joenilson /
fsRepublicaDominicana
| 1 | <?php |
||
| 2 | /* |
||
| 3 | * Copyright (C) 2022 Joe Nilson <[email protected]> |
||
| 4 | * |
||
| 5 | * This program is free software: you can redistribute it and/or modify |
||
| 6 | * it under the terms of the GNU Lesser General Public License as |
||
| 7 | * published by the Free Software Foundation, either version 3 of the |
||
| 8 | * License, or (at your option) any later version. |
||
| 9 | * |
||
| 10 | * This program 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 |
||
| 13 | * GNU Lesser General Public License for more details. |
||
| 14 | * You should have received a copy of the GNU Lesser General Public License |
||
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
| 16 | */ |
||
| 17 | |||
| 18 | namespace FacturaScripts\Plugins\fsRepublicaDominicana\Model\Join; |
||
| 19 | |||
| 20 | use FacturaScripts\Core\Model\Base\JoinModel; |
||
|
0 ignored issues
–
show
|
|||
| 21 | use FacturaScripts\Core\Tools; |
||
| 22 | |||
| 23 | |||
| 24 | class FiscalReports extends JoinModel |
||
| 25 | { |
||
| 26 | const MAIN_TABLE = 'facturascli'; |
||
| 27 | const SECONDARY_TABLE = 'facturascli AS f2'; |
||
| 28 | const SECONDARY_TABLE_ALIAS = 'f2'; |
||
| 29 | const LINES_TABLE = 'lineasfacturascli'; |
||
| 30 | const ALMACENES_TABLE = 'almacenes'; |
||
| 31 | const NCFTIPO_TABLE = 'rd_ncftipo'; |
||
| 32 | const NCFTIPOMOV_TABLE = 'rd_ncftipomovimiento'; |
||
| 33 | const NCFTIPOANUL_TABLE = 'rd_ncftipoanulacion'; |
||
| 34 | const NCFTIPOPAGO_TABLE = 'rd_ncftipopagos'; |
||
| 35 | const ESTADOSDOC_TABLE = 'estados_documentos'; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * |
||
| 39 | * @return array |
||
| 40 | */ |
||
| 41 | protected function getFields(): array |
||
| 42 | { |
||
| 43 | $dateFormat = (FS_DB_TYPE === 'postgresql') ? "to_char" : "date_format"; |
||
|
0 ignored issues
–
show
|
|||
| 44 | $dateFormatString = (FS_DB_TYPE === 'postgresql') ? "YYYYMMDD" : "%Y%m%d"; |
||
|
0 ignored issues
–
show
|
|||
| 45 | |||
| 46 | $data = [ |
||
| 47 | 'idfactura' => static::MAIN_TABLE.'.idfactura', |
||
| 48 | 'idempresa' => static::MAIN_TABLE.'.idempresa', |
||
| 49 | 'fecha' => static::MAIN_TABLE.'.fecha', |
||
| 50 | 'codalmacen' => static::MAIN_TABLE.'.codalmacen', |
||
| 51 | 'almacen' => static::ALMACENES_TABLE.'.nombre', |
||
| 52 | 'cliente' => static::MAIN_TABLE.'.nombrecliente', |
||
| 53 | 'cifnif' => static::MAIN_TABLE.'.cifnif', |
||
| 54 | 'ncf' => static::MAIN_TABLE.'.numeroncf', |
||
| 55 | 'baseimponible' => 'sum(case when '.static::LINES_TABLE.'.iva != 0 then '.static::LINES_TABLE.'.pvptotal else 0 end)', |
||
| 56 | 'baseexenta' => 'sum(case when '.static::LINES_TABLE.'.iva = 0 then '.static::LINES_TABLE.'.pvptotal else 0 end)', |
||
| 57 | 'itbis' => static::MAIN_TABLE.'.totaliva', |
||
| 58 | 'total' => static::MAIN_TABLE.'.total', |
||
| 59 | 'pagada' => static::MAIN_TABLE.'.pagada', |
||
| 60 | 'estado' => static::ESTADOSDOC_TABLE.'.nombre', |
||
| 61 | 'ncfmodifica' => static::SECONDARY_TABLE_ALIAS.'.numeroncf', |
||
| 62 | 'tipocomprobante' => static::NCFTIPO_TABLE.'.descripcion', |
||
| 63 | 'tipopago' => static::NCFTIPOPAGO_TABLE.'.descripcion', |
||
| 64 | 'tipomovimiento' => static::NCFTIPOMOV_TABLE.'.descripcion', |
||
| 65 | 'tipoanulacion' => static::NCFTIPOANUL_TABLE.'.descripcion', |
||
| 66 | ]; |
||
| 67 | return $data; |
||
| 68 | } |
||
| 69 | |||
| 70 | /** |
||
| 71 | * |
||
| 72 | * @return string |
||
| 73 | */ |
||
| 74 | protected function getGroupFields(): string |
||
| 75 | { |
||
| 76 | return static::MAIN_TABLE.'.idfactura, '. |
||
| 77 | static::MAIN_TABLE.'.idempresa, '. |
||
| 78 | static::MAIN_TABLE.'.fecha, '. |
||
| 79 | static::MAIN_TABLE.'.codalmacen, '. |
||
| 80 | static::ALMACENES_TABLE.'.nombre, '. |
||
| 81 | static::MAIN_TABLE.'.nombrecliente, '. |
||
| 82 | static::MAIN_TABLE.'.cifnif, '. |
||
| 83 | static::MAIN_TABLE.'.numeroncf, '. |
||
| 84 | static::MAIN_TABLE.'.total, '. |
||
| 85 | static::MAIN_TABLE.'.totaliva, '. |
||
| 86 | static::MAIN_TABLE.'.pagada, '. |
||
| 87 | static::ESTADOSDOC_TABLE.'.nombre, '. |
||
| 88 | static::SECONDARY_TABLE_ALIAS.'.numeroncf, '. |
||
| 89 | static::NCFTIPO_TABLE.'.descripcion, '. |
||
| 90 | static::NCFTIPOPAGO_TABLE.'.descripcion, '. |
||
| 91 | static::NCFTIPOMOV_TABLE.'.descripcion, '. |
||
| 92 | static::NCFTIPOANUL_TABLE.'.descripcion'; |
||
| 93 | } |
||
| 94 | |||
| 95 | /** |
||
| 96 | * |
||
| 97 | * @return string |
||
| 98 | */ |
||
| 99 | protected function getSQLFrom(): string |
||
| 100 | { |
||
| 101 | return static::MAIN_TABLE |
||
| 102 | . ' LEFT JOIN ' . static::LINES_TABLE . ' ON (' |
||
| 103 | . static::MAIN_TABLE . '.idfactura = ' . static::LINES_TABLE . '.idfactura)' |
||
| 104 | . ' LEFT JOIN '. static::SECONDARY_TABLE . ' ON (' |
||
| 105 | . static::MAIN_TABLE . '.idfacturarect = ' . static::SECONDARY_TABLE_ALIAS . '.idfactura)' |
||
| 106 | . ' LEFT JOIN '. static::ALMACENES_TABLE . ' ON (' |
||
| 107 | . static::MAIN_TABLE . '.codalmacen = ' . static::ALMACENES_TABLE . '.codalmacen)' |
||
| 108 | . ' LEFT JOIN '. static::NCFTIPO_TABLE . ' ON (' |
||
| 109 | . static::MAIN_TABLE . '.tipocomprobante = ' . static::NCFTIPO_TABLE . '.tipocomprobante)' |
||
| 110 | . ' LEFT JOIN ' . static::NCFTIPOPAGO_TABLE . ' ON (' |
||
| 111 | . static::MAIN_TABLE . '.ncftipopago = ' . static::NCFTIPOPAGO_TABLE . '.codigo)' |
||
| 112 | . ' LEFT JOIN ' . static::NCFTIPOMOV_TABLE . ' ON (' |
||
| 113 | . static::MAIN_TABLE . '.ncftipomovimiento = ' . static::NCFTIPOMOV_TABLE . '.codigo)' |
||
| 114 | . ' LEFT JOIN ' . static::NCFTIPOANUL_TABLE . ' ON (' |
||
| 115 | . static::MAIN_TABLE . '.ncftipoanulacion = ' . static::NCFTIPOANUL_TABLE . '.codigo)' |
||
| 116 | . ' LEFT JOIN ' . static::ESTADOSDOC_TABLE . ' ON (' |
||
| 117 | . static::MAIN_TABLE . '.idestado = ' . static::ESTADOSDOC_TABLE . '.idestado)'; |
||
| 118 | } |
||
| 119 | |||
| 120 | /** |
||
| 121 | * |
||
| 122 | * @return array |
||
| 123 | */ |
||
| 124 | protected function getTables(): array |
||
| 125 | { |
||
| 126 | return [ |
||
| 127 | static::MAIN_TABLE, |
||
| 128 | static::ALMACENES_TABLE, |
||
| 129 | static::LINES_TABLE, |
||
| 130 | static::NCFTIPO_TABLE, |
||
| 131 | static::NCFTIPOANUL_TABLE, |
||
| 132 | static::NCFTIPOMOV_TABLE, |
||
| 133 | static::NCFTIPOPAGO_TABLE, |
||
| 134 | static::ESTADOSDOC_TABLE |
||
| 135 | ]; |
||
| 136 | } |
||
| 137 | } |
||
| 138 |
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