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\Lib\PDF; |
19
|
|
|
|
20
|
|
|
use FacturaScripts\Core\Base\Utils; |
|
|
|
|
21
|
|
|
use FacturaScripts\Plugins\fsRepublicaDominicana\Model\NCFTipo; |
22
|
|
|
use FacturaScripts\Core\Lib\PDF\PDFDocument as ParentClass; |
|
|
|
|
23
|
|
|
|
24
|
|
|
abstract class PDFDocument extends ParentClass |
25
|
|
|
{ |
26
|
|
|
protected function insertBusinessDocHeader($model): void |
27
|
|
|
{ |
28
|
|
|
$headerData = [ |
29
|
|
|
'title' => $this->i18n->trans($model->modelClassName() . '-min'), |
30
|
|
|
'subject' => $this->i18n->trans('customer'), |
31
|
|
|
'fieldName' => 'nombrecliente' |
32
|
|
|
]; |
33
|
|
|
|
34
|
|
|
if (isset($model->codproveedor)) { |
35
|
|
|
$headerData['subject'] = $this->i18n->trans('supplier'); |
36
|
|
|
$headerData['fieldName'] = 'nombre'; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
if (!empty($this->format->titulo)) { |
40
|
|
|
$headerData['title'] = Utils::fixHtml($this->format->titulo); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
$this->pdf->ezText("\n" . $headerData['title'] . ': ' . $model->codigo . "\n", self::FONT_SIZE + 6); |
44
|
|
|
$this->newLine(); |
45
|
|
|
|
46
|
|
|
$subject = $model->getSubject(); |
47
|
|
|
$tipoidfiscal = empty($subject->tipoidfiscal) ? $this->i18n->trans('cifnif') : $subject->tipoidfiscal; |
48
|
|
|
$serie = $model->getSerie(); |
49
|
|
|
|
50
|
|
|
$tableData = [ |
51
|
|
|
['key' => $headerData['subject'], 'value' => Utils::fixHtml($model->{$headerData['fieldName']})], |
52
|
|
|
['key' => $this->i18n->trans('date'), 'value' => $model->fecha], |
53
|
|
|
['key' => $this->i18n->trans('address'), 'value' => $this->getDocAddress($subject, $model)], |
54
|
|
|
['key' => $this->i18n->trans('code'), 'value' => $model->codigo], |
55
|
|
|
['key' => $tipoidfiscal, 'value' => $model->cifnif], |
56
|
|
|
['key' => $this->i18n->trans('tipocomprobante'), 'value' => $model->tipocomprobante], |
57
|
|
|
['key' => $this->i18n->trans('number'), 'value' => $model->numero], |
58
|
|
|
['key' => $this->i18n->trans('due-date'), 'value' => $model->ncffechavencimiento], |
59
|
|
|
['key' => $this->i18n->trans('serie'), 'value' => $serie->descripcion], |
60
|
|
|
]; |
61
|
|
|
|
62
|
|
|
// rectified invoice? |
63
|
|
|
if (!empty($model->codigorect) && isset($model->codigorect)) { |
64
|
|
|
$facturaOrigen = $model->parentDocuments(); |
65
|
|
|
$tableData[9] = ['key' => $this->i18n->trans('ncf-modifies'), 'value' => $facturaOrigen[0]->numeroncf]; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
if (property_exists($model, 'numproveedor') && $model->numeroncf) { |
69
|
|
|
$tableData[3] = ['key' => $this->i18n->trans('ncf-number'), 'value' => $model->numeroncf]; |
70
|
|
|
} elseif (property_exists($model, 'numeroncf') && $model->numeroncf) { |
71
|
|
|
$tipoComprobante = new NCFTipo(); |
|
|
|
|
72
|
|
|
$tableData[3] = ['key' => $this->i18n->trans('ncf-number'), 'value' => $model->numeroncf]; |
73
|
|
|
} else { |
74
|
|
|
$tableData[3] = ['key' => $this->i18n->trans('serie'), 'value' => $serie->descripcion]; |
75
|
|
|
unset($tableData[6]); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
if (property_exists($model, 'tipocomprobante') && $model->tipocomprobante) { |
79
|
|
|
$tipoComprobante = new NCFTipo(); |
80
|
|
|
$dataTC = $tipoComprobante->get($model->tipocomprobante); |
81
|
|
|
$tableData[5] = ['key' => $this->i18n->trans('tipocomprobante'), 'value' => $dataTC->descripcion]; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
$tableOptions = [ |
85
|
|
|
'width' => $this->tableWidth, |
86
|
|
|
'showHeadings' => 0, |
87
|
|
|
'shaded' => 0, |
88
|
|
|
'lineCol' => [1, 1, 1], |
89
|
|
|
'cols' => [] |
90
|
|
|
]; |
91
|
|
|
$this->insertParallelTable($tableData, '', $tableOptions); |
92
|
|
|
$this->pdf->ezText(''); |
93
|
|
|
|
94
|
|
|
if (!empty($model->idcontactoenv) |
95
|
|
|
&& ($model->idcontactoenv !== $model->idcontactofact || !empty($model->codtrans))) { |
96
|
|
|
$this->insertBusinessDocShipping($model); |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
} |
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