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; |
|
|
|
|
21
|
|
|
|
22
|
|
|
class FiscalReport608 extends JoinModel |
23
|
|
|
{ |
24
|
|
|
const MAIN_TABLE = 'facturascli'; |
25
|
|
|
const NCFCANCELTYPE_TABLE = 'rd_ncftipoanulacion'; |
26
|
|
|
const ESTADOSDOC_TABLE = 'estados_documentos'; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* |
30
|
|
|
* @return array |
31
|
|
|
*/ |
32
|
|
|
protected function getFields(): array |
33
|
|
|
{ |
34
|
|
|
$dateFormat = (FS_DB_TYPE === 'postgresql') ? "to_char" : "date_format"; |
|
|
|
|
35
|
|
|
$dateFormatString = (FS_DB_TYPE === 'postgresql') ? "YYYYMMDD" : "%Y%m%d"; |
36
|
|
|
|
37
|
|
|
$data = [ |
38
|
|
|
'itemrow' => static::MAIN_TABLE.'.idfactura', |
39
|
|
|
'idempresa' => static::MAIN_TABLE.'.idempresa', |
40
|
|
|
'codalmacen' => static::MAIN_TABLE.'.codalmacen', |
41
|
|
|
'ncf' => static::MAIN_TABLE.'.numeroncf', |
42
|
|
|
'tipoanulacion' => 'CASE WHEN ' . |
43
|
|
|
static::ESTADOSDOC_TABLE . '.nombre = \'Anulada\' AND ' . |
44
|
|
|
static::MAIN_TABLE.'.ncftipoanulacion is null ' . |
45
|
|
|
'THEN CONCAT(\'05\',\' - \',\'Corrección de la Información\') ELSE ' . |
46
|
|
|
'concat(' . static::MAIN_TABLE.'.ncftipoanulacion, \' - \', ' . |
47
|
|
|
static::NCFCANCELTYPE_TABLE.'.descripcion) END', |
48
|
|
|
'fecha' => $dateFormat.'('.static::MAIN_TABLE.'.fecha,\''.$dateFormatString.'\')', |
49
|
|
|
'estado' => 'CASE WHEN ' . static::ESTADOSDOC_TABLE . |
50
|
|
|
'.nombre = \'Emitida\' THEN \'Activo\' ELSE \'Anulado\' END', |
51
|
|
|
]; |
52
|
|
|
return $data; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* |
57
|
|
|
* @return string |
58
|
|
|
*/ |
59
|
|
|
protected function getSQLFrom(): string |
60
|
|
|
{ |
61
|
|
|
return static::MAIN_TABLE |
62
|
|
|
. ' JOIN ' . static::ESTADOSDOC_TABLE . ' ON (' |
63
|
|
|
. static::MAIN_TABLE . '.idestado = ' . static::ESTADOSDOC_TABLE . '.idestado AND '.static::ESTADOSDOC_TABLE.'.nombre = \'Anulada\')' |
64
|
|
|
. ' LEFT JOIN ' . static::NCFCANCELTYPE_TABLE . ' ON (' |
65
|
|
|
. static::MAIN_TABLE . '.ncftipoanulacion = ' . static::NCFCANCELTYPE_TABLE . '.codigo)'; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* |
70
|
|
|
* @return array |
71
|
|
|
*/ |
72
|
|
|
protected function getTables(): array |
73
|
|
|
{ |
74
|
|
|
return [ |
75
|
|
|
static::MAIN_TABLE, |
76
|
|
|
static::NCFCANCELTYPE_TABLE, |
77
|
|
|
static::ESTADOSDOC_TABLE |
78
|
|
|
]; |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|
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