$showtable = true;
 } else {
     if ($_GET['jns_pencarian'] == "tgl") {
         if (!empty($_POST['frm']['tgl_update'])) {
             $tgl_update = balikTgl($_POST["frm"]['tgl_update']) . " 23:59:59";
             $setTgl = balikTgl($_POST["frm"]['tgl_update']);
             $sql = "select trail.LNC as lnc,count(trail.LNC) as jml from debitur join debitur_trail trail on debitur.no_rekg_pinjaman=trail.no_rekg_pinjaman\n            join (\n            select max(tgl_update) tgl_update,no_rekg_pinjaman from debitur_trail where tgl_update <= '{$tgl_update}'  group by no_rekg_pinjaman) bb\n            on trail.no_rekg_pinjaman=bb.no_rekg_pinjaman and trail.tgl_update=bb.tgl_update\n            where 1=1 :paramwhere: group by trail.lnc";
             $sqlIMB = str_replace(":paramwhere:", "and trail.no_imb='PENDING' ", $sql);
             $sqlSIUP = str_replace(":paramwhere:", "and trail.siup='PENDING' ", $sql);
             $sqlTDP = str_replace(":paramwhere:", "and trail.tdp='PENDING' ", $sql);
             $sqlOTHERS = str_replace(":paramwhere:", "and trail.others='PENDING' ", $sql);
             //  echo "test->".$sqlSIUP;exit;
             $countIMB = pecahData($db_function->selectAllRows($sqlIMB));
             $countSIUP = pecahData($db_function->selectAllRows($sqlSIUP));
             $countTDP = pecahData($db_function->selectAllRows($sqlTDP));
             $countOTHERS = pecahData($db_function->selectAllRows($sqlOTHERS));
             // print_r($dataAJB);
             $showtable = true;
         }
     } else {
         if ($_GET['jns_pencarian'] == "point") {
             $data = $db_function->selectAllRows("select distinct tanggal from summery_legal order by tanggal desc");
             if (!empty($data)) {
                 foreach ($data as $row) {
                     $ddl_tglpoint[$row['tanggal']] = balikTgl($row['tanggal']);
                 }
             }
             $tgl_point = "";
             if (isset($_GET['tgl_point'])) {
                 $tgl_point = $_GET['tgl_point'];
                 $_POST['frm']['tgl_point'] = $tgl_point;
         $setTgl = balikTgl($_POST["frm"]['tgl_update']);
         $tgl_update = balikTgl($_POST["frm"]['tgl_update']) . " 23:59:59";
         $sql = "select trail.LNC as lnc,count(trail.LNC) as jml from debitur_trail trail \n            join (select max(tgl_update) tgl_update,no_rekg_pinjaman from debitur_trail where tgl_update <= '{$tgl_update}'  group by no_rekg_pinjaman) bb\n            on trail.no_rekg_pinjaman=bb.no_rekg_pinjaman and trail.tgl_update=bb.tgl_update\n            where 1=1 :paramwhere: group by trail.lnc";
         $sqlBPKB = str_replace(":paramwhere:", "and trail.no_bpkb='PENDING' ", $sql);
         $sqlAJB = str_replace(":paramwhere:", "and trail.no_ajb='PENDING' ", $sql);
         $sqlSHT = str_replace(":paramwhere:", "and trail.no_pengikatan='PENDING' ", $sql);
         $sqlPolisAssJiwa = str_replace(":paramwhere:", "and trail.no_polis_ass_jiwa='PENDING' ", $sql);
         $sqlPolisAssRugi = str_replace(":paramwhere:", "and trail.no_polis_ass_kerugian='PENDING' ", $sql);
         $sqlTotalDebitur = str_replace(":paramwhere:", "and trail.status_rekg='AKTIF' ", $sql);
         //  echo "test->".$sqlAJB;exit;
         $countBPKB = pecahData($db_function->selectAllRows($sqlBPKB));
         $countAJB = pecahData($db_function->selectAllRows($sqlAJB));
         $countSHT = pecahData($db_function->selectAllRows($sqlSHT));
         $countAssJiwa = pecahData($db_function->selectAllRows($sqlPolisAssJiwa));
         $countKerugian = pecahData($db_function->selectAllRows($sqlPolisAssRugi));
         $countTotalDebitur = pecahData($db_function->selectAllRows($sqlTotalDebitur));
         // print_r($dataAJB);
         $showtable = true;
     }
 } else {
     if ($_GET['jns_pencarian'] == "point") {
         $data = $db_function->selectAllRows("select distinct tanggal from summery_pending order by tanggal desc");
         if (!empty($data)) {
             foreach ($data as $row) {
                 $ddl_tglpoint[$row['tanggal']] = balikTgl($row['tanggal']);
             }
         }
         $tgl_point = "";
         if (isset($_GET['tgl_point'])) {
             $tgl_point = $_GET['tgl_point'];
             $setTgl = $tgl_point;
     $setTgl = balikTgl($_POST["frm"]['tgl_update']);
     $tgl_update = balikTgl($_POST["frm"]['tgl_update']) . " 23:59:59";
     if (!empty($_POST['frm']['tgl_update'])) {
         $sql = "select trail.LNC as lnc,count(trail.LNC) as jml from debitur join debitur_trail trail on debitur.no_rekg_pinjaman=trail.no_rekg_pinjaman\r\n            join (\r\n            select max(tgl_update) tgl_update,no_rekg_pinjaman from debitur_trail where tgl_update <= '{$tgl_update}'  group by no_rekg_pinjaman) bb\r\n            on trail.no_rekg_pinjaman=bb.no_rekg_pinjaman and trail.tgl_update=bb.tgl_update\r\n            where 1=1 and trail.skim_pencairan='PARTIAL DROW DOWN' and trail.skim_pks in('KAVLING BANGUN','INDENT') :paramwhere: group by trail.lnc";
         $sqlDebitur = str_replace(":paramwhere:", "and trail.progress <>'' ", $sql);
         $sqlFondasi = str_replace(":paramwhere:", "and trail.progress='BELUM SELESAI' and trail.tgl_cair_tahap_fondasi  in(null,'','0000-00-00') ", $sql);
         $sqlTopping = str_replace(":paramwhere:", "and trail.progress='BELUM SELESAI' and trail.tgl_cair_tahap_fondasi >'0000-00-00' and trail.tgl_cair_tahap_topping in(null,'','0000-00-00') ", $sql);
         $sqlBast = str_replace(":paramwhere:", "and trail.progress='BELUM SELESAI' and trail.tgl_cair_tahap_topping >'0000-00-00' and trail.tgl_cair_tahap_bast in(null,'','0000-00-00') ", $sql);
         $sqlTahapDok = str_replace(":paramwhere:", "and trail.progress='BELUM SELESAI' and trail.tgl_cair_tahap_bast >'0000-00-00' and trail.tgl_cair_tahap_dok in(null,'','0000-00-00') ", $sql);
         $sqlSelesai = str_replace(":paramwhere:", "and trail.progress='SELESAI' ", $sql);
         $countDebitur = pecahData($db_function->selectAllRows($sqlDebitur));
         $countFondasi = pecahData($db_function->selectAllRows($sqlFondasi));
         $countTopping = pecahData($db_function->selectAllRows($sqlTopping));
         $countBast = pecahData($db_function->selectAllRows($sqlBast));
         $countTahapDok = pecahData($db_function->selectAllRows($sqlTahapDok));
         $countSelesai = pecahData($db_function->selectAllRows($sqlSelesai));
         $showtable = true;
     }
 } else {
     if ($_GET['jns_pencarian'] == "point") {
         $data = $db_function->selectAllRows("select distinct tanggal from summery_bertahap order by tanggal desc");
         if (!empty($data)) {
             foreach ($data as $row) {
                 $ddl_tglpoint[$row['tanggal']] = balikTgl($row['tanggal']);
             }
         }
         $tgl_point = "";
         if (isset($_GET['tgl_point'])) {
             $tgl_point = $_GET['tgl_point'];
             $_POST['frm']['tgl_point'] = $tgl_point;
             $setTgl = $tgl_point;