<?php
//
class dye_standdf_form_apl
{
   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(),
                                'navPage'        => 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'  => '',
                               );
   var $Nav_permite_ava = true;
   var $Nav_permite_ret = true;
   var $Apl_com_erro    = false;
   var $Ini;
   var $Erro;
   var $Db;
   var $number;
   var $date;
   var $gs;
   var $as;
   var $ae;
   var $gs1;
   var $as1;
   var $ae1;
   var $gs2;
   var $as2;
   var $ae2;
   var $gs3;
   var $as3;
   var $ae3;
   var $gs4;
   var $as4;
   var $ae4;
   var $gs5;
   var $as5;
   var $ae5;
   var $fs;
   var $frame;
   var $cpi;
   var $wpi;
   var $spec1;
   var $spec2;
   var $spec3;
   var $finish;
   var $fin_no;
   var $gryield;
   var $fyield;
   var $put_up;
   var $fab1;
   var $fab2;
   var $fwidth;
   var $panels;
   var $rollsize;
   var $tubesize;
   var $fold;
   var $cases;
   var $id2;
   var $finno2;
   var $finno2_1;
   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']['ae']))
          {
              $this->ae = $this->NM_ajax_info['param']['ae'];
          }
          if (isset($this->NM_ajax_info['param']['ae1']))
          {
              $this->ae1 = $this->NM_ajax_info['param']['ae1'];
          }
          if (isset($this->NM_ajax_info['param']['ae2']))
          {
              $this->ae2 = $this->NM_ajax_info['param']['ae2'];
          }
          if (isset($this->NM_ajax_info['param']['ae3']))
          {
              $this->ae3 = $this->NM_ajax_info['param']['ae3'];
          }
          if (isset($this->NM_ajax_info['param']['ae4']))
          {
              $this->ae4 = $this->NM_ajax_info['param']['ae4'];
          }
          if (isset($this->NM_ajax_info['param']['ae5']))
          {
              $this->ae5 = $this->NM_ajax_info['param']['ae5'];
          }
          if (isset($this->NM_ajax_info['param']['as']))
          {
              $this->as = $this->NM_ajax_info['param']['as'];
          }
          if (isset($this->NM_ajax_info['param']['as1']))
          {
              $this->as1 = $this->NM_ajax_info['param']['as1'];
          }
          if (isset($this->NM_ajax_info['param']['as2']))
          {
              $this->as2 = $this->NM_ajax_info['param']['as2'];
          }
          if (isset($this->NM_ajax_info['param']['as3']))
          {
              $this->as3 = $this->NM_ajax_info['param']['as3'];
          }
          if (isset($this->NM_ajax_info['param']['as4']))
          {
              $this->as4 = $this->NM_ajax_info['param']['as4'];
          }
          if (isset($this->NM_ajax_info['param']['as5']))
          {
              $this->as5 = $this->NM_ajax_info['param']['as5'];
          }
          if (isset($this->NM_ajax_info['param']['cases']))
          {
              $this->cases = $this->NM_ajax_info['param']['cases'];
          }
          if (isset($this->NM_ajax_info['param']['cpi']))
          {
              $this->cpi = $this->NM_ajax_info['param']['cpi'];
          }
          if (isset($this->NM_ajax_info['param']['date']))
          {
              $this->date = $this->NM_ajax_info['param']['date'];
          }
          if (isset($this->NM_ajax_info['param']['fab1']))
          {
              $this->fab1 = $this->NM_ajax_info['param']['fab1'];
          }
          if (isset($this->NM_ajax_info['param']['fab2']))
          {
              $this->fab2 = $this->NM_ajax_info['param']['fab2'];
          }
          if (isset($this->NM_ajax_info['param']['fin_no']))
          {
              $this->fin_no = $this->NM_ajax_info['param']['fin_no'];
          }
          if (isset($this->NM_ajax_info['param']['finish']))
          {
              $this->finish = $this->NM_ajax_info['param']['finish'];
          }
          if (isset($this->NM_ajax_info['param']['finno2']))
          {
              $this->finno2 = $this->NM_ajax_info['param']['finno2'];
          }
          if (isset($this->NM_ajax_info['param']['fold']))
          {
              $this->fold = $this->NM_ajax_info['param']['fold'];
          }
          if (isset($this->NM_ajax_info['param']['frame']))
          {
              $this->frame = $this->NM_ajax_info['param']['frame'];
          }
          if (isset($this->NM_ajax_info['param']['fs']))
          {
              $this->fs = $this->NM_ajax_info['param']['fs'];
          }
          if (isset($this->NM_ajax_info['param']['fwidth']))
          {
              $this->fwidth = $this->NM_ajax_info['param']['fwidth'];
          }
          if (isset($this->NM_ajax_info['param']['fyield']))
          {
              $this->fyield = $this->NM_ajax_info['param']['fyield'];
          }
          if (isset($this->NM_ajax_info['param']['gryield']))
          {
              $this->gryield = $this->NM_ajax_info['param']['gryield'];
          }
          if (isset($this->NM_ajax_info['param']['gs']))
          {
              $this->gs = $this->NM_ajax_info['param']['gs'];
          }
          if (isset($this->NM_ajax_info['param']['gs1']))
          {
              $this->gs1 = $this->NM_ajax_info['param']['gs1'];
          }
          if (isset($this->NM_ajax_info['param']['gs2']))
          {
              $this->gs2 = $this->NM_ajax_info['param']['gs2'];
          }
          if (isset($this->NM_ajax_info['param']['gs3']))
          {
              $this->gs3 = $this->NM_ajax_info['param']['gs3'];
          }
          if (isset($this->NM_ajax_info['param']['gs4']))
          {
              $this->gs4 = $this->NM_ajax_info['param']['gs4'];
          }
          if (isset($this->NM_ajax_info['param']['gs5']))
          {
              $this->gs5 = $this->NM_ajax_info['param']['gs5'];
          }
          if (isset($this->NM_ajax_info['param']['id2']))
          {
              $this->id2 = $this->NM_ajax_info['param']['id2'];
          }
          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_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']['number']))
          {
              $this->number = $this->NM_ajax_info['param']['number'];
          }
          if (isset($this->NM_ajax_info['param']['panels']))
          {
              $this->panels = $this->NM_ajax_info['param']['panels'];
          }
          if (isset($this->NM_ajax_info['param']['put_up']))
          {
              $this->put_up = $this->NM_ajax_info['param']['put_up'];
          }
          if (isset($this->NM_ajax_info['param']['rollsize']))
          {
              $this->rollsize = $this->NM_ajax_info['param']['rollsize'];
          }
          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']['spec1']))
          {
              $this->spec1 = $this->NM_ajax_info['param']['spec1'];
          }
          if (isset($this->NM_ajax_info['param']['spec2']))
          {
              $this->spec2 = $this->NM_ajax_info['param']['spec2'];
          }
          if (isset($this->NM_ajax_info['param']['spec3']))
          {
              $this->spec3 = $this->NM_ajax_info['param']['spec3'];
          }
          if (isset($this->NM_ajax_info['param']['tubesize']))
          {
              $this->tubesize = $this->NM_ajax_info['param']['tubesize'];
          }
          if (isset($this->NM_ajax_info['param']['wpi']))
          {
              $this->wpi = $this->NM_ajax_info['param']['wpi'];
          }
          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($_SESSION['sc_session'][$script_case_init]['dye_standdf_form']['embutida_parms']))
      { 
          $this->nmgp_parms = $_SESSION['sc_session'][$script_case_init]['dye_standdf_form']['embutida_parms'];
          unset($_SESSION['sc_session'][$script_case_init]['dye_standdf_form']['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_dye_standdf_form($cadapar[1]);
                 $this->$cadapar[0] = $cadapar[1];
             }
             $ix++;
          }
          if (isset($this->NM_where_filter_form))
          {
              $_SESSION['sc_session'][$script_case_init]['dye_standdf_form']['where_filter_form'] = $this->NM_where_filter_form;
             unset($_SESSION['sc_session'][$script_case_init]['dye_standdf_form']['total']);
          }
          if (isset($this->sc_redir_atualiz))
          {
              $_SESSION['sc_session'][$script_case_init]['dye_standdf_form']['sc_redir_atualiz'] = $this->sc_redir_atualiz;
          }
          if (isset($this->sc_redir_insert))
          {
              $_SESSION['sc_session'][$script_case_init]['dye_standdf_form']['sc_redir_insert'] = $this->sc_redir_insert;
          }
      } 
      elseif (isset($script_case_init) && !empty($script_case_init) && isset($_SESSION['sc_session'][$script_case_init]['dye_standdf_form']['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]['dye_standdf_form']['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]['dye_standdf_form']['lig_edit_lookup']     = true;
          $_SESSION['sc_session'][$script_case_init]['dye_standdf_form']['lig_edit_lookup_cb']  = $this->nm_evt_ret_edit;
          $_SESSION['sc_session'][$script_case_init]['dye_standdf_form']['lig_edit_lookup_row'] = isset($this->nm_evt_ret_row) ? $this->nm_evt_ret_row : '';
      }
      if (isset($_SESSION['sc_session'][$script_case_init]['dye_standdf_form']['lig_edit_lookup']) && $_SESSION['sc_session'][$script_case_init]['dye_standdf_form']['lig_edit_lookup'])
      {
          $this->lig_edit_lookup     = true;
          $this->lig_edit_lookup_cb  = $_SESSION['sc_session'][$script_case_init]['dye_standdf_form']['lig_edit_lookup_cb'];
          $this->lig_edit_lookup_row = $_SESSION['sc_session'][$script_case_init]['dye_standdf_form']['lig_edit_lookup_row'];
      }
      if (!$this->Ini)
      { 
          $this->Ini = new dye_standdf_form_ini(); 
          $this->Ini->init();
      } 
      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 . '.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;



      $_SESSION['scriptcase']['error_icon']['dye_standdf_form']  = "<img src=\"" . $this->Ini->path_icones . "/scriptcase__NM__icnMensagemAlerta.png\" style=\"border-width: 0px\" align=\"top\">&nbsp;";
      $_SESSION['scriptcase']['error_close']['dye_standdf_form'] = "<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]['dye_standdf_form']['embutida_proc']) ? $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['embutida_proc'] : $this->Embutida_proc;
      $this->Embutida_form = isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['embutida_form']) ? $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['embutida_form'] : $this->Embutida_form;
      $this->Embutida_call = isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['embutida_call']) ? $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['embutida_call'] : $this->Embutida_call;

      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['embutida_liga_grid_edit']) && '' != $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['embutida_liga_grid_edit'])
      {
          $this->Grid_editavel = ('on' == $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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]['dye_standdf_form']['embutida_multi']) && $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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]['dye_standdf_form']['embutida_liga_tp_pag']) && '' != $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['embutida_liga_tp_pag'])
      {
          $this->form_paginacao = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['embutida_liga_tp_pag'];
      }

      if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['embutida_form']) || '' == $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['embutida_form'])
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['embutida_form'] = $this->Embutida_form;
      }
      if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['embutida_liga_grid_edit']) || '' == $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['embutida_liga_grid_edit'])
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['embutida_liga_grid_edit'] = $this->Grid_editavel ? 'on' : 'off';
      }
      if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['embutida_liga_grid_edit']) || '' == $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['embutida_liga_grid_edit'])
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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 ;

      $this->loadFieldConfig();

      if ($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['first_time'])
      {
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['insert']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['new']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['update']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['delete']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['first']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['back']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['forward']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['last']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['qsearch']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['summary']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['navpage']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['goto']);
      }
      if (isset($this->NM_btn_insert) && '' != $this->NM_btn_insert && (!isset($_SESSION['scriptcase']['sc_apl_conf']['dye_standdf_form']['insert']) || '' == $_SESSION['scriptcase']['sc_apl_conf']['dye_standdf_form']['insert']))
      {
          if ('N' == $this->NM_btn_insert)
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['insert'] = 'off';
          }
          else
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['insert'] = 'on';
          }
      }
      if (isset($this->NM_btn_new) && 'N' == $this->NM_btn_new)
      {
          $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['new'] = 'off';
      }
      if (isset($this->NM_btn_update) && '' != $this->NM_btn_update && (!isset($_SESSION['scriptcase']['sc_apl_conf']['dye_standdf_form']['update']) || '' == $_SESSION['scriptcase']['sc_apl_conf']['dye_standdf_form']['update']))
      {
          if ('N' == $this->NM_btn_update)
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['update'] = 'off';
          }
          else
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['update'] = 'on';
          }
      }
      if (isset($this->NM_btn_delete) && '' != $this->NM_btn_delete && (!isset($_SESSION['scriptcase']['sc_apl_conf']['dye_standdf_form']['delete']) || '' == $_SESSION['scriptcase']['sc_apl_conf']['dye_standdf_form']['delete']))
      {
          if ('N' == $this->NM_btn_delete)
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['delete'] = 'off';
          }
          else
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['delete'] = 'on';
          }
      }
      if (isset($this->NM_btn_navega) && '' != $this->NM_btn_navega)
      {
          if ('N' == $this->NM_btn_navega)
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['first']   = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['back']    = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['forward'] = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['last']    = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['qsearch'] = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['summary'] = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['navpage'] = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['goto']    = 'off';
          }
          else
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['first']   = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['back']    = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['forward'] = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['last']    = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['qsearch'] = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['summary'] = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['navpage'] = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['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'] = "on";
      $this->nmgp_botoes['goto'] = "on";
      $this->nmgp_botoes['qtline'] = "off";
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['iframe_filtro']) && $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['iframe_filtro'] == "S")
      {
          $this->nmgp_botoes['exit'] = "off";
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf']['dye_standdf_form']['btn_display']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['dye_standdf_form']['btn_display']))
      {
          foreach ($_SESSION['scriptcase']['sc_apl_conf']['dye_standdf_form']['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']['dye_standdf_form']['insert']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['insert'] != '')
      {
          $this->nmgp_botoes['new']    = $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['insert'];
          $this->nmgp_botoes['insert'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['insert'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['new']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['new'] != '')
      {
          $this->nmgp_botoes['new']    = $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['new'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['update']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['update'] != '')
      {
          $this->nmgp_botoes['update'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['update'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['delete']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['delete'] != '')
      {
          $this->nmgp_botoes['delete'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['delete'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['first']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['first'] != '')
      {
          $this->nmgp_botoes['first'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['first'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['back']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['back'] != '')
      {
          $this->nmgp_botoes['back'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['back'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['forward']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['forward'] != '')
      {
          $this->nmgp_botoes['forward'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['forward'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['last']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['last'] != '')
      {
          $this->nmgp_botoes['last'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['last'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['qsearch']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['qsearch'] != '')
      {
          $this->nmgp_botoes['qsearch'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['qsearch'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['summary']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['summary'] != '')
      {
          $this->nmgp_botoes['summary'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['summary'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['navpage']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['navpage'] != '')
      {
          $this->nmgp_botoes['navpage'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['navpage'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['goto']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['goto'] != '')
      {
          $this->nmgp_botoes['goto'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['dye_standdf_form']['goto'];
      }

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

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

      if (isset($_SESSION['scriptcase']['sc_apl_conf']['dye_standdf_form']['field_display']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['dye_standdf_form']['field_display']))
      {
          foreach ($_SESSION['scriptcase']['sc_apl_conf']['dye_standdf_form']['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']['dye_standdf_form']['field_readonly']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['dye_standdf_form']['field_readonly']))
      {
          foreach ($_SESSION['scriptcase']['sc_apl_conf']['dye_standdf_form']['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']['dye_standdf_form']['exit']) && $_SESSION['scriptcase']['sc_apl_conf']['dye_standdf_form']['exit'] != '')
      {
          $_SESSION['scriptcase']['sc_url_saida'][$this->Ini->sc_page] = $_SESSION['scriptcase']['sc_apl_conf']['dye_standdf_form']['exit'];
      }
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['dados_form']))
      {
          $this->nmgp_dados_form = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['dados_form'];
          if (!isset($this->id2)){$this->id2 = $this->nmgp_dados_form['id2'];} 
      }
      $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("dye_standdf_form", $apls_aba))
              {
                  $this->aba_iframe = true;
                  break;
              }
          }
      }
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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") ; 
      $this->nm_data = new nm_data("en_us");
      if (isset($_GET['nm_cal_display']))
      {
          if ($this->Embutida_proc)
          { 
              include_once($this->Ini->path_embutida . 'dye_standdf_form/dye_standdf_form_calendar.php');
          }
          else
          { 
              include_once($this->Ini->path_aplicacao . 'dye_standdf_form_calendar.php');
          }
          exit;
      }

      if (is_file($this->Ini->path_aplicacao . 'dye_standdf_form_help.txt'))
      {
          $arr_link_webhelp = file($this->Ini->path_aplicacao . 'dye_standdf_form_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 . 'dye_standdf_form/dye_standdf_form_erro.class.php');
      }
      else
      { 
          require_once($this->Ini->path_aplicacao . "dye_standdf_form_erro.class.php"); 
      }
      $this->Erro      = new dye_standdf_form_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]['dye_standdf_form']['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]['dye_standdf_form']['opcao']))
         { 
             if ($this->number != "" || $this->id2 != "")   
             { 
                 $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['opcao'] = "igual" ;  
             }   
         }   
      } 
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['opcao']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['opcao']) && empty($this->nmgp_refresh_fields))
      {
          $this->nmgp_opcao = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['opcao'];  
          $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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']['dye_standdf_form']['start']) && $_SESSION['scriptcase']['sc_apl_conf']['dye_standdf_form']['start'] == 'new')
      {
          $this->nmgp_opcao = "novo";
          $this->nm_Start_new = true;
          $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['opcao'] = "novo";
          unset($_SESSION['scriptcase']['sc_apl_conf']['dye_standdf_form']['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]['dye_standdf_form']['opc_ant'];
      } 
      if ($this->nmgp_opcao == "recarga" || $this->nmgp_opcao == "muda_form")  
      {
          $this->nmgp_botoes = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['botoes'];
          $this->Nav_permite_ret = 0 != $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['inicio'];
          $this->Nav_permite_ava = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['total'] != $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['final'];
      }
      else
      {
      }
      $this->nm_flag_iframe = false;
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['dados_form'])) 
      {
         $this->nmgp_dados_form = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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->number)) { $this->nm_limpa_alfa($this->number); }
      if (isset($this->gs)) { $this->nm_limpa_alfa($this->gs); }
      if (isset($this->as)) { $this->nm_limpa_alfa($this->as); }
      if (isset($this->ae)) { $this->nm_limpa_alfa($this->ae); }
      if (isset($this->gs1)) { $this->nm_limpa_alfa($this->gs1); }
      if (isset($this->as1)) { $this->nm_limpa_alfa($this->as1); }
      if (isset($this->ae1)) { $this->nm_limpa_alfa($this->ae1); }
      if (isset($this->gs2)) { $this->nm_limpa_alfa($this->gs2); }
      if (isset($this->as2)) { $this->nm_limpa_alfa($this->as2); }
      if (isset($this->ae2)) { $this->nm_limpa_alfa($this->ae2); }
      if (isset($this->gs3)) { $this->nm_limpa_alfa($this->gs3); }
      if (isset($this->as3)) { $this->nm_limpa_alfa($this->as3); }
      if (isset($this->ae3)) { $this->nm_limpa_alfa($this->ae3); }
      if (isset($this->gs4)) { $this->nm_limpa_alfa($this->gs4); }
      if (isset($this->as4)) { $this->nm_limpa_alfa($this->as4); }
      if (isset($this->ae4)) { $this->nm_limpa_alfa($this->ae4); }
      if (isset($this->gs5)) { $this->nm_limpa_alfa($this->gs5); }
      if (isset($this->as5)) { $this->nm_limpa_alfa($this->as5); }
      if (isset($this->ae5)) { $this->nm_limpa_alfa($this->ae5); }
      if (isset($this->fs)) { $this->nm_limpa_alfa($this->fs); }
      if (isset($this->frame)) { $this->nm_limpa_alfa($this->frame); }
      if (isset($this->cpi)) { $this->nm_limpa_alfa($this->cpi); }
      if (isset($this->wpi)) { $this->nm_limpa_alfa($this->wpi); }
      if (isset($this->spec1)) { $this->nm_limpa_alfa($this->spec1); }
      if (isset($this->spec2)) { $this->nm_limpa_alfa($this->spec2); }
      if (isset($this->spec3)) { $this->nm_limpa_alfa($this->spec3); }
      if (isset($this->finish)) { $this->nm_limpa_alfa($this->finish); }
      if (isset($this->fin_no)) { $this->nm_limpa_alfa($this->fin_no); }
      if (isset($this->gryield)) { $this->nm_limpa_alfa($this->gryield); }
      if (isset($this->fyield)) { $this->nm_limpa_alfa($this->fyield); }
      if (isset($this->put_up)) { $this->nm_limpa_alfa($this->put_up); }
      if (isset($this->fab1)) { $this->nm_limpa_alfa($this->fab1); }
      if (isset($this->fab2)) { $this->nm_limpa_alfa($this->fab2); }
      if (isset($this->fwidth)) { $this->nm_limpa_alfa($this->fwidth); }
      if (isset($this->panels)) { $this->nm_limpa_alfa($this->panels); }
      if (isset($this->rollsize)) { $this->nm_limpa_alfa($this->rollsize); }
      if (isset($this->tubesize)) { $this->nm_limpa_alfa($this->tubesize); }
      if (isset($this->fold)) { $this->nm_limpa_alfa($this->fold); }
      if (isset($this->cases)) { $this->nm_limpa_alfa($this->cases); }
      $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]['dye_standdf_form']['opc_edit'] = true;  
     if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['dados_select'])) 
     {
        $this->nmgp_dados_select = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['dados_select'];
     }
   }

   function loadFieldConfig()
   {
      $this->field_config = array();
      //-- number
      $this->field_config['number']               = array();
      $this->field_config['number']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['number']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['number']['symbol_dec'] = '';
      $this->field_config['number']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['number']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- date
      $this->field_config['date']                 = array();
      $this->field_config['date']['date_format']  = $_SESSION['scriptcase']['reg_conf']['date_format'];
      $this->field_config['date']['date_sep']     = $_SESSION['scriptcase']['reg_conf']['date_sep'];
      $this->field_config['date']['date_display'] = "ddmmaaaa";
      $this->new_date_format('DT', 'date');
      //-- fwidth
      $this->field_config['fwidth']               = array();
      $this->field_config['fwidth']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['fwidth']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['fwidth']['symbol_dec'] = '';
      $this->field_config['fwidth']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['fwidth']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- panels
      $this->field_config['panels']               = array();
      $this->field_config['panels']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['panels']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['panels']['symbol_dec'] = '';
      $this->field_config['panels']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['panels']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- rollsize
      $this->field_config['rollsize']               = array();
      $this->field_config['rollsize']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['rollsize']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['rollsize']['symbol_dec'] = '';
      $this->field_config['rollsize']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['rollsize']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- tubesize
      $this->field_config['tubesize']               = array();
      $this->field_config['tubesize']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['tubesize']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['tubesize']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['tubesize']['symbol_mon'] = '';
      $this->field_config['tubesize']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['tubesize']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- id2
      $this->field_config['id2']               = array();
      $this->field_config['id2']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['id2']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['id2']['symbol_dec'] = '';
      $this->field_config['id2']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['id2']['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['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();
          $this->nm_converte_datas();

          $_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 && 'validate_' == substr($this->NM_ajax_opcao, 0, 9))
      {
          if ('validate_number' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'number');
          }
          if ('validate_date' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'date');
          }
          if ('validate_gs' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'gs');
          }
          if ('validate_fs' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'fs');
          }
          if ('validate_frame' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'frame');
          }
          if ('validate_fwidth' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'fwidth');
          }
          if ('validate_panels' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'panels');
          }
          if ('validate_cpi' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'cpi');
          }
          if ('validate_wpi' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'wpi');
          }
          if ('validate_gryield' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'gryield');
          }
          if ('validate_fyield' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'fyield');
          }
          if ('validate_finno2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'finno2');
          }
          if ('validate_finish' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'finish');
          }
          if ('validate_fin_no' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'fin_no');
          }
          if ('validate_put_up' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'put_up');
          }
          if ('validate_rollsize' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'rollsize');
          }
          if ('validate_tubesize' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'tubesize');
          }
          if ('validate_fold' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'fold');
          }
          if ('validate_cases' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'cases');
          }
          if ('validate_spec1' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'spec1');
          }
          if ('validate_spec2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'spec2');
          }
          if ('validate_spec3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'spec3');
          }
          if ('validate_fab1' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'fab1');
          }
          if ('validate_fab2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'fab2');
          }
          if ('validate_as' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'as');
          }
          if ('validate_ae' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'ae');
          }
          if ('validate_gs1' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'gs1');
          }
          if ('validate_as1' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'as1');
          }
          if ('validate_ae1' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'ae1');
          }
          if ('validate_gs2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'gs2');
          }
          if ('validate_as2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'as2');
          }
          if ('validate_ae2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'ae2');
          }
          if ('validate_gs3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'gs3');
          }
          if ('validate_as3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'as3');
          }
          if ('validate_ae3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'ae3');
          }
          if ('validate_gs4' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'gs4');
          }
          if ('validate_as4' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'as4');
          }
          if ('validate_ae4' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'ae4');
          }
          if ('validate_gs5' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'gs5');
          }
          if ('validate_as5' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'as5');
          }
          if ('validate_ae5' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'ae5');
          }
          dye_standdf_form_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_finno2_onchange' == $this->NM_ajax_opcao)
          {
              $this->FinNo2_onChange();
          }
          dye_standdf_form_pack_ajax_response();
          exit;
      }
      if (isset($this->sc_inline_call) && 'Y' == $this->sc_inline_call)
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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") 
      {
          $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();
              dye_standdf_form_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']['dye_standdf_form']['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)
              {
                  dye_standdf_form_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]['dye_standdf_form']['recarga'] = $this->nmgp_opcao;
          if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['sc_redir_insert']) && $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['sc_redir_insert'] == "ok")
          {
              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 (isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['sc_redir_atualiz']) && $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['sc_redir_atualiz'] == "ok")
          {
              if ($this->sc_evento == "update")
              {
                  $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();
          dye_standdf_form_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']);
          }
          dye_standdf_form_pack_ajax_response();
          exit;
      }
      $this->nm_gera_html();
      $this->NM_close_db(); 
      $this->nmgp_opcao = ""; 
   }
