89 lines
3.4 KiB
PHP
89 lines
3.4 KiB
PHP
<?php
|
|
|
|
/*******************************************************************
|
|
|
|
App. Name : Inventory Advanced Systems
|
|
Module : /apps/php/tab/outlet_grup.php
|
|
Desc. : PHP - Tabel Master Grup Outlet
|
|
Created By : Siau Pheng ([email protected]).
|
|
Created Date : December 7th, 2010.
|
|
Last Modified : March 19th, 2023.
|
|
|
|
(c) 2010 - 2023, 3FONIA Software; WWW.3FONIA.COM.
|
|
|
|
*******************************************************************/
|
|
|
|
require_once(__DIR__."/../../../../../vendor/autoload.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;
|
|
|
|
$db = (is_resource($db)) ? $db : new MySQL();
|
|
$ajson = [];
|
|
$data = Param::Get("data");
|
|
$mode = Param::Get("mode");
|
|
$id_tm = Param::Get("Grup_OutletID", 0);
|
|
|
|
if ( $data == "grup-detail" ) {
|
|
$atabel = ['Grup_OutletID'=>0,'Aktif'=>1];
|
|
if ($id_tm > 0) {
|
|
$db->Query("SELECT * FROM para_outlet_grup WHERE Grup_OutletID='".$id_tm."' LIMIT 1");
|
|
if ($db->Next()) $atabel = $db->AllRow();
|
|
}
|
|
|
|
$form = new Form($db);
|
|
$form->textbox("Kode Grup Produk", "Kode_Grup", $atabel['Kode_Grup'], true, true, "text", "kode grup outlet");
|
|
$form->textbox("Nama Grup Produk", "Nama_Grup", $atabel['Nama_Grup'], true, true, "text", "nama grup outlet");
|
|
$form->switch("Status Aktif", "Aktif", $atabel['Aktif'], true, true, [1,0]);
|
|
$form->hidden("Grup_OutletID", $atabel['Grup_OutletID']);
|
|
$form->hidden("mode", $mode);
|
|
$form->show(' _Kode_Grup_ _Nama_Grup_ _Aktif_ _mode_ _Grup_OutletID_ ');
|
|
|
|
} else if ( $data == "save" ) {
|
|
$sql = new SQL($db);
|
|
$sql->set_table("para_outlet_grup");
|
|
$sql->add_param("Kode_Grup");
|
|
$sql->add_param("Nama_Grup");
|
|
$sql->add_param("Aktif");
|
|
$sql->add_param_userid();
|
|
$sql->add_where("Grup_OutletID");
|
|
|
|
if ($mode=="add") {
|
|
$sql->InsertDB();
|
|
} else if ($mode=="edit") {
|
|
$sql->UpdateDB();
|
|
} else if ($mode=="del") {
|
|
$sql->DeleteDB();
|
|
}
|
|
$ajson['status'] = true;
|
|
|
|
} else if ( $data == "detail" ) {
|
|
$tcari = trim(Param::Get("Cari_Grup"));
|
|
$tsql = ($tcari=="") ? "" : " WHERE CONCAT(Kode_Grup,Nama_Grup) LIKE '%".$tcari."%'";
|
|
|
|
$obj = new Table($db);
|
|
$obj->set_query("SELECT * FROM para_outlet_grup".$tsql);
|
|
$obj->add_field("Grup_OutletID", "ID", "hid");
|
|
$obj->add_field("Kode_Grup", "Kode Grup");
|
|
$obj->add_field("Nama_Grup", "Nama Grup", "awr");
|
|
$obj->add_field("Aktif", "Aktif", "c", "checkbox");
|
|
$obj->set_field_order("Kode_Grup", "A");
|
|
$obj->add_row_btn("clipboard", "Ubah", "OutletGrupJS.detail_ubah");
|
|
$obj->add_row_btn("trash", "Hapus", "OutletGrupJS.detail_hapus");
|
|
$obj->set_func_navi("OutletGrupJS.data_query('detail')");
|
|
$obj->set_func_btn("OutletGrupJS.detail_tambah", "+ Grup Outlet");
|
|
$ajson[] = $obj->json_table("divDetail");
|
|
|
|
} else if ( $data == "default") {
|
|
echo '
|
|
<div class="fade-in">
|
|
<div class="card"><div class="card-header custom-style">Daftar Grup Outlet</div><div class="card-body"><div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Grup" 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"> </div></div></div>
|
|
</div>';
|
|
}
|
|
|
|
send_json($ajson);
|
|
?>
|