Skip to content

Commit 99099d8

Browse files
author
Daniel Fernández Giménez
committed
añadidos filtros en presupuestos, pedidos, albaranes y facturas de venta para buscar el servicio
1 parent c081496 commit 99099d8

12 files changed

Lines changed: 357 additions & 79 deletions
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* This file is part of Servicios plugin for FacturaScripts
4+
* Copyright (C) 2026 Carlos Garcia Gomez <carlos@facturascripts.com>
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Lesser General Public License as
8+
* published by the Free Software Foundation, either version 3 of the
9+
* License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
20+
namespace FacturaScripts\Plugins\Servicios\Extension\Controller;
21+
22+
use Closure;
23+
24+
/**
25+
* @author Daniel Fernandez Giménez <contacto@danielfg.es>
26+
*/
27+
class ListAlbaranCliente
28+
{
29+
public function createViews(): Closure
30+
{
31+
return function() {
32+
$this->tab($this->getmainViewName())
33+
->addFilterAutocomplete('service', 'service', 'idservicio', 'serviciosat', 'idservicio', 'codigo');
34+
};
35+
}
36+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* This file is part of Servicios plugin for FacturaScripts
4+
* Copyright (C) 2026 Carlos Garcia Gomez <carlos@facturascripts.com>
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Lesser General Public License as
8+
* published by the Free Software Foundation, either version 3 of the
9+
* License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
20+
namespace FacturaScripts\Plugins\Servicios\Extension\Controller;
21+
22+
use Closure;
23+
24+
/**
25+
* @author Daniel Fernandez Giménez <contacto@danielfg.es>
26+
*/
27+
class ListFacturaCliente
28+
{
29+
public function createViews(): Closure
30+
{
31+
return function() {
32+
$this->tab($this->getmainViewName())
33+
->addFilterAutocomplete('service', 'service', 'idservicio', 'serviciosat', 'idservicio', 'codigo');
34+
};
35+
}
36+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* This file is part of Servicios plugin for FacturaScripts
4+
* Copyright (C) 2026 Carlos Garcia Gomez <carlos@facturascripts.com>
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Lesser General Public License as
8+
* published by the Free Software Foundation, either version 3 of the
9+
* License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
20+
namespace FacturaScripts\Plugins\Servicios\Extension\Controller;
21+
22+
use Closure;
23+
24+
/**
25+
* @author Daniel Fernandez Giménez <contacto@danielfg.es>
26+
*/
27+
class ListPedidoCliente
28+
{
29+
public function createViews(): Closure
30+
{
31+
return function() {
32+
$this->tab($this->getmainViewName())
33+
->addFilterAutocomplete('service', 'service', 'idservicio', 'serviciosat', 'idservicio', 'codigo');
34+
};
35+
}
36+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
/**
3+
* This file is part of Servicios plugin for FacturaScripts
4+
* Copyright (C) 2026 Carlos Garcia Gomez <carlos@facturascripts.com>
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Lesser General Public License as
8+
* published by the Free Software Foundation, either version 3 of the
9+
* License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
20+
namespace FacturaScripts\Plugins\Servicios\Extension\Controller;
21+
22+
use Closure;
23+
24+
/**
25+
* @author Daniel Fernandez Giménez <contacto@danielfg.es>
26+
*/
27+
class ListPresupuestoCliente
28+
{
29+
public function createViews(): Closure
30+
{
31+
return function() {
32+
$this->tab($this->getmainViewName())
33+
->addFilterAutocomplete('service', 'service', 'idservicio', 'serviciosat', 'idservicio', 'codigo');
34+
};
35+
}
36+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
* This file is part of Servicios plugin for FacturaScripts
4+
* Copyright (C) 2026 Carlos Garcia Gomez <carlos@facturascripts.com>
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Lesser General Public License as
8+
* published by the Free Software Foundation, either version 3 of the
9+
* License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*
19+
* @author Daniel Fernández Giménez <contacto@danielfg.es>
20+
*/
21+
-->
22+
<view>
23+
<columns>
24+
<column name="service" display="none" order="300">
25+
<widget type="select" fieldname="idservicio">
26+
<values source="serviciosat" fieldcode="idservicio" fieldtitle="codigo"/>
27+
</widget>
28+
</column>
29+
</columns>
30+
</view>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
* This file is part of Servicios plugin for FacturaScripts
4+
* Copyright (C) 2026 Carlos Garcia Gomez <carlos@facturascripts.com>
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Lesser General Public License as
8+
* published by the Free Software Foundation, either version 3 of the
9+
* License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*
19+
* @author Daniel Fernández Giménez <contacto@danielfg.es>
20+
*/
21+
-->
22+
<view>
23+
<columns>
24+
<column name="service" display="none" order="300">
25+
<widget type="select" fieldname="idservicio">
26+
<values source="serviciosat" fieldcode="idservicio" fieldtitle="codigo"/>
27+
</widget>
28+
</column>
29+
</columns>
30+
</view>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
* This file is part of Servicios plugin for FacturaScripts
4+
* Copyright (C) 2026 Carlos Garcia Gomez <carlos@facturascripts.com>
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Lesser General Public License as
8+
* published by the Free Software Foundation, either version 3 of the
9+
* License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*
19+
* @author Daniel Fernández Giménez <contacto@danielfg.es>
20+
*/
21+
-->
22+
<view>
23+
<columns>
24+
<column name="service" display="none" order="300">
25+
<widget type="select" fieldname="idservicio">
26+
<values source="serviciosat" fieldcode="idservicio" fieldtitle="codigo"/>
27+
</widget>
28+
</column>
29+
</columns>
30+
</view>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
* This file is part of Servicios plugin for FacturaScripts
4+
* Copyright (C) 2026 Carlos Garcia Gomez <carlos@facturascripts.com>
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Lesser General Public License as
8+
* published by the Free Software Foundation, either version 3 of the
9+
* License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*
19+
* @author Daniel Fernández Giménez <contacto@danielfg.es>
20+
*/
21+
-->
22+
<view>
23+
<columns>
24+
<column name="service" display="none" order="300">
25+
<widget type="select" fieldname="idservicio">
26+
<values source="serviciosat" fieldcode="idservicio" fieldtitle="codigo"/>
27+
</widget>
28+
</column>
29+
</columns>
30+
</view>

Init.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ public function init(): void
5151
$this->loadExtension(new Extension\Controller\CopyModel());
5252
$this->loadExtension(new Extension\Controller\EditCliente());
5353
$this->loadExtension(new Extension\Controller\EditProducto());
54+
$this->loadExtension(new Extension\Controller\ListAlbaranCliente());
55+
$this->loadExtension(new Extension\Controller\ListFacturaCliente());
56+
$this->loadExtension(new Extension\Controller\ListPedidoCliente());
57+
$this->loadExtension(new Extension\Controller\ListPresupuestoCliente());
5458

5559
// tickets
5660
if (Plugins::isEnabled('Tickets')) {

Mod/SalesHeaderHTMLMod.php

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
use FacturaScripts\Core\Contract\SalesModInterface;
2323
use FacturaScripts\Core\Model\Base\SalesDocument;
2424
use FacturaScripts\Core\Tools;
25-
25+
use FacturaScripts\Dinamic\Model\ServicioAT;
2626

2727
class SalesHeaderHTMLMod implements SalesModInterface
2828
{
@@ -72,9 +72,14 @@ private static function servicioBtn(SalesDocument $model): string
7272
return '';
7373
}
7474

75+
$service = new ServicioAT();
76+
if (false === $service->load($model->{'idservicio'})) {
77+
return '';
78+
}
79+
7580
return '<div class="col-sm-auto">'
7681
. '<div class="mb-2">'
77-
. '<a href="EditServicioAT?code=' . $model->{'idservicio'} . '" class="btn btn-warning text-black">'
82+
. '<a href="' . $service->url() . '" class="btn btn-warning text-black">'
7883
. '<i class="fa-solid fa-headset"></i> ' . Tools::trans('service')
7984
. '</a>'
8085
. '</div>'
@@ -83,11 +88,20 @@ private static function servicioBtn(SalesDocument $model): string
8388

8489
private static function servicio(SalesDocument $model): string
8590
{
86-
return $model->hasColumn('idservicio') && false === empty($model->{'idservicio'}) ? '<div class="col-sm-6">'
91+
if (false === $model->hasColumn('idservicio') || empty($model->{'idservicio'})) {
92+
return '';
93+
}
94+
95+
$service = new ServicioAT();
96+
if (false === $service->load($model->{'idservicio'})) {
97+
return '';
98+
}
99+
100+
return '<div class="col-sm-6">'
87101
. '<div class="mb-3">'
88-
. '<a href="EditServicioAT?code=' . $model->{'idservicio'} . '">' . Tools::trans('service') . '</a>'
89-
. '<input type="text" value="' . $model->{'idservicio'} . '" class="form-control" disabled />'
102+
. '<a href="' . $service->url() . '">' . Tools::trans('service') . '</a>'
103+
. '<input type="text" value="' . $service->codigo . '" class="form-control" disabled />'
90104
. '</div>'
91-
. '</div>' : '';
105+
. '</div>';
92106
}
93107
}

0 commit comments

Comments
 (0)