<?php
    $objAxpDB->ViewName("Daftar laporan keuangan");
    $objAxpDB->ViewSQL("SELECT fnid, ftreport_code, ftreport_name FROM tlreport WHERE ftreport_group = 'keuangan' order by ftreport_code");
    $objAxpDB->ViewCaption("ID,ftreport_code,  Nama laporan");

    $objAxpDB->FormName(" laporan keuangan");
    $objAxpDB->FormSQL("SELECT ftreport_name FROM tlreport");
    $objAxpDB->FormCaption("Nama laporan");
    $objAxpDB->FormPosition("TL");
    $objAxpDB->lengt_object=false;
    
    if($_REQUEST['id']) {
        $ssql="select * from tlreport where fnid='{$_REQUEST['id']}'";
        $rs=mysql_query($ssql);
        $r=mysql_fetch_assoc($rs);
        $code=$r['ftreport_code'];
        $report_name=" :: ".$r['ftreport_name'];
        switch ($code) {
            case "f05": //date_from,date_end
                $objAxpDB->Lookup("ftcoa_code", "SELECT 'SELURUH' as ftcoa_code, 'SELURUH' AS ftcoa_name UNION ALL  SELECT ftcoa_code, ftcoa_name FROM tlcoa WHERE fnstatus = 1 AND  ftcoa_subgroup_code=15 AND RIGHT(ftcoa_code, 5) <> '.0000' ", "ftcoa_code", "ftcoa_name", -1,false);
                
                $objAxpDB->FormSQL("SELECT
                                        DATE_ADD(DATE_ADD(LAST_DAY(NOW()),INTERVAL 1 DAY),INTERVAL -1 MONTH) AS date_from,
                                        LAST_DAY(NOW()) AS date_end, 
                                        '' as ftcoa_code
                                        FROM tlreport");
                $objAxpDB->FormCaption("Date From,Date End,No Perkiraan");
                $objAxpDB->FormPosition("TL,TL,TL");
                break;
            case "f06": //date_from,date_end
                $objAxpDB->Lookup("ftcoa_code", "SELECT 'SELURUH' as ftcoa_code, 'SELURUH' AS ftcoa_name UNION ALL  SELECT ftcoa_code, ftcoa_name FROM tlcoa WHERE fnstatus = 1 AND  ftcoa_subgroup_code=16 AND RIGHT(ftcoa_code, 5) <> '.0000' ", "ftcoa_code", "ftcoa_name", -1,false);
                
                $objAxpDB->FormSQL("SELECT DATE_ADD(DATE_ADD(LAST_DAY(NOW()),INTERVAL 1 DAY),INTERVAL -1 MONTH) AS date_from, LAST_DAY(NOW()) AS date_end,'' as ftcoa_code FROM tlreport");
                $objAxpDB->FormCaption("Date From,Date End,No Perkiraan");
                $objAxpDB->FormPosition("TL,TL,TL");
                break;
             case "f07": //date_from,date_end
                $objAxpDB->FormSQL("SELECT
                                CONVERT(null,date) as date_from,
                                CONVERT(null,date) as date_end
                                FROM tlreport");
                $objAxpDB->FormCaption("Date From,Date End");
                $objAxpDB->FormPosition("TL, TL,TL");
                break;

            case "f08": //date_from,date_end
                $objAxpDB->FormSQL("SELECT
                                CONVERT(null,date) as date_from,
                                CONVERT(null,date) as date_end
                                FROM tlreport");
                $objAxpDB->FormCaption("Date From,Date End");
                $objAxpDB->FormPosition("TL, TL,TL");
                break;

            case "f09":
                $objAxpDB->Lookup("customer_code", "SELECT 'SELURUH' as ftcustomer_code,'SELURUH' AS ftcustomer_name UNION ALL   SELECT ftcustomer_code, ftcustomer_name FROM tlcustomer", "ftcustomer_code", "ftcustomer_name", -1,false);

                $objAxpDB->FormSQL("SELECT '' as customer_code, 
                                    DATE_ADD(DATE_ADD(LAST_DAY(NOW()),INTERVAL 1 DAY),INTERVAL -1 MONTH) AS date_from,
                                        LAST_DAY(NOW()) AS date_end
                                    FROM tlreport");

                $objAxpDB->FormCaption("Customer,Date From,Date End");
                $objAxpDB->FormPosition("TL,TR,TR");
                break;

            case "f10":
                $objAxpDB->Lookup("supplier_code", "SELECT 'SELURUH' as ftsupplier_code,'SELURUH' AS ftsupplier_name UNION ALL   SELECT ftsupplier_code, ftsupplier_name FROM tlsupplier", "ftsupplier_code", "ftsupplier_name", -1,false);
                $objAxpDB->FormSQL("SELECT
                                    '' as supplier_code,
                                    DATE_ADD(DATE_ADD(LAST_DAY(NOW()),INTERVAL 1 DAY),INTERVAL -1 MONTH) AS date_from,
                                        LAST_DAY(NOW()) AS date_end
                                    FROM tlreport");

                $objAxpDB->FormCaption("Supplier,Date From,Date End");
                $objAxpDB->FormPosition("TL,TR, TR");
                break;

            case "f11":
                $objAxpDB->Lookup("customer_code", "SELECT 'SELURUH' as ftcustomer_code,'SELURUH' AS ftcustomer_name UNION ALL   SELECT ftcustomer_code, ftcustomer_name FROM tlcustomer", "ftcustomer_code", "ftcustomer_name", -1,false);
                $objAxpDB->FormSQL("SELECT
                                    '' as customer_code,
                                    CONVERT(null,date) as date_from
                                    FROM tlreport");

                $objAxpDB->FormCaption("Customer,Date");
                $objAxpDB->FormPosition("TL,TL");
               break;

            case "f12":
                $objAxpDB->Lookup("customer_code", "SELECT 'SELURUH' as ftcustomer_code,'SELURUH' AS ftcustomer_name UNION ALL   SELECT ftcustomer_code, ftcustomer_name FROM tlcustomer", "ftcustomer_code", "ftcustomer_name", -1,false);
                $objAxpDB->FormSQL("SELECT
                                    '' as customer_code,
                                    CONVERT(null,date) as date_from
                                    FROM tlreport");

                $objAxpDB->FormCaption("Customer,Date");
                $objAxpDB->FormPosition("TL,TL");
                break;

            case "f13":
                $objAxpDB->Lookup("supplier_code", "SELECT 'SELURUH' as ftsupplier_code,'SELURUH' AS ftsupplier_name UNION ALL   SELECT ftsupplier_code, ftsupplier_name FROM tlsupplier", "ftsupplier_code", "ftsupplier_name", -1,false);
                $objAxpDB->FormSQL("SELECT
                                    '' as supplier_code,
                                    CONVERT(null,date) as date_from
                                    FROM tlreport");

                $objAxpDB->FormCaption("Supplier,Date");
                $objAxpDB->FormPosition("TL,TL");
                break;
            case "f14":
                $objAxpDB->Lookup("supplier_code", "SELECT 'SELURUH' as ftsupplier_code,'SELURUH' AS ftsupplier_name UNION ALL   SELECT ftsupplier_code, ftsupplier_name FROM tlsupplier", "ftsupplier_code", "ftsupplier_name", -1,false);
                $objAxpDB->FormSQL("SELECT
                                    '' as supplier_code,
                                    CONVERT(null,date) as date_from
                                    FROM tlreport");

                $objAxpDB->FormCaption("Supplier,Date");
                $objAxpDB->FormPosition("TL,TL");
                break;

            case "f20":
                $objAxpDB->Lookup("customer_code", "SELECT 'SELURUH' as ftcustomer_code,'SELURUH' AS ftcustomer_name UNION ALL   (SELECT ftcustomer_code, ftcustomer_name FROM tlcustomer WHERE  ifnull(ftparent_code,'')='' ORDER BY ftcustomer_code) ", "ftcustomer_code", "ftcustomer_name", -1,false);
                $objAxpDB->FormSQL("SELECT
                                    '' as customer_code,
                                    DATE_ADD(DATE_ADD(LAST_DAY(NOW()),INTERVAL 1 DAY),INTERVAL -1 MONTH) AS date_from,
                                        LAST_DAY(NOW()) AS date_end
                                    FROM tlreport");

                $objAxpDB->FormCaption("Customer,Date From,Date End");
                $objAxpDB->FormPosition("TL,TR,TR");
                break;

            case "f21":
                $objAxpDB->Lookup("supplier_code", "SELECT 'SELURUH' as ftsupplier_code,'SELURUH' AS ftsupplier_name UNION ALL   (SELECT ftsupplier_code, ftsupplier_name FROM tlsupplier ORDER BY ftsupplier_code) ", "ftsupplier_code", "ftsupplier_name", -1,false);
                $objAxpDB->FormSQL("SELECT
                                    '' as supplier_code,
                                    DATE_ADD(DATE_ADD(LAST_DAY(NOW()),INTERVAL 1 DAY),INTERVAL -1 MONTH) AS date_from,
                                        LAST_DAY(NOW()) AS date_end
                                    FROM tlreport");

                $objAxpDB->FormCaption("Supplier,Date From,Date End");
                $objAxpDB->FormPosition("TL,TR, TR");
                break;

            case "f35":
                $objAxpDB->FormSQL("SELECT 
                                    CONVERT(null,date) as date_from,
                                    CONVERT(null,date) as date_end
                                    FROM tlreport");

                $objAxpDB->FormCaption("Date From,Date End");
                $objAxpDB->FormPosition("HD,HD");
                break;

            case "f36": //date_from,date_end
                $objAxpDB->FormSQL("SELECT
                            CONVERT(null,date) as date_from,
                            CONVERT(null,date) as date_end
                            FROM tlreport");
                $objAxpDB->FormCaption("Date From,Date End");
                $objAxpDB->FormPosition("HD, HD");
                break;

            case "f48":
                $objAxpDB->Lookup("customer_code", "SELECT \'SELURUH\' as ftcustomer_code,\'SELURUH\' AS ftcustomer_name UNION ALL SELECT ftcustomer_code, ftcustomer_name FROM tlcustomer", "ftcustomer_code", "ftcustomer_name", -1,false);
                $objAxpDB->Lookup("currency_code", "SELECT ftsimbol, ftdescription FROM tlcurrency_hdr order by ftsimbol", "ftsimbol", "ftdescription", -1,true);

                $objAxpDB->FormSQL("SELECT '' as customer_code,
                                        '' as currency_code,
                                        DATE_ADD(DATE_ADD(LAST_DAY(NOW()),INTERVAL 1 DAY),INTERVAL -1 MONTH) AS date_from,
                                        LAST_DAY(NOW()) AS date_end
                                    FROM tlreport");

                $objAxpDB->FormCaption("Customer, Mata Uang, Date From,Date End");
                $objAxpDB->FormPosition("TL, HD, TR, TR");                
                /*$report_script = "document.getElementById('customer_code').value = 'SELURUH'
                                  document.getElementById('hidden_customer_code').value = 'SELURUH';
                                  document.getElementById('span_customer_code').innerHTML = 'SELURUH';"; */
                
                $objAxpDB->FormJS($report_script);
                break;    

            case "f49":
                $objAxpDB->Lookup("supplier_code", "SELECT \'SELURUH\' as ftsupplier_code,\'SELURUH\' AS ftsupplier_name UNION ALL SELECT ftsupplier_code, ftsupplier_name FROM tlsupplier", "ftsupplier_code", "ftsupplier_name", -1,false);
                $objAxpDB->Lookup("currency_code", "SELECT ftsimbol, ftdescription FROM tlcurrency_hdr order by ftsimbol", "ftsimbol", "ftdescription", -1,true);

                $objAxpDB->FormSQL("SELECT '' as supplier_code,
                                        '' as currency_code,
                                        DATE_ADD(DATE_ADD(LAST_DAY(NOW()),INTERVAL 1 DAY),INTERVAL -1 MONTH) AS date_from,
                                        LAST_DAY(NOW()) AS date_end
                                    FROM tlreport");

                $objAxpDB->FormCaption("Supplier, Mata Uang, Date From,Date End");
                $objAxpDB->FormPosition("TL, HD, TR, TR");     
                $objAxpDB->FormJS($report_script);
                break;   

            case "f50":
                $objAxpDB->Lookup("customer_code", "SELECT \'SELURUH\' as ftcustomer_code,\'SELURUH\' AS ftcustomer_name UNION ALL SELECT ftcustomer_code, ftcustomer_name FROM tlcustomer", "ftcustomer_code", "ftcustomer_name", -1,false);
                $objAxpDB->Lookup("status_giro", "SELECT fntrans_status_code, fttrans_status_name FROM tstransaction_status WHERE fntrans_group_code = 11 ", "fntrans_status_code", "fttrans_status_name", 1,true);
                
                $objAxpDB->FormSQL("SELECT '' as customer_code,
                                        0 as status_giro,
                                        DATE_ADD(DATE_ADD(LAST_DAY(NOW()),INTERVAL 1 DAY),INTERVAL -1 MONTH) AS date_from,
                                        LAST_DAY(NOW()) AS date_end
                                    FROM tlreport");

                $objAxpDB->FormCaption("Customer, Status Giro, Date From,Date End");
                $objAxpDB->FormPosition("TL, TL, TR, TR");
                
                $objAxpDB->FormJS($report_script);
                break;    

            case "f51":
                $objAxpDB->FormSQL("SELECT '' as supplier_code,
                                        0 AS status_giro,
                                        DATE_ADD(DATE_ADD(LAST_DAY(NOW()),INTERVAL 1 DAY),INTERVAL -1 MONTH) AS date_from,
                                        LAST_DAY(NOW()) AS date_end
                                    FROM tlreport");

                $objAxpDB->FormCaption("Supplier, Status Giro, Date From,Date End");
                $objAxpDB->FormPosition("TL, TL, TR, TR");
                
                $objAxpDB->Lookup("supplier_code", "SELECT \'SELURUH\' as ftsupplier_code,\'SELURUH\' AS ftsupplier_name UNION ALL SELECT ftsupplier_code, ftsupplier_name FROM tlsupplier", "ftsupplier_code", "ftsupplier_name", -1,false);
                $objAxpDB->Lookup("status_giro", "SELECT fntrans_status_code, fttrans_status_name FROM tstransaction_status WHERE fntrans_group_code = 11 ", "fntrans_status_code", "fttrans_status_name", 1,true);
                
                // $objAxpDB->FormJS($report_script);
                break;    
            
            case "f52":
                $objAxpDB->Lookup("customer_code", "SELECT 'SELURUH' as ftcustomer_code,'SELURUH' AS ftcustomer_name UNION ALL   SELECT ftcustomer_code, ftcustomer_name FROM tlcustomer", "ftcustomer_code", "ftcustomer_name", -1,false);
                $objAxpDB->Lookup("sales_code", "SELECT  'SELURUH' as sales_code , 'SELURUH' as ftsales_name UNION ALL SELECT  ftsales_code as sales_code, ftsales_name FROM tlsales WHERE fnstatus=1 ORDER BY sales_code", "sales_code", "ftsales_name", -1, true);
                $objAxpDB->FormSQL("SELECT
                                    '' as customer_code,'SELURUH' as sales_code,
                                    CONVERT(null,date) as date_from
                                    FROM tlreport");

                $objAxpDB->FormCaption("Customer,Sales,Date");
                $objAxpDB->FormPosition("TL,TR,TL");
               break;

               case "f53":
                $objAxpDB->Lookup("customer_code", "SELECT 'SELURUH' as ftcustomer_code,'SELURUH' AS ftcustomer_name UNION ALL   SELECT ftcustomer_code, ftcustomer_name FROM tlcustomer", "ftcustomer_code", "ftcustomer_name", -1,false);
                
                $objAxpDB->FormSQL("SELECT DISTINCT
                                        date_add(date_add(LAST_DAY(now()),interval 1 DAY),interval -1 MONTH) as date_from,
                                        LAST_DAY(NOW()) as date_end, 'PUSAT' as branch_code,
                                        '' as customer_code
                                        FROM tlreport");
                $objAxpDB->FormCaption("Date From,Date End, Cabang, Customer");
                $objAxpDB->FormPosition("TL,TL, HD, TL");
               break;

               case "f54":
                $objAxpDB->Lookup("supplier_code", "SELECT 'SELURUH' as ftsupplier_code,'SELURUH' AS ftsupplier_name UNION ALL   SELECT ftsupplier_code, ftsupplier_name FROM tlsupplier", "ftsupplier_code", "ftsupplier_name", -1,false);
                
                $objAxpDB->FormSQL("SELECT DISTINCT
                                        date_add(date_add(LAST_DAY(now()),interval 1 DAY),interval -1 MONTH) as date_from,
                                        LAST_DAY(NOW()) as date_end, 'PUSAT' as branch_code,
                                        '' as supplier_code
                                        FROM tlreport");
                $objAxpDB->FormCaption("Date From,Date End, Cabang, Supplier");
                $objAxpDB->FormPosition("TL,TL,HD, TL");
               break;
               
            /* Tidak digunakan saat ini 
            case "f01": //date_from,date_end
                $objAxpDB->FormSQL("SELECT
                                CONVERT(null,date) as date_from,
                                CONVERT(null,date) as date_end
                                FROM tlreport");
                $objAxpDB->FormCaption("Date From,Date End");
                $objAxpDB->FormPosition("TL, TL,TL");
                break;
            case "f02": //date_from,date_end
                $objAxpDB->FormSQL("SELECT
                                CONVERT(null,date) as date_from,
                                CONVERT(null,date) as date_end
                                FROM tlreport");
                $objAxpDB->FormCaption("Date From,Date End");
                $objAxpDB->FormPosition("TL, TL,TL");
                 break;
            case "f03": //date_from,date_end
                $objAxpDB->FormSQL("SELECT
                                CONVERT(null,date) as date_from,
                                CONVERT(null,date) as date_end
                                FROM tlreport");
                $objAxpDB->FormCaption("Date From,Date End");
                $objAxpDB->FormPosition("TL, TL,TL");
                 break;
            case "f04": //date_from,date_end
                $objAxpDB->FormSQL("SELECT
                                CONVERT(null,date) as date_from,
                                CONVERT(null,date) as date_end
                                FROM tlreport");
                $objAxpDB->FormCaption("Date From,Date End");
                $objAxpDB->FormPosition("TL, TL,TL");
                break;
            case "f05_1": //date_from,date_end
                $objAxpDB->Lookup("journal1", "SELECT ftjournal_no,date_format(fdtrans_date,\'%d-%b-%Y\') as fdtrans_date from txbankrcp_hdr ", "ftjournal_no", "fdtrans_date",1,false);
                $objAxpDB->Lookup("journal2", "SELECT ftjournal_no,date_format(fdtrans_date,\'%d-%b-%Y\') as fdtrans_date from txbankrcp_hdr", "ftjournal_no", "fdtrans_date",1,false);

                $objAxpDB->FormSQL("SELECT
                                 '' as journal1,
                                '' as journal2
                                FROM tlreport");
                $objAxpDB->FormCaption("No. Jurnal (1),No. Jurnal (2)");

                $objAxpDB->FormPosition("TL, TL,TL");
                break;
            case "f05_2": //date_from,date_end
                $objAxpDB->Lookup("journal1", "SELECT ftjournal_no,date_format(fdtrans_date,\'%d-%b-%Y\') as fdtrans_date from txbankpym_hdr", "ftjournal_no", "fdtrans_date",1,false);
                $objAxpDB->Lookup("journal2", "SELECT ftjournal_no,date_format(fdtrans_date,\'%d-%b-%Y\') as fdtrans_date from txbankpym_hdr", "ftjournal_no", "fdtrans_date",1,false);

                $objAxpDB->FormSQL("SELECT
                               '' as journal1,
                              '' as journal2
                              FROM tlreport");
                $objAxpDB->FormCaption("No. Jurnal (1),No. Jurnal (2)");

                $objAxpDB->FormPosition("TL, TL,TL");
                break;


            case "f05_3": //date_from,date_end
                $objAxpDB->Lookup("journal1", "SELECT ftjournal_no,date_format(fdtrans_date,\'%d-%b-%Y\') as fdtrans_date from txar_hdr", "ftjournal_no", "fdtrans_date",1,false);
                $objAxpDB->Lookup("journal2", "SELECT ftjournal_no,date_format(fdtrans_date,\'%d-%b-%Y\') as fdtrans_date from txar_hdr", "ftjournal_no", "fdtrans_date",1,false);

                $objAxpDB->FormSQL("SELECT
                             '' as journal1,
                            '' as journal2
                            FROM tlreport");
                $objAxpDB->FormCaption("No. Jurnal (1),No. Jurnal (2)");

                $objAxpDB->FormPosition("TL, TL,TL");
                break;
            case "f05_4": //date_from,date_end
                $objAxpDB->FormSQL("SELECT
                            CONVERT(null,date) as date_from,
                            CONVERT(null,date) as date_end
                            FROM tlreport");
                $objAxpDB->FormCaption("Date From,Date End");
                $objAxpDB->FormPosition("TL, TL,TL");
                break;
            case "f06_1": //date_from,date_end
                $objAxpDB->FormSQL("SELECT
                                CONVERT(null,date) as date_from,
                                CONVERT(null,date) as date_end
                                FROM tlreport");
                $objAxpDB->FormCaption("Date From,Date End");
                $objAxpDB->FormPosition("TL, TL,TL");
                break;
            case "f06_2": //date_from,date_end
                $objAxpDB->Lookup("trans1", "select * from (SELECT ftbankrcp_no as trans1,date_format(fdtrans_date,\'%d-%b-%Y\') as fdtrans_date from txbankrcp_hdr union all SELECT ftbankpym_no as trans1 ,date_format(fdtrans_date,\'%d-%b-%Y\') as fdtrans_date from txbankpym_hdr) m  order by trans1 ", "trans1", "fdtrans_date",1,false);
                $objAxpDB->Lookup("trans2", "select * from (SELECT ftbankrcp_no as trans1,date_format(fdtrans_date,\'%d-%b-%Y\') as fdtrans_date from txbankrcp_hdr union all SELECT ftbankpym_no as trans1,date_format(fdtrans_date,\'%d-%b-%Y\') as fdtrans_date from txbankpym_hdr) m order by  trans1 ", "trans1", "fdtrans_date",1,false);

                $objAxpDB->FormSQL("SELECT
                                '' as trans1,
                               '' as trans2
                               FROM tlreport");
                $objAxpDB->FormCaption("No. Voucher (1),No. Voucher (2)");

                $objAxpDB->FormPosition("TL, TL,TL");
                break;
            case "f06_3": //date_from,date_end

                $objAxpDB->FormSQL("SELECT
                                 '' as `desc`
                                FROM tlreport");
                $objAxpDB->FormCaption("Desc");

                $objAxpDB->FormPosition("TL");
                break;
            case "f15":
                $objAxpDB->FormSQL("SELECT
                                    CONVERT(null,date) as date_from
                                    FROM tlreport");

                $objAxpDB->FormCaption("Date");
                $objAxpDB->FormPosition("TL");
                break;
            case "f16": //date_from,date_end
                $objAxpDB->FormSQL("SELECT
                                CONVERT(null,date) as date_from,
                                CONVERT(null,date) as date_end
                                FROM tlreport");
                $objAxpDB->FormCaption("Date From,Date End");
                $objAxpDB->FormPosition("TL, TL,TL");
                break;
        case "f17": //date_from,date_end

            $objAxpDB->FormSQL("SELECT
                             '' as journal1,
                            '' as journal2,
                             '' as coa_code
                            FROM tlreport");
            $objAxpDB->FormCaption("No. Jurnal (1),No. Jurnal (2), Bank");
             $objAxpDB->Lookup("journal1", "select * from (SELECT ftjournal_no,ftjournal_no as fdtrans_date from txbankrcp_hdr union  SELECT ftjournal_no,ftjournal_no as fdtrans_date from txbankpym_hdr  union  SELECT ftjournal_no,ftjournal_no as fdtrans_date from txar_hdr   union  SELECT ftjournal_no,ftjournal_no as fdtrans_date from txrecap_bank_voucher_hdr) m order by ftjournal_no  ", "ftjournal_no", "fdtrans_date",1,false);
             $objAxpDB->Lookup("journal2", "select * from (SELECT ftjournal_no,ftjournal_no as fdtrans_date from txbankrcp_hdr union  SELECT ftjournal_no,ftjournal_no as fdtrans_date from txbankpym_hdr  union  SELECT ftjournal_no,ftjournal_no as fdtrans_date from txar_hdr   union  SELECT ftjournal_no,ftjournal_no as fdtrans_date from txrecap_bank_voucher_hdr) m order by ftjournal_no  ", "ftjournal_no", "fdtrans_date",1,false);

                $objAxpDB->Lookup("coa_code", "SELECT 'SELURUH' as ftcode,'SELURUH' AS ftdescription UNION ALL   SELECT ftcode, ftdescription FROM tlmaster_bank", "ftcode", "ftdescription", -1,true);

            $objAxpDB->FormPosition("TL, TL,TL");

        break;
         case "f17_1": //date_from,date_end
                $objAxpDB->Lookup("coa_code", "SELECT 'SELURUH' as ftcode,'SELURUH' AS ftdescription UNION ALL   SELECT ftcode, ftdescription FROM tlmaster_bank", "ftcode", "ftdescription", -1,true);

            $objAxpDB->FormSQL("SELECT
                            CONVERT(null,date) as date_from,
                            CONVERT(null,date) as date_end,
                             '' as coa_code
                            FROM tlreport");
            $objAxpDB->FormCaption("Date From,Date End, Bank");
            $objAxpDB->FormPosition("TL, TL,TL");

        break;
         case "f17_2": //date_from,date_end
                $objAxpDB->Lookup("coa_code", "SELECT 'SELURUH' as ftcode,'SELURUH' AS ftdescription UNION ALL   SELECT ftcode, ftdescription FROM tlmaster_bank", "ftcode", "ftdescription", -1,true);

            $objAxpDB->FormSQL("SELECT
                            CONVERT(null,date) as date_from,
                            CONVERT(null,date) as date_end,
                             '' as coa_code
                            FROM tlreport");
            $objAxpDB->FormCaption("Date From,Date End, Bank");
            $objAxpDB->FormPosition("TL, TL,TL");

        break;
        case "f18":
            $objAxpDB->Lookup("coa_code", "SELECT 'SELURUH' as ftcode,'SELURUH' AS ftdescription UNION ALL   SELECT ftcode, ftdescription FROM tlmaster_bank", "ftcode", "ftdescription", -1,true);

            $objAxpDB->FormSQL("SELECT
                            CONVERT(null,date) as date_from,
                            CONVERT(null,date) as date_end ,
                            '' as coa_code
                            FROM tlreport");
            $objAxpDB->FormCaption("Date From,Date End,Bank");
            $objAxpDB->FormPosition("TL, TL,TL");

         break;
          case "f18_1":
            $objAxpDB->Lookup("coa_code", "SELECT 'SELURUH' as ftcode,'SELURUH' AS ftdescription UNION ALL   SELECT ftcode, ftdescription FROM tlmaster_bank", "ftcode", "ftdescription", -1,true);

            $objAxpDB->FormSQL("SELECT
                            CONVERT(null,date) as date_from,
                            CONVERT(null,date) as date_end ,
                            '' as coa_code
                            FROM tlreport");
            $objAxpDB->FormCaption("Date From,Date End,Bank");
            $objAxpDB->FormPosition("TL, TL,TL");

         break;
        case "f19":
            $objAxpDB->FormSQL("SELECT
                            CONVERT(null,date) as date_from,
                            CONVERT(null,date) as date_end
                            FROM tlreport");
            $objAxpDB->FormCaption("Date From,Date End");
            $objAxpDB->FormPosition("TL, TL,TL");
          break;
        case "f22":
            $objAxpDB->FormSQL("SELECT
                            CONVERT(null,date) as date_from,
                            CONVERT(null,date) as date_end
                            FROM tlreport");
            $objAxpDB->FormCaption("Date From,Date End");
            $objAxpDB->FormPosition("TL, TL,TL");
             break;
        case "f23":
            $objAxpDB->Lookup("customer_code", "SELECT \'SELURUH\' as ftcustomer_code,\'SELURUH\' AS ftcustomer_name UNION ALL   SELECT ftcustomer_code, ftcustomer_name FROM tlcustomer", "ftcustomer_code", "ftcustomer_name", -1,false);
            $objAxpDB->FormSQL("SELECT
                                '' as customer_code
                                FROM tlreport");

            $objAxpDB->FormCaption("Customer");
            $objAxpDB->FormPosition("TL");
             break;
         case "f24":
            $objAxpDB->Lookup("supplier_code", "SELECT \'SELURUH\' as ftsupplier_code,\'SELURUH\' AS ftsupplier_name UNION ALL   SELECT ftsupplier_code, ftsupplier_name FROM tlsupplier", "ftsupplier_code", "ftsupplier_name", -1,false);
            $objAxpDB->FormSQL("SELECT
                                '' as supplier_code
                                FROM tlreport");

            $objAxpDB->FormCaption("supplier");
            $objAxpDB->FormPosition("TL");
              break;
          case "f25":
            $objAxpDB->FormSQL("SELECT
                                CONVERT(null,date) as date_from,
                                CONVERT(null,date) as date_end
                                FROM tlreport");

            $objAxpDB->FormCaption("Date From,Date End");
            $objAxpDB->FormPosition("TL,TL");
            break;
         case "f25":
            $objAxpDB->FormSQL("SELECT
                                CONVERT(null,date) as date_from,
                                CONVERT(null,date) as date_end
                                FROM tlreport");

            $objAxpDB->FormCaption("Date From,Date End");
            $objAxpDB->FormPosition("TL,TL");
            break;
          case "f25_1":
            $objAxpDB->FormSQL("SELECT
                                CONVERT(null,date) as date_from,
                                CONVERT(null,date) as date_end
                                FROM tlreport");

            $objAxpDB->FormCaption("Date From,Date End");
            $objAxpDB->FormPosition("TL,TL");
            break;
           case "f25_2":
            $objAxpDB->Lookup("journal1", "SELECT ftjournal_no,date_format(fdtrans_date,\'%d-%b-%Y\') as fdtrans_date from txrecap_bank_voucher_hdr WHERE  ifnull(fntype,0)=1 ", "ftjournal_no", "fdtrans_date",1,false);
              $objAxpDB->Lookup("journal2", "SELECT ftjournal_no,date_format(fdtrans_date,\'%d-%b-%Y\') as fdtrans_date from txrecap_bank_voucher_hdr WHERE ifnull(fntype,0)=1 ", "ftjournal_no", "fdtrans_date",1,false);

            $objAxpDB->FormSQL("SELECT
                             '' as journal1,
                            '' as journal2
                            FROM tlreport");
            $objAxpDB->FormCaption("No. Jurnal (1),No. Jurnal (2)");

            $objAxpDB->FormPosition("TL, TL,TL");
            break;
         case "f26":
          $objAxpDB->FormSQL("SELECT
                                CONVERT(null,date) as date_from,
                                CONVERT(null,date) as date_end
                                FROM tlreport");

            $objAxpDB->FormCaption("Date From,Date End");
            $objAxpDB->FormPosition("TL,TL");

           break;
           case "f27":
              $objAxpDB->FormSQL("SELECT
                                    CONVERT(null,date) as date_from,
                                    CONVERT(null,date) as date_end
                                    FROM tlreport");

                $objAxpDB->FormCaption("Date From,Date End");
                $objAxpDB->FormPosition("TL,TL");

           break;
            case "f28":
              $objAxpDB->Lookup("coa_code", "SELECT 'SELURUH' as ftcode,'SELURUH' AS ftdescription UNION ALL   SELECT ftcode, ftdescription FROM tlmaster_bank", "ftcode", "ftdescription", -1,true);
              $objAxpDB->FormSQL("SELECT
                                    CONVERT(null,date) as date_from,
                                    CONVERT(null,date) as date_end,
                                    '' as coa_code
                                    FROM tlreport");

                $objAxpDB->FormCaption("Date From,Date End,Bank");
                $objAxpDB->FormPosition("TL,TL,TL");

           break;
		     case "f28_1":
              $objAxpDB->Lookup("coa_code", "SELECT 'SELURUH' as ftcode,'SELURUH' AS ftdescription UNION ALL   SELECT ftcode, ftdescription FROM tlmaster_bank", "ftcode", "ftdescription", -1,true);
              $objAxpDB->FormSQL("SELECT
                                    CONVERT(null,date) as date_from,
                                    CONVERT(null,date) as date_end,
                                    '' as coa_code
                                    FROM tlreport");

                $objAxpDB->FormCaption("Date From,Date End,Bank");
                $objAxpDB->FormPosition("TL,TL,TL");

           break;
		     case "f28_2":
              $objAxpDB->Lookup("coa_code", "SELECT 'SELURUH' as ftcode,'SELURUH' AS ftdescription UNION ALL   SELECT ftcode, ftdescription FROM tlmaster_bank", "ftcode", "ftdescription", -1,true);
              $objAxpDB->FormSQL("SELECT
                                    CONVERT(null,date) as date_from,
                                    CONVERT(null,date) as date_end,
                                    '' as coa_code
                                    FROM tlreport");

                $objAxpDB->FormCaption("Date From,Date End,Bank");
                $objAxpDB->FormPosition("TL,TL,TL");

           break;
           case "f29":
              $objAxpDB->FormSQL("SELECT
                                    CONVERT(null,date) as date_from,
                                    CONVERT(null,date) as date_end
                                    FROM tlreport");

                $objAxpDB->FormCaption("Date From,Date End");
                $objAxpDB->FormPosition("TL,TL");

           break;
            case "f30":
               $objAxpDB->Lookup("coa_code", "SELECT 'SELURUH' as ftcode,'SELURUH' AS ftdescription UNION ALL   SELECT ftcode, ftdescription FROM tlmaster_bank", "ftcode", "ftdescription", -1,true);
          
              $objAxpDB->FormSQL("SELECT
                                    '' as coa_code,
                                    CONVERT(null,date) as date_from,
                                    CONVERT(null,date) as date_end
                                    FROM tlreport");

                $objAxpDB->FormCaption("Bank, Date From,Date End");
                $objAxpDB->FormPosition("TL,TL,TL");

           break;
           case "f31":
              $objAxpDB->Lookup("customer_type", "SELECT 'SELURUH' as ftcustomer_type_code,'SELURUH' AS ftcustomer_type_name UNION ALL   SELECT ftcustomer_type_code, ftcustomer_type_name FROM tlcustomer_type", "ftcustomer_type_code", "ftcustomer_type_name",1,true);
              $objAxpDB->FormSQL("SELECT
                                    '' as customer_type,
                                    CONVERT(null,date) as date_from,
                                    CONVERT(null,date) as date_end
                                    FROM tlreport");

                $objAxpDB->FormCaption("Customer Type, Date From,Date End");
                $objAxpDB->FormPosition("TL,TL,TL");

           break;
           
             case "f32":
              $objAxpDB->Lookup("customer_type", "SELECT 'SELURUH' as ftcustomer_type_code,'SELURUH' AS ftcustomer_type_name UNION ALL   SELECT ftcustomer_type_code, ftcustomer_type_name FROM tlcustomer_type", "ftcustomer_type_code", "ftcustomer_type_name",1,true);
              $objAxpDB->FormSQL("SELECT
                                    '' as customer_type,
                                    CONVERT(null,date) as date_from,
                                    CONVERT(null,date) as date_end
                                    FROM tlreport");

                $objAxpDB->FormCaption("Customer Type, Date From,Date End");
                $objAxpDB->FormPosition("TL,TL,TL");

           break;
             case "f33":
            $objAxpDB->Lookup("supplier_code", "SELECT \'SELURUH\' as ftsupplier_code,\'SELURUH\' AS ftsupplier_name UNION ALL   SELECT ftsupplier_code, ftsupplier_name FROM tlsupplier", "ftsupplier_code", "ftsupplier_name", -1,false);
            $objAxpDB->FormSQL("SELECT
                                '' as supplier_code,
                                CONVERT(null,date) as date_from,
                                CONVERT(null,date) as date_end
                                FROM tlreport");

            $objAxpDB->FormCaption("Supplier,Date From,Date End");
            $objAxpDB->FormPosition("TL,TR, TR");

           break;
             case "f34":
            $objAxpDB->Lookup("supplier_code", "SELECT \'SELURUH\' as ftsupplier_code,\'SELURUH\' AS ftsupplier_name UNION ALL   SELECT ftsupplier_code, ftsupplier_name FROM tlsupplier", "ftsupplier_code", "ftsupplier_name", -1,false);
            $objAxpDB->FormSQL("SELECT
                                '' as supplier_code,
                                CONVERT(null,date) as date_from,
                                CONVERT(null,date) as date_end
                                FROM tlreport");

            $objAxpDB->FormCaption("Supplier,Date From,Date End");
            $objAxpDB->FormPosition("TL,TL, HD");

           break;   
            case "f37": //date_from,date_end
                $objAxpDB->FormSQL("SELECT
                            CONVERT(null,date) as date_from,
                            CONVERT(null,date) as date_end
                            FROM tlreport");
                $objAxpDB->FormCaption("Date From,Date End");
                $objAxpDB->FormPosition("TL, TL,TL");
                break;
            case "f38": //date_from,date_end
                $objAxpDB->FormSQL("SELECT
                            CONVERT(null,date) as date_from,
                            CONVERT(null,date) as date_end
                            FROM tlreport");
                $objAxpDB->FormCaption("Date From,Date End");
                $objAxpDB->FormPosition("TL, TL,TL");
                 break;
            case "f39":
                $objAxpDB->FormSQL("SELECT
                                    CONVERT(null,date) as date_from,
                                    CONVERT(null,date) as date_end
                                    FROM tlreport");

                $objAxpDB->FormCaption("Date From,Date End");
                $objAxpDB->FormPosition("TL,TL");
                break;
        
              
              
             */
                    
            
        }
        $objAxpDB->FormName("laporan keuangan".$report_name);
        $objAxpDB->ButtonShow("generate_report,print_report,export_excel_report,export_pdf_report");
    }



    $objAxpDB->Process();
    if(!$_REQUEST['id']) {

        $objAxpDB->WriteHtmlTable();
    }
    else {
         # die("suhut");
        $objAxpDB->reportData();
    }