first commit

This commit is contained in:
2026-10-29 13:34:31 +07:00
commit 45e4595c57
255 changed files with 35457 additions and 0 deletions
@@ -0,0 +1,215 @@
<?php
/*******************************************************************
PHP Class : /Controller/Table/Member/MemberController
Description : Master Member
Created By : Siau Pheng ([email protected]).
Created Date : December 7th, 2010.
Last Modified : September 3rd, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
declare(strict_types=1);
namespace App\Controller\Table\Member;
use App\Utils\Invesa;
use flight\Engine;
use flight\database\SimplePdo;
use flight\Session;
use Webapp\DB\SQL;
use Webapp\Printer\PrintHTML;
use Webapp\Web\Form;
use Webapp\Web\Param;
use Webapp\Web\Table;
class MemberController {
private string $reg_name;
private string $mode_detail;
private int $id_member;
protected Engine $app;
protected SimplePdo $db;
public function __construct(Engine $app, SimplePdo $db, Session $session) {
$this->app = $app;
$this->db = $db;
$this->reg_name = (string) $session->get('WEB_APP')['REG_NAME'];
$this->mode_detail = Param::Get("mode_detail", "");
$this->id_member = (int) Param::Get("MemberID", 0);
}
public function table_detail() {
if (in_array($this->mode_detail, ["insert","update","delete"])) {
$sql = new SQL($this->app);
$sql->set_table("para_member");
$sql->add_param("Grup_MemberID");
$sql->add_param("Kode_Member");
$sql->add_param("Nama_Member");
$sql->add_param("Alamat_Member");
$sql->add_param("Kota_Member");
$sql->add_param("Telp_Member");
$sql->add_param("KTP_Member");
$sql->add_param_date("Tgl_Lahir");
$sql->add_param_date("Tgl_Daftar");
$sql->add_param("IM");
$sql->add_param("Aktif");
$sql->add_param_userid();
$sql->add_where("MemberID");
if ($this->mode_detail === "insert") {
$sql->InsertDB();
} else if ($this->mode_detail === "update") {
$sql->UpdateDB();
} else if ($this->mode_detail === "delete") {
$sql->DeleteDB();
}
}
$tcari = Param::Get("Cari_Member");
$tsql = ''; $asql = [];
if (!empty($tcari)) {
$tsql = 'CONCAT(Kode_Member,Nama_Member,Telp_Member) LIKE ?';
$asql[] = '%'. $tcari .'%';
}
$obj = new Table($this->app);
$obj->set_table("para_member", "*", $tsql, $asql);
$obj->add_field("MemberID", "ID", "hid");
$obj->add_field("Kode_Member", "Kode / ID", "c");
$obj->add_field("Nama_Member", "Nama Member", "awr");
$obj->add_field("Alamat_Member", "Alamat", "awr");
$obj->add_field("Telp_Member", "No. Telp", "l");
$obj->add_field("IM", "Member", "c", "checkbox");
$obj->add_field("Aktif", "Aktif", "c", "checkbox");
$obj->set_field_order("Kode_Member", "A");
$obj->add_row_btn("clipboard", "Ubah", "MemberJS.detail_ubah");
$obj->add_row_btn("trash", "Hapus", "MemberJS.detail_hapus");
$obj->set_func_btn("MemberJS.detail_tambah", "+ Member");
$this->app->json([ $obj->db_table("divDetail") ]);
}
public function form_member() {
$atabel = Invesa::A_Member_Member();
if ($this->id_member > 0) {
$atabel = $this->db->fetchRow("SELECT * FROM para_member WHERE MemberID=?", [$this->id_member]);
}
$form = new Form($this->app);
$tgrup = $form->option_db("_", "Grup_MemberID", $atabel['Grup_MemberID'], true, false, "para_member_grup", ["Grup_MemberID","Nama_Grup"], "Aktif=1 ORDER BY Nama_Grup");
$tkode = $form->textbox("_", "Kode_Member", $atabel['Kode_Member'], true, false, "text", "kode member");
$tnama = $form->textbox("_", "Nama_Member", $atabel['Nama_Member'], true, true, "text", "nama member");
$talamat = $form->textarea("_", "Alamat_Member", $atabel['Alamat_Member'], true, true, 2);
$tkota = $form->textbox("_", "Kota_Member", $atabel['Kota_Member'], true, true, "text", "kota member");
$ttelp = $form->textbox("_", "Telp_Member", $atabel['Telp_Member'], true, true, "text", "telp member");
$tktp = $form->textbox("_", "KTP_Member", $atabel['KTP_Member'], true, true, "text", "ktp member");
$tlahir = $form->datebox("_", "Tgl_Lahir", $atabel['Tgl_Lahir'], true, true);
$tdaftar = $form->datebox("_", "Tgl_Daftar", $atabel['Tgl_Daftar'], true, true);
$tim = $form->checkbox("_", "IM", $atabel['IM'], true, true, [1,0]);
$taktif = $form->radio("_", "Aktif", $atabel['Aktif'], true, true, [1=>"Ya",0=>"Tidak"]);
$ajson['html'] = '
<div class="row mb-1">
<label class="col-sm-5 col-lg-2 col-form-label" for="Grup_MemberID">Grup Member</label>
<div class="col-sm-7 col-lg-4">'.$tgrup.'</div>
<label class="col-sm-5 col-lg-2 col-form-label" for="Aktif">Status Aktif ?</label>
<div class="col-sm-7 col-lg-4 d-flex gap-2">'.$taktif.'<div class="col-form-label ms-auto me-2">Member ?</div>'.$tim.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-5 col-lg-2 col-form-label" for="Kode_Member">Kode / ID Member</label>
<div class="col-sm-7 col-lg-4"><div class="input-group">'.$tkode.Invesa::Form_Info("Kode / ID Barcode Member (Scan dari Kartu Member). Contoh : 17000017.").'</div></div>
<label class="col-sm-5 col-lg-2 col-form-label" for="Tgl_Daftar">Tanggal Daftar</label>
<div class="col-sm-7 col-lg-4">'.$tdaftar.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-5 col-lg-2 col-form-label" for="KTP_Member">No. KTP / SIM</label>
<div class="col-sm-7 col-lg-4">'.$tktp.'</div>
<label class="col-sm-5 col-lg-2 col-form-label" for="Tgl_Lahir">Tanggal Lahir</label>
<div class="col-sm-7 col-lg-4">'.$tlahir.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-5 col-lg-2 col-form-label" for="Nama_Member">Nama Member</label>
<div class="col-sm-7 col-lg-10">'.$tnama.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-5 col-lg-2 col-form-label" for="Alamat_Member">Alamat Member</label>
<div class="col-sm-7 col-lg-10">'.$talamat.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-5 col-lg-2 col-form-label" for="Kota_Member">Kota Member</label>
<div class="col-sm-7 col-lg-4">'.$tkota.'</div>
<label class="col-sm-5 col-lg-2 col-form-label" for="Telp_Member">Telp. Member</label>
<div class="col-sm-7 col-lg-4">'.$ttelp.'</div>
</div>
<input type="hidden" id="MemberID" value="'.$atabel['MemberID'].'" />
<input type="hidden" id="mode_detail" value="'.$this->mode_detail.'" />';
$this->app->json($ajson);
}
public function detail_print() {
$form = new Form($this->app);
$tgrup = $form->option_db("_", "Grup_MemberID", 0, true, false, "para_member_grup", ["Grup_MemberID","Nama_Grup"], "Aktif=1 ORDER BY Nama_Grup", [0,"SEMUA GRUP MEMBER"]);
$taktif = $form->radio("_", "Aktif", 9, true, true, [9=>"Semua",'1'=>"Ya",'0'=>"Tidak"]);
$ttgl = $form->datebox("_", "Tgl_Cetak", tgl_ymd(), true, false);
$ajson['html'] = '
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Grup_MemberID">Grup Member</label>
<div class="col">'.$tgrup.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Aktif">Status Aktif</label>
<div class="col d-flex gap-2">'.$taktif.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Tgl_Cetak">Tanggal Cetak</label>
<div class="col-sm-4 col-lg-4">'.$ttgl.'</div>
</div>';
$this->app->json($ajson);
}
public function print_member() {
$id_grup = Param::Get("Grup_MemberID", 0);
$aktif = Param::Get("Aktif", 9);
$nama_grup = ""; $nama_aktif = ($aktif==0) ? "Tidak Aktif" : "Aktif";
if ($id_grup > 0) $nama_grup = $this->db->fetchField("SELECT Nama_Grup FROM para_member_grup WHERE Grup_MemberID=?", [$id_grup]);
// generate report header
$tglheader = "Tanggal Cetak : ".Param::Get("Tgl_Cetak");
$tsql = ''; $asql = [];
if ($id_grup > 0) { $tsql .= " AND Grup_MemberID=?"; $asql[] = $id_grup; }
if ($aktif < 9) { $tsql .= " AND Aktif=?"; $asql[] = $aktif; }
$tsql = (strlen($tsql) > 0) ? ' WHERE '.substr($tsql, 4) : '';
// query data laporan
$stat = $this->db->runQuery("SELECT * FROM para_member".$tsql." ORDER BY Nama_Member", $asql);
$pre = new PrintHTML($this->app);
$pre->add_title([strtoupper($this->reg_name), "Laporan Daftar Member", $tglheader]);
$pre->add_field("No",10,"C");
$pre->add_field("Nama Member",80, "L");
$pre->add_field("Alamat",12, "L");
$pre->add_field("Kota",12, "L");
if ($id_grup > 0) $pre->add_sub_title("Grup Member : ".$nama_grup);
if ($aktif < 9) $pre->add_sub_title("Status Aktif : ".$nama_aktif);
$pre->show_titles();
$pre->show_headers();
$nomor = 1;
while ($row = $stat->fetch(SimplePdo::FETCH_ASSOC)) {
$pre->add_row([ $nomor++, $row['Nama_Member'], $row['Alamat_Member'], $row['Kota_Member'] ]);
}
$pre->add_stamp(0, true);
$pre->show();
}
public function index() {
$this->app->json(['html' => '
<div class="fade-in"><div class="card"><div class="card-header custom-style">Daftar Member</div><div class="card-body"><div class="row mb-1"><div class="col-10"><div class="input-group"><input class="form-control" id="Cari_Member" placeholder="Kunci Pencarian" type="text"><button class="btn btn-info shadow-none" type="button" id="butSearch">Cari</button><button class="btn btn-secondary shadow-none" type="button" id="butAll">Semua</button></div></div><div class="col-2 btn-group"><button class="btn btn-info shadow-none" type="button" id="butPrint"><i class="bi-printer me-2"></i>Cetak</button></div></div><div id="divDetail">&nbsp;</div></div></div></div>'
]);
}
}
@@ -0,0 +1,115 @@
<?php
/*******************************************************************
PHP Class : /Controller/Table/Member/MembergrupController
Description : Master Grup Member
Created By : Siau Pheng ([email protected]).
Created Date : May 19th, 2010.
Last Modified : September 3rd, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
declare(strict_types=1);
namespace App\Controller\Table\Member;
use App\Utils\Invesa;
use flight\Engine;
use flight\database\SimplePdo;
use Webapp\DB\SQL;
use Webapp\Web\Form;
use Webapp\Web\Param;
use Webapp\Web\Table;
class MembergrupController {
private string $mode_detail;
private int $id_grup;
protected Engine $app;
protected SimplePdo $db;
public function __construct(Engine $app, SimplePdo $db) {
$this->app = $app;
$this->db = $db;
$this->mode_detail = Param::Get("mode_detail", "");
$this->id_grup = (int) Param::Get("Grup_MemberID", 0);
}
public function table_detail() {
if (in_array($this->mode_detail, ["insert","update","delete"])) {
$sql = new SQL($this->app);
$sql->set_table("para_member_grup");
$sql->add_param("Kode_Grup");
$sql->add_param("Nama_Grup");
$sql->add_param("Aktif");
$sql->add_param_userid();
$sql->add_where("Grup_MemberID");
if ($this->mode_detail === "insert") {
$sql->InsertDB();
} else if ($this->mode_detail === "update") {
$sql->UpdateDB();
} else if ($this->mode_detail === "delete") {
$sql->DeleteDB();
}
}
$tcari = Param::Get("Cari_Member");
$tsql = ''; $asql = [];
if (!empty($tcari)) {
$tsql = 'CONCAT(Kode_Grup,Nama_Grup) LIKE ?';
$asql[] = '%'. $tcari .'%';
}
$obj = new Table($this->app);
$obj->set_table("para_member_grup", "*", $tsql, $asql);
$obj->add_field("Grup_MemberID", "ID", "hid");
$obj->add_field("Kode_Grup", "Kode");
$obj->add_field("Nama_Grup", "Nama Grup Member", "awr");
$obj->add_field("Aktif", "Aktif", "c", "checkbox");
$obj->set_field_order("Kode_Grup", "A");
$obj->add_row_btn("clipboard", "Ubah", "MemberGrupJS.detail_ubah");
$obj->add_row_btn("trash", "Hapus", "MemberGrupJS.detail_hapus");
$obj->set_func_btn("MemberGrupJS.detail_tambah", "+ Grup Member");
$this->app->json([ $obj->json_table("divDetail") ]);
}
public function form_grup() {
$atabel = Invesa::A_Member_Grup();
if ($this->id_grup > 0) {
$atabel = $this->db->fetchRow("SELECT * FROM para_member_grup WHERE Grup_MemberID=?", [$this->id_grup]);
}
$form = new Form($this->app);
$tkode = $form->textbox("_", "Kode_Grup", $atabel['Kode_Grup'], true, true, "text", "kode grup member");
$tnama = $form->textbox("_", "Nama_Grup", $atabel['Nama_Grup'], true, true, "text", "nama grup member");
$taktif = $form->radio("_", "Aktif", $atabel['Aktif'], true, true, ['1'=>"Aktif",'0'=>"Tidak"]);
$ajson['html'] = '
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Kode_Grup">Kode Grup Member</label>
<div class="col-sm-6 col-lg-5">'.$tkode.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Nama_Grup">Nama Grup Member</label>
<div class="col">'.$tnama.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Aktif">Status Aktif ?</label>
<div class="col d-flex gap-2">'.$taktif.'</div>
</div>
<input type="hidden" id="Grup_MemberID" value="'.$atabel['Grup_MemberID'].'" >
<input type="hidden" id="mode_detail" value="'.$this->mode_detail.'" >';
$this->app->json($ajson);
}
public function index() {
$this->app->json(['html' => '
<div class="fade-in">
<div class="card"><div class="card-header custom-style">Daftar Grup Member</div><div class="card-body"><div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Member" placeholder="Kunci Pencarian" type="text"><button class="btn btn-info shadow-none" type="button" id="butSearch">Cari</button><button class="btn btn-secondary shadow-none" type="button" id="butAll">Semua</button></div></div></div><div id="divDetail">&nbsp;</div></div></div>
</div>'
]);
}
}
@@ -0,0 +1,135 @@
<?php
/*******************************************************************
PHP Class : /Controller/Table/Member/PointbarangController
Description : Master Point Penukanan Barang
Created By : Siau Pheng ([email protected]).
Created Date : May 19th, 2010.
Last Modified : September 4th, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
declare(strict_types=1);
namespace App\Controller\Table\Member;
use App\Utils\Invesa;
use flight\Engine;
use flight\database\SimplePdo;
use Webapp\DB\SQL;
use Webapp\Web\Form;
use Webapp\Web\Param;
use Webapp\Web\Table;
class PointbarangController {
private string $mode_detail;
private int $id_point;
protected Engine $app;
protected SimplePdo $db;
public function __construct(Engine $app, SimplePdo $db) {
$this->app = $app;
$this->db = $db;
$this->mode_detail = Param::Get("mode_detail", "");
$this->id_point = (int) Param::Get("InvPID", 0);
}
public function table_detail() {
if (in_array($this->mode_detail, ["insert","update","delete"])) {
$sql = new SQL($this->app);
$sql->set_table("inv_point_barang");
$sql->add_param("Point_TipeID");
$sql->add_param("Nama_Barang");
$sql->add_param("SatuanID");
$sql->add_param("Nilai_Barang");
$sql->add_param("Nilai_Point");
$sql->add_param("Aktif");
$sql->add_param_userid();
$sql->add_where("InvPID");
if ($this->mode_detail === "insert") {
$sql->InsertDB();
} else if ($this->mode_detail === "update") {
$sql->UpdateDB();
} else if ($this->mode_detail === "delete") {
$sql->DeleteDB();
}
}
$tcari = Param::Get("Cari_Barang");
$tsql = ''; $asql = [];
if (!empty($tcari)) {
$tsql = 'Nama_Barang LIKE ?';
$asql[] = '%'. $tcari .'%';
}
$obj = new Table($this->app);
$obj->set_table("inv_point_barang B LEFT JOIN inv_point_tipe T ON (B.Point_TipeID=T.Point_TipeID)", "B.*,T.Nama_Tipe", $tsql, $asql);
$obj->add_field("InvPID", "ID", "hid");
$obj->add_field("Nama_Tipe", "Tipe Point", "awr");
$obj->add_field("Nama_Barang", "Nama Barang", "awr");
$obj->add_field("Nilai_Barang", "Nilai Barang", "r", "rupiah");
$obj->add_field("Nilai_Point", "Nilai Point", "r", "rupiah");
$obj->add_field("Aktif", "Aktif", "c", "checkbox");
$obj->set_field_order("Nama_Barang", "A");
$obj->add_row_btn("clipboard", "Ubah", "PointBarangJS.detail_ubah");
$obj->add_row_btn("trash", "Hapus", "PointBarangJS.detail_hapus");
$obj->set_func_btn("PointBarangJS.detail_tambah", "+ Barang");
$this->app->json([ $obj->json_table("divDetail") ]);
}
public function form_barang() {
$atabel = [ 'InvPID'=>0, 'Point_TipeID'=>0, 'Nama_Barang'=>"", 'SatuanID'=>0, 'Nilai_Barang'=>0, 'Nilai_Point'=>0, 'Aktif'=>1];
if ($this->id_point > 0) {
$atabel = $this->db->fetchRow("SELECT * FROM inv_point_barang WHERE InvPID=?", [$this->id_point]);
}
$form = new Form($this->app);
$ttipe = $form->option_db("_", "Point_TipeID", $atabel['Point_TipeID'], true, false, "inv_point_tipe", ["Point_TipeID","Nama_Tipe"], "Aktif=1 ORDER BY Point_TipeID", [0,"&nbsp;"]);
$tnama = $form->textbox("_", "Nama_Barang", $atabel['Nama_Barang'], true, true, "text");
$tsatuan = $form->option_db("_", "SatuanID", $atabel['SatuanID'], true, false, "para_satuan", ["SatuanID","Nama_Satuan"], "Aktif=1 ORDER BY Nama_Satuan", [0,"&nbsp;"]);
$tnilai = $form->textbox("_", "Nilai_Barang", $atabel['Nilai_Barang'], true, false, "double");
$tpoint = $form->textbox("_", "Nilai_Point", $atabel['Nilai_Point'], true, false, "number");
$taktif = $form->radio("_", "Aktif", $atabel['Aktif'], true, false, [1=>"Aktif",0=>"Tidak"]);
$ajson['html'] = '
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Point_TipeID">Tipe Point</label>
<div class="col">'.$ttipe.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Nama_Barang">Nama Barang</label>
<div class="col">'.$tnama.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="SatuanID">Satuan Barang</label>
<div class="col-sm-6 col-lg-5">'.$tsatuan.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Nilai_Barang">Nilai Barang</label>
<div class="col-sm-6 col-lg-5">'.$tnilai.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Nilai_Point">Point Barang</label>
<div class="col-sm-6 col-lg-5">'.$tpoint.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Aktif">Status Aktif ?</label>
<div class="col d-flex gap-2">'.$taktif.'</div>
</div>
<input type="hidden" id="InvPID" value="'.$atabel['InvPID'].'" >
<input type="hidden" id="mode_detail" value="'.$this->mode_detail.'" >';
$this->app->json($ajson);
}
public function index() {
$this->app->json(['html' => '
<div class="fade-in">
<div class="card"><div class="card-header custom-style">Daftar Point Penukarang Barang</div><div class="card-body"><div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Barang" placeholder="Kunci Pencarian" type="text"><button class="btn btn-info shadow-none" type="button" id="butSearch">Cari</button><button class="btn btn-secondary shadow-none" type="button" id="butAll">Semua</button></div></div></div><div id="divDetail">&nbsp;</div></div></div>
</div>'
]);
}
}
@@ -0,0 +1,223 @@
<?php
/*******************************************************************
PHP Class : /Controller/Table/Member/PointskemaController
Description : Master Skema Point Member
Created By : Siau Pheng ([email protected]).
Created Date : September 28th, 2014.
Last Modified : September 4th, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
declare(strict_types=1);
namespace App\Controller\Table\Member;
use App\Utils\Invesa;
use flight\Engine;
use flight\database\SimplePdo;
use Webapp\DB\SQL;
use Webapp\Web\Form;
use Webapp\Web\Param;
use Webapp\Web\Table;
class PointskemaController {
private string $mode_detail;
private int $id_point;
private string $kode_barang;
protected Engine $app;
protected SimplePdo $db;
public function __construct(Engine $app, SimplePdo $db) {
$this->app = $app;
$this->db = $db;
$this->mode_detail = Param::Get("mode_detail", "");
$this->id_point = (int) Param::Get("PointID", 0);
$this->kode_barang = (string) Param::Get("Kode_Barang", "");
}
public function table_detail() {
if (in_array($this->mode_detail, ["insert","update","delete"])) {
$sql = new SQL($this->app);
$sql->set_table("inv_point");
$sql->add_param("Point_TipeID");
$sql->add_param("KartuID");
$sql->add_param("CabID");
$sql->add_param("Grup_MemberID");
$sql->add_param("Nilai_Jual");
$sql->add_param("Grup_Barang");
$sql->add_param("Kode_Barang");
$sql->add_param_date("Tgl_Mulai");
$sql->add_param("Aktif");
$sql->add_param_userid();
$sql->add_where("PointID");
if ($this->mode_detail === "insert") {
$sql->InsertDB();
} else if ($this->mode_detail === "update") {
$sql->UpdateDB();
} else if ($this->mode_detail === "delete") {
$sql->DeleteDB();
}
}
$tcari = Param::Get("Cari_Skema");
$tsql = ''; $asql = [];
if (!empty($tcari)) {
$tsql = 'CONCAT_WS(G.Nama_Grup,T.Nama_Tipe) LIKE ?';
$asql[] = '%'. $tcari .'%';
}
$obj = new Table($this->app);
$obj->set_table("inv_point P LEFT JOIN para_member_grup G ON (G.Grup_MemberID=P.Grup_MemberID) LEFT JOIN para_cabang C ON (P.CabID=C.CabID) LEFT JOIN para_rek_pos K ON (P.KartuID=K.KartuID) LEFT JOIN inv_point_tipe T ON (P.Point_TipeID=T.Point_TipeID)", "P.*,IF(P.KartuID=0,'SEMUA JENIS',K.Nama_Kartu) Nama_Kartu,IF(P.Grup_MemberID=0,'SEMUA GRUP',G.Nama_Grup) Nama_Grup,IF(P.CabID=0,'SEMUA CABANG',C.Nama_Cab) Nama_Cab,T.Nama_Tipe", $tsql, $asql);
$obj->add_field("PointID", "ID", "hid");
$obj->add_field("Nama_Tipe", "Tipe", "l");
$obj->add_field("Nama_Cab", "Cabang", "l");
$obj->add_field("Nama_Kartu", "Pembayaran", "l");
$obj->add_field("Nama_Grup", "Grup Member", "l");
$obj->add_field("Grup_Barang", "Grup Barang", "awr");
$obj->add_field("Nilai_Jual", "Nominal (Rp.)", "r", "rupiah");
$obj->add_field("Tgl_Mulai", "Tgl. Mulai", "c", "sqltgl", "", "val-tgl");
$obj->add_field("Aktif", "Aktif", "c", "checkbox");
$obj->set_field_order("Nama_Tipe", "A");
$obj->add_row_btn("clipboard", "Ubah", "PointSkemaJS.detail_ubah");
$obj->add_row_btn("trash", "Hapus", "PointSkemaJS.detail_hapus");
$obj->set_func_btn("PointSkemaJS.detail_tambah", "+ Skema Point");
$this->app->json([ $obj->json_table("divDetail") ]);
}
public function table_barang() {
$ainv = (empty($this->kode_barang)) ? [] : explode(",", $this->kode_barang);
if (in_array($this->mode_detail, ["insert","delete"])) {
$id_inv = Param::Get("InvID", 0);
if ($this->mode_detail === "insert") {
if (!in_array($id_inv, $ainv)) $ainv[] = $id_inv;
} else if ($this->mode_detail === "delete") {
if (($key = array_search($id_inv, $ainv)) !== false) unset($ainv[$key]);
}
}
$tsql = 'FALSE'; $asql = [];
if (count($ainv) > 0) {
$tsql = 'InvID IN (?)';
$asql[] = $ainv;
}
$obj = new Table($this->app);
$obj->set_table("inv_produk", "*,1 Hapus", $tsql, $asql);
$obj->add_field("InvID", "ID", "hid");
$obj->add_field("Nama_Produk", "Nama Barang", "awr");
$obj->add_row_btn("trash", "Hapus", "PointSkemaJS.barang_hapus");
$this->app->json([ $obj->json_table("divBarang"), ['type'=>"form", 'id'=>"Kode_Barang", 'value'=>implode(',', $ainv)] ]);
}
public function auto_produk() {
$tcari = Param::Get("Auto_Query");
$ajson['autodata'] = [];
$bcode = 0; $arec = [];
// Cari by SKU & Barcode
$arec = $this->db->fetchRow("SELECT V.InvID,P.Nama_Produk FROM (SELECT * FROM inv_produk_varian WHERE Kode_SKU=? OR Kode_Barcode=? LIMIT 1) V LEFT JOIN inv_produk P ON (P.InvID=V.InvID) WHERE P.Aktif=1", [$tcari, $tcari]);
if (is_array($arec) && count($arec) > 0) $bcode = 1;
if ($bcode === 1) {
$ajson['autodata'][] = ['value'=>$arec['InvID'], 'text'=>$arec['Nama_Produk'], 'data'=>0, 'bc'=>1];
} else {
// Cari by Nama
$stat = $this->db->runQuery("SELECT InvID,Nama_Produk FROM inv_produk WHERE Aktif=1 AND Nama_Produk LIKE ? ORDER BY Nama_Produk LIMIT 50", ['%'.$tcari.'%']);
while ($row = $stat->fetch(SimplePdo::FETCH_ASSOC)) {
$ajson['autodata'][] = ['value'=>$row['InvID'], 'text'=>$row['Nama_Produk'], 'html'=>$row['Nama_Produk'], 'data'=>0, 'bc'=>0];
}
}
$this->app->json($ajson);
}
public function form_skema() {
$atabel = [ 'PointID'=>0,'CabID'=>0,'Grup_MemberID'=>0,'Point_TipeID'=>0,'KartuID'=>0,'Grup_Barang'=>"",'Kode_Barang'=>"",'Nilai_Jual'=>0,'Tgl_Mulai'=>tgl_ymd(),'Aktif'=>1 ];
if ($this->id_point > 0) {
$atabel = $this->db->fetchRow("SELECT * FROM inv_point WHERE PointID=?", [$this->id_point]);
}
$form = new Form($this->app);
$tcab = $form->option_db("_", "CabID", $atabel['CabID'], true, false, "para_cabang", ["CabID","Nama_Cab"], "Aktif=1 ORDER BY Nama_Cab", [0,"SEMUA CABANG"]);
$tgrup = $form->option_db("_", "Grup_MemberID", $atabel['Grup_MemberID'], true, false, "para_member_grup", ["Grup_MemberID","Nama_Grup"], "Aktif=1 ORDER BY Nama_Grup", [0,"SEMUA GRUP"]);
$ttipe = $form->option_db("_", "Point_TipeID", $atabel['Point_TipeID'], true, false, "inv_point_tipe", ["Point_TipeID","Nama_Tipe"], "Aktif=1 ORDER BY Point_TipeID", [0,"&nbsp;"]);
$tkartu = $form->option_db("_", "KartuID", $atabel['KartuID'], true, false, "para_rek_pos", ["KartuID","Nama_Kartu"], "Aktif=1", [0,"SEMUA JENIS PEMBAYARAN"]);
$t_grup = $form->textbox("_", "Grup_Barang", $atabel['Grup_Barang'], false, false, "text");
$t_brg = $form->textbox("_", "Kode_Barang", $atabel['Kode_Barang'], false, false, "text");
$t_nilai = $form->textbox("_", "Nilai_Jual", $atabel['Nilai_Jual'], true, false, "double");
$ttglmulai = $form->datebox("_", "Tgl_Mulai", $atabel['Tgl_Mulai'], true, false);
$taktif = $form->radio("_", "Aktif", $atabel['Aktif'], true, false, ['1'=>"Ya",'0'=>"Tidak"]);
$ajson['html'] = '
<div class="row mb-1">
<label class="col-sm-4 col-lg-2 col-form-label" for="Point_TipeID">Tipe Point</label>
<div class="col">'.$ttipe.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-2 col-form-label" for="CabID">Nama Cabang</label>
<div class="col-sm-8 col-lg-4">'.$tcab.'</div>
<label class="col-sm-4 col-lg-2 col-form-label" for="Grup_MemberID">Grup Member</label>
<div class="col-sm-8 col-lg-4">'.$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-4 col-lg-2 col-form-label">Grup Barang</label>
<div class="col"><div class="input-group">'.$t_grup.'<button id="butBrow1" class="btn btn-info" type="button"><i class="bi-search"></i></button></div></div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-2 col-form-label">Daftar Barang</label>
<div class="col"><div class="input-group">'.$t_brg.'<button id="butBrow2" class="btn btn-info" type="button"><i class="bi-search"></i></button></div></div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-2 col-form-label" for="Nilai_Jual">Nominal Penjualan</label>
<div class="col-sm-8 col-lg-4"><div class="input-group">'.$t_nilai.Invesa::Form_Info("Jumlah Nominal Penjualan untuk Memperoleh Point (berlaku kelipatan). Contoh : Rp 100.000").'</div></div>
<label class="col-sm-4 col-lg-2 col-form-label" for="Tgl_Mulai">Tanggal Mulai</label>
<div class="col-sm-8 col-lg-4">'.$ttglmulai.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-2 col-form-label" for="KartuID">Jenis Pembayaran</label>
<div class="col-sm-8 col-lg-4">'.$tkartu.'</div>
<label class="col-sm-4 col-lg-2 col-form-label" for="Aktif">Status Aktif ?</label>
<div class="col d-flex gap-2">'.$taktif.'</div>
</div>
<input type="hidden" id="PointID" value="'.$atabel['PointID'].'" >
<input type="hidden" id="mode_detail" value="'.$this->mode_detail.'" >';
$this->app->json($ajson);
}
public function form_grup() {
$agrup = explode(",", Param::Get("Grup_Barang","0"));
$ajson['html'] = '<table class="table table-striped table-bordered table-hover" id="tabGrupList"><thead><tr><th>Nama Grup Barang</th><th>Aksi</th></tr></thead><tbody>';
$stat = $this->db->runQuery("SELECT * FROM inv_produk_grup ORDER BY Nama_Grup");
while ($row = $stat->fetch(SimplePdo::FETCH_ASSOC)) {
$checked = (in_array($row['Grup_InvID'], $agrup)) ? "checked" : "";
$ajson['html'] .= sprintf('<tr><td class="l">%s</td><td class="c"><input class="form-check-input" type="checkbox" value="%s" %s/></td></tr>', $row['Nama_Grup'], $row['Grup_InvID'], $checked);
}
$ajson['html'] .= '</tbody></table>';
$this->app->json($ajson);
}
public function form_barang() {
$form = new Form($this->app);
$tnama = $form->textauto("_", "Nama_Produk", [], true, true, "ketik nama produk");
$ajson['html'] = '
<div class="row mb-1">
<label class="col-sm-4 col-lg-2 col-form-label" for="Nama_Produk">Nama Barang</label>
<div class="col">'.$tnama.'</div>
</div>
<div id="divBarang">&nbsp;</div>
<input type="hidden" id="InvID" value="0" >';
$this->app->json($ajson);
}
public function index() {
$this->app->json(['html' => '
<div class="fade-in">
<div class="card"><div class="card-header custom-style">Daftar Skema Point Member</div><div class="card-body"><div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Skema" placeholder="Kunci Pencarian" type="text"><button class="btn btn-info shadow-none" type="button" id="butSearch">Cari</button><button class="btn btn-secondary shadow-none" type="button" id="butAll">Semua</button></div></div></div><div id="divDetail">&nbsp;</div></div></div>
</div>'
]);
}
}
@@ -0,0 +1,120 @@
<?php
/*******************************************************************
PHP Class : /Controller/Table/Member/PointtipeController
Description : Master Tipe Point Member
Created By : Siau Pheng ([email protected]).
Created Date : May 19th, 2010.
Last Modified : September 4th, 2026.
(c) 3FONIA Software; WWW.3FONIA.COM.
*******************************************************************/
declare(strict_types=1);
namespace App\Controller\Table\Member;
use App\Utils\Invesa;
use flight\Engine;
use flight\database\SimplePdo;
use Webapp\DB\SQL;
use Webapp\Web\Form;
use Webapp\Web\Param;
use Webapp\Web\Table;
class PointtipeController {
private string $mode_detail;
private int $id_tipe;
protected Engine $app;
protected SimplePdo $db;
public function __construct(Engine $app, SimplePdo $db) {
$this->app = $app;
$this->db = $db;
$this->mode_detail = Param::Get("mode_detail", "");
$this->id_tipe = (int) Param::Get("Point_TipeID", 0);
}
public function table_detail() {
if (in_array($this->mode_detail, ["insert","update","delete"])) {
$sql = new SQL($this->app);
$sql->set_table("inv_point_tipe");
$sql->add_param("Nama_Tipe");
$sql->add_param("Txt_Struk1");
$sql->add_param("Txt_Struk2");
$sql->add_param("Aktif");
$sql->add_param_userid();
$sql->add_where("Point_TipeID");
if ($this->mode_detail === "insert") {
$sql->InsertDB();
} else if ($this->mode_detail === "update") {
$sql->UpdateDB();
} else if ($this->mode_detail === "delete") {
$sql->DeleteDB();
}
}
$tcari = Param::Get("Cari_Tipe");
$tsql = ''; $asql = [];
if (!empty($tcari)) {
$tsql = 'Nama_Tipe LIKE ?';
$asql[] = '%'. $tcari .'%';
}
$obj = new Table($this->app);
$obj->set_table("inv_point_tipe", "*", $tsql, $asql);
$obj->add_field("Point_TipeID", "ID", "hid");
$obj->add_field("Nama_Tipe", "Tipe Point", "awr");
$obj->add_field("Aktif", "Aktif", "c", "checkbox");
$obj->set_field_order("Nama_Tipe", "A");
$obj->add_row_btn("clipboard", "Ubah", "PointTipeJS.detail_ubah");
$obj->add_row_btn("trash", "Hapus", "PointTipeJS.detail_hapus");
$obj->set_func_btn("PointTipeJS.detail_tambah", "+ Tipe Point");
$this->app->json([ $obj->json_table("divDetail") ]);
}
public function form_tipe() {
$atabel = [ 'Point_TipeID'=>0, 'Nama_Tipe'=>"", 'Txt_Struk1'=>"", 'Txt_Struk2'=>"", 'Aktif'=>1 ];
if ($this->id_tipe > 0) {
$atabel = $this->db->fetchRow("SELECT * FROM inv_point_tipe WHERE Point_TipeID=?", [$this->id_tipe]);
}
$form = new Form($this->app);
$tnama = $form->textbox("_", "Nama_Tipe", $atabel['Nama_Tipe'], true, true, "text", "nama tipe point");
$tstruk1 = $form->textbox("_", "Txt_Struk1", $atabel['Txt_Struk1'], true, true, "text", "text struk utk dapat point baru");
$tstruk2 = $form->textbox("_", "Txt_Struk2", $atabel['Txt_Struk2'], true, true, "text", "text struk utk tampilan total point");
$taktif = $form->radio("_", "Aktif", $atabel['Aktif'], true, false, [1=>"Aktif",0=>"Tidak"]);
$ajson['html'] = '
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Nama_Tipe">Nama Tipe Point</label>
<div class="col">'.$tnama.'</div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Txt_Struk2">Tulisan Point Baru</label>
<div class="col"><div class="input-group">'.$tstruk2.Invesa::Form_Info("Gunakan [TOT_POINT] untuk tampilan nilai.").'</div></div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Txt_Struk1">Tulisan Total Point</label>
<div class="col"><div class="input-group">'.$tstruk1.Invesa::Form_Info("Gunakan [POINT] untuk tampilan nilai.").'</div></div>
</div>
<div class="row mb-1">
<label class="col-sm-4 col-lg-3 col-form-label" for="Aktif">Status Aktif ?</label>
<div class="col d-flex gap-2">'.$taktif.'</div>
</div>
<input type="hidden" id="Point_TipeID" value="'.$atabel['Point_TipeID'].'" >
<input type="hidden" id="mode_detail" value="'.$this->mode_detail.'" >';
$this->app->json($ajson);
}
public function index() {
$this->app->json(['html' => '
<div class="fade-in">
<div class="card"><div class="card-header custom-style">Daftar Tipe Point Member</div><div class="card-body"><div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Tipe" placeholder="Kunci Pencarian" type="text"><button class="btn btn-info shadow-none" type="button" id="butSearch">Cari</button><button class="btn btn-secondary shadow-none" type="button" id="butAll">Semua</button></div></div></div><div id="divDetail">&nbsp;</div></div></div>
</div>'
]);
}
}