<?php
class beam_knitorder_pdf_grid
{
   var $Ini;
   var $Erro;
   var $Pdf;
   var $Db;
   var $rs_grid;
   var $nm_grid_sem_reg;
   var $SC_seq_register;
   var $nm_location;
   var $nm_data;
   var $nm_cod_barra;
   var $sc_proc_grid; 
   var $nmgp_botoes = array();
   var $Campos_Mens_erro;
   var $NM_raiz_img; 
   var $Font_ttf; 
   var $p_o_number = array();
   var $top_p_o_ = array();
   var $bot_p_o_ = array();
   var $date = array();
   var $to = array();
   var $ship_to = array();
   var $location = array();
   var $delivery = array();
   var $terms = array();
   var $desc = array();
   var $lbs_orderd = array();
   var $lbs_recd = array();
   var $lbs_open = array();
   var $order_amt = array();
   var $lbs_allocd = array();
   var $lbs_avail = array();
   var $lbs_knit = array();
   var $warp_loss = array();
   var $lbs_sold = array();
   var $inventory = array();
   var $price_lb_w = array();
   var $cost_lb_w = array();
   var $cost_lb_y = array();
   var $cost_lb_t = array();
   var $beam_code = array();
   var $yarn_code = array();
   var $status = array();
   var $tcost = array();
   var $samt = array();
   var $tv = array();
   var $size = array();
   var $b_s = array();
   var $waste = array();
   var $acost = array();
   var $fiber = array();
   var $ns = array();
   var $markdown = array();
   var $mdvalue = array();
   var $den = array();
   var $fil = array();
   var $luster = array();
   var $producer = array();
   var $merge = array();
   var $ac = array();
   var $comment = array();
   var $id2 = array();
//--- 
 function monta_grid($linhas = 0)
 {

   clearstatcache();
   $this->inicializa();
   $this->grid();
 }
//--- 
 function inicializa()
 {
   global $nm_saida, 
   $rec, $nmgp_chave, $nmgp_opcao, $nmgp_ordem, $nmgp_chave_det, 
   $nmgp_quant_linhas, $nmgp_quant_colunas, $nmgp_url_saida, $nmgp_parms;
//
   $this->nm_data = new nm_data("en_us");
   $this->default_font = 'Arial';
   $this->default_font_sr  = 'Arial';
   $this->default_style    = '';
   $this->default_style_sr = 'B';
   $Tp_papel = "Letter";
   $old_dir = getcwd();
   $File_font_ttf = "";
   $this->Font_ttf = false;
   if (in_array(trim($this->Ini->str_lang), $this->Ini->nm_font_ttf) && is_dir($this->Ini->path_third . "/tfpdf/"))
   {
       if (in_array(trim($this->Ini->str_lang), $this->Ini->nm_ttf_arab))
       {
           $this->default_font    = "Simplified Arabic";
           $this->default_font_sr = "Simplified Arabic";
           $File_font_ttf         = "simpo.ttf";
       }
       if (in_array(trim($this->Ini->str_lang), $this->Ini->nm_ttf_jap))
       {
           $this->default_font    = "IPAGothic";
           $this->default_font_sr = "IPAGothic";
           $File_font_ttf         = "ipag.ttf";
       }
       if (in_array(trim($this->Ini->str_lang), $this->Ini->nm_ttf_rus))
       {
           $this->default_font    = "Gentium";
           $this->default_font_sr = "Gentium";
           $File_font_ttf         = "GenR102.TTF";
       }
       if (in_array(trim($this->Ini->str_lang), $this->Ini->nm_ttf_chi))
       {
           $this->default_font    = "HanWangMingMedium";
           $this->default_font_sr = "HanWangMingMedium";
           $File_font_ttf         = "wt002.ttf";
       }
       if (in_array(trim($this->Ini->str_lang), $this->Ini->nm_ttf_thai))
       {
           $this->default_font    = "Courpro";
           $this->default_font_sr = "Courpro";
           $File_font_ttf         = "courpro.ttf";
       }
       $this->default_style    = '';
       $this->default_style_sr = '';
       chdir($this->Ini->path_third . "/tfpdf/");
   }
   else
   {
       chdir($this->Ini->path_third . "/fpdf/");
   }
   include_once("visibility.php");
   chdir($old_dir);
   $this->Pdf = new PDF_Visibility('P', 'mm', $Tp_papel);
   if (!empty($File_font_ttf))
   {
       $this->Font_ttf = true;
       $this->Pdf->AddFont($this->default_font, '', $File_font_ttf, true);
   }
   $_SESSION['beam_knitorder_pdf']['Font_ttf'] = $this->Font_ttf;
   $this->Pdf->SetDisplayMode('real');
   $this->Pdf->AliasNbPages();
   $this->aba_iframe = false;
   if (isset($_SESSION['scriptcase']['sc_aba_iframe']))
   {
       foreach ($_SESSION['scriptcase']['sc_aba_iframe'] as $aba => $apls_aba)
       {
           if (in_array("beam_knitorder_pdf", $apls_aba))
           {
               $this->aba_iframe = true;
               break;
           }
       }
   }
   if ($_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['iframe_menu'] && (!isset($_SESSION['scriptcase']['menu_mobile']) || empty($_SESSION['scriptcase']['menu_mobile'])))
   {
       $this->aba_iframe = true;
   }
   $this->nmgp_botoes['exit'] = "on";
   $this->sc_proc_grid = false; 
   $this->NM_raiz_img = $this->Ini->root;
   $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
   $this->nm_where_dinamico = "";
   $this->nm_grid_colunas = 0;
   if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['campos_busca']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['campos_busca']))
   { 
       $this->p_o_number[0] = $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['campos_busca']['p_o_number']; 
       $tmp_pos = strpos($this->p_o_number[0], "##@@");
       if ($tmp_pos !== false)
       {
           $this->p_o_number[0] = substr($this->p_o_number[0], 0, $tmp_pos);
       }
       $this->top_p_o_[0] = $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['campos_busca']['top_p_o_']; 
       $tmp_pos = strpos($this->top_p_o_[0], "##@@");
       if ($tmp_pos !== false)
       {
           $this->top_p_o_[0] = substr($this->top_p_o_[0], 0, $tmp_pos);
       }
       $this->bot_p_o_[0] = $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['campos_busca']['bot_p_o_']; 
       $tmp_pos = strpos($this->bot_p_o_[0], "##@@");
       if ($tmp_pos !== false)
       {
           $this->bot_p_o_[0] = substr($this->bot_p_o_[0], 0, $tmp_pos);
       }
       $this->date[0] = $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['campos_busca']['date']; 
       $tmp_pos = strpos($this->date[0], "##@@");
       if ($tmp_pos !== false)
       {
           $this->date[0] = substr($this->date[0], 0, $tmp_pos);
       }
       $this->id2[0] = $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['campos_busca']['id2']; 
       $tmp_pos = strpos($this->id2[0], "##@@");
       if ($tmp_pos !== false)
       {
           $this->id2[0] = substr($this->id2[0], 0, $tmp_pos);
       }
   } 
   $this->nm_field_dinamico = array();
   $this->nm_order_dinamico = array();
   $this->sc_where_orig   = $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_orig'];
   $this->sc_where_atual  = $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_pesq'];
   $this->sc_where_filtro = $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_pesq_filtro'];
   $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['scriptcase']['contr_link_emb'] = $this->nm_location;
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['qt_col_grid'] = 1 ;  
   if (isset($_SESSION['scriptcase']['sc_apl_conf']['beam_knitorder_pdf']['cols']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['beam_knitorder_pdf']['cols']))
   {
       $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['qt_col_grid'] = $_SESSION['scriptcase']['sc_apl_conf']['beam_knitorder_pdf']['cols'];  
       unset($_SESSION['scriptcase']['sc_apl_conf']['beam_knitorder_pdf']['cols']);
   }
   if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['ordem_select']))  
   { 
       $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['ordem_select'] = array(); 
   } 
   if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['ordem_quebra']))  
   { 
       $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['ordem_grid'] = "" ; 
       $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['ordem_ant']  = ""; 
       $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['ordem_desc'] = "" ; 
   }   
   if (!empty($nmgp_parms) && $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['opcao'] != "pdf")   
   { 
       $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['opcao'] = "igual";
       $rec = "ini";
   }
   if (!isset($_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_orig']) || $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['prim_cons'] || !empty($nmgp_parms))  
   { 
       $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['prim_cons'] = false;  
       $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_orig'] = " where p_o_number='" . $_SESSION['var_po'] . "'";  
       $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_pesq']        = $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_orig'];  
       $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_pesq_ant']    = $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_orig'];  
       $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['cond_pesq']         = ""; 
       $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_pesq_filtro'] = "";
   }   
   if  (!empty($this->nm_where_dinamico)) 
   {   
       $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_pesq'] .= $this->nm_where_dinamico;
   }   
   $this->sc_where_orig   = $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_orig'];
   $this->sc_where_atual  = $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_pesq'];
   $this->sc_where_filtro = $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_pesq_filtro'];
