@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | $this->id = str_replace('ID', '', $this->infCanc->getAttribute("Id")); |
129 | 129 | $this->chCTe = $this->infCanc->getElementsByTagName("chCTe")->item(0)->nodeValue; |
130 | - $this->aEnd['CNPJ']=substr($this->chCTe, 6, 14); |
|
130 | + $this->aEnd['CNPJ'] = substr($this->chCTe, 6, 14); |
|
131 | 131 | $this->tpAmb = $this->infCanc->getElementsByTagName("tpAmb")->item(0)->nodeValue; |
132 | 132 | $this->xJust = $this->infCanc->getElementsByTagName("xJust")->item(0)->nodeValue; |
133 | 133 | $this->dhEvento = $this->retCancCTe->getElementsByTagName("dhRecbto")->item(0)->nodeValue; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | $this->orientacao = $orientacao; |
180 | 180 | $this->papel = $papel; |
181 | 181 | $this->logoAlign = $logoAlign; |
182 | - if ($classPDF!==false) { |
|
182 | + if ($classPDF !== false) { |
|
183 | 183 | $this->pdf = $classPDF; |
184 | 184 | } else { |
185 | 185 | $this->pdf = new Pdf($this->orientacao, 'mm', $this->papel); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | // posição inicial do relatorio |
192 | 192 | $xInic = 1; |
193 | 193 | $yInic = 1; |
194 | - if ($this->papel =='A4') { |
|
194 | + if ($this->papel == 'A4') { |
|
195 | 195 | $maxW = 210; |
196 | 196 | $maxH = 297; |
197 | 197 | } |
@@ -202,15 +202,15 @@ discard block |
||
202 | 202 | // posição inicial do relatorio |
203 | 203 | $xInic = 5; |
204 | 204 | $yInic = 5; |
205 | - if ($papel =='A4') { |
|
205 | + if ($papel == 'A4') { |
|
206 | 206 | $maxH = 210; |
207 | 207 | $maxW = 297; |
208 | 208 | } |
209 | 209 | } |
210 | 210 | //largura imprimivel em mm |
211 | - $this->wPrint = $maxW-($margEsq+$xInic); |
|
211 | + $this->wPrint = $maxW - ($margEsq + $xInic); |
|
212 | 212 | //comprimento imprimivel em mm |
213 | - $this->hPrint = $maxH-($margSup+$yInic); |
|
213 | + $this->hPrint = $maxH - ($margSup + $yInic); |
|
214 | 214 | // estabelece contagem de paginas |
215 | 215 | $this->pdf->aliasNbPages(); |
216 | 216 | // fixa as margens |
@@ -230,12 +230,12 @@ discard block |
||
230 | 230 | //coloca o cabeçalho |
231 | 231 | $y = $this->headerCCe($x, $y, $pag); |
232 | 232 | //coloca os dados da CCe |
233 | - $y = $this->bodyCCe($x, $y+15); |
|
233 | + $y = $this->bodyCCe($x, $y + 15); |
|
234 | 234 | //coloca os dados da CCe |
235 | - $y = $this->footerCCe($x, $y+$this->hPrint-20); |
|
235 | + $y = $this->footerCCe($x, $y + $this->hPrint - 20); |
|
236 | 236 | //retorna o ID do evento |
237 | - if ($classPDF!==false) { |
|
238 | - $aR = ['id'=>$this->id,'classe_PDF'=>$this->pdf]; |
|
237 | + if ($classPDF !== false) { |
|
238 | + $aR = ['id'=>$this->id, 'classe_PDF'=>$this->pdf]; |
|
239 | 239 | return $aR; |
240 | 240 | } else { |
241 | 241 | return $this->id; |
@@ -256,14 +256,14 @@ discard block |
||
256 | 256 | $maxW = $this->wPrint; |
257 | 257 | //############################################################# |
258 | 258 | //coluna esquerda identificação do emitente |
259 | - $w = round($maxW*0.41, 0);// 80; |
|
259 | + $w = round($maxW * 0.41, 0); // 80; |
|
260 | 260 | if ($this->orientacao == 'P') { |
261 | - $aFont = array('font'=>$this->fontePadrao,'size'=>6,'style'=>'I'); |
|
261 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'); |
|
262 | 262 | } else { |
263 | - $aFont = array('font'=>$this->fontePadrao,'size'=>8,'style'=>'B'); |
|
263 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'); |
|
264 | 264 | } |
265 | 265 | $w1 = $w; |
266 | - $h=32; |
|
266 | + $h = 32; |
|
267 | 267 | $oldY += $h; |
268 | 268 | $this->pdf->textBox($x, $y, $w, $h); |
269 | 269 | $texto = 'IDENTIFICAÇÃO DO EMITENTE'; |
@@ -271,147 +271,147 @@ discard block |
||
271 | 271 | if (is_file($this->logomarca)) { |
272 | 272 | $logoInfo = getimagesize($this->logomarca); |
273 | 273 | //largura da imagem em mm |
274 | - $logoWmm = ($logoInfo[0]/72)*25.4; |
|
274 | + $logoWmm = ($logoInfo[0] / 72) * 25.4; |
|
275 | 275 | //altura da imagem em mm |
276 | - $logoHmm = ($logoInfo[1]/72)*25.4; |
|
277 | - if ($this->logoAlign=='L') { |
|
278 | - $nImgW = round($w/3, 0); |
|
279 | - $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0); |
|
280 | - $xImg = $x+1; |
|
281 | - $yImg = round(($h-$nImgH)/2, 0)+$y; |
|
276 | + $logoHmm = ($logoInfo[1] / 72) * 25.4; |
|
277 | + if ($this->logoAlign == 'L') { |
|
278 | + $nImgW = round($w / 3, 0); |
|
279 | + $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
|
280 | + $xImg = $x + 1; |
|
281 | + $yImg = round(($h - $nImgH) / 2, 0) + $y; |
|
282 | 282 | //estabelecer posições do texto |
283 | - $x1 = round($xImg + $nImgW +1, 0); |
|
284 | - $y1 = round($h/3+$y, 0); |
|
285 | - $tw = round(2*$w/3, 0); |
|
283 | + $x1 = round($xImg + $nImgW + 1, 0); |
|
284 | + $y1 = round($h / 3 + $y, 0); |
|
285 | + $tw = round(2 * $w / 3, 0); |
|
286 | 286 | } |
287 | - if ($this->logoAlign=='C') { |
|
288 | - $nImgH = round($h/3, 0); |
|
289 | - $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0); |
|
290 | - $xImg = round(($w-$nImgW)/2+$x, 0); |
|
291 | - $yImg = $y+3; |
|
287 | + if ($this->logoAlign == 'C') { |
|
288 | + $nImgH = round($h / 3, 0); |
|
289 | + $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0); |
|
290 | + $xImg = round(($w - $nImgW) / 2 + $x, 0); |
|
291 | + $yImg = $y + 3; |
|
292 | 292 | $x1 = $x; |
293 | 293 | $y1 = round($yImg + $nImgH + 1, 0); |
294 | 294 | $tw = $w; |
295 | 295 | } |
296 | - if ($this->logoAlign=='R') { |
|
297 | - $nImgW = round($w/3, 0); |
|
298 | - $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0); |
|
299 | - $xImg = round($x+($w-(1+$nImgW)), 0); |
|
300 | - $yImg = round(($h-$nImgH)/2, 0)+$y; |
|
296 | + if ($this->logoAlign == 'R') { |
|
297 | + $nImgW = round($w / 3, 0); |
|
298 | + $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
|
299 | + $xImg = round($x + ($w - (1 + $nImgW)), 0); |
|
300 | + $yImg = round(($h - $nImgH) / 2, 0) + $y; |
|
301 | 301 | $x1 = $x; |
302 | - $y1 = round($h/3+$y, 0); |
|
303 | - $tw = round(2*$w/3, 0); |
|
302 | + $y1 = round($h / 3 + $y, 0); |
|
303 | + $tw = round(2 * $w / 3, 0); |
|
304 | 304 | } |
305 | 305 | $this->pdf->image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg'); |
306 | 306 | } else { |
307 | 307 | $x1 = $x; |
308 | - $y1 = round($h/3+$y, 0); |
|
308 | + $y1 = round($h / 3 + $y, 0); |
|
309 | 309 | $tw = $w; |
310 | 310 | } |
311 | 311 | //Nome emitente |
312 | - $aFont = array('font'=>$this->fontePadrao,'size'=>12,'style'=>'B'); |
|
313 | - $texto = (isset($this->aEnd['razao'])?$this->aEnd['razao']:''); |
|
312 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B'); |
|
313 | + $texto = (isset($this->aEnd['razao']) ? $this->aEnd['razao'] : ''); |
|
314 | 314 | $this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, ''); |
315 | 315 | //endereço |
316 | - $y1 = $y1+6; |
|
317 | - $aFont = array('font'=>$this->fontePadrao,'size'=>8,'style'=>''); |
|
318 | - $lgr = (isset($this->aEnd['logradouro'])?$this->aEnd['logradouro']:''); |
|
319 | - $nro = (isset($this->aEnd['numero'])?$this->aEnd['numero']:''); |
|
320 | - $cpl = (isset($this->aEnd['complemento'])?$this->aEnd['complemento']:''); |
|
321 | - $bairro = (isset($this->aEnd['bairro'])?$this->aEnd['bairro']:''); |
|
322 | - $CEP = (isset($this->aEnd['CEP'])?$this->aEnd['CEP']:''); |
|
316 | + $y1 = $y1 + 6; |
|
317 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
|
318 | + $lgr = (isset($this->aEnd['logradouro']) ? $this->aEnd['logradouro'] : ''); |
|
319 | + $nro = (isset($this->aEnd['numero']) ? $this->aEnd['numero'] : ''); |
|
320 | + $cpl = (isset($this->aEnd['complemento']) ? $this->aEnd['complemento'] : ''); |
|
321 | + $bairro = (isset($this->aEnd['bairro']) ? $this->aEnd['bairro'] : ''); |
|
322 | + $CEP = (isset($this->aEnd['CEP']) ? $this->aEnd['CEP'] : ''); |
|
323 | 323 | $CEP = $this->format($CEP, "#####-###"); |
324 | - $mun = (isset($this->aEnd['municipio'])?$this->aEnd['municipio']:''); |
|
325 | - $UF = (isset($this->aEnd['UF'])?$this->aEnd['UF']:''); |
|
326 | - $fone = (isset($this->aEnd['telefone'])?$this->aEnd['telefone']:''); |
|
327 | - $email = (isset($this->aEnd['email'])?$this->aEnd['email']:''); |
|
324 | + $mun = (isset($this->aEnd['municipio']) ? $this->aEnd['municipio'] : ''); |
|
325 | + $UF = (isset($this->aEnd['UF']) ? $this->aEnd['UF'] : ''); |
|
326 | + $fone = (isset($this->aEnd['telefone']) ? $this->aEnd['telefone'] : ''); |
|
327 | + $email = (isset($this->aEnd['email']) ? $this->aEnd['email'] : ''); |
|
328 | 328 | $foneLen = strlen($fone); |
329 | 329 | if ($foneLen > 0) { |
330 | - $fone2 = substr($fone, 0, $foneLen-4); |
|
331 | - $fone1 = substr($fone, 0, $foneLen-8); |
|
330 | + $fone2 = substr($fone, 0, $foneLen - 4); |
|
331 | + $fone1 = substr($fone, 0, $foneLen - 8); |
|
332 | 332 | $fone = '(' . $fone1 . ') ' . substr($fone2, -4) . '-' . substr($fone, -4); |
333 | 333 | } else { |
334 | 334 | $fone = ''; |
335 | 335 | } |
336 | 336 | if ($email != '') { |
337 | - $email = 'Email: '.$email; |
|
337 | + $email = 'Email: ' . $email; |
|
338 | 338 | } |
339 | 339 | $texto = ""; |
340 | - $tmp_txt=trim(($lgr!=''?"$lgr, ":'').($nro!=0?$nro:"SN").($cpl!=''?" - $cpl":'')); |
|
341 | - $tmp_txt=($tmp_txt=='SN'?'':$tmp_txt); |
|
342 | - $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt; |
|
343 | - $tmp_txt=trim($bairro . ($bairro!='' && $CEP!=''?" - ":'') . $CEP); |
|
344 | - $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt; |
|
345 | - $tmp_txt=$mun; |
|
346 | - $tmp_txt.=($tmp_txt!='' && $UF!=''?" - ":'').$UF; |
|
347 | - $tmp_txt.=($tmp_txt!='' && $fone!=''?" - ":'').$fone; |
|
348 | - $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt; |
|
349 | - $tmp_txt=$email; |
|
350 | - $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt; |
|
351 | - $this->pdf->textBox($x1, $y1-2, $tw, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
340 | + $tmp_txt = trim(($lgr != '' ? "$lgr, " : '') . ($nro != 0 ? $nro : "SN") . ($cpl != '' ? " - $cpl" : '')); |
|
341 | + $tmp_txt = ($tmp_txt == 'SN' ? '' : $tmp_txt); |
|
342 | + $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt; |
|
343 | + $tmp_txt = trim($bairro . ($bairro != '' && $CEP != '' ? " - " : '') . $CEP); |
|
344 | + $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt; |
|
345 | + $tmp_txt = $mun; |
|
346 | + $tmp_txt .= ($tmp_txt != '' && $UF != '' ? " - " : '') . $UF; |
|
347 | + $tmp_txt .= ($tmp_txt != '' && $fone != '' ? " - " : '') . $fone; |
|
348 | + $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt; |
|
349 | + $tmp_txt = $email; |
|
350 | + $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt; |
|
351 | + $this->pdf->textBox($x1, $y1 - 2, $tw, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
352 | 352 | //################################################## |
353 | 353 | $w2 = round($maxW - $w, 0); |
354 | 354 | $x += $w; |
355 | 355 | $this->pdf->textBox($x, $y, $w2, $h); |
356 | 356 | $y1 = $y + $h; |
357 | - $aFont = array('font'=>$this->fontePadrao,'size'=>16,'style'=>'B'); |
|
358 | - $this->pdf->textBox($x, $y+2, $w2, 8, 'Representação Gráfica de ProtCancCTe', $aFont, 'T', 'C', 0, ''); |
|
359 | - $aFont = array('font'=>$this->fontePadrao,'size'=>12,'style'=>'I'); |
|
360 | - $this->pdf->textBox($x, $y+7, $w2, 8, '(Protocolo Cancelamento de CTe)', $aFont, 'T', 'C', 0, ''); |
|
357 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>16, 'style'=>'B'); |
|
358 | + $this->pdf->textBox($x, $y + 2, $w2, 8, 'Representação Gráfica de ProtCancCTe', $aFont, 'T', 'C', 0, ''); |
|
359 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'I'); |
|
360 | + $this->pdf->textBox($x, $y + 7, $w2, 8, '(Protocolo Cancelamento de CTe)', $aFont, 'T', 'C', 0, ''); |
|
361 | 361 | $tsHora = $this->toTimestamp($this->dhEvento); |
362 | - $texto = 'Criado em : '. date('d/m/Y H:i:s', $tsHora); |
|
363 | - $this->pdf->textBox($x, $y+20, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
362 | + $texto = 'Criado em : ' . date('d/m/Y H:i:s', $tsHora); |
|
363 | + $this->pdf->textBox($x, $y + 20, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
364 | 364 | $tsHora = $this->toTimestamp($this->dhRegEvento); |
365 | - $texto = 'Prococolo: '.$this->nProt.' - Registrado na SEFAZ em: '.date('d/m/Y H:i:s', $tsHora); |
|
366 | - $this->pdf->textBox($x, $y+25, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
365 | + $texto = 'Prococolo: ' . $this->nProt . ' - Registrado na SEFAZ em: ' . date('d/m/Y H:i:s', $tsHora); |
|
366 | + $this->pdf->textBox($x, $y + 25, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
367 | 367 | //#################################################### |
368 | 368 | $x = $oldX; |
369 | 369 | $this->pdf->textBox($x, $y1, $maxW, 33); |
370 | - $sY = $y1+23; |
|
370 | + $sY = $y1 + 23; |
|
371 | 371 | $texto = 'De acordo com as determinações legais vigentes, vimos por meio desta ' |
372 | 372 | . 'comunicar-lhe que o Conhecimento de Transporte Eletrônico, abaixo ' |
373 | 373 | . 'referenciada, encontra-se cancelada, solicitamos que sejam aplicadas ' |
374 | 374 | . 'essas correções ao executar seus lançamentos fiscais.'; |
375 | - $aFont = array('font'=>$this->fontePadrao,'size'=>10,'style'=>''); |
|
376 | - $this->pdf->textBox($x+5, $y1, $maxW-5, 20, $texto, $aFont, 'T', 'L', 0, '', false); |
|
375 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
|
376 | + $this->pdf->textBox($x + 5, $y1, $maxW - 5, 20, $texto, $aFont, 'T', 'L', 0, '', false); |
|
377 | 377 | //############################################ |
378 | 378 | $x = $oldX; |
379 | 379 | $y = $y1; |
380 | 380 | $numNF = substr($this->chCTe, 25, 9); |
381 | 381 | $serie = substr($this->chCTe, 22, 3); |
382 | 382 | $numNF = $this->format($numNF, "###.###.###"); |
383 | - $texto = "Conhecimento: " . $numNF .' - Série: '.$serie; |
|
384 | - $this->pdf->textBox($x+2, $y+11, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
383 | + $texto = "Conhecimento: " . $numNF . ' - Série: ' . $serie; |
|
384 | + $this->pdf->textBox($x + 2, $y + 11, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
385 | 385 | $bW = 87; |
386 | 386 | $bH = 15; |
387 | 387 | $x = 55; |
388 | - $y = $y1+10; |
|
388 | + $y = $y1 + 10; |
|
389 | 389 | $w = $maxW; |
390 | 390 | $this->pdf->setFillColor(0, 0, 0); |
391 | - $this->pdf->code128($x+(($w-$bW)/2), $y+2, $this->chCTe, $bW, $bH); |
|
391 | + $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $this->chCTe, $bW, $bH); |
|
392 | 392 | $this->pdf->setFillColor(255, 255, 255); |
393 | - $y1 = $y+2+$bH; |
|
394 | - $aFont = array('font'=>$this->fontePadrao,'size'=>10,'style'=>''); |
|
393 | + $y1 = $y + 2 + $bH; |
|
394 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
|
395 | 395 | $texto = $this->format($this->chCTe, $this->formatoChave); |
396 | - $this->pdf->textBox($x, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
396 | + $this->pdf->textBox($x, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
397 | 397 | $retVal = $sY; |
398 | 398 | //indicar sem valor |
399 | 399 | if ($this->tpAmb != 1) { |
400 | 400 | $x = 10; |
401 | 401 | if ($this->orientacao == 'P') { |
402 | - $y = round($this->hPrint*2/3, 0); |
|
402 | + $y = round($this->hPrint * 2 / 3, 0); |
|
403 | 403 | } else { |
404 | - $y = round($this->hPrint/2, 0); |
|
404 | + $y = round($this->hPrint / 2, 0); |
|
405 | 405 | } |
406 | 406 | $h = 5; |
407 | - $w = $maxW-(2*$x); |
|
407 | + $w = $maxW - (2 * $x); |
|
408 | 408 | $this->pdf->setTextColor(90, 90, 90); |
409 | 409 | $texto = "SEM VALOR FISCAL"; |
410 | - $aFont = array('font'=>$this->fontePadrao,'size'=>48,'style'=>'B'); |
|
410 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'); |
|
411 | 411 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
412 | - $aFont = array('font'=>$this->fontePadrao,'size'=>30,'style'=>'B'); |
|
412 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B'); |
|
413 | 413 | $texto = "AMBIENTE DE HOMOLOGAÇÃO"; |
414 | - $this->pdf->textBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
414 | + $this->pdf->textBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
415 | 415 | $this->pdf->setTextColor(0, 0, 0); |
416 | 416 | } |
417 | 417 | return $retVal; |
@@ -426,13 +426,13 @@ discard block |
||
426 | 426 | { |
427 | 427 | $maxW = $this->wPrint; |
428 | 428 | $texto = 'JUSTIFICATIVA DO CANCELAMENTO'; |
429 | - $aFont = array('font'=>$this->fontePadrao,'size'=>10,'style'=>'B'); |
|
429 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'); |
|
430 | 430 | $this->pdf->textBox($x, $y, $maxW, 5, $texto, $aFont, 'T', 'L', 0, '', false); |
431 | 431 | $y += 5; |
432 | 432 | $this->pdf->textBox($x, $y, $maxW, 210); |
433 | 433 | $texto = $this->xJust; |
434 | - $aFont = array('font'=>$this->fontePadrao,'size'=>12,'style'=>'B'); |
|
435 | - $this->pdf->textBox($x+2, $y+2, $maxW-2, 150, $texto, $aFont, 'T', 'L', 0, '', false); |
|
434 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B'); |
|
435 | + $this->pdf->textBox($x + 2, $y + 2, $maxW - 2, 150, $texto, $aFont, 'T', 'L', 0, '', false); |
|
436 | 436 | } |
437 | 437 | |
438 | 438 | /** |
@@ -449,17 +449,17 @@ discard block |
||
449 | 449 | . "validade fiscal.\n O Protocolo deve ser recebido e mantido" |
450 | 450 | . " em arquivo eletrônico XML e pode ser consultada através dos" |
451 | 451 | . " Portais das SEFAZ."; |
452 | - $aFont = array('font'=>$this->fontePadrao,'size'=>10,'style'=>'I'); |
|
452 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'I'); |
|
453 | 453 | $this->pdf->textBox($x, $y, $w, 20, $texto, $aFont, 'T', 'C', 0, '', false); |
454 | - $y = $this->hPrint -4; |
|
455 | - $texto = "Impresso em ". date('d/m/Y H:i:s'); |
|
456 | - $w = $this->wPrint-4; |
|
457 | - $aFont = array('font'=>$this->fontePadrao,'size'=>6,'style'=>'I'); |
|
454 | + $y = $this->hPrint - 4; |
|
455 | + $texto = "Impresso em " . date('d/m/Y H:i:s'); |
|
456 | + $w = $this->wPrint - 4; |
|
457 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'); |
|
458 | 458 | $this->pdf->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'L', 0, ''); |
459 | 459 | $texto = "DaCanccteNFePHP ver. " |
460 | 460 | . $this->version |
461 | 461 | . " Powered by NFePHP (GNU/GPLv3 GNU/LGPLv3) © www.nfephp.org"; |
462 | - $aFont = array('font'=>$this->fontePadrao,'size'=>6,'style'=>'I'); |
|
462 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'); |
|
463 | 463 | $this->pdf->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'R', 0, 'http://www.nfephp.org'); |
464 | 464 | } |
465 | 465 |
@@ -134,28 +134,28 @@ discard block |
||
134 | 134 | $this->rinfEvento = $this->retEvento->getElementsByTagName("infEvento")->item(0); |
135 | 135 | $this->tpEvento = $this->infEvento->getElementsByTagName("tpEvento")->item(0)->nodeValue; |
136 | 136 | if (!in_array($this->tpEvento, array('110110', '110111'))) { |
137 | - $this->errMsg = 'Evento não implementado '.$tpEvento.' !!'; |
|
137 | + $this->errMsg = 'Evento não implementado ' . $tpEvento . ' !!'; |
|
138 | 138 | $this->errStatus = true; |
139 | 139 | return false; |
140 | 140 | } |
141 | 141 | $this->id = str_replace('ID', '', $this->infEvento->getAttribute("Id")); |
142 | 142 | $this->chCTe = $this->infEvento->getElementsByTagName("chCTe")->item(0)->nodeValue; |
143 | - $this->aEnd['CNPJ']=substr($this->chCTe, 6, 14); |
|
143 | + $this->aEnd['CNPJ'] = substr($this->chCTe, 6, 14); |
|
144 | 144 | $this->tpAmb = $this->infEvento->getElementsByTagName("tpAmb")->item(0)->nodeValue; |
145 | 145 | $this->cOrgao = $this->infEvento->getElementsByTagName("cOrgao")->item(0)->nodeValue; |
146 | 146 | $this->xCorrecao = $this->infEvento->getElementsByTagName("xCorrecao")->item(0); |
147 | - $this->xCorrecao=(empty($this->xCorrecao)?'':$this->xCorrecao->nodeValue); |
|
147 | + $this->xCorrecao = (empty($this->xCorrecao) ? '' : $this->xCorrecao->nodeValue); |
|
148 | 148 | $this->xCondUso = $this->infEvento->getElementsByTagName("xCondUso")->item(0); |
149 | - $this->xCondUso=(empty($this->xCondUso)?'':$this->xCondUso->nodeValue); |
|
150 | - $this->xJust = $this->infEvento->getElementsByTagName("xJust")->item(0); |
|
151 | - $this->xJust=(empty($this->xJust)?'':$this->xJust->nodeValue); |
|
149 | + $this->xCondUso = (empty($this->xCondUso) ? '' : $this->xCondUso->nodeValue); |
|
150 | + $this->xJust = $this->infEvento->getElementsByTagName("xJust")->item(0); |
|
151 | + $this->xJust = (empty($this->xJust) ? '' : $this->xJust->nodeValue); |
|
152 | 152 | $this->dhEvento = $this->infEvento->getElementsByTagName("dhEvento")->item(0)->nodeValue; |
153 | 153 | $this->cStat = $this->rinfEvento->getElementsByTagName("cStat")->item(0)->nodeValue; |
154 | 154 | $this->xMotivo = $this->rinfEvento->getElementsByTagName("xMotivo")->item(0)->nodeValue; |
155 | - $this->CNPJDest = !empty($this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue)? |
|
156 | - $this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue:''; |
|
157 | - $this->CPFDest = !empty($this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue)? |
|
158 | - $this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue:''; |
|
155 | + $this->CNPJDest = !empty($this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue) ? |
|
156 | + $this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue : ''; |
|
157 | + $this->CPFDest = !empty($this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue) ? |
|
158 | + $this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue : ''; |
|
159 | 159 | $this->dhRegEvento = $this->rinfEvento->getElementsByTagName("dhRegEvento")->item(0)->nodeValue; |
160 | 160 | $this->nProt = $this->rinfEvento->getElementsByTagName("nProt")->item(0)->nodeValue; |
161 | 161 | } |
@@ -219,8 +219,8 @@ discard block |
||
219 | 219 | $this->orientacao = $orientacao; |
220 | 220 | $this->papel = $papel; |
221 | 221 | $this->logoAlign = $logoAlign; |
222 | - if ($classPDF!==false) { |
|
223 | - $this->pdf = $classPDF ; |
|
222 | + if ($classPDF !== false) { |
|
223 | + $this->pdf = $classPDF; |
|
224 | 224 | } else { |
225 | 225 | $this->pdf = new Pdf($this->orientacao, 'mm', $this->papel); |
226 | 226 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | // posição inicial do relatorio |
233 | 233 | $xInic = 1; |
234 | 234 | $yInic = 1; |
235 | - if ($this->papel =='A4') { //A4 210x297mm |
|
235 | + if ($this->papel == 'A4') { //A4 210x297mm |
|
236 | 236 | $maxW = 210; |
237 | 237 | $maxH = 297; |
238 | 238 | } |
@@ -244,16 +244,16 @@ discard block |
||
244 | 244 | // posição inicial do relatorio |
245 | 245 | $xInic = 5; |
246 | 246 | $yInic = 5; |
247 | - if ($papel =='A4') { |
|
247 | + if ($papel == 'A4') { |
|
248 | 248 | //A4 210x297mm |
249 | 249 | $maxH = 210; |
250 | 250 | $maxW = 297; |
251 | 251 | } |
252 | 252 | } |
253 | 253 | //largura imprimivel em mm |
254 | - $this->wPrint = $maxW-($margEsq+$xInic); |
|
254 | + $this->wPrint = $maxW - ($margEsq + $xInic); |
|
255 | 255 | //comprimento imprimivel em mm |
256 | - $this->hPrint = $maxH-($margSup+$yInic); |
|
256 | + $this->hPrint = $maxH - ($margSup + $yInic); |
|
257 | 257 | // estabelece contagem de paginas |
258 | 258 | $this->pdf->aliasNbPages(); |
259 | 259 | // fixa as margens |
@@ -273,11 +273,11 @@ discard block |
||
273 | 273 | //coloca o cabeçalho |
274 | 274 | $y = $this->header($x, $y, $pag, $situacao_externa); |
275 | 275 | //coloca os dados da CCe |
276 | - $y = $this->body($x, $y+15); |
|
276 | + $y = $this->body($x, $y + 15); |
|
277 | 277 | //coloca os dados da CCe |
278 | - $y = $this->footer($x, $y+$this->hPrint-20); |
|
278 | + $y = $this->footer($x, $y + $this->hPrint - 20); |
|
279 | 279 | //retorna o ID do evento |
280 | - if ($classPDF !==false) { |
|
280 | + if ($classPDF !== false) { |
|
281 | 281 | $aR = array( |
282 | 282 | 'id'=>$this->id, |
283 | 283 | 'classe_PDF'=>$this->pdf); |
@@ -304,14 +304,14 @@ discard block |
||
304 | 304 | $maxW = $this->wPrint; |
305 | 305 | //#################################################################################### |
306 | 306 | //coluna esquerda identificação do emitente |
307 | - $w = round($maxW*0.41, 0);// 80; |
|
307 | + $w = round($maxW * 0.41, 0); // 80; |
|
308 | 308 | if ($this->orientacao == 'P') { |
309 | 309 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'); |
310 | 310 | } else { |
311 | 311 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'); |
312 | 312 | } |
313 | 313 | $w1 = $w; |
314 | - $h=32; |
|
314 | + $h = 32; |
|
315 | 315 | $oldY += $h; |
316 | 316 | $this->pdf->textBox($x, $y, $w, $h); |
317 | 317 | $texto = 'IDENTIFICAÇÃO DO EMITENTE'; |
@@ -319,130 +319,130 @@ discard block |
||
319 | 319 | if (is_file($this->logomarca)) { |
320 | 320 | $logoInfo = getimagesize($this->logomarca); |
321 | 321 | //largura da imagem em mm |
322 | - $logoWmm = ($logoInfo[0]/72)*25.4; |
|
322 | + $logoWmm = ($logoInfo[0] / 72) * 25.4; |
|
323 | 323 | //altura da imagem em mm |
324 | - $logoHmm = ($logoInfo[1]/72)*25.4; |
|
325 | - if ($this->logoAlign=='L') { |
|
326 | - $nImgW = round($w/3, 0); |
|
327 | - $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0); |
|
328 | - $xImg = $x+1; |
|
329 | - $yImg = round(($h-$nImgH)/2, 0)+$y; |
|
324 | + $logoHmm = ($logoInfo[1] / 72) * 25.4; |
|
325 | + if ($this->logoAlign == 'L') { |
|
326 | + $nImgW = round($w / 3, 0); |
|
327 | + $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
|
328 | + $xImg = $x + 1; |
|
329 | + $yImg = round(($h - $nImgH) / 2, 0) + $y; |
|
330 | 330 | //estabelecer posições do texto |
331 | - $x1 = round($xImg + $nImgW +1, 0); |
|
332 | - $y1 = round($h/3+$y, 0); |
|
333 | - $tw = round(2*$w/3, 0); |
|
331 | + $x1 = round($xImg + $nImgW + 1, 0); |
|
332 | + $y1 = round($h / 3 + $y, 0); |
|
333 | + $tw = round(2 * $w / 3, 0); |
|
334 | 334 | } |
335 | - if ($this->logoAlign=='C') { |
|
336 | - $nImgH = round($h/3, 0); |
|
337 | - $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0); |
|
338 | - $xImg = round(($w-$nImgW)/2+$x, 0); |
|
339 | - $yImg = $y+3; |
|
335 | + if ($this->logoAlign == 'C') { |
|
336 | + $nImgH = round($h / 3, 0); |
|
337 | + $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0); |
|
338 | + $xImg = round(($w - $nImgW) / 2 + $x, 0); |
|
339 | + $yImg = $y + 3; |
|
340 | 340 | $x1 = $x; |
341 | 341 | $y1 = round($yImg + $nImgH + 1, 0); |
342 | 342 | $tw = $w; |
343 | 343 | } |
344 | - if ($this->logoAlign=='R') { |
|
345 | - $nImgW = round($w/3, 0); |
|
346 | - $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0); |
|
347 | - $xImg = round($x+($w-(1+$nImgW)), 0); |
|
348 | - $yImg = round(($h-$nImgH)/2, 0)+$y; |
|
344 | + if ($this->logoAlign == 'R') { |
|
345 | + $nImgW = round($w / 3, 0); |
|
346 | + $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
|
347 | + $xImg = round($x + ($w - (1 + $nImgW)), 0); |
|
348 | + $yImg = round(($h - $nImgH) / 2, 0) + $y; |
|
349 | 349 | $x1 = $x; |
350 | - $y1 = round($h/3+$y, 0); |
|
351 | - $tw = round(2*$w/3, 0); |
|
350 | + $y1 = round($h / 3 + $y, 0); |
|
351 | + $tw = round(2 * $w / 3, 0); |
|
352 | 352 | } |
353 | 353 | $this->pdf->image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg'); |
354 | 354 | } else { |
355 | 355 | $x1 = $x; |
356 | - $y1 = round($h/3+$y, 0); |
|
356 | + $y1 = round($h / 3 + $y, 0); |
|
357 | 357 | $tw = $w; |
358 | 358 | } |
359 | 359 | //Nome emitente |
360 | 360 | $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B'); |
361 | - $texto = (isset($this->aEnd['razao'])?$this->aEnd['razao']:''); |
|
361 | + $texto = (isset($this->aEnd['razao']) ? $this->aEnd['razao'] : ''); |
|
362 | 362 | $this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, ''); |
363 | 363 | //endereço |
364 | - $y1 = $y1+6; |
|
364 | + $y1 = $y1 + 6; |
|
365 | 365 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
366 | - $lgr = (isset($this->aEnd['logradouro'])?$this->aEnd['logradouro']:''); |
|
367 | - $nro = (isset($this->aEnd['numero'])?$this->aEnd['numero']:''); |
|
368 | - $cpl = (isset($this->aEnd['complemento'])?$this->aEnd['complemento']:''); |
|
369 | - $bairro = (isset($this->aEnd['bairro'])?$this->aEnd['bairro']:''); |
|
370 | - $CEP = (isset($this->aEnd['CEP'])?$this->aEnd['CEP']:''); |
|
366 | + $lgr = (isset($this->aEnd['logradouro']) ? $this->aEnd['logradouro'] : ''); |
|
367 | + $nro = (isset($this->aEnd['numero']) ? $this->aEnd['numero'] : ''); |
|
368 | + $cpl = (isset($this->aEnd['complemento']) ? $this->aEnd['complemento'] : ''); |
|
369 | + $bairro = (isset($this->aEnd['bairro']) ? $this->aEnd['bairro'] : ''); |
|
370 | + $CEP = (isset($this->aEnd['CEP']) ? $this->aEnd['CEP'] : ''); |
|
371 | 371 | $CEP = $this->formatField($CEP, "#####-###"); |
372 | - $mun = (isset($this->aEnd['municipio'])?$this->aEnd['municipio']:''); |
|
373 | - $UF = (isset($this->aEnd['UF'])?$this->aEnd['UF']:''); |
|
374 | - $fone = (isset($this->aEnd['telefone'])?$this->aEnd['telefone']:''); |
|
375 | - $email = (isset($this->aEnd['email'])?$this->aEnd['email']:''); |
|
372 | + $mun = (isset($this->aEnd['municipio']) ? $this->aEnd['municipio'] : ''); |
|
373 | + $UF = (isset($this->aEnd['UF']) ? $this->aEnd['UF'] : ''); |
|
374 | + $fone = (isset($this->aEnd['telefone']) ? $this->aEnd['telefone'] : ''); |
|
375 | + $email = (isset($this->aEnd['email']) ? $this->aEnd['email'] : ''); |
|
376 | 376 | $foneLen = strlen($fone); |
377 | 377 | if ($foneLen > 0) { |
378 | - $fone2 = substr($fone, 0, $foneLen-4); |
|
379 | - $fone1 = substr($fone, 0, $foneLen-8); |
|
378 | + $fone2 = substr($fone, 0, $foneLen - 4); |
|
379 | + $fone1 = substr($fone, 0, $foneLen - 8); |
|
380 | 380 | $fone = '(' . $fone1 . ') ' . substr($fone2, -4) . '-' . substr($fone, -4); |
381 | 381 | } else { |
382 | 382 | $fone = ''; |
383 | 383 | } |
384 | 384 | if ($email != '') { |
385 | - $email = 'Email: '.$email; |
|
385 | + $email = 'Email: ' . $email; |
|
386 | 386 | } |
387 | 387 | $texto = ""; |
388 | - $tmp_txt = trim(($lgr!=''?"$lgr, ":'').($nro!=0?$nro:"SN").($cpl!=''?" - $cpl":'')); |
|
389 | - $tmp_txt = ($tmp_txt=='SN'?'':$tmp_txt); |
|
390 | - $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt; |
|
391 | - $tmp_txt = trim($bairro.($bairro!='' && $CEP!=''?" - ":'').$CEP); |
|
392 | - $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt; |
|
388 | + $tmp_txt = trim(($lgr != '' ? "$lgr, " : '') . ($nro != 0 ? $nro : "SN") . ($cpl != '' ? " - $cpl" : '')); |
|
389 | + $tmp_txt = ($tmp_txt == 'SN' ? '' : $tmp_txt); |
|
390 | + $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt; |
|
391 | + $tmp_txt = trim($bairro . ($bairro != '' && $CEP != '' ? " - " : '') . $CEP); |
|
392 | + $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt; |
|
393 | 393 | $tmp_txt = $mun; |
394 | - $tmp_txt.= ($tmp_txt!='' && $UF!=''?" - ":'').$UF; |
|
395 | - $tmp_txt.= ($tmp_txt!='' && $fone!=''?" - ":'').$fone; |
|
396 | - $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt; |
|
394 | + $tmp_txt .= ($tmp_txt != '' && $UF != '' ? " - " : '') . $UF; |
|
395 | + $tmp_txt .= ($tmp_txt != '' && $fone != '' ? " - " : '') . $fone; |
|
396 | + $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt; |
|
397 | 397 | $tmp_txt = $email; |
398 | - $texto .= ($texto!='' && $tmp_txt!=''?"\n":'').$tmp_txt; |
|
399 | - $this->pdf->textBox($x1, $y1-2, $tw, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
398 | + $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt; |
|
399 | + $this->pdf->textBox($x1, $y1 - 2, $tw, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
400 | 400 | //################################################## |
401 | 401 | $w2 = round($maxW - $w, 0); |
402 | 402 | $x += $w; |
403 | 403 | $this->pdf->textBox($x, $y, $w2, $h); |
404 | 404 | $y1 = $y + $h; |
405 | 405 | $aFont = array('font'=>$this->fontePadrao, 'size'=>16, 'style'=>'B'); |
406 | - if ($this->tpEvento=='110110') { |
|
407 | - $texto='Representação Gráfica de CCe'; |
|
406 | + if ($this->tpEvento == '110110') { |
|
407 | + $texto = 'Representação Gráfica de CCe'; |
|
408 | 408 | } else { |
409 | - $texto='Representação Gráfica de Evento'; |
|
409 | + $texto = 'Representação Gráfica de Evento'; |
|
410 | 410 | } |
411 | - $this->pdf->textBox($x, $y+2, $w2, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
411 | + $this->pdf->textBox($x, $y + 2, $w2, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
412 | 412 | $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'I'); |
413 | - if ($this->tpEvento=='110110') { |
|
414 | - $texto='(Carta de Correção Eletrônica)'; |
|
415 | - } elseif ($this->tpEvento=='110111') { |
|
416 | - $texto='(Cancelamento de CTe)'; |
|
413 | + if ($this->tpEvento == '110110') { |
|
414 | + $texto = '(Carta de Correção Eletrônica)'; |
|
415 | + } elseif ($this->tpEvento == '110111') { |
|
416 | + $texto = '(Cancelamento de CTe)'; |
|
417 | 417 | } |
418 | - $this->pdf->textBox($x, $y+7, $w2, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
419 | - $texto = 'ID do Evento: '.$this->id; |
|
418 | + $this->pdf->textBox($x, $y + 7, $w2, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
419 | + $texto = 'ID do Evento: ' . $this->id; |
|
420 | 420 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
421 | - $this->pdf->textBox($x, $y+15, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
421 | + $this->pdf->textBox($x, $y + 15, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
422 | 422 | $tsHora = $this->toTimestamp($this->dhEvento); |
423 | - $texto = 'Criado em : '. date('d/m/Y H:i:s', $tsHora); |
|
424 | - $this->pdf->textBox($x, $y+20, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
423 | + $texto = 'Criado em : ' . date('d/m/Y H:i:s', $tsHora); |
|
424 | + $this->pdf->textBox($x, $y + 20, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
425 | 425 | $tsHora = $this->toTimestamp($this->dhRegEvento); |
426 | - $texto = 'Prococolo: '.$this->nProt.' - Registrado na SEFAZ em: '.date('d/m/Y H:i:s', $tsHora); |
|
427 | - $this->pdf->textBox($x, $y+25, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
426 | + $texto = 'Prococolo: ' . $this->nProt . ' - Registrado na SEFAZ em: ' . date('d/m/Y H:i:s', $tsHora); |
|
427 | + $this->pdf->textBox($x, $y + 25, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
428 | 428 | //#################################################### |
429 | 429 | $x = $oldX; |
430 | 430 | $this->pdf->textBox($x, $y1, $maxW, 40); |
431 | - $sY = $y1+40; |
|
432 | - if ($this->tpEvento=='110110') { |
|
431 | + $sY = $y1 + 40; |
|
432 | + if ($this->tpEvento == '110110') { |
|
433 | 433 | $texto = 'De acordo com as determinações legais vigentes, vimos por meio ' |
434 | 434 | . 'desta comunicar-lhe que o Conhecimento de Transporte, abaixo referenciado, ' |
435 | 435 | . 'contêm irregularidades que estão destacadas e suas respectivas ' |
436 | 436 | . 'correções, solicitamos que sejam aplicadas essas correções ao ' |
437 | 437 | . 'executar seus lançamentos fiscais.'; |
438 | - } elseif ($this->tpEvento=='110111') { |
|
438 | + } elseif ($this->tpEvento == '110111') { |
|
439 | 439 | $texto = 'De acordo com as determinações legais vigentes, vimos por meio ' |
440 | 440 | . 'desta comunicar-lhe que o Conhecimento de Transporte, abaixo referenciado, está ' |
441 | 441 | . 'cancelado, solicitamos que sejam aplicadas essas correções ao ' |
442 | 442 | . 'executar seus lançamentos fiscais.'; |
443 | 443 | } |
444 | 444 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
445 | - $this->pdf->textBox($x+5, $y1, $maxW-5, 20, $texto, $aFont, 'T', 'L', 0, '', false); |
|
445 | + $this->pdf->textBox($x + 5, $y1, $maxW - 5, 20, $texto, $aFont, 'T', 'L', 0, '', false); |
|
446 | 446 | //############################################ |
447 | 447 | $x = $oldX; |
448 | 448 | $y = $y1; |
@@ -450,45 +450,45 @@ discard block |
||
450 | 450 | $numNF = substr($this->chCTe, 25, 9); |
451 | 451 | $serie = substr($this->chCTe, 22, 3); |
452 | 452 | $numNF = $this->formatField($numNF, "###.###.###"); |
453 | - $texto = "Conhecimento: " . $numNF .' - Série: '.$serie; |
|
454 | - $this->pdf->textBox($x+2, $y+19, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
453 | + $texto = "Conhecimento: " . $numNF . ' - Série: ' . $serie; |
|
454 | + $this->pdf->textBox($x + 2, $y + 19, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
455 | 455 | $bW = 87; |
456 | 456 | $bH = 15; |
457 | 457 | $x = 55; |
458 | - $y = $y1+13; |
|
458 | + $y = $y1 + 13; |
|
459 | 459 | $w = $maxW; |
460 | 460 | $this->pdf->setFillColor(0, 0, 0); |
461 | - $this->pdf->code128($x+(($w-$bW)/2), $y+2, $this->chCTe, $bW, $bH); |
|
461 | + $this->pdf->code128($x + (($w - $bW) / 2), $y + 2, $this->chCTe, $bW, $bH); |
|
462 | 462 | $this->pdf->setFillColor(255, 255, 255); |
463 | - $y1 = $y+2+$bH; |
|
463 | + $y1 = $y + 2 + $bH; |
|
464 | 464 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
465 | 465 | $texto = $this->formatField($this->chCTe, $this->formatoChave); |
466 | - $this->pdf->textBox($x, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
467 | - $retVal = $sY+2; |
|
468 | - if ($this->tpEvento=='110110') { |
|
466 | + $this->pdf->textBox($x, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
467 | + $retVal = $sY + 2; |
|
468 | + if ($this->tpEvento == '110110') { |
|
469 | 469 | $x = $oldX; |
470 | 470 | $this->pdf->textBox($x, $sY, $maxW, 15); |
471 | 471 | $texto = $this->xCondUso; |
472 | 472 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'I'); |
473 | - $this->pdf->textBox($x+2, $sY+2, $maxW-2, 15, $texto, $aFont, 'T', 'L', 0, '', false); |
|
474 | - $retVal = $sY+2; |
|
473 | + $this->pdf->textBox($x + 2, $sY + 2, $maxW - 2, 15, $texto, $aFont, 'T', 'L', 0, '', false); |
|
474 | + $retVal = $sY + 2; |
|
475 | 475 | } |
476 | 476 | if ($this->tpAmb != 1) { |
477 | 477 | $x = 10; |
478 | 478 | if ($this->orientacao == 'P') { |
479 | - $y = round($this->hPrint*2/3, 0); |
|
479 | + $y = round($this->hPrint * 2 / 3, 0); |
|
480 | 480 | } else { |
481 | - $y = round($this->hPrint/2, 0); |
|
481 | + $y = round($this->hPrint / 2, 0); |
|
482 | 482 | } |
483 | 483 | $h = 5; |
484 | - $w = $maxW-(2*$x); |
|
484 | + $w = $maxW - (2 * $x); |
|
485 | 485 | $this->pdf->setTextColor(90, 90, 90); |
486 | 486 | $texto = "SEM VALOR FISCAL"; |
487 | 487 | $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'); |
488 | 488 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
489 | 489 | $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B'); |
490 | 490 | $texto = "AMBIENTE DE HOMOLOGAÇÃO"; |
491 | - $this->pdf->textBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
491 | + $this->pdf->textBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
492 | 492 | $this->pdf->setTextColor(0, 0, 0); |
493 | 493 | } |
494 | 494 | return $retVal; |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | private function body($x, $y) |
503 | 503 | { |
504 | 504 | $maxW = $this->wPrint; |
505 | - if ($this->tpEvento=='110110') { |
|
505 | + if ($this->tpEvento == '110110') { |
|
506 | 506 | $texto = 'CORREÇÕES A SEREM CONSIDERADAS'; |
507 | 507 | } else { |
508 | 508 | $texto = 'JUSTIFICATIVA DO CANCELAMENTO'; |
@@ -511,13 +511,13 @@ discard block |
||
511 | 511 | $this->pdf->textBox($x, $y, $maxW, 5, $texto, $aFont, 'T', 'L', 0, '', false); |
512 | 512 | $y += 5; |
513 | 513 | $this->pdf->textBox($x, $y, $maxW, 190); |
514 | - if ($this->tpEvento=='110110') { |
|
514 | + if ($this->tpEvento == '110110') { |
|
515 | 515 | $texto = $this->xCorrecao; |
516 | - } elseif ($this->tpEvento=='110111') { |
|
516 | + } elseif ($this->tpEvento == '110111') { |
|
517 | 517 | $texto = $this->xJust; |
518 | 518 | } |
519 | 519 | $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B'); |
520 | - $this->pdf->textBox($x+2, $y+2, $maxW-2, 150, $texto, $aFont, 'T', 'L', 0, '', false); |
|
520 | + $this->pdf->textBox($x + 2, $y + 2, $maxW - 2, 150, $texto, $aFont, 'T', 'L', 0, '', false); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | /** |
@@ -528,12 +528,12 @@ discard block |
||
528 | 528 | private function footer($x, $y) |
529 | 529 | { |
530 | 530 | $w = $this->wPrint; |
531 | - if ($this->tpEvento=='110110') { |
|
531 | + if ($this->tpEvento == '110110') { |
|
532 | 532 | $texto = "Este documento é uma representação gráfica da CCe e foi " |
533 | 533 | . "impresso apenas para sua informação e não possue validade fiscal." |
534 | 534 | . "\n A CCe deve ser recebida e mantida em arquivo eletrônico XML e " |
535 | 535 | . "pode ser consultada através dos Portais das SEFAZ."; |
536 | - } elseif ($this->tpEvento=='110111') { |
|
536 | + } elseif ($this->tpEvento == '110111') { |
|
537 | 537 | $texto = "Este documento é uma representação gráfica do evento de CTe e foi " |
538 | 538 | . "impresso apenas para sua informação e não possue validade fiscal." |
539 | 539 | . "\n O Evento deve ser recebido e mantido em arquivo eletrônico XML e " |
@@ -541,9 +541,9 @@ discard block |
||
541 | 541 | } |
542 | 542 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'I'); |
543 | 543 | $this->pdf->textBox($x, $y, $w, 20, $texto, $aFont, 'T', 'C', 0, '', false); |
544 | - $y = $this->hPrint -4; |
|
545 | - $texto = "Impresso em ". date('d/m/Y H:i:s'); |
|
546 | - $w = $this->wPrint-4; |
|
544 | + $y = $this->hPrint - 4; |
|
545 | + $texto = "Impresso em " . date('d/m/Y H:i:s'); |
|
546 | + $w = $this->wPrint - 4; |
|
547 | 547 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'); |
548 | 548 | $this->pdf->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'L', 0, ''); |
549 | 549 | $texto = "Daevento ver. " . $this->version |