1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* Copyright (C) 2020 Joe Zegarra. |
5
|
|
|
* |
6
|
|
|
* This library is free software; you can redistribute it and/or |
7
|
|
|
* modify it under the terms of the GNU Lesser General Public |
8
|
|
|
* License as published by the Free Software Foundation; either |
9
|
|
|
* version 3 of the License, or (at your option) any later version. |
10
|
|
|
* |
11
|
|
|
* This library 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 GNU |
14
|
|
|
* Lesser General Public License for more details. |
15
|
|
|
* |
16
|
|
|
* You should have received a copy of the GNU Lesser General Public |
17
|
|
|
* License along with this library; if not, write to the Free Software |
18
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
19
|
|
|
* MA 02110-1301 USA |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
namespace FacturaScripts\Plugins\fsRepublicaDominicana\Model; |
23
|
|
|
|
24
|
|
|
use FacturaScripts\Core\Base\DataBase; |
|
|
|
|
25
|
|
|
use FacturaScripts\Core\Base\DataBase\DataBaseWhere; |
|
|
|
|
26
|
|
|
use FacturaScripts\Core\Model\Base; |
|
|
|
|
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Description of NCFTipoMovimiento |
30
|
|
|
* |
31
|
|
|
* @author Joe Zegarra |
32
|
|
|
*/ |
33
|
|
|
class NCFTipoMovimiento extends Base\ModelClass |
|
|
|
|
34
|
|
|
{ |
35
|
|
|
use Base\ModelTrait; |
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* two digit string to identify the Payment Type |
38
|
|
|
* sales|purchase 01|02 options |
39
|
|
|
* @var string |
40
|
|
|
*/ |
41
|
|
|
public $tipomovimiento; |
42
|
|
|
/** |
43
|
|
|
* two digit string to identify the Payment Code |
44
|
|
|
* @var string |
45
|
|
|
*/ |
46
|
|
|
public $codigo; |
47
|
|
|
/** |
48
|
|
|
* The description of the Payment Type |
49
|
|
|
* @var string |
50
|
|
|
*/ |
51
|
|
|
public $descripcion; |
52
|
|
|
/** |
53
|
|
|
* The status of the record |
54
|
|
|
* @var bool |
55
|
|
|
*/ |
56
|
|
|
public $estado; |
57
|
|
|
|
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* List of Movement types |
61
|
|
|
* @var array |
62
|
|
|
*/ |
63
|
|
|
private $arrayTiposMovimiento = [ |
64
|
|
|
['tipomovimiento'=>'COM','codigo' => '01', 'descripcion' => 'GASTOS DE PERSONAL', 'estado' => true], |
65
|
|
|
['tipomovimiento'=>'COM','codigo' => '02', 'descripcion' => 'GASTOS POR TRABAJOS, SUMINISTROS Y SERVICIOS', 'estado' => true], |
66
|
|
|
['tipomovimiento'=>'COM','codigo' => '03', 'descripcion' => 'ARRENDAMIENTOS', 'estado' => true], |
67
|
|
|
['tipomovimiento'=>'COM','codigo' => '04', 'descripcion' => 'GASTOS DE ACTIVOS FIJOS', 'estado' => true], |
68
|
|
|
['tipomovimiento'=>'COM','codigo' => '05', 'descripcion' => 'GASTOS DE REPRESENTACIÓN', 'estado' => true], |
69
|
|
|
['tipomovimiento'=>'COM','codigo' => '06', 'descripcion' => 'OTRAS DEDUCCIONES ADMITIDAS', 'estado' => true], |
70
|
|
|
['tipomovimiento'=>'COM','codigo' => '07', 'descripcion' => 'GASTOS FINANCIEROS', 'estado' => true], |
71
|
|
|
['tipomovimiento'=>'COM','codigo' => '08', 'descripcion' => 'GASTOS EXTRAORDINARIOS', 'estado' => true], |
72
|
|
|
['tipomovimiento'=>'COM','codigo' => '09', 'descripcion' => 'COMPRAS Y GASTOS QUE FORMARÁN PARTE DEL COSTO DE VENTA', 'estado' => true], |
73
|
|
|
['tipomovimiento'=>'COM','codigo' => '10', 'descripcion' => 'ADQUISICIONES DE ACTIVOS', 'estado' => true], |
74
|
|
|
['tipomovimiento'=>'COM','codigo' => '11', 'descripcion' => 'GASTOS DE SEGUROS', 'estado' => true], |
75
|
|
|
['tipomovimiento'=>'VEN','codigo' => '1', 'descripcion' => 'Ingresos por operaciones (No financieros)', 'estado' => true], |
76
|
|
|
['tipomovimiento'=>'VEN','codigo' => '2', 'descripcion' => 'Ingresos Financieros', 'estado' => true], |
77
|
|
|
['tipomovimiento'=>'VEN','codigo' => '3', 'descripcion' => 'Ingresos Extraordinarios', 'estado' => true], |
78
|
|
|
['tipomovimiento'=>'VEN','codigo' => '4', 'descripcion' => 'Ingresos por Arrendamientos', 'estado' => true], |
79
|
|
|
['tipomovimiento'=>'VEN','codigo' => '5', 'descripcion' => 'Ingresos por Venta de Activo Depreciable', 'estado' => true], |
80
|
|
|
['tipomovimiento'=>'VEN','codigo' => '6', 'descripcion' => 'Otros Ingresos', 'estado' => true] |
81
|
|
|
]; |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* @return string |
85
|
|
|
*/ |
86
|
|
|
public static function primaryColumn(): string |
87
|
|
|
{ |
88
|
|
|
return 'id'; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @return string |
93
|
|
|
*/ |
94
|
|
|
public static function tableName(): string |
95
|
|
|
{ |
96
|
|
|
return 'rd_ncftipomovimiento'; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return string |
101
|
|
|
*/ |
102
|
|
|
public function install(): string |
103
|
|
|
{ |
104
|
|
|
parent::install(); |
105
|
|
|
return "INSERT INTO rd_ncftipomovimiento (tipomovimiento, codigo, descripcion, estado) VALUES " . |
106
|
|
|
"('COM','01','GASTOS DE PERSONAL',true), ". |
107
|
|
|
"('COM','02','GASTOS POR TRABAJOS, SUMINISTROS Y SERVICIOS',true), ". |
108
|
|
|
"('COM','03','ARRENDAMIENTOS',true), ". |
109
|
|
|
"('COM','04','GASTOS DE ACTIVOS FIJOS',true), ". |
110
|
|
|
"('COM','05','GASTOS DE REPRESENTACIÓN',true), ". |
111
|
|
|
"('COM','06','OTRAS DEDUCCIONES ADMITIDAS',true), ". |
112
|
|
|
"('COM','07','GASTOS FINANCIEROS',true), ". |
113
|
|
|
"('COM','08','GASTOS EXTRAORDINARIOS',true), ". |
114
|
|
|
"('COM','09','COMPRAS Y GASTOS QUE FORMARÁN PARTE DEL COSTO DE VENTA',true), ". |
115
|
|
|
"('COM','10','ADQUISICIONES DE ACTIVOS',true), ". |
116
|
|
|
"('COM','11','GASTOS DE SEGUROS',true), ". |
117
|
|
|
"('VEN','1','Ingresos por operaciones (No financieros)',true), ". |
118
|
|
|
"('VEN','2','Ingresos Financieros',true), ". |
119
|
|
|
"('VEN','3','Ingresos Extraordinarios',true), ". |
120
|
|
|
"('VEN','4','Ingresos por Arrendamientos',true), ". |
121
|
|
|
"('VEN','5','Ingresos por Venta de Activo Depreciable',true), ". |
122
|
|
|
"('VEN','6','Otros Ingresos',true);"; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
public function restoreData() |
126
|
|
|
{ |
127
|
|
|
$dataBase = new DataBase(); |
128
|
|
|
$sqlClean = "DELETE FROM " . $this->tableName() . ";"; |
129
|
|
|
$dataBase->exec($sqlClean); |
130
|
|
|
foreach ($this->arrayTiposMovimiento as $arrayItem) { |
131
|
|
|
$initialData = new NCFTipoMovimiento($arrayItem); |
132
|
|
|
$initialData->save(); |
133
|
|
|
} |
134
|
|
|
$this->clear(); |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
public function findAllByTipomovimiento(string $tipomovimiento): array |
138
|
|
|
{ |
139
|
|
|
$where = [new DataBaseWhere('tipomovimiento', $tipomovimiento)]; |
140
|
|
|
return $this->all($where, ['codigo' => 'ASC'], 0, 50); |
141
|
|
|
} |
142
|
|
|
} |
143
|
|
|
|
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