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