//
//--------------------------------------------------------------------------------------
   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;
       } 
   }
//
//--------------------------------------------------------------------------------------
   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_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 'number':
               return "NUMBER";
               break;
           case 'date':
               return "DATE";
               break;
           case 'gs':
               return "GS";
               break;
           case 'fs':
               return "FS";
               break;
           case 'frame':
               return "FRAME";
               break;
           case 'fwidth':
               return "FWIDTH";
               break;
           case 'panels':
               return "PANELS";
               break;
           case 'cpi':
               return "CPI";
               break;
           case 'wpi':
               return "WPI";
               break;
           case 'gryield':
               return "GRYIELD";
               break;
           case 'fyield':
               return "FYIELD";
               break;
           case 'finno2':
               return "";
               break;
           case 'finish':
               return "FINISH";
               break;
           case 'fin_no':
               return "FIN NO";
               break;
           case 'put_up':
               return "PUT UP";
               break;
           case 'rollsize':
               return "ROLLSIZE";
               break;
           case 'tubesize':
               return "TUBESIZE";
               break;
           case 'fold':
               return "FOLD";
               break;
           case 'cases':
               return "CASES";
               break;
           case 'spec1':
               return "SPEC1";
               break;
           case 'spec2':
               return "SPEC2";
               break;
           case 'spec3':
               return "SPEC3";
               break;
           case 'fab1':
               return "FAB1";
               break;
           case 'fab2':
               return "FAB2";
               break;
           case 'as':
               return "AS";
               break;
           case 'ae':
               return "AE";
               break;
           case 'gs1':
               return "GS1";
               break;
           case 'as1':
               return "AS1";
               break;
           case 'ae1':
               return "AE1";
               break;
           case 'gs2':
               return "GS2";
               break;
           case 'as2':
               return "AS2";
               break;
           case 'ae2':
               return "AE2";
               break;
           case 'gs3':
               return "GS3";
               break;
           case 'as3':
               return "AS3";
               break;
           case 'ae3':
               return "AE3";
               break;
           case 'gs4':
               return "GS4";
               break;
           case 'as4':
               return "AS4";
               break;
           case 'ae4':
               return "AE4";
               break;
           case 'gs5':
               return "GS5";
               break;
           case 'as5':
               return "AS5";
               break;
           case 'ae5':
               return "AE5";
               break;
           case 'id2':
               return "ID2";
               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 || 'number' == $filtro)
        $this->ValidateField_number($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'date' == $filtro)
        $this->ValidateField_date($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'gs' == $filtro)
        $this->ValidateField_gs($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'fs' == $filtro)
        $this->ValidateField_fs($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'frame' == $filtro)
        $this->ValidateField_frame($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'fwidth' == $filtro)
        $this->ValidateField_fwidth($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'panels' == $filtro)
        $this->ValidateField_panels($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'cpi' == $filtro)
        $this->ValidateField_cpi($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'wpi' == $filtro)
        $this->ValidateField_wpi($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'gryield' == $filtro)
        $this->ValidateField_gryield($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'fyield' == $filtro)
        $this->ValidateField_fyield($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'finno2' == $filtro)
        $this->ValidateField_finno2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'finish' == $filtro)
        $this->ValidateField_finish($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'fin_no' == $filtro)
        $this->ValidateField_fin_no($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'put_up' == $filtro)
        $this->ValidateField_put_up($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'rollsize' == $filtro)
        $this->ValidateField_rollsize($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'tubesize' == $filtro)
        $this->ValidateField_tubesize($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'fold' == $filtro)
        $this->ValidateField_fold($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'cases' == $filtro)
        $this->ValidateField_cases($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'spec1' == $filtro)
        $this->ValidateField_spec1($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'spec2' == $filtro)
        $this->ValidateField_spec2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'spec3' == $filtro)
        $this->ValidateField_spec3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'fab1' == $filtro)
        $this->ValidateField_fab1($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'fab2' == $filtro)
        $this->ValidateField_fab2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'as' == $filtro)
        $this->ValidateField_as($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'ae' == $filtro)
        $this->ValidateField_ae($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'gs1' == $filtro)
        $this->ValidateField_gs1($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'as1' == $filtro)
        $this->ValidateField_as1($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'ae1' == $filtro)
        $this->ValidateField_ae1($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'gs2' == $filtro)
        $this->ValidateField_gs2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'as2' == $filtro)
        $this->ValidateField_as2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'ae2' == $filtro)
        $this->ValidateField_ae2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'gs3' == $filtro)
        $this->ValidateField_gs3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'as3' == $filtro)
        $this->ValidateField_as3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'ae3' == $filtro)
        $this->ValidateField_ae3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'gs4' == $filtro)
        $this->ValidateField_gs4($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'as4' == $filtro)
        $this->ValidateField_as4($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'ae4' == $filtro)
        $this->ValidateField_ae4($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'gs5' == $filtro)
        $this->ValidateField_gs5($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'as5' == $filtro)
        $this->ValidateField_as5($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'ae5' == $filtro)
        $this->ValidateField_ae5($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_number(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->number == "")  
      { 
          $this->number = 0;
          $this->sc_force_zero[] = 'number';
      } 
      nm_limpa_numero($this->number, $this->field_config['number']['symbol_grp']) ; 
      if ($this->nmgp_opcao == "incluir")
      { 
          if ($this->number != '')  
          { 
              $iTestSize = 6;
              if (strlen($this->number) > $iTestSize)  
              { 
                  $Campos_Crit .= "NUMBER: " . $this->Ini->Nm_lang['lang_errm_size']; 
                  if (!isset($Campos_Erros['number']))
                  {
                      $Campos_Erros['number'] = array();
                  }
                  $Campos_Erros['number'][] = $this->Ini->Nm_lang['lang_errm_size'];
                  if (!isset($this->NM_ajax_info['errList']['number']) || !is_array($this->NM_ajax_info['errList']['number']))
                  {
                      $this->NM_ajax_info['errList']['number'] = array();
                  }
                  $this->NM_ajax_info['errList']['number'][] = $this->Ini->Nm_lang['lang_errm_size'];
              } 
              if ($teste_validade->Valor($this->number, 6, 0, 0, 0, "N") == false)  
              { 
                  $Campos_Crit .= "NUMBER; " ; 
                  if (!isset($Campos_Erros['number']))
                  {
                      $Campos_Erros['number'] = array();
                  }
                  $Campos_Erros['number'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['number']) || !is_array($this->NM_ajax_info['errList']['number']))
                  {
                      $this->NM_ajax_info['errList']['number'] = array();
                  }
                  $this->NM_ajax_info['errList']['number'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
      } 
    } // ValidateField_number

    function ValidateField_date(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      nm_limpa_data($this->date, $this->field_config['date']['date_sep']) ; 
      $trab_dt_min = ""; 
      $trab_dt_max = ""; 
      if ($this->nmgp_opcao == "incluir")
      { 
          $guarda_datahora = $this->field_config['date']['date_format']; 
          if (false !== strpos($guarda_datahora, ';')) $this->field_config['date']['date_format'] = substr($guarda_datahora, 0, strpos($guarda_datahora, ';'));
          $Format_Data = $this->field_config['date']['date_format']; 
          nm_limpa_data($Format_Data, $this->field_config['date']['date_sep']) ; 
          if (trim($this->date) != "")  
          { 
              if ($teste_validade->Data($this->date, $Format_Data, $trab_dt_min, $trab_dt_max) == false)  
              { 
                  $Campos_Crit .= "DATE; " ; 
                  if (!isset($Campos_Erros['date']))
                  {
                      $Campos_Erros['date'] = array();
                  }
                  $Campos_Erros['date'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['date']) || !is_array($this->NM_ajax_info['errList']['date']))
                  {
                      $this->NM_ajax_info['errList']['date'] = array();
                  }
                  $this->NM_ajax_info['errList']['date'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
           elseif ((!$this->NM_ajax_flag || 'validate_date' != $this->NM_ajax_opcao) && (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['php_cmp_required']['date']) || $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['php_cmp_required']['date'] == "on")) 
           { 
              $Campos_Falta[] = "DATE" ; 
              if (!isset($Campos_Erros['date']))
              {
                  $Campos_Erros['date'] = array();
              }
              $Campos_Erros['date'][] = $this->Ini->Nm_lang['lang_errm_ajax_rqrd'];
                  if (!isset($this->NM_ajax_info['errList']['date']) || !is_array($this->NM_ajax_info['errList']['date']))
                  {
                      $this->NM_ajax_info['errList']['date'] = array();
                  }
                  $this->NM_ajax_info['errList']['date'][] = $this->Ini->Nm_lang['lang_errm_ajax_rqrd'];
           } 
          $this->field_config['date']['date_format'] = $guarda_datahora; 
       } 
    } // ValidateField_date

    function ValidateField_gs(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->gs) > 8) 
          { 
              $Campos_Crit .= "GS " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['gs']))
              {
                  $Campos_Erros['gs'] = array();
              }
              $Campos_Erros['gs'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['gs']) || !is_array($this->NM_ajax_info['errList']['gs']))
              {
                  $this->NM_ajax_info['errList']['gs'] = array();
              }
              $this->NM_ajax_info['errList']['gs'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_gs

    function ValidateField_fs(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->fs) > 8) 
          { 
              $Campos_Crit .= "FS " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['fs']))
              {
                  $Campos_Erros['fs'] = array();
              }
              $Campos_Erros['fs'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['fs']) || !is_array($this->NM_ajax_info['errList']['fs']))
              {
                  $this->NM_ajax_info['errList']['fs'] = array();
              }
              $this->NM_ajax_info['errList']['fs'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_fs

    function ValidateField_frame(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->frame) > 25) 
          { 
              $Campos_Crit .= "FRAME " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 25 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['frame']))
              {
                  $Campos_Erros['frame'] = array();
              }
              $Campos_Erros['frame'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 25 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['frame']) || !is_array($this->NM_ajax_info['errList']['frame']))
              {
                  $this->NM_ajax_info['errList']['frame'] = array();
              }
              $this->NM_ajax_info['errList']['frame'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 25 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_frame

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

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

    function ValidateField_cpi(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->cpi) > 5) 
          { 
              $Campos_Crit .= "CPI " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 5 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['cpi']))
              {
                  $Campos_Erros['cpi'] = array();
              }
              $Campos_Erros['cpi'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 5 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['cpi']) || !is_array($this->NM_ajax_info['errList']['cpi']))
              {
                  $this->NM_ajax_info['errList']['cpi'] = array();
              }
              $this->NM_ajax_info['errList']['cpi'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 5 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_cpi

    function ValidateField_wpi(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->wpi) > 5) 
          { 
              $Campos_Crit .= "WPI " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 5 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['wpi']))
              {
                  $Campos_Erros['wpi'] = array();
              }
              $Campos_Erros['wpi'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 5 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['wpi']) || !is_array($this->NM_ajax_info['errList']['wpi']))
              {
                  $this->NM_ajax_info['errList']['wpi'] = array();
              }
              $this->NM_ajax_info['errList']['wpi'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 5 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_wpi

    function ValidateField_gryield(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->gryield) > 16) 
          { 
              $Campos_Crit .= "GRYIELD " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 16 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['gryield']))
              {
                  $Campos_Erros['gryield'] = array();
              }
              $Campos_Erros['gryield'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 16 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['gryield']) || !is_array($this->NM_ajax_info['errList']['gryield']))
              {
                  $this->NM_ajax_info['errList']['gryield'] = array();
              }
              $this->NM_ajax_info['errList']['gryield'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 16 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_gryield

    function ValidateField_fyield(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->fyield) > 16) 
          { 
              $Campos_Crit .= "FYIELD " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 16 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['fyield']))
              {
                  $Campos_Erros['fyield'] = array();
              }
              $Campos_Erros['fyield'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 16 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['fyield']) || !is_array($this->NM_ajax_info['errList']['fyield']))
              {
                  $this->NM_ajax_info['errList']['fyield'] = array();
              }
              $this->NM_ajax_info['errList']['fyield'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 16 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_fyield

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

    function ValidateField_finish(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->finish) > 25) 
          { 
              $Campos_Crit .= "FINISH " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 25 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['finish']))
              {
                  $Campos_Erros['finish'] = array();
              }
              $Campos_Erros['finish'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 25 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['finish']) || !is_array($this->NM_ajax_info['errList']['finish']))
              {
                  $this->NM_ajax_info['errList']['finish'] = array();
              }
              $this->NM_ajax_info['errList']['finish'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 25 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_finish

    function ValidateField_fin_no(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->fin_no) > 5) 
          { 
              $Campos_Crit .= "FIN NO " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 5 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['fin_no']))
              {
                  $Campos_Erros['fin_no'] = array();
              }
              $Campos_Erros['fin_no'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 5 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['fin_no']) || !is_array($this->NM_ajax_info['errList']['fin_no']))
              {
                  $this->NM_ajax_info['errList']['fin_no'] = array();
              }
              $this->NM_ajax_info['errList']['fin_no'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 5 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_fin_no

    function ValidateField_put_up(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->put_up) > 30) 
          { 
              $Campos_Crit .= "PUT UP " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 30 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['put_up']))
              {
                  $Campos_Erros['put_up'] = array();
              }
              $Campos_Erros['put_up'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 30 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['put_up']) || !is_array($this->NM_ajax_info['errList']['put_up']))
              {
                  $this->NM_ajax_info['errList']['put_up'] = array();
              }
              $this->NM_ajax_info['errList']['put_up'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 30 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_put_up

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

    function ValidateField_tubesize(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->tubesize == "")  
      { 
          $this->tubesize = 0;
          $this->sc_force_zero[] = 'tubesize';
      } 
      if (!empty($this->field_config['tubesize']['symbol_dec']))
      {
          $this->sc_remove_currency($this->tubesize, $this->field_config['tubesize']['symbol_dec'], $this->field_config['tubesize']['symbol_grp'], $this->field_config['tubesize']['symbol_mon']); 
          nm_limpa_valor($this->tubesize, $this->field_config['tubesize']['symbol_dec'], $this->field_config['tubesize']['symbol_grp']) ; 
          if ('.' == substr($this->tubesize, 0, 1))
          {
              if ('' == str_replace('0', '', substr($this->tubesize, 1)))
              {
                  $this->tubesize = '';
              }
              else
              {
                  $this->tubesize = '0' . $this->tubesize;
              }
          }
      }
      if ($this->nmgp_opcao != "excluir") 
      { 
          if ($this->tubesize != '')  
          { 
              $iTestSize = 7;
              if (strlen($this->tubesize) > $iTestSize)  
              { 
                  $Campos_Crit .= "TUBESIZE: " . $this->Ini->Nm_lang['lang_errm_size']; 
                  if (!isset($Campos_Erros['tubesize']))
                  {
                      $Campos_Erros['tubesize'] = array();
                  }
                  $Campos_Erros['tubesize'][] = $this->Ini->Nm_lang['lang_errm_size'];
                  if (!isset($this->NM_ajax_info['errList']['tubesize']) || !is_array($this->NM_ajax_info['errList']['tubesize']))
                  {
                      $this->NM_ajax_info['errList']['tubesize'] = array();
                  }
                  $this->NM_ajax_info['errList']['tubesize'][] = $this->Ini->Nm_lang['lang_errm_size'];
              } 
              if ($teste_validade->Valor($this->tubesize, 4, 2, 0, 0, "N") == false)  
              { 
                  $Campos_Crit .= "TUBESIZE; " ; 
                  if (!isset($Campos_Erros['tubesize']))
                  {
                      $Campos_Erros['tubesize'] = array();
                  }
                  $Campos_Erros['tubesize'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['tubesize']) || !is_array($this->NM_ajax_info['errList']['tubesize']))
                  {
                      $this->NM_ajax_info['errList']['tubesize'] = array();
                  }
                  $this->NM_ajax_info['errList']['tubesize'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
      } 
    } // ValidateField_tubesize

    function ValidateField_fold(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->fold) > 11) 
          { 
              $Campos_Crit .= "FOLD " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 11 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['fold']))
              {
                  $Campos_Erros['fold'] = array();
              }
              $Campos_Erros['fold'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 11 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['fold']) || !is_array($this->NM_ajax_info['errList']['fold']))
              {
                  $this->NM_ajax_info['errList']['fold'] = array();
              }
              $this->NM_ajax_info['errList']['fold'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 11 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_fold

    function ValidateField_cases(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->cases) > 1) 
          { 
              $Campos_Crit .= "CASES " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['cases']))
              {
                  $Campos_Erros['cases'] = array();
              }
              $Campos_Erros['cases'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['cases']) || !is_array($this->NM_ajax_info['errList']['cases']))
              {
                  $this->NM_ajax_info['errList']['cases'] = array();
              }
              $this->NM_ajax_info['errList']['cases'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_cases

    function ValidateField_spec1(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->spec1) > 25) 
          { 
              $Campos_Crit .= "SPEC1 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 25 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['spec1']))
              {
                  $Campos_Erros['spec1'] = array();
              }
              $Campos_Erros['spec1'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 25 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['spec1']) || !is_array($this->NM_ajax_info['errList']['spec1']))
              {
                  $this->NM_ajax_info['errList']['spec1'] = array();
              }
              $this->NM_ajax_info['errList']['spec1'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 25 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_spec1

    function ValidateField_spec2(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->spec2) > 25) 
          { 
              $Campos_Crit .= "SPEC2 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 25 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['spec2']))
              {
                  $Campos_Erros['spec2'] = array();
              }
              $Campos_Erros['spec2'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 25 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['spec2']) || !is_array($this->NM_ajax_info['errList']['spec2']))
              {
                  $this->NM_ajax_info['errList']['spec2'] = array();
              }
              $this->NM_ajax_info['errList']['spec2'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 25 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_spec2

    function ValidateField_spec3(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->spec3) > 25) 
          { 
              $Campos_Crit .= "SPEC3 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 25 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['spec3']))
              {
                  $Campos_Erros['spec3'] = array();
              }
              $Campos_Erros['spec3'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 25 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['spec3']) || !is_array($this->NM_ajax_info['errList']['spec3']))
              {
                  $this->NM_ajax_info['errList']['spec3'] = array();
              }
              $this->NM_ajax_info['errList']['spec3'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 25 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_spec3

    function ValidateField_fab1(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->fab1) > 30) 
          { 
              $Campos_Crit .= "FAB1 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 30 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['fab1']))
              {
                  $Campos_Erros['fab1'] = array();
              }
              $Campos_Erros['fab1'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 30 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['fab1']) || !is_array($this->NM_ajax_info['errList']['fab1']))
              {
                  $this->NM_ajax_info['errList']['fab1'] = array();
              }
              $this->NM_ajax_info['errList']['fab1'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 30 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_fab1

    function ValidateField_fab2(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->fab2) > 30) 
          { 
              $Campos_Crit .= "FAB2 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 30 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['fab2']))
              {
                  $Campos_Erros['fab2'] = array();
              }
              $Campos_Erros['fab2'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 30 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['fab2']) || !is_array($this->NM_ajax_info['errList']['fab2']))
              {
                  $this->NM_ajax_info['errList']['fab2'] = array();
              }
              $this->NM_ajax_info['errList']['fab2'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 30 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_fab2

    function ValidateField_as(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->as) > 1) 
          { 
              $Campos_Crit .= "AS " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['as']))
              {
                  $Campos_Erros['as'] = array();
              }
              $Campos_Erros['as'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['as']) || !is_array($this->NM_ajax_info['errList']['as']))
              {
                  $this->NM_ajax_info['errList']['as'] = array();
              }
              $this->NM_ajax_info['errList']['as'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_as

    function ValidateField_ae(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->ae) > 1) 
          { 
              $Campos_Crit .= "AE " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['ae']))
              {
                  $Campos_Erros['ae'] = array();
              }
              $Campos_Erros['ae'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['ae']) || !is_array($this->NM_ajax_info['errList']['ae']))
              {
                  $this->NM_ajax_info['errList']['ae'] = array();
              }
              $this->NM_ajax_info['errList']['ae'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_ae

    function ValidateField_gs1(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->gs1) > 8) 
          { 
              $Campos_Crit .= "GS1 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['gs1']))
              {
                  $Campos_Erros['gs1'] = array();
              }
              $Campos_Erros['gs1'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['gs1']) || !is_array($this->NM_ajax_info['errList']['gs1']))
              {
                  $this->NM_ajax_info['errList']['gs1'] = array();
              }
              $this->NM_ajax_info['errList']['gs1'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_gs1

    function ValidateField_as1(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->as1) > 1) 
          { 
              $Campos_Crit .= "AS1 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['as1']))
              {
                  $Campos_Erros['as1'] = array();
              }
              $Campos_Erros['as1'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['as1']) || !is_array($this->NM_ajax_info['errList']['as1']))
              {
                  $this->NM_ajax_info['errList']['as1'] = array();
              }
              $this->NM_ajax_info['errList']['as1'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_as1

    function ValidateField_ae1(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->ae1) > 1) 
          { 
              $Campos_Crit .= "AE1 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['ae1']))
              {
                  $Campos_Erros['ae1'] = array();
              }
              $Campos_Erros['ae1'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['ae1']) || !is_array($this->NM_ajax_info['errList']['ae1']))
              {
                  $this->NM_ajax_info['errList']['ae1'] = array();
              }
              $this->NM_ajax_info['errList']['ae1'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_ae1

    function ValidateField_gs2(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->gs2) > 8) 
          { 
              $Campos_Crit .= "GS2 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['gs2']))
              {
                  $Campos_Erros['gs2'] = array();
              }
              $Campos_Erros['gs2'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['gs2']) || !is_array($this->NM_ajax_info['errList']['gs2']))
              {
                  $this->NM_ajax_info['errList']['gs2'] = array();
              }
              $this->NM_ajax_info['errList']['gs2'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_gs2

    function ValidateField_as2(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->as2) > 1) 
          { 
              $Campos_Crit .= "AS2 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['as2']))
              {
                  $Campos_Erros['as2'] = array();
              }
              $Campos_Erros['as2'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['as2']) || !is_array($this->NM_ajax_info['errList']['as2']))
              {
                  $this->NM_ajax_info['errList']['as2'] = array();
              }
              $this->NM_ajax_info['errList']['as2'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_as2

    function ValidateField_ae2(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->ae2) > 1) 
          { 
              $Campos_Crit .= "AE2 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['ae2']))
              {
                  $Campos_Erros['ae2'] = array();
              }
              $Campos_Erros['ae2'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['ae2']) || !is_array($this->NM_ajax_info['errList']['ae2']))
              {
                  $this->NM_ajax_info['errList']['ae2'] = array();
              }
              $this->NM_ajax_info['errList']['ae2'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_ae2

    function ValidateField_gs3(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->gs3) > 8) 
          { 
              $Campos_Crit .= "GS3 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['gs3']))
              {
                  $Campos_Erros['gs3'] = array();
              }
              $Campos_Erros['gs3'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['gs3']) || !is_array($this->NM_ajax_info['errList']['gs3']))
              {
                  $this->NM_ajax_info['errList']['gs3'] = array();
              }
              $this->NM_ajax_info['errList']['gs3'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_gs3

    function ValidateField_as3(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->as3) > 1) 
          { 
              $Campos_Crit .= "AS3 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['as3']))
              {
                  $Campos_Erros['as3'] = array();
              }
              $Campos_Erros['as3'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['as3']) || !is_array($this->NM_ajax_info['errList']['as3']))
              {
                  $this->NM_ajax_info['errList']['as3'] = array();
              }
              $this->NM_ajax_info['errList']['as3'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_as3

    function ValidateField_ae3(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->ae3) > 1) 
          { 
              $Campos_Crit .= "AE3 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['ae3']))
              {
                  $Campos_Erros['ae3'] = array();
              }
              $Campos_Erros['ae3'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['ae3']) || !is_array($this->NM_ajax_info['errList']['ae3']))
              {
                  $this->NM_ajax_info['errList']['ae3'] = array();
              }
              $this->NM_ajax_info['errList']['ae3'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_ae3

    function ValidateField_gs4(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->gs4) > 8) 
          { 
              $Campos_Crit .= "GS4 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['gs4']))
              {
                  $Campos_Erros['gs4'] = array();
              }
              $Campos_Erros['gs4'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['gs4']) || !is_array($this->NM_ajax_info['errList']['gs4']))
              {
                  $this->NM_ajax_info['errList']['gs4'] = array();
              }
              $this->NM_ajax_info['errList']['gs4'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_gs4

    function ValidateField_as4(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->as4) > 1) 
          { 
              $Campos_Crit .= "AS4 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['as4']))
              {
                  $Campos_Erros['as4'] = array();
              }
              $Campos_Erros['as4'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['as4']) || !is_array($this->NM_ajax_info['errList']['as4']))
              {
                  $this->NM_ajax_info['errList']['as4'] = array();
              }
              $this->NM_ajax_info['errList']['as4'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_as4

    function ValidateField_ae4(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->ae4) > 1) 
          { 
              $Campos_Crit .= "AE4 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['ae4']))
              {
                  $Campos_Erros['ae4'] = array();
              }
              $Campos_Erros['ae4'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['ae4']) || !is_array($this->NM_ajax_info['errList']['ae4']))
              {
                  $this->NM_ajax_info['errList']['ae4'] = array();
              }
              $this->NM_ajax_info['errList']['ae4'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_ae4

    function ValidateField_gs5(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->gs5) > 8) 
          { 
              $Campos_Crit .= "GS5 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['gs5']))
              {
                  $Campos_Erros['gs5'] = array();
              }
              $Campos_Erros['gs5'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['gs5']) || !is_array($this->NM_ajax_info['errList']['gs5']))
              {
                  $this->NM_ajax_info['errList']['gs5'] = array();
              }
              $this->NM_ajax_info['errList']['gs5'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_gs5

    function ValidateField_as5(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->as5) > 1) 
          { 
              $Campos_Crit .= "AS5 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['as5']))
              {
                  $Campos_Erros['as5'] = array();
              }
              $Campos_Erros['as5'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['as5']) || !is_array($this->NM_ajax_info['errList']['as5']))
              {
                  $this->NM_ajax_info['errList']['as5'] = array();
              }
              $this->NM_ajax_info['errList']['as5'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_as5

    function ValidateField_ae5(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->ae5) > 1) 
          { 
              $Campos_Crit .= "AE5 " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['ae5']))
              {
                  $Campos_Erros['ae5'] = array();
              }
              $Campos_Erros['ae5'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['ae5']) || !is_array($this->NM_ajax_info['errList']['ae5']))
              {
                  $this->NM_ajax_info['errList']['ae5'] = array();
              }
              $this->NM_ajax_info['errList']['ae5'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 1 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_ae5

    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['number'] = $this->number;
    $this->nmgp_dados_form['date'] = $this->date;
    $this->nmgp_dados_form['gs'] = $this->gs;
    $this->nmgp_dados_form['fs'] = $this->fs;
    $this->nmgp_dados_form['frame'] = $this->frame;
    $this->nmgp_dados_form['fwidth'] = $this->fwidth;
    $this->nmgp_dados_form['panels'] = $this->panels;
    $this->nmgp_dados_form['cpi'] = $this->cpi;
    $this->nmgp_dados_form['wpi'] = $this->wpi;
    $this->nmgp_dados_form['gryield'] = $this->gryield;
    $this->nmgp_dados_form['fyield'] = $this->fyield;
    $this->nmgp_dados_form['finno2'] = $this->finno2;
    $this->nmgp_dados_form['finish'] = $this->finish;
    $this->nmgp_dados_form['fin_no'] = $this->fin_no;
    $this->nmgp_dados_form['put_up'] = $this->put_up;
    $this->nmgp_dados_form['rollsize'] = $this->rollsize;
    $this->nmgp_dados_form['tubesize'] = $this->tubesize;
    $this->nmgp_dados_form['fold'] = $this->fold;
    $this->nmgp_dados_form['cases'] = $this->cases;
    $this->nmgp_dados_form['spec1'] = $this->spec1;
    $this->nmgp_dados_form['spec2'] = $this->spec2;
    $this->nmgp_dados_form['spec3'] = $this->spec3;
    $this->nmgp_dados_form['fab1'] = $this->fab1;
    $this->nmgp_dados_form['fab2'] = $this->fab2;
    $this->nmgp_dados_form['as'] = $this->as;
    $this->nmgp_dados_form['ae'] = $this->ae;
    $this->nmgp_dados_form['gs1'] = $this->gs1;
    $this->nmgp_dados_form['as1'] = $this->as1;
    $this->nmgp_dados_form['ae1'] = $this->ae1;
    $this->nmgp_dados_form['gs2'] = $this->gs2;
    $this->nmgp_dados_form['as2'] = $this->as2;
    $this->nmgp_dados_form['ae2'] = $this->ae2;
    $this->nmgp_dados_form['gs3'] = $this->gs3;
    $this->nmgp_dados_form['as3'] = $this->as3;
    $this->nmgp_dados_form['ae3'] = $this->ae3;
    $this->nmgp_dados_form['gs4'] = $this->gs4;
    $this->nmgp_dados_form['as4'] = $this->as4;
    $this->nmgp_dados_form['ae4'] = $this->ae4;
    $this->nmgp_dados_form['gs5'] = $this->gs5;
    $this->nmgp_dados_form['as5'] = $this->as5;
    $this->nmgp_dados_form['ae5'] = $this->ae5;
    $this->nmgp_dados_form['id2'] = $this->id2;
    $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['dados_form'] = $this->nmgp_dados_form;
   }
   function nm_tira_formatacao()
   {
      global $nm_form_submit;
         $this->formatado = false;
      nm_limpa_numero($this->number, $this->field_config['number']['symbol_grp']) ; 
      nm_limpa_data($this->date, $this->field_config['date']['date_sep']) ; 
      nm_limpa_numero($this->fwidth, $this->field_config['fwidth']['symbol_grp']) ; 
      nm_limpa_numero($this->panels, $this->field_config['panels']['symbol_grp']) ; 
      nm_limpa_numero($this->rollsize, $this->field_config['rollsize']['symbol_grp']) ; 
      if (!empty($this->field_config['tubesize']['symbol_dec']))
      {
         $this->sc_remove_currency($this->tubesize, $this->field_config['tubesize']['symbol_dec'], $this->field_config['tubesize']['symbol_grp'], $this->field_config['tubesize']['symbol_mon']);
         nm_limpa_valor($this->tubesize, $this->field_config['tubesize']['symbol_dec'], $this->field_config['tubesize']['symbol_grp']);
      }
      nm_limpa_numero($this->id2, $this->field_config['id2']['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 == "number")
      {
          nm_limpa_numero($this->number, $this->field_config['number']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "fwidth")
      {
          nm_limpa_numero($this->fwidth, $this->field_config['fwidth']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "panels")
      {
          nm_limpa_numero($this->panels, $this->field_config['panels']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "rollsize")
      {
          nm_limpa_numero($this->rollsize, $this->field_config['rollsize']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "tubesize")
      {
          if (!empty($this->field_config['tubesize']['symbol_dec']))
          {
             $this->sc_remove_currency($this->tubesize, $this->field_config['tubesize']['symbol_dec'], $this->field_config['tubesize']['symbol_grp'], $this->field_config['tubesize']['symbol_mon']);
             nm_limpa_valor($this->tubesize, $this->field_config['tubesize']['symbol_dec'], $this->field_config['tubesize']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "id2")
      {
          nm_limpa_numero($this->id2, $this->field_config['id2']['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->number) || (!empty($format_fields) && isset($format_fields['number'])))
      {
          nmgp_Form_Num_Val($this->number, $this->field_config['number']['symbol_grp'], $this->field_config['number']['symbol_dec'], "0", "S", "", "", "", "-", $this->field_config['number']['symbol_fmt']) ; 
      }
      if ((!empty($this->date) && 'null' != $this->date) || (!empty($format_fields) && isset($format_fields['date'])))
      {
          nm_volta_data($this->date, $this->field_config['date']['date_format']) ; 
          nmgp_Form_Datas($this->date, $this->field_config['date']['date_format'], $this->field_config['date']['date_sep']) ;  
      }
      elseif ('null' == $this->date || '' == $this->date)
      {
          $this->date = '';
      }
      if (!empty($this->fwidth) || (!empty($format_fields) && isset($format_fields['fwidth'])))
      {
          nmgp_Form_Num_Val($this->fwidth, $this->field_config['fwidth']['symbol_grp'], $this->field_config['fwidth']['symbol_dec'], "0", "S", "", "", "", "-", $this->field_config['fwidth']['symbol_fmt']) ; 
      }
      if (!empty($this->panels) || (!empty($format_fields) && isset($format_fields['panels'])))
      {
          nmgp_Form_Num_Val($this->panels, $this->field_config['panels']['symbol_grp'], $this->field_config['panels']['symbol_dec'], "0", "S", "", "", "", "-", $this->field_config['panels']['symbol_fmt']) ; 
      }
      if (!empty($this->rollsize) || (!empty($format_fields) && isset($format_fields['rollsize'])))
      {
          nmgp_Form_Num_Val($this->rollsize, $this->field_config['rollsize']['symbol_grp'], $this->field_config['rollsize']['symbol_dec'], "0", "S", "", "", "", "-", $this->field_config['rollsize']['symbol_fmt']) ; 
      }
      if (!empty($this->tubesize) || (!empty($format_fields) && isset($format_fields['tubesize'])))
      {
          nmgp_Form_Num_Val($this->tubesize, $this->field_config['tubesize']['symbol_grp'], $this->field_config['tubesize']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['tubesize']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['tubesize']['symbol_mon'];
          $this->sc_add_currency($this->tubesize, $sMonSymb, $this->field_config['tubesize']['format_pos']); 
      }
   }
   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['date']['date_format'];
      if ($this->date != "")  
      { 
          nm_conv_data($this->date, $this->field_config['date']['date_format']) ; 
          $this->date_hora = "00:00:00:000" ; 
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
          {
              $this->date_hora = substr($this->date_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
          {
              $this->date_hora = substr($this->date_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
          {
              $this->date_hora = substr($this->date_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
          {
              $this->date_hora = substr($this->date_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_db2))
          {
              $this->date_hora = substr($this->date_hora, 0, -4);
          }
      } 
      if ($this->date == "" && $use_null)  
      { 
          $this->date = "null" ; 
      } 
       $this->field_config['date']['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_number();
          $this->ajax_return_values_date();
          $this->ajax_return_values_gs();
          $this->ajax_return_values_fs();
          $this->ajax_return_values_frame();
          $this->ajax_return_values_fwidth();
          $this->ajax_return_values_panels();
          $this->ajax_return_values_cpi();
          $this->ajax_return_values_wpi();
          $this->ajax_return_values_gryield();
          $this->ajax_return_values_fyield();
          $this->ajax_return_values_finno2();
          $this->ajax_return_values_finish();
          $this->ajax_return_values_fin_no();
          $this->ajax_return_values_put_up();
          $this->ajax_return_values_rollsize();
          $this->ajax_return_values_tubesize();
          $this->ajax_return_values_fold();
          $this->ajax_return_values_cases();
          $this->ajax_return_values_spec1();
          $this->ajax_return_values_spec2();
          $this->ajax_return_values_spec3();
          $this->ajax_return_values_fab1();
          $this->ajax_return_values_fab2();
          $this->ajax_return_values_as();
          $this->ajax_return_values_ae();
          $this->ajax_return_values_gs1();
          $this->ajax_return_values_as1();
          $this->ajax_return_values_ae1();
          $this->ajax_return_values_gs2();
          $this->ajax_return_values_as2();
          $this->ajax_return_values_ae2();
          $this->ajax_return_values_gs3();
          $this->ajax_return_values_as3();
          $this->ajax_return_values_ae3();
          $this->ajax_return_values_gs4();
          $this->ajax_return_values_as4();
          $this->ajax_return_values_ae4();
          $this->ajax_return_values_gs5();
          $this->ajax_return_values_as5();
          $this->ajax_return_values_ae5();
          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']['number']['keyVal'] = dye_standdf_form_pack_protect_string($this->nmgp_dados_form['number']);
              $this->NM_ajax_info['fldList']['id2']['keyVal'] = dye_standdf_form_pack_protect_string($this->nmgp_dados_form['id2']);
          }
   } // ajax_return_values

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

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

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

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

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

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

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

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

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

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

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

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

 
$nmgp_def_dados = "" ; 
if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['Lookup_finno2']))
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['Lookup_finno2'] = array_unique($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['Lookup_finno2']); 
}
else
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['Lookup_finno2'] = array(); 
}
$aLookup[] = array(dye_standdf_form_pack_protect_string('') => dye_standdf_form_pack_protect_string('---Select Finish---'));
$_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['Lookup_finno2'][] = '';
   if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
   { 
       $GLOBALS["NM_ERRO_IBASE"] = 1;  
   } 
   $nm_nao_carga = false;
   $nmgp_def_dados = "" ; 

   $old_value_number = $this->number;
   $old_value_date = $this->date;
   $old_value_fwidth = $this->fwidth;
   $old_value_panels = $this->panels;
   $old_value_rollsize = $this->rollsize;
   $old_value_tubesize = $this->tubesize;
   $this->nm_tira_formatacao();
   $this->nm_converte_datas(false);


   $unformatted_value_number = $this->number;
   $unformatted_value_date = $this->date;
   $unformatted_value_fwidth = $this->fwidth;
   $unformatted_value_panels = $this->panels;
   $unformatted_value_rollsize = $this->rollsize;
   $unformatted_value_tubesize = $this->tubesize;

   if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sybase))
   {
       $nm_comando = "SELECT FINISH, FINISH + '-' + DYER + '-' + STYLE + '-' + NAME  FROM finish  ORDER BY FINISH, DYER, STYLE, NAME";
   }
   elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
   {
       $nm_comando = "SELECT FINISH, concat(FINISH,'-', DYER, '-', STYLE, '-', NAME)  FROM finish  ORDER BY FINISH, DYER, STYLE, NAME";
   }
   elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
   {
       $nm_comando = "SELECT FINISH, FINISH&'-'&DYER&'-'&STYLE&'-'&NAME  FROM finish  ORDER BY FINISH, DYER, STYLE, NAME";
   }
   elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
   {
       $nm_comando = "SELECT FINISH, FINISH||'-'||DYER||'-'||STYLE||'-'||NAME  FROM finish  ORDER BY FINISH, DYER, STYLE, NAME";
   }
   elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
   {
       $nm_comando = "SELECT FINISH, convert(char,FINISH) + '-' + DYER + '-' + STYLE + '-' + NAME  FROM finish  ORDER BY FINISH, DYER, STYLE, NAME";
   }
   elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_db2))
   {
       $nm_comando = "SELECT FINISH, char(FINISH)||'-'||DYER||'-'||STYLE||'-'||NAME  FROM finish  ORDER BY FINISH, DYER, STYLE, NAME";
   }
   else
   {
       $nm_comando = "SELECT FINISH, FINISH||'-'||DYER||'-'||STYLE||'-'||NAME  FROM finish  ORDER BY FINISH, DYER, STYLE, NAME";
   }

   $this->number = $old_value_number;
   $this->date = $old_value_date;
   $this->fwidth = $old_value_fwidth;
   $this->panels = $old_value_panels;
   $this->rollsize = $old_value_rollsize;
   $this->tubesize = $old_value_tubesize;

   $_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(dye_standdf_form_pack_protect_string($rs->fields[0]) => dye_standdf_form_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]['dye_standdf_form']['Lookup_finno2'][] = $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=\"finno2\"";
          if (isset($this->NM_ajax_info['select_html']['finno2']) && !empty($this->NM_ajax_info['select_html']['finno2']))
          {
              $sSelComp = $this->NM_ajax_info['select_html']['finno2'];
          }
          $sLookup = '';
          if (empty($aLookup))
          {
              $aLookup[] = array('' => '');
          }
          foreach ($aLookup as $aOption)
          {
              foreach ($aOption as $sValue => $sLabel)
              {

                  if ($this->finno2 == $sValue)
                  {
                      $this->_tmp_lookup_finno2 = $sLabel;
                  }

                  $sOpt     = ($sValue !== $sLabel) ? $sValue : $sLabel;
                  $sLookup .= "<option value=\"" . $sOpt . "\">" . $sLabel . "</option>";
              }
          }
          $aLookup  = $sLookup;
          $this->NM_ajax_info['fldList']['finno2'] = 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']['finno2']['valList']))
              {
                  $aLabelTemp[key($aValData)] = current($aValData);
              }
          }
          foreach ($this->NM_ajax_info['fldList']['finno2']['valList'] as $iIndex => $sValue)
          {
              $aLabel[$iIndex] = (isset($aLabelTemp[$sValue])) ? $aLabelTemp[$sValue] : $sValue;
          }
          $this->NM_ajax_info['fldList']['finno2']['labList'] = $aLabel;
          }
   }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

   function ajax_add_parameters()
   {
   } // ajax_add_parameters
  function nm_proc_onload($bFormat = true)
  {
      $this->nm_guardar_campos();
      if ($bFormat) $this->nm_formatar_campos();
  }
//
//----------------------------------------------------
//-----> 
//----------------------------------------------------
//
   function nm_troca_decimal($sc_parm1, $sc_parm2) 
   { 
      $this->tubesize = str_replace($sc_parm1, $sc_parm2, $this->tubesize); 
   } 
   function nm_poe_aspas_decimal() 
   { 
      $this->tubesize = "'" . $this->tubesize . "'";
   } 
   function nm_tira_aspas_decimal() 
   { 
      $this->tubesize = str_replace("'", "", $this->tubesize); 
   } 
//----------- 


   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 (!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 = ""; 
      } 
      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; 
      } 
      $NM_val_form['number'] = $this->number;
      $NM_val_form['date'] = $this->date;
      $NM_val_form['gs'] = $this->gs;
      $NM_val_form['fs'] = $this->fs;
      $NM_val_form['frame'] = $this->frame;
      $NM_val_form['fwidth'] = $this->fwidth;
      $NM_val_form['panels'] = $this->panels;
      $NM_val_form['cpi'] = $this->cpi;
      $NM_val_form['wpi'] = $this->wpi;
      $NM_val_form['gryield'] = $this->gryield;
      $NM_val_form['fyield'] = $this->fyield;
      $NM_val_form['finno2'] = $this->finno2;
      $NM_val_form['finish'] = $this->finish;
      $NM_val_form['fin_no'] = $this->fin_no;
      $NM_val_form['put_up'] = $this->put_up;
      $NM_val_form['rollsize'] = $this->rollsize;
      $NM_val_form['tubesize'] = $this->tubesize;
      $NM_val_form['fold'] = $this->fold;
      $NM_val_form['cases'] = $this->cases;
      $NM_val_form['spec1'] = $this->spec1;
      $NM_val_form['spec2'] = $this->spec2;
      $NM_val_form['spec3'] = $this->spec3;
      $NM_val_form['fab1'] = $this->fab1;
      $NM_val_form['fab2'] = $this->fab2;
      $NM_val_form['as'] = $this->as;
      $NM_val_form['ae'] = $this->ae;
      $NM_val_form['gs1'] = $this->gs1;
      $NM_val_form['as1'] = $this->as1;
      $NM_val_form['ae1'] = $this->ae1;
      $NM_val_form['gs2'] = $this->gs2;
      $NM_val_form['as2'] = $this->as2;
      $NM_val_form['ae2'] = $this->ae2;
      $NM_val_form['gs3'] = $this->gs3;
      $NM_val_form['as3'] = $this->as3;
      $NM_val_form['ae3'] = $this->ae3;
      $NM_val_form['gs4'] = $this->gs4;
      $NM_val_form['as4'] = $this->as4;
      $NM_val_form['ae4'] = $this->ae4;
      $NM_val_form['gs5'] = $this->gs5;
      $NM_val_form['as5'] = $this->as5;
      $NM_val_form['ae5'] = $this->ae5;
      $NM_val_form['id2'] = $this->id2;
      if ($this->number == "")  
      { 
          $this->number = 0;
          $this->sc_force_zero[] = 'number';
      } 
      if ($this->fwidth == "")  
      { 
          $this->fwidth = 0;
          $this->sc_force_zero[] = 'fwidth';
      } 
      if ($this->panels == "")  
      { 
          $this->panels = 0;
          $this->sc_force_zero[] = 'panels';
      } 
      if ($this->rollsize == "")  
      { 
          $this->rollsize = 0;
          $this->sc_force_zero[] = 'rollsize';
      } 
      if ($this->tubesize == "")  
      { 
          $this->tubesize = 0;
          $this->sc_force_zero[] = 'tubesize';
      } 
      if ($this->id2 == "")  
      { 
          $this->id2 = 0;
      } 
      $nm_bases_lob_geral = array_merge($this->Ini->nm_bases_oracle, $this->Ini->nm_bases_ibase, $this->Ini->nm_bases_informix);
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['decimal_db'] == ",") 
      {
          $this->nm_troca_decimal(".", ",");
      }
      if ($this->nmgp_opcao == "alterar" || $this->nmgp_opcao == "incluir") 
      {
          if ($this->date == "")  
          { 
              $this->date = "null"; 
              $NM_val_null[] = "date";
          } 
          $this->gs = substr($this->Db->qstr($this->gs), 1, -1); 
          if ($this->gs == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->gs = "null"; 
              $NM_val_null[] = "gs";
          } 
          $this->as = substr($this->Db->qstr($this->as), 1, -1); 
          if ($this->as == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->as = "null"; 
              $NM_val_null[] = "as";
          } 
          $this->ae = substr($this->Db->qstr($this->ae), 1, -1); 
          if ($this->ae == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->ae = "null"; 
              $NM_val_null[] = "ae";
          } 
          $this->gs1 = substr($this->Db->qstr($this->gs1), 1, -1); 
          if ($this->gs1 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->gs1 = "null"; 
              $NM_val_null[] = "gs1";
          } 
          $this->as1 = substr($this->Db->qstr($this->as1), 1, -1); 
          if ($this->as1 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->as1 = "null"; 
              $NM_val_null[] = "as1";
          } 
          $this->ae1 = substr($this->Db->qstr($this->ae1), 1, -1); 
          if ($this->ae1 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->ae1 = "null"; 
              $NM_val_null[] = "ae1";
          } 
          $this->gs2 = substr($this->Db->qstr($this->gs2), 1, -1); 
          if ($this->gs2 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->gs2 = "null"; 
              $NM_val_null[] = "gs2";
          } 
          $this->as2 = substr($this->Db->qstr($this->as2), 1, -1); 
          if ($this->as2 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->as2 = "null"; 
              $NM_val_null[] = "as2";
          } 
          $this->ae2 = substr($this->Db->qstr($this->ae2), 1, -1); 
          if ($this->ae2 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->ae2 = "null"; 
              $NM_val_null[] = "ae2";
          } 
          $this->gs3 = substr($this->Db->qstr($this->gs3), 1, -1); 
          if ($this->gs3 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->gs3 = "null"; 
              $NM_val_null[] = "gs3";
          } 
          $this->as3 = substr($this->Db->qstr($this->as3), 1, -1); 
          if ($this->as3 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->as3 = "null"; 
              $NM_val_null[] = "as3";
          } 
          $this->ae3 = substr($this->Db->qstr($this->ae3), 1, -1); 
          if ($this->ae3 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->ae3 = "null"; 
              $NM_val_null[] = "ae3";
          } 
          $this->gs4 = substr($this->Db->qstr($this->gs4), 1, -1); 
          if ($this->gs4 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->gs4 = "null"; 
              $NM_val_null[] = "gs4";
          } 
          $this->as4 = substr($this->Db->qstr($this->as4), 1, -1); 
          if ($this->as4 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->as4 = "null"; 
              $NM_val_null[] = "as4";
          } 
          $this->ae4 = substr($this->Db->qstr($this->ae4), 1, -1); 
          if ($this->ae4 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->ae4 = "null"; 
              $NM_val_null[] = "ae4";
          } 
          $this->gs5 = substr($this->Db->qstr($this->gs5), 1, -1); 
          if ($this->gs5 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->gs5 = "null"; 
              $NM_val_null[] = "gs5";
          } 
          $this->as5 = substr($this->Db->qstr($this->as5), 1, -1); 
          if ($this->as5 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->as5 = "null"; 
              $NM_val_null[] = "as5";
          } 
          $this->ae5 = substr($this->Db->qstr($this->ae5), 1, -1); 
          if ($this->ae5 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->ae5 = "null"; 
              $NM_val_null[] = "ae5";
          } 
          $this->fs = substr($this->Db->qstr($this->fs), 1, -1); 
          if ($this->fs == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->fs = "null"; 
              $NM_val_null[] = "fs";
          } 
          $this->frame = substr($this->Db->qstr($this->frame), 1, -1); 
          if ($this->frame == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->frame = "null"; 
              $NM_val_null[] = "frame";
          } 
          $this->cpi = substr($this->Db->qstr($this->cpi), 1, -1); 
          if ($this->cpi == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->cpi = "null"; 
              $NM_val_null[] = "cpi";
          } 
          $this->wpi = substr($this->Db->qstr($this->wpi), 1, -1); 
          if ($this->wpi == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->wpi = "null"; 
              $NM_val_null[] = "wpi";
          } 
          $this->spec1 = substr($this->Db->qstr($this->spec1), 1, -1); 
          if ($this->spec1 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->spec1 = "null"; 
              $NM_val_null[] = "spec1";
          } 
          $this->spec2 = substr($this->Db->qstr($this->spec2), 1, -1); 
          if ($this->spec2 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->spec2 = "null"; 
              $NM_val_null[] = "spec2";
          } 
          $this->spec3 = substr($this->Db->qstr($this->spec3), 1, -1); 
          if ($this->spec3 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->spec3 = "null"; 
              $NM_val_null[] = "spec3";
          } 
          $this->finish = substr($this->Db->qstr($this->finish), 1, -1); 
          if ($this->finish == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->finish = "null"; 
              $NM_val_null[] = "finish";
          } 
          $this->fin_no = substr($this->Db->qstr($this->fin_no), 1, -1); 
          if ($this->fin_no == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->fin_no = "null"; 
              $NM_val_null[] = "fin_no";
          } 
          $this->gryield = substr($this->Db->qstr($this->gryield), 1, -1); 
          if ($this->gryield == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->gryield = "null"; 
              $NM_val_null[] = "gryield";
          } 
          $this->fyield = substr($this->Db->qstr($this->fyield), 1, -1); 
          if ($this->fyield == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->fyield = "null"; 
              $NM_val_null[] = "fyield";
          } 
          $this->put_up = substr($this->Db->qstr($this->put_up), 1, -1); 
          if ($this->put_up == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->put_up = "null"; 
              $NM_val_null[] = "put_up";
          } 
          $this->fab1 = substr($this->Db->qstr($this->fab1), 1, -1); 
          if ($this->fab1 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->fab1 = "null"; 
              $NM_val_null[] = "fab1";
          } 
          $this->fab2 = substr($this->Db->qstr($this->fab2), 1, -1); 
          if ($this->fab2 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->fab2 = "null"; 
              $NM_val_null[] = "fab2";
          } 
          $this->fold = substr($this->Db->qstr($this->fold), 1, -1); 
          if ($this->fold == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->fold = "null"; 
              $NM_val_null[] = "fold";
          } 
          $this->cases = substr($this->Db->qstr($this->cases), 1, -1); 
          if ($this->cases == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->cases = "null"; 
              $NM_val_null[] = "cases";
          } 
      }
      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]['dye_standdf_form']['foreign_key']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['foreign_key']))
          {
              foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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]['dye_standdf_form']['decimal_db'] == ",") 
          {
              $this->nm_poe_aspas_decimal();
          }
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
          {
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 ";
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
          }  
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
          {
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 ";
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
          }  
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
          {
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 ";
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
          }  
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
          {
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 ";
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
          }  
          else  
          {
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 ";
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
          }  
          if ($rs1 === false)  
          { 
              $this->Erro->mensagem (__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dbas'], $this->Db->ErrorMsg()); 
              if ($this->NM_ajax_flag)
              {
                 dye_standdf_form_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(); 
              if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
              { 
                  $comando = "UPDATE " . $this->Ini->nm_tabela . " SET GS = '$this->gs', `AS` = '$this->as', AE = '$this->ae', GS1 = '$this->gs1', AS1 = '$this->as1', AE1 = '$this->ae1', GS2 = '$this->gs2', AS2 = '$this->as2', AE2 = '$this->ae2', GS3 = '$this->gs3', AS3 = '$this->as3', AE3 = '$this->ae3', GS4 = '$this->gs4', AS4 = '$this->as4', AE4 = '$this->ae4', GS5 = '$this->gs5', AS5 = '$this->as5', AE5 = '$this->ae5', FS = '$this->fs', FRAME = '$this->frame', CPI = '$this->cpi', WPI = '$this->wpi', SPEC1 = '$this->spec1', SPEC2 = '$this->spec2', SPEC3 = '$this->spec3', FINISH = '$this->finish', FIN_NO = '$this->fin_no', GRYIELD = '$this->gryield', FYIELD = '$this->fyield', PUT_UP = '$this->put_up', FAB1 = '$this->fab1', FAB2 = '$this->fab2', FWIDTH = $this->fwidth, PANELS = $this->panels, ROLLSIZE = $this->rollsize, TUBESIZE = $this->tubesize, FOLD = '$this->fold', CASES = '$this->cases'";  
              } 
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
              { 
                  $comando = "UPDATE " . $this->Ini->nm_tabela . " SET GS = '$this->gs', `AS` = '$this->as', AE = '$this->ae', GS1 = '$this->gs1', AS1 = '$this->as1', AE1 = '$this->ae1', GS2 = '$this->gs2', AS2 = '$this->as2', AE2 = '$this->ae2', GS3 = '$this->gs3', AS3 = '$this->as3', AE3 = '$this->ae3', GS4 = '$this->gs4', AS4 = '$this->as4', AE4 = '$this->ae4', GS5 = '$this->gs5', AS5 = '$this->as5', AE5 = '$this->ae5', FS = '$this->fs', FRAME = '$this->frame', CPI = '$this->cpi', WPI = '$this->wpi', SPEC1 = '$this->spec1', SPEC2 = '$this->spec2', SPEC3 = '$this->spec3', FINISH = '$this->finish', FIN_NO = '$this->fin_no', GRYIELD = '$this->gryield', FYIELD = '$this->fyield', PUT_UP = '$this->put_up', FAB1 = '$this->fab1', FAB2 = '$this->fab2', FWIDTH = $this->fwidth, PANELS = $this->panels, ROLLSIZE = $this->rollsize, TUBESIZE = $this->tubesize, FOLD = '$this->fold', CASES = '$this->cases'";  
              } 
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
              { 
                  $comando_oracle = "UPDATE " . $this->Ini->nm_tabela . " SET GS = '$this->gs', `AS` = '$this->as', AE = '$this->ae', GS1 = '$this->gs1', AS1 = '$this->as1', AE1 = '$this->ae1', GS2 = '$this->gs2', AS2 = '$this->as2', AE2 = '$this->ae2', GS3 = '$this->gs3', AS3 = '$this->as3', AE3 = '$this->ae3', GS4 = '$this->gs4', AS4 = '$this->as4', AE4 = '$this->ae4', GS5 = '$this->gs5', AS5 = '$this->as5', AE5 = '$this->ae5', FS = '$this->fs', FRAME = '$this->frame', CPI = '$this->cpi', WPI = '$this->wpi', SPEC1 = '$this->spec1', SPEC2 = '$this->spec2', SPEC3 = '$this->spec3', FINISH = '$this->finish', FIN_NO = '$this->fin_no', GRYIELD = '$this->gryield', FYIELD = '$this->fyield', PUT_UP = '$this->put_up', FAB1 = '$this->fab1', FAB2 = '$this->fab2', FWIDTH = $this->fwidth, PANELS = $this->panels, ROLLSIZE = $this->rollsize, TUBESIZE = $this->tubesize, FOLD = '$this->fold', CASES = '$this->cases'";  
              } 
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
              { 
                  $comando_oracle = "UPDATE " . $this->Ini->nm_tabela . " SET GS = '$this->gs', `AS` = '$this->as', AE = '$this->ae', GS1 = '$this->gs1', AS1 = '$this->as1', AE1 = '$this->ae1', GS2 = '$this->gs2', AS2 = '$this->as2', AE2 = '$this->ae2', GS3 = '$this->gs3', AS3 = '$this->as3', AE3 = '$this->ae3', GS4 = '$this->gs4', AS4 = '$this->as4', AE4 = '$this->ae4', GS5 = '$this->gs5', AS5 = '$this->as5', AE5 = '$this->ae5', FS = '$this->fs', FRAME = '$this->frame', CPI = '$this->cpi', WPI = '$this->wpi', SPEC1 = '$this->spec1', SPEC2 = '$this->spec2', SPEC3 = '$this->spec3', FINISH = '$this->finish', FIN_NO = '$this->fin_no', GRYIELD = '$this->gryield', FYIELD = '$this->fyield', PUT_UP = '$this->put_up', FAB1 = '$this->fab1', FAB2 = '$this->fab2', FWIDTH = $this->fwidth, PANELS = $this->panels, ROLLSIZE = $this->rollsize, TUBESIZE = $this->tubesize, FOLD = '$this->fold', CASES = '$this->cases'";  
              } 
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
              { 
                  $comando_oracle = "UPDATE " . $this->Ini->nm_tabela . " SET GS = '$this->gs', `AS` = '$this->as', AE = '$this->ae', GS1 = '$this->gs1', AS1 = '$this->as1', AE1 = '$this->ae1', GS2 = '$this->gs2', AS2 = '$this->as2', AE2 = '$this->ae2', GS3 = '$this->gs3', AS3 = '$this->as3', AE3 = '$this->ae3', GS4 = '$this->gs4', AS4 = '$this->as4', AE4 = '$this->ae4', GS5 = '$this->gs5', AS5 = '$this->as5', AE5 = '$this->ae5', FS = '$this->fs', FRAME = '$this->frame', CPI = '$this->cpi', WPI = '$this->wpi', SPEC1 = '$this->spec1', SPEC2 = '$this->spec2', SPEC3 = '$this->spec3', FINISH = '$this->finish', FIN_NO = '$this->fin_no', GRYIELD = '$this->gryield', FYIELD = '$this->fyield', PUT_UP = '$this->put_up', FAB1 = '$this->fab1', FAB2 = '$this->fab2', FWIDTH = $this->fwidth, PANELS = $this->panels, ROLLSIZE = $this->rollsize, TUBESIZE = $this->tubesize, FOLD = '$this->fold', CASES = '$this->cases'";  
              } 
              else 
              { 
                  $comando = "UPDATE " . $this->Ini->nm_tabela . " SET GS = '$this->gs', `AS` = '$this->as', AE = '$this->ae', GS1 = '$this->gs1', AS1 = '$this->as1', AE1 = '$this->ae1', GS2 = '$this->gs2', AS2 = '$this->as2', AE2 = '$this->ae2', GS3 = '$this->gs3', AS3 = '$this->as3', AE3 = '$this->ae3', GS4 = '$this->gs4', AS4 = '$this->as4', AE4 = '$this->ae4', GS5 = '$this->gs5', AS5 = '$this->as5', AE5 = '$this->ae5', FS = '$this->fs', FRAME = '$this->frame', CPI = '$this->cpi', WPI = '$this->wpi', SPEC1 = '$this->spec1', SPEC2 = '$this->spec2', SPEC3 = '$this->spec3', FINISH = '$this->finish', FIN_NO = '$this->fin_no', GRYIELD = '$this->gryield', FYIELD = '$this->fyield', PUT_UP = '$this->put_up', FAB1 = '$this->fab1', FAB2 = '$this->fab2', FWIDTH = $this->fwidth, PANELS = $this->panels, ROLLSIZE = $this->rollsize, TUBESIZE = $this->tubesize, FOLD = '$this->fold', CASES = '$this->cases'";  
              } 
              if (isset($NM_val_form['date']) && $NM_val_form['date'] != $this->nmgp_dados_select['date']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
                  { 
                      $comando        .= " `DATE` = #$this->date#"; 
                  } 
                  else 
                  { 
                      $comando        .= " `DATE` = '$this->date'"; 
                  } 
                  if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
                  { 
                      $comando_oracle        .= " `DATE` = EXTEND('" . $this->date . "', YEAR TO DAY)"; 
                  } 
                  else
                  { 
                      $comando_oracle        .= " `DATE` = '$this->date'"; 
                  } 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (in_array(strtolower($this->Ini->nm_tpbanco), $nm_bases_lob_geral))
              { 
                  $comando = $comando_oracle;  
                  $SC_ex_update = $SC_ex_upd_or;
              }   
              if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
              {
                  $comando .= " WHERE NUMBER = $this->number and ID2 = $this->id2 ";  
              }  
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
              {
                  $comando .= " WHERE NUMBER = $this->number and ID2 = $this->id2 ";  
              }  
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
              {
                  $comando .= " WHERE NUMBER = $this->number and ID2 = $this->id2 ";  
              }  
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
              {
                  $comando .= " WHERE NUMBER = $this->number and ID2 = $this->id2 ";  
              }  
              else  
              {
                  $comando .= " WHERE NUMBER = $this->number and ID2 = $this->id2 ";  
              }  
              $comando = str_replace("'null'", "null", $comando) ; 
              $comando = str_replace("#null#", "null", $comando) ; 
              if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
              {
                $comando = str_replace("EXTEND('', YEAR TO FRACTION)", "null", $comando) ; 
                $comando = str_replace("EXTEND(null, YEAR TO FRACTION)", "null", $comando) ; 
                $comando = str_replace("EXTEND('', YEAR TO DAY)", "null", $comando) ; 
                $comando = str_replace("EXTEND(null, YEAR TO DAY)", "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)
                              {
                                  dye_standdf_form_pack_ajax_response();
                              }
                              exit;  
                          }   
                      }   
                  }   
              }   
              if (in_array(strtolower($this->Ini->nm_tpbanco), $nm_bases_lob_geral))
              { 
              }   
              $this->sc_evento = "update"; 
              $this->nmgp_opcao = "igual"; 
              $this->nm_flag_iframe = true;
              if ($this->lig_edit_lookup)
              {
                  $this->lig_edit_lookup_call = true;
              }

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


              if     (isset($NM_val_form) && isset($NM_val_form['number'])) { $this->number = $NM_val_form['number']; }
              elseif (isset($this->number)) { $this->nm_limpa_alfa($this->number); }
              if     (isset($NM_val_form) && isset($NM_val_form['gs'])) { $this->gs = $NM_val_form['gs']; }
              elseif (isset($this->gs)) { $this->nm_limpa_alfa($this->gs); }
              if     (isset($NM_val_form) && isset($NM_val_form['as'])) { $this->as = $NM_val_form['as']; }
              elseif (isset($this->as)) { $this->nm_limpa_alfa($this->as); }
              if     (isset($NM_val_form) && isset($NM_val_form['ae'])) { $this->ae = $NM_val_form['ae']; }
              elseif (isset($this->ae)) { $this->nm_limpa_alfa($this->ae); }
              if     (isset($NM_val_form) && isset($NM_val_form['gs1'])) { $this->gs1 = $NM_val_form['gs1']; }
              elseif (isset($this->gs1)) { $this->nm_limpa_alfa($this->gs1); }
              if     (isset($NM_val_form) && isset($NM_val_form['as1'])) { $this->as1 = $NM_val_form['as1']; }
              elseif (isset($this->as1)) { $this->nm_limpa_alfa($this->as1); }
              if     (isset($NM_val_form) && isset($NM_val_form['ae1'])) { $this->ae1 = $NM_val_form['ae1']; }
              elseif (isset($this->ae1)) { $this->nm_limpa_alfa($this->ae1); }
              if     (isset($NM_val_form) && isset($NM_val_form['gs2'])) { $this->gs2 = $NM_val_form['gs2']; }
              elseif (isset($this->gs2)) { $this->nm_limpa_alfa($this->gs2); }
              if     (isset($NM_val_form) && isset($NM_val_form['as2'])) { $this->as2 = $NM_val_form['as2']; }
              elseif (isset($this->as2)) { $this->nm_limpa_alfa($this->as2); }
              if     (isset($NM_val_form) && isset($NM_val_form['ae2'])) { $this->ae2 = $NM_val_form['ae2']; }
              elseif (isset($this->ae2)) { $this->nm_limpa_alfa($this->ae2); }
              if     (isset($NM_val_form) && isset($NM_val_form['gs3'])) { $this->gs3 = $NM_val_form['gs3']; }
              elseif (isset($this->gs3)) { $this->nm_limpa_alfa($this->gs3); }
              if     (isset($NM_val_form) && isset($NM_val_form['as3'])) { $this->as3 = $NM_val_form['as3']; }
              elseif (isset($this->as3)) { $this->nm_limpa_alfa($this->as3); }
              if     (isset($NM_val_form) && isset($NM_val_form['ae3'])) { $this->ae3 = $NM_val_form['ae3']; }
              elseif (isset($this->ae3)) { $this->nm_limpa_alfa($this->ae3); }
              if     (isset($NM_val_form) && isset($NM_val_form['gs4'])) { $this->gs4 = $NM_val_form['gs4']; }
              elseif (isset($this->gs4)) { $this->nm_limpa_alfa($this->gs4); }
              if     (isset($NM_val_form) && isset($NM_val_form['as4'])) { $this->as4 = $NM_val_form['as4']; }
              elseif (isset($this->as4)) { $this->nm_limpa_alfa($this->as4); }
              if     (isset($NM_val_form) && isset($NM_val_form['ae4'])) { $this->ae4 = $NM_val_form['ae4']; }
              elseif (isset($this->ae4)) { $this->nm_limpa_alfa($this->ae4); }
              if     (isset($NM_val_form) && isset($NM_val_form['gs5'])) { $this->gs5 = $NM_val_form['gs5']; }
              elseif (isset($this->gs5)) { $this->nm_limpa_alfa($this->gs5); }
              if     (isset($NM_val_form) && isset($NM_val_form['as5'])) { $this->as5 = $NM_val_form['as5']; }
              elseif (isset($this->as5)) { $this->nm_limpa_alfa($this->as5); }
              if     (isset($NM_val_form) && isset($NM_val_form['ae5'])) { $this->ae5 = $NM_val_form['ae5']; }
              elseif (isset($this->ae5)) { $this->nm_limpa_alfa($this->ae5); }
              if     (isset($NM_val_form) && isset($NM_val_form['fs'])) { $this->fs = $NM_val_form['fs']; }
              elseif (isset($this->fs)) { $this->nm_limpa_alfa($this->fs); }
              if     (isset($NM_val_form) && isset($NM_val_form['frame'])) { $this->frame = $NM_val_form['frame']; }
              elseif (isset($this->frame)) { $this->nm_limpa_alfa($this->frame); }
              if     (isset($NM_val_form) && isset($NM_val_form['cpi'])) { $this->cpi = $NM_val_form['cpi']; }
              elseif (isset($this->cpi)) { $this->nm_limpa_alfa($this->cpi); }
              if     (isset($NM_val_form) && isset($NM_val_form['wpi'])) { $this->wpi = $NM_val_form['wpi']; }
              elseif (isset($this->wpi)) { $this->nm_limpa_alfa($this->wpi); }
              if     (isset($NM_val_form) && isset($NM_val_form['spec1'])) { $this->spec1 = $NM_val_form['spec1']; }
              elseif (isset($this->spec1)) { $this->nm_limpa_alfa($this->spec1); }
              if     (isset($NM_val_form) && isset($NM_val_form['spec2'])) { $this->spec2 = $NM_val_form['spec2']; }
              elseif (isset($this->spec2)) { $this->nm_limpa_alfa($this->spec2); }
              if     (isset($NM_val_form) && isset($NM_val_form['spec3'])) { $this->spec3 = $NM_val_form['spec3']; }
              elseif (isset($this->spec3)) { $this->nm_limpa_alfa($this->spec3); }
              if     (isset($NM_val_form) && isset($NM_val_form['finish'])) { $this->finish = $NM_val_form['finish']; }
              elseif (isset($this->finish)) { $this->nm_limpa_alfa($this->finish); }
              if     (isset($NM_val_form) && isset($NM_val_form['fin_no'])) { $this->fin_no = $NM_val_form['fin_no']; }
              elseif (isset($this->fin_no)) { $this->nm_limpa_alfa($this->fin_no); }
              if     (isset($NM_val_form) && isset($NM_val_form['gryield'])) { $this->gryield = $NM_val_form['gryield']; }
              elseif (isset($this->gryield)) { $this->nm_limpa_alfa($this->gryield); }
              if     (isset($NM_val_form) && isset($NM_val_form['fyield'])) { $this->fyield = $NM_val_form['fyield']; }
              elseif (isset($this->fyield)) { $this->nm_limpa_alfa($this->fyield); }
              if     (isset($NM_val_form) && isset($NM_val_form['put_up'])) { $this->put_up = $NM_val_form['put_up']; }
              elseif (isset($this->put_up)) { $this->nm_limpa_alfa($this->put_up); }
              if     (isset($NM_val_form) && isset($NM_val_form['fab1'])) { $this->fab1 = $NM_val_form['fab1']; }
              elseif (isset($this->fab1)) { $this->nm_limpa_alfa($this->fab1); }
              if     (isset($NM_val_form) && isset($NM_val_form['fab2'])) { $this->fab2 = $NM_val_form['fab2']; }
              elseif (isset($this->fab2)) { $this->nm_limpa_alfa($this->fab2); }
              if     (isset($NM_val_form) && isset($NM_val_form['fwidth'])) { $this->fwidth = $NM_val_form['fwidth']; }
              elseif (isset($this->fwidth)) { $this->nm_limpa_alfa($this->fwidth); }
              if     (isset($NM_val_form) && isset($NM_val_form['panels'])) { $this->panels = $NM_val_form['panels']; }
              elseif (isset($this->panels)) { $this->nm_limpa_alfa($this->panels); }
              if     (isset($NM_val_form) && isset($NM_val_form['rollsize'])) { $this->rollsize = $NM_val_form['rollsize']; }
              elseif (isset($this->rollsize)) { $this->nm_limpa_alfa($this->rollsize); }
              if     (isset($NM_val_form) && isset($NM_val_form['tubesize'])) { $this->tubesize = $NM_val_form['tubesize']; }
              elseif (isset($this->tubesize)) { $this->nm_limpa_alfa($this->tubesize); }
              if     (isset($NM_val_form) && isset($NM_val_form['fold'])) { $this->fold = $NM_val_form['fold']; }
              elseif (isset($this->fold)) { $this->nm_limpa_alfa($this->fold); }
              if     (isset($NM_val_form) && isset($NM_val_form['cases'])) { $this->cases = $NM_val_form['cases']; }
              elseif (isset($this->cases)) { $this->nm_limpa_alfa($this->cases); }

              $this->nm_formatar_campos();
              if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
              {
              }

              $aOldRefresh               = $this->nmgp_refresh_fields;
              $this->nmgp_refresh_fields = array('number', 'date', 'gs', 'fs', 'frame', 'fwidth', 'panels', 'cpi', 'wpi', 'gryield', 'fyield', 'finno2', 'finish', 'fin_no', 'put_up', 'rollsize', 'tubesize', 'fold', 'cases', 'spec1', 'spec2', 'spec3', 'fab1', 'fab2', 'as', 'ae', 'gs1', 'as1', 'ae1', 'gs2', 'as2', 'ae2', 'gs3', 'as3', 'ae3', 'gs4', 'as4', 'ae4', 'gs5', 'as5', 'ae5');
              $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]['dye_standdf_form']['foreign_key']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['foreign_key']))
          {
              foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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]['dye_standdf_form']['decimal_db'] == ",") 
          {
              $this->nm_poe_aspas_decimal();
          }
          $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(NUMBER) from " . $this->Ini->nm_tabela; 
          $comando = "select max(NUMBER) from " . $this->Ini->nm_tabela; 
          $rs = $this->Db->Execute($comando); 
          if ($rs === false && !$rs->EOF)  
          { 
              $this->Erro->mensagem (__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_inst'], $this->Db->ErrorMsg()); 
              $this->NM_rollback_db(); 
              if ($this->NM_ajax_flag)
              {
                  dye_standdf_form_pack_ajax_response();
              }
              exit; 
          }  
          $this->number = $rs->fields[0] + 1;
          $rs->Close(); 
              $this->date =  date('Y') . "-" . date('m')  . "-" . date('d');
          $bInsertOk = true;
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
          {
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
          }  
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
          {
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
          }  
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
          {
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
          }  
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
          {
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
          }  
          else  
          {
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
          }  
          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 != 0) 
          { 
              $this->Erro->mensagem (__FILE__, __LINE__, "critica", $this->Ini->Nm_lang['lang_errm_pkey']); 
              $this->nmgp_opcao = "nada"; 
              $GLOBALS["erro_incl"] = 1; 
              $bInsertOk = false;
              $this->sc_evento = 'insert';
          } 
          $rs1->Close(); 
          $aInsertOk = array(); 
          $bInsertOk = $bInsertOk && empty($aInsertOk);
          if ($bInsertOk)
          { 
              if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
              { 
                  $comando = "INSERT INTO " . $this->Ini->nm_tabela . " (NUMBER, `DATE`, GS, `AS`, AE, GS1, AS1, AE1, GS2, AS2, AE2, GS3, AS3, AE3, GS4, AS4, AE4, GS5, AS5, AE5, FS, FRAME, CPI, WPI, SPEC1, SPEC2, SPEC3, FINISH, FIN_NO, GRYIELD, FYIELD, PUT_UP, FAB1, FAB2, FWIDTH, PANELS, ROLLSIZE, TUBESIZE, FOLD, CASES, ID2) VALUES ($this->number, #$this->date#, '$this->gs', '$this->as', '$this->ae', '$this->gs1', '$this->as1', '$this->ae1', '$this->gs2', '$this->as2', '$this->ae2', '$this->gs3', '$this->as3', '$this->ae3', '$this->gs4', '$this->as4', '$this->ae4', '$this->gs5', '$this->as5', '$this->ae5', '$this->fs', '$this->frame', '$this->cpi', '$this->wpi', '$this->spec1', '$this->spec2', '$this->spec3', '$this->finish', '$this->fin_no', '$this->gryield', '$this->fyield', '$this->put_up', '$this->fab1', '$this->fab2', $this->fwidth, $this->panels, $this->rollsize, $this->tubesize, '$this->fold', '$this->cases', $this->id2)"; 
              }
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
              { 
                  $comando = "INSERT INTO " . $this->Ini->nm_tabela . " (" . $NM_cmp_auto . "NUMBER, `DATE`, GS, `AS`, AE, GS1, AS1, AE1, GS2, AS2, AE2, GS3, AS3, AE3, GS4, AS4, AE4, GS5, AS5, AE5, FS, FRAME, CPI, WPI, SPEC1, SPEC2, SPEC3, FINISH, FIN_NO, GRYIELD, FYIELD, PUT_UP, FAB1, FAB2, FWIDTH, PANELS, ROLLSIZE, TUBESIZE, FOLD, CASES, ID2) VALUES (" . $NM_seq_auto . "$this->number, '$this->date', '$this->gs', '$this->as', '$this->ae', '$this->gs1', '$this->as1', '$this->ae1', '$this->gs2', '$this->as2', '$this->ae2', '$this->gs3', '$this->as3', '$this->ae3', '$this->gs4', '$this->as4', '$this->ae4', '$this->gs5', '$this->as5', '$this->ae5', '$this->fs', '$this->frame', '$this->cpi', '$this->wpi', '$this->spec1', '$this->spec2', '$this->spec3', '$this->finish', '$this->fin_no', '$this->gryield', '$this->fyield', '$this->put_up', '$this->fab1', '$this->fab2', $this->fwidth, $this->panels, $this->rollsize, $this->tubesize, '$this->fold', '$this->cases', $this->id2)"; 
              }
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
              {
                  $comando = "INSERT INTO " . $this->Ini->nm_tabela . " (" . $NM_cmp_auto . "NUMBER, `DATE`, GS, `AS`, AE, GS1, AS1, AE1, GS2, AS2, AE2, GS3, AS3, AE3, GS4, AS4, AE4, GS5, AS5, AE5, FS, FRAME, CPI, WPI, SPEC1, SPEC2, SPEC3, FINISH, FIN_NO, GRYIELD, FYIELD, PUT_UP, FAB1, FAB2, FWIDTH, PANELS, ROLLSIZE, TUBESIZE, FOLD, CASES, ID2) VALUES (" . $NM_seq_auto . "$this->number, '$this->date', '$this->gs', '$this->as', '$this->ae', '$this->gs1', '$this->as1', '$this->ae1', '$this->gs2', '$this->as2', '$this->ae2', '$this->gs3', '$this->as3', '$this->ae3', '$this->gs4', '$this->as4', '$this->ae4', '$this->gs5', '$this->as5', '$this->ae5', '$this->fs', '$this->frame', '$this->cpi', '$this->wpi', '$this->spec1', '$this->spec2', '$this->spec3', '$this->finish', '$this->fin_no', '$this->gryield', '$this->fyield', '$this->put_up', '$this->fab1', '$this->fab2', $this->fwidth, $this->panels, $this->rollsize, $this->tubesize, '$this->fold', '$this->cases', $this->id2)"; 
              }
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
              {
                  $comando = "INSERT INTO " . $this->Ini->nm_tabela . " (" . $NM_cmp_auto . "NUMBER, `DATE`, GS, `AS`, AE, GS1, AS1, AE1, GS2, AS2, AE2, GS3, AS3, AE3, GS4, AS4, AE4, GS5, AS5, AE5, FS, FRAME, CPI, WPI, SPEC1, SPEC2, SPEC3, FINISH, FIN_NO, GRYIELD, FYIELD, PUT_UP, FAB1, FAB2, FWIDTH, PANELS, ROLLSIZE, TUBESIZE, FOLD, CASES, ID2) VALUES (" . $NM_seq_auto . "$this->number, EXTEND('$this->date', YEAR TO DAY), '$this->gs', '$this->as', '$this->ae', '$this->gs1', '$this->as1', '$this->ae1', '$this->gs2', '$this->as2', '$this->ae2', '$this->gs3', '$this->as3', '$this->ae3', '$this->gs4', '$this->as4', '$this->ae4', '$this->gs5', '$this->as5', '$this->ae5', '$this->fs', '$this->frame', '$this->cpi', '$this->wpi', '$this->spec1', '$this->spec2', '$this->spec3', '$this->finish', '$this->fin_no', '$this->gryield', '$this->fyield', '$this->put_up', '$this->fab1', '$this->fab2', $this->fwidth, $this->panels, $this->rollsize, $this->tubesize, '$this->fold', '$this->cases', $this->id2)"; 
              }
              else
              {
                  $comando = "INSERT INTO " . $this->Ini->nm_tabela . " (" . $NM_cmp_auto . "NUMBER, `DATE`, GS, `AS`, AE, GS1, AS1, AE1, GS2, AS2, AE2, GS3, AS3, AE3, GS4, AS4, AE4, GS5, AS5, AE5, FS, FRAME, CPI, WPI, SPEC1, SPEC2, SPEC3, FINISH, FIN_NO, GRYIELD, FYIELD, PUT_UP, FAB1, FAB2, FWIDTH, PANELS, ROLLSIZE, TUBESIZE, FOLD, CASES, ID2) VALUES (" . $NM_seq_auto . "$this->number, '$this->date', '$this->gs', '$this->as', '$this->ae', '$this->gs1', '$this->as1', '$this->ae1', '$this->gs2', '$this->as2', '$this->ae2', '$this->gs3', '$this->as3', '$this->ae3', '$this->gs4', '$this->as4', '$this->ae4', '$this->gs5', '$this->as5', '$this->ae5', '$this->fs', '$this->frame', '$this->cpi', '$this->wpi', '$this->spec1', '$this->spec2', '$this->spec3', '$this->finish', '$this->fin_no', '$this->gryield', '$this->fyield', '$this->put_up', '$this->fab1', '$this->fab2', $this->fwidth, $this->panels, $this->rollsize, $this->tubesize, '$this->fold', '$this->cases', $this->id2)"; 
              }
              $comando = str_replace("'null'", "null", $comando) ; 
              $comando = str_replace("#null#", "null", $comando) ; 
              if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
              {
                $comando = str_replace("EXTEND('', YEAR TO FRACTION)", "null", $comando) ; 
                $comando = str_replace("EXTEND(null, YEAR TO FRACTION)", "null", $comando) ; 
                $comando = str_replace("EXTEND('', YEAR TO DAY)", "null", $comando) ; 
                $comando = str_replace("EXTEND(null, YEAR TO DAY)", "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)
                          {
                              dye_standdf_form_pack_ajax_response();
                              exit; 
                          }
                      }  
                  }  
              }  
              if ('refresh_insert' != $this->nmgp_opcao)
              {
              }

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

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

              $this->sc_evento = "insert"; 
              $this->sc_insert_on = true; 
              if ('refresh_insert' != $this->nmgp_opcao && (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['sc_redir_insert']) || $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['sc_redir_insert'] != "S"))
              {
              $this->nmgp_opcao = "novo"; 
              }
              $this->nm_flag_iframe = true;
          } 
          if ($this->lig_edit_lookup)
          {
              $this->lig_edit_lookup_call = true;
          }
      } 
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['decimal_db'] == ",") 
      {
          $this->nm_tira_aspas_decimal();
      }
      if ($this->nmgp_opcao == "excluir") 
      { 
          $this->number = substr($this->Db->qstr($this->number), 1, -1); 
          $this->id2 = substr($this->Db->qstr($this->id2), 1, -1); 

          $bDelecaoOk = true;
          $sMsgErro   = '';

          if ($bDelecaoOk)
          {

          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
          {
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2"; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
          }  
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
          {
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2"; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
          }  
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
          {
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2"; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
          }  
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
          {
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2"; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
          }  
          else  
          {
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2"; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
          }  
          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(); 
              if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
              {
                  $_SESSION['scriptcase']['sc_sql_ult_comando'] = "DELETE FROM " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "; 
                  $rs = $this->Db->Execute("DELETE FROM " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
              }  
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
              {
                  $_SESSION['scriptcase']['sc_sql_ult_comando'] = "DELETE FROM " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "; 
                  $rs = $this->Db->Execute("DELETE FROM " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
              }  
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
              {
                  $_SESSION['scriptcase']['sc_sql_ult_comando'] = "DELETE FROM " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "; 
                  $rs = $this->Db->Execute("DELETE FROM " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
              }  
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
              {
                  $_SESSION['scriptcase']['sc_sql_ult_comando'] = "DELETE FROM " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "; 
                  $rs = $this->Db->Execute("DELETE FROM " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
              }  
              else  
              {
                  $_SESSION['scriptcase']['sc_sql_ult_comando'] = "DELETE FROM " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "; 
                  $rs = $this->Db->Execute("DELETE FROM " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 = $this->id2 "); 
              }  
              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)
                      {
                          dye_standdf_form_pack_ajax_response();
                          exit; 
                      }
                  } 
              } 
              $this->sc_evento = "delete"; 
              $this->nmgp_opcao = "avanca"; 
              $this->nm_flag_iframe = true;
              $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start']--; 
              if ($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start'] < 0)
              {
                  $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start'] = 0; 
              }

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

              if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['total']))
              {
                  unset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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 ($salva_opcao == "incluir" && $GLOBALS["erro_incl"] != 1) 
      { 
          $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['parms'] = "number?#?$this->number?@?id2?#?$this->id2?@?"; 
      }
      $this->NM_commit_db(); 
      if ($this->sc_evento != "insert" && $this->sc_evento != "update" && $this->sc_evento != "delete")
      { 
          $this->number = substr($this->Db->qstr($this->number), 1, -1); 
          $this->id2 = substr($this->Db->qstr($this->id2), 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]['dye_standdf_form']['where_filter'] = trim($this->NM_where_filter);
          if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['total']))
          {
              unset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['total']);
          }
      }
      $sc_where_filter = '';
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['where_filter_form']) && '' != $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['where_filter_form'])
      {
          $sc_where_filter = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['where_filter_form'];
      }
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['where_filter']) && '' != $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['where_filter'])
      {
          if (empty($sc_where_filter))
          {
              $sc_where_filter = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['where_filter'];
          }
          else
          {
              $sc_where_filter .= " and (" . $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['where_filter'] . ")";
          }
      }
