diff --git a/src/CTe/DacteOS.php b/src/CTe/DacteOS.php index a67d5a96..ba7a0a85 100644 --- a/src/CTe/DacteOS.php +++ b/src/CTe/DacteOS.php @@ -53,6 +53,7 @@ class DacteOS extends DaCommon protected $compl; protected $ICMS; protected $imp; + protected $infTribFed; protected $toma4; protected $toma03; protected $tpEmis; @@ -139,6 +140,7 @@ private function loadDoc($xml) $this->compl = $this->dom->getElementsByTagName("compl"); $this->ICMS = $this->dom->getElementsByTagName("ICMS")->item(0); $this->ICMSSN = $this->dom->getElementsByTagName("ICMSSN")->item(0); + $this->infTribFed = $this->dom->getElementsByTagName("infTribFed")->item(0); $this->imp = $this->dom->getElementsByTagName("imp")->item(0); $vTrib = $this->getTagValue($this->imp, "vTotTrib"); @@ -147,10 +149,10 @@ private function loadDoc($xml) } $textoAdic = number_format($vTrib, 2, ",", "."); $textoObsFisco = ""; - foreach($this->ObsFisco as $obsFisco){ + foreach($this->ObsFisco as $obsFisco){ $textoObsFisco .= $this->getTagValue($obsFisco, "xTexto").". "; } - $this->textoAdic = "o valor aproximado de tributos incidentes sobre o preço deste serviço é de R$" + $this->textoAdic = "Valor aproximado de tributos incidentes sobre o preço deste serviço é de R$" .$textoAdic.'. '.$textoObsFisco; $this->toma = $this->dom->getElementsByTagName("toma")->item(0); $this->enderToma = $this->getTagValue($this->toma, "enderToma"); @@ -281,7 +283,7 @@ protected function monta( $y += 25; $x = $xInic; $r = $this->impostos($x, $y); - $y += 13; + $y += 26; $x = $xInic; $r = $this->observacoes($x, $y); $y += 19; @@ -340,7 +342,7 @@ protected function monta( $y += 25; $x = $xInic; $r = $this->impostos($x, $y); - $y += 13; + $y += 26; $x = $xInic; $r = $this->observacoes($x, $y); $y += 15; @@ -1139,20 +1141,20 @@ protected function impostos($x = 0, $y = 0) $y += 3.4; $this->pdf->line($x, $y, $w + 1, $y); - $texto = 'SITUAÇÃO TRIBUTÁRIA'; + $texto = 'SITUAÇÃO TRIBUTÁRIA ICMS'; $aFont = $this->formatPadrao; $this->pdf->textBox($x, $y, $w * 0.26, $h, $texto, $aFont, 'T', 'L', 0, ''); $x += $w * 0.26; $this->pdf->line($x, $y, $x, $y + 9.5); - $texto = 'BASE DE CALCULO'; + $texto = 'BASE DE CALCULO ICMS'; $aFont = $this->formatPadrao; $this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); $wCol02=0.18; $x += $w * $wCol02; $this->pdf->line($x, $y, $x, $y + 9.5); - $texto = 'ALÍQ ICMS'; + $texto = 'ALÍQUOTA ICMS'; $aFont = $this->formatPadrao; $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); @@ -1168,13 +1170,6 @@ protected function impostos($x = 0, $y = 0) $aFont = $this->formatPadrao; $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); - /*$x += $w * 0.14; - $this->pdf->line($x, $y, $x, $y + 9.5); - $texto = 'ICMS ST'; - $aFont = $this->formatPadrao; - $this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); - * */ - $x = $oldX; $y = $y + 4; $texto = $this->getTagValue($this->ICMS, "CST"); @@ -1207,32 +1202,99 @@ protected function impostos($x = 0, $y = 0) $x += $w * 0.26; $texto = !empty($this->ICMS->getElementsByTagName("vBC")->item(0)->nodeValue) ? - number_format($this->getTagValue($this->ICMS, "vBC"), 2, ",", ".") : ''; + number_format($this->getTagValue($this->ICMS, "vBC"), 2, ",", ".") : '0,00'; $aFont = $this->formatNegrito; $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); $x += $w * $wCol02; $texto = !empty($this->ICMS->getElementsByTagName("pICMS")->item(0)->nodeValue) ? - number_format($this->getTagValue($this->ICMS, "pICMS"), 2, ",", ".") : ''; + number_format($this->getTagValue($this->ICMS, "pICMS"), 2, ",", ".") : '0,00'; $aFont = $this->formatNegrito; $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); $x += $w * $wCol02; $texto = !empty($this->ICMS->getElementsByTagName("vICMS")->item(0)->nodeValue) ? - number_format($this->getTagValue($this->ICMS, "vICMS"), 2, ",", ".") : ''; + number_format($this->getTagValue($this->ICMS, "vICMS"), 2, ",", ".") : '0,00'; $aFont = $this->formatNegrito; $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); $x += $w * $wCol02; $texto = !empty($this->ICMS->getElementsByTagName("pRedBC")->item(0)->nodeValue) ? - number_format($this->getTagValue($this->ICMS, "pRedBC"), 2, ",", ".").'%' :''; + number_format($this->getTagValue($this->ICMS, "pRedBC"), 2, ",", ".").'%' : '0,00'; $aFont = $this->formatNegrito; $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); - /*$x += $w * 0.14; - $texto = ''; + $y += 5.5; + $x = $oldX; + + $h = 13; + $texto = 'INFORMAÇÕES RELATIVAS AO IMPOSTOS FEDERAIS'; + $aFont = $this->formatPadrao; + $this->pdf->textBox($x, $y, $w, $h, $texto, $aFont, 'T', 'C', 1, ''); + + $y += 3.4; + $this->pdf->line($x, $y, $w + 1, $y); + $texto = 'VALOR PIS'; + $aFont = $this->formatPadrao; + $this->pdf->textBox($x, $y, $w * 0.26, $h, $texto, $aFont, 'T', 'L', 0, ''); + + $x += $w * 0.26; + $this->pdf->line($x, $y, $x, $y + 9.5); + $texto = 'VALOR COFINS'; + $aFont = $this->formatPadrao; + $this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, ''); + + $wCol02=0.18; + $x += $w * $wCol02; + $this->pdf->line($x, $y, $x, $y + 9.5); + $texto = 'VALOR IR'; + $aFont = $this->formatPadrao; + $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); + + $x += $w * $wCol02; + $this->pdf->line($x, $y, $x, $y + 9.5); + $texto = 'VALOR INSS'; + $aFont = $this->formatPadrao; + $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); + + $x += $w * $wCol02; + $this->pdf->line($x, $y, $x, $y + 9.5); + $texto = 'VALOR CSLL'; + $aFont = $this->formatPadrao; + $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); + + $x = $oldX; + $y = $y + 4; + + $texto = !empty($this->infTribFed->getElementsByTagName("vPIS")->item(0)->nodeValue) ? + number_format($this->getTagValue($this->infTribFed, "vPIS"), 2, ",", ".") : '0,00'; $aFont = $this->formatNegrito; - $this->pdf->textBox($x, $y, $w * 0.14, $h, $texto, $aFont, 'T', 'L', 0, '');*/ + $this->pdf->textBox($x, $y, $w * 0.26, $h, $texto, $aFont, 'T', 'L', 0, ''); + $x += $w * 0.26; + + $texto = !empty($this->infTribFed->getElementsByTagName("vCOFINS")->item(0)->nodeValue) ? + number_format($this->getTagValue($this->infTribFed, "vCOFINS"), 2, ",", ".") : '0,00'; + $aFont = $this->formatNegrito; + $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); + $x += $w * $wCol02; + + $texto = !empty($this->infTribFed->getElementsByTagName("vIR")->item(0)->nodeValue) ? + number_format($this->getTagValue($this->infTribFed, "vIR"), 2, ",", ".") : '0,00'; + $aFont = $this->formatNegrito; + $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); + $x += $w * $wCol02; + + $texto = !empty($this->infTribFed->getElementsByTagName("vINSS")->item(0)->nodeValue) ? + number_format($this->getTagValue($this->infTribFed, "vINSS"), 2, ",", ".") : '0,00'; + $aFont = $this->formatNegrito; + $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); + $x += $w * $wCol02; + + $texto = !empty($this->infTribFed->getElementsByTagName("vCSLL")->item(0)->nodeValue) ? + number_format($this->getTagValue($this->infTribFed, "vCSLL"), 2, ",", ".").'%' : '0,00'; + $aFont = $this->formatNegrito; + $this->pdf->textBox($x, $y, $w * $wCol02, $h, $texto, $aFont, 'T', 'L', 0, ''); + } //fim da função compValorDACTE /**