first commit
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/keluar.php
|
||||
Desc. : PHP - Laporan Pengeluaran
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : July 17th, 2011.
|
||||
Last Modified : October 22nd, 2015.
|
||||
|
||||
(c) 2011 - 2015, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
require_once(__DIR__."/../../../../../vendor/autoload.php");
|
||||
require_once(__DIR__."/../func/ias.php");
|
||||
require_once(__DIR__."/../func/report.php");
|
||||
|
||||
use siaupheng\fonia3\DB\MySQL;
|
||||
use siaupheng\fonia3\DB\SQL;
|
||||
use siaupheng\fonia3\Web\Param;
|
||||
use siaupheng\fonia3\Web\Table;
|
||||
use siaupheng\fonia3\Web\Form;
|
||||
use siaupheng\fonia3\Printer\PrintHTML;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export" ) {
|
||||
$tipe = Param::Get("Tipe"); // R or D
|
||||
$tglfrom = Param::Get("Tgl_From");
|
||||
$tglto = Param::Get("Tgl_To");
|
||||
|
||||
// generate report header
|
||||
$tglheader = "Periode : ".$tglfrom;
|
||||
if ($tglfrom!==$tglto) $tglheader .= " S/D ".$tglto;
|
||||
$tglfrom = tgl_sql2str($tglfrom);
|
||||
$tglto = tgl_sql2str($tglto);
|
||||
|
||||
if ($tipe=="R") {
|
||||
$db->Query("SELECT DATE_FORMAT(L.Tgl_Bayar,'%d-%m-%Y') Tgl_Bayar2,IF(L.Tipe=1,'Cash','BG') Tipe_Bayar,SUM(L.Total_Bayar) Total_Bayar FROM inv_beli_lunas L WHERE (L.Tgl_Bayar BETWEEN '".$tglfrom."' AND '".$tglto."') GROUP BY L.Tgl_Bayar,L.Tipe ORDER BY L.Tgl_Bayar,L.Tipe");
|
||||
} else {
|
||||
$db->Query("SELECT L.*,DATE_FORMAT(L.Tgl_Bayar,'%d-%m-%Y') Tgl_Bayar2,DATE_FORMAT(L.Tgl_Cair,'%d-%m-%Y') Tgl_Cair2,IF(L.Tipe=1,'Cash','BG') Tipe_Bayar, S.Nama_Sup FROM inv_beli_lunas L LEFT JOIN inv_beli B ON (B.No_Beli=L.No_Beli) LEFT JOIN para_supplier S ON (S.SupID=B.SupID) WHERE (L.Tgl_Bayar BETWEEN '".$tglfrom."' AND '".$tglto."') ORDER BY L.Tgl_Bayar,L.Tipe");
|
||||
}
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN ".($tipe=="R"?"REKAP":"DETAIL")." PENGELUARAN", $tglheader);
|
||||
$pre = new PrintHTML();
|
||||
$pre->set_css("garis");
|
||||
|
||||
if ($tipe=="R") {
|
||||
$pre->add_field("NO.",10,"C");
|
||||
$pre->add_field("TANGGAL",30,"C");
|
||||
$pre->add_field("TIPE",10);
|
||||
$pre->add_field("JUMLAH",30,"R","uang");
|
||||
$pre->show_fields();
|
||||
|
||||
$tot_bayar = $nomor = 0;
|
||||
while ($db->Next()) {
|
||||
$nomor++;
|
||||
$tot_bayar += $db->Row("Total_Bayar");
|
||||
$pre->add_value($nomor, $db->Row("Tgl_Bayar2"), $db->Row("Tipe_Bayar"), $db->Row("Total_Bayar"));
|
||||
}
|
||||
$pre->add_span(array("GRAND TOTAL",3,"L,B"),array($tot_bayar,1,"R,B","uang"));
|
||||
|
||||
} else {
|
||||
$pre->add_field("TANGGAL",30,"C");
|
||||
$pre->add_field("BAYAR KEPADA",150);
|
||||
$pre->add_field("TIPE",10);
|
||||
$pre->add_field("TGL. CAIR BG",30,"C");
|
||||
$pre->add_field("JUMLAH",30,"R","uang");
|
||||
$pre->show_fields();
|
||||
|
||||
$tot_bayar = 0;
|
||||
while ($db->Next()) {
|
||||
$tot_bayar += $db->Row("Total_Bayar");
|
||||
$pre->add_value($db->Row("Tgl_Bayar2"), $db->Row("No_Beli")." - ".$db->Row("Nama_Sup"), $db->Row("Tipe_Bayar"), $db->Row("Tgl_Cair2"), $db->Row("Total_Bayar"));
|
||||
}
|
||||
$pre->add_span(array("GRAND TOTAL",4,"L,B"),array($tot_bayar,1,"R,B","uang"));
|
||||
}
|
||||
$pre->add_stamp(1, true);
|
||||
$pre->show();
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$form = new Form($db);
|
||||
$ttipe = $form->radio("_", "Tipe", "R", true, false, ["R"=>"Rekap","D"=>"Detail"]);
|
||||
$ttglfrom = $form->datebox("_", "Tgl_From", tgl_ymd(), true, false);
|
||||
$ttglto = $form->datebox("_", "Tgl_To", tgl_ymd(), true, false);
|
||||
echo '
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Tipe">Tipe Laporan</label>
|
||||
<div class="col">'.$ttipe.'</div>
|
||||
</div>
|
||||
<div class="row mb-1"><div class="col"><hr class="my-1"></div></div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Tgl_From">Dari Tanggal</label>
|
||||
<div class="col">'.$ttglfrom.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Tgl_To">Sampai Tanggal</label>
|
||||
<div class="col">'.$ttglto.'</div>
|
||||
</div>';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user