0) { $db->Query("SELECT * FROM para_outlet_grup WHERE Grup_OutletID='".$id_outlet."'"); if ($db->Next()) $aout = $db->AllRow(); } if ($id_grup>0) { $db->Query("SELECT * FROM inv_produk_grup WHERE Grup_InvID='".$id_grup."'"); if ($db->Next()) $agrup = $db->AllRow(); } if ($aktif<>"X") $nama_aktif = ($aktif=="Y") ? "AKTIF" : "TIDAK AKTIF"; // generate report header $tglheader = "Tanggal Cetak : ".Param::Get("Tgl_Cetak"); $tsql = ($id_outlet==0) ? "" : " AND O.Grup_OutletID='".$id_outlet."'"; $tsql .= ($id_grup==0) ? "" : " AND P.Grup_InvID='".$id_grup."'"; $tsql .= ($aktif=="X") ? "" : " AND O.Aktif='".(($aktif=="Y")?1:0)."'"; $tsql = ($tsql == "") ? " TRUE" : substr($tsql,4); $ljoin = ($id_grup==0) ? "" : " LEFT JOIN inv_jual J ON (J.OutletID=O.OutletID) LEFT JOIN inv_detail D ON (D.No_Ref=J.No_Jual) LEFT JOIN inv_produk P ON (P.InvID=D.InvID)"; $lgrup = ($id_grup==0) ? "" : " GROUP BY O.OutletID"; // query data laporan $db->Query("SELECT O.*,IF(O.No_NPWP=0,O.No_NIK,O.No_NPWP) No_NPWP_NIK FROM para_outlet O ".$ljoin." WHERE ".$tsql." ".$lgrup." ORDER BY O.Nama_Outlet"); } if ( $data == "print" ) { Report_Header("LAPORAN DAFTAR OUTLET", $tglheader); if ($id_outlet>0) $header = '

Nama Grup Outlet : '.$aout['Nama_Grup'].'

'; if ($id_grup>0) $header .= '

Nama Grup Produk : '.$agrup['Nama_Grup'].'

'; if ($aktif<>"X") $header .= '

Status Aktif : '.$nama_aktif.'

'; $header .= ''; $_line = ''; $body = ''; $nomor = 1; while ($db->Next()) { $body .= sprintf($_line, $nomor, $db->Row("Nama_Outlet"), $db->Row("No_NPWP_NIK"), $db->Row("Alamat_Outlet"), $db->Row("Kota_Outlet")); $nomor++; } echo $header . $body . "
No.Nama OutletNPWPAlamatKota
%s%s%s%s%s
" . Report_Stamp(1, true); } else if ( $data == "export" ) { $excel = Excel::create(['Daftar Outlet']); $excel->setCompany($_SESSION['__WEB_APP']['REG_NAME']); $excel->setAuthor($_SESSION['__WEB_APP']['APP_NAMES']); $sheet = $excel->getSheet(); $rep_header = [ 'font' => ['style' => 'bold'], 'text-align' => 'center', 'vertical-align' => 'center' ]; $sheet->writeTo('A1:E1', $_SESSION['__WEB_APP']['REG_NAME'], $rep_header); $sheet->writeTo('A2:E2', "LAPORAN DAFTAR OUTLET", $rep_header); $sheet->writeTo('A3:E3', $tglheader, $rep_header); $sheet->nextRow(); if ($id_outlet>0) $sheet->writeRow(["Nama Grup Outlet : ".$aout['Nama_Grup']]); if ($id_grup>0) $sheet->writeRow(["Nama Grup Produk : ".$agrup['Nama_Grup']]); if ($aktif<>"X") $sheet->writeRow(["Status Aktif : ".$nama_aktif]); $tab_header = [ 'font' => ['style' => 'bold'], 'text-align' => 'center', 'vertical-align' => 'center', 'fill' => '#ddd' ]; $sheet->writeHeader(['No', 'Nama Outlet', 'NPWP', 'Alamat', 'Kota'], $tab_header); $sheet->setColOptions([ 'A' => ['format' => "@integer", 'width' => 8], 'B' => ['format' => "@text", 'width' => 25], 'C' => ['format' => "@text", 'width' => 25], 'D' => ['format' => "@text", 'width' => 80], 'E' => ['format' => "@text", 'width' => 15], ]); $nomor = 1; while ($db->Next()) { $sheet->writeRow([$nomor++, $db->Row("Nama_Outlet"), $db->Row("No_NPWP_NIK"), $db->Row("Alamat_Outlet"), $db->Row("Kota_Outlet")]); } $excel->output("Daftar Outlet.xlsx"); } else if ( $data == "default") { $form = new Form($db); $form->option_db("Grup Outlet", "Grup_OutletID", 0, true, false, "para_outlet_grup", ["Grup_OutletID","Nama_Grup"], "Aktif=1 ORDER BY Nama_Grup", [0,"SEMUA GRUP OUTLET"]); $form->option_db("Grup Produk", "Grup_InvID", 0, true, false, "inv_produk_grup", ["Grup_InvID","Nama_Grup"], "Aktif=1 ORDER BY Nama_Grup", [0,"SEMUA GRUP PRODUK"]); $form->radio("Status Aktif", "Aktif", "X", true, false, ['Y'=>"Ya",'N'=>"Tidak",'X'=>"Semua"]); $form->datebox("Tanggal Cetak", "Tgl_Cetak", tgl_ymd(), true, false); $form->show(' _Grup_OutletID_ _Grup_InvID_ _Aktif_ _Tgl_Cetak_ '); } ?>