<?php

    Getsecurity("pembelian_purchase_invoice_local");

       if($_REQUEST['ajax']) {
            switch($_REQUEST['code']) {
                case "transno":
                  if(RetRstField("SELECT fnid FROM txpurchase_invoice_hdr WHERE ftpurchase_invoice_no='{$_REQUEST['fttrans_no']}'")) {
                      ?>

                      alert('No. transaksi sudah dipakai...\n System akan mengenerate No. transaksi kembali ...\n Silahkan ulangi proses penyimpanan...  ');
                      OnChangeDate_fdtrans_date();
                <?php
                  }
                  else {
                      ?>
                      submitbutton('Simpan','','','','');

                    <?php
                  }
                   die("");
                   break;
             case "tgl":
                $ssql="select date_add('".CDate($_REQUEST['tgl'])."',INTERVAL ".intval($_REQUEST['ftterm_payment'])." DAY)";
                $date=RetRstField($ssql);
                ?>
                     document.getElementById('fddue_date').value='<?php echo CDateRev($date); ?>';
                <?php
            break;
             case "tgltempo":
                $ssql="select date_add('".CDate($_REQUEST['fdtrans_date'])."',INTERVAL ".intval($_REQUEST['ftterm_payment'])." DAY)";
                $date=RetRstField($ssql);
                ?>
                     document.getElementById('<?php echo $_REQUEST["fddue_date"]; ?>').value='<?php echo CDateRev($date); ?>';
                <?php
            break;
            case "idr":
                $ssql="SELECT fcrate FROM tlcurrency_hdr WHERE ftsimbol='{$_REQUEST["ftcurrency_code"]}'";
                $mysql=mysql_query($ssql) or die ($ssql);
                $r=mysql_fetch_assoc($mysql);
                ?>
                  document.getElementById('fcrate').value='<?php echo number_format($r["fcrate"], 2); ?>';
                  ElementCurrencyALL();
                <?php
            break;
            }
       }

    $objAxpDB->LookupMagicQuotes(True);

    $objAxpDB->ViewName("Daftar Purchase Invoice Local");
    //$objAxpDB->ViewTable("vPUPurchaseInvoiceLocal");
    $objAxpDB->ViewSQL("select a.fnid,a.fdtrans_date, a.ftpurchase_invoice_no,a.ftstock_in_no, a.ftsupplier_code,
                        b.ftsupplier_name,d.fttrans_status_name as ftshipment_status,
                         c.fttrans_status_name as ftstatus
                        from txpurchase_invoice_hdr a
                        left join tlsupplier b on a.ftsupplier_code = b.ftsupplier_code
                        left join tstransaction_status c on a.fnstatus = c.fntrans_status_code and c.fntrans_group_code = 2
                        left join tstransaction_status d on a.fnpayment_status = d.fntrans_status_code and d.fntrans_group_code = 1
                        where a.fnpo_type=0
                        AND (('{$_SESSION['strbranch']}' <> 'PUSAT' AND a.ftbranch_code = '{$_SESSION['strbranch']}') OR '{$_SESSION['strbranch']}' = 'PUSAT')
                        order by a.fdtrans_date desc, a.ftpurchase_invoice_no desc");
    $objAxpDB->ViewCaption("ID, Tgl. PI, No. PI, No. Stock Masuk, Kode Supplier, Nama Supplier,  Status Pembayaran, Status");
    $objAxpDB->ViewPeriod(TRUE);

    if(!$_REQUEST['id']) {
            $strAutoNumber1="ajax_do('query2.php?code=2&ftmodule_code=tn113&thbln=' + document.getElementById(\"fdtrans_date\").value + '&field_name=ftpurchase_invoice_no&no_trans=ftpurchase_invoice_no&table_name=txpurchase_invoice_hdr&ftbranch_code={$_SESSION['strbranch']}');";
            $ajaxTransDate="ajax_do('pembelian.php?form=".$_REQUEST['form']."&mode=".$_REQUEST['mode']."&id=0&ajax=1&code=tgl&tgl=' + document.getElementById(\"fdtrans_date\").value + '&ftterm_payment='+ document.getElementById(\"ftterm_payment\").value);";
            $strAutoNumber0=" function OnChangeDate_fdtrans_date() {
                                           {$strAutoNumber1}
                                           {$ajaxTransDate}
                                     }
                                     OnChangeDate_fdtrans_date();
                                       // var i=document.getElementsByName('fnindexD0[]').length;

                                 document.getElementById(\"fnpo_type\").value='0';
                                 document.getElementById('ftcurrency_code').value='IDR';
                                 {$ajaxKurs}
                                ";

            $objAxpDB->FormJS($strAutoNumber0);
    } else {
            $objAxpDB->FormJS("ElementCurrencyALL();");
    }

    // Deklarasi Header & Footer
    $objAxpDB->FormName("Purchase Invoice Local");
    $objAxpDB->FormSQL("SELECT  ftpurchase_invoice_no, ftsupplier_code,ftstock_in_no,ftpo_no,
                                    fdtrans_date,ftterm_payment, fddue_date,
                                    ftcurrency_code,fcrate,fnpayment_status, fntax_code, ftnotes,
                                    fcsub_amount,ffdiscount,fcdiscount,
                                    fcother_cost,ffvat,fcvat,
                                    fcamount,fnstatus,
                                    '0' AS fnpo_type,
                                    ftexpedition_code,fcexpedition_cost,fnexpedition_auto_inv,
                                    fcreturn_amount,fcpayment_amount,fcoutstanding_amount                               
                            FROM txpurchase_invoice_hdr");
    $objAxpDB->FormCaption("No. PI, Supplier, No. Terima,No. PO,
                                Tgl. PI, Syarat Pembayaran, Tgl. Jatuh Tempo, Mata Uang, Kurs, Status Pembayaran,Kode Pajak, Catatan,
                                Sub Total, Disc (%), Disc,Biaya Lain-Lain,Pajak (%), Pajak,Grand Total, Status,
                                Type PO, No Perkiraan Ekspedisi, Biaya Ekspedisi, Invoice Ekspedisi, Total Retur, Total Pembayaran, Sisa Pembayaran");
    $objAxpDB->FormPosition("TL,TL, TL, HD,TR, TR, TR, TR, TR,  TR, TR, BL,BR, BR, BR, BR, BR,BR, BR, BR,HD,BL,BL,HD,BL,BL,BL");
    $objAxpDB->FormLayout(5,"&nbsp;Hari");

    // Deklarasi Detail
    $objAxpDB->GridSQL(0, "SELECT fnindex, ftitem_code,fnqty,ftuom_code,ftwarehouse_code,ftlocation_code, fcprice, ffdiscount, fcdiscount, fcamount, fcprice_cogs, fnvat, fnqty_base, ffformula, fnqty_return FROM txpurchase_invoice_det");
    $objAxpDB->GridCaption(0, "No., Kode Barang, Qty, Satuan,Gudang, Lokasi, Harga, Discount(%),Discount,Jumlah, Harga Modal, Include Pajak, Qty Base, Formula, Qty Retur");
    $objAxpDB->GridHidden(0,"0,0,0,0,1,1,0,0,0,0,0,1,1,1,0");
    $objAxpDB->GridAutoAdd(0, False);

    if(!$_REQUEST['id']) {
      $ssql_ftstock_in_no= "SELECT ftstock_in_no, fdtrans_date, ftstock_in_company FROM ( SELECT ftstock_in_no, fdtrans_date, ftstock_in_company FROM ( SELECT a.ftstock_in_no, a.fdtrans_date, a.ftstock_in_company, a.fnstatus FROM txstock_in_hdr a INNER JOIN txpurchase_order_hdr b ON a.ftdocument_no=b.ftpo_no WHERE a.fnstatus=1 AND b.fnpo_type=0 AND a.ftcategory_code=0 AND (SELECT COUNT(c.fnid) FROM txpurchase_invoice_hdr c WHERE c.ftstock_in_no=a.ftstock_in_no AND c.fnstatus<>9) = 0 UNION ALL SELECT a.ftstock_in_no, a.fdtrans_date, a.ftstock_in_company, a.fnstatus FROM txstock_in_hdr a WHERE a.fnstatus=1 AND a.ftcategory_code=6 AND (SELECT COUNT(b.fnid) FROM txpurchase_invoice_hdr b WHERE b.ftstock_in_no=a.ftstock_in_no AND b.fnstatus<>9) = 0 UNION ALL SELECT ftpo_no AS ftstock_in_no, fdtrans_date, ftsupplier_code AS ftstock_in_company, fnstatus FROM txpurchase_order_hdr a WHERE fnhdr_category=2 AND fnstatus=1 AND (SELECT COUNT(b.fnid) FROM txpurchase_invoice_hdr b WHERE b.ftpo_no=a.ftpo_no AND b.fnstatus<>9) = 0 ) z ORDER BY ftstock_in_no) a WHERE 1=1";
    }else{
      $ssql_ftstock_in_no="SELECT ftstock_in_no, fdtrans_date, ftstock_in_company FROM (SELECT a.ftstock_in_no, a.fdtrans_date, a.ftstock_in_company FROM txstock_in_hdr a INNER JOIN txpurchase_order_hdr b ON a.ftdocument_no=b.ftpo_no WHERE a.fnstatus=1 AND b.fnpo_type=0 UNION ALL SELECT ftstock_in_no, fdtrans_date, ftstock_in_company FROM txstock_in_hdr WHERE fnstatus=1 AND ftcategory_code=6 UNION ALL SELECT ftpo_no AS ftstock_in_no, fdtrans_date, ftsupplier_code AS ftstock_in_company FROM txpurchase_order_hdr WHERE fnhdr_category=2) z WHERE 1=1";
    }

    $objAxpDB->Lookup("ftsupplier_code", "SELECT ftsupplier_code, ftsupplier_name FROM tlsupplier WHERE fnsupplier_type IN (0, 2) ORDER BY ftsupplier_Code", "ftsupplier_Code", "ftsupplier_name", -1, False);
    $objAxpDB->Lookup("ftstock_in_no", $ssql_ftstock_in_no, "ftstock_in_no", "fdtrans_date", -1, False, "' AND ftstock_in_company=\''+ document.getElementById('ftsupplier_code').value + '\''");
    $objAxpDB->Lookup("fnstatus", "SELECT fntrans_status_code, fttrans_status_name FROM tstransaction_status WHERE fntrans_group_code = 2", "fntrans_status_code", "fttrans_status_name",1, True);
    $objAxpDB->Lookup("fnpayment_status", "SELECT fntrans_status_code, fttrans_status_name FROM tstransaction_status WHERE fntrans_group_code = 1", "fntrans_status_code", "fttrans_status_name", 1, True);
    $objAxpDB->Lookup("fntax_code", "SELECT fntrans_status_code, fttrans_status_name FROM tstransaction_status WHERE fntrans_group_code = 15", "fntrans_status_code", "fttrans_status_name", 0,true);
    $objAxpDB->Lookup("ftexpedition_code", "SELECT a.ftcoa_code, a.ftcoa_name FROM tlcoa a WHERE  RIGHT(a.ftcoa_code, 5) <> '.0000'", "ftcoa_code", "ftcoa_name", -1,false);
    $objAxpDB->Lookup("fnexpedition_auto_inv", "SELECT '0' AS A,'No' AS B UNION ALL SELECT '1' AS A,'Yes' AS B ", "A", "B", 0,true);
    $objAxpDB->LookupGrid(0,"fnvat", "SELECT '1' AS A,'TRUE' AS B UNION ALL SELECT '0' AS A,'FALSE' AS B ", "A", "B", 0,true);

    $ssql_ftitem_code="SELECT a.ftitem_code, a.ftitem_name FROM (
                            SELECT ftitem_code, ftitem_name FROM tlstock_hdr
                            UNION ALL
                            SELECT ftitem_code, ftitem_name FROM tlstock_hdr_bahan_baku
                            UNION ALL
                            SELECT ftitem_code, ftitem_name FROM tlstock_hdr_setengah_jadi
                            UNION ALL
                            SELECT ftitem_code, ftitem_name FROM tlstock_hdr_sparepart
                            ) a
                            ORDER BY a.ftitem_code";
    $objAxpDB->Lookup("ftitem_code", $ssql_ftitem_code, "ftitem_code", "ftitem_name", -1, False);
    $objAxpDB->Lookup("ftcurrency_code", "SELECT  ftsimbol, ftdescription  FROM tlcurrency_hdr ORDER BY ftsimbol", "ftsimbol", "ftdescription", 0, True);

    //$ajaxSupplier="ajax_do('pembelian.php?form=".$_REQUEST['form']."&mode=".$_REQUEST['mode']."&id=0&ajax=1&code=supplier');";
    $ajaxClear="document.getElementById('ftstock_in_no').value='';document.getElementById('span_ftstock_in_no').innerHTML='';document.getElementById('hidden_ftstock_in_no').value='';";
    $ajaxGrid="ajax_do('pembelian.php?form=".$_REQUEST['form']."&mode=".$_REQUEST['mode']."&id=0&ajax=1&code=grid&ftstock_in_no=' + document.getElementById('ftstock_in_no').value + '&fdtrans_date=' + document.getElementById('fdtrans_date').value);";
    $objAxpDB->FormScript(1, "onChange=\"{$ajaxClear}{$ajaxGrid}\"");
    $objAxpDB->FormScript(2, "onChange=\"{$ajaxGrid}\"");

    $ajax_due="ajax_do('pembelian.php?form=".$_REQUEST['form']."&mode=".$_REQUEST['mode']."&id=0&code=tgltempo&ajax=1&fdtrans_date=' + document.getElementById('fdtrans_date').value + '&ftterm_payment=' + document.getElementById('ftterm_payment').value + '&fddue_date=fddue_date');";
    $objAxpDB->FormScript(5, "onChange=\"{$ajax_due}\"");

    $ajaxKurs="ajax_do('pembelian.php?form=".$_REQUEST['form']."&mode=".$_REQUEST['mode']."&id=0&ajax=1&code=idr&ftcurrency_code='+ document.getElementById('ftcurrency_code').value);";
    $objAxpDB->FormScript(7, "OnChange=\"{$ajaxKurs}\"");

    $objAxpDB->FormScript(13, "onChange=\"PurchaseInvoiceLocalRecalDiscPercent();\"");
    $objAxpDB->FormScript(14, "onChange=\"PurchaseInvoiceLocalRecalDiscRp();\"");
    $objAxpDB->FormScript(15, "onChange=\"PurchaseInvoiceLocalRecalQty0();\"");
    $objAxpDB->FormScript(16, "onChange=\"PurchaseInvoiceLocalRecalQty0();\"");
    $objAxpDB->FormScript(22, "onChange=\"PurchaseInvoiceLocalRecalQty0();\"");
    
    $ajax1=" onChange=\"PurchaseInvoiceLocalRecalPrice();\"  ";
    $ajaxItem="ajax_do('pembelian.php?form=".$_REQUEST['form']."&mode=".$_REQUEST['mode']."&id=0&ajax=1&code=item&ftitem_code=' + this.value + '&index=_N_');";
    $objAxpDB->GridScript(0,1," onChange=\"{$ajaxItem}\"");

    $ajax1=" onChange=\"PurchaseInvoiceLocalRecalPrice();\"  ";
    $objAxpDB->GridScript(0,2, $ajax1);

    $objAxpDB->GridScript(0,6, $ajax1);
    $ajax1=" onChange=\"PurchaseInvoiceLocalRecalDiscDetailPercent(_N_);\"   ";
    $objAxpDB->GridScript(0,7, $ajax1);

    $ajax1="   onChange=\"PurchaseInvoiceLocalRecalDiscDetailRp(_N_);\"  ";
    $objAxpDB->GridScript(0,8, $ajax1);
   
    $objAxpDB->SetStatus("id, fnreceipt_status, fnstatus");

    if ($objAxpDB->GetStatus("id") == "") {
            $objAxpDB->ButtonShow("baru,  cetak_daftar, export_excel ,tutup");
    } elseif ($objAxpDB->GetStatus("id") == 0) {
            $objAxpDB->ButtonShow("reset, simpan, tutup");
            $objAxpDB->FormLocked("0, 0, 0, 0,
                                   0, 0, 0, 1, 0, 1,1,
                                   0,
                                    1,0,0,0,0,1,1,1,1,0,0,0,1,1,1");
            $objAxpDB->GridLocked(0, "1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1");

    } elseif ($objAxpDB->GetStatus("fnstatus") == 1) {
            $objAxpDB->ButtonShow("baru, cetak, batal, tutup");

            $objAxpDB->FormLocked("1, 1, 1,1,
                                   1, 1,1, 1, 1, 1,1,1,
                                   1,
                                    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1");
            $objAxpDB->GridLocked(0, "1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1");
    } elseif ($objAxpDB->GetStatus("fnstatus") == 9) {
            $objAxpDB->ButtonShow("baru, tutup");
            $objAxpDB->FormLocked("1, 1, 1,1,
                                   1, 1, 1,1, 1, 1,1,1,
                                   1,
                                    1,1,1,1,1,1,1,1,1,1,1,1,1,1,1");
            $objAxpDB->GridLocked(0, "1, 1, 1, 1,1,1,1,1,1,1,1,1,1,1");
    }


     if($_REQUEST['ajax']) {
           switch($_REQUEST['code']) {
             case "grid":
               ob_start();
               $ftstock_in_no=$_REQUEST['ftstock_in_no'];
               $ssql="SELECT fnid, ftdocument_no, ftstock_in_company, ftcategory_code FROM txstock_in_hdr WHERE ftstock_in_no='{$ftstock_in_no}'";
               $rs=mysql_query($ssql) or die($ssql);
               $r=mysql_fetch_assoc($rs);
               if(isset($r["fnid"])):
                   $ftpo_no=$r["ftdocument_no"];
                   $ftsupplier_code=$r["ftstock_in_company"];
                   $ftcategory_code=$r["ftcategory_code"];

                   if($ftcategory_code == 6){
                     $ssql="SELECT ftdocument_no FROM txstock_out_hdr WHERE ftstock_out_no='{$ftpo_no}' UNION ALL ";
                     $ssql.="SELECT ftdocument_no FROM txstock_out_hdr_bahan_baku WHERE ftstock_out_no='{$ftpo_no}' UNION ALL ";
                     $ssql.="SELECT ftdocument_no FROM txstock_out_hdr_setengah_jadi WHERE ftstock_out_no='{$ftpo_no}' UNION ALL ";
                     $ssql.="SELECT ftdocument_no FROM txstock_out_hdr_sparepart WHERE ftstock_out_no='{$ftpo_no}'";
                     $ssql="SELECT ftdocument_no FROM ({$ssql}) txstock";
                     $rs=mysql_query($ssql) or die($ssql);
                     $r=mysql_fetch_assoc($rs);
                     $ftpo_no=$r["ftdocument_no"];
                     //$m=" AND (SELECT COUNT(*) FROM txstock_out_det b WHERE b.ftitem_code=a.ftitem_code AND b.ftstock_out_no='{$ftpo_no}') > 0";
                     /*$ssql_grid="SELECT a.fnindex, a.ftitem_code,a.fnqty - ifnull(a.fnqty_accept,0) as fnqty, a.ftuom_code,'' as ftwarehouse_code,'' as ftlocation_code, a.fcprice, a.ffdiscount, a.fcdiscount, a.fcamount, a.fnvat FROM
                                txpurchase_order_det a WHERE a.ftpo_no='{$ftpo_no}'{$m} #";*/
                     $ssql_grid="SELECT a.fnindex, a.ftitem_code, a.fnqty, a.ftuom_code, a.ftwarehouse_code,a.ftlocation_code, b.fcprice, b.ffdiscount, (a.fnqty * b.fcprice * b.ffdiscount) / 100 AS fcdiscount, ((a.fnqty * b.fcprice) - (a.fnqty * b.fcprice * b.ffdiscount) / 100) AS fcamount, b.fcprice as fcprice_cogs, b.fnvat, a.fnqty_base, a.ffformula,'0.00' as fnqty_return FROM
                                txstock_in_det a INNER JOIN txpurchase_order_det b ON a.ftitem_code=b.ftitem_code AND b.ftpo_no='{$ftpo_no}' WHERE ftstock_in_no='{$ftstock_in_no}'{$m} #";
                   }else{
                     //$m=" AND (SELECT COUNT(*) FROM txstock_in_det b WHERE b.ftitem_code=a.ftitem_code AND b.ftstock_in_no='{$ftstock_in_no}') > 0";
                     $ssql_grid="SELECT a.fnindex, a.ftitem_code, a.fnqty, a.ftuom_code, a.ftwarehouse_code,a.ftlocation_code, b.fcprice, b.ffdiscount, (a.fnqty * b.fcprice * b.ffdiscount) / 100 AS fcdiscount, ((a.fnqty * b.fcprice) - (a.fnqty * b.fcprice * b.ffdiscount) / 100) AS fcamount, b.fcprice as fcprice_cogs, b.fnvat, a.fnqty_base, a.ffformula,'0.00' as fnqty_return FROM
                                txstock_in_det a INNER JOIN txpurchase_order_det b ON a.ftitem_code=b.ftitem_code AND b.ftpo_no='{$ftpo_no}' WHERE ftstock_in_no='{$ftstock_in_no}'{$m} #";
                   }
               else:
                  $ftpo_no=$_REQUEST['ftstock_in_no'];
                  $ssql_grid="SELECT a.fnindex, a.ftitem_code,a.fnqty - ifnull(a.fnqty_accept,0) as fnqty, a.ftuom_code,'' as ftwarehouse_code,'' as ftlocation_code, a.fcprice, a.ffdiscount, a.fcdiscount, a.fcamount, a.fcprice as fcprice_cogs, a.fnvat, a.fnqty_base, a.ffformula,'0.00' as fnqty_return
                                FROM txpurchase_order_det a WHERE a.ftpo_no='{$ftpo_no}'{$m} #";
               endif;

               $objAxpDB->GridSQL(0, $ssql_grid);
               $objAxpDB->Process();
               $objAxpDB->setGrid2(0);
               $html = ob_get_contents();
               ob_end_clean();
               ?>

                    div = document.getElementById('txtHint0');
                    var m='<?php echo js_esc($html); ?>';
                    m= m.replace(/^\s*|\s*$/g,"");

                    div.innerHTML =m;
                    RowIndex0();
                    reSize();
                <?php
                      $ftsupplier_name=RetRstField("SELECT ftsupplier_name FROM tlsupplier  WHERE ftsupplier_code='{$ftsupplier_code}'");
//                    $ftpo_no=RetRstField("SELECT ftdocument_no FROM txstock_in_hdr_bahan_baku  WHERE ftstock_in_no='{$_REQUEST['ftstock_in_no']}'");
                      $ssql="SELECT ffvat,ffdiscount,fcother_cost,fntax_code,ftterm_payment,ftcurrency_code,fcrate FROM txpurchase_order_hdr WHERE ftpo_no='{$ftpo_no}'";
                      $rs=mysql_query($ssql) or die($ssql);
                      $r=mysql_fetch_assoc($rs);
                 ?>
                    document.getElementById('ftpo_no').value='<?php echo $ftpo_no; ?>';
                    //document.getElementById('hidden_ftsupplier_code').value='<?php echo $ftsupplier_name; ?>';
                    //document.getElementById('span_ftsupplier_code').innerHTML='<?php echo $ftsupplier_name; ?>';
                    document.getElementById('ftterm_payment').value='<?php echo $r['ftterm_payment']; ?>';
                    document.getElementById('fcrate').value='<?php echo $r['fcrate']; ?>';
                    document.getElementById('ffvat').value='<?php echo $r['ffvat']; ?>';
                    document.getElementById('ffdiscount').value='<?php echo $r['ffdiscount']; ?>';
                    document.getElementById('fcother_cost').value='<?php echo$r['fcother_cost']; ?>';
                <?
                  $ssql="select date_add('".CDate($_REQUEST['fdtrans_date'])."',INTERVAL ".intval($r['ftterm_payment'])." DAY)";
                  $date=RetRstField($ssql);
                ?>
                     document.getElementById('fddue_date').value='<?php echo CDateRev($date); ?>';

                    var len1 = document.getElementById('ftcurrency_code').length;
                    for (var idx1=0; idx1 < len1; idx1++)
                    {
                        if (document.getElementById('ftcurrency_code').options[idx1].value=='<?php echo $r['ftcurrency_code']; ?>') {
                            document.getElementById('ftcurrency_code').selectedIndex=idx1;
                            break;
                        }
                    }

                     var len2 = document.getElementById('fntax_code').length;
                    for (var idx2=0; idx2 < len2; idx2++)
                    {
                        if (document.getElementById('fntax_code').options[idx2].value=='<?php echo $r['fntax_code']; ?>') {
                            document.getElementById('fntax_code').selectedIndex=idx2;
                            break;
                        }
                    }

                    ElementCurrencyALL();
                    PurchaseInvoiceLocalRecalPrice();
                     
                <?php

               break;

           }
           die("");
           exit;
    }

    $objAxpDB->Process();
    $objAxpDB->WriteHtmlTable();