1 | <?php |
||
2 | /* |
||
3 | * Copyright (C) 2020-2024 Joe Zegarra. |
||
4 | * |
||
5 | * This library is free software; you can redistribute it and/or |
||
6 | * modify it under the terms of the GNU Lesser General Public |
||
7 | * License as published by the Free Software Foundation; either |
||
8 | * version 3 of the License, or (at your option) any later version. |
||
9 | * |
||
10 | * This library is distributed in the hope that it will be useful, |
||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
||
13 | * Lesser General Public License for more details. |
||
14 | * |
||
15 | * You should have received a copy of the GNU Lesser General Public |
||
16 | * License along with this library; if not, write to the Free Software |
||
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
||
18 | * MA 02110-1301 USA |
||
19 | */ |
||
20 | |||
21 | namespace FacturaScripts\Plugins\fsRepublicaDominicana; |
||
22 | |||
23 | use FacturaScripts\Core\Base\AjaxForms\SalesLineHTML; |
||
24 | use FacturaScripts\Core\Base\AjaxForms\SalesFooterHTML; |
||
25 | use FacturaScripts\Core\Base\AjaxForms\PurchasesFooterHTML; |
||
26 | use FacturaScripts\Core\Base\Calculator; |
||
27 | use FacturaScripts\Core\Base\DataBase; |
||
28 | use FacturaScripts\Core\Base\DataBase\DataBaseWhere; |
||
29 | use FacturaScripts\Core\Base\InitClass; |
||
30 | use FacturaScripts\Core\Model\Impuesto; |
||
31 | use FacturaScripts\Core\Plugins; |
||
1 ignored issue
–
show
|
|||
32 | use FacturaScripts\Dinamic\Controller\SendTicket; |
||
1 ignored issue
–
show
The type
FacturaScripts\Dinamic\Controller\SendTicket was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
33 | use FacturaScripts\Dinamic\Lib\AssetManager; |
||
34 | use FacturaScripts\Dinamic\Lib\Tickets\RepDominicana; |
||
1 ignored issue
–
show
The type
FacturaScripts\Dinamic\Lib\Tickets\RepDominicana was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
35 | use FacturaScripts\Dinamic\Model\Cliente; |
||
36 | use FacturaScripts\Dinamic\Model\EstadoDocumento; |
||
37 | use FacturaScripts\Dinamic\Model\FacturaCliente; |
||
38 | use FacturaScripts\Dinamic\Model\Proveedor; |
||
39 | use FacturaScripts\Dinamic\Model\FacturaProveedor; |
||
40 | use FacturaScripts\Plugins\fsRepublicaDominicana\Model\ImpuestoProducto; |
||
41 | use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFRango; |
||
42 | use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFTipo; |
||
43 | use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFTipoAnulacion; |
||
44 | use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFTipoMovimiento; |
||
45 | use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFTipoPago; |
||
46 | |||
47 | /** |
||
48 | * Description of Init |
||
49 | * |
||
50 | * @author Joe Zegarra |
||
51 | */ |
||
52 | class Init extends InitClass |
||
53 | { |
||
54 | public function init(): void |
||
55 | { |
||
56 | $this->loadExtension(new Extension\Model\Cliente()); |
||
57 | $this->loadExtension(new Extension\Model\FacturaCliente()); |
||
58 | $this->loadExtension(new Extension\Model\FacturaProveedor()); |
||
59 | $this->loadExtension(new Extension\Model\Producto()); |
||
60 | $this->loadExtension(new Extension\Controller\EditCliente()); |
||
61 | $this->loadExtension(new Extension\Controller\EditProveedor()); |
||
62 | $this->loadExtension(new Extension\Controller\EditFacturaCliente()); |
||
63 | $this->loadExtension(new Extension\Controller\EditFacturaProveedor()); |
||
64 | $this->loadExtension(new Extension\Controller\EditProducto()); |
||
65 | $this->loadExtension(new Extension\Controller\EditSettings()); |
||
66 | |||
67 | AssetManager::add('js', \FS_ROUTE . '/Plugins/fsRepublicaDominicana/Assets/JS/CommonDomFunctions.js'); |
||
68 | SalesLineHTML::addMod(new Mod\SalesLineMod()); |
||
69 | SalesFooterHTML::addMod(new Mod\SalesFooterMod()); |
||
70 | PurchasesFooterHTML::addMod(new Mod\PurchasesFooterMod()); |
||
71 | Calculator::addMod(new Mod\CalculatorMod()); |
||
72 | |||
73 | if (Plugins::isEnabled('Tickets')) { |
||
74 | SendTicket::addFormat(RepDominicana::class, 'FacturaCliente', 'dominicana'); |
||
75 | } |
||
76 | } |
||
77 | |||
78 | private function actualizarEstados(): void |
||
79 | { |
||
80 | $arrayDocumentos = [ |
||
81 | 'FacturaCliente', |
||
82 | 'FacturaProveedor', |
||
83 | 'AlbaranCliente', |
||
84 | 'AlbaranProveedor', |
||
85 | 'PedidoCliente', |
||
86 | 'PedidoProveedor' |
||
87 | ]; |
||
88 | $estados = new EstadoDocumento(); |
||
89 | |||
90 | foreach ($arrayDocumentos as $documento) { |
||
91 | $lista = $estados->all( |
||
92 | [ |
||
93 | new DataBaseWhere('nombre', 'Anulada'), |
||
94 | new DataBaseWhere('tipodoc', $documento) |
||
95 | ] |
||
96 | ); |
||
97 | |||
98 | if (count($lista) === 0) { |
||
99 | $nuevoDocumento = new EstadoDocumento(); |
||
100 | $nuevoDocumento->nombre = 'Anulada'; |
||
101 | $nuevoDocumento->tipodoc = $documento; |
||
102 | $nuevoDocumento->icon = 'fas fa-handshake-slash'; |
||
103 | $nuevoDocumento->editable = false; |
||
104 | $nuevoDocumento->bloquear = true; |
||
105 | $nuevoDocumento->actualizastock = 0; |
||
106 | $nuevoDocumento->predeterminado = false; |
||
107 | $nuevoDocumento->save(); |
||
108 | } |
||
109 | } |
||
110 | } |
||
111 | |||
112 | private function actualizarNumeroNCF(): void |
||
113 | { |
||
114 | $dataBase = new DataBase(); |
||
115 | $dataBase->exec("UPDATE facturascli SET numeroncf = numero2 WHERE numero2 != '' and tipocomprobante != '' AND numeroncf is null;"); |
||
116 | $dataBase->exec("UPDATE facturasprov SET numeroncf = numproveedor WHERE numproveedor != '' and tipocomprobante != '' AND numeroncf is null;"); |
||
117 | } |
||
118 | |||
119 | private function actualizarImpuestos(): void |
||
120 | { |
||
121 | $impuesto = new Impuesto(); |
||
122 | $isc = $impuesto->get('ISC'); |
||
123 | if ($isc === false) { |
||
124 | $isc = new Impuesto(); |
||
125 | $isc->codimpuesto = 'ISC'; |
||
126 | $isc->descripcion = 'ISC 10%'; |
||
127 | $isc->iva = 10; |
||
128 | $isc->recargo = 0; |
||
129 | $isc->tipo = 1; |
||
130 | $isc->save(); |
||
131 | } |
||
132 | |||
133 | $cdt = $impuesto->get('CDT'); |
||
134 | if ($cdt === false) { |
||
135 | $cdt = new Impuesto(); |
||
136 | $cdt->codimpuesto = 'CDT'; |
||
137 | $cdt->descripcion = 'CDT 2%'; |
||
138 | $cdt->iva = 2; |
||
139 | $cdt->recargo = 0; |
||
140 | $cdt->tipo = 1; |
||
141 | $cdt->save(); |
||
142 | } |
||
143 | } |
||
144 | |||
145 | public function update() |
||
146 | { |
||
147 | new NCFTipoPago(); |
||
148 | new NCFTipoAnulacion(); |
||
149 | new NCFTipoMovimiento(); |
||
150 | new NCFTipo(); |
||
151 | new NCFRango(); |
||
152 | new Cliente(); |
||
153 | new FacturaCliente(); |
||
154 | new Proveedor(); |
||
155 | new FacturaProveedor(); |
||
156 | new ImpuestoProducto(); |
||
157 | $this->actualizarEstados(); |
||
158 | $this->actualizarNumeroNCF(); |
||
159 | $this->actualizarImpuestos(); |
||
160 | } |
||
161 | } |
||
162 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths