<?php

class pdfreport_wastetransactions_rtf
{
   var $Db;
   var $Erro;
   var $Ini;
   var $Lookup;
   var $nm_data;
   var $texto_tag;
   var $arquivo;
   var $tit_doc;
   var $sc_proc_grid; 
   var $NM_cmp_hidden = array();

   //---- 
   function pdfreport_wastetransactions_rtf()
   {
      $this->nm_data   = new nm_data("el");
      $this->texto_tag = "";
   }

   //---- 
   function monta_rtf()
   {
      $this->inicializa_vars();
      $this->gera_texto_tag();
      $this->grava_arquivo_rtf();
      $this->monta_html();
   }

   //----- 
   function inicializa_vars()
   {
      global $nm_lang;
      $dir_raiz          = strrpos($_SERVER['PHP_SELF'],"/") ;  
      $dir_raiz          = substr($_SERVER['PHP_SELF'], 0, $dir_raiz + 1) ;  
      $this->nm_location = $this->Ini->sc_protocolo . $this->Ini->server . $dir_raiz; 
      $this->arquivo    = "sc_rtf";
      $this->arquivo   .= "_" . date("YmdHis") . "_" . rand(0, 1000);
      $this->arquivo   .= "_pdfreport_wastetransactions";
      $this->arquivo   .= ".rtf";
      $this->tit_doc    = "pdfreport_wastetransactions.rtf";
   }

