public function tagdest($cnpj = '', $cpf = '', $idEstrangeiro = '', $xNome = '', $indIEDest = '', $numIE = '', $isUF = '', $numIM = '', $email = '')
{
$identificador = 'E01 <dest> - ';
$flagNome = true;
//marca se xNome é ou não obrigatório
$this->dest = $this->dom->createElement("dest");
if (($numIE == 'ISENTO' || $numIE == '') && $indIEDest == '1') {
$indIEDest = '2';
}
if ($this->mod == '65') {
$indIEDest = '9';
if ($xNome == '') {
$flagNome = false;
//marca se xNome é ou não obrigatório
}
}
if ($this->tpAmb == '2') {
$xNome = 'NF-E EMITIDA EM AMBIENTE DE HOMOLOGACAO - SEM VALOR FISCAL';
//a exigência do CNPJ 99999999000191 não existe mais
//removido modelo 55
}
if ($cnpj != '') {
$this->dom->addChild($this->dest, "CNPJ", $cnpj, true, $identificador . "CNPJ do destinatário");
} elseif ($cpf != '') {
$this->dom->addChild($this->dest, "CPF", $cpf, true, $identificador . "CPF do destinatário");
} else {
$this->dom->addChild($this->dest, "idEstrangeiro", $idEstrangeiro, true, $identificador . "Identificação do destinatário no caso de comprador estrangeiro");
$indIEDest = '9';
}
$this->dom->addChild($this->dest, "xNome", $xNome, $flagNome, $identificador . "Razão Social ou nome do destinatário");
$this->dom->addChild($this->dest, "indIEDest", $indIEDest, true, $identificador . "Indicador da IE do Destinatário");
if ($numIE != '' && $numIE != 'ISENTO') {
$this->dom->addChild($this->dest, "IE", $numIE, true, $identificador . "Inscrição Estadual do Destinatário");
}
$this->dom->addChild($this->dest, "ISUF", $isUF, false, $identificador . "Inscrição na SUFRAMA do destinatário");
$this->dom->addChild($this->dest, "IM", $numIM, false, $identificador . "Inscrição Municipal do Tomador do Serviço do destinatário");
$this->dom->addChild($this->dest, "email", $email, false, $identificador . "Email do destinatário");
return $this->dest;
}