//------------ 
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['run_iframe'] == "F" || $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['run_iframe'] == "R")
      {
          if ($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['iframe_evento'] == "insert") 
          { 
               $this->nmgp_opcao = "novo"; 
               $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['select'] = "";
          } 
          $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['iframe_evento'] = $this->sc_evento; 
      } 
      if (!isset($this->nmgp_opcao) || empty($this->nmgp_opcao)) 
      { 
          if (empty($this->number) && empty($this->id2)) 
          { 
              $this->nmgp_opcao = "inicio"; 
          } 
          else 
          { 
              $this->nmgp_opcao = "igual"; 
          } 
      } 
      if (isset($_POST['master_nav']) && 'on' == $_POST['master_nav']) 
      { 
          $this->nmgp_opcao = "inicio";
      } 
      if ($this->nmgp_opcao != "nada" && (trim($this->number) === "" || trim($this->id2) === "")) 
      { 
          if ($this->nmgp_opcao == "avanca")  
          { 
              $this->nmgp_opcao = "final"; 
          } 
          elseif ($this->nmgp_opcao != "novo")
          { 
              $this->nmgp_opcao = "inicio"; 
          } 
      } 
      if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
      { 
          $GLOBALS["NM_ERRO_IBASE"] = 1;  
      } 
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['run_iframe'] == "F" && $this->sc_evento == "insert")
      {
          $this->nmgp_opcao = "final";
      }
      $sc_where = trim("");
      if (substr(strtolower($sc_where), 0, 5) == "where")
      {
          $sc_where  = substr($sc_where , 5);
      }
      if (!empty($sc_where))
      {
          $sc_where = " where " . $sc_where . " ";
      }
      if ('' != $sc_where_filter)
      {
          $sc_where = ('' != $sc_where) ? $sc_where . ' and (' . $sc_where_filter . ')' : ' where ' . $sc_where_filter;
      }
      if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['total']))
      { 
          $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_dye_standdf_form = isset($rt->fields[0]) ? $rt->fields[0] - 1 : 0; 
          $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['total'] = $qt_geral_reg_dye_standdf_form;
          $rt->Close(); 
          if ($this->nmgp_opcao == "igual" && isset($this->NM_btn_navega) && 'S' == $this->NM_btn_navega && !empty($this->number) && !empty($this->id2))
          {
              $Reg_OK      = false;
              $Count_start = -1;
              $sc_order_by = "";
              if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
              {
                  $Sel_Chave = "NUMBER, ID2"; 
              }
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
              {
                  $Sel_Chave = "NUMBER, ID2"; 
              }
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
              {
                  $Sel_Chave = "NUMBER, ID2"; 
              }
              else  
              {
                  $Sel_Chave = "NUMBER, ID2"; 
              }
              $nmgp_select = "SELECT " . $Sel_Chave . " from " . $this->Ini->nm_tabela . $sc_where; 
              $sc_order_by = "NUMBER, ID2";
              $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 "; 
              }
              $_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 ; 
              }  
              while (!$rt->EOF && !$Reg_OK)
              { 
                  if ($rt->fields[0] == $this->number && $rt->fields[1] == $this->id2)
                  { 
                      $Reg_OK = true;
                  }  
                  $Count_start++;
                  $rt->MoveNext();
              }  
              $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start'] = $Count_start;
              $rt->Close(); 
          }
      } 
      else 
      { 
          $qt_geral_reg_dye_standdf_form = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['total'];
      } 
      if ($this->nmgp_opcao == "inicio") 
      { 
          $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start'] = 0; 
      } 
      if ($this->nmgp_opcao == "avanca")  
      { 
          $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start']++; 
          if ($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start'] > $qt_geral_reg_dye_standdf_form)
          {
              $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start'] = $qt_geral_reg_dye_standdf_form; 
          }
      } 
      if ($this->nmgp_opcao == "retorna") 
      { 
          $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start']--; 
          if ($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start'] < 0)
          {
              $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start'] = 0; 
          }
      } 
      if ($this->nmgp_opcao == "final") 
      { 
          $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start'] = $qt_geral_reg_dye_standdf_form; 
      } 
      if ($this->nmgp_opcao == "navpage" && ($this->nmgp_ordem - 1) <= $qt_geral_reg_dye_standdf_form) 
      { 
          $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start'] = $this->nmgp_ordem - 1; 
      } 
      if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start']) || empty($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start']))
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start'] = 0;
      }
      $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_qtd'] = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start'] + 1;
      $this->NM_ajax_info['navSummary']['reg_ini'] = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start'] + 1; 
      $this->NM_ajax_info['navSummary']['reg_qtd'] = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_qtd']; 
      $this->NM_ajax_info['navSummary']['reg_tot'] = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['total'] + 1; 
      $this->NM_gera_nav_page(); 
      $this->NM_ajax_info['navPage'] = $this->SC_nav_page; 
      $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]['dye_standdf_form']['parms'] = ""; 
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
          { 
              $GLOBALS["NM_ERRO_IBASE"] = 1;  
          } 
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sybase))
          { 
              $nmgp_select = "SELECT NUMBER, str_replace (convert(char(10),`DATE`,102), '.', '-') + ' ' + convert(char(8),`DATE`,20), GS, `AS`, AE, GS1, AS1, AE1, GS2, AS2, AE2, GS3, AS3, AE3, GS4, AS4, AE4, GS5, AS5, AE5, FS, FRAME, CPI, WPI, SPEC1, SPEC2, SPEC3, FINISH, FIN_NO, GRYIELD, FYIELD, PUT_UP, FAB1, FAB2, FWIDTH, PANELS, ROLLSIZE, TUBESIZE, FOLD, CASES, ID2 from " . $this->Ini->nm_tabela ; 
          } 
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
          { 
              $nmgp_select = "SELECT NUMBER, convert(char(23),`DATE`,121), GS, `AS`, AE, GS1, AS1, AE1, GS2, AS2, AE2, GS3, AS3, AE3, GS4, AS4, AE4, GS5, AS5, AE5, FS, FRAME, CPI, WPI, SPEC1, SPEC2, SPEC3, FINISH, FIN_NO, GRYIELD, FYIELD, PUT_UP, FAB1, FAB2, FWIDTH, PANELS, ROLLSIZE, TUBESIZE, FOLD, CASES, ID2 from " . $this->Ini->nm_tabela ; 
          } 
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
          { 
              $nmgp_select = "SELECT NUMBER, `DATE`, GS, `AS`, AE, GS1, AS1, AE1, GS2, AS2, AE2, GS3, AS3, AE3, GS4, AS4, AE4, GS5, AS5, AE5, FS, FRAME, CPI, WPI, SPEC1, SPEC2, SPEC3, FINISH, FIN_NO, GRYIELD, FYIELD, PUT_UP, FAB1, FAB2, FWIDTH, PANELS, ROLLSIZE, TUBESIZE, FOLD, CASES, ID2 from " . $this->Ini->nm_tabela ; 
          } 
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
          { 
              $nmgp_select = "SELECT NUMBER, EXTEND(`DATE`, YEAR TO DAY), GS, `AS`, AE, GS1, AS1, AE1, GS2, AS2, AE2, GS3, AS3, AE3, GS4, AS4, AE4, GS5, AS5, AE5, FS, FRAME, CPI, WPI, SPEC1, SPEC2, SPEC3, FINISH, FIN_NO, GRYIELD, FYIELD, PUT_UP, FAB1, FAB2, FWIDTH, PANELS, ROLLSIZE, TUBESIZE, FOLD, CASES, ID2 from " . $this->Ini->nm_tabela ; 
          } 
          else 
          { 
              $nmgp_select = "SELECT NUMBER, `DATE`, GS, `AS`, AE, GS1, AS1, AE1, GS2, AS2, AE2, GS3, AS3, AE3, GS4, AS4, AE4, GS5, AS5, AE5, FS, FRAME, CPI, WPI, SPEC1, SPEC2, SPEC3, FINISH, FIN_NO, GRYIELD, FYIELD, PUT_UP, FAB1, FAB2, FWIDTH, PANELS, ROLLSIZE, TUBESIZE, FOLD, CASES, ID2 from " . $this->Ini->nm_tabela ; 
          } 
          $aWhere = array();
          $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 (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
              {
                  $aWhere[] = "NUMBER = $this->number and ID2 = $this->id2"; 
              }  
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
              {
                  $aWhere[] = "NUMBER = $this->number and ID2 = $this->id2"; 
              }  
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
              {
                  $aWhere[] = "NUMBER = $this->number and ID2 = $this->id2"; 
              }  
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
              {
                  $aWhere[] = "NUMBER = $this->number and ID2 = $this->id2"; 
              }  
              else  
              {
                  $aWhere[] = "NUMBER = $this->number and ID2 = $this->id2"; 
              }  
              if (!empty($sc_where_filter))  
              {
                  $teste_select = $nmgp_select . $this->returnWhere($aWhere);
                  $_SESSION['scriptcase']['sc_sql_ult_comando'] = $teste_select; 
                  $rs = $this->Db->Execute($teste_select); 
                  if ($rs->EOF)
                  {
                     $aWhere = array($sc_where_filter);
                  }  
                  $rs->Close(); 
              }  
          } 
          $nmgp_select .= $this->returnWhere($aWhere) . ' ';
          $sc_order_by = "";
          $sc_order_by = "NUMBER, ID2";
          $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]['dye_standdf_form']['run_iframe'] == "F" || $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['run_iframe'] == "R")
          {
              if ($this->sc_evento == "update")
              {
                  $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['select'] = $nmgp_select;
                  $this->nm_gera_html();
              } 
              elseif (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['select']))
              { 
                  $nmgp_select = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['select'];
                  $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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) || in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres) || in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle) || in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase) || in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_db2))
          { 
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "SelectLimit($nmgp_select, 1, " . $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start'] . ")" ; 
              $rs = $this->Db->SelectLimit($nmgp_select, 1, $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start']) ; 
          } 
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
          { 
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "SelectLimit($nmgp_select, 1, " . $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start'] . ")" ; 
              $rs = $this->Db->SelectLimit($nmgp_select, 1, $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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]['dye_standdf_form']['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 ($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(); 
              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->number = $rs->fields[0] ; 
              $this->nmgp_dados_select['number'] = $this->number;
              $this->date = $rs->fields[1] ; 
              $this->nmgp_dados_select['date'] = $this->date;
              $this->gs = $rs->fields[2] ; 
              $this->nmgp_dados_select['gs'] = $this->gs;
              $this->as = $rs->fields[3] ; 
              $this->nmgp_dados_select['as'] = $this->as;
              $this->ae = $rs->fields[4] ; 
              $this->nmgp_dados_select['ae'] = $this->ae;
              $this->gs1 = $rs->fields[5] ; 
              $this->nmgp_dados_select['gs1'] = $this->gs1;
              $this->as1 = $rs->fields[6] ; 
              $this->nmgp_dados_select['as1'] = $this->as1;
              $this->ae1 = $rs->fields[7] ; 
              $this->nmgp_dados_select['ae1'] = $this->ae1;
              $this->gs2 = $rs->fields[8] ; 
              $this->nmgp_dados_select['gs2'] = $this->gs2;
              $this->as2 = $rs->fields[9] ; 
              $this->nmgp_dados_select['as2'] = $this->as2;
              $this->ae2 = $rs->fields[10] ; 
              $this->nmgp_dados_select['ae2'] = $this->ae2;
              $this->gs3 = $rs->fields[11] ; 
              $this->nmgp_dados_select['gs3'] = $this->gs3;
              $this->as3 = $rs->fields[12] ; 
              $this->nmgp_dados_select['as3'] = $this->as3;
              $this->ae3 = $rs->fields[13] ; 
              $this->nmgp_dados_select['ae3'] = $this->ae3;
              $this->gs4 = $rs->fields[14] ; 
              $this->nmgp_dados_select['gs4'] = $this->gs4;
              $this->as4 = $rs->fields[15] ; 
              $this->nmgp_dados_select['as4'] = $this->as4;
              $this->ae4 = $rs->fields[16] ; 
              $this->nmgp_dados_select['ae4'] = $this->ae4;
              $this->gs5 = $rs->fields[17] ; 
              $this->nmgp_dados_select['gs5'] = $this->gs5;
              $this->as5 = $rs->fields[18] ; 
              $this->nmgp_dados_select['as5'] = $this->as5;
              $this->ae5 = $rs->fields[19] ; 
              $this->nmgp_dados_select['ae5'] = $this->ae5;
              $this->fs = $rs->fields[20] ; 
              $this->nmgp_dados_select['fs'] = $this->fs;
              $this->frame = $rs->fields[21] ; 
              $this->nmgp_dados_select['frame'] = $this->frame;
              $this->cpi = $rs->fields[22] ; 
              $this->nmgp_dados_select['cpi'] = $this->cpi;
              $this->wpi = $rs->fields[23] ; 
              $this->nmgp_dados_select['wpi'] = $this->wpi;
              $this->spec1 = $rs->fields[24] ; 
              $this->nmgp_dados_select['spec1'] = $this->spec1;
              $this->spec2 = $rs->fields[25] ; 
              $this->nmgp_dados_select['spec2'] = $this->spec2;
              $this->spec3 = $rs->fields[26] ; 
              $this->nmgp_dados_select['spec3'] = $this->spec3;
              $this->finish = $rs->fields[27] ; 
              $this->nmgp_dados_select['finish'] = $this->finish;
              $this->fin_no = $rs->fields[28] ; 
              $this->nmgp_dados_select['fin_no'] = $this->fin_no;
              $this->gryield = $rs->fields[29] ; 
              $this->nmgp_dados_select['gryield'] = $this->gryield;
              $this->fyield = $rs->fields[30] ; 
              $this->nmgp_dados_select['fyield'] = $this->fyield;
              $this->put_up = $rs->fields[31] ; 
              $this->nmgp_dados_select['put_up'] = $this->put_up;
              $this->fab1 = $rs->fields[32] ; 
              $this->nmgp_dados_select['fab1'] = $this->fab1;
              $this->fab2 = $rs->fields[33] ; 
              $this->nmgp_dados_select['fab2'] = $this->fab2;
              $this->fwidth = $rs->fields[34] ; 
              $this->nmgp_dados_select['fwidth'] = $this->fwidth;
              $this->panels = $rs->fields[35] ; 
              $this->nmgp_dados_select['panels'] = $this->panels;
              $this->rollsize = $rs->fields[36] ; 
              $this->nmgp_dados_select['rollsize'] = $this->rollsize;
              $this->tubesize = trim($rs->fields[37]) ; 
              $this->nmgp_dados_select['tubesize'] = $this->tubesize;
              $this->fold = $rs->fields[38] ; 
              $this->nmgp_dados_select['fold'] = $this->fold;
              $this->cases = $rs->fields[39] ; 
              $this->nmgp_dados_select['cases'] = $this->cases;
              $this->id2 = $rs->fields[40] ; 
              $this->nmgp_dados_select['id2'] = $this->id2;
          $GLOBALS["NM_ERRO_IBASE"] = 0; 
              $this->nm_troca_decimal(",", ".");
              $this->number = (string)$this->number; 
              $this->fwidth = (string)$this->fwidth; 
              $this->panels = (string)$this->panels; 
              $this->rollsize = (string)$this->rollsize; 
              $this->tubesize = (strpos(strtolower($this->tubesize), "e")) ? (float)$this->tubesize : $this->tubesize; 
              $this->tubesize = (string)$this->tubesize; 
              $this->id2 = (string)$this->id2; 
              $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['parms'] = "number?#?$this->number?@?id2?#?$this->id2?@?";
          } 
          $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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]['dye_standdf_form']['reg_start'];
              $this->Nav_permite_ava = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start'] < $qt_geral_reg_dye_standdf_form;
              $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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->number = "" ;  
              $this->date = "" ;  
              $this->date_hora = "" ;  
              $this->gs = "" ;  
              $this->as = "" ;  
              $this->ae = "" ;  
              $this->gs1 = "" ;  
              $this->as1 = "" ;  
              $this->ae1 = "" ;  
              $this->gs2 = "" ;  
              $this->as2 = "" ;  
              $this->ae2 = "" ;  
              $this->gs3 = "" ;  
              $this->as3 = "" ;  
              $this->ae3 = "" ;  
              $this->gs4 = "" ;  
              $this->as4 = "" ;  
              $this->ae4 = "" ;  
              $this->gs5 = "" ;  
              $this->as5 = "" ;  
              $this->ae5 = "" ;  
              $this->fs = "" ;  
              $this->frame = "" ;  
              $this->cpi = "" ;  
              $this->wpi = "" ;  
              $this->spec1 = "" ;  
              $this->spec2 = "" ;  
              $this->spec3 = "" ;  
              $this->finish = "" ;  
              $this->fin_no = "" ;  
              $this->gryield = "" ;  
              $this->fyield = "" ;  
              $this->put_up = "" ;  
              $this->fab1 = "" ;  
              $this->fab2 = "" ;  
              $this->fwidth = "" ;  
              $this->panels = "" ;  
              $this->rollsize = "" ;  
              $this->tubesize = "" ;  
              $this->fold = "" ;  
              $this->cases = "" ;  
              $this->id2 = "" ;  
              $this->finno2 = "" ;  
              $this->formatado = false;
          }
          if (($this->Embutida_form || $this->Embutida_multi) && isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['foreign_key']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['foreign_key']))
          {
              foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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_db_retorna($str_where_param = '') 
   {  
     $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
     $str_where_filter = ('' != $str_where_param) ? ' and ' . $str_where_param : '';
     if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 < $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 < $this->id2" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 < $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 < $this->id2" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 < $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 < $this->id2" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 < $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 < $this->id2" . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 < $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 < $this->id2" . $str_where_filter); 
     }  
     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 (isset($rs->fields[0]) && $rs->fields[0] != "") 
     { 
         $this->id2 = substr($this->Db->qstr($rs->fields[0]), 1, -1); 
         $rs->Close();  
         $this->nmgp_opcao = "igual";  
         return ;  
     } 
     $str_where_filter = ('' != $str_where_param) ? ' and ' . $str_where_param : '';
     if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER < $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER < $this->number" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER < $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER < $this->number" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER < $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER < $this->number" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER < $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER < $this->number" . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER < $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER < $this->number" . $str_where_filter); 
     }  
     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 (isset($rs->fields[0]) && $rs->fields[0] != "") 
     { 
         $this->number = substr($this->Db->qstr($rs->fields[0]), 1, -1); 
         $rs->Close();  
     } 
     else 
     { 
        $this->nmgp_opcao = "inicio";  
        $rs->Close();  
        return ; 
     } 
     $str_where_filter = ('' != $str_where_param) ? ' and ' . $str_where_param : '';
     if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter); 
     }  
     $this->id2 = substr($this->Db->qstr($rs->fields[0]), 1, -1); 
     $rs->Close();  
     $this->nmgp_opcao = "igual";  
     return ;  
   } 
