Completed
Push — master ( d048fd...6d1a7c )
by Roberto
11:43 queued 07:32
created
src/CTe/Dacanc.php 4 patches
Doc Comments   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -64,9 +64,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -56,18 +56,18 @@
 block discarded – undo
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 = '',
Please login to merge, or discard this patch.
Spacing   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     
Please login to merge, or discard this patch.
src/CTe/Daevento.php 3 patches
Doc Comments   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -71,7 +71,6 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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,
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -15,8 +15,6 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -134,28 +134,28 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
src/Legacy/FPDF/font/makefont/makefont.php 2 patches
Doc Comments   +11 added lines patch added patch discarded remove patch
@@ -7,6 +7,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -10,23 +10,23 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/MDFe/Damdfe.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
Spacing   +162 added lines, -162 removed lines patch added patch discarded remove patch
@@ -22,25 +22,25 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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';
Please login to merge, or discard this patch.
src/NFe/Danfce.php 4 patches
Doc Comments   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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) {
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -14,11 +14,9 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -223,8 +223,8 @@
 block discarded – undo
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 {
Please login to merge, or discard this patch.
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
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;
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
         $this->textoAdic = '';
258 258
         if (isset($this->infAdic)) {
259 259
             $this->textoAdic .= !empty($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue) ?
260
-            'Inf. Contribuinte: '.
260
+            'Inf. Contribuinte: ' .
261 261
             trim($this->pAnfavea($this->infAdic->getElementsByTagName('infCpl')->item(0)->nodeValue)) : '';
262 262
             if (!empty($this->textoAdic)) {
263 263
                 $tempPDF = new Pdf(); // cria uma instancia temporaria da class pdf
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
             $orientacao = 'P';
274 274
         }
275 275
         $this->orientacao = $orientacao;
276
-        $this->papel = array(80,$tamPapelVert);
276
+        $this->papel = array(80, $tamPapelVert);
277 277
         $this->logoAlign = $logoAlign;
278 278
         //$this->situacao_externa = $situacaoExterna;
279 279
         $this->numero_registro_dpec = $depecNumReg;
@@ -297,10 +297,10 @@  discard block
 block discarded – undo
297 297
         //total inicial de paginas
298 298
         $totPag = 1;
299 299
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
300
-        $this->wPrint = $maxW-($margEsq*2);
300
+        $this->wPrint = $maxW - ($margEsq * 2);
301 301
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
302 302
         //superior e inferior
303
-        $this->hPrint = $maxH-$margSup-$margInf;
303
+        $this->hPrint = $maxH - $margSup - $margInf;
304 304
         // estabelece contagem de paginas
305 305
         $this->pdf->aliasNbPages();
306 306
         $this->pdf->setMargins($margEsq, $margSup); // fixa as margens
@@ -311,22 +311,22 @@  discard block
 block discarded – undo
311 311
         $this->pdf->setLineWidth(0.1); // define a largura da linha
312 312
         $this->pdf->setTextColor(0, 0, 0);
313 313
         $this->pTextBox(0, 0, $maxW, $maxH); // POR QUE PRECISO DESA LINHA?
314
-        $hcabecalho = 27;//para cabeçalho (dados emitente mais logomarca)  (FIXO)
315
-        $hcabecalhoSecundario = 10;//para cabeçalho secundário (cabeçalho sefaz) (FIXO)
316
-        $hprodutos = $hLinha + ($qtdItens*$hMaxLinha) ;//box poduto
314
+        $hcabecalho = 27; //para cabeçalho (dados emitente mais logomarca)  (FIXO)
315
+        $hcabecalhoSecundario = 10; //para cabeçalho secundário (cabeçalho sefaz) (FIXO)
316
+        $hprodutos = $hLinha + ($qtdItens * $hMaxLinha); //box poduto
317 317
         $hTotal = 12; //box total (FIXO)
318
-        $hpagamentos = $hLinha + ($qtdPgto*$hLinha);//para pagamentos
319
-        $hmsgfiscal = 21;// para imposto (FIXO)
318
+        $hpagamentos = $hLinha + ($qtdPgto * $hLinha); //para pagamentos
319
+        $hmsgfiscal = 21; // para imposto (FIXO)
320 320
         if (!isset($this->dest)) {
321
-            $hcliente = 6;// para cliente (FIXO)
321
+            $hcliente = 6; // para cliente (FIXO)
322 322
         } else {
323 323
             $hcliente = 12;
324 324
         }// para cliente (FIXO)};
325
-        $hQRCode = 50;// para qrcode (FIXO)
326
-        $hCabecItens = 4;//cabeçalho dos itens
325
+        $hQRCode = 50; // para qrcode (FIXO)
326
+        $hCabecItens = 4; //cabeçalho dos itens
327 327
         
328 328
         $hUsado = $hCabecItens;
329
-        $w2 = round($this->wPrint*0.31, 0);
329
+        $w2 = round($this->wPrint * 0.31, 0);
330 330
         $totPag = 1;
331 331
         $pag = 1;
332 332
         $x = $xInic;
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
         $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal;
347 347
         $y = $this->pPagamentosDANFE($x, $y, $hpagamentos);
348 348
         //COLOCA MENSAGEM FISCAL
349
-        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal+ $hpagamentos;
349
+        $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos;
350 350
         $y = $this->pFiscalDANFE($x, $y, $hmsgfiscal);
351 351
         //COLOCA CONSUMIDOR
352 352
         $y = $xInic + $hcabecalho + $hcabecalhoSecundario + $hprodutos + $hTotal + $hpagamentos + $hmsgfiscal;
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
         }
365 365
         
366 366
         //retorna o ID na NFe
367
-        if ($classPdf!==false) {
367
+        if ($classPdf !== false) {
368 368
             $aR = [
369 369
              'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
370 370
              'classe_PDF'=>$this->pdf
@@ -384,14 +384,14 @@  discard block
 block discarded – undo
384 384
         $emitIM     = $this->pSimpleGetValue($this->emit, "IM");
385 385
         $emitFone = $this->pSimpleGetValue($this->enderEmit, "fone");
386 386
         $foneLen = strlen($emitFone);
387
-        if ($foneLen>0) {
387
+        if ($foneLen > 0) {
388 388
             $ddd = substr($emitFone, 0, 2);
389 389
             $fone1 = substr($emitFone, -8);
390 390
             $digito9 = ' ';
391 391
             if ($foneLen == 11) {
392 392
                 $digito9 = substr($emitFone, 2, 1);
393 393
             }
394
-            $emitFone = ' - ('.$ddd.') '.$digito9. ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4);
394
+            $emitFone = ' - (' . $ddd . ') ' . $digito9 . ' ' . substr($fone1, 0, 4) . '-' . substr($fone1, -4);
395 395
         } else {
396 396
             $emitFone = '';
397 397
         }
@@ -405,18 +405,18 @@  discard block
 block discarded – undo
405 405
         // CONFIGURAÇÃO DE POSIÇÃO
406 406
         $margemInterna = $this->margemInterna;
407 407
         $maxW = $this->wPrint;
408
-        $h = $h-($margemInterna);
408
+        $h = $h - ($margemInterna);
409 409
         //COLOCA LOGOMARCA
410 410
         if (is_file($this->logomarca)) {
411 411
             $xImg = $margemInterna;
412 412
             $yImg = $margemInterna + 1;
413 413
             $this->pdf->Image($this->logomarca, $xImg, $yImg, 30, 22.5);
414
-            $xRs = ($maxW*0.4) + $margemInterna;
415
-            $wRs = ($maxW*0.6);
414
+            $xRs = ($maxW * 0.4) + $margemInterna;
415
+            $wRs = ($maxW * 0.6);
416 416
             $alignEmit = 'L';
417 417
         } else {
418 418
             $xRs = $margemInterna;
419
-            $wRs = ($maxW*1);
419
+            $wRs = ($maxW * 1);
420 420
             $alignEmit = 'L';
421 421
         }
422 422
         //COLOCA RAZÃO SOCIAL
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
     {
437 437
         $margemInterna = $this->margemInterna;
438 438
         $maxW = $this->wPrint;
439
-        $w = ($maxW*1);
439
+        $w = ($maxW * 1);
440 440
         $hBox1 = 7;
441 441
         $texto = "DANFE NFC-e\nDocumento Auxiliar da Nota Fiscal de Consumidor Eletrônica";
442 442
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
@@ -453,13 +453,13 @@  discard block
 block discarded – undo
453 453
         $margemInterna = $this->margemInterna;
454 454
         $maxW = $this->wPrint;
455 455
         $qtdItens = $this->det->length;
456
-        $w = ($maxW*1);
456
+        $w = ($maxW * 1);
457 457
         $hLinha = $this->hLinha;
458 458
         $aFontCabProdutos = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
459
-        $wBoxCod = $w*0.17;
459
+        $wBoxCod = $w * 0.17;
460 460
         $texto = "CÓDIGO";
461 461
         $this->pTextBox($x, $y, $wBoxCod, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
462
-        $wBoxDescricao = $w*0.43;
462
+        $wBoxDescricao = $w * 0.43;
463 463
         $xBoxDescricao = $wBoxCod + $x;
464 464
         $texto = "DESCRICÃO";
465 465
         $this->pTextBox(
@@ -475,19 +475,19 @@  discard block
 block discarded – undo
475 475
             '',
476 476
             false
477 477
         );
478
-        $wBoxQt = $w*0.08;
478
+        $wBoxQt = $w * 0.08;
479 479
         $xBoxQt = $wBoxDescricao + $xBoxDescricao;
480 480
         $texto = "QT";
481 481
         $this->pTextBox($xBoxQt, $y, $wBoxQt, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
482
-        $wBoxUn = $w*0.06;
482
+        $wBoxUn = $w * 0.06;
483 483
         $xBoxUn = $wBoxQt + $xBoxQt;
484 484
         $texto = "UN";
485 485
         $this->pTextBox($xBoxUn, $y, $wBoxUn, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
486
-        $wBoxVl = $w*0.13;
486
+        $wBoxVl = $w * 0.13;
487 487
         $xBoxVl = $wBoxUn + $xBoxUn;
488 488
         $texto = "VALOR";
489 489
         $this->pTextBox($xBoxVl, $y, $wBoxVl, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
490
-        $wBoxTotal = $w*0.13;
490
+        $wBoxTotal = $w * 0.13;
491 491
         $xBoxTotal = $wBoxVl + $xBoxVl;
492 492
         $texto = "TOTAL";
493 493
         $this->pTextBox($xBoxTotal, $y, $wBoxTotal, $hLinha, $texto, $aFontCabProdutos, 'T', 'L', 0, '', false);
@@ -507,13 +507,13 @@  discard block
 block discarded – undo
507 507
                 $vUnCom     = number_format($this->pSimpleGetValue($prod, "vUnCom"), 2, ",", ".");
508 508
                 $vProd      = number_format($this->pSimpleGetValue($prod, "vProd"), 2, ",", ".");
509 509
                 //COLOCA PRODUTO
510
-                $yBoxProd = $y + $hLinha + ($cont*$hMaxLinha);
510
+                $yBoxProd = $y + $hLinha + ($cont * $hMaxLinha);
511 511
                 //COLOCA PRODUTO CÓDIGO
512
-                $wBoxCod = $w*0.17;
512
+                $wBoxCod = $w * 0.17;
513 513
                 $texto = $cProd;
514 514
                 $this->pTextBox($x, $yBoxProd, $wBoxCod, $hMaxLinha, $texto, $aFontProdutos, 'C', 'C', 0, '', false);
515 515
                 //COLOCA PRODUTO DESCRIÇÃO
516
-                $wBoxDescricao = $w*0.43;
516
+                $wBoxDescricao = $w * 0.43;
517 517
                 $xBoxDescricao = $wBoxCod + $x;
518 518
                 $texto = $xProd;
519 519
                 $this->pTextBox(
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
                     false
531 531
                 );
532 532
                 //COLOCA PRODUTO QUANTIDADE
533
-                $wBoxQt = $w*0.08;
533
+                $wBoxQt = $w * 0.08;
534 534
                 $xBoxQt = $wBoxDescricao + $xBoxDescricao;
535 535
                 $texto = $qCom;
536 536
                 $this->pTextBox(
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
                     false
548 548
                 );
549 549
                 //COLOCA PRODUTO UNIDADE
550
-                $wBoxUn = $w*0.06;
550
+                $wBoxUn = $w * 0.06;
551 551
                 $xBoxUn = $wBoxQt + $xBoxQt;
552 552
                 $texto = $uCom;
553 553
                 $this->pTextBox(
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
                     false
565 565
                 );
566 566
                 //COLOCA PRODUTO VL UNITÁRIO
567
-                $wBoxVl = $w*0.13;
567
+                $wBoxVl = $w * 0.13;
568 568
                 $xBoxVl = $wBoxUn + $xBoxUn;
569 569
                 $texto = $vUnCom;
570 570
                 $this->pTextBox(
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
                     false
582 582
                 );
583 583
                 //COLOCA PRODUTO VL TOTAL
584
-                $wBoxTotal = $w*0.13;
584
+                $wBoxTotal = $w * 0.13;
585 585
                 $xBoxTotal = $wBoxVl + $xBoxVl;
586 586
                 $texto = $vProd;
587 587
                 $this->pTextBox(
@@ -608,13 +608,13 @@  discard block
 block discarded – undo
608 608
         $margemInterna = $this->margemInterna;
609 609
         $maxW = $this->wPrint;
610 610
         $hLinha = 3;
611
-        $wColEsq = ($maxW*0.7);
612
-        $wColDir = ($maxW*0.3);
611
+        $wColEsq = ($maxW * 0.7);
612
+        $wColDir = ($maxW * 0.3);
613 613
         $xValor = $x + $wColEsq;
614 614
         $qtdItens = $this->det->length;
615 615
         $vProd = $this->pSimpleGetValue($this->ICMSTot, "vProd");
616 616
         $vNF = $this->pSimpleGetValue($this->ICMSTot, "vNF");
617
-        $vDesc  = $this->pSimpleGetValue($this->ICMSTot, "vDesc");
617
+        $vDesc = $this->pSimpleGetValue($this->ICMSTot, "vDesc");
618 618
         $vTotTrib = $this->pSimpleGetValue($this->ICMSTot, "vTotTrib");
619 619
         $texto = "Qtd. Total de Itens";
620 620
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
@@ -629,21 +629,21 @@  discard block
 block discarded – undo
629 629
         $texto = "R$ " . number_format($vProd, 2, ",", ".");
630 630
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
631 631
         $this->pTextBox($xValor, $yTotal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
632
-        $yDesconto = $y + ($hLinha*2);
632
+        $yDesconto = $y + ($hLinha * 2);
633 633
         $texto = "Descontos";
634 634
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
635 635
         $this->pTextBox($x, $yDesconto, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
636 636
         $texto = "R$ " . $vDesc;
637 637
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
638 638
         $this->pTextBox($xValor, $yDesconto, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
639
-        $yTotalFinal = $y + ($hLinha*3);
639
+        $yTotalFinal = $y + ($hLinha * 3);
640 640
         $texto = "Total";
641 641
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
642 642
         $this->pTextBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
643 643
         $texto = "R$ " . $vNF;
644 644
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
645 645
         $this->pTextBox($xValor, $yTotalFinal, $wColDir, $hLinha, $texto, $aFont, 'T', 'R', 0, '', false);
646
-        $yTotalFinal = $y + ($hLinha*4);
646
+        $yTotalFinal = $y + ($hLinha * 4);
647 647
         $texto = "Informação dos Tributos Totais Incidentes";
648 648
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
649 649
         $this->pTextBox($x, $yTotalFinal, $wColEsq, $hLinha, $texto, $aFont, 'T', 'L', 0, '', false);
@@ -658,16 +658,16 @@  discard block
 block discarded – undo
658 658
         $margemInterna = $this->margemInterna;
659 659
         $maxW = $this->wPrint;
660 660
         $qtdPgto = $this->pag->length;
661
-        $w = ($maxW*1);
661
+        $w = ($maxW * 1);
662 662
         $hLinha = $this->hLinha;
663
-        $wColEsq = ($maxW*0.7);
664
-        $wColDir = ($maxW*0.3);
663
+        $wColEsq = ($maxW * 0.7);
664
+        $wColDir = ($maxW * 0.3);
665 665
         $xValor = $x + $wColEsq;
666 666
         $aFontPgto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
667
-        $wBoxEsq = $w*0.7;
667
+        $wBoxEsq = $w * 0.7;
668 668
         $texto = "FORMA DE PAGAMENTO";
669 669
         $this->pTextBox($x, $y, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
670
-        $wBoxDir = $w*0.3;
670
+        $wBoxDir = $w * 0.3;
671 671
         $xBoxDescricao = $x + $wBoxEsq;
672 672
         $texto = "VALOR PAGO";
673 673
         $this->pTextBox($xBoxDescricao, $y, $wBoxDir, $hLinha, $texto, $aFontPgto, 'T', 'R', 0, '', false);
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
                     $tBandNome = self::getCardName($tBand);
690 690
                 }
691 691
                 //COLOCA PRODUTO
692
-                $yBoxProd = $y + $hLinha + ($cont*$hLinha);
692
+                $yBoxProd = $y + $hLinha + ($cont * $hLinha);
693 693
                 //COLOCA PRODUTO CÓDIGO
694 694
                 $texto = $tPagNome;
695 695
                 $this->pTextBox($x, $yBoxProd, $wBoxEsq, $hLinha, $texto, $aFontPgto, 'T', 'L', 0, '', false);
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
         $y += 4;
720 720
         $margemInterna = $this->margemInterna;
721 721
         $maxW = $this->wPrint;
722
-        $w = ($maxW*1);
722
+        $w = ($maxW * 1);
723 723
         $hLinha = $this->hLinha;
724 724
         $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
725 725
         $aFontTex = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
@@ -733,18 +733,18 @@  discard block
 block discarded – undo
733 733
         $urlChave = $this->urlConsulta[$tpAmb][$this->UFSigla[$cUF]];
734 734
         $texto = "ÁREA DE MENSAGEM FISCAL";
735 735
         $this->pTextBox($x, $y, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
736
-        $yTex1 = $y + ($hLinha*1);
737
-        $hTex1 = $hLinha*2;
738
-        $texto = "Número " . $nNF . " Série " . $serieNF . " " .$dhEmi . " - Via Consumidor";
736
+        $yTex1 = $y + ($hLinha * 1);
737
+        $hTex1 = $hLinha * 2;
738
+        $texto = "Número " . $nNF . " Série " . $serieNF . " " . $dhEmi . " - Via Consumidor";
739 739
         $this->pTextBox($x, $yTex1, $w, $hTex1, $texto, $aFontTex, 'C', 'C', 0, '', false);
740
-        $yTex2 = $y + ($hLinha*3);
741
-        $hTex2 = $hLinha*2;
740
+        $yTex2 = $y + ($hLinha * 3);
741
+        $hTex2 = $hLinha * 2;
742 742
         $texto = "Consulte pela Chave de Acesso em " . $urlChave;
743 743
         $this->pTextBox($x, $yTex2, $w, $hTex2, $texto, $aFontTex, 'C', 'C', 0, '', false);
744 744
         $texto = "CHAVE DE ACESSO";
745
-        $yTit2 = $y + ($hLinha*5);
745
+        $yTit2 = $y + ($hLinha * 5);
746 746
         $this->pTextBox($x, $yTit2, $w, $hLinha, $texto, $aFontTit, 'C', 'C', 0, '', false);
747
-        $yTex3 = $y + ($hLinha*6);
747
+        $yTex3 = $y + ($hLinha * 6);
748 748
         $texto = $chNFe;
749 749
         $this->pTextBox($x, $yTex3, $w, $hLinha, $texto, $aFontTex, 'C', 'C', 0, '', false);
750 750
     }
@@ -754,7 +754,7 @@  discard block
 block discarded – undo
754 754
         $y += 4;
755 755
         $margemInterna = $this->margemInterna;
756 756
         $maxW = $this->wPrint;
757
-        $w = ($maxW*1);
757
+        $w = ($maxW * 1);
758 758
         $hLinha = $this->hLinha;
759 759
         $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
760 760
         $aFontTex = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
             $consCNPJ = !empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)
771 771
                     ? $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue
772 772
                     : '';
773
-            $cDest = $consCPF.$consCNPJ.$considEstrangeiro; //documentos do consumidor
773
+            $cDest = $consCPF . $consCNPJ . $considEstrangeiro; //documentos do consumidor
774 774
             $enderDest = $this->dest->getElementsByTagName("enderDest")->item(0);
775 775
             $consNome = $this->pSimpleGetValue($this->dest, "xNome");
776 776
             $consLgr = $this->pSimpleGetValue($enderDest, "xLgr");
@@ -810,8 +810,8 @@  discard block
 block discarded – undo
810 810
             $yTex1 = $y + $hLinha;
811 811
             $texto = $consNome;
812 812
             if (!empty($consDoc)) {
813
-                $texto .= " - ". $consDoc . "\n" . $consEnd;
814
-                $this->pTextBox($x, $yTex1, $w, $hLinha*3, $texto, $aFontTex, 'C', 'C', 0, '', false);
813
+                $texto .= " - " . $consDoc . "\n" . $consEnd;
814
+                $this->pTextBox($x, $yTex1, $w, $hLinha * 3, $texto, $aFontTex, 'C', 'C', 0, '', false);
815 815
             }
816 816
         } else {
817 817
             $yTex1 = $y + $hLinha;
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
         $y += 4;
826 826
         $margemInterna = $this->margemInterna;
827 827
         $maxW = $this->wPrint;
828
-        $w = ($maxW*1);
828
+        $w = ($maxW * 1);
829 829
         $hLinha = $this->hLinha;
830 830
         $hBoxLinha = $this->hBoxLinha;
831 831
         $aFontTit = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
@@ -834,19 +834,19 @@  discard block
 block discarded – undo
834 834
         $nProt = '';
835 835
         if (isset($this->nfeProc)) {
836 836
             $nProt = $this->pSimpleGetValue($this->nfeProc, "nProt");
837
-            $dhRecbto  = $this->pSimpleGetValue($this->nfeProc, "dhRecbto");
837
+            $dhRecbto = $this->pSimpleGetValue($this->nfeProc, "dhRecbto");
838 838
         }
839 839
         $qrcode = new QRcode($this->qrCode, 'M');
840 840
         $wQr = 50;
841 841
         $hQr = 50;
842
-        $yQr = ($y+$margemInterna);
843
-        $xQr = ($w/2) - ($wQr/2);
842
+        $yQr = ($y + $margemInterna);
843
+        $xQr = ($w / 2) - ($wQr / 2);
844 844
         // prepare a base64 encoded "data url"
845 845
         $pic = 'data://text/plain;base64,' . base64_encode($qrcode->writeString());
846 846
         $info = getimagesize($pic);
847 847
         $this->pdf->image($pic, $xQr, $yQr, $wQr, $hQr, 'PNG');
848 848
         $dt = new DateTime($dhRecbto);
849
-        $yQr = ($yQr+$hQr+$margemInterna);
849
+        $yQr = ($yQr + $hQr + $margemInterna);
850 850
         $this->pTextBox($x, $yQr, $w, $hBoxLinha, "Protocolo de Autorização: " . $nProt . "\n"
851 851
             . $dt->format('d/m/Y H:i:s'), $aFontTex, 'C', 'C', 0, '', false);
852 852
     }
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
         if ($startPos === false) {
932 932
             return $cdata;
933 933
         }
934
-        for ($x=$len; $x>0; $x--) {
934
+        for ($x = $len; $x > 0; $x--) {
935 935
             if (substr($cdata, $x, 1) == '>') {
936 936
                 $endPos = $x;
937 937
                 break;
@@ -942,15 +942,15 @@  discard block
 block discarded – undo
942 942
         } else {
943 943
             $parte1 = '';
944 944
         }
945
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
945
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
946 946
         if ($endPos < $len) {
947 947
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
948 948
         } else {
949 949
             $parte3 = '';
950 950
         }
951
-        $texto = trim($parte1).' '.trim($parte3);
951
+        $texto = trim($parte1) . ' ' . trim($parte3);
952 952
         if (strpos($parte2, '<CDATA>') === false) {
953
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
953
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
954 954
         } else {
955 955
             $cdata = $parte2;
956 956
         }
@@ -1022,15 +1022,15 @@  discard block
 block discarded – undo
1022 1022
         //grupo CADATA infCpl
1023 1023
         $t = $dom->getElementsByTagName('transmissor')->item(0);
1024 1024
         $r = $dom->getElementsByTagName('receptor')->item(0);
1025
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
1026
-        'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
1027
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
1028
-        'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
1029
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
1030
-        'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
1031
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
1032
-        'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
1033
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
1025
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
1026
+        'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
1027
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
1028
+        'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
1029
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
1030
+        'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
1031
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
1032
+        'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
1033
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
1034 1034
         if (isset($t)) {
1035 1035
             if ($t->hasAttributes()) {
1036 1036
                 $texto .= " Transmissor ";
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
         $bin = "";
1148 1148
         $iCount = 0;
1149 1149
         do {
1150
-            $bin .= chr(hexdec($str{$iCount}.$str{($iCount + 1)}));
1150
+            $bin .= chr(hexdec($str{$iCount} . $str{($iCount + 1)}));
1151 1151
             $iCount += 2;
1152 1152
         } while ($iCount < strlen($str));
1153 1153
         return $bin;
@@ -1181,12 +1181,12 @@  discard block
 block discarded – undo
1181 1181
         $seq .= '&digVal=' . strtolower($digHex);
1182 1182
         $seq .= '&cIdToken=' . $idToken;
1183 1183
         //o hash code é calculado com o Token incluso
1184
-        $hash = sha1($seq.$token);
1185
-        $seq .= '&cHashQRCode='. strtoupper($hash);
1184
+        $hash = sha1($seq . $token);
1185
+        $seq .= '&cHashQRCode=' . strtoupper($hash);
1186 1186
         if (strpos($url, '?') === false) {
1187
-            $seq = $url.'?'.$seq;
1187
+            $seq = $url . '?' . $seq;
1188 1188
         } else {
1189
-            $seq = $url.''.$seq;
1189
+            $seq = $url . '' . $seq;
1190 1190
         }
1191 1191
         return $seq;
1192 1192
     }
Please login to merge, or discard this patch.
src/NFe/DanfcePos.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -53,20 +53,20 @@
 block discarded – undo
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
     /**
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/NFe/Daevento.php 3 patches
Doc Comments   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -72,9 +72,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)
Please login to merge, or discard this patch.
Spacing   +16 added lines, -18 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/NFe/Danfe.php 3 patches
Doc Comments   +18 added lines, -14 removed lines patch added patch discarded remove patch
@@ -976,8 +976,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
      *
Please login to merge, or discard this patch.
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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');
Please login to merge, or discard this patch.
Spacing   +314 added lines, -321 removed lines patch added patch discarded remove patch
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
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
      * Creditos para integrador
304 304
      * @var string
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
             $this->fontePadrao = $fonteDANFE;
357 357
         }
358 358
         //se for passado o xml
359
-        if (! empty($this->xml)) {
359
+        if (!empty($this->xml)) {
360 360
             $this->dom = new Dom();
361 361
             $this->dom->loadXML($this->xml);
362 362
             $this->nfeProc    = $this->dom->getElementsByTagName("nfeProc")->item(0);
@@ -513,10 +513,10 @@  discard block
 block discarded – undo
513 513
         //total inicial de paginas
514 514
         $totPag = 1;
515 515
         //largura imprimivel em mm: largura da folha menos as margens esq/direita
516
-        $this->wPrint = $maxW-($margEsq*2);
516
+        $this->wPrint = $maxW - ($margEsq * 2);
517 517
         //comprimento (altura) imprimivel em mm: altura da folha menos as margens
518 518
         //superior e inferior
519
-        $this->hPrint = $maxH-$margSup-$margInf;
519
+        $this->hPrint = $maxH - $margSup - $margInf;
520 520
         // estabelece contagem de paginas
521 521
         $this->pdf->aliasNbPages();
522 522
         // fixa as margens
@@ -554,34 +554,28 @@  discard block
 block discarded – undo
554 554
         }
555 555
         //calcular a altura necessária para os dados adicionais
556 556
         if ($this->orientacao == 'P') {
557
-            $this->wAdic = round($this->wPrint*0.66, 0);
557
+            $this->wAdic = round($this->wPrint * 0.66, 0);
558 558
         } else {
559
-            $this->wAdic = round(($this->wPrint-$this->wCanhoto)*0.5, 0);
559
+            $this->wAdic = round(($this->wPrint - $this->wCanhoto) * 0.5, 0);
560 560
         }
561 561
         $fontProduto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
562 562
         $this->textoAdic = '';
563 563
         if (isset($this->retirada)) {
564
-            $txRetCNPJ = ! empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
565
-                $this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue :
566
-                '';
567
-            $txRetxLgr = ! empty($this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue) ?
568
-                $this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue :
569
-                '';
570
-            $txRetnro = ! empty($this->retirada->getElementsByTagName("nro")->item(0)->nodeValue) ?
571
-                $this->retirada->getElementsByTagName("nro")->item(0)->nodeValue :
572
-                's/n';
564
+            $txRetCNPJ = !empty($this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
565
+                $this->retirada->getElementsByTagName("CNPJ")->item(0)->nodeValue : '';
566
+            $txRetxLgr = !empty($this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue) ?
567
+                $this->retirada->getElementsByTagName("xLgr")->item(0)->nodeValue : '';
568
+            $txRetnro = !empty($this->retirada->getElementsByTagName("nro")->item(0)->nodeValue) ?
569
+                $this->retirada->getElementsByTagName("nro")->item(0)->nodeValue : 's/n';
573 570
             $txRetxCpl = $this->pSimpleGetValue($this->retirada, "xCpl", " - ");
574
-            $txRetxBairro = ! empty($this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue) ?
575
-                $this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue :
576
-                '';
577
-            $txRetxMun = ! empty($this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue) ?
578
-                $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue :
579
-                '';
580
-            $txRetUF = ! empty($this->retirada->getElementsByTagName("UF")->item(0)->nodeValue) ?
581
-                $this->retirada->getElementsByTagName("UF")->item(0)->nodeValue :
582
-                '';
583
-            $this->textoAdic .= "LOCAL DE RETIRADA : ".
584
-                    $txRetCNPJ.
571
+            $txRetxBairro = !empty($this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue) ?
572
+                $this->retirada->getElementsByTagName("xBairro")->item(0)->nodeValue : '';
573
+            $txRetxMun = !empty($this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue) ?
574
+                $this->retirada->getElementsByTagName("xMun")->item(0)->nodeValue : '';
575
+            $txRetUF = !empty($this->retirada->getElementsByTagName("UF")->item(0)->nodeValue) ?
576
+                $this->retirada->getElementsByTagName("UF")->item(0)->nodeValue : '';
577
+            $this->textoAdic .= "LOCAL DE RETIRADA : " .
578
+                    $txRetCNPJ .
585 579
                     '-' .
586 580
                     $txRetxLgr .
587 581
                     ', ' .
@@ -598,24 +592,24 @@  discard block
 block discarded – undo
598 592
         }
599 593
         //dados do local de entrega da mercadoria
600 594
         if (isset($this->entrega)) {
601
-            $txRetCNPJ = ! empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
595
+            $txRetCNPJ = !empty($this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
602 596
                 $this->entrega->getElementsByTagName("CNPJ")->item(0)->nodeValue : '';
603
-            $txRetxLgr = ! empty($this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue) ?
597
+            $txRetxLgr = !empty($this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue) ?
604 598
                 $this->entrega->getElementsByTagName("xLgr")->item(0)->nodeValue : '';
605
-            $txRetnro = ! empty($this->entrega->getElementsByTagName("nro")->item(0)->nodeValue) ?
599
+            $txRetnro = !empty($this->entrega->getElementsByTagName("nro")->item(0)->nodeValue) ?
606 600
                 $this->entrega->getElementsByTagName("nro")->item(0)->nodeValue : 's/n';
607 601
             $txRetxCpl = $this->pSimpleGetValue($this->entrega, "xCpl", " - ");
608
-            $txRetxBairro = ! empty($this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue) ?
602
+            $txRetxBairro = !empty($this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue) ?
609 603
                 $this->entrega->getElementsByTagName("xBairro")->item(0)->nodeValue : '';
610
-            $txRetxMun = ! empty($this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue) ?
604
+            $txRetxMun = !empty($this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue) ?
611 605
                 $this->entrega->getElementsByTagName("xMun")->item(0)->nodeValue : '';
612
-            $txRetUF = ! empty($this->entrega->getElementsByTagName("UF")->item(0)->nodeValue) ?
606
+            $txRetUF = !empty($this->entrega->getElementsByTagName("UF")->item(0)->nodeValue) ?
613 607
                 $this->entrega->getElementsByTagName("UF")->item(0)->nodeValue : '';
614 608
             if ($this->textoAdic != '') {
615 609
                 $this->textoAdic .= ". \r\n";
616 610
             }
617
-            $this->textoAdic .= "LOCAL DE ENTREGA : ".$txRetCNPJ.'-'.$txRetxLgr.', '.$txRetnro.' '.$txRetxCpl.
618
-               ' - '.$txRetxBairro.' '.$txRetxMun.' - '.$txRetUF."\r\n";
611
+            $this->textoAdic .= "LOCAL DE ENTREGA : " . $txRetCNPJ . '-' . $txRetxLgr . ', ' . $txRetnro . ' ' . $txRetxCpl .
612
+               ' - ' . $txRetxBairro . ' ' . $txRetxMun . ' - ' . $txRetUF . "\r\n";
619 613
         }
620 614
         //informações adicionais
621 615
         $this->textoAdic .= $this->pGeraInformacoesDasNotasReferenciadas();
@@ -624,7 +618,7 @@  discard block
 block discarded – undo
624 618
             if ($this->textoAdic != '') {
625 619
                 $this->textoAdic .= ". \r\n";
626 620
             }
627
-            $this->textoAdic .= ! empty($this->infAdic->getElementsByTagName("infCpl")->item(0)->nodeValue) ?
621
+            $this->textoAdic .= !empty($this->infAdic->getElementsByTagName("infCpl")->item(0)->nodeValue) ?
628 622
                 'Inf. Contribuinte: ' .
629 623
                 trim($this->pAnfavea($this->infAdic->getElementsByTagName("infCpl")->item(0)->nodeValue)) : '';
630 624
             $infPedido = $this->pGeraInformacoesDaTagCompra();
@@ -632,14 +626,14 @@  discard block
 block discarded – undo
632 626
                 $this->textoAdic .= $infPedido;
633 627
             }
634 628
             $this->textoAdic .= $this->pSimpleGetValue($this->dest, "email", ' Email do Destinatário: ');
635
-            $this->textoAdic .= ! empty($this->infAdic->getElementsByTagName("infAdFisco")->item(0)->nodeValue) ?
629
+            $this->textoAdic .= !empty($this->infAdic->getElementsByTagName("infAdFisco")->item(0)->nodeValue) ?
636 630
                 "\r\n Inf. fisco: " .
637 631
                 trim($this->infAdic->getElementsByTagName("infAdFisco")->item(0)->nodeValue) : '';
638 632
             $obsCont = $this->infAdic->getElementsByTagName("obsCont");
639 633
             if (isset($obsCont)) {
640 634
                 foreach ($obsCont as $obs) {
641
-                    $campo =  $obsCont->item($i)->getAttribute("xCampo");
642
-                    $xTexto = ! empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ?
635
+                    $campo = $obsCont->item($i)->getAttribute("xCampo");
636
+                    $xTexto = !empty($obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue) ?
643 637
                         $obsCont->item($i)->getElementsByTagName("xTexto")->item(0)->nodeValue : '';
644 638
                     $this->textoAdic .= "\r\n" . $campo . ':  ' . trim($xTexto);
645 639
                     $i++;
@@ -667,38 +661,38 @@  discard block
 block discarded – undo
667 661
         foreach ($alinhas as $linha) {
668 662
             $numlinhasdados += $this->pGetNumLines($linha, $this->wAdic, $fontProduto);
669 663
         }
670
-        $hdadosadic = round(($numlinhasdados+3) * $this->pdf->fontSize, 0);
664
+        $hdadosadic = round(($numlinhasdados + 3) * $this->pdf->fontSize, 0);
671 665
         if ($hdadosadic < 10) {
672 666
             $hdadosadic = 10;
673 667
         }
674 668
         //altura disponivel para os campos da DANFE
675
-        $hcabecalho = 47;//para cabeçalho
676
-        $hdestinatario = 25;//para destinatario
677
-        $hduplicatas = 12;//para cada grupo de 7 duplicatas
678
-        $himposto = 18;// para imposto
679
-        $htransporte = 25;// para transporte
680
-        $hissqn = 11;// para issqn
681
-        $hfooter = 5;// para rodape
682
-        $hCabecItens = 4;//cabeçalho dos itens
669
+        $hcabecalho = 47; //para cabeçalho
670
+        $hdestinatario = 25; //para destinatario
671
+        $hduplicatas = 12; //para cada grupo de 7 duplicatas
672
+        $himposto = 18; // para imposto
673
+        $htransporte = 25; // para transporte
674
+        $hissqn = 11; // para issqn
675
+        $hfooter = 5; // para rodape
676
+        $hCabecItens = 4; //cabeçalho dos itens
683 677
         //alturas disponiveis para os dados
684 678
         $hDispo1 = $this->hPrint - 10 - ($hcabecalho +
685 679
             $hdestinatario + ($linhasDup * $hduplicatas) + $himposto + $htransporte +
686 680
             ($linhaISSQN * $hissqn) + $hdadosadic + $hfooter + $hCabecItens +
687 681
             $this->pSizeExtraTextoFatura());
688 682
         if ($this->orientacao == 'P') {
689
-            $hDispo1 -= 23 * $this->qCanhoto;//para canhoto
683
+            $hDispo1 -= 23 * $this->qCanhoto; //para canhoto
690 684
             $w = $this->wPrint;
691 685
         } else {
692
-            $hcanhoto = $this->hPrint;//para canhoto
686
+            $hcanhoto = $this->hPrint; //para canhoto
693 687
             $w = $this->wPrint - $this->wCanhoto;
694 688
         }
695
-        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens)-4;
689
+        $hDispo2 = $this->hPrint - 10 - ($hcabecalho + $hfooter + $hCabecItens) - 4;
696 690
         //Contagem da altura ocupada para impressão dos itens
697 691
         $fontProduto = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
698 692
         $i = 0;
699 693
         $numlinhas = 0;
700 694
         $hUsado = $hCabecItens;
701
-        $w2 = round($w*0.28, 0);
695
+        $w2 = round($w * 0.28, 0);
702 696
         $hDispo = $hDispo1;
703 697
         $totPag = 1;
704 698
         while ($i < $this->det->length) {
@@ -710,7 +704,7 @@  discard block
 block discarded – undo
710 704
                 $hDispo = $hDispo2;
711 705
                 $hUsado = $hCabecItens;
712 706
                 // Remove canhoto para páginas secundárias em modo paisagem ('L')
713
-                $w2 = round($this->wPrint*0.28, 0);
707
+                $w2 = round($this->wPrint * 0.28, 0);
714 708
                 $i--; // decrementa para readicionar o item que não coube nessa pagina na outra.
715 709
             }
716 710
             $i++;
@@ -734,19 +728,19 @@  discard block
 block discarded – undo
734 728
         //coloca o cabeçalho
735 729
         $y = $this->pCabecalhoDANFE($x, $y, $pag, $totPag);
736 730
         //coloca os dados do destinatário
737
-        $y = $this->pDestinatarioDANFE($x, $y+1);
731
+        $y = $this->pDestinatarioDANFE($x, $y + 1);
738 732
         //coloca os dados das faturas
739
-        $y = $this->pFaturaDANFE($x, $y+1);
733
+        $y = $this->pFaturaDANFE($x, $y + 1);
740 734
         //coloca os dados dos impostos e totais da NFe
741
-        $y = $this->pImpostoDANFE($x, $y+1);
735
+        $y = $this->pImpostoDANFE($x, $y + 1);
742 736
         //coloca os dados do trasnporte
743
-        $y = $this->pTransporteDANFE($x, $y+1);
737
+        $y = $this->pTransporteDANFE($x, $y + 1);
744 738
         //itens da DANFE
745 739
         $nInicial = 0;
746
-        $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
740
+        $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo1, $pag, $totPag, $hCabecItens);
747 741
         //coloca os dados do ISSQN
748 742
         if ($linhaISSQN == 1) {
749
-            $y = $this->pIssqnDANFE($x, $y+4);
743
+            $y = $this->pIssqnDANFE($x, $y + 4);
750 744
         } else {
751 745
             $y += 4;
752 746
         }
@@ -754,7 +748,7 @@  discard block
 block discarded – undo
754 748
         $y = $this->pDadosAdicionaisDANFE($x, $y, $hdadosadic);
755 749
         //coloca o rodapé da página
756 750
         if ($this->orientacao == 'P') {
757
-            $this->pRodape($xInic, $y-1);
751
+            $this->pRodape($xInic, $y - 1);
758 752
         } else {
759 753
             $this->pRodape($xInic, $this->hPrint + 1);
760 754
         }
@@ -774,7 +768,7 @@  discard block
 block discarded – undo
774 768
             //coloca o cabeçalho na página adicional
775 769
             $y = $this->pCabecalhoDANFE($x, $y, $n, $totPag);
776 770
             //coloca os itens na página adicional
777
-            $y = $this->pItensDANFE($x, $y+1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
771
+            $y = $this->pItensDANFE($x, $y + 1, $nInicial, $hDispo2, $n, $totPag, $hCabecItens);
778 772
             //coloca o rodapé da página
779 773
             if ($this->orientacao == 'P') {
780 774
                 $this->pRodape($xInic, $y + 4);
@@ -787,7 +781,7 @@  discard block
 block discarded – undo
787 781
             }
788 782
         }
789 783
         //retorna o ID na NFe
790
-        if ($classPdf!==false) {
784
+        if ($classPdf !== false) {
791 785
             $aR = array(
792 786
              'id'=>str_replace('NFe', '', $this->infNFe->getAttribute("Id")),
793 787
              'classe_PDF'=>$this->pdf);
@@ -820,7 +814,7 @@  discard block
 block discarded – undo
820 814
         if ($startPos === false) {
821 815
             return $cdata;
822 816
         }
823
-        for ($x=$len; $x>0; $x--) {
817
+        for ($x = $len; $x > 0; $x--) {
824 818
             if (substr($cdata, $x, 1) == '>') {
825 819
                 $endPos = $x;
826 820
                 break;
@@ -831,15 +825,15 @@  discard block
 block discarded – undo
831 825
         } else {
832 826
             $parte1 = '';
833 827
         }
834
-        $parte2 = substr($cdata, $startPos, $endPos-$startPos+1);
828
+        $parte2 = substr($cdata, $startPos, $endPos - $startPos + 1);
835 829
         if ($endPos < $len) {
836 830
             $parte3 = substr($cdata, $endPos + 1, $len - $endPos - 1);
837 831
         } else {
838 832
             $parte3 = '';
839 833
         }
840
-        $texto = trim($parte1).' '.trim($parte3);
834
+        $texto = trim($parte1) . ' ' . trim($parte3);
841 835
         if (strpos($parte2, '<CDATA>') === false) {
842
-            $cdata = '<CDATA>'.$parte2.'</CDATA>';
836
+            $cdata = '<CDATA>' . $parte2 . '</CDATA>';
843 837
         } else {
844 838
             $cdata = $parte2;
845 839
         }
@@ -913,15 +907,15 @@  discard block
 block discarded – undo
913 907
         //grupo CADATA infCpl
914 908
         $t = $dom->getElementsByTagName('transmissor')->item(0);
915 909
         $r = $dom->getElementsByTagName('receptor')->item(0);
916
-        $versao = ! empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
917
-            'Versao:'.$dom->getElementsByTagName('versao')->item(0)->nodeValue.' ' : '';
918
-        $especieNF = ! empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
919
-            'Especie:'.$dom->getElementsByTagName('especieNF')->item(0)->nodeValue.' ' : '';
920
-        $fabEntrega = ! empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
921
-            'Entrega:'.$dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue.' ' : '';
922
-        $dca = ! empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
923
-            'dca:'.$dom->getElementsByTagName('dca')->item(0)->nodeValue.' ' : '';
924
-        $texto .= "".$versao.$especieNF.$fabEntrega.$dca;
910
+        $versao = !empty($dom->getElementsByTagName('versao')->item(0)->nodeValue) ?
911
+            'Versao:' . $dom->getElementsByTagName('versao')->item(0)->nodeValue . ' ' : '';
912
+        $especieNF = !empty($dom->getElementsByTagName('especieNF')->item(0)->nodeValue) ?
913
+            'Especie:' . $dom->getElementsByTagName('especieNF')->item(0)->nodeValue . ' ' : '';
914
+        $fabEntrega = !empty($dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue) ?
915
+            'Entrega:' . $dom->getElementsByTagName('fabEntrega')->item(0)->nodeValue . ' ' : '';
916
+        $dca = !empty($dom->getElementsByTagName('dca')->item(0)->nodeValue) ?
917
+            'dca:' . $dom->getElementsByTagName('dca')->item(0)->nodeValue . ' ' : '';
918
+        $texto .= "" . $versao . $especieNF . $fabEntrega . $dca;
925 919
         if (isset($t)) {
926 920
             if ($t->hasAttributes()) {
927 921
                 $texto .= " Transmissor ";
@@ -1011,14 +1005,14 @@  discard block
 block discarded – undo
1011 1005
         }
1012 1006
         //####################################################################################
1013 1007
         //coluna esquerda identificação do emitente
1014
-        $w = round($maxW*0.41, 0);
1008
+        $w = round($maxW * 0.41, 0);
1015 1009
         if ($this->orientacao == 'P') {
1016 1010
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
1017 1011
         } else {
1018 1012
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
1019 1013
         }
1020 1014
         $w1 = $w;
1021
-        $h=32;
1015
+        $h = 32;
1022 1016
         $oldY += $h;
1023 1017
         $this->pTextBox($x, $y, $w, $h);
1024 1018
         $texto = 'IDENTIFICAÇÃO DO EMITENTE';
@@ -1032,41 +1026,41 @@  discard block
 block discarded – undo
1032 1026
         //se não houver logo centraliza dos dados do emitente
1033 1027
         // coloca o logo
1034 1028
         if (is_file($this->logomarca)) {
1035
-            $logoInfo=getimagesize($this->logomarca);
1029
+            $logoInfo = getimagesize($this->logomarca);
1036 1030
             //largura da imagem em mm
1037
-            $logoWmm = ($logoInfo[0]/72)*25.4;
1031
+            $logoWmm = ($logoInfo[0] / 72) * 25.4;
1038 1032
             //altura da imagem em mm
1039
-            $logoHmm = ($logoInfo[1]/72)*25.4;
1040
-            if ($this->logoAlign=='L') {
1041
-                $nImgW = round($w/3, 0);
1042
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1043
-                $xImg = $x+1;
1044
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1033
+            $logoHmm = ($logoInfo[1] / 72) * 25.4;
1034
+            if ($this->logoAlign == 'L') {
1035
+                $nImgW = round($w / 3, 0);
1036
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1037
+                $xImg = $x + 1;
1038
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1045 1039
                 //estabelecer posições do texto
1046
-                $x1 = round($xImg + $nImgW +1, 0);
1047
-                $y1 = round($h/3+$y, 0);
1048
-                $tw = round(2*$w/3, 0);
1049
-            } elseif ($this->logoAlign=='C') {
1050
-                $nImgH = round($h/3, 0);
1051
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1052
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1053
-                $yImg = $y+3;
1040
+                $x1 = round($xImg + $nImgW + 1, 0);
1041
+                $y1 = round($h / 3 + $y, 0);
1042
+                $tw = round(2 * $w / 3, 0);
1043
+            } elseif ($this->logoAlign == 'C') {
1044
+                $nImgH = round($h / 3, 0);
1045
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1046
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1047
+                $yImg = $y + 3;
1054 1048
                 $x1 = $x;
1055 1049
                 $y1 = round($yImg + $nImgH + 1, 0);
1056 1050
                 $tw = $w;
1057
-            } elseif ($this->logoAlign=='R') {
1058
-                $nImgW = round($w/3, 0);
1059
-                $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0);
1060
-                $xImg = round($x+($w-(1+$nImgW)), 0);
1061
-                $yImg = round(($h-$nImgH)/2, 0)+$y;
1051
+            } elseif ($this->logoAlign == 'R') {
1052
+                $nImgW = round($w / 3, 0);
1053
+                $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0);
1054
+                $xImg = round($x + ($w - (1 + $nImgW)), 0);
1055
+                $yImg = round(($h - $nImgH) / 2, 0) + $y;
1062 1056
                 $x1 = $x;
1063
-                $y1 = round($h/3+$y, 0);
1064
-                $tw = round(2*$w/3, 0);
1065
-            } elseif ($this->logoAlign=='F') {
1066
-                $nImgH = round($h-5, 0);
1067
-                $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0);
1068
-                $xImg = round(($w-$nImgW)/2+$x, 0);
1069
-                $yImg = $y+3;
1057
+                $y1 = round($h / 3 + $y, 0);
1058
+                $tw = round(2 * $w / 3, 0);
1059
+            } elseif ($this->logoAlign == 'F') {
1060
+                $nImgH = round($h - 5, 0);
1061
+                $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0);
1062
+                $xImg = round(($w - $nImgW) / 2 + $x, 0);
1063
+                $yImg = $y + 3;
1070 1064
                 $x1 = $x;
1071 1065
                 $y1 = round($yImg + $nImgH + 1, 0);
1072 1066
                 $tw = $w;
@@ -1074,7 +1068,7 @@  discard block
 block discarded – undo
1074 1068
             $this->pdf->Image($this->logomarca, $xImg, $yImg, $nImgW, $nImgH);
1075 1069
         } else {
1076 1070
             $x1 = $x;
1077
-            $y1 = round($h/3+$y, 0);
1071
+            $y1 = round($h / 3 + $y, 0);
1078 1072
             $tw = $w;
1079 1073
         }
1080 1074
         // monta as informações apenas se diferente de full logo
@@ -1084,9 +1078,9 @@  discard block
 block discarded – undo
1084 1078
             $texto = $this->emit->getElementsByTagName("xNome")->item(0)->nodeValue;
1085 1079
             $this->pTextBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
1086 1080
             //endereço
1087
-            $y1 = $y1+5;
1081
+            $y1 = $y1 + 5;
1088 1082
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1089
-            $fone = ! empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1083
+            $fone = !empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue)
1090 1084
                  ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue
1091 1085
                  : '';
1092 1086
             $lgr = $this->pSimpleGetValue($this->enderEmit, "xLgr");
@@ -1106,37 +1100,37 @@  discard block
 block discarded – undo
1106 1100
         //####################################################################################
1107 1101
         //coluna central Danfe
1108 1102
         $x += $w;
1109
-        $w=round($maxW * 0.17, 0);//35;
1103
+        $w = round($maxW * 0.17, 0); //35;
1110 1104
         $w2 = $w;
1111 1105
         $h = 32;
1112 1106
         $this->pTextBox($x, $y, $w, $h);
1113 1107
 
1114
-        if (! $this->pNotaCancelada()) {
1108
+        if (!$this->pNotaCancelada()) {
1115 1109
             // A PRINCIPIO NÃO PRECISAVA, POIS A NFE ESTÁ AUTORIZADA,
1116 1110
             // SÓ SE RETIRA O DANFE PARA NOTAS NÃO AUTORIZADAS
1117 1111
             $texto = "DANFE";
1118 1112
             $aFont = array('font'=>$this->fontePadrao, 'size'=>14, 'style'=>'B');
1119
-            $this->pTextBox($x, $y+1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1113
+            $this->pTextBox($x, $y + 1, $w, $h, $texto, $aFont, 'T', 'C', 0, '');
1120 1114
             $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1121 1115
             $texto = 'Documento Auxiliar da Nota Fiscal Eletrônica';
1122 1116
             $h = 20;
1123
-            $this->pTextBox($x, $y+6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1117
+            $this->pTextBox($x, $y + 6, $w, $h, $texto, $aFont, 'T', 'C', 0, '', false);
1124 1118
         }
1125 1119
 
1126 1120
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1127 1121
         $texto = '0 - ENTRADA';
1128 1122
         $y1 = $y + 14;
1129 1123
         $h = 8;
1130
-        $this->pTextBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1124
+        $this->pTextBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1131 1125
         $texto = '1 - SAÍDA';
1132 1126
         $y1 = $y + 17;
1133
-        $this->pTextBox($x+2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1127
+        $this->pTextBox($x + 2, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1134 1128
         //tipo de nF
1135 1129
         $aFont = array('font'=>$this->fontePadrao, 'size'=>12, 'style'=>'B');
1136 1130
         $y1 = $y + 13;
1137 1131
         $h = 7;
1138 1132
         $texto = $this->ide->getElementsByTagName('tpNF')->item(0)->nodeValue;
1139
-        $this->pTextBox($x+27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1133
+        $this->pTextBox($x + 27, $y1, 5, $h, $texto, $aFont, 'C', 'C', 1, '');
1140 1134
         //numero da NF
1141 1135
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1142 1136
         $y1 = $y + 20;
@@ -1158,7 +1152,7 @@  discard block
 block discarded – undo
1158 1152
         //####################################################################################
1159 1153
         //coluna codigo de barras
1160 1154
         $x += $w;
1161
-        $w = ($maxW-$w1-$w2);//85;
1155
+        $w = ($maxW - $w1 - $w2); //85;
1162 1156
         $w3 = $w;
1163 1157
         $h = 32;
1164 1158
         $this->pTextBox($x, $y, $w, $h);
@@ -1167,22 +1161,22 @@  discard block
 block discarded – undo
1167 1161
         $bW = 75;
1168 1162
         $bH = 12;
1169 1163
         //codigo de barras
1170
-        $this->pdf->Code128($x+(($w-$bW)/2), $y+2, $chave_acesso, $bW, $bH);
1164
+        $this->pdf->Code128($x + (($w - $bW) / 2), $y + 2, $chave_acesso, $bW, $bH);
1171 1165
         //linhas divisorias
1172
-        $this->pdf->Line($x, $y+4+$bH, $x+$w, $y+4+$bH);
1173
-        $this->pdf->Line($x, $y+12+$bH, $x+$w, $y+12+$bH);
1166
+        $this->pdf->Line($x, $y + 4 + $bH, $x + $w, $y + 4 + $bH);
1167
+        $this->pdf->Line($x, $y + 12 + $bH, $x + $w, $y + 12 + $bH);
1174 1168
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1175
-        $y1 = $y+4+$bH;
1169
+        $y1 = $y + 4 + $bH;
1176 1170
         $h = 7;
1177 1171
         $texto = 'CHAVE DE ACESSO';
1178 1172
         $this->pTextBox($x, $y1, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1179 1173
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'B');
1180
-        $y1 = $y+8+$bH;
1174
+        $y1 = $y + 8 + $bH;
1181 1175
         $texto = $this->pFormat($chave_acesso, $this->formatoChave);
1182
-        $this->pTextBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1183
-        $y1 = $y+12+$bH;
1176
+        $this->pTextBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1177
+        $y1 = $y + 12 + $bH;
1184 1178
         $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1185
-        $chaveContingencia="";
1179
+        $chaveContingencia = "";
1186 1180
         if ($this->pNotaDPEC()) {
1187 1181
             $cabecalhoProtoAutorizacao = 'NÚMERO DE REGISTRO DPEC';
1188 1182
         } else {
@@ -1193,16 +1187,16 @@  discard block
 block discarded – undo
1193 1187
             $chaveContingencia = $this->pGeraChaveAdicionalDeContingencia();
1194 1188
             $this->pdf->SetFillColor(0, 0, 0);
1195 1189
             //codigo de barras
1196
-            $this->pdf->Code128($x+11, $y1+1, $chaveContingencia, $bW*.9, $bH/2);
1190
+            $this->pdf->Code128($x + 11, $y1 + 1, $chaveContingencia, $bW * .9, $bH / 2);
1197 1191
         } else {
1198 1192
             $texto = 'Consulta de autenticidade no portal nacional da NF-e';
1199
-            $this->pTextBox($x+2, $y1, $w-2, $h, $texto, $aFont, 'T', 'C', 0, '');
1200
-            $y1 = $y+16+$bH;
1193
+            $this->pTextBox($x + 2, $y1, $w - 2, $h, $texto, $aFont, 'T', 'C', 0, '');
1194
+            $y1 = $y + 16 + $bH;
1201 1195
             $texto = 'www.nfe.fazenda.gov.br/portal ou no site da Sefaz Autorizadora';
1202 1196
             $this->pTextBox(
1203
-                $x+2,
1197
+                $x + 2,
1204 1198
                 $y1,
1205
-                $w-2,
1199
+                $w - 2,
1206 1200
                 $h,
1207 1201
                 $texto,
1208 1202
                 $aFont,
@@ -1218,7 +1212,7 @@  discard block
 block discarded – undo
1218 1212
         //natureza da operação
1219 1213
         $texto = 'NATUREZA DA OPERAÇÃO';
1220 1214
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1221
-        $w = $w1+$w2;
1215
+        $w = $w1 + $w2;
1222 1216
         $y = $oldY;
1223 1217
         $oldY += $h;
1224 1218
         $x = $oldX;
@@ -1248,7 +1242,7 @@  discard block
 block discarded – undo
1248 1242
                 $cStat = '';
1249 1243
             } else {
1250 1244
                 if (isset($this->nfeProc)) {
1251
-                    $texto = ! empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1245
+                    $texto = !empty($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue) ?
1252 1246
                             $this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue : '';
1253 1247
                     $tsHora = $this->pConvertTime($this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue);
1254 1248
                     if ($texto != '') {
@@ -1279,25 +1273,25 @@  discard block
 block discarded – undo
1279 1273
         $texto = 'INSCRIÇÃO ESTADUAL DO SUBST. TRIBUT.';
1280 1274
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1281 1275
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1282
-        $texto = ! empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1276
+        $texto = !empty($this->emit->getElementsByTagName("IEST")->item(0)->nodeValue)
1283 1277
              ? $this->emit->getElementsByTagName("IEST")->item(0)->nodeValue
1284 1278
              : '';
1285 1279
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1286 1280
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1287 1281
         //CNPJ
1288 1282
         $x += $w;
1289
-        $w = ($maxW-(2*$w));
1283
+        $w = ($maxW - (2 * $w));
1290 1284
         $texto = 'CNPJ / CPF';
1291 1285
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1292 1286
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1293 1287
         //Pegando valor do CPF/CNPJ
1294
-        if (! empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1288
+        if (!empty($this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1295 1289
             $texto = $this->pFormat(
1296 1290
                 $this->emit->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1297 1291
                 "###.###.###/####-##"
1298 1292
             );
1299 1293
         } else {
1300
-            $texto = ! empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1294
+            $texto = !empty($this->emit->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1301 1295
                 $this->pFormat(
1302 1296
                     $this->emit->getElementsByTagName("CPF")->item(0)->nodeValue,
1303 1297
                     "###.###.###-##"
@@ -1313,9 +1307,9 @@  discard block
 block discarded – undo
1313 1307
         if ($this->pNotaCancelada()) {
1314 1308
             //101 Cancelamento
1315 1309
             $x = 10;
1316
-            $y = $this->hPrint-130;
1310
+            $y = $this->hPrint - 130;
1317 1311
             $h = 25;
1318
-            $w = $maxW-(2*$x);
1312
+            $w = $maxW - (2 * $x);
1319 1313
             $this->pdf->SetTextColor(90, 90, 90);
1320 1314
             $texto = "NFe CANCELADA";
1321 1315
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
@@ -1326,12 +1320,12 @@  discard block
 block discarded – undo
1326 1320
         if ($this->pNotaDPEC() || $this->tpEmis == 4) {
1327 1321
             //DPEC
1328 1322
             $x = 10;
1329
-            $y = $this->hPrint-130;
1323
+            $y = $this->hPrint - 130;
1330 1324
             $h = 25;
1331
-            $w = $maxW-(2*$x);
1325
+            $w = $maxW - (2 * $x);
1332 1326
             $this->pdf->SetTextColor(200, 200, 200);
1333
-            $texto = "DANFE impresso em contingência -\n".
1334
-                     "DPEC regularmente recebido pela Receita\n".
1327
+            $texto = "DANFE impresso em contingência -\n" .
1328
+                     "DPEC regularmente recebido pela Receita\n" .
1335 1329
                      "Federal do Brasil";
1336 1330
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1337 1331
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
@@ -1340,22 +1334,22 @@  discard block
 block discarded – undo
1340 1334
         if ($this->pNotaDenegada()) {
1341 1335
             //110 301 302 Denegada
1342 1336
             $x = 10;
1343
-            $y = $this->hPrint-130;
1337
+            $y = $this->hPrint - 130;
1344 1338
             $h = 25;
1345
-            $w = $maxW-(2*$x);
1339
+            $w = $maxW - (2 * $x);
1346 1340
             $this->pdf->SetTextColor(90, 90, 90);
1347 1341
             $texto = "NFe USO DENEGADO";
1348 1342
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1349 1343
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1350 1344
             $y += $h;
1351 1345
             $h = 5;
1352
-            $w = $maxW-(2*$x);
1346
+            $w = $maxW - (2 * $x);
1353 1347
             if (isset($this->infProt)) {
1354 1348
                 $xMotivo = $this->infProt->getElementsByTagName("xMotivo")->item(0)->nodeValue;
1355 1349
             } else {
1356 1350
                 $xMotivo = '';
1357 1351
             }
1358
-            $texto = "SEM VALOR FISCAL\n".$xMotivo;
1352
+            $texto = "SEM VALOR FISCAL\n" . $xMotivo;
1359 1353
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
1360 1354
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1361 1355
             $this->pdf->SetTextColor(0, 0, 0);
@@ -1364,29 +1358,29 @@  discard block
 block discarded – undo
1364 1358
         if ($tpAmb != 1) {
1365 1359
             $x = 10;
1366 1360
             if ($this->orientacao == 'P') {
1367
-                $y = round($this->hPrint*2/3, 0);
1361
+                $y = round($this->hPrint * 2 / 3, 0);
1368 1362
             } else {
1369
-                $y = round($this->hPrint/2, 0);
1363
+                $y = round($this->hPrint / 2, 0);
1370 1364
             }
1371 1365
             $h = 5;
1372
-            $w = $maxW-(2*$x);
1366
+            $w = $maxW - (2 * $x);
1373 1367
             $this->pdf->SetTextColor(90, 90, 90);
1374 1368
             $texto = "SEM VALOR FISCAL";
1375 1369
             $aFont = array('font'=>$this->fontePadrao, 'size'=>48, 'style'=>'B');
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 = "AMBIENTE DE HOMOLOGAÇÃO";
1379
-            $this->pTextBox($x, $y+14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1373
+            $this->pTextBox($x, $y + 14, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1380 1374
             $this->pdf->SetTextColor(0, 0, 0);
1381 1375
         } else {
1382 1376
             $x = 10;
1383 1377
             if ($this->orientacao == 'P') {
1384
-                $y = round($this->hPrint*2/3, 0);
1378
+                $y = round($this->hPrint * 2 / 3, 0);
1385 1379
             } else {
1386
-                $y = round($this->hPrint/2, 0);
1380
+                $y = round($this->hPrint / 2, 0);
1387 1381
             }//fim orientacao
1388 1382
             $h = 5;
1389
-            $w = $maxW-(2*$x);
1383
+            $w = $maxW - (2 * $x);
1390 1384
             $this->pdf->SetTextColor(90, 90, 90);
1391 1385
             //indicar FALTA DO PROTOCOLO se NFe não for em contingência
1392 1386
             if (($this->tpEmis == 2 || $this->tpEmis == 5) && !$this->pNotaDPEC()) {
@@ -1396,7 +1390,7 @@  discard block
 block discarded – undo
1396 1390
                 $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1397 1391
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1398 1392
                 $texto = "devido à problemas técnicos";
1399
-                $this->pTextBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1393
+                $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1400 1394
             } else {
1401 1395
                 if (!isset($this->nfeProc)) {
1402 1396
                     if (!$this->pNotaDPEC()) {
@@ -1407,9 +1401,9 @@  discard block
 block discarded – undo
1407 1401
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>30, 'style'=>'B');
1408 1402
                     $texto = "FALTA PROTOCOLO DE APROVAÇÃO DA SEFAZ";
1409 1403
                     if (!$this->pNotaDPEC()) {
1410
-                        $this->pTextBox($x, $y+12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1404
+                        $this->pTextBox($x, $y + 12, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1411 1405
                     } else {
1412
-                        $this->pTextBox($x, $y+25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1406
+                        $this->pTextBox($x, $y + 25, $w, $h, $texto, $aFont, 'C', 'C', 0, '');
1413 1407
                     }
1414 1408
                 }//fim nefProc
1415 1409
             }//fim tpEmis
@@ -1444,7 +1438,7 @@  discard block
 block discarded – undo
1444 1438
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1445 1439
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1446 1440
         //NOME / RAZÃO SOCIAL
1447
-        $w = round($maxW*0.61, 0);
1441
+        $w = round($maxW * 0.61, 0);
1448 1442
         $w1 = $w;
1449 1443
         $y += 3;
1450 1444
         $texto = 'NOME / RAZÃO SOCIAL';
@@ -1459,19 +1453,19 @@  discard block
 block discarded – undo
1459 1453
         }
1460 1454
         //CNPJ / CPF
1461 1455
         $x += $w;
1462
-        $w = round($maxW*0.23, 0);
1456
+        $w = round($maxW * 0.23, 0);
1463 1457
         $w2 = $w;
1464 1458
         $texto = 'CNPJ / CPF';
1465 1459
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1466 1460
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1467 1461
         //Pegando valor do CPF/CNPJ
1468
-        if (! empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1462
+        if (!empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue)) {
1469 1463
             $texto = $this->pFormat(
1470 1464
                 $this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue,
1471 1465
                 "###.###.###/####-##"
1472 1466
             );
1473 1467
         } else {
1474
-            $texto = ! empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1468
+            $texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ?
1475 1469
                     $this->pFormat(
1476 1470
                         $this->dest->getElementsByTagName("CPF")->item(0)->nodeValue,
1477 1471
                         "###.###.###-##"
@@ -1481,15 +1475,15 @@  discard block
 block discarded – undo
1481 1475
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1482 1476
         //DATA DA EMISSÃO
1483 1477
         $x += $w;
1484
-        $w = $maxW-($w1+$w2);
1478
+        $w = $maxW - ($w1 + $w2);
1485 1479
         $wx = $w;
1486 1480
         $texto = 'DATA DA EMISSÃO';
1487 1481
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1488 1482
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1489
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1483
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
1490 1484
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
1491 1485
         if ($dEmi == '') {
1492
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1486
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
1493 1487
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
1494 1488
             $aDemi = explode('T', $dEmi);
1495 1489
             $dEmi = $aDemi[0];
@@ -1502,7 +1496,7 @@  discard block
 block discarded – undo
1502 1496
             $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 1, '');
1503 1497
         }
1504 1498
         //ENDEREÇO
1505
-        $w = round($maxW*0.47, 0);
1499
+        $w = round($maxW * 0.47, 0);
1506 1500
         $w1 = $w;
1507 1501
         $y += $h;
1508 1502
         $x = $oldX;
@@ -1517,7 +1511,7 @@  discard block
 block discarded – undo
1517 1511
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '', true);
1518 1512
         //BAIRRO / DISTRITO
1519 1513
         $x += $w;
1520
-        $w = round($maxW*0.21, 0);
1514
+        $w = round($maxW * 0.21, 0);
1521 1515
         $w2 = $w;
1522 1516
         $texto = 'BAIRRO / DISTRITO';
1523 1517
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
@@ -1527,12 +1521,12 @@  discard block
 block discarded – undo
1527 1521
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1528 1522
         //CEP
1529 1523
         $x += $w;
1530
-        $w = $maxW-$w1-$w2-$wx;
1524
+        $w = $maxW - $w1 - $w2 - $wx;
1531 1525
         $w2 = $w;
1532 1526
         $texto = 'CEP';
1533 1527
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1534 1528
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1535
-        $texto = ! empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1529
+        $texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ?
1536 1530
                 $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue : '';
1537 1531
         $texto = $this->pFormat($texto, "#####-###");
1538 1532
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
@@ -1543,10 +1537,10 @@  discard block
 block discarded – undo
1543 1537
         $texto = 'DATA DA SAÍDA/ENTRADA';
1544 1538
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1545 1539
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1546
-        $dSaiEnt = ! empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1540
+        $dSaiEnt = !empty($this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue) ?
1547 1541
                 $this->ide->getElementsByTagName("dSaiEnt")->item(0)->nodeValue : '';
1548 1542
         if ($dSaiEnt == '') {
1549
-            $dSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1543
+            $dSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1550 1544
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1551 1545
             $aDsaient = explode('T', $dSaiEnt);
1552 1546
             $dSaiEnt = $aDsaient[0];
@@ -1563,7 +1557,7 @@  discard block
 block discarded – undo
1563 1557
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1564 1558
         $texto = $this->dest->getElementsByTagName("xMun")->item(0)->nodeValue;
1565 1559
         if (strtoupper(trim($texto)) == "EXTERIOR" && $this->dest->getElementsByTagName("xPais")->length > 0) {
1566
-            $texto .= " - " .  $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1560
+            $texto .= " - " . $this->dest->getElementsByTagName("xPais")->item(0)->nodeValue;
1567 1561
         }
1568 1562
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1569 1563
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -1578,18 +1572,18 @@  discard block
 block discarded – undo
1578 1572
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1579 1573
         //FONE / FAX
1580 1574
         $x += $w;
1581
-        $w = round(($maxW -$w1-$wx-8)/2, 0);
1575
+        $w = round(($maxW - $w1 - $wx - 8) / 2, 0);
1582 1576
         $w3 = $w;
1583 1577
         $texto = 'FONE / FAX';
1584 1578
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1585 1579
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1586
-        $texto = ! empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1580
+        $texto = !empty($this->dest->getElementsByTagName("fone")->item(0)->nodeValue) ?
1587 1581
                 $this->dest->getElementsByTagName("fone")->item(0)->nodeValue : '';
1588 1582
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
1589 1583
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'C', 0, '');
1590 1584
         //INSCRIÇÃO ESTADUAL
1591 1585
         $x += $w;
1592
-        $w = $maxW -$w1-$wx-8-$w3;
1586
+        $w = $maxW - $w1 - $wx - 8 - $w3;
1593 1587
         $texto = 'INSCRIÇÃO ESTADUAL';
1594 1588
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1595 1589
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -1603,10 +1597,10 @@  discard block
 block discarded – undo
1603 1597
         $texto = 'HORA DA SAÍDA/ENTRADA';
1604 1598
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1605 1599
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
1606
-        $hSaiEnt = ! empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1600
+        $hSaiEnt = !empty($this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue) ?
1607 1601
                 $this->ide->getElementsByTagName("hSaiEnt")->item(0)->nodeValue : '';
1608 1602
         if ($hSaiEnt == '') {
1609
-            $dhSaiEnt = ! empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1603
+            $dhSaiEnt = !empty($this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue) ?
1610 1604
                     $this->ide->getElementsByTagName("dhSaiEnt")->item(0)->nodeValue : '';
1611 1605
             $tsDhSaiEnt = $this->pConvertTime($dhSaiEnt);
1612 1606
             if ($tsDhSaiEnt != '') {
@@ -1631,7 +1625,7 @@  discard block
 block discarded – undo
1631 1625
         if (isset($this->cobr)) {
1632 1626
             $fat = $this->cobr->getElementsByTagName("fat")->item(0);
1633 1627
             if (isset($fat)) {
1634
-                $textoIndPag="";
1628
+                $textoIndPag = "";
1635 1629
                 $indPag = $this->pSimpleGetValue($this->ide, "indPag");
1636 1630
                 if ($indPag === "0") {
1637 1631
                     $textoIndPag = "Pagamento à Vista - ";
@@ -1678,7 +1672,7 @@  discard block
 block discarded – undo
1678 1672
     protected function pFaturaDANFE($x, $y)
1679 1673
     {
1680 1674
         $linha = 1;
1681
-        $h = 8+3;
1675
+        $h = 8 + 3;
1682 1676
         $oldx = $x;
1683 1677
         $textoFatura = $this->pGetTextoFatura();
1684 1678
         //verificar se existem duplicatas
@@ -1699,27 +1693,27 @@  discard block
 block discarded – undo
1699 1693
             $dupcont = 0;
1700 1694
             $nFat = $this->dup->length;
1701 1695
             if ($textoFatura !== "" && $this->exibirTextoFatura) {
1702
-                $myH=6;
1696
+                $myH = 6;
1703 1697
                 $myW = $this->wPrint;
1704 1698
                 if ($this->orientacao == 'L') {
1705 1699
                     $myW -= $this->wCanhoto;
1706 1700
                 }
1707 1701
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>8, 'style'=>'');
1708 1702
                 $this->pTextBox($x, $y, $myW, $myH, $textoFatura, $aFont, 'C', 'L', 1, '');
1709
-                $y+=$myH+1;
1703
+                $y += $myH + 1;
1710 1704
             }
1711 1705
             if ($this->orientacao == 'P') {
1712
-                $w = round($this->wPrint/7.018, 0)-1;
1706
+                $w = round($this->wPrint / 7.018, 0) - 1;
1713 1707
             } else {
1714 1708
                 $w = 28;
1715 1709
             }
1716 1710
             $increm = 1;
1717 1711
             foreach ($this->dup as $k => $d) {
1718
-                $nDup = ! empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1712
+                $nDup = !empty($this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue) ?
1719 1713
                         $this->dup->item($k)->getElementsByTagName('nDup')->item(0)->nodeValue : '';
1720
-                $dDup = ! empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1714
+                $dDup = !empty($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) ?
1721 1715
                         $this->pYmd2dmy($this->dup->item($k)->getElementsByTagName('dVenc')->item(0)->nodeValue) : '';
1722
-                $vDup = ! empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1716
+                $vDup = !empty($this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue) ?
1723 1717
                         'R$ ' . number_format(
1724 1718
                             $this->dup->item($k)->getElementsByTagName('vDup')->item(0)->nodeValue,
1725 1719
                             2,
@@ -1728,14 +1722,14 @@  discard block
 block discarded – undo
1728 1722
                         ) : '';
1729 1723
                 $h = 8;
1730 1724
                 $texto = '';
1731
-                if ($nDup!='0' && $nDup!='') {
1725
+                if ($nDup != '0' && $nDup != '') {
1732 1726
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1733 1727
                     $this->pTextBox($x, $y, $w, $h, 'Num.', $aFont, 'T', 'L', 1, '');
1734 1728
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1735 1729
                     $this->pTextBox($x, $y, $w, $h, $nDup, $aFont, 'T', 'R', 0, '');
1736 1730
                 } else {
1737 1731
                     $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1738
-                    $this->pTextBox($x, $y, $w, $h, ($dupcont+1)."", $aFont, 'T', 'L', 1, '');
1732
+                    $this->pTextBox($x, $y, $w, $h, ($dupcont + 1) . "", $aFont, 'T', 'L', 1, '');
1739 1733
                 }
1740 1734
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1741 1735
                 $this->pTextBox($x, $y, $w, $h, 'Venc.', $aFont, 'C', 'L', 0, '');
@@ -1745,7 +1739,7 @@  discard block
 block discarded – undo
1745 1739
                 $this->pTextBox($x, $y, $w, $h, 'Valor', $aFont, 'B', 'L', 0, '');
1746 1740
                 $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1747 1741
                 $this->pTextBox($x, $y, $w, $h, $vDup, $aFont, 'B', 'R', 0, '');
1748
-                $x += $w+$increm;
1742
+                $x += $w + $increm;
1749 1743
                 $dupcont += 1;
1750 1744
                 if ($this->orientacao == 'P') {
1751 1745
                     $maxDupCont = 6;
@@ -1767,10 +1761,10 @@  discard block
 block discarded – undo
1767 1761
                 $y -= 9;
1768 1762
                 $linha--;
1769 1763
             }
1770
-            return ($y+$h);
1764
+            return ($y + $h);
1771 1765
         } else {
1772 1766
             $linha = 0;
1773
-            return ($y-2);
1767
+            return ($y - 2);
1774 1768
         }
1775 1769
     } //fim da função faturaDANFE
1776 1770
 
@@ -1882,7 +1876,7 @@  discard block
 block discarded – undo
1882 1876
         }
1883 1877
         $x = $this->pImpostoDanfeHelper($x, $y, $w, $h, "V. TOTAL DA NOTA", "vNF");
1884 1878
 
1885
-        return ($y+$h);
1879
+        return ($y + $h);
1886 1880
     } //fim impostoDANFE
1887 1881
 
1888 1882
     /**
@@ -1910,13 +1904,13 @@  discard block
 block discarded – undo
1910 1904
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
1911 1905
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
1912 1906
         //NOME / RAZÃO SOCIAL
1913
-        $w1 = $maxW*0.29;
1907
+        $w1 = $maxW * 0.29;
1914 1908
         $y += 3;
1915 1909
         $texto = 'NOME / RAZÃO SOCIAL';
1916 1910
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1917 1911
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
1918 1912
         if (isset($this->transporta)) {
1919
-            $texto = ! empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
1913
+            $texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ?
1920 1914
                     $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue : '';
1921 1915
         } else {
1922 1916
             $texto = '';
@@ -1925,11 +1919,11 @@  discard block
 block discarded – undo
1925 1919
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
1926 1920
         //FRETE POR CONTA
1927 1921
         $x += $w1;
1928
-        $w2 = $maxW*0.15;
1922
+        $w2 = $maxW * 0.15;
1929 1923
         $texto = 'FRETE POR CONTA';
1930 1924
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1931 1925
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
1932
-        $tipoFrete = ! empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
1926
+        $tipoFrete = !empty($this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue) ?
1933 1927
                 $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue : '0';
1934 1928
         switch ($tipoFrete) {
1935 1929
             case 0:
@@ -1953,7 +1947,7 @@  discard block
 block discarded – undo
1953 1947
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1954 1948
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
1955 1949
         if (isset($this->veicTransp)) {
1956
-            $texto = ! empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
1950
+            $texto = !empty($this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue) ?
1957 1951
                     $this->veicTransp->getElementsByTagName("RNTC")->item(0)->nodeValue : '';
1958 1952
         } else {
1959 1953
             $texto = '';
@@ -1966,10 +1960,10 @@  discard block
 block discarded – undo
1966 1960
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1967 1961
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
1968 1962
         if (isset($this->veicTransp)) {
1969
-            $texto = ! empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
1963
+            $texto = !empty($this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue) ?
1970 1964
                     $this->veicTransp->getElementsByTagName("placa")->item(0)->nodeValue : '';
1971 1965
         } elseif (isset($this->reboque)) {
1972
-            $texto = ! empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
1966
+            $texto = !empty($this->reboque->getElementsByTagName("placa")->item(0)->nodeValue) ?
1973 1967
                     $this->reboque->getElementsByTagName("placa")->item(0)->nodeValue : '';
1974 1968
         } else {
1975 1969
             $texto = '';
@@ -1978,15 +1972,15 @@  discard block
 block discarded – undo
1978 1972
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
1979 1973
         //UF
1980 1974
         $x += $w2;
1981
-        $w3 = round($maxW*0.04, 0);
1975
+        $w3 = round($maxW * 0.04, 0);
1982 1976
         $texto = 'UF';
1983 1977
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
1984 1978
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
1985 1979
         if (isset($this->veicTransp)) {
1986
-            $texto = ! empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
1980
+            $texto = !empty($this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue) ?
1987 1981
                     $this->veicTransp->getElementsByTagName("UF")->item(0)->nodeValue : '';
1988 1982
         } elseif (isset($this->reboque)) {
1989
-            $texto = ! empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
1983
+            $texto = !empty($this->reboque->getElementsByTagName("UF")->item(0)->nodeValue) ?
1990 1984
                     $this->reboque->getElementsByTagName("UF")->item(0)->nodeValue : '';
1991 1985
         } else {
1992 1986
             $texto = '';
@@ -1995,18 +1989,18 @@  discard block
 block discarded – undo
1995 1989
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
1996 1990
         //CNPJ / CPF
1997 1991
         $x += $w3;
1998
-        $w = $maxW-($w1+3*$w2+$w3);
1992
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
1999 1993
         $texto = 'CNPJ / CPF';
2000 1994
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2001 1995
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2002 1996
         if (isset($this->transporta)) {
2003
-            $texto = ! empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
1997
+            $texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ?
2004 1998
                     $this->pFormat(
2005 1999
                         $this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,
2006 2000
                         "##.###.###/####-##"
2007 2001
                     ) : '';
2008 2002
             if ($texto == '') {
2009
-                $texto = ! empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2003
+                $texto = !empty($this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue) ?
2010 2004
                         $this->pFormat(
2011 2005
                             $this->transporta->getElementsByTagName("CPF")->item(0)->nodeValue,
2012 2006
                             "###.###.###-##"
@@ -2022,12 +2016,12 @@  discard block
 block discarded – undo
2022 2016
         $y += $h;
2023 2017
         $x = $oldX;
2024 2018
         $h = 7;
2025
-        $w1 = $maxW*0.44;
2019
+        $w1 = $maxW * 0.44;
2026 2020
         $texto = 'ENDEREÇO';
2027 2021
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2028 2022
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
2029 2023
         if (isset($this->transporta)) {
2030
-            $texto = ! empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2024
+            $texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ?
2031 2025
                     $this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue : '';
2032 2026
         } else {
2033 2027
             $texto = '';
@@ -2036,12 +2030,12 @@  discard block
 block discarded – undo
2036 2030
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'B', 'L', 0, '');
2037 2031
         //MUNICÍPIO
2038 2032
         $x += $w1;
2039
-        $w2 = round($maxW*0.30, 0);
2033
+        $w2 = round($maxW * 0.30, 0);
2040 2034
         $texto = 'MUNICÍPIO';
2041 2035
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2042 2036
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2043 2037
         if (isset($this->transporta)) {
2044
-            $texto = ! empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2038
+            $texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ?
2045 2039
                     $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue : '';
2046 2040
         } else {
2047 2041
             $texto = '';
@@ -2050,12 +2044,12 @@  discard block
 block discarded – undo
2050 2044
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2051 2045
         //UF
2052 2046
         $x += $w2;
2053
-        $w3 = round($maxW*0.04, 0);
2047
+        $w3 = round($maxW * 0.04, 0);
2054 2048
         $texto = 'UF';
2055 2049
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2056 2050
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
2057 2051
         if (isset($this->transporta)) {
2058
-            $texto = ! empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2052
+            $texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ?
2059 2053
                     $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue : '';
2060 2054
         } else {
2061 2055
             $texto = '';
@@ -2064,13 +2058,13 @@  discard block
 block discarded – undo
2064 2058
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'C', 0, '');
2065 2059
         //INSCRIÇÃO ESTADUAL
2066 2060
         $x += $w3;
2067
-        $w = $maxW-($w1+$w2+$w3);
2061
+        $w = $maxW - ($w1 + $w2 + $w3);
2068 2062
         $texto = 'INSCRIÇÃO ESTADUAL';
2069 2063
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2070 2064
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2071 2065
         $texto = '';
2072 2066
         if (isset($this->transporta)) {
2073
-            if (! empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2067
+            if (!empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue)) {
2074 2068
                 $texto = $this->transporta->getElementsByTagName("IE")->item(0)->nodeValue;
2075 2069
             }
2076 2070
         }
@@ -2083,16 +2077,16 @@  discard block
 block discarded – undo
2083 2077
         $marca = '';
2084 2078
         $numero = '';
2085 2079
         $texto = '';
2086
-        $pesoBruto=0;
2087
-        $pesoLiquido=0;
2080
+        $pesoBruto = 0;
2081
+        $pesoLiquido = 0;
2088 2082
         foreach ($volumes as $volume) {
2089
-            $quantidade += ! empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2083
+            $quantidade += !empty($volume->getElementsByTagName("qVol")->item(0)->nodeValue) ?
2090 2084
                     $volume->getElementsByTagName("qVol")->item(0)->nodeValue : 0;
2091
-            $pesoBruto += ! empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2085
+            $pesoBruto += !empty($volume->getElementsByTagName("pesoB")->item(0)->nodeValue) ?
2092 2086
                     $volume->getElementsByTagName("pesoB")->item(0)->nodeValue : 0;
2093
-            $pesoLiquido += ! empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2087
+            $pesoLiquido += !empty($volume->getElementsByTagName("pesoL")->item(0)->nodeValue) ?
2094 2088
                     $volume->getElementsByTagName("pesoL")->item(0)->nodeValue : 0;
2095
-            $texto = ! empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2089
+            $texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ?
2096 2090
                     $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';
2097 2091
             if ($texto != $especie && $especie != '') {
2098 2092
                 //tem várias especies
@@ -2100,7 +2094,7 @@  discard block
 block discarded – undo
2100 2094
             } else {
2101 2095
                 $especie = $texto;
2102 2096
             }
2103
-            $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2097
+            $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2104 2098
                     $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2105 2099
             if ($texto != $marca && $marca != '') {
2106 2100
                 //tem várias especies
@@ -2108,7 +2102,7 @@  discard block
 block discarded – undo
2108 2102
             } else {
2109 2103
                 $marca = $texto;
2110 2104
             }
2111
-            $texto = ! empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2105
+            $texto = !empty($this->transp->getElementsByTagName("nVol")->item(0)->nodeValue) ?
2112 2106
                     $this->transp->getElementsByTagName("nVol")->item(0)->nodeValue : '';
2113 2107
             if ($texto != $numero && $numero != '') {
2114 2108
                 //tem várias especies
@@ -2123,7 +2117,7 @@  discard block
 block discarded – undo
2123 2117
         $y += $h;
2124 2118
         $x = $oldX;
2125 2119
         $h = 7;
2126
-        $w1 = round($maxW*0.10, 0);
2120
+        $w1 = round($maxW * 0.10, 0);
2127 2121
         $texto = 'QUANTIDADE';
2128 2122
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2129 2123
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2134,7 +2128,7 @@  discard block
 block discarded – undo
2134 2128
         }
2135 2129
         //ESPÉCIE
2136 2130
         $x += $w1;
2137
-        $w2 = round($maxW*0.17, 0);
2131
+        $w2 = round($maxW * 0.17, 0);
2138 2132
         $texto = 'ESPÉCIE';
2139 2133
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2140 2134
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2146,7 +2140,7 @@  discard block
 block discarded – undo
2146 2140
         $texto = 'MARCA';
2147 2141
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2148 2142
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'T', 'L', 1, '');
2149
-        $texto = ! empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2143
+        $texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ?
2150 2144
                 $this->transp->getElementsByTagName("marca")->item(0)->nodeValue : '';
2151 2145
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2152 2146
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
@@ -2160,7 +2154,7 @@  discard block
 block discarded – undo
2160 2154
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'B', 'C', 0, '');
2161 2155
         //PESO BRUTO
2162 2156
         $x += $w2;
2163
-        $w3 = round($maxW*0.20, 0);
2157
+        $w3 = round($maxW * 0.20, 0);
2164 2158
         $texto = 'PESO BRUTO';
2165 2159
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2166 2160
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2173,7 +2167,7 @@  discard block
 block discarded – undo
2173 2167
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'B', 'R', 0, '');
2174 2168
         //PESO LÍQUIDO
2175 2169
         $x += $w3;
2176
-        $w = $maxW -($w1+3*$w2+$w3);
2170
+        $w = $maxW - ($w1 + 3 * $w2 + $w3);
2177 2171
         $texto = 'PESO LÍQUIDO';
2178 2172
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2179 2173
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2184,7 +2178,7 @@  discard block
 block discarded – undo
2184 2178
         }
2185 2179
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2186 2180
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2187
-        return ($y+$h);
2181
+        return ($y + $h);
2188 2182
     } //fim transporteDANFE
2189 2183
 
2190 2184
 
@@ -2196,7 +2190,7 @@  discard block
 block discarded – undo
2196 2190
             return "";
2197 2191
         }
2198 2192
         $valor_original = $valor_original->nodeValue;
2199
-        $valor = ! empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2193
+        $valor = !empty($valor_original) ? number_format($valor_original, 2, ",", ".") : '';
2200 2194
 
2201 2195
         if ($valor != "") {
2202 2196
             return sprintf($formato, $valor);
@@ -2234,13 +2228,13 @@  discard block
 block discarded – undo
2234 2228
             $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
2235 2229
             $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
2236 2230
         }
2237
-        $infAdProd = ! empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ?
2231
+        $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ?
2238 2232
                 substr($this->pAnfavea($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue), 0, 500) : '';
2239
-        if (! empty($infAdProd)) {
2233
+        if (!empty($infAdProd)) {
2240 2234
             $infAdProd = trim($infAdProd);
2241 2235
             $infAdProd .= ' ';
2242 2236
         }
2243
-        $medTxt='';
2237
+        $medTxt = '';
2244 2238
         $med = $prod->getElementsByTagName("med");
2245 2239
         if (isset($med)) {
2246 2240
             $i = 0;
@@ -2253,14 +2247,14 @@  discard block
 block discarded – undo
2253 2247
                 $i++;
2254 2248
             }
2255 2249
             if ($medTxt != '') {
2256
-                $medTxt.= ' ';
2250
+                $medTxt .= ' ';
2257 2251
             }
2258 2252
         }
2259 2253
         //NT2013.006 FCI
2260
-        $nFCI = (! empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2261
-                ' FCI:'.$itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2262
-        $tmp_ad=$infAdProd . ($this->descProdInfoComplemento ? $medTxt . $impostos . $nFCI : '');
2263
-        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad)!=0?"\n    ".$tmp_ad:'');
2254
+        $nFCI = (!empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue)) ?
2255
+                ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
2256
+        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $medTxt . $impostos . $nFCI : '');
2257
+        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
2264 2258
         if ($this->descProdQuebraLinha) {
2265 2259
             $texto = str_replace(";", "\n", $texto);
2266 2260
         }
@@ -2308,104 +2302,104 @@  discard block
 block discarded – undo
2308 2302
         // cabecalho LOOP COM OS DADOS DOS PRODUTOS
2309 2303
         //CÓDIGO PRODUTO
2310 2304
         $texto = "CÓDIGO PRODUTO";
2311
-        $w1 = round($w*0.09, 0);
2305
+        $w1 = round($w * 0.09, 0);
2312 2306
         $h = 4;
2313 2307
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2314 2308
         $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2315
-        $this->pdf->Line($x+$w1, $y, $x+$w1, $y+$hmax);
2309
+        $this->pdf->Line($x + $w1, $y, $x + $w1, $y + $hmax);
2316 2310
         //DESCRIÇÃO DO PRODUTO / SERVIÇO
2317 2311
         $x += $w1;
2318
-        $w2 = round($w*0.28, 0);
2312
+        $w2 = round($w * 0.28, 0);
2319 2313
         $texto = 'DESCRIÇÃO DO PRODUTO / SERVIÇO';
2320 2314
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2321 2315
         $this->pTextBox($x, $y, $w2, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2322
-        $this->pdf->Line($x+$w2, $y, $x+$w2, $y+$hmax);
2316
+        $this->pdf->Line($x + $w2, $y, $x + $w2, $y + $hmax);
2323 2317
         //NCM/SH
2324 2318
         $x += $w2;
2325
-        $w3 = round($w*0.06, 0);
2319
+        $w3 = round($w * 0.06, 0);
2326 2320
         $texto = 'NCM/SH';
2327 2321
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2328 2322
         $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2329
-        $this->pdf->Line($x+$w3, $y, $x+$w3, $y+$hmax);
2323
+        $this->pdf->Line($x + $w3, $y, $x + $w3, $y + $hmax);
2330 2324
         //O/CST ou O/CSOSN
2331 2325
         $x += $w3;
2332
-        $w4 = round($w*0.05, 0);
2333
-        $texto = 'O/CSOSN';//Regime do Simples CRT = 1 ou CRT = 2
2326
+        $w4 = round($w * 0.05, 0);
2327
+        $texto = 'O/CSOSN'; //Regime do Simples CRT = 1 ou CRT = 2
2334 2328
         if ($this->pSimpleGetValue($this->emit, 'CRT') == '3') {
2335
-             $texto = 'O/CST';//Regime Normal
2329
+             $texto = 'O/CST'; //Regime Normal
2336 2330
         }
2337 2331
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2338 2332
         $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2339
-        $this->pdf->Line($x+$w4, $y, $x+$w4, $y+$hmax);
2333
+        $this->pdf->Line($x + $w4, $y, $x + $w4, $y + $hmax);
2340 2334
         //CFOP
2341 2335
         $x += $w4;
2342
-        $w5 = round($w*0.04, 0);
2336
+        $w5 = round($w * 0.04, 0);
2343 2337
         $texto = 'CFOP';
2344 2338
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2345 2339
         $this->pTextBox($x, $y, $w5, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2346
-        $this->pdf->Line($x+$w5, $y, $x+$w5, $y+$hmax);
2340
+        $this->pdf->Line($x + $w5, $y, $x + $w5, $y + $hmax);
2347 2341
         //UN
2348 2342
         $x += $w5;
2349
-        $w6 = round($w*0.03, 0);
2343
+        $w6 = round($w * 0.03, 0);
2350 2344
         $texto = 'UN';
2351 2345
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2352 2346
         $this->pTextBox($x, $y, $w6, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2353
-        $this->pdf->Line($x+$w6, $y, $x+$w6, $y+$hmax);
2347
+        $this->pdf->Line($x + $w6, $y, $x + $w6, $y + $hmax);
2354 2348
         //QUANT
2355 2349
         $x += $w6;
2356
-        $w7 = round($w*0.07, 0);
2350
+        $w7 = round($w * 0.07, 0);
2357 2351
         $texto = 'QUANT';
2358 2352
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2359 2353
         $this->pTextBox($x, $y, $w7, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2360
-        $this->pdf->Line($x+$w7, $y, $x+$w7, $y+$hmax);
2354
+        $this->pdf->Line($x + $w7, $y, $x + $w7, $y + $hmax);
2361 2355
         //VALOR UNIT
2362 2356
         $x += $w7;
2363
-        $w8 = round($w*0.06, 0);
2357
+        $w8 = round($w * 0.06, 0);
2364 2358
         $texto = 'VALOR UNIT';
2365 2359
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2366 2360
         $this->pTextBox($x, $y, $w8, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2367
-        $this->pdf->Line($x+$w8, $y, $x+$w8, $y+$hmax);
2361
+        $this->pdf->Line($x + $w8, $y, $x + $w8, $y + $hmax);
2368 2362
         //VALOR TOTAL
2369 2363
         $x += $w8;
2370
-        $w9 = round($w*0.06, 0);
2364
+        $w9 = round($w * 0.06, 0);
2371 2365
         $texto = 'VALOR TOTAL';
2372 2366
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2373 2367
         $this->pTextBox($x, $y, $w9, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2374
-        $this->pdf->Line($x+$w9, $y, $x+$w9, $y+$hmax);
2368
+        $this->pdf->Line($x + $w9, $y, $x + $w9, $y + $hmax);
2375 2369
         //B.CÁLC ICMS
2376 2370
         $x += $w9;
2377
-        $w10 = round($w*0.06, 0);
2371
+        $w10 = round($w * 0.06, 0);
2378 2372
         $texto = 'B.CÁLC ICMS';
2379 2373
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2380 2374
         $this->pTextBox($x, $y, $w10, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2381
-        $this->pdf->Line($x+$w10, $y, $x+$w10, $y+$hmax);
2375
+        $this->pdf->Line($x + $w10, $y, $x + $w10, $y + $hmax);
2382 2376
         //VALOR ICMS
2383 2377
         $x += $w10;
2384
-        $w11 = round($w*0.06, 0);
2378
+        $w11 = round($w * 0.06, 0);
2385 2379
         $texto = 'VALOR ICMS';
2386 2380
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2387 2381
         $this->pTextBox($x, $y, $w11, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2388
-        $this->pdf->Line($x+$w11, $y, $x+$w11, $y+$hmax);
2382
+        $this->pdf->Line($x + $w11, $y, $x + $w11, $y + $hmax);
2389 2383
         //VALOR IPI
2390 2384
         $x += $w11;
2391
-        $w12 = round($w*0.05, 0);
2385
+        $w12 = round($w * 0.05, 0);
2392 2386
         $texto = 'VALOR IPI';
2393 2387
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2394 2388
         $this->pTextBox($x, $y, $w12, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2395
-        $this->pdf->Line($x+$w12, $y, $x+$w12, $y+$hmax);
2389
+        $this->pdf->Line($x + $w12, $y, $x + $w12, $y + $hmax);
2396 2390
         //ALÍQ. ICMS
2397 2391
         $x += $w12;
2398
-        $w13 = round($w*0.035, 0);
2392
+        $w13 = round($w * 0.035, 0);
2399 2393
         $texto = 'ALÍQ. ICMS';
2400 2394
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2401 2395
         $this->pTextBox($x, $y, $w13, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2402
-        $this->pdf->Line($x+$w13, $y, $x+$w13, $y+$hmax);
2396
+        $this->pdf->Line($x + $w13, $y, $x + $w13, $y + $hmax);
2403 2397
         //ALÍQ. IPI
2404 2398
         $x += $w13;
2405
-        $w14 = $w-($w1+$w2+$w3+$w4+$w5+$w6+$w7+$w8+$w9+$w10+$w11+$w12+$w13);
2399
+        $w14 = $w - ($w1 + $w2 + $w3 + $w4 + $w5 + $w6 + $w7 + $w8 + $w9 + $w10 + $w11 + $w12 + $w13);
2406 2400
         $texto = 'ALÍQ. IPI';
2407 2401
         $this->pTextBox($x, $y, $w14, $h, $texto, $aFont, 'C', 'C', 0, '', false);
2408
-        $this->pdf->Line($oldX, $y+$h+1, $oldX + $w, $y+$h+1);
2402
+        $this->pdf->Line($oldX, $y + $h + 1, $oldX + $w, $y + $h + 1);
2409 2403
         $y += 5;
2410 2404
         //##################################################################################
2411 2405
         // LOOP COM OS DADOS DOS PRODUTOS
@@ -2422,7 +2416,7 @@  discard block
 block discarded – undo
2422 2416
                 $IPI  = $imposto->getElementsByTagName("IPI")->item(0);
2423 2417
                 $textoProduto = $this->pDescricaoProduto($thisItem);
2424 2418
                 $linhaDescr = $this->pGetNumLines($textoProduto, $w2, $aFont);
2425
-                $h = round(($linhaDescr * $this->pdf->fontSize)+ ($linhaDescr * 0.5), 2);
2419
+                $h = round(($linhaDescr * $this->pdf->fontSize) + ($linhaDescr * 0.5), 2);
2426 2420
                 $hUsado += $h;
2427 2421
                 if ($pag != $totpag) {
2428 2422
                     if ($hUsado >= $hmax && $i < $totItens) {
@@ -2432,11 +2426,11 @@  discard block
 block discarded – undo
2432 2426
                         break;
2433 2427
                     }
2434 2428
                 }
2435
-                $y_linha=$y+$h;
2429
+                $y_linha = $y + $h;
2436 2430
                 // linha entre itens
2437 2431
                 $this->pdf->DashedHLine($oldX, $y_linha, $w, 0.1, 120);
2438 2432
                 //corrige o x
2439
-                $x=$oldX;
2433
+                $x = $oldX;
2440 2434
                 //codigo do produto
2441 2435
                 $texto = $prod->getElementsByTagName("cProd")->item(0)->nodeValue;
2442 2436
                 $this->pTextBox($x, $y, $w1, $h, $texto, $aFont, 'T', 'C', 0, '');
@@ -2449,16 +2443,16 @@  discard block
 block discarded – undo
2449 2443
                 }
2450 2444
                 $x += $w2;
2451 2445
                 //NCM
2452
-                $texto = ! empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2446
+                $texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ?
2453 2447
                         $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';
2454 2448
                 $this->pTextBox($x, $y, $w3, $h, $texto, $aFont, 'T', 'C', 0, '');
2455 2449
                 $x += $w3;
2456 2450
                 //CST
2457 2451
                 if (isset($ICMS)) {
2458
-                    $origem =  $this->pSimpleGetValue($ICMS, "orig");
2459
-                    $cst =  $this->pSimpleGetValue($ICMS, "CST");
2460
-                    $csosn =  $this->pSimpleGetValue($ICMS, "CSOSN");
2461
-                    $texto = $origem.$cst.$csosn;
2452
+                    $origem = $this->pSimpleGetValue($ICMS, "orig");
2453
+                    $cst = $this->pSimpleGetValue($ICMS, "CST");
2454
+                    $csosn = $this->pSimpleGetValue($ICMS, "CSOSN");
2455
+                    $texto = $origem . $cst . $csosn;
2462 2456
                     $this->pTextBox($x, $y, $w4, $h, $texto, $aFont, 'T', 'C', 0, '');
2463 2457
                 }
2464 2458
                 //CFOP
@@ -2492,7 +2486,7 @@  discard block
 block discarded – undo
2492 2486
                 //Valor da Base de calculo
2493 2487
                 $x += $w9;
2494 2488
                 if (isset($ICMS)) {
2495
-                    $texto = ! empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2489
+                    $texto = !empty($ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2496 2490
                             number_format(
2497 2491
                                 $ICMS->getElementsByTagName("vBC")->item(0)->nodeValue,
2498 2492
                                 2,
@@ -2504,7 +2498,7 @@  discard block
 block discarded – undo
2504 2498
                 //Valor do ICMS
2505 2499
                 $x += $w10;
2506 2500
                 if (isset($ICMS)) {
2507
-                    $texto = ! empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2501
+                    $texto = !empty($ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ?
2508 2502
                             number_format(
2509 2503
                                 $ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue,
2510 2504
                                 2,
@@ -2516,8 +2510,8 @@  discard block
 block discarded – undo
2516 2510
                 //Valor do IPI
2517 2511
                 $x += $w11;
2518 2512
                 if (isset($IPI)) {
2519
-                    $texto = ! empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2520
-                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") :'';
2513
+                    $texto = !empty($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue) ?
2514
+                            number_format($IPI->getElementsByTagName("vIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2521 2515
                 } else {
2522 2516
                     $texto = '';
2523 2517
                 }
@@ -2525,7 +2519,7 @@  discard block
 block discarded – undo
2525 2519
                 // %ICMS
2526 2520
                 $x += $w12;
2527 2521
                 if (isset($ICMS)) {
2528
-                    $texto = ! empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2522
+                    $texto = !empty($ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ?
2529 2523
                             number_format(
2530 2524
                                 $ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue,
2531 2525
                                 2,
@@ -2537,7 +2531,7 @@  discard block
 block discarded – undo
2537 2531
                 //%IPI
2538 2532
                 $x += $w13;
2539 2533
                 if (isset($IPI)) {
2540
-                    $texto = ! empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2534
+                    $texto = !empty($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue) ?
2541 2535
                             number_format($IPI->getElementsByTagName("pIPI")->item(0)->nodeValue, 2, ",", ".") : '';
2542 2536
                 } else {
2543 2537
                     $texto = '';
@@ -2551,7 +2545,7 @@  discard block
 block discarded – undo
2551 2545
                 $i++;
2552 2546
             }
2553 2547
         }
2554
-        return $oldY+$hmax;
2548
+        return $oldY + $hmax;
2555 2549
     }
2556 2550
 
2557 2551
     /**
@@ -2575,12 +2569,12 @@  discard block
 block discarded – undo
2575 2569
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 0, '');
2576 2570
         //INSCRIÇÃO MUNICIPAL
2577 2571
         $y += 3;
2578
-        $w = round($this->wPrint*0.23, 0);
2572
+        $w = round($this->wPrint * 0.23, 0);
2579 2573
         $texto = 'INSCRIÇÃO MUNICIPAL';
2580 2574
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2581 2575
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2582 2576
         //inscrição municipal
2583
-        $texto = ! empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2577
+        $texto = !empty($this->emit->getElementsByTagName("IM")->item(0)->nodeValue) ?
2584 2578
                 $this->emit->getElementsByTagName("IM")->item(0)->nodeValue : '';
2585 2579
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2586 2580
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'L', 0, '');
@@ -2590,7 +2584,7 @@  discard block
 block discarded – undo
2590 2584
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2591 2585
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2592 2586
         if (isset($this->ISSQNtot)) {
2593
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2587
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue) ?
2594 2588
                     $this->ISSQNtot->getElementsByTagName("vServ")->item(0)->nodeValue : '';
2595 2589
             $texto = number_format($texto, 2, ",", ".");
2596 2590
         } else {
@@ -2604,9 +2598,9 @@  discard block
 block discarded – undo
2604 2598
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2605 2599
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2606 2600
         if (isset($this->ISSQNtot)) {
2607
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2601
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue) ?
2608 2602
                     $this->ISSQNtot->getElementsByTagName("vBC")->item(0)->nodeValue : '';
2609
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2603
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2610 2604
         } else {
2611 2605
             $texto = '';
2612 2606
         }
@@ -2617,21 +2611,21 @@  discard block
 block discarded – undo
2617 2611
         if ($this->orientacao == 'P') {
2618 2612
             $w = $this->wPrint - (3 * $w);
2619 2613
         } else {
2620
-            $w = $this->wPrint - (3 * $w)-$this->wCanhoto;
2614
+            $w = $this->wPrint - (3 * $w) - $this->wCanhoto;
2621 2615
         }
2622 2616
         $texto = 'VALOR TOTAL DO ISSQN';
2623 2617
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2624 2618
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
2625 2619
         if (isset($this->ISSQNtot)) {
2626
-            $texto = ! empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2620
+            $texto = !empty($this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue) ?
2627 2621
                     $this->ISSQNtot->getElementsByTagName("vISS")->item(0)->nodeValue : '';
2628
-            $texto = ! empty($texto) ? number_format($texto, 2, ",", ".") : '';
2622
+            $texto = !empty($texto) ? number_format($texto, 2, ",", ".") : '';
2629 2623
         } else {
2630 2624
             $texto = '';
2631 2625
         }
2632 2626
         $aFont = array('font'=>$this->fontePadrao, 'size'=>10, 'style'=>'B');
2633 2627
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'B', 'R', 0, '');
2634
-        return ($y+$h+1);
2628
+        return ($y + $h + 1);
2635 2629
     }
2636 2630
 
2637 2631
     /**
@@ -2652,7 +2646,7 @@  discard block
 block discarded – undo
2652 2646
         if ($this->orientacao == 'P') {
2653 2647
               $w = $this->wPrint;
2654 2648
         } else {
2655
-              $w = $this->wPrint-$this->wCanhoto;
2649
+              $w = $this->wPrint - $this->wCanhoto;
2656 2650
         }
2657 2651
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'B');
2658 2652
         $this->pTextBox($x, $y, $w, 8, $texto, $aFont, 'T', 'L', 0, '');
@@ -2668,15 +2662,15 @@  discard block
 block discarded – undo
2668 2662
         //$this->textoAdic com o texto completo do campo
2669 2663
         $y += 1;
2670 2664
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
2671
-        $this->pTextBox($x, $y+2, $w-2, $h-3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
2665
+        $this->pTextBox($x, $y + 2, $w - 2, $h - 3, $this->textoAdic, $aFont, 'T', 'L', 0, '', false);
2672 2666
         //RESERVADO AO FISCO
2673 2667
         $texto = "RESERVADO AO FISCO";
2674 2668
         $x += $w;
2675 2669
         $y -= 1;
2676 2670
         if ($this->orientacao == 'P') {
2677
-            $w = $this->wPrint-$w;
2671
+            $w = $this->wPrint - $w;
2678 2672
         } else {
2679
-            $w = $this->wPrint-$w-$this->wCanhoto;
2673
+            $w = $this->wPrint - $w - $this->wCanhoto;
2680 2674
         }
2681 2675
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'B');
2682 2676
         $this->pTextBox($x, $y, $w, $h, $texto, $aFont, 'T', 'L', 1, '');
@@ -2715,8 +2709,8 @@  discard block
 block discarded – undo
2715 2709
         }
2716 2710
         $y += 2;
2717 2711
         $aFont = array('font'=>$this->fontePadrao, 'size'=>7, 'style'=>'');
2718
-        $this->pTextBox($x, $y, $w-2, $h-3, $texto, $aFont, 'T', 'L', 0, '', false);
2719
-        return $y+$h;
2712
+        $this->pTextBox($x, $y, $w - 2, $h - 3, $texto, $aFont, 'T', 'L', 0, '', false);
2713
+        return $y + $h;
2720 2714
     }
2721 2715
 
2722 2716
     /**
@@ -2734,13 +2728,13 @@  discard block
 block discarded – undo
2734 2728
         if ($this->orientacao == 'P') {
2735 2729
               $w = $this->wPrint;
2736 2730
         } else {
2737
-              $w = $this->wPrint-$this->wCanhoto;
2731
+              $w = $this->wPrint - $this->wCanhoto;
2738 2732
               $x = $this->wCanhoto;
2739 2733
         }
2740 2734
         $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'I');
2741
-        $texto = "Impresso em ". date('d/m/Y') . " as " . date('H:i:s');
2735
+        $texto = "Impresso em " . date('d/m/Y') . " as " . date('H:i:s');
2742 2736
         $this->pTextBox($x, $y, $w, 0, $texto, $aFont, 'T', 'L', false);
2743
-        $texto = $this->creditos .  "  Powered by NFePHP";
2737
+        $texto = $this->creditos . "  Powered by NFePHP";
2744 2738
         $this->pTextBox($x, $y, $w, 0, $texto, $aFont, 'T', 'R', false, '');
2745 2739
     }
2746 2740
 
@@ -2793,9 +2787,9 @@  discard block
 block discarded – undo
2793 2787
         } else {
2794 2788
             //linha separadora do canhoto - 238
2795 2789
             //posicao altura
2796
-            $y = $this->wPrint-85;
2790
+            $y = $this->wPrint - 85;
2797 2791
             //altura
2798
-            $w = $this->wPrint-85-24;
2792
+            $w = $this->wPrint - 85 - 24;
2799 2793
         }
2800 2794
         $h = 10;
2801 2795
         //desenha caixa
@@ -2818,21 +2812,21 @@  discard block
 block discarded – undo
2818 2812
             $texto .= "AO LADO";
2819 2813
         }
2820 2814
         $texto .= ". EMISSÃO: ";
2821
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
2815
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
2822 2816
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
2823 2817
         if ($dEmi == '') {
2824
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
2818
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
2825 2819
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
2826 2820
             $aDemi = explode('T', $dEmi);
2827 2821
             $dEmi = $aDemi[0];
2828 2822
         }
2829
-        $texto .= $this->pYmd2dmy($dEmi) ." ";
2823
+        $texto .= $this->pYmd2dmy($dEmi) . " ";
2830 2824
         $texto .= "VALOR TOTAL: R$ ";
2831 2825
         $texto .= number_format($this->ICMSTot->getElementsByTagName("vNF")->item(0)->nodeValue, 2, ",", ".") . " ";
2832 2826
         $texto .= "DESTINATÁRIO: ";
2833 2827
         $texto .= $destinatario;
2834 2828
         if ($this->orientacao == 'P') {
2835
-            $this->pTextBox($x, $y, $w-1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
2829
+            $this->pTextBox($x, $y, $w - 1, $h, $texto, $aFont, 'C', 'L', 0, '', false);
2836 2830
             $x1 = $x + $w;
2837 2831
             $w1 = $this->wPrint - $w;
2838 2832
             $texto = "NF-e";
@@ -2845,12 +2839,12 @@  discard block
 block discarded – undo
2845 2839
             //DATA DE RECEBIMENTO
2846 2840
             $texto = "DATA DE RECEBIMENTO";
2847 2841
             $y += $h;
2848
-            $w2 = round($this->wPrint*0.17, 0); //35;
2842
+            $w2 = round($this->wPrint * 0.17, 0); //35;
2849 2843
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2850 2844
             $this->pTextBox($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
2851 2845
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
2852 2846
             $x += $w2;
2853
-            $w3 = $w-$w2;
2847
+            $w3 = $w - $w2;
2854 2848
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
2855 2849
             $this->pTextBox($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
2856 2850
             $x = $oldX;
@@ -2860,7 +2854,7 @@  discard block
 block discarded – undo
2860 2854
             return $y;
2861 2855
         } else {
2862 2856
             $x--;
2863
-            $x = $this->pTextBox90($x, $y, $w-1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
2857
+            $x = $this->pTextBox90($x, $y, $w - 1, $h, $texto, $aFontSmall, 'C', 'L', 0, '', false);
2864 2858
             //NUMERO DA NOTA FISCAL LOGO NFE
2865 2859
             $w1 = 16;
2866 2860
             $x1 = $oldX;
@@ -2874,18 +2868,18 @@  discard block
 block discarded – undo
2874 2868
             $this->pTextBox($x1, $y, $w1, 18, $texto, $aFont, 'C', 'C', 1, '');
2875 2869
             //DATA DO RECEBIMENTO
2876 2870
             $texto = "DATA DO RECEBIMENTO";
2877
-            $y = $this->wPrint-85;
2871
+            $y = $this->wPrint - 85;
2878 2872
             $x = 12;
2879
-            $w2 = round($this->wPrint*0.17, 0); //35;
2873
+            $w2 = round($this->wPrint * 0.17, 0); //35;
2880 2874
             $aFont = array('font'=>$this->fontePadrao, 'size'=>6, 'style'=>'');
2881 2875
             $this->pTextBox90($x, $y, $w2, 8, $texto, $aFont, 'T', 'L', 1, '');
2882 2876
             //IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR
2883 2877
             $y -= $w2;
2884
-            $w3 = $w-$w2;
2878
+            $w3 = $w - $w2;
2885 2879
             $texto = "IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR";
2886 2880
             $aFont = array('font'=>$this->fontePadrao, 'size'=>5.7, 'style'=>'');
2887 2881
             $x = $this->pTextBox90($x, $y, $w3, 8, $texto, $aFont, 'T', 'L', 1, '');
2888
-            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint-20, 67);
2882
+            $this->pdf->DashedVLine(23, $oldY, 0.1, $this->wPrint - 20, 67);
2889 2883
             return $x;
2890 2884
         }
2891 2885
     }
@@ -2902,13 +2896,13 @@  discard block
 block discarded – undo
2902 2896
     {
2903 2897
         $saida = "";
2904 2898
         if (isset($this->compra)) {
2905
-            if (! empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
2899
+            if (!empty($this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue)) {
2906 2900
                 $saida .= " Nota de Empenho: " . $this->compra->getElementsByTagName("xNEmp")->item(0)->nodeValue;
2907 2901
             }
2908
-            if (! empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
2902
+            if (!empty($this->compra->getElementsByTagName("xPed")->item(0)->nodeValue)) {
2909 2903
                 $saida .= " Pedido: " . $this->compra->getElementsByTagName("xPed")->item(0)->nodeValue;
2910 2904
             }
2911
-            if (! empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
2905
+            if (!empty($this->compra->getElementsByTagName("xCont")->item(0)->nodeValue)) {
2912 2906
                 $saida .= " Contrato: " . $this->compra->getElementsByTagName("xCont")->item(0)->nodeValue;
2913 2907
             }
2914 2908
         }
@@ -2934,21 +2928,21 @@  discard block
 block discarded – undo
2934 2928
         if ($vICMS > 0) {
2935 2929
             $vICMS = 1;
2936 2930
         }
2937
-        $icmss  = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
2931
+        $icmss = $this->ICMSTot->getElementsByTagName("vBC")->item(0)->nodeValue;
2938 2932
         if ($icmss > 0) {
2939 2933
             $icmss = 1;
2940 2934
         }
2941
-        $dEmi = ! empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
2935
+        $dEmi = !empty($this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue) ?
2942 2936
                 $this->ide->getElementsByTagName("dEmi")->item(0)->nodeValue : '';
2943 2937
         if ($dEmi == '') {
2944
-            $dEmi = ! empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
2938
+            $dEmi = !empty($this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue) ?
2945 2939
                     $this->ide->getElementsByTagName("dhEmi")->item(0)->nodeValue : '';
2946 2940
             $aDemi = explode('T', $dEmi);
2947 2941
             $dEmi = $aDemi[0];
2948 2942
         }
2949 2943
         $dd  = $dEmi;
2950 2944
         $rpos = strrpos($dd, '-');
2951
-        $dd  = substr($dd, $rpos +1);
2945
+        $dd  = substr($dd, $rpos + 1);
2952 2946
         $chave = sprintf($forma, $cUF, $this->tpEmis, $CNPJ, $vNF, $vICMS, $icmss, $dd);
2953 2947
         $chave = $chave . $this->pModulo11($chave);
2954 2948
         return $chave;
@@ -2969,7 +2963,7 @@  discard block
 block discarded – undo
2969 2963
         $formaNfRef = "\r\nNF  Ref.: série:%d numero:%d emit:%s em %s modelo: %d";
2970 2964
         $formaECFRef = "\r\nECF Ref.: modelo: %s ECF:%d COO:%d";
2971 2965
         $formaNfpRef = "\r\nNFP Ref.: série:%d número:%d emit:%s em %s modelo: %d IE:%s";
2972
-        $saida='';
2966
+        $saida = '';
2973 2967
         $nfRefs = $this->ide->getElementsByTagName('NFref');
2974 2968
         if (0 === $nfRefs->length) {
2975 2969
             return $saida;
@@ -2982,7 +2976,7 @@  discard block
 block discarded – undo
2982 2976
             foreach ($refNFe as $chave_acessoRef) {
2983 2977
                 $chave_acesso = $chave_acessoRef->nodeValue;
2984 2978
                 $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave);
2985
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
2979
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
2986 2980
                 $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##");
2987 2981
                 $serie  = substr($chave_acesso, 22, 3);
2988 2982
                 $numero = substr($chave_acesso, 25, 9);
@@ -3003,7 +2997,7 @@  discard block
 block discarded – undo
3003 2997
             foreach ($refCTe as $chave_acessoRef) {
3004 2998
                 $chave_acesso = $chave_acessoRef->nodeValue;
3005 2999
                 $chave_acessoF = $this->pFormat($chave_acesso, $this->formatoChave);
3006
-                $data = substr($chave_acesso, 4, 2)."/20".substr($chave_acesso, 2, 2);
3000
+                $data = substr($chave_acesso, 4, 2) . "/20" . substr($chave_acesso, 2, 2);
3007 3001
                 $cnpj = $this->pFormat(substr($chave_acesso, 6, 14), "##.###.###/####-##");
3008 3002
                 $serie  = substr($chave_acesso, 22, 3);
3009 3003
                 $numero = substr($chave_acesso, 25, 9);
@@ -3019,10 +3013,9 @@  discard block
 block discarded – undo
3019 3013
             $refNFP = $nfRef->getElementsByTagName('refNFP');
3020 3014
             foreach ($refNFP as $umaRefNFe) {
3021 3015
                 $data = $umaRefNFe->getElementsByTagName('AAMM')->item(0)->nodeValue;
3022
-                $cnpj = ! empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3023
-                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue :
3024
-                    '';
3025
-                $cpf = ! empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3016
+                $cnpj = !empty($umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue) ?
3017
+                    $umaRefNFe->getElementsByTagName('CNPJ')->item(0)->nodeValue : '';
3018
+                $cpf = !empty($umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue) ?
3026 3019
                         $umaRefNFe->getElementsByTagName('CPF')->item(0)->nodeValue : '';
3027 3020
                 $mod = $umaRefNFe->getElementsByTagName('mod')->item(0)->nodeValue;
3028 3021
                 $serie = $umaRefNFe->getElementsByTagName('serie')->item(0)->nodeValue;
Please login to merge, or discard this patch.
src/CTe/Dacce.php 3 patches
Doc Comments   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
      * @param string $sDestino    Destino do PDF I-browser D-download S-string F-salva
72 72
      * @param array  $aEnd        array com o endereço do emitente
73 73
      * @param string $sDirPDF     Caminho para o diretorio de armazenamento dos arquivos PDF
74
-     * @param string $fonteDANFE  Nome da fonte alternativa do DAnfe
75
-     * @param number $mododebug   0-Não 1-Sim e 2-nada (2 default)
74
+     * @param string $fontePDF  Nome da fonte alternativa do DAnfe
75
+     * @param integer $mododebug   0-Não 1-Sim e 2-nada (2 default)
76 76
      */
77 77
     public function __construct(
78 78
         $docXML = '',
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
     /**
230 230
      * pHeader
231 231
      *
232
-     * @param  number $x
233
-     * @param  number $y
234
-     * @param  number $pag
232
+     * @param  integer $x
233
+     * @param  integer $y
234
+     * @param  integer $pag
235 235
      * @return number
236 236
      */
237 237
     private function pHeader($x, $y, $pag)
@@ -419,8 +419,8 @@  discard block
 block discarded – undo
419 419
     /**
420 420
      * pBody
421 421
      *
422
-     * @param number $x
423
-     * @param number $y
422
+     * @param integer $x
423
+     * @param double $y
424 424
      */
425 425
     private function pBody($x, $y)
426 426
     {
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
     /**
473 473
      * pFooter
474 474
      *
475
-     * @param number $x
475
+     * @param integer $x
476 476
      * @param number $y
477 477
      */
478 478
     protected function pFooter($x, $y)
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -441,7 +441,7 @@
 block discarded – undo
441 441
         $this->pTextBox($x, $y, $maxW, $maxH);
442 442
         
443 443
         
444
-         $aFont = array(
444
+            $aFont = array(
445 445
             'font' => $this->fontePadrao,
446 446
             'size' => 9,
447 447
             'style' => 'B'
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -302,12 +302,12 @@  discard block
 block discarded – undo
302 302
             $tw = $w;
303 303
         }
304 304
         // Nome emitente
305
-        $aFont = ['font' => $this->fontePadrao,'size' => 12,'style' => 'B'];
305
+        $aFont = ['font' => $this->fontePadrao, 'size' => 12, 'style' => 'B'];
306 306
         $texto = $this->aEnd['razao'];
307 307
         $this->pTextBox($x1, $y1, $tw, 8, $texto, $aFont, 'T', 'C', 0, '');
308 308
         // endereço
309 309
         $y1 = $y1 + 6;
310
-        $aFont = ['font' => $this->fontePadrao,'size' => 8,'style' => ''];
310
+        $aFont = ['font' => $this->fontePadrao, 'size' => 8, 'style' => ''];
311 311
         $lgr = $this->aEnd['logradouro'];
312 312
         $nro = $this->aEnd['numero'];
313 313
         $cpl = $this->aEnd['complemento'];
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
         $x += $w;
338 338
         $this->pTextBox($x, $y, $w2, $h);
339 339
         $y1 = $y + $h;
340
-        $aFont = ['font' => $this->fontePadrao,'size' => 16,'style' => 'B'];
340
+        $aFont = ['font' => $this->fontePadrao, 'size' => 16, 'style' => 'B'];
341 341
         $this->pTextBox($x, $y + 2, $w2, 8, 'Representação Gráfica de CC-e', $aFont, 'T', 'C', 0, '');
342 342
         $aFont = array(
343 343
             'font' => $this->fontePadrao,
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
         );
347 347
         $this->pTextBox($x, $y + 7, $w2, 8, '(Carta de Correção Eletrônica)', $aFont, 'T', 'C', 0, '');
348 348
         $texto = 'ID do Evento: ' . $this->id;
349
-        $aFont = ['font' => $this->fontePadrao,'size' => 10,'style' => ''];
349
+        $aFont = ['font' => $this->fontePadrao, 'size' => 10, 'style' => ''];
350 350
         $this->pTextBox($x, $y + 15, $w2, 8, $texto, $aFont, 'T', 'L', 0, '');
351 351
         $tsHora = $this->pConvertTime($this->dhEvento);
352 352
         $texto = 'Criado em : ' . date('d/m/Y   H:i:s', $tsHora);
@@ -358,9 +358,9 @@  discard block
 block discarded – undo
358 358
         $x = $oldX;
359 359
         $this->pTextBox($x, $y1, $maxW, 40);
360 360
         $sY = $y1 + 40;
361
-        $texto = 'De acordo com as determinações legais vigentes, vimos por meio desta comunicar-lhe'.
361
+        $texto = 'De acordo com as determinações legais vigentes, vimos por meio desta comunicar-lhe' .
362 362
             ' que o Conhecimento, abaixo referenciada, contêm irregularidades que estão destacadas e' .
363
-            ' suas respectivas correções, solicitamos que sejam aplicadas essas correções ao executar'.
363
+            ' suas respectivas correções, solicitamos que sejam aplicadas essas correções ao executar' .
364 364
             ' seus lançamentos fiscais.';
365 365
         $aFont = array(
366 366
             'font' => $this->fontePadrao,
@@ -446,10 +446,10 @@  discard block
 block discarded – undo
446 446
             'size' => 9,
447 447
             'style' => 'B'
448 448
         );
449
-        $this->pTextBox($x, $y, $maxW = ($maxW/5), 5, "Grupo", $aFont, 'T', 'C', 0, '', false);
449
+        $this->pTextBox($x, $y, $maxW = ($maxW / 5), 5, "Grupo", $aFont, 'T', 'C', 0, '', false);
450 450
         $this->pTextBox($x = $maxW, $y, $maxW, 5, "Campo", $aFont, 'T', 'C', 0, '', false);
451
-        $this->pTextBox($x = ($maxW*2), $y, $maxW, 5, "Número", $aFont, 'T', 'C', 0, '', false);
452
-        $this->pTextBox($x = ($maxW*3), $y, ($this->wPrint-$x), 5, "Valor", $aFont, 'T', 'C', 0, '', false);
451
+        $this->pTextBox($x = ($maxW * 2), $y, $maxW, 5, "Número", $aFont, 'T', 'C', 0, '', false);
452
+        $this->pTextBox($x = ($maxW * 3), $y, ($this->wPrint - $x), 5, "Valor", $aFont, 'T', 'C', 0, '', false);
453 453
         
454 454
         $aFont = array(
455 455
             'font' => $this->fontePadrao,
@@ -457,11 +457,11 @@  discard block
 block discarded – undo
457 457
             'style' => ''
458 458
         );
459 459
         //Correções
460
-        $i=0;
460
+        $i = 0;
461 461
         $numlinhas = 1;
462 462
         while ($i < $this->infCorrecao->length) {
463 463
             $x = 0;
464
-            $y = $numlinhas == 1 ? ($y+5) : ($y+(5*$numlinhas));
464
+            $y = $numlinhas == 1 ? ($y + 5) : ($y + (5 * $numlinhas));
465 465
             $maxW = $this->wPrint;
466 466
             $grupo = $this->infCorrecao->item($i)->getElementsByTagName('grupoAlterado')->item(0)->nodeValue;
467 467
             $campo = $this->infCorrecao->item($i)->getElementsByTagName('campoAlterado')->item(0)->nodeValue;
@@ -469,11 +469,11 @@  discard block
 block discarded – undo
469 469
             $valor = $this->infCorrecao->item($i)->getElementsByTagName('valorAlterado')->item(0)->nodeValue;
470 470
                                     
471 471
             $i++;
472
-            $this->pTextBox($x, $y, $maxW = ($maxW/5), 5, $grupo, $aFont, 'T', 'C', 0, '', false);
472
+            $this->pTextBox($x, $y, $maxW = ($maxW / 5), 5, $grupo, $aFont, 'T', 'C', 0, '', false);
473 473
             $this->pTextBox($x = $maxW, $y, $maxW, 5, $campo, $aFont, 'T', 'C', 0, '', false);
474
-            $this->pTextBox($x = ($maxW*2), $y, $maxW, 5, $numero, $aFont, 'T', 'C', 0, '', false);
475
-            $this->pTextBox($x = ($maxW*3), $y, ($this->wPrint-$x), 5, $valor, $aFont, 'T', 'C', 0, '', false);
476
-            $numlinhas = $this->pGetNumLines($valor, ($this->wPrint-$x), $aFont);
474
+            $this->pTextBox($x = ($maxW * 2), $y, $maxW, 5, $numero, $aFont, 'T', 'C', 0, '', false);
475
+            $this->pTextBox($x = ($maxW * 3), $y, ($this->wPrint - $x), 5, $valor, $aFont, 'T', 'C', 0, '', false);
476
+            $numlinhas = $this->pGetNumLines($valor, ($this->wPrint - $x), $aFont);
477 477
         } //fim da soma das areas de itens usadas
478 478
                         
479 479
         
Please login to merge, or discard this patch.