|
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-2020 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
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
use DateTime; |
|
17
|
|
|
use Exception; |
|
18
|
|
|
use InvalidArgumentException; |
|
19
|
|
|
use NFePHP\DA\Legacy\Dom; |
|
20
|
|
|
use NFePHP\DA\Legacy\Pdf; |
|
21
|
|
|
use NFePHP\DA\Common\DaCommon; |
|
22
|
|
|
use Com\Tecnick\Barcode\Barcode; |
|
23
|
|
|
|
|
24
|
|
|
class Danfce extends DaCommon |
|
25
|
|
|
{ |
|
26
|
|
|
protected $papel; |
|
27
|
|
|
protected $paperwidth = 80; |
|
28
|
|
|
protected $descPercent = 0.38; |
|
29
|
|
|
protected $xml; // string XML NFe |
|
30
|
|
|
protected $logomarca=''; // path para logomarca em jpg |
|
31
|
|
|
protected $formatoChave="#### #### #### #### #### #### #### #### #### #### ####"; |
|
32
|
|
|
protected $nfeProc; |
|
33
|
|
|
protected $nfe; |
|
34
|
|
|
protected $infNFe; |
|
35
|
|
|
protected $ide; |
|
36
|
|
|
protected $enderDest; |
|
37
|
|
|
protected $ICMSTot; |
|
38
|
|
|
protected $imposto; |
|
39
|
|
|
protected $emit; |
|
40
|
|
|
protected $enderEmit; |
|
41
|
|
|
protected $qrCode; |
|
42
|
|
|
protected $urlChave; |
|
43
|
|
|
protected $det; |
|
44
|
|
|
protected $infAdic; |
|
45
|
|
|
protected $textoAdic; |
|
46
|
|
|
protected $tpEmis; |
|
47
|
|
|
protected $tpAmb; |
|
48
|
|
|
protected $pag; |
|
49
|
|
|
protected $vTroco; |
|
50
|
|
|
protected $itens = []; |
|
51
|
|
|
protected $dest; |
|
52
|
|
|
protected $imgQRCode; |
|
53
|
|
|
protected $urlQR = ''; |
|
54
|
|
|
protected $pdf; |
|
55
|
|
|
protected $margem = 2; |
|
56
|
|
|
protected $flagResume = false; |
|
57
|
|
|
protected $hMaxLinha = 5; |
|
58
|
|
|
protected $hBoxLinha = 6; |
|
59
|
|
|
protected $hLinha = 3; |
|
60
|
|
|
protected $aFontTit = ['font' => 'times', 'size' => 9, 'style' => 'B']; |
|
61
|
|
|
protected $aFontTex = ['font' => 'times', 'size' => 8, 'style' => '']; |
|
62
|
|
|
protected $via = "Via Consumidor"; |
|
63
|
|
|
protected $offline_double = true; |
|
64
|
|
|
protected $canceled = false; |
|
65
|
|
|
protected $submessage = null; |
|
66
|
|
|
|
|
67
|
|
|
protected $bloco1H = 18.0; //cabecalho |
|
68
|
|
|
protected $bloco2H = 12.0; //informação fiscal |
|
69
|
|
|
|
|
70
|
|
|
protected $bloco3H = 0.0; //itens |
|
71
|
|
|
protected $bloco4H = 13.0; //totais |
|
72
|
|
|
protected $bloco5H = 0.0; //formas de pagamento |
|
73
|
|
|
|
|
74
|
|
|
protected $bloco6H = 10.0; //informação para consulta |
|
75
|
|
|
protected $bloco7H = 20.0; //informações do consumidor |
|
76
|
|
|
protected $bloco8H = 50.0; //informações do consumidor |
|
77
|
|
|
protected $bloco9H = 4.0; //informações sobre tributos |
|
78
|
|
|
protected $bloco10H = 5.0; //informações do integrador |
|
79
|
|
|
|
|
80
|
|
|
use Traits\TraitBlocoI; |
|
81
|
|
|
use Traits\TraitBlocoII; |
|
82
|
|
|
use Traits\TraitBlocoIII; |
|
83
|
|
|
use Traits\TraitBlocoIV; |
|
84
|
|
|
use Traits\TraitBlocoV; |
|
85
|
|
|
use Traits\TraitBlocoVI; |
|
86
|
|
|
use Traits\TraitBlocoVII; |
|
87
|
|
|
use Traits\TraitBlocoVIII; |
|
88
|
|
|
use Traits\TraitBlocoIX; |
|
89
|
|
|
use Traits\TraitBlocoX; |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* Construtor |
|
93
|
|
|
* |
|
94
|
|
|
* @param string $xml |
|
95
|
|
|
* |
|
96
|
|
|
* @throws Exception |
|
97
|
|
|
*/ |
|
98
|
|
|
public function __construct($xml) |
|
99
|
|
|
{ |
|
100
|
|
|
$this->xml = $xml; |
|
101
|
|
|
if (empty($xml)) { |
|
102
|
|
|
throw new \Exception('Um xml de NFCe deve ser passado ao construtor da classe.'); |
|
103
|
|
|
} |
|
104
|
|
|
//carrega dados do xml |
|
105
|
|
|
$this->loadXml(); |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* Seta a largura do papel de impressão em mm |
|
110
|
|
|
* |
|
111
|
|
|
* @param int $width |
|
112
|
|
|
*/ |
|
113
|
|
|
public function setPaperWidth($width = 80) |
|
114
|
|
|
{ |
|
115
|
|
|
if ($width < 58) { |
|
116
|
|
|
throw new Exception("Largura insuficiente para a impressão do documento"); |
|
117
|
|
|
} |
|
118
|
|
|
$this->paperwidth = $width; |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* Seta margens de impressão em mm |
|
123
|
|
|
* |
|
124
|
|
|
* @param int $width |
|
125
|
|
|
*/ |
|
126
|
|
|
public function setMargins($width = 2) |
|
127
|
|
|
{ |
|
128
|
|
|
if ($width > 4 || $width < 0) { |
|
129
|
|
|
throw new Exception("As margens devem estar entre 0 e 4 mm."); |
|
130
|
|
|
} |
|
131
|
|
|
$this->margem = $width; |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
/** |
|
135
|
|
|
* Seta a fonte a ser usada times ou arial |
|
136
|
|
|
* |
|
137
|
|
|
* @param string $font |
|
138
|
|
|
*/ |
|
139
|
|
|
public function setFont($font = 'times') |
|
140
|
|
|
{ |
|
141
|
|
|
if (!in_array($font, ['times', 'arial'])) { |
|
142
|
|
|
$this->fontePadrao = 'times'; |
|
143
|
|
|
} else { |
|
144
|
|
|
$this->fontePadrao = $font; |
|
145
|
|
|
} |
|
146
|
|
|
} |
|
147
|
|
|
|
|
148
|
|
|
/** |
|
149
|
|
|
* Seta a impressão para NFCe completa ou Simplificada |
|
150
|
|
|
* |
|
151
|
|
|
* @param bool $flag |
|
152
|
|
|
*/ |
|
153
|
|
|
public function setPrintResume($flag = false) |
|
154
|
|
|
{ |
|
155
|
|
|
$this->flagResume = $flag; |
|
156
|
|
|
} |
|
157
|
|
|
|
|
158
|
|
|
/** |
|
159
|
|
|
* Marca como cancelada |
|
160
|
|
|
*/ |
|
161
|
|
|
public function setAsCanceled() |
|
162
|
|
|
{ |
|
163
|
|
|
$this->canceled = true; |
|
164
|
|
|
} |
|
165
|
|
|
|
|
166
|
|
|
/** |
|
167
|
|
|
* Registra via do estabelecimento quando a impressção for offline |
|
168
|
|
|
*/ |
|
169
|
|
|
public function setViaEstabelecimento() |
|
170
|
|
|
{ |
|
171
|
|
|
$this->via = "Via Estabelecimento"; |
|
172
|
|
|
} |
|
173
|
|
|
|
|
174
|
|
|
/** |
|
175
|
|
|
* Habilita a impressão de duas vias quando NFCe for OFFLINE |
|
176
|
|
|
* |
|
177
|
|
|
* @param bool $flag |
|
178
|
|
|
*/ |
|
179
|
|
|
public function setOffLineDoublePrint($flag = true) |
|
180
|
|
|
{ |
|
181
|
|
|
$this->offline_double = $flag; |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
/** |
|
185
|
|
|
* Renderiza o pdf |
|
186
|
|
|
* |
|
187
|
|
|
* @param string $logo |
|
188
|
|
|
* @return string |
|
189
|
|
|
*/ |
|
190
|
|
|
public function render($logo = '') |
|
191
|
|
|
{ |
|
192
|
|
|
$this->monta($logo); |
|
193
|
|
|
//$this->papel = 80; |
|
194
|
|
|
return $this->pdf->getPdf(); |
|
195
|
|
|
} |
|
196
|
|
|
|
|
197
|
|
|
protected function monta( |
|
198
|
|
|
$logo = '' |
|
199
|
|
|
) { |
|
200
|
|
|
if (!empty($logo)) { |
|
201
|
|
|
$this->logomarca = $this->adjustImage($logo, true); |
|
202
|
|
|
} |
|
203
|
|
|
$tamPapelVert = $this->calculatePaperLength(); |
|
204
|
|
|
$this->orientacao = 'P'; |
|
205
|
|
|
$this->papel = [$this->paperwidth, $tamPapelVert]; |
|
206
|
|
|
$this->logoAlign = 'L'; |
|
207
|
|
|
$this->pdf = new Pdf($this->orientacao, 'mm', $this->papel); |
|
|
|
|
|
|
208
|
|
|
|
|
209
|
|
|
//margens do PDF, em milímetros. Obs.: a margem direita é sempre igual à |
|
210
|
|
|
//margem esquerda. A margem inferior *não* existe na FPDF, é definida aqui |
|
211
|
|
|
//apenas para controle se necessário ser maior do que a margem superior |
|
212
|
|
|
$margSup = $this->margem; |
|
213
|
|
|
$margEsq = $this->margem; |
|
214
|
|
|
$margInf = $this->margem; |
|
215
|
|
|
// posição inicial do conteúdo, a partir do canto superior esquerdo da página |
|
216
|
|
|
$xInic = $margEsq; |
|
|
|
|
|
|
217
|
|
|
$yInic = $margSup; |
|
|
|
|
|
|
218
|
|
|
$maxW = $this->paperwidth; |
|
219
|
|
|
$maxH = $tamPapelVert; |
|
220
|
|
|
//total inicial de paginas |
|
221
|
|
|
$totPag = 1; |
|
|
|
|
|
|
222
|
|
|
//largura imprimivel em mm: largura da folha menos as margens esq/direita |
|
223
|
|
|
$this->wPrint = $maxW-($margEsq*2); |
|
|
|
|
|
|
224
|
|
|
//comprimento (altura) imprimivel em mm: altura da folha menos as margens |
|
225
|
|
|
//superior e inferior |
|
226
|
|
|
$this->hPrint = $maxH-$margSup-$margInf; |
|
227
|
|
|
// estabelece contagem de paginas |
|
228
|
|
|
$this->pdf->aliasNbPages(); |
|
229
|
|
|
$this->pdf->setMargins($margEsq, $margSup); // fixa as margens |
|
230
|
|
|
$this->pdf->setDrawColor(0, 0, 0); |
|
231
|
|
|
$this->pdf->setFillColor(255, 255, 255); |
|
232
|
|
|
$this->pdf->open(); // inicia o documento |
|
233
|
|
|
$this->pdf->addPage($this->orientacao, $this->papel); // adiciona a primeira página |
|
|
|
|
|
|
234
|
|
|
$this->pdf->setLineWidth(0.1); // define a largura da linha |
|
235
|
|
|
$this->pdf->setTextColor(0, 0, 0); |
|
236
|
|
|
|
|
237
|
|
|
$y = $this->blocoI(); //cabecalho |
|
238
|
|
|
$y = $this->blocoII($y); //informação cabeçalho fiscal e contingência |
|
239
|
|
|
|
|
240
|
|
|
$y = $this->blocoIII($y); //informação dos itens |
|
241
|
|
|
$y = $this->blocoIV($y); //informação sobre os totais |
|
242
|
|
|
$y = $this->blocoV($y); //informação sobre pagamento |
|
243
|
|
|
|
|
244
|
|
|
$y = $this->blocoVI($y); //informações sobre consulta pela chave |
|
245
|
|
|
$y = $this->blocoVII($y); //informações sobre o consumidor e dados da NFCe |
|
246
|
|
|
$y = $this->blocoVIII($y); //QRCODE |
|
247
|
|
|
$y = $this->blocoIX($y); //informações sobre tributos |
|
248
|
|
|
$y = $this->blocoX($y); //creditos |
|
|
|
|
|
|
249
|
|
|
|
|
250
|
|
|
$ymark = $maxH/4; |
|
251
|
|
|
if ($this->tpAmb == 2) { |
|
252
|
|
|
$this->pdf->setTextColor(120, 120, 120); |
|
253
|
|
|
$texto = "SEM VALOR FISCAL\nEmitida em ambiente de homologacao"; |
|
254
|
|
|
$aFont = ['font' => $this->fontePadrao, 'size' => 14, 'style' => 'B']; |
|
255
|
|
|
$ymark += $this->pdf->textBox( |
|
256
|
|
|
$this->margem, |
|
257
|
|
|
$ymark, |
|
258
|
|
|
$this->wPrint, |
|
259
|
|
|
$maxH/2, |
|
260
|
|
|
$texto, |
|
261
|
|
|
$aFont, |
|
262
|
|
|
'T', |
|
263
|
|
|
'C', |
|
264
|
|
|
false, |
|
265
|
|
|
'', |
|
266
|
|
|
false |
|
267
|
|
|
); |
|
268
|
|
|
$this->pdf->setTextColor(0, 0, 0); |
|
269
|
|
|
} |
|
270
|
|
|
if ($this->canceled) { |
|
271
|
|
|
$this->pdf->setTextColor(120, 120, 120); |
|
272
|
|
|
$texto = "CANCELADA"; |
|
273
|
|
|
$aFont = ['font' => $this->fontePadrao, 'size' => 24, 'style' => 'B']; |
|
274
|
|
|
$this->pdf->textBox( |
|
275
|
|
|
$this->margem, |
|
276
|
|
|
$ymark+4, |
|
277
|
|
|
$this->wPrint, |
|
278
|
|
|
$maxH/2, |
|
279
|
|
|
$texto, |
|
280
|
|
|
$aFont, |
|
281
|
|
|
'T', |
|
282
|
|
|
'C', |
|
283
|
|
|
false, |
|
284
|
|
|
'', |
|
285
|
|
|
false |
|
286
|
|
|
); |
|
287
|
|
|
$aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B']; |
|
288
|
|
|
$this->pdf->textBox( |
|
289
|
|
|
$this->margem, |
|
290
|
|
|
$ymark+14, |
|
291
|
|
|
$this->wPrint, |
|
292
|
|
|
$maxH/2, |
|
293
|
|
|
$this->submessage, |
|
294
|
|
|
$aFont, |
|
295
|
|
|
'T', |
|
296
|
|
|
'C', |
|
297
|
|
|
false, |
|
298
|
|
|
'', |
|
299
|
|
|
false |
|
300
|
|
|
); |
|
301
|
|
|
$this->pdf->setTextColor(0, 0, 0); |
|
302
|
|
|
} |
|
303
|
|
|
|
|
304
|
|
|
if (!$this->canceled && $this->tpEmis == 9 && $this->offline_double) { |
|
305
|
|
|
$this->setViaEstabelecimento(); |
|
306
|
|
|
//não está cancelada e foi emitida OFFLINE e está ativada a dupla impressão |
|
307
|
|
|
$this->pdf->addPage($this->orientacao, $this->papel); // adiciona a primeira página |
|
|
|
|
|
|
308
|
|
|
$this->pdf->setLineWidth(0.1); // define a largura da linha |
|
309
|
|
|
$this->pdf->setTextColor(0, 0, 0); |
|
310
|
|
|
$y = $this->blocoI(); //cabecalho |
|
311
|
|
|
$y = $this->blocoII($y); //informação cabeçalho fiscal e contingência |
|
312
|
|
|
$y = $this->blocoIII($y); //informação dos itens |
|
313
|
|
|
$y = $this->blocoIV($y); //informação sobre os totais |
|
314
|
|
|
$y = $this->blocoV($y); //informação sobre pagamento |
|
315
|
|
|
$y = $this->blocoVI($y); //informações sobre consulta pela chave |
|
316
|
|
|
$y = $this->blocoVII($y); //informações sobre o consumidor e dados da NFCe |
|
317
|
|
|
$y = $this->blocoVIII($y); //QRCODE |
|
318
|
|
|
$y = $this->blocoIX($y); //informações sobre tributos |
|
319
|
|
|
$y = $this->blocoX($y); //creditos |
|
|
|
|
|
|
320
|
|
|
$ymark = $maxH/4; |
|
321
|
|
|
if ($this->tpAmb == 2) { |
|
322
|
|
|
$this->pdf->setTextColor(120, 120, 120); |
|
323
|
|
|
$texto = "SEM VALOR FISCAL\nEmitida em ambiente de homologacao"; |
|
324
|
|
|
$aFont = ['font' => $this->fontePadrao, 'size' => 14, 'style' => 'B']; |
|
325
|
|
|
$ymark += $this->pdf->textBox( |
|
326
|
|
|
$this->margem, |
|
327
|
|
|
$ymark, |
|
328
|
|
|
$this->wPrint, |
|
329
|
|
|
$maxH/2, |
|
330
|
|
|
$texto, |
|
331
|
|
|
$aFont, |
|
332
|
|
|
'T', |
|
333
|
|
|
'C', |
|
334
|
|
|
false, |
|
335
|
|
|
'', |
|
336
|
|
|
false |
|
337
|
|
|
); |
|
338
|
|
|
} |
|
339
|
|
|
$this->pdf->setTextColor(0, 0, 0); |
|
340
|
|
|
} |
|
341
|
|
|
} |
|
342
|
|
|
|
|
343
|
|
|
|
|
344
|
|
|
private function calculatePaperLength() |
|
345
|
|
|
{ |
|
346
|
|
|
$wprint = $this->paperwidth - (2 * $this->margem); |
|
347
|
|
|
$this->bloco3H = $this->calculateHeightItens($wprint * $this->descPercent); |
|
348
|
|
|
$this->bloco5H = $this->calculateHeightPag(); |
|
349
|
|
|
|
|
350
|
|
|
$length = $this->bloco1H //cabecalho |
|
351
|
|
|
+ $this->bloco2H //informação fiscal |
|
352
|
|
|
+ $this->bloco3H //itens |
|
353
|
|
|
+ $this->bloco4H //totais |
|
354
|
|
|
+ $this->bloco5H //formas de pagamento |
|
355
|
|
|
+ $this->bloco6H //informação para consulta |
|
356
|
|
|
+ $this->bloco7H //informações do consumidor |
|
357
|
|
|
+ $this->bloco8H //qrcode |
|
358
|
|
|
+ $this->bloco9H //informações sobre tributos |
|
359
|
|
|
+ $this->bloco10H; //informações do integrador |
|
360
|
|
|
return $length; |
|
361
|
|
|
} |
|
362
|
|
|
|
|
363
|
|
|
/** |
|
364
|
|
|
* Carrega os dados do xml na classe |
|
365
|
|
|
* @param string $xml |
|
|
|
|
|
|
366
|
|
|
* |
|
367
|
|
|
* @throws InvalidArgumentException |
|
368
|
|
|
*/ |
|
369
|
|
|
private function loadXml() |
|
370
|
|
|
{ |
|
371
|
|
|
$this->dom = new Dom(); |
|
|
|
|
|
|
372
|
|
|
$this->dom->loadXML($this->xml); |
|
373
|
|
|
$this->ide = $this->dom->getElementsByTagName("ide")->item(0); |
|
374
|
|
|
$mod = $this->getTagValue($this->ide, "mod"); |
|
|
|
|
|
|
375
|
|
|
if ($this->getTagValue($this->ide, "mod") != '65') { |
|
376
|
|
|
throw new \Exception("O xml do DANFE deve ser uma NFC-e modelo 65"); |
|
377
|
|
|
} |
|
378
|
|
|
$this->tpAmb = $this->getTagValue($this->ide, 'tpAmb'); |
|
379
|
|
|
$this->nfeProc = $this->dom->getElementsByTagName("nfeProc")->item(0) ?? null; |
|
380
|
|
|
$this->infProt = $this->dom->getElementsByTagName("infProt")->item(0) ?? null; |
|
|
|
|
|
|
381
|
|
|
$this->nfe = $this->dom->getElementsByTagName("NFe")->item(0); |
|
382
|
|
|
$this->infNFe = $this->dom->getElementsByTagName("infNFe")->item(0); |
|
383
|
|
|
$this->emit = $this->dom->getElementsByTagName("emit")->item(0); |
|
384
|
|
|
$this->enderEmit = $this->dom->getElementsByTagName("enderEmit")->item(0); |
|
385
|
|
|
$this->det = $this->dom->getElementsByTagName("det"); |
|
386
|
|
|
$this->dest = $this->dom->getElementsByTagName("dest")->item(0); |
|
387
|
|
|
$this->enderDest = $this->dom->getElementsByTagName("enderDest")->item(0); |
|
388
|
|
|
$this->imposto = $this->dom->getElementsByTagName("imposto")->item(0); |
|
389
|
|
|
$this->ICMSTot = $this->dom->getElementsByTagName("ICMSTot")->item(0); |
|
390
|
|
|
$this->tpImp = $this->ide->getElementsByTagName("tpImp")->item(0)->nodeValue; |
|
|
|
|
|
|
391
|
|
|
$this->infAdic = $this->dom->getElementsByTagName("infAdic")->item(0); |
|
392
|
|
|
$this->tpEmis = $this->dom->getValue($this->ide, "tpEmis"); |
|
|
|
|
|
|
393
|
|
|
//se for o layout 4.0 busca pelas tags de detalhe do pagamento |
|
394
|
|
|
//senão, busca pelas tags de pagamento principal |
|
395
|
|
|
if ($this->infNFe->getAttribute("versao") == "4.00") { |
|
396
|
|
|
$this->pag = $this->dom->getElementsByTagName("detPag"); |
|
397
|
|
|
$tagPag = $this->dom->getElementsByTagName("pag")->item(0); |
|
398
|
|
|
$this->vTroco = $this->getTagValue($tagPag, "vTroco"); |
|
399
|
|
|
} else { |
|
400
|
|
|
$this->pag = $this->dom->getElementsByTagName("pag"); |
|
401
|
|
|
} |
|
402
|
|
|
$this->qrCode = !empty($this->dom->getElementsByTagName('qrCode')->item(0)->nodeValue) |
|
403
|
|
|
? $this->dom->getElementsByTagName('qrCode')->item(0)->nodeValue : null; |
|
404
|
|
|
$this->urlChave = !empty($this->dom->getElementsByTagName('urlChave')->item(0)->nodeValue) |
|
405
|
|
|
? $this->dom->getElementsByTagName('urlChave')->item(0)->nodeValue : null; |
|
406
|
|
|
if (!empty($this->infProt)) { |
|
407
|
|
|
$cStat = $this->getTagValue($this->infProt, 'cStat'); |
|
408
|
|
|
if ($cStat != 100) { |
|
409
|
|
|
$this->canceled = true; |
|
410
|
|
|
} elseif (!empty($retEvento = $this->nfeProc->getElementsByTagName('retEvento')->item(0))) { |
|
411
|
|
|
$infEvento = $retEvento->getElementsByTagName('infEvento')->item(0); |
|
412
|
|
|
$cStat = $this->getTagValue($infEvento, "cStat"); |
|
413
|
|
|
$tpEvento= $this->getTagValue($infEvento, "tpEvento"); |
|
414
|
|
|
$dhEvento = date("d/m/Y H:i:s", $this->toTimestamp($this->getTagValue($infEvento, "dhRegEvento"))); |
|
415
|
|
|
$nProt = $this->getTagValue($infEvento, "nProt"); |
|
416
|
|
|
if ($tpEvento == '110111' && ($cStat == '101' || $cStat == '151' || $cStat == '135' || $cStat == '155')) { |
|
417
|
|
|
$this->canceled = true; |
|
418
|
|
|
$this->submessage = "Data: {$dhEvento}\nProtocolo: {$nProt}"; |
|
419
|
|
|
} |
|
420
|
|
|
} |
|
421
|
|
|
} |
|
422
|
|
|
} |
|
423
|
|
|
} |
|
424
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: