Query("SELECT Tgl_Bayar,SUM(Total_Bayar) Total_Bayar FROM inv_beli_lunas WHERE (Tgl_Bayar BETWEEN '".$tglfrom."' AND '".$tglto."')".$tsql." GROUP BY Tgl_Bayar ORDER BY Tgl_Bayar"); } else { $db->Query("SELECT L.*,S.Nama_Sup FROM (SELECT * FROM inv_beli_lunas WHERE (Tgl_Bayar BETWEEN '".$tglfrom."' AND '".$tglto."')".$tsql.") L LEFT JOIN para_supplier S ON (S.SupID=L.SupID) ORDER BY L.Tgl_Bayar"); } } if ( $data == "print" ) { Report_Header(($tipe=="R"?"REKAP":"DETAIL")." PEMBAYARAN SUPPLIER", "Periode : ".$tglheader); $pre = new \siaupheng\fonia3\Printer\PrintHTML(); if ($tipe=="R") { $pre->add_field("No.",10,"C"); $pre->add_field("Tanggal",30,"C","sqltgl"); $pre->add_field("Keterangan",80,"L"); $pre->add_field("Jumlah",20,"R","rupiah"); $sub_tot = 0; $nomor = 0; while ($db->Next()) { $sub_tot += $db->Row("Total_Bayar"); $pre->add_value(++$nomor, $db->Row("Tgl_Bayar"), "Pembayaran Hutang Supplier", $db->Row("Total_Bayar")); } $pre->add_span(array("GRAND TOTAL",3,"R,B"),array($sub_tot,1,"R,B","rupiah")); } else { $pre->add_field("Tanggal",30,"C","sqltgl"); $pre->add_field("No. Transaksi",20,"L"); $pre->add_field("Nama Supplier",150,"L"); $pre->add_field("Jumlah",30,"R","rupiah"); $sub_tot = 0; while ($db->Next()) { $sub_tot += $db->Row("Total_Bayar"); $pre->add_value($db->Row("Tgl_Bayar"), $db->Row("No_Beli"), $db->Row("Nama_Sup"), $db->Row("Total_Bayar")); } $pre->add_span(array("GRAND TOTAL",3,"R,B"),array($sub_tot,1,"R,B","rupiah")); } $pre->add_stamp(1, true); $pre->show(); } else if ( $data == "export" ) { $xls = new SimpleXLS([ 'title'=>"Data Pembayaran Supplier", 'desc'=>"Export Data Pembayaran Supplier" ]); $xls->add_header("".$_SESSION['__WEB_APP']['REG_NAME'].""); $xls->add_header("DATA ".($tipe=="R"?"REKAP":"DETAIL")." PEMBAYARAN SUPPLIER"); $xls->add_header("Periode : ".$tglheader); if ($tipe=="R") { $xls->add_field("No.", 5, "C"); $xls->add_field("Tanggal", 12, "C", "tgl_sql2str"); $xls->add_field("Keterangan", 50, "L"); $xls->add_field("Jumlah", 15, "R,N"); $xls->add_sheet("".str_replace("S/D","-",$tglheader), true); $sub_tot = 0; $nomor = 0; while ($db->Next()) { $sub_tot += $db->Row("Total_Bayar"); $xls->add_value(++$nomor, $db->Row("Tgl_Bayar"), "Pembayaran Hutang Supplier", $db->Row("Total_Bayar")); } $xls->add_span(array("GRAND TOTAL",3,"R,B"),array($sub_tot,1,"R,B,N")); } else { $xls->add_field("Tanggal", 12, "C", "tgl_sql2str"); $xls->add_field("No. Transaksi", 15, "L"); $xls->add_field("Nama Supplier", 50, "L"); $xls->add_field("Jumlah", 15, "R,N"); $xls->add_sheet("".str_replace("S/D","-",$tglheader), true); $sub_tot = 0; while ($db->Next()) { $sub_tot += $db->Row("Total_Bayar"); $xls->add_value($db->Row("Tgl_Bayar"), $db->Row("No_Beli"), $db->Row("Nama_Sup"), $db->Row("Total_Bayar")); } $xls->add_span(array("GRAND TOTAL",3,"R,B"),array($sub_tot,1,"R,B,N")); } $xls->add_stamp(1, true); $xls->send("Data Pembayaran Supplier ".str_replace("S/D","-",$tglheader).".xlsx"); unset($xls); } else if ( $data == "default") { $form = new Form($db); $ttipe = $form->radio("_", "Tipe", "R", true, false, ["R"=>"Rekap","D"=>"Detail"]); $tcab = $form->option_db("_", "CabID", $id_cab, true, false, "para_cabang", ["CabID","Nama_Cab"], "Aktif=1 ORDER BY CabID", [0,"SEMUA CABANG"]); $tsup = $form->option_db("_", "SupID", 0, true, false, "para_supplier", ["SupID","Nama_Sup"], "Aktif=1 ORDER BY Nama_Sup", [0,"SEMUA SUPPLIER"]); $tfrom = $form->datebox("_", "Tgl_From", tgl_ymd(), true, false); $tto = $form->datebox("_", "Tgl_To", tgl_ymd(), true, false); echo '