<?php
//
class line_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 $style;
   var $name;
   var $width;
   var $fiber;
   var $desc;
   var $odesc;
   var $price;
   var $med;
   var $dark;
   var $hand;
   var $sprice;
   var $nprice;
   var $npdate;
   var $end1;
   var $end1_1;
   var $end2;
   var $end2_1;
   var $end3;
   var $end3_1;
   var $date;
   var $gs;
   var $k;
   var $mindye;
   var $minord;
   var $cpi;
   var $wpi;
   var $finwt;
   var $machine;
   var $stdcost;
   var $stdgp;
   var $avcost;
   var $end4;
   var $end4_1;
   var $end5;
   var $end5_1;
   var $yds;
   var $lbs;
   var $lbbo;
   var $dye;
   var $bo;
   var $gc;
   var $conv;
   var $fc;
   var $comment;
   var $spec;
   var $memo;
   var $ytdd;
   var $ytdy;
   var $mtdd;
   var $mtdy;
   var $histy;
   var $histd;
   var $update;
   var $avprice;
   var $lastyry;
   var $lastyrd;
   var $gshort;
   var $conv2;
   var $conv3;
   var $dept;
   var $samples;
   var $dyeleft;
   var $line;
   var $yarn1;
   var $per1;
   var $yarn2;
   var $per2;
   var $yarn3;
   var $per3;
   var $yarn4;
   var $per4;
   var $ozsquare;
   var $ozlin;
   var $sqlb;
   var $meterkilo;
   var $meter2kilo;
   var $grammeter;
   var $grammeter2;
   var $del1;
   var $del2;
   var $del3;
   var $stdputup;
   var $stdtube;
   var $date1;
   var $date2;
   var $date3;
   var $date4;
   var $date5;
   var $date6;
   var $name1;
   var $name2;
   var $name3;
   var $name4;
   var $name5;
   var $name6;
   var $method1;
   var $method2;
   var $method3;
   var $method4;
   var $method5;
   var $method6;
   var $test1;
   var $test2;
   var $test3;
   var $test4;
   var $lot1;
   var $lot2;
   var $lot3;
   var $lot4;
   var $lot5;
   var $lot6;
   var $result1;
   var $result2;
   var $result3;
   var $result4;
   var $result5;
   var $result6;
   var $sname1;
   var $sname2;
   var $sname3;
   var $smethod1;
   var $smethod2;
   var $smethod3;
   var $sstd1;
   var $sstd2;
   var $sstd3;
   var $stol1;
   var $stol2;
   var $stol3;
   var $cgs;
   var $smemo;
   var $id2;
   var $grstyle;
   var $stdcosting;
   var $image;
   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']['avcost']))
          {
              $this->avcost = $this->NM_ajax_info['param']['avcost'];
          }
          if (isset($this->NM_ajax_info['param']['avprice']))
          {
              $this->avprice = $this->NM_ajax_info['param']['avprice'];
          }
          if (isset($this->NM_ajax_info['param']['bo']))
          {
              $this->bo = $this->NM_ajax_info['param']['bo'];
          }
          if (isset($this->NM_ajax_info['param']['cgs']))
          {
              $this->cgs = $this->NM_ajax_info['param']['cgs'];
          }
          if (isset($this->NM_ajax_info['param']['comment']))
          {
              $this->comment = $this->NM_ajax_info['param']['comment'];
          }
          if (isset($this->NM_ajax_info['param']['conv']))
          {
              $this->conv = $this->NM_ajax_info['param']['conv'];
          }
          if (isset($this->NM_ajax_info['param']['conv2']))
          {
              $this->conv2 = $this->NM_ajax_info['param']['conv2'];
          }
          if (isset($this->NM_ajax_info['param']['conv3']))
          {
              $this->conv3 = $this->NM_ajax_info['param']['conv3'];
          }
          if (isset($this->NM_ajax_info['param']['cpi']))
          {
              $this->cpi = $this->NM_ajax_info['param']['cpi'];
          }
          if (isset($this->NM_ajax_info['param']['dark']))
          {
              $this->dark = $this->NM_ajax_info['param']['dark'];
          }
          if (isset($this->NM_ajax_info['param']['date']))
          {
              $this->date = $this->NM_ajax_info['param']['date'];
          }
          if (isset($this->NM_ajax_info['param']['date1']))
          {
              $this->date1 = $this->NM_ajax_info['param']['date1'];
          }
          if (isset($this->NM_ajax_info['param']['date2']))
          {
              $this->date2 = $this->NM_ajax_info['param']['date2'];
          }
          if (isset($this->NM_ajax_info['param']['date3']))
          {
              $this->date3 = $this->NM_ajax_info['param']['date3'];
          }
          if (isset($this->NM_ajax_info['param']['date4']))
          {
              $this->date4 = $this->NM_ajax_info['param']['date4'];
          }
          if (isset($this->NM_ajax_info['param']['date5']))
          {
              $this->date5 = $this->NM_ajax_info['param']['date5'];
          }
          if (isset($this->NM_ajax_info['param']['date6']))
          {
              $this->date6 = $this->NM_ajax_info['param']['date6'];
          }
          if (isset($this->NM_ajax_info['param']['del1']))
          {
              $this->del1 = $this->NM_ajax_info['param']['del1'];
          }
          if (isset($this->NM_ajax_info['param']['del2']))
          {
              $this->del2 = $this->NM_ajax_info['param']['del2'];
          }
          if (isset($this->NM_ajax_info['param']['del3']))
          {
              $this->del3 = $this->NM_ajax_info['param']['del3'];
          }
          if (isset($this->NM_ajax_info['param']['dept']))
          {
              $this->dept = $this->NM_ajax_info['param']['dept'];
          }
          if (isset($this->NM_ajax_info['param']['desc']))
          {
              $this->desc = $this->NM_ajax_info['param']['desc'];
          }
          if (isset($this->NM_ajax_info['param']['dye']))
          {
              $this->dye = $this->NM_ajax_info['param']['dye'];
          }
          if (isset($this->NM_ajax_info['param']['dyeleft']))
          {
              $this->dyeleft = $this->NM_ajax_info['param']['dyeleft'];
          }
          if (isset($this->NM_ajax_info['param']['end1']))
          {
              $this->end1 = $this->NM_ajax_info['param']['end1'];
          }
          if (isset($this->NM_ajax_info['param']['end2']))
          {
              $this->end2 = $this->NM_ajax_info['param']['end2'];
          }
          if (isset($this->NM_ajax_info['param']['end3']))
          {
              $this->end3 = $this->NM_ajax_info['param']['end3'];
          }
          if (isset($this->NM_ajax_info['param']['end4']))
          {
              $this->end4 = $this->NM_ajax_info['param']['end4'];
          }
          if (isset($this->NM_ajax_info['param']['end5']))
          {
              $this->end5 = $this->NM_ajax_info['param']['end5'];
          }
          if (isset($this->NM_ajax_info['param']['fc']))
          {
              $this->fc = $this->NM_ajax_info['param']['fc'];
          }
          if (isset($this->NM_ajax_info['param']['fiber']))
          {
              $this->fiber = $this->NM_ajax_info['param']['fiber'];
          }
          if (isset($this->NM_ajax_info['param']['finwt']))
          {
              $this->finwt = $this->NM_ajax_info['param']['finwt'];
          }
          if (isset($this->NM_ajax_info['param']['gc']))
          {
              $this->gc = $this->NM_ajax_info['param']['gc'];
          }
          if (isset($this->NM_ajax_info['param']['grammeter']))
          {
              $this->grammeter = $this->NM_ajax_info['param']['grammeter'];
          }
          if (isset($this->NM_ajax_info['param']['grammeter2']))
          {
              $this->grammeter2 = $this->NM_ajax_info['param']['grammeter2'];
          }
          if (isset($this->NM_ajax_info['param']['grstyle']))
          {
              $this->grstyle = $this->NM_ajax_info['param']['grstyle'];
          }
          if (isset($this->NM_ajax_info['param']['gs']))
          {
              $this->gs = $this->NM_ajax_info['param']['gs'];
          }
          if (isset($this->NM_ajax_info['param']['gshort']))
          {
              $this->gshort = $this->NM_ajax_info['param']['gshort'];
          }
          if (isset($this->NM_ajax_info['param']['hand']))
          {
              $this->hand = $this->NM_ajax_info['param']['hand'];
          }
          if (isset($this->NM_ajax_info['param']['histd']))
          {
              $this->histd = $this->NM_ajax_info['param']['histd'];
          }
          if (isset($this->NM_ajax_info['param']['histy']))
          {
              $this->histy = $this->NM_ajax_info['param']['histy'];
          }
          if (isset($this->NM_ajax_info['param']['id2']))
          {
              $this->id2 = $this->NM_ajax_info['param']['id2'];
          }
          if (isset($this->NM_ajax_info['param']['image']))
          {
              $this->image = $this->NM_ajax_info['param']['image'];
          }
          if (isset($this->NM_ajax_info['param']['k']))
          {
              $this->k = $this->NM_ajax_info['param']['k'];
          }
          if (isset($this->NM_ajax_info['param']['lastyrd']))
          {
              $this->lastyrd = $this->NM_ajax_info['param']['lastyrd'];
          }
          if (isset($this->NM_ajax_info['param']['lastyry']))
          {
              $this->lastyry = $this->NM_ajax_info['param']['lastyry'];
          }
          if (isset($this->NM_ajax_info['param']['lbbo']))
          {
              $this->lbbo = $this->NM_ajax_info['param']['lbbo'];
          }
          if (isset($this->NM_ajax_info['param']['lbs']))
          {
              $this->lbs = $this->NM_ajax_info['param']['lbs'];
          }
          if (isset($this->NM_ajax_info['param']['line']))
          {
              $this->line = $this->NM_ajax_info['param']['line'];
          }
          if (isset($this->NM_ajax_info['param']['lot1']))
          {
              $this->lot1 = $this->NM_ajax_info['param']['lot1'];
          }
          if (isset($this->NM_ajax_info['param']['lot2']))
          {
              $this->lot2 = $this->NM_ajax_info['param']['lot2'];
          }
          if (isset($this->NM_ajax_info['param']['lot3']))
          {
              $this->lot3 = $this->NM_ajax_info['param']['lot3'];
          }
          if (isset($this->NM_ajax_info['param']['lot4']))
          {
              $this->lot4 = $this->NM_ajax_info['param']['lot4'];
          }
          if (isset($this->NM_ajax_info['param']['lot5']))
          {
              $this->lot5 = $this->NM_ajax_info['param']['lot5'];
          }
          if (isset($this->NM_ajax_info['param']['lot6']))
          {
              $this->lot6 = $this->NM_ajax_info['param']['lot6'];
          }
          if (isset($this->NM_ajax_info['param']['machine']))
          {
              $this->machine = $this->NM_ajax_info['param']['machine'];
          }
          if (isset($this->NM_ajax_info['param']['med']))
          {
              $this->med = $this->NM_ajax_info['param']['med'];
          }
          if (isset($this->NM_ajax_info['param']['memo']))
          {
              $this->memo = $this->NM_ajax_info['param']['memo'];
          }
          if (isset($this->NM_ajax_info['param']['meter2kilo']))
          {
              $this->meter2kilo = $this->NM_ajax_info['param']['meter2kilo'];
          }
          if (isset($this->NM_ajax_info['param']['meterkilo']))
          {
              $this->meterkilo = $this->NM_ajax_info['param']['meterkilo'];
          }
          if (isset($this->NM_ajax_info['param']['method1']))
          {
              $this->method1 = $this->NM_ajax_info['param']['method1'];
          }
          if (isset($this->NM_ajax_info['param']['method2']))
          {
              $this->method2 = $this->NM_ajax_info['param']['method2'];
          }
          if (isset($this->NM_ajax_info['param']['method3']))
          {
              $this->method3 = $this->NM_ajax_info['param']['method3'];
          }
          if (isset($this->NM_ajax_info['param']['method4']))
          {
              $this->method4 = $this->NM_ajax_info['param']['method4'];
          }
          if (isset($this->NM_ajax_info['param']['method5']))
          {
              $this->method5 = $this->NM_ajax_info['param']['method5'];
          }
          if (isset($this->NM_ajax_info['param']['method6']))
          {
              $this->method6 = $this->NM_ajax_info['param']['method6'];
          }
          if (isset($this->NM_ajax_info['param']['mindye']))
          {
              $this->mindye = $this->NM_ajax_info['param']['mindye'];
          }
          if (isset($this->NM_ajax_info['param']['minord']))
          {
              $this->minord = $this->NM_ajax_info['param']['minord'];
          }
          if (isset($this->NM_ajax_info['param']['mtdd']))
          {
              $this->mtdd = $this->NM_ajax_info['param']['mtdd'];
          }
          if (isset($this->NM_ajax_info['param']['mtdy']))
          {
              $this->mtdy = $this->NM_ajax_info['param']['mtdy'];
          }
          if (isset($this->NM_ajax_info['param']['name']))
          {
              $this->name = $this->NM_ajax_info['param']['name'];
          }
          if (isset($this->NM_ajax_info['param']['name1']))
          {
              $this->name1 = $this->NM_ajax_info['param']['name1'];
          }
          if (isset($this->NM_ajax_info['param']['name2']))
          {
              $this->name2 = $this->NM_ajax_info['param']['name2'];
          }
          if (isset($this->NM_ajax_info['param']['name3']))
          {
              $this->name3 = $this->NM_ajax_info['param']['name3'];
          }
          if (isset($this->NM_ajax_info['param']['name4']))
          {
              $this->name4 = $this->NM_ajax_info['param']['name4'];
          }
          if (isset($this->NM_ajax_info['param']['name5']))
          {
              $this->name5 = $this->NM_ajax_info['param']['name5'];
          }
          if (isset($this->NM_ajax_info['param']['name6']))
          {
              $this->name6 = $this->NM_ajax_info['param']['name6'];
          }
          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_url_saida']))
          {
              $this->nmgp_url_saida = $this->NM_ajax_info['param']['nmgp_url_saida'];
          }
          if (isset($this->NM_ajax_info['param']['npdate']))
          {
              $this->npdate = $this->NM_ajax_info['param']['npdate'];
          }
          if (isset($this->NM_ajax_info['param']['nprice']))
          {
              $this->nprice = $this->NM_ajax_info['param']['nprice'];
          }
          if (isset($this->NM_ajax_info['param']['odesc']))
          {
              $this->odesc = $this->NM_ajax_info['param']['odesc'];
          }
          if (isset($this->NM_ajax_info['param']['ozlin']))
          {
              $this->ozlin = $this->NM_ajax_info['param']['ozlin'];
          }
          if (isset($this->NM_ajax_info['param']['ozsquare']))
          {
              $this->ozsquare = $this->NM_ajax_info['param']['ozsquare'];
          }
          if (isset($this->NM_ajax_info['param']['per1']))
          {
              $this->per1 = $this->NM_ajax_info['param']['per1'];
          }
          if (isset($this->NM_ajax_info['param']['per2']))
          {
              $this->per2 = $this->NM_ajax_info['param']['per2'];
          }
          if (isset($this->NM_ajax_info['param']['per3']))
          {
              $this->per3 = $this->NM_ajax_info['param']['per3'];
          }
          if (isset($this->NM_ajax_info['param']['per4']))
          {
              $this->per4 = $this->NM_ajax_info['param']['per4'];
          }
          if (isset($this->NM_ajax_info['param']['price']))
          {
              $this->price = $this->NM_ajax_info['param']['price'];
          }
          if (isset($this->NM_ajax_info['param']['result1']))
          {
              $this->result1 = $this->NM_ajax_info['param']['result1'];
          }
          if (isset($this->NM_ajax_info['param']['result2']))
          {
              $this->result2 = $this->NM_ajax_info['param']['result2'];
          }
          if (isset($this->NM_ajax_info['param']['result3']))
          {
              $this->result3 = $this->NM_ajax_info['param']['result3'];
          }
          if (isset($this->NM_ajax_info['param']['result4']))
          {
              $this->result4 = $this->NM_ajax_info['param']['result4'];
          }
          if (isset($this->NM_ajax_info['param']['result5']))
          {
              $this->result5 = $this->NM_ajax_info['param']['result5'];
          }
          if (isset($this->NM_ajax_info['param']['result6']))
          {
              $this->result6 = $this->NM_ajax_info['param']['result6'];
          }
          if (isset($this->NM_ajax_info['param']['samples']))
          {
              $this->samples = $this->NM_ajax_info['param']['samples'];
          }
          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']['smemo']))
          {
              $this->smemo = $this->NM_ajax_info['param']['smemo'];
          }
          if (isset($this->NM_ajax_info['param']['smethod1']))
          {
              $this->smethod1 = $this->NM_ajax_info['param']['smethod1'];
          }
          if (isset($this->NM_ajax_info['param']['smethod2']))
          {
              $this->smethod2 = $this->NM_ajax_info['param']['smethod2'];
          }
          if (isset($this->NM_ajax_info['param']['smethod3']))
          {
              $this->smethod3 = $this->NM_ajax_info['param']['smethod3'];
          }
          if (isset($this->NM_ajax_info['param']['sname1']))
          {
              $this->sname1 = $this->NM_ajax_info['param']['sname1'];
          }
          if (isset($this->NM_ajax_info['param']['sname2']))
          {
              $this->sname2 = $this->NM_ajax_info['param']['sname2'];
          }
          if (isset($this->NM_ajax_info['param']['sname3']))
          {
              $this->sname3 = $this->NM_ajax_info['param']['sname3'];
          }
          if (isset($this->NM_ajax_info['param']['spec']))
          {
              $this->spec = $this->NM_ajax_info['param']['spec'];
          }
          if (isset($this->NM_ajax_info['param']['sprice']))
          {
              $this->sprice = $this->NM_ajax_info['param']['sprice'];
          }
          if (isset($this->NM_ajax_info['param']['sqlb']))
          {
              $this->sqlb = $this->NM_ajax_info['param']['sqlb'];
          }
          if (isset($this->NM_ajax_info['param']['sstd1']))
          {
              $this->sstd1 = $this->NM_ajax_info['param']['sstd1'];
          }
          if (isset($this->NM_ajax_info['param']['sstd2']))
          {
              $this->sstd2 = $this->NM_ajax_info['param']['sstd2'];
          }
          if (isset($this->NM_ajax_info['param']['sstd3']))
          {
              $this->sstd3 = $this->NM_ajax_info['param']['sstd3'];
          }
          if (isset($this->NM_ajax_info['param']['stdcost']))
          {
              $this->stdcost = $this->NM_ajax_info['param']['stdcost'];
          }
          if (isset($this->NM_ajax_info['param']['stdcosting']))
          {
              $this->stdcosting = $this->NM_ajax_info['param']['stdcosting'];
          }
          if (isset($this->NM_ajax_info['param']['stdgp']))
          {
              $this->stdgp = $this->NM_ajax_info['param']['stdgp'];
          }
          if (isset($this->NM_ajax_info['param']['stdputup']))
          {
              $this->stdputup = $this->NM_ajax_info['param']['stdputup'];
          }
          if (isset($this->NM_ajax_info['param']['stdtube']))
          {
              $this->stdtube = $this->NM_ajax_info['param']['stdtube'];
          }
          if (isset($this->NM_ajax_info['param']['stol1']))
          {
              $this->stol1 = $this->NM_ajax_info['param']['stol1'];
          }
          if (isset($this->NM_ajax_info['param']['stol2']))
          {
              $this->stol2 = $this->NM_ajax_info['param']['stol2'];
          }
          if (isset($this->NM_ajax_info['param']['stol3']))
          {
              $this->stol3 = $this->NM_ajax_info['param']['stol3'];
          }
          if (isset($this->NM_ajax_info['param']['style']))
          {
              $this->style = $this->NM_ajax_info['param']['style'];
          }
          if (isset($this->NM_ajax_info['param']['test1']))
          {
              $this->test1 = $this->NM_ajax_info['param']['test1'];
          }
          if (isset($this->NM_ajax_info['param']['test2']))
          {
              $this->test2 = $this->NM_ajax_info['param']['test2'];
          }
          if (isset($this->NM_ajax_info['param']['test3']))
          {
              $this->test3 = $this->NM_ajax_info['param']['test3'];
          }
          if (isset($this->NM_ajax_info['param']['test4']))
          {
              $this->test4 = $this->NM_ajax_info['param']['test4'];
          }
          if (isset($this->NM_ajax_info['param']['update']))
          {
              $this->update = $this->NM_ajax_info['param']['update'];
          }
          if (isset($this->NM_ajax_info['param']['width']))
          {
              $this->width = $this->NM_ajax_info['param']['width'];
          }
          if (isset($this->NM_ajax_info['param']['wpi']))
          {
              $this->wpi = $this->NM_ajax_info['param']['wpi'];
          }
          if (isset($this->NM_ajax_info['param']['yarn1']))
          {
              $this->yarn1 = $this->NM_ajax_info['param']['yarn1'];
          }
          if (isset($this->NM_ajax_info['param']['yarn2']))
          {
              $this->yarn2 = $this->NM_ajax_info['param']['yarn2'];
          }
          if (isset($this->NM_ajax_info['param']['yarn3']))
          {
              $this->yarn3 = $this->NM_ajax_info['param']['yarn3'];
          }
          if (isset($this->NM_ajax_info['param']['yarn4']))
          {
              $this->yarn4 = $this->NM_ajax_info['param']['yarn4'];
          }
          if (isset($this->NM_ajax_info['param']['yds']))
          {
              $this->yds = $this->NM_ajax_info['param']['yds'];
          }
          if (isset($this->NM_ajax_info['param']['ytdd']))
          {
              $this->ytdd = $this->NM_ajax_info['param']['ytdd'];
          }
          if (isset($this->NM_ajax_info['param']['ytdy']))
          {
              $this->ytdy = $this->NM_ajax_info['param']['ytdy'];
          }
          if (isset($this->nmgp_refresh_fields))
          {
              $this->nmgp_refresh_fields = explode('_#fld#_', $this->nmgp_refresh_fields);
              $this->nmgp_opcao          = 'recarga';
          }
          if (!isset($this->nmgp_refresh_row))
          {
              $this->nmgp_refresh_row = '';
          }
      }

      $this->sc_conv_var = array();
      if (!empty($_FILES))
      {
          foreach ($_FILES as $nmgp_campo => $nmgp_valores)
          {
               if (isset($this->sc_conv_var[$nmgp_campo]))
               {
                   $nmgp_campo = $this->sc_conv_var[$nmgp_campo];
               }
               elseif (isset($this->sc_conv_var[strtolower($nmgp_campo)]))
               {
                   $nmgp_campo = $this->sc_conv_var[strtolower($nmgp_campo)];
               }
               $tmp_scfile_name     = $nmgp_campo . "_scfile_name";
               $tmp_scfile_type     = $nmgp_campo . "_scfile_type";
               $this->$nmgp_campo = is_array($nmgp_valores['tmp_name']) ? $nmgp_valores['tmp_name'][0] : $nmgp_valores['tmp_name'];
               $this->$tmp_scfile_type   = is_array($nmgp_valores['type'])     ? $nmgp_valores['type'][0]     : $nmgp_valores['type'];
               $this->$tmp_scfile_name   = is_array($nmgp_valores['name'])     ? $nmgp_valores['name'][0]     : $nmgp_valores['name'];
          }
      }
      if (!empty($_POST))
      {
          foreach ($_POST as $nmgp_var => $nmgp_val)
          {
               if (isset($this->sc_conv_var[$nmgp_var]))
               {
                   $nmgp_var = $this->sc_conv_var[$nmgp_var];
               }
               elseif (isset($this->sc_conv_var[strtolower($nmgp_var)]))
               {
                   $nmgp_var = $this->sc_conv_var[strtolower($nmgp_var)];
               }
               $this->$nmgp_var = $nmgp_val;
          }
      }
      if (!empty($_GET))
      {
          foreach ($_GET as $nmgp_var => $nmgp_val)
          {
               if (isset($this->sc_conv_var[$nmgp_var]))
               {
                   $nmgp_var = $this->sc_conv_var[$nmgp_var];
               }
               elseif (isset($this->sc_conv_var[strtolower($nmgp_var)]))
               {
                   $nmgp_var = $this->sc_conv_var[strtolower($nmgp_var)];
               }
               $this->$nmgp_var = $nmgp_val;
          }
      }
      if (isset($this->var_line) && isset($this->NM_contr_var_session) && $this->NM_contr_var_session == "Yes") 
      {
          $_SESSION['var_line'] = $this->var_line;
      }
      if (isset($this->var_style) && isset($this->NM_contr_var_session) && $this->NM_contr_var_session == "Yes") 
      {
          $_SESSION['var_style'] = $this->var_style;
      }
      if (isset($_POST["var_line"])) 
      {
          $_SESSION['var_line'] = $this->var_line;
      }
      if (isset($_POST["var_style"])) 
      {
          $_SESSION['var_style'] = $this->var_style;
      }
      if (isset($_GET["var_line"])) 
      {
          $_SESSION['var_line'] = $this->var_line;
      }
      if (isset($_GET["var_style"])) 
      {
          $_SESSION['var_style'] = $this->var_style;
      }
      if (isset($_SESSION['sc_session'][$script_case_init]['line_form']['embutida_parms']))
      { 
          $this->nmgp_parms = $_SESSION['sc_session'][$script_case_init]['line_form']['embutida_parms'];
          unset($_SESSION['sc_session'][$script_case_init]['line_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_line_form($cadapar[1]);
                 $this->$cadapar[0] = $cadapar[1];
             }
             $ix++;
          }
          if (isset($this->NM_where_filter_form))
          {
              $_SESSION['sc_session'][$script_case_init]['line_form']['where_filter_form'] = $this->NM_where_filter_form;
             unset($_SESSION['sc_session'][$script_case_init]['line_form']['total']);
          }
          if (isset($this->sc_redir_atualiz))
          {
              $_SESSION['sc_session'][$script_case_init]['line_form']['sc_redir_atualiz'] = $this->sc_redir_atualiz;
          }
          if (isset($this->sc_redir_insert))
          {
              $_SESSION['sc_session'][$script_case_init]['line_form']['sc_redir_insert'] = $this->sc_redir_insert;
          }
          if (isset($this->var_line)) 
          {
              $_SESSION['var_line'] = $this->var_line;
          }
          if (isset($this->var_style)) 
          {
              $_SESSION['var_style'] = $this->var_style;
          }
      } 
      elseif (isset($script_case_init) && !empty($script_case_init) && isset($_SESSION['sc_session'][$script_case_init]['line_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]['line_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]['line_form']['lig_edit_lookup']     = true;
          $_SESSION['sc_session'][$script_case_init]['line_form']['lig_edit_lookup_cb']  = $this->nm_evt_ret_edit;
          $_SESSION['sc_session'][$script_case_init]['line_form']['lig_edit_lookup_row'] = isset($this->nm_evt_ret_row) ? $this->nm_evt_ret_row : '';
      }
      if (isset($_SESSION['sc_session'][$script_case_init]['line_form']['lig_edit_lookup']) && $_SESSION['sc_session'][$script_case_init]['line_form']['lig_edit_lookup'])
      {
          $this->lig_edit_lookup     = true;
          $this->lig_edit_lookup_cb  = $_SESSION['sc_session'][$script_case_init]['line_form']['lig_edit_lookup_cb'];
          $this->lig_edit_lookup_row = $_SESSION['sc_session'][$script_case_init]['line_form']['lig_edit_lookup_row'];
      }
      if (!$this->Ini)
      { 
          $this->Ini = new line_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;


      $this->arr_buttons['greige']['hint']             = "List Veratex greige inventory only.";
      $this->arr_buttons['greige']['type']             = "button";
      $this->arr_buttons['greige']['value']            = "Greige Inventory";
      $this->arr_buttons['greige']['display']          = "only_text";
      $this->arr_buttons['greige']['display_position'] = "text_right";
      $this->arr_buttons['greige']['style']            = "default";
      $this->arr_buttons['greige']['image']            = "";

      $this->arr_buttons['fgi']['hint']             = "List Veratex or Fairlane FGI depending on style line.";
      $this->arr_buttons['fgi']['type']             = "button";
      $this->arr_buttons['fgi']['value']            = "FGI";
      $this->arr_buttons['fgi']['display']          = "only_text";
      $this->arr_buttons['fgi']['display_position'] = "text_right";
      $this->arr_buttons['fgi']['style']            = "default";
      $this->arr_buttons['fgi']['image']            = "";

      $this->arr_buttons['sc_btn_0']['hint']             = "List Veratex or Fairlane sales history depending on style line.";
      $this->arr_buttons['sc_btn_0']['type']             = "button";
      $this->arr_buttons['sc_btn_0']['value']            = "Sales History";
      $this->arr_buttons['sc_btn_0']['display']          = "only_text";
      $this->arr_buttons['sc_btn_0']['display_position'] = "text_right";
      $this->arr_buttons['sc_btn_0']['style']            = "default";
      $this->arr_buttons['sc_btn_0']['image']            = "";

      $this->arr_buttons['sc_btn_1']['hint']             = "Lis Veratex or Fairlane order history depending on style line.";
      $this->arr_buttons['sc_btn_1']['type']             = "button";
      $this->arr_buttons['sc_btn_1']['value']            = "Order History";
      $this->arr_buttons['sc_btn_1']['display']          = "only_text";
      $this->arr_buttons['sc_btn_1']['display_position'] = "text_right";
      $this->arr_buttons['sc_btn_1']['style']            = "default";
      $this->arr_buttons['sc_btn_1']['image']            = "";

      $this->arr_buttons['dye']['hint']             = "List Veratex or Fairlane dye orders depending on style line.";
      $this->arr_buttons['dye']['type']             = "button";
      $this->arr_buttons['dye']['value']            = "Dye";
      $this->arr_buttons['dye']['display']          = "only_text";
      $this->arr_buttons['dye']['display_position'] = "text_right";
      $this->arr_buttons['dye']['style']            = "default";
      $this->arr_buttons['dye']['image']            = "";

      $this->arr_buttons['sc_btn_2']['hint']             = "";
      $this->arr_buttons['sc_btn_2']['type']             = "button";
      $this->arr_buttons['sc_btn_2']['value']            = "Greige Styles Linked";
      $this->arr_buttons['sc_btn_2']['display']          = "only_text";
      $this->arr_buttons['sc_btn_2']['display_position'] = "text_right";
      $this->arr_buttons['sc_btn_2']['style']            = "default";
      $this->arr_buttons['sc_btn_2']['image']            = "";

      $this->arr_buttons['sc_btn_3']['hint']             = "";
      $this->arr_buttons['sc_btn_3']['type']             = "button";
      $this->arr_buttons['sc_btn_3']['value']            = "Sample Inventory";
      $this->arr_buttons['sc_btn_3']['display']          = "only_text";
      $this->arr_buttons['sc_btn_3']['display_position'] = "text_right";
      $this->arr_buttons['sc_btn_3']['style']            = "default";
      $this->arr_buttons['sc_btn_3']['image']            = "";

      $this->arr_buttons['sampling']['hint']             = "";
      $this->arr_buttons['sampling']['type']             = "button";
      $this->arr_buttons['sampling']['value']            = "Sampling";
      $this->arr_buttons['sampling']['display']          = "only_text";
      $this->arr_buttons['sampling']['display_position'] = "text_right";
      $this->arr_buttons['sampling']['style']            = "default";
      $this->arr_buttons['sampling']['image']            = "";


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

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

      if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['embutida_form']) || '' == $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['embutida_form'])
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['embutida_form'] = $this->Embutida_form;
      }
      if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['embutida_liga_grid_edit']) || '' == $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['embutida_liga_grid_edit'])
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['embutida_liga_grid_edit'] = $this->Grid_editavel ? 'on' : 'off';
      }
      if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['embutida_liga_grid_edit']) || '' == $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['embutida_liga_grid_edit'])
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['line_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]['line_form']['first_time'])
      {
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['insert']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['new']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['update']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['delete']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['first']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['back']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['forward']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['last']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['qsearch']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['summary']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['navpage']);
          unset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['goto']);
      }
      if (isset($this->NM_btn_insert) && '' != $this->NM_btn_insert && (!isset($_SESSION['scriptcase']['sc_apl_conf']['line_form']['insert']) || '' == $_SESSION['scriptcase']['sc_apl_conf']['line_form']['insert']))
      {
          if ('N' == $this->NM_btn_insert)
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['insert'] = 'off';
          }
          else
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['insert'] = 'on';
          }
      }
      if (isset($this->NM_btn_new) && 'N' == $this->NM_btn_new)
      {
          $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['new'] = 'off';
      }
      if (isset($this->NM_btn_update) && '' != $this->NM_btn_update && (!isset($_SESSION['scriptcase']['sc_apl_conf']['line_form']['update']) || '' == $_SESSION['scriptcase']['sc_apl_conf']['line_form']['update']))
      {
          if ('N' == $this->NM_btn_update)
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['update'] = 'off';
          }
          else
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['update'] = 'on';
          }
      }
      if (isset($this->NM_btn_delete) && '' != $this->NM_btn_delete && (!isset($_SESSION['scriptcase']['sc_apl_conf']['line_form']['delete']) || '' == $_SESSION['scriptcase']['sc_apl_conf']['line_form']['delete']))
      {
          if ('N' == $this->NM_btn_delete)
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['delete'] = 'off';
          }
          else
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_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']['line_form']['first']   = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['back']    = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['forward'] = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['last']    = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['qsearch'] = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['summary'] = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['navpage'] = 'off';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['goto']    = 'off';
          }
          else
          {
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['first']   = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['back']    = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['forward'] = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['last']    = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['qsearch'] = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['summary'] = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['navpage'] = 'on';
              $_SESSION['scriptcase']['sc_apl_conf_lig']['line_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'] = "off";
      $this->nmgp_botoes['qtline'] = "off";
      $this->nmgp_botoes['Greige'] = "on";
      $this->nmgp_botoes['FGI'] = "on";
      $this->nmgp_botoes['sc_btn_0'] = "on";
      $this->nmgp_botoes['sc_btn_1'] = "on";
      $this->nmgp_botoes['Dye'] = "on";
      $this->nmgp_botoes['sc_btn_2'] = "on";
      $this->nmgp_botoes['sc_btn_3'] = "on";
      $this->nmgp_botoes['Sampling'] = "on";
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['iframe_filtro']) && $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['iframe_filtro'] == "S")
      {
          $this->nmgp_botoes['exit'] = "off";
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf']['line_form']['btn_display']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['line_form']['btn_display']))
      {
          foreach ($_SESSION['scriptcase']['sc_apl_conf']['line_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']['line_form']['insert']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['insert'] != '')
      {
          $this->nmgp_botoes['new']    = $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['insert'];
          $this->nmgp_botoes['insert'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['insert'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['new']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['new'] != '')
      {
          $this->nmgp_botoes['new']    = $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['new'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['update']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['update'] != '')
      {
          $this->nmgp_botoes['update'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['update'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['delete']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['delete'] != '')
      {
          $this->nmgp_botoes['delete'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['delete'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['first']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['first'] != '')
      {
          $this->nmgp_botoes['first'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['first'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['back']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['back'] != '')
      {
          $this->nmgp_botoes['back'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['back'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['forward']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['forward'] != '')
      {
          $this->nmgp_botoes['forward'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['forward'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['last']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['last'] != '')
      {
          $this->nmgp_botoes['last'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['last'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['qsearch']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['qsearch'] != '')
      {
          $this->nmgp_botoes['qsearch'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['qsearch'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['summary']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['summary'] != '')
      {
          $this->nmgp_botoes['summary'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['summary'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['navpage']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['navpage'] != '')
      {
          $this->nmgp_botoes['navpage'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['navpage'];
      }
      if (isset($_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['goto']) && $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['goto'] != '')
      {
          $this->nmgp_botoes['goto'] = $_SESSION['scriptcase']['sc_apl_conf_lig']['line_form']['goto'];
      }

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

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

      if (isset($_SESSION['scriptcase']['sc_apl_conf']['line_form']['field_display']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['line_form']['field_display']))
      {
          foreach ($_SESSION['scriptcase']['sc_apl_conf']['line_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']['line_form']['field_readonly']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['line_form']['field_readonly']))
      {
          foreach ($_SESSION['scriptcase']['sc_apl_conf']['line_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']['line_form']['exit']) && $_SESSION['scriptcase']['sc_apl_conf']['line_form']['exit'] != '')
      {
          $_SESSION['scriptcase']['sc_url_saida'][$this->Ini->sc_page] = $_SESSION['scriptcase']['sc_apl_conf']['line_form']['exit'];
      }
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['dados_form']))
      {
          $this->nmgp_dados_form = $_SESSION['sc_session'][$this->Ini->sc_page]['line_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("line_form", $apls_aba))
              {
                  $this->aba_iframe = true;
                  break;
              }
          }
      }
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['line_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 . 'line_form/line_form_calendar.php');
          }
          else
          { 
              include_once($this->Ini->path_aplicacao . 'line_form_calendar.php');
          }
          exit;
      }

      if (is_file($this->Ini->path_aplicacao . 'line_form_help.txt'))
      {
          $arr_link_webhelp = file($this->Ini->path_aplicacao . 'line_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 . 'line_form/line_form_erro.class.php');
      }
      else
      { 
          require_once($this->Ini->path_aplicacao . "line_form_erro.class.php"); 
      }
      $this->Erro      = new line_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]['line_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]['line_form']['opcao']))
         { 
             if ($this->style != "" || $this->id2 != "")   
             { 
                 $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['opcao'] = "igual" ;  
             }   
         }   
      } 
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['opcao']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['opcao']) && empty($this->nmgp_refresh_fields))
      {
          $this->nmgp_opcao = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['opcao'];  
          $_SESSION['sc_session'][$this->Ini->sc_page]['line_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']['line_form']['start']) && $_SESSION['scriptcase']['sc_apl_conf']['line_form']['start'] == 'new')
      {
          $this->nmgp_opcao = "novo";
          $this->nm_Start_new = true;
          $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['opcao'] = "novo";
          unset($_SESSION['scriptcase']['sc_apl_conf']['line_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]['line_form']['opc_ant'];
      } 
      if ($this->nmgp_opcao == "novo")  
      {
          $this->nmgp_botoes['Greige'] = "off";
          $this->nmgp_botoes['FGI'] = "off";
          $this->nmgp_botoes['sc_btn_0'] = "off";
          $this->nmgp_botoes['sc_btn_1'] = "off";
          $this->nmgp_botoes['Dye'] = "off";
          $this->nmgp_botoes['sc_btn_2'] = "off";
          $this->nmgp_botoes['sc_btn_3'] = "off";
          $this->nmgp_botoes['Sampling'] = "off";
      }
      elseif ($this->nmgp_opcao == "incluir")  
      {
          $this->nmgp_botoes['Greige'] = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['botoes']['Greige'];
          $this->nmgp_botoes['FGI'] = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['botoes']['FGI'];
          $this->nmgp_botoes['sc_btn_0'] = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['botoes']['sc_btn_0'];
          $this->nmgp_botoes['sc_btn_1'] = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['botoes']['sc_btn_1'];
          $this->nmgp_botoes['Dye'] = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['botoes']['Dye'];
          $this->nmgp_botoes['sc_btn_2'] = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['botoes']['sc_btn_2'];
          $this->nmgp_botoes['sc_btn_3'] = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['botoes']['sc_btn_3'];
          $this->nmgp_botoes['Sampling'] = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['botoes']['Sampling'];
      }
      if ($this->nmgp_opcao == "recarga" || $this->nmgp_opcao == "muda_form")  
      {
          $this->nmgp_botoes = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['botoes'];
          $this->Nav_permite_ret = 0 != $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['inicio'];
          $this->Nav_permite_ava = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['total'] != $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['final'];
      }
      else
      {
      }
      $this->nm_flag_iframe = false;
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['dados_form'])) 
      {
         $this->nmgp_dados_form = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['dados_form'];
      }
      if ($this->nmgp_opcao == "edit_novo")  
      {
          $this->nmgp_opcao = "novo";
          $this->nm_flag_saida_novo = "S";
      }
//
      if ($this->nmgp_opcao == "excluir")
      {
          $GLOBALS['script_case_init'] = $this->Ini->sc_page;
          $_SESSION['sc_session'][$this->Ini->sc_page]['line_cmatch_edit_grid']['embutida_form'] = false;
          $_SESSION['sc_session'][$this->Ini->sc_page]['line_cmatch_edit_grid']['embutida_proc'] = true;
          $_SESSION['sc_session'][$this->Ini->sc_page]['line_cmatch_edit_grid']['reg_start'] = "";
          unset($_SESSION['sc_session'][$this->Ini->sc_page]['line_cmatch_edit_grid']['total']);
          require_once($this->Ini->root . $this->Ini->path_link  . SC_dir_app_name('line_cmatch_edit_grid') . "/index.php");
          require_once($this->Ini->root . $this->Ini->path_link  . SC_dir_app_name('line_cmatch_edit_grid') . "/line_cmatch_edit_grid_apl.php");
          $this->line_cmatch_edit_grid = new line_cmatch_edit_grid_apl;
          $_SESSION['sc_session'][$this->Ini->sc_page]['greige_grstyle_ro2_form']['embutida_form'] = false;
          $_SESSION['sc_session'][$this->Ini->sc_page]['greige_grstyle_ro2_form']['embutida_proc'] = true;
          $_SESSION['sc_session'][$this->Ini->sc_page]['greige_grstyle_ro2_form']['reg_start'] = "";
          unset($_SESSION['sc_session'][$this->Ini->sc_page]['greige_grstyle_ro2_form']['total']);
          require_once($this->Ini->root . $this->Ini->path_link  . SC_dir_app_name('greige_grstyle_ro2_form') . "/index.php");
          require_once($this->Ini->root . $this->Ini->path_link  . SC_dir_app_name('greige_grstyle_ro2_form') . "/greige_grstyle_ro2_form_apl.php");
          $this->greige_grstyle_ro2_form = new greige_grstyle_ro2_form_apl;
      }
      $this->sc_evento = $this->nmgp_opcao;
      $this->sc_insert_on = false;
      if (isset($this->style)) { $this->nm_limpa_alfa($this->style); }
      if (isset($this->name)) { $this->nm_limpa_alfa($this->name); }
      if (isset($this->width)) { $this->nm_limpa_alfa($this->width); }
      if (isset($this->fiber)) { $this->nm_limpa_alfa($this->fiber); }
      if (isset($this->desc)) { $this->nm_limpa_alfa($this->desc); }
      if (isset($this->odesc)) { $this->nm_limpa_alfa($this->odesc); }
      if (isset($this->price)) { $this->nm_limpa_alfa($this->price); }
      if (isset($this->med)) { $this->nm_limpa_alfa($this->med); }
      if (isset($this->dark)) { $this->nm_limpa_alfa($this->dark); }
      if (isset($this->hand)) { $this->nm_limpa_alfa($this->hand); }
      if (isset($this->sprice)) { $this->nm_limpa_alfa($this->sprice); }
      if (isset($this->nprice)) { $this->nm_limpa_alfa($this->nprice); }
      if (isset($this->end1)) { $this->nm_limpa_alfa($this->end1); }
      if (isset($this->end2)) { $this->nm_limpa_alfa($this->end2); }
      if (isset($this->end3)) { $this->nm_limpa_alfa($this->end3); }
      if (isset($this->gs)) { $this->nm_limpa_alfa($this->gs); }
      if (isset($this->k)) { $this->nm_limpa_alfa($this->k); }
      if (isset($this->mindye)) { $this->nm_limpa_alfa($this->mindye); }
      if (isset($this->minord)) { $this->nm_limpa_alfa($this->minord); }
      if (isset($this->cpi)) { $this->nm_limpa_alfa($this->cpi); }
      if (isset($this->wpi)) { $this->nm_limpa_alfa($this->wpi); }
      if (isset($this->finwt)) { $this->nm_limpa_alfa($this->finwt); }
      if (isset($this->machine)) { $this->nm_limpa_alfa($this->machine); }
      if (isset($this->stdcost)) { $this->nm_limpa_alfa($this->stdcost); }
      if (isset($this->stdgp)) { $this->nm_limpa_alfa($this->stdgp); }
      if (isset($this->avcost)) { $this->nm_limpa_alfa($this->avcost); }
      if (isset($this->end4)) { $this->nm_limpa_alfa($this->end4); }
      if (isset($this->end5)) { $this->nm_limpa_alfa($this->end5); }
      if (isset($this->yds)) { $this->nm_limpa_alfa($this->yds); }
      if (isset($this->lbs)) { $this->nm_limpa_alfa($this->lbs); }
      if (isset($this->lbbo)) { $this->nm_limpa_alfa($this->lbbo); }
      if (isset($this->dye)) { $this->nm_limpa_alfa($this->dye); }
      if (isset($this->bo)) { $this->nm_limpa_alfa($this->bo); }
      if (isset($this->gc)) { $this->nm_limpa_alfa($this->gc); }
      if (isset($this->conv)) { $this->nm_limpa_alfa($this->conv); }
      if (isset($this->fc)) { $this->nm_limpa_alfa($this->fc); }
      if (isset($this->comment)) { $this->nm_limpa_alfa($this->comment); }
      if (isset($this->spec)) { $this->nm_limpa_alfa($this->spec); }
      if (isset($this->memo)) { $this->nm_limpa_alfa($this->memo); }
      if (isset($this->ytdd)) { $this->nm_limpa_alfa($this->ytdd); }
      if (isset($this->ytdy)) { $this->nm_limpa_alfa($this->ytdy); }
      if (isset($this->mtdd)) { $this->nm_limpa_alfa($this->mtdd); }
      if (isset($this->mtdy)) { $this->nm_limpa_alfa($this->mtdy); }
      if (isset($this->histy)) { $this->nm_limpa_alfa($this->histy); }
      if (isset($this->histd)) { $this->nm_limpa_alfa($this->histd); }
      if (isset($this->avprice)) { $this->nm_limpa_alfa($this->avprice); }
      if (isset($this->lastyry)) { $this->nm_limpa_alfa($this->lastyry); }
      if (isset($this->lastyrd)) { $this->nm_limpa_alfa($this->lastyrd); }
      if (isset($this->gshort)) { $this->nm_limpa_alfa($this->gshort); }
      if (isset($this->conv2)) { $this->nm_limpa_alfa($this->conv2); }
      if (isset($this->conv3)) { $this->nm_limpa_alfa($this->conv3); }
      if (isset($this->dept)) { $this->nm_limpa_alfa($this->dept); }
      if (isset($this->samples)) { $this->nm_limpa_alfa($this->samples); }
      if (isset($this->dyeleft)) { $this->nm_limpa_alfa($this->dyeleft); }
      if (isset($this->line)) { $this->nm_limpa_alfa($this->line); }
      if (isset($this->yarn1)) { $this->nm_limpa_alfa($this->yarn1); }
      if (isset($this->per1)) { $this->nm_limpa_alfa($this->per1); }
      if (isset($this->yarn2)) { $this->nm_limpa_alfa($this->yarn2); }
      if (isset($this->per2)) { $this->nm_limpa_alfa($this->per2); }
      if (isset($this->yarn3)) { $this->nm_limpa_alfa($this->yarn3); }
      if (isset($this->per3)) { $this->nm_limpa_alfa($this->per3); }
      if (isset($this->yarn4)) { $this->nm_limpa_alfa($this->yarn4); }
      if (isset($this->per4)) { $this->nm_limpa_alfa($this->per4); }
      if (isset($this->ozsquare)) { $this->nm_limpa_alfa($this->ozsquare); }
      if (isset($this->ozlin)) { $this->nm_limpa_alfa($this->ozlin); }
      if (isset($this->sqlb)) { $this->nm_limpa_alfa($this->sqlb); }
      if (isset($this->meterkilo)) { $this->nm_limpa_alfa($this->meterkilo); }
      if (isset($this->meter2kilo)) { $this->nm_limpa_alfa($this->meter2kilo); }
      if (isset($this->grammeter)) { $this->nm_limpa_alfa($this->grammeter); }
      if (isset($this->grammeter2)) { $this->nm_limpa_alfa($this->grammeter2); }
      if (isset($this->del1)) { $this->nm_limpa_alfa($this->del1); }
      if (isset($this->del2)) { $this->nm_limpa_alfa($this->del2); }
      if (isset($this->del3)) { $this->nm_limpa_alfa($this->del3); }
      if (isset($this->stdputup)) { $this->nm_limpa_alfa($this->stdputup); }
      if (isset($this->stdtube)) { $this->nm_limpa_alfa($this->stdtube); }
      if (isset($this->name1)) { $this->nm_limpa_alfa($this->name1); }
      if (isset($this->name2)) { $this->nm_limpa_alfa($this->name2); }
      if (isset($this->name3)) { $this->nm_limpa_alfa($this->name3); }
      if (isset($this->name4)) { $this->nm_limpa_alfa($this->name4); }
      if (isset($this->name5)) { $this->nm_limpa_alfa($this->name5); }
      if (isset($this->name6)) { $this->nm_limpa_alfa($this->name6); }
      if (isset($this->method1)) { $this->nm_limpa_alfa($this->method1); }
      if (isset($this->method2)) { $this->nm_limpa_alfa($this->method2); }
      if (isset($this->method3)) { $this->nm_limpa_alfa($this->method3); }
      if (isset($this->method4)) { $this->nm_limpa_alfa($this->method4); }
      if (isset($this->method5)) { $this->nm_limpa_alfa($this->method5); }
      if (isset($this->method6)) { $this->nm_limpa_alfa($this->method6); }
      if (isset($this->test1)) { $this->nm_limpa_alfa($this->test1); }
      if (isset($this->test2)) { $this->nm_limpa_alfa($this->test2); }
      if (isset($this->test3)) { $this->nm_limpa_alfa($this->test3); }
      if (isset($this->test4)) { $this->nm_limpa_alfa($this->test4); }
      if (isset($this->lot1)) { $this->nm_limpa_alfa($this->lot1); }
      if (isset($this->lot2)) { $this->nm_limpa_alfa($this->lot2); }
      if (isset($this->lot3)) { $this->nm_limpa_alfa($this->lot3); }
      if (isset($this->lot4)) { $this->nm_limpa_alfa($this->lot4); }
      if (isset($this->lot5)) { $this->nm_limpa_alfa($this->lot5); }
      if (isset($this->lot6)) { $this->nm_limpa_alfa($this->lot6); }
      if (isset($this->result1)) { $this->nm_limpa_alfa($this->result1); }
      if (isset($this->result2)) { $this->nm_limpa_alfa($this->result2); }
      if (isset($this->result3)) { $this->nm_limpa_alfa($this->result3); }
      if (isset($this->result4)) { $this->nm_limpa_alfa($this->result4); }
      if (isset($this->result5)) { $this->nm_limpa_alfa($this->result5); }
      if (isset($this->result6)) { $this->nm_limpa_alfa($this->result6); }
      if (isset($this->sname1)) { $this->nm_limpa_alfa($this->sname1); }
      if (isset($this->sname2)) { $this->nm_limpa_alfa($this->sname2); }
      if (isset($this->sname3)) { $this->nm_limpa_alfa($this->sname3); }
      if (isset($this->smethod1)) { $this->nm_limpa_alfa($this->smethod1); }
      if (isset($this->smethod2)) { $this->nm_limpa_alfa($this->smethod2); }
      if (isset($this->smethod3)) { $this->nm_limpa_alfa($this->smethod3); }
      if (isset($this->sstd1)) { $this->nm_limpa_alfa($this->sstd1); }
      if (isset($this->sstd2)) { $this->nm_limpa_alfa($this->sstd2); }
      if (isset($this->sstd3)) { $this->nm_limpa_alfa($this->sstd3); }
      if (isset($this->stol1)) { $this->nm_limpa_alfa($this->stol1); }
      if (isset($this->stol2)) { $this->nm_limpa_alfa($this->stol2); }
      if (isset($this->stol3)) { $this->nm_limpa_alfa($this->stol3); }
      if (isset($this->cgs)) { $this->nm_limpa_alfa($this->cgs); }
      if (isset($this->smemo)) { $this->nm_limpa_alfa($this->smemo); }
      if (isset($this->grstyle)) { $this->nm_limpa_alfa($this->grstyle); }
      if (isset($this->stdcosting)) { $this->nm_limpa_alfa($this->stdcosting); }
      if ($nm_opc_form_php == "formphp")
      { 
          if ($nm_call_php == "FGI")
          { 
              $this->sc_btn_FGI();
          } 
          if ($nm_call_php == "sc_btn_0")
          { 
              $this->sc_btn_sc_btn_0();
          } 
          if ($nm_call_php == "sc_btn_1")
          { 
              $this->sc_btn_sc_btn_1();
          } 
          if ($nm_call_php == "Dye")
          { 
              $this->sc_btn_Dye();
          } 
          $this->NM_close_db(); 
          exit;
      } 
      $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]['line_form']['opc_edit'] = true;  
     if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['dados_select'])) 
     {
        $this->nmgp_dados_select = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['dados_select'];
     }
   }

   function loadFieldConfig()
   {
      $this->field_config = array();
      //-- 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');
      //-- per1
      $this->field_config['per1']               = array();
      $this->field_config['per1']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['per1']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['per1']['symbol_dec'] = '';
      $this->field_config['per1']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['per1']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- per2
      $this->field_config['per2']               = array();
      $this->field_config['per2']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['per2']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['per2']['symbol_dec'] = '';
      $this->field_config['per2']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['per2']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- per3
      $this->field_config['per3']               = array();
      $this->field_config['per3']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['per3']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['per3']['symbol_dec'] = '';
      $this->field_config['per3']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['per3']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- per4
      $this->field_config['per4']               = array();
      $this->field_config['per4']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['per4']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['per4']['symbol_dec'] = '';
      $this->field_config['per4']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['per4']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- nprice
      $this->field_config['nprice']               = array();
      $this->field_config['nprice']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['nprice']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['nprice']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['nprice']['symbol_mon'] = '';
      $this->field_config['nprice']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['nprice']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- npdate
      $this->field_config['npdate']                 = array();
      $this->field_config['npdate']['date_format']  = $_SESSION['scriptcase']['reg_conf']['date_format'];
      $this->field_config['npdate']['date_sep']     = $_SESSION['scriptcase']['reg_conf']['date_sep'];
      $this->field_config['npdate']['date_display'] = "ddmmaaaa";
      $this->new_date_format('DT', 'npdate');
      //-- yds
      $this->field_config['yds']               = array();
      $this->field_config['yds']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['yds']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['yds']['symbol_dec'] = '';
      $this->field_config['yds']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['yds']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- lbs
      $this->field_config['lbs']               = array();
      $this->field_config['lbs']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['lbs']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['lbs']['symbol_dec'] = '';
      $this->field_config['lbs']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['lbs']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- dye
      $this->field_config['dye']               = array();
      $this->field_config['dye']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['dye']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['dye']['symbol_dec'] = '';
      $this->field_config['dye']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['dye']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- gc
      $this->field_config['gc']               = array();
      $this->field_config['gc']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['gc']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['gc']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['gc']['symbol_mon'] = '';
      $this->field_config['gc']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['gc']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- fc
      $this->field_config['fc']               = array();
      $this->field_config['fc']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['fc']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['fc']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['fc']['symbol_mon'] = '';
      $this->field_config['fc']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['fc']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- gshort
      $this->field_config['gshort']               = array();
      $this->field_config['gshort']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['gshort']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['gshort']['symbol_dec'] = '';
      $this->field_config['gshort']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['gshort']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- ytdd
      $this->field_config['ytdd']               = array();
      $this->field_config['ytdd']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['ytdd']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['ytdd']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['ytdd']['symbol_mon'] = '';
      $this->field_config['ytdd']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['ytdd']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- ytdy
      $this->field_config['ytdy']               = array();
      $this->field_config['ytdy']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['ytdy']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['ytdy']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['ytdy']['symbol_mon'] = '';
      $this->field_config['ytdy']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['ytdy']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- mtdd
      $this->field_config['mtdd']               = array();
      $this->field_config['mtdd']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['mtdd']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['mtdd']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['mtdd']['symbol_mon'] = '';
      $this->field_config['mtdd']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['mtdd']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- mtdy
      $this->field_config['mtdy']               = array();
      $this->field_config['mtdy']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['mtdy']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['mtdy']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['mtdy']['symbol_mon'] = '';
      $this->field_config['mtdy']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['mtdy']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- histy
      $this->field_config['histy']               = array();
      $this->field_config['histy']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['histy']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['histy']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['histy']['symbol_mon'] = '';
      $this->field_config['histy']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['histy']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- histd
      $this->field_config['histd']               = array();
      $this->field_config['histd']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['histd']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['histd']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['histd']['symbol_mon'] = '';
      $this->field_config['histd']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['histd']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- update
      $this->field_config['update']                 = array();
      $this->field_config['update']['date_format']  = $_SESSION['scriptcase']['reg_conf']['date_format'];
      $this->field_config['update']['date_sep']     = $_SESSION['scriptcase']['reg_conf']['date_sep'];
      $this->field_config['update']['date_display'] = "ddmmaaaa";
      $this->new_date_format('DT', 'update');
      //-- avprice
      $this->field_config['avprice']               = array();
      $this->field_config['avprice']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['avprice']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['avprice']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['avprice']['symbol_mon'] = '';
      $this->field_config['avprice']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['avprice']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- lastyry
      $this->field_config['lastyry']               = array();
      $this->field_config['lastyry']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['lastyry']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['lastyry']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['lastyry']['symbol_mon'] = '';
      $this->field_config['lastyry']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['lastyry']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- lastyrd
      $this->field_config['lastyrd']               = array();
      $this->field_config['lastyrd']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['lastyrd']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['lastyrd']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['lastyrd']['symbol_mon'] = '';
      $this->field_config['lastyrd']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['lastyrd']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- dyeleft
      $this->field_config['dyeleft']               = array();
      $this->field_config['dyeleft']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['dyeleft']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['dyeleft']['symbol_dec'] = '';
      $this->field_config['dyeleft']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['dyeleft']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- ozsquare
      $this->field_config['ozsquare']               = array();
      $this->field_config['ozsquare']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['ozsquare']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['ozsquare']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['ozsquare']['symbol_mon'] = '';
      $this->field_config['ozsquare']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['ozsquare']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- ozlin
      $this->field_config['ozlin']               = array();
      $this->field_config['ozlin']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['ozlin']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['ozlin']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['ozlin']['symbol_mon'] = '';
      $this->field_config['ozlin']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['ozlin']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- sqlb
      $this->field_config['sqlb']               = array();
      $this->field_config['sqlb']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['sqlb']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['sqlb']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['sqlb']['symbol_mon'] = '';
      $this->field_config['sqlb']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['sqlb']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- meterkilo
      $this->field_config['meterkilo']               = array();
      $this->field_config['meterkilo']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['meterkilo']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['meterkilo']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['meterkilo']['symbol_mon'] = '';
      $this->field_config['meterkilo']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['meterkilo']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- meter2kilo
      $this->field_config['meter2kilo']               = array();
      $this->field_config['meter2kilo']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['meter2kilo']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['meter2kilo']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['meter2kilo']['symbol_mon'] = '';
      $this->field_config['meter2kilo']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['meter2kilo']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- grammeter
      $this->field_config['grammeter']               = array();
      $this->field_config['grammeter']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['grammeter']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['grammeter']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['grammeter']['symbol_mon'] = '';
      $this->field_config['grammeter']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['grammeter']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- grammeter2
      $this->field_config['grammeter2']               = array();
      $this->field_config['grammeter2']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['grammeter2']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['grammeter2']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['grammeter2']['symbol_mon'] = '';
      $this->field_config['grammeter2']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['grammeter2']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- date1
      $this->field_config['date1']                 = array();
      $this->field_config['date1']['date_format']  = $_SESSION['scriptcase']['reg_conf']['date_format'];
      $this->field_config['date1']['date_sep']     = $_SESSION['scriptcase']['reg_conf']['date_sep'];
      $this->field_config['date1']['date_display'] = "ddmmaaaa";
      $this->new_date_format('DT', 'date1');
      //-- date2
      $this->field_config['date2']                 = array();
      $this->field_config['date2']['date_format']  = $_SESSION['scriptcase']['reg_conf']['date_format'];
      $this->field_config['date2']['date_sep']     = $_SESSION['scriptcase']['reg_conf']['date_sep'];
      $this->field_config['date2']['date_display'] = "ddmmaaaa";
      $this->new_date_format('DT', 'date2');
      //-- date3
      $this->field_config['date3']                 = array();
      $this->field_config['date3']['date_format']  = $_SESSION['scriptcase']['reg_conf']['date_format'];
      $this->field_config['date3']['date_sep']     = $_SESSION['scriptcase']['reg_conf']['date_sep'];
      $this->field_config['date3']['date_display'] = "ddmmaaaa";
      $this->new_date_format('DT', 'date3');
      //-- date4
      $this->field_config['date4']                 = array();
      $this->field_config['date4']['date_format']  = $_SESSION['scriptcase']['reg_conf']['date_format'];
      $this->field_config['date4']['date_sep']     = $_SESSION['scriptcase']['reg_conf']['date_sep'];
      $this->field_config['date4']['date_display'] = "ddmmaaaa";
      $this->new_date_format('DT', 'date4');
      //-- date5
      $this->field_config['date5']                 = array();
      $this->field_config['date5']['date_format']  = $_SESSION['scriptcase']['reg_conf']['date_format'];
      $this->field_config['date5']['date_sep']     = $_SESSION['scriptcase']['reg_conf']['date_sep'];
      $this->field_config['date5']['date_display'] = "ddmmaaaa";
      $this->new_date_format('DT', 'date5');
      //-- date6
      $this->field_config['date6']                 = array();
      $this->field_config['date6']['date_format']  = $_SESSION['scriptcase']['reg_conf']['date_format'];
      $this->field_config['date6']['date_sep']     = $_SESSION['scriptcase']['reg_conf']['date_sep'];
      $this->field_config['date6']['date_display'] = "ddmmaaaa";
      $this->new_date_format('DT', 'date6');
      //-- conv2
      $this->field_config['conv2']               = array();
      $this->field_config['conv2']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['conv2']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['conv2']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['conv2']['symbol_mon'] = '';
      $this->field_config['conv2']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['conv2']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- conv3
      $this->field_config['conv3']               = array();
      $this->field_config['conv3']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['conv3']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['conv3']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['conv3']['symbol_mon'] = '';
      $this->field_config['conv3']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['conv3']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- conv
      $this->field_config['conv']               = array();
      $this->field_config['conv']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['conv']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['conv']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['conv']['symbol_mon'] = '';
      $this->field_config['conv']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['conv']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- stdcost
      $this->field_config['stdcost']               = array();
      $this->field_config['stdcost']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['stdcost']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['stdcost']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['stdcost']['symbol_mon'] = '';
      $this->field_config['stdcost']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['stdcost']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- stdgp
      $this->field_config['stdgp']               = array();
      $this->field_config['stdgp']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['stdgp']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['stdgp']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['stdgp']['symbol_mon'] = '';
      $this->field_config['stdgp']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['stdgp']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- sprice
      $this->field_config['sprice']               = array();
      $this->field_config['sprice']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['sprice']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['sprice']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['sprice']['symbol_mon'] = '';
      $this->field_config['sprice']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['sprice']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- avcost
      $this->field_config['avcost']               = array();
      $this->field_config['avcost']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_val'];
      $this->field_config['avcost']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit'];
      $this->field_config['avcost']['symbol_dec'] = $_SESSION['scriptcase']['reg_conf']['dec_val'];
      $this->field_config['avcost']['symbol_mon'] = '';
      $this->field_config['avcost']['format_pos'] = $_SESSION['scriptcase']['reg_conf']['monet_f_pos'];
      $this->field_config['avcost']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['monet_f_neg'];
      //-- lbbo
      $this->field_config['lbbo']               = array();
      $this->field_config['lbbo']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['lbbo']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['lbbo']['symbol_dec'] = '';
      $this->field_config['lbbo']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['lbbo']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- bo
      $this->field_config['bo']               = array();
      $this->field_config['bo']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['bo']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['bo']['symbol_dec'] = '';
      $this->field_config['bo']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['bo']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- samples
      $this->field_config['samples']               = array();
      $this->field_config['samples']['symbol_grp'] = $_SESSION['scriptcase']['reg_conf']['grup_num'];
      $this->field_config['samples']['symbol_fmt'] = $_SESSION['scriptcase']['reg_conf']['num_group_digit'];
      $this->field_config['samples']['symbol_dec'] = '';
      $this->field_config['samples']['symbol_neg'] = $_SESSION['scriptcase']['reg_conf']['simb_neg'];
      $this->field_config['samples']['format_neg'] = $_SESSION['scriptcase']['reg_conf']['neg_num'];
      //-- 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_image' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'image');
          }
          if ('validate_style' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'style');
          }
          if ('validate_name' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'name');
          }
          if ('validate_width' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'width');
          }
          if ('validate_comment' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'comment');
          }
          if ('validate_fiber' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'fiber');
          }
          if ('validate_desc' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'desc');
          }
          if ('validate_line' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'line');
          }
          if ('validate_dept' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'dept');
          }
          if ('validate_odesc' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'odesc');
          }
          if ('validate_hand' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'hand');
          }
          if ('validate_date' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'date');
          }
          if ('validate_mindye' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'mindye');
          }
          if ('validate_minord' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'minord');
          }
          if ('validate_yarn1' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'yarn1');
          }
          if ('validate_per1' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'per1');
          }
          if ('validate_yarn2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'yarn2');
          }
          if ('validate_per2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'per2');
          }
          if ('validate_yarn3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'yarn3');
          }
          if ('validate_per3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'per3');
          }
          if ('validate_yarn4' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'yarn4');
          }
          if ('validate_per4' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'per4');
          }
          if ('validate_del1' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'del1');
          }
          if ('validate_del2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'del2');
          }
          if ('validate_del3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'del3');
          }
          if ('validate_end1' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'end1');
          }
          if ('validate_end2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'end2');
          }
          if ('validate_end3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'end3');
          }
          if ('validate_end4' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'end4');
          }
          if ('validate_end5' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'end5');
          }
          if ('validate_price' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'price');
          }
          if ('validate_med' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'med');
          }
          if ('validate_dark' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'dark');
          }
          if ('validate_nprice' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'nprice');
          }
          if ('validate_npdate' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'npdate');
          }
          if ('validate_memo' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'memo');
          }
          if ('validate_smemo' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'smemo');
          }
          if ('validate_yds' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'yds');
          }
          if ('validate_lbs' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'lbs');
          }
          if ('validate_dye' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'dye');
          }
          if ('validate_gc' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'gc');
          }
          if ('validate_fc' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'fc');
          }
          if ('validate_spec' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'spec');
          }
          if ('validate_gshort' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'gshort');
          }
          if ('validate_ytdd' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'ytdd');
          }
          if ('validate_ytdy' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'ytdy');
          }
          if ('validate_mtdd' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'mtdd');
          }
          if ('validate_mtdy' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'mtdy');
          }
          if ('validate_histy' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'histy');
          }
          if ('validate_histd' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'histd');
          }
          if ('validate_update' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'update');
          }
          if ('validate_avprice' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'avprice');
          }
          if ('validate_lastyry' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'lastyry');
          }
          if ('validate_lastyrd' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'lastyrd');
          }
          if ('validate_dyeleft' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'dyeleft');
          }
          if ('validate_ozsquare' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'ozsquare');
          }
          if ('validate_ozlin' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'ozlin');
          }
          if ('validate_sqlb' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'sqlb');
          }
          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_finwt' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'finwt');
          }
          if ('validate_meterkilo' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'meterkilo');
          }
          if ('validate_meter2kilo' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'meter2kilo');
          }
          if ('validate_grammeter' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'grammeter');
          }
          if ('validate_grammeter2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'grammeter2');
          }
          if ('validate_stdputup' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'stdputup');
          }
          if ('validate_stdtube' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'stdtube');
          }
          if ('validate_date1' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'date1');
          }
          if ('validate_date2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'date2');
          }
          if ('validate_date3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'date3');
          }
          if ('validate_date4' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'date4');
          }
          if ('validate_date5' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'date5');
          }
          if ('validate_date6' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'date6');
          }
          if ('validate_name1' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'name1');
          }
          if ('validate_name2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'name2');
          }
          if ('validate_name3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'name3');
          }
          if ('validate_name4' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'name4');
          }
          if ('validate_name5' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'name5');
          }
          if ('validate_name6' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'name6');
          }
          if ('validate_method1' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'method1');
          }
          if ('validate_method2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'method2');
          }
          if ('validate_method3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'method3');
          }
          if ('validate_method4' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'method4');
          }
          if ('validate_method5' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'method5');
          }
          if ('validate_method6' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'method6');
          }
          if ('validate_test1' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'test1');
          }
          if ('validate_test2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'test2');
          }
          if ('validate_test3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'test3');
          }
          if ('validate_test4' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'test4');
          }
          if ('validate_lot1' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'lot1');
          }
          if ('validate_lot2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'lot2');
          }
          if ('validate_lot3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'lot3');
          }
          if ('validate_lot4' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'lot4');
          }
          if ('validate_lot5' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'lot5');
          }
          if ('validate_lot6' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'lot6');
          }
          if ('validate_result1' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'result1');
          }
          if ('validate_result2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'result2');
          }
          if ('validate_result3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'result3');
          }
          if ('validate_result4' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'result4');
          }
          if ('validate_result5' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'result5');
          }
          if ('validate_result6' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'result6');
          }
          if ('validate_sname1' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'sname1');
          }
          if ('validate_sname2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'sname2');
          }
          if ('validate_sname3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'sname3');
          }
          if ('validate_smethod1' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'smethod1');
          }
          if ('validate_smethod2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'smethod2');
          }
          if ('validate_smethod3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'smethod3');
          }
          if ('validate_sstd1' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'sstd1');
          }
          if ('validate_sstd2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'sstd2');
          }
          if ('validate_sstd3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'sstd3');
          }
          if ('validate_stol1' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'stol1');
          }
          if ('validate_stol2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'stol2');
          }
          if ('validate_stol3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'stol3');
          }
          if ('validate_conv2' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'conv2');
          }
          if ('validate_conv3' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'conv3');
          }
          if ('validate_conv' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'conv');
          }
          if ('validate_stdcost' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'stdcost');
          }
          if ('validate_stdgp' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'stdgp');
          }
          if ('validate_sprice' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'sprice');
          }
          if ('validate_avcost' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'avcost');
          }
          if ('validate_stdcosting' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'stdcosting');
          }
          if ('validate_machine' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'machine');
          }
          if ('validate_cgs' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'cgs');
          }
          if ('validate_gs' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'gs');
          }
          if ('validate_k' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'k');
          }
          if ('validate_grstyle' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'grstyle');
          }
          if ('validate_lbbo' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'lbbo');
          }
          if ('validate_bo' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'bo');
          }
          if ('validate_samples' == $this->NM_ajax_opcao)
          {
              $this->Valida_campos($Campos_Crit, $Campos_Falta, $Campos_Erros, 'samples');
          }
          line_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_conv_onchange' == $this->NM_ajax_opcao)
          {
              $this->CONV_onChange();
          }
          if ('event_stdgp_onchange' == $this->NM_ajax_opcao)
          {
              $this->STDGP_onChange();
          }
          line_form_pack_ajax_response();
          exit;
      }
      if (isset($this->sc_inline_call) && 'Y' == $this->sc_inline_call)
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['line_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();
              line_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']['line_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)
              {
                  line_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]['line_form']['recarga'] = $this->nmgp_opcao;
          if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['sc_redir_insert']) && $_SESSION['sc_session'][$this->Ini->sc_page]['line_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]['line_form']['sc_redir_atualiz']) && $_SESSION['sc_session'][$this->Ini->sc_page]['line_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();
          line_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']);
          }
          line_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 sc_btn_FGI() 
   {
        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;
 
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">

<html<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'] ?>>
 <head>
    <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'] ?>" />
    <SCRIPT type="text/javascript">
      var sc_pathToTB = '<?php echo $this->Ini->path_prod ?>/third/jquery_plugin/thickbox/';
    </SCRIPT>
    <SCRIPT type="text/javascript" src="<?php echo $this->Ini->path_prod; ?>/third/jquery/js/jquery.js"></SCRIPT>
    <SCRIPT type="text/javascript" src="<?php echo $this->Ini->path_prod; ?>/third/jquery_plugin/malsup-blockui/jquery.blockUI.js"></SCRIPT>
    <SCRIPT type="text/javascript" src="<?php echo $this->Ini->path_prod; ?>/third/jquery_plugin/thickbox/thickbox-compressed.js"></SCRIPT>
    <link rel="stylesheet" href="<?php echo $this->Ini->path_prod ?>/third/jquery_plugin/thickbox/thickbox.css" type="text/css" media="screen" />
    <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_form.css" />
 </head>
  <body class="scFormPage">
      <table class="scFormTabela" align="center"><tr><td>
<?php
      $nmgp_opcao_saida_php = "igual";
      $nmgp_opc_ant_saida_php = "";
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['opc_ant'] == "novo" || $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['opc_ant'] == "incluir")
      {
          $nmgp_opc_ant_saida_php = "novo";
          $nmgp_opcao_saida_php   = "recarga";
      }
      $nm_f_saida = "./";
      nm_limpa_data($this->date, $this->field_config['date']['date_sep']) ; 
      nm_limpa_numero($this->per1, $this->field_config['per1']['symbol_grp']) ; 
      nm_limpa_numero($this->per2, $this->field_config['per2']['symbol_grp']) ; 
      nm_limpa_numero($this->per3, $this->field_config['per3']['symbol_grp']) ; 
      nm_limpa_numero($this->per4, $this->field_config['per4']['symbol_grp']) ; 
      if (!empty($this->field_config['nprice']['symbol_dec']))
      {
          $this->sc_remove_currency($this->nprice, $this->field_config['nprice']['symbol_dec'], $this->field_config['nprice']['symbol_grp'], $this->field_config['nprice']['symbol_mon']); 
          nm_limpa_valor($this->nprice, $this->field_config['nprice']['symbol_dec'], $this->field_config['nprice']['symbol_grp']) ; 
      }
      nm_limpa_data($this->npdate, $this->field_config['npdate']['date_sep']) ; 
      nm_limpa_numero($this->yds, $this->field_config['yds']['symbol_grp']) ; 
      nm_limpa_numero($this->lbs, $this->field_config['lbs']['symbol_grp']) ; 
      nm_limpa_numero($this->dye, $this->field_config['dye']['symbol_grp']) ; 
      if (!empty($this->field_config['gc']['symbol_dec']))
      {
          $this->sc_remove_currency($this->gc, $this->field_config['gc']['symbol_dec'], $this->field_config['gc']['symbol_grp'], $this->field_config['gc']['symbol_mon']); 
          nm_limpa_valor($this->gc, $this->field_config['gc']['symbol_dec'], $this->field_config['gc']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['fc']['symbol_dec']))
      {
          $this->sc_remove_currency($this->fc, $this->field_config['fc']['symbol_dec'], $this->field_config['fc']['symbol_grp'], $this->field_config['fc']['symbol_mon']); 
          nm_limpa_valor($this->fc, $this->field_config['fc']['symbol_dec'], $this->field_config['fc']['symbol_grp']) ; 
      }
      nm_limpa_numero($this->gshort, $this->field_config['gshort']['symbol_grp']) ; 
      if (!empty($this->field_config['ytdd']['symbol_dec']))
      {
          $this->sc_remove_currency($this->ytdd, $this->field_config['ytdd']['symbol_dec'], $this->field_config['ytdd']['symbol_grp'], $this->field_config['ytdd']['symbol_mon']); 
          nm_limpa_valor($this->ytdd, $this->field_config['ytdd']['symbol_dec'], $this->field_config['ytdd']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['ytdy']['symbol_dec']))
      {
          $this->sc_remove_currency($this->ytdy, $this->field_config['ytdy']['symbol_dec'], $this->field_config['ytdy']['symbol_grp'], $this->field_config['ytdy']['symbol_mon']); 
          nm_limpa_valor($this->ytdy, $this->field_config['ytdy']['symbol_dec'], $this->field_config['ytdy']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['mtdd']['symbol_dec']))
      {
          $this->sc_remove_currency($this->mtdd, $this->field_config['mtdd']['symbol_dec'], $this->field_config['mtdd']['symbol_grp'], $this->field_config['mtdd']['symbol_mon']); 
          nm_limpa_valor($this->mtdd, $this->field_config['mtdd']['symbol_dec'], $this->field_config['mtdd']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['mtdy']['symbol_dec']))
      {
          $this->sc_remove_currency($this->mtdy, $this->field_config['mtdy']['symbol_dec'], $this->field_config['mtdy']['symbol_grp'], $this->field_config['mtdy']['symbol_mon']); 
          nm_limpa_valor($this->mtdy, $this->field_config['mtdy']['symbol_dec'], $this->field_config['mtdy']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['histy']['symbol_dec']))
      {
          $this->sc_remove_currency($this->histy, $this->field_config['histy']['symbol_dec'], $this->field_config['histy']['symbol_grp'], $this->field_config['histy']['symbol_mon']); 
          nm_limpa_valor($this->histy, $this->field_config['histy']['symbol_dec'], $this->field_config['histy']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['histd']['symbol_dec']))
      {
          $this->sc_remove_currency($this->histd, $this->field_config['histd']['symbol_dec'], $this->field_config['histd']['symbol_grp'], $this->field_config['histd']['symbol_mon']); 
          nm_limpa_valor($this->histd, $this->field_config['histd']['symbol_dec'], $this->field_config['histd']['symbol_grp']) ; 
      }
      nm_limpa_data($this->update, $this->field_config['update']['date_sep']) ; 
      if (!empty($this->field_config['avprice']['symbol_dec']))
      {
          $this->sc_remove_currency($this->avprice, $this->field_config['avprice']['symbol_dec'], $this->field_config['avprice']['symbol_grp'], $this->field_config['avprice']['symbol_mon']); 
          nm_limpa_valor($this->avprice, $this->field_config['avprice']['symbol_dec'], $this->field_config['avprice']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['lastyry']['symbol_dec']))
      {
          $this->sc_remove_currency($this->lastyry, $this->field_config['lastyry']['symbol_dec'], $this->field_config['lastyry']['symbol_grp'], $this->field_config['lastyry']['symbol_mon']); 
          nm_limpa_valor($this->lastyry, $this->field_config['lastyry']['symbol_dec'], $this->field_config['lastyry']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['lastyrd']['symbol_dec']))
      {
          $this->sc_remove_currency($this->lastyrd, $this->field_config['lastyrd']['symbol_dec'], $this->field_config['lastyrd']['symbol_grp'], $this->field_config['lastyrd']['symbol_mon']); 
          nm_limpa_valor($this->lastyrd, $this->field_config['lastyrd']['symbol_dec'], $this->field_config['lastyrd']['symbol_grp']) ; 
      }
      nm_limpa_numero($this->dyeleft, $this->field_config['dyeleft']['symbol_grp']) ; 
      if (!empty($this->field_config['ozsquare']['symbol_dec']))
      {
          $this->sc_remove_currency($this->ozsquare, $this->field_config['ozsquare']['symbol_dec'], $this->field_config['ozsquare']['symbol_grp'], $this->field_config['ozsquare']['symbol_mon']); 
          nm_limpa_valor($this->ozsquare, $this->field_config['ozsquare']['symbol_dec'], $this->field_config['ozsquare']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['ozlin']['symbol_dec']))
      {
          $this->sc_remove_currency($this->ozlin, $this->field_config['ozlin']['symbol_dec'], $this->field_config['ozlin']['symbol_grp'], $this->field_config['ozlin']['symbol_mon']); 
          nm_limpa_valor($this->ozlin, $this->field_config['ozlin']['symbol_dec'], $this->field_config['ozlin']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['sqlb']['symbol_dec']))
      {
          $this->sc_remove_currency($this->sqlb, $this->field_config['sqlb']['symbol_dec'], $this->field_config['sqlb']['symbol_grp'], $this->field_config['sqlb']['symbol_mon']); 
          nm_limpa_valor($this->sqlb, $this->field_config['sqlb']['symbol_dec'], $this->field_config['sqlb']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['meterkilo']['symbol_dec']))
      {
          $this->sc_remove_currency($this->meterkilo, $this->field_config['meterkilo']['symbol_dec'], $this->field_config['meterkilo']['symbol_grp'], $this->field_config['meterkilo']['symbol_mon']); 
          nm_limpa_valor($this->meterkilo, $this->field_config['meterkilo']['symbol_dec'], $this->field_config['meterkilo']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['meter2kilo']['symbol_dec']))
      {
          $this->sc_remove_currency($this->meter2kilo, $this->field_config['meter2kilo']['symbol_dec'], $this->field_config['meter2kilo']['symbol_grp'], $this->field_config['meter2kilo']['symbol_mon']); 
          nm_limpa_valor($this->meter2kilo, $this->field_config['meter2kilo']['symbol_dec'], $this->field_config['meter2kilo']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['grammeter']['symbol_dec']))
      {
          $this->sc_remove_currency($this->grammeter, $this->field_config['grammeter']['symbol_dec'], $this->field_config['grammeter']['symbol_grp'], $this->field_config['grammeter']['symbol_mon']); 
          nm_limpa_valor($this->grammeter, $this->field_config['grammeter']['symbol_dec'], $this->field_config['grammeter']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['grammeter2']['symbol_dec']))
      {
          $this->sc_remove_currency($this->grammeter2, $this->field_config['grammeter2']['symbol_dec'], $this->field_config['grammeter2']['symbol_grp'], $this->field_config['grammeter2']['symbol_mon']); 
          nm_limpa_valor($this->grammeter2, $this->field_config['grammeter2']['symbol_dec'], $this->field_config['grammeter2']['symbol_grp']) ; 
      }
      nm_limpa_data($this->date1, $this->field_config['date1']['date_sep']) ; 
      nm_limpa_data($this->date2, $this->field_config['date2']['date_sep']) ; 
      nm_limpa_data($this->date3, $this->field_config['date3']['date_sep']) ; 
      nm_limpa_data($this->date4, $this->field_config['date4']['date_sep']) ; 
      nm_limpa_data($this->date5, $this->field_config['date5']['date_sep']) ; 
      nm_limpa_data($this->date6, $this->field_config['date6']['date_sep']) ; 
      if (!empty($this->field_config['conv2']['symbol_dec']))
      {
          $this->sc_remove_currency($this->conv2, $this->field_config['conv2']['symbol_dec'], $this->field_config['conv2']['symbol_grp'], $this->field_config['conv2']['symbol_mon']); 
          nm_limpa_valor($this->conv2, $this->field_config['conv2']['symbol_dec'], $this->field_config['conv2']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['conv3']['symbol_dec']))
      {
          $this->sc_remove_currency($this->conv3, $this->field_config['conv3']['symbol_dec'], $this->field_config['conv3']['symbol_grp'], $this->field_config['conv3']['symbol_mon']); 
          nm_limpa_valor($this->conv3, $this->field_config['conv3']['symbol_dec'], $this->field_config['conv3']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['conv']['symbol_dec']))
      {
          $this->sc_remove_currency($this->conv, $this->field_config['conv']['symbol_dec'], $this->field_config['conv']['symbol_grp'], $this->field_config['conv']['symbol_mon']); 
          nm_limpa_valor($this->conv, $this->field_config['conv']['symbol_dec'], $this->field_config['conv']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['stdcost']['symbol_dec']))
      {
          $this->sc_remove_currency($this->stdcost, $this->field_config['stdcost']['symbol_dec'], $this->field_config['stdcost']['symbol_grp'], $this->field_config['stdcost']['symbol_mon']); 
          nm_limpa_valor($this->stdcost, $this->field_config['stdcost']['symbol_dec'], $this->field_config['stdcost']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['stdgp']['symbol_dec']))
      {
          $this->sc_remove_currency($this->stdgp, $this->field_config['stdgp']['symbol_dec'], $this->field_config['stdgp']['symbol_grp'], $this->field_config['stdgp']['symbol_mon']); 
          nm_limpa_valor($this->stdgp, $this->field_config['stdgp']['symbol_dec'], $this->field_config['stdgp']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['sprice']['symbol_dec']))
      {
          $this->sc_remove_currency($this->sprice, $this->field_config['sprice']['symbol_dec'], $this->field_config['sprice']['symbol_grp'], $this->field_config['sprice']['symbol_mon']); 
          nm_limpa_valor($this->sprice, $this->field_config['sprice']['symbol_dec'], $this->field_config['sprice']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['avcost']['symbol_dec']))
      {
          $this->sc_remove_currency($this->avcost, $this->field_config['avcost']['symbol_dec'], $this->field_config['avcost']['symbol_grp'], $this->field_config['avcost']['symbol_mon']); 
          nm_limpa_valor($this->avcost, $this->field_config['avcost']['symbol_dec'], $this->field_config['avcost']['symbol_grp']) ; 
      }
      nm_limpa_numero($this->lbbo, $this->field_config['lbbo']['symbol_grp']) ; 
      nm_limpa_numero($this->bo, $this->field_config['bo']['symbol_grp']) ; 
      nm_limpa_numero($this->samples, $this->field_config['samples']['symbol_grp']) ; 
      $this->nm_converte_datas();
      $_SESSION['scriptcase']['line_form']['contr_erro'] = 'on';
if (!isset($this->sc_temp_var_line)) {$this->sc_temp_var_line = (isset($_SESSION['var_line'])) ? $_SESSION['var_line'] : "";}
       if ($this->sc_temp_var_line == 'VERATEX')
{
     if (isset($this->sc_temp_var_line)) { $_SESSION['var_line'] = $this->sc_temp_var_line;}
 if (!isset($this->Campos_Mens_erro) || empty($this->Campos_Mens_erro))
 {
$this->nmgp_redireciona_form($this->Ini->path_link . "" . SC_dir_app_name('line_fgi_grid') . "/", $this->nm_location, "var_style?#?" . $this->style  . "?@?","_self", '', 440, 630);
 };
}
if ($this->sc_temp_var_line == 'FAIRLANE')
{
     if (isset($this->sc_temp_var_line)) { $_SESSION['var_line'] = $this->sc_temp_var_line;}
 if (!isset($this->Campos_Mens_erro) || empty($this->Campos_Mens_erro))
 {
$this->nmgp_redireciona_form($this->Ini->path_link . "" . SC_dir_app_name('fv_line_fgi_grid') . "/", $this->nm_location, "var_style?#?" . $this->style  . "?@?","_self", '', 440, 630);
 };
}
if (isset($this->sc_temp_var_line)) { $_SESSION['var_line'] = $this->sc_temp_var_line;}
$_SESSION['scriptcase']['line_form']['contr_erro'] = 'off'; 
?>
      </td></tr><tr><td align="center">
      <form name="FPHP" method="post" 
                        action="<?php echo $nm_f_saida ?>" 
                        target="_self">
      <input type=hidden name="nmgp_opcao" value=""/>
      <input type=hidden name="script_case_init" value="<?php  echo NM_encode_input($this->Ini->sc_page); ?>"/>
      <input type=hidden name="script_case_session" value="<?php  echo NM_encode_input(session_id()); ?>"/>
      <input type=hidden name="style" value="<?php echo NM_encode_input($this->style) ?>"/>
      <input type=hidden name="id2" value="<?php echo NM_encode_input($this->id2) ?>"/>
      <input type=hidden name="nmgp_opcao" value="<?php echo NM_encode_input($nmgp_opcao_saida_php); ?>"/>
      <input type=hidden name="nmgp_opc_ant" value="<?php echo NM_encode_input($nmgp_opc_ant_saida_php); ?>"/>
      <input type=submit name="nmgp_bok" value="<?php echo $this->Ini->Nm_lang['lang_btns_cfrm'] ?>" onclick="window.close()"/>
      </form>
      </td></tr></table>
      </body>
      </html>
<?php
   }
   function sc_btn_sc_btn_0() 
   {
        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;
 
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">

<html<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'] ?>>
 <head>
    <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'] ?>" />
    <SCRIPT type="text/javascript">
      var sc_pathToTB = '<?php echo $this->Ini->path_prod ?>/third/jquery_plugin/thickbox/';
    </SCRIPT>
    <SCRIPT type="text/javascript" src="<?php echo $this->Ini->path_prod; ?>/third/jquery/js/jquery.js"></SCRIPT>
    <SCRIPT type="text/javascript" src="<?php echo $this->Ini->path_prod; ?>/third/jquery_plugin/malsup-blockui/jquery.blockUI.js"></SCRIPT>
    <SCRIPT type="text/javascript" src="<?php echo $this->Ini->path_prod; ?>/third/jquery_plugin/thickbox/thickbox-compressed.js"></SCRIPT>
    <link rel="stylesheet" href="<?php echo $this->Ini->path_prod ?>/third/jquery_plugin/thickbox/thickbox.css" type="text/css" media="screen" />
    <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_form.css" />
 </head>
  <body class="scFormPage">
      <table class="scFormTabela" align="center"><tr><td>
<?php
      $nmgp_opcao_saida_php = "igual";
      $nmgp_opc_ant_saida_php = "";
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['opc_ant'] == "novo" || $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['opc_ant'] == "incluir")
      {
          $nmgp_opc_ant_saida_php = "novo";
          $nmgp_opcao_saida_php   = "recarga";
      }
      $nm_f_saida = "./";
      nm_limpa_data($this->date, $this->field_config['date']['date_sep']) ; 
      nm_limpa_numero($this->per1, $this->field_config['per1']['symbol_grp']) ; 
      nm_limpa_numero($this->per2, $this->field_config['per2']['symbol_grp']) ; 
      nm_limpa_numero($this->per3, $this->field_config['per3']['symbol_grp']) ; 
      nm_limpa_numero($this->per4, $this->field_config['per4']['symbol_grp']) ; 
      if (!empty($this->field_config['nprice']['symbol_dec']))
      {
          $this->sc_remove_currency($this->nprice, $this->field_config['nprice']['symbol_dec'], $this->field_config['nprice']['symbol_grp'], $this->field_config['nprice']['symbol_mon']); 
          nm_limpa_valor($this->nprice, $this->field_config['nprice']['symbol_dec'], $this->field_config['nprice']['symbol_grp']) ; 
      }
      nm_limpa_data($this->npdate, $this->field_config['npdate']['date_sep']) ; 
      nm_limpa_numero($this->yds, $this->field_config['yds']['symbol_grp']) ; 
      nm_limpa_numero($this->lbs, $this->field_config['lbs']['symbol_grp']) ; 
      nm_limpa_numero($this->dye, $this->field_config['dye']['symbol_grp']) ; 
      if (!empty($this->field_config['gc']['symbol_dec']))
      {
          $this->sc_remove_currency($this->gc, $this->field_config['gc']['symbol_dec'], $this->field_config['gc']['symbol_grp'], $this->field_config['gc']['symbol_mon']); 
          nm_limpa_valor($this->gc, $this->field_config['gc']['symbol_dec'], $this->field_config['gc']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['fc']['symbol_dec']))
      {
          $this->sc_remove_currency($this->fc, $this->field_config['fc']['symbol_dec'], $this->field_config['fc']['symbol_grp'], $this->field_config['fc']['symbol_mon']); 
          nm_limpa_valor($this->fc, $this->field_config['fc']['symbol_dec'], $this->field_config['fc']['symbol_grp']) ; 
      }
      nm_limpa_numero($this->gshort, $this->field_config['gshort']['symbol_grp']) ; 
      if (!empty($this->field_config['ytdd']['symbol_dec']))
      {
          $this->sc_remove_currency($this->ytdd, $this->field_config['ytdd']['symbol_dec'], $this->field_config['ytdd']['symbol_grp'], $this->field_config['ytdd']['symbol_mon']); 
          nm_limpa_valor($this->ytdd, $this->field_config['ytdd']['symbol_dec'], $this->field_config['ytdd']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['ytdy']['symbol_dec']))
      {
          $this->sc_remove_currency($this->ytdy, $this->field_config['ytdy']['symbol_dec'], $this->field_config['ytdy']['symbol_grp'], $this->field_config['ytdy']['symbol_mon']); 
          nm_limpa_valor($this->ytdy, $this->field_config['ytdy']['symbol_dec'], $this->field_config['ytdy']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['mtdd']['symbol_dec']))
      {
          $this->sc_remove_currency($this->mtdd, $this->field_config['mtdd']['symbol_dec'], $this->field_config['mtdd']['symbol_grp'], $this->field_config['mtdd']['symbol_mon']); 
          nm_limpa_valor($this->mtdd, $this->field_config['mtdd']['symbol_dec'], $this->field_config['mtdd']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['mtdy']['symbol_dec']))
      {
          $this->sc_remove_currency($this->mtdy, $this->field_config['mtdy']['symbol_dec'], $this->field_config['mtdy']['symbol_grp'], $this->field_config['mtdy']['symbol_mon']); 
          nm_limpa_valor($this->mtdy, $this->field_config['mtdy']['symbol_dec'], $this->field_config['mtdy']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['histy']['symbol_dec']))
      {
          $this->sc_remove_currency($this->histy, $this->field_config['histy']['symbol_dec'], $this->field_config['histy']['symbol_grp'], $this->field_config['histy']['symbol_mon']); 
          nm_limpa_valor($this->histy, $this->field_config['histy']['symbol_dec'], $this->field_config['histy']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['histd']['symbol_dec']))
      {
          $this->sc_remove_currency($this->histd, $this->field_config['histd']['symbol_dec'], $this->field_config['histd']['symbol_grp'], $this->field_config['histd']['symbol_mon']); 
          nm_limpa_valor($this->histd, $this->field_config['histd']['symbol_dec'], $this->field_config['histd']['symbol_grp']) ; 
      }
      nm_limpa_data($this->update, $this->field_config['update']['date_sep']) ; 
      if (!empty($this->field_config['avprice']['symbol_dec']))
      {
          $this->sc_remove_currency($this->avprice, $this->field_config['avprice']['symbol_dec'], $this->field_config['avprice']['symbol_grp'], $this->field_config['avprice']['symbol_mon']); 
          nm_limpa_valor($this->avprice, $this->field_config['avprice']['symbol_dec'], $this->field_config['avprice']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['lastyry']['symbol_dec']))
      {
          $this->sc_remove_currency($this->lastyry, $this->field_config['lastyry']['symbol_dec'], $this->field_config['lastyry']['symbol_grp'], $this->field_config['lastyry']['symbol_mon']); 
          nm_limpa_valor($this->lastyry, $this->field_config['lastyry']['symbol_dec'], $this->field_config['lastyry']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['lastyrd']['symbol_dec']))
      {
          $this->sc_remove_currency($this->lastyrd, $this->field_config['lastyrd']['symbol_dec'], $this->field_config['lastyrd']['symbol_grp'], $this->field_config['lastyrd']['symbol_mon']); 
          nm_limpa_valor($this->lastyrd, $this->field_config['lastyrd']['symbol_dec'], $this->field_config['lastyrd']['symbol_grp']) ; 
      }
      nm_limpa_numero($this->dyeleft, $this->field_config['dyeleft']['symbol_grp']) ; 
      if (!empty($this->field_config['ozsquare']['symbol_dec']))
      {
          $this->sc_remove_currency($this->ozsquare, $this->field_config['ozsquare']['symbol_dec'], $this->field_config['ozsquare']['symbol_grp'], $this->field_config['ozsquare']['symbol_mon']); 
          nm_limpa_valor($this->ozsquare, $this->field_config['ozsquare']['symbol_dec'], $this->field_config['ozsquare']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['ozlin']['symbol_dec']))
      {
          $this->sc_remove_currency($this->ozlin, $this->field_config['ozlin']['symbol_dec'], $this->field_config['ozlin']['symbol_grp'], $this->field_config['ozlin']['symbol_mon']); 
          nm_limpa_valor($this->ozlin, $this->field_config['ozlin']['symbol_dec'], $this->field_config['ozlin']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['sqlb']['symbol_dec']))
      {
          $this->sc_remove_currency($this->sqlb, $this->field_config['sqlb']['symbol_dec'], $this->field_config['sqlb']['symbol_grp'], $this->field_config['sqlb']['symbol_mon']); 
          nm_limpa_valor($this->sqlb, $this->field_config['sqlb']['symbol_dec'], $this->field_config['sqlb']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['meterkilo']['symbol_dec']))
      {
          $this->sc_remove_currency($this->meterkilo, $this->field_config['meterkilo']['symbol_dec'], $this->field_config['meterkilo']['symbol_grp'], $this->field_config['meterkilo']['symbol_mon']); 
          nm_limpa_valor($this->meterkilo, $this->field_config['meterkilo']['symbol_dec'], $this->field_config['meterkilo']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['meter2kilo']['symbol_dec']))
      {
          $this->sc_remove_currency($this->meter2kilo, $this->field_config['meter2kilo']['symbol_dec'], $this->field_config['meter2kilo']['symbol_grp'], $this->field_config['meter2kilo']['symbol_mon']); 
          nm_limpa_valor($this->meter2kilo, $this->field_config['meter2kilo']['symbol_dec'], $this->field_config['meter2kilo']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['grammeter']['symbol_dec']))
      {
          $this->sc_remove_currency($this->grammeter, $this->field_config['grammeter']['symbol_dec'], $this->field_config['grammeter']['symbol_grp'], $this->field_config['grammeter']['symbol_mon']); 
          nm_limpa_valor($this->grammeter, $this->field_config['grammeter']['symbol_dec'], $this->field_config['grammeter']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['grammeter2']['symbol_dec']))
      {
          $this->sc_remove_currency($this->grammeter2, $this->field_config['grammeter2']['symbol_dec'], $this->field_config['grammeter2']['symbol_grp'], $this->field_config['grammeter2']['symbol_mon']); 
          nm_limpa_valor($this->grammeter2, $this->field_config['grammeter2']['symbol_dec'], $this->field_config['grammeter2']['symbol_grp']) ; 
      }
      nm_limpa_data($this->date1, $this->field_config['date1']['date_sep']) ; 
      nm_limpa_data($this->date2, $this->field_config['date2']['date_sep']) ; 
      nm_limpa_data($this->date3, $this->field_config['date3']['date_sep']) ; 
      nm_limpa_data($this->date4, $this->field_config['date4']['date_sep']) ; 
      nm_limpa_data($this->date5, $this->field_config['date5']['date_sep']) ; 
      nm_limpa_data($this->date6, $this->field_config['date6']['date_sep']) ; 
      if (!empty($this->field_config['conv2']['symbol_dec']))
      {
          $this->sc_remove_currency($this->conv2, $this->field_config['conv2']['symbol_dec'], $this->field_config['conv2']['symbol_grp'], $this->field_config['conv2']['symbol_mon']); 
          nm_limpa_valor($this->conv2, $this->field_config['conv2']['symbol_dec'], $this->field_config['conv2']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['conv3']['symbol_dec']))
      {
          $this->sc_remove_currency($this->conv3, $this->field_config['conv3']['symbol_dec'], $this->field_config['conv3']['symbol_grp'], $this->field_config['conv3']['symbol_mon']); 
          nm_limpa_valor($this->conv3, $this->field_config['conv3']['symbol_dec'], $this->field_config['conv3']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['conv']['symbol_dec']))
      {
          $this->sc_remove_currency($this->conv, $this->field_config['conv']['symbol_dec'], $this->field_config['conv']['symbol_grp'], $this->field_config['conv']['symbol_mon']); 
          nm_limpa_valor($this->conv, $this->field_config['conv']['symbol_dec'], $this->field_config['conv']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['stdcost']['symbol_dec']))
      {
          $this->sc_remove_currency($this->stdcost, $this->field_config['stdcost']['symbol_dec'], $this->field_config['stdcost']['symbol_grp'], $this->field_config['stdcost']['symbol_mon']); 
          nm_limpa_valor($this->stdcost, $this->field_config['stdcost']['symbol_dec'], $this->field_config['stdcost']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['stdgp']['symbol_dec']))
      {
          $this->sc_remove_currency($this->stdgp, $this->field_config['stdgp']['symbol_dec'], $this->field_config['stdgp']['symbol_grp'], $this->field_config['stdgp']['symbol_mon']); 
          nm_limpa_valor($this->stdgp, $this->field_config['stdgp']['symbol_dec'], $this->field_config['stdgp']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['sprice']['symbol_dec']))
      {
          $this->sc_remove_currency($this->sprice, $this->field_config['sprice']['symbol_dec'], $this->field_config['sprice']['symbol_grp'], $this->field_config['sprice']['symbol_mon']); 
          nm_limpa_valor($this->sprice, $this->field_config['sprice']['symbol_dec'], $this->field_config['sprice']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['avcost']['symbol_dec']))
      {
          $this->sc_remove_currency($this->avcost, $this->field_config['avcost']['symbol_dec'], $this->field_config['avcost']['symbol_grp'], $this->field_config['avcost']['symbol_mon']); 
          nm_limpa_valor($this->avcost, $this->field_config['avcost']['symbol_dec'], $this->field_config['avcost']['symbol_grp']) ; 
      }
      nm_limpa_numero($this->lbbo, $this->field_config['lbbo']['symbol_grp']) ; 
      nm_limpa_numero($this->bo, $this->field_config['bo']['symbol_grp']) ; 
      nm_limpa_numero($this->samples, $this->field_config['samples']['symbol_grp']) ; 
      $this->nm_converte_datas();
      $_SESSION['scriptcase']['line_form']['contr_erro'] = 'on';
if (!isset($this->sc_temp_var_line)) {$this->sc_temp_var_line = (isset($_SESSION['var_line'])) ? $_SESSION['var_line'] : "";}
       if ($this->sc_temp_var_line == 'VERATEX')
{
     if (isset($this->sc_temp_var_line)) { $_SESSION['var_line'] = $this->sc_temp_var_line;}
 if (!isset($this->Campos_Mens_erro) || empty($this->Campos_Mens_erro))
 {
$this->nmgp_redireciona_form($this->Ini->path_link . "" . SC_dir_app_name('line_item_grid') . "/", $this->nm_location, "var_style?#?" . $this->style  . "?@?","_self", '', 440, 630);
 };
}
if ($this->sc_temp_var_line == 'FAIRLANE')
{
     if (isset($this->sc_temp_var_line)) { $_SESSION['var_line'] = $this->sc_temp_var_line;}
 if (!isset($this->Campos_Mens_erro) || empty($this->Campos_Mens_erro))
 {
$this->nmgp_redireciona_form($this->Ini->path_link . "" . SC_dir_app_name('fv_line_item_grid') . "/", $this->nm_location, "var_style?#?" . $this->style  . "?@?","_self", '', 440, 630);
 };
}
if (isset($this->sc_temp_var_line)) { $_SESSION['var_line'] = $this->sc_temp_var_line;}
$_SESSION['scriptcase']['line_form']['contr_erro'] = 'off'; 
?>
      </td></tr><tr><td align="center">
      <form name="FPHP" method="post" 
                        action="<?php echo $nm_f_saida ?>" 
                        target="_self">
      <input type=hidden name="nmgp_opcao" value=""/>
      <input type=hidden name="script_case_init" value="<?php  echo NM_encode_input($this->Ini->sc_page); ?>"/>
      <input type=hidden name="script_case_session" value="<?php  echo NM_encode_input(session_id()); ?>"/>
      <input type=hidden name="style" value="<?php echo NM_encode_input($this->style) ?>"/>
      <input type=hidden name="id2" value="<?php echo NM_encode_input($this->id2) ?>"/>
      <input type=hidden name="nmgp_opcao" value="<?php echo NM_encode_input($nmgp_opcao_saida_php); ?>"/>
      <input type=hidden name="nmgp_opc_ant" value="<?php echo NM_encode_input($nmgp_opc_ant_saida_php); ?>"/>
      <input type=submit name="nmgp_bok" value="<?php echo $this->Ini->Nm_lang['lang_btns_cfrm'] ?>" onclick="window.close()"/>
      </form>
      </td></tr></table>
      </body>
      </html>
<?php
   }
   function sc_btn_sc_btn_1() 
   {
        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;
 
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">

<html<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'] ?>>
 <head>
    <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'] ?>" />
    <SCRIPT type="text/javascript">
      var sc_pathToTB = '<?php echo $this->Ini->path_prod ?>/third/jquery_plugin/thickbox/';
    </SCRIPT>
    <SCRIPT type="text/javascript" src="<?php echo $this->Ini->path_prod; ?>/third/jquery/js/jquery.js"></SCRIPT>
    <SCRIPT type="text/javascript" src="<?php echo $this->Ini->path_prod; ?>/third/jquery_plugin/malsup-blockui/jquery.blockUI.js"></SCRIPT>
    <SCRIPT type="text/javascript" src="<?php echo $this->Ini->path_prod; ?>/third/jquery_plugin/thickbox/thickbox-compressed.js"></SCRIPT>
    <link rel="stylesheet" href="<?php echo $this->Ini->path_prod ?>/third/jquery_plugin/thickbox/thickbox.css" type="text/css" media="screen" />
    <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_form.css" />
 </head>
  <body class="scFormPage">
      <table class="scFormTabela" align="center"><tr><td>
<?php
      $nmgp_opcao_saida_php = "igual";
      $nmgp_opc_ant_saida_php = "";
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['opc_ant'] == "novo" || $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['opc_ant'] == "incluir")
      {
          $nmgp_opc_ant_saida_php = "novo";
          $nmgp_opcao_saida_php   = "recarga";
      }
      $nm_f_saida = "./";
      nm_limpa_data($this->date, $this->field_config['date']['date_sep']) ; 
      nm_limpa_numero($this->per1, $this->field_config['per1']['symbol_grp']) ; 
      nm_limpa_numero($this->per2, $this->field_config['per2']['symbol_grp']) ; 
      nm_limpa_numero($this->per3, $this->field_config['per3']['symbol_grp']) ; 
      nm_limpa_numero($this->per4, $this->field_config['per4']['symbol_grp']) ; 
      if (!empty($this->field_config['nprice']['symbol_dec']))
      {
          $this->sc_remove_currency($this->nprice, $this->field_config['nprice']['symbol_dec'], $this->field_config['nprice']['symbol_grp'], $this->field_config['nprice']['symbol_mon']); 
          nm_limpa_valor($this->nprice, $this->field_config['nprice']['symbol_dec'], $this->field_config['nprice']['symbol_grp']) ; 
      }
      nm_limpa_data($this->npdate, $this->field_config['npdate']['date_sep']) ; 
      nm_limpa_numero($this->yds, $this->field_config['yds']['symbol_grp']) ; 
      nm_limpa_numero($this->lbs, $this->field_config['lbs']['symbol_grp']) ; 
      nm_limpa_numero($this->dye, $this->field_config['dye']['symbol_grp']) ; 
      if (!empty($this->field_config['gc']['symbol_dec']))
      {
          $this->sc_remove_currency($this->gc, $this->field_config['gc']['symbol_dec'], $this->field_config['gc']['symbol_grp'], $this->field_config['gc']['symbol_mon']); 
          nm_limpa_valor($this->gc, $this->field_config['gc']['symbol_dec'], $this->field_config['gc']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['fc']['symbol_dec']))
      {
          $this->sc_remove_currency($this->fc, $this->field_config['fc']['symbol_dec'], $this->field_config['fc']['symbol_grp'], $this->field_config['fc']['symbol_mon']); 
          nm_limpa_valor($this->fc, $this->field_config['fc']['symbol_dec'], $this->field_config['fc']['symbol_grp']) ; 
      }
      nm_limpa_numero($this->gshort, $this->field_config['gshort']['symbol_grp']) ; 
      if (!empty($this->field_config['ytdd']['symbol_dec']))
      {
          $this->sc_remove_currency($this->ytdd, $this->field_config['ytdd']['symbol_dec'], $this->field_config['ytdd']['symbol_grp'], $this->field_config['ytdd']['symbol_mon']); 
          nm_limpa_valor($this->ytdd, $this->field_config['ytdd']['symbol_dec'], $this->field_config['ytdd']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['ytdy']['symbol_dec']))
      {
          $this->sc_remove_currency($this->ytdy, $this->field_config['ytdy']['symbol_dec'], $this->field_config['ytdy']['symbol_grp'], $this->field_config['ytdy']['symbol_mon']); 
          nm_limpa_valor($this->ytdy, $this->field_config['ytdy']['symbol_dec'], $this->field_config['ytdy']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['mtdd']['symbol_dec']))
      {
          $this->sc_remove_currency($this->mtdd, $this->field_config['mtdd']['symbol_dec'], $this->field_config['mtdd']['symbol_grp'], $this->field_config['mtdd']['symbol_mon']); 
          nm_limpa_valor($this->mtdd, $this->field_config['mtdd']['symbol_dec'], $this->field_config['mtdd']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['mtdy']['symbol_dec']))
      {
          $this->sc_remove_currency($this->mtdy, $this->field_config['mtdy']['symbol_dec'], $this->field_config['mtdy']['symbol_grp'], $this->field_config['mtdy']['symbol_mon']); 
          nm_limpa_valor($this->mtdy, $this->field_config['mtdy']['symbol_dec'], $this->field_config['mtdy']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['histy']['symbol_dec']))
      {
          $this->sc_remove_currency($this->histy, $this->field_config['histy']['symbol_dec'], $this->field_config['histy']['symbol_grp'], $this->field_config['histy']['symbol_mon']); 
          nm_limpa_valor($this->histy, $this->field_config['histy']['symbol_dec'], $this->field_config['histy']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['histd']['symbol_dec']))
      {
          $this->sc_remove_currency($this->histd, $this->field_config['histd']['symbol_dec'], $this->field_config['histd']['symbol_grp'], $this->field_config['histd']['symbol_mon']); 
          nm_limpa_valor($this->histd, $this->field_config['histd']['symbol_dec'], $this->field_config['histd']['symbol_grp']) ; 
      }
      nm_limpa_data($this->update, $this->field_config['update']['date_sep']) ; 
      if (!empty($this->field_config['avprice']['symbol_dec']))
      {
          $this->sc_remove_currency($this->avprice, $this->field_config['avprice']['symbol_dec'], $this->field_config['avprice']['symbol_grp'], $this->field_config['avprice']['symbol_mon']); 
          nm_limpa_valor($this->avprice, $this->field_config['avprice']['symbol_dec'], $this->field_config['avprice']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['lastyry']['symbol_dec']))
      {
          $this->sc_remove_currency($this->lastyry, $this->field_config['lastyry']['symbol_dec'], $this->field_config['lastyry']['symbol_grp'], $this->field_config['lastyry']['symbol_mon']); 
          nm_limpa_valor($this->lastyry, $this->field_config['lastyry']['symbol_dec'], $this->field_config['lastyry']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['lastyrd']['symbol_dec']))
      {
          $this->sc_remove_currency($this->lastyrd, $this->field_config['lastyrd']['symbol_dec'], $this->field_config['lastyrd']['symbol_grp'], $this->field_config['lastyrd']['symbol_mon']); 
          nm_limpa_valor($this->lastyrd, $this->field_config['lastyrd']['symbol_dec'], $this->field_config['lastyrd']['symbol_grp']) ; 
      }
      nm_limpa_numero($this->dyeleft, $this->field_config['dyeleft']['symbol_grp']) ; 
      if (!empty($this->field_config['ozsquare']['symbol_dec']))
      {
          $this->sc_remove_currency($this->ozsquare, $this->field_config['ozsquare']['symbol_dec'], $this->field_config['ozsquare']['symbol_grp'], $this->field_config['ozsquare']['symbol_mon']); 
          nm_limpa_valor($this->ozsquare, $this->field_config['ozsquare']['symbol_dec'], $this->field_config['ozsquare']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['ozlin']['symbol_dec']))
      {
          $this->sc_remove_currency($this->ozlin, $this->field_config['ozlin']['symbol_dec'], $this->field_config['ozlin']['symbol_grp'], $this->field_config['ozlin']['symbol_mon']); 
          nm_limpa_valor($this->ozlin, $this->field_config['ozlin']['symbol_dec'], $this->field_config['ozlin']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['sqlb']['symbol_dec']))
      {
          $this->sc_remove_currency($this->sqlb, $this->field_config['sqlb']['symbol_dec'], $this->field_config['sqlb']['symbol_grp'], $this->field_config['sqlb']['symbol_mon']); 
          nm_limpa_valor($this->sqlb, $this->field_config['sqlb']['symbol_dec'], $this->field_config['sqlb']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['meterkilo']['symbol_dec']))
      {
          $this->sc_remove_currency($this->meterkilo, $this->field_config['meterkilo']['symbol_dec'], $this->field_config['meterkilo']['symbol_grp'], $this->field_config['meterkilo']['symbol_mon']); 
          nm_limpa_valor($this->meterkilo, $this->field_config['meterkilo']['symbol_dec'], $this->field_config['meterkilo']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['meter2kilo']['symbol_dec']))
      {
          $this->sc_remove_currency($this->meter2kilo, $this->field_config['meter2kilo']['symbol_dec'], $this->field_config['meter2kilo']['symbol_grp'], $this->field_config['meter2kilo']['symbol_mon']); 
          nm_limpa_valor($this->meter2kilo, $this->field_config['meter2kilo']['symbol_dec'], $this->field_config['meter2kilo']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['grammeter']['symbol_dec']))
      {
          $this->sc_remove_currency($this->grammeter, $this->field_config['grammeter']['symbol_dec'], $this->field_config['grammeter']['symbol_grp'], $this->field_config['grammeter']['symbol_mon']); 
          nm_limpa_valor($this->grammeter, $this->field_config['grammeter']['symbol_dec'], $this->field_config['grammeter']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['grammeter2']['symbol_dec']))
      {
          $this->sc_remove_currency($this->grammeter2, $this->field_config['grammeter2']['symbol_dec'], $this->field_config['grammeter2']['symbol_grp'], $this->field_config['grammeter2']['symbol_mon']); 
          nm_limpa_valor($this->grammeter2, $this->field_config['grammeter2']['symbol_dec'], $this->field_config['grammeter2']['symbol_grp']) ; 
      }
      nm_limpa_data($this->date1, $this->field_config['date1']['date_sep']) ; 
      nm_limpa_data($this->date2, $this->field_config['date2']['date_sep']) ; 
      nm_limpa_data($this->date3, $this->field_config['date3']['date_sep']) ; 
      nm_limpa_data($this->date4, $this->field_config['date4']['date_sep']) ; 
      nm_limpa_data($this->date5, $this->field_config['date5']['date_sep']) ; 
      nm_limpa_data($this->date6, $this->field_config['date6']['date_sep']) ; 
      if (!empty($this->field_config['conv2']['symbol_dec']))
      {
          $this->sc_remove_currency($this->conv2, $this->field_config['conv2']['symbol_dec'], $this->field_config['conv2']['symbol_grp'], $this->field_config['conv2']['symbol_mon']); 
          nm_limpa_valor($this->conv2, $this->field_config['conv2']['symbol_dec'], $this->field_config['conv2']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['conv3']['symbol_dec']))
      {
          $this->sc_remove_currency($this->conv3, $this->field_config['conv3']['symbol_dec'], $this->field_config['conv3']['symbol_grp'], $this->field_config['conv3']['symbol_mon']); 
          nm_limpa_valor($this->conv3, $this->field_config['conv3']['symbol_dec'], $this->field_config['conv3']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['conv']['symbol_dec']))
      {
          $this->sc_remove_currency($this->conv, $this->field_config['conv']['symbol_dec'], $this->field_config['conv']['symbol_grp'], $this->field_config['conv']['symbol_mon']); 
          nm_limpa_valor($this->conv, $this->field_config['conv']['symbol_dec'], $this->field_config['conv']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['stdcost']['symbol_dec']))
      {
          $this->sc_remove_currency($this->stdcost, $this->field_config['stdcost']['symbol_dec'], $this->field_config['stdcost']['symbol_grp'], $this->field_config['stdcost']['symbol_mon']); 
          nm_limpa_valor($this->stdcost, $this->field_config['stdcost']['symbol_dec'], $this->field_config['stdcost']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['stdgp']['symbol_dec']))
      {
          $this->sc_remove_currency($this->stdgp, $this->field_config['stdgp']['symbol_dec'], $this->field_config['stdgp']['symbol_grp'], $this->field_config['stdgp']['symbol_mon']); 
          nm_limpa_valor($this->stdgp, $this->field_config['stdgp']['symbol_dec'], $this->field_config['stdgp']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['sprice']['symbol_dec']))
      {
          $this->sc_remove_currency($this->sprice, $this->field_config['sprice']['symbol_dec'], $this->field_config['sprice']['symbol_grp'], $this->field_config['sprice']['symbol_mon']); 
          nm_limpa_valor($this->sprice, $this->field_config['sprice']['symbol_dec'], $this->field_config['sprice']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['avcost']['symbol_dec']))
      {
          $this->sc_remove_currency($this->avcost, $this->field_config['avcost']['symbol_dec'], $this->field_config['avcost']['symbol_grp'], $this->field_config['avcost']['symbol_mon']); 
          nm_limpa_valor($this->avcost, $this->field_config['avcost']['symbol_dec'], $this->field_config['avcost']['symbol_grp']) ; 
      }
      nm_limpa_numero($this->lbbo, $this->field_config['lbbo']['symbol_grp']) ; 
      nm_limpa_numero($this->bo, $this->field_config['bo']['symbol_grp']) ; 
      nm_limpa_numero($this->samples, $this->field_config['samples']['symbol_grp']) ; 
      $this->nm_converte_datas();
      $_SESSION['scriptcase']['line_form']['contr_erro'] = 'on';
if (!isset($this->sc_temp_var_line)) {$this->sc_temp_var_line = (isset($_SESSION['var_line'])) ? $_SESSION['var_line'] : "";}
       if ($this->sc_temp_var_line == 'VERATEX')
{
     if (isset($this->sc_temp_var_line)) { $_SESSION['var_line'] = $this->sc_temp_var_line;}
 if (!isset($this->Campos_Mens_erro) || empty($this->Campos_Mens_erro))
 {
$this->nmgp_redireciona_form($this->Ini->path_link . "" . SC_dir_app_name('line_orders_grid') . "/", $this->nm_location, "var_style?#?" . $this->style  . "?@?","_self", '', 440, 630);
 };
}
if ($this->sc_temp_var_line == 'FAIRLANE')
{
     if (isset($this->sc_temp_var_line)) { $_SESSION['var_line'] = $this->sc_temp_var_line;}
 if (!isset($this->Campos_Mens_erro) || empty($this->Campos_Mens_erro))
 {
$this->nmgp_redireciona_form($this->Ini->path_link . "" . SC_dir_app_name('fv_line_grpo_grid') . "/", $this->nm_location, "var_style?#?" . $this->style  . "?@?","_self", '', 440, 630);
 };
}
if (isset($this->sc_temp_var_line)) { $_SESSION['var_line'] = $this->sc_temp_var_line;}
$_SESSION['scriptcase']['line_form']['contr_erro'] = 'off'; 
?>
      </td></tr><tr><td align="center">
      <form name="FPHP" method="post" 
                        action="<?php echo $nm_f_saida ?>" 
                        target="_self">
      <input type=hidden name="nmgp_opcao" value=""/>
      <input type=hidden name="script_case_init" value="<?php  echo NM_encode_input($this->Ini->sc_page); ?>"/>
      <input type=hidden name="script_case_session" value="<?php  echo NM_encode_input(session_id()); ?>"/>
      <input type=hidden name="style" value="<?php echo NM_encode_input($this->style) ?>"/>
      <input type=hidden name="id2" value="<?php echo NM_encode_input($this->id2) ?>"/>
      <input type=hidden name="nmgp_opcao" value="<?php echo NM_encode_input($nmgp_opcao_saida_php); ?>"/>
      <input type=hidden name="nmgp_opc_ant" value="<?php echo NM_encode_input($nmgp_opc_ant_saida_php); ?>"/>
      <input type=submit name="nmgp_bok" value="<?php echo $this->Ini->Nm_lang['lang_btns_cfrm'] ?>" onclick="window.close()"/>
      </form>
      </td></tr></table>
      </body>
      </html>
<?php
   }
   function sc_btn_Dye() 
   {
        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;
 
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
            "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">

<html<?php echo $_SESSION['scriptcase']['reg_conf']['html_dir'] ?>>
 <head>
    <META http-equiv="Content-Type" content="text/html; charset=<?php echo $_SESSION['scriptcase']['charset_html'] ?>" />
    <SCRIPT type="text/javascript">
      var sc_pathToTB = '<?php echo $this->Ini->path_prod ?>/third/jquery_plugin/thickbox/';
    </SCRIPT>
    <SCRIPT type="text/javascript" src="<?php echo $this->Ini->path_prod; ?>/third/jquery/js/jquery.js"></SCRIPT>
    <SCRIPT type="text/javascript" src="<?php echo $this->Ini->path_prod; ?>/third/jquery_plugin/malsup-blockui/jquery.blockUI.js"></SCRIPT>
    <SCRIPT type="text/javascript" src="<?php echo $this->Ini->path_prod; ?>/third/jquery_plugin/thickbox/thickbox-compressed.js"></SCRIPT>
    <link rel="stylesheet" href="<?php echo $this->Ini->path_prod ?>/third/jquery_plugin/thickbox/thickbox.css" type="text/css" media="screen" />
    <link rel="stylesheet" type="text/css" href="../_lib/css/<?php echo $this->Ini->str_schema_all ?>_form.css" />
 </head>
  <body class="scFormPage">
      <table class="scFormTabela" align="center"><tr><td>
<?php
      $nmgp_opcao_saida_php = "igual";
      $nmgp_opc_ant_saida_php = "";
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['opc_ant'] == "novo" || $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['opc_ant'] == "incluir")
      {
          $nmgp_opc_ant_saida_php = "novo";
          $nmgp_opcao_saida_php   = "recarga";
      }
      $nm_f_saida = "./";
      nm_limpa_data($this->date, $this->field_config['date']['date_sep']) ; 
      nm_limpa_numero($this->per1, $this->field_config['per1']['symbol_grp']) ; 
      nm_limpa_numero($this->per2, $this->field_config['per2']['symbol_grp']) ; 
      nm_limpa_numero($this->per3, $this->field_config['per3']['symbol_grp']) ; 
      nm_limpa_numero($this->per4, $this->field_config['per4']['symbol_grp']) ; 
      if (!empty($this->field_config['nprice']['symbol_dec']))
      {
          $this->sc_remove_currency($this->nprice, $this->field_config['nprice']['symbol_dec'], $this->field_config['nprice']['symbol_grp'], $this->field_config['nprice']['symbol_mon']); 
          nm_limpa_valor($this->nprice, $this->field_config['nprice']['symbol_dec'], $this->field_config['nprice']['symbol_grp']) ; 
      }
      nm_limpa_data($this->npdate, $this->field_config['npdate']['date_sep']) ; 
      nm_limpa_numero($this->yds, $this->field_config['yds']['symbol_grp']) ; 
      nm_limpa_numero($this->lbs, $this->field_config['lbs']['symbol_grp']) ; 
      nm_limpa_numero($this->dye, $this->field_config['dye']['symbol_grp']) ; 
      if (!empty($this->field_config['gc']['symbol_dec']))
      {
          $this->sc_remove_currency($this->gc, $this->field_config['gc']['symbol_dec'], $this->field_config['gc']['symbol_grp'], $this->field_config['gc']['symbol_mon']); 
          nm_limpa_valor($this->gc, $this->field_config['gc']['symbol_dec'], $this->field_config['gc']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['fc']['symbol_dec']))
      {
          $this->sc_remove_currency($this->fc, $this->field_config['fc']['symbol_dec'], $this->field_config['fc']['symbol_grp'], $this->field_config['fc']['symbol_mon']); 
          nm_limpa_valor($this->fc, $this->field_config['fc']['symbol_dec'], $this->field_config['fc']['symbol_grp']) ; 
      }
      nm_limpa_numero($this->gshort, $this->field_config['gshort']['symbol_grp']) ; 
      if (!empty($this->field_config['ytdd']['symbol_dec']))
      {
          $this->sc_remove_currency($this->ytdd, $this->field_config['ytdd']['symbol_dec'], $this->field_config['ytdd']['symbol_grp'], $this->field_config['ytdd']['symbol_mon']); 
          nm_limpa_valor($this->ytdd, $this->field_config['ytdd']['symbol_dec'], $this->field_config['ytdd']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['ytdy']['symbol_dec']))
      {
          $this->sc_remove_currency($this->ytdy, $this->field_config['ytdy']['symbol_dec'], $this->field_config['ytdy']['symbol_grp'], $this->field_config['ytdy']['symbol_mon']); 
          nm_limpa_valor($this->ytdy, $this->field_config['ytdy']['symbol_dec'], $this->field_config['ytdy']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['mtdd']['symbol_dec']))
      {
          $this->sc_remove_currency($this->mtdd, $this->field_config['mtdd']['symbol_dec'], $this->field_config['mtdd']['symbol_grp'], $this->field_config['mtdd']['symbol_mon']); 
          nm_limpa_valor($this->mtdd, $this->field_config['mtdd']['symbol_dec'], $this->field_config['mtdd']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['mtdy']['symbol_dec']))
      {
          $this->sc_remove_currency($this->mtdy, $this->field_config['mtdy']['symbol_dec'], $this->field_config['mtdy']['symbol_grp'], $this->field_config['mtdy']['symbol_mon']); 
          nm_limpa_valor($this->mtdy, $this->field_config['mtdy']['symbol_dec'], $this->field_config['mtdy']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['histy']['symbol_dec']))
      {
          $this->sc_remove_currency($this->histy, $this->field_config['histy']['symbol_dec'], $this->field_config['histy']['symbol_grp'], $this->field_config['histy']['symbol_mon']); 
          nm_limpa_valor($this->histy, $this->field_config['histy']['symbol_dec'], $this->field_config['histy']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['histd']['symbol_dec']))
      {
          $this->sc_remove_currency($this->histd, $this->field_config['histd']['symbol_dec'], $this->field_config['histd']['symbol_grp'], $this->field_config['histd']['symbol_mon']); 
          nm_limpa_valor($this->histd, $this->field_config['histd']['symbol_dec'], $this->field_config['histd']['symbol_grp']) ; 
      }
      nm_limpa_data($this->update, $this->field_config['update']['date_sep']) ; 
      if (!empty($this->field_config['avprice']['symbol_dec']))
      {
          $this->sc_remove_currency($this->avprice, $this->field_config['avprice']['symbol_dec'], $this->field_config['avprice']['symbol_grp'], $this->field_config['avprice']['symbol_mon']); 
          nm_limpa_valor($this->avprice, $this->field_config['avprice']['symbol_dec'], $this->field_config['avprice']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['lastyry']['symbol_dec']))
      {
          $this->sc_remove_currency($this->lastyry, $this->field_config['lastyry']['symbol_dec'], $this->field_config['lastyry']['symbol_grp'], $this->field_config['lastyry']['symbol_mon']); 
          nm_limpa_valor($this->lastyry, $this->field_config['lastyry']['symbol_dec'], $this->field_config['lastyry']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['lastyrd']['symbol_dec']))
      {
          $this->sc_remove_currency($this->lastyrd, $this->field_config['lastyrd']['symbol_dec'], $this->field_config['lastyrd']['symbol_grp'], $this->field_config['lastyrd']['symbol_mon']); 
          nm_limpa_valor($this->lastyrd, $this->field_config['lastyrd']['symbol_dec'], $this->field_config['lastyrd']['symbol_grp']) ; 
      }
      nm_limpa_numero($this->dyeleft, $this->field_config['dyeleft']['symbol_grp']) ; 
      if (!empty($this->field_config['ozsquare']['symbol_dec']))
      {
          $this->sc_remove_currency($this->ozsquare, $this->field_config['ozsquare']['symbol_dec'], $this->field_config['ozsquare']['symbol_grp'], $this->field_config['ozsquare']['symbol_mon']); 
          nm_limpa_valor($this->ozsquare, $this->field_config['ozsquare']['symbol_dec'], $this->field_config['ozsquare']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['ozlin']['symbol_dec']))
      {
          $this->sc_remove_currency($this->ozlin, $this->field_config['ozlin']['symbol_dec'], $this->field_config['ozlin']['symbol_grp'], $this->field_config['ozlin']['symbol_mon']); 
          nm_limpa_valor($this->ozlin, $this->field_config['ozlin']['symbol_dec'], $this->field_config['ozlin']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['sqlb']['symbol_dec']))
      {
          $this->sc_remove_currency($this->sqlb, $this->field_config['sqlb']['symbol_dec'], $this->field_config['sqlb']['symbol_grp'], $this->field_config['sqlb']['symbol_mon']); 
          nm_limpa_valor($this->sqlb, $this->field_config['sqlb']['symbol_dec'], $this->field_config['sqlb']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['meterkilo']['symbol_dec']))
      {
          $this->sc_remove_currency($this->meterkilo, $this->field_config['meterkilo']['symbol_dec'], $this->field_config['meterkilo']['symbol_grp'], $this->field_config['meterkilo']['symbol_mon']); 
          nm_limpa_valor($this->meterkilo, $this->field_config['meterkilo']['symbol_dec'], $this->field_config['meterkilo']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['meter2kilo']['symbol_dec']))
      {
          $this->sc_remove_currency($this->meter2kilo, $this->field_config['meter2kilo']['symbol_dec'], $this->field_config['meter2kilo']['symbol_grp'], $this->field_config['meter2kilo']['symbol_mon']); 
          nm_limpa_valor($this->meter2kilo, $this->field_config['meter2kilo']['symbol_dec'], $this->field_config['meter2kilo']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['grammeter']['symbol_dec']))
      {
          $this->sc_remove_currency($this->grammeter, $this->field_config['grammeter']['symbol_dec'], $this->field_config['grammeter']['symbol_grp'], $this->field_config['grammeter']['symbol_mon']); 
          nm_limpa_valor($this->grammeter, $this->field_config['grammeter']['symbol_dec'], $this->field_config['grammeter']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['grammeter2']['symbol_dec']))
      {
          $this->sc_remove_currency($this->grammeter2, $this->field_config['grammeter2']['symbol_dec'], $this->field_config['grammeter2']['symbol_grp'], $this->field_config['grammeter2']['symbol_mon']); 
          nm_limpa_valor($this->grammeter2, $this->field_config['grammeter2']['symbol_dec'], $this->field_config['grammeter2']['symbol_grp']) ; 
      }
      nm_limpa_data($this->date1, $this->field_config['date1']['date_sep']) ; 
      nm_limpa_data($this->date2, $this->field_config['date2']['date_sep']) ; 
      nm_limpa_data($this->date3, $this->field_config['date3']['date_sep']) ; 
      nm_limpa_data($this->date4, $this->field_config['date4']['date_sep']) ; 
      nm_limpa_data($this->date5, $this->field_config['date5']['date_sep']) ; 
      nm_limpa_data($this->date6, $this->field_config['date6']['date_sep']) ; 
      if (!empty($this->field_config['conv2']['symbol_dec']))
      {
          $this->sc_remove_currency($this->conv2, $this->field_config['conv2']['symbol_dec'], $this->field_config['conv2']['symbol_grp'], $this->field_config['conv2']['symbol_mon']); 
          nm_limpa_valor($this->conv2, $this->field_config['conv2']['symbol_dec'], $this->field_config['conv2']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['conv3']['symbol_dec']))
      {
          $this->sc_remove_currency($this->conv3, $this->field_config['conv3']['symbol_dec'], $this->field_config['conv3']['symbol_grp'], $this->field_config['conv3']['symbol_mon']); 
          nm_limpa_valor($this->conv3, $this->field_config['conv3']['symbol_dec'], $this->field_config['conv3']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['conv']['symbol_dec']))
      {
          $this->sc_remove_currency($this->conv, $this->field_config['conv']['symbol_dec'], $this->field_config['conv']['symbol_grp'], $this->field_config['conv']['symbol_mon']); 
          nm_limpa_valor($this->conv, $this->field_config['conv']['symbol_dec'], $this->field_config['conv']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['stdcost']['symbol_dec']))
      {
          $this->sc_remove_currency($this->stdcost, $this->field_config['stdcost']['symbol_dec'], $this->field_config['stdcost']['symbol_grp'], $this->field_config['stdcost']['symbol_mon']); 
          nm_limpa_valor($this->stdcost, $this->field_config['stdcost']['symbol_dec'], $this->field_config['stdcost']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['stdgp']['symbol_dec']))
      {
          $this->sc_remove_currency($this->stdgp, $this->field_config['stdgp']['symbol_dec'], $this->field_config['stdgp']['symbol_grp'], $this->field_config['stdgp']['symbol_mon']); 
          nm_limpa_valor($this->stdgp, $this->field_config['stdgp']['symbol_dec'], $this->field_config['stdgp']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['sprice']['symbol_dec']))
      {
          $this->sc_remove_currency($this->sprice, $this->field_config['sprice']['symbol_dec'], $this->field_config['sprice']['symbol_grp'], $this->field_config['sprice']['symbol_mon']); 
          nm_limpa_valor($this->sprice, $this->field_config['sprice']['symbol_dec'], $this->field_config['sprice']['symbol_grp']) ; 
      }
      if (!empty($this->field_config['avcost']['symbol_dec']))
      {
          $this->sc_remove_currency($this->avcost, $this->field_config['avcost']['symbol_dec'], $this->field_config['avcost']['symbol_grp'], $this->field_config['avcost']['symbol_mon']); 
          nm_limpa_valor($this->avcost, $this->field_config['avcost']['symbol_dec'], $this->field_config['avcost']['symbol_grp']) ; 
      }
      nm_limpa_numero($this->lbbo, $this->field_config['lbbo']['symbol_grp']) ; 
      nm_limpa_numero($this->bo, $this->field_config['bo']['symbol_grp']) ; 
      nm_limpa_numero($this->samples, $this->field_config['samples']['symbol_grp']) ; 
      $this->nm_converte_datas();
      $_SESSION['scriptcase']['line_form']['contr_erro'] = 'on';
if (!isset($this->sc_temp_var_line)) {$this->sc_temp_var_line = (isset($_SESSION['var_line'])) ? $_SESSION['var_line'] : "";}
       if ($this->sc_temp_var_line == 'VERATEX')
{
     if (isset($this->sc_temp_var_line)) { $_SESSION['var_line'] = $this->sc_temp_var_line;}
 if (!isset($this->Campos_Mens_erro) || empty($this->Campos_Mens_erro))
 {
$this->nmgp_redireciona_form($this->Ini->path_link . "" . SC_dir_app_name('line_dyeorder_grid') . "/", $this->nm_location, "var_style?#?" . $this->style  . "?@?","_self", '', 440, 630);
 };
}
if ($this->sc_temp_var_line == 'FAIRLANE')
{
     if (isset($this->sc_temp_var_line)) { $_SESSION['var_line'] = $this->sc_temp_var_line;}
 if (!isset($this->Campos_Mens_erro) || empty($this->Campos_Mens_erro))
 {
$this->nmgp_redireciona_form($this->Ini->path_link . "" . SC_dir_app_name('fv_line_dyeorder_grid') . "/", $this->nm_location, "var_style?#?" . $this->style  . "?@?","_self", '', 440, 630);
 };
}
if (isset($this->sc_temp_var_line)) { $_SESSION['var_line'] = $this->sc_temp_var_line;}
$_SESSION['scriptcase']['line_form']['contr_erro'] = 'off'; 
?>
      </td></tr><tr><td align="center">
      <form name="FPHP" method="post" 
                        action="<?php echo $nm_f_saida ?>" 
                        target="_self">
      <input type=hidden name="nmgp_opcao" value=""/>
      <input type=hidden name="script_case_init" value="<?php  echo NM_encode_input($this->Ini->sc_page); ?>"/>
      <input type=hidden name="script_case_session" value="<?php  echo NM_encode_input(session_id()); ?>"/>
      <input type=hidden name="style" value="<?php echo NM_encode_input($this->style) ?>"/>
      <input type=hidden name="id2" value="<?php echo NM_encode_input($this->id2) ?>"/>
      <input type=hidden name="nmgp_opcao" value="<?php echo NM_encode_input($nmgp_opcao_saida_php); ?>"/>
      <input type=hidden name="nmgp_opc_ant" value="<?php echo NM_encode_input($nmgp_opc_ant_saida_php); ?>"/>
      <input type=submit name="nmgp_bok" value="<?php echo $this->Ini->Nm_lang['lang_btns_cfrm'] ?>" onclick="window.close()"/>
      </form>
      </td></tr></table>
      </body>
      </html>
<?php
   }
//
//--------------------------------------------------------------------------------------
   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 'image':
               return "Image";
               break;
           case 'style':
               return "STYLE";
               break;
           case 'name':
               return "NAME";
               break;
           case 'width':
               return "WIDTH";
               break;
           case 'comment':
               return "COMMENT";
               break;
           case 'fiber':
               return "FIBER";
               break;
           case 'desc':
               return "DESC";
               break;
           case 'line':
               return "LINE";
               break;
           case 'dept':
               return "DEPT";
               break;
           case 'odesc':
               return "INTERNAL DESC";
               break;
           case 'hand':
               return "HAND";
               break;
           case 'date':
               return "DATE";
               break;
           case 'mindye':
               return "MINDYE";
               break;
           case 'minord':
               return "MINORD";
               break;
           case 'yarn1':
               return "YARN1";
               break;
           case 'per1':
               return "PER1";
               break;
           case 'yarn2':
               return "YARN2";
               break;
           case 'per2':
               return "PER2";
               break;
           case 'yarn3':
               return "YARN3";
               break;
           case 'per3':
               return "PER3";
               break;
           case 'yarn4':
               return "YARN4";
               break;
           case 'per4':
               return "PER4";
               break;
           case 'del1':
               return "DEL1";
               break;
           case 'del2':
               return "DEL2";
               break;
           case 'del3':
               return "DEL3";
               break;
           case 'end1':
               return "END1";
               break;
           case 'end2':
               return "END2";
               break;
           case 'end3':
               return "END3";
               break;
           case 'end4':
               return "END4";
               break;
           case 'end5':
               return "END5";
               break;
           case 'price':
               return "PRICE";
               break;
           case 'med':
               return "MED";
               break;
           case 'dark':
               return "DARK";
               break;
           case 'nprice':
               return "NPRICE";
               break;
           case 'npdate':
               return "NPDATE";
               break;
           case 'memo':
               return "MEMO";
               break;
           case 'smemo':
               return "SMEMO";
               break;
           case 'yds':
               return "FGI YARDS";
               break;
           case 'lbs':
               return "GREIGE LBS INVENTORY";
               break;
           case 'dye':
               return "DYE";
               break;
           case 'gc':
               return "GC";
               break;
           case 'fc':
               return "FC";
               break;
           case 'spec':
               return "SPEC";
               break;
           case 'gshort':
               return "GSHORT";
               break;
           case 'ytdd':
               return "YTDD";
               break;
           case 'ytdy':
               return "YTDY";
               break;
           case 'mtdd':
               return "MTDD";
               break;
           case 'mtdy':
               return "MTDY";
               break;
           case 'histy':
               return "HISTY";
               break;
           case 'histd':
               return "HISTD";
               break;
           case 'update':
               return "UPDATE";
               break;
           case 'avprice':
               return "AVPRICE";
               break;
           case 'lastyry':
               return "LASTYRY";
               break;
           case 'lastyrd':
               return "LASTYRD";
               break;
           case 'dyeleft':
               return "DYELEFT";
               break;
           case 'ozsquare':
               return "OZ PER SQUARE";
               break;
           case 'ozlin':
               return "OZ PER LIN YARD";
               break;
           case 'sqlb':
               return "SQ YARDS PER LB";
               break;
           case 'cpi':
               return "CPI";
               break;
           case 'wpi':
               return "WPI";
               break;
           case 'finwt':
               return "LIN YARDS PER LB";
               break;
           case 'meterkilo':
               return "METERS PER KILO";
               break;
           case 'meter2kilo':
               return "SQ METERS PER KILO";
               break;
           case 'grammeter':
               return "GRAMS PER METER";
               break;
           case 'grammeter2':
               return "GRAMS PER SQ METER";
               break;
           case 'stdputup':
               return "STDPUTUP";
               break;
           case 'stdtube':
               return "STDTUBE";
               break;
           case 'date1':
               return "DATE1";
               break;
           case 'date2':
               return "DATE2";
               break;
           case 'date3':
               return "DATE3";
               break;
           case 'date4':
               return "DATE4";
               break;
           case 'date5':
               return "DATE5";
               break;
           case 'date6':
               return "DATE6";
               break;
           case 'name1':
               return "NAME1";
               break;
           case 'name2':
               return "NAME2";
               break;
           case 'name3':
               return "NAME3";
               break;
           case 'name4':
               return "NAME4";
               break;
           case 'name5':
               return "NAME5";
               break;
           case 'name6':
               return "NAME6";
               break;
           case 'method1':
               return "METHOD1";
               break;
           case 'method2':
               return "METHOD2";
               break;
           case 'method3':
               return "METHOD3";
               break;
           case 'method4':
               return "METHOD4";
               break;
           case 'method5':
               return "METHOD5";
               break;
           case 'method6':
               return "METHOD6";
               break;
           case 'test1':
               return "TEST1";
               break;
           case 'test2':
               return "TEST2";
               break;
           case 'test3':
               return "TEST3";
               break;
           case 'test4':
               return "TEST4";
               break;
           case 'lot1':
               return "LOT1";
               break;
           case 'lot2':
               return "LOT2";
               break;
           case 'lot3':
               return "LOT3";
               break;
           case 'lot4':
               return "LOT4";
               break;
           case 'lot5':
               return "LOT5";
               break;
           case 'lot6':
               return "LOT6";
               break;
           case 'result1':
               return "RESULT1";
               break;
           case 'result2':
               return "RESULT2";
               break;
           case 'result3':
               return "RESULT3";
               break;
           case 'result4':
               return "RESULT4";
               break;
           case 'result5':
               return "RESULT5";
               break;
           case 'result6':
               return "RESULT6";
               break;
           case 'sname1':
               return "SNAME1";
               break;
           case 'sname2':
               return "SNAME2";
               break;
           case 'sname3':
               return "SNAME3";
               break;
           case 'smethod1':
               return "SMETHOD1";
               break;
           case 'smethod2':
               return "SMETHOD2";
               break;
           case 'smethod3':
               return "SMETHOD3";
               break;
           case 'sstd1':
               return "SSTD1";
               break;
           case 'sstd2':
               return "SSTD2";
               break;
           case 'sstd3':
               return "SSTD3";
               break;
           case 'stol1':
               return "STOL1";
               break;
           case 'stol2':
               return "STOL2";
               break;
           case 'stol3':
               return "STOL3";
               break;
           case 'conv2':
               return "CONV2";
               break;
           case 'conv3':
               return "CONV3";
               break;
           case 'conv':
               return "CONV";
               break;
           case 'stdcost':
               return "STDCOST";
               break;
           case 'stdgp':
               return "STDGP";
               break;
           case 'sprice':
               return "SPRICE";
               break;
           case 'avcost':
               return "AVCOST";
               break;
           case 'stdcosting':
               return "Standard Costing";
               break;
           case 'machine':
               return "MACHINE";
               break;
           case 'cgs':
               return "CGS";
               break;
           case 'gs':
               return "ORIGINAL GREIGE STYLE";
               break;
           case 'k':
               return "ORIGINAL KNITTER";
               break;
           case 'grstyle':
               return "Greige Construction";
               break;
           case 'lbbo':
               return "LBBO";
               break;
           case 'bo':
               return "BO";
               break;
           case 'samples':
               return "SAMPLES";
               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 || 'image' == $filtro)
        $this->ValidateField_image($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'style' == $filtro)
        $this->ValidateField_style($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'name' == $filtro)
        $this->ValidateField_name($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'width' == $filtro)
        $this->ValidateField_width($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'comment' == $filtro)
        $this->ValidateField_comment($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'fiber' == $filtro)
        $this->ValidateField_fiber($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'desc' == $filtro)
        $this->ValidateField_desc($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'line' == $filtro)
        $this->ValidateField_line($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'dept' == $filtro)
        $this->ValidateField_dept($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'odesc' == $filtro)
        $this->ValidateField_odesc($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'hand' == $filtro)
        $this->ValidateField_hand($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'date' == $filtro)
        $this->ValidateField_date($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'mindye' == $filtro)
        $this->ValidateField_mindye($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'minord' == $filtro)
        $this->ValidateField_minord($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'yarn1' == $filtro)
        $this->ValidateField_yarn1($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'per1' == $filtro)
        $this->ValidateField_per1($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'yarn2' == $filtro)
        $this->ValidateField_yarn2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'per2' == $filtro)
        $this->ValidateField_per2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'yarn3' == $filtro)
        $this->ValidateField_yarn3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'per3' == $filtro)
        $this->ValidateField_per3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'yarn4' == $filtro)
        $this->ValidateField_yarn4($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'per4' == $filtro)
        $this->ValidateField_per4($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'del1' == $filtro)
        $this->ValidateField_del1($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'del2' == $filtro)
        $this->ValidateField_del2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'del3' == $filtro)
        $this->ValidateField_del3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'end1' == $filtro)
        $this->ValidateField_end1($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'end2' == $filtro)
        $this->ValidateField_end2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'end3' == $filtro)
        $this->ValidateField_end3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'end4' == $filtro)
        $this->ValidateField_end4($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'end5' == $filtro)
        $this->ValidateField_end5($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'price' == $filtro)
        $this->ValidateField_price($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'med' == $filtro)
        $this->ValidateField_med($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'dark' == $filtro)
        $this->ValidateField_dark($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'nprice' == $filtro)
        $this->ValidateField_nprice($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'npdate' == $filtro)
        $this->ValidateField_npdate($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'memo' == $filtro)
        $this->ValidateField_memo($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'smemo' == $filtro)
        $this->ValidateField_smemo($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'yds' == $filtro)
        $this->ValidateField_yds($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'lbs' == $filtro)
        $this->ValidateField_lbs($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'dye' == $filtro)
        $this->ValidateField_dye($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'gc' == $filtro)
        $this->ValidateField_gc($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'fc' == $filtro)
        $this->ValidateField_fc($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'spec' == $filtro)
        $this->ValidateField_spec($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'gshort' == $filtro)
        $this->ValidateField_gshort($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'ytdd' == $filtro)
        $this->ValidateField_ytdd($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'ytdy' == $filtro)
        $this->ValidateField_ytdy($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'mtdd' == $filtro)
        $this->ValidateField_mtdd($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'mtdy' == $filtro)
        $this->ValidateField_mtdy($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'histy' == $filtro)
        $this->ValidateField_histy($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'histd' == $filtro)
        $this->ValidateField_histd($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'update' == $filtro)
        $this->ValidateField_update($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'avprice' == $filtro)
        $this->ValidateField_avprice($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'lastyry' == $filtro)
        $this->ValidateField_lastyry($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'lastyrd' == $filtro)
        $this->ValidateField_lastyrd($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'dyeleft' == $filtro)
        $this->ValidateField_dyeleft($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'ozsquare' == $filtro)
        $this->ValidateField_ozsquare($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'ozlin' == $filtro)
        $this->ValidateField_ozlin($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'sqlb' == $filtro)
        $this->ValidateField_sqlb($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 || 'finwt' == $filtro)
        $this->ValidateField_finwt($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'meterkilo' == $filtro)
        $this->ValidateField_meterkilo($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'meter2kilo' == $filtro)
        $this->ValidateField_meter2kilo($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'grammeter' == $filtro)
        $this->ValidateField_grammeter($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'grammeter2' == $filtro)
        $this->ValidateField_grammeter2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'stdputup' == $filtro)
        $this->ValidateField_stdputup($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'stdtube' == $filtro)
        $this->ValidateField_stdtube($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'date1' == $filtro)
        $this->ValidateField_date1($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'date2' == $filtro)
        $this->ValidateField_date2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'date3' == $filtro)
        $this->ValidateField_date3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'date4' == $filtro)
        $this->ValidateField_date4($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'date5' == $filtro)
        $this->ValidateField_date5($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'date6' == $filtro)
        $this->ValidateField_date6($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'name1' == $filtro)
        $this->ValidateField_name1($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'name2' == $filtro)
        $this->ValidateField_name2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'name3' == $filtro)
        $this->ValidateField_name3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'name4' == $filtro)
        $this->ValidateField_name4($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'name5' == $filtro)
        $this->ValidateField_name5($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'name6' == $filtro)
        $this->ValidateField_name6($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'method1' == $filtro)
        $this->ValidateField_method1($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'method2' == $filtro)
        $this->ValidateField_method2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'method3' == $filtro)
        $this->ValidateField_method3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'method4' == $filtro)
        $this->ValidateField_method4($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'method5' == $filtro)
        $this->ValidateField_method5($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'method6' == $filtro)
        $this->ValidateField_method6($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'test1' == $filtro)
        $this->ValidateField_test1($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'test2' == $filtro)
        $this->ValidateField_test2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'test3' == $filtro)
        $this->ValidateField_test3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'test4' == $filtro)
        $this->ValidateField_test4($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'lot1' == $filtro)
        $this->ValidateField_lot1($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'lot2' == $filtro)
        $this->ValidateField_lot2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'lot3' == $filtro)
        $this->ValidateField_lot3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'lot4' == $filtro)
        $this->ValidateField_lot4($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'lot5' == $filtro)
        $this->ValidateField_lot5($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'lot6' == $filtro)
        $this->ValidateField_lot6($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'result1' == $filtro)
        $this->ValidateField_result1($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'result2' == $filtro)
        $this->ValidateField_result2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'result3' == $filtro)
        $this->ValidateField_result3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'result4' == $filtro)
        $this->ValidateField_result4($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'result5' == $filtro)
        $this->ValidateField_result5($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'result6' == $filtro)
        $this->ValidateField_result6($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'sname1' == $filtro)
        $this->ValidateField_sname1($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'sname2' == $filtro)
        $this->ValidateField_sname2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'sname3' == $filtro)
        $this->ValidateField_sname3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'smethod1' == $filtro)
        $this->ValidateField_smethod1($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'smethod2' == $filtro)
        $this->ValidateField_smethod2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'smethod3' == $filtro)
        $this->ValidateField_smethod3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'sstd1' == $filtro)
        $this->ValidateField_sstd1($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'sstd2' == $filtro)
        $this->ValidateField_sstd2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'sstd3' == $filtro)
        $this->ValidateField_sstd3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'stol1' == $filtro)
        $this->ValidateField_stol1($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'stol2' == $filtro)
        $this->ValidateField_stol2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'stol3' == $filtro)
        $this->ValidateField_stol3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'conv2' == $filtro)
        $this->ValidateField_conv2($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'conv3' == $filtro)
        $this->ValidateField_conv3($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'conv' == $filtro)
        $this->ValidateField_conv($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'stdcost' == $filtro)
        $this->ValidateField_stdcost($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'stdgp' == $filtro)
        $this->ValidateField_stdgp($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'sprice' == $filtro)
        $this->ValidateField_sprice($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'avcost' == $filtro)
        $this->ValidateField_avcost($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'stdcosting' == $filtro)
        $this->ValidateField_stdcosting($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'machine' == $filtro)
        $this->ValidateField_machine($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'cgs' == $filtro)
        $this->ValidateField_cgs($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'gs' == $filtro)
        $this->ValidateField_gs($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'k' == $filtro)
        $this->ValidateField_k($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'grstyle' == $filtro)
        $this->ValidateField_grstyle($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'lbbo' == $filtro)
        $this->ValidateField_lbbo($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'bo' == $filtro)
        $this->ValidateField_bo($Campos_Crit, $Campos_Falta, $Campos_Erros);
      if ('' == $filtro || 'samples' == $filtro)
        $this->ValidateField_samples($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_image(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (trim($this->image) != "")  
          { 
          } 
      } 
    } // ValidateField_image

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

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

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

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

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

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

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

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

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

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

    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'] . "";
              } 
          } 
          $this->field_config['date']['date_format'] = $guarda_datahora; 
       } 
    } // ValidateField_date

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    function ValidateField_npdate(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      nm_limpa_data($this->npdate, $this->field_config['npdate']['date_sep']) ; 
      $trab_dt_min = ""; 
      $trab_dt_max = ""; 
      if ($this->nmgp_opcao != "excluir") 
      { 
          $guarda_datahora = $this->field_config['npdate']['date_format']; 
          if (false !== strpos($guarda_datahora, ';')) $this->field_config['npdate']['date_format'] = substr($guarda_datahora, 0, strpos($guarda_datahora, ';'));
          $Format_Data = $this->field_config['npdate']['date_format']; 
          nm_limpa_data($Format_Data, $this->field_config['npdate']['date_sep']) ; 
          if (trim($this->npdate) != "")  
          { 
              if ($teste_validade->Data($this->npdate, $Format_Data, $trab_dt_min, $trab_dt_max) == false)  
              { 
                  $Campos_Crit .= "NPDATE; " ; 
                  if (!isset($Campos_Erros['npdate']))
                  {
                      $Campos_Erros['npdate'] = array();
                  }
                  $Campos_Erros['npdate'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['npdate']) || !is_array($this->NM_ajax_info['errList']['npdate']))
                  {
                      $this->NM_ajax_info['errList']['npdate'] = array();
                  }
                  $this->NM_ajax_info['errList']['npdate'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
          $this->field_config['npdate']['date_format'] = $guarda_datahora; 
       } 
    } // ValidateField_npdate

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    function ValidateField_update(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      nm_limpa_data($this->update, $this->field_config['update']['date_sep']) ; 
      $trab_dt_min = ""; 
      $trab_dt_max = ""; 
      if ($this->nmgp_opcao == "incluir")
      { 
          $guarda_datahora = $this->field_config['update']['date_format']; 
          if (false !== strpos($guarda_datahora, ';')) $this->field_config['update']['date_format'] = substr($guarda_datahora, 0, strpos($guarda_datahora, ';'));
          $Format_Data = $this->field_config['update']['date_format']; 
          nm_limpa_data($Format_Data, $this->field_config['update']['date_sep']) ; 
          if (trim($this->update) != "")  
          { 
              if ($teste_validade->Data($this->update, $Format_Data, $trab_dt_min, $trab_dt_max) == false)  
              { 
                  $Campos_Crit .= "UPDATE; " ; 
                  if (!isset($Campos_Erros['update']))
                  {
                      $Campos_Erros['update'] = array();
                  }
                  $Campos_Erros['update'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['update']) || !is_array($this->NM_ajax_info['errList']['update']))
                  {
                      $this->NM_ajax_info['errList']['update'] = array();
                  }
                  $this->NM_ajax_info['errList']['update'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
          $this->field_config['update']['date_format'] = $guarda_datahora; 
       } 
    } // ValidateField_update

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

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

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

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

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

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

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

    function ValidateField_cpi(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->cpi) > 8) 
          { 
              $Campos_Crit .= "CPI " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $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'] . " 8 " . $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'] . " 8 " . $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) > 8) 
          { 
              $Campos_Crit .= "WPI " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 8 " . $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'] . " 8 " . $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'] . " 8 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_wpi

    function ValidateField_finwt(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->finwt) > 9) 
          { 
              $Campos_Crit .= "LIN YARDS PER LB " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 9 " . $this->Ini->Nm_lang['lang_errm_nchr']; 
              if (!isset($Campos_Erros['finwt']))
              {
                  $Campos_Erros['finwt'] = array();
              }
              $Campos_Erros['finwt'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 9 " . $this->Ini->Nm_lang['lang_errm_nchr'];
              if (!isset($this->NM_ajax_info['errList']['finwt']) || !is_array($this->NM_ajax_info['errList']['finwt']))
              {
                  $this->NM_ajax_info['errList']['finwt'] = array();
              }
              $this->NM_ajax_info['errList']['finwt'][] = $this->Ini->Nm_lang['lang_errm_mxch'] . " 9 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_finwt

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

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

    function ValidateField_grammeter(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->grammeter == "")  
      { 
          $this->grammeter = 0;
          $this->sc_force_zero[] = 'grammeter';
      } 
      if (!empty($this->field_config['grammeter']['symbol_dec']))
      {
          $this->sc_remove_currency($this->grammeter, $this->field_config['grammeter']['symbol_dec'], $this->field_config['grammeter']['symbol_grp'], $this->field_config['grammeter']['symbol_mon']); 
          nm_limpa_valor($this->grammeter, $this->field_config['grammeter']['symbol_dec'], $this->field_config['grammeter']['symbol_grp']) ; 
          if ('.' == substr($this->grammeter, 0, 1))
          {
              if ('' == str_replace('0', '', substr($this->grammeter, 1)))
              {
                  $this->grammeter = '';
              }
              else
              {
                  $this->grammeter = '0' . $this->grammeter;
              }
          }
      }
      if ($this->nmgp_opcao == "incluir")
      { 
          if ($this->grammeter != '')  
          { 
              $iTestSize = 8;
              if (strlen($this->grammeter) > $iTestSize)  
              { 
                  $Campos_Crit .= "GRAMS PER METER: " . $this->Ini->Nm_lang['lang_errm_size']; 
                  if (!isset($Campos_Erros['grammeter']))
                  {
                      $Campos_Erros['grammeter'] = array();
                  }
                  $Campos_Erros['grammeter'][] = $this->Ini->Nm_lang['lang_errm_size'];
                  if (!isset($this->NM_ajax_info['errList']['grammeter']) || !is_array($this->NM_ajax_info['errList']['grammeter']))
                  {
                      $this->NM_ajax_info['errList']['grammeter'] = array();
                  }
                  $this->NM_ajax_info['errList']['grammeter'][] = $this->Ini->Nm_lang['lang_errm_size'];
              } 
              if ($teste_validade->Valor($this->grammeter, 6, 1, 0, 0, "N") == false)  
              { 
                  $Campos_Crit .= "GRAMS PER METER; " ; 
                  if (!isset($Campos_Erros['grammeter']))
                  {
                      $Campos_Erros['grammeter'] = array();
                  }
                  $Campos_Erros['grammeter'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['grammeter']) || !is_array($this->NM_ajax_info['errList']['grammeter']))
                  {
                      $this->NM_ajax_info['errList']['grammeter'] = array();
                  }
                  $this->NM_ajax_info['errList']['grammeter'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
      } 
    } // ValidateField_grammeter

    function ValidateField_grammeter2(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->grammeter2 == "")  
      { 
          $this->grammeter2 = 0;
          $this->sc_force_zero[] = 'grammeter2';
      } 
      if (!empty($this->field_config['grammeter2']['symbol_dec']))
      {
          $this->sc_remove_currency($this->grammeter2, $this->field_config['grammeter2']['symbol_dec'], $this->field_config['grammeter2']['symbol_grp'], $this->field_config['grammeter2']['symbol_mon']); 
          nm_limpa_valor($this->grammeter2, $this->field_config['grammeter2']['symbol_dec'], $this->field_config['grammeter2']['symbol_grp']) ; 
          if ('.' == substr($this->grammeter2, 0, 1))
          {
              if ('' == str_replace('0', '', substr($this->grammeter2, 1)))
              {
                  $this->grammeter2 = '';
              }
              else
              {
                  $this->grammeter2 = '0' . $this->grammeter2;
              }
          }
      }
      if ($this->nmgp_opcao == "incluir")
      { 
          if ($this->grammeter2 != '')  
          { 
              $iTestSize = 8;
              if (strlen($this->grammeter2) > $iTestSize)  
              { 
                  $Campos_Crit .= "GRAMS PER SQ METER: " . $this->Ini->Nm_lang['lang_errm_size']; 
                  if (!isset($Campos_Erros['grammeter2']))
                  {
                      $Campos_Erros['grammeter2'] = array();
                  }
                  $Campos_Erros['grammeter2'][] = $this->Ini->Nm_lang['lang_errm_size'];
                  if (!isset($this->NM_ajax_info['errList']['grammeter2']) || !is_array($this->NM_ajax_info['errList']['grammeter2']))
                  {
                      $this->NM_ajax_info['errList']['grammeter2'] = array();
                  }
                  $this->NM_ajax_info['errList']['grammeter2'][] = $this->Ini->Nm_lang['lang_errm_size'];
              } 
              if ($teste_validade->Valor($this->grammeter2, 6, 1, 0, 0, "N") == false)  
              { 
                  $Campos_Crit .= "GRAMS PER SQ METER; " ; 
                  if (!isset($Campos_Erros['grammeter2']))
                  {
                      $Campos_Erros['grammeter2'] = array();
                  }
                  $Campos_Erros['grammeter2'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['grammeter2']) || !is_array($this->NM_ajax_info['errList']['grammeter2']))
                  {
                      $this->NM_ajax_info['errList']['grammeter2'] = array();
                  }
                  $this->NM_ajax_info['errList']['grammeter2'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
      } 
    } // ValidateField_grammeter2

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

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

    function ValidateField_date1(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      nm_limpa_data($this->date1, $this->field_config['date1']['date_sep']) ; 
      $trab_dt_min = ""; 
      $trab_dt_max = ""; 
      if ($this->nmgp_opcao != "excluir") 
      { 
          $guarda_datahora = $this->field_config['date1']['date_format']; 
          if (false !== strpos($guarda_datahora, ';')) $this->field_config['date1']['date_format'] = substr($guarda_datahora, 0, strpos($guarda_datahora, ';'));
          $Format_Data = $this->field_config['date1']['date_format']; 
          nm_limpa_data($Format_Data, $this->field_config['date1']['date_sep']) ; 
          if (trim($this->date1) != "")  
          { 
              if ($teste_validade->Data($this->date1, $Format_Data, $trab_dt_min, $trab_dt_max) == false)  
              { 
                  $Campos_Crit .= "DATE1; " ; 
                  if (!isset($Campos_Erros['date1']))
                  {
                      $Campos_Erros['date1'] = array();
                  }
                  $Campos_Erros['date1'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['date1']) || !is_array($this->NM_ajax_info['errList']['date1']))
                  {
                      $this->NM_ajax_info['errList']['date1'] = array();
                  }
                  $this->NM_ajax_info['errList']['date1'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
          $this->field_config['date1']['date_format'] = $guarda_datahora; 
       } 
    } // ValidateField_date1

    function ValidateField_date2(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      nm_limpa_data($this->date2, $this->field_config['date2']['date_sep']) ; 
      $trab_dt_min = ""; 
      $trab_dt_max = ""; 
      if ($this->nmgp_opcao != "excluir") 
      { 
          $guarda_datahora = $this->field_config['date2']['date_format']; 
          if (false !== strpos($guarda_datahora, ';')) $this->field_config['date2']['date_format'] = substr($guarda_datahora, 0, strpos($guarda_datahora, ';'));
          $Format_Data = $this->field_config['date2']['date_format']; 
          nm_limpa_data($Format_Data, $this->field_config['date2']['date_sep']) ; 
          if (trim($this->date2) != "")  
          { 
              if ($teste_validade->Data($this->date2, $Format_Data, $trab_dt_min, $trab_dt_max) == false)  
              { 
                  $Campos_Crit .= "DATE2; " ; 
                  if (!isset($Campos_Erros['date2']))
                  {
                      $Campos_Erros['date2'] = array();
                  }
                  $Campos_Erros['date2'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['date2']) || !is_array($this->NM_ajax_info['errList']['date2']))
                  {
                      $this->NM_ajax_info['errList']['date2'] = array();
                  }
                  $this->NM_ajax_info['errList']['date2'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
          $this->field_config['date2']['date_format'] = $guarda_datahora; 
       } 
    } // ValidateField_date2

    function ValidateField_date3(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      nm_limpa_data($this->date3, $this->field_config['date3']['date_sep']) ; 
      $trab_dt_min = ""; 
      $trab_dt_max = ""; 
      if ($this->nmgp_opcao != "excluir") 
      { 
          $guarda_datahora = $this->field_config['date3']['date_format']; 
          if (false !== strpos($guarda_datahora, ';')) $this->field_config['date3']['date_format'] = substr($guarda_datahora, 0, strpos($guarda_datahora, ';'));
          $Format_Data = $this->field_config['date3']['date_format']; 
          nm_limpa_data($Format_Data, $this->field_config['date3']['date_sep']) ; 
          if (trim($this->date3) != "")  
          { 
              if ($teste_validade->Data($this->date3, $Format_Data, $trab_dt_min, $trab_dt_max) == false)  
              { 
                  $Campos_Crit .= "DATE3; " ; 
                  if (!isset($Campos_Erros['date3']))
                  {
                      $Campos_Erros['date3'] = array();
                  }
                  $Campos_Erros['date3'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['date3']) || !is_array($this->NM_ajax_info['errList']['date3']))
                  {
                      $this->NM_ajax_info['errList']['date3'] = array();
                  }
                  $this->NM_ajax_info['errList']['date3'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
          $this->field_config['date3']['date_format'] = $guarda_datahora; 
       } 
    } // ValidateField_date3

    function ValidateField_date4(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      nm_limpa_data($this->date4, $this->field_config['date4']['date_sep']) ; 
      $trab_dt_min = ""; 
      $trab_dt_max = ""; 
      if ($this->nmgp_opcao != "excluir") 
      { 
          $guarda_datahora = $this->field_config['date4']['date_format']; 
          if (false !== strpos($guarda_datahora, ';')) $this->field_config['date4']['date_format'] = substr($guarda_datahora, 0, strpos($guarda_datahora, ';'));
          $Format_Data = $this->field_config['date4']['date_format']; 
          nm_limpa_data($Format_Data, $this->field_config['date4']['date_sep']) ; 
          if (trim($this->date4) != "")  
          { 
              if ($teste_validade->Data($this->date4, $Format_Data, $trab_dt_min, $trab_dt_max) == false)  
              { 
                  $Campos_Crit .= "DATE4; " ; 
                  if (!isset($Campos_Erros['date4']))
                  {
                      $Campos_Erros['date4'] = array();
                  }
                  $Campos_Erros['date4'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['date4']) || !is_array($this->NM_ajax_info['errList']['date4']))
                  {
                      $this->NM_ajax_info['errList']['date4'] = array();
                  }
                  $this->NM_ajax_info['errList']['date4'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
          $this->field_config['date4']['date_format'] = $guarda_datahora; 
       } 
    } // ValidateField_date4

    function ValidateField_date5(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      nm_limpa_data($this->date5, $this->field_config['date5']['date_sep']) ; 
      $trab_dt_min = ""; 
      $trab_dt_max = ""; 
      if ($this->nmgp_opcao != "excluir") 
      { 
          $guarda_datahora = $this->field_config['date5']['date_format']; 
          if (false !== strpos($guarda_datahora, ';')) $this->field_config['date5']['date_format'] = substr($guarda_datahora, 0, strpos($guarda_datahora, ';'));
          $Format_Data = $this->field_config['date5']['date_format']; 
          nm_limpa_data($Format_Data, $this->field_config['date5']['date_sep']) ; 
          if (trim($this->date5) != "")  
          { 
              if ($teste_validade->Data($this->date5, $Format_Data, $trab_dt_min, $trab_dt_max) == false)  
              { 
                  $Campos_Crit .= "DATE5; " ; 
                  if (!isset($Campos_Erros['date5']))
                  {
                      $Campos_Erros['date5'] = array();
                  }
                  $Campos_Erros['date5'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['date5']) || !is_array($this->NM_ajax_info['errList']['date5']))
                  {
                      $this->NM_ajax_info['errList']['date5'] = array();
                  }
                  $this->NM_ajax_info['errList']['date5'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
          $this->field_config['date5']['date_format'] = $guarda_datahora; 
       } 
    } // ValidateField_date5

    function ValidateField_date6(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      nm_limpa_data($this->date6, $this->field_config['date6']['date_sep']) ; 
      $trab_dt_min = ""; 
      $trab_dt_max = ""; 
      if ($this->nmgp_opcao != "excluir") 
      { 
          $guarda_datahora = $this->field_config['date6']['date_format']; 
          if (false !== strpos($guarda_datahora, ';')) $this->field_config['date6']['date_format'] = substr($guarda_datahora, 0, strpos($guarda_datahora, ';'));
          $Format_Data = $this->field_config['date6']['date_format']; 
          nm_limpa_data($Format_Data, $this->field_config['date6']['date_sep']) ; 
          if (trim($this->date6) != "")  
          { 
              if ($teste_validade->Data($this->date6, $Format_Data, $trab_dt_min, $trab_dt_max) == false)  
              { 
                  $Campos_Crit .= "DATE6; " ; 
                  if (!isset($Campos_Erros['date6']))
                  {
                      $Campos_Erros['date6'] = array();
                  }
                  $Campos_Erros['date6'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
                  if (!isset($this->NM_ajax_info['errList']['date6']) || !is_array($this->NM_ajax_info['errList']['date6']))
                  {
                      $this->NM_ajax_info['errList']['date6'] = array();
                  }
                  $this->NM_ajax_info['errList']['date6'][] = "" . $this->Ini->Nm_lang['lang_errm_ajax_data'] . "";
              } 
          } 
          $this->field_config['date6']['date_format'] = $guarda_datahora; 
       } 
    } // ValidateField_date6

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    function ValidateField_gs(&$Campos_Crit, &$Campos_Falta, &$Campos_Erros)
    {
        global $teste_validade;
      if ($this->nmgp_opcao != "excluir") 
      { 
          if (NM_utf8_strlen($this->gs) > 10) 
          { 
              $Campos_Crit .= "ORIGINAL GREIGE STYLE " . $this->Ini->Nm_lang['lang_errm_mxch'] . " 10 " . $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'] . " 10 " . $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'] . " 10 " . $this->Ini->Nm_lang['lang_errm_nchr'];
          } 
      } 
    } // ValidateField_gs

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

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

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

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

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

    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['image'] = $this->image;
    $this->nmgp_dados_form['style'] = $this->style;
    $this->nmgp_dados_form['name'] = $this->name;
    $this->nmgp_dados_form['width'] = $this->width;
    $this->nmgp_dados_form['comment'] = $this->comment;
    $this->nmgp_dados_form['fiber'] = $this->fiber;
    $this->nmgp_dados_form['desc'] = $this->desc;
    $this->nmgp_dados_form['line'] = $this->line;
    $this->nmgp_dados_form['dept'] = $this->dept;
    $this->nmgp_dados_form['odesc'] = $this->odesc;
    $this->nmgp_dados_form['hand'] = $this->hand;
    $this->nmgp_dados_form['date'] = $this->date;
    $this->nmgp_dados_form['mindye'] = $this->mindye;
    $this->nmgp_dados_form['minord'] = $this->minord;
    $this->nmgp_dados_form['yarn1'] = $this->yarn1;
    $this->nmgp_dados_form['per1'] = $this->per1;
    $this->nmgp_dados_form['yarn2'] = $this->yarn2;
    $this->nmgp_dados_form['per2'] = $this->per2;
    $this->nmgp_dados_form['yarn3'] = $this->yarn3;
    $this->nmgp_dados_form['per3'] = $this->per3;
    $this->nmgp_dados_form['yarn4'] = $this->yarn4;
    $this->nmgp_dados_form['per4'] = $this->per4;
    $this->nmgp_dados_form['del1'] = $this->del1;
    $this->nmgp_dados_form['del2'] = $this->del2;
    $this->nmgp_dados_form['del3'] = $this->del3;
    $this->nmgp_dados_form['end1'] = $this->end1;
    $this->nmgp_dados_form['end2'] = $this->end2;
    $this->nmgp_dados_form['end3'] = $this->end3;
    $this->nmgp_dados_form['end4'] = $this->end4;
    $this->nmgp_dados_form['end5'] = $this->end5;
    $this->nmgp_dados_form['price'] = $this->price;
    $this->nmgp_dados_form['med'] = $this->med;
    $this->nmgp_dados_form['dark'] = $this->dark;
    $this->nmgp_dados_form['nprice'] = $this->nprice;
    $this->nmgp_dados_form['npdate'] = $this->npdate;
    $this->nmgp_dados_form['memo'] = $this->memo;
    $this->nmgp_dados_form['smemo'] = $this->smemo;
    $this->nmgp_dados_form['yds'] = $this->yds;
    $this->nmgp_dados_form['lbs'] = $this->lbs;
    $this->nmgp_dados_form['dye'] = $this->dye;
    $this->nmgp_dados_form['gc'] = $this->gc;
    $this->nmgp_dados_form['fc'] = $this->fc;
    $this->nmgp_dados_form['spec'] = $this->spec;
    $this->nmgp_dados_form['gshort'] = $this->gshort;
    $this->nmgp_dados_form['ytdd'] = $this->ytdd;
    $this->nmgp_dados_form['ytdy'] = $this->ytdy;
    $this->nmgp_dados_form['mtdd'] = $this->mtdd;
    $this->nmgp_dados_form['mtdy'] = $this->mtdy;
    $this->nmgp_dados_form['histy'] = $this->histy;
    $this->nmgp_dados_form['histd'] = $this->histd;
    $this->nmgp_dados_form['update'] = $this->update;
    $this->nmgp_dados_form['avprice'] = $this->avprice;
    $this->nmgp_dados_form['lastyry'] = $this->lastyry;
    $this->nmgp_dados_form['lastyrd'] = $this->lastyrd;
    $this->nmgp_dados_form['dyeleft'] = $this->dyeleft;
    $this->nmgp_dados_form['ozsquare'] = $this->ozsquare;
    $this->nmgp_dados_form['ozlin'] = $this->ozlin;
    $this->nmgp_dados_form['sqlb'] = $this->sqlb;
    $this->nmgp_dados_form['cpi'] = $this->cpi;
    $this->nmgp_dados_form['wpi'] = $this->wpi;
    $this->nmgp_dados_form['finwt'] = $this->finwt;
    $this->nmgp_dados_form['meterkilo'] = $this->meterkilo;
    $this->nmgp_dados_form['meter2kilo'] = $this->meter2kilo;
    $this->nmgp_dados_form['grammeter'] = $this->grammeter;
    $this->nmgp_dados_form['grammeter2'] = $this->grammeter2;
    $this->nmgp_dados_form['stdputup'] = $this->stdputup;
    $this->nmgp_dados_form['stdtube'] = $this->stdtube;
    $this->nmgp_dados_form['date1'] = $this->date1;
    $this->nmgp_dados_form['date2'] = $this->date2;
    $this->nmgp_dados_form['date3'] = $this->date3;
    $this->nmgp_dados_form['date4'] = $this->date4;
    $this->nmgp_dados_form['date5'] = $this->date5;
    $this->nmgp_dados_form['date6'] = $this->date6;
    $this->nmgp_dados_form['name1'] = $this->name1;
    $this->nmgp_dados_form['name2'] = $this->name2;
    $this->nmgp_dados_form['name3'] = $this->name3;
    $this->nmgp_dados_form['name4'] = $this->name4;
    $this->nmgp_dados_form['name5'] = $this->name5;
    $this->nmgp_dados_form['name6'] = $this->name6;
    $this->nmgp_dados_form['method1'] = $this->method1;
    $this->nmgp_dados_form['method2'] = $this->method2;
    $this->nmgp_dados_form['method3'] = $this->method3;
    $this->nmgp_dados_form['method4'] = $this->method4;
    $this->nmgp_dados_form['method5'] = $this->method5;
    $this->nmgp_dados_form['method6'] = $this->method6;
    $this->nmgp_dados_form['test1'] = $this->test1;
    $this->nmgp_dados_form['test2'] = $this->test2;
    $this->nmgp_dados_form['test3'] = $this->test3;
    $this->nmgp_dados_form['test4'] = $this->test4;
    $this->nmgp_dados_form['lot1'] = $this->lot1;
    $this->nmgp_dados_form['lot2'] = $this->lot2;
    $this->nmgp_dados_form['lot3'] = $this->lot3;
    $this->nmgp_dados_form['lot4'] = $this->lot4;
    $this->nmgp_dados_form['lot5'] = $this->lot5;
    $this->nmgp_dados_form['lot6'] = $this->lot6;
    $this->nmgp_dados_form['result1'] = $this->result1;
    $this->nmgp_dados_form['result2'] = $this->result2;
    $this->nmgp_dados_form['result3'] = $this->result3;
    $this->nmgp_dados_form['result4'] = $this->result4;
    $this->nmgp_dados_form['result5'] = $this->result5;
    $this->nmgp_dados_form['result6'] = $this->result6;
    $this->nmgp_dados_form['sname1'] = $this->sname1;
    $this->nmgp_dados_form['sname2'] = $this->sname2;
    $this->nmgp_dados_form['sname3'] = $this->sname3;
    $this->nmgp_dados_form['smethod1'] = $this->smethod1;
    $this->nmgp_dados_form['smethod2'] = $this->smethod2;
    $this->nmgp_dados_form['smethod3'] = $this->smethod3;
    $this->nmgp_dados_form['sstd1'] = $this->sstd1;
    $this->nmgp_dados_form['sstd2'] = $this->sstd2;
    $this->nmgp_dados_form['sstd3'] = $this->sstd3;
    $this->nmgp_dados_form['stol1'] = $this->stol1;
    $this->nmgp_dados_form['stol2'] = $this->stol2;
    $this->nmgp_dados_form['stol3'] = $this->stol3;
    $this->nmgp_dados_form['conv2'] = $this->conv2;
    $this->nmgp_dados_form['conv3'] = $this->conv3;
    $this->nmgp_dados_form['conv'] = $this->conv;
    $this->nmgp_dados_form['stdcost'] = $this->stdcost;
    $this->nmgp_dados_form['stdgp'] = $this->stdgp;
    $this->nmgp_dados_form['sprice'] = $this->sprice;
    $this->nmgp_dados_form['avcost'] = $this->avcost;
    $this->nmgp_dados_form['stdcosting'] = $this->stdcosting;
    $this->nmgp_dados_form['machine'] = $this->machine;
    $this->nmgp_dados_form['cgs'] = $this->cgs;
    $this->nmgp_dados_form['gs'] = $this->gs;
    $this->nmgp_dados_form['k'] = $this->k;
    $this->nmgp_dados_form['grstyle'] = $this->grstyle;
    $this->nmgp_dados_form['lbbo'] = $this->lbbo;
    $this->nmgp_dados_form['bo'] = $this->bo;
    $this->nmgp_dados_form['samples'] = $this->samples;
    $this->nmgp_dados_form['id2'] = $this->id2;
    $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['dados_form'] = $this->nmgp_dados_form;
   }
   function nm_tira_formatacao()
   {
      global $nm_form_submit;
         $this->formatado = false;
      nm_limpa_data($this->date, $this->field_config['date']['date_sep']) ; 
      nm_limpa_numero($this->per1, $this->field_config['per1']['symbol_grp']) ; 
      nm_limpa_numero($this->per2, $this->field_config['per2']['symbol_grp']) ; 
      nm_limpa_numero($this->per3, $this->field_config['per3']['symbol_grp']) ; 
      nm_limpa_numero($this->per4, $this->field_config['per4']['symbol_grp']) ; 
      if (!empty($this->field_config['nprice']['symbol_dec']))
      {
         $this->sc_remove_currency($this->nprice, $this->field_config['nprice']['symbol_dec'], $this->field_config['nprice']['symbol_grp'], $this->field_config['nprice']['symbol_mon']);
         nm_limpa_valor($this->nprice, $this->field_config['nprice']['symbol_dec'], $this->field_config['nprice']['symbol_grp']);
      }
      nm_limpa_data($this->npdate, $this->field_config['npdate']['date_sep']) ; 
      nm_limpa_numero($this->yds, $this->field_config['yds']['symbol_grp']) ; 
      nm_limpa_numero($this->lbs, $this->field_config['lbs']['symbol_grp']) ; 
      nm_limpa_numero($this->dye, $this->field_config['dye']['symbol_grp']) ; 
      if (!empty($this->field_config['gc']['symbol_dec']))
      {
         $this->sc_remove_currency($this->gc, $this->field_config['gc']['symbol_dec'], $this->field_config['gc']['symbol_grp'], $this->field_config['gc']['symbol_mon']);
         nm_limpa_valor($this->gc, $this->field_config['gc']['symbol_dec'], $this->field_config['gc']['symbol_grp']);
      }
      if (!empty($this->field_config['fc']['symbol_dec']))
      {
         $this->sc_remove_currency($this->fc, $this->field_config['fc']['symbol_dec'], $this->field_config['fc']['symbol_grp'], $this->field_config['fc']['symbol_mon']);
         nm_limpa_valor($this->fc, $this->field_config['fc']['symbol_dec'], $this->field_config['fc']['symbol_grp']);
      }
      nm_limpa_numero($this->gshort, $this->field_config['gshort']['symbol_grp']) ; 
      if (!empty($this->field_config['ytdd']['symbol_dec']))
      {
         $this->sc_remove_currency($this->ytdd, $this->field_config['ytdd']['symbol_dec'], $this->field_config['ytdd']['symbol_grp'], $this->field_config['ytdd']['symbol_mon']);
         nm_limpa_valor($this->ytdd, $this->field_config['ytdd']['symbol_dec'], $this->field_config['ytdd']['symbol_grp']);
      }
      if (!empty($this->field_config['ytdy']['symbol_dec']))
      {
         $this->sc_remove_currency($this->ytdy, $this->field_config['ytdy']['symbol_dec'], $this->field_config['ytdy']['symbol_grp'], $this->field_config['ytdy']['symbol_mon']);
         nm_limpa_valor($this->ytdy, $this->field_config['ytdy']['symbol_dec'], $this->field_config['ytdy']['symbol_grp']);
      }
      if (!empty($this->field_config['mtdd']['symbol_dec']))
      {
         $this->sc_remove_currency($this->mtdd, $this->field_config['mtdd']['symbol_dec'], $this->field_config['mtdd']['symbol_grp'], $this->field_config['mtdd']['symbol_mon']);
         nm_limpa_valor($this->mtdd, $this->field_config['mtdd']['symbol_dec'], $this->field_config['mtdd']['symbol_grp']);
      }
      if (!empty($this->field_config['mtdy']['symbol_dec']))
      {
         $this->sc_remove_currency($this->mtdy, $this->field_config['mtdy']['symbol_dec'], $this->field_config['mtdy']['symbol_grp'], $this->field_config['mtdy']['symbol_mon']);
         nm_limpa_valor($this->mtdy, $this->field_config['mtdy']['symbol_dec'], $this->field_config['mtdy']['symbol_grp']);
      }
      if (!empty($this->field_config['histy']['symbol_dec']))
      {
         $this->sc_remove_currency($this->histy, $this->field_config['histy']['symbol_dec'], $this->field_config['histy']['symbol_grp'], $this->field_config['histy']['symbol_mon']);
         nm_limpa_valor($this->histy, $this->field_config['histy']['symbol_dec'], $this->field_config['histy']['symbol_grp']);
      }
      if (!empty($this->field_config['histd']['symbol_dec']))
      {
         $this->sc_remove_currency($this->histd, $this->field_config['histd']['symbol_dec'], $this->field_config['histd']['symbol_grp'], $this->field_config['histd']['symbol_mon']);
         nm_limpa_valor($this->histd, $this->field_config['histd']['symbol_dec'], $this->field_config['histd']['symbol_grp']);
      }
      nm_limpa_data($this->update, $this->field_config['update']['date_sep']) ; 
      if (!empty($this->field_config['avprice']['symbol_dec']))
      {
         $this->sc_remove_currency($this->avprice, $this->field_config['avprice']['symbol_dec'], $this->field_config['avprice']['symbol_grp'], $this->field_config['avprice']['symbol_mon']);
         nm_limpa_valor($this->avprice, $this->field_config['avprice']['symbol_dec'], $this->field_config['avprice']['symbol_grp']);
      }
      if (!empty($this->field_config['lastyry']['symbol_dec']))
      {
         $this->sc_remove_currency($this->lastyry, $this->field_config['lastyry']['symbol_dec'], $this->field_config['lastyry']['symbol_grp'], $this->field_config['lastyry']['symbol_mon']);
         nm_limpa_valor($this->lastyry, $this->field_config['lastyry']['symbol_dec'], $this->field_config['lastyry']['symbol_grp']);
      }
      if (!empty($this->field_config['lastyrd']['symbol_dec']))
      {
         $this->sc_remove_currency($this->lastyrd, $this->field_config['lastyrd']['symbol_dec'], $this->field_config['lastyrd']['symbol_grp'], $this->field_config['lastyrd']['symbol_mon']);
         nm_limpa_valor($this->lastyrd, $this->field_config['lastyrd']['symbol_dec'], $this->field_config['lastyrd']['symbol_grp']);
      }
      nm_limpa_numero($this->dyeleft, $this->field_config['dyeleft']['symbol_grp']) ; 
      if (!empty($this->field_config['ozsquare']['symbol_dec']))
      {
         $this->sc_remove_currency($this->ozsquare, $this->field_config['ozsquare']['symbol_dec'], $this->field_config['ozsquare']['symbol_grp'], $this->field_config['ozsquare']['symbol_mon']);
         nm_limpa_valor($this->ozsquare, $this->field_config['ozsquare']['symbol_dec'], $this->field_config['ozsquare']['symbol_grp']);
      }
      if (!empty($this->field_config['ozlin']['symbol_dec']))
      {
         $this->sc_remove_currency($this->ozlin, $this->field_config['ozlin']['symbol_dec'], $this->field_config['ozlin']['symbol_grp'], $this->field_config['ozlin']['symbol_mon']);
         nm_limpa_valor($this->ozlin, $this->field_config['ozlin']['symbol_dec'], $this->field_config['ozlin']['symbol_grp']);
      }
      if (!empty($this->field_config['sqlb']['symbol_dec']))
      {
         $this->sc_remove_currency($this->sqlb, $this->field_config['sqlb']['symbol_dec'], $this->field_config['sqlb']['symbol_grp'], $this->field_config['sqlb']['symbol_mon']);
         nm_limpa_valor($this->sqlb, $this->field_config['sqlb']['symbol_dec'], $this->field_config['sqlb']['symbol_grp']);
      }
      if (!empty($this->field_config['meterkilo']['symbol_dec']))
      {
         $this->sc_remove_currency($this->meterkilo, $this->field_config['meterkilo']['symbol_dec'], $this->field_config['meterkilo']['symbol_grp'], $this->field_config['meterkilo']['symbol_mon']);
         nm_limpa_valor($this->meterkilo, $this->field_config['meterkilo']['symbol_dec'], $this->field_config['meterkilo']['symbol_grp']);
      }
      if (!empty($this->field_config['meter2kilo']['symbol_dec']))
      {
         $this->sc_remove_currency($this->meter2kilo, $this->field_config['meter2kilo']['symbol_dec'], $this->field_config['meter2kilo']['symbol_grp'], $this->field_config['meter2kilo']['symbol_mon']);
         nm_limpa_valor($this->meter2kilo, $this->field_config['meter2kilo']['symbol_dec'], $this->field_config['meter2kilo']['symbol_grp']);
      }
      if (!empty($this->field_config['grammeter']['symbol_dec']))
      {
         $this->sc_remove_currency($this->grammeter, $this->field_config['grammeter']['symbol_dec'], $this->field_config['grammeter']['symbol_grp'], $this->field_config['grammeter']['symbol_mon']);
         nm_limpa_valor($this->grammeter, $this->field_config['grammeter']['symbol_dec'], $this->field_config['grammeter']['symbol_grp']);
      }
      if (!empty($this->field_config['grammeter2']['symbol_dec']))
      {
         $this->sc_remove_currency($this->grammeter2, $this->field_config['grammeter2']['symbol_dec'], $this->field_config['grammeter2']['symbol_grp'], $this->field_config['grammeter2']['symbol_mon']);
         nm_limpa_valor($this->grammeter2, $this->field_config['grammeter2']['symbol_dec'], $this->field_config['grammeter2']['symbol_grp']);
      }
      nm_limpa_data($this->date1, $this->field_config['date1']['date_sep']) ; 
      nm_limpa_data($this->date2, $this->field_config['date2']['date_sep']) ; 
      nm_limpa_data($this->date3, $this->field_config['date3']['date_sep']) ; 
      nm_limpa_data($this->date4, $this->field_config['date4']['date_sep']) ; 
      nm_limpa_data($this->date5, $this->field_config['date5']['date_sep']) ; 
      nm_limpa_data($this->date6, $this->field_config['date6']['date_sep']) ; 
      if (!empty($this->field_config['conv2']['symbol_dec']))
      {
         $this->sc_remove_currency($this->conv2, $this->field_config['conv2']['symbol_dec'], $this->field_config['conv2']['symbol_grp'], $this->field_config['conv2']['symbol_mon']);
         nm_limpa_valor($this->conv2, $this->field_config['conv2']['symbol_dec'], $this->field_config['conv2']['symbol_grp']);
      }
      if (!empty($this->field_config['conv3']['symbol_dec']))
      {
         $this->sc_remove_currency($this->conv3, $this->field_config['conv3']['symbol_dec'], $this->field_config['conv3']['symbol_grp'], $this->field_config['conv3']['symbol_mon']);
         nm_limpa_valor($this->conv3, $this->field_config['conv3']['symbol_dec'], $this->field_config['conv3']['symbol_grp']);
      }
      if (!empty($this->field_config['conv']['symbol_dec']))
      {
         $this->sc_remove_currency($this->conv, $this->field_config['conv']['symbol_dec'], $this->field_config['conv']['symbol_grp'], $this->field_config['conv']['symbol_mon']);
         nm_limpa_valor($this->conv, $this->field_config['conv']['symbol_dec'], $this->field_config['conv']['symbol_grp']);
      }
      if (!empty($this->field_config['stdcost']['symbol_dec']))
      {
         $this->sc_remove_currency($this->stdcost, $this->field_config['stdcost']['symbol_dec'], $this->field_config['stdcost']['symbol_grp'], $this->field_config['stdcost']['symbol_mon']);
         nm_limpa_valor($this->stdcost, $this->field_config['stdcost']['symbol_dec'], $this->field_config['stdcost']['symbol_grp']);
      }
      if (!empty($this->field_config['stdgp']['symbol_dec']))
      {
         $this->sc_remove_currency($this->stdgp, $this->field_config['stdgp']['symbol_dec'], $this->field_config['stdgp']['symbol_grp'], $this->field_config['stdgp']['symbol_mon']);
         nm_limpa_valor($this->stdgp, $this->field_config['stdgp']['symbol_dec'], $this->field_config['stdgp']['symbol_grp']);
      }
      if (!empty($this->field_config['sprice']['symbol_dec']))
      {
         $this->sc_remove_currency($this->sprice, $this->field_config['sprice']['symbol_dec'], $this->field_config['sprice']['symbol_grp'], $this->field_config['sprice']['symbol_mon']);
         nm_limpa_valor($this->sprice, $this->field_config['sprice']['symbol_dec'], $this->field_config['sprice']['symbol_grp']);
      }
      if (!empty($this->field_config['avcost']['symbol_dec']))
      {
         $this->sc_remove_currency($this->avcost, $this->field_config['avcost']['symbol_dec'], $this->field_config['avcost']['symbol_grp'], $this->field_config['avcost']['symbol_mon']);
         nm_limpa_valor($this->avcost, $this->field_config['avcost']['symbol_dec'], $this->field_config['avcost']['symbol_grp']);
      }
      nm_limpa_numero($this->lbbo, $this->field_config['lbbo']['symbol_grp']) ; 
      nm_limpa_numero($this->bo, $this->field_config['bo']['symbol_grp']) ; 
      nm_limpa_numero($this->samples, $this->field_config['samples']['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 == "per1")
      {
          nm_limpa_numero($this->per1, $this->field_config['per1']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "per2")
      {
          nm_limpa_numero($this->per2, $this->field_config['per2']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "per3")
      {
          nm_limpa_numero($this->per3, $this->field_config['per3']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "per4")
      {
          nm_limpa_numero($this->per4, $this->field_config['per4']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "nprice")
      {
          if (!empty($this->field_config['nprice']['symbol_dec']))
          {
             $this->sc_remove_currency($this->nprice, $this->field_config['nprice']['symbol_dec'], $this->field_config['nprice']['symbol_grp'], $this->field_config['nprice']['symbol_mon']);
             nm_limpa_valor($this->nprice, $this->field_config['nprice']['symbol_dec'], $this->field_config['nprice']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "yds")
      {
          nm_limpa_numero($this->yds, $this->field_config['yds']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "lbs")
      {
          nm_limpa_numero($this->lbs, $this->field_config['lbs']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "dye")
      {
          nm_limpa_numero($this->dye, $this->field_config['dye']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "gc")
      {
          if (!empty($this->field_config['gc']['symbol_dec']))
          {
             $this->sc_remove_currency($this->gc, $this->field_config['gc']['symbol_dec'], $this->field_config['gc']['symbol_grp'], $this->field_config['gc']['symbol_mon']);
             nm_limpa_valor($this->gc, $this->field_config['gc']['symbol_dec'], $this->field_config['gc']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "fc")
      {
          if (!empty($this->field_config['fc']['symbol_dec']))
          {
             $this->sc_remove_currency($this->fc, $this->field_config['fc']['symbol_dec'], $this->field_config['fc']['symbol_grp'], $this->field_config['fc']['symbol_mon']);
             nm_limpa_valor($this->fc, $this->field_config['fc']['symbol_dec'], $this->field_config['fc']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "gshort")
      {
          nm_limpa_numero($this->gshort, $this->field_config['gshort']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "ytdd")
      {
          if (!empty($this->field_config['ytdd']['symbol_dec']))
          {
             $this->sc_remove_currency($this->ytdd, $this->field_config['ytdd']['symbol_dec'], $this->field_config['ytdd']['symbol_grp'], $this->field_config['ytdd']['symbol_mon']);
             nm_limpa_valor($this->ytdd, $this->field_config['ytdd']['symbol_dec'], $this->field_config['ytdd']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "ytdy")
      {
          if (!empty($this->field_config['ytdy']['symbol_dec']))
          {
             $this->sc_remove_currency($this->ytdy, $this->field_config['ytdy']['symbol_dec'], $this->field_config['ytdy']['symbol_grp'], $this->field_config['ytdy']['symbol_mon']);
             nm_limpa_valor($this->ytdy, $this->field_config['ytdy']['symbol_dec'], $this->field_config['ytdy']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "mtdd")
      {
          if (!empty($this->field_config['mtdd']['symbol_dec']))
          {
             $this->sc_remove_currency($this->mtdd, $this->field_config['mtdd']['symbol_dec'], $this->field_config['mtdd']['symbol_grp'], $this->field_config['mtdd']['symbol_mon']);
             nm_limpa_valor($this->mtdd, $this->field_config['mtdd']['symbol_dec'], $this->field_config['mtdd']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "mtdy")
      {
          if (!empty($this->field_config['mtdy']['symbol_dec']))
          {
             $this->sc_remove_currency($this->mtdy, $this->field_config['mtdy']['symbol_dec'], $this->field_config['mtdy']['symbol_grp'], $this->field_config['mtdy']['symbol_mon']);
             nm_limpa_valor($this->mtdy, $this->field_config['mtdy']['symbol_dec'], $this->field_config['mtdy']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "histy")
      {
          if (!empty($this->field_config['histy']['symbol_dec']))
          {
             $this->sc_remove_currency($this->histy, $this->field_config['histy']['symbol_dec'], $this->field_config['histy']['symbol_grp'], $this->field_config['histy']['symbol_mon']);
             nm_limpa_valor($this->histy, $this->field_config['histy']['symbol_dec'], $this->field_config['histy']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "histd")
      {
          if (!empty($this->field_config['histd']['symbol_dec']))
          {
             $this->sc_remove_currency($this->histd, $this->field_config['histd']['symbol_dec'], $this->field_config['histd']['symbol_grp'], $this->field_config['histd']['symbol_mon']);
             nm_limpa_valor($this->histd, $this->field_config['histd']['symbol_dec'], $this->field_config['histd']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "avprice")
      {
          if (!empty($this->field_config['avprice']['symbol_dec']))
          {
             $this->sc_remove_currency($this->avprice, $this->field_config['avprice']['symbol_dec'], $this->field_config['avprice']['symbol_grp'], $this->field_config['avprice']['symbol_mon']);
             nm_limpa_valor($this->avprice, $this->field_config['avprice']['symbol_dec'], $this->field_config['avprice']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "lastyry")
      {
          if (!empty($this->field_config['lastyry']['symbol_dec']))
          {
             $this->sc_remove_currency($this->lastyry, $this->field_config['lastyry']['symbol_dec'], $this->field_config['lastyry']['symbol_grp'], $this->field_config['lastyry']['symbol_mon']);
             nm_limpa_valor($this->lastyry, $this->field_config['lastyry']['symbol_dec'], $this->field_config['lastyry']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "lastyrd")
      {
          if (!empty($this->field_config['lastyrd']['symbol_dec']))
          {
             $this->sc_remove_currency($this->lastyrd, $this->field_config['lastyrd']['symbol_dec'], $this->field_config['lastyrd']['symbol_grp'], $this->field_config['lastyrd']['symbol_mon']);
             nm_limpa_valor($this->lastyrd, $this->field_config['lastyrd']['symbol_dec'], $this->field_config['lastyrd']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "dyeleft")
      {
          nm_limpa_numero($this->dyeleft, $this->field_config['dyeleft']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "ozsquare")
      {
          if (!empty($this->field_config['ozsquare']['symbol_dec']))
          {
             $this->sc_remove_currency($this->ozsquare, $this->field_config['ozsquare']['symbol_dec'], $this->field_config['ozsquare']['symbol_grp'], $this->field_config['ozsquare']['symbol_mon']);
             nm_limpa_valor($this->ozsquare, $this->field_config['ozsquare']['symbol_dec'], $this->field_config['ozsquare']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "ozlin")
      {
          if (!empty($this->field_config['ozlin']['symbol_dec']))
          {
             $this->sc_remove_currency($this->ozlin, $this->field_config['ozlin']['symbol_dec'], $this->field_config['ozlin']['symbol_grp'], $this->field_config['ozlin']['symbol_mon']);
             nm_limpa_valor($this->ozlin, $this->field_config['ozlin']['symbol_dec'], $this->field_config['ozlin']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "sqlb")
      {
          if (!empty($this->field_config['sqlb']['symbol_dec']))
          {
             $this->sc_remove_currency($this->sqlb, $this->field_config['sqlb']['symbol_dec'], $this->field_config['sqlb']['symbol_grp'], $this->field_config['sqlb']['symbol_mon']);
             nm_limpa_valor($this->sqlb, $this->field_config['sqlb']['symbol_dec'], $this->field_config['sqlb']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "meterkilo")
      {
          if (!empty($this->field_config['meterkilo']['symbol_dec']))
          {
             $this->sc_remove_currency($this->meterkilo, $this->field_config['meterkilo']['symbol_dec'], $this->field_config['meterkilo']['symbol_grp'], $this->field_config['meterkilo']['symbol_mon']);
             nm_limpa_valor($this->meterkilo, $this->field_config['meterkilo']['symbol_dec'], $this->field_config['meterkilo']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "meter2kilo")
      {
          if (!empty($this->field_config['meter2kilo']['symbol_dec']))
          {
             $this->sc_remove_currency($this->meter2kilo, $this->field_config['meter2kilo']['symbol_dec'], $this->field_config['meter2kilo']['symbol_grp'], $this->field_config['meter2kilo']['symbol_mon']);
             nm_limpa_valor($this->meter2kilo, $this->field_config['meter2kilo']['symbol_dec'], $this->field_config['meter2kilo']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "grammeter")
      {
          if (!empty($this->field_config['grammeter']['symbol_dec']))
          {
             $this->sc_remove_currency($this->grammeter, $this->field_config['grammeter']['symbol_dec'], $this->field_config['grammeter']['symbol_grp'], $this->field_config['grammeter']['symbol_mon']);
             nm_limpa_valor($this->grammeter, $this->field_config['grammeter']['symbol_dec'], $this->field_config['grammeter']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "grammeter2")
      {
          if (!empty($this->field_config['grammeter2']['symbol_dec']))
          {
             $this->sc_remove_currency($this->grammeter2, $this->field_config['grammeter2']['symbol_dec'], $this->field_config['grammeter2']['symbol_grp'], $this->field_config['grammeter2']['symbol_mon']);
             nm_limpa_valor($this->grammeter2, $this->field_config['grammeter2']['symbol_dec'], $this->field_config['grammeter2']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "conv2")
      {
          if (!empty($this->field_config['conv2']['symbol_dec']))
          {
             $this->sc_remove_currency($this->conv2, $this->field_config['conv2']['symbol_dec'], $this->field_config['conv2']['symbol_grp'], $this->field_config['conv2']['symbol_mon']);
             nm_limpa_valor($this->conv2, $this->field_config['conv2']['symbol_dec'], $this->field_config['conv2']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "conv3")
      {
          if (!empty($this->field_config['conv3']['symbol_dec']))
          {
             $this->sc_remove_currency($this->conv3, $this->field_config['conv3']['symbol_dec'], $this->field_config['conv3']['symbol_grp'], $this->field_config['conv3']['symbol_mon']);
             nm_limpa_valor($this->conv3, $this->field_config['conv3']['symbol_dec'], $this->field_config['conv3']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "conv")
      {
          if (!empty($this->field_config['conv']['symbol_dec']))
          {
             $this->sc_remove_currency($this->conv, $this->field_config['conv']['symbol_dec'], $this->field_config['conv']['symbol_grp'], $this->field_config['conv']['symbol_mon']);
             nm_limpa_valor($this->conv, $this->field_config['conv']['symbol_dec'], $this->field_config['conv']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "stdcost")
      {
          if (!empty($this->field_config['stdcost']['symbol_dec']))
          {
             $this->sc_remove_currency($this->stdcost, $this->field_config['stdcost']['symbol_dec'], $this->field_config['stdcost']['symbol_grp'], $this->field_config['stdcost']['symbol_mon']);
             nm_limpa_valor($this->stdcost, $this->field_config['stdcost']['symbol_dec'], $this->field_config['stdcost']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "stdgp")
      {
          if (!empty($this->field_config['stdgp']['symbol_dec']))
          {
             $this->sc_remove_currency($this->stdgp, $this->field_config['stdgp']['symbol_dec'], $this->field_config['stdgp']['symbol_grp'], $this->field_config['stdgp']['symbol_mon']);
             nm_limpa_valor($this->stdgp, $this->field_config['stdgp']['symbol_dec'], $this->field_config['stdgp']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "sprice")
      {
          if (!empty($this->field_config['sprice']['symbol_dec']))
          {
             $this->sc_remove_currency($this->sprice, $this->field_config['sprice']['symbol_dec'], $this->field_config['sprice']['symbol_grp'], $this->field_config['sprice']['symbol_mon']);
             nm_limpa_valor($this->sprice, $this->field_config['sprice']['symbol_dec'], $this->field_config['sprice']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "avcost")
      {
          if (!empty($this->field_config['avcost']['symbol_dec']))
          {
             $this->sc_remove_currency($this->avcost, $this->field_config['avcost']['symbol_dec'], $this->field_config['avcost']['symbol_grp'], $this->field_config['avcost']['symbol_mon']);
             nm_limpa_valor($this->avcost, $this->field_config['avcost']['symbol_dec'], $this->field_config['avcost']['symbol_grp']);
          }
      }
      if ($Nome_Campo == "lbbo")
      {
          nm_limpa_numero($this->lbbo, $this->field_config['lbbo']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "bo")
      {
          nm_limpa_numero($this->bo, $this->field_config['bo']['symbol_grp']) ; 
      }
      if ($Nome_Campo == "samples")
      {
          nm_limpa_numero($this->samples, $this->field_config['samples']['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->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->per1) || (!empty($format_fields) && isset($format_fields['per1'])))
      {
          nmgp_Form_Num_Val($this->per1, $this->field_config['per1']['symbol_grp'], $this->field_config['per1']['symbol_dec'], "0", "S", "", "", "", "-", $this->field_config['per1']['symbol_fmt']) ; 
      }
      if (!empty($this->per2) || (!empty($format_fields) && isset($format_fields['per2'])))
      {
          nmgp_Form_Num_Val($this->per2, $this->field_config['per2']['symbol_grp'], $this->field_config['per2']['symbol_dec'], "0", "S", "", "", "", "-", $this->field_config['per2']['symbol_fmt']) ; 
      }
      if (!empty($this->per3) || (!empty($format_fields) && isset($format_fields['per3'])))
      {
          nmgp_Form_Num_Val($this->per3, $this->field_config['per3']['symbol_grp'], $this->field_config['per3']['symbol_dec'], "0", "S", "", "", "", "-", $this->field_config['per3']['symbol_fmt']) ; 
      }
      if (!empty($this->per4) || (!empty($format_fields) && isset($format_fields['per4'])))
      {
          nmgp_Form_Num_Val($this->per4, $this->field_config['per4']['symbol_grp'], $this->field_config['per4']['symbol_dec'], "0", "S", "", "", "", "-", $this->field_config['per4']['symbol_fmt']) ; 
      }
      if (!empty($this->nprice) || (!empty($format_fields) && isset($format_fields['nprice'])))
      {
          nmgp_Form_Num_Val($this->nprice, $this->field_config['nprice']['symbol_grp'], $this->field_config['nprice']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['nprice']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['nprice']['symbol_mon'];
          $this->sc_add_currency($this->nprice, $sMonSymb, $this->field_config['nprice']['format_pos']); 
      }
      if ((!empty($this->npdate) && 'null' != $this->npdate) || (!empty($format_fields) && isset($format_fields['npdate'])))
      {
          nm_volta_data($this->npdate, $this->field_config['npdate']['date_format']) ; 
          nmgp_Form_Datas($this->npdate, $this->field_config['npdate']['date_format'], $this->field_config['npdate']['date_sep']) ;  
      }
      elseif ('null' == $this->npdate || '' == $this->npdate)
      {
          $this->npdate = '';
      }
      if (!empty($this->yds) || (!empty($format_fields) && isset($format_fields['yds'])))
      {
          nmgp_Form_Num_Val($this->yds, $this->field_config['yds']['symbol_grp'], $this->field_config['yds']['symbol_dec'], "0", "S", "", "", "", "-", $this->field_config['yds']['symbol_fmt']) ; 
      }
      if (!empty($this->lbs) || (!empty($format_fields) && isset($format_fields['lbs'])))
      {
          nmgp_Form_Num_Val($this->lbs, $this->field_config['lbs']['symbol_grp'], $this->field_config['lbs']['symbol_dec'], "0", "S", "", "", "", "-", $this->field_config['lbs']['symbol_fmt']) ; 
      }
      if (!empty($this->dye) || (!empty($format_fields) && isset($format_fields['dye'])))
      {
          nmgp_Form_Num_Val($this->dye, $this->field_config['dye']['symbol_grp'], $this->field_config['dye']['symbol_dec'], "0", "S", "", "", "", "-", $this->field_config['dye']['symbol_fmt']) ; 
      }
      if (!empty($this->gc) || (!empty($format_fields) && isset($format_fields['gc'])))
      {
          nmgp_Form_Num_Val($this->gc, $this->field_config['gc']['symbol_grp'], $this->field_config['gc']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['gc']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['gc']['symbol_mon'];
          $this->sc_add_currency($this->gc, $sMonSymb, $this->field_config['gc']['format_pos']); 
      }
      if (!empty($this->fc) || (!empty($format_fields) && isset($format_fields['fc'])))
      {
          nmgp_Form_Num_Val($this->fc, $this->field_config['fc']['symbol_grp'], $this->field_config['fc']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['fc']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['fc']['symbol_mon'];
          $this->sc_add_currency($this->fc, $sMonSymb, $this->field_config['fc']['format_pos']); 
      }
      if (!empty($this->gshort) || (!empty($format_fields) && isset($format_fields['gshort'])))
      {
          nmgp_Form_Num_Val($this->gshort, $this->field_config['gshort']['symbol_grp'], $this->field_config['gshort']['symbol_dec'], "0", "S", "", "", "", "-", $this->field_config['gshort']['symbol_fmt']) ; 
      }
      if (!empty($this->ytdd) || (!empty($format_fields) && isset($format_fields['ytdd'])))
      {
          nmgp_Form_Num_Val($this->ytdd, $this->field_config['ytdd']['symbol_grp'], $this->field_config['ytdd']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['ytdd']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['ytdd']['symbol_mon'];
          $this->sc_add_currency($this->ytdd, $sMonSymb, $this->field_config['ytdd']['format_pos']); 
      }
      if (!empty($this->ytdy) || (!empty($format_fields) && isset($format_fields['ytdy'])))
      {
          nmgp_Form_Num_Val($this->ytdy, $this->field_config['ytdy']['symbol_grp'], $this->field_config['ytdy']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['ytdy']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['ytdy']['symbol_mon'];
          $this->sc_add_currency($this->ytdy, $sMonSymb, $this->field_config['ytdy']['format_pos']); 
      }
      if (!empty($this->mtdd) || (!empty($format_fields) && isset($format_fields['mtdd'])))
      {
          nmgp_Form_Num_Val($this->mtdd, $this->field_config['mtdd']['symbol_grp'], $this->field_config['mtdd']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['mtdd']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['mtdd']['symbol_mon'];
          $this->sc_add_currency($this->mtdd, $sMonSymb, $this->field_config['mtdd']['format_pos']); 
      }
      if (!empty($this->mtdy) || (!empty($format_fields) && isset($format_fields['mtdy'])))
      {
          nmgp_Form_Num_Val($this->mtdy, $this->field_config['mtdy']['symbol_grp'], $this->field_config['mtdy']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['mtdy']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['mtdy']['symbol_mon'];
          $this->sc_add_currency($this->mtdy, $sMonSymb, $this->field_config['mtdy']['format_pos']); 
      }
      if (!empty($this->histy) || (!empty($format_fields) && isset($format_fields['histy'])))
      {
          nmgp_Form_Num_Val($this->histy, $this->field_config['histy']['symbol_grp'], $this->field_config['histy']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['histy']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['histy']['symbol_mon'];
          $this->sc_add_currency($this->histy, $sMonSymb, $this->field_config['histy']['format_pos']); 
      }
      if (!empty($this->histd) || (!empty($format_fields) && isset($format_fields['histd'])))
      {
          nmgp_Form_Num_Val($this->histd, $this->field_config['histd']['symbol_grp'], $this->field_config['histd']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['histd']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['histd']['symbol_mon'];
          $this->sc_add_currency($this->histd, $sMonSymb, $this->field_config['histd']['format_pos']); 
      }
      if ((!empty($this->update) && 'null' != $this->update) || (!empty($format_fields) && isset($format_fields['update'])))
      {
          nm_volta_data($this->update, $this->field_config['update']['date_format']) ; 
          nmgp_Form_Datas($this->update, $this->field_config['update']['date_format'], $this->field_config['update']['date_sep']) ;  
      }
      elseif ('null' == $this->update || '' == $this->update)
      {
          $this->update = '';
      }
      if (!empty($this->avprice) || (!empty($format_fields) && isset($format_fields['avprice'])))
      {
          nmgp_Form_Num_Val($this->avprice, $this->field_config['avprice']['symbol_grp'], $this->field_config['avprice']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['avprice']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['avprice']['symbol_mon'];
          $this->sc_add_currency($this->avprice, $sMonSymb, $this->field_config['avprice']['format_pos']); 
      }
      if (!empty($this->lastyry) || (!empty($format_fields) && isset($format_fields['lastyry'])))
      {
          nmgp_Form_Num_Val($this->lastyry, $this->field_config['lastyry']['symbol_grp'], $this->field_config['lastyry']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['lastyry']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['lastyry']['symbol_mon'];
          $this->sc_add_currency($this->lastyry, $sMonSymb, $this->field_config['lastyry']['format_pos']); 
      }
      if (!empty($this->lastyrd) || (!empty($format_fields) && isset($format_fields['lastyrd'])))
      {
          nmgp_Form_Num_Val($this->lastyrd, $this->field_config['lastyrd']['symbol_grp'], $this->field_config['lastyrd']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['lastyrd']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['lastyrd']['symbol_mon'];
          $this->sc_add_currency($this->lastyrd, $sMonSymb, $this->field_config['lastyrd']['format_pos']); 
      }
      if (!empty($this->dyeleft) || (!empty($format_fields) && isset($format_fields['dyeleft'])))
      {
          nmgp_Form_Num_Val($this->dyeleft, $this->field_config['dyeleft']['symbol_grp'], $this->field_config['dyeleft']['symbol_dec'], "0", "S", "", "", "", "-", $this->field_config['dyeleft']['symbol_fmt']) ; 
      }
      if (!empty($this->ozsquare) || (!empty($format_fields) && isset($format_fields['ozsquare'])))
      {
          nmgp_Form_Num_Val($this->ozsquare, $this->field_config['ozsquare']['symbol_grp'], $this->field_config['ozsquare']['symbol_dec'], "1", "S", "", "", "", "-", $this->field_config['ozsquare']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['ozsquare']['symbol_mon'];
          $this->sc_add_currency($this->ozsquare, $sMonSymb, $this->field_config['ozsquare']['format_pos']); 
      }
      if (!empty($this->ozlin) || (!empty($format_fields) && isset($format_fields['ozlin'])))
      {
          nmgp_Form_Num_Val($this->ozlin, $this->field_config['ozlin']['symbol_grp'], $this->field_config['ozlin']['symbol_dec'], "1", "S", "", "", "", "-", $this->field_config['ozlin']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['ozlin']['symbol_mon'];
          $this->sc_add_currency($this->ozlin, $sMonSymb, $this->field_config['ozlin']['format_pos']); 
      }
      if (!empty($this->sqlb) || (!empty($format_fields) && isset($format_fields['sqlb'])))
      {
          nmgp_Form_Num_Val($this->sqlb, $this->field_config['sqlb']['symbol_grp'], $this->field_config['sqlb']['symbol_dec'], "1", "S", "", "", "", "-", $this->field_config['sqlb']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['sqlb']['symbol_mon'];
          $this->sc_add_currency($this->sqlb, $sMonSymb, $this->field_config['sqlb']['format_pos']); 
      }
      if (!empty($this->meterkilo) || (!empty($format_fields) && isset($format_fields['meterkilo'])))
      {
          nmgp_Form_Num_Val($this->meterkilo, $this->field_config['meterkilo']['symbol_grp'], $this->field_config['meterkilo']['symbol_dec'], "1", "S", "", "", "", "-", $this->field_config['meterkilo']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['meterkilo']['symbol_mon'];
          $this->sc_add_currency($this->meterkilo, $sMonSymb, $this->field_config['meterkilo']['format_pos']); 
      }
      if (!empty($this->meter2kilo) || (!empty($format_fields) && isset($format_fields['meter2kilo'])))
      {
          nmgp_Form_Num_Val($this->meter2kilo, $this->field_config['meter2kilo']['symbol_grp'], $this->field_config['meter2kilo']['symbol_dec'], "1", "S", "", "", "", "-", $this->field_config['meter2kilo']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['meter2kilo']['symbol_mon'];
          $this->sc_add_currency($this->meter2kilo, $sMonSymb, $this->field_config['meter2kilo']['format_pos']); 
      }
      if (!empty($this->grammeter) || (!empty($format_fields) && isset($format_fields['grammeter'])))
      {
          nmgp_Form_Num_Val($this->grammeter, $this->field_config['grammeter']['symbol_grp'], $this->field_config['grammeter']['symbol_dec'], "1", "S", "", "", "", "-", $this->field_config['grammeter']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['grammeter']['symbol_mon'];
          $this->sc_add_currency($this->grammeter, $sMonSymb, $this->field_config['grammeter']['format_pos']); 
      }
      if (!empty($this->grammeter2) || (!empty($format_fields) && isset($format_fields['grammeter2'])))
      {
          nmgp_Form_Num_Val($this->grammeter2, $this->field_config['grammeter2']['symbol_grp'], $this->field_config['grammeter2']['symbol_dec'], "1", "S", "", "", "", "-", $this->field_config['grammeter2']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['grammeter2']['symbol_mon'];
          $this->sc_add_currency($this->grammeter2, $sMonSymb, $this->field_config['grammeter2']['format_pos']); 
      }
      if ((!empty($this->date1) && 'null' != $this->date1) || (!empty($format_fields) && isset($format_fields['date1'])))
      {
          nm_volta_data($this->date1, $this->field_config['date1']['date_format']) ; 
          nmgp_Form_Datas($this->date1, $this->field_config['date1']['date_format'], $this->field_config['date1']['date_sep']) ;  
      }
      elseif ('null' == $this->date1 || '' == $this->date1)
      {
          $this->date1 = '';
      }
      if ((!empty($this->date2) && 'null' != $this->date2) || (!empty($format_fields) && isset($format_fields['date2'])))
      {
          nm_volta_data($this->date2, $this->field_config['date2']['date_format']) ; 
          nmgp_Form_Datas($this->date2, $this->field_config['date2']['date_format'], $this->field_config['date2']['date_sep']) ;  
      }
      elseif ('null' == $this->date2 || '' == $this->date2)
      {
          $this->date2 = '';
      }
      if ((!empty($this->date3) && 'null' != $this->date3) || (!empty($format_fields) && isset($format_fields['date3'])))
      {
          nm_volta_data($this->date3, $this->field_config['date3']['date_format']) ; 
          nmgp_Form_Datas($this->date3, $this->field_config['date3']['date_format'], $this->field_config['date3']['date_sep']) ;  
      }
      elseif ('null' == $this->date3 || '' == $this->date3)
      {
          $this->date3 = '';
      }
      if ((!empty($this->date4) && 'null' != $this->date4) || (!empty($format_fields) && isset($format_fields['date4'])))
      {
          nm_volta_data($this->date4, $this->field_config['date4']['date_format']) ; 
          nmgp_Form_Datas($this->date4, $this->field_config['date4']['date_format'], $this->field_config['date4']['date_sep']) ;  
      }
      elseif ('null' == $this->date4 || '' == $this->date4)
      {
          $this->date4 = '';
      }
      if ((!empty($this->date5) && 'null' != $this->date5) || (!empty($format_fields) && isset($format_fields['date5'])))
      {
          nm_volta_data($this->date5, $this->field_config['date5']['date_format']) ; 
          nmgp_Form_Datas($this->date5, $this->field_config['date5']['date_format'], $this->field_config['date5']['date_sep']) ;  
      }
      elseif ('null' == $this->date5 || '' == $this->date5)
      {
          $this->date5 = '';
      }
      if ((!empty($this->date6) && 'null' != $this->date6) || (!empty($format_fields) && isset($format_fields['date6'])))
      {
          nm_volta_data($this->date6, $this->field_config['date6']['date_format']) ; 
          nmgp_Form_Datas($this->date6, $this->field_config['date6']['date_format'], $this->field_config['date6']['date_sep']) ;  
      }
      elseif ('null' == $this->date6 || '' == $this->date6)
      {
          $this->date6 = '';
      }
      if (!empty($this->conv2) || (!empty($format_fields) && isset($format_fields['conv2'])))
      {
          nmgp_Form_Num_Val($this->conv2, $this->field_config['conv2']['symbol_grp'], $this->field_config['conv2']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['conv2']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['conv2']['symbol_mon'];
          $this->sc_add_currency($this->conv2, $sMonSymb, $this->field_config['conv2']['format_pos']); 
      }
      if (!empty($this->conv3) || (!empty($format_fields) && isset($format_fields['conv3'])))
      {
          nmgp_Form_Num_Val($this->conv3, $this->field_config['conv3']['symbol_grp'], $this->field_config['conv3']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['conv3']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['conv3']['symbol_mon'];
          $this->sc_add_currency($this->conv3, $sMonSymb, $this->field_config['conv3']['format_pos']); 
      }
      if (!empty($this->conv) || (!empty($format_fields) && isset($format_fields['conv'])))
      {
          nmgp_Form_Num_Val($this->conv, $this->field_config['conv']['symbol_grp'], $this->field_config['conv']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['conv']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['conv']['symbol_mon'];
          $this->sc_add_currency($this->conv, $sMonSymb, $this->field_config['conv']['format_pos']); 
      }
      if (!empty($this->stdcost) || (!empty($format_fields) && isset($format_fields['stdcost'])))
      {
          nmgp_Form_Num_Val($this->stdcost, $this->field_config['stdcost']['symbol_grp'], $this->field_config['stdcost']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['stdcost']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['stdcost']['symbol_mon'];
          $this->sc_add_currency($this->stdcost, $sMonSymb, $this->field_config['stdcost']['format_pos']); 
      }
      if (!empty($this->stdgp) || (!empty($format_fields) && isset($format_fields['stdgp'])))
      {
          nmgp_Form_Num_Val($this->stdgp, $this->field_config['stdgp']['symbol_grp'], $this->field_config['stdgp']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['stdgp']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['stdgp']['symbol_mon'];
          $this->sc_add_currency($this->stdgp, $sMonSymb, $this->field_config['stdgp']['format_pos']); 
      }
      if (!empty($this->sprice) || (!empty($format_fields) && isset($format_fields['sprice'])))
      {
          nmgp_Form_Num_Val($this->sprice, $this->field_config['sprice']['symbol_grp'], $this->field_config['sprice']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['sprice']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['sprice']['symbol_mon'];
          $this->sc_add_currency($this->sprice, $sMonSymb, $this->field_config['sprice']['format_pos']); 
      }
      if (!empty($this->avcost) || (!empty($format_fields) && isset($format_fields['avcost'])))
      {
          nmgp_Form_Num_Val($this->avcost, $this->field_config['avcost']['symbol_grp'], $this->field_config['avcost']['symbol_dec'], "2", "S", "", "", "", "-", $this->field_config['avcost']['symbol_fmt']) ; 
          $sMonSymb = $this->field_config['avcost']['symbol_mon'];
          $this->sc_add_currency($this->avcost, $sMonSymb, $this->field_config['avcost']['format_pos']); 
      }
      if (!empty($this->lbbo) || (!empty($format_fields) && isset($format_fields['lbbo'])))
      {
          nmgp_Form_Num_Val($this->lbbo, $this->field_config['lbbo']['symbol_grp'], $this->field_config['lbbo']['symbol_dec'], "0", "S", "", "", "", "-", $this->field_config['lbbo']['symbol_fmt']) ; 
      }
      if (!empty($this->bo) || (!empty($format_fields) && isset($format_fields['bo'])))
      {
          nmgp_Form_Num_Val($this->bo, $this->field_config['bo']['symbol_grp'], $this->field_config['bo']['symbol_dec'], "0", "S", "", "", "", "-", $this->field_config['bo']['symbol_fmt']) ; 
      }
      if (!empty($this->samples) || (!empty($format_fields) && isset($format_fields['samples'])))
      {
          nmgp_Form_Num_Val($this->samples, $this->field_config['samples']['symbol_grp'], $this->field_config['samples']['symbol_dec'], "0", "S", "", "", "", "-", $this->field_config['samples']['symbol_fmt']) ; 
      }
   }
   function nm_gera_mask(&$nm_campo, $nm_mask)
   { 
      $trab_campo = $nm_campo;
      $trab_mask  = $nm_mask;
      $tam_campo  = strlen($nm_campo);
      $trab_saida = "";

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

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

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

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

                  $nm_campo = $new_campo;

          return;
      }

      $mask_num = false;
      for ($x=0; $x < strlen($trab_mask); $x++)
      {
          if (substr($trab_mask, $x, 1) == "#")
          {
              $mask_num = true;
              break;
          }
      }
      if ($mask_num )
      {
          $ver_duas = explode(";", $trab_mask);
          if (isset($ver_duas[1]) && !empty($ver_duas[1]))
          {
              $cont1 = count(explode("#", $ver_duas[0])) - 1;
              $cont2 = count(explode("#", $ver_duas[1])) - 1;
              if ($cont1 < $cont2 && $tam_campo <= $cont2 && $tam_campo > $cont1)
              {
                  $trab_mask = $ver_duas[1];
              }
              elseif ($cont1 > $cont2 && $tam_campo <= $cont2)
              {
                  $trab_mask = $ver_duas[1];
              }
              else
              {
                  $trab_mask = $ver_duas[0];
              }
          }
          $tam_mask = strlen($trab_mask);
          $xdados = 0;
          for ($x=0; $x < $tam_mask; $x++)
          {
              if (substr($trab_mask, $x, 1) == "#" && $xdados < $tam_campo)
              {
                  $trab_saida .= substr($trab_campo, $xdados, 1);
                  $xdados++;
              }
              elseif ($xdados < $tam_campo)
              {
                  $trab_saida .= substr($trab_mask, $x, 1);
              }
          }
          if ($xdados < $tam_campo)
          {
              $trab_saida .= substr($trab_campo, $xdados);
          }
          $nm_campo = $trab_saida;
          return;
      }
      for ($ix = strlen($trab_mask); $ix > 0; $ix--)
      {
           $char_mask = substr($trab_mask, $ix - 1, 1);
           if ($char_mask != "x" && $char_mask != "z")
           {
               $trab_saida = $char_mask . $trab_saida;
           }
           else
           {
               if ($tam_campo != 0)
               {
                   $trab_saida = substr($trab_campo, $tam_campo - 1, 1) . $trab_saida;
                   $tam_campo--;
               }
               else
               {
                   $trab_saida = "0" . $trab_saida;
               }
           }
      }
      if ($tam_campo != 0)
      {
          $trab_saida = substr($trab_campo, 0, $tam_campo) . $trab_saida;
          $trab_mask  = str_repeat("z", $tam_campo) . $trab_mask;
      }
   
      $iz = 0; 
      for ($ix = 0; $ix < strlen($trab_mask); $ix++)
      {
           $char_mask = substr($trab_mask, $ix, 1);
           if ($char_mask != "x" && $char_mask != "z")
           {
               if ($char_mask == "." || $char_mask == ",")
               {
                   $trab_saida = substr($trab_saida, 0, $iz) . substr($trab_saida, $iz + 1);
               }
               else
               {
                   $iz++;
               }
           }
           elseif ($char_mask == "x" || substr($trab_saida, $iz, 1) != "0")
           {
               $ix = strlen($trab_mask) + 1;
           }
           else
           {
               $trab_saida = substr($trab_saida, 0, $iz) . substr($trab_saida, $iz + 1);
           }
      }
      $nm_campo = $trab_saida;
   } 
   function nm_conta_mask_chars($sMask)
   {
       $iLength = 0;

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

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

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

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

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

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

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

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

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

          $nm_campo = $new_campo;

          return;
      }

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

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

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

       return $new;
   }
//
   function nm_limpa_alfa(&$str)
   {
       if (get_magic_quotes_gpc())
       {
           if (is_array($str))
           {
               $x = 0;
               foreach ($str as $cada_str)
               {
                   $str[$x] = stripslashes($str[$x]);
                   $x++;
               }
           }
           else
           {
               $str = stripslashes($str);
           }
       }
   }
//
//-- 
   function nm_converte_datas($use_null = true)
   {
       $guarda_format_hora = $this->field_config['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;
       $guarda_format_hora = $this->field_config['npdate']['date_format'];
      if ($this->npdate != "")  
      { 
          nm_conv_data($this->npdate, $this->field_config['npdate']['date_format']) ; 
          $this->npdate_hora = "00:00:00:000" ; 
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
          {
              $this->npdate_hora = substr($this->npdate_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
          {
              $this->npdate_hora = substr($this->npdate_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
          {
              $this->npdate_hora = substr($this->npdate_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
          {
              $this->npdate_hora = substr($this->npdate_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_db2))
          {
              $this->npdate_hora = substr($this->npdate_hora, 0, -4);
          }
      } 
      if ($this->npdate == "" && $use_null)  
      { 
          $this->npdate = "null" ; 
      } 
       $this->field_config['npdate']['date_format'] = $guarda_format_hora;
       $guarda_format_hora = $this->field_config['update']['date_format'];
      if ($this->update != "")  
      { 
          nm_conv_data($this->update, $this->field_config['update']['date_format']) ; 
          $this->update_hora = "00:00:00:000" ; 
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
          {
              $this->update_hora = substr($this->update_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
          {
              $this->update_hora = substr($this->update_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
          {
              $this->update_hora = substr($this->update_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
          {
              $this->update_hora = substr($this->update_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_db2))
          {
              $this->update_hora = substr($this->update_hora, 0, -4);
          }
      } 
      if ($this->update == "" && $use_null)  
      { 
          $this->update = "null" ; 
      } 
       $this->field_config['update']['date_format'] = $guarda_format_hora;
       $guarda_format_hora = $this->field_config['date1']['date_format'];
      if ($this->date1 != "")  
      { 
          nm_conv_data($this->date1, $this->field_config['date1']['date_format']) ; 
          $this->date1_hora = "00:00:00:000" ; 
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
          {
              $this->date1_hora = substr($this->date1_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
          {
              $this->date1_hora = substr($this->date1_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
          {
              $this->date1_hora = substr($this->date1_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
          {
              $this->date1_hora = substr($this->date1_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_db2))
          {
              $this->date1_hora = substr($this->date1_hora, 0, -4);
          }
      } 
      if ($this->date1 == "" && $use_null)  
      { 
          $this->date1 = "null" ; 
      } 
       $this->field_config['date1']['date_format'] = $guarda_format_hora;
       $guarda_format_hora = $this->field_config['date2']['date_format'];
      if ($this->date2 != "")  
      { 
          nm_conv_data($this->date2, $this->field_config['date2']['date_format']) ; 
          $this->date2_hora = "00:00:00:000" ; 
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
          {
              $this->date2_hora = substr($this->date2_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
          {
              $this->date2_hora = substr($this->date2_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
          {
              $this->date2_hora = substr($this->date2_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
          {
              $this->date2_hora = substr($this->date2_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_db2))
          {
              $this->date2_hora = substr($this->date2_hora, 0, -4);
          }
      } 
      if ($this->date2 == "" && $use_null)  
      { 
          $this->date2 = "null" ; 
      } 
       $this->field_config['date2']['date_format'] = $guarda_format_hora;
       $guarda_format_hora = $this->field_config['date3']['date_format'];
      if ($this->date3 != "")  
      { 
          nm_conv_data($this->date3, $this->field_config['date3']['date_format']) ; 
          $this->date3_hora = "00:00:00:000" ; 
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
          {
              $this->date3_hora = substr($this->date3_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
          {
              $this->date3_hora = substr($this->date3_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
          {
              $this->date3_hora = substr($this->date3_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
          {
              $this->date3_hora = substr($this->date3_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_db2))
          {
              $this->date3_hora = substr($this->date3_hora, 0, -4);
          }
      } 
      if ($this->date3 == "" && $use_null)  
      { 
          $this->date3 = "null" ; 
      } 
       $this->field_config['date3']['date_format'] = $guarda_format_hora;
       $guarda_format_hora = $this->field_config['date4']['date_format'];
      if ($this->date4 != "")  
      { 
          nm_conv_data($this->date4, $this->field_config['date4']['date_format']) ; 
          $this->date4_hora = "00:00:00:000" ; 
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
          {
              $this->date4_hora = substr($this->date4_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
          {
              $this->date4_hora = substr($this->date4_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
          {
              $this->date4_hora = substr($this->date4_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
          {
              $this->date4_hora = substr($this->date4_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_db2))
          {
              $this->date4_hora = substr($this->date4_hora, 0, -4);
          }
      } 
      if ($this->date4 == "" && $use_null)  
      { 
          $this->date4 = "null" ; 
      } 
       $this->field_config['date4']['date_format'] = $guarda_format_hora;
       $guarda_format_hora = $this->field_config['date5']['date_format'];
      if ($this->date5 != "")  
      { 
          nm_conv_data($this->date5, $this->field_config['date5']['date_format']) ; 
          $this->date5_hora = "00:00:00:000" ; 
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
          {
              $this->date5_hora = substr($this->date5_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
          {
              $this->date5_hora = substr($this->date5_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
          {
              $this->date5_hora = substr($this->date5_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
          {
              $this->date5_hora = substr($this->date5_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_db2))
          {
              $this->date5_hora = substr($this->date5_hora, 0, -4);
          }
      } 
      if ($this->date5 == "" && $use_null)  
      { 
          $this->date5 = "null" ; 
      } 
       $this->field_config['date5']['date_format'] = $guarda_format_hora;
       $guarda_format_hora = $this->field_config['date6']['date_format'];
      if ($this->date6 != "")  
      { 
          nm_conv_data($this->date6, $this->field_config['date6']['date_format']) ; 
          $this->date6_hora = "00:00:00:000" ; 
          if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_postgres))
          {
              $this->date6_hora = substr($this->date6_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
          {
              $this->date6_hora = substr($this->date6_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
          {
              $this->date6_hora = substr($this->date6_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
          {
              $this->date6_hora = substr($this->date6_hora, 0, -4);
          }
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_db2))
          {
              $this->date6_hora = substr($this->date6_hora, 0, -4);
          }
      } 
      if ($this->date6 == "" && $use_null)  
      { 
          $this->date6 = "null" ; 
      } 
       $this->field_config['date6']['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_image();
          $this->ajax_return_values_style();
          $this->ajax_return_values_name();
          $this->ajax_return_values_width();
          $this->ajax_return_values_comment();
          $this->ajax_return_values_fiber();
          $this->ajax_return_values_desc();
          $this->ajax_return_values_line();
          $this->ajax_return_values_dept();
          $this->ajax_return_values_odesc();
          $this->ajax_return_values_hand();
          $this->ajax_return_values_date();
          $this->ajax_return_values_mindye();
          $this->ajax_return_values_minord();
          $this->ajax_return_values_yarn1();
          $this->ajax_return_values_per1();
          $this->ajax_return_values_yarn2();
          $this->ajax_return_values_per2();
          $this->ajax_return_values_yarn3();
          $this->ajax_return_values_per3();
          $this->ajax_return_values_yarn4();
          $this->ajax_return_values_per4();
          $this->ajax_return_values_del1();
          $this->ajax_return_values_del2();
          $this->ajax_return_values_del3();
          $this->ajax_return_values_end1();
          $this->ajax_return_values_end2();
          $this->ajax_return_values_end3();
          $this->ajax_return_values_end4();
          $this->ajax_return_values_end5();
          $this->ajax_return_values_price();
          $this->ajax_return_values_med();
          $this->ajax_return_values_dark();
          $this->ajax_return_values_nprice();
          $this->ajax_return_values_npdate();
          $this->ajax_return_values_memo();
          $this->ajax_return_values_smemo();
          $this->ajax_return_values_yds();
          $this->ajax_return_values_lbs();
          $this->ajax_return_values_dye();
          $this->ajax_return_values_gc();
          $this->ajax_return_values_fc();
          $this->ajax_return_values_spec();
          $this->ajax_return_values_gshort();
          $this->ajax_return_values_ytdd();
          $this->ajax_return_values_ytdy();
          $this->ajax_return_values_mtdd();
          $this->ajax_return_values_mtdy();
          $this->ajax_return_values_histy();
          $this->ajax_return_values_histd();
          $this->ajax_return_values_update();
          $this->ajax_return_values_avprice();
          $this->ajax_return_values_lastyry();
          $this->ajax_return_values_lastyrd();
          $this->ajax_return_values_dyeleft();
          $this->ajax_return_values_ozsquare();
          $this->ajax_return_values_ozlin();
          $this->ajax_return_values_sqlb();
          $this->ajax_return_values_cpi();
          $this->ajax_return_values_wpi();
          $this->ajax_return_values_finwt();
          $this->ajax_return_values_meterkilo();
          $this->ajax_return_values_meter2kilo();
          $this->ajax_return_values_grammeter();
          $this->ajax_return_values_grammeter2();
          $this->ajax_return_values_stdputup();
          $this->ajax_return_values_stdtube();
          $this->ajax_return_values_date1();
          $this->ajax_return_values_date2();
          $this->ajax_return_values_date3();
          $this->ajax_return_values_date4();
          $this->ajax_return_values_date5();
          $this->ajax_return_values_date6();
          $this->ajax_return_values_name1();
          $this->ajax_return_values_name2();
          $this->ajax_return_values_name3();
          $this->ajax_return_values_name4();
          $this->ajax_return_values_name5();
          $this->ajax_return_values_name6();
          $this->ajax_return_values_method1();
          $this->ajax_return_values_method2();
          $this->ajax_return_values_method3();
          $this->ajax_return_values_method4();
          $this->ajax_return_values_method5();
          $this->ajax_return_values_method6();
          $this->ajax_return_values_test1();
          $this->ajax_return_values_test2();
          $this->ajax_return_values_test3();
          $this->ajax_return_values_test4();
          $this->ajax_return_values_lot1();
          $this->ajax_return_values_lot2();
          $this->ajax_return_values_lot3();
          $this->ajax_return_values_lot4();
          $this->ajax_return_values_lot5();
          $this->ajax_return_values_lot6();
          $this->ajax_return_values_result1();
          $this->ajax_return_values_result2();
          $this->ajax_return_values_result3();
          $this->ajax_return_values_result4();
          $this->ajax_return_values_result5();
          $this->ajax_return_values_result6();
          $this->ajax_return_values_sname1();
          $this->ajax_return_values_sname2();
          $this->ajax_return_values_sname3();
          $this->ajax_return_values_smethod1();
          $this->ajax_return_values_smethod2();
          $this->ajax_return_values_smethod3();
          $this->ajax_return_values_sstd1();
          $this->ajax_return_values_sstd2();
          $this->ajax_return_values_sstd3();
          $this->ajax_return_values_stol1();
          $this->ajax_return_values_stol2();
          $this->ajax_return_values_stol3();
          $this->ajax_return_values_conv2();
          $this->ajax_return_values_conv3();
          $this->ajax_return_values_conv();
          $this->ajax_return_values_stdcost();
          $this->ajax_return_values_stdgp();
          $this->ajax_return_values_sprice();
          $this->ajax_return_values_avcost();
          $this->ajax_return_values_stdcosting();
          $this->ajax_return_values_machine();
          $this->ajax_return_values_cgs();
          $this->ajax_return_values_gs();
          $this->ajax_return_values_k();
          $this->ajax_return_values_grstyle();
          $this->ajax_return_values_lbbo();
          $this->ajax_return_values_bo();
          $this->ajax_return_values_samples();
          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']['style']['keyVal'] = line_form_pack_protect_string($this->nmgp_dados_form['style']);
              $this->NM_ajax_info['fldList']['id2']['keyVal'] = line_form_pack_protect_string($this->nmgp_dados_form['id2']);
              $_SESSION['sc_session'][$this->Ini->sc_page]['greige_grstyle_ro2_form']['foreign_key']['gr_style'] = $this->nmgp_dados_form['cgs'];
              $_SESSION['sc_session'][$this->Ini->sc_page]['greige_grstyle_ro2_form']['where_filter'] = "GR_STYLE = '" . $this->nmgp_dados_form['cgs'] . "'";
              $_SESSION['sc_session'][$this->Ini->sc_page]['greige_grstyle_ro2_form']['where_detal']  = "GR_STYLE = '" . $this->nmgp_dados_form['cgs'] . "'";
              if ($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['total'] < 0)
              {
                  $_SESSION['sc_session'][$this->Ini->sc_page]['greige_grstyle_ro2_form']['where_filter'] = "1 <> 1";
              }
              $_SESSION['sc_session'][$this->Ini->sc_page]['greige_grstyle_ro2_form']['reg_start'] = "";
              unset($_SESSION['sc_session'][$this->Ini->sc_page]['greige_grstyle_ro2_form']['total']);
              $_SESSION['sc_session'][$this->Ini->sc_page]['line_cmatch_edit_grid']['foreign_key']['style'] = $this->nmgp_dados_form['style'];
              $_SESSION['sc_session'][$this->Ini->sc_page]['line_cmatch_edit_grid']['where_filter'] = "STYLE = '" . $this->nmgp_dados_form['style'] . "'";
              $_SESSION['sc_session'][$this->Ini->sc_page]['line_cmatch_edit_grid']['where_detal']  = "STYLE = '" . $this->nmgp_dados_form['style'] . "'";
              if ($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['total'] < 0)
              {
                  $_SESSION['sc_session'][$this->Ini->sc_page]['line_cmatch_edit_grid']['where_filter'] = "1 <> 1";
              }
              $_SESSION['sc_session'][$this->Ini->sc_page]['line_cmatch_edit_grid']['reg_start'] = "";
              unset($_SESSION['sc_session'][$this->Ini->sc_page]['line_cmatch_edit_grid']['total']);
          }
   } // ajax_return_values

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

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

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

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

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

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

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

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

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

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

          //----- hand
   function ajax_return_values_hand($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("hand", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->hand);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['hand'] = array(
                       'row'    => '',
               'type'    => 'text',
               '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),
              );
          }
   }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 
$nmgp_def_dados = "" ; 
if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end1']))
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end1'] = array_unique($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end1']); 
}
else
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end1'] = array(); 
}
$aLookup[] = array(line_form_pack_protect_string('') => line_form_pack_protect_string('' . $_SESSION['var_end1'] . ''));
$_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end1'][] = '';
   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_date = $this->date;
   $old_value_per1 = $this->per1;
   $old_value_per2 = $this->per2;
   $old_value_per3 = $this->per3;
   $old_value_per4 = $this->per4;
   $old_value_nprice = $this->nprice;
   $old_value_npdate = $this->npdate;
   $old_value_yds = $this->yds;
   $old_value_lbs = $this->lbs;
   $old_value_dye = $this->dye;
   $old_value_gc = $this->gc;
   $old_value_fc = $this->fc;
   $old_value_gshort = $this->gshort;
   $old_value_ytdd = $this->ytdd;
   $old_value_ytdy = $this->ytdy;
   $old_value_mtdd = $this->mtdd;
   $old_value_mtdy = $this->mtdy;
   $old_value_histy = $this->histy;
   $old_value_histd = $this->histd;
   $old_value_update = $this->update;
   $old_value_avprice = $this->avprice;
   $old_value_lastyry = $this->lastyry;
   $old_value_lastyrd = $this->lastyrd;
   $old_value_dyeleft = $this->dyeleft;
   $old_value_ozsquare = $this->ozsquare;
   $old_value_ozlin = $this->ozlin;
   $old_value_sqlb = $this->sqlb;
   $old_value_meterkilo = $this->meterkilo;
   $old_value_meter2kilo = $this->meter2kilo;
   $old_value_grammeter = $this->grammeter;
   $old_value_grammeter2 = $this->grammeter2;
   $old_value_date1 = $this->date1;
   $old_value_date2 = $this->date2;
   $old_value_date3 = $this->date3;
   $old_value_date4 = $this->date4;
   $old_value_date5 = $this->date5;
   $old_value_date6 = $this->date6;
   $old_value_conv2 = $this->conv2;
   $old_value_conv3 = $this->conv3;
   $old_value_conv = $this->conv;
   $old_value_stdcost = $this->stdcost;
   $old_value_stdgp = $this->stdgp;
   $old_value_sprice = $this->sprice;
   $old_value_avcost = $this->avcost;
   $old_value_lbbo = $this->lbbo;
   $old_value_bo = $this->bo;
   $old_value_samples = $this->samples;
   $this->nm_tira_formatacao();
   $this->nm_converte_datas(false);


   $unformatted_value_date = $this->date;
   $unformatted_value_per1 = $this->per1;
   $unformatted_value_per2 = $this->per2;
   $unformatted_value_per3 = $this->per3;
   $unformatted_value_per4 = $this->per4;
   $unformatted_value_nprice = $this->nprice;
   $unformatted_value_npdate = $this->npdate;
   $unformatted_value_yds = $this->yds;
   $unformatted_value_lbs = $this->lbs;
   $unformatted_value_dye = $this->dye;
   $unformatted_value_gc = $this->gc;
   $unformatted_value_fc = $this->fc;
   $unformatted_value_gshort = $this->gshort;
   $unformatted_value_ytdd = $this->ytdd;
   $unformatted_value_ytdy = $this->ytdy;
   $unformatted_value_mtdd = $this->mtdd;
   $unformatted_value_mtdy = $this->mtdy;
   $unformatted_value_histy = $this->histy;
   $unformatted_value_histd = $this->histd;
   $unformatted_value_update = $this->update;
   $unformatted_value_avprice = $this->avprice;
   $unformatted_value_lastyry = $this->lastyry;
   $unformatted_value_lastyrd = $this->lastyrd;
   $unformatted_value_dyeleft = $this->dyeleft;
   $unformatted_value_ozsquare = $this->ozsquare;
   $unformatted_value_ozlin = $this->ozlin;
   $unformatted_value_sqlb = $this->sqlb;
   $unformatted_value_meterkilo = $this->meterkilo;
   $unformatted_value_meter2kilo = $this->meter2kilo;
   $unformatted_value_grammeter = $this->grammeter;
   $unformatted_value_grammeter2 = $this->grammeter2;
   $unformatted_value_date1 = $this->date1;
   $unformatted_value_date2 = $this->date2;
   $unformatted_value_date3 = $this->date3;
   $unformatted_value_date4 = $this->date4;
   $unformatted_value_date5 = $this->date5;
   $unformatted_value_date6 = $this->date6;
   $unformatted_value_conv2 = $this->conv2;
   $unformatted_value_conv3 = $this->conv3;
   $unformatted_value_conv = $this->conv;
   $unformatted_value_stdcost = $this->stdcost;
   $unformatted_value_stdgp = $this->stdgp;
   $unformatted_value_sprice = $this->sprice;
   $unformatted_value_avcost = $this->avcost;
   $unformatted_value_lbbo = $this->lbbo;
   $unformatted_value_bo = $this->bo;
   $unformatted_value_samples = $this->samples;

   $nm_comando = "SELECT ECODE, ENDUSE 
FROM enduse 
ORDER BY ENDUSE";

   $this->date = $old_value_date;
   $this->per1 = $old_value_per1;
   $this->per2 = $old_value_per2;
   $this->per3 = $old_value_per3;
   $this->per4 = $old_value_per4;
   $this->nprice = $old_value_nprice;
   $this->npdate = $old_value_npdate;
   $this->yds = $old_value_yds;
   $this->lbs = $old_value_lbs;
   $this->dye = $old_value_dye;
   $this->gc = $old_value_gc;
   $this->fc = $old_value_fc;
   $this->gshort = $old_value_gshort;
   $this->ytdd = $old_value_ytdd;
   $this->ytdy = $old_value_ytdy;
   $this->mtdd = $old_value_mtdd;
   $this->mtdy = $old_value_mtdy;
   $this->histy = $old_value_histy;
   $this->histd = $old_value_histd;
   $this->update = $old_value_update;
   $this->avprice = $old_value_avprice;
   $this->lastyry = $old_value_lastyry;
   $this->lastyrd = $old_value_lastyrd;
   $this->dyeleft = $old_value_dyeleft;
   $this->ozsquare = $old_value_ozsquare;
   $this->ozlin = $old_value_ozlin;
   $this->sqlb = $old_value_sqlb;
   $this->meterkilo = $old_value_meterkilo;
   $this->meter2kilo = $old_value_meter2kilo;
   $this->grammeter = $old_value_grammeter;
   $this->grammeter2 = $old_value_grammeter2;
   $this->date1 = $old_value_date1;
   $this->date2 = $old_value_date2;
   $this->date3 = $old_value_date3;
   $this->date4 = $old_value_date4;
   $this->date5 = $old_value_date5;
   $this->date6 = $old_value_date6;
   $this->conv2 = $old_value_conv2;
   $this->conv3 = $old_value_conv3;
   $this->conv = $old_value_conv;
   $this->stdcost = $old_value_stdcost;
   $this->stdgp = $old_value_stdgp;
   $this->sprice = $old_value_sprice;
   $this->avcost = $old_value_avcost;
   $this->lbbo = $old_value_lbbo;
   $this->bo = $old_value_bo;
   $this->samples = $old_value_samples;

   $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando; 
   $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
   if ($nm_comando != "" && $rs = $this->Db->Execute($nm_comando)) 
   {
       while (!$rs->EOF) 
       { 
              $aLookup[] = array(line_form_pack_protect_string($rs->fields[0]) => line_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]['line_form']['Lookup_end1'][] = $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=\"end1\"";
          if (isset($this->NM_ajax_info['select_html']['end1']) && !empty($this->NM_ajax_info['select_html']['end1']))
          {
              $sSelComp = $this->NM_ajax_info['select_html']['end1'];
          }
          $sLookup = '';
          if (empty($aLookup))
          {
              $aLookup[] = array('' => '');
          }
          foreach ($aLookup as $aOption)
          {
              foreach ($aOption as $sValue => $sLabel)
              {

                  if ($this->end1 == $sValue)
                  {
                      $this->_tmp_lookup_end1 = $sLabel;
                  }

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

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

 
$nmgp_def_dados = "" ; 
if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end2']))
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end2'] = array_unique($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end2']); 
}
else
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end2'] = array(); 
}
$aLookup[] = array(line_form_pack_protect_string('') => line_form_pack_protect_string('' . $_SESSION['var_end2'] . ''));
$_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end2'][] = '';
   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_date = $this->date;
   $old_value_per1 = $this->per1;
   $old_value_per2 = $this->per2;
   $old_value_per3 = $this->per3;
   $old_value_per4 = $this->per4;
   $old_value_nprice = $this->nprice;
   $old_value_npdate = $this->npdate;
   $old_value_yds = $this->yds;
   $old_value_lbs = $this->lbs;
   $old_value_dye = $this->dye;
   $old_value_gc = $this->gc;
   $old_value_fc = $this->fc;
   $old_value_gshort = $this->gshort;
   $old_value_ytdd = $this->ytdd;
   $old_value_ytdy = $this->ytdy;
   $old_value_mtdd = $this->mtdd;
   $old_value_mtdy = $this->mtdy;
   $old_value_histy = $this->histy;
   $old_value_histd = $this->histd;
   $old_value_update = $this->update;
   $old_value_avprice = $this->avprice;
   $old_value_lastyry = $this->lastyry;
   $old_value_lastyrd = $this->lastyrd;
   $old_value_dyeleft = $this->dyeleft;
   $old_value_ozsquare = $this->ozsquare;
   $old_value_ozlin = $this->ozlin;
   $old_value_sqlb = $this->sqlb;
   $old_value_meterkilo = $this->meterkilo;
   $old_value_meter2kilo = $this->meter2kilo;
   $old_value_grammeter = $this->grammeter;
   $old_value_grammeter2 = $this->grammeter2;
   $old_value_date1 = $this->date1;
   $old_value_date2 = $this->date2;
   $old_value_date3 = $this->date3;
   $old_value_date4 = $this->date4;
   $old_value_date5 = $this->date5;
   $old_value_date6 = $this->date6;
   $old_value_conv2 = $this->conv2;
   $old_value_conv3 = $this->conv3;
   $old_value_conv = $this->conv;
   $old_value_stdcost = $this->stdcost;
   $old_value_stdgp = $this->stdgp;
   $old_value_sprice = $this->sprice;
   $old_value_avcost = $this->avcost;
   $old_value_lbbo = $this->lbbo;
   $old_value_bo = $this->bo;
   $old_value_samples = $this->samples;
   $this->nm_tira_formatacao();
   $this->nm_converte_datas(false);


   $unformatted_value_date = $this->date;
   $unformatted_value_per1 = $this->per1;
   $unformatted_value_per2 = $this->per2;
   $unformatted_value_per3 = $this->per3;
   $unformatted_value_per4 = $this->per4;
   $unformatted_value_nprice = $this->nprice;
   $unformatted_value_npdate = $this->npdate;
   $unformatted_value_yds = $this->yds;
   $unformatted_value_lbs = $this->lbs;
   $unformatted_value_dye = $this->dye;
   $unformatted_value_gc = $this->gc;
   $unformatted_value_fc = $this->fc;
   $unformatted_value_gshort = $this->gshort;
   $unformatted_value_ytdd = $this->ytdd;
   $unformatted_value_ytdy = $this->ytdy;
   $unformatted_value_mtdd = $this->mtdd;
   $unformatted_value_mtdy = $this->mtdy;
   $unformatted_value_histy = $this->histy;
   $unformatted_value_histd = $this->histd;
   $unformatted_value_update = $this->update;
   $unformatted_value_avprice = $this->avprice;
   $unformatted_value_lastyry = $this->lastyry;
   $unformatted_value_lastyrd = $this->lastyrd;
   $unformatted_value_dyeleft = $this->dyeleft;
   $unformatted_value_ozsquare = $this->ozsquare;
   $unformatted_value_ozlin = $this->ozlin;
   $unformatted_value_sqlb = $this->sqlb;
   $unformatted_value_meterkilo = $this->meterkilo;
   $unformatted_value_meter2kilo = $this->meter2kilo;
   $unformatted_value_grammeter = $this->grammeter;
   $unformatted_value_grammeter2 = $this->grammeter2;
   $unformatted_value_date1 = $this->date1;
   $unformatted_value_date2 = $this->date2;
   $unformatted_value_date3 = $this->date3;
   $unformatted_value_date4 = $this->date4;
   $unformatted_value_date5 = $this->date5;
   $unformatted_value_date6 = $this->date6;
   $unformatted_value_conv2 = $this->conv2;
   $unformatted_value_conv3 = $this->conv3;
   $unformatted_value_conv = $this->conv;
   $unformatted_value_stdcost = $this->stdcost;
   $unformatted_value_stdgp = $this->stdgp;
   $unformatted_value_sprice = $this->sprice;
   $unformatted_value_avcost = $this->avcost;
   $unformatted_value_lbbo = $this->lbbo;
   $unformatted_value_bo = $this->bo;
   $unformatted_value_samples = $this->samples;

   $nm_comando = "SELECT ECODE, ENDUSE 
FROM enduse 
ORDER BY ENDUSE";

   $this->date = $old_value_date;
   $this->per1 = $old_value_per1;
   $this->per2 = $old_value_per2;
   $this->per3 = $old_value_per3;
   $this->per4 = $old_value_per4;
   $this->nprice = $old_value_nprice;
   $this->npdate = $old_value_npdate;
   $this->yds = $old_value_yds;
   $this->lbs = $old_value_lbs;
   $this->dye = $old_value_dye;
   $this->gc = $old_value_gc;
   $this->fc = $old_value_fc;
   $this->gshort = $old_value_gshort;
   $this->ytdd = $old_value_ytdd;
   $this->ytdy = $old_value_ytdy;
   $this->mtdd = $old_value_mtdd;
   $this->mtdy = $old_value_mtdy;
   $this->histy = $old_value_histy;
   $this->histd = $old_value_histd;
   $this->update = $old_value_update;
   $this->avprice = $old_value_avprice;
   $this->lastyry = $old_value_lastyry;
   $this->lastyrd = $old_value_lastyrd;
   $this->dyeleft = $old_value_dyeleft;
   $this->ozsquare = $old_value_ozsquare;
   $this->ozlin = $old_value_ozlin;
   $this->sqlb = $old_value_sqlb;
   $this->meterkilo = $old_value_meterkilo;
   $this->meter2kilo = $old_value_meter2kilo;
   $this->grammeter = $old_value_grammeter;
   $this->grammeter2 = $old_value_grammeter2;
   $this->date1 = $old_value_date1;
   $this->date2 = $old_value_date2;
   $this->date3 = $old_value_date3;
   $this->date4 = $old_value_date4;
   $this->date5 = $old_value_date5;
   $this->date6 = $old_value_date6;
   $this->conv2 = $old_value_conv2;
   $this->conv3 = $old_value_conv3;
   $this->conv = $old_value_conv;
   $this->stdcost = $old_value_stdcost;
   $this->stdgp = $old_value_stdgp;
   $this->sprice = $old_value_sprice;
   $this->avcost = $old_value_avcost;
   $this->lbbo = $old_value_lbbo;
   $this->bo = $old_value_bo;
   $this->samples = $old_value_samples;

   $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando; 
   $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
   if ($nm_comando != "" && $rs = $this->Db->Execute($nm_comando)) 
   {
       while (!$rs->EOF) 
       { 
              $aLookup[] = array(line_form_pack_protect_string($rs->fields[0]) => line_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]['line_form']['Lookup_end2'][] = $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=\"end2\"";
          if (isset($this->NM_ajax_info['select_html']['end2']) && !empty($this->NM_ajax_info['select_html']['end2']))
          {
              $sSelComp = $this->NM_ajax_info['select_html']['end2'];
          }
          $sLookup = '';
          if (empty($aLookup))
          {
              $aLookup[] = array('' => '');
          }
          foreach ($aLookup as $aOption)
          {
              foreach ($aOption as $sValue => $sLabel)
              {

                  if ($this->end2 == $sValue)
                  {
                      $this->_tmp_lookup_end2 = $sLabel;
                  }

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

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

 
$nmgp_def_dados = "" ; 
if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end3']))
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end3'] = array_unique($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end3']); 
}
else
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end3'] = array(); 
}
$aLookup[] = array(line_form_pack_protect_string('') => line_form_pack_protect_string('' . $_SESSION['var_end3'] . ''));
$_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end3'][] = '';
   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_date = $this->date;
   $old_value_per1 = $this->per1;
   $old_value_per2 = $this->per2;
   $old_value_per3 = $this->per3;
   $old_value_per4 = $this->per4;
   $old_value_nprice = $this->nprice;
   $old_value_npdate = $this->npdate;
   $old_value_yds = $this->yds;
   $old_value_lbs = $this->lbs;
   $old_value_dye = $this->dye;
   $old_value_gc = $this->gc;
   $old_value_fc = $this->fc;
   $old_value_gshort = $this->gshort;
   $old_value_ytdd = $this->ytdd;
   $old_value_ytdy = $this->ytdy;
   $old_value_mtdd = $this->mtdd;
   $old_value_mtdy = $this->mtdy;
   $old_value_histy = $this->histy;
   $old_value_histd = $this->histd;
   $old_value_update = $this->update;
   $old_value_avprice = $this->avprice;
   $old_value_lastyry = $this->lastyry;
   $old_value_lastyrd = $this->lastyrd;
   $old_value_dyeleft = $this->dyeleft;
   $old_value_ozsquare = $this->ozsquare;
   $old_value_ozlin = $this->ozlin;
   $old_value_sqlb = $this->sqlb;
   $old_value_meterkilo = $this->meterkilo;
   $old_value_meter2kilo = $this->meter2kilo;
   $old_value_grammeter = $this->grammeter;
   $old_value_grammeter2 = $this->grammeter2;
   $old_value_date1 = $this->date1;
   $old_value_date2 = $this->date2;
   $old_value_date3 = $this->date3;
   $old_value_date4 = $this->date4;
   $old_value_date5 = $this->date5;
   $old_value_date6 = $this->date6;
   $old_value_conv2 = $this->conv2;
   $old_value_conv3 = $this->conv3;
   $old_value_conv = $this->conv;
   $old_value_stdcost = $this->stdcost;
   $old_value_stdgp = $this->stdgp;
   $old_value_sprice = $this->sprice;
   $old_value_avcost = $this->avcost;
   $old_value_lbbo = $this->lbbo;
   $old_value_bo = $this->bo;
   $old_value_samples = $this->samples;
   $this->nm_tira_formatacao();
   $this->nm_converte_datas(false);


   $unformatted_value_date = $this->date;
   $unformatted_value_per1 = $this->per1;
   $unformatted_value_per2 = $this->per2;
   $unformatted_value_per3 = $this->per3;
   $unformatted_value_per4 = $this->per4;
   $unformatted_value_nprice = $this->nprice;
   $unformatted_value_npdate = $this->npdate;
   $unformatted_value_yds = $this->yds;
   $unformatted_value_lbs = $this->lbs;
   $unformatted_value_dye = $this->dye;
   $unformatted_value_gc = $this->gc;
   $unformatted_value_fc = $this->fc;
   $unformatted_value_gshort = $this->gshort;
   $unformatted_value_ytdd = $this->ytdd;
   $unformatted_value_ytdy = $this->ytdy;
   $unformatted_value_mtdd = $this->mtdd;
   $unformatted_value_mtdy = $this->mtdy;
   $unformatted_value_histy = $this->histy;
   $unformatted_value_histd = $this->histd;
   $unformatted_value_update = $this->update;
   $unformatted_value_avprice = $this->avprice;
   $unformatted_value_lastyry = $this->lastyry;
   $unformatted_value_lastyrd = $this->lastyrd;
   $unformatted_value_dyeleft = $this->dyeleft;
   $unformatted_value_ozsquare = $this->ozsquare;
   $unformatted_value_ozlin = $this->ozlin;
   $unformatted_value_sqlb = $this->sqlb;
   $unformatted_value_meterkilo = $this->meterkilo;
   $unformatted_value_meter2kilo = $this->meter2kilo;
   $unformatted_value_grammeter = $this->grammeter;
   $unformatted_value_grammeter2 = $this->grammeter2;
   $unformatted_value_date1 = $this->date1;
   $unformatted_value_date2 = $this->date2;
   $unformatted_value_date3 = $this->date3;
   $unformatted_value_date4 = $this->date4;
   $unformatted_value_date5 = $this->date5;
   $unformatted_value_date6 = $this->date6;
   $unformatted_value_conv2 = $this->conv2;
   $unformatted_value_conv3 = $this->conv3;
   $unformatted_value_conv = $this->conv;
   $unformatted_value_stdcost = $this->stdcost;
   $unformatted_value_stdgp = $this->stdgp;
   $unformatted_value_sprice = $this->sprice;
   $unformatted_value_avcost = $this->avcost;
   $unformatted_value_lbbo = $this->lbbo;
   $unformatted_value_bo = $this->bo;
   $unformatted_value_samples = $this->samples;

   $nm_comando = "SELECT ECODE, ENDUSE 
FROM enduse 
ORDER BY ENDUSE";

   $this->date = $old_value_date;
   $this->per1 = $old_value_per1;
   $this->per2 = $old_value_per2;
   $this->per3 = $old_value_per3;
   $this->per4 = $old_value_per4;
   $this->nprice = $old_value_nprice;
   $this->npdate = $old_value_npdate;
   $this->yds = $old_value_yds;
   $this->lbs = $old_value_lbs;
   $this->dye = $old_value_dye;
   $this->gc = $old_value_gc;
   $this->fc = $old_value_fc;
   $this->gshort = $old_value_gshort;
   $this->ytdd = $old_value_ytdd;
   $this->ytdy = $old_value_ytdy;
   $this->mtdd = $old_value_mtdd;
   $this->mtdy = $old_value_mtdy;
   $this->histy = $old_value_histy;
   $this->histd = $old_value_histd;
   $this->update = $old_value_update;
   $this->avprice = $old_value_avprice;
   $this->lastyry = $old_value_lastyry;
   $this->lastyrd = $old_value_lastyrd;
   $this->dyeleft = $old_value_dyeleft;
   $this->ozsquare = $old_value_ozsquare;
   $this->ozlin = $old_value_ozlin;
   $this->sqlb = $old_value_sqlb;
   $this->meterkilo = $old_value_meterkilo;
   $this->meter2kilo = $old_value_meter2kilo;
   $this->grammeter = $old_value_grammeter;
   $this->grammeter2 = $old_value_grammeter2;
   $this->date1 = $old_value_date1;
   $this->date2 = $old_value_date2;
   $this->date3 = $old_value_date3;
   $this->date4 = $old_value_date4;
   $this->date5 = $old_value_date5;
   $this->date6 = $old_value_date6;
   $this->conv2 = $old_value_conv2;
   $this->conv3 = $old_value_conv3;
   $this->conv = $old_value_conv;
   $this->stdcost = $old_value_stdcost;
   $this->stdgp = $old_value_stdgp;
   $this->sprice = $old_value_sprice;
   $this->avcost = $old_value_avcost;
   $this->lbbo = $old_value_lbbo;
   $this->bo = $old_value_bo;
   $this->samples = $old_value_samples;

   $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando; 
   $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
   if ($nm_comando != "" && $rs = $this->Db->Execute($nm_comando)) 
   {
       while (!$rs->EOF) 
       { 
              $aLookup[] = array(line_form_pack_protect_string($rs->fields[0]) => line_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]['line_form']['Lookup_end3'][] = $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=\"end3\"";
          if (isset($this->NM_ajax_info['select_html']['end3']) && !empty($this->NM_ajax_info['select_html']['end3']))
          {
              $sSelComp = $this->NM_ajax_info['select_html']['end3'];
          }
          $sLookup = '';
          if (empty($aLookup))
          {
              $aLookup[] = array('' => '');
          }
          foreach ($aLookup as $aOption)
          {
              foreach ($aOption as $sValue => $sLabel)
              {

                  if ($this->end3 == $sValue)
                  {
                      $this->_tmp_lookup_end3 = $sLabel;
                  }

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

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

 
$nmgp_def_dados = "" ; 
if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end4']))
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end4'] = array_unique($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end4']); 
}
else
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end4'] = array(); 
}
$aLookup[] = array(line_form_pack_protect_string('') => line_form_pack_protect_string('' . $_SESSION['var_end4'] . ''));
$_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end4'][] = '';
   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_date = $this->date;
   $old_value_per1 = $this->per1;
   $old_value_per2 = $this->per2;
   $old_value_per3 = $this->per3;
   $old_value_per4 = $this->per4;
   $old_value_nprice = $this->nprice;
   $old_value_npdate = $this->npdate;
   $old_value_yds = $this->yds;
   $old_value_lbs = $this->lbs;
   $old_value_dye = $this->dye;
   $old_value_gc = $this->gc;
   $old_value_fc = $this->fc;
   $old_value_gshort = $this->gshort;
   $old_value_ytdd = $this->ytdd;
   $old_value_ytdy = $this->ytdy;
   $old_value_mtdd = $this->mtdd;
   $old_value_mtdy = $this->mtdy;
   $old_value_histy = $this->histy;
   $old_value_histd = $this->histd;
   $old_value_update = $this->update;
   $old_value_avprice = $this->avprice;
   $old_value_lastyry = $this->lastyry;
   $old_value_lastyrd = $this->lastyrd;
   $old_value_dyeleft = $this->dyeleft;
   $old_value_ozsquare = $this->ozsquare;
   $old_value_ozlin = $this->ozlin;
   $old_value_sqlb = $this->sqlb;
   $old_value_meterkilo = $this->meterkilo;
   $old_value_meter2kilo = $this->meter2kilo;
   $old_value_grammeter = $this->grammeter;
   $old_value_grammeter2 = $this->grammeter2;
   $old_value_date1 = $this->date1;
   $old_value_date2 = $this->date2;
   $old_value_date3 = $this->date3;
   $old_value_date4 = $this->date4;
   $old_value_date5 = $this->date5;
   $old_value_date6 = $this->date6;
   $old_value_conv2 = $this->conv2;
   $old_value_conv3 = $this->conv3;
   $old_value_conv = $this->conv;
   $old_value_stdcost = $this->stdcost;
   $old_value_stdgp = $this->stdgp;
   $old_value_sprice = $this->sprice;
   $old_value_avcost = $this->avcost;
   $old_value_lbbo = $this->lbbo;
   $old_value_bo = $this->bo;
   $old_value_samples = $this->samples;
   $this->nm_tira_formatacao();
   $this->nm_converte_datas(false);


   $unformatted_value_date = $this->date;
   $unformatted_value_per1 = $this->per1;
   $unformatted_value_per2 = $this->per2;
   $unformatted_value_per3 = $this->per3;
   $unformatted_value_per4 = $this->per4;
   $unformatted_value_nprice = $this->nprice;
   $unformatted_value_npdate = $this->npdate;
   $unformatted_value_yds = $this->yds;
   $unformatted_value_lbs = $this->lbs;
   $unformatted_value_dye = $this->dye;
   $unformatted_value_gc = $this->gc;
   $unformatted_value_fc = $this->fc;
   $unformatted_value_gshort = $this->gshort;
   $unformatted_value_ytdd = $this->ytdd;
   $unformatted_value_ytdy = $this->ytdy;
   $unformatted_value_mtdd = $this->mtdd;
   $unformatted_value_mtdy = $this->mtdy;
   $unformatted_value_histy = $this->histy;
   $unformatted_value_histd = $this->histd;
   $unformatted_value_update = $this->update;
   $unformatted_value_avprice = $this->avprice;
   $unformatted_value_lastyry = $this->lastyry;
   $unformatted_value_lastyrd = $this->lastyrd;
   $unformatted_value_dyeleft = $this->dyeleft;
   $unformatted_value_ozsquare = $this->ozsquare;
   $unformatted_value_ozlin = $this->ozlin;
   $unformatted_value_sqlb = $this->sqlb;
   $unformatted_value_meterkilo = $this->meterkilo;
   $unformatted_value_meter2kilo = $this->meter2kilo;
   $unformatted_value_grammeter = $this->grammeter;
   $unformatted_value_grammeter2 = $this->grammeter2;
   $unformatted_value_date1 = $this->date1;
   $unformatted_value_date2 = $this->date2;
   $unformatted_value_date3 = $this->date3;
   $unformatted_value_date4 = $this->date4;
   $unformatted_value_date5 = $this->date5;
   $unformatted_value_date6 = $this->date6;
   $unformatted_value_conv2 = $this->conv2;
   $unformatted_value_conv3 = $this->conv3;
   $unformatted_value_conv = $this->conv;
   $unformatted_value_stdcost = $this->stdcost;
   $unformatted_value_stdgp = $this->stdgp;
   $unformatted_value_sprice = $this->sprice;
   $unformatted_value_avcost = $this->avcost;
   $unformatted_value_lbbo = $this->lbbo;
   $unformatted_value_bo = $this->bo;
   $unformatted_value_samples = $this->samples;

   $nm_comando = "SELECT ECODE, ENDUSE 
FROM enduse 
ORDER BY ENDUSE";

   $this->date = $old_value_date;
   $this->per1 = $old_value_per1;
   $this->per2 = $old_value_per2;
   $this->per3 = $old_value_per3;
   $this->per4 = $old_value_per4;
   $this->nprice = $old_value_nprice;
   $this->npdate = $old_value_npdate;
   $this->yds = $old_value_yds;
   $this->lbs = $old_value_lbs;
   $this->dye = $old_value_dye;
   $this->gc = $old_value_gc;
   $this->fc = $old_value_fc;
   $this->gshort = $old_value_gshort;
   $this->ytdd = $old_value_ytdd;
   $this->ytdy = $old_value_ytdy;
   $this->mtdd = $old_value_mtdd;
   $this->mtdy = $old_value_mtdy;
   $this->histy = $old_value_histy;
   $this->histd = $old_value_histd;
   $this->update = $old_value_update;
   $this->avprice = $old_value_avprice;
   $this->lastyry = $old_value_lastyry;
   $this->lastyrd = $old_value_lastyrd;
   $this->dyeleft = $old_value_dyeleft;
   $this->ozsquare = $old_value_ozsquare;
   $this->ozlin = $old_value_ozlin;
   $this->sqlb = $old_value_sqlb;
   $this->meterkilo = $old_value_meterkilo;
   $this->meter2kilo = $old_value_meter2kilo;
   $this->grammeter = $old_value_grammeter;
   $this->grammeter2 = $old_value_grammeter2;
   $this->date1 = $old_value_date1;
   $this->date2 = $old_value_date2;
   $this->date3 = $old_value_date3;
   $this->date4 = $old_value_date4;
   $this->date5 = $old_value_date5;
   $this->date6 = $old_value_date6;
   $this->conv2 = $old_value_conv2;
   $this->conv3 = $old_value_conv3;
   $this->conv = $old_value_conv;
   $this->stdcost = $old_value_stdcost;
   $this->stdgp = $old_value_stdgp;
   $this->sprice = $old_value_sprice;
   $this->avcost = $old_value_avcost;
   $this->lbbo = $old_value_lbbo;
   $this->bo = $old_value_bo;
   $this->samples = $old_value_samples;

   $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando; 
   $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
   if ($nm_comando != "" && $rs = $this->Db->Execute($nm_comando)) 
   {
       while (!$rs->EOF) 
       { 
              $aLookup[] = array(line_form_pack_protect_string($rs->fields[0]) => line_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]['line_form']['Lookup_end4'][] = $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=\"end4\"";
          if (isset($this->NM_ajax_info['select_html']['end4']) && !empty($this->NM_ajax_info['select_html']['end4']))
          {
              $sSelComp = $this->NM_ajax_info['select_html']['end4'];
          }
          $sLookup = '';
          if (empty($aLookup))
          {
              $aLookup[] = array('' => '');
          }
          foreach ($aLookup as $aOption)
          {
              foreach ($aOption as $sValue => $sLabel)
              {

                  if ($this->end4 == $sValue)
                  {
                      $this->_tmp_lookup_end4 = $sLabel;
                  }

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

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

 
$nmgp_def_dados = "" ; 
if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end5']))
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end5'] = array_unique($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end5']); 
}
else
{
    $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end5'] = array(); 
}
$aLookup[] = array(line_form_pack_protect_string('') => line_form_pack_protect_string('' . $_SESSION['var_end5'] . ''));
$_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['Lookup_end5'][] = '';
   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_date = $this->date;
   $old_value_per1 = $this->per1;
   $old_value_per2 = $this->per2;
   $old_value_per3 = $this->per3;
   $old_value_per4 = $this->per4;
   $old_value_nprice = $this->nprice;
   $old_value_npdate = $this->npdate;
   $old_value_yds = $this->yds;
   $old_value_lbs = $this->lbs;
   $old_value_dye = $this->dye;
   $old_value_gc = $this->gc;
   $old_value_fc = $this->fc;
   $old_value_gshort = $this->gshort;
   $old_value_ytdd = $this->ytdd;
   $old_value_ytdy = $this->ytdy;
   $old_value_mtdd = $this->mtdd;
   $old_value_mtdy = $this->mtdy;
   $old_value_histy = $this->histy;
   $old_value_histd = $this->histd;
   $old_value_update = $this->update;
   $old_value_avprice = $this->avprice;
   $old_value_lastyry = $this->lastyry;
   $old_value_lastyrd = $this->lastyrd;
   $old_value_dyeleft = $this->dyeleft;
   $old_value_ozsquare = $this->ozsquare;
   $old_value_ozlin = $this->ozlin;
   $old_value_sqlb = $this->sqlb;
   $old_value_meterkilo = $this->meterkilo;
   $old_value_meter2kilo = $this->meter2kilo;
   $old_value_grammeter = $this->grammeter;
   $old_value_grammeter2 = $this->grammeter2;
   $old_value_date1 = $this->date1;
   $old_value_date2 = $this->date2;
   $old_value_date3 = $this->date3;
   $old_value_date4 = $this->date4;
   $old_value_date5 = $this->date5;
   $old_value_date6 = $this->date6;
   $old_value_conv2 = $this->conv2;
   $old_value_conv3 = $this->conv3;
   $old_value_conv = $this->conv;
   $old_value_stdcost = $this->stdcost;
   $old_value_stdgp = $this->stdgp;
   $old_value_sprice = $this->sprice;
   $old_value_avcost = $this->avcost;
   $old_value_lbbo = $this->lbbo;
   $old_value_bo = $this->bo;
   $old_value_samples = $this->samples;
   $this->nm_tira_formatacao();
   $this->nm_converte_datas(false);


   $unformatted_value_date = $this->date;
   $unformatted_value_per1 = $this->per1;
   $unformatted_value_per2 = $this->per2;
   $unformatted_value_per3 = $this->per3;
   $unformatted_value_per4 = $this->per4;
   $unformatted_value_nprice = $this->nprice;
   $unformatted_value_npdate = $this->npdate;
   $unformatted_value_yds = $this->yds;
   $unformatted_value_lbs = $this->lbs;
   $unformatted_value_dye = $this->dye;
   $unformatted_value_gc = $this->gc;
   $unformatted_value_fc = $this->fc;
   $unformatted_value_gshort = $this->gshort;
   $unformatted_value_ytdd = $this->ytdd;
   $unformatted_value_ytdy = $this->ytdy;
   $unformatted_value_mtdd = $this->mtdd;
   $unformatted_value_mtdy = $this->mtdy;
   $unformatted_value_histy = $this->histy;
   $unformatted_value_histd = $this->histd;
   $unformatted_value_update = $this->update;
   $unformatted_value_avprice = $this->avprice;
   $unformatted_value_lastyry = $this->lastyry;
   $unformatted_value_lastyrd = $this->lastyrd;
   $unformatted_value_dyeleft = $this->dyeleft;
   $unformatted_value_ozsquare = $this->ozsquare;
   $unformatted_value_ozlin = $this->ozlin;
   $unformatted_value_sqlb = $this->sqlb;
   $unformatted_value_meterkilo = $this->meterkilo;
   $unformatted_value_meter2kilo = $this->meter2kilo;
   $unformatted_value_grammeter = $this->grammeter;
   $unformatted_value_grammeter2 = $this->grammeter2;
   $unformatted_value_date1 = $this->date1;
   $unformatted_value_date2 = $this->date2;
   $unformatted_value_date3 = $this->date3;
   $unformatted_value_date4 = $this->date4;
   $unformatted_value_date5 = $this->date5;
   $unformatted_value_date6 = $this->date6;
   $unformatted_value_conv2 = $this->conv2;
   $unformatted_value_conv3 = $this->conv3;
   $unformatted_value_conv = $this->conv;
   $unformatted_value_stdcost = $this->stdcost;
   $unformatted_value_stdgp = $this->stdgp;
   $unformatted_value_sprice = $this->sprice;
   $unformatted_value_avcost = $this->avcost;
   $unformatted_value_lbbo = $this->lbbo;
   $unformatted_value_bo = $this->bo;
   $unformatted_value_samples = $this->samples;

   $nm_comando = "SELECT ECODE, ENDUSE 
FROM enduse 
ORDER BY ENDUSE";

   $this->date = $old_value_date;
   $this->per1 = $old_value_per1;
   $this->per2 = $old_value_per2;
   $this->per3 = $old_value_per3;
   $this->per4 = $old_value_per4;
   $this->nprice = $old_value_nprice;
   $this->npdate = $old_value_npdate;
   $this->yds = $old_value_yds;
   $this->lbs = $old_value_lbs;
   $this->dye = $old_value_dye;
   $this->gc = $old_value_gc;
   $this->fc = $old_value_fc;
   $this->gshort = $old_value_gshort;
   $this->ytdd = $old_value_ytdd;
   $this->ytdy = $old_value_ytdy;
   $this->mtdd = $old_value_mtdd;
   $this->mtdy = $old_value_mtdy;
   $this->histy = $old_value_histy;
   $this->histd = $old_value_histd;
   $this->update = $old_value_update;
   $this->avprice = $old_value_avprice;
   $this->lastyry = $old_value_lastyry;
   $this->lastyrd = $old_value_lastyrd;
   $this->dyeleft = $old_value_dyeleft;
   $this->ozsquare = $old_value_ozsquare;
   $this->ozlin = $old_value_ozlin;
   $this->sqlb = $old_value_sqlb;
   $this->meterkilo = $old_value_meterkilo;
   $this->meter2kilo = $old_value_meter2kilo;
   $this->grammeter = $old_value_grammeter;
   $this->grammeter2 = $old_value_grammeter2;
   $this->date1 = $old_value_date1;
   $this->date2 = $old_value_date2;
   $this->date3 = $old_value_date3;
   $this->date4 = $old_value_date4;
   $this->date5 = $old_value_date5;
   $this->date6 = $old_value_date6;
   $this->conv2 = $old_value_conv2;
   $this->conv3 = $old_value_conv3;
   $this->conv = $old_value_conv;
   $this->stdcost = $old_value_stdcost;
   $this->stdgp = $old_value_stdgp;
   $this->sprice = $old_value_sprice;
   $this->avcost = $old_value_avcost;
   $this->lbbo = $old_value_lbbo;
   $this->bo = $old_value_bo;
   $this->samples = $old_value_samples;

   $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nm_comando; 
   $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
   if ($nm_comando != "" && $rs = $this->Db->Execute($nm_comando)) 
   {
       while (!$rs->EOF) 
       { 
              $aLookup[] = array(line_form_pack_protect_string($rs->fields[0]) => line_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]['line_form']['Lookup_end5'][] = $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=\"end5\"";
          if (isset($this->NM_ajax_info['select_html']['end5']) && !empty($this->NM_ajax_info['select_html']['end5']))
          {
              $sSelComp = $this->NM_ajax_info['select_html']['end5'];
          }
          $sLookup = '';
          if (empty($aLookup))
          {
              $aLookup[] = array('' => '');
          }
          foreach ($aLookup as $aOption)
          {
              foreach ($aOption as $sValue => $sLabel)
              {

                  if ($this->end5 == $sValue)
                  {
                      $this->_tmp_lookup_end5 = $sLabel;
                  }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          //----- sqlb
   function ajax_return_values_sqlb($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("sqlb", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->sqlb);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['sqlb'] = 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),
              );
          }
   }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          //----- cgs
   function ajax_return_values_cgs($bForce = false)
   {
          if ('navigate_form' == $this->NM_ajax_opcao || 'backup_line' == $this->NM_ajax_opcao || (isset($this->nmgp_refresh_fields) && in_array("cgs", $this->nmgp_refresh_fields)) || $bForce)
          {
              $sTmpValue = NM_charset_to_utf8($this->cgs);
              $aLookup = array();
          $aLookupOrig = $aLookup;
          $this->NM_ajax_info['fldList']['cgs'] = array(
                       'row'    => '',
               'type'    => 'text',
               '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),
              );
          }
   }

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

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

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

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

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

   function ajax_add_parameters()
   {
       $this->NM_ajax_info['btnVars']['var_btn_Greige_var_fs'] = $this->nmgp_dados_form['style'];
       $this->NM_ajax_info['btnVars']['var_btn_sc_btn_2_var_style'] = $this->nmgp_dados_form['style'];
       $this->NM_ajax_info['btnVars']['var_btn_sc_btn_3_var_style'] = $this->nmgp_dados_form['style'];
       $this->NM_ajax_info['btnVars']['var_btn_Sampling_var_fs'] = $this->nmgp_dados_form['style'];
   } // ajax_add_parameters
  function nm_proc_onload($bFormat = true)
  {
      if (!$this->NM_ajax_flag || !isset($this->nmgp_refresh_fields)) {
      $_SESSION['scriptcase']['line_form']['contr_erro'] = 'on';
if (isset($this->NM_ajax_flag) && $this->NM_ajax_flag)
{
    $original_line = $this->line;
    $original_style = $this->style;
}
if (!isset($this->sc_temp_var_style)) {$this->sc_temp_var_style = (isset($_SESSION['var_style'])) ? $_SESSION['var_style'] : "";}
if (!isset($this->sc_temp_var_line)) {$this->sc_temp_var_line = (isset($_SESSION['var_line'])) ? $_SESSION['var_line'] : "";}
       $this->sc_temp_var_line = $this->line ;
$this->sc_temp_var_style = $this->style ;
if (isset($this->sc_temp_var_line)) { $_SESSION['var_line'] = $this->sc_temp_var_line;}
if (isset($this->sc_temp_var_style)) { $_SESSION['var_style'] = $this->sc_temp_var_style;}
if (isset($this->NM_ajax_flag) && $this->NM_ajax_flag)
{
    if (($original_line != $this->line || (isset($bFlagRead_line) && $bFlagRead_line)))
    {
        $this->ajax_return_values_line(true);
    }
    if (($original_style != $this->style || (isset($bFlagRead_style) && $bFlagRead_style)))
    {
        $this->ajax_return_values_style(true);
    }
}
$_SESSION['scriptcase']['line_form']['contr_erro'] = 'off'; 
      }
      $this->nm_guardar_campos();
      if ($bFormat) $this->nm_formatar_campos();
  }
//
//----------------------------------------------------
//-----> 
//----------------------------------------------------
//
   function nm_troca_decimal($sc_parm1, $sc_parm2) 
   { 
      $this->nprice = str_replace($sc_parm1, $sc_parm2, $this->nprice); 
      $this->gc = str_replace($sc_parm1, $sc_parm2, $this->gc); 
      $this->fc = str_replace($sc_parm1, $sc_parm2, $this->fc); 
      $this->ytdd = str_replace($sc_parm1, $sc_parm2, $this->ytdd); 
      $this->ytdy = str_replace($sc_parm1, $sc_parm2, $this->ytdy); 
      $this->mtdd = str_replace($sc_parm1, $sc_parm2, $this->mtdd); 
      $this->mtdy = str_replace($sc_parm1, $sc_parm2, $this->mtdy); 
      $this->histy = str_replace($sc_parm1, $sc_parm2, $this->histy); 
      $this->histd = str_replace($sc_parm1, $sc_parm2, $this->histd); 
      $this->avprice = str_replace($sc_parm1, $sc_parm2, $this->avprice); 
      $this->lastyry = str_replace($sc_parm1, $sc_parm2, $this->lastyry); 
      $this->lastyrd = str_replace($sc_parm1, $sc_parm2, $this->lastyrd); 
      $this->ozsquare = str_replace($sc_parm1, $sc_parm2, $this->ozsquare); 
      $this->ozlin = str_replace($sc_parm1, $sc_parm2, $this->ozlin); 
      $this->sqlb = str_replace($sc_parm1, $sc_parm2, $this->sqlb); 
      $this->meterkilo = str_replace($sc_parm1, $sc_parm2, $this->meterkilo); 
      $this->meter2kilo = str_replace($sc_parm1, $sc_parm2, $this->meter2kilo); 
      $this->grammeter = str_replace($sc_parm1, $sc_parm2, $this->grammeter); 
      $this->grammeter2 = str_replace($sc_parm1, $sc_parm2, $this->grammeter2); 
      $this->conv2 = str_replace($sc_parm1, $sc_parm2, $this->conv2); 
      $this->conv3 = str_replace($sc_parm1, $sc_parm2, $this->conv3); 
      $this->conv = str_replace($sc_parm1, $sc_parm2, $this->conv); 
      $this->stdcost = str_replace($sc_parm1, $sc_parm2, $this->stdcost); 
      $this->stdgp = str_replace($sc_parm1, $sc_parm2, $this->stdgp); 
      $this->sprice = str_replace($sc_parm1, $sc_parm2, $this->sprice); 
      $this->avcost = str_replace($sc_parm1, $sc_parm2, $this->avcost); 
   } 
   function nm_poe_aspas_decimal() 
   { 
      $this->nprice = "'" . $this->nprice . "'";
      $this->gc = "'" . $this->gc . "'";
      $this->fc = "'" . $this->fc . "'";
      $this->ytdd = "'" . $this->ytdd . "'";
      $this->ytdy = "'" . $this->ytdy . "'";
      $this->mtdd = "'" . $this->mtdd . "'";
      $this->mtdy = "'" . $this->mtdy . "'";
      $this->histy = "'" . $this->histy . "'";
      $this->histd = "'" . $this->histd . "'";
      $this->avprice = "'" . $this->avprice . "'";
      $this->lastyry = "'" . $this->lastyry . "'";
      $this->lastyrd = "'" . $this->lastyrd . "'";
      $this->ozsquare = "'" . $this->ozsquare . "'";
      $this->ozlin = "'" . $this->ozlin . "'";
      $this->sqlb = "'" . $this->sqlb . "'";
      $this->meterkilo = "'" . $this->meterkilo . "'";
      $this->meter2kilo = "'" . $this->meter2kilo . "'";
      $this->grammeter = "'" . $this->grammeter . "'";
      $this->grammeter2 = "'" . $this->grammeter2 . "'";
      $this->conv2 = "'" . $this->conv2 . "'";
      $this->conv3 = "'" . $this->conv3 . "'";
      $this->conv = "'" . $this->conv . "'";
      $this->stdcost = "'" . $this->stdcost . "'";
      $this->stdgp = "'" . $this->stdgp . "'";
      $this->sprice = "'" . $this->sprice . "'";
      $this->avcost = "'" . $this->avcost . "'";
   } 
   function nm_tira_aspas_decimal() 
   { 
      $this->nprice = str_replace("'", "", $this->nprice); 
      $this->gc = str_replace("'", "", $this->gc); 
      $this->fc = str_replace("'", "", $this->fc); 
      $this->ytdd = str_replace("'", "", $this->ytdd); 
      $this->ytdy = str_replace("'", "", $this->ytdy); 
      $this->mtdd = str_replace("'", "", $this->mtdd); 
      $this->mtdy = str_replace("'", "", $this->mtdy); 
      $this->histy = str_replace("'", "", $this->histy); 
      $this->histd = str_replace("'", "", $this->histd); 
      $this->avprice = str_replace("'", "", $this->avprice); 
      $this->lastyry = str_replace("'", "", $this->lastyry); 
      $this->lastyrd = str_replace("'", "", $this->lastyrd); 
      $this->ozsquare = str_replace("'", "", $this->ozsquare); 
      $this->ozlin = str_replace("'", "", $this->ozlin); 
      $this->sqlb = str_replace("'", "", $this->sqlb); 
      $this->meterkilo = str_replace("'", "", $this->meterkilo); 
      $this->meter2kilo = str_replace("'", "", $this->meter2kilo); 
      $this->grammeter = str_replace("'", "", $this->grammeter); 
      $this->grammeter2 = str_replace("'", "", $this->grammeter2); 
      $this->conv2 = str_replace("'", "", $this->conv2); 
      $this->conv3 = str_replace("'", "", $this->conv3); 
      $this->conv = str_replace("'", "", $this->conv); 
      $this->stdcost = str_replace("'", "", $this->stdcost); 
      $this->stdgp = str_replace("'", "", $this->stdgp); 
      $this->sprice = str_replace("'", "", $this->sprice); 
      $this->avcost = str_replace("'", "", $this->avcost); 
   } 
//----------- 


   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['image'] = $this->image;
      $NM_val_form['style'] = $this->style;
      $NM_val_form['name'] = $this->name;
      $NM_val_form['width'] = $this->width;
      $NM_val_form['comment'] = $this->comment;
      $NM_val_form['fiber'] = $this->fiber;
      $NM_val_form['desc'] = $this->desc;
      $NM_val_form['line'] = $this->line;
      $NM_val_form['dept'] = $this->dept;
      $NM_val_form['odesc'] = $this->odesc;
      $NM_val_form['hand'] = $this->hand;
      $NM_val_form['date'] = $this->date;
      $NM_val_form['mindye'] = $this->mindye;
      $NM_val_form['minord'] = $this->minord;
      $NM_val_form['yarn1'] = $this->yarn1;
      $NM_val_form['per1'] = $this->per1;
      $NM_val_form['yarn2'] = $this->yarn2;
      $NM_val_form['per2'] = $this->per2;
      $NM_val_form['yarn3'] = $this->yarn3;
      $NM_val_form['per3'] = $this->per3;
      $NM_val_form['yarn4'] = $this->yarn4;
      $NM_val_form['per4'] = $this->per4;
      $NM_val_form['del1'] = $this->del1;
      $NM_val_form['del2'] = $this->del2;
      $NM_val_form['del3'] = $this->del3;
      $NM_val_form['end1'] = $this->end1;
      $NM_val_form['end2'] = $this->end2;
      $NM_val_form['end3'] = $this->end3;
      $NM_val_form['end4'] = $this->end4;
      $NM_val_form['end5'] = $this->end5;
      $NM_val_form['price'] = $this->price;
      $NM_val_form['med'] = $this->med;
      $NM_val_form['dark'] = $this->dark;
      $NM_val_form['nprice'] = $this->nprice;
      $NM_val_form['npdate'] = $this->npdate;
      $NM_val_form['memo'] = $this->memo;
      $NM_val_form['smemo'] = $this->smemo;
      $NM_val_form['yds'] = $this->yds;
      $NM_val_form['lbs'] = $this->lbs;
      $NM_val_form['dye'] = $this->dye;
      $NM_val_form['gc'] = $this->gc;
      $NM_val_form['fc'] = $this->fc;
      $NM_val_form['spec'] = $this->spec;
      $NM_val_form['gshort'] = $this->gshort;
      $NM_val_form['ytdd'] = $this->ytdd;
      $NM_val_form['ytdy'] = $this->ytdy;
      $NM_val_form['mtdd'] = $this->mtdd;
      $NM_val_form['mtdy'] = $this->mtdy;
      $NM_val_form['histy'] = $this->histy;
      $NM_val_form['histd'] = $this->histd;
      $NM_val_form['update'] = $this->update;
      $NM_val_form['avprice'] = $this->avprice;
      $NM_val_form['lastyry'] = $this->lastyry;
      $NM_val_form['lastyrd'] = $this->lastyrd;
      $NM_val_form['dyeleft'] = $this->dyeleft;
      $NM_val_form['ozsquare'] = $this->ozsquare;
      $NM_val_form['ozlin'] = $this->ozlin;
      $NM_val_form['sqlb'] = $this->sqlb;
      $NM_val_form['cpi'] = $this->cpi;
      $NM_val_form['wpi'] = $this->wpi;
      $NM_val_form['finwt'] = $this->finwt;
      $NM_val_form['meterkilo'] = $this->meterkilo;
      $NM_val_form['meter2kilo'] = $this->meter2kilo;
      $NM_val_form['grammeter'] = $this->grammeter;
      $NM_val_form['grammeter2'] = $this->grammeter2;
      $NM_val_form['stdputup'] = $this->stdputup;
      $NM_val_form['stdtube'] = $this->stdtube;
      $NM_val_form['date1'] = $this->date1;
      $NM_val_form['date2'] = $this->date2;
      $NM_val_form['date3'] = $this->date3;
      $NM_val_form['date4'] = $this->date4;
      $NM_val_form['date5'] = $this->date5;
      $NM_val_form['date6'] = $this->date6;
      $NM_val_form['name1'] = $this->name1;
      $NM_val_form['name2'] = $this->name2;
      $NM_val_form['name3'] = $this->name3;
      $NM_val_form['name4'] = $this->name4;
      $NM_val_form['name5'] = $this->name5;
      $NM_val_form['name6'] = $this->name6;
      $NM_val_form['method1'] = $this->method1;
      $NM_val_form['method2'] = $this->method2;
      $NM_val_form['method3'] = $this->method3;
      $NM_val_form['method4'] = $this->method4;
      $NM_val_form['method5'] = $this->method5;
      $NM_val_form['method6'] = $this->method6;
      $NM_val_form['test1'] = $this->test1;
      $NM_val_form['test2'] = $this->test2;
      $NM_val_form['test3'] = $this->test3;
      $NM_val_form['test4'] = $this->test4;
      $NM_val_form['lot1'] = $this->lot1;
      $NM_val_form['lot2'] = $this->lot2;
      $NM_val_form['lot3'] = $this->lot3;
      $NM_val_form['lot4'] = $this->lot4;
      $NM_val_form['lot5'] = $this->lot5;
      $NM_val_form['lot6'] = $this->lot6;
      $NM_val_form['result1'] = $this->result1;
      $NM_val_form['result2'] = $this->result2;
      $NM_val_form['result3'] = $this->result3;
      $NM_val_form['result4'] = $this->result4;
      $NM_val_form['result5'] = $this->result5;
      $NM_val_form['result6'] = $this->result6;
      $NM_val_form['sname1'] = $this->sname1;
      $NM_val_form['sname2'] = $this->sname2;
      $NM_val_form['sname3'] = $this->sname3;
      $NM_val_form['smethod1'] = $this->smethod1;
      $NM_val_form['smethod2'] = $this->smethod2;
      $NM_val_form['smethod3'] = $this->smethod3;
      $NM_val_form['sstd1'] = $this->sstd1;
      $NM_val_form['sstd2'] = $this->sstd2;
      $NM_val_form['sstd3'] = $this->sstd3;
      $NM_val_form['stol1'] = $this->stol1;
      $NM_val_form['stol2'] = $this->stol2;
      $NM_val_form['stol3'] = $this->stol3;
      $NM_val_form['conv2'] = $this->conv2;
      $NM_val_form['conv3'] = $this->conv3;
      $NM_val_form['conv'] = $this->conv;
      $NM_val_form['stdcost'] = $this->stdcost;
      $NM_val_form['stdgp'] = $this->stdgp;
      $NM_val_form['sprice'] = $this->sprice;
      $NM_val_form['avcost'] = $this->avcost;
      $NM_val_form['stdcosting'] = $this->stdcosting;
      $NM_val_form['machine'] = $this->machine;
      $NM_val_form['cgs'] = $this->cgs;
      $NM_val_form['gs'] = $this->gs;
      $NM_val_form['k'] = $this->k;
      $NM_val_form['grstyle'] = $this->grstyle;
      $NM_val_form['lbbo'] = $this->lbbo;
      $NM_val_form['bo'] = $this->bo;
      $NM_val_form['samples'] = $this->samples;
      $NM_val_form['id2'] = $this->id2;
      if ($this->sprice == "")  
      { 
          $this->sprice = 0;
          $this->sc_force_zero[] = 'sprice';
      } 
      if ($this->nprice == "")  
      { 
          $this->nprice = 0;
          $this->sc_force_zero[] = 'nprice';
      } 
      if ($this->stdcost == "")  
      { 
          $this->stdcost = 0;
          $this->sc_force_zero[] = 'stdcost';
      } 
      if ($this->stdgp == "")  
      { 
          $this->stdgp = 0;
          $this->sc_force_zero[] = 'stdgp';
      } 
      if ($this->avcost == "")  
      { 
          $this->avcost = 0;
          $this->sc_force_zero[] = 'avcost';
      } 
      if ($this->yds == "")  
      { 
          $this->yds = 0;
          $this->sc_force_zero[] = 'yds';
      } 
      if ($this->lbs == "")  
      { 
          $this->lbs = 0;
          $this->sc_force_zero[] = 'lbs';
      } 
      if ($this->lbbo == "")  
      { 
          $this->lbbo = 0;
          $this->sc_force_zero[] = 'lbbo';
      } 
      if ($this->dye == "")  
      { 
          $this->dye = 0;
          $this->sc_force_zero[] = 'dye';
      } 
      if ($this->bo == "")  
      { 
          $this->bo = 0;
          $this->sc_force_zero[] = 'bo';
      } 
      if ($this->gc == "")  
      { 
          $this->gc = 0;
          $this->sc_force_zero[] = 'gc';
      } 
      if ($this->conv == "")  
      { 
          $this->conv = 0;
          $this->sc_force_zero[] = 'conv';
      } 
      if ($this->fc == "")  
      { 
          $this->fc = 0;
          $this->sc_force_zero[] = 'fc';
      } 
      if ($this->ytdd == "")  
      { 
          $this->ytdd = 0;
          $this->sc_force_zero[] = 'ytdd';
      } 
      if ($this->ytdy == "")  
      { 
          $this->ytdy = 0;
          $this->sc_force_zero[] = 'ytdy';
      } 
      if ($this->mtdd == "")  
      { 
          $this->mtdd = 0;
          $this->sc_force_zero[] = 'mtdd';
      } 
      if ($this->mtdy == "")  
      { 
          $this->mtdy = 0;
          $this->sc_force_zero[] = 'mtdy';
      } 
      if ($this->histy == "")  
      { 
          $this->histy = 0;
          $this->sc_force_zero[] = 'histy';
      } 
      if ($this->histd == "")  
      { 
          $this->histd = 0;
          $this->sc_force_zero[] = 'histd';
      } 
      if ($this->avprice == "")  
      { 
          $this->avprice = 0;
          $this->sc_force_zero[] = 'avprice';
      } 
      if ($this->lastyry == "")  
      { 
          $this->lastyry = 0;
          $this->sc_force_zero[] = 'lastyry';
      } 
      if ($this->lastyrd == "")  
      { 
          $this->lastyrd = 0;
          $this->sc_force_zero[] = 'lastyrd';
      } 
      if ($this->gshort == "")  
      { 
          $this->gshort = 0;
          $this->sc_force_zero[] = 'gshort';
      } 
      if ($this->conv2 == "")  
      { 
          $this->conv2 = 0;
          $this->sc_force_zero[] = 'conv2';
      } 
      if ($this->conv3 == "")  
      { 
          $this->conv3 = 0;
          $this->sc_force_zero[] = 'conv3';
      } 
      if ($this->samples == "")  
      { 
          $this->samples = 0;
          $this->sc_force_zero[] = 'samples';
      } 
      if ($this->dyeleft == "")  
      { 
          $this->dyeleft = 0;
          $this->sc_force_zero[] = 'dyeleft';
      } 
      if ($this->per1 == "")  
      { 
          $this->per1 = 0;
          $this->sc_force_zero[] = 'per1';
      } 
      if ($this->per2 == "")  
      { 
          $this->per2 = 0;
          $this->sc_force_zero[] = 'per2';
      } 
      if ($this->per3 == "")  
      { 
          $this->per3 = 0;
          $this->sc_force_zero[] = 'per3';
      } 
      if ($this->per4 == "")  
      { 
          $this->per4 = 0;
          $this->sc_force_zero[] = 'per4';
      } 
      if ($this->ozsquare == "")  
      { 
          $this->ozsquare = 0;
          $this->sc_force_zero[] = 'ozsquare';
      } 
      if ($this->ozlin == "")  
      { 
          $this->ozlin = 0;
          $this->sc_force_zero[] = 'ozlin';
      } 
      if ($this->sqlb == "")  
      { 
          $this->sqlb = 0;
          $this->sc_force_zero[] = 'sqlb';
      } 
      if ($this->meterkilo == "")  
      { 
          $this->meterkilo = 0;
          $this->sc_force_zero[] = 'meterkilo';
      } 
      if ($this->meter2kilo == "")  
      { 
          $this->meter2kilo = 0;
          $this->sc_force_zero[] = 'meter2kilo';
      } 
      if ($this->grammeter == "")  
      { 
          $this->grammeter = 0;
          $this->sc_force_zero[] = 'grammeter';
      } 
      if ($this->grammeter2 == "")  
      { 
          $this->grammeter2 = 0;
          $this->sc_force_zero[] = 'grammeter2';
      } 
      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]['line_form']['decimal_db'] == ",") 
      {
          $this->nm_troca_decimal(".", ",");
      }
      if ($this->nmgp_opcao == "alterar" || $this->nmgp_opcao == "incluir") 
      {
          $this->style = substr($this->Db->qstr($this->style), 1, -1); 
          if ($this->style == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->style = "null"; 
              $NM_val_null[] = "style";
          } 
          $this->name = substr($this->Db->qstr($this->name), 1, -1); 
          if ($this->name == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->name = "null"; 
              $NM_val_null[] = "name";
          } 
          $this->width = substr($this->Db->qstr($this->width), 1, -1); 
          if ($this->width == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->width = "null"; 
              $NM_val_null[] = "width";
          } 
          $this->fiber = substr($this->Db->qstr($this->fiber), 1, -1); 
          if ($this->fiber == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->fiber = "null"; 
              $NM_val_null[] = "fiber";
          } 
          $this->desc = substr($this->Db->qstr($this->desc), 1, -1); 
          if ($this->desc == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->desc = "null"; 
              $NM_val_null[] = "desc";
          } 
          $this->odesc = substr($this->Db->qstr($this->odesc), 1, -1); 
          if ($this->odesc == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->odesc = "null"; 
              $NM_val_null[] = "odesc";
          } 
          $this->price = substr($this->Db->qstr($this->price), 1, -1); 
          if ($this->price == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->price = "null"; 
              $NM_val_null[] = "price";
          } 
          $this->med = substr($this->Db->qstr($this->med), 1, -1); 
          if ($this->med == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->med = "null"; 
              $NM_val_null[] = "med";
          } 
          $this->dark = substr($this->Db->qstr($this->dark), 1, -1); 
          if ($this->dark == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->dark = "null"; 
              $NM_val_null[] = "dark";
          } 
          $this->hand = substr($this->Db->qstr($this->hand), 1, -1); 
          if ($this->hand == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->hand = "null"; 
              $NM_val_null[] = "hand";
          } 
          if ($this->npdate == "")  
          { 
              $this->npdate = "null"; 
              $NM_val_null[] = "npdate";
          } 
          $this->end1 = substr($this->Db->qstr($this->end1), 1, -1); 
          if ($this->end1 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->end1 = "null"; 
              $NM_val_null[] = "end1";
          } 
          $this->end2 = substr($this->Db->qstr($this->end2), 1, -1); 
          if ($this->end2 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->end2 = "null"; 
              $NM_val_null[] = "end2";
          } 
          $this->end3 = substr($this->Db->qstr($this->end3), 1, -1); 
          if ($this->end3 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->end3 = "null"; 
              $NM_val_null[] = "end3";
          } 
          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->k = substr($this->Db->qstr($this->k), 1, -1); 
          if ($this->k == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->k = "null"; 
              $NM_val_null[] = "k";
          } 
          $this->mindye = substr($this->Db->qstr($this->mindye), 1, -1); 
          if ($this->mindye == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->mindye = "null"; 
              $NM_val_null[] = "mindye";
          } 
          $this->minord = substr($this->Db->qstr($this->minord), 1, -1); 
          if ($this->minord == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->minord = "null"; 
              $NM_val_null[] = "minord";
          } 
          $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->finwt = substr($this->Db->qstr($this->finwt), 1, -1); 
          if ($this->finwt == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->finwt = "null"; 
              $NM_val_null[] = "finwt";
          } 
          $this->machine = substr($this->Db->qstr($this->machine), 1, -1); 
          if ($this->machine == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->machine = "null"; 
              $NM_val_null[] = "machine";
          } 
          $this->end4 = substr($this->Db->qstr($this->end4), 1, -1); 
          if ($this->end4 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->end4 = "null"; 
              $NM_val_null[] = "end4";
          } 
          $this->end5 = substr($this->Db->qstr($this->end5), 1, -1); 
          if ($this->end5 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->end5 = "null"; 
              $NM_val_null[] = "end5";
          } 
          $this->comment = substr($this->Db->qstr($this->comment), 1, -1); 
          if ($this->comment == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->comment = "null"; 
              $NM_val_null[] = "comment";
          } 
          $this->spec = substr($this->Db->qstr($this->spec), 1, -1); 
          if ($this->spec == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->spec = "null"; 
              $NM_val_null[] = "spec";
          } 
          $this->memo = substr($this->Db->qstr($this->memo), 1, -1); 
          if ($this->memo == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->memo = "null"; 
              $NM_val_null[] = "memo";
          } 
          if ($this->update == "")  
          { 
              $this->update = "null"; 
              $NM_val_null[] = "update";
          } 
          $this->dept = substr($this->Db->qstr($this->dept), 1, -1); 
          if ($this->dept == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->dept = "null"; 
              $NM_val_null[] = "dept";
          } 
          $this->line = substr($this->Db->qstr($this->line), 1, -1); 
          if ($this->line == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->line = "null"; 
              $NM_val_null[] = "line";
          } 
          $this->yarn1 = substr($this->Db->qstr($this->yarn1), 1, -1); 
          if ($this->yarn1 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->yarn1 = "null"; 
              $NM_val_null[] = "yarn1";
          } 
          $this->yarn2 = substr($this->Db->qstr($this->yarn2), 1, -1); 
          if ($this->yarn2 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->yarn2 = "null"; 
              $NM_val_null[] = "yarn2";
          } 
          $this->yarn3 = substr($this->Db->qstr($this->yarn3), 1, -1); 
          if ($this->yarn3 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->yarn3 = "null"; 
              $NM_val_null[] = "yarn3";
          } 
          $this->yarn4 = substr($this->Db->qstr($this->yarn4), 1, -1); 
          if ($this->yarn4 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->yarn4 = "null"; 
              $NM_val_null[] = "yarn4";
          } 
          $this->del1 = substr($this->Db->qstr($this->del1), 1, -1); 
          if ($this->del1 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->del1 = "null"; 
              $NM_val_null[] = "del1";
          } 
          $this->del2 = substr($this->Db->qstr($this->del2), 1, -1); 
          if ($this->del2 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->del2 = "null"; 
              $NM_val_null[] = "del2";
          } 
          $this->del3 = substr($this->Db->qstr($this->del3), 1, -1); 
          if ($this->del3 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->del3 = "null"; 
              $NM_val_null[] = "del3";
          } 
          $this->stdputup = substr($this->Db->qstr($this->stdputup), 1, -1); 
          if ($this->stdputup == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->stdputup = "null"; 
              $NM_val_null[] = "stdputup";
          } 
          $this->stdtube = substr($this->Db->qstr($this->stdtube), 1, -1); 
          if ($this->stdtube == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->stdtube = "null"; 
              $NM_val_null[] = "stdtube";
          } 
          if ($this->date1 == "")  
          { 
              $this->date1 = "null"; 
              $NM_val_null[] = "date1";
          } 
          if ($this->date2 == "")  
          { 
              $this->date2 = "null"; 
              $NM_val_null[] = "date2";
          } 
          if ($this->date3 == "")  
          { 
              $this->date3 = "null"; 
              $NM_val_null[] = "date3";
          } 
          if ($this->date4 == "")  
          { 
              $this->date4 = "null"; 
              $NM_val_null[] = "date4";
          } 
          if ($this->date5 == "")  
          { 
              $this->date5 = "null"; 
              $NM_val_null[] = "date5";
          } 
          if ($this->date6 == "")  
          { 
              $this->date6 = "null"; 
              $NM_val_null[] = "date6";
          } 
          $this->name1 = substr($this->Db->qstr($this->name1), 1, -1); 
          if ($this->name1 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->name1 = "null"; 
              $NM_val_null[] = "name1";
          } 
          $this->name2 = substr($this->Db->qstr($this->name2), 1, -1); 
          if ($this->name2 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->name2 = "null"; 
              $NM_val_null[] = "name2";
          } 
          $this->name3 = substr($this->Db->qstr($this->name3), 1, -1); 
          if ($this->name3 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->name3 = "null"; 
              $NM_val_null[] = "name3";
          } 
          $this->name4 = substr($this->Db->qstr($this->name4), 1, -1); 
          if ($this->name4 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->name4 = "null"; 
              $NM_val_null[] = "name4";
          } 
          $this->name5 = substr($this->Db->qstr($this->name5), 1, -1); 
          if ($this->name5 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->name5 = "null"; 
              $NM_val_null[] = "name5";
          } 
          $this->name6 = substr($this->Db->qstr($this->name6), 1, -1); 
          if ($this->name6 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->name6 = "null"; 
              $NM_val_null[] = "name6";
          } 
          $this->method1 = substr($this->Db->qstr($this->method1), 1, -1); 
          if ($this->method1 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->method1 = "null"; 
              $NM_val_null[] = "method1";
          } 
          $this->method2 = substr($this->Db->qstr($this->method2), 1, -1); 
          if ($this->method2 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->method2 = "null"; 
              $NM_val_null[] = "method2";
          } 
          $this->method3 = substr($this->Db->qstr($this->method3), 1, -1); 
          if ($this->method3 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->method3 = "null"; 
              $NM_val_null[] = "method3";
          } 
          $this->method4 = substr($this->Db->qstr($this->method4), 1, -1); 
          if ($this->method4 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->method4 = "null"; 
              $NM_val_null[] = "method4";
          } 
          $this->method5 = substr($this->Db->qstr($this->method5), 1, -1); 
          if ($this->method5 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->method5 = "null"; 
              $NM_val_null[] = "method5";
          } 
          $this->method6 = substr($this->Db->qstr($this->method6), 1, -1); 
          if ($this->method6 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->method6 = "null"; 
              $NM_val_null[] = "method6";
          } 
          $this->test1 = substr($this->Db->qstr($this->test1), 1, -1); 
          if ($this->test1 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->test1 = "null"; 
              $NM_val_null[] = "test1";
          } 
          $this->test2 = substr($this->Db->qstr($this->test2), 1, -1); 
          if ($this->test2 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->test2 = "null"; 
              $NM_val_null[] = "test2";
          } 
          $this->test3 = substr($this->Db->qstr($this->test3), 1, -1); 
          if ($this->test3 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->test3 = "null"; 
              $NM_val_null[] = "test3";
          } 
          $this->test4 = substr($this->Db->qstr($this->test4), 1, -1); 
          if ($this->test4 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->test4 = "null"; 
              $NM_val_null[] = "test4";
          } 
          $this->lot1 = substr($this->Db->qstr($this->lot1), 1, -1); 
          if ($this->lot1 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->lot1 = "null"; 
              $NM_val_null[] = "lot1";
          } 
          $this->lot2 = substr($this->Db->qstr($this->lot2), 1, -1); 
          if ($this->lot2 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->lot2 = "null"; 
              $NM_val_null[] = "lot2";
          } 
          $this->lot3 = substr($this->Db->qstr($this->lot3), 1, -1); 
          if ($this->lot3 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->lot3 = "null"; 
              $NM_val_null[] = "lot3";
          } 
          $this->lot4 = substr($this->Db->qstr($this->lot4), 1, -1); 
          if ($this->lot4 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->lot4 = "null"; 
              $NM_val_null[] = "lot4";
          } 
          $this->lot5 = substr($this->Db->qstr($this->lot5), 1, -1); 
          if ($this->lot5 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->lot5 = "null"; 
              $NM_val_null[] = "lot5";
          } 
          $this->lot6 = substr($this->Db->qstr($this->lot6), 1, -1); 
          if ($this->lot6 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->lot6 = "null"; 
              $NM_val_null[] = "lot6";
          } 
          $this->result1 = substr($this->Db->qstr($this->result1), 1, -1); 
          if ($this->result1 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->result1 = "null"; 
              $NM_val_null[] = "result1";
          } 
          $this->result2 = substr($this->Db->qstr($this->result2), 1, -1); 
          if ($this->result2 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->result2 = "null"; 
              $NM_val_null[] = "result2";
          } 
          $this->result3 = substr($this->Db->qstr($this->result3), 1, -1); 
          if ($this->result3 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->result3 = "null"; 
              $NM_val_null[] = "result3";
          } 
          $this->result4 = substr($this->Db->qstr($this->result4), 1, -1); 
          if ($this->result4 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->result4 = "null"; 
              $NM_val_null[] = "result4";
          } 
          $this->result5 = substr($this->Db->qstr($this->result5), 1, -1); 
          if ($this->result5 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->result5 = "null"; 
              $NM_val_null[] = "result5";
          } 
          $this->result6 = substr($this->Db->qstr($this->result6), 1, -1); 
          if ($this->result6 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->result6 = "null"; 
              $NM_val_null[] = "result6";
          } 
          $this->sname1 = substr($this->Db->qstr($this->sname1), 1, -1); 
          if ($this->sname1 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->sname1 = "null"; 
              $NM_val_null[] = "sname1";
          } 
          $this->sname2 = substr($this->Db->qstr($this->sname2), 1, -1); 
          if ($this->sname2 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->sname2 = "null"; 
              $NM_val_null[] = "sname2";
          } 
          $this->sname3 = substr($this->Db->qstr($this->sname3), 1, -1); 
          if ($this->sname3 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->sname3 = "null"; 
              $NM_val_null[] = "sname3";
          } 
          $this->smethod1 = substr($this->Db->qstr($this->smethod1), 1, -1); 
          if ($this->smethod1 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->smethod1 = "null"; 
              $NM_val_null[] = "smethod1";
          } 
          $this->smethod2 = substr($this->Db->qstr($this->smethod2), 1, -1); 
          if ($this->smethod2 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->smethod2 = "null"; 
              $NM_val_null[] = "smethod2";
          } 
          $this->smethod3 = substr($this->Db->qstr($this->smethod3), 1, -1); 
          if ($this->smethod3 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->smethod3 = "null"; 
              $NM_val_null[] = "smethod3";
          } 
          $this->sstd1 = substr($this->Db->qstr($this->sstd1), 1, -1); 
          if ($this->sstd1 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->sstd1 = "null"; 
              $NM_val_null[] = "sstd1";
          } 
          $this->sstd2 = substr($this->Db->qstr($this->sstd2), 1, -1); 
          if ($this->sstd2 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->sstd2 = "null"; 
              $NM_val_null[] = "sstd2";
          } 
          $this->sstd3 = substr($this->Db->qstr($this->sstd3), 1, -1); 
          if ($this->sstd3 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->sstd3 = "null"; 
              $NM_val_null[] = "sstd3";
          } 
          $this->stol1 = substr($this->Db->qstr($this->stol1), 1, -1); 
          if ($this->stol1 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->stol1 = "null"; 
              $NM_val_null[] = "stol1";
          } 
          $this->stol2 = substr($this->Db->qstr($this->stol2), 1, -1); 
          if ($this->stol2 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->stol2 = "null"; 
              $NM_val_null[] = "stol2";
          } 
          $this->stol3 = substr($this->Db->qstr($this->stol3), 1, -1); 
          if ($this->stol3 == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->stol3 = "null"; 
              $NM_val_null[] = "stol3";
          } 
          $this->cgs = substr($this->Db->qstr($this->cgs), 1, -1); 
          if ($this->cgs == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->cgs = "null"; 
              $NM_val_null[] = "cgs";
          } 
          $this->smemo = substr($this->Db->qstr($this->smemo), 1, -1); 
          if ($this->smemo == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->smemo = "null"; 
              $NM_val_null[] = "smemo";
          } 
          $this->grstyle = substr($this->Db->qstr($this->grstyle), 1, -1); 
          if ($this->grstyle == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->grstyle = "null"; 
              $NM_val_null[] = "grstyle";
          } 
          $this->stdcosting = substr($this->Db->qstr($this->stdcosting), 1, -1); 
          if ($this->stdcosting == "" && in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))  
          { 
              $this->stdcosting = "null"; 
              $NM_val_null[] = "stdcosting";
          } 
      }
      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]['line_form']['foreign_key']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['foreign_key']))
          {
              foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['line_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]['line_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 STYLE = '$this->style' and ID2 = $this->id2 ";
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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 STYLE = '$this->style' and ID2 = $this->id2 ";
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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 STYLE = '$this->style' and ID2 = $this->id2 ";
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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 STYLE = '$this->style' and ID2 = $this->id2 ";
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' and ID2 = $this->id2 "); 
          }  
          else  
          {
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' and ID2 = $this->id2 ";
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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)
              {
                 line_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();
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where (STYLE = '" . $this->style . "') AND (STYLE <> '$this->style' and ID2 <> $this->id2)";
              $rsUni = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where (STYLE = '" . $this->style . "') AND (STYLE <> '$this->style' and ID2 <> $this->id2)");
              if (0 < $rsUni->fields[0])
              {
                  $this->Erro->mensagem (__FILE__, __LINE__, "critica", $this->Ini->Nm_lang['lang_errm_ukey'] . " STYLE"); 
                  $this->nmgp_opcao = "nada"; 
                  $aUpdateOk[] = 'style';
              }
              $rsUni->Close();
          $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 NAME = '$this->name', WIDTH = '$this->width', FIBER = '$this->fiber', `DESC` = '$this->desc', ODESC = '$this->odesc', PRICE = '$this->price', MED = '$this->med', DARK = '$this->dark', HAND = '$this->hand', NPRICE = $this->nprice, NPDATE = #$this->npdate#, END1 = '$this->end1', END2 = '$this->end2', END3 = '$this->end3', GS = '$this->gs', K = '$this->k', MINDYE = '$this->mindye', MINORD = '$this->minord', CPI = '$this->cpi', WPI = '$this->wpi', FINWT = '$this->finwt', MACHINE = '$this->machine', STDGP = $this->stdgp, END4 = '$this->end4', END5 = '$this->end5', CONV = $this->conv, COMMENT = '$this->comment', SPEC = '$this->spec', MEMO = '$this->memo', DEPT = '$this->dept', LINE = '$this->line', YARN1 = '$this->yarn1', PER1 = $this->per1, YARN2 = '$this->yarn2', PER2 = $this->per2, YARN3 = '$this->yarn3', PER3 = $this->per3, YARN4 = '$this->yarn4', PER4 = $this->per4, OZSQUARE = $this->ozsquare, SQLB = $this->sqlb, DEL1 = '$this->del1', DEL2 = '$this->del2', DEL3 = '$this->del3', STDPUTUP = '$this->stdputup', STDTUBE = '$this->stdtube', DATE1 = #$this->date1#, DATE2 = #$this->date2#, DATE3 = #$this->date3#, DATE4 = #$this->date4#, DATE5 = #$this->date5#, DATE6 = #$this->date6#, NAME1 = '$this->name1', NAME2 = '$this->name2', NAME3 = '$this->name3', NAME4 = '$this->name4', NAME5 = '$this->name5', NAME6 = '$this->name6', METHOD1 = '$this->method1', METHOD2 = '$this->method2', METHOD3 = '$this->method3', METHOD4 = '$this->method4', METHOD5 = '$this->method5', METHOD6 = '$this->method6', TEST1 = '$this->test1', TEST2 = '$this->test2', TEST3 = '$this->test3', TEST4 = '$this->test4', LOT1 = '$this->lot1', LOT2 = '$this->lot2', LOT3 = '$this->lot3', LOT4 = '$this->lot4', LOT5 = '$this->lot5', LOT6 = '$this->lot6', RESULT1 = '$this->result1', RESULT2 = '$this->result2', RESULT3 = '$this->result3', RESULT4 = '$this->result4', RESULT5 = '$this->result5', RESULT6 = '$this->result6', SNAME1 = '$this->sname1', SNAME2 = '$this->sname2', SNAME3 = '$this->sname3', SMETHOD1 = '$this->smethod1', SMETHOD2 = '$this->smethod2', SMETHOD3 = '$this->smethod3', SSTD1 = '$this->sstd1', SSTD2 = '$this->sstd2', SSTD3 = '$this->sstd3', STOL1 = '$this->stol1', STOL2 = '$this->stol2', STOL3 = '$this->stol3', CGS = '$this->cgs', SMEMO = '$this->smemo'";  
              } 
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
              { 
                  $comando = "UPDATE " . $this->Ini->nm_tabela . " SET NAME = '$this->name', WIDTH = '$this->width', FIBER = '$this->fiber', `DESC` = '$this->desc', ODESC = '$this->odesc', PRICE = '$this->price', MED = '$this->med', DARK = '$this->dark', HAND = '$this->hand', NPRICE = $this->nprice, NPDATE = '$this->npdate', END1 = '$this->end1', END2 = '$this->end2', END3 = '$this->end3', GS = '$this->gs', K = '$this->k', MINDYE = '$this->mindye', MINORD = '$this->minord', CPI = '$this->cpi', WPI = '$this->wpi', FINWT = '$this->finwt', MACHINE = '$this->machine', STDGP = $this->stdgp, END4 = '$this->end4', END5 = '$this->end5', CONV = $this->conv, COMMENT = '$this->comment', SPEC = '$this->spec', MEMO = '$this->memo', DEPT = '$this->dept', LINE = '$this->line', YARN1 = '$this->yarn1', PER1 = $this->per1, YARN2 = '$this->yarn2', PER2 = $this->per2, YARN3 = '$this->yarn3', PER3 = $this->per3, YARN4 = '$this->yarn4', PER4 = $this->per4, OZSQUARE = $this->ozsquare, SQLB = $this->sqlb, DEL1 = '$this->del1', DEL2 = '$this->del2', DEL3 = '$this->del3', STDPUTUP = '$this->stdputup', STDTUBE = '$this->stdtube', DATE1 = '$this->date1', DATE2 = '$this->date2', DATE3 = '$this->date3', DATE4 = '$this->date4', DATE5 = '$this->date5', DATE6 = '$this->date6', NAME1 = '$this->name1', NAME2 = '$this->name2', NAME3 = '$this->name3', NAME4 = '$this->name4', NAME5 = '$this->name5', NAME6 = '$this->name6', METHOD1 = '$this->method1', METHOD2 = '$this->method2', METHOD3 = '$this->method3', METHOD4 = '$this->method4', METHOD5 = '$this->method5', METHOD6 = '$this->method6', TEST1 = '$this->test1', TEST2 = '$this->test2', TEST3 = '$this->test3', TEST4 = '$this->test4', LOT1 = '$this->lot1', LOT2 = '$this->lot2', LOT3 = '$this->lot3', LOT4 = '$this->lot4', LOT5 = '$this->lot5', LOT6 = '$this->lot6', RESULT1 = '$this->result1', RESULT2 = '$this->result2', RESULT3 = '$this->result3', RESULT4 = '$this->result4', RESULT5 = '$this->result5', RESULT6 = '$this->result6', SNAME1 = '$this->sname1', SNAME2 = '$this->sname2', SNAME3 = '$this->sname3', SMETHOD1 = '$this->smethod1', SMETHOD2 = '$this->smethod2', SMETHOD3 = '$this->smethod3', SSTD1 = '$this->sstd1', SSTD2 = '$this->sstd2', SSTD3 = '$this->sstd3', STOL1 = '$this->stol1', STOL2 = '$this->stol2', STOL3 = '$this->stol3', CGS = '$this->cgs', SMEMO = '$this->smemo'";  
              } 
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
              { 
                  $comando_oracle = "UPDATE " . $this->Ini->nm_tabela . " SET NAME = '$this->name', WIDTH = '$this->width', FIBER = '$this->fiber', `DESC` = '$this->desc', ODESC = '$this->odesc', PRICE = '$this->price', MED = '$this->med', DARK = '$this->dark', HAND = '$this->hand', NPRICE = $this->nprice, NPDATE = '$this->npdate', END1 = '$this->end1', END2 = '$this->end2', END3 = '$this->end3', GS = '$this->gs', K = '$this->k', MINDYE = '$this->mindye', MINORD = '$this->minord', CPI = '$this->cpi', WPI = '$this->wpi', FINWT = '$this->finwt', MACHINE = '$this->machine', STDGP = $this->stdgp, END4 = '$this->end4', END5 = '$this->end5', CONV = $this->conv, COMMENT = '$this->comment', SPEC = '$this->spec', MEMO = '$this->memo', DEPT = '$this->dept', LINE = '$this->line', YARN1 = '$this->yarn1', PER1 = $this->per1, YARN2 = '$this->yarn2', PER2 = $this->per2, YARN3 = '$this->yarn3', PER3 = $this->per3, YARN4 = '$this->yarn4', PER4 = $this->per4, OZSQUARE = $this->ozsquare, SQLB = $this->sqlb, DEL1 = '$this->del1', DEL2 = '$this->del2', DEL3 = '$this->del3', STDPUTUP = '$this->stdputup', STDTUBE = '$this->stdtube', DATE1 = '$this->date1', DATE2 = '$this->date2', DATE3 = '$this->date3', DATE4 = '$this->date4', DATE5 = '$this->date5', DATE6 = '$this->date6', NAME1 = '$this->name1', NAME2 = '$this->name2', NAME3 = '$this->name3', NAME4 = '$this->name4', NAME5 = '$this->name5', NAME6 = '$this->name6', METHOD1 = '$this->method1', METHOD2 = '$this->method2', METHOD3 = '$this->method3', METHOD4 = '$this->method4', METHOD5 = '$this->method5', METHOD6 = '$this->method6', TEST1 = '$this->test1', TEST2 = '$this->test2', TEST3 = '$this->test3', TEST4 = '$this->test4', LOT1 = '$this->lot1', LOT2 = '$this->lot2', LOT3 = '$this->lot3', LOT4 = '$this->lot4', LOT5 = '$this->lot5', LOT6 = '$this->lot6', RESULT1 = '$this->result1', RESULT2 = '$this->result2', RESULT3 = '$this->result3', RESULT4 = '$this->result4', RESULT5 = '$this->result5', RESULT6 = '$this->result6', SNAME1 = '$this->sname1', SNAME2 = '$this->sname2', SNAME3 = '$this->sname3', SMETHOD1 = '$this->smethod1', SMETHOD2 = '$this->smethod2', SMETHOD3 = '$this->smethod3', SSTD1 = '$this->sstd1', SSTD2 = '$this->sstd2', SSTD3 = '$this->sstd3', STOL1 = '$this->stol1', STOL2 = '$this->stol2', STOL3 = '$this->stol3', CGS = '$this->cgs', SMEMO = '$this->smemo'";  
              } 
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
              { 
                  $comando_oracle = "UPDATE " . $this->Ini->nm_tabela . " SET NAME = '$this->name', WIDTH = '$this->width', FIBER = '$this->fiber', `DESC` = '$this->desc', ODESC = '$this->odesc', PRICE = '$this->price', MED = '$this->med', DARK = '$this->dark', HAND = '$this->hand', NPRICE = $this->nprice, NPDATE = EXTEND('$this->npdate', YEAR TO DAY), END1 = '$this->end1', END2 = '$this->end2', END3 = '$this->end3', GS = '$this->gs', K = '$this->k', MINDYE = '$this->mindye', MINORD = '$this->minord', CPI = '$this->cpi', WPI = '$this->wpi', FINWT = '$this->finwt', MACHINE = '$this->machine', STDGP = $this->stdgp, END4 = '$this->end4', END5 = '$this->end5', CONV = $this->conv, COMMENT = '$this->comment', SPEC = '$this->spec', MEMO = '$this->memo', DEPT = '$this->dept', LINE = '$this->line', YARN1 = '$this->yarn1', PER1 = $this->per1, YARN2 = '$this->yarn2', PER2 = $this->per2, YARN3 = '$this->yarn3', PER3 = $this->per3, YARN4 = '$this->yarn4', PER4 = $this->per4, OZSQUARE = $this->ozsquare, SQLB = $this->sqlb, DEL1 = '$this->del1', DEL2 = '$this->del2', DEL3 = '$this->del3', STDPUTUP = '$this->stdputup', STDTUBE = '$this->stdtube', DATE1 = EXTEND('$this->date1', YEAR TO DAY), DATE2 = EXTEND('$this->date2', YEAR TO DAY), DATE3 = EXTEND('$this->date3', YEAR TO DAY), DATE4 = EXTEND('$this->date4', YEAR TO DAY), DATE5 = EXTEND('$this->date5', YEAR TO DAY), DATE6 = EXTEND('$this->date6', YEAR TO DAY), NAME1 = '$this->name1', NAME2 = '$this->name2', NAME3 = '$this->name3', NAME4 = '$this->name4', NAME5 = '$this->name5', NAME6 = '$this->name6', METHOD1 = '$this->method1', METHOD2 = '$this->method2', METHOD3 = '$this->method3', METHOD4 = '$this->method4', METHOD5 = '$this->method5', METHOD6 = '$this->method6', TEST1 = '$this->test1', TEST2 = '$this->test2', TEST3 = '$this->test3', TEST4 = '$this->test4', LOT1 = '$this->lot1', LOT2 = '$this->lot2', LOT3 = '$this->lot3', LOT4 = '$this->lot4', LOT5 = '$this->lot5', LOT6 = '$this->lot6', RESULT1 = '$this->result1', RESULT2 = '$this->result2', RESULT3 = '$this->result3', RESULT4 = '$this->result4', RESULT5 = '$this->result5', RESULT6 = '$this->result6', SNAME1 = '$this->sname1', SNAME2 = '$this->sname2', SNAME3 = '$this->sname3', SMETHOD1 = '$this->smethod1', SMETHOD2 = '$this->smethod2', SMETHOD3 = '$this->smethod3', SSTD1 = '$this->sstd1', SSTD2 = '$this->sstd2', SSTD3 = '$this->sstd3', STOL1 = '$this->stol1', STOL2 = '$this->stol2', STOL3 = '$this->stol3', CGS = '$this->cgs', SMEMO = '$this->smemo'";  
              } 
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_ibase))
              { 
                  $comando_oracle = "UPDATE " . $this->Ini->nm_tabela . " SET NAME = '$this->name', WIDTH = '$this->width', FIBER = '$this->fiber', `DESC` = '$this->desc', ODESC = '$this->odesc', PRICE = '$this->price', MED = '$this->med', DARK = '$this->dark', HAND = '$this->hand', NPRICE = $this->nprice, NPDATE = '$this->npdate', END1 = '$this->end1', END2 = '$this->end2', END3 = '$this->end3', GS = '$this->gs', K = '$this->k', MINDYE = '$this->mindye', MINORD = '$this->minord', CPI = '$this->cpi', WPI = '$this->wpi', FINWT = '$this->finwt', MACHINE = '$this->machine', STDGP = $this->stdgp, END4 = '$this->end4', END5 = '$this->end5', CONV = $this->conv, COMMENT = '$this->comment', SPEC = '$this->spec', MEMO = '$this->memo', DEPT = '$this->dept', LINE = '$this->line', YARN1 = '$this->yarn1', PER1 = $this->per1, YARN2 = '$this->yarn2', PER2 = $this->per2, YARN3 = '$this->yarn3', PER3 = $this->per3, YARN4 = '$this->yarn4', PER4 = $this->per4, OZSQUARE = $this->ozsquare, SQLB = $this->sqlb, DEL1 = '$this->del1', DEL2 = '$this->del2', DEL3 = '$this->del3', STDPUTUP = '$this->stdputup', STDTUBE = '$this->stdtube', DATE1 = '$this->date1', DATE2 = '$this->date2', DATE3 = '$this->date3', DATE4 = '$this->date4', DATE5 = '$this->date5', DATE6 = '$this->date6', NAME1 = '$this->name1', NAME2 = '$this->name2', NAME3 = '$this->name3', NAME4 = '$this->name4', NAME5 = '$this->name5', NAME6 = '$this->name6', METHOD1 = '$this->method1', METHOD2 = '$this->method2', METHOD3 = '$this->method3', METHOD4 = '$this->method4', METHOD5 = '$this->method5', METHOD6 = '$this->method6', TEST1 = '$this->test1', TEST2 = '$this->test2', TEST3 = '$this->test3', TEST4 = '$this->test4', LOT1 = '$this->lot1', LOT2 = '$this->lot2', LOT3 = '$this->lot3', LOT4 = '$this->lot4', LOT5 = '$this->lot5', LOT6 = '$this->lot6', RESULT1 = '$this->result1', RESULT2 = '$this->result2', RESULT3 = '$this->result3', RESULT4 = '$this->result4', RESULT5 = '$this->result5', RESULT6 = '$this->result6', SNAME1 = '$this->sname1', SNAME2 = '$this->sname2', SNAME3 = '$this->sname3', SMETHOD1 = '$this->smethod1', SMETHOD2 = '$this->smethod2', SMETHOD3 = '$this->smethod3', SSTD1 = '$this->sstd1', SSTD2 = '$this->sstd2', SSTD3 = '$this->sstd3', STOL1 = '$this->stol1', STOL2 = '$this->stol2', STOL3 = '$this->stol3', CGS = '$this->cgs', SMEMO = '$this->smemo'";  
              } 
              else 
              { 
                  $comando = "UPDATE " . $this->Ini->nm_tabela . " SET NAME = '$this->name', WIDTH = '$this->width', FIBER = '$this->fiber', `DESC` = '$this->desc', ODESC = '$this->odesc', PRICE = '$this->price', MED = '$this->med', DARK = '$this->dark', HAND = '$this->hand', NPRICE = $this->nprice, NPDATE = '$this->npdate', END1 = '$this->end1', END2 = '$this->end2', END3 = '$this->end3', GS = '$this->gs', K = '$this->k', MINDYE = '$this->mindye', MINORD = '$this->minord', CPI = '$this->cpi', WPI = '$this->wpi', FINWT = '$this->finwt', MACHINE = '$this->machine', STDGP = $this->stdgp, END4 = '$this->end4', END5 = '$this->end5', CONV = $this->conv, COMMENT = '$this->comment', SPEC = '$this->spec', MEMO = '$this->memo', DEPT = '$this->dept', LINE = '$this->line', YARN1 = '$this->yarn1', PER1 = $this->per1, YARN2 = '$this->yarn2', PER2 = $this->per2, YARN3 = '$this->yarn3', PER3 = $this->per3, YARN4 = '$this->yarn4', PER4 = $this->per4, OZSQUARE = $this->ozsquare, SQLB = $this->sqlb, DEL1 = '$this->del1', DEL2 = '$this->del2', DEL3 = '$this->del3', STDPUTUP = '$this->stdputup', STDTUBE = '$this->stdtube', DATE1 = '$this->date1', DATE2 = '$this->date2', DATE3 = '$this->date3', DATE4 = '$this->date4', DATE5 = '$this->date5', DATE6 = '$this->date6', NAME1 = '$this->name1', NAME2 = '$this->name2', NAME3 = '$this->name3', NAME4 = '$this->name4', NAME5 = '$this->name5', NAME6 = '$this->name6', METHOD1 = '$this->method1', METHOD2 = '$this->method2', METHOD3 = '$this->method3', METHOD4 = '$this->method4', METHOD5 = '$this->method5', METHOD6 = '$this->method6', TEST1 = '$this->test1', TEST2 = '$this->test2', TEST3 = '$this->test3', TEST4 = '$this->test4', LOT1 = '$this->lot1', LOT2 = '$this->lot2', LOT3 = '$this->lot3', LOT4 = '$this->lot4', LOT5 = '$this->lot5', LOT6 = '$this->lot6', RESULT1 = '$this->result1', RESULT2 = '$this->result2', RESULT3 = '$this->result3', RESULT4 = '$this->result4', RESULT5 = '$this->result5', RESULT6 = '$this->result6', SNAME1 = '$this->sname1', SNAME2 = '$this->sname2', SNAME3 = '$this->sname3', SMETHOD1 = '$this->smethod1', SMETHOD2 = '$this->smethod2', SMETHOD3 = '$this->smethod3', SSTD1 = '$this->sstd1', SSTD2 = '$this->sstd2', SSTD3 = '$this->sstd3', STOL1 = '$this->stol1', STOL2 = '$this->stol2', STOL3 = '$this->stol3', CGS = '$this->cgs', SMEMO = '$this->smemo'";  
              } 
              if (isset($NM_val_form['sprice']) && $NM_val_form['sprice'] != $this->nmgp_dados_select['sprice']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " SPRICE = $this->sprice"; 
                  $comando_oracle        .= " SPRICE = $this->sprice"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              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 (isset($NM_val_form['stdcost']) && $NM_val_form['stdcost'] != $this->nmgp_dados_select['stdcost']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " STDCOST = $this->stdcost"; 
                  $comando_oracle        .= " STDCOST = $this->stdcost"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['avcost']) && $NM_val_form['avcost'] != $this->nmgp_dados_select['avcost']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " AVCOST = $this->avcost"; 
                  $comando_oracle        .= " AVCOST = $this->avcost"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['yds']) && $NM_val_form['yds'] != $this->nmgp_dados_select['yds']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " YDS = $this->yds"; 
                  $comando_oracle        .= " YDS = $this->yds"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['lbs']) && $NM_val_form['lbs'] != $this->nmgp_dados_select['lbs']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " LBS = $this->lbs"; 
                  $comando_oracle        .= " LBS = $this->lbs"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['lbbo']) && $NM_val_form['lbbo'] != $this->nmgp_dados_select['lbbo']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " LBBO = $this->lbbo"; 
                  $comando_oracle        .= " LBBO = $this->lbbo"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['dye']) && $NM_val_form['dye'] != $this->nmgp_dados_select['dye']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " DYE = $this->dye"; 
                  $comando_oracle        .= " DYE = $this->dye"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['bo']) && $NM_val_form['bo'] != $this->nmgp_dados_select['bo']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " BO = $this->bo"; 
                  $comando_oracle        .= " BO = $this->bo"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['gc']) && $NM_val_form['gc'] != $this->nmgp_dados_select['gc']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " GC = $this->gc"; 
                  $comando_oracle        .= " GC = $this->gc"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['fc']) && $NM_val_form['fc'] != $this->nmgp_dados_select['fc']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " FC = $this->fc"; 
                  $comando_oracle        .= " FC = $this->fc"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['ytdd']) && $NM_val_form['ytdd'] != $this->nmgp_dados_select['ytdd']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " YTDD = $this->ytdd"; 
                  $comando_oracle        .= " YTDD = $this->ytdd"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['ytdy']) && $NM_val_form['ytdy'] != $this->nmgp_dados_select['ytdy']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " YTDY = $this->ytdy"; 
                  $comando_oracle        .= " YTDY = $this->ytdy"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['mtdd']) && $NM_val_form['mtdd'] != $this->nmgp_dados_select['mtdd']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " MTDD = $this->mtdd"; 
                  $comando_oracle        .= " MTDD = $this->mtdd"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['mtdy']) && $NM_val_form['mtdy'] != $this->nmgp_dados_select['mtdy']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " MTDY = $this->mtdy"; 
                  $comando_oracle        .= " MTDY = $this->mtdy"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['histy']) && $NM_val_form['histy'] != $this->nmgp_dados_select['histy']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " HISTY = $this->histy"; 
                  $comando_oracle        .= " HISTY = $this->histy"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['histd']) && $NM_val_form['histd'] != $this->nmgp_dados_select['histd']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " HISTD = $this->histd"; 
                  $comando_oracle        .= " HISTD = $this->histd"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['update']) && $NM_val_form['update'] != $this->nmgp_dados_select['update']) 
              { 
                  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        .= " `UPDATE` = #$this->update#"; 
                  } 
                  else 
                  { 
                      $comando        .= " `UPDATE` = '$this->update'"; 
                  } 
                  if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
                  { 
                      $comando_oracle        .= " `UPDATE` = EXTEND('" . $this->update . "', YEAR TO DAY)"; 
                  } 
                  else
                  { 
                      $comando_oracle        .= " `UPDATE` = '$this->update'"; 
                  } 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['avprice']) && $NM_val_form['avprice'] != $this->nmgp_dados_select['avprice']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " AVPRICE = $this->avprice"; 
                  $comando_oracle        .= " AVPRICE = $this->avprice"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['lastyry']) && $NM_val_form['lastyry'] != $this->nmgp_dados_select['lastyry']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " LASTYRY = $this->lastyry"; 
                  $comando_oracle        .= " LASTYRY = $this->lastyry"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['lastyrd']) && $NM_val_form['lastyrd'] != $this->nmgp_dados_select['lastyrd']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " LASTYRD = $this->lastyrd"; 
                  $comando_oracle        .= " LASTYRD = $this->lastyrd"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['gshort']) && $NM_val_form['gshort'] != $this->nmgp_dados_select['gshort']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " GSHORT = $this->gshort"; 
                  $comando_oracle        .= " GSHORT = $this->gshort"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['conv2']) && $NM_val_form['conv2'] != $this->nmgp_dados_select['conv2']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " CONV2 = $this->conv2"; 
                  $comando_oracle        .= " CONV2 = $this->conv2"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['conv3']) && $NM_val_form['conv3'] != $this->nmgp_dados_select['conv3']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " CONV3 = $this->conv3"; 
                  $comando_oracle        .= " CONV3 = $this->conv3"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['samples']) && $NM_val_form['samples'] != $this->nmgp_dados_select['samples']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " SAMPLES = $this->samples"; 
                  $comando_oracle        .= " SAMPLES = $this->samples"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['dyeleft']) && $NM_val_form['dyeleft'] != $this->nmgp_dados_select['dyeleft']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " DYELEFT = $this->dyeleft"; 
                  $comando_oracle        .= " DYELEFT = $this->dyeleft"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['ozlin']) && $NM_val_form['ozlin'] != $this->nmgp_dados_select['ozlin']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " OZLIN = $this->ozlin"; 
                  $comando_oracle        .= " OZLIN = $this->ozlin"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['meterkilo']) && $NM_val_form['meterkilo'] != $this->nmgp_dados_select['meterkilo']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " METERKILO = $this->meterkilo"; 
                  $comando_oracle        .= " METERKILO = $this->meterkilo"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['meter2kilo']) && $NM_val_form['meter2kilo'] != $this->nmgp_dados_select['meter2kilo']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " METER2KILO = $this->meter2kilo"; 
                  $comando_oracle        .= " METER2KILO = $this->meter2kilo"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['grammeter']) && $NM_val_form['grammeter'] != $this->nmgp_dados_select['grammeter']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " GRAMMETER = $this->grammeter"; 
                  $comando_oracle        .= " GRAMMETER = $this->grammeter"; 
                  $SC_ex_update = true; 
                  $SC_ex_upd_or = true; 
              } 
              if (isset($NM_val_form['grammeter2']) && $NM_val_form['grammeter2'] != $this->nmgp_dados_select['grammeter2']) 
              { 
                  if ($SC_ex_update || $SC_tem_cmp_update) 
                  { 
                      $comando        .= ","; 
                      $comando_oracle .= ","; 
                  } 
                  $comando        .= " GRAMMETER2 = $this->grammeter2"; 
                  $comando_oracle        .= " GRAMMETER2 = $this->grammeter2"; 
                  $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 STYLE = '$this->style' and ID2 = $this->id2 ";  
              }  
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
              {
                  $comando .= " WHERE STYLE = '$this->style' and ID2 = $this->id2 ";  
              }  
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
              {
                  $comando .= " WHERE STYLE = '$this->style' and ID2 = $this->id2 ";  
              }  
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
              {
                  $comando .= " WHERE STYLE = '$this->style' and ID2 = $this->id2 ";  
              }  
              else  
              {
                  $comando .= " WHERE STYLE = '$this->style' 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)
                              {
                                  line_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]['line_form']['db_changed'] = true;


              if     (isset($NM_val_form) && isset($NM_val_form['style'])) { $this->style = $NM_val_form['style']; }
              elseif (isset($this->style)) { $this->nm_limpa_alfa($this->style); }
              if     (isset($NM_val_form) && isset($NM_val_form['name'])) { $this->name = $NM_val_form['name']; }
              elseif (isset($this->name)) { $this->nm_limpa_alfa($this->name); }
              if     (isset($NM_val_form) && isset($NM_val_form['width'])) { $this->width = $NM_val_form['width']; }
              elseif (isset($this->width)) { $this->nm_limpa_alfa($this->width); }
              if     (isset($NM_val_form) && isset($NM_val_form['fiber'])) { $this->fiber = $NM_val_form['fiber']; }
              elseif (isset($this->fiber)) { $this->nm_limpa_alfa($this->fiber); }
              if     (isset($NM_val_form) && isset($NM_val_form['desc'])) { $this->desc = $NM_val_form['desc']; }
              elseif (isset($this->desc)) { $this->nm_limpa_alfa($this->desc); }
              if     (isset($NM_val_form) && isset($NM_val_form['odesc'])) { $this->odesc = $NM_val_form['odesc']; }
              elseif (isset($this->odesc)) { $this->nm_limpa_alfa($this->odesc); }
              if     (isset($NM_val_form) && isset($NM_val_form['price'])) { $this->price = $NM_val_form['price']; }
              elseif (isset($this->price)) { $this->nm_limpa_alfa($this->price); }
              if     (isset($NM_val_form) && isset($NM_val_form['med'])) { $this->med = $NM_val_form['med']; }
              elseif (isset($this->med)) { $this->nm_limpa_alfa($this->med); }
              if     (isset($NM_val_form) && isset($NM_val_form['dark'])) { $this->dark = $NM_val_form['dark']; }
              elseif (isset($this->dark)) { $this->nm_limpa_alfa($this->dark); }
              if     (isset($NM_val_form) && isset($NM_val_form['hand'])) { $this->hand = $NM_val_form['hand']; }
              elseif (isset($this->hand)) { $this->nm_limpa_alfa($this->hand); }
              if     (isset($NM_val_form) && isset($NM_val_form['sprice'])) { $this->sprice = $NM_val_form['sprice']; }
              elseif (isset($this->sprice)) { $this->nm_limpa_alfa($this->sprice); }
              if     (isset($NM_val_form) && isset($NM_val_form['nprice'])) { $this->nprice = $NM_val_form['nprice']; }
              elseif (isset($this->nprice)) { $this->nm_limpa_alfa($this->nprice); }
              if     (isset($NM_val_form) && isset($NM_val_form['end1'])) { $this->end1 = $NM_val_form['end1']; }
              elseif (isset($this->end1)) { $this->nm_limpa_alfa($this->end1); }
              if     (isset($NM_val_form) && isset($NM_val_form['end2'])) { $this->end2 = $NM_val_form['end2']; }
              elseif (isset($this->end2)) { $this->nm_limpa_alfa($this->end2); }
              if     (isset($NM_val_form) && isset($NM_val_form['end3'])) { $this->end3 = $NM_val_form['end3']; }
              elseif (isset($this->end3)) { $this->nm_limpa_alfa($this->end3); }
              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['k'])) { $this->k = $NM_val_form['k']; }
              elseif (isset($this->k)) { $this->nm_limpa_alfa($this->k); }
              if     (isset($NM_val_form) && isset($NM_val_form['mindye'])) { $this->mindye = $NM_val_form['mindye']; }
              elseif (isset($this->mindye)) { $this->nm_limpa_alfa($this->mindye); }
              if     (isset($NM_val_form) && isset($NM_val_form['minord'])) { $this->minord = $NM_val_form['minord']; }
              elseif (isset($this->minord)) { $this->nm_limpa_alfa($this->minord); }
              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['finwt'])) { $this->finwt = $NM_val_form['finwt']; }
              elseif (isset($this->finwt)) { $this->nm_limpa_alfa($this->finwt); }
              if     (isset($NM_val_form) && isset($NM_val_form['machine'])) { $this->machine = $NM_val_form['machine']; }
              elseif (isset($this->machine)) { $this->nm_limpa_alfa($this->machine); }
              if     (isset($NM_val_form) && isset($NM_val_form['stdcost'])) { $this->stdcost = $NM_val_form['stdcost']; }
              elseif (isset($this->stdcost)) { $this->nm_limpa_alfa($this->stdcost); }
              if     (isset($NM_val_form) && isset($NM_val_form['stdgp'])) { $this->stdgp = $NM_val_form['stdgp']; }
              elseif (isset($this->stdgp)) { $this->nm_limpa_alfa($this->stdgp); }
              if     (isset($NM_val_form) && isset($NM_val_form['avcost'])) { $this->avcost = $NM_val_form['avcost']; }
              elseif (isset($this->avcost)) { $this->nm_limpa_alfa($this->avcost); }
              if     (isset($NM_val_form) && isset($NM_val_form['end4'])) { $this->end4 = $NM_val_form['end4']; }
              elseif (isset($this->end4)) { $this->nm_limpa_alfa($this->end4); }
              if     (isset($NM_val_form) && isset($NM_val_form['end5'])) { $this->end5 = $NM_val_form['end5']; }
              elseif (isset($this->end5)) { $this->nm_limpa_alfa($this->end5); }
              if     (isset($NM_val_form) && isset($NM_val_form['yds'])) { $this->yds = $NM_val_form['yds']; }
              elseif (isset($this->yds)) { $this->nm_limpa_alfa($this->yds); }
              if     (isset($NM_val_form) && isset($NM_val_form['lbs'])) { $this->lbs = $NM_val_form['lbs']; }
              elseif (isset($this->lbs)) { $this->nm_limpa_alfa($this->lbs); }
              if     (isset($NM_val_form) && isset($NM_val_form['lbbo'])) { $this->lbbo = $NM_val_form['lbbo']; }
              elseif (isset($this->lbbo)) { $this->nm_limpa_alfa($this->lbbo); }
              if     (isset($NM_val_form) && isset($NM_val_form['dye'])) { $this->dye = $NM_val_form['dye']; }
              elseif (isset($this->dye)) { $this->nm_limpa_alfa($this->dye); }
              if     (isset($NM_val_form) && isset($NM_val_form['bo'])) { $this->bo = $NM_val_form['bo']; }
              elseif (isset($this->bo)) { $this->nm_limpa_alfa($this->bo); }
              if     (isset($NM_val_form) && isset($NM_val_form['gc'])) { $this->gc = $NM_val_form['gc']; }
              elseif (isset($this->gc)) { $this->nm_limpa_alfa($this->gc); }
              if     (isset($NM_val_form) && isset($NM_val_form['conv'])) { $this->conv = $NM_val_form['conv']; }
              elseif (isset($this->conv)) { $this->nm_limpa_alfa($this->conv); }
              if     (isset($NM_val_form) && isset($NM_val_form['fc'])) { $this->fc = $NM_val_form['fc']; }
              elseif (isset($this->fc)) { $this->nm_limpa_alfa($this->fc); }
              if     (isset($NM_val_form) && isset($NM_val_form['comment'])) { $this->comment = $NM_val_form['comment']; }
              elseif (isset($this->comment)) { $this->nm_limpa_alfa($this->comment); }
              if     (isset($NM_val_form) && isset($NM_val_form['spec'])) { $this->spec = $NM_val_form['spec']; }
              elseif (isset($this->spec)) { $this->nm_limpa_alfa($this->spec); }
              if     (isset($NM_val_form) && isset($NM_val_form['memo'])) { $this->memo = $NM_val_form['memo']; }
              elseif (isset($this->memo)) { $this->nm_limpa_alfa($this->memo); }
              if     (isset($NM_val_form) && isset($NM_val_form['ytdd'])) { $this->ytdd = $NM_val_form['ytdd']; }
              elseif (isset($this->ytdd)) { $this->nm_limpa_alfa($this->ytdd); }
              if     (isset($NM_val_form) && isset($NM_val_form['ytdy'])) { $this->ytdy = $NM_val_form['ytdy']; }
              elseif (isset($this->ytdy)) { $this->nm_limpa_alfa($this->ytdy); }
              if     (isset($NM_val_form) && isset($NM_val_form['mtdd'])) { $this->mtdd = $NM_val_form['mtdd']; }
              elseif (isset($this->mtdd)) { $this->nm_limpa_alfa($this->mtdd); }
              if     (isset($NM_val_form) && isset($NM_val_form['mtdy'])) { $this->mtdy = $NM_val_form['mtdy']; }
              elseif (isset($this->mtdy)) { $this->nm_limpa_alfa($this->mtdy); }
              if     (isset($NM_val_form) && isset($NM_val_form['histy'])) { $this->histy = $NM_val_form['histy']; }
              elseif (isset($this->histy)) { $this->nm_limpa_alfa($this->histy); }
              if     (isset($NM_val_form) && isset($NM_val_form['histd'])) { $this->histd = $NM_val_form['histd']; }
              elseif (isset($this->histd)) { $this->nm_limpa_alfa($this->histd); }
              if     (isset($NM_val_form) && isset($NM_val_form['avprice'])) { $this->avprice = $NM_val_form['avprice']; }
              elseif (isset($this->avprice)) { $this->nm_limpa_alfa($this->avprice); }
              if     (isset($NM_val_form) && isset($NM_val_form['lastyry'])) { $this->lastyry = $NM_val_form['lastyry']; }
              elseif (isset($this->lastyry)) { $this->nm_limpa_alfa($this->lastyry); }
              if     (isset($NM_val_form) && isset($NM_val_form['lastyrd'])) { $this->lastyrd = $NM_val_form['lastyrd']; }
              elseif (isset($this->lastyrd)) { $this->nm_limpa_alfa($this->lastyrd); }
              if     (isset($NM_val_form) && isset($NM_val_form['gshort'])) { $this->gshort = $NM_val_form['gshort']; }
              elseif (isset($this->gshort)) { $this->nm_limpa_alfa($this->gshort); }
              if     (isset($NM_val_form) && isset($NM_val_form['conv2'])) { $this->conv2 = $NM_val_form['conv2']; }
              elseif (isset($this->conv2)) { $this->nm_limpa_alfa($this->conv2); }
              if     (isset($NM_val_form) && isset($NM_val_form['conv3'])) { $this->conv3 = $NM_val_form['conv3']; }
              elseif (isset($this->conv3)) { $this->nm_limpa_alfa($this->conv3); }
              if     (isset($NM_val_form) && isset($NM_val_form['dept'])) { $this->dept = $NM_val_form['dept']; }
              elseif (isset($this->dept)) { $this->nm_limpa_alfa($this->dept); }
              if     (isset($NM_val_form) && isset($NM_val_form['samples'])) { $this->samples = $NM_val_form['samples']; }
              elseif (isset($this->samples)) { $this->nm_limpa_alfa($this->samples); }
              if     (isset($NM_val_form) && isset($NM_val_form['dyeleft'])) { $this->dyeleft = $NM_val_form['dyeleft']; }
              elseif (isset($this->dyeleft)) { $this->nm_limpa_alfa($this->dyeleft); }
              if     (isset($NM_val_form) && isset($NM_val_form['line'])) { $this->line = $NM_val_form['line']; }
              elseif (isset($this->line)) { $this->nm_limpa_alfa($this->line); }
              if     (isset($NM_val_form) && isset($NM_val_form['yarn1'])) { $this->yarn1 = $NM_val_form['yarn1']; }
              elseif (isset($this->yarn1)) { $this->nm_limpa_alfa($this->yarn1); }
              if     (isset($NM_val_form) && isset($NM_val_form['per1'])) { $this->per1 = $NM_val_form['per1']; }
              elseif (isset($this->per1)) { $this->nm_limpa_alfa($this->per1); }
              if     (isset($NM_val_form) && isset($NM_val_form['yarn2'])) { $this->yarn2 = $NM_val_form['yarn2']; }
              elseif (isset($this->yarn2)) { $this->nm_limpa_alfa($this->yarn2); }
              if     (isset($NM_val_form) && isset($NM_val_form['per2'])) { $this->per2 = $NM_val_form['per2']; }
              elseif (isset($this->per2)) { $this->nm_limpa_alfa($this->per2); }
              if     (isset($NM_val_form) && isset($NM_val_form['yarn3'])) { $this->yarn3 = $NM_val_form['yarn3']; }
              elseif (isset($this->yarn3)) { $this->nm_limpa_alfa($this->yarn3); }
              if     (isset($NM_val_form) && isset($NM_val_form['per3'])) { $this->per3 = $NM_val_form['per3']; }
              elseif (isset($this->per3)) { $this->nm_limpa_alfa($this->per3); }
              if     (isset($NM_val_form) && isset($NM_val_form['yarn4'])) { $this->yarn4 = $NM_val_form['yarn4']; }
              elseif (isset($this->yarn4)) { $this->nm_limpa_alfa($this->yarn4); }
              if     (isset($NM_val_form) && isset($NM_val_form['per4'])) { $this->per4 = $NM_val_form['per4']; }
              elseif (isset($this->per4)) { $this->nm_limpa_alfa($this->per4); }
              if     (isset($NM_val_form) && isset($NM_val_form['ozsquare'])) { $this->ozsquare = $NM_val_form['ozsquare']; }
              elseif (isset($this->ozsquare)) { $this->nm_limpa_alfa($this->ozsquare); }
              if     (isset($NM_val_form) && isset($NM_val_form['ozlin'])) { $this->ozlin = $NM_val_form['ozlin']; }
              elseif (isset($this->ozlin)) { $this->nm_limpa_alfa($this->ozlin); }
              if     (isset($NM_val_form) && isset($NM_val_form['sqlb'])) { $this->sqlb = $NM_val_form['sqlb']; }
              elseif (isset($this->sqlb)) { $this->nm_limpa_alfa($this->sqlb); }
              if     (isset($NM_val_form) && isset($NM_val_form['meterkilo'])) { $this->meterkilo = $NM_val_form['meterkilo']; }
              elseif (isset($this->meterkilo)) { $this->nm_limpa_alfa($this->meterkilo); }
              if     (isset($NM_val_form) && isset($NM_val_form['meter2kilo'])) { $this->meter2kilo = $NM_val_form['meter2kilo']; }
              elseif (isset($this->meter2kilo)) { $this->nm_limpa_alfa($this->meter2kilo); }
              if     (isset($NM_val_form) && isset($NM_val_form['grammeter'])) { $this->grammeter = $NM_val_form['grammeter']; }
              elseif (isset($this->grammeter)) { $this->nm_limpa_alfa($this->grammeter); }
              if     (isset($NM_val_form) && isset($NM_val_form['grammeter2'])) { $this->grammeter2 = $NM_val_form['grammeter2']; }
              elseif (isset($this->grammeter2)) { $this->nm_limpa_alfa($this->grammeter2); }
              if     (isset($NM_val_form) && isset($NM_val_form['del1'])) { $this->del1 = $NM_val_form['del1']; }
              elseif (isset($this->del1)) { $this->nm_limpa_alfa($this->del1); }
              if     (isset($NM_val_form) && isset($NM_val_form['del2'])) { $this->del2 = $NM_val_form['del2']; }
              elseif (isset($this->del2)) { $this->nm_limpa_alfa($this->del2); }
              if     (isset($NM_val_form) && isset($NM_val_form['del3'])) { $this->del3 = $NM_val_form['del3']; }
              elseif (isset($this->del3)) { $this->nm_limpa_alfa($this->del3); }
              if     (isset($NM_val_form) && isset($NM_val_form['stdputup'])) { $this->stdputup = $NM_val_form['stdputup']; }
              elseif (isset($this->stdputup)) { $this->nm_limpa_alfa($this->stdputup); }
              if     (isset($NM_val_form) && isset($NM_val_form['stdtube'])) { $this->stdtube = $NM_val_form['stdtube']; }
              elseif (isset($this->stdtube)) { $this->nm_limpa_alfa($this->stdtube); }
              if     (isset($NM_val_form) && isset($NM_val_form['name1'])) { $this->name1 = $NM_val_form['name1']; }
              elseif (isset($this->name1)) { $this->nm_limpa_alfa($this->name1); }
              if     (isset($NM_val_form) && isset($NM_val_form['name2'])) { $this->name2 = $NM_val_form['name2']; }
              elseif (isset($this->name2)) { $this->nm_limpa_alfa($this->name2); }
              if     (isset($NM_val_form) && isset($NM_val_form['name3'])) { $this->name3 = $NM_val_form['name3']; }
              elseif (isset($this->name3)) { $this->nm_limpa_alfa($this->name3); }
              if     (isset($NM_val_form) && isset($NM_val_form['name4'])) { $this->name4 = $NM_val_form['name4']; }
              elseif (isset($this->name4)) { $this->nm_limpa_alfa($this->name4); }
              if     (isset($NM_val_form) && isset($NM_val_form['name5'])) { $this->name5 = $NM_val_form['name5']; }
              elseif (isset($this->name5)) { $this->nm_limpa_alfa($this->name5); }
              if     (isset($NM_val_form) && isset($NM_val_form['name6'])) { $this->name6 = $NM_val_form['name6']; }
              elseif (isset($this->name6)) { $this->nm_limpa_alfa($this->name6); }
              if     (isset($NM_val_form) && isset($NM_val_form['method1'])) { $this->method1 = $NM_val_form['method1']; }
              elseif (isset($this->method1)) { $this->nm_limpa_alfa($this->method1); }
              if     (isset($NM_val_form) && isset($NM_val_form['method2'])) { $this->method2 = $NM_val_form['method2']; }
              elseif (isset($this->method2)) { $this->nm_limpa_alfa($this->method2); }
              if     (isset($NM_val_form) && isset($NM_val_form['method3'])) { $this->method3 = $NM_val_form['method3']; }
              elseif (isset($this->method3)) { $this->nm_limpa_alfa($this->method3); }
              if     (isset($NM_val_form) && isset($NM_val_form['method4'])) { $this->method4 = $NM_val_form['method4']; }
              elseif (isset($this->method4)) { $this->nm_limpa_alfa($this->method4); }
              if     (isset($NM_val_form) && isset($NM_val_form['method5'])) { $this->method5 = $NM_val_form['method5']; }
              elseif (isset($this->method5)) { $this->nm_limpa_alfa($this->method5); }
              if     (isset($NM_val_form) && isset($NM_val_form['method6'])) { $this->method6 = $NM_val_form['method6']; }
              elseif (isset($this->method6)) { $this->nm_limpa_alfa($this->method6); }
              if     (isset($NM_val_form) && isset($NM_val_form['test1'])) { $this->test1 = $NM_val_form['test1']; }
              elseif (isset($this->test1)) { $this->nm_limpa_alfa($this->test1); }
              if     (isset($NM_val_form) && isset($NM_val_form['test2'])) { $this->test2 = $NM_val_form['test2']; }
              elseif (isset($this->test2)) { $this->nm_limpa_alfa($this->test2); }
              if     (isset($NM_val_form) && isset($NM_val_form['test3'])) { $this->test3 = $NM_val_form['test3']; }
              elseif (isset($this->test3)) { $this->nm_limpa_alfa($this->test3); }
              if     (isset($NM_val_form) && isset($NM_val_form['test4'])) { $this->test4 = $NM_val_form['test4']; }
              elseif (isset($this->test4)) { $this->nm_limpa_alfa($this->test4); }
              if     (isset($NM_val_form) && isset($NM_val_form['lot1'])) { $this->lot1 = $NM_val_form['lot1']; }
              elseif (isset($this->lot1)) { $this->nm_limpa_alfa($this->lot1); }
              if     (isset($NM_val_form) && isset($NM_val_form['lot2'])) { $this->lot2 = $NM_val_form['lot2']; }
              elseif (isset($this->lot2)) { $this->nm_limpa_alfa($this->lot2); }
              if     (isset($NM_val_form) && isset($NM_val_form['lot3'])) { $this->lot3 = $NM_val_form['lot3']; }
              elseif (isset($this->lot3)) { $this->nm_limpa_alfa($this->lot3); }
              if     (isset($NM_val_form) && isset($NM_val_form['lot4'])) { $this->lot4 = $NM_val_form['lot4']; }
              elseif (isset($this->lot4)) { $this->nm_limpa_alfa($this->lot4); }
              if     (isset($NM_val_form) && isset($NM_val_form['lot5'])) { $this->lot5 = $NM_val_form['lot5']; }
              elseif (isset($this->lot5)) { $this->nm_limpa_alfa($this->lot5); }
              if     (isset($NM_val_form) && isset($NM_val_form['lot6'])) { $this->lot6 = $NM_val_form['lot6']; }
              elseif (isset($this->lot6)) { $this->nm_limpa_alfa($this->lot6); }
              if     (isset($NM_val_form) && isset($NM_val_form['result1'])) { $this->result1 = $NM_val_form['result1']; }
              elseif (isset($this->result1)) { $this->nm_limpa_alfa($this->result1); }
              if     (isset($NM_val_form) && isset($NM_val_form['result2'])) { $this->result2 = $NM_val_form['result2']; }
              elseif (isset($this->result2)) { $this->nm_limpa_alfa($this->result2); }
              if     (isset($NM_val_form) && isset($NM_val_form['result3'])) { $this->result3 = $NM_val_form['result3']; }
              elseif (isset($this->result3)) { $this->nm_limpa_alfa($this->result3); }
              if     (isset($NM_val_form) && isset($NM_val_form['result4'])) { $this->result4 = $NM_val_form['result4']; }
              elseif (isset($this->result4)) { $this->nm_limpa_alfa($this->result4); }
              if     (isset($NM_val_form) && isset($NM_val_form['result5'])) { $this->result5 = $NM_val_form['result5']; }
              elseif (isset($this->result5)) { $this->nm_limpa_alfa($this->result5); }
              if     (isset($NM_val_form) && isset($NM_val_form['result6'])) { $this->result6 = $NM_val_form['result6']; }
              elseif (isset($this->result6)) { $this->nm_limpa_alfa($this->result6); }
              if     (isset($NM_val_form) && isset($NM_val_form['sname1'])) { $this->sname1 = $NM_val_form['sname1']; }
              elseif (isset($this->sname1)) { $this->nm_limpa_alfa($this->sname1); }
              if     (isset($NM_val_form) && isset($NM_val_form['sname2'])) { $this->sname2 = $NM_val_form['sname2']; }
              elseif (isset($this->sname2)) { $this->nm_limpa_alfa($this->sname2); }
              if     (isset($NM_val_form) && isset($NM_val_form['sname3'])) { $this->sname3 = $NM_val_form['sname3']; }
              elseif (isset($this->sname3)) { $this->nm_limpa_alfa($this->sname3); }
              if     (isset($NM_val_form) && isset($NM_val_form['smethod1'])) { $this->smethod1 = $NM_val_form['smethod1']; }
              elseif (isset($this->smethod1)) { $this->nm_limpa_alfa($this->smethod1); }
              if     (isset($NM_val_form) && isset($NM_val_form['smethod2'])) { $this->smethod2 = $NM_val_form['smethod2']; }
              elseif (isset($this->smethod2)) { $this->nm_limpa_alfa($this->smethod2); }
              if     (isset($NM_val_form) && isset($NM_val_form['smethod3'])) { $this->smethod3 = $NM_val_form['smethod3']; }
              elseif (isset($this->smethod3)) { $this->nm_limpa_alfa($this->smethod3); }
              if     (isset($NM_val_form) && isset($NM_val_form['sstd1'])) { $this->sstd1 = $NM_val_form['sstd1']; }
              elseif (isset($this->sstd1)) { $this->nm_limpa_alfa($this->sstd1); }
              if     (isset($NM_val_form) && isset($NM_val_form['sstd2'])) { $this->sstd2 = $NM_val_form['sstd2']; }
              elseif (isset($this->sstd2)) { $this->nm_limpa_alfa($this->sstd2); }
              if     (isset($NM_val_form) && isset($NM_val_form['sstd3'])) { $this->sstd3 = $NM_val_form['sstd3']; }
              elseif (isset($this->sstd3)) { $this->nm_limpa_alfa($this->sstd3); }
              if     (isset($NM_val_form) && isset($NM_val_form['stol1'])) { $this->stol1 = $NM_val_form['stol1']; }
              elseif (isset($this->stol1)) { $this->nm_limpa_alfa($this->stol1); }
              if     (isset($NM_val_form) && isset($NM_val_form['stol2'])) { $this->stol2 = $NM_val_form['stol2']; }
              elseif (isset($this->stol2)) { $this->nm_limpa_alfa($this->stol2); }
              if     (isset($NM_val_form) && isset($NM_val_form['stol3'])) { $this->stol3 = $NM_val_form['stol3']; }
              elseif (isset($this->stol3)) { $this->nm_limpa_alfa($this->stol3); }
              if     (isset($NM_val_form) && isset($NM_val_form['cgs'])) { $this->cgs = $NM_val_form['cgs']; }
              elseif (isset($this->cgs)) { $this->nm_limpa_alfa($this->cgs); }
              if     (isset($NM_val_form) && isset($NM_val_form['smemo'])) { $this->smemo = $NM_val_form['smemo']; }
              elseif (isset($this->smemo)) { $this->nm_limpa_alfa($this->smemo); }
              if     (isset($NM_val_form) && isset($NM_val_form['grstyle'])) { $this->grstyle = $NM_val_form['grstyle']; }
              elseif (isset($this->grstyle)) { $this->nm_limpa_alfa($this->grstyle); }
              if     (isset($NM_val_form) && isset($NM_val_form['stdcosting'])) { $this->stdcosting = $NM_val_form['stdcosting']; }
              elseif (isset($this->stdcosting)) { $this->nm_limpa_alfa($this->stdcosting); }

              $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('image', 'style', 'name', 'width', 'comment', 'fiber', 'desc', 'line', 'dept', 'odesc', 'hand', 'date', 'mindye', 'minord', 'yarn1', 'per1', 'yarn2', 'per2', 'yarn3', 'per3', 'yarn4', 'per4', 'del1', 'del2', 'del3', 'end1', 'end2', 'end3', 'end4', 'end5', 'price', 'med', 'dark', 'nprice', 'npdate', 'memo', 'smemo', 'yds', 'lbs', 'dye', 'gc', 'fc', 'spec', 'gshort', 'ytdd', 'ytdy', 'mtdd', 'mtdy', 'histy', 'histd', 'update', 'avprice', 'lastyry', 'lastyrd', 'dyeleft', 'ozsquare', 'ozlin', 'sqlb', 'cpi', 'wpi', 'finwt', 'meterkilo', 'meter2kilo', 'grammeter', 'grammeter2', 'stdputup', 'stdtube', 'date1', 'date2', 'date3', 'date4', 'date5', 'date6', 'name1', 'name2', 'name3', 'name4', 'name5', 'name6', 'method1', 'method2', 'method3', 'method4', 'method5', 'method6', 'test1', 'test2', 'test3', 'test4', 'lot1', 'lot2', 'lot3', 'lot4', 'lot5', 'lot6', 'result1', 'result2', 'result3', 'result4', 'result5', 'result6', 'sname1', 'sname2', 'sname3', 'smethod1', 'smethod2', 'smethod3', 'sstd1', 'sstd2', 'sstd3', 'stol1', 'stol2', 'stol3', 'conv2', 'conv3', 'conv', 'stdcost', 'stdgp', 'sprice', 'avcost', 'stdcosting', 'machine', 'cgs', 'gs', 'k', 'grstyle', 'lbbo', 'bo', 'samples');
              $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]['line_form']['foreign_key']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['foreign_key']))
          {
              foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['line_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]['line_form']['decimal_db'] == ",") 
          {
              $this->nm_poe_aspas_decimal();
          }
              $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 STYLE = '$this->style' and ID2 = $this->id2 "; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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 STYLE = '$this->style' and ID2 = $this->id2 "; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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 STYLE = '$this->style' and ID2 = $this->id2 "; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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 STYLE = '$this->style' and ID2 = $this->id2 "; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' and ID2 = $this->id2 "); 
          }  
          else  
          {
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' and ID2 = $this->id2 "; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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(); 
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '" . $this->style . "'";
              $rsUni = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '" . $this->style . "'");
              if (0 < $rsUni->fields[0])
              {
                  $this->Erro->mensagem (__FILE__, __LINE__, "critica", $this->Ini->Nm_lang['lang_errm_inst_uniq'] . " STYLE"); 
                  $this->nmgp_opcao = "nada"; 
                  $GLOBALS["erro_incl"] = 1; 
                  $aInsertOk[] = 'style';
              }
              $rsUni->Close();
          $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 . " (STYLE, NAME, WIDTH, FIBER, `DESC`, ODESC, PRICE, MED, DARK, HAND, SPRICE, NPRICE, NPDATE, END1, END2, END3, `DATE`, GS, K, MINDYE, MINORD, CPI, WPI, FINWT, MACHINE, STDCOST, STDGP, AVCOST, END4, END5, YDS, LBS, LBBO, DYE, BO, GC, CONV, FC, COMMENT, SPEC, MEMO, YTDD, YTDY, MTDD, MTDY, HISTY, HISTD, `UPDATE`, AVPRICE, LASTYRY, LASTYRD, GSHORT, CONV2, CONV3, DEPT, SAMPLES, DYELEFT, LINE, YARN1, PER1, YARN2, PER2, YARN3, PER3, YARN4, PER4, OZSQUARE, OZLIN, SQLB, METERKILO, METER2KILO, GRAMMETER, GRAMMETER2, DEL1, DEL2, DEL3, STDPUTUP, STDTUBE, DATE1, DATE2, DATE3, DATE4, DATE5, DATE6, NAME1, NAME2, NAME3, NAME4, NAME5, NAME6, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5, METHOD6, TEST1, TEST2, TEST3, TEST4, LOT1, LOT2, LOT3, LOT4, LOT5, LOT6, RESULT1, RESULT2, RESULT3, RESULT4, RESULT5, RESULT6, SNAME1, SNAME2, SNAME3, SMETHOD1, SMETHOD2, SMETHOD3, SSTD1, SSTD2, SSTD3, STOL1, STOL2, STOL3, CGS, SMEMO, ID2) VALUES ('$this->style', '$this->name', '$this->width', '$this->fiber', '$this->desc', '$this->odesc', '$this->price', '$this->med', '$this->dark', '$this->hand', $this->sprice, $this->nprice, #$this->npdate#, '$this->end1', '$this->end2', '$this->end3', #$this->date#, '$this->gs', '$this->k', '$this->mindye', '$this->minord', '$this->cpi', '$this->wpi', '$this->finwt', '$this->machine', $this->stdcost, $this->stdgp, $this->avcost, '$this->end4', '$this->end5', $this->yds, $this->lbs, $this->lbbo, $this->dye, $this->bo, $this->gc, $this->conv, $this->fc, '$this->comment', '$this->spec', '$this->memo', $this->ytdd, $this->ytdy, $this->mtdd, $this->mtdy, $this->histy, $this->histd, #$this->update#, $this->avprice, $this->lastyry, $this->lastyrd, $this->gshort, $this->conv2, $this->conv3, '$this->dept', $this->samples, $this->dyeleft, '$this->line', '$this->yarn1', $this->per1, '$this->yarn2', $this->per2, '$this->yarn3', $this->per3, '$this->yarn4', $this->per4, $this->ozsquare, $this->ozlin, $this->sqlb, $this->meterkilo, $this->meter2kilo, $this->grammeter, $this->grammeter2, '$this->del1', '$this->del2', '$this->del3', '$this->stdputup', '$this->stdtube', #$this->date1#, #$this->date2#, #$this->date3#, #$this->date4#, #$this->date5#, #$this->date6#, '$this->name1', '$this->name2', '$this->name3', '$this->name4', '$this->name5', '$this->name6', '$this->method1', '$this->method2', '$this->method3', '$this->method4', '$this->method5', '$this->method6', '$this->test1', '$this->test2', '$this->test3', '$this->test4', '$this->lot1', '$this->lot2', '$this->lot3', '$this->lot4', '$this->lot5', '$this->lot6', '$this->result1', '$this->result2', '$this->result3', '$this->result4', '$this->result5', '$this->result6', '$this->sname1', '$this->sname2', '$this->sname3', '$this->smethod1', '$this->smethod2', '$this->smethod3', '$this->sstd1', '$this->sstd2', '$this->sstd3', '$this->stol1', '$this->stol2', '$this->stol3', '$this->cgs', '$this->smemo', $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 . "STYLE, NAME, WIDTH, FIBER, `DESC`, ODESC, PRICE, MED, DARK, HAND, SPRICE, NPRICE, NPDATE, END1, END2, END3, `DATE`, GS, K, MINDYE, MINORD, CPI, WPI, FINWT, MACHINE, STDCOST, STDGP, AVCOST, END4, END5, YDS, LBS, LBBO, DYE, BO, GC, CONV, FC, COMMENT, SPEC, MEMO, YTDD, YTDY, MTDD, MTDY, HISTY, HISTD, `UPDATE`, AVPRICE, LASTYRY, LASTYRD, GSHORT, CONV2, CONV3, DEPT, SAMPLES, DYELEFT, LINE, YARN1, PER1, YARN2, PER2, YARN3, PER3, YARN4, PER4, OZSQUARE, OZLIN, SQLB, METERKILO, METER2KILO, GRAMMETER, GRAMMETER2, DEL1, DEL2, DEL3, STDPUTUP, STDTUBE, DATE1, DATE2, DATE3, DATE4, DATE5, DATE6, NAME1, NAME2, NAME3, NAME4, NAME5, NAME6, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5, METHOD6, TEST1, TEST2, TEST3, TEST4, LOT1, LOT2, LOT3, LOT4, LOT5, LOT6, RESULT1, RESULT2, RESULT3, RESULT4, RESULT5, RESULT6, SNAME1, SNAME2, SNAME3, SMETHOD1, SMETHOD2, SMETHOD3, SSTD1, SSTD2, SSTD3, STOL1, STOL2, STOL3, CGS, SMEMO, ID2) VALUES (" . $NM_seq_auto . "'$this->style', '$this->name', '$this->width', '$this->fiber', '$this->desc', '$this->odesc', '$this->price', '$this->med', '$this->dark', '$this->hand', $this->sprice, $this->nprice, '$this->npdate', '$this->end1', '$this->end2', '$this->end3', '$this->date', '$this->gs', '$this->k', '$this->mindye', '$this->minord', '$this->cpi', '$this->wpi', '$this->finwt', '$this->machine', $this->stdcost, $this->stdgp, $this->avcost, '$this->end4', '$this->end5', $this->yds, $this->lbs, $this->lbbo, $this->dye, $this->bo, $this->gc, $this->conv, $this->fc, '$this->comment', '$this->spec', '$this->memo', $this->ytdd, $this->ytdy, $this->mtdd, $this->mtdy, $this->histy, $this->histd, '$this->update', $this->avprice, $this->lastyry, $this->lastyrd, $this->gshort, $this->conv2, $this->conv3, '$this->dept', $this->samples, $this->dyeleft, '$this->line', '$this->yarn1', $this->per1, '$this->yarn2', $this->per2, '$this->yarn3', $this->per3, '$this->yarn4', $this->per4, $this->ozsquare, $this->ozlin, $this->sqlb, $this->meterkilo, $this->meter2kilo, $this->grammeter, $this->grammeter2, '$this->del1', '$this->del2', '$this->del3', '$this->stdputup', '$this->stdtube', '$this->date1', '$this->date2', '$this->date3', '$this->date4', '$this->date5', '$this->date6', '$this->name1', '$this->name2', '$this->name3', '$this->name4', '$this->name5', '$this->name6', '$this->method1', '$this->method2', '$this->method3', '$this->method4', '$this->method5', '$this->method6', '$this->test1', '$this->test2', '$this->test3', '$this->test4', '$this->lot1', '$this->lot2', '$this->lot3', '$this->lot4', '$this->lot5', '$this->lot6', '$this->result1', '$this->result2', '$this->result3', '$this->result4', '$this->result5', '$this->result6', '$this->sname1', '$this->sname2', '$this->sname3', '$this->smethod1', '$this->smethod2', '$this->smethod3', '$this->sstd1', '$this->sstd2', '$this->sstd3', '$this->stol1', '$this->stol2', '$this->stol3', '$this->cgs', '$this->smemo', $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 . "STYLE, NAME, WIDTH, FIBER, `DESC`, ODESC, PRICE, MED, DARK, HAND, SPRICE, NPRICE, NPDATE, END1, END2, END3, `DATE`, GS, K, MINDYE, MINORD, CPI, WPI, FINWT, MACHINE, STDCOST, STDGP, AVCOST, END4, END5, YDS, LBS, LBBO, DYE, BO, GC, CONV, FC, COMMENT, SPEC, MEMO, YTDD, YTDY, MTDD, MTDY, HISTY, HISTD, `UPDATE`, AVPRICE, LASTYRY, LASTYRD, GSHORT, CONV2, CONV3, DEPT, SAMPLES, DYELEFT, LINE, YARN1, PER1, YARN2, PER2, YARN3, PER3, YARN4, PER4, OZSQUARE, OZLIN, SQLB, METERKILO, METER2KILO, GRAMMETER, GRAMMETER2, DEL1, DEL2, DEL3, STDPUTUP, STDTUBE, DATE1, DATE2, DATE3, DATE4, DATE5, DATE6, NAME1, NAME2, NAME3, NAME4, NAME5, NAME6, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5, METHOD6, TEST1, TEST2, TEST3, TEST4, LOT1, LOT2, LOT3, LOT4, LOT5, LOT6, RESULT1, RESULT2, RESULT3, RESULT4, RESULT5, RESULT6, SNAME1, SNAME2, SNAME3, SMETHOD1, SMETHOD2, SMETHOD3, SSTD1, SSTD2, SSTD3, STOL1, STOL2, STOL3, CGS, SMEMO, ID2) VALUES (" . $NM_seq_auto . "'$this->style', '$this->name', '$this->width', '$this->fiber', '$this->desc', '$this->odesc', '$this->price', '$this->med', '$this->dark', '$this->hand', $this->sprice, $this->nprice, '$this->npdate', '$this->end1', '$this->end2', '$this->end3', '$this->date', '$this->gs', '$this->k', '$this->mindye', '$this->minord', '$this->cpi', '$this->wpi', '$this->finwt', '$this->machine', $this->stdcost, $this->stdgp, $this->avcost, '$this->end4', '$this->end5', $this->yds, $this->lbs, $this->lbbo, $this->dye, $this->bo, $this->gc, $this->conv, $this->fc, '$this->comment', '$this->spec', '$this->memo', $this->ytdd, $this->ytdy, $this->mtdd, $this->mtdy, $this->histy, $this->histd, '$this->update', $this->avprice, $this->lastyry, $this->lastyrd, $this->gshort, $this->conv2, $this->conv3, '$this->dept', $this->samples, $this->dyeleft, '$this->line', '$this->yarn1', $this->per1, '$this->yarn2', $this->per2, '$this->yarn3', $this->per3, '$this->yarn4', $this->per4, $this->ozsquare, $this->ozlin, $this->sqlb, $this->meterkilo, $this->meter2kilo, $this->grammeter, $this->grammeter2, '$this->del1', '$this->del2', '$this->del3', '$this->stdputup', '$this->stdtube', '$this->date1', '$this->date2', '$this->date3', '$this->date4', '$this->date5', '$this->date6', '$this->name1', '$this->name2', '$this->name3', '$this->name4', '$this->name5', '$this->name6', '$this->method1', '$this->method2', '$this->method3', '$this->method4', '$this->method5', '$this->method6', '$this->test1', '$this->test2', '$this->test3', '$this->test4', '$this->lot1', '$this->lot2', '$this->lot3', '$this->lot4', '$this->lot5', '$this->lot6', '$this->result1', '$this->result2', '$this->result3', '$this->result4', '$this->result5', '$this->result6', '$this->sname1', '$this->sname2', '$this->sname3', '$this->smethod1', '$this->smethod2', '$this->smethod3', '$this->sstd1', '$this->sstd2', '$this->sstd3', '$this->stol1', '$this->stol2', '$this->stol3', '$this->cgs', '$this->smemo', $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 . "STYLE, NAME, WIDTH, FIBER, `DESC`, ODESC, PRICE, MED, DARK, HAND, SPRICE, NPRICE, NPDATE, END1, END2, END3, `DATE`, GS, K, MINDYE, MINORD, CPI, WPI, FINWT, MACHINE, STDCOST, STDGP, AVCOST, END4, END5, YDS, LBS, LBBO, DYE, BO, GC, CONV, FC, COMMENT, SPEC, MEMO, YTDD, YTDY, MTDD, MTDY, HISTY, HISTD, `UPDATE`, AVPRICE, LASTYRY, LASTYRD, GSHORT, CONV2, CONV3, DEPT, SAMPLES, DYELEFT, LINE, YARN1, PER1, YARN2, PER2, YARN3, PER3, YARN4, PER4, OZSQUARE, OZLIN, SQLB, METERKILO, METER2KILO, GRAMMETER, GRAMMETER2, DEL1, DEL2, DEL3, STDPUTUP, STDTUBE, DATE1, DATE2, DATE3, DATE4, DATE5, DATE6, NAME1, NAME2, NAME3, NAME4, NAME5, NAME6, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5, METHOD6, TEST1, TEST2, TEST3, TEST4, LOT1, LOT2, LOT3, LOT4, LOT5, LOT6, RESULT1, RESULT2, RESULT3, RESULT4, RESULT5, RESULT6, SNAME1, SNAME2, SNAME3, SMETHOD1, SMETHOD2, SMETHOD3, SSTD1, SSTD2, SSTD3, STOL1, STOL2, STOL3, CGS, SMEMO, ID2) VALUES (" . $NM_seq_auto . "'$this->style', '$this->name', '$this->width', '$this->fiber', '$this->desc', '$this->odesc', '$this->price', '$this->med', '$this->dark', '$this->hand', $this->sprice, $this->nprice, EXTEND('$this->npdate', YEAR TO DAY), '$this->end1', '$this->end2', '$this->end3', EXTEND('$this->date', YEAR TO DAY), '$this->gs', '$this->k', '$this->mindye', '$this->minord', '$this->cpi', '$this->wpi', '$this->finwt', '$this->machine', $this->stdcost, $this->stdgp, $this->avcost, '$this->end4', '$this->end5', $this->yds, $this->lbs, $this->lbbo, $this->dye, $this->bo, $this->gc, $this->conv, $this->fc, '$this->comment', '$this->spec', '$this->memo', $this->ytdd, $this->ytdy, $this->mtdd, $this->mtdy, $this->histy, $this->histd, EXTEND('$this->update', YEAR TO DAY), $this->avprice, $this->lastyry, $this->lastyrd, $this->gshort, $this->conv2, $this->conv3, '$this->dept', $this->samples, $this->dyeleft, '$this->line', '$this->yarn1', $this->per1, '$this->yarn2', $this->per2, '$this->yarn3', $this->per3, '$this->yarn4', $this->per4, $this->ozsquare, $this->ozlin, $this->sqlb, $this->meterkilo, $this->meter2kilo, $this->grammeter, $this->grammeter2, '$this->del1', '$this->del2', '$this->del3', '$this->stdputup', '$this->stdtube', EXTEND('$this->date1', YEAR TO DAY), EXTEND('$this->date2', YEAR TO DAY), EXTEND('$this->date3', YEAR TO DAY), EXTEND('$this->date4', YEAR TO DAY), EXTEND('$this->date5', YEAR TO DAY), EXTEND('$this->date6', YEAR TO DAY), '$this->name1', '$this->name2', '$this->name3', '$this->name4', '$this->name5', '$this->name6', '$this->method1', '$this->method2', '$this->method3', '$this->method4', '$this->method5', '$this->method6', '$this->test1', '$this->test2', '$this->test3', '$this->test4', '$this->lot1', '$this->lot2', '$this->lot3', '$this->lot4', '$this->lot5', '$this->lot6', '$this->result1', '$this->result2', '$this->result3', '$this->result4', '$this->result5', '$this->result6', '$this->sname1', '$this->sname2', '$this->sname3', '$this->smethod1', '$this->smethod2', '$this->smethod3', '$this->sstd1', '$this->sstd2', '$this->sstd3', '$this->stol1', '$this->stol2', '$this->stol3', '$this->cgs', '$this->smemo', $this->id2)"; 
              }
              else
              {
                  $comando = "INSERT INTO " . $this->Ini->nm_tabela . " (" . $NM_cmp_auto . "STYLE, NAME, WIDTH, FIBER, `DESC`, ODESC, PRICE, MED, DARK, HAND, SPRICE, NPRICE, NPDATE, END1, END2, END3, `DATE`, GS, K, MINDYE, MINORD, CPI, WPI, FINWT, MACHINE, STDCOST, STDGP, AVCOST, END4, END5, YDS, LBS, LBBO, DYE, BO, GC, CONV, FC, COMMENT, SPEC, MEMO, YTDD, YTDY, MTDD, MTDY, HISTY, HISTD, `UPDATE`, AVPRICE, LASTYRY, LASTYRD, GSHORT, CONV2, CONV3, DEPT, SAMPLES, DYELEFT, LINE, YARN1, PER1, YARN2, PER2, YARN3, PER3, YARN4, PER4, OZSQUARE, OZLIN, SQLB, METERKILO, METER2KILO, GRAMMETER, GRAMMETER2, DEL1, DEL2, DEL3, STDPUTUP, STDTUBE, DATE1, DATE2, DATE3, DATE4, DATE5, DATE6, NAME1, NAME2, NAME3, NAME4, NAME5, NAME6, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5, METHOD6, TEST1, TEST2, TEST3, TEST4, LOT1, LOT2, LOT3, LOT4, LOT5, LOT6, RESULT1, RESULT2, RESULT3, RESULT4, RESULT5, RESULT6, SNAME1, SNAME2, SNAME3, SMETHOD1, SMETHOD2, SMETHOD3, SSTD1, SSTD2, SSTD3, STOL1, STOL2, STOL3, CGS, SMEMO, ID2) VALUES (" . $NM_seq_auto . "'$this->style', '$this->name', '$this->width', '$this->fiber', '$this->desc', '$this->odesc', '$this->price', '$this->med', '$this->dark', '$this->hand', $this->sprice, $this->nprice, '$this->npdate', '$this->end1', '$this->end2', '$this->end3', '$this->date', '$this->gs', '$this->k', '$this->mindye', '$this->minord', '$this->cpi', '$this->wpi', '$this->finwt', '$this->machine', $this->stdcost, $this->stdgp, $this->avcost, '$this->end4', '$this->end5', $this->yds, $this->lbs, $this->lbbo, $this->dye, $this->bo, $this->gc, $this->conv, $this->fc, '$this->comment', '$this->spec', '$this->memo', $this->ytdd, $this->ytdy, $this->mtdd, $this->mtdy, $this->histy, $this->histd, '$this->update', $this->avprice, $this->lastyry, $this->lastyrd, $this->gshort, $this->conv2, $this->conv3, '$this->dept', $this->samples, $this->dyeleft, '$this->line', '$this->yarn1', $this->per1, '$this->yarn2', $this->per2, '$this->yarn3', $this->per3, '$this->yarn4', $this->per4, $this->ozsquare, $this->ozlin, $this->sqlb, $this->meterkilo, $this->meter2kilo, $this->grammeter, $this->grammeter2, '$this->del1', '$this->del2', '$this->del3', '$this->stdputup', '$this->stdtube', '$this->date1', '$this->date2', '$this->date3', '$this->date4', '$this->date5', '$this->date6', '$this->name1', '$this->name2', '$this->name3', '$this->name4', '$this->name5', '$this->name6', '$this->method1', '$this->method2', '$this->method3', '$this->method4', '$this->method5', '$this->method6', '$this->test1', '$this->test2', '$this->test3', '$this->test4', '$this->lot1', '$this->lot2', '$this->lot3', '$this->lot4', '$this->lot5', '$this->lot6', '$this->result1', '$this->result2', '$this->result3', '$this->result4', '$this->result5', '$this->result6', '$this->sname1', '$this->sname2', '$this->sname3', '$this->smethod1', '$this->smethod2', '$this->smethod3', '$this->sstd1', '$this->sstd2', '$this->sstd3', '$this->stol1', '$this->stol2', '$this->stol3', '$this->cgs', '$this->smemo', $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)
                          {
                              line_form_pack_ajax_response();
                              exit; 
                          }
                      }  
                  }  
              }  
              if ('refresh_insert' != $this->nmgp_opcao)
              {
              }

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

              if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['total']))
              {
                  unset($_SESSION['sc_session'][$this->Ini->sc_page]['line_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]['line_form']['sc_redir_insert']) || $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['sc_redir_insert'] != "S"))
              {
              $this->nmgp_opcao   = "igual"; 
              $this->nmgp_opc_ant = "igual"; 
              $this->nmgp_botoes['Greige'] = "on";
              $this->nmgp_botoes['FGI'] = "on";
              $this->nmgp_botoes['sc_btn_0'] = "on";
              $this->nmgp_botoes['sc_btn_1'] = "on";
              $this->nmgp_botoes['Dye'] = "on";
              $this->nmgp_botoes['sc_btn_2'] = "on";
              $this->nmgp_botoes['sc_btn_3'] = "on";
              $this->nmgp_botoes['Sampling'] = "on";
              }
              $this->nm_flag_iframe = true;
              $_SESSION["var_end1"] = $this->end1;  
              $_SESSION["var_end2"] = $this->end2;  
              $_SESSION["var_end3"] = $this->end3;  
              $_SESSION["var_end4"] = $this->end4;  
              $_SESSION["var_end5"] = $this->end5;  
          } 
          if ($this->lig_edit_lookup)
          {
              $this->lig_edit_lookup_call = true;
          }
      } 
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['decimal_db'] == ",") 
      {
          $this->nm_tira_aspas_decimal();
      }
      if ($this->nmgp_opcao == "excluir") 
      { 
          $this->style = substr($this->Db->qstr($this->style), 1, -1); 
          $this->id2 = substr($this->Db->qstr($this->id2), 1, -1); 

          $bDelecaoOk = true;
          $sMsgErro   = '';
          if ($bDelecaoOk)
          {
              $sDetailWhere = "GR_STYLE = '" . $this->cgs . "'";
              $this->greige_grstyle_ro2_form->ini_controle();
              if ($this->greige_grstyle_ro2_form->temRegistros($sDetailWhere))
              {
                  $bDelecaoOk = false;
                  $sMsgErro   = $this->Ini->Nm_lang['lang_errm_fkvi'];
              }
          }
          if ($bDelecaoOk)
          {
              $sDetailWhere = "STYLE = '" . $this->style . "'";
              $this->line_cmatch_edit_grid->ini_controle();
              if ($this->line_cmatch_edit_grid->temRegistros($sDetailWhere))
              {
                  $bDelecaoOk = false;
                  $sMsgErro   = $this->Ini->Nm_lang['lang_errm_fkvi'];
              }
          }

          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 STYLE = '$this->style' and ID2 = $this->id2"; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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 STYLE = '$this->style' and ID2 = $this->id2"; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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 STYLE = '$this->style' and ID2 = $this->id2"; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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 STYLE = '$this->style' and ID2 = $this->id2"; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' and ID2 = $this->id2 "); 
          }  
          else  
          {
              $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' and ID2 = $this->id2"; 
              $rs1 = $this->Db->Execute("select count(*) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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 STYLE = '$this->style' and ID2 = $this->id2 "; 
                  $rs = $this->Db->Execute("DELETE FROM " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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 STYLE = '$this->style' and ID2 = $this->id2 "; 
                  $rs = $this->Db->Execute("DELETE FROM " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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 STYLE = '$this->style' and ID2 = $this->id2 "; 
                  $rs = $this->Db->Execute("DELETE FROM " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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 STYLE = '$this->style' and ID2 = $this->id2 "; 
                  $rs = $this->Db->Execute("DELETE FROM " . $this->Ini->nm_tabela . " where STYLE = '$this->style' and ID2 = $this->id2 "); 
              }  
              else  
              {
                  $_SESSION['scriptcase']['sc_sql_ult_comando'] = "DELETE FROM " . $this->Ini->nm_tabela . " where STYLE = '$this->style' and ID2 = $this->id2 "; 
                  $rs = $this->Db->Execute("DELETE FROM " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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)
                      {
                          line_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]['line_form']['reg_start']--; 
              if ($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_start'] < 0)
              {
                  $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_start'] = 0; 
              }

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

              if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['total']))
              {
                  unset($_SESSION['sc_session'][$this->Ini->sc_page]['line_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]['line_form']['parms'] = "style?#?$this->style?@?id2?#?$this->id2?@?"; 
      }
      $this->NM_commit_db(); 
      if ($this->sc_evento != "insert" && $this->sc_evento != "update" && $this->sc_evento != "delete")
      { 
          $this->style = substr($this->Db->qstr($this->style), 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]['line_form']['where_filter'] = trim($this->NM_where_filter);
          if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['total']))
          {
              unset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['total']);
          }
      }
      $sc_where_filter = '';
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['where_filter_form']) && '' != $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['where_filter_form'])
      {
          $sc_where_filter = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['where_filter_form'];
      }
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['where_filter']) && '' != $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['where_filter'])
      {
          if (empty($sc_where_filter))
          {
              $sc_where_filter = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['where_filter'];
          }
          else
          {
              $sc_where_filter .= " and (" . $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['where_filter'] . ")";
          }
      }
//------------ 
      if ($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['run_iframe'] == "F" || $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['run_iframe'] == "R")
      {
          if ($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['iframe_evento'] == "insert") 
          { 
               $this->nmgp_opcao = "novo"; 
               $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['select'] = "";
          } 
          $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['iframe_evento'] = $this->sc_evento; 
      } 
      if (!isset($this->nmgp_opcao) || empty($this->nmgp_opcao)) 
      { 
          if (empty($this->style) && 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->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]['line_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]['line_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_line_form = isset($rt->fields[0]) ? $rt->fields[0] - 1 : 0; 
          $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['total'] = $qt_geral_reg_line_form;
          $rt->Close(); 
          if ($this->nmgp_opcao == "igual" && isset($this->NM_btn_navega) && 'S' == $this->NM_btn_navega && !empty($this->style) && !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 = "STYLE, ID2"; 
              }
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
              {
                  $Sel_Chave = "STYLE, ID2"; 
              }
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
              {
                  $Sel_Chave = "STYLE, ID2"; 
              }
              else  
              {
                  $Sel_Chave = "STYLE, ID2"; 
              }
              $nmgp_select = "SELECT " . $Sel_Chave . " from " . $this->Ini->nm_tabela . $sc_where; 
              $sc_order_by = "STYLE, 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->style && $rt->fields[1] == $this->id2)
                  { 
                      $Reg_OK = true;
                  }  
                  $Count_start++;
                  $rt->MoveNext();
              }  
              $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_start'] = $Count_start;
              $rt->Close(); 
          }
      } 
      else 
      { 
          $qt_geral_reg_line_form = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['total'];
      } 
      if ($this->nmgp_opcao == "inicio") 
      { 
          $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_start'] = 0; 
      } 
      if ($this->nmgp_opcao == "avanca")  
      { 
          $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_start']++; 
          if ($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_start'] > $qt_geral_reg_line_form)
          {
              $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_start'] = $qt_geral_reg_line_form; 
          }
      } 
      if ($this->nmgp_opcao == "retorna") 
      { 
          $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_start']--; 
          if ($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_start'] < 0)
          {
              $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_start'] = 0; 
          }
      } 
      if ($this->nmgp_opcao == "final") 
      { 
          $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_start'] = $qt_geral_reg_line_form; 
      } 
      if ($this->nmgp_opcao == "navpage" && ($this->nmgp_ordem - 1) <= $qt_geral_reg_line_form) 
      { 
          $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_start'] = $this->nmgp_ordem - 1; 
      } 
      if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_start']) || empty($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_start']))
      {
          $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_start'] = 0;
      }
      $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_qtd'] = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_start'] + 1;
      $this->NM_ajax_info['navSummary']['reg_ini'] = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_start'] + 1; 
      $this->NM_ajax_info['navSummary']['reg_qtd'] = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_qtd']; 
      $this->NM_ajax_info['navSummary']['reg_tot'] = $_SESSION['sc_session'][$this->Ini->sc_page]['line_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]['line_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 STYLE, NAME, WIDTH, FIBER, `DESC`, ODESC, PRICE, MED, DARK, HAND, SPRICE, NPRICE, str_replace (convert(char(10),NPDATE,102), '.', '-') + ' ' + convert(char(8),NPDATE,20), END1, END2, END3, str_replace (convert(char(10),`DATE`,102), '.', '-') + ' ' + convert(char(8),`DATE`,20), GS, K, MINDYE, MINORD, CPI, WPI, FINWT, MACHINE, STDCOST, STDGP, AVCOST, END4, END5, YDS, LBS, LBBO, DYE, BO, GC, CONV, FC, COMMENT, SPEC, MEMO, YTDD, YTDY, MTDD, MTDY, HISTY, HISTD, str_replace (convert(char(10),`UPDATE`,102), '.', '-') + ' ' + convert(char(8),`UPDATE`,20), AVPRICE, LASTYRY, LASTYRD, GSHORT, CONV2, CONV3, DEPT, SAMPLES, DYELEFT, LINE, YARN1, PER1, YARN2, PER2, YARN3, PER3, YARN4, PER4, OZSQUARE, OZLIN, SQLB, METERKILO, METER2KILO, GRAMMETER, GRAMMETER2, DEL1, DEL2, DEL3, STDPUTUP, STDTUBE, str_replace (convert(char(10),DATE1,102), '.', '-') + ' ' + convert(char(8),DATE1,20), str_replace (convert(char(10),DATE2,102), '.', '-') + ' ' + convert(char(8),DATE2,20), str_replace (convert(char(10),DATE3,102), '.', '-') + ' ' + convert(char(8),DATE3,20), str_replace (convert(char(10),DATE4,102), '.', '-') + ' ' + convert(char(8),DATE4,20), str_replace (convert(char(10),DATE5,102), '.', '-') + ' ' + convert(char(8),DATE5,20), str_replace (convert(char(10),DATE6,102), '.', '-') + ' ' + convert(char(8),DATE6,20), NAME1, NAME2, NAME3, NAME4, NAME5, NAME6, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5, METHOD6, TEST1, TEST2, TEST3, TEST4, LOT1, LOT2, LOT3, LOT4, LOT5, LOT6, RESULT1, RESULT2, RESULT3, RESULT4, RESULT5, RESULT6, SNAME1, SNAME2, SNAME3, SMETHOD1, SMETHOD2, SMETHOD3, SSTD1, SSTD2, SSTD3, STOL1, STOL2, STOL3, CGS, SMEMO, ID2 from " . $this->Ini->nm_tabela ; 
          } 
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
          { 
              $nmgp_select = "SELECT STYLE, NAME, WIDTH, FIBER, `DESC`, ODESC, PRICE, MED, DARK, HAND, SPRICE, NPRICE, convert(char(23),NPDATE,121), END1, END2, END3, convert(char(23),`DATE`,121), GS, K, MINDYE, MINORD, CPI, WPI, FINWT, MACHINE, STDCOST, STDGP, AVCOST, END4, END5, YDS, LBS, LBBO, DYE, BO, GC, CONV, FC, COMMENT, SPEC, MEMO, YTDD, YTDY, MTDD, MTDY, HISTY, HISTD, convert(char(23),`UPDATE`,121), AVPRICE, LASTYRY, LASTYRD, GSHORT, CONV2, CONV3, DEPT, SAMPLES, DYELEFT, LINE, YARN1, PER1, YARN2, PER2, YARN3, PER3, YARN4, PER4, OZSQUARE, OZLIN, SQLB, METERKILO, METER2KILO, GRAMMETER, GRAMMETER2, DEL1, DEL2, DEL3, STDPUTUP, STDTUBE, convert(char(23),DATE1,121), convert(char(23),DATE2,121), convert(char(23),DATE3,121), convert(char(23),DATE4,121), convert(char(23),DATE5,121), convert(char(23),DATE6,121), NAME1, NAME2, NAME3, NAME4, NAME5, NAME6, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5, METHOD6, TEST1, TEST2, TEST3, TEST4, LOT1, LOT2, LOT3, LOT4, LOT5, LOT6, RESULT1, RESULT2, RESULT3, RESULT4, RESULT5, RESULT6, SNAME1, SNAME2, SNAME3, SMETHOD1, SMETHOD2, SMETHOD3, SSTD1, SSTD2, SSTD3, STOL1, STOL2, STOL3, CGS, SMEMO, ID2 from " . $this->Ini->nm_tabela ; 
          } 
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
          { 
              $nmgp_select = "SELECT STYLE, NAME, WIDTH, FIBER, `DESC`, ODESC, PRICE, MED, DARK, HAND, SPRICE, NPRICE, NPDATE, END1, END2, END3, `DATE`, GS, K, MINDYE, MINORD, CPI, WPI, FINWT, MACHINE, STDCOST, STDGP, AVCOST, END4, END5, YDS, LBS, LBBO, DYE, BO, GC, CONV, FC, COMMENT, SPEC, MEMO, YTDD, YTDY, MTDD, MTDY, HISTY, HISTD, `UPDATE`, AVPRICE, LASTYRY, LASTYRD, GSHORT, CONV2, CONV3, DEPT, SAMPLES, DYELEFT, LINE, YARN1, PER1, YARN2, PER2, YARN3, PER3, YARN4, PER4, OZSQUARE, OZLIN, SQLB, METERKILO, METER2KILO, GRAMMETER, GRAMMETER2, DEL1, DEL2, DEL3, STDPUTUP, STDTUBE, DATE1, DATE2, DATE3, DATE4, DATE5, DATE6, NAME1, NAME2, NAME3, NAME4, NAME5, NAME6, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5, METHOD6, TEST1, TEST2, TEST3, TEST4, LOT1, LOT2, LOT3, LOT4, LOT5, LOT6, RESULT1, RESULT2, RESULT3, RESULT4, RESULT5, RESULT6, SNAME1, SNAME2, SNAME3, SMETHOD1, SMETHOD2, SMETHOD3, SSTD1, SSTD2, SSTD3, STOL1, STOL2, STOL3, CGS, SMEMO, ID2 from " . $this->Ini->nm_tabela ; 
          } 
          elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
          { 
              $nmgp_select = "SELECT STYLE, NAME, WIDTH, FIBER, `DESC`, ODESC, PRICE, MED, DARK, HAND, SPRICE, NPRICE, EXTEND(NPDATE, YEAR TO DAY), END1, END2, END3, EXTEND(`DATE`, YEAR TO DAY), GS, K, MINDYE, MINORD, CPI, WPI, FINWT, MACHINE, STDCOST, STDGP, AVCOST, END4, END5, YDS, LBS, LBBO, DYE, BO, GC, CONV, FC, COMMENT, SPEC, MEMO, YTDD, YTDY, MTDD, MTDY, HISTY, HISTD, EXTEND(`UPDATE`, YEAR TO DAY), AVPRICE, LASTYRY, LASTYRD, GSHORT, CONV2, CONV3, DEPT, SAMPLES, DYELEFT, LINE, YARN1, PER1, YARN2, PER2, YARN3, PER3, YARN4, PER4, OZSQUARE, OZLIN, SQLB, METERKILO, METER2KILO, GRAMMETER, GRAMMETER2, DEL1, DEL2, DEL3, STDPUTUP, STDTUBE, EXTEND(DATE1, YEAR TO DAY), EXTEND(DATE2, YEAR TO DAY), EXTEND(DATE3, YEAR TO DAY), EXTEND(DATE4, YEAR TO DAY), EXTEND(DATE5, YEAR TO DAY), EXTEND(DATE6, YEAR TO DAY), NAME1, NAME2, NAME3, NAME4, NAME5, NAME6, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5, METHOD6, TEST1, TEST2, TEST3, TEST4, LOT1, LOT2, LOT3, LOT4, LOT5, LOT6, RESULT1, RESULT2, RESULT3, RESULT4, RESULT5, RESULT6, SNAME1, SNAME2, SNAME3, SMETHOD1, SMETHOD2, SMETHOD3, SSTD1, SSTD2, SSTD3, STOL1, STOL2, STOL3, CGS, SMEMO, ID2 from " . $this->Ini->nm_tabela ; 
          } 
          else 
          { 
              $nmgp_select = "SELECT STYLE, NAME, WIDTH, FIBER, `DESC`, ODESC, PRICE, MED, DARK, HAND, SPRICE, NPRICE, NPDATE, END1, END2, END3, `DATE`, GS, K, MINDYE, MINORD, CPI, WPI, FINWT, MACHINE, STDCOST, STDGP, AVCOST, END4, END5, YDS, LBS, LBBO, DYE, BO, GC, CONV, FC, COMMENT, SPEC, MEMO, YTDD, YTDY, MTDD, MTDY, HISTY, HISTD, `UPDATE`, AVPRICE, LASTYRY, LASTYRD, GSHORT, CONV2, CONV3, DEPT, SAMPLES, DYELEFT, LINE, YARN1, PER1, YARN2, PER2, YARN3, PER3, YARN4, PER4, OZSQUARE, OZLIN, SQLB, METERKILO, METER2KILO, GRAMMETER, GRAMMETER2, DEL1, DEL2, DEL3, STDPUTUP, STDTUBE, DATE1, DATE2, DATE3, DATE4, DATE5, DATE6, NAME1, NAME2, NAME3, NAME4, NAME5, NAME6, METHOD1, METHOD2, METHOD3, METHOD4, METHOD5, METHOD6, TEST1, TEST2, TEST3, TEST4, LOT1, LOT2, LOT3, LOT4, LOT5, LOT6, RESULT1, RESULT2, RESULT3, RESULT4, RESULT5, RESULT6, SNAME1, SNAME2, SNAME3, SMETHOD1, SMETHOD2, SMETHOD3, SSTD1, SSTD2, SSTD3, STOL1, STOL2, STOL3, CGS, SMEMO, 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[] = "STYLE = '$this->style' and ID2 = $this->id2"; 
              }  
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
              {
                  $aWhere[] = "STYLE = '$this->style' and ID2 = $this->id2"; 
              }  
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
              {
                  $aWhere[] = "STYLE = '$this->style' and ID2 = $this->id2"; 
              }  
              elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
              {
                  $aWhere[] = "STYLE = '$this->style' and ID2 = $this->id2"; 
              }  
              else  
              {
                  $aWhere[] = "STYLE = '$this->style' 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 = "STYLE, 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]['line_form']['run_iframe'] == "F" || $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['run_iframe'] == "R")
          {
              if ($this->sc_evento == "update")
              {
                  $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['select'] = $nmgp_select;
                  $this->nm_gera_html();
              } 
              elseif (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['select']))
              { 
                  $nmgp_select = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['select'];
                  $_SESSION['sc_session'][$this->Ini->sc_page]['line_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]['line_form']['reg_start'] . ")" ; 
              $rs = $this->Db->SelectLimit($nmgp_select, 1, $_SESSION['sc_session'][$this->Ini->sc_page]['line_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]['line_form']['reg_start'] . ")" ; 
              $rs = $this->Db->SelectLimit($nmgp_select, 1, $_SESSION['sc_session'][$this->Ini->sc_page]['line_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]['line_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(); 
              $this->nmgp_botoes['Greige'] = "off";
              $this->nmgp_botoes['FGI'] = "off";
              $this->nmgp_botoes['sc_btn_0'] = "off";
              $this->nmgp_botoes['sc_btn_1'] = "off";
              $this->nmgp_botoes['Dye'] = "off";
              $this->nmgp_botoes['sc_btn_2'] = "off";
              $this->nmgp_botoes['sc_btn_3'] = "off";
              $this->nmgp_botoes['Sampling'] = "off";
              if ($this->aba_iframe)
              {
                  $this->nmgp_botoes['exit'] = 'off';
              }
          } 
          if ($rs === false && $GLOBALS["NM_ERRO_IBASE"] == 1) 
          { 
              $GLOBALS["NM_ERRO_IBASE"] = 0; 
              $this->Erro->mensagem (__FILE__, __LINE__, "critica", $this->Ini->Nm_lang['lang_errm_nfnd_extr']); 
              $this->nmgp_opcao = "novo"; 
          }  
          if ($this->nmgp_opcao != "novo") 
          { 
              $this->style = $rs->fields[0] ; 
              $this->nmgp_dados_select['style'] = $this->style;
              $this->name = $rs->fields[1] ; 
              $this->nmgp_dados_select['name'] = $this->name;
              $this->width = $rs->fields[2] ; 
              $this->nmgp_dados_select['width'] = $this->width;
              $this->fiber = $rs->fields[3] ; 
              $this->nmgp_dados_select['fiber'] = $this->fiber;
              $this->desc = $rs->fields[4] ; 
              $this->nmgp_dados_select['desc'] = $this->desc;
              $this->odesc = $rs->fields[5] ; 
              $this->nmgp_dados_select['odesc'] = $this->odesc;
              $this->price = $rs->fields[6] ; 
              $this->nmgp_dados_select['price'] = $this->price;
              $this->med = $rs->fields[7] ; 
              $this->nmgp_dados_select['med'] = $this->med;
              $this->dark = $rs->fields[8] ; 
              $this->nmgp_dados_select['dark'] = $this->dark;
              $this->hand = $rs->fields[9] ; 
              $this->nmgp_dados_select['hand'] = $this->hand;
              $this->sprice = trim($rs->fields[10]) ; 
              $this->nmgp_dados_select['sprice'] = $this->sprice;
              $this->nprice = trim($rs->fields[11]) ; 
              $this->nmgp_dados_select['nprice'] = $this->nprice;
              $this->npdate = $rs->fields[12] ; 
              $this->nmgp_dados_select['npdate'] = $this->npdate;
              $this->end1 = $rs->fields[13] ; 
              $this->nmgp_dados_select['end1'] = $this->end1;
              $this->end2 = $rs->fields[14] ; 
              $this->nmgp_dados_select['end2'] = $this->end2;
              $this->end3 = $rs->fields[15] ; 
              $this->nmgp_dados_select['end3'] = $this->end3;
              $this->date = $rs->fields[16] ; 
              $this->nmgp_dados_select['date'] = $this->date;
              $this->gs = $rs->fields[17] ; 
              $this->nmgp_dados_select['gs'] = $this->gs;
              $this->k = $rs->fields[18] ; 
              $this->nmgp_dados_select['k'] = $this->k;
              $this->mindye = $rs->fields[19] ; 
              $this->nmgp_dados_select['mindye'] = $this->mindye;
              $this->minord = $rs->fields[20] ; 
              $this->nmgp_dados_select['minord'] = $this->minord;
              $this->cpi = $rs->fields[21] ; 
              $this->nmgp_dados_select['cpi'] = $this->cpi;
              $this->wpi = $rs->fields[22] ; 
              $this->nmgp_dados_select['wpi'] = $this->wpi;
              $this->finwt = $rs->fields[23] ; 
              $this->nmgp_dados_select['finwt'] = $this->finwt;
              $this->machine = $rs->fields[24] ; 
              $this->nmgp_dados_select['machine'] = $this->machine;
              $this->stdcost = trim($rs->fields[25]) ; 
              $this->nmgp_dados_select['stdcost'] = $this->stdcost;
              $this->stdgp = trim($rs->fields[26]) ; 
              $this->nmgp_dados_select['stdgp'] = $this->stdgp;
              $this->avcost = trim($rs->fields[27]) ; 
              $this->nmgp_dados_select['avcost'] = $this->avcost;
              $this->end4 = $rs->fields[28] ; 
              $this->nmgp_dados_select['end4'] = $this->end4;
              $this->end5 = $rs->fields[29] ; 
              $this->nmgp_dados_select['end5'] = $this->end5;
              $this->yds = $rs->fields[30] ; 
              $this->nmgp_dados_select['yds'] = $this->yds;
              $this->lbs = $rs->fields[31] ; 
              $this->nmgp_dados_select['lbs'] = $this->lbs;
              $this->lbbo = $rs->fields[32] ; 
              $this->nmgp_dados_select['lbbo'] = $this->lbbo;
              $this->dye = $rs->fields[33] ; 
              $this->nmgp_dados_select['dye'] = $this->dye;
              $this->bo = $rs->fields[34] ; 
              $this->nmgp_dados_select['bo'] = $this->bo;
              $this->gc = trim($rs->fields[35]) ; 
              $this->nmgp_dados_select['gc'] = $this->gc;
              $this->conv = trim($rs->fields[36]) ; 
              $this->nmgp_dados_select['conv'] = $this->conv;
              $this->fc = trim($rs->fields[37]) ; 
              $this->nmgp_dados_select['fc'] = $this->fc;
              $this->comment = $rs->fields[38] ; 
              $this->nmgp_dados_select['comment'] = $this->comment;
              $this->spec = $rs->fields[39] ; 
              $this->nmgp_dados_select['spec'] = $this->spec;
              $this->memo = $rs->fields[40] ; 
              $this->nmgp_dados_select['memo'] = $this->memo;
              $this->ytdd = trim($rs->fields[41]) ; 
              $this->nmgp_dados_select['ytdd'] = $this->ytdd;
              $this->ytdy = trim($rs->fields[42]) ; 
              $this->nmgp_dados_select['ytdy'] = $this->ytdy;
              $this->mtdd = trim($rs->fields[43]) ; 
              $this->nmgp_dados_select['mtdd'] = $this->mtdd;
              $this->mtdy = trim($rs->fields[44]) ; 
              $this->nmgp_dados_select['mtdy'] = $this->mtdy;
              $this->histy = trim($rs->fields[45]) ; 
              $this->nmgp_dados_select['histy'] = $this->histy;
              $this->histd = trim($rs->fields[46]) ; 
              $this->nmgp_dados_select['histd'] = $this->histd;
              $this->update = $rs->fields[47] ; 
              $this->nmgp_dados_select['update'] = $this->update;
              $this->avprice = trim($rs->fields[48]) ; 
              $this->nmgp_dados_select['avprice'] = $this->avprice;
              $this->lastyry = trim($rs->fields[49]) ; 
              $this->nmgp_dados_select['lastyry'] = $this->lastyry;
              $this->lastyrd = trim($rs->fields[50]) ; 
              $this->nmgp_dados_select['lastyrd'] = $this->lastyrd;
              $this->gshort = $rs->fields[51] ; 
              $this->nmgp_dados_select['gshort'] = $this->gshort;
              $this->conv2 = trim($rs->fields[52]) ; 
              $this->nmgp_dados_select['conv2'] = $this->conv2;
              $this->conv3 = trim($rs->fields[53]) ; 
              $this->nmgp_dados_select['conv3'] = $this->conv3;
              $this->dept = $rs->fields[54] ; 
              $this->nmgp_dados_select['dept'] = $this->dept;
              $this->samples = $rs->fields[55] ; 
              $this->nmgp_dados_select['samples'] = $this->samples;
              $this->dyeleft = $rs->fields[56] ; 
              $this->nmgp_dados_select['dyeleft'] = $this->dyeleft;
              $this->line = $rs->fields[57] ; 
              $this->nmgp_dados_select['line'] = $this->line;
              $this->yarn1 = $rs->fields[58] ; 
              $this->nmgp_dados_select['yarn1'] = $this->yarn1;
              $this->per1 = $rs->fields[59] ; 
              $this->nmgp_dados_select['per1'] = $this->per1;
              $this->yarn2 = $rs->fields[60] ; 
              $this->nmgp_dados_select['yarn2'] = $this->yarn2;
              $this->per2 = $rs->fields[61] ; 
              $this->nmgp_dados_select['per2'] = $this->per2;
              $this->yarn3 = $rs->fields[62] ; 
              $this->nmgp_dados_select['yarn3'] = $this->yarn3;
              $this->per3 = $rs->fields[63] ; 
              $this->nmgp_dados_select['per3'] = $this->per3;
              $this->yarn4 = $rs->fields[64] ; 
              $this->nmgp_dados_select['yarn4'] = $this->yarn4;
              $this->per4 = $rs->fields[65] ; 
              $this->nmgp_dados_select['per4'] = $this->per4;
              $this->ozsquare = trim($rs->fields[66]) ; 
              $this->nmgp_dados_select['ozsquare'] = $this->ozsquare;
              $this->ozlin = trim($rs->fields[67]) ; 
              $this->nmgp_dados_select['ozlin'] = $this->ozlin;
              $this->sqlb = trim($rs->fields[68]) ; 
              $this->nmgp_dados_select['sqlb'] = $this->sqlb;
              $this->meterkilo = trim($rs->fields[69]) ; 
              $this->nmgp_dados_select['meterkilo'] = $this->meterkilo;
              $this->meter2kilo = trim($rs->fields[70]) ; 
              $this->nmgp_dados_select['meter2kilo'] = $this->meter2kilo;
              $this->grammeter = trim($rs->fields[71]) ; 
              $this->nmgp_dados_select['grammeter'] = $this->grammeter;
              $this->grammeter2 = trim($rs->fields[72]) ; 
              $this->nmgp_dados_select['grammeter2'] = $this->grammeter2;
              $this->del1 = $rs->fields[73] ; 
              $this->nmgp_dados_select['del1'] = $this->del1;
              $this->del2 = $rs->fields[74] ; 
              $this->nmgp_dados_select['del2'] = $this->del2;
              $this->del3 = $rs->fields[75] ; 
              $this->nmgp_dados_select['del3'] = $this->del3;
              $this->stdputup = $rs->fields[76] ; 
              $this->nmgp_dados_select['stdputup'] = $this->stdputup;
              $this->stdtube = $rs->fields[77] ; 
              $this->nmgp_dados_select['stdtube'] = $this->stdtube;
              $this->date1 = $rs->fields[78] ; 
              $this->nmgp_dados_select['date1'] = $this->date1;
              $this->date2 = $rs->fields[79] ; 
              $this->nmgp_dados_select['date2'] = $this->date2;
              $this->date3 = $rs->fields[80] ; 
              $this->nmgp_dados_select['date3'] = $this->date3;
              $this->date4 = $rs->fields[81] ; 
              $this->nmgp_dados_select['date4'] = $this->date4;
              $this->date5 = $rs->fields[82] ; 
              $this->nmgp_dados_select['date5'] = $this->date5;
              $this->date6 = $rs->fields[83] ; 
              $this->nmgp_dados_select['date6'] = $this->date6;
              $this->name1 = $rs->fields[84] ; 
              $this->nmgp_dados_select['name1'] = $this->name1;
              $this->name2 = $rs->fields[85] ; 
              $this->nmgp_dados_select['name2'] = $this->name2;
              $this->name3 = $rs->fields[86] ; 
              $this->nmgp_dados_select['name3'] = $this->name3;
              $this->name4 = $rs->fields[87] ; 
              $this->nmgp_dados_select['name4'] = $this->name4;
              $this->name5 = $rs->fields[88] ; 
              $this->nmgp_dados_select['name5'] = $this->name5;
              $this->name6 = $rs->fields[89] ; 
              $this->nmgp_dados_select['name6'] = $this->name6;
              $this->method1 = $rs->fields[90] ; 
              $this->nmgp_dados_select['method1'] = $this->method1;
              $this->method2 = $rs->fields[91] ; 
              $this->nmgp_dados_select['method2'] = $this->method2;
              $this->method3 = $rs->fields[92] ; 
              $this->nmgp_dados_select['method3'] = $this->method3;
              $this->method4 = $rs->fields[93] ; 
              $this->nmgp_dados_select['method4'] = $this->method4;
              $this->method5 = $rs->fields[94] ; 
              $this->nmgp_dados_select['method5'] = $this->method5;
              $this->method6 = $rs->fields[95] ; 
              $this->nmgp_dados_select['method6'] = $this->method6;
              $this->test1 = $rs->fields[96] ; 
              $this->nmgp_dados_select['test1'] = $this->test1;
              $this->test2 = $rs->fields[97] ; 
              $this->nmgp_dados_select['test2'] = $this->test2;
              $this->test3 = $rs->fields[98] ; 
              $this->nmgp_dados_select['test3'] = $this->test3;
              $this->test4 = $rs->fields[99] ; 
              $this->nmgp_dados_select['test4'] = $this->test4;
              $this->lot1 = $rs->fields[100] ; 
              $this->nmgp_dados_select['lot1'] = $this->lot1;
              $this->lot2 = $rs->fields[101] ; 
              $this->nmgp_dados_select['lot2'] = $this->lot2;
              $this->lot3 = $rs->fields[102] ; 
              $this->nmgp_dados_select['lot3'] = $this->lot3;
              $this->lot4 = $rs->fields[103] ; 
              $this->nmgp_dados_select['lot4'] = $this->lot4;
              $this->lot5 = $rs->fields[104] ; 
              $this->nmgp_dados_select['lot5'] = $this->lot5;
              $this->lot6 = $rs->fields[105] ; 
              $this->nmgp_dados_select['lot6'] = $this->lot6;
              $this->result1 = $rs->fields[106] ; 
              $this->nmgp_dados_select['result1'] = $this->result1;
              $this->result2 = $rs->fields[107] ; 
              $this->nmgp_dados_select['result2'] = $this->result2;
              $this->result3 = $rs->fields[108] ; 
              $this->nmgp_dados_select['result3'] = $this->result3;
              $this->result4 = $rs->fields[109] ; 
              $this->nmgp_dados_select['result4'] = $this->result4;
              $this->result5 = $rs->fields[110] ; 
              $this->nmgp_dados_select['result5'] = $this->result5;
              $this->result6 = $rs->fields[111] ; 
              $this->nmgp_dados_select['result6'] = $this->result6;
              $this->sname1 = $rs->fields[112] ; 
              $this->nmgp_dados_select['sname1'] = $this->sname1;
              $this->sname2 = $rs->fields[113] ; 
              $this->nmgp_dados_select['sname2'] = $this->sname2;
              $this->sname3 = $rs->fields[114] ; 
              $this->nmgp_dados_select['sname3'] = $this->sname3;
              $this->smethod1 = $rs->fields[115] ; 
              $this->nmgp_dados_select['smethod1'] = $this->smethod1;
              $this->smethod2 = $rs->fields[116] ; 
              $this->nmgp_dados_select['smethod2'] = $this->smethod2;
              $this->smethod3 = $rs->fields[117] ; 
              $this->nmgp_dados_select['smethod3'] = $this->smethod3;
              $this->sstd1 = $rs->fields[118] ; 
              $this->nmgp_dados_select['sstd1'] = $this->sstd1;
              $this->sstd2 = $rs->fields[119] ; 
              $this->nmgp_dados_select['sstd2'] = $this->sstd2;
              $this->sstd3 = $rs->fields[120] ; 
              $this->nmgp_dados_select['sstd3'] = $this->sstd3;
              $this->stol1 = $rs->fields[121] ; 
              $this->nmgp_dados_select['stol1'] = $this->stol1;
              $this->stol2 = $rs->fields[122] ; 
              $this->nmgp_dados_select['stol2'] = $this->stol2;
              $this->stol3 = $rs->fields[123] ; 
              $this->nmgp_dados_select['stol3'] = $this->stol3;
              $this->cgs = $rs->fields[124] ; 
              $this->nmgp_dados_select['cgs'] = $this->cgs;
              $this->smemo = $rs->fields[125] ; 
              $this->nmgp_dados_select['smemo'] = $this->smemo;
              $this->id2 = $rs->fields[126] ; 
              $this->nmgp_dados_select['id2'] = $this->id2;
              $this->grstyle = $rs->fields[127] ; 
              $this->nmgp_dados_select['grstyle'] = $this->grstyle;
              $this->stdcosting = $rs->fields[128] ; 
              $this->nmgp_dados_select['stdcosting'] = $this->stdcosting;
          $GLOBALS["NM_ERRO_IBASE"] = 0; 
              $this->nm_troca_decimal(",", ".");
              $this->sprice = (strpos(strtolower($this->sprice), "e")) ? (float)$this->sprice : $this->sprice; 
              $this->sprice = (string)$this->sprice; 
              $this->nprice = (strpos(strtolower($this->nprice), "e")) ? (float)$this->nprice : $this->nprice; 
              $this->nprice = (string)$this->nprice; 
              $this->stdcost = (strpos(strtolower($this->stdcost), "e")) ? (float)$this->stdcost : $this->stdcost; 
              $this->stdcost = (string)$this->stdcost; 
              $this->stdgp = (strpos(strtolower($this->stdgp), "e")) ? (float)$this->stdgp : $this->stdgp; 
              $this->stdgp = (string)$this->stdgp; 
              $this->avcost = (strpos(strtolower($this->avcost), "e")) ? (float)$this->avcost : $this->avcost; 
              $this->avcost = (string)$this->avcost; 
              $this->yds = (string)$this->yds; 
              $this->lbs = (string)$this->lbs; 
              $this->lbbo = (string)$this->lbbo; 
              $this->dye = (string)$this->dye; 
              $this->bo = (string)$this->bo; 
              $this->gc = (strpos(strtolower($this->gc), "e")) ? (float)$this->gc : $this->gc; 
              $this->gc = (string)$this->gc; 
              $this->conv = (strpos(strtolower($this->conv), "e")) ? (float)$this->conv : $this->conv; 
              $this->conv = (string)$this->conv; 
              $this->fc = (strpos(strtolower($this->fc), "e")) ? (float)$this->fc : $this->fc; 
              $this->fc = (string)$this->fc; 
              $this->ytdd = (strpos(strtolower($this->ytdd), "e")) ? (float)$this->ytdd : $this->ytdd; 
              $this->ytdd = (string)$this->ytdd; 
              $this->ytdy = (strpos(strtolower($this->ytdy), "e")) ? (float)$this->ytdy : $this->ytdy; 
              $this->ytdy = (string)$this->ytdy; 
              $this->mtdd = (strpos(strtolower($this->mtdd), "e")) ? (float)$this->mtdd : $this->mtdd; 
              $this->mtdd = (string)$this->mtdd; 
              $this->mtdy = (strpos(strtolower($this->mtdy), "e")) ? (float)$this->mtdy : $this->mtdy; 
              $this->mtdy = (string)$this->mtdy; 
              $this->histy = (strpos(strtolower($this->histy), "e")) ? (float)$this->histy : $this->histy; 
              $this->histy = (string)$this->histy; 
              $this->histd = (strpos(strtolower($this->histd), "e")) ? (float)$this->histd : $this->histd; 
              $this->histd = (string)$this->histd; 
              $this->avprice = (strpos(strtolower($this->avprice), "e")) ? (float)$this->avprice : $this->avprice; 
              $this->avprice = (string)$this->avprice; 
              $this->lastyry = (strpos(strtolower($this->lastyry), "e")) ? (float)$this->lastyry : $this->lastyry; 
              $this->lastyry = (string)$this->lastyry; 
              $this->lastyrd = (strpos(strtolower($this->lastyrd), "e")) ? (float)$this->lastyrd : $this->lastyrd; 
              $this->lastyrd = (string)$this->lastyrd; 
              $this->gshort = (string)$this->gshort; 
              $this->conv2 = (strpos(strtolower($this->conv2), "e")) ? (float)$this->conv2 : $this->conv2; 
              $this->conv2 = (string)$this->conv2; 
              $this->conv3 = (strpos(strtolower($this->conv3), "e")) ? (float)$this->conv3 : $this->conv3; 
              $this->conv3 = (string)$this->conv3; 
              $this->samples = (string)$this->samples; 
              $this->dyeleft = (string)$this->dyeleft; 
              $this->per1 = (string)$this->per1; 
              $this->per2 = (string)$this->per2; 
              $this->per3 = (string)$this->per3; 
              $this->per4 = (string)$this->per4; 
              $this->ozsquare = (strpos(strtolower($this->ozsquare), "e")) ? (float)$this->ozsquare : $this->ozsquare; 
              $this->ozsquare = (string)$this->ozsquare; 
              $this->ozlin = (strpos(strtolower($this->ozlin), "e")) ? (float)$this->ozlin : $this->ozlin; 
              $this->ozlin = (string)$this->ozlin; 
              $this->sqlb = (strpos(strtolower($this->sqlb), "e")) ? (float)$this->sqlb : $this->sqlb; 
              $this->sqlb = (string)$this->sqlb; 
              $this->meterkilo = (strpos(strtolower($this->meterkilo), "e")) ? (float)$this->meterkilo : $this->meterkilo; 
              $this->meterkilo = (string)$this->meterkilo; 
              $this->meter2kilo = (strpos(strtolower($this->meter2kilo), "e")) ? (float)$this->meter2kilo : $this->meter2kilo; 
              $this->meter2kilo = (string)$this->meter2kilo; 
              $this->grammeter = (strpos(strtolower($this->grammeter), "e")) ? (float)$this->grammeter : $this->grammeter; 
              $this->grammeter = (string)$this->grammeter; 
              $this->grammeter2 = (strpos(strtolower($this->grammeter2), "e")) ? (float)$this->grammeter2 : $this->grammeter2; 
              $this->grammeter2 = (string)$this->grammeter2; 
              $this->id2 = (string)$this->id2; 
              $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['parms'] = "style?#?$this->style?@?id2?#?$this->id2?@?";
          } 
          $_SESSION['sc_session'][$this->Ini->sc_page]['line_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]['line_form']['reg_start'];
              $this->Nav_permite_ava = $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['reg_start'] < $qt_geral_reg_line_form;
              $_SESSION['sc_session'][$this->Ini->sc_page]['line_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->style = "" ;  
              $this->name = "" ;  
              $this->width = "" ;  
              $this->fiber = "" ;  
              $this->desc = "" ;  
              $this->odesc = "" ;  
              $this->price = "" ;  
              $this->med = "" ;  
              $this->dark = "" ;  
              $this->hand = "" ;  
              $this->sprice = "" ;  
              $this->nprice = "" ;  
              $this->npdate = "" ;  
              $this->npdate_hora = "" ;  
              $this->end1 = "" ;  
              $this->end2 = "" ;  
              $this->end3 = "" ;  
              $this->date = "" ;  
              $this->date_hora = "" ;  
              $this->gs = "" ;  
              $this->k = "" ;  
              $this->mindye = "" ;  
              $this->minord = "" ;  
              $this->cpi = "" ;  
              $this->wpi = "" ;  
              $this->finwt = "" ;  
              $this->machine = "" ;  
              $this->stdcost = "" ;  
              $this->stdgp = "" ;  
              $this->avcost = "" ;  
              $this->end4 = "" ;  
              $this->end5 = "" ;  
              $this->yds = "" ;  
              $this->lbs = "" ;  
              $this->lbbo = "" ;  
              $this->dye = "" ;  
              $this->bo = "" ;  
              $this->gc = "" ;  
              $this->conv = "" ;  
              $this->fc = "" ;  
              $this->comment = "" ;  
              $this->spec = "" ;  
              $this->memo = "" ;  
              $this->ytdd = "" ;  
              $this->ytdy = "" ;  
              $this->mtdd = "" ;  
              $this->mtdy = "" ;  
              $this->histy = "" ;  
              $this->histd = "" ;  
              $this->update = "" ;  
              $this->update_hora = "" ;  
              $this->avprice = "" ;  
              $this->lastyry = "" ;  
              $this->lastyrd = "" ;  
              $this->gshort = "" ;  
              $this->conv2 = "" ;  
              $this->conv3 = "" ;  
              $this->dept = "" ;  
              $this->samples = "" ;  
              $this->dyeleft = "" ;  
              $this->line = "" ;  
              $this->yarn1 = "" ;  
              $this->per1 = "" ;  
              $this->yarn2 = "" ;  
              $this->per2 = "" ;  
              $this->yarn3 = "" ;  
              $this->per3 = "" ;  
              $this->yarn4 = "" ;  
              $this->per4 = "" ;  
              $this->ozsquare = "" ;  
              $this->ozlin = "" ;  
              $this->sqlb = "" ;  
              $this->meterkilo = "" ;  
              $this->meter2kilo = "" ;  
              $this->grammeter = "" ;  
              $this->grammeter2 = "" ;  
              $this->del1 = "" ;  
              $this->del2 = "" ;  
              $this->del3 = "" ;  
              $this->stdputup = "" ;  
              $this->stdtube = "" ;  
              $this->date1 = "" ;  
              $this->date1_hora = "" ;  
              $this->date2 = "" ;  
              $this->date2_hora = "" ;  
              $this->date3 = "" ;  
              $this->date3_hora = "" ;  
              $this->date4 = "" ;  
              $this->date4_hora = "" ;  
              $this->date5 = "" ;  
              $this->date5_hora = "" ;  
              $this->date6 = "" ;  
              $this->date6_hora = "" ;  
              $this->name1 = "" ;  
              $this->name2 = "" ;  
              $this->name3 = "" ;  
              $this->name4 = "" ;  
              $this->name5 = "" ;  
              $this->name6 = "" ;  
              $this->method1 = "" ;  
              $this->method2 = "" ;  
              $this->method3 = "" ;  
              $this->method4 = "" ;  
              $this->method5 = "" ;  
              $this->method6 = "" ;  
              $this->test1 = "" ;  
              $this->test2 = "" ;  
              $this->test3 = "" ;  
              $this->test4 = "" ;  
              $this->lot1 = "" ;  
              $this->lot2 = "" ;  
              $this->lot3 = "" ;  
              $this->lot4 = "" ;  
              $this->lot5 = "" ;  
              $this->lot6 = "" ;  
              $this->result1 = "" ;  
              $this->result2 = "" ;  
              $this->result3 = "" ;  
              $this->result4 = "" ;  
              $this->result5 = "" ;  
              $this->result6 = "" ;  
              $this->sname1 = "" ;  
              $this->sname2 = "" ;  
              $this->sname3 = "" ;  
              $this->smethod1 = "" ;  
              $this->smethod2 = "" ;  
              $this->smethod3 = "" ;  
              $this->sstd1 = "" ;  
              $this->sstd2 = "" ;  
              $this->sstd3 = "" ;  
              $this->stol1 = "" ;  
              $this->stol2 = "" ;  
              $this->stol3 = "" ;  
              $this->cgs = "" ;  
              $this->smemo = "" ;  
              $this->id2 = "" ;  
              $this->grstyle = "" ;  
              $this->stdcosting = "" ;  
              $this->image = "" ;  
              $this->formatado = false;
          }
          if (($this->Embutida_form || $this->Embutida_multi) && isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['foreign_key']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['foreign_key']))
          {
              foreach ($_SESSION['sc_session'][$this->Ini->sc_page]['line_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") 
      {
          $_SESSION["var_end1"] = $this->end1;  
          $_SESSION["var_end2"] = $this->end2;  
          $_SESSION["var_end3"] = $this->end3;  
          $_SESSION["var_end4"] = $this->end4;  
          $_SESSION["var_end5"] = $this->end5;  
      }
      $this->nm_proc_onload();
      $_SESSION['sc_session'][$this->Ini->sc_page]['line_cmatch_edit_grid']['embutida_parms'] = "var_conv?#?" . $this->nmgp_dados_form['conv'] . "?@?NM_btn_insert?#?S?@?NM_btn_update?#?S?@?NM_btn_delete?#?S?@?NM_btn_navega?#?N?@?";
      $_SESSION['sc_session'][$this->Ini->sc_page]['greige_grstyle_ro2_form']['embutida_parms'] = "NM_btn_insert?#?N?@?NM_btn_update?#?N?@?NM_btn_delete?#?N?@?NM_btn_navega?#?N?@?";
  }
// 
//-- 
   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 STYLE = '$this->style' and ID2 < $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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 STYLE = '$this->style' and ID2 < $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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 STYLE = '$this->style' and ID2 < $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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 STYLE = '$this->style' and ID2 < $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' and ID2 < $this->id2" . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' and ID2 < $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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(STYLE) from " . $this->Ini->nm_tabela . " where STYLE < '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(STYLE) from " . $this->Ini->nm_tabela . " where STYLE < '$this->style'" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(STYLE) from " . $this->Ini->nm_tabela . " where STYLE < '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(STYLE) from " . $this->Ini->nm_tabela . " where STYLE < '$this->style'" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(STYLE) from " . $this->Ini->nm_tabela . " where STYLE < '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(STYLE) from " . $this->Ini->nm_tabela . " where STYLE < '$this->style'" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(STYLE) from " . $this->Ini->nm_tabela . " where STYLE < '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(STYLE) from " . $this->Ini->nm_tabela . " where STYLE < '$this->style'" . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(STYLE) from " . $this->Ini->nm_tabela . " where STYLE < '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(STYLE) from " . $this->Ini->nm_tabela . " where STYLE < '$this->style'" . $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->style = 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 STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style'" . $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 STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style'" . $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 STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style'" . $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 STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style'" . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style'" . $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 STYLE = '$this->style' and ID2 > $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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 STYLE = '$this->style' and ID2 > $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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 STYLE = '$this->style' and ID2 > $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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 STYLE = '$this->style' and ID2 > $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' and ID2 > $this->id2" . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' and ID2 > $this->id2" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style' 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(STYLE) from " . $this->Ini->nm_tabela . " where STYLE > '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(STYLE) from " . $this->Ini->nm_tabela . " where STYLE > '$this->style'" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(STYLE) from " . $this->Ini->nm_tabela . " where STYLE > '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(STYLE) from " . $this->Ini->nm_tabela . " where STYLE > '$this->style'" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(STYLE) from " . $this->Ini->nm_tabela . " where STYLE > '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(STYLE) from " . $this->Ini->nm_tabela . " where STYLE > '$this->style'" . $str_where_filter); 
     }  
     elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(STYLE) from " . $this->Ini->nm_tabela . " where STYLE > '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(STYLE) from " . $this->Ini->nm_tabela . " where STYLE > '$this->style'" . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(STYLE) from " . $this->Ini->nm_tabela . " where STYLE > '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(STYLE) from " . $this->Ini->nm_tabela . " where STYLE > '$this->style'" . $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->style = 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 STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style'" . $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 STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style'" . $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 STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style'" . $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 STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style'" . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . " where STYLE = '$this->style'" . $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(STYLE) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select min(STYLE) 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(STYLE) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select min(STYLE) 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(STYLE) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select min(STYLE) 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(STYLE) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select min(STYLE) from " . $this->Ini->nm_tabela . " " . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(STYLE) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select min(STYLE) 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->style = 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 STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . "  where STYLE = '$this->style'" . $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 STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . "  where STYLE = '$this->style'" . $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 STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . "  where STYLE = '$this->style'" . $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 STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . "  where STYLE = '$this->style'" . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select min(ID2) from " . $this->Ini->nm_tabela . "  where STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select min(ID2) from " . $this->Ini->nm_tabela . "  where STYLE = '$this->style'" . $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(STYLE) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select max(STYLE) 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(STYLE) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select max(STYLE) 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(STYLE) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select max(STYLE) 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(STYLE) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select max(STYLE) from " . $this->Ini->nm_tabela . " " . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(STYLE) from " . $this->Ini->nm_tabela . " " . $str_where_filter; 
         $rs = $this->Db->Execute("select max(STYLE) 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->style = 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 STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . "  where STYLE = '$this->style'" . $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 STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . "  where STYLE = '$this->style'" . $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 STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . "  where STYLE = '$this->style'" . $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 STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . "  where STYLE = '$this->style'" . $str_where_filter); 
     }  
     else  
     {
         $_SESSION['scriptcase']['sc_sql_ult_comando'] = "select max(ID2) from " . $this->Ini->nm_tabela . "  where STYLE = '$this->style'" . $str_where_filter; 
         $rs = $this->Db->Execute("select max(ID2) from " . $this->Ini->nm_tabela . "  where STYLE = '$this->style'" . $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]['line_form']['total'] + 1;
       $rec_fim    = $_SESSION['sc_session'][$this->Ini->sc_page]['line_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 CONV_onChange()
{
$_SESSION['scriptcase']['line_form']['contr_erro'] = 'on';
       
$original_style = $this->style;
$original_stdcost = $this->stdcost;
$original_conv = $this->conv;
$original_sprice = $this->sprice;
$original_stdgp = $this->stdgp;

$this->costupdate();

$modificado_style = $this->style;
$modificado_stdcost = $this->stdcost;
$modificado_conv = $this->conv;
$modificado_sprice = $this->sprice;
$modificado_stdgp = $this->stdgp;
$this->nm_formatar_campos('style', 'stdcost', 'conv', 'sprice', 'stdgp');
if ($original_style != $modificado_style || (isset($bFlagRead_style) && $bFlagRead_style))
{
    $this->ajax_return_values_style(true);
}
if ($original_stdcost != $modificado_stdcost || (isset($bFlagRead_stdcost) && $bFlagRead_stdcost))
{
    $this->ajax_return_values_stdcost(true);
}
if ($original_conv != $modificado_conv || (isset($bFlagRead_conv) && $bFlagRead_conv))
{
    $this->ajax_return_values_conv(true);
}
if ($original_sprice != $modificado_sprice || (isset($bFlagRead_sprice) && $bFlagRead_sprice))
{
    $this->ajax_return_values_sprice(true);
}
if ($original_stdgp != $modificado_stdgp || (isset($bFlagRead_stdgp) && $bFlagRead_stdgp))
{
    $this->ajax_return_values_stdgp(true);
}
line_form_pack_ajax_response();
exit;


$_SESSION['scriptcase']['line_form']['contr_erro'] = 'off';
}
function STDGP_onChange()
{
$_SESSION['scriptcase']['line_form']['contr_erro'] = 'on';
       
$original_style = $this->style;
$original_stdcost = $this->stdcost;
$original_conv = $this->conv;
$original_sprice = $this->sprice;
$original_stdgp = $this->stdgp;

$this->costupdate();

$modificado_style = $this->style;
$modificado_stdcost = $this->stdcost;
$modificado_conv = $this->conv;
$modificado_sprice = $this->sprice;
$modificado_stdgp = $this->stdgp;
$this->nm_formatar_campos('style', 'stdcost', 'conv', 'sprice', 'stdgp');
if ($original_style != $modificado_style || (isset($bFlagRead_style) && $bFlagRead_style))
{
    $this->ajax_return_values_style(true);
}
if ($original_stdcost != $modificado_stdcost || (isset($bFlagRead_stdcost) && $bFlagRead_stdcost))
{
    $this->ajax_return_values_stdcost(true);
}
if ($original_conv != $modificado_conv || (isset($bFlagRead_conv) && $bFlagRead_conv))
{
    $this->ajax_return_values_conv(true);
}
if ($original_sprice != $modificado_sprice || (isset($bFlagRead_sprice) && $bFlagRead_sprice))
{
    $this->ajax_return_values_sprice(true);
}
if ($original_stdgp != $modificado_stdgp || (isset($bFlagRead_stdgp) && $bFlagRead_stdgp))
{
    $this->ajax_return_values_stdgp(true);
}
line_form_pack_ajax_response();
exit;


$_SESSION['scriptcase']['line_form']['contr_erro'] = 'off';
}
function costupdate()
{
$_SESSION['scriptcase']['line_form']['contr_erro'] = 'on';
       
$check_sql = "SELECT sum(amount)"
   . " FROM cmatch"
   . " WHERE style = '" . $this->style  . "'";
 
      $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->stdcost  = $this->rs[0][0]/$this->conv ;
	$this->sprice  = $this->stdcost  / (1-$this->stdgp );
}
else     
{
		    $this->stdcost  = 'NA';
			$this->sprice  = 'NA';
}
$_SESSION['scriptcase']['line_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]['line_form']['botoes'] = $this->nmgp_botoes;
     if ($this->nmgp_opcao != "recarga" && $this->nmgp_opcao != "muda_form")
     {
         $_SESSION['sc_session'][$this->Ini->sc_page]['line_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]['line_form']['run_iframe'] == "F" || $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['run_iframe'] == "R") && $this->nm_flag_iframe && empty($this->nm_todas_criticas))
     {
          if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['run_iframe_ajax']))
          {
              $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['retorno_edit'] = array("edit", "");
          }
          else
          {
              $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['retorno_edit'] .= "&nmgp_opcao=edit";
          }
          if ($this->sc_evento == "insert" && $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['run_iframe'] == "F")
          {
              if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['run_iframe_ajax']))
              {
                  $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['retorno_edit'] = array("edit", "fim");
              }
              else
              {
                  $_SESSION['sc_session'][$this->Ini->sc_page]['line_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]['line_form']['run_iframe_ajax']))
              {
                  $this->NM_ajax_info['ajaxJavascript'][] = array("parent.ajax_navigate", $_SESSION['sc_session'][$this->Ini->sc_page]['line_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]['line_form']['retorno_edit'];
                  $this->NM_ajax_info['redir']['target'] = $sJsParent;
              }
              line_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]['line_form']['run_iframe_ajax']))
    {
        $opc = ($_SESSION['sc_session'][$this->Ini->sc_page]['line_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]['line_form']['retorno_edit'] . "';";
    }
?>
         </script>
         </body></html>
<?php
         exit;
     }
        include_once("line_form_form0.php");
        include_once("line_form_form1.php");
        include_once("line_form_form2.php");
        include_once("line_form_form3.php");
        include_once("line_form_form4.php");
        include_once("line_form_form5.php");
        include_once("line_form_form6.php");
        include_once("line_form_form7.php");
        include_once("line_form_form8.php");
        include_once("line_form_form9.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]['line_form']['where_filter']);
          unset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['total']);
          unset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['fast_search']);
          if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['where_detal']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['where_detal'])) 
          {
              $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['where_filter'] = $_SESSION['sc_session'][$this->Ini->sc_page]['line_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 == "style") 
      {
          $this->SC_monta_condicao($comando, "STYLE", $arg_search, $data_search);
      }
      if ($field == "width") 
      {
          $this->SC_monta_condicao($comando, "WIDTH", $arg_search, $data_search);
      }
      if ($field == "fiber") 
      {
          $this->SC_monta_condicao($comando, "FIBER", $arg_search, $data_search);
      }
      if ($field == "desc") 
      {
          $this->SC_monta_condicao($comando, "`DESC`", $arg_search, $data_search);
      }
      if ($field == "odesc") 
      {
          $this->SC_monta_condicao($comando, "ODESC", $arg_search, $data_search);
      }
      if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['where_detal']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['where_detal']) && !empty($comando)) 
      {
          $comando = $_SESSION['sc_session'][$this->Ini->sc_page]['line_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_line_form = isset($rt->fields[0]) ? $rt->fields[0] - 1 : 0; 
     $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['total'] = $qt_geral_reg_line_form;
      $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['where_filter'] = $comando;
      $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['fast_search'][0] = $field;
      $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['fast_search'][1] = $arg_search;
      $_SESSION['sc_session'][$this->Ini->sc_page]['line_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[] = "sprice";$nm_numeric[] = "nprice";$nm_numeric[] = "stdcost";$nm_numeric[] = "stdgp";$nm_numeric[] = "avcost";$nm_numeric[] = "yds";$nm_numeric[] = "lbs";$nm_numeric[] = "lbbo";$nm_numeric[] = "dye";$nm_numeric[] = "bo";$nm_numeric[] = "gc";$nm_numeric[] = "conv";$nm_numeric[] = "fc";$nm_numeric[] = "ytdd";$nm_numeric[] = "ytdy";$nm_numeric[] = "mtdd";$nm_numeric[] = "mtdy";$nm_numeric[] = "histy";$nm_numeric[] = "histd";$nm_numeric[] = "avprice";$nm_numeric[] = "lastyry";$nm_numeric[] = "lastyrd";$nm_numeric[] = "gshort";$nm_numeric[] = "conv2";$nm_numeric[] = "conv3";$nm_numeric[] = "samples";$nm_numeric[] = "dyeleft";$nm_numeric[] = "per1";$nm_numeric[] = "per2";$nm_numeric[] = "per3";$nm_numeric[] = "per4";$nm_numeric[] = "ozsquare";$nm_numeric[] = "ozlin";$nm_numeric[] = "sqlb";$nm_numeric[] = "meterkilo";$nm_numeric[] = "meter2kilo";$nm_numeric[] = "grammeter";$nm_numeric[] = "grammeter2";$nm_numeric[] = "id2";
      if (in_array($campo_join, $nm_numeric))
      {
         if ($_SESSION['sc_session'][$this->Ini->sc_page]['line_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[] = "npdate";$Nm_datas[] = "date";$Nm_datas[] = "update";$Nm_datas[] = "date1";$Nm_datas[] = "date2";$Nm_datas[] = "date3";$Nm_datas[] = "date4";$Nm_datas[] = "date5";$Nm_datas[] = "date6";
          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]['line_form']['sc_outra_jan']) && $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['sc_outra_jan'])
   {
       $nmgp_saida_form = "line_form_fim.php";
   }
   if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['redir']) && $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['redir'] == 'redir')
   {
       unset($_SESSION['sc_session'][$this->Ini->sc_page]['line_form']);
   }
   unset($_SESSION['sc_session'][$this->Ini->sc_page]['line_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;
       }
       line_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]['line_form']['sc_modal']) && $_SESSION['sc_session'][$this->Ini->sc_page]['line_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;
}
function nmgp_redireciona_form($nm_apl_dest, $nm_apl_retorno, $nm_apl_parms, $nm_target="", $opc="", $alt_modal=430, $larg_modal=630)
{
   if (isset($this->NM_is_redirected) && $this->NM_is_redirected)
   {
       return;
   }
   $_SESSION['sc_session'][$this->Ini->sc_page]['line_cmatch_edit_grid']['reg_start'] = "";
   unset($_SESSION['sc_session'][$this->Ini->sc_page]['line_cmatch_edit_grid']['total']);
   $_SESSION['sc_session'][$this->Ini->sc_page]['greige_grstyle_ro2_form']['reg_start'] = "";
   unset($_SESSION['sc_session'][$this->Ini->sc_page]['greige_grstyle_ro2_form']['total']);
   if (is_array($nm_apl_parms))
   {
       $tmp_parms = "";
       foreach ($nm_apl_parms as $par => $val)
       {
           $par = trim($par);
           $val = trim($val);
           $tmp_parms .= str_replace(".", "_", $par) . "?#?";
           if (substr($val, 0, 1) == "$")
           {
               $tmp_parms .= $$val;
           }
           elseif (substr($val, 0, 1) == "{")
           {
               $val        = substr($val, 1, -1);
               $tmp_parms .= $this->$val;
           }
           elseif (substr($val, 0, 1) == "[")
           {
               $tmp_parms .= $_SESSION['sc_session'][$this->Ini->sc_page]['line_form'][substr($val, 1, -1)];
           }
           else
           {
               $tmp_parms .= $val;
           }
           $tmp_parms .= "?@?";
       }
       $nm_apl_parms = $tmp_parms;
   }
   if (empty($opc))
   {
       $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['opcao'] = "";
       $_SESSION['sc_session'][$this->Ini->sc_page]['line_form']['retorno_edit'] = "";
   }
   $nm_target_form = (empty($nm_target)) ? "_self" : $nm_target;
   if (strtolower(substr($nm_apl_dest, -4)) != ".php" && (strtolower(substr($nm_apl_dest, 0, 7)) == "http://" || strtolower(substr($nm_apl_dest, 0, 8)) == "https://" || strtolower(substr($nm_apl_dest, 0, 3)) == "../"))
   {
       if ($this->NM_ajax_flag)
       {
           $this->NM_ajax_info['redir']['metodo'] = 'location';
           $this->NM_ajax_info['redir']['action'] = $nm_apl_dest;
           $this->NM_ajax_info['redir']['target'] = $nm_target_form;
           line_form_pack_ajax_response();
           exit;
       }
       echo "<SCRIPT language=\"javascript\">";
       if (strtolower($nm_target) == "_blank")
       {
           echo "window.open ('" . $nm_apl_dest . "');";
           echo "</SCRIPT>";
           return;
       }
       else
       {
           echo "window.location='" . $nm_apl_dest . "';";
           echo "</SCRIPT>";
           $this->NM_close_db();
           exit;
       }
   }
   $dir = explode("/", $nm_apl_dest);
   if (count($dir) == 1)
   {
       $nm_apl_dest = str_replace(".php", "", $nm_apl_dest);
       $nm_apl_dest = $this->Ini->path_link . SC_dir_app_name($nm_apl_dest) . "/" . $nm_apl_dest . ".php";
   }
   if ($this->NM_ajax_flag)
   {
       $nm_apl_parms = str_replace("?#?", "*scin", $nm_apl_parms);
       $nm_apl_parms = str_replace("?@?", "*scout", $nm_apl_parms);
       $this->NM_ajax_info['redir']['metodo']     = 'post';
       $this->NM_ajax_info['redir']['action']     = $nm_apl_dest;
       $this->NM_ajax_info['redir']['nmgp_parms'] = $nm_apl_parms;
       $this->NM_ajax_info['redir']['target']     = $nm_target_form;
       $this->NM_ajax_info['redir']['h_modal']    = $alt_modal;
       $this->NM_ajax_info['redir']['w_modal']    = $larg_modal;
       if ($nm_target_form == "_blank")
       {
           $this->NM_ajax_info['redir']['nmgp_outra_jan'] = 'true';
       }
       else
       {
           $this->NM_ajax_info['redir']['nmgp_url_saida']      = $nm_apl_retorno;
           $this->NM_ajax_info['redir']['script_case_init']    = $this->Ini->sc_page;
           $this->NM_ajax_info['redir']['script_case_session'] = session_id();
       }
       line_form_pack_ajax_response();
       exit;
   }
   if ($nm_target == "modal")
   {
       if (!empty($nm_apl_parms))
       {
           $nm_apl_parms = str_replace("?#?", "*scin", $nm_apl_parms);
           $nm_apl_parms = str_replace("?@?", "*scout", $nm_apl_parms);
           $nm_apl_parms = "nmgp_parms=" . $nm_apl_parms . "&";
       }
       $par_modal = "?script_case_init=" . $this->Ini->sc_page . "&script_case_session=" . session_id() . "&nmgp_outra_jan=true&nmgp_url_saida=modal&NMSC_modal=ok&";
       $this->redir_modal = "$(function() { tb_show('', '" . $nm_apl_dest . $par_modal . $nm_apl_parms . "TB_iframe=true&modal=true&height=" . $alt_modal . "&width=" . $larg_modal . "', '') })";
       $this->NM_is_redirected = true;
       return;
   }
?>
<!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="Fredir" method="post" 
                  target="_self"> 
  <input type="hidden" name="nmgp_parms" value="<?php echo NM_encode_input($nm_apl_parms); ?>"/>
<?php
   if ($nm_target_form == "_blank")
   {
?>
  <input type="hidden" name="nmgp_outra_jan" value="true"/> 
<?php
   }
   else
   {
?>
  <input type="hidden" name="nmgp_url_saida" value="<?php echo NM_encode_input($nm_apl_retorno) ?>">
  <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()); ?>"> 
<?php
   }
?>
</form> 
   <SCRIPT type="text/javascript">
<?php
   if ($nm_target_form == "modal")
   {
?>
       $(document).ready(function(){
           tb_show('', '<?php echo $nm_apl_dest ?>?script_case_init=<?php echo $this->Ini->sc_page; ?>&script_case_session=<?php echo session_id() ?> &nmgp_url_saida=modal&nmgp_parms=<?php echo NM_encode_input($nm_apl_parms); ?>&nmgp_outra_jan=true&TB_iframe=true&height=<?php echo $alt_modal; ?>&width=<?php echo $larg_modal; ?>&modal=true', '');
       });
<?php
   }
   else
   {
?>
       document.Fredir.target = "<?php echo $nm_target_form ?>"; 
       document.Fredir.action = "<?php echo $nm_apl_dest ?>";
       document.Fredir.submit();
<?php
   }
?>
   </SCRIPT>
   </BODY>
   </HTML>
<?php
   if ($nm_target_form != "_blank" && $nm_target_form != "modal")
   {
       $this->NM_close_db();
       exit;
   }
}
}
?>
