<?php
//--- 
class purchases_grid_det
{
   var $Ini;
   var $Erro;
   var $Db;
   var $nm_data;
   var $NM_raiz_img; 
   var $nmgp_botoes; 
   var $vendorid;
   var $vendorname;
   var $sc_field_0;
   var $date;
   var $dropship;
   var $waitingonbill;
   var $dropshipcustomerid;
   var $sc_field_1;
   var $shiptoname;
   var $sc_field_2;
   var $sc_field_3;
   var $shiptocity;
   var $shiptostate;
   var $shiptozipcode;
   var $shiptocountry;
   var $datedue;
   var $discountdate;
   var $discountamount;
   var $accountspayableaccount;
   var $accountspayableamount;
   var $shipvia;
   var $ponote;
   var $noteprintsafterlineitems;
   var $beginningbalancetransaction;
   var $dateclearedinbankrec;
   var $appliedtopurchaseorder;
   var $numberofdistributions;
   var $ponumber;
   var $podistribution;
   var $quantity;
   var $itemid;
   var $description;
   var $sc_field_4;
   var $unitprice;
   var $amount;
   var $jobid;
   var $usedforreimbursableexpense;
   var $transactionperiod;
   var $transactionnumber;
   var $id2;
 function monta_det()
 {
    global 
           $nm_saida, $nm_lang, $nmgp_cor_print, $nmgp_tipo_pdf;
    $this->nmgp_botoes['det_pdf'] = "on";
    $this->nmgp_botoes['det_print'] = "on";
    if (isset($_SESSION['scriptcase']['sc_apl_conf']['purchases_grid']['btn_display']) && !empty($_SESSION['scriptcase']['sc_apl_conf']['purchases_grid']['btn_display']))
    {
        foreach ($_SESSION['scriptcase']['sc_apl_conf']['purchases_grid']['btn_display'] as $NM_cada_btn => $NM_cada_opc)
        {
            $this->nmgp_botoes[$NM_cada_btn] = $NM_cada_opc;
        }
    }
    if (isset($_SESSION['sc_session'][$this->Ini->sc_page]['purchases_grid']['campos_busca']) && !empty($_SESSION['sc_session'][$this->Ini->sc_page]['purchases_grid']['campos_busca']))
    { 
        $this->date = $_SESSION['sc_session'][$this->Ini->sc_page]['purchases_grid']['campos_busca']['date']; 
        $tmp_pos = strpos($this->date, "##@@");
        if ($tmp_pos !== false)
        {
            $this->date = substr($this->date, 0, $tmp_pos);
        }
        $this->vendorid = $_SESSION['sc_session'][$this->Ini->sc_page]['purchases_grid']['campos_busca']['vendorid']; 
        $tmp_pos = strpos($this->vendorid, "##@@");
        if ($tmp_pos !== false)
        {
            $this->vendorid = substr($this->vendorid, 0, $tmp_pos);
        }
        $this->vendorname = $_SESSION['sc_session'][$this->Ini->sc_page]['purchases_grid']['campos_busca']['vendorname']; 
        $tmp_pos = strpos($this->vendorname, "##@@");
        if ($tmp_pos !== false)
        {
            $this->vendorname = substr($this->vendorname, 0, $tmp_pos);
        }
        $this->sc_field_0 = $_SESSION['sc_session'][$this->Ini->sc_page]['purchases_grid']['campos_busca']['sc_field_0']; 
        $tmp_pos = strpos($this->sc_field_0, "##@@");
        if ($tmp_pos !== false)
        {
            $this->sc_field_0 = substr($this->sc_field_0, 0, $tmp_pos);
        }
    } 
    $this->sc_where_orig   = $_SESSION['sc_session'][$this->Ini->sc_page]['purchases_grid']['where_orig'];
    $this->sc_where_atual  = $_SESSION['sc_session'][$this->Ini->sc_page]['purchases_grid']['where_pesq'];
    $this->sc_where_filtro = $_SESSION['sc_session'][$this->Ini->sc_page]['purchases_grid']['where_pesq_filtro'];
    $this->nm_field_dinamico = array();
    $this->nm_order_dinamico = array();
    $this->nm_data = new nm_data("en_us");
    $this->NM_raiz_img  = ""; 
    $this->sc_proc_grid = false; 
    include($this->Ini->path_btn . $this->Ini->Str_btn_grid);
    $_SESSION['sc_session'][$this->Ini->sc_page]['purchases_grid']['seq_dir'] = 0; 
    $_SESSION['sc_session'][$this->Ini->sc_page]['purchases_grid']['sub_dir'] = array(); 
   $Str_date = strtolower($_SESSION['scriptcase']['reg_conf']['date_format']);
   $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;
   $Str  = "";
   foreach ($Arr_D as $Cada_d)
   {
       $Str .= (!$Prim) ? $_SESSION['scriptcase']['reg_conf']['date_sep'] : "";
       $Str .= $Cada_d;
       $Prim = false;
   }
   $Str = str_replace("a", "Y", $Str);
   $Str = str_replace("y", "Y", $Str);
   $nm_data_fixa = date($Str); 
   $this->nm_data->SetaData(date("Y/m/d H:i:s"), "YYYY/MM/DD HH:II:SS"); 
   $this->Ini->sc_Include($this->Ini->path_lib_php . "/nm_edit.php", "F", "nmgp_Form_Num_Val") ; 
   if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_sybase)) 
   { 
       $nmgp_select = "SELECT VendorID, VendorName, `Invoice#`, `Date`, DropShip, WaitingonBill, DropShipCustomerID, `ShiptoInvoice#`, ShiptoName, `ShiptoAddress-LineOne`, `ShiptoAddress-LineTwo`, ShiptoCity, ShiptoState, ShiptoZipcode, ShiptoCountry, DateDue, DiscountDate, DiscountAmount, AccountsPayableAccount, AccountsPayableAmount, ShipVia, PONote, NotePrintsAfterLineItems, BeginningBalanceTransaction, DateClearedinBankRec, AppliedToPurchaseOrder, NumberofDistributions, PONumber, PODistribution, Quantity, ItemID, Description, `G-LAccount`, UnitPrice, Amount, JobID, UsedforReimbursableExpense, TransactionPeriod, TransactionNumber, ID2 from " . $this->Ini->nm_tabela; 
   } 
   elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql)) 
   { 
       $nmgp_select = "SELECT VendorID, VendorName, `Invoice#`, `Date`, DropShip, WaitingonBill, DropShipCustomerID, `ShiptoInvoice#`, ShiptoName, `ShiptoAddress-LineOne`, `ShiptoAddress-LineTwo`, ShiptoCity, ShiptoState, ShiptoZipcode, ShiptoCountry, DateDue, DiscountDate, DiscountAmount, AccountsPayableAccount, AccountsPayableAmount, ShipVia, PONote, NotePrintsAfterLineItems, BeginningBalanceTransaction, DateClearedinBankRec, AppliedToPurchaseOrder, NumberofDistributions, PONumber, PODistribution, Quantity, ItemID, Description, `G-LAccount`, UnitPrice, Amount, JobID, UsedforReimbursableExpense, TransactionPeriod, TransactionNumber, ID2 from " . $this->Ini->nm_tabela; 
   } 
   elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_oracle)) 
   { 
       $nmgp_select = "SELECT VendorID, VendorName, `Invoice#`, `Date`, DropShip, WaitingonBill, DropShipCustomerID, `ShiptoInvoice#`, ShiptoName, `ShiptoAddress-LineOne`, `ShiptoAddress-LineTwo`, ShiptoCity, ShiptoState, ShiptoZipcode, ShiptoCountry, DateDue, DiscountDate, DiscountAmount, AccountsPayableAccount, AccountsPayableAmount, ShipVia, PONote, NotePrintsAfterLineItems, BeginningBalanceTransaction, DateClearedinBankRec, AppliedToPurchaseOrder, NumberofDistributions, PONumber, PODistribution, Quantity, ItemID, Description, `G-LAccount`, UnitPrice, Amount, JobID, UsedforReimbursableExpense, TransactionPeriod, TransactionNumber, ID2 from " . $this->Ini->nm_tabela; 
   } 
   elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_informix)) 
   { 
       $nmgp_select = "SELECT VendorID, VendorName, `Invoice#`, `Date`, DropShip, WaitingonBill, DropShipCustomerID, `ShiptoInvoice#`, ShiptoName, `ShiptoAddress-LineOne`, `ShiptoAddress-LineTwo`, ShiptoCity, ShiptoState, ShiptoZipcode, ShiptoCountry, DateDue, DiscountDate, DiscountAmount, AccountsPayableAccount, AccountsPayableAmount, ShipVia, PONote, NotePrintsAfterLineItems, BeginningBalanceTransaction, DateClearedinBankRec, AppliedToPurchaseOrder, NumberofDistributions, PONumber, PODistribution, Quantity, ItemID, Description, `G-LAccount`, UnitPrice, Amount, JobID, UsedforReimbursableExpense, TransactionPeriod, TransactionNumber, ID2 from " . $this->Ini->nm_tabela; 
   } 
   else 
   { 
       $nmgp_select = "SELECT VendorID, VendorName, `Invoice#`, `Date`, DropShip, WaitingonBill, DropShipCustomerID, `ShiptoInvoice#`, ShiptoName, `ShiptoAddress-LineOne`, `ShiptoAddress-LineTwo`, ShiptoCity, ShiptoState, ShiptoZipcode, ShiptoCountry, DateDue, DiscountDate, DiscountAmount, AccountsPayableAccount, AccountsPayableAmount, ShipVia, PONote, NotePrintsAfterLineItems, BeginningBalanceTransaction, DateClearedinBankRec, AppliedToPurchaseOrder, NumberofDistributions, PONumber, PODistribution, Quantity, ItemID, Description, `G-LAccount`, UnitPrice, Amount, JobID, UsedforReimbursableExpense, TransactionPeriod, TransactionNumber, ID2 from " . $this->Ini->nm_tabela; 
   } 
   $parms_det = explode(";", $_SESSION['sc_session'][$this->Ini->sc_page]['purchases_grid']['chave_det']) ; 
   foreach ($parms_det as $key => $cada_par)
   {
       $parms_det[$key] = stripslashes($parms_det[$key]);
       $parms_det[$key] = $this->Db->qstr($parms_det[$key]);
       $parms_det[$key] = substr($parms_det[$key], 1, strlen($parms_det[$key]) - 2);
   } 
   if (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_access))
   {
       $nmgp_select .= " where  ID2 = $parms_det[0]" ;  
   } 
   elseif (in_array(strtolower($this->Ini->nm_tpbanco), $this->Ini->nm_bases_mssql))
   {
       $nmgp_select .= " where  ID2 = $parms_det[0]" ;  
   } 
   else 
   { 
       $nmgp_select .= " where  ID2 = $parms_det[0]" ;  
   } 
   $_SESSION['scriptcase']['sc_sql_ult_conexao'] = ''; 
   $_SESSION['scriptcase']['sc_sql_ult_comando'] = $nmgp_select; 
   $rs = $this->Db->Execute($nmgp_select) ; 
   if ($rs === false && !$rs->EOF && $GLOBALS["NM_ERRO_IBASE"] != 1) 
   { 
       $this->Erro->mensagem (__FILE__, __LINE__, "banco", $this->Ini->Nm_lang['lang_errm_dber'], $this->Db->ErrorMsg()); 
       exit ; 
   }  
   $this->vendorid = $rs->fields[0] ;  
   $this->vendorname = $rs->fields[1] ;  
   $this->sc_field_0 = $rs->fields[2] ;  
   $this->date = $rs->fields[3] ;  
   $this->dropship = $rs->fields[4] ;  
   $this->waitingonbill = $rs->fields[5] ;  
   $this->dropshipcustomerid = $rs->fields[6] ;  
   $this->sc_field_1 = $rs->fields[7] ;  
   $this->shiptoname = $rs->fields[8] ;  
   $this->sc_field_2 = $rs->fields[9] ;  
   $this->sc_field_3 = $rs->fields[10] ;  
   $this->shiptocity = $rs->fields[11] ;  
   $this->shiptostate = $rs->fields[12] ;  
   $this->shiptozipcode = $rs->fields[13] ;  
   $this->shiptocountry = $rs->fields[14] ;  
   $this->datedue = $rs->fields[15] ;  
   $this->discountdate = $rs->fields[16] ;  
   $this->discountamount = $rs->fields[17] ;  
   $this->accountspayableaccount = $rs->fields[18] ;  
   $this->accountspayableamount = $rs->fields[19] ;  
   $this->shipvia = $rs->fields[20] ;  
   $this->ponote = $rs->fields[21] ;  
   $this->noteprintsafterlineitems = $rs->fields[22] ;  
   $this->beginningbalancetransaction = $rs->fields[23] ;  
   $this->dateclearedinbankrec = $rs->fields[24] ;  
   $this->appliedtopurchaseorder = $rs->fields[25] ;  
   $this->numberofdistributions = $rs->fields[26] ;  
   $this->ponumber = $rs->fields[27] ;  
   $this->podistribution = $rs->fields[28] ;  
   $this->quantity = $rs->fields[29] ;  
   $this->itemid = $rs->fields[30] ;  
   $this->description = $rs->fields[31] ;  
   $this->sc_field_4 = $rs->fields[32] ;  
   $this->unitprice = $rs->fields[33] ;  
   $this->amount = $rs->fields[34] ;  
   $this->jobid = $rs->fields[35] ;  
   $this->usedforreimbursableexpense = $rs->fields[36] ;  
   $this->transactionperiod = $rs->fields[37] ;  
   $this->transactionnumber = $rs->fields[38] ;  
   $this->id2 = $rs->fields[39] ;  
   $this->id2 = (string)$this->id2;