   //----- 
   function gera_texto_tag()
   {
     global $nm_lang;
      global
             $nm_nada, $nm_lang;

      $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
      $this->sc_proc_grid = false; 
      $nm_raiz_img  = ""; 
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['pdfreport_wastetransactions']['campos_busca']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['pdfreport_wastetransactions']['campos_busca']))
      { 
          $Busca_temp = $_SESSION['sc_session'][$this->Ini->sc_page]['pdfreport_wastetransactions']['campos_busca'];
          if ($_SESSION['scriptcase']['charset'] != "UTF-8")
          {
              $Busca_temp = NM_conv_charset($Busca_temp, $_SESSION['scriptcase']['charset'], "UTF-8");
          }
          $this->wtfdestrd = $Busca_temp['wtfdestrd']; 
          $tmp_pos = strpos($this->wtfdestrd, "##@@");
          if ($tmp_pos !== false)
          {
              $this->wtfdestrd = substr($this->wtfdestrd, 0, $tmp_pos);
          }
          $this->wtid = $Busca_temp['wtid']; 
          $tmp_pos = strpos($this->wtid, "##@@");
          if ($tmp_pos !== false)
          {
              $this->wtid = substr($this->wtid, 0, $tmp_pos);
          }
          $this->wtid_2 = $Busca_temp['wtid_input_2']; 
          $this->wtprofilid = $Busca_temp['wtprofilid']; 
          $tmp_pos = strpos($this->wtprofilid, "##@@");
          if ($tmp_pos !== false)
          {
              $this->wtprofilid = substr($this->wtprofilid, 0, $tmp_pos);
          }
          $this->wtprofilid_2 = $Busca_temp['wtprofilid_input_2']; 
          $this->intnumber = $Busca_temp['intnumber']; 
          $tmp_pos = strpos($this->intnumber, "##@@");
          if ($tmp_pos !== false)
          {
              $this->intnumber = substr($this->intnumber, 0, $tmp_pos);
          }
          $this->intnumber_2 = $Busca_temp['intnumber_input_2']; 
          $this->wtrequestdate = $Busca_temp['wtrequestdate']; 
          $tmp_pos = strpos($this->wtrequestdate, "##@@");
          if ($tmp_pos !== false)
          {
              $this->wtrequestdate = substr($this->wtrequestdate, 0, $tmp_pos);
          }
          $this->wtrequestdate_2 = $Busca_temp['wtrequestdate_input_2']; 
      } 
      $this->nm_field_dinamico = array();
      $this->nm_order_dinamico = array();
      $this->sc_where_orig   = $_SESSION['sc_session'][$this->Ini->sc_page]['pdfreport_wastetransactions']['where_orig'];
      $this->sc_where_atual  = $_SESSION['sc_session'][$this->Ini->sc_page]['pdfreport_wastetransactions']['where_pesq'];
      $this->sc_where_filtro = $_SESSION['sc_session'][$this->Ini->sc_page]['pdfreport_wastetransactions']['where_pesq_filtro'];
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['pdfreport_wastetransactions']['rtf_name']))
      {
          $this->arquivo = $_SESSION['sc_session'][$this->Ini->sc_page]['pdfreport_wastetransactions']['rtf_name'];
          $this->tit_doc = $_SESSION['sc_session'][$this->Ini->sc_page]['pdfreport_wastetransactions']['rtf_name'];
          unset($_SESSION['sc_session'][$this->Ini->sc_page]['pdfreport_wastetransactions']['rtf_name']);
      }
      if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
      { 
          $nmgp_select = "SELECT wtid, wtProfilID, INTNUMBER, wtRequestDate, wtProducerBranchID, wtProducerPeriferia, wtProducerEwc, wtProducerEwc as ewc1, wtProducerAcceptWeigth, wtProducerQty, wtPrducerm3, wtProducerRemarks, wtProducerValidate, wtTransportDate, wtTransporterID, wtTransporterPeriferiaID, wtTransporterEWC, wtTransporterVechicle, wtTransporterValidate, wtTransporterValidateIP, wtTransporterNumberID, wtFdestDate, wtFDestID, wtFDestPeriferia, wtFDestEWC, wtFDestEWC as ewc2, wtFDestRD, wtFDestQty, wtFDestM3, wtFDestVlidated, wtFDestValidateIP, wtProducerSign, wtTransporterSign, wtFDestSign from " . $this->Ini->nm_tabela; 
      } 
      else 
      { 
          $nmgp_select = "SELECT wtid, wtProfilID, INTNUMBER, wtRequestDate, wtProducerBranchID, wtProducerPeriferia, wtProducerEwc, wtProducerEwc as ewc1, wtProducerAcceptWeigth, wtProducerQty, wtPrducerm3, wtProducerRemarks, wtProducerValidate, wtTransportDate, wtTransporterID, wtTransporterPeriferiaID, wtTransporterEWC, wtTransporterVechicle, wtTransporterValidate, wtTransporterValidateIP, wtTransporterNumberID, wtFdestDate, wtFDestID, wtFDestPeriferia, wtFDestEWC, wtFDestEWC as ewc2, wtFDestRD, wtFDestQty, wtFDestM3, wtFDestVlidated, wtFDestValidateIP, wtProducerSign, wtTransporterSign, wtFDestSign from " . $this->Ini->nm_tabela; 
      } 
      $nmgp_select .= " " . $_SESSION['sc_session'][$this->Ini->sc_page]['pdfreport_wastetransactions']['where_pesq'];
      $nmgp_order_by = $_SESSION['sc_session'][$this->Ini->sc_page]['pdfreport_wastetransactions']['order_grid'];
      $nmgp_select .= $nmgp_order_by; 
      $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nmgp_select;
      $rs = $this->Db->Execute($nmgp_select);
      if ($rs === false && !$rs->EOF && $GLOBALS["NM_ERRO_IBASE"] != 1)
      {
         $this->Erro->mensagem(__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg());
         exit;
      }

      $this->texto_tag .= "<table>\r\n";
      $this->texto_tag .= "<tr>\r\n";
      foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['pdfreport_wastetransactions']['field_order'] as $Cada_col)
      { 
          $SC_Label = (isset($this->New_label['wtid'])) ? $this->New_label['wtid'] : "Wtid"; 
          if ($Cada_col == "wtid" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtprofilid'])) ? $this->New_label['wtprofilid'] : "Wt Profil ID"; 
          if ($Cada_col == "wtprofilid" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['intnumber'])) ? $this->New_label['intnumber'] : "INTNUMBER"; 
          if ($Cada_col == "intnumber" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtrequestdate'])) ? $this->New_label['wtrequestdate'] : "Wt Request Date"; 
          if ($Cada_col == "wtrequestdate" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtproducerbranchid'])) ? $this->New_label['wtproducerbranchid'] : "Wt Producer Branch ID"; 
          if ($Cada_col == "wtproducerbranchid" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtproducerperiferia'])) ? $this->New_label['wtproducerperiferia'] : "Wt Producer Periferia"; 
          if ($Cada_col == "wtproducerperiferia" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtproducerewc'])) ? $this->New_label['wtproducerewc'] : "Wt Producer Ewc"; 
          if ($Cada_col == "wtproducerewc" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['ewc1'])) ? $this->New_label['ewc1'] : "Ewc 1"; 
          if ($Cada_col == "ewc1" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtproduceracceptweigth'])) ? $this->New_label['wtproduceracceptweigth'] : "Wt Producer Accept Weigth"; 
          if ($Cada_col == "wtproduceracceptweigth" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtproducerqty'])) ? $this->New_label['wtproducerqty'] : "Wt Producer Qty"; 
          if ($Cada_col == "wtproducerqty" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtprducerm3'])) ? $this->New_label['wtprducerm3'] : "Wt Prducerm 3"; 
          if ($Cada_col == "wtprducerm3" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtproducerremarks'])) ? $this->New_label['wtproducerremarks'] : "Wt Producer Remarks"; 
          if ($Cada_col == "wtproducerremarks" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtproducervalidate'])) ? $this->New_label['wtproducervalidate'] : "Wt Producer Validate"; 
          if ($Cada_col == "wtproducervalidate" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wttransportdate'])) ? $this->New_label['wttransportdate'] : "Wt Transport Date"; 
          if ($Cada_col == "wttransportdate" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wttransporterid'])) ? $this->New_label['wttransporterid'] : "Wt Transporter ID"; 
          if ($Cada_col == "wttransporterid" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wttransporterperiferiaid'])) ? $this->New_label['wttransporterperiferiaid'] : "Wt Transporter Periferia ID"; 
          if ($Cada_col == "wttransporterperiferiaid" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wttransporterewc'])) ? $this->New_label['wttransporterewc'] : "Wt Transporter EWC"; 
          if ($Cada_col == "wttransporterewc" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wttransportervechicle'])) ? $this->New_label['wttransportervechicle'] : "Wt Transporter Vechicle"; 
          if ($Cada_col == "wttransportervechicle" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wttransportervalidate'])) ? $this->New_label['wttransportervalidate'] : "Wt Transporter Validate"; 
          if ($Cada_col == "wttransportervalidate" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wttransportervalidateip'])) ? $this->New_label['wttransportervalidateip'] : "Wt Transporter Validate IP"; 
          if ($Cada_col == "wttransportervalidateip" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wttransporternumberid'])) ? $this->New_label['wttransporternumberid'] : "Wt Transporter Number ID"; 
          if ($Cada_col == "wttransporternumberid" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtfdestdate'])) ? $this->New_label['wtfdestdate'] : "Wt Fdest Date"; 
          if ($Cada_col == "wtfdestdate" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtfdestid'])) ? $this->New_label['wtfdestid'] : "Wt F Dest ID"; 
          if ($Cada_col == "wtfdestid" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtfdestperiferia'])) ? $this->New_label['wtfdestperiferia'] : "Wt F Dest Periferia"; 
          if ($Cada_col == "wtfdestperiferia" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtfdestewc'])) ? $this->New_label['wtfdestewc'] : "Wt F Dest EWC"; 
          if ($Cada_col == "wtfdestewc" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['ewc2'])) ? $this->New_label['ewc2'] : "Ewc 2"; 
          if ($Cada_col == "ewc2" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtfdestrd'])) ? $this->New_label['wtfdestrd'] : "Wt F Dest RD"; 
          if ($Cada_col == "wtfdestrd" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtfdestqty'])) ? $this->New_label['wtfdestqty'] : "Wt F Dest Qty"; 
          if ($Cada_col == "wtfdestqty" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtfdestm3'])) ? $this->New_label['wtfdestm3'] : "Wt F Dest M3"; 
          if ($Cada_col == "wtfdestm3" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtfdestvlidated'])) ? $this->New_label['wtfdestvlidated'] : "Wt F Dest Vlidated"; 
          if ($Cada_col == "wtfdestvlidated" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtfdestvalidateip'])) ? $this->New_label['wtfdestvalidateip'] : "Wt F Dest Validate IP"; 
          if ($Cada_col == "wtfdestvalidateip" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtproducersign'])) ? $this->New_label['wtproducersign'] : ""; 
          if ($Cada_col == "wtproducersign" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wttransportersign'])) ? $this->New_label['wttransportersign'] : "Wt Transporter Sign"; 
          if ($Cada_col == "wttransportersign" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wtfdestsign'])) ? $this->New_label['wtfdestsign'] : "Wt F Dest Sign"; 
          if ($Cada_col == "wtfdestsign" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['email'])) ? $this->New_label['email'] : "Email"; 
          if ($Cada_col == "email" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['envregistrationno'])) ? $this->New_label['envregistrationno'] : "EnvRegistrationNo"; 
          if ($Cada_col == "envregistrationno" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['fdestaddress'])) ? $this->New_label['fdestaddress'] : "FDestAddress"; 
          if ($Cada_col == "fdestaddress" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['fdestaepo'])) ? $this->New_label['fdestaepo'] : "FDestAepo"; 
          if ($Cada_col == "fdestaepo" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['fdestphone'])) ? $this->New_label['fdestphone'] : "FDestPhone"; 
          if ($Cada_col == "fdestphone" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['fdestrespone'])) ? $this->New_label['fdestrespone'] : "FDestRespone"; 
          if ($Cada_col == "fdestrespone" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['fdestresponseemail'])) ? $this->New_label['fdestresponseemail'] : "FDestResponseEmail"; 
          if ($Cada_col == "fdestresponseemail" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['phone'])) ? $this->New_label['phone'] : "Phone"; 
          if ($Cada_col == "phone" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['produceraepo'])) ? $this->New_label['produceraepo'] : "ProducerAEPO"; 
          if ($Cada_col == "produceraepo" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['producerb_address'])) ? $this->New_label['producerb_address'] : "ProducerB_Address"; 
          if ($Cada_col == "producerb_address" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['responsename'])) ? $this->New_label['responsename'] : "ResponseName"; 
          if ($Cada_col == "responsename" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
          $SC_Label = (isset($this->New_label['wttransporterresponse'])) ? $this->New_label['wttransporterresponse'] : "wtTransporterResponse"; 
          if ($Cada_col == "wttransporterresponse" && (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off"))
          {
              if (!NM_is_utf8($SC_Label))
              {
                  $SC_Label = sc_convert_encoding($SC_Label, "UTF-8", $_SESSION['scriptcase']['charset']);
              }
              $SC_Label = str_replace('<', '&lt;', $SC_Label);
              $SC_Label = str_replace('>', '&gt;', $SC_Label);
              $this->texto_tag .= "<td>" . $SC_Label . "</td>\r\n";
          }
      } 
      $this->texto_tag .= "</tr>\r\n";
      while (!$rs->EOF)
      {
         $this->texto_tag .= "<tr>\r\n";
         $this->wtid = $rs->fields[0] ;  
         $this->wtid = (string)$this->wtid;
         $this->wtprofilid = $rs->fields[1] ;  
         $this->wtprofilid = (string)$this->wtprofilid;
         $this->intnumber = $rs->fields[2] ;  
         $this->intnumber = (string)$this->intnumber;
         $this->wtrequestdate = $rs->fields[3] ;  
         $this->wtproducerbranchid = $rs->fields[4] ;  
         $this->wtproducerbranchid = (string)$this->wtproducerbranchid;
         $this->wtproducerperiferia = $rs->fields[5] ;  
         $this->wtproducerperiferia = (string)$this->wtproducerperiferia;
         $this->wtproducerewc = $rs->fields[6] ;  
         $this->ewc1 = $rs->fields[7] ;  
         $this->wtproduceracceptweigth = $rs->fields[8] ;  
         $this->wtproduceracceptweigth = (string)$this->wtproduceracceptweigth;
         $this->wtproducerqty = $rs->fields[9] ;  
         $this->wtproducerqty = (string)$this->wtproducerqty;
         $this->wtprducerm3 = $rs->fields[10] ;  
         $this->wtprducerm3 = (string)$this->wtprducerm3;
         $this->wtproducerremarks = $rs->fields[11] ;  
         $this->wtproducervalidate = $rs->fields[12] ;  
         $this->wttransportdate = $rs->fields[13] ;  
         $this->wttransporterid = $rs->fields[14] ;  
         $this->wttransporterid = (string)$this->wttransporterid;
         $this->wttransporterperiferiaid = $rs->fields[15] ;  
         $this->wttransporterperiferiaid = (string)$this->wttransporterperiferiaid;
         $this->wttransporterewc = $rs->fields[16] ;  
         $this->wttransportervechicle = $rs->fields[17] ;  
         $this->wttransportervalidate = $rs->fields[18] ;  
         $this->wttransportervalidate = (string)$this->wttransportervalidate;
         $this->wttransportervalidateip = $rs->fields[19] ;  
         $this->wttransporternumberid = $rs->fields[20] ;  
         $this->wtfdestdate = $rs->fields[21] ;  
         $this->wtfdestid = $rs->fields[22] ;  
         $this->wtfdestid = (string)$this->wtfdestid;
         $this->wtfdestperiferia = $rs->fields[23] ;  
         $this->wtfdestperiferia = (string)$this->wtfdestperiferia;
         $this->wtfdestewc = $rs->fields[24] ;  
         $this->ewc2 = $rs->fields[25] ;  
         $this->wtfdestrd = $rs->fields[26] ;  
         $this->wtfdestqty = $rs->fields[27] ;  
         $this->wtfdestqty = (string)$this->wtfdestqty;
         $this->wtfdestm3 = $rs->fields[28] ;  
         $this->wtfdestm3 = (string)$this->wtfdestm3;
         $this->wtfdestvlidated = $rs->fields[29] ;  
         $this->wtfdestvlidated = (string)$this->wtfdestvlidated;
         $this->wtfdestvalidateip = $rs->fields[30] ;  
         $this->wtproducersign = $rs->fields[31] ;  
         $this->wttransportersign = $rs->fields[32] ;  
         $this->wtfdestsign = $rs->fields[33] ;  
         //----- lookup - wtprofilid
         $this->look_wtprofilid = $this->wtprofilid; 
         $this->Lookup->lookup_wtprofilid($this->look_wtprofilid, $this->wtprofilid) ; 
         $this->look_wtprofilid = ($this->look_wtprofilid == "&nbsp;") ? "" : $this->look_wtprofilid; 
         //----- lookup - wtproducerbranchid
         $this->look_wtproducerbranchid = $this->wtproducerbranchid; 
         $this->Lookup->lookup_wtproducerbranchid($this->look_wtproducerbranchid, $this->wtproducerbranchid) ; 
         $this->look_wtproducerbranchid = ($this->look_wtproducerbranchid == "&nbsp;") ? "" : $this->look_wtproducerbranchid; 
         //----- lookup - wtproducerewc
         $this->look_wtproducerewc = $this->wtproducerewc; 
         $this->Lookup->lookup_wtproducerewc($this->look_wtproducerewc, $this->wtproducerewc) ; 
         $this->look_wtproducerewc = ($this->look_wtproducerewc == "&nbsp;") ? "" : $this->look_wtproducerewc; 
         //----- lookup - wtproduceracceptweigth
         $this->look_wtproduceracceptweigth = $this->wtproduceracceptweigth; 
         $this->Lookup->lookup_wtproduceracceptweigth($this->look_wtproduceracceptweigth); 
         $this->look_wtproduceracceptweigth = ($this->look_wtproduceracceptweigth == "&nbsp;") ? "" : $this->look_wtproduceracceptweigth; 
         //----- lookup - wtfdestid
         $this->look_wtfdestid = $this->wtfdestid; 
         $this->Lookup->lookup_wtfdestid($this->look_wtfdestid, $this->wtfdestid) ; 
         $this->look_wtfdestid = ($this->look_wtfdestid == "&nbsp;") ? "" : $this->look_wtfdestid; 
         //----- lookup - ewc2
         $this->look_ewc2 = $this->ewc2; 
         $this->Lookup->lookup_ewc2($this->look_ewc2, $this->ewc2) ; 
         $this->look_ewc2 = ($this->look_ewc2 == "&nbsp;") ? "" : $this->look_ewc2; 
         $this->wtproducersign = "";
         $this->wttransportersign = "";
         $this->wtfdestsign = "";
         $this->sc_proc_grid = true; 
         $_SESSION['scriptcase']['pdfreport_wastetransactions']['contr_erro'] = 'on';
  $this->loadDetails();
$_SESSION['scriptcase']['pdfreport_wastetransactions']['contr_erro'] = 'off'; 
         foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['pdfreport_wastetransactions']['field_order'] as $Cada_col)
         { 
            if (!isset($this->NM_cmp_hidden[$Cada_col]) || $this->NM_cmp_hidden[$Cada_col] != "off")
            { 
                $NM_func_exp = "NM_export_" . $Cada_col;
                $this->$NM_func_exp();
            } 
         } 
         $this->texto_tag .= "</tr>\r\n";
         $rs->MoveNext();
      }
      $this->texto_tag .= "</table>\r\n";

      $rs->Close();
   }
   //----- wtid
   function NM_export_wtid()
   {
         nmgp_Form_Num_Val($this->wtid, $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
         if (!NM_is_utf8($this->wtid))
         {
             $this->wtid = sc_convert_encoding($this->wtid, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wtid = str_replace('<', '&lt;', $this->wtid);
         $this->wtid = str_replace('>', '&gt;', $this->wtid);
         $this->texto_tag .= "<td>" . $this->wtid . "</td>\r\n";
   }
   //----- wtprofilid
   function NM_export_wtprofilid()
   {
         nmgp_Form_Num_Val($this->look_wtprofilid, $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
         if (!NM_is_utf8($this->look_wtprofilid))
         {
             $this->look_wtprofilid = sc_convert_encoding($this->look_wtprofilid, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->look_wtprofilid = str_replace('<', '&lt;', $this->look_wtprofilid);
         $this->look_wtprofilid = str_replace('>', '&gt;', $this->look_wtprofilid);
         $this->texto_tag .= "<td>" . $this->look_wtprofilid . "</td>\r\n";
   }
   //----- intnumber
   function NM_export_intnumber()
   {
         nmgp_Form_Num_Val($this->intnumber, $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
         if (!NM_is_utf8($this->intnumber))
         {
             $this->intnumber = sc_convert_encoding($this->intnumber, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->intnumber = str_replace('<', '&lt;', $this->intnumber);
         $this->intnumber = str_replace('>', '&gt;', $this->intnumber);
         $this->texto_tag .= "<td>" . $this->intnumber . "</td>\r\n";
   }
   //----- wtrequestdate
   function NM_export_wtrequestdate()
   {
         $conteudo_x =  $this->wtrequestdate;
         nm_conv_limpa_dado($conteudo_x, "YYYY-MM-DD");
         if (is_numeric($conteudo_x) && $conteudo_x > 0) 
         { 
             $this->nm_data->SetaData($this->wtrequestdate, "YYYY-MM-DD");
             $this->wtrequestdate = $this->nm_data->FormataSaida($this->nm_data->FormatRegion("DT", "ddmmaaaa"));
         } 
         if (!NM_is_utf8($this->wtrequestdate))
         {
             $this->wtrequestdate = sc_convert_encoding($this->wtrequestdate, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wtrequestdate = str_replace('<', '&lt;', $this->wtrequestdate);
         $this->wtrequestdate = str_replace('>', '&gt;', $this->wtrequestdate);
         $this->texto_tag .= "<td>" . $this->wtrequestdate . "</td>\r\n";
   }
   //----- wtproducerbranchid
   function NM_export_wtproducerbranchid()
   {
         nmgp_Form_Num_Val($this->look_wtproducerbranchid, $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
         if (!NM_is_utf8($this->look_wtproducerbranchid))
         {
             $this->look_wtproducerbranchid = sc_convert_encoding($this->look_wtproducerbranchid, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->look_wtproducerbranchid = str_replace('<', '&lt;', $this->look_wtproducerbranchid);
         $this->look_wtproducerbranchid = str_replace('>', '&gt;', $this->look_wtproducerbranchid);
         $this->texto_tag .= "<td>" . $this->look_wtproducerbranchid . "</td>\r\n";
   }
   //----- wtproducerperiferia
   function NM_export_wtproducerperiferia()
   {
         nmgp_Form_Num_Val($this->wtproducerperiferia, $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
         if (!NM_is_utf8($this->wtproducerperiferia))
         {
             $this->wtproducerperiferia = sc_convert_encoding($this->wtproducerperiferia, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wtproducerperiferia = str_replace('<', '&lt;', $this->wtproducerperiferia);
         $this->wtproducerperiferia = str_replace('>', '&gt;', $this->wtproducerperiferia);
         $this->texto_tag .= "<td>" . $this->wtproducerperiferia . "</td>\r\n";
   }
   //----- wtproducerewc
   function NM_export_wtproducerewc()
   {
         $this->look_wtproducerewc = html_entity_decode($this->look_wtproducerewc, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         if (!NM_is_utf8($this->look_wtproducerewc))
         {
             $this->look_wtproducerewc = sc_convert_encoding($this->look_wtproducerewc, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->look_wtproducerewc = str_replace('<', '&lt;', $this->look_wtproducerewc);
         $this->look_wtproducerewc = str_replace('>', '&gt;', $this->look_wtproducerewc);
         $this->texto_tag .= "<td>" . $this->look_wtproducerewc . "</td>\r\n";
   }
   //----- ewc1
   function NM_export_ewc1()
   {
         $this->ewc1 = html_entity_decode($this->ewc1, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->ewc1 = strip_tags($this->ewc1);
         if (!NM_is_utf8($this->ewc1))
         {
             $this->ewc1 = sc_convert_encoding($this->ewc1, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->ewc1 = str_replace('<', '&lt;', $this->ewc1);
         $this->ewc1 = str_replace('>', '&gt;', $this->ewc1);
         $this->texto_tag .= "<td>" . $this->ewc1 . "</td>\r\n";
   }
   //----- wtproduceracceptweigth
   function NM_export_wtproduceracceptweigth()
   {
         $this->look_wtproduceracceptweigth = html_entity_decode($this->look_wtproduceracceptweigth, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         if (!NM_is_utf8($this->look_wtproduceracceptweigth))
         {
             $this->look_wtproduceracceptweigth = sc_convert_encoding($this->look_wtproduceracceptweigth, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->look_wtproduceracceptweigth = str_replace('<', '&lt;', $this->look_wtproduceracceptweigth);
         $this->look_wtproduceracceptweigth = str_replace('>', '&gt;', $this->look_wtproduceracceptweigth);
         $this->texto_tag .= "<td>" . $this->look_wtproduceracceptweigth . "</td>\r\n";
   }
   //----- wtproducerqty
   function NM_export_wtproducerqty()
   {
         nmgp_Form_Num_Val($this->wtproducerqty, $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "3", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'], $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
         if (!NM_is_utf8($this->wtproducerqty))
         {
             $this->wtproducerqty = sc_convert_encoding($this->wtproducerqty, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wtproducerqty = str_replace('<', '&lt;', $this->wtproducerqty);
         $this->wtproducerqty = str_replace('>', '&gt;', $this->wtproducerqty);
         $this->texto_tag .= "<td>" . $this->wtproducerqty . "</td>\r\n";
   }
   //----- wtprducerm3
   function NM_export_wtprducerm3()
   {
         nmgp_Form_Num_Val($this->wtprducerm3, $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
         if (!NM_is_utf8($this->wtprducerm3))
         {
             $this->wtprducerm3 = sc_convert_encoding($this->wtprducerm3, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wtprducerm3 = str_replace('<', '&lt;', $this->wtprducerm3);
         $this->wtprducerm3 = str_replace('>', '&gt;', $this->wtprducerm3);
         $this->texto_tag .= "<td>" . $this->wtprducerm3 . "</td>\r\n";
   }
   //----- wtproducerremarks
   function NM_export_wtproducerremarks()
   {
         $this->wtproducerremarks = html_entity_decode($this->wtproducerremarks, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->wtproducerremarks = strip_tags($this->wtproducerremarks);
         if (!NM_is_utf8($this->wtproducerremarks))
         {
             $this->wtproducerremarks = sc_convert_encoding($this->wtproducerremarks, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wtproducerremarks = str_replace('<', '&lt;', $this->wtproducerremarks);
         $this->wtproducerremarks = str_replace('>', '&gt;', $this->wtproducerremarks);
         $this->texto_tag .= "<td>" . $this->wtproducerremarks . "</td>\r\n";
   }
   //----- wtproducervalidate
   function NM_export_wtproducervalidate()
   {
         $this->wtproducervalidate = html_entity_decode($this->wtproducervalidate, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->wtproducervalidate = strip_tags($this->wtproducervalidate);
         if (!NM_is_utf8($this->wtproducervalidate))
         {
             $this->wtproducervalidate = sc_convert_encoding($this->wtproducervalidate, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wtproducervalidate = str_replace('<', '&lt;', $this->wtproducervalidate);
         $this->wtproducervalidate = str_replace('>', '&gt;', $this->wtproducervalidate);
         $this->texto_tag .= "<td>" . $this->wtproducervalidate . "</td>\r\n";
   }
   //----- wttransportdate
   function NM_export_wttransportdate()
   {
         $conteudo_x =  $this->wttransportdate;
         nm_conv_limpa_dado($conteudo_x, "YYYY-MM-DD");
         if (is_numeric($conteudo_x) && $conteudo_x > 0) 
         { 
             $this->nm_data->SetaData($this->wttransportdate, "YYYY-MM-DD");
             $this->wttransportdate = $this->nm_data->FormataSaida($this->nm_data->FormatRegion("DT", "ddmmaaaa"));
         } 
         if (!NM_is_utf8($this->wttransportdate))
         {
             $this->wttransportdate = sc_convert_encoding($this->wttransportdate, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wttransportdate = str_replace('<', '&lt;', $this->wttransportdate);
         $this->wttransportdate = str_replace('>', '&gt;', $this->wttransportdate);
         $this->texto_tag .= "<td>" . $this->wttransportdate . "</td>\r\n";
   }
   //----- wttransporterid
   function NM_export_wttransporterid()
   {
         nmgp_Form_Num_Val($this->wttransporterid, $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
         if (!NM_is_utf8($this->wttransporterid))
         {
             $this->wttransporterid = sc_convert_encoding($this->wttransporterid, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wttransporterid = str_replace('<', '&lt;', $this->wttransporterid);
         $this->wttransporterid = str_replace('>', '&gt;', $this->wttransporterid);
         $this->texto_tag .= "<td>" . $this->wttransporterid . "</td>\r\n";
   }
   //----- wttransporterperiferiaid
   function NM_export_wttransporterperiferiaid()
   {
         nmgp_Form_Num_Val($this->wttransporterperiferiaid, $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
         if (!NM_is_utf8($this->wttransporterperiferiaid))
         {
             $this->wttransporterperiferiaid = sc_convert_encoding($this->wttransporterperiferiaid, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wttransporterperiferiaid = str_replace('<', '&lt;', $this->wttransporterperiferiaid);
         $this->wttransporterperiferiaid = str_replace('>', '&gt;', $this->wttransporterperiferiaid);
         $this->texto_tag .= "<td>" . $this->wttransporterperiferiaid . "</td>\r\n";
   }
   //----- wttransporterewc
   function NM_export_wttransporterewc()
   {
         $this->wttransporterewc = html_entity_decode($this->wttransporterewc, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->wttransporterewc = strip_tags($this->wttransporterewc);
         if (!NM_is_utf8($this->wttransporterewc))
         {
             $this->wttransporterewc = sc_convert_encoding($this->wttransporterewc, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wttransporterewc = str_replace('<', '&lt;', $this->wttransporterewc);
         $this->wttransporterewc = str_replace('>', '&gt;', $this->wttransporterewc);
         $this->texto_tag .= "<td>" . $this->wttransporterewc . "</td>\r\n";
   }
   //----- wttransportervechicle
   function NM_export_wttransportervechicle()
   {
         $this->wttransportervechicle = html_entity_decode($this->wttransportervechicle, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->wttransportervechicle = strip_tags($this->wttransportervechicle);
         if (!NM_is_utf8($this->wttransportervechicle))
         {
             $this->wttransportervechicle = sc_convert_encoding($this->wttransportervechicle, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wttransportervechicle = str_replace('<', '&lt;', $this->wttransportervechicle);
         $this->wttransportervechicle = str_replace('>', '&gt;', $this->wttransportervechicle);
         $this->texto_tag .= "<td>" . $this->wttransportervechicle . "</td>\r\n";
   }
   //----- wttransportervalidate
   function NM_export_wttransportervalidate()
   {
         $this->wttransportervalidate = html_entity_decode($this->wttransportervalidate, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->wttransportervalidate = strip_tags($this->wttransportervalidate);
         if (!NM_is_utf8($this->wttransportervalidate))
         {
             $this->wttransportervalidate = sc_convert_encoding($this->wttransportervalidate, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wttransportervalidate = str_replace('<', '&lt;', $this->wttransportervalidate);
         $this->wttransportervalidate = str_replace('>', '&gt;', $this->wttransportervalidate);
         $this->texto_tag .= "<td>" . $this->wttransportervalidate . "</td>\r\n";
   }
   //----- wttransportervalidateip
   function NM_export_wttransportervalidateip()
   {
         $this->wttransportervalidateip = html_entity_decode($this->wttransportervalidateip, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->wttransportervalidateip = strip_tags($this->wttransportervalidateip);
         if (!NM_is_utf8($this->wttransportervalidateip))
         {
             $this->wttransportervalidateip = sc_convert_encoding($this->wttransportervalidateip, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wttransportervalidateip = str_replace('<', '&lt;', $this->wttransportervalidateip);
         $this->wttransportervalidateip = str_replace('>', '&gt;', $this->wttransportervalidateip);
         $this->texto_tag .= "<td>" . $this->wttransportervalidateip . "</td>\r\n";
   }
   //----- wttransporternumberid
   function NM_export_wttransporternumberid()
   {
         $this->wttransporternumberid = html_entity_decode($this->wttransporternumberid, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->wttransporternumberid = strip_tags($this->wttransporternumberid);
         if (!NM_is_utf8($this->wttransporternumberid))
         {
             $this->wttransporternumberid = sc_convert_encoding($this->wttransporternumberid, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wttransporternumberid = str_replace('<', '&lt;', $this->wttransporternumberid);
         $this->wttransporternumberid = str_replace('>', '&gt;', $this->wttransporternumberid);
         $this->texto_tag .= "<td>" . $this->wttransporternumberid . "</td>\r\n";
   }
   //----- wtfdestdate
   function NM_export_wtfdestdate()
   {
         $conteudo_x =  $this->wtfdestdate;
         nm_conv_limpa_dado($conteudo_x, "YYYY-MM-DD");
         if (is_numeric($conteudo_x) && $conteudo_x > 0) 
         { 
             $this->nm_data->SetaData($this->wtfdestdate, "YYYY-MM-DD");
             $this->wtfdestdate = $this->nm_data->FormataSaida($this->nm_data->FormatRegion("DT", "ddmmaaaa"));
         } 
         if (!NM_is_utf8($this->wtfdestdate))
         {
             $this->wtfdestdate = sc_convert_encoding($this->wtfdestdate, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wtfdestdate = str_replace('<', '&lt;', $this->wtfdestdate);
         $this->wtfdestdate = str_replace('>', '&gt;', $this->wtfdestdate);
         $this->texto_tag .= "<td>" . $this->wtfdestdate . "</td>\r\n";
   }
   //----- wtfdestid
   function NM_export_wtfdestid()
   {
         nmgp_Form_Num_Val($this->look_wtfdestid, $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
         if (!NM_is_utf8($this->look_wtfdestid))
         {
             $this->look_wtfdestid = sc_convert_encoding($this->look_wtfdestid, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->look_wtfdestid = str_replace('<', '&lt;', $this->look_wtfdestid);
         $this->look_wtfdestid = str_replace('>', '&gt;', $this->look_wtfdestid);
         $this->texto_tag .= "<td>" . $this->look_wtfdestid . "</td>\r\n";
   }
   //----- wtfdestperiferia
   function NM_export_wtfdestperiferia()
   {
         nmgp_Form_Num_Val($this->wtfdestperiferia, $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
         if (!NM_is_utf8($this->wtfdestperiferia))
         {
             $this->wtfdestperiferia = sc_convert_encoding($this->wtfdestperiferia, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wtfdestperiferia = str_replace('<', '&lt;', $this->wtfdestperiferia);
         $this->wtfdestperiferia = str_replace('>', '&gt;', $this->wtfdestperiferia);
         $this->texto_tag .= "<td>" . $this->wtfdestperiferia . "</td>\r\n";
   }
   //----- wtfdestewc
   function NM_export_wtfdestewc()
   {
         $this->wtfdestewc = html_entity_decode($this->wtfdestewc, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->wtfdestewc = strip_tags($this->wtfdestewc);
         if (!NM_is_utf8($this->wtfdestewc))
         {
             $this->wtfdestewc = sc_convert_encoding($this->wtfdestewc, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wtfdestewc = str_replace('<', '&lt;', $this->wtfdestewc);
         $this->wtfdestewc = str_replace('>', '&gt;', $this->wtfdestewc);
         $this->texto_tag .= "<td>" . $this->wtfdestewc . "</td>\r\n";
   }
   //----- ewc2
   function NM_export_ewc2()
   {
         $this->look_ewc2 = html_entity_decode($this->look_ewc2, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         if (!NM_is_utf8($this->look_ewc2))
         {
             $this->look_ewc2 = sc_convert_encoding($this->look_ewc2, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->look_ewc2 = str_replace('<', '&lt;', $this->look_ewc2);
         $this->look_ewc2 = str_replace('>', '&gt;', $this->look_ewc2);
         $this->texto_tag .= "<td>" . $this->look_ewc2 . "</td>\r\n";
   }
   //----- wtfdestrd
   function NM_export_wtfdestrd()
   {
         $this->wtfdestrd = html_entity_decode($this->wtfdestrd, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->wtfdestrd = strip_tags($this->wtfdestrd);
         if (!NM_is_utf8($this->wtfdestrd))
         {
             $this->wtfdestrd = sc_convert_encoding($this->wtfdestrd, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wtfdestrd = str_replace('<', '&lt;', $this->wtfdestrd);
         $this->wtfdestrd = str_replace('>', '&gt;', $this->wtfdestrd);
         $this->texto_tag .= "<td>" . $this->wtfdestrd . "</td>\r\n";
   }
   //----- wtfdestqty
   function NM_export_wtfdestqty()
   {
         nmgp_Form_Num_Val($this->wtfdestqty, $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "3", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'], $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
         if (!NM_is_utf8($this->wtfdestqty))
         {
             $this->wtfdestqty = sc_convert_encoding($this->wtfdestqty, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wtfdestqty = str_replace('<', '&lt;', $this->wtfdestqty);
         $this->wtfdestqty = str_replace('>', '&gt;', $this->wtfdestqty);
         $this->texto_tag .= "<td>" . $this->wtfdestqty . "</td>\r\n";
   }
   //----- wtfdestm3
   function NM_export_wtfdestm3()
   {
         nmgp_Form_Num_Val($this->wtfdestm3, $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
         if (!NM_is_utf8($this->wtfdestm3))
         {
             $this->wtfdestm3 = sc_convert_encoding($this->wtfdestm3, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wtfdestm3 = str_replace('<', '&lt;', $this->wtfdestm3);
         $this->wtfdestm3 = str_replace('>', '&gt;', $this->wtfdestm3);
         $this->texto_tag .= "<td>" . $this->wtfdestm3 . "</td>\r\n";
   }
   //----- wtfdestvlidated
   function NM_export_wtfdestvlidated()
   {
         $this->wtfdestvlidated = html_entity_decode($this->wtfdestvlidated, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->wtfdestvlidated = strip_tags($this->wtfdestvlidated);
         if (!NM_is_utf8($this->wtfdestvlidated))
         {
             $this->wtfdestvlidated = sc_convert_encoding($this->wtfdestvlidated, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wtfdestvlidated = str_replace('<', '&lt;', $this->wtfdestvlidated);
         $this->wtfdestvlidated = str_replace('>', '&gt;', $this->wtfdestvlidated);
         $this->texto_tag .= "<td>" . $this->wtfdestvlidated . "</td>\r\n";
   }
   //----- wtfdestvalidateip
   function NM_export_wtfdestvalidateip()
   {
         $this->wtfdestvalidateip = html_entity_decode($this->wtfdestvalidateip, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->wtfdestvalidateip = strip_tags($this->wtfdestvalidateip);
         if (!NM_is_utf8($this->wtfdestvalidateip))
         {
             $this->wtfdestvalidateip = sc_convert_encoding($this->wtfdestvalidateip, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wtfdestvalidateip = str_replace('<', '&lt;', $this->wtfdestvalidateip);
         $this->wtfdestvalidateip = str_replace('>', '&gt;', $this->wtfdestvalidateip);
         $this->texto_tag .= "<td>" . $this->wtfdestvalidateip . "</td>\r\n";
   }
   //----- wtproducersign
   function NM_export_wtproducersign()
   {
         if (!NM_is_utf8($this->wtproducersign))
         {
             $this->wtproducersign = sc_convert_encoding($this->wtproducersign, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wtproducersign = str_replace('<', '&lt;', $this->wtproducersign);
         $this->wtproducersign = str_replace('>', '&gt;', $this->wtproducersign);
         $this->texto_tag .= "<td>" . $this->wtproducersign . "</td>\r\n";
   }
   //----- wttransportersign
   function NM_export_wttransportersign()
   {
         if (!NM_is_utf8($this->wttransportersign))
         {
             $this->wttransportersign = sc_convert_encoding($this->wttransportersign, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wttransportersign = str_replace('<', '&lt;', $this->wttransportersign);
         $this->wttransportersign = str_replace('>', '&gt;', $this->wttransportersign);
         $this->texto_tag .= "<td>" . $this->wttransportersign . "</td>\r\n";
   }
   //----- wtfdestsign
   function NM_export_wtfdestsign()
   {
         if (!NM_is_utf8($this->wtfdestsign))
         {
             $this->wtfdestsign = sc_convert_encoding($this->wtfdestsign, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wtfdestsign = str_replace('<', '&lt;', $this->wtfdestsign);
         $this->wtfdestsign = str_replace('>', '&gt;', $this->wtfdestsign);
         $this->texto_tag .= "<td>" . $this->wtfdestsign . "</td>\r\n";
   }
   //----- email
   function NM_export_email()
   {
         $this->email = html_entity_decode($this->email, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->email = strip_tags($this->email);
         if (!NM_is_utf8($this->email))
         {
             $this->email = sc_convert_encoding($this->email, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->email = str_replace('<', '&lt;', $this->email);
         $this->email = str_replace('>', '&gt;', $this->email);
         $this->texto_tag .= "<td>" . $this->email . "</td>\r\n";
   }
   //----- envregistrationno
   function NM_export_envregistrationno()
   {
         $this->envregistrationno = html_entity_decode($this->envregistrationno, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->envregistrationno = strip_tags($this->envregistrationno);
         if (!NM_is_utf8($this->envregistrationno))
         {
             $this->envregistrationno = sc_convert_encoding($this->envregistrationno, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->envregistrationno = str_replace('<', '&lt;', $this->envregistrationno);
         $this->envregistrationno = str_replace('>', '&gt;', $this->envregistrationno);
         $this->texto_tag .= "<td>" . $this->envregistrationno . "</td>\r\n";
   }
   //----- fdestaddress
   function NM_export_fdestaddress()
   {
         $this->fdestaddress = html_entity_decode($this->fdestaddress, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->fdestaddress = strip_tags($this->fdestaddress);
         if (!NM_is_utf8($this->fdestaddress))
         {
             $this->fdestaddress = sc_convert_encoding($this->fdestaddress, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->fdestaddress = str_replace('<', '&lt;', $this->fdestaddress);
         $this->fdestaddress = str_replace('>', '&gt;', $this->fdestaddress);
         $this->texto_tag .= "<td>" . $this->fdestaddress . "</td>\r\n";
   }
   //----- fdestaepo
   function NM_export_fdestaepo()
   {
         $this->fdestaepo = html_entity_decode($this->fdestaepo, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->fdestaepo = strip_tags($this->fdestaepo);
         if (!NM_is_utf8($this->fdestaepo))
         {
             $this->fdestaepo = sc_convert_encoding($this->fdestaepo, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->fdestaepo = str_replace('<', '&lt;', $this->fdestaepo);
         $this->fdestaepo = str_replace('>', '&gt;', $this->fdestaepo);
         $this->texto_tag .= "<td>" . $this->fdestaepo . "</td>\r\n";
   }
   //----- fdestphone
   function NM_export_fdestphone()
   {
         $this->fdestphone = html_entity_decode($this->fdestphone, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->fdestphone = strip_tags($this->fdestphone);
         if (!NM_is_utf8($this->fdestphone))
         {
             $this->fdestphone = sc_convert_encoding($this->fdestphone, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->fdestphone = str_replace('<', '&lt;', $this->fdestphone);
         $this->fdestphone = str_replace('>', '&gt;', $this->fdestphone);
         $this->texto_tag .= "<td>" . $this->fdestphone . "</td>\r\n";
   }
   //----- fdestrespone
   function NM_export_fdestrespone()
   {
         $this->fdestrespone = html_entity_decode($this->fdestrespone, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->fdestrespone = strip_tags($this->fdestrespone);
         if (!NM_is_utf8($this->fdestrespone))
         {
             $this->fdestrespone = sc_convert_encoding($this->fdestrespone, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->fdestrespone = str_replace('<', '&lt;', $this->fdestrespone);
         $this->fdestrespone = str_replace('>', '&gt;', $this->fdestrespone);
         $this->texto_tag .= "<td>" . $this->fdestrespone . "</td>\r\n";
   }
   //----- fdestresponseemail
   function NM_export_fdestresponseemail()
   {
         $this->fdestresponseemail = html_entity_decode($this->fdestresponseemail, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->fdestresponseemail = strip_tags($this->fdestresponseemail);
         if (!NM_is_utf8($this->fdestresponseemail))
         {
             $this->fdestresponseemail = sc_convert_encoding($this->fdestresponseemail, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->fdestresponseemail = str_replace('<', '&lt;', $this->fdestresponseemail);
         $this->fdestresponseemail = str_replace('>', '&gt;', $this->fdestresponseemail);
         $this->texto_tag .= "<td>" . $this->fdestresponseemail . "</td>\r\n";
   }
   //----- phone
   function NM_export_phone()
   {
         $this->phone = html_entity_decode($this->phone, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->phone = strip_tags($this->phone);
         if (!NM_is_utf8($this->phone))
         {
             $this->phone = sc_convert_encoding($this->phone, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->phone = str_replace('<', '&lt;', $this->phone);
         $this->phone = str_replace('>', '&gt;', $this->phone);
         $this->texto_tag .= "<td>" . $this->phone . "</td>\r\n";
   }
   //----- produceraepo
   function NM_export_produceraepo()
   {
         $this->produceraepo = html_entity_decode($this->produceraepo, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->produceraepo = strip_tags($this->produceraepo);
         if (!NM_is_utf8($this->produceraepo))
         {
             $this->produceraepo = sc_convert_encoding($this->produceraepo, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->produceraepo = str_replace('<', '&lt;', $this->produceraepo);
         $this->produceraepo = str_replace('>', '&gt;', $this->produceraepo);
         $this->texto_tag .= "<td>" . $this->produceraepo . "</td>\r\n";
   }
   //----- producerb_address
   function NM_export_producerb_address()
   {
         $this->producerb_address = html_entity_decode($this->producerb_address, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->producerb_address = strip_tags($this->producerb_address);
         if (!NM_is_utf8($this->producerb_address))
         {
             $this->producerb_address = sc_convert_encoding($this->producerb_address, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->producerb_address = str_replace('<', '&lt;', $this->producerb_address);
         $this->producerb_address = str_replace('>', '&gt;', $this->producerb_address);
         $this->texto_tag .= "<td>" . $this->producerb_address . "</td>\r\n";
   }
   //----- responsename
   function NM_export_responsename()
   {
         $this->responsename = html_entity_decode($this->responsename, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         $this->responsename = strip_tags($this->responsename);
         if (!NM_is_utf8($this->responsename))
         {
             $this->responsename = sc_convert_encoding($this->responsename, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->responsename = str_replace('<', '&lt;', $this->responsename);
         $this->responsename = str_replace('>', '&gt;', $this->responsename);
         $this->texto_tag .= "<td>" . $this->responsename . "</td>\r\n";
   }
   //----- wttransporterresponse
   function NM_export_wttransporterresponse()
   {
         $this->wttransporterresponse = html_entity_decode($this->wttransporterresponse, ENT_COMPAT, $_SESSION['scriptcase']['charset']);
         if (!NM_is_utf8($this->wttransporterresponse))
         {
             $this->wttransporterresponse = sc_convert_encoding($this->wttransporterresponse, "UTF-8", $_SESSION['scriptcase']['charset']);
         }
         $this->wttransporterresponse = str_replace('<', '&lt;', $this->wttransporterresponse);
         $this->wttransporterresponse = str_replace('>', '&gt;', $this->wttransporterresponse);
         $this->texto_tag .= "<td>" . $this->wttransporterresponse . "</td>\r\n";
   }

   //----- 
   function grava_arquivo_rtf()
   {
      global $nm_lang, $doc_wrap;
      $rtf_f = fopen($this->Ini->root . $this->Ini->path_imag_temp . "/" . $this->arquivo, "w");
      require_once($this->Ini->path_third      . "/rtf_new/document_generator/cl_xml2driver.php"); 
      $text_ok  =  "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n"; 
      $text_ok .=  "<DOC config_file=\"" . $this->Ini->path_third . "/rtf_new/doc_config.inc\" >\r\n"; 
      $text_ok .=  $this->texto_tag; 
      $text_ok .=  "</DOC>\r\n"; 
      $xml = new nDOCGEN($text_ok,"RTF"); 
      fwrite($rtf_f, $xml->get_result_file());
      fclose($rtf_f);
   }

   function nm_conv_data_db($dt_in, $form_in, $form_out)
   {
       $dt_out = $dt_in;
       if (strtoupper($form_in) == "DB_FORMAT")
       {
           if ($dt_out == "null" || $dt_out == "")
           {
               $dt_out = "";
               return $dt_out;
           }
           $form_in = "AAAA-MM-DD";
       }
       if (strtoupper($form_out) == "DB_FORMAT")
       {
           if (empty($dt_out))
           {
               $dt_out = "null";
               return $dt_out;
           }
           $form_out = "AAAA-MM-DD";
       }
       nm_conv_form_data($dt_out, $form_in, $form_out);
       return $dt_out;
   }
   //---- 
   function monta_html()
   {
      global $nm_url_saida, $nm_lang;
      include($this->Ini->path_btn . $this->Ini->Str_btn_grid);
      unset($_SESSION['sc_session'][$this->Ini->sc_page]['pdfreport_wastetransactions']['rtf_file']);
      if (is_file($this->Ini->root . $this->Ini->path_imag_temp . "/" . $this->arquivo))
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['pdfreport_wastetransactions']['rtf_file'] = $this->Ini->root . $this->Ini->path_imag_temp . "/" . $this->arquivo;
      }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'] ?>>
<HEAD>
 <TITLE><?php echo $this->Ini->Nm_lang['lang_othr_grid_titl'] ?> - wastetransactions :: RTF</TITLE>
 <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'] ?>" />
<?php
if ($_SESSION['scriptcase']['proc_mobile'])
{
?>
  <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<?php
}
?>
  <META http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT"/>
  <META http-equiv="Last-Modified" content="<?php echo gmdate("D, d M Y H:i:s"); ?> GMT"/>
  <META http-equiv="Cache-Control" content="no-store, no-cache, must-revalidate"/>
  <META http-equiv="Cache-Control" content="post-check=0, pre-check=0"/>
  <META http-equiv="Pragma" content="no-cache"/>
  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export.css" /> 
  <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_export<?php echo $_SESSION['scriptcase']['reg_conf']['css_dir'] ?>.css" /> 
  <link rel="stylesheet" type="text/css" href="../_lib/buttons/<?php echo $this->Ini->Str_btn_css ?>" /> 
</HEAD>
<BODY class="scExportPage">
<?php echo $this->Ini->Ajax_result_set ?>
<table style="border-collapse: collapse; border-width: 0; height: 100%; width: 100%"><tr><td style="padding: 0; text-align: center; vertical-align: middle">
 <table class="scExportTable" align="center">
  <tr>
   <td class="scExportTitle" style="height: 25px">RTF</td>
  </tr>
  <tr>
   <td class="scExportLine" style="width: 100%">
    <table style="border-collapse: collapse; border-width: 0; width: 100%"><tr><td class="scExportLineFont" style="padding: 3px 0 0 0" id="idMessage">
    <?php echo $this->Ini->Nm_lang['lang_othr_file_msge'] ?>
    </td><td class="scExportLineFont" style="text-align:right; padding: 3px 0 0 0">
     <?php echo nmButtonOutput($this->arr_buttons, "bexportview", "document.Fview.submit()", "document.Fview.submit()", "idBtnView", "", "", "", "", "", "", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "");
 ?>
     <?php echo nmButtonOutput($this->arr_buttons, "bdownload", "document.Fdown.submit()", "document.Fdown.submit()", "idBtnDown", "", "", "", "", "", "", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "");
 ?>
     <?php echo nmButtonOutput($this->arr_buttons, "bvoltar", "document.F0.submit()", "document.F0.submit()", "idBtnBack", "", "", "", "", "", "", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "", "", "");
 ?>
    </td></tr></table>
   </td>
  </tr>
 </table>
</td></tr></table>
<form name="Fview" method="get" action="<?php echo $this->Ini->path_imag_temp . "/" . $this->arquivo ?>" target="_blank" style="display: none"> 
</form>
<form name="Fdown" method="get" action="pdfreport_wastetransactions_download.php" target="_blank" style="display: none"> 
<input type="hidden" name="nm_tit_doc" value="<?php echo NM_encode_input($this->tit_doc); ?>"> 
<input type="hidden" name="nm_name_doc" value="<?php echo NM_encode_input($this->Ini->path_imag_temp . "/" . $this->arquivo) ?>"> 
</form>
<FORM name="F0" method=post action="./"> 
<INPUT type="hidden" name="script_case_init" value="<?php echo NM_encode_input($this->Ini->sc_page); ?>"> 
<INPUT type="hidden" name="script_case_session" value="<?php echo NM_encode_input(session_id()); ?>"> 
<INPUT type="hidden" name="nmgp_opcao" value="volta_grid"> 
</FORM> 
</BODY>
</HTML>
<?php
   }
   function nm_gera_mask(&$nm_campo, $nm_mask)
   { 
      $trab_campo = $nm_campo;
      $trab_mask  = $nm_mask;
      $tam_campo  = strlen($nm_campo);
      $trab_saida = "";
      $mask_num = false;
      for ($x=0; $x < strlen($trab_mask); $x++)
      {
          if (substr($trab_mask, $x, 1) == "#")
          {
              $mask_num = true;
              break;
          }
      }
      if ($mask_num )
      {
          $ver_duas = explode(";", $trab_mask);
          if (isset($ver_duas[1]) && !empty($ver_duas[1]))
          {
              $cont1 = count(explode("#", $ver_duas[0])) - 1;
              $cont2 = count(explode("#", $ver_duas[1])) - 1;
              if ($cont2 >= $tam_campo)
              {
                  $trab_mask = $ver_duas[1];
              }
              else
              {
                  $trab_mask = $ver_duas[0];
              }
          }
          $tam_mask = strlen($trab_mask);
          $xdados = 0;
          for ($x=0; $x < $tam_mask; $x++)
          {
              if (substr($trab_mask, $x, 1) == "#" && $xdados < $tam_campo)
              {
                  $trab_saida .= substr($trab_campo, $xdados, 1);
                  $xdados++;
              }
              elseif ($xdados < $tam_campo)
              {
                  $trab_saida .= substr($trab_mask, $x, 1);
              }
          }
          if ($xdados < $tam_campo)
          {
              $trab_saida .= substr($trab_campo, $xdados);
          }
          $nm_campo = $trab_saida;
          return;
      }
      for ($ix = strlen($trab_mask); $ix > 0; $ix--)
      {
           $char_mask = substr($trab_mask, $ix - 1, 1);
           if ($char_mask != "x" && $char_mask != "z")
           {
               $trab_saida = $char_mask . $trab_saida;
           }
           else
           {
               if ($tam_campo != 0)
               {
                   $trab_saida = substr($trab_campo, $tam_campo - 1, 1) . $trab_saida;
                   $tam_campo--;
               }
               else
               {
                   $trab_saida = "0" . $trab_saida;
               }
           }
      }
      if ($tam_campo != 0)
      {
          $trab_saida = substr($trab_campo, 0, $tam_campo) . $trab_saida;
          $trab_mask  = str_repeat("z", $tam_campo) . $trab_mask;
      }
   
      $iz = 0; 
      for ($ix = 0; $ix < strlen($trab_mask); $ix++)
      {
           $char_mask = substr($trab_mask, $ix, 1);
           if ($char_mask != "x" && $char_mask != "z")
           {
               if ($char_mask == "." || $char_mask == ",")
               {
                   $trab_saida = substr($trab_saida, 0, $iz) . substr($trab_saida, $iz + 1);
               }
               else
               {
                   $iz++;
               }
           }
           elseif ($char_mask == "x" || substr($trab_saida, $iz, 1) != "0")
           {
               $ix = strlen($trab_mask) + 1;
           }
           else
           {
               $trab_saida = substr($trab_saida, 0, $iz) . substr($trab_saida, $iz + 1);
           }
      }
      $nm_campo = $trab_saida;
   } 
function loadDetails()
{
$_SESSION['scriptcase']['pdfreport_wastetransactions']['contr_erro'] = 'on';
   



$check_sql = "SELECT Response,ResponsePhone,email,ENV_RegNo,ResponseFax "
  . " FROM transporter"
 . " WHERE TransporterID = '" . $this->wttransporterid  . "'";
 
      $nm_select = $check_sql; 
      $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_select; 
      $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
      $this->rs = array();
      if ($rx = $this->Db->Execute($nm_select)) 
      { 
          $y = 0; 
          $nm_count = $rx->FieldCount();
          while (!$rx->EOF)
          { 
                 for ($x = 0; $x < $nm_count; $x++)
                 { 
                        $this->rs[$y] [$x] = $rx->fields[$x];
                 }
                 $y++; 
                 $rx->MoveNext();
          } 
          $rx->Close();
      } 
      elseif (isset($GLOBALS["NM_ERRO_IBASE"]) && $GLOBALS["NM_ERRO_IBASE"] != 1)  
      { 
          $this->rs = false;
          $this->rs_erro = $this->Db->ErrorMsg();
      } 
;

if (isset($this->rs[0][0]))     
{
  $this->wttransporterresponse  = $this->rs[0][0];




}
		else     
{
	$transporterresponse  = '';




}


$check_sql = "SELECT Address, ResponseName,Phone,email,Periferia,AEPO "
  . " FROM producerbranch"
 . " WHERE PrBID = '" . $this->wtproducerbranchid  . "'";
 
      $nm_select = $check_sql; 
      $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_select; 
      $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
      $this->rs = array();
      if ($rx = $this->Db->Execute($nm_select)) 
      { 
          $y = 0; 
          $nm_count = $rx->FieldCount();
          while (!$rx->EOF)
          { 
                 for ($x = 0; $x < $nm_count; $x++)
                 { 
                        $this->rs[$y] [$x] = $rx->fields[$x];
                 }
                 $y++; 
                 $rx->MoveNext();
          } 
          $rx->Close();
      } 
      elseif (isset($GLOBALS["NM_ERRO_IBASE"]) && $GLOBALS["NM_ERRO_IBASE"] != 1)  
      { 
          $this->rs = false;
          $this->rs_erro = $this->Db->ErrorMsg();
      } 
;

if (isset($this->rs[0][0]))     
{
  $this->producerb_address  = $this->rs[0][0];
  $this->responsename  = $this->rs[0][1];
$this->phone  = $this->rs[0][2];
$this->email  = $this->rs[0][3];
$this->produceraepo  = $this->rs[0][5];
}
		else     
{
	$this->producerb_address  = '......';
   $this->responsename  = '';
	$this->phone  = '';
	$this->email  = '';
	$this->produceraepo  = '';
}




$check_sql = "SELECT Address, ResponseName,Phone,email,Periferia,AEPO,EnvRegistrationNo "
   . " FROM fdestbranch "
   . " WHERE PrBID = '" . $this->wtfdestid  . "'";
 
      $nm_select = $check_sql; 
      $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_select; 
      $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
      $this->rs = array();
      if ($rx = $this->Db->Execute($nm_select)) 
      { 
          $y = 0; 
          $nm_count = $rx->FieldCount();
          while (!$rx->EOF)
          { 
                 for ($x = 0; $x < $nm_count; $x++)
                 { 
                        $this->rs[$y] [$x] = $rx->fields[$x];
                 }
                 $y++; 
                 $rx->MoveNext();
          } 
          $rx->Close();
      } 
      elseif (isset($GLOBALS["NM_ERRO_IBASE"]) && $GLOBALS["NM_ERRO_IBASE"] != 1)  
      { 
          $this->rs = false;
          $this->rs_erro = $this->Db->ErrorMsg();
      } 
;

if (isset($this->rs[0][0]))     
{
   $this->fdestaddress  = $this->rs[0][0];
  $this->fdestrespone  = $this->rs[0][1];
   $this->fdestphone  = $this->rs[0][2];
	$this->fdestresponseemail  = $this->rs[0][3];
	$this->fdestaepo  = $this->rs[0][5];
	$this->envregistrationno  = $this->rs[0][6];
}
		else     
{
$this->fdestaddress  = '';
$this->fdestrespone  = '';
$this->fdestphone  = '';
$this->fdestresponseemail  = '';
$this->fdestaepo   = '';
$this->envregistrationno ='';
}
$_SESSION['scriptcase']['pdfreport_wastetransactions']['contr_erro'] = 'off';
}
}

?>
