Passed
Push — master ( 540769...d71d6d )
by Joe Nilson
01:52
created

FiscalReports::getFields()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 12
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 14
rs 9.8666
1
<?php
2
/**
3
 * Copyright (C) 2019-2022 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\Base\DataBase;
0 ignored issues
show
Bug introduced by
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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
24
use FacturaScripts\Core\Model\Base\JoinModel;
0 ignored issues
show
Bug introduced by
The type FacturaScripts\Core\Model\Base\JoinModel 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
25
26
class FiscalReports extends JoinModel
27
{
28
    public const MAIN_TABLE = 'facturascli';
29
    public const CLIENTES_TABLE = 'clientes';
30
    public const NCFTIPO_TABLE = 'rd_ncftipo';
31
    public const NCFTIPOMOV_TABLE = 'rd_ncftipomovimiento';
32
    public const NCFTIPOANUL_TABLE = 'rd_ncftipoanulacion';
33
    public const NCFTIPOPAGO_TABLE = 'rd_ncftipopagos';
34
35
    protected function getTables(): array
36
    {
37
        return [
38
            static::MAIN_TABLE,
39
            static::NCFTIPO_TABLE,
40
            static::NCFTIPOANUL_TABLE,
41
            static::NCFTIPOMOV_TABLE,
42
            static::NCFTIPOPAGO_TABLE,
43
            static::CLIENTES_TABLE
44
        ];
45
    }
46
47
    protected function getFields(): array
48
    {
49
        return [
50
            'fecha' => static::MAIN_TABLE.'.fecha',
51
            'codalmacen' => static::MAIN_TABLE.'.codalmacen',
52
            'cliente' => static::CLIENTES_TABLE.'.nombre',
53
            'cifnif' => static::CLIENTES_TABLE.'.cifnif',
54
            'ncf' => static::MAIN_TABLE.'.numero2',
55
            'ncfmodifica' => static::MAIN_TABLE.'.codigorect',
56
            'tipocomprobante' => static::MAIN_TABLE.'.tipocomprobante',
57
            'base_imponible' => static::MAIN_TABLE.'.total',
58
            'base_exenta' => static::MAIN_TABLE.'.total',
59
            'itbis' => static::MAIN_TABLE.'.totaliva',
60
            'estado' => static::MAIN_TABLE.'.idestado'
61
        ];
62
    }
63
64
    protected function getSQLFrom(): string
65
    {
66
        return static::MAIN_TABLE . ''
67
            . ' LEFT JOIN '. static::CLIENTES_TABLE . ' ON '
68
            . static::MAIN_TABLE . '.codcliente = ' . static::CLIENTES_TABLE . '.codcliente'
69
            . ' LEFT JOIN '. static::NCFTIPO_TABLE . ' ON '
70
            . static::MAIN_TABLE . '.tipocomprobante = ' . static::NCFTIPO_TABLE . '.tipocomprobante'
71
            . ' LEFT JOIN ' . static::NCFTIPOPAGO_TABLE . ' ON '
72
            . static::MAIN_TABLE . '.ncftipopago = ' . static::NCFTIPOPAGO_TABLE . '.tipopago';
73
    }
74
}