@@ -45,7 +45,6 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * Carrega o conector da impressora. |
| 48 | - * @param Printer $printer |
|
| 49 | 48 | */ |
| 50 | 49 | public function __construct(PrintConnector $connector) |
| 51 | 50 | { |
@@ -400,6 +399,10 @@ discard block |
||
| 400 | 399 | return ''; |
| 401 | 400 | } |
| 402 | 401 | |
| 402 | + /** |
|
| 403 | + * @param integer $pad_length |
|
| 404 | + * @param integer $pad_type |
|
| 405 | + */ |
|
| 403 | 406 | private function strPad( |
| 404 | 407 | $input, |
| 405 | 408 | $pad_length, |
@@ -418,7 +421,6 @@ discard block |
||
| 418 | 421 | |
| 419 | 422 | /** |
| 420 | 423 | * Function to encode a number as two bytes. This is straight out of Mike42\Escpos\Printer |
| 421 | - * @param int $tPag |
|
| 422 | 424 | * @return string |
| 423 | 425 | */ |
| 424 | 426 | private function intLowHigh($input, $length) |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | $this->printer->text($printTotItens . "\n"); |
| 216 | 216 | $this->printer->setJustification(Printer::JUSTIFY_CENTER); |
| 217 | 217 | $this->separador(); |
| 218 | - $pag = $this->nfce->infNFe->pag->detPag; |
|
| 218 | + $pag = $this->nfce->infNFe->pag->detPag; |
|
| 219 | 219 | foreach ($pag as $pagI) { |
| 220 | 220 | $tPag = (string)$pagI->tPag; |
| 221 | 221 | $tPag = (string)$this->tipoPag($tPag); |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | protected function parteVIII() |
| 308 | 308 | { |
| 309 | 309 | $this->printer->setJustification(Printer::JUSTIFY_CENTER); |
| 310 | - if (!empty($this->protNFe->infProt->xMsg)) { |
|
| 310 | + if (!empty($this->protNFe->infProt->xMsg)) { |
|
| 311 | 311 | $this->printer->text("INFORMAÇÕES ADICIONAIS"); |
| 312 | 312 | $this->printer->feed(1); |
| 313 | 313 | $this->printer->text($this->protNFe->infProt->xMsg); |
@@ -110,15 +110,15 @@ discard block |
||
| 110 | 110 | */ |
| 111 | 111 | protected function parteI() |
| 112 | 112 | { |
| 113 | - $razao = (string)$this->nfce->infNFe->emit->xNome; |
|
| 114 | - $cnpj = (string)$this->nfce->infNFe->emit->CNPJ; |
|
| 115 | - $ie = (string)$this->nfce->infNFe->emit->IE; |
|
| 116 | - $im = (string)$this->nfce->infNFe->emit->IM; |
|
| 117 | - $log = (string)$this->nfce->infNFe->emit->enderEmit->xLgr; |
|
| 118 | - $nro = (string)$this->nfce->infNFe->emit->enderEmit->nro; |
|
| 119 | - $bairro = (string)$this->nfce->infNFe->emit->enderEmit->xBairro; |
|
| 120 | - $mun = (string)$this->nfce->infNFe->emit->enderEmit->xMun; |
|
| 121 | - $uf = (string)$this->nfce->infNFe->emit->enderEmit->UF; |
|
| 113 | + $razao = (string) $this->nfce->infNFe->emit->xNome; |
|
| 114 | + $cnpj = (string) $this->nfce->infNFe->emit->CNPJ; |
|
| 115 | + $ie = (string) $this->nfce->infNFe->emit->IE; |
|
| 116 | + $im = (string) $this->nfce->infNFe->emit->IM; |
|
| 117 | + $log = (string) $this->nfce->infNFe->emit->enderEmit->xLgr; |
|
| 118 | + $nro = (string) $this->nfce->infNFe->emit->enderEmit->nro; |
|
| 119 | + $bairro = (string) $this->nfce->infNFe->emit->enderEmit->xBairro; |
|
| 120 | + $mun = (string) $this->nfce->infNFe->emit->enderEmit->xMun; |
|
| 121 | + $uf = (string) $this->nfce->infNFe->emit->enderEmit->UF; |
|
| 122 | 122 | $this->uri = (string) $this->nfce->infNFeSupl->urlChave; |
| 123 | 123 | $this->printer->setJustification(Printer::JUSTIFY_CENTER); |
| 124 | 124 | if (!empty($this->logo)) { |
@@ -164,13 +164,13 @@ discard block |
||
| 164 | 164 | $this->totItens = $det->count(); |
| 165 | 165 | $vTot = 0; |
| 166 | 166 | for ($x = 0; $x <= $this->totItens - 1; $x++) { |
| 167 | - $nItem = (int)$det[$x]->attributes()->{'nItem'}; |
|
| 168 | - $cProd = (string)$det[$x]->prod->cProd; |
|
| 169 | - $xProd = (string)$det[$x]->prod->xProd; |
|
| 170 | - $qCom = (float)$det[$x]->prod->qCom; |
|
| 171 | - $uCom = (string)$det[$x]->prod->uCom; |
|
| 172 | - $vUnCom = (float)$det[$x]->prod->vUnCom; |
|
| 173 | - $vProd = (float)$det[$x]->prod->vProd; |
|
| 167 | + $nItem = (int) $det[$x]->attributes()->{'nItem'}; |
|
| 168 | + $cProd = (string) $det[$x]->prod->cProd; |
|
| 169 | + $xProd = (string) $det[$x]->prod->xProd; |
|
| 170 | + $qCom = (float) $det[$x]->prod->qCom; |
|
| 171 | + $uCom = (string) $det[$x]->prod->uCom; |
|
| 172 | + $vUnCom = (float) $det[$x]->prod->vUnCom; |
|
| 173 | + $vProd = (float) $det[$x]->prod->vProd; |
|
| 174 | 174 | $vTot += $vProd; |
| 175 | 175 | // Formatar dados do item |
| 176 | 176 | $linha = new \stdClass(); |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | ); |
| 188 | 188 | } |
| 189 | 189 | $printtot = str_pad( |
| 190 | - (string)"Total:", |
|
| 190 | + (string) "Total:", |
|
| 191 | 191 | 31, |
| 192 | 192 | " ", |
| 193 | 193 | STR_PAD_LEFT |
@@ -204,22 +204,22 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | protected function parteIV() |
| 206 | 206 | { |
| 207 | - $vNF = (float)$this->nfce->infNFe->total->ICMSTot->vNF; |
|
| 207 | + $vNF = (float) $this->nfce->infNFe->total->ICMSTot->vNF; |
|
| 208 | 208 | $printTotItens = $this->strPad( |
| 209 | 209 | 'Qtd. Total:', |
| 210 | 210 | 31, |
| 211 | 211 | " ", |
| 212 | 212 | STR_PAD_LEFT |
| 213 | 213 | ) |
| 214 | - . $this->strPad((string)$this->totItens, 17, " ", STR_PAD_LEFT); |
|
| 214 | + . $this->strPad((string) $this->totItens, 17, " ", STR_PAD_LEFT); |
|
| 215 | 215 | $this->printer->text($printTotItens . "\n"); |
| 216 | 216 | $this->printer->setJustification(Printer::JUSTIFY_CENTER); |
| 217 | 217 | $this->separador(); |
| 218 | 218 | $pag = $this->nfce->infNFe->pag->detPag; |
| 219 | 219 | foreach ($pag as $pagI) { |
| 220 | - $tPag = (string)$pagI->tPag; |
|
| 221 | - $tPag = (string)$this->tipoPag($tPag); |
|
| 222 | - $vPag = (float)$pagI->vPag; |
|
| 220 | + $tPag = (string) $pagI->tPag; |
|
| 221 | + $tPag = (string) $this->tipoPag($tPag); |
|
| 222 | + $vPag = (float) $pagI->vPag; |
|
| 223 | 223 | $printFormPag = $this->strPad( |
| 224 | 224 | $tPag . ":", |
| 225 | 225 | 31, |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | protected function parteV() |
| 244 | 244 | { |
| 245 | - $vTotTrib = (float)$this->nfce->infNFe->total->ICMSTot->vTotTrib; |
|
| 245 | + $vTotTrib = (float) $this->nfce->infNFe->total->ICMSTot->vTotTrib; |
|
| 246 | 246 | $printimp = $this->strPad("Informação dos Tributos Incidentes:", 35, " ") |
| 247 | 247 | . str_pad("R$" . number_format($vTotTrib, 2, ',', '.'), 13, " ", STR_PAD_LEFT); |
| 248 | 248 | $this->printer->text($printimp . "\n"); |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | */ |
| 261 | 261 | protected function parteVI() |
| 262 | 262 | { |
| 263 | - $infCpl = (string)$this->nfce->infNFe->infAdic->infCpl; |
|
| 263 | + $infCpl = (string) $this->nfce->infNFe->infAdic->infCpl; |
|
| 264 | 264 | if (!empty($infCpl)) { |
| 265 | 265 | $this->printer->text($infCpl . "\n"); |
| 266 | 266 | } |
@@ -273,18 +273,18 @@ discard block |
||
| 273 | 273 | protected function parteVII() |
| 274 | 274 | { |
| 275 | 275 | $this->printer->setJustification(Printer::JUSTIFY_CENTER); |
| 276 | - $tpAmb = (int)$this->nfce->infNFe->ide->tpAmb; |
|
| 276 | + $tpAmb = (int) $this->nfce->infNFe->ide->tpAmb; |
|
| 277 | 277 | if ($tpAmb == 2) { |
| 278 | 278 | $this->printer->text("EMITIDA EM AMBIENTE DE HOMOLOGAÇÃO\nSEM VALOR FISCAL\n"); |
| 279 | 279 | } |
| 280 | - $tpEmis = (int)$this->nfce->infNFe->ide->tpEmis; |
|
| 280 | + $tpEmis = (int) $this->nfce->infNFe->ide->tpEmis; |
|
| 281 | 281 | if ($tpEmis != 1) { |
| 282 | 282 | $this->printer->text("EMITIDA EM AMBIENTE DE CONTINGÊNCIA\n"); |
| 283 | 283 | } |
| 284 | - $nNF = (string)$this->nfce->infNFe->ide->nNF; |
|
| 285 | - $serie = (int)$this->nfce->infNFe->ide->serie; |
|
| 286 | - $dhEmi = (string)$this->nfce->infNFe->ide->dhEmi; |
|
| 287 | - $Id = (string)$this->nfce->infNFe->attributes()->{'Id'}; |
|
| 284 | + $nNF = (string) $this->nfce->infNFe->ide->nNF; |
|
| 285 | + $serie = (int) $this->nfce->infNFe->ide->serie; |
|
| 286 | + $dhEmi = (string) $this->nfce->infNFe->ide->dhEmi; |
|
| 287 | + $Id = (string) $this->nfce->infNFe->attributes()->{'Id'}; |
|
| 288 | 288 | $chave = substr($Id, 3, strlen($Id) - 3); |
| 289 | 289 | //$this->printer->text('Nr. ' . $nNF. ' Serie ' .$serie . ' Emissão ' .$dhEmi . ' via Consumidor'); |
| 290 | 290 | $linha = new \stdClass(); |
@@ -321,11 +321,11 @@ discard block |
||
| 321 | 321 | return; |
| 322 | 322 | } |
| 323 | 323 | $this->printer->setJustification(Printer::JUSTIFY_CENTER); |
| 324 | - $xNome = (string)$this->nfce->infNFe->dest->xNome; |
|
| 324 | + $xNome = (string) $this->nfce->infNFe->dest->xNome; |
|
| 325 | 325 | $this->printer->text($xNome . "\n"); |
| 326 | - $cnpj = (string)$this->nfce->infNFe->dest->CNPJ; |
|
| 327 | - $cpf = (string)$this->nfce->infNFe->dest->CPF; |
|
| 328 | - $idEstrangeiro = (string)$this->nfce->infNFe->dest->idEstrangeiro; |
|
| 326 | + $cnpj = (string) $this->nfce->infNFe->dest->CNPJ; |
|
| 327 | + $cpf = (string) $this->nfce->infNFe->dest->CPF; |
|
| 328 | + $idEstrangeiro = (string) $this->nfce->infNFe->dest->idEstrangeiro; |
|
| 329 | 329 | if (!empty($cnpj)) { |
| 330 | 330 | $this->printer->text("CNPJ " . $cnpj . "\n"); |
| 331 | 331 | $this->printer->feed(1); |
@@ -336,13 +336,13 @@ discard block |
||
| 336 | 336 | if (!empty($idEstrangeiro)) { |
| 337 | 337 | $this->printer->text("Estrangeiro " . $idEstrangeiro . "\n"); |
| 338 | 338 | } |
| 339 | - $xLgr = (string)$this->nfce->infNFe->dest->enderDest->xLgr; |
|
| 340 | - $nro = (string)$this->nfce->infNFe->dest->enderDest->nro; |
|
| 341 | - $xCpl = (string)$this->nfce->infNFe->dest->enderDest->xCpl; |
|
| 342 | - $xBairro = (string)$this->nfce->infNFe->dest->enderDest->xBairro; |
|
| 343 | - $xMun = (string)$this->nfce->infNFe->dest->enderDest->xMun; |
|
| 344 | - $uf = (string)$this->nfce->infNFe->dest->enderDest->UF; |
|
| 345 | - $cep = (string)$this->nfce->infNFe->dest->enderDest->CEP; |
|
| 339 | + $xLgr = (string) $this->nfce->infNFe->dest->enderDest->xLgr; |
|
| 340 | + $nro = (string) $this->nfce->infNFe->dest->enderDest->nro; |
|
| 341 | + $xCpl = (string) $this->nfce->infNFe->dest->enderDest->xCpl; |
|
| 342 | + $xBairro = (string) $this->nfce->infNFe->dest->enderDest->xBairro; |
|
| 343 | + $xMun = (string) $this->nfce->infNFe->dest->enderDest->xMun; |
|
| 344 | + $uf = (string) $this->nfce->infNFe->dest->enderDest->UF; |
|
| 345 | + $cep = (string) $this->nfce->infNFe->dest->enderDest->CEP; |
|
| 346 | 346 | $this->printer->text($xLgr . ", " . $nro . ".\n"); |
| 347 | 347 | if (!empty($xCpl)) { |
| 348 | 348 | $this->printer->text($xCpl . ", "); |
@@ -360,13 +360,13 @@ discard block |
||
| 360 | 360 | { |
| 361 | 361 | $this->printer->setJustification(Printer::JUSTIFY_CENTER); |
| 362 | 362 | $this->printer->text("Consulte via Leitor de QRCode\n"); |
| 363 | - $qr = (string)$this->nfce->infNFeSupl->qrCode; |
|
| 363 | + $qr = (string) $this->nfce->infNFeSupl->qrCode; |
|
| 364 | 364 | // $this->printer->barcodeQRCode($qr); |
| 365 | 365 | $this->printer->qrCode($qr, Printer::QR_ECLEVEL_L, 5); |
| 366 | 366 | $this->printer->feed(); |
| 367 | 367 | if (!empty($this->protNFe)) { |
| 368 | - $nProt = (string)$this->protNFe->infProt->nProt; |
|
| 369 | - $dhRecbto = (string)$this->protNFe->infProt->dhRecbto; |
|
| 368 | + $nProt = (string) $this->protNFe->infProt->nProt; |
|
| 369 | + $dhRecbto = (string) $this->protNFe->infProt->dhRecbto; |
|
| 370 | 370 | $this->printer->text("Protocolo de autorização: " . $nProt . "\n"); |
| 371 | 371 | } else { |
| 372 | 372 | $this->printer->setEmphasis(true); |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | $outp = ""; |
| 427 | 427 | for ($i = 0; $i < $length; $i++) { |
| 428 | 428 | $outp .= chr($input % 256); |
| 429 | - $input = (int)($input / 256); |
|
| 429 | + $input = (int) ($input / 256); |
|
| 430 | 430 | } |
| 431 | 431 | return $outp; |
| 432 | 432 | } |