NFePHP\Extras\Danfe::pDescricaoProduto PHP Method

pDescricaoProduto() protected method

descricaoProduto Monta a string de descrição de cada Produto
protected pDescricaoProduto ( $itemProd ) : string
return string descricao do produto
    protected function pDescricaoProduto($itemProd)
    {
        $prod = $itemProd->getElementsByTagName('prod')->item(0);
        $ICMS = $itemProd->getElementsByTagName("ICMS")->item(0);
        $ICMSUFDest = $itemProd->getElementsByTagName("ICMSUFDest")->item(0);
        $impostos = '';
        if (!empty($ICMS)) {
            $impostos .= $this->pDescricaoProdutoHelper($ICMS, "pRedBC", " pRedBC=%s%%");
            $impostos .= $this->pDescricaoProdutoHelper($ICMS, "pMVAST", " IVA=%s%%");
            $impostos .= $this->pDescricaoProdutoHelper($ICMS, "pICMSST", " pIcmsSt=%s%%");
            $impostos .= $this->pDescricaoProdutoHelper($ICMS, "vBCST", " BcIcmsSt=%s");
            $impostos .= $this->pDescricaoProdutoHelper($ICMS, "vICMSST", " vIcmsSt=%s");
        }
        if (!empty($ICMSUFDest)) {
            $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "pFCPUFDest", " pFCPUFDest=%s%%");
            $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "pICMSUFDest", " pICMSUFDest=%s%%");
            $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "pICMSInterPart", " pICMSInterPart=%s%%");
            $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vFCPUFDest", " vFCPUFDest=%s");
            $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFDest", " vICMSUFDest=%s");
            $impostos .= $this->pDescricaoProdutoHelper($ICMSUFDest, "vICMSUFRemet", " vICMSUFRemet=%s");
        }
        $infAdProd = !empty($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue) ? substr($this->pAnfavea($itemProd->getElementsByTagName('infAdProd')->item(0)->nodeValue), 0, 500) : '';
        if (!empty($infAdProd)) {
            $infAdProd = trim($infAdProd);
            $infAdProd .= ' ';
        }
        $medTxt = '';
        $med = $prod->getElementsByTagName("med");
        if (isset($med)) {
            $i = 0;
            while ($i < $med->length) {
                $medTxt .= $this->pSimpleGetValue($med->item($i), 'nLote', ' Lote: ');
                $medTxt .= $this->pSimpleGetValue($med->item($i), 'qLote', ' Quant: ');
                $medTxt .= $this->pSimpleGetDate($med->item($i), 'dFab', ' Fab: ');
                $medTxt .= $this->pSimpleGetDate($med->item($i), 'dVal', ' Val: ');
                $medTxt .= $this->pSimpleGetValue($med->item($i), 'vPMC', ' PMC: ');
                $i++;
            }
            if ($medTxt != '') {
                $medTxt .= ' ';
            }
        }
        //NT2013.006 FCI
        $nFCI = !empty($itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue) ? ' FCI:' . $itemProd->getElementsByTagName('nFCI')->item(0)->nodeValue : '';
        $tmp_ad = $infAdProd . ($this->descProdInfoComplemento ? $medTxt . $impostos . $nFCI : '');
        $texto = $prod->getElementsByTagName("xProd")->item(0)->nodeValue . (strlen($tmp_ad) != 0 ? "\n    " . $tmp_ad : '');
        if ($this->descProdQuebraLinha) {
            $texto = str_replace(";", "\n", $texto);
        }
        return $texto;
    }