84 lines
3.0 KiB
PHP
84 lines
3.0 KiB
PHP
<?php
|
|
|
|
/*******************************************************************
|
|
|
|
PHP Class : /Controller/Table/Gel/GajiController
|
|
Description : Master Standar Gaji
|
|
Created By : Siau Pheng ([email protected]).
|
|
Created Date : September 17th, 2014.
|
|
Last Modified : September 4th, 2026.
|
|
|
|
(c) 3FONIA Software; WWW.3FONIA.COM.
|
|
|
|
*******************************************************************/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Controller\Table\Gel;
|
|
|
|
use flight\Engine;
|
|
use flight\database\SimplePdo;
|
|
use flight\Session;
|
|
use Webapp\DB\SQL;
|
|
use Webapp\Web\Form;
|
|
use Webapp\Web\Param;
|
|
|
|
class GajiController {
|
|
|
|
private string $mode_detail;
|
|
private int $id_reg;
|
|
protected Engine $app;
|
|
protected SimplePdo $db;
|
|
|
|
public function __construct(Engine $app, SimplePdo $db, Session $session) {
|
|
$this->app = $app;
|
|
$this->db = $db;
|
|
$this->mode_detail = Param::Get("mode_detail", "");
|
|
$this->id_reg = Param::Int("REG_ID", $session->get('WEB_APP')['REG_ID']);
|
|
}
|
|
|
|
public function form_gaji() {
|
|
if ( $this->mode_detail == "save" ) {
|
|
$sql = new SQL($this->app);
|
|
$sql->set_table("gel_config");
|
|
$sql->add_param("LEMBUR");
|
|
$sql->add_param("BONUS1");
|
|
$sql->add_param("BONUS2");
|
|
$sql->add_where("REG_ID");
|
|
$sql->UpdateDB();
|
|
$this->mode_detail = "view";
|
|
}
|
|
|
|
$atabel = [ 'REG_ID'=>0, 'LEMBUR'=>0, 'BONUS1'=>0, 'BONUS2'=>0 ];
|
|
if ($this->id_reg > 0) {
|
|
$atabel = $this->db->fetchRow("SELECT * FROM gel_config WHERE REG_ID=?", [$this->id_reg]);
|
|
}
|
|
|
|
$benable = ($this->mode_detail === "update") ? true : false;
|
|
$form = new Form($this->app);
|
|
$tlembur = $form->textbox("_", "LEMBUR", $atabel['LEMBUR'], $benable, false, "double", "nilai lembur harian");
|
|
$tbonus1 = $form->textbox("_", "BONUS1", $atabel['BONUS1'], $benable, false, "double", "nilai bonus mingguan");
|
|
$tbonus2 = $form->textbox("_", "BONUS2", $atabel['BONUS2'], $benable, false, "double", "nilai bonus bulanan");
|
|
$ajson['html'] = '
|
|
<div class="row mb-1">
|
|
<label class="col-sm-6 col-lg-5 col-form-label" for="LEMBUR">Lembur Harian</label>
|
|
<div class="col">'.$tlembur.'</div>
|
|
</div>
|
|
<div class="row mb-1">
|
|
<label class="col-sm-6 col-lg-5 col-form-label" for="BONUS1">Bonus Mingguan</label>
|
|
<div class="col">'.$tbonus1.'</div>
|
|
</div>
|
|
<div class="row mb-1">
|
|
<label class="col-sm-6 col-lg-5 col-form-label" for="BONUS2">Bonus Bulanan</label>
|
|
<div class="col">'.$tbonus2.'</div>
|
|
</div>
|
|
<input type="hidden" id="REG_ID" value="'.$atabel['REG_ID'].'" >
|
|
<input type="hidden" id="mode_detail" value="'.$this->mode_detail.'" >';
|
|
$this->app->json($ajson);
|
|
}
|
|
|
|
public function index() {
|
|
$this->app->json(['html' => '<div id="divMaster"> </div>' ]);
|
|
}
|
|
}
|