@@ -279,7 +279,6 @@ |
||
| 279 | 279 | |
| 280 | 280 | /** |
| 281 | 281 | * Carrega os dados do xml na classe |
| 282 | - * @param string $xml |
|
| 283 | 282 | * |
| 284 | 283 | * @throws InvalidArgumentException |
| 285 | 284 | */ |
@@ -13,13 +13,11 @@ |
||
| 13 | 13 | * @link http://github.com/nfephp-org/sped-da for the canonical source repository |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -use DateTime; |
|
| 17 | 16 | use Exception; |
| 18 | 17 | use InvalidArgumentException; |
| 19 | 18 | use NFePHP\DA\Legacy\Dom; |
| 20 | 19 | use NFePHP\DA\Legacy\Pdf; |
| 21 | 20 | use NFePHP\DA\Common\DaCommon; |
| 22 | -use Com\Tecnick\Barcode\Barcode; |
|
| 23 | 21 | |
| 24 | 22 | class Danfce extends DaCommon |
| 25 | 23 | { |
@@ -27,8 +27,8 @@ discard block |
||
| 27 | 27 | protected $paperwidth = 80; |
| 28 | 28 | protected $descPercent = 0.38; |
| 29 | 29 | protected $xml; // string XML NFe |
| 30 | - protected $logomarca=''; // path para logomarca em jpg |
|
| 31 | - protected $formatoChave="#### #### #### #### #### #### #### #### #### #### ####"; |
|
| 30 | + protected $logomarca = ''; // path para logomarca em jpg |
|
| 31 | + protected $formatoChave = "#### #### #### #### #### #### #### #### #### #### ####"; |
|
| 32 | 32 | protected $nfeProc; |
| 33 | 33 | protected $nfe; |
| 34 | 34 | protected $infNFe; |
@@ -191,10 +191,10 @@ discard block |
||
| 191 | 191 | //total inicial de paginas |
| 192 | 192 | $totPag = 1; |
| 193 | 193 | //largura imprimivel em mm: largura da folha menos as margens esq/direita |
| 194 | - $this->wPrint = $maxW-($margEsq*2); |
|
| 194 | + $this->wPrint = $maxW - ($margEsq * 2); |
|
| 195 | 195 | //comprimento (altura) imprimivel em mm: altura da folha menos as margens |
| 196 | 196 | //superior e inferior |
| 197 | - $this->hPrint = $maxH-$margSup-$margInf; |
|
| 197 | + $this->hPrint = $maxH - $margSup - $margInf; |
|
| 198 | 198 | // estabelece contagem de paginas |
| 199 | 199 | $this->pdf->aliasNbPages(); |
| 200 | 200 | $this->pdf->setMargins($margEsq, $margSup); // fixa as margens |
@@ -224,9 +224,9 @@ discard block |
||
| 224 | 224 | $aFont = ['font' => $this->fontePadrao, 'size' => 20, 'style' => 'B']; |
| 225 | 225 | $this->pdf->textBox( |
| 226 | 226 | $this->margem, |
| 227 | - ($maxH/3), |
|
| 227 | + ($maxH / 3), |
|
| 228 | 228 | $this->wPrint, |
| 229 | - $maxH/2, |
|
| 229 | + $maxH / 2, |
|
| 230 | 230 | $texto, |
| 231 | 231 | $aFont, |
| 232 | 232 | 'T', |
@@ -242,9 +242,9 @@ discard block |
||
| 242 | 242 | $aFont = ['font' => $this->fontePadrao, 'size' => 20, 'style' => 'B']; |
| 243 | 243 | $this->pdf->textBox( |
| 244 | 244 | $this->margem, |
| 245 | - ($maxH/3), |
|
| 245 | + ($maxH / 3), |
|
| 246 | 246 | $this->wPrint, |
| 247 | - $maxH/2, |
|
| 247 | + $maxH / 2, |
|
| 248 | 248 | $texto, |
| 249 | 249 | $aFont, |
| 250 | 250 | 'T', |
@@ -7,6 +7,9 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | trait TraitBlocoIII |
| 9 | 9 | { |
| 10 | + /** |
|
| 11 | + * @param integer $y |
|
| 12 | + */ |
|
| 10 | 13 | protected function blocoIII($y) |
| 11 | 14 | { |
| 12 | 15 | if ($this->flagResume) { |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $y2 += $it->height; |
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | - $this->pdf->dashedHLine($this->margem, $this->bloco3H+$y, $this->wPrint, 0.1, 30); |
|
| 137 | + $this->pdf->dashedHLine($this->margem, $this->bloco3H + $y, $this->wPrint, 0.1, 30); |
|
| 138 | 138 | return $this->bloco3H + $y; |
| 139 | 139 | } |
| 140 | 140 | |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | if ($this->paperwidth < 70) { |
| 148 | 148 | $fsize = 5; |
| 149 | 149 | } |
| 150 | - $hfont = (imagefontheight($fsize)/72)*15; |
|
| 150 | + $hfont = (imagefontheight($fsize) / 72) * 15; |
|
| 151 | 151 | $aFont = ['font'=> $this->fontePadrao, 'size' => $fsize, 'style' => '']; |
| 152 | 152 | $htot = 0; |
| 153 | 153 | if ($this->det->length == 0) { |
@@ -185,6 +185,6 @@ discard block |
||
| 185 | 185 | $htot += $h; |
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | - return $htot+2; |
|
| 188 | + return $htot + 2; |
|
| 189 | 189 | } |
| 190 | 190 | } |
@@ -7,6 +7,9 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | trait TraitBlocoIX |
| 9 | 9 | { |
| 10 | + /** |
|
| 11 | + * @param integer $y |
|
| 12 | + */ |
|
| 10 | 13 | protected function blocoIX($y) |
| 11 | 14 | { |
| 12 | 15 | $this->bloco9H = 4; |
@@ -7,6 +7,9 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | trait TraitBlocoV |
| 9 | 9 | { |
| 10 | + /** |
|
| 11 | + * @param integer $y |
|
| 12 | + */ |
|
| 10 | 13 | protected function blocoV($y) |
| 11 | 14 | { |
| 12 | 15 | $this->bloco5H = $this->calculateHeightPag(); |
@@ -66,6 +69,9 @@ discard block |
||
| 66 | 69 | return $this->bloco5H + $y; |
| 67 | 70 | } |
| 68 | 71 | |
| 72 | + /** |
|
| 73 | + * @param integer $type |
|
| 74 | + */ |
|
| 69 | 75 | protected function pagType($type) |
| 70 | 76 | { |
| 71 | 77 | $lista = [ |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | $y1 = $this->pdf->textBox($this->margem, $z, $this->wPrint, 3, $texto, $aFont, 'T', 'R', false, '', false); |
| 63 | 63 | |
| 64 | 64 | |
| 65 | - $this->pdf->dashedHLine($this->margem, $this->bloco5H+$y, $this->wPrint, 0.1, 30); |
|
| 65 | + $this->pdf->dashedHLine($this->margem, $this->bloco5H + $y, $this->wPrint, 0.1, 30); |
|
| 66 | 66 | return $this->bloco5H + $y; |
| 67 | 67 | } |
| 68 | 68 | |
@@ -7,6 +7,9 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | trait TraitBlocoVI |
| 9 | 9 | { |
| 10 | + /** |
|
| 11 | + * @param double $y |
|
| 12 | + */ |
|
| 10 | 13 | protected function blocoVI($y) |
| 11 | 14 | { |
| 12 | 15 | $this->bloco6H = 10; |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | false |
| 31 | 31 | ); |
| 32 | 32 | |
| 33 | - $texto = $this->urlChave; |
|
| 33 | + $texto = $this->urlChave; |
|
| 34 | 34 | $aFont = ['font'=> $this->fontePadrao, 'size' => 7, 'style' => '']; |
| 35 | 35 | $y2 = $this->pdf->textBox( |
| 36 | 36 | $this->margem, |
| 37 | - $y+$y1, |
|
| 37 | + $y + $y1, |
|
| 38 | 38 | $this->wPrint, |
| 39 | 39 | 2, |
| 40 | 40 | $texto, |
@@ -46,12 +46,12 @@ discard block |
||
| 46 | 46 | false |
| 47 | 47 | ); |
| 48 | 48 | |
| 49 | - $chave = str_replace('NFe', '', $this->infNFe->getAttribute("Id")); |
|
| 49 | + $chave = str_replace('NFe', '', $this->infNFe->getAttribute("Id")); |
|
| 50 | 50 | $texto = $this->formatField($chave, $this->formatoChave); |
| 51 | 51 | $aFont = ['font'=> $this->fontePadrao, 'size' => 7, 'style' => '']; |
| 52 | 52 | $y3 = $this->pdf->textBox( |
| 53 | 53 | $this->margem, |
| 54 | - $y+$y1+$y2+1, |
|
| 54 | + $y + $y1 + $y2 + 1, |
|
| 55 | 55 | $this->wPrint, |
| 56 | 56 | 2, |
| 57 | 57 | $texto, |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | '', |
| 63 | 63 | true |
| 64 | 64 | ); |
| 65 | - $this->pdf->dashedHLine($this->margem, $this->bloco6H+$y, $this->wPrint, 0.1, 30); |
|
| 65 | + $this->pdf->dashedHLine($this->margem, $this->bloco6H + $y, $this->wPrint, 0.1, 30); |
|
| 66 | 66 | return $this->bloco6H + $y; |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -6,6 +6,9 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | trait TraitBlocoVII |
| 8 | 8 | { |
| 9 | + /** |
|
| 10 | + * @param integer $y |
|
| 11 | + */ |
|
| 9 | 12 | protected function blocoVII($y) |
| 10 | 13 | { |
| 11 | 14 | $this->bloco7H = 20; |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | $subSize = 1.5; |
| 44 | 44 | } |
| 45 | 45 | if ($this->tpEmis == 9) { |
| 46 | - $aFont = ['font'=> $this->fontePadrao, 'size' => (7-$subSize), 'style' => '']; |
|
| 47 | - $y += 2*$yPlus; |
|
| 46 | + $aFont = ['font'=> $this->fontePadrao, 'size' => (7 - $subSize), 'style' => '']; |
|
| 47 | + $y += 2 * $yPlus; |
|
| 48 | 48 | $y1 = $this->pdf->textBox( |
| 49 | 49 | $this->margem, |
| 50 | 50 | $y, |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | false |
| 60 | 60 | ); |
| 61 | 61 | |
| 62 | - $y1 += 2*$yPlus; |
|
| 62 | + $y1 += 2 * $yPlus; |
|
| 63 | 63 | $num = str_pad($this->getTagValue($this->ide, "nNF"), 9, '0', STR_PAD_LEFT); |
| 64 | 64 | $serie = str_pad($this->getTagValue($this->ide, "serie"), 3, '0', STR_PAD_LEFT); |
| 65 | 65 | $data = (new \DateTime($this->getTagValue($this->ide, "dhEmi")))->format('d/m/Y H:i:s'); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $aFont = ['font'=> $this->fontePadrao, 'size' => 8, 'style' => 'B']; |
| 68 | 68 | $y2 = $this->pdf->textBox( |
| 69 | 69 | $this->margem, |
| 70 | - $y+$y1, |
|
| 70 | + $y + $y1, |
|
| 71 | 71 | $this->wPrint, |
| 72 | 72 | 4, |
| 73 | 73 | $texto, |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $texto = $this->via; |
| 83 | 83 | $y3 = $this->pdf->textBox( |
| 84 | 84 | $this->margem, |
| 85 | - $y+$y1+$y2, |
|
| 85 | + $y + $y1 + $y2, |
|
| 86 | 86 | $this->wPrint, |
| 87 | 87 | 4, |
| 88 | 88 | $texto, |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $aFont = ['font'=> $this->fontePadrao, 'size' => 10, 'style' => 'B']; |
| 100 | 100 | $y4 = $this->pdf->textBox( |
| 101 | 101 | $this->margem, |
| 102 | - $y+$y1+$y2+$y3, |
|
| 102 | + $y + $y1 + $y2 + $y3, |
|
| 103 | 103 | $this->wPrint, |
| 104 | 104 | 4, |
| 105 | 105 | $texto, |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $aFont = ['font'=> $this->fontePadrao, 'size' => 8, 'style' => 'I']; |
| 116 | 116 | $y5 = $this->pdf->textBox( |
| 117 | 117 | $this->margem, |
| 118 | - $y+$y1+$y2+$y3+$y4, |
|
| 118 | + $y + $y1 + $y2 + $y3 + $y4, |
|
| 119 | 119 | $this->wPrint, |
| 120 | 120 | 3, |
| 121 | 121 | $texto, |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $aFont = ['font'=> $this->fontePadrao, 'size' => 7, 'style' => '']; |
| 131 | 131 | $y1 = $this->pdf->textBox( |
| 132 | 132 | $this->margem, |
| 133 | - $y+1, |
|
| 133 | + $y + 1, |
|
| 134 | 134 | $this->wPrint, |
| 135 | 135 | $this->bloco7H, |
| 136 | 136 | $texto, |
@@ -146,10 +146,10 @@ discard block |
||
| 146 | 146 | $serie = str_pad($this->getTagValue($this->ide, "serie"), 3, '0', STR_PAD_LEFT); |
| 147 | 147 | $data = (new \DateTime($this->getTagValue($this->ide, "dhEmi")))->format('d/m/Y H:i:s'); |
| 148 | 148 | $texto = "NFCe n. {$num} Série {$serie} {$data}"; |
| 149 | - $aFont = ['font'=> $this->fontePadrao, 'size' => (8-$subSize), 'style' => 'B']; |
|
| 149 | + $aFont = ['font'=> $this->fontePadrao, 'size' => (8 - $subSize), 'style' => 'B']; |
|
| 150 | 150 | $y2 = $this->pdf->textBox( |
| 151 | 151 | $this->margem, |
| 152 | - $y+1+$y1, |
|
| 152 | + $y + 1 + $y1, |
|
| 153 | 153 | $this->wPrint, |
| 154 | 154 | 4, |
| 155 | 155 | $texto, |
@@ -169,10 +169,10 @@ discard block |
||
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | $texto = "Protodolo de Autorização: {$protocolo}"; |
| 172 | - $aFont = ['font'=> $this->fontePadrao, 'size' => (8-$subSize), 'style' => '']; |
|
| 172 | + $aFont = ['font'=> $this->fontePadrao, 'size' => (8 - $subSize), 'style' => '']; |
|
| 173 | 173 | $y3 = $this->pdf->textBox( |
| 174 | 174 | $this->margem, |
| 175 | - $y+1+$y1+$y2, |
|
| 175 | + $y + 1 + $y1 + $y2, |
|
| 176 | 176 | $this->wPrint, |
| 177 | 177 | 4, |
| 178 | 178 | $texto, |
@@ -185,10 +185,10 @@ discard block |
||
| 185 | 185 | ); |
| 186 | 186 | |
| 187 | 187 | $texto = "Data de Autorização: {$data}"; |
| 188 | - $aFont = ['font'=> $this->fontePadrao, 'size' => (8-$subSize), 'style' => '']; |
|
| 188 | + $aFont = ['font'=> $this->fontePadrao, 'size' => (8 - $subSize), 'style' => '']; |
|
| 189 | 189 | $y4 = $this->pdf->textBox( |
| 190 | 190 | $this->margem, |
| 191 | - $y+1+$y1+$y2+$y3, |
|
| 191 | + $y + 1 + $y1 + $y2 + $y3, |
|
| 192 | 192 | $this->wPrint, |
| 193 | 193 | 4, |
| 194 | 194 | $texto, |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | true |
| 201 | 201 | ); |
| 202 | 202 | } |
| 203 | - $this->pdf->dashedHLine($this->margem, $this->bloco7H+$y, $this->wPrint, 0.1, 30); |
|
| 203 | + $this->pdf->dashedHLine($this->margem, $this->bloco7H + $y, $this->wPrint, 0.1, 30); |
|
| 204 | 204 | return $this->bloco7H + $y; |
| 205 | 205 | } |
| 206 | 206 | } |
@@ -8,6 +8,9 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | trait TraitBlocoVIII |
| 10 | 10 | { |
| 11 | + /** |
|
| 12 | + * @param integer $y |
|
| 13 | + */ |
|
| 11 | 14 | protected function blocoVIII($y) |
| 12 | 15 | { |
| 13 | 16 | $this->bloco8H = 50; |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | 21 | $maxW = $this->wPrint; |
| 22 | - $w = ($maxW*1)+4; |
|
| 22 | + $w = ($maxW * 1) + 4; |
|
| 23 | 23 | $barcode = new Barcode(); |
| 24 | 24 | $bobj = $barcode->getBarcodeObj( |
| 25 | 25 | 'QRCODE,M', |
@@ -33,10 +33,10 @@ discard block |
||
| 33 | 33 | $wQr = 50; |
| 34 | 34 | $hQr = 50; |
| 35 | 35 | $yQr = ($y); |
| 36 | - $xQr = ($w/2) - ($wQr/2); |
|
| 36 | + $xQr = ($w / 2) - ($wQr / 2); |
|
| 37 | 37 | $pic = 'data://text/plain;base64,' . base64_encode($qrcode); |
| 38 | 38 | $info = getimagesize($pic); |
| 39 | 39 | $this->pdf->image($pic, $xQr, $yQr, $wQr, $hQr, 'PNG'); |
| 40 | - return $this->bloco8H+$y; |
|
| 40 | + return $this->bloco8H + $y; |
|
| 41 | 41 | } |
| 42 | 42 | } |
@@ -7,6 +7,9 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | trait TraitBlocoX |
| 9 | 9 | { |
| 10 | + /** |
|
| 11 | + * @param integer $y |
|
| 12 | + */ |
|
| 10 | 13 | protected function blocoX($y) |
| 11 | 14 | { |
| 12 | 15 | $this->bloco9H = 3; |
@@ -31,13 +31,13 @@ discard block |
||
| 31 | 31 | $xImg = $this->margem; |
| 32 | 32 | $yImg = $this->margem + 1; |
| 33 | 33 | $logoInfo = getimagesize($this->logomarca); |
| 34 | - $logoWmm = ($logoInfo[0]/72)*25.4; |
|
| 35 | - $logoHmm = ($logoInfo[1]/72)*25.4; |
|
| 36 | - $nImgW = $this->wPrint/4; |
|
| 37 | - $nImgH = round($logoHmm * ($nImgW/$logoWmm), 0); |
|
| 34 | + $logoWmm = ($logoInfo[0] / 72) * 25.4; |
|
| 35 | + $logoHmm = ($logoInfo[1] / 72) * 25.4; |
|
| 36 | + $nImgW = $this->wPrint / 4; |
|
| 37 | + $nImgH = round($logoHmm * ($nImgW / $logoWmm), 0); |
|
| 38 | 38 | if ($nImgH > $maxHimg) { |
| 39 | 39 | $nImgH = $maxHimg; |
| 40 | - $nImgW = round($logoWmm * ($nImgH/$logoHmm), 0); |
|
| 40 | + $nImgW = round($logoWmm * ($nImgH / $logoHmm), 0); |
|
| 41 | 41 | } |
| 42 | 42 | $xRs = ($nImgW) + $this->margem; |
| 43 | 43 | $wRs = ($this->wPrint - $nImgW); |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | $aFont = ['font'=>$this->fontePadrao, 'size' => 8, 'style' => '']; |
| 53 | 53 | $texto = "{$emitRazao}"; |
| 54 | 54 | $y += $this->pdf->textBox( |
| 55 | - $xRs+2, |
|
| 55 | + $xRs + 2, |
|
| 56 | 56 | $this->margem, |
| 57 | - $wRs-2, |
|
| 58 | - $this->bloco1H-$this->margem-1, |
|
| 57 | + $wRs - 2, |
|
| 58 | + $this->bloco1H - $this->margem - 1, |
|
| 59 | 59 | $texto, |
| 60 | 60 | $aFont, |
| 61 | 61 | 'T', |
@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | $aFont = ['font'=>$this->fontePadrao, 'size' => $this->pdf->fontSizePt, 'style' => '']; |
| 69 | 69 | } |
| 70 | 70 | $texto = "CNPJ: {$emitCnpj} IE: {$emitIE}"; |
| 71 | - $y += $this->pdf->textBox($xRs+2, $y, $wRs-2, 3, $texto, $aFont, 'T', $alignH, false, '', true); |
|
| 71 | + $y += $this->pdf->textBox($xRs + 2, $y, $wRs - 2, 3, $texto, $aFont, 'T', $alignH, false, '', true); |
|
| 72 | 72 | $texto = $emitLgr . ", " . $emitNro; |
| 73 | - $y += $this->pdf->textBox($xRs+2, $y, $wRs-2, 3, $texto, $aFont, 'T', $alignH, false, '', true); |
|
| 73 | + $y += $this->pdf->textBox($xRs + 2, $y, $wRs - 2, 3, $texto, $aFont, 'T', $alignH, false, '', true); |
|
| 74 | 74 | $texto = $emitBairro; |
| 75 | - $y += $this->pdf->textBox($xRs+2, $y, $wRs-2, 3, $texto, $aFont, 'T', $alignH, false, '', true); |
|
| 75 | + $y += $this->pdf->textBox($xRs + 2, $y, $wRs - 2, 3, $texto, $aFont, 'T', $alignH, false, '', true); |
|
| 76 | 76 | $texto = $emitMun . "-" . $emitUF; |
| 77 | - $y += $this->pdf->textBox($xRs+2, $y, $wRs-2, 3, $texto, $aFont, 'T', $alignH, false, '', true); |
|
| 77 | + $y += $this->pdf->textBox($xRs + 2, $y, $wRs - 2, 3, $texto, $aFont, 'T', $alignH, false, '', true); |
|
| 78 | 78 | $this->pdf->dashedHLine($this->margem, $this->bloco1H, $this->wPrint, 0.1, 30); |
| 79 | 79 | return $this->bloco1H; |
| 80 | 80 | } |