//
   if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['tot_geral'][1])) 
   { 
       $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['total'] = $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['tot_geral'][1] ;  
   }
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_pesq_ant'] = $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_pesq'];  
//----- 
   if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sybase))
   { 
       $nmgp_select = "SELECT P_O_NUMBER, TOP_P_O_, BOT_P_O_, str_replace (convert(char(10),`DATE`,102), '.', '-') + ' ' + convert(char(8),`DATE`,20) as sc_def_col_1, `TO` as sc_def_col_2, SHIP_TO, LOCATION, DELIVERY, TERMS, `DESC` as sc_def_col_3, LBS_ORDERD, LBS_RECD, LBS_OPEN, ORDER_AMT, LBS_ALLOCD, LBS_AVAIL, LBS_KNIT, WARP_LOSS, LBS_SOLD, INVENTORY, PRICE_LB_W, COST_LB_W, COST_LB_Y, COST_LB_T, BEAM_CODE, YARN_CODE, STATUS, TCOST, SAMT, TV, SIZE, B_S, WASTE, ACOST, FIBER, NS, MARKDOWN, MDVALUE, DEN, FIL, LUSTER, PRODUCER, MERGE, AC, COMMENT, ID2 from " . $this->Ini->nm_tabela; 
   } 
   elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mysql))
   { 
       $nmgp_select = "SELECT P_O_NUMBER, TOP_P_O_, BOT_P_O_, `DATE` as sc_def_col_1, `TO` as sc_def_col_2, SHIP_TO, LOCATION, DELIVERY, TERMS, `DESC` as sc_def_col_3, LBS_ORDERD, LBS_RECD, LBS_OPEN, ORDER_AMT, LBS_ALLOCD, LBS_AVAIL, LBS_KNIT, WARP_LOSS, LBS_SOLD, INVENTORY, PRICE_LB_W, COST_LB_W, COST_LB_Y, COST_LB_T, BEAM_CODE, YARN_CODE, STATUS, TCOST, SAMT, TV, SIZE, B_S, WASTE, ACOST, FIBER, NS, MARKDOWN, MDVALUE, DEN, FIL, LUSTER, PRODUCER, MERGE, AC, COMMENT, ID2 from " . $this->Ini->nm_tabela; 
   } 
   elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
   { 
       $nmgp_select = "SELECT P_O_NUMBER, TOP_P_O_, BOT_P_O_, convert(char(23),`DATE`,121) as sc_def_col_1, `TO` as sc_def_col_2, SHIP_TO, LOCATION, DELIVERY, TERMS, `DESC` as sc_def_col_3, LBS_ORDERD, LBS_RECD, LBS_OPEN, ORDER_AMT, LBS_ALLOCD, LBS_AVAIL, LBS_KNIT, WARP_LOSS, LBS_SOLD, INVENTORY, PRICE_LB_W, COST_LB_W, COST_LB_Y, COST_LB_T, BEAM_CODE, YARN_CODE, STATUS, TCOST, SAMT, TV, SIZE, B_S, WASTE, ACOST, FIBER, NS, MARKDOWN, MDVALUE, DEN, FIL, LUSTER, PRODUCER, MERGE, AC, COMMENT, ID2 from " . $this->Ini->nm_tabela; 
   } 
   elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle))
   { 
       $nmgp_select = "SELECT P_O_NUMBER, TOP_P_O_, BOT_P_O_, `DATE` as sc_def_col_1, `TO` as sc_def_col_2, SHIP_TO, LOCATION, DELIVERY, TERMS, `DESC` as sc_def_col_3, LBS_ORDERD, LBS_RECD, LBS_OPEN, ORDER_AMT, LBS_ALLOCD, LBS_AVAIL, LBS_KNIT, WARP_LOSS, LBS_SOLD, INVENTORY, PRICE_LB_W, COST_LB_W, COST_LB_Y, COST_LB_T, BEAM_CODE, YARN_CODE, STATUS, TCOST, SAMT, TV, SIZE, B_S, WASTE, ACOST, FIBER, NS, MARKDOWN, MDVALUE, DEN, FIL, LUSTER, PRODUCER, MERGE, AC, COMMENT, ID2 from " . $this->Ini->nm_tabela; 
   } 
   elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix))
   { 
       $nmgp_select = "SELECT P_O_NUMBER, TOP_P_O_, BOT_P_O_, EXTEND(`DATE`, YEAR TO DAY) as sc_def_col_1, `TO` as sc_def_col_2, SHIP_TO, LOCATION, DELIVERY, TERMS, `DESC` as sc_def_col_3, LBS_ORDERD, LBS_RECD, LBS_OPEN, ORDER_AMT, LBS_ALLOCD, LBS_AVAIL, LBS_KNIT, WARP_LOSS, LBS_SOLD, INVENTORY, PRICE_LB_W, COST_LB_W, COST_LB_Y, COST_LB_T, BEAM_CODE, YARN_CODE, STATUS, TCOST, SAMT, TV, SIZE, B_S, WASTE, ACOST, FIBER, NS, MARKDOWN, MDVALUE, DEN, FIL, LUSTER, PRODUCER, MERGE, AC, COMMENT, ID2 from " . $this->Ini->nm_tabela; 
   } 
   else 
   { 
       $nmgp_select = "SELECT P_O_NUMBER, TOP_P_O_, BOT_P_O_, `DATE` as sc_def_col_1, `TO` as sc_def_col_2, SHIP_TO, LOCATION, DELIVERY, TERMS, `DESC` as sc_def_col_3, LBS_ORDERD, LBS_RECD, LBS_OPEN, ORDER_AMT, LBS_ALLOCD, LBS_AVAIL, LBS_KNIT, WARP_LOSS, LBS_SOLD, INVENTORY, PRICE_LB_W, COST_LB_W, COST_LB_Y, COST_LB_T, BEAM_CODE, YARN_CODE, STATUS, TCOST, SAMT, TV, SIZE, B_S, WASTE, ACOST, FIBER, NS, MARKDOWN, MDVALUE, DEN, FIL, LUSTER, PRODUCER, MERGE, AC, COMMENT, ID2 from " . $this->Ini->nm_tabela; 
   } 
   $nmgp_select .= " " . $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_pesq']; 
   $nmgp_order_by = ""; 
   $campos_order_select = "";
   foreach($_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['ordem_select'] as $campo => $ordem) 
   {
        if ($campo != $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['ordem_grid']) 
        {
           if (!empty($campos_order_select)) 
           {
               $campos_order_select .= ", ";
           }
           $campos_order_select .= $campo . " " . $ordem;
        }
   }
   if (!empty($_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['ordem_grid'])) 
   { 
       $nmgp_order_by = " order by " . $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['ordem_grid'] . $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['ordem_desc']; 
   } 
   if (!empty($campos_order_select)) 
   { 
       if (!empty($nmgp_order_by)) 
       { 
          $nmgp_order_by .= ", " . $campos_order_select; 
       } 
       else 
       { 
          $nmgp_order_by = " order by $campos_order_select"; 
       } 
   } 
   $nmgp_select .= $nmgp_order_by; 
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['order_grid'] = $nmgp_order_by;
   $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nmgp_select; 
   $this->rs_grid = $this->Db->Execute($nmgp_select) ; 
   if ($this->rs_grid === false && !$this->rs_grid->EOF && $GLOBALS["NM_ERRO_IBASE"] != 1) 
   { 
       $this->Erro->mensagem(__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
       exit ; 
   }  
   if ($this->rs_grid->EOF || ($this->rs_grid === false && $GLOBALS["NM_ERRO_IBASE"] == 1)) 
   { 
       $this->nm_grid_sem_reg = $this->Ini->Nm_lang['lang_errm_empt']; 
   }  
// 
 }  
// 
 function Pdf_init()
 {
   $this->Pdf->SetFont($this->default_font, $this->default_style, 12);
   $this->Pdf->SetTextColor(0, 0, 0);
 }
// 
 function Pdf_scale()
 {
//   $this->Pdf->SetVisibility('screen');
   $NM_cont  = 0;
   $NM_num_h = 0;
   $NM_num_v = 0;
   $this->Pdf->SetFont('Arial', '', 6);
   $this->Pdf->SetLineWidth(0.4);
   for ($i = 3; $i < 215.9; $i += 1)
   {
      $NM_cont++;
      if ($NM_cont % 10 == 0)
      {
          $NM_num_h++;
          $NM_num_h = ($NM_num_h == 10) ? 0 : $NM_num_h;
          $this->Pdf->Text($i, 2, $NM_num_h);
          $this->Pdf->Line($i, 3, $i, 5);
          $this->Pdf->Line($i, 272.4, $i, 274.4);
          $this->Pdf->Text($i, 276.4, $NM_num_h);
      }
      elseif ($NM_cont % 5 == 0)
      {
          $this->Pdf->Line($i, 3.5, $i, 5);
          $this->Pdf->Line($i, 272.4, $i, 273.9);
      }
      else
      {
          $this->Pdf->Line($i, 4, $i, 5);
          $this->Pdf->Line($i, 272.4, $i, 273.4);
      }
   }
   $NM_cont = 0;
   for ($i = 1; $i < 279.4; $i += 1)
   {
      $NM_cont++;
      if ($NM_cont % 10 == 0)
      {
          $NM_num_v++;
          $NM_num_v = ($NM_num_v == 10) ? 0 : $NM_num_v;
          $this->Pdf->Text(1, $i, $NM_num_v);
          $this->Pdf->Line(3, $i, 5, $i);
          $this->Pdf->Line(207.9, $i, 209.9, $i);
          $this->Pdf->Text(210.9, $i, $NM_num_v);
      }
      elseif ($NM_cont % 5 == 0)
      {
          $this->Pdf->Line(3.5, $i, 5, $i);
          $this->Pdf->Line(207.9, $i, 209.4, $i);
      }
      else
      {
          $this->Pdf->Line(4, $i, 5, $i);
          $this->Pdf->Line(207.9, $i, 208.9, $i);
      }
   }
//   $this->Pdf->SetVisibility('all');
 }
// 
 function Pdf_image()
 {
   $this->Pdf->Image($this->NM_raiz_img . $this->Ini->path_img_global . "/sys__NM__vform.jpg", 1, 1, 0, 0);
 }
