joenilson /
fsRepublicaDominicana
| 1 | <?php |
||
| 2 | /* |
||
| 3 | * Copyright (C) 2020 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\DataBase; |
||
|
0 ignored issues
–
show
|
|||
| 24 | use FacturaScripts\Core\Base\DataBase\DataBaseWhere; |
||
|
0 ignored issues
–
show
The type
FacturaScripts\Core\Base\DataBase\DataBaseWhere 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 Loading history...
|
|||
| 25 | use FacturaScripts\Core\Base\InitClass; |
||
|
0 ignored issues
–
show
The type
FacturaScripts\Core\Base\InitClass 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 Loading history...
|
|||
| 26 | use FacturaScripts\Core\Model\Impuesto; |
||
|
0 ignored issues
–
show
The type
FacturaScripts\Core\Model\Impuesto 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 Loading history...
|
|||
| 27 | use FacturaScripts\Dinamic\Lib\AssetManager; |
||
|
0 ignored issues
–
show
The type
FacturaScripts\Dinamic\Lib\AssetManager 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 Loading history...
|
|||
| 28 | use FacturaScripts\Dinamic\Model\Cliente; |
||
|
0 ignored issues
–
show
The type
FacturaScripts\Dinamic\Model\Cliente 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 Loading history...
|
|||
| 29 | use FacturaScripts\Dinamic\Model\EstadoDocumento; |
||
|
0 ignored issues
–
show
The type
FacturaScripts\Dinamic\Model\EstadoDocumento 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 Loading history...
|
|||
| 30 | use FacturaScripts\Dinamic\Model\FacturaCliente; |
||
|
0 ignored issues
–
show
The type
FacturaScripts\Dinamic\Model\FacturaCliente 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 Loading history...
|
|||
| 31 | use FacturaScripts\Dinamic\Model\Proveedor; |
||
|
0 ignored issues
–
show
The type
FacturaScripts\Dinamic\Model\Proveedor 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 Loading history...
|
|||
| 32 | use FacturaScripts\Dinamic\Model\FacturaProveedor; |
||
|
0 ignored issues
–
show
The type
FacturaScripts\Dinamic\Model\FacturaProveedor 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 Loading history...
|
|||
| 33 | use FacturaScripts\Plugins\fsRepublicaDominicana\Model\ImpuestoProducto; |
||
| 34 | use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFRango; |
||
| 35 | use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFTipo; |
||
| 36 | use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFTipoAnulacion; |
||
| 37 | use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFTipoMovimiento; |
||
| 38 | use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFTipoPago; |
||
| 39 | |||
| 40 | use FacturaScripts\Core\Base\AjaxForms\SalesLineHTML; |
||
|
0 ignored issues
–
show
The type
FacturaScripts\Core\Base\AjaxForms\SalesLineHTML 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 Loading history...
|
|||
| 41 | use FacturaScripts\Core\Base\AjaxForms\SalesFooterHTML; |
||
|
0 ignored issues
–
show
The type
FacturaScripts\Core\Base\AjaxForms\SalesFooterHTML 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 Loading history...
|
|||
| 42 | use FacturaScripts\Core\Base\AjaxForms\PurchasesFooterHTML; |
||
|
0 ignored issues
–
show
The type
FacturaScripts\Core\Base...rms\PurchasesFooterHTML 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 Loading history...
|
|||
| 43 | use FacturaScripts\Core\Base\Calculator; |
||
|
0 ignored issues
–
show
The type
FacturaScripts\Core\Base\Calculator 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 Loading history...
|
|||
| 44 | |||
| 45 | /** |
||
| 46 | * Description of Init |
||
| 47 | * |
||
| 48 | * @author Joe Zegarra |
||
| 49 | */ |
||
| 50 | class Init extends InitClass |
||
| 51 | { |
||
| 52 | public function init(): void |
||
| 53 | { |
||
| 54 | $this->loadExtension(new Extension\Model\Cliente()); |
||
| 55 | $this->loadExtension(new Extension\Model\FacturaCliente()); |
||
| 56 | $this->loadExtension(new Extension\Model\FacturaProveedor()); |
||
| 57 | $this->loadExtension(new Extension\Model\Producto()); |
||
| 58 | $this->loadExtension(new Extension\Controller\EditCliente()); |
||
| 59 | $this->loadExtension(new Extension\Controller\EditProveedor()); |
||
| 60 | $this->loadExtension(new Extension\Controller\EditFacturaCliente()); |
||
| 61 | $this->loadExtension(new Extension\Controller\EditFacturaProveedor()); |
||
| 62 | $this->loadExtension(new Extension\Controller\EditProducto()); |
||
| 63 | $this->loadExtension(new Extension\Controller\EditSettings()); |
||
| 64 | AssetManager::add('js', \FS_ROUTE . '/Plugins/fsRepublicaDominicana/Assets/JS/CommonDomFunctions.js'); |
||
|
0 ignored issues
–
show
|
|||
| 65 | SalesLineHTML::addMod(new Mod\SalesLineMod()); |
||
| 66 | SalesFooterHTML::addMod(new Mod\SalesFooterMod()); |
||
| 67 | PurchasesFooterHTML::addMod(new Mod\PurchasesFooterMod()); |
||
| 68 | Calculator::addMod(new Mod\CalculatorMod()); |
||
| 69 | } |
||
| 70 | |||
| 71 | private function actualizarEstados(): void |
||
| 72 | { |
||
| 73 | $arrayDocumentos = [ |
||
| 74 | 'FacturaCliente', |
||
| 75 | 'FacturaProveedor', |
||
| 76 | 'AlbaranCliente', |
||
| 77 | 'AlbaranProveedor', |
||
| 78 | 'PedidoCliente', |
||
| 79 | 'PedidoProveedor' |
||
| 80 | ]; |
||
| 81 | $estados = new EstadoDocumento(); |
||
| 82 | |||
| 83 | foreach ($arrayDocumentos as $documento) { |
||
| 84 | $lista = $estados->all( |
||
| 85 | [ |
||
| 86 | new DataBaseWhere('nombre', 'Anulada'), |
||
| 87 | new DataBaseWhere('tipodoc', $documento) |
||
| 88 | ] |
||
| 89 | ); |
||
| 90 | |||
| 91 | if (count($lista) === 0) { |
||
| 92 | $nuevoDocumento = new EstadoDocumento(); |
||
| 93 | $nuevoDocumento->nombre = 'Anulada'; |
||
| 94 | $nuevoDocumento->tipodoc = $documento; |
||
| 95 | $nuevoDocumento->icon = 'fas fa-handshake-slash'; |
||
| 96 | $nuevoDocumento->editable = false; |
||
| 97 | $nuevoDocumento->bloquear = true; |
||
| 98 | $nuevoDocumento->actualizastock = 0; |
||
| 99 | $nuevoDocumento->predeterminado = false; |
||
| 100 | $nuevoDocumento->save(); |
||
| 101 | } |
||
| 102 | } |
||
| 103 | } |
||
| 104 | |||
| 105 | private function actualizarNumeroNCF(): void |
||
| 106 | { |
||
| 107 | $dataBase = new DataBase(); |
||
| 108 | $dataBase->exec("UPDATE facturascli SET numeroncf = numero2 WHERE numero2 != '' and tipocomprobante != '' AND numeroncf is null;"); |
||
| 109 | $dataBase->exec("UPDATE facturasprov SET numeroncf = numproveedor WHERE numproveedor != '' and tipocomprobante != '' AND numeroncf is null;"); |
||
| 110 | } |
||
| 111 | |||
| 112 | private function actualizarImpuestos(): void |
||
| 113 | { |
||
| 114 | $impuesto = new Impuesto(); |
||
| 115 | $isc = $impuesto->get('ISC'); |
||
| 116 | if ($isc === false) { |
||
| 117 | $isc = new Impuesto(); |
||
| 118 | $isc->codimpuesto = 'ISC'; |
||
| 119 | $isc->descripcion = 'ISC 10%'; |
||
| 120 | $isc->iva = 10; |
||
| 121 | $isc->recargo = 0; |
||
| 122 | $isc->tipo = 1; |
||
| 123 | $isc->save(); |
||
| 124 | } |
||
| 125 | |||
| 126 | $cdt = $impuesto->get('CDT'); |
||
| 127 | if ($cdt === false) { |
||
| 128 | $cdt = new Impuesto(); |
||
| 129 | $cdt->codimpuesto = 'CDT'; |
||
| 130 | $cdt->descripcion = 'CDT 2%'; |
||
| 131 | $cdt->iva = 2; |
||
| 132 | $cdt->recargo = 0; |
||
| 133 | $cdt->tipo = 1; |
||
| 134 | $cdt->save(); |
||
| 135 | } |
||
| 136 | } |
||
| 137 | |||
| 138 | public function update() |
||
| 139 | { |
||
| 140 | new NCFTipoPago(); |
||
| 141 | new NCFTipoAnulacion(); |
||
| 142 | new NCFTipoMovimiento(); |
||
| 143 | new NCFTipo(); |
||
| 144 | new NCFRango(); |
||
| 145 | new Cliente(); |
||
| 146 | new FacturaCliente(); |
||
| 147 | new Proveedor(); |
||
| 148 | new FacturaProveedor(); |
||
| 149 | new ImpuestoProducto(); |
||
| 150 | $this->actualizarEstados(); |
||
| 151 | $this->actualizarNumeroNCF(); |
||
| 152 | $this->actualizarImpuestos(); |
||
| 153 | } |
||
| 154 | } |
||
| 155 |
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