NFePHP\Extras\Danfce::itens PHP Method

itens() protected method

Make itens block
protected itens ( NFePHP\Extras\DomDocumentNFePHP $det ) : string
$det NFePHP\Extras\DomDocumentNFePHP
return string
    protected function itens($det)
    {
        if (!isset($det)) {
            return '';
        }
        //ITENS
        $itensHtml = "<table width='100%'>\n";
        $itensHtml .= "<thead>\n";
        $itensHtml .= "<tr>\n";
        $itensHtml .= "<td>#</td>\n";
        $itensHtml .= "<td>" . htmlspecialchars('CÓDIGO') . "</td>\n";
        $itensHtml .= "<td>" . htmlspecialchars('DESCRIÇÃO') . "</td>\n";
        $itensHtml .= "<td>QTDE.</td>\n";
        $itensHtml .= "<td>UN.</td>\n";
        $itensHtml .= "<td>VL.UNIT.</td>\n";
        $itensHtml .= "<td>VL.TOTAL</td>\n";
        $itensHtml .= "</tr>\n";
        $itensHtml .= "</thead>\n";
        foreach ($det as $detI) {
            $thisItem = $detI;
            $prod = $thisItem->getElementsByTagName("prod")->item(0);
            $nitem = $thisItem->getAttribute("nItem");
            $cProd = $this->pSimpleGetValue($prod, "cProd");
            $xProd = $this->pSimpleGetValue($prod, "xProd");
            $qCom = number_format($this->pSimpleGetValue($prod, "qCom"), 2, ",", ".");
            $uCom = $this->pSimpleGetValue($prod, "uCom");
            $vUnCom = number_format($this->pSimpleGetValue($prod, "vUnCom"), 2, ",", ".");
            $vProd = number_format($this->pSimpleGetValue($prod, "vProd"), 2, ",", ".");
            $itensHtml .= "<tr>\n";
            $itensHtml .= "<td class=\"tLeft\">" . htmlspecialchars($nitem) . "</td>\n";
            $itensHtml .= "<td class=\"tLeft\">" . htmlspecialchars($cProd) . "</td>\n";
            $itensHtml .= "<td class=\"tLeft\" colspan=\"5\">" . htmlspecialchars($xProd) . "</td>\n";
            $itensHtml .= "</tr>\n";
            $itensHtml .= "<tr>\n";
            $itensHtml .= "<td colspan=\"3\"></td>\n";
            $itensHtml .= "<td class=\"tRight\">{$qCom}</td>\n";
            $itensHtml .= "<td>{$uCom}</td>\n";
            $itensHtml .= "<td class=\"tRight\">" . htmlspecialchars($vUnCom) . "</td>\n";
            $itensHtml .= "<td class=\"tRight\">{$vProd}</td>\n";
            $itensHtml .= "</tr>\n";
        }
        $itensHtml .= "</table>\n";
        return $itensHtml;
    }