// 
//----- 
 function grid($linhas = 0)
 {
    global 
           $nm_saida, $nm_url_saida;
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['p_o_number'] = "P_O_NUMBER";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['top_p_o_'] = "TOP_P_O_";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['bot_p_o_'] = "BOT_P_O_";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['date'] = "DATE";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['to'] = "TO";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['ship_to'] = "SHIP_TO";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['location'] = "LOCATION";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['delivery'] = "DELIVERY";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['terms'] = "TERMS";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['desc'] = "DESC";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['lbs_orderd'] = "LBS_ORDERD";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['lbs_recd'] = "LBS_RECD";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['lbs_open'] = "LBS_OPEN";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['order_amt'] = "ORDER_AMT";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['lbs_allocd'] = "LBS_ALLOCD";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['lbs_avail'] = "LBS_AVAIL";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['lbs_knit'] = "LBS_KNIT";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['warp_loss'] = "WARP_LOSS";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['lbs_sold'] = "LBS_SOLD";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['inventory'] = "INVENTORY";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['price_lb_w'] = "PRICE_LB_W";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['cost_lb_w'] = "COST_LB_W";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['cost_lb_y'] = "COST_LB_Y";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['cost_lb_t'] = "COST_LB_T";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['beam_code'] = "BEAM_CODE";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['yarn_code'] = "YARN_CODE";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['status'] = "STATUS";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['tcost'] = "TCOST";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['samt'] = "SAMT";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['tv'] = "TV";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['size'] = "SIZE";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['b_s'] = "B_S";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['waste'] = "WASTE";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['acost'] = "ACOST";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['fiber'] = "FIBER";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['ns'] = "NS";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['markdown'] = "MARKDOWN";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['mdvalue'] = "MDVALUE";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['den'] = "DEN";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['fil'] = "FIL";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['luster'] = "LUSTER";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['producer'] = "PRODUCER";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['merge'] = "MERGE";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['ac'] = "AC";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['comment'] = "COMMENT";
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['labels']['id2'] = "ID2";
   $HTTP_REFERER = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : ""; 
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['seq_dir'] = 0; 
   $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['sub_dir'] = array(); 
   $this->sc_where_orig   = $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_orig'];
   $this->sc_where_atual  = $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_pesq'];
   $this->sc_where_filtro = $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['where_pesq_filtro'];
   if (isset($_SESSION['scriptcase']['sc_apl_conf']['beam_knitorder_pdf']['lig_edit']) && $_SESSION['scriptcase']['sc_apl_conf']['beam_knitorder_pdf']['lig_edit'] != '')
   {
       $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['mostra_edit'] = $_SESSION['scriptcase']['sc_apl_conf']['beam_knitorder_pdf']['lig_edit'];
   }
   if (!empty($this->nm_grid_sem_reg))
   {
       $this->Pdf_init();
       $this->Pdf->AddPage();
       $this->Pdf->SetFont($this->default_font_sr, 'B', 12);
       $this->Pdf->SetTextColor(0, 0, 0);
       $this->Pdf->Text(10, 10, html_entity_decode($this->nm_grid_sem_reg));
       $this->Pdf->Output($this->Ini->root . $this->Ini->nm_path_pdf);
       return;
   }
// 
   $Init_Pdf = true;
   $this->SC_seq_register = 0; 
   while (!$this->rs_grid->EOF) 
   {  
      $this->nm_grid_colunas = 0; 
      $nm_quant_linhas = 0;
      $this->Pdf->AddPage();
      $this->Pdf_init();
      $this->Pdf_image();
      $this->Pdf_scale();
      $this->Pdf_init();
      while (!$this->rs_grid->EOF && $nm_quant_linhas < $_SESSION['sc_session'][$this->Ini->sc_page]['beam_knitorder_pdf']['qt_col_grid']) 
      {  
          $this->sc_proc_grid = true;
          $this->SC_seq_register++; 
          $this->p_o_number[$this->nm_grid_colunas] = $this->rs_grid->fields[0] ;  
          $this->top_p_o_[$this->nm_grid_colunas] = $this->rs_grid->fields[1] ;  
          $this->bot_p_o_[$this->nm_grid_colunas] = $this->rs_grid->fields[2] ;  
          $this->date[$this->nm_grid_colunas] = $this->rs_grid->fields[3] ;  
          $this->to[$this->nm_grid_colunas] = $this->rs_grid->fields[4] ;  
          $this->ship_to[$this->nm_grid_colunas] = $this->rs_grid->fields[5] ;  
          $this->location[$this->nm_grid_colunas] = $this->rs_grid->fields[6] ;  
          $this->delivery[$this->nm_grid_colunas] = $this->rs_grid->fields[7] ;  
          $this->terms[$this->nm_grid_colunas] = $this->rs_grid->fields[8] ;  
          $this->desc[$this->nm_grid_colunas] = $this->rs_grid->fields[9] ;  
          $this->lbs_orderd[$this->nm_grid_colunas] = $this->rs_grid->fields[10] ;  
          $this->lbs_orderd[$this->nm_grid_colunas] = (string)$this->lbs_orderd[$this->nm_grid_colunas];
          $this->lbs_recd[$this->nm_grid_colunas] = $this->rs_grid->fields[11] ;  
          $this->lbs_recd[$this->nm_grid_colunas] =  str_replace(",", ".", $this->lbs_recd[$this->nm_grid_colunas]);
          $this->lbs_recd[$this->nm_grid_colunas] = (strpos(strtolower($this->lbs_recd[$this->nm_grid_colunas]), "e")) ? (float)$this->lbs_recd[$this->nm_grid_colunas] : $this->lbs_recd[$this->nm_grid_colunas]; 
          $this->lbs_recd[$this->nm_grid_colunas] = (string)$this->lbs_recd[$this->nm_grid_colunas];
          $this->lbs_open[$this->nm_grid_colunas] = $this->rs_grid->fields[12] ;  
          $this->lbs_open[$this->nm_grid_colunas] = (string)$this->lbs_open[$this->nm_grid_colunas];
          $this->order_amt[$this->nm_grid_colunas] = $this->rs_grid->fields[13] ;  
          $this->order_amt[$this->nm_grid_colunas] =  str_replace(",", ".", $this->order_amt[$this->nm_grid_colunas]);
          $this->order_amt[$this->nm_grid_colunas] = (strpos(strtolower($this->order_amt[$this->nm_grid_colunas]), "e")) ? (float)$this->order_amt[$this->nm_grid_colunas] : $this->order_amt[$this->nm_grid_colunas]; 
          $this->order_amt[$this->nm_grid_colunas] = (string)$this->order_amt[$this->nm_grid_colunas];
          $this->lbs_allocd[$this->nm_grid_colunas] = $this->rs_grid->fields[14] ;  
          $this->lbs_allocd[$this->nm_grid_colunas] = (string)$this->lbs_allocd[$this->nm_grid_colunas];
          $this->lbs_avail[$this->nm_grid_colunas] = $this->rs_grid->fields[15] ;  
          $this->lbs_avail[$this->nm_grid_colunas] = (string)$this->lbs_avail[$this->nm_grid_colunas];
          $this->lbs_knit[$this->nm_grid_colunas] = $this->rs_grid->fields[16] ;  
          $this->lbs_knit[$this->nm_grid_colunas] =  str_replace(",", ".", $this->lbs_knit[$this->nm_grid_colunas]);
          $this->lbs_knit[$this->nm_grid_colunas] = (strpos(strtolower($this->lbs_knit[$this->nm_grid_colunas]), "e")) ? (float)$this->lbs_knit[$this->nm_grid_colunas] : $this->lbs_knit[$this->nm_grid_colunas]; 
          $this->lbs_knit[$this->nm_grid_colunas] = (string)$this->lbs_knit[$this->nm_grid_colunas];
          $this->warp_loss[$this->nm_grid_colunas] = $this->rs_grid->fields[17] ;  
          $this->warp_loss[$this->nm_grid_colunas] =  str_replace(",", ".", $this->warp_loss[$this->nm_grid_colunas]);
          $this->warp_loss[$this->nm_grid_colunas] = (strpos(strtolower($this->warp_loss[$this->nm_grid_colunas]), "e")) ? (float)$this->warp_loss[$this->nm_grid_colunas] : $this->warp_loss[$this->nm_grid_colunas]; 
          $this->warp_loss[$this->nm_grid_colunas] = (string)$this->warp_loss[$this->nm_grid_colunas];
          $this->lbs_sold[$this->nm_grid_colunas] = $this->rs_grid->fields[18] ;  
          $this->lbs_sold[$this->nm_grid_colunas] = (string)$this->lbs_sold[$this->nm_grid_colunas];
          $this->inventory[$this->nm_grid_colunas] = $this->rs_grid->fields[19] ;  
          $this->inventory[$this->nm_grid_colunas] =  str_replace(",", ".", $this->inventory[$this->nm_grid_colunas]);
          $this->inventory[$this->nm_grid_colunas] = (strpos(strtolower($this->inventory[$this->nm_grid_colunas]), "e")) ? (float)$this->inventory[$this->nm_grid_colunas] : $this->inventory[$this->nm_grid_colunas]; 
          $this->inventory[$this->nm_grid_colunas] = (string)$this->inventory[$this->nm_grid_colunas];
          $this->price_lb_w[$this->nm_grid_colunas] = $this->rs_grid->fields[20] ;  
          $this->price_lb_w[$this->nm_grid_colunas] = (strpos(strtolower($this->price_lb_w[$this->nm_grid_colunas]), "e")) ? (float)$this->price_lb_w[$this->nm_grid_colunas] : $this->price_lb_w[$this->nm_grid_colunas]; 
          $this->price_lb_w[$this->nm_grid_colunas] = (string)$this->price_lb_w[$this->nm_grid_colunas];
          $this->cost_lb_w[$this->nm_grid_colunas] = $this->rs_grid->fields[21] ;  
          $this->cost_lb_w[$this->nm_grid_colunas] = (strpos(strtolower($this->cost_lb_w[$this->nm_grid_colunas]), "e")) ? (float)$this->cost_lb_w[$this->nm_grid_colunas] : $this->cost_lb_w[$this->nm_grid_colunas]; 
          $this->cost_lb_w[$this->nm_grid_colunas] = (string)$this->cost_lb_w[$this->nm_grid_colunas];
          $this->cost_lb_y[$this->nm_grid_colunas] = $this->rs_grid->fields[22] ;  
          $this->cost_lb_y[$this->nm_grid_colunas] = (strpos(strtolower($this->cost_lb_y[$this->nm_grid_colunas]), "e")) ? (float)$this->cost_lb_y[$this->nm_grid_colunas] : $this->cost_lb_y[$this->nm_grid_colunas]; 
          $this->cost_lb_y[$this->nm_grid_colunas] = (string)$this->cost_lb_y[$this->nm_grid_colunas];
          $this->cost_lb_t[$this->nm_grid_colunas] = $this->rs_grid->fields[23] ;  
          $this->cost_lb_t[$this->nm_grid_colunas] = (strpos(strtolower($this->cost_lb_t[$this->nm_grid_colunas]), "e")) ? (float)$this->cost_lb_t[$this->nm_grid_colunas] : $this->cost_lb_t[$this->nm_grid_colunas]; 
          $this->cost_lb_t[$this->nm_grid_colunas] = (string)$this->cost_lb_t[$this->nm_grid_colunas];
          $this->beam_code[$this->nm_grid_colunas] = $this->rs_grid->fields[24] ;  
          $this->yarn_code[$this->nm_grid_colunas] = $this->rs_grid->fields[25] ;  
          $this->yarn_code[$this->nm_grid_colunas] = (strpos(strtolower($this->yarn_code[$this->nm_grid_colunas]), "e")) ? (float)$this->yarn_code[$this->nm_grid_colunas] : $this->yarn_code[$this->nm_grid_colunas]; 
          $this->yarn_code[$this->nm_grid_colunas] = (string)$this->yarn_code[$this->nm_grid_colunas];
          $this->status[$this->nm_grid_colunas] = $this->rs_grid->fields[26] ;  
          $this->tcost[$this->nm_grid_colunas] = $this->rs_grid->fields[27] ;  
          $this->tcost[$this->nm_grid_colunas] =  str_replace(",", ".", $this->tcost[$this->nm_grid_colunas]);
          $this->tcost[$this->nm_grid_colunas] = (strpos(strtolower($this->tcost[$this->nm_grid_colunas]), "e")) ? (float)$this->tcost[$this->nm_grid_colunas] : $this->tcost[$this->nm_grid_colunas]; 
          $this->tcost[$this->nm_grid_colunas] = (string)$this->tcost[$this->nm_grid_colunas];
          $this->samt[$this->nm_grid_colunas] = $this->rs_grid->fields[28] ;  
          $this->samt[$this->nm_grid_colunas] =  str_replace(",", ".", $this->samt[$this->nm_grid_colunas]);
          $this->samt[$this->nm_grid_colunas] = (strpos(strtolower($this->samt[$this->nm_grid_colunas]), "e")) ? (float)$this->samt[$this->nm_grid_colunas] : $this->samt[$this->nm_grid_colunas]; 
          $this->samt[$this->nm_grid_colunas] = (string)$this->samt[$this->nm_grid_colunas];
          $this->tv[$this->nm_grid_colunas] = $this->rs_grid->fields[29] ;  
          $this->tv[$this->nm_grid_colunas] =  str_replace(",", ".", $this->tv[$this->nm_grid_colunas]);
          $this->tv[$this->nm_grid_colunas] = (strpos(strtolower($this->tv[$this->nm_grid_colunas]), "e")) ? (float)$this->tv[$this->nm_grid_colunas] : $this->tv[$this->nm_grid_colunas]; 
          $this->tv[$this->nm_grid_colunas] = (string)$this->tv[$this->nm_grid_colunas];
          $this->size[$this->nm_grid_colunas] = $this->rs_grid->fields[30] ;  
          $this->b_s[$this->nm_grid_colunas] = $this->rs_grid->fields[31] ;  
          $this->waste[$this->nm_grid_colunas] = $this->rs_grid->fields[32] ;  
          $this->waste[$this->nm_grid_colunas] =  str_replace(",", ".", $this->waste[$this->nm_grid_colunas]);
          $this->waste[$this->nm_grid_colunas] = (strpos(strtolower($this->waste[$this->nm_grid_colunas]), "e")) ? (float)$this->waste[$this->nm_grid_colunas] : $this->waste[$this->nm_grid_colunas]; 
          $this->waste[$this->nm_grid_colunas] = (string)$this->waste[$this->nm_grid_colunas];
          $this->acost[$this->nm_grid_colunas] = $this->rs_grid->fields[33] ;  
          $this->acost[$this->nm_grid_colunas] = (strpos(strtolower($this->acost[$this->nm_grid_colunas]), "e")) ? (float)$this->acost[$this->nm_grid_colunas] : $this->acost[$this->nm_grid_colunas]; 
          $this->acost[$this->nm_grid_colunas] = (string)$this->acost[$this->nm_grid_colunas];
          $this->fiber[$this->nm_grid_colunas] = $this->rs_grid->fields[34] ;  
          $this->ns[$this->nm_grid_colunas] = $this->rs_grid->fields[35] ;  
          $this->ns[$this->nm_grid_colunas] = (string)$this->ns[$this->nm_grid_colunas];
          $this->markdown[$this->nm_grid_colunas] = $this->rs_grid->fields[36] ;  
          $this->markdown[$this->nm_grid_colunas] =  str_replace(",", ".", $this->markdown[$this->nm_grid_colunas]);
          $this->markdown[$this->nm_grid_colunas] = (strpos(strtolower($this->markdown[$this->nm_grid_colunas]), "e")) ? (float)$this->markdown[$this->nm_grid_colunas] : $this->markdown[$this->nm_grid_colunas]; 
          $this->markdown[$this->nm_grid_colunas] = (string)$this->markdown[$this->nm_grid_colunas];
          $this->mdvalue[$this->nm_grid_colunas] = $this->rs_grid->fields[37] ;  
          $this->mdvalue[$this->nm_grid_colunas] =  str_replace(",", ".", $this->mdvalue[$this->nm_grid_colunas]);
          $this->mdvalue[$this->nm_grid_colunas] = (strpos(strtolower($this->mdvalue[$this->nm_grid_colunas]), "e")) ? (float)$this->mdvalue[$this->nm_grid_colunas] : $this->mdvalue[$this->nm_grid_colunas]; 
          $this->mdvalue[$this->nm_grid_colunas] = (string)$this->mdvalue[$this->nm_grid_colunas];
          $this->den[$this->nm_grid_colunas] = $this->rs_grid->fields[38] ;  
          $this->fil[$this->nm_grid_colunas] = $this->rs_grid->fields[39] ;  
          $this->luster[$this->nm_grid_colunas] = $this->rs_grid->fields[40] ;  
          $this->producer[$this->nm_grid_colunas] = $this->rs_grid->fields[41] ;  
          $this->merge[$this->nm_grid_colunas] = $this->rs_grid->fields[42] ;  
          $this->ac[$this->nm_grid_colunas] = $this->rs_grid->fields[43] ;  
          $this->comment[$this->nm_grid_colunas] = $this->rs_grid->fields[44] ;  
          $this->id2[$this->nm_grid_colunas] = $this->rs_grid->fields[45] ;  
          $this->id2[$this->nm_grid_colunas] = (string)$this->id2[$this->nm_grid_colunas];
          $this->p_o_number[$this->nm_grid_colunas] = $this->p_o_number[$this->nm_grid_colunas];
          if ($this->p_o_number[$this->nm_grid_colunas] === "") 
          { 
              $this->p_o_number[$this->nm_grid_colunas] = "" ;  
          } 
          $this->p_o_number[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->p_o_number[$this->nm_grid_colunas]);
          $this->top_p_o_[$this->nm_grid_colunas] = $this->top_p_o_[$this->nm_grid_colunas];
          if ($this->top_p_o_[$this->nm_grid_colunas] === "") 
          { 
              $this->top_p_o_[$this->nm_grid_colunas] = "" ;  
          } 
          $this->top_p_o_[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->top_p_o_[$this->nm_grid_colunas]);
          $this->bot_p_o_[$this->nm_grid_colunas] = $this->bot_p_o_[$this->nm_grid_colunas];
          if ($this->bot_p_o_[$this->nm_grid_colunas] === "") 
          { 
              $this->bot_p_o_[$this->nm_grid_colunas] = "" ;  
          } 
          $this->bot_p_o_[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->bot_p_o_[$this->nm_grid_colunas]);
          $this->date[$this->nm_grid_colunas] = $this->date[$this->nm_grid_colunas];
          if ($this->date[$this->nm_grid_colunas] === "") 
          { 
              $this->date[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
               $date_x =  $this->date[$this->nm_grid_colunas];
               nm_conv_limpa_dado($date_x, "YYYY-MM-DD");
               if (is_numeric($date_x) && $date_x > 0) 
               { 
                   $this->nm_data->SetaData($this->date[$this->nm_grid_colunas], "YYYY-MM-DD");
                   $this->date[$this->nm_grid_colunas] = html_entity_decode($this->nm_data->FormataSaida($this->Nm_date_format("DT", "ddmmaaaa")));
               } 
          } 
          $this->date[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->date[$this->nm_grid_colunas]);
          $this->to[$this->nm_grid_colunas] = $this->to[$this->nm_grid_colunas];
          if ($this->to[$this->nm_grid_colunas] === "") 
          { 
              $this->to[$this->nm_grid_colunas] = "" ;  
          } 
          $this->to[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->to[$this->nm_grid_colunas]);
          $this->ship_to[$this->nm_grid_colunas] = $this->ship_to[$this->nm_grid_colunas];
          if ($this->ship_to[$this->nm_grid_colunas] === "") 
          { 
              $this->ship_to[$this->nm_grid_colunas] = "" ;  
          } 
          $this->ship_to[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->ship_to[$this->nm_grid_colunas]);
          $this->location[$this->nm_grid_colunas] = $this->location[$this->nm_grid_colunas];
          if ($this->location[$this->nm_grid_colunas] === "") 
          { 
              $this->location[$this->nm_grid_colunas] = "" ;  
          } 
          $this->location[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->location[$this->nm_grid_colunas]);
          $this->delivery[$this->nm_grid_colunas] = $this->delivery[$this->nm_grid_colunas];
          if ($this->delivery[$this->nm_grid_colunas] === "") 
          { 
              $this->delivery[$this->nm_grid_colunas] = "" ;  
          } 
          $this->delivery[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->delivery[$this->nm_grid_colunas]);
          $this->terms[$this->nm_grid_colunas] = $this->terms[$this->nm_grid_colunas];
          if ($this->terms[$this->nm_grid_colunas] === "") 
          { 
              $this->terms[$this->nm_grid_colunas] = "" ;  
          } 
          $this->terms[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->terms[$this->nm_grid_colunas]);
          $this->desc[$this->nm_grid_colunas] = $this->desc[$this->nm_grid_colunas];
          if ($this->desc[$this->nm_grid_colunas] === "") 
          { 
              $this->desc[$this->nm_grid_colunas] = "" ;  
          } 
          $this->desc[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->desc[$this->nm_grid_colunas]);
          $this->lbs_orderd[$this->nm_grid_colunas] = $this->lbs_orderd[$this->nm_grid_colunas];
          if ($this->lbs_orderd[$this->nm_grid_colunas] === "") 
          { 
              $this->lbs_orderd[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->lbs_orderd[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
          } 
          $this->lbs_orderd[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->lbs_orderd[$this->nm_grid_colunas]);
          $this->lbs_recd[$this->nm_grid_colunas] = $this->lbs_recd[$this->nm_grid_colunas];
          if ($this->lbs_recd[$this->nm_grid_colunas] === "") 
          { 
              $this->lbs_recd[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->lbs_recd[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_val'], $_SESSION['scriptcase']['reg_conf']['dec_val'], "2", "S", "2", "", "V:" . $_SESSION['scriptcase']['reg_conf']['monet_f_pos'] . ":" . $_SESSION['scriptcase']['reg_conf']['monet_f_neg'], $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit']) ; 
          } 
          $this->lbs_recd[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->lbs_recd[$this->nm_grid_colunas]);
          $this->lbs_open[$this->nm_grid_colunas] = $this->lbs_open[$this->nm_grid_colunas];
          if ($this->lbs_open[$this->nm_grid_colunas] === "") 
          { 
              $this->lbs_open[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->lbs_open[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
          } 
          $this->lbs_open[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->lbs_open[$this->nm_grid_colunas]);
          $this->order_amt[$this->nm_grid_colunas] = $this->order_amt[$this->nm_grid_colunas];
          if ($this->order_amt[$this->nm_grid_colunas] === "") 
          { 
              $this->order_amt[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->order_amt[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_val'], $_SESSION['scriptcase']['reg_conf']['dec_val'], "2", "S", "2", "", "V:" . $_SESSION['scriptcase']['reg_conf']['monet_f_pos'] . ":" . $_SESSION['scriptcase']['reg_conf']['monet_f_neg'], $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit']) ; 
          } 
          $this->order_amt[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->order_amt[$this->nm_grid_colunas]);
          $this->lbs_allocd[$this->nm_grid_colunas] = $this->lbs_allocd[$this->nm_grid_colunas];
          if ($this->lbs_allocd[$this->nm_grid_colunas] === "") 
          { 
              $this->lbs_allocd[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->lbs_allocd[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
          } 
          $this->lbs_allocd[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->lbs_allocd[$this->nm_grid_colunas]);
          $this->lbs_avail[$this->nm_grid_colunas] = $this->lbs_avail[$this->nm_grid_colunas];
          if ($this->lbs_avail[$this->nm_grid_colunas] === "") 
          { 
              $this->lbs_avail[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->lbs_avail[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
          } 
          $this->lbs_avail[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->lbs_avail[$this->nm_grid_colunas]);
          $this->lbs_knit[$this->nm_grid_colunas] = $this->lbs_knit[$this->nm_grid_colunas];
          if ($this->lbs_knit[$this->nm_grid_colunas] === "") 
          { 
              $this->lbs_knit[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->lbs_knit[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_val'], $_SESSION['scriptcase']['reg_conf']['dec_val'], "1", "S", "2", "", "V:" . $_SESSION['scriptcase']['reg_conf']['monet_f_pos'] . ":" . $_SESSION['scriptcase']['reg_conf']['monet_f_neg'], $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit']) ; 
          } 
          $this->lbs_knit[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->lbs_knit[$this->nm_grid_colunas]);
          $this->warp_loss[$this->nm_grid_colunas] = $this->warp_loss[$this->nm_grid_colunas];
          if ($this->warp_loss[$this->nm_grid_colunas] === "") 
          { 
              $this->warp_loss[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->warp_loss[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_val'], $_SESSION['scriptcase']['reg_conf']['dec_val'], "1", "S", "2", "", "V:" . $_SESSION['scriptcase']['reg_conf']['monet_f_pos'] . ":" . $_SESSION['scriptcase']['reg_conf']['monet_f_neg'], $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit']) ; 
          } 
          $this->warp_loss[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->warp_loss[$this->nm_grid_colunas]);
          $this->lbs_sold[$this->nm_grid_colunas] = $this->lbs_sold[$this->nm_grid_colunas];
          if ($this->lbs_sold[$this->nm_grid_colunas] === "") 
          { 
              $this->lbs_sold[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->lbs_sold[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
          } 
          $this->lbs_sold[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->lbs_sold[$this->nm_grid_colunas]);
          $this->inventory[$this->nm_grid_colunas] = $this->inventory[$this->nm_grid_colunas];
          if ($this->inventory[$this->nm_grid_colunas] === "") 
          { 
              $this->inventory[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->inventory[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_val'], $_SESSION['scriptcase']['reg_conf']['dec_val'], "1", "S", "2", "", "V:" . $_SESSION['scriptcase']['reg_conf']['monet_f_pos'] . ":" . $_SESSION['scriptcase']['reg_conf']['monet_f_neg'], $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit']) ; 
          } 
          $this->inventory[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->inventory[$this->nm_grid_colunas]);
          $this->price_lb_w[$this->nm_grid_colunas] = $this->price_lb_w[$this->nm_grid_colunas];
          if ($this->price_lb_w[$this->nm_grid_colunas] === "") 
          { 
              $this->price_lb_w[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->price_lb_w[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "3", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'], $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
          } 
          $this->price_lb_w[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->price_lb_w[$this->nm_grid_colunas]);
          $this->cost_lb_w[$this->nm_grid_colunas] = $this->cost_lb_w[$this->nm_grid_colunas];
          if ($this->cost_lb_w[$this->nm_grid_colunas] === "") 
          { 
              $this->cost_lb_w[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->cost_lb_w[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "3", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'], $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
          } 
          $this->cost_lb_w[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->cost_lb_w[$this->nm_grid_colunas]);
          $this->cost_lb_y[$this->nm_grid_colunas] = $this->cost_lb_y[$this->nm_grid_colunas];
          if ($this->cost_lb_y[$this->nm_grid_colunas] === "") 
          { 
              $this->cost_lb_y[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->cost_lb_y[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "3", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'], $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
          } 
          $this->cost_lb_y[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->cost_lb_y[$this->nm_grid_colunas]);
          $this->cost_lb_t[$this->nm_grid_colunas] = $this->cost_lb_t[$this->nm_grid_colunas];
          if ($this->cost_lb_t[$this->nm_grid_colunas] === "") 
          { 
              $this->cost_lb_t[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->cost_lb_t[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "3", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'], $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
          } 
          $this->cost_lb_t[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->cost_lb_t[$this->nm_grid_colunas]);
          $this->beam_code[$this->nm_grid_colunas] = $this->beam_code[$this->nm_grid_colunas];
          if ($this->beam_code[$this->nm_grid_colunas] === "") 
          { 
              $this->beam_code[$this->nm_grid_colunas] = "" ;  
          } 
          $this->beam_code[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->beam_code[$this->nm_grid_colunas]);
          $this->yarn_code[$this->nm_grid_colunas] = $this->yarn_code[$this->nm_grid_colunas];
          if ($this->yarn_code[$this->nm_grid_colunas] === "") 
          { 
              $this->yarn_code[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->yarn_code[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "4", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'], $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
          } 
          $this->yarn_code[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->yarn_code[$this->nm_grid_colunas]);
          $this->status[$this->nm_grid_colunas] = $this->status[$this->nm_grid_colunas];
          if ($this->status[$this->nm_grid_colunas] === "") 
          { 
              $this->status[$this->nm_grid_colunas] = "" ;  
          } 
          $this->status[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->status[$this->nm_grid_colunas]);
          $this->tcost[$this->nm_grid_colunas] = $this->tcost[$this->nm_grid_colunas];
          if ($this->tcost[$this->nm_grid_colunas] === "") 
          { 
              $this->tcost[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->tcost[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_val'], $_SESSION['scriptcase']['reg_conf']['dec_val'], "2", "S", "2", "", "V:" . $_SESSION['scriptcase']['reg_conf']['monet_f_pos'] . ":" . $_SESSION['scriptcase']['reg_conf']['monet_f_neg'], $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit']) ; 
          } 
          $this->tcost[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->tcost[$this->nm_grid_colunas]);
          $this->samt[$this->nm_grid_colunas] = $this->samt[$this->nm_grid_colunas];
          if ($this->samt[$this->nm_grid_colunas] === "") 
          { 
              $this->samt[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->samt[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_val'], $_SESSION['scriptcase']['reg_conf']['dec_val'], "2", "S", "2", "", "V:" . $_SESSION['scriptcase']['reg_conf']['monet_f_pos'] . ":" . $_SESSION['scriptcase']['reg_conf']['monet_f_neg'], $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit']) ; 
          } 
          $this->samt[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->samt[$this->nm_grid_colunas]);
          $this->tv[$this->nm_grid_colunas] = $this->tv[$this->nm_grid_colunas];
          if ($this->tv[$this->nm_grid_colunas] === "") 
          { 
              $this->tv[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->tv[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_val'], $_SESSION['scriptcase']['reg_conf']['dec_val'], "2", "S", "2", "", "V:" . $_SESSION['scriptcase']['reg_conf']['monet_f_pos'] . ":" . $_SESSION['scriptcase']['reg_conf']['monet_f_neg'], $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit']) ; 
          } 
          $this->tv[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->tv[$this->nm_grid_colunas]);
          $this->size[$this->nm_grid_colunas] = $this->size[$this->nm_grid_colunas];
          if ($this->size[$this->nm_grid_colunas] === "") 
          { 
              $this->size[$this->nm_grid_colunas] = "" ;  
          } 
          $this->size[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->size[$this->nm_grid_colunas]);
          $this->b_s[$this->nm_grid_colunas] = $this->b_s[$this->nm_grid_colunas];
          if ($this->b_s[$this->nm_grid_colunas] === "") 
          { 
              $this->b_s[$this->nm_grid_colunas] = "" ;  
          } 
          $this->b_s[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->b_s[$this->nm_grid_colunas]);
          $this->waste[$this->nm_grid_colunas] = $this->waste[$this->nm_grid_colunas];
          if ($this->waste[$this->nm_grid_colunas] === "") 
          { 
              $this->waste[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->waste[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_val'], $_SESSION['scriptcase']['reg_conf']['dec_val'], "2", "S", "2", "", "V:" . $_SESSION['scriptcase']['reg_conf']['monet_f_pos'] . ":" . $_SESSION['scriptcase']['reg_conf']['monet_f_neg'], $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit']) ; 
          } 
          $this->waste[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->waste[$this->nm_grid_colunas]);
          $this->acost[$this->nm_grid_colunas] = $this->acost[$this->nm_grid_colunas];
          if ($this->acost[$this->nm_grid_colunas] === "") 
          { 
              $this->acost[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->acost[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "3", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'], $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
          } 
          $this->acost[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->acost[$this->nm_grid_colunas]);
          $this->fiber[$this->nm_grid_colunas] = $this->fiber[$this->nm_grid_colunas];
          if ($this->fiber[$this->nm_grid_colunas] === "") 
          { 
              $this->fiber[$this->nm_grid_colunas] = "" ;  
          } 
          $this->fiber[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->fiber[$this->nm_grid_colunas]);
          $this->ns[$this->nm_grid_colunas] = $this->ns[$this->nm_grid_colunas];
          if ($this->ns[$this->nm_grid_colunas] === "") 
          { 
              $this->ns[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->ns[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
          } 
          $this->ns[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->ns[$this->nm_grid_colunas]);
          $this->markdown[$this->nm_grid_colunas] = $this->markdown[$this->nm_grid_colunas];
          if ($this->markdown[$this->nm_grid_colunas] === "") 
          { 
              $this->markdown[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->markdown[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_val'], $_SESSION['scriptcase']['reg_conf']['dec_val'], "2", "S", "2", "", "V:" . $_SESSION['scriptcase']['reg_conf']['monet_f_pos'] . ":" . $_SESSION['scriptcase']['reg_conf']['monet_f_neg'], $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit']) ; 
          } 
          $this->markdown[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->markdown[$this->nm_grid_colunas]);
          $this->mdvalue[$this->nm_grid_colunas] = $this->mdvalue[$this->nm_grid_colunas];
          if ($this->mdvalue[$this->nm_grid_colunas] === "") 
          { 
              $this->mdvalue[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->mdvalue[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_val'], $_SESSION['scriptcase']['reg_conf']['dec_val'], "2", "S", "2", "", "V:" . $_SESSION['scriptcase']['reg_conf']['monet_f_pos'] . ":" . $_SESSION['scriptcase']['reg_conf']['monet_f_neg'], $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['unid_mont_group_digit']) ; 
          } 
          $this->mdvalue[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->mdvalue[$this->nm_grid_colunas]);
          $this->den[$this->nm_grid_colunas] = $this->den[$this->nm_grid_colunas];
          if ($this->den[$this->nm_grid_colunas] === "") 
          { 
              $this->den[$this->nm_grid_colunas] = "" ;  
          } 
          $this->den[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->den[$this->nm_grid_colunas]);
          $this->fil[$this->nm_grid_colunas] = $this->fil[$this->nm_grid_colunas];
          if ($this->fil[$this->nm_grid_colunas] === "") 
          { 
              $this->fil[$this->nm_grid_colunas] = "" ;  
          } 
          $this->fil[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->fil[$this->nm_grid_colunas]);
          $this->luster[$this->nm_grid_colunas] = $this->luster[$this->nm_grid_colunas];
          if ($this->luster[$this->nm_grid_colunas] === "") 
          { 
              $this->luster[$this->nm_grid_colunas] = "" ;  
          } 
          $this->luster[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->luster[$this->nm_grid_colunas]);
          $this->producer[$this->nm_grid_colunas] = $this->producer[$this->nm_grid_colunas];
          if ($this->producer[$this->nm_grid_colunas] === "") 
          { 
              $this->producer[$this->nm_grid_colunas] = "" ;  
          } 
          $this->producer[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->producer[$this->nm_grid_colunas]);
          $this->merge[$this->nm_grid_colunas] = $this->merge[$this->nm_grid_colunas];
          if ($this->merge[$this->nm_grid_colunas] === "") 
          { 
              $this->merge[$this->nm_grid_colunas] = "" ;  
          } 
          $this->merge[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->merge[$this->nm_grid_colunas]);
          $this->ac[$this->nm_grid_colunas] = $this->ac[$this->nm_grid_colunas];
          if ($this->ac[$this->nm_grid_colunas] === "") 
          { 
              $this->ac[$this->nm_grid_colunas] = "" ;  
          } 
          $this->ac[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->ac[$this->nm_grid_colunas]);
          $this->comment[$this->nm_grid_colunas] = $this->comment[$this->nm_grid_colunas];
          if ($this->comment[$this->nm_grid_colunas] === "") 
          { 
              $this->comment[$this->nm_grid_colunas] = "" ;  
          } 
          $this->comment[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->comment[$this->nm_grid_colunas]);
          $this->id2[$this->nm_grid_colunas] = $this->id2[$this->nm_grid_colunas];
          if ($this->id2[$this->nm_grid_colunas] === "") 
          { 
              $this->id2[$this->nm_grid_colunas] = "" ;  
          } 
          else    
          { 
              nmgp_Form_Num_Val($this->id2[$this->nm_grid_colunas], $_SESSION['scriptcase']['reg_conf']['grup_num'], $_SESSION['scriptcase']['reg_conf']['dec_num'], "0", "S", "2", "", "N:" . $_SESSION['scriptcase']['reg_conf']['neg_num'] , $_SESSION['scriptcase']['reg_conf']['simb_neg'], $_SESSION['scriptcase']['reg_conf']['num_group_digit']) ; 
          } 
          $this->id2[$this->nm_grid_colunas] = $this->SC_conv_utf8($this->id2[$this->nm_grid_colunas]);
            $cell_P_O_NUMBER = array('posx' => 10, 'posy' => 10, 'data' => $this->p_o_number[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_DATE = array('posx' => 10, 'posy' => 40, 'data' => $this->date[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_TO = array('posx' => 10, 'posy' => 50, 'data' => $this->to[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_SHIP_TO = array('posx' => 10, 'posy' => 60, 'data' => $this->ship_to[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_DELIVERY = array('posx' => 10, 'posy' => 80, 'data' => $this->delivery[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_TERMS = array('posx' => 10, 'posy' => 90, 'data' => $this->terms[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_DESC = array('posx' => 10, 'posy' => 100, 'data' => $this->desc[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_LBS_ORDERD = array('posx' => 10, 'posy' => 110, 'data' => $this->lbs_orderd[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_ORDER_AMT = array('posx' => 10, 'posy' => 140, 'data' => $this->order_amt[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_WARP_LOSS = array('posx' => 10, 'posy' => 180, 'data' => $this->warp_loss[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_TOP_P_O_ = array('posx' => 10, 'posy' => 20, 'data' => $this->top_p_o_[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_BOT_P_O_ = array('posx' => 10, 'posy' => 30, 'data' => $this->bot_p_o_[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_LBS_SOLD = array('posx' => 10, 'posy' => 190, 'data' => $this->lbs_sold[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_INVENTORY = array('posx' => 10, 'posy' => 200, 'data' => $this->inventory[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_PRICE_LB_W = array('posx' => 10, 'posy' => 210, 'data' => $this->price_lb_w[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_COST_LB_W = array('posx' => 10, 'posy' => 220, 'data' => $this->cost_lb_w[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_COST_LB_Y = array('posx' => 10, 'posy' => 230, 'data' => $this->cost_lb_y[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_COST_LB_T = array('posx' => 10, 'posy' => 240, 'data' => $this->cost_lb_t[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_BEAM_CODE = array('posx' => 10, 'posy' => 250, 'data' => $this->beam_code[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_YARN_CODE = array('posx' => 10, 'posy' => 260, 'data' => $this->yarn_code[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_STATUS = array('posx' => 10, 'posy' => 270, 'data' => $this->status[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_TCOST = array('posx' => 10, 'posy' => 280, 'data' => $this->tcost[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_SAMT = array('posx' => 10, 'posy' => 290, 'data' => $this->samt[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_TV = array('posx' => 10, 'posy' => 300, 'data' => $this->tv[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_SIZE = array('posx' => 10, 'posy' => 310, 'data' => $this->size[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_B_S = array('posx' => 10, 'posy' => 320, 'data' => $this->b_s[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_WASTE = array('posx' => 10, 'posy' => 330, 'data' => $this->waste[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_ACOST = array('posx' => 10, 'posy' => 340, 'data' => $this->acost[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_FIBER = array('posx' => 10, 'posy' => 350, 'data' => $this->fiber[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_NS = array('posx' => 10, 'posy' => 360, 'data' => $this->ns[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_MARKDOWN = array('posx' => 10, 'posy' => 370, 'data' => $this->markdown[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_MDVALUE = array('posx' => 10, 'posy' => 380, 'data' => $this->mdvalue[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_DEN = array('posx' => 10, 'posy' => 390, 'data' => $this->den[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_FIL = array('posx' => 10, 'posy' => 400, 'data' => $this->fil[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_LUSTER = array('posx' => 10, 'posy' => 410, 'data' => $this->luster[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_PRODUCER = array('posx' => 10, 'posy' => 420, 'data' => $this->producer[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_MERGE = array('posx' => 10, 'posy' => 430, 'data' => $this->merge[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_AC = array('posx' => 10, 'posy' => 440, 'data' => $this->ac[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);
            $cell_COMMENT = array('posx' => 10, 'posy' => 450, 'data' => $this->comment[$this->nm_grid_colunas], 'width'      => 0, 'align'      => 'L', 'font_type'  => $this->default_font, 'font_size'  => 12, 'color_r'    => '0', 'color_g'    => '0', 'color_b'    => '0', 'font_style' => $this->default_style);


            $this->Pdf->SetFont($cell_P_O_NUMBER['font_type'], $cell_P_O_NUMBER['font_style'], $cell_P_O_NUMBER['font_size']);
            $this->Pdf->SetTextColor($cell_P_O_NUMBER['color_r'], $cell_P_O_NUMBER['color_g'], $cell_P_O_NUMBER['color_b']);
            if (!empty($cell_P_O_NUMBER['posx']) && !empty($cell_P_O_NUMBER['posy']))
            {
                $this->Pdf->SetXY($cell_P_O_NUMBER['posx'], $cell_P_O_NUMBER['posy']);
            }
            elseif (!empty($cell_P_O_NUMBER['posx']))
            {
                $this->Pdf->SetX($cell_P_O_NUMBER['posx']);
            }
            elseif (!empty($cell_P_O_NUMBER['posy']))
            {
                $this->Pdf->SetY($cell_P_O_NUMBER['posy']);
            }
            $this->Pdf->Cell($cell_P_O_NUMBER['width'], 0, $cell_P_O_NUMBER['data'], 0, 0, $cell_P_O_NUMBER['align']);

            $this->Pdf->SetFont($cell_DATE['font_type'], $cell_DATE['font_style'], $cell_DATE['font_size']);
            $this->Pdf->SetTextColor($cell_DATE['color_r'], $cell_DATE['color_g'], $cell_DATE['color_b']);
            if (!empty($cell_DATE['posx']) && !empty($cell_DATE['posy']))
            {
                $this->Pdf->SetXY($cell_DATE['posx'], $cell_DATE['posy']);
            }
            elseif (!empty($cell_DATE['posx']))
            {
                $this->Pdf->SetX($cell_DATE['posx']);
            }
            elseif (!empty($cell_DATE['posy']))
            {
                $this->Pdf->SetY($cell_DATE['posy']);
            }
            $this->Pdf->Cell($cell_DATE['width'], 0, $cell_DATE['data'], 0, 0, $cell_DATE['align']);

            $this->Pdf->SetFont($cell_TO['font_type'], $cell_TO['font_style'], $cell_TO['font_size']);
            $this->Pdf->SetTextColor($cell_TO['color_r'], $cell_TO['color_g'], $cell_TO['color_b']);
            if (!empty($cell_TO['posx']) && !empty($cell_TO['posy']))
            {
                $this->Pdf->SetXY($cell_TO['posx'], $cell_TO['posy']);
            }
            elseif (!empty($cell_TO['posx']))
            {
                $this->Pdf->SetX($cell_TO['posx']);
            }
            elseif (!empty($cell_TO['posy']))
            {
                $this->Pdf->SetY($cell_TO['posy']);
            }
            $this->Pdf->Cell($cell_TO['width'], 0, $cell_TO['data'], 0, 0, $cell_TO['align']);

            $this->Pdf->SetFont($cell_SHIP_TO['font_type'], $cell_SHIP_TO['font_style'], $cell_SHIP_TO['font_size']);
            $this->Pdf->SetTextColor($cell_SHIP_TO['color_r'], $cell_SHIP_TO['color_g'], $cell_SHIP_TO['color_b']);
            if (!empty($cell_SHIP_TO['posx']) && !empty($cell_SHIP_TO['posy']))
            {
                $this->Pdf->SetXY($cell_SHIP_TO['posx'], $cell_SHIP_TO['posy']);
            }
            elseif (!empty($cell_SHIP_TO['posx']))
            {
                $this->Pdf->SetX($cell_SHIP_TO['posx']);
            }
            elseif (!empty($cell_SHIP_TO['posy']))
            {
                $this->Pdf->SetY($cell_SHIP_TO['posy']);
            }
            $this->Pdf->Cell($cell_SHIP_TO['width'], 0, $cell_SHIP_TO['data'], 0, 0, $cell_SHIP_TO['align']);

            $this->Pdf->SetFont($cell_DELIVERY['font_type'], $cell_DELIVERY['font_style'], $cell_DELIVERY['font_size']);
            $this->Pdf->SetTextColor($cell_DELIVERY['color_r'], $cell_DELIVERY['color_g'], $cell_DELIVERY['color_b']);
            if (!empty($cell_DELIVERY['posx']) && !empty($cell_DELIVERY['posy']))
            {
                $this->Pdf->SetXY($cell_DELIVERY['posx'], $cell_DELIVERY['posy']);
            }
            elseif (!empty($cell_DELIVERY['posx']))
            {
                $this->Pdf->SetX($cell_DELIVERY['posx']);
            }
            elseif (!empty($cell_DELIVERY['posy']))
            {
                $this->Pdf->SetY($cell_DELIVERY['posy']);
            }
            $this->Pdf->Cell($cell_DELIVERY['width'], 0, $cell_DELIVERY['data'], 0, 0, $cell_DELIVERY['align']);

            $this->Pdf->SetFont($cell_TERMS['font_type'], $cell_TERMS['font_style'], $cell_TERMS['font_size']);
            $this->Pdf->SetTextColor($cell_TERMS['color_r'], $cell_TERMS['color_g'], $cell_TERMS['color_b']);
            if (!empty($cell_TERMS['posx']) && !empty($cell_TERMS['posy']))
            {
                $this->Pdf->SetXY($cell_TERMS['posx'], $cell_TERMS['posy']);
            }
            elseif (!empty($cell_TERMS['posx']))
            {
                $this->Pdf->SetX($cell_TERMS['posx']);
            }
            elseif (!empty($cell_TERMS['posy']))
            {
                $this->Pdf->SetY($cell_TERMS['posy']);
            }
            $this->Pdf->Cell($cell_TERMS['width'], 0, $cell_TERMS['data'], 0, 0, $cell_TERMS['align']);

            $this->Pdf->SetFont($cell_DESC['font_type'], $cell_DESC['font_style'], $cell_DESC['font_size']);
            $this->Pdf->SetTextColor($cell_DESC['color_r'], $cell_DESC['color_g'], $cell_DESC['color_b']);
            if (!empty($cell_DESC['posx']) && !empty($cell_DESC['posy']))
            {
                $this->Pdf->SetXY($cell_DESC['posx'], $cell_DESC['posy']);
            }
            elseif (!empty($cell_DESC['posx']))
            {
                $this->Pdf->SetX($cell_DESC['posx']);
            }
            elseif (!empty($cell_DESC['posy']))
            {
                $this->Pdf->SetY($cell_DESC['posy']);
            }
            $this->Pdf->Cell($cell_DESC['width'], 0, $cell_DESC['data'], 0, 0, $cell_DESC['align']);

            $this->Pdf->SetFont($cell_LBS_ORDERD['font_type'], $cell_LBS_ORDERD['font_style'], $cell_LBS_ORDERD['font_size']);
            $this->Pdf->SetTextColor($cell_LBS_ORDERD['color_r'], $cell_LBS_ORDERD['color_g'], $cell_LBS_ORDERD['color_b']);
            if (!empty($cell_LBS_ORDERD['posx']) && !empty($cell_LBS_ORDERD['posy']))
            {
                $this->Pdf->SetXY($cell_LBS_ORDERD['posx'], $cell_LBS_ORDERD['posy']);
            }
            elseif (!empty($cell_LBS_ORDERD['posx']))
            {
                $this->Pdf->SetX($cell_LBS_ORDERD['posx']);
            }
            elseif (!empty($cell_LBS_ORDERD['posy']))
            {
                $this->Pdf->SetY($cell_LBS_ORDERD['posy']);
            }
            $this->Pdf->Cell($cell_LBS_ORDERD['width'], 0, $cell_LBS_ORDERD['data'], 0, 0, $cell_LBS_ORDERD['align']);

            $this->Pdf->SetFont($cell_ORDER_AMT['font_type'], $cell_ORDER_AMT['font_style'], $cell_ORDER_AMT['font_size']);
            $this->Pdf->SetTextColor($cell_ORDER_AMT['color_r'], $cell_ORDER_AMT['color_g'], $cell_ORDER_AMT['color_b']);
            if (!empty($cell_ORDER_AMT['posx']) && !empty($cell_ORDER_AMT['posy']))
            {
                $this->Pdf->SetXY($cell_ORDER_AMT['posx'], $cell_ORDER_AMT['posy']);
            }
            elseif (!empty($cell_ORDER_AMT['posx']))
            {
                $this->Pdf->SetX($cell_ORDER_AMT['posx']);
            }
            elseif (!empty($cell_ORDER_AMT['posy']))
            {
                $this->Pdf->SetY($cell_ORDER_AMT['posy']);
            }
            $this->Pdf->Cell($cell_ORDER_AMT['width'], 0, $cell_ORDER_AMT['data'], 0, 0, $cell_ORDER_AMT['align']);

            $this->Pdf->SetFont($cell_WARP_LOSS['font_type'], $cell_WARP_LOSS['font_style'], $cell_WARP_LOSS['font_size']);
            $this->Pdf->SetTextColor($cell_WARP_LOSS['color_r'], $cell_WARP_LOSS['color_g'], $cell_WARP_LOSS['color_b']);
            if (!empty($cell_WARP_LOSS['posx']) && !empty($cell_WARP_LOSS['posy']))
            {
                $this->Pdf->SetXY($cell_WARP_LOSS['posx'], $cell_WARP_LOSS['posy']);
            }
            elseif (!empty($cell_WARP_LOSS['posx']))
            {
                $this->Pdf->SetX($cell_WARP_LOSS['posx']);
            }
            elseif (!empty($cell_WARP_LOSS['posy']))
            {
                $this->Pdf->SetY($cell_WARP_LOSS['posy']);
            }
            $this->Pdf->Cell($cell_WARP_LOSS['width'], 0, $cell_WARP_LOSS['data'], 0, 0, $cell_WARP_LOSS['align']);

            $this->Pdf->SetFont($cell_TOP_P_O_['font_type'], $cell_TOP_P_O_['font_style'], $cell_TOP_P_O_['font_size']);
            $this->Pdf->SetTextColor($cell_TOP_P_O_['color_r'], $cell_TOP_P_O_['color_g'], $cell_TOP_P_O_['color_b']);
            if (!empty($cell_TOP_P_O_['posx']) && !empty($cell_TOP_P_O_['posy']))
            {
                $this->Pdf->SetXY($cell_TOP_P_O_['posx'], $cell_TOP_P_O_['posy']);
            }
            elseif (!empty($cell_TOP_P_O_['posx']))
            {
                $this->Pdf->SetX($cell_TOP_P_O_['posx']);
            }
            elseif (!empty($cell_TOP_P_O_['posy']))
            {
                $this->Pdf->SetY($cell_TOP_P_O_['posy']);
            }
            $this->Pdf->Cell($cell_TOP_P_O_['width'], 0, $cell_TOP_P_O_['data'], 0, 0, $cell_TOP_P_O_['align']);

            $this->Pdf->SetFont($cell_BOT_P_O_['font_type'], $cell_BOT_P_O_['font_style'], $cell_BOT_P_O_['font_size']);
            $this->Pdf->SetTextColor($cell_BOT_P_O_['color_r'], $cell_BOT_P_O_['color_g'], $cell_BOT_P_O_['color_b']);
            if (!empty($cell_BOT_P_O_['posx']) && !empty($cell_BOT_P_O_['posy']))
            {
                $this->Pdf->SetXY($cell_BOT_P_O_['posx'], $cell_BOT_P_O_['posy']);
            }
            elseif (!empty($cell_BOT_P_O_['posx']))
            {
                $this->Pdf->SetX($cell_BOT_P_O_['posx']);
            }
            elseif (!empty($cell_BOT_P_O_['posy']))
            {
                $this->Pdf->SetY($cell_BOT_P_O_['posy']);
            }
            $this->Pdf->Cell($cell_BOT_P_O_['width'], 0, $cell_BOT_P_O_['data'], 0, 0, $cell_BOT_P_O_['align']);

            $this->Pdf->SetFont($cell_LBS_SOLD['font_type'], $cell_LBS_SOLD['font_style'], $cell_LBS_SOLD['font_size']);
            $this->Pdf->SetTextColor($cell_LBS_SOLD['color_r'], $cell_LBS_SOLD['color_g'], $cell_LBS_SOLD['color_b']);
            if (!empty($cell_LBS_SOLD['posx']) && !empty($cell_LBS_SOLD['posy']))
            {
                $this->Pdf->SetXY($cell_LBS_SOLD['posx'], $cell_LBS_SOLD['posy']);
            }
            elseif (!empty($cell_LBS_SOLD['posx']))
            {
                $this->Pdf->SetX($cell_LBS_SOLD['posx']);
            }
            elseif (!empty($cell_LBS_SOLD['posy']))
            {
                $this->Pdf->SetY($cell_LBS_SOLD['posy']);
            }
            $this->Pdf->Cell($cell_LBS_SOLD['width'], 0, $cell_LBS_SOLD['data'], 0, 0, $cell_LBS_SOLD['align']);

            $this->Pdf->SetFont($cell_INVENTORY['font_type'], $cell_INVENTORY['font_style'], $cell_INVENTORY['font_size']);
            $this->Pdf->SetTextColor($cell_INVENTORY['color_r'], $cell_INVENTORY['color_g'], $cell_INVENTORY['color_b']);
            if (!empty($cell_INVENTORY['posx']) && !empty($cell_INVENTORY['posy']))
            {
                $this->Pdf->SetXY($cell_INVENTORY['posx'], $cell_INVENTORY['posy']);
            }
            elseif (!empty($cell_INVENTORY['posx']))
            {
                $this->Pdf->SetX($cell_INVENTORY['posx']);
            }
            elseif (!empty($cell_INVENTORY['posy']))
            {
                $this->Pdf->SetY($cell_INVENTORY['posy']);
            }
            $this->Pdf->Cell($cell_INVENTORY['width'], 0, $cell_INVENTORY['data'], 0, 0, $cell_INVENTORY['align']);

            $this->Pdf->SetFont($cell_PRICE_LB_W['font_type'], $cell_PRICE_LB_W['font_style'], $cell_PRICE_LB_W['font_size']);
            $this->Pdf->SetTextColor($cell_PRICE_LB_W['color_r'], $cell_PRICE_LB_W['color_g'], $cell_PRICE_LB_W['color_b']);
            if (!empty($cell_PRICE_LB_W['posx']) && !empty($cell_PRICE_LB_W['posy']))
            {
                $this->Pdf->SetXY($cell_PRICE_LB_W['posx'], $cell_PRICE_LB_W['posy']);
            }
            elseif (!empty($cell_PRICE_LB_W['posx']))
            {
                $this->Pdf->SetX($cell_PRICE_LB_W['posx']);
            }
            elseif (!empty($cell_PRICE_LB_W['posy']))
            {
                $this->Pdf->SetY($cell_PRICE_LB_W['posy']);
            }
            $this->Pdf->Cell($cell_PRICE_LB_W['width'], 0, $cell_PRICE_LB_W['data'], 0, 0, $cell_PRICE_LB_W['align']);

            $this->Pdf->SetFont($cell_COST_LB_W['font_type'], $cell_COST_LB_W['font_style'], $cell_COST_LB_W['font_size']);
            $this->Pdf->SetTextColor($cell_COST_LB_W['color_r'], $cell_COST_LB_W['color_g'], $cell_COST_LB_W['color_b']);
            if (!empty($cell_COST_LB_W['posx']) && !empty($cell_COST_LB_W['posy']))
            {
                $this->Pdf->SetXY($cell_COST_LB_W['posx'], $cell_COST_LB_W['posy']);
            }
            elseif (!empty($cell_COST_LB_W['posx']))
            {
                $this->Pdf->SetX($cell_COST_LB_W['posx']);
            }
            elseif (!empty($cell_COST_LB_W['posy']))
            {
                $this->Pdf->SetY($cell_COST_LB_W['posy']);
            }
            $this->Pdf->Cell($cell_COST_LB_W['width'], 0, $cell_COST_LB_W['data'], 0, 0, $cell_COST_LB_W['align']);

            $this->Pdf->SetFont($cell_COST_LB_Y['font_type'], $cell_COST_LB_Y['font_style'], $cell_COST_LB_Y['font_size']);
            $this->Pdf->SetTextColor($cell_COST_LB_Y['color_r'], $cell_COST_LB_Y['color_g'], $cell_COST_LB_Y['color_b']);
            if (!empty($cell_COST_LB_Y['posx']) && !empty($cell_COST_LB_Y['posy']))
            {
                $this->Pdf->SetXY($cell_COST_LB_Y['posx'], $cell_COST_LB_Y['posy']);
            }
            elseif (!empty($cell_COST_LB_Y['posx']))
            {
                $this->Pdf->SetX($cell_COST_LB_Y['posx']);
            }
            elseif (!empty($cell_COST_LB_Y['posy']))
            {
                $this->Pdf->SetY($cell_COST_LB_Y['posy']);
            }
            $this->Pdf->Cell($cell_COST_LB_Y['width'], 0, $cell_COST_LB_Y['data'], 0, 0, $cell_COST_LB_Y['align']);

            $this->Pdf->SetFont($cell_COST_LB_T['font_type'], $cell_COST_LB_T['font_style'], $cell_COST_LB_T['font_size']);
            $this->Pdf->SetTextColor($cell_COST_LB_T['color_r'], $cell_COST_LB_T['color_g'], $cell_COST_LB_T['color_b']);
            if (!empty($cell_COST_LB_T['posx']) && !empty($cell_COST_LB_T['posy']))
            {
                $this->Pdf->SetXY($cell_COST_LB_T['posx'], $cell_COST_LB_T['posy']);
            }
            elseif (!empty($cell_COST_LB_T['posx']))
            {
                $this->Pdf->SetX($cell_COST_LB_T['posx']);
            }
            elseif (!empty($cell_COST_LB_T['posy']))
            {
                $this->Pdf->SetY($cell_COST_LB_T['posy']);
            }
            $this->Pdf->Cell($cell_COST_LB_T['width'], 0, $cell_COST_LB_T['data'], 0, 0, $cell_COST_LB_T['align']);

            $this->Pdf->SetFont($cell_BEAM_CODE['font_type'], $cell_BEAM_CODE['font_style'], $cell_BEAM_CODE['font_size']);
            $this->Pdf->SetTextColor($cell_BEAM_CODE['color_r'], $cell_BEAM_CODE['color_g'], $cell_BEAM_CODE['color_b']);
            if (!empty($cell_BEAM_CODE['posx']) && !empty($cell_BEAM_CODE['posy']))
            {
                $this->Pdf->SetXY($cell_BEAM_CODE['posx'], $cell_BEAM_CODE['posy']);
            }
            elseif (!empty($cell_BEAM_CODE['posx']))
            {
                $this->Pdf->SetX($cell_BEAM_CODE['posx']);
            }
            elseif (!empty($cell_BEAM_CODE['posy']))
            {
                $this->Pdf->SetY($cell_BEAM_CODE['posy']);
            }
            $this->Pdf->Cell($cell_BEAM_CODE['width'], 0, $cell_BEAM_CODE['data'], 0, 0, $cell_BEAM_CODE['align']);

            $this->Pdf->SetFont($cell_YARN_CODE['font_type'], $cell_YARN_CODE['font_style'], $cell_YARN_CODE['font_size']);
            $this->Pdf->SetTextColor($cell_YARN_CODE['color_r'], $cell_YARN_CODE['color_g'], $cell_YARN_CODE['color_b']);
            if (!empty($cell_YARN_CODE['posx']) && !empty($cell_YARN_CODE['posy']))
            {
                $this->Pdf->SetXY($cell_YARN_CODE['posx'], $cell_YARN_CODE['posy']);
            }
            elseif (!empty($cell_YARN_CODE['posx']))
            {
                $this->Pdf->SetX($cell_YARN_CODE['posx']);
            }
            elseif (!empty($cell_YARN_CODE['posy']))
            {
                $this->Pdf->SetY($cell_YARN_CODE['posy']);
            }
            $this->Pdf->Cell($cell_YARN_CODE['width'], 0, $cell_YARN_CODE['data'], 0, 0, $cell_YARN_CODE['align']);

            $this->Pdf->SetFont($cell_STATUS['font_type'], $cell_STATUS['font_style'], $cell_STATUS['font_size']);
            $this->Pdf->SetTextColor($cell_STATUS['color_r'], $cell_STATUS['color_g'], $cell_STATUS['color_b']);
            if (!empty($cell_STATUS['posx']) && !empty($cell_STATUS['posy']))
            {
                $this->Pdf->SetXY($cell_STATUS['posx'], $cell_STATUS['posy']);
            }
            elseif (!empty($cell_STATUS['posx']))
            {
                $this->Pdf->SetX($cell_STATUS['posx']);
            }
            elseif (!empty($cell_STATUS['posy']))
            {
                $this->Pdf->SetY($cell_STATUS['posy']);
            }
            $this->Pdf->Cell($cell_STATUS['width'], 0, $cell_STATUS['data'], 0, 0, $cell_STATUS['align']);

            $this->Pdf->SetFont($cell_TCOST['font_type'], $cell_TCOST['font_style'], $cell_TCOST['font_size']);
            $this->Pdf->SetTextColor($cell_TCOST['color_r'], $cell_TCOST['color_g'], $cell_TCOST['color_b']);
            if (!empty($cell_TCOST['posx']) && !empty($cell_TCOST['posy']))
            {
                $this->Pdf->SetXY($cell_TCOST['posx'], $cell_TCOST['posy']);
            }
            elseif (!empty($cell_TCOST['posx']))
            {
                $this->Pdf->SetX($cell_TCOST['posx']);
            }
            elseif (!empty($cell_TCOST['posy']))
            {
                $this->Pdf->SetY($cell_TCOST['posy']);
            }
            $this->Pdf->Cell($cell_TCOST['width'], 0, $cell_TCOST['data'], 0, 0, $cell_TCOST['align']);

            $this->Pdf->SetFont($cell_SAMT['font_type'], $cell_SAMT['font_style'], $cell_SAMT['font_size']);
            $this->Pdf->SetTextColor($cell_SAMT['color_r'], $cell_SAMT['color_g'], $cell_SAMT['color_b']);
            if (!empty($cell_SAMT['posx']) && !empty($cell_SAMT['posy']))
            {
                $this->Pdf->SetXY($cell_SAMT['posx'], $cell_SAMT['posy']);
            }
            elseif (!empty($cell_SAMT['posx']))
            {
                $this->Pdf->SetX($cell_SAMT['posx']);
            }
            elseif (!empty($cell_SAMT['posy']))
            {
                $this->Pdf->SetY($cell_SAMT['posy']);
            }
            $this->Pdf->Cell($cell_SAMT['width'], 0, $cell_SAMT['data'], 0, 0, $cell_SAMT['align']);

            $this->Pdf->SetFont($cell_TV['font_type'], $cell_TV['font_style'], $cell_TV['font_size']);
            $this->Pdf->SetTextColor($cell_TV['color_r'], $cell_TV['color_g'], $cell_TV['color_b']);
            if (!empty($cell_TV['posx']) && !empty($cell_TV['posy']))
            {
                $this->Pdf->SetXY($cell_TV['posx'], $cell_TV['posy']);
            }
            elseif (!empty($cell_TV['posx']))
            {
                $this->Pdf->SetX($cell_TV['posx']);
            }
            elseif (!empty($cell_TV['posy']))
            {
                $this->Pdf->SetY($cell_TV['posy']);
            }
            $this->Pdf->Cell($cell_TV['width'], 0, $cell_TV['data'], 0, 0, $cell_TV['align']);

            $this->Pdf->SetFont($cell_SIZE['font_type'], $cell_SIZE['font_style'], $cell_SIZE['font_size']);
            $this->Pdf->SetTextColor($cell_SIZE['color_r'], $cell_SIZE['color_g'], $cell_SIZE['color_b']);
            if (!empty($cell_SIZE['posx']) && !empty($cell_SIZE['posy']))
            {
                $this->Pdf->SetXY($cell_SIZE['posx'], $cell_SIZE['posy']);
            }
            elseif (!empty($cell_SIZE['posx']))
            {
                $this->Pdf->SetX($cell_SIZE['posx']);
            }
            elseif (!empty($cell_SIZE['posy']))
            {
                $this->Pdf->SetY($cell_SIZE['posy']);
            }
            $this->Pdf->Cell($cell_SIZE['width'], 0, $cell_SIZE['data'], 0, 0, $cell_SIZE['align']);

            $this->Pdf->SetFont($cell_B_S['font_type'], $cell_B_S['font_style'], $cell_B_S['font_size']);
            $this->Pdf->SetTextColor($cell_B_S['color_r'], $cell_B_S['color_g'], $cell_B_S['color_b']);
            if (!empty($cell_B_S['posx']) && !empty($cell_B_S['posy']))
            {
                $this->Pdf->SetXY($cell_B_S['posx'], $cell_B_S['posy']);
            }
            elseif (!empty($cell_B_S['posx']))
            {
                $this->Pdf->SetX($cell_B_S['posx']);
            }
            elseif (!empty($cell_B_S['posy']))
            {
                $this->Pdf->SetY($cell_B_S['posy']);
            }
            $this->Pdf->Cell($cell_B_S['width'], 0, $cell_B_S['data'], 0, 0, $cell_B_S['align']);

            $this->Pdf->SetFont($cell_WASTE['font_type'], $cell_WASTE['font_style'], $cell_WASTE['font_size']);
            $this->Pdf->SetTextColor($cell_WASTE['color_r'], $cell_WASTE['color_g'], $cell_WASTE['color_b']);
            if (!empty($cell_WASTE['posx']) && !empty($cell_WASTE['posy']))
            {
                $this->Pdf->SetXY($cell_WASTE['posx'], $cell_WASTE['posy']);
            }
            elseif (!empty($cell_WASTE['posx']))
            {
                $this->Pdf->SetX($cell_WASTE['posx']);
            }
            elseif (!empty($cell_WASTE['posy']))
            {
                $this->Pdf->SetY($cell_WASTE['posy']);
            }
            $this->Pdf->Cell($cell_WASTE['width'], 0, $cell_WASTE['data'], 0, 0, $cell_WASTE['align']);

            $this->Pdf->SetFont($cell_ACOST['font_type'], $cell_ACOST['font_style'], $cell_ACOST['font_size']);
            $this->Pdf->SetTextColor($cell_ACOST['color_r'], $cell_ACOST['color_g'], $cell_ACOST['color_b']);
            if (!empty($cell_ACOST['posx']) && !empty($cell_ACOST['posy']))
            {
                $this->Pdf->SetXY($cell_ACOST['posx'], $cell_ACOST['posy']);
            }
            elseif (!empty($cell_ACOST['posx']))
            {
                $this->Pdf->SetX($cell_ACOST['posx']);
            }
            elseif (!empty($cell_ACOST['posy']))
            {
                $this->Pdf->SetY($cell_ACOST['posy']);
            }
            $this->Pdf->Cell($cell_ACOST['width'], 0, $cell_ACOST['data'], 0, 0, $cell_ACOST['align']);

            $this->Pdf->SetFont($cell_FIBER['font_type'], $cell_FIBER['font_style'], $cell_FIBER['font_size']);
            $this->Pdf->SetTextColor($cell_FIBER['color_r'], $cell_FIBER['color_g'], $cell_FIBER['color_b']);
            if (!empty($cell_FIBER['posx']) && !empty($cell_FIBER['posy']))
            {
                $this->Pdf->SetXY($cell_FIBER['posx'], $cell_FIBER['posy']);
            }
            elseif (!empty($cell_FIBER['posx']))
            {
                $this->Pdf->SetX($cell_FIBER['posx']);
            }
            elseif (!empty($cell_FIBER['posy']))
            {
                $this->Pdf->SetY($cell_FIBER['posy']);
            }
            $this->Pdf->Cell($cell_FIBER['width'], 0, $cell_FIBER['data'], 0, 0, $cell_FIBER['align']);

            $this->Pdf->SetFont($cell_NS['font_type'], $cell_NS['font_style'], $cell_NS['font_size']);
            $this->Pdf->SetTextColor($cell_NS['color_r'], $cell_NS['color_g'], $cell_NS['color_b']);
            if (!empty($cell_NS['posx']) && !empty($cell_NS['posy']))
            {
                $this->Pdf->SetXY($cell_NS['posx'], $cell_NS['posy']);
            }
            elseif (!empty($cell_NS['posx']))
            {
                $this->Pdf->SetX($cell_NS['posx']);
            }
            elseif (!empty($cell_NS['posy']))
            {
                $this->Pdf->SetY($cell_NS['posy']);
            }
            $this->Pdf->Cell($cell_NS['width'], 0, $cell_NS['data'], 0, 0, $cell_NS['align']);

            $this->Pdf->SetFont($cell_MARKDOWN['font_type'], $cell_MARKDOWN['font_style'], $cell_MARKDOWN['font_size']);
            $this->Pdf->SetTextColor($cell_MARKDOWN['color_r'], $cell_MARKDOWN['color_g'], $cell_MARKDOWN['color_b']);
            if (!empty($cell_MARKDOWN['posx']) && !empty($cell_MARKDOWN['posy']))
            {
                $this->Pdf->SetXY($cell_MARKDOWN['posx'], $cell_MARKDOWN['posy']);
            }
            elseif (!empty($cell_MARKDOWN['posx']))
            {
                $this->Pdf->SetX($cell_MARKDOWN['posx']);
            }
            elseif (!empty($cell_MARKDOWN['posy']))
            {
                $this->Pdf->SetY($cell_MARKDOWN['posy']);
            }
            $this->Pdf->Cell($cell_MARKDOWN['width'], 0, $cell_MARKDOWN['data'], 0, 0, $cell_MARKDOWN['align']);

            $this->Pdf->SetFont($cell_MDVALUE['font_type'], $cell_MDVALUE['font_style'], $cell_MDVALUE['font_size']);
            $this->Pdf->SetTextColor($cell_MDVALUE['color_r'], $cell_MDVALUE['color_g'], $cell_MDVALUE['color_b']);
            if (!empty($cell_MDVALUE['posx']) && !empty($cell_MDVALUE['posy']))
            {
                $this->Pdf->SetXY($cell_MDVALUE['posx'], $cell_MDVALUE['posy']);
            }
            elseif (!empty($cell_MDVALUE['posx']))
            {
                $this->Pdf->SetX($cell_MDVALUE['posx']);
            }
            elseif (!empty($cell_MDVALUE['posy']))
            {
                $this->Pdf->SetY($cell_MDVALUE['posy']);
            }
            $this->Pdf->Cell($cell_MDVALUE['width'], 0, $cell_MDVALUE['data'], 0, 0, $cell_MDVALUE['align']);

            $this->Pdf->SetFont($cell_DEN['font_type'], $cell_DEN['font_style'], $cell_DEN['font_size']);
            $this->Pdf->SetTextColor($cell_DEN['color_r'], $cell_DEN['color_g'], $cell_DEN['color_b']);
            if (!empty($cell_DEN['posx']) && !empty($cell_DEN['posy']))
            {
                $this->Pdf->SetXY($cell_DEN['posx'], $cell_DEN['posy']);
            }
            elseif (!empty($cell_DEN['posx']))
            {
                $this->Pdf->SetX($cell_DEN['posx']);
            }
            elseif (!empty($cell_DEN['posy']))
            {
                $this->Pdf->SetY($cell_DEN['posy']);
            }
            $this->Pdf->Cell($cell_DEN['width'], 0, $cell_DEN['data'], 0, 0, $cell_DEN['align']);

            $this->Pdf->SetFont($cell_FIL['font_type'], $cell_FIL['font_style'], $cell_FIL['font_size']);
            $this->Pdf->SetTextColor($cell_FIL['color_r'], $cell_FIL['color_g'], $cell_FIL['color_b']);
            if (!empty($cell_FIL['posx']) && !empty($cell_FIL['posy']))
            {
                $this->Pdf->SetXY($cell_FIL['posx'], $cell_FIL['posy']);
            }
            elseif (!empty($cell_FIL['posx']))
            {
                $this->Pdf->SetX($cell_FIL['posx']);
            }
            elseif (!empty($cell_FIL['posy']))
            {
                $this->Pdf->SetY($cell_FIL['posy']);
            }
            $this->Pdf->Cell($cell_FIL['width'], 0, $cell_FIL['data'], 0, 0, $cell_FIL['align']);

            $this->Pdf->SetFont($cell_LUSTER['font_type'], $cell_LUSTER['font_style'], $cell_LUSTER['font_size']);
            $this->Pdf->SetTextColor($cell_LUSTER['color_r'], $cell_LUSTER['color_g'], $cell_LUSTER['color_b']);
            if (!empty($cell_LUSTER['posx']) && !empty($cell_LUSTER['posy']))
            {
                $this->Pdf->SetXY($cell_LUSTER['posx'], $cell_LUSTER['posy']);
            }
            elseif (!empty($cell_LUSTER['posx']))
            {
                $this->Pdf->SetX($cell_LUSTER['posx']);
            }
            elseif (!empty($cell_LUSTER['posy']))
            {
                $this->Pdf->SetY($cell_LUSTER['posy']);
            }
            $this->Pdf->Cell($cell_LUSTER['width'], 0, $cell_LUSTER['data'], 0, 0, $cell_LUSTER['align']);

            $this->Pdf->SetFont($cell_PRODUCER['font_type'], $cell_PRODUCER['font_style'], $cell_PRODUCER['font_size']);
            $this->Pdf->SetTextColor($cell_PRODUCER['color_r'], $cell_PRODUCER['color_g'], $cell_PRODUCER['color_b']);
            if (!empty($cell_PRODUCER['posx']) && !empty($cell_PRODUCER['posy']))
            {
                $this->Pdf->SetXY($cell_PRODUCER['posx'], $cell_PRODUCER['posy']);
            }
            elseif (!empty($cell_PRODUCER['posx']))
            {
                $this->Pdf->SetX($cell_PRODUCER['posx']);
            }
            elseif (!empty($cell_PRODUCER['posy']))
            {
                $this->Pdf->SetY($cell_PRODUCER['posy']);
            }
            $this->Pdf->Cell($cell_PRODUCER['width'], 0, $cell_PRODUCER['data'], 0, 0, $cell_PRODUCER['align']);

            $this->Pdf->SetFont($cell_MERGE['font_type'], $cell_MERGE['font_style'], $cell_MERGE['font_size']);
            $this->Pdf->SetTextColor($cell_MERGE['color_r'], $cell_MERGE['color_g'], $cell_MERGE['color_b']);
            if (!empty($cell_MERGE['posx']) && !empty($cell_MERGE['posy']))
            {
                $this->Pdf->SetXY($cell_MERGE['posx'], $cell_MERGE['posy']);
            }
            elseif (!empty($cell_MERGE['posx']))
            {
                $this->Pdf->SetX($cell_MERGE['posx']);
            }
            elseif (!empty($cell_MERGE['posy']))
            {
                $this->Pdf->SetY($cell_MERGE['posy']);
            }
            $this->Pdf->Cell($cell_MERGE['width'], 0, $cell_MERGE['data'], 0, 0, $cell_MERGE['align']);

            $this->Pdf->SetFont($cell_AC['font_type'], $cell_AC['font_style'], $cell_AC['font_size']);
            $this->Pdf->SetTextColor($cell_AC['color_r'], $cell_AC['color_g'], $cell_AC['color_b']);
            if (!empty($cell_AC['posx']) && !empty($cell_AC['posy']))
            {
                $this->Pdf->SetXY($cell_AC['posx'], $cell_AC['posy']);
            }
            elseif (!empty($cell_AC['posx']))
            {
                $this->Pdf->SetX($cell_AC['posx']);
            }
            elseif (!empty($cell_AC['posy']))
            {
                $this->Pdf->SetY($cell_AC['posy']);
            }
            $this->Pdf->Cell($cell_AC['width'], 0, $cell_AC['data'], 0, 0, $cell_AC['align']);

            $this->Pdf->SetFont($cell_COMMENT['font_type'], $cell_COMMENT['font_style'], $cell_COMMENT['font_size']);
            $this->Pdf->SetTextColor($cell_COMMENT['color_r'], $cell_COMMENT['color_g'], $cell_COMMENT['color_b']);
            if (!empty($cell_COMMENT['posx']) && !empty($cell_COMMENT['posy']))
            {
                $this->Pdf->SetXY($cell_COMMENT['posx'], $cell_COMMENT['posy']);
            }
            elseif (!empty($cell_COMMENT['posx']))
            {
                $this->Pdf->SetX($cell_COMMENT['posx']);
            }
            elseif (!empty($cell_COMMENT['posy']))
            {
                $this->Pdf->SetY($cell_COMMENT['posy']);
            }
            $this->Pdf->Cell($cell_COMMENT['width'], 0, $cell_COMMENT['data'], 0, 0, $cell_COMMENT['align']);

          $max_Y = 0;
          $this->rs_grid->MoveNext();
          $this->sc_proc_grid = false;
          $nm_quant_linhas++ ;
      }  
   }  
   $this->rs_grid->Close();
   $this->Pdf->Output($this->Ini->root . $this->Ini->nm_path_pdf);
 }
 function SC_conv_utf8($input)
 {
     if ($this->Font_ttf && !NM_is_utf8($input))
     {
         $input = mb_convert_encoding($input, "UTF-8", $_SESSION['scriptcase']['charset']);
     }
     elseif (!$this->Font_ttf && $_SESSION['scriptcase']['charset'] == "UTF-8" && NM_is_utf8($input))
     {
         $input = mb_convert_encoding($input, "ISO-8859-9", "UTF-8");
     }
     return $input;
 }
   function nm_conv_data_db($dt_in, $form_in, $form_out)
   {
       $dt_out = $dt_in;
       if (strtoupper($form_in) == "DB_FORMAT")
       {
           if ($dt_out == "null" || $dt_out == "")
           {
               $dt_out = "";
               return $dt_out;
           }
           $form_in = "AAAA-MM-DD";
       }
       if (strtoupper($form_out) == "DB_FORMAT")
       {
           if (empty($dt_out))
           {
               $dt_out = "null";
               return $dt_out;
           }
           $form_out = "AAAA-MM-DD";
       }
       nm_conv_form_data($dt_out, $form_in, $form_out);
       return $dt_out;
   }

 function Nm_date_format($Type, $Format)
 {
     $Form_base = str_replace("/", "", $Format);
     $Form_base = str_replace("-", "", $Form_base);
     $Form_base = str_replace(":", "", $Form_base);
     $Form_base = str_replace(";", "", $Form_base);
     $Form_base = str_replace(" ", "", $Form_base);
     $Form_base = str_replace("a", "Y", $Form_base);
     $Form_base = str_replace("y", "Y", $Form_base);
     $Form_base = str_replace("h", "H", $Form_base);
     $date_format_show = "";
     if ($Type == "DT" || $Type == "DH")
     {
         $Str_date = str_replace("a", "y", strtolower($_SESSION['scriptcase']['reg_conf']['date_format']));
         $Str_date = str_replace("y", "Y", $Str_date);
         $Str_date = str_replace("h", "H", $Str_date);
         $Lim   = strlen($Str_date);
         $Ult   = "";
         $Arr_D = array();
         for ($I = 0; $I < $Lim; $I++)
         {
              $Char = substr($Str_date, $I, 1);
              if ($Char != $Ult)
              {
                  $Arr_D[] = $Char;
              }
              $Ult = $Char;
         }
         $Prim = true;
         foreach ($Arr_D as $Cada_d)
         {
             if (strpos($Form_base, $Cada_d) !== false)
             {
                 $date_format_show .= (!$Prim) ? $_SESSION['scriptcase']['reg_conf']['date_sep'] : "";
                 $date_format_show .= $Cada_d;
                 $Prim = false;
             }
         }
     }
     if ($Type == "DH" || $Type == "HH")
     {
         if ($Type == "DH")
         {
             $date_format_show .= " ";
         }
         $Str_time = strtolower($_SESSION['scriptcase']['reg_conf']['time_format']);
         $Str_time = str_replace("h", "H", $Str_time);
         $Lim   = strlen($Str_time);
         $Ult   = "";
         $Arr_T = array();
         for ($I = 0; $I < $Lim; $I++)
         {
              $Char = substr($Str_time, $I, 1);
              if ($Char != $Ult)
              {
                  $Arr_T[] = $Char;
              }
              $Ult = $Char;
         }
         $Prim = true;
         foreach ($Arr_T as $Cada_t)
         {
             if (strpos($Form_base, $Cada_t) !== false)
             {
                 $date_format_show .= (!$Prim) ? $_SESSION['scriptcase']['reg_conf']['time_sep'] : "";
                 $date_format_show .= $Cada_t;
                 $Prim = false;
             }
         }
     }
     return $date_format_show;
 }

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