@@ -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; |
@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | $this->pdf->cell($c1, 5, "TIPO NF", 1, 0, 'C', 1); |
| 256 | 256 | $this->pdf->setFont('Arial', '', 10); |
| 257 | 257 | $this->pdf->cell($c1, 5, "{$this->nfeArray['NFe']['infNFe']['ide']['tpNF']} - " . |
| 258 | - ($this->nfeArray['NFe']['infNFe']['ide']['tpNF']==1 ? 'Saida':'Entrada'), |
|
| 259 | - 1, 0, 'C', 1); |
|
| 258 | + ($this->nfeArray['NFe']['infNFe']['ide']['tpNF']==1 ? 'Saida':'Entrada'), |
|
| 259 | + 1, 0, 'C', 1); |
|
| 260 | 260 | $this->pdf->setFont('Arial', 'B', 10); |
| 261 | 261 | $this->pdf->cell($c1, 5, "DATA EMISSAO", 1, 0, 'C', 1); |
| 262 | 262 | $this->pdf->setFont('Arial', '', 10); |
@@ -335,8 +335,8 @@ discard block |
||
| 335 | 335 | $enderecoLinha2 .= "{$this->nfeArray['NFe']['infNFe']['entrega']['xCpl']} - "; |
| 336 | 336 | } |
| 337 | 337 | $enderecoLinha2 .= "{$this->nfeArray['NFe']['infNFe']['entrega']['xMun']}" |
| 338 | - . " / {$this->nfeArray['NFe']['infNFe']['entrega']['UF']}" |
|
| 339 | - . " - CEP {$this->nfeArray['NFe']['infNFe']['entrega']['CEP']}"; |
|
| 338 | + . " / {$this->nfeArray['NFe']['infNFe']['entrega']['UF']}" |
|
| 339 | + . " - CEP {$this->nfeArray['NFe']['infNFe']['entrega']['CEP']}"; |
|
| 340 | 340 | } else { |
| 341 | 341 | $enderecoLinha1 = "{$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['xLgr']}"; |
| 342 | 342 | if (!empty($this->nfeArray['NFe']['infNFe']['dest']['enderDest']['nro'])) |
@@ -349,8 +349,8 @@ discard block |
||
| 349 | 349 | $enderecoLinha2 .= "{$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['xCpl']} - "; |
| 350 | 350 | } |
| 351 | 351 | $enderecoLinha2 .= "{$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['xMun']}" |
| 352 | - . " / {$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['UF']}" |
|
| 353 | - . " - CEP {$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['CEP']}"; |
|
| 352 | + . " / {$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['UF']}" |
|
| 353 | + . " - CEP {$this->nfeArray['NFe']['infNFe']['dest']['enderDest']['CEP']}"; |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | // LINHA 12 |
@@ -201,10 +201,10 @@ discard block |
||
| 201 | 201 | $stdClass = simplexml_load_string($xml); |
| 202 | 202 | $json = json_encode($stdClass, JSON_OBJECT_AS_ARRAY); |
| 203 | 203 | $this->nfeArray = json_decode($json, JSON_OBJECT_AS_ARRAY); |
| 204 | - if (!isset($this->nfeArray['NFe']['infNFe']['@attributes']['Id'])){ |
|
| 204 | + if (!isset($this->nfeArray['NFe']['infNFe']['@attributes']['Id'])) { |
|
| 205 | 205 | throw new Exception('XML não parece ser uma NF-e!'); |
| 206 | 206 | } |
| 207 | - if ($this->nfeArray['protNFe']['infProt']['cStat'] != '100'){ |
|
| 207 | + if ($this->nfeArray['protNFe']['infProt']['cStat'] != '100') { |
|
| 208 | 208 | throw new Exception('NF-e não autorizada!'); |
| 209 | 209 | } |
| 210 | 210 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | $this->pdf->cell($c1, 5, "TIPO NF", 1, 0, 'C', 1); |
| 256 | 256 | $this->pdf->setFont('Arial', '', 10); |
| 257 | 257 | $this->pdf->cell($c1, 5, "{$this->nfeArray['NFe']['infNFe']['ide']['tpNF']} - " . |
| 258 | - ($this->nfeArray['NFe']['infNFe']['ide']['tpNF']==1 ? 'Saida':'Entrada'), |
|
| 258 | + ($this->nfeArray['NFe']['infNFe']['ide']['tpNF'] == 1 ? 'Saida' : 'Entrada'), |
|
| 259 | 259 | 1, 0, 'C', 1); |
| 260 | 260 | $this->pdf->setFont('Arial', 'B', 10); |
| 261 | 261 | $this->pdf->cell($c1, 5, "DATA EMISSAO", 1, 0, 'C', 1); |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | $this->pdf->ln(); |
| 290 | 290 | $y = $this->pdf->getY(); |
| 291 | 291 | $this->pdf->setFillColor(0, 0, 0); |
| 292 | - $this->pdf->code128(($c1/2), $y, $chave, ($c1 * 3), 15); |
|
| 292 | + $this->pdf->code128(($c1 / 2), $y, $chave, ($c1 * 3), 15); |
|
| 293 | 293 | $this->pdf->setFillColor(255, 255, 255); |
| 294 | 294 | $this->pdf->ln(); |
| 295 | 295 | $this->pdf->ln(); |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | $this->pdf->cell(($c1 * 4), 5, "{$this->nfeArray['NFe']['infNFe']['emit']['xNome']}", 1, 1, 'C', 1); |
| 306 | 306 | |
| 307 | 307 | // LINHA 8 |
| 308 | - $cpfCnpj = (isset($this->nfeArray['NFe']['infNFe']['emit']['CNPJ']) ? $this->nfeArray['NFe']['infNFe']['emit']['CNPJ']:$this->nfeArray['NFe']['infNFe']['emit']['CPF']); |
|
| 308 | + $cpfCnpj = (isset($this->nfeArray['NFe']['infNFe']['emit']['CNPJ']) ? $this->nfeArray['NFe']['infNFe']['emit']['CNPJ'] : $this->nfeArray['NFe']['infNFe']['emit']['CPF']); |
|
| 309 | 309 | $this->pdf->cell(($c1 * 2), 5, "CNPJ/CPF {$cpfCnpj}", 1, 0, 'C', 1); |
| 310 | 310 | $this->pdf->cell(($c1 * 2), 5, @"RG/IE {$this->nfeArray['NFe']['infNFe']['emit']['IE']}", 1, 1, 'C', 1); |
| 311 | 311 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | $this->pdf->cell(($c1 * 4), 5, "{$this->nfeArray['NFe']['infNFe']['dest']['xNome']}", 1, 1, 'C', 1); |
| 319 | 319 | |
| 320 | 320 | // LINHA 11 |
| 321 | - $cpfCnpj = (isset($this->nfeArray['NFe']['infNFe']['dest']['CNPJ']) ? $this->nfeArray['NFe']['infNFe']['dest']['CNPJ']:$this->nfeArray['NFe']['infNFe']['dest']['CPF']); |
|
| 321 | + $cpfCnpj = (isset($this->nfeArray['NFe']['infNFe']['dest']['CNPJ']) ? $this->nfeArray['NFe']['infNFe']['dest']['CNPJ'] : $this->nfeArray['NFe']['infNFe']['dest']['CPF']); |
|
| 322 | 322 | $this->pdf->cell(($c1 * 2), 5, "CNPJ/CPF {$cpfCnpj}", 1, 0, 'C', 1); |
| 323 | 323 | $this->pdf->cell(($c1 * 2), 5, @"RG/IE {$this->nfeArray['NFe']['infNFe']['dest']['IE']}", 1, 1, 'C', 1); |
| 324 | 324 | |