These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace NFePHP\DA\CTe; |
||
4 | |||
5 | /** |
||
6 | * Classe para geração do envento do CTe em PDF |
||
7 | * NOTA: Este documento não está NORMALIZADO, nem é requerido pela SEFAZ |
||
8 | * |
||
9 | * @category Library |
||
10 | * @package nfephp-org/sped-da |
||
11 | * @name Daevento.php |
||
12 | * @copyright 2009-2019 NFePHP |
||
13 | * @license http://www.gnu.org/licenses/lgpl.html GNU/LGPL v.3 |
||
14 | * @link http://github.com/nfephp-org/sped-da for the canonical source repository |
||
15 | * @author Roberto L. Machado <linux.rlm at gmail dot com> |
||
16 | */ |
||
17 | |||
18 | use Exception; |
||
19 | use NFePHP\DA\Legacy\Dom; |
||
20 | use NFePHP\DA\Legacy\Pdf; |
||
21 | use NFePHP\DA\Legacy\Common; |
||
22 | |||
23 | class Daevento extends Common |
||
24 | { |
||
25 | public $chCTe; |
||
26 | |||
27 | protected $logoAlign = 'C'; |
||
28 | protected $yDados = 0; |
||
29 | protected $debugMode = 0; |
||
30 | protected $aEnd = array(); |
||
31 | protected $pdf; |
||
32 | protected $xml; |
||
33 | protected $logomarca = ''; |
||
34 | protected $errMsg = ''; |
||
35 | protected $errStatus = false; |
||
36 | protected $orientacao = 'P'; |
||
37 | protected $papel = 'A4'; |
||
38 | protected $destino = 'I'; |
||
39 | protected $pdfDir = ''; |
||
40 | protected $fontePadrao = 'Times'; |
||
41 | protected $version = '0.1.1'; |
||
42 | protected $wPrint; |
||
43 | protected $hPrint; |
||
44 | protected $wCanhoto; |
||
45 | protected $formatoChave = "#### #### #### #### #### #### #### #### #### #### ####"; |
||
46 | protected $id; |
||
47 | protected $tpAmb; |
||
48 | protected $cOrgao; |
||
49 | protected $xCorrecao; |
||
50 | protected $xCondUso; |
||
51 | protected $dhEvento; |
||
52 | protected $cStat; |
||
53 | protected $xMotivo; |
||
54 | protected $xJust; |
||
55 | protected $CNPJDest = ''; |
||
56 | protected $CPFDest = ''; |
||
57 | protected $dhRegEvento; |
||
58 | protected $nProt; |
||
59 | protected $tpEvento; |
||
60 | |||
61 | private $dom; |
||
62 | private $procEventoCTe; |
||
63 | private $evento; |
||
64 | private $infEvento; |
||
65 | private $retEvento; |
||
66 | private $rinfEvento; |
||
67 | |||
68 | /** |
||
69 | *__construct |
||
70 | * @param string $docXML Arquivo XML da cce |
||
71 | * @param string $sOrientacao (Opcional) Orientação da impressão P-retrato L-Paisagem |
||
72 | * @param string $sPapel Tamanho do papel (Ex. A4) |
||
73 | * @param string $sPathLogo Caminho para o arquivo do logo |
||
74 | * @param string $sDestino Estabelece a direção do envio do documento PDF I-browser D-browser com download S- |
||
75 | * @param string $sDirPDF Caminho para o diretorio de armazenamento dos arquivos PDF |
||
76 | * @param string $fonteDACTE Nome da fonte alternativa do DACTE |
||
77 | * @param array $aEnd array com o endereço do emitente |
||
78 | * @param integer $mododebug 1-SIM e 0-Não (0 default) |
||
79 | */ |
||
80 | public function __construct( |
||
81 | $docXML = '', |
||
82 | $sOrientacao = '', |
||
83 | $sPapel = '', |
||
84 | $sPathLogo = '', |
||
85 | $sDestino = 'I', |
||
86 | $sDirPDF = '', |
||
87 | $fontePDF = '', |
||
88 | $aEnd = '', |
||
89 | $mododebug = 0 |
||
90 | ) { |
||
91 | if (is_numeric($mododebug)) { |
||
92 | $this->debugMode = $mododebug; |
||
93 | } |
||
94 | if ($this->debugMode) { |
||
95 | //ativar modo debug |
||
96 | error_reporting(E_ALL); |
||
97 | ini_set('display_errors', 'On'); |
||
98 | } else { |
||
99 | //desativar modo debug |
||
100 | error_reporting(0); |
||
101 | ini_set('display_errors', 'Off'); |
||
102 | } |
||
103 | if (is_array($aEnd)) { |
||
104 | $this->aEnd = $aEnd; |
||
105 | } |
||
106 | $this->orientacao = $sOrientacao; |
||
107 | $this->papel = $sPapel; |
||
108 | $this->pdf = ''; |
||
109 | $this->logomarca = $sPathLogo; |
||
110 | $this->destino = $sDestino; |
||
111 | $this->pdfDir = $sDirPDF; |
||
112 | // verifica se foi passa a fonte a ser usada |
||
113 | if (empty($fontePDF)) { |
||
114 | $this->fontePadrao = 'Times'; |
||
115 | } else { |
||
116 | $this->fontePadrao = $fontePDF; |
||
117 | } |
||
118 | //se for passado o xml |
||
119 | if (!is_file($docXML)) { |
||
120 | if (empty($docXML)) { |
||
121 | $this->errMsg = 'Um caminho ou um arquivo xml de evento de CTe deve ser passado!'; |
||
122 | $this->errStatus = true; |
||
123 | return false; |
||
124 | } |
||
125 | } else { |
||
126 | $docXML = file_get_contents($docXML); |
||
127 | } |
||
128 | $this->dom = new DomDocument; |
||
129 | $this->dom->loadXML($docXML); |
||
130 | $this->procEventoCTe = $this->dom->getElementsByTagName("procEventoCTe")->item(0); |
||
131 | $this->evento = $this->dom->getElementsByTagName("eventoCTe")->item(0); |
||
132 | $this->infEvento = $this->evento->getElementsByTagName("infEvento")->item(0); |
||
133 | $this->retEvento = $this->dom->getElementsByTagName("retEventoCTe")->item(0); |
||
134 | $this->rinfEvento = $this->retEvento->getElementsByTagName("infEvento")->item(0); |
||
135 | $this->tpEvento = $this->infEvento->getElementsByTagName("tpEvento")->item(0)->nodeValue; |
||
136 | if (!in_array($this->tpEvento, array('110110', '110111'))) { |
||
137 | $this->errMsg = 'Evento não implementado '.$tpEvento.' !!'; |
||
138 | $this->errStatus = true; |
||
139 | return false; |
||
140 | } |
||
141 | $this->id = str_replace('ID', '', $this->infEvento->getAttribute("Id")); |
||
142 | $this->chCTe = $this->infEvento->getElementsByTagName("chCTe")->item(0)->nodeValue; |
||
143 | $this->aEnd['CNPJ']=substr($this->chCTe, 6, 14); |
||
144 | $this->tpAmb = $this->infEvento->getElementsByTagName("tpAmb")->item(0)->nodeValue; |
||
145 | $this->cOrgao = $this->infEvento->getElementsByTagName("cOrgao")->item(0)->nodeValue; |
||
146 | $this->xCorrecao = $this->infEvento->getElementsByTagName("xCorrecao")->item(0); |
||
147 | $this->xCorrecao=(empty($this->xCorrecao)?'':$this->xCorrecao->nodeValue); |
||
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); |
||
152 | $this->dhEvento = $this->infEvento->getElementsByTagName("dhEvento")->item(0)->nodeValue; |
||
153 | $this->cStat = $this->rinfEvento->getElementsByTagName("cStat")->item(0)->nodeValue; |
||
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:''; |
||
159 | $this->dhRegEvento = $this->rinfEvento->getElementsByTagName("dhRegEvento")->item(0)->nodeValue; |
||
160 | $this->nProt = $this->rinfEvento->getElementsByTagName("nProt")->item(0)->nodeValue; |
||
161 | } |
||
162 | |||
163 | /** |
||
164 | * monta |
||
165 | * @param string $orientacao |
||
166 | * @param string $papel |
||
167 | * @param string $logoAlign |
||
168 | * @param string $situacao_externa |
||
169 | * @param string $classPDF |
||
170 | * @return string |
||
171 | */ |
||
172 | public function monta( |
||
173 | $orientacao = '', |
||
174 | $papel = 'A4', |
||
175 | $logoAlign = 'C', |
||
176 | $classPDF = false |
||
177 | ) { |
||
178 | return $this->montaDAEventoCTe( |
||
179 | $orientacao, |
||
180 | $papel, |
||
181 | $logoAlign, |
||
182 | $classPDF |
||
183 | ); |
||
184 | } |
||
185 | |||
186 | /** |
||
187 | * printDocument |
||
188 | * @param string $nome |
||
189 | * @param string $destino |
||
190 | * @param string $printer |
||
191 | * @return string pdf |
||
192 | */ |
||
193 | public function printDocument($nome = '', $destino = 'I', $printer = '') |
||
194 | { |
||
195 | return $this->printDAEventoCTe($nome, $destino, $printer); |
||
196 | } |
||
197 | |||
198 | /** |
||
199 | * montaDAEventoCTe |
||
200 | * Esta função monta a DAEventoCTe conforme as informações fornecidas para a classe |
||
201 | * durante sua construção. |
||
202 | * A definição de margens e posições iniciais para a impressão são estabelecidas no |
||
203 | * pelo conteúdo da funçao e podem ser modificados. |
||
204 | * |
||
205 | * @param string $orientacao (Opcional) Estabelece a orientação da impressão (ex. P-retrato), |
||
206 | * se nada for fornecido será usado o padrão da CTe |
||
207 | * @param string $papel (Opcional) Estabelece o tamanho do papel (ex. A4) |
||
208 | * @return string O ID do evento extraido do arquivo XML |
||
209 | */ |
||
210 | public function montaDAEventoCTe( |
||
211 | $orientacao = '', |
||
212 | $papel = 'A4', |
||
213 | $logoAlign = 'C', |
||
214 | $classPDF = false |
||
215 | ) { |
||
216 | if ($orientacao == '') { |
||
217 | $orientacao = 'P'; |
||
218 | } |
||
219 | $this->orientacao = $orientacao; |
||
220 | $this->papel = $papel; |
||
221 | $this->logoAlign = $logoAlign; |
||
222 | if ($classPDF!==false) { |
||
223 | $this->pdf = $classPDF ; |
||
224 | } else { |
||
225 | $this->pdf = new Pdf($this->orientacao, 'mm', $this->papel); |
||
226 | } |
||
227 | if ($this->orientacao == 'P') { |
||
228 | // margens do PDF |
||
229 | $margSup = 2; |
||
230 | $margEsq = 2; |
||
231 | $margDir = 2; |
||
232 | // posição inicial do relatorio |
||
233 | $xInic = 1; |
||
234 | $yInic = 1; |
||
235 | if ($this->papel =='A4') { //A4 210x297mm |
||
236 | $maxW = 210; |
||
237 | $maxH = 297; |
||
238 | } |
||
239 | } else { |
||
240 | // margens do PDF |
||
241 | $margSup = 3; |
||
242 | $margEsq = 3; |
||
243 | $margDir = 3; |
||
244 | // posição inicial do relatorio |
||
245 | $xInic = 5; |
||
246 | $yInic = 5; |
||
247 | if ($papel =='A4') { |
||
248 | //A4 210x297mm |
||
249 | $maxH = 210; |
||
250 | $maxW = 297; |
||
251 | } |
||
252 | } |
||
253 | //largura imprimivel em mm |
||
254 | $this->wPrint = $maxW-($margEsq+$xInic); |
||
255 | //comprimento imprimivel em mm |
||
256 | $this->hPrint = $maxH-($margSup+$yInic); |
||
257 | // estabelece contagem de paginas |
||
258 | $this->pdf->aliasNbPages(); |
||
259 | // fixa as margens |
||
260 | $this->pdf->setMargins($margEsq, $margSup, $margDir); |
||
261 | $this->pdf->setDrawColor(0, 0, 0); |
||
262 | $this->pdf->setFillColor(255, 255, 255); |
||
263 | // inicia o documento |
||
264 | $this->pdf->open(); |
||
265 | // adiciona a primeira página |
||
266 | $this->pdf->addPage($this->orientacao, $this->papel); |
||
267 | $this->pdf->setLineWidth(0.1); |
||
268 | $this->pdf->setTextColor(0, 0, 0); |
||
269 | //montagem da página |
||
270 | $pag = 1; |
||
271 | $x = $xInic; |
||
272 | $y = $yInic; |
||
273 | //coloca o cabeçalho |
||
274 | $y = $this->header($x, $y, $pag, $situacao_externa); |
||
275 | //coloca os dados da CCe |
||
276 | $y = $this->body($x, $y+15); |
||
277 | //coloca os dados da CCe |
||
278 | $y = $this->footer($x, $y+$this->hPrint-20); |
||
279 | //retorna o ID do evento |
||
280 | if ($classPDF !==false) { |
||
281 | $aR = array( |
||
282 | 'id'=>$this->id, |
||
283 | 'classe_PDF'=>$this->pdf); |
||
284 | return $aR; |
||
285 | } else { |
||
286 | return $this->id; |
||
287 | } |
||
288 | } |
||
289 | |||
290 | /** |
||
291 | * header |
||
292 | * @param integer $x |
||
293 | * @param integer $y |
||
294 | * @param integer $pag |
||
295 | * @return integer |
||
296 | */ |
||
297 | private function header( |
||
298 | $x, |
||
299 | $y, |
||
300 | $pag |
||
301 | ) { |
||
302 | $oldX = $x; |
||
303 | $oldY = $y; |
||
304 | $maxW = $this->wPrint; |
||
305 | //#################################################################################### |
||
306 | //coluna esquerda identificação do emitente |
||
307 | $w = round($maxW*0.41, 0);// 80; |
||
308 | if ($this->orientacao == 'P') { |
||
309 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'); |
||
310 | } else { |
||
311 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'); |
||
312 | } |
||
313 | $w1 = $w; |
||
314 | $h=32; |
||
315 | $oldY += $h; |
||
316 | $this->pdf->textBox($x, $y, $w, $h); |
||
317 | $texto = 'IDENTIFICAÇÃO DO EMITENTE'; |
||
318 | $this->pdf->textBox($x, $y, $w, 5, $texto, $aFont, 'T', 'C', 0, ''); |
||
319 | if (is_file($this->logomarca)) { |
||
320 | $logoInfo = getimagesize($this->logomarca); |
||
321 | //largura da imagem em mm |
||
322 | $logoWmm = ($logoInfo[0]/72)*25.4; |
||
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; |
||
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); |
||
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; |
||
340 | $x1 = $x; |
||
341 | $y1 = round($yImg + $nImgH + 1, 0); |
||
342 | $tw = $w; |
||
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; |
||
349 | $x1 = $x; |
||
350 | $y1 = round($h/3+$y, 0); |
||
351 | $tw = round(2*$w/3, 0); |
||
352 | } |
||
353 | $this->pdf->image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg'); |
||
354 | } else { |
||
355 | $x1 = $x; |
||
356 | $y1 = round($h/3+$y, 0); |
||
357 | $tw = $w; |
||
358 | } |
||
359 | //Nome emitente |
||
360 | $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B'); |
||
361 | $texto = (isset($this->aEnd['razao'])?$this->aEnd['razao']:''); |
||
362 | $this->pdf->textBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, ''); |
||
363 | //endereço |
||
364 | $y1 = $y1+6; |
||
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']:''); |
||
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']:''); |
||
376 | $foneLen = strlen($fone); |
||
377 | if ($foneLen > 0) { |
||
378 | $fone2 = substr($fone, 0, $foneLen-4); |
||
379 | $fone1 = substr($fone, 0, $foneLen-8); |
||
380 | $fone = '(' . $fone1 . ') ' . substr($fone2, -4) . '-' . substr($fone, -4); |
||
381 | } else { |
||
382 | $fone = ''; |
||
383 | } |
||
384 | if ($email != '') { |
||
385 | $email = 'Email: '.$email; |
||
386 | } |
||
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; |
||
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; |
||
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, ''); |
||
400 | //################################################## |
||
401 | $w2 = round($maxW - $w, 0); |
||
402 | $x += $w; |
||
403 | $this->pdf->textBox($x, $y, $w2, $h); |
||
404 | $y1 = $y + $h; |
||
405 | $aFont = array('font'=>$this->fontePadrao, 'size'=>16, 'style'=>'B'); |
||
406 | if ($this->tpEvento=='110110') { |
||
407 | $texto='Representação Gráfica de CCe'; |
||
408 | } else { |
||
409 | $texto='Representação Gráfica de Evento'; |
||
410 | } |
||
411 | $this->pdf->textBox($x, $y+2, $w2, 8, $texto, $aFont, 'T', 'C', 0, ''); |
||
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)'; |
||
417 | } |
||
418 | $this->pdf->textBox($x, $y+7, $w2, 8, $texto, $aFont, 'T', 'C', 0, ''); |
||
419 | $texto = 'ID do Evento: '.$this->id; |
||
420 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
||
421 | $this->pdf->textBox($x, $y+15, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
||
422 | $tsHora = $this->convertTime($this->dhEvento); |
||
0 ignored issues
–
show
|
|||
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 | $tsHora = $this->convertTime($this->dhRegEvento); |
||
0 ignored issues
–
show
The method
convertTime() does not seem to exist on object<NFePHP\DA\CTe\Daevento> .
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed. ![]() |
|||
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 | //#################################################### |
||
429 | $x = $oldX; |
||
430 | $this->pdf->textBox($x, $y1, $maxW, 40); |
||
431 | $sY = $y1+40; |
||
432 | if ($this->tpEvento=='110110') { |
||
433 | $texto = 'De acordo com as determinações legais vigentes, vimos por meio ' |
||
434 | . 'desta comunicar-lhe que o Conhecimento de Transporte, abaixo referenciado, ' |
||
435 | . 'contêm irregularidades que estão destacadas e suas respectivas ' |
||
436 | . 'correções, solicitamos que sejam aplicadas essas correções ao ' |
||
437 | . 'executar seus lançamentos fiscais.'; |
||
438 | } elseif ($this->tpEvento=='110111') { |
||
439 | $texto = 'De acordo com as determinações legais vigentes, vimos por meio ' |
||
440 | . 'desta comunicar-lhe que o Conhecimento de Transporte, abaixo referenciado, está ' |
||
441 | . 'cancelado, solicitamos que sejam aplicadas essas correções ao ' |
||
442 | . 'executar seus lançamentos fiscais.'; |
||
443 | } |
||
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); |
||
446 | //############################################ |
||
447 | $x = $oldX; |
||
448 | $y = $y1; |
||
449 | $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B'); |
||
450 | $numNF = substr($this->chCTe, 25, 9); |
||
451 | $serie = substr($this->chCTe, 22, 3); |
||
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, ''); |
||
455 | $bW = 87; |
||
456 | $bH = 15; |
||
457 | $x = 55; |
||
458 | $y = $y1+13; |
||
459 | $w = $maxW; |
||
460 | $this->pdf->setFillColor(0, 0, 0); |
||
461 | $this->pdf->code128($x+(($w-$bW)/2), $y+2, $this->chCTe, $bW, $bH); |
||
462 | $this->pdf->setFillColor(255, 255, 255); |
||
463 | $y1 = $y+2+$bH; |
||
464 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
||
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') { |
||
469 | $x = $oldX; |
||
470 | $this->pdf->textBox($x, $sY, $maxW, 15); |
||
471 | $texto = $this->xCondUso; |
||
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; |
||
475 | } |
||
476 | if ($this->tpAmb != 1) { |
||
477 | $x = 10; |
||
478 | if ($this->orientacao == 'P') { |
||
479 | $y = round($this->hPrint*2/3, 0); |
||
480 | } else { |
||
481 | $y = round($this->hPrint/2, 0); |
||
482 | } |
||
483 | $h = 5; |
||
484 | $w = $maxW-(2*$x); |
||
485 | $this->pdf->setTextColor(90, 90, 90); |
||
486 | $texto = "SEM VALOR FISCAL"; |
||
487 | $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'); |
||
488 | $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
||
489 | $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B'); |
||
490 | $texto = "AMBIENTE DE HOMOLOGAÇÃO"; |
||
491 | $this->pdf->textBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
||
492 | $this->pdf->setTextColor(0, 0, 0); |
||
493 | } |
||
494 | return $retVal; |
||
495 | } |
||
496 | |||
497 | /** |
||
498 | * body |
||
499 | * @param integer $x |
||
500 | * @param integer $y |
||
501 | */ |
||
502 | private function body($x, $y) |
||
503 | { |
||
504 | $maxW = $this->wPrint; |
||
505 | if ($this->tpEvento=='110110') { |
||
506 | $texto = 'CORREÇÕES A SEREM CONSIDERADAS'; |
||
507 | } else { |
||
508 | $texto = 'JUSTIFICATIVA DO CANCELAMENTO'; |
||
509 | } |
||
510 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'); |
||
511 | $this->pdf->textBox($x, $y, $maxW, 5, $texto, $aFont, 'T', 'L', 0, '', false); |
||
512 | $y += 5; |
||
513 | $this->pdf->textBox($x, $y, $maxW, 190); |
||
514 | if ($this->tpEvento=='110110') { |
||
515 | $texto = $this->xCorrecao; |
||
516 | } elseif ($this->tpEvento=='110111') { |
||
517 | $texto = $this->xJust; |
||
518 | } |
||
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); |
||
521 | } |
||
522 | |||
523 | /** |
||
524 | * footer |
||
525 | * @param integer $x |
||
526 | * @param integer $y |
||
527 | */ |
||
528 | private function footer($x, $y) |
||
529 | { |
||
530 | $w = $this->wPrint; |
||
531 | if ($this->tpEvento=='110110') { |
||
532 | $texto = "Este documento é uma representação gráfica da CCe e foi " |
||
533 | . "impresso apenas para sua informação e não possue validade fiscal." |
||
534 | . "\n A CCe deve ser recebida e mantida em arquivo eletrônico XML e " |
||
535 | . "pode ser consultada através dos Portais das SEFAZ."; |
||
536 | } elseif ($this->tpEvento=='110111') { |
||
537 | $texto = "Este documento é uma representação gráfica do evento de CTe e foi " |
||
538 | . "impresso apenas para sua informação e não possue validade fiscal." |
||
539 | . "\n O Evento deve ser recebido e mantido em arquivo eletrônico XML e " |
||
540 | . "pode ser consultada através dos Portais das SEFAZ."; |
||
541 | } |
||
542 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'I'); |
||
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; |
||
547 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'); |
||
548 | $this->pdf->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'L', 0, ''); |
||
549 | $texto = "Daevento ver. " . $this->version |
||
550 | . " Powered by NFePHP (GNU/GPLv3 GNU/LGPLv3) © www.nfephp.org"; |
||
551 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'); |
||
552 | $this->pdf->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'R', 0, 'http://www.nfephp.org'); |
||
553 | } |
||
554 | |||
555 | /** |
||
556 | * printDAEventoCTe |
||
557 | * @param string $nome |
||
558 | * @param string $destino |
||
559 | * @param string $printer |
||
560 | * @return type |
||
561 | */ |
||
562 | public function printDAEventoCTe($nome = '', $destino = 'I', $printer = '') |
||
563 | { |
||
564 | $arq = $this->pdf->Output($nome, $destino); |
||
565 | if ($destino == 'S') { |
||
566 | //aqui pode entrar a rotina de impressão direta |
||
567 | } |
||
568 | return $arq; |
||
569 | } |
||
570 | } |
||
571 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.