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