function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_laporan_pembayaran_wp_online;
    //Compatibility
    //End Page_BeforeShow
    //Custom Code @572-2A29BDB7
    // -------------------------
    // Write your own code here.
    $doAction = CCGetFromGet('doAction');
    global $Label1;
    if ($doAction == 'view_html') {
        $param_arr['p_year_period_id'] = CCGetFromGet('p_year_period_id');
        $param_arr['p_finance_period_id'] = CCGetFromGet('p_finance_period_id');
        $param_arr['p_vat_type_id'] = CCGetFromGet('p_vat_type_id');
        $param_arr['tgl_penerimaan'] = CCGetFromGet('tgl_penerimaan');
        $param_arr['vat_code'] = CCGetFromGet('vat_code');
        $param_arr['year_code'] = CCGetFromGet('year_code');
        $param_arr['code'] = CCGetFromGet('code');
        $Label1->SetText(GetCetakHTML($param_arr));
    }
    // -------------------------
    //End Custom Code
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_laporan_perkembangan_jumlah_wp;
    //Compatibility
    //End Page_BeforeShow
    //Custom Code @572-2A29BDB7
    // -------------------------
    // Write your own code here.
    $doAction = CCGetFromGet('doAction');
    global $Label1;
    $param_arr['p_year_period_id'] = CCGetFromGet('p_year_period_id');
    $param_arr['p_finance_period_id'] = CCGetFromGet('p_finance_period_id');
    $param_arr['p_vat_type_id'] = CCGetFromGet('p_vat_type_id');
    $param_arr['status_bayar'] = CCGetFromGet('ListBox1');
    $param_arr['vat_code'] = CCGetFromGet('vat_code');
    $param_arr['year_code'] = CCGetFromGet('year_code');
    $param_arr['code'] = CCGetFromGet('code');
    $param_arr['npwpd_jabatan'] = CCGetFromGet('npwpd_jabatan');
    if ($doAction == 'view_html') {
        $Label1->SetText(GetCetakHTML($param_arr));
    }
    if ($doAction == 'view_excel') {
        GetCetakHTML($param_arr);
    }
    // -------------------------
    //End Custom Code
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_lembar_kontrol_bphtb;
    //Compatibility
    //End Page_BeforeShow
    global $Label1;
    //Custom Code @10-2A29BDB7
    // -------------------------
    // Write your own code here.
    $doAction = CCGetFromGet('doAction');
    if ($doAction == 'view_html') {
        $param_arr = array();
        if (empty($param_arr['date_start'])) {
            $param_arr['date_start'] = CCGetFromGet('date_start_laporan');
        }
        if (empty($param_arr['date_end'])) {
            $param_arr['date_end'] = CCGetFromGet('date_end_laporan');
        }
        //$t_laporan_rekap_bphtb->date_start_laporan->SetValue($param_arr['date_start']);
        //$t_laporan_rekap_bphtb->date_end_laporan->SetValue($param_arr['date_end']);
        $Label1->SetText(GetCetakHTML($param_arr));
    }
    // -------------------------
    //End Custom Code
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_rekap_npwpd_jabatan;
    //Compatibility
    //End Page_BeforeShow
    //Custom Code @572-2A29BDB7
    // -------------------------
    // Write your own code here.
    $doAction = CCGetFromGet('doAction');
    global $Label1;
    $param_arr['p_vat_type_id'] = CCGetFromGet('p_vat_type_id');
    $param_arr['date_start_laporan'] = CCGetFromGet('date_start_laporan');
    $param_arr['date_end_laporan'] = CCGetFromGet('date_end_laporan');
    $param_arr['nilai'] = CCGetFromGet('nilai');
    $param_arr['vat_code'] = CCGetFromGet('vat_code');
    if ($doAction == 'view_html') {
        $Label1->SetText(GetCetakHTML($param_arr));
    }
    if ($doAction == 'view_excel') {
        GetCetakExcel($param_arr);
    }
    // -------------------------
    //End Custom Code
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_laporan_denda_tgl_bayar;
    //Compatibility
    //End Page_BeforeShow
    //Custom Code @572-2A29BDB7
    // -------------------------
    // Write your own code here.
    $doAction = CCGetFromGet('doAction');
    global $Label1;
    $param_arr['end_date'] = CCGetFromGet('date_end_laporan');
    $param_arr['start_date'] = CCGetFromGet('date_start_laporan');
    $param_arr['p_vat_type_dtl_id'] = CCGetFromGet('p_vat_type_dtl_id', '');
    $param_arr['status_bayar'] = CCGetFromGet('ListBox1');
    $param_arr['vat_code'] = CCGetFromGet('vat_code');
    if ($doAction == 'view_html') {
        $Label1->SetText(GetCetakHTML($param_arr));
    }
    if ($doAction == 'view_rekap_html') {
        $Label1->SetText(GetCetakRekapHTML($param_arr));
    }
    if ($doAction == 'cetak_excel') {
        CetakExcel($param_arr);
    }
    if ($doAction == 'cetak_rekap_excel') {
        CetakRekapExcel($param_arr);
    }
    // -------------------------
    //End Custom Code
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_laporan_pembayaran_per_bulan_per_ayat;
    //Compatibility
    //End Page_BeforeShow
    //Custom Code @572-2A29BDB7
    // -------------------------
    // Write your own code here.
    $doAction = CCGetFromGet('doAction');
    global $Label1;
    $param_arr['p_year_period_id'] = CCGetFromGet('p_year_period_id');
    $param_arr['year_code'] = CCGetFromGet('year_code');
    $param_arr['npwpd_jabatan'] = CCGetFromGet('npwpd_jabatan');
    $param_arr['tgl_penerimaan'] = CCGetFromGet('tgl_penerimaan');
    $param_arr['tgl_penerimaan_last'] = CCGetFromGet('tgl_penerimaan_last');
    $param_arr['kode_wilayah'] = CCGetFromGet('kode_wilayah');
    if ($doAction == 'view_html') {
        $Label1->SetText(GetCetakHTML($param_arr));
    }
    if ($doAction == 'view_excel') {
        GetCetakHTML($param_arr);
    }
    // -------------------------
    //End Custom Code
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_laporan_rekap_surat_teguran_per_bulan;
    //Compatibility
    //End Page_BeforeShow
    //Custom Code @572-2A29BDB7
    // -------------------------
    // Write your own code here.
    $doAction = CCGetFromGet('doAction');
    global $Label1;
    $param_arr['p_year_period_id'] = CCGetFromGet('p_year_period_id');
    $param_arr['year_code'] = CCGetFromGet('year_code');
    if ($doAction == 'view_html') {
        $Label1->SetText(GetCetakHTML($param_arr));
    }
    if ($doAction == 'view_excel') {
        $Label1->SetText(GetCetakExcel($param_arr));
    }
    // -------------------------
    //End Custom Code
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_cetak_kartu_npwpd_dr_t_cust_account;
    //Compatibility
    //End Page_BeforeShow
    //Custom Code @572-2A29BDB7
    // -------------------------
    // Write your own code here.
    $doAction = CCGetFromGet('doAction');
    global $Label1;
    if ($doAction == 'view_html') {
        $param_arr['search'] = CCGetFromGet('search');
        $param_arr['tgl'] = CCGetFromGet('tgl');
        /*if ($param_arr['tgl']==''){
        			$param_arr['tgl']='';
        		}*/
        $Label1->SetText(GetCetakHTML($param_arr));
    }
    // -------------------------
    //End Custom Code
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_monitoring_pendaftaran_new;
    //Compatibility
    //End Page_BeforeShow
    //Custom Code @572-2A29BDB7
    // -------------------------
    // Write your own code here.
    $doAction = CCGetFromGet('doAction');
    global $Label1;
    $param_arr['p_year_period_id'] = CCGetFromGet('p_year_period_id');
    $param_arr['p_finance_period_id'] = CCGetFromGet('p_finance_period_id');
    $param_arr['p_vat_type_id'] = CCGetFromGet('p_vat_type_id');
    $param_arr['nilai'] = CCGetFromGet('nilai');
    $param_arr['vat_code'] = CCGetFromGet('vat_code');
    $param_arr['year_code'] = CCGetFromGet('year_code');
    $param_arr['code'] = CCGetFromGet('code');
    if ($doAction == 'view_html') {
        $Label1->SetText(GetCetakHTML($param_arr));
    }
    if ($doAction == 'view_excel') {
        $Label1->SetText(GetCetakExcel($param_arr));
    }
    // -------------------------
    //End Custom Code
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_laporan_penyampaian_surat_teguran;
    //Compatibility
    //End Page_BeforeShow
    global $Label1;
    global $t_rep_sisa_piutangSearch;
    //Custom Code @566-2A29BDB7
    // -------------------------
    // Write your own code here.
    // -------------------------
    //End Custom Code
    $doAction = CCGetFromGet('doAction');
    if ($doAction != '') {
        $data = array();
        $param_arr = array();
        $param_arr['p_year_period_id'] = CCGetFromGet('p_year_period_id');
        $param_arr['p_finance_period_id'] = CCGetFromGet('p_finance_period_id');
        $param_arr['p_vat_type_id'] = CCGetFromGet('p_vat_type_id');
        $param_arr['tahun_periode'] = CCGetFromGet('tahun_periode');
        $param_arr['pajak_periode'] = CCGetFromGet('pajak_periode');
        $param_arr['jenis_pajak'] = CCGetFromGet('jenis_pajak');
        $param_arr['status'] = CCGetFromGet('status', 1);
        $t_rep_sisa_piutangSearch->p_year_period_id->SetValue($param_arr['p_year_period_id']);
        $t_rep_sisa_piutangSearch->p_finance_period_id->SetValue($param_arr['p_finance_period_id']);
        $t_rep_sisa_piutangSearch->p_vat_type_id->SetValue($param_arr['p_vat_type_id']);
        $t_rep_sisa_piutangSearch->year_code->SetValue($param_arr['tahun_periode']);
        $t_rep_sisa_piutangSearch->code->SetValue($param_arr['pajak_periode']);
        $t_rep_sisa_piutangSearch->vat_code->SetValue($param_arr['jenis_pajak']);
        if (!empty($param_arr['p_finance_period_id']) and !empty($param_arr['p_vat_type_id'])) {
            $tanggal = CCGetFromGet('date_end_laporan', '31-12-2014');
            $dbConn = new clsDBConnSIKP();
            $query = "select b.company_brand,regexp_replace(b.brand_address_name, '\r|\n', '', 'g')||' '||b.brand_address_no as alamat_merk_dagang,a.* ,\r\n\t\t\t\tc.total_vat_amount,c.total_penalty_amount\r\n\t\t\t\tfrom f_penyampaian_surat_teguran_fase_2(" . $param_arr['p_vat_type_id'] . "," . $param_arr['p_finance_period_id'] . ",'') a\r\n\t\t\t\tleft join t_cust_account b on a.npwpd = b.npwd\r\n\t\t\t\tleft join t_vat_setllement c on a.t_vat_setllement_id = c.t_vat_setllement_id\r\n\t\t\t\tORDER BY company_brand,npwpd, surat_teguran_3,surat_teguran_2,surat_teguran_1";
            //echo $query;exit;
            $data = array();
            $dbConn->query($query);
            while ($dbConn->next_record()) {
                $data[] = $dbConn->Record;
            }
            $dbConn->close();
        }
    }
    if ($doAction == 'view_html') {
        $Label1->SetText(GetCetakHTML($data, $param_arr));
    }
    if ($doAction == 'download_excel') {
        GetCetakHTML($data, $param_arr);
    }
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function t_vat_setllement_dtlGrid_BeforeShow(&$sender)
{
    $t_vat_setllement_dtlGrid_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_vat_setllement_dtlGrid;
    //Compatibility
    //End t_vat_setllement_dtlGrid_BeforeShow
    //Custom Code @88-2A29BDB7
    // -------------------------
    //global $Label1;
    $param_arr['t_vat_setllement_id'] = CCGetFromGet('t_vat_setllement_id');
    $t_vat_setllement_dtlGrid->Label1->SetText(GetCetakHTML($param_arr));
    //End Custom Code
    //Close t_vat_setllement_dtlGrid_BeforeShow @2-CACF216C
    return $t_vat_setllement_dtlGrid_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_rep_lap_bpps_piutang2;
    //Compatibility
    //End Page_BeforeShow
    global $Label1;
    // -------------------------
    // Write your own code here.
    $doAction = CCGetFromGet('doAction');
    if ($doAction == 'view_html') {
        $p_vat_type_id = CCGetFromGet("p_vat_type_id", "");
        //$year_code = CCGetFromGet("year_code", "");
        $tgl_penerimaan = "'01-01-2010'";
        $tgl_penerimaan_last = "'31-12-2014'";
        $i_flag_setoran = 1;
        $p_year_period_id = 4;
        //year_period_id 4 = 2013
        //year_period_id 16 = 2014
        $date_start = str_replace("'", "", $year_code);
        //$year_date = DateTime::createFromFormat('d-m-Y', $date_start)->format('Y');
        $year_date = $year_code;
        $user = CCGetUserLogin();
        $data = array();
        $dbConn = new clsDBConnSIKP();
        $jenis_laporan = "all";
        $query = "select *,trunc(payment_date) \r\n\t\t\tfrom f_rep_bpps_piutang2new_rm_masuk_resto({$p_vat_type_id}, {$p_year_period_id}, {$tgl_penerimaan}, to_char(sysdate,'dd-mm-yyyy'), {$i_flag_setoran}) \r\n\t\t\torder by p_vat_type_dtl_id, wp_name,npwpd, payment_date";
        //echo $query; exit;
        $dbConn->query($query);
        $tgl_penerimaan = str_replace("'", "", $tgl_penerimaan);
        $tgl_penerimaan_last = str_replace("'", "", $tgl_penerimaan_last);
        $tahun = date("Y", strtotime($tgl_penerimaan));
        while ($dbConn->next_record()) {
            $data[] = array("address" => $dbConn->f("address"), "company_name" => $dbConn->f("company_name"), "kode_jns_trans" => $dbConn->f("kode_jns_trans"), "jns_trans" => $dbConn->f("jns_trans"), "kode_jns_pajak" => $dbConn->f("kode_jns_pajak"), "kode_ayat" => $dbConn->f("kode_ayat"), "jns_pajak" => $dbConn->f("jns_pajak"), "jns_ayat" => $dbConn->f("jns_ayat"), "nama_ayat" => $dbConn->f("nama_ayat"), "no_kohir" => $dbConn->f("no_kohir"), "wp_name" => $dbConn->f("wp_name"), "wp_address_name" => $dbConn->f("wp_address_name"), "wp_address_no" => $dbConn->f("wp_address_no"), "npwpd" => $dbConn->f("npwpd"), "jumlah_terima" => $dbConn->f("jumlah_terima"), "masa_pajak" => $dbConn->f("masa_pajak"), "kd_tap" => $dbConn->f("kd_tap"), "keterangan" => $dbConn->f("keterangan"), "payment_date" => $dbConn->f("payment_date"), "jam" => $dbConn->f("jam"));
        }
        $dbConn->close();
        $Label1->SetText(GetCetakHTML($data));
    }
    // -------------------------
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_bphtb_registration_list_check_date;
    //Compatibility
    //End Page_BeforeShow
    //Custom Code @703-2A29BDB7
    // -------------------------
    // Write your own code here.
    global $Label1;
    if (CCGetFromGet("doAction") == "html") {
        $s_keyword = CCGetFromGet("s_keyword", "");
        $date_start_laporan = CCGetFromGet("date_start_laporan", "");
        $date_end_laporan = CCGetFromGet("date_end_laporan", "");
        $user = CCGetUserLogin();
        $data = array();
        $dbConn = new clsDBConnSIKP();
        $query = "SELECT * FROM t_payment_receipt_bphtb x\r\n\t\t\tLEFT JOIN t_bphtb_registration y ON y.t_bphtb_registration_id = x.t_bphtb_registration_id\r\n\t\t\tLEFT JOIN t_customer_order z ON y.t_customer_order_id = z.t_customer_order_id\r\n\t\t\tWHERE\r\n\t\t\t\tcheck_date IS NOT NULL\r\n\t\t\tAND wp_name ILIKE '%{$s_keyword}%'";
        if ($date_end_laporan != "" && $date_start_laporan != "") {
            $query .= "AND(check_date BETWEEN to_date ('{$date_start_laporan}') AND ('{$date_end_laporan}'))";
        } else {
            if ($date_end_laporan != "") {
                $query .= "AND(check_date <= to_date ('{$date_end_laporan}') )";
            }
            if ($date_start_laporan != "") {
                $query .= "AND(check_date >= to_date ('{$date_start_laporan}') )";
            }
        }
        $dbConn->query($query);
        while ($dbConn->next_record()) {
            $data[] = array("wp_name" => $dbConn->f("wp_name"), "order_no" => $dbConn->f("order_no"), "receipt_no" => $dbConn->f("receipt_no"), "check_date" => $dbConn->f("check_date"), "wp_address_name" => $dbConn->f("wp_address_name"), "t_payment_receipt_id" => $dbConn->f("t_payment_receipt_id"), "t_bphtb_registration_id" => $dbConn->f("t_bphtb_registration_id"), "bphtb_registration_no" => $dbConn->f("bphtb_registration_no"), "t_customer_order_id" => $dbConn->f("t_customer_order_id"), "payment_date" => $dbConn->f("payment_date"), "payment_vat_amount" => $dbConn->f("payment_vat_amount"));
        }
        $dbConn->close();
        $Label1->SetText(GetCetakHTML($data));
    }
    // -------------------------
    //End Custom Code
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_pembayaran_terakhir_wp;
    //Compatibility
    //End Page_BeforeShow
    //Custom Code @572-2A29BDB7
    // -------------------------
    // Write your own code here.
    $doAction = CCGetFromGet('doAction');
    global $Label1;
    if ($doAction == 'view_html') {
        $param_arr['npwpd'] = strtoupper(CCGetFromGet('npwpd'));
        $Label1->SetText(GetCetakHTML($param_arr));
    }
    // -------------------------
    //End Custom Code
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $history_pembayaran_wp_tidak_aktif;
    //Compatibility
    //End Page_BeforeShow
    //Custom Code @70-2A29BDB7
    // -------------------------
    // Write your own code here.
    $doAction = CCGetFromGet('doAction');
    global $Label1;
    $param_arr['t_cust_account_id'] = CCGetFromGet('t_cust_account_id');
    if ($doAction == 'view_html') {
        $Label1->SetText(GetCetakHTML($param_arr));
    }
    // -------------------------
    //End Custom Code
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_laporan_monitoring_bphtb;
    //Compatibility
    //End Page_BeforeShow
    global $Label1;
    global $t_laporan_daftar_bphtb;
    //Custom Code @10-2A29BDB7
    // -------------------------
    $param_arr = array();
    if (empty($param_arr['date_start'])) {
        $param_arr['date_start'] = CCGetFromGet('date_start');
    }
    if (empty($param_arr['date_end'])) {
        $param_arr['date_end'] = CCGetFromGet('date_end');
    }
    if (empty($param_arr['date_start']) and empty($param_arr['date_end'])) {
        return;
    }
    if (!empty($param_arr['date_start']) and empty($param_arr['date_end'])) {
        $param_arr['date_end'] = $param_arr['date_start'];
    }
    if (empty($param_arr['date_start']) and !empty($param_arr['date_end'])) {
        $param_arr['date_start'] = $param_arr['date_end'];
    }
    if (!empty($param_arr['date_start']) and !empty($param_arr['date_end'])) {
        $Label1->SetText(GetCetakHTML($param_arr));
    }
    $t_laporan_daftar_bphtb->date_start_laporan->SetValue($param_arr['date_start']);
    $t_laporan_daftar_bphtb->date_end_laporan->SetValue($param_arr['date_end']);
    // -------------------------
    //End Custom Code
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_laporan_history_potensi_piutang;
    //Compatibility
    //End Page_BeforeShow
    //Custom Code @572-2A29BDB7
    // -------------------------
    // Write your own code here.
    $doAction = CCGetFromGet('doAction');
    global $Label1;
    $param_arr['p_year_period_id'] = CCGetFromGet('p_year_period_id');
    $param_arr['p_finance_period_id'] = CCGetFromGet('p_finance_period_id');
    $param_arr['p_finance_period_id1'] = CCGetFromGet('p_finance_period_id1');
    $param_arr['p_vat_type_id'] = CCGetFromGet('p_vat_type_id', '');
    $param_arr['status_bayar'] = CCGetFromGet('ListBox1');
    $param_arr['ketetapan'] = CCGetFromGet('ListBox2', 4);
    $param_arr['tgl_penerimaan'] = CCGetFromGet('tgl_penerimaan', '');
    $param_arr['tgl_penerimaan_last'] = CCGetFromGet('tgl_penerimaan_last', '');
    $param_arr['vat_code'] = CCGetFromGet('vat_code');
    $param_arr['year_code'] = CCGetFromGet('year_code');
    $param_arr['code'] = CCGetFromGet('code');
    $param_arr['code1'] = CCGetFromGet('code1');
    if ($doAction == 'view_html') {
        $Label1->SetText(GetCetakHTML($param_arr));
    }
    if ($doAction == 'cetak_excel') {
        CetakExcel($param_arr);
    }
    // -------------------------
    //End Custom Code
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_laporan_teguran_bphtb;
    //Compatibility
    //End Page_BeforeShow
    global $Label1;
    //Custom Code @10-2A29BDB7
    // -------------------------
    // Write your own code here.
    $doAction = CCGetFromGet('doAction');
    if ($doAction == 'view_html') {
        $data = array();
        $param_arr = array();
        $param_arr['date_start'] = CCGetFromGet('date_start');
        $param_arr['date_end'] = CCGetFromGet('date_end');
        $t_laporan_teguran_bphtb->date_start_laporan->SetValue($param_arr['date_start']);
        $t_laporan_teguran_bphtb->date_end_laporan->SetValue($param_arr['date_end']);
        if (!empty($param_arr['date_start']) and !empty($param_arr['date_end'])) {
            $dbConn = new clsDBConnSIKP();
            $whereClause = '';
            if (!empty($param_arr['date_start']) && !empty($param_arr['date_end'])) {
                $whereClause .= " AND (trunc(reg_bphtb.creation_date) BETWEEN '" . $param_arr['date_start'] . "'";
                $whereClause .= " AND '" . $param_arr['date_end'] . "')";
            } else {
                if (!empty($param_arr['date_start']) && empty($param_arr['date_end'])) {
                    $whereClause .= " AND trunc(reg_bphtb.creation_date) >= '" . $param_arr['date_start'] . "'";
                } else {
                    if (empty($param_arr['date_start']) && !empty($param_arr['date_end'])) {
                        $whereClause .= " AND trunc(reg_bphtb.creation_date) <= '" . $param_arr['date_end'] . "'";
                    }
                }
            }
            $whereClause .= " AND NOT EXISTS (SELECT 1 FROM t_payment_receipt_bphtb as x WHERE x.t_bphtb_registration_id = reg_bphtb.t_bphtb_registration_id) ";
            $query = "SELECT\r\n\t\t\t\treg_bphtb.t_bphtb_registration_id,\r\n\t\t\t\tto_char(reg_bphtb.creation_date, 'YYYY-MM-DD') as creation_date,\r\n\t\t\t\tregistration_no,\r\n\t\t\t\twp_name,\r\n\t\t\t\treg_bphtb.p_bphtb_legal_doc_type_id,\r\n\t\t\t\tbphtb_doc.description,\r\n\t\t\t\tnjop_pbb,\r\n\t\t\t\tland_area,\r\n\t\t\t\tland_total_price,\r\n\t\t\t\tbuilding_area,\r\n\t\t\t\tbuilding_total_price,\r\n\t\t\t\tmarket_price,\r\n\t\t\t\tbphtb_amt_final\r\n\t\t\tFROM\r\n\t\t\t\tsikp.t_bphtb_registration reg_bphtb\r\n\t\t\tLEFT JOIN p_bphtb_legal_doc_type bphtb_doc on bphtb_doc.p_bphtb_legal_doc_type_id = reg_bphtb.p_bphtb_legal_doc_type_id\r\n\t\t\tLEFT JOIN t_customer_order cust_order ON cust_order.t_customer_order_id = reg_bphtb.t_customer_order_id \r\n\t\t\tWHERE cust_order.p_order_status_id <> 1 and bphtb_amt_final >0";
            $query .= $whereClause;
            $query .= " order by trunc(reg_bphtb.creation_date) ASC,upper(wp_name) ASC";
            $dbConn->query($query);
            while ($dbConn->next_record()) {
                $data['t_bphtb_registration_id'][] = $dbConn->f("t_bphtb_registration_id");
                $data['creation_date'][] = $dbConn->f("creation_date");
                $data['registration_no'][] = $dbConn->f("registration_no");
                $data['wp_name'][] = $dbConn->f("wp_name");
                $data['p_bphtb_legal_doc_type_id'][] = $dbConn->f("p_bphtb_legal_doc_type_id");
                $data['description'][] = $dbConn->f("description");
                $data['njop_pbb'][] = $dbConn->f("njop_pbb");
                $data['land_area'][] = $dbConn->f("land_area");
                $data['land_total_price'][] = $dbConn->f("land_total_price");
                $data['building_area'][] = $dbConn->f("building_area");
                $data['building_total_price'][] = $dbConn->f("building_total_price");
                $data['market_price'][] = $dbConn->f("market_price");
                $data['bphtb_amt_final'][] = $dbConn->f("bphtb_amt_final");
                $data['nilai_njop'][] = $dbConn->f("building_total_price") + $dbConn->f("land_total_price");
            }
            $dbConn->close();
            $Label1->SetText(GetCetakHTML($data, $param_arr['date_start'], $param_arr['date_end']));
        } else {
            /* Tampilkan Alert */
            echo '<script> alert("Filter Tanggal Harus Diisi"); </script>';
        }
    } else {
        //do nothing
    }
    // -------------------------
    //End Custom Code
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_rep_penerimaan_pertahun;
    //Compatibility
    //End Page_BeforeShow
    global $Label1;
    //Custom Code @569-2A29BDB7
    // -------------------------
    // Write your own code here.
    // -------------------------
    //End Custom Code
    $doAction = CCGetFromGet('doAction');
    if ($doAction == 'view_html') {
        $p_year_period_id = CCGetFromGet("p_year_period_id", "");
        $p_vat_type_id = CCGetFromGet("p_vat_type_id", "");
        $tgl_status = CCGetFromGet("tgl_status", "");
        $p_account_status_id = CCGetFromGet("p_account_status_id", "");
        $status_bayar = CCGetFromGet("status_bayar", "");
        if (empty($p_account_status_id)) {
            $p_account_status_id = "NULL";
        }
        if (empty($status_bayar)) {
            $status_bayar = "NULL";
        }
        $user = CCGetUserLogin();
        $data = array();
        $dbConn = new clsDBConnSIKP();
        $query = "select * from f_rep_penerimaan_pertahun_sts_new_desc({$p_year_period_id}, {$p_vat_type_id}, {$tgl_status}, {$p_account_status_id}, {$status_bayar});";
        $dbConn->query($query);
        while ($dbConn->next_record()) {
            $data["jenis_pajak"][] = $dbConn->f("jenis_pajak");
            $data["tahun"][] = $dbConn->f("tahun");
            $data["nama"][] = $dbConn->f("nama");
            $data["alamat"][] = $dbConn->f("alamat");
            $data["npwpd"][] = $dbConn->f("npwpd");
            $data["active_date"][] = $dbConn->f("active_date");
            $data["f_12_sts"][] = $dbConn->f("f_12_sts");
            $data["f_12_amt"][] = $dbConn->f("f_12_amt");
            $data["f_12_paydate"][] = $dbConn->f("f_12_paydate");
            $data["f_11_sts"][] = $dbConn->f("f_11_sts");
            $data["f_11_amt"][] = $dbConn->f("f_11_amt");
            $data["f_11_paydate"][] = $dbConn->f("f_11_paydate");
            $data["f_10_sts"][] = $dbConn->f("f_10_sts");
            $data["f_10_amt"][] = $dbConn->f("f_10_amt");
            $data["f_10_paydate"][] = $dbConn->f("f_10_paydate");
            $data["f_09_sts"][] = $dbConn->f("f_09_sts");
            $data["f_09_amt"][] = $dbConn->f("f_09_amt");
            $data["f_09_paydate"][] = $dbConn->f("f_09_paydate");
            $data["f_08_sts"][] = $dbConn->f("f_08_sts");
            $data["f_08_amt"][] = $dbConn->f("f_08_amt");
            $data["f_08_paydate"][] = $dbConn->f("f_08_paydate");
            $data["f_07_sts"][] = $dbConn->f("f_07_sts");
            $data["f_07_amt"][] = $dbConn->f("f_07_amt");
            $data["f_07_paydate"][] = $dbConn->f("f_07_paydate");
            $data["f_06_sts"][] = $dbConn->f("f_06_sts");
            $data["f_06_amt"][] = $dbConn->f("f_06_amt");
            $data["f_06_paydate"][] = $dbConn->f("f_06_paydate");
            $data["f_05_sts"][] = $dbConn->f("f_05_sts");
            $data["f_05_amt"][] = $dbConn->f("f_05_amt");
            $data["f_05_paydate"][] = $dbConn->f("f_05_paydate");
            $data["f_04_sts"][] = $dbConn->f("f_04_sts");
            $data["f_04_amt"][] = $dbConn->f("f_04_amt");
            $data["f_04_paydate"][] = $dbConn->f("f_04_paydate");
            $data["f_03_sts"][] = $dbConn->f("f_03_sts");
            $data["f_03_amt"][] = $dbConn->f("f_03_amt");
            $data["f_03_paydate"][] = $dbConn->f("f_03_paydate");
            $data["f_02_sts"][] = $dbConn->f("f_02_sts");
            $data["f_02_amt"][] = $dbConn->f("f_02_amt");
            $data["f_02_paydate"][] = $dbConn->f("f_02_paydate");
            $data["f_01_sts"][] = $dbConn->f("f_01_sts");
            $data["f_01_amt"][] = $dbConn->f("f_01_amt");
            $data["f_01_paydate"][] = $dbConn->f("f_01_paydate");
        }
        $dbConn->close();
        $Label1->SetText(GetCetakHTML($data));
    }
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_rep_lap_tingkat_kepatuhan_wp;
    //Compatibility
    //End Page_BeforeShow
    global $Label1;
    global $t_rep_sisa_piutangSearch;
    //Custom Code @566-2A29BDB7
    // -------------------------
    // Write your own code here.
    // -------------------------
    //End Custom Code
    $doAction = CCGetFromGet('doAction');
    if ($doAction == 'view_html') {
        $data = array();
        $param_arr = array();
        $param_arr['p_year_period_id'] = CCGetFromGet('p_year_period_id');
        $param_arr['p_finance_period_id'] = CCGetFromGet('p_finance_period_id');
        $param_arr['p_vat_type_id'] = CCGetFromGet('p_vat_type_id');
        $param_arr['tahun_periode'] = CCGetFromGet('tahun_periode');
        $param_arr['pajak_periode'] = CCGetFromGet('pajak_periode');
        $param_arr['jenis_pajak'] = CCGetFromGet('jenis_pajak');
        $param_arr['status'] = CCGetFromGet('status');
        $t_rep_sisa_piutangSearch->p_year_period_id->SetValue($param_arr['p_year_period_id']);
        $t_rep_sisa_piutangSearch->p_finance_period_id->SetValue($param_arr['p_finance_period_id']);
        $t_rep_sisa_piutangSearch->p_vat_type_id->SetValue($param_arr['p_vat_type_id']);
        $t_rep_sisa_piutangSearch->year_code->SetValue($param_arr['tahun_periode']);
        $t_rep_sisa_piutangSearch->code->SetValue($param_arr['pajak_periode']);
        $t_rep_sisa_piutangSearch->vat_code->SetValue($param_arr['jenis_pajak']);
        $t_rep_sisa_piutangSearch->ListBox1->SetValue($param_arr['status']);
        if (!empty($param_arr['p_finance_period_id']) and !empty($param_arr['p_vat_type_id'])) {
            $dbConn = new clsDBConnSIKP();
            if (empty($param_arr['status'])) {
                /* GLOBAL */
                $query = "SELECT * FROM f_rep_status_piutang (" . $param_arr['p_vat_type_id'] . ", " . $param_arr['p_finance_period_id'] . ", 1)";
            } else {
                if ($param_arr['status'] == '1') {
                    /* BELUM BAYAR */
                    $query = "SELECT * FROM f_rep_status_piutang (" . $param_arr['p_vat_type_id'] . ", " . $param_arr['p_finance_period_id'] . ", 1)\r\n\t\t\t\t\t\tWHERE ((f_teg1_amount is null) OR (f_teg1_amount < 1)) AND\r\n\t\t\t\t\t\t\t  ((f_teg2_amount is null) OR (f_teg2_amount < 1)) AND\r\n\t\t\t\t\t\t\t  ((f_teg3_amount is null) OR (f_teg3_amount < 1))\r\n\t\t\t\t\t\t\t  AND NOT textregexeq(f_action_sts,'^[[:digit:]]+(\\.[[:digit:]]+)?\$')\r\n\t\t\t\t\t\t\t  ";
                } else {
                    if ($param_arr['status'] == '2') {
                        /* SUDAH BAYAR */
                        $query = "SELECT *, (f_amount IS NULL AND f_teg1_amount IS NULL AND f_teg2_amount IS NULL AND f_teg3_amount IS NULL AND f_action_sts > 0) AS bayar_setelah\r\n\t\t\t\t\t\tFROM f_rep_status_piutang (" . $param_arr['p_vat_type_id'] . ", " . $param_arr['p_finance_period_id'] . ", 1)\r\n\t\t\t\t\t\tWHERE (f_teg1_amount > 0) OR \r\n\t\t\t\t\t\t\t  (f_teg2_amount > 0) OR \r\n\t\t\t\t\t\t\t  (f_teg3_amount > 0) \r\n\t\t\t\t\t\t\t  OR textregexeq(f_action_sts,'^[[:digit:]]+(\\.[[:digit:]]+)?\$')\r\n\t\t\t\t\t\t\t  ";
                    }
                }
            }
            $data = array();
            $dbConn->query($query);
            while ($dbConn->next_record()) {
                $data[] = $dbConn->Record;
            }
            $dbConn->close();
            // ----- AMBIL JATUH TEMPO ------
            $dbConn2 = new clsDBConnSIKP();
            $tgl_jatuh_tempo = '';
            $qJatuhTempo = "SELECT to_char((trunc(end_date) + due_in_day), 'yyyy-mm-dd') AS jatuh_tempo \r\n\t\t\t\t\t\t\tFROM p_finance_period \r\n\t\t\t\t\t\t\tWHERE p_finance_period_id = " . $param_arr['p_finance_period_id'];
            $dbConn2->query($qJatuhTempo);
            while ($dbConn2->next_record()) {
                $tgl_jatuh_tempo = $dbConn2->f('jatuh_tempo');
            }
            $dbConn2->close();
            $Label1->SetText(GetCetakHTML($data, $param_arr['pajak_periode'], $param_arr['jenis_pajak'], $tgl_jatuh_tempo, $param_arr['status']));
        } else {
            /* Tampilkan Alert */
            echo '<script> alert("Semua Filter Harus Diisi"); </script>';
        }
    }
    if ($doAction == 'cetak_excel') {
        $data = array();
        $param_arr = array();
        $param_arr['p_year_period_id'] = CCGetFromGet('p_year_period_id');
        $param_arr['p_finance_period_id'] = CCGetFromGet('p_finance_period_id');
        $param_arr['p_vat_type_id'] = CCGetFromGet('p_vat_type_id');
        $param_arr['tahun_periode'] = CCGetFromGet('tahun_periode');
        $param_arr['pajak_periode'] = CCGetFromGet('pajak_periode');
        $param_arr['jenis_pajak'] = CCGetFromGet('jenis_pajak');
        $param_arr['status'] = CCGetFromGet('status');
        $t_rep_sisa_piutangSearch->p_year_period_id->SetValue($param_arr['p_year_period_id']);
        $t_rep_sisa_piutangSearch->p_finance_period_id->SetValue($param_arr['p_finance_period_id']);
        $t_rep_sisa_piutangSearch->p_vat_type_id->SetValue($param_arr['p_vat_type_id']);
        $t_rep_sisa_piutangSearch->year_code->SetValue($param_arr['tahun_periode']);
        $t_rep_sisa_piutangSearch->code->SetValue($param_arr['pajak_periode']);
        $t_rep_sisa_piutangSearch->vat_code->SetValue($param_arr['jenis_pajak']);
        $t_rep_sisa_piutangSearch->ListBox1->SetValue($param_arr['status']);
        if (!empty($param_arr['p_finance_period_id']) and !empty($param_arr['p_vat_type_id'])) {
            $dbConn = new clsDBConnSIKP();
            if (empty($param_arr['status'])) {
                /* GLOBAL */
                $query = "SELECT * FROM f_rep_status_piutang (" . $param_arr['p_vat_type_id'] . ", " . $param_arr['p_finance_period_id'] . ", 1)";
            } else {
                if ($param_arr['status'] == '1') {
                    /* BELUM BAYAR */
                    $query = "SELECT * FROM f_rep_status_piutang (" . $param_arr['p_vat_type_id'] . ", " . $param_arr['p_finance_period_id'] . ", 1)\r\n\t\t\t\t\t\tWHERE ((f_teg1_amount is null) OR (f_teg1_amount < 1)) AND\r\n\t\t\t\t\t\t\t  ((f_teg2_amount is null) OR (f_teg2_amount < 1)) AND\r\n\t\t\t\t\t\t\t  ((f_teg3_amount is null) OR (f_teg3_amount < 1))\r\n\t\t\t\t\t\t\t  AND NOT textregexeq(f_action_sts,'^[[:digit:]]+(\\.[[:digit:]]+)?\$')\r\n\t\t\t\t\t\t\t  ";
                } else {
                    if ($param_arr['status'] == '2') {
                        /* SUDAH BAYAR */
                        $query = "SELECT *, (f_amount IS NULL AND f_teg1_amount IS NULL AND f_teg2_amount IS NULL AND f_teg3_amount IS NULL AND f_action_sts > 0) AS bayar_setelah\r\n\t\t\t\t\t\tFROM f_rep_status_piutang (" . $param_arr['p_vat_type_id'] . ", " . $param_arr['p_finance_period_id'] . ", 1)\r\n\t\t\t\t\t\tWHERE (f_teg1_amount > 0) OR \r\n\t\t\t\t\t\t\t  (f_teg2_amount > 0) OR \r\n\t\t\t\t\t\t\t  (f_teg3_amount > 0) \r\n\t\t\t\t\t\t\t  OR textregexeq(f_action_sts,'^[[:digit:]]+(\\.[[:digit:]]+)?\$')\r\n\t\t\t\t\t\t\t  ";
                    }
                }
            }
            $data = array();
            $dbConn->query($query);
            while ($dbConn->next_record()) {
                $data[] = $dbConn->Record;
            }
            $dbConn->close();
            // ----- AMBIL JATUH TEMPO ------
            $dbConn2 = new clsDBConnSIKP();
            $tgl_jatuh_tempo = '';
            $qJatuhTempo = "SELECT to_char((trunc(end_date) + due_in_day), 'yyyy-mm-dd') AS jatuh_tempo \r\n\t\t\t\t\t\t\tFROM p_finance_period \r\n\t\t\t\t\t\t\tWHERE p_finance_period_id = " . $param_arr['p_finance_period_id'];
            $dbConn2->query($qJatuhTempo);
            while ($dbConn2->next_record()) {
                $tgl_jatuh_tempo = $dbConn2->f('jatuh_tempo');
            }
            $dbConn2->close();
            $Label1->SetText(GetCetakHTML($data, $param_arr['pajak_periode'], $param_arr['jenis_pajak'], $tgl_jatuh_tempo, $param_arr['status']));
        } else {
            /* Tampilkan Alert */
            echo '<script> alert("Semua Filter Harus Diisi"); </script>';
        }
    } else {
        //do nothing
    }
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_rep_lap_bpps_piutang2;
    //Compatibility
    //End Page_BeforeShow
    global $Label1;
    // -------------------------
    // Write your own code here.
    $doAction = CCGetFromGet('doAction');
    if ($doAction == 'view_html') {
        $p_vat_type_id = CCGetFromGet("p_vat_type_id", "");
        $p_year_period_id = CCGetFromGet("p_year_period_id", "");
        $tgl_penerimaan = CCGetFromGet("tgl_penerimaan", "");
        $i_flag_setoran = CCGetFromGet("i_flag_setoran", "");
        $tgl_penerimaan_last = CCGetFromGet("tgl_penerimaan_last", "");
        $year_code = CCGetFromGet("year_code", "");
        $tgl_penerimaan = "'" . $tgl_penerimaan . "'";
        $tgl_penerimaan_last = "'" . $tgl_penerimaan_last . "'";
        // $p_vat_type_id		= 1;
        // $p_year_period_id	= 4;
        // $tgl_penerimaan		= '15-12-2013';
        $date_start = str_replace("'", "", $year_code);
        //$year_date = DateTime::createFromFormat('d-m-Y', $date_start)->format('Y');
        $year_date = $year_code;
        $user = CCGetUserLogin();
        $data = array();
        $dbConn = new clsDBConnSIKP();
        $jenis_laporan = CCGetFromGet("jenis_laporan", "all");
        if ($jenis_laporan == 'all') {
            $query = "select *,trunc(payment_date) \r\n\t\t\tfrom f_rep_bpps_piutang2new_mod_1({$p_vat_type_id}, {$p_year_period_id}, {$tgl_penerimaan}, {$tgl_penerimaan_last}, {$i_flag_setoran}) \r\n\t\t\torder by kode_ayat, npwpd, masa_pajak";
            //echo $query;
            //exit;
        } else {
            if ($jenis_laporan == 'piutang') {
                $border = $year_date - 1;
                $query = "select *,trunc(payment_date) \r\n\t\t\tfrom f_rep_bpps_piutang2new_mod_1({$p_vat_type_id}, {$p_year_period_id}, {$tgl_penerimaan}, {$tgl_penerimaan_last}, {$i_flag_setoran}) rep\r\n\t\tWHERE\r\n\t\t\t(\tSUBSTRING(rep.masa_pajak,22,4) < {$year_date}\r\n\t\t\t\tAND \r\n\t\t\t\t(NOT (SUBSTRING(rep.masa_pajak,22,4) = {$border}\r\n\t\t\t\tAND SUBSTRING(rep.masa_pajak,19,2) = 12))\r\n\t\t\t)\r\n\t\t\tOR\r\n\t\t\t(\r\n\t\t\t\t(SUBSTRING(rep.masa_pajak,22,4) = {$year_date}\r\n\t\t\t\tAND SUBSTRING(rep.masa_pajak,19,2) = 12)\r\n\t\t\t)\r\n\t\t\tOR\r\n\t\t\t(\r\n\t\t\t\tSUBSTRING(rep.masa_pajak,22,4) > {$year_date}\r\n\t\t\t)\r\n\t\t\torder by kode_ayat, npwpd, masa_pajak";
                //echo $query;
                //exit;
            } else {
                if ($jenis_laporan == 'murni') {
                    $query = "select *,trunc(payment_date) \r\n\t\t\tfrom f_rep_bpps_piutang3new_mod_1({$p_vat_type_id}, {$p_year_period_id}, {$tgl_penerimaan}, {$tgl_penerimaan_last}, {$i_flag_setoran}) rep\r\n\t\tWHERE\r\n\t\t\tEXTRACT (YEAR FROM rep.settlement_date) = {$year_date}\r\n\t\t\torder by kode_ayat, npwpd, masa_pajak";
                }
            }
        }
        //die($query);
        //echo $query;
        //exit;
        $dbConn->query($query);
        $tgl_penerimaan = str_replace("'", "", $tgl_penerimaan);
        $tgl_penerimaan_last = str_replace("'", "", $tgl_penerimaan_last);
        $tahun = date("Y", strtotime($tgl_penerimaan));
        while ($dbConn->next_record()) {
            $data[] = array("address" => $dbConn->f("address"), "company_name" => $dbConn->f("company_name"), "kode_jns_trans" => $dbConn->f("kode_jns_trans"), "jns_trans" => $dbConn->f("jns_trans"), "kode_jns_pajak" => $dbConn->f("kode_jns_pajak"), "kode_ayat" => $dbConn->f("kode_ayat"), "jns_pajak" => $dbConn->f("jns_pajak"), "jns_ayat" => $dbConn->f("jns_ayat"), "nama_ayat" => $dbConn->f("nama_ayat"), "no_kohir" => $dbConn->f("no_kohir"), "wp_name" => $dbConn->f("wp_name"), "wp_address_name" => $dbConn->f("wp_address_name"), "wp_address_no" => $dbConn->f("wp_address_no"), "npwpd" => $dbConn->f("npwpd"), "jumlah_terima" => $dbConn->f("jumlah_terima"), "masa_pajak" => $dbConn->f("masa_pajak"), "kd_tap" => $dbConn->f("kd_tap"), "keterangan" => $dbConn->f("keterangan"), "payment_date" => $dbConn->f("payment_date"), "jam" => $dbConn->f("jam"));
        }
        $dbConn->close();
        $Label1->SetText(GetCetakHTML($data));
    } else {
        if ($doAction == 'view_html2' || $doAction == 'view_html3') {
            $p_vat_type_id = CCGetFromGet("p_vat_type_id", "");
            $p_year_period_id = CCGetFromGet("p_year_period_id", "");
            $tgl_penerimaan = CCGetFromGet("tgl_penerimaan", "");
            $i_flag_setoran = CCGetFromGet("i_flag_setoran", "");
            $tgl_penerimaan_last = CCGetFromGet("tgl_penerimaan_last", "");
            $year_code = CCGetFromGet("year_code", "");
            $tgl_penerimaan = "'" . $tgl_penerimaan . "'";
            $tgl_penerimaan_last = "'" . $tgl_penerimaan_last . "'";
            // $p_vat_type_id		= 1;
            // $p_year_period_id	= 4;
            // $tgl_penerimaan		= '15-12-2013';
            $date_start = str_replace("'", "", $year_code);
            //$year_date = DateTime::createFromFormat('d-m-Y', $date_start)->format('Y');
            $year_date = $year_code;
            $user = CCGetUserLogin();
            $data = array();
            $dbConn = new clsDBConnSIKP();
            $jenis_laporan = CCGetFromGet("jenis_laporan", "all");
            /*
            			if($jenis_laporan == 'all'){
            				$query	= "select *
            				from f_rep_bpps_list_distinct_semua($p_vat_type_id, $p_year_period_id, $tgl_penerimaan, $tgl_penerimaan_last) order by npwpd";	
            				//echo $query;
            				//exit;
            			}else if($jenis_laporan == 'piutang'){
            				$border= $year_date-1;
            				$query	= "select *
            				from f_rep_bpps_list_distinct_non_murni($p_vat_type_id, $p_year_period_id, $tgl_penerimaan, $tgl_penerimaan_last, $i_year_date) rep order by npwpd";	
            				//echo $query;
            				//exit;
            			}else if($jenis_laporan == 'murni'){
            				$query	= "select *
            				from f_rep_bpps_list_distinct_non_murni($p_vat_type_id, $p_year_period_id, $tgl_penerimaan, $tgl_penerimaan_last, $i_year_date) rep order by npwpd";	
            			}*/
            if ($jenis_laporan == 'all') {
                $query = "select to_char(active_date,'dd-mm-yyyy') as active_date2,*,trunc(payment_date) \r\n\t\t\t\tfrom f_rep_bpps_piutang2new_mod_1({$p_vat_type_id}, {$p_year_period_id}, {$tgl_penerimaan}, {$tgl_penerimaan_last}, {$i_flag_setoran}) a\r\n\t\t\t\tleft join t_cust_account x on a.npwpd = x.npwd \r\n\t\t\t\torder by kode_ayat, npwpd, masa_pajak";
                //echo $query;
                //exit;
            } else {
                if ($jenis_laporan == 'piutang') {
                    $border = $year_date - 1;
                    $query = "select to_char(active_date,'dd-mm-yyyy') as active_date2,*,trunc(payment_date) \r\n\t\t\t\tfrom f_rep_bpps_piutang2new_mod_1({$p_vat_type_id}, {$p_year_period_id}, {$tgl_penerimaan}, {$tgl_penerimaan_last}, {$i_flag_setoran}) rep\r\n\t\t\t\tleft join t_cust_account x on rep.npwpd = x.npwd \r\n\t\t\tWHERE\r\n\t\t\t\t(\tSUBSTRING(rep.masa_pajak,22,4) < {$year_date}\r\n\t\t\t\t\tAND \r\n\t\t\t\t\t(NOT (SUBSTRING(rep.masa_pajak,22,4) = {$border}\r\n\t\t\t\t\tAND SUBSTRING(rep.masa_pajak,19,2) = 12))\r\n\t\t\t\t)\r\n\t\t\t\tOR\r\n\t\t\t\t(\r\n\t\t\t\t\t(SUBSTRING(rep.masa_pajak,22,4) = {$year_date}\r\n\t\t\t\t\tAND SUBSTRING(rep.masa_pajak,19,2) = 12)\r\n\t\t\t\t)\r\n\t\t\t\tOR\r\n\t\t\t\t(\r\n\t\t\t\t\tSUBSTRING(rep.masa_pajak,22,4) > {$year_date}\r\n\t\t\t\t)\r\n\t\t\t\torder by kode_ayat, npwpd, masa_pajak";
                    //echo $query;
                    //exit;
                } else {
                    if ($jenis_laporan == 'murni') {
                        $query = "select to_char(active_date,'dd-mm-yyyy') as active_date2,*,trunc(payment_date) \r\n\t\t\t\tfrom f_rep_bpps_piutang3new_mod_1({$p_vat_type_id}, {$p_year_period_id}, {$tgl_penerimaan}, {$tgl_penerimaan_last}, {$i_flag_setoran}) a\r\n\t\t\t\tleft join t_cust_account x on a.npwpd = x.npwd \r\n\t\t\tWHERE\r\n\t\t\t\tEXTRACT (YEAR FROM a.settlement_date) = {$year_date}\r\n\t\t\t\torder by kode_ayat, npwpd, masa_pajak";
                    }
                }
            }
            //die($query);
            //echo $query;
            //exit;
            $dbConn->query($query);
            $tgl_penerimaan = str_replace("'", "", $tgl_penerimaan);
            $tgl_penerimaan_last = str_replace("'", "", $tgl_penerimaan_last);
            $tahun = date("Y", strtotime($tgl_penerimaan));
            while ($dbConn->next_record()) {
                $data[] = array("address" => $dbConn->f("address"), "company_name" => $dbConn->f("company_name"), "kode_jns_trans" => $dbConn->f("kode_jns_trans"), "jns_trans" => $dbConn->f("jns_trans"), "kode_jns_pajak" => $dbConn->f("kode_jns_pajak"), "kode_ayat" => $dbConn->f("kode_ayat"), "jns_pajak" => $dbConn->f("jns_pajak"), "jns_ayat" => $dbConn->f("jns_ayat"), "nama_ayat" => $dbConn->f("nama_ayat"), "no_kohir" => $dbConn->f("no_kohir"), "wp_name" => $dbConn->f("company_brand"), "wp_address_name" => $dbConn->f("brand_address_name"), "wp_address_no" => $dbConn->f("brand_address_no"), "active_date2" => $dbConn->f("active_date2"), "npwpd" => $dbConn->f("npwpd"), "jumlah_terima" => $dbConn->f("jumlah_terima"), "masa_pajak" => $dbConn->f("masa_pajak"), "kd_tap" => $dbConn->f("kd_tap"), "keterangan" => $dbConn->f("keterangan"), "payment_date" => $dbConn->f("payment_date"), "jam" => $dbConn->f("jam"));
            }
            /*
            while ($dbConn->next_record()) {
            	$data[]= array(
            	"npwpd"			=> $dbConn->f("npwpd"));
            }
            */
            $dbConn->close();
            if ($doAction == 'view_html2') {
                $Label1->SetText(GetCetakHTML2($data));
            } else {
                $Label1->SetText(GetCetakHTML3($data));
            }
        } else {
            //do nothing
        }
    }
    // -------------------------
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}
function Page_BeforeShow(&$sender)
{
    $Page_BeforeShow = true;
    $Component =& $sender;
    $Container =& CCGetParentContainer($sender);
    global $t_rep_sisa_piutang;
    //Compatibility
    //End Page_BeforeShow
    global $Label1;
    global $t_rep_sisa_piutangSearch;
    //Custom Code @566-2A29BDB7
    // -------------------------
    // Write your own code here.
    // -------------------------
    //End Custom Code
    $doAction = CCGetFromGet('doAction');
    if ($doAction == 'view_html') {
        $data = array();
        $param_arr = array();
        $param_arr['p_year_period_id'] = CCGetFromGet('p_year_period_id');
        $param_arr['p_finance_period_id'] = CCGetFromGet('p_finance_period_id');
        $param_arr['p_vat_type_id'] = CCGetFromGet('p_vat_type_id');
        $param_arr['tahun_periode'] = CCGetFromGet('tahun_periode');
        $param_arr['pajak_periode'] = CCGetFromGet('pajak_periode');
        $param_arr['jenis_pajak'] = CCGetFromGet('jenis_pajak');
        $param_arr['status'] = CCGetFromGet('status');
        $t_rep_sisa_piutangSearch->p_year_period_id->SetValue($param_arr['p_year_period_id']);
        $t_rep_sisa_piutangSearch->p_finance_period_id->SetValue($param_arr['p_finance_period_id']);
        $t_rep_sisa_piutangSearch->p_vat_type_id->SetValue($param_arr['p_vat_type_id']);
        $t_rep_sisa_piutangSearch->year_code->SetValue($param_arr['tahun_periode']);
        $t_rep_sisa_piutangSearch->code->SetValue($param_arr['pajak_periode']);
        $t_rep_sisa_piutangSearch->vat_code->SetValue($param_arr['jenis_pajak']);
        $t_rep_sisa_piutangSearch->ListBox1->SetValue($param_arr['status']);
        if (!empty($param_arr['p_finance_period_id']) and !empty($param_arr['p_vat_type_id'])) {
            $dbConn = new clsDBConnSIKP();
            if (empty($param_arr['status'])) {
                /* GLOBAL */
                $query = "SELECT b.company_brand,regexp_replace(b.brand_address_name, '\r|\n', '', 'g')||' '||b.brand_address_no as alamat_merk_dagang,a.* \r\n\t\t\t\tFROM f_rep_status_piutang (" . $param_arr['p_vat_type_id'] . ", " . $param_arr['p_finance_period_id'] . ", 1) a\r\n\t\t\t\tleft join t_cust_account b on a.t_cust_account_id=b.t_cust_account_id\r\n\t\t\t\tORDER BY company_brand, npwd";
            } else {
                if ($param_arr['status'] == '1') {
                    /* BELUM BAYAR */
                    $query = "SELECT b.company_brand,regexp_replace(b.brand_address_name, '\r|\n', '', 'g')||' '||b.brand_address_no as alamat_merk_dagang,a.*\r\n\t\t\t\t\t\tFROM f_rep_status_piutang2 (" . $param_arr['p_vat_type_id'] . ", " . $param_arr['p_finance_period_id'] . ", 1) a\r\n\t\t\t\t\t\tleft join t_cust_account b on a.t_cust_account_id=b.t_cust_account_id\r\n\t\t\t\t\t\tWHERE ((f_teg1_amount is null) OR (f_teg1_amount < 1)) AND\r\n\t\t\t\t\t\t\t  ((f_teg2_amount is null) OR (f_teg2_amount < 1)) AND\r\n\t\t\t\t\t\t\t  ((f_teg3_amount is null) OR (f_teg3_amount < 1))\r\n\t\t\t\t\t\t\t  AND NOT textregexeq(f_action_sts,'^[[:digit:]]+(\\.[[:digit:]]+)?\$')\r\n\t\t\t\t\t\tORDER BY company_brand, npwd";
                } else {
                    if ($param_arr['status'] == '2') {
                        /* SUDAH BAYAR */
                        $query = "SELECT b.company_brand,regexp_replace(b.brand_address_name, '\r|\n', '', 'g')||' '||b.brand_address_no as alamat_merk_dagang,a.*, (f_amount IS NULL AND f_teg1_amount IS NULL AND f_teg2_amount IS NULL AND f_teg3_amount IS NULL AND f_action_sts > 0) AS bayar_setelah\r\n\t\t\t\t\t\tFROM f_rep_status_piutang (" . $param_arr['p_vat_type_id'] . ", " . $param_arr['p_finance_period_id'] . ", 1) a\r\n\t\t\t\t\t\tleft join t_cust_account b on a.t_cust_account_id=b.t_cust_account_id\r\n\t\t\t\t\t\tWHERE (f_teg1_amount > 0) OR \r\n\t\t\t\t\t\t\t  (f_teg2_amount > 0) OR \r\n\t\t\t\t\t\t\t  (f_teg3_amount > 0) \r\n\t\t\t\t\t\t\t  OR textregexeq(f_action_sts,'^[[:digit:]]+(\\.[[:digit:]]+)?\$')\r\n\t\t\t\t\t\tORDER BY company_brand, npwd";
                    }
                }
            }
            //echo $query;exit;
            $data = array();
            $dbConn->query($query);
            while ($dbConn->next_record()) {
                $data[] = $dbConn->Record;
            }
            $dbConn->close();
            // ----- AMBIL JATUH TEMPO ------
            $dbConn2 = new clsDBConnSIKP();
            $tgl_jatuh_tempo = '';
            $qJatuhTempo = "SELECT to_char((trunc(start_date) + due_in_day-1),'yyyy-mm-dd') AS jatuh_tempo\r\n\t\t\t\t\t\t\tFROM p_finance_period WHERE to_char(trunc(start_date),'yyyy-mm-dd') IN \r\n\t\t\t\t\t\t\t( \tSELECT to_char((trunc(end_date) + 1), 'yyyy-mm-dd') \r\n\t\t\t\t\t\t\t\tFROM p_finance_period \r\n\t\t\t\t\t\t\t\tWHERE p_finance_period_id = " . $param_arr['p_finance_period_id'] . ")";
            $dbConn2->query($qJatuhTempo);
            while ($dbConn2->next_record()) {
                $tgl_jatuh_tempo = $dbConn2->f('jatuh_tempo');
            }
            $dbConn2->close();
            $Label1->SetText(GetCetakHTML($data, $param_arr['pajak_periode'], $param_arr['jenis_pajak'], $tgl_jatuh_tempo, $param_arr['status']));
        } else {
            /* Tampilkan Alert */
            echo '<script> alert("Semua Filter Harus Diisi"); </script>';
        }
    } elseif ($doAction == 'download_excel') {
        $data = array();
        $param_arr = array();
        $param_arr['p_year_period_id'] = CCGetFromGet('p_year_period_id');
        $param_arr['p_finance_period_id'] = CCGetFromGet('p_finance_period_id');
        $param_arr['p_vat_type_id'] = CCGetFromGet('p_vat_type_id');
        $param_arr['tahun_periode'] = CCGetFromGet('tahun_periode');
        $param_arr['pajak_periode'] = CCGetFromGet('pajak_periode');
        $param_arr['jenis_pajak'] = CCGetFromGet('jenis_pajak');
        $param_arr['status'] = CCGetFromGet('status');
        $t_rep_sisa_piutangSearch->p_year_period_id->SetValue($param_arr['p_year_period_id']);
        $t_rep_sisa_piutangSearch->p_finance_period_id->SetValue($param_arr['p_finance_period_id']);
        $t_rep_sisa_piutangSearch->p_vat_type_id->SetValue($param_arr['p_vat_type_id']);
        $t_rep_sisa_piutangSearch->year_code->SetValue($param_arr['tahun_periode']);
        $t_rep_sisa_piutangSearch->code->SetValue($param_arr['pajak_periode']);
        $t_rep_sisa_piutangSearch->vat_code->SetValue($param_arr['jenis_pajak']);
        $t_rep_sisa_piutangSearch->ListBox1->SetValue($param_arr['status']);
        if (!empty($param_arr['p_finance_period_id']) and !empty($param_arr['p_vat_type_id'])) {
            $dbConn = new clsDBConnSIKP();
            if (empty($param_arr['status'])) {
                /* GLOBAL */
                $query = "SELECT b.company_brand,regexp_replace(b.brand_address_name, '\r|\n', '', 'g')||' '||b.brand_address_no as alamat_merk_dagang,a.* \r\n\t\t\t\tFROM f_rep_status_piutang (" . $param_arr['p_vat_type_id'] . ", " . $param_arr['p_finance_period_id'] . ", 1) a\r\n\t\t\t\tleft join t_cust_account b on a.t_cust_account_id=b.t_cust_account_id\r\n\t\t\t\tORDER BY company_brand, npwd";
            } else {
                if ($param_arr['status'] == '1') {
                    /* BELUM BAYAR */
                    $query = "SELECT b.company_brand,regexp_replace(b.brand_address_name, '\r|\n', '', 'g')||' '||b.brand_address_no as alamat_merk_dagang,a.*\r\n\t\t\t\t\t\tFROM f_rep_status_piutang2 (" . $param_arr['p_vat_type_id'] . ", " . $param_arr['p_finance_period_id'] . ", 1) a\r\n\t\t\t\t\t\tleft join t_cust_account b on a.t_cust_account_id=b.t_cust_account_id\r\n\t\t\t\t\t\tWHERE ((f_teg1_amount is null) OR (f_teg1_amount < 1)) AND\r\n\t\t\t\t\t\t\t  ((f_teg2_amount is null) OR (f_teg2_amount < 1)) AND\r\n\t\t\t\t\t\t\t  ((f_teg3_amount is null) OR (f_teg3_amount < 1))\r\n\t\t\t\t\t\t\t  AND NOT textregexeq(f_action_sts,'^[[:digit:]]+(\\.[[:digit:]]+)?\$')\r\n\t\t\t\t\t\tORDER BY company_brand, npwd";
                } else {
                    if ($param_arr['status'] == '2') {
                        /* SUDAH BAYAR */
                        $query = "SELECT b.company_brand,regexp_replace(b.brand_address_name, '\r|\n', '', 'g')||' '||b.brand_address_no as alamat_merk_dagang,a.*, (f_amount IS NULL AND f_teg1_amount IS NULL AND f_teg2_amount IS NULL AND f_teg3_amount IS NULL AND f_action_sts > 0) AS bayar_setelah\r\n\t\t\t\t\t\tFROM f_rep_status_piutang (" . $param_arr['p_vat_type_id'] . ", " . $param_arr['p_finance_period_id'] . ", 1) a\r\n\t\t\t\t\t\tleft join t_cust_account b on a.t_cust_account_id=b.t_cust_account_id\r\n\t\t\t\t\t\tWHERE (f_teg1_amount > 0) OR \r\n\t\t\t\t\t\t\t  (f_teg2_amount > 0) OR \r\n\t\t\t\t\t\t\t  (f_teg3_amount > 0) \r\n\t\t\t\t\t\t\t  OR textregexeq(f_action_sts,'^[[:digit:]]+(\\.[[:digit:]]+)?\$')\r\n\t\t\t\t\t\tORDER BY company_brand, npwd";
                    }
                }
            }
            $data = array();
            $dbConn->query($query);
            while ($dbConn->next_record()) {
                $data[] = $dbConn->Record;
            }
            $dbConn->close();
            // ----- AMBIL JATUH TEMPO ------
            $dbConn2 = new clsDBConnSIKP();
            $tgl_jatuh_tempo = '';
            $qJatuhTempo = "SELECT to_char((trunc(start_date) + due_in_day-1),'yyyy-mm-dd') AS jatuh_tempo\r\n\t\t\t\t\t\t\tFROM p_finance_period WHERE to_char(trunc(start_date),'yyyy-mm-dd') IN \r\n\t\t\t\t\t\t\t( \tSELECT to_char((trunc(end_date) + 1), 'yyyy-mm-dd') \r\n\t\t\t\t\t\t\t\tFROM p_finance_period \r\n\t\t\t\t\t\t\t\tWHERE p_finance_period_id = " . $param_arr['p_finance_period_id'] . ")";
            $dbConn2->query($qJatuhTempo);
            while ($dbConn2->next_record()) {
                $tgl_jatuh_tempo = $dbConn2->f('jatuh_tempo');
            }
            $dbConn2->close();
            CetakExcel($data, $param_arr['pajak_periode'], $param_arr['jenis_pajak'], $tgl_jatuh_tempo, $param_arr['status']);
        } else {
            /* Tampilkan Alert */
            echo '<script> alert("Semua Filter Harus Diisi"); </script>';
        }
    }
    //Close Page_BeforeShow @1-4BC230CD
    return $Page_BeforeShow;
}