@@ -64,9 +64,8 @@ discard block |
||
64 | 64 | * @param string $sPathLogo Caminho para o arquivo do logo |
65 | 65 | * @param string $sDestino Estabelece a direção do envio do documento PDF I-browser D-browser com download S- |
66 | 66 | * @param string $sDirPDF Caminho para o diretorio de armazenamento dos arquivos PDF |
67 | - * @param string $fonteDACTE Nome da fonte alternativa do DActe |
|
68 | 67 | * @param array $aEnd array com o endereço do emitente |
69 | - * @param number $mododebug 1-SIM e 0-Não (0 default) |
|
68 | + * @param integer $mododebug 1-SIM e 0-Não (0 default) |
|
70 | 69 | */ |
71 | 70 | public function __construct( |
72 | 71 | $docXML = '', |
@@ -142,7 +141,7 @@ discard block |
||
142 | 141 | * @param type $orientacao |
143 | 142 | * @param type $papel |
144 | 143 | * @param type $logoAlign |
145 | - * @return type |
|
144 | + * @return string |
|
146 | 145 | */ |
147 | 146 | public function monta($orientacao = '', $papel = 'A4', $logoAlign = 'C', $classPDF = false) |
148 | 147 | { |
@@ -244,10 +243,10 @@ discard block |
||
244 | 243 | |
245 | 244 | /** |
246 | 245 | * header |
247 | - * @param type $x |
|
248 | - * @param type $y |
|
249 | - * @param type $pag |
|
250 | - * @return type |
|
246 | + * @param integer $x |
|
247 | + * @param integer $y |
|
248 | + * @param integer $pag |
|
249 | + * @return double |
|
251 | 250 | */ |
252 | 251 | private function headerCCe($x, $y, $pag) |
253 | 252 | { |
@@ -437,7 +436,7 @@ discard block |
||
437 | 436 | |
438 | 437 | /** |
439 | 438 | * footer |
440 | - * @param type $x |
|
439 | + * @param integer $x |
|
441 | 440 | * @param type $y |
442 | 441 | */ |
443 | 442 | private function footerCCe($x, $y) |
@@ -15,7 +15,6 @@ |
||
15 | 15 | * @author Roberto L. Machado <linux.rlm at gmail dot com> |
16 | 16 | */ |
17 | 17 | |
18 | -use Exception; |
|
19 | 18 | use NFePHP\DA\Legacy\Dom; |
20 | 19 | use NFePHP\DA\Legacy\Pdf; |
21 | 20 | use NFePHP\DA\Legacy\Common; |
@@ -56,18 +56,18 @@ |
||
56 | 56 | private $infCanc; |
57 | 57 | private $retCancCte; |
58 | 58 | |
59 | - /** |
|
60 | - *__construct |
|
61 | - * @param string $docXML Arquivo XML da cce |
|
62 | - * @param string $sOrientacao (Opcional) Orientação da impressão P-retrato L-Paisagem |
|
63 | - * @param string $sPapel Tamanho do papel (Ex. A4) |
|
64 | - * @param string $sPathLogo Caminho para o arquivo do logo |
|
65 | - * @param string $sDestino Estabelece a direção do envio do documento PDF I-browser D-browser com download S- |
|
66 | - * @param string $sDirPDF Caminho para o diretorio de armazenamento dos arquivos PDF |
|
67 | - * @param string $fonteDACTE Nome da fonte alternativa do DActe |
|
68 | - * @param array $aEnd array com o endereço do emitente |
|
69 | - * @param number $mododebug 1-SIM e 0-Não (0 default) |
|
70 | - */ |
|
59 | + /** |
|
60 | + *__construct |
|
61 | + * @param string $docXML Arquivo XML da cce |
|
62 | + * @param string $sOrientacao (Opcional) Orientação da impressão P-retrato L-Paisagem |
|
63 | + * @param string $sPapel Tamanho do papel (Ex. A4) |
|
64 | + * @param string $sPathLogo Caminho para o arquivo do logo |
|
65 | + * @param string $sDestino Estabelece a direção do envio do documento PDF I-browser D-browser com download S- |
|
66 | + * @param string $sDirPDF Caminho para o diretorio de armazenamento dos arquivos PDF |
|
67 | + * @param string $fonteDACTE Nome da fonte alternativa do DActe |
|
68 | + * @param array $aEnd array com o endereço do emitente |
|
69 | + * @param number $mododebug 1-SIM e 0-Não (0 default) |
|
70 | + */ |
|
71 | 71 | public function __construct( |
72 | 72 | $docXML = '', |
73 | 73 | $sOrientacao = '', |
@@ -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->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->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->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->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->textBox($x, $y, $w2, $h); |
356 | 356 | $y1 = $y + $h; |
357 | - $aFont = array('font'=>$this->fontePadrao,'size'=>16,'style'=>'B'); |
|
358 | - $this->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->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->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->textBox($x, $y + 7, $w2, 8, '(Protocolo Cancelamento de CTe)', $aFont, 'T', 'C', 0, ''); |
|
361 | 361 | $tsHora = $this->convertTime($this->dhEvento); |
362 | - $texto = 'Criado em : '. date('d/m/Y H:i:s', $tsHora); |
|
363 | - $this->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->textBox($x, $y + 20, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
364 | 364 | $tsHora = $this->convertTime($this->dhRegEvento); |
365 | - $texto = 'Prococolo: '.$this->nProt.' - Registrado na SEFAZ em: '.date('d/m/Y H:i:s', $tsHora); |
|
366 | - $this->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->textBox($x, $y + 25, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
367 | 367 | //#################################################### |
368 | 368 | $x = $oldX; |
369 | 369 | $this->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->textBox($x+5, $y1, $maxW-5, 20, $texto, $aFont, 'T', 'L', 0, '', false); |
|
375 | + $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
|
376 | + $this->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->textBox($x+2, $y+11, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
383 | + $texto = "Conhecimento: " . $numNF . ' - Série: ' . $serie; |
|
384 | + $this->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->textBox($x, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
396 | + $this->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->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->textBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
414 | + $this->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->textBox($x, $y, $maxW, 5, $texto, $aFont, 'T', 'L', 0, '', false); |
431 | 431 | $y += 5; |
432 | 432 | $this->textBox($x, $y, $maxW, 210); |
433 | 433 | $texto = $this->xJust; |
434 | - $aFont = array('font'=>$this->fontePadrao,'size'=>12,'style'=>'B'); |
|
435 | - $this->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->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->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->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->textBox($x, $y, $w, 4, $texto, $aFont, 'T', 'R', 0, 'http://www.nfephp.org'); |
464 | 464 | } |
465 | 465 |
@@ -71,7 +71,6 @@ discard block |
||
71 | 71 | * @param string $sPathLogo Caminho para o arquivo do logo |
72 | 72 | * @param string $sDestino Estabelece a direção do envio do documento PDF I-browser D-browser com download S- |
73 | 73 | * @param string $sDirPDF Caminho para o diretorio de armazenamento dos arquivos PDF |
74 | - * @param string $fonteDACTE Nome da fonte alternativa do DACTE |
|
75 | 74 | * @param array $aEnd array com o endereço do emitente |
76 | 75 | * @param integer $mododebug 1-SIM e 0-Não (0 default) |
77 | 76 | */ |
@@ -163,7 +162,6 @@ discard block |
||
163 | 162 | * @param string $orientacao |
164 | 163 | * @param string $papel |
165 | 164 | * @param string $logoAlign |
166 | - * @param string $situacao_externa |
|
167 | 165 | * @param string $classPDF |
168 | 166 | * @return string |
169 | 167 | */ |
@@ -290,7 +288,7 @@ discard block |
||
290 | 288 | * @param integer $x |
291 | 289 | * @param integer $y |
292 | 290 | * @param integer $pag |
293 | - * @return integer |
|
291 | + * @return double |
|
294 | 292 | */ |
295 | 293 | private function zCabecalho( |
296 | 294 | $x, |
@@ -15,8 +15,6 @@ |
||
15 | 15 | * @author Roberto L. Machado <linux.rlm at gmail dot com> |
16 | 16 | */ |
17 | 17 | |
18 | -use Exception; |
|
19 | -use NFePHP\DA\Legacy\Dom; |
|
20 | 18 | use NFePHP\DA\Legacy\Pdf; |
21 | 19 | use NFePHP\DA\Legacy\Common; |
22 | 20 |
@@ -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->zCabecalho($x, $y, $pag, $situacao_externa); |
275 | 275 | //coloca os dados da CCe |
276 | - $y = $this->zCorpo($x, $y+15); |
|
276 | + $y = $this->zCorpo($x, $y + 15); |
|
277 | 277 | //coloca os dados da CCe |
278 | - $y = $this->zRodape($x, $y+$this->hPrint-20); |
|
278 | + $y = $this->zRodape($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->pTextBox($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->pTextBox($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->pFormat($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->pTextBox($x1, $y1-2, $tw, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
398 | + $texto .= ($texto != '' && $tmp_txt != '' ? "\n" : '') . $tmp_txt; |
|
399 | + $this->pTextBox($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->pTextBox($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->pTextBox($x, $y+2, $w2, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
411 | + $this->pTextBox($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->pTextBox($x, $y+7, $w2, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
419 | - $texto = 'ID do Evento: '.$this->id; |
|
418 | + $this->pTextBox($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->pTextBox($x, $y+15, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
421 | + $this->pTextBox($x, $y + 15, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
422 | 422 | $tsHora = $this->pConvertTime($this->dhEvento); |
423 | - $texto = 'Criado em : '. date('d/m/Y H:i:s', $tsHora); |
|
424 | - $this->pTextBox($x, $y+20, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
423 | + $texto = 'Criado em : ' . date('d/m/Y H:i:s', $tsHora); |
|
424 | + $this->pTextBox($x, $y + 20, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
425 | 425 | $tsHora = $this->pConvertTime($this->dhRegEvento); |
426 | - $texto = 'Prococolo: '.$this->nProt.' - Registrado na SEFAZ em: '.date('d/m/Y H:i:s', $tsHora); |
|
427 | - $this->pTextBox($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->pTextBox($x, $y + 25, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
428 | 428 | //#################################################### |
429 | 429 | $x = $oldX; |
430 | 430 | $this->pTextBox($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->pTextBox($x+5, $y1, $maxW-5, 20, $texto, $aFont, 'T', 'L', 0, '', false); |
|
445 | + $this->pTextBox($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->pFormat($numNF, "###.###.###"); |
453 | - $texto = "Conhecimento: " . $numNF .' - Série: '.$serie; |
|
454 | - $this->pTextBox($x+2, $y+19, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
453 | + $texto = "Conhecimento: " . $numNF . ' - Série: ' . $serie; |
|
454 | + $this->pTextBox($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->pFormat($this->chCTe, $this->formatoChave); |
466 | - $this->pTextBox($x, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
467 | - $retVal = $sY+2; |
|
468 | - if ($this->tpEvento=='110110') { |
|
466 | + $this->pTextBox($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->pTextBox($x, $sY, $maxW, 15); |
471 | 471 | $texto = $this->xCondUso; |
472 | 472 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'I'); |
473 | - $this->pTextBox($x+2, $sY+2, $maxW-2, 15, $texto, $aFont, 'T', 'L', 0, '', false); |
|
474 | - $retVal = $sY+2; |
|
473 | + $this->pTextBox($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->pTextBox($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->pTextBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
491 | + $this->pTextBox($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 zCorpo($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->pTextBox($x, $y, $maxW, 5, $texto, $aFont, 'T', 'L', 0, '', false); |
512 | 512 | $y += 5; |
513 | 513 | $this->pTextBox($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->pTextBox($x+2, $y+2, $maxW-2, 150, $texto, $aFont, 'T', 'L', 0, '', false); |
|
520 | + $this->pTextBox($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 zRodape($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->pTextBox($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->pTextBox($x, $y, $w, 4, $texto, $aFont, 'T', 'L', 0, ''); |
549 | 549 | $texto = "Daevento ver. " . $this->version |
@@ -7,6 +7,9 @@ discard block |
||
7 | 7 | * Author: Olivier PLATHEY * |
8 | 8 | *******************************************************************************/ |
9 | 9 | |
10 | +/** |
|
11 | + * @param string $enc |
|
12 | + */ |
|
10 | 13 | function readMap($enc) |
11 | 14 | { |
12 | 15 | //Read a map file |
@@ -159,6 +162,9 @@ discard block |
||
159 | 162 | return $fm; |
160 | 163 | } |
161 | 164 | |
165 | +/** |
|
166 | + * @param boolean $symbolic |
|
167 | + */ |
|
162 | 168 | function makeFontDescriptor($fm, $symbolic) |
163 | 169 | { |
164 | 170 | //Ascent |
@@ -263,6 +269,11 @@ discard block |
||
263 | 269 | return rtrim($s); |
264 | 270 | } |
265 | 271 | |
272 | +/** |
|
273 | + * @param string $file |
|
274 | + * @param string $s |
|
275 | + * @param string $mode |
|
276 | + */ |
|
266 | 277 | function saveToFile($file, $s, $mode) |
267 | 278 | { |
268 | 279 | $f = fopen($file, 'w'.$mode); |
@@ -10,23 +10,23 @@ discard block |
||
10 | 10 | function readMap($enc) |
11 | 11 | { |
12 | 12 | //Read a map file |
13 | - $file = dirname(__FILE__).'/'.strtolower($enc).'.map'; |
|
13 | + $file = dirname(__FILE__) . '/' . strtolower($enc) . '.map'; |
|
14 | 14 | $a = file($file); |
15 | 15 | if (empty($a)) { |
16 | - die('<b>Error:</b> encoding not found: '.$enc); |
|
16 | + die('<b>Error:</b> encoding not found: ' . $enc); |
|
17 | 17 | } |
18 | 18 | $cc2gn = array(); |
19 | 19 | foreach ($a as $l) { |
20 | - if ($l[0]=='!') { |
|
20 | + if ($l[0] == '!') { |
|
21 | 21 | $e = preg_split('/[ \\t]+/', rtrim($l)); |
22 | 22 | $cc = hexdec(substr($e[0], 1)); |
23 | 23 | $gn = $e[2]; |
24 | 24 | $cc2gn[$cc] = $gn; |
25 | 25 | } |
26 | 26 | } |
27 | - for ($i=0; $i<=255; $i++) { |
|
27 | + for ($i = 0; $i <= 255; $i++) { |
|
28 | 28 | if (!isset($cc2gn[$i])) { |
29 | - $cc2gn[$i]='.notdef'; |
|
29 | + $cc2gn[$i] = '.notdef'; |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | return $cc2gn; |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | ]; |
79 | 79 | foreach ($a as $l) { |
80 | 80 | $e = explode(' ', rtrim($l)); |
81 | - if (count($e)<2) { |
|
81 | + if (count($e) < 2) { |
|
82 | 82 | continue; |
83 | 83 | } |
84 | 84 | $code = $e[0]; |
85 | 85 | $param = $e[1]; |
86 | 86 | if ($code == 'C') { |
87 | 87 | //Character metrics |
88 | - $cc = (int)$e[1]; |
|
88 | + $cc = (int) $e[1]; |
|
89 | 89 | $w = $e[4]; |
90 | 90 | $gn = $e[7]; |
91 | 91 | if (substr($gn, -4) == '20AC') { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | //Fix incorrect glyph name |
96 | 96 | foreach ($map as $c => $n) { |
97 | 97 | if ($n == $fix[$gn]) { |
98 | - $map[$c]=$gn; |
|
98 | + $map[$c] = $gn; |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } else { |
106 | 106 | $widths[$gn] = $w; |
107 | 107 | if ($gn == 'X') { |
108 | - $fm['CapXHeight']=$e[13]; |
|
108 | + $fm['CapXHeight'] = $e[13]; |
|
109 | 109 | } |
110 | 110 | } |
111 | 111 | if ($gn == '.notdef') { |
@@ -116,23 +116,23 @@ discard block |
||
116 | 116 | } elseif ($code == 'Weight') { |
117 | 117 | $fm['Weight'] = $param; |
118 | 118 | } elseif ($code == 'ItalicAngle') { |
119 | - $fm['ItalicAngle'] = (double)$param; |
|
119 | + $fm['ItalicAngle'] = (double) $param; |
|
120 | 120 | } elseif ($code == 'Ascender') { |
121 | - $fm['Ascender'] = (int)$param; |
|
121 | + $fm['Ascender'] = (int) $param; |
|
122 | 122 | } elseif ($code == 'Descender') { |
123 | - $fm['Descender'] = (int)$param; |
|
123 | + $fm['Descender'] = (int) $param; |
|
124 | 124 | } elseif ($code == 'UnderlineThickness') { |
125 | - $fm['UnderlineThickness'] = (int)$param; |
|
125 | + $fm['UnderlineThickness'] = (int) $param; |
|
126 | 126 | } elseif ($code == 'UnderlinePosition') { |
127 | - $fm['UnderlinePosition'] = (int)$param; |
|
127 | + $fm['UnderlinePosition'] = (int) $param; |
|
128 | 128 | } elseif ($code == 'IsFixedPitch') { |
129 | 129 | $fm['IsFixedPitch'] = ($param == 'true'); |
130 | 130 | } elseif ($code == 'FontBBox') { |
131 | 131 | $fm['FontBBox'] = array($e[1], $e[2], $e[3], $e[4]); |
132 | 132 | } elseif ($code == 'CapHeight') { |
133 | - $fm['CapHeight'] = (int)$param; |
|
133 | + $fm['CapHeight'] = (int) $param; |
|
134 | 134 | } elseif ($code == 'StdVW') { |
135 | - $fm['StdVW'] = (int)$param; |
|
135 | + $fm['StdVW'] = (int) $param; |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | if (!isset($fm['FontName'])) { |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | $widths['Delta'] = $widths['increment']; |
147 | 147 | } |
148 | 148 | //Order widths according to map |
149 | - for ($i=0; $i<=255; $i++) { |
|
149 | + for ($i = 0; $i <= 255; $i++) { |
|
150 | 150 | if (!isset($widths[$map[$i]])) { |
151 | - echo '<b>Warning:</b> character '.$map[$i].' is missing<br>'; |
|
151 | + echo '<b>Warning:</b> character ' . $map[$i] . ' is missing<br>'; |
|
152 | 152 | $widths[$i] = $widths['.notdef']; |
153 | 153 | } else { |
154 | 154 | $widths[$i] = $widths[$map[$i]]; |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | function makeFontDescriptor($fm, $symbolic) |
163 | 163 | { |
164 | 164 | //Ascent |
165 | - $asc=(isset($fm['Ascender']) ? $fm['Ascender'] : 1000); |
|
166 | - $fd = "array('Ascent'=>".$asc; |
|
165 | + $asc = (isset($fm['Ascender']) ? $fm['Ascender'] : 1000); |
|
166 | + $fd = "array('Ascent'=>" . $asc; |
|
167 | 167 | //Descent |
168 | 168 | $desc = (isset($fm['Descender']) ? $fm['Descender'] : -200); |
169 | - $fd .= ",'Descent'=>".$desc; |
|
169 | + $fd .= ",'Descent'=>" . $desc; |
|
170 | 170 | //CapHeight |
171 | 171 | if (isset($fm['CapHeight'])) { |
172 | 172 | $ch = $fm['CapHeight']; |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } else { |
176 | 176 | $ch = $asc; |
177 | 177 | } |
178 | - $fd .= ",'CapHeight'=>".$ch; |
|
178 | + $fd .= ",'CapHeight'=>" . $ch; |
|
179 | 179 | //Flags |
180 | 180 | $flags = 0; |
181 | 181 | if (isset($fm['IsFixedPitch']) && $fm['IsFixedPitch']) { |
@@ -185,22 +185,22 @@ discard block |
||
185 | 185 | $flags += 1 << 2; |
186 | 186 | } |
187 | 187 | if (!$symbolic) { |
188 | - $flags += 1<< 5; |
|
188 | + $flags += 1 << 5; |
|
189 | 189 | } |
190 | - if (isset($fm['ItalicAngle']) && $fm['ItalicAngle']!=0) { |
|
190 | + if (isset($fm['ItalicAngle']) && $fm['ItalicAngle'] != 0) { |
|
191 | 191 | $flags += 1 << 6; |
192 | 192 | } |
193 | - $fd.=",'Flags'=>".$flags; |
|
193 | + $fd .= ",'Flags'=>" . $flags; |
|
194 | 194 | //FontBBox |
195 | 195 | if (isset($fm['FontBBox'])) { |
196 | 196 | $fbb = $fm['FontBBox']; |
197 | 197 | } else { |
198 | - $fbb = array(0,$desc-100,1000,$asc+100); |
|
198 | + $fbb = array(0, $desc - 100, 1000, $asc + 100); |
|
199 | 199 | } |
200 | - $fd .= ",'FontBBox'=>'[".$fbb[0].' '.$fbb[1].' '.$fbb[2].' '.$fbb[3]."]'"; |
|
200 | + $fd .= ",'FontBBox'=>'[" . $fbb[0] . ' ' . $fbb[1] . ' ' . $fbb[2] . ' ' . $fbb[3] . "]'"; |
|
201 | 201 | //ItalicAngle |
202 | 202 | $ia = (isset($fm['ItalicAngle']) ? $fm['ItalicAngle'] : 0); |
203 | - $fd .= ",'ItalicAngle'=>".$ia; |
|
203 | + $fd .= ",'ItalicAngle'=>" . $ia; |
|
204 | 204 | //StemV |
205 | 205 | if (isset($fm['StdVW'])) { |
206 | 206 | $stemv = $fm['StdVW']; |
@@ -209,10 +209,10 @@ discard block |
||
209 | 209 | } else { |
210 | 210 | $stemv = 70; |
211 | 211 | } |
212 | - $fd .= ",'StemV'=>".$stemv; |
|
212 | + $fd .= ",'StemV'=>" . $stemv; |
|
213 | 213 | //MissingWidth |
214 | 214 | if (isset($fm['MissingWidth'])) { |
215 | - $fd .= ",'MissingWidth'=>".$fm['MissingWidth']; |
|
215 | + $fd .= ",'MissingWidth'=>" . $fm['MissingWidth']; |
|
216 | 216 | } |
217 | 217 | $fd .= ')'; |
218 | 218 | return $fd; |
@@ -223,21 +223,21 @@ discard block |
||
223 | 223 | //Make character width array |
224 | 224 | $s = "array(\n\t"; |
225 | 225 | $cw = $fm['Widths']; |
226 | - for ($i=0; $i<=255; $i++) { |
|
226 | + for ($i = 0; $i <= 255; $i++) { |
|
227 | 227 | if (chr($i) == "'") { |
228 | 228 | $s .= "'\\''"; |
229 | 229 | } elseif (chr($i) == "\\") { |
230 | 230 | $s .= "'\\\\'"; |
231 | 231 | } elseif ($i >= 32 && $i <= 126) { |
232 | - $s .= "'".chr($i)."'"; |
|
232 | + $s .= "'" . chr($i) . "'"; |
|
233 | 233 | } else { |
234 | 234 | $s .= "chr($i)"; |
235 | 235 | } |
236 | - $s .= '=>'.$fm['Widths'][$i]; |
|
236 | + $s .= '=>' . $fm['Widths'][$i]; |
|
237 | 237 | if ($i < 255) { |
238 | 238 | $s .= ','; |
239 | 239 | } |
240 | - if (($i+1)%22==0) { |
|
240 | + if (($i + 1) % 22 == 0) { |
|
241 | 241 | $s .= "\n\t"; |
242 | 242 | } |
243 | 243 | } |
@@ -251,13 +251,13 @@ discard block |
||
251 | 251 | $ref = readMap('cp1252'); |
252 | 252 | $s = ''; |
253 | 253 | $last = 0; |
254 | - for ($i=32; $i<=255; $i++) { |
|
255 | - if ($map[$i]!=$ref[$i]) { |
|
256 | - if ($i!=$last+1) { |
|
257 | - $s .= $i.' '; |
|
254 | + for ($i = 32; $i <= 255; $i++) { |
|
255 | + if ($map[$i] != $ref[$i]) { |
|
256 | + if ($i != $last + 1) { |
|
257 | + $s .= $i . ' '; |
|
258 | 258 | } |
259 | 259 | $last = $i; |
260 | - $s .= '/'.$map[$i].' '; |
|
260 | + $s .= '/' . $map[$i] . ' '; |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | return rtrim($s); |
@@ -265,9 +265,9 @@ discard block |
||
265 | 265 | |
266 | 266 | function saveToFile($file, $s, $mode) |
267 | 267 | { |
268 | - $f = fopen($file, 'w'.$mode); |
|
268 | + $f = fopen($file, 'w' . $mode); |
|
269 | 269 | if (!$f) { |
270 | - die('Can\'t write to file '.$file); |
|
270 | + die('Can\'t write to file ' . $file); |
|
271 | 271 | } |
272 | 272 | fwrite($f, $s, strlen($s)); |
273 | 273 | fclose($f); |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | //Check if font license allows embedding |
291 | 291 | $f = fopen($file, 'rb'); |
292 | 292 | if (!$f) { |
293 | - die('<b>Error:</b> Can\'t open '.$file); |
|
293 | + die('<b>Error:</b> Can\'t open ' . $file); |
|
294 | 294 | } |
295 | 295 | //Extract number of tables |
296 | 296 | fseek($f, 4, SEEK_CUR); |
@@ -298,8 +298,8 @@ discard block |
||
298 | 298 | fseek($f, 6, SEEK_CUR); |
299 | 299 | //Seek OS/2 table |
300 | 300 | $found = false; |
301 | - for ($i=0; $i<$nb; $i++) { |
|
302 | - if (fread($f, 4)=='OS/2') { |
|
301 | + for ($i = 0; $i < $nb; $i++) { |
|
302 | + if (fread($f, 4) == 'OS/2') { |
|
303 | 303 | $found = true; |
304 | 304 | break; |
305 | 305 | } |
@@ -315,9 +315,9 @@ discard block |
||
315 | 315 | //Extract fsType flags |
316 | 316 | fseek($f, 8, SEEK_CUR); |
317 | 317 | $fsType = readShort($f); |
318 | - $rl = ($fsType & 0x02)!=0; |
|
319 | - $pp = ($fsType & 0x04)!=0; |
|
320 | - $e = ($fsType & 0x08)!=0; |
|
318 | + $rl = ($fsType & 0x02) != 0; |
|
319 | + $pp = ($fsType & 0x04) != 0; |
|
320 | + $e = ($fsType & 0x08) != 0; |
|
321 | 321 | fclose($f); |
322 | 322 | if ($rl && !$pp && !$e) { |
323 | 323 | echo '<b>Warning:</b> font license does not allow embedding'; |
@@ -341,71 +341,71 @@ discard block |
||
341 | 341 | if ($enc) { |
342 | 342 | $map = readMap($enc); |
343 | 343 | foreach ($patch as $cc => $gn) { |
344 | - $map[$cc]=$gn; |
|
344 | + $map[$cc] = $gn; |
|
345 | 345 | } |
346 | 346 | } else { |
347 | - $map=array(); |
|
347 | + $map = array(); |
|
348 | 348 | } |
349 | 349 | if (!file_exists($afmfile)) { |
350 | - die('<b>Error:</b> AFM file not found: '.$afmfile); |
|
350 | + die('<b>Error:</b> AFM file not found: ' . $afmfile); |
|
351 | 351 | } |
352 | 352 | $fm = readAFM($afmfile, $map); |
353 | 353 | if ($enc) { |
354 | 354 | $diff = makeFontEncoding($map); |
355 | 355 | } else { |
356 | - $diff=''; |
|
356 | + $diff = ''; |
|
357 | 357 | } |
358 | 358 | $fd = makeFontDescriptor($fm, empty($map)); |
359 | 359 | //Find font type |
360 | 360 | if ($fontfile) { |
361 | 361 | $ext = strtolower(substr($fontfile, -3)); |
362 | 362 | if ($ext == 'ttf') { |
363 | - $type='TrueType'; |
|
363 | + $type = 'TrueType'; |
|
364 | 364 | } elseif ($ext == 'pfb') { |
365 | 365 | $type = 'Type1'; |
366 | 366 | } else { |
367 | - die('<b>Error:</b> unrecognized font file extension: '.$ext); |
|
367 | + die('<b>Error:</b> unrecognized font file extension: ' . $ext); |
|
368 | 368 | } |
369 | 369 | } else { |
370 | - if ($type!='TrueType' && $type!='Type1') { |
|
371 | - die('<b>Error:</b> incorrect font type: '.$type); |
|
370 | + if ($type != 'TrueType' && $type != 'Type1') { |
|
371 | + die('<b>Error:</b> incorrect font type: ' . $type); |
|
372 | 372 | } |
373 | 373 | } |
374 | 374 | //Start generation |
375 | - $s = '<?php'."\n"; |
|
376 | - $s .= '$type=\''.$type."';\n"; |
|
377 | - $s .= '$name=\''.$fm['FontName']."';\n"; |
|
378 | - $s .= '$desc='.$fd.";\n"; |
|
375 | + $s = '<?php' . "\n"; |
|
376 | + $s .= '$type=\'' . $type . "';\n"; |
|
377 | + $s .= '$name=\'' . $fm['FontName'] . "';\n"; |
|
378 | + $s .= '$desc=' . $fd . ";\n"; |
|
379 | 379 | if (!isset($fm['UnderlinePosition'])) { |
380 | 380 | $fm['UnderlinePosition'] = -100; |
381 | 381 | } |
382 | 382 | if (!isset($fm['UnderlineThickness'])) { |
383 | 383 | $fm['UnderlineThickness'] = 50; |
384 | 384 | } |
385 | - $s .= '$up='.$fm['UnderlinePosition'].";\n"; |
|
386 | - $s .= '$ut='.$fm['UnderlineThickness'].";\n"; |
|
385 | + $s .= '$up=' . $fm['UnderlinePosition'] . ";\n"; |
|
386 | + $s .= '$ut=' . $fm['UnderlineThickness'] . ";\n"; |
|
387 | 387 | $w = makeWidthArray($fm); |
388 | - $s .= '$cw='.$w.";\n"; |
|
389 | - $s .= '$enc=\''.$enc."';\n"; |
|
390 | - $s.= '$diff=\''.$diff."';\n"; |
|
388 | + $s .= '$cw=' . $w . ";\n"; |
|
389 | + $s .= '$enc=\'' . $enc . "';\n"; |
|
390 | + $s .= '$diff=\'' . $diff . "';\n"; |
|
391 | 391 | $basename = substr(basename($afmfile), 0, -4); |
392 | 392 | if ($fontfile) { |
393 | 393 | //Embedded font |
394 | 394 | if (!file_exists($fontfile)) { |
395 | - die('<b>Error:</b> font file not found: '.$fontfile); |
|
395 | + die('<b>Error:</b> font file not found: ' . $fontfile); |
|
396 | 396 | } |
397 | - if ($type=='TrueType') { |
|
397 | + if ($type == 'TrueType') { |
|
398 | 398 | checkTTF($fontfile); |
399 | 399 | } |
400 | 400 | $f = fopen($fontfile, 'rb'); |
401 | 401 | if (!$f) { |
402 | - die('<b>Error:</b> Can\'t open '.$fontfile); |
|
402 | + die('<b>Error:</b> Can\'t open ' . $fontfile); |
|
403 | 403 | } |
404 | 404 | $file = fread($f, filesize($fontfile)); |
405 | 405 | fclose($f); |
406 | 406 | if ($type == 'Type1') { |
407 | 407 | //Find first two sections and discard third one |
408 | - $header = (ord($file[0])==128); |
|
408 | + $header = (ord($file[0]) == 128); |
|
409 | 409 | if ($header) { |
410 | 410 | //Strip first binary header |
411 | 411 | $file = substr($file, 6); |
@@ -414,38 +414,38 @@ discard block |
||
414 | 414 | if (!$pos) { |
415 | 415 | die('<b>Error:</b> font file does not seem to be valid Type1'); |
416 | 416 | } |
417 | - $size1 = $pos+6; |
|
418 | - if ($header && ord($file[$size1])==128) { |
|
417 | + $size1 = $pos + 6; |
|
418 | + if ($header && ord($file[$size1]) == 128) { |
|
419 | 419 | //Strip second binary header |
420 | - $file = substr($file, 0, $size1).substr($file, $size1+6); |
|
420 | + $file = substr($file, 0, $size1) . substr($file, $size1 + 6); |
|
421 | 421 | } |
422 | 422 | $pos = strpos($file, '00000000'); |
423 | 423 | if (!$pos) { |
424 | 424 | die('<b>Error:</b> font file does not seem to be valid Type1'); |
425 | 425 | } |
426 | - $size2 = $pos-$size1; |
|
427 | - $file = substr($file, 0, $size1+$size2); |
|
426 | + $size2 = $pos - $size1; |
|
427 | + $file = substr($file, 0, $size1 + $size2); |
|
428 | 428 | } |
429 | 429 | if (function_exists('gzcompress')) { |
430 | - $cmp=$basename.'.z'; |
|
430 | + $cmp = $basename . '.z'; |
|
431 | 431 | saveToFile($cmp, gzcompress($file), 'b'); |
432 | - $s .= '$file=\''.$cmp."';\n"; |
|
433 | - echo 'Font file compressed ('.$cmp.')<br>'; |
|
432 | + $s .= '$file=\'' . $cmp . "';\n"; |
|
433 | + echo 'Font file compressed (' . $cmp . ')<br>'; |
|
434 | 434 | } else { |
435 | - $s .= '$file=\''.basename($fontfile)."';\n"; |
|
435 | + $s .= '$file=\'' . basename($fontfile) . "';\n"; |
|
436 | 436 | echo '<b>Notice:</b> font file could not be compressed (zlib extension not available)<br>'; |
437 | 437 | } |
438 | 438 | if ($type == 'Type1') { |
439 | - $s .= '$size1='.$size1.";\n"; |
|
440 | - $s .= '$size2='.$size2.";\n"; |
|
439 | + $s .= '$size1=' . $size1 . ";\n"; |
|
440 | + $s .= '$size2=' . $size2 . ";\n"; |
|
441 | 441 | } else { |
442 | - $s .= '$originalsize='.filesize($fontfile).";\n"; |
|
442 | + $s .= '$originalsize=' . filesize($fontfile) . ";\n"; |
|
443 | 443 | } |
444 | 444 | } else { |
445 | 445 | //Not embedded font |
446 | - $s .= '$file='."'';\n"; |
|
446 | + $s .= '$file=' . "'';\n"; |
|
447 | 447 | } |
448 | - $s.="?>\n"; |
|
449 | - saveToFile($basename.'.php', $s, 't'); |
|
450 | - echo 'Font definition file generated ('.$basename.'.php'.')<br>'; |
|
448 | + $s .= "?>\n"; |
|
449 | + saveToFile($basename . '.php', $s, 't'); |
|
450 | + echo 'Font definition file generated (' . $basename . '.php' . ')<br>'; |
|
451 | 451 | } |
@@ -164,6 +164,9 @@ discard block |
||
164 | 164 | /** |
165 | 165 | * Code128 |
166 | 166 | * Imprime barcode 128 |
167 | + * @param double $x |
|
168 | + * @param double $y |
|
169 | + * @param integer $h |
|
167 | 170 | */ |
168 | 171 | public function code128($x, $y, $code, $w, $h) |
169 | 172 | { |
@@ -240,8 +243,8 @@ discard block |
||
240 | 243 | * rotate |
241 | 244 | * Rotaciona para impressão paisagem (landscape) |
242 | 245 | * @param number $angle |
243 | - * @param number $x |
|
244 | - * @param number $y |
|
246 | + * @param integer $x |
|
247 | + * @param integer $y |
|
245 | 248 | */ |
246 | 249 | public function rotate($angle, $x = -1, $y = -1) |
247 | 250 | { |
@@ -340,12 +343,12 @@ discard block |
||
340 | 343 | /** |
341 | 344 | * arc |
342 | 345 | * Desenha o arco para arredondar o canto do retangulo |
343 | - * @param number $x1 |
|
344 | - * @param number $y1 |
|
345 | - * @param number $x2 |
|
346 | - * @param number $y2 |
|
347 | - * @param number $x3 |
|
348 | - * @param number $y3 |
|
346 | + * @param double $x1 |
|
347 | + * @param double $y1 |
|
348 | + * @param double $x2 |
|
349 | + * @param double $y2 |
|
350 | + * @param double $x3 |
|
351 | + * @param double $y3 |
|
349 | 352 | */ |
350 | 353 | private function arc($x1, $y1, $x2, $y2, $x3, $y3) |
351 | 354 | { |
@@ -370,8 +373,8 @@ discard block |
||
370 | 373 | * @param number $y1 |
371 | 374 | * @param number $x2 |
372 | 375 | * @param number $y2 |
373 | - * @param number $width |
|
374 | - * @param number $nb |
|
376 | + * @param integer $width |
|
377 | + * @param integer $nb |
|
375 | 378 | */ |
376 | 379 | public function dashedRect($x1, $y1, $x2, $y2, $width = 1, $nb = 15) |
377 | 380 | { |
@@ -440,11 +443,11 @@ discard block |
||
440 | 443 | * @param number $w |
441 | 444 | * @param number $h |
442 | 445 | * @param string $txt |
443 | - * @param string $border |
|
446 | + * @param integer $border |
|
444 | 447 | * @param string $align |
445 | 448 | * @param boolean $fill |
446 | - * @param number $maxline |
|
447 | - * @param number $prn |
|
449 | + * @param integer $maxline |
|
450 | + * @param integer $prn |
|
448 | 451 | * @return int |
449 | 452 | */ |
450 | 453 | private function drawRows($w, $h, $txt, $border = 0, $align = 'J', $fill = false, $maxline = 0, $prn = 0) |
@@ -626,10 +629,10 @@ discard block |
||
626 | 629 | * CellFit |
627 | 630 | * Celula com escala horizontal caso o texto seja muito largo |
628 | 631 | * @param number $w |
629 | - * @param number $h |
|
632 | + * @param integer $h |
|
630 | 633 | * @param string $txt |
631 | - * @param number $border |
|
632 | - * @param number $ln |
|
634 | + * @param integer $border |
|
635 | + * @param integer $ln |
|
633 | 636 | * @param string $align |
634 | 637 | * @param boolean $fill |
635 | 638 | * @param string $link |
@@ -681,10 +684,10 @@ discard block |
||
681 | 684 | * CellFitScale |
682 | 685 | * Celula com escalamento horizontal somente se necessário |
683 | 686 | * @param number $w |
684 | - * @param number $h |
|
687 | + * @param integer $h |
|
685 | 688 | * @param string $txt |
686 | - * @param number $border |
|
687 | - * @param number $ln |
|
689 | + * @param integer $border |
|
690 | + * @param integer $ln |
|
688 | 691 | * @param string $align |
689 | 692 | * @param boolean $fill |
690 | 693 | * @param string $link |
@@ -698,10 +701,10 @@ discard block |
||
698 | 701 | * CellFitScaleForce |
699 | 702 | * Celula com escalamento forçado |
700 | 703 | * @param number $w |
701 | - * @param number $h |
|
704 | + * @param integer $h |
|
702 | 705 | * @param string $txt |
703 | - * @param number $border |
|
704 | - * @param number $ln |
|
706 | + * @param integer $border |
|
707 | + * @param integer $ln |
|
705 | 708 | * @param string $align |
706 | 709 | * @param boolean $fill |
707 | 710 | * @param string $link |
@@ -723,10 +726,10 @@ discard block |
||
723 | 726 | * CellFitSpace |
724 | 727 | * Celula com espaçamento de caracteres somente se necessário |
725 | 728 | * @param number $w |
726 | - * @param number $h |
|
729 | + * @param integer $h |
|
727 | 730 | * @param string $txt |
728 | - * @param number $border |
|
729 | - * @param number $ln |
|
731 | + * @param integer $border |
|
732 | + * @param integer $ln |
|
730 | 733 | * @param string $align |
731 | 734 | * @param boolean $fill |
732 | 735 | * @param string $link |
@@ -740,10 +743,10 @@ discard block |
||
740 | 743 | * CellFitSpaceForce |
741 | 744 | * Celula com espaçamento de caracteres forçado |
742 | 745 | * @param number $w |
743 | - * @param number $h |
|
746 | + * @param integer $h |
|
744 | 747 | * @param string $txt |
745 | - * @param number $border |
|
746 | - * @param number $ln |
|
748 | + * @param integer $border |
|
749 | + * @param integer $ln |
|
747 | 750 | * @param string $align |
748 | 751 | * @param boolean $fill |
749 | 752 | * @param string $link |
@@ -812,15 +812,15 @@ |
||
812 | 812 | } |
813 | 813 | |
814 | 814 | /** |
815 | - * DashedVLine |
|
816 | - * Desenha uma linha vertical tracejada com o FPDF |
|
817 | - * @param number $x Posição horizontal inicial, em mm |
|
818 | - * @param number $y Posição vertical inicial, em mm |
|
819 | - * @param number $w Comprimento da linha, em mm |
|
820 | - * @param number $yfinal Espessura da linha, em mm |
|
821 | - * @param number $n Numero de traços na seção da linha com o comprimento $w |
|
822 | - * @return none |
|
823 | - */ |
|
815 | + * DashedVLine |
|
816 | + * Desenha uma linha vertical tracejada com o FPDF |
|
817 | + * @param number $x Posição horizontal inicial, em mm |
|
818 | + * @param number $y Posição vertical inicial, em mm |
|
819 | + * @param number $w Comprimento da linha, em mm |
|
820 | + * @param number $yfinal Espessura da linha, em mm |
|
821 | + * @param number $n Numero de traços na seção da linha com o comprimento $w |
|
822 | + * @return none |
|
823 | + */ |
|
824 | 824 | public function dashedVLine($x, $y, $w, $yfinal, $n) |
825 | 825 | { |
826 | 826 | $this->setLineWidth($w); |
@@ -7,129 +7,129 @@ discard block |
||
7 | 7 | class Pdf extends Fpdf |
8 | 8 | { |
9 | 9 | |
10 | - private $t128; // tabela de codigos 128 |
|
11 | - private $abcSet=""; // conjunto de caracteres legiveis em 128 |
|
12 | - private $aSet=""; // grupo A do conjunto de de caracteres legiveis |
|
13 | - private $bSet=""; // grupo B do conjunto de caracteres legiveis |
|
14 | - private $cSet=""; // grupo C do conjunto de caracteres legiveis |
|
15 | - private $setFrom; // converter de |
|
16 | - private $setTo; // converter para |
|
17 | - private $jStart = array("A"=>103, "B"=>104, "C"=>105); // Caracteres de seleção do grupo 128 |
|
18 | - private $jSwap = array("A"=>101, "B"=>100, "C"=>99); // Caracteres de troca de grupo |
|
10 | + private $t128; // tabela de codigos 128 |
|
11 | + private $abcSet = ""; // conjunto de caracteres legiveis em 128 |
|
12 | + private $aSet = ""; // grupo A do conjunto de de caracteres legiveis |
|
13 | + private $bSet = ""; // grupo B do conjunto de caracteres legiveis |
|
14 | + private $cSet = ""; // grupo C do conjunto de caracteres legiveis |
|
15 | + private $setFrom; // converter de |
|
16 | + private $setTo; // converter para |
|
17 | + private $jStart = array("A"=>103, "B"=>104, "C"=>105); // Caracteres de seleção do grupo 128 |
|
18 | + private $jSwap = array("A"=>101, "B"=>100, "C"=>99); // Caracteres de troca de grupo |
|
19 | 19 | |
20 | 20 | public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4') |
21 | 21 | { |
22 | 22 | //passar parametros para a classe principal |
23 | 23 | parent::__construct($orientation, $unit, $format); |
24 | 24 | // composição dos caracteres do barcode 128 |
25 | - $this->t128[] = array(2, 1, 2, 2, 2, 2); //0 : [ ] |
|
26 | - $this->t128[] = array(2, 2, 2, 1, 2, 2); //1 : [!] |
|
27 | - $this->t128[] = array(2, 2, 2, 2, 2, 1); //2 : ["] |
|
28 | - $this->t128[] = array(1, 2, 1, 2, 2, 3); //3 : [#] |
|
29 | - $this->t128[] = array(1, 2, 1, 3, 2, 2); //4 : [$] |
|
30 | - $this->t128[] = array(1, 3, 1, 2, 2, 2); //5 : [%] |
|
31 | - $this->t128[] = array(1, 2, 2, 2, 1, 3); //6 : [&] |
|
32 | - $this->t128[] = array(1, 2, 2, 3, 1, 2); //7 : ['] |
|
33 | - $this->t128[] = array(1, 3, 2, 2, 1, 2); //8 : [(] |
|
34 | - $this->t128[] = array(2, 2, 1, 2, 1, 3); //9 : [)] |
|
35 | - $this->t128[] = array(2, 2, 1, 3, 1, 2); //10 : [*] |
|
36 | - $this->t128[] = array(2, 3, 1, 2, 1, 2); //11 : [+] |
|
37 | - $this->t128[] = array(1, 1, 2, 2, 3, 2); //12 : [,] |
|
38 | - $this->t128[] = array(1, 2, 2, 1, 3, 2); //13 : [-] |
|
39 | - $this->t128[] = array(1, 2, 2, 2, 3, 1); //14 : [.] |
|
40 | - $this->t128[] = array(1, 1, 3, 2, 2, 2); //15 : [/] |
|
41 | - $this->t128[] = array(1, 2, 3, 1, 2, 2); //16 : [0] |
|
42 | - $this->t128[] = array(1, 2, 3, 2, 2, 1); //17 : [1] |
|
43 | - $this->t128[] = array(2, 2, 3, 2, 1, 1); //18 : [2] |
|
44 | - $this->t128[] = array(2, 2, 1, 1, 3, 2); //19 : [3] |
|
45 | - $this->t128[] = array(2, 2, 1, 2, 3, 1); //20 : [4] |
|
46 | - $this->t128[] = array(2, 1, 3, 2, 1, 2); //21 : [5] |
|
47 | - $this->t128[] = array(2, 2, 3, 1, 1, 2); //22 : [6] |
|
48 | - $this->t128[] = array(3, 1, 2, 1, 3, 1); //23 : [7] |
|
49 | - $this->t128[] = array(3, 1, 1, 2, 2, 2); //24 : [8] |
|
50 | - $this->t128[] = array(3, 2, 1, 1, 2, 2); //25 : [9] |
|
51 | - $this->t128[] = array(3, 2, 1, 2, 2, 1); //26 : [:] |
|
52 | - $this->t128[] = array(3, 1, 2, 2, 1, 2); //27 : [;] |
|
53 | - $this->t128[] = array(3, 2, 2, 1, 1, 2); //28 : [<] |
|
54 | - $this->t128[] = array(3, 2, 2, 2, 1, 1); //29 : [=] |
|
55 | - $this->t128[] = array(2, 1, 2, 1, 2, 3); //30 : [>] |
|
56 | - $this->t128[] = array(2, 1, 2, 3, 2, 1); //31 : [?] |
|
57 | - $this->t128[] = array(2, 3, 2, 1, 2, 1); //32 : [@] |
|
58 | - $this->t128[] = array(1, 1, 1, 3, 2, 3); //33 : [A] |
|
59 | - $this->t128[] = array(1, 3, 1, 1, 2, 3); //34 : [B] |
|
60 | - $this->t128[] = array(1, 3, 1, 3, 2, 1); //35 : [C] |
|
61 | - $this->t128[] = array(1, 1, 2, 3, 1, 3); //36 : [D] |
|
62 | - $this->t128[] = array(1, 3, 2, 1, 1, 3); //37 : [E] |
|
63 | - $this->t128[] = array(1, 3, 2, 3, 1, 1); //38 : [F] |
|
64 | - $this->t128[] = array(2, 1, 1, 3, 1, 3); //39 : [G] |
|
65 | - $this->t128[] = array(2, 3, 1, 1, 1, 3); //40 : [H] |
|
66 | - $this->t128[] = array(2, 3, 1, 3, 1, 1); //41 : [I] |
|
67 | - $this->t128[] = array(1, 1, 2, 1, 3, 3); //42 : [J] |
|
68 | - $this->t128[] = array(1, 1, 2, 3, 3, 1); //43 : [K] |
|
69 | - $this->t128[] = array(1, 3, 2, 1, 3, 1); //44 : [L] |
|
70 | - $this->t128[] = array(1, 1, 3, 1, 2, 3); //45 : [M] |
|
71 | - $this->t128[] = array(1, 1, 3, 3, 2, 1); //46 : [N] |
|
72 | - $this->t128[] = array(1, 3, 3, 1, 2, 1); //47 : [O] |
|
73 | - $this->t128[] = array(3, 1, 3, 1, 2, 1); //48 : [P] |
|
74 | - $this->t128[] = array(2, 1, 1, 3, 3, 1); //49 : [Q] |
|
75 | - $this->t128[] = array(2, 3, 1, 1, 3, 1); //50 : [R] |
|
76 | - $this->t128[] = array(2, 1, 3, 1, 1, 3); //51 : [S] |
|
77 | - $this->t128[] = array(2, 1, 3, 3, 1, 1); //52 : [T] |
|
78 | - $this->t128[] = array(2, 1, 3, 1, 3, 1); //53 : [U] |
|
79 | - $this->t128[] = array(3, 1, 1, 1, 2, 3); //54 : [V] |
|
80 | - $this->t128[] = array(3, 1, 1, 3, 2, 1); //55 : [W] |
|
81 | - $this->t128[] = array(3, 3, 1, 1, 2, 1); //56 : [X] |
|
82 | - $this->t128[] = array(3, 1, 2, 1, 1, 3); //57 : [Y] |
|
83 | - $this->t128[] = array(3, 1, 2, 3, 1, 1); //58 : [Z] |
|
84 | - $this->t128[] = array(3, 3, 2, 1, 1, 1); //59 : [[] |
|
85 | - $this->t128[] = array(3, 1, 4, 1, 1, 1); //60 : [\] |
|
86 | - $this->t128[] = array(2, 2, 1, 4, 1, 1); //61 : []] |
|
87 | - $this->t128[] = array(4, 3, 1, 1, 1, 1); //62 : [^] |
|
88 | - $this->t128[] = array(1, 1, 1, 2, 2, 4); //63 : [_] |
|
89 | - $this->t128[] = array(1, 1, 1, 4, 2, 2); //64 : [`] |
|
90 | - $this->t128[] = array(1, 2, 1, 1, 2, 4); //65 : [a] |
|
91 | - $this->t128[] = array(1, 2, 1, 4, 2, 1); //66 : [b] |
|
92 | - $this->t128[] = array(1, 4, 1, 1, 2, 2); //67 : [c] |
|
93 | - $this->t128[] = array(1, 4, 1, 2, 2, 1); //68 : [d] |
|
94 | - $this->t128[] = array(1, 1, 2, 2, 1, 4); //69 : [e] |
|
95 | - $this->t128[] = array(1, 1, 2, 4, 1, 2); //70 : [f] |
|
96 | - $this->t128[] = array(1, 2, 2, 1, 1, 4); //71 : [g] |
|
97 | - $this->t128[] = array(1, 2, 2, 4, 1, 1); //72 : [h] |
|
98 | - $this->t128[] = array(1, 4, 2, 1, 1, 2); //73 : [i] |
|
99 | - $this->t128[] = array(1, 4, 2, 2, 1, 1); //74 : [j] |
|
100 | - $this->t128[] = array(2, 4, 1, 2, 1, 1); //75 : [k] |
|
101 | - $this->t128[] = array(2, 2, 1, 1, 1, 4); //76 : [l] |
|
102 | - $this->t128[] = array(4, 1, 3, 1, 1, 1); //77 : [m] |
|
103 | - $this->t128[] = array(2, 4, 1, 1, 1, 2); //78 : [n] |
|
104 | - $this->t128[] = array(1, 3, 4, 1, 1, 1); //79 : [o] |
|
105 | - $this->t128[] = array(1, 1, 1, 2, 4, 2); //80 : [p] |
|
106 | - $this->t128[] = array(1, 2, 1, 1, 4, 2); //81 : [q] |
|
107 | - $this->t128[] = array(1, 2, 1, 2, 4, 1); //82 : [r] |
|
108 | - $this->t128[] = array(1, 1, 4, 2, 1, 2); //83 : [s] |
|
109 | - $this->t128[] = array(1, 2, 4, 1, 1, 2); //84 : [t] |
|
110 | - $this->t128[] = array(1, 2, 4, 2, 1, 1); //85 : [u] |
|
111 | - $this->t128[] = array(4, 1, 1, 2, 1, 2); //86 : [v] |
|
112 | - $this->t128[] = array(4, 2, 1, 1, 1, 2); //87 : [w] |
|
113 | - $this->t128[] = array(4, 2, 1, 2, 1, 1); //88 : [x] |
|
114 | - $this->t128[] = array(2, 1, 2, 1, 4, 1); //89 : [y] |
|
115 | - $this->t128[] = array(2, 1, 4, 1, 2, 1); //90 : [z] |
|
116 | - $this->t128[] = array(4, 1, 2, 1, 2, 1); //91 : [{] |
|
117 | - $this->t128[] = array(1, 1, 1, 1, 4, 3); //92 : [|] |
|
118 | - $this->t128[] = array(1, 1, 1, 3, 4, 1); //93 : [}] |
|
119 | - $this->t128[] = array(1, 3, 1, 1, 4, 1); //94 : [~] |
|
120 | - $this->t128[] = array(1, 1, 4, 1, 1, 3); //95 : [DEL] |
|
121 | - $this->t128[] = array(1, 1, 4, 3, 1, 1); //96 : [FNC3] |
|
122 | - $this->t128[] = array(4, 1, 1, 1, 1, 3); //97 : [FNC2] |
|
123 | - $this->t128[] = array(4, 1, 1, 3, 1, 1); //98 : [SHIFT] |
|
124 | - $this->t128[] = array(1, 1, 3, 1, 4, 1); //99 : [Cswap] |
|
125 | - $this->t128[] = array(1, 1, 4, 1, 3, 1); //100 : [Bswap] |
|
126 | - $this->t128[] = array(3, 1, 1, 1, 4, 1); //101 : [Aswap] |
|
127 | - $this->t128[] = array(4, 1, 1, 1, 3, 1); //102 : [FNC1] |
|
128 | - $this->t128[] = array(2, 1, 1, 4, 1, 2); //103 : [Astart] |
|
129 | - $this->t128[] = array(2, 1, 1, 2, 1, 4); //104 : [Bstart] |
|
130 | - $this->t128[] = array(2, 1, 1, 2, 3, 2); //105 : [Cstart] |
|
131 | - $this->t128[] = array(2, 3, 3, 1, 1, 1); //106 : [STOP] |
|
132 | - $this->t128[] = array(2, 1); //107 : [END BAR] |
|
25 | + $this->t128[] = array(2, 1, 2, 2, 2, 2); //0 : [ ] |
|
26 | + $this->t128[] = array(2, 2, 2, 1, 2, 2); //1 : [!] |
|
27 | + $this->t128[] = array(2, 2, 2, 2, 2, 1); //2 : ["] |
|
28 | + $this->t128[] = array(1, 2, 1, 2, 2, 3); //3 : [#] |
|
29 | + $this->t128[] = array(1, 2, 1, 3, 2, 2); //4 : [$] |
|
30 | + $this->t128[] = array(1, 3, 1, 2, 2, 2); //5 : [%] |
|
31 | + $this->t128[] = array(1, 2, 2, 2, 1, 3); //6 : [&] |
|
32 | + $this->t128[] = array(1, 2, 2, 3, 1, 2); //7 : ['] |
|
33 | + $this->t128[] = array(1, 3, 2, 2, 1, 2); //8 : [(] |
|
34 | + $this->t128[] = array(2, 2, 1, 2, 1, 3); //9 : [)] |
|
35 | + $this->t128[] = array(2, 2, 1, 3, 1, 2); //10 : [*] |
|
36 | + $this->t128[] = array(2, 3, 1, 2, 1, 2); //11 : [+] |
|
37 | + $this->t128[] = array(1, 1, 2, 2, 3, 2); //12 : [,] |
|
38 | + $this->t128[] = array(1, 2, 2, 1, 3, 2); //13 : [-] |
|
39 | + $this->t128[] = array(1, 2, 2, 2, 3, 1); //14 : [.] |
|
40 | + $this->t128[] = array(1, 1, 3, 2, 2, 2); //15 : [/] |
|
41 | + $this->t128[] = array(1, 2, 3, 1, 2, 2); //16 : [0] |
|
42 | + $this->t128[] = array(1, 2, 3, 2, 2, 1); //17 : [1] |
|
43 | + $this->t128[] = array(2, 2, 3, 2, 1, 1); //18 : [2] |
|
44 | + $this->t128[] = array(2, 2, 1, 1, 3, 2); //19 : [3] |
|
45 | + $this->t128[] = array(2, 2, 1, 2, 3, 1); //20 : [4] |
|
46 | + $this->t128[] = array(2, 1, 3, 2, 1, 2); //21 : [5] |
|
47 | + $this->t128[] = array(2, 2, 3, 1, 1, 2); //22 : [6] |
|
48 | + $this->t128[] = array(3, 1, 2, 1, 3, 1); //23 : [7] |
|
49 | + $this->t128[] = array(3, 1, 1, 2, 2, 2); //24 : [8] |
|
50 | + $this->t128[] = array(3, 2, 1, 1, 2, 2); //25 : [9] |
|
51 | + $this->t128[] = array(3, 2, 1, 2, 2, 1); //26 : [:] |
|
52 | + $this->t128[] = array(3, 1, 2, 2, 1, 2); //27 : [;] |
|
53 | + $this->t128[] = array(3, 2, 2, 1, 1, 2); //28 : [<] |
|
54 | + $this->t128[] = array(3, 2, 2, 2, 1, 1); //29 : [=] |
|
55 | + $this->t128[] = array(2, 1, 2, 1, 2, 3); //30 : [>] |
|
56 | + $this->t128[] = array(2, 1, 2, 3, 2, 1); //31 : [?] |
|
57 | + $this->t128[] = array(2, 3, 2, 1, 2, 1); //32 : [@] |
|
58 | + $this->t128[] = array(1, 1, 1, 3, 2, 3); //33 : [A] |
|
59 | + $this->t128[] = array(1, 3, 1, 1, 2, 3); //34 : [B] |
|
60 | + $this->t128[] = array(1, 3, 1, 3, 2, 1); //35 : [C] |
|
61 | + $this->t128[] = array(1, 1, 2, 3, 1, 3); //36 : [D] |
|
62 | + $this->t128[] = array(1, 3, 2, 1, 1, 3); //37 : [E] |
|
63 | + $this->t128[] = array(1, 3, 2, 3, 1, 1); //38 : [F] |
|
64 | + $this->t128[] = array(2, 1, 1, 3, 1, 3); //39 : [G] |
|
65 | + $this->t128[] = array(2, 3, 1, 1, 1, 3); //40 : [H] |
|
66 | + $this->t128[] = array(2, 3, 1, 3, 1, 1); //41 : [I] |
|
67 | + $this->t128[] = array(1, 1, 2, 1, 3, 3); //42 : [J] |
|
68 | + $this->t128[] = array(1, 1, 2, 3, 3, 1); //43 : [K] |
|
69 | + $this->t128[] = array(1, 3, 2, 1, 3, 1); //44 : [L] |
|
70 | + $this->t128[] = array(1, 1, 3, 1, 2, 3); //45 : [M] |
|
71 | + $this->t128[] = array(1, 1, 3, 3, 2, 1); //46 : [N] |
|
72 | + $this->t128[] = array(1, 3, 3, 1, 2, 1); //47 : [O] |
|
73 | + $this->t128[] = array(3, 1, 3, 1, 2, 1); //48 : [P] |
|
74 | + $this->t128[] = array(2, 1, 1, 3, 3, 1); //49 : [Q] |
|
75 | + $this->t128[] = array(2, 3, 1, 1, 3, 1); //50 : [R] |
|
76 | + $this->t128[] = array(2, 1, 3, 1, 1, 3); //51 : [S] |
|
77 | + $this->t128[] = array(2, 1, 3, 3, 1, 1); //52 : [T] |
|
78 | + $this->t128[] = array(2, 1, 3, 1, 3, 1); //53 : [U] |
|
79 | + $this->t128[] = array(3, 1, 1, 1, 2, 3); //54 : [V] |
|
80 | + $this->t128[] = array(3, 1, 1, 3, 2, 1); //55 : [W] |
|
81 | + $this->t128[] = array(3, 3, 1, 1, 2, 1); //56 : [X] |
|
82 | + $this->t128[] = array(3, 1, 2, 1, 1, 3); //57 : [Y] |
|
83 | + $this->t128[] = array(3, 1, 2, 3, 1, 1); //58 : [Z] |
|
84 | + $this->t128[] = array(3, 3, 2, 1, 1, 1); //59 : [[] |
|
85 | + $this->t128[] = array(3, 1, 4, 1, 1, 1); //60 : [\] |
|
86 | + $this->t128[] = array(2, 2, 1, 4, 1, 1); //61 : []] |
|
87 | + $this->t128[] = array(4, 3, 1, 1, 1, 1); //62 : [^] |
|
88 | + $this->t128[] = array(1, 1, 1, 2, 2, 4); //63 : [_] |
|
89 | + $this->t128[] = array(1, 1, 1, 4, 2, 2); //64 : [`] |
|
90 | + $this->t128[] = array(1, 2, 1, 1, 2, 4); //65 : [a] |
|
91 | + $this->t128[] = array(1, 2, 1, 4, 2, 1); //66 : [b] |
|
92 | + $this->t128[] = array(1, 4, 1, 1, 2, 2); //67 : [c] |
|
93 | + $this->t128[] = array(1, 4, 1, 2, 2, 1); //68 : [d] |
|
94 | + $this->t128[] = array(1, 1, 2, 2, 1, 4); //69 : [e] |
|
95 | + $this->t128[] = array(1, 1, 2, 4, 1, 2); //70 : [f] |
|
96 | + $this->t128[] = array(1, 2, 2, 1, 1, 4); //71 : [g] |
|
97 | + $this->t128[] = array(1, 2, 2, 4, 1, 1); //72 : [h] |
|
98 | + $this->t128[] = array(1, 4, 2, 1, 1, 2); //73 : [i] |
|
99 | + $this->t128[] = array(1, 4, 2, 2, 1, 1); //74 : [j] |
|
100 | + $this->t128[] = array(2, 4, 1, 2, 1, 1); //75 : [k] |
|
101 | + $this->t128[] = array(2, 2, 1, 1, 1, 4); //76 : [l] |
|
102 | + $this->t128[] = array(4, 1, 3, 1, 1, 1); //77 : [m] |
|
103 | + $this->t128[] = array(2, 4, 1, 1, 1, 2); //78 : [n] |
|
104 | + $this->t128[] = array(1, 3, 4, 1, 1, 1); //79 : [o] |
|
105 | + $this->t128[] = array(1, 1, 1, 2, 4, 2); //80 : [p] |
|
106 | + $this->t128[] = array(1, 2, 1, 1, 4, 2); //81 : [q] |
|
107 | + $this->t128[] = array(1, 2, 1, 2, 4, 1); //82 : [r] |
|
108 | + $this->t128[] = array(1, 1, 4, 2, 1, 2); //83 : [s] |
|
109 | + $this->t128[] = array(1, 2, 4, 1, 1, 2); //84 : [t] |
|
110 | + $this->t128[] = array(1, 2, 4, 2, 1, 1); //85 : [u] |
|
111 | + $this->t128[] = array(4, 1, 1, 2, 1, 2); //86 : [v] |
|
112 | + $this->t128[] = array(4, 2, 1, 1, 1, 2); //87 : [w] |
|
113 | + $this->t128[] = array(4, 2, 1, 2, 1, 1); //88 : [x] |
|
114 | + $this->t128[] = array(2, 1, 2, 1, 4, 1); //89 : [y] |
|
115 | + $this->t128[] = array(2, 1, 4, 1, 2, 1); //90 : [z] |
|
116 | + $this->t128[] = array(4, 1, 2, 1, 2, 1); //91 : [{] |
|
117 | + $this->t128[] = array(1, 1, 1, 1, 4, 3); //92 : [|] |
|
118 | + $this->t128[] = array(1, 1, 1, 3, 4, 1); //93 : [}] |
|
119 | + $this->t128[] = array(1, 3, 1, 1, 4, 1); //94 : [~] |
|
120 | + $this->t128[] = array(1, 1, 4, 1, 1, 3); //95 : [DEL] |
|
121 | + $this->t128[] = array(1, 1, 4, 3, 1, 1); //96 : [FNC3] |
|
122 | + $this->t128[] = array(4, 1, 1, 1, 1, 3); //97 : [FNC2] |
|
123 | + $this->t128[] = array(4, 1, 1, 3, 1, 1); //98 : [SHIFT] |
|
124 | + $this->t128[] = array(1, 1, 3, 1, 4, 1); //99 : [Cswap] |
|
125 | + $this->t128[] = array(1, 1, 4, 1, 3, 1); //100 : [Bswap] |
|
126 | + $this->t128[] = array(3, 1, 1, 1, 4, 1); //101 : [Aswap] |
|
127 | + $this->t128[] = array(4, 1, 1, 1, 3, 1); //102 : [FNC1] |
|
128 | + $this->t128[] = array(2, 1, 1, 4, 1, 2); //103 : [Astart] |
|
129 | + $this->t128[] = array(2, 1, 1, 2, 1, 4); //104 : [Bstart] |
|
130 | + $this->t128[] = array(2, 1, 1, 2, 3, 2); //105 : [Cstart] |
|
131 | + $this->t128[] = array(2, 3, 3, 1, 1, 1); //106 : [STOP] |
|
132 | + $this->t128[] = array(2, 1); //107 : [END BAR] |
|
133 | 133 | for ($i = 32; $i <= 95; $i++) { // conjunto de caracteres |
134 | 134 | $this->abcSet .= chr($i); |
135 | 135 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $this->abcSet .= chr($i); |
144 | 144 | $this->bSet .= chr($i); |
145 | 145 | } |
146 | - $this->cSet="0123456789"; |
|
146 | + $this->cSet = "0123456789"; |
|
147 | 147 | for ($i = 0; $i < 96; $i++) { |
148 | 148 | // convertendo grupos A & B |
149 | 149 | if (isset($this->setFrom["A"])) { |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $this->setFrom["B"] .= chr($i + 32); |
154 | 154 | } |
155 | 155 | if (isset($this->setTo["A"])) { |
156 | - $this->setTo["A"] .= chr(($i < 32) ? $i+64 : $i-32); |
|
156 | + $this->setTo["A"] .= chr(($i < 32) ? $i + 64 : $i - 32); |
|
157 | 157 | } |
158 | 158 | if (isset($this->setTo["A"])) { |
159 | 159 | $this->setTo["B"] .= chr($i); |
@@ -167,21 +167,21 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function code128($x, $y, $code, $w, $h) |
169 | 169 | { |
170 | - $Aguid=""; |
|
171 | - $Bguid=""; |
|
172 | - $Cguid=""; |
|
173 | - for ($i=0; $i < strlen($code); $i++) { |
|
174 | - $needle=substr($code, $i, 1); |
|
175 | - $Aguid .= ((strpos($this->aSet, $needle)===false) ? "N" : "O"); |
|
176 | - $Bguid .= ((strpos($this->bSet, $needle)===false) ? "N" : "O"); |
|
177 | - $Cguid .= ((strpos($this->cSet, $needle)===false) ? "N" : "O"); |
|
170 | + $Aguid = ""; |
|
171 | + $Bguid = ""; |
|
172 | + $Cguid = ""; |
|
173 | + for ($i = 0; $i < strlen($code); $i++) { |
|
174 | + $needle = substr($code, $i, 1); |
|
175 | + $Aguid .= ((strpos($this->aSet, $needle) === false) ? "N" : "O"); |
|
176 | + $Bguid .= ((strpos($this->bSet, $needle) === false) ? "N" : "O"); |
|
177 | + $Cguid .= ((strpos($this->cSet, $needle) === false) ? "N" : "O"); |
|
178 | 178 | } |
179 | 179 | $SminiC = "OOOO"; |
180 | 180 | $IminiC = 4; |
181 | 181 | $crypt = ""; |
182 | 182 | while ($code > "") { |
183 | 183 | $i = strpos($Cguid, $SminiC); |
184 | - if ($i!==false) { |
|
184 | + if ($i !== false) { |
|
185 | 185 | $Aguid [$i] = "N"; |
186 | 186 | $Bguid [$i] = "N"; |
187 | 187 | } |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | if ($made === false) { |
192 | 192 | $made = strlen($Cguid); |
193 | 193 | } |
194 | - if (fmod($made, 2)==1) { |
|
194 | + if (fmod($made, 2) == 1) { |
|
195 | 195 | $made--; |
196 | 196 | } |
197 | - for ($i=0; $i < $made; |
|
197 | + for ($i = 0; $i < $made; |
|
198 | 198 | $i += 2) { |
199 | 199 | $crypt .= chr(strval(substr($code, $i, 2))); |
200 | 200 | } |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | if ($madeB === false) { |
209 | 209 | $madeB = strlen($Bguid); |
210 | 210 | } |
211 | - $made = (($madeA < $madeB) ? $madeB : $madeA ); |
|
212 | - $jeu = (($madeA < $madeB) ? "B" : "A" ); |
|
211 | + $made = (($madeA < $madeB) ? $madeB : $madeA); |
|
212 | + $jeu = (($madeA < $madeB) ? "B" : "A"); |
|
213 | 213 | $jeuguid = $jeu . "guid"; |
214 | 214 | $crypt .= chr(($crypt > "") ? $this->jSwap["$jeu"] : $this->jStart["$jeu"]); |
215 | 215 | $crypt .= strtr(substr($code, 0, $made), $this->setFrom[$jeu], $this->setTo[$jeu]); |
@@ -220,18 +220,18 @@ discard block |
||
220 | 220 | $Cguid = substr($Cguid, $made); |
221 | 221 | } |
222 | 222 | $check = ord($crypt[0]); |
223 | - for ($i=0; $i<strlen($crypt); $i++) { |
|
223 | + for ($i = 0; $i < strlen($crypt); $i++) { |
|
224 | 224 | $check += (ord($crypt[$i]) * $i); |
225 | 225 | } |
226 | 226 | $check %= 103; |
227 | 227 | $crypt .= chr($check) . chr(106) . chr(107); |
228 | 228 | $i = (strlen($crypt) * 11) - 8; |
229 | - $modul = $w/$i; |
|
230 | - for ($i=0; $i<strlen($crypt); $i++) { |
|
229 | + $modul = $w / $i; |
|
230 | + for ($i = 0; $i < strlen($crypt); $i++) { |
|
231 | 231 | $c = $this->t128[ord($crypt[$i])]; |
232 | - for ($j=0; $j<count($c); $j++) { |
|
233 | - $this->Rect($x, $y, $c[$j]*$modul, $h, "F"); |
|
234 | - $x += ($c[$j++]+$c[$j])*$modul; |
|
232 | + for ($j = 0; $j < count($c); $j++) { |
|
233 | + $this->Rect($x, $y, $c[$j] * $modul, $h, "F"); |
|
234 | + $x += ($c[$j++] + $c[$j]) * $modul; |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | } |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | } |
257 | 257 | $this->angle = $angle; |
258 | 258 | if ($angle != 0) { |
259 | - $angle *= M_PI/180; |
|
259 | + $angle *= M_PI / 180; |
|
260 | 260 | $c = cos($angle); |
261 | 261 | $s = sin($angle); |
262 | - $cx =$x*$this->k; |
|
263 | - $cy = ($this->h-$y)*$this->k; |
|
262 | + $cx = $x * $this->k; |
|
263 | + $cy = ($this->h - $y) * $this->k; |
|
264 | 264 | $this->out( |
265 | 265 | sprintf( |
266 | 266 | 'q %.5F %.5F %.5F %.5F %.2F %.2F cm 1 0 0 1 %.2F %.2F cm', |
@@ -299,40 +299,40 @@ discard block |
||
299 | 299 | } else { |
300 | 300 | $op = 'S'; |
301 | 301 | } |
302 | - $MyArc = 4/3 * (sqrt(2) - 1); |
|
303 | - $this->out(sprintf('%.2F %.2F m', ($x+$r)*$k, ($hp-$y)*$k)); |
|
304 | - $xc = $x+$w-$r; |
|
305 | - $yc = $y+$r; |
|
306 | - $this->out(sprintf('%.2F %.2F l', $xc*$k, ($hp-$y)*$k)); |
|
307 | - if (strpos($corners, '2')===false) { |
|
308 | - $this->out(sprintf('%.2F %.2F l', ($x+$w)*$k, ($hp-$y)*$k)); |
|
302 | + $MyArc = 4 / 3 * (sqrt(2) - 1); |
|
303 | + $this->out(sprintf('%.2F %.2F m', ($x + $r) * $k, ($hp - $y) * $k)); |
|
304 | + $xc = $x + $w - $r; |
|
305 | + $yc = $y + $r; |
|
306 | + $this->out(sprintf('%.2F %.2F l', $xc * $k, ($hp - $y) * $k)); |
|
307 | + if (strpos($corners, '2') === false) { |
|
308 | + $this->out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - $y) * $k)); |
|
309 | 309 | } else { |
310 | - $this->arc($xc + $r*$MyArc, $yc - $r, $xc + $r, $yc - $r*$MyArc, $xc + $r, $yc); |
|
310 | + $this->arc($xc + $r * $MyArc, $yc - $r, $xc + $r, $yc - $r * $MyArc, $xc + $r, $yc); |
|
311 | 311 | } |
312 | - $xc = $x+$w-$r; |
|
313 | - $yc = $y+$h-$r; |
|
314 | - $this->out(sprintf('%.2F %.2F l', ($x+$w)*$k, ($hp-$yc)*$k)); |
|
315 | - if (strpos($corners, '3')===false) { |
|
316 | - $this->out(sprintf('%.2F %.2F l', ($x+$w)*$k, ($hp-($y+$h))*$k)); |
|
312 | + $xc = $x + $w - $r; |
|
313 | + $yc = $y + $h - $r; |
|
314 | + $this->out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - $yc) * $k)); |
|
315 | + if (strpos($corners, '3') === false) { |
|
316 | + $this->out(sprintf('%.2F %.2F l', ($x + $w) * $k, ($hp - ($y + $h)) * $k)); |
|
317 | 317 | } else { |
318 | - $this->arc($xc + $r, $yc + $r*$MyArc, $xc + $r*$MyArc, $yc + $r, $xc, $yc + $r); |
|
318 | + $this->arc($xc + $r, $yc + $r * $MyArc, $xc + $r * $MyArc, $yc + $r, $xc, $yc + $r); |
|
319 | 319 | } |
320 | - $xc = $x+$r; |
|
321 | - $yc = $y+$h-$r; |
|
322 | - $this->out(sprintf('%.2F %.2F l', $xc*$k, ($hp-($y+$h))*$k)); |
|
323 | - if (strpos($corners, '4')===false) { |
|
324 | - $this->out(sprintf('%.2F %.2F l', ($x)*$k, ($hp-($y+$h))*$k)); |
|
320 | + $xc = $x + $r; |
|
321 | + $yc = $y + $h - $r; |
|
322 | + $this->out(sprintf('%.2F %.2F l', $xc * $k, ($hp - ($y + $h)) * $k)); |
|
323 | + if (strpos($corners, '4') === false) { |
|
324 | + $this->out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - ($y + $h)) * $k)); |
|
325 | 325 | } else { |
326 | - $this->arc($xc - $r*$MyArc, $yc + $r, $xc - $r, $yc + $r*$MyArc, $xc - $r, $yc); |
|
327 | - } |
|
328 | - $xc = $x+$r ; |
|
329 | - $yc = $y+$r; |
|
330 | - $this->out(sprintf('%.2F %.2F l', ($x)*$k, ($hp-$yc)*$k)); |
|
331 | - if (strpos($corners, '1')===false) { |
|
332 | - $this->out(sprintf('%.2F %.2F l', ($x)*$k, ($hp-$y)*$k)); |
|
333 | - $this->out(sprintf('%.2F %.2F l', ($x+$r)*$k, ($hp-$y)*$k)); |
|
326 | + $this->arc($xc - $r * $MyArc, $yc + $r, $xc - $r, $yc + $r * $MyArc, $xc - $r, $yc); |
|
327 | + } |
|
328 | + $xc = $x + $r; |
|
329 | + $yc = $y + $r; |
|
330 | + $this->out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - $yc) * $k)); |
|
331 | + if (strpos($corners, '1') === false) { |
|
332 | + $this->out(sprintf('%.2F %.2F l', ($x) * $k, ($hp - $y) * $k)); |
|
333 | + $this->out(sprintf('%.2F %.2F l', ($x + $r) * $k, ($hp - $y) * $k)); |
|
334 | 334 | } else { |
335 | - $this->arc($xc - $r, $yc - $r*$MyArc, $xc - $r*$MyArc, $yc - $r, $xc, $yc - $r); |
|
335 | + $this->arc($xc - $r, $yc - $r * $MyArc, $xc - $r * $MyArc, $yc - $r, $xc, $yc - $r); |
|
336 | 336 | } |
337 | 337 | $this->out($op); |
338 | 338 | } |
@@ -353,12 +353,12 @@ discard block |
||
353 | 353 | $this->out( |
354 | 354 | sprintf( |
355 | 355 | '%.2F %.2F %.2F %.2F %.2F %.2F c ', |
356 | - $x1*$this->k, |
|
357 | - ($h-$y1)*$this->k, |
|
358 | - $x2*$this->k, |
|
359 | - ($h-$y2)*$this->k, |
|
360 | - $x3*$this->k, |
|
361 | - ($h-$y3)*$this->k |
|
356 | + $x1 * $this->k, |
|
357 | + ($h - $y1) * $this->k, |
|
358 | + $x2 * $this->k, |
|
359 | + ($h - $y2) * $this->k, |
|
360 | + $x3 * $this->k, |
|
361 | + ($h - $y3) * $this->k |
|
362 | 362 | ) |
363 | 363 | ); |
364 | 364 | } |
@@ -376,26 +376,26 @@ discard block |
||
376 | 376 | public function dashedRect($x1, $y1, $x2, $y2, $width = 1, $nb = 15) |
377 | 377 | { |
378 | 378 | $this->setLineWidth($width); |
379 | - $longueur = abs($x1-$x2); |
|
380 | - $hauteur = abs($y1-$y2); |
|
379 | + $longueur = abs($x1 - $x2); |
|
380 | + $hauteur = abs($y1 - $y2); |
|
381 | 381 | if ($longueur > $hauteur) { |
382 | - $Pointilles = ($longueur/$nb)/2; |
|
382 | + $Pointilles = ($longueur / $nb) / 2; |
|
383 | 383 | } else { |
384 | - $Pointilles = ($hauteur/$nb)/2; |
|
384 | + $Pointilles = ($hauteur / $nb) / 2; |
|
385 | 385 | } |
386 | - for ($i=$x1; $i<=$x2; $i+=$Pointilles+$Pointilles) { |
|
387 | - for ($j=$i; $j<=($i+$Pointilles); $j++) { |
|
388 | - if ($j<=($x2-1)) { |
|
389 | - $this->line($j, $y1, $j+1, $y1); |
|
390 | - $this->line($j, $y2, $j+1, $y2); |
|
386 | + for ($i = $x1; $i <= $x2; $i += $Pointilles + $Pointilles) { |
|
387 | + for ($j = $i; $j <= ($i + $Pointilles); $j++) { |
|
388 | + if ($j <= ($x2 - 1)) { |
|
389 | + $this->line($j, $y1, $j + 1, $y1); |
|
390 | + $this->line($j, $y2, $j + 1, $y2); |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | } |
394 | - for ($i=$y1; $i<=$y2; $i+=$Pointilles+$Pointilles) { |
|
395 | - for ($j=$i; $j<=($i+$Pointilles); $j++) { |
|
396 | - if ($j<=($y2-1)) { |
|
397 | - $this->line($x1, $j, $x1, $j+1); |
|
398 | - $this->line($x2, $j, $x2, $j+1); |
|
394 | + for ($i = $y1; $i <= $y2; $i += $Pointilles + $Pointilles) { |
|
395 | + for ($j = $i; $j <= ($i + $Pointilles); $j++) { |
|
396 | + if ($j <= ($y2 - 1)) { |
|
397 | + $this->line($x1, $j, $x1, $j + 1); |
|
398 | + $this->line($x2, $j, $x2, $j + 1); |
|
399 | 399 | } |
400 | 400 | } |
401 | 401 | } |
@@ -417,16 +417,16 @@ discard block |
||
417 | 417 | $yi = $this->getY(); |
418 | 418 | $hrow = $this->fontSize; |
419 | 419 | $textrows = $this->drawRows($w, $hrow, $strText, 0, $align, 0, 0, 0); |
420 | - $maxrows = floor($h/$this->fontSize); |
|
420 | + $maxrows = floor($h / $this->fontSize); |
|
421 | 421 | $rows = min($textrows, $maxrows); |
422 | 422 | $dy = 0; |
423 | 423 | if (strtoupper($valign) == 'M') { |
424 | - $dy = ($h-$rows*$this->fontSize)/2; |
|
424 | + $dy = ($h - $rows * $this->fontSize) / 2; |
|
425 | 425 | } |
426 | 426 | if (strtoupper($valign) == 'B') { |
427 | - $dy = $h-$rows*$this->fontSize; |
|
427 | + $dy = $h - $rows * $this->fontSize; |
|
428 | 428 | } |
429 | - $this->setY($yi+$dy); |
|
429 | + $this->setY($yi + $dy); |
|
430 | 430 | $this->setX($xi); |
431 | 431 | $this->drawRows($w, $hrow, $strText, 0, $align, false, $rows, 1); |
432 | 432 | if ($border) { |
@@ -449,17 +449,17 @@ discard block |
||
449 | 449 | */ |
450 | 450 | private function drawRows($w, $h, $txt, $border = 0, $align = 'J', $fill = false, $maxline = 0, $prn = 0) |
451 | 451 | { |
452 | - $cw =& $this->currentFont['cw']; |
|
452 | + $cw = & $this->currentFont['cw']; |
|
453 | 453 | if ($w == 0) { |
454 | - $w = $this->w-$this->rMargin-$this->x; |
|
454 | + $w = $this->w - $this->rMargin - $this->x; |
|
455 | 455 | } |
456 | - $wmax = ($w-2*$this->cMargin)*1000/$this->fontSize; |
|
456 | + $wmax = ($w - 2 * $this->cMargin) * 1000 / $this->fontSize; |
|
457 | 457 | $s = str_replace("\r", '', $txt); |
458 | 458 | $nb = strlen($s); |
459 | - if ($nb > 0 && $s[$nb-1] == "\n") { |
|
459 | + if ($nb > 0 && $s[$nb - 1] == "\n") { |
|
460 | 460 | $nb--; |
461 | 461 | } |
462 | - $b=0; |
|
462 | + $b = 0; |
|
463 | 463 | if ($border) { |
464 | 464 | if ($border == 1) { |
465 | 465 | $border = 'LTRB'; |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | if (is_int(strpos($border, 'R'))) { |
474 | 474 | $b2 .= 'R'; |
475 | 475 | } |
476 | - $b = is_int(strpos($border, 'T')) ? $b2.'T' : $b2; |
|
476 | + $b = is_int(strpos($border, 'T')) ? $b2 . 'T' : $b2; |
|
477 | 477 | } |
478 | 478 | } |
479 | 479 | $sep = -1; |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | } |
493 | 493 | } |
494 | 494 | if ($prn == 1) { |
495 | - $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill); |
|
495 | + $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
496 | 496 | } |
497 | 497 | $i++; |
498 | 498 | $sep = -1; |
@@ -526,19 +526,19 @@ discard block |
||
526 | 526 | } |
527 | 527 | } |
528 | 528 | if ($prn == 1) { |
529 | - $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill); |
|
529 | + $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
530 | 530 | } |
531 | 531 | } else { |
532 | 532 | if ($align == 'J') { |
533 | - $this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0; |
|
533 | + $this->ws = ($ns > 1) ? ($wmax - $ls) / 1000 * $this->FontSize / ($ns - 1) : 0; |
|
534 | 534 | if ($prn == 1) { |
535 | - $this->out(sprintf('%.3F Tw', $this->ws*$this->k)); |
|
535 | + $this->out(sprintf('%.3F Tw', $this->ws * $this->k)); |
|
536 | 536 | } |
537 | 537 | } |
538 | 538 | if ($prn == 1) { |
539 | - $this->cell($w, $h, substr($s, $j, $sep-$j), $b, 2, $align, $fill); |
|
539 | + $this->cell($w, $h, substr($s, $j, $sep - $j), $b, 2, $align, $fill); |
|
540 | 540 | } |
541 | - $i = $sep+1; |
|
541 | + $i = $sep + 1; |
|
542 | 542 | } |
543 | 543 | $sep = -1; |
544 | 544 | $j = $i; |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | $b .= 'B'; |
566 | 566 | } |
567 | 567 | if ($prn == 1) { |
568 | - $this->cell($w, $h, substr($s, $j, $i-$j), $b, 2, $align, $fill); |
|
568 | + $this->cell($w, $h, substr($s, $j, $i - $j), $b, 2, $align, $fill); |
|
569 | 569 | } |
570 | 570 | $this->x = $this->lMargin; |
571 | 571 | return $nl; |
@@ -595,27 +595,27 @@ discard block |
||
595 | 595 | $wordwidth = $this->getStringWidth($word); |
596 | 596 | if ($wordwidth > $maxwidth) { |
597 | 597 | // Word is too long, we cut it |
598 | - for ($i=0; $i<strlen($word); $i++) { |
|
598 | + for ($i = 0; $i < strlen($word); $i++) { |
|
599 | 599 | $wordwidth = $this->getStringWidth(substr($word, $i, 1)); |
600 | 600 | if ($width + $wordwidth <= $maxwidth) { |
601 | 601 | $width += $wordwidth; |
602 | 602 | $text .= substr($word, $i, 1); |
603 | 603 | } else { |
604 | 604 | $width = $wordwidth; |
605 | - $text = rtrim($text)."\n".substr($word, $i, 1); |
|
605 | + $text = rtrim($text) . "\n" . substr($word, $i, 1); |
|
606 | 606 | $count++; |
607 | 607 | } |
608 | 608 | } |
609 | 609 | } elseif ($width + $wordwidth <= $maxwidth) { |
610 | 610 | $width += $wordwidth + $space; |
611 | - $text .= $word.' '; |
|
611 | + $text .= $word . ' '; |
|
612 | 612 | } else { |
613 | 613 | $width = $wordwidth + $space; |
614 | - $text = rtrim($text)."\n".$word.' '; |
|
614 | + $text = rtrim($text) . "\n" . $word . ' '; |
|
615 | 615 | $count++; |
616 | 616 | } |
617 | 617 | } |
618 | - $text = rtrim($text)."\n"; |
|
618 | + $text = rtrim($text) . "\n"; |
|
619 | 619 | $count++; |
620 | 620 | } |
621 | 621 | $text = rtrim($text); |
@@ -648,21 +648,21 @@ discard block |
||
648 | 648 | $scale = false, |
649 | 649 | $force = true |
650 | 650 | ) { |
651 | - $str_width=$this->getStringWidth($txt); |
|
651 | + $str_width = $this->getStringWidth($txt); |
|
652 | 652 | if ($w == 0) { |
653 | - $w = $this->w-$this->rMargin-$this->x; |
|
653 | + $w = $this->w - $this->rMargin - $this->x; |
|
654 | 654 | } |
655 | - $ratio = ($w-$this->cMargin*2)/$str_width; |
|
655 | + $ratio = ($w - $this->cMargin * 2) / $str_width; |
|
656 | 656 | $fit = ($ratio < 1 || ($ratio > 1 && $force)); |
657 | 657 | if ($fit) { |
658 | 658 | if ($scale) { |
659 | 659 | //Calcula a escala horizontal |
660 | - $horiz_scale = $ratio*100.0; |
|
660 | + $horiz_scale = $ratio * 100.0; |
|
661 | 661 | //Ajusta a escala horizontal |
662 | 662 | $this->out(sprintf('BT %.2F Tz ET', $horiz_scale)); |
663 | 663 | } else { |
664 | 664 | //Calcula o espaçamento de caracteres em pontos |
665 | - $char_space = ($w-$this->cMargin*2-$str_width)/max($this->_MBGetStringLength($txt)-1, 1)*$this->k; |
|
665 | + $char_space = ($w - $this->cMargin * 2 - $str_width) / max($this->_MBGetStringLength($txt) - 1, 1) * $this->k; |
|
666 | 666 | //Ajusta o espaçamento de caracteres |
667 | 667 | $this->out(sprintf('BT %.2F Tc ET', $char_space)); |
668 | 668 | } |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | $this->cell($w, $h, $txt, $border, $ln, $align, $fill, $link); |
674 | 674 | //Reseta o espaçamento de caracteres e a escala horizontal |
675 | 675 | if ($fit) { |
676 | - $this->out('BT '.($scale ? '100 Tz' : '0 Tc').' ET'); |
|
676 | + $this->out('BT ' . ($scale ? '100 Tz' : '0 Tc') . ' ET'); |
|
677 | 677 | } |
678 | 678 | } |
679 | 679 | |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | $len = 0; |
774 | 774 | $nbbytes = strlen($s); |
775 | 775 | for ($i = 0; $i < $nbbytes; $i++) { |
776 | - if (ord($s[$i])<128) { |
|
776 | + if (ord($s[$i]) < 128) { |
|
777 | 777 | $len++; |
778 | 778 | } else { |
779 | 779 | $len++; |
@@ -800,11 +800,11 @@ discard block |
||
800 | 800 | { |
801 | 801 | $this->setDrawColor(110); |
802 | 802 | $this->setLineWidth($h); |
803 | - $wDash = ($w/$n)/2; // comprimento dos traços |
|
804 | - for ($i=$x; $i<=$x+$w; $i += $wDash+$wDash) { |
|
805 | - for ($j=$i; $j<= ($i+$wDash); $j++) { |
|
806 | - if ($j <= ($x+$w-1)) { |
|
807 | - $this->line($j, $y, $j+1, $y); |
|
803 | + $wDash = ($w / $n) / 2; // comprimento dos traços |
|
804 | + for ($i = $x; $i <= $x + $w; $i += $wDash + $wDash) { |
|
805 | + for ($j = $i; $j <= ($i + $wDash); $j++) { |
|
806 | + if ($j <= ($x + $w - 1)) { |
|
807 | + $this->line($j, $y, $j + 1, $y); |
|
808 | 808 | } |
809 | 809 | } |
810 | 810 | } |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | $y = $aux; |
832 | 832 | } |
833 | 833 | while ($y < $yfinal && $n > 0) { |
834 | - $this->line($x, $y, $x, $y+1); |
|
834 | + $this->line($x, $y, $x, $y + 1); |
|
835 | 835 | $y += 3; |
836 | 836 | $n--; |
837 | 837 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @param string $sPathLogo Caminho para o arquivo do logo |
72 | 72 | * @param string $sDestino Estabelece a direção do envio do documento PDF I-browser D-browser com download S- |
73 | 73 | * @param string $sDirPDF Caminho para o diretorio de armazenamento dos arquivos PDF |
74 | - * @param string $fonteDAMDFE Nome da fonte alternativa do DAnfe |
|
74 | + * @param string $fontePDF Nome da fonte alternativa do DAnfe |
|
75 | 75 | * @param integer $mododebug 0-Não 1-Sim e 2-nada (2 default) |
76 | 76 | */ |
77 | 77 | public function __construct( |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | * @param float $x |
265 | 265 | * @param float $y |
266 | 266 | * @param integer $pag |
267 | - * @return string |
|
267 | + * @return double |
|
268 | 268 | */ |
269 | 269 | private function headerMDFePaisagem($x, $y, $pag) |
270 | 270 | { |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @param float $x |
430 | 430 | * @param float $y |
431 | 431 | * @param integer $pag |
432 | - * @return string |
|
432 | + * @return double |
|
433 | 433 | */ |
434 | 434 | private function headerMDFeRetrato($x, $y, $pag) |
435 | 435 | { |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | * |
593 | 593 | * @param float $x |
594 | 594 | * @param float $y |
595 | - * @return void |
|
595 | + * @return double |
|
596 | 596 | */ |
597 | 597 | private function bodyMDFe($x, $y) |
598 | 598 | { |
@@ -22,25 +22,25 @@ discard block |
||
22 | 22 | class Damdfe extends Common |
23 | 23 | { |
24 | 24 | //publicas |
25 | - public $logoAlign='L'; //alinhamento do logo |
|
26 | - public $yDados=0; |
|
27 | - public $debugMode=0; //ativa ou desativa o modo de debug |
|
25 | + public $logoAlign = 'L'; //alinhamento do logo |
|
26 | + public $yDados = 0; |
|
27 | + public $debugMode = 0; //ativa ou desativa o modo de debug |
|
28 | 28 | //privadas |
29 | 29 | protected $pdf; // objeto fpdf() |
30 | 30 | protected $xml; // string XML NFe |
31 | - protected $logomarca=''; // path para logomarca em jpg |
|
32 | - protected $errMsg=''; // mesagens de erro |
|
33 | - protected $errStatus=false;// status de erro TRUE um erro ocorreu false sem erros |
|
34 | - protected $orientacao='P'; //orientação da DANFE P-Retrato ou L-Paisagem |
|
35 | - protected $papel='A4'; //formato do papel |
|
31 | + protected $logomarca = ''; // path para logomarca em jpg |
|
32 | + protected $errMsg = ''; // mesagens de erro |
|
33 | + protected $errStatus = false; // status de erro TRUE um erro ocorreu false sem erros |
|
34 | + protected $orientacao = 'P'; //orientação da DANFE P-Retrato ou L-Paisagem |
|
35 | + protected $papel = 'A4'; //formato do papel |
|
36 | 36 | //destivo do arquivo pdf I-borwser, S-retorna o arquivo, D-força download, F-salva em arquivo local |
37 | 37 | protected $destino = 'I'; |
38 | - protected $pdfDir=''; //diretorio para salvar o pdf com a opção de destino = F |
|
39 | - protected $fontePadrao='Times'; //Nome da Fonte para gerar o DANFE |
|
38 | + protected $pdfDir = ''; //diretorio para salvar o pdf com a opção de destino = F |
|
39 | + protected $fontePadrao = 'Times'; //Nome da Fonte para gerar o DANFE |
|
40 | 40 | protected $version = '1.0.0'; |
41 | 41 | protected $wPrint; //largura imprimivel |
42 | 42 | protected $hPrint; //comprimento imprimivel |
43 | - protected $formatoChave="#### #### #### #### #### #### #### #### #### #### ####"; |
|
43 | + protected $formatoChave = "#### #### #### #### #### #### #### #### #### #### ####"; |
|
44 | 44 | //variaveis da carta de correção |
45 | 45 | protected $id; |
46 | 46 | protected $chMDFe; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | ) { |
86 | 86 | //define o caminho base da instalação do sistema |
87 | 87 | if (!defined('PATH_ROOT')) { |
88 | - define('PATH_ROOT', dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR); |
|
88 | + define('PATH_ROOT', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR); |
|
89 | 89 | } |
90 | 90 | //ajuste do tempo limite de resposta do processo |
91 | 91 | set_time_limit(1800); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $this->infMDFe->getAttribute("Id") |
192 | 192 | ); |
193 | 193 | if (is_object($this->mdfeProc)) { |
194 | - $this->nProt = ! empty($this->mdfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ? |
|
194 | + $this->nProt = !empty($this->mdfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ? |
|
195 | 195 | $this->mdfeProc->getElementsByTagName("nProt")->item(0)->nodeValue : ''; |
196 | 196 | $this->dhRecbto = $this->mdfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue; |
197 | 197 | } |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | // posição inicial do relatorio |
212 | 212 | $xInic = 7; |
213 | 213 | $yInic = 7; |
214 | - if ($this->papel =='A4') { //A4 210x297mm |
|
214 | + if ($this->papel == 'A4') { //A4 210x297mm |
|
215 | 215 | $maxW = 210; |
216 | 216 | $maxH = 297; |
217 | 217 | } |
@@ -223,15 +223,15 @@ discard block |
||
223 | 223 | // posição inicial do relatorio |
224 | 224 | $xInic = 7; |
225 | 225 | $yInic = 7; |
226 | - if ($this->papel =='A4') { //A4 210x297mm |
|
226 | + if ($this->papel == 'A4') { //A4 210x297mm |
|
227 | 227 | $maxH = 210; |
228 | 228 | $maxW = 297; |
229 | 229 | } |
230 | 230 | }//orientação |
231 | 231 | //largura imprimivel em mm |
232 | - $this->wPrint = $maxW-($margEsq+$xInic); |
|
232 | + $this->wPrint = $maxW - ($margEsq + $xInic); |
|
233 | 233 | //comprimento imprimivel em mm |
234 | - $this->hPrint = $maxH-($margSup+$yInic); |
|
234 | + $this->hPrint = $maxH - ($margSup + $yInic); |
|
235 | 235 | // estabelece contagem de paginas |
236 | 236 | $this->pdf->AliasNbPages(); |
237 | 237 | // fixa as margens |
@@ -276,67 +276,67 @@ discard block |
||
276 | 276 | $w = $maxW; //round($maxW*0.41, 0);// 80; |
277 | 277 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'); |
278 | 278 | $w1 = $w; |
279 | - $h=30; |
|
279 | + $h = 30; |
|
280 | 280 | $oldY += $h; |
281 | 281 | $this->pTextBox($x, $y, $w, $h); |
282 | 282 | if (is_file($this->logomarca)) { |
283 | 283 | $logoInfo = getimagesize($this->logomarca); |
284 | 284 | //largura da imagem em mm |
285 | - $logoWmm = ($logoInfo[0]/72)*25.4; |
|
285 | + $logoWmm = ($logoInfo[0] / 72) * 25.4; |
|
286 | 286 | //altura da imagem em mm |
287 | - $logoHmm = ($logoInfo[1]/72)*25.4; |
|
288 | - if ($this->logoAlign=='L') { |
|
289 | - $nImgW = round($w/4.5, 0); |
|
290 | - $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0); |
|
291 | - $xImg = $x+1; |
|
292 | - $yImg = round(($h-$nImgH)/2, 0)+$y; |
|
287 | + $logoHmm = ($logoInfo[1] / 72) * 25.4; |
|
288 | + if ($this->logoAlign == 'L') { |
|
289 | + $nImgW = round($w / 4.5, 0); |
|
290 | + $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
|
291 | + $xImg = $x + 1; |
|
292 | + $yImg = round(($h - $nImgH) / 2, 0) + $y; |
|
293 | 293 | //estabelecer posições do texto |
294 | - $x1 = round($xImg + $nImgW +1, 0); |
|
295 | - $y1 = round($y+2, 0); |
|
296 | - $tw = round(2*$w/3, 0); |
|
294 | + $x1 = round($xImg + $nImgW + 1, 0); |
|
295 | + $y1 = round($y + 2, 0); |
|
296 | + $tw = round(2 * $w / 3, 0); |
|
297 | 297 | } |
298 | - if ($this->logoAlign=='C') { |
|
299 | - $nImgH = round($h/3, 0); |
|
300 | - $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0); |
|
301 | - $xImg = round(($w-$nImgW)/2+$x, 0); |
|
302 | - $yImg = $y+3; |
|
298 | + if ($this->logoAlign == 'C') { |
|
299 | + $nImgH = round($h / 3, 0); |
|
300 | + $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0); |
|
301 | + $xImg = round(($w - $nImgW) / 2 + $x, 0); |
|
302 | + $yImg = $y + 3; |
|
303 | 303 | $x1 = $x; |
304 | 304 | $y1 = round($yImg + $nImgH + 1, 0); |
305 | 305 | $tw = $w; |
306 | 306 | } |
307 | - if ($this->logoAlign=='R') { |
|
308 | - $nImgW = round($w/3, 0); |
|
309 | - $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0); |
|
310 | - $xImg = round($x+($w-(1+$nImgW)), 0); |
|
311 | - $yImg = round(($h-$nImgH)/2, 0)+$y; |
|
307 | + if ($this->logoAlign == 'R') { |
|
308 | + $nImgW = round($w / 3, 0); |
|
309 | + $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
|
310 | + $xImg = round($x + ($w - (1 + $nImgW)), 0); |
|
311 | + $yImg = round(($h - $nImgH) / 2, 0) + $y; |
|
312 | 312 | $x1 = $x; |
313 | - $y1 = round($h/3+$y, 0); |
|
314 | - $tw = round(2*$w/3, 0); |
|
313 | + $y1 = round($h / 3 + $y, 0); |
|
314 | + $tw = round(2 * $w / 3, 0); |
|
315 | 315 | } |
316 | 316 | $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg'); |
317 | 317 | } else { |
318 | 318 | $x1 = $x; |
319 | - $y1 = round($h/3+$y, 0); |
|
319 | + $y1 = round($h / 3 + $y, 0); |
|
320 | 320 | $tw = $w; |
321 | 321 | } |
322 | 322 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
323 | 323 | $razao = $this->xNome; |
324 | - $cnpj = 'CNPJ: '.$this->pFormat($this->CNPJ, "###.###.###/####-##"); |
|
325 | - $ie = 'IE: '.$this->pFormat($this->IE, '##/########'); |
|
326 | - $lgr = 'Logradouro: '.$this->xLgr; |
|
327 | - $nro = 'Nº: '.$this->nro; |
|
328 | - $bairro = 'Bairro: '.$this->xBairro; |
|
324 | + $cnpj = 'CNPJ: ' . $this->pFormat($this->CNPJ, "###.###.###/####-##"); |
|
325 | + $ie = 'IE: ' . $this->pFormat($this->IE, '##/########'); |
|
326 | + $lgr = 'Logradouro: ' . $this->xLgr; |
|
327 | + $nro = 'Nº: ' . $this->nro; |
|
328 | + $bairro = 'Bairro: ' . $this->xBairro; |
|
329 | 329 | $CEP = $this->CEP; |
330 | - $CEP = 'CEP: '.$this->pFormat($CEP, "##.###-###"); |
|
331 | - $UF = 'UF: '.$this->UF; |
|
332 | - $mun = 'Municipio: '.$this->xMun; |
|
330 | + $CEP = 'CEP: ' . $this->pFormat($CEP, "##.###-###"); |
|
331 | + $UF = 'UF: ' . $this->UF; |
|
332 | + $mun = 'Municipio: ' . $this->xMun; |
|
333 | 333 | |
334 | 334 | $texto = $razao . "\n" . $cnpj . ' - ' . $ie . "\n"; |
335 | 335 | $texto .= $lgr . ' - ' . $nro . "\n"; |
336 | 336 | $texto .= $bairro . "\n"; |
337 | 337 | $texto .= $UF . ' - ' . $mun . ' - ' . $CEP; |
338 | - $this->pTextBox($x1, $y1+5, $tw, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
339 | - $x = $x+$maxW/2; |
|
338 | + $this->pTextBox($x1, $y1 + 5, $tw, 8, $texto, $aFont, 'T', 'L', 0, ''); |
|
339 | + $x = $x + $maxW / 2; |
|
340 | 340 | $w = $maxW / 2; |
341 | 341 | $this->pTextBox($x, $y, $w, $h); |
342 | 342 | $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'I'); |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | $bH = 13; |
357 | 357 | $bW = round(($w), 0); |
358 | 358 | $this->pdf->SetFillColor(0, 0, 0); |
359 | - $this->pdf->Code128($x+5, $y+7.5, $this->chMDFe, $bW-10, $bH); |
|
359 | + $this->pdf->Code128($x + 5, $y + 7.5, $this->chMDFe, $bW - 10, $bH); |
|
360 | 360 | $this->pdf->SetFillColor(255, 255, 255); |
361 | 361 | $y = $y + 22; |
362 | 362 | $this->pTextBox($x, $y, $w, 8); |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | $this->pTextBox($x, $y, $maxW, 6, $texto, $aFont, 'T', 'L', 0, ''); |
367 | 367 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
368 | 368 | $texto = $this->pFormat($this->chMDFe, $this->formatoChave); |
369 | - $this->pTextBox($x, $y+3, $w, 6, $texto, $aFont, 'T', 'C', 0, ''); |
|
369 | + $this->pTextBox($x, $y + 3, $w, 6, $texto, $aFont, 'T', 'C', 0, ''); |
|
370 | 370 | $y = $y + 11; |
371 | 371 | $this->pTextBox($x, $y, $w, 12); |
372 | 372 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'I'); |
@@ -376,37 +376,37 @@ discard block |
||
376 | 376 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
377 | 377 | if (is_object($this->mdfeProc)) { |
378 | 378 | $tsHora = $this->pConvertTime($this->dhRecbto); |
379 | - $texto = $this->nProt.' - '.date('d/m/Y H:i:s', $tsHora); |
|
379 | + $texto = $this->nProt . ' - ' . date('d/m/Y H:i:s', $tsHora); |
|
380 | 380 | } else { |
381 | - $texto = 'DAMDFE impresso em contingência - '.date('d/m/Y H:i:s'); |
|
381 | + $texto = 'DAMDFE impresso em contingência - ' . date('d/m/Y H:i:s'); |
|
382 | 382 | } |
383 | - $this->pTextBox($x, $y+4, $w, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
383 | + $this->pTextBox($x, $y + 4, $w, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
384 | 384 | if ($this->tpAmb != 1) { |
385 | 385 | $x = 10; |
386 | 386 | if ($this->orientacao == 'P') { |
387 | - $yy = round($this->hPrint*2/3, 0); |
|
387 | + $yy = round($this->hPrint * 2 / 3, 0); |
|
388 | 388 | } else { |
389 | - $yy = round($this->hPrint/2, 0); |
|
389 | + $yy = round($this->hPrint / 2, 0); |
|
390 | 390 | } |
391 | 391 | $h = 5; |
392 | - $w = $maxW-(2*$x); |
|
392 | + $w = $maxW - (2 * $x); |
|
393 | 393 | $this->pdf->SetTextColor(90, 90, 90); |
394 | 394 | $texto = "SEM VALOR FISCAL"; |
395 | 395 | $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'); |
396 | 396 | $this->pTextBox($x, $yy, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
397 | 397 | $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B'); |
398 | 398 | $texto = "AMBIENTE DE HOMOLOGAÇÃO"; |
399 | - $this->pTextBox($x, $yy+14, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
399 | + $this->pTextBox($x, $yy + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
400 | 400 | $this->pdf->SetTextColor(0, 0, 0); |
401 | 401 | } else { |
402 | 402 | $x = 10; |
403 | 403 | if ($this->orientacao == 'P') { |
404 | - $yy = round($this->hPrint*2/3, 0); |
|
404 | + $yy = round($this->hPrint * 2 / 3, 0); |
|
405 | 405 | } else { |
406 | - $yy = round($this->hPrint/2, 0); |
|
406 | + $yy = round($this->hPrint / 2, 0); |
|
407 | 407 | }//fim orientacao |
408 | 408 | $h = 5; |
409 | - $w = $maxW-(2*$x); |
|
409 | + $w = $maxW - (2 * $x); |
|
410 | 410 | $this->pdf->SetTextColor(90, 90, 90); |
411 | 411 | //indicar FALTA DO PROTOCOLO se MDFe não for em contingência |
412 | 412 | if (($this->tpEmis == 2 || $this->tpEmis == 5)) { |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | $this->pTextBox($x, $yy, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
417 | 417 | $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B'); |
418 | 418 | $texto = "devido à problemas técnicos"; |
419 | - $this->pTextBox($x, $yy+12, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
419 | + $this->pTextBox($x, $yy + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
420 | 420 | } |
421 | 421 | $this->pdf->SetTextColor(0, 0, 0); |
422 | 422 | } |
@@ -441,60 +441,60 @@ discard block |
||
441 | 441 | $w = $maxW; //round($maxW*0.41, 0);// 80; |
442 | 442 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'); |
443 | 443 | $w1 = $w; |
444 | - $h=20; |
|
444 | + $h = 20; |
|
445 | 445 | $oldY += $h; |
446 | 446 | $this->pTextBox($x, $y, $w, $h); |
447 | 447 | if (is_file($this->logomarca)) { |
448 | 448 | $logoInfo = getimagesize($this->logomarca); |
449 | 449 | //largura da imagem em mm |
450 | - $logoWmm = ($logoInfo[0]/72)*25.4; |
|
450 | + $logoWmm = ($logoInfo[0] / 72) * 25.4; |
|
451 | 451 | //altura da imagem em mm |
452 | - $logoHmm = ($logoInfo[1]/72)*25.4; |
|
453 | - if ($this->logoAlign=='L') { |
|
454 | - $nImgW = round($w/8, 0); |
|
455 | - $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0); |
|
456 | - $xImg = $x+1; |
|
457 | - $yImg = round(($h-$nImgH)/2, 0)+$y; |
|
452 | + $logoHmm = ($logoInfo[1] / 72) * 25.4; |
|
453 | + if ($this->logoAlign == 'L') { |
|
454 | + $nImgW = round($w / 8, 0); |
|
455 | + $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
|
456 | + $xImg = $x + 1; |
|
457 | + $yImg = round(($h - $nImgH) / 2, 0) + $y; |
|
458 | 458 | //estabelecer posições do texto |
459 | - $x1 = round($xImg + $nImgW +1, 0); |
|
460 | - $y1 = round($y+2, 0); |
|
461 | - $tw = round(2*$w/3, 0); |
|
459 | + $x1 = round($xImg + $nImgW + 1, 0); |
|
460 | + $y1 = round($y + 2, 0); |
|
461 | + $tw = round(2 * $w / 3, 0); |
|
462 | 462 | } |
463 | - if ($this->logoAlign=='C') { |
|
464 | - $nImgH = round($h/3, 0); |
|
465 | - $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0); |
|
466 | - $xImg = round(($w-$nImgW)/2+$x, 0); |
|
467 | - $yImg = $y+3; |
|
463 | + if ($this->logoAlign == 'C') { |
|
464 | + $nImgH = round($h / 3, 0); |
|
465 | + $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0); |
|
466 | + $xImg = round(($w - $nImgW) / 2 + $x, 0); |
|
467 | + $yImg = $y + 3; |
|
468 | 468 | $x1 = $x; |
469 | 469 | $y1 = round($yImg + $nImgH + 1, 0); |
470 | 470 | $tw = $w; |
471 | 471 | } |
472 | - if ($this->logoAlign=='R') { |
|
473 | - $nImgW = round($w/3, 0); |
|
474 | - $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0); |
|
475 | - $xImg = round($x+($w-(1+$nImgW)), 0); |
|
476 | - $yImg = round(($h-$nImgH)/2, 0)+$y; |
|
472 | + if ($this->logoAlign == 'R') { |
|
473 | + $nImgW = round($w / 3, 0); |
|
474 | + $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
|
475 | + $xImg = round($x + ($w - (1 + $nImgW)), 0); |
|
476 | + $yImg = round(($h - $nImgH) / 2, 0) + $y; |
|
477 | 477 | $x1 = $x; |
478 | - $y1 = round($h/3+$y, 0); |
|
479 | - $tw = round(2*$w/3, 0); |
|
478 | + $y1 = round($h / 3 + $y, 0); |
|
479 | + $tw = round(2 * $w / 3, 0); |
|
480 | 480 | } |
481 | 481 | $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH, 'jpeg'); |
482 | 482 | } else { |
483 | - $x1 = $x+40; |
|
483 | + $x1 = $x + 40; |
|
484 | 484 | $y1 = $y; |
485 | 485 | $tw = $w; |
486 | 486 | } |
487 | 487 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
488 | 488 | $razao = $this->xNome; |
489 | - $cnpj = 'CNPJ: '.$this->pFormat($this->CNPJ, "###.###.###/####-##"); |
|
490 | - $ie = 'IE: '.$this->pFormat($this->IE, '###/#######'); |
|
491 | - $lgr = 'Logradouro: '.$this->xLgr; |
|
492 | - $nro = 'Nº: '.$this->nro; |
|
493 | - $bairro = 'Bairro: '.$this->xBairro; |
|
489 | + $cnpj = 'CNPJ: ' . $this->pFormat($this->CNPJ, "###.###.###/####-##"); |
|
490 | + $ie = 'IE: ' . $this->pFormat($this->IE, '###/#######'); |
|
491 | + $lgr = 'Logradouro: ' . $this->xLgr; |
|
492 | + $nro = 'Nº: ' . $this->nro; |
|
493 | + $bairro = 'Bairro: ' . $this->xBairro; |
|
494 | 494 | $CEP = $this->CEP; |
495 | - $CEP = 'CEP: '.$this->pFormat($CEP, "##.###-###"); |
|
496 | - $mun = 'Municipio: '.$this->xMun; |
|
497 | - $UF = 'UF: '.$this->UF; |
|
495 | + $CEP = 'CEP: ' . $this->pFormat($CEP, "##.###-###"); |
|
496 | + $mun = 'Municipio: ' . $this->xMun; |
|
497 | + $UF = 'UF: ' . $this->UF; |
|
498 | 498 | $texto = $razao . "\n" . $cnpj . ' - ' . $ie . "\n"; |
499 | 499 | $texto .= $lgr . ' - ' . $nro . "\n"; |
500 | 500 | $texto .= $bairro . "\n"; |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | $bH = 16; |
522 | 522 | $w = $maxW; |
523 | 523 | $this->pdf->SetFillColor(0, 0, 0); |
524 | - $this->pdf->Code128($x + 5, $y+2, $this->chMDFe, $maxW - 10, $bH); |
|
524 | + $this->pdf->Code128($x + 5, $y + 2, $this->chMDFe, $maxW - 10, $bH); |
|
525 | 525 | $this->pdf->SetFillColor(255, 255, 255); |
526 | 526 | $y = $y + 22; |
527 | 527 | $this->pTextBox($x, $y, $maxW, 10); |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | $this->pTextBox($x, $y, $maxW, 6, $texto, $aFont, 'T', 'L', 0, ''); |
532 | 532 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
533 | 533 | $texto = $this->pFormat($this->chMDFe, $this->formatoChave); |
534 | - $this->pTextBox($x, $y+4, $maxW, 6, $texto, $aFont, 'T', 'C', 0, ''); |
|
534 | + $this->pTextBox($x, $y + 4, $maxW, 6, $texto, $aFont, 'T', 'C', 0, ''); |
|
535 | 535 | $y = $y + 12; |
536 | 536 | $this->pTextBox($x, $y, $maxW, 10); |
537 | 537 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'I'); |
@@ -540,37 +540,37 @@ discard block |
||
540 | 540 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
541 | 541 | if (is_object($this->mdfeProc)) { |
542 | 542 | $tsHora = $this->pConvertTime($this->dhRecbto); |
543 | - $texto = $this->nProt.' - '.date('d/m/Y H:i:s', $tsHora); |
|
543 | + $texto = $this->nProt . ' - ' . date('d/m/Y H:i:s', $tsHora); |
|
544 | 544 | } else { |
545 | - $texto = 'DAMDFE impresso em contingência - '.date('d/m/Y H:i:s'); |
|
545 | + $texto = 'DAMDFE impresso em contingência - ' . date('d/m/Y H:i:s'); |
|
546 | 546 | } |
547 | - $this->pTextBox($x, $y+4, $maxW, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
547 | + $this->pTextBox($x, $y + 4, $maxW, 8, $texto, $aFont, 'T', 'C', 0, ''); |
|
548 | 548 | if ($this->tpAmb != 1) { |
549 | 549 | $x = 10; |
550 | 550 | if ($this->orientacao == 'P') { |
551 | - $yy = round($this->hPrint*2/3, 0); |
|
551 | + $yy = round($this->hPrint * 2 / 3, 0); |
|
552 | 552 | } else { |
553 | - $yy = round($this->hPrint/2, 0); |
|
553 | + $yy = round($this->hPrint / 2, 0); |
|
554 | 554 | } |
555 | 555 | $h = 5; |
556 | - $w = $maxW-(2*$x); |
|
556 | + $w = $maxW - (2 * $x); |
|
557 | 557 | $this->pdf->SetTextColor(90, 90, 90); |
558 | 558 | $texto = "SEM VALOR FISCAL"; |
559 | 559 | $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'); |
560 | 560 | $this->pTextBox($x, $yy, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
561 | 561 | $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B'); |
562 | 562 | $texto = "AMBIENTE DE HOMOLOGAÇÃO"; |
563 | - $this->pTextBox($x, $yy+14, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
563 | + $this->pTextBox($x, $yy + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
564 | 564 | $this->pdf->SetTextColor(0, 0, 0); |
565 | 565 | } else { |
566 | 566 | $x = 10; |
567 | 567 | if ($this->orientacao == 'P') { |
568 | - $yy = round($this->hPrint*2/3, 0); |
|
568 | + $yy = round($this->hPrint * 2 / 3, 0); |
|
569 | 569 | } else { |
570 | - $yy = round($this->hPrint/2, 0); |
|
570 | + $yy = round($this->hPrint / 2, 0); |
|
571 | 571 | }//fim orientacao |
572 | 572 | $h = 5; |
573 | - $w = $maxW-(2*$x); |
|
573 | + $w = $maxW - (2 * $x); |
|
574 | 574 | $this->pdf->SetTextColor(90, 90, 90); |
575 | 575 | //indicar FALTA DO PROTOCOLO se MDFe não for em contingência |
576 | 576 | if (($this->tpEmis == 2 || $this->tpEmis == 5)) { |
@@ -580,11 +580,11 @@ discard block |
||
580 | 580 | $this->pTextBox($x, $yy, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
581 | 581 | $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B'); |
582 | 582 | $texto = "devido à problemas técnicos"; |
583 | - $this->pTextBox($x, $yy+12, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
583 | + $this->pTextBox($x, $yy + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
584 | 584 | } |
585 | 585 | $this->pdf->SetTextColor(0, 0, 0); |
586 | 586 | } |
587 | - return $y+12; |
|
587 | + return $y + 12; |
|
588 | 588 | }// fim headerMDFe |
589 | 589 | |
590 | 590 | /** |
@@ -603,64 +603,64 @@ discard block |
||
603 | 603 | } |
604 | 604 | $x2 = ($maxW / 6); |
605 | 605 | $x1 = $x2; |
606 | - $this->pTextBox($x, $y, $x2-7, 12); |
|
606 | + $this->pTextBox($x, $y, $x2 - 7, 12); |
|
607 | 607 | $texto = 'Modelo'; |
608 | 608 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
609 | - $this->pTextBox($x, $y, $x2-7, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
609 | + $this->pTextBox($x, $y, $x2 - 7, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
610 | 610 | $texto = $this->mod; |
611 | 611 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
612 | - $this->pTextBox($x, $y+4, $x2-7, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
612 | + $this->pTextBox($x, $y + 4, $x2 - 7, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
613 | 613 | $x1 = $x2; |
614 | - $this->pTextBox($x1, $y, $x2-7, 12); |
|
614 | + $this->pTextBox($x1, $y, $x2 - 7, 12); |
|
615 | 615 | $texto = 'Série'; |
616 | 616 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
617 | - $this->pTextBox($x1, $y, $x2-7, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
617 | + $this->pTextBox($x1, $y, $x2 - 7, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
618 | 618 | $texto = $this->serie; |
619 | 619 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
620 | - $this->pTextBox($x1, $y+4, $x2-7, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
621 | - $x1 += $x2-7; |
|
622 | - $this->pTextBox($x1, $y, $x2+5, 12); |
|
620 | + $this->pTextBox($x1, $y + 4, $x2 - 7, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
621 | + $x1 += $x2 - 7; |
|
622 | + $this->pTextBox($x1, $y, $x2 + 5, 12); |
|
623 | 623 | $texto = 'Número'; |
624 | 624 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
625 | - $this->pTextBox($x1, $y, $x2+5, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
625 | + $this->pTextBox($x1, $y, $x2 + 5, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
626 | 626 | $texto = $this->pFormat(str_pad($this->nMDF, 9, '0', STR_PAD_LEFT), '###.###.###'); |
627 | 627 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
628 | - $this->pTextBox($x1, $y+4, $x2+5, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
629 | - $x1 += $x2+5; |
|
630 | - $this->pTextBox($x1, $y, $x2-7, 12); |
|
628 | + $this->pTextBox($x1, $y + 4, $x2 + 5, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
629 | + $x1 += $x2 + 5; |
|
630 | + $this->pTextBox($x1, $y, $x2 - 7, 12); |
|
631 | 631 | $texto = 'FL'; |
632 | 632 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
633 | - $this->pTextBox($x1, $y, $x2-7, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
633 | + $this->pTextBox($x1, $y, $x2 - 7, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
634 | 634 | $texto = '1'; |
635 | 635 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
636 | - $this->pTextBox($x1, $y+4, $x2-7, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
637 | - $x1 += $x2-7; |
|
638 | - $this->pTextBox($x1, $y, $x2+11, 12); |
|
636 | + $this->pTextBox($x1, $y + 4, $x2 - 7, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
637 | + $x1 += $x2 - 7; |
|
638 | + $this->pTextBox($x1, $y, $x2 + 11, 12); |
|
639 | 639 | $texto = 'Data e Hora de Emissão'; |
640 | 640 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
641 | - $this->pTextBox($x1, $y, $x2+11, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
641 | + $this->pTextBox($x1, $y, $x2 + 11, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
642 | 642 | $data = explode('T', $this->dhEmi); |
643 | - $texto = $this->pYmd2dmy($data[0]).' - '.$data[1]; |
|
643 | + $texto = $this->pYmd2dmy($data[0]) . ' - ' . $data[1]; |
|
644 | 644 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
645 | - $this->pTextBox($x1, $y+4, $x2+11, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
646 | - $x1 += $x2+11; |
|
647 | - $this->pTextBox($x1, $y, $x2-15, 12); |
|
645 | + $this->pTextBox($x1, $y + 4, $x2 + 11, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
646 | + $x1 += $x2 + 11; |
|
647 | + $this->pTextBox($x1, $y, $x2 - 15, 12); |
|
648 | 648 | $texto = 'UF Carreg.'; |
649 | 649 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
650 | - $this->pTextBox($x1, $y, $x2-15, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
650 | + $this->pTextBox($x1, $y, $x2 - 15, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
651 | 651 | $texto = $this->UFIni; |
652 | 652 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
653 | - $this->pTextBox($x1, $y+4, $x2-15, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
653 | + $this->pTextBox($x1, $y + 4, $x2 - 15, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
654 | 654 | $maxW = $this->wPrint; |
655 | 655 | |
656 | - $x1 += $x2-15; |
|
657 | - $this->pTextBox($x1, $y, $x2-13, 12); |
|
656 | + $x1 += $x2 - 15; |
|
657 | + $this->pTextBox($x1, $y, $x2 - 13, 12); |
|
658 | 658 | $texto = 'UF Descar.'; |
659 | 659 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
660 | - $this->pTextBox($x1, $y, $x2-13, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
660 | + $this->pTextBox($x1, $y, $x2 - 13, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
661 | 661 | $texto = $this->UFFim; |
662 | 662 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
663 | - $this->pTextBox($x1, $y+4, $x2-13, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
663 | + $this->pTextBox($x1, $y + 4, $x2 - 13, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
664 | 664 | $maxW = $this->wPrint; |
665 | 665 | |
666 | 666 | |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | $this->pTextBox($x1, $y, $x2, 23); |
672 | 672 | $texto = 'Modal Rodoviário de Carga'; |
673 | 673 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'); |
674 | - $this->pTextBox($x1, $y+1, $x2, 8, $texto, $aFont, 'T', 'C', 0, '', false); |
|
674 | + $this->pTextBox($x1, $y + 1, $x2, 8, $texto, $aFont, 'T', 'C', 0, '', false); |
|
675 | 675 | $x1 = $x; |
676 | 676 | $x2 = ($maxW / 6); |
677 | 677 | $y += 6; |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | $this->pTextBox($x1, $y, $x2, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
682 | 682 | $texto = str_pad($this->qCTe, 3, '0', STR_PAD_LEFT); |
683 | 683 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
684 | - $this->pTextBox($x1, $y+4, $x2, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
684 | + $this->pTextBox($x1, $y + 4, $x2, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
685 | 685 | $x1 += $x2; |
686 | 686 | $this->pTextBox($x1, $y, $x2, 12); |
687 | 687 | $texto = 'Qtd. NF-e'; |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | $this->pTextBox($x1, $y, $x2, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
690 | 690 | $texto = str_pad($this->qNFe, 3, '0', STR_PAD_LEFT); |
691 | 691 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
692 | - $this->pTextBox($x1, $y+4, $x2, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
692 | + $this->pTextBox($x1, $y + 4, $x2, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
693 | 693 | $x1 += $x2; |
694 | 694 | $this->pTextBox($x1, $y, $x2, 12); |
695 | 695 | $texto = 'Peso Total (Kg)'; |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | $this->pTextBox($x1, $y, $x2, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
698 | 698 | $texto = number_format($this->qCarga, 4, ', ', '.'); |
699 | 699 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
700 | - $this->pTextBox($x1, $y+4, $x2, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
700 | + $this->pTextBox($x1, $y + 4, $x2, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
701 | 701 | $x1 = $x; |
702 | 702 | $y += 12; |
703 | 703 | $yold = $y; |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | $this->pTextBox($x1, $y, $x2, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
715 | 715 | $texto = $this->veicTracao->getElementsByTagName("placa")->item(0)->nodeValue; |
716 | 716 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
717 | - $this->pTextBox($x1, $y+4, $x2, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
717 | + $this->pTextBox($x1, $y + 4, $x2, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
718 | 718 | $altura = $y + 4; |
719 | 719 | /** @var \DOMNodeList $veicReboque */ |
720 | 720 | $veicReboque = $this->veicReboque; |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | $texto = ""; |
737 | 737 | } |
738 | 738 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
739 | - $this->pTextBox($x1, $y+4, $x2, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
739 | + $this->pTextBox($x1, $y + 4, $x2, 10, $texto, $aFont, 'T', 'C', 0, '', false); |
|
740 | 740 | $altura = $y + 4; |
741 | 741 | /** @var \DOMNodeList $veicReboque */ |
742 | 742 | $veicReboque = $this->veicReboque; |
@@ -762,46 +762,46 @@ discard block |
||
762 | 762 | if (!$temVales) { |
763 | 763 | $valesPedagios = 0; |
764 | 764 | } |
765 | - $this->pTextBox($x1, $y, $x2, 11+$tamanho/2); |
|
765 | + $this->pTextBox($x1, $y, $x2, 11 + $tamanho / 2); |
|
766 | 766 | $texto = 'Vale Pedágio'; |
767 | 767 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
768 | 768 | $this->pTextBox($x1, $y, $x2, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
769 | 769 | $y += 5; |
770 | 770 | $x2 = ($x2 / 3); |
771 | - $this->pTextBox($x1, $y, $x2-3, 6+($tamanho/2)); |
|
771 | + $this->pTextBox($x1, $y, $x2 - 3, 6 + ($tamanho / 2)); |
|
772 | 772 | $texto = 'Responsável CNPJ'; |
773 | 773 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
774 | - $this->pTextBox($x1, $y, $x2-4, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
774 | + $this->pTextBox($x1, $y, $x2 - 4, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
775 | 775 | $altura = $y; |
776 | 776 | for ($i = 0; $i < $valesPedagios; $i++) { |
777 | 777 | $altura += 4; |
778 | 778 | $texto = $this->valePed->item($i)->getElementsByTagName('CNPJForn')->item(0)->nodeValue; |
779 | 779 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
780 | - $this->pTextBox($x1 + 1, $altura, $x2-5, 10, $texto, $aFont, 'T', 'L', 0, '', false); |
|
780 | + $this->pTextBox($x1 + 1, $altura, $x2 - 5, 10, $texto, $aFont, 'T', 'L', 0, '', false); |
|
781 | 781 | } |
782 | - $x1 += $x2-3; |
|
783 | - $this->pTextBox($x1, $y, $x2-3, 6+($tamanho/2)); |
|
782 | + $x1 += $x2 - 3; |
|
783 | + $this->pTextBox($x1, $y, $x2 - 3, 6 + ($tamanho / 2)); |
|
784 | 784 | $texto = 'Fornecedora CNPJ'; |
785 | 785 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
786 | - $this->pTextBox($x1, $y, $x2-4, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
786 | + $this->pTextBox($x1, $y, $x2 - 4, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
787 | 787 | $altura = $y; |
788 | 788 | for ($i = 0; $i < $valesPedagios; $i++) { |
789 | 789 | $altura += 4; |
790 | 790 | $texto = $this->valePed->item($i)->getElementsByTagName('CNPJPg')->item(0)->nodeValue; |
791 | 791 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
792 | - $this->pTextBox($x1 + 1, $altura, $x2-5, 10, $texto, $aFont, 'T', 'L', 0, '', false); |
|
792 | + $this->pTextBox($x1 + 1, $altura, $x2 - 5, 10, $texto, $aFont, 'T', 'L', 0, '', false); |
|
793 | 793 | } |
794 | - $x1 += $x2-3; |
|
795 | - $this->pTextBox($x1, $y, $x2+6, 6+($tamanho/2)); |
|
794 | + $x1 += $x2 - 3; |
|
795 | + $this->pTextBox($x1, $y, $x2 + 6, 6 + ($tamanho / 2)); |
|
796 | 796 | $texto = 'Nº Comprovante'; |
797 | 797 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
798 | - $this->pTextBox($x1, $y, $x2+6, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
798 | + $this->pTextBox($x1, $y, $x2 + 6, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
|
799 | 799 | $altura = $y; |
800 | 800 | for ($i = 0; $i < $valesPedagios; $i++) { |
801 | 801 | $altura += 4; |
802 | 802 | $texto = $this->valePed->item($i)->getElementsByTagName('nCompra')->item(0)->nodeValue; |
803 | 803 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>''); |
804 | - $this->pTextBox($x1 + 1, $altura, $x2+5, 10, $texto, $aFont, 'T', 'L', 0, '', false); |
|
804 | + $this->pTextBox($x1 + 1, $altura, $x2 + 5, 10, $texto, $aFont, 'T', 'L', 0, '', false); |
|
805 | 805 | } |
806 | 806 | if (!$temVales) { |
807 | 807 | $altura += 4; |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | $this->pTextBox($x1, $y, $x2, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
816 | 816 | $y += 5; |
817 | 817 | $x2 = ($maxW / 4); |
818 | - $this->pTextBox($x1, $y, $x2, 33+($tamanho/2)); |
|
818 | + $this->pTextBox($x1, $y, $x2, 33 + ($tamanho / 2)); |
|
819 | 819 | $texto = 'CPF'; |
820 | 820 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
821 | 821 | $this->pTextBox($x1, $y, $x2, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | } |
829 | 829 | $y = $yold; |
830 | 830 | $x1 += $x2; |
831 | - $this->pTextBox($x1, $y, $x2, 33+($tamanho/2)); |
|
831 | + $this->pTextBox($x1, $y, $x2, 33 + ($tamanho / 2)); |
|
832 | 832 | $texto = 'Nome'; |
833 | 833 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
834 | 834 | $this->pTextBox($x1, $y, $x2, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
@@ -855,9 +855,9 @@ discard block |
||
855 | 855 | '.$this->infCpl; |
856 | 856 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
857 | 857 | $this->pTextBox($x, $y, $x2, 8, $texto, $aFont, 'T', 'L', 0, '', false); |
858 | - $y = $this->hPrint -4; |
|
859 | - $texto = "Impresso em ". date('d/m/Y H:i:s'); |
|
860 | - $w = $this->wPrint-4; |
|
858 | + $y = $this->hPrint - 4; |
|
859 | + $texto = "Impresso em " . date('d/m/Y H:i:s'); |
|
860 | + $w = $this->wPrint - 4; |
|
861 | 861 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'); |
862 | 862 | $this->pTextBox($x, $y, $w, 4, $texto, $aFont, 'T', 'L', 0, ''); |
863 | 863 | }//fim footerCCe |
@@ -874,9 +874,9 @@ discard block |
||
874 | 874 | //monta |
875 | 875 | $command = ''; |
876 | 876 | if ($nome == '') { |
877 | - $file = $this->pdfDir.'mdfe.pdf'; |
|
877 | + $file = $this->pdfDir . 'mdfe.pdf'; |
|
878 | 878 | } else { |
879 | - $file = $this->pdfDir.$nome; |
|
879 | + $file = $this->pdfDir . $nome; |
|
880 | 880 | } |
881 | 881 | if (($destino != 'I' || $destino != 'S') && $destino != 'F') { |
882 | 882 | $destino = 'I'; |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @param string $docXML |
57 | 57 | * @param string $sPathLogo |
58 | - * @param string $mododebug |
|
58 | + * @param integer $mododebug |
|
59 | 59 | * @param string $idToken |
60 | - * @param string $Token |
|
60 | + * @param string $emitToken |
|
61 | 61 | */ |
62 | 62 | public function __construct( |
63 | 63 | $docXML = '', |
@@ -718,6 +718,9 @@ discard block |
||
718 | 718 | return $hex; |
719 | 719 | }//fim str2Hex |
720 | 720 | |
721 | + /** |
|
722 | + * @param string $tBand |
|
723 | + */ |
|
721 | 724 | protected static function getCardName($tBand) |
722 | 725 | { |
723 | 726 | switch ($tBand) { |
@@ -739,6 +742,9 @@ discard block |
||
739 | 742 | return $tBandNome; |
740 | 743 | } |
741 | 744 | |
745 | + /** |
|
746 | + * @param string $tPag |
|
747 | + */ |
|
742 | 748 | protected function tipoPag($tPag) |
743 | 749 | { |
744 | 750 | switch ($tPag) { |
@@ -14,11 +14,9 @@ |
||
14 | 14 | * @author Roberto Spadim <roberto at spadim dot com dot br> |
15 | 15 | */ |
16 | 16 | |
17 | -use Exception; |
|
18 | 17 | use NFePHP\DA\Legacy\Dom; |
19 | 18 | use NFePHP\DA\Legacy\Pdf; |
20 | 19 | use NFePHP\DA\Legacy\Common; |
21 | -use Endroid\QrCode\QrCode; |
|
22 | 20 | use DateTime; |
23 | 21 | |
24 | 22 | class Danfce extends Common |
@@ -223,8 +223,8 @@ |
||
223 | 223 | //retorna o ID na NFe |
224 | 224 | if ($classPdf!==false) { |
225 | 225 | $aR = [ |
226 | - 'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")), |
|
227 | - 'classe_PDF'=>$this->pdf |
|
226 | + 'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")), |
|
227 | + 'classe_PDF'=>$this->pdf |
|
228 | 228 | ]; |
229 | 229 | return $aR; |
230 | 230 | } else { |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | { |
26 | 26 | protected $papel; |
27 | 27 | protected $xml; // string XML NFe |
28 | - protected $logomarca=''; // path para logomarca em jpg |
|
29 | - protected $formatoChave="#### #### #### #### #### #### #### #### #### #### ####"; |
|
30 | - protected $debugMode=0; //ativa ou desativa o modo de debug |
|
28 | + protected $logomarca = ''; // path para logomarca em jpg |
|
29 | + protected $formatoChave = "#### #### #### #### #### #### #### #### #### #### ####"; |
|
30 | + protected $debugMode = 0; //ativa ou desativa o modo de debug |
|
31 | 31 | protected $tpImp; //ambiente |
32 | - protected $fontePadrao='Times'; |
|
32 | + protected $fontePadrao = 'Times'; |
|
33 | 33 | protected $nfeProc; |
34 | 34 | protected $nfe; |
35 | 35 | protected $infNFe; |
@@ -132,13 +132,13 @@ discard block |
||
132 | 132 | $hMaxLinha = $this->hMaxLinha; |
133 | 133 | $hBoxLinha = $this->hBoxLinha; |
134 | 134 | $hLinha = $this->hLinha; |
135 | - $tamPapelVert = 160 +16+ (($qtdItens-1)*$hMaxLinha) + ($qtdPgto*$hLinha); |
|
135 | + $tamPapelVert = 160 + 16 + (($qtdItens - 1) * $hMaxLinha) + ($qtdPgto * $hLinha); |
|
136 | 136 | //se a orientação estiver em branco utilizar o padrão estabelecido na NF |
137 | 137 | if ($orientacao == '') { |
138 | 138 | $orientacao = 'P'; |
139 | 139 | } |
140 | 140 | $this->orientacao = $orientacao; |
141 | - $this->papel = array(80,$tamPapelVert); |
|
141 | + $this->papel = array(80, $tamPapelVert); |
|
142 | 142 | $this->logoAlign = $logoAlign; |
143 | 143 | $this->situacao_externa = $situacaoExterna; |
144 | 144 | $this->numero_registro_dpec = $depecNumReg; |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | //total inicial de paginas |
163 | 163 | $totPag = 1; |
164 | 164 | //largura imprimivel em mm: largura da folha menos as margens esq/direita |
165 | - $this->wPrint = $maxW-($margEsq*2); |
|
165 | + $this->wPrint = $maxW - ($margEsq * 2); |
|
166 | 166 | //comprimento (altura) imprimivel em mm: altura da folha menos as margens |
167 | 167 | //superior e inferior |
168 | - $this->hPrint = $maxH-$margSup-$margInf; |
|
168 | + $this->hPrint = $maxH - $margSup - $margInf; |
|
169 | 169 | // estabelece contagem de paginas |
170 | 170 | $this->pdf->aliasNbPages(); |
171 | 171 | $this->pdf->setMargins($margEsq, $margSup); // fixa as margens |
@@ -176,22 +176,22 @@ discard block |
||
176 | 176 | $this->pdf->setLineWidth(0.1); // define a largura da linha |
177 | 177 | $this->pdf->setTextColor(0, 0, 0); |
178 | 178 | $this->pTextBox(0, 0, $maxW, $maxH); // POR QUE PRECISO DESA LINHA? |
179 | - $hcabecalho = 27;//para cabeçalho (dados emitente mais logomarca) (FIXO) |
|
180 | - $hcabecalhoSecundario = 10;//para cabeçalho secundário (cabeçalho sefaz) (FIXO) |
|
181 | - $hprodutos = $hLinha + ($qtdItens*$hMaxLinha) ;//box poduto |
|
179 | + $hcabecalho = 27; //para cabeçalho (dados emitente mais logomarca) (FIXO) |
|
180 | + $hcabecalhoSecundario = 10; //para cabeçalho secundário (cabeçalho sefaz) (FIXO) |
|
181 | + $hprodutos = $hLinha + ($qtdItens * $hMaxLinha); //box poduto |
|
182 | 182 | $hTotal = 12; //box total (FIXO) |
183 | - $hpagamentos = $hLinha + ($qtdPgto*$hLinha);//para pagamentos |
|
184 | - $hmsgfiscal = 21;// para imposto (FIXO) |
|
183 | + $hpagamentos = $hLinha + ($qtdPgto * $hLinha); //para pagamentos |
|
184 | + $hmsgfiscal = 21; // para imposto (FIXO) |
|
185 | 185 | if (!isset($this->dest)) { |
186 | - $hcliente = 6;// para cliente (FIXO) |
|
186 | + $hcliente = 6; // para cliente (FIXO) |
|
187 | 187 | } else { |
188 | 188 | $hcliente = 12; |
189 | 189 | }// para cliente (FIXO)}; |
190 | - $hQRCode = 50;// para qrcode (FIXO) |
|
191 | - $hCabecItens = 4;//cabeçalho dos itens |
|
190 | + $hQRCode = 50; // para qrcode (FIXO) |
|
191 | + $hCabecItens = 4; //cabeçalho dos itens |
|
192 | 192 | |
193 | 193 | $hUsado = $hCabecItens; |
194 | - $w2 = round($this->wPrint*0.31, 0); |
|
194 | + $w2 = round($this->wPrint * 0.31, 0); |
|
195 | 195 | $totPag = 1; |
196 | 196 | $pag = 1; |
197 | 197 | $x = $xInic; |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal; |
212 | 212 | $y = $this->pPagamentosDANFE($x, $y, $hpagamentos); |
213 | 213 | //COLOCA MENSAGEM FISCAL |
214 | - $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal+ $hpagamentos; |
|
214 | + $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos; |
|
215 | 215 | $y = $this->pFiscalDANFE($x, $y, $hmsgfiscal); |
216 | 216 | //COLOCA CONSUMIDOR |
217 | 217 | $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos + $hmsgfiscal; |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | + $hTotal + $hpagamentos + $hmsgfiscal + $hcliente; |
222 | 222 | $y = $this->pQRDANFE($x, $y, $hQRCode); |
223 | 223 | //retorna o ID na NFe |
224 | - if ($classPdf!==false) { |
|
224 | + if ($classPdf !== false) { |
|
225 | 225 | $aR = [ |
226 | 226 | 'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")), |
227 | 227 | 'classe_PDF'=>$this->pdf |
@@ -241,13 +241,13 @@ discard block |
||
241 | 241 | $emitIM = $this->pSimpleGetValue($this->emit, "IM"); |
242 | 242 | $emitFone = $this->pSimpleGetValue($this->enderEmit, "fone"); |
243 | 243 | $foneLen = strlen($emitFone); |
244 | - if ($foneLen>0) { |
|
244 | + if ($foneLen > 0) { |
|
245 | 245 | $ddd = substr($emitFone, 0, 2); |
246 | 246 | $fone1 = substr($emitFone, -8); |
247 | 247 | if ($foneLen == 11) { |
248 | 248 | $digito9 = substr($emitFone, 2, 1); |
249 | 249 | } |
250 | - $emitFone = ' - ('.$ddd.') '.$digito9. ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4); |
|
250 | + $emitFone = ' - (' . $ddd . ') ' . $digito9 . ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4); |
|
251 | 251 | } else { |
252 | 252 | $emitFone = ''; |
253 | 253 | } |
@@ -261,18 +261,18 @@ discard block |
||
261 | 261 | // CONFIGURAÇÃO DE POSIÇÃO |
262 | 262 | $margemInterna = $this->margemInterna; |
263 | 263 | $maxW = $this->wPrint; |
264 | - $h = $h-($margemInterna); |
|
264 | + $h = $h - ($margemInterna); |
|
265 | 265 | //COLOCA LOGOMARCA |
266 | 266 | if (is_file($this->logomarca)) { |
267 | 267 | $xImg = $margemInterna; |
268 | 268 | $yImg = $margemInterna + 1; |
269 | 269 | $this->pdf->Image($this->logomarca, $xImg, $yImg, 30, 22.5); |
270 | - $xRs = ($maxW*0.4) + $margemInterna; |
|
271 | - $wRs = ($maxW*0.6); |
|
270 | + $xRs = ($maxW * 0.4) + $margemInterna; |
|
271 | + $wRs = ($maxW * 0.6); |
|
272 | 272 | $alignEmit = 'L'; |
273 | 273 | } else { |
274 | 274 | $xRs = $margemInterna; |
275 | - $wRs = ($maxW*1); |
|
275 | + $wRs = ($maxW * 1); |
|
276 | 276 | $alignEmit = 'L'; |
277 | 277 | } |
278 | 278 | //COLOCA RAZÃO SOCIAL |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | { |
292 | 292 | $margemInterna = $this->margemInterna; |
293 | 293 | $maxW = $this->wPrint; |
294 | - $w = ($maxW*1); |
|
294 | + $w = ($maxW * 1); |
|
295 | 295 | $hBox1 = 7; |
296 | 296 | $texto = "DANFE NFC-e\nDocumento Auxiliar da Nota Fiscal de Consumidor Eletrônica"; |
297 | 297 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'); |
@@ -308,13 +308,13 @@ discard block |
||
308 | 308 | $margemInterna = $this->margemInterna; |
309 | 309 | $maxW = $this->wPrint; |
310 | 310 | $qtdItens = $this->det->length; |
311 | - $w = ($maxW*1); |
|
311 | + $w = ($maxW * 1); |
|
312 | 312 | $hLinha = $this->hLinha; |
313 | 313 | $aFontCabProdutos = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'); |
314 | - $wBoxCod = $w*0.17; |
|
314 | + $wBoxCod = $w * 0.17; |
|
315 | 315 | $texto = "CÓDIGO"; |
316 | 316 | $this->pTextBox($x, $y, $wBoxCod, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false); |
317 | - $wBoxDescricao = $w*0.43; |
|
317 | + $wBoxDescricao = $w * 0.43; |
|
318 | 318 | $xBoxDescricao = $wBoxCod + $x; |
319 | 319 | $texto = "DESCRICÃO"; |
320 | 320 | $this->pTextBox( |
@@ -330,19 +330,19 @@ discard block |
||
330 | 330 | '', |
331 | 331 | false |
332 | 332 | ); |
333 | - $wBoxQt = $w*0.08; |
|
333 | + $wBoxQt = $w * 0.08; |
|
334 | 334 | $xBoxQt = $wBoxDescricao + $xBoxDescricao; |
335 | 335 | $texto = "QT"; |
336 | 336 | $this->pTextBox($xBoxQt, $y, $wBoxQt, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false); |
337 | - $wBoxUn = $w*0.06; |
|
337 | + $wBoxUn = $w * 0.06; |
|
338 | 338 | $xBoxUn = $wBoxQt + $xBoxQt; |
339 | 339 | $texto = "UN"; |
340 | 340 | $this->pTextBox($xBoxUn, $y, $wBoxUn, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false); |
341 | - $wBoxVl = $w*0.13; |
|
341 | + $wBoxVl = $w * 0.13; |
|
342 | 342 | $xBoxVl = $wBoxUn + $xBoxUn; |
343 | 343 | $texto = "VALOR"; |
344 | 344 | $this->pTextBox($xBoxVl, $y, $wBoxVl, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false); |
345 | - $wBoxTotal = $w*0.13; |
|
345 | + $wBoxTotal = $w * 0.13; |
|
346 | 346 | $xBoxTotal = $wBoxVl + $xBoxVl; |
347 | 347 | $texto = "TOTAL"; |
348 | 348 | $this->pTextBox($xBoxTotal, $y, $wBoxTotal, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false); |
@@ -362,13 +362,13 @@ discard block |
||
362 | 362 | $vUnCom = number_format($this->pSimpleGetValue($prod, "vUnCom"), 2, ",", "."); |
363 | 363 | $vProd = number_format($this->pSimpleGetValue($prod, "vProd"), 2, ",", "."); |
364 | 364 | //COLOCA PRODUTO |
365 | - $yBoxProd = $y + $hLinha + ($cont*$hMaxLinha); |
|
365 | + $yBoxProd = $y + $hLinha + ($cont * $hMaxLinha); |
|
366 | 366 | //COLOCA PRODUTO CÓDIGO |
367 | - $wBoxCod = $w*0.17; |
|
367 | + $wBoxCod = $w * 0.17; |
|
368 | 368 | $texto = $cProd; |
369 | 369 | $this->pTextBox($x, $yBoxProd, $wBoxCod, $hMaxLinha, $texto, $aFontProdutos, 'C', 'C', 0, '', false); |
370 | 370 | //COLOCA PRODUTO DESCRIÇÃO |
371 | - $wBoxDescricao = $w*0.43; |
|
371 | + $wBoxDescricao = $w * 0.43; |
|
372 | 372 | $xBoxDescricao = $wBoxCod + $x; |
373 | 373 | $texto = $xProd; |
374 | 374 | $this->pTextBox( |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | false |
386 | 386 | ); |
387 | 387 | //COLOCA PRODUTO QUANTIDADE |
388 | - $wBoxQt = $w*0.08; |
|
388 | + $wBoxQt = $w * 0.08; |
|
389 | 389 | $xBoxQt = $wBoxDescricao + $xBoxDescricao; |
390 | 390 | $texto = $qCom; |
391 | 391 | $this->pTextBox( |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | false |
403 | 403 | ); |
404 | 404 | //COLOCA PRODUTO UNIDADE |
405 | - $wBoxUn = $w*0.06; |
|
405 | + $wBoxUn = $w * 0.06; |
|
406 | 406 | $xBoxUn = $wBoxQt + $xBoxQt; |
407 | 407 | $texto = $uCom; |
408 | 408 | $this->pTextBox( |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | false |
420 | 420 | ); |
421 | 421 | //COLOCA PRODUTO VL UNITÁRIO |
422 | - $wBoxVl = $w*0.13; |
|
422 | + $wBoxVl = $w * 0.13; |
|
423 | 423 | $xBoxVl = $wBoxUn + $xBoxUn; |
424 | 424 | $texto = $vUnCom; |
425 | 425 | $this->pTextBox( |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | false |
437 | 437 | ); |
438 | 438 | //COLOCA PRODUTO VL TOTAL |
439 | - $wBoxTotal = $w*0.13; |
|
439 | + $wBoxTotal = $w * 0.13; |
|
440 | 440 | $xBoxTotal = $wBoxVl + $xBoxVl; |
441 | 441 | $texto = $vProd; |
442 | 442 | $this->pTextBox( |
@@ -463,13 +463,13 @@ discard block |
||
463 | 463 | $margemInterna = $this->margemInterna; |
464 | 464 | $maxW = $this->wPrint; |
465 | 465 | $hLinha = 3; |
466 | - $wColEsq = ($maxW*0.7); |
|
467 | - $wColDir = ($maxW*0.3); |
|
466 | + $wColEsq = ($maxW * 0.7); |
|
467 | + $wColDir = ($maxW * 0.3); |
|
468 | 468 | $xValor = $x + $wColEsq; |
469 | 469 | $qtdItens = $this->det->length; |
470 | 470 | $vProd = $this->pSimpleGetValue($this->ICMSTot, "vProd"); |
471 | 471 | $vNF = $this->pSimpleGetValue($this->ICMSTot, "vNF"); |
472 | - $vDesc = $this->pSimpleGetValue($this->ICMSTot, "vDesc"); |
|
472 | + $vDesc = $this->pSimpleGetValue($this->ICMSTot, "vDesc"); |
|
473 | 473 | $texto = "Qtd. Total de Itens"; |
474 | 474 | $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'); |
475 | 475 | $this->pTextBox($x, $y, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false); |
@@ -483,21 +483,21 @@ discard block |
||
483 | 483 | $texto = "R$ " . number_format($vProd, 2, ",", "."); |
484 | 484 | $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'); |
485 | 485 | $this->pTextBox($xValor, $yTotal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false); |
486 | - $yDesconto = $y + ($hLinha*2); |
|
486 | + $yDesconto = $y + ($hLinha * 2); |
|
487 | 487 | $texto = "Descontos"; |
488 | 488 | $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'); |
489 | 489 | $this->pTextBox($x, $yDesconto, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false); |
490 | 490 | $texto = "R$ " . $vDesc; |
491 | 491 | $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'); |
492 | 492 | $this->pTextBox($xValor, $yDesconto, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false); |
493 | - $yTotalFinal = $y + ($hLinha*3); |
|
493 | + $yTotalFinal = $y + ($hLinha * 3); |
|
494 | 494 | $texto = "Total"; |
495 | 495 | $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'); |
496 | 496 | $this->pTextBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false); |
497 | 497 | $texto = "R$ " . $vNF; |
498 | 498 | $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'); |
499 | 499 | $this->pTextBox($xValor, $yTotalFinal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false); |
500 | - $yTotalFinal = $y + ($hLinha*4); |
|
500 | + $yTotalFinal = $y + ($hLinha * 4); |
|
501 | 501 | $texto = "Informação dos Tributos Totais Incidentes"; |
502 | 502 | $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>''); |
503 | 503 | $this->pTextBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false); |
@@ -512,16 +512,16 @@ discard block |
||
512 | 512 | $margemInterna = $this->margemInterna; |
513 | 513 | $maxW = $this->wPrint; |
514 | 514 | $qtdPgto = $this->pag->length; |
515 | - $w = ($maxW*1); |
|
515 | + $w = ($maxW * 1); |
|
516 | 516 | $hLinha = $this->hLinha; |
517 | - $wColEsq = ($maxW*0.7); |
|
518 | - $wColDir = ($maxW*0.3); |
|
517 | + $wColEsq = ($maxW * 0.7); |
|
518 | + $wColDir = ($maxW * 0.3); |
|
519 | 519 | $xValor = $x + $wColEsq; |
520 | 520 | $aFontPgto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'); |
521 | - $wBoxEsq = $w*0.7; |
|
521 | + $wBoxEsq = $w * 0.7; |
|
522 | 522 | $texto = "FORMA DE PAGAMENTO"; |
523 | 523 | $this->pTextBox($x, $y, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false); |
524 | - $wBoxDir = $w*0.3; |
|
524 | + $wBoxDir = $w * 0.3; |
|
525 | 525 | $xBoxDescricao = $x + $wBoxEsq; |
526 | 526 | $texto = "VALOR PAGO"; |
527 | 527 | $this->pTextBox($xBoxDescricao, $y, $wBoxDir, $hLinha, $texto, $aFontPgto, 'T', 'R', 0, '', false); |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | $tBandNome = self::getCardName($tBand); |
544 | 544 | } |
545 | 545 | //COLOCA PRODUTO |
546 | - $yBoxProd = $y + $hLinha + ($cont*$hLinha); |
|
546 | + $yBoxProd = $y + $hLinha + ($cont * $hLinha); |
|
547 | 547 | //COLOCA PRODUTO CÓDIGO |
548 | 548 | $texto = $tPagNome; |
549 | 549 | $this->pTextBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false); |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | $y += 4; |
574 | 574 | $margemInterna = $this->margemInterna; |
575 | 575 | $maxW = $this->wPrint; |
576 | - $w = ($maxW*1); |
|
576 | + $w = ($maxW * 1); |
|
577 | 577 | $hLinha = $this->hLinha; |
578 | 578 | $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'); |
579 | 579 | $aFontTex = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
@@ -587,18 +587,18 @@ discard block |
||
587 | 587 | $urlChave = $this->urlConsulta[$tpAmb][$cUF]['chave']; |
588 | 588 | $texto = "ÁREA DE MENSAGEM FISCAL"; |
589 | 589 | $this->pTextBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false); |
590 | - $yTex1 = $y + ($hLinha*1); |
|
591 | - $hTex1 = $hLinha*2; |
|
592 | - $texto = "Número " . $nNF . " Série " . $serieNF . " " .$dhEmi . " - Via Consumidor"; |
|
590 | + $yTex1 = $y + ($hLinha * 1); |
|
591 | + $hTex1 = $hLinha * 2; |
|
592 | + $texto = "Número " . $nNF . " Série " . $serieNF . " " . $dhEmi . " - Via Consumidor"; |
|
593 | 593 | $this->pTextBox($x, $yTex1, $w, $hTex1, $texto, $aFontTex, 'C', 'C', 0, '', false); |
594 | - $yTex2 = $y + ($hLinha*3); |
|
595 | - $hTex2 = $hLinha*2; |
|
594 | + $yTex2 = $y + ($hLinha * 3); |
|
595 | + $hTex2 = $hLinha * 2; |
|
596 | 596 | $texto = "Consulte pela Chave de Acesso em " . $urlChave; |
597 | 597 | $this->pTextBox($x, $yTex2, $w, $hTex2, $texto, $aFontTex, 'C', 'C', 0, '', false); |
598 | 598 | $texto = "CHAVE DE ACESSO"; |
599 | - $yTit2 = $y + ($hLinha*5); |
|
599 | + $yTit2 = $y + ($hLinha * 5); |
|
600 | 600 | $this->pTextBox($x, $yTit2, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false); |
601 | - $yTex3 = $y + ($hLinha*6); |
|
601 | + $yTex3 = $y + ($hLinha * 6); |
|
602 | 602 | $texto = $chNFe; |
603 | 603 | $this->pTextBox($x, $yTex3, $w, $hLinha, $texto, $aFontTex, 'C', 'C', 0, '', false); |
604 | 604 | } |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | $y += 4; |
609 | 609 | $margemInterna = $this->margemInterna; |
610 | 610 | $maxW = $this->wPrint; |
611 | - $w = ($maxW*1); |
|
611 | + $w = ($maxW * 1); |
|
612 | 612 | $hLinha = $this->hLinha; |
613 | 613 | $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'); |
614 | 614 | $aFontTex = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | $consCNPJ = !empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue) |
625 | 625 | ? $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue |
626 | 626 | : ''; |
627 | - $cDest = $consCPF.$consCNPJ.$considEstrangeiro; //documentos do consumidor |
|
627 | + $cDest = $consCPF . $consCNPJ . $considEstrangeiro; //documentos do consumidor |
|
628 | 628 | $enderDest = $this->dest->getElementsByTagName("enderDest")->item(0); |
629 | 629 | $consNome = $this->pSimpleGetValue($this->dest, "xNome"); |
630 | 630 | $consLgr = $this->pSimpleGetValue($enderDest, "xLgr"); |
@@ -664,8 +664,8 @@ discard block |
||
664 | 664 | $yTex1 = $y + $hLinha; |
665 | 665 | $texto = $consNome; |
666 | 666 | if (!empty($consDoc)) { |
667 | - $texto .= " - ". $consDoc . "\n" . $consEnd; |
|
668 | - $this->pTextBox($x, $yTex1, $w, $hLinha*3, $texto, $aFontTex, 'C', 'C', 0, '', false); |
|
667 | + $texto .= " - " . $consDoc . "\n" . $consEnd; |
|
668 | + $this->pTextBox($x, $yTex1, $w, $hLinha * 3, $texto, $aFontTex, 'C', 'C', 0, '', false); |
|
669 | 669 | } |
670 | 670 | } else { |
671 | 671 | $yTex1 = $y + $hLinha; |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | $y += 4; |
680 | 680 | $margemInterna = $this->margemInterna; |
681 | 681 | $maxW = $this->wPrint; |
682 | - $w = ($maxW*1); |
|
682 | + $w = ($maxW * 1); |
|
683 | 683 | $hLinha = $this->hLinha; |
684 | 684 | $hBoxLinha = $this->hBoxLinha; |
685 | 685 | $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'); |
@@ -688,19 +688,19 @@ discard block |
||
688 | 688 | $nProt = ''; |
689 | 689 | if (isset($this->nfeProc)) { |
690 | 690 | $nProt = $this->pSimpleGetValue($this->nfeProc, "nProt"); |
691 | - $dhRecbto = $this->pSimpleGetValue($this->nfeProc, "dhRecbto"); |
|
691 | + $dhRecbto = $this->pSimpleGetValue($this->nfeProc, "dhRecbto"); |
|
692 | 692 | } |
693 | 693 | $qrcode = new QRcode($this->qrCode, 'M'); |
694 | 694 | $wQr = 50; |
695 | 695 | $hQr = 50; |
696 | - $yQr = ($y+$margemInterna); |
|
697 | - $xQr = ($w/2) - ($wQr/2); |
|
696 | + $yQr = ($y + $margemInterna); |
|
697 | + $xQr = ($w / 2) - ($wQr / 2); |
|
698 | 698 | // prepare a base64 encoded "data url" |
699 | 699 | $pic = 'data://text/plain;base64,' . base64_encode($qrcode->writeString()); |
700 | 700 | $info = getimagesize($pic); |
701 | 701 | $this->pdf->image($pic, $xQr, $yQr, $wQr, $hQr, 'PNG'); |
702 | 702 | $dt = new DateTime($dhRecbto); |
703 | - $yQr = ($yQr+$hQr+$margemInterna); |
|
703 | + $yQr = ($yQr + $hQr + $margemInterna); |
|
704 | 704 | $this->pTextBox($x, $yQr, $w, $hBoxLinha, "Protocolo de Autorização: " . $nProt . "\n" |
705 | 705 | . $dt->format('d/m/Y H:i:s'), $aFontTex, 'C', 'C', 0, '', false); |
706 | 706 | } |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | $bin = ""; |
825 | 825 | $iCount = 0; |
826 | 826 | do { |
827 | - $bin .= chr(hexdec($str{$iCount}.$str{($iCount + 1)})); |
|
827 | + $bin .= chr(hexdec($str{$iCount} . $str{($iCount + 1)})); |
|
828 | 828 | $iCount += 2; |
829 | 829 | } while ($iCount < strlen($str)); |
830 | 830 | return $bin; |
@@ -858,12 +858,12 @@ discard block |
||
858 | 858 | $seq .= '&digVal=' . strtolower($digHex); |
859 | 859 | $seq .= '&cIdToken=' . $idToken; |
860 | 860 | //o hash code é calculado com o Token incluso |
861 | - $hash = sha1($seq.$token); |
|
862 | - $seq .= '&cHashQRCode='. strtoupper($hash); |
|
861 | + $hash = sha1($seq . $token); |
|
862 | + $seq .= '&cHashQRCode=' . strtoupper($hash); |
|
863 | 863 | if (strpos($url, '?') === false) { |
864 | - $seq = $url.'?'.$seq; |
|
864 | + $seq = $url . '?' . $seq; |
|
865 | 865 | } else { |
866 | - $seq = $url.''.$seq; |
|
866 | + $seq = $url . '' . $seq; |
|
867 | 867 | } |
868 | 868 | return $seq; |
869 | 869 | } |
@@ -74,7 +74,7 @@ |
||
74 | 74 | * a mesma deverá já ter sido pré definida inclusive seu |
75 | 75 | * conector |
76 | 76 | * |
77 | - * @param PrinterInterface $this->printer |
|
77 | + * @param PrinterInterface $printer |
|
78 | 78 | */ |
79 | 79 | public function __construct(PrinterInterface $printer) |
80 | 80 | { |
@@ -53,20 +53,20 @@ |
||
53 | 53 | protected $uri = ''; |
54 | 54 | |
55 | 55 | protected $aURI = [ |
56 | - 'AC' => 'http://sefaznet.ac.gov.br/nfce/consulta.xhtml', |
|
57 | - 'AM' => 'http://sistemas.sefaz.am.gov.br/nfceweb/formConsulta.do', |
|
58 | - 'BA' => 'http://nfe.sefaz.ba.gov.br/servicos/nfce/Modulos/Geral/NFCEC_consulta_chave_acesso.aspx', |
|
59 | - 'MT' => 'https://www.sefaz.mt.gov.br/nfce/consultanfce', |
|
60 | - 'MA' => 'http://www.nfce.sefaz.ma.gov.br/portal/consultaNFe.do?method=preFilterCupom&', |
|
61 | - 'PA' => 'https://appnfc.sefa.pa.gov.br/portal/view/consultas/nfce/consultanfce.seam', |
|
62 | - 'PB' => 'https://www.receita.pb.gov.br/ser/servirtual/documentos-fiscais/nfc-e/consultar-nfc-e', |
|
63 | - 'PR' => 'http://www.sped.fazenda.pr.gov.br/modules/conteudo/conteudo.php?conteudo=100', |
|
64 | - 'RJ' => 'http://www4.fazenda.rj.gov.br/consultaDFe/paginas/consultaChaveAcesso.faces', |
|
65 | - 'RS' => 'https://www.sefaz.rs.gov.br/NFE/NFE-COM.aspx', |
|
66 | - 'RO' => 'http://www.nfce.sefin.ro.gov.br/home.jsp', |
|
67 | - 'RR' => 'https://www.sefaz.rr.gov.br/nfce/servlet/wp_consulta_nfce', |
|
68 | - 'SE' => 'http://www.nfce.se.gov.br/portal/portalNoticias.jsp?jsp=barra-menu/servicos/consultaDANFENFCe.htm', |
|
69 | - 'SP' => 'https://www.nfce.fazenda.sp.gov.br/NFCeConsultaPublica/Paginas/ConsultaPublica.aspx' |
|
56 | + 'AC' => 'http://sefaznet.ac.gov.br/nfce/consulta.xhtml', |
|
57 | + 'AM' => 'http://sistemas.sefaz.am.gov.br/nfceweb/formConsulta.do', |
|
58 | + 'BA' => 'http://nfe.sefaz.ba.gov.br/servicos/nfce/Modulos/Geral/NFCEC_consulta_chave_acesso.aspx', |
|
59 | + 'MT' => 'https://www.sefaz.mt.gov.br/nfce/consultanfce', |
|
60 | + 'MA' => 'http://www.nfce.sefaz.ma.gov.br/portal/consultaNFe.do?method=preFilterCupom&', |
|
61 | + 'PA' => 'https://appnfc.sefa.pa.gov.br/portal/view/consultas/nfce/consultanfce.seam', |
|
62 | + 'PB' => 'https://www.receita.pb.gov.br/ser/servirtual/documentos-fiscais/nfc-e/consultar-nfc-e', |
|
63 | + 'PR' => 'http://www.sped.fazenda.pr.gov.br/modules/conteudo/conteudo.php?conteudo=100', |
|
64 | + 'RJ' => 'http://www4.fazenda.rj.gov.br/consultaDFe/paginas/consultaChaveAcesso.faces', |
|
65 | + 'RS' => 'https://www.sefaz.rs.gov.br/NFE/NFE-COM.aspx', |
|
66 | + 'RO' => 'http://www.nfce.sefin.ro.gov.br/home.jsp', |
|
67 | + 'RR' => 'https://www.sefaz.rr.gov.br/nfce/servlet/wp_consulta_nfce', |
|
68 | + 'SE' => 'http://www.nfce.se.gov.br/portal/portalNoticias.jsp?jsp=barra-menu/servicos/consultaDANFENFCe.htm', |
|
69 | + 'SP' => 'https://www.nfce.fazenda.sp.gov.br/NFCeConsultaPublica/Paginas/ConsultaPublica.aspx' |
|
70 | 70 | ]; |
71 | 71 | |
72 | 72 | /** |
@@ -166,8 +166,8 @@ discard block |
||
166 | 166 | } |
167 | 167 | $this->printer->setAlign('C'); |
168 | 168 | $this->printer->text($razao); |
169 | - $this->printer->text('CNPJ: '.$cnpj.' '.'IE: ' . $ie); |
|
170 | - $this->printer->text('IM: '.$im); |
|
169 | + $this->printer->text('CNPJ: ' . $cnpj . ' ' . 'IE: ' . $ie); |
|
170 | + $this->printer->text('IM: ' . $im); |
|
171 | 171 | $this->printer->setAlign('L'); |
172 | 172 | //o que acontece quando o texto é maior que o numero de carecteres |
173 | 173 | //da linha ?? |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | //obter dados dos itens da NFCe |
202 | 202 | $det = $this->nfce->infNFe->det; |
203 | 203 | $this->totItens = $det->count(); |
204 | - for ($x=0; $x<=$this->totItens-1; $x++) { |
|
204 | + for ($x = 0; $x <= $this->totItens - 1; $x++) { |
|
205 | 205 | $nItem = (int) $det[$x]->attributes()->{'nItem'}; |
206 | 206 | $cProd = (string) $det[$x]->prod->cProd; |
207 | 207 | $xProd = (string) $det[$x]->prod->xProd; |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $vUnCom = (float) $det[$x]->prod->vUnCom; |
211 | 211 | $vProd = (float) $det[$x]->prod->vProd; |
212 | 212 | //falta formatar os campos e o espaçamento entre eles |
213 | - $this->printer->text($nItem . $cProd. $xProd . $qCom . $uCom . $vUnCom . $vProd); |
|
213 | + $this->printer->text($nItem . $cProd . $xProd . $qCom . $uCom . $vUnCom . $vProd); |
|
214 | 214 | } |
215 | 215 | //linha divisória ?? |
216 | 216 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | { |
224 | 224 | $vTotTrib = (float) $this->nfce->infNFe->total->ICMSTot->vTotTrib; |
225 | 225 | $this->printer->setAlign('L'); |
226 | - $this->printer->text('Informação dos Tributos Totais:' . '' . 'R$ ' . $vTotTrib); |
|
226 | + $this->printer->text('Informação dos Tributos Totais:' . '' . 'R$ ' . $vTotTrib); |
|
227 | 227 | $this->printer->text('Incidentes (Lei Federal 12.741 /2012) - Fonte IBPT'); |
228 | 228 | //linha divisória ?? |
229 | 229 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | $std = json_decode(json_encode($pg)); |
246 | 246 | $tPag = (string) $this->tipoPag($std->tPag); |
247 | 247 | $vPag = (float) $std->vPag; |
248 | - $this->printer->text($tPag . ' R$ '. $vPag); |
|
248 | + $this->printer->text($tPag . ' R$ ' . $vPag); |
|
249 | 249 | } |
250 | 250 | //linha divisória ?? |
251 | 251 | } |
@@ -284,9 +284,9 @@ discard block |
||
284 | 284 | $serie = (int) $this->nfce->infNFe->ide->serie; |
285 | 285 | $dhEmi = (string) $this->nfce->infNFe->ide->dhEmi; |
286 | 286 | $Id = (string) $this->nfce->infNFe->attributes()->{'Id'}; |
287 | - $chave = substr($Id, 3, strlen($Id)-3); |
|
287 | + $chave = substr($Id, 3, strlen($Id) - 3); |
|
288 | 288 | $this->printer->setAlign('L'); |
289 | - $this->printer->text('Nr. ' . $nNF. ' Serie ' .$serie . ' Emissão ' .$dhEmi . ' via Consumidor'); |
|
289 | + $this->printer->text('Nr. ' . $nNF . ' Serie ' . $serie . ' Emissão ' . $dhEmi . ' via Consumidor'); |
|
290 | 290 | $this->printer->setAlign('C'); |
291 | 291 | $this->printer->text('Consulte pela chave de acesso em'); |
292 | 292 | $this->printer->text($this->uri); |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | * @param string $sPathLogo Caminho para o arquivo do logo |
73 | 73 | * @param string $sDestino Destino do PDF I-browser D-download S-string F-salva |
74 | 74 | * @param string $sDirPDF Caminho para o diretorio de armazenamento dos arquivos PDF |
75 | - * @param string $fonteDANFE Nome da fonte alternativa |
|
75 | + * @param string $fontePDF Nome da fonte alternativa |
|
76 | 76 | * @param array $aEnd array com o endereço do emitente |
77 | - * @param number $mododebug 0-Não 1-Sim e 2-nada (2 default) |
|
77 | + * @param integer $mododebug 0-Não 1-Sim e 2-nada (2 default) |
|
78 | 78 | */ |
79 | 79 | public function __construct( |
80 | 80 | $docXML = '', |
@@ -167,9 +167,8 @@ discard block |
||
167 | 167 | * @param string $orientacao |
168 | 168 | * @param string $papel |
169 | 169 | * @param string $logoAlign |
170 | - * @param int $situacao_externa |
|
171 | 170 | * @param boolean $classe_pdf |
172 | - * @return number |
|
171 | + * @return string |
|
173 | 172 | */ |
174 | 173 | public function monta($orientacao = '', $papel = 'A4', $logoAlign = 'C', $classe_pdf = false) |
175 | 174 | { |
@@ -264,9 +263,9 @@ discard block |
||
264 | 263 | |
265 | 264 | /** |
266 | 265 | * pHeader |
267 | - * @param number $x |
|
268 | - * @param number $y |
|
269 | - * @param number $pag |
|
266 | + * @param integer $x |
|
267 | + * @param integer $y |
|
268 | + * @param integer $pag |
|
270 | 269 | * @return number |
271 | 270 | */ |
272 | 271 | private function pHeader($x, $y, $pag) |
@@ -496,8 +495,8 @@ discard block |
||
496 | 495 | /** |
497 | 496 | * pBody |
498 | 497 | * |
499 | - * @param number $x |
|
500 | - * @param number $y |
|
498 | + * @param integer $x |
|
499 | + * @param double $y |
|
501 | 500 | */ |
502 | 501 | private function pBody($x, $y) |
503 | 502 | { |
@@ -523,7 +522,7 @@ discard block |
||
523 | 522 | /** |
524 | 523 | * pFooter |
525 | 524 | * |
526 | - * @param number $x |
|
525 | + * @param integer $x |
|
527 | 526 | * @param number $y |
528 | 527 | */ |
529 | 528 | private function pFooter($x, $y) |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $this->retEvento = $this->dom->getElementsByTagName("retEvento")->item(0); |
135 | 135 | $this->rinfEvento = $this->retEvento->getElementsByTagName("infEvento")->item(0); |
136 | 136 | $this->tpEvento = $this->infEvento->getElementsByTagName("tpEvento")->item(0)->nodeValue; |
137 | - if (!in_array($this->tpEvento, ['110110','110111'])) { |
|
137 | + if (!in_array($this->tpEvento, ['110110', '110111'])) { |
|
138 | 138 | $this->errMsg = 'Evento não implementado ' . $tpEvento . ' !!'; |
139 | 139 | $this->errStatus = true; |
140 | 140 | return false; |
@@ -154,11 +154,9 @@ discard block |
||
154 | 154 | $this->cStat = $this->rinfEvento->getElementsByTagName("cStat")->item(0)->nodeValue; |
155 | 155 | $this->xMotivo = $this->rinfEvento->getElementsByTagName("xMotivo")->item(0)->nodeValue; |
156 | 156 | $this->CNPJDest = !empty($this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue) ? |
157 | - $this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue : |
|
158 | - ''; |
|
157 | + $this->rinfEvento->getElementsByTagName("CNPJDest")->item(0)->nodeValue : ''; |
|
159 | 158 | $this->CPFDest = !empty($this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue) ? |
160 | - $this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue : |
|
161 | - ''; |
|
159 | + $this->rinfEvento->getElementsByTagName("CPFDest")->item(0)->nodeValue : ''; |
|
162 | 160 | $this->dhRegEvento = $this->rinfEvento->getElementsByTagName("dhRegEvento")->item(0)->nodeValue; |
163 | 161 | $this->nProt = $this->rinfEvento->getElementsByTagName("nProt")->item(0)->nodeValue; |
164 | 162 | } |
@@ -280,9 +278,9 @@ discard block |
||
280 | 278 | // coluna esquerda identificação do emitente |
281 | 279 | $w = round($maxW * 0.41, 0); // 80; |
282 | 280 | if ($this->orientacao == 'P') { |
283 | - $aFont = ['font' => $this->fontePadrao,'size' => 6,'style' => 'I']; |
|
281 | + $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I']; |
|
284 | 282 | } else { |
285 | - $aFont = ['font' => $this->fontePadrao,'size' => 8,'style' => 'B']; |
|
283 | + $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'B']; |
|
286 | 284 | } |
287 | 285 | $w1 = $w; |
288 | 286 | $h = 32; |
@@ -434,7 +432,7 @@ discard block |
||
434 | 432 | . 'abaixo referenciada, está cancelada, solicitamos que sejam ' |
435 | 433 | . 'aplicadas essas correções ao executar seus lançamentos fiscais.'; |
436 | 434 | } |
437 | - $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => '']; |
|
435 | + $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => '']; |
|
438 | 436 | $this->pTextBox($x + 5, $y1, $maxW - 5, 20, $texto, $aFont, 'T', 'L', 0, '', false); |
439 | 437 | // ############################################ |
440 | 438 | $x = $oldX; |
@@ -445,7 +443,7 @@ discard block |
||
445 | 443 | if ($this->CPFDest != '') { |
446 | 444 | $texto = 'CPF do Destinatário: ' . $this->pFormat($this->CPFDest, "###.###.###-##"); |
447 | 445 | } |
448 | - $aFont = ['font' => $this->fontePadrao,'size' => 12,'style' => 'B']; |
|
446 | + $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B']; |
|
449 | 447 | $this->pTextBox($x + 2, $y + 13, $w2, 8, $texto, $aFont, 'T', 'L', 0, ''); |
450 | 448 | $numNF = substr($this->chNFe, 25, 9); |
451 | 449 | $serie = substr($this->chNFe, 22, 3); |
@@ -461,7 +459,7 @@ discard block |
||
461 | 459 | $this->pdf->Code128($x + (($w - $bW) / 2), $y + 2, $this->chNFe, $bW, $bH); |
462 | 460 | $this->pdf->SetFillColor(255, 255, 255); |
463 | 461 | $y1 = $y + 2 + $bH; |
464 | - $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => '']; |
|
462 | + $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => '']; |
|
465 | 463 | $texto = $this->pFormat($this->chNFe, $this->formatoChave); |
466 | 464 | $this->pTextBox($x, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, ''); |
467 | 465 | $retVal = $sY + 2; |
@@ -469,7 +467,7 @@ discard block |
||
469 | 467 | $x = $oldX; |
470 | 468 | $this->pTextBox($x, $sY, $maxW, 15); |
471 | 469 | $texto = $this->xCondUso; |
472 | - $aFont = ['font' => $this->fontePadrao,'size' => 8,'style' => 'I']; |
|
470 | + $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => 'I']; |
|
473 | 471 | $this->pTextBox($x + 2, $sY + 2, $maxW - 2, 15, $texto, $aFont, 'T', 'L', 0, '', false); |
474 | 472 | $retVal = $sY + 2; |
475 | 473 | } |
@@ -485,9 +483,9 @@ discard block |
||
485 | 483 | $w = $maxW - (2 * $x); |
486 | 484 | $this->pdf->setTextColor(90, 90, 90); |
487 | 485 | $texto = "SEM VALOR FISCAL"; |
488 | - $aFont = ['font' => $this->fontePadrao,'size' => 48,'style' => 'B']; |
|
486 | + $aFont = ['font' => $this->fontePadrao, 'size' => 48, 'style' => 'B']; |
|
489 | 487 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
490 | - $aFont = ['font' => $this->fontePadrao,'size' => 30,'style' => 'B']; |
|
488 | + $aFont = ['font' => $this->fontePadrao, 'size' => 30, 'style' => 'B']; |
|
491 | 489 | $texto = "AMBIENTE DE HOMOLOGAÇÃO"; |
492 | 490 | $this->pTextBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
493 | 491 | $this->pdf->setTextColor(0, 0, 0); |
@@ -509,7 +507,7 @@ discard block |
||
509 | 507 | } else { |
510 | 508 | $texto = 'JUSTIFICATIVA DO CANCELAMENTO'; |
511 | 509 | } |
512 | - $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => 'B']; |
|
510 | + $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'B']; |
|
513 | 511 | $this->pTextBox($x, $y, $maxW, 5, $texto, $aFont, 'T', 'L', 0, '', false); |
514 | 512 | $y += 5; |
515 | 513 | $this->pTextBox($x, $y, $maxW, 190); |
@@ -518,7 +516,7 @@ discard block |
||
518 | 516 | } elseif ($this->tpEvento == '110111') { |
519 | 517 | $texto = $this->xJust; |
520 | 518 | } |
521 | - $aFont = ['font' => $this->fontePadrao,'size' => 12,'style' => 'B']; |
|
519 | + $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B']; |
|
522 | 520 | $this->pTextBox($x + 2, $y + 2, $maxW - 2, 150, $texto, $aFont, 'T', 'L', 0, '', false); |
523 | 521 | } |
524 | 522 | |
@@ -543,15 +541,15 @@ discard block |
||
543 | 541 | . "eletrônico XML e pode ser consultada através dos Portais " |
544 | 542 | . "das SEFAZ."; |
545 | 543 | } |
546 | - $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => 'I']; |
|
544 | + $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => 'I']; |
|
547 | 545 | $this->pTextBox($x, $y, $w, 20, $texto, $aFont, 'T', 'C', 0, '', false); |
548 | 546 | $y = $this->hPrint - 4; |
549 | 547 | $texto = "Impresso em " . date('d/m/Y H:i:s'); |
550 | 548 | $w = $this->wPrint - 4; |
551 | - $aFont = ['font' => $this->fontePadrao,'size' => 6,'style' => 'I']; |
|
549 | + $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I']; |
|
552 | 550 | $this->pTextBox($x, $y, $w, 4, $texto, $aFont, 'T', 'L', 0, ''); |
553 | 551 | $texto = "Daevento ver. " . $this->version . " Powered by NFePHP (GNU/GPLv3 GNU/LGPLv3) © www.nfephp.org"; |
554 | - $aFont = ['font' => $this->fontePadrao,'size' => 6,'style' => 'I']; |
|
552 | + $aFont = ['font' => $this->fontePadrao, 'size' => 6, 'style' => 'I']; |
|
555 | 553 | $this->pTextBox($x, $y, $w, 4, $texto, $aFont, 'T', 'R', 0, 'http://www.nfephp.org'); |
556 | 554 | } |
557 | 555 |
@@ -15,7 +15,6 @@ |
||
15 | 15 | * @author Roberto L. Machado <linux.rlm at gmail dot com> |
16 | 16 | */ |
17 | 17 | |
18 | -use Exception; |
|
19 | 18 | use NFePHP\DA\Legacy\Dom; |
20 | 19 | use NFePHP\DA\Legacy\Pdf; |
21 | 20 | use NFePHP\DA\Legacy\Common; |
@@ -976,8 +976,8 @@ discard block |
||
976 | 976 | *cabecalhoDANFE |
977 | 977 | * Monta o cabelhalho da DANFE (retrato e paisagem) |
978 | 978 | * |
979 | - * @param number $x Posição horizontal inicial, canto esquerdo |
|
980 | - * @param number $y Posição vertical inicial, canto superior |
|
979 | + * @param integer $x Posição horizontal inicial, canto esquerdo |
|
980 | + * @param integer $y Posição vertical inicial, canto superior |
|
981 | 981 | * @param number $pag Número da Página |
982 | 982 | * @param number $totPag Total de páginas |
983 | 983 | * @return number Posição vertical final |
@@ -1398,8 +1398,8 @@ discard block |
||
1398 | 1398 | * Monta o campo com os dados do destinatário na DANFE. (retrato e paisagem) |
1399 | 1399 | * |
1400 | 1400 | * @name destinatarioDANFE |
1401 | - * @param number $x Posição horizontal canto esquerdo |
|
1402 | - * @param number $y Posição vertical canto superior |
|
1401 | + * @param integer $x Posição horizontal canto esquerdo |
|
1402 | + * @param integer $y Posição vertical canto superior |
|
1403 | 1403 | * @return number Posição vertical final |
1404 | 1404 | */ |
1405 | 1405 | protected function pDestinatarioDANFE($x = 0, $y = 0) |
@@ -1599,7 +1599,7 @@ discard block |
||
1599 | 1599 | * Gera a String do Texto da Fatura |
1600 | 1600 | * |
1601 | 1601 | * @name getTextoFatura |
1602 | - * @return a String com o texto ou ""; |
|
1602 | + * @return string String com o texto ou ""; |
|
1603 | 1603 | */ |
1604 | 1604 | protected function pGetTextoFatura() |
1605 | 1605 | { |
@@ -1646,8 +1646,8 @@ discard block |
||
1646 | 1646 | * Monta o campo de duplicatas da DANFE (retrato e paisagem) |
1647 | 1647 | * |
1648 | 1648 | * @name faturaDANFE |
1649 | - * @param number $x Posição horizontal canto esquerdo |
|
1650 | - * @param number $y Posição vertical canto superior |
|
1649 | + * @param integer $x Posição horizontal canto esquerdo |
|
1650 | + * @param double $y Posição vertical canto superior |
|
1651 | 1651 | * @return number Posição vertical final |
1652 | 1652 | */ |
1653 | 1653 | protected function pFaturaDANFE($x, $y) |
@@ -1760,6 +1760,8 @@ discard block |
||
1760 | 1760 | * @param float $h Altura do campo |
1761 | 1761 | * @param float $h Título do campo |
1762 | 1762 | * @param float $h Valor do imposto |
1763 | + * @param string $titulo |
|
1764 | + * @param string $campoImposto |
|
1763 | 1765 | * @return float Sugestão do $x do próximo imposto |
1764 | 1766 | */ |
1765 | 1767 | protected function pImpostoDanfeHelper($x, $y, $w, $h, $titulo, $campoImposto) |
@@ -1786,9 +1788,9 @@ discard block |
||
1786 | 1788 | * impostoDANFE |
1787 | 1789 | * Monta o campo de impostos e totais da DANFE (retrato e paisagem) |
1788 | 1790 | * |
1789 | - * @param number $x Posição horizontal canto esquerdo |
|
1790 | - * @param number $y Posição vertical canto superior |
|
1791 | - * @return number Posição vertical final |
|
1791 | + * @param integer $x Posição horizontal canto esquerdo |
|
1792 | + * @param double $y Posição vertical canto superior |
|
1793 | + * @return double Posição vertical final |
|
1792 | 1794 | */ |
1793 | 1795 | protected function pImpostoDANFE($x, $y) |
1794 | 1796 | { |
@@ -2164,6 +2166,10 @@ discard block |
||
2164 | 2166 | |
2165 | 2167 | |
2166 | 2168 | |
2169 | + /** |
|
2170 | + * @param string $campo |
|
2171 | + * @param string $formato |
|
2172 | + */ |
|
2167 | 2173 | protected function pDescricaoProdutoHelper($origem, $campo, $formato) |
2168 | 2174 | { |
2169 | 2175 | $valor_original = $origem->getElementsByTagName($campo)->item(0); |
@@ -2250,7 +2256,6 @@ discard block |
||
2250 | 2256 | * @param float $x Posição horizontal canto esquerdo |
2251 | 2257 | * @param float $y Posição vertical canto superior |
2252 | 2258 | * @param float $nInicio Número do item inicial |
2253 | - * @param float $max Número do item final |
|
2254 | 2259 | * @param float $hmax Altura máxima do campo de itens em mm |
2255 | 2260 | * @return float Posição vertical final |
2256 | 2261 | */ |
@@ -2697,8 +2702,7 @@ discard block |
||
2697 | 2702 | * sobre a API NfePHP |
2698 | 2703 | * |
2699 | 2704 | * @name pRodape |
2700 | - * @param float $xInic Posição horizontal canto esquerdo |
|
2701 | - * @param float $yFinal Posição vertical final para impressão |
|
2705 | + * @param integer $x |
|
2702 | 2706 | * @return void |
2703 | 2707 | */ |
2704 | 2708 | protected function pRodape($x, $y) |
@@ -2721,7 +2725,7 @@ discard block |
||
2721 | 2725 | * Monta o canhoto da DANFE (retrato e paisagem) |
2722 | 2726 | * |
2723 | 2727 | * @name canhotoDANFE |
2724 | - * @param number $x Posição horizontal canto esquerdo |
|
2728 | + * @param integer $x Posição horizontal canto esquerdo |
|
2725 | 2729 | * @param number $y Posição vertical canto superior |
2726 | 2730 | * @return number Posição vertical final |
2727 | 2731 | * |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | $this->textoAdic .= ". \r\n"; |
598 | 598 | } |
599 | 599 | $this->textoAdic .= "LOCAL DE ENTREGA : ".$txRetCNPJ.'-'.$txRetxLgr.', '.$txRetnro.' '.$txRetxCpl. |
600 | - ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n"; |
|
600 | + ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n"; |
|
601 | 601 | } |
602 | 602 | //informações adicionais |
603 | 603 | $this->textoAdic .= $this->pGeraInformacoesDasNotasReferenciadas(); |
@@ -771,8 +771,8 @@ discard block |
||
771 | 771 | //retorna o ID na NFe |
772 | 772 | if ($classPdf!==false) { |
773 | 773 | $aR = array( |
774 | - 'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")), |
|
775 | - 'classe_PDF'=>$this->pdf); |
|
774 | + 'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")), |
|
775 | + 'classe_PDF'=>$this->pdf); |
|
776 | 776 | return $aR; |
777 | 777 | } else { |
778 | 778 | return str_replace('NFe', '', $this->infNFe->getAttribute("Id")); |
@@ -981,7 +981,7 @@ discard block |
||
981 | 981 | $oldX = $x; |
982 | 982 | $oldY = $y; |
983 | 983 | if ($this->orientacao == 'P') { |
984 | - $maxW = $this->wPrint; |
|
984 | + $maxW = $this->wPrint; |
|
985 | 985 | } else { |
986 | 986 | if ($pag == 1) { // primeira página |
987 | 987 | $maxW = $this->wPrint - $this->wCanhoto; |
@@ -1300,8 +1300,8 @@ discard block |
||
1300 | 1300 | $w = $maxW-(2*$x); |
1301 | 1301 | $this->pdf->SetTextColor(200, 200, 200); |
1302 | 1302 | $texto = "DANFE impresso em contingência -\n". |
1303 | - "DPEC regularmente recebido pela Receita\n". |
|
1304 | - "Federal do Brasil"; |
|
1303 | + "DPEC regularmente recebido pela Receita\n". |
|
1304 | + "Federal do Brasil"; |
|
1305 | 1305 | $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'); |
1306 | 1306 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
1307 | 1307 | $this->pdf->SetTextColor(0, 0, 0); |
@@ -1588,13 +1588,13 @@ discard block |
||
1588 | 1588 | return ($y + $h); |
1589 | 1589 | } //fim da função destinatarioDANFE |
1590 | 1590 | |
1591 | - /** |
|
1592 | - * pGetTextoFatura |
|
1593 | - * Gera a String do Texto da Fatura |
|
1594 | - * |
|
1595 | - * @name getTextoFatura |
|
1596 | - * @return a String com o texto ou ""; |
|
1597 | - */ |
|
1591 | + /** |
|
1592 | + * pGetTextoFatura |
|
1593 | + * Gera a String do Texto da Fatura |
|
1594 | + * |
|
1595 | + * @name getTextoFatura |
|
1596 | + * @return a String com o texto ou ""; |
|
1597 | + */ |
|
1598 | 1598 | protected function pGetTextoFatura() |
1599 | 1599 | { |
1600 | 1600 | if (isset($this->cobr)) { |
@@ -1618,13 +1618,13 @@ discard block |
||
1618 | 1618 | return ""; |
1619 | 1619 | } //fim getTextoFatura |
1620 | 1620 | |
1621 | - /** |
|
1622 | - * pSizeExtraTextoFatura |
|
1623 | - * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata. |
|
1624 | - * |
|
1625 | - * @name pSizeExtraTextoFatura |
|
1626 | - * @return integer |
|
1627 | - */ |
|
1621 | + /** |
|
1622 | + * pSizeExtraTextoFatura |
|
1623 | + * Calcula o espaço ocupado pelo texto da fatura. Este espaço só é utilizado quando não houver duplicata. |
|
1624 | + * |
|
1625 | + * @name pSizeExtraTextoFatura |
|
1626 | + * @return integer |
|
1627 | + */ |
|
1628 | 1628 | protected function pSizeExtraTextoFatura() |
1629 | 1629 | { |
1630 | 1630 | $textoFatura = $this->pGetTextoFatura(); |
@@ -2301,7 +2301,7 @@ discard block |
||
2301 | 2301 | $w4 = round($w*0.05, 0); |
2302 | 2302 | $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2 |
2303 | 2303 | if ($this->pSimpleGetValue($this->emit, 'CRT') == '3') { |
2304 | - $texto = 'O/CST';//Regime Normal |
|
2304 | + $texto = 'O/CST';//Regime Normal |
|
2305 | 2305 | } |
2306 | 2306 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2307 | 2307 | $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
@@ -2619,9 +2619,9 @@ discard block |
||
2619 | 2619 | //DADOS ADICIONAIS |
2620 | 2620 | $texto = "DADOS ADICIONAIS"; |
2621 | 2621 | if ($this->orientacao == 'P') { |
2622 | - $w = $this->wPrint; |
|
2622 | + $w = $this->wPrint; |
|
2623 | 2623 | } else { |
2624 | - $w = $this->wPrint-$this->wCanhoto; |
|
2624 | + $w = $this->wPrint-$this->wCanhoto; |
|
2625 | 2625 | } |
2626 | 2626 | $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'); |
2627 | 2627 | $this->pTextBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, ''); |
@@ -2701,10 +2701,10 @@ discard block |
||
2701 | 2701 | protected function pRodape($x, $y) |
2702 | 2702 | { |
2703 | 2703 | if ($this->orientacao == 'P') { |
2704 | - $w = $this->wPrint; |
|
2704 | + $w = $this->wPrint; |
|
2705 | 2705 | } else { |
2706 | - $w = $this->wPrint-$this->wCanhoto; |
|
2707 | - $x = $this->wCanhoto; |
|
2706 | + $w = $this->wPrint-$this->wCanhoto; |
|
2707 | + $x = $this->wCanhoto; |
|
2708 | 2708 | } |
2709 | 2709 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'); |
2710 | 2710 | $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s'); |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | * ativa ou desativa o modo de debug |
299 | 299 | * @var integer |
300 | 300 | */ |
301 | - protected $debugMode=2; |
|
301 | + protected $debugMode = 2; |
|
302 | 302 | |
303 | 303 | /** |
304 | 304 | * __construct |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $this->fontePadrao = $fonteDANFE; |
352 | 352 | } |
353 | 353 | //se for passado o xml |
354 | - if (! empty($this->xml)) { |
|
354 | + if (!empty($this->xml)) { |
|
355 | 355 | $this->dom = new Dom(); |
356 | 356 | $this->dom->loadXML($this->xml); |
357 | 357 | $this->nfeProc = $this->dom->getElementsByTagName("nfeProc")->item(0); |
@@ -495,10 +495,10 @@ discard block |
||
495 | 495 | //total inicial de paginas |
496 | 496 | $totPag = 1; |
497 | 497 | //largura imprimivel em mm: largura da folha menos as margens esq/direita |
498 | - $this->wPrint = $maxW-($margEsq*2); |
|
498 | + $this->wPrint = $maxW - ($margEsq * 2); |
|
499 | 499 | //comprimento (altura) imprimivel em mm: altura da folha menos as margens |
500 | 500 | //superior e inferior |
501 | - $this->hPrint = $maxH-$margSup-$margInf; |
|
501 | + $this->hPrint = $maxH - $margSup - $margInf; |
|
502 | 502 | // estabelece contagem de paginas |
503 | 503 | $this->pdf->aliasNbPages(); |
504 | 504 | // fixa as margens |
@@ -536,34 +536,28 @@ discard block |
||
536 | 536 | } |
537 | 537 | //calcular a altura necessária para os dados adicionais |
538 | 538 | if ($this->orientacao == 'P') { |
539 | - $this->wAdic = round($this->wPrint*0.66, 0); |
|
539 | + $this->wAdic = round($this->wPrint * 0.66, 0); |
|
540 | 540 | } else { |
541 | - $this->wAdic = round(($this->wPrint-$this->wCanhoto)*0.5, 0); |
|
541 | + $this->wAdic = round(($this->wPrint - $this->wCanhoto) * 0.5, 0); |
|
542 | 542 | } |
543 | 543 | $fontProduto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>''); |
544 | 544 | $this->textoAdic = ''; |
545 | 545 | if (isset($this->retirada)) { |
546 | - $txRetCNPJ = ! empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue) ? |
|
547 | - $this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue : |
|
548 | - ''; |
|
549 | - $txRetxLgr = ! empty($this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue) ? |
|
550 | - $this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue : |
|
551 | - ''; |
|
552 | - $txRetnro = ! empty($this->retirada->getElementsByTagName("nro")->item(0)->nodeValue) ? |
|
553 | - $this->retirada->getElementsByTagName("nro")->item(0)->nodeValue : |
|
554 | - 's/n'; |
|
546 | + $txRetCNPJ = !empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue) ? |
|
547 | + $this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue : ''; |
|
548 | + $txRetxLgr = !empty($this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue) ? |
|
549 | + $this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue : ''; |
|
550 | + $txRetnro = !empty($this->retirada->getElementsByTagName("nro")->item(0)->nodeValue) ? |
|
551 | + $this->retirada->getElementsByTagName("nro")->item(0)->nodeValue : 's/n'; |
|
555 | 552 | $txRetxCpl = $this->pSimpleGetValue($this->retirada, "xCpl", " - "); |
556 | - $txRetxBairro = ! empty($this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue) ? |
|
557 | - $this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue : |
|
558 | - ''; |
|
559 | - $txRetxMun = ! empty($this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue) ? |
|
560 | - $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue : |
|
561 | - ''; |
|
562 | - $txRetUF = ! empty($this->retirada->getElementsByTagName("UF")->item(0)->nodeValue) ? |
|
563 | - $this->retirada->getElementsByTagName("UF")->item(0)->nodeValue : |
|
564 | - ''; |
|
565 | - $this->textoAdic .= "LOCAL DE RETIRADA : ". |
|
566 | - $txRetCNPJ. |
|
553 | + $txRetxBairro = !empty($this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue) ? |
|
554 | + $this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue : ''; |
|
555 | + $txRetxMun = !empty($this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue) ? |
|
556 | + $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue : ''; |
|
557 | + $txRetUF = !empty($this->retirada->getElementsByTagName("UF")->item(0)->nodeValue) ? |
|
558 | + $this->retirada->getElementsByTagName("UF")->item(0)->nodeValue : ''; |
|
559 | + $this->textoAdic .= "LOCAL DE RETIRADA : " . |
|
560 | + $txRetCNPJ . |
|
567 | 561 | '-' . |
568 | 562 | $txRetxLgr . |
569 | 563 | ', ' . |
@@ -580,24 +574,24 @@ discard block |
||
580 | 574 | } |
581 | 575 | //dados do local de entrega da mercadoria |
582 | 576 | if (isset($this->entrega)) { |
583 | - $txRetCNPJ = ! empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue) ? |
|
577 | + $txRetCNPJ = !empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue) ? |
|
584 | 578 | $this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue : ''; |
585 | - $txRetxLgr = ! empty($this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue) ? |
|
579 | + $txRetxLgr = !empty($this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue) ? |
|
586 | 580 | $this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue : ''; |
587 | - $txRetnro = ! empty($this->entrega->getElementsByTagName("nro")->item(0)->nodeValue) ? |
|
581 | + $txRetnro = !empty($this->entrega->getElementsByTagName("nro")->item(0)->nodeValue) ? |
|
588 | 582 | $this->entrega->getElementsByTagName("nro")->item(0)->nodeValue : 's/n'; |
589 | 583 | $txRetxCpl = $this->pSimpleGetValue($this->entrega, "xCpl", " - "); |
590 | - $txRetxBairro = ! empty($this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue) ? |
|
584 | + $txRetxBairro = !empty($this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue) ? |
|
591 | 585 | $this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue : ''; |
592 | - $txRetxMun = ! empty($this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue) ? |
|
586 | + $txRetxMun = !empty($this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue) ? |
|
593 | 587 | $this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue : ''; |
594 | - $txRetUF = ! empty($this->entrega->getElementsByTagName("UF")->item(0)->nodeValue) ? |
|
588 | + $txRetUF = !empty($this->entrega->getElementsByTagName("UF")->item(0)->nodeValue) ? |
|
595 | 589 | $this->entrega->getElementsByTagName("UF")->item(0)->nodeValue : ''; |
596 | 590 | if ($this->textoAdic != '') { |
597 | 591 | $this->textoAdic .= ". \r\n"; |
598 | 592 | } |
599 | - $this->textoAdic .= "LOCAL DE ENTREGA : ".$txRetCNPJ.'-'.$txRetxLgr.', '.$txRetnro.' '.$txRetxCpl. |
|
600 | - ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n"; |
|
593 | + $this->textoAdic .= "LOCAL DE ENTREGA : " . $txRetCNPJ . '-' . $txRetxLgr . ', ' . $txRetnro . ' ' . $txRetxCpl . |
|
594 | + ' - ' . $txRetxBairro . ' ' . $txRetxMun . ' - ' . $txRetUF . "\r\n"; |
|
601 | 595 | } |
602 | 596 | //informações adicionais |
603 | 597 | $this->textoAdic .= $this->pGeraInformacoesDasNotasReferenciadas(); |
@@ -606,7 +600,7 @@ discard block |
||
606 | 600 | if ($this->textoAdic != '') { |
607 | 601 | $this->textoAdic .= ". \r\n"; |
608 | 602 | } |
609 | - $this->textoAdic .= ! empty($this->infAdic->getElementsByTagName("infCpl")->item(0)->nodeValue) ? |
|
603 | + $this->textoAdic .= !empty($this->infAdic->getElementsByTagName("infCpl")->item(0)->nodeValue) ? |
|
610 | 604 | 'Inf. Contribuinte: ' . |
611 | 605 | trim($this->pAnfavea($this->infAdic->getElementsByTagName("infCpl")->item(0)->nodeValue)) : ''; |
612 | 606 | $infPedido = $this->pGeraInformacoesDaTagCompra(); |
@@ -614,14 +608,14 @@ discard block |
||
614 | 608 | $this->textoAdic .= $infPedido; |
615 | 609 | } |
616 | 610 | $this->textoAdic .= $this->pSimpleGetValue($this->dest, "email", ' Email do Destinatário: '); |
617 | - $this->textoAdic .= ! empty($this->infAdic->getElementsByTagName("infAdFisco")->item(0)->nodeValue) ? |
|
611 | + $this->textoAdic .= !empty($this->infAdic->getElementsByTagName("infAdFisco")->item(0)->nodeValue) ? |
|
618 | 612 | "\r\n Inf. fisco: " . |
619 | 613 | trim($this->infAdic->getElementsByTagName("infAdFisco")->item(0)->nodeValue) : ''; |
620 | 614 | $obsCont = $this->infAdic->getElementsByTagName("obsCont"); |
621 | 615 | if (isset($obsCont)) { |
622 | 616 | foreach ($obsCont as $obs) { |
623 | - $campo = $obsCont->item($i)->getAttribute("xCampo"); |
|
624 | - $xTexto = ! empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ? |
|
617 | + $campo = $obsCont->item($i)->getAttribute("xCampo"); |
|
618 | + $xTexto = !empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ? |
|
625 | 619 | $obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue : ''; |
626 | 620 | $this->textoAdic .= "\r\n" . $campo . ': ' . trim($xTexto); |
627 | 621 | $i++; |
@@ -649,38 +643,38 @@ discard block |
||
649 | 643 | foreach ($alinhas as $linha) { |
650 | 644 | $numlinhasdados += $this->pGetNumLines($linha, $this->wAdic, $fontProduto); |
651 | 645 | } |
652 | - $hdadosadic = round(($numlinhasdados+3) * $this->pdf->fontSize, 0); |
|
646 | + $hdadosadic = round(($numlinhasdados + 3) * $this->pdf->fontSize, 0); |
|
653 | 647 | if ($hdadosadic < 10) { |
654 | 648 | $hdadosadic = 10; |
655 | 649 | } |
656 | 650 | //altura disponivel para os campos da DANFE |
657 | - $hcabecalho = 47;//para cabeçalho |
|
658 | - $hdestinatario = 25;//para destinatario |
|
659 | - $hduplicatas = 12;//para cada grupo de 7 duplicatas |
|
660 | - $himposto = 18;// para imposto |
|
661 | - $htransporte = 25;// para transporte |
|
662 | - $hissqn = 11;// para issqn |
|
663 | - $hfooter = 5;// para rodape |
|
664 | - $hCabecItens = 4;//cabeçalho dos itens |
|
651 | + $hcabecalho = 47; //para cabeçalho |
|
652 | + $hdestinatario = 25; //para destinatario |
|
653 | + $hduplicatas = 12; //para cada grupo de 7 duplicatas |
|
654 | + $himposto = 18; // para imposto |
|
655 | + $htransporte = 25; // para transporte |
|
656 | + $hissqn = 11; // para issqn |
|
657 | + $hfooter = 5; // para rodape |
|
658 | + $hCabecItens = 4; //cabeçalho dos itens |
|
665 | 659 | //alturas disponiveis para os dados |
666 | 660 | $hDispo1 = $this->hPrint - 10 - ($hcabecalho + |
667 | 661 | $hdestinatario + ($linhasDup * $hduplicatas) + $himposto + $htransporte + |
668 | 662 | ($linhaISSQN * $hissqn) + $hdadosadic + $hfooter + $hCabecItens + |
669 | 663 | $this->pSizeExtraTextoFatura()); |
670 | 664 | if ($this->orientacao == 'P') { |
671 | - $hDispo1 -= 23 * $this->qCanhoto;//para canhoto |
|
665 | + $hDispo1 -= 23 * $this->qCanhoto; //para canhoto |
|
672 | 666 | $w = $this->wPrint; |
673 | 667 | } else { |
674 | - $hcanhoto = $this->hPrint;//para canhoto |
|
668 | + $hcanhoto = $this->hPrint; //para canhoto |
|
675 | 669 | $w = $this->wPrint - $this->wCanhoto; |
676 | 670 | } |
677 | - $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens)-4; |
|
671 | + $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens) - 4; |
|
678 | 672 | //Contagem da altura ocupada para impressão dos itens |
679 | 673 | $fontProduto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>''); |
680 | 674 | $i = 0; |
681 | 675 | $numlinhas = 0; |
682 | 676 | $hUsado = $hCabecItens; |
683 | - $w2 = round($w*0.28, 0); |
|
677 | + $w2 = round($w * 0.28, 0); |
|
684 | 678 | $hDispo = $hDispo1; |
685 | 679 | $totPag = 1; |
686 | 680 | while ($i < $this->det->length) { |
@@ -692,7 +686,7 @@ discard block |
||
692 | 686 | $hDispo = $hDispo2; |
693 | 687 | $hUsado = $hCabecItens; |
694 | 688 | // Remove canhoto para páginas secundárias em modo paisagem ('L') |
695 | - $w2 = round($this->wPrint*0.28, 0); |
|
689 | + $w2 = round($this->wPrint * 0.28, 0); |
|
696 | 690 | $i--; // decrementa para readicionar o item que não coube nessa pagina na outra. |
697 | 691 | } |
698 | 692 | $i++; |
@@ -716,19 +710,19 @@ discard block |
||
716 | 710 | //coloca o cabeçalho |
717 | 711 | $y = $this->pCabecalhoDANFE($x, $y, $pag, $totPag); |
718 | 712 | //coloca os dados do destinatário |
719 | - $y = $this->pDestinatarioDANFE($x, $y+1); |
|
713 | + $y = $this->pDestinatarioDANFE($x, $y + 1); |
|
720 | 714 | //coloca os dados das faturas |
721 | - $y = $this->pFaturaDANFE($x, $y+1); |
|
715 | + $y = $this->pFaturaDANFE($x, $y + 1); |
|
722 | 716 | //coloca os dados dos impostos e totais da NFe |
723 | - $y = $this->pImpostoDANFE($x, $y+1); |
|
717 | + $y = $this->pImpostoDANFE($x, $y + 1); |
|
724 | 718 | //coloca os dados do trasnporte |
725 | - $y = $this->pTransporteDANFE($x, $y+1); |
|
719 | + $y = $this->pTransporteDANFE($x, $y + 1); |
|
726 | 720 | //itens da DANFE |
727 | 721 | $nInicial = 0; |
728 | - $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens); |
|
722 | + $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens); |
|
729 | 723 | //coloca os dados do ISSQN |
730 | 724 | if ($linhaISSQN == 1) { |
731 | - $y = $this->pIssqnDANFE($x, $y+4); |
|
725 | + $y = $this->pIssqnDANFE($x, $y + 4); |
|
732 | 726 | } else { |
733 | 727 | $y += 4; |
734 | 728 | } |
@@ -736,7 +730,7 @@ discard block |
||
736 | 730 | $y = $this->pDadosAdicionaisDANFE($x, $y, $hdadosadic); |
737 | 731 | //coloca o rodapé da página |
738 | 732 | if ($this->orientacao == 'P') { |
739 | - $this->pRodape($xInic, $y-1); |
|
733 | + $this->pRodape($xInic, $y - 1); |
|
740 | 734 | } else { |
741 | 735 | $this->pRodape($xInic, $this->hPrint + 1); |
742 | 736 | } |
@@ -756,7 +750,7 @@ discard block |
||
756 | 750 | //coloca o cabeçalho na página adicional |
757 | 751 | $y = $this->pCabecalhoDANFE($x, $y, $n, $totPag); |
758 | 752 | //coloca os itens na página adicional |
759 | - $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens); |
|
753 | + $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens); |
|
760 | 754 | //coloca o rodapé da página |
761 | 755 | if ($this->orientacao == 'P') { |
762 | 756 | $this->pRodape($xInic, $y + 4); |
@@ -769,7 +763,7 @@ discard block |
||
769 | 763 | } |
770 | 764 | } |
771 | 765 | //retorna o ID na NFe |
772 | - if ($classPdf!==false) { |
|
766 | + if ($classPdf !== false) { |
|
773 | 767 | $aR = array( |
774 | 768 | 'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")), |
775 | 769 | 'classe_PDF'=>$this->pdf); |
@@ -802,7 +796,7 @@ discard block |
||
802 | 796 | if ($startPos === false) { |
803 | 797 | return $cdata; |
804 | 798 | } |
805 | - for ($x=$len; $x>0; $x--) { |
|
799 | + for ($x = $len; $x > 0; $x--) { |
|
806 | 800 | if (substr($cdata, $x, 1) == '>') { |
807 | 801 | $endPos = $x; |
808 | 802 | break; |
@@ -813,15 +807,15 @@ discard block |
||
813 | 807 | } else { |
814 | 808 | $parte1 = ''; |
815 | 809 | } |
816 | - $parte2 = substr($cdata, $startPos, $endPos-$startPos+1); |
|
810 | + $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1); |
|
817 | 811 | if ($endPos < $len) { |
818 | 812 | $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1); |
819 | 813 | } else { |
820 | 814 | $parte3 = ''; |
821 | 815 | } |
822 | - $texto = trim($parte1).' '.trim($parte3); |
|
816 | + $texto = trim($parte1) . ' ' . trim($parte3); |
|
823 | 817 | if (strpos($parte2, '<CDATA>') === false) { |
824 | - $cdata = '<CDATA>'.$parte2.'</CDATA>'; |
|
818 | + $cdata = '<CDATA>' . $parte2 . '</CDATA>'; |
|
825 | 819 | } else { |
826 | 820 | $cdata = $parte2; |
827 | 821 | } |
@@ -893,15 +887,15 @@ discard block |
||
893 | 887 | //grupo CADATA infCpl |
894 | 888 | $t = $dom->getElementsByTagName('transmissor')->item(0); |
895 | 889 | $r = $dom->getElementsByTagName('receptor')->item(0); |
896 | - $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ? |
|
897 | - 'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : ''; |
|
898 | - $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ? |
|
899 | - 'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : ''; |
|
900 | - $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ? |
|
901 | - 'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : ''; |
|
902 | - $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ? |
|
903 | - 'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : ''; |
|
904 | - $texto .= "".$versao.$especieNF.$fabEntrega.$dca; |
|
890 | + $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ? |
|
891 | + 'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : ''; |
|
892 | + $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ? |
|
893 | + 'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : ''; |
|
894 | + $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ? |
|
895 | + 'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : ''; |
|
896 | + $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ? |
|
897 | + 'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : ''; |
|
898 | + $texto .= "" . $versao . $especieNF . $fabEntrega . $dca; |
|
905 | 899 | if (isset($t)) { |
906 | 900 | if ($t->hasAttributes()) { |
907 | 901 | $texto .= " Transmissor "; |
@@ -991,14 +985,14 @@ discard block |
||
991 | 985 | } |
992 | 986 | //#################################################################################### |
993 | 987 | //coluna esquerda identificação do emitente |
994 | - $w = round($maxW*0.41, 0); |
|
988 | + $w = round($maxW * 0.41, 0); |
|
995 | 989 | if ($this->orientacao == 'P') { |
996 | 990 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'); |
997 | 991 | } else { |
998 | 992 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'); |
999 | 993 | } |
1000 | 994 | $w1 = $w; |
1001 | - $h=32; |
|
995 | + $h = 32; |
|
1002 | 996 | $oldY += $h; |
1003 | 997 | $this->pTextBox($x, $y, $w, $h); |
1004 | 998 | $texto = 'IDENTIFICAÇÃO DO EMITENTE'; |
@@ -1012,41 +1006,41 @@ discard block |
||
1012 | 1006 | //se não houver logo centraliza dos dados do emitente |
1013 | 1007 | // coloca o logo |
1014 | 1008 | if (is_file($this->logomarca)) { |
1015 | - $logoInfo=getimagesize($this->logomarca); |
|
1009 | + $logoInfo = getimagesize($this->logomarca); |
|
1016 | 1010 | //largura da imagem em mm |
1017 | - $logoWmm = ($logoInfo[0]/72)*25.4; |
|
1011 | + $logoWmm = ($logoInfo[0] / 72) * 25.4; |
|
1018 | 1012 | //altura da imagem em mm |
1019 | - $logoHmm = ($logoInfo[1]/72)*25.4; |
|
1020 | - if ($this->logoAlign=='L') { |
|
1021 | - $nImgW = round($w/3, 0); |
|
1022 | - $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0); |
|
1023 | - $xImg = $x+1; |
|
1024 | - $yImg = round(($h-$nImgH)/2, 0)+$y; |
|
1013 | + $logoHmm = ($logoInfo[1] / 72) * 25.4; |
|
1014 | + if ($this->logoAlign == 'L') { |
|
1015 | + $nImgW = round($w / 3, 0); |
|
1016 | + $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
|
1017 | + $xImg = $x + 1; |
|
1018 | + $yImg = round(($h - $nImgH) / 2, 0) + $y; |
|
1025 | 1019 | //estabelecer posições do texto |
1026 | - $x1 = round($xImg + $nImgW +1, 0); |
|
1027 | - $y1 = round($h/3+$y, 0); |
|
1028 | - $tw = round(2*$w/3, 0); |
|
1029 | - } elseif ($this->logoAlign=='C') { |
|
1030 | - $nImgH = round($h/3, 0); |
|
1031 | - $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0); |
|
1032 | - $xImg = round(($w-$nImgW)/2+$x, 0); |
|
1033 | - $yImg = $y+3; |
|
1020 | + $x1 = round($xImg + $nImgW + 1, 0); |
|
1021 | + $y1 = round($h / 3 + $y, 0); |
|
1022 | + $tw = round(2 * $w / 3, 0); |
|
1023 | + } elseif ($this->logoAlign == 'C') { |
|
1024 | + $nImgH = round($h / 3, 0); |
|
1025 | + $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0); |
|
1026 | + $xImg = round(($w - $nImgW) / 2 + $x, 0); |
|
1027 | + $yImg = $y + 3; |
|
1034 | 1028 | $x1 = $x; |
1035 | 1029 | $y1 = round($yImg + $nImgH + 1, 0); |
1036 | 1030 | $tw = $w; |
1037 | - } elseif ($this->logoAlign=='R') { |
|
1038 | - $nImgW = round($w/3, 0); |
|
1039 | - $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0); |
|
1040 | - $xImg = round($x+($w-(1+$nImgW)), 0); |
|
1041 | - $yImg = round(($h-$nImgH)/2, 0)+$y; |
|
1031 | + } elseif ($this->logoAlign == 'R') { |
|
1032 | + $nImgW = round($w / 3, 0); |
|
1033 | + $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
|
1034 | + $xImg = round($x + ($w - (1 + $nImgW)), 0); |
|
1035 | + $yImg = round(($h - $nImgH) / 2, 0) + $y; |
|
1042 | 1036 | $x1 = $x; |
1043 | - $y1 = round($h/3+$y, 0); |
|
1044 | - $tw = round(2*$w/3, 0); |
|
1045 | - } elseif ($this->logoAlign=='F') { |
|
1046 | - $nImgH = round($h-5, 0); |
|
1047 | - $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0); |
|
1048 | - $xImg = round(($w-$nImgW)/2+$x, 0); |
|
1049 | - $yImg = $y+3; |
|
1037 | + $y1 = round($h / 3 + $y, 0); |
|
1038 | + $tw = round(2 * $w / 3, 0); |
|
1039 | + } elseif ($this->logoAlign == 'F') { |
|
1040 | + $nImgH = round($h - 5, 0); |
|
1041 | + $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0); |
|
1042 | + $xImg = round(($w - $nImgW) / 2 + $x, 0); |
|
1043 | + $yImg = $y + 3; |
|
1050 | 1044 | $x1 = $x; |
1051 | 1045 | $y1 = round($yImg + $nImgH + 1, 0); |
1052 | 1046 | $tw = $w; |
@@ -1054,7 +1048,7 @@ discard block |
||
1054 | 1048 | $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH); |
1055 | 1049 | } else { |
1056 | 1050 | $x1 = $x; |
1057 | - $y1 = round($h/3+$y, 0); |
|
1051 | + $y1 = round($h / 3 + $y, 0); |
|
1058 | 1052 | $tw = $w; |
1059 | 1053 | } |
1060 | 1054 | // monta as informações apenas se diferente de full logo |
@@ -1064,9 +1058,9 @@ discard block |
||
1064 | 1058 | $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue; |
1065 | 1059 | $this->pTextBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, ''); |
1066 | 1060 | //endereço |
1067 | - $y1 = $y1+5; |
|
1061 | + $y1 = $y1 + 5; |
|
1068 | 1062 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
1069 | - $fone = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue) |
|
1063 | + $fone = !empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue) |
|
1070 | 1064 | ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue |
1071 | 1065 | : ''; |
1072 | 1066 | $lgr = $this->pSimpleGetValue($this->enderEmit, "xLgr"); |
@@ -1086,37 +1080,37 @@ discard block |
||
1086 | 1080 | //#################################################################################### |
1087 | 1081 | //coluna central Danfe |
1088 | 1082 | $x += $w; |
1089 | - $w=round($maxW * 0.17, 0);//35; |
|
1083 | + $w = round($maxW * 0.17, 0); //35; |
|
1090 | 1084 | $w2 = $w; |
1091 | 1085 | $h = 32; |
1092 | 1086 | $this->pTextBox($x, $y, $w, $h); |
1093 | 1087 | |
1094 | - if (! $this->pNotaCancelada()) { |
|
1088 | + if (!$this->pNotaCancelada()) { |
|
1095 | 1089 | // A PRINCIPIO NÃO PRECISAVA, POIS A NFE ESTÁ AUTORIZADA, |
1096 | 1090 | // SÓ SE RETIRA O DANFE PARA NOTAS NÃO AUTORIZADAS |
1097 | 1091 | $texto = "DANFE"; |
1098 | 1092 | $aFont = array('font'=>$this->fontePadrao, 'size'=>14, 'style'=>'B'); |
1099 | - $this->pTextBox($x, $y+1, $w, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
1093 | + $this->pTextBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
1100 | 1094 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
1101 | 1095 | $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica'; |
1102 | 1096 | $h = 20; |
1103 | - $this->pTextBox($x, $y+6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false); |
|
1097 | + $this->pTextBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false); |
|
1104 | 1098 | } |
1105 | 1099 | |
1106 | 1100 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
1107 | 1101 | $texto = '0 - ENTRADA'; |
1108 | 1102 | $y1 = $y + 14; |
1109 | 1103 | $h = 8; |
1110 | - $this->pTextBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
1104 | + $this->pTextBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
1111 | 1105 | $texto = '1 - SAÍDA'; |
1112 | 1106 | $y1 = $y + 17; |
1113 | - $this->pTextBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
1107 | + $this->pTextBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
|
1114 | 1108 | //tipo de nF |
1115 | 1109 | $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B'); |
1116 | 1110 | $y1 = $y + 13; |
1117 | 1111 | $h = 7; |
1118 | 1112 | $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue; |
1119 | - $this->pTextBox($x+27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, ''); |
|
1113 | + $this->pTextBox($x + 27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, ''); |
|
1120 | 1114 | //numero da NF |
1121 | 1115 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'); |
1122 | 1116 | $y1 = $y + 20; |
@@ -1138,7 +1132,7 @@ discard block |
||
1138 | 1132 | //#################################################################################### |
1139 | 1133 | //coluna codigo de barras |
1140 | 1134 | $x += $w; |
1141 | - $w = ($maxW-$w1-$w2);//85; |
|
1135 | + $w = ($maxW - $w1 - $w2); //85; |
|
1142 | 1136 | $w3 = $w; |
1143 | 1137 | $h = 32; |
1144 | 1138 | $this->pTextBox($x, $y, $w, $h); |
@@ -1147,22 +1141,22 @@ discard block |
||
1147 | 1141 | $bW = 75; |
1148 | 1142 | $bH = 12; |
1149 | 1143 | //codigo de barras |
1150 | - $this->pdf->Code128($x+(($w-$bW)/2), $y+2, $chave_acesso, $bW, $bH); |
|
1144 | + $this->pdf->Code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH); |
|
1151 | 1145 | //linhas divisorias |
1152 | - $this->pdf->Line($x, $y+4+$bH, $x+$w, $y+4+$bH); |
|
1153 | - $this->pdf->Line($x, $y+12+$bH, $x+$w, $y+12+$bH); |
|
1146 | + $this->pdf->Line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH); |
|
1147 | + $this->pdf->Line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH); |
|
1154 | 1148 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1155 | - $y1 = $y+4+$bH; |
|
1149 | + $y1 = $y + 4 + $bH; |
|
1156 | 1150 | $h = 7; |
1157 | 1151 | $texto = 'CHAVE DE ACESSO'; |
1158 | 1152 | $this->pTextBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
1159 | 1153 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B'); |
1160 | - $y1 = $y+8+$bH; |
|
1154 | + $y1 = $y + 8 + $bH; |
|
1161 | 1155 | $texto = $this->pFormat($chave_acesso, $this->formatoChave); |
1162 | - $this->pTextBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
1163 | - $y1 = $y+12+$bH; |
|
1156 | + $this->pTextBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
1157 | + $y1 = $y + 12 + $bH; |
|
1164 | 1158 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
1165 | - $chaveContingencia=""; |
|
1159 | + $chaveContingencia = ""; |
|
1166 | 1160 | if ($this->pNotaDPEC()) { |
1167 | 1161 | $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC'; |
1168 | 1162 | } else { |
@@ -1173,16 +1167,16 @@ discard block |
||
1173 | 1167 | $chaveContingencia = $this->pGeraChaveAdicionalDeContingencia(); |
1174 | 1168 | $this->pdf->SetFillColor(0, 0, 0); |
1175 | 1169 | //codigo de barras |
1176 | - $this->pdf->Code128($x+11, $y1+1, $chaveContingencia, $bW*.9, $bH/2); |
|
1170 | + $this->pdf->Code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2); |
|
1177 | 1171 | } else { |
1178 | 1172 | $texto = 'Consulta de autenticidade no portal nacional da NF-e'; |
1179 | - $this->pTextBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
1180 | - $y1 = $y+16+$bH; |
|
1173 | + $this->pTextBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, ''); |
|
1174 | + $y1 = $y + 16 + $bH; |
|
1181 | 1175 | $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora'; |
1182 | 1176 | $this->pTextBox( |
1183 | - $x+2, |
|
1177 | + $x + 2, |
|
1184 | 1178 | $y1, |
1185 | - $w-2, |
|
1179 | + $w - 2, |
|
1186 | 1180 | $h, |
1187 | 1181 | $texto, |
1188 | 1182 | $aFont, |
@@ -1198,7 +1192,7 @@ discard block |
||
1198 | 1192 | //natureza da operação |
1199 | 1193 | $texto = 'NATUREZA DA OPERAÇÃO'; |
1200 | 1194 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1201 | - $w = $w1+$w2; |
|
1195 | + $w = $w1 + $w2; |
|
1202 | 1196 | $y = $oldY; |
1203 | 1197 | $oldY += $h; |
1204 | 1198 | $x = $oldX; |
@@ -1228,7 +1222,7 @@ discard block |
||
1228 | 1222 | $cStat = ''; |
1229 | 1223 | } else { |
1230 | 1224 | if (isset($this->nfeProc)) { |
1231 | - $texto = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ? |
|
1225 | + $texto = !empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ? |
|
1232 | 1226 | $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue : ''; |
1233 | 1227 | $tsHora = $this->pConvertTime($this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue); |
1234 | 1228 | if ($texto != '') { |
@@ -1259,25 +1253,25 @@ discard block |
||
1259 | 1253 | $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.'; |
1260 | 1254 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1261 | 1255 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
1262 | - $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue) |
|
1256 | + $texto = !empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue) |
|
1263 | 1257 | ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue |
1264 | 1258 | : ''; |
1265 | 1259 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'); |
1266 | 1260 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, ''); |
1267 | 1261 | //CNPJ |
1268 | 1262 | $x += $w; |
1269 | - $w = ($maxW-(2*$w)); |
|
1263 | + $w = ($maxW - (2 * $w)); |
|
1270 | 1264 | $texto = 'CNPJ / CPF'; |
1271 | 1265 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1272 | 1266 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
1273 | 1267 | //Pegando valor do CPF/CNPJ |
1274 | - if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) { |
|
1268 | + if (!empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) { |
|
1275 | 1269 | $texto = $this->pFormat( |
1276 | 1270 | $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue, |
1277 | 1271 | "###.###.###/####-##" |
1278 | 1272 | ); |
1279 | 1273 | } else { |
1280 | - $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ? |
|
1274 | + $texto = !empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ? |
|
1281 | 1275 | $this->pFormat( |
1282 | 1276 | $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue, |
1283 | 1277 | "###.###.###-##" |
@@ -1293,9 +1287,9 @@ discard block |
||
1293 | 1287 | if ($this->pNotaCancelada()) { |
1294 | 1288 | //101 Cancelamento |
1295 | 1289 | $x = 10; |
1296 | - $y = $this->hPrint-130; |
|
1290 | + $y = $this->hPrint - 130; |
|
1297 | 1291 | $h = 25; |
1298 | - $w = $maxW-(2*$x); |
|
1292 | + $w = $maxW - (2 * $x); |
|
1299 | 1293 | $this->pdf->SetTextColor(90, 90, 90); |
1300 | 1294 | $texto = "NFe CANCELADA"; |
1301 | 1295 | $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'); |
@@ -1306,12 +1300,12 @@ discard block |
||
1306 | 1300 | if ($this->pNotaDPEC() || $this->tpEmis == 4) { |
1307 | 1301 | //DPEC |
1308 | 1302 | $x = 10; |
1309 | - $y = $this->hPrint-130; |
|
1303 | + $y = $this->hPrint - 130; |
|
1310 | 1304 | $h = 25; |
1311 | - $w = $maxW-(2*$x); |
|
1305 | + $w = $maxW - (2 * $x); |
|
1312 | 1306 | $this->pdf->SetTextColor(200, 200, 200); |
1313 | - $texto = "DANFE impresso em contingência -\n". |
|
1314 | - "DPEC regularmente recebido pela Receita\n". |
|
1307 | + $texto = "DANFE impresso em contingência -\n" . |
|
1308 | + "DPEC regularmente recebido pela Receita\n" . |
|
1315 | 1309 | "Federal do Brasil"; |
1316 | 1310 | $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'); |
1317 | 1311 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
@@ -1320,22 +1314,22 @@ discard block |
||
1320 | 1314 | if ($this->pNotaDenegada()) { |
1321 | 1315 | //110 301 302 Denegada |
1322 | 1316 | $x = 10; |
1323 | - $y = $this->hPrint-130; |
|
1317 | + $y = $this->hPrint - 130; |
|
1324 | 1318 | $h = 25; |
1325 | - $w = $maxW-(2*$x); |
|
1319 | + $w = $maxW - (2 * $x); |
|
1326 | 1320 | $this->pdf->SetTextColor(90, 90, 90); |
1327 | 1321 | $texto = "NFe USO DENEGADO"; |
1328 | 1322 | $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'); |
1329 | 1323 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
1330 | 1324 | $y += $h; |
1331 | 1325 | $h = 5; |
1332 | - $w = $maxW-(2*$x); |
|
1326 | + $w = $maxW - (2 * $x); |
|
1333 | 1327 | if (isset($this->infProt)) { |
1334 | 1328 | $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue; |
1335 | 1329 | } else { |
1336 | 1330 | $xMotivo = ''; |
1337 | 1331 | } |
1338 | - $texto = "SEM VALOR FISCAL\n".$xMotivo; |
|
1332 | + $texto = "SEM VALOR FISCAL\n" . $xMotivo; |
|
1339 | 1333 | $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'); |
1340 | 1334 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
1341 | 1335 | $this->pdf->SetTextColor(0, 0, 0); |
@@ -1344,29 +1338,29 @@ discard block |
||
1344 | 1338 | if ($tpAmb != 1) { |
1345 | 1339 | $x = 10; |
1346 | 1340 | if ($this->orientacao == 'P') { |
1347 | - $y = round($this->hPrint*2/3, 0); |
|
1341 | + $y = round($this->hPrint * 2 / 3, 0); |
|
1348 | 1342 | } else { |
1349 | - $y = round($this->hPrint/2, 0); |
|
1343 | + $y = round($this->hPrint / 2, 0); |
|
1350 | 1344 | } |
1351 | 1345 | $h = 5; |
1352 | - $w = $maxW-(2*$x); |
|
1346 | + $w = $maxW - (2 * $x); |
|
1353 | 1347 | $this->pdf->SetTextColor(90, 90, 90); |
1354 | 1348 | $texto = "SEM VALOR FISCAL"; |
1355 | 1349 | $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B'); |
1356 | 1350 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
1357 | 1351 | $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B'); |
1358 | 1352 | $texto = "AMBIENTE DE HOMOLOGAÇÃO"; |
1359 | - $this->pTextBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
1353 | + $this->pTextBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
1360 | 1354 | $this->pdf->SetTextColor(0, 0, 0); |
1361 | 1355 | } else { |
1362 | 1356 | $x = 10; |
1363 | 1357 | if ($this->orientacao == 'P') { |
1364 | - $y = round($this->hPrint*2/3, 0); |
|
1358 | + $y = round($this->hPrint * 2 / 3, 0); |
|
1365 | 1359 | } else { |
1366 | - $y = round($this->hPrint/2, 0); |
|
1360 | + $y = round($this->hPrint / 2, 0); |
|
1367 | 1361 | }//fim orientacao |
1368 | 1362 | $h = 5; |
1369 | - $w = $maxW-(2*$x); |
|
1363 | + $w = $maxW - (2 * $x); |
|
1370 | 1364 | $this->pdf->SetTextColor(90, 90, 90); |
1371 | 1365 | //indicar FALTA DO PROTOCOLO se NFe não for em contingência |
1372 | 1366 | if (($this->tpEmis == 2 || $this->tpEmis == 5) && !$this->pNotaDPEC()) { |
@@ -1376,7 +1370,7 @@ discard block |
||
1376 | 1370 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
1377 | 1371 | $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B'); |
1378 | 1372 | $texto = "devido à problemas técnicos"; |
1379 | - $this->pTextBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
1373 | + $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
1380 | 1374 | } else { |
1381 | 1375 | if (!isset($this->nfeProc)) { |
1382 | 1376 | if (!$this->pNotaDPEC()) { |
@@ -1387,9 +1381,9 @@ discard block |
||
1387 | 1381 | $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B'); |
1388 | 1382 | $texto = "FALTA PROTOCOLO DE APROVAÇÃO DA SEFAZ"; |
1389 | 1383 | if (!$this->pNotaDPEC()) { |
1390 | - $this->pTextBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
1384 | + $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
1391 | 1385 | } else { |
1392 | - $this->pTextBox($x, $y+25, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
1386 | + $this->pTextBox($x, $y + 25, $w, $h, $texto, $aFont, 'C', 'C', 0, ''); |
|
1393 | 1387 | } |
1394 | 1388 | }//fim nefProc |
1395 | 1389 | }//fim tpEmis |
@@ -1424,7 +1418,7 @@ discard block |
||
1424 | 1418 | $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'); |
1425 | 1419 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
1426 | 1420 | //NOME / RAZÃO SOCIAL |
1427 | - $w = round($maxW*0.61, 0); |
|
1421 | + $w = round($maxW * 0.61, 0); |
|
1428 | 1422 | $w1 = $w; |
1429 | 1423 | $y += 3; |
1430 | 1424 | $texto = 'NOME / RAZÃO SOCIAL'; |
@@ -1439,19 +1433,19 @@ discard block |
||
1439 | 1433 | } |
1440 | 1434 | //CNPJ / CPF |
1441 | 1435 | $x += $w; |
1442 | - $w = round($maxW*0.23, 0); |
|
1436 | + $w = round($maxW * 0.23, 0); |
|
1443 | 1437 | $w2 = $w; |
1444 | 1438 | $texto = 'CNPJ / CPF'; |
1445 | 1439 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1446 | 1440 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
1447 | 1441 | //Pegando valor do CPF/CNPJ |
1448 | - if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) { |
|
1442 | + if (!empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) { |
|
1449 | 1443 | $texto = $this->pFormat( |
1450 | 1444 | $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue, |
1451 | 1445 | "###.###.###/####-##" |
1452 | 1446 | ); |
1453 | 1447 | } else { |
1454 | - $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ? |
|
1448 | + $texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ? |
|
1455 | 1449 | $this->pFormat( |
1456 | 1450 | $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue, |
1457 | 1451 | "###.###.###-##" |
@@ -1461,15 +1455,15 @@ discard block |
||
1461 | 1455 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, ''); |
1462 | 1456 | //DATA DA EMISSÃO |
1463 | 1457 | $x += $w; |
1464 | - $w = $maxW-($w1+$w2); |
|
1458 | + $w = $maxW - ($w1 + $w2); |
|
1465 | 1459 | $wx = $w; |
1466 | 1460 | $texto = 'DATA DA EMISSÃO'; |
1467 | 1461 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1468 | 1462 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
1469 | - $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ? |
|
1463 | + $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ? |
|
1470 | 1464 | $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : ''; |
1471 | 1465 | if ($dEmi == '') { |
1472 | - $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ? |
|
1466 | + $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ? |
|
1473 | 1467 | $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : ''; |
1474 | 1468 | $aDemi = explode('T', $dEmi); |
1475 | 1469 | $dEmi = $aDemi[0]; |
@@ -1482,7 +1476,7 @@ discard block |
||
1482 | 1476 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, ''); |
1483 | 1477 | } |
1484 | 1478 | //ENDEREÇO |
1485 | - $w = round($maxW*0.47, 0); |
|
1479 | + $w = round($maxW * 0.47, 0); |
|
1486 | 1480 | $w1 = $w; |
1487 | 1481 | $y += $h; |
1488 | 1482 | $x = $oldX; |
@@ -1497,7 +1491,7 @@ discard block |
||
1497 | 1491 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true); |
1498 | 1492 | //BAIRRO / DISTRITO |
1499 | 1493 | $x += $w; |
1500 | - $w = round($maxW*0.21, 0); |
|
1494 | + $w = round($maxW * 0.21, 0); |
|
1501 | 1495 | $w2 = $w; |
1502 | 1496 | $texto = 'BAIRRO / DISTRITO'; |
1503 | 1497 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
@@ -1507,12 +1501,12 @@ discard block |
||
1507 | 1501 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, ''); |
1508 | 1502 | //CEP |
1509 | 1503 | $x += $w; |
1510 | - $w = $maxW-$w1-$w2-$wx; |
|
1504 | + $w = $maxW - $w1 - $w2 - $wx; |
|
1511 | 1505 | $w2 = $w; |
1512 | 1506 | $texto = 'CEP'; |
1513 | 1507 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1514 | 1508 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
1515 | - $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ? |
|
1509 | + $texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ? |
|
1516 | 1510 | $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue : ''; |
1517 | 1511 | $texto = $this->pFormat($texto, "#####-###"); |
1518 | 1512 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'); |
@@ -1523,10 +1517,10 @@ discard block |
||
1523 | 1517 | $texto = 'DATA DA SAÍDA/ENTRADA'; |
1524 | 1518 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1525 | 1519 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
1526 | - $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ? |
|
1520 | + $dSaiEnt = !empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ? |
|
1527 | 1521 | $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue : ''; |
1528 | 1522 | if ($dSaiEnt == '') { |
1529 | - $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ? |
|
1523 | + $dSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ? |
|
1530 | 1524 | $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : ''; |
1531 | 1525 | $aDsaient = explode('T', $dSaiEnt); |
1532 | 1526 | $dSaiEnt = $aDsaient[0]; |
@@ -1543,7 +1537,7 @@ discard block |
||
1543 | 1537 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
1544 | 1538 | $texto = $this->dest->getElementsByTagName("xMun")->item(0)->nodeValue; |
1545 | 1539 | if (strtoupper(trim($texto)) == "EXTERIOR" && $this->dest->getElementsByTagName("xPais")->length > 0) { |
1546 | - $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue; |
|
1540 | + $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue; |
|
1547 | 1541 | } |
1548 | 1542 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'); |
1549 | 1543 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, ''); |
@@ -1558,18 +1552,18 @@ discard block |
||
1558 | 1552 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, ''); |
1559 | 1553 | //FONE / FAX |
1560 | 1554 | $x += $w; |
1561 | - $w = round(($maxW -$w1-$wx-8)/2, 0); |
|
1555 | + $w = round(($maxW - $w1 - $wx - 8) / 2, 0); |
|
1562 | 1556 | $w3 = $w; |
1563 | 1557 | $texto = 'FONE / FAX'; |
1564 | 1558 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1565 | 1559 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
1566 | - $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ? |
|
1560 | + $texto = !empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ? |
|
1567 | 1561 | $this->dest->getElementsByTagName("fone")->item(0)->nodeValue : ''; |
1568 | 1562 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'); |
1569 | 1563 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, ''); |
1570 | 1564 | //INSCRIÇÃO ESTADUAL |
1571 | 1565 | $x += $w; |
1572 | - $w = $maxW -$w1-$wx-8-$w3; |
|
1566 | + $w = $maxW - $w1 - $wx - 8 - $w3; |
|
1573 | 1567 | $texto = 'INSCRIÇÃO ESTADUAL'; |
1574 | 1568 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1575 | 1569 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
@@ -1583,10 +1577,10 @@ discard block |
||
1583 | 1577 | $texto = 'HORA DA SAÍDA/ENTRADA'; |
1584 | 1578 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1585 | 1579 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
1586 | - $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ? |
|
1580 | + $hSaiEnt = !empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ? |
|
1587 | 1581 | $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue : ''; |
1588 | 1582 | if ($hSaiEnt == '') { |
1589 | - $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ? |
|
1583 | + $dhSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ? |
|
1590 | 1584 | $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : ''; |
1591 | 1585 | $tsDhSaiEnt = $this->pConvertTime($dhSaiEnt); |
1592 | 1586 | if ($tsDhSaiEnt != '') { |
@@ -1611,7 +1605,7 @@ discard block |
||
1611 | 1605 | if (isset($this->cobr)) { |
1612 | 1606 | $fat = $this->cobr->getElementsByTagName("fat")->item(0); |
1613 | 1607 | if (isset($fat)) { |
1614 | - $textoIndPag=""; |
|
1608 | + $textoIndPag = ""; |
|
1615 | 1609 | $indPag = $this->pSimpleGetValue($this->ide, "indPag"); |
1616 | 1610 | if ($indPag == 0) { |
1617 | 1611 | $textoIndPag = "Pagamento à Vista - "; |
@@ -1658,7 +1652,7 @@ discard block |
||
1658 | 1652 | protected function pFaturaDANFE($x, $y) |
1659 | 1653 | { |
1660 | 1654 | $linha = 1; |
1661 | - $h = 8+3; |
|
1655 | + $h = 8 + 3; |
|
1662 | 1656 | $oldx = $x; |
1663 | 1657 | $textoFatura = $this->pGetTextoFatura(); |
1664 | 1658 | //verificar se existem duplicatas |
@@ -1679,27 +1673,27 @@ discard block |
||
1679 | 1673 | $dupcont = 0; |
1680 | 1674 | $nFat = $this->dup->length; |
1681 | 1675 | if ($textoFatura !== "" && $this->exibirTextoFatura) { |
1682 | - $myH=6; |
|
1676 | + $myH = 6; |
|
1683 | 1677 | $myW = $this->wPrint; |
1684 | 1678 | if ($this->orientacao == 'L') { |
1685 | 1679 | $myW -= $this->wCanhoto; |
1686 | 1680 | } |
1687 | 1681 | $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>''); |
1688 | 1682 | $this->pTextBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, ''); |
1689 | - $y+=$myH+1; |
|
1683 | + $y += $myH + 1; |
|
1690 | 1684 | } |
1691 | 1685 | if ($this->orientacao == 'P') { |
1692 | - $w = round($this->wPrint/7.018, 0)-1; |
|
1686 | + $w = round($this->wPrint / 7.018, 0) - 1; |
|
1693 | 1687 | } else { |
1694 | 1688 | $w = 28; |
1695 | 1689 | } |
1696 | 1690 | $increm = 1; |
1697 | 1691 | foreach ($this->dup as $k => $d) { |
1698 | - $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ? |
|
1692 | + $nDup = !empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ? |
|
1699 | 1693 | $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue : ''; |
1700 | - $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ? |
|
1694 | + $dDup = !empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ? |
|
1701 | 1695 | $this->pYmd2dmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) : ''; |
1702 | - $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ? |
|
1696 | + $vDup = !empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ? |
|
1703 | 1697 | 'R$ ' . number_format( |
1704 | 1698 | $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue, |
1705 | 1699 | 2, |
@@ -1708,14 +1702,14 @@ discard block |
||
1708 | 1702 | ) : ''; |
1709 | 1703 | $h = 8; |
1710 | 1704 | $texto = ''; |
1711 | - if ($nDup!='0' && $nDup!='') { |
|
1705 | + if ($nDup != '0' && $nDup != '') { |
|
1712 | 1706 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1713 | 1707 | $this->pTextBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, ''); |
1714 | 1708 | $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'); |
1715 | 1709 | $this->pTextBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, ''); |
1716 | 1710 | } else { |
1717 | 1711 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1718 | - $this->pTextBox($x, $y, $w, $h, ($dupcont+1)."", $aFont, 'T', 'L', 1, ''); |
|
1712 | + $this->pTextBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, ''); |
|
1719 | 1713 | } |
1720 | 1714 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1721 | 1715 | $this->pTextBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, ''); |
@@ -1725,7 +1719,7 @@ discard block |
||
1725 | 1719 | $this->pTextBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, ''); |
1726 | 1720 | $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'); |
1727 | 1721 | $this->pTextBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, ''); |
1728 | - $x += $w+$increm; |
|
1722 | + $x += $w + $increm; |
|
1729 | 1723 | $dupcont += 1; |
1730 | 1724 | if ($this->orientacao == 'P') { |
1731 | 1725 | $maxDupCont = 6; |
@@ -1747,10 +1741,10 @@ discard block |
||
1747 | 1741 | $y -= 9; |
1748 | 1742 | $linha--; |
1749 | 1743 | } |
1750 | - return ($y+$h); |
|
1744 | + return ($y + $h); |
|
1751 | 1745 | } else { |
1752 | 1746 | $linha = 0; |
1753 | - return ($y-2); |
|
1747 | + return ($y - 2); |
|
1754 | 1748 | } |
1755 | 1749 | } //fim da função faturaDANFE |
1756 | 1750 | |
@@ -1862,7 +1856,7 @@ discard block |
||
1862 | 1856 | } |
1863 | 1857 | $x = $this->pImpostoDanfeHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF"); |
1864 | 1858 | |
1865 | - return ($y+$h); |
|
1859 | + return ($y + $h); |
|
1866 | 1860 | } //fim impostoDANFE |
1867 | 1861 | |
1868 | 1862 | /** |
@@ -1890,13 +1884,13 @@ discard block |
||
1890 | 1884 | $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'); |
1891 | 1885 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
1892 | 1886 | //NOME / RAZÃO SOCIAL |
1893 | - $w1 = $maxW*0.29; |
|
1887 | + $w1 = $maxW * 0.29; |
|
1894 | 1888 | $y += 3; |
1895 | 1889 | $texto = 'NOME / RAZÃO SOCIAL'; |
1896 | 1890 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1897 | 1891 | $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, ''); |
1898 | 1892 | if (isset($this->transporta)) { |
1899 | - $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ? |
|
1893 | + $texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ? |
|
1900 | 1894 | $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue : ''; |
1901 | 1895 | } else { |
1902 | 1896 | $texto = ''; |
@@ -1905,11 +1899,11 @@ discard block |
||
1905 | 1899 | $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, ''); |
1906 | 1900 | //FRETE POR CONTA |
1907 | 1901 | $x += $w1; |
1908 | - $w2 = $maxW*0.15; |
|
1902 | + $w2 = $maxW * 0.15; |
|
1909 | 1903 | $texto = 'FRETE POR CONTA'; |
1910 | 1904 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1911 | 1905 | $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, ''); |
1912 | - $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ? |
|
1906 | + $tipoFrete = !empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ? |
|
1913 | 1907 | $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue : '0'; |
1914 | 1908 | switch ($tipoFrete) { |
1915 | 1909 | case 0: |
@@ -1933,7 +1927,7 @@ discard block |
||
1933 | 1927 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1934 | 1928 | $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, ''); |
1935 | 1929 | if (isset($this->veicTransp)) { |
1936 | - $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ? |
|
1930 | + $texto = !empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ? |
|
1937 | 1931 | $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue : ''; |
1938 | 1932 | } else { |
1939 | 1933 | $texto = ''; |
@@ -1946,10 +1940,10 @@ discard block |
||
1946 | 1940 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1947 | 1941 | $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, ''); |
1948 | 1942 | if (isset($this->veicTransp)) { |
1949 | - $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ? |
|
1943 | + $texto = !empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ? |
|
1950 | 1944 | $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue : ''; |
1951 | 1945 | } elseif (isset($this->reboque)) { |
1952 | - $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ? |
|
1946 | + $texto = !empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ? |
|
1953 | 1947 | $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue : ''; |
1954 | 1948 | } else { |
1955 | 1949 | $texto = ''; |
@@ -1958,15 +1952,15 @@ discard block |
||
1958 | 1952 | $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, ''); |
1959 | 1953 | //UF |
1960 | 1954 | $x += $w2; |
1961 | - $w3 = round($maxW*0.04, 0); |
|
1955 | + $w3 = round($maxW * 0.04, 0); |
|
1962 | 1956 | $texto = 'UF'; |
1963 | 1957 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1964 | 1958 | $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, ''); |
1965 | 1959 | if (isset($this->veicTransp)) { |
1966 | - $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ? |
|
1960 | + $texto = !empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ? |
|
1967 | 1961 | $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue : ''; |
1968 | 1962 | } elseif (isset($this->reboque)) { |
1969 | - $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ? |
|
1963 | + $texto = !empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ? |
|
1970 | 1964 | $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue : ''; |
1971 | 1965 | } else { |
1972 | 1966 | $texto = ''; |
@@ -1975,18 +1969,18 @@ discard block |
||
1975 | 1969 | $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, ''); |
1976 | 1970 | //CNPJ / CPF |
1977 | 1971 | $x += $w3; |
1978 | - $w = $maxW-($w1+3*$w2+$w3); |
|
1972 | + $w = $maxW - ($w1 + 3 * $w2 + $w3); |
|
1979 | 1973 | $texto = 'CNPJ / CPF'; |
1980 | 1974 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
1981 | 1975 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
1982 | 1976 | if (isset($this->transporta)) { |
1983 | - $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ? |
|
1977 | + $texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ? |
|
1984 | 1978 | $this->pFormat( |
1985 | 1979 | $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue, |
1986 | 1980 | "##.###.###/####-##" |
1987 | 1981 | ) : ''; |
1988 | 1982 | if ($texto == '') { |
1989 | - $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ? |
|
1983 | + $texto = !empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ? |
|
1990 | 1984 | $this->pFormat( |
1991 | 1985 | $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue, |
1992 | 1986 | "###.###.###-##" |
@@ -2002,12 +1996,12 @@ discard block |
||
2002 | 1996 | $y += $h; |
2003 | 1997 | $x = $oldX; |
2004 | 1998 | $h = 7; |
2005 | - $w1 = $maxW*0.44; |
|
1999 | + $w1 = $maxW * 0.44; |
|
2006 | 2000 | $texto = 'ENDEREÇO'; |
2007 | 2001 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2008 | 2002 | $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, ''); |
2009 | 2003 | if (isset($this->transporta)) { |
2010 | - $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ? |
|
2004 | + $texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ? |
|
2011 | 2005 | $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue : ''; |
2012 | 2006 | } else { |
2013 | 2007 | $texto = ''; |
@@ -2016,12 +2010,12 @@ discard block |
||
2016 | 2010 | $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, ''); |
2017 | 2011 | //MUNICÍPIO |
2018 | 2012 | $x += $w1; |
2019 | - $w2 = round($maxW*0.30, 0); |
|
2013 | + $w2 = round($maxW * 0.30, 0); |
|
2020 | 2014 | $texto = 'MUNICÍPIO'; |
2021 | 2015 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2022 | 2016 | $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, ''); |
2023 | 2017 | if (isset($this->transporta)) { |
2024 | - $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ? |
|
2018 | + $texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ? |
|
2025 | 2019 | $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue : ''; |
2026 | 2020 | } else { |
2027 | 2021 | $texto = ''; |
@@ -2030,12 +2024,12 @@ discard block |
||
2030 | 2024 | $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, ''); |
2031 | 2025 | //UF |
2032 | 2026 | $x += $w2; |
2033 | - $w3 = round($maxW*0.04, 0); |
|
2027 | + $w3 = round($maxW * 0.04, 0); |
|
2034 | 2028 | $texto = 'UF'; |
2035 | 2029 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2036 | 2030 | $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, ''); |
2037 | 2031 | if (isset($this->transporta)) { |
2038 | - $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ? |
|
2032 | + $texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ? |
|
2039 | 2033 | $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue : ''; |
2040 | 2034 | } else { |
2041 | 2035 | $texto = ''; |
@@ -2044,13 +2038,13 @@ discard block |
||
2044 | 2038 | $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, ''); |
2045 | 2039 | //INSCRIÇÃO ESTADUAL |
2046 | 2040 | $x += $w3; |
2047 | - $w = $maxW-($w1+$w2+$w3); |
|
2041 | + $w = $maxW - ($w1 + $w2 + $w3); |
|
2048 | 2042 | $texto = 'INSCRIÇÃO ESTADUAL'; |
2049 | 2043 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2050 | 2044 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
2051 | 2045 | $texto = ''; |
2052 | 2046 | if (isset($this->transporta)) { |
2053 | - if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) { |
|
2047 | + if (!empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) { |
|
2054 | 2048 | $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue; |
2055 | 2049 | } |
2056 | 2050 | } |
@@ -2063,16 +2057,16 @@ discard block |
||
2063 | 2057 | $marca = ''; |
2064 | 2058 | $numero = ''; |
2065 | 2059 | $texto = ''; |
2066 | - $pesoBruto=0; |
|
2067 | - $pesoLiquido=0; |
|
2060 | + $pesoBruto = 0; |
|
2061 | + $pesoLiquido = 0; |
|
2068 | 2062 | foreach ($volumes as $volume) { |
2069 | - $quantidade += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ? |
|
2063 | + $quantidade += !empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ? |
|
2070 | 2064 | $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0; |
2071 | - $pesoBruto += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ? |
|
2065 | + $pesoBruto += !empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ? |
|
2072 | 2066 | $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0; |
2073 | - $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ? |
|
2067 | + $pesoLiquido += !empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ? |
|
2074 | 2068 | $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0; |
2075 | - $texto = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ? |
|
2069 | + $texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ? |
|
2076 | 2070 | $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : ''; |
2077 | 2071 | if ($texto != $especie && $especie != '') { |
2078 | 2072 | //tem várias especies |
@@ -2080,7 +2074,7 @@ discard block |
||
2080 | 2074 | } else { |
2081 | 2075 | $especie = $texto; |
2082 | 2076 | } |
2083 | - $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ? |
|
2077 | + $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ? |
|
2084 | 2078 | $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : ''; |
2085 | 2079 | if ($texto != $marca && $marca != '') { |
2086 | 2080 | //tem várias especies |
@@ -2088,7 +2082,7 @@ discard block |
||
2088 | 2082 | } else { |
2089 | 2083 | $marca = $texto; |
2090 | 2084 | } |
2091 | - $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ? |
|
2085 | + $texto = !empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ? |
|
2092 | 2086 | $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue : ''; |
2093 | 2087 | if ($texto != $numero && $numero != '') { |
2094 | 2088 | //tem várias especies |
@@ -2103,7 +2097,7 @@ discard block |
||
2103 | 2097 | $y += $h; |
2104 | 2098 | $x = $oldX; |
2105 | 2099 | $h = 7; |
2106 | - $w1 = round($maxW*0.10, 0); |
|
2100 | + $w1 = round($maxW * 0.10, 0); |
|
2107 | 2101 | $texto = 'QUANTIDADE'; |
2108 | 2102 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2109 | 2103 | $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, ''); |
@@ -2114,7 +2108,7 @@ discard block |
||
2114 | 2108 | } |
2115 | 2109 | //ESPÉCIE |
2116 | 2110 | $x += $w1; |
2117 | - $w2 = round($maxW*0.17, 0); |
|
2111 | + $w2 = round($maxW * 0.17, 0); |
|
2118 | 2112 | $texto = 'ESPÉCIE'; |
2119 | 2113 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2120 | 2114 | $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, ''); |
@@ -2126,7 +2120,7 @@ discard block |
||
2126 | 2120 | $texto = 'MARCA'; |
2127 | 2121 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2128 | 2122 | $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, ''); |
2129 | - $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ? |
|
2123 | + $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ? |
|
2130 | 2124 | $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : ''; |
2131 | 2125 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'); |
2132 | 2126 | $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, ''); |
@@ -2140,7 +2134,7 @@ discard block |
||
2140 | 2134 | $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, ''); |
2141 | 2135 | //PESO BRUTO |
2142 | 2136 | $x += $w2; |
2143 | - $w3 = round($maxW*0.20, 0); |
|
2137 | + $w3 = round($maxW * 0.20, 0); |
|
2144 | 2138 | $texto = 'PESO BRUTO'; |
2145 | 2139 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2146 | 2140 | $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, ''); |
@@ -2153,7 +2147,7 @@ discard block |
||
2153 | 2147 | $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, ''); |
2154 | 2148 | //PESO LÍQUIDO |
2155 | 2149 | $x += $w3; |
2156 | - $w = $maxW -($w1+3*$w2+$w3); |
|
2150 | + $w = $maxW - ($w1 + 3 * $w2 + $w3); |
|
2157 | 2151 | $texto = 'PESO LÍQUIDO'; |
2158 | 2152 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2159 | 2153 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
@@ -2164,7 +2158,7 @@ discard block |
||
2164 | 2158 | } |
2165 | 2159 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'); |
2166 | 2160 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, ''); |
2167 | - return ($y+$h); |
|
2161 | + return ($y + $h); |
|
2168 | 2162 | } //fim transporteDANFE |
2169 | 2163 | |
2170 | 2164 | |
@@ -2176,7 +2170,7 @@ discard block |
||
2176 | 2170 | return ""; |
2177 | 2171 | } |
2178 | 2172 | $valor_original = $valor_original->nodeValue; |
2179 | - $valor = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : ''; |
|
2173 | + $valor = !empty($valor_original) ? number_format($valor_original, 2, ",", ".") : ''; |
|
2180 | 2174 | |
2181 | 2175 | if ($valor != "") { |
2182 | 2176 | return sprintf($formato, $valor); |
@@ -2214,13 +2208,13 @@ discard block |
||
2214 | 2208 | $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s"); |
2215 | 2209 | $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s"); |
2216 | 2210 | } |
2217 | - $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ? |
|
2211 | + $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ? |
|
2218 | 2212 | substr($this->pAnfavea($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue), 0, 500) : ''; |
2219 | - if (! empty($infAdProd)) { |
|
2213 | + if (!empty($infAdProd)) { |
|
2220 | 2214 | $infAdProd = trim($infAdProd); |
2221 | 2215 | $infAdProd .= ' '; |
2222 | 2216 | } |
2223 | - $medTxt=''; |
|
2217 | + $medTxt = ''; |
|
2224 | 2218 | $med = $prod->getElementsByTagName("med"); |
2225 | 2219 | if (isset($med)) { |
2226 | 2220 | $i = 0; |
@@ -2233,14 +2227,14 @@ discard block |
||
2233 | 2227 | $i++; |
2234 | 2228 | } |
2235 | 2229 | if ($medTxt != '') { |
2236 | - $medTxt.= ' '; |
|
2230 | + $medTxt .= ' '; |
|
2237 | 2231 | } |
2238 | 2232 | } |
2239 | 2233 | //NT2013.006 FCI |
2240 | - $nFCI = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ? |
|
2241 | - ' FCI:'.$itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : ''; |
|
2242 | - $tmp_ad=$infAdProd . ($this->descProdInfoComplemento ? $medTxt . $impostos . $nFCI : ''); |
|
2243 | - $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad)!=0?"\n ".$tmp_ad:''); |
|
2234 | + $nFCI = (!empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ? |
|
2235 | + ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : ''; |
|
2236 | + $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $medTxt . $impostos . $nFCI : ''); |
|
2237 | + $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad) != 0 ? "\n " . $tmp_ad : ''); |
|
2244 | 2238 | if ($this->descProdQuebraLinha) { |
2245 | 2239 | $texto = str_replace(";", "\n", $texto); |
2246 | 2240 | } |
@@ -2288,104 +2282,104 @@ discard block |
||
2288 | 2282 | // cabecalho LOOP COM OS DADOS DOS PRODUTOS |
2289 | 2283 | //CÓDIGO PRODUTO |
2290 | 2284 | $texto = "CÓDIGO PRODUTO"; |
2291 | - $w1 = round($w*0.09, 0); |
|
2285 | + $w1 = round($w * 0.09, 0); |
|
2292 | 2286 | $h = 4; |
2293 | 2287 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2294 | 2288 | $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
2295 | - $this->pdf->Line($x+$w1, $y, $x+$w1, $y+$hmax); |
|
2289 | + $this->pdf->Line($x + $w1, $y, $x + $w1, $y + $hmax); |
|
2296 | 2290 | //DESCRIÇÃO DO PRODUTO / SERVIÇO |
2297 | 2291 | $x += $w1; |
2298 | - $w2 = round($w*0.28, 0); |
|
2292 | + $w2 = round($w * 0.28, 0); |
|
2299 | 2293 | $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO'; |
2300 | 2294 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2301 | 2295 | $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
2302 | - $this->pdf->Line($x+$w2, $y, $x+$w2, $y+$hmax); |
|
2296 | + $this->pdf->Line($x + $w2, $y, $x + $w2, $y + $hmax); |
|
2303 | 2297 | //NCM/SH |
2304 | 2298 | $x += $w2; |
2305 | - $w3 = round($w*0.06, 0); |
|
2299 | + $w3 = round($w * 0.06, 0); |
|
2306 | 2300 | $texto = 'NCM/SH'; |
2307 | 2301 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2308 | 2302 | $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
2309 | - $this->pdf->Line($x+$w3, $y, $x+$w3, $y+$hmax); |
|
2303 | + $this->pdf->Line($x + $w3, $y, $x + $w3, $y + $hmax); |
|
2310 | 2304 | //O/CST ou O/CSOSN |
2311 | 2305 | $x += $w3; |
2312 | - $w4 = round($w*0.05, 0); |
|
2313 | - $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2 |
|
2306 | + $w4 = round($w * 0.05, 0); |
|
2307 | + $texto = 'O/CSOSN'; //Regime do Simples CRT = 1 ou CRT = 2 |
|
2314 | 2308 | if ($this->pSimpleGetValue($this->emit, 'CRT') == '3') { |
2315 | - $texto = 'O/CST';//Regime Normal |
|
2309 | + $texto = 'O/CST'; //Regime Normal |
|
2316 | 2310 | } |
2317 | 2311 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2318 | 2312 | $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
2319 | - $this->pdf->Line($x+$w4, $y, $x+$w4, $y+$hmax); |
|
2313 | + $this->pdf->Line($x + $w4, $y, $x + $w4, $y + $hmax); |
|
2320 | 2314 | //CFOP |
2321 | 2315 | $x += $w4; |
2322 | - $w5 = round($w*0.04, 0); |
|
2316 | + $w5 = round($w * 0.04, 0); |
|
2323 | 2317 | $texto = 'CFOP'; |
2324 | 2318 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2325 | 2319 | $this->pTextBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
2326 | - $this->pdf->Line($x+$w5, $y, $x+$w5, $y+$hmax); |
|
2320 | + $this->pdf->Line($x + $w5, $y, $x + $w5, $y + $hmax); |
|
2327 | 2321 | //UN |
2328 | 2322 | $x += $w5; |
2329 | - $w6 = round($w*0.03, 0); |
|
2323 | + $w6 = round($w * 0.03, 0); |
|
2330 | 2324 | $texto = 'UN'; |
2331 | 2325 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2332 | 2326 | $this->pTextBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
2333 | - $this->pdf->Line($x+$w6, $y, $x+$w6, $y+$hmax); |
|
2327 | + $this->pdf->Line($x + $w6, $y, $x + $w6, $y + $hmax); |
|
2334 | 2328 | //QUANT |
2335 | 2329 | $x += $w6; |
2336 | - $w7 = round($w*0.07, 0); |
|
2330 | + $w7 = round($w * 0.07, 0); |
|
2337 | 2331 | $texto = 'QUANT'; |
2338 | 2332 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2339 | 2333 | $this->pTextBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
2340 | - $this->pdf->Line($x+$w7, $y, $x+$w7, $y+$hmax); |
|
2334 | + $this->pdf->Line($x + $w7, $y, $x + $w7, $y + $hmax); |
|
2341 | 2335 | //VALOR UNIT |
2342 | 2336 | $x += $w7; |
2343 | - $w8 = round($w*0.06, 0); |
|
2337 | + $w8 = round($w * 0.06, 0); |
|
2344 | 2338 | $texto = 'VALOR UNIT'; |
2345 | 2339 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2346 | 2340 | $this->pTextBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
2347 | - $this->pdf->Line($x+$w8, $y, $x+$w8, $y+$hmax); |
|
2341 | + $this->pdf->Line($x + $w8, $y, $x + $w8, $y + $hmax); |
|
2348 | 2342 | //VALOR TOTAL |
2349 | 2343 | $x += $w8; |
2350 | - $w9 = round($w*0.06, 0); |
|
2344 | + $w9 = round($w * 0.06, 0); |
|
2351 | 2345 | $texto = 'VALOR TOTAL'; |
2352 | 2346 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2353 | 2347 | $this->pTextBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
2354 | - $this->pdf->Line($x+$w9, $y, $x+$w9, $y+$hmax); |
|
2348 | + $this->pdf->Line($x + $w9, $y, $x + $w9, $y + $hmax); |
|
2355 | 2349 | //B.CÁLC ICMS |
2356 | 2350 | $x += $w9; |
2357 | - $w10 = round($w*0.06, 0); |
|
2351 | + $w10 = round($w * 0.06, 0); |
|
2358 | 2352 | $texto = 'B.CÁLC ICMS'; |
2359 | 2353 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2360 | 2354 | $this->pTextBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
2361 | - $this->pdf->Line($x+$w10, $y, $x+$w10, $y+$hmax); |
|
2355 | + $this->pdf->Line($x + $w10, $y, $x + $w10, $y + $hmax); |
|
2362 | 2356 | //VALOR ICMS |
2363 | 2357 | $x += $w10; |
2364 | - $w11 = round($w*0.06, 0); |
|
2358 | + $w11 = round($w * 0.06, 0); |
|
2365 | 2359 | $texto = 'VALOR ICMS'; |
2366 | 2360 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2367 | 2361 | $this->pTextBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
2368 | - $this->pdf->Line($x+$w11, $y, $x+$w11, $y+$hmax); |
|
2362 | + $this->pdf->Line($x + $w11, $y, $x + $w11, $y + $hmax); |
|
2369 | 2363 | //VALOR IPI |
2370 | 2364 | $x += $w11; |
2371 | - $w12 = round($w*0.05, 0); |
|
2365 | + $w12 = round($w * 0.05, 0); |
|
2372 | 2366 | $texto = 'VALOR IPI'; |
2373 | 2367 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2374 | 2368 | $this->pTextBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
2375 | - $this->pdf->Line($x+$w12, $y, $x+$w12, $y+$hmax); |
|
2369 | + $this->pdf->Line($x + $w12, $y, $x + $w12, $y + $hmax); |
|
2376 | 2370 | //ALÍQ. ICMS |
2377 | 2371 | $x += $w12; |
2378 | - $w13 = round($w*0.035, 0); |
|
2372 | + $w13 = round($w * 0.035, 0); |
|
2379 | 2373 | $texto = 'ALÍQ. ICMS'; |
2380 | 2374 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2381 | 2375 | $this->pTextBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
2382 | - $this->pdf->Line($x+$w13, $y, $x+$w13, $y+$hmax); |
|
2376 | + $this->pdf->Line($x + $w13, $y, $x + $w13, $y + $hmax); |
|
2383 | 2377 | //ALÍQ. IPI |
2384 | 2378 | $x += $w13; |
2385 | - $w14 = $w-($w1+$w2+$w3+$w4+$w5+$w6+$w7+$w8+$w9+$w10+$w11+$w12+$w13); |
|
2379 | + $w14 = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13); |
|
2386 | 2380 | $texto = 'ALÍQ. IPI'; |
2387 | 2381 | $this->pTextBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false); |
2388 | - $this->pdf->Line($oldX, $y+$h+1, $oldX + $w, $y+$h+1); |
|
2382 | + $this->pdf->Line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1); |
|
2389 | 2383 | $y += 5; |
2390 | 2384 | //################################################################################## |
2391 | 2385 | // LOOP COM OS DADOS DOS PRODUTOS |
@@ -2402,7 +2396,7 @@ discard block |
||
2402 | 2396 | $IPI = $imposto->getElementsByTagName("IPI")->item(0); |
2403 | 2397 | $textoProduto = $this->pDescricaoProduto($thisItem); |
2404 | 2398 | $linhaDescr = $this->pGetNumLines($textoProduto, $w2, $aFont); |
2405 | - $h = round(($linhaDescr * $this->pdf->fontSize)+ ($linhaDescr * 0.5), 2); |
|
2399 | + $h = round(($linhaDescr * $this->pdf->fontSize) + ($linhaDescr * 0.5), 2); |
|
2406 | 2400 | $hUsado += $h; |
2407 | 2401 | if ($pag != $totpag) { |
2408 | 2402 | if ($hUsado >= $hmax && $i < $totItens) { |
@@ -2412,11 +2406,11 @@ discard block |
||
2412 | 2406 | break; |
2413 | 2407 | } |
2414 | 2408 | } |
2415 | - $y_linha=$y+$h; |
|
2409 | + $y_linha = $y + $h; |
|
2416 | 2410 | // linha entre itens |
2417 | 2411 | $this->pdf->DashedHLine($oldX, $y_linha, $w, 0.1, 120); |
2418 | 2412 | //corrige o x |
2419 | - $x=$oldX; |
|
2413 | + $x = $oldX; |
|
2420 | 2414 | //codigo do produto |
2421 | 2415 | $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue; |
2422 | 2416 | $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'C', 0, ''); |
@@ -2429,16 +2423,16 @@ discard block |
||
2429 | 2423 | } |
2430 | 2424 | $x += $w2; |
2431 | 2425 | //NCM |
2432 | - $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ? |
|
2426 | + $texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ? |
|
2433 | 2427 | $prod->getElementsByTagName("NCM")->item(0)->nodeValue : ''; |
2434 | 2428 | $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, ''); |
2435 | 2429 | $x += $w3; |
2436 | 2430 | //CST |
2437 | 2431 | if (isset($ICMS)) { |
2438 | - $origem = $this->pSimpleGetValue($ICMS, "orig"); |
|
2439 | - $cst = $this->pSimpleGetValue($ICMS, "CST"); |
|
2440 | - $csosn = $this->pSimpleGetValue($ICMS, "CSOSN"); |
|
2441 | - $texto = $origem.$cst.$csosn; |
|
2432 | + $origem = $this->pSimpleGetValue($ICMS, "orig"); |
|
2433 | + $cst = $this->pSimpleGetValue($ICMS, "CST"); |
|
2434 | + $csosn = $this->pSimpleGetValue($ICMS, "CSOSN"); |
|
2435 | + $texto = $origem . $cst . $csosn; |
|
2442 | 2436 | $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, ''); |
2443 | 2437 | } |
2444 | 2438 | //CFOP |
@@ -2472,7 +2466,7 @@ discard block |
||
2472 | 2466 | //Valor da Base de calculo |
2473 | 2467 | $x += $w9; |
2474 | 2468 | if (isset($ICMS)) { |
2475 | - $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ? |
|
2469 | + $texto = !empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ? |
|
2476 | 2470 | number_format( |
2477 | 2471 | $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue, |
2478 | 2472 | 2, |
@@ -2484,7 +2478,7 @@ discard block |
||
2484 | 2478 | //Valor do ICMS |
2485 | 2479 | $x += $w10; |
2486 | 2480 | if (isset($ICMS)) { |
2487 | - $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ? |
|
2481 | + $texto = !empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ? |
|
2488 | 2482 | number_format( |
2489 | 2483 | $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue, |
2490 | 2484 | 2, |
@@ -2496,8 +2490,8 @@ discard block |
||
2496 | 2490 | //Valor do IPI |
2497 | 2491 | $x += $w11; |
2498 | 2492 | if (isset($IPI)) { |
2499 | - $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ? |
|
2500 | - number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") :''; |
|
2493 | + $texto = !empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ? |
|
2494 | + number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") : ''; |
|
2501 | 2495 | } else { |
2502 | 2496 | $texto = ''; |
2503 | 2497 | } |
@@ -2505,7 +2499,7 @@ discard block |
||
2505 | 2499 | // %ICMS |
2506 | 2500 | $x += $w12; |
2507 | 2501 | if (isset($ICMS)) { |
2508 | - $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ? |
|
2502 | + $texto = !empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ? |
|
2509 | 2503 | number_format( |
2510 | 2504 | $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue, |
2511 | 2505 | 2, |
@@ -2517,7 +2511,7 @@ discard block |
||
2517 | 2511 | //%IPI |
2518 | 2512 | $x += $w13; |
2519 | 2513 | if (isset($IPI)) { |
2520 | - $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ? |
|
2514 | + $texto = !empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ? |
|
2521 | 2515 | number_format($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue, 2, ",", ".") : ''; |
2522 | 2516 | } else { |
2523 | 2517 | $texto = ''; |
@@ -2531,7 +2525,7 @@ discard block |
||
2531 | 2525 | $i++; |
2532 | 2526 | } |
2533 | 2527 | } |
2534 | - return $oldY+$hmax; |
|
2528 | + return $oldY + $hmax; |
|
2535 | 2529 | } |
2536 | 2530 | |
2537 | 2531 | /** |
@@ -2555,12 +2549,12 @@ discard block |
||
2555 | 2549 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, ''); |
2556 | 2550 | //INSCRIÇÃO MUNICIPAL |
2557 | 2551 | $y += 3; |
2558 | - $w = round($this->wPrint*0.23, 0); |
|
2552 | + $w = round($this->wPrint * 0.23, 0); |
|
2559 | 2553 | $texto = 'INSCRIÇÃO MUNICIPAL'; |
2560 | 2554 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2561 | 2555 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
2562 | 2556 | //inscrição municipal |
2563 | - $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ? |
|
2557 | + $texto = !empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ? |
|
2564 | 2558 | $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : ''; |
2565 | 2559 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'); |
2566 | 2560 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, ''); |
@@ -2570,7 +2564,7 @@ discard block |
||
2570 | 2564 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2571 | 2565 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
2572 | 2566 | if (isset($this->ISSQNtot)) { |
2573 | - $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ? |
|
2567 | + $texto = !empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ? |
|
2574 | 2568 | $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : ''; |
2575 | 2569 | $texto = number_format($texto, 2, ",", "."); |
2576 | 2570 | } else { |
@@ -2584,9 +2578,9 @@ discard block |
||
2584 | 2578 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2585 | 2579 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
2586 | 2580 | if (isset($this->ISSQNtot)) { |
2587 | - $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ? |
|
2581 | + $texto = !empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ? |
|
2588 | 2582 | $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : ''; |
2589 | - $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : ''; |
|
2583 | + $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : ''; |
|
2590 | 2584 | } else { |
2591 | 2585 | $texto = ''; |
2592 | 2586 | } |
@@ -2597,21 +2591,21 @@ discard block |
||
2597 | 2591 | if ($this->orientacao == 'P') { |
2598 | 2592 | $w = $this->wPrint - (3 * $w); |
2599 | 2593 | } else { |
2600 | - $w = $this->wPrint - (3 * $w)-$this->wCanhoto; |
|
2594 | + $w = $this->wPrint - (3 * $w) - $this->wCanhoto; |
|
2601 | 2595 | } |
2602 | 2596 | $texto = 'VALOR TOTAL DO ISSQN'; |
2603 | 2597 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2604 | 2598 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
2605 | 2599 | if (isset($this->ISSQNtot)) { |
2606 | - $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ? |
|
2600 | + $texto = !empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ? |
|
2607 | 2601 | $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : ''; |
2608 | - $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : ''; |
|
2602 | + $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : ''; |
|
2609 | 2603 | } else { |
2610 | 2604 | $texto = ''; |
2611 | 2605 | } |
2612 | 2606 | $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B'); |
2613 | 2607 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, ''); |
2614 | - return ($y+$h+1); |
|
2608 | + return ($y + $h + 1); |
|
2615 | 2609 | } |
2616 | 2610 | |
2617 | 2611 | /** |
@@ -2632,7 +2626,7 @@ discard block |
||
2632 | 2626 | if ($this->orientacao == 'P') { |
2633 | 2627 | $w = $this->wPrint; |
2634 | 2628 | } else { |
2635 | - $w = $this->wPrint-$this->wCanhoto; |
|
2629 | + $w = $this->wPrint - $this->wCanhoto; |
|
2636 | 2630 | } |
2637 | 2631 | $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B'); |
2638 | 2632 | $this->pTextBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, ''); |
@@ -2648,15 +2642,15 @@ discard block |
||
2648 | 2642 | //$this->textoAdic com o texto completo do campo |
2649 | 2643 | $y += 1; |
2650 | 2644 | $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>''); |
2651 | - $this->pTextBox($x, $y+2, $w-2, $h-3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false); |
|
2645 | + $this->pTextBox($x, $y + 2, $w - 2, $h - 3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false); |
|
2652 | 2646 | //RESERVADO AO FISCO |
2653 | 2647 | $texto = "RESERVADO AO FISCO"; |
2654 | 2648 | $x += $w; |
2655 | 2649 | $y -= 1; |
2656 | 2650 | if ($this->orientacao == 'P') { |
2657 | - $w = $this->wPrint-$w; |
|
2651 | + $w = $this->wPrint - $w; |
|
2658 | 2652 | } else { |
2659 | - $w = $this->wPrint-$w-$this->wCanhoto; |
|
2653 | + $w = $this->wPrint - $w - $this->wCanhoto; |
|
2660 | 2654 | } |
2661 | 2655 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'B'); |
2662 | 2656 | $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, ''); |
@@ -2695,8 +2689,8 @@ discard block |
||
2695 | 2689 | } |
2696 | 2690 | $y += 2; |
2697 | 2691 | $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>''); |
2698 | - $this->pTextBox($x, $y, $w-2, $h-3, $texto, $aFont, 'T', 'L', 0, '', false); |
|
2699 | - return $y+$h; |
|
2692 | + $this->pTextBox($x, $y, $w - 2, $h - 3, $texto, $aFont, 'T', 'L', 0, '', false); |
|
2693 | + return $y + $h; |
|
2700 | 2694 | } |
2701 | 2695 | |
2702 | 2696 | /** |
@@ -2714,13 +2708,13 @@ discard block |
||
2714 | 2708 | if ($this->orientacao == 'P') { |
2715 | 2709 | $w = $this->wPrint; |
2716 | 2710 | } else { |
2717 | - $w = $this->wPrint-$this->wCanhoto; |
|
2711 | + $w = $this->wPrint - $this->wCanhoto; |
|
2718 | 2712 | $x = $this->wCanhoto; |
2719 | 2713 | } |
2720 | 2714 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I'); |
2721 | - $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s'); |
|
2715 | + $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s'); |
|
2722 | 2716 | $this->pTextBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false); |
2723 | - $texto = "DanfeNFePHP ver. " . $this->version . " Powered by NFePHP (GNU/GPLv3 GNU/LGPLv3) © www.nfephp.org"; |
|
2717 | + $texto = "DanfeNFePHP ver. " . $this->version . " Powered by NFePHP (GNU/GPLv3 GNU/LGPLv3) © www.nfephp.org"; |
|
2724 | 2718 | $this->pTextBox($x, $y, $w, 0, $texto, $aFont, 'T', 'R', false, 'http://www.nfephp.org'); |
2725 | 2719 | } |
2726 | 2720 | |
@@ -2773,9 +2767,9 @@ discard block |
||
2773 | 2767 | } else { |
2774 | 2768 | //linha separadora do canhoto - 238 |
2775 | 2769 | //posicao altura |
2776 | - $y = $this->wPrint-85; |
|
2770 | + $y = $this->wPrint - 85; |
|
2777 | 2771 | //altura |
2778 | - $w = $this->wPrint-85-24; |
|
2772 | + $w = $this->wPrint - 85 - 24; |
|
2779 | 2773 | } |
2780 | 2774 | $h = 10; |
2781 | 2775 | //desenha caixa |
@@ -2798,21 +2792,21 @@ discard block |
||
2798 | 2792 | $texto .= "AO LADO"; |
2799 | 2793 | } |
2800 | 2794 | $texto .= ". EMISSÃO: "; |
2801 | - $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ? |
|
2795 | + $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ? |
|
2802 | 2796 | $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : ''; |
2803 | 2797 | if ($dEmi == '') { |
2804 | - $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ? |
|
2798 | + $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ? |
|
2805 | 2799 | $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : ''; |
2806 | 2800 | $aDemi = explode('T', $dEmi); |
2807 | 2801 | $dEmi = $aDemi[0]; |
2808 | 2802 | } |
2809 | - $texto .= $this->pYmd2dmy($dEmi) ." "; |
|
2803 | + $texto .= $this->pYmd2dmy($dEmi) . " "; |
|
2810 | 2804 | $texto .= "VALOR TOTAL: R$ "; |
2811 | 2805 | $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " "; |
2812 | 2806 | $texto .= "DESTINATÁRIO: "; |
2813 | 2807 | $texto .= $destinatario; |
2814 | 2808 | if ($this->orientacao == 'P') { |
2815 | - $this->pTextBox($x, $y, $w-1, $h, $texto, $aFont, 'C', 'L', 0, '', false); |
|
2809 | + $this->pTextBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false); |
|
2816 | 2810 | $x1 = $x + $w; |
2817 | 2811 | $w1 = $this->wPrint - $w; |
2818 | 2812 | $texto = "NF-e"; |
@@ -2825,12 +2819,12 @@ discard block |
||
2825 | 2819 | //DATA DE RECEBIMENTO |
2826 | 2820 | $texto = "DATA DE RECEBIMENTO"; |
2827 | 2821 | $y += $h; |
2828 | - $w2 = round($this->wPrint*0.17, 0); //35; |
|
2822 | + $w2 = round($this->wPrint * 0.17, 0); //35; |
|
2829 | 2823 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2830 | 2824 | $this->pTextBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, ''); |
2831 | 2825 | //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR |
2832 | 2826 | $x += $w2; |
2833 | - $w3 = $w-$w2; |
|
2827 | + $w3 = $w - $w2; |
|
2834 | 2828 | $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR"; |
2835 | 2829 | $this->pTextBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, ''); |
2836 | 2830 | $x = $oldX; |
@@ -2840,7 +2834,7 @@ discard block |
||
2840 | 2834 | return $y; |
2841 | 2835 | } else { |
2842 | 2836 | $x--; |
2843 | - $x = $this->pTextBox90($x, $y, $w-1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false); |
|
2837 | + $x = $this->pTextBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false); |
|
2844 | 2838 | //NUMERO DA NOTA FISCAL LOGO NFE |
2845 | 2839 | $w1 = 16; |
2846 | 2840 | $x1 = $oldX; |
@@ -2854,18 +2848,18 @@ discard block |
||
2854 | 2848 | $this->pTextBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, ''); |
2855 | 2849 | //DATA DO RECEBIMENTO |
2856 | 2850 | $texto = "DATA DO RECEBIMENTO"; |
2857 | - $y = $this->wPrint-85; |
|
2851 | + $y = $this->wPrint - 85; |
|
2858 | 2852 | $x = 12; |
2859 | - $w2 = round($this->wPrint*0.17, 0); //35; |
|
2853 | + $w2 = round($this->wPrint * 0.17, 0); //35; |
|
2860 | 2854 | $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>''); |
2861 | 2855 | $this->pTextBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, ''); |
2862 | 2856 | //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR |
2863 | 2857 | $y -= $w2; |
2864 | - $w3 = $w-$w2; |
|
2858 | + $w3 = $w - $w2; |
|
2865 | 2859 | $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR"; |
2866 | 2860 | $aFont = array('font'=>$this->fontePadrao, 'size'=>5.7, 'style'=>''); |
2867 | 2861 | $x = $this->pTextBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, ''); |
2868 | - $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint-20, 67); |
|
2862 | + $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint - 20, 67); |
|
2869 | 2863 | return $x; |
2870 | 2864 | } |
2871 | 2865 | } |
@@ -2882,13 +2876,13 @@ discard block |
||
2882 | 2876 | { |
2883 | 2877 | $saida = ""; |
2884 | 2878 | if (isset($this->compra)) { |
2885 | - if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) { |
|
2879 | + if (!empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) { |
|
2886 | 2880 | $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue; |
2887 | 2881 | } |
2888 | - if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) { |
|
2882 | + if (!empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) { |
|
2889 | 2883 | $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue; |
2890 | 2884 | } |
2891 | - if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) { |
|
2885 | + if (!empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) { |
|
2892 | 2886 | $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue; |
2893 | 2887 | } |
2894 | 2888 | } |
@@ -2914,21 +2908,21 @@ discard block |
||
2914 | 2908 | if ($vICMS > 0) { |
2915 | 2909 | $vICMS = 1; |
2916 | 2910 | } |
2917 | - $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue; |
|
2911 | + $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue; |
|
2918 | 2912 | if ($icmss > 0) { |
2919 | 2913 | $icmss = 1; |
2920 | 2914 | } |
2921 | - $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ? |
|
2915 | + $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ? |
|
2922 | 2916 | $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : ''; |
2923 | 2917 | if ($dEmi == '') { |
2924 | - $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ? |
|
2918 | + $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ? |
|
2925 | 2919 | $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : ''; |
2926 | 2920 | $aDemi = explode('T', $dEmi); |
2927 | 2921 | $dEmi = $aDemi[0]; |
2928 | 2922 | } |
2929 | 2923 | $dd = $dEmi; |
2930 | 2924 | $rpos = strrpos($dd, '-'); |
2931 | - $dd = substr($dd, $rpos +1); |
|
2925 | + $dd = substr($dd, $rpos + 1); |
|
2932 | 2926 | $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd); |
2933 | 2927 | $chave = $chave . $this->pModulo11($chave); |
2934 | 2928 | return $chave; |
@@ -2949,7 +2943,7 @@ discard block |
||
2949 | 2943 | $formaNfRef = "\r\nNF Ref.: série:%d numero:%d emit:%s em %s modelo: %d"; |
2950 | 2944 | $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d"; |
2951 | 2945 | $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s"; |
2952 | - $saida=''; |
|
2946 | + $saida = ''; |
|
2953 | 2947 | $nfRefs = $this->ide->getElementsByTagName('NFref'); |
2954 | 2948 | if (0 === $nfRefs->length) { |
2955 | 2949 | return $saida; |
@@ -2962,7 +2956,7 @@ discard block |
||
2962 | 2956 | foreach ($refNFe as $chave_acessoRef) { |
2963 | 2957 | $chave_acesso = $chave_acessoRef->nodeValue; |
2964 | 2958 | $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave); |
2965 | - $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2); |
|
2959 | + $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2); |
|
2966 | 2960 | $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##"); |
2967 | 2961 | $serie = substr($chave_acesso, 22, 3); |
2968 | 2962 | $numero = substr($chave_acesso, 25, 9); |
@@ -2983,7 +2977,7 @@ discard block |
||
2983 | 2977 | foreach ($refCTe as $chave_acessoRef) { |
2984 | 2978 | $chave_acesso = $chave_acessoRef->nodeValue; |
2985 | 2979 | $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave); |
2986 | - $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2); |
|
2980 | + $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2); |
|
2987 | 2981 | $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##"); |
2988 | 2982 | $serie = substr($chave_acesso, 22, 3); |
2989 | 2983 | $numero = substr($chave_acesso, 25, 9); |
@@ -2999,10 +2993,9 @@ discard block |
||
2999 | 2993 | $refNFP = $nfRef->getElementsByTagName('refNFP'); |
3000 | 2994 | foreach ($refNFP as $umaRefNFe) { |
3001 | 2995 | $data = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue; |
3002 | - $cnpj = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ? |
|
3003 | - $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : |
|
3004 | - ''; |
|
3005 | - $cpf = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ? |
|
2996 | + $cnpj = !empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ? |
|
2997 | + $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : ''; |
|
2998 | + $cpf = !empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ? |
|
3006 | 2999 | $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : ''; |
3007 | 3000 | $mod = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue; |
3008 | 3001 | $serie = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue; |