// 
//-- 
   function nm_db_avanca($str_where_param = '') 
   {  
     $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
     $str_where_filter = ('' != $str_where_param) ? ' and ' . $str_where_param : '';
     if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 > $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 > $this->id2" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 > $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 > $this->id2" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 > $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 > $this->id2" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 > $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 > $this->id2" . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 > $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number and ID2 > $this->id2" . $str_where_filter); 
     }  
     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 (isset($rs->fields[0]) && $rs->fields[0] != "") 
     { 
         $this->id2 = substr($this->Db->qstr($rs->fields[0]), 1, -1); 
         $rs->Close();  
         $this->nmgp_opcao = "igual";  
         return ;  
     } 
     $str_where_filter = ('' != $str_where_param) ? ' and ' . $str_where_param : '';
     if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER > $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER > $this->number" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER > $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER > $this->number" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER > $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER > $this->number" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER > $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER > $this->number" . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER > $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(NUMBER) from " . $this->Ini->nm_tabela . " where NUMBER > $this->number" . $str_where_filter); 
     }  
     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 (isset($rs->fields[0]) && $rs->fields[0] != "") 
     { 
         $this->number = substr($this->Db->qstr($rs->fields[0]), 1, -1); 
         $rs->Close();  
     } 
     else 
     { 
        $this->nmgp_opcao = "final";  
        $rs->Close();  
        return ; 
     } 
     $str_where_filter = ('' != $str_where_param) ? ' and ' . $str_where_param : '';
     if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where NUMBER = $this->number" . $str_where_filter); 
     }  
     $this->id2 = substr($this->Db->qstr($rs->fields[0]), 1, -1); 
     $rs->Close();  
     $this->nmgp_opcao = "igual";  
     return ;  
   } 
