|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* Copyright (C) 2019 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 NCFTipoPago |
|
30
|
|
|
* |
|
31
|
|
|
* @author Joe Zegarra |
|
32
|
|
|
*/ |
|
33
|
|
|
class NCFTipoPago 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 $tipopago; |
|
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 Payment types |
|
61
|
|
|
* @var array |
|
62
|
|
|
*/ |
|
63
|
|
|
public $arrayTipos = array( |
|
64
|
|
|
array ('tipopago'=>'01','codigo' => '17', 'descripcion' => 'EFECTIVO','estado'=>true), |
|
65
|
|
|
array ('tipopago'=>'01','codigo' => '18', 'descripcion' => 'CHEQUES/TRANSFERENCIAS/DEPOSITO','estado'=>true), |
|
66
|
|
|
array ('tipopago'=>'01','codigo' => '19', 'descripcion' => 'TARJETA CRÉDITO/DÉBITO','estado'=>true), |
|
67
|
|
|
array ('tipopago'=>'01','codigo' => '20', 'descripcion' => 'VENTA A CREDITO','estado'=>true), |
|
68
|
|
|
array ('tipopago'=>'01','codigo' => '21', 'descripcion' => 'BONOS O CERTIFICADOS DE REGALO','estado'=>true), |
|
69
|
|
|
array ('tipopago'=>'01','codigo' => '22', 'descripcion' => 'PERMUTA','estado'=>true), |
|
70
|
|
|
array ('tipopago'=>'01','codigo' => '23', 'descripcion' => 'OTRAS FORMAS DE VENTAS','estado'=>true), |
|
71
|
|
|
array ('tipopago'=>'02','codigo' => '01', 'descripcion' => 'EFECTIVO','estado'=>true), |
|
72
|
|
|
array ('tipopago'=>'02','codigo' => '02', 'descripcion' => 'CHEQUES/TRANSFERENCIAS/DEPOSITO','estado'=>true), |
|
73
|
|
|
array ('tipopago'=>'02','codigo' => '03', 'descripcion' => 'TARJETA CRÉDITO/DÉBITO','estado'=>true), |
|
74
|
|
|
array ('tipopago'=>'02','codigo' => '04', 'descripcion' => 'COMPRA A CREDITO','estado'=>true), |
|
75
|
|
|
array ('tipopago'=>'02','codigo' => '05', 'descripcion' => 'PERMUTA','estado'=>true), |
|
76
|
|
|
array ('tipopago'=>'02','codigo' => '06', 'descripcion' => 'NOTA DE CREDITO','estado'=>true), |
|
77
|
|
|
array ('tipopago'=>'02','codigo' => '07', 'descripcion' => 'MIXTO','estado'=>true) |
|
78
|
|
|
); |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* |
|
82
|
|
|
* @return string |
|
83
|
|
|
*/ |
|
84
|
|
|
public static function primaryColumn() |
|
85
|
|
|
{ |
|
86
|
|
|
return 'codigo'; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* |
|
91
|
|
|
* @return string |
|
92
|
|
|
*/ |
|
93
|
|
|
public static function tableName() |
|
94
|
|
|
{ |
|
95
|
|
|
return 'rd_ncftipopagos'; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* |
|
100
|
|
|
* @return string |
|
101
|
|
|
*/ |
|
102
|
|
|
public function install() |
|
103
|
|
|
{ |
|
104
|
|
|
parent::install(); |
|
105
|
|
|
return "INSERT INTO rd_ncftipopagos (tipopago, codigo, descripcion, estado) VALUES " . |
|
106
|
|
|
"('01','17','EFECTIVO',true), " . |
|
107
|
|
|
"('01','18','CHEQUES/TRANSFERENCIAS/DEPOSITO',true), " . |
|
108
|
|
|
"('01','19','TARJETA CRÉDITO/DÉBITO',true), " . |
|
109
|
|
|
"('01','20','VENTA A CRÉDITO',true), " . |
|
110
|
|
|
"('01','21','BONOS O CERTIFICADOS DE REGALO',true), " . |
|
111
|
|
|
"('01','22','PERMUTA',true), " . |
|
112
|
|
|
"('01','23','OTRAS FORMAS DE VENTAS',true), " . |
|
113
|
|
|
"('02','01','EFECTIVO',true), " . |
|
114
|
|
|
"('02','02','CHEQUES/TRANSFERENCIAS/DEPOSITO',true), " . |
|
115
|
|
|
"('02','03','TARJETA CRÉDITO/DÉBITO',true), " . |
|
116
|
|
|
"('02','04','COMPRA A CREDITO',true), " . |
|
117
|
|
|
"('02','05','PERMUTA',true), " . |
|
118
|
|
|
"('02','06','NOTA DE CREDITO',true), " . |
|
119
|
|
|
"('02','07','MIXTO',true);"; |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
public function restoreData() |
|
123
|
|
|
{ |
|
124
|
|
|
$dataBase = new DataBase(); |
|
125
|
|
|
$sqlClean = "DELETE FROM " . $this->tableName() . ";"; |
|
126
|
|
|
$dataBase->exec($sqlClean); |
|
127
|
|
|
foreach ($this->arrayTipos as $arrayItem) { |
|
128
|
|
|
$initialData = new NCFTipoMovimiento($arrayItem); |
|
129
|
|
|
$initialData->save(); |
|
130
|
|
|
} |
|
131
|
|
|
$this->clear(); |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
public function findAllByTipopago(string $tipopago) |
|
135
|
|
|
{ |
|
136
|
|
|
$where = [new DataBaseWhere('tipopago', $tipopago)]; |
|
137
|
|
|
return $this->all($where, ['codigo' => 'ASC'], 0, 50); |
|
138
|
|
|
} |
|
139
|
|
|
} |
|
140
|
|
|
|
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