joenilson /
fsRepublicaDominicana
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Copyright (C) 2019-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\Model; |
||
| 22 | |||
| 23 | use FacturaScripts\Core\Template\ModelClass; |
||
|
0 ignored issues
–
show
|
|||
| 24 | use FacturaScripts\Core\Template\ModelTrait; |
||
|
0 ignored issues
–
show
The type
FacturaScripts\Core\Template\ModelTrait 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\Tools; |
||
| 26 | |||
| 27 | use FacturaScripts\Core\Base\DataBase; |
||
|
0 ignored issues
–
show
The type
FacturaScripts\Core\Base\DataBase 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 | |||
| 29 | /** |
||
| 30 | * Description of NCFRango |
||
| 31 | * |
||
| 32 | * @author Joe Zegarra |
||
| 33 | */ |
||
| 34 | class NCFRango extends ModelClass |
||
| 35 | { |
||
| 36 | use ModelTrait; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * The key of all the records |
||
| 40 | * @var int |
||
| 41 | */ |
||
| 42 | public $id; |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Authorization number gived by DGII |
||
| 46 | * @var int |
||
| 47 | */ |
||
| 48 | public $autorizacion; |
||
| 49 | |||
| 50 | /** |
||
| 51 | * Old record for printing area |
||
| 52 | * @var string |
||
| 53 | * @deprecated since version 2017.50 added only for migration purposes |
||
| 54 | */ |
||
| 55 | public $areaimpresion; |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Old record for warehouse location |
||
| 59 | * @var string |
||
| 60 | * @deprecated since version 2017.50 added only for migration purposes |
||
| 61 | */ |
||
| 62 | public $codalmacen; |
||
| 63 | |||
| 64 | /** |
||
| 65 | * Old record for cash or credit payment rule |
||
| 66 | * @var bool |
||
| 67 | * @deprecated since version 2017.50 |
||
| 68 | */ |
||
| 69 | public $contado; |
||
| 70 | |||
| 71 | /** |
||
| 72 | * The next number to assign for a NCF number |
||
| 73 | * @var int |
||
| 74 | */ |
||
| 75 | public $correlativo; |
||
| 76 | |||
| 77 | /** |
||
| 78 | * Old record for business unit where had been generated the NCF |
||
| 79 | * @var string |
||
| 80 | * @deprecated since version 2017.50 |
||
| 81 | */ |
||
| 82 | public $division; |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Status of the record true or false, true if active |
||
| 86 | * @var bool |
||
| 87 | */ |
||
| 88 | public $estado; |
||
| 89 | |||
| 90 | /** |
||
| 91 | * Record creation date |
||
|
0 ignored issues
–
show
The type
FacturaScripts\Plugins\f...caDominicana\Model\date 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...
|
|||
| 92 | * @var date |
||
| 93 | */ |
||
| 94 | public $fechacreacion; |
||
| 95 | |||
| 96 | /** |
||
| 97 | * Record modification date |
||
| 98 | * @var date |
||
| 99 | */ |
||
| 100 | public $fechamodificacion; |
||
| 101 | |||
| 102 | /** |
||
| 103 | * NCF Authorization expiration date |
||
| 104 | * @var date |
||
| 105 | */ |
||
| 106 | public $fechavencimiento; |
||
| 107 | |||
| 108 | /** |
||
| 109 | * Compnay id for who the records is created |
||
| 110 | * @var int |
||
| 111 | */ |
||
| 112 | public $idempresa; |
||
| 113 | |||
| 114 | /** |
||
| 115 | * Old record for point of NCF generation |
||
| 116 | * @var string |
||
| 117 | * @deprecated since version 2017.50 |
||
| 118 | */ |
||
| 119 | public $puntoemision; |
||
| 120 | |||
| 121 | /** |
||
| 122 | * Start number for the DGII NCF sequence |
||
| 123 | * @var int |
||
| 124 | */ |
||
| 125 | public $secuenciainicio; |
||
| 126 | /** |
||
| 127 | * Last number for the DGII NCF sequence |
||
| 128 | * @var int |
||
| 129 | */ |
||
| 130 | public $secuenciafin; |
||
| 131 | |||
| 132 | /** |
||
| 133 | * The letter assigned to the NCF sequence |
||
| 134 | * @var string |
||
| 135 | */ |
||
| 136 | public $serie; |
||
| 137 | |||
| 138 | /** |
||
| 139 | * The request number generated in the DGII Virtual Office for the NCF sequence |
||
| 140 | * @var int |
||
| 141 | */ |
||
| 142 | public $solicitud; |
||
| 143 | |||
| 144 | /** |
||
| 145 | * The NCF type for this sequence |
||
| 146 | * @var string |
||
| 147 | */ |
||
| 148 | public $tipocomprobante; |
||
| 149 | |||
| 150 | /** |
||
| 151 | * The user nickname that created the record |
||
| 152 | * @var string |
||
| 153 | */ |
||
| 154 | public $usuariocreacion; |
||
| 155 | |||
| 156 | /** |
||
| 157 | * The user nickname that modified the record |
||
| 158 | * @var string |
||
| 159 | */ |
||
| 160 | public $usuariomodificacion; |
||
| 161 | |||
| 162 | public static function primaryColumn(): string |
||
| 163 | { |
||
| 164 | return 'id'; |
||
| 165 | } |
||
| 166 | |||
| 167 | public static function tableName(): string |
||
| 168 | { |
||
| 169 | return 'rd_ncfrango'; |
||
| 170 | } |
||
| 171 | |||
| 172 | protected function saveUpdate(array $values = array()): bool |
||
| 173 | { |
||
| 174 | if ($this->id and isset($this->usuariomodificacion_view)) { |
||
| 175 | $this->fechamodificacion = \date('d-m-Y'); |
||
|
0 ignored issues
–
show
It seems like
date('d-m-Y') of type string is incompatible with the declared type FacturaScripts\Plugins\f...caDominicana\Model\date of property $fechamodificacion.
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. Loading history...
|
|||
| 176 | $this->usuariomodificacion = $this->usuariomodificacion_view; |
||
| 177 | } |
||
| 178 | return parent::saveUpdate($values); |
||
| 179 | } |
||
| 180 | |||
| 181 | public function getByTipoComprobante($idempresa, $tipocomprobante) |
||
| 182 | { |
||
| 183 | $dataBase = new DataBase(); |
||
| 184 | $sql = 'SELECT * FROM ' |
||
| 185 | . $this->tableName() |
||
| 186 | . ' WHERE idempresa = ' |
||
| 187 | . $idempresa |
||
| 188 | . ' AND tipocomprobante = ' |
||
| 189 | . $dataBase->var2str($tipocomprobante) |
||
| 190 | . ' AND estado = ' . $dataBase->var2str(true) |
||
| 191 | . ' AND correlativo <= secuenciafin ' |
||
| 192 | . ';'; |
||
| 193 | $data = $dataBase->select($sql); |
||
| 194 | if (empty($data) === true || in_array($data[0], [null, ''], true)) { |
||
| 195 | return false; |
||
| 196 | } |
||
| 197 | return new NCFRango($data[0]); |
||
| 198 | } |
||
| 199 | |||
| 200 | public function generateNCF() |
||
| 201 | { |
||
| 202 | return $this->serie |
||
| 203 | . $this->tipocomprobante |
||
| 204 | . \str_pad($this->correlativo, 8, '0', STR_PAD_LEFT); |
||
| 205 | } |
||
| 206 | } |
||
| 207 |
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