// 
//-- 
   function nm_db_inicio($str_where_param = '') 
   {   
     $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
     $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela; 
     $rs = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela);
     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->fields[0] == 0) 
     { 
         $this->nmgp_opcao = "novo"; 
         $this->nm_flag_saida_novo = "S"; 
         $rs->Close(); 
         if ($this->aba_iframe)
         {
             $this->nmgp_botoes['exit'] = 'off';
         }
         return;
     }
     $str_where_filter = ('' != $str_where_param) ? ' where ' . $str_where_param : '';
     if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select min(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select min(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select min(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select min(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select min(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter); 
     }  
     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 (!isset($rs->fields[0]) || $rs->EOF) 
     { 
         $this->nm_flag_saida_novo = "S"; 
         $this->nmgp_opcao = "novo";  
         $rs->Close();  
         if ($this->aba_iframe)
         {
             $this->nmgp_botoes['exit'] = 'off';
         }
         return ; 
     } 
     $this->number = substr($this->Db->qstr($rs->fields[0]), 1, -1); 
     $rs->Close();  
     $str_where_filter = ('' != $str_where_param) ? ' and ' . $str_where_param : '';
     if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter); 
     }  
     if ($rs === false && !$rs->EOF && $GLOBALS["NM_ERRO_IBASE"] != 1) 
     { 
         $this->Erro->mensagem (__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
         exit ; 
     }  
     $this->id2 = substr($this->Db->qstr($rs->fields[0]), 1, -1); 
     $rs->Close();  
     $this->nmgp_opcao = "igual";  
     return ;  
   } 
// 
//-- 
   function nm_db_final($str_where_param = '') 
   { 
     $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
     $str_where_filter = ('' != $str_where_param) ? ' where ' . $str_where_param : '';
     if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select max(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select max(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select max(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select max(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select max(NUMBER) from " . $this->Ini->nm_tabela . " " . $str_where_filter); 
     }  
     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 (!isset($rs->fields[0]) || $rs->EOF) 
     { 
         $this->nm_flag_saida_novo = "S"; 
         $this->nmgp_opcao = "novo";  
         $rs->Close();  
         if ($this->aba_iframe)
         {
             $this->nmgp_botoes['exit'] = 'off';
         }
         return ; 
     } 
     $this->number = substr($this->Db->qstr($rs->fields[0]), 1, -1); 
     $rs->Close();  
     $str_where_filter = ('' != $str_where_param) ? ' and ' . $str_where_param : '';
     if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . "  where NUMBER = $this->number" . $str_where_filter); 
     }  
     if ($rs === false && !$rs->EOF && $GLOBALS["NM_ERRO_IBASE"] != 1) 
     { 
         $this->Erro->mensagem (__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
         exit ; 
     }  
     $this->id2 = substr($this->Db->qstr($rs->fields[0]), 1, -1); 
     $rs->Close();  
     $this->nmgp_opcao = "igual";  
     return ;  
   } 
   function NM_gera_nav_page() 
   {
       $this->SC_nav_page = "";
       $Reg_Page   = 1;
       $Max_link   = 5;
       $Mid_link   = ceil($Max_link / 2);
       $Corr_link  = (($Max_link % 2) == 0) ? 0 : 1;
       $rec_tot    = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['total'] + 1;
       $rec_fim    = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['reg_start'] + 1;
       $rec_fim    = ($rec_fim > $rec_tot) ? $rec_tot : $rec_fim;
       if ($rec_tot == 0)
       {
           return;
       }
       $Qtd_Pages  = ceil($rec_tot / $Reg_Page);
       $Page_Atu   = ceil($rec_fim / $Reg_Page);
       $Link_ini   = 1;
       if ($Page_Atu > $Max_link)
       {
           $Link_ini = $Page_Atu - $Mid_link + $Corr_link;
       }
       elseif ($Page_Atu > $Mid_link)
       {
           $Link_ini = $Page_Atu - $Mid_link + $Corr_link;
       }
       if (($Qtd_Pages - $Link_ini) < $Max_link)
       {
           $Link_ini = ($Qtd_Pages - $Max_link) + 1;
       }
       if ($Link_ini < 1)
       {
           $Link_ini = 1;
       }
       for ($x = 0; $x < $Max_link && $Link_ini <= $Qtd_Pages; $x++)
       {
           $rec = (($Link_ini - 1) * $Reg_Page) + 1;
           if ($Link_ini == $Page_Atu)
           {
               $this->SC_nav_page .= '<span class="scFormToolbarNavOpen" style="vertical-align: middle;">' . $Link_ini . '</span>';
           }
           else
           {
               $this->SC_nav_page .= '<a class="scFormToolbarNav" style="vertical-align: middle;" href="javascript: nm_navpage(' . $rec . ')">' . $Link_ini . '</a>';
           }
           $Link_ini++;
           if (($x + 1) < $Max_link && $Link_ini <= $Qtd_Pages && '' != $this->Ini->Str_toolbarnav_separator && @is_file($this->Ini->root . $this->Ini->path_img_global . $this->Ini->Str_toolbarnav_separator))
           {
               $this->SC_nav_page .= '<img src="' . $this->Ini->path_img_global . $this->Ini->Str_toolbarnav_separator . '" align="absmiddle" style="vertical-align: middle;">';
           }
       }
   }
//
function FinNo2_onChange()
{
$_SESSION['scriptcase']['dye_standdf_form']['contr_erro'] = 'on';
   
$original_finno2 = $this->finno2;
$original_fin_no = $this->fin_no;
$original_finish = $this->finish;




$check_sql = "SELECT finish,name"
   . " FROM finish"
   . " WHERE finish = '" . $this->finno2  . "'";
 
      $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->fin_no  = $this->rs[0][0];
    $this->finish  = $this->rs[0][1];
}
		else     
{
		    $this->finish  = '';
    $this->fin_no  = '';
}


$modificado_finno2 = $this->finno2;
$modificado_fin_no = $this->fin_no;
$modificado_finish = $this->finish;
$this->nm_formatar_campos('finno2', 'fin_no', 'finish');
if ($original_finno2 != $modificado_finno2 || (isset($bFlagRead_finno2) && $bFlagRead_finno2))
{
    $this->ajax_return_values_finno2(true);
}
if ($original_fin_no != $modificado_fin_no || (isset($bFlagRead_fin_no) && $bFlagRead_fin_no))
{
    $this->ajax_return_values_fin_no(true);
}
if ($original_finish != $modificado_finish || (isset($bFlagRead_finish) && $bFlagRead_finish))
{
    $this->ajax_return_values_finish(true);
}
dye_standdf_form_pack_ajax_response();
exit;
$_SESSION['scriptcase']['dye_standdf_form']['contr_erro'] = 'off';
}
//
 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;
     }
     $HTTP_REFERER = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : ""; 
     $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
     $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['botoes'] = $this->nmgp_botoes;
     if ($this->nmgp_opcao != "recarga" && $this->nmgp_opcao != "muda_form")
     {
         $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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]['dye_standdf_form']['run_iframe'] == "F" || $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['run_iframe'] == "R") && $this->nm_flag_iframe && empty($this->nm_todas_criticas))
     {
          if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['run_iframe_ajax']))
          {
              $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['retorno_edit'] = array("edit", "");
          }
          else
          {
              $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['retorno_edit'] .= "&nmgp_opcao=edit";
          }
          if ($this->sc_evento == "insert" && $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['run_iframe'] == "F")
          {
              if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['run_iframe_ajax']))
              {
                  $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['retorno_edit'] = array("edit", "fim");
              }
              else
              {
                  $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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]['dye_standdf_form']['run_iframe_ajax']))
              {
                  $this->NM_ajax_info['ajaxJavascript'][] = array("parent.ajax_navigate", $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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]['dye_standdf_form']['retorno_edit'];
                  $this->NM_ajax_info['redir']['target'] = $sJsParent;
              }
              dye_standdf_form_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]['dye_standdf_form']['run_iframe_ajax']))
    {
        $opc = ($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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]['dye_standdf_form']['retorno_edit'] . "';";
    }
