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 | |||
22 | class FiscalReport607 extends JoinModel |
||
23 | { |
||
24 | const MAIN_TABLE = 'facturascli'; |
||
25 | const SECONDARY_TABLE = 'facturascli AS f2'; |
||
26 | const SECONDARY_TABLE_ALIAS = 'f2'; |
||
27 | const ESTADOSDOC_TABLE = 'estados_documentos'; |
||
28 | |||
29 | /** |
||
30 | * |
||
31 | * @return array |
||
32 | */ |
||
33 | protected function getFields(): array |
||
34 | { |
||
35 | $dateFormat = (FS_DB_TYPE === 'postgresql') ? "to_char" : "date_format"; |
||
0 ignored issues
–
show
|
|||
36 | $dateFormatString = (FS_DB_TYPE === 'postgresql') ? "YYYYMMDD" : "%Y%m%d"; |
||
37 | |||
38 | $data = [ |
||
39 | 'itemrow' => static::MAIN_TABLE.'.idfactura', |
||
40 | 'idempresa' => static::MAIN_TABLE.'.idempresa', |
||
41 | 'codalmacen' => static::MAIN_TABLE.'.codalmacen', |
||
42 | 'cifnif' => 'CASE WHEN length('.static::MAIN_TABLE.'.cifnif)=9 THEN ' |
||
43 | . static::MAIN_TABLE.'.cifnif WHEN length('.static::MAIN_TABLE.'.cifnif)=11 THEN ' |
||
44 | . static::MAIN_TABLE.'.cifnif ELSE NULL END', |
||
45 | 'tipoid' => 'CASE WHEN length('.static::MAIN_TABLE.'.cifnif)=9 THEN 1 WHEN length(' |
||
46 | . static::MAIN_TABLE.'.cifnif)=11 THEN 2 ELSE 3 END', |
||
47 | 'ncf' => static::MAIN_TABLE.'.numeroncf', |
||
48 | 'ncfmodifica' => static::SECONDARY_TABLE_ALIAS.'.numeroncf', |
||
49 | 'tipoingreso' => 'CASE WHEN '.static::MAIN_TABLE.'.ncftipomovimiento is null THEN \'1\' ELSE ' |
||
50 | . static::MAIN_TABLE.'.ncftipomovimiento END', |
||
51 | 'fecha' => $dateFormat.'('.static::MAIN_TABLE.'.fecha,\''.$dateFormatString.'\')', |
||
52 | // 'fecharetencion' => '\'\'', |
||
53 | 'base' => 'CASE WHEN '.static::ESTADOSDOC_TABLE.'.nombre = \'Anulada\' THEN 0 WHEN ' |
||
54 | . static::ESTADOSDOC_TABLE.'.nombre = \'Emitida\' AND '.static::MAIN_TABLE.'.neto < 0 THEN ' |
||
55 | . static::MAIN_TABLE.'.neto*-1 ELSE '.static::MAIN_TABLE.'.neto END', |
||
56 | 'itbis' => 'CASE WHEN '.static::ESTADOSDOC_TABLE.'.nombre = \'Anulada\' THEN 0 WHEN ' |
||
57 | . static::ESTADOSDOC_TABLE.'.nombre = \'Emitida\' AND '.static::MAIN_TABLE.'.totaliva < 0 THEN ' |
||
58 | . static::MAIN_TABLE.'.totaliva*-1 ELSE '.static::MAIN_TABLE.'.totaliva END', |
||
59 | // 'itbisretenido' => '0', |
||
60 | // 'itbispercibido' => '0', |
||
61 | // 'rentaretenido' => '0', |
||
62 | // 'rentapercibido' => '0', |
||
63 | // 'isc' => '0', |
||
64 | // 'otrosimpuestos' => '0', |
||
65 | // 'propinalegal' => '0', |
||
66 | 'totalefectivo' => 'CASE WHEN '.static::MAIN_TABLE.'.ncftipopago IS NULL OR ' |
||
67 | . static::MAIN_TABLE.'.ncftipopago = \'\' OR ' |
||
68 | . static::MAIN_TABLE.'.ncftipopago = \'17\' THEN ' |
||
69 | . static::MAIN_TABLE.'.total else 0 END', |
||
70 | 'totalcheque' => 'CASE WHEN '.static::MAIN_TABLE.'.ncftipopago = \'18\' THEN ' |
||
71 | . static::MAIN_TABLE.'.total else 0 END', |
||
72 | 'totaltarjeta' => 'CASE WHEN '.static::MAIN_TABLE.'.ncftipopago = \'19\' THEN ' |
||
73 | . static::MAIN_TABLE.'.total else 0 END', |
||
74 | 'totalcredito' => 'CASE WHEN '.static::MAIN_TABLE.'.ncftipopago = \'20\' THEN ' |
||
75 | . static::MAIN_TABLE.'.total else 0 END', |
||
76 | 'totalbonos' => 'CASE WHEN '.static::MAIN_TABLE.'.ncftipopago = \'21\' THEN ' |
||
77 | . static::MAIN_TABLE.'.total else 0 END', |
||
78 | 'totalpermuta' => 'CASE WHEN '.static::MAIN_TABLE.'.ncftipopago = \'22\' THEN ' |
||
79 | . static::MAIN_TABLE.'.total else 0 END', |
||
80 | 'totalotrasformas' => 'CASE WHEN '.static::MAIN_TABLE.'.ncftipopago = \'23\' THEN ' |
||
81 | . static::MAIN_TABLE.'.total else 0 END', |
||
82 | 'estado' => 'CASE WHEN '.static::ESTADOSDOC_TABLE |
||
83 | . '.nombre = \'Emitida\' THEN \'Activo\' ELSE \'Anulado\' END', |
||
84 | ]; |
||
85 | return $data; |
||
86 | } |
||
87 | |||
88 | /** |
||
89 | * |
||
90 | * @return string |
||
91 | */ |
||
92 | protected function getSQLFrom(): string |
||
93 | { |
||
94 | return static::MAIN_TABLE |
||
95 | . ' LEFT JOIN '. static::SECONDARY_TABLE . ' ON (' |
||
96 | . static::MAIN_TABLE . '.idfacturarect = ' . static::SECONDARY_TABLE_ALIAS . '.idfactura)' |
||
97 | . ' LEFT JOIN ' . static::ESTADOSDOC_TABLE . ' ON (' |
||
98 | . static::MAIN_TABLE . '.idestado = ' . static::ESTADOSDOC_TABLE . '.idestado AND ' |
||
99 | . static::ESTADOSDOC_TABLE.'.nombre != \'Anulada\')'; |
||
100 | } |
||
101 | |||
102 | /** |
||
103 | * |
||
104 | * @return array |
||
105 | */ |
||
106 | protected function getTables(): array |
||
107 | { |
||
108 | return [ |
||
109 | static::MAIN_TABLE, |
||
110 | static::ESTADOSDOC_TABLE |
||
111 | ]; |
||
112 | } |
||
113 | } |
||
114 |
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