@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | protected function saveUpdate(array $values = array()) |
| 175 | 175 | { |
| 176 | - if($this->id and isset($this->usuariomodificacion_view)) { |
|
| 176 | + if ($this->id and isset($this->usuariomodificacion_view)) { |
|
| 177 | 177 | $this->fechamodificacion = \date('d-m-Y'); |
| 178 | 178 | $this->usuariomodificacion = $this->usuariomodificacion_view; |
| 179 | 179 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | . $idempresa |
| 190 | 190 | . ' AND tipocomprobante = ' |
| 191 | 191 | . $dataBase->var2str($tipocomprobante) |
| 192 | - . ' AND estado = ' . $dataBase->var2str(true) |
|
| 192 | + . ' AND estado = '.$dataBase->var2str(true) |
|
| 193 | 193 | . ';'; |
| 194 | 194 | $data = $dataBase->select($sql); |
| 195 | 195 | if ($data[0] === '') { |
@@ -36,14 +36,14 @@ discard block |
||
| 36 | 36 | 'idempresa' => static::MAIN_TABLE.'.idempresa', |
| 37 | 37 | 'codalmacen' => static::MAIN_TABLE.'.codalmacen', |
| 38 | 38 | 'ncf' => static::MAIN_TABLE.'.numero2', |
| 39 | - 'tipoanulacion' => 'CASE WHEN ' . |
|
| 40 | - static::ESTADOSDOC_TABLE . '.nombre = \'Anulada\' AND ' . |
|
| 41 | - static::MAIN_TABLE.'.ncftipoanulacion is null ' . |
|
| 42 | - 'THEN CONCAT(\'05\',\' - \',\'Corrección de la Información\') ELSE ' . |
|
| 43 | - 'concat(' . static::MAIN_TABLE.'.ncftipoanulacion, \' - \', ' . |
|
| 39 | + 'tipoanulacion' => 'CASE WHEN '. |
|
| 40 | + static::ESTADOSDOC_TABLE.'.nombre = \'Anulada\' AND '. |
|
| 41 | + static::MAIN_TABLE.'.ncftipoanulacion is null '. |
|
| 42 | + 'THEN CONCAT(\'05\',\' - \',\'Corrección de la Información\') ELSE '. |
|
| 43 | + 'concat('.static::MAIN_TABLE.'.ncftipoanulacion, \' - \', '. |
|
| 44 | 44 | static::NCFCANCELTYPE_TABLE.'.descripcion) END', |
| 45 | 45 | 'fecha' => 'to_char('.static::MAIN_TABLE.'.fecha,\'YYYYMMDD\')', |
| 46 | - 'estado' => 'CASE WHEN ' . static::ESTADOSDOC_TABLE . |
|
| 46 | + 'estado' => 'CASE WHEN '.static::ESTADOSDOC_TABLE. |
|
| 47 | 47 | '.nombre = \'Emitida\' THEN \'Activo\' ELSE \'Anulado\' END', |
| 48 | 48 | ]; |
| 49 | 49 | return $data; |
@@ -56,10 +56,10 @@ discard block |
||
| 56 | 56 | protected function getSQLFrom(): string |
| 57 | 57 | { |
| 58 | 58 | return static::MAIN_TABLE |
| 59 | - . ' JOIN ' . static::ESTADOSDOC_TABLE . ' ON (' |
|
| 60 | - . static::MAIN_TABLE . '.idestado = ' . static::ESTADOSDOC_TABLE . '.idestado AND '.static::ESTADOSDOC_TABLE.'.nombre = \'Anulada\')' |
|
| 61 | - . ' LEFT JOIN ' . static::NCFCANCELTYPE_TABLE . ' ON (' |
|
| 62 | - . static::MAIN_TABLE . '.ncftipoanulacion = ' . static::NCFCANCELTYPE_TABLE . '.codigo)'; |
|
| 59 | + . ' JOIN '.static::ESTADOSDOC_TABLE.' ON (' |
|
| 60 | + . static::MAIN_TABLE.'.idestado = '.static::ESTADOSDOC_TABLE.'.idestado AND '.static::ESTADOSDOC_TABLE.'.nombre = \'Anulada\')' |
|
| 61 | + . ' LEFT JOIN '.static::NCFCANCELTYPE_TABLE.' ON (' |
|
| 62 | + . static::MAIN_TABLE.'.ncftipoanulacion = '.static::NCFCANCELTYPE_TABLE.'.codigo)'; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -71,10 +71,10 @@ |
||
| 71 | 71 | protected function getSQLFrom(): string |
| 72 | 72 | { |
| 73 | 73 | return static::MAIN_TABLE |
| 74 | - . ' LEFT JOIN '. static::SECONDARY_TABLE . ' ON (' |
|
| 75 | - . static::MAIN_TABLE . '.idfacturarect = ' . static::SECONDARY_TABLE_ALIAS . '.idfactura)' |
|
| 76 | - . ' LEFT JOIN ' . static::ESTADOSDOC_TABLE . ' ON (' |
|
| 77 | - . static::MAIN_TABLE . '.idestado = ' . static::ESTADOSDOC_TABLE . '.idestado)'; |
|
| 74 | + . ' LEFT JOIN '.static::SECONDARY_TABLE.' ON (' |
|
| 75 | + . static::MAIN_TABLE.'.idfacturarect = '.static::SECONDARY_TABLE_ALIAS.'.idfactura)' |
|
| 76 | + . ' LEFT JOIN '.static::ESTADOSDOC_TABLE.' ON (' |
|
| 77 | + . static::MAIN_TABLE.'.idestado = '.static::ESTADOSDOC_TABLE.'.idestado)'; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
@@ -69,16 +69,16 @@ discard block |
||
| 69 | 69 | protected function getGroupFields(): string |
| 70 | 70 | { |
| 71 | 71 | //return parent::getGroupFields(); // TODO: Change the autogenerated stub |
| 72 | - return static::MAIN_TABLE.'.idempresa, ' . |
|
| 73 | - static::MAIN_TABLE.'.codalmacen, ' . |
|
| 74 | - static::MAIN_TABLE.'.cifnif, ' . |
|
| 75 | - static::MAIN_TABLE.'.ncftipomovimiento, ' . |
|
| 76 | - static::MAIN_TABLE.'.numproveedor, ' . |
|
| 77 | - static::SECONDARY_TABLE_ALIAS.'.numproveedor, ' . |
|
| 78 | - static::MAIN_TABLE.'.fecha, ' . |
|
| 79 | - static::ESTADOSDOC_TABLE.'.nombre, ' . |
|
| 80 | - static::MAIN_TABLE.'.neto, ' . |
|
| 81 | - static::MAIN_TABLE.'.totaliva' . |
|
| 72 | + return static::MAIN_TABLE.'.idempresa, '. |
|
| 73 | + static::MAIN_TABLE.'.codalmacen, '. |
|
| 74 | + static::MAIN_TABLE.'.cifnif, '. |
|
| 75 | + static::MAIN_TABLE.'.ncftipomovimiento, '. |
|
| 76 | + static::MAIN_TABLE.'.numproveedor, '. |
|
| 77 | + static::SECONDARY_TABLE_ALIAS.'.numproveedor, '. |
|
| 78 | + static::MAIN_TABLE.'.fecha, '. |
|
| 79 | + static::ESTADOSDOC_TABLE.'.nombre, '. |
|
| 80 | + static::MAIN_TABLE.'.neto, '. |
|
| 81 | + static::MAIN_TABLE.'.totaliva'. |
|
| 82 | 82 | ' '; |
| 83 | 83 | } |
| 84 | 84 | |
@@ -89,14 +89,14 @@ discard block |
||
| 89 | 89 | protected function getSQLFrom(): string |
| 90 | 90 | { |
| 91 | 91 | return static::MAIN_TABLE |
| 92 | - . ' LEFT JOIN '. static::SECONDARY_TABLE . ' ON (' |
|
| 93 | - . static::MAIN_TABLE . '.idfacturarect = ' . static::SECONDARY_TABLE_ALIAS . '.idfactura)' |
|
| 94 | - . ' LEFT JOIN '. static::LINES_TABLE . ' ON (' |
|
| 95 | - . static::MAIN_TABLE . '.idfactura = ' . static::LINES_TABLE . '.idfactura)' |
|
| 96 | - . ' LEFT JOIN '. static::PRODS_TABLE . ' ON (' |
|
| 97 | - . static::LINES_TABLE . '.referencia = ' . static::PRODS_TABLE . '.referencia)' |
|
| 98 | - . ' LEFT JOIN ' . static::ESTADOSDOC_TABLE . ' ON (' |
|
| 99 | - . static::MAIN_TABLE . '.idestado = ' . static::ESTADOSDOC_TABLE . '.idestado)'; |
|
| 92 | + . ' LEFT JOIN '.static::SECONDARY_TABLE.' ON (' |
|
| 93 | + . static::MAIN_TABLE.'.idfacturarect = '.static::SECONDARY_TABLE_ALIAS.'.idfactura)' |
|
| 94 | + . ' LEFT JOIN '.static::LINES_TABLE.' ON (' |
|
| 95 | + . static::MAIN_TABLE.'.idfactura = '.static::LINES_TABLE.'.idfactura)' |
|
| 96 | + . ' LEFT JOIN '.static::PRODS_TABLE.' ON (' |
|
| 97 | + . static::LINES_TABLE.'.referencia = '.static::PRODS_TABLE.'.referencia)' |
|
| 98 | + . ' LEFT JOIN '.static::ESTADOSDOC_TABLE.' ON (' |
|
| 99 | + . static::MAIN_TABLE.'.idestado = '.static::ESTADOSDOC_TABLE.'.idestado)'; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -94,22 +94,22 @@ |
||
| 94 | 94 | protected function getSQLFrom(): string |
| 95 | 95 | { |
| 96 | 96 | return static::MAIN_TABLE |
| 97 | - . ' LEFT JOIN ' . static::LINES_TABLE . ' ON (' |
|
| 98 | - . static::MAIN_TABLE . '.idfactura = ' . static::LINES_TABLE . '.idfactura)' |
|
| 99 | - . ' LEFT JOIN '. static::SECONDARY_TABLE . ' ON (' |
|
| 100 | - . static::MAIN_TABLE . '.idfacturarect = ' . static::SECONDARY_TABLE_ALIAS . '.idfactura)' |
|
| 101 | - . ' LEFT JOIN '. static::ALMACENES_TABLE . ' ON (' |
|
| 102 | - . static::MAIN_TABLE . '.codalmacen = ' . static::ALMACENES_TABLE . '.codalmacen)' |
|
| 103 | - . ' LEFT JOIN '. static::NCFTIPO_TABLE . ' ON (' |
|
| 104 | - . static::MAIN_TABLE . '.tipocomprobante = ' . static::NCFTIPO_TABLE . '.tipocomprobante)' |
|
| 105 | - . ' LEFT JOIN ' . static::NCFTIPOPAGO_TABLE . ' ON (' |
|
| 106 | - . static::MAIN_TABLE . '.ncftipopago = ' . static::NCFTIPOPAGO_TABLE . '.codigo)' |
|
| 107 | - . ' LEFT JOIN ' . static::NCFTIPOMOV_TABLE . ' ON (' |
|
| 108 | - . static::MAIN_TABLE . '.ncftipomovimiento = ' . static::NCFTIPOMOV_TABLE . '.codigo)' |
|
| 109 | - . ' LEFT JOIN ' . static::NCFTIPOANUL_TABLE . ' ON (' |
|
| 110 | - . static::MAIN_TABLE . '.ncftipoanulacion = ' . static::NCFTIPOANUL_TABLE . '.codigo)' |
|
| 111 | - . ' LEFT JOIN ' . static::ESTADOSDOC_TABLE . ' ON (' |
|
| 112 | - . static::MAIN_TABLE . '.idestado = ' . static::ESTADOSDOC_TABLE . '.idestado)'; |
|
| 97 | + . ' LEFT JOIN '.static::LINES_TABLE.' ON (' |
|
| 98 | + . static::MAIN_TABLE.'.idfactura = '.static::LINES_TABLE.'.idfactura)' |
|
| 99 | + . ' LEFT JOIN '.static::SECONDARY_TABLE.' ON (' |
|
| 100 | + . static::MAIN_TABLE.'.idfacturarect = '.static::SECONDARY_TABLE_ALIAS.'.idfactura)' |
|
| 101 | + . ' LEFT JOIN '.static::ALMACENES_TABLE.' ON (' |
|
| 102 | + . static::MAIN_TABLE.'.codalmacen = '.static::ALMACENES_TABLE.'.codalmacen)' |
|
| 103 | + . ' LEFT JOIN '.static::NCFTIPO_TABLE.' ON (' |
|
| 104 | + . static::MAIN_TABLE.'.tipocomprobante = '.static::NCFTIPO_TABLE.'.tipocomprobante)' |
|
| 105 | + . ' LEFT JOIN '.static::NCFTIPOPAGO_TABLE.' ON (' |
|
| 106 | + . static::MAIN_TABLE.'.ncftipopago = '.static::NCFTIPOPAGO_TABLE.'.codigo)' |
|
| 107 | + . ' LEFT JOIN '.static::NCFTIPOMOV_TABLE.' ON (' |
|
| 108 | + . static::MAIN_TABLE.'.ncftipomovimiento = '.static::NCFTIPOMOV_TABLE.'.codigo)' |
|
| 109 | + . ' LEFT JOIN '.static::NCFTIPOANUL_TABLE.' ON (' |
|
| 110 | + . static::MAIN_TABLE.'.ncftipoanulacion = '.static::NCFTIPOANUL_TABLE.'.codigo)' |
|
| 111 | + . ' LEFT JOIN '.static::ESTADOSDOC_TABLE.' ON (' |
|
| 112 | + . static::MAIN_TABLE.'.idestado = '.static::ESTADOSDOC_TABLE.'.idestado)'; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | /** |
@@ -16,13 +16,13 @@ |
||
| 16 | 16 | * along with fsRepublicaDominicana. If not, see <http://www.gnu.org/licenses/>. |
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | - namespace FacturaScripts\Plugins\fsRepublicaDominicana\Extension\Model; |
|
| 19 | + namespace FacturaScripts\Plugins\fsRepublicaDominicana\Extension\Model; |
|
| 20 | 20 | |
| 21 | - class Producto |
|
| 22 | - { |
|
| 21 | + class Producto |
|
| 22 | + { |
|
| 23 | 23 | /** |
| 24 | 24 | * This field is to determinate if the product is a service or a good |
| 25 | 25 | * @var boolean |
| 26 | 26 | */ |
| 27 | 27 | public $esservicio; |
| 28 | - } |
|
| 28 | + } |
|
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | public function saveInsert() |
| 49 | 49 | { |
| 50 | - return function () { |
|
| 51 | - $ArrayTipoNCFCompras = ['11','12','16','17']; |
|
| 50 | + return function() { |
|
| 51 | + $ArrayTipoNCFCompras = ['11', '12', '16', '17']; |
|
| 52 | 52 | $ncfrango = new NCFRango(); |
| 53 | 53 | $cliente = new Proveedor(); |
| 54 | 54 | $appSettings = new AppSettings; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $tipocomprobante = $this->tipocomprobante; |
| 58 | 58 | $ncfRangoToUse = $ncfrango->getByTipoComprobante($actualProveedor->idempresa, $tipocomprobante); |
| 59 | 59 | |
| 60 | - if(in_array($tipocomprobante, $ArrayTipoNCFCompras, true)) { |
|
| 60 | + if (in_array($tipocomprobante, $ArrayTipoNCFCompras, true)) { |
|
| 61 | 61 | $ncf = $ncfRangoToUse->generateNCF(); |
| 62 | 62 | $this->numproveedor = $ncf; |
| 63 | 63 | $this->ncffechavencimiento = $ncfRangoToUse->fechavencimiento; |