|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace NFePHP\DA\NFe; |
|
4
|
|
|
|
|
5
|
|
|
/** |
|
6
|
|
|
* Classe para a impressão em PDF do Documento Auxiliar de NFe Consumidor |
|
7
|
|
|
* NOTA: Esta classe não é a indicada para quem faz uso de impressoras térmicas ESCPOS |
|
8
|
|
|
* |
|
9
|
|
|
* @category Library |
|
10
|
|
|
* @package nfephp-org/sped-da |
|
11
|
|
|
* @copyright 2009-2019 NFePHP |
|
12
|
|
|
* @license http://www.gnu.org/licenses/lesser.html LGPL v3 |
|
13
|
|
|
* @link http://github.com/nfephp-org/sped-da for the canonical source repository |
|
14
|
|
|
* @author Roberto Spadim <roberto at spadim dot com dot br> |
|
15
|
|
|
*/ |
|
16
|
|
|
use Exception; |
|
17
|
|
|
use InvalidArgumentException; |
|
18
|
|
|
use NFePHP\DA\Legacy\Dom; |
|
19
|
|
|
use NFePHP\DA\Legacy\Pdf; |
|
20
|
|
|
use NFePHP\DA\Common\DaCommon; |
|
21
|
|
|
use Com\Tecnick\Barcode\Barcode; |
|
22
|
|
|
use DateTime; |
|
23
|
|
|
|
|
24
|
|
|
class Danfce extends DaCommon |
|
25
|
|
|
{ |
|
26
|
|
|
protected $papel; |
|
27
|
|
|
protected $paperwidth = 80; |
|
28
|
|
|
protected $xml; // string XML NFe |
|
29
|
|
|
protected $logomarca=''; // path para logomarca em jpg |
|
30
|
|
|
protected $formatoChave="#### #### #### #### #### #### #### #### #### #### ####"; |
|
31
|
|
|
protected $nfeProc; |
|
32
|
|
|
protected $nfe; |
|
33
|
|
|
protected $infNFe; |
|
34
|
|
|
protected $ide; |
|
35
|
|
|
protected $enderDest; |
|
36
|
|
|
protected $ICMSTot; |
|
37
|
|
|
protected $imposto; |
|
38
|
|
|
protected $emit; |
|
39
|
|
|
protected $enderEmit; |
|
40
|
|
|
protected $qrCode; |
|
41
|
|
|
protected $urlChave; |
|
42
|
|
|
protected $det; |
|
43
|
|
|
protected $infAdic; |
|
44
|
|
|
protected $textoAdic; |
|
45
|
|
|
protected $tpEmis; |
|
46
|
|
|
protected $pag; |
|
47
|
|
|
protected $vTroco; |
|
48
|
|
|
protected $dest; |
|
49
|
|
|
protected $imgQRCode; |
|
50
|
|
|
protected $urlQR = ''; |
|
51
|
|
|
protected $pdf; |
|
52
|
|
|
protected $margemInterna = 2; |
|
53
|
|
|
protected $hMaxLinha = 9; |
|
54
|
|
|
protected $hBoxLinha = 6; |
|
55
|
|
|
protected $hLinha = 3; |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* __contruct |
|
59
|
|
|
* |
|
60
|
|
|
* @param string $docXML |
|
61
|
|
|
*/ |
|
62
|
|
|
public function __construct( |
|
63
|
|
|
$docXML |
|
64
|
|
|
) { |
|
65
|
|
|
|
|
66
|
|
|
$this->xml = $docXML; |
|
67
|
|
|
|
|
68
|
|
|
if (!empty($this->xml)) { |
|
69
|
|
|
$this->dom = new Dom(); |
|
|
|
|
|
|
70
|
|
|
$this->dom->loadXML($this->xml); |
|
71
|
|
|
$this->nfeProc = $this->dom->getElementsByTagName("nfeProc")->item(0); |
|
72
|
|
|
$this->nfe = $this->dom->getElementsByTagName("NFe")->item(0); |
|
73
|
|
|
$this->infNFe = $this->dom->getElementsByTagName("infNFe")->item(0); |
|
74
|
|
|
$this->ide = $this->dom->getElementsByTagName("ide")->item(0); |
|
75
|
|
|
$this->emit = $this->dom->getElementsByTagName("emit")->item(0); |
|
76
|
|
|
$this->enderEmit = $this->dom->getElementsByTagName("enderEmit")->item(0); |
|
77
|
|
|
$this->det = $this->dom->getElementsByTagName("det"); |
|
78
|
|
|
$this->dest = $this->dom->getElementsByTagName("dest")->item(0); |
|
79
|
|
|
$this->imposto = $this->dom->getElementsByTagName("imposto")->item(0); |
|
80
|
|
|
$this->ICMSTot = $this->dom->getElementsByTagName("ICMSTot")->item(0); |
|
81
|
|
|
$this->tpImp = $this->ide->getElementsByTagName("tpImp")->item(0)->nodeValue; |
|
|
|
|
|
|
82
|
|
|
$this->infAdic = $this->dom->getElementsByTagName("infAdic")->item(0); |
|
83
|
|
|
$this->tpEmis = $this->dom->getValue($this->ide, "tpEmis"); |
|
|
|
|
|
|
84
|
|
|
|
|
85
|
|
|
//se for o layout 4.0 busca pelas tags de detalhe do pagamento |
|
86
|
|
|
//senao, busca pelas tags de pagamento principal |
|
87
|
|
|
if ($this->infNFe->getAttribute("versao") == "4.00") { |
|
88
|
|
|
$this->pag = $this->dom->getElementsByTagName("detPag"); |
|
89
|
|
|
|
|
90
|
|
|
$tagPag = $this->dom->getElementsByTagName("pag")->item(0); |
|
91
|
|
|
$this->vTroco = $this->getTagValue($tagPag, "vTroco"); |
|
92
|
|
|
} else { |
|
93
|
|
|
$this->pag = $this->dom->getElementsByTagName("pag"); |
|
94
|
|
|
} |
|
95
|
|
|
} |
|
96
|
|
|
$this->qrCode = !empty($this->dom->getElementsByTagName('qrCode')->item(0)->nodeValue) |
|
97
|
|
|
? $this->dom->getElementsByTagName('qrCode')->item(0)->nodeValue : null; |
|
98
|
|
|
$this->urlChave = !empty($this->dom->getElementsByTagName('urlChave')->item(0)->nodeValue) |
|
99
|
|
|
? $this->dom->getElementsByTagName('urlChave')->item(0)->nodeValue : null; |
|
100
|
|
|
if ($this->getTagValue($this->ide, "mod") != '65') { |
|
101
|
|
|
throw new InvalidArgumentException("O xml do DANFE deve ser uma NFC-e modelo 65"); |
|
102
|
|
|
} |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* Add the credits to the integrator in the footer message |
|
107
|
|
|
* @param string $message |
|
108
|
|
|
*/ |
|
109
|
|
|
public function creditsIntegratorFooter($message = '') |
|
110
|
|
|
{ |
|
111
|
|
|
$this->creditos = trim($message); |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* Dados brutos do PDF |
|
116
|
|
|
* @return string |
|
117
|
|
|
*/ |
|
118
|
|
|
public function render( |
|
119
|
|
|
$logo = '' |
|
120
|
|
|
) { |
|
121
|
|
|
if (empty($this->pdf)) { |
|
122
|
|
|
$this->monta($logo); |
|
123
|
|
|
} |
|
124
|
|
|
return $this->pdf->getPdf(); |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* Seta a largura do papel de impressão |
|
129
|
|
|
* @param int $width |
|
130
|
|
|
*/ |
|
131
|
|
|
public function setPaperWidth($width = 80) |
|
132
|
|
|
{ |
|
133
|
|
|
$this->paperwidth = $width; |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
/** |
|
137
|
|
|
* Parametros de impressão |
|
138
|
|
|
* @param string $orientacao |
|
139
|
|
|
* @param string $papel |
|
140
|
|
|
* @param int $margSup |
|
141
|
|
|
* @param int $margEsq |
|
142
|
|
|
*/ |
|
143
|
|
|
public function printParameters($orientacao = '', $papel = 'A4', $margSup = 2, $margEsq = 2) |
|
144
|
|
|
{ |
|
145
|
|
|
//do nothing |
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
|
|
/** |
|
149
|
|
|
* |
|
150
|
|
|
* @param string $logo |
|
151
|
|
|
*/ |
|
152
|
|
|
protected function monta( |
|
153
|
|
|
$logo = '' |
|
154
|
|
|
) { |
|
155
|
|
|
|
|
156
|
|
|
$this->aFontTit = array('font' => $this->fontePadrao, 'size' => 9, 'style' => 'B'); |
|
|
|
|
|
|
157
|
|
|
$this->aFontTex = array('font' => $this->fontePadrao, 'size' => 8, 'style' => ''); |
|
|
|
|
|
|
158
|
|
|
if (!empty($logo)) { |
|
159
|
|
|
$this->logomarca = $this->adjustImage($logo, true); |
|
160
|
|
|
} |
|
161
|
|
|
$qtdItens = $this->det->length; |
|
162
|
|
|
$qtdPgto = $this->pag->length; |
|
163
|
|
|
$hMaxLinha = $this->hMaxLinha; |
|
164
|
|
|
$hBoxLinha = $this->hBoxLinha; |
|
|
|
|
|
|
165
|
|
|
$hLinha = $this->hLinha; |
|
166
|
|
|
$tamPapelVert = 160 + 16 + 12 + (($qtdItens - 1) * $hMaxLinha) + ($qtdPgto * $hLinha); |
|
167
|
|
|
// verifica se existe informações adicionais |
|
168
|
|
|
$this->textoAdic = ''; |
|
169
|
|
|
if (isset($this->infAdic)) { |
|
170
|
|
|
$this->textoAdic .= !empty($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue) ? |
|
171
|
|
|
'Inf. Contribuinte: '. |
|
172
|
|
|
trim($this->anfaveaDANFE($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue)) : ''; |
|
173
|
|
|
if (!empty($this->textoAdic)) { |
|
174
|
|
|
$this->textoAdic = str_replace(";", "\n", $this->textoAdic); |
|
175
|
|
|
$alinhas = explode("\n", $this->textoAdic); |
|
176
|
|
|
$numlinhasdados = 0; |
|
177
|
|
|
$tempPDF = new Pdf(); // cria uma instancia temporaria da class pdf |
|
178
|
|
|
$tempPDF->setFont('times', '', '8'); // seta a font do PDF |
|
179
|
|
|
foreach ($alinhas as $linha) { |
|
180
|
|
|
$linha = trim($linha); |
|
181
|
|
|
$numlinhasdados += $tempPDF->wordWrap($linha, 76 - 0.2); |
|
|
|
|
|
|
182
|
|
|
} |
|
183
|
|
|
$hdadosadic = round(($numlinhasdados + 1) * $tempPDF->fontSize, 0); |
|
184
|
|
|
if ($hdadosadic < 5) { |
|
185
|
|
|
$hdadosadic = 5; |
|
186
|
|
|
} |
|
187
|
|
|
// seta o tamanho do papel |
|
188
|
|
|
$tamPapelVert += $hdadosadic; |
|
189
|
|
|
} |
|
190
|
|
|
} |
|
191
|
|
|
$this->orientacao = 'P'; |
|
192
|
|
|
$this->papel = [$this->paperwidth, $tamPapelVert]; |
|
193
|
|
|
$this->logoAlign = 'L'; |
|
194
|
|
|
$this->pdf = new Pdf($this->orientacao, 'mm', $this->papel); |
|
|
|
|
|
|
195
|
|
|
|
|
196
|
|
|
//margens do PDF, em milímetros. Obs.: a margem direita é sempre igual à |
|
197
|
|
|
//margem esquerda. A margem inferior *não* existe na FPDF, é definida aqui |
|
198
|
|
|
//apenas para controle se necessário ser maior do que a margem superior |
|
199
|
|
|
$margSup = 2; |
|
200
|
|
|
$margEsq = 2; |
|
201
|
|
|
$margInf = 2; |
|
202
|
|
|
// posição inicial do conteúdo, a partir do canto superior esquerdo da página |
|
203
|
|
|
$xInic = $margEsq; |
|
204
|
|
|
$yInic = $margSup; |
|
205
|
|
|
$maxW = 80; |
|
206
|
|
|
$maxH = $tamPapelVert; |
|
207
|
|
|
//total inicial de paginas |
|
208
|
|
|
$totPag = 1; |
|
|
|
|
|
|
209
|
|
|
//largura imprimivel em mm: largura da folha menos as margens esq/direita |
|
210
|
|
|
$this->wPrint = $maxW-($margEsq*2); |
|
|
|
|
|
|
211
|
|
|
//comprimento (altura) imprimivel em mm: altura da folha menos as margens |
|
212
|
|
|
//superior e inferior |
|
213
|
|
|
$this->hPrint = $maxH-$margSup-$margInf; |
|
|
|
|
|
|
214
|
|
|
// estabelece contagem de paginas |
|
215
|
|
|
$this->pdf->aliasNbPages(); |
|
216
|
|
|
$this->pdf->setMargins($margEsq, $margSup); // fixa as margens |
|
217
|
|
|
$this->pdf->setDrawColor(0, 0, 0); |
|
218
|
|
|
$this->pdf->setFillColor(255, 255, 255); |
|
219
|
|
|
$this->pdf->open(); // inicia o documento |
|
220
|
|
|
$this->pdf->addPage($this->orientacao, $this->papel); // adiciona a primeira página |
|
|
|
|
|
|
221
|
|
|
$this->pdf->setLineWidth(0.1); // define a largura da linha |
|
222
|
|
|
$this->pdf->setTextColor(0, 0, 0); |
|
223
|
|
|
$this->pdf->textBox(0, 0, $maxW, $maxH); // POR QUE PRECISO DESA LINHA? |
|
224
|
|
|
$hcabecalho = 27;//para cabeçalho (dados emitente mais logomarca) (FIXO) |
|
225
|
|
|
$hcabecalhoSecundario = 10 + 3;//para cabeçalho secundário (cabeçalho sefaz) (FIXO) |
|
226
|
|
|
$hprodutos = $hLinha + ($qtdItens * $hMaxLinha) ;//box poduto |
|
227
|
|
|
$hTotal = 12; //box total (FIXO) |
|
228
|
|
|
$hpagamentos = $hLinha + ($qtdPgto * $hLinha) + 3;//para pagamentos |
|
229
|
|
|
if (!empty($this->vTroco)) { |
|
230
|
|
|
$hpagamentos += $hLinha; |
|
231
|
|
|
} |
|
232
|
|
|
|
|
233
|
|
|
$hmsgfiscal = 21 + 2; // para imposto (FIXO) |
|
234
|
|
|
$hcliente = !isset($this->dest) ? 6 : 12; // para cliente (FIXO) |
|
235
|
|
|
$hcontingencia = $this->tpEmis == 9 ? 6 : 0; // para contingência (FIXO) |
|
|
|
|
|
|
236
|
|
|
$hQRCode = 50; // para qrcode (FIXO) |
|
237
|
|
|
$hCabecItens = 4; //cabeçalho dos itens |
|
238
|
|
|
|
|
239
|
|
|
$hUsado = $hCabecItens; |
|
|
|
|
|
|
240
|
|
|
$w2 = round($this->wPrint * 0.31, 0); |
|
|
|
|
|
|
241
|
|
|
$totPag = 1; |
|
242
|
|
|
$pag = 1; |
|
243
|
|
|
$x = $xInic; |
|
244
|
|
|
//COLOCA CABEÇALHO |
|
245
|
|
|
$y = $yInic; |
|
246
|
|
|
$y = $this->cabecalhoDANFE($x, $y, $hcabecalho, $pag, $totPag); |
|
|
|
|
|
|
247
|
|
|
//COLOCA CABEÇALHO SECUNDÁRIO |
|
248
|
|
|
$y = $hcabecalho; |
|
249
|
|
|
$y = $this->cabecalhoSecundarioDANFE($x, $y, $hcabecalhoSecundario); |
|
|
|
|
|
|
250
|
|
|
$jj = $hcabecalho + $hcabecalhoSecundario; |
|
|
|
|
|
|
251
|
|
|
//COLOCA PRODUTOS |
|
252
|
|
|
$y = $xInic + $hcabecalho + $hcabecalhoSecundario; |
|
253
|
|
|
$y = $this->produtosDANFE($x, $y, $hprodutos); |
|
|
|
|
|
|
254
|
|
|
//COLOCA TOTAL |
|
255
|
|
|
$y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos; |
|
256
|
|
|
$y = $this->totalDANFE($x, $y, $hTotal); |
|
|
|
|
|
|
257
|
|
|
//COLOCA PAGAMENTOS |
|
258
|
|
|
$y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal; |
|
259
|
|
|
$y = $this->pagamentosDANFE($x, $y, $hpagamentos); |
|
|
|
|
|
|
260
|
|
|
//COLOCA MENSAGEM FISCAL |
|
261
|
|
|
$y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal+ $hpagamentos; |
|
262
|
|
|
$y = $this->fiscalDANFE($x, $y, $hmsgfiscal); |
|
|
|
|
|
|
263
|
|
|
//COLOCA CONSUMIDOR |
|
264
|
|
|
$y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos + $hmsgfiscal; |
|
265
|
|
|
$y = $this->consumidorDANFE($x, $y, $hcliente); |
|
|
|
|
|
|
266
|
|
|
//COLOCA QRCODE |
|
267
|
|
|
$y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos |
|
268
|
|
|
+ $hTotal + $hpagamentos + $hmsgfiscal + $hcliente; |
|
269
|
|
|
$y = $this->qrCodeDANFE($x, $y, $hQRCode); |
|
|
|
|
|
|
270
|
|
|
|
|
271
|
|
|
//adiciona as informações opcionais |
|
272
|
|
|
if (!empty($this->textoAdic)) { |
|
273
|
|
|
$y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos |
|
274
|
|
|
+ $hTotal + $hpagamentos + $hmsgfiscal + $hcliente + $hQRCode; |
|
275
|
|
|
$hInfAdic = 0; |
|
276
|
|
|
$y = $this->infAdic($x, $y, $hInfAdic); |
|
|
|
|
|
|
277
|
|
|
} |
|
278
|
|
|
} |
|
279
|
|
|
|
|
280
|
|
|
protected function cabecalhoDANFE($x = 0, $y = 0, $h = 0, $pag = '1', $totPag = '1') |
|
|
|
|
|
|
281
|
|
|
{ |
|
282
|
|
|
$emitRazao = $this->getTagValue($this->emit, "xNome"); |
|
283
|
|
|
$emitCnpj = $this->getTagValue($this->emit, "CNPJ"); |
|
284
|
|
|
$emitCnpj = $this->formatField($emitCnpj, "##.###.###/####-##"); |
|
285
|
|
|
$emitIE = $this->getTagValue($this->emit, "IE"); |
|
286
|
|
|
$emitIM = $this->getTagValue($this->emit, "IM"); |
|
287
|
|
|
$emitFone = $this->getTagValue($this->enderEmit, "fone"); |
|
288
|
|
|
$foneLen = strlen($emitFone); |
|
289
|
|
|
if ($foneLen>0) { |
|
290
|
|
|
$ddd = substr($emitFone, 0, 2); |
|
291
|
|
|
$fone1 = substr($emitFone, -8); |
|
292
|
|
|
$digito9 = ' '; |
|
293
|
|
|
if ($foneLen == 11) { |
|
294
|
|
|
$digito9 = substr($emitFone, 2, 1); |
|
295
|
|
|
} |
|
296
|
|
|
$emitFone = ' - ('.$ddd.') '.$digito9. ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4); |
|
297
|
|
|
} else { |
|
298
|
|
|
$emitFone = ''; |
|
299
|
|
|
} |
|
300
|
|
|
$emitLgr = $this->getTagValue($this->enderEmit, "xLgr"); |
|
301
|
|
|
$emitNro = $this->getTagValue($this->enderEmit, "nro"); |
|
302
|
|
|
$emitCpl = $this->getTagValue($this->enderEmit, "xCpl", ""); |
|
303
|
|
|
$emitBairro = $this->getTagValue($this->enderEmit, "xBairro"); |
|
304
|
|
|
$emitCEP = $this->formatField($this->getTagValue($this->enderEmit, "CEP"), "#####-###"); |
|
305
|
|
|
$emitMun = $this->getTagValue($this->enderEmit, "xMun"); |
|
306
|
|
|
$emitUF = $this->getTagValue($this->enderEmit, "UF"); |
|
307
|
|
|
// CONFIGURAÇÃO DE POSIÇÃO |
|
308
|
|
|
$margemInterna = $this->margemInterna; |
|
309
|
|
|
$maxW = $this->wPrint; |
|
310
|
|
|
$h = $h-($margemInterna); |
|
311
|
|
|
//COLOCA LOGOMARCA |
|
312
|
|
|
if (!empty($this->logomarca)) { |
|
313
|
|
|
$xImg = $margemInterna; |
|
314
|
|
|
$yImg = $margemInterna + 1; |
|
|
|
|
|
|
315
|
|
|
$logoInfo = getimagesize($this->logomarca); |
|
316
|
|
|
$logoWmm = ($logoInfo[0]/72)*25.4; |
|
317
|
|
|
$logoHmm = ($logoInfo[1]/72)*25.4; |
|
318
|
|
|
$nImgW = 30; |
|
319
|
|
|
$nImgH = round($logoHmm * ($nImgW/$logoWmm), 0); |
|
320
|
|
|
$yImg = $margemInterna + $nImgH/2; |
|
321
|
|
|
$this->pdf->image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg'); |
|
322
|
|
|
$xRs = ($maxW*0.4) + $margemInterna; |
|
323
|
|
|
$wRs = ($maxW*0.6); |
|
324
|
|
|
$alignEmit = 'L'; |
|
325
|
|
|
} else { |
|
326
|
|
|
$xRs = $margemInterna; |
|
327
|
|
|
$wRs = ($maxW*1); |
|
328
|
|
|
$alignEmit = 'L'; |
|
329
|
|
|
} |
|
330
|
|
|
//COLOCA RAZÃO SOCIAL |
|
331
|
|
|
$texto = $emitRazao; |
|
332
|
|
|
$texto = $texto . "\nCNPJ:" . $emitCnpj; |
|
333
|
|
|
$texto = $texto . "\nIE:" . $emitIE; |
|
334
|
|
|
if (!empty($emitIM)) { |
|
335
|
|
|
$texto = $texto . " - IM:" . $emitIM; |
|
336
|
|
|
} |
|
337
|
|
|
$texto = $texto . "\n" . $emitLgr . "," . $emitNro . " " . $emitCpl . "," . $emitBairro |
|
338
|
|
|
. ". CEP:" . $emitCEP . ". " . $emitMun . "-" . $emitUF . $emitFone; |
|
339
|
|
|
$aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
|
340
|
|
|
$this->pdf->textBox($xRs, $y, $wRs, $h, $texto, $aFont, 'C', $alignEmit, 0, '', false); |
|
|
|
|
|
|
341
|
|
|
} |
|
342
|
|
|
|
|
343
|
|
|
protected function cabecalhoSecundarioDANFE($x = 0, $y = 0, $h = 0) |
|
|
|
|
|
|
344
|
|
|
{ |
|
345
|
|
|
$margemInterna = $this->margemInterna; |
|
|
|
|
|
|
346
|
|
|
$maxW = $this->wPrint; |
|
347
|
|
|
$w = ($maxW*1); |
|
348
|
|
|
$hBox1 = 7; |
|
349
|
|
|
$texto = "DANFE NFC-e\nDocumento Auxiliar da Nota Fiscal de Consumidor Eletrônica"; |
|
350
|
|
|
$aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'); |
|
351
|
|
|
$this->pdf->textBox($x, $y, $w, $hBox1, $texto, $aFont, 'C', 'C', 0, '', false); |
|
|
|
|
|
|
352
|
|
|
$hBox2 = 4; |
|
353
|
|
|
$yBox2 = $y + $hBox1; |
|
354
|
|
|
$texto = "\nNFC-e não permite aproveitamento de crédito de ICMS"; |
|
355
|
|
|
$aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>''); |
|
356
|
|
|
$this->pdf->textBox($x, $yBox2, $w, $hBox2, $texto, $aFont, 'C', 'C', 0, '', false); |
|
|
|
|
|
|
357
|
|
|
} |
|
358
|
|
|
|
|
359
|
|
|
protected function produtosDANFE($x = 0, $y = 0, $h = 0) |
|
|
|
|
|
|
360
|
|
|
{ |
|
361
|
|
|
$margemInterna = $this->margemInterna; |
|
|
|
|
|
|
362
|
|
|
$maxW = $this->wPrint; |
|
363
|
|
|
$qtdItens = $this->det->length; |
|
364
|
|
|
$w = ($maxW*1); |
|
365
|
|
|
$hLinha = $this->hLinha; |
|
366
|
|
|
$aFontCabProdutos = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'); |
|
367
|
|
|
$wBoxCod = $w*0.17; |
|
368
|
|
|
$texto = "CÓDIGO"; |
|
369
|
|
|
$this->pdf->textBox($x, $y, $wBoxCod, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false); |
|
|
|
|
|
|
370
|
|
|
$wBoxDescricao = $w*0.43; |
|
371
|
|
|
$xBoxDescricao = $wBoxCod + $x; |
|
372
|
|
|
$texto = "DESCRICÃO"; |
|
373
|
|
|
$this->pdf->textBox( |
|
374
|
|
|
$xBoxDescricao, |
|
375
|
|
|
$y, |
|
376
|
|
|
$wBoxDescricao, |
|
377
|
|
|
$hLinha, |
|
378
|
|
|
$texto, |
|
379
|
|
|
$aFontCabProdutos, |
|
380
|
|
|
'T', |
|
381
|
|
|
'L', |
|
382
|
|
|
0, |
|
|
|
|
|
|
383
|
|
|
'', |
|
384
|
|
|
false |
|
385
|
|
|
); |
|
386
|
|
|
$wBoxQt = $w*0.08; |
|
387
|
|
|
$xBoxQt = $wBoxDescricao + $xBoxDescricao; |
|
388
|
|
|
$texto = "QT"; |
|
389
|
|
|
$this->pdf->textBox($xBoxQt, $y, $wBoxQt, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false); |
|
|
|
|
|
|
390
|
|
|
$wBoxUn = $w*0.06; |
|
391
|
|
|
$xBoxUn = $wBoxQt + $xBoxQt; |
|
392
|
|
|
$texto = "UN"; |
|
393
|
|
|
$this->pdf->textBox($xBoxUn, $y, $wBoxUn, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false); |
|
|
|
|
|
|
394
|
|
|
$wBoxVl = $w*0.13; |
|
395
|
|
|
$xBoxVl = $wBoxUn + $xBoxUn; |
|
396
|
|
|
$texto = "VALOR"; |
|
397
|
|
|
$this->pdf->textBox($xBoxVl, $y, $wBoxVl, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false); |
|
|
|
|
|
|
398
|
|
|
$wBoxTotal = $w*0.13; |
|
399
|
|
|
$xBoxTotal = $wBoxVl + $xBoxVl; |
|
400
|
|
|
$texto = "TOTAL"; |
|
401
|
|
|
$this->pdf->textBox($xBoxTotal, $y, $wBoxTotal, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false); |
|
|
|
|
|
|
402
|
|
|
$hBoxLinha = $this->hBoxLinha; |
|
|
|
|
|
|
403
|
|
|
$hMaxLinha = $this->hMaxLinha; |
|
404
|
|
|
$cont = 0; |
|
405
|
|
|
$aFontProdutos = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>''); |
|
406
|
|
|
if ($qtdItens > 0) { |
|
407
|
|
|
foreach ($this->det as $detI) { |
|
408
|
|
|
$thisItem = $detI; |
|
409
|
|
|
$prod = $thisItem->getElementsByTagName("prod")->item(0); |
|
410
|
|
|
$nitem = $thisItem->getAttribute("nItem"); |
|
|
|
|
|
|
411
|
|
|
$cProd = $this->getTagValue($prod, "cProd"); |
|
412
|
|
|
$xProd = $this->getTagValue($prod, "xProd"); |
|
413
|
|
|
$qCom = number_format($this->getTagValue($prod, "qCom"), 2, ",", "."); |
|
414
|
|
|
$uCom = $this->getTagValue($prod, "uCom"); |
|
415
|
|
|
$vUnCom = number_format($this->getTagValue($prod, "vUnCom"), 2, ",", "."); |
|
416
|
|
|
$vProd = number_format($this->getTagValue($prod, "vProd"), 2, ",", "."); |
|
417
|
|
|
//COLOCA PRODUTO |
|
418
|
|
|
$yBoxProd = $y + $hLinha + ($cont*$hMaxLinha); |
|
419
|
|
|
//COLOCA PRODUTO CÓDIGO |
|
420
|
|
|
$wBoxCod = $w*0.17; |
|
421
|
|
|
$texto = $cProd; |
|
422
|
|
|
$this->pdf->textBox( |
|
423
|
|
|
$x, |
|
424
|
|
|
$yBoxProd, |
|
425
|
|
|
$wBoxCod, |
|
426
|
|
|
$hMaxLinha, |
|
427
|
|
|
$texto, |
|
428
|
|
|
$aFontProdutos, |
|
429
|
|
|
'C', |
|
430
|
|
|
'C', |
|
431
|
|
|
0, |
|
|
|
|
|
|
432
|
|
|
'', |
|
433
|
|
|
false |
|
434
|
|
|
); |
|
435
|
|
|
//COLOCA PRODUTO DESCRIÇÃO |
|
436
|
|
|
$wBoxDescricao = $w*0.43; |
|
437
|
|
|
$xBoxDescricao = $wBoxCod + $x; |
|
438
|
|
|
$texto = $xProd; |
|
439
|
|
|
$this->pdf->textBox( |
|
440
|
|
|
$xBoxDescricao, |
|
441
|
|
|
$yBoxProd, |
|
442
|
|
|
$wBoxDescricao, |
|
443
|
|
|
$hMaxLinha, |
|
444
|
|
|
$texto, |
|
445
|
|
|
$aFontProdutos, |
|
446
|
|
|
'C', |
|
447
|
|
|
'L', |
|
448
|
|
|
0, |
|
|
|
|
|
|
449
|
|
|
'', |
|
450
|
|
|
false |
|
451
|
|
|
); |
|
452
|
|
|
//COLOCA PRODUTO QUANTIDADE |
|
453
|
|
|
$wBoxQt = $w*0.08; |
|
454
|
|
|
$xBoxQt = $wBoxDescricao + $xBoxDescricao; |
|
455
|
|
|
$texto = $qCom; |
|
456
|
|
|
$this->pdf->textBox( |
|
457
|
|
|
$xBoxQt, |
|
458
|
|
|
$yBoxProd, |
|
459
|
|
|
$wBoxQt, |
|
460
|
|
|
$hMaxLinha, |
|
461
|
|
|
$texto, |
|
462
|
|
|
$aFontProdutos, |
|
463
|
|
|
'C', |
|
464
|
|
|
'C', |
|
465
|
|
|
0, |
|
|
|
|
|
|
466
|
|
|
'', |
|
467
|
|
|
false |
|
468
|
|
|
); |
|
469
|
|
|
//COLOCA PRODUTO UNIDADE |
|
470
|
|
|
$wBoxUn = $w*0.06; |
|
471
|
|
|
$xBoxUn = $wBoxQt + $xBoxQt; |
|
472
|
|
|
$texto = $uCom; |
|
473
|
|
|
$this->pdf->textBox( |
|
474
|
|
|
$xBoxUn, |
|
475
|
|
|
$yBoxProd, |
|
476
|
|
|
$wBoxUn, |
|
477
|
|
|
$hMaxLinha, |
|
478
|
|
|
$texto, |
|
479
|
|
|
$aFontProdutos, |
|
480
|
|
|
'C', |
|
481
|
|
|
'C', |
|
482
|
|
|
0, |
|
|
|
|
|
|
483
|
|
|
'', |
|
484
|
|
|
false |
|
485
|
|
|
); |
|
486
|
|
|
//COLOCA PRODUTO VL UNITÁRIO |
|
487
|
|
|
$wBoxVl = $w*0.13; |
|
488
|
|
|
$xBoxVl = $wBoxUn + $xBoxUn; |
|
489
|
|
|
$texto = $vUnCom; |
|
490
|
|
|
$this->pdf->textBox( |
|
491
|
|
|
$xBoxVl, |
|
492
|
|
|
$yBoxProd, |
|
493
|
|
|
$wBoxVl, |
|
494
|
|
|
$hMaxLinha, |
|
495
|
|
|
$texto, |
|
496
|
|
|
$aFontProdutos, |
|
497
|
|
|
'C', |
|
498
|
|
|
'R', |
|
499
|
|
|
0, |
|
|
|
|
|
|
500
|
|
|
'', |
|
501
|
|
|
false |
|
502
|
|
|
); |
|
503
|
|
|
//COLOCA PRODUTO VL TOTAL |
|
504
|
|
|
$wBoxTotal = $w*0.13; |
|
505
|
|
|
$xBoxTotal = $wBoxVl + $xBoxVl; |
|
506
|
|
|
$texto = $vProd; |
|
507
|
|
|
$this->pdf->textBox( |
|
508
|
|
|
$xBoxTotal, |
|
509
|
|
|
$yBoxProd, |
|
510
|
|
|
$wBoxTotal, |
|
511
|
|
|
$hMaxLinha, |
|
512
|
|
|
$texto, |
|
513
|
|
|
$aFontProdutos, |
|
514
|
|
|
'C', |
|
515
|
|
|
'R', |
|
516
|
|
|
0, |
|
|
|
|
|
|
517
|
|
|
'', |
|
518
|
|
|
false |
|
519
|
|
|
); |
|
520
|
|
|
|
|
521
|
|
|
$cont++; |
|
522
|
|
|
} |
|
523
|
|
|
} |
|
524
|
|
|
} |
|
525
|
|
|
|
|
526
|
|
|
protected function totalDANFE($x = 0, $y = 0, $h = 0) |
|
|
|
|
|
|
527
|
|
|
{ |
|
528
|
|
|
$margemInterna = $this->margemInterna; |
|
|
|
|
|
|
529
|
|
|
$maxW = $this->wPrint; |
|
530
|
|
|
$hLinha = 3; |
|
531
|
|
|
$wColEsq = ($maxW*0.7); |
|
532
|
|
|
$wColDir = ($maxW*0.3); |
|
533
|
|
|
$xValor = $x + $wColEsq; |
|
534
|
|
|
$qtdItens = $this->det->length; |
|
535
|
|
|
$vProd = $this->getTagValue($this->ICMSTot, "vProd"); |
|
536
|
|
|
$vNF = $this->getTagValue($this->ICMSTot, "vNF"); |
|
537
|
|
|
$vDesc = $this->getTagValue($this->ICMSTot, "vDesc"); |
|
538
|
|
|
$vFrete = $this->getTagValue($this->ICMSTot, "vFrete"); |
|
539
|
|
|
$vTotTrib = $this->getTagValue($this->ICMSTot, "vTotTrib"); |
|
540
|
|
|
$texto = "Qtd. Total de Itens"; |
|
541
|
|
|
$aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
|
542
|
|
|
$this->pdf->textBox($x, $y, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false); |
|
|
|
|
|
|
543
|
|
|
$texto = $qtdItens; |
|
544
|
|
|
$aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
|
545
|
|
|
$this->pdf->textBox($xValor, $y, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false); |
|
|
|
|
|
|
546
|
|
|
$yTotal = $y + ($hLinha); |
|
547
|
|
|
$texto = "Total de Produtos"; |
|
548
|
|
|
$aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
|
549
|
|
|
$this->pdf->textBox($x, $yTotal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false); |
|
|
|
|
|
|
550
|
|
|
$texto = "R$ " . number_format($vProd, 2, ",", "."); |
|
551
|
|
|
$aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
|
552
|
|
|
$this->pdf->textBox($xValor, $yTotal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false); |
|
|
|
|
|
|
553
|
|
|
$yDesconto = $y + ($hLinha*2); |
|
554
|
|
|
$texto = "Descontos"; |
|
555
|
|
|
$aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
|
556
|
|
|
$this->pdf->textBox($x, $yDesconto, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false); |
|
|
|
|
|
|
557
|
|
|
$texto = "R$ " . $vDesc; |
|
558
|
|
|
$aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
|
559
|
|
|
$this->pdf->textBox($xValor, $yDesconto, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false); |
|
|
|
|
|
|
560
|
|
|
$yFrete= $y + ($hLinha*3); |
|
561
|
|
|
$texto = "Frete"; |
|
562
|
|
|
$aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
|
563
|
|
|
$this->pdf->textBox($x, $yFrete, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false); |
|
|
|
|
|
|
564
|
|
|
$texto = "R$ " . $vFrete; |
|
565
|
|
|
$aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
|
566
|
|
|
$this->pdf->textBox($xValor, $yFrete, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false); |
|
|
|
|
|
|
567
|
|
|
$yTotalFinal = $y + ($hLinha*4); |
|
568
|
|
|
$texto = "Total"; |
|
569
|
|
|
$aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
|
570
|
|
|
$this->pdf->textBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false); |
|
|
|
|
|
|
571
|
|
|
$texto = "R$ " . $vNF; |
|
572
|
|
|
$aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
|
573
|
|
|
$this->pdf->textBox($xValor, $yTotalFinal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false); |
|
|
|
|
|
|
574
|
|
|
$yTotalFinal = $y + ($hLinha*5); |
|
575
|
|
|
$texto = "Informação dos Tributos Totais Incidentes"; |
|
576
|
|
|
$aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'']; |
|
577
|
|
|
$this->pdf->textBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false); |
|
|
|
|
|
|
578
|
|
|
$texto = "R$ " . $vTotTrib; |
|
579
|
|
|
$aFont = ['font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B']; |
|
580
|
|
|
$this->pdf->textBox($xValor, $yTotalFinal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false); |
|
|
|
|
|
|
581
|
|
|
} |
|
582
|
|
|
|
|
583
|
|
|
protected function pagamentosDANFE($x = 0, $y = 0, $h = 0) |
|
|
|
|
|
|
584
|
|
|
{ |
|
585
|
|
|
$y += 6; |
|
586
|
|
|
$margemInterna = $this->margemInterna; |
|
|
|
|
|
|
587
|
|
|
$maxW = $this->wPrint; |
|
588
|
|
|
$qtdPgto = $this->pag->length; |
|
589
|
|
|
$w = ($maxW*1); |
|
590
|
|
|
$hLinha = $this->hLinha; |
|
591
|
|
|
$wColEsq = ($maxW*0.7); |
|
592
|
|
|
$wColDir = ($maxW*0.3); |
|
|
|
|
|
|
593
|
|
|
$xValor = $x + $wColEsq; |
|
|
|
|
|
|
594
|
|
|
$aFontPgto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'); |
|
595
|
|
|
$wBoxEsq = $w*0.7; |
|
596
|
|
|
$texto = "FORMA DE PAGAMENTO"; |
|
597
|
|
|
$this->pdf->textBox($x, $y, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false); |
|
|
|
|
|
|
598
|
|
|
$wBoxDir = $w*0.3; |
|
599
|
|
|
$xBoxDescricao = $x + $wBoxEsq; |
|
600
|
|
|
$texto = "VALOR PAGO"; |
|
601
|
|
|
$this->pdf->textBox($xBoxDescricao, $y, $wBoxDir, $hLinha, $texto, $aFontPgto, 'T', 'R', 0, '', false); |
|
|
|
|
|
|
602
|
|
|
$cont = 0; |
|
603
|
|
|
if ($qtdPgto > 0) { |
|
604
|
|
|
foreach ($this->pag as $pagI) { |
|
605
|
|
|
$tPag = $this->getTagValue($pagI, "tPag"); |
|
606
|
|
|
$tPagNome = $this->tipoPag($tPag); |
|
607
|
|
|
$tPnome = $tPagNome; |
|
|
|
|
|
|
608
|
|
|
$vPag = number_format($this->getTagValue($pagI, "vPag"), 2, ",", "."); |
|
609
|
|
|
$card = $pagI->getElementsByTagName("card")->item(0); |
|
610
|
|
|
$cardCNPJ = ''; |
|
|
|
|
|
|
611
|
|
|
$tBand = ''; |
|
|
|
|
|
|
612
|
|
|
$tBandNome = ''; |
|
|
|
|
|
|
613
|
|
|
if (isset($card)) { |
|
614
|
|
|
$cardCNPJ = $this->getTagValue($card, "CNPJ"); |
|
|
|
|
|
|
615
|
|
|
$tBand = $this->getTagValue($card, "tBand"); |
|
616
|
|
|
$cAut = $this->getTagValue($card, "cAut"); |
|
|
|
|
|
|
617
|
|
|
$tBandNome = self::getCardName($tBand); |
|
|
|
|
|
|
618
|
|
|
} |
|
619
|
|
|
//COLOCA PRODUTO |
|
620
|
|
|
$yBoxProd = $y + $hLinha + ($cont*$hLinha); |
|
621
|
|
|
//COLOCA PRODUTO CÓDIGO |
|
622
|
|
|
$texto = $tPagNome; |
|
623
|
|
|
$this->pdf->textBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false); |
|
|
|
|
|
|
624
|
|
|
//COLOCA PRODUTO DESCRIÇÃO |
|
625
|
|
|
$xBoxDescricao = $wBoxEsq + $x; |
|
626
|
|
|
$texto = "R$ " . $vPag; |
|
627
|
|
|
$this->pdf->textBox( |
|
628
|
|
|
$xBoxDescricao, |
|
629
|
|
|
$yBoxProd, |
|
630
|
|
|
$wBoxDir, |
|
631
|
|
|
$hLinha, |
|
632
|
|
|
$texto, |
|
633
|
|
|
$aFontPgto, |
|
634
|
|
|
'C', |
|
635
|
|
|
'R', |
|
636
|
|
|
0, |
|
|
|
|
|
|
637
|
|
|
'', |
|
638
|
|
|
false |
|
639
|
|
|
); |
|
640
|
|
|
$cont++; |
|
641
|
|
|
} |
|
642
|
|
|
|
|
643
|
|
|
if (!empty($this->vTroco)) { |
|
644
|
|
|
$yBoxProd = $y + $hLinha + ($cont*$hLinha); |
|
645
|
|
|
//COLOCA PRODUTO CÓDIGO |
|
646
|
|
|
$texto = 'Troco'; |
|
647
|
|
|
$this->pdf->textBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false); |
|
|
|
|
|
|
648
|
|
|
//COLOCA PRODUTO DESCRIÇÃO |
|
649
|
|
|
$xBoxDescricao = $wBoxEsq + $x; |
|
650
|
|
|
$texto = "R$ " . number_format($this->vTroco, 2, ",", "."); |
|
651
|
|
|
$this->pdf->textBox( |
|
652
|
|
|
$xBoxDescricao, |
|
653
|
|
|
$yBoxProd, |
|
654
|
|
|
$wBoxDir, |
|
655
|
|
|
$hLinha, |
|
656
|
|
|
$texto, |
|
657
|
|
|
$aFontPgto, |
|
658
|
|
|
'C', |
|
659
|
|
|
'R', |
|
660
|
|
|
0, |
|
|
|
|
|
|
661
|
|
|
'', |
|
662
|
|
|
false |
|
663
|
|
|
); |
|
664
|
|
|
} |
|
665
|
|
|
} |
|
666
|
|
|
} |
|
667
|
|
|
|
|
668
|
|
|
protected function fiscalDANFE($x = 0, $y = 0, $h = 0) |
|
669
|
|
|
{ |
|
670
|
|
|
$y += 6; |
|
671
|
|
|
$margemInterna = $this->margemInterna; |
|
|
|
|
|
|
672
|
|
|
$maxW = $this->wPrint; |
|
673
|
|
|
$w = ($maxW*1); |
|
674
|
|
|
$hLinha = $this->hLinha; |
|
675
|
|
|
$aFontTit = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B']; |
|
676
|
|
|
$aFontTex = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'']; |
|
677
|
|
|
$digVal = $this->getTagValue($this->nfe, "DigestValue"); |
|
|
|
|
|
|
678
|
|
|
$chNFe = str_replace('NFe', '', $this->infNFe->getAttribute("Id")); |
|
679
|
|
|
$tpAmb = $this->getTagValue($this->ide, 'tpAmb'); |
|
|
|
|
|
|
680
|
|
|
|
|
681
|
|
|
if ($this->checkCancelada()) { |
|
682
|
|
|
//101 Cancelamento |
|
683
|
|
|
$this->pdf->setTextColor(255, 0, 0); |
|
684
|
|
|
$texto = "NFCe CANCELADA"; |
|
685
|
|
|
$this->pdf->textBox($x, $y - 25, $w, $h, $texto, $aFontTit, 'C', 'C', 0, ''); |
|
|
|
|
|
|
686
|
|
|
$this->pdf->setTextColor(0, 0, 0); |
|
687
|
|
|
} |
|
688
|
|
|
|
|
689
|
|
|
if ($this->checkDenegada()) { |
|
690
|
|
|
//uso denegado |
|
691
|
|
|
$this->pdf->setTextColor(255, 0, 0); |
|
692
|
|
|
$texto = "NFCe CANCELADA"; |
|
693
|
|
|
$this->pdf->textBox($x, $y - 25, $w, $h, $texto, $aFontTit, 'C', 'C', 0, ''); |
|
|
|
|
|
|
694
|
|
|
$this->pdf->SetTextColor(0, 0, 0); |
|
695
|
|
|
} |
|
696
|
|
|
|
|
697
|
|
|
$cUF = $this->getTagValue($this->ide, 'cUF'); |
|
|
|
|
|
|
698
|
|
|
$nNF = $this->getTagValue($this->ide, 'nNF'); |
|
699
|
|
|
$serieNF = str_pad($this->getTagValue($this->ide, "serie"), 3, "0", STR_PAD_LEFT); |
|
700
|
|
|
$dhEmi = $this->getTagValue($this->ide, "dhEmi"); |
|
701
|
|
|
$dhEmilocal = new \DateTime($dhEmi); |
|
702
|
|
|
$dhEmiLocalFormat = $dhEmilocal->format('d/m/Y H:i:s'); |
|
703
|
|
|
$texto = "ÁREA DE MENSAGEM FISCAL"; |
|
704
|
|
|
$this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false); |
|
|
|
|
|
|
705
|
|
|
$yTex1 = $y + ($hLinha*1); |
|
706
|
|
|
$hTex1 = $hLinha*2; |
|
707
|
|
|
$texto = "Número " . $nNF . " Série " . $serieNF . " " .$dhEmiLocalFormat . " - Via Consumidor"; |
|
708
|
|
|
$this->pdf->textBox($x, $yTex1, $w, $hTex1, $texto, $aFontTex, 'C', 'C', 0, '', false); |
|
|
|
|
|
|
709
|
|
|
$yTex2 = $y + ($hLinha*3); |
|
710
|
|
|
$hTex2 = $hLinha*2; |
|
711
|
|
|
|
|
712
|
|
|
$texto = !empty($this->urlChave) ? "Consulte pela Chave de Acesso em " . $this->urlChave : ''; |
|
713
|
|
|
$this->pdf->textBox($x, $yTex2, $w, $hTex2, $texto, $aFontTex, 'C', 'C', 0, '', false); |
|
|
|
|
|
|
714
|
|
|
$texto = "CHAVE DE ACESSO"; |
|
715
|
|
|
$yTit2 = $y + ($hLinha*5); |
|
716
|
|
|
$this->pdf->textBox($x, $yTit2, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false); |
|
|
|
|
|
|
717
|
|
|
$yTex3 = $y + ($hLinha*6); |
|
718
|
|
|
$texto = $chNFe; |
|
719
|
|
|
$this->pdf->textBox($x, $yTex3, $w, $hLinha, $texto, $aFontTex, 'C', 'C', 0, '', false); |
|
|
|
|
|
|
720
|
|
|
} |
|
721
|
|
|
|
|
722
|
|
|
protected function consumidorDANFE($x = 0, $y = 0, $h = 0) |
|
|
|
|
|
|
723
|
|
|
{ |
|
724
|
|
|
$y += 6; |
|
725
|
|
|
$margemInterna = $this->margemInterna; |
|
|
|
|
|
|
726
|
|
|
$maxW = $this->wPrint; |
|
727
|
|
|
$w = ($maxW*1); |
|
728
|
|
|
$hLinha = $this->hLinha; |
|
729
|
|
|
$aFontTit = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B']; |
|
730
|
|
|
$aFontTex = ['font'=>$this->fontePadrao, 'size'=>8, 'style'=>'']; |
|
731
|
|
|
$texto = "CONSUMIDOR"; |
|
732
|
|
|
$this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false); |
|
|
|
|
|
|
733
|
|
|
if (isset($this->dest)) { |
|
734
|
|
|
$considEstrangeiro = !empty($this->dest->getElementsByTagName("idEstrangeiro")->item(0)->nodeValue) |
|
735
|
|
|
? $this->dest->getElementsByTagName("idEstrangeiro")->item(0)->nodeValue |
|
736
|
|
|
: ''; |
|
737
|
|
|
$consCPF = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) |
|
738
|
|
|
? $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue |
|
739
|
|
|
: ''; |
|
740
|
|
|
$consCNPJ = !empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue) |
|
741
|
|
|
? $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue |
|
742
|
|
|
: ''; |
|
743
|
|
|
$cDest = $consCPF.$consCNPJ.$considEstrangeiro; //documentos do consumidor |
|
|
|
|
|
|
744
|
|
|
$enderDest = $this->dest->getElementsByTagName("enderDest")->item(0); |
|
745
|
|
|
$consNome = $this->getTagValue($this->dest, "xNome"); |
|
746
|
|
|
$consLgr = $this->getTagValue($enderDest, "xLgr"); |
|
747
|
|
|
$consNro = $this->getTagValue($enderDest, "nro"); |
|
748
|
|
|
$consCpl = $this->getTagValue($enderDest, "xCpl", " - "); |
|
749
|
|
|
$consBairro = $this->getTagValue($enderDest, "xBairro"); |
|
750
|
|
|
$consCEP = $this->formatField($this->getTagValue($enderDest, "CEP")); |
|
751
|
|
|
$consMun = $this->getTagValue($enderDest, "xMun"); |
|
752
|
|
|
$consUF = $this->getTagValue($enderDest, "UF"); |
|
753
|
|
|
$considEstrangeiro = $this->getTagValue($this->dest, "idEstrangeiro"); |
|
754
|
|
|
$consCPF = $this->getTagValue($this->dest, "CPF"); |
|
755
|
|
|
$consCNPJ = $this->getTagValue($this->dest, "CNPJ"); |
|
756
|
|
|
$consDoc = ""; |
|
757
|
|
|
if (!empty($consCNPJ)) { |
|
758
|
|
|
$consDoc = "CNPJ: $consCNPJ"; |
|
759
|
|
|
} elseif (!empty($consCPF)) { |
|
760
|
|
|
$consDoc = "CPF: $consCPF"; |
|
761
|
|
|
} elseif (!empty($considEstrangeiro)) { |
|
762
|
|
|
$consDoc = "id: $considEstrangeiro"; |
|
763
|
|
|
} |
|
764
|
|
|
$consEnd = ""; |
|
765
|
|
|
if (!empty($consLgr)) { |
|
766
|
|
|
$consEnd = $consLgr |
|
767
|
|
|
. "," |
|
768
|
|
|
. $consNro |
|
769
|
|
|
. " " |
|
770
|
|
|
. $consCpl |
|
771
|
|
|
. "," |
|
772
|
|
|
. $consBairro |
|
773
|
|
|
. ". CEP:" |
|
774
|
|
|
. $consCEP |
|
775
|
|
|
. ". " |
|
776
|
|
|
. $consMun |
|
777
|
|
|
. "-" |
|
778
|
|
|
. $consUF; |
|
779
|
|
|
} |
|
780
|
|
|
$yTex1 = $y + $hLinha; |
|
781
|
|
|
$texto = $consNome; |
|
782
|
|
|
if (!empty($consDoc)) { |
|
783
|
|
|
$texto .= " - ". $consDoc . "\n" . $consEnd; |
|
784
|
|
|
$this->pdf->textBox($x, $yTex1, $w, $hLinha*3, $texto, $aFontTex, 'C', 'C', 0, '', false); |
|
|
|
|
|
|
785
|
|
|
} |
|
786
|
|
|
} else { |
|
787
|
|
|
$yTex1 = $y + $hLinha; |
|
788
|
|
|
$texto = "Consumidor não identificado"; |
|
789
|
|
|
$this->pdf->textBox($x, $yTex1, $w, $hLinha, $texto, $aFontTex, 'C', 'C', 0, '', false); |
|
|
|
|
|
|
790
|
|
|
} |
|
791
|
|
|
} |
|
792
|
|
|
|
|
793
|
|
|
protected function qrCodeDANFE($x = 0, $y = 0, $h = 0) |
|
|
|
|
|
|
794
|
|
|
{ |
|
795
|
|
|
$y += 6; |
|
796
|
|
|
$margemInterna = $this->margemInterna; |
|
797
|
|
|
$maxW = $this->wPrint; |
|
798
|
|
|
$w = ($maxW*1)+4; |
|
799
|
|
|
$hLinha = $this->hLinha; |
|
|
|
|
|
|
800
|
|
|
$hBoxLinha = $this->hBoxLinha; |
|
801
|
|
|
$aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'); |
|
|
|
|
|
|
802
|
|
|
$aFontTex = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
|
803
|
|
|
$dhRecbto = ''; |
|
804
|
|
|
$nProt = ''; |
|
805
|
|
|
if (isset($this->nfeProc)) { |
|
806
|
|
|
$nProt = $this->getTagValue($this->nfeProc, "nProt"); |
|
807
|
|
|
$dhRecbto = $this->getTagValue($this->nfeProc, "dhRecbto"); |
|
808
|
|
|
} |
|
809
|
|
|
$barcode = new Barcode(); |
|
810
|
|
|
$bobj = $barcode->getBarcodeObj( |
|
811
|
|
|
'QRCODE,M', |
|
812
|
|
|
$this->qrCode, |
|
813
|
|
|
-4, |
|
814
|
|
|
-4, |
|
815
|
|
|
'black', |
|
816
|
|
|
array(-2, -2, -2, -2) |
|
817
|
|
|
)->setBackgroundColor('white'); |
|
818
|
|
|
$qrcode = $bobj->getPngData(); |
|
819
|
|
|
$wQr = 50; |
|
820
|
|
|
$hQr = 50; |
|
821
|
|
|
$yQr = ($y+$margemInterna); |
|
822
|
|
|
$xQr = ($w/2) - ($wQr/2); |
|
823
|
|
|
// prepare a base64 encoded "data url" |
|
824
|
|
|
$pic = 'data://text/plain;base64,' . base64_encode($qrcode); |
|
825
|
|
|
$info = getimagesize($pic); |
|
|
|
|
|
|
826
|
|
|
$this->pdf->image($pic, $xQr, $yQr, $wQr, $hQr, 'PNG'); |
|
827
|
|
|
$dt = new DateTime($dhRecbto); |
|
828
|
|
|
$yQr = ($yQr+$hQr+$margemInterna); |
|
829
|
|
|
$this->pdf->textBox($x, $yQr, $w-4, $hBoxLinha, "Protocolo de Autorização: " . $nProt . "\n" |
|
830
|
|
|
. $dt->format('d/m/Y H:i:s'), $aFontTex, 'C', 'C', 0, '', false); |
|
|
|
|
|
|
831
|
|
|
} |
|
832
|
|
|
|
|
833
|
|
|
protected function infAdic($x = 0, $y = 0, $h = 0) |
|
|
|
|
|
|
834
|
|
|
{ |
|
835
|
|
|
$y += 17; |
|
836
|
|
|
$margemInterna = $this->margemInterna; |
|
|
|
|
|
|
837
|
|
|
$maxW = $this->wPrint; |
|
838
|
|
|
$w = ($maxW * 1); |
|
839
|
|
|
$hLinha = $this->hLinha; |
|
840
|
|
|
$aFontTit = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B']; |
|
841
|
|
|
$aFontTex = ['font' => $this->fontePadrao, 'size' => 8, 'style' => '']; |
|
842
|
|
|
// seta o textbox do titulo |
|
843
|
|
|
$texto = "INFORMAÇÃO ADICIONAL"; |
|
844
|
|
|
if (isset($this->nfeProc) && $this->nfeProc->getElementsByTagName("xMsg")->length) { |
|
845
|
|
|
$y += 3; |
|
846
|
|
|
$texto = $texto . ' ' . $this->nfeProc->getElementsByTagName("xMsg")->item(0)->nodeValue; |
|
847
|
|
|
$heigthText = $this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false); |
|
|
|
|
|
|
848
|
|
|
$y += 4; |
|
849
|
|
|
} else { |
|
850
|
|
|
$heigthText = $this->pdf->textBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false); |
|
|
|
|
|
|
851
|
|
|
} |
|
852
|
|
|
// seta o textbox do texto adicional |
|
853
|
|
|
$this->pdf->textBox($x, $y+3, $w-2, $hLinha-3, $this->textoAdic, $aFontTex, 'T', 'L', 0, '', false); |
|
|
|
|
|
|
854
|
|
|
} |
|
855
|
|
|
|
|
856
|
|
|
/** |
|
857
|
|
|
* anfavea |
|
858
|
|
|
* Função para transformar o campo cdata do padrão ANFAVEA para |
|
859
|
|
|
* texto imprimível |
|
860
|
|
|
* |
|
861
|
|
|
* @param string $cdata campo CDATA |
|
862
|
|
|
* @return string conteúdo do campo CDATA como string |
|
863
|
|
|
*/ |
|
864
|
|
|
protected function anfaveaDANFE($cdata = '') |
|
865
|
|
|
{ |
|
866
|
|
|
if ($cdata == '') { |
|
867
|
|
|
return ''; |
|
868
|
|
|
} |
|
869
|
|
|
//remove qualquer texto antes ou depois da tag CDATA |
|
870
|
|
|
$cdata = str_replace('<![CDATA[', '<CDATA>', $cdata); |
|
871
|
|
|
$cdata = str_replace(']]>', '</CDATA>', $cdata); |
|
872
|
|
|
$cdata = preg_replace('/\s\s+/', ' ', $cdata); |
|
873
|
|
|
$cdata = str_replace("> <", "><", $cdata); |
|
874
|
|
|
$len = strlen($cdata); |
|
875
|
|
|
$startPos = strpos($cdata, '<'); |
|
876
|
|
|
if ($startPos === false) { |
|
877
|
|
|
return $cdata; |
|
878
|
|
|
} |
|
879
|
|
|
for ($x=$len; $x>0; $x--) { |
|
880
|
|
|
if (substr($cdata, $x, 1) == '>') { |
|
881
|
|
|
$endPos = $x; |
|
882
|
|
|
break; |
|
883
|
|
|
} |
|
884
|
|
|
} |
|
885
|
|
|
if ($startPos > 0) { |
|
886
|
|
|
$parte1 = substr($cdata, 0, $startPos); |
|
887
|
|
|
} else { |
|
888
|
|
|
$parte1 = ''; |
|
889
|
|
|
} |
|
890
|
|
|
$parte2 = substr($cdata, $startPos, $endPos-$startPos+1); |
|
|
|
|
|
|
891
|
|
|
if ($endPos < $len) { |
|
892
|
|
|
$parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1); |
|
893
|
|
|
} else { |
|
894
|
|
|
$parte3 = ''; |
|
895
|
|
|
} |
|
896
|
|
|
$texto = trim($parte1).' '.trim($parte3); |
|
897
|
|
|
if (strpos($parte2, '<CDATA>') === false) { |
|
898
|
|
|
$cdata = '<CDATA>'.$parte2.'</CDATA>'; |
|
899
|
|
|
} else { |
|
900
|
|
|
$cdata = $parte2; |
|
901
|
|
|
} |
|
902
|
|
|
//carrega o xml CDATA em um objeto DOM |
|
903
|
|
|
$dom = new Dom(); |
|
904
|
|
|
$dom->loadXML($cdata, LIBXML_NOBLANKS | LIBXML_NOEMPTYTAG); |
|
905
|
|
|
//$xml = $dom->saveXML(); |
|
906
|
|
|
//grupo CDATA infADprod |
|
907
|
|
|
$id = $dom->getElementsByTagName('id')->item(0); |
|
908
|
|
|
$div = $dom->getElementsByTagName('div')->item(0); |
|
909
|
|
|
$entg = $dom->getElementsByTagName('entg')->item(0); |
|
910
|
|
|
$dest = $dom->getElementsByTagName('dest')->item(0); |
|
911
|
|
|
$ctl = $dom->getElementsByTagName('ctl')->item(0); |
|
912
|
|
|
$ref = $dom->getElementsByTagName('ref')->item(0); |
|
913
|
|
|
if (isset($id)) { |
|
914
|
|
|
if ($id->hasAttributes()) { |
|
915
|
|
|
foreach ($id->attributes as $attr) { |
|
916
|
|
|
$name = $attr->nodeName; |
|
917
|
|
|
$value = $attr->nodeValue; |
|
918
|
|
|
$texto .= " $name : $value"; |
|
919
|
|
|
} |
|
920
|
|
|
} |
|
921
|
|
|
} |
|
922
|
|
|
if (isset($div)) { |
|
923
|
|
|
if ($div->hasAttributes()) { |
|
924
|
|
|
foreach ($div->attributes as $attr) { |
|
925
|
|
|
$name = $attr->nodeName; |
|
926
|
|
|
$value = $attr->nodeValue; |
|
927
|
|
|
$texto .= " $name : $value"; |
|
928
|
|
|
} |
|
929
|
|
|
} |
|
930
|
|
|
} |
|
931
|
|
|
if (isset($entg)) { |
|
932
|
|
|
if ($entg->hasAttributes()) { |
|
933
|
|
|
foreach ($entg->attributes as $attr) { |
|
934
|
|
|
$name = $attr->nodeName; |
|
935
|
|
|
$value = $attr->nodeValue; |
|
936
|
|
|
$texto .= " $name : $value"; |
|
937
|
|
|
} |
|
938
|
|
|
} |
|
939
|
|
|
} |
|
940
|
|
|
if (isset($dest)) { |
|
941
|
|
|
if ($dest->hasAttributes()) { |
|
942
|
|
|
foreach ($dest->attributes as $attr) { |
|
943
|
|
|
$name = $attr->nodeName; |
|
944
|
|
|
$value = $attr->nodeValue; |
|
945
|
|
|
$texto .= " $name : $value"; |
|
946
|
|
|
} |
|
947
|
|
|
} |
|
948
|
|
|
} |
|
949
|
|
|
if (isset($ctl)) { |
|
950
|
|
|
if ($ctl->hasAttributes()) { |
|
951
|
|
|
foreach ($ctl->attributes as $attr) { |
|
952
|
|
|
$name = $attr->nodeName; |
|
953
|
|
|
$value = $attr->nodeValue; |
|
954
|
|
|
$texto .= " $name : $value"; |
|
955
|
|
|
} |
|
956
|
|
|
} |
|
957
|
|
|
} |
|
958
|
|
|
if (isset($ref)) { |
|
959
|
|
|
if ($ref->hasAttributes()) { |
|
960
|
|
|
foreach ($ref->attributes as $attr) { |
|
961
|
|
|
$name = $attr->nodeName; |
|
962
|
|
|
$value = $attr->nodeValue; |
|
963
|
|
|
$texto .= " $name : $value"; |
|
964
|
|
|
} |
|
965
|
|
|
} |
|
966
|
|
|
} |
|
967
|
|
|
//grupo CADATA infCpl |
|
968
|
|
|
$t = $dom->getElementsByTagName('transmissor')->item(0); |
|
969
|
|
|
$r = $dom->getElementsByTagName('receptor')->item(0); |
|
970
|
|
|
$versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ? |
|
971
|
|
|
'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : ''; |
|
972
|
|
|
$especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ? |
|
973
|
|
|
'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : ''; |
|
974
|
|
|
$fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ? |
|
975
|
|
|
'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : ''; |
|
976
|
|
|
$dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ? |
|
977
|
|
|
'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : ''; |
|
978
|
|
|
$texto .= "".$versao.$especieNF.$fabEntrega.$dca; |
|
979
|
|
|
if (isset($t)) { |
|
980
|
|
|
if ($t->hasAttributes()) { |
|
981
|
|
|
$texto .= " Transmissor "; |
|
982
|
|
|
foreach ($t->attributes as $attr) { |
|
983
|
|
|
$name = $attr->nodeName; |
|
984
|
|
|
$value = $attr->nodeValue; |
|
985
|
|
|
$texto .= " $name : $value"; |
|
986
|
|
|
} |
|
987
|
|
|
} |
|
988
|
|
|
} |
|
989
|
|
|
if (isset($r)) { |
|
990
|
|
|
if ($r->hasAttributes()) { |
|
991
|
|
|
$texto .= " Receptor "; |
|
992
|
|
|
foreach ($r->attributes as $attr) { |
|
993
|
|
|
$name = $attr->nodeName; |
|
994
|
|
|
$value = $attr->nodeValue; |
|
995
|
|
|
$texto .= " $name : $value"; |
|
996
|
|
|
} |
|
997
|
|
|
} |
|
998
|
|
|
} |
|
999
|
|
|
return $texto; |
|
1000
|
|
|
} |
|
1001
|
|
|
|
|
1002
|
|
|
protected static function getCardName($tBand) |
|
1003
|
|
|
{ |
|
1004
|
|
|
switch ($tBand) { |
|
1005
|
|
|
case '01': |
|
1006
|
|
|
$tBandNome = 'VISA'; |
|
1007
|
|
|
break; |
|
1008
|
|
|
case '02': |
|
1009
|
|
|
$tBandNome = 'MASTERCARD'; |
|
1010
|
|
|
break; |
|
1011
|
|
|
case '03': |
|
1012
|
|
|
$tBandNome = 'AMERICAM EXPRESS'; |
|
1013
|
|
|
break; |
|
1014
|
|
|
case '04': |
|
1015
|
|
|
$tBandNome = 'SOROCRED'; |
|
1016
|
|
|
break; |
|
1017
|
|
|
case '99': |
|
1018
|
|
|
$tBandNome = 'OUTROS'; |
|
1019
|
|
|
break; |
|
1020
|
|
|
default: |
|
1021
|
|
|
$tBandNome = ''; |
|
1022
|
|
|
} |
|
1023
|
|
|
return $tBandNome; |
|
1024
|
|
|
} |
|
1025
|
|
|
|
|
1026
|
|
|
protected function checkCancelada() |
|
1027
|
|
|
{ |
|
1028
|
|
|
if (!isset($this->nfeProc)) { |
|
1029
|
|
|
return false; |
|
1030
|
|
|
} |
|
1031
|
|
|
$cStat = $this->getTagValue($this->nfeProc, "cStat"); |
|
1032
|
|
|
return $cStat == '101' || |
|
1033
|
|
|
$cStat == '151' || |
|
1034
|
|
|
$cStat == '135' || |
|
1035
|
|
|
$cStat == '155'; |
|
1036
|
|
|
} |
|
1037
|
|
|
|
|
1038
|
|
|
protected function checkDenegada() |
|
1039
|
|
|
{ |
|
1040
|
|
|
if (!isset($this->nfeProc)) { |
|
1041
|
|
|
return false; |
|
1042
|
|
|
} |
|
1043
|
|
|
//NÃO ERA NECESSÁRIO ESSA FUNÇÃO POIS SÓ SE USA |
|
1044
|
|
|
//1 VEZ NO ARQUIVO INTEIRO |
|
1045
|
|
|
$cStat = $this->getTagValue($this->nfeProc, "cStat"); |
|
1046
|
|
|
return $cStat == '110' || |
|
1047
|
|
|
$cStat == '301' || |
|
1048
|
|
|
$cStat == '302'; |
|
1049
|
|
|
} |
|
1050
|
|
|
} |
|
1051
|
|
|
|
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: