|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
* Copyright (C) 2022 Joe Nilson <[email protected]> |
|
4
|
|
|
* |
|
5
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
6
|
|
|
* it under the terms of the GNU Lesser General Public License as |
|
7
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
8
|
|
|
* License, or (at your option) any later version. |
|
9
|
|
|
* |
|
10
|
|
|
* This program 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 |
|
13
|
|
|
* GNU Lesser General Public License for more details. |
|
14
|
|
|
* You should have received a copy of the GNU Lesser General Public License |
|
15
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16
|
|
|
*/ |
|
17
|
|
|
|
|
18
|
|
|
namespace FacturaScripts\Plugins\fsRepublicaDominicana\Controller; |
|
19
|
|
|
|
|
20
|
|
|
use FacturaScripts\Core\Base\DataBase\DataBaseWhere; |
|
|
|
|
|
|
21
|
|
|
use FacturaScripts\Core\Lib\ExtendedController\ListController; |
|
|
|
|
|
|
22
|
|
|
use FacturaScripts\Plugins\fsRepublicaDominicana\Lib\WebserviceDgii; |
|
23
|
|
|
use FacturaScripts\Plugins\fsRepublicaDominicana\Model\RNCDGIIDB; |
|
24
|
|
|
|
|
25
|
|
|
class ConsultaDGII extends ListController |
|
26
|
|
|
{ |
|
27
|
|
|
public function getPageData(): array |
|
28
|
|
|
{ |
|
29
|
|
|
$pageData = parent::getPageData(); |
|
30
|
|
|
$pageData['menu'] = 'accounting'; |
|
31
|
|
|
$pageData['submenu'] = 'Republica Dominicana'; |
|
32
|
|
|
$pageData['title'] = 'ncf-dgii-db'; |
|
33
|
|
|
$pageData['icon'] = 'fas fa-file-archive'; |
|
34
|
|
|
|
|
35
|
|
|
return $pageData; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function addUpdateButton($viewName) |
|
39
|
|
|
{ |
|
40
|
|
|
$updateButton = [ |
|
41
|
|
|
'color' => 'warning', |
|
42
|
|
|
'icon' => 'fas fa-file-archive', |
|
43
|
|
|
'label' => 'update-dgiidb-data', |
|
44
|
|
|
'title' => 'update-dgiidb-data', |
|
45
|
|
|
'type' => 'action', |
|
46
|
|
|
'action' => 'update-data', |
|
47
|
|
|
'hint' => 'update-dgiidb-data', |
|
48
|
|
|
'confirm' => true |
|
49
|
|
|
]; |
|
50
|
|
|
$this->addButton($viewName, $updateButton); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
protected function createViews() |
|
54
|
|
|
{ |
|
55
|
|
|
$this->addView('ConsultaDGII', 'RNCDGIIDB'); |
|
56
|
|
|
$this->addSearchFields('ConsultaDGII', ['rnc', 'nombre', 'razonsocial', 'estado'], 'rnc'); |
|
57
|
|
|
$this->addOrderBy('ConsultaDGII', ['rnc', ], 'rnc'); |
|
58
|
|
|
$this->addOrderBy('ConsultaDGII', ['nombre'], 'nombre'); |
|
59
|
|
|
$this->addOrderBy('ConsultaDGII', ['razonsocial'], 'razonsocial'); |
|
60
|
|
|
$this->addOrderBy('ConsultaDGII', ['estado'], 'estado'); |
|
61
|
|
|
$this->addUpdateButton('ConsultaDGII'); |
|
62
|
|
|
|
|
63
|
|
|
$estados = [ |
|
64
|
|
|
['code' => 'ACTIVO', 'description' => 'Activo'], |
|
65
|
|
|
['code' => 'SUSPENDIDO', 'description' => 'Suspendido'], |
|
66
|
|
|
['code' => 'DADO DE BAJA', 'description' => 'Dado de Baja'], |
|
67
|
|
|
['code' => 'RECHAZADO', 'description' => 'Rechazado'], |
|
68
|
|
|
['code' => 'ANULADO', 'description' => 'Anulado'], |
|
69
|
|
|
['code' => 'CESE TEMPORAL', 'description' => 'Cese Temporal'], |
|
70
|
|
|
]; |
|
71
|
|
|
$this->addFilterSelect('ConsultaDGII', 'estado', 'status', 'estado', $estados); |
|
72
|
|
|
$this->addFilterPeriod('ConsultaDGII', 'inicioactividad', 'period', 'inicioactividad'); |
|
73
|
|
|
|
|
74
|
|
|
$this->setSettings('ConsultaDGII', 'clickable', false); |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
protected function execAfterAction($action) |
|
78
|
|
|
{ |
|
79
|
|
|
switch ($action) { |
|
80
|
|
|
case 'update-data': |
|
81
|
|
|
$this->views['ConsultaDGII']->model->updateFile(); |
|
82
|
|
|
$this->views['ConsultaDGII']->model->clear(); |
|
83
|
|
|
$this->toolBox()->i18nLog()->notice('updated-rnc-data'); |
|
84
|
|
|
|
|
85
|
|
|
break; |
|
86
|
|
|
case 'busca_rnc': |
|
87
|
|
|
$this->setTemplate(false); |
|
88
|
|
|
$this->views['ConsultaDGII']->model->clear(); |
|
89
|
|
|
$registros = $this->views['ConsultaDGII']->model->count(); |
|
90
|
|
|
if ($registros !== 0) { |
|
91
|
|
|
$resultado = $this->views['ConsultaDGII']->model->get($_REQUEST['cifnif']); |
|
92
|
|
|
if ($resultado) { |
|
93
|
|
|
$arrayResultado = []; |
|
94
|
|
|
$arrayResultado["RGE_RUC"] = $resultado->rnc; |
|
95
|
|
|
$arrayResultado["RGE_NOMBRE"] = $resultado->nombre; |
|
96
|
|
|
$arrayResultado["NOMBRE_COMERCIAL"] = $resultado->razonsocial; |
|
97
|
|
|
$arrayResultado["ESTATUS"] = $resultado->estado; |
|
98
|
|
|
echo json_encode($arrayResultado); |
|
99
|
|
|
} else { |
|
100
|
|
|
echo '{"RGE_ERROR": "true", "message": "RNC No encontrado."}'; |
|
101
|
|
|
} |
|
102
|
|
|
} else { |
|
103
|
|
|
echo '{"RGE_ERROR": "true", "message": "La tabla de RNC está vacia, por favor Ejecute la actualización de RNC."}'; |
|
104
|
|
|
} |
|
105
|
|
|
break; |
|
106
|
|
|
default: |
|
107
|
|
|
break; |
|
108
|
|
|
} |
|
109
|
|
|
parent::execPreviousAction($action); |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
|
|
113
|
|
|
} |
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