//--- 
   $nm_saida->saida("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\r\n");
   $nm_saida->saida("            \"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd\">\r\n");
   $nm_saida->saida("<html" . $_SESSION['scriptcase']['reg_conf']['html_dir'] . ">\r\n");
   $nm_saida->saida("<HEAD>\r\n");
   $nm_saida->saida("   <TITLE>" . $this->Ini->Nm_lang['lang_othr_detl_titl'] . " - purchases</TITLE>\r\n");
   $nm_saida->saida(" <META http-equiv=\"Content-Type\" content=\"text/html; charset=" . $_SESSION['scriptcase']['charset_html'] . "\" />\r\n");
   $nm_saida->saida(" <META http-equiv=\"Expires\" content=\"Fri, Jan 01 1900 00:00:00 GMT\"/>\r\n");
   $nm_saida->saida(" <META http-equiv=\"Last-Modified\" content=\"" . gmdate("D, d M Y H:i:s") . " GMT\"/>\r\n");
   $nm_saida->saida(" <META http-equiv=\"Cache-Control\" content=\"no-store, no-cache, must-revalidate\"/>\r\n");
   $nm_saida->saida(" <META http-equiv=\"Cache-Control\" content=\"post-check=0, pre-check=0\"/>\r\n");
   $nm_saida->saida(" <META http-equiv=\"Pragma\" content=\"no-cache\"/>\r\n");
   $nm_saida->saida(" <script type=\"text/javascript\" src=\"" . $this->Ini->path_prod . "/third/jquery/js/jquery.js\"></script>\r\n");
   $nm_saida->saida(" <script type=\"text/javascript\" src=\"" . $this->Ini->path_prod . "/third/jquery_plugin/malsup-blockui/jquery.blockUI.js\"></script>\r\n");
   $nm_saida->saida(" <script type=\"text/javascript\">var sc_pathToTB = '" . $this->Ini->path_prod . "/third/jquery_plugin/thickbox/';</script>\r\n");
   $nm_saida->saida(" <script type=\"text/javascript\" src=\"" . $this->Ini->path_prod . "/third/jquery_plugin/thickbox/thickbox-compressed.js\"></script>\r\n");
   $nm_saida->saida(" <script type=\"text/javascript\" src=\"../_lib/lib/js/jquery.scInput.js\"></script>\r\n");
   $nm_saida->saida(" <link rel=\"stylesheet\" href=\"" . $this->Ini->path_prod . "/third/jquery_plugin/thickbox/thickbox.css\" type=\"text/css\" media=\"screen\" />\r\n");
   if (($_SESSION['sc_session'][$this->Ini->sc_page]['purchases_grid']['det_print'] == "print" && strtoupper($nmgp_cor_print) == "PB") || $nmgp_tipo_pdf == "pb")
   {
       $nm_saida->saida(" <link rel=\"stylesheet\" type=\"text/css\" href=\"" . $this->Ini->path_link . "_lib/css/" . $this->Ini->str_schema_all . "_grid_bw.css\" /> \r\n");
   }
   else
   {
       $nm_saida->saida(" <link rel=\"stylesheet\" type=\"text/css\" href=\"" . $this->Ini->path_link . "_lib/css/" . $this->Ini->str_schema_all . "_grid.css\" /> \r\n");
   }
   if (!$_SESSION['sc_session'][$this->Ini->sc_page]['purchases_grid']['pdf_det'] && $_SESSION['sc_session'][$this->Ini->sc_page]['purchases_grid']['det_print'] != "print")
   {
       $nm_saida->saida(" <link rel=\"stylesheet\" type=\"text/css\" href=\"../_lib/buttons/" . $this->Ini->Str_btn_css . "\" /> \r\n");
       $nm_saida->saida(" <link rel=\"stylesheet\" href=\"../_lib/css/" . $_SESSION['scriptcase']['erro']['str_schema'] . "\" type=\"text/css\" media=\"screen\" />\r\n");
   }
   $nm_saida->saida("</HEAD>\r\n");
   $nm_saida->saida("  <body class=\"scGridPage\">\r\n");
   $nm_saida->saida("  " . $this->Ini->Ajax_result_set . "\r\n");
   $nm_saida->saida("<table class=\"scGridBorder\" border=0 align=\"center\" valign=\"top\" ><tr><td style=\"padding: 0px\">\r\n");
   $nm_saida->saida("<tr><td class=\"scGridTabelaTd\">\r\n");
   $nm_saida->saida("<style>\r\n");
   $nm_saida->saida("#lin1_col1 { padding-left:9px; padding-top:7px;  height:27px; overflow:hidden; text-align:left;}			 \r\n");
   $nm_saida->saida("#lin1_col2 { padding-right:9px; padding-top:7px; height:27px; text-align:right; overflow:hidden;   font-size:12px; font-weight:normal;}\r\n");
   $nm_saida->saida("</style>\r\n");
   $nm_saida->saida("<div style=\"width: 100%\">\r\n");
   $nm_saida->saida(" <div class=\"scGridHeader\" style=\"height:11px; display: block; border-width:0px; \"></div>\r\n");
   $nm_saida->saida(" <div style=\"height:37px; border-width:0px 0px 1px 0px;  border-style: dashed; border-color:#ddd; display: block\">\r\n");
   $nm_saida->saida(" 	<table style=\"width:100%; border-collapse:collapse; padding:0;\">\r\n");
   $nm_saida->saida("    	<tr>\r\n");
   $nm_saida->saida("        	<td id=\"lin1_col1\" class=\"scGridHeaderFont\"><span>" . $this->Ini->Nm_lang['lang_othr_detl_titl'] . " - purchases</span></td>\r\n");
   $nm_saida->saida("            <td id=\"lin1_col2\" class=\"scGridHeaderFont\"><span></span></td>\r\n");
   $nm_saida->saida("        </tr>\r\n");
   $nm_saida->saida("    </table>		 \r\n");
   $nm_saida->saida(" </div>\r\n");
   $nm_saida->saida("</div>\r\n");
   $nm_saida->saida("  </TD>\r\n");
   $nm_saida->saida(" </TR>\r\n");
   if ($_SESSION['sc_session'][$this->Ini->sc_page]['purchases_grid']['det_print'] != "print" && !$_SESSION['sc_session'][$this->Ini->sc_page]['purchases_grid']['pdf_det']) 
   { 
       $nm_saida->saida("   <tr><td class=\"scGridTabelaTd\">\r\n");
       $nm_saida->saida("    <table width=\"100%\"><tr>\r\n");
       $nm_saida->saida("     <td class=\"scGridToolbar\">\r\n");
       $nm_saida->saida("         </td> \r\n");
       $nm_saida->saida("          <td class=\"" . $this->css_scGridToolbarPadd . "\" nowrap valign=\"middle\" align=\"center\" width=\"33%\"> \r\n");
       if ($this->nmgp_botoes['det_pdf'] == "on")
       {
         $Cod_Btn = nmButtonOutput($this->arr_buttons, "bpdf", "", "", "Dpdf_top", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "thickbox", "" . $this->Ini->path_link . "purchases_grid/purchases_grid_config_pdf.php?nm_opc=pdf_det&nm_target=0&nm_cor=cor&papel=1&orientacao=1&largura=1200&conf_larg=S&conf_fonte=10&language=en_us&conf_socor=S&KeepThis=true&TB_iframe=true&modal=true", "", "only_text", "text_right", "", "");
         $nm_saida->saida("           $Cod_Btn \r\n");
       }
       if ($this->nmgp_botoes['det_print'] == "on")
       {
         $Cod_Btn = nmButtonOutput($this->arr_buttons, "bprint", "", "", "Dprint_top", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "thickbox", "" . $this->Ini->path_link . "purchases_grid/purchases_grid_config_print.php?nm_opc=detalhe&nm_cor=AM&language=en_us&KeepThis=true&TB_iframe=true&modal=true", "", "only_text", "text_right", "", "");
         $nm_saida->saida("           $Cod_Btn \r\n");
       }
       $Cod_Btn = nmButtonOutput($this->arr_buttons, "bvoltar", "document.F3.submit()", "document.F3.submit()", "sc_b_sai_top", "", "", "", "absmiddle", "", "0px", $this->Ini->path_botoes, "", "", "", "", "", "only_text", "text_right", "", "");
       $nm_saida->saida("           $Cod_Btn \r\n");
       $nm_saida->saida("         </td> \r\n");
       $nm_saida->saida("          <td class=\"" . $this->css_scGridToolbarPadd . "\" nowrap valign=\"middle\" align=\"right\" width=\"33%\"> \r\n");
       $nm_saida->saida("     </td>\r\n");
       $nm_saida->saida("    </tr></table>\r\n");
       $nm_saida->saida("   </td></tr>\r\n");
   } 
   $nm_saida->saida("<tr><td class=\"scGridTabelaTd\">\r\n");
   $nm_saida->saida("<TABLE style=\"padding: 0px; spacing: 0px; border-width: 0px;\"  align=\"center\" valign=\"top\" width=\"100%\">\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['vendorid'])) ? $this->New_label['vendorid'] : "Vendor ID"; 
          $conteudo = trim($this->vendorid); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['vendorname'])) ? $this->New_label['vendorname'] : "Vendor Name"; 
          $conteudo = trim($this->vendorname); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['sc_field_0'])) ? $this->New_label['sc_field_0'] : "Invoice"; 
          $conteudo = trim($this->sc_field_0); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['date'])) ? $this->New_label['date'] : "Date"; 
          $conteudo = trim($this->date); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['dropship'])) ? $this->New_label['dropship'] : "Drop Ship"; 
          $conteudo = trim($this->dropship); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['waitingonbill'])) ? $this->New_label['waitingonbill'] : "Waitingon Bill"; 
          $conteudo = trim($this->waitingonbill); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['dropshipcustomerid'])) ? $this->New_label['dropshipcustomerid'] : "Drop Ship Customer ID"; 
          $conteudo = trim($this->dropshipcustomerid); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['sc_field_1'])) ? $this->New_label['sc_field_1'] : "Shipto Invoice"; 
          $conteudo = trim($this->sc_field_1); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['shiptoname'])) ? $this->New_label['shiptoname'] : "Shipto Name"; 
          $conteudo = trim($this->shiptoname); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['sc_field_2'])) ? $this->New_label['sc_field_2'] : "Shipto Address Line One"; 
          $conteudo = trim($this->sc_field_2); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['sc_field_3'])) ? $this->New_label['sc_field_3'] : "Shipto Address Line Two"; 
          $conteudo = trim($this->sc_field_3); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['shiptocity'])) ? $this->New_label['shiptocity'] : "Shipto City"; 
          $conteudo = trim($this->shiptocity); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['shiptostate'])) ? $this->New_label['shiptostate'] : "Shipto State"; 
          $conteudo = trim($this->shiptostate); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['shiptozipcode'])) ? $this->New_label['shiptozipcode'] : "Shipto Zipcode"; 
          $conteudo = trim($this->shiptozipcode); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['shiptocountry'])) ? $this->New_label['shiptocountry'] : "Shipto Country"; 
          $conteudo = trim($this->shiptocountry); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['datedue'])) ? $this->New_label['datedue'] : "Date Due"; 
          $conteudo = trim($this->datedue); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['discountdate'])) ? $this->New_label['discountdate'] : "Discount Date"; 
          $conteudo = trim($this->discountdate); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['discountamount'])) ? $this->New_label['discountamount'] : "Discount Amount"; 
          $conteudo = trim($this->discountamount); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['accountspayableaccount'])) ? $this->New_label['accountspayableaccount'] : "Accounts Payable Account"; 
          $conteudo = trim($this->accountspayableaccount); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['accountspayableamount'])) ? $this->New_label['accountspayableamount'] : "Accounts Payable Amount"; 
          $conteudo = trim($this->accountspayableamount); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['shipvia'])) ? $this->New_label['shipvia'] : "Ship Via"; 
          $conteudo = trim($this->shipvia); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['ponote'])) ? $this->New_label['ponote'] : "PO Note"; 
          $conteudo = trim($this->ponote); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['noteprintsafterlineitems'])) ? $this->New_label['noteprintsafterlineitems'] : "Note Prints After Line Items"; 
          $conteudo = trim($this->noteprintsafterlineitems); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['beginningbalancetransaction'])) ? $this->New_label['beginningbalancetransaction'] : "Beginning Balance Transaction"; 
          $conteudo = trim($this->beginningbalancetransaction); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['dateclearedinbankrec'])) ? $this->New_label['dateclearedinbankrec'] : "Date Clearedin Bank Rec"; 
          $conteudo = trim($this->dateclearedinbankrec); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['appliedtopurchaseorder'])) ? $this->New_label['appliedtopurchaseorder'] : "Applied To Purchase Order"; 
          $conteudo = trim($this->appliedtopurchaseorder); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['numberofdistributions'])) ? $this->New_label['numberofdistributions'] : "Numberof Distributions"; 
          $conteudo = trim($this->numberofdistributions); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['ponumber'])) ? $this->New_label['ponumber'] : "PO Number"; 
          $conteudo = trim($this->ponumber); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['podistribution'])) ? $this->New_label['podistribution'] : "PO Distribution"; 
          $conteudo = trim($this->podistribution); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['quantity'])) ? $this->New_label['quantity'] : "Quantity"; 
          $conteudo = trim($this->quantity); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['itemid'])) ? $this->New_label['itemid'] : "Item ID"; 
          $conteudo = trim($this->itemid); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['description'])) ? $this->New_label['description'] : "Description"; 
          $conteudo = trim($this->description); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['sc_field_4'])) ? $this->New_label['sc_field_4'] : "G L Account"; 
          $conteudo = trim($this->sc_field_4); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['unitprice'])) ? $this->New_label['unitprice'] : "Unit Price"; 
          $conteudo = trim($this->unitprice); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['amount'])) ? $this->New_label['amount'] : "Amount"; 
          $conteudo = trim($this->amount); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['jobid'])) ? $this->New_label['jobid'] : "Job ID"; 
          $conteudo = trim($this->jobid); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['usedforreimbursableexpense'])) ? $this->New_label['usedforreimbursableexpense'] : "Usedfor Reimbursable Expense"; 
          $conteudo = trim($this->usedforreimbursableexpense); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['transactionperiod'])) ? $this->New_label['transactionperiod'] : "Transaction Period"; 
          $conteudo = trim($this->transactionperiod); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['transactionnumber'])) ? $this->New_label['transactionnumber'] : "Transaction Number"; 
          $conteudo = trim($this->transactionnumber); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldOddVert\"   ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("  <TR class=\"scGridLabel\">\r\n");
          $SC_Label = (isset($this->New_label['id2'])) ? $this->New_label['id2'] : "ID2"; 
          $conteudo = trim($this->id2); 
          if ($conteudo === "") 
          { 
              $conteudo = "&nbsp;" ; 
          } 
          else    
          { 
              nmgp_Form_Num_Val($conteudo, $_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']) ; 
          } 
   $nm_saida->saida("    <TD class=\"scGridLabelFont\"  ALIGN=\"left\" VALIGN=\"middle\">" . nl2br($SC_Label) . "</TD>\r\n");
   $nm_saida->saida("    <TD class=\"scGridFieldEvenVert\"  NOWRAP ALIGN=\"left\" VALIGN=\"top\">" . $conteudo . "</TD>\r\n");
   $nm_saida->saida("   \r\n");
   $nm_saida->saida("  </TR>\r\n");
   $nm_saida->saida("</TABLE>\r\n");
   if ($_SESSION['sc_session'][$this->Ini->sc_page]['purchases_grid']['det_print'] != "print" && !$_SESSION['sc_session'][$this->Ini->sc_page]['purchases_grid']['pdf_det']) 
   { 
       $nm_saida->saida("   <tr><td class=\"scGridTabelaTd\">\r\n");
       $nm_saida->saida("    <table width=\"100%\"><tr>\r\n");
       $nm_saida->saida("     <td class=\"scGridToolbar\">\r\n");
       $nm_saida->saida("         </td> \r\n");
       $nm_saida->saida("          <td class=\"" . $this->css_scGridToolbarPadd . "\" nowrap valign=\"middle\" align=\"center\" width=\"33%\"> \r\n");
       $nm_saida->saida("         </td> \r\n");
       $nm_saida->saida("          <td class=\"" . $this->css_scGridToolbarPadd . "\" nowrap valign=\"middle\" align=\"right\" width=\"33%\"> \r\n");
       $nm_saida->saida("     </td>\r\n");
       $nm_saida->saida("    </tr></table>\r\n");
       $nm_saida->saida("   </td></tr>\r\n");
   } 
   $rs->Close(); 
   $nm_saida->saida("  </td>\r\n");
   $nm_saida->saida(" </tr>\r\n");
   $nm_saida->saida(" </table>\r\n");
   $nm_saida->saida("  </td>\r\n");
   $nm_saida->saida(" </tr>\r\n");
   $nm_saida->saida(" </table>\r\n");
//--- 
//--- 
   $nm_saida->saida("<form name=\"F3\" method=post\r\n");
   $nm_saida->saida("                  target=\"_self\"\r\n");
   $nm_saida->saida("                  action=\"./\">\r\n");
   $nm_saida->saida("<input type=hidden name=\"nmgp_opcao\" value=\"igual\"/>\r\n");
   $nm_saida->saida("<input type=hidden name=\"script_case_init\" value=\"" . NM_encode_input($this->Ini->sc_page) . "\"/>\r\n");
   $nm_saida->saida("<input type=hidden name=\"script_case_session\" value=\"" . NM_encode_input(session_id()) . "\"/>\r\n");
   $nm_saida->saida("</form>\r\n");
   $nm_saida->saida("<script language=JavaScript>\r\n");
   $nm_saida->saida("   function nm_mostra_doc(campo1, campo2, campo3)\r\n");
   $nm_saida->saida("   {\r\n");
   $nm_saida->saida("       NovaJanela = window.open (\"purchases_grid_doc.php?script_case_init=" . NM_encode_input($this->Ini->sc_page) . "&script_case_session=" . session_id() . "&nm_cod_doc=\" + campo1 + \"&nm_nome_doc=\" + campo2 + \"&nm_cod_apl=\" + campo3, \"ScriptCase\", \"resizable\");\r\n");
   $nm_saida->saida("   }\r\n");
   $nm_saida->saida("   function nm_gp_move(x, y, z, p, g) \r\n");
   $nm_saida->saida("   {\r\n");
   $nm_saida->saida("      window.location = \"" . $this->Ini->path_link . "purchases_grid/index.php?nmgp_opcao=pdf_det&nmgp_tipo_pdf=\" + z + \"&nmgp_parms_pdf=\" + p +  \"&nmgp_graf_pdf=\" + g + \"&script_case_init=" . NM_encode_input($this->Ini->sc_page) . "&script_case_session=" . session_id() . "\";\r\n");
   $nm_saida->saida("   }\r\n");
   $nm_saida->saida("   function nm_gp_print_conf(tp, cor)\r\n");
   $nm_saida->saida("   {\r\n");
   $nm_saida->saida("       window.open('" . $this->Ini->path_link . "purchases_grid/purchases_grid_iframe_prt.php?path_botoes=" . $this->Ini->path_botoes . "&script_case_init=" . NM_encode_input($this->Ini->sc_page) . "&script_case_session=" . session_id() . "&opcao=det_print&cor_print=' + cor,'','location=no,menubar,resizable,scrollbars,status=no,toolbar');\r\n");
   $nm_saida->saida("   }\r\n");
   $nm_saida->saida("</script>\r\n");
   $nm_saida->saida("</body>\r\n");
   $nm_saida->saida("</html>\r\n");
 }
   function nm_gera_mask(&$nm_campo, $nm_mask)
   { 
      $trab_campo = $nm_campo;
      $trab_mask  = $nm_mask;
      $tam_campo  = strlen($nm_campo);
      $trab_saida = "";
      $mask_num = false;
      for ($x=0; $x < strlen($trab_mask); $x++)
      {
          if (substr($trab_mask, $x, 1) == "#")
          {
              $mask_num = true;
              break;
          }
      }
      if ($mask_num )
      {
          $ver_duas = explode(";", $trab_mask);
          if (isset($ver_duas[1]) && !empty($ver_duas[1]))
          {
              $cont1 = count(explode("#", $ver_duas[0])) - 1;
              $cont2 = count(explode("#", $ver_duas[1])) - 1;
              if ($cont2 >= $tam_campo)
              {
                  $trab_mask = $ver_duas[1];
              }
              else
              {
                  $trab_mask = $ver_duas[0];
              }
          }
          $tam_mask = strlen($trab_mask);
          $xdados = 0;
          for ($x=0; $x < $tam_mask; $x++)
          {
              if (substr($trab_mask, $x, 1) == "#" && $xdados < $tam_campo)
              {
                  $trab_saida .= substr($trab_campo, $xdados, 1);
                  $xdados++;
              }
              elseif ($xdados < $tam_campo)
              {
                  $trab_saida .= substr($trab_mask, $x, 1);
              }
          }
          if ($xdados < $tam_campo)
          {
              $trab_saida .= substr($trab_campo, $xdados);
          }
          $nm_campo = $trab_saida;
          return;
      }
      for ($ix = strlen($trab_mask); $ix > 0; $ix--)
      {
           $char_mask = substr($trab_mask, $ix - 1, 1);
           if ($char_mask != "x" && $char_mask != "z")
           {
               $trab_saida = $char_mask . $trab_saida;
           }
           else
           {
               if ($tam_campo != 0)
               {
                   $trab_saida = substr($trab_campo, $tam_campo - 1, 1) . $trab_saida;
                   $tam_campo--;
               }
               else
               {
                   $trab_saida = "0" . $trab_saida;
               }
           }
      }
      if ($tam_campo != 0)
      {
          $trab_saida = substr($trab_campo, 0, $tam_campo) . $trab_saida;
          $trab_mask  = str_repeat("z", $tam_campo) . $trab_mask;
      }
   
      $iz = 0; 
      for ($ix = 0; $ix < strlen($trab_mask); $ix++)
      {
           $char_mask = substr($trab_mask, $ix, 1);
           if ($char_mask != "x" && $char_mask != "z")
           {
               if ($char_mask == "." || $char_mask == ",")
               {
                   $trab_saida = substr($trab_saida, 0, $iz) . substr($trab_saida, $iz + 1);
               }
               else
               {
                   $iz++;
               }
           }
           elseif ($char_mask == "x" || substr($trab_saida, $iz, 1) != "0")
           {
               $ix = strlen($trab_mask) + 1;
           }
           else
           {
               $trab_saida = substr($trab_saida, 0, $iz) . substr($trab_saida, $iz + 1);
           }
      }
      $nm_campo = $trab_saida;
   } 
   function 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;
   }
}
