<?php

    Getsecurity('jurnal_system');

    $objAxpDB->ViewName("Daftar Jurnal System");
    $objAxpDB->ViewSQL("SELECT b.fnid, b.ftjournal_no, b.ftdocument_no, b.fdtrans_date, b.fcdebit AS fcamount, c.fttrans_status_name FROM txgeneral_journal_hdr b LEFT JOIN tstransaction_status c ON b.fnStatus = c.fnTrans_Status_Code AND c.fnTrans_Group_Code = 2  WHERE fntype = 0 GROUP BY b.ftJournal_No ORDER BY b.fdTrans_Date DESC, b.ftjournal_no DESC");
    $objAxpDB->ViewCaption("ID, No. Jurnal, No. Bukti, Tgl. Jurnal, Jml. Total, Status");
    $objAxpDB->ViewPeriod(TRUE);
    
    $objAxpDB->FormName("Jurnal System");
    $objAxpDB->FormSQL("SELECT ftjournal_no, fdtrans_date, ftdocument_no, fnstatus, fcdebit, fccredit, fntype, ftsource FROM txgeneral_journal_hdr");
    $objAxpDB->FormCaption("No. Jurnal, Tgl. Jurnal, No. Bukti, Status, Total Debit, Total Kredit, Tipe Jurnal, Sumber Jurnal");
    $objAxpDB->FormPosition("TL, TL, TR, TR, BR, BR, HD, HD");
    
    $objAxpDB->GridSQL(0, "SELECT fnindex, ftcoa_code, ftdescription, fcdebit, fccredit FROM txgeneral_journal_det");
    $objAxpDB->GridCaption(0, "No, No. Perkiraan, Keterangan, Debit, Kredit");
    
    $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("ftcoa_code", "SELECT ftCOA_Code, ftCOA_Name FROM tlcoa WHERE fnstatus=1 AND RIGHT(ftcoa_code,4) != '0000' ", "ftCOA_Code", "ftCOA_Name", -1, False);

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

            $objAxpDB->GridAllowAddNew(0, TRUE);
            $objAxpDB->GridAllowDelete(0, TRUE);
    } else {
            $objAxpDB->ButtonShow("cetak, tutup");
            $objAxpDB->FormLocked("1, 1, 1, 1, 1, 1, 1");
            $objAxpDB->GridLocked(0, "1, 1, 1, 1, 1");
    }
    
    $objAxpDB->Process();
    $objAxpDB->WriteHtmlTable();

?>

