<?php
    Getsecurity("production_order_request");

    $objAxpDB->ViewName("Daftar Production Order Request");
    $objAxpDB->ViewTable("vPRPORequest");
    $objAxpDB->ViewCaption("ID, No. POR, No. Reff, Tanggal, Tanggal Selesai, Catatan, Status");
    $objAxpDB->ViewPeriod(TRUE);

    $objAxpDB->FormName("Production Order Request");
    $objAxpDB->FormSQL("SELECT  ftpor_no,fntype, ftmpor_no,fdtrans_date, fdfinished_date, ftnotes, fnstatus FROM txproduction_order_request_hdr");
    $objAxpDB->FormCaption("No. POR, Tipe POR, No Reff, Tanggal, Tanggal Selesai,Catatan, Status");
    $objAxpDB->FormPosition(" TL,TL,TL,TR,TR,BL, BR");
    $objAxpDB->SetStatus("id, fnstatus");

    $objAxpDB->GridSQL(0, "SELECT fnindex, ftitem_code, ftstock_group_code,ftstock_group_name,ffqty from txproduction_order_request_det");
    $objAxpDB->GridCaption(0, "No, Kode Barang, Kode Group, Nama Group, Qty");

    $objAxpDB->Lookup("fntype", "SELECT fntrans_status_code, fttrans_status_name FROM tstransaction_status WHERE fntrans_group_code = 51", "fntrans_status_code", "fttrans_status_name", 1,true);
    $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("ftitem_code", "SELECT ftitem_code, ftitem_name FROM tlstock_hdr ORDER BY ftitem_code", "ftitem_code", "ftitem_name", -1, False);


    if ($objAxpDB->GetStatus("id") == "") {
            $objAxpDB->ButtonShow(" cetak_daftar, export_excel ,tutup");
    }
    elseif ($objAxpDB->GetStatus("fnstatus") == 1) {
         $objAxpDB->ButtonShow("cetak,tutup");
         $objAxpDB->FormLocked("1,1,1,1,1,1,1");
         $objAxpDB->GridLocked(0, "1,1,1,1,1");
         $objAxpDB->GridHidden(0, "0,0,1,1,0");
    }
    $objAxpDB->Process();
    $objAxpDB->WriteHtmlTable();

?>
