first commit
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/beli.php
|
||||
Desc. : PHP - Laporan Pembelian
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : April 12th, 2011.
|
||||
Last Modified : July 4th, 2023.
|
||||
|
||||
(c) 2011 - 2023, 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\Form;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export" ) {
|
||||
$tipe = Param::Get("Tipe"); // R or D
|
||||
$id_sup = Param::Get("SupID", 0);
|
||||
$tglfrom = Param::Get("Tgl_From");
|
||||
$tglto = Param::Get("Tgl_To");
|
||||
$asup = [];
|
||||
if ($id_sup > 0) {
|
||||
$db->Query("SELECT * FROM para_supplier WHERE SupID='".$id_sup."' LIMIT 1");
|
||||
if ($db->Next()) $asup = $db->AllRow();
|
||||
}
|
||||
|
||||
// generate report header
|
||||
$tglheader = "Periode : ".$tglfrom;
|
||||
if ($tglfrom!==$tglto) $tglheader .= " s/d ".$tglto;
|
||||
$tglfrom = tgl_sql2str($tglfrom);
|
||||
$tglto = tgl_sql2str($tglto);
|
||||
|
||||
$tsql = ($id_sup>0) ? " AND SupID='".$id_sup."'" : "";
|
||||
|
||||
// query data laporan
|
||||
if ($tipe=="R") {
|
||||
$db->Query("SELECT B.*,S.Nama_Sup FROM (SELECT SupID,SUM(Total_Beli) Total_Beli,SUM(Total_Diskon) Total_Diskon,SUM(Total_Beli-Total_Diskon) Total FROM inv_beli WHERE Data_Beli=1 AND (Tgl_Beli BETWEEN '".$tglfrom."' AND '".$tglto."')".$tsql." GROUP BY SupID) B LEFT JOIN para_supplier S ON (B.SupID=S.SupID) ORDER BY S.Nama_Sup");
|
||||
} else {
|
||||
$db->Query("SELECT B.*,DATE_FORMAT(B.Tgl_Beli,'%d-%m-%Y') Tgl_Beli2,B.Total_Beli-B.Total_Diskon Total,S.Nama_Sup FROM (SELECT * FROM inv_beli WHERE Data_Beli=1 AND (Tgl_Beli BETWEEN '".$tglfrom."' AND '".$tglto."')".$tsql.") B LEFT JOIN para_supplier S ON (B.SupID=S.SupID) ORDER BY B.No_Beli");
|
||||
}
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN ".($tipe=="R"?"REKAP":"DETAIL")." PEMBELIAN", $tglheader);
|
||||
|
||||
if ($id_sup>0) $header = "Nama Supplier : ".$asup['Nama_Sup'];
|
||||
if ($tipe=="R") {
|
||||
$header .= '<table class="garis"><thead><tr><th>No.</th><th>Nama Supplier</th><th>Sub. Total</th><th>Diskon</th><th>Total</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="c">%s</td><td>%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td></tr>';
|
||||
$_sline = '<tr><td class="c b" colspan="2">%s</td><td class="r b">%s</td><td class="r b">%s</td><td class="r b">%s</td></tr>';
|
||||
|
||||
$body = ''; $nomor = 1; $subtotal = 0; $diskon = 0;
|
||||
while ($db->Next()) {
|
||||
$subtotal += $db->Row("Total_Beli");
|
||||
$diskon += $db->Row("Total_Diskon");
|
||||
$body .= sprintf($_line, $nomor++, $db->Row("Nama_Sup"), rupiah2($db->Row("Total_Beli")), rupiah2($db->Row("Total_Diskon")), rupiah2($db->Row("Total")));
|
||||
}
|
||||
$body .= sprintf($_sline, "Jumlah", rupiah2($subtotal), rupiah2($diskon), rupiah2($subtotal-$diskon));
|
||||
|
||||
} else {
|
||||
$header .= '<table class="garis"><thead><tr><th>No. Nota</th><th>Tgl. Nota</th><th>No. Faktur</th><th>Nama Supplier</th><th>Sub. Total</th><th>Diskon</th><th>Total</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="c">%s</td><td class="c">%s</td><td>%s</td><td>%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td></tr>';
|
||||
$_sline = '<tr><td class="c b" colspan="4">%s</td><td class="r b">%s</td><td class="r b">%s</td><td class="r b">%s</td></tr>';
|
||||
|
||||
$body = ''; $subtotal = 0; $diskon = 0;
|
||||
while ($db->Next()) {
|
||||
$subtotal += $db->Row("Total_Beli");
|
||||
$diskon += $db->Row("Total_Diskon");
|
||||
$body .= sprintf($_line, $db->Row("No_Beli"), $db->Row("Tgl_Beli2"), $db->Row("No_Faktur"), $db->Row("Nama_Sup"), rupiah2($db->Row("Total_Beli")), rupiah2($db->Row("Total_Diskon")), rupiah2($db->Row("Total")));
|
||||
}
|
||||
$body .= sprintf($_sline, "Jumlah", rupiah2($subtotal), rupiah2($diskon), rupiah2($subtotal-$diskon));
|
||||
}
|
||||
|
||||
echo $header . $body . "</tbody></table>" . Report_Stamp(1, true);
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$form = new Form($db);
|
||||
$form->radio("Tipe Laporan", "Tipe", "R", true, false, ["R"=>"Rekap","D"=>"Detail"]);
|
||||
$form->option_db("Nama Supplier", "SupID", 0, true, false, "para_supplier", ["SupID","Nama_Sup"], "TRUE ORDER BY Nama_Sup", [0,"SEMUA SUPPLIER"]);
|
||||
$form->datebox("Dari Tanggal", "Tgl_From", tgl_ymd(), true, false);
|
||||
$form->datebox("Sampai Tanggal", "Tgl_To", tgl_ymd(), true, false);
|
||||
$form->show(' _Tipe_ _SupID_ _Tgl_From_ _Tgl_To_ ');
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/beli_retur.php
|
||||
Desc. : PHP - Laporan Retur Pembelian
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : April 12th, 2011.
|
||||
Last Modified : July 4th, 2023.
|
||||
|
||||
(c) 2011 - 2023, 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\Form;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export" ) {
|
||||
$tipe = Param::Get("Tipe"); // R or D
|
||||
$id_sup = Param::Get("SupID", 0);
|
||||
$tglfrom = Param::Get("Tgl_From");
|
||||
$tglto = Param::Get("Tgl_To");
|
||||
$asup = [];
|
||||
if ($id_sup > 0) {
|
||||
$db->Query("SELECT * FROM para_supplier WHERE SupID='".$id_sup."' LIMIT 1");
|
||||
if ($db->Next()) $asup = $db->AllRow();
|
||||
}
|
||||
|
||||
// generate report header
|
||||
$tglheader = "Periode : ".$tglfrom;
|
||||
if ($tglfrom!==$tglto) $tglheader .= " s/d ".$tglto;
|
||||
$tglfrom = tgl_sql2str($tglfrom);
|
||||
$tglto = tgl_sql2str($tglto);
|
||||
|
||||
$tsql = ($id_sup>0) ? " AND SupID='".$id_sup."'" : "";
|
||||
|
||||
// query data laporan
|
||||
if ($tipe=="R") {
|
||||
$db->Query("SELECT B.*,S.Nama_Sup FROM (SELECT SupID,SUM(-Total_Beli) Total_Retur FROM inv_beli WHERE Data_Beli=0 AND (Tgl_Beli BETWEEN '".$tglfrom."' AND '".$tglto."')".$tsql." GROUP BY SupID) B LEFT JOIN para_supplier S ON (B.SupID=S.SupID) ORDER BY S.Nama_Sup");
|
||||
} else {
|
||||
$db->Query("SELECT B.*,DATE_FORMAT(B.Tgl_Beli,'%d-%m-%Y') Tgl_Beli2,-B.Total_Beli Retur,S.Nama_Sup FROM (SELECT * FROM inv_beli WHERE Data_Beli=0 AND (Tgl_Beli BETWEEN '".$tglfrom."' AND '".$tglto."')".$tsql.") B LEFT JOIN para_supplier S ON (B.SupID=S.SupID) ORDER BY B.No_Beli");
|
||||
}
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN ".($tipe=="R"?"REKAP":"DETAIL")." RETUR PEMBELIAN", $tglheader);
|
||||
|
||||
if ($id_sup>0) $header = "Nama Supplier : ".$asup['Nama_Sup'];
|
||||
if ($tipe=="R") {
|
||||
$header .= '<table class="garis"><thead><tr><th>No.</th><th>Nama Supplier</th><th>Total</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="c">%s</td><td>%s</td><td class="r">%s</td></tr>';
|
||||
$_sline = '<tr><td class="c b" colspan="2">%s</td><td class="r b">%s</td></tr>';
|
||||
|
||||
$body = ''; $nomor = 1; $subtotal = 0;
|
||||
while ($db->Next()) {
|
||||
$subtotal += $db->Row("Total_Retur");
|
||||
$body .= sprintf($_line, $nomor++, $db->Row("Nama_Sup"), rupiah2($db->Row("Total_Retur")));
|
||||
}
|
||||
$body .= sprintf($_sline, "Jumlah", rupiah2($subtotal));
|
||||
|
||||
} else {
|
||||
$header .= '<table class="garis"><thead><tr><th>No. Nota</th><th>Tgl. Nota</th><th>Nama Supplier</th><th>Total</th><th>Catatan</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="c">%s</td><td class="c">%s</td><td>%s</td><td class="r">%s</td><td>%s</td></tr>';
|
||||
$_sline = '<tr><td class="c b" colspan="3">%s</td><td class="r b">%s</td><td class="r b">%s</td></tr>';
|
||||
|
||||
$body = ''; $subtotal = 0;
|
||||
while ($db->Next()) {
|
||||
$subtotal += $db->Row("Retur");
|
||||
|
||||
$body .= sprintf($_line, $db->Row("No_Beli"), $db->Row("Tgl_Beli2"), $db->Row("Nama_Sup"), rupiah2($db->Row("Retur")), $db->Row("No_Faktur"));
|
||||
}
|
||||
$body .= sprintf($_sline, "Jumlah", rupiah2($subtotal), "");
|
||||
}
|
||||
|
||||
echo $header . $body . "</tbody></table>" . Report_Stamp(1, true);
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$form = new Form($db);
|
||||
$form->radio("Tipe Laporan", "Tipe", "R", true, false, ["R"=>"Rekap","D"=>"Detail"]);
|
||||
$form->option_db("Nama Supplier", "SupID", 0, true, false, "para_supplier", ["SupID","Nama_Sup"], "TRUE ORDER BY Nama_Sup", [0,"SEMUA SUPPLIER"]);
|
||||
$form->datebox("Dari Tanggal", "Tgl_From", tgl_ymd(), true, false);
|
||||
$form->datebox("Sampai Tanggal", "Tgl_To", tgl_ymd(), true, false);
|
||||
$form->show(' _Tipe_ _SupID_ _Tgl_From_ _Tgl_To_ ');
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,136 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/bonus_supir.php
|
||||
Desc. : PHP - Laporan Bonus Penjualan Supir
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : June 8th, 2011.
|
||||
Last Modified : July 10th, 2021.
|
||||
|
||||
(c) 2011 - 2021, 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);
|
||||
|
||||
$tsql = " AND P.Grup_InvID<>".$_SESSION['__APP_IAS']['GRUP_PRODUK_KEMASAN']." AND P.Grup_InvID<>".$_SESSION['__APP_IAS']['GRUP_PRODUK_HADIAH'];
|
||||
|
||||
if ($tipe=="R") {
|
||||
$db->Query("SELECT D.PegID,S.Nama_Satuan,SUM(D.Qty) Qty,G.Nama_Pegawai FROM (SELECT D.InvID,D.SatuanID,SUM(IFNULL(-D.Qty/D.Person,0)) Qty,SUBSTRING_INDEX(SUBSTRING_INDEX(D.Picker2,',',P.PegID),',',-1) PegID FROM para_pegawai P INNER JOIN (SELECT A.*,IF(B.SupirID>0,1,0)+IF(B.A_Picker='0',0,LENGTH(B.A_Picker)-LENGTH(REPLACE(B.A_Picker,',',''))+1) Person,CONCAT(B.SupirID,',',B.A_Picker) Picker2 FROM (SELECT * FROM inv_detail USE INDEX (NO_REF) WHERE (Tgl_Ref BETWEEN '".$tglfrom."' AND '".$tglto."') AND Promo=0) A LEFT JOIN (SELECT * FROM inv_jual WHERE (Tgl_Jual BETWEEN '".$tglfrom."' AND '".$tglto."') AND Rekap=1 AND SupirID>0) B ON (A.No_Ref=B.No_Jual)) D ON (CHAR_LENGTH(D.Picker2)-CHAR_LENGTH(REPLACE(D.Picker2,',',''))>=P.PegID-1) GROUP BY D.InvID,D.SatuanID,SUBSTRING_INDEX(SUBSTRING_INDEX(D.Picker2,',',P.PegID),',',-1)) D LEFT JOIN inv_produk P ON (P.InvID=D.InvID) LEFT JOIN para_satuan S ON (S.SatuanID=D.SatuanID) LEFT JOIN para_pegawai G ON (G.PegID=D.PegID) WHERE D.PegID>0".$tsql." GROUP BY D.PegID,D.SatuanID ORDER BY G.Nama_Pegawai");
|
||||
} else {
|
||||
$db->Query("SELECT D.PegID,P.Nama_Produk,S.Nama_Satuan,SUM(D.Qty) Qty,G.Nama_Pegawai FROM (SELECT D.InvID,D.SatuanID,SUM(IFNULL(-D.Qty/D.Person,0)) Qty,SUBSTRING_INDEX(SUBSTRING_INDEX(D.Picker2,',',P.PegID),',',-1) PegID FROM para_pegawai P INNER JOIN (SELECT A.*,IF(B.SupirID>0,1,0)+IF(B.A_Picker='0',0,LENGTH(B.A_Picker)-LENGTH(REPLACE(B.A_Picker,',',''))+1) Person,CONCAT(B.SupirID,',',B.A_Picker) Picker2 FROM (SELECT * FROM inv_detail USE INDEX (NO_REF) WHERE (Tgl_Ref BETWEEN '".$tglfrom."' AND '".$tglto."') AND Promo=0) A LEFT JOIN (SELECT * FROM inv_jual WHERE (Tgl_Jual BETWEEN '".$tglfrom."' AND '".$tglto."') AND Rekap=1 AND SupirID>0) B ON (A.No_Ref=B.No_Jual)) D ON (CHAR_LENGTH(D.Picker2)-CHAR_LENGTH(REPLACE(D.Picker2,',',''))>=P.PegID-1) GROUP BY D.InvID,D.SatuanID,SUBSTRING_INDEX(SUBSTRING_INDEX(D.Picker2,',',P.PegID),',',-1)) D LEFT JOIN inv_produk P ON (P.InvID=D.InvID) LEFT JOIN para_satuan S ON (S.SatuanID=D.SatuanID) LEFT JOIN para_pegawai G ON (G.PegID=D.PegID) WHERE D.PegID>0".$tsql." GROUP BY D.PegID,D.InvID,D.SatuanID ORDER BY D.PegID");
|
||||
}
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN ".($tipe=="R"?"REKAP":"DETAIL")." BONUS PENJUALAN SUPIR & PICKER", $tglheader);
|
||||
$pre = new PrintHTML();
|
||||
$pre->set_css("garis");
|
||||
|
||||
if ($tipe=="R") {
|
||||
$pre->add_field("NO.", 40, "C", "uang");
|
||||
$pre->add_field("NAMA SUPIR / PICKER", 200);
|
||||
$pre->add_field("JUMLAH", 100);
|
||||
$pre->show_fields();
|
||||
|
||||
$nomor = 1; $arekap = array();
|
||||
while ($db->Next()) {
|
||||
$arekap[$db->Row("Nama_Pegawai")][$db->Row("Nama_Satuan")] += $db->Row("Qty");
|
||||
}
|
||||
foreach ($arekap as $nama => $ket) {
|
||||
$ket_tot = "";
|
||||
foreach ($ket as $key => $val) {
|
||||
if ($val > 0) $ket_tot .= " / ".uang($val,2)." ".strtoupper($key);
|
||||
}
|
||||
$ket_tot = substr($ket_tot, 3);
|
||||
$pre->add_value( $nomor, $nama, $ket_tot );
|
||||
$nomor++;
|
||||
}
|
||||
|
||||
} else {
|
||||
$pre->add_field("NO.", 40, "C", "uang");
|
||||
$pre->add_field("NAMA PRODUK", 320);
|
||||
$pre->add_field("QTY", 60, "R");
|
||||
$pre->add_field("SATUAN", 80);
|
||||
|
||||
$nomor = 1; $supir = ""; $atot = array();
|
||||
while ($db->Next()) {
|
||||
if ($supir <> $db->Row("PegID")) {
|
||||
if ($supir <> "") {
|
||||
$ket_tot = "";
|
||||
foreach ($atot as $key => $val) {
|
||||
if ($val > 0) $ket_tot .= " / ".uang($val,2)." ".strtoupper($key);
|
||||
}
|
||||
$atot = array();
|
||||
$ket_tot = substr($ket_tot, 3);
|
||||
$pre->add_span(array("TOTAL BONUS : ".$ket_tot,4,"C,B"));
|
||||
$pre->add_span(array(" ",4,"L,NB"));
|
||||
$nomor = 1;
|
||||
}
|
||||
$pre->add_span(array("Nama Supir / Picker : ".$db->Row("Nama_Pegawai"),4,"L"));
|
||||
$pre->show_fields();
|
||||
}
|
||||
$pre->add_value( $nomor, $db->Row("Nama_Produk"), uang($db->Row("Qty"),2), $db->Row("Nama_Satuan") );
|
||||
$supir = $db->Row("PegID");
|
||||
$atot[$db->Row("Nama_Satuan")] += $db->Row("Qty");
|
||||
$nomor++;
|
||||
}
|
||||
$ket_tot = "";
|
||||
foreach ($atot as $key => $val) {
|
||||
if ($val > 0) $ket_tot .= " / ".uang($val,2)." ".strtoupper($key);
|
||||
}
|
||||
$ket_tot = substr($ket_tot, 3);
|
||||
$pre->add_span(array("TOTAL BONUS : ".$ket_tot,4,"C,B"));
|
||||
}
|
||||
$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>';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,399 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/fp.php
|
||||
Desc. : PHP - Cetak Faktur Pajak
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : April 12th, 2011.
|
||||
Last Modified : December 27th, 2024.
|
||||
|
||||
(c) 2011 - 2024, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
require_once(__DIR__."/../../../../../vendor/autoload.php");
|
||||
require_once(__DIR__."/../func/ias.php");
|
||||
|
||||
use siaupheng\fonia3\DB\MySQL;
|
||||
use siaupheng\fonia3\Web\Param;
|
||||
|
||||
function fp_jual($db, $nota="") {
|
||||
if (trim($nota)=="") return;
|
||||
$html = '
|
||||
<htmlpagefooter name="RepFoot">
|
||||
<table width="100%" style="border:none;"><tr><td width="95%" style="text-align:left;border:none;">PEMBERITAHUAN: Faktur Pajak ini telah dilaporkan ke Direktorat Jenderal Pajak dan telah memperoleh persetujuan sesuai dengan ketentuan peraturan perpajakan yang berlaku. PERINGATAN: PKP yang menerbitkan Faktur Pajak yang tidak sesuai dengan keadaan yang sebenarnya dan/atau sesungguhnya sebagaimana dimaksud Pasal 13 ayat (9) UU PPN dikenai sanksi sesuai dengan Pasal 14 ayat (4) UU KUP</td><td width="50%" style="text-align:right;font-style:italic;border:none;">{PAGENO} dari {nbpg}</td></tr></table>
|
||||
</htmlpagefooter>
|
||||
<sethtmlpagefooter name="RepFoot" show-this-page="1" value="on" />
|
||||
<table class="judul" style="width:100%;" borderspacing="0">
|
||||
<tr><td class="center" style="font-size:15pt;">Faktur Pajak</td></tr>
|
||||
<tr><td class="line">Kode dan Nomor Seri Faktur Pajak : _NO_PAJAK_</td></tr>
|
||||
<tr><td class="line">Pengusaha Kena Pajak</td></tr>
|
||||
<tr>
|
||||
<td class="line">
|
||||
<table width="100%">
|
||||
<tr><td width="50" class="left">Nama</td><td width="5" class="center">:</td><td class="left">_REG_NAME_</td></tr>
|
||||
<tr><td class="left">Alamat</td><td class="center">:</td><td class="left">_REG_ADDRESS_ _REG_CITY_</td></tr>
|
||||
<tr><td class="left">NPWP</td><td class="center">:</td><td class="left">_REG_NPWP_</td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td class="line">Pembeli Barang Kena Pajak / Penerima Jasa Kena Pajak</td></tr>
|
||||
<tr>
|
||||
<td class="line">
|
||||
<table width="100%">
|
||||
<tr><td width="50" class="left">Nama</td><td width="5" class="center">:</td><td class="left">_OUT_NAME_</td></tr>
|
||||
<tr><td class="left">Alamat</td><td class="center">:</td><td class="left">_OUT_ADDRESS_ _OUT_CITY_</td></tr>
|
||||
<tr><td class="left">NPWP</td><td class="center">:</td><td class="left">_OUT_NPWP_</td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="pdf_cont">
|
||||
<table><thead>
|
||||
<tr><th style="width:5%;">No.</th><th>Nama Barang Kena Pajak / Jasa Kena Pajak</th><th style="width:25%;">Harga Jual/Penggantian/Uang<br>Muka/Termin</th></tr>
|
||||
</thead><tbody>';
|
||||
$_line = '<tr><td class="center">%s</td><td class="left">%s</td><td class="right">%s</td></tr>';
|
||||
|
||||
$_foot = '
|
||||
</tbody></table>
|
||||
<table>
|
||||
<tr><td class="left">Harga Jual / Penggantian</td><td class="right" style="width:25%;">_TOT_INVOICE_</td></tr>
|
||||
<tr><td class="left">Dikurangi Potongan Harga</td><td class="right">_TOT_DISC_</td></tr>
|
||||
<tr><td class="left">Dikurangi Uang Muka</td><td class="right">_TOT_DP_</td></tr>
|
||||
<tr><td class="left">Dasar Pengenaan Pajak</td><td class="right">_TOT_BTAX_</td></tr>
|
||||
<tr><td class="left">Total PPN = _PPN_STRING_% x Dasar Pengenaan Pajak</td><td class="right">_TOT_TAX_</td></tr>
|
||||
<tr><td class="left">Total PPnBM (Pajak Penjualan Barang Mewah)</td><td class="right">0,00</td></tr>
|
||||
</table>
|
||||
<span style="font-size:8pt;">Sesuai dengan ketentuan yang berlaku, Direktorat Jenderal Pajak mengatur bahwa Faktur Pajak ini telah ditandatangani secara elektronik sehingga tidak diperlukan tanda tangan basah pada Faktur Pajak ini.</span><br />
|
||||
<table width="100%" style="border:0;">
|
||||
<tr><td style="width:50%;border:0;"> </td><td style="border:0;">_REG_CITY_, _TGL_PAJAK_<br><br><br><br><br>_REG_OWNER_</td></tr>
|
||||
</table>
|
||||
</div>';
|
||||
|
||||
$db->Query("SELECT *,DATE_FORMAT(Tgl_Pajak,'%d-%m-%Y') Tgl_Pajak2 FROM inv_jual_pajak WHERE No_Pajak='".$nota."'");
|
||||
if ($db->Next()) $ainfo = $db->AllRow();
|
||||
if (intval($ainfo['OutletID'])>0) {
|
||||
$db->Query("SELECT * FROM para_outlet WHERE OutletID='".$ainfo['OutletID']."'");
|
||||
if ($db->Next()) {
|
||||
if (!$ainfo['No_NPWP']) $ainfo['No_NPWP'] = $db->Row("No_NPWP");
|
||||
if (!$ainfo['Nama_NPWP']) $ainfo['Nama_NPWP'] = $db->Row("Nama_NPWP");
|
||||
if (!$ainfo['Alamat_NPWP']) $ainfo['Alamat_NPWP'] = $db->Row("Alamat_Outlet");
|
||||
$ainfo['Kota_NPWP'] = $db->Row("Kota_Outlet");
|
||||
}
|
||||
}
|
||||
|
||||
$html = str_replace("_NO_PAJAK_", "010.".format_nofp($ainfo['No_Pajak']), $html);
|
||||
$html = str_replace("_REG_NAME_", strtoupper($_SESSION['__WEB_APP']['REG_NAME']), $html);
|
||||
$html = str_replace("_REG_ADDRESS_", $_SESSION['__WEB_APP']['REG_ADDRESS'], $html);
|
||||
$html = str_replace("_REG_CITY_", $_SESSION['__WEB_APP']['REG_CITY'], $html);
|
||||
$html = str_replace("_REG_NPWP_", $_SESSION['__WEB_APP']['REG_NPWP'], $html);
|
||||
$html = str_replace("_OUT_NAME_", strtoupper($ainfo['Nama_NPWP']), $html);
|
||||
$html = str_replace("_OUT_ADDRESS_", rapi_alamat($ainfo['Alamat_NPWP']), $html);
|
||||
$html = str_replace("_OUT_CITY_", $ainfo['Kota_NPWP'], $html);
|
||||
$html = str_replace("_OUT_NPWP_", $ainfo['No_NPWP'], $html);
|
||||
$_foot = str_replace("_REG_CITY_", $_SESSION['__WEB_APP']['REG_CITY'], $_foot);
|
||||
$_foot = str_replace("_TGL_PAJAK_", tgl_panjang($ainfo['Tgl_Pajak2']), $_foot);
|
||||
$_foot = str_replace("_REG_OWNER_", $_SESSION['__WEB_APP']['REG_OWNER'], $_foot);
|
||||
$_foot = str_replace("_PPN_STRING_", "11", $_foot);
|
||||
//$_foot = str_replace("_PPN_STRING_", (($ainfo['Tgl_Pajak'] >= $_SESSION['__APP_IAS']['PPN_TGL']) ? $_SESSION['__APP_IAS']['PPN_STRING'] : "11"), $_foot);
|
||||
|
||||
$nomor = 1; $tot_inv = $tot_disc = $tot_btax = $tot_tax = 0; $ppn = 0;
|
||||
$db->Query("SELECT P.Nama_Produk,R.Nama_Rasa,SUM(-D.Qty) Qty,ROUND(D.Harga_Jual/(1+D.PPN),2) Harga_Jual,SUM(-D.Qty*ROUND(D.Harga_Jual/(1+D.PPN),2)) Total_Jual,SUM(IF(D.Total_Diskon=(-D.Qty*D.Harga_Jual),-D.Qty*ROUND(D.Harga_Jual/(1+D.PPN),2),ROUND(D.Total_Diskon/(1+D.PPN),2))) Total_Diskon,D.PPN FROM (SELECT * FROM inv_detail WHERE No_Ref IN (SELECT No_Jual FROM inv_jual WHERE No_Pajak='".$nota."') AND Qty<>0) D LEFT JOIN inv_produk P ON (D.InvID=P.InvID) LEFT JOIN para_rasa R ON (D.RasaID=R.RasaID) WHERE P.Pajak=1 GROUP BY D.InvID, D.RasaID, D.SatuanID ORDER BY P.Nama_Produk");
|
||||
while ($db->Next()) {
|
||||
$ppn = $db->Row("PPN");
|
||||
$_tdisc = ($db->RowFloat("Total_Diskon")==0) ? "" : "<br>Potongan Harga : Rp ".rupiah2($db->Row("Total_Diskon"));
|
||||
$html .= sprintf($_line, $nomor, $db->Row("Nama_Produk").data_rasafp($db->Row("Nama_Rasa"))."<br>Rp ".rupiah2($db->Row("Harga_Jual"))." x ".rupiah2($db->Row("Qty")).$_tdisc, rupiah2($db->Row("Total_Jual")));
|
||||
$tot_inv += $db->Row("Total_Jual");
|
||||
$tot_disc += $db->Row("Total_Diskon");
|
||||
$nomor++;
|
||||
}
|
||||
|
||||
$tot_btax = floor($tot_inv - $tot_disc);
|
||||
$tot_tax = floor($tot_btax * $ppn);
|
||||
$_foot = str_replace("_TOT_INVOICE_", rupiah2($tot_inv), $_foot);
|
||||
$_foot = str_replace("_TOT_DISC_", rupiah2($tot_disc), $_foot);
|
||||
$_foot = str_replace("_TOT_DP_", rupiah2(0), $_foot);
|
||||
$_foot = str_replace("_TOT_BTAX_", rupiah2($tot_btax), $_foot);
|
||||
$_foot = str_replace("_TOT_TAX_", rupiah2($tot_tax), $_foot);
|
||||
$html .= $_foot;
|
||||
|
||||
$mpdf = new \Mpdf\Mpdf([
|
||||
'default_font_size' => 10,
|
||||
'mode' => 'c',
|
||||
'format' => 'A4',
|
||||
'margin_left' => 5,
|
||||
'margin_right' => 5,
|
||||
'margin_top' => 5,
|
||||
'margin_header' => 5,
|
||||
'margin_footer' => 5
|
||||
]);
|
||||
$mpdf->SetDisplayMode('fullpage');
|
||||
$css = file_get_contents($_SESSION['__WEB_APP']['REAL_PATH'].'assets/css/pdf/fp.css');
|
||||
$mpdf->WriteHTML($css, \Mpdf\HTMLParserMode::HEADER_CSS);
|
||||
$mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
$mpdf->SetAuthor($_SESSION['__WEB_APP']['REG_NAME']);
|
||||
$mpdf->SetCreator($_SESSION['__WEB_APP']['APP_NAME']." v".$_SESSION['__WEB_APP']['APP_VER']);
|
||||
$mpdf->setTitle("Faktur Pajak No. ".$nota);
|
||||
$mpdf->Output($nota.".pdf", \Mpdf\Output\Destination::INLINE);
|
||||
unset($mpdf);
|
||||
}
|
||||
|
||||
function fp_retur($db, $nota="") {
|
||||
if (trim($nota)=="") return;
|
||||
$html = '
|
||||
<htmlpagefooter name="RepFoot">
|
||||
<table width="100%" style="border:none;"><tr><td width="95%" style="text-align:left;border:none;">PEMBERITAHUAN: Faktur Pajak ini telah dilaporkan ke Direktorat Jenderal Pajak dan telah memperoleh persetujuan sesuai dengan ketentuan peraturan perpajakan yang berlaku. PERINGATAN: PKP yang menerbitkan Faktur Pajak yang tidak sesuai dengan keadaan yang sebenarnya dan/atau sesungguhnya sebagaimana dimaksud Pasal 13 ayat (9) UU PPN dikenai sanksi sesuai dengan Pasal 14 ayat (4) UU KUP</td><td width="50%" style="text-align:right;font-style:italic;border:none;">{PAGENO} dari {nbpg}</td></tr></table>
|
||||
</htmlpagefooter>
|
||||
<sethtmlpagefooter name="RepFoot" show-this-page="1" value="on" />
|
||||
<table class="judul" style="width:100%;" borderspacing="0">
|
||||
<tr><td class="center" style="font-size:15pt;">Nota Retur</td></tr>
|
||||
<tr><td class="line">Nomor : _NO_PAJAK_</td></tr>
|
||||
<tr><td class="line">Pembeli Barang Kena Pajak</td></tr>
|
||||
<tr>
|
||||
<td class="line">
|
||||
<table width="100%">
|
||||
<tr><td width="50" class="left">Nama</td><td width="5" class="center">:</td><td class="left">_REG_NAME_</td></tr>
|
||||
<tr><td class="left">Alamat</td><td class="center">:</td><td class="left">_REG_ADDRESS_ _REG_CITY_</td></tr>
|
||||
<tr><td class="left">NPWP</td><td class="center">:</td><td class="left">_REG_NPWP_</td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td class="line">Kepada Penjual</td></tr>
|
||||
<tr>
|
||||
<td class="line">
|
||||
<table width="100%">
|
||||
<tr><td width="50" class="left">Nama</td><td width="5" class="center">:</td><td class="left">_OUT_NAME_</td></tr>
|
||||
<tr><td class="left">Alamat</td><td class="center">:</td><td class="left">_OUT_ADDRESS_ _OUT_CITY_</td></tr>
|
||||
<tr><td class="left">NPWP</td><td class="center">:</td><td class="left">_OUT_NPWP_</td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="pdf_cont">
|
||||
<table><thead>
|
||||
<tr><th style="width:5%;">No.</th><th>Nama Barang Kena Pajak / Jasa Kena Pajak</th><th style="width:25%;">Harga Jual/Penggantian/Uang<br>Muka/Termin</th></tr>
|
||||
</thead><tbody>';
|
||||
$_line = '<tr><td class="center">%s</td><td class="left">%s</td><td class="right">%s</td></tr>';
|
||||
|
||||
$_foot = '
|
||||
</tbody></table>
|
||||
<table>
|
||||
<tr><td class="left">Harga Jual / Penggantian</td><td class="right" style="width:25%;">_TOT_INVOICE_</td></tr>
|
||||
<tr><td class="left">Dikurangi Potongan Harga</td><td class="right">_TOT_DISC_</td></tr>
|
||||
<tr><td class="left">Dikurangi Uang Muka</td><td class="right">_TOT_DP_</td></tr>
|
||||
<tr><td class="left">Dasar Pengenaan Pajak</td><td class="right">_TOT_BTAX_</td></tr>
|
||||
<tr><td class="left">Total PPN = _PPN_STRING_% x Dasar Pengenaan Pajak</td><td class="right">_TOT_TAX_</td></tr>
|
||||
<tr><td class="left">Total PPnBM (Pajak Penjualan Barang Mewah)</td><td class="right">0,00</td></tr>
|
||||
</table>
|
||||
<span style="font-size:8pt;">Sesuai dengan ketentuan yang berlaku, Direktorat Jenderal Pajak mengatur bahwa Faktur Pajak ini telah ditandatangani secara elektronik sehingga tidak diperlukan tanda tangan basah pada Faktur Pajak ini.</span><br />
|
||||
<table width="100%" style="border:0;">
|
||||
<tr><td style="width:50%;border:0;"> </td><td style="border:0;">_REG_CITY_, _TGL_PAJAK_<br><br><br><br><br>_REG_OWNER_</td></tr>
|
||||
</table>
|
||||
</div>';
|
||||
|
||||
$db->Query("SELECT *,DATE_FORMAT(Tgl_Pajak,'%d-%m-%Y') Tgl_Pajak2,DATE_FORMAT(Tgl_Retur,'%d-%m-%Y') Tgl_Retur2 FROM inv_beli_pajak WHERE No_Pajak='".$nota."'");
|
||||
if ($db->Next()) $ainfo = $db->AllRow();
|
||||
if (intval($ainfo['SupID'])>0) {
|
||||
$db->Query("SELECT * FROM para_supplier WHERE SupID='".$ainfo['SupID']."'");
|
||||
if ($db->Next()) {
|
||||
$ainfo['No_NPWP'] = $db->Row("No_NPWP");
|
||||
$ainfo['Nama_NPWP'] = $db->Row("Nama_Sup");
|
||||
$ainfo['Alamat_NPWP'] = $db->Row("Alamat_Sup");
|
||||
$ainfo['Kota_NPWP'] = $db->Row("Kota_Sup");
|
||||
}
|
||||
}
|
||||
|
||||
$html = str_replace("_NO_RETUR_", $ainfo['No_Retur'], $html);
|
||||
$html = str_replace("_NO_PAJAK_", $ainfo['No_Pajak'], $html);
|
||||
$html = str_replace("_TGL_PAJAK_", $ainfo['Tgl_Pajak2'], $html);
|
||||
$html = str_replace("_REG_NAME_", strtoupper($_SESSION['__WEB_APP']['REG_NAME']), $html);
|
||||
$html = str_replace("_REG_ADDRESS_", $_SESSION['__WEB_APP']['REG_ADDRESS'], $html);
|
||||
$html = str_replace("_REG_CITY_", $_SESSION['__WEB_APP']['REG_CITY'], $html);
|
||||
$html = str_replace("_REG_NPWP_", $_SESSION['__WEB_APP']['REG_NPWP'], $html);
|
||||
$html = str_replace("_OUT_NAME_", strtoupper($ainfo['Nama_NPWP']), $html);
|
||||
$html = str_replace("_OUT_ADDRESS_", rapi_alamat($ainfo['Alamat_NPWP']), $html);
|
||||
$html = str_replace("_OUT_CITY_", $ainfo['Kota_NPWP'], $html);
|
||||
$html = str_replace("_OUT_NPWP_", $ainfo['No_NPWP'], $html);
|
||||
$_foot = str_replace("_REG_CITY_", $_SESSION['__WEB_APP']['REG_CITY'], $_foot);
|
||||
$_foot = str_replace("_TGL_PAJAK_", tgl_panjang($ainfo['Tgl_Pajak2']), $_foot);
|
||||
$_foot = str_replace("_REG_OWNER_", $_SESSION['__WEB_APP']['REG_OWNER'], $_foot);
|
||||
$_foot = str_replace("_PPN_STRING_", "11", $_foot);
|
||||
//$_foot = str_replace("_PPN_STRING_", (($ainfo['Tgl_Pajak'] >= $_SESSION['__APP_IAS']['PPN_TGL']) ? $_SESSION['__APP_IAS']['PPN_STRING'] : "11"), $_foot);
|
||||
|
||||
$nomor = 1; $tot_inv = 0; $tot_tax = 0; $ppn = 0;
|
||||
$db->Query("SELECT P.Nama_Produk,R.Nama_Rasa,S.Nama_Satuan,-D.Qty Qty,(D.Harga_Pokok/(1+D.PPN)) Harga_Satuan,FLOOR((-D.Qty*D.Harga_Pokok)/(1+D.PPN)) Total_Beli FROM (SELECT * FROM inv_detail WHERE No_Ref IN (SELECT No_Beli FROM inv_beli WHERE No_Pajak='".$nota."' AND Data_Beli=0) AND Qty<>0) D LEFT JOIN inv_produk P ON (D.InvID=P.InvID) LEFT JOIN para_satuan S ON (D.SatuanID=S.SatuanID) LEFT JOIN para_rasa R ON (D.RasaID=R.RasaID)");
|
||||
while ($db->Next()) {
|
||||
$ppn = $db->Row("PPN");
|
||||
$html .= sprintf($_line, $nomor, $db->Row("Nama_Produk").data_rasafp($db->Row("Nama_Rasa"))."<br>Rp ".rupiah2($db->Row("Harga_Satuan"))." x ".rupiah2($db->Row("Qty")), rupiah2($db->Row("Total_Beli")));
|
||||
$tot_inv += $db->Row("Total_Beli");
|
||||
$nomor++;
|
||||
}
|
||||
|
||||
$tot_tax = floor($tot_inv * $ppn);
|
||||
$_foot = str_replace("_TOT_INVOICE_", rupiah2($tot_inv), $_foot);
|
||||
$_foot = str_replace("_TOT_DISC_", rupiah2(0), $_foot);
|
||||
$_foot = str_replace("_TOT_DP_", rupiah2(0), $_foot);
|
||||
$_foot = str_replace("_TOT_BTAX_", rupiah2($tot_tax), $_foot);
|
||||
$_foot = str_replace("_TOT_TAX_", rupiah2($tot_tax), $_foot);
|
||||
$html .= $_foot;
|
||||
|
||||
$mpdf = new \Mpdf\Mpdf([
|
||||
'default_font_size' => 10,
|
||||
'mode' => 'c',
|
||||
'format' => 'A4',
|
||||
'margin_left' => 5,
|
||||
'margin_right' => 5,
|
||||
'margin_top' => 5,
|
||||
'margin_header' => 5,
|
||||
'margin_footer' => 5
|
||||
]);
|
||||
$mpdf->SetDisplayMode('fullpage');
|
||||
$css = file_get_contents($_SESSION['__WEB_APP']['REAL_PATH'].'assets/css/pdf/fp.css');
|
||||
$mpdf->WriteHTML($css, \Mpdf\HTMLParserMode::HEADER_CSS);
|
||||
$mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
$mpdf->SetAuthor($_SESSION['__WEB_APP']['REG_NAME']);
|
||||
$mpdf->SetCreator($_SESSION['__WEB_APP']['APP_NAME']." v".$_SESSION['__WEB_APP']['APP_VER']);
|
||||
$mpdf->setTitle("Faktur Pajak No. ".$nota);
|
||||
$mpdf->Output($nota.".pdf", \Mpdf\Output\Destination::INLINE);
|
||||
unset($mpdf);
|
||||
}
|
||||
|
||||
function fp_biaya($db, $nota="") {
|
||||
if (trim($nota)=="") return;
|
||||
$html = '
|
||||
<htmlpagefooter name="RepFoot">
|
||||
<table width="100%" style="border:none;"><tr><td width="95%" style="text-align:left;border:none;">PEMBERITAHUAN: Faktur Pajak ini telah dilaporkan ke Direktorat Jenderal Pajak dan telah memperoleh persetujuan sesuai dengan ketentuan peraturan perpajakan yang berlaku. PERINGATAN: PKP yang menerbitkan Faktur Pajak yang tidak sesuai dengan keadaan yang sebenarnya dan/atau sesungguhnya sebagaimana dimaksud Pasal 13 ayat (9) UU PPN dikenai sanksi sesuai dengan Pasal 14 ayat (4) UU KUP</td><td width="50%" style="text-align:right;font-style:italic;border:none;">{PAGENO} dari {nbpg}</td></tr></table>
|
||||
</htmlpagefooter>
|
||||
<sethtmlpagefooter name="RepFoot" show-this-page="1" value="on" />
|
||||
<table class="judul" style="width:100%;" borderspacing="0">
|
||||
<tr><td class="center" style="font-size:15pt;">Faktur Pajak</td></tr>
|
||||
<tr><td class="line">Kode dan Nomor Seri Faktur Pajak : _NO_PAJAK_</td></tr>
|
||||
<tr><td class="line">Pengusaha Kena Pajak</td></tr>
|
||||
<tr>
|
||||
<td class="line">
|
||||
<table width="100%">
|
||||
<tr><td width="50" class="left">Nama</td><td width="5" class="center">:</td><td class="left">_REG_NAME_</td></tr>
|
||||
<tr><td class="left">Alamat</td><td class="center">:</td><td class="left">_REG_ADDRESS_ _REG_CITY_</td></tr>
|
||||
<tr><td class="left">NPWP</td><td class="center">:</td><td class="left">_REG_NPWP_</td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td class="line">Pembeli Barang Kena Pajak / Penerima Jasa Kena Pajak</td></tr>
|
||||
<tr>
|
||||
<td class="line">
|
||||
<table width="100%">
|
||||
<tr><td width="50" class="left">Nama</td><td width="5" class="center">:</td><td class="left">_OUT_NAME_</td></tr>
|
||||
<tr><td class="left">Alamat</td><td class="center">:</td><td class="left">_OUT_ADDRESS_ _OUT_CITY_</td></tr>
|
||||
<tr><td class="left">NPWP</td><td class="center">:</td><td class="left">_OUT_NPWP_</td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div id="pdf_cont">
|
||||
<table><thead>
|
||||
<tr><th style="width:5%;">No.</th><th>Nama Barang Kena Pajak / Jasa Kena Pajak</th><th style="width:25%;">Harga Jual/Penggantian/Uang<br>Muka/Termin</th></tr>
|
||||
</thead><tbody>';
|
||||
$_line = '<tr><td class="center">%s</td><td class="left">%s</td><td class="right">%s</td></tr>';
|
||||
|
||||
$_foot = '
|
||||
</tbody></table>
|
||||
<table>
|
||||
<tr><td class="left">Harga Jual / Penggantian</td><td class="right" style="width:25%;">_TOT_INVOICE_</td></tr>
|
||||
<tr><td class="left">Dikurangi Potongan Harga</td><td class="right">_TOT_DISC_</td></tr>
|
||||
<tr><td class="left">Dikurangi Uang Muka</td><td class="right">_TOT_DP_</td></tr>
|
||||
<tr><td class="left">Dasar Pengenaan Pajak</td><td class="right">_TOT_BTAX_</td></tr>
|
||||
<tr><td class="left">Total PPN = _PPN_STRING_% x Dasar Pengenaan Pajak</td><td class="right">_TOT_TAX_</td></tr>
|
||||
<tr><td class="left">Total PPnBM (Pajak Penjualan Barang Mewah)</td><td class="right">0,00</td></tr>
|
||||
</table>
|
||||
<span style="font-size:8pt;">Sesuai dengan ketentuan yang berlaku, Direktorat Jenderal Pajak mengatur bahwa Faktur Pajak ini telah ditandatangani secara elektronik sehingga tidak diperlukan tanda tangan basah pada Faktur Pajak ini.</span><br />
|
||||
<table width="100%" style="border:0;">
|
||||
<tr><td style="width:50%;border:0;"> </td><td style="border:0;">_REG_CITY_, _TGL_PAJAK_<br><br><br><br><br>_REG_OWNER_</td></tr>
|
||||
</table>
|
||||
</div>';
|
||||
|
||||
$db->Query("SELECT *,DATE_FORMAT(Tgl_Pajak,'%d-%m-%Y') Tgl_Pajak2 FROM biaya_pajak WHERE No_Biaya='".$nota."'");
|
||||
if ($db->Next()) $ainfo = $db->AllRow();
|
||||
if (intval($ainfo['SupID'])>0) {
|
||||
$db->Query("SELECT * FROM para_supplier WHERE SupID='".$ainfo['SupID']."'");
|
||||
if ($db->Next()) {
|
||||
$ainfo['No_NPWP'] = $db->Row("No_NPWP");
|
||||
$ainfo['Nama_NPWP'] = $db->Row("Nama_Sup");
|
||||
$ainfo['Alamat_NPWP'] = $db->Row("Alamat_Sup");
|
||||
$ainfo['Kota_NPWP'] = $db->Row("Kota_Sup");
|
||||
}
|
||||
}
|
||||
|
||||
$html = str_replace("_NO_PAJAK_", "010.".format_nofp($ainfo['No_Pajak']), $html);
|
||||
$html = str_replace("_REG_NAME_", strtoupper($_SESSION['__WEB_APP']['REG_NAME']), $html);
|
||||
$html = str_replace("_REG_ADDRESS_", $_SESSION['__WEB_APP']['REG_ADDRESS'], $html);
|
||||
$html = str_replace("_REG_CITY_", $_SESSION['__WEB_APP']['REG_CITY'], $html);
|
||||
$html = str_replace("_REG_NPWP_", $_SESSION['__WEB_APP']['REG_NPWP'], $html);
|
||||
$html = str_replace("_OUT_NAME_", strtoupper($ainfo['Nama_NPWP']), $html);
|
||||
$html = str_replace("_OUT_ADDRESS_", rapi_alamat($ainfo['Alamat_NPWP']), $html);
|
||||
$html = str_replace("_OUT_CITY_", $ainfo['Kota_NPWP'], $html);
|
||||
$html = str_replace("_OUT_NPWP_", $ainfo['No_NPWP'], $html);
|
||||
$_foot = str_replace("_REG_CITY_", $_SESSION['__WEB_APP']['REG_CITY'], $_foot);
|
||||
$_foot = str_replace("_TGL_PAJAK_", tgl_panjang($ainfo['Tgl_Pajak2']), $_foot);
|
||||
$_foot = str_replace("_REG_OWNER_", $_SESSION['__WEB_APP']['REG_OWNER'], $_foot);
|
||||
$_foot = str_replace("_PPN_STRING_", "11", $_foot);
|
||||
//$_foot = str_replace("_PPN_STRING_", (($ainfo['Tgl_Pajak'] >= $_SESSION['__APP_IAS']['PPN_TGL']) ? $_SESSION['__APP_IAS']['PPN_STRING'] : "11"), $_foot);
|
||||
|
||||
$nomor = 1; $tot_inv = $tot_disc = $tot_btax = $tot_tax = 0; $ppn = 0;
|
||||
$db->Query("SELECT *,(Qty*Harga_Jual) Total_Jual,0 Total_Diskon FROM biaya_pajak_detail WHERE No_Biaya='".$nota."' ORDER BY ID");
|
||||
while ($db->Next()) {
|
||||
$ppn = $db->Row("PPN");
|
||||
$_tdisc = ($db->RowFloat("Total_Diskon")==0) ? "" : "<br>Potongan Harga : Rp ".rupiah2($db->Row("Total_Diskon"));
|
||||
$html .= sprintf($_line, $nomor, $db->Row("Uraian_Biaya")."<br>Rp ".rupiah2($db->Row("Harga_Jual"))." x ".rupiah2($db->Row("Qty")).$_tdisc, rupiah2($db->Row("Total_Jual")));
|
||||
$tot_inv += $db->Row("Total_Jual");
|
||||
$tot_disc += $db->Row("Total_Diskon");
|
||||
$nomor++;
|
||||
}
|
||||
|
||||
$tot_btax = floor($tot_inv - $tot_disc);
|
||||
$tot_tax = floor($tot_btax * $ppn);
|
||||
$_foot = str_replace("_TOT_INVOICE_", rupiah2($tot_inv), $_foot);
|
||||
$_foot = str_replace("_TOT_DISC_", rupiah2($tot_disc), $_foot);
|
||||
$_foot = str_replace("_TOT_DP_", rupiah2(0), $_foot);
|
||||
$_foot = str_replace("_TOT_BTAX_", rupiah2($tot_btax), $_foot);
|
||||
$_foot = str_replace("_TOT_TAX_", rupiah2($tot_tax), $_foot);
|
||||
$html .= $_foot;
|
||||
|
||||
$mpdf = new \Mpdf\Mpdf([
|
||||
'default_font_size' => 10,
|
||||
'mode' => 'c',
|
||||
'format' => 'A4',
|
||||
'margin_left' => 5,
|
||||
'margin_right' => 5,
|
||||
'margin_top' => 5,
|
||||
'margin_header' => 5,
|
||||
'margin_footer' => 5
|
||||
]);
|
||||
$mpdf->SetDisplayMode('fullpage');
|
||||
$css = file_get_contents($_SESSION['__WEB_APP']['REAL_PATH'].'assets/css/pdf/fp.css');
|
||||
$mpdf->WriteHTML($css, \Mpdf\HTMLParserMode::HEADER_CSS);
|
||||
$mpdf->WriteHTML($html, \Mpdf\HTMLParserMode::HTML_BODY);
|
||||
$mpdf->SetAuthor($_SESSION['__WEB_APP']['REG_NAME']);
|
||||
$mpdf->SetCreator($_SESSION['__WEB_APP']['APP_NAME']." v".$_SESSION['__WEB_APP']['APP_VER']);
|
||||
$mpdf->setTitle("Faktur Pajak No. ".$nota);
|
||||
$mpdf->Output($nota.".pdf", \Mpdf\Output\Destination::INLINE);
|
||||
unset($mpdf);
|
||||
}
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$data = Param::Get("data");
|
||||
$nomor = Param::Get("Nomor_Cetak");
|
||||
|
||||
if ( $data == "fp-jual" ) {
|
||||
fp_jual($db, $nomor);
|
||||
|
||||
} else if ( $data == "fp-retur" ) {
|
||||
fp_retur($db, $nomor);
|
||||
|
||||
} else if ( $data == "fp-biaya" ) {
|
||||
fp_biaya($db, $nomor);
|
||||
|
||||
} else if ( $data == "default") {}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/hutang.php
|
||||
Desc. : PHP - Laporan Hutang Supplier
|
||||
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
|
||||
$id_sup = Param::Get("SupID", 0);
|
||||
$tglfrom = Param::Get("Tgl_From");
|
||||
$tglto = Param::Get("Tgl_To");
|
||||
$asup = [];
|
||||
if ($id_sup > 0) {
|
||||
$db->Query("SELECT * FROM para_supplier WHERE SupID='".$id_sup."' LIMIT 1");
|
||||
if ($db->Next()) $asup = $db->AllRow();
|
||||
}
|
||||
|
||||
// generate report header
|
||||
$tglheader = "Periode : ".$tglfrom;
|
||||
if ($tglfrom!==$tglto) $tglheader .= " S/D ".$tglto;
|
||||
$tglfrom = tgl_sql2str($tglfrom);
|
||||
$tglto = tgl_sql2str($tglto);
|
||||
|
||||
$tsql = ($id_sup>0) ? " AND B.SupID='".$id_sup."'" : "";
|
||||
|
||||
if ($tipe=="R") {
|
||||
$db->Query("SELECT S.Nama_Sup,SUM(B.Total_Beli-B.Total_Diskon) Total_Hutang FROM inv_beli B LEFT JOIN para_supplier S ON (B.SupID=S.SupID) WHERE B.Lunas=0 AND (B.Tgl_Beli BETWEEN '".$tglfrom."' AND '".$tglto."')".$tsql." GROUP BY B.SupID ORDER BY S.Nama_Sup");
|
||||
} else {
|
||||
$db->Query("SELECT B.*,DATE_FORMAT(B.Tgl_Beli,'%d-%m-%Y') Tgl_Beli2,CONCAT(S.Nama_Sup,IF(B.Data_Beli=1,'',' <i>(Retur)</i>')) Nama_Sup,B.Total_Beli-B.Total_Diskon Total_Hutang FROM inv_beli B LEFT JOIN para_supplier S ON (B.SupID=S.SupID) WHERE B.Lunas=0 AND (B.Tgl_Beli BETWEEN '".$tglfrom."' AND '".$tglto."')".$tsql." ORDER BY B.No_Beli");
|
||||
}
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN ".($tipe=="R"?"REKAP":"DETAIL")." HUTANG SUPPLIER", $tglheader);
|
||||
$pre = new PrintHTML();
|
||||
$pre->set_css("garis");
|
||||
|
||||
if ($tipe=="R") {
|
||||
$pre->add_field("NO.",10,"C");
|
||||
$pre->add_field("NAMA SUPPLIER",120);
|
||||
$pre->add_field("JUMLAH HUTANG",30,"R","uang");
|
||||
$pre->add_field("JUMLAH BAYAR",30,"R","uang");
|
||||
$pre->add_field("SISA HUTANG",30,"R","uang");
|
||||
|
||||
if ($supid>0) $pre->add_span(array("NAMA SUPPLIER",2,"L,NB"),array(": ".$asup['Nama_Sup'],3,"L,NB"));
|
||||
$pre->show_fields();
|
||||
|
||||
$tot_hut = $tot_bayar = $nomor = 0;
|
||||
while ($db->Next()) {
|
||||
$nomor++;
|
||||
$tot_hut += $db->Row("Total_Hutang");
|
||||
$tot_bayar += 0;
|
||||
$pre->add_value($nomor, $db->Row("Nama_Sup"), $db->Row("Total_Hutang"), 0, $db->Row("Total_Hutang"));
|
||||
}
|
||||
$pre->add_span(array("",1),array("GRAND TOTAL",1,"L,B"),array($tot_hut,1,"R,B","uang"),array($tot_bayar,1,"R,B","uang"),array($tot_hut-$tot_bayar,1,"R,B","uang"));
|
||||
|
||||
} else {
|
||||
$pre->add_field("NO. NOTA",10,"C");
|
||||
$pre->add_field("TGL. BELI",10,"C");
|
||||
$pre->add_field("NAMA SUPPLIER",120);
|
||||
$pre->add_field("JUMLAH HUTANG",30,"R","uang");
|
||||
|
||||
if ($supid>0) $pre->add_span(array("NAMA SUPPLIER",2,"L,NB"),array(": ".$nama_sup,2,"L,NB"));
|
||||
$pre->show_fields();
|
||||
|
||||
$subtotal = 0;
|
||||
while ($db->Next()) {
|
||||
$subtotal += $db->Row("Total_Hutang");
|
||||
$pre->add_value($db->Row("No_Beli"), $db->Row("Tgl_Beli2"), $db->Row("Nama_Sup"), $db->Row("Total_Hutang"));
|
||||
}
|
||||
$pre->add_span(array("GRAND TOTAL",3,"L,B"),array($subtotal,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"]);
|
||||
$tsup = $form->option_db("_", "SupID", 0, true, false, "para_supplier", ["SupID","Nama_Sup"], "TRUE ORDER BY Nama_Sup", [0,"SEMUA SUPPLIER"]);
|
||||
$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">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="SupID">Nama Supplier</label>
|
||||
<div class="col">'.$tsup.'</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>';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,271 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/jual.php
|
||||
Desc. : PHP - Laporan Penjualan
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : April 12th, 2011.
|
||||
Last Modified : February 4th, 2024.
|
||||
|
||||
(c) 2011 - 2024, 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;
|
||||
use siaupheng\fonia3\Data\SimpleXLS;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export" ) {
|
||||
$tipe = Param::Get("Tipe"); // R or D
|
||||
$rekap = Param::Get("Rekap"); // X, 1, 0
|
||||
$ck = Param::Get("CK", "X");
|
||||
$id_outlet = Param::Get("OutletID", 0);
|
||||
$id_sales = Param::Get("SalesID", "SEMUA");
|
||||
$id_grup = Param::Get("Grup_InvID");
|
||||
$tglfrom = Param::Get("Tgl_From");
|
||||
$tglto = Param::Get("Tgl_To");
|
||||
$aoutlet = []; $agroup = []; $asales = [];
|
||||
if ($id_outlet > 0) {
|
||||
$db->Query("SELECT * FROM para_outlet WHERE OutletID='".$id_outlet."' LIMIT 1");
|
||||
if ($db->Next()) $aoutlet = $db->AllRow();
|
||||
}
|
||||
if ($id_grup > 0) {
|
||||
$db->Query("SELECT * FROM inv_produk_grup WHERE Grup_InvID='".$id_grup."' LIMIT 1");
|
||||
if ($db->Next()) $agroup = $db->AllRow();
|
||||
}
|
||||
if (!in_array($id_sales, [0,"NON","SEMUA"])) {
|
||||
$db->Query("SELECT Nama_Pegawai Nama_Sales FROM para_pegawai WHERE PegID='".$id_sales."' LIMIT 1");
|
||||
if ($db->Next()) $asales = $db->AllRow();
|
||||
}
|
||||
if ($id_sales=="NON") $asales['Nama_Sales'] = "TANPA SALES";
|
||||
|
||||
// generate report header
|
||||
$tglheader = "Periode : ".$tglfrom;
|
||||
if ($tglfrom!==$tglto) $tglheader .= " s/d ".$tglto;
|
||||
$tglfrom = tgl_sql2str($tglfrom);
|
||||
$tglto = tgl_sql2str($tglto);
|
||||
|
||||
$tsql = ($id_outlet>0) ? " AND OutletID='".$id_outlet."'" : "";
|
||||
$tsql .= (!in_array($id_sales, [0,"NON","SEMUA"])) ? " AND SalesID='".$id_sales."'" : "";
|
||||
$tsql .= ($id_sales=="NON") ? " AND SalesID=0" : "";
|
||||
$tsql .= ($rekap<>"X") ? " AND Rekap='".intval($rekap)."'" : "";
|
||||
$tsql .= ($ck=="X") ? "" : ($ck=="C" ? " AND (Tgl_Jual=Tgl_JT OR Tgl_JT='0000-00-00')" : " AND (Tgl_Jual<>Tgl_JT AND Tgl_JT<>'0000-00-00')");
|
||||
|
||||
if ($tipe=="R") {
|
||||
$db->Query("SELECT J.*,O.Nama_Outlet FROM (SELECT OutletID,SUM(Total_Jual) Total_Jual,SUM(Total_Diskon) Total_Diskon,SUM(Total_Jual-Total_Diskon) Total FROM inv_jual WHERE Data_Jual=1 AND (Tgl_Jual BETWEEN '".$tglfrom."' AND '".$tglto."')".$tsql." GROUP BY OutletID) J LEFT JOIN para_outlet O ON (J.OutletID=O.OutletID) ORDER BY O.Nama_Outlet");
|
||||
} else {
|
||||
$tgrup = ($id_grup>0) ? " AND InvID IN (SELECT InvID FROM inv_produk WHERE Grup_InvID='".$id_grup."')" : "";
|
||||
$db->Query("SELECT J.*,D.*,O.Nama_Outlet,S.Nama_Pegawai FROM (SELECT No_Jual,OutletID,SalesID,Tgl_Jual,DATE_FORMAT(Tgl_Jual,'%d-%m-%Y') Tgl_Jual2,Tgl_Lunas,DATE_FORMAT(Tgl_Lunas,'%d-%m-%Y') Tgl_Lunas2,IF(Tgl_Jual=Tgl_JT OR Tgl_JT='0000-00-00','C','K') CK,No_Faktur,Catatan FROM inv_jual WHERE Data_Jual=1 AND (Tgl_Jual BETWEEN '".$tglfrom."' AND '".$tglto."')".$tsql.") J LEFT JOIN (SELECT No_Ref,SUM(-Qty*Harga_Jual) Total_Jual,SUM(Total_Diskon) Total_Diskon FROM inv_detail WHERE No_Ref IN (SELECT No_Jual FROM inv_jual WHERE Data_Jual=1 AND (Tgl_Jual BETWEEN '".$tglfrom."' AND '".$tglto."')".$tsql.")".$tgrup." GROUP BY No_Ref) D ON (D.No_Ref=J.No_Jual) LEFT JOIN para_outlet O ON (J.OutletID=O.OutletID) LEFT JOIN para_pegawai S ON (S.PegID=J.SalesID) WHERE D.Total_Jual<>0 ORDER BY J.No_Jual");
|
||||
}
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN ".($tipe=="R"?"REKAP":"DETAIL")." PENJUALAN", $tglheader);
|
||||
$pre = new PrintHTML();
|
||||
$pre->set_css("garis");
|
||||
|
||||
if ($tipe=="R") {
|
||||
if ($id_outlet>0) echo "Nama Outlet : ".$aoutlet['Nama_Outlet']."<br>";
|
||||
if ($id_sales>0 || $id_sales=="NON") echo "Nama Sales : ".$asales['Nama_Sales']."<br>";
|
||||
|
||||
$pre->add_field("NO.",10,"C");
|
||||
$pre->add_field("NAMA OUTLET",80);
|
||||
$pre->add_field("SUB. TOTAL",20,"R","rupiah");
|
||||
$pre->add_field("DISKON",20,"R","rupiah");
|
||||
$pre->add_field("TOTAL",20,"R","rupiah");
|
||||
$pre->show_fields();
|
||||
|
||||
$subtotal = 0; $diskon = 0; $nomor = 0;
|
||||
while ($db->Next()) {
|
||||
$subtotal += $db->Row("Total_Jual");
|
||||
$diskon += $db->Row("Total_Diskon");
|
||||
$pre->add_value(++$nomor, $db->Row("Nama_Outlet"), $db->Row("Total_Jual"), $db->Row("Total_Diskon"), $db->Row("Total"));
|
||||
}
|
||||
$pre->add_span(array(""),array("GRAND TOTAL",1,"L,B"),array($subtotal,1,"R,B","rupiah"),array($diskon,1,"R,B","rupiah"),array($subtotal-$diskon,1,"R,B","rupiah"));
|
||||
|
||||
} else {
|
||||
if ($id_outlet>0) echo "Nama Outlet : ".$aoutlet['Nama_Outlet']."<br>";
|
||||
if ($id_sales>0 || $id_sales=="NON") echo "Nama Sales : ".$asales['Nama_Sales']."<br>";
|
||||
if ($id_grup>0) echo "Nama Grup Produk : ".$agroup['Nama_Grup']."<br>";
|
||||
|
||||
$pre->add_field("No. Nota",10,"C");
|
||||
$pre->add_field("Tgl. Nota",10,"C");
|
||||
$pre->add_field("Tgl. Lunas",10,"C");
|
||||
$pre->add_field("No. Faktur",10);
|
||||
$pre->add_field("Nama Outlet",80);
|
||||
$pre->add_field("Nama Sales",30);
|
||||
$pre->add_field("Sub. Total",20,"R","rupiah");
|
||||
$pre->add_field("Diskon",20,"R","rupiah");
|
||||
$pre->add_field("Total",20,"R","rupiah");
|
||||
$pre->add_field("C/K", 6, "C");
|
||||
$pre->add_field("Catatan", 30);
|
||||
$pre->show_fields();
|
||||
|
||||
$subtotal = 0; $diskon = 0;
|
||||
while ($db->Next()) {
|
||||
$subtotal += $db->Row("Total_Jual");
|
||||
$diskon += $db->Row("Total_Diskon");
|
||||
$pre->add_value($db->Row("No_Jual"), $db->Row("Tgl_Jual2"), $db->Row("Tgl_Lunas2"), $db->Row("No_Faktur"), $db->Row("Nama_Outlet"), $db->Row("Nama_Pegawai"), $db->Row("Total_Jual"), $db->Row("Total_Diskon"), $db->Row("Total_Jual")-$db->Row("Total_Diskon"), $db->Row("CK"), $db->Row("Catatan"));
|
||||
}
|
||||
$pre->add_span(array("",2),array("GRAND TOTAL",4,"L,B"),array($subtotal,1,"R,B","rupiah"),array($diskon,1,"R,B","rupiah"),array($subtotal-$diskon,1,"R,B","rupiah"), array("",1), array("",1));
|
||||
}
|
||||
$pre->add_stamp(1, true);
|
||||
$pre->show();
|
||||
|
||||
} else if ( $data == "export" ) {
|
||||
$xls = new SimpleXLS([
|
||||
'title'=>"Laporan ".($tipe=="R"?"Rekap":"Detail")." Penjualan",
|
||||
'subject'=>"PT.PMS",
|
||||
'desc'=>"Export Data dari IAS"
|
||||
]);
|
||||
$xls->add_header("<b>".strtoupper($_SESSION['__WEB_APP']['REG_NAME'])."</b>");
|
||||
$xls->add_header("<b>LAPORAN ".($tipe=="R"?"REKAP":"DETAIL")." PENJUALAN</b>");
|
||||
$xls->add_header($tglheader);
|
||||
|
||||
if ($tipe=="R") {
|
||||
$xls->add_field("NO.", 10, "C");
|
||||
$xls->add_field("NAMA OUTLET", 80, "L");
|
||||
$xls->add_field("SUB. TOTAL", 20, "R,N");
|
||||
$xls->add_field("DISKON", 20, "R,N");
|
||||
$xls->add_field("TOTAL", 20, "R,N");
|
||||
$xls->add_sheet("REKAP PENJUALAN", false);
|
||||
|
||||
if ($id_outlet>0) $xls->add_span(["Nama Outlet",2,"L"],[$aoutlet['Nama_Outlet'],3]);
|
||||
if ($id_sales>0 || $id_sales=="NON") $xls->add_span(["Nama Sales",2,"L"],[$asales['Nama_Sales'],3]);
|
||||
$xls->show_headers();
|
||||
|
||||
$subtotal = 0; $diskon = 0; $nomor = 0;
|
||||
while ($db->Next()) {
|
||||
$nomor++;
|
||||
$subtotal += $db->RowFloat("Total_Jual");
|
||||
$diskon += $db->RowFloat("Total_Diskon");
|
||||
$xls->add_value($nomor, $db->Row("Nama_Outlet"), $db->RowFloat("Total_Jual"), $db->RowFloat("Total_Diskon"), $db->RowFloat("Total"));
|
||||
}
|
||||
$xls->add_span(["GRAND TOTAL",2,"C,B"],[$subtotal,1,"R,B,N"],[$diskon,1,"R,B,N"],[$subtotal-$diskon,1,"R,B,N"]);
|
||||
|
||||
} else {
|
||||
$xls->add_field("NO. NOTA", 12, "C");
|
||||
$xls->add_field("TGL. NOTA", 12, "C");
|
||||
$xls->add_field("TGL. LUNAS", 12, "C");
|
||||
$xls->add_field("NO. FAKTUR", 12, "L");
|
||||
$xls->add_field("NAMA OUTLET", 60, "L");
|
||||
$xls->add_field("NAMA SALES", 20, "L");
|
||||
$xls->add_field("SUB. TOTAL", 20, "R,N");
|
||||
$xls->add_field("DISKON", 20, "R,N");
|
||||
$xls->add_field("TOTAL", 20, "R,N");
|
||||
$xls->add_field("C/K", 4, "C");
|
||||
$xls->add_field("CATATAN", 20, "L");
|
||||
$xls->add_sheet("DETAIL PENJUALAN", false);
|
||||
|
||||
if ($id_outlet>0) $xls->add_span(["Nama Outlet",3,"L"],[$aoutlet['Nama_Outlet'],8]);
|
||||
if ($id_sales>0 || $id_sales=="NON") $xls->add_span(["Nama Sales",3,"L"],[$asales['Nama_Sales'],8]);
|
||||
if ($id_grup>0) $xls->add_span(["Nama Grup Produk",3,"L"],[$agroup['Nama_Grup'],8]);
|
||||
$xls->show_headers();
|
||||
|
||||
$subtotal = 0; $diskon = 0;
|
||||
while ($db->Next()) {
|
||||
$subtotal += $db->RowFloat("Total_Jual");
|
||||
$diskon += $db->RowFloat("Total_Diskon");
|
||||
$xls->add_value($db->Row("No_Jual"), $db->Row("Tgl_Jual"), ($db->Row("Tgl_Lunas")=="0000-00-00"?"":$db->Row("Tgl_Lunas")), $db->Row("No_Faktur"), $db->Row("Nama_Outlet"), $db->Row("Nama_Pegawai"), $db->RowFloat("Total_Jual"), $db->RowFloat("Total_Diskon"), $db->RowFloat("Total_Jual")-$db->RowFloat("Total_Diskon"), $db->Row("CK"), $db->Row("Catatan"));
|
||||
}
|
||||
$xls->add_span(["GRAND TOTAL",6,"C,B"],[$subtotal,1,"R,B,N"],[$diskon,1,"R,B,N"],[$subtotal-$diskon,1,"R,B,N"],[""],[""]);
|
||||
}
|
||||
$xls->add_stamp(1, true);
|
||||
$xls->send("Laporan Penjualan.xlsx");
|
||||
unset($xls);
|
||||
|
||||
} else if ( $data == "brow-outlet" ) {
|
||||
$tcari = trim(Param::Get("Cari_Outlet"));
|
||||
$tsql = ($tcari=="") ? " LIMIT 100" : " AND CONCAT(Nama_Outlet,Telp_Outlet,Nama_Outlet) LIKE '%".$tcari."%'";
|
||||
|
||||
$obj = new Table($db);
|
||||
$obj->set_query("SELECT * FROM vi_para_outlet WHERE Aktif=1".$tsql);
|
||||
$obj->add_field("OutletID", "ID", "hid");
|
||||
$obj->add_field("Kode_Outlet", "Kode", "c");
|
||||
$obj->add_field("Nama_Alamat", "Nama Outlet", "awr");
|
||||
$obj->add_field("Alamat_Kota", "Alamat & Kota", "awr");
|
||||
$obj->set_field_order("Nama_Outlet", "A");
|
||||
$obj->add_row_btn("save", "Pilih", "RepoJualJS.outlet_select");
|
||||
$obj->set_func_navi("RepoJualJS.data_query('brow-outlet')");
|
||||
$ajson[] = $obj->json_table("divBrowOutlet");
|
||||
|
||||
} else if ( $data == "auto-outlet" ) {
|
||||
$tcari = Param::Get("Auto_Query");
|
||||
$ajson['autodata'] = [['value' => 0, 'text' => "SEMUA OUTLET", 'data' => ""]];
|
||||
if (is_string($tcari) && strlen($tcari) < 64) {
|
||||
$db->Query("SELECT * FROM vi_para_outlet WHERE Aktif=1 AND CONCAT(Nama_Outlet,Alamat_Outlet) LIKE '%".$tcari."%' ORDER BY Nama_Outlet LIMIT 50");
|
||||
while ($db->Next()) {
|
||||
$ajson['autodata'][] = ['value'=>$db->Row("OutletID"), 'text'=>$db->Row("Nama_Alamat"), 'data'=>$db->Row("Alamat_Kota")];
|
||||
}
|
||||
}
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$asales = ['SEMUA' => "SEMUA SALES", 'NON' => "TANPA-SALES"];
|
||||
$db->Query("SELECT PegID,Nama_Pegawai FROM para_pegawai WHERE Jenis_PegID='".$_SESSION['__APP_IAS']['GRUP_PEG_SALES']."' ORDER BY Nama_Pegawai");
|
||||
while ($db->Next()){
|
||||
$asales[$db->Row("PegID")] = $db->Row("Nama_Pegawai");
|
||||
}
|
||||
|
||||
$form = new Form($db);
|
||||
$ttipe = $form->radio("_", "Tipe", "R", true, false, ["R"=>"Rekap","D"=>"Detail"], null, "RepoJualJS.oc_Tipe();");
|
||||
$trekap = $form->radio("_", "Rekap", "X", true, false, ["1"=>"Antar","0"=>"Belum Antar","X"=>"Semua"]);
|
||||
$tck = $form->radio("_", "CK", "X", true, false, ["C"=>"Cash","K"=>"Kredit","X"=>"Semua"]);
|
||||
$toutlet = $form->textauto("_", "Nama_Outlet", ['value'=>0,'text'=>"SEMUA OUTLET"], true, false);
|
||||
$tsales = $form->option("_", "SalesID", "SEMUA", true, false, $asales);
|
||||
$tgrup = $form->option_db("_", "Grup_InvID", 0, true, false, "inv_produk_grup", ["Grup_InvID","Nama_Grup"], "TRUE ORDER BY Nama_Grup", [0,"SEMUA GRUP"]);
|
||||
$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">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Rekap">Status Order</label>
|
||||
<div class="col">'.$trekap.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="CK">Status Bayar</label>
|
||||
<div class="col">'.$tck.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Nama_Outlet">Nama Outlet</label>
|
||||
<div class="col"><div class="input-group">'.$toutlet.'<button class="btn btn-info" type="button" onclick="RepoJualJS.outlet_brow();"><i class="bi-search"></i></button></div></div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="SalesID">Nama Sales</label>
|
||||
<div class="col">'.$tsales.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Grup_InvID">Grup Produk</label>
|
||||
<div class="col">'.$tgrup.'</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>
|
||||
<input type="hidden" id="OutletID" value="0">';
|
||||
|
||||
}
|
||||
|
||||
send_json($ajson);
|
||||
?>
|
||||
@@ -0,0 +1,159 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/jual_harian.php
|
||||
Desc. : PHP - Laporan Penjualan Harian
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : June 6th, 2011.
|
||||
Last Modified : November 18th, 2023.
|
||||
|
||||
(c) 2011 - 2023, 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;
|
||||
use siaupheng\fonia3\Data\SimpleXLS;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export" ) {
|
||||
$rekap = Param::Get("Rekap"); // X, 1, 0
|
||||
$id_grup = Param::Get("Grup_InvID", 0);
|
||||
$tgldata = Param::Get("Tgl_Data");
|
||||
|
||||
// generate report header
|
||||
//$grupheader = ($grup>0) ? " - ".fastQuery("SELECT UPPER(Nama_Grup) Nama FROM inv_produk_grup WHERE Grup_InvID=".$grup, "") : "";
|
||||
$tglheader = "Periode : ".$tgldata;
|
||||
$tgldata = tgl_sql2str($tgldata);
|
||||
|
||||
$tsql = ($rekap<>"X") ? " AND Rekap=".intval($rekap) : "";
|
||||
$tsql2 = ($id_grup>0) ? " WHERE P.Grup_InvID=".$id_grup : "";
|
||||
|
||||
$db->Query("SELECT D.No_Ref,D.Promo,D.Harga_Jual,P.Nama_Produk,S.Nama_Satuan,R.Nama_Rasa,SUM(-D.Qty) Qty1,SUM(-D.Qty*D.Harga_Jual) Sub_Total,J.No_Faktur,O.Nama_Outlet,O.Alamat_Outlet,L.Nama_Pegawai Nama_Sales,J.Total_Jual,J.Total_Diskon FROM (SELECT * FROM inv_detail WHERE No_Ref IN (SELECT No_Jual FROM inv_jual WHERE Data_Jual=1 AND Tgl_Jual='".$tgldata."'".$tsql.")) D LEFT JOIN (SELECT * FROM inv_jual WHERE Data_Jual=1 AND Tgl_Jual='".$tgldata."'".$tsql.") J ON (J.No_Jual=D.No_Ref) LEFT JOIN para_outlet O ON (O.OutletID=J.OutletID) LEFT JOIN para_pegawai L ON (L.PegID=J.SalesID) LEFT JOIN inv_produk P ON (P.InvID=D.InvID) LEFT JOIN para_satuan S ON (D.SatuanID=S.SatuanID) LEFT JOIN para_rasa R ON (R.RasaID=D.RasaID)".$tsql2." GROUP BY D.No_Ref, D.InvID, D.RasaID, D.SatuanID, D.Harga_Jual ORDER BY D.No_Ref, D.Promo, P.Pajak DESC, P.Nama_Produk");
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN PENJUALAN DETAIL HARIAN", $tglheader);
|
||||
$pre = new PrintHTML();
|
||||
$pre->set_css("garis");
|
||||
$pre->add_field("NO.", 40, "C", "uang");
|
||||
$pre->add_field("NAMA PRODUK", 320);
|
||||
$pre->add_field("QTY", 60, "R");
|
||||
$pre->add_field("SATUAN", 80);
|
||||
$pre->add_field("HARGA @", 90, "R", "uang");
|
||||
$pre->add_field("TOTAL", 90, "R", "uang");
|
||||
|
||||
$nomor = 1; $no_ref = ""; $sub = $dis = 0;
|
||||
while ($db->Next()) {
|
||||
if ($no_ref <> $db->Row("No_Ref")) {
|
||||
if ($no_ref <> "") {
|
||||
$pre->add_span(array("Sub. Total Rp.",4,"R,B"),array($sub,2,"R,B","uang"));
|
||||
$pre->add_span(array("Diskon Rp.",4,"R,B"),array($dis,2,"R,B","uang"));
|
||||
$pre->add_span(array("Total Rp.",4,"R,B"),array($sub-$dis,2,"R,B","uang"));
|
||||
$pre->add_span(array(" ",6,"L,NB"));
|
||||
$sub = $dis = 0;
|
||||
$nomor = 1;
|
||||
}
|
||||
$pre->add_span(array('<table width="100%" class="pnormal"><tr><td class="nb" width="10%">Outlet</td><td class="nb" width="40%">: '.$db->Row("Nama_Outlet").'</td><td class="nb" width="10%">No. Nota</td><td class="nb" width="40%">: '.$db->Row("No_Ref").($db->Row("No_Faktur")?" / ".$db->Row("No_Faktur"):"").'</td></tr><tr><td class="nb">Alamat</td><td class="nb">: '.$db->Row("Alamat_Outlet").'</td><td class="nb">Sales</td><td class="nb">: '.$db->Row("Nama_Sales").'</td></tr></table>',6,"L"));
|
||||
$pre->show_fields();
|
||||
}
|
||||
$pre->add_value( $nomor++, $db->Row("Nama_Produk").(($db->Row("Nama_Rasa"))?" (".$db->Row("Nama_Rasa").")":"").(($db->Row("Promo")>0)?" ***":""), uang($db->Row("Qty1"),2), $db->Row("Nama_Satuan"), $db->Row("Harga_Jual"), $db->Row("Sub_Total") );
|
||||
$no_ref = $db->Row("No_Ref");
|
||||
$sub = $db->Row("Total_Jual");
|
||||
$dis = $db->Row("Total_Diskon");
|
||||
}
|
||||
if ($nomor > 1) {
|
||||
$pre->add_span(array("Sub. Total Rp.",4,"R,B"),array($sub,2,"R,B","uang"));
|
||||
$pre->add_span(array("Diskon Rp.",4,"R,B"),array($dis,2,"R,B","uang"));
|
||||
$pre->add_span(array("Total Rp.",4,"R,B"),array($sub-$dis,2,"R,B","uang"));
|
||||
}
|
||||
$pre->add_stamp(1, true);
|
||||
$pre->show();
|
||||
|
||||
} else if ( $data == "export" ) {
|
||||
$xls = new SimpleXLS([
|
||||
'title'=>"Laporan Penjualan Detail Harian",
|
||||
'subject'=>"PT.PMS",
|
||||
'desc'=>"Export Data dari IAS"
|
||||
]);
|
||||
$xls->add_header("<b>".strtoupper($_SESSION['__WEB_APP']['REG_NAME'])."</b>");
|
||||
$xls->add_header("<b>LAPORAN PENJUALAN DETAIL HARIAN</b>");
|
||||
$xls->add_header($tglheader);
|
||||
|
||||
$xls->add_field("NO", 8, "C");
|
||||
$xls->add_field("NAMA PRODUK", 50, "L");
|
||||
$xls->add_field("QTY", 8, "R,N");
|
||||
$xls->add_field("SATUAN", 13, "L");
|
||||
$xls->add_field("HARGA @", 13, "R,N0");
|
||||
$xls->add_field("TOTAL", 13, "R,N0");
|
||||
$xls->add_sheet("PENJ.DET-HARIAN", false);
|
||||
|
||||
$nomor = 1; $no_ref = ""; $sub = 0; $dis = 0;
|
||||
while ($db->Next()) {
|
||||
if ($no_ref <> $db->Row("No_Ref")) {
|
||||
if ($no_ref <> "") {
|
||||
if ($dis > 0) {
|
||||
$xls->add_span(array("Sub. Total Rp.",4,"R,B"),array($sub,2,"R,B,N0"));
|
||||
$xls->add_span(array("Diskon Rp.",4,"R,B"),array($dis,2,"R,B,N0"));
|
||||
}
|
||||
$xls->add_span(array("TOTAL Rp.",4,"R,B"),array($sub-$dis,2,"R,B,N0"));
|
||||
$xls->add_empty_row();
|
||||
$sub = $dis = 0;
|
||||
$nomor = 1;
|
||||
}
|
||||
$xls->add_span(array("Outlet",1,"L"),array($db->Row("Nama_Outlet"),2,"L"),array("No. Nota",1,"L"),array($db->Row("No_Ref"),1,"L"),array($db->Row("No_Faktur"),1,"L"));
|
||||
$xls->add_span(array("Alamat",1,"L"),array($db->Row("Alamat_Outlet"),2,"L"),array("Sales",1,"L"),array($db->Row("Nama_Sales"),1,"L"),array("",1,"L"));
|
||||
$xls->show_headers();
|
||||
}
|
||||
$xls->add_value($nomor++, $db->Row("Nama_Produk").(($db->Row("Nama_Rasa"))?" (".$db->Row("Nama_Rasa").")":"").(($db->Row("Promo")>0)?" ***":""), $db->Row("Qty1"), $db->Row("Nama_Satuan"), $db->Row("Harga_Jual"), $db->Row("Sub_Total"));
|
||||
$no_ref = $db->Row("No_Ref");
|
||||
$sub += $db->Row("Sub_Total");
|
||||
$dis = $db->Row("Total_Diskon");
|
||||
}
|
||||
if ($nomor > 1) {
|
||||
if ($dis > 0) {
|
||||
$xls->add_span(array("Sub. Total Rp.",4,"R,B"),array($sub,2,"R,B,N0"));
|
||||
$xls->add_span(array("Diskon Rp.",4,"R,B"),array($dis,2,"R,B,N0"));
|
||||
}
|
||||
$xls->add_span(array("TOTAL Rp.",4,"R,B"),array($sub-$dis,2,"R,B,N0"));
|
||||
}
|
||||
|
||||
$xls->send("Laporan Penjualan Detail Harian.xlsx");
|
||||
unset($xls);
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$form = new Form($db);
|
||||
$trekap = $form->radio("_", "Rekap", "X", true, false, ["1"=>"Antar","0"=>"Belum Antar","X"=>"Semua"]);
|
||||
$tgrup = $form->option_db("_", "Grup_InvID", 0, true, false, "inv_produk_grup", ["Grup_InvID","Nama_Grup"], "TRUE ORDER BY Nama_Grup", [0,"SEMUA GRUP"]);
|
||||
$ttgldata = $form->datebox("_", "Tgl_Data", tgl_ymd(), true, false);
|
||||
echo '
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Rekap">Status Order</label>
|
||||
<div class="col">'.$trekap.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Grup_InvID">Grup Produk</label>
|
||||
<div class="col">'.$tgrup.'</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_Data">Tanggal Faktur</label>
|
||||
<div class="col">'.$ttgldata.'</div>
|
||||
</div>';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/jual_harian_pajak.php
|
||||
Desc. : PHP - Laporan Penjualan Harian Pajak
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : November 11st, 2011.
|
||||
Last Modified : December 27th, 2024.
|
||||
|
||||
(c) 2011 - 2024, 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;
|
||||
use siaupheng\fonia3\Data\SimpleXLS;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export" ) {
|
||||
$tgldata = Param::Get("Tgl_Data");
|
||||
|
||||
// generate report header
|
||||
$tglheader = "Periode : ".$tgldata;
|
||||
$tgldata = tgl_sql2str($tgldata);
|
||||
$ppn_string = "11";
|
||||
//$ppn_string = ($tgldata >= $_SESSION['__APP_IAS']['PPN_TGL']) ? $_SESSION['__APP_IAS']['PPN_STRING'] : "11";
|
||||
|
||||
$db->Query("SELECT P.Nama_Produk,S.Nama_Satuan,SUM(-D.Qty) Qty,SUM(-D.Qty*ROUND(D.Harga_Jual/(1+D.PPN),2)) Total_Jual,SUM(IF(D.Total_Diskon=(-D.Qty*D.Harga_Jual),-D.Qty*ROUND(D.Harga_Jual/(1+D.PPN),2),ROUND(D.Total_Diskon/(1+D.PPN),2))) Total_Diskon,D.PPN,K.No_Pajak,K.Nama_NPWP FROM inv_detail D LEFT JOIN inv_jual J ON (D.No_Ref=J.No_Jual) LEFT JOIN inv_jual_pajak K ON (J.No_Pajak=K.No_Pajak) LEFT JOIN inv_produk P ON (D.InvID=P.InvID) LEFT JOIN para_satuan S ON (D.SatuanID=S.SatuanID) WHERE K.Tgl_Pajak='".$tgldata."' AND P.Pajak=1 AND D.Qty<>0 GROUP BY J.No_Pajak,D.InvID, D.SatuanID");
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN PENJUALAN DETAIL HARIAN PAJAK", $tglheader);
|
||||
$pre = new PrintHTML();
|
||||
$pre->set_css("garis");
|
||||
$pre->add_field("NO.", 40, "C", "uang");
|
||||
$pre->add_field("NAMA PRODUK", 320);
|
||||
$pre->add_field("QTY", 60, "R");
|
||||
$pre->add_field("SATUAN", 80);
|
||||
$pre->add_field("TOTAL", 90, "R", "rupiah2");
|
||||
|
||||
$nomor = 1; $no_pajak = ""; $sub = 0; $dis = 0; $ppn = 0;
|
||||
while ($db->Next()) {
|
||||
$ppn = $db->Row("PPN");
|
||||
if ($no_pajak <> $db->Row("No_Pajak")) {
|
||||
if ($no_pajak <> "") {
|
||||
$tot_dpp = round($sub - $dis, 2);
|
||||
$tot_tax = round($tot_dpp * $ppn);
|
||||
$pre->add_span(array("",1),array("Sub. Total Rp.",3,"R,B"),array($sub,1,"R,B","rupiah2"));
|
||||
$pre->add_span(array("",1),array("Diskon Rp.",3,"R,B"),array($dis,1,"R,B","rupiah2"));
|
||||
$pre->add_span(array("",1),array("Total DPP Rp.",3,"R,B"),array($tot_dpp,1,"R,B","rupiah2"));
|
||||
$pre->add_span(array("",1),array("PPN (".$ppn_string."%) Rp.",3,"R,B"),array($tot_tax,1,"R,B","rupiah2"));
|
||||
$pre->add_span(array(" ",5,"L,NB"));
|
||||
$sub = $dis = 0;
|
||||
$nomor = 1;
|
||||
}
|
||||
$pre->add_span(array("<table width=\"100%\" class=\"pnormal\"><tr><td class=\"nb\" width=\"30%\">No. Pajak</td><td class=\"nb\">: ".$db->Row("No_Pajak")."</td></tr><tr><td class=\"nb\">Nama NPWP</td><td class=\"nb\">: ".$db->Row("Nama_NPWP")."</td></tr></table>",5,"L,B"));
|
||||
$pre->show_fields();
|
||||
}
|
||||
$pre->add_value($nomor++, $db->Row("Nama_Produk"), uang($db->Row("Qty"),2), $db->Row("Nama_Satuan"), $db->Row("Total_Jual"));
|
||||
$no_pajak = $db->Row("No_Pajak");
|
||||
$sub += $db->Row("Total_Jual");
|
||||
$dis += $db->Row("Total_Diskon");
|
||||
}
|
||||
if ($nomor > 1) {
|
||||
$tot_dpp = round($sub - $dis, 2);
|
||||
$tot_tax = round($tot_dpp * $ppn);
|
||||
$pre->add_span(array("",1),array("Sub. Total Rp.",3,"R,B"),array($sub,1,"R,B","rupiah2"));
|
||||
$pre->add_span(array("",1),array("Diskon Rp.",3,"R,B"),array($dis,1,"R,B","rupiah2"));
|
||||
$pre->add_span(array("",1),array("Total DPP Rp.",3,"R,B"),array($tot_dpp,1,"R,B","rupiah2"));
|
||||
$pre->add_span(array("",1),array("PPN (".$ppn_string."%) Rp.",3,"R,B"),array($tot_tax,1,"R,B","rupiah2"));
|
||||
}
|
||||
$pre->add_stamp(1, true);
|
||||
$pre->show();
|
||||
|
||||
} else if ( $data == "export" ) {
|
||||
$xls = new SimpleXLS([
|
||||
'title'=>"Laporan Penjualan Detail Harian Pajak",
|
||||
'subject'=>"PT.PMS",
|
||||
'desc'=>"Export Data dari IAS"
|
||||
]);
|
||||
$xls->add_header("<b>".strtoupper($_SESSION['__WEB_APP']['REG_NAME'])."</b>");
|
||||
$xls->add_header("<b>LAPORAN PENJUALAN DETAIL HARIAN PAJAK</b>");
|
||||
$xls->add_header($tglheader);
|
||||
|
||||
$xls->add_field("NO.", 10, "C");
|
||||
$xls->add_field("NAMA PRODUK", 80, "L");
|
||||
$xls->add_field("QTY", 20, "R,N");
|
||||
$xls->add_field("SATUAN", 12, "L");
|
||||
$xls->add_field("TOTAL", 20, "R,N");
|
||||
$xls->add_sheet("JUAL HARIAN PAJAK", false);
|
||||
|
||||
$nomor = 1; $no_pajak = ""; $sub = $dis = 0; $ppn = 0;
|
||||
while ($db->Next()) {
|
||||
$ppn = $db->Row("PPN");
|
||||
if ($no_pajak <> $db->Row("No_Pajak")) {
|
||||
if ($no_pajak <> "") {
|
||||
$tot_tax = round(($sub - $dis) * $ppn);
|
||||
$xls->add_span(array("Sub. Total Rp.",4,"R,B"),array($sub,1,"R,B,N"));
|
||||
$xls->add_span(array("Diskon Rp.",4,"R,B"),array($dis,1,"R,B,N"));
|
||||
$xls->add_span(array("Total Rp.",4,"R,B"),array($sub-$dis,1,"R,B,N"));
|
||||
$xls->add_span(array("PPN (".$ppn_string."%) Rp.",4,"R,B"),array($tot_tax,1,"R,B,N"));
|
||||
$xls->add_empty_row();
|
||||
//$xls->add_span(array("",5,"L,NL"));
|
||||
$sub = $dis = 0;
|
||||
$nomor = 1;
|
||||
}
|
||||
$xls->add_span(array("No. Pajak",2,"L,NL"),array($db->Row("No_Pajak"),3,"L,NL"));
|
||||
$xls->add_span(array("Nama NPWP",2,"L,NL"),array($db->Row("Nama_NPWP"),3,"L,NL"));
|
||||
$xls->show_headers();
|
||||
}
|
||||
$xls->add_value($nomor++, $db->Row("Nama_Produk"), $db->Row("Qty"), $db->Row("Nama_Satuan"), $db->Row("Total_Jual"));
|
||||
$no_pajak = $db->Row("No_Pajak");
|
||||
$sub += $db->Row("Total_Jual");
|
||||
$dis += $db->Row("Total_Diskon");
|
||||
}
|
||||
if ($nomor > 1) {
|
||||
$tot_tax = round(($sub - $dis) * $ppn);
|
||||
$xls->add_span(array("Sub. Total Rp.",4,"R,B"),array($sub,1,"R,B,N"));
|
||||
$xls->add_span(array("Diskon Rp.",4,"R,B"),array($dis,1,"R,B,N"));
|
||||
$xls->add_span(array("Total Rp.",4,"R,B"),array($sub-$dis,1,"R,B,N"));
|
||||
$xls->add_span(array("PPN (".$ppn_string."%) Rp.",4,"R,B"),array($tot_tax,1,"R,B,N"));
|
||||
}
|
||||
$xls->add_stamp(1, true);
|
||||
$xls->send("Laporan Penjualan Detail Harian Pajak.xlsx");
|
||||
unset($xls);
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$form = new Form($db);
|
||||
$ttgldata = $form->datebox("_", "Tgl_Data", tgl_ymd(), true, false);
|
||||
echo '
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Tgl_Data">Tanggal Pajak</label>
|
||||
<div class="col">'.$ttgldata.'</div>
|
||||
</div>';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/jual_retur.php
|
||||
Desc. : PHP - Laporan Retur Penjualan
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : April 12th, 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
|
||||
$id_outlet = Param::Get("OutletID", 0);
|
||||
$tglfrom = Param::Get("Tgl_From");
|
||||
$tglto = Param::Get("Tgl_To");
|
||||
$aoutlet = [];
|
||||
if ($id_outlet > 0) {
|
||||
$db->Query("SELECT * FROM para_outlet WHERE OutletID='".$id_outlet."' LIMIT 1");
|
||||
if ($db->Next()) $aoutlet = $db->AllRow();
|
||||
}
|
||||
|
||||
// generate report header
|
||||
$tglheader = "Periode : ".$tglfrom;
|
||||
if ($tglfrom!==$tglto) $tglheader .= " S/D ".$tglto;
|
||||
$tglfrom = tgl_sql2str($tglfrom);
|
||||
$tglto = tgl_sql2str($tglto);
|
||||
|
||||
$tsql = ($outid>0) ? " AND J.OutletID=".$outid : "";
|
||||
|
||||
if ($tipe=="R") {
|
||||
$db->Query("SELECT O.Nama_Outlet,SUM(J.Total_Jual) Total_Jual FROM inv_jual J LEFT JOIN para_outlet O ON (J.OutletID=O.OutletID) WHERE J.Data_Jual=0 AND (J.Tgl_Jual BETWEEN '".$tglfrom."' AND '".$tglto."')".$tsql." GROUP BY J.OutletID ORDER BY O.Nama_Outlet");
|
||||
} else {
|
||||
$db->Query("SELECT J.*,DATE_FORMAT(J.Tgl_Jual,'%d-%m-%Y') Tgl_Jual2,O.Nama_Outlet FROM inv_jual J LEFT JOIN para_outlet O ON (J.OutletID=O.OutletID) WHERE J.Data_Jual=0 AND (J.Tgl_Jual BETWEEN '".$tglfrom."' AND '".$tglto."')".$tsql." ORDER BY J.No_Jual");
|
||||
}
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN ".($tipe=="R"?"REKAP":"DETAIL")." RETUR PENJUALAN", $tglheader);
|
||||
$pre = new PrintHTML();
|
||||
$pre->set_css("garis");
|
||||
|
||||
if ($tipe=="R") {
|
||||
$pre->add_field("NO.",10,"C");
|
||||
$pre->add_field("NAMA OUTLET",80);
|
||||
$pre->add_field("TOTAL",20,"R","uang");
|
||||
|
||||
if ($outid>0) $pre->add_span(array("NAMA OUTLET",2,"L,NB"),array(": ".$aoutlet['Nama_Outlet'],1,"L,NB"));
|
||||
$pre->show_fields();
|
||||
|
||||
$subtotal = $nomor = 0;
|
||||
while ($db->Next()) {
|
||||
$nomor++;
|
||||
$subtotal += $db->Row("Total_Jual");
|
||||
$pre->add_value($nomor, $db->Row("Nama_Outlet"), $db->Row("Total_Jual"));
|
||||
}
|
||||
$pre->add_span(array(""),array("GRAND TOTAL",1,"L,B"),array($subtotal,1,"R,B","uang"));
|
||||
|
||||
} else {
|
||||
$pre->add_field("NO. NOTA",10,"C");
|
||||
$pre->add_field("TGL. NOTA",10,"C");
|
||||
$pre->add_field("NAMA OUTLET",80);
|
||||
$pre->add_field("TOTAL",20,"R","uang");
|
||||
$pre->add_field("CATATAN",30);
|
||||
|
||||
if ($outid>0) $pre->add_span(array("NAMA OUTLET",2,"L,NB"),array(": ".$nama_out,3,"L,NB"));
|
||||
$pre->show_fields();
|
||||
|
||||
$subtotal = 0;
|
||||
while ($db->Next()) {
|
||||
$subtotal += $db->Row("Total_Jual");
|
||||
$pre->add_value($db->Row("No_Jual"), $db->Row("Tgl_Jual2"), $db->Row("Nama_Outlet"), $db->Row("Total_Jual"), $db->Row("No_Faktur"));
|
||||
}
|
||||
$pre->add_span(array(""),array("GRAND TOTAL",2,"L,B"),array($subtotal,1,"R,B","uang"),array("",1));
|
||||
}
|
||||
$pre->add_stamp(1, true);
|
||||
$pre->show();
|
||||
|
||||
} else if ( $data == "brow-outlet" ) {
|
||||
$tcari = trim(Param::Get("Cari_Outlet"));
|
||||
$tsql = ($tcari=="") ? " LIMIT 100" : " AND CONCAT(Nama_Outlet,Telp_Outlet,Nama_Outlet) LIKE '%".$tcari."%'";
|
||||
|
||||
$obj = new Table($db);
|
||||
$obj->set_query("SELECT * FROM vi_para_outlet WHERE Aktif=1".$tsql);
|
||||
$obj->add_field("OutletID", "ID", "hid");
|
||||
$obj->add_field("Kode_Outlet", "Kode", "c");
|
||||
$obj->add_field("Nama_Alamat", "Nama Outlet", "awr");
|
||||
$obj->add_field("Alamat_Kota", "Alamat & Kota", "awr");
|
||||
$obj->set_field_order("Nama_Outlet", "A");
|
||||
$obj->add_row_btn("save", "Pilih", "RepoJualReturJS.outlet_select");
|
||||
$obj->set_func_navi("RepoJualReturJS.data_query('brow-outlet')");
|
||||
$ajson[] = $obj->json_table("divBrowOutlet");
|
||||
|
||||
} else if ( $data == "auto-outlet" ) {
|
||||
$tcari = Param::Get("Auto_Query");
|
||||
$ajson['autodata'] = [['value' => 0, 'text' => "SEMUA OUTLET", 'data' => ""]];
|
||||
if (is_string($tcari) && strlen($tcari) < 64) {
|
||||
$db->Query("SELECT * FROM vi_para_outlet WHERE Aktif=1 AND CONCAT(Nama_Outlet,Alamat_Outlet) LIKE '%".$tcari."%' ORDER BY Nama_Outlet LIMIT 50");
|
||||
while ($db->Next()) {
|
||||
$ajson['autodata'][] = ['value'=>$db->Row("OutletID"), 'text'=>$db->Row("Nama_Alamat"), 'data'=>$db->Row("Alamat_Kota")];
|
||||
}
|
||||
}
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$form = new Form($db);
|
||||
$ttipe = $form->radio("_", "Tipe", "R", true, false, ["R"=>"Rekap","D"=>"Detail"]);
|
||||
$toutlet = $form->textauto("_", "Nama_Outlet", ['value'=>0,'text'=>"SEMUA OUTLET"], true, false);
|
||||
$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">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Nama_Outlet">Nama Outlet</label>
|
||||
<div class="col"><div class="input-group">'.$toutlet.'<button class="btn btn-info" type="button" onclick="RepoJualReturJS.outlet_brow();"><i class="bi-search"></i></button></div></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>
|
||||
<input type="hidden" id="OutletID" value="0">';
|
||||
|
||||
}
|
||||
|
||||
send_json($ajson);
|
||||
?>
|
||||
@@ -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>';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,477 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/nota.php
|
||||
Desc. : PHP - Cetak Nota
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : April 12th, 2011.
|
||||
Last Modified : July 5th, 2025.
|
||||
|
||||
(c) 2011 - 2025, 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\Web\Param;
|
||||
|
||||
function nota_beli($db, $nota="") {
|
||||
if (trim($nota)=="") return;
|
||||
$baris_faktur = 8;
|
||||
|
||||
$ainfo = [];
|
||||
$db->Query("SELECT B.*,DATE_FORMAT(B.Tgl_Beli,'%d-%m-%Y') Tgl_Beli2,DATE_FORMAT(B.Tgl_JT,'%d-%m-%Y') Tgl_JT2,S.Nama_Sup,S.Alamat_Sup,S.No_NPWP,B.Total_Beli-B.Total_Diskon Jumlah FROM (SELECT * FROM inv_beli WHERE No_Beli='".$nota."' LIMIT 1) B LEFT JOIN para_supplier S ON (S.SupID=B.SupID)");
|
||||
if ($db->Next()) $ainfo = $db->AllRow();
|
||||
$ainfo['Alamat_Sup'] = str_replace("\n", " ", $ainfo['Alamat_Sup']);
|
||||
|
||||
$db->Query("SELECT D.*,P.Nama_Produk,S.Nama_Satuan,R.Nama_Rasa FROM (SELECT InvID,RasaID,SatuanID,Harga_Pokok,SUM(Qty) Qty,SUM(Qty*Harga_Pokok) Jumlah,SUM(Total_Diskon) Total_Diskon FROM inv_detail WHERE No_Ref='".$nota."' GROUP BY InvID,RasaID,SatuanID,Harga_Pokok) D LEFT JOIN inv_produk P ON (P.InvID=D.InvID) LEFT JOIN para_satuan S ON (S.SatuanID=D.SatuanID) LEFT JOIN para_rasa R ON (R.RasaID=D.RasaID) ORDER BY P.Nama_Produk");
|
||||
//if ($db->RecordCount()==0) return;
|
||||
|
||||
// menampilkan judul dibagian atas laporan
|
||||
$kop = '<div class="notaTitle">FAKTUR PEMBELIAN</div>';
|
||||
$kop .= '<table class="notaAddress"><tbody>';
|
||||
$kop .= '<tr><td class="w50">'.$_SESSION['__WEB_APP']['REG_NAME'].'</td><td class="w50">Terima Dari Yth. :</td></tr>';
|
||||
$kop .= '<tr><td class="w50">Telp. '.$_SESSION['__WEB_APP']['REG_PHONE'].'</td><td class="w50">'.$ainfo['Nama_Sup'].'</td></tr>';
|
||||
$kop .= '<tr><td class="w50">Fax. '.$_SESSION['__WEB_APP']['REG_FAX'].'</td><td class="w50">'.$ainfo['Alamat_Sup'].'</td></tr>';
|
||||
$kop .= '<tr><td> </td><td>'.$ainfo['No_NPWP'].'</td></tr>';
|
||||
$kop .= '</tbody></table>';
|
||||
$kop .= '<table class="notaDesc"><tbody>';
|
||||
$kop .= '<tr><td width="15%">No. Nota</td><td width="35%" class="ttkdua">'.$ainfo['No_Beli'].'</td><td width="15%">Tanggal</td><td width="35%" class="ttkdua">'.$ainfo['Tgl_Beli2'].'</td></tr>';
|
||||
$kop .= '<tr><td>No. Faktur</td><td class="ttkdua">'.$ainfo['No_Faktur'].'</td><td>Jatuh Tempo</td><td class="ttkdua">'.$ainfo['Tgl_JT2'].'</td></tr>';
|
||||
$kop .= '</tbody></table>';
|
||||
|
||||
$header = '<table class="notaTable"><thead><tr><th style="width:1cm">No.</th><th>Nama Produk</th><th style="width:1.8cm">Qty</th><th style="width:2cm">Satuan</th><th style="width:2.6cm">Harga @</th><th style="width:2.8cm">Total</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="c">%s</td><td>%s</td><td class="r">%s</td><td>%s</td><td class="r">%s</td><td class="r">%s</td></tr>';
|
||||
$_bline = '<tr><td class="b"> </td><td class="b r" colspan="3">%s</td><td class="b r" colspan="2">%s</td></tr>';
|
||||
|
||||
$body = ""; $no_urut = 1;
|
||||
while ($db->Next()) {
|
||||
$body .= sprintf($_line, $no_urut++, $db->Row("Nama_Produk").(($db->Row("Nama_Rasa"))?" (".$db->Row("Nama_Rasa").")":""), rupiah2($db->Row("Qty")), $db->Row("Nama_Satuan"), rupiah($db->Row("Harga_Pokok")), rupiah($db->Row("Jumlah")));
|
||||
}
|
||||
if ($no_urut <= $baris_faktur) {
|
||||
$no_urut--;
|
||||
for ($x=$baris_faktur; $x>fmod($no_urut, $baris_faktur); $x--) {
|
||||
$body .= sprintf($_line, " ", " ", " "," ", " ", " ");
|
||||
}
|
||||
}
|
||||
$body .= sprintf($_bline, "Sub. Total Rp.", rupiah($ainfo['Total_Beli']));
|
||||
$body .= sprintf($_bline, "Diskon Rp.", rupiah($ainfo['Total_Diskon']));
|
||||
$body .= sprintf($_bline, "Total Rp.", rupiah($ainfo['Jumlah']));
|
||||
|
||||
$body .= '</tbody></table>';
|
||||
$body .= '<table class="notaFooter"><tr height="80"><td>Penerima,</td><td>Hormat Kami,</td></tr><tr><td>Tanda Tangan & Cap Perusahaan</td><td class="r stamp">'.Report_Stamp(1,true).'</td></tr></table>';
|
||||
|
||||
echo '<div class="printNota">' . $kop . $header . $body . '</div>';
|
||||
}
|
||||
|
||||
function nota_jual($db, $nota="") {
|
||||
if (trim($nota)=="") return;
|
||||
$baris_faktur = 8;
|
||||
|
||||
$ainfo = [];
|
||||
$db->Query("SELECT J.*,DATE_FORMAT(J.Tgl_Jual,'%d-%m-%Y') Tgl_Jual2,DATE_FORMAT(J.Tgl_JT,'%d-%m-%Y') Tgl_JT2,O.Nama_Outlet,O.Alamat_Outlet,O.No_NPWP,O.No_NIK,O.Nama_NPWP,O.Alamat_NPWP,S.Kode_Pegawai Kode_Sales,S.Nama_Pegawai Nama_Sales,J.Total_Jual-J.Total_Diskon Jumlah FROM (SELECT * FROM inv_jual WHERE No_Jual='".$nota."' LIMIT 1) J LEFT JOIN para_outlet O ON (O.OutletID=J.OutletID) LEFT JOIN para_pegawai S ON (J.SalesID=S.PegID)");
|
||||
if ($db->Next()) $ainfo = $db->AllRow();
|
||||
$ainfo['Alamat_Outlet'] = str_replace("\n", " ", $ainfo['Alamat_Outlet']);
|
||||
$ainfo['Alamat_NPWP'] = str_replace("\n", " ", $ainfo['Alamat_NPWP']);
|
||||
$ainfo['No_NPWP'] = ($ainfo['No_NPWP']==0) ? "NIK : ".$ainfo['No_NIK'] : "NPWP : ".$ainfo['No_NPWP'];
|
||||
|
||||
$db->Query("SELECT SUM(-Qty*Harga_Jual) Total_Jual,SUM(Total_Diskon) Total_Diskon,SUM((-Qty*Harga_Jual)-Total_Diskon) Jumlah FROM inv_detail WHERE No_Ref='".$nota."' AND Qty<>0 AND InvID IN (".$_SESSION['__APP_IAS']['PRODUK_EX'].")");
|
||||
if ($db->Next()) {
|
||||
$ainfo['Total_Jual'] -= $db->RowFloat("Total_Jual", 0);
|
||||
$ainfo['Total_Diskon'] -= $db->RowFloat("Total_Diskon", 0);
|
||||
$ainfo['Jumlah'] -= $db->RowFloat("Jumlah", 0);
|
||||
}
|
||||
|
||||
$db->Query("SELECT D.*,P.Nama_Produk,S.Nama_Satuan,R.Nama_Rasa FROM (SELECT InvID,RasaID,SatuanID,Harga_Jual,SUM(Total_Diskon) Total_Diskon,SUM(-Qty) Qty,SUM((-Qty*Harga_Jual)-Total_Diskon) Jumlah FROM inv_detail WHERE No_Ref='".$nota."' AND Qty<>0 AND InvID NOT IN(".$_SESSION['__APP_IAS']['PRODUK_EX'].") GROUP BY InvID,RasaID,SatuanID,Harga_Jual) D LEFT JOIN inv_produk P ON (P.InvID=D.InvID) LEFT JOIN para_satuan S ON (D.SatuanID=S.SatuanID) LEFT JOIN para_rasa R ON (R.RasaID=D.RasaID) ORDER BY P.Nama_Produk");
|
||||
|
||||
// menampilkan judul dibagian atas laporan
|
||||
$kop = '<div class="notaTitle">FAKTUR PENJUALAN</div>';
|
||||
$kop .= '<table class="notaAddress"><tbody>';
|
||||
if ($ainfo['Nama_Outlet']==$ainfo['Nama_NPWP'] && $ainfo['Alamat_Outlet']==$ainfo['Alamat_NPWP']) {
|
||||
$kop .= '<tr><td class="w50">'.$_SESSION['__WEB_APP']['REG_NAME'].'</td><td class="w50">Kepada Yth. :</td></tr>';
|
||||
$kop .= '<tr><td class="w50">Telp. '.$_SESSION['__WEB_APP']['REG_PHONE'].'</td><td class="w50">'.$ainfo['Nama_Outlet'].'</td></tr>';
|
||||
$kop .= '<tr><td class="w50">Fax. '.$_SESSION['__WEB_APP']['REG_FAX'].'</td><td class="w50">'.$ainfo['Alamat_Outlet'].'</td></tr>';
|
||||
} else {
|
||||
$kop .= '<tr><td>'.$_SESSION['__WEB_APP']['REG_NAME'].'</td><td>Kepada Yth. :</td><td>Dikirim Ke :</td></tr>';
|
||||
$kop .= '<tr><td>Telp. '.$_SESSION['__WEB_APP']['REG_PHONE'].'</td><td>'.$ainfo['Nama_NPWP'].'</td><td>'.$ainfo['Nama_Outlet'].'</td></tr>';
|
||||
$kop .= '<tr><td>Fax. '.$_SESSION['__WEB_APP']['REG_FAX'].'</td><td>'.$ainfo['Alamat_NPWP'].'</td><td rowspan="2">'.$ainfo['Alamat_Outlet'].' '.$ainfo['Kota_Outlet'].'</td></tr>';
|
||||
}
|
||||
$kop .= '<tr><td> </td><td>'.$ainfo['No_NPWP'].'</td></tr>';
|
||||
$kop .= '</tbody></table>';
|
||||
$kop .= '<table class="notaDesc"><tbody>';
|
||||
$kop .= '<tr><td width="15%">No. Faktur</td><td width="35%" class="ttkdua">'.$ainfo['No_Jual'].'</td><td width="15%">Tanggal</td><td width="35%" class="ttkdua">'.$ainfo['Tgl_Jual2'].'</td></tr>';
|
||||
$kop .= '<tr><td>Sales</td><td class="ttkdua">'.$ainfo['Nama_Sales'].($ainfo['Kode_Sales']==""?"":" (".$ainfo['Kode_Sales'].")").'</td><td>Jatuh Tempo</td><td class="ttkdua">'.$ainfo['Tgl_JT2'].'</td></tr>';
|
||||
$kop .= '</tbody></table>';
|
||||
|
||||
$header = '<table class="notaTable"><thead><tr><th style="width:1cm">No.</th><th>Nama Produk</th><th style="width:1.8cm">Qty</th><th style="width:2cm">Satuan</th><th style="width:2.6cm">Harga @</th><th style="width:2.3cm">Diskon</th><th style="width:2.8cm">Total</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="c">%s</td><td>%s</td><td class="r">%s</td><td>%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td></tr>';
|
||||
$_bline = '<tr><td class="b"> </td><td class="b r" colspan="4">%s</td><td class="b r" colspan="2">%s</td></tr>';
|
||||
|
||||
$body = ""; $no_urut = 1;
|
||||
while ($db->Next()) {
|
||||
if ($db->Row("Qty", 0)==0) continue;
|
||||
$body .= sprintf($_line, $no_urut++, $db->Row("Nama_Produk").(($db->Row("Nama_Rasa"))?" (".$db->Row("Nama_Rasa").")":""), rupiah2($db->Row("Qty")), $db->Row("Nama_Satuan"), rupiah($db->Row("Harga_Jual")), rupiah($db->Row("Total_Diskon")), rupiah($db->Row("Jumlah")));
|
||||
}
|
||||
if ($no_urut <= $baris_faktur) {
|
||||
$no_urut--;
|
||||
for ($x=$baris_faktur; $x>fmod($no_urut, $baris_faktur); $x--) {
|
||||
$body .= sprintf($_line, " ", " ", " "," ", " ", " ", " ");
|
||||
}
|
||||
}
|
||||
$body .= sprintf($_bline, "Sub. Total Rp.", rupiah($ainfo['Total_Jual']));
|
||||
$body .= sprintf($_bline, "Diskon Rp.", rupiah($ainfo['Total_Diskon']));
|
||||
$body .= sprintf($_bline, "Total Rp.", rupiah($ainfo['Jumlah']));
|
||||
|
||||
$body .= '</tbody></table>';
|
||||
$body .= '<table class="notaFooter"><tr height="80"><td>Penerima,</td><td>Hormat Kami,</td></tr><tr><td>Tanda Tangan & Cap Perusahaan</td><td class="r stamp">'.Report_Stamp(1,true).'</td></tr></table>';
|
||||
|
||||
echo '<div class="printNota">' . $kop . $header . $body . '</div>';
|
||||
}
|
||||
|
||||
function nota_retur_beli($db, $nota="") {//
|
||||
if (trim($nota)=="") return;
|
||||
$baris_faktur = 8;
|
||||
|
||||
$ainfo = [];
|
||||
$db->Query("SELECT R.*,DATE_FORMAT(R.Tgl_Beli,'%d-%m-%Y') Tgl_Beli2,S.Nama_Sup,S.Alamat_Sup,R.Total_Beli Jumlah FROM (SELECT * FROM inv_beli WHERE No_Beli='".$nota."' LIMIT 1) R LEFT JOIN para_supplier S ON (S.SupID=R.SupID)");
|
||||
if ($db->Next()) $ainfo = $db->AllRow();
|
||||
$ainfo['Alamat_Sup'] = str_replace("\n", "<br>", $ainfo['Alamat_Sup']);
|
||||
|
||||
$db->Query("SELECT D.*,P.Nama_Produk,S.Nama_Satuan,R.Nama_Rasa FROM (SELECT InvID,RasaID,SatuanID,Harga_Pokok,SUM(-Qty) Qty,SUM(-Qty*Harga_Pokok) Jumlah FROM inv_detail WHERE No_Ref='".$nota."' GROUP BY InvID,RasaID,SatuanID,Harga_Pokok) D LEFT JOIN inv_produk P ON (P.InvID=D.InvID) LEFT JOIN para_satuan S ON (S.SatuanID=D.SatuanID) LEFT JOIN para_rasa R ON (R.RasaID=D.RasaID) ORDER BY P.Nama_Produk");
|
||||
//if ($db->RecordCount()==0) return;
|
||||
|
||||
// menampilkan judul dibagian atas laporan
|
||||
$kop = '<h5 class="text-center">RETUR PEMBELIAN</h5>';
|
||||
$kop .= '<table class="notaHeader"><tbody>';
|
||||
$kop .= '<tr><td colspan="2">'.$_SESSION['__WEB_APP']['REG_NAME'].'</td><td colspan="2">Kepada Yth. :</td></tr>';
|
||||
$kop .= '<tr><td colspan="2">Telp. '.$_SESSION['__WEB_APP']['REG_PHONE'].'</td><td colspan="2">'.$ainfo['Nama_Sup'].'</td></tr>';
|
||||
$kop .= '<tr><td colspan="2">Fax. '.$_SESSION['__WEB_APP']['REG_FAX'].'</td><td colspan="2">'.$ainfo['Alamat_Sup'].'</td></tr>';
|
||||
$kop .= '<tr><td colspan="4"> </td></tr>';
|
||||
$kop .= '<tr><td width="20%">No. Retur</td><td width="30%">'.$ainfo['No_Beli'].'</td><td width="20%">Tanggal</td><td width="30%">'.$ainfo['Tgl_Beli2'].'</td></tr>';
|
||||
$kop .= '</tbody></table>';
|
||||
|
||||
$header = '<table class="garis"><thead><tr><th style="width:1cm">No.</th><th>Nama Produk</th><th style="width:1.8cm">Qty</th><th style="width:1.8cm">Satuan</th><th style="width:2.8cm">Harga @</th><th style="width:2.8cm">Total</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="c">%s</td><td>%s</td><td class="r">%s</td><td>%s</td><td class="r">%s</td><td class="r">%s</td></tr>';
|
||||
$_bline = '<tr><td class="b"> </td><td class="b r" colspan="3">%s</td><td class="b r" colspan="2">%s</td></tr>';
|
||||
|
||||
$body = ""; $no_urut = 1;
|
||||
while ($db->Next()) {
|
||||
$body .= sprintf($_line, $no_urut++, $db->Row("Nama_Produk").(($db->Row("Nama_Rasa"))?" (".$db->Row("Nama_Rasa").")":""), rupiah2($db->Row("Qty")), $db->Row("Nama_Satuan"), rupiah($db->Row("Harga_Pokok")), rupiah($db->Row("Jumlah")));
|
||||
}
|
||||
if ($no_urut <= $baris_faktur) {
|
||||
$no_urut--;
|
||||
for ($x=$baris_faktur; $x>fmod($no_urut, $baris_faktur); $x--) {
|
||||
$body .= sprintf($_line, " ", " ", " "," ", " ", " ");
|
||||
}
|
||||
}
|
||||
$body .= sprintf($_bline, "Total Rp.", rupiah($ainfo['Jumlah']));
|
||||
|
||||
$body .= '<table class="notaFooter">';
|
||||
if ($ainfo['No_Faktur']<>"") $body .= '<tr><td colspan="2">Catatan : <i>'.$ainfo['No_Faktur'].'</i>.</td></tr>';
|
||||
$body .= '<tr height="80"><td width="50%">Penerima,</td><td>Hormat Kami,</td></tr><tr><td>Tanda Tangan & Cap Perusahaan</td><td class="r stamp">'.Report_Stamp(1,true).'</td></tr></table>';
|
||||
|
||||
echo '<div class="printNota">' . $kop . $header . $body . '</tbody></table></div>';
|
||||
}
|
||||
|
||||
function nota_retur_jual($db, $nota="") {//
|
||||
if (trim($nota)=="") return;
|
||||
$baris_faktur = 8;
|
||||
|
||||
$ainfo = [];
|
||||
$db->Query("SELECT R.*,DATE_FORMAT(R.Tgl_Jual,'%d-%m-%Y') Tgl_Jual2,O.Nama_Outlet,O.Alamat_Outlet,-R.Total_Jual Jumlah FROM (SELECT * FROM inv_jual WHERE No_Jual='".$nota."' LIMIT 1) R LEFT JOIN para_outlet O ON (O.OutletID=R.OutletID)");
|
||||
if ($db->Next()) $ainfo = $db->AllRow();
|
||||
$ainfo['Alamat_Outlet'] = str_replace("\n", "<br>", $ainfo['Alamat_Outlet']);
|
||||
|
||||
$db->Query("SELECT D.*,P.Nama_Produk,S.Nama_Satuan,R.Nama_Rasa FROM (SELECT InvID,RasaID,SatuanID,Harga_Jual,SUM(Qty) Qty,SUM(Qty*Harga_Jual) Jumlah FROM inv_detail WHERE No_Ref='".$nota."' GROUP BY InvID,RasaID,SatuanID,Harga_Jual) D LEFT JOIN inv_produk P ON (P.InvID=D.InvID) LEFT JOIN para_satuan S ON (S.SatuanID=D.SatuanID) LEFT JOIN para_rasa R ON (R.RasaID=D.RasaID) ORDER BY P.Nama_Produk");
|
||||
//if ($db->RecordCount()==0) return;
|
||||
|
||||
// menampilkan judul dibagian atas laporan
|
||||
$kop = '<h5 class="text-center">RETUR PENJUALAN</h5>';
|
||||
$kop .= '<table class="notaHeader"><tbody>';
|
||||
$kop .= '<tr><td colspan="2">'.$_SESSION['__WEB_APP']['REG_NAME'].'</td><td colspan="2">Kepada Yth. :</td></tr>';
|
||||
$kop .= '<tr><td colspan="2">Telp. '.$_SESSION['__WEB_APP']['REG_PHONE'].'</td><td colspan="2">'.$ainfo['Nama_Outlet'].'</td></tr>';
|
||||
$kop .= '<tr><td colspan="2">Fax. '.$_SESSION['__WEB_APP']['REG_FAX'].'</td><td colspan="2">'.$ainfo['Alamat_Outlet'].'</td></tr>';
|
||||
$kop .= '<tr><td colspan="4"> </td></tr>';
|
||||
$kop .= '<tr><td width="20%">Nomor Retur / Tanggal Retur</td><td width="30%">: '.$ainfo['No_Jual'].' / '.$ainfo['Tgl_Jual2'].'</td></tr>';
|
||||
$kop .= '</tbody></table>';
|
||||
|
||||
$header = '<table class="garis"><thead><tr><th style="width:1cm">No.</th><th>Nama Produk</th><th style="width:1.8cm">Qty</th><th style="width:1.8cm">Satuan</th><th style="width:2.8cm">Harga @</th><th style="width:2.8cm">Total</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="c">%s</td><td>%s</td><td class="r">%s</td><td>%s</td><td class="r">%s</td><td class="r">%s</td></tr>';
|
||||
$_bline = '<tr><td class="b"> </td><td class="b r" colspan="3">%s</td><td class="b r" colspan="2">%s</td></tr>';
|
||||
|
||||
$body = ""; $no_urut = 1;
|
||||
while ($db->Next()) {
|
||||
$body .= sprintf($_line, $no_urut++, $db->Row("Nama_Produk").(($db->Row("Nama_Rasa"))?" (".$db->Row("Nama_Rasa").")":""), rupiah2($db->Row("Qty")), $db->Row("Nama_Satuan"), rupiah($db->Row("Harga_Jual")), rupiah($db->Row("Jumlah")));
|
||||
}
|
||||
if ($no_urut <= $baris_faktur) {
|
||||
$no_urut--;
|
||||
for ($x=$baris_faktur; $x>fmod($no_urut, $baris_faktur); $x--) {
|
||||
$body .= sprintf($_line, " ", " ", " "," ", " ", " ");
|
||||
}
|
||||
}
|
||||
$body .= sprintf($_bline, "Total Rp.", rupiah($ainfo['Jumlah']));
|
||||
|
||||
$body .= '<table class="notaFooter">';
|
||||
if ($ainfo['Catatan']<>"") $body .= '<tr><td colspan="2">Catatan : <i>'.$ainfo['Catatan'].'</i>.</td></tr>';
|
||||
$body .= '<tr height="80"><td width="50%">Penerima,</td><td>Hormat Kami,</td></tr><tr><td>Tanda Tangan & Cap Perusahaan</td><td class="r stamp">'.Report_Stamp(1,true).'</td></tr></table>';
|
||||
|
||||
echo '<div class="printNota">' . $kop . $header . $body . '</tbody></table></div>';
|
||||
}
|
||||
|
||||
function nota_do_produk($db, $nota="", $w_catat=0) {
|
||||
if (trim($nota)=="") return;
|
||||
$asatuan = []; $ainfo = [];
|
||||
$db->Query("SELECT Kode_Satuan FROM para_satuan ORDER BY Urut");//todo: hilangkan nomor urut
|
||||
while ($db->Next()) $asatuan[$db->Row("Kode_Satuan")] = 0;
|
||||
|
||||
$db->Query("SELECT DO.No_DO,DO.Catatan,DATE_FORMAT(DO.Tgl_DO,'%d-%m-%Y') Tgl_DO2,M.Nama_Mobil,S.Nama_Pegawai Nama_Supir,Nama_Picker(DO.A_Picker) Nama_Picker FROM (SELECT * FROM inv_jual_do WHERE No_DO='".$nota."') DO LEFT JOIN para_mobil M ON (DO.MobilID=M.MobilID) LEFT JOIN para_pegawai S ON (DO.SupirID=S.PegID)");
|
||||
if ($db->Next()) $ainfo = $db->AllRow();
|
||||
|
||||
$db->Query("SELECT P.Kode_Produk,R.Kode_Rasa,S.Kode_Satuan,D.Qty,P.Grup_InvID Grup FROM (SELECT InvID,RasaID,SatuanID,SUM(-Qty) Qty FROM inv_detail WHERE No_Ref IN (SELECT No_Jual FROM inv_jual WHERE No_DO='".$nota."') GROUP BY InvID,RasaID,SatuanID) D LEFT JOIN inv_produk P ON (D.InvID=P.InvID) LEFT JOIN para_rasa R ON (D.RasaID=R.RasaID) LEFT JOIN para_satuan S ON (D.SatuanID=S.SatuanID) ORDER BY P.Pajak DESC,P.Grup_InvID,D.InvID");
|
||||
|
||||
// menampilkan judul dibagian atas laporan
|
||||
$kop = '<div class="text-center"><span class="fs-6 fw-bold">'.$_SESSION['__WEB_APP']['REG_NAME'].'</span><br>DELIVERY ORDER (DO)</div>';
|
||||
$kop .= '<table class="notaHeader"><tbody>';
|
||||
$kop .= '<tr><td width="15%">No. DO</td><td width="35%" class="ttkdua">'.$ainfo['No_DO'].'</td><td width="15%">Driver</td><td width="35%" class="ttkdua">'.$ainfo['Nama_Supir'].'</td></tr>';
|
||||
$kop .= '<tr><td>Tanggal</td><td class="ttkdua">'.$ainfo['Tgl_DO2'].'</td><td>Helper</td><td class="ttkdua">'.$ainfo['Nama_Picker'].'</td></tr>';
|
||||
$kop .= '<tr><td>Kendaraan</td><td colspan="3" class="ttkdua">'.$ainfo['Nama_Mobil'].'</td></tr>';
|
||||
$kop .= '</tbody></table>';
|
||||
|
||||
$header = '<table class="garis"><thead><tr><th style="width:1cm">No.</th><th>Produk</th><th style="width:2.2cm">Jumlah</th><th style="width:2cm">Satuan</th><th style="width:2.2cm">Kembali</th><th style="width:2.2cm">Total</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="c">%s</td><td>%s</td><td class="r">%s</td><td>%s</td><td class="r">%s</td><td class="r">%s</td></tr>';
|
||||
$_bline = '<tr><td class="b c" colspan="4">%s</td><td class="b r">%s</td><td class="b r">%s</td></tr>';
|
||||
|
||||
$body = $kop.$header; $no_urut = 1; $sub_jenis = 0;
|
||||
while ($db->Next()) {
|
||||
$mark = "";
|
||||
if ($db->Row("Grup")==$_SESSION['__APP_IAS']['GRUP_PRODUK_KEMASAN']) $mark = " *)";
|
||||
if ($db->Row("Grup")==$_SESSION['__APP_IAS']['GRUP_PRODUK_HADIAH']) $mark = " ***";
|
||||
if ($db->Row("Grup")<>$_SESSION['__APP_IAS']['GRUP_PRODUK_KEMASAN'] && $db->Row("Grup")<>$_SESSION['__APP_IAS']['GRUP_PRODUK_HADIAH']) {
|
||||
$asatuan[$db->Row("Kode_Satuan")] += $db->Row("Qty");
|
||||
$sub_jenis++;
|
||||
}
|
||||
$body .= sprintf($_line, $no_urut++, $db->Row("Kode_Produk").(($db->Row("Kode_Rasa"))?" (".$db->Row("Kode_Rasa").")":"").$mark, rupiah2($db->Row("Qty")), $db->Row("Kode_Satuan"), "", "");
|
||||
}
|
||||
$ket_produk = "";
|
||||
foreach ($asatuan as $key => $val) {
|
||||
if ($val > 0) $ket_produk .= " / ".rupiah2($val)." ".strtoupper($key);
|
||||
}
|
||||
$ket_produk = substr($ket_produk, 3);
|
||||
$body .= sprintf($_bline, $sub_jenis." ITEM PRODUK (".$ket_produk.")", "", "");
|
||||
|
||||
$t_catat = ($w_catat==1 && $ainfo['Catatan']<>"") ? '<i>'.nl2br($ainfo['Catatan']).'</i>.' : ' ';
|
||||
$body .= '</tbody></table><table class="notaFooter"><tr height="80"><td colspan="2">'.$t_catat.'</td></tr><tr><td width="50%" class="stamp"> </td><td class="r stamp">'.Report_Stamp(1,true).'</td></tr></table>';
|
||||
|
||||
echo '<div>' . $body . '</div>';
|
||||
}
|
||||
|
||||
function nota_do_faktur($db, $nota = "", $w_catat=0) {
|
||||
if (trim($nota)=="") return;
|
||||
|
||||
$ainfo = [];
|
||||
$db->Query("SELECT DO.No_DO,DO.Catatan,DATE_FORMAT(DO.Tgl_DO,'%d-%m-%Y') Tgl_DO2,M.Nama_Mobil,S.Nama_Pegawai Nama_Supir,Nama_Picker(DO.A_Picker) Nama_Picker FROM (SELECT * FROM inv_jual_do WHERE No_DO='".$nota."') DO LEFT JOIN para_mobil M ON (DO.MobilID=M.MobilID) LEFT JOIN para_pegawai S ON (DO.SupirID=S.PegID)");
|
||||
if ($db->Next()) $ainfo = $db->AllRow();
|
||||
|
||||
$db->Query("SELECT J.*,DATE_FORMAT(J.Tgl_Jual,'%d-%m-%Y') Tgl_Jual2,J.Total_Jual-J.Total_Diskon Total_Nota,O.Nama_Outlet,S.Nama_Pegawai FROM (SELECT * FROM inv_jual WHERE No_DO='".$nota."') J LEFT JOIN para_outlet O ON (J.OutletID=O.OutletID) LEFT JOIN para_pegawai S ON (J.SalesID=S.PegID) ORDER BY J.No_Jual");
|
||||
|
||||
// menampilkan judul dibagian atas laporan
|
||||
$kop = '<div class="text-center"><span class="fs-6 fw-bold">'.$_SESSION['__WEB_APP']['REG_NAME'].'</span><br>DELIVERY ORDER (DO)</div>';
|
||||
$kop .= '<table class="notaHeader"><tbody>';
|
||||
$kop .= '<tr><td width="15%">No. DO</td><td width="35%" class="ttkdua">'.$ainfo['No_DO'].'</td><td width="15%">Driver</td><td width="35%" class="ttkdua">'.$ainfo['Nama_Supir'].'</td></tr>';
|
||||
$kop .= '<tr><td>Tanggal</td><td class="ttkdua">'.$ainfo['Tgl_DO2'].'</td><td>Helper</td><td class="ttkdua">'.$ainfo['Nama_Picker'].'</td></tr>';
|
||||
$kop .= '<tr><td>Kendaraan</td><td colspan="3" class="ttkdua">'.$ainfo['Nama_Mobil'].'</td></tr>';
|
||||
$kop .= '</tbody></table>';
|
||||
|
||||
$header = '<table class="garis"><thead><tr><th style="width:1cm">No.</th><th style="width:2cm">No. Faktur</th><th style="width:2.5cm">Tgl. Faktur</th><th>Nama Outlet</th><th style="width:2.2cm">Jumlah</th><th>Sales</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="c">%s</td><td class="c">%s</td><td class="c">%s</td><td>%s</td><td class="r">%s</td><td>%s</td></tr>';
|
||||
$_bline = '<tr><td class="b c" colspan="4">%s</td><td class="b r">%s</td><td class="b r">%s</td></tr>';
|
||||
|
||||
$body = $kop.$header; $no_urut = 1; $tot_nota = 0;
|
||||
while ($db->Next()) {
|
||||
$body .= sprintf($_line, $no_urut++, $db->Row("No_Jual"), $db->Row("Tgl_Jual2"), $db->Row("Nama_Outlet"), rupiah2($db->Row("Total_Nota")), $db->Row("Nama_Pegawai"));
|
||||
$tot_nota += $db->Row("Total_Nota");
|
||||
}
|
||||
$body .= sprintf($_bline, "Total Delivery Order", rupiah2($tot_nota), "");
|
||||
|
||||
//$t_catat = ($w_catat==1 && $ainfo['Catatan']<>"") ? 'Catatan : <i>'.$ainfo['Catatan'].'</i>.' : ' ';
|
||||
$t_catat = ' ';
|
||||
$body .= '</tbody></table><table class="notaFooter"><tr height="80"><td colspan="2">'.$t_catat.'</td></tr><tr><td width="50%" class="stamp"> </td><td class="r stamp">'.Report_Stamp(1,true).'</td></tr></table>';
|
||||
|
||||
echo '<div>' . $body . '</div>';
|
||||
}
|
||||
|
||||
function nota_dt($db, $nota = "", $w_lunas = 0) {
|
||||
if (trim($nota)=="") return;
|
||||
|
||||
$ainfo = [];
|
||||
$db->Query("SELECT T.*,DATE_FORMAT(T.Tgl_Tagih,'%d-%m-%Y') Tgl_Tagih2,S.Kode_Pegawai Kode_Sales,S.Nama_Pegawai Nama_Sales FROM (SELECT * FROM inv_jual_tagih WHERE No_Tagih='".$nota."' LIMIT 1) T LEFT JOIN para_pegawai S ON (T.SalesID=S.PegID)");
|
||||
if ($db->Next()) $ainfo = $db->AllRow();
|
||||
|
||||
$tsql = ($w_lunas == 0) ? " AND Lunas=0" : "";
|
||||
$db->Query("SELECT J.*,DATE_FORMAT(J.Tgl_Jual,'%d-%m-%Y') Tgl_Jual2,DATE_FORMAT(J.Tgl_JT,'%d-%m-%Y') Tgl_JT2,O.Nama_Outlet,J.Total_Jual-J.Total_Diskon Total_Faktur,IFNULL(B.Bayar_Lalu,0) Bayar_Lalu,IFNULL(B.Bayar_Ini,0) Bayar_Ini,J.Total_Jual-J.Total_Diskon-IFNULL(B.Bayar_Lalu,0)-IFNULL(B.Bayar_Ini,0) Total_Sisa FROM (SELECT * FROM inv_jual WHERE No_Jual IN (SELECT No_Jual FROM inv_jual_tagih_detail WHERE No_Tagih='".$ainfo['No_Tagih']."')".$tsql.") J LEFT JOIN (SELECT No_Jual,SUM(IF(Tgl_Bayar<'".$ainfo['Tgl_Tagih']."',Total_Bayar+Total_Potong,0)) Bayar_Lalu,SUM(IF(Tgl_Bayar='".$ainfo['Tgl_Tagih']."',Total_Bayar+Total_Potong,0)) Bayar_Ini FROM inv_jual_lunas WHERE No_Jual IN (SELECT No_Jual FROM inv_jual_tagih_detail WHERE No_Tagih='".$ainfo['No_Tagih']."') GROUP BY No_Jual) B ON (B.No_Jual=J.No_Jual) LEFT JOIN para_outlet O ON (O.OutletID=J.OutletID) ORDER BY O.Nama_Outlet, J.Tgl_Jual");
|
||||
//if ($db->RecordCount()==0) return;
|
||||
|
||||
// menampilkan judul dibagian atas laporan
|
||||
$kop = '<div class="text-center"><span class="fs-6 fw-bold">'.$_SESSION['__WEB_APP']['REG_NAME'].'</span><br>DAFTAR TAGIHAN OUTLET</div>';
|
||||
$kop .= '<table class="notaHeader"><tbody>';
|
||||
$kop .= '<tr><td width="15%">No. Tagihan</td><td width="35%" class="ttkdua">'.$ainfo['No_Tagih'].'</td><td width="15%">Sales</td><td width="35%" class="ttkdua">'.$ainfo['Nama_Sales'].($ainfo['Kode_Sales']==""?"":" (".$ainfo['Kode_Sales'].")").'</td></tr>';
|
||||
$kop .= '<tr><td>Tanggal</td><td class="ttkdua">'.$ainfo['Tgl_Tagih2'].'</td></tr>';
|
||||
$kop .= '</tbody></table>';
|
||||
|
||||
$header = '<table class="garis"><thead><tr><th style="width:1cm">No.</th><th>Nama Outlet</th><th style="width:2cm">No. Nota</th><th style="width:2.6cm">Tgl. Nota</th><th style="width:2.2cm">Total Nota</th><th style="width:2.2cm">Setoran</th><th style="width:2.2cm">Pembayaran</th><th style="width:2.2cm">Sisa Nota</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="c">%s</td><td>%s</td><td class="c">%s</td><td class="c nwr">%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td></tr>';
|
||||
$_bline = '<tr><td class="b c" colspan="6">%s</td><td class="b r" colspan="2">%s</td></tr>';
|
||||
|
||||
$body = ""; $no_urut = 1; $tot_tag = 0;
|
||||
while ($db->Next()) {
|
||||
$body .= sprintf($_line, $no_urut++, $db->Row("Nama_Outlet"), $db->Row("No_Jual"), $db->Row("Tgl_Jual2"), rupiah($db->Row("Total_Faktur")), rupiah($db->Row("Bayar_Lalu")), rupiah($db->Row("Bayar_Ini")), rupiah($db->Row("Total_Sisa")));
|
||||
$tot_tag += $db->RowFloat("Total_Sisa", 0);
|
||||
}
|
||||
$body .= sprintf($_bline, "Total Tagihan Rp.", rupiah($tot_tag), "");
|
||||
|
||||
$body .= '</tbody></table><table class="notaFooter"><tr height="80"><td width="50%"> </td></tr><tr><td class="r stamp">'.Report_Stamp(1,true).'</td></tr></table>';
|
||||
|
||||
echo '<div>' . $kop . $header . $body . '</div>';
|
||||
}
|
||||
|
||||
function nota_biaya($db, $nota = "") {
|
||||
if (trim($nota)=="") return;
|
||||
$baris_faktur = 6;
|
||||
|
||||
$ainfo = [];
|
||||
$db->Query("SELECT B.*,DATE_FORMAT(B.Tgl_Biaya,'%d-%m-%Y') Tgl_Biaya2,(B.Jumlah_DPP+B.Jumlah_PPN) Jumlah,S.Nama_Sup,S.Alamat_Sup,S.Kota_Sup FROM (SELECT * FROM biaya_pajak WHERE No_Biaya='".$nota."') B LEFT JOIN para_supplier S ON (S.SupID=B.SupID)");
|
||||
if ($db->Next()) $ainfo = $db->AllRow();
|
||||
$ainfo['Alamat_Sup'] = str_replace("\n", "<br>", $ainfo['Alamat_Sup']);
|
||||
|
||||
$db->Query("SELECT *,(Qty*Harga_Jual) Jumlah FROM biaya_pajak_detail WHERE No_Biaya='".$nota."' ORDER BY ID");
|
||||
//if ($db->RecordCount()==0) return;
|
||||
|
||||
// menampilkan judul dibagian atas laporan
|
||||
$kop = '<div class="text-center"><span class="fs-6 fw-bold">INVOICE</span><br>Nomor : '.$ainfo['No_Biaya'].'</div>';
|
||||
$kop .= '<table class="notaHeader"><tbody>';
|
||||
$kop .= '<tr><td colspan="2">'.$_SESSION['__WEB_APP']['REG_NAME'].'</td><td colspan="2">Kepada Yth. :</td></tr>';
|
||||
$kop .= '<tr><td colspan="2" class="align-top">Telp. '.$_SESSION['__WEB_APP']['REG_PHONE'].'</td><td colspan="2">'.$ainfo['Nama_Sup'].'</td></tr>';
|
||||
$kop .= '<tr><td colspan="2" class="align-top">Fax. '.$_SESSION['__WEB_APP']['REG_FAX'].'</td><td colspan="2">'.$ainfo['Alamat_Sup'].'</td></tr>';
|
||||
$kop .= '<tr><td colspan="2" width="50%"> </td><td width="50%">'.$ainfo['Kota_Sup'].'</td></tr>';
|
||||
$kop .= '</tbody></table>';
|
||||
|
||||
$header = '<table class="garis"><thead><tr><th style="width:1cm">No.</th><th>Uraian</th><th style="width:1.8cm">Qty</th><th style="width:2.8cm">Harga @</th><th style="width:2.8cm">Jumlah</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="c">%s</td><td>%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td></tr>';
|
||||
$_bline = '<tr><td class="b"> </td><td class="b r" colspan="2">%s</td><td class="b r" colspan="2">%s</td></tr>';
|
||||
|
||||
$body = ""; $no_urut = 1;
|
||||
while ($db->Next()) {
|
||||
$body .= sprintf($_line, $no_urut++, $db->Row("Uraian_Biaya"), rupiah2($db->Row("Qty")), rupiah($db->Row("Harga_Jual")), rupiah($db->Row("Jumlah")));
|
||||
}
|
||||
if ($no_urut <= $baris_faktur) {
|
||||
$no_urut--;
|
||||
for ($x=$baris_faktur; $x>fmod($no_urut, $baris_faktur); $x--) {
|
||||
$body .= sprintf($_line, " ", " ", " "," ", " ");
|
||||
}
|
||||
}
|
||||
$body .= sprintf($_bline, "Total (Dasar Pengenaan Pajak) Rp.", rupiah($ainfo['Jumlah_DPP']));
|
||||
$body .= sprintf($_bline, "PPN (11% x Dasar Pengenaan Pajak) Rp.", rupiah($ainfo['Jumlah_PPN']));
|
||||
//$body .= sprintf($_bline, "PPN (".(($ainfo['Tgl_Biaya'] >= $_SESSION['__APP_IAS']['PPN_TGL']) ? $_SESSION['__APP_IAS']['PPN_STRING'] : "11")."% x Dasar Pengenaan Pajak) Rp.", rupiah($ainfo['Jumlah_PPN']));
|
||||
$body .= sprintf($_bline, "Grand Total Rp.", rupiah($ainfo['Jumlah']));
|
||||
|
||||
$body .= '<table class="notaFooter">';
|
||||
$body .= '<tr><td width="50%"> </td><td>Pontianak, '.tgl_panjang($ainfo['Tgl_Biaya2']).'</td></tr><tr height="80"><td><table class="nostyle"><tr><td style="width:30%;" class="py-0">A/C</td><td class="py-0 ttkdua">029 052 7899</td></tr><tr><td class="py-0">A/N</td><td class="py-0 ttkdua">PT. Ponti Mitra Sejati</td></tr><tr><td class="py-0">Bank</td><td class="py-0 ttkdua">BCA KCU Pontianak</td></tr></table></td><td style="vertical-align:bottom;">Budiyanto Halim Krisno<br>Manager</td></tr><tr><td> </td><td class="r stamp">'.Report_Stamp(1,true).'</td></tr></table>';
|
||||
|
||||
echo '<div class="printNota">' . $kop . $header . $body . '</tbody></table></div>';
|
||||
|
||||
}
|
||||
|
||||
function nota_mdo($db, $nota="") {
|
||||
if (trim($nota)=="") return;
|
||||
$asatuan = []; $ainfo = []; $baris_faktur = 25;
|
||||
$db->Query("SELECT Kode_Satuan FROM para_satuan ORDER BY Urut");//todo: hilangkan nomor urut
|
||||
while ($db->Next()) $asatuan[$db->Row("Kode_Satuan")] = 0;
|
||||
|
||||
$db->Query("SELECT DO.No_MDO,DO.Catatan,DATE_FORMAT(DO.Tgl_MDO,'%d-%m-%Y') Tgl_MDO2,S.Nama_Pegawai Nama_Supir FROM (SELECT * FROM manual_do WHERE No_MDO='".$nota."') DO LEFT JOIN para_pegawai S ON (DO.SupirID=S.PegID)");
|
||||
if ($db->Next()) $ainfo = $db->AllRow();
|
||||
|
||||
$db->Query("SELECT P.Kode_Produk,R.Kode_Rasa,S.Kode_Satuan,D.Muat,D.Kembali,D.Terantar FROM (SELECT *,(Muat-Kembali) Terantar FROM manual_do_detail WHERE No_MDO='".$nota."') D LEFT JOIN inv_produk P ON (D.InvID=P.InvID) LEFT JOIN para_rasa R ON (D.RasaID=R.RasaID) LEFT JOIN para_satuan S ON (D.SatuanID=S.SatuanID) ORDER BY D.ID");
|
||||
$jml_hal = ceil($db->RecordCount() / $baris_faktur);
|
||||
|
||||
// menampilkan judul dibagian atas laporan
|
||||
$kop = '<div class="text-center"><span class="fs-6 fw-bold">'.$_SESSION['__WEB_APP']['REG_NAME'].'</span><br>DELIVERY ORDER (DO)</div>';
|
||||
$kop .= '<table class="notaHeader"><tbody>';
|
||||
$kop .= '<tr><td width="15%">No. DO</td><td width="35%" class="ttkdua">'.$ainfo['No_MDO'].'</td><td width="15%">Driver</td><td width="35%" class="ttkdua">'.$ainfo['Nama_Supir'].'</td></tr>';
|
||||
$kop .= '<tr><td>Tanggal</td><td class="ttkdua">'.$ainfo['Tgl_MDO2'].'</td></tr>';
|
||||
$kop .= '<tr><td>Catatan</td><td colspan="3" class="ttkdua">'.$ainfo['Catatan'].'</td></tr>';
|
||||
$kop .= '</tbody></table>';
|
||||
|
||||
$header = '<table class="garis"><thead><tr><th style="width:1cm">No.</th><th>Produk</th><th style="width:2cm">Satuan</th><th style="width:2.2cm">Muat</th><th style="width:2.2cm">Kembali</th><th style="width:2.2cm">Terantar</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="c">%s</td><td>%s</td><td>%s</td><td class="r">%s</td><td class="r">%s</td><td class="r">%s</td></tr>';
|
||||
$_bline = '<tr><td class="b c" colspan="4">%s</td><td class="b r">%s</td><td class="b r">%s</td></tr>';
|
||||
|
||||
$body = '<p id="autopage"> </p>';
|
||||
$body .= $kop.$header; $no_urut = 1; $hal = 1; $sub_jenis = 0;
|
||||
while ($db->Next()) {
|
||||
if (fmod(($no_urut-1), $baris_faktur) == 0 && $no_urut > $baris_faktur) {
|
||||
//footer
|
||||
$body .= '</tbody></table><table class="notaFooter"><tr height="80"><td colspan="2"> </td></tr><tr><td width="50%" class="stamp">Halaman : '.$hal."/".$jml_hal.'</td><td class="r stamp">'.Report_Stamp(1,true).'</td></tr></table>';
|
||||
$body .= '<p id="linebreak">................ page break ................</p><p id="pagebreak"> </p>';
|
||||
//header
|
||||
$body .= $kop.$header;
|
||||
$hal++;
|
||||
}
|
||||
//if ($db->Row("Grup")<>$_SESSION['__APP_IAS']['GRUP_PRODUK_KEMASAN'] && $db->Row("Grup")<>$_SESSION['__APP_IAS']['GRUP_PRODUK_HADIAH']) {
|
||||
$asatuan[$db->Row("Kode_Satuan")] += $db->RowFloat("Terantar");
|
||||
$sub_jenis++;
|
||||
//}
|
||||
$body .= sprintf($_line, $no_urut++, $db->Row("Kode_Produk").(($db->Row("Kode_Rasa"))?" (".$db->Row("Kode_Rasa").")":""), $db->Row("Kode_Satuan"), rupiah($db->Row("Muat")), ($db->RowFloat("Kembali")>0?rupiah($db->Row("Kembali")):""), ($db->RowFloat("Kembali")>0?rupiah($db->Row("Terantar")):""));
|
||||
}
|
||||
$ket_produk = "";
|
||||
foreach ($asatuan as $key => $val) {
|
||||
if ($val > 0) $ket_produk .= " / ".rupiah($val)." ".strtoupper($key);
|
||||
}
|
||||
$ket_produk = substr($ket_produk, 3);
|
||||
$body .= sprintf($_bline, $sub_jenis." ITEM PRODUK (".$ket_produk.")", "", "");
|
||||
|
||||
$body .= '</tbody></table><table class="notaFooter"><tr height="80"><td colspan="2"> </td></tr><tr><td width="50%" class="stamp">Halaman : '.$hal."/".$jml_hal.'</td><td class="r stamp">'.Report_Stamp(1,true).'</td></tr></table>';
|
||||
|
||||
echo '<div>' . $body . '</div>';
|
||||
}
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$data = Param::Get("data");
|
||||
$nomor = Param::Get("Nomor_Cetak");
|
||||
$w_catatan = Param::Get("Cetak_Catatan");
|
||||
$w_lunas = Param::Get("Cetak_Lunas");
|
||||
|
||||
if ( $data == "beli" ) {
|
||||
nota_beli($db, $nomor);
|
||||
|
||||
} else if ( $data == "jual" ) {
|
||||
nota_jual($db, $nomor);
|
||||
|
||||
} else if ( $data == "retur-beli" ) {
|
||||
nota_retur_beli($db, $nomor);
|
||||
|
||||
} else if ( $data == "retur-jual" ) {
|
||||
nota_retur_jual($db, $nomor);
|
||||
|
||||
} else if ( $data == "do-produk" ) {
|
||||
nota_do_produk($db, $nomor, $w_catatan);
|
||||
|
||||
} else if ( $data == "do-faktur" ) {
|
||||
nota_do_faktur($db, $nomor, $w_catatan);
|
||||
|
||||
} else if ( $data == "tagih" ) {
|
||||
nota_dt($db, $nomor, $w_lunas);
|
||||
|
||||
} else if ( $data == "biaya" ) {
|
||||
nota_biaya($db, $nomor);
|
||||
|
||||
} else if ( $data == "mdo" ) {
|
||||
nota_mdo($db, $nomor);
|
||||
|
||||
} else if ( $data == "default") {}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/outlet.php
|
||||
Desc. : PHP - Laporan Daftar Outlet
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : March 25th, 2011.
|
||||
Last Modified : August 8th, 2024.
|
||||
|
||||
(c) 2011 - 2024, 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\Form;
|
||||
use avadim\FastExcelWriter\Excel;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export") {
|
||||
$id_outlet = Param::Get("Grup_OutletID", 0); $aout = [];
|
||||
$id_grup = Param::Get("Grup_InvID", 0); $agrup = [];
|
||||
$aktif = Param::Get("Aktif", "X");
|
||||
if ($id_outlet>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 = '<p>Nama Grup Outlet : '.$aout['Nama_Grup'].'</p>';
|
||||
if ($id_grup>0) $header .= '<p>Nama Grup Produk : '.$agrup['Nama_Grup'].'</p>';
|
||||
if ($aktif<>"X") $header .= '<p>Status Aktif : '.$nama_aktif.'</p>';
|
||||
$header .= '<table class="garis"><thead><tr><th>No.</th><th>Nama Outlet</th><th>NPWP</th><th>Alamat</th><th>Kota</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="c">%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>';
|
||||
|
||||
$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 . "</tbody></table>" . 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_ ');
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,313 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/piutang.php
|
||||
Desc. : PHP - Laporan Piutang Outlet
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : July 17th, 2011.
|
||||
Last Modified : January 20th, 2024.
|
||||
|
||||
(c) 2011 - 2024, 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;
|
||||
use siaupheng\fonia3\Data\SimpleXLS;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export" ) {
|
||||
$tipe = Param::Get("Tipe"); // R or D
|
||||
$tipedt = Param::Get("TipeDT"); // X, S, B
|
||||
$ck = Param::Get("CK", "X");
|
||||
$id_gout = Param::Get("Grup_OutletID", 0);
|
||||
$id_outlet = Param::Get("OutletID", 0);
|
||||
$id_sales = Param::Get("SalesID", "SEMUA");
|
||||
$id_grup = Param::Get("Grup_InvID");
|
||||
$tglfrom = Param::Get("Tgl_From");
|
||||
$tglto = Param::Get("Tgl_To");
|
||||
$aoutlet = []; $nama_gout = ""; $nama_grup = ""; $nama_sales = "TANPA SALES";
|
||||
if ($id_outlet > 0) {
|
||||
$db->Query("SELECT * FROM para_outlet WHERE OutletID='".$id_outlet."' LIMIT 1");
|
||||
if ($db->Next()) $aoutlet = $db->AllRow();
|
||||
}
|
||||
if ($id_gout > 0) {
|
||||
$db->Query("SELECT Nama_Grup FROM para_outlet_grup WHERE Grup_OutletID='".$id_gout."' LIMIT 1");
|
||||
if ($db->Next()) $nama_gout = $db->Row("Nama_Grup");
|
||||
}
|
||||
if ($id_grup > 0) {
|
||||
$db->Query("SELECT Nama_Grup FROM inv_produk_grup WHERE Grup_InvID='".$id_grup."' LIMIT 1");
|
||||
if ($db->Next()) $nama_grup = $db->Row("Nama_Grup");
|
||||
}
|
||||
if ($id_sales>0 && $id_sales<>"NON" && $id_sales<>"SEMUA") {
|
||||
$db->Query("SELECT Nama_Pegawai FROM para_pegawai WHERE PegID='".$id_sales."' LIMIT 1");
|
||||
$nama_sales = $db->Row("Nama_Pegawai");
|
||||
}
|
||||
if ($id_sales=="SEMUA") $nama_sales = "";
|
||||
$nama_dt = ($tipedt<>"X") ? (($tipedt=="S")?"SUDAH DT":"BELUM DT") : "";
|
||||
|
||||
// generate report header
|
||||
$tglheader = "Periode : ".$tglfrom;
|
||||
if ($tglfrom!==$tglto) $tglheader .= " S/D ".$tglto;
|
||||
$tglfrom = tgl_sql2str($tglfrom);
|
||||
$tglto = tgl_sql2str($tglto);
|
||||
|
||||
$qsql = ($id_outlet>0) ? " AND OutletID=".$id_outlet : "";
|
||||
$qsql .= ($id_sales>0 && $id_sales<>"NON" && $id_sales<>"SEMUA") ? " AND SalesID=".$id_sales : "";
|
||||
$qsql .= ($id_sales=="NON") ? " AND SalesID=0" : "";
|
||||
$qsql .= ($tipedt<>"X") ? (($tipedt=="S")?" AND No_Jual IN (SELECT No_Jual FROM inv_jual_tagih_detail)":" AND No_Jual NOT IN (SELECT No_Jual FROM inv_jual_tagih_detail)") : "";
|
||||
$tsql = ($id_gout>0) ? " AND O.Grup_OutletID='".$id_gout."'" : "";
|
||||
$tsql .= ($id_grup>0) ? " AND P.Grup_InvID=".$id_grup : "";
|
||||
if ($tsql <> "") $tsql = " WHERE ".substr($tsql, 4);
|
||||
|
||||
if ($tipe=="R") {
|
||||
$xsql = "SELECT O.Nama_Outlet,SUM(J.Total_Jual-J.Total_Diskon) Total_Piutang,SUM(J.Total_Bayar) Total_Bayar, SUM(J.Total_Jual-J.Total_Diskon-J.Total_Bayar) Total_Sisa FROM (SELECT * FROM inv_jual WHERE Lunas=0 AND Rekap=1 AND (Tgl_Jual BETWEEN '".$tglfrom."' AND '".$tglto."')".$qsql.") J LEFT JOIN para_outlet O ON (J.OutletID=O.OutletID)".$tsql." GROUP BY J.OutletID ORDER BY O.Nama_Outlet";
|
||||
if ($id_grup > 0) $xsql = "SELECT O.Nama_Outlet,SUM((-D.Qty*D.Harga_Jual)-D.Total_Diskon) Total_Piutang FROM (SELECT * FROM inv_jual WHERE Lunas=0 AND Rekap=1 AND (Tgl_Jual BETWEEN '".$tglfrom."' AND '".$tglto."')".$qsql.") J INNER JOIN (SELECT * FROM inv_detail WHERE Tgl_Ref BETWEEN '".$tglfrom."' AND '".$tglto."') D ON (D.No_Ref=J.No_Jual) LEFT JOIN para_outlet O ON (J.OutletID=O.OutletID) LEFT JOIN inv_produk P ON (D.InvID=P.InvID)".$tsql." GROUP BY J.OutletID ORDER BY O.Nama_Outlet";
|
||||
} else {
|
||||
$xsql = "SELECT J.*,DATE_FORMAT(J.Tgl_Jual,'%d-%m-%Y') Tgl_Jual2,O.Nama_Outlet,J.Total_Jual-J.Total_Diskon Total_Piutang,J.Total_Jual-J.Total_Diskon-J.Total_Bayar Total_Sisa FROM (SELECT * FROM inv_jual WHERE Lunas=0 AND Rekap=1 AND (Tgl_Jual BETWEEN '".$tglfrom."' AND '".$tglto."')".$qsql.") J LEFT JOIN para_outlet O ON (J.OutletID=O.OutletID)".$tsql." ORDER BY J.No_Jual";
|
||||
if ($id_grup > 0) $xsql = "SELECT J.*,DATE_FORMAT(J.Tgl_Jual,'%d-%m-%Y') Tgl_Jual2,O.Nama_Outlet,SUM((-D.Qty*D.Harga_Jual)-D.Total_Diskon) Total_Piutang FROM (SELECT * FROM inv_jual WHERE Lunas=0 AND Rekap=1 AND (Tgl_Jual BETWEEN '".$tglfrom."' AND '".$tglto."')".$qsql.") J INNER JOIN (SELECT * FROM inv_detail WHERE Tgl_Ref BETWEEN '".$tglfrom."' AND '".$tglto."') D ON (D.No_Ref=J.No_Jual) LEFT JOIN para_outlet O ON (J.OutletID=O.OutletID) LEFT JOIN inv_produk P ON (D.InvID=P.InvID)".$tsql." GROUP BY J.No_Jual ORDER BY J.No_Jual";
|
||||
}
|
||||
$db->Query($xsql);
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN ".($tipe=="R"?"REKAP":"DETAIL")." PIUTANG OUTLET", $tglheader);
|
||||
$pre = new PrintHTML();
|
||||
$pre->set_css("garis");
|
||||
|
||||
if ($tipe=="R") {
|
||||
$nkol = 3;
|
||||
$pre->add_field("NO.",10,"C");
|
||||
$pre->add_field("NAMA OUTLET",120);
|
||||
$pre->add_field("JUMLAH PIUTANG",30,"R","uang");
|
||||
if ($id_grup == 0) {
|
||||
$nkol = 5;
|
||||
$pre->add_field("JUMLAH BAYAR",30,"R","uang");
|
||||
$pre->add_field("SISA PIUTANG",30,"R","uang");
|
||||
}
|
||||
|
||||
if ($id_gout>0) $pre->add_span(array("NAMA GRUP OUTLET : ".$nama_gout,$nkol,"L,NB"));
|
||||
if ($id_outlet>0) $pre->add_span(array("NAMA OUTLET : ".strtoupper($nama_out),$nkol,"L,NB"));
|
||||
if ($id_sales>0 || $id_sales=="NON") $pre->add_span(array("NAMA SALES : ".strtoupper($nama_sales),$nkol,"L,NB"));
|
||||
if ($id_grup>0) $pre->add_span(array("GRUP PRODUK : ".strtoupper($nama_grup),$nkol,"L,NB"));
|
||||
if ($tipedt<>"X") $pre->add_span(array("STATUS DT : ".strtoupper($nama_dt),$nkol,"L,NB"));
|
||||
$pre->show_fields();
|
||||
|
||||
$tot_piu = $tot_bayar = $nomor = 0;
|
||||
while ($db->Next()) {
|
||||
$nomor++;
|
||||
$tot_piu += $db->Row("Total_Piutang");
|
||||
if ($id_grup == 0) {
|
||||
$tot_bayar += $db->Row("Total_Bayar");
|
||||
$pre->add_value($nomor, $db->Row("Nama_Outlet"), $db->Row("Total_Piutang"), $db->Row("Total_Bayar"), $db->Row("Total_Sisa"));
|
||||
}
|
||||
if ($id_grup > 0) $pre->add_value($nomor, $db->Row("Nama_Outlet"), $db->Row("Total_Piutang"));
|
||||
}
|
||||
if ($id_grup == 0) $pre->add_span(array(""),array("GRAND TOTAL",1,"L,B"),array($tot_piu,1,"R,B","uang"),array($tot_bayar,1,"R,B","uang"),array($tot_piu-$tot_bayar,1,"R,B","uang"));
|
||||
if ($id_grup > 0) $pre->add_span(array(""),array("GRAND TOTAL",1,"L,B"),array($tot_piu,1,"R,B","uang"));
|
||||
|
||||
} else {
|
||||
$nkol = 4;
|
||||
$pre->add_field("NO. NOTA",10,"C");
|
||||
$pre->add_field("TGL. NOTA",10,"C");
|
||||
$pre->add_field("NAMA OUTLET",120);
|
||||
$pre->add_field("JUMLAH PIUTANG",30,"R","uang");
|
||||
if ($id_grup == 0) {
|
||||
$nkol = 6;
|
||||
$pre->add_field("JUMLAH BAYAR",30,"R","uang");
|
||||
$pre->add_field("SISA PIUTANG",30,"R","uang");
|
||||
}
|
||||
|
||||
if ($id_gout>0) $pre->add_span(array("NAMA GRUP OUTLET : ".$nama_gout,$nkol,"L,NB"));
|
||||
if ($id_outlet>0) $pre->add_span(array("NAMA OUTLET : ".strtoupper($nama_out),$nkol,"L,NB"));
|
||||
if ($id_sales>0 || $id_sales=="NON") $pre->add_span(array("NAMA SALES : ".strtoupper($nama_sales),$nkol,"L,NB"));
|
||||
if ($id_grup>0) $pre->add_span(array("GRUP PRODUK : ".strtoupper($nama_grup),$nkol,"L,NB"));
|
||||
if ($tipedt<>"X") $pre->add_span(array("STATUS DT : ".strtoupper($nama_dt),$nkol,"L,NB"));
|
||||
$pre->show_fields();
|
||||
|
||||
$tot_piu = $tot_bayar = $diskon = 0;
|
||||
while ($db->Next()) {
|
||||
$tot_piu += $db->Row("Total_Piutang");
|
||||
if ($id_grup == 0) {
|
||||
$tot_bayar += $db->Row("Total_Bayar");
|
||||
$pre->add_value($db->Row("No_Jual"), $db->Row("Tgl_Jual2"), $db->Row("Nama_Outlet"), $db->Row("Total_Piutang"), $db->Row("Total_Bayar"), $db->Row("Total_Sisa"));
|
||||
}
|
||||
if ($id_grup > 0) $pre->add_value($db->Row("No_Jual"), $db->Row("Tgl_Jual2"), $db->Row("Nama_Outlet"), $db->Row("Total_Piutang"));
|
||||
}
|
||||
if ($id_grup == 0) $pre->add_span(array("GRAND TOTAL",3,"L,B"),array($tot_piu,1,"R,B","uang"),array($tot_bayar,1,"R,B","uang"),array($tot_piu-$tot_bayar,1,"R,B","uang"));
|
||||
if ($id_grup > 0) $pre->add_span(array("GRAND TOTAL",3,"L,B"),array($tot_piu,1,"R,B","uang"));
|
||||
}
|
||||
$pre->add_stamp(1, true);
|
||||
$pre->show();
|
||||
|
||||
} else if ( $data == "export" ) {
|
||||
$xls = new SimpleXLS([
|
||||
'title'=>"Laporan ".($tipe=="R"?"Rekap":"Detail")." Piutang Outlet",
|
||||
'subject'=>"PT.PMS",
|
||||
'desc'=>"Export Data dari IAS"
|
||||
]);
|
||||
$xls->add_header("<b>".strtoupper($_SESSION['__WEB_APP']['REG_NAME'])."</b>");
|
||||
$xls->add_header("<b>LAPORAN ".(($tipe=="R")?"REKAP":"DETAIL")." PIUTANG OUTLET</b>");
|
||||
$xls->add_header($tglheader);
|
||||
|
||||
if ($tipe=="R") {
|
||||
$xls->add_field("NO", 12, "C");
|
||||
$xls->add_field("NAMA OUTLET", 60, "L");
|
||||
$xls->add_field("JUMLAH PIUTANG", 20, "R,N");
|
||||
if ($id_grup == 0) {
|
||||
$xls->add_field("JUMLAH BAYAR", 20, "R,N");
|
||||
$xls->add_field("SISA PIUTANG", 20, "R,N");
|
||||
}
|
||||
$xls->add_sheet("PIUTANG OUTLET", false);
|
||||
|
||||
$nkol = ($id_grup == 0) ? 3 : 1;
|
||||
if ($id_gout>0) $xls->add_span(array("NAMA GRUP OUTLET",2,"L,B,NL"),array($nama_gout,$nkol,"L,B,NL"));
|
||||
if ($id_outlet>0) $xls->add_span(array("NAMA OUTLET",2,"L,B,NL"),array(strtoupper($nama_out),$nkol,"L,B,NL"));
|
||||
if ($id_sales>0 || $id_sales=="NON") $xls->add_span(array("NAMA SALES",2,"L,B,NL"),array(strtoupper($nama_sales),$nkol,"L,B,NL"));
|
||||
if ($id_grup>0) $xls->add_span(array("GRUP PRODUK",2,"L,B,NL"),array(strtoupper($nama_grup),$nkol,"L,B,NL"));
|
||||
if ($tipedt<>"X") $xls->add_span(array("STATUS DT",2,"L,B,NL"),array(strtoupper($nama_dt),$nkol,"L,B,NL"));
|
||||
$xls->show_headers();
|
||||
|
||||
$tot_piu = $tot_bayar = $nomor = 0;
|
||||
while ($db->Next()) {
|
||||
$nomor++;
|
||||
$tot_piu += $db->Row("Total_Piutang");
|
||||
if ($id_grup == 0) {
|
||||
$tot_bayar += $db->Row("Total_Bayar");
|
||||
$xls->add_value($nomor, $db->Row("Nama_Outlet"), $db->Row("Total_Piutang"), $db->Row("Total_Bayar"), $db->Row("Total_Sisa"));
|
||||
} else {
|
||||
$xls->add_value($nomor, $db->Row("Nama_Outlet"), $db->Row("Total_Piutang"));
|
||||
}
|
||||
}
|
||||
if ($id_grup == 0) {
|
||||
$xls->add_span(array("TOTAL PIUTANG",2,"R,B"),array($tot_piu,1,"R,N,B"),array($tot_bayar,1,"R,N,B"),array($tot_piu-$tot_bayar,1,"R,N,B"));
|
||||
} else {
|
||||
$xls->add_span(array("TOTAL PIUTANG",2,"R,B"),array($tot_piu,1,"R,N,B"));
|
||||
}
|
||||
} else {
|
||||
$xls->add_field("NO. NOTA", 14, "C");
|
||||
$xls->add_field("TGL. NOTA", 15, "C");
|
||||
$xls->add_field("NAMA OUTLET", 60, "L");
|
||||
$xls->add_field("JUMLAH PIUTANG", 20, "R,N");
|
||||
if ($id_grup == 0) {
|
||||
$xls->add_field("JUMLAH BAYAR", 20, "R,N");
|
||||
$xls->add_field("SISA PIUTANG", 20, "R,N");
|
||||
}
|
||||
$xls->add_sheet("PIUTANG OUTLET", false);
|
||||
|
||||
$nkol = ($id_grup == 0) ? 4 : 2;
|
||||
if ($id_gout>0) $xls->add_span(array("NAMA GRUP OUTLET",2,"L,B,NL"),array($nama_gout,$nkol,"L,B,NL"));
|
||||
if ($id_outlet>0) $xls->add_span(array("NAMA OUTLET",2,"L,B,NL"),array(strtoupper($nama_out),$nkol,"L,B,NL"));
|
||||
if ($id_sales>0 || $id_sales=="NON") $xls->add_span(array("NAMA SALES",2,"L,B,NL"),array(strtoupper($nama_sales),$nkol,"L,B,NL"));
|
||||
if ($id_grup>0) $xls->add_span(array("GRUP PRODUK",2,"L,B,NL"),array(strtoupper($nama_grup),$nkol,"L,B,NL"));
|
||||
if ($tipedt<>"X") $xls->add_span(array("STATUS DT",2,"L,B,NL"),array(strtoupper($nama_dt),$nkol,"L,B,NL"));
|
||||
$xls->show_headers();
|
||||
|
||||
$tot_piu = $tot_bayar = $diskon = 0;
|
||||
while ($db->Next()) {
|
||||
$tot_piu += $db->Row("Total_Piutang");
|
||||
if ($id_grup == 0) {
|
||||
$tot_bayar += $db->Row("Total_Bayar");
|
||||
$xls->add_value($db->Row("No_Jual"), $db->Row("Tgl_Jual2"), $db->Row("Nama_Outlet"), $db->Row("Total_Piutang"), $db->Row("Total_Bayar"), $db->Row("Total_Sisa"));
|
||||
} else {
|
||||
$xls->add_value($db->Row("No_Jual"), $db->Row("Tgl_Jual2"), $db->Row("Nama_Outlet"), $db->Row("Total_Piutang"));
|
||||
}
|
||||
}
|
||||
if ($id_grup == 0) {
|
||||
$xls->add_span(array("TOTAL PIUTANG",3,"R,B"),array($tot_piu,1,"R,N,B"),array($tot_bayar,1,"R,N,B"),array($tot_piu-$tot_bayar,1,"R,N,B"));
|
||||
} else {
|
||||
$xls->add_span(array("TOTAL PIUTANG",3,"R,B"),array($tot_piu,1,"R,N,B"));
|
||||
}
|
||||
}
|
||||
$xls->send("Laporan ".($tipe=="R"?"Rekap":"Detail")." Piutang Outlet.xlsx");
|
||||
unset($xls);
|
||||
|
||||
} else if ( $data == "brow-outlet" ) {
|
||||
$tcari = trim(Param::Get("Cari_Outlet"));
|
||||
$tsql = ($tcari=="") ? " LIMIT 100" : " AND CONCAT(Nama_Outlet,Telp_Outlet,Nama_Outlet) LIKE '%".$tcari."%'";
|
||||
|
||||
$obj = new Table($db);
|
||||
$obj->set_query("SELECT * FROM vi_para_outlet WHERE Aktif=1".$tsql);
|
||||
$obj->add_field("OutletID", "ID", "hid");
|
||||
$obj->add_field("Kode_Outlet", "Kode", "c");
|
||||
$obj->add_field("Nama_Alamat", "Nama Outlet", "awr");
|
||||
$obj->add_field("Alamat_Kota", "Alamat & Kota", "awr");
|
||||
$obj->set_field_order("Nama_Outlet", "A");
|
||||
$obj->add_row_btn("save", "Pilih", "RepoPiutangJS.outlet_select");
|
||||
$obj->set_func_navi("RepoPiutangJS.data_query('brow-outlet')");
|
||||
$ajson[] = $obj->json_table("divBrowOutlet");
|
||||
|
||||
} else if ( $data == "auto-outlet" ) {
|
||||
$tcari = Param::Get("Auto_Query");
|
||||
$ajson['autodata'] = [['value' => 0, 'text' => "SEMUA OUTLET", 'data' => ""]];
|
||||
if (is_string($tcari) && strlen($tcari) < 64) {
|
||||
$db->Query("SELECT * FROM vi_para_outlet WHERE Aktif=1 AND CONCAT(Nama_Outlet,Alamat_Outlet) LIKE '%".$tcari."%' ORDER BY Nama_Outlet LIMIT 50");
|
||||
while ($db->Next()) {
|
||||
$ajson['autodata'][] = ['value'=>$db->Row("OutletID"), 'text'=>$db->Row("Nama_Alamat"), 'data'=>$db->Row("Alamat_Kota")];
|
||||
}
|
||||
}
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$asales = ['SEMUA' => "SEMUA SALES", 'NON' => "TANPA-SALES"];
|
||||
$db->Query("SELECT PegID,Nama_Pegawai FROM para_pegawai WHERE Jenis_PegID='".$_SESSION['__APP_IAS']['GRUP_PEG_SALES']."' ORDER BY Nama_Pegawai");
|
||||
while ($db->Next()){
|
||||
$asales[$db->Row("PegID")] = $db->Row("Nama_Pegawai");
|
||||
}
|
||||
|
||||
$form = new Form($db);
|
||||
$ttipe = $form->radio("_", "Tipe", "R", true, false, ["R"=>"Rekap","D"=>"Detail"]);
|
||||
$tdt = $form->radio("_", "TipeDT", "X", true, false, ["X"=>"Semua","S"=>"Sudah DT","B"=>"Belum DT"]);
|
||||
$toutlet = $form->textauto("_", "Nama_Outlet", ['value'=>0,'text'=>"SEMUA OUTLET"], true, false);
|
||||
$tsales = $form->option("_", "SalesID", "SEMUA", true, false, $asales);
|
||||
$tgrup = $form->option_db("_", "Grup_InvID", 0, true, false, "inv_produk_grup", ["Grup_InvID","Nama_Grup"], "TRUE ORDER BY Nama_Grup", [0,"SEMUA GRUP"]);
|
||||
$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">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="TipeDT">Status DT</label>
|
||||
<div class="col">'.$tdt.'</div>
|
||||
</div>
|
||||
<!--- group outlet -->
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Nama_Outlet">Nama Outlet</label>
|
||||
<div class="col"><div class="input-group">'.$toutlet.'<button class="btn btn-info" type="button" onclick="RepoPiutangJS.outlet_brow();"><i class="bi-search"></i></button></div></div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="SalesID">Nama Sales</label>
|
||||
<div class="col">'.$tsales.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Grup_InvID">Grup Produk</label>
|
||||
<div class="col">'.$tgrup.'</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>
|
||||
<input type="hidden" id="OutletID" value="0">';
|
||||
}
|
||||
|
||||
send_json($ajson);
|
||||
?>
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/produk.php
|
||||
Desc. : PHP - Laporan Daftar Produk
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : May 26th, 2010.
|
||||
Last Modified : March 21st, 2023.
|
||||
|
||||
(c) 2010 - 2023, 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\Form;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export") {
|
||||
$id_grup = Param::Get("Grup_InvID", 0); $agrup = [];
|
||||
if ($id_grup>0) {
|
||||
$db->Query("SELECT * FROM inv_produk_grup WHERE Grup_InvID='".$id_grup."'");
|
||||
if ($db->Next()) $agrup = $db->AllRow();
|
||||
}
|
||||
|
||||
// generate report header
|
||||
$tglheader = "Tanggal Cetak : ".Param::Get("Tgl_Cetak");
|
||||
$tsql = ($id_grup==0) ? "" : " WHERE Grup_InvID='".$id_grup."'";
|
||||
|
||||
// query data laporan
|
||||
$db->Query("SELECT * FROM vi_inv_produk".$tsql." ORDER BY Nama_Produk");
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN DAFTAR PRODUK", $tglheader);
|
||||
|
||||
if ($id_grup>0) $header = '<p>Nama Grup Produk : '.$agrup['Nama_Grup'].'</p>';
|
||||
$header .= '<table class="garis"><thead><tr><th>No.</th><th>Kode</th><th>Nama Produk</th><th>Satuan</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="c">%s</td><td>%s</td><td>%s</td><td>%s</td></tr>';
|
||||
|
||||
$body = ''; $nomor = 1;
|
||||
while ($db->Next()) {
|
||||
$body .= sprintf($_line, $nomor, $db->Row("Kode_Produk"), $db->Row("Nama_Produk"), $db->Row("Satuan_Stok"));
|
||||
$nomor++;
|
||||
}
|
||||
|
||||
echo $header . $body . "</tbody></table>" . Report_Stamp(1, true);
|
||||
|
||||
} else if ( $data == "export" ) {
|
||||
\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
|
||||
|
||||
$styleTxt = [
|
||||
'numberFormat' => ['formatCode' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT]
|
||||
];
|
||||
$styleNum = [
|
||||
'numberFormat' => ['formatCode' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2]
|
||||
];
|
||||
|
||||
$ssheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||
$ssheet->getProperties()
|
||||
->setCreator($_SESSION['__WEB_APP']['APP_NAME']." v".$_SESSION['__WEB_APP']['APP_VER'])
|
||||
->setLastModifiedBy($_SESSION['__WEB_APP']['APP_NAME']." v".$_SESSION['__WEB_APP']['APP_VER'])
|
||||
->setTitle("Daftar Produk")
|
||||
->setCompany($_SESSION['__WEB_APP']['REG_NAME']);
|
||||
$sheet = $ssheet->getActiveSheet();
|
||||
$sheet->setTitle("Daftar Produk");
|
||||
|
||||
// header
|
||||
$styleHeader = [
|
||||
'font' => ['bold' => true],
|
||||
'alignment' => ['horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER]
|
||||
];
|
||||
$sheet->setCellValue("A1", strtoupper($_SESSION['__WEB_APP']['REG_NAME']));
|
||||
$sheet->mergeCells('A1:D1');
|
||||
$sheet->setCellValue("A2", "LAPORAN DAFTAR PRODUK");
|
||||
$sheet->mergeCells('A2:D2');
|
||||
$sheet->setCellValue("A3", $tglheader);
|
||||
$sheet->mergeCells('A3:D3');
|
||||
$sheet->getStyle('A1:D3')->applyFromArray($styleHeader);
|
||||
|
||||
// table header
|
||||
$sheet->getColumnDimension('A')->setWidth(8);
|
||||
$sheet->getColumnDimension('B')->setWidth(25);
|
||||
$sheet->getColumnDimension('C')->setWidth(80);
|
||||
$sheet->getColumnDimension('D')->setWidth(15);
|
||||
|
||||
$baris = 5;
|
||||
if ($id_grup>0) {
|
||||
$sheet->setCellValue("A".$baris, "Nama Grup Outlet : ".$agrup['Nama_Grup']);
|
||||
$baris++;
|
||||
}
|
||||
|
||||
$styleTableH = [
|
||||
'font' => ['bold' => true],
|
||||
'alignment' => ['horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER, 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, 'wrapText' => true],
|
||||
'fill' => ['fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID, 'startColor' => ['rgb'=>"D0D0D0"]],
|
||||
'borders' => ['allBorders' => ['borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN, 'color' => ['rgb'=>"C0C0C0"]]]
|
||||
];
|
||||
$sheet->setCellValue("A".$baris, "No.");
|
||||
$sheet->setCellValue("B".$baris, "Kode");
|
||||
$sheet->setCellValue("C".$baris, "Nama Produk");
|
||||
$sheet->setCellValue("D".$baris, "Satuan");
|
||||
$sheet->getStyle('A'.$baris.':D'.$baris)->applyFromArray($styleTableH);
|
||||
|
||||
$baris++; $nomor = 1;
|
||||
while ($db->Next()) {
|
||||
$sheet->setCellValue("A".$baris, $nomor++);
|
||||
$sheet->setCellValue("B".$baris, $db->Row("Kode_Produk"));
|
||||
$sheet->setCellValue("C".$baris, $db->Row("Nama_Produk"));
|
||||
$sheet->setCellValue("D".$baris, $db->Row("Satuan_Stok"));
|
||||
$baris++;
|
||||
}
|
||||
|
||||
$sheet->getSheetView()->setZoomScale(75);
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="Daftar Produk.xlsx"');
|
||||
header('Cache-Control: max-age=0');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($ssheet, 'Xlsx');
|
||||
$writer->save('php://output');
|
||||
$ssheet->disconnectWorksheets();
|
||||
unset($ssheet);
|
||||
unset($writer);
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$form = new Form($db);
|
||||
$form->option_db("Grup Produk", "Grup_InvID", 0, true, true, "inv_produk_grup", array("Grup_InvID","Nama_Grup"), "Aktif=1 ORDER BY Nama_Grup", [0,"SEMUA GRUP PRODUK"]);
|
||||
$form->datebox("Tanggal Cetak", "Tgl_Cetak", tgl_ymd(), true, true);
|
||||
$form->show(' _Grup_InvID_ _Tgl_Cetak_ ');
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/rekap_do.php
|
||||
Desc. : PHP - Rekap Penjualan Produk Per-DO
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : January 25th, 2024.
|
||||
|
||||
(c) 2024, 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\Web\Param;
|
||||
use siaupheng\fonia3\Web\Form;
|
||||
use siaupheng\fonia3\Printer\PrintHTML;
|
||||
use siaupheng\fonia3\Data\SimpleXLS;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export" ) {
|
||||
$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);
|
||||
|
||||
$ahasil = []; $aprod = [];
|
||||
$db->Query("SELECT A.No_DO,A.Tgl_DO,D.InvID,SUM(D.Stok) Stok FROM (SELECT * FROM inv_jual_do WHERE Tgl_DO BETWEEN '".$tglfrom."' AND '".$tglto."') A LEFT JOIN (SELECT No_DO,No_Jual FROM inv_jual WHERE No_DO IN (SELECT No_DO FROM inv_jual_do WHERE Tgl_DO BETWEEN '".$tglfrom."' AND '".$tglto."')) J ON (J.No_DO=A.No_DO) LEFT JOIN (SELECT No_Ref,InvID,SUM(-Stok) Stok FROM inv_detail WHERE No_Ref IN (SELECT No_Jual FROM inv_jual WHERE No_DO IN (SELECT No_DO FROM inv_jual_do WHERE Tgl_DO BETWEEN '".$tglfrom."' AND '".$tglto."') AND InvID NOT IN (SELECT InvID FROM inv_produk WHERE Grup_InvID IN (".$_SESSION['__APP_IAS']['GRUP_PRODUK_KEMASAN'].",".$_SESSION['__APP_IAS']['GRUP_PRODUK_HADIAH']."))) GROUP BY No_Ref,InvID) D ON (D.No_Ref=J.No_Jual) GROUP BY A.No_DO,D.InvID ORDER BY A.No_DO");
|
||||
while ($db->Next()) {
|
||||
if (!$ahasil[$db->Row("No_DO")]) {
|
||||
$ahasil[$db->Row("No_DO")]['No_DO'] = $db->Row("No_DO");
|
||||
$ahasil[$db->Row("No_DO")]['Tgl_DO'] = tgl_sql2str($db->Row("Tgl_DO"));
|
||||
}
|
||||
$ahasil[$db->Row("No_DO")][$db->Row("InvID")] += $db->RowFloat("Stok", 0);
|
||||
$aprod[$db->Row("InvID")] += $db->RowFloat("Stok", 0);
|
||||
}
|
||||
|
||||
$aproduk = [];
|
||||
$db->Query("SELECT A.InvID,A.Kode_Produk,IFNULL(B.Qty,0) Qty FROM (SELECT * FROM inv_produk) A LEFT JOIN (SELECT * FROM inv_produk_kemasan WHERE SatuanID=2) B ON (B.InvID=A.InvID)");
|
||||
while ($db->Next()) {
|
||||
$aproduk[$db->Row("InvID")] = ['kode' => $db->Row("Kode_Produk"), 'kali' => $db->RowFloat("Qty", 0)];
|
||||
}
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN REKAP DELIVERY ORDER", $tglheader);
|
||||
$pre = new PrintHTML();
|
||||
$pre->set_css("garis");
|
||||
$pre->add_field("No DO",50,"C");
|
||||
$pre->add_field("Tgl DO",30, "C");
|
||||
foreach ($aprod as $_key => $_val) {
|
||||
if ($_key == "") continue;
|
||||
$pre->add_field($aproduk[$_key]['kode'],50,"R","rupiah2");
|
||||
}
|
||||
$pre->add_field("TOTAL",50,"R","rupiah2");
|
||||
$pre->show_fields();
|
||||
|
||||
foreach ($ahasil as $_key => $_val) {
|
||||
$_tot = 0;
|
||||
$_atmp = [$_val['No_DO'], $_val['Tgl_DO']];
|
||||
foreach ($aprod as $_key2 => $_val2) {
|
||||
if ($_key2 == "") continue;
|
||||
array_push($_atmp, $_val[$_key2] / $aproduk[$_key2]['kali']);
|
||||
$_tot += $_val[$_key2] / $aproduk[$_key2]['kali'];
|
||||
}
|
||||
array_push($_atmp, $_tot);
|
||||
$pre->add_value($_atmp);
|
||||
}
|
||||
$_tot = 0;
|
||||
$_atmp = ["TOTAL", ""];
|
||||
foreach ($aprod as $_key2 => $_val2) {
|
||||
if ($_key2 == "") continue;
|
||||
array_push($_atmp, $_val2 / $aproduk[$_key2]['kali']);
|
||||
$_tot += $_val2 / $aproduk[$_key2]['kali'];
|
||||
}
|
||||
array_push($_atmp, $_tot);
|
||||
$pre->add_value($_atmp);
|
||||
|
||||
$pre->add_stamp(0, true);
|
||||
$pre->show();
|
||||
|
||||
} else if ( $data == "export" ) {
|
||||
$xls = new SimpleXLS([
|
||||
'title'=>"Laporan Penjualan ".ucfirst($sjudul)."",
|
||||
'subject'=>"PT.PMS",
|
||||
'desc'=>"Export Data dari IAS"
|
||||
]);
|
||||
$xls->add_header("<b>".strtoupper($_SESSION['__WEB_APP']['REG_NAME'])."</b>");
|
||||
$xls->add_header("<b>LAPORAN REKAP DELIVERY ORDER</b>");
|
||||
$xls->add_header($tglheader);
|
||||
|
||||
$xls->add_field("No DO", 20, "C");
|
||||
$xls->add_field("Tgl DO", 15, "C");
|
||||
foreach ($aprod as $_key => $_val) {
|
||||
if ($_key == "") continue;
|
||||
$xls->add_field($aproduk[$_key]['kode'],12,"R,N");
|
||||
}
|
||||
$xls->add_field("TOTAL",12,"R,N");
|
||||
$xls->add_sheet("REKAP DO", false);
|
||||
$xls->show_headers();
|
||||
|
||||
foreach ($ahasil as $_key => $_val) {
|
||||
$_tot = 0;
|
||||
$_atmp = [$_val['No_DO'], $_val['Tgl_DO']];
|
||||
foreach ($aprod as $_key2 => $_val2) {
|
||||
if ($_key2 == "") continue;
|
||||
array_push($_atmp, $_val[$_key2] / $aproduk[$_key2]['kali']);
|
||||
$_tot += $_val[$_key2] / $aproduk[$_key2]['kali'];
|
||||
}
|
||||
array_push($_atmp, $_tot);
|
||||
$xls->add_value($_atmp);
|
||||
}
|
||||
$_tot = 0;
|
||||
$_atmp = ["TOTAL", ""];
|
||||
foreach ($aprod as $_key2 => $_val2) {
|
||||
if ($_key2 == "") continue;
|
||||
array_push($_atmp, $_val2 / $aproduk[$_key2]['kali']);
|
||||
$_tot += $_val2 / $aproduk[$_key2]['kali'];
|
||||
}
|
||||
array_push($_atmp, $_tot);
|
||||
$xls->add_value($_atmp);
|
||||
|
||||
$xls->add_stamp(1, true);
|
||||
$xls->send("Laporan Rekap Delivery Order.xlsx");
|
||||
unset($xls);
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$form = new Form($db);
|
||||
$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-4 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-4 col-form-label" for="Tgl_To">Sampai Tanggal</label>
|
||||
<div class="col">'.$ttglto.'</div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/rekap_fp.php
|
||||
Desc. : PHP - Rekap Faktur Pajak Keluaran
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : August 30th, 2016.
|
||||
Last Modified : July 4th, 2023.
|
||||
|
||||
(c) 2016 - 2023, 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\Form;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export" ) {
|
||||
$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);
|
||||
|
||||
// query data laporan
|
||||
$db->Query("SELECT P.*,J.No_Nota,O.Email_Outlet FROM (SELECT * FROM inv_jual_pajak WHERE Tgl_Pajak BETWEEN '".$tglfrom."' AND '".$tglto."') P LEFT JOIN (SELECT No_Pajak,GROUP_CONCAT(RIGHT(No_Jual,5) SEPARATOR ', ') No_Nota FROM inv_jual WHERE No_Pajak IN (SELECT No_Pajak FROM inv_jual_pajak WHERE Tgl_Pajak BETWEEN '".$tglfrom."' AND '".$tglto."') GROUP BY No_Pajak ORDER BY No_Pajak) J ON (J.No_Pajak=P.No_Pajak) LEFT JOIN para_outlet O ON (O.OutletID=P.OutletID) ORDER BY P.No_Pajak");
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN REKAPITULASI FAKTUR PAJAK", $tglheader);
|
||||
|
||||
$header .= '<table class="garis"><thead><tr><th>No.</th><th>NSFP</th><th>Tanggal</th><th>No. Nota</th><th>Nama NPWP</th><th>Email Outlet</th><th>DPP</th><th>PPN</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="c">%s</td><td>%s</td><td class="c">%s</td><td>%s</td><td>%s</td><td>%s</td><td class="r">%s</td><td class="r">%s</td></tr>';
|
||||
$_sline = '<tr><td class="c b" colspan="6">%s</td><td class="r b">%s</td><td class="r b">%s</td></tr>';
|
||||
|
||||
$body = ''; $nomor = 1; $tot_dpp = 0; $tot_ppn = 0;
|
||||
while ($db->Next()) {
|
||||
$tot_dpp += $db->Row("Jumlah_DPP");
|
||||
$tot_ppn += $db->Row("Jumlah_PPN");
|
||||
$body .= sprintf($_line, $nomor++, $db->Row("No_Pajak"), tgl_sql2str($db->Row("Tgl_Pajak")), $db->Row("No_Nota"), $db->Row("Nama_NPWP"), $db->Row("Email_Outlet"), rupiah2($db->Row("Jumlah_DPP")), rupiah2($db->Row("Jumlah_PPN")));
|
||||
}
|
||||
$body .= sprintf($_sline, "Jumlah", rupiah2($tot_dpp), rupiah2($tot_ppn));
|
||||
|
||||
echo $header . $body . "</tbody></table>" . Report_Stamp(1, true);
|
||||
|
||||
} else if ( $data == "export" ) {
|
||||
\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
|
||||
|
||||
$styleTxt = [
|
||||
'numberFormat' => ['formatCode' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT]
|
||||
];
|
||||
$styleNum = [
|
||||
'numberFormat' => ['formatCode' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2]
|
||||
];
|
||||
|
||||
$ssheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||
$ssheet->getProperties()
|
||||
->setCreator($_SESSION['__WEB_APP']['APP_NAME']." v".$_SESSION['__WEB_APP']['APP_VER'])
|
||||
->setLastModifiedBy($_SESSION['__WEB_APP']['APP_NAME']." v".$_SESSION['__WEB_APP']['APP_VER'])
|
||||
->setTitle("Data Rekapitulasi Faktur Pajak")
|
||||
->setCompany($_SESSION['__WEB_APP']['REG_NAME']);
|
||||
$sheet = $ssheet->getActiveSheet();
|
||||
$sheet->setTitle("Data Rekapitulasi Faktur Pajak");
|
||||
|
||||
// header
|
||||
$styleHeader = [
|
||||
'font' => ['bold' => true],
|
||||
'alignment' => ['horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER]
|
||||
];
|
||||
$sheet->setCellValue("A1", strtoupper($_SESSION['__WEB_APP']['REG_NAME']));
|
||||
$sheet->mergeCells('A1:H1');
|
||||
$sheet->setCellValue("A2", "LAPORAN REKAPITULASI FAKTUR PAJAK");
|
||||
$sheet->mergeCells('A2:H2');
|
||||
$sheet->setCellValue("A3", $tglheader);
|
||||
$sheet->mergeCells('A3:H3');
|
||||
$sheet->getStyle('A1:H3')->applyFromArray($styleHeader);
|
||||
|
||||
// table header
|
||||
$sheet->getColumnDimension('A')->setWidth(8);
|
||||
$sheet->getColumnDimension('B')->setWidth(18);
|
||||
$sheet->getColumnDimension('C')->setWidth(12);
|
||||
$sheet->getColumnDimension('D')->setWidth(25);
|
||||
$sheet->getColumnDimension('E')->setWidth(25);
|
||||
$sheet->getColumnDimension('F')->setWidth(20);
|
||||
$sheet->getColumnDimension('G')->setWidth(18);
|
||||
$sheet->getColumnDimension('H')->setWidth(18);
|
||||
|
||||
$styleTableH = [
|
||||
'font' => ['bold' => true],
|
||||
'alignment' => ['horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER, 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, 'wrapText' => true],
|
||||
'fill' => ['fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID, 'startColor' => ['rgb'=>"D0D0D0"]],
|
||||
'borders' => ['allBorders' => ['borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN, 'color' => ['rgb'=>"C0C0C0"]]]
|
||||
];
|
||||
$baris = 5;
|
||||
$sheet->setCellValue("A".$baris, "No.");
|
||||
$sheet->setCellValue("B".$baris, "NSFP");
|
||||
$sheet->setCellValue("C".$baris, "Tanggal");
|
||||
$sheet->setCellValue("D".$baris, "No. Nota");
|
||||
$sheet->setCellValue("E".$baris, "Nama NPWP");
|
||||
$sheet->setCellValue("F".$baris, "Email Outlet");
|
||||
$sheet->setCellValue("G".$baris, "DPP");
|
||||
$sheet->setCellValue("H".$baris, "PPN");
|
||||
$sheet->getStyle('A'.$baris.':H'.$baris)->applyFromArray($styleTableH);
|
||||
|
||||
$baris++; $nomor = 1; $tot_dpp = 0; $tot_ppn = 0;
|
||||
while ($db->Next()) {
|
||||
$sheet->setCellValue("A".$baris, $nomor++);
|
||||
$sheet->setCellValue("B".$baris, $db->Row("No_Pajak"));
|
||||
$sheet->setCellValue("C".$baris, $db->Row("Tgl_Pajak"));
|
||||
$sheet->setCellValue("D".$baris, $db->Row("No_Nota"));
|
||||
$sheet->setCellValue("E".$baris, $db->Row("Nama_NPWP"));
|
||||
$sheet->setCellValue("F".$baris, $db->Row("Email_Outlet"));
|
||||
$sheet->setCellValue("G".$baris, $db->RowFloat("Jumlah_DPP"));
|
||||
$sheet->setCellValue("H".$baris, $db->RowFloat("Jumlah_PPN"));
|
||||
$sheet->getStyle('G'.$baris.':H'.$baris)->applyFromArray($styleNum);
|
||||
$baris++;
|
||||
$tot_dpp += $db->Row("Jumlah_DPP");
|
||||
$tot_ppn += $db->Row("Jumlah_PPN");
|
||||
}
|
||||
$sheet->setCellValue("A".$baris, "Jumlah");
|
||||
$sheet->mergeCells('A'.$baris.':F'.$baris);
|
||||
$sheet->setCellValue("G".$baris, $tot_dpp);
|
||||
$sheet->setCellValue("H".$baris, $tot_ppn);
|
||||
$sheet->getStyle('A'.$baris.':F'.$baris)->applyFromArray(['alignment' => ['horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER]]);
|
||||
$sheet->getStyle('G'.$baris.':H'.$baris)->applyFromArray($styleNum);
|
||||
$styleSub = [
|
||||
'font' => ['bold' => true],
|
||||
'fill' => ['fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID, 'startColor' => ['rgb'=>"D0D0D0"]]
|
||||
];
|
||||
$sheet->getStyle('A'.$baris.':H'.$baris)->applyFromArray($styleSub);
|
||||
|
||||
$sheet->getSheetView()->setZoomScale(75);
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="Data Rekapitulasi Faktur Pajak.xlsx"');
|
||||
header('Cache-Control: max-age=0');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($ssheet, 'Xlsx');
|
||||
$writer->save('php://output');
|
||||
$ssheet->disconnectWorksheets();
|
||||
unset($ssheet);
|
||||
unset($writer);
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$form = new Form($db);
|
||||
$form->datebox("Dari Tanggal", "Tgl_From", tgl_ymd(), true, false);
|
||||
$form->datebox("Sampai Tanggal", "Tgl_To", tgl_ymd(), true, false);
|
||||
$form->show(' _Tgl_From_ _Tgl_To_ ');
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,162 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/rekap_fp_biaya.php
|
||||
Desc. : PHP - Rekap Faktur Pajak Biaya
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : December 31st, 2024.
|
||||
|
||||
(c) 2016 - 2024, 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\Form;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export" ) {
|
||||
$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);
|
||||
|
||||
// query data laporan
|
||||
$db->Query("SELECT P.* FROM (SELECT * FROM biaya_pajak WHERE Tgl_Pajak BETWEEN '".$tglfrom."' AND '".$tglto."') P ORDER BY P.No_Pajak");
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN REKAPITULASI FP INVOICE BIAYA", $tglheader);
|
||||
|
||||
$header .= '<table class="garis"><thead><tr><th>No.</th><th>No. Faktur</th><th>Tgl. Faktur</th><th>NSFP</th><th>NPWP</th><th>Nama NPWP</th><th>DPP</th><th>PPN</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="c">%s</td><td>%s</td><td class="c">%s</td><td>%s</td><td>%s</td><td>%s</td><td class="r">%s</td><td class="r">%s</td></tr>';
|
||||
$_sline = '<tr><td class="c b" colspan="6">%s</td><td class="r b">%s</td><td class="r b">%s</td></tr>';
|
||||
|
||||
$body = ''; $nomor = 1; $tot_dpp = 0; $tot_ppn = 0;
|
||||
while ($db->Next()) {
|
||||
$tot_dpp += $db->Row("Jumlah_DPP");
|
||||
$tot_ppn += $db->Row("Jumlah_PPN");
|
||||
$body .= sprintf($_line, $nomor++, $db->Row("No_Biaya"), tgl_sql2str($db->Row("Tgl_Biaya")), $db->Row("No_Pajak"), $db->Row("No_NPWP"), $db->Row("Nama_NPWP"), rupiah2($db->Row("Jumlah_DPP")), rupiah2($db->Row("Jumlah_PPN")));
|
||||
}
|
||||
$body .= sprintf($_sline, "Jumlah", rupiah2($tot_dpp), rupiah2($tot_ppn));
|
||||
|
||||
echo $header . $body . "</tbody></table>" . Report_Stamp(1, true);
|
||||
|
||||
} else if ( $data == "export" ) {
|
||||
\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
|
||||
|
||||
$styleTxt = [
|
||||
'numberFormat' => ['formatCode' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT]
|
||||
];
|
||||
$styleNum = [
|
||||
'numberFormat' => ['formatCode' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2]
|
||||
];
|
||||
|
||||
$ssheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||
$ssheet->getProperties()
|
||||
->setCreator($_SESSION['__WEB_APP']['APP_NAME']." v".$_SESSION['__WEB_APP']['APP_VER'])
|
||||
->setLastModifiedBy($_SESSION['__WEB_APP']['APP_NAME']." v".$_SESSION['__WEB_APP']['APP_VER'])
|
||||
->setTitle("Data Rekapitulasi FP Invoice Biaya")
|
||||
->setCompany($_SESSION['__WEB_APP']['REG_NAME']);
|
||||
$sheet = $ssheet->getActiveSheet();
|
||||
$sheet->setTitle("Data Rekapitulasi FP Invoice Biaya");
|
||||
|
||||
// header
|
||||
$styleHeader = [
|
||||
'font' => ['bold' => true],
|
||||
'alignment' => ['horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER]
|
||||
];
|
||||
$sheet->setCellValue("A1", strtoupper($_SESSION['__WEB_APP']['REG_NAME']));
|
||||
$sheet->mergeCells('A1:H1');
|
||||
$sheet->setCellValue("A2", "LAPORAN REKAPITULASI FP INVOICE BIAYA");
|
||||
$sheet->mergeCells('A2:H2');
|
||||
$sheet->setCellValue("A3", $tglheader);
|
||||
$sheet->mergeCells('A3:H3');
|
||||
$sheet->getStyle('A1:H3')->applyFromArray($styleHeader);
|
||||
|
||||
// table header
|
||||
$sheet->getColumnDimension('A')->setWidth(8);
|
||||
$sheet->getColumnDimension('B')->setWidth(18);
|
||||
$sheet->getColumnDimension('C')->setWidth(12);
|
||||
$sheet->getColumnDimension('D')->setWidth(25);
|
||||
$sheet->getColumnDimension('E')->setWidth(25);
|
||||
$sheet->getColumnDimension('F')->setWidth(20);
|
||||
$sheet->getColumnDimension('G')->setWidth(18);
|
||||
$sheet->getColumnDimension('H')->setWidth(18);
|
||||
|
||||
$styleTableH = [
|
||||
'font' => ['bold' => true],
|
||||
'alignment' => ['horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER, 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, 'wrapText' => true],
|
||||
'fill' => ['fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID, 'startColor' => ['rgb'=>"D0D0D0"]],
|
||||
'borders' => ['allBorders' => ['borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN, 'color' => ['rgb'=>"C0C0C0"]]]
|
||||
];
|
||||
$baris = 5;
|
||||
$sheet->setCellValue("A".$baris, "No.");
|
||||
$sheet->setCellValue("B".$baris, "No. Faktur");
|
||||
$sheet->setCellValue("C".$baris, "Tgl. Faktur");
|
||||
$sheet->setCellValue("D".$baris, "NSFP");
|
||||
$sheet->setCellValue("E".$baris, "NPWP");
|
||||
$sheet->setCellValue("F".$baris, "Nama NPWP");
|
||||
$sheet->setCellValue("G".$baris, "DPP");
|
||||
$sheet->setCellValue("H".$baris, "PPN");
|
||||
$sheet->getStyle('A'.$baris.':H'.$baris)->applyFromArray($styleTableH);
|
||||
|
||||
$baris++; $nomor = 1; $tot_dpp = 0; $tot_ppn = 0;
|
||||
while ($db->Next()) {
|
||||
$sheet->setCellValue("A".$baris, $nomor++);
|
||||
$sheet->setCellValue("B".$baris, $db->Row("No_Biaya"));
|
||||
$sheet->setCellValue("C".$baris, $db->Row("Tgl_Biaya"));
|
||||
$sheet->setCellValue("D".$baris, $db->Row("No_Pajak"));
|
||||
$sheet->setCellValue("E".$baris, $db->Row("No_NPWP"));
|
||||
$sheet->setCellValue("F".$baris, $db->Row("Nama_NPWP"));
|
||||
$sheet->setCellValue("G".$baris, $db->RowFloat("Jumlah_DPP"));
|
||||
$sheet->setCellValue("H".$baris, $db->RowFloat("Jumlah_PPN"));
|
||||
$sheet->getStyle('G'.$baris.':H'.$baris)->applyFromArray($styleNum);
|
||||
$baris++;
|
||||
$tot_dpp += $db->Row("Jumlah_DPP");
|
||||
$tot_ppn += $db->Row("Jumlah_PPN");
|
||||
}
|
||||
$sheet->setCellValue("A".$baris, "Jumlah");
|
||||
$sheet->mergeCells('A'.$baris.':F'.$baris);
|
||||
$sheet->setCellValue("G".$baris, $tot_dpp);
|
||||
$sheet->setCellValue("H".$baris, $tot_ppn);
|
||||
$sheet->getStyle('A'.$baris.':F'.$baris)->applyFromArray(['alignment' => ['horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER]]);
|
||||
$sheet->getStyle('G'.$baris.':H'.$baris)->applyFromArray($styleNum);
|
||||
$styleSub = [
|
||||
'font' => ['bold' => true],
|
||||
'fill' => ['fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID, 'startColor' => ['rgb'=>"D0D0D0"]]
|
||||
];
|
||||
$sheet->getStyle('A'.$baris.':H'.$baris)->applyFromArray($styleSub);
|
||||
|
||||
$sheet->getSheetView()->setZoomScale(75);
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="Data Rekapitulasi FP Invoice Biaya.xlsx"');
|
||||
header('Cache-Control: max-age=0');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($ssheet, 'Xlsx');
|
||||
$writer->save('php://output');
|
||||
$ssheet->disconnectWorksheets();
|
||||
unset($ssheet);
|
||||
unset($writer);
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$form = new Form($db);
|
||||
$form->datebox("Dari Tanggal", "Tgl_From", tgl_ymd(), true, false);
|
||||
$form->datebox("Sampai Tanggal", "Tgl_To", tgl_ymd(), true, false);
|
||||
$form->show(' _Tgl_From_ _Tgl_To_ ');
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/rekap_outlet.php
|
||||
Desc. : PHP - Laporan R. Penjualan Produk/Outlet
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : April 16th, 2011.
|
||||
Last Modified : November 18th, 2023.
|
||||
|
||||
(c) 2011 - 2023, 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;
|
||||
use siaupheng\fonia3\Data\SimpleXLS;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export" ) {
|
||||
$id_outlet = Param::Get("OutletID", 0);
|
||||
$id_grup = Param::Get("Grup_InvID");
|
||||
$tglfrom = Param::Get("Tgl_From");
|
||||
$tglto = Param::Get("Tgl_To");
|
||||
$aoutlet = []; $agrup = [];
|
||||
if ($id_outlet > 0) {
|
||||
$db->Query("SELECT * FROM para_outlet WHERE OutletID='".$id_outlet."' LIMIT 1");
|
||||
if ($db->Next()) $aoutlet = $db->AllRow();
|
||||
}
|
||||
if ($id_grup > 0) {
|
||||
$db->Query("SELECT * FROM inv_produk_grup WHERE Grup_InvID='".$id_grup."' LIMIT 1");
|
||||
if ($db->Next()) $agrup = $db->AllRow();
|
||||
}
|
||||
|
||||
// generate report header
|
||||
$tglheader = "Periode : ".$tglfrom;
|
||||
if ($tglfrom!==$tglto) $tglheader .= " S/D ".$tglto;
|
||||
$tglfrom = tgl_sql2str($tglfrom);
|
||||
$tglto = tgl_sql2str($tglto);
|
||||
|
||||
$tsql = ($id_outlet>0) ? " AND J.OutletID='".$id_outlet."'" : "";
|
||||
$tsql .= ($id_grup>0) ? " AND P.Grup_InvID='".$id_grup."'" : "";
|
||||
|
||||
$db->Query("SELECT D.Promo,P.Kode_Produk,P.Nama_Produk,SUM(-D.Qty) Qty,S.Nama_Satuan FROM inv_detail D LEFT JOIN inv_jual J ON (D.No_Ref=J.No_Jual) LEFT JOIN inv_produk P ON (D.InvID=P.InvID) LEFT JOIN para_satuan S ON (D.SatuanID=S.SatuanID) WHERE J.Data_Jual=1 AND (J.Tgl_Jual BETWEEN '".$tglfrom."' AND '".$tglto."') AND J.Rekap=1".$tsql." GROUP BY D.Promo,D.InvID,D.SatuanID ORDER BY D.Promo,P.Nama_Produk");
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN REKAP PENJUALAN PRODUK PER-OUTLET", $tglheader);
|
||||
$pre = new PrintHTML();
|
||||
$pre->set_css("garis");
|
||||
|
||||
if ($id_outlet>0) echo "Nama Outlet : ".$aoutlet['Nama_Outlet']."<br>";
|
||||
if ($id_grup>0) echo "Nama Grup Produk : ".$agrup['Nama_Grup']."<br>";
|
||||
|
||||
$pre->add_field("No.",10,"C");
|
||||
$pre->add_field("Kode",10);
|
||||
$pre->add_field("Nama Produk",90);
|
||||
$pre->add_field("Jumlah",20,"R");
|
||||
$pre->add_field("Satuan",10);
|
||||
$pre->show_fields();
|
||||
|
||||
$nomor = 0; $atot = [];
|
||||
while ($db->Next()) {
|
||||
$pre->add_value(++$nomor, $db->Row("Kode_Produk"), $db->Row("Nama_Produk").(($db->Row("Promo")>0)?" ***":""), uang($db->Row("Qty"),2), $db->Row("Nama_Satuan"));
|
||||
$atot[$db->Row("Nama_Satuan")] += $db->Row("Qty");
|
||||
}
|
||||
$ket_tot = "";
|
||||
foreach ($atot as $key => $val) {
|
||||
if ($val > 0) $ket_tot .= " / ".uang($val,2)." ".strtoupper($key);
|
||||
}
|
||||
$ket_tot = substr($ket_tot, 3);
|
||||
$pre->add_span(array("GRAND TOTAL",2,"L,B"),array($ket_tot,3,"C,B"));
|
||||
$pre->add_stamp(1, true);
|
||||
$pre->show();
|
||||
|
||||
} else if ( $data == "export" ) {
|
||||
$xls = new SimpleXLS([
|
||||
'title'=>"Laporan Rekap Penjualan Produk Per Outlet",
|
||||
'subject'=>"PT.PMS",
|
||||
'desc'=>"Export Data dari IAS"
|
||||
]);
|
||||
$xls->add_header("<b>".strtoupper($_SESSION['__WEB_APP']['REG_NAME'])."</b>");
|
||||
$xls->add_header("<b>LAPORAN REKAP PENJUALAN PRODUK PER-OUTLET</b>");
|
||||
$xls->add_header($tglheader);
|
||||
|
||||
$xls->add_field("NO.", 5, "C");
|
||||
$xls->add_field("KODE", 12, "L");
|
||||
$xls->add_field("NAMA PRODUK", 60, "L");
|
||||
$xls->add_field("JUMLAH", 22, "R,N");
|
||||
$xls->add_field("SATUAN", 8, "L");
|
||||
$xls->add_sheet("REKAP OUTLET", false);
|
||||
|
||||
if ($id_outlet>0) $xls->add_span(["Nama Outlet : ".$aoutlet['Nama_Outlet'],5,"L"]);
|
||||
if ($id_grup>0) $xls->add_span(["Nama Grup Produk : ".$agrup['Nama_Grup'],5,"L"]);
|
||||
$xls->show_headers();
|
||||
|
||||
$nomor = 0; $atot = [];
|
||||
while ($db->Next()) {
|
||||
$xls->add_value(++$nomor, $db->Row("Kode_Produk"), $db->Row("Nama_Produk").(($db->Row("Promo")>0)?" ***":""), uang($db->Row("Qty"),2), $db->Row("Nama_Satuan"));
|
||||
$atot[$db->Row("Nama_Satuan")] += $db->Row("Qty");
|
||||
}
|
||||
$ket_tot = "";
|
||||
foreach ($atot as $key => $val) {
|
||||
if ($val > 0) $ket_tot .= " / ".uang($val,2)." ".strtoupper($key);
|
||||
}
|
||||
$ket_tot = substr($ket_tot, 3);
|
||||
$xls->add_span(array("GRAND TOTAL",2,"L,B"),array($ket_tot,3,"C,B"));
|
||||
$xls->add_stamp(1, true);
|
||||
$xls->send("Laporan Rekap Penjualan Produk Per Outlet.xlsx");
|
||||
unset($xls);
|
||||
|
||||
} else if ( $data == "brow-outlet" ) {
|
||||
$tcari = trim(Param::Get("Cari_Outlet"));
|
||||
$tsql = ($tcari=="") ? " LIMIT 100" : " AND CONCAT(Nama_Outlet,Telp_Outlet,Nama_Outlet) LIKE '%".$tcari."%'";
|
||||
|
||||
$obj = new Table($db);
|
||||
$obj->set_query("SELECT * FROM vi_para_outlet WHERE Aktif=1".$tsql);
|
||||
$obj->add_field("OutletID", "ID", "hid");
|
||||
$obj->add_field("Kode_Outlet", "Kode", "c");
|
||||
$obj->add_field("Nama_Alamat", "Nama Outlet", "awr");
|
||||
$obj->add_field("Alamat_Kota", "Alamat & Kota", "awr");
|
||||
$obj->set_field_order("Nama_Outlet", "A");
|
||||
$obj->add_row_btn("save", "Pilih", "RepoRekapOutletJS.outlet_select");
|
||||
$obj->set_func_navi("RepoRekapOutletJS.data_query('brow-outlet')");
|
||||
$ajson[] = $obj->json_table("divBrowOutlet");
|
||||
|
||||
} else if ( $data == "auto-outlet" ) {
|
||||
$tcari = Param::Get("Auto_Query");
|
||||
$ajson['autodata'] = [['value' => 0, 'text' => "SEMUA OUTLET", 'data' => ""]];
|
||||
if (is_string($tcari) && strlen($tcari) < 64) {
|
||||
$db->Query("SELECT * FROM vi_para_outlet WHERE Aktif=1 AND CONCAT(Nama_Outlet,Alamat_Outlet) LIKE '%".$tcari."%' ORDER BY Nama_Outlet LIMIT 50");
|
||||
while ($db->Next()) {
|
||||
$ajson['autodata'][] = ['value'=>$db->Row("OutletID"), 'text'=>$db->Row("Nama_Alamat"), 'data'=>$db->Row("Alamat_Kota")];
|
||||
}
|
||||
}
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$form = new Form($db);
|
||||
$toutlet = $form->textauto("_", "Nama_Outlet", ['value'=>0,'text'=>"SEMUA OUTLET"], true, false);
|
||||
$tgrup = $form->option_db("_", "Grup_InvID", 0, true, false, "inv_produk_grup", ["Grup_InvID","Nama_Grup"], "TRUE ORDER BY Nama_Grup", [0,"SEMUA GRUP"]);
|
||||
$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="Nama_Outlet">Nama Outlet</label>
|
||||
<div class="col"><div class="input-group">'.$toutlet.'<button class="btn btn-info" type="button" onclick="RepoRekapOutletJS.outlet_brow();"><i class="bi-search"></i></button></div></div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Grup_InvID">Grup Produk</label>
|
||||
<div class="col">'.$tgrup.'</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>
|
||||
<input type="hidden" id="OutletID" value="0">';
|
||||
|
||||
}
|
||||
|
||||
send_json($ajson);
|
||||
?>
|
||||
@@ -0,0 +1,182 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/rekap_outlet_oli.php
|
||||
Desc. : PHP - Rekap Penj. Outlet Produk Sosro & Oli
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : November 20th, 2014.
|
||||
Last Modified : January 20th, 2024.
|
||||
|
||||
(c) 2014 - 2024, 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\Web\Param;
|
||||
use siaupheng\fonia3\Web\Form;
|
||||
use siaupheng\fonia3\Printer\PrintHTML;
|
||||
use siaupheng\fonia3\Data\SimpleXLS;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export" ) {
|
||||
$tipe = Param::Get("Tipe", 1); // 1, 2
|
||||
$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);
|
||||
|
||||
$sjudul = "OLI"; $tsql1 = ""; $tsql2 = "/B.Qty"; $tsql3 = "5";
|
||||
if ($tipe==1) {
|
||||
$sjudul = "SOSRO"; $tsql1 = " NOT"; $tsql2 = ""; $tsql3 = "3";
|
||||
}
|
||||
|
||||
$tsql = (Param::Get("Semua",2)==1) ? " WHERE D.OutletID2 IS NOT NULL" : "";
|
||||
$ahasil = []; $aprod = [];
|
||||
$db->Query("SELECT O.OutletID,O.Nama_Outlet,O.Alamat_Outlet,D.* FROM (SELECT * FROM para_outlet WHERE Grup_OutletID".$tsql1." IN (14,18,19,20,21,22,23,25,26,27,28,29,30,31,32,33,34,35,36)) O LEFT JOIN (SELECT A.No_Ref,A.InvID,SUM(-A.Stok)".$tsql2." Qty,J.OutletID OutletID2,S.Nama_Pegawai Nama_Sales FROM inv_detail A LEFT JOIN inv_jual J ON (A.No_Ref=J.No_Jual) LEFT JOIN para_pegawai S ON (J.SalesID=S.PegID) LEFT JOIN inv_produk_kemasan B ON (A.InvID=B.InvID AND B.SatuanID=2) WHERE (A.Tgl_Ref BETWEEN '".$tglfrom."' AND '".$tglto."') AND A.InvID IN (SELECT InvID FROM inv_produk WHERE Grup_InvID=".$tsql3." ORDER BY Kode_Produk) AND A.NotaID=5 AND J.Rekap=1 GROUP BY A.No_Ref,A.InvID) D ON (O.OutletID=D.OutletID2)".$tsql." ORDER BY O.Nama_Outlet");
|
||||
while ($db->Next()) {
|
||||
if (!$ahasil[$db->Row("OutletID")]) {
|
||||
$ahasil[$db->Row("OutletID")]['Nama'] = $db->Row("Nama_Outlet");
|
||||
$ahasil[$db->Row("OutletID")]['Alamat'] = $db->Row("Alamat_Outlet");
|
||||
$ahasil[$db->Row("OutletID")]['Sales'] = $db->Row("Nama_Sales");
|
||||
}
|
||||
$ahasil[$db->Row("OutletID")][$db->Row("InvID")] += $db->RowFloat("Qty", 0);
|
||||
$aprod[$db->Row("InvID")] += $db->RowFloat("Qty", 0);
|
||||
}
|
||||
|
||||
$aproduk = array();
|
||||
$db->Query("SELECT InvID,Kode_Produk FROM inv_produk WHERE Grup_InvID='".$tsql3."'");
|
||||
while ($db->Next()) {
|
||||
$aproduk[$db->Row("InvID")] = $db->Row("Kode_Produk");
|
||||
}
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN PENJUALAN ".$sjudul, $tglheader);
|
||||
$pre = new PrintHTML();
|
||||
$pre->set_css("garis");
|
||||
$pre->add_field("NO.",5,"C");
|
||||
$pre->add_field("NAMA OUTLET",80);
|
||||
$pre->add_field("ALAMAT OUTLET",100);
|
||||
$pre->add_field("SALES",20);
|
||||
foreach ($aprod as $_key => $_val) {
|
||||
if ($_key == "") continue;
|
||||
$pre->add_field($aproduk[$_key],50,"R","rupiah2");
|
||||
}
|
||||
$pre->add_field("TOTAL",50,"R","rupiah2");
|
||||
$pre->show_fields();
|
||||
|
||||
$tot = 0; $no = 1;
|
||||
foreach ($ahasil as $_key => $_val) {
|
||||
$_tot = 0;
|
||||
$_atmp = array($no, $_val['Nama'], $_val['Alamat'], $_val['Sales']);
|
||||
foreach ($aprod as $_key2 => $_val2) {
|
||||
if ($_key2 == "") continue;
|
||||
$_atmp[] = $_val[$_key2];
|
||||
$_tot += $_val[$_key2];
|
||||
}
|
||||
$_atmp[] = $_tot;
|
||||
$pre->add_value($_atmp);
|
||||
$no++;
|
||||
}
|
||||
$_tot = 0;
|
||||
$_atmp = array("", "TOTAL", "", "");
|
||||
foreach ($aprod as $_key2 => $_val2) {
|
||||
if ($_key2 == "") continue;
|
||||
$_atmp[] = $_val2;
|
||||
$_tot += $_val2;
|
||||
}
|
||||
$_atmp[] = $_tot;
|
||||
$pre->add_value($_atmp);
|
||||
|
||||
$pre->add_stamp(0, true);
|
||||
$pre->show();
|
||||
|
||||
} else if ( $data == "export" ) {
|
||||
$xls = new SimpleXLS([
|
||||
'title'=>"Laporan Penjualan ".ucfirst($sjudul)."",
|
||||
'subject'=>"PT.PMS",
|
||||
'desc'=>"Export Data dari IAS"
|
||||
]);
|
||||
$xls->add_header("<b>".strtoupper($_SESSION['__WEB_APP']['REG_NAME'])."</b>");
|
||||
$xls->add_header("<b>LAPORAN PENJUALAN ".$sjudul."</b>");
|
||||
$xls->add_header($tglheader);
|
||||
|
||||
$xls->add_field("NO.", 6, "C");
|
||||
$xls->add_field("NAMA OUTLET", 30, "L");
|
||||
$xls->add_field("ALAMAT OUTLET", 80, "L");
|
||||
$xls->add_field("SALES", 20, "L");
|
||||
foreach ($aprod as $_key => $_val) {
|
||||
if ($_key == "") continue;
|
||||
$xls->add_field($aproduk[$_key],12,"R,N");
|
||||
}
|
||||
$xls->add_field("TOTAL",12,"R,N");
|
||||
$xls->add_sheet("REKAP PENJUALAN ".$sjudul, false);
|
||||
$xls->show_headers();
|
||||
|
||||
$tot = 0; $no = 1;
|
||||
foreach ($ahasil as $_key => $_val) {
|
||||
$_tot = 0;
|
||||
$_atmp = array($no, $_val['Nama'], $_val['Alamat'], $_val['Sales']);
|
||||
foreach ($aprod as $_key2 => $_val2) {
|
||||
if ($_key2 == "") continue;
|
||||
$_atmp[] = $_val[$_key2];
|
||||
$_tot += $_val[$_key2];
|
||||
}
|
||||
$_atmp[] = $_tot;
|
||||
$xls->add_value($_atmp);
|
||||
$no++;
|
||||
}
|
||||
$_tot = 0;
|
||||
$_atmp = array("", "TOTAL", "", "");
|
||||
foreach ($aprod as $_key2 => $_val2) {
|
||||
if ($_key2 == "") continue;
|
||||
$_atmp[] = $_val2;
|
||||
$_tot += $_val2;
|
||||
}
|
||||
$_atmp[] = $_tot;
|
||||
$xls->add_value($_atmp);
|
||||
|
||||
$xls->add_stamp(1, true);
|
||||
$xls->send("Laporan Penjualan ".ucfirst($sjudul).".xlsx");
|
||||
unset($xls);
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$form = new Form($db);
|
||||
$ttipe = $form->radio("_", "Tipe", 1, true, false, [1=>"Sosro",2=>"Oli"], null);
|
||||
$tsemua = $form->radio("_", "Semua", 2, true, false, [1=>"Ya",2=>"Tidak"]);
|
||||
$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">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Semua">Semua Outlet</label>
|
||||
<div class="col">'.$tsemua.'</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>';
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/rekap_outlet_produk.php
|
||||
Desc. : PHP - Laporan Rekap Penj. Outlet/Produk
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : November 4th, 2011.
|
||||
Last Modified : November 18th, 2023.
|
||||
|
||||
(c) 2011 - 2023, 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;
|
||||
use siaupheng\fonia3\Data\SimpleXLS;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export" ) {
|
||||
$rekap = Param::Get("Rekap"); // X, 1, 0
|
||||
$id_inv = Param::Get("InvID", 0);
|
||||
$id_sales = Param::Get("SalesID", 0);
|
||||
$id_grup = Param::Get("Grup_OutletID");
|
||||
$tglfrom = Param::Get("Tgl_From");
|
||||
$tglto = Param::Get("Tgl_To");
|
||||
|
||||
if ($id_inv>0) {
|
||||
$nama_produk = ""; $ainfo = array();
|
||||
$db->Query("SELECT CONCAT('[',P.Kode_Produk,'] ',P.Nama_Produk,' (',P.Satuan_Normal,')') Nama,K.Qty Kali,P.Satuan_Stok,P.Satuan_Normal FROM vi_inv_produk P LEFT JOIN inv_produk_kemasan K ON (K.InvID=P.InvID AND K.SatuanID=P.NormalID) WHERE P.InvID='".$id_inv."'");
|
||||
if ($db->Next()) {
|
||||
$nama_produk = $db->Row("Nama");
|
||||
$ainfo = $db->AllRow();
|
||||
}
|
||||
}
|
||||
if ($id_grup>0) {
|
||||
$db->Query("SELECT Nama_Grup FROM para_outlet_grup WHERE Grup_OutletID='".$id_grup."'");
|
||||
if ($db->Next()) $nama_goutlet = $db->Row("Nama_Grup");
|
||||
}
|
||||
if ($id_sales>0) {
|
||||
$db->Query("SELECT Nama_Pegawai FROM para_pegawai WHERE PegID='".$id_sales."'");
|
||||
if ($db->Next()) $nama_sales = $db->Row("Nama_Pegawai");
|
||||
}
|
||||
|
||||
// generate report header
|
||||
$tglheader = "Periode : ".$tglfrom;
|
||||
if ($tglfrom!==$tglto) $tglheader .= " S/D ".$tglto;
|
||||
$tglfrom = tgl_sql2str($tglfrom);
|
||||
$tglto = tgl_sql2str($tglto);
|
||||
|
||||
$tsql = ($id_grup==0) ? "" : " AND O.Grup_OutletID='".$id_grup."'";
|
||||
$tsql .= ($id_sales==0) ? "" : " AND J.SalesID='".$id_sales."'";
|
||||
$tsql .= ($rekap=="X") ? "" : " AND J.Rekap='".intval($rekap)."'";
|
||||
|
||||
$db->Query("SELECT O.Nama_Outlet,O.Alamat_Outlet,SUM(D.Qty) Qty,SUM(D.Stok) Stok,D.Promo,S.Nama_Satuan FROM (SELECT No_Ref,Promo,SatuanID,SUM(-Qty) Qty,SUM(-Stok) Stok FROM inv_detail WHERE NotaID=5 AND InvID=".$id_inv." AND (Tgl_Ref BETWEEN '".$tglfrom."' AND '".$tglto."') GROUP BY No_Ref) D LEFT JOIN inv_jual J ON (D.No_Ref=J.No_Jual) LEFT JOIN para_outlet O ON (J.OutletID=O.OutletID) LEFT JOIN para_satuan S ON (D.SatuanID=S.SatuanID) WHERE J.Data_Jual=1".$tsql." GROUP BY J.OutletID,D.Promo,D.SatuanID ORDER BY O.Nama_Outlet,D.Promo,D.SatuanID");
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN REKAP PENJUALAN OUTLET / PRODUK", $tglheader);
|
||||
$pre = new PrintHTML();
|
||||
$pre->set_css("garis");
|
||||
|
||||
echo "Nama Produk : ".$nama_produk."<br>";
|
||||
if ($id_grup>0) echo "Nama Grup Outlet : ".$nama_goutlet."<br>";
|
||||
if ($id_sales>0) echo "Nama Sales : ".$nama_sales."<br>";
|
||||
|
||||
$pre->add_field("NO.",5,"R");
|
||||
$pre->add_field("NAMA OUTLET",80);
|
||||
$pre->add_field("ALAMAT OUTLET",100);
|
||||
$pre->add_field("QTY",10,"R");
|
||||
$pre->add_field("SATUAN",15);
|
||||
$pre->show_fields();
|
||||
|
||||
$tot = 0; $no = 1;
|
||||
while ($db->Next()) {
|
||||
$pre->add_value($no++, $db->Row("Nama_Outlet"), $db->Row("Alamat_Outlet"), uang($db->Row("Qty"),2), $db->Row("Nama_Satuan").(($db->Row("Promo",0)==0)?"":" ***"));
|
||||
$tot += $db->Row("Stok");
|
||||
}
|
||||
$pre->add_span(array("JUMLAH PENJUALAN",3,"R,B"),array(Format_Stok($tot,$ainfo['Kali'],$ainfo['Satuan_Normal'],$ainfo['Satuan_Stok']),2,"C,B"));
|
||||
$pre->add_stamp(0, true);
|
||||
$pre->show();
|
||||
|
||||
} else if ( $data == "export" ) {
|
||||
$xls = new SimpleXLS([
|
||||
'title'=>"Laporan Rekap Penjualan Outlet / Produk",
|
||||
'subject'=>"PT.PMS",
|
||||
'desc'=>"Export Data dari IAS"
|
||||
]);
|
||||
$xls->add_header("<b>".strtoupper($_SESSION['__WEB_APP']['REG_NAME'])."</b>");
|
||||
$xls->add_header("<b>LAPORAN REKAP PENJUALAN OUTLET / PRODUK</b>");
|
||||
$xls->add_header($nama_produk);
|
||||
$xls->add_header($tglheader);
|
||||
|
||||
$xls->add_field("NO.", 10, "C");
|
||||
$xls->add_field("NAMA OUTLET", 50, "L");
|
||||
$xls->add_field("ALAMAT OUTLET", 80, "L");
|
||||
$xls->add_field("QTY", 20, "R,N");
|
||||
$xls->add_field("SATUAN", 15, "L");
|
||||
$xls->add_sheet("REKAP OUTLET PRODUK", false);
|
||||
|
||||
if ($id_grup>0) $xls->add_span(["Nama Grup Outlet : ".$nama_goutlet,5,"L"]);
|
||||
if ($id_sales>0) $xls->add_span(["Nama Sales : ".$nama_sales,5,"L"]);
|
||||
$xls->show_headers();
|
||||
|
||||
$tot = 0; $no = 1;
|
||||
while ($db->Next()) {
|
||||
$xls->add_value($no++, $db->Row("Nama_Outlet"), $db->Row("Alamat_Outlet"), $db->RowFloat("Qty"), $db->Row("Nama_Satuan").(($db->Row("Promo",0)==0)?"":" ***"));
|
||||
$tot += $db->Row("Stok");
|
||||
}
|
||||
$xls->add_span(array("JUMLAH PENJUALAN",3,"R,B"),array(Format_Stok($tot,$ainfo['Kali'],$ainfo['Satuan_Normal'],$ainfo['Satuan_Stok']),2,"C,B"));
|
||||
$xls->add_stamp(1, true);
|
||||
$xls->send("Laporan Rekap Penjualan Outlet Per Produk.xlsx");
|
||||
unset($xls);
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$form = new Form($db);
|
||||
$trekap = $form->radio("_", "Rekap", "1", true, false, ["1"=>"Antar","0"=>"Belum Antar","X"=>"Semua"]);
|
||||
$tproduk = $form->option_db("_", "InvID", 0, true, false, "inv_produk", ["InvID","Nama_Produk"], "TRUE ORDER BY Nama_Produk");
|
||||
$tgrup = $form->option_db("_", "Grup_OutletID", 0, true, false, "para_outlet_grup", ["Grup_OutletID","Nama_Grup"], "TRUE ORDER BY Nama_Grup", [0,"SEMUA GRUP"]);
|
||||
$tsales = $form->option_db("_", "SalesID", 0, true, false, "para_pegawai", ["PegID","Nama_Pegawai"], "Jenis_PegID='".$_SESSION['__APP_IAS']['GRUP_PEG_SALES']."' ORDER BY Nama_Pegawai", [0,"SEMUA SALES"]);
|
||||
$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="Rekap">Status Order</label>
|
||||
<div class="col">'.$trekap.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="InvID">Nama Produk</label>
|
||||
<div class="col">'.$tproduk.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Grup_OutletID">Grup Outlet</label>
|
||||
<div class="col">'.$tgrup.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="SalesID">Nama Sales</label>
|
||||
<div class="col">'.$tsales.'</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>';
|
||||
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,377 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/rekap_promo.php
|
||||
Desc. : PHP - Laporan Penjualan Produk Promo
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : July 22th, 2011.
|
||||
Last Modified : March 28th, 2025.
|
||||
|
||||
(c) 2011 - 2025, 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;
|
||||
use siaupheng\fonia3\Data\SimpleXLS;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
$id_grup = Param::Get("Grup_InvID", 0);
|
||||
$id_inv = Param::Get("InvID", 0);
|
||||
|
||||
if ( $data == "print" || $data == "export" ) {
|
||||
$tipe = Param::Get("Tipe"); // R or D
|
||||
$rekap = Param::Get("Rekap"); // X, 1, 0
|
||||
$id_sales = Param::Get("SalesID", "SEMUA");
|
||||
$tglfrom = Param::Get("Tgl_From");
|
||||
$tglto = Param::Get("Tgl_To");
|
||||
$asales = []; $aproduk = [];
|
||||
if (!in_array($id_sales, [0,"NON","SEMUA"])) {
|
||||
$db->Query("SELECT Nama_Pegawai Nama_Sales FROM para_pegawai WHERE PegID='".$id_sales."' LIMIT 1");
|
||||
if ($db->Next()) $asales = $db->AllRow();
|
||||
}
|
||||
if ($id_sales=="NON") $asales['Nama_Sales'] = "TANPA SALES";
|
||||
if ($id_inv > 0) {
|
||||
$db->Query("SELECT UPPER(CONCAT('[',Kode_Produk,'] ',Nama_Produk,' (',Satuan_Normal,')')) Nama_Produk FROM vi_inv_produk WHERE InvID='".$id_inv."' LIMIT 1");
|
||||
if ($db->Next()) $aproduk = $db->AllRow();
|
||||
}
|
||||
|
||||
// generate report header
|
||||
$tglheader = "Periode : ".$tglfrom;
|
||||
if ($tglfrom!==$tglto) $tglheader .= " S/D ".$tglto;
|
||||
$tglfrom = tgl_sql2str($tglfrom);
|
||||
$tglto = tgl_sql2str($tglto);
|
||||
|
||||
$qdetail = ""; $qsql = "";
|
||||
if ($id_inv > 0) {
|
||||
$qdetail = " AND InvID='".$id_inv."'";
|
||||
} else if ($id_grup > 0) {
|
||||
$qsql .= " AND P.Grup_InvID='".$id_grup."'";
|
||||
} else {
|
||||
$qsql .= " AND P.Grup_InvID NOT IN ('".$_SESSION['__APP_IAS']['GRUP_PRODUK_KEMASAN']."','".$_SESSION['__APP_IAS']['GRUP_PRODUK_HADIAH']."')";
|
||||
}
|
||||
$qsql .= ($rekap<>"X") ? " AND J.Rekap='".intval($rekap)."'" : "";
|
||||
$qsql .= ($id_sales>0 && $id_sales<>"NON") ? " AND J.SalesID='".$id_sales."'" : "";
|
||||
$qsql .= ($id_sales=="NON") ? " AND J.SalesID=0" : "";
|
||||
|
||||
if ($tipe=="R") {
|
||||
$db->Query("SELECT SUM(-D.Qty) Qty,S.Nama_Satuan,CONCAT(P.Nama_Produk,IF(D.RasaID=0,'',CONCAT(' (',R.Nama_Rasa,')'))) Nama_Produk FROM (SELECT * FROM inv_detail WHERE (Tgl_Ref BETWEEN '".$tglfrom."' AND '".$tglto."') AND Pro_SQ=1".$qdetail.") D LEFT JOIN inv_jual J ON (J.No_Jual=D.No_Ref) LEFT JOIN para_outlet O ON (O.OutletID=J.OutletID) LEFT JOIN inv_produk P ON (P.InvID=D.InvID) LEFT JOIN para_satuan S ON (S.SatuanID=D.SatuanID) LEFT JOIN para_rasa R ON (R.RasaID=D.RasaID) WHERE J.Data_Jual=1".$qsql." GROUP BY D.InvID,D.RasaID,D.SatuanID ORDER BY P.Nama_Produk,D.RasaID,D.SatuanID");
|
||||
} else if ($tipe=="B") {
|
||||
if (trim($qsql)<>"") $qsql = " WHERE".substr($qsql,4);
|
||||
$db->Query("SELECT D.*,J.Tgl_Jual,O.Nama_Outlet,O.Alamat_Outlet FROM (SELECT B.No_Ref,B.InvID,B.SatuanID,J.SatuanID SatuanID2,B.Bonus,J.Qty FROM (SELECT No_Ref,InvID,SatuanID,-Qty Bonus FROM inv_detail WHERE (Tgl_Ref BETWEEN '".$tglfrom."' AND '".$tglto."') AND Pro_SQ=1 AND NotaID=5 AND Qty<>0".$qdetail.") B LEFT JOIN (SELECT No_Ref,InvID,SatuanID,SUM(-Qty) Qty FROM inv_detail WHERE (Tgl_Ref BETWEEN '".$tglfrom."' AND '".$tglto."') AND Pro_SQ=0 AND NotaID=5".$qdetail." GROUP BY No_Ref,InvID,SatuanID) J ON (B.No_Ref=J.No_Ref AND B.InvID=J.InvID)) D LEFT JOIN inv_jual J ON (D.No_Ref=J.No_Jual) LEFT JOIN para_outlet O ON (J.OutletID=O.OutletID) LEFT JOIN inv_produk P ON (P.InvID=D.InvID)".$qsql." ORDER BY J.Tgl_Jual");
|
||||
$aheader = []; $adata = [];
|
||||
while ($db->Next()) {
|
||||
$aheader[$db->Row("InvID")] = "";
|
||||
$adata[$db->Row("No_Ref")]['Kode'] = ($db->Row("SatuanID",0)==$db->Row("SatuanID2",0)?$adata[$db->Row("No_Ref")]['Kode']:" ***");
|
||||
$adata[$db->Row("No_Ref")]['No_Jual'] = $db->Row("No_Ref");
|
||||
$adata[$db->Row("No_Ref")]['Tgl_Jual'] = tgl_sql2str($db->Row("Tgl_Jual"));
|
||||
$adata[$db->Row("No_Ref")]['N_Outlet'] = $db->Row("Nama_Outlet");
|
||||
$adata[$db->Row("No_Ref")]['A_Outlet'] = $db->Row("Alamat_Outlet");
|
||||
$adata[$db->Row("No_Ref")][$db->Row("InvID")]['Qty'] = $db->RowFloat("Qty",0);
|
||||
$adata[$db->Row("No_Ref")][$db->Row("InvID")]['Bonus'] += $db->RowFloat("Bonus",0);
|
||||
}
|
||||
// Header Caption
|
||||
$t_judul = "";
|
||||
foreach ($aheader as $_key => $_val) {
|
||||
$t_judul .= "," . $_key;
|
||||
}
|
||||
$db->Query("SELECT InvID,Kode_Produk FROM inv_produk WHERE InvID IN (".substr($t_judul,1).")");
|
||||
while ($db->Next()) {
|
||||
$aheader[$db->Row("InvID")] = $db->Row("Kode_Produk");
|
||||
}
|
||||
} else {
|
||||
$db->Query("SELECT D.No_Ref,DATE_FORMAT(D.Tgl_Ref,'%d-%m-%Y') Tgl_Ref2,J.No_Faktur,O.Nama_Outlet,LEFT(O.Alamat_Outlet,100) Alamat_Outlet,-D.Qty Qty,S.Nama_Satuan,CONCAT(P.Nama_Produk,IF(D.RasaID=0,'',CONCAT(' (',R.Nama_Rasa,')'))) Nama_Produk FROM (SELECT * FROM inv_detail WHERE (Tgl_Ref BETWEEN '".$tglfrom."' AND '".$tglto."') AND Pro_SQ=1".$qdetail.") D LEFT JOIN inv_jual J ON (J.No_Jual=D.No_Ref) LEFT JOIN para_outlet O ON (O.OutletID=J.OutletID) LEFT JOIN inv_produk P ON (P.InvID=D.InvID) LEFT JOIN para_satuan S ON (S.SatuanID=D.SatuanID) LEFT JOIN para_rasa R ON (R.RasaID=D.RasaID) WHERE J.Data_Jual=1".$qsql." ORDER BY D.Tgl_Ref,O.Nama_Outlet,P.Nama_Produk,D.RasaID,D.SatuanID");
|
||||
}
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN ".($tipe=="R"?"REKAP":($tipe=="B"?"DETAIL & BONUS":"DETAIL"))." PENJUALAN PRODUK PROMO", $tglheader);
|
||||
$pre = new PrintHTML();
|
||||
$pre->set_css("garis");
|
||||
|
||||
if ($tipe=="R") {
|
||||
if ($id_inv>0) echo "Nama Produk : ".$aproduk['Nama_Produk']."<br>";
|
||||
|
||||
$pre->add_field("NO.",10,"C");
|
||||
$pre->add_field("NAMA PRODUK",120);
|
||||
$pre->add_field("JUMLAH",20,"R","rupiah2");
|
||||
$pre->add_field("SATUAN",20);
|
||||
$pre->show_fields();
|
||||
|
||||
$no = 1;
|
||||
while ($db->Next()) {
|
||||
$pre->add_value($no++, $db->Row("Nama_Produk"), $db->Row("Qty"), $db->Row("Nama_Satuan"));
|
||||
}
|
||||
|
||||
} else if ($tipe=="B") {
|
||||
$t_head = '<table class="garis"><tbody>';
|
||||
if ($id_sales>0 && $id_sales=="NON") $t_head .= '<tr><td class="l nb b" colspan="'.((count($aheader)*2)+5).'">NAMA SALES : '.$asales['Nama_Sales'].'</td></tr>';
|
||||
$t_head .= '<tr><th class="c" rowspan="2" width="10">NO.</th><th class="c" rowspan="2" width="20">TANGGAL</th><th class="c" rowspan="2" width="20">NO. NOTA</th><th class="c" rowspan="2" width="120">NAMA OUTLET</th><th class="c" rowspan="2" width="120">ALAMAT OUTLET</th>';
|
||||
$t_shead = '<tr>';
|
||||
foreach ($aheader as $_key => $_val) {
|
||||
$t_head .= '<th class="c" colspan="2" width="60">'.$_val.'</th>';
|
||||
$t_shead .= '<th class="c" width="20">Qty</th><th class="c" width="20">Bonus</th>';
|
||||
}
|
||||
$t_head .= '</tr>' . $t_shead . '</tr>';
|
||||
|
||||
$t_cont = ""; $i_no = 1;
|
||||
foreach ($adata as $_key => $_val) {
|
||||
$t_cont .= '<tr><td class="c">'.$i_no.'</td><td class="c">'.$_val['Tgl_Jual'].'</td><td class="l">'.$_val['No_Jual'].$_val['Kode'].'</td><td class="l">'.$_val['N_Outlet'].'</td><td class="l">'.$_val['A_Outlet'].'</td>';
|
||||
foreach ($aheader as $_skey => $_sval) {
|
||||
$t_cont .= (isset($_val[$_skey])) ? '<td class="r">'.rupiah2($_val[$_skey]['Qty']).'</td><td class="r">'.rupiah2($_val[$_skey]['Bonus']).'</td>' : '<td class="r"> </td><td class="r"> </td>';
|
||||
}
|
||||
$t_cont .= '</tr>';
|
||||
$i_no++;
|
||||
}
|
||||
|
||||
$t_foot = '<tr><td colspan="'.((count($aheader)*2)+5).'" class="nb">'.$pre->get_stamp(1,true).'</td></tr></tbody></table>';
|
||||
echo $t_head . $t_cont . $t_foot;
|
||||
|
||||
} else {
|
||||
if ($id_inv>0) echo "Nama Produk : ".$aproduk['Nama_Produk']."<br>";
|
||||
|
||||
$pre->add_field("NO.",10,"C");
|
||||
$pre->add_field("NAMA PRODUK",120);
|
||||
$pre->add_field("JUMLAH",20,"R","rupiah2");
|
||||
$pre->add_field("SATUAN",20);
|
||||
$pre->show_fields();
|
||||
|
||||
$no = 1; $no_ref = "";
|
||||
while ($db->Next()) {
|
||||
if ($no_ref <> $db->Row("No_Ref")) {
|
||||
$pre->add_span(array(" ",4,"L,NB"));
|
||||
$pre->add_span(array('<table width="100%"><tr><td width="100" class="nb">NO. NOTA</td><td class="nb">: '.$db->Row("No_Ref")." / TANGGAL : ".$db->Row("Tgl_Ref2")." / NO. FAKTUR : ".$db->Row("No_Faktur").'</td></tr><tr><td class="nb">NAMA OUTLET</td><td class="nb">: '.$db->Row("Nama_Outlet").'</td></tr><tr><td class="nb">ALAMAT OUTLET</td><td class="nb">: '.$db->Row("Alamat_Outlet").'</td></tr></table>',4));
|
||||
$no = 1;
|
||||
}
|
||||
$pre->add_value($no++, $db->Row("Nama_Produk"), $db->Row("Qty"), $db->Row("Nama_Satuan"));
|
||||
$no_ref = $db->Row("No_Ref");
|
||||
}
|
||||
}
|
||||
if ($tipe <> "B") {
|
||||
$pre->add_stamp(1, true);
|
||||
$pre->show();
|
||||
}
|
||||
|
||||
} else if ( $data == "export" ) {
|
||||
$xls = new SimpleXLS([
|
||||
'title'=>"Laporan Penjualan ".($tipe=="R"?"Rekap":"Detail")." Penjualan",
|
||||
'subject'=>"PT.PMS",
|
||||
'desc'=>"Export Data dari IAS"
|
||||
]);
|
||||
$xls->add_header("<b>".strtoupper($_SESSION['__WEB_APP']['REG_NAME'])."</b>");
|
||||
|
||||
if ($tipe=="R") {
|
||||
$xls->add_header("<b>LAPORAN REKAP PENJUALAN PRODUK PROMO</b>");
|
||||
$xls->add_header($tglheader);
|
||||
|
||||
$xls->add_field("NO.", 5, "C");
|
||||
$xls->add_field("NAMA PRODUK", 80, "L");
|
||||
$xls->add_field("JUMLAH", 15, "R,N");
|
||||
$xls->add_field("SATUAN", 15, "L");
|
||||
$xls->add_sheet("REKAP PENJUALAN PROMO", false);
|
||||
|
||||
if ($id_inv>0) $xls->add_span(["Nama Produk : ".$aproduk['Nama_Produk'],4,"L"]);
|
||||
$xls->show_headers();
|
||||
|
||||
$no = 1;
|
||||
while ($db->Next()) {
|
||||
$xls->add_value($no++, $db->Row("Nama_Produk"), $db->Row("Qty"), $db->Row("Nama_Satuan"));
|
||||
}
|
||||
|
||||
} else if ($tipe=="B") {
|
||||
$wbook = new Spreadsheet_Excel_Writer();
|
||||
$fjudul =& $wbook->addFormat();
|
||||
$fjudul->setBold();
|
||||
$fjudul->setAlign("center");
|
||||
$fhead =& $wbook->addFormat();
|
||||
$fhead->setBold();
|
||||
$fhead->setAlign("center");
|
||||
$fhead->setVAlign("vcenter");
|
||||
$fhead->setBorder(1);
|
||||
$fhead->setTextWrap();
|
||||
$ftxt =& $wbook->addFormat();
|
||||
$ftxt->setVAlign("top");
|
||||
$ftxt->setTextWrap();
|
||||
$ftxt->setNumFormat("@");
|
||||
$fbtxt =& $wbook->addFormat();
|
||||
$fbtxt->setVAlign("top");
|
||||
$fbtxt->setItalic();
|
||||
$fbtxt->setNumFormat("@");
|
||||
$fnum =& $wbook->addFormat();
|
||||
$fnum->setNumFormat(4);
|
||||
|
||||
$jum_col = (count($aheader)*2) + 5;
|
||||
$baris = 4;
|
||||
|
||||
$wsheet =& $wbook->addWorksheet("DETAIL + BONUS");
|
||||
$wsheet->setColumn(0,0,4);
|
||||
$wsheet->setColumn(1,2,12);
|
||||
$wsheet->setColumn(3,3,20);
|
||||
$wsheet->setColumn(4,4,30);
|
||||
$wsheet->write(0,0,strtoupper($_SESSION['__WEB_APP']['REG_NAME']),$fjudul);
|
||||
$wsheet->setMerge(0,0,0,$jum_col-1);
|
||||
$wsheet->write(1,0,"LAPORAN DETAIL & BONUS PENJUALAN PRODUK PROMO",$fjudul);
|
||||
$wsheet->setMerge(1,0,1,$jum_col-1);
|
||||
$wsheet->write(2,0,"PERIODE : ".$tglheader,$fjudul);
|
||||
$wsheet->setMerge(2,0,2,$jum_col-1);
|
||||
|
||||
if ($id_sales>0 && $id_sales=="NON") {
|
||||
$wsheet->write($baris,0,"NAMA SALES : ".$nama_sales,$ftxt);
|
||||
$wsheet->setMerge($baris,0,$baris,$jum_col-1);
|
||||
$baris++;
|
||||
}
|
||||
|
||||
for ($_x=0;$_x<$jum_col;$_x++) {
|
||||
$wsheet->write($baris,$_x,"",$fhead);
|
||||
$wsheet->write($baris+1,$_x,"",$fhead);
|
||||
}
|
||||
$wsheet->write($baris,0,"No.",$fhead);
|
||||
$wsheet->setMerge($baris,0,$baris+1,0);
|
||||
$wsheet->write($baris,1,"Tanggal",$fhead);
|
||||
$wsheet->setMerge($baris,1,$baris+1,1);
|
||||
$wsheet->write($baris,2,"No. Nota",$fhead);
|
||||
$wsheet->setMerge($baris,2,$baris+1,2);
|
||||
$wsheet->write($baris,3,"Nama Outlet",$fhead);
|
||||
$wsheet->setMerge($baris,3,$baris+1,3);
|
||||
$wsheet->write($baris,4,"Alamat Outlet",$fhead);
|
||||
$wsheet->setMerge($baris,4,$baris+1,4);
|
||||
|
||||
$h_kol = 5;
|
||||
foreach ($aheader as $_key => $_val) {
|
||||
$wsheet->setColumn($h_kol,$h_kol+1,6);
|
||||
$wsheet->write($baris,$h_kol,$_val,$fhead);
|
||||
$wsheet->setMerge($baris,$h_kol,$baris,$h_kol+1);
|
||||
$wsheet->write($baris+1,$h_kol,"Qty",$fhead);
|
||||
$wsheet->write($baris+1,$h_kol+1,"Bonus",$fhead);
|
||||
$h_kol += 2;
|
||||
}
|
||||
$baris += 2;
|
||||
|
||||
$i_no = 1;
|
||||
foreach ($adata as $_key => $_val) {
|
||||
$wsheet->write($baris,0, $i_no, $ftxt);
|
||||
$wsheet->write($baris,1, $_val['Tgl_Jual'], $ftxt);
|
||||
$wsheet->write($baris,2, $_val['No_Jual'].$_val['Kode'], $ftxt);
|
||||
$wsheet->write($baris,3, $_val['N_Outlet'], $ftxt);
|
||||
$wsheet->write($baris,4, $_val['A_Outlet'], $ftxt);
|
||||
|
||||
$h_kol = 5;
|
||||
foreach ($aheader as $_skey => $_sval) {
|
||||
if (isset($_val[$_skey])) {
|
||||
$wsheet->write($baris,$h_kol, $_val[$_skey]['Qty'], $fnum);
|
||||
$wsheet->write($baris,$h_kol+1, $_val[$_skey]['Bonus'], $fnum);
|
||||
} else {
|
||||
$wsheet->write($baris,$h_kol, "", $fnum);
|
||||
$wsheet->write($baris,$h_kol+1, "", $fnum);
|
||||
}
|
||||
$h_kol += 2;
|
||||
}
|
||||
$i_no++;
|
||||
$baris++;
|
||||
}
|
||||
|
||||
$wsheet->write($baris,0,$xls->get_stamp(1,true),$fbtxt);
|
||||
$wbook->send("DATA DETAIL & BONUS PENJUALAN ".tgl_dmy(true).".xls");
|
||||
$wbook->close();
|
||||
|
||||
} else {
|
||||
$xls->add_header("<b>LAPORAN DETAIL PENJUALAN PRODUK PROMO</b>");
|
||||
$xls->add_header($tglheader);
|
||||
|
||||
$xls->add_field("NO.", 5, "C");
|
||||
$xls->add_field("NAMA PRODUK", 80, "L");
|
||||
$xls->add_field("JUMLAH", 15, "R,N");
|
||||
$xls->add_field("SATUAN", 15, "L");
|
||||
$xls->add_sheet("DETAIL PENJUALAN PROMO", false);
|
||||
|
||||
if ($id_inv>0) $xls->add_span(["Nama Produk : ".$aproduk['Nama_Produk'],4,"L"]);
|
||||
$xls->show_headers();
|
||||
|
||||
$no = 1; $no_ref = "";
|
||||
while ($db->Next()) {
|
||||
if ($no_ref <> $db->Row("No_Ref")) {
|
||||
$xls->add_span(array("",4,"L,NL"));
|
||||
$xls->add_span(array("NO. NOTA : ".$db->Row("No_Ref")." / TANGGAL : ".$db->Row("Tgl_Ref2")." / NO. FAKTUR : ".$db->Row("No_Faktur"),4,"L"));
|
||||
$xls->add_span(array("NAMA OUTLET : ".$db->Row("Nama_Outlet"),4,"L"));
|
||||
$xls->add_span(array("ALAMAT OUTLET : ".$db->Row("Alamat_Outlet"),4,"L"));
|
||||
$no = 1;
|
||||
}
|
||||
$xls->add_value($no++, $db->Row("Nama_Produk"), $db->Row("Qty"), $db->Row("Nama_Satuan"));
|
||||
$no_ref = $db->Row("No_Ref");
|
||||
}
|
||||
}
|
||||
$xls->add_stamp(1, true);
|
||||
$xls->send("Laporan Penjualan Produk Promo.xlsx");
|
||||
unset($xls);
|
||||
|
||||
} else if ( $data == "option-produk" ) {
|
||||
$tsql = ($id_grup == 0) ? " Grup_InvID NOT IN ('".$_SESSION['__APP_IAS']['GRUP_PRODUK_KEMASAN']."','".$_SESSION['__APP_IAS']['GRUP_PRODUK_HADIAH']."')" : " Grup_InvID='".$id_grup."'";
|
||||
$aoption = ['type' => "option", 'id' => "InvID", 'value' => 0, 'avalue' => [['value'=>0,'html'=>"SEMUA PRODUK"]]];
|
||||
$db->Query("SELECT * FROM inv_produk WHERE".$tsql." ORDER BY Nama_Produk");
|
||||
while ($db->Next()) {
|
||||
$aoption['avalue'][] = ['value'=>$db->Row("InvID"), 'html'=>$db->Row("Nama_Produk")];
|
||||
}
|
||||
$ajson[] = $aoption;
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$asales = ['SEMUA' => "SEMUA SALES", 'NON' => "TANPA-SALES"];
|
||||
$db->Query("SELECT PegID,Nama_Pegawai FROM para_pegawai WHERE Jenis_PegID='".$_SESSION['__APP_IAS']['GRUP_PEG_SALES']."' ORDER BY Nama_Pegawai");
|
||||
while ($db->Next()){
|
||||
$asales[$db->Row("PegID")] = $db->Row("Nama_Pegawai");
|
||||
}
|
||||
|
||||
$form = new Form($db);
|
||||
$ttipe = $form->radio("_", "Tipe", "R", true, false, ["R"=>"Rekap","D"=>"Detail","B"=>"Detail + Bonus"]);
|
||||
$trekap = $form->radio("_", "Rekap", "X", true, false, ["1"=>"Antar","0"=>"Belum Antar","X"=>"Semua"]);
|
||||
$tsales = $form->option("_", "SalesID", "SEMUA", true, false, $asales);
|
||||
$tgrup = $form->option_db("_", "Grup_InvID", 0, true, false, "inv_produk_grup", ["Grup_InvID","Nama_Grup"], "Grup_InvID NOT IN ('".$_SESSION['__APP_IAS']['GRUP_PRODUK_KEMASAN']."','".$_SESSION['__APP_IAS']['GRUP_PRODUK_HADIAH']."') ORDER BY Nama_Grup", [0,"SEMUA GRUP PRODUK"], null, "RepoRekapPromoJS.oc_Grup();");
|
||||
$tproduk = $form->option("_", "InvID", $id_inv, true, false, []);
|
||||
$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">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Rekap">Status Order</label>
|
||||
<div class="col">'.$trekap.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="SalesID">Nama Sales</label>
|
||||
<div class="col">'.$tsales.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Grup_InvID">Grup Produk</label>
|
||||
<div class="col">'.$tgrup.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="InvID">Nama Produk</label>
|
||||
<div class="col">'.$tproduk.'</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>';
|
||||
|
||||
}
|
||||
|
||||
send_json($ajson);
|
||||
?>
|
||||
@@ -0,0 +1,175 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/rekap_sales.php
|
||||
Desc. : PHP - Laporan R. Penjualan Produk/Sales
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : April 15th, 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;
|
||||
|
||||
function total_kemasan($aval = array()) {
|
||||
$ket_tot = "";
|
||||
foreach ($aval as $key => $val) {
|
||||
if ($val <> 0) $ket_tot .= " / ".uang($val,2)." ".strtoupper($key);
|
||||
}
|
||||
$ket_tot = substr($ket_tot, 3);
|
||||
return $ket_tot;
|
||||
}
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export" ) {
|
||||
$rekap = Param::Get("Rekap"); // X, 1, 0
|
||||
$id_outlet = Param::Get("OutletID", 0);
|
||||
$id_sales = Param::Get("SalesID", 0);
|
||||
$id_grup = Param::Get("Grup_InvID");
|
||||
$tglfrom = Param::Get("Tgl_From");
|
||||
$tglto = Param::Get("Tgl_To");
|
||||
$aoutlet = [];
|
||||
if ($id_outlet > 0) {
|
||||
$db->Query("SELECT * FROM para_outlet WHERE OutletID='".$id_outlet."' LIMIT 1");
|
||||
if ($db->Next()) $aoutlet = $db->AllRow();
|
||||
}
|
||||
$asales = ['Nama_Pegawai'=>"TANPA SALES"];
|
||||
if ($id_sales > 0) {
|
||||
$db->Query("SELECT * FROM para_pegawai WHERE PegID='".$id_sales."' LIMIT 1");
|
||||
if ($db->Next()) $asales = $db->AllRow();
|
||||
}
|
||||
//$nama_grup = ($gprod>0) ? fastQuery("SELECT UPPER(Nama_Grup) Nama FROM inv_produk_grup WHERE Grup_InvID=".$gprod, "") : "";
|
||||
|
||||
// generate report header
|
||||
$tglheader = "Periode : ".$tglfrom;
|
||||
if ($tglfrom!==$tglto) $tglheader .= " S/D ".$tglto;
|
||||
$tglfrom = tgl_sql2str($tglfrom);
|
||||
$tglto = tgl_sql2str($tglto);
|
||||
if ($rekap<>"X") {
|
||||
$tglheader .= ($rekap==0) ? " (STATUS ORDER : NOTA BELUM TERANTAR)" : " (STATUS ORDER : TERANTAR)";
|
||||
}
|
||||
|
||||
$tsql = " AND J.SalesID='".$id_sales."'";
|
||||
$tsql .= ($id_outlet>0) ? " AND J.OutletID='".$id_outlet."'" : "";
|
||||
$tsql .= ($id_grup>0) ? " AND P.Grup_InvID='".$id_grup."'" : " AND P.Grup_InvID<>'".$_SESSION['__APP_IAS']['GRUP_PRODUK_KEMASAN']."' AND P.Grup_InvID<>'".$_SESSION['__APP_IAS']['GRUP_PRODUK_HADIAH']."'";
|
||||
$tsql .= ($rekap<>"X") ? " AND J.Rekap='".intval($rekap)."'" : "";
|
||||
|
||||
$db->Query("SELECT P.Kode_Produk,P.Nama_Produk,SUM(-D.Qty) Qty,SUM(IF(D.Pro_SQ=0,0,-D.Qty)) Pro_SQ,S.Nama_Satuan FROM inv_detail D LEFT JOIN inv_jual J ON (D.No_Ref=J.No_Jual) LEFT JOIN inv_produk P ON (D.InvID=P.InvID) LEFT JOIN para_satuan S ON (D.SatuanID=S.SatuanID) WHERE J.Data_Jual=1 AND (J.Tgl_Jual BETWEEN '".$tglfrom."' AND '".$tglto."')".$tsql." GROUP BY D.InvID, D.SatuanID ORDER BY P.Nama_Produk");
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN REKAP PENJUALAN PRODUK PER-SALES", $tglheader);
|
||||
echo "NAMA SALES : ".$asales['Nama_Pegawai'];
|
||||
if ($id_outlet>0) echo "<br>NAMA OUTLET : ".$aoutlet['Nama_Outlet'];
|
||||
if ($id_grup>0) echo "<br>NAMA GRUP PRODUK : ".$nama_grup;
|
||||
|
||||
$pre = new PrintHTML();
|
||||
$pre->set_css("garis");
|
||||
$pre->add_field("No.",10,"C");
|
||||
$pre->add_field("Kode",10);
|
||||
$pre->add_field("Nama Produk",80);
|
||||
$pre->add_field("Satuan",10);
|
||||
$pre->add_field("Jumlah",20,"R","rupiah2");
|
||||
$pre->add_field("Promo",20,"R","rupiah2");
|
||||
$pre->add_field("Total",20,"R","rupiah2");
|
||||
$pre->show_fields();
|
||||
|
||||
$nomor = 0; $atot = $abon = $anet = array();
|
||||
while ($db->Next()) {
|
||||
$nomor++;
|
||||
$pre->add_value($nomor, $db->Row("Kode_Produk"), $db->Row("Nama_Produk"), $db->Row("Nama_Satuan"), $db->Row("Qty")-$db->Row("Pro_SQ"), $db->Row("Pro_SQ"), $db->Row("Qty"));
|
||||
$atot[$db->Row("Nama_Satuan")] += $db->Row("Qty")-$db->Row("Pro_SQ");
|
||||
$abon[$db->Row("Nama_Satuan")] += $db->Row("Pro_SQ");
|
||||
$anet[$db->Row("Nama_Satuan")] += $db->Row("Qty");
|
||||
}
|
||||
$pre->add_span(array("TOTAL PENJUALAN",4,"R,B"),array(total_kemasan($atot),1,"R,B"),array(total_kemasan($abon),1,"R,B"),array(total_kemasan($anet),1,"R,B"));
|
||||
$pre->add_stamp(1, true);
|
||||
$pre->show();
|
||||
|
||||
} else if ( $data == "brow-outlet" ) {
|
||||
$tcari = trim(Param::Get("Cari_Outlet"));
|
||||
$tsql = ($tcari=="") ? " LIMIT 100" : " AND CONCAT(Nama_Outlet,Telp_Outlet,Nama_Outlet) LIKE '%".$tcari."%'";
|
||||
|
||||
$obj = new Table($db);
|
||||
$obj->set_query("SELECT * FROM vi_para_outlet WHERE Aktif=1".$tsql);
|
||||
$obj->add_field("OutletID", "ID", "hid");
|
||||
$obj->add_field("Kode_Outlet", "Kode", "c");
|
||||
$obj->add_field("Nama_Alamat", "Nama Outlet", "awr");
|
||||
$obj->add_field("Alamat_Kota", "Alamat & Kota", "awr");
|
||||
$obj->set_field_order("Nama_Outlet", "A");
|
||||
$obj->add_row_btn("save", "Pilih", "RepoRekapSalesJS.outlet_select");
|
||||
$obj->set_func_navi("RepoRekapSalesJS.data_query('brow-outlet')");
|
||||
$ajson[] = $obj->json_table("divBrowOutlet");
|
||||
|
||||
} else if ( $data == "auto-outlet" ) {
|
||||
$tcari = Param::Get("Auto_Query");
|
||||
$ajson['autodata'] = [['value' => 0, 'text' => "SEMUA OUTLET", 'data' => ""]];
|
||||
if (is_string($tcari) && strlen($tcari) < 64) {
|
||||
$db->Query("SELECT * FROM vi_para_outlet WHERE Aktif=1 AND CONCAT(Nama_Outlet,Alamat_Outlet) LIKE '%".$tcari."%' ORDER BY Nama_Outlet LIMIT 50");
|
||||
while ($db->Next()) {
|
||||
$ajson['autodata'][] = ['value'=>$db->Row("OutletID"), 'text'=>$db->Row("Nama_Alamat"), 'data'=>$db->Row("Alamat_Kota")];
|
||||
}
|
||||
}
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$asales = ['NON' => "TANPA-SALES"];
|
||||
$db->Query("SELECT PegID,Nama_Pegawai FROM para_pegawai WHERE Jenis_PegID='".$_SESSION['__APP_IAS']['GRUP_PEG_SALES']."' ORDER BY Nama_Pegawai");
|
||||
while ($db->Next()){
|
||||
$asales[$db->Row("PegID")] = $db->Row("Nama_Pegawai");
|
||||
}
|
||||
|
||||
$form = new Form($db);
|
||||
$trekap = $form->radio("_", "Rekap", "X", true, false, ["1"=>"Antar","0"=>"Belum Antar","X"=>"Semua"]);
|
||||
$toutlet = $form->textauto("_", "Nama_Outlet", ['value'=>0,'text'=>"SEMUA OUTLET"], true, false);
|
||||
$tsales = $form->option("_", "SalesID", "SEMUA", true, false, $asales);
|
||||
$tgrup = $form->option_db("_", "Grup_InvID", 0, true, false, "inv_produk_grup", ["Grup_InvID","Nama_Grup"], "TRUE ORDER BY Nama_Grup", [0,"SEMUA GRUP"]);
|
||||
$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="Rekap">Status Order</label>
|
||||
<div class="col">'.$trekap.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Nama_Outlet">Nama Outlet</label>
|
||||
<div class="col"><div class="input-group">'.$toutlet.'<button class="btn btn-info" type="button" onclick="RepoRekapSalesJS.outlet_brow();"><i class="bi-search"></i></button></div></div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="SalesID">Nama Sales</label>
|
||||
<div class="col">'.$tsales.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Grup_InvID">Grup Produk</label>
|
||||
<div class="col">'.$tgrup.'</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>
|
||||
<input type="hidden" id="OutletID" value="0">';
|
||||
|
||||
}
|
||||
|
||||
send_json($ajson);
|
||||
?>
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/rekap_sup.php
|
||||
Desc. : PHP - Laporan Rekap Pembelian / Supplier
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : March 5th, 2012.
|
||||
Last Modified : November 18th, 2023.
|
||||
|
||||
(c) 2012 - 2023, 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\Form;
|
||||
use siaupheng\fonia3\Data\SimpleXLS;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export" ) {
|
||||
$id_sup = Param::Get("SupID", 0);
|
||||
$id_grup = Param::Get("Grup_InvID", 0);
|
||||
$tglfrom = Param::Get("Tgl_From");
|
||||
$tglto = Param::Get("Tgl_To");
|
||||
$asup = []; $agrup = [];
|
||||
if ($id_sup > 0) {
|
||||
$db->Query("SELECT * FROM para_supplier WHERE SupID='".$id_sup."' LIMIT 1");
|
||||
if ($db->Next()) $asup = $db->AllRow();
|
||||
}
|
||||
if ($id_grup > 0) {
|
||||
$db->Query("SELECT * FROM inv_produk_grup WHERE Grup_InvID='".$id_grup."' LIMIT 1");
|
||||
if ($db->Next()) $agrup = $db->AllRow();
|
||||
}
|
||||
|
||||
// generate report header
|
||||
$tglheader = "Periode : ".$tglfrom;
|
||||
if ($tglfrom!==$tglto) $tglheader .= " s/d ".$tglto;
|
||||
$tglfrom = tgl_sql2str($tglfrom);
|
||||
$tglto = tgl_sql2str($tglto);
|
||||
|
||||
$tsql = ($id_sup>0) ? " AND SupID='".$id_sup."'" : "";
|
||||
$tsql2 = ($id_grup>0) ? " AND P.Grup_InvID='".$id_grup."'" : "";
|
||||
|
||||
// query data laporan
|
||||
$db->Query("SELECT D.*,P.Kode_Produk,P.Nama_Produk,S.Nama_Satuan FROM (SELECT InvID,SatuanID,SUM(Qty) Qty FROM inv_detail WHERE No_Ref IN (SELECT No_Beli FROM inv_beli WHERE Data_Beli=1 AND (Tgl_Beli BETWEEN '".$tglfrom."' AND '".$tglto."')".$tsql.") GROUP BY InvID,SatuanID) D LEFT JOIN inv_produk P ON (D.InvID=P.InvID) LEFT JOIN para_satuan S ON (D.SatuanID=S.SatuanID) ORDER BY P.Nama_Produk");
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN REKAP PEMBELIAN PRODUK PER-SUPPLIER", $tglheader);
|
||||
|
||||
if ($id_sup>0) $header .= "Nama Supplier : ".$asup['Nama_Sup'];
|
||||
if ($id_grup>0) $header .= "Nama Grup Produk : ".$agrup['Nama_Grup'];
|
||||
$header .= '<table class="garis"><thead><tr><th>No.</th><th>Kode</th><th>Nama Produk</th><th>Jumlah</th><th>Satuan</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="c">%s</td><td class="c">%s</td><td>%s</td><td class="r">%s</td><td>%s</td></tr>';
|
||||
$_sline = '<tr><td class="c b" colspan="2">%s</td><td class="r b" colspan="3">%s</td></tr>';
|
||||
|
||||
$body = ''; $nomor = 0; $atot = [];
|
||||
while ($db->Next()) {
|
||||
$atot[$db->Row("Nama_Satuan")] += $db->Row("Qty");
|
||||
$body .= sprintf($_line, ++$nomor, $db->Row("Kode_Produk"), $db->Row("Nama_Produk"), rupiah2($db->Row("Qty")), $db->Row("Nama_Satuan"));
|
||||
}
|
||||
$ket_tot = "";
|
||||
foreach ($atot as $key => $val) {
|
||||
if ($val > 0) $ket_tot .= " / ".rupiah2($val,2)." ".strtoupper($key);
|
||||
}
|
||||
$ket_tot = substr($ket_tot, 3);
|
||||
$body .= sprintf($_sline, "Jumlah", $ket_tot);
|
||||
|
||||
echo $header . $body . "</tbody></table>" . Report_Stamp(1, true);
|
||||
|
||||
} else if ( $data == "export" ) {
|
||||
$xls = new SimpleXLS([
|
||||
'title'=>"Laporan Rekap Pembelian Produk Per-Supplier",
|
||||
'subject'=>"PT.PMS",
|
||||
'desc'=>"Export Data dari IAS"
|
||||
]);
|
||||
$xls->add_header("<b>".strtoupper($_SESSION['__WEB_APP']['REG_NAME'])."</b>");
|
||||
$xls->add_header("<b>LAPORAN REKAP PEMBELIAN PRODUK PER-SUPPLIER</b>");
|
||||
$xls->add_header($tglheader);
|
||||
|
||||
$xls->add_field("NO.", 10, "C");
|
||||
$xls->add_field("KODE", 25, "L");
|
||||
$xls->add_field("NAMA PRODUK", 80, "L");
|
||||
$xls->add_field("JUMLAH", 20, "R,N");
|
||||
$xls->add_field("SATUAN", 12, "L");
|
||||
$xls->add_sheet("R-BELI-SUP", false);
|
||||
|
||||
if ($id_sup>0) $xls->add_span(["Nama Supplier : ".$asup['Nama_Sup'],5,"L"]);
|
||||
if ($id_grup>0) $xls->add_span(["Nama Grup Produk : ".$agrup['Nama_Grup'],5,"L"]);
|
||||
$xls->show_headers();
|
||||
|
||||
$nomor = 0; $atot = [];
|
||||
while ($db->Next()) {
|
||||
$xls->add_value(++$nomor, $db->Row("Kode_Produk"), $db->Row("Nama_Produk"), uang($db->Row("Qty"),2), $db->Row("Nama_Satuan"));
|
||||
$atot[$db->Row("Nama_Satuan")] += $db->Row("Qty");
|
||||
}
|
||||
$ket_tot = "";
|
||||
foreach ($atot as $key => $val) {
|
||||
if ($val > 0) $ket_tot .= " / ".uang($val,2)." ".strtoupper($key);
|
||||
}
|
||||
$ket_tot = substr($ket_tot, 3);
|
||||
$xls->add_span(["Jumlah",2,"L,B"],[$ket_tot,3,"C,B"]);
|
||||
$xls->add_stamp(1, true);
|
||||
$xls->send("Laporan Rekap Pembelian Produk Per-Supplier.xlsx");
|
||||
unset($xls);
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$form = new Form($db);
|
||||
$form->option_db("Nama Supplier", "SupID", 0, true, false, "para_supplier", ["SupID","Nama_Sup"], "TRUE ORDER BY Nama_Sup", [0,"SEMUA SUPPLIER"]);
|
||||
$form->option_db("Grup Produk", "Grup_InvID", 0, true, false, "inv_produk_grup", ["Grup_InvID","Nama_Grup"], "TRUE ORDER BY Nama_Grup", [0,"SEMUA GRUP PRODUK"]);
|
||||
$form->datebox("Dari Tanggal", "Tgl_From", tgl_ymd(), true, false);
|
||||
$form->datebox("Sampai Tanggal", "Tgl_To", tgl_ymd(), true, false);
|
||||
$form->show(' _SupID_ _Grup_InvID_ _Tgl_From_ _Tgl_To_ ');
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/stok_akhir.php
|
||||
Desc. : PHP - Laporan Stok Akhir Produk
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : January 24th, 2011.
|
||||
Last Modified : November 18th, 2023.
|
||||
|
||||
(c) 2011 - 2023, 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;
|
||||
use siaupheng\fonia3\Data\SimpleXLS;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export" ) {
|
||||
$id_gudang = Param::Get("GudangID", 0);
|
||||
$tgldata = Param::Get("Tgl_Data");
|
||||
|
||||
$agudang = [];
|
||||
if ($id_gudang>0) {
|
||||
$db->Query("SELECT * FROM para_gudang WHERE GudangID='".$id_gudang."' LIMIT 1");
|
||||
if ($db->Next()) $agudang = $db->AllRow();
|
||||
}
|
||||
|
||||
// generate report header
|
||||
$tglheader = "Periode : ".$tgldata;
|
||||
$tgldata = tgl_sql2str($tgldata);
|
||||
$tsql = ($id_gudang==0) ? "" : " AND GudangID='".$id_gudang."'";
|
||||
|
||||
$db->Query("SELECT P.Kode_Produk,P.Nama_Produk,P.Satuan_Normal,P.Satuan_Stok,D.Jumlah,S.Qty Kali FROM (SELECT InvID,SUM(Stok) Jumlah FROM inv_detail WHERE NotaID<>5 OR (NotaID=5 AND Promo=0 AND No_Ref IN (SELECT No_Jual FROM inv_jual WHERE Data_Jual=1 AND Rekap=1)) AND Tgl_Ref<>'0000-00-00' AND Tgl_Ref<='".$tgldata."'".$tsql." GROUP BY InvID) D LEFT JOIN vi_inv_produk P ON (P.InvID=D.InvID) LEFT JOIN inv_produk_kemasan S ON (S.InvID=P.InvID AND S.SatuanID=P.NormalID) WHERE P.Nama_Produk IS NOT NULL ORDER BY P.Grup_InvID,P.Nama_Produk");
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN STOK PRODUK", $tglheader);
|
||||
$pre = new PrintHTML();
|
||||
$pre->set_css("garis");
|
||||
|
||||
if ($id_gudang>0) echo "Nama Gudang : ".$agudang['Nama_Gudang']."<br>";
|
||||
|
||||
$pre->add_field("NO",10,"C");
|
||||
$pre->add_field("KODE",20);
|
||||
$pre->add_field("NAMA PRODUK",200);
|
||||
$pre->add_field("STOK",80,"R");
|
||||
$pre->show_fields();
|
||||
|
||||
$nomor = 1;
|
||||
while ($db->Next()) {
|
||||
$total = $db->Row("Jumlah",0);
|
||||
$kali = $db->Row("Kali",0);
|
||||
$sat_norm = $db->Row("Satuan_Normal");
|
||||
$sat_stok = $db->Row("Satuan_Stok");
|
||||
$pre->add_value($nomor++, $db->Row("Kode_Produk"), $db->Row("Nama_Produk"), Format_Stok($total, $kali, $sat_norm, $sat_stok));
|
||||
}
|
||||
$pre->add_stamp(0, true);
|
||||
$pre->show();
|
||||
|
||||
} else if ( $data == "export" ) {
|
||||
$xls = new SimpleXLS([
|
||||
'title'=>"Laporan Stok Produk",
|
||||
'subject'=>"PT.PMS",
|
||||
'desc'=>"Export Data dari IAS"
|
||||
]);
|
||||
$xls->add_header("<b>".strtoupper($_SESSION['__WEB_APP']['REG_NAME'])."</b>");
|
||||
$xls->add_header("<b>LAPORAN STOK PRODUK</b>");
|
||||
$xls->add_header($tglheader);
|
||||
|
||||
$xls->add_field("NO.", 5, "C");
|
||||
$xls->add_field("KODE", 12, "L");
|
||||
$xls->add_field("NAMA PRODUK", 50, "L");
|
||||
$xls->add_field("STOK", 22, "R");
|
||||
$xls->add_sheet("STOK AKHIR", false);
|
||||
|
||||
if ($id_gudang>0) $xls->add_span(["Nama Gudang : ".$agudang['Nama_Gudang'],4,"L"]);
|
||||
$xls->show_headers();
|
||||
|
||||
$nomor = 1;
|
||||
while ($db->Next()) {
|
||||
$total = $db->Row("Jumlah",0);
|
||||
$kali = $db->Row("Kali",0);
|
||||
$sat_norm = $db->Row("Satuan_Normal");
|
||||
$sat_stok = $db->Row("Satuan_Stok");
|
||||
$xls->add_value($nomor++, $db->Row("Kode_Produk"), $db->Row("Nama_Produk"), Format_Stok($total, $kali, $sat_norm, $sat_stok));
|
||||
}
|
||||
$xls->add_stamp(1, true);
|
||||
$xls->send("Laporan Stok Produk.xlsx");
|
||||
unset($xls);
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$form = new Form($db);
|
||||
$tgudang = $form->option_db("_", "GudangID", 0, true, false, "para_gudang", ["GudangID","Nama_Gudang"], "TRUE ORDER BY Nama_Gudang", [0,"SEMUA GUDANG"]);
|
||||
$ttgldata = $form->datebox("_", "Tgl_Data", tgl_ymd(), true, false);
|
||||
echo '
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="GudangID">Nama Gudang</label>
|
||||
<div class="col">'.$tgudang.'</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_Data">Tanggal Stok</label>
|
||||
<div class="col">'.$ttgldata.'</div>
|
||||
</div>';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/stok_mutasi.php
|
||||
Desc. : PHP - Laporan Mutasi Stok Produk
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : July 16th, 2011.
|
||||
Last Modified : November 18th, 2023.
|
||||
|
||||
(c) 2011 - 2023, 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;
|
||||
use siaupheng\fonia3\Data\SimpleXLS;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export" ) {
|
||||
$tipe = Param::Get("Tipe_Data"); // X:Semua, B:Beli, J:Jual
|
||||
$jenis = Param::Get("Nota_Pajak", 1); // 1:No_Faktur, 2:No_Pajak
|
||||
$id_gudang = Param::Get("GudangID", 0);
|
||||
$id_inv = Param::Get("InvID");
|
||||
$tglfrom = Param::Get("Tgl_From");
|
||||
$tglto = Param::Get("Tgl_To");
|
||||
$agudang = []; $aproduk = [];
|
||||
if ($id_gudang > 0) {
|
||||
$db->Query("SELECT * FROM para_gudang WHERE GudangID='".$id_gudang."' LIMIT 1");
|
||||
if ($db->Next()) $agudang = $db->AllRow();
|
||||
}
|
||||
if ($id_inv > 0) {
|
||||
$db->Query("SELECT CONCAT('[',Kode_Produk,'] ',Nama_Produk,' (',Satuan_Normal,')') Nama_Produk FROM vi_inv_produk WHERE InvID='".$id_inv."' LIMIT 1");
|
||||
if ($db->Next()) $aproduk = $db->AllRow();
|
||||
}
|
||||
|
||||
// generate report header
|
||||
$tglheader = "Periode : ".$tglfrom;
|
||||
if ($tglfrom!==$tglto) $tglheader .= " S/D ".$tglto;
|
||||
$tglfrom = tgl_sql2str($tglfrom);
|
||||
$tglto = tgl_sql2str($tglto);
|
||||
|
||||
$tsql = ($id_gudang==0) ? " AND D.NotaID<>2" : " AND D.GudangID='".$id_gudang."'";
|
||||
$tord = ($jenis==1) ? ",No_Faktur" : ",No_Pajak";
|
||||
|
||||
// query ukuran normal produk & stok awal
|
||||
$db->Query("SELECT P.Satuan_Stok,P.Satuan_Normal,S.Qty Kali FROM (SELECT * FROM vi_inv_produk WHERE InvID='".$id_inv."') P LEFT JOIN inv_produk_kemasan S ON (S.InvID=P.InvID AND S.SatuanID=P.NormalID)");
|
||||
if ($db->Next()) $ainfo = $db->AllRow();
|
||||
$stok = 0;
|
||||
$db->Query("SELECT SUM(D.Stok) Stok FROM inv_detail D LEFT JOIN inv_jual J ON (J.No_Jual=D.No_Ref) WHERE D.Tgl_Ref<>'0000-00-00' AND D.Tgl_Ref<'".$tglfrom."'".$tsql." AND D.InvID='".$id_inv."' AND (D.NotaID<>5 OR (D.NotaID=5 AND J.Rekap=1 AND D.Promo=0))");
|
||||
if ($db->Next()) $stok = $db->Row("Stok", 0);
|
||||
|
||||
if ($tipe == "X") {
|
||||
$tsql .= " AND (D.NotaID<>5 OR (D.NotaID=5 AND J.Rekap=1 AND D.Promo=0))";
|
||||
} else {
|
||||
$tsql .= ($tipe == "B") ? " AND D.NotaID=3" : " AND (D.NotaID=5 AND J.Rekap=1 AND D.Promo=0)";
|
||||
}
|
||||
|
||||
$db->Query("SELECT DATE_FORMAT(D.Tgl_Ref,'%d-%m-%Y') Tgl_Ref2,D.No_Ref,SUM(IF(D.Stok<0,-D.Stok,0)) Keluar,SUM(IF(D.Stok>0,D.Stok,0)) Masuk, IF(ISNULL(B.No_Faktur),J.No_Faktur,B.No_Faktur) No_Faktur, IF(ISNULL(B.No_Pajak),J.No_Pajak,B.No_Pajak) No_Pajak, IF(ISNULL(S.Nama_Sup),T.Nama_Outlet,S.Nama_Sup) Nama FROM inv_detail D LEFT JOIN inv_beli B ON (B.No_Beli=D.No_Ref) LEFT JOIN inv_jual J ON (J.No_Jual=D.No_Ref) LEFT JOIN inv_opname O ON (O.No_Opname=D.No_Ref) LEFT JOIN inv_mutasi M ON (M.No_Mutasi=D.No_Ref) LEFT JOIN para_supplier S ON (S.SupID=B.SupID) LEFT JOIN para_outlet T ON (T.OutletID=J.OutletID) LEFT JOIN para_nota N ON (D.NotaID=N.NotaID) WHERE (D.Tgl_Ref BETWEEN '".$tglfrom."' AND '".$tglto."')".$tsql." AND D.InvID='".$id_inv."' AND D.Stok<>0 GROUP BY D.No_Ref,D.InvID ORDER BY D.Tgl_Ref,N.Urut,D.No_Ref".$tord);
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN MUTASI STOK PRODUK", $tglheader);
|
||||
$pre = new PrintHTML();
|
||||
$pre->set_css("garis");
|
||||
|
||||
echo "Nama Produk : ".$aproduk['Nama_Produk']."<br>";
|
||||
if ($id_gudang>0) echo "Nama Gudang : ".$agudang['Nama_Gudang']."<br>";
|
||||
|
||||
$pre->add_field("TANGGAL",20,"C");
|
||||
$pre->add_field("NO. NOTA",20);
|
||||
$pre->add_field("NO. FAKTUR",100);
|
||||
$pre->add_field("NAMA SUPPLIER / OUTLET",300);
|
||||
$pre->add_field("MASUK",160,"R");
|
||||
$pre->add_field("KELUAR",160,"R");
|
||||
$pre->add_field("STOK",160,"R");
|
||||
$pre->show_fields();
|
||||
|
||||
$tot_m = 0; $tot_k = 0;
|
||||
$pre->add_span(array("STOK AWAL",4,"R"),array("",1,"R"),array("",1,"R"),array(Format_Stok($stok,$ainfo['Kali'],$ainfo['Satuan_Normal'],$ainfo['Satuan_Stok']),1,"R"));
|
||||
while ($db->Next()) {
|
||||
$msk = $db->Row("Masuk");
|
||||
$klr = $db->Row("Keluar");
|
||||
$stok += $msk - $klr;
|
||||
$tot_m += $msk;
|
||||
$tot_k += $klr;
|
||||
$pre->add_value($db->Row("Tgl_Ref2"), $db->Row("No_Ref"), (($jenis==1)?$db->Row("No_Faktur"):$db->Row("No_Pajak")), $db->Row("Nama"), (($msk>0)?Format_Stok($msk,$ainfo['Kali'],$ainfo['Satuan_Normal'],$ainfo['Satuan_Stok']):""), (($klr>0)?Format_Stok($klr,$ainfo['Kali'],$ainfo['Satuan_Normal'],$ainfo['Satuan_Stok']):""), Format_Stok($stok,$ainfo['Kali'],$ainfo['Satuan_Normal'],$ainfo['Satuan_Stok']));
|
||||
}
|
||||
$pre->add_span(array("STOK AKHIR",4,"R"),array(Format_Stok($tot_m,$ainfo['Kali'],$ainfo['Satuan_Normal'],$ainfo['Satuan_Stok']),1,"R"),array(Format_Stok($tot_k,$ainfo['Kali'],$ainfo['Satuan_Normal'],$ainfo['Satuan_Stok']),1,"R"),array(Format_Stok($stok,$ainfo['Kali'],$ainfo['Satuan_Normal'],$ainfo['Satuan_Stok']),1,"R"));
|
||||
$pre->add_stamp(0, true);
|
||||
$pre->show();
|
||||
|
||||
} else if ( $data == "export" ) {
|
||||
$xls = new SimpleXLS([
|
||||
'title'=>"Laporan Mutasi Stok Produk",
|
||||
'subject'=>"PT.PMS",
|
||||
'desc'=>"Export Data dari IAS"
|
||||
]);
|
||||
$xls->add_header("<b>".strtoupper($_SESSION['__WEB_APP']['REG_NAME'])."</b>");
|
||||
$xls->add_header("<b>LAPORAN MUTASI STOK PRODUK</b>");
|
||||
$xls->add_header($aproduk['Nama_Produk']);
|
||||
$xls->add_header($tglheader);
|
||||
|
||||
$xls->add_field("TANGGAL", 12, "C");
|
||||
$xls->add_field("NO. NOTA", 14, "L");
|
||||
$xls->add_field("NO. FAKTUR", 14, "L");
|
||||
$xls->add_field("NAMA SUPPLIER / OUTLET", 60, "L");
|
||||
$xls->add_field("MASUK", 20, "R");
|
||||
$xls->add_field("KELUAR", 20, "R");
|
||||
$xls->add_field("STOK", 20, "R");
|
||||
$xls->add_sheet("MUTASI STOK", false);
|
||||
|
||||
if ($id_gudang>0) $xls->add_span(["Nama Gudang",3,"L"],[$agudang['Nama_Gudang'],4]);
|
||||
$xls->show_headers();
|
||||
|
||||
$tot_m = 0; $tot_k = 0;
|
||||
$xls->add_span(["STOK AWAL",4,"R,B"],["",1,"R,B"],["",1,"R,B"],[Format_Stok($stok,$ainfo['Kali'],$ainfo['Satuan_Normal'],$ainfo['Satuan_Stok']),1,"R,B"]);
|
||||
while ($db->Next()) {
|
||||
$msk = $db->Row("Masuk");
|
||||
$klr = $db->Row("Keluar");
|
||||
$stok += $msk - $klr;
|
||||
$tot_m += $msk;
|
||||
$tot_k += $klr;
|
||||
$xls->add_value($db->Row("Tgl_Ref2"), $db->Row("No_Ref"), (($jenis==1)?$db->Row("No_Faktur"):$db->Row("No_Pajak")), $db->Row("Nama"), (($msk>0)?Format_Stok($msk,$ainfo['Kali'],$ainfo['Satuan_Normal'],$ainfo['Satuan_Stok']):""), (($klr>0)?Format_Stok($klr,$ainfo['Kali'],$ainfo['Satuan_Normal'],$ainfo['Satuan_Stok']):""), Format_Stok($stok,$ainfo['Kali'],$ainfo['Satuan_Normal'],$ainfo['Satuan_Stok']));
|
||||
}
|
||||
$xls->add_span(array("STOK AKHIR",4,"R,B"),array(Format_Stok($tot_m,$ainfo['Kali'],$ainfo['Satuan_Normal'],$ainfo['Satuan_Stok']),1,"R,B"),array(Format_Stok($tot_k,$ainfo['Kali'],$ainfo['Satuan_Normal'],$ainfo['Satuan_Stok']),1,"R,B"),array(Format_Stok($stok,$ainfo['Kali'],$ainfo['Satuan_Normal'],$ainfo['Satuan_Stok']),1,"R,B"));
|
||||
$xls->add_stamp(1, true);
|
||||
$xls->send("Laporan Mutasi Stok Produk.xlsx");
|
||||
unset($xls);
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$form = new Form($db);
|
||||
$ttipe = $form->radio("_", "Tipe_Data", "X", true, false, ["X"=>"Semua","B"=>"Pembelian","J"=>"Penjualan"]);
|
||||
$tnota = $form->radio("_", "Nota_Pajak", 1, true, false, [1=>"Nota Jual",2=>"Faktur Pajak"]);
|
||||
$tgudang = $form->option_db("_", "GudangID", 0, true, false, "para_gudang", ["GudangID","Nama_Gudang"], "TRUE ORDER BY Nama_Gudang", [0,"SEMUA GUDANG"]);
|
||||
$tproduk = $form->option_db("_", "InvID", 0, true, false, "inv_produk", ["InvID","Nama_Produk"], "TRUE ORDER BY Nama_Produk");
|
||||
$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_Data">Jenis Transaksi</label>
|
||||
<div class="col">'.$ttipe.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="Nota_Pajak">Jenis Informasi</label>
|
||||
<div class="col">'.$tnota.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="GudangID">Nama Gudang</label>
|
||||
<div class="col">'.$tgud.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-5 col-lg-3 col-form-label" for="InvID">Nama Produk</label>
|
||||
<div class="col">'.$tproduk.'</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>';
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
Module : /apps/php/repo/supervisi.php
|
||||
Desc. : PHP - Laporan Supervisi
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : June 1st, 2013.
|
||||
Last Modified : March 26th, 2023.
|
||||
|
||||
(c) 2013 - 2023, 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\Form;
|
||||
|
||||
$db = (is_resource($db)) ? $db : new MySQL();
|
||||
$ajson = [];
|
||||
$data = Param::Get("data");
|
||||
|
||||
if ( $data == "print" || $data == "export") {
|
||||
$id_user = Param::Get("UserID", 0);
|
||||
$tgl_from = Param::Get("Tgl_From");
|
||||
$tgl_to = Param::Get("Tgl_To");
|
||||
$auser = [];
|
||||
if ($id_user>0) {
|
||||
$db->Query("SELECT Nama FROM app_operator WHERE UserID='".$id_user."'");
|
||||
if ($db->Next()) $auser = $db->AllRow();
|
||||
}
|
||||
|
||||
// generate report header
|
||||
$tglheader = "Periode : ".$tgl_from;
|
||||
if ($tgl_from!==$tgl_to) $tglheader .= " s/d ".$tgl_to;
|
||||
$tgl_from = tgl_sql2str($tgl_from);
|
||||
$tgl_to = tgl_sql2str($tgl_to);
|
||||
|
||||
// query data laporan
|
||||
$tsql = ($id_user>0) ? " AND UserID='".$id_user."'" : " AND UserID>1";
|
||||
$db->Query("SELECT UPPER(O.Nama) Nama_User,UPPER(M.Judul) Menu,DATE_FORMAT(A.Tanggal,'%d-%m-%Y %H:%i:%s') Tanggal2,A.Catatan,UPPER(S.Nama) Nama_Super FROM (SELECT * FROM app_auth WHERE Auth=1 AND (Tanggal BETWEEN '".$tgl_from." 00:00:00' AND '".$tgl_to." 23:59:59')".$tsql.") A LEFT JOIN app_operator O ON (O.UserID=A.UserID) LEFT JOIN app_operator S ON (S.UserID=A.SuperID) LEFT JOIN app_menu M ON (M.Kode=A.Kode) ORDER BY A.Tanggal");
|
||||
}
|
||||
|
||||
if ( $data == "print" ) {
|
||||
Report_Header("LAPORAN SUPERVISI APLIKASI", $tglheader);
|
||||
|
||||
if ($id_user>0) $header = '<p>Nama Pengguna : '.$auser['Nama'].'</p>';
|
||||
$header .= '<table class="garis"><thead><tr><th>No.</th><th>Tanggal / Jam</th><th>Menu Aplikasi</th><th>Catatan</th><th>Operator</th><th>Supervisi</th></tr></thead><tbody>';
|
||||
$_line = '<tr><td class="c">%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>';
|
||||
|
||||
$body = ''; $nomor = 1;
|
||||
while ($db->Next()) {
|
||||
$body .= sprintf($_line, $nomor++, $db->Row("Tanggal2"), $db->Row("Menu"), $db->Row("Catatan"), $db->Row("Nama_User"), $db->Row("Nama_Super"));
|
||||
}
|
||||
|
||||
echo $header . $body . "</tbody></table>" . Report_Stamp(1, true);
|
||||
|
||||
} else if ( $data == "export" ) {
|
||||
\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder() );
|
||||
|
||||
$styleTxt = [
|
||||
'numberFormat' => ['formatCode' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_TEXT]
|
||||
];
|
||||
$styleNum = [
|
||||
'numberFormat' => ['formatCode' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2]
|
||||
];
|
||||
|
||||
$ssheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||
$ssheet->getProperties()
|
||||
->setCreator($_SESSION['__WEB_APP']['APP_NAME']." v".$_SESSION['__WEB_APP']['APP_VER'])
|
||||
->setLastModifiedBy($_SESSION['__WEB_APP']['APP_NAME']." v".$_SESSION['__WEB_APP']['APP_VER'])
|
||||
->setTitle("Data Supervisi")
|
||||
->setCompany($_SESSION['__WEB_APP']['REG_NAME']);
|
||||
$sheet = $ssheet->getActiveSheet();
|
||||
$sheet->setTitle("Data Supervisi");
|
||||
|
||||
// header
|
||||
$styleHeader = [
|
||||
'font' => ['bold' => true],
|
||||
'alignment' => ['horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER]
|
||||
];
|
||||
$sheet->setCellValue("A1", strtoupper($_SESSION['__WEB_APP']['REG_NAME']));
|
||||
$sheet->mergeCells('A1:F1');
|
||||
$sheet->setCellValue("A2", "LAPORAN SUPERVISI APLIKASI");
|
||||
$sheet->mergeCells('A2:F2');
|
||||
$sheet->setCellValue("A3", $tglheader);
|
||||
$sheet->mergeCells('A3:F3');
|
||||
$sheet->getStyle('A1:F3')->applyFromArray($styleHeader);
|
||||
|
||||
// table header
|
||||
$sheet->getColumnDimension('A')->setWidth(8);
|
||||
$sheet->getColumnDimension('B')->setWidth(25);
|
||||
$sheet->getColumnDimension('C')->setWidth(80);
|
||||
$sheet->getColumnDimension('D')->setWidth(25);
|
||||
$sheet->getColumnDimension('E')->setWidth(15);
|
||||
$sheet->getColumnDimension('F')->setWidth(15);
|
||||
|
||||
$baris = 5;
|
||||
if ($id_user>0) {
|
||||
$sheet->setCellValue("A".$baris, "Nama Pengguna : ".$auser['Nama']);
|
||||
$baris++;
|
||||
}
|
||||
|
||||
$styleTableH = [
|
||||
'font' => ['bold' => true],
|
||||
'alignment' => ['horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER, 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, 'wrapText' => true],
|
||||
'fill' => ['fillType' => \PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID, 'startColor' => ['rgb'=>"D0D0D0"]],
|
||||
'borders' => ['allBorders' => ['borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN, 'color' => ['rgb'=>"C0C0C0"]]]
|
||||
];
|
||||
$sheet->setCellValue("A".$baris, "No.");
|
||||
$sheet->setCellValue("B".$baris, "Tanggal / Jam");
|
||||
$sheet->setCellValue("C".$baris, "Menu Aplikasi");
|
||||
$sheet->setCellValue("D".$baris, "Catatan");
|
||||
$sheet->setCellValue("E".$baris, "Operator");
|
||||
$sheet->setCellValue("F".$baris, "Supervisi");
|
||||
$sheet->getStyle('A'.$baris.':F'.$baris)->applyFromArray($styleTableH);
|
||||
|
||||
$baris++; $nomor = 1;
|
||||
while ($db->Next()) {
|
||||
$sheet->setCellValue("A".$baris, $nomor++);
|
||||
$sheet->setCellValue("B".$baris, $db->Row("Tanggal2"));
|
||||
$sheet->setCellValue("C".$baris, $db->Row("Menu"));
|
||||
$sheet->setCellValue("D".$baris, $db->Row("Catatan"));
|
||||
$sheet->setCellValue("E".$baris, $db->Row("Nama_User"));
|
||||
$sheet->setCellValue("F".$baris, $db->Row("Nama_Super"));
|
||||
$baris++;
|
||||
}
|
||||
|
||||
$sheet->getSheetView()->setZoomScale(75);
|
||||
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
|
||||
header('Content-Disposition: attachment;filename="Data Supervisi.xlsx"');
|
||||
header('Cache-Control: max-age=0');
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($ssheet, 'Xlsx');
|
||||
$writer->save('php://output');
|
||||
$ssheet->disconnectWorksheets();
|
||||
unset($ssheet);
|
||||
unset($writer);
|
||||
|
||||
} else if ( $data == "default") {
|
||||
$form = new Form($db);
|
||||
$form->option_db("Nama Pengguna", "UserID", 0, true, false, "app_operator", ["UserID","Nama"], "UserID>1 ORDER BY Nama", [0,"SEMUA PENGGUNA"]);
|
||||
$form->datebox("Dari Tanggal", "Tgl_From", tgl_ymd(), true, false);
|
||||
$form->datebox("Sampai Tanggal", "Tgl_To", tgl_ymd(), true, false);
|
||||
$form->show(' _UserID_ _Tgl_From_ _Tgl_To_ ');
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
App. Name : Inventory Advanced Systems
|
||||
Module : /apps/php/repo/terima.php
|
||||
Desc. : PHP - Laporan Penerimaan
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : July 17th, 2011.
|
||||
Last Modified : March 6th, 2017.
|
||||
|
||||
(c) 2011 - 2017, 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_jual_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, O.Nama_Outlet,J.Tgl_Nota FROM inv_jual_lunas L LEFT JOIN inv_jual J ON (J.No_Jual=L.No_Jual) LEFT JOIN para_outlet O ON (O.OutletID=J.OutletID) 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")." PENERIMAAN", $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("TERIMA DARI",150);
|
||||
$pre->add_field("TGL. NOTA",30,"C","sqltgl");
|
||||
$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_Jual")." - ".$db->Row("Nama_Outlet"), $db->Row("Tgl_Nota"), $db->Row("Tipe_Bayar"), $db->Row("Tgl_Cair2"), $db->Row("Total_Bayar"));
|
||||
}
|
||||
$pre->add_span(array("GRAND TOTAL",5,"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