@@ -58,11 +58,11 @@ |
||
58 | 58 | |
59 | 59 | $texto = "Troco R$"; |
60 | 60 | $this->pdf->textBox($this->margem, $z, $this->wPrint, 3, $texto, $aFont, 'T', 'L', false, '', false); |
61 | - $texto = !empty($this->vTroco) ? number_format((float) $this->vTroco, 2, ',', '.') : '0,00'; |
|
61 | + $texto = !empty($this->vTroco) ? number_format((float) $this->vTroco, 2, ',', '.') : '0,00'; |
|
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 |
@@ -66,6 +66,9 @@ |
||
66 | 66 | return $this->bloco5H + $y; |
67 | 67 | } |
68 | 68 | |
69 | + /** |
|
70 | + * @param integer $type |
|
71 | + */ |
|
69 | 72 | protected function pagType($type) |
70 | 73 | { |
71 | 74 | $lista = [ |
@@ -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; |
@@ -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 = "Protocolo 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 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $y2 += $it->height; |
132 | 132 | } |
133 | 133 | } |
134 | - $this->pdf->dashedHLine($this->margem, $this->bloco3H+$y, $this->wPrint, 0.1, 30); |
|
134 | + $this->pdf->dashedHLine($this->margem, $this->bloco3H + $y, $this->wPrint, 0.1, 30); |
|
135 | 135 | return $this->bloco3H + $y; |
136 | 136 | } |
137 | 137 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | if ($this->paperwidth < 70) { |
145 | 145 | $fsize = 5; |
146 | 146 | } |
147 | - $hfont = (imagefontheight($fsize)/72)*15; |
|
147 | + $hfont = (imagefontheight($fsize) / 72) * 15; |
|
148 | 148 | $aFont = ['font'=> $this->fontePadrao, 'size' => $fsize, 'style' => '']; |
149 | 149 | $htot = 0; |
150 | 150 | if ($this->det->length == 0) { |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $p = $xProd; |
170 | 170 | $n = $tempPDF->wordWrap($p, $descriptionWidth); |
171 | 171 | } |
172 | - $h = ($hfont * $n)+0.5; |
|
172 | + $h = ($hfont * $n) + 0.5; |
|
173 | 173 | $this->itens[] = [ |
174 | 174 | "codigo" => $cProd, |
175 | 175 | "desc" => $xProd, |
@@ -182,6 +182,6 @@ discard block |
||
182 | 182 | $htot += $h; |
183 | 183 | } |
184 | 184 | } |
185 | - return $htot+2; |
|
185 | + return $htot + 2; |
|
186 | 186 | } |
187 | 187 | } |
@@ -193,6 +193,9 @@ |
||
193 | 193 | $this->orientacao = $orientacao; |
194 | 194 | } |
195 | 195 | |
196 | + /** |
|
197 | + * @param string $xml |
|
198 | + */ |
|
196 | 199 | private function loadDoc($xml) |
197 | 200 | { |
198 | 201 | $this->xml = $xml; |
@@ -200,10 +200,10 @@ discard block |
||
200 | 200 | $stdClass = simplexml_load_string($xml); |
201 | 201 | $json = json_encode($stdClass, JSON_OBJECT_AS_ARRAY); |
202 | 202 | $this->nfeArray = json_decode($json, JSON_OBJECT_AS_ARRAY); |
203 | - if (!isset($this->nfeArray['NFe']['infNFe']['@attributes']['Id'])){ |
|
203 | + if (!isset($this->nfeArray['NFe']['infNFe']['@attributes']['Id'])) { |
|
204 | 204 | throw new Exception('XML não parece ser uma NF-e!'); |
205 | 205 | } |
206 | - if ($this->nfeArray['protNFe']['infProt']['cStat'] != '100'){ |
|
206 | + if ($this->nfeArray['protNFe']['infProt']['cStat'] != '100') { |
|
207 | 207 | throw new Exception('NF-e não autorizada!'); |
208 | 208 | } |
209 | 209 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | $this->pdf->setFont('Arial', 'B', 10); |
254 | 254 | $this->pdf->cell($c1, 5, "TIPO NF", 1, 0, 'C', 1); |
255 | 255 | $this->pdf->setFont('Arial', '', 10); |
256 | - $this->pdf->cell($c1, 5, "{$this->nfeArray['NFe']['infNFe']['ide']['tpNF']} - ".($this->nfeArray['NFe']['infNFe']['ide']['tpNF']==1 ? 'Saida':'Entrada'), 1, 0, 'C', 1); |
|
256 | + $this->pdf->cell($c1, 5, "{$this->nfeArray['NFe']['infNFe']['ide']['tpNF']} - " . ($this->nfeArray['NFe']['infNFe']['ide']['tpNF'] == 1 ? 'Saida' : 'Entrada'), 1, 0, 'C', 1); |
|
257 | 257 | $this->pdf->setFont('Arial', 'B', 10); |
258 | 258 | $this->pdf->cell($c1, 5, "DATA EMISSAO", 1, 0, 'C', 1); |
259 | 259 | $this->pdf->setFont('Arial', '', 10); |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | $this->pdf->ln(); |
287 | 287 | $y = $this->pdf->getY(); |
288 | 288 | $this->pdf->setFillColor(0, 0, 0); |
289 | - $this->pdf->code128(($c1/2), $y, $chave, ($c1 * 3), 15); |
|
289 | + $this->pdf->code128(($c1 / 2), $y, $chave, ($c1 * 3), 15); |
|
290 | 290 | $this->pdf->setFillColor(255, 255, 255); |
291 | 291 | $this->pdf->ln(); |
292 | 292 | $this->pdf->ln(); |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | $this->pdf->cell(($c1 * 4), 5, "{$this->nfeArray['NFe']['infNFe']['emit']['xNome']}", 1, 1, 'C', 1); |
303 | 303 | |
304 | 304 | // LINHA 8 |
305 | - $cpfCnpj = (isset($this->nfeArray['NFe']['infNFe']['emit']['CNPJ']) ? $this->nfeArray['NFe']['infNFe']['emit']['CNPJ']:$this->nfeArray['NFe']['infNFe']['emit']['CPF']); |
|
305 | + $cpfCnpj = (isset($this->nfeArray['NFe']['infNFe']['emit']['CNPJ']) ? $this->nfeArray['NFe']['infNFe']['emit']['CNPJ'] : $this->nfeArray['NFe']['infNFe']['emit']['CPF']); |
|
306 | 306 | $this->pdf->cell(($c1 * 2), 5, "CNPJ/CPF {$cpfCnpj}", 1, 0, 'C', 1); |
307 | 307 | $this->pdf->cell(($c1 * 2), 5, @"RG/IE {$this->nfeArray['NFe']['infNFe']['emit']['IE']}", 1, 1, 'C', 1); |
308 | 308 | |
@@ -315,27 +315,27 @@ discard block |
||
315 | 315 | $this->pdf->cell(($c1 * 4), 5, "{$this->nfeArray['NFe']['infNFe']['dest']['xNome']}", 1, 1, 'C', 1); |
316 | 316 | |
317 | 317 | // LINHA 11 |
318 | - $cpfCnpj = (isset($this->nfeArray['NFe']['infNFe']['dest']['CNPJ']) ? $this->nfeArray['NFe']['infNFe']['dest']['CNPJ']:$this->nfeArray['NFe']['infNFe']['dest']['CPF']); |
|
318 | + $cpfCnpj = (isset($this->nfeArray['NFe']['infNFe']['dest']['CNPJ']) ? $this->nfeArray['NFe']['infNFe']['dest']['CNPJ'] : $this->nfeArray['NFe']['infNFe']['dest']['CPF']); |
|
319 | 319 | $this->pdf->cell(($c1 * 2), 5, "CNPJ/CPF {$cpfCnpj}", 1, 0, 'C', 1); |
320 | 320 | $this->pdf->cell(($c1 * 2), 5, @"RG/IE {$this->nfeArray['NFe']['infNFe']['dest']['IE']}", 1, 1, 'C', 1); |
321 | 321 | |
322 | - if (isset($this->nfeArray['NFe']['infNFe']['entrega'])){ |
|
322 | + if (isset($this->nfeArray['NFe']['infNFe']['entrega'])) { |
|
323 | 323 | $enderecoLinha1 = "{$this->nfeArray['NFe']['infNFe']['entrega']['xLgr']}"; |
324 | - if (!empty($this->nfeArray['NFe']['infNFe']['entrega']['nro'])){ |
|
324 | + if (!empty($this->nfeArray['NFe']['infNFe']['entrega']['nro'])) { |
|
325 | 325 | $enderecoLinha1 .= ", {$this->nfeArray['NFe']['infNFe']['entrega']['nro']}"; |
326 | 326 | } |
327 | 327 | $enderecoLinha2 = ''; |
328 | - if (!empty($this->nfeArray['NFe']['infNFe']['entrega']['xCpl'])){ |
|
328 | + if (!empty($this->nfeArray['NFe']['infNFe']['entrega']['xCpl'])) { |
|
329 | 329 | $enderecoLinha2 .= "{$this->nfeArray['NFe']['infNFe']['entrega']['xCpl']} - "; |
330 | 330 | } |
331 | 331 | $enderecoLinha2 .= "{$this->nfeArray['NFe']['infNFe']['entrega']['xMun']} / {$this->nfeArray['NFe']['infNFe']['entrega']['UF']} - CEP {$this->nfeArray['NFe']['infNFe']['entrega']['CEP']}"; |
332 | 332 | } else { |
333 | 333 | $enderecoLinha1 = "{$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['xLgr']}"; |
334 | - if (!empty($this->nfeArray['NFe']['infNFe']['dest']['enderDest']['nro'])){ |
|
334 | + if (!empty($this->nfeArray['NFe']['infNFe']['dest']['enderDest']['nro'])) { |
|
335 | 335 | $enderecoLinha1 .= ", {$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['nro']}"; |
336 | 336 | } |
337 | 337 | $enderecoLinha2 = ''; |
338 | - if (!empty($this->nfeArray['NFe']['infNFe']['dest']['enderDest']['xCpl'])){ |
|
338 | + if (!empty($this->nfeArray['NFe']['infNFe']['dest']['enderDest']['xCpl'])) { |
|
339 | 339 | $enderecoLinha2 .= "{$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['xCpl']} - "; |
340 | 340 | } |
341 | 341 | $enderecoLinha2 .= "{$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['xMun']} / {$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['UF']} - CEP {$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['CEP']}"; |