first commit
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
/*******************************************************************
|
||||
|
||||
PHP Class : /Controller/Table/RekposController
|
||||
Description : Master Jenis Pembayaran POS
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : September 9th, 2014.
|
||||
Last Modified : August 31st, 2026.
|
||||
|
||||
(c) 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Controller\Table;
|
||||
|
||||
use flight\Engine;
|
||||
use flight\database\SimplePdo;
|
||||
use Webapp\DB\SQL;
|
||||
use Webapp\Web\Form;
|
||||
use Webapp\Web\Param;
|
||||
use Webapp\Web\Table;
|
||||
|
||||
class RekposController {
|
||||
|
||||
private string $mode_detail;
|
||||
private int $id_kartu;
|
||||
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_kartu = (int) Param::Get("KartuID", 0);
|
||||
}
|
||||
|
||||
public function table_detail() {
|
||||
if (in_array($this->mode_detail, ["insert","update","delete"])) {
|
||||
$sql = new SQL($this->app);
|
||||
$sql->set_table("para_rek_pos");
|
||||
$sql->add_param("Kode_Kartu");
|
||||
$sql->add_param("Nama_Kartu");
|
||||
$sql->add_param("Kode_Rek");
|
||||
$sql->add_param("Aktif");
|
||||
$sql->add_param_userid();
|
||||
$sql->add_where("KartuID");
|
||||
|
||||
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_Rekpos");
|
||||
$tsql = ''; $asql = [];
|
||||
if (!empty($tcari)) {
|
||||
$tsql = 'CONCAT(Kode_Kartu,Nama_Kartu) LIKE ?';
|
||||
$asql[] = '%'. $tcari .'%';
|
||||
}
|
||||
|
||||
$obj = new Table($this->app);
|
||||
$obj->set_table("para_rek_pos", "*", $tsql, $asql);
|
||||
$obj->add_field("KartuID", "ID", "hid");
|
||||
$obj->add_field("Kode_Kartu", "Kode");
|
||||
$obj->add_field("Nama_Kartu", "Nama Jenis Pembayaran", "awr");
|
||||
$obj->add_field("Kode_Rek", "Rekening", "c");
|
||||
$obj->add_field("Aktif", "Aktif", "c", "checkbox");
|
||||
$obj->set_field_order("Kode_Kartu", "A");
|
||||
$obj->add_row_btn("clipboard", "Ubah", "RekPOSJS.detail_ubah");
|
||||
$obj->add_row_btn("trash", "Hapus", "RekPOSJS.detail_hapus");
|
||||
$obj->set_func_btn("RekPOSJS.detail_tambah", "+ Jenis Pembayaran");
|
||||
$this->app->json([ $obj->json_table("divDetail") ]);
|
||||
}
|
||||
|
||||
public function form_rekpos() {
|
||||
$atabel = ['KartuID'=>0, 'Kode_Kartu'=>"", 'Nama_Kartu'=>"", 'Kode_Rek'=>"", 'Aktif'=>1];
|
||||
if ($this->id_kartu > 0) {
|
||||
$atabel = $this->db->fetchRow("SELECT * FROM para_rek_pos WHERE KartuID=?", [$this->id_kartu]);
|
||||
}
|
||||
|
||||
$form = new Form($this->app);
|
||||
$tkode = $form->textbox("_", "Kode_Kartu", $atabel['Kode_Kartu'], true, true, "text", "kode jenis pembayaran");
|
||||
$tnama = $form->textbox("_", "Nama_Kartu", $atabel['Nama_Kartu'], true, true, "text", "nama jenis pembayaran");
|
||||
$trek = $form->option_db("_", "Kode_Rek", $atabel['Kode_Rek'], true, false, "vi_gel_acc", ["Kode_Rek","Nama_Lengkap"], "Kode_Induk='1100' AND Mode='D' AND Aktif=1 ORDER BY Nama_Lengkap", [0," "]);
|
||||
$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_Kartu">Kode Jenis Pembayaran</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_Kartu">Nama Jenis Pembayaran</label>
|
||||
<div class="col">'.$tnama.'</div>
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<label class="col-sm-4 col-lg-3 col-form-label" for="Kode_Rek">Nama Rekening</label>
|
||||
<div class="col">'.$trek.'</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="KartuID" value="'.$atabel['KartuID'].'" >
|
||||
<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 Jenis Pembayaran POS</div><div class="card-body"><div class="row mb-1"><div class="col"><div class="input-group"><input class="form-control" id="Cari_Rekpos" 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>'
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user