?>
         </script>
         </body></html>
<?php
         exit;
     }
    include_once("dye_standdf_form_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 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]['dye_standdf_form']['where_filter']);
          unset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['total']);
          unset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['fast_search']);
          if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['where_detal']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['where_detal'])) 
          {
              $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['where_filter'] = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['where_detal'];
          }
          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 == "number") 
      {
          $this->SC_monta_condicao($comando, "NUMBER", $arg_search, $data_search);
      }
      if ($field == "gs") 
      {
          $this->SC_monta_condicao($comando, "GS", $arg_search, $data_search);
      }
      if ($field == "fs") 
      {
          $this->SC_monta_condicao($comando, "FS", $arg_search, $data_search);
      }
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['where_detal']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['where_detal']) && !empty($comando)) 
      {
          $comando = $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['where_detal'] . " and (" .  $comando . ")";
      }
      if (empty($comando)) 
      {
          $comando = " 1 <> 1 "; 
      }
      $sc_where = " where " . $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_dye_standdf_form = isset($rt->fields[0]) ? $rt->fields[0] - 1 : 0; 
     $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['total'] = $qt_geral_reg_dye_standdf_form;
      $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['where_filter'] = $comando;
      $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['fast_search'][0] = $field;
      $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['fast_search'][1] = $arg_search;
      $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['fast_search'][2] = $sv_data;
      $rt->Close(); 
   }
   function SC_monta_condicao(&$comando, $nome, $condicao, $campo, $tp_campo="")
   {
      $nm_aspas   = "'";
      $nm_numeric = array();
      $campo_join = strtolower(str_replace(".", "_", $nome));
      $nm_ini_lower = "";
      $nm_fim_lower = "";
      $nm_numeric[] = "number";$nm_numeric[] = "fwidth";$nm_numeric[] = "panels";$nm_numeric[] = "rollsize";$nm_numeric[] = "tubesize";$nm_numeric[] = "id2";
      if (in_array($campo_join, $nm_numeric))
      {
         if ($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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[] = "date";
          if (in_array($campo_join, $Nm_datas) && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
          {
             $nm_aspas = "#";
          }
         if (in_array($campo_join, $nm_numeric) && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres) && (strtoupper($condicao) == "II" || strtoupper($condicao) == "QP" || strtoupper($condicao) == "NP"))
         {
             $nome     = "CAST ($nome AS TEXT)";
             $nm_aspas = "'";
         }
         if (in_array($campo_join, $Nm_datas) && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
         {
             $nome     = "to_char ($nome, 'YYYY-MM-DD')";
         }
         if (substr($tp_campo, 0, 4) == "DATE" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sybase))
         {
             $nome     = "str_replace (convert(char(10),$nome,102), '.', '-') + ' ' + convert(char(8),$nome,20)";
         }
         if (substr($tp_campo, 0, 4) == "DATE" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
         {
             $nome     = "convert(char(23),$nome,121)";
         }
         if (substr($tp_campo, 0, 5) == "TIMES" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
         {
             $nome     = "TO_DATE(TO_CHAR($nome, 'yyyy-mm-dd hh24:mi:ss'), 'yyyy-mm-dd hh24:mi:ss')";
             $tp_campo = "DATE" . substr($tp_campo, 4);
         }
         $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":     // 
               if (substr($tp_campo, 0, 4) == "DATE")
               {
                   $NM_cmd     = "";
                   if ($this->NM_data_qp['ano'] != "____")
                   {
                       $NM_cmd     .= (empty($NM_cmd)) ? "" : " and ";
                       if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
                       {
                           $NM_cmd     .= "extract('year' from $nome) = " . $this->NM_data_qp['ano'];
                       }
                       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
                       {
                           $NM_cmd     .= "extract(year from $nome) = " . $this->NM_data_qp['ano'];
                       }
                       else
                       {
                       $NM_cmd     .= "year($nome) = " . $this->NM_data_qp['ano'];
                       }
                   }
                   if ($this->NM_data_qp['mes'] != "__")
                   {
                       $NM_cmd     .= (empty($NM_cmd)) ? "" : " and ";
                       if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
                       {
                           $NM_cmd     .= "extract('month' from $nome) = " . $this->NM_data_qp['mes'];
                       }
                       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
                       {
                           $NM_cmd     .= "extract(month from $nome) = " . $this->NM_data_qp['mes'];
                       }
                       else
                       {
                       $NM_cmd     .= "month($nome) = " . $this->NM_data_qp['mes'];
                       }
                   }
                   if ($this->NM_data_qp['dia'] != "__")
                   {
                       $NM_cmd     .= (empty($NM_cmd)) ? "" : " and ";
                       if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
                       {
                           $NM_cmd     .= "extract('day' from $nome) = " . $this->NM_data_qp['dia'];
                       }
                       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
                       {
                           $NM_cmd     .= "extract(day from $nome) = " . $this->NM_data_qp['dia'];
                       }
                       else
                       {
                       $NM_cmd     .= "day($nome) = " . $this->NM_data_qp['dia'];
                       }
                   }
                   if (!empty($NM_cmd))
                   {
                       $NM_cmd     = " (" . $NM_cmd . ")";
                       $comando        .= $NM_cmd;
                   }
               }
               else
               {
                   $comando        .= $nm_ini_lower . $nome . $nm_fim_lower ." like '%" . $campo . "%'";
               }
            break;
            case "NP":     // 
               if (substr($tp_campo, 0, 4) == "DATE")
               {
                   $NM_cmd     = "";
                   if ($this->NM_data_qp['ano'] != "____")
                   {
                       $NM_cmd     .= (empty($NM_cmd)) ? "" : " and ";
                       if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
                       {
                           $NM_cmd     .= "extract('year' from $nome) <> " . $this->NM_data_qp['ano'];
                       }
                       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
                       {
                           $NM_cmd     .= "extract(year from $nome) <> " . $this->NM_data_qp['ano'];
                       }
                       else
                       {
                       $NM_cmd     .= "year($nome) <> " . $this->NM_data_qp['ano'];
                       }
                   }
                   if ($this->NM_data_qp['mes'] != "__")
                   {
                       $NM_cmd     .= (empty($NM_cmd)) ? "" : " and ";
                       if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
                       {
                           $NM_cmd     .= "extract('month' from $nome) <> " . $this->NM_data_qp['mes'];
                       }
                       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
                       {
                           $NM_cmd     .= "extract(month from $nome) <> " . $this->NM_data_qp['mes'];
                       }
                       else
                       {
                       $NM_cmd     .= "month($nome) <> " . $this->NM_data_qp['mes'];
                       }
                   }
                   if ($this->NM_data_qp['dia'] != "__")
                   {
                       $NM_cmd     .= (empty($NM_cmd)) ? "" : " and ";
                       if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
                       {
                           $NM_cmd     .= "extract('day' from $nome) <> " . $this->NM_data_qp['dia'];
                       }
                       elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
                       {
                           $NM_cmd     .= "extract(day from $nome) <> " . $this->NM_data_qp['dia'];
                       }
                       else
                       {
                       $NM_cmd     .= "day($nome) <> " . $this->NM_data_qp['dia'];
                       }
                   }
                   if (!empty($NM_cmd))
                   {
                       $NM_cmd     = " (" . $NM_cmd . ")";
                       $comando        .= $NM_cmd;
                   }
               }
               else
               {
                   $comando        .= $nm_ini_lower . $nome . $nm_fim_lower ." not like '%" . $campo . "%'";
               }
            break;
            case "DF":     // 
               if ($tp_campo == "DTDF" || $tp_campo == "DATEDF")
               {
                   $comando        .= $nm_ini_lower . $nome . $nm_fim_lower . " not like '%" . $campo . "%'";
               }
               else
               {
                   $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 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]['dye_standdf_form']['sc_outra_jan']) && $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['sc_outra_jan'])
   {
       $nmgp_saida_form = "dye_standdf_form_fim.php";
   }
   if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['redir']) && $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['redir'] == 'redir')
   {
       unset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']);
   }
   unset($_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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;
       }
       dye_standdf_form_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'] ?>" />
    <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]['dye_standdf_form']['sc_modal']) && $_SESSION['sc_session'][$this->Ini->sc_page]['dye_standdf_form']['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;
}
}
?>
