Skip to content

Commit

Permalink
Merge pull request #866 from robmachado/master
Browse files Browse the repository at this point in the history
ajustes totalizadores
  • Loading branch information
robmachado committed Sep 3, 2021
2 parents 1d75611 + a5e7321 commit 0ffe79b
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions src/Make.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ public function __construct()
$this->stdTot->vII = 0;
$this->stdTot->vIPI = 0;
$this->stdTot->vIPIDevol = 0;
$this->stdTot->vServ = 0;
$this->stdTot->vPIS = 0;
$this->stdTot->vCOFINS = 0;
$this->stdTot->vPISST = 0;
Expand Down Expand Up @@ -3358,6 +3359,8 @@ public function tagICMS(stdClass $std)
);
break;
case '51':
$this->stdTot->vBC += (float) !empty($std->vBC) ? $std->vBC : 0;

$icms = $this->dom->createElement("ICMS51");
$this->dom->addChild(
$icms,
Expand Down Expand Up @@ -5873,6 +5876,8 @@ public function tagISSQNTot(stdClass $std)
'cRegTrib'
];
$std = $this->equilizeParameters($std, $possible);
$this->stdTot->vServ = (float) round($std->vServ, 2) ?? 0;

$this->buildTotal();
$ISSQNTot = $this->dom->createElement("ISSQNtot");
$this->dom->addChild(
Expand Down Expand Up @@ -7447,19 +7452,7 @@ protected function buildTotal()
if (empty($this->total)) {
$this->total = $this->dom->createElement("total");
}

$this->stdTot->vNF = $this->stdTot->vProd
- $this->stdTot->vDesc
+ $this->stdTot->vST
+ $this->stdTot->vFCPST
+ $this->stdTot->vFrete
+ $this->stdTot->vSeg
+ $this->stdTot->vOutro
+ $this->stdTot->vII
+ $this->stdTot->vIPI
+ $this->stdTot->vIPIDevol
+ $this->stdTot->vPISST
+ $this->stdTot->vCOFINSST;

//round all values
$this->stdTot->vBC = round($this->stdTot->vBC, 2);
$this->stdTot->vICMS = round($this->stdTot->vICMS, 2);
Expand All @@ -7484,6 +7477,21 @@ protected function buildTotal()
$this->stdTot->vOutro = round($this->stdTot->vOutro, 2);
$this->stdTot->vNF = round($this->stdTot->vNF, 2);
$this->stdTot->vTotTrib = round($this->stdTot->vTotTrib, 2);

$this->stdTot->vNF = $this->stdTot->vProd
- $this->stdTot->vDesc
- $this->stdTot->vICMSDeson
+ $this->stdTot->vST
+ $this->stdTot->vFCPST
+ $this->stdTot->vFrete
+ $this->stdTot->vSeg
+ $this->stdTot->vOutro
+ $this->stdTot->vII
+ $this->stdTot->vIPI
+ $this->stdTot->vIPIDevol
+ $this->stdTot->vServ
+ $this->stdTot->vPISST
+ $this->stdTot->vCOFINSST;
}

/**
Expand Down

0 comments on commit 0ffe79b

Please sign in to comment.