Skip to content

Commit

Permalink
Merge pull request #267 from guicalabria/patch-5
Browse files Browse the repository at this point in the history
Adicionando a leitura do detPag loadDoc
  • Loading branch information
robmachado committed Oct 17, 2019
2 parents 0b1d682 + b1033e1 commit e7164a8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/NFe/Danfe.php
Expand Up @@ -402,13 +402,18 @@ public function monta(
//##################################################################
//Verificando quantas linhas serão usadas para impressão das duplicatas
$linhasDup = 0;
if (($this->dup->length > 0) && ($this->dup->length <= 7)) {
if (isset($this->dup) && $this->dup->length > 0) {
$qtdPag = $this->dup->length;
} elseif (isset($this->detPag) && $this->detPag->length > 0) {
$qtdPag = $this->detPag->length;
}
if (($qtdPag > 0) && ($qtdPag <= 7)) {
$linhasDup = 1;
} elseif (($this->dup->length > 7) && ($this->dup->length <= 14)) {
} elseif (($qtdPag > 7) && ($qtdPag <= 14)) {
$linhasDup = 2;
} elseif (($this->dup->length > 14) && ($this->dup->length <= 21)) {
} elseif (($qtdPag > 14) && ($qtdPag <= 21)) {
$linhasDup = 3;
} elseif ($this->dup->length > 21) {
} elseif ($qtdPag > 21) {
// chinnonsantos 11/05/2016: Limite máximo de impressão de duplicatas na NFe,
// só vai ser exibito as 21 primeiras duplicatas (parcelas de pagamento),
// se não oculpa espaço d+, cada linha comporta até 7 duplicatas.
Expand Down Expand Up @@ -3305,6 +3310,7 @@ private function loadDoc($xml)
$this->transp = $this->dom->getElementsByTagName("transp")->item(0);
$this->transporta = $this->dom->getElementsByTagName("transporta")->item(0);
$this->veicTransp = $this->dom->getElementsByTagName("veicTransp")->item(0);
$this->detPag = $this->dom->getElementsByTagName("detPag");
$this->reboque = $this->dom->getElementsByTagName("reboque")->item(0);
$this->infAdic = $this->dom->getElementsByTagName("infAdic")->item(0);
$this->compra = $this->dom->getElementsByTagName("compra")->item(0);
Expand Down

0 comments on commit e7164a8

Please sign in to comment.