Changeset 97
Author: linux.rlm
(2010/03/13 13:05) Almost 2 years ago
[ALT] Correçoes para php 5.3. Correção de bugs que ocorrem quando o campo não existe na NFe
Author: linux.rlm
(2010/03/13 13:05) Almost 2 years ago
[ALT] Correçoes para php 5.3. Correção de bugs que ocorrem quando o campo não existe na NFe
public function printDANFE($nome='',$destino='I',$printer=''){public function printDANFE($nome='',$destino='I',$printer=''){return '';if ( $destino == 'S' ){//aqui rotina de impressão direta// não completada ainda}return $arq;$aFont = array('font'=>'Arial','size'=>7,'style'=>'');$aFont = array('font'=>'Arial','size'=>7,'style'=>'');$fone = $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue;$fone = !empty($this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue) ? $this->enderEmit->getElementsByTagName("fone")->item(0)->nodeValue : '';$fone = '(' . $fone1 . ') ' . substr($fone2,-4) . '-' . substr($fone,-4);$fone = '(' . $fone1 . ') ' . substr($fone2,-4) . '-' . substr($fone,-4);$texto = $this->enderEmit->getElementsByTagName("xLgr")->item(0)->nodeValue . ', ' . $this->enderEmit->getElementsByTagName("nro")->item(0)->nodeValue . ' ' . $this->enderEmit->getElementsByTagName("xCpl")->item(0)->nodeValue . ' - ' . $this->enderEmit->getElementsByTagName("xBairro")->item(0)->nodeValue . "\n" . $this->__format($this->enderEmit->getElementsByTagName("CEP")->item(0)->nodeValue,"#####-###") . ' ' . $this->enderEmit->getElementsByTagName("xMun")->item(0)->nodeValue . ' - ' . $this->enderEmit->getElementsByTagName("UF")->item(0)->nodeValue . "\n" . "Fone/Fax: " . $fone;$lgr = !empty($this->enderEmit->getElementsByTagName("xLgr")->item(0)->nodeValue) ? $this->enderEmit->getElementsByTagName("xLgr")->item(0)->nodeValue : '';$nro = !empty($this->enderEmit->getElementsByTagName("nro")->item(0)->nodeValue) ? $this->enderEmit->getElementsByTagName("nro")->item(0)->nodeValue : '';$cpl = !empty($this->enderEmit->getElementsByTagName("xCpl")->item(0)->nodeValue) ? $this->enderEmit->getElementsByTagName("xCpl")->item(0)->nodeValue : '';$bairro = !empty($this->enderEmit->getElementsByTagName("xBairro")->item(0)->nodeValue) ? $this->enderEmit->getElementsByTagName("xBairro")->item(0)->nodeValue : '';$CEP = !empty($this->enderEmit->getElementsByTagName("CEP")->item(0)->nodeValue) ? $this->enderEmit->getElementsByTagName("CEP")->item(0)->nodeValue : ' ';$CEP = $this->__format($CEP,"#####-###");$mun = !empty($this->enderEmit->getElementsByTagName("xMun")->item(0)->nodeValue) ? $this->enderEmit->getElementsByTagName("xMun")->item(0)->nodeValue : '';$UF = !empty($this->enderEmit->getElementsByTagName("UF")->item(0)->nodeValue) ? $this->enderEmit->getElementsByTagName("UF")->item(0)->nodeValue : '';$texto = $lgr . "," . $nro . " " . $cpl . "\n" . $bairro . " - " . $CEP . "\n" . $mun . " - " . $UF . "\n" . "Fone/Fax: " . $fone;$chave_acesso = str_replace('NFe', '', $this->infNFe->getAttribute("Id"));$chave_acesso = str_replace('NFe', '', $this->infNFe->getAttribute("Id"));$bW = 80;$bW = 75;$texto = utf8_decode($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue);$texto = utf8_decode($this->nfeProc->getElementsByTagName("nProt")->item(0)->nodeValue);$tsHora = $this->__convertTime($this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue);$tsHora = $this->__convertTime($this->nfeProc->getElementsByTagName("dhRecbto")->item(0)->nodeValue);$texto .= " - " . date('d/m/Y H:i:s',$tsHora);$texto .= " - " . date('d/m/Y H:i:s',$tsHora);$cStat = $this->nfeProc->getElementsByTagName("cStat")->item(0)->nodeValue;} else {} else {$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$tpAmb = $this->ide->getElementsByTagName('tpAmb')->item(0)->nodeValue;$tpAmb = $this->ide->getElementsByTagName('tpAmb')->item(0)->nodeValue;if ( $cStat == '101') {$aFont = array('font'=>'Arial','size'=>42,'style'=>'B');if ( $tpAmb != 1 ) {if ( $tpAmb != 1 ) {$texto = utf8_decode('CNPJ / CPF');$texto = utf8_decode('CNPJ / CPF');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$texto = $this->__format(utf8_decode($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue),"###.###.###/####-##");$texto = !empty($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue) ? $this->__format(utf8_decode($this->dest->getElementsByTagName("CNPJ")->item(0)->nodeValue),"###.###.###/####-##") : '';if ($texto == ''){$texto = !empty($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue) ? $this->__format(utf8_decode($this->dest->getElementsByTagName("CPF")->item(0)->nodeValue),"###.###.###.###-##") : '';}$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$texto = utf8_decode($this->dest->getElementsByTagName("xLgr")->item(0)->nodeValue);$texto = utf8_decode($this->dest->getElementsByTagName("xLgr")->item(0)->nodeValue);$texto .= ', ' . $this->dest->getElementsByTagName("nro")->item(0)->nodeValue;$texto .= ', ' . $this->dest->getElementsByTagName("nro")->item(0)->nodeValue;$aFont = array('font'=>'Arial','size'=>9,'style'=>'B');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$this->__textBox($x,$y,$w,$h,strtoupper($texto),$aFont,'B','L',0,'',TRUE);$texto = utf8_decode('BAIRRO / DISTRITO');$texto = utf8_decode('BAIRRO / DISTRITO');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$texto = utf8_decode($this->dest->getElementsByTagName("xBairro")->item(0)->nodeValue);$texto = !empty($this->dest->getElementsByTagName("xBairro")->item(0)->nodeValue) ? utf8_decode($this->dest->getElementsByTagName("xBairro")->item(0)->nodeValue) : '';$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$texto = utf8_decode('CEP');$texto = utf8_decode('CEP');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$texto = $this->__format(utf8_decode($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue),"#####-###");$texto = !empty($this->dest->getElementsByTagName("CEP")->item(0)->nodeValue) ? $this->dest->getElementsByTagName("CEP")->item(0)->nodeValue : '';$texto = $this->__format(utf8_decode($texto),"#####-###");$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$texto = utf8_decode('MUNICÍPIO');$texto = utf8_decode('MUNICÍPIO');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$texto = utf8_decode($this->dest->getElementsByTagName("xMun")->item(0)->nodeValue);$texto = !empty($this->dest->getElementsByTagName("xMun")->item(0)->nodeValue) ? utf8_decode($this->dest->getElementsByTagName("xMun")->item(0)->nodeValue) : '';$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$texto = utf8_decode('INSCRIÇÃO ESTADUAL');$texto = utf8_decode('INSCRIÇÃO ESTADUAL');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$texto = utf8_decode($this->dest->getElementsByTagName("IE")->item(0)->nodeValue);$texto = !empty($this->dest->getElementsByTagName("IE")->item(0)->nodeValue) ? utf8_decode($this->dest->getElementsByTagName("IE")->item(0)->nodeValue) : '';$texto = $this->__format($texto,"###.###.###.###");if ( $texto != '') {$texto = $this->__format($texto,"###.###.###.###");}$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');private function __faturaDANFE($x,$y){private function __faturaDANFE($x,$y){if ( $this->dup->length > 0 ) {if ( $this->dup->length > 0 ) {//se sim carregar variáveisif( isset($this->transporta) ) {//se não deixar variáveis em branco//se sim carregar variáveis//NOME / RAZÃO SOCIAL$w = 62;$y += 3;$texto = utf8_decode('NOME / RAZÃO SOCIAL');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$texto = !empty($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue) ? $this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue : '';$texto = utf8_decode($texto);$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$this->__textBox($x,$y,$w,$h,strtoupper($texto),$aFont,'B','L',0,'');//NOME / RAZÃO SOCIAL//FRETE POR CONTA$w = 62;$x += $w;$y += 3;$w = 32;$texto = utf8_decode('NOME / RAZÃO SOCIAL');$texto = utf8_decode('FRETE POR CONTA');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$texto = utf8_decode($this->transporta->getElementsByTagName("xNome")->item(0)->nodeValue);$this->__textBox($x+1,$y+2,$w,$h-2,'0-EMITENTE',$aFont,'T','L',0,'');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$this->__textBox($x+1,$y+4,$w,$h-4,'1-DESTINATARIO',$aFont,'T','L',0,'');$this->__textBox($x,$y,$w,$h,strtoupper($texto),$aFont,'B','L',0,'');$texto = $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue;$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');//FRETE POR CONTA$this->__textBox($x+25,$y+1,5,5,$texto,$aFont,'C','C',1,'');$x += $w;//CÓDIGO ANTT$w = 32;$x += $w;$texto = utf8_decode('FRETE POR CONTA');$w = 31;$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$texto = utf8_decode('CÓDIGO ANTT');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$this->__textBox($x+1,$y+2,$w,$h-2,'0-EMITENTE',$aFont,'T','L',0,'');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$this->__textBox($x+1,$y+4,$w,$h-4,'1-DESTINATARIO',$aFont,'T','L',0,'');if ( isset($this->transporta)){$texto = $this->transp->getElementsByTagName("modFrete")->item(0)->nodeValue;$texto = !empty($this->transporta->getElementsByTagName("RNTC")->item(0)->nodeValue) ? $this->transporta->getElementsByTagName("RNTC")->item(0)->nodeValue : '';$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');} else {$this->__textBox($x+25,$y+1,5,5,$texto,$aFont,'C','C',1,'');$texto = '';//CÓDIGO ANTT}$x += $w;$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$w = 31;$this->__textBox($x,$y,$w,$h,$texto,$aFont,'B','C',0,'');$texto = utf8_decode('CÓDIGO ANTT');//PLACA DO VEÍC$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$x += $w;$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$w = 32;//$texto = $this->transporta->getElementsByTagName("RNTC")->item(0)->nodeValue;$texto = utf8_decode('PLACA DO VEÍCULO');$texto = '';$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'B','C',0,'');$texto = !empty($this->transporta->getElementsByTagName("placa")->item(0)->nodeValue) ? $this->transporta->getElementsByTagName("placa")->item(0)->nodeValue : '';//PLACA DO VEÍC$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$x += $w;$this->__textBox($x,$y,$w,$h,$texto,$aFont,'B','C',0,'');$w = 32;//UF$texto = utf8_decode('PLACA DO VEÍCULO');$x += $w;$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$w = 8;$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$texto = utf8_decode('UF');//$texto = $this->transporta->getElementsByTagName("placa")->item(0)->nodeValue;$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$texto = '';$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ? $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue : '';$this->__textBox($x,$y,$w,$h,$texto,$aFont,'B','C',0,'');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');//UF$this->__textBox($x,$y,$w,$h,$texto,$aFont,'B','C',0,'');$x += $w;//CNPJ / CPF$w = 8;$x += $w;$texto = utf8_decode('UF');$w = 35;$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$texto = utf8_decode('CNPJ / CPF');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');//$texto = $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue;$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$texto = '';$texto = !empty($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue) ? $this->__format($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,"##.###.###/####-##") : '';$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'B','C',0,'');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'B','C',0,'');//CNPJ / CPF//#####################################################################$x += $w;//ENDEREÇO$w = 35;$w = 94;$texto = utf8_decode('CNPJ / CPF');$y += $h;$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$x = $oldX;$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$h = 7;$texto = $this->__format($this->transporta->getElementsByTagName("CNPJ")->item(0)->nodeValue,"##.###.###/####-##");$texto = utf8_decode('ENDEREÇO');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'B','C',0,'');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');//#####################################################################$texto = !empty($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) ? utf8_decode($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue) : '';//ENDEREÇO$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$w = 94;$this->__textBox($x,$y,$w,$h,strtoupper($texto),$aFont,'B','L',0,'');$y += $h;//MUNICÍPIO$x = $oldX;$x += $w;$h = 7;$w = 63;$texto = utf8_decode('ENDEREÇO');$texto = utf8_decode('MUNICÍPIO');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$texto = utf8_decode($this->transporta->getElementsByTagName("xEnder")->item(0)->nodeValue);$texto = !empty($this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue) ? $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue : '';$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$this->__textBox($x,$y,$w,$h,strtoupper($texto),$aFont,'B','L',0,'');$this->__textBox($x,$y,$w,$h,strtoupper($texto),$aFont,'B','C',0,'');//MUNICÍPIO//UF$x += $w;$x += $w;$w = 63;$w = 8;$texto = utf8_decode('MUNICÍPIO');$texto = utf8_decode('UF');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$texto = $this->transporta->getElementsByTagName("xMun")->item(0)->nodeValue;$texto = !empty($this->transporta->getElementsByTagName("UF")->item(0)->nodeValue) ? $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue : '';$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$this->__textBox($x,$y,$w,$h,strtoupper($texto),$aFont,'B','C',0,'');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'B','C',0,'');//UF//INSCRIÇÃO ESTADUAL$x += $w;$x += $w;$w = 8;$w = 35;$texto = utf8_decode('UF');$texto = utf8_decode('INSCRIÇÃO ESTADUAL');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$texto = $this->transporta->getElementsByTagName("UF")->item(0)->nodeValue;$texto = !empty($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue) ? $this->__format($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue,"###.###.###.###") : '';$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'B','C',0,'');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'B','C',0,'');//INSCRIÇÃO ESTADUAL//#####################################################################$x += $w;//QUANTIDADE$w = 35;$w = 20;$texto = utf8_decode('INSCRIÇÃO ESTADUAL');$y += $h;$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$x = $oldX;$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$h = 7;$texto = $this->__format($this->transporta->getElementsByTagName("IE")->item(0)->nodeValue,"###.###.###.###");$texto = utf8_decode('QUANTIDADE');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'B','C',0,'');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');//#####################################################################$texto = !empty($this->transp->getElementsByTagName("qVol")->item(0)->nodeValue) ? $this->transp->getElementsByTagName("qVol")->item(0)->nodeValue : '';//QUANTIDADE$texto = utf8_decode($texto);$w = 20;$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$y += $h;$this->__textBox($x,$y,$w,$h,strtoupper($texto),$aFont,'B','C',0,'');$x = $oldX;//ESPÉCIE$h = 7;$x += $w;$texto = utf8_decode('QUANTIDADE');$w = 36;$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$texto = utf8_decode('ESPÉCIE');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$texto = utf8_decode($this->transp->getElementsByTagName("qVol")->item(0)->nodeValue);$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$texto = !empty($this->transp->getElementsByTagName("esp")->item(0)->nodeValue) ? $this->transp->getElementsByTagName("esp")->item(0)->nodeValue : '';$this->__textBox($x,$y,$w,$h,strtoupper($texto),$aFont,'B','C',0,'');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');//ESPÉCIE$this->__textBox($x,$y,$w,$h,strtoupper($texto),$aFont,'B','C',0,'');$x += $w;//MARCA$w = 36;$x += $w;$texto = utf8_decode('ESPÉCIE');$w = 36;$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$texto = utf8_decode('MARCA');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$texto = $this->transp->getElementsByTagName("esp")->item(0)->nodeValue;$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$texto = !empty($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) ? utf8_decode($this->transp->getElementsByTagName("marca")->item(0)->nodeValue) : '';$this->__textBox($x,$y,$w,$h,strtoupper($texto),$aFont,'B','C',0,'');$texto = '';//MARCA$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$x += $w;$this->__textBox($x,$y,$w,$h,strtoupper($texto),$aFont,'B','C',0,'');$w = 36;//NÚMERO$texto = utf8_decode('MARCA');$x += $w;$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$w = 36;$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$texto = utf8_decode('NÚMERO');//$texto = $this->transp->getElementsByTagName("esp")->item(0)->nodeValue;$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$texto = '';$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$texto = !empty($this->transp->getElementsByTagName("numero")->item(0)->nodeValue) ? $this->transp->getElementsByTagName("numero")->item(0)->nodeValue : '';$this->__textBox($x,$y,$w,$h,strtoupper($texto),$aFont,'B','C',0,'');$texto = '';//NÚMERO$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$x += $w;$this->__textBox($x,$y,$w,$h,strtoupper($texto),$aFont,'B','C',0,'');$w = 36;//PESO BRUTO$texto = utf8_decode('NÚMERO');$x += $w;$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$w = 36;$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$texto = utf8_decode('PESO BRUTO');//$texto = $this->transp->getElementsByTagName("esp")->item(0)->nodeValue;$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$texto = '';$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$texto = !empty($this->transp->getElementsByTagName("pesoB")->item(0)->nodeValue) ? $this->transp->getElementsByTagName("pesoB")->item(0)->nodeValue : '0.0';$this->__textBox($x,$y,$w,$h,strtoupper($texto),$aFont,'B','C',0,'');$texto = number_format($texto, 2, ",", ".");//PESO BRUTO$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$x += $w;$this->__textBox($x,$y,$w,$h,strtoupper($texto),$aFont,'B','R',0,'');$w = 36;//PESO LÍQUIDO$texto = utf8_decode('PESO BRUTO');$x += $w;$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$w = 36;$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$texto = utf8_decode('PESO LÍQUIDO');$texto = number_format($this->transp->getElementsByTagName("pesoB")->item(0)->nodeValue, 2, ",", ".");$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$this->__textBox($x,$y,$w,$h,strtoupper($texto),$aFont,'B','R',0,'');$texto = !empty($this->transp->getElementsByTagName("pesoL")->item(0)->nodeValue) ? $this->transp->getElementsByTagName("pesoL")->item(0)->nodeValue : '0.0';//PESO LÍQUIDO$texto = number_format($texto, 2, ",", ".");$x += $w;$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$w = 36;$this->__textBox($x,$y,$w,$h,strtoupper($texto),$aFont,'B','R',0,'');$texto = utf8_decode('PESO LÍQUIDO');}$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$this->__textBox($x,$y,$w,$h,$texto,$aFont,'T','L',1,'');$texto = number_format($this->transp->getElementsByTagName("pesoL")->item(0)->nodeValue, 2, ",", ".");$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$this->__textBox($x,$y,$w,$h,strtoupper($texto),$aFont,'B','R',0,'');foreach ($this->det as $d) {foreach ($this->det as $d) {if ( $i >= $nInicio && $i < $max ) {if ( $i >= $nInicio && $i < $max ) {$prod = $this->det->item($i)->getElementsByTagName("prod")->item(0);$prod = $this->det->item($i)->getElementsByTagName("prod")->item(0);$infAdProd = $this->det->item($i)->getElementsByTagName("infAdProd")->item(0)->nodeValue;$infAdProd = !empty($this->det->item($i)->getElementsByTagName("infAdProd")->item(0)->nodeValue) ? $this->det->item($i)->getElementsByTagName("infAdProd")->item(0)->nodeValue : '';$imposto = $this->det->item($i)->getElementsByTagName("imposto")->item(0);$imposto = $this->det->item($i)->getElementsByTagName("imposto")->item(0);$ICMS = $imposto->getElementsByTagName("ICMS")->item(0);$ICMS = $imposto->getElementsByTagName("ICMS")->item(0);$IPI = $imposto->getElementsByTagName("IPI")->item(0);$IPI = $imposto->getElementsByTagName("IPI")->item(0);//codigo do produto$texto = $prod->getElementsByTagName("NCM")->item(0)->nodeValue;$texto = !empty($prod->getElementsByTagName("NCM")->item(0)->nodeValue) ? $prod->getElementsByTagName("NCM")->item(0)->nodeValue : '';$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$aFont = array('font'=>'Arial','size'=>6,'style'=>'');$texto = $this->infAdic->getElementsByTagName("infCpl")->item(0)->nodeValue;if( isset($this->infAdic) ) {$texto = utf8_decode($texto);$texto = !empty($this->infAdic->getElementsByTagName("infCpl")->item(0)->nodeValue) ? $this->infAdic->getElementsByTagName("infCpl")->item(0)->nodeValue : '';$texto .= !empty($this->infAdic->getElementsByTagName("infAdFisco")->item(0)->nodeValue) ? ' Inf. de interesse do fisco: '.$this->infAdic->getElementsByTagName("infAdFisco")->item(0)->nodeValue : '';$texto = utf8_decode($texto);} else {$texto = '';}$aFont = array('font'=>'Arial','size'=>8,'style'=>'');$aFont = array('font'=>'Arial','size'=>8,'style'=>'');$aFont = array('font'=>'Arial','size'=>14,'style'=>'B');$aFont = array('font'=>'Arial','size'=>14,'style'=>'B');$texto = "Nº. " . $this->__format($numNF,"###.###.###") . " \n";$texto .= "SRIE $serie";$texto .= "Srie $serie";$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');$aFont = array('font'=>'Arial','size'=>10,'style'=>'B');} else {} else {foreach ( $aMask as $letra ){if ($letra == '#'){if ( $z > $tCampo ) {if ( $x > 0 ) {if ( $x > 0 ) {} else {} else {$digMask = '#';$digMask = '#';if ( $digMask=='#' ) {if ( $digMask=='#' ) {if ( $y > 0 ) {if ( $y > 0 ) {} else {} else {//$sRetorno[--$tRetorno] = '';//$sRetorno[--$tRetorno] = '';} else {} else {$sRetorno[--$tRetorno] = $mascara[$x];if ( $y > 0 ) {$sRetorno[--$tRetorno] = $mascara[$x];} else {if ($mascara[$x] =='('){$sRetorno[--$tRetorno] = $mascara[$x];}}* @version 1.0* @version 1.1* - Substituidas as funções split por explodeprivate function __convertTime($DH){private function __convertTime($DH){if ($DH){if ($DH){$aDH = split('T',$DH);$aDH = explode('T',$DH);$adDH = split('-',$aDH[0]);$adDH = explode('-',$aDH[0]);$atDH = split(':',$aDH[1]);$atDH = explode(':',$aDH[1]);