<?php
//
class validate_wastetransactions_mob_apl
{
   var $has_where_params = false;
   var $NM_is_redirected = false;
   var $NM_non_ajax_info = false;
   var $NM_ajax_flag    = false;
   var $NM_ajax_opcao   = '';
   var $NM_ajax_retorno = '';
   var $NM_ajax_info    = array('result'         => '',
                                'param'          => array(),
                                'autoComp'       => '',
                                'rsSize'         => '',
                                'msgDisplay'     => '',
                                'errList'        => array(),
                                'fldList'        => array(),
                                'focus'          => '',
                                'navStatus'      => array(),
                                'navSummary'     => array(),
                                'redir'          => array(),
                                'blockDisplay'   => array(),
                                'fieldDisplay'   => array(),
                                'fieldLabel'     => array(),
                                'readOnly'       => array(),
                                'btnVars'        => array(),
                                'ajaxAlert'      => '',
                                'ajaxMessage'    => '',
                                'ajaxJavascript' => array(),
                                'buttonDisplay'  => array(),
                                'calendarReload' => false,
                                'quickSearchRes' => false,
                                'displayMsg'     => false,
                                'displayMsgTxt'  => '',
                                'dyn_search'     => array(),
                                'empty_filter'   => '',
                               );
   var $Nav_permite_ava     = true;
   var $Nav_permite_ret     = true;
   var $Apl_com_erro        = false;
   var $app_is_initializing = false;
   var $Ini;
   var $Erro;
   var $Db;
   var $wtid;
   var $wtprofilid;
   var $intnumber;
   var $wtrequestdate;
   var $wtproducerbranchid;
   var $wtproducerbranchid_1;
   var $wtproducerperiferia;
   var $wtproducerperiferia_1;
   var $wtproduceracceptweigth;
   var $wtproduceracceptweigth_1;
   var $wtproducerewc;
   var $wtproducerewc_1;
   var $wtproducerqty;
   var $wtprducerm3;
   var $wtproducerremarks;
   var $wttransportdate;
   var $wtproducervalidate;
   var $wttransporterid;
   var $wttransporterid_1;
   var $wttransporterperiferiaid;
   var $wttransporterewc;
   var $wttransportervechicle;
   var $wttransportervalidate;
   var $wttransportervalidate_1;
   var $wttransportervalidateip;
   var $envregistrationno_transporter;
   var $wttransporternumberid;
   var $wtwasteid;
   var $wtwasteid_1;
   var $wtequipment;
   var $wtequipment_1;
   var $wtfdestdate;
   var $wtfdestid;
   var $wtfdestid_1;
   var $wtfdestperiferia;
   var $wtfdestperiferia_1;
   var $wtfdestewc;
   var $wtfdestewc_1;
   var $wtfdestrd;
   var $wtfdestrd_1;
   var $wtfdestqty;
   var $wtfdestm3;
   var $wtfdestvlidated;
   var $wtfdestvalidateip;
   var $envregistrationno_fdest;
   var $wttransportersign;
   var $wttransportersign_scfile_name;
   var $wttransportersign_ul_name;
   var $wttransportersign_scfile_type;
   var $wttransportersign_ul_type;
   var $wttransportersign_limpa;
   var $wttransportersign_salva;
   var $out_wttransportersign;
   var $out1_wttransportersign;
   var $wtproducersign;
   var $wtproducersign_scfile_name;
   var $wtproducersign_ul_name;
   var $wtproducersign_scfile_type;
   var $wtproducersign_ul_type;
   var $wtproducersign_limpa;
   var $wtproducersign_salva;
   var $out_wtproducersign;
   var $out1_wtproducersign;
   var $wtfdestsign;
   var $wtfdestsign_scfile_name;
   var $wtfdestsign_ul_name;
   var $wtfdestsign_scfile_type;
   var $wtfdestsign_ul_type;
   var $wtfdestsign_limpa;
   var $wtfdestsign_salva;
   var $out_wtfdestsign;
   var $out1_wtfdestsign;
   var $checktransvsproducer;
   var $checktransportervsfdest;
   var $ewctitle;
   var $fdewctitle;
   var $fdestaddress;
   var $fdestphone;
   var $fdestrespone;
   var $fdestresponseemail;
   var $pphone;
   var $premail;
   var $prbrresponse;
   var $producerb_address;
   var $transporteremail;
   var $transporterfax;
   var $transporterphone;
   var $transporterregno;
   var $transporterresponse;
   var $nm_data;
   var $nmgp_opcao;
   var $nmgp_opc_ant;
   var $sc_evento;
   var $sc_insert_on;
   var $nmgp_clone;
   var $nmgp_return_img = array();
   var $nmgp_dados_form = array();
   var $nmgp_dados_select = array();
   var $nm_location;
   var $nm_flag_iframe;
   var $nm_flag_saida_novo;
   var $nmgp_botoes = array();
   var $nmgp_url_saida;
   var $nmgp_form_show;
   var $nmgp_form_empty;
   var $nmgp_cmp_readonly = array();
   var $nmgp_cmp_hidden = array();
   var $form_paginacao = 'parcial';
   var $lig_edit_lookup      = false;
   var $lig_edit_lookup_call = false;
   var $lig_edit_lookup_cb   = '';
   var $lig_edit_lookup_row  = '';
   var $is_calendar_app = false;
   var $Embutida_call  = false;
   var $Embutida_ronly = false;
   var $Embutida_proc  = false;
   var $Embutida_form  = false;
   var $Grid_editavel  = false;
   var $url_webhelp = '';
   var $nm_todas_criticas;
   var $Campos_Mens_erro;
   var $nm_new_label = array();
//
//----- 
   function ini_controle()
   {
        global $nm_url_saida, $teste_validade, $script_case_init, 
               $glo_senha_protect, $nm_apl_dependente, $nm_form_submit, $sc_check_excl, $nm_opc_form_php, $nm_call_php, $nm_opc_lookup;


      if ($this->NM_ajax_flag)
      {
          if (isset($this->NM_ajax_info['param']['checktransportervsfdest']))
          {
              $this->checktransportervsfdest = $this->NM_ajax_info['param']['checktransportervsfdest'];
          }
          if (isset($this->NM_ajax_info['param']['checktransvsproducer']))
          {
              $this->checktransvsproducer = $this->NM_ajax_info['param']['checktransvsproducer'];
          }
          if (isset($this->NM_ajax_info['param']['envregistrationno_fdest']))
          {
              $this->envregistrationno_fdest = $this->NM_ajax_info['param']['envregistrationno_fdest'];
          }
          if (isset($this->NM_ajax_info['param']['envregistrationno_transporter']))
          {
              $this->envregistrationno_transporter = $this->NM_ajax_info['param']['envregistrationno_transporter'];
          }
          if (isset($this->NM_ajax_info['param']['ewctitle']))
          {
              $this->ewctitle = $this->NM_ajax_info['param']['ewctitle'];
          }
          if (isset($this->NM_ajax_info['param']['fdestaddress']))
          {
              $this->fdestaddress = $this->NM_ajax_info['param']['fdestaddress'];
          }
          if (isset($this->NM_ajax_info['param']['fdestphone']))
          {
              $this->fdestphone = $this->NM_ajax_info['param']['fdestphone'];
          }
          if (isset($this->NM_ajax_info['param']['fdestrespone']))
          {
              $this->fdestrespone = $this->NM_ajax_info['param']['fdestrespone'];
          }
          if (isset($this->NM_ajax_info['param']['fdestresponseemail']))
          {
              $this->fdestresponseemail = $this->NM_ajax_info['param']['fdestresponseemail'];
          }
          if (isset($this->NM_ajax_info['param']['fdewctitle']))
          {
              $this->fdewctitle = $this->NM_ajax_info['param']['fdewctitle'];
          }
          if (isset($this->NM_ajax_info['param']['nm_form_submit']))
          {
              $this->nm_form_submit = $this->NM_ajax_info['param']['nm_form_submit'];
          }
          if (isset($this->NM_ajax_info['param']['nmgp_ancora']))
          {
              $this->nmgp_ancora = $this->NM_ajax_info['param']['nmgp_ancora'];
          }
          if (isset($this->NM_ajax_info['param']['nmgp_arg_dyn_search']))
          {
              $this->nmgp_arg_dyn_search = $this->NM_ajax_info['param']['nmgp_arg_dyn_search'];
          }
          if (isset($this->NM_ajax_info['param']['nmgp_arg_fast_search']))
          {
              $this->nmgp_arg_fast_search = $this->NM_ajax_info['param']['nmgp_arg_fast_search'];
          }
          if (isset($this->NM_ajax_info['param']['nmgp_cond_fast_search']))
          {
              $this->nmgp_cond_fast_search = $this->NM_ajax_info['param']['nmgp_cond_fast_search'];
          }
          if (isset($this->NM_ajax_info['param']['nmgp_fast_search']))
          {
              $this->nmgp_fast_search = $this->NM_ajax_info['param']['nmgp_fast_search'];
          }
          if (isset($this->NM_ajax_info['param']['nmgp_num_form']))
          {
              $this->nmgp_num_form = $this->NM_ajax_info['param']['nmgp_num_form'];
          }
          if (isset($this->NM_ajax_info['param']['nmgp_opcao']))
          {
              $this->nmgp_opcao = $this->NM_ajax_info['param']['nmgp_opcao'];
          }
          if (isset($this->NM_ajax_info['param']['nmgp_ordem']))
          {
              $this->nmgp_ordem = $this->NM_ajax_info['param']['nmgp_ordem'];
          }
          if (isset($this->NM_ajax_info['param']['nmgp_parms']))
          {
              $this->nmgp_parms = $this->NM_ajax_info['param']['nmgp_parms'];
          }
          if (isset($this->NM_ajax_info['param']['nmgp_refresh_fields']))
          {
              $this->nmgp_refresh_fields = $this->NM_ajax_info['param']['nmgp_refresh_fields'];
          }
          if (isset($this->NM_ajax_info['param']['nmgp_url_saida']))
          {
              $this->nmgp_url_saida = $this->NM_ajax_info['param']['nmgp_url_saida'];
          }
          if (isset($this->NM_ajax_info['param']['pphone']))
          {
              $this->pphone = $this->NM_ajax_info['param']['pphone'];
          }
          if (isset($this->NM_ajax_info['param']['prbrresponse']))
          {
              $this->prbrresponse = $this->NM_ajax_info['param']['prbrresponse'];
          }
          if (isset($this->NM_ajax_info['param']['premail']))
          {
              $this->premail = $this->NM_ajax_info['param']['premail'];
          }
          if (isset($this->NM_ajax_info['param']['producerb_address']))
          {
              $this->producerb_address = $this->NM_ajax_info['param']['producerb_address'];
          }
          if (isset($this->NM_ajax_info['param']['script_case_init']))
          {
              $this->script_case_init = $this->NM_ajax_info['param']['script_case_init'];
          }
          if (isset($this->NM_ajax_info['param']['transporteremail']))
          {
              $this->transporteremail = $this->NM_ajax_info['param']['transporteremail'];
          }
          if (isset($this->NM_ajax_info['param']['transporterfax']))
          {
              $this->transporterfax = $this->NM_ajax_info['param']['transporterfax'];
          }
          if (isset($this->NM_ajax_info['param']['transporterphone']))
          {
              $this->transporterphone = $this->NM_ajax_info['param']['transporterphone'];
          }
          if (isset($this->NM_ajax_info['param']['transporterresponse']))
          {
              $this->transporterresponse = $this->NM_ajax_info['param']['transporterresponse'];
          }
          if (isset($this->NM_ajax_info['param']['wtequipment']))
          {
              $this->wtequipment = $this->NM_ajax_info['param']['wtequipment'];
          }
          if (isset($this->NM_ajax_info['param']['wtfdestdate']))
          {
              $this->wtfdestdate = $this->NM_ajax_info['param']['wtfdestdate'];
          }
          if (isset($this->NM_ajax_info['param']['wtfdestewc']))
          {
              $this->wtfdestewc = $this->NM_ajax_info['param']['wtfdestewc'];
          }
          if (isset($this->NM_ajax_info['param']['wtfdestid']))
          {
              $this->wtfdestid = $this->NM_ajax_info['param']['wtfdestid'];
          }
          if (isset($this->NM_ajax_info['param']['wtfdestm3']))
          {
              $this->wtfdestm3 = $this->NM_ajax_info['param']['wtfdestm3'];
          }
          if (isset($this->NM_ajax_info['param']['wtfdestperiferia']))
          {
              $this->wtfdestperiferia = $this->NM_ajax_info['param']['wtfdestperiferia'];
          }
          if (isset($this->NM_ajax_info['param']['wtfdestqty']))
          {
              $this->wtfdestqty = $this->NM_ajax_info['param']['wtfdestqty'];
          }
          if (isset($this->NM_ajax_info['param']['wtfdestrd']))
          {
              $this->wtfdestrd = $this->NM_ajax_info['param']['wtfdestrd'];
          }
          if (isset($this->NM_ajax_info['param']['wtfdestsign']))
          {
              $this->wtfdestsign = $this->NM_ajax_info['param']['wtfdestsign'];
          }
          if (isset($this->NM_ajax_info['param']['wtfdestsign_limpa']))
          {
              $this->wtfdestsign_limpa = $this->NM_ajax_info['param']['wtfdestsign_limpa'];
          }
          if (isset($this->NM_ajax_info['param']['wtfdestsign_ul_name']))
          {
              $this->wtfdestsign_ul_name = $this->NM_ajax_info['param']['wtfdestsign_ul_name'];
          }
          if (isset($this->NM_ajax_info['param']['wtfdestsign_ul_type']))
          {
              $this->wtfdestsign_ul_type = $this->NM_ajax_info['param']['wtfdestsign_ul_type'];
          }
          if (isset($this->NM_ajax_info['param']['wtid']))
          {
              $this->wtid = $this->NM_ajax_info['param']['wtid'];
          }
          if (isset($this->NM_ajax_info['param']['wtprducerm3']))
          {
              $this->wtprducerm3 = $this->NM_ajax_info['param']['wtprducerm3'];
          }
          if (isset($this->NM_ajax_info['param']['wtproduceracceptweigth']))
          {
              $this->wtproduceracceptweigth = $this->NM_ajax_info['param']['wtproduceracceptweigth'];
          }
          if (isset($this->NM_ajax_info['param']['wtproducerbranchid']))
          {
              $this->wtproducerbranchid = $this->NM_ajax_info['param']['wtproducerbranchid'];
          }
          if (isset($this->NM_ajax_info['param']['wtproducerewc']))
          {
              $this->wtproducerewc = $this->NM_ajax_info['param']['wtproducerewc'];
          }
          if (isset($this->NM_ajax_info['param']['wtproducerperiferia']))
          {
              $this->wtproducerperiferia = $this->NM_ajax_info['param']['wtproducerperiferia'];
          }
          if (isset($this->NM_ajax_info['param']['wtproducerqty']))
          {
              $this->wtproducerqty = $this->NM_ajax_info['param']['wtproducerqty'];
          }
          if (isset($this->NM_ajax_info['param']['wtproducerremarks']))
          {
              $this->wtproducerremarks = $this->NM_ajax_info['param']['wtproducerremarks'];
          }
          if (isset($this->NM_ajax_info['param']['wtproducersign']))
          {
              $this->wtproducersign = $this->NM_ajax_info['param']['wtproducersign'];
          }
          if (isset($this->NM_ajax_info['param']['wtproducersign_limpa']))
          {
              $this->wtproducersign_limpa = $this->NM_ajax_info['param']['wtproducersign_limpa'];
          }
          if (isset($this->NM_ajax_info['param']['wtproducersign_ul_name']))
          {
              $this->wtproducersign_ul_name = $this->NM_ajax_info['param']['wtproducersign_ul_name'];
          }
          if (isset($this->NM_ajax_info['param']['wtproducersign_ul_type']))
          {
              $this->wtproducersign_ul_type = $this->NM_ajax_info['param']['wtproducersign_ul_type'];
          }
          if (isset($this->NM_ajax_info['param']['wtprofilid']))
          {
              $this->wtprofilid = $this->NM_ajax_info['param']['wtprofilid'];
          }
          if (isset($this->NM_ajax_info['param']['wtrequestdate']))
          {
              $this->wtrequestdate = $this->NM_ajax_info['param']['wtrequestdate'];
          }
          if (isset($this->NM_ajax_info['param']['wttransportdate']))
          {
              $this->wttransportdate = $this->NM_ajax_info['param']['wttransportdate'];
          }
          if (isset($this->NM_ajax_info['param']['wttransporterid']))
          {
              $this->wttransporterid = $this->NM_ajax_info['param']['wttransporterid'];
          }
          if (isset($this->NM_ajax_info['param']['wttransporternumberid']))
          {
              $this->wttransporternumberid = $this->NM_ajax_info['param']['wttransporternumberid'];
          }
          if (isset($this->NM_ajax_info['param']['wttransportersign']))
          {
              $this->wttransportersign = $this->NM_ajax_info['param']['wttransportersign'];
          }
          if (isset($this->NM_ajax_info['param']['wttransportersign_limpa']))
          {
              $this->wttransportersign_limpa = $this->NM_ajax_info['param']['wttransportersign_limpa'];
          }
          if (isset($this->NM_ajax_info['param']['wttransportersign_ul_name']))
          {
              $this->wttransportersign_ul_name = $this->NM_ajax_info['param']['wttransportersign_ul_name'];
          }
          if (isset($this->NM_ajax_info['param']['wttransportersign_ul_type']))
          {
              $this->wttransportersign_ul_type = $this->NM_ajax_info['param']['wttransportersign_ul_type'];
          }
          if (isset($this->NM_ajax_info['param']['wttransportervechicle']))
          {
              $this->wttransportervechicle = $this->NM_ajax_info['param']['wttransportervechicle'];
          }
          if (isset($this->NM_ajax_info['param']['wtwasteid']))
          {
              $this->wtwasteid = $this->NM_ajax_info['param']['wtwasteid'];
          }
          if (isset($this->nmgp_refresh_fields))
          {
              $this->nmgp_refresh_fields = explode('_#fld#_', $this->nmgp_refresh_fields);
              $this->nmgp_opcao          = 'recarga';
          }
          if (!isset($this->nmgp_refresh_row))
          {
              $this->nmgp_refresh_row = '';
          }
      }

      $this->sc_conv_var = array();
      if (!empty($_FILES))
      {
          foreach ($_FILES as $nmgp_campo => $nmgp_valores)
          {
               if (isset($this->sc_conv_var[$nmgp_campo]))
               {
                   $nmgp_campo = $this->sc_conv_var[$nmgp_campo];
               }
               elseif (isset($this->sc_conv_var[strtolower($nmgp_campo)]))
               {
                   $nmgp_campo = $this->sc_conv_var[strtolower($nmgp_campo)];
               }
               $tmp_scfile_name     = $nmgp_campo . "_scfile_name";
               $tmp_scfile_type     = $nmgp_campo . "_scfile_type";
               $this->$nmgp_campo = is_array($nmgp_valores['tmp_name']) ? $nmgp_valores['tmp_name'][0] : $nmgp_valores['tmp_name'];
               $this->$tmp_scfile_type   = is_array($nmgp_valores['type'])     ? $nmgp_valores['type'][0]     : $nmgp_valores['type'];
               $this->$tmp_scfile_name   = is_array($nmgp_valores['name'])     ? $nmgp_valores['name'][0]     : $nmgp_valores['name'];
          }
      }
      if (!empty($_POST))
      {
          foreach ($_POST as $nmgp_var => $nmgp_val)
          {
               if (isset($this->sc_conv_var[$nmgp_var]))
               {
                   $nmgp_var = $this->sc_conv_var[$nmgp_var];
               }
               elseif (isset($this->sc_conv_var[strtolower($nmgp_var)]))
               {
                   $nmgp_var = $this->sc_conv_var[strtolower($nmgp_var)];
               }
               $this->$nmgp_var = $nmgp_val;
          }
      }
      if (!empty($_GET))
      {
          foreach ($_GET as $nmgp_var => $nmgp_val)
          {
               if (isset($this->sc_conv_var[$nmgp_var]))
               {
                   $nmgp_var = $this->sc_conv_var[$nmgp_var];
               }
               elseif (isset($this->sc_conv_var[strtolower($nmgp_var)]))
               {
                   $nmgp_var = $this->sc_conv_var[strtolower($nmgp_var)];
               }
               $this->$nmgp_var = $nmgp_val;
          }
      }
      if (isset($this->glo_wtid) && isset($this->NM_contr_var_session) && $this->NM_contr_var_session == "Yes") 
      {
          $_SESSION['glo_wtid'] = $this->glo_wtid;
      }
      if (isset($this->ProfilID) && isset($this->NM_contr_var_session) && $this->NM_contr_var_session == "Yes") 
      {
          $_SESSION['ProfilID'] = $this->ProfilID;
      }
      if (isset($this->glo_INTNUMBER) && isset($this->NM_contr_var_session) && $this->NM_contr_var_session == "Yes") 
      {
          $_SESSION['glo_INTNUMBER'] = $this->glo_INTNUMBER;
      }
      if (isset($this->TitleName) && isset($this->NM_contr_var_session) && $this->NM_contr_var_session == "Yes") 
      {
          $_SESSION['TitleName'] = $this->TitleName;
      }
      if (isset($this->glo_module) && isset($this->NM_contr_var_session) && $this->NM_contr_var_session == "Yes") 
      {
          $_SESSION['glo_module'] = $this->glo_module;
      }
      if (isset($_POST["glo_wtid"])) 
      {
          $_SESSION['glo_wtid'] = $this->glo_wtid;
      }
      if (isset($_POST["ProfilID"])) 
      {
          $_SESSION['ProfilID'] = $this->ProfilID;
      }
      if (!isset($_POST["ProfilID"]) && isset($_POST["profilid"])) 
      {
          $_SESSION['ProfilID'] = $this->profilid;
      }
      if (isset($_POST["glo_INTNUMBER"])) 
      {
          $_SESSION['glo_INTNUMBER'] = $this->glo_INTNUMBER;
      }
      if (!isset($_POST["glo_INTNUMBER"]) && isset($_POST["glo_intnumber"])) 
      {
          $_SESSION['glo_INTNUMBER'] = $this->glo_intnumber;
      }
      if (isset($_POST["TitleName"])) 
      {
          $_SESSION['TitleName'] = $this->TitleName;
      }
      if (!isset($_POST["TitleName"]) && isset($_POST["titlename"])) 
      {
          $_SESSION['TitleName'] = $this->titlename;
      }
      if (isset($_POST["glo_module"])) 
      {
          $_SESSION['glo_module'] = $this->glo_module;
      }
      if (isset($_GET["glo_wtid"])) 
      {
          $_SESSION['glo_wtid'] = $this->glo_wtid;
      }
      if (isset($_GET["ProfilID"])) 
      {
          $_SESSION['ProfilID'] = $this->ProfilID;
      }
      if (!isset($_GET["ProfilID"]) && isset($_GET["profilid"])) 
      {
          $_SESSION['ProfilID'] = $this->profilid;
      }
      if (isset($_GET["glo_INTNUMBER"])) 
      {
          $_SESSION['glo_INTNUMBER'] = $this->glo_INTNUMBER;
      }
      if (!isset($_GET["glo_INTNUMBER"]) && isset($_GET["glo_intnumber"])) 
      {
          $_SESSION['glo_INTNUMBER'] = $this->glo_intnumber;
      }
      if (isset($_GET["TitleName"])) 
      {
          $_SESSION['TitleName'] = $this->TitleName;
      }
      if (!isset($_GET["TitleName"]) && isset($_GET["titlename"])) 
      {
          $_SESSION['TitleName'] = $this->titlename;
      }
      if (isset($_GET["glo_module"])) 
      {
          $_SESSION['glo_module'] = $this->glo_module;
      }
      if (isset($_SESSION['sc_session'][$script_case_init]['validate_wastetransactions_mob']['embutida_parms']))
      { 
          $this->nmgp_parms = $_SESSION['sc_session'][$script_case_init]['validate_wastetransactions_mob']['embutida_parms'];
          unset($_SESSION['sc_session'][$script_case_init]['validate_wastetransactions_mob']['embutida_parms']);
      } 
      if (isset($this->nmgp_parms) && !empty($this->nmgp_parms)) 
      { 
          if (isset($_SESSION['nm_aba_bg_color'])) 
          { 
              unset($_SESSION['nm_aba_bg_color']);
          }   
          $nmgp_parms = NM_decode_input($nmgp_parms);
          $nmgp_parms = str_replace("@aspass@", "'", $this->nmgp_parms);
          $nmgp_parms = str_replace("*scout", "?@?", $nmgp_parms);
          $nmgp_parms = str_replace("*scin", "?#?", $nmgp_parms);
          $todo = explode("?@?", $nmgp_parms);
          $ix = 0;
          while (!empty($todo[$ix]))
          {
             $cadapar = explode("?#?", $todo[$ix]);
             if (1 < sizeof($cadapar))
             {
                 if (isset($this->sc_conv_var[$cadapar[0]]))
                 {
                     $cadapar[0] = $this->sc_conv_var[$cadapar[0]];
                 }
                 elseif (isset($this->sc_conv_var[strtolower($cadapar[0])]))
                 {
                     $cadapar[0] = $this->sc_conv_var[strtolower($cadapar[0])];
                 }
                 nm_limpa_str_validate_wastetransactions_mob($cadapar[1]);
                 $this->$cadapar[0] = $cadapar[1];
             }
             $ix++;
          }
          if (isset($this->NM_where_filter_form))
          {
              $_SESSION['sc_session'][$script_case_init]['validate_wastetransactions_mob']['where_filter_form'] = $this->NM_where_filter_form;
              unset($_SESSION['sc_session'][$script_case_init]['validate_wastetransactions_mob']['total']);
          }
          if (isset($this->sc_redir_atualiz))
          {
              $_SESSION['sc_session'][$script_case_init]['validate_wastetransactions_mob']['sc_redir_atualiz'] = $this->sc_redir_atualiz;
          }
          if (isset($this->sc_redir_insert))
          {
              $_SESSION['sc_session'][$script_case_init]['validate_wastetransactions_mob']['sc_redir_insert'] = $this->sc_redir_insert;
          }
          if (isset($this->glo_wtid)) 
          {
              $_SESSION['glo_wtid'] = $this->glo_wtid;
          }
          if (!isset($this->ProfilID) && isset($this->profilid)) 
          {
              $this->ProfilID = $this->profilid;
          }
          if (isset($this->ProfilID)) 
          {
              $_SESSION['ProfilID'] = $this->ProfilID;
          }
          if (!isset($this->glo_INTNUMBER) && isset($this->glo_intnumber)) 
          {
              $this->glo_INTNUMBER = $this->glo_intnumber;
          }
          if (isset($this->glo_INTNUMBER)) 
          {
              $_SESSION['glo_INTNUMBER'] = $this->glo_INTNUMBER;
          }
          if (!isset($this->TitleName) && isset($this->titlename)) 
          {
              $this->TitleName = $this->titlename;
          }
          if (isset($this->TitleName)) 
          {
              $_SESSION['TitleName'] = $this->TitleName;
          }
          if (isset($this->glo_module)) 
          {
              $_SESSION['glo_module'] = $this->glo_module;
          }
      } 
      elseif (isset($script_case_init) && !empty($script_case_init) && isset($_SESSION['sc_session'][$script_case_init]['validate_wastetransactions_mob']['parms']))
      {
          if ((!isset($this->nmgp_opcao) || ($this->nmgp_opcao != "incluir" && $this->nmgp_opcao != "alterar" && $this->nmgp_opcao != "excluir" && $this->nmgp_opcao != "novo" && $this->nmgp_opcao != "recarga" && $this->nmgp_opcao != "muda_form")) && (!isset($this->NM_ajax_opcao) || $this->NM_ajax_opcao == ""))
          {
              $todo = explode("?@?", $_SESSION['sc_session'][$script_case_init]['validate_wastetransactions_mob']['parms']);
              $ix = 0;
              while (!empty($todo[$ix]))
              {
                 $cadapar = explode("?#?", $todo[$ix]);
                 $this->$cadapar[0] = $cadapar[1];
                 $ix++;
              }
          }
      } 

      if (!$this->NM_ajax_flag && 'autocomp_' == substr($this->NM_ajax_opcao, 0, 9))
      {
          $this->NM_ajax_flag = true;
      }

      $dir_raiz          = strrpos($_SERVER['PHP_SELF'],"/") ;  
      $dir_raiz          = substr($_SERVER['PHP_SELF'], 0, $dir_raiz + 1) ;  
      if (isset($this->nm_evt_ret_edit) && '' != $this->nm_evt_ret_edit)
      {
          $_SESSION['sc_session'][$script_case_init]['validate_wastetransactions_mob']['lig_edit_lookup']     = true;
          $_SESSION['sc_session'][$script_case_init]['validate_wastetransactions_mob']['lig_edit_lookup_cb']  = $this->nm_evt_ret_edit;
          $_SESSION['sc_session'][$script_case_init]['validate_wastetransactions_mob']['lig_edit_lookup_row'] = isset($this->nm_evt_ret_row) ? $this->nm_evt_ret_row : '';
      }
      if (isset($_SESSION['sc_session'][$script_case_init]['validate_wastetransactions_mob']['lig_edit_lookup']) && $_SESSION['sc_session'][$script_case_init]['validate_wastetransactions_mob']['lig_edit_lookup'])
      {
          $this->lig_edit_lookup     = true;
          $this->lig_edit_lookup_cb  = $_SESSION['sc_session'][$script_case_init]['validate_wastetransactions_mob']['lig_edit_lookup_cb'];
          $this->lig_edit_lookup_row = $_SESSION['sc_session'][$script_case_init]['validate_wastetransactions_mob']['lig_edit_lookup_row'];
      }
      if (!$this->Ini)
      { 
          $this->Ini = new validate_wastetransactions_mob_ini(); 
          $this->Ini->init();
          $this->nm_data = new nm_data("el");
          $this->app_is_initializing = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['initialize'];
          if (isset($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions']))
          {
              foreach ($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions'] as $I_conf => $Conf_opt)
              {
                  $_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob'][$I_conf]  = $Conf_opt;
              }
          }
      } 
      else 
      { 
         $this->nm_data = new nm_data("el");
      } 
      $this->Change_Menu = false;
      $run_iframe = (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['run_iframe']) && ($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['run_iframe'] == "F" || $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['run_iframe'] == "R")) ? true : false;
      if (!$run_iframe && isset($_SESSION['scriptcase']['menu_atual']) && !$_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_call'] && (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['sc_outra_jan']) || !$_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['sc_outra_jan']))
      {
          $this->sc_init_menu = "x";
          if (isset($_SESSION['scriptcase'][$_SESSION['scriptcase']['menu_atual']]['sc_init']['validate_wastetransactions_mob']))
          {
              $this->sc_init_menu = $_SESSION['scriptcase'][$_SESSION['scriptcase']['menu_atual']]['sc_init']['validate_wastetransactions_mob'];
          }
          elseif (isset($_SESSION['scriptcase']['menu_apls'][$_SESSION['scriptcase']['menu_atual']]))
          {
              foreach ($_SESSION['scriptcase']['menu_apls'][$_SESSION['scriptcase']['menu_atual']] as $init => $resto)
              {
                  if ($this->Ini->sc_page == $init)
                  {
                      $this->sc_init_menu = $init;
                      break;
                  }
              }
          }
          if ($this->Ini->sc_page == $this->sc_init_menu && !isset($_SESSION['scriptcase']['menu_apls'][$_SESSION['scriptcase']['menu_atual']][$this->sc_init_menu]['validate_wastetransactions_mob']))
          {
               $_SESSION['scriptcase']['menu_apls'][$_SESSION['scriptcase']['menu_atual']][$this->sc_init_menu]['validate_wastetransactions_mob']['link'] = $this->Ini->sc_protocolo . $this->Ini->server . $this->Ini->path_link . "" . SC_dir_app_name('validate_wastetransactions_mob') . "/";
               $_SESSION['scriptcase']['menu_apls'][$_SESSION['scriptcase']['menu_atual']][$this->sc_init_menu]['validate_wastetransactions_mob']['label'] = "Επιβεβαίωση εντύπου κίνησης {INTNUMBER}";
               $this->Change_Menu = true;
          }
          elseif ($this->Ini->sc_page == $this->sc_init_menu)
          {
              $achou = false;
              foreach ($_SESSION['scriptcase']['menu_apls'][$_SESSION['scriptcase']['menu_atual']][$this->sc_init_menu] as $apl => $parms)
              {
                  if ($apl == "validate_wastetransactions_mob")
                  {
                      $achou = true;
                  }
                  elseif ($achou)
                  {
                      unset($_SESSION['scriptcase']['menu_apls'][$_SESSION['scriptcase']['menu_atual']][$this->sc_init_menu][$apl]);
                      $this->Change_Menu = true;
                  }
              }
          }
      }
      if (!function_exists("nmButtonOutput"))
      {
          include_once($this->Ini->path_lib_php . "nm_gp_config_btn.php");
      }
      include("../_lib/css/" . $this->Ini->str_schema_all . "_form.php");
      $this->Ini->Str_btn_form    = trim($str_button);
      include($this->Ini->path_btn . $this->Ini->Str_btn_form . '/' . $this->Ini->Str_btn_form . $_SESSION['scriptcase']['reg_conf']['css_dir'] . '.php');
      $this->Db = $this->Ini->Db; 
      $this->Ini->Img_sep_form    = "/" . trim($str_toolbar_separator);
      $this->Ini->Color_bg_ajax   = "" == trim($str_ajax_bg)         ? "#000" : $str_ajax_bg;
      $this->Ini->Border_c_ajax   = "" == trim($str_ajax_border_c)   ? ""     : $str_ajax_border_c;
      $this->Ini->Border_s_ajax   = "" == trim($str_ajax_border_s)   ? ""     : $str_ajax_border_s;
      $this->Ini->Border_w_ajax   = "" == trim($str_ajax_border_w)   ? ""     : $str_ajax_border_w;
      $this->Ini->Block_img_exp   = "" == trim($str_block_exp)       ? ""     : $str_block_exp;
      $this->Ini->Block_img_col   = "" == trim($str_block_col)       ? ""     : $str_block_col;
      $this->Ini->Msg_ico_title   = "" == trim($str_msg_ico_title)   ? ""     : $str_msg_ico_title;
      $this->Ini->Msg_ico_body    = "" == trim($str_msg_ico_body)    ? ""     : $str_msg_ico_body;
      $this->Ini->Err_ico_title   = "" == trim($str_err_ico_title)   ? ""     : $str_err_ico_title;
      $this->Ini->Err_ico_body    = "" == trim($str_err_ico_body)    ? ""     : $str_err_ico_body;
      $this->Ini->Cal_ico_back    = "" == trim($str_cal_ico_back)    ? ""     : $str_cal_ico_back;
      $this->Ini->Cal_ico_for     = "" == trim($str_cal_ico_for)     ? ""     : $str_cal_ico_for;
      $this->Ini->Cal_ico_close   = "" == trim($str_cal_ico_close)   ? ""     : $str_cal_ico_close;
      $this->Ini->Tab_space       = "" == trim($str_tab_space)       ? ""     : $str_tab_space;
      $this->Ini->Bubble_tail     = "" == trim($str_bubble_tail)     ? ""     : $str_bubble_tail;
      $this->Ini->Label_sort_pos  = "" == trim($str_label_sort_pos)  ? ""     : $str_label_sort_pos;
      $this->Ini->Label_sort      = "" == trim($str_label_sort)      ? ""     : $str_label_sort;
      $this->Ini->Label_sort_asc  = "" == trim($str_label_sort_asc)  ? ""     : $str_label_sort_asc;
      $this->Ini->Label_sort_desc = "" == trim($str_label_sort_desc) ? ""     : $str_label_sort_desc;
      $this->Ini->Img_status_ok   = "" == trim($str_img_status_ok)   ? ""     : $str_img_status_ok;
      $this->Ini->Img_status_err  = "" == trim($str_img_status_err)  ? ""     : $str_img_status_err;
      $this->Ini->Css_status      = "scFormInputError";
      $this->Ini->Error_icon_span = "" == trim($str_error_icon_span) ? false  : "message" == $str_error_icon_span;
      $this->Ini->Img_qs_search        = "" == trim($img_qs_search)        ? "scriptcase__NM__qs_lupa.png"  : $img_qs_search;
      $this->Ini->Img_qs_clean         = "" == trim($img_qs_clean)         ? "scriptcase__NM__qs_close.png" : $img_qs_clean;
      $this->Ini->Str_qs_image_padding = "" == trim($str_qs_image_padding) ? "0"                            : $str_qs_image_padding;
      $this->Ini->App_div_tree_img_col = trim($app_div_str_tree_col);
      $this->Ini->App_div_tree_img_exp = trim($app_div_str_tree_exp);


      $this->arr_buttons['sc_btn_0']['hint']             = "";
      $this->arr_buttons['sc_btn_0']['type']             = "button";
      $this->arr_buttons['sc_btn_0']['value']            = "Εντυπο";
      $this->arr_buttons['sc_btn_0']['display']          = "only_text";
      $this->arr_buttons['sc_btn_0']['display_position'] = "text_right";
      $this->arr_buttons['sc_btn_0']['style']            = "default";
      $this->arr_buttons['sc_btn_0']['image']            = "";

      $this->arr_buttons['group_group_2']= array(
          'value'            => "" . $this->Ini->Nm_lang['lang_btns_options'] . "",
          'hint'             => "" . $this->Ini->Nm_lang['lang_btns_options'] . "",
          'type'             => "button",
          'display'          => "text_img",
          'display_position' => "text_right",
          'image'            => "scriptcase__NM__gear.png",
          'style'            => "default",
      );


      $_SESSION['scriptcase']['error_icon']['validate_wastetransactions_mob']  = "<img src=\"" . $this->Ini->path_icones . "/scriptcase__NM__icnMensagemAlerta.png\" style=\"border-width: 0px\" align=\"top\">&nbsp;";
      $_SESSION['scriptcase']['error_close']['validate_wastetransactions_mob'] = "<td>" . nmButtonOutput($this->arr_buttons, "berrm_clse", "document.getElementById('id_error_display_fixed').style.display = 'none'; document.getElementById('id_error_message_fixed').innerHTML = ''; return false", "document.getElementById('id_error_display_fixed').style.display = 'none'; document.getElementById('id_error_message_fixed').innerHTML = ''; return false", "", "", "", "", "", "", "", $this->Ini->path_botoes, "", "", "", "", "") . "</td>";

      $this->Embutida_proc = isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_proc']) ? $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_proc'] : $this->Embutida_proc;
      $this->Embutida_form = isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_form']) ? $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_form'] : $this->Embutida_form;
      $this->Embutida_call = isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_call']) ? $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_call'] : $this->Embutida_call;

      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_grid_edit']) && '' != $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_grid_edit'])
      {
          $this->Grid_editavel = ('on' == $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_grid_edit']) ? true : false;
      }
      if (isset($this->Grid_editavel) && $this->Grid_editavel)
      {
          $this->Embutida_form  = true;
          $this->Embutida_ronly = true;
      }
      $this->Embutida_multi = false;
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_multi']) && $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_multi'])
      {
          $this->Grid_editavel  = false;
          $this->Embutida_form  = false;
          $this->Embutida_ronly = false;
          $this->Embutida_multi = true;
      }
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_tp_pag']) && '' != $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_tp_pag'])
      {
          $this->form_paginacao = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_tp_pag'];
      }

      if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_form']) || '' == $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_form'])
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_form'] = $this->Embutida_form;
      }
      if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_grid_edit']) || '' == $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_grid_edit'])
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_grid_edit'] = $this->Grid_editavel ? 'on' : 'off';
      }
      if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_grid_edit']) || '' == $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_grid_edit'])
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_grid_edit'] = $this->Embutida_call;
      }

      $this->Ini->cor_grid_par = $this->Ini->cor_grid_impar;
      $this->nm_location = $this->Ini->sc_protocolo . $this->Ini->server . $dir_raiz; 
      $this->nmgp_url_saida  = $nm_url_saida;
      $this->nmgp_form_show  = "on";
      $this->nmgp_form_empty = false;
      $this->Ini->sc_Include($this->Ini->path_lib_php . "/nm_valida.php", "C", "NM_Valida") ; 
      $teste_validade = new NM_Valida ;

      if (isset($this->NM_ajax_info['param']['wttransportersign_ul_name']) && '' != $this->NM_ajax_info['param']['wttransportersign_ul_name'])
      {
          $this->wttransportersign         = $this->Ini->root . $this->Ini->path_imag_temp . '/' . $this->NM_ajax_info['param']['wttransportersign_ul_name'];
          $this->wttransportersign_scfile_name    = substr($this->NM_ajax_info['param']['wttransportersign_ul_name'], 12);
          $this->wttransportersign_scfile_type    = $this->NM_ajax_info['param']['wttransportersign_ul_type'];
          $this->wttransportersign_ul_name = $this->NM_ajax_info['param']['wttransportersign_ul_name'];
          $this->wttransportersign_ul_type = $this->NM_ajax_info['param']['wttransportersign_ul_type'];
      }
      elseif (isset($this->wttransportersign_ul_name) && '' != $this->wttransportersign_ul_name)
      {
          $this->wttransportersign      = $this->Ini->root . $this->Ini->path_imag_temp . '/' . $this->wttransportersign_ul_name;
          $this->wttransportersign_scfile_name = substr($this->wttransportersign_ul_name, 12);
          $this->wttransportersign_scfile_type = $this->wttransportersign_ul_type;
      }
      if (isset($this->NM_ajax_info['param']['wtproducersign_ul_name']) && '' != $this->NM_ajax_info['param']['wtproducersign_ul_name'])
      {
          $this->wtproducersign         = $this->Ini->root . $this->Ini->path_imag_temp . '/' . $this->NM_ajax_info['param']['wtproducersign_ul_name'];
          $this->wtproducersign_scfile_name    = substr($this->NM_ajax_info['param']['wtproducersign_ul_name'], 12);
          $this->wtproducersign_scfile_type    = $this->NM_ajax_info['param']['wtproducersign_ul_type'];
          $this->wtproducersign_ul_name = $this->NM_ajax_info['param']['wtproducersign_ul_name'];
          $this->wtproducersign_ul_type = $this->NM_ajax_info['param']['wtproducersign_ul_type'];
      }
      elseif (isset($this->wtproducersign_ul_name) && '' != $this->wtproducersign_ul_name)
      {
          $this->wtproducersign      = $this->Ini->root . $this->Ini->path_imag_temp . '/' . $this->wtproducersign_ul_name;
          $this->wtproducersign_scfile_name = substr($this->wtproducersign_ul_name, 12);
          $this->wtproducersign_scfile_type = $this->wtproducersign_ul_type;
      }
      if (isset($this->NM_ajax_info['param']['wtfdestsign_ul_name']) && '' != $this->NM_ajax_info['param']['wtfdestsign_ul_name'])
      {
          $this->wtfdestsign         = $this->Ini->root . $this->Ini->path_imag_temp . '/' . $this->NM_ajax_info['param']['wtfdestsign_ul_name'];
          $this->wtfdestsign_scfile_name    = substr($this->NM_ajax_info['param']['wtfdestsign_ul_name'], 12);
          $this->wtfdestsign_scfile_type    = $this->NM_ajax_info['param']['wtfdestsign_ul_type'];
          $this->wtfdestsign_ul_name = $this->NM_ajax_info['param']['wtfdestsign_ul_name'];
          $this->wtfdestsign_ul_type = $this->NM_ajax_info['param']['wtfdestsign_ul_type'];
      }
      elseif (isset($this->wtfdestsign_ul_name) && '' != $this->wtfdestsign_ul_name)
      {
          $this->wtfdestsign      = $this->Ini->root . $this->Ini->path_imag_temp . '/' . $this->wtfdestsign_ul_name;
          $this->wtfdestsign_scfile_name = substr($this->wtfdestsign_ul_name, 12);
          $this->wtfdestsign_scfile_type = $this->wtfdestsign_ul_type;
      }

      $this->loadFieldConfig();

      if ($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['first_time'])
      {
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['insert']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['new']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['update']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['delete']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['first']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['back']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['forward']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['last']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['qsearch']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['dynsearch']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['summary']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['navpage']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['goto']);
      }
      $this->NM_cancel_return_new = (isset($this->NM_cancel_return_new) && $this->NM_cancel_return_new == 1) ? "1" : "";
      $this->NM_cancel_insert_new = ((isset($this->NM_cancel_insert_new) && $this->NM_cancel_insert_new == 1) || $this->NM_cancel_return_new == 1) ? "document.F5.action='" . $nm_url_saida . "';" : "";
      if (isset($this->NM_btn_insert) && '' != $this->NM_btn_insert && (!isset($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['insert']) || '' == $_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['insert']))
      {
          if ('N' == $this->NM_btn_insert)
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['insert'] = 'off';
          }
          else
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['insert'] = 'on';
          }
      }
      if (isset($this->NM_btn_new) && 'N' == $this->NM_btn_new)
      {
          $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['new'] = 'off';
      }
      if (isset($this->NM_btn_update) && '' != $this->NM_btn_update && (!isset($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['update']) || '' == $_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['update']))
      {
          if ('N' == $this->NM_btn_update)
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['update'] = 'off';
          }
          else
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['update'] = 'on';
          }
      }
      if (isset($this->NM_btn_delete) && '' != $this->NM_btn_delete && (!isset($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['delete']) || '' == $_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['delete']))
      {
          if ('N' == $this->NM_btn_delete)
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['delete'] = 'off';
          }
          else
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['delete'] = 'on';
          }
      }
      if (isset($this->NM_btn_navega) && '' != $this->NM_btn_navega)
      {
          if ('N' == $this->NM_btn_navega)
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['first']     = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['back']      = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['forward']   = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['last']      = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['qsearch']   = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['dynsearch'] = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['summary']   = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['navpage']   = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['goto']      = 'off';
              $this->Nav_permite_ava = false;
              $this->Nav_permite_ret = false;
          }
          else
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['first']     = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['back']      = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['forward']   = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['last']      = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['qsearch']   = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['dynsearch'] = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['summary']   = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['navpage']   = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['goto']      = 'on';
          }
      }

      $this->nmgp_botoes['exit'] = "on";
      $this->nmgp_botoes['qsearch'] = "on";
      $this->nmgp_botoes['new'] = "on";
      $this->nmgp_botoes['insert'] = "on";
      $this->nmgp_botoes['copy'] = "off";
      $this->nmgp_botoes['update'] = "on";
      $this->nmgp_botoes['delete'] = "on";
      $this->nmgp_botoes['first'] = "on";
      $this->nmgp_botoes['back'] = "on";
      $this->nmgp_botoes['forward'] = "on";
      $this->nmgp_botoes['last'] = "on";
      $this->nmgp_botoes['summary'] = "on";
      $this->nmgp_botoes['navpage'] = "off";
      $this->nmgp_botoes['goto'] = "off";
      $this->nmgp_botoes['qtline'] = "off";
      $this->nmgp_botoes['sc_btn_0'] = "on";
      $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_orig'] = " where wtid = " . $_SESSION['glo_wtid'] . " AND wtProfilID = " . $_SESSION['ProfilID'] . "";
      if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_pesq']))
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_pesq'] = " where wtid = " . $_SESSION['glo_wtid'] . " AND wtProfilID = " . $_SESSION['ProfilID'] . "";
          $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_pesq_filtro'] = "";
      }
      $this->sc_where_orig   = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_orig'];
      $this->sc_where_atual  = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_pesq'];
      $this->sc_where_filtro = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_pesq_filtro'];
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['iframe_filtro']) && $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['iframe_filtro'] == "S")
      {
          $this->nmgp_botoes['exit'] = "off";
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['btn_display']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['btn_display']))
      {
          foreach ($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['btn_display'] as $NM_cada_btn => $NM_cada_opc)
          {
              $this->nmgp_botoes[$NM_cada_btn] = $NM_cada_opc;
          }
      }

      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['insert']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['insert'] != '')
      {
          $this->nmgp_botoes['new']    = $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['insert'];
          $this->nmgp_botoes['insert'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['insert'];
          $this->nmgp_botoes['copy']   = $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['insert'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['new']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['new'] != '')
      {
          $this->nmgp_botoes['new']    = $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['new'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['update']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['update'] != '')
      {
          $this->nmgp_botoes['update'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['update'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['delete']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['delete'] != '')
      {
          $this->nmgp_botoes['delete'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['delete'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['first']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['first'] != '')
      {
          $this->nmgp_botoes['first'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['first'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['back']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['back'] != '')
      {
          $this->nmgp_botoes['back'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['back'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['forward']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['forward'] != '')
      {
          $this->nmgp_botoes['forward'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['forward'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['last']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['last'] != '')
      {
          $this->nmgp_botoes['last'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['last'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['qsearch']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['qsearch'] != '')
      {
          $this->nmgp_botoes['qsearch'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['qsearch'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['dynsearch']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['dynsearch'] != '')
      {
          $this->nmgp_botoes['dynsearch'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['dynsearch'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['summary']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['summary'] != '')
      {
          $this->nmgp_botoes['summary'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['summary'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['navpage']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['navpage'] != '')
      {
          $this->nmgp_botoes['navpage'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['navpage'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['goto']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['goto'] != '')
      {
          $this->nmgp_botoes['goto'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['validate_wastetransactions_mob']['goto'];
      }

      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_form_insert']) && $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_form_insert'] != '')
      {
          $this->nmgp_botoes['new']    = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_form_insert'];
          $this->nmgp_botoes['insert'] = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_form_insert'];
          $this->nmgp_botoes['copy']   = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_form_insert'];
      }
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_form_update']) && $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_form_update'] != '')
      {
          $this->nmgp_botoes['update'] = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_form_update'];
      }
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_form_delete']) && $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_form_delete'] != '')
      {
          $this->nmgp_botoes['delete'] = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_form_delete'];
      }
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_form_btn_nav']) && $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_form_btn_nav'] != '')
      {
          $this->nmgp_botoes['first']   = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_form_btn_nav'];
          $this->nmgp_botoes['back']    = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_form_btn_nav'];
          $this->nmgp_botoes['forward'] = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_form_btn_nav'];
          $this->nmgp_botoes['last']    = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['embutida_liga_form_btn_nav'];
      }

      if (isset($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['insert']) && $_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['insert'] != '')
      {
          $this->nmgp_botoes['new']    = $_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['insert'];
          $this->nmgp_botoes['insert'] = $_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['insert'];
          $this->nmgp_botoes['copy']   = $_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['insert'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['update']) && $_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['update'] != '')
      {
          $this->nmgp_botoes['update'] = $_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['update'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['delete']) && $_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['delete'] != '')
      {
          $this->nmgp_botoes['delete'] = $_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['delete'];
      }

      if (isset($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['field_display']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['field_display']))
      {
          foreach ($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['field_display'] as $NM_cada_field => $NM_cada_opc)
          {
              $this->nmgp_cmp_hidden[$NM_cada_field] = $NM_cada_opc;
              $this->NM_ajax_info['fieldDisplay'][$NM_cada_field] = $NM_cada_opc;
          }
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['field_readonly']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['field_readonly']))
      {
          foreach ($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['field_readonly'] as $NM_cada_field => $NM_cada_opc)
          {
              $this->nmgp_cmp_readonly[$NM_cada_field] = "on";
              $this->NM_ajax_info['readOnly'][$NM_cada_field] = $NM_cada_opc;
          }
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['exit']) && $_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['exit'] != '')
      {
          $_SESSION['scriptcase']['sc_url_saida'][$this->Ini->sc_page] = $_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['exit'];
      }
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_form']))
      {
          $this->nmgp_dados_form = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_form'];
          if (!isset($this->wtid)){$this->wtid = $this->nmgp_dados_form['wtid'];} 
          if (!isset($this->wtprofilid)){$this->wtprofilid = $this->nmgp_dados_form['wtprofilid'];} 
          if (!isset($this->intnumber)){$this->intnumber = $this->nmgp_dados_form['intnumber'];} 
          if (!isset($this->wtproducervalidate)){$this->wtproducervalidate = $this->nmgp_dados_form['wtproducervalidate'];} 
          if (!isset($this->wttransporterperiferiaid)){$this->wttransporterperiferiaid = $this->nmgp_dados_form['wttransporterperiferiaid'];} 
          if (!isset($this->wttransporterewc)){$this->wttransporterewc = $this->nmgp_dados_form['wttransporterewc'];} 
          if (!isset($this->wttransportervalidate)){$this->wttransportervalidate = $this->nmgp_dados_form['wttransportervalidate'];} 
          if (!isset($this->wttransportervalidateip)){$this->wttransportervalidateip = $this->nmgp_dados_form['wttransportervalidateip'];} 
          if (!isset($this->wtfdestvlidated)){$this->wtfdestvlidated = $this->nmgp_dados_form['wtfdestvlidated'];} 
          if (!isset($this->wtfdestvalidateip)){$this->wtfdestvalidateip = $this->nmgp_dados_form['wtfdestvalidateip'];} 
          if (!isset($this->transporterregno)){$this->transporterregno = $this->nmgp_dados_form['transporterregno'];} 
      }
      $glo_senha_protect = (isset($_SESSION['scriptcase']['glo_senha_protect'])) ? $_SESSION['scriptcase']['glo_senha_protect'] : "S";
      $this->aba_iframe = false;
      if (isset($_SESSION['scriptcase']['sc_aba_iframe']))
      {
          foreach ($_SESSION['scriptcase']['sc_aba_iframe'] as $aba => $apls_aba)
          {
              if (in_array("validate_wastetransactions_mob", $apls_aba))
              {
                  $this->aba_iframe = true;
                  break;
              }
          }
      }
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['iframe_menu'] && (!isset($_SESSION['scriptcase']['menu_mobile']) || empty($_SESSION['scriptcase']['menu_mobile'])))
      {
          $this->aba_iframe = true;
      }
      $this->Ini->sc_Include($this->Ini->path_lib_php . "/nm_gp_limpa.php", "F", "nm_limpa_valor") ; 
      $this->Ini->sc_Include($this->Ini->path_libs . "/nm_gc.php", "F", "nm_gc") ; 
      $_SESSION['scriptcase']['sc_tab_meses']['int'] = array(
                                      $this->Ini->Nm_lang['lang_mnth_janu'],
                                      $this->Ini->Nm_lang['lang_mnth_febr'],
                                      $this->Ini->Nm_lang['lang_mnth_marc'],
                                      $this->Ini->Nm_lang['lang_mnth_apri'],
                                      $this->Ini->Nm_lang['lang_mnth_mayy'],
                                      $this->Ini->Nm_lang['lang_mnth_june'],
                                      $this->Ini->Nm_lang['lang_mnth_july'],
                                      $this->Ini->Nm_lang['lang_mnth_augu'],
                                      $this->Ini->Nm_lang['lang_mnth_sept'],
                                      $this->Ini->Nm_lang['lang_mnth_octo'],
                                      $this->Ini->Nm_lang['lang_mnth_nove'],
                                      $this->Ini->Nm_lang['lang_mnth_dece']);
      $_SESSION['scriptcase']['sc_tab_meses']['abr'] = array(
                                      $this->Ini->Nm_lang['lang_shrt_mnth_janu'],
                                      $this->Ini->Nm_lang['lang_shrt_mnth_febr'],
                                      $this->Ini->Nm_lang['lang_shrt_mnth_marc'],
                                      $this->Ini->Nm_lang['lang_shrt_mnth_apri'],
                                      $this->Ini->Nm_lang['lang_shrt_mnth_mayy'],
                                      $this->Ini->Nm_lang['lang_shrt_mnth_june'],
                                      $this->Ini->Nm_lang['lang_shrt_mnth_july'],
                                      $this->Ini->Nm_lang['lang_shrt_mnth_augu'],
                                      $this->Ini->Nm_lang['lang_shrt_mnth_sept'],
                                      $this->Ini->Nm_lang['lang_shrt_mnth_octo'],
                                      $this->Ini->Nm_lang['lang_shrt_mnth_nove'],
                                      $this->Ini->Nm_lang['lang_shrt_mnth_dece']);
      $_SESSION['scriptcase']['sc_tab_dias']['int'] = array(
                                      $this->Ini->Nm_lang['lang_days_sund'],
                                      $this->Ini->Nm_lang['lang_days_mond'],
                                      $this->Ini->Nm_lang['lang_days_tued'],
                                      $this->Ini->Nm_lang['lang_days_wend'],
                                      $this->Ini->Nm_lang['lang_days_thud'],
                                      $this->Ini->Nm_lang['lang_days_frid'],
                                      $this->Ini->Nm_lang['lang_days_satd']);
      $_SESSION['scriptcase']['sc_tab_dias']['abr'] = array(
                                      $this->Ini->Nm_lang['lang_shrt_days_sund'],
                                      $this->Ini->Nm_lang['lang_shrt_days_mond'],
                                      $this->Ini->Nm_lang['lang_shrt_days_tued'],
                                      $this->Ini->Nm_lang['lang_shrt_days_wend'],
                                      $this->Ini->Nm_lang['lang_shrt_days_thud'],
                                      $this->Ini->Nm_lang['lang_shrt_days_frid'],
                                      $this->Ini->Nm_lang['lang_shrt_days_satd']);
      nm_gc($this->Ini->path_libs);
      $this->Ini->Gd_missing  = true;
      if(function_exists("getProdVersion"))
      {
         $_SESSION['scriptcase']['sc_prod_Version'] = str_replace(".", "", getProdVersion($this->Ini->path_libs));
         if(function_exists("gd_info"))
         {
            $this->Ini->Gd_missing = false;
         }
      }
      $this->Ini->sc_Include($this->Ini->path_lib_php . "/nm_trata_img.php", "C", "nm_trata_img") ; 
      if (isset($_GET['nm_cal_display']))
      {
          if ($this->Embutida_proc)
          { 
              include_once($this->Ini->path_embutida . 'validate_wastetransactions/validate_wastetransactions_mob_calendar.php');
          }
          else
          { 
              include_once($this->Ini->path_aplicacao . 'validate_wastetransactions_mob_calendar.php');
          }
          exit;
      }

      if (is_file($this->Ini->path_aplicacao . 'validate_wastetransactions_mob_help.txt'))
      {
          $arr_link_webhelp = file($this->Ini->path_aplicacao . 'validate_wastetransactions_mob_help.txt');
          if ($arr_link_webhelp)
          {
              foreach ($arr_link_webhelp as $str_link_webhelp)
              {
                  $str_link_webhelp = trim($str_link_webhelp);
                  if ('form:' == substr($str_link_webhelp, 0, 5))
                  {
                      $arr_link_parts = explode(':', $str_link_webhelp);
                      if ('' != $arr_link_parts[1] && is_file($this->Ini->root . $this->Ini->path_help . $arr_link_parts[1]))
                      {
                          $this->url_webhelp = $this->Ini->path_help . $arr_link_parts[1];
                      }
                  }
              }
          }
      }

      if (is_dir($this->Ini->path_aplicacao . 'img'))
      {
          $Res_dir_img = @opendir($this->Ini->path_aplicacao . 'img');
          if ($Res_dir_img)
          {
              while (FALSE !== ($Str_arquivo = @readdir($Res_dir_img))) 
              {
                 if (@is_file($this->Ini->path_aplicacao . 'img/' . $Str_arquivo) && '.' != $Str_arquivo && '..' != $this->Ini->path_aplicacao . 'img/' . $Str_arquivo)
                 {
                     @unlink($this->Ini->path_aplicacao . 'img/' . $Str_arquivo);
                 }
              }
          }
          @closedir($Res_dir_img);
          rmdir($this->Ini->path_aplicacao . 'img');
      }

      if ($this->Embutida_proc)
      { 
          require_once($this->Ini->path_embutida . 'validate_wastetransactions/validate_wastetransactions_mob_erro.class.php');
      }
      else
      { 
          require_once($this->Ini->path_aplicacao . "validate_wastetransactions_mob_erro.class.php"); 
      }
      $this->Erro      = new validate_wastetransactions_mob_erro();
      $this->Erro->Ini = $this->Ini;
      $this->proc_fast_search = false;
      if ($this->nmgp_opcao == "fast_search")  
      {
          $this->SC_fast_search($this->nmgp_fast_search, $this->nmgp_cond_fast_search, $this->nmgp_arg_fast_search);
          $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['opcao'] = "inicio";
          $this->nmgp_opcao = "inicio";
          $this->proc_fast_search = true;
      } 
      if ($nm_opc_lookup != "lookup" && $nm_opc_php != "formphp")
      { 
         if (empty($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['opcao']))
         { 
             if ($this->wtid != "")   
             { 
                 $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['opcao'] = "igual" ;  
             }   
         }   
      } 
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['opcao']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['opcao']) && empty($this->nmgp_refresh_fields))
      {
          $this->nmgp_opcao = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['opcao'];  
          $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['opcao'] = "" ;  
          if ($this->nmgp_opcao == "edit_novo")  
          {
             $this->nmgp_opcao = "novo";
             $this->nm_flag_saida_novo = "S";
          }
      } 
      $this->nm_Start_new = false;
      if (isset($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['start']) && $_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['start'] == 'new')
      {
          $this->nmgp_opcao = "novo";
          $this->nm_Start_new = true;
          $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['opcao'] = "novo";
          unset($_SESSION['scriptcase']['sc_apl_conf']['validate_wastetransactions_mob']['start']);
      }
      if ($this->nmgp_opcao == "igual")  
      {
          $this->nmgp_opc_ant = $this->nmgp_opcao;
      } 
      else
      {
          $this->nmgp_opc_ant = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['opc_ant'];
      } 
      if ($this->nmgp_opcao == "novo")  
      {
          $this->nmgp_botoes['sc_btn_0'] = "off";
      }
      elseif ($this->nmgp_opcao == "incluir")  
      {
          $this->nmgp_botoes['sc_btn_0'] = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['botoes']['sc_btn_0'];
      }
      if ($this->nmgp_opcao == "recarga" || $this->nmgp_opcao == "muda_form")  
      {
          $this->nmgp_botoes = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['botoes'];
          $this->Nav_permite_ret = 0 != $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['inicio'];
          $this->Nav_permite_ava = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['total'] != $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['final'];
      }
      else
      {
      }
      $this->nm_flag_iframe = false;
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_form'])) 
      {
         $this->nmgp_dados_form = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_form'];
      }
      if ($this->nmgp_opcao == "edit_novo")  
      {
          $this->nmgp_opcao = "novo";
          $this->nm_flag_saida_novo = "S";
      }
//
      $this->sc_evento = $this->nmgp_opcao;
      $this->sc_insert_on = false;
      if (!isset($this->NM_ajax_flag) || ('validate_' != substr($this->NM_ajax_opcao, 0, 9) && 'add_new_line' != $this->NM_ajax_opcao))
      {
      $_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'on';
if (!isset($this->sc_temp_glo_module)) {$this->sc_temp_glo_module = (isset($_SESSION['glo_module'])) ? $_SESSION['glo_module'] : "";}
                         
if ($this->sc_temp_glo_module == '2')     
{
	$this->sc_field_readonly("wttransporterid", 'on');
	$this->sc_field_readonly("wttransportdate", 'off');
   	$this->sc_field_readonly("wttransporterid", 'on');
   	$this->sc_field_readonly("wttransporterperiferiaid", 'on');
   	$this->sc_field_readonly("wttransporterewc", 'on');
   	$this->sc_field_readonly("wttransportervechicle", 'off');
   	$this->sc_field_readonly("wttransportervalidate", 'off');
   	$this->sc_field_readonly("wttransportervalidateip", 'off');
	  $this->sc_field_readonly("wttransportersign", 'off');
  	
   $this->sc_field_readonly("wtrequestdate", 'on');
   $this->sc_field_readonly("wtproducerbranchid", 'on');
   $this->sc_field_readonly("wtproducerperiferia", 'on');
   $this->sc_field_readonly("wtproducerewc", 'on');
   $this->sc_field_readonly("wtproduceracceptweigth", 'on');
   $this->sc_field_readonly("wtproducerqty", 'on');
   $this->sc_field_readonly("wtprducerm3", 'on');
   $this->sc_field_readonly("wtproducerremarks", 'on');
   $this->sc_field_readonly("wtproducervalidate", 'on');
   $this->sc_field_readonly("wtproducersign", 'on');
	
	$this->sc_field_readonly("wtfdestdate", 'on');
    $this->sc_field_readonly("wtfdestid", 'on');
    $this->sc_field_readonly("wtfdestperiferia", 'on');
    $this->sc_field_readonly("wtfdestewc", 'on');
    $this->sc_field_readonly("wtfdestrd", 'on');
    $this->sc_field_readonly("wtfdestqty", 'on');
    $this->sc_field_readonly("wtfdestm3", 'on');
    $this->sc_field_readonly("wtfdestvlidated", 'on');
    $this->sc_field_readonly("wtfdestvalidateip", 'on');
    $this->sc_field_readonly("wtfdestsign", 'on');
  
}	
if ($this->sc_temp_glo_module == '3')     
{
	$this->sc_field_readonly("wttransporterid", 'on');
	$this->sc_field_readonly("wttransportdate", 'on');
   	$this->sc_field_readonly("wttransporterid", 'on');
   	$this->sc_field_readonly("wttransporterperiferiaid", 'on');
   	$this->sc_field_readonly("wttransporterewc", 'on');
   	$this->sc_field_readonly("wttransportervechicle", 'on');
   	$this->sc_field_readonly("wttransportervalidate", 'on');
   	$this->sc_field_readonly("wttransportervalidateip", 'on');
	  $this->sc_field_readonly("wttransportersign", 'on');
  	
   $this->sc_field_readonly("wtrequestdate", 'on');
   $this->sc_field_readonly("wtproducerbranchid", 'on');
   $this->sc_field_readonly("wtproducerperiferia", 'on');
   $this->sc_field_readonly("wtproducerewc", 'on');
   $this->sc_field_readonly("wtproduceracceptweigth", 'on');
   $this->sc_field_readonly("wtproducerqty", 'on');
   $this->sc_field_readonly("wtprducerm3", 'on');
   $this->sc_field_readonly("wtproducerremarks", 'on');
   $this->sc_field_readonly("wtproducervalidate", 'on');
   $this->sc_field_readonly("wtproducersign", 'on');
	
	$this->sc_field_readonly("wtfdestdate", 'off');
    $this->sc_field_readonly("wtfdestid", 'on');
    $this->sc_field_readonly("wtfdestperiferia", 'on');
    $this->sc_field_readonly("wtfdestewc", 'on');
    $this->sc_field_readonly("wtfdestrd", 'off');
    $this->sc_field_readonly("wtfdestqty", 'off');
    $this->sc_field_readonly("wtfdestm3", 'off');
    $this->sc_field_readonly("wtfdestvlidated", 'off');
    $this->sc_field_readonly("wtfdestvalidateip", 'off');
    $this->sc_field_readonly("wtfdestsign", 'off');
 }		
 if ($this->sc_temp_glo_module == '1')     
{
	$this->sc_field_readonly("wttransporterid", 'on');
	$this->sc_field_readonly("wttransportdate", 'on');
   	$this->sc_field_readonly("wttransporterid", 'on');
   	$this->sc_field_readonly("wttransporterperiferiaid", 'on');
   	$this->sc_field_readonly("wttransporterewc", 'on');
   	$this->sc_field_readonly("wttransportervechicle", 'on');
   	$this->sc_field_readonly("wttransportervalidate", 'on');
   	$this->sc_field_readonly("wttransportervalidateip", 'on');
	  $this->sc_field_readonly("wttransportersign", 'on');
  	
   $this->sc_field_readonly("wtrequestdate", 'off');
   $this->sc_field_readonly("wtproducerbranchid", 'off');
   $this->sc_field_readonly("wtproducerperiferia", 'off');
   $this->sc_field_readonly("wtproducerewc", 'off');
   $this->sc_field_readonly("wtproduceracceptweigth", 'off');
   $this->sc_field_readonly("wtproducerqty", 'off');
   $this->sc_field_readonly("wtprducerm3", 'off');
   $this->sc_field_readonly("wtproducerremarks", 'off');
   $this->sc_field_readonly("wtproducervalidate", 'off');
   $this->sc_field_readonly("wtproducersign", 'off');
	
	$this->sc_field_readonly("wtfdestdate", 'on');
    $this->sc_field_readonly("wtfdestid", 'on');
    $this->sc_field_readonly("wtfdestperiferia", 'on');
    $this->sc_field_readonly("wtfdestewc", 'on');
    $this->sc_field_readonly("wtfdestrd", 'on');
    $this->sc_field_readonly("wtfdestqty", 'on');
    $this->sc_field_readonly("wtfdestm3", 'on');
    $this->sc_field_readonly("wtfdestvlidated", 'on');
    $this->sc_field_readonly("wtfdestvalidateip", 'on');
    $this->sc_field_readonly("wtfdestsign", 'on');
 }
if (isset($this->sc_temp_glo_module)) { $_SESSION['glo_module'] = $this->sc_temp_glo_module;}
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'off'; 
      }
      if (isset($this->wtproducerbranchid)) { $this->nm_limpa_alfa($this->wtproducerbranchid); }
      if (isset($this->wtproducerperiferia)) { $this->nm_limpa_alfa($this->wtproducerperiferia); }
      if (isset($this->wtproduceracceptweigth)) { $this->nm_limpa_alfa($this->wtproduceracceptweigth); }
      if (isset($this->wtproducerewc)) { $this->nm_limpa_alfa($this->wtproducerewc); }
      if (isset($this->wtproducerqty)) { $this->nm_limpa_alfa($this->wtproducerqty); }
      if (isset($this->wtprducerm3)) { $this->nm_limpa_alfa($this->wtprducerm3); }
      if (isset($this->wtproducerremarks)) { $this->nm_limpa_alfa($this->wtproducerremarks); }
      if (isset($this->wttransporterid)) { $this->nm_limpa_alfa($this->wttransporterid); }
      if (isset($this->wttransportervechicle)) { $this->nm_limpa_alfa($this->wttransportervechicle); }
      if (isset($this->envregistrationno_transporter)) { $this->nm_limpa_alfa($this->envregistrationno_transporter); }
      if (isset($this->wttransporternumberid)) { $this->nm_limpa_alfa($this->wttransporternumberid); }
      if (isset($this->wtwasteid)) { $this->nm_limpa_alfa($this->wtwasteid); }
      if (isset($this->wtequipment)) { $this->nm_limpa_alfa($this->wtequipment); }
      if (isset($this->wtfdestid)) { $this->nm_limpa_alfa($this->wtfdestid); }
      if (isset($this->wtfdestperiferia)) { $this->nm_limpa_alfa($this->wtfdestperiferia); }
      if (isset($this->wtfdestewc)) { $this->nm_limpa_alfa($this->wtfdestewc); }
      if (isset($this->wtfdestrd)) { $this->nm_limpa_alfa($this->wtfdestrd); }
      if (isset($this->wtfdestqty)) { $this->nm_limpa_alfa($this->wtfdestqty); }
      if (isset($this->wtfdestm3)) { $this->nm_limpa_alfa($this->wtfdestm3); }
      if (isset($this->envregistrationno_fdest)) { $this->nm_limpa_alfa($this->envregistrationno_fdest); }
      $Campos_Crit       = "";
      $Campos_erro       = "";
      $Campos_Falta      = array();
      $Campos_Erros      = array();
      $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; 
      $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['opc_edit'] = true;  
     if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_select'])) 
     {
        $this->nmgp_dados_select = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_select'];
     }
   }

   function loadFieldConfig()
   {
      $this->field_config = array();
      //-- wtrequestdate
      $this->field_config['wtrequestdate']                 = array();
      $this->field_config['wtrequestdate']['date_format']  = $_SESSION['scriptcase']['reg_conf']['date_format'];
      $this->field_config['wtrequestdate']['date_sep']     = $_SESSION['scriptcase']['reg_conf']['date_sep'];
      $this->field_config['wtrequestdate']['date_display'] = "ddmmaaaa";
      $this->new_date_format('DT', 'wtrequestdate');
      //-- wtproducerqty
      $this->field_config['wtproducerqty']               = array();
      $this->field_config['wtproducerqty']['symbol_grp'] = '';
      $this->field_config['wtproducerqty']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['wtproducerqty']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_num'];
      $this->field_config['wtproducerqty']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['wtproducerqty']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- wtprducerm3
      $this->field_config['wtprducerm3']               = array();
      $this->field_config['wtprducerm3']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['wtprducerm3']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['wtprducerm3']['symbol_dec'] = '';
      $this->field_config['wtprducerm3']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['wtprducerm3']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- wttransportdate
      $this->field_config['wttransportdate']                 = array();
      $this->field_config['wttransportdate']['date_format']  = $_SESSION['scriptcase']['reg_conf']['date_format'];
      $this->field_config['wttransportdate']['date_sep']     = $_SESSION['scriptcase']['reg_conf']['date_sep'];
      $this->field_config['wttransportdate']['date_display'] = "ddmmaaaa";
      $this->new_date_format('DT', 'wttransportdate');
      //-- wtfdestdate
      $this->field_config['wtfdestdate']                 = array();
      $this->field_config['wtfdestdate']['date_format']  = $_SESSION['scriptcase']['reg_conf']['date_format'];
      $this->field_config['wtfdestdate']['date_sep']     = $_SESSION['scriptcase']['reg_conf']['date_sep'];
      $this->field_config['wtfdestdate']['date_display'] = "ddmmaaaa";
      $this->new_date_format('DT', 'wtfdestdate');
      //-- wtfdestqty
      $this->field_config['wtfdestqty']               = array();
      $this->field_config['wtfdestqty']['symbol_grp'] = '';
      $this->field_config['wtfdestqty']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['wtfdestqty']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_num'];
      $this->field_config['wtfdestqty']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['wtfdestqty']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- wtfdestm3
      $this->field_config['wtfdestm3']               = array();
      $this->field_config['wtfdestm3']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['wtfdestm3']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['wtfdestm3']['symbol_dec'] = '';
      $this->field_config['wtfdestm3']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['wtfdestm3']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- wtid
      $this->field_config['wtid']               = array();
      $this->field_config['wtid']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['wtid']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['wtid']['symbol_dec'] = '';
      $this->field_config['wtid']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['wtid']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- wtprofilid
      $this->field_config['wtprofilid']               = array();
      $this->field_config['wtprofilid']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['wtprofilid']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['wtprofilid']['symbol_dec'] = '';
      $this->field_config['wtprofilid']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['wtprofilid']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- intnumber
      $this->field_config['intnumber']               = array();
      $this->field_config['intnumber']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['intnumber']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['intnumber']['symbol_dec'] = '';
      $this->field_config['intnumber']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['intnumber']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- wttransporterperiferiaid
      $this->field_config['wttransporterperiferiaid']               = array();
      $this->field_config['wttransporterperiferiaid']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['wttransporterperiferiaid']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['wttransporterperiferiaid']['symbol_dec'] = '';
      $this->field_config['wttransporterperiferiaid']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['wttransporterperiferiaid']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
   }

   function controle()
   {
        global $nm_url_saida, $teste_validade, 
               $glo_senha_protect, $nm_apl_dependente, $nm_form_submit, $sc_check_excl, $nm_opc_form_php, $nm_call_php, $nm_opc_lookup;


      $this->ini_controle();
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Gera_log_access'])
      {
          $this->NM_gera_log_insert("Scriptcase", "access");
          $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Gera_log_access'] = false;
      }

      if ('' != $_SESSION['scriptcase']['change_regional_old'])
      {
          $_SESSION['scriptcase']['str_conf_reg'] = $_SESSION['scriptcase']['change_regional_old'];
          $this->Ini->regionalDefault($_SESSION['scriptcase']['str_conf_reg']);
          $this->loadFieldConfig();
          $this->nm_tira_formatacao();

          $_SESSION['scriptcase']['str_conf_reg'] = $_SESSION['scriptcase']['change_regional_new'];
          $this->Ini->regionalDefault($_SESSION['scriptcase']['str_conf_reg']);
          $this->loadFieldConfig();
          $guarda_formatado = $this->formatado;
          $this->nm_formatar_campos();
          $this->formatado = $guarda_formatado;

          $_SESSION['scriptcase']['change_regional_old'] = '';
          $_SESSION['scriptcase']['change_regional_new'] = '';
      }

      if (!$this->NM_ajax_flag || 'alterar' != $this->nmgp_opcao || 'submit_form' != $this->NM_ajax_opcao)
      {
      }
//
//-----> 
//
      if ($this->NM_ajax_flag && 'validate_' == substr($this->NM_ajax_opcao, 0, 9))
      {
          if ('validate_wtrequestdate' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wtrequestdate');
          }
          if ('validate_wtproducerbranchid' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wtproducerbranchid');
          }
          if ('validate_producerb_address' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'producerb_address');
          }
          if ('validate_prbrresponse' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'prbrresponse');
          }
          if ('validate_pphone' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'pphone');
          }
          if ('validate_premail' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'premail');
          }
          if ('validate_wtproducerewc' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wtproducerewc');
          }
          if ('validate_ewctitle' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'ewctitle');
          }
          if ('validate_wtproducerperiferia' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wtproducerperiferia');
          }
          if ('validate_wtproduceracceptweigth' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wtproduceracceptweigth');
          }
          if ('validate_wtproducerqty' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wtproducerqty');
          }
          if ('validate_wtprducerm3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wtprducerm3');
          }
          if ('validate_wtproducersign' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wtproducersign');
          }
          if ('validate_wttransportdate' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wttransportdate');
          }
          if ('validate_wttransporternumberid' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wttransporternumberid');
          }
          if ('validate_wttransportervechicle' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wttransportervechicle');
          }
          if ('validate_wttransporterid' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wttransporterid');
          }
          if ('validate_envregistrationno_transporter' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'envregistrationno_transporter');
          }
          if ('validate_transporterresponse' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'transporterresponse');
          }
          if ('validate_transporteremail' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'transporteremail');
          }
          if ('validate_transporterphone' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'transporterphone');
          }
          if ('validate_transporterfax' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'transporterfax');
          }
          if ('validate_checktransvsproducer' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'checktransvsproducer');
          }
          if ('validate_checktransportervsfdest' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'checktransportervsfdest');
          }
          if ('validate_wtwasteid' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wtwasteid');
          }
          if ('validate_wtequipment' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wtequipment');
          }
          if ('validate_wttransportersign' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wttransportersign');
          }
          if ('validate_wtfdestdate' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wtfdestdate');
          }
          if ('validate_wtfdestid' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wtfdestid');
          }
          if ('validate_wtfdestperiferia' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wtfdestperiferia');
          }
          if ('validate_envregistrationno_fdest' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'envregistrationno_fdest');
          }
          if ('validate_fdestaddress' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'fdestaddress');
          }
          if ('validate_fdestrespone' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'fdestrespone');
          }
          if ('validate_fdestphone' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'fdestphone');
          }
          if ('validate_fdestresponseemail' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'fdestresponseemail');
          }
          if ('validate_wtfdestewc' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wtfdestewc');
          }
          if ('validate_fdewctitle' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'fdewctitle');
          }
          if ('validate_wtfdestrd' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wtfdestrd');
          }
          if ('validate_wtfdestqty' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wtfdestqty');
          }
          if ('validate_wtfdestm3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wtfdestm3');
          }
          if ('validate_wtfdestsign' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wtfdestsign');
          }
          if ('validate_wtproducerremarks' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wtproducerremarks');
          }
          validate_wastetransactions_mob_pack_ajax_response();
          exit;
      }
      if ($this->NM_ajax_flag && 'event_' == substr($this->NM_ajax_opcao, 0, 6))
      {
          $this->nm_tira_formatacao();
          $this->nm_converte_datas();
          if ('event_wtfdestewc_onchange' == $this->NM_ajax_opcao)
          {
              $this->wtFDestEWC_onChange();
          }
          if ('event_wtfdestid_onchange' == $this->NM_ajax_opcao)
          {
              $this->wtFDestID_onChange();
          }
          if ('event_wtfdestid_onclick' == $this->NM_ajax_opcao)
          {
              $this->wtFDestID_onClick();
          }
          if ('event_wtproducerbranchid_onchange' == $this->NM_ajax_opcao)
          {
              $this->wtProducerBranchID_onChange();
          }
          if ('event_wtproducerbranchid_onclick' == $this->NM_ajax_opcao)
          {
              $this->wtProducerBranchID_onClick();
          }
          if ('event_wtproducerewc_onchange' == $this->NM_ajax_opcao)
          {
              $this->wtProducerEwc_onChange();
          }
          if ('event_wttransporterid_onchange' == $this->NM_ajax_opcao)
          {
              $this->wtTransporterID_onChange();
          }
          validate_wastetransactions_mob_pack_ajax_response();
          exit;
      }
      if (isset($this->sc_inline_call) && 'Y' == $this->sc_inline_call)
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['inline_form_seq'] = $this->sc_seq_row;
          $this->nm_tira_formatacao();
          $this->nm_converte_datas();
      }
      if ($this->nmgp_opcao == "recarga" || $this->nmgp_opcao == "muda_form") 
      {
          if (is_array($this->wtproduceracceptweigth))
          {
              $x = 0; 
              $this->wtproduceracceptweigth_1 = $this->wtproduceracceptweigth;
              $this->wtproduceracceptweigth = ""; 
              if ($this->wtproduceracceptweigth_1 != "") 
              { 
                  foreach ($this->wtproduceracceptweigth_1 as $dados_wtproduceracceptweigth_1 ) 
                  { 
                      if ($x != 0)
                      { 
                          $this->wtproduceracceptweigth .= ";";
                      } 
                      $this->wtproduceracceptweigth .= $dados_wtproduceracceptweigth_1;
                      $x++ ; 
                  } 
              } 
          } 
          if (is_array($this->wttransportervalidate))
          {
              $x = 0; 
              $this->wttransportervalidate_1 = $this->wttransportervalidate;
              $this->wttransportervalidate = ""; 
              if ($this->wttransportervalidate_1 != "") 
              { 
                  foreach ($this->wttransportervalidate_1 as $dados_wttransportervalidate_1 ) 
                  { 
                      if ($x != 0)
                      { 
                          $this->wttransportervalidate .= ";";
                      } 
                      $this->wttransportervalidate .= $dados_wttransportervalidate_1;
                      $x++ ; 
                  } 
              } 
          } 
          $this->upload_img_doc($Campos_Crit, $Campos_Falta, $Campos_Erros) ; 
          $this->nm_tira_formatacao();
          $this->nm_converte_datas();
          $nm_sc_sv_opcao = $this->nmgp_opcao; 
          $this->nmgp_opcao = "nada"; 
          $this->nm_acessa_banco();
          if ($this->NM_ajax_flag)
          {
              $this->ajax_return_values();
              validate_wastetransactions_mob_pack_ajax_response();
              exit;
          }
          $this->nm_formatar_campos();
          $this->nmgp_opcao = $nm_sc_sv_opcao; 
          $this->nm_gera_html();
          $this->NM_close_db(); 
          $this->nmgp_opcao = ""; 
          exit; 
      }
      if ($this->nmgp_opcao == "incluir" || $this->nmgp_opcao == "alterar" || $this->nmgp_opcao == "excluir") 
      {
          $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros) ; 
          $_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'off';
          if ($Campos_Crit != "") 
          {
              $Campos_Crit = $this->Ini->Nm_lang['lang_errm_flds'] . ' ' . $Campos_Crit ; 
          }
          if ($Campos_Crit != "" || !empty($Campos_Falta) || $this->Campos_Mens_erro != "")
          {
              if ($this->NM_ajax_flag)
              {
                  validate_wastetransactions_mob_pack_ajax_response();
                  exit;
              }
              $campos_erro = $this->Formata_Erros($Campos_Crit, $Campos_Falta, $Campos_Erros);
              $this->Campos_Mens_erro = ""; 
              $this->Erro->mensagem(__FILE__, __LINE__, "critica", $campos_erro); 
              $this->nmgp_opc_ant = $this->nmgp_opcao ; 
              if ($this->nmgp_opcao == "incluir" && $nm_apl_dependente == 1) 
              { 
                  $this->nm_flag_saida_novo = "S";; 
              }
              if ($this->nmgp_opcao == "incluir") 
              { 
                  $GLOBALS["erro_incl"] = 1; 
              }
              $this->nmgp_opcao = "nada" ; 
          }
      }
      elseif (isset($nm_form_submit) && $this->nmgp_opcao != "menu_link")
      {
      }
//
      if ($this->nmgp_opcao != "nada")
      {
          $this->nm_acessa_banco();
      }
      else
      {
           if ($this->nmgp_opc_ant == "incluir") 
           { 
               $this->nm_proc_onload(false);
           }
           else
           { 
              $this->nm_guardar_campos();
           }
      }
      if ($this->nmgp_opcao != "recarga" && $this->nmgp_opcao != "muda_form" && !$this->Apl_com_erro)
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['recarga'] = $this->nmgp_opcao;
          if ($this->sc_evento == "update")
          {
              $this->NM_close_db(); 
              $this->nmgp_redireciona(2); 
          }
          if ($this->sc_evento == "insert" || ($this->nmgp_opc_ant == "novo" && $this->nmgp_opcao == "novo" && $this->sc_evento == "novo"))
          {
              $this->NM_close_db(); 
              $this->nmgp_redireciona(2); 
          }
          if ($this->sc_evento == "delete")
          {
              $this->NM_close_db(); 
              $this->nmgp_redireciona(2); 
          }
      }
      if ($this->NM_ajax_flag && 'navigate_form' == $this->NM_ajax_opcao)
      {
          $this->ajax_return_values();
          $this->ajax_add_parameters();
          validate_wastetransactions_mob_pack_ajax_response();
          exit;
      }
      $this->nm_formatar_campos();
      if ($this->NM_ajax_flag)
      {
          $this->NM_ajax_info['result'] = 'OK';
          if ('alterar' == $this->NM_ajax_info['param']['nmgp_opcao'])
          {
              $this->NM_ajax_info['msgDisplay'] = NM_charset_to_utf8($this->Ini->Nm_lang['lang_othr_ajax_frmu']);
          }
          validate_wastetransactions_mob_pack_ajax_response();
          exit;
      }
      $this->nm_gera_html();
      $this->NM_close_db(); 
      $this->nmgp_opcao = ""; 
      if ($this->Change_Menu)
      {
          $apl_menu  = $_SESSION['scriptcase']['menu_atual'];
          $Arr_rastro = array();
          if (isset($_SESSION['scriptcase']['menu_apls'][$apl_menu][$this->sc_init_menu]) && count($_SESSION['scriptcase']['menu_apls'][$apl_menu][$this->sc_init_menu]) > 1)
          {
              foreach ($_SESSION['scriptcase']['menu_apls'][$apl_menu][$this->sc_init_menu] as $menu => $apls)
              {
                 $Arr_rastro[] = "'<a href=\"" . $apls['link'] . "?script_case_init=" . $this->sc_init_menu . "&script_case_session=" . session_id() . "\" target=\"#NMIframe#\">" . $apls['label'] . "</a>'";
              }
              $ult_apl = count($Arr_rastro) - 1;
              unset($Arr_rastro[$ult_apl]);
              $rastro = implode(",", $Arr_rastro);
?>
  <script type="text/javascript">
     link_atual = new Array (<?php echo $rastro ?>);
     parent.writeFastMenu(link_atual);
  </script>
<?php
          }
          else
          {
?>
  <script type="text/javascript">
     parent.clearFastMenu();
  </script>
<?php
          }
      }
   }
//
//--------------------------------------------------------------------------------------
   function NM_has_trans()
   {
       return !in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access);
   }
//
//--------------------------------------------------------------------------------------
   function NM_commit_db()
   {
       if ($this->Ini->sc_tem_trans_banco && !$this->Embutida_proc)
       { 
           $this->Db->CommitTrans(); 
           $this->Ini->sc_tem_trans_banco = false;
       } 
       if ($this->SC_log_atv)
       {
           $this->NM_gera_log_output();
       }
   }
//
//--------------------------------------------------------------------------------------
   function NM_rollback_db()
   {
       if ($this->Ini->sc_tem_trans_banco && !$this->Embutida_proc)
       { 
           $this->Db->RollbackTrans(); 
           $this->Ini->sc_tem_trans_banco = false;
       } 
   }
//
//--------------------------------------------------------------------------------------
   function NM_gera_log_insert($orig="Scriptcase", $evento="", $texto="")
   {
       $dt  = "'" . date('Y-m-d H:i:s') . "'";
       $usr = isset($_SESSION['usr_login']) ? $_SESSION['usr_login'] : "";
       if (in_array(strtolower($_SESSION['scriptcase']['glo_tpbanco']), $this->Ini->nm_bases_sqlite))
       { 
           $comando = "INSERT INTO sc_log (id, inserted_date, username, application, creator, ip_user, action, description) VALUES (NULL, $dt, " . $this->Db->qstr($usr) . ", 'validate_wastetransactions_mob', '$orig', '" . $_SERVER['REMOTE_ADDR'] . "', '$evento', " . $this->Db->qstr($texto) . ")"; 
       } 
       else
       { 
           $comando = "INSERT INTO sc_log (inserted_date, username, application, creator, ip_user, action, description) VALUES ($dt, " . $this->Db->qstr($usr) . ", 'validate_wastetransactions_mob', '$orig', '" . $_SERVER['REMOTE_ADDR'] . "', '$evento', " . $this->Db->qstr($texto) . ")"; 
       } 
       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $comando; 
       $rlog = $this->Db->Execute($comando); 
       if ($rlog === false)  
       { 
           $this->Erro->mensagem (__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_inst'], $this->Db->ErrorMsg()); 
           if ($this->NM_ajax_flag)
           {
               validate_wastetransactions_mob_pack_ajax_response();
               exit; 
           }
       }
   }
//
//--------------------------------------------------------------------------------------
   function NM_close_db()
   {
       if ($this->Db && !$this->Embutida_proc)
       { 
           $this->Db->Close(); 
       } 
   }
//
//--------------------------------------------------------------------------------------
   function Formata_Erros($Campos_Crit, $Campos_Falta, $Campos_Erros, $mode = 3) 
   {
       switch ($mode)
       {
           case 1:
               $campos_erro = array();
               if (!empty($Campos_Crit))
               {
                   $campos_erro[] = $Campos_Crit;
               }
               if (!empty($Campos_Falta))
               {
                   $campos_erro[] = $this->Formata_Campos_Falta($Campos_Falta);
               }
               if (!empty($this->Campos_Mens_erro))
               {
                   $campos_erro[] = $this->Campos_Mens_erro;
               }
               return implode('<br />', $campos_erro);
               break;

           case 2:
               $campos_erro = array();
               if (!empty($Campos_Crit))
               {
                   $campos_erro[] = $Campos_Crit;
               }
               if (!empty($Campos_Falta))
               {
                   $campos_erro[] = $this->Formata_Campos_Falta($Campos_Falta, true);
               }
               if (!empty($this->Campos_Mens_erro))
               {
                   $campos_erro[] = $this->Campos_Mens_erro;
               }
               return implode('<br />', $campos_erro);
               break;

           case 3:
               $campos_erro = array();
               if (!empty($Campos_Erros))
               {
                   $campos_erro[] = $this->Formata_Campos_Erros($Campos_Erros);
               }
               if (!empty($this->Campos_Mens_erro))
               {
                   $campos_mens_erro = str_replace(array('<br />', '<br>', '<BR />'), array('<BR>', '<BR>', '<BR>'), $this->Campos_Mens_erro);
                   $campos_mens_erro = explode('<BR>', $campos_mens_erro);
                   foreach ($campos_mens_erro as $msg_erro)
                   {
                       if ('' != $msg_erro && !in_array($msg_erro, $campos_erro))
                       {
                           $campos_erro[] = $msg_erro;
                       }
                   }
               }
               return implode('<br />', $campos_erro);
               break;
       }
   }

   function Formata_Campos_Falta($Campos_Falta, $table = false) 
   {
       $Campos_Falta = array_unique($Campos_Falta);

       if (!$table)
       {
           return $this->Ini->Nm_lang['lang_errm_reqd'] . ' ' . implode('; ', $Campos_Falta);
       }

       $aCols  = array();
       $iTotal = sizeof($Campos_Falta);
       $iCols  = 6 > $iTotal ? 1 : (11 > $iTotal ? 2 : (16 > $iTotal ? 3 : 4));
       $iItems = ceil($iTotal / $iCols);
       $iNowC  = 0;
       $iNowI  = 0;

       foreach ($Campos_Falta as $campo)
       {
           $aCols[$iNowC][] = $campo;
           if ($iItems == ++$iNowI)
           {
               $iNowC++;
               $iNowI = 0;
           }
       }

       $sError  = '<table style="border-collapse: collapse; border-width: 0px">';
       $sError .= '<tr>';
       $sError .= '<td class="scFormErrorMessageFont" style="padding: 0; vertical-align: top; white-space: nowrap">' . $this->Ini->Nm_lang['lang_errm_reqd'] . '</td>';
       foreach ($aCols as $aCol)
       {
           $sError .= '<td class="scFormErrorMessageFont" style="padding: 0 6px; vertical-align: top; white-space: nowrap">' . implode('<br />', $aCol) . '</td>';
       }
       $sError .= '</tr>';
       $sError .= '</table>';

       return $sError;
   }

   function Formata_Campos_Crit($Campos_Crit, $table = false) 
   {
       $Campos_Crit = array_unique($Campos_Crit);

       if (!$table)
       {
           return $this->Ini->Nm_lang['lang_errm_flds'] . ' ' . implode('; ', $Campos_Crit);
       }

       $aCols  = array();
       $iTotal = sizeof($Campos_Crit);
       $iCols  = 6 > $iTotal ? 1 : (11 > $iTotal ? 2 : (16 > $iTotal ? 3 : 4));
       $iItems = ceil($iTotal / $iCols);
       $iNowC  = 0;
       $iNowI  = 0;

       foreach ($Campos_Crit as $campo)
       {
           $aCols[$iNowC][] = $campo;
           if ($iItems == ++$iNowI)
           {
               $iNowC++;
               $iNowI = 0;
           }
       }

       $sError  = '<table style="border-collapse: collapse; border-width: 0px">';
       $sError .= '<tr>';
       $sError .= '<td class="scFormErrorMessageFont" style="padding: 0; vertical-align: top; white-space: nowrap">' . $this->Ini->Nm_lang['lang_errm_flds'] . '</td>';
       foreach ($aCols as $aCol)
       {
           $sError .= '<td class="scFormErrorMessageFont" style="padding: 0 6px; vertical-align: top; white-space: nowrap">' . implode('<br />', $aCol) . '</td>';
       }
       $sError .= '</tr>';
       $sError .= '</table>';

       return $sError;
   }

   function Formata_Campos_Erros($Campos_Erros) 
   {
       $sError  = '<table style="border-collapse: collapse; border-width: 0px">';

       foreach ($Campos_Erros as $campo => $erros)
       {
           $sError .= '<tr>';
           $sError .= '<td class="scFormErrorMessageFont" style="padding: 0; vertical-align: top; white-space: nowrap">' . $this->Recupera_Nome_Campo($campo) . ':</td>';
           $sError .= '<td class="scFormErrorMessageFont" style="padding: 0 6px; vertical-align: top; white-space: nowrap">' . implode('<br />', array_unique($erros)) . '</td>';
           $sError .= '</tr>';
       }

       $sError .= '</table>';

       return $sError;
   }

   function Recupera_Nome_Campo($campo) 
   {
       switch($campo)
       {
           case 'wtrequestdate':
               return "Ημερομηνία";
               break;
           case 'wtproducerbranchid':
               return "Επιλογή εγκατάστασης";
               break;
           case 'producerb_address':
               return "Διεύθυνση εγκατάστασης";
               break;
           case 'prbrresponse':
               return "Υπεύθυνος";
               break;
           case 'pphone':
               return "Τηλέφωνο υπευθύνου";
               break;
           case 'premail':
               return "Email υπευθύνου";
               break;
           case 'wtproducerewc':
               return "Κωδικός  αποβλήτου";
               break;
           case 'ewctitle':
               return "Περιγραφή αποβλήτου";
               break;
           case 'wtproducerperiferia':
               return "Περιφέρεια εγκατάστασης";
               break;
           case 'wtproduceracceptweigth':
               return "";
               break;
           case 'wtproducerqty':
               return "Ποσότητα (τν)";
               break;
           case 'wtprducerm3':
               return "Κυβικά";
               break;
           case 'wtproducersign':
               return "Ψηφιακή υπογραφή παραγωγού";
               break;
           case 'wttransportdate':
               return "Ημερομηνία μεταφοράς";
               break;
           case 'wttransporternumberid':
               return "Wt Transporter Number ID";
               break;
           case 'wttransportervechicle':
               return "Οχημα μεταφοράς";
               break;
           case 'wttransporterid':
               return "Μεταφορέας";
               break;
           case 'envregistrationno_transporter':
               return "Αρ.Μητρώου ΥΠΕΚΑ";
               break;
           case 'transporterresponse':
               return "Υπεύθυνος μεταφοράς";
               break;
           case 'transporteremail':
               return "Email";
               break;
           case 'transporterphone':
               return "Τηλέφωνο υπευθύνου";
               break;
           case 'transporterfax':
               return "Fax υπευθύνου";
               break;
           case 'checktransvsproducer':
               return "Ελενχος μεταφοράς απο παραγωγό";
               break;
           case 'checktransportervsfdest':
               return "Ελενχος μεταφοράς προς Αποδέκτη";
               break;
           case 'wtwasteid':
               return "Κατάσταση αποβλήτου";
               break;
           case 'wtequipment':
               return "Τύπος εξοπλισμού";
               break;
           case 'wttransportersign':
               return "Ψηφιακή υπογραφή μεταφορέα";
               break;
           case 'wtfdestdate':
               return "Ημερομηνία παραλαβής";
               break;
           case 'wtfdestid':
               return "Εγκατάσταση αποδέκτη";
               break;
           case 'wtfdestperiferia':
               return "Περιφέρεια εγκατάστασης";
               break;
           case 'envregistrationno_fdest':
               return "Env Registration No F Dest";
               break;
           case 'fdestaddress':
               return "Διεύθυνση εγκατάστασης";
               break;
           case 'fdestrespone':
               return "Στοχεία υπευθύνου";
               break;
           case 'fdestphone':
               return "Τηλέφωνο υπευθύνου";
               break;
           case 'fdestresponseemail':
               return "Email υπευθύνου";
               break;
           case 'wtfdestewc':
               return "Κωδικός αποβλήτου";
               break;
           case 'fdewctitle':
               return "Περιγραφή αποβλήτου";
               break;
           case 'wtfdestrd':
               return "Κωδικός επεξεργασίας";
               break;
           case 'wtfdestqty':
               return "Ποσότητα";
               break;
           case 'wtfdestm3':
               return "M3";
               break;
           case 'wtfdestsign':
               return "Ψηφιακή υπογραφή Τελικού αποδέκτη";
               break;
           case 'wtproducerremarks':
               return "Σχόλια";
               break;
           case 'wtid':
               return "Wtid";
               break;
           case 'wtprofilid':
               return "Wt Profil ID";
               break;
           case 'intnumber':
               return "INTNUMBER";
               break;
           case 'wtproducervalidate':
               return "Wt Producer Validate";
               break;
           case 'wttransporterperiferiaid':
               return "Wt Transporter Periferia ID";
               break;
           case 'wttransporterewc':
               return "Wt Transporter EWC";
               break;
           case 'wttransportervalidate':
               return "Επιβεβαιωμένο";
               break;
           case 'wttransportervalidateip':
               return "Wt Transporter Validate IP";
               break;
           case 'wtfdestvlidated':
               return "Wt F Dest Vlidated";
               break;
           case 'wtfdestvalidateip':
               return "Wt F Dest Validate IP";
               break;
           case 'transporterregno':
               return "Αριθμός Μητρώου ΥΠΕΚΑ";
               break;
       }

       return $campo;
   }

   function dateDefaultFormat()
   {
       if (isset($this->Ini->Nm_conf_reg[$this->Ini->str_conf_reg]['data_format']))
       {
           $sDate = str_replace('yyyy', 'Y', $this->Ini->Nm_conf_reg[$this->Ini->str_conf_reg]['data_format']);
           $sDate = str_replace('mm',   'm', $sDate);
           $sDate = str_replace('dd',   'd', $sDate);
           return substr(chunk_split($sDate, 1, $this->Ini->Nm_conf_reg[$this->Ini->str_conf_reg]['data_sep']), 0, -1);
       }
       elseif ('en_us' == $this->Ini->str_lang)
       {
           return 'm/d/Y';
       }
       else
       {
           return 'd/m/Y';
       }
   } // dateDefaultFormat

//
//--------------------------------------------------------------------------------------
   function Valida_campos(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros, $filtro = '') 
   {
     global $nm_browser, $teste_validade;
//---------------------------------------------------------
     $this->sc_force_zero = array();
      if ('' == $filtro || 'wtrequestdate' == $filtro)
        $this->ValidateField_wtrequestdate($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wtproducerbranchid' == $filtro)
        $this->ValidateField_wtproducerbranchid($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'producerb_address' == $filtro)
        $this->ValidateField_producerb_address($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'prbrresponse' == $filtro)
        $this->ValidateField_prbrresponse($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'pphone' == $filtro)
        $this->ValidateField_pphone($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'premail' == $filtro)
        $this->ValidateField_premail($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wtproducerewc' == $filtro)
        $this->ValidateField_wtproducerewc($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'ewctitle' == $filtro)
        $this->ValidateField_ewctitle($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wtproducerperiferia' == $filtro)
        $this->ValidateField_wtproducerperiferia($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wtproduceracceptweigth' == $filtro)
        $this->ValidateField_wtproduceracceptweigth($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wtproducerqty' == $filtro)
        $this->ValidateField_wtproducerqty($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wtprducerm3' == $filtro)
        $this->ValidateField_wtprducerm3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wtproducersign' == $filtro)
        $this->ValidateField_wtproducersign($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wttransportdate' == $filtro)
        $this->ValidateField_wttransportdate($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wttransporternumberid' == $filtro)
        $this->ValidateField_wttransporternumberid($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wttransportervechicle' == $filtro)
        $this->ValidateField_wttransportervechicle($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wttransporterid' == $filtro)
        $this->ValidateField_wttransporterid($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'envregistrationno_transporter' == $filtro)
        $this->ValidateField_envregistrationno_transporter($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'transporterresponse' == $filtro)
        $this->ValidateField_transporterresponse($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'transporteremail' == $filtro)
        $this->ValidateField_transporteremail($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'transporterphone' == $filtro)
        $this->ValidateField_transporterphone($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'transporterfax' == $filtro)
        $this->ValidateField_transporterfax($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'checktransvsproducer' == $filtro)
        $this->ValidateField_checktransvsproducer($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'checktransportervsfdest' == $filtro)
        $this->ValidateField_checktransportervsfdest($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wtwasteid' == $filtro)
        $this->ValidateField_wtwasteid($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wtequipment' == $filtro)
        $this->ValidateField_wtequipment($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wttransportersign' == $filtro)
        $this->ValidateField_wttransportersign($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wtfdestdate' == $filtro)
        $this->ValidateField_wtfdestdate($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wtfdestid' == $filtro)
        $this->ValidateField_wtfdestid($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wtfdestperiferia' == $filtro)
        $this->ValidateField_wtfdestperiferia($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'envregistrationno_fdest' == $filtro)
        $this->ValidateField_envregistrationno_fdest($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'fdestaddress' == $filtro)
        $this->ValidateField_fdestaddress($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'fdestrespone' == $filtro)
        $this->ValidateField_fdestrespone($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'fdestphone' == $filtro)
        $this->ValidateField_fdestphone($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'fdestresponseemail' == $filtro)
        $this->ValidateField_fdestresponseemail($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wtfdestewc' == $filtro)
        $this->ValidateField_wtfdestewc($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'fdewctitle' == $filtro)
        $this->ValidateField_fdewctitle($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wtfdestrd' == $filtro)
        $this->ValidateField_wtfdestrd($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wtfdestqty' == $filtro)
        $this->ValidateField_wtfdestqty($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wtfdestm3' == $filtro)
        $this->ValidateField_wtfdestm3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wtfdestsign' == $filtro)
        $this->ValidateField_wtfdestsign($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wtproducerremarks' == $filtro)
        $this->ValidateField_wtproducerremarks($Campos_Crit, $Campos_Falta, $Campos_Erros);
      $this->upload_img_doc($Campos_Crit, $Campos_Falta, $Campos_Erros) ; 
//-- converter datas   
      $this->nm_converte_datas();
//---
      if (!empty($Campos_Crit) || !empty($Campos_Falta) || !empty($this->Campos_Mens_erro))
      {
          if (!empty($this->sc_force_zero))
          {
              foreach ($this->sc_force_zero as $i_force_zero => $sc_force_zero_field)
              {
                  eval('$this->' . $sc_force_zero_field . ' = "";');
                  unset($this->sc_force_zero[$i_force_zero]);
              }
          }
      }
   }

    function ValidateField_wtrequestdate(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      nm_limpa_data($this->wtrequestdate, $this->field_config['wtrequestdate']['date_sep']) ; 
      $trab_dt_min = ""; 
      $trab_dt_max = ""; 
      if ($this->nmgp_opcao != "excluir") 
      { 
          $guarda_datahora = $this->field_config['wtrequestdate']['date_format']; 
          if (false !== strpos($guarda_datahora, ';')) $this->field_config['wtrequestdate']['date_format'] = substr($guarda_datahora, 0, strpos($guarda_datahora, ';'));
          $Format_Data = $this->field_config['wtrequestdate']['date_format']; 
          nm_limpa_data($Format_Data, $this->field_config['wtrequestdate']['date_sep']) ; 
          if (trim($this->wtrequestdate) != "")  
          { 
              if ($teste_validade->Data($this->wtrequestdate, $Format_Data, $trab_dt_min, $trab_dt_max) == false)  
              { 
                  $Campos_Crit .= "Ημερομηνία; " ; 
                  if (!isset($Campos_Erros['wtrequestdate']))
                  {
                      $Campos_Erros['wtrequestdate'] = array();
                  }
                  $Campos_Erros['wtrequestdate'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['wtrequestdate']) || !is_array($this->NM_ajax_info['errList']['wtrequestdate']))
                  {
                      $this->NM_ajax_info['errList']['wtrequestdate'] = array();
                  }
                  $this->NM_ajax_info['errList']['wtrequestdate'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
          $this->field_config['wtrequestdate']['date_format'] = $guarda_datahora; 
       } 
    } // ValidateField_wtrequestdate

    function ValidateField_wtproducerbranchid(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
               if (!empty($this->wtproducerbranchid) && isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerbranchid']) && !in_array($this->wtproducerbranchid, $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerbranchid']))
               {
                   $Campos_Crit .= $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($Campos_Erros['wtproducerbranchid']))
                   {
                       $Campos_Erros['wtproducerbranchid'] = array();
                   }
                   $Campos_Erros['wtproducerbranchid'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($this->NM_ajax_info['errList']['wtproducerbranchid']) || !is_array($this->NM_ajax_info['errList']['wtproducerbranchid']))
                   {
                       $this->NM_ajax_info['errList']['wtproducerbranchid'] = array();
                   }
                   $this->NM_ajax_info['errList']['wtproducerbranchid'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
               }
    } // ValidateField_wtproducerbranchid

    function ValidateField_producerb_address(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (trim($this->producerb_address) != "")  
          { 
          } 
      } 
    } // ValidateField_producerb_address

    function ValidateField_prbrresponse(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (trim($this->prbrresponse) != "")  
          { 
          } 
      } 
    } // ValidateField_prbrresponse

    function ValidateField_pphone(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (trim($this->pphone) != "")  
          { 
          } 
      } 
    } // ValidateField_pphone

    function ValidateField_premail(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (trim($this->premail) != "")  
          { 
          } 
      } 
    } // ValidateField_premail

    function ValidateField_wtproducerewc(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
               if (!empty($this->wtproducerewc) && isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerewc']) && !in_array($this->wtproducerewc, $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerewc']))
               {
                   $Campos_Crit .= $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($Campos_Erros['wtproducerewc']))
                   {
                       $Campos_Erros['wtproducerewc'] = array();
                   }
                   $Campos_Erros['wtproducerewc'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($this->NM_ajax_info['errList']['wtproducerewc']) || !is_array($this->NM_ajax_info['errList']['wtproducerewc']))
                   {
                       $this->NM_ajax_info['errList']['wtproducerewc'] = array();
                   }
                   $this->NM_ajax_info['errList']['wtproducerewc'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
               }
    } // ValidateField_wtproducerewc

    function ValidateField_ewctitle(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (trim($this->ewctitle) != "")  
          { 
          } 
      } 
    } // ValidateField_ewctitle

    function ValidateField_wtproducerperiferia(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
               if (!empty($this->wtproducerperiferia) && isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerperiferia']) && !in_array($this->wtproducerperiferia, $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerperiferia']))
               {
                   $Campos_Crit .= $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($Campos_Erros['wtproducerperiferia']))
                   {
                       $Campos_Erros['wtproducerperiferia'] = array();
                   }
                   $Campos_Erros['wtproducerperiferia'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($this->NM_ajax_info['errList']['wtproducerperiferia']) || !is_array($this->NM_ajax_info['errList']['wtproducerperiferia']))
                   {
                       $this->NM_ajax_info['errList']['wtproducerperiferia'] = array();
                   }
                   $this->NM_ajax_info['errList']['wtproducerperiferia'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
               }
    } // ValidateField_wtproducerperiferia

    function ValidateField_wtproduceracceptweigth(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->wtproduceracceptweigth == "" && $this->nmgp_opcao != "excluir")
      { 
          $this->wtproduceracceptweigth = "";
      } 
      else 
      { 
          if (is_array($this->wtproduceracceptweigth))
          {
              $x = 0; 
              $this->wtproduceracceptweigth_1 = array(); 
              foreach ($this->wtproduceracceptweigth as $ind => $dados_wtproduceracceptweigth_1 ) 
              {
                  if ($dados_wtproduceracceptweigth_1 !== "") 
                  {
                      $this->wtproduceracceptweigth_1[] = $dados_wtproduceracceptweigth_1;
                  } 
              } 
              $this->wtproduceracceptweigth = ""; 
              foreach ($this->wtproduceracceptweigth_1 as $dados_wtproduceracceptweigth_1 ) 
              { 
                   if ($x != 0)
                   { 
                       $this->wtproduceracceptweigth .= ";";
                   } 
                   $this->wtproduceracceptweigth .= $dados_wtproduceracceptweigth_1;
                   $x++ ; 
              } 
          } 
      } 
      if ($this->wtproduceracceptweigth == "")  
      { 
          $this->wtproduceracceptweigth = 0;
          $this->sc_force_zero[] = 'wtproduceracceptweigth';
      } 
    } // ValidateField_wtproduceracceptweigth

    function ValidateField_wtproducerqty(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->wtproducerqty == "")  
      { 
          $this->wtproducerqty = 0;
          $this->sc_force_zero[] = 'wtproducerqty';
      } 
      if (!empty($this->field_config['wtproducerqty']['symbol_dec']))
      {
          nm_limpa_valor($this->wtproducerqty, $this->field_config['wtproducerqty']['symbol_dec'], $this->field_config['wtproducerqty']['symbol_grp']) ; 
          if ('.' == substr($this->wtproducerqty, 0, 1))
          {
              if ('' == str_replace('0', '', substr($this->wtproducerqty, 1)))
              {
                  $this->wtproducerqty = '';
              }
              else
              {
                  $this->wtproducerqty = '0' . $this->wtproducerqty;
              }
          }
      }
      if ($this->nmgp_opcao != "excluir") 
      { 
          if ($this->wtproducerqty != '')  
          { 
              $iTestSize = 11;
              if (strlen($this->wtproducerqty) > $iTestSize)  
              { 
                  $Campos_Crit .= "Ποσότητα (τν): " . $this->Ini->Nm_lang['lang_errm_size']; 
                  if (!isset($Campos_Erros['wtproducerqty']))
                  {
                      $Campos_Erros['wtproducerqty'] = array();
                  }
                  $Campos_Erros['wtproducerqty'][] = $this->Ini->Nm_lang['lang_errm_size'];
                  if (!isset($this->NM_ajax_info['errList']['wtproducerqty']) || !is_array($this->NM_ajax_info['errList']['wtproducerqty']))
                  {
                      $this->NM_ajax_info['errList']['wtproducerqty'] = array();
                  }
                  $this->NM_ajax_info['errList']['wtproducerqty'][] = $this->Ini->Nm_lang['lang_errm_size'];
              } 
              if ($teste_validade->Valor($this->wtproducerqty, 7, 3, -0, 9999999999, "N") == false)  
              { 
                  $Campos_Crit .= "Ποσότητα (τν); " ; 
                  if (!isset($Campos_Erros['wtproducerqty']))
                  {
                      $Campos_Erros['wtproducerqty'] = array();
                  }
                  $Campos_Erros['wtproducerqty'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['wtproducerqty']) || !is_array($this->NM_ajax_info['errList']['wtproducerqty']))
                  {
                      $this->NM_ajax_info['errList']['wtproducerqty'] = array();
                  }
                  $this->NM_ajax_info['errList']['wtproducerqty'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
      } 
    } // ValidateField_wtproducerqty

    function ValidateField_wtprducerm3(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->wtprducerm3 == "")  
      { 
          $this->wtprducerm3 = 0;
          $this->sc_force_zero[] = 'wtprducerm3';
      } 
      nm_limpa_numero($this->wtprducerm3, $this->field_config['wtprducerm3']['symbol_grp']) ; 
      if ($this->nmgp_opcao != "excluir") 
      { 
          if ($this->wtprducerm3 != '')  
          { 
              $iTestSize = 11;
              if (strlen($this->wtprducerm3) > $iTestSize)  
              { 
                  $Campos_Crit .= "Κυβικά: " . $this->Ini->Nm_lang['lang_errm_size']; 
                  if (!isset($Campos_Erros['wtprducerm3']))
                  {
                      $Campos_Erros['wtprducerm3'] = array();
                  }
                  $Campos_Erros['wtprducerm3'][] = $this->Ini->Nm_lang['lang_errm_size'];
                  if (!isset($this->NM_ajax_info['errList']['wtprducerm3']) || !is_array($this->NM_ajax_info['errList']['wtprducerm3']))
                  {
                      $this->NM_ajax_info['errList']['wtprducerm3'] = array();
                  }
                  $this->NM_ajax_info['errList']['wtprducerm3'][] = $this->Ini->Nm_lang['lang_errm_size'];
              } 
              if ($teste_validade->Valor($this->wtprducerm3, 11, 0, -0, 99999999999, "N") == false)  
              { 
                  $Campos_Crit .= "Κυβικά; " ; 
                  if (!isset($Campos_Erros['wtprducerm3']))
                  {
                      $Campos_Erros['wtprducerm3'] = array();
                  }
                  $Campos_Erros['wtprducerm3'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['wtprducerm3']) || !is_array($this->NM_ajax_info['errList']['wtprducerm3']))
                  {
                      $this->NM_ajax_info['errList']['wtprducerm3'] = array();
                  }
                  $this->NM_ajax_info['errList']['wtprducerm3'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
      } 
    } // ValidateField_wtprducerm3

    function ValidateField_wtproducersign(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
        if ($this->nmgp_opcao != "excluir")
        {
            $sTestFile = $this->wtproducersign;
            if ("" != $this->wtproducersign && "S" != $this->wtproducersign_limpa && !$teste_validade->ArqExtensao($this->wtproducersign, array()))
            {
                $Campos_Crit .= "Ψηφιακή υπογραφή παραγωγού: " . $this->Ini->Nm_lang['lang_errm_file_invl']; 
                if (!isset($Campos_Erros['wtproducersign']))
                {
                    $Campos_Erros['wtproducersign'] = array();
                }
                $Campos_Erros['wtproducersign'][] = $this->Ini->Nm_lang['lang_errm_file_invl'];
                if (!isset($this->NM_ajax_info['errList']['wtproducersign']) || !is_array($this->NM_ajax_info['errList']['wtproducersign']))
                {
                    $this->NM_ajax_info['errList']['wtproducersign'] = array();
                }
                $this->NM_ajax_info['errList']['wtproducersign'][] = $this->Ini->Nm_lang['lang_errm_file_invl'];
            }
        }
    } // ValidateField_wtproducersign

    function ValidateField_wttransportdate(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      nm_limpa_data($this->wttransportdate, $this->field_config['wttransportdate']['date_sep']) ; 
      $trab_dt_min = ""; 
      $trab_dt_max = ""; 
      if ($this->nmgp_opcao != "excluir") 
      { 
          $guarda_datahora = $this->field_config['wttransportdate']['date_format']; 
          if (false !== strpos($guarda_datahora, ';')) $this->field_config['wttransportdate']['date_format'] = substr($guarda_datahora, 0, strpos($guarda_datahora, ';'));
          $Format_Data = $this->field_config['wttransportdate']['date_format']; 
          nm_limpa_data($Format_Data, $this->field_config['wttransportdate']['date_sep']) ; 
          if (trim($this->wttransportdate) != "")  
          { 
              if ($teste_validade->Data($this->wttransportdate, $Format_Data, $trab_dt_min, $trab_dt_max) == false)  
              { 
                  $Campos_Crit .= "Ημερομηνία μεταφοράς; " ; 
                  if (!isset($Campos_Erros['wttransportdate']))
                  {
                      $Campos_Erros['wttransportdate'] = array();
                  }
                  $Campos_Erros['wttransportdate'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['wttransportdate']) || !is_array($this->NM_ajax_info['errList']['wttransportdate']))
                  {
                      $this->NM_ajax_info['errList']['wttransportdate'] = array();
                  }
                  $this->NM_ajax_info['errList']['wttransportdate'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
          $this->field_config['wttransportdate']['date_format'] = $guarda_datahora; 
       } 
    } // ValidateField_wttransportdate

    function ValidateField_wttransporternumberid(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->wttransporternumberid) > 10) 
          { 
              $Campos_Crit .= "Wt Transporter Number ID " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 10 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['wttransporternumberid']))
              {
                  $Campos_Erros['wttransporternumberid'] = array();
              }
              $Campos_Erros['wttransporternumberid'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 10 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['wttransporternumberid']) || !is_array($this->NM_ajax_info['errList']['wttransporternumberid']))
              {
                  $this->NM_ajax_info['errList']['wttransporternumberid'] = array();
              }
              $this->NM_ajax_info['errList']['wttransporternumberid'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 10 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_wttransporternumberid

    function ValidateField_wttransportervechicle(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->wttransportervechicle) > 15) 
          { 
              $Campos_Crit .= "Οχημα μεταφοράς " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 15 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['wttransportervechicle']))
              {
                  $Campos_Erros['wttransportervechicle'] = array();
              }
              $Campos_Erros['wttransportervechicle'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 15 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['wttransportervechicle']) || !is_array($this->NM_ajax_info['errList']['wttransportervechicle']))
              {
                  $this->NM_ajax_info['errList']['wttransportervechicle'] = array();
              }
              $this->NM_ajax_info['errList']['wttransportervechicle'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 15 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_wttransportervechicle

    function ValidateField_wttransporterid(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
               if (!empty($this->wttransporterid) && isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wttransporterid']) && !in_array($this->wttransporterid, $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wttransporterid']))
               {
                   $Campos_Crit .= $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($Campos_Erros['wttransporterid']))
                   {
                       $Campos_Erros['wttransporterid'] = array();
                   }
                   $Campos_Erros['wttransporterid'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($this->NM_ajax_info['errList']['wttransporterid']) || !is_array($this->NM_ajax_info['errList']['wttransporterid']))
                   {
                       $this->NM_ajax_info['errList']['wttransporterid'] = array();
                   }
                   $this->NM_ajax_info['errList']['wttransporterid'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
               }
    } // ValidateField_wttransporterid

    function ValidateField_envregistrationno_transporter(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->envregistrationno_transporter) > 15) 
          { 
              $Campos_Crit .= "Αρ.Μητρώου ΥΠΕΚΑ " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 15 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['envregistrationno_transporter']))
              {
                  $Campos_Erros['envregistrationno_transporter'] = array();
              }
              $Campos_Erros['envregistrationno_transporter'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 15 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['envregistrationno_transporter']) || !is_array($this->NM_ajax_info['errList']['envregistrationno_transporter']))
              {
                  $this->NM_ajax_info['errList']['envregistrationno_transporter'] = array();
              }
              $this->NM_ajax_info['errList']['envregistrationno_transporter'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 15 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_envregistrationno_transporter

    function ValidateField_transporterresponse(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (trim($this->transporterresponse) != "")  
          { 
          } 
      } 
    } // ValidateField_transporterresponse

    function ValidateField_transporteremail(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (trim($this->transporteremail) != "")  
          { 
          } 
      } 
    } // ValidateField_transporteremail

    function ValidateField_transporterphone(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (trim($this->transporterphone) != "")  
          { 
          } 
      } 
    } // ValidateField_transporterphone

    function ValidateField_transporterfax(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (trim($this->transporterfax) != "")  
          { 
          } 
      } 
    } // ValidateField_transporterfax

    function ValidateField_checktransvsproducer(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (trim($this->checktransvsproducer) != "")  
          { 
          } 
      } 
    } // ValidateField_checktransvsproducer

    function ValidateField_checktransportervsfdest(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (trim($this->checktransportervsfdest) != "")  
          { 
          } 
      } 
    } // ValidateField_checktransportervsfdest

    function ValidateField_wtwasteid(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
               if (!empty($this->wtwasteid) && isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtwasteid']) && !in_array($this->wtwasteid, $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtwasteid']))
               {
                   $Campos_Crit .= $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($Campos_Erros['wtwasteid']))
                   {
                       $Campos_Erros['wtwasteid'] = array();
                   }
                   $Campos_Erros['wtwasteid'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($this->NM_ajax_info['errList']['wtwasteid']) || !is_array($this->NM_ajax_info['errList']['wtwasteid']))
                   {
                       $this->NM_ajax_info['errList']['wtwasteid'] = array();
                   }
                   $this->NM_ajax_info['errList']['wtwasteid'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
               }
    } // ValidateField_wtwasteid

    function ValidateField_wtequipment(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
               if (!empty($this->wtequipment) && isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtequipment']) && !in_array($this->wtequipment, $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtequipment']))
               {
                   $Campos_Crit .= $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($Campos_Erros['wtequipment']))
                   {
                       $Campos_Erros['wtequipment'] = array();
                   }
                   $Campos_Erros['wtequipment'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($this->NM_ajax_info['errList']['wtequipment']) || !is_array($this->NM_ajax_info['errList']['wtequipment']))
                   {
                       $this->NM_ajax_info['errList']['wtequipment'] = array();
                   }
                   $this->NM_ajax_info['errList']['wtequipment'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
               }
    } // ValidateField_wtequipment

    function ValidateField_wttransportersign(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
        if ($this->nmgp_opcao != "excluir")
        {
            $sTestFile = $this->wttransportersign;
            if ("" != $this->wttransportersign && "S" != $this->wttransportersign_limpa && !$teste_validade->ArqExtensao($this->wttransportersign, array()))
            {
                $Campos_Crit .= "Ψηφιακή υπογραφή μεταφορέα: " . $this->Ini->Nm_lang['lang_errm_file_invl']; 
                if (!isset($Campos_Erros['wttransportersign']))
                {
                    $Campos_Erros['wttransportersign'] = array();
                }
                $Campos_Erros['wttransportersign'][] = $this->Ini->Nm_lang['lang_errm_file_invl'];
                if (!isset($this->NM_ajax_info['errList']['wttransportersign']) || !is_array($this->NM_ajax_info['errList']['wttransportersign']))
                {
                    $this->NM_ajax_info['errList']['wttransportersign'] = array();
                }
                $this->NM_ajax_info['errList']['wttransportersign'][] = $this->Ini->Nm_lang['lang_errm_file_invl'];
            }
        }
    } // ValidateField_wttransportersign

    function ValidateField_wtfdestdate(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      nm_limpa_data($this->wtfdestdate, $this->field_config['wtfdestdate']['date_sep']) ; 
      $trab_dt_min = ""; 
      $trab_dt_max = ""; 
      if ($this->nmgp_opcao != "excluir") 
      { 
          $guarda_datahora = $this->field_config['wtfdestdate']['date_format']; 
          if (false !== strpos($guarda_datahora, ';')) $this->field_config['wtfdestdate']['date_format'] = substr($guarda_datahora, 0, strpos($guarda_datahora, ';'));
          $Format_Data = $this->field_config['wtfdestdate']['date_format']; 
          nm_limpa_data($Format_Data, $this->field_config['wtfdestdate']['date_sep']) ; 
          if (trim($this->wtfdestdate) != "")  
          { 
              if ($teste_validade->Data($this->wtfdestdate, $Format_Data, $trab_dt_min, $trab_dt_max) == false)  
              { 
                  $Campos_Crit .= "Ημερομηνία παραλαβής; " ; 
                  if (!isset($Campos_Erros['wtfdestdate']))
                  {
                      $Campos_Erros['wtfdestdate'] = array();
                  }
                  $Campos_Erros['wtfdestdate'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['wtfdestdate']) || !is_array($this->NM_ajax_info['errList']['wtfdestdate']))
                  {
                      $this->NM_ajax_info['errList']['wtfdestdate'] = array();
                  }
                  $this->NM_ajax_info['errList']['wtfdestdate'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
          $this->field_config['wtfdestdate']['date_format'] = $guarda_datahora; 
       } 
    } // ValidateField_wtfdestdate

    function ValidateField_wtfdestid(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
               if (!empty($this->wtfdestid) && isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestid']) && !in_array($this->wtfdestid, $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestid']))
               {
                   $Campos_Crit .= $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($Campos_Erros['wtfdestid']))
                   {
                       $Campos_Erros['wtfdestid'] = array();
                   }
                   $Campos_Erros['wtfdestid'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($this->NM_ajax_info['errList']['wtfdestid']) || !is_array($this->NM_ajax_info['errList']['wtfdestid']))
                   {
                       $this->NM_ajax_info['errList']['wtfdestid'] = array();
                   }
                   $this->NM_ajax_info['errList']['wtfdestid'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
               }
    } // ValidateField_wtfdestid

    function ValidateField_wtfdestperiferia(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
               if (!empty($this->wtfdestperiferia) && isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestperiferia']) && !in_array($this->wtfdestperiferia, $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestperiferia']))
               {
                   $Campos_Crit .= $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($Campos_Erros['wtfdestperiferia']))
                   {
                       $Campos_Erros['wtfdestperiferia'] = array();
                   }
                   $Campos_Erros['wtfdestperiferia'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($this->NM_ajax_info['errList']['wtfdestperiferia']) || !is_array($this->NM_ajax_info['errList']['wtfdestperiferia']))
                   {
                       $this->NM_ajax_info['errList']['wtfdestperiferia'] = array();
                   }
                   $this->NM_ajax_info['errList']['wtfdestperiferia'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
               }
    } // ValidateField_wtfdestperiferia

    function ValidateField_envregistrationno_fdest(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->envregistrationno_fdest) > 15) 
          { 
              $Campos_Crit .= "Env Registration No F Dest " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 15 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['envregistrationno_fdest']))
              {
                  $Campos_Erros['envregistrationno_fdest'] = array();
              }
              $Campos_Erros['envregistrationno_fdest'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 15 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['envregistrationno_fdest']) || !is_array($this->NM_ajax_info['errList']['envregistrationno_fdest']))
              {
                  $this->NM_ajax_info['errList']['envregistrationno_fdest'] = array();
              }
              $this->NM_ajax_info['errList']['envregistrationno_fdest'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 15 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_envregistrationno_fdest

    function ValidateField_fdestaddress(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (trim($this->fdestaddress) != "")  
          { 
          } 
      } 
    } // ValidateField_fdestaddress

    function ValidateField_fdestrespone(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (trim($this->fdestrespone) != "")  
          { 
          } 
      } 
    } // ValidateField_fdestrespone

    function ValidateField_fdestphone(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (trim($this->fdestphone) != "")  
          { 
          } 
      } 
    } // ValidateField_fdestphone

    function ValidateField_fdestresponseemail(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (trim($this->fdestresponseemail) != "")  
          { 
          } 
      } 
    } // ValidateField_fdestresponseemail

    function ValidateField_wtfdestewc(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
               if (!empty($this->wtfdestewc) && isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestewc']) && !in_array($this->wtfdestewc, $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestewc']))
               {
                   $Campos_Crit .= $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($Campos_Erros['wtfdestewc']))
                   {
                       $Campos_Erros['wtfdestewc'] = array();
                   }
                   $Campos_Erros['wtfdestewc'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($this->NM_ajax_info['errList']['wtfdestewc']) || !is_array($this->NM_ajax_info['errList']['wtfdestewc']))
                   {
                       $this->NM_ajax_info['errList']['wtfdestewc'] = array();
                   }
                   $this->NM_ajax_info['errList']['wtfdestewc'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
               }
    } // ValidateField_wtfdestewc

    function ValidateField_fdewctitle(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (trim($this->fdewctitle) != "")  
          { 
          } 
      } 
    } // ValidateField_fdewctitle

    function ValidateField_wtfdestrd(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
               if (!empty($this->wtfdestrd) && isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestrd']) && !in_array($this->wtfdestrd, $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestrd']))
               {
                   $Campos_Crit .= $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($Campos_Erros['wtfdestrd']))
                   {
                       $Campos_Erros['wtfdestrd'] = array();
                   }
                   $Campos_Erros['wtfdestrd'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
                   if (!isset($this->NM_ajax_info['errList']['wtfdestrd']) || !is_array($this->NM_ajax_info['errList']['wtfdestrd']))
                   {
                       $this->NM_ajax_info['errList']['wtfdestrd'] = array();
                   }
                   $this->NM_ajax_info['errList']['wtfdestrd'][] = $this->Ini->Nm_lang['lang_errm_ajax_data'];
               }
    } // ValidateField_wtfdestrd

    function ValidateField_wtfdestqty(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->wtfdestqty == "")  
      { 
          $this->wtfdestqty = 0;
          $this->sc_force_zero[] = 'wtfdestqty';
      } 
      if (!empty($this->field_config['wtfdestqty']['symbol_dec']))
      {
          nm_limpa_valor($this->wtfdestqty, $this->field_config['wtfdestqty']['symbol_dec'], $this->field_config['wtfdestqty']['symbol_grp']) ; 
          if ('.' == substr($this->wtfdestqty, 0, 1))
          {
              if ('' == str_replace('0', '', substr($this->wtfdestqty, 1)))
              {
                  $this->wtfdestqty = '';
              }
              else
              {
                  $this->wtfdestqty = '0' . $this->wtfdestqty;
              }
          }
      }
      if ($this->nmgp_opcao != "excluir") 
      { 
          if ($this->wtfdestqty != '')  
          { 
              $iTestSize = 11;
              if (strlen($this->wtfdestqty) > $iTestSize)  
              { 
                  $Campos_Crit .= "Ποσότητα: " . $this->Ini->Nm_lang['lang_errm_size']; 
                  if (!isset($Campos_Erros['wtfdestqty']))
                  {
                      $Campos_Erros['wtfdestqty'] = array();
                  }
                  $Campos_Erros['wtfdestqty'][] = $this->Ini->Nm_lang['lang_errm_size'];
                  if (!isset($this->NM_ajax_info['errList']['wtfdestqty']) || !is_array($this->NM_ajax_info['errList']['wtfdestqty']))
                  {
                      $this->NM_ajax_info['errList']['wtfdestqty'] = array();
                  }
                  $this->NM_ajax_info['errList']['wtfdestqty'][] = $this->Ini->Nm_lang['lang_errm_size'];
              } 
              if ($teste_validade->Valor($this->wtfdestqty, 7, 3, -0, 9999999999, "N") == false)  
              { 
                  $Campos_Crit .= "Ποσότητα; " ; 
                  if (!isset($Campos_Erros['wtfdestqty']))
                  {
                      $Campos_Erros['wtfdestqty'] = array();
                  }
                  $Campos_Erros['wtfdestqty'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['wtfdestqty']) || !is_array($this->NM_ajax_info['errList']['wtfdestqty']))
                  {
                      $this->NM_ajax_info['errList']['wtfdestqty'] = array();
                  }
                  $this->NM_ajax_info['errList']['wtfdestqty'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
      } 
    } // ValidateField_wtfdestqty

    function ValidateField_wtfdestm3(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->wtfdestm3 == "")  
      { 
          $this->wtfdestm3 = 0;
          $this->sc_force_zero[] = 'wtfdestm3';
      } 
      nm_limpa_numero($this->wtfdestm3, $this->field_config['wtfdestm3']['symbol_grp']) ; 
      if ($this->nmgp_opcao != "excluir") 
      { 
          if ($this->wtfdestm3 != '')  
          { 
              $iTestSize = 11;
              if (strlen($this->wtfdestm3) > $iTestSize)  
              { 
                  $Campos_Crit .= "M3: " . $this->Ini->Nm_lang['lang_errm_size']; 
                  if (!isset($Campos_Erros['wtfdestm3']))
                  {
                      $Campos_Erros['wtfdestm3'] = array();
                  }
                  $Campos_Erros['wtfdestm3'][] = $this->Ini->Nm_lang['lang_errm_size'];
                  if (!isset($this->NM_ajax_info['errList']['wtfdestm3']) || !is_array($this->NM_ajax_info['errList']['wtfdestm3']))
                  {
                      $this->NM_ajax_info['errList']['wtfdestm3'] = array();
                  }
                  $this->NM_ajax_info['errList']['wtfdestm3'][] = $this->Ini->Nm_lang['lang_errm_size'];
              } 
              if ($teste_validade->Valor($this->wtfdestm3, 11, 0, -0, 99999999999, "N") == false)  
              { 
                  $Campos_Crit .= "M3; " ; 
                  if (!isset($Campos_Erros['wtfdestm3']))
                  {
                      $Campos_Erros['wtfdestm3'] = array();
                  }
                  $Campos_Erros['wtfdestm3'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['wtfdestm3']) || !is_array($this->NM_ajax_info['errList']['wtfdestm3']))
                  {
                      $this->NM_ajax_info['errList']['wtfdestm3'] = array();
                  }
                  $this->NM_ajax_info['errList']['wtfdestm3'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
      } 
    } // ValidateField_wtfdestm3

    function ValidateField_wtfdestsign(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
        if ($this->nmgp_opcao != "excluir")
        {
            $sTestFile = $this->wtfdestsign;
            if ("" != $this->wtfdestsign && "S" != $this->wtfdestsign_limpa && !$teste_validade->ArqExtensao($this->wtfdestsign, array()))
            {
                $Campos_Crit .= "Ψηφιακή υπογραφή Τελικού αποδέκτη: " . $this->Ini->Nm_lang['lang_errm_file_invl']; 
                if (!isset($Campos_Erros['wtfdestsign']))
                {
                    $Campos_Erros['wtfdestsign'] = array();
                }
                $Campos_Erros['wtfdestsign'][] = $this->Ini->Nm_lang['lang_errm_file_invl'];
                if (!isset($this->NM_ajax_info['errList']['wtfdestsign']) || !is_array($this->NM_ajax_info['errList']['wtfdestsign']))
                {
                    $this->NM_ajax_info['errList']['wtfdestsign'] = array();
                }
                $this->NM_ajax_info['errList']['wtfdestsign'][] = $this->Ini->Nm_lang['lang_errm_file_invl'];
            }
        }
    } // ValidateField_wtfdestsign

    function ValidateField_wtproducerremarks(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->wtproducerremarks) > 50) 
          { 
              $Campos_Crit .= "Σχόλια " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 50 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['wtproducerremarks']))
              {
                  $Campos_Erros['wtproducerremarks'] = array();
              }
              $Campos_Erros['wtproducerremarks'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 50 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['wtproducerremarks']) || !is_array($this->NM_ajax_info['errList']['wtproducerremarks']))
              {
                  $this->NM_ajax_info['errList']['wtproducerremarks'] = array();
              }
              $this->NM_ajax_info['errList']['wtproducerremarks'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 50 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_wtproducerremarks
//
//--------------------------------------------------------------------------------------
   function upload_img_doc(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros) 
   {
     global $nm_browser;
      if ($this->nmgp_opcao == "incluir" && $this->wtproducersign == "" &&  $this->wtproducersign_limpa != "S" && isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_clone']['wtproducersign']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_clone']['wtproducersign']))
      { 
          $this->wtproducersign = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_clone']['wtproducersign'];
      } 
      elseif ($this->nmgp_opcao != "excluir") 
      { 
          if ($this->wtproducersign == "none") 
          { 
              $this->wtproducersign = ""; 
          } 
          if ($this->wtproducersign != "") 
          { 
              if ($nm_browser == "Opera")  
              { 
                  $this->wtproducersign_scfile_type = substr($this->wtproducersign_scfile_type, 0, strpos($this->wtproducersign_scfile_type, ";")) ; 
              } 
              if ($this->wtproducersign_scfile_type == "image/pjpeg" || $this->wtproducersign_scfile_type == "image/jpeg" || $this->wtproducersign_scfile_type == "image/gif" ||  
                  $this->wtproducersign_scfile_type == "image/png" || $this->wtproducersign_scfile_type == "image/x-png" || $this->wtproducersign_scfile_type == "image/bmp")  
              { 
                  if (is_file($this->wtproducersign))  
                  { 
                      $reg_wtproducersign = file_get_contents($this->wtproducersign); 
                      $this->wtproducersign = $reg_wtproducersign; 
                  } 
                  else 
                  { 
                      $Campos_Crit .= "Ψηφιακή υπογραφή παραγωγού " . $this->Ini->Nm_lang['lang_errm_upld']; 
                      $this->wtproducersign = "";
                      if (!isset($Campos_Erros['wtproducersign']))
                      {
                          $Campos_Erros['wtproducersign'] = array();
                      }
                      $Campos_Erros['wtproducersign'][] = $this->Ini->Nm_lang['lang_errm_upld'];
                      if (!isset($this->NM_ajax_info['errList']['wtproducersign']) || !is_array($this->NM_ajax_info['errList']['wtproducersign']))
                      {
                          $this->NM_ajax_info['errList']['wtproducersign'] = array();
                      }
                      $this->NM_ajax_info['errList']['wtproducersign'][] = $this->Ini->Nm_lang['lang_errm_upld'];
                  } 
              } 
              else 
              { 
                  if ($nm_browser == "Konqueror")  
                  { 
                      $this->wtproducersign = "" ; 
                  } 
                  else 
                  { 
                     $Campos_Crit .= "Ψηφιακή υπογραφή παραγωγού " . $this->Ini->Nm_lang['lang_errm_ivtp'];  
                      if (!isset($Campos_Erros['wtproducersign']))
                      {
                          $Campos_Erros['wtproducersign'] = array();
                      }
                      $Campos_Erros['wtproducersign'][] = $this->Ini->Nm_lang['lang_errm_ivtp'];
                      if (!isset($this->NM_ajax_info['errList']['wtproducersign']) || !is_array($this->NM_ajax_info['errList']['wtproducersign']))
                      {
                          $this->NM_ajax_info['errList']['wtproducersign'] = array();
                      }
                      $this->NM_ajax_info['errList']['wtproducersign'][] = $this->Ini->Nm_lang['lang_errm_ivtp'];
                  } 
              } 
          } 
          elseif (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_form']['wtproducersign']) && $this->wtproducersign_limpa != "S")
          {
              $this->wtproducersign = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_form']['wtproducersign'];
          }
      } 
      if ($this->nmgp_opcao == "incluir" && $this->wttransportersign == "" &&  $this->wttransportersign_limpa != "S" && isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_clone']['wttransportersign']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_clone']['wttransportersign']))
      { 
          $this->wttransportersign = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_clone']['wttransportersign'];
      } 
      elseif ($this->nmgp_opcao != "excluir") 
      { 
          if ($this->wttransportersign == "none") 
          { 
              $this->wttransportersign = ""; 
          } 
          if ($this->wttransportersign != "") 
          { 
              if ($nm_browser == "Opera")  
              { 
                  $this->wttransportersign_scfile_type = substr($this->wttransportersign_scfile_type, 0, strpos($this->wttransportersign_scfile_type, ";")) ; 
              } 
              if ($this->wttransportersign_scfile_type == "image/pjpeg" || $this->wttransportersign_scfile_type == "image/jpeg" || $this->wttransportersign_scfile_type == "image/gif" ||  
                  $this->wttransportersign_scfile_type == "image/png" || $this->wttransportersign_scfile_type == "image/x-png" || $this->wttransportersign_scfile_type == "image/bmp")  
              { 
                  if (is_file($this->wttransportersign))  
                  { 
                      $reg_wttransportersign = file_get_contents($this->wttransportersign); 
                      $this->wttransportersign = $reg_wttransportersign; 
                  } 
                  else 
                  { 
                      $Campos_Crit .= "Ψηφιακή υπογραφή μεταφορέα " . $this->Ini->Nm_lang['lang_errm_upld']; 
                      $this->wttransportersign = "";
                      if (!isset($Campos_Erros['wttransportersign']))
                      {
                          $Campos_Erros['wttransportersign'] = array();
                      }
                      $Campos_Erros['wttransportersign'][] = $this->Ini->Nm_lang['lang_errm_upld'];
                      if (!isset($this->NM_ajax_info['errList']['wttransportersign']) || !is_array($this->NM_ajax_info['errList']['wttransportersign']))
                      {
                          $this->NM_ajax_info['errList']['wttransportersign'] = array();
                      }
                      $this->NM_ajax_info['errList']['wttransportersign'][] = $this->Ini->Nm_lang['lang_errm_upld'];
                  } 
              } 
              else 
              { 
                  if ($nm_browser == "Konqueror")  
                  { 
                      $this->wttransportersign = "" ; 
                  } 
                  else 
                  { 
                     $Campos_Crit .= "Ψηφιακή υπογραφή μεταφορέα " . $this->Ini->Nm_lang['lang_errm_ivtp'];  
                      if (!isset($Campos_Erros['wttransportersign']))
                      {
                          $Campos_Erros['wttransportersign'] = array();
                      }
                      $Campos_Erros['wttransportersign'][] = $this->Ini->Nm_lang['lang_errm_ivtp'];
                      if (!isset($this->NM_ajax_info['errList']['wttransportersign']) || !is_array($this->NM_ajax_info['errList']['wttransportersign']))
                      {
                          $this->NM_ajax_info['errList']['wttransportersign'] = array();
                      }
                      $this->NM_ajax_info['errList']['wttransportersign'][] = $this->Ini->Nm_lang['lang_errm_ivtp'];
                  } 
              } 
          } 
          elseif (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_form']['wttransportersign']) && $this->wttransportersign_limpa != "S")
          {
              $this->wttransportersign = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_form']['wttransportersign'];
          }
      } 
      if ($this->nmgp_opcao == "incluir" && $this->wtfdestsign == "" &&  $this->wtfdestsign_limpa != "S" && isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_clone']['wtfdestsign']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_clone']['wtfdestsign']))
      { 
          $this->wtfdestsign = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_clone']['wtfdestsign'];
      } 
      elseif ($this->nmgp_opcao != "excluir") 
      { 
          if ($this->wtfdestsign == "none") 
          { 
              $this->wtfdestsign = ""; 
          } 
          if ($this->wtfdestsign != "") 
          { 
              if ($nm_browser == "Opera")  
              { 
                  $this->wtfdestsign_scfile_type = substr($this->wtfdestsign_scfile_type, 0, strpos($this->wtfdestsign_scfile_type, ";")) ; 
              } 
              if ($this->wtfdestsign_scfile_type == "image/pjpeg" || $this->wtfdestsign_scfile_type == "image/jpeg" || $this->wtfdestsign_scfile_type == "image/gif" ||  
                  $this->wtfdestsign_scfile_type == "image/png" || $this->wtfdestsign_scfile_type == "image/x-png" || $this->wtfdestsign_scfile_type == "image/bmp")  
              { 
                  if (is_file($this->wtfdestsign))  
                  { 
                      $reg_wtfdestsign = file_get_contents($this->wtfdestsign); 
                      $this->wtfdestsign = $reg_wtfdestsign; 
                  } 
                  else 
                  { 
                      $Campos_Crit .= "Ψηφιακή υπογραφή Τελικού αποδέκτη " . $this->Ini->Nm_lang['lang_errm_upld']; 
                      $this->wtfdestsign = "";
                      if (!isset($Campos_Erros['wtfdestsign']))
                      {
                          $Campos_Erros['wtfdestsign'] = array();
                      }
                      $Campos_Erros['wtfdestsign'][] = $this->Ini->Nm_lang['lang_errm_upld'];
                      if (!isset($this->NM_ajax_info['errList']['wtfdestsign']) || !is_array($this->NM_ajax_info['errList']['wtfdestsign']))
                      {
                          $this->NM_ajax_info['errList']['wtfdestsign'] = array();
                      }
                      $this->NM_ajax_info['errList']['wtfdestsign'][] = $this->Ini->Nm_lang['lang_errm_upld'];
                  } 
              } 
              else 
              { 
                  if ($nm_browser == "Konqueror")  
                  { 
                      $this->wtfdestsign = "" ; 
                  } 
                  else 
                  { 
                     $Campos_Crit .= "Ψηφιακή υπογραφή Τελικού αποδέκτη " . $this->Ini->Nm_lang['lang_errm_ivtp'];  
                      if (!isset($Campos_Erros['wtfdestsign']))
                      {
                          $Campos_Erros['wtfdestsign'] = array();
                      }
                      $Campos_Erros['wtfdestsign'][] = $this->Ini->Nm_lang['lang_errm_ivtp'];
                      if (!isset($this->NM_ajax_info['errList']['wtfdestsign']) || !is_array($this->NM_ajax_info['errList']['wtfdestsign']))
                      {
                          $this->NM_ajax_info['errList']['wtfdestsign'] = array();
                      }
                      $this->NM_ajax_info['errList']['wtfdestsign'][] = $this->Ini->Nm_lang['lang_errm_ivtp'];
                  } 
              } 
          } 
          elseif (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_form']['wtfdestsign']) && $this->wtfdestsign_limpa != "S")
          {
              $this->wtfdestsign = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_form']['wtfdestsign'];
          }
      } 
   }

    function removeDuplicateDttmError($aErrDate, &$aErrTime)
    {
        if (empty($aErrDate) || empty($aErrTime))
        {
            return;
        }

        foreach ($aErrDate as $sErrDate)
        {
            foreach ($aErrTime as $iErrTime => $sErrTime)
            {
                if ($sErrDate == $sErrTime)
                {
                    unset($aErrTime[$iErrTime]);
                }
            }
        }
    } // removeDuplicateDttmError

   function nm_guardar_campos()
   {
    global
           $sc_seq_vert;
    $this->nmgp_dados_form['wtrequestdate'] = $this->wtrequestdate;
    $this->nmgp_dados_form['wtproducerbranchid'] = $this->wtproducerbranchid;
    $this->nmgp_dados_form['producerb_address'] = $this->producerb_address;
    $this->nmgp_dados_form['prbrresponse'] = $this->prbrresponse;
    $this->nmgp_dados_form['pphone'] = $this->pphone;
    $this->nmgp_dados_form['premail'] = $this->premail;
    $this->nmgp_dados_form['wtproducerewc'] = $this->wtproducerewc;
    $this->nmgp_dados_form['ewctitle'] = $this->ewctitle;
    $this->nmgp_dados_form['wtproducerperiferia'] = $this->wtproducerperiferia;
    $this->nmgp_dados_form['wtproduceracceptweigth'] = $this->wtproduceracceptweigth;
    $this->nmgp_dados_form['wtproducerqty'] = $this->wtproducerqty;
    $this->nmgp_dados_form['wtprducerm3'] = $this->wtprducerm3;
    if (empty($this->wtproducersign))
    {
        $this->wtproducersign = $this->nmgp_dados_form['wtproducersign'];
    }
    $this->nmgp_dados_form['wtproducersign'] = $this->wtproducersign;
    $this->nmgp_dados_form['wtproducersign_limpa'] = $this->wtproducersign_limpa;
    $this->nmgp_dados_form['wttransportdate'] = $this->wttransportdate;
    $this->nmgp_dados_form['wttransporternumberid'] = $this->wttransporternumberid;
    $this->nmgp_dados_form['wttransportervechicle'] = $this->wttransportervechicle;
    $this->nmgp_dados_form['wttransporterid'] = $this->wttransporterid;
    $this->nmgp_dados_form['envregistrationno_transporter'] = $this->envregistrationno_transporter;
    $this->nmgp_dados_form['transporterresponse'] = $this->transporterresponse;
    $this->nmgp_dados_form['transporteremail'] = $this->transporteremail;
    $this->nmgp_dados_form['transporterphone'] = $this->transporterphone;
    $this->nmgp_dados_form['transporterfax'] = $this->transporterfax;
    $this->nmgp_dados_form['checktransvsproducer'] = $this->checktransvsproducer;
    $this->nmgp_dados_form['checktransportervsfdest'] = $this->checktransportervsfdest;
    $this->nmgp_dados_form['wtwasteid'] = $this->wtwasteid;
    $this->nmgp_dados_form['wtequipment'] = $this->wtequipment;
    if (empty($this->wttransportersign))
    {
        $this->wttransportersign = $this->nmgp_dados_form['wttransportersign'];
    }
    $this->nmgp_dados_form['wttransportersign'] = $this->wttransportersign;
    $this->nmgp_dados_form['wttransportersign_limpa'] = $this->wttransportersign_limpa;
    $this->nmgp_dados_form['wtfdestdate'] = $this->wtfdestdate;
    $this->nmgp_dados_form['wtfdestid'] = $this->wtfdestid;
    $this->nmgp_dados_form['wtfdestperiferia'] = $this->wtfdestperiferia;
    $this->nmgp_dados_form['envregistrationno_fdest'] = $this->envregistrationno_fdest;
    $this->nmgp_dados_form['fdestaddress'] = $this->fdestaddress;
    $this->nmgp_dados_form['fdestrespone'] = $this->fdestrespone;
    $this->nmgp_dados_form['fdestphone'] = $this->fdestphone;
    $this->nmgp_dados_form['fdestresponseemail'] = $this->fdestresponseemail;
    $this->nmgp_dados_form['wtfdestewc'] = $this->wtfdestewc;
    $this->nmgp_dados_form['fdewctitle'] = $this->fdewctitle;
    $this->nmgp_dados_form['wtfdestrd'] = $this->wtfdestrd;
    $this->nmgp_dados_form['wtfdestqty'] = $this->wtfdestqty;
    $this->nmgp_dados_form['wtfdestm3'] = $this->wtfdestm3;
    if (empty($this->wtfdestsign))
    {
        $this->wtfdestsign = $this->nmgp_dados_form['wtfdestsign'];
    }
    $this->nmgp_dados_form['wtfdestsign'] = $this->wtfdestsign;
    $this->nmgp_dados_form['wtfdestsign_limpa'] = $this->wtfdestsign_limpa;
    $this->nmgp_dados_form['wtproducerremarks'] = $this->wtproducerremarks;
    $this->nmgp_dados_form['wtid'] = $this->wtid;
    $this->nmgp_dados_form['wtprofilid'] = $this->wtprofilid;
    $this->nmgp_dados_form['intnumber'] = $this->intnumber;
    $this->nmgp_dados_form['wtproducervalidate'] = $this->wtproducervalidate;
    $this->nmgp_dados_form['wttransporterperiferiaid'] = $this->wttransporterperiferiaid;
    $this->nmgp_dados_form['wttransporterewc'] = $this->wttransporterewc;
    $this->nmgp_dados_form['wttransportervalidate'] = $this->wttransportervalidate;
    $this->nmgp_dados_form['wttransportervalidateip'] = $this->wttransportervalidateip;
    $this->nmgp_dados_form['wtfdestvlidated'] = $this->wtfdestvlidated;
    $this->nmgp_dados_form['wtfdestvalidateip'] = $this->wtfdestvalidateip;
    $this->nmgp_dados_form['transporterregno'] = $this->transporterregno;
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_form'] = $this->nmgp_dados_form;
   }
   function nm_tira_formatacao()
   {
      global $nm_form_submit;
         $this->formatado = false;
      nm_limpa_data($this->wtrequestdate, $this->field_config['wtrequestdate']['date_sep']) ; 
      if (!empty($this->field_config['wtproducerqty']['symbol_dec']))
      {
         nm_limpa_valor($this->wtproducerqty, $this->field_config['wtproducerqty']['symbol_dec'], $this->field_config['wtproducerqty']['symbol_grp']);
      }
      nm_limpa_numero($this->wtprducerm3, $this->field_config['wtprducerm3']['symbol_grp']) ; 
      nm_limpa_data($this->wttransportdate, $this->field_config['wttransportdate']['date_sep']) ; 
      nm_limpa_data($this->wtfdestdate, $this->field_config['wtfdestdate']['date_sep']) ; 
      if (!empty($this->field_config['wtfdestqty']['symbol_dec']))
      {
         nm_limpa_valor($this->wtfdestqty, $this->field_config['wtfdestqty']['symbol_dec'], $this->field_config['wtfdestqty']['symbol_grp']);
      }
      nm_limpa_numero($this->wtfdestm3, $this->field_config['wtfdestm3']['symbol_grp']) ; 
      nm_limpa_numero($this->wtid, $this->field_config['wtid']['symbol_grp']) ; 
      nm_limpa_numero($this->wtprofilid, $this->field_config['wtprofilid']['symbol_grp']) ; 
      nm_limpa_numero($this->intnumber, $this->field_config['intnumber']['symbol_grp']) ; 
      nm_limpa_numero($this->wttransporterperiferiaid, $this->field_config['wttransporterperiferiaid']['symbol_grp']) ; 
   }
   function sc_add_currency(&$value, $symbol, $pos)
   {
       if ('' == $value)
       {
           return;
       }
       $value = (1 == $pos || 3 == $pos) ? $symbol . ' ' . $value : $value . ' ' . $symbol;
   }
   function sc_remove_currency(&$value, $symbol_dec, $symbol_tho, $symbol_mon)
   {
       $value = preg_replace('~&#x0*([0-9a-f]+);~ei', '', $value);
       $sNew  = str_replace($symbol_mon, '', $value);
       if ($sNew != $value)
       {
           $value = str_replace(' ', '', $sNew);
           return;
       }
       $aTest = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', $symbol_dec, $symbol_tho);
       $sNew  = '';
       for ($i = 0; $i < strlen($value); $i++)
       {
           if ($this->sc_test_currency_char($value[$i], $aTest))
           {
               $sNew .= $value[$i];
           }
       }
       $value = $sNew;
   }
   function sc_test_currency_char($char, $test)
   {
       $found = false;
       foreach ($test as $test_char)
       {
           if ($char === $test_char)
           {
               $found = true;
           }
       }
       return $found;
   }
   function nm_clear_val($Nome_Campo)
   {
      if ($Nome_Campo == "wtproducerqty")
      {
          if (!empty($this->field_config['wtproducerqty']['symbol_dec']))
          {
             nm_limpa_valor($this->wtproducerqty, $this->field_config['wtproducerqty']['symbol_dec'], $this->field_config['wtproducerqty']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "wtprducerm3")
      {
          nm_limpa_numero($this->wtprducerm3, $this->field_config['wtprducerm3']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "wtfdestqty")
      {
          if (!empty($this->field_config['wtfdestqty']['symbol_dec']))
          {
             nm_limpa_valor($this->wtfdestqty, $this->field_config['wtfdestqty']['symbol_dec'], $this->field_config['wtfdestqty']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "wtfdestm3")
      {
          nm_limpa_numero($this->wtfdestm3, $this->field_config['wtfdestm3']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "wtid")
      {
          nm_limpa_numero($this->wtid, $this->field_config['wtid']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "wtprofilid")
      {
          nm_limpa_numero($this->wtprofilid, $this->field_config['wtprofilid']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "intnumber")
      {
          nm_limpa_numero($this->intnumber, $this->field_config['intnumber']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "wttransporterperiferiaid")
      {
          nm_limpa_numero($this->wttransporterperiferiaid, $this->field_config['wttransporterperiferiaid']['symbol_grp']) ; 
      }
   }
   function nm_formatar_campos($format_fields = array())
   {
      global $nm_form_submit;
     if (isset($this->formatado) && $this->formatado)
     {
         return;
     }
     $this->formatado = true;
      if ((!empty($this->wtrequestdate) && 'null' != $this->wtrequestdate) || (!empty($format_fields) && isset($format_fields['wtrequestdate'])))
      {
          nm_volta_data($this->wtrequestdate, $this->field_config['wtrequestdate']['date_format']) ; 
          nmgp_Form_Datas($this->wtrequestdate, $this->field_config['wtrequestdate']['date_format'], $this->field_config['wtrequestdate']['date_sep']) ;  
      }
      elseif ('null' == $this->wtrequestdate || '' == $this->wtrequestdate)
      {
          $this->wtrequestdate = '';
      }
      if (!empty($this->wtproducerqty) || (!empty($format_fields) && isset($format_fields['wtproducerqty'])))
      {
          nmgp_Form_Num_Val($this->wtproducerqty, $this->field_config['wtproducerqty']['symbol_grp'], $this->field_config['wtproducerqty']['symbol_dec'], "3", "S", "", "", "", "-", $this->field_config['wtproducerqty']['symbol_fmt']) ; 
      }
      if (!empty($this->wtprducerm3) || (!empty($format_fields) && isset($format_fields['wtprducerm3'])))
      {
          nmgp_Form_Num_Val($this->wtprducerm3, $this->field_config['wtprducerm3']['symbol_grp'], $this->field_config['wtprducerm3']['symbol_dec'], "0", "S", "", "", "", "-", $this->field_config['wtprducerm3']['symbol_fmt']) ; 
      }
      if ((!empty($this->wttransportdate) && 'null' != $this->wttransportdate) || (!empty($format_fields) && isset($format_fields['wttransportdate'])))
      {
          nm_volta_data($this->wttransportdate, $this->field_config['wttransportdate']['date_format']) ; 
          nmgp_Form_Datas($this->wttransportdate, $this->field_config['wttransportdate']['date_format'], $this->field_config['wttransportdate']['date_sep']) ;  
      }
      elseif ('null' == $this->wttransportdate || '' == $this->wttransportdate)
      {
          $this->wttransportdate = '';
      }
      if ((!empty($this->wtfdestdate) && 'null' != $this->wtfdestdate) || (!empty($format_fields) && isset($format_fields['wtfdestdate'])))
      {
          nm_volta_data($this->wtfdestdate, $this->field_config['wtfdestdate']['date_format']) ; 
          nmgp_Form_Datas($this->wtfdestdate, $this->field_config['wtfdestdate']['date_format'], $this->field_config['wtfdestdate']['date_sep']) ;  
      }
      elseif ('null' == $this->wtfdestdate || '' == $this->wtfdestdate)
      {
          $this->wtfdestdate = '';
      }
      if (!empty($this->wtfdestqty) || (!empty($format_fields) && isset($format_fields['wtfdestqty'])))
      {
          nmgp_Form_Num_Val($this->wtfdestqty, $this->field_config['wtfdestqty']['symbol_grp'], $this->field_config['wtfdestqty']['symbol_dec'], "3", "S", "", "", "", "-", $this->field_config['wtfdestqty']['symbol_fmt']) ; 
      }
      if (!empty($this->wtfdestm3) || (!empty($format_fields) && isset($format_fields['wtfdestm3'])))
      {
          nmgp_Form_Num_Val($this->wtfdestm3, $this->field_config['wtfdestm3']['symbol_grp'], $this->field_config['wtfdestm3']['symbol_dec'], "0", "S", "", "", "", "-", $this->field_config['wtfdestm3']['symbol_fmt']) ; 
      }
   }
   function nm_gera_mask(&$nm_campo, $nm_mask)
   { 
      $trab_campo = $nm_campo;
      $trab_mask  = $nm_mask;
      $tam_campo  = strlen($nm_campo);
      $trab_saida = "";

      if (false !== strpos($nm_mask, '9') || false !== strpos($nm_mask, 'a') || false !== strpos($nm_mask, '*'))
      {
          $new_campo = '';
          $a_mask_ord  = array();
          $i_mask_size = -1;

          foreach (explode(';', $nm_mask) as $str_mask)
          {
              $a_mask_ord[ $this->nm_conta_mask_chars($str_mask) ] = $str_mask;
          }
          ksort($a_mask_ord);

          foreach ($a_mask_ord as $i_size => $s_mask)
          {
              if (-1 == $i_mask_size)
              {
                  $i_mask_size = $i_size;
              }
              elseif (strlen($nm_campo) >= $i_size && strlen($nm_campo) > $i_mask_size)
              {
                  $i_mask_size = $i_size;
              }
          }
          $nm_mask = $a_mask_ord[$i_mask_size];

          for ($i = 0; $i < strlen($nm_mask); $i++)
          {
              $test_mask = substr($nm_mask, $i, 1);
              
              if ('9' == $test_mask || 'a' == $test_mask || '*' == $test_mask)
              {
                  $new_campo .= substr($nm_campo, 0, 1);
                  $nm_campo   = substr($nm_campo, 1);
              }
              else
              {
                  $new_campo .= $test_mask;
              }
          }

                  $nm_campo = $new_campo;

          return;
      }

      $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 ($cont1 < $cont2 && $tam_campo <= $cont2 && $tam_campo > $cont1)
              {
                  $trab_mask = $ver_duas[1];
              }
              elseif ($cont1 > $cont2 && $tam_campo <= $cont2)
              {
                  $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 nm_conta_mask_chars($sMask)
   {
       $iLength = 0;

       for ($i = 0; $i < strlen($sMask); $i++)
       {
           if (in_array($sMask[$i], array('9', 'a', '*')))
           {
               $iLength++;
           }
       }

       return $iLength;
   }
   function nm_tira_mask(&$nm_campo, $nm_mask, $nm_chars = '')
   { 
      $mask_dados = $nm_campo;
      $trab_mask  = $nm_mask;
      $tam_campo  = strlen($nm_campo);
      $tam_mask   = strlen($nm_mask);
      $trab_saida = "";

      if (false !== strpos($nm_mask, '9') || false !== strpos($nm_mask, 'a') || false !== strpos($nm_mask, '*'))
      {
          $raw_campo = $this->sc_clear_mask($nm_campo, $nm_chars);
          $raw_mask  = $this->sc_clear_mask($nm_mask, $nm_chars);
          $new_campo = '';

          $test_mask = substr($raw_mask, 0, 1);
          $raw_mask  = substr($raw_mask, 1);

          while ('' != $raw_campo)
          {
              $test_val  = substr($raw_campo, 0, 1);
              $raw_campo = substr($raw_campo, 1);
              $ord       = ord($test_val);
              $found     = false;

              switch ($test_mask)
              {
                  case '9':
                      if (48 <= $ord && 57 >= $ord)
                      {
                          $new_campo .= $test_val;
                          $found      = true;
                      }
                      break;

                  case 'a':
                      if ((65 <= $ord && 90 >= $ord) || (97 <= $ord && 122 >= $ord))
                      {
                          $new_campo .= $test_val;
                          $found      = true;
                      }
                      break;

                  case '*':
                      if ((48 <= $ord && 57 >= $ord) || (65 <= $ord && 90 >= $ord) || (97 <= $ord && 122 >= $ord))
                      {
                          $new_campo .= $test_val;
                          $found      = true;
                      }
                      break;
              }

              if ($found)
              {
                  $test_mask = substr($raw_mask, 0, 1);
                  $raw_mask  = substr($raw_mask, 1);
              }
          }

          $nm_campo = $new_campo;

          return;
      }

      $mask_num = false;
      for ($x=0; $x < strlen($trab_mask); $x++)
      {
          if (substr($trab_mask, $x, 1) == "#")
          {
              $mask_num = true;
              break;
          }
      }
      if ($mask_num )
      {
          for ($x=0; $x < strlen($mask_dados); $x++)
          {
              if (is_numeric(substr($mask_dados, $x, 1)))
              {
                  $trab_saida .= substr($mask_dados, $x, 1);
              }
          }
          $nm_campo = $trab_saida;
          return;
      }
      if ($tam_mask > $tam_campo)
      {
         $mask_desfaz = "";
         for ($mask_ind = 0; $tam_mask > $tam_campo; $mask_ind++)
         {
              $mask_char = substr($trab_mask, $mask_ind, 1);
              if ($mask_char == "z")
              {
                  $tam_mask--;
              }
              else
              {
                  $mask_desfaz .= $mask_char;
              }
              if ($mask_ind == $tam_campo)
              {
                  $tam_mask = $tam_campo;
              }
         }
         $trab_mask = $mask_desfaz . substr($trab_mask, $mask_ind);
      }
      $mask_saida = "";
      for ($mask_ind = strlen($trab_mask); $mask_ind > 0; $mask_ind--)
      {
          $mask_char = substr($trab_mask, $mask_ind - 1, 1);
          if ($mask_char == "x" || $mask_char == "z")
          {
              if ($tam_campo > 0)
              {
                  $mask_saida = substr($mask_dados, $tam_campo - 1, 1) . $mask_saida;
              }
          }
          else
          {
              if ($mask_char != substr($mask_dados, $tam_campo - 1, 1) && $tam_campo > 0)
              {
                  $mask_saida = substr($mask_dados, $tam_campo - 1, 1) . $mask_saida;
                  $mask_ind--;
              }
          }
          $tam_campo--;
      }
      if ($tam_campo > 0)
      {
         $mask_saida = substr($mask_dados, 0, $tam_campo) . $mask_saida;
      }
      $nm_campo = $mask_saida;
   }

   function sc_clear_mask($value, $chars)
   {
       $new = '';

       for ($i = 0; $i < strlen($value); $i++)
       {
           if (false === strpos($chars, $value[$i]))
           {
               $new .= $value[$i];
           }
       }

       return $new;
   }
//
   function nm_limpa_alfa(&$str)
   {
       if (get_magic_quotes_gpc())
       {
           if (is_array($str))
           {
               $x = 0;
               foreach ($str as $cada_str)
               {
                   $str[$x] = stripslashes($str[$x]);
                   $x++;
               }
           }
           else
           {
               $str = stripslashes($str);
           }
       }
   }
//
//-- 
   function nm_converte_datas($use_null = true)
   {
       $guarda_format_hora = $this->field_config['wtrequestdate']['date_format'];
      if ($this->wtrequestdate != "")  
      { 
          nm_conv_data($this->wtrequestdate, $this->field_config['wtrequestdate']['date_format']) ; 
          $this->wtrequestdate_hora = "00:00:00:000" ; 
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
          {
              $this->wtrequestdate_hora = substr($this->wtrequestdate_hora, 0, -4);
          }
      } 
      if ($this->wtrequestdate == "" && $use_null)  
      { 
          $this->wtrequestdate = "null" ; 
      } 
       $this->field_config['wtrequestdate']['date_format'] = $guarda_format_hora;
       $guarda_format_hora = $this->field_config['wttransportdate']['date_format'];
      if ($this->wttransportdate != "")  
      { 
          nm_conv_data($this->wttransportdate, $this->field_config['wttransportdate']['date_format']) ; 
          $this->wttransportdate_hora = "00:00:00:000" ; 
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
          {
              $this->wttransportdate_hora = substr($this->wttransportdate_hora, 0, -4);
          }
      } 
      if ($this->wttransportdate == "" && $use_null)  
      { 
          $this->wttransportdate = "null" ; 
      } 
       $this->field_config['wttransportdate']['date_format'] = $guarda_format_hora;
       $guarda_format_hora = $this->field_config['wtfdestdate']['date_format'];
      if ($this->wtfdestdate != "")  
      { 
          nm_conv_data($this->wtfdestdate, $this->field_config['wtfdestdate']['date_format']) ; 
          $this->wtfdestdate_hora = "00:00:00:000" ; 
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
          {
              $this->wtfdestdate_hora = substr($this->wtfdestdate_hora, 0, -4);
          }
      } 
      if ($this->wtfdestdate == "" && $use_null)  
      { 
          $this->wtfdestdate = "null" ; 
      } 
       $this->field_config['wtfdestdate']['date_format'] = $guarda_format_hora;
   }
   function nm_conv_data_db($dt_in, $form_in, $form_out, $replaces = array())
   {
       $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, $replaces);
       return $dt_out;
   }

   function returnWhere($aCond, $sOp = 'AND')
   {
       $aWhere = array();
       foreach ($aCond as $sCond)
       {
           $this->handleWhereCond($sCond);
           if ('' != $sCond)
           {
               $aWhere[] = $sCond;
           }
       }
       if (empty($aWhere))
       {
           return '';
       }
       else
       {
           return ' WHERE (' . implode(') ' . $sOp . ' (', $aWhere) . ')';
       }
   } // returnWhere

   function handleWhereCond(&$sCond)
   {
       $sCond = trim($sCond);
       if ('where' == strtolower(substr($sCond, 0, 5)))
       {
           $sCond = trim(substr($sCond, 5));
       }
   } // handleWhereCond

   function ajax_return_values()
   {
          $this->ajax_return_values_wtrequestdate();
          $this->ajax_return_values_wtproducerbranchid();
          $this->ajax_return_values_producerb_address();
          $this->ajax_return_values_prbrresponse();
          $this->ajax_return_values_pphone();
          $this->ajax_return_values_premail();
          $this->ajax_return_values_wtproducerewc();
          $this->ajax_return_values_ewctitle();
          $this->ajax_return_values_wtproducerperiferia();
          $this->ajax_return_values_wtproduceracceptweigth();
          $this->ajax_return_values_wtproducerqty();
          $this->ajax_return_values_wtprducerm3();
          $this->ajax_return_values_wtproducersign();
          $this->ajax_return_values_wttransportdate();
          $this->ajax_return_values_wttransporternumberid();
          $this->ajax_return_values_wttransportervechicle();
          $this->ajax_return_values_wttransporterid();
          $this->ajax_return_values_envregistrationno_transporter();
          $this->ajax_return_values_transporterresponse();
          $this->ajax_return_values_transporteremail();
          $this->ajax_return_values_transporterphone();
          $this->ajax_return_values_transporterfax();
          $this->ajax_return_values_checktransvsproducer();
          $this->ajax_return_values_checktransportervsfdest();
          $this->ajax_return_values_wtwasteid();
          $this->ajax_return_values_wtequipment();
          $this->ajax_return_values_wttransportersign();
          $this->ajax_return_values_wtfdestdate();
          $this->ajax_return_values_wtfdestid();
          $this->ajax_return_values_wtfdestperiferia();
          $this->ajax_return_values_envregistrationno_fdest();
          $this->ajax_return_values_fdestaddress();
          $this->ajax_return_values_fdestrespone();
          $this->ajax_return_values_fdestphone();
          $this->ajax_return_values_fdestresponseemail();
          $this->ajax_return_values_wtfdestewc();
          $this->ajax_return_values_fdewctitle();
          $this->ajax_return_values_wtfdestrd();
          $this->ajax_return_values_wtfdestqty();
          $this->ajax_return_values_wtfdestm3();
          $this->ajax_return_values_wtfdestsign();
          $this->ajax_return_values_wtproducerremarks();
          $this->ajax_return_values_wtid();
          if ('navigate_form' == $this->NM_ajax_opcao)
          {
              $this->NM_ajax_info['clearUpload']      = 'S';
              $this->NM_ajax_info['navStatus']['ret'] = $this->Nav_permite_ret ? 'S' : 'N';
              $this->NM_ajax_info['navStatus']['ava'] = $this->Nav_permite_ava ? 'S' : 'N';
              $this->NM_ajax_info['fldList']['wtid']['keyVal'] = validate_wastetransactions_mob_pack_protect_string($this->nmgp_dados_form['wtid']);
          }
   } // ajax_return_values

          //----- wtrequestdate
   function ajax_return_values_wtrequestdate($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtrequestdate", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtrequestdate);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['wtrequestdate'] = array(
                       'row'    => '',
               'type'    => 'text',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- wtproducerbranchid
   function ajax_return_values_wtproducerbranchid($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtproducerbranchid", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtproducerbranchid);
              $aLookup = array();
              $this->_tmp_lookup_wtproducerbranchid = $this->wtproducerbranchid;

 
$nmgp_def_dados = "" ; 
if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerbranchid']))
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerbranchid'] = array_unique($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerbranchid']); 
}
else
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerbranchid'] = array(); 
}
$aLookup[] = array(validate_wastetransactions_mob_pack_protect_string('') => validate_wastetransactions_mob_pack_protect_string('---Επιλογή εγκατάστασης---'));
$_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerbranchid'][] = '';
   $nm_nao_carga = false;
   $nmgp_def_dados = "" ; 

   $old_value_wtrequestdate = $this->wtrequestdate;
   $old_value_wtproducerqty = $this->wtproducerqty;
   $old_value_wtprducerm3 = $this->wtprducerm3;
   $old_value_wttransportdate = $this->wttransportdate;
   $old_value_wtfdestdate = $this->wtfdestdate;
   $old_value_wtfdestqty = $this->wtfdestqty;
   $old_value_wtfdestm3 = $this->wtfdestm3;
   $this->nm_tira_formatacao();
   $this->nm_converte_datas(false);


   $unformatted_value_wtrequestdate = $this->wtrequestdate;
   $unformatted_value_wtproducerqty = $this->wtproducerqty;
   $unformatted_value_wtprducerm3 = $this->wtprducerm3;
   $unformatted_value_wttransportdate = $this->wttransportdate;
   $unformatted_value_wtfdestdate = $this->wtfdestdate;
   $unformatted_value_wtfdestqty = $this->wtfdestqty;
   $unformatted_value_wtfdestm3 = $this->wtfdestm3;

   $nm_comando = "SELECT PrBID, PrBranchName 
FROM producerbranch 
where ProfilID = " . $_SESSION['ProfilID'] . "
ORDER BY PrBranchName";

   $this->wtrequestdate = $old_value_wtrequestdate;
   $this->wtproducerqty = $old_value_wtproducerqty;
   $this->wtprducerm3 = $old_value_wtprducerm3;
   $this->wttransportdate = $old_value_wttransportdate;
   $this->wtfdestdate = $old_value_wtfdestdate;
   $this->wtfdestqty = $old_value_wtfdestqty;
   $this->wtfdestm3 = $old_value_wtfdestm3;

   $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando; 
   $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
   if ($nm_comando != "" && $rs = $this->Db->Execute($nm_comando)) 
   {
       while (!$rs->EOF) 
       { 
              $rs->fields[0] = str_replace(',', '.', $rs->fields[0]);
              $rs->fields[0] = (strpos(strtolower($rs->fields[0]), "e")) ? (float)$rs->fields[0] : $rs->fields[0];
              $rs->fields[0] = (string)$rs->fields[0];
              $aLookup[] = array(validate_wastetransactions_mob_pack_protect_string($rs->fields[0]) => validate_wastetransactions_mob_pack_protect_string(NM_charset_to_utf8($rs->fields[1])));
              $nmgp_def_dados .= $rs->fields[1] . "?#?" ; 
              $nmgp_def_dados .= $rs->fields[0] . "?#?N?@?" ; 
              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerbranchid'][] = $rs->fields[0];
              $rs->MoveNext() ; 
       } 
       $rs->Close() ; 
   } 
   elseif ($GLOBALS["NM_ERRO_IBASE"] != 1 && $nm_comando != "")  
   {  
       $this->Erro->mensagem(__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
       exit; 
   } 
   $GLOBALS["NM_ERRO_IBASE"] = 0; 
          $aLookupOrig = $aLookup;
          $sSelComp = "name=\"wtproducerbranchid\"";
          if (isset($this->NM_ajax_info['select_html']['wtproducerbranchid']) && !empty($this->NM_ajax_info['select_html']['wtproducerbranchid']))
          {
              $sSelComp = $this->NM_ajax_info['select_html']['wtproducerbranchid'];
          }
          $sLookup = '';
          if (empty($aLookup))
          {
              $aLookup[] = array('' => '');
          }
          foreach ($aLookup as $aOption)
          {
              foreach ($aOption as $sValue => $sLabel)
              {

                  if ($this->wtproducerbranchid == $sValue)
                  {
                      $this->_tmp_lookup_wtproducerbranchid = $sLabel;
                  }

                  $sOpt     = ($sValue !== $sLabel) ? $sValue : $sLabel;
                  $sLookup .= "<option value=\"" . $sOpt . "\">" . $sLabel . "</option>";
              }
          }
          $aLookup  = $sLookup;
          $this->NM_ajax_info['fldList']['wtproducerbranchid'] = array(
                       'row'    => '',
               'type'    => 'select',
               'valList' => array($sTmpValue),
               'optList' => $aLookup,
              );
          $aLabel     = array();
          $aLabelTemp = array();
          foreach ($aLookupOrig as $aValData)
          {
              if (in_array(key($aValData), $this->NM_ajax_info['fldList']['wtproducerbranchid']['valList']))
              {
                  $aLabelTemp[key($aValData)] = current($aValData);
              }
          }
          foreach ($this->NM_ajax_info['fldList']['wtproducerbranchid']['valList'] as $iIndex => $sValue)
          {
              $aLabel[$iIndex] = (isset($aLabelTemp[$sValue])) ? $aLabelTemp[$sValue] : $sValue;
          }
          $this->NM_ajax_info['fldList']['wtproducerbranchid']['labList'] = $aLabel;
          }
   }

          //----- producerb_address
   function ajax_return_values_producerb_address($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("producerb_address", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->producerb_address);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['producerb_address'] = array(
                       'row'    => '',
               'type'    => 'label',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- prbrresponse
   function ajax_return_values_prbrresponse($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("prbrresponse", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->prbrresponse);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['prbrresponse'] = array(
                       'row'    => '',
               'type'    => 'label',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- pphone
   function ajax_return_values_pphone($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("pphone", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->pphone);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['pphone'] = array(
                       'row'    => '',
               'type'    => 'label',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- premail
   function ajax_return_values_premail($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("premail", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->premail);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['premail'] = array(
                       'row'    => '',
               'type'    => 'label',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- wtproducerewc
   function ajax_return_values_wtproducerewc($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtproducerewc", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtproducerewc);
              $aLookup = array();
              $this->_tmp_lookup_wtproducerewc = $this->wtproducerewc;

 
$nmgp_def_dados = "" ; 
if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerewc']))
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerewc'] = array_unique($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerewc']); 
}
else
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerewc'] = array(); 
}
$aLookup[] = array(validate_wastetransactions_mob_pack_protect_string('') => validate_wastetransactions_mob_pack_protect_string('---Επιλογή αποβλήτου---'));
$_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerewc'][] = '';
if ($this->wtproducerbranchid != "")
{ 
   $this->nm_clear_val("wtproducerbranchid");
   $nm_nao_carga = false;
   $nmgp_def_dados = "" ; 

   $old_value_wtrequestdate = $this->wtrequestdate;
   $old_value_wtproducerqty = $this->wtproducerqty;
   $old_value_wtprducerm3 = $this->wtprducerm3;
   $old_value_wttransportdate = $this->wttransportdate;
   $old_value_wtfdestdate = $this->wtfdestdate;
   $old_value_wtfdestqty = $this->wtfdestqty;
   $old_value_wtfdestm3 = $this->wtfdestm3;
   $this->nm_tira_formatacao();
   $this->nm_converte_datas(false);


   $unformatted_value_wtrequestdate = $this->wtrequestdate;
   $unformatted_value_wtproducerqty = $this->wtproducerqty;
   $unformatted_value_wtprducerm3 = $this->wtprducerm3;
   $unformatted_value_wttransportdate = $this->wttransportdate;
   $unformatted_value_wtfdestdate = $this->wtfdestdate;
   $unformatted_value_wtfdestqty = $this->wtfdestqty;
   $unformatted_value_wtfdestm3 = $this->wtfdestm3;

   $nm_comando = "SELECT EWC, EWC 
FROM producerewcbranch 
where producerbranchid = '$this->wtproducerbranchid'
ORDER BY EWC";

   $this->wtrequestdate = $old_value_wtrequestdate;
   $this->wtproducerqty = $old_value_wtproducerqty;
   $this->wtprducerm3 = $old_value_wtprducerm3;
   $this->wttransportdate = $old_value_wttransportdate;
   $this->wtfdestdate = $old_value_wtfdestdate;
   $this->wtfdestqty = $old_value_wtfdestqty;
   $this->wtfdestm3 = $old_value_wtfdestm3;

   $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando; 
   $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
   if ($nm_comando != "" && $rs = $this->Db->Execute($nm_comando)) 
   {
       while (!$rs->EOF) 
       { 
              $aLookup[] = array(validate_wastetransactions_mob_pack_protect_string($rs->fields[0]) => validate_wastetransactions_mob_pack_protect_string(NM_charset_to_utf8($rs->fields[1])));
              $nmgp_def_dados .= $rs->fields[1] . "?#?" ; 
              $nmgp_def_dados .= $rs->fields[0] . "?#?N?@?" ; 
              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerewc'][] = $rs->fields[0];
              $rs->MoveNext() ; 
       } 
       $rs->Close() ; 
   } 
   elseif ($GLOBALS["NM_ERRO_IBASE"] != 1 && $nm_comando != "")  
   {  
       $this->Erro->mensagem(__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
       exit; 
   } 
   $GLOBALS["NM_ERRO_IBASE"] = 0; 
} 
          $aLookupOrig = $aLookup;
          $sSelComp = "name=\"wtproducerewc\"";
          if (isset($this->NM_ajax_info['select_html']['wtproducerewc']) && !empty($this->NM_ajax_info['select_html']['wtproducerewc']))
          {
              $sSelComp = $this->NM_ajax_info['select_html']['wtproducerewc'];
          }
          $sLookup = '';
          if (empty($aLookup))
          {
              $aLookup[] = array('' => '');
          }
          foreach ($aLookup as $aOption)
          {
              foreach ($aOption as $sValue => $sLabel)
              {

                  if ($this->wtproducerewc == $sValue)
                  {
                      $this->_tmp_lookup_wtproducerewc = $sLabel;
                  }

                  $sOpt     = ($sValue !== $sLabel) ? $sValue : $sLabel;
                  $sLookup .= "<option value=\"" . $sOpt . "\">" . $sLabel . "</option>";
              }
          }
          $aLookup  = $sLookup;
          $this->NM_ajax_info['fldList']['wtproducerewc'] = array(
                       'row'    => '',
               'type'    => 'select',
               'valList' => array($sTmpValue),
               'optList' => $aLookup,
              );
          $aLabel     = array();
          $aLabelTemp = array();
          foreach ($aLookupOrig as $aValData)
          {
              if (in_array(key($aValData), $this->NM_ajax_info['fldList']['wtproducerewc']['valList']))
              {
                  $aLabelTemp[key($aValData)] = current($aValData);
              }
          }
          foreach ($this->NM_ajax_info['fldList']['wtproducerewc']['valList'] as $iIndex => $sValue)
          {
              $aLabel[$iIndex] = (isset($aLabelTemp[$sValue])) ? $aLabelTemp[$sValue] : $sValue;
          }
          $this->NM_ajax_info['fldList']['wtproducerewc']['labList'] = $aLabel;
          }
   }

          //----- ewctitle
   function ajax_return_values_ewctitle($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("ewctitle", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->ewctitle);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['ewctitle'] = array(
                       'row'    => '',
               'type'    => 'label',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- wtproducerperiferia
   function ajax_return_values_wtproducerperiferia($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtproducerperiferia", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtproducerperiferia);
              $aLookup = array();
              $this->_tmp_lookup_wtproducerperiferia = $this->wtproducerperiferia;

 
$nmgp_def_dados = "" ; 
if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerperiferia']))
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerperiferia'] = array_unique($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerperiferia']); 
}
else
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerperiferia'] = array(); 
}
$aLookup[] = array(validate_wastetransactions_mob_pack_protect_string('') => validate_wastetransactions_mob_pack_protect_string('---Περιφέρεια εγκατάστασης---'));
$_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerperiferia'][] = '';
if ($this->wtproducerperiferia != "")
{ 
   $this->nm_clear_val("wtproducerperiferia");
   $nm_nao_carga = false;
   $nmgp_def_dados = "" ; 

   $old_value_wtrequestdate = $this->wtrequestdate;
   $old_value_wtproducerqty = $this->wtproducerqty;
   $old_value_wtprducerm3 = $this->wtprducerm3;
   $old_value_wttransportdate = $this->wttransportdate;
   $old_value_wtfdestdate = $this->wtfdestdate;
   $old_value_wtfdestqty = $this->wtfdestqty;
   $old_value_wtfdestm3 = $this->wtfdestm3;
   $this->nm_tira_formatacao();
   $this->nm_converte_datas(false);


   $unformatted_value_wtrequestdate = $this->wtrequestdate;
   $unformatted_value_wtproducerqty = $this->wtproducerqty;
   $unformatted_value_wtprducerm3 = $this->wtprducerm3;
   $unformatted_value_wttransportdate = $this->wttransportdate;
   $unformatted_value_wtfdestdate = $this->wtfdestdate;
   $unformatted_value_wtfdestqty = $this->wtfdestqty;
   $unformatted_value_wtfdestm3 = $this->wtfdestm3;

   $nm_comando = "SELECT PerifID, PerifName 
FROM perif 
WHERE PerifID = '$this->wtproducerperiferia'
ORDER BY PerifName";

   $this->wtrequestdate = $old_value_wtrequestdate;
   $this->wtproducerqty = $old_value_wtproducerqty;
   $this->wtprducerm3 = $old_value_wtprducerm3;
   $this->wttransportdate = $old_value_wttransportdate;
   $this->wtfdestdate = $old_value_wtfdestdate;
   $this->wtfdestqty = $old_value_wtfdestqty;
   $this->wtfdestm3 = $old_value_wtfdestm3;

   $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando; 
   $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
   if ($nm_comando != "" && $rs = $this->Db->Execute($nm_comando)) 
   {
       while (!$rs->EOF) 
       { 
              $rs->fields[0] = str_replace(',', '.', $rs->fields[0]);
              $rs->fields[0] = (strpos(strtolower($rs->fields[0]), "e")) ? (float)$rs->fields[0] : $rs->fields[0];
              $rs->fields[0] = (string)$rs->fields[0];
              $aLookup[] = array(validate_wastetransactions_mob_pack_protect_string($rs->fields[0]) => validate_wastetransactions_mob_pack_protect_string(NM_charset_to_utf8($rs->fields[1])));
              $nmgp_def_dados .= $rs->fields[1] . "?#?" ; 
              $nmgp_def_dados .= $rs->fields[0] . "?#?N?@?" ; 
              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproducerperiferia'][] = $rs->fields[0];
              $rs->MoveNext() ; 
       } 
       $rs->Close() ; 
   } 
   elseif ($GLOBALS["NM_ERRO_IBASE"] != 1 && $nm_comando != "")  
   {  
       $this->Erro->mensagem(__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
       exit; 
   } 
   $GLOBALS["NM_ERRO_IBASE"] = 0; 
} 
          $aLookupOrig = $aLookup;
          $sSelComp = "name=\"wtproducerperiferia\"";
          if (isset($this->NM_ajax_info['select_html']['wtproducerperiferia']) && !empty($this->NM_ajax_info['select_html']['wtproducerperiferia']))
          {
              $sSelComp = $this->NM_ajax_info['select_html']['wtproducerperiferia'];
          }
          $sLookup = '';
          if (empty($aLookup))
          {
              $aLookup[] = array('' => '');
          }
          foreach ($aLookup as $aOption)
          {
              foreach ($aOption as $sValue => $sLabel)
              {

                  if ($this->wtproducerperiferia == $sValue)
                  {
                      $this->_tmp_lookup_wtproducerperiferia = $sLabel;
                  }

                  $sOpt     = ($sValue !== $sLabel) ? $sValue : $sLabel;
                  $sLookup .= "<option value=\"" . $sOpt . "\">" . $sLabel . "</option>";
              }
          }
          $aLookup  = $sLookup;
          $this->NM_ajax_info['fldList']['wtproducerperiferia'] = array(
                       'row'    => '',
               'type'    => 'select',
               'valList' => array($sTmpValue),
               'optList' => $aLookup,
              );
          $aLabel     = array();
          $aLabelTemp = array();
          foreach ($aLookupOrig as $aValData)
          {
              if (in_array(key($aValData), $this->NM_ajax_info['fldList']['wtproducerperiferia']['valList']))
              {
                  $aLabelTemp[key($aValData)] = current($aValData);
              }
          }
          foreach ($this->NM_ajax_info['fldList']['wtproducerperiferia']['valList'] as $iIndex => $sValue)
          {
              $aLabel[$iIndex] = (isset($aLabelTemp[$sValue])) ? $aLabelTemp[$sValue] : $sValue;
          }
          $this->NM_ajax_info['fldList']['wtproducerperiferia']['labList'] = $aLabel;
          }
   }

          //----- wtproduceracceptweigth
   function ajax_return_values_wtproduceracceptweigth($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtproduceracceptweigth", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtproduceracceptweigth);
              $aLookup = array();
              $this->_tmp_lookup_wtproduceracceptweigth = $this->wtproduceracceptweigth;

$aLookup[] = array(validate_wastetransactions_mob_pack_protect_string('1') => validate_wastetransactions_mob_pack_protect_string("Αποδέχομαι το βάρος του παραλήτη "));
$_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtproduceracceptweigth'][] = '1';
          $aLookupOrig = $aLookup;
          $sOptComp = "";
          if (isset($this->NM_ajax_info['select_html']['wtproduceracceptweigth']) && !empty($this->NM_ajax_info['select_html']['wtproduceracceptweigth']))
          {
              $sOptComp = $this->NM_ajax_info['select_html']['wtproduceracceptweigth'];
          }
          $this->NM_ajax_info['fldList']['wtproduceracceptweigth'] = array(
                       'row'    => '',
               'type'    => 'checkbox',
               'valList' => explode(';', $this->wtproduceracceptweigth),
               'colNum'  => 1,
               'optComp'  => $sOptComp,
               'optClass' => 'sc-ui-checkbox-wtproduceracceptweigth',
              );
          $aLabel     = array();
          $aLabelTemp = array();
          foreach ($aLookupOrig as $aValData)
          {
              if (in_array(key($aValData), $this->NM_ajax_info['fldList']['wtproduceracceptweigth']['valList']))
              {
                  $aLabelTemp[key($aValData)] = current($aValData);
              }
          }
          foreach ($this->NM_ajax_info['fldList']['wtproduceracceptweigth']['valList'] as $iIndex => $sValue)
          {
              $aLabel[$iIndex] = (isset($aLabelTemp[$sValue])) ? $aLabelTemp[$sValue] : $sValue;
          }
          $this->NM_ajax_info['fldList']['wtproduceracceptweigth']['labList'] = $aLabel;
          }
   }

          //----- wtproducerqty
   function ajax_return_values_wtproducerqty($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtproducerqty", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtproducerqty);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['wtproducerqty'] = array(
                       'row'    => '',
               'type'    => 'text',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- wtprducerm3
   function ajax_return_values_wtprducerm3($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtprducerm3", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtprducerm3);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['wtprducerm3'] = array(
                       'row'    => '',
               'type'    => 'text',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- wtproducersign
   function ajax_return_values_wtproducersign($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtproducersign", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtproducersign);
              $aLookup = array();
   $out_wtproducersign = '';
   $out1_wtproducersign = '';
   if ('' != $this->wtproducersign_ul_name && @is_file($this->Ini->root . $this->Ini->path_imag_temp . '/' . $this->wtproducersign_ul_name))
   {
       $this->wtproducersign = @file_get_contents($this->Ini->root . $this->Ini->path_imag_temp . '/' . $this->wtproducersign_ul_name);
   }
   if ($this->wtproducersign != "" && $this->wtproducersign != "none")   
   { 
       $out_wtproducersign = $this->Ini->path_imag_temp . "/sc_wtproducersign_" . $_SESSION['scriptcase']['sc_num_img'] . session_id() . ".gif" ;  
       $out1_wtproducersign = $out_wtproducersign; 
       $arq_wtproducersign = fopen($this->Ini->root . $out_wtproducersign, "w") ;  
       if (substr($this->wtproducersign, 0, 4) == "*nm*") 
       { 
           $this->wtproducersign = substr($this->wtproducersign, 4) ; 
           $this->wtproducersign = base64_decode($this->wtproducersign) ; 
       } 
       $img_pos_bm = strpos($this->wtproducersign, "BM") ; 
       if (!$img_pos_bm === FALSE && $img_pos_bm == 78) 
       { 
           $this->wtproducersign = substr($this->wtproducersign, $img_pos_bm) ; 
       } 
       fwrite($arq_wtproducersign, $this->wtproducersign) ;  
       fclose($arq_wtproducersign) ;  
       $_SESSION['scriptcase']['sc_num_img']++ ; 
       $out_wtproducersign = $this->Ini->path_imag_temp . "/sc_" . "wtproducersign_" . $_SESSION['scriptcase']['sc_num_img'] . session_id() . ".gif" ; 
       $_SESSION['scriptcase']['sc_num_img']++ ; 
       if (!$this->Ini->Gd_missing)
       { 
           $sc_obj_img = new nm_trata_img($this->Ini->root . $out1_wtproducersign);
           $sc_obj_img->setWidth(90);
           $sc_obj_img->setHeight(90);
           $sc_obj_img->createImg($this->Ini->root . $out_wtproducersign);
       } 
       else 
       { 
           $out_wtproducersign = $out1_wtproducersign;
       } 
       $_SESSION['scriptcase']['sc_num_img']++ ; 
   } 
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['wtproducersign'] = array(
                       'row'    => '',
               'type'    => 'imagem',
               'valList' => array($this->Ini->Nm_lang['lang_othr_show_imgg']),
               'imgFile' => $out_wtproducersign,
               'imgOrig' => $out1_wtproducersign,
               'keepImg' => $sKeepImage,
              );
          }
   }

          //----- wttransportdate
   function ajax_return_values_wttransportdate($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wttransportdate", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wttransportdate);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['wttransportdate'] = array(
                       'row'    => '',
               'type'    => 'text',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- wttransporternumberid
   function ajax_return_values_wttransporternumberid($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wttransporternumberid", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wttransporternumberid);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['wttransporternumberid'] = array(
                       'row'    => '',
               'type'    => 'text',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- wttransportervechicle
   function ajax_return_values_wttransportervechicle($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wttransportervechicle", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wttransportervechicle);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['wttransportervechicle'] = array(
                       'row'    => '',
               'type'    => 'text',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- wttransporterid
   function ajax_return_values_wttransporterid($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wttransporterid", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wttransporterid);
              $aLookup = array();
              $this->_tmp_lookup_wttransporterid = $this->wttransporterid;

 
$nmgp_def_dados = "" ; 
if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wttransporterid']))
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wttransporterid'] = array_unique($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wttransporterid']); 
}
else
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wttransporterid'] = array(); 
}
$aLookup[] = array(validate_wastetransactions_mob_pack_protect_string('') => validate_wastetransactions_mob_pack_protect_string('---Επιλογή μεταφορέα---'));
$_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wttransporterid'][] = '';
   $nm_nao_carga = false;
   $nmgp_def_dados = "" ; 

   $old_value_wtrequestdate = $this->wtrequestdate;
   $old_value_wtproducerqty = $this->wtproducerqty;
   $old_value_wtprducerm3 = $this->wtprducerm3;
   $old_value_wttransportdate = $this->wttransportdate;
   $old_value_wtfdestdate = $this->wtfdestdate;
   $old_value_wtfdestqty = $this->wtfdestqty;
   $old_value_wtfdestm3 = $this->wtfdestm3;
   $this->nm_tira_formatacao();
   $this->nm_converte_datas(false);


   $unformatted_value_wtrequestdate = $this->wtrequestdate;
   $unformatted_value_wtproducerqty = $this->wtproducerqty;
   $unformatted_value_wtprducerm3 = $this->wtprducerm3;
   $unformatted_value_wttransportdate = $this->wttransportdate;
   $unformatted_value_wtfdestdate = $this->wtfdestdate;
   $unformatted_value_wtfdestqty = $this->wtfdestqty;
   $unformatted_value_wtfdestm3 = $this->wtfdestm3;

   $nm_comando = "SELECT TransporterID, Trans_Title 
FROM transporter 
WHERE ProfilID= " . $_SESSION['ProfilID'] . "
ORDER BY Trans_Title";

   $this->wtrequestdate = $old_value_wtrequestdate;
   $this->wtproducerqty = $old_value_wtproducerqty;
   $this->wtprducerm3 = $old_value_wtprducerm3;
   $this->wttransportdate = $old_value_wttransportdate;
   $this->wtfdestdate = $old_value_wtfdestdate;
   $this->wtfdestqty = $old_value_wtfdestqty;
   $this->wtfdestm3 = $old_value_wtfdestm3;

   $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando; 
   $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
   if ($nm_comando != "" && $rs = $this->Db->Execute($nm_comando)) 
   {
       while (!$rs->EOF) 
       { 
              $rs->fields[0] = str_replace(',', '.', $rs->fields[0]);
              $rs->fields[0] = (strpos(strtolower($rs->fields[0]), "e")) ? (float)$rs->fields[0] : $rs->fields[0];
              $rs->fields[0] = (string)$rs->fields[0];
              $aLookup[] = array(validate_wastetransactions_mob_pack_protect_string($rs->fields[0]) => validate_wastetransactions_mob_pack_protect_string(NM_charset_to_utf8($rs->fields[1])));
              $nmgp_def_dados .= $rs->fields[1] . "?#?" ; 
              $nmgp_def_dados .= $rs->fields[0] . "?#?N?@?" ; 
              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wttransporterid'][] = $rs->fields[0];
              $rs->MoveNext() ; 
       } 
       $rs->Close() ; 
   } 
   elseif ($GLOBALS["NM_ERRO_IBASE"] != 1 && $nm_comando != "")  
   {  
       $this->Erro->mensagem(__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
       exit; 
   } 
   $GLOBALS["NM_ERRO_IBASE"] = 0; 
          $aLookupOrig = $aLookup;
          $sSelComp = "name=\"wttransporterid\"";
          if (isset($this->NM_ajax_info['select_html']['wttransporterid']) && !empty($this->NM_ajax_info['select_html']['wttransporterid']))
          {
              $sSelComp = $this->NM_ajax_info['select_html']['wttransporterid'];
          }
          $sLookup = '';
          if (empty($aLookup))
          {
              $aLookup[] = array('' => '');
          }
          foreach ($aLookup as $aOption)
          {
              foreach ($aOption as $sValue => $sLabel)
              {

                  if ($this->wttransporterid == $sValue)
                  {
                      $this->_tmp_lookup_wttransporterid = $sLabel;
                  }

                  $sOpt     = ($sValue !== $sLabel) ? $sValue : $sLabel;
                  $sLookup .= "<option value=\"" . $sOpt . "\">" . $sLabel . "</option>";
              }
          }
          $aLookup  = $sLookup;
          $this->NM_ajax_info['fldList']['wttransporterid'] = array(
                       'row'    => '',
               'type'    => 'select',
               'valList' => array($sTmpValue),
               'optList' => $aLookup,
              );
          $aLabel     = array();
          $aLabelTemp = array();
          foreach ($aLookupOrig as $aValData)
          {
              if (in_array(key($aValData), $this->NM_ajax_info['fldList']['wttransporterid']['valList']))
              {
                  $aLabelTemp[key($aValData)] = current($aValData);
              }
          }
          foreach ($this->NM_ajax_info['fldList']['wttransporterid']['valList'] as $iIndex => $sValue)
          {
              $aLabel[$iIndex] = (isset($aLabelTemp[$sValue])) ? $aLabelTemp[$sValue] : $sValue;
          }
          $this->NM_ajax_info['fldList']['wttransporterid']['labList'] = $aLabel;
          }
   }

          //----- envregistrationno_transporter
   function ajax_return_values_envregistrationno_transporter($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("envregistrationno_transporter", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->envregistrationno_transporter);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['envregistrationno_transporter'] = array(
                       'row'    => '',
               'type'    => 'text',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- transporterresponse
   function ajax_return_values_transporterresponse($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("transporterresponse", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->transporterresponse);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['transporterresponse'] = array(
                       'row'    => '',
               'type'    => 'label',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- transporteremail
   function ajax_return_values_transporteremail($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("transporteremail", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->transporteremail);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['transporteremail'] = array(
                       'row'    => '',
               'type'    => 'label',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- transporterphone
   function ajax_return_values_transporterphone($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("transporterphone", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->transporterphone);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['transporterphone'] = array(
                       'row'    => '',
               'type'    => 'label',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- transporterfax
   function ajax_return_values_transporterfax($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("transporterfax", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->transporterfax);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['transporterfax'] = array(
                       'row'    => '',
               'type'    => 'label',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- checktransvsproducer
   function ajax_return_values_checktransvsproducer($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("checktransvsproducer", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->checktransvsproducer);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['checktransvsproducer'] = array(
                       'row'    => '',
               'type'    => 'label',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- checktransportervsfdest
   function ajax_return_values_checktransportervsfdest($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("checktransportervsfdest", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->checktransportervsfdest);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['checktransportervsfdest'] = array(
                       'row'    => '',
               'type'    => 'label',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- wtwasteid
   function ajax_return_values_wtwasteid($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtwasteid", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtwasteid);
              $aLookup = array();
              $this->_tmp_lookup_wtwasteid = $this->wtwasteid;

 
$nmgp_def_dados = "" ; 
if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtwasteid']))
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtwasteid'] = array_unique($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtwasteid']); 
}
else
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtwasteid'] = array(); 
}
$aLookup[] = array(validate_wastetransactions_mob_pack_protect_string('') => validate_wastetransactions_mob_pack_protect_string('---Κατάσταση φορτίου---'));
$_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtwasteid'][] = '';
   $nm_nao_carga = false;
   $nmgp_def_dados = "" ; 

   $old_value_wtrequestdate = $this->wtrequestdate;
   $old_value_wtproducerqty = $this->wtproducerqty;
   $old_value_wtprducerm3 = $this->wtprducerm3;
   $old_value_wttransportdate = $this->wttransportdate;
   $old_value_wtfdestdate = $this->wtfdestdate;
   $old_value_wtfdestqty = $this->wtfdestqty;
   $old_value_wtfdestm3 = $this->wtfdestm3;
   $this->nm_tira_formatacao();
   $this->nm_converte_datas(false);


   $unformatted_value_wtrequestdate = $this->wtrequestdate;
   $unformatted_value_wtproducerqty = $this->wtproducerqty;
   $unformatted_value_wtprducerm3 = $this->wtprducerm3;
   $unformatted_value_wttransportdate = $this->wttransportdate;
   $unformatted_value_wtfdestdate = $this->wtfdestdate;
   $unformatted_value_wtfdestqty = $this->wtfdestqty;
   $unformatted_value_wtfdestm3 = $this->wtfdestm3;

   $nm_comando = "SELECT WasteID, WasteTitle 
FROM wasteliq 
ORDER BY WasteTitle";

   $this->wtrequestdate = $old_value_wtrequestdate;
   $this->wtproducerqty = $old_value_wtproducerqty;
   $this->wtprducerm3 = $old_value_wtprducerm3;
   $this->wttransportdate = $old_value_wttransportdate;
   $this->wtfdestdate = $old_value_wtfdestdate;
   $this->wtfdestqty = $old_value_wtfdestqty;
   $this->wtfdestm3 = $old_value_wtfdestm3;

   $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando; 
   $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
   if ($nm_comando != "" && $rs = $this->Db->Execute($nm_comando)) 
   {
       while (!$rs->EOF) 
       { 
              $rs->fields[0] = str_replace(',', '.', $rs->fields[0]);
              $rs->fields[0] = (strpos(strtolower($rs->fields[0]), "e")) ? (float)$rs->fields[0] : $rs->fields[0];
              $rs->fields[0] = (string)$rs->fields[0];
              $aLookup[] = array(validate_wastetransactions_mob_pack_protect_string($rs->fields[0]) => validate_wastetransactions_mob_pack_protect_string(NM_charset_to_utf8($rs->fields[1])));
              $nmgp_def_dados .= $rs->fields[1] . "?#?" ; 
              $nmgp_def_dados .= $rs->fields[0] . "?#?N?@?" ; 
              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtwasteid'][] = $rs->fields[0];
              $rs->MoveNext() ; 
       } 
       $rs->Close() ; 
   } 
   elseif ($GLOBALS["NM_ERRO_IBASE"] != 1 && $nm_comando != "")  
   {  
       $this->Erro->mensagem(__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
       exit; 
   } 
   $GLOBALS["NM_ERRO_IBASE"] = 0; 
          $aLookupOrig = $aLookup;
          $sSelComp = "name=\"wtwasteid\"";
          if (isset($this->NM_ajax_info['select_html']['wtwasteid']) && !empty($this->NM_ajax_info['select_html']['wtwasteid']))
          {
              $sSelComp = $this->NM_ajax_info['select_html']['wtwasteid'];
          }
          $sLookup = '';
          if (empty($aLookup))
          {
              $aLookup[] = array('' => '');
          }
          foreach ($aLookup as $aOption)
          {
              foreach ($aOption as $sValue => $sLabel)
              {

                  if ($this->wtwasteid == $sValue)
                  {
                      $this->_tmp_lookup_wtwasteid = $sLabel;
                  }

                  $sOpt     = ($sValue !== $sLabel) ? $sValue : $sLabel;
                  $sLookup .= "<option value=\"" . $sOpt . "\">" . $sLabel . "</option>";
              }
          }
          $aLookup  = $sLookup;
          $this->NM_ajax_info['fldList']['wtwasteid'] = array(
                       'row'    => '',
               'type'    => 'select',
               'valList' => array($sTmpValue),
               'optList' => $aLookup,
              );
          $aLabel     = array();
          $aLabelTemp = array();
          foreach ($aLookupOrig as $aValData)
          {
              if (in_array(key($aValData), $this->NM_ajax_info['fldList']['wtwasteid']['valList']))
              {
                  $aLabelTemp[key($aValData)] = current($aValData);
              }
          }
          foreach ($this->NM_ajax_info['fldList']['wtwasteid']['valList'] as $iIndex => $sValue)
          {
              $aLabel[$iIndex] = (isset($aLabelTemp[$sValue])) ? $aLabelTemp[$sValue] : $sValue;
          }
          $this->NM_ajax_info['fldList']['wtwasteid']['labList'] = $aLabel;
          }
   }

          //----- wtequipment
   function ajax_return_values_wtequipment($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtequipment", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtequipment);
              $aLookup = array();
              $this->_tmp_lookup_wtequipment = $this->wtequipment;

 
$nmgp_def_dados = "" ; 
if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtequipment']))
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtequipment'] = array_unique($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtequipment']); 
}
else
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtequipment'] = array(); 
}
$aLookup[] = array(validate_wastetransactions_mob_pack_protect_string('') => validate_wastetransactions_mob_pack_protect_string('---Επιλογή τύπου εξοπλισμού---'));
$_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtequipment'][] = '';
   $nm_nao_carga = false;
   $nmgp_def_dados = "" ; 

   $old_value_wtrequestdate = $this->wtrequestdate;
   $old_value_wtproducerqty = $this->wtproducerqty;
   $old_value_wtprducerm3 = $this->wtprducerm3;
   $old_value_wttransportdate = $this->wttransportdate;
   $old_value_wtfdestdate = $this->wtfdestdate;
   $old_value_wtfdestqty = $this->wtfdestqty;
   $old_value_wtfdestm3 = $this->wtfdestm3;
   $this->nm_tira_formatacao();
   $this->nm_converte_datas(false);


   $unformatted_value_wtrequestdate = $this->wtrequestdate;
   $unformatted_value_wtproducerqty = $this->wtproducerqty;
   $unformatted_value_wtprducerm3 = $this->wtprducerm3;
   $unformatted_value_wttransportdate = $this->wttransportdate;
   $unformatted_value_wtfdestdate = $this->wtfdestdate;
   $unformatted_value_wtfdestqty = $this->wtfdestqty;
   $unformatted_value_wtfdestm3 = $this->wtfdestm3;

   $nm_comando = "SELECT eqid, eqtitle 
FROM equipment 
ORDER BY eqtitle";

   $this->wtrequestdate = $old_value_wtrequestdate;
   $this->wtproducerqty = $old_value_wtproducerqty;
   $this->wtprducerm3 = $old_value_wtprducerm3;
   $this->wttransportdate = $old_value_wttransportdate;
   $this->wtfdestdate = $old_value_wtfdestdate;
   $this->wtfdestqty = $old_value_wtfdestqty;
   $this->wtfdestm3 = $old_value_wtfdestm3;

   $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando; 
   $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
   if ($nm_comando != "" && $rs = $this->Db->Execute($nm_comando)) 
   {
       while (!$rs->EOF) 
       { 
              $rs->fields[0] = str_replace(',', '.', $rs->fields[0]);
              $rs->fields[0] = (strpos(strtolower($rs->fields[0]), "e")) ? (float)$rs->fields[0] : $rs->fields[0];
              $rs->fields[0] = (string)$rs->fields[0];
              $aLookup[] = array(validate_wastetransactions_mob_pack_protect_string($rs->fields[0]) => validate_wastetransactions_mob_pack_protect_string(NM_charset_to_utf8($rs->fields[1])));
              $nmgp_def_dados .= $rs->fields[1] . "?#?" ; 
              $nmgp_def_dados .= $rs->fields[0] . "?#?N?@?" ; 
              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtequipment'][] = $rs->fields[0];
              $rs->MoveNext() ; 
       } 
       $rs->Close() ; 
   } 
   elseif ($GLOBALS["NM_ERRO_IBASE"] != 1 && $nm_comando != "")  
   {  
       $this->Erro->mensagem(__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
       exit; 
   } 
   $GLOBALS["NM_ERRO_IBASE"] = 0; 
          $aLookupOrig = $aLookup;
          $sSelComp = "name=\"wtequipment\"";
          if (isset($this->NM_ajax_info['select_html']['wtequipment']) && !empty($this->NM_ajax_info['select_html']['wtequipment']))
          {
              $sSelComp = $this->NM_ajax_info['select_html']['wtequipment'];
          }
          $sLookup = '';
          if (empty($aLookup))
          {
              $aLookup[] = array('' => '');
          }
          foreach ($aLookup as $aOption)
          {
              foreach ($aOption as $sValue => $sLabel)
              {

                  if ($this->wtequipment == $sValue)
                  {
                      $this->_tmp_lookup_wtequipment = $sLabel;
                  }

                  $sOpt     = ($sValue !== $sLabel) ? $sValue : $sLabel;
                  $sLookup .= "<option value=\"" . $sOpt . "\">" . $sLabel . "</option>";
              }
          }
          $aLookup  = $sLookup;
          $this->NM_ajax_info['fldList']['wtequipment'] = array(
                       'row'    => '',
               'type'    => 'select',
               'valList' => array($sTmpValue),
               'optList' => $aLookup,
              );
          $aLabel     = array();
          $aLabelTemp = array();
          foreach ($aLookupOrig as $aValData)
          {
              if (in_array(key($aValData), $this->NM_ajax_info['fldList']['wtequipment']['valList']))
              {
                  $aLabelTemp[key($aValData)] = current($aValData);
              }
          }
          foreach ($this->NM_ajax_info['fldList']['wtequipment']['valList'] as $iIndex => $sValue)
          {
              $aLabel[$iIndex] = (isset($aLabelTemp[$sValue])) ? $aLabelTemp[$sValue] : $sValue;
          }
          $this->NM_ajax_info['fldList']['wtequipment']['labList'] = $aLabel;
          }
   }

          //----- wttransportersign
   function ajax_return_values_wttransportersign($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wttransportersign", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wttransportersign);
              $aLookup = array();
   $out_wttransportersign = '';
   $out1_wttransportersign = '';
   if ('' != $this->wttransportersign_ul_name && @is_file($this->Ini->root . $this->Ini->path_imag_temp . '/' . $this->wttransportersign_ul_name))
   {
       $this->wttransportersign = @file_get_contents($this->Ini->root . $this->Ini->path_imag_temp . '/' . $this->wttransportersign_ul_name);
   }
   if ($this->wttransportersign != "" && $this->wttransportersign != "none")   
   { 
       $out_wttransportersign = $this->Ini->path_imag_temp . "/sc_wttransportersign_" . $_SESSION['scriptcase']['sc_num_img'] . session_id() . ".gif" ;  
       $out1_wttransportersign = $out_wttransportersign; 
       $arq_wttransportersign = fopen($this->Ini->root . $out_wttransportersign, "w") ;  
       if (substr($this->wttransportersign, 0, 4) == "*nm*") 
       { 
           $this->wttransportersign = substr($this->wttransportersign, 4) ; 
           $this->wttransportersign = base64_decode($this->wttransportersign) ; 
       } 
       $img_pos_bm = strpos($this->wttransportersign, "BM") ; 
       if (!$img_pos_bm === FALSE && $img_pos_bm == 78) 
       { 
           $this->wttransportersign = substr($this->wttransportersign, $img_pos_bm) ; 
       } 
       fwrite($arq_wttransportersign, $this->wttransportersign) ;  
       fclose($arq_wttransportersign) ;  
       $_SESSION['scriptcase']['sc_num_img']++ ; 
       $out_wttransportersign = $this->Ini->path_imag_temp . "/sc_" . "wttransportersign_" . $_SESSION['scriptcase']['sc_num_img'] . session_id() . ".gif" ; 
       $_SESSION['scriptcase']['sc_num_img']++ ; 
       if (!$this->Ini->Gd_missing)
       { 
           $sc_obj_img = new nm_trata_img($this->Ini->root . $out1_wttransportersign);
           $sc_obj_img->setWidth(90);
           $sc_obj_img->setHeight(90);
           $sc_obj_img->createImg($this->Ini->root . $out_wttransportersign);
       } 
       else 
       { 
           $out_wttransportersign = $out1_wttransportersign;
       } 
       $_SESSION['scriptcase']['sc_num_img']++ ; 
   } 
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['wttransportersign'] = array(
                       'row'    => '',
               'type'    => 'imagem',
               'valList' => array($this->Ini->Nm_lang['lang_othr_show_imgg']),
               'imgFile' => $out_wttransportersign,
               'imgOrig' => $out1_wttransportersign,
               'keepImg' => $sKeepImage,
              );
          }
   }

          //----- wtfdestdate
   function ajax_return_values_wtfdestdate($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtfdestdate", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtfdestdate);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['wtfdestdate'] = array(
                       'row'    => '',
               'type'    => 'text',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- wtfdestid
   function ajax_return_values_wtfdestid($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtfdestid", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtfdestid);
              $aLookup = array();
              $this->_tmp_lookup_wtfdestid = $this->wtfdestid;

 
$nmgp_def_dados = "" ; 
if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestid']))
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestid'] = array_unique($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestid']); 
}
else
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestid'] = array(); 
}
$aLookup[] = array(validate_wastetransactions_mob_pack_protect_string('0') => validate_wastetransactions_mob_pack_protect_string('---Επιλογή τελικού αποδέκτη---'));
$_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestid'][] = '0';
   $nm_nao_carga = false;
   $nmgp_def_dados = "" ; 

   $old_value_wtrequestdate = $this->wtrequestdate;
   $old_value_wtproducerqty = $this->wtproducerqty;
   $old_value_wtprducerm3 = $this->wtprducerm3;
   $old_value_wttransportdate = $this->wttransportdate;
   $old_value_wtfdestdate = $this->wtfdestdate;
   $old_value_wtfdestqty = $this->wtfdestqty;
   $old_value_wtfdestm3 = $this->wtfdestm3;
   $this->nm_tira_formatacao();
   $this->nm_converte_datas(false);


   $unformatted_value_wtrequestdate = $this->wtrequestdate;
   $unformatted_value_wtproducerqty = $this->wtproducerqty;
   $unformatted_value_wtprducerm3 = $this->wtprducerm3;
   $unformatted_value_wttransportdate = $this->wttransportdate;
   $unformatted_value_wtfdestdate = $this->wtfdestdate;
   $unformatted_value_wtfdestqty = $this->wtfdestqty;
   $unformatted_value_wtfdestm3 = $this->wtfdestm3;

   $nm_comando = "SELECT PrBID, PrBranchName 
FROM fdestbranch
where ProfilID = " . $_SESSION['ProfilID'] . "
ORDER BY PrBranchName";

   $this->wtrequestdate = $old_value_wtrequestdate;
   $this->wtproducerqty = $old_value_wtproducerqty;
   $this->wtprducerm3 = $old_value_wtprducerm3;
   $this->wttransportdate = $old_value_wttransportdate;
   $this->wtfdestdate = $old_value_wtfdestdate;
   $this->wtfdestqty = $old_value_wtfdestqty;
   $this->wtfdestm3 = $old_value_wtfdestm3;

   $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando; 
   $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
   if ($nm_comando != "" && $rs = $this->Db->Execute($nm_comando)) 
   {
       while (!$rs->EOF) 
       { 
              $rs->fields[0] = str_replace(',', '.', $rs->fields[0]);
              $rs->fields[0] = (strpos(strtolower($rs->fields[0]), "e")) ? (float)$rs->fields[0] : $rs->fields[0];
              $rs->fields[0] = (string)$rs->fields[0];
              $aLookup[] = array(validate_wastetransactions_mob_pack_protect_string($rs->fields[0]) => validate_wastetransactions_mob_pack_protect_string(NM_charset_to_utf8($rs->fields[1])));
              $nmgp_def_dados .= $rs->fields[1] . "?#?" ; 
              $nmgp_def_dados .= $rs->fields[0] . "?#?N?@?" ; 
              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestid'][] = $rs->fields[0];
              $rs->MoveNext() ; 
       } 
       $rs->Close() ; 
   } 
   elseif ($GLOBALS["NM_ERRO_IBASE"] != 1 && $nm_comando != "")  
   {  
       $this->Erro->mensagem(__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
       exit; 
   } 
   $GLOBALS["NM_ERRO_IBASE"] = 0; 
          $aLookupOrig = $aLookup;
          $sSelComp = "name=\"wtfdestid\"";
          if (isset($this->NM_ajax_info['select_html']['wtfdestid']) && !empty($this->NM_ajax_info['select_html']['wtfdestid']))
          {
              $sSelComp = $this->NM_ajax_info['select_html']['wtfdestid'];
          }
          $sLookup = '';
          if (empty($aLookup))
          {
              $aLookup[] = array('' => '');
          }
          foreach ($aLookup as $aOption)
          {
              foreach ($aOption as $sValue => $sLabel)
              {

                  if ($this->wtfdestid == $sValue)
                  {
                      $this->_tmp_lookup_wtfdestid = $sLabel;
                  }

                  $sOpt     = ($sValue !== $sLabel) ? $sValue : $sLabel;
                  $sLookup .= "<option value=\"" . $sOpt . "\">" . $sLabel . "</option>";
              }
          }
          $aLookup  = $sLookup;
          $this->NM_ajax_info['fldList']['wtfdestid'] = array(
                       'row'    => '',
               'type'    => 'select',
               'valList' => array($sTmpValue),
               'optList' => $aLookup,
              );
          $aLabel     = array();
          $aLabelTemp = array();
          foreach ($aLookupOrig as $aValData)
          {
              if (in_array(key($aValData), $this->NM_ajax_info['fldList']['wtfdestid']['valList']))
              {
                  $aLabelTemp[key($aValData)] = current($aValData);
              }
          }
          foreach ($this->NM_ajax_info['fldList']['wtfdestid']['valList'] as $iIndex => $sValue)
          {
              $aLabel[$iIndex] = (isset($aLabelTemp[$sValue])) ? $aLabelTemp[$sValue] : $sValue;
          }
          $this->NM_ajax_info['fldList']['wtfdestid']['labList'] = $aLabel;
          }
   }

          //----- wtfdestperiferia
   function ajax_return_values_wtfdestperiferia($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtfdestperiferia", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtfdestperiferia);
              $aLookup = array();
              $this->_tmp_lookup_wtfdestperiferia = $this->wtfdestperiferia;

 
$nmgp_def_dados = "" ; 
if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestperiferia']))
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestperiferia'] = array_unique($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestperiferia']); 
}
else
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestperiferia'] = array(); 
}
if ($this->wtfdestperiferia != "")
{ 
   $this->nm_clear_val("wtfdestperiferia");
   $nm_nao_carga = false;
   $nmgp_def_dados = "" ; 

   $old_value_wtrequestdate = $this->wtrequestdate;
   $old_value_wtproducerqty = $this->wtproducerqty;
   $old_value_wtprducerm3 = $this->wtprducerm3;
   $old_value_wttransportdate = $this->wttransportdate;
   $old_value_wtfdestdate = $this->wtfdestdate;
   $old_value_wtfdestqty = $this->wtfdestqty;
   $old_value_wtfdestm3 = $this->wtfdestm3;
   $this->nm_tira_formatacao();
   $this->nm_converte_datas(false);


   $unformatted_value_wtrequestdate = $this->wtrequestdate;
   $unformatted_value_wtproducerqty = $this->wtproducerqty;
   $unformatted_value_wtprducerm3 = $this->wtprducerm3;
   $unformatted_value_wttransportdate = $this->wttransportdate;
   $unformatted_value_wtfdestdate = $this->wtfdestdate;
   $unformatted_value_wtfdestqty = $this->wtfdestqty;
   $unformatted_value_wtfdestm3 = $this->wtfdestm3;

   $nm_comando = "SELECT PerifID, PerifName 
FROM perif 
WHERE PerifID = '$this->wtfdestperiferia'
ORDER BY PerifName";

   $this->wtrequestdate = $old_value_wtrequestdate;
   $this->wtproducerqty = $old_value_wtproducerqty;
   $this->wtprducerm3 = $old_value_wtprducerm3;
   $this->wttransportdate = $old_value_wttransportdate;
   $this->wtfdestdate = $old_value_wtfdestdate;
   $this->wtfdestqty = $old_value_wtfdestqty;
   $this->wtfdestm3 = $old_value_wtfdestm3;

   $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando; 
   $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
   if ($nm_comando != "" && $rs = $this->Db->Execute($nm_comando)) 
   {
       while (!$rs->EOF) 
       { 
              $rs->fields[0] = str_replace(',', '.', $rs->fields[0]);
              $rs->fields[0] = (strpos(strtolower($rs->fields[0]), "e")) ? (float)$rs->fields[0] : $rs->fields[0];
              $rs->fields[0] = (string)$rs->fields[0];
              $aLookup[] = array(validate_wastetransactions_mob_pack_protect_string($rs->fields[0]) => validate_wastetransactions_mob_pack_protect_string(NM_charset_to_utf8($rs->fields[1])));
              $nmgp_def_dados .= $rs->fields[1] . "?#?" ; 
              $nmgp_def_dados .= $rs->fields[0] . "?#?N?@?" ; 
              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestperiferia'][] = $rs->fields[0];
              $rs->MoveNext() ; 
       } 
       $rs->Close() ; 
   } 
   elseif ($GLOBALS["NM_ERRO_IBASE"] != 1 && $nm_comando != "")  
   {  
       $this->Erro->mensagem(__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
       exit; 
   } 
   $GLOBALS["NM_ERRO_IBASE"] = 0; 
} 
          $aLookupOrig = $aLookup;
          $sSelComp = "name=\"wtfdestperiferia\"";
          if (isset($this->NM_ajax_info['select_html']['wtfdestperiferia']) && !empty($this->NM_ajax_info['select_html']['wtfdestperiferia']))
          {
              $sSelComp = $this->NM_ajax_info['select_html']['wtfdestperiferia'];
          }
          $sLookup = '';
          if (empty($aLookup))
          {
              $aLookup[] = array('' => '');
          }
          foreach ($aLookup as $aOption)
          {
              foreach ($aOption as $sValue => $sLabel)
              {

                  if ($this->wtfdestperiferia == $sValue)
                  {
                      $this->_tmp_lookup_wtfdestperiferia = $sLabel;
                  }

                  $sOpt     = ($sValue !== $sLabel) ? $sValue : $sLabel;
                  $sLookup .= "<option value=\"" . $sOpt . "\">" . $sLabel . "</option>";
              }
          }
          $aLookup  = $sLookup;
          $this->NM_ajax_info['fldList']['wtfdestperiferia'] = array(
                       'row'    => '',
               'type'    => 'select',
               'valList' => array($sTmpValue),
               'optList' => $aLookup,
              );
          $aLabel     = array();
          $aLabelTemp = array();
          foreach ($aLookupOrig as $aValData)
          {
              if (in_array(key($aValData), $this->NM_ajax_info['fldList']['wtfdestperiferia']['valList']))
              {
                  $aLabelTemp[key($aValData)] = current($aValData);
              }
          }
          foreach ($this->NM_ajax_info['fldList']['wtfdestperiferia']['valList'] as $iIndex => $sValue)
          {
              $aLabel[$iIndex] = (isset($aLabelTemp[$sValue])) ? $aLabelTemp[$sValue] : $sValue;
          }
          $this->NM_ajax_info['fldList']['wtfdestperiferia']['labList'] = $aLabel;
          }
   }

          //----- envregistrationno_fdest
   function ajax_return_values_envregistrationno_fdest($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("envregistrationno_fdest", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->envregistrationno_fdest);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['envregistrationno_fdest'] = array(
                       'row'    => '',
               'type'    => 'text',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- fdestaddress
   function ajax_return_values_fdestaddress($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("fdestaddress", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->fdestaddress);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['fdestaddress'] = array(
                       'row'    => '',
               'type'    => 'label',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- fdestrespone
   function ajax_return_values_fdestrespone($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("fdestrespone", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->fdestrespone);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['fdestrespone'] = array(
                       'row'    => '',
               'type'    => 'label',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- fdestphone
   function ajax_return_values_fdestphone($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("fdestphone", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->fdestphone);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['fdestphone'] = array(
                       'row'    => '',
               'type'    => 'label',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- fdestresponseemail
   function ajax_return_values_fdestresponseemail($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("fdestresponseemail", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->fdestresponseemail);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['fdestresponseemail'] = array(
                       'row'    => '',
               'type'    => 'label',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- wtfdestewc
   function ajax_return_values_wtfdestewc($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtfdestewc", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtfdestewc);
              $aLookup = array();
              $this->_tmp_lookup_wtfdestewc = $this->wtfdestewc;

 
$nmgp_def_dados = "" ; 
if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestewc']))
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestewc'] = array_unique($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestewc']); 
}
else
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestewc'] = array(); 
}
$aLookup[] = array(validate_wastetransactions_mob_pack_protect_string('') => validate_wastetransactions_mob_pack_protect_string('---Επιλογή αποβλήτου---'));
$_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestewc'][] = '';
if ($this->wtfdestid != "")
{ 
   $this->nm_clear_val("wtfdestid");
   $nm_nao_carga = false;
   $nmgp_def_dados = "" ; 

   $old_value_wtrequestdate = $this->wtrequestdate;
   $old_value_wtproducerqty = $this->wtproducerqty;
   $old_value_wtprducerm3 = $this->wtprducerm3;
   $old_value_wttransportdate = $this->wttransportdate;
   $old_value_wtfdestdate = $this->wtfdestdate;
   $old_value_wtfdestqty = $this->wtfdestqty;
   $old_value_wtfdestm3 = $this->wtfdestm3;
   $this->nm_tira_formatacao();
   $this->nm_converte_datas(false);


   $unformatted_value_wtrequestdate = $this->wtrequestdate;
   $unformatted_value_wtproducerqty = $this->wtproducerqty;
   $unformatted_value_wtprducerm3 = $this->wtprducerm3;
   $unformatted_value_wttransportdate = $this->wttransportdate;
   $unformatted_value_wtfdestdate = $this->wtfdestdate;
   $unformatted_value_wtfdestqty = $this->wtfdestqty;
   $unformatted_value_wtfdestm3 = $this->wtfdestm3;

   $nm_comando = "SELECT EWC, EWC 
FROM fdestewcbranch 
where producerbranchid = '$this->wtfdestid'
ORDER BY EWC";

   $this->wtrequestdate = $old_value_wtrequestdate;
   $this->wtproducerqty = $old_value_wtproducerqty;
   $this->wtprducerm3 = $old_value_wtprducerm3;
   $this->wttransportdate = $old_value_wttransportdate;
   $this->wtfdestdate = $old_value_wtfdestdate;
   $this->wtfdestqty = $old_value_wtfdestqty;
   $this->wtfdestm3 = $old_value_wtfdestm3;

   $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando; 
   $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
   if ($nm_comando != "" && $rs = $this->Db->Execute($nm_comando)) 
   {
       while (!$rs->EOF) 
       { 
              $aLookup[] = array(validate_wastetransactions_mob_pack_protect_string($rs->fields[0]) => validate_wastetransactions_mob_pack_protect_string(NM_charset_to_utf8($rs->fields[1])));
              $nmgp_def_dados .= $rs->fields[1] . "?#?" ; 
              $nmgp_def_dados .= $rs->fields[0] . "?#?N?@?" ; 
              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestewc'][] = $rs->fields[0];
              $rs->MoveNext() ; 
       } 
       $rs->Close() ; 
   } 
   elseif ($GLOBALS["NM_ERRO_IBASE"] != 1 && $nm_comando != "")  
   {  
       $this->Erro->mensagem(__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
       exit; 
   } 
   $GLOBALS["NM_ERRO_IBASE"] = 0; 
} 
          $aLookupOrig = $aLookup;
          $sSelComp = "name=\"wtfdestewc\"";
          if (isset($this->NM_ajax_info['select_html']['wtfdestewc']) && !empty($this->NM_ajax_info['select_html']['wtfdestewc']))
          {
              $sSelComp = $this->NM_ajax_info['select_html']['wtfdestewc'];
          }
          $sLookup = '';
          if (empty($aLookup))
          {
              $aLookup[] = array('' => '');
          }
          foreach ($aLookup as $aOption)
          {
              foreach ($aOption as $sValue => $sLabel)
              {

                  if ($this->wtfdestewc == $sValue)
                  {
                      $this->_tmp_lookup_wtfdestewc = $sLabel;
                  }

                  $sOpt     = ($sValue !== $sLabel) ? $sValue : $sLabel;
                  $sLookup .= "<option value=\"" . $sOpt . "\">" . $sLabel . "</option>";
              }
          }
          $aLookup  = $sLookup;
          $this->NM_ajax_info['fldList']['wtfdestewc'] = array(
                       'row'    => '',
               'type'    => 'select',
               'valList' => array($sTmpValue),
               'optList' => $aLookup,
              );
          $aLabel     = array();
          $aLabelTemp = array();
          foreach ($aLookupOrig as $aValData)
          {
              if (in_array(key($aValData), $this->NM_ajax_info['fldList']['wtfdestewc']['valList']))
              {
                  $aLabelTemp[key($aValData)] = current($aValData);
              }
          }
          foreach ($this->NM_ajax_info['fldList']['wtfdestewc']['valList'] as $iIndex => $sValue)
          {
              $aLabel[$iIndex] = (isset($aLabelTemp[$sValue])) ? $aLabelTemp[$sValue] : $sValue;
          }
          $this->NM_ajax_info['fldList']['wtfdestewc']['labList'] = $aLabel;
          }
   }

          //----- fdewctitle
   function ajax_return_values_fdewctitle($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("fdewctitle", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->fdewctitle);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['fdewctitle'] = array(
                       'row'    => '',
               'type'    => 'label',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- wtfdestrd
   function ajax_return_values_wtfdestrd($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtfdestrd", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtfdestrd);
              $aLookup = array();
              $this->_tmp_lookup_wtfdestrd = $this->wtfdestrd;

 
$nmgp_def_dados = "" ; 
if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestrd']))
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestrd'] = array_unique($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestrd']); 
}
else
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestrd'] = array(); 
}
$aLookup[] = array(validate_wastetransactions_mob_pack_protect_string('') => validate_wastetransactions_mob_pack_protect_string('---Επιλογή κωδικού διαχείρησης---'));
$_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestrd'][] = '';
   $nm_nao_carga = false;
   $nmgp_def_dados = "" ; 

   $old_value_wtrequestdate = $this->wtrequestdate;
   $old_value_wtproducerqty = $this->wtproducerqty;
   $old_value_wtprducerm3 = $this->wtprducerm3;
   $old_value_wttransportdate = $this->wttransportdate;
   $old_value_wtfdestdate = $this->wtfdestdate;
   $old_value_wtfdestqty = $this->wtfdestqty;
   $old_value_wtfdestm3 = $this->wtfdestm3;
   $this->nm_tira_formatacao();
   $this->nm_converte_datas(false);


   $unformatted_value_wtrequestdate = $this->wtrequestdate;
   $unformatted_value_wtproducerqty = $this->wtproducerqty;
   $unformatted_value_wtprducerm3 = $this->wtprducerm3;
   $unformatted_value_wttransportdate = $this->wttransportdate;
   $unformatted_value_wtfdestdate = $this->wtfdestdate;
   $unformatted_value_wtfdestqty = $this->wtfdestqty;
   $unformatted_value_wtfdestm3 = $this->wtfdestm3;

   $nm_comando = "SELECT RDCode
FROM rdcodes 
ORDER BY RDTitle";

   $this->wtrequestdate = $old_value_wtrequestdate;
   $this->wtproducerqty = $old_value_wtproducerqty;
   $this->wtprducerm3 = $old_value_wtprducerm3;
   $this->wttransportdate = $old_value_wttransportdate;
   $this->wtfdestdate = $old_value_wtfdestdate;
   $this->wtfdestqty = $old_value_wtfdestqty;
   $this->wtfdestm3 = $old_value_wtfdestm3;

   $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando; 
   $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
   if ($nm_comando != "" && $rs = $this->Db->Execute($nm_comando)) 
   {
       while (!$rs->EOF) 
       { 
              $aLookup[] = array(validate_wastetransactions_mob_pack_protect_string($rs->fields[0]) => validate_wastetransactions_mob_pack_protect_string(NM_charset_to_utf8($rs->fields[0])));
              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['Lookup_wtfdestrd'][] = $rs->fields[0];
              $nmgp_def_dados .= $rs->fields[0] . "?#?" ; 
              $nmgp_def_dados .= $rs->fields[0] . "?#?N?@?" ; 
              $rs->MoveNext() ; 
       } 
       $rs->Close() ; 
   } 
   elseif ($GLOBALS["NM_ERRO_IBASE"] != 1 && $nm_comando != "")  
   {  
       $this->Erro->mensagem(__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
       exit; 
   } 
   $GLOBALS["NM_ERRO_IBASE"] = 0; 
          $aLookupOrig = $aLookup;
          $sSelComp = "name=\"wtfdestrd\"";
          if (isset($this->NM_ajax_info['select_html']['wtfdestrd']) && !empty($this->NM_ajax_info['select_html']['wtfdestrd']))
          {
              $sSelComp = $this->NM_ajax_info['select_html']['wtfdestrd'];
          }
          $sLookup = '';
          if (empty($aLookup))
          {
              $aLookup[] = array('' => '');
          }
          foreach ($aLookup as $aOption)
          {
              foreach ($aOption as $sValue => $sLabel)
              {

                  if ($this->wtfdestrd == $sValue)
                  {
                      $this->_tmp_lookup_wtfdestrd = $sLabel;
                  }

                  $sOpt     = ($sValue !== $sLabel) ? $sValue : $sLabel;
                  $sLookup .= "<option value=\"" . $sOpt . "\">" . $sLabel . "</option>";
              }
          }
          $aLookup  = $sLookup;
          $this->NM_ajax_info['fldList']['wtfdestrd'] = array(
                       'row'    => '',
               'type'    => 'select',
               'valList' => array($sTmpValue),
               'optList' => $aLookup,
              );
          $aLabel     = array();
          $aLabelTemp = array();
          foreach ($aLookupOrig as $aValData)
          {
              if (in_array(key($aValData), $this->NM_ajax_info['fldList']['wtfdestrd']['valList']))
              {
                  $aLabelTemp[key($aValData)] = current($aValData);
              }
          }
          foreach ($this->NM_ajax_info['fldList']['wtfdestrd']['valList'] as $iIndex => $sValue)
          {
              $aLabel[$iIndex] = (isset($aLabelTemp[$sValue])) ? $aLabelTemp[$sValue] : $sValue;
          }
          $this->NM_ajax_info['fldList']['wtfdestrd']['labList'] = $aLabel;
          }
   }

          //----- wtfdestqty
   function ajax_return_values_wtfdestqty($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtfdestqty", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtfdestqty);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['wtfdestqty'] = array(
                       'row'    => '',
               'type'    => 'text',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- wtfdestm3
   function ajax_return_values_wtfdestm3($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtfdestm3", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtfdestm3);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['wtfdestm3'] = array(
                       'row'    => '',
               'type'    => 'text',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- wtfdestsign
   function ajax_return_values_wtfdestsign($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtfdestsign", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtfdestsign);
              $aLookup = array();
   $out_wtfdestsign = '';
   $out1_wtfdestsign = '';
   if ('' != $this->wtfdestsign_ul_name && @is_file($this->Ini->root . $this->Ini->path_imag_temp . '/' . $this->wtfdestsign_ul_name))
   {
       $this->wtfdestsign = @file_get_contents($this->Ini->root . $this->Ini->path_imag_temp . '/' . $this->wtfdestsign_ul_name);
   }
   if ($this->wtfdestsign != "" && $this->wtfdestsign != "none")   
   { 
       $out_wtfdestsign = $this->Ini->path_imag_temp . "/sc_wtfdestsign_" . $_SESSION['scriptcase']['sc_num_img'] . session_id() . ".gif" ;  
       $out1_wtfdestsign = $out_wtfdestsign; 
       $arq_wtfdestsign = fopen($this->Ini->root . $out_wtfdestsign, "w") ;  
       if (substr($this->wtfdestsign, 0, 4) == "*nm*") 
       { 
           $this->wtfdestsign = substr($this->wtfdestsign, 4) ; 
           $this->wtfdestsign = base64_decode($this->wtfdestsign) ; 
       } 
       $img_pos_bm = strpos($this->wtfdestsign, "BM") ; 
       if (!$img_pos_bm === FALSE && $img_pos_bm == 78) 
       { 
           $this->wtfdestsign = substr($this->wtfdestsign, $img_pos_bm) ; 
       } 
       fwrite($arq_wtfdestsign, $this->wtfdestsign) ;  
       fclose($arq_wtfdestsign) ;  
       $_SESSION['scriptcase']['sc_num_img']++ ; 
       $out_wtfdestsign = $this->Ini->path_imag_temp . "/sc_" . "wtfdestsign_" . $_SESSION['scriptcase']['sc_num_img'] . session_id() . ".gif" ; 
       $_SESSION['scriptcase']['sc_num_img']++ ; 
       if (!$this->Ini->Gd_missing)
       { 
           $sc_obj_img = new nm_trata_img($this->Ini->root . $out1_wtfdestsign);
           $sc_obj_img->setWidth(90);
           $sc_obj_img->setHeight(90);
           $sc_obj_img->createImg($this->Ini->root . $out_wtfdestsign);
       } 
       else 
       { 
           $out_wtfdestsign = $out1_wtfdestsign;
       } 
       $_SESSION['scriptcase']['sc_num_img']++ ; 
   } 
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['wtfdestsign'] = array(
                       'row'    => '',
               'type'    => 'imagem',
               'valList' => array($this->Ini->Nm_lang['lang_othr_show_imgg']),
               'imgFile' => $out_wtfdestsign,
               'imgOrig' => $out1_wtfdestsign,
               'keepImg' => $sKeepImage,
              );
          }
   }

          //----- wtproducerremarks
   function ajax_return_values_wtproducerremarks($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtproducerremarks", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtproducerremarks);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['wtproducerremarks'] = array(
                       'row'    => '',
               'type'    => 'text',
               'valList' => array($sTmpValue),
              );
          }
   }

          //----- wtid
   function ajax_return_values_wtid($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("wtid", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->wtid);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['wtid'] = array(
                       'row'    => '',
               'type'    => 'label',
               'valList' => array($sTmpValue),
              );
          }
   }

    function fetchUniqueUploadName($originalName, $uploadDir, $fieldName)
    {
        $originalName = trim($originalName);
        if ('' == $originalName)
        {
            return $originalName;
        }
        if (!@is_dir($uploadDir))
        {
            return $originalName;
        }
        if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['upload_dir'][$fieldName]))
        {
            $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['upload_dir'][$fieldName] = array();
            $resDir = @opendir($uploadDir);
            if (!$resDir)
            {
                return $originalName;
            }
            while (false !== ($fileName = @readdir($resDir)))
            {
                if (@is_file($uploadDir . $fileName))
                {
                    $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['upload_dir'][$fieldName][] = $fileName;
                }
            }
            @closedir($resDir);
        }
        if (!in_array($originalName, $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['upload_dir'][$fieldName]))
        {
            $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['upload_dir'][$fieldName][] = $originalName;
            return $originalName;
        }
        else
        {
            $newName = $this->fetchFileNextName($originalName, $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['upload_dir'][$fieldName]);
            $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['upload_dir'][$fieldName][] = $newName;
            return $newName;
        }
    } // fetchUniqueUploadName

    function fetchFileNextName($uniqueName, $uniqueList)
    {
        $aPathinfo     = pathinfo($uniqueName);
        $fileExtension = $aPathinfo['extension'];
        $fileName      = $aPathinfo['filename'];
        $foundName     = false;
        $nameIt        = 1;
        if ('' != $fileExtension)
        {
            $fileExtension = '.' . $fileExtension;
        }
        while (!$foundName)
        {
            $testName = $fileName . '(' . $nameIt . ')' . $fileExtension;
            if (in_array($testName, $uniqueList))
            {
                $nameIt++;
            }
            else
            {
                $foundName = true;
                return $testName;
            }
        }
    } // fetchFileNextName

   function ajax_add_parameters()
   {
   } // ajax_add_parameters
  function nm_proc_onload($bFormat = true)
  {
      if (!$this->NM_ajax_flag || !isset($this->nmgp_refresh_fields)) {
      $_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'on';
if (!isset($this->sc_temp_mail_from_g)) {$this->sc_temp_mail_from_g = (isset($_SESSION['mail_from_g'])) ? $_SESSION['mail_from_g'] : "";}
if (!isset($this->sc_temp_mail_smtp_pass_g)) {$this->sc_temp_mail_smtp_pass_g = (isset($_SESSION['mail_smtp_pass_g'])) ? $_SESSION['mail_smtp_pass_g'] : "";}
if (!isset($this->sc_temp_mail_smtp_user_g)) {$this->sc_temp_mail_smtp_user_g = (isset($_SESSION['mail_smtp_user_g'])) ? $_SESSION['mail_smtp_user_g'] : "";}
if (!isset($this->sc_temp_mail_smtp_server_g)) {$this->sc_temp_mail_smtp_server_g = (isset($_SESSION['mail_smtp_server_g'])) ? $_SESSION['mail_smtp_server_g'] : "";}
                         


$check_sql = "SELECT * FROM config";
 
      $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]))     
{

	$mail_smtp_server_g    = $this->rs[0][0];        
	$mail_smtp_user_g      = $this->rs[0][1];                   
	$mail_smtp_pass_g      = $this->rs[0][2];   
	$mail_from_g           = $this->rs[0][1]; 
	
	 if (isset($mail_smtp_server_g)) {$this->sc_temp_mail_smtp_server_g = $mail_smtp_server_g;}
;
	 if (isset($mail_smtp_user_g)) {$this->sc_temp_mail_smtp_user_g = $mail_smtp_user_g;}
;
	 if (isset($mail_smtp_pass_g)) {$this->sc_temp_mail_smtp_pass_g = $mail_smtp_pass_g;}
;
	 if (isset($mail_from_g)) {$this->sc_temp_mail_from_g = $mail_from_g;}
;
		
}
		else     
{
	$mail_smtp_server_g    = '';        
	$mail_smtp_user_g      = '';                   
	$mail_smtp_pass_g      = '';   
	$mail_from_g           =''; 
}






$this->load_more();
$this->load_more_FDEst();
$this->load_more_transporter();
$this->ch_ProducervsTransportation();
$this->ch_FDestVsTransportation();
if (isset($this->sc_temp_mail_smtp_server_g)) { $_SESSION['mail_smtp_server_g'] = $this->sc_temp_mail_smtp_server_g;}
if (isset($this->sc_temp_mail_smtp_user_g)) { $_SESSION['mail_smtp_user_g'] = $this->sc_temp_mail_smtp_user_g;}
if (isset($this->sc_temp_mail_smtp_pass_g)) { $_SESSION['mail_smtp_pass_g'] = $this->sc_temp_mail_smtp_pass_g;}
if (isset($this->sc_temp_mail_from_g)) { $_SESSION['mail_from_g'] = $this->sc_temp_mail_from_g;}
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'off'; 
      }
      $this->nm_guardar_campos();
      if ($bFormat) $this->nm_formatar_campos();
  }
//
//----------------------------------------------------
//-----> 
//----------------------------------------------------
//
   function nm_troca_decimal($sc_parm1, $sc_parm2) 
   { 
      $this->wtproducerqty = str_replace($sc_parm1, $sc_parm2, $this->wtproducerqty); 
      $this->wtfdestqty = str_replace($sc_parm1, $sc_parm2, $this->wtfdestqty); 
   } 
   function nm_poe_aspas_decimal() 
   { 
      $this->wtproducerqty = "'" . $this->wtproducerqty . "'";
      $this->wtfdestqty = "'" . $this->wtfdestqty . "'";
   } 
   function nm_tira_aspas_decimal() 
   { 
      $this->wtproducerqty = str_replace("'", "", $this->wtproducerqty); 
      $this->wtfdestqty = str_replace("'", "", $this->wtfdestqty); 
   } 
//----------- 

   function return_after_insert()
   {
      global $sc_where;
      $sc_where_pos = " WHERE ((wtid < $this->wtid))";
      if ('' != $sc_where)
      {
          if ('where ' == strtolower(substr(trim($sc_where), 0, 6)))
          {
              $sc_where = substr(trim($sc_where), 6);
          }
          if ('and ' == strtolower(substr(trim($sc_where), 0, 4)))
          {
              $sc_where = substr(trim($sc_where), 4);
          }
          $sc_where_pos .= ' AND (' . $sc_where . ')';
          $sc_where = ' WHERE ' . $sc_where;
      }
      if ('' != $this->wtid)
      {
          $nmgp_sel_count = 'SELECT COUNT(*) FROM ' . $this->Ini->nm_tabela . $sc_where_pos;
          $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nmgp_sel_count;
          $rsc = $this->Db->Execute($nmgp_sel_count);
          if ($rsc === false && !$rsc->EOF)
          {
              $this->Erro->mensagem (__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dbas'], $this->Db->ErrorMsg());
              exit;
          }
          $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['reg_start'] = $rsc->fields[0];
          $rsc->Close();
      }
   }

   function temRegistros($sWhere)
   {
       if ('' == $sWhere)
       {
           return false;
       }
       $nmgp_sel_count = 'SELECT COUNT(*) FROM ' . $this->Ini->nm_tabela . ' WHERE ' . $sWhere;
       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nmgp_sel_count; 
       $rsc = $this->Db->Execute($nmgp_sel_count); 
       if ($rsc === false && !$rsc->EOF)
       {
           $this->Erro->mensagem(__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dbas'], $this->Db->ErrorMsg());
           exit; 
       }
       $iTotal = $rsc->fields[0];
       $rsc->Close();
       return 0 < $iTotal;
   } // temRegistros

   function deletaRegistros($sWhere)
   {
       if ('' == $sWhere)
       {
           return false;
       }
       $nmgp_sel_count = 'DELETE FROM ' . $this->Ini->nm_tabela . ' WHERE ' . $sWhere;
       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nmgp_sel_count; 
       $rsc = $this->Db->Execute($nmgp_sel_count); 
       $bResult = $rsc;
       $rsc->Close();
       return $bResult == true;
   } // deletaRegistros

   function nm_acessa_banco() 
   { 
      global  $nm_form_submit, $teste_validade, $sc_where;
 
      $NM_val_null = array();
      $NM_val_form = array();
      $this->sc_erro_insert = "";
      $this->sc_erro_update = "";
      $this->sc_erro_delete = "";
      if ($this->nmgp_opcao != "incluir")  
      {
           unset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_clone']['wtproducersign']);
           unset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_clone']['wttransportersign']);
           unset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_clone']['wtfdestsign']);
      }
      $this->SC_log_atv = false;
      if ("alterar" == $this->nmgp_opcao || "excluir" == $this->nmgp_opcao)
      {
          $this->NM_gera_log_key($this->nmgp_opcao);
      }
      if ("alterar" == $this->nmgp_opcao || "excluir" == $this->nmgp_opcao)
      {
          $this->NM_gera_log_old();
      }
      if (!empty($this->sc_force_zero))
      {
          foreach ($this->sc_force_zero as $i_force_zero => $sc_force_zero_field)
          {
              eval('if ($this->' . $sc_force_zero_field . ' == 0) {$this->' . $sc_force_zero_field . ' = "";}');
          }
      }
      $this->sc_force_zero = array();
      $SC_tem_cmp_update = true; 
      $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
      $salva_opcao = $this->nmgp_opcao; 
      if ($this->sc_evento != "novo" && $this->sc_evento != "incluir") 
      { 
          $this->sc_evento = ""; 
      } 
      if (!in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access) && !$this->Ini->sc_tem_trans_banco && in_array($this->nmgp_opcao, array('excluir', 'incluir', 'alterar')))
      { 
          $this->Db->BeginTrans(); 
          $this->Ini->sc_tem_trans_banco = true; 
      } 
      if (!isset($this->wtprofilid)){$this->wtprofilid =  $_SESSION['ProfilID'];}  
      if (!isset($this->wttransportervalidateip)){$this->wttransportervalidateip =  $_SESSION['glo_INTNUMBER'];}  
      $NM_val_form['wtrequestdate'] = $this->wtrequestdate;
      $NM_val_form['wtproducerbranchid'] = $this->wtproducerbranchid;
      $NM_val_form['producerb_address'] = $this->producerb_address;
      $NM_val_form['prbrresponse'] = $this->prbrresponse;
      $NM_val_form['pphone'] = $this->pphone;
      $NM_val_form['premail'] = $this->premail;
      $NM_val_form['wtproducerewc'] = $this->wtproducerewc;
      $NM_val_form['ewctitle'] = $this->ewctitle;
      $NM_val_form['wtproducerperiferia'] = $this->wtproducerperiferia;
      $NM_val_form['wtproduceracceptweigth'] = $this->wtproduceracceptweigth;
      $NM_val_form['wtproducerqty'] = $this->wtproducerqty;
      $NM_val_form['wtprducerm3'] = $this->wtprducerm3;
      $NM_val_form['wtproducersign'] = $this->wtproducersign;
      $NM_val_form['wttransportdate'] = $this->wttransportdate;
      $NM_val_form['wttransporternumberid'] = $this->wttransporternumberid;
      $NM_val_form['wttransportervechicle'] = $this->wttransportervechicle;
      $NM_val_form['wttransporterid'] = $this->wttransporterid;
      $NM_val_form['envregistrationno_transporter'] = $this->envregistrationno_transporter;
      $NM_val_form['transporterresponse'] = $this->transporterresponse;
      $NM_val_form['transporteremail'] = $this->transporteremail;
      $NM_val_form['transporterphone'] = $this->transporterphone;
      $NM_val_form['transporterfax'] = $this->transporterfax;
      $NM_val_form['checktransvsproducer'] = $this->checktransvsproducer;
      $NM_val_form['checktransportervsfdest'] = $this->checktransportervsfdest;
      $NM_val_form['wtwasteid'] = $this->wtwasteid;
      $NM_val_form['wtequipment'] = $this->wtequipment;
      $NM_val_form['wttransportersign'] = $this->wttransportersign;
      $NM_val_form['wtfdestdate'] = $this->wtfdestdate;
      $NM_val_form['wtfdestid'] = $this->wtfdestid;
      $NM_val_form['wtfdestperiferia'] = $this->wtfdestperiferia;
      $NM_val_form['envregistrationno_fdest'] = $this->envregistrationno_fdest;
      $NM_val_form['fdestaddress'] = $this->fdestaddress;
      $NM_val_form['fdestrespone'] = $this->fdestrespone;
      $NM_val_form['fdestphone'] = $this->fdestphone;
      $NM_val_form['fdestresponseemail'] = $this->fdestresponseemail;
      $NM_val_form['wtfdestewc'] = $this->wtfdestewc;
      $NM_val_form['fdewctitle'] = $this->fdewctitle;
      $NM_val_form['wtfdestrd'] = $this->wtfdestrd;
      $NM_val_form['wtfdestqty'] = $this->wtfdestqty;
      $NM_val_form['wtfdestm3'] = $this->wtfdestm3;
      $NM_val_form['wtfdestsign'] = $this->wtfdestsign;
      $NM_val_form['wtproducerremarks'] = $this->wtproducerremarks;
      $NM_val_form['wtid'] = $this->wtid;
      $NM_val_form['wtprofilid'] = $this->wtprofilid;
      $NM_val_form['intnumber'] = $this->intnumber;
      $NM_val_form['wtproducervalidate'] = $this->wtproducervalidate;
      $NM_val_form['wttransporterperiferiaid'] = $this->wttransporterperiferiaid;
      $NM_val_form['wttransporterewc'] = $this->wttransporterewc;
      $NM_val_form['wttransportervalidate'] = $this->wttransportervalidate;
      $NM_val_form['wttransportervalidateip'] = $this->wttransportervalidateip;
      $NM_val_form['wtfdestvlidated'] = $this->wtfdestvlidated;
      $NM_val_form['wtfdestvalidateip'] = $this->wtfdestvalidateip;
      $NM_val_form['transporterregno'] = $this->transporterregno;
      if ($this->wtid == "")  
      { 
          $this->wtid = 0;
      } 
      if ($this->wtprofilid == "")  
      { 
          $this->wtprofilid = 0;
          $this->sc_force_zero[] = 'wtprofilid';
      } 
      if ($this->intnumber == "")  
      { 
          $this->intnumber = 0;
          $this->sc_force_zero[] = 'intnumber';
      } 
      if ($this->wtproducerbranchid == "")  
      { 
          $this->wtproducerbranchid = 0;
          $this->sc_force_zero[] = 'wtproducerbranchid';
      } 
      if ($this->wtproducerperiferia == "")  
      { 
          $this->wtproducerperiferia = 0;
          $this->sc_force_zero[] = 'wtproducerperiferia';
      } 
      if ($this->wtproduceracceptweigth == "")  
      { 
          $this->wtproduceracceptweigth = 0;
          $this->sc_force_zero[] = 'wtproduceracceptweigth';
      } 
      if ($this->wtproducerqty == "")  
      { 
          $this->wtproducerqty = 0;
          $this->sc_force_zero[] = 'wtproducerqty';
      } 
      if ($this->wtprducerm3 == "")  
      { 
          $this->wtprducerm3 = 0;
          $this->sc_force_zero[] = 'wtprducerm3';
      } 
      if ($this->wttransporterid == "")  
      { 
          $this->wttransporterid = 0;
          $this->sc_force_zero[] = 'wttransporterid';
      } 
      if ($this->wttransporterperiferiaid == "")  
      { 
          $this->wttransporterperiferiaid = 0;
          $this->sc_force_zero[] = 'wttransporterperiferiaid';
      } 
      if ($this->wttransportervalidate == "")  
      { 
          $this->wttransportervalidate = 0;
          $this->sc_force_zero[] = 'wttransportervalidate';
      } 
      if ($this->wtwasteid == "")  
      { 
          $this->wtwasteid = 0;
          $this->sc_force_zero[] = 'wtwasteid';
      } 
      if ($this->wtequipment == "")  
      { 
          $this->wtequipment = 0;
          $this->sc_force_zero[] = 'wtequipment';
      } 
      if ($this->wtfdestid == "")  
      { 
          $this->wtfdestid = 0;
          $this->sc_force_zero[] = 'wtfdestid';
      } 
      if ($this->wtfdestperiferia == "")  
      { 
          $this->wtfdestperiferia = 0;
          $this->sc_force_zero[] = 'wtfdestperiferia';
      } 
      if ($this->wtfdestqty == "")  
      { 
          $this->wtfdestqty = 0;
          $this->sc_force_zero[] = 'wtfdestqty';
      } 
      if ($this->wtfdestm3 == "")  
      { 
          $this->wtfdestm3 = 0;
          $this->sc_force_zero[] = 'wtfdestm3';
      } 
      if ($this->wtfdestvlidated == "")  
      { 
          $this->wtfdestvlidated = 0;
          $this->sc_force_zero[] = 'wtfdestvlidated';
      } 
      $nm_bases_lob_geral = array();
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['decimal_db'] == ",") 
      {
          $this->nm_troca_decimal(".", ",");
      }
      if ($this->nmgp_opcao == "alterar" || $this->nmgp_opcao == "incluir") 
      {
          if ($this->wtrequestdate == "")  
          { 
              $this->wtrequestdate = "null"; 
              $NM_val_null[] = "wtrequestdate";
          } 
          $this->wtproducerewc_before_qstr = $this->wtproducerewc;
          $this->wtproducerewc = substr($this->Db->qstr($this->wtproducerewc), 1, -1); 
          $this->wtproducerremarks_before_qstr = $this->wtproducerremarks;
          $this->wtproducerremarks = substr($this->Db->qstr($this->wtproducerremarks), 1, -1); 
          if ($this->wttransportdate == "")  
          { 
              $this->wttransportdate = "null"; 
              $NM_val_null[] = "wttransportdate";
          } 
          $this->wtproducervalidate_before_qstr = $this->wtproducervalidate;
          $this->wtproducervalidate = substr($this->Db->qstr($this->wtproducervalidate), 1, -1); 
          $this->wttransporterewc_before_qstr = $this->wttransporterewc;
          $this->wttransporterewc = substr($this->Db->qstr($this->wttransporterewc), 1, -1); 
          $this->wttransportervechicle_before_qstr = $this->wttransportervechicle;
          $this->wttransportervechicle = substr($this->Db->qstr($this->wttransportervechicle), 1, -1); 
          $this->wttransportervalidateip_before_qstr = $this->wttransportervalidateip;
          $this->wttransportervalidateip = substr($this->Db->qstr($this->wttransportervalidateip), 1, -1); 
          $this->envregistrationno_transporter_before_qstr = $this->envregistrationno_transporter;
          $this->envregistrationno_transporter = substr($this->Db->qstr($this->envregistrationno_transporter), 1, -1); 
          $this->wttransporternumberid_before_qstr = $this->wttransporternumberid;
          $this->wttransporternumberid = substr($this->Db->qstr($this->wttransporternumberid), 1, -1); 
          if ($this->wtfdestdate == "")  
          { 
              $this->wtfdestdate = "null"; 
              $NM_val_null[] = "wtfdestdate";
          } 
          $this->wtfdestewc_before_qstr = $this->wtfdestewc;
          $this->wtfdestewc = substr($this->Db->qstr($this->wtfdestewc), 1, -1); 
          $this->wtfdestrd_before_qstr = $this->wtfdestrd;
          $this->wtfdestrd = substr($this->Db->qstr($this->wtfdestrd), 1, -1); 
          $this->wtfdestvalidateip_before_qstr = $this->wtfdestvalidateip;
          $this->wtfdestvalidateip = substr($this->Db->qstr($this->wtfdestvalidateip), 1, -1); 
          $this->envregistrationno_fdest_before_qstr = $this->envregistrationno_fdest;
          $this->envregistrationno_fdest = substr($this->Db->qstr($this->envregistrationno_fdest), 1, -1); 
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sqlite))
          { 
              if (!empty($this->wttransportersign) && $this->wttransportersign != 'null' && substr($this->wttransportersign, 0, 4) != "*nm*") 
              { 
                  $this->wttransportersign = "*nm*" . base64_encode($this->wttransportersign) ; 
              } 
          } 
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
          { }
          else
          { 
              $this->wttransportersign =  substr($this->Db->qstr($this->wttransportersign), 1, -1);
          } 
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sqlite))
          { 
              if (!empty($this->wtproducersign) && $this->wtproducersign != 'null' && substr($this->wtproducersign, 0, 4) != "*nm*") 
              { 
                  $this->wtproducersign = "*nm*" . base64_encode($this->wtproducersign) ; 
              } 
          } 
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
          { }
          else
          { 
              $this->wtproducersign =  substr($this->Db->qstr($this->wtproducersign), 1, -1);
          } 
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sqlite))
          { 
              if (!empty($this->wtfdestsign) && $this->wtfdestsign != 'null' && substr($this->wtfdestsign, 0, 4) != "*nm*") 
              { 
                  $this->wtfdestsign = "*nm*" . base64_encode($this->wtfdestsign) ; 
              } 
          } 
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
          { }
          else
          { 
              $this->wtfdestsign =  substr($this->Db->qstr($this->wtfdestsign), 1, -1);
          } 
      }
      if ($this->nmgp_opcao == "alterar") 
      {
          $SC_ex_update = true; 
          $SC_ex_upd_or = true; 
          if (($this->Embutida_form || $this->Embutida_multi) && isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['foreign_key']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['foreign_key']))
          {
              foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['foreign_key'] as $sFKName => $sFKValue)
              {
                   if (isset($this->sc_conv_var[$sFKName]))
                   {
                       $sFKName = $this->sc_conv_var[$sFKName];
                   }
                  eval("\$this->" . $sFKName . " = \"" . $sFKValue . "\";");
              }
          }
          if ($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['decimal_db'] == ",") 
          {
              $this->nm_poe_aspas_decimal();
          }
          $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where wtid = $this->wtid ";
          $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where wtid = $this->wtid "); 
          if ($rs1 === false)  
          { 
              $this->Erro->mensagem (__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dbas'], $this->Db->ErrorMsg()); 
              if ($this->NM_ajax_flag)
              {
                 validate_wastetransactions_mob_pack_ajax_response();
              }
              exit; 
          }  
          $bUpdateOk = true;
          $tmp_result = (int) $rs1->fields[0]; 
          if ($tmp_result != 1) 
          { 
              $this->Erro->mensagem (__FILE__, __LINE__, "critica", $this->Ini->Nm_lang['lang_errm_nfnd']); 
              $this->nmgp_opcao = "nada"; 
              $bUpdateOk = false;
              $this->sc_evento = 'update';
          } 
          $aUpdateOk = array();
          $bUpdateOk = $bUpdateOk && empty($aUpdateOk);
          if ($bUpdateOk)
          { 
              $rs1->Close(); 
              $comando_oracle = "";  
              $comando = "UPDATE " . $this->Ini->nm_tabela . " SET wtRequestDate = '$this->wtrequestdate', wtProducerBranchID = $this->wtproducerbranchid, wtProducerPeriferia = $this->wtproducerperiferia, wtProducerAcceptWeigth = $this->wtproduceracceptweigth, wtProducerEwc = '$this->wtproducerewc', wtProducerQty = $this->wtproducerqty, wtPrducerm3 = $this->wtprducerm3, wtProducerRemarks = '$this->wtproducerremarks', wtTransportDate = '$this->wttransportdate', wtTransporterID = $this->wttransporterid, wtTransporterVechicle = '$this->wttransportervechicle', EnvRegistrationNo_Transporter = '$this->envregistrationno_transporter', wtTransporterNumberID = '$this->wttransporternumberid', wtWasteID = $this->wtwasteid, wtequipment = $this->wtequipment, wtFdestDate = '$this->wtfdestdate', wtFDestID = $this->wtfdestid, wtFDestPeriferia = $this->wtfdestperiferia, wtFDestEWC = '$this->wtfdestewc', wtFDestRD = '$this->wtfdestrd', wtFDestQty = $this->wtfdestqty, wtFDestM3 = $this->wtfdestm3, EnvRegistrationNo_FDest = '$this->envregistrationno_fdest'";  
              if (isset($NM_val_form['wtprofilid']) && $NM_val_form['wtprofilid'] != $this->nmgp_dados_select['wtprofilid']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " wtProfilID = $this->wtprofilid"; 
                  $comando_oracle        .= " wtProfilID = $this->wtprofilid"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['intnumber']) && $NM_val_form['intnumber'] != $this->nmgp_dados_select['intnumber']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " INTNUMBER = $this->intnumber"; 
                  $comando_oracle        .= " INTNUMBER = $this->intnumber"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['wtproducervalidate']) && $NM_val_form['wtproducervalidate'] != $this->nmgp_dados_select['wtproducervalidate']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " wtProducerValidate = '$this->wtproducervalidate'"; 
                  $comando_oracle        .= " wtProducerValidate = '$this->wtproducervalidate'"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['wttransporterperiferiaid']) && $NM_val_form['wttransporterperiferiaid'] != $this->nmgp_dados_select['wttransporterperiferiaid']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " wtTransporterPeriferiaID = $this->wttransporterperiferiaid"; 
                  $comando_oracle        .= " wtTransporterPeriferiaID = $this->wttransporterperiferiaid"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['wttransporterewc']) && $NM_val_form['wttransporterewc'] != $this->nmgp_dados_select['wttransporterewc']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " wtTransporterEWC = '$this->wttransporterewc'"; 
                  $comando_oracle        .= " wtTransporterEWC = '$this->wttransporterewc'"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['wttransportervalidate']) && $NM_val_form['wttransportervalidate'] != $this->nmgp_dados_select['wttransportervalidate']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " wtTransporterValidate = $this->wttransportervalidate"; 
                  $comando_oracle        .= " wtTransporterValidate = $this->wttransportervalidate"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['wttransportervalidateip']) && $NM_val_form['wttransportervalidateip'] != $this->nmgp_dados_select['wttransportervalidateip']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " wtTransporterValidateIP = '$this->wttransportervalidateip'"; 
                  $comando_oracle        .= " wtTransporterValidateIP = '$this->wttransportervalidateip'"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['wtfdestvlidated']) && $NM_val_form['wtfdestvlidated'] != $this->nmgp_dados_select['wtfdestvlidated']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " wtFDestVlidated = $this->wtfdestvlidated"; 
                  $comando_oracle        .= " wtFDestVlidated = $this->wtfdestvlidated"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['wtfdestvalidateip']) && $NM_val_form['wtfdestvalidateip'] != $this->nmgp_dados_select['wtfdestvalidateip']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " wtFDestValidateIP = '$this->wtfdestvalidateip'"; 
                  $comando_oracle        .= " wtFDestValidateIP = '$this->wtfdestvalidateip'"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              $aDoNotUpdate = array();
              $temp_cmd_sql = "";
              if ($this->wttransportersign_limpa == "S") 
              { 
                  if ($this->wttransportersign != "null") 
                  { 
                      $this->wttransportersign = ''; 
                  } 
                  if ($SC_ex_update || $SC_tem_cmp_update || $SC_ex_upd_or) 
                  { 
                      $temp_cmd_sql .= ", wtTransporterSign = '" . $this->wttransportersign . "'"; 
                      $comando_oracle .= ", wtTransporterSign = '" . $this->wttransportersign . "'"; 
                  } 
                  else 
                  { 
                     $temp_cmd_sql .= " wtTransporterSign = '" . $this->wttransportersign . "'"; 
                     $comando_oracle .= " wtTransporterSign = '" . $this->wttransportersign . "'"; 
                     $SC_ex_upd_or = true; 
                     $SC_ex_update = true; 
                  } 
                  $this->wttransportersign = "";
              } 
              else 
              { 
                  if ($this->wttransportersign != "none" && $this->wttransportersign != "") 
                  { 
                      $NM_conteudo =  $this->wttransportersign;
                      if ($SC_ex_update || $SC_tem_cmp_update || $SC_ex_upd_or) 
                      { 
                          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
                          {
                              $temp_cmd_sql .= ", wtTransporterSign = 0x" . bin2hex($NM_conteudo); 
                          }
                          else
                          {
                              $temp_cmd_sql .= ", wtTransporterSign = '$NM_conteudo'" ; 
                          }
                          $comando_oracle .= ", wtTransporterSign = '$NM_conteudo'" ; 
                      } 
                      else 
                      { 
                          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
                          {
                              $temp_cmd_sql .= ", wtTransporterSign = 0x" . bin2hex($NM_conteudo); 
                          }
                          else
                          {
                              $temp_cmd_sql .= " wtTransporterSign = '$NM_conteudo'" ; 
                          }
                          $comando_oracle .= " wtTransporterSign = '$NM_conteudo'" ; 
                          $SC_ex_upd_or = true; 
                          $SC_ex_update = true; 
                      } 
                  } 
                  else
                  {
                      $aDoNotUpdate[] = "wttransportersign";
                  }
              } 
              if (!empty($temp_cmd_sql)) 
              { 
                  $comando .= $temp_cmd_sql;
              } 
              $temp_cmd_sql = "";
              if ($this->wtproducersign_limpa == "S") 
              { 
                  if ($this->wtproducersign != "null") 
                  { 
                      $this->wtproducersign = ''; 
                  } 
                  if ($SC_ex_update || $SC_tem_cmp_update || $SC_ex_upd_or) 
                  { 
                      $temp_cmd_sql .= ", wtProducerSign = '" . $this->wtproducersign . "'"; 
                      $comando_oracle .= ", wtProducerSign = '" . $this->wtproducersign . "'"; 
                  } 
                  else 
                  { 
                     $temp_cmd_sql .= " wtProducerSign = '" . $this->wtproducersign . "'"; 
                     $comando_oracle .= " wtProducerSign = '" . $this->wtproducersign . "'"; 
                     $SC_ex_upd_or = true; 
                     $SC_ex_update = true; 
                  } 
                  $this->wtproducersign = "";
              } 
              else 
              { 
                  if ($this->wtproducersign != "none" && $this->wtproducersign != "") 
                  { 
                      $NM_conteudo =  $this->wtproducersign;
                      if ($SC_ex_update || $SC_tem_cmp_update || $SC_ex_upd_or) 
                      { 
                          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
                          {
                              $temp_cmd_sql .= ", wtProducerSign = 0x" . bin2hex($NM_conteudo); 
                          }
                          else
                          {
                              $temp_cmd_sql .= ", wtProducerSign = '$NM_conteudo'" ; 
                          }
                          $comando_oracle .= ", wtProducerSign = '$NM_conteudo'" ; 
                      } 
                      else 
                      { 
                          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
                          {
                              $temp_cmd_sql .= ", wtProducerSign = 0x" . bin2hex($NM_conteudo); 
                          }
                          else
                          {
                              $temp_cmd_sql .= " wtProducerSign = '$NM_conteudo'" ; 
                          }
                          $comando_oracle .= " wtProducerSign = '$NM_conteudo'" ; 
                          $SC_ex_upd_or = true; 
                          $SC_ex_update = true; 
                      } 
                  } 
                  else
                  {
                      $aDoNotUpdate[] = "wtproducersign";
                  }
              } 
              if (!empty($temp_cmd_sql)) 
              { 
                  $comando .= $temp_cmd_sql;
              } 
              $temp_cmd_sql = "";
              if ($this->wtfdestsign_limpa == "S") 
              { 
                  if ($this->wtfdestsign != "null") 
                  { 
                      $this->wtfdestsign = ''; 
                  } 
                  if ($SC_ex_update || $SC_tem_cmp_update || $SC_ex_upd_or) 
                  { 
                      $temp_cmd_sql .= ", wtFDestSign = '" . $this->wtfdestsign . "'"; 
                      $comando_oracle .= ", wtFDestSign = '" . $this->wtfdestsign . "'"; 
                  } 
                  else 
                  { 
                     $temp_cmd_sql .= " wtFDestSign = '" . $this->wtfdestsign . "'"; 
                     $comando_oracle .= " wtFDestSign = '" . $this->wtfdestsign . "'"; 
                     $SC_ex_upd_or = true; 
                     $SC_ex_update = true; 
                  } 
                  $this->wtfdestsign = "";
              } 
              else 
              { 
                  if ($this->wtfdestsign != "none" && $this->wtfdestsign != "") 
                  { 
                      $NM_conteudo =  $this->wtfdestsign;
                      if ($SC_ex_update || $SC_tem_cmp_update || $SC_ex_upd_or) 
                      { 
                          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
                          {
                              $temp_cmd_sql .= ", wtFDestSign = 0x" . bin2hex($NM_conteudo); 
                          }
                          else
                          {
                              $temp_cmd_sql .= ", wtFDestSign = '$NM_conteudo'" ; 
                          }
                          $comando_oracle .= ", wtFDestSign = '$NM_conteudo'" ; 
                      } 
                      else 
                      { 
                          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
                          {
                              $temp_cmd_sql .= ", wtFDestSign = 0x" . bin2hex($NM_conteudo); 
                          }
                          else
                          {
                              $temp_cmd_sql .= " wtFDestSign = '$NM_conteudo'" ; 
                          }
                          $comando_oracle .= " wtFDestSign = '$NM_conteudo'" ; 
                          $SC_ex_upd_or = true; 
                          $SC_ex_update = true; 
                      } 
                  } 
                  else
                  {
                      $aDoNotUpdate[] = "wtfdestsign";
                  }
              } 
              if (!empty($temp_cmd_sql)) 
              { 
                  $comando .= $temp_cmd_sql;
              } 
              if (in_array(strtolower($this->Ini->nm_tpbanco), $nm_bases_lob_geral))
              { 
                  $comando = $comando_oracle;  
                  $SC_ex_update = $SC_ex_upd_or;
              }   
              $comando .= " WHERE wtid = $this->wtid ";  
              $comando = str_replace("'null'", "null", $comando) ; 
              $comando = str_replace("#null#", "null", $comando) ; 
              if ($SC_ex_update || $SC_tem_cmp_update)
              { 
                  $_SESSION['scriptcase']['sc_sql_ult_comando'] = $comando; 
                  $rs = $this->Db->Execute($comando);  
                  if ($rs === false) 
                  { 
                      if (FALSE === strpos(strtoupper($this->Db->ErrorMsg()), "MAIL SENT") && FALSE === strpos(strtoupper($this->Db->ErrorMsg()), "WARNING"))
                      {
                          $this->Erro->mensagem (__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_updt'], $this->Db->ErrorMsg(), true); 
                          if (isset($_SESSION['scriptcase']['erro_handler']) && $_SESSION['scriptcase']['erro_handler']) 
                          { 
                              $this->sc_erro_update = $this->Db->ErrorMsg();  
                              $this->NM_rollback_db(); 
                              if ($this->NM_ajax_flag)
                              {
                                  validate_wastetransactions_mob_pack_ajax_response();
                              }
                              exit;  
                          }   
                      }   
                  }   
              }   
              if (in_array(strtolower($this->Ini->nm_tpbanco), $nm_bases_lob_geral))
              { 
              }   
              if ($this->wttransportersign_limpa == "S")
              {
                  $this->NM_ajax_info['fldList']['wttransportersign_salva'] = array(
                      'row'     => '',
                      'type'    => 'text',
                      'valList' => array(''),
                  );
              }
              if ($this->wtproducersign_limpa == "S")
              {
                  $this->NM_ajax_info['fldList']['wtproducersign_salva'] = array(
                      'row'     => '',
                      'type'    => 'text',
                      'valList' => array(''),
                  );
              }
              if ($this->wtfdestsign_limpa == "S")
              {
                  $this->NM_ajax_info['fldList']['wtfdestsign_salva'] = array(
                      'row'     => '',
                      'type'    => 'text',
                      'valList' => array(''),
                  );
              }
          $this->wtproducerewc = $this->wtproducerewc_before_qstr;
          $this->wtproducerremarks = $this->wtproducerremarks_before_qstr;
          $this->wtproducervalidate = $this->wtproducervalidate_before_qstr;
          $this->wttransporterewc = $this->wttransporterewc_before_qstr;
          $this->wttransportervechicle = $this->wttransportervechicle_before_qstr;
          $this->wttransportervalidateip = $this->wttransportervalidateip_before_qstr;
          $this->envregistrationno_transporter = $this->envregistrationno_transporter_before_qstr;
          $this->wttransporternumberid = $this->wttransporternumberid_before_qstr;
          $this->wtfdestewc = $this->wtfdestewc_before_qstr;
          $this->wtfdestrd = $this->wtfdestrd_before_qstr;
          $this->wtfdestvalidateip = $this->wtfdestvalidateip_before_qstr;
          $this->envregistrationno_fdest = $this->envregistrationno_fdest_before_qstr;
              $this->sc_evento = "update"; 
              $this->nmgp_opcao = "igual"; 
              $this->nm_flag_iframe = true;
              if ($this->lig_edit_lookup)
              {
                  $this->lig_edit_lookup_call = true;
              }
              $this->NM_gera_log_new();
              $this->NM_gera_log_compress();

              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['db_changed'] = true;


              if     (isset($NM_val_form) && isset($NM_val_form['wtid'])) { $this->wtid = $NM_val_form['wtid']; }
              elseif (isset($this->wtid)) { $this->nm_limpa_alfa($this->wtid); }
              if     (isset($NM_val_form) && isset($NM_val_form['wtproducerbranchid'])) { $this->wtproducerbranchid = $NM_val_form['wtproducerbranchid']; }
              elseif (isset($this->wtproducerbranchid)) { $this->nm_limpa_alfa($this->wtproducerbranchid); }
              if     (isset($NM_val_form) && isset($NM_val_form['wtproducerperiferia'])) { $this->wtproducerperiferia = $NM_val_form['wtproducerperiferia']; }
              elseif (isset($this->wtproducerperiferia)) { $this->nm_limpa_alfa($this->wtproducerperiferia); }
              if     (isset($NM_val_form) && isset($NM_val_form['wtproduceracceptweigth'])) { $this->wtproduceracceptweigth = $NM_val_form['wtproduceracceptweigth']; }
              elseif (isset($this->wtproduceracceptweigth)) { $this->nm_limpa_alfa($this->wtproduceracceptweigth); }
              if     (isset($NM_val_form) && isset($NM_val_form['wtproducerewc'])) { $this->wtproducerewc = $NM_val_form['wtproducerewc']; }
              elseif (isset($this->wtproducerewc)) { $this->nm_limpa_alfa($this->wtproducerewc); }
              if     (isset($NM_val_form) && isset($NM_val_form['wtproducerqty'])) { $this->wtproducerqty = $NM_val_form['wtproducerqty']; }
              elseif (isset($this->wtproducerqty)) { $this->nm_limpa_alfa($this->wtproducerqty); }
              if     (isset($NM_val_form) && isset($NM_val_form['wtprducerm3'])) { $this->wtprducerm3 = $NM_val_form['wtprducerm3']; }
              elseif (isset($this->wtprducerm3)) { $this->nm_limpa_alfa($this->wtprducerm3); }
              if     (isset($NM_val_form) && isset($NM_val_form['wtproducerremarks'])) { $this->wtproducerremarks = $NM_val_form['wtproducerremarks']; }
              elseif (isset($this->wtproducerremarks)) { $this->nm_limpa_alfa($this->wtproducerremarks); }
              if     (isset($NM_val_form) && isset($NM_val_form['wttransporterid'])) { $this->wttransporterid = $NM_val_form['wttransporterid']; }
              elseif (isset($this->wttransporterid)) { $this->nm_limpa_alfa($this->wttransporterid); }
              if     (isset($NM_val_form) && isset($NM_val_form['wttransportervechicle'])) { $this->wttransportervechicle = $NM_val_form['wttransportervechicle']; }
              elseif (isset($this->wttransportervechicle)) { $this->nm_limpa_alfa($this->wttransportervechicle); }
              if     (isset($NM_val_form) && isset($NM_val_form['envregistrationno_transporter'])) { $this->envregistrationno_transporter = $NM_val_form['envregistrationno_transporter']; }
              elseif (isset($this->envregistrationno_transporter)) { $this->nm_limpa_alfa($this->envregistrationno_transporter); }
              if     (isset($NM_val_form) && isset($NM_val_form['wttransporternumberid'])) { $this->wttransporternumberid = $NM_val_form['wttransporternumberid']; }
              elseif (isset($this->wttransporternumberid)) { $this->nm_limpa_alfa($this->wttransporternumberid); }
              if     (isset($NM_val_form) && isset($NM_val_form['wtwasteid'])) { $this->wtwasteid = $NM_val_form['wtwasteid']; }
              elseif (isset($this->wtwasteid)) { $this->nm_limpa_alfa($this->wtwasteid); }
              if     (isset($NM_val_form) && isset($NM_val_form['wtequipment'])) { $this->wtequipment = $NM_val_form['wtequipment']; }
              elseif (isset($this->wtequipment)) { $this->nm_limpa_alfa($this->wtequipment); }
              if     (isset($NM_val_form) && isset($NM_val_form['wtfdestid'])) { $this->wtfdestid = $NM_val_form['wtfdestid']; }
              elseif (isset($this->wtfdestid)) { $this->nm_limpa_alfa($this->wtfdestid); }
              if     (isset($NM_val_form) && isset($NM_val_form['wtfdestperiferia'])) { $this->wtfdestperiferia = $NM_val_form['wtfdestperiferia']; }
              elseif (isset($this->wtfdestperiferia)) { $this->nm_limpa_alfa($this->wtfdestperiferia); }
              if     (isset($NM_val_form) && isset($NM_val_form['wtfdestewc'])) { $this->wtfdestewc = $NM_val_form['wtfdestewc']; }
              elseif (isset($this->wtfdestewc)) { $this->nm_limpa_alfa($this->wtfdestewc); }
              if     (isset($NM_val_form) && isset($NM_val_form['wtfdestrd'])) { $this->wtfdestrd = $NM_val_form['wtfdestrd']; }
              elseif (isset($this->wtfdestrd)) { $this->nm_limpa_alfa($this->wtfdestrd); }
              if     (isset($NM_val_form) && isset($NM_val_form['wtfdestqty'])) { $this->wtfdestqty = $NM_val_form['wtfdestqty']; }
              elseif (isset($this->wtfdestqty)) { $this->nm_limpa_alfa($this->wtfdestqty); }
              if     (isset($NM_val_form) && isset($NM_val_form['wtfdestm3'])) { $this->wtfdestm3 = $NM_val_form['wtfdestm3']; }
              elseif (isset($this->wtfdestm3)) { $this->nm_limpa_alfa($this->wtfdestm3); }
              if     (isset($NM_val_form) && isset($NM_val_form['envregistrationno_fdest'])) { $this->envregistrationno_fdest = $NM_val_form['envregistrationno_fdest']; }
              elseif (isset($this->envregistrationno_fdest)) { $this->nm_limpa_alfa($this->envregistrationno_fdest); }

              $this->nm_formatar_campos();

              $aOldRefresh               = $this->nmgp_refresh_fields;
              $this->nmgp_refresh_fields = array_diff(array('wtrequestdate', 'wtproducerbranchid', 'producerb_address', 'prbrresponse', 'pphone', 'premail', 'wtproducerewc', 'ewctitle', 'wtproducerperiferia', 'wtproduceracceptweigth', 'wtproducerqty', 'wtprducerm3', 'wtproducersign', 'wttransportdate', 'wttransporternumberid', 'wttransportervechicle', 'wttransporterid', 'envregistrationno_transporter', 'transporterresponse', 'transporteremail', 'transporterphone', 'transporterfax', 'checktransvsproducer', 'checktransportervsfdest', 'wtwasteid', 'wtequipment', 'wttransportersign', 'wtfdestdate', 'wtfdestid', 'wtfdestperiferia', 'envregistrationno_fdest', 'fdestaddress', 'fdestrespone', 'fdestphone', 'fdestresponseemail', 'wtfdestewc', 'fdewctitle', 'wtfdestrd', 'wtfdestqty', 'wtfdestm3', 'wtfdestsign', 'wtproducerremarks'), $aDoNotUpdate);
              $this->ajax_return_values();
              $this->nmgp_refresh_fields = $aOldRefresh;

              $this->nm_tira_formatacao();
              $this->nm_converte_datas();
          }  
      }  
      if ($this->nmgp_opcao == "incluir") 
      { 
          $NM_cmp_auto = "";
          $NM_seq_auto = "";
          if (($this->Embutida_form || $this->Embutida_multi) && isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['foreign_key']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['foreign_key']))
          {
              foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['foreign_key'] as $sFKName => $sFKValue)
              {
                   if (isset($this->sc_conv_var[$sFKName]))
                   {
                       $sFKName = $this->sc_conv_var[$sFKName];
                   }
                  eval("\$this->" . $sFKName . " = \"" . $sFKValue . "\";");
              }
          }
          if ($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['decimal_db'] == ",") 
          {
              $this->nm_poe_aspas_decimal();
          }
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sqlite))
          { 
              $NM_seq_auto = "NULL, ";
              $NM_cmp_auto = "wtid, ";
          } 
          $bInsertOk = true;
          $aInsertOk = array(); 
          $bInsertOk = $bInsertOk && empty($aInsertOk);
          if (!isset($_POST['nmgp_ins_valid']) || $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['insert_validation'] != $_POST['nmgp_ins_valid'])
          {
              $bInsertOk = false;
              $this->Erro->mensagem(__FILE__, __LINE__, 'security', $this->Ini->Nm_lang['lang_errm_inst_vald']);
              if (isset($_SESSION['scriptcase']['erro_handler']) && $_SESSION['scriptcase']['erro_handler'])
              {
                  $this->nmgp_opcao = 'refresh_insert';
                  if ($this->NM_ajax_flag)
                  {
                      validate_wastetransactions_mob_pack_ajax_response();
                      exit;
                  }
              }
          }
          if ($bInsertOk)
          { 
              $_test_file = $this->fetchUniqueUploadName($this->wtproducersign_scfile_name, $dir_file, "wtproducersign");
              if (trim($this->wtproducersign_scfile_name) != $_test_file)
              {
                  $this->wtproducersign_scfile_name = $_test_file;
                  $this->wtproducersign = $_test_file;
              }
              $_test_file = $this->fetchUniqueUploadName($this->wttransportersign_scfile_name, $dir_file, "wttransportersign");
              if (trim($this->wttransportersign_scfile_name) != $_test_file)
              {
                  $this->wttransportersign_scfile_name = $_test_file;
                  $this->wttransportersign = $_test_file;
              }
              $_test_file = $this->fetchUniqueUploadName($this->wtfdestsign_scfile_name, $dir_file, "wtfdestsign");
              if (trim($this->wtfdestsign_scfile_name) != $_test_file)
              {
                  $this->wtfdestsign_scfile_name = $_test_file;
                  $this->wtfdestsign = $_test_file;
              }
              if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
              {
                  if ($this->wttransportersign != "" && $this->wttransportersign != "null")
                  { 
                       $this->wttransportersign = '0x' . bin2hex($this->wttransportersign);
                  } 
                  elseif ($this->wttransportersign != "null") 
                  { 
                       $this->wttransportersign = "'" . $this->wttransportersign . "'";
                  } 
                  if ($this->wtproducersign != "" && $this->wtproducersign != "null")
                  { 
                       $this->wtproducersign = '0x' . bin2hex($this->wtproducersign);
                  } 
                  elseif ($this->wtproducersign != "null") 
                  { 
                       $this->wtproducersign = "'" . $this->wtproducersign . "'";
                  } 
                  if ($this->wtfdestsign != "" && $this->wtfdestsign != "null")
                  { 
                       $this->wtfdestsign = '0x' . bin2hex($this->wtfdestsign);
                  } 
                  elseif ($this->wtfdestsign != "null") 
                  { 
                       $this->wtfdestsign = "'" . $this->wtfdestsign . "'";
                  } 
                  $comando = "INSERT INTO " . $this->Ini->nm_tabela . " (" . $NM_cmp_auto . "wtProfilID, INTNUMBER, wtRequestDate, wtProducerBranchID, wtProducerPeriferia, wtProducerAcceptWeigth, wtProducerEwc, wtProducerQty, wtPrducerm3, wtProducerRemarks, wtTransportDate, wtProducerValidate, wtTransporterID, wtTransporterPeriferiaID, wtTransporterEWC, wtTransporterVechicle, wtTransporterValidate, wtTransporterValidateIP, EnvRegistrationNo_Transporter, wtTransporterNumberID, wtWasteID, wtequipment, wtFdestDate, wtFDestID, wtFDestPeriferia, wtFDestEWC, wtFDestRD, wtFDestQty, wtFDestM3, wtFDestVlidated, wtFDestValidateIP, EnvRegistrationNo_FDest, wtTransporterSign, wtProducerSign, wtFDestSign) VALUES (" . $NM_seq_auto . "$this->wtprofilid, $this->intnumber, '$this->wtrequestdate', $this->wtproducerbranchid, $this->wtproducerperiferia, $this->wtproduceracceptweigth, '$this->wtproducerewc', $this->wtproducerqty, $this->wtprducerm3, '$this->wtproducerremarks', '$this->wttransportdate', '$this->wtproducervalidate', $this->wttransporterid, $this->wttransporterperiferiaid, '$this->wttransporterewc', '$this->wttransportervechicle', $this->wttransportervalidate, '$this->wttransportervalidateip', '$this->envregistrationno_transporter', '$this->wttransporternumberid', $this->wtwasteid, $this->wtequipment, '$this->wtfdestdate', $this->wtfdestid, $this->wtfdestperiferia, '$this->wtfdestewc', '$this->wtfdestrd', $this->wtfdestqty, $this->wtfdestm3, $this->wtfdestvlidated, '$this->wtfdestvalidateip', '$this->envregistrationno_fdest', $this->wttransportersign, $this->wtproducersign, $this->wtfdestsign)"; 
              }
              else
              {
                  $comando = "INSERT INTO " . $this->Ini->nm_tabela . " (" . $NM_cmp_auto . "wtProfilID, INTNUMBER, wtRequestDate, wtProducerBranchID, wtProducerPeriferia, wtProducerAcceptWeigth, wtProducerEwc, wtProducerQty, wtPrducerm3, wtProducerRemarks, wtTransportDate, wtProducerValidate, wtTransporterID, wtTransporterPeriferiaID, wtTransporterEWC, wtTransporterVechicle, wtTransporterValidate, wtTransporterValidateIP, EnvRegistrationNo_Transporter, wtTransporterNumberID, wtWasteID, wtequipment, wtFdestDate, wtFDestID, wtFDestPeriferia, wtFDestEWC, wtFDestRD, wtFDestQty, wtFDestM3, wtFDestVlidated, wtFDestValidateIP, EnvRegistrationNo_FDest, wtTransporterSign, wtProducerSign, wtFDestSign) VALUES (" . $NM_seq_auto . "$this->wtprofilid, $this->intnumber, '$this->wtrequestdate', $this->wtproducerbranchid, $this->wtproducerperiferia, $this->wtproduceracceptweigth, '$this->wtproducerewc', $this->wtproducerqty, $this->wtprducerm3, '$this->wtproducerremarks', '$this->wttransportdate', '$this->wtproducervalidate', $this->wttransporterid, $this->wttransporterperiferiaid, '$this->wttransporterewc', '$this->wttransportervechicle', $this->wttransportervalidate, '$this->wttransportervalidateip', '$this->envregistrationno_transporter', '$this->wttransporternumberid', $this->wtwasteid, $this->wtequipment, '$this->wtfdestdate', $this->wtfdestid, $this->wtfdestperiferia, '$this->wtfdestewc', '$this->wtfdestrd', $this->wtfdestqty, $this->wtfdestm3, $this->wtfdestvlidated, '$this->wtfdestvalidateip', '$this->envregistrationno_fdest', '$this->wttransportersign', '$this->wtproducersign', '$this->wtfdestsign')"; 
              }
              $comando = str_replace("'null'", "null", $comando) ; 
              $comando = str_replace("#null#", "null", $comando) ; 
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = $comando; 
              $rs = $this->Db->Execute($comando); 
              if ($rs === false)  
              { 
                  if (FALSE === strpos(strtoupper($this->Db->ErrorMsg()), "MAIL SENT") && FALSE === strpos(strtoupper($this->Db->ErrorMsg()), "WARNING"))
                  {
                      $this->Erro->mensagem (__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_inst'], $this->Db->ErrorMsg(), true); 
                      if (isset($_SESSION['scriptcase']['erro_handler']) && $_SESSION['scriptcase']['erro_handler']) 
                      { 
                          $this->sc_erro_insert = $this->Db->ErrorMsg();  
                          $this->nmgp_opcao     = 'refresh_insert';
                          $this->NM_rollback_db(); 
                          if ($this->NM_ajax_flag)
                          {
                              validate_wastetransactions_mob_pack_ajax_response();
                              exit; 
                          }
                      }  
                  }  
              }  
              if ('refresh_insert' != $this->nmgp_opcao)
              {
              if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
              { 
                  $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select last_insert_id()"; 
                  $rsy = $this->Db->Execute($_SESSION['scriptcase']['sc_sql_ult_comando']); 
                  if ($rsy === false && !$rsy->EOF)  
                  { 
                      $this->Erro->mensagem (__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dbas'], $this->Db->ErrorMsg()); 
                      exit; 
                  } 
                  $this->wtid = $rsy->fields[0];
                  $rsy->Close(); 
              } 
              if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sqlite))
              { 
                  $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select last_insert_rowid()"; 
                  $rsy = $this->Db->Execute($_SESSION['scriptcase']['sc_sql_ult_comando']); 
                  if ($rsy === false && !$rsy->EOF)  
                  { 
                      $this->Erro->mensagem (__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dbas'], $this->Db->ErrorMsg()); 
                      exit; 
                  } 
                  $this->wtid = $rsy->fields[0];
                  $rsy->Close(); 
              } 
              }

              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['db_changed'] = true;

              if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['total']))
              {
                  unset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['total']);
              }

              $this->sc_evento = "insert"; 
              $this->sc_insert_on = true; 
              $this->NM_gera_log_key("incluir");
              $this->NM_gera_log_new();
              if ('refresh_insert' != $this->nmgp_opcao && (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['sc_redir_insert']) || $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['sc_redir_insert'] != "S"))
              {
              $this->nmgp_opcao   = "igual"; 
              $this->nmgp_opc_ant = "igual"; 
              $this->nmgp_botoes['sc_btn_0'] = "on";
              $this->return_after_insert();
              }
              $this->nm_flag_iframe = true;
          } 
          if ($this->lig_edit_lookup)
          {
              $this->lig_edit_lookup_call = true;
          }
      } 
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['decimal_db'] == ",") 
      {
          $this->nm_tira_aspas_decimal();
      }
      if ($this->nmgp_opcao == "excluir") 
      { 
          $this->wtid = substr($this->Db->qstr($this->wtid), 1, -1); 

          $bDelecaoOk = true;
          $sMsgErro   = '';

          if ($bDelecaoOk)
          {

          $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where wtid = $this->wtid"; 
          $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where wtid = $this->wtid "); 
          if ($rs1 === false)  
          { 
              $this->Erro->mensagem (__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dbas'], $this->Db->ErrorMsg()); 
              exit; 
          }  
          if ($rs1 === false)  
          { 
              $this->Erro->mensagem (__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dbas'], $this->Db->ErrorMsg()); 
              exit; 
          }  
          $tmp_result = (int) $rs1->fields[0]; 
          if ($tmp_result != 1) 
          { 
              $this->Erro->mensagem (__FILE__, __LINE__, "critica", $this->Ini->Nm_lang['lang_errm_dele_nfnd']); 
              $this->nmgp_opcao = "nada"; 
              $this->sc_evento = 'delete';
          } 
          else 
          { 
              $rs1->Close(); 
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "DELETE FROM " . $this->Ini->nm_tabela . " where wtid = $this->wtid "; 
              $rs = $this->Db->Execute("DELETE FROM " . $this->Ini->nm_tabela . " where wtid = $this->wtid "); 
              if ($rs === false) 
              { 
                  $this->Erro->mensagem (__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dele'], $this->Db->ErrorMsg(), true); 
                  if (isset($_SESSION['scriptcase']['erro_handler']) && $_SESSION['scriptcase']['erro_handler']) 
                  { 
                      $this->sc_erro_delete = $this->Db->ErrorMsg();  
                      $this->NM_rollback_db(); 
                      if ($this->NM_ajax_flag)
                      {
                          validate_wastetransactions_mob_pack_ajax_response();
                          exit; 
                      }
                  } 
              } 
              $this->sc_evento = "delete"; 
              $this->nmgp_opcao = "avanca"; 
              $this->nm_flag_iframe = true;
              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['reg_start']--; 
              if ($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['reg_start'] < 0)
              {
                  $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['reg_start'] = 0; 
              }

              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['db_changed'] = true;

              if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['total']))
              {
                  unset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['total']);
              }

              if ($this->lig_edit_lookup)
              {
                  $this->lig_edit_lookup_call = true;
              }
          }

          }
          else
          {
              $this->sc_evento = "delete"; 
              $this->nmgp_opcao = "igual"; 
              $this->Erro->mensagem(__FILE__, __LINE__, "critica", $sMsgErro); 
          }

      }  
      if (!empty($this->sc_force_zero))
      {
          foreach ($this->sc_force_zero as $i_force_zero => $sc_force_zero_field)
          {
              eval('if ($this->' . $sc_force_zero_field . ' == 0) {$this->' . $sc_force_zero_field . ' = "";}');
          }
      }
      $this->sc_force_zero = array();
      if (!empty($NM_val_null))
      {
          foreach ($NM_val_null as $i_val_null => $sc_val_null_field)
          {
              eval('$this->' . $sc_val_null_field . ' = "";');
          }
      }
    if ("insert" == $this->sc_evento && $this->nmgp_opcao != "nada") {
        if ($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['decimal_db'] == ",")
        {
            $this->nm_troca_decimal(",", ".");
        }
        $_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'on';
if (!isset($this->sc_temp_TitleName)) {$this->sc_temp_TitleName = (isset($_SESSION['TitleName'])) ? $_SESSION['TitleName'] : "";}
                         



$check_sql1 = "SELECT PrBranchName "
   . " FROM producerbranch"
   . " WHERE PrBID = '" . $this->wtproducerbranchid  . "'";
 
      $nm_select = $check_sql1; 
      $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_select; 
      $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
      $this->rs1 = 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->rs1[$y] [$x] = $rx->fields[$x];
                 }
                 $y++; 
                 $rx->MoveNext();
          } 
          $rx->Close();
      } 
      elseif (isset($GLOBALS["NM_ERRO_IBASE"]) && $GLOBALS["NM_ERRO_IBASE"] != 1)  
      { 
          $this->rs1 = false;
          $this->rs1_erro = $this->Db->ErrorMsg();
      } 
;

if (isset($this->rs1[0][0]))     
{
   $ProducerName =  $this->rs1[0][0];
}
else
	{
	   $ProducerName = '';
	}


$check_sql2 = "SELECT Trans_Title "
   . " FROM transporter"
   . " WHERE TransporterID = '" . $this->wttransporterid  . "'";
 
      $nm_select = $check_sql2; 
      $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_select; 
      $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
      $this->rs2 = 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->rs2[$y] [$x] = $rx->fields[$x];
                 }
                 $y++; 
                 $rx->MoveNext();
          } 
          $rx->Close();
      } 
      elseif (isset($GLOBALS["NM_ERRO_IBASE"]) && $GLOBALS["NM_ERRO_IBASE"] != 1)  
      { 
          $this->rs2 = false;
          $this->rs2_erro = $this->Db->ErrorMsg();
      } 
;

if (isset($this->rs2[0][0]))     
{
   $TransporterName =  $this->rs2[0][0];
}
else
	{
	$TransporterName = '';
	}


$check_sql3 = "SELECT PrBranchName  "
   . " FROM fdestbranch"
   . " WHERE PrBID = '" . $this->wtfdestid  . "'";
 
      $nm_select = $check_sql3; 
      $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_select; 
      $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
      $this->rs3 = 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->rs3[$y] [$x] = $rx->fields[$x];
                 }
                 $y++; 
                 $rx->MoveNext();
          } 
          $rx->Close();
      } 
      elseif (isset($GLOBALS["NM_ERRO_IBASE"]) && $GLOBALS["NM_ERRO_IBASE"] != 1)  
      { 
          $this->rs3 = false;
          $this->rs3_erro = $this->Db->ErrorMsg();
      } 
;

if (isset($this->rs3[0][0]))     
{
   $FDestTitle =  $this->rs3[0][0];
}
else
	{
	$FDestTitle = '';
	}




$TitleName = $this->sc_temp_TitleName;


$mail_smtp_server    = 'mail.urlhost.gr';        
$mail_smtp_user      = 'etaxiswaste@urlhost.gr';                   
$mail_smtp_pass      = '100lobbe#';                
$mail_from           = 'etaxiswaste@urlhost.gr';  
$mail_format         = 'H';                       
$mail_copies         = '';                        
$mail_tp_copies      = '';                        
$mail_port           = '465';                     
$mail_tp_connection  = 'S';                       


$mail_subject        = 'Nέο εντύπο προς διαχείρηση απο ' .$this->sc_temp_TitleName;  

if ($this->wtproducerbranchid <>0) 
	{
$mail_to  = $this->premail ;        
	
$mail_subject        = 'Nέο εντύπο προς διαχείρηση απο ' .$this->sc_temp_TitleName;  
$msg = "<table border='1' bordercolor='#CCCCCC' cellpadding='5' cellspacing='0' width='600' height='260' style='border-collapse:collapse'>";
$msg .= "<tr>";
$msg .= "<td valign='top' style=' margin:0;'>";
$msg .= "<p>";
$msg .= "<b><font size='4' face='Verdana, Arial, Helvetica, sans-serif' color='#fe5800'> Η καταχώρηση με αριθμό ($this->wtid ) επιβεβαιώθηκε για τον εκδότη </font></b>";
$msg .= "<b><font size='3' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $TitleName </font></b>";
$msg .= "<br/>";
$msg .= "<br>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Ημερομηνία έκδοσης:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->wtrequestdate <font></b>";
$msg .= "<br>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Εγκατάσταση παραγωγού:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $ProducerName<font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Διεύθυνση εγκατάστασης:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->producerb_address <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία υπευθύνου:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->prbrresponse <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία επικοινωνίας:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->pphone <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Email:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->premail <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Κωδικός αποβλήτου:</font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->wtproducerewc  $this->ewctitle <font></b>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Κωδικός ταυτοποιησης</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->wtproducervalidate <font></b>";	


$msg .= "<br/>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Ημερομηνία μεταφοράς:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wttransportdate <font></b>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Μεταφορέας:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> // 
$TransporterName<font></b>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Οχημα μεταφοράς:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wttransportervechicle <font></b>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Υπεύθυνος μεταφοράς:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->transporterresponse <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Email υπευθύνου:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->transporteremail <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία επικοινωνίας:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->transporterphone  Fax : $this->transporterfax <font></b>";
	

$msg .= "<br/>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Ημερομηνία παραλαβής</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtfdestdate <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Εγκατάσταση παραλαβής</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $FDestTitle<font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Διεύθυνση εγκατάστασης</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestaddress <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Υπεύθυνος εγκατάστασης</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestrespone <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία επικοινωνίας</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestphone <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Email:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestresponseemail <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Κωδικός αποβλήτου παραλαβής/διαχείρησης:</font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtfdestewc -$this->fdewctitle -$this->wtfdestrd <font></b>";
$msg .= "<br/>";	
$msg .= "<br/>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Γενικά σχόλια εντύπου:</font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtproducerremarks <font></b>";

$msg .= "</p>";
$msg .= "</td>";
$msg .= "</tr>";
$msg .= "<tr>";
$msg .= "</tr>";
$msg .= "</table>";	
	
	
	
	
    include_once($this->Ini->path_third . "/swift/swift_required.php");
    $sc_mail_port     = "$mail_port";
    $sc_mail_tp_port  = "$mail_tp_connection";
    $sc_mail_tp_mens  = "$mail_format";
    $sc_mail_tp_copy  = "$mail_tp_copies";
    $this->sc_mail_count = 0;
    $this->sc_mail_erro  = "";
    $this->sc_mail_ok    = true;
    if ($sc_mail_tp_port == "S" || $sc_mail_tp_port == "Y")
    {
        $sc_mail_port = (!empty($sc_mail_port)) ? $sc_mail_port : 465;
        $Con_Mail = Swift_SmtpTransport::newInstance($mail_smtp_server, $sc_mail_port, 'ssl');
    }
    elseif ($sc_mail_tp_port == "T")
    {
        $sc_mail_port = !empty($sc_mail_port) ? $sc_mail_port : 587;
        $Con_Mail = Swift_SmtpTransport::newInstance($mail_smtp_server, $sc_mail_port, 'tls');
    }
    else
    {
        $sc_mail_port = (!empty($sc_mail_port)) ? $sc_mail_port : 25;
        $Con_Mail = Swift_SmtpTransport::newInstance($mail_smtp_server, $sc_mail_port);
    }
    $Con_Mail->setUsername($mail_smtp_user);
    $Con_Mail->setpassword($mail_smtp_pass);
    $Send_Mail = Swift_Mailer::newInstance($Con_Mail);
    if ($sc_mail_tp_mens == "H")
    {
        $Mens_Mail = Swift_Message::newInstance($mail_subject);
        $Mens_Mail->setBody(SC_Mail_Image($msg, $Mens_Mail))->setContentType("text/html");
    }
    else
    {
        $Mens_Mail = Swift_Message::newInstance($mail_subject)->setBody($msg);
    }
    if (!empty($_SESSION['scriptcase']['charset']))
    {
        $Mens_Mail->setCharset($_SESSION['scriptcase']['charset']);
    }
    $Temp_mail = $mail_to;
    if (!is_array($Temp_mail))
    {
        $Temp_mail = explode(";", $mail_to);
    }
    foreach ($Temp_mail as $NM_dest)
    {
        if (!empty($NM_dest))
        {
            $Arr_addr = SC_Mail_Address($NM_dest);
            $Mens_Mail->addTo($Arr_addr[0], $Arr_addr[1]);
        }
    }
    $Temp_mail = $mail_copies;
    if (!is_array($Temp_mail))
    {
        $Temp_mail = explode(";", $mail_copies);
    }
    foreach ($Temp_mail as $NM_dest)
    {
        if (!empty($NM_dest))
        {
            $Arr_addr = SC_Mail_Address($NM_dest);
            if (strtoupper(substr($sc_mail_tp_copy, 0, 2)) == "CC")
            {
                $Mens_Mail->addCc($Arr_addr[0], $Arr_addr[1]);
            }
            else
            {
                $Mens_Mail->addBcc($Arr_addr[0], $Arr_addr[1]);
            }
        }
    }
    $Arr_addr = SC_Mail_Address($mail_from);
    $this->sc_mail_count = $Send_Mail->send($Mens_Mail->setFrom($Arr_addr[0], $Arr_addr[1]), $Err_mail);
    if (!empty($Err_mail))
    {
        $this->sc_mail_erro = $Err_mail;
        $this->sc_mail_ok   = false;
    }
;

if ($this->sc_mail_ok ) {

echo "<script>alert('Το μύνημα στάλθηκε με επιτυχία!');</script>";
} else {

 if (!isset($this->Campos_Mens_erro)){$this->Campos_Mens_erro = "";}
 if (!empty($this->Campos_Mens_erro)){$this->Campos_Mens_erro .= "<br>";}$this->Campos_Mens_erro .= "There was a problem in sending! Please contact the System
Administrator through telephone (xx) xxxx-xxxx.";
 if ('submit_form' == $this->NM_ajax_opcao || 'event_' == substr($this->NM_ajax_opcao, 0, 6))
 {
  $sErrorIndex = ('submit_form' == $this->NM_ajax_opcao) ? 'geral_validate_wastetransactions_mob' : substr(substr($this->NM_ajax_opcao, 0, strrpos($this->NM_ajax_opcao, '_')), 6);
  $this->NM_ajax_info['errList'][$sErrorIndex][] = "There was a problem in sending! Please contact the System
Administrator through telephone (xx) xxxx-xxxx.";
 }
;
}
}
if ($this->wttransporterid <>0) 
	{
$mail_to  = $this->transporteremail ;        
	$mail_subject        = 'Nέο εντύπο προς διαχείρηση απο ' .$this->sc_temp_TitleName;  
$msg = "<table border='1' bordercolor='#CCCCCC' cellpadding='5' cellspacing='0' width='600' height='260' style='border-collapse:collapse'>";
$msg .= "<tr>";
$msg .= "<td valign='top' style=' margin:0;'>";
$msg .= "<p>";
$msg .= "<b><font size='4' face='Verdana, Arial, Helvetica, sans-serif' color='#fe5800'> Η καταχώρηση με αριθμό ($this->wtid ) επιβεβαιώθηκε για τον εκδότη </font></b>";
$msg .= "<b><font size='3' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $TitleName </font></b>";
$msg .= "<br/>";
$msg .= "<br>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Ημερομηνία έκδοσης:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->wtrequestdate <font></b>";
$msg .= "<br>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Εγκατάσταση παραγωγού:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $ProducerName<font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Διεύθυνση εγκατάστασης:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->producerb_address <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία υπευθύνου:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->prbrresponse <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία επικοινωνίας:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->pphone <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Email:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->premail <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Κωδικός αποβλήτου:</font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->wtproducerewc  $this->ewctitle <font></b>";	
$msg .= "<br/>";


$msg .= "<br/>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Ημερομηνία μεταφοράς:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wttransportdate <font></b>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Μεταφορέας:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> // 
$TransporterName<font></b>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Οχημα μεταφοράς:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wttransportervechicle <font></b>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Υπεύθυνος μεταφοράς:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->transporterresponse <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Email υπευθύνου:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->transporteremail <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία επικοινωνίας:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->transporterphone  Fax : $this->transporterfax <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Κωδικός ταυτοποίησης:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->wttransportervalidateip <font></b>";	

$msg .= "<br/>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Ημερομηνία παραλαβής</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtfdestdate <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Εγκατάσταση παραλαβής</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $FDestTitle<font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Διεύθυνση εγκατάστασης</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestaddress <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Υπεύθυνος εγκατάστασης</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestrespone <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία επικοινωνίας</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestphone <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Email:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestresponseemail <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Κωδικός αποβλήτου παραλαβής/διαχείρησης:</font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtfdestewc -$this->fdewctitle -$this->wtfdestrd <font></b>";
$msg .= "<br/>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Γενικά σχόλια εντύπου:</font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtproducerremarks <font></b>";

$msg .= "</p>";
$msg .= "</td>";
$msg .= "</tr>";
$msg .= "<tr>";
$msg .= "</tr>";
$msg .= "</table>";
    include_once($this->Ini->path_third . "/swift/swift_required.php");
    $sc_mail_port     = "$mail_port";
    $sc_mail_tp_port  = "$mail_tp_connection";
    $sc_mail_tp_mens  = "$mail_format";
    $sc_mail_tp_copy  = "$mail_tp_copies";
    $this->sc_mail_count = 0;
    $this->sc_mail_erro  = "";
    $this->sc_mail_ok    = true;
    if ($sc_mail_tp_port == "S" || $sc_mail_tp_port == "Y")
    {
        $sc_mail_port = (!empty($sc_mail_port)) ? $sc_mail_port : 465;
        $Con_Mail = Swift_SmtpTransport::newInstance($mail_smtp_server, $sc_mail_port, 'ssl');
    }
    elseif ($sc_mail_tp_port == "T")
    {
        $sc_mail_port = !empty($sc_mail_port) ? $sc_mail_port : 587;
        $Con_Mail = Swift_SmtpTransport::newInstance($mail_smtp_server, $sc_mail_port, 'tls');
    }
    else
    {
        $sc_mail_port = (!empty($sc_mail_port)) ? $sc_mail_port : 25;
        $Con_Mail = Swift_SmtpTransport::newInstance($mail_smtp_server, $sc_mail_port);
    }
    $Con_Mail->setUsername($mail_smtp_user);
    $Con_Mail->setpassword($mail_smtp_pass);
    $Send_Mail = Swift_Mailer::newInstance($Con_Mail);
    if ($sc_mail_tp_mens == "H")
    {
        $Mens_Mail = Swift_Message::newInstance($mail_subject);
        $Mens_Mail->setBody(SC_Mail_Image($msg, $Mens_Mail))->setContentType("text/html");
    }
    else
    {
        $Mens_Mail = Swift_Message::newInstance($mail_subject)->setBody($msg);
    }
    if (!empty($_SESSION['scriptcase']['charset']))
    {
        $Mens_Mail->setCharset($_SESSION['scriptcase']['charset']);
    }
    $Temp_mail = $mail_to;
    if (!is_array($Temp_mail))
    {
        $Temp_mail = explode(";", $mail_to);
    }
    foreach ($Temp_mail as $NM_dest)
    {
        if (!empty($NM_dest))
        {
            $Arr_addr = SC_Mail_Address($NM_dest);
            $Mens_Mail->addTo($Arr_addr[0], $Arr_addr[1]);
        }
    }
    $Temp_mail = $mail_copies;
    if (!is_array($Temp_mail))
    {
        $Temp_mail = explode(";", $mail_copies);
    }
    foreach ($Temp_mail as $NM_dest)
    {
        if (!empty($NM_dest))
        {
            $Arr_addr = SC_Mail_Address($NM_dest);
            if (strtoupper(substr($sc_mail_tp_copy, 0, 2)) == "CC")
            {
                $Mens_Mail->addCc($Arr_addr[0], $Arr_addr[1]);
            }
            else
            {
                $Mens_Mail->addBcc($Arr_addr[0], $Arr_addr[1]);
            }
        }
    }
    $Arr_addr = SC_Mail_Address($mail_from);
    $this->sc_mail_count = $Send_Mail->send($Mens_Mail->setFrom($Arr_addr[0], $Arr_addr[1]), $Err_mail);
    if (!empty($Err_mail))
    {
        $this->sc_mail_erro = $Err_mail;
        $this->sc_mail_ok   = false;
    }
;

if ($this->sc_mail_ok ) {

echo "<script>alert('Το μύνημα στάλθηκε με επιτυχία!');</script>";
} else {

 if (!isset($this->Campos_Mens_erro)){$this->Campos_Mens_erro = "";}
 if (!empty($this->Campos_Mens_erro)){$this->Campos_Mens_erro .= "<br>";}$this->Campos_Mens_erro .= "There was a problem in sending! Please contact the System
Administrator through telephone (xx) xxxx-xxxx.";
 if ('submit_form' == $this->NM_ajax_opcao || 'event_' == substr($this->NM_ajax_opcao, 0, 6))
 {
  $sErrorIndex = ('submit_form' == $this->NM_ajax_opcao) ? 'geral_validate_wastetransactions_mob' : substr(substr($this->NM_ajax_opcao, 0, strrpos($this->NM_ajax_opcao, '_')), 6);
  $this->NM_ajax_info['errList'][$sErrorIndex][] = "There was a problem in sending! Please contact the System
Administrator through telephone (xx) xxxx-xxxx.";
 }
;
}
}
if ($this->wtfdestid <>0) 
	{
$mail_to  = $this->fdestresponseemail ;        
	$mail_subject        = 'Nέο εντύπο προς διαχείρηση απο ' .$this->sc_temp_TitleName;  
$msg = "<table border='1' bordercolor='#CCCCCC' cellpadding='5' cellspacing='0' width='600' height='260' style='border-collapse:collapse'>";
$msg .= "<tr>";
$msg .= "<td valign='top' style=' margin:0;'>";
$msg .= "<p>";
$msg .= "<b><font size='4' face='Verdana, Arial, Helvetica, sans-serif' color='#fe5800'> Η καταχώρηση με αριθμό ($this->wtid ) επιβεβαιώθηκε για τον εκδότη </font></b>";
$msg .= "<b><font size='3' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $TitleName </font></b>";
$msg .= "<br/>";
$msg .= "<br>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Ημερομηνία έκδοσης:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->wtrequestdate <font></b>";
$msg .= "<br>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Εγκατάσταση παραγωγού:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $ProducerName<font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Διεύθυνση εγκατάστασης:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->producerb_address <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία υπευθύνου:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->prbrresponse <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία επικοινωνίας:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->pphone <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Email:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->premail <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Κωδικός αποβλήτου:</font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->wtproducerewc  $this->ewctitle <font></b>";	
$msg .= "<br/>";

$msg .= "<br/>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Ημερομηνία μεταφοράς:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wttransportdate <font></b>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Μεταφορέας:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> // 
$TransporterName<font></b>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Οχημα μεταφοράς:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wttransportervechicle <font></b>";	
	
	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Υπεύθυνος μεταφοράς:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->transporterresponse <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Email υπευθύνου:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->transporteremail <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία επικοινωνίας:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->transporterphone  Fax : $this->transporterfax <font></b>";


$msg .= "<br/>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Ημερομηνία παραλαβής</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtfdestdate <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Εγκατάσταση παραλαβής</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $FDestTitle<font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Διεύθυνση εγκατάστασης</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestaddress <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Υπεύθυνος εγκατάστασης</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestrespone <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία επικοινωνίας</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestphone <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Email:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestresponseemail <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Κωδικός αποβλήτου παραλαβής/διαχείρησης:</font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtfdestewc -$this->fdewctitle -$this->wtfdestrd <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Κωδικός ταυτοποίησης:</font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtfdestvalidateip <font></b>";
$msg .= "<br/>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Γενικά σχόλια εντύπου:</font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtproducerremarks <font></b>";

$msg .= "</p>";
$msg .= "</td>";
$msg .= "</tr>";
$msg .= "<tr>";
$msg .= "</tr>";
$msg .= "</table>";
    include_once($this->Ini->path_third . "/swift/swift_required.php");
    $sc_mail_port     = "$mail_port";
    $sc_mail_tp_port  = "$mail_tp_connection";
    $sc_mail_tp_mens  = "$mail_format";
    $sc_mail_tp_copy  = "$mail_tp_copies";
    $this->sc_mail_count = 0;
    $this->sc_mail_erro  = "";
    $this->sc_mail_ok    = true;
    if ($sc_mail_tp_port == "S" || $sc_mail_tp_port == "Y")
    {
        $sc_mail_port = (!empty($sc_mail_port)) ? $sc_mail_port : 465;
        $Con_Mail = Swift_SmtpTransport::newInstance($mail_smtp_server, $sc_mail_port, 'ssl');
    }
    elseif ($sc_mail_tp_port == "T")
    {
        $sc_mail_port = !empty($sc_mail_port) ? $sc_mail_port : 587;
        $Con_Mail = Swift_SmtpTransport::newInstance($mail_smtp_server, $sc_mail_port, 'tls');
    }
    else
    {
        $sc_mail_port = (!empty($sc_mail_port)) ? $sc_mail_port : 25;
        $Con_Mail = Swift_SmtpTransport::newInstance($mail_smtp_server, $sc_mail_port);
    }
    $Con_Mail->setUsername($mail_smtp_user);
    $Con_Mail->setpassword($mail_smtp_pass);
    $Send_Mail = Swift_Mailer::newInstance($Con_Mail);
    if ($sc_mail_tp_mens == "H")
    {
        $Mens_Mail = Swift_Message::newInstance($mail_subject);
        $Mens_Mail->setBody(SC_Mail_Image($msg, $Mens_Mail))->setContentType("text/html");
    }
    else
    {
        $Mens_Mail = Swift_Message::newInstance($mail_subject)->setBody($msg);
    }
    if (!empty($_SESSION['scriptcase']['charset']))
    {
        $Mens_Mail->setCharset($_SESSION['scriptcase']['charset']);
    }
    $Temp_mail = $mail_to;
    if (!is_array($Temp_mail))
    {
        $Temp_mail = explode(";", $mail_to);
    }
    foreach ($Temp_mail as $NM_dest)
    {
        if (!empty($NM_dest))
        {
            $Arr_addr = SC_Mail_Address($NM_dest);
            $Mens_Mail->addTo($Arr_addr[0], $Arr_addr[1]);
        }
    }
    $Temp_mail = $mail_copies;
    if (!is_array($Temp_mail))
    {
        $Temp_mail = explode(";", $mail_copies);
    }
    foreach ($Temp_mail as $NM_dest)
    {
        if (!empty($NM_dest))
        {
            $Arr_addr = SC_Mail_Address($NM_dest);
            if (strtoupper(substr($sc_mail_tp_copy, 0, 2)) == "CC")
            {
                $Mens_Mail->addCc($Arr_addr[0], $Arr_addr[1]);
            }
            else
            {
                $Mens_Mail->addBcc($Arr_addr[0], $Arr_addr[1]);
            }
        }
    }
    $Arr_addr = SC_Mail_Address($mail_from);
    $this->sc_mail_count = $Send_Mail->send($Mens_Mail->setFrom($Arr_addr[0], $Arr_addr[1]), $Err_mail);
    if (!empty($Err_mail))
    {
        $this->sc_mail_erro = $Err_mail;
        $this->sc_mail_ok   = false;
    }
;

if ($this->sc_mail_ok ) {

echo "<script>alert('Το μύνημα στάλθηκε με επιτυχία!');</script>";
} else {

 if (!isset($this->Campos_Mens_erro)){$this->Campos_Mens_erro = "";}
 if (!empty($this->Campos_Mens_erro)){$this->Campos_Mens_erro .= "<br>";}$this->Campos_Mens_erro .= "There was a problem in sending! Please contact the System
Administrator through telephone (xx) xxxx-xxxx.";
 if ('submit_form' == $this->NM_ajax_opcao || 'event_' == substr($this->NM_ajax_opcao, 0, 6))
 {
  $sErrorIndex = ('submit_form' == $this->NM_ajax_opcao) ? 'geral_validate_wastetransactions_mob' : substr(substr($this->NM_ajax_opcao, 0, strrpos($this->NM_ajax_opcao, '_')), 6);
  $this->NM_ajax_info['errList'][$sErrorIndex][] = "There was a problem in sending! Please contact the System
Administrator through telephone (xx) xxxx-xxxx.";
 }
;
}
}
if (isset($this->sc_temp_TitleName)) { $_SESSION['TitleName'] = $this->sc_temp_TitleName;}
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'off'; 
    }
    if ("update" == $this->sc_evento && $this->nmgp_opcao != "nada") {
        $_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'on';
if (!isset($this->sc_temp_TitleName)) {$this->sc_temp_TitleName = (isset($_SESSION['TitleName'])) ? $_SESSION['TitleName'] : "";}
                         



$check_sql1 = "SELECT PrBranchName "
   . " FROM producerbranch"
   . " WHERE PrBID = '" . $this->wtproducerbranchid  . "'";
 
      $nm_select = $check_sql1; 
      $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_select; 
      $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
      $this->rs1 = 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->rs1[$y] [$x] = $rx->fields[$x];
                 }
                 $y++; 
                 $rx->MoveNext();
          } 
          $rx->Close();
      } 
      elseif (isset($GLOBALS["NM_ERRO_IBASE"]) && $GLOBALS["NM_ERRO_IBASE"] != 1)  
      { 
          $this->rs1 = false;
          $this->rs1_erro = $this->Db->ErrorMsg();
      } 
;

if (isset($this->rs1[0][0]))     
{
   $ProducerName =  $this->rs1[0][0];
}
else
	{
	   $ProducerName = '';
	}


$check_sql2 = "SELECT Trans_Title "
   . " FROM transporter"
   . " WHERE TransporterID = '" . $this->wttransporterid  . "'";
 
      $nm_select = $check_sql2; 
      $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_select; 
      $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
      $this->rs2 = 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->rs2[$y] [$x] = $rx->fields[$x];
                 }
                 $y++; 
                 $rx->MoveNext();
          } 
          $rx->Close();
      } 
      elseif (isset($GLOBALS["NM_ERRO_IBASE"]) && $GLOBALS["NM_ERRO_IBASE"] != 1)  
      { 
          $this->rs2 = false;
          $this->rs2_erro = $this->Db->ErrorMsg();
      } 
;

if (isset($this->rs2[0][0]))     
{
   $TransporterName =  $this->rs2[0][0];
}
else
	{
	$TransporterName = '';
	}


$check_sql3 = "SELECT PrBranchName  "
   . " FROM fdestbranch"
   . " WHERE PrBID = '" . $this->wtfdestid  . "'";
 
      $nm_select = $check_sql3; 
      $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_select; 
      $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
      $this->rs3 = 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->rs3[$y] [$x] = $rx->fields[$x];
                 }
                 $y++; 
                 $rx->MoveNext();
          } 
          $rx->Close();
      } 
      elseif (isset($GLOBALS["NM_ERRO_IBASE"]) && $GLOBALS["NM_ERRO_IBASE"] != 1)  
      { 
          $this->rs3 = false;
          $this->rs3_erro = $this->Db->ErrorMsg();
      } 
;

if (isset($this->rs3[0][0]))     
{
   $FDestTitle =  $this->rs3[0][0];
}
else
	{
	$FDestTitle = '';
	}




$TitleName = $this->sc_temp_TitleName;


$mail_smtp_server    = 'mail.urlhost.gr';        
$mail_smtp_user      = 'etaxiswaste@urlhost.gr';                   
$mail_smtp_pass      = '100lobbe#';                
$mail_from           = 'etaxiswaste@urlhost.gr';  
$mail_format         = 'H';                       
$mail_copies         = '';                        
$mail_tp_copies      = '';                        
$mail_port           = '465';                     
$mail_tp_connection  = 'S';                       


$mail_subject        = 'Nέο εντύπο προς διαχείρηση απο ' .$this->sc_temp_TitleName;  

if ($this->wtproducerbranchid <>0) 
	{
$mail_to  = $this->premail ;        
	
$mail_subject        = 'Nέο εντύπο προς διαχείρηση απο ' .$this->sc_temp_TitleName;  
$msg = "<table border='1' bordercolor='#CCCCCC' cellpadding='5' cellspacing='0' width='600' height='260' style='border-collapse:collapse'>";
$msg .= "<tr>";
$msg .= "<td valign='top' style=' margin:0;'>";
$msg .= "<p>";
$msg .= "<b><font size='4' face='Verdana, Arial, Helvetica, sans-serif' color='#fe5800'> Η καταχώρηση με αριθμό ($this->wtid ) επιβεβαιώθηκε για τον εκδότη </font></b>";
$msg .= "<b><font size='3' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $TitleName </font></b>";
$msg .= "<br/>";
$msg .= "<br>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Ημερομηνία έκδοσης:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->wtrequestdate <font></b>";
$msg .= "<br>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Εγκατάσταση παραγωγού:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $ProducerName<font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Διεύθυνση εγκατάστασης:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->producerb_address <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία υπευθύνου:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->prbrresponse <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία επικοινωνίας:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->pphone <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Email:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->premail <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Κωδικός αποβλήτου:</font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->wtproducerewc  $this->ewctitle <font></b>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Κωδικός ταυτοποιησης</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->wtproducervalidate <font></b>";	


$msg .= "<br/>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Ημερομηνία μεταφοράς:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wttransportdate <font></b>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Μεταφορέας:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> // 
$TransporterName<font></b>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Οχημα μεταφοράς:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wttransportervechicle <font></b>";	
	
	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Υπεύθυνος μεταφοράς:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->transporterresponse <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Email υπευθύνου:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->transporteremail <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία επικοινωνίας:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->transporterphone  Fax : $this->transporterfax <font></b>";
	

$msg .= "<br/>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Ημερομηνία παραλαβής</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtfdestdate <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Εγκατάσταση παραλαβής</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $FDestTitle<font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Διεύθυνση εγκατάστασης</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestaddress <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Υπεύθυνος εγκατάστασης</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestrespone <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία επικοινωνίας</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestphone <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Email:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestresponseemail <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Κωδικός αποβλήτου παραλαβής/διαχείρησης:</font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtfdestewc -$this->fdewctitle -$this->wtfdestrd <font></b>";
$msg .= "<br/>";	
$msg .= "<br/>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Γενικά σχόλια εντύπου:</font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtproducerremarks <font></b>";

$msg .= "</p>";
$msg .= "</td>";
$msg .= "</tr>";
$msg .= "<tr>";
$msg .= "</tr>";
$msg .= "</table>";	
	
	
	
	
    include_once($this->Ini->path_third . "/swift/swift_required.php");
    $sc_mail_port     = "$mail_port";
    $sc_mail_tp_port  = "$mail_tp_connection";
    $sc_mail_tp_mens  = "$mail_format";
    $sc_mail_tp_copy  = "$mail_tp_copies";
    $this->sc_mail_count = 0;
    $this->sc_mail_erro  = "";
    $this->sc_mail_ok    = true;
    if ($sc_mail_tp_port == "S" || $sc_mail_tp_port == "Y")
    {
        $sc_mail_port = (!empty($sc_mail_port)) ? $sc_mail_port : 465;
        $Con_Mail = Swift_SmtpTransport::newInstance($mail_smtp_server, $sc_mail_port, 'ssl');
    }
    elseif ($sc_mail_tp_port == "T")
    {
        $sc_mail_port = !empty($sc_mail_port) ? $sc_mail_port : 587;
        $Con_Mail = Swift_SmtpTransport::newInstance($mail_smtp_server, $sc_mail_port, 'tls');
    }
    else
    {
        $sc_mail_port = (!empty($sc_mail_port)) ? $sc_mail_port : 25;
        $Con_Mail = Swift_SmtpTransport::newInstance($mail_smtp_server, $sc_mail_port);
    }
    $Con_Mail->setUsername($mail_smtp_user);
    $Con_Mail->setpassword($mail_smtp_pass);
    $Send_Mail = Swift_Mailer::newInstance($Con_Mail);
    if ($sc_mail_tp_mens == "H")
    {
        $Mens_Mail = Swift_Message::newInstance($mail_subject);
        $Mens_Mail->setBody(SC_Mail_Image($msg, $Mens_Mail))->setContentType("text/html");
    }
    else
    {
        $Mens_Mail = Swift_Message::newInstance($mail_subject)->setBody($msg);
    }
    if (!empty($_SESSION['scriptcase']['charset']))
    {
        $Mens_Mail->setCharset($_SESSION['scriptcase']['charset']);
    }
    $Temp_mail = $mail_to;
    if (!is_array($Temp_mail))
    {
        $Temp_mail = explode(";", $mail_to);
    }
    foreach ($Temp_mail as $NM_dest)
    {
        if (!empty($NM_dest))
        {
            $Arr_addr = SC_Mail_Address($NM_dest);
            $Mens_Mail->addTo($Arr_addr[0], $Arr_addr[1]);
        }
    }
    $Temp_mail = $mail_copies;
    if (!is_array($Temp_mail))
    {
        $Temp_mail = explode(";", $mail_copies);
    }
    foreach ($Temp_mail as $NM_dest)
    {
        if (!empty($NM_dest))
        {
            $Arr_addr = SC_Mail_Address($NM_dest);
            if (strtoupper(substr($sc_mail_tp_copy, 0, 2)) == "CC")
            {
                $Mens_Mail->addCc($Arr_addr[0], $Arr_addr[1]);
            }
            else
            {
                $Mens_Mail->addBcc($Arr_addr[0], $Arr_addr[1]);
            }
        }
    }
    $Arr_addr = SC_Mail_Address($mail_from);
    $this->sc_mail_count = $Send_Mail->send($Mens_Mail->setFrom($Arr_addr[0], $Arr_addr[1]), $Err_mail);
    if (!empty($Err_mail))
    {
        $this->sc_mail_erro = $Err_mail;
        $this->sc_mail_ok   = false;
    }
;

if ($this->sc_mail_ok ) {

echo "<script>alert('Το μύνημα στάλθηκε με επιτυχία!');</script>";
} else {

 if (!isset($this->Campos_Mens_erro)){$this->Campos_Mens_erro = "";}
 if (!empty($this->Campos_Mens_erro)){$this->Campos_Mens_erro .= "<br>";}$this->Campos_Mens_erro .= "There was a problem in sending! Please contact the System
Administrator through telephone (xx) xxxx-xxxx.";
 if ('submit_form' == $this->NM_ajax_opcao || 'event_' == substr($this->NM_ajax_opcao, 0, 6))
 {
  $sErrorIndex = ('submit_form' == $this->NM_ajax_opcao) ? 'geral_validate_wastetransactions_mob' : substr(substr($this->NM_ajax_opcao, 0, strrpos($this->NM_ajax_opcao, '_')), 6);
  $this->NM_ajax_info['errList'][$sErrorIndex][] = "There was a problem in sending! Please contact the System
Administrator through telephone (xx) xxxx-xxxx.";
 }
;
}
}
if ($this->wttransporterid <>0) 
	{
$mail_to  = $this->transporteremail ;        
	$mail_subject        = 'Nέο εντύπο προς διαχείρηση απο ' .$this->sc_temp_TitleName;  
$msg = "<table border='1' bordercolor='#CCCCCC' cellpadding='5' cellspacing='0' width='600' height='260' style='border-collapse:collapse'>";
$msg .= "<tr>";
$msg .= "<td valign='top' style=' margin:0;'>";
$msg .= "<p>";
$msg .= "<b><font size='4' face='Verdana, Arial, Helvetica, sans-serif' color='#fe5800'> Η καταχώρηση με αριθμό ($this->wtid ) επιβεβαιώθηκε για τον εκδότη </font></b>";
$msg .= "<b><font size='3' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $TitleName </font></b>";
$msg .= "<br/>";
$msg .= "<br>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Ημερομηνία έκδοσης:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->wtrequestdate <font></b>";
$msg .= "<br>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Εγκατάσταση παραγωγού:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $ProducerName<font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Διεύθυνση εγκατάστασης:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->producerb_address <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία υπευθύνου:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->prbrresponse <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία επικοινωνίας:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->pphone <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Email:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->premail <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Κωδικός αποβλήτου:</font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->wtproducerewc  $this->ewctitle <font></b>";	
$msg .= "<br/>";


$msg .= "<br/>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Ημερομηνία μεταφοράς:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wttransportdate <font></b>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Μεταφορέας:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> // 
$TransporterName<font></b>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Οχημα μεταφοράς:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wttransportervechicle <font></b>";	
	
	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Υπεύθυνος μεταφοράς:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->transporterresponse <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Email υπευθύνου:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->transporteremail <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία επικοινωνίας:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->transporterphone  Fax : $this->transporterfax <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Κωδικός ταυτοποίησης:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->wttransportervalidateip <font></b>";	

$msg .= "<br/>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Ημερομηνία παραλαβής</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtfdestdate <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Εγκατάσταση παραλαβής</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $FDestTitle<font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Διεύθυνση εγκατάστασης</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestaddress <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Υπεύθυνος εγκατάστασης</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestrespone <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία επικοινωνίας</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestphone <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Email:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestresponseemail <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Κωδικός αποβλήτου παραλαβής/διαχείρησης:</font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtfdestewc -$this->fdewctitle -$this->wtfdestrd <font></b>";
$msg .= "<br/>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Γενικά σχόλια εντύπου:</font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtproducerremarks <font></b>";

$msg .= "</p>";
$msg .= "</td>";
$msg .= "</tr>";
$msg .= "<tr>";
$msg .= "</tr>";
$msg .= "</table>";
    include_once($this->Ini->path_third . "/swift/swift_required.php");
    $sc_mail_port     = "$mail_port";
    $sc_mail_tp_port  = "$mail_tp_connection";
    $sc_mail_tp_mens  = "$mail_format";
    $sc_mail_tp_copy  = "$mail_tp_copies";
    $this->sc_mail_count = 0;
    $this->sc_mail_erro  = "";
    $this->sc_mail_ok    = true;
    if ($sc_mail_tp_port == "S" || $sc_mail_tp_port == "Y")
    {
        $sc_mail_port = (!empty($sc_mail_port)) ? $sc_mail_port : 465;
        $Con_Mail = Swift_SmtpTransport::newInstance($mail_smtp_server, $sc_mail_port, 'ssl');
    }
    elseif ($sc_mail_tp_port == "T")
    {
        $sc_mail_port = !empty($sc_mail_port) ? $sc_mail_port : 587;
        $Con_Mail = Swift_SmtpTransport::newInstance($mail_smtp_server, $sc_mail_port, 'tls');
    }
    else
    {
        $sc_mail_port = (!empty($sc_mail_port)) ? $sc_mail_port : 25;
        $Con_Mail = Swift_SmtpTransport::newInstance($mail_smtp_server, $sc_mail_port);
    }
    $Con_Mail->setUsername($mail_smtp_user);
    $Con_Mail->setpassword($mail_smtp_pass);
    $Send_Mail = Swift_Mailer::newInstance($Con_Mail);
    if ($sc_mail_tp_mens == "H")
    {
        $Mens_Mail = Swift_Message::newInstance($mail_subject);
        $Mens_Mail->setBody(SC_Mail_Image($msg, $Mens_Mail))->setContentType("text/html");
    }
    else
    {
        $Mens_Mail = Swift_Message::newInstance($mail_subject)->setBody($msg);
    }
    if (!empty($_SESSION['scriptcase']['charset']))
    {
        $Mens_Mail->setCharset($_SESSION['scriptcase']['charset']);
    }
    $Temp_mail = $mail_to;
    if (!is_array($Temp_mail))
    {
        $Temp_mail = explode(";", $mail_to);
    }
    foreach ($Temp_mail as $NM_dest)
    {
        if (!empty($NM_dest))
        {
            $Arr_addr = SC_Mail_Address($NM_dest);
            $Mens_Mail->addTo($Arr_addr[0], $Arr_addr[1]);
        }
    }
    $Temp_mail = $mail_copies;
    if (!is_array($Temp_mail))
    {
        $Temp_mail = explode(";", $mail_copies);
    }
    foreach ($Temp_mail as $NM_dest)
    {
        if (!empty($NM_dest))
        {
            $Arr_addr = SC_Mail_Address($NM_dest);
            if (strtoupper(substr($sc_mail_tp_copy, 0, 2)) == "CC")
            {
                $Mens_Mail->addCc($Arr_addr[0], $Arr_addr[1]);
            }
            else
            {
                $Mens_Mail->addBcc($Arr_addr[0], $Arr_addr[1]);
            }
        }
    }
    $Arr_addr = SC_Mail_Address($mail_from);
    $this->sc_mail_count = $Send_Mail->send($Mens_Mail->setFrom($Arr_addr[0], $Arr_addr[1]), $Err_mail);
    if (!empty($Err_mail))
    {
        $this->sc_mail_erro = $Err_mail;
        $this->sc_mail_ok   = false;
    }
;

if ($this->sc_mail_ok ) {

echo "<script>alert('Το μύνημα στάλθηκε με επιτυχία!');</script>";
} else {

 if (!isset($this->Campos_Mens_erro)){$this->Campos_Mens_erro = "";}
 if (!empty($this->Campos_Mens_erro)){$this->Campos_Mens_erro .= "<br>";}$this->Campos_Mens_erro .= "There was a problem in sending! Please contact the System
Administrator through telephone (xx) xxxx-xxxx.";
 if ('submit_form' == $this->NM_ajax_opcao || 'event_' == substr($this->NM_ajax_opcao, 0, 6))
 {
  $sErrorIndex = ('submit_form' == $this->NM_ajax_opcao) ? 'geral_validate_wastetransactions_mob' : substr(substr($this->NM_ajax_opcao, 0, strrpos($this->NM_ajax_opcao, '_')), 6);
  $this->NM_ajax_info['errList'][$sErrorIndex][] = "There was a problem in sending! Please contact the System
Administrator through telephone (xx) xxxx-xxxx.";
 }
;
}
}
if ($this->wtfdestid <>0) 
	{
$mail_to  = $this->fdestresponseemail ;        
	$mail_subject        = 'Nέο εντύπο προς διαχείρηση απο ' .$this->sc_temp_TitleName;  
$msg = "<table border='1' bordercolor='#CCCCCC' cellpadding='5' cellspacing='0' width='600' height='260' style='border-collapse:collapse'>";
$msg .= "<tr>";
$msg .= "<td valign='top' style=' margin:0;'>";
$msg .= "<p>";
$msg .= "<b><font size='4' face='Verdana, Arial, Helvetica, sans-serif' color='#fe5800'> Η καταχώρηση με αριθμό ($this->wtid ) επιβεβαιώθηκε για τον εκδότη </font></b>";
$msg .= "<b><font size='3' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $TitleName </font></b>";
$msg .= "<br/>";
$msg .= "<br>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Ημερομηνία έκδοσης:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->wtrequestdate <font></b>";
$msg .= "<br>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Εγκατάσταση παραγωγού:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $ProducerName<font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Διεύθυνση εγκατάστασης:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->producerb_address <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία υπευθύνου:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->prbrresponse <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία επικοινωνίας:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->pphone <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Email:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->premail <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Κωδικός αποβλήτου:</font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80ca'> $this->wtproducerewc  $this->ewctitle <font></b>";	
$msg .= "<br/>";

$msg .= "<br/>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Ημερομηνία μεταφοράς:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wttransportdate <font></b>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Μεταφορέας:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> // 
$TransporterName<font></b>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Οχημα μεταφοράς:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wttransportervechicle <font></b>";	
	
	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Υπεύθυνος μεταφοράς:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->transporterresponse <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Email υπευθύνου:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->transporteremail <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία επικοινωνίας:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->transporterphone  Fax : $this->transporterfax <font></b>";


$msg .= "<br/>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Ημερομηνία παραλαβής</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtfdestdate <font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Εγκατάσταση παραλαβής</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $FDestTitle<font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Διεύθυνση εγκατάστασης</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestaddress <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Υπεύθυνος εγκατάστασης</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestrespone <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Στοιχεία επικοινωνίας</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestphone <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Email:</font></b>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->fdestresponseemail <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Κωδικός αποβλήτου παραλαβής/διαχείρησης:</font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtfdestewc -$this->fdewctitle -$this->wtfdestrd <font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Κωδικός ταυτοποίησης:</font></b>";
$msg .= "<br/>";
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtfdestvalidateip <font></b>";
$msg .= "<br/>";	
$msg .= "<br/>";
$msg .= "<b><font size='3' face='Georgia, Times New Roman, Times, serif' color='#fe5800'>Γενικά σχόλια εντύπου:</font></b>";
$msg .= "<br/>";	
$msg .= "<b><font size='2' face='Verdana, Arial, Helvetica, sans-serif' color='#4a80cb'> $this->wtproducerremarks <font></b>";

$msg .= "</p>";
$msg .= "</td>";
$msg .= "</tr>";
$msg .= "<tr>";
$msg .= "</tr>";
$msg .= "</table>";
    include_once($this->Ini->path_third . "/swift/swift_required.php");
    $sc_mail_port     = "$mail_port";
    $sc_mail_tp_port  = "$mail_tp_connection";
    $sc_mail_tp_mens  = "$mail_format";
    $sc_mail_tp_copy  = "$mail_tp_copies";
    $this->sc_mail_count = 0;
    $this->sc_mail_erro  = "";
    $this->sc_mail_ok    = true;
    if ($sc_mail_tp_port == "S" || $sc_mail_tp_port == "Y")
    {
        $sc_mail_port = (!empty($sc_mail_port)) ? $sc_mail_port : 465;
        $Con_Mail = Swift_SmtpTransport::newInstance($mail_smtp_server, $sc_mail_port, 'ssl');
    }
    elseif ($sc_mail_tp_port == "T")
    {
        $sc_mail_port = !empty($sc_mail_port) ? $sc_mail_port : 587;
        $Con_Mail = Swift_SmtpTransport::newInstance($mail_smtp_server, $sc_mail_port, 'tls');
    }
    else
    {
        $sc_mail_port = (!empty($sc_mail_port)) ? $sc_mail_port : 25;
        $Con_Mail = Swift_SmtpTransport::newInstance($mail_smtp_server, $sc_mail_port);
    }
    $Con_Mail->setUsername($mail_smtp_user);
    $Con_Mail->setpassword($mail_smtp_pass);
    $Send_Mail = Swift_Mailer::newInstance($Con_Mail);
    if ($sc_mail_tp_mens == "H")
    {
        $Mens_Mail = Swift_Message::newInstance($mail_subject);
        $Mens_Mail->setBody(SC_Mail_Image($msg, $Mens_Mail))->setContentType("text/html");
    }
    else
    {
        $Mens_Mail = Swift_Message::newInstance($mail_subject)->setBody($msg);
    }
    if (!empty($_SESSION['scriptcase']['charset']))
    {
        $Mens_Mail->setCharset($_SESSION['scriptcase']['charset']);
    }
    $Temp_mail = $mail_to;
    if (!is_array($Temp_mail))
    {
        $Temp_mail = explode(";", $mail_to);
    }
    foreach ($Temp_mail as $NM_dest)
    {
        if (!empty($NM_dest))
        {
            $Arr_addr = SC_Mail_Address($NM_dest);
            $Mens_Mail->addTo($Arr_addr[0], $Arr_addr[1]);
        }
    }
    $Temp_mail = $mail_copies;
    if (!is_array($Temp_mail))
    {
        $Temp_mail = explode(";", $mail_copies);
    }
    foreach ($Temp_mail as $NM_dest)
    {
        if (!empty($NM_dest))
        {
            $Arr_addr = SC_Mail_Address($NM_dest);
            if (strtoupper(substr($sc_mail_tp_copy, 0, 2)) == "CC")
            {
                $Mens_Mail->addCc($Arr_addr[0], $Arr_addr[1]);
            }
            else
            {
                $Mens_Mail->addBcc($Arr_addr[0], $Arr_addr[1]);
            }
        }
    }
    $Arr_addr = SC_Mail_Address($mail_from);
    $this->sc_mail_count = $Send_Mail->send($Mens_Mail->setFrom($Arr_addr[0], $Arr_addr[1]), $Err_mail);
    if (!empty($Err_mail))
    {
        $this->sc_mail_erro = $Err_mail;
        $this->sc_mail_ok   = false;
    }
;

if ($this->sc_mail_ok ) {

echo "<script>alert('Το μύνημα στάλθηκε με επιτυχία!');</script>";
} else {

 if (!isset($this->Campos_Mens_erro)){$this->Campos_Mens_erro = "";}
 if (!empty($this->Campos_Mens_erro)){$this->Campos_Mens_erro .= "<br>";}$this->Campos_Mens_erro .= "There was a problem in sending! Please contact the System
Administrator through telephone (xx) xxxx-xxxx.";
 if ('submit_form' == $this->NM_ajax_opcao || 'event_' == substr($this->NM_ajax_opcao, 0, 6))
 {
  $sErrorIndex = ('submit_form' == $this->NM_ajax_opcao) ? 'geral_validate_wastetransactions_mob' : substr(substr($this->NM_ajax_opcao, 0, strrpos($this->NM_ajax_opcao, '_')), 6);
  $this->NM_ajax_info['errList'][$sErrorIndex][] = "There was a problem in sending! Please contact the System
Administrator through telephone (xx) xxxx-xxxx.";
 }
;
}
}
if (isset($this->sc_temp_TitleName)) { $_SESSION['TitleName'] = $this->sc_temp_TitleName;}
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'off'; 
    }
      if (!empty($this->Campos_Mens_erro)) 
      {
          $this->Erro->mensagem(__FILE__, __LINE__, "critica", $this->Campos_Mens_erro); 
          $this->Campos_Mens_erro = ""; 
          $this->nmgp_opc_ant = $salva_opcao ; 
          if ($salva_opcao == "incluir") 
          { 
              $GLOBALS["erro_incl"] = 1; 
          }
          if ($this->nmgp_opcao == "alterar" || $this->nmgp_opcao == "incluir" || $this->nmgp_opcao == "excluir") 
          {
              $this->nmgp_opcao = "nada"; 
          } 
          $this->sc_evento = ""; 
          $this->NM_rollback_db(); 
          return; 
      }
   if ($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['decimal_db'] == ",")
   {
       $this->nm_troca_decimal(".", ",");
   }
      if ($salva_opcao == "incluir" && $GLOBALS["erro_incl"] != 1) 
      { 
          $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['parms'] = "wtid?#?$this->wtid?@?"; 
      }
      $this->nmgp_dados_form[wttransportersign] = ""; 
      $this->wttransportersign_limpa = ""; 
      $this->wttransportersign_salva = ""; 
      $this->nmgp_dados_form[wtproducersign] = ""; 
      $this->wtproducersign_limpa = ""; 
      $this->wtproducersign_salva = ""; 
      $this->nmgp_dados_form[wtfdestsign] = ""; 
      $this->wtfdestsign_limpa = ""; 
      $this->wtfdestsign_salva = ""; 
      $this->NM_commit_db(); 
      if ($this->sc_evento != "insert" && $this->sc_evento != "update" && $this->sc_evento != "delete")
      { 
          $this->wtid = substr($this->Db->qstr($this->wtid), 1, -1); 
      } 
      if (isset($this->NM_where_filter))
      {
          $this->NM_where_filter = str_replace("@percent@", "%", $this->NM_where_filter);
          $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_filter'] = trim($this->NM_where_filter);
          if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['total']))
          {
              unset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['total']);
          }
      }
      $sc_where_filter = '';
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_filter_form']) && '' != $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_filter_form'])
      {
          $sc_where_filter = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_filter_form'];
      }
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_filter']) && '' != $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_filter'])
      {
          if (empty($sc_where_filter))
          {
              $sc_where_filter = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_filter'];
          }
          else
          {
              $sc_where_filter .= " and (" . $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_filter'] . ")";
          }
      }
      if ($this->nmgp_opcao != "novo" && $this->nmgp_opcao != "nada" && $this->nmgp_opcao != "inicio")
      { 
          $this->nmgp_opcao = "igual"; 
      } 
      $GLOBALS["NM_ERRO_IBASE"] = 0;  
//---------- 
      if ($this->nmgp_opcao != "novo" && $this->nmgp_opcao != "nada" && $this->nmgp_opcao != "refresh_insert") 
      { 
          $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['parms'] = ""; 
          $nmgp_select = "SELECT wtid, wtProfilID, INTNUMBER, wtRequestDate, wtProducerBranchID, wtProducerPeriferia, wtProducerAcceptWeigth, wtProducerEwc, wtProducerQty, wtPrducerm3, wtProducerRemarks, wtTransportDate, wtProducerValidate, wtTransporterID, wtTransporterPeriferiaID, wtTransporterEWC, wtTransporterVechicle, wtTransporterValidate, wtTransporterValidateIP, EnvRegistrationNo_Transporter, wtTransporterNumberID, wtWasteID, wtequipment, wtFdestDate, wtFDestID, wtFDestPeriferia, wtFDestEWC, wtFDestRD, wtFDestQty, wtFDestM3, wtFDestVlidated, wtFDestValidateIP, EnvRegistrationNo_FDest, wtTransporterSign, wtProducerSign, wtFDestSign from " . $this->Ini->nm_tabela ; 
          $aWhere = array();
          $aWhere[] = "wtid = " . $_SESSION['glo_wtid'] . " AND wtProfilID = " . $_SESSION['ProfilID'] . "";
          $aWhere[] = $sc_where_filter;
          if ($this->nmgp_opcao == "igual" || (($_SESSION['sc_session'][$this->Ini->sc_page]['form_adm_clientes']['run_iframe'] == "F" || $_SESSION['sc_session'][$this->Ini->sc_page]['form_adm_clientes']['run_iframe'] == "R") && ($this->sc_evento == "insert" || $this->sc_evento == "update")) )
          { 
              if (!empty($sc_where))
              {
                 $aWhere[] = "wtid = $this->wtid"; 
              } 
          } 
          $nmgp_select .= $this->returnWhere($aWhere) . ' ';
          $sc_order_by = "";
          $sc_order_by = "wtid";
          $sc_order_by = str_replace("order by ", "", $sc_order_by);
          $sc_order_by = str_replace("ORDER BY ", "", trim($sc_order_by));
          if (!empty($sc_order_by))
          {
              $nmgp_select .= " order by $sc_order_by "; 
          }
          if ($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['run_iframe'] == "F" || $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['run_iframe'] == "R")
          {
              if ($this->sc_evento == "insert" || $this->sc_evento == "update")
              {
                  $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['select'] = $nmgp_select;
                  $this->nm_gera_html();
              } 
              elseif (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['select']))
              { 
                  $nmgp_select = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['select'];
                  $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['select'] = ""; 
              } 
          } 
          if ($this->nmgp_opcao == "igual") 
          { 
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nmgp_select; 
              $rs = $this->Db->Execute($nmgp_select) ; 
          } 
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
          { 
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "SelectLimit($nmgp_select, 1, " . $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['reg_start'] . ")" ; 
              $rs = $this->Db->SelectLimit($nmgp_select, 1, $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['reg_start']) ; 
          } 
          else  
          { 
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nmgp_select; 
              $rs = $this->Db->Execute($nmgp_select) ; 
              if (!$rs === false && !$rs->EOF) 
              { 
                  $rs->Move($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['reg_start']) ;  
              } 
          } 
          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 ; 
          }  
          if ($rs === false && $GLOBALS["NM_ERRO_IBASE"] == 1) 
          { 
              $GLOBALS["NM_ERRO_IBASE"] = 0; 
              $this->Erro->mensagem (__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_nfnd_extr'], $this->Db->ErrorMsg()); 
              exit ; 
          }  
          if ($rs->EOF) 
          { 
              if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_filter']))
              {
                  $this->nmgp_form_empty        = true;
                  $this->nmgp_botoes['first']   = "off";
                  $this->nmgp_botoes['back']    = "off";
                  $this->nmgp_botoes['forward'] = "off";
                  $this->nmgp_botoes['last']    = "off";
                  $this->nmgp_botoes['update']  = "off";
                  $this->nmgp_botoes['delete']  = "off";
                  $this->nmgp_botoes['insert']  = "off";
                  $this->nmgp_botoes['sc_btn_0'] = "off";
                  $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['empty_filter'] = true;
                  return; 
              }
              if ($this->nmgp_botoes['insert'] != "on")
              {
                  $this->nmgp_form_empty        = true;
                  $this->nmgp_botoes['first']   = "off";
                  $this->nmgp_botoes['back']    = "off";
                  $this->nmgp_botoes['forward'] = "off";
                  $this->nmgp_botoes['last']    = "off";
              }
              $this->nmgp_opcao = "novo"; 
              $this->nm_flag_saida_novo = "S"; 
              $rs->Close(); 
              $this->nmgp_botoes['sc_btn_0'] = "off";
              if ($this->aba_iframe)
              {
                  $this->nmgp_botoes['exit'] = 'off';
              }
          } 
          if ($rs === false && $GLOBALS["NM_ERRO_IBASE"] == 1) 
          { 
              $GLOBALS["NM_ERRO_IBASE"] = 0; 
              $this->Erro->mensagem (__FILE__, __LINE__, "critica", $this->Ini->Nm_lang['lang_errm_nfnd_extr']); 
              $this->nmgp_opcao = "novo"; 
          }  
          if ($this->nmgp_opcao != "novo") 
          { 
              $this->wtid = $rs->fields[0] ; 
              $this->nmgp_dados_select['wtid'] = $this->wtid;
              $this->wtprofilid = $rs->fields[1] ; 
              $this->nmgp_dados_select['wtprofilid'] = $this->wtprofilid;
              $this->intnumber = $rs->fields[2] ; 
              $this->nmgp_dados_select['intnumber'] = $this->intnumber;
              $this->wtrequestdate = $rs->fields[3] ; 
              $this->nmgp_dados_select['wtrequestdate'] = $this->wtrequestdate;
              $this->wtproducerbranchid = $rs->fields[4] ; 
              $this->nmgp_dados_select['wtproducerbranchid'] = $this->wtproducerbranchid;
              $this->wtproducerperiferia = $rs->fields[5] ; 
              $this->nmgp_dados_select['wtproducerperiferia'] = $this->wtproducerperiferia;
              $this->wtproduceracceptweigth = $rs->fields[6] ; 
              $this->nmgp_dados_select['wtproduceracceptweigth'] = $this->wtproduceracceptweigth;
              $this->wtproducerewc = $rs->fields[7] ; 
              $this->nmgp_dados_select['wtproducerewc'] = $this->wtproducerewc;
              $this->wtproducerqty = $rs->fields[8] ; 
              $this->nmgp_dados_select['wtproducerqty'] = $this->wtproducerqty;
              $this->wtprducerm3 = $rs->fields[9] ; 
              $this->nmgp_dados_select['wtprducerm3'] = $this->wtprducerm3;
              $this->wtproducerremarks = $rs->fields[10] ; 
              $this->nmgp_dados_select['wtproducerremarks'] = $this->wtproducerremarks;
              $this->wttransportdate = $rs->fields[11] ; 
              $this->nmgp_dados_select['wttransportdate'] = $this->wttransportdate;
              $this->wtproducervalidate = $rs->fields[12] ; 
              $this->nmgp_dados_select['wtproducervalidate'] = $this->wtproducervalidate;
              $this->wttransporterid = $rs->fields[13] ; 
              $this->nmgp_dados_select['wttransporterid'] = $this->wttransporterid;
              $this->wttransporterperiferiaid = $rs->fields[14] ; 
              $this->nmgp_dados_select['wttransporterperiferiaid'] = $this->wttransporterperiferiaid;
              $this->wttransporterewc = $rs->fields[15] ; 
              $this->nmgp_dados_select['wttransporterewc'] = $this->wttransporterewc;
              $this->wttransportervechicle = $rs->fields[16] ; 
              $this->nmgp_dados_select['wttransportervechicle'] = $this->wttransportervechicle;
              $this->wttransportervalidate = $rs->fields[17] ; 
              $this->nmgp_dados_select['wttransportervalidate'] = $this->wttransportervalidate;
              $this->wttransportervalidateip = $rs->fields[18] ; 
              $this->nmgp_dados_select['wttransportervalidateip'] = $this->wttransportervalidateip;
              $this->envregistrationno_transporter = $rs->fields[19] ; 
              $this->nmgp_dados_select['envregistrationno_transporter'] = $this->envregistrationno_transporter;
              $this->wttransporternumberid = $rs->fields[20] ; 
              $this->nmgp_dados_select['wttransporternumberid'] = $this->wttransporternumberid;
              $this->wtwasteid = $rs->fields[21] ; 
              $this->nmgp_dados_select['wtwasteid'] = $this->wtwasteid;
              $this->wtequipment = $rs->fields[22] ; 
              $this->nmgp_dados_select['wtequipment'] = $this->wtequipment;
              $this->wtfdestdate = $rs->fields[23] ; 
              $this->nmgp_dados_select['wtfdestdate'] = $this->wtfdestdate;
              $this->wtfdestid = $rs->fields[24] ; 
              $this->nmgp_dados_select['wtfdestid'] = $this->wtfdestid;
              $this->wtfdestperiferia = $rs->fields[25] ; 
              $this->nmgp_dados_select['wtfdestperiferia'] = $this->wtfdestperiferia;
              $this->wtfdestewc = $rs->fields[26] ; 
              $this->nmgp_dados_select['wtfdestewc'] = $this->wtfdestewc;
              $this->wtfdestrd = $rs->fields[27] ; 
              $this->nmgp_dados_select['wtfdestrd'] = $this->wtfdestrd;
              $this->wtfdestqty = $rs->fields[28] ; 
              $this->nmgp_dados_select['wtfdestqty'] = $this->wtfdestqty;
              $this->wtfdestm3 = $rs->fields[29] ; 
              $this->nmgp_dados_select['wtfdestm3'] = $this->wtfdestm3;
              $this->wtfdestvlidated = $rs->fields[30] ; 
              $this->nmgp_dados_select['wtfdestvlidated'] = $this->wtfdestvlidated;
              $this->wtfdestvalidateip = $rs->fields[31] ; 
              $this->nmgp_dados_select['wtfdestvalidateip'] = $this->wtfdestvalidateip;
              $this->envregistrationno_fdest = $rs->fields[32] ; 
              $this->nmgp_dados_select['envregistrationno_fdest'] = $this->envregistrationno_fdest;
              $this->wttransportersign = $rs->fields[33] ; 
              $this->nmgp_dados_select['wttransportersign'] = $this->wttransportersign;
              $this->wtproducersign = $rs->fields[34] ; 
              $this->nmgp_dados_select['wtproducersign'] = $this->wtproducersign;
              $this->wtfdestsign = $rs->fields[35] ; 
              $this->nmgp_dados_select['wtfdestsign'] = $this->wtfdestsign;
          $GLOBALS["NM_ERRO_IBASE"] = 0; 
              $this->nm_troca_decimal(",", ".");
              $this->wtid = (string)$this->wtid; 
              $this->wtprofilid = (string)$this->wtprofilid; 
              $this->intnumber = (string)$this->intnumber; 
              $this->wtproducerbranchid = (string)$this->wtproducerbranchid; 
              $this->wtproducerperiferia = (string)$this->wtproducerperiferia; 
              $this->wtproduceracceptweigth = (string)$this->wtproduceracceptweigth; 
              $this->wtproducerqty = (string)$this->wtproducerqty; 
              $this->wtprducerm3 = (string)$this->wtprducerm3; 
              $this->wttransporterid = (string)$this->wttransporterid; 
              $this->wttransporterperiferiaid = (string)$this->wttransporterperiferiaid; 
              $this->wttransportervalidate = (string)$this->wttransportervalidate; 
              $this->wtwasteid = (string)$this->wtwasteid; 
              $this->wtequipment = (string)$this->wtequipment; 
              $this->wtfdestid = (string)$this->wtfdestid; 
              $this->wtfdestperiferia = (string)$this->wtfdestperiferia; 
              $this->wtfdestqty = (string)$this->wtfdestqty; 
              $this->wtfdestm3 = (string)$this->wtfdestm3; 
              $this->wtfdestvlidated = (string)$this->wtfdestvlidated; 
              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['parms'] = "wtid?#?$this->wtid?@?";
              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['sub_dir'][0]  = "";
              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['sub_dir'][1]  = "";
              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['sub_dir'][2]  = "";
          } 
          $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_select'] = $this->nmgp_dados_select;
          if (!$this->NM_ajax_flag || 'backup_line' != $this->NM_ajax_opcao)
          {
              $this->Nav_permite_ret = 0 != $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['reg_start'];
              $this->Nav_permite_ava = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['reg_start'] < $qt_geral_reg_validate_wastetransactions_mob;
              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['opcao']   = '';
          }
      } 
      if ($this->nmgp_opcao == "novo" || $this->nmgp_opcao == "refresh_insert") 
      { 
          $this->sc_evento_old = $this->sc_evento;
          $this->sc_evento = "novo";
          if ('refresh_insert' == $this->nmgp_opcao)
          {
              $this->nmgp_opcao = 'novo';
          }
          else
          {
              $this->nm_formatar_campos();
              $this->wtid = "" ;  
              $this->wtprofilid = "" . $_SESSION['ProfilID'] . "" ;  
              $this->intnumber = "" ;  
              $this->wtrequestdate =  date('Y') . "-" . date('m')  . "-" . date('d');
              $this->wtproducerbranchid = "0" ;  
              $this->wtproducerperiferia = "" ;  
              $this->wtproduceracceptweigth = "" ;  
              $this->wtproducerewc = "" ;  
              $this->wtproducerqty = "0" ;  
              $this->wtprducerm3 = "" ;  
              $this->wtproducerremarks = "" ;  
              $this->wttransportdate = "" ;  
              $this->wttransportdate_hora = "" ;  
              $this->wtproducervalidate = "" ;  
              $this->wttransporterid = "0" ;  
              $this->wttransporterperiferiaid = "" ;  
              $this->wttransporterewc = "" ;  
              $this->wttransportervechicle = "" ;  
              $this->wttransportervalidate = "" ;  
              $this->wttransportervalidateip = "" ;  
              $this->envregistrationno_transporter = "" ;  
              $this->wttransporternumberid = "" ;  
              $this->wtwasteid = "" ;  
              $this->wtequipment = "" ;  
              $this->wtfdestdate = "" ;  
              $this->wtfdestdate_hora = "" ;  
              $this->wtfdestid = "0" ;  
              $this->wtfdestperiferia = "" ;  
              $this->wtfdestewc = "" ;  
              $this->wtfdestrd = "" ;  
              $this->wtfdestqty = "0" ;  
              $this->wtfdestm3 = "" ;  
              $this->wtfdestvlidated = "" ;  
              $this->wtfdestvalidateip = "" ;  
              $this->envregistrationno_fdest = "" ;  
              $this->wttransportersign = "" ;  
              $this->wttransportersign_ul_name = "" ;  
              $this->wttransportersign_ul_type = "" ;  
              $this->wtproducersign = "" ;  
              $this->wtproducersign_ul_name = "" ;  
              $this->wtproducersign_ul_type = "" ;  
              $this->wtfdestsign = "" ;  
              $this->wtfdestsign_ul_name = "" ;  
              $this->wtfdestsign_ul_type = "" ;  
              $this->checktransvsproducer = "" ;  
              $this->checktransportervsfdest = "" ;  
              $this->ewctitle = "" ;  
              $this->fdewctitle = "" ;  
              $this->fdestaddress = "" ;  
              $this->fdestphone = "" ;  
              $this->fdestrespone = "" ;  
              $this->fdestresponseemail = "" ;  
              $this->pphone = "" ;  
              $this->premail = "" ;  
              $this->prbrresponse = "" ;  
              $this->producerb_address = "" ;  
              $this->transporteremail = "" ;  
              $this->transporterfax = "" ;  
              $this->transporterphone = "" ;  
              $this->transporterregno = "" ;  
              $this->transporterresponse = "" ;  
              $this->formatado = false;
              if ($this->nmgp_clone != "S")
              {
                  unset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_clone']['wttransportersign']);  
                  unset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_clone']['wtproducersign']);  
                  unset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_clone']['wtfdestsign']);  
              }
              if ($this->nmgp_clone == "S" && isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_select']))
              {
                  $this->nmgp_dados_select = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_select'];
                  $this->wtprofilid = $this->nmgp_dados_select['wtprofilid'];  
                  $this->intnumber = $this->nmgp_dados_select['intnumber'];  
                  $this->wtrequestdate = $this->nmgp_dados_select['wtrequestdate'];  
                  $this->wtproducerbranchid = $this->nmgp_dados_select['wtproducerbranchid'];  
                  $this->wtproducerperiferia = $this->nmgp_dados_select['wtproducerperiferia'];  
                  $this->wtproduceracceptweigth = $this->nmgp_dados_select['wtproduceracceptweigth'];  
                  $this->wtproducerewc = $this->nmgp_dados_select['wtproducerewc'];  
                  $this->wtproducerqty = $this->nmgp_dados_select['wtproducerqty'];  
                  $this->wtprducerm3 = $this->nmgp_dados_select['wtprducerm3'];  
                  $this->wtproducerremarks = $this->nmgp_dados_select['wtproducerremarks'];  
                  $this->wttransportdate = $this->nmgp_dados_select['wttransportdate'];  
                  $this->wtproducervalidate = $this->nmgp_dados_select['wtproducervalidate'];  
                  $this->wttransporterid = $this->nmgp_dados_select['wttransporterid'];  
                  $this->wttransporterperiferiaid = $this->nmgp_dados_select['wttransporterperiferiaid'];  
                  $this->wttransporterewc = $this->nmgp_dados_select['wttransporterewc'];  
                  $this->wttransportervechicle = $this->nmgp_dados_select['wttransportervechicle'];  
                  $this->wttransportervalidate = $this->nmgp_dados_select['wttransportervalidate'];  
                  $this->wttransportervalidateip = $this->nmgp_dados_select['wttransportervalidateip'];  
                  $this->envregistrationno_transporter = $this->nmgp_dados_select['envregistrationno_transporter'];  
                  $this->wttransporternumberid = $this->nmgp_dados_select['wttransporternumberid'];  
                  $this->wtwasteid = $this->nmgp_dados_select['wtwasteid'];  
                  $this->wtequipment = $this->nmgp_dados_select['wtequipment'];  
                  $this->wtfdestdate = $this->nmgp_dados_select['wtfdestdate'];  
                  $this->wtfdestid = $this->nmgp_dados_select['wtfdestid'];  
                  $this->wtfdestperiferia = $this->nmgp_dados_select['wtfdestperiferia'];  
                  $this->wtfdestewc = $this->nmgp_dados_select['wtfdestewc'];  
                  $this->wtfdestrd = $this->nmgp_dados_select['wtfdestrd'];  
                  $this->wtfdestqty = $this->nmgp_dados_select['wtfdestqty'];  
                  $this->wtfdestm3 = $this->nmgp_dados_select['wtfdestm3'];  
                  $this->wtfdestvlidated = $this->nmgp_dados_select['wtfdestvlidated'];  
                  $this->wtfdestvalidateip = $this->nmgp_dados_select['wtfdestvalidateip'];  
                  $this->envregistrationno_fdest = $this->nmgp_dados_select['envregistrationno_fdest'];  
                  $this->wttransportersign = $this->nmgp_dados_select['wttransportersign'];  
                  $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_clone']['wttransportersign'] = $this->nmgp_dados_select['wttransportersign'];  
                  $this->wtproducersign = $this->nmgp_dados_select['wtproducersign'];  
                  $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_clone']['wtproducersign'] = $this->nmgp_dados_select['wtproducersign'];  
                  $this->wtfdestsign = $this->nmgp_dados_select['wtfdestsign'];  
                  $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_clone']['wtfdestsign'] = $this->nmgp_dados_select['wtfdestsign'];  
              }
          }
          if (($this->Embutida_form || $this->Embutida_multi) && isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['foreign_key']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['foreign_key']))
          {
              foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['foreign_key'] as $sFKName => $sFKValue)
              {
                   if (isset($this->sc_conv_var[$sFKName]))
                   {
                       $sFKName = $this->sc_conv_var[$sFKName];
                   }
                  eval("\$this->" . $sFKName . " = \"" . $sFKValue . "\";");
              }
          }
      }  
//
//
//-- 
      if ($this->nmgp_opcao != "novo") 
      {
      }
      $this->nm_proc_onload();
  }
// 
   function NM_gera_log_key($evt) 
   {
       $this->SC_log_arr = array();
       $this->SC_log_atv = true;
       if ($evt == "incluir")
       {
           $this->SC_log_evt = "insert";
       }
       if ($evt == "alterar")
       {
           $this->SC_log_evt = "update";
       }
       if ($evt == "excluir")
       {
           $this->SC_log_evt = "delete";
       }
       $this->SC_log_arr['keys']['wtid'] =  $this->wtid;
   }
// 
   function NM_gera_log_old() 
   {
       if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_select']))
       {
           $nmgp_dados_select = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['dados_select'];
           $this->SC_log_arr['fields']['wtProfilID']['0'] =  $nmgp_dados_select['wtprofilid'];
           $this->SC_log_arr['fields']['INTNUMBER']['0'] =  $nmgp_dados_select['intnumber'];
           $this->SC_log_arr['fields']['wtRequestDate']['0'] =  $nmgp_dados_select['wtrequestdate'];
           $this->SC_log_arr['fields']['wtProducerBranchID']['0'] =  $nmgp_dados_select['wtproducerbranchid'];
           $this->SC_log_arr['fields']['wtProducerPeriferia']['0'] =  $nmgp_dados_select['wtproducerperiferia'];
           $this->SC_log_arr['fields']['wtProducerAcceptWeigth']['0'] =  $nmgp_dados_select['wtproduceracceptweigth'];
           $this->SC_log_arr['fields']['wtProducerEwc']['0'] =  $nmgp_dados_select['wtproducerewc'];
           $this->SC_log_arr['fields']['wtProducerQty']['0'] =  $nmgp_dados_select['wtproducerqty'];
           $this->SC_log_arr['fields']['wtPrducerm3']['0'] =  $nmgp_dados_select['wtprducerm3'];
           $this->SC_log_arr['fields']['wtProducerRemarks']['0'] =  $nmgp_dados_select['wtproducerremarks'];
           $this->SC_log_arr['fields']['wtTransportDate']['0'] =  $nmgp_dados_select['wttransportdate'];
           $this->SC_log_arr['fields']['wtProducerValidate']['0'] =  $nmgp_dados_select['wtproducervalidate'];
           $this->SC_log_arr['fields']['wtTransporterID']['0'] =  $nmgp_dados_select['wttransporterid'];
           $this->SC_log_arr['fields']['wtTransporterPeriferiaID']['0'] =  $nmgp_dados_select['wttransporterperiferiaid'];
           $this->SC_log_arr['fields']['wtTransporterEWC']['0'] =  $nmgp_dados_select['wttransporterewc'];
           $this->SC_log_arr['fields']['wtTransporterVechicle']['0'] =  $nmgp_dados_select['wttransportervechicle'];
           $this->SC_log_arr['fields']['wtTransporterValidate']['0'] =  $nmgp_dados_select['wttransportervalidate'];
           $this->SC_log_arr['fields']['wtTransporterValidateIP']['0'] =  $nmgp_dados_select['wttransportervalidateip'];
           $this->SC_log_arr['fields']['EnvRegistrationNo_Transporter']['0'] =  $nmgp_dados_select['envregistrationno_transporter'];
           $this->SC_log_arr['fields']['wtTransporterNumberID']['0'] =  $nmgp_dados_select['wttransporternumberid'];
           $this->SC_log_arr['fields']['wtWasteID']['0'] =  $nmgp_dados_select['wtwasteid'];
           $this->SC_log_arr['fields']['wtequipment']['0'] =  $nmgp_dados_select['wtequipment'];
           $this->SC_log_arr['fields']['wtFdestDate']['0'] =  $nmgp_dados_select['wtfdestdate'];
           $this->SC_log_arr['fields']['wtFDestID']['0'] =  $nmgp_dados_select['wtfdestid'];
           $this->SC_log_arr['fields']['wtFDestPeriferia']['0'] =  $nmgp_dados_select['wtfdestperiferia'];
           $this->SC_log_arr['fields']['wtFDestEWC']['0'] =  $nmgp_dados_select['wtfdestewc'];
           $this->SC_log_arr['fields']['wtFDestRD']['0'] =  $nmgp_dados_select['wtfdestrd'];
           $this->SC_log_arr['fields']['wtFDestQty']['0'] =  $nmgp_dados_select['wtfdestqty'];
           $this->SC_log_arr['fields']['wtFDestM3']['0'] =  $nmgp_dados_select['wtfdestm3'];
           $this->SC_log_arr['fields']['wtFDestVlidated']['0'] =  $nmgp_dados_select['wtfdestvlidated'];
           $this->SC_log_arr['fields']['wtFDestValidateIP']['0'] =  $nmgp_dados_select['wtfdestvalidateip'];
           $this->SC_log_arr['fields']['EnvRegistrationNo_FDest']['0'] =  $nmgp_dados_select['envregistrationno_fdest'];
           $this->SC_log_arr['fields']['wtTransporterSign']['0'] =  $nmgp_dados_select['wttransportersign'];
           $this->SC_log_arr['fields']['wtProducerSign']['0'] =  $nmgp_dados_select['wtproducersign'];
           $this->SC_log_arr['fields']['wtFDestSign']['0'] =  $nmgp_dados_select['wtfdestsign'];
       }
   }
// 
   function NM_gera_log_new() 
   {
       $this->SC_log_arr['fields']['wtProfilID']['1'] =  $this->wtprofilid;
       $this->SC_log_arr['fields']['INTNUMBER']['1'] =  $this->intnumber;
       $this->SC_log_arr['fields']['wtRequestDate']['1'] =  $this->wtrequestdate;
       $this->SC_log_arr['fields']['wtProducerBranchID']['1'] =  $this->wtproducerbranchid;
       $this->SC_log_arr['fields']['wtProducerPeriferia']['1'] =  $this->wtproducerperiferia;
       $this->SC_log_arr['fields']['wtProducerAcceptWeigth']['1'] =  $this->wtproduceracceptweigth;
       $this->SC_log_arr['fields']['wtProducerEwc']['1'] =  $this->wtproducerewc;
       $this->SC_log_arr['fields']['wtProducerQty']['1'] =  $this->wtproducerqty;
       $this->SC_log_arr['fields']['wtPrducerm3']['1'] =  $this->wtprducerm3;
       $this->SC_log_arr['fields']['wtProducerRemarks']['1'] =  $this->wtproducerremarks;
       $this->SC_log_arr['fields']['wtTransportDate']['1'] =  $this->wttransportdate;
       $this->SC_log_arr['fields']['wtProducerValidate']['1'] =  $this->wtproducervalidate;
       $this->SC_log_arr['fields']['wtTransporterID']['1'] =  $this->wttransporterid;
       $this->SC_log_arr['fields']['wtTransporterPeriferiaID']['1'] =  $this->wttransporterperiferiaid;
       $this->SC_log_arr['fields']['wtTransporterEWC']['1'] =  $this->wttransporterewc;
       $this->SC_log_arr['fields']['wtTransporterVechicle']['1'] =  $this->wttransportervechicle;
       $this->SC_log_arr['fields']['wtTransporterValidate']['1'] =  $this->wttransportervalidate;
       $this->SC_log_arr['fields']['wtTransporterValidateIP']['1'] =  $this->wttransportervalidateip;
       $this->SC_log_arr['fields']['EnvRegistrationNo_Transporter']['1'] =  $this->envregistrationno_transporter;
       $this->SC_log_arr['fields']['wtTransporterNumberID']['1'] =  $this->wttransporternumberid;
       $this->SC_log_arr['fields']['wtWasteID']['1'] =  $this->wtwasteid;
       $this->SC_log_arr['fields']['wtequipment']['1'] =  $this->wtequipment;
       $this->SC_log_arr['fields']['wtFdestDate']['1'] =  $this->wtfdestdate;
       $this->SC_log_arr['fields']['wtFDestID']['1'] =  $this->wtfdestid;
       $this->SC_log_arr['fields']['wtFDestPeriferia']['1'] =  $this->wtfdestperiferia;
       $this->SC_log_arr['fields']['wtFDestEWC']['1'] =  $this->wtfdestewc;
       $this->SC_log_arr['fields']['wtFDestRD']['1'] =  $this->wtfdestrd;
       $this->SC_log_arr['fields']['wtFDestQty']['1'] =  $this->wtfdestqty;
       $this->SC_log_arr['fields']['wtFDestM3']['1'] =  $this->wtfdestm3;
       $this->SC_log_arr['fields']['wtFDestVlidated']['1'] =  $this->wtfdestvlidated;
       $this->SC_log_arr['fields']['wtFDestValidateIP']['1'] =  $this->wtfdestvalidateip;
       $this->SC_log_arr['fields']['EnvRegistrationNo_FDest']['1'] =  $this->envregistrationno_fdest;
       $this->SC_log_arr['fields']['wtTransporterSign']['1'] =  $this->wttransportersign;
       $this->SC_log_arr['fields']['wtProducerSign']['1'] =  $this->wtproducersign;
       $this->SC_log_arr['fields']['wtFDestSign']['1'] =  $this->wtfdestsign;
   }
// 
   function NM_gera_log_compress() 
   {
       foreach ($this->SC_log_arr['fields'] as $fild => $data_f)
       {
           if ($data_f[0] == $data_f[1] || ($data_f[0] == "" && $data_f[1] == "null"))
           {
               unset($this->SC_log_arr['fields'][$fild]);
           }
       }
   }
// 
   function NM_gera_log_output() 
   {
       $Log_output = "";
       $prim_delim = "";
       foreach ($this->SC_log_arr as $type => $dats)
       {
           if ($type == "keys")
           {
               $Log_output .= "--> keys <-- ";
               foreach ($dats as $key => $data)
               {
                   $Log_output .=  $prim_delim . $key . " : " . $data;
                   $prim_delim  = "||";
               }
           }
           if ($type == "fields")
           {
               $Log_output .= $prim_delim . "--> fields <-- ";
               $prim_delim = "";
               if (empty($dats) && $this->SC_log_evt == "update")
               {
                   return;
               }
               foreach ($dats as $key => $data)
               {
                   foreach ($data as $tp => $val)
                   {
                      $tpok = ($tp == 0) ? " (old) " : " (new) ";
                      $Log_output .= $prim_delim . $key . $tpok . " : " . $val;
                      $prim_delim  = "||";
                   }
               }
           }
       }
       $this->NM_gera_log_insert("Scriptcase", $this->SC_log_evt, $Log_output);
   }
//
function ch_FDestVsTransportation()
{
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'on';
if (!isset($this->sc_temp_ProfilID)) {$this->sc_temp_ProfilID = (isset($_SESSION['ProfilID'])) ? $_SESSION['ProfilID'] : "";}
                         



$check_Sql = "SELECT
   transporter.ProfilID,
   transperif.Perif,
   transperif.DateEnd,
   transperifewc.EWC
FROM
   transporter INNER JOIN transperif ON transporter.TransporterID = transperif.TransporterID
   INNER JOIN transperifewc ON transperif.TransPerif = transperifewc.TransPerif
WHERE 
      (transporter.ProfilID = '$this->sc_temp_ProfilID') AND
   (transporter.TransporterID = '$this->wttransporterid') AND
   (transperif.Perif = '$this->wtfdestperiferia') AND
   (transperifewc.EWC = '$this->wtfdestewc')";


 
      $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 (empty($this->rs ))
{
    
	$this->checktransportervsfdest  = 'Προσοχή > Δεν επιβεβαιώθηκε η δυνατότητα μεταφοράς πρός τον Τελικό αποδέκτη';
}
else
{
	
	$this->checktransportervsfdest  = 'Eπιβεβαιώθηκε η δυνατότητα μεταφοράς πρός τον Τελικό αποδέκτη';
}
if (isset($this->sc_temp_ProfilID)) { $_SESSION['ProfilID'] = $this->sc_temp_ProfilID;}
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'off';
}
function ch_ProducervsTransportation()
{
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'on';
if (!isset($this->sc_temp_ProfilID)) {$this->sc_temp_ProfilID = (isset($_SESSION['ProfilID'])) ? $_SESSION['ProfilID'] : "";}
                         



$check_Sql = "SELECT
   transporter.ProfilID,
   transperif.Perif,
   transperif.DateEnd,
   transperifewc.EWC
FROM
   transporter INNER JOIN transperif ON transporter.TransporterID = transperif.TransporterID
   INNER JOIN transperifewc ON transperif.TransPerif = transperifewc.TransPerif
WHERE 
      (transporter.ProfilID = '$this->sc_temp_ProfilID') AND
   (transporter.TransporterID = '$this->wttransporterid') AND
   (transperif.Perif = '$this->wtproducerperiferia') AND
   (transperifewc.EWC = '$this->wtproducerewc')";


 
      $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 (empty($this->rs ))
{
    
	$this->checktransvsproducer  = 'Προσοχή > Δεν επιβεβαιώθηκε η δυνατότητα μεταφοράς απο τον Παραγωγό';
}
else
{
	
	$this->checktransvsproducer  = 'Eπιβεβαιώθηκε η δυνατότητα μεταφοράς απο τον Παραγωγό';
}
if (isset($this->sc_temp_ProfilID)) { $_SESSION['ProfilID'] = $this->sc_temp_ProfilID;}
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'off';
}
function load_more()
{
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'on';
                         



$check_sql = "SELECT Address, ResponseName,Phone,email,Periferia "
   . " 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->prbrresponse  = $this->rs[0][1];
	$this->pphone  = $this->rs[0][2];
	$this->premail  = $this->rs[0][3];
	$this->wtproducerperiferia  = $this->rs[0][4];
	$this->wttransporterperiferiaid  = $this->rs[0][4];
}
		else     
{
	$this->producerb_address  = '......';
    $this->prbrresponse  = '';
	$this->pphone  = '';
	$this->premail  = '';
	$this->wtproducerperiferia  = '';
	$this->wttransporterperiferiaid  = '';
}


$check_sql = "SELECT TITLE"
   . " FROM ewc"
   . " WHERE EWC = '" . $this->wtproducerewc  . "'";
 
      $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->ewctitle  = $this->rs[0][0];
}
		else     
{
		    $this->ewctitle  = '';
}
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'off';
}
function load_more_FDEst()
{
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'on';
                         



$check_sql = "SELECT Address, ResponseName,Phone,email,Periferia "
   . " 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->wtfdestperiferia  = $this->rs[0][4];

}
		else     
{
	$this->fdestaddress  = '';
    $this->fdestrespone  = '';
	$this->fdestphone  = '';
	$this->fdestresponseemail  = '';
	$this->wtfdestperiferia  = '';
}



$check_sql = "SELECT TITLE"
   . " FROM ewc"
   . " WHERE EWC = '" . $this->wtfdestewc  . "'";
 
      $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->fdewctitle  = $this->rs[0][0];
}
		else     
{
		    $this->fdewctitle  = '';
}
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'off';
}
function load_more_transporter()
{
$_SESSION['scriptcase']['validate_wastetransactions_mob']['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->transporterresponse  = $this->rs[0][0];
    $this->transporterphone  = $this->rs[0][1];    
	$this->transporteremail  = $this->rs[0][2];
	$this->transporterregno  = $this->rs[0][3];
	$this->transporterfax  =   $this->rs[0][4];
}
		else     
{
	$this->transporterresponse  = '';
    $this->transporterphone  = '';
	$this->transporteremail  = '';
	$this->transporterregno  = '';
	$this->transporterfax  =  '';
}
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'off';
}
function wtFDestEWC_onChange()
{
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'on';
                         
$original_wttransporterid = $this->wttransporterid;
$original_wtfdestewc = $this->wtfdestewc;
$original_fdewctitle = $this->fdewctitle;




$check_sql = "SELECT TITLE"
   . " FROM ewc"
   . " WHERE EWC = '" . $this->wtfdestewc  . "'";
 
      $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->fdewctitle  = $this->rs[0][0];
}
		else     
{
		    $this->fdewctitle  = '';
}



$modificado_wttransporterid = $this->wttransporterid;
$modificado_wtfdestewc = $this->wtfdestewc;
$modificado_fdewctitle = $this->fdewctitle;
$this->nm_formatar_campos('wttransporterid', 'wtfdestewc', 'fdewctitle');
if ($original_wttransporterid !== $modificado_wttransporterid || (isset($bFlagRead_wttransporterid) && $bFlagRead_wttransporterid))
{
    $this->ajax_return_values_wttransporterid(true);
}
if ($original_wtfdestewc !== $modificado_wtfdestewc || (isset($bFlagRead_wtfdestewc) && $bFlagRead_wtfdestewc))
{
    $this->ajax_return_values_wtfdestewc(true);
}
if ($original_fdewctitle !== $modificado_fdewctitle || (isset($bFlagRead_fdewctitle) && $bFlagRead_fdewctitle))
{
    $this->ajax_return_values_fdewctitle(true);
}
validate_wastetransactions_mob_pack_ajax_response();
exit;
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'off';
}
function wtFDestID_onChange()
{
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'on';
                         
$original_wtfdestid = $this->wtfdestid;
$original_fdestaddress = $this->fdestaddress;
$original_fdestrespone = $this->fdestrespone;
$original_fdestphone = $this->fdestphone;
$original_fdestresponseemail = $this->fdestresponseemail;
$original_wtfdestperiferia = $this->wtfdestperiferia;
$original_wttransporterid = $this->wttransporterid;
$original_wtfdestewc = $this->wtfdestewc;
$original_fdewctitle = $this->fdewctitle;

$this->load_more_FDEst();

$modificado_wtfdestid = $this->wtfdestid;
$modificado_fdestaddress = $this->fdestaddress;
$modificado_fdestrespone = $this->fdestrespone;
$modificado_fdestphone = $this->fdestphone;
$modificado_fdestresponseemail = $this->fdestresponseemail;
$modificado_wtfdestperiferia = $this->wtfdestperiferia;
$modificado_wttransporterid = $this->wttransporterid;
$modificado_wtfdestewc = $this->wtfdestewc;
$modificado_fdewctitle = $this->fdewctitle;
$this->nm_formatar_campos('wtfdestid', 'fdestaddress', 'fdestrespone', 'fdestphone', 'fdestresponseemail', 'wtfdestperiferia', 'wttransporterid', 'wtfdestewc', 'fdewctitle');
if ($original_wtfdestid !== $modificado_wtfdestid || (isset($bFlagRead_wtfdestid) && $bFlagRead_wtfdestid))
{
    $this->ajax_return_values_wtfdestid(true);
}
if ($original_fdestaddress !== $modificado_fdestaddress || (isset($bFlagRead_fdestaddress) && $bFlagRead_fdestaddress))
{
    $this->ajax_return_values_fdestaddress(true);
}
if ($original_fdestrespone !== $modificado_fdestrespone || (isset($bFlagRead_fdestrespone) && $bFlagRead_fdestrespone))
{
    $this->ajax_return_values_fdestrespone(true);
}
if ($original_fdestphone !== $modificado_fdestphone || (isset($bFlagRead_fdestphone) && $bFlagRead_fdestphone))
{
    $this->ajax_return_values_fdestphone(true);
}
if ($original_fdestresponseemail !== $modificado_fdestresponseemail || (isset($bFlagRead_fdestresponseemail) && $bFlagRead_fdestresponseemail))
{
    $this->ajax_return_values_fdestresponseemail(true);
}
if ($original_wtfdestperiferia !== $modificado_wtfdestperiferia || (isset($bFlagRead_wtfdestperiferia) && $bFlagRead_wtfdestperiferia))
{
    $this->ajax_return_values_wtfdestperiferia(true);
}
if ($original_wttransporterid !== $modificado_wttransporterid || (isset($bFlagRead_wttransporterid) && $bFlagRead_wttransporterid))
{
    $this->ajax_return_values_wttransporterid(true);
}
if ($original_wtfdestewc !== $modificado_wtfdestewc || (isset($bFlagRead_wtfdestewc) && $bFlagRead_wtfdestewc))
{
    $this->ajax_return_values_wtfdestewc(true);
}
if ($original_fdewctitle !== $modificado_fdewctitle || (isset($bFlagRead_fdewctitle) && $bFlagRead_fdewctitle))
{
    $this->ajax_return_values_fdewctitle(true);
}
validate_wastetransactions_mob_pack_ajax_response();
exit;


$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'off';
}
function wtFDestID_onClick()
{
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'on';
                         
$original_wtfdestid = $this->wtfdestid;
$original_fdestaddress = $this->fdestaddress;
$original_fdestrespone = $this->fdestrespone;
$original_fdestphone = $this->fdestphone;
$original_fdestresponseemail = $this->fdestresponseemail;
$original_wtfdestperiferia = $this->wtfdestperiferia;
$original_wttransporterid = $this->wttransporterid;
$original_wtfdestewc = $this->wtfdestewc;
$original_fdewctitle = $this->fdewctitle;

$this->load_more_FDEst();

$modificado_wtfdestid = $this->wtfdestid;
$modificado_fdestaddress = $this->fdestaddress;
$modificado_fdestrespone = $this->fdestrespone;
$modificado_fdestphone = $this->fdestphone;
$modificado_fdestresponseemail = $this->fdestresponseemail;
$modificado_wtfdestperiferia = $this->wtfdestperiferia;
$modificado_wttransporterid = $this->wttransporterid;
$modificado_wtfdestewc = $this->wtfdestewc;
$modificado_fdewctitle = $this->fdewctitle;
$this->nm_formatar_campos('wtfdestid', 'fdestaddress', 'fdestrespone', 'fdestphone', 'fdestresponseemail', 'wtfdestperiferia', 'wttransporterid', 'wtfdestewc', 'fdewctitle');
if ($original_wtfdestid !== $modificado_wtfdestid || (isset($bFlagRead_wtfdestid) && $bFlagRead_wtfdestid))
{
    $this->ajax_return_values_wtfdestid(true);
}
if ($original_fdestaddress !== $modificado_fdestaddress || (isset($bFlagRead_fdestaddress) && $bFlagRead_fdestaddress))
{
    $this->ajax_return_values_fdestaddress(true);
}
if ($original_fdestrespone !== $modificado_fdestrespone || (isset($bFlagRead_fdestrespone) && $bFlagRead_fdestrespone))
{
    $this->ajax_return_values_fdestrespone(true);
}
if ($original_fdestphone !== $modificado_fdestphone || (isset($bFlagRead_fdestphone) && $bFlagRead_fdestphone))
{
    $this->ajax_return_values_fdestphone(true);
}
if ($original_fdestresponseemail !== $modificado_fdestresponseemail || (isset($bFlagRead_fdestresponseemail) && $bFlagRead_fdestresponseemail))
{
    $this->ajax_return_values_fdestresponseemail(true);
}
if ($original_wtfdestperiferia !== $modificado_wtfdestperiferia || (isset($bFlagRead_wtfdestperiferia) && $bFlagRead_wtfdestperiferia))
{
    $this->ajax_return_values_wtfdestperiferia(true);
}
if ($original_wttransporterid !== $modificado_wttransporterid || (isset($bFlagRead_wttransporterid) && $bFlagRead_wttransporterid))
{
    $this->ajax_return_values_wttransporterid(true);
}
if ($original_wtfdestewc !== $modificado_wtfdestewc || (isset($bFlagRead_wtfdestewc) && $bFlagRead_wtfdestewc))
{
    $this->ajax_return_values_wtfdestewc(true);
}
if ($original_fdewctitle !== $modificado_fdewctitle || (isset($bFlagRead_fdewctitle) && $bFlagRead_fdewctitle))
{
    $this->ajax_return_values_fdewctitle(true);
}
validate_wastetransactions_mob_pack_ajax_response();
exit;


$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'off';
}
function wtProducerBranchID_onChange()
{
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'on';
                         
$original_wtproducerbranchid = $this->wtproducerbranchid;
$original_producerb_address = $this->producerb_address;
$original_prbrresponse = $this->prbrresponse;
$original_pphone = $this->pphone;
$original_premail = $this->premail;
$original_wtproducerperiferia = $this->wtproducerperiferia;
$original_wtproducerewc = $this->wtproducerewc;
$original_ewctitle = $this->ewctitle;

$this->load_more();

$modificado_wtproducerbranchid = $this->wtproducerbranchid;
$modificado_producerb_address = $this->producerb_address;
$modificado_prbrresponse = $this->prbrresponse;
$modificado_pphone = $this->pphone;
$modificado_premail = $this->premail;
$modificado_wtproducerperiferia = $this->wtproducerperiferia;
$modificado_wtproducerewc = $this->wtproducerewc;
$modificado_ewctitle = $this->ewctitle;
$this->nm_formatar_campos('wtproducerbranchid', 'producerb_address', 'prbrresponse', 'pphone', 'premail', 'wtproducerperiferia', 'wtproducerewc', 'ewctitle');
if ($original_wtproducerbranchid !== $modificado_wtproducerbranchid || (isset($bFlagRead_wtproducerbranchid) && $bFlagRead_wtproducerbranchid))
{
    $this->ajax_return_values_wtproducerbranchid(true);
}
if ($original_producerb_address !== $modificado_producerb_address || (isset($bFlagRead_producerb_address) && $bFlagRead_producerb_address))
{
    $this->ajax_return_values_producerb_address(true);
}
if ($original_prbrresponse !== $modificado_prbrresponse || (isset($bFlagRead_prbrresponse) && $bFlagRead_prbrresponse))
{
    $this->ajax_return_values_prbrresponse(true);
}
if ($original_pphone !== $modificado_pphone || (isset($bFlagRead_pphone) && $bFlagRead_pphone))
{
    $this->ajax_return_values_pphone(true);
}
if ($original_premail !== $modificado_premail || (isset($bFlagRead_premail) && $bFlagRead_premail))
{
    $this->ajax_return_values_premail(true);
}
if ($original_wtproducerperiferia !== $modificado_wtproducerperiferia || (isset($bFlagRead_wtproducerperiferia) && $bFlagRead_wtproducerperiferia))
{
    $this->ajax_return_values_wtproducerperiferia(true);
}
if ($original_wtproducerewc !== $modificado_wtproducerewc || (isset($bFlagRead_wtproducerewc) && $bFlagRead_wtproducerewc))
{
    $this->ajax_return_values_wtproducerewc(true);
}
if ($original_ewctitle !== $modificado_ewctitle || (isset($bFlagRead_ewctitle) && $bFlagRead_ewctitle))
{
    $this->ajax_return_values_ewctitle(true);
}
validate_wastetransactions_mob_pack_ajax_response();
exit;


$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'off';
}
function wtProducerBranchID_onClick()
{
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'on';
                         
$original_wtproducerbranchid = $this->wtproducerbranchid;
$original_producerb_address = $this->producerb_address;
$original_prbrresponse = $this->prbrresponse;
$original_pphone = $this->pphone;
$original_premail = $this->premail;
$original_wtproducerperiferia = $this->wtproducerperiferia;
$original_wtproducerewc = $this->wtproducerewc;
$original_ewctitle = $this->ewctitle;

$this->load_more();

$modificado_wtproducerbranchid = $this->wtproducerbranchid;
$modificado_producerb_address = $this->producerb_address;
$modificado_prbrresponse = $this->prbrresponse;
$modificado_pphone = $this->pphone;
$modificado_premail = $this->premail;
$modificado_wtproducerperiferia = $this->wtproducerperiferia;
$modificado_wtproducerewc = $this->wtproducerewc;
$modificado_ewctitle = $this->ewctitle;
$this->nm_formatar_campos('wtproducerbranchid', 'producerb_address', 'prbrresponse', 'pphone', 'premail', 'wtproducerperiferia', 'wtproducerewc', 'ewctitle');
if ($original_wtproducerbranchid !== $modificado_wtproducerbranchid || (isset($bFlagRead_wtproducerbranchid) && $bFlagRead_wtproducerbranchid))
{
    $this->ajax_return_values_wtproducerbranchid(true);
}
if ($original_producerb_address !== $modificado_producerb_address || (isset($bFlagRead_producerb_address) && $bFlagRead_producerb_address))
{
    $this->ajax_return_values_producerb_address(true);
}
if ($original_prbrresponse !== $modificado_prbrresponse || (isset($bFlagRead_prbrresponse) && $bFlagRead_prbrresponse))
{
    $this->ajax_return_values_prbrresponse(true);
}
if ($original_pphone !== $modificado_pphone || (isset($bFlagRead_pphone) && $bFlagRead_pphone))
{
    $this->ajax_return_values_pphone(true);
}
if ($original_premail !== $modificado_premail || (isset($bFlagRead_premail) && $bFlagRead_premail))
{
    $this->ajax_return_values_premail(true);
}
if ($original_wtproducerperiferia !== $modificado_wtproducerperiferia || (isset($bFlagRead_wtproducerperiferia) && $bFlagRead_wtproducerperiferia))
{
    $this->ajax_return_values_wtproducerperiferia(true);
}
if ($original_wtproducerewc !== $modificado_wtproducerewc || (isset($bFlagRead_wtproducerewc) && $bFlagRead_wtproducerewc))
{
    $this->ajax_return_values_wtproducerewc(true);
}
if ($original_ewctitle !== $modificado_ewctitle || (isset($bFlagRead_ewctitle) && $bFlagRead_ewctitle))
{
    $this->ajax_return_values_ewctitle(true);
}
validate_wastetransactions_mob_pack_ajax_response();
exit;


$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'off';
}
function wtProducerEwc_onChange($wtproducerbranchid)
{
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'on';
                         
$original_wttransporterid = $this->wttransporterid;
$original_wtproducerewc = $this->wtproducerewc;
$original_ewctitle = $this->ewctitle;
$original_wtproducerbranchid = $this->wtproducerbranchid;

$this->wttransporterid  = '';


$check_sql = "SELECT TITLE"
   . " FROM ewc"
   . " WHERE EWC = '" . $this->wtproducerewc  . "'";
 
      $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->ewctitle  = $this->rs[0][0];
}
		else     
{
		    $this->ewctitle  = '';
}




$modificado_wttransporterid = $this->wttransporterid;
$modificado_wtproducerewc = $this->wtproducerewc;
$modificado_ewctitle = $this->ewctitle;
$modificado_wtproducerbranchid = $this->wtproducerbranchid;
$this->nm_formatar_campos('wttransporterid', 'wtproducerewc', 'ewctitle');
if ($original_wttransporterid !== $modificado_wttransporterid || (isset($bFlagRead_wttransporterid) && $bFlagRead_wttransporterid))
{
    $this->ajax_return_values_wttransporterid(true);
}
if ($original_wtproducerewc !== $modificado_wtproducerewc || (isset($bFlagRead_wtproducerewc) && $bFlagRead_wtproducerewc))
{
    $this->ajax_return_values_wtproducerewc(true);
}
if ($original_ewctitle !== $modificado_ewctitle || (isset($bFlagRead_ewctitle) && $bFlagRead_ewctitle))
{
    $this->ajax_return_values_ewctitle(true);
}
if ($original_wtproducerbranchid !== $modificado_wtproducerbranchid || (isset($bFlagRead_wtproducerbranchid) && $bFlagRead_wtproducerbranchid))
{
    $this->ajax_return_values_wtproducerbranchid(true);
}
validate_wastetransactions_mob_pack_ajax_response();
exit;
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'off';
}
function wtTransporterID_onChange($wtproducerperiferia, $wtproducerbranchid, $wtprofilid)
{
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'on';
if (!isset($this->sc_temp_ProfilID)) {$this->sc_temp_ProfilID = (isset($_SESSION['ProfilID'])) ? $_SESSION['ProfilID'] : "";}
                         
$original_wttransporterid = $this->wttransporterid;
$original_wtproducerperiferia = $this->wtproducerperiferia;
$original_wtproducerewc = $this->wtproducerewc;
$original_checktransvsproducer = $this->checktransvsproducer;
$original_transporterresponse = $this->transporterresponse;
$original_transporterphone = $this->transporterphone;
$original_transporteremail = $this->transporteremail;
$original_transporterfax = $this->transporterfax;
$original_wtproducerperiferia = $this->wtproducerperiferia;
$original_wtproducerbranchid = $this->wtproducerbranchid;
$original_wtprofilid = $this->wtprofilid;


$this->load_more_transporter();

$check_Sql = "SELECT
   transporter.ProfilID,
   transperif.Perif,
   transperif.DateEnd,
   transperifewc.EWC
FROM
   transporter INNER JOIN transperif ON transporter.TransporterID = transperif.TransporterID
   INNER JOIN transperifewc ON transperif.TransPerif = transperifewc.TransPerif
WHERE 
      (transporter.ProfilID = '$this->sc_temp_ProfilID') AND
   (transporter.TransporterID = '$this->wttransporterid') AND
   (transperif.Perif = '$this->wtproducerperiferia') AND
   (transperifewc.EWC = '$this->wtproducerewc')";

 
      $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 (empty($this->rs ))
{
    
	$this->checktransvsproducer  = 'Προσοχή > Δεν επιβεβαιώθηκε η δυνατότητα μεταφοράς απο τον Παραγωγό';
}
else
{
	$this->transporterregno =$this->rs[0][1];
	$this->checktransvsproducer  = 'Eπιβεβαιώθηκε η δυνατότητα μεταφοράς απο τον Παραγωγό';
}





if (isset($this->sc_temp_ProfilID)) { $_SESSION['ProfilID'] = $this->sc_temp_ProfilID;}
$_SESSION['scriptcase']['validate_wastetransactions_mob']['contr_erro'] = 'off';
$modificado_wttransporterid = $this->wttransporterid;
$modificado_wtproducerperiferia = $this->wtproducerperiferia;
$modificado_wtproducerewc = $this->wtproducerewc;
$modificado_checktransvsproducer = $this->checktransvsproducer;
$modificado_transporterresponse = $this->transporterresponse;
$modificado_transporterphone = $this->transporterphone;
$modificado_transporteremail = $this->transporteremail;
$modificado_transporterfax = $this->transporterfax;
$modificado_wtproducerperiferia = $this->wtproducerperiferia;
$modificado_wtproducerbranchid = $this->wtproducerbranchid;
$modificado_wtprofilid = $this->wtprofilid;
$this->nm_formatar_campos('wttransporterid', 'wtproducerperiferia', 'wtproducerewc', 'checktransvsproducer', 'transporterresponse', 'transporterphone', 'transporteremail', 'transporterfax');
if ($original_wttransporterid !== $modificado_wttransporterid || (isset($bFlagRead_wttransporterid) && $bFlagRead_wttransporterid))
{
    $this->ajax_return_values_wttransporterid(true);
}
if ($original_wtproducerperiferia !== $modificado_wtproducerperiferia || (isset($bFlagRead_wtproducerperiferia) && $bFlagRead_wtproducerperiferia))
{
    $this->ajax_return_values_wtproducerperiferia(true);
}
if ($original_wtproducerewc !== $modificado_wtproducerewc || (isset($bFlagRead_wtproducerewc) && $bFlagRead_wtproducerewc))
{
    $this->ajax_return_values_wtproducerewc(true);
}
if ($original_checktransvsproducer !== $modificado_checktransvsproducer || (isset($bFlagRead_checktransvsproducer) && $bFlagRead_checktransvsproducer))
{
    $this->ajax_return_values_checktransvsproducer(true);
}
if ($original_transporterresponse !== $modificado_transporterresponse || (isset($bFlagRead_transporterresponse) && $bFlagRead_transporterresponse))
{
    $this->ajax_return_values_transporterresponse(true);
}
if ($original_transporterphone !== $modificado_transporterphone || (isset($bFlagRead_transporterphone) && $bFlagRead_transporterphone))
{
    $this->ajax_return_values_transporterphone(true);
}
if ($original_transporteremail !== $modificado_transporteremail || (isset($bFlagRead_transporteremail) && $bFlagRead_transporteremail))
{
    $this->ajax_return_values_transporteremail(true);
}
if ($original_transporterfax !== $modificado_transporterfax || (isset($bFlagRead_transporterfax) && $bFlagRead_transporterfax))
{
    $this->ajax_return_values_transporterfax(true);
}
if ($original_wtproducerperiferia !== $modificado_wtproducerperiferia || (isset($bFlagRead_wtproducerperiferia) && $bFlagRead_wtproducerperiferia))
{
    $this->ajax_return_values_wtproducerperiferia(true);
}
if ($original_wtproducerbranchid !== $modificado_wtproducerbranchid || (isset($bFlagRead_wtproducerbranchid) && $bFlagRead_wtproducerbranchid))
{
    $this->ajax_return_values_wtproducerbranchid(true);
}
if ($original_wtprofilid !== $modificado_wtprofilid || (isset($bFlagRead_wtprofilid) && $bFlagRead_wtprofilid))
{
    $this->ajax_return_values_wtprofilid(true);
}
validate_wastetransactions_mob_pack_ajax_response();
exit;
}
//
 function nm_gera_html()
 {
    global
           $nm_url_saida, $nmgp_url_saida, $nm_saida_global, $nm_apl_dependente, $glo_subst, $sc_check_excl, $sc_check_incl, $nmgp_num_form, $NM_run_iframe;
     if ($this->Embutida_proc)
     {
         return;
     }
     if ($this->nmgp_form_show == 'off')
     {
         exit;
     }
      if (isset($NM_run_iframe) && $NM_run_iframe == 1)
      {
          $this->nmgp_botoes['exit'] = "off";
      }
     $HTTP_REFERER = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : ""; 
     $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
     $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['botoes'] = $this->nmgp_botoes;
     if ($this->nmgp_opcao != "recarga" && $this->nmgp_opcao != "muda_form")
     {
         $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['opc_ant'] = $this->nmgp_opcao;
     }
     else
     {
         $this->nmgp_opcao = $this->nmgp_opc_ant;
     }
     if (!empty($this->Campos_Mens_erro)) 
     {
         $this->Erro->mensagem(__FILE__, __LINE__, "critica", $this->Campos_Mens_erro); 
         $this->Campos_Mens_erro = "";
     }
     if (($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['run_iframe'] == "F" || $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['run_iframe'] == "R") && $this->nm_flag_iframe && empty($this->nm_todas_criticas))
     {
          if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['run_iframe_ajax']))
          {
              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['retorno_edit'] = array("edit", "");
          }
          else
          {
              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['retorno_edit'] .= "&nmgp_opcao=edit";
          }
          if ($this->sc_evento == "insert" && $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['run_iframe'] == "F")
          {
              if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['run_iframe_ajax']))
              {
                  $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['retorno_edit'] = array("edit", "fim");
              }
              else
              {
                  $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['retorno_edit'] .= "&rec=fim";
              }
          }
          $this->NM_close_db(); 
          $sJsParent = '';
          if ($this->NM_ajax_flag && isset($this->NM_ajax_info['param']['buffer_output']) && $this->NM_ajax_info['param']['buffer_output'])
          {
              if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['run_iframe_ajax']))
              {
                  $this->NM_ajax_info['ajaxJavascript'][] = array("parent.ajax_navigate", $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['retorno_edit']);
              }
              else
              {
                  $sJsParent .= 'parent';
                  $this->NM_ajax_info['redir']['metodo'] = 'location';
                  $this->NM_ajax_info['redir']['action'] = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['retorno_edit'];
                  $this->NM_ajax_info['redir']['target'] = $sJsParent;
              }
              validate_wastetransactions_mob_pack_ajax_response();
              exit;
          }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">

         <html><body>
         <script type="text/javascript">
<?php
    
    if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['run_iframe_ajax']))
    {
        $opc = ($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['run_iframe'] == "F" && $this->sc_evento == "insert") ? "fim" : "";
        echo "parent.ajax_navigate('edit', '" .$opc . "');";
    }
    else
    {
        echo $sJsParent . "parent.location = '" . $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['retorno_edit'] . "';";
    }
?>
         </script>
         </body></html>
<?php
         exit;
     }
//-- 
   if ($this->nmgp_opcao == "novo")
   { 
       $out_wtproducersign = "";  
   } 
   else 
   { 
       $out_wtproducersign = $this->wtproducersign;  
   } 
   if ($this->wtproducersign != "" && $this->wtproducersign != "none")   
   { 
       $out_wtproducersign = $this->Ini->path_imag_temp . "/sc_wtproducersign_" . $_SESSION['scriptcase']['sc_num_img'] . session_id() . ".gif" ;  
       $arq_wtproducersign = fopen($this->Ini->root . $out_wtproducersign, "w") ;  
       if (substr($this->wtproducersign, 0, 4) == "*nm*") 
       { 
           $this->wtproducersign = substr($this->wtproducersign, 4) ; 
           $this->wtproducersign = base64_decode($this->wtproducersign) ; 
       } 
       $img_pos_bm = strpos($this->wtproducersign, "BM") ; 
       if (!$img_pos_bm === FALSE && $img_pos_bm == 78) 
       { 
           $this->wtproducersign = substr($this->wtproducersign, $img_pos_bm) ; 
       } 
       fwrite($arq_wtproducersign, $this->wtproducersign) ;  
       fclose($arq_wtproducersign) ;  
       $out1_wtproducersign = $out_wtproducersign; 
       $_SESSION['scriptcase']['sc_num_img']++ ; 
       $out_wtproducersign = $this->Ini->path_imag_temp . "/sc_" . "wtproducersign_" . $_SESSION['scriptcase']['sc_num_img'] . session_id() . ".gif" ; 
       $_SESSION['scriptcase']['sc_num_img']++ ; 
       if (!$this->Ini->Gd_missing)
       { 
           $sc_obj_img = new nm_trata_img($this->Ini->root . $out1_wtproducersign);
           $sc_obj_img->setWidth(90);
           $sc_obj_img->setHeight(90);
           $sc_obj_img->createImg($this->Ini->root . $out_wtproducersign);
       } 
       else 
       { 
           $out_wtproducersign = $out1_wtproducersign;
       } 
       $_SESSION['scriptcase']['sc_num_img']++ ; 
   } 
   if (isset($_POST['nmgp_opcao']) && 'excluir' == $_POST['nmgp_opcao'] && $this->sc_evento != "delete" && (!isset($this->sc_evento_old) || 'delete' != $this->sc_evento_old))
   {
       global $temp_out_wtproducersign;
       if (isset($temp_out_wtproducersign))
       {
           $out_wtproducersign = $temp_out_wtproducersign;
       }
       global $temp_out1_wtproducersign;
       if (isset($temp_out1_wtproducersign))
       {
           $out1_wtproducersign = $temp_out1_wtproducersign;
       }
   }
   if ($this->nmgp_opcao == "novo")
   { 
       $out_wttransportersign = "";  
   } 
   else 
   { 
       $out_wttransportersign = $this->wttransportersign;  
   } 
   if ($this->wttransportersign != "" && $this->wttransportersign != "none")   
   { 
       $out_wttransportersign = $this->Ini->path_imag_temp . "/sc_wttransportersign_" . $_SESSION['scriptcase']['sc_num_img'] . session_id() . ".gif" ;  
       $arq_wttransportersign = fopen($this->Ini->root . $out_wttransportersign, "w") ;  
       if (substr($this->wttransportersign, 0, 4) == "*nm*") 
       { 
           $this->wttransportersign = substr($this->wttransportersign, 4) ; 
           $this->wttransportersign = base64_decode($this->wttransportersign) ; 
       } 
       $img_pos_bm = strpos($this->wttransportersign, "BM") ; 
       if (!$img_pos_bm === FALSE && $img_pos_bm == 78) 
       { 
           $this->wttransportersign = substr($this->wttransportersign, $img_pos_bm) ; 
       } 
       fwrite($arq_wttransportersign, $this->wttransportersign) ;  
       fclose($arq_wttransportersign) ;  
       $out1_wttransportersign = $out_wttransportersign; 
       $_SESSION['scriptcase']['sc_num_img']++ ; 
       $out_wttransportersign = $this->Ini->path_imag_temp . "/sc_" . "wttransportersign_" . $_SESSION['scriptcase']['sc_num_img'] . session_id() . ".gif" ; 
       $_SESSION['scriptcase']['sc_num_img']++ ; 
       if (!$this->Ini->Gd_missing)
       { 
           $sc_obj_img = new nm_trata_img($this->Ini->root . $out1_wttransportersign);
           $sc_obj_img->setWidth(90);
           $sc_obj_img->setHeight(90);
           $sc_obj_img->createImg($this->Ini->root . $out_wttransportersign);
       } 
       else 
       { 
           $out_wttransportersign = $out1_wttransportersign;
       } 
       $_SESSION['scriptcase']['sc_num_img']++ ; 
   } 
   if (isset($_POST['nmgp_opcao']) && 'excluir' == $_POST['nmgp_opcao'] && $this->sc_evento != "delete" && (!isset($this->sc_evento_old) || 'delete' != $this->sc_evento_old))
   {
       global $temp_out_wttransportersign;
       if (isset($temp_out_wttransportersign))
       {
           $out_wttransportersign = $temp_out_wttransportersign;
       }
       global $temp_out1_wttransportersign;
       if (isset($temp_out1_wttransportersign))
       {
           $out1_wttransportersign = $temp_out1_wttransportersign;
       }
   }
   if ($this->nmgp_opcao == "novo")
   { 
       $out_wtfdestsign = "";  
   } 
   else 
   { 
       $out_wtfdestsign = $this->wtfdestsign;  
   } 
   if ($this->wtfdestsign != "" && $this->wtfdestsign != "none")   
   { 
       $out_wtfdestsign = $this->Ini->path_imag_temp . "/sc_wtfdestsign_" . $_SESSION['scriptcase']['sc_num_img'] . session_id() . ".gif" ;  
       $arq_wtfdestsign = fopen($this->Ini->root . $out_wtfdestsign, "w") ;  
       if (substr($this->wtfdestsign, 0, 4) == "*nm*") 
       { 
           $this->wtfdestsign = substr($this->wtfdestsign, 4) ; 
           $this->wtfdestsign = base64_decode($this->wtfdestsign) ; 
       } 
       $img_pos_bm = strpos($this->wtfdestsign, "BM") ; 
       if (!$img_pos_bm === FALSE && $img_pos_bm == 78) 
       { 
           $this->wtfdestsign = substr($this->wtfdestsign, $img_pos_bm) ; 
       } 
       fwrite($arq_wtfdestsign, $this->wtfdestsign) ;  
       fclose($arq_wtfdestsign) ;  
       $out1_wtfdestsign = $out_wtfdestsign; 
       $_SESSION['scriptcase']['sc_num_img']++ ; 
       $out_wtfdestsign = $this->Ini->path_imag_temp . "/sc_" . "wtfdestsign_" . $_SESSION['scriptcase']['sc_num_img'] . session_id() . ".gif" ; 
       $_SESSION['scriptcase']['sc_num_img']++ ; 
       if (!$this->Ini->Gd_missing)
       { 
           $sc_obj_img = new nm_trata_img($this->Ini->root . $out1_wtfdestsign);
           $sc_obj_img->setWidth(90);
           $sc_obj_img->setHeight(90);
           $sc_obj_img->createImg($this->Ini->root . $out_wtfdestsign);
       } 
       else 
       { 
           $out_wtfdestsign = $out1_wtfdestsign;
       } 
       $_SESSION['scriptcase']['sc_num_img']++ ; 
   } 
   if (isset($_POST['nmgp_opcao']) && 'excluir' == $_POST['nmgp_opcao'] && $this->sc_evento != "delete" && (!isset($this->sc_evento_old) || 'delete' != $this->sc_evento_old))
   {
       global $temp_out_wtfdestsign;
       if (isset($temp_out_wtfdestsign))
       {
           $out_wtfdestsign = $temp_out_wtfdestsign;
       }
       global $temp_out1_wtfdestsign;
       if (isset($temp_out1_wtfdestsign))
       {
           $out1_wtfdestsign = $temp_out1_wtfdestsign;
       }
   }
    include_once("validate_wastetransactions_mob_form0.php");
 }
   function jqueryCalendarDtFormat($sFormat, $sSep)
   {
       $sFormat = chunk_split(str_replace('yyyy', 'yy', $sFormat), 2, $sSep);

       if ($sSep == substr($sFormat, -1))
       {
           $sFormat = substr($sFormat, 0, -1);
       }

       return $sFormat;
   } // jqueryCalendarDtFormat

   function jqueryCalendarTimeStart($sFormat)
   {
       $aDateParts = explode(';', $sFormat);

       if (2 == sizeof($aDateParts))
       {
           $sTime = $aDateParts[1];
       }
       else
       {
           $sTime = 'hh:mm:ss';
       }

       return str_replace(array('h', 'm', 'i', 's'), array('0', '0', '0', '0'), $sTime);
   } // jqueryCalendarTimeStart

   function jqueryCalendarWeekInit($sDay)
   {
       switch ($sDay) {
           case 'MO': return 1; break;
           case 'TU': return 2; break;
           case 'WE': return 3; break;
           case 'TH': return 4; break;
           case 'FR': return 5; break;
           case 'SA': return 6; break;
           default  : return 7; break;
       }
   } // jqueryCalendarWeekInit

   function jqueryIconFile($sModule)
   {
       if ('calendar' == $sModule)
       {
           if (isset($this->arr_buttons['bcalendario']) && isset($this->arr_buttons['bcalendario']['type']) && 'image' == $this->arr_buttons['bcalendario']['type'])
           {
               $sImage = $this->arr_buttons['bcalendario']['image'];
           }
       }
       elseif ('calculator' == $sModule)
       {
           if (isset($this->arr_buttons['bcalculadora']) && isset($this->arr_buttons['bcalculadora']['type']) && 'image' == $this->arr_buttons['bcalculadora']['type'])
           {
               $sImage = $this->arr_buttons['bcalculadora']['image'];
           }
       }

       return $this->Ini->path_icones . '/' . $sImage;
   } // jqueryIconFile


 function allowedCharsCharset($charlist)
 {
     if ($_SESSION['scriptcase']['charset'] != 'UTF-8')
     {
         $charlist = NM_conv_charset($charlist, $_SESSION['scriptcase']['charset'], 'UTF-8');
     }
     return str_replace("'", "\'", $charlist);
 }

 function new_date_format($type, $field)
 {
     $new_date_format = '';

     if ('DT' == $type)
     {
         $date_format  = $this->field_config[$field]['date_format'];
         $date_sep     = $this->field_config[$field]['date_sep'];
         $date_display = $this->field_config[$field]['date_display'];
         $time_format  = '';
         $time_sep     = '';
         $time_display = '';
     }
     elseif ('DH' == $type)
     {
         $date_format  = false !== strpos($this->field_config[$field]['date_format'] , ';') ? substr($this->field_config[$field]['date_format'] , 0, strpos($this->field_config[$field]['date_format'] , ';')) : $this->field_config[$field]['date_format'];
         $date_sep     = $this->field_config[$field]['date_sep'];
         $date_display = false !== strpos($this->field_config[$field]['date_display'], ';') ? substr($this->field_config[$field]['date_display'], 0, strpos($this->field_config[$field]['date_display'], ';')) : $this->field_config[$field]['date_display'];
         $time_format  = false !== strpos($this->field_config[$field]['date_format'] , ';') ? substr($this->field_config[$field]['date_format'] , strpos($this->field_config[$field]['date_format'] , ';') + 1) : '';
         $time_sep     = $this->field_config[$field]['time_sep'];
         $time_display = false !== strpos($this->field_config[$field]['date_display'], ';') ? substr($this->field_config[$field]['date_display'], strpos($this->field_config[$field]['date_display'], ';') + 1) : '';
     }
     elseif ('HH' == $type)
     {
         $date_format  = '';
         $date_sep     = '';
         $date_display = '';
         $time_format  = $this->field_config[$field]['date_format'];
         $time_sep     = $this->field_config[$field]['time_sep'];
         $time_display = $this->field_config[$field]['date_display'];
     }

     if ('DT' == $type || 'DH' == $type)
     {
         $date_array = array();
         $date_index = 0;
         $date_ult   = '';
         for ($i = 0; $i < strlen($date_format); $i++)
         {
             $char = strtolower(substr($date_format, $i, 1));
             if (in_array($char, array('d', 'm', 'y', 'a')))
             {
                 if ('a' == $char)
                 {
                     $char = 'y';
                 }
                 if ($char == $date_ult)
                 {
                     $date_array[$date_index] .= $char;
                 }
                 else
                 {
                     if ('' != $date_ult)
                     {
                         $date_index++;
                     }
                     $date_array[$date_index] = $char;
                 }
             }
             $date_ult = $char;
         }

         $disp_array = array();
         $date_index = 0;
         $date_ult   = '';
         for ($i = 0; $i < strlen($date_display); $i++)
         {
             $char = strtolower(substr($date_display, $i, 1));
             if (in_array($char, array('d', 'm', 'y', 'a')))
             {
                 if ('a' == $char)
                 {
                     $char = 'y';
                 }
                 if ($char == $date_ult)
                 {
                     $disp_array[$date_index] .= $char;
                 }
                 else
                 {
                     if ('' != $date_ult)
                     {
                         $date_index++;
                     }
                     $disp_array[$date_index] = $char;
                 }
             }
             $date_ult = $char;
         }

         $date_final = array();
         foreach ($date_array as $date_part)
         {
             if (in_array($date_part, $disp_array))
             {
                 $date_final[] = $date_part;
             }
         }

         $date_format = implode($date_sep, $date_final);
     }
     if ('HH' == $type || 'DH' == $type)
     {
         $time_array = array();
         $time_index = 0;
         $time_ult   = '';
         for ($i = 0; $i < strlen($time_format); $i++)
         {
             $char = strtolower(substr($time_format, $i, 1));
             if (in_array($char, array('h', 'i', 's')))
             {
                 if ($char == $time_ult)
                 {
                     $time_array[$time_index] .= $char;
                 }
                 else
                 {
                     if ('' != $time_ult)
                     {
                         $time_index++;
                     }
                     $time_array[$time_index] = $char;
                 }
             }
             $time_ult = $char;
         }

         $disp_array = array();
         $time_index = 0;
         $time_ult   = '';
         for ($i = 0; $i < strlen($time_display); $i++)
         {
             $char = strtolower(substr($time_display, $i, 1));
             if (in_array($char, array('h', 'i', 's')))
             {
                 if ($char == $time_ult)
                 {
                     $disp_array[$time_index] .= $char;
                 }
                 else
                 {
                     if ('' != $time_ult)
                     {
                         $time_index++;
                     }
                     $disp_array[$time_index] = $char;
                 }
             }
             $time_ult = $char;
         }

         $time_final = array();
         foreach ($time_array as $time_part)
         {
             if (in_array($time_part, $disp_array))
             {
                 $time_final[] = $time_part;
             }
         }

         $time_format = implode($time_sep, $time_final);
     }

     if ('DT' == $type)
     {
         $old_date_format = $date_format;
     }
     elseif ('DH' == $type)
     {
         $old_date_format = $date_format . ';' . $time_format;
     }
     elseif ('HH' == $type)
     {
         $old_date_format = $time_format;
     }

     for ($i = 0; $i < strlen($old_date_format); $i++)
     {
         $char = substr($old_date_format, $i, 1);
         if ('/' == $char)
         {
             $new_date_format .= $date_sep;
         }
         elseif (':' == $char)
         {
             $new_date_format .= $time_sep;
         }
         else
         {
             $new_date_format .= $char;
         }
     }

     $this->field_config[$field]['date_format'] = $new_date_format;
     if ('DH' == $type)
     {
         $new_date_format                                      = explode(';', $new_date_format);
         $this->field_config[$field]['date_format_js']        = $new_date_format[0];
         $this->field_config[$field . '_hora']['date_format'] = $new_date_format[1];
         $this->field_config[$field . '_hora']['time_sep']    = $this->field_config[$field]['time_sep'];
     }
 } // new_date_format

   function SC_fast_search($field, $arg_search, $data_search)
   {
      if (empty($data_search)) 
      {
          unset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_filter']);
          unset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['total']);
          unset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['fast_search']);
          if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_detal']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_detal'])) 
          {
              $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_filter'] = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_detal'];
          }
          if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['empty_filter']) && $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['empty_filter'])
          {
              unset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['empty_filter']);
              $this->NM_ajax_info['empty_filter'] = 'ok';
              validate_wastetransactions_mob_pack_ajax_response();
              exit;
          }
          return;
      }
      $comando = "";
      if ($_SESSION['scriptcase']['charset'] != "UTF-8" && NM_is_utf8($data_search))
      {
          $data_search = NM_conv_charset($data_search, $_SESSION['scriptcase']['charset'], "UTF-8");
      }
      $sv_data = $data_search;
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "wtid", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "wtProfilID", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "wtRequestDate", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $data_lookup = $this->SC_lookup_wtproducerbranchid($arg_search, $data_search);
          if (is_array($data_lookup) && !empty($data_lookup)) 
          {
              $this->SC_monta_condicao($comando, "wtProducerBranchID", $arg_search, $data_lookup);
          }
      }
      if ($field == "SC_all_Cmp") 
      {
          $data_lookup = $this->SC_lookup_wtproducerewc($arg_search, $data_search);
          if (is_array($data_lookup) && !empty($data_lookup)) 
          {
              $this->SC_monta_condicao($comando, "wtProducerEwc", $arg_search, $data_lookup);
          }
      }
      if ($field == "SC_all_Cmp") 
      {
          $data_lookup = $this->SC_lookup_wtproduceracceptweigth($arg_search, $data_search);
          if (is_array($data_lookup) && !empty($data_lookup)) 
          {
              $this->SC_monta_condicao($comando, "wtProducerAcceptWeigth", $arg_search, $data_lookup);
          }
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "wtProducerQty", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "wtPrducerm3", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "wtProducerRemarks", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "wtRequestDate", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $data_lookup = $this->SC_lookup_wtproducerbranchid($arg_search, $data_search);
          if (is_array($data_lookup) && !empty($data_lookup)) 
          {
              $this->SC_monta_condicao($comando, "wtProducerBranchID", $arg_search, $data_lookup);
          }
      }
      if ($field == "SC_all_Cmp") 
      {
          $data_lookup = $this->SC_lookup_wtproducerewc($arg_search, $data_search);
          if (is_array($data_lookup) && !empty($data_lookup)) 
          {
              $this->SC_monta_condicao($comando, "wtProducerEwc", $arg_search, $data_lookup);
          }
      }
      if ($field == "SC_all_Cmp") 
      {
          $data_lookup = $this->SC_lookup_wtproducerperiferia($arg_search, $data_search);
          if (is_array($data_lookup) && !empty($data_lookup)) 
          {
              $this->SC_monta_condicao($comando, "wtProducerPeriferia", $arg_search, $data_lookup);
          }
      }
      if ($field == "SC_all_Cmp") 
      {
          $data_lookup = $this->SC_lookup_wtproduceracceptweigth($arg_search, $data_search);
          if (is_array($data_lookup) && !empty($data_lookup)) 
          {
              $this->SC_monta_condicao($comando, "wtProducerAcceptWeigth", $arg_search, $data_lookup);
          }
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "wtProducerQty", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "wtPrducerm3", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "wtProducerSign", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "wtTransportDate", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "wtTransporterNumberID", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "wtTransporterVechicle", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $data_lookup = $this->SC_lookup_wttransporterid($arg_search, $data_search);
          if (is_array($data_lookup) && !empty($data_lookup)) 
          {
              $this->SC_monta_condicao($comando, "wtTransporterID", $arg_search, $data_lookup);
          }
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "EnvRegistrationNo_Transporter", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $data_lookup = $this->SC_lookup_wtwasteid($arg_search, $data_search);
          if (is_array($data_lookup) && !empty($data_lookup)) 
          {
              $this->SC_monta_condicao($comando, "wtWasteID", $arg_search, $data_lookup);
          }
      }
      if ($field == "SC_all_Cmp") 
      {
          $data_lookup = $this->SC_lookup_wtequipment($arg_search, $data_search);
          if (is_array($data_lookup) && !empty($data_lookup)) 
          {
              $this->SC_monta_condicao($comando, "wtequipment", $arg_search, $data_lookup);
          }
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "wtTransporterSign", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "wtFdestDate", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $data_lookup = $this->SC_lookup_wtfdestid($arg_search, $data_search);
          if (is_array($data_lookup) && !empty($data_lookup)) 
          {
              $this->SC_monta_condicao($comando, "wtFDestID", $arg_search, $data_lookup);
          }
      }
      if ($field == "SC_all_Cmp") 
      {
          $data_lookup = $this->SC_lookup_wtfdestperiferia($arg_search, $data_search);
          if (is_array($data_lookup) && !empty($data_lookup)) 
          {
              $this->SC_monta_condicao($comando, "wtFDestPeriferia", $arg_search, $data_lookup);
          }
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "EnvRegistrationNo_FDest", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $data_lookup = $this->SC_lookup_wtfdestewc($arg_search, $data_search);
          if (is_array($data_lookup) && !empty($data_lookup)) 
          {
              $this->SC_monta_condicao($comando, "wtFDestEWC", $arg_search, $data_lookup);
          }
      }
      if ($field == "SC_all_Cmp") 
      {
          $data_lookup = $this->SC_lookup_wtfdestrd($arg_search, $data_search);
          if (is_array($data_lookup) && !empty($data_lookup)) 
          {
              $this->SC_monta_condicao($comando, "wtFDestRD", $arg_search, $data_lookup);
          }
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "wtFDestQty", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "wtFDestM3", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "wtFDestSign", $arg_search, $data_search);
      }
      if ($field == "SC_all_Cmp") 
      {
          $this->SC_monta_condicao($comando, "wtProducerRemarks", $arg_search, $data_search);
      }
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_detal']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_detal']) && !empty($comando)) 
      {
          $comando = $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_detal'] . " and (" .  $comando . ")";
      }
      if (empty($comando)) 
      {
          $comando = " 1 <> 1 "; 
      }
      $sc_where = " where wtid = " . $_SESSION['glo_wtid'] . " AND wtProfilID = " . $_SESSION['ProfilID'] . " and (" . $comando . ")";
      $nmgp_select = "SELECT count(*) from " . $this->Ini->nm_tabela . $sc_where; 
      $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nmgp_select; 
      $rt = $this->Db->Execute($nmgp_select) ; 
      if ($rt === false && !$rt->EOF && $GLOBALS["NM_ERRO_IBASE"] != 1) 
      { 
          $this->Erro->mensagem (__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
          exit ; 
      }  
      $qt_geral_reg_validate_wastetransactions_mob = isset($rt->fields[0]) ? $rt->fields[0] - 1 : 0; 
      $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['total'] = $qt_geral_reg_validate_wastetransactions_mob;
      $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['where_filter'] = $comando;
      $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['fast_search'][0] = $field;
      $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['fast_search'][1] = $arg_search;
      $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['fast_search'][2] = $sv_data;
      $rt->Close(); 
      if (isset($rt->fields[0]) && $rt->fields[0] > 0 &&  isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['empty_filter']) && $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['empty_filter'])
      {
          unset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['empty_filter']);
          $this->NM_ajax_info['empty_filter'] = 'ok';
          validate_wastetransactions_mob_pack_ajax_response();
          exit;
      }
   }
   function SC_monta_condicao(&$comando, $nome, $condicao, $campo, $tp_campo="")
   {
      $nm_aspas   = "'";
      $nm_numeric = array();
      $Nm_datas   = array();
      $campo_join = strtolower(str_replace(".", "_", $nome));
      $nm_ini_lower = "";
      $nm_fim_lower = "";
      $nm_numeric[] = "wtid";$nm_numeric[] = "wtprofilid";$nm_numeric[] = "intnumber";$nm_numeric[] = "wtproducerbranchid";$nm_numeric[] = "wtproducerperiferia";$nm_numeric[] = "wtproduceracceptweigth";$nm_numeric[] = "wtproducerqty";$nm_numeric[] = "wtprducerm3";$nm_numeric[] = "wttransporterid";$nm_numeric[] = "wttransporterperiferiaid";$nm_numeric[] = "wttransportervalidate";$nm_numeric[] = "wtwasteid";$nm_numeric[] = "wtequipment";$nm_numeric[] = "wtfdestid";$nm_numeric[] = "wtfdestperiferia";$nm_numeric[] = "wtfdestqty";$nm_numeric[] = "wtfdestm3";$nm_numeric[] = "wtfdestvlidated";
      if (in_array($campo_join, $nm_numeric))
      {
         if ($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['decimal_db'] == ".")
         {
             $nm_aspas = "";
         }
         if (is_array($campo))
         {
             foreach ($campo as $Ind => $Cmp)
             {
                if (!is_numeric($Cmp))
                {
                    return;
                }
                if ($Cmp == "")
                {
                    $campo[$Ind] = 0;
                }
             }
         }
         else
         {
             if (!is_numeric($campo))
             {
                 return;
             }
             if ($campo == "")
             {
                $campo = 0;
             }
         }
      }
      $Nm_datas['wtrequestdate'] = "date";$Nm_datas['wttransportdate'] = "date";$Nm_datas['wtfdestdate'] = "date";
         if (isset($Nm_datas[$campo_join]))
         {
             for ($x = 0; $x < strlen($campo); $x++)
             {
                 $tst = substr($campo, $x, 1);
                 if (!is_numeric($tst) && ($tst != "-" && $tst != ":" && $tst != " "))
                 {
                     return;
                 }
             }
         }
      if (isset($Nm_datas[$campo_join]) && (strtoupper($condicao) == "II" || strtoupper($condicao) == "QP" || strtoupper($condicao) == "NP" || strtoupper($condicao) == "DF"))
      {
          if (strtoupper($condicao) == "DF")
          {
              $condicao = "NP";
          }
      }
         $comando .= (!empty($comando) ? " or " : "");
         if (is_array($campo))
         {
             $prep = "";
             foreach ($campo as $Ind => $Cmp)
             {
                 $prep .= (!empty($prep)) ? "," : "";
                 $Cmp   = substr($this->Db->qstr($Cmp), 1, -1);
                 $prep .= $nm_aspas . $Cmp . $nm_aspas;
             }
             $prep .= (empty($prep)) ? $nm_aspas . $nm_aspas : "";
             $comando .= $nm_ini_lower . $nome . $nm_fim_lower . " in (" . $prep . ")";
             return;
         }
         $campo  = substr($this->Db->qstr($campo), 1, -1);
         switch (strtoupper($condicao))
         {
            case "EQ":     // 
               $comando        .= $nm_ini_lower . $nome . $nm_fim_lower . " = " . $nm_aspas . $campo . $nm_aspas;
            break;
            case "II":     // 
               $comando        .= $nm_ini_lower . $nome . $nm_fim_lower . " like '" . $campo . "%'";
            break;
            case "QP":     // 
               $comando        .= $nm_ini_lower . $nome . $nm_fim_lower ." like '%" . $campo . "%'";
            break;
            case "NP":     // 
               $comando        .= $nm_ini_lower . $nome . $nm_fim_lower ." not like '%" . $campo . "%'";
            break;
            case "DF":     // 
               $comando        .= $nm_ini_lower . $nome . $nm_fim_lower . " <> " . $nm_aspas . $campo . $nm_aspas;
            break;
            case "GT":     // 
               $comando        .= " $nome > " . $nm_aspas . $campo . $nm_aspas;
            break;
            case "GE":     // 
               $comando        .= " $nome >= " . $nm_aspas . $campo . $nm_aspas;
            break;
            case "LT":     // 
               $comando        .= " $nome < " . $nm_aspas . $campo . $nm_aspas;
            break;
            case "LE":     // 
               $comando        .= " $nome <= " . $nm_aspas . $campo . $nm_aspas;
            break;
         }
   }
   function SC_lookup_wtproducerbranchid($condicao, $campo)
   {
       return false;
   }
   function SC_lookup_wtproducerewc($condicao, $campo)
   {
       $result = array();
       $campo  = substr($this->Db->qstr($campo), 1, -1);
       $nm_comando = "SELECT EWC, producerbranchid FROM producerewcbranch WHERE (EWC LIKE '%$campo%')" ; 
       if ($condicao == "ii")
       {
           $nm_comando = str_replace("LIKE '%$campo%'", "LIKE '$campo%'", $nm_comando);
       }
       if ($condicao == "df" || $condicao == "np")
       {
           $nm_comando = str_replace("LIKE '%$campo%'", "NOT LIKE '%$campo%'", $nm_comando);
       }
       if ($condicao == "gt")
       {
           $nm_comando = str_replace("LIKE '%$campo%'", "> '$campo'", $nm_comando);
       }
       if ($condicao == "ge")
       {
           $nm_comando = str_replace("LIKE '%$campo%'", ">= '$campo'", $nm_comando);
       }
       if ($condicao == "lt")
       {
           $nm_comando = str_replace("LIKE '%$campo%'", "< '$campo'", $nm_comando);
       }
       if ($condicao == "le")
       {
           $nm_comando = str_replace("LIKE '%$campo%'", "<= '$campo'", $nm_comando);
       }
       $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando; 
       $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
       if ($rx = $this->Db->Execute($nm_comando)) 
       { 
           while (!$rx->EOF) 
           { 
               $chave = $rx->fields[1];
               $label = $rx->fields[0];
               if ($condicao == "eq" && $campo == $label)
               {
                   $result[] = $chave;
               }
               if ($condicao == "ii" && $campo == substr($label, 0, strlen($campo)))
               {
                   $result[] = $chave;
               }
               if ($condicao == "qp" && strstr($label, $campo))
               {
                   $result[] = $chave;
               }
               if ($condicao == "np" && !strstr($label, $campo))
               {
                   $result[] = $chave;
               }
               if ($condicao == "df" && $campo != $label)
               {
                   $result[] = $chave;
               }
               if ($condicao == "gt" && $label > $campo )
               {
                   $result[] = $chave;
               }
               if ($condicao == "ge" && $label >= $campo)
               {
                   $result[] = $chave;
               }
               if ($condicao == "lt" && $label < $campo)
               {
                   $result[] = $chave;
               }
               if ($condicao == "le" && $label <= $campo)
               {
                   $result[] = $chave;
               }
               $rx->MoveNext() ;
           }  
           return $result;
       }  
       elseif ($GLOBALS["NM_ERRO_IBASE"] != 1)  
       { 
           $this->Erro->mensagem(__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
           exit; 
       } 
   }
   function SC_lookup_wtproduceracceptweigth($condicao, $campo)
   {
       $data_look = array();
       $campo  = substr($this->Db->qstr($campo), 1, -1);
       $data_look['1'] = "Αποδέχομαι το βάρος του παραλήτη ";
       $result = array();
       foreach ($data_look as $chave => $label) 
       {
           if ($condicao == "eq" && $campo == $label)
           {
               $result[] = $chave;
           }
           if ($condicao == "ii" && $campo == substr($label, 0, strlen($campo)))
           {
               $result[] = $chave;
           }
           if ($condicao == "qp" && strstr($label, $campo))
           {
               $result[] = $chave;
           }
           if ($condicao == "np" && !strstr($label, $campo))
           {
               $result[] = $chave;
           }
           if ($condicao == "df" && $campo != $label)
           {
               $result[] = $chave;
           }
           if ($condicao == "gt" && $label > $campo )
           {
               $result[] = $chave;
           }
           if ($condicao == "ge" && $label >= $campo)
            {
               $result[] = $chave;
           }
           if ($condicao == "lt" && $label < $campo)
           {
               $result[] = $chave;
           }
           if ($condicao == "le" && $label <= $campo)
           {
               $result[] = $chave;
           }
          
       }
       return $result;
   }
function nmgp_redireciona($tipo=0)
{
   global $nm_apl_dependente;
   if (isset($_SESSION['scriptcase']['nm_sc_retorno']) && !empty($_SESSION['scriptcase']['nm_sc_retorno']) && $_SESSION['scriptcase']['sc_tp_saida'] != "D" && $nm_apl_dependente != 1) 
   {
       $nmgp_saida_form = $_SESSION['scriptcase']['nm_sc_retorno'];
   }
   else
   {
       $nmgp_saida_form = $_SESSION['scriptcase']['sc_url_saida'][$this->Ini->sc_page];
   }
   if ($tipo == 2 && isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['sc_outra_jan']) && $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['sc_outra_jan'])
   {
       $nmgp_saida_form = "validate_wastetransactions_mob_fim.php";
   }
   if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['redir']) && $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['redir'] == 'redir')
   {
       unset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']);
   }
   unset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['opc_ant']);
   $diretorio = explode("/", $nmgp_saida_form);
   $cont = count($diretorio);
   $apl = $diretorio[$cont - 1];
   $apl = str_replace(".php", "", $apl);
   $pos = strpos($apl, "?");
   if ($pos !== false)
   {
       $apl = substr($apl, 0, $pos);
   }
   if ($tipo != 1 && $tipo != 2)
   {
       unset($_SESSION['sc_session'][$this->Ini->sc_page][$apl]['where_orig']);
   }
   if ($this->NM_ajax_flag)
   {
       $this->NM_ajax_info['redir']['metodo']              = 'post';
       $this->NM_ajax_info['redir']['action']              = $nmgp_saida_form;
       $this->NM_ajax_info['redir']['target']              = '_self';
       $this->NM_ajax_info['redir']['script_case_init']    = $this->Ini->sc_page;
       $this->NM_ajax_info['redir']['script_case_session'] = session_id();
       if (0 == $tipo)
       {
           $this->NM_ajax_info['redir']['nmgp_url_saida'] = $this->nm_location;
       }
       validate_wastetransactions_mob_pack_ajax_response();
       exit;
   }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">

   <HTML>
   <HEAD>
    <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'] ?>" />
<?php

   if (isset($_SESSION['scriptcase']['device_mobile']) && $_SESSION['scriptcase']['device_mobile'] && $_SESSION['scriptcase']['display_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"/>
   </HEAD>
   <BODY>
   <FORM name="form_ok" method="POST" action="<?php echo NM_encode_input($nmgp_saida_form); ?>" target="_self">
<?php
   if ($tipo == 0)
   {
?>
     <INPUT type="hidden" name="nmgp_url_saida" value="<?php echo NM_encode_input($this->nm_location); ?>"> 
<?php
   }
?>
     <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()); ?>"> 
   </FORM>
   <SCRIPT type="text/javascript">
      bLigEditLookupCall = <?php if ($this->lig_edit_lookup_call) { ?>true<?php } else { ?>false<?php } ?>;
      function scLigEditLookupCall()
      {
<?php
   if ($this->lig_edit_lookup && isset($_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['sc_modal']) && $_SESSION['sc_session'][$this->Ini->sc_page]['validate_wastetransactions_mob']['sc_modal'])
   {
?>
        parent.<?php echo $this->lig_edit_lookup_cb; ?>(<?php echo $this->lig_edit_lookup_row; ?>);
<?php
   }
   elseif ($this->lig_edit_lookup)
   {
?>
        opener.<?php echo $this->lig_edit_lookup_cb; ?>(<?php echo $this->lig_edit_lookup_row; ?>);
<?php
   }
?>
      }
      if (bLigEditLookupCall)
      {
        scLigEditLookupCall();
      }
      document.form_ok.submit();
   </SCRIPT>
   </BODY>
   </HTML>
<?php
  exit;
}
    function sc_field_readonly($sField, $sStatus, $iSeq = '')
    {
        if ('on' != $sStatus && 'off' != $sStatus)
        {
            return;
        }

        $sFieldDateTime = '';

        $sFlagVar        = 'bFlagRead_' . $sField;
        $this->$sFlagVar = 'on' == $sStatus;

        $this->nmgp_cmp_readonly[$sField]                = $sStatus;
        $this->NM_ajax_info['readOnly'][$sField . $iSeq] = $sStatus;
        if ('' != $sFieldDateTime)
        {
            $this->NM_ajax_info['readOnly'][$sFieldDateTime . $iSeq] = $sStatus;
        }
    } // sc_field_readonly
}
?>
