661 lines
24 KiB
PHP
661 lines
24 KiB
PHP
<?php
|
|
class Summaryfisik extends MY_Controller
|
|
{
|
|
var $db;
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
echo "SUMMARY FISIK API";
|
|
}
|
|
|
|
function search()
|
|
{
|
|
try {
|
|
if (!$this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$prm = $this->sys_input;
|
|
$userid = $this->sys_user['M_UserID'];
|
|
|
|
$search = "";
|
|
if (isset($prm["search"])) {
|
|
$search = trim($prm["search"]);
|
|
if ($search != "") {
|
|
$search = "%" . $prm["search"] . "%";
|
|
} else {
|
|
$search = "%%";
|
|
}
|
|
}
|
|
|
|
$number_offset = 0;
|
|
$number_limit = 10;
|
|
|
|
if ($prm["current_page"] > 0) {
|
|
$number_offset = ($prm["current_page"] - 1) * $number_limit;
|
|
}
|
|
|
|
$sql_total = "SELECT count(*) as total FROM mcu_fisiksummary
|
|
LEFT JOIN mcu_kelainan ON Mcu_FisikSummaryMcu_KelainanID = Mcu_KelainanID
|
|
AND Mcu_KelainanIsActive = 'Y'
|
|
LEFT JOIN mcu_fitness_category ON Mcu_FisikSummaryMcu_FitnessCategoryID = Mcu_FitnessCategoryID
|
|
AND Mcu_FitnessCategoryIsActive = 'Y'
|
|
WHERE Mcu_FisikSummaryIsActive = 'Y'
|
|
AND (Mcu_KelainanName LIKE ? OR CONCAT(Mcu_FitnessCategoryName,' ','(',Mcu_FitnessCategoryEng,')') LIKE ?)";
|
|
$qry_total = $this->db->query($sql_total, [$search, $search]);
|
|
$last_qry = $this->db->last_query();
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($qry_total) {
|
|
$tot_count = $qry_total->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count / $number_limit);
|
|
} else {
|
|
$this->db->trans_rollback();
|
|
$message['last_qry'] = $last_qry;
|
|
$this->sys_error_db("mcu summary fisik count error", $this->db);
|
|
exit;
|
|
}
|
|
|
|
$sql = "SELECT Mcu_FisikSummaryID,
|
|
Mcu_FisikSummaryMcu_KelainanID,
|
|
Mcu_KelainanID,
|
|
Mcu_KelainanName,
|
|
Mcu_KelainanClasification,
|
|
Mcu_FisikSummaryType,
|
|
Mcu_FitnessCategoryID,
|
|
Mcu_FitnessCategoryName,
|
|
Mcu_FitnessCategoryEng,
|
|
CONCAT(Mcu_FitnessCategoryName,' ','(',Mcu_FitnessCategoryEng,')') as fitnessname
|
|
FROM mcu_fisiksummary
|
|
LEFT JOIN mcu_kelainan ON Mcu_FisikSummaryMcu_KelainanID = Mcu_KelainanID
|
|
AND Mcu_KelainanIsActive = 'Y'
|
|
LEFT JOIN mcu_fitness_category ON Mcu_FisikSummaryMcu_FitnessCategoryID = Mcu_FitnessCategoryID
|
|
AND Mcu_FitnessCategoryIsActive = 'Y'
|
|
WHERE Mcu_FisikSummaryIsActive = 'Y'
|
|
AND (Mcu_KelainanName LIKE ? OR CONCAT(Mcu_FitnessCategoryName,' ','(',Mcu_FitnessCategoryEng,')') LIKE ?)
|
|
LIMIT ? OFFSET ?";
|
|
|
|
$qry = $this->db->query($sql, [$search, $search, $number_limit, $number_offset]);
|
|
$last_qry = $this->db->last_query();
|
|
if (!$qry) {
|
|
$message = $this->db->error();
|
|
$message['last_qry'] = $last_qry;
|
|
$this->sys_error_db("mcu summary fisik select error", $this->db);
|
|
exit;
|
|
}
|
|
$rows = $qry->result_array();
|
|
$result = [
|
|
"total_page" => $tot_page,
|
|
"total" => $tot_count,
|
|
"records" => $rows,
|
|
"last_qry" => $last_qry
|
|
];
|
|
$this->sys_ok($result);
|
|
} catch (Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
|
|
function searchkelainan()
|
|
{
|
|
try {
|
|
if (!$this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$prm = $this->sys_input;
|
|
$userid = $this->sys_user['M_UserID'];
|
|
|
|
$number_limit = 10;
|
|
$tot_count = 0;
|
|
|
|
$search = "";
|
|
if (isset($prm['search'])) {
|
|
$search = trim($prm["search"]);
|
|
if ($search != "") {
|
|
$search = '%' . $prm['search'] . '%';
|
|
} else {
|
|
$search = '%%';
|
|
}
|
|
}
|
|
|
|
$sql_total = "SELECT count(*) as total
|
|
FROM mcu_kelainan
|
|
WHERE Mcu_KelainanIsActive = 'Y'
|
|
AND (Mcu_KelainanName LIKE ?)
|
|
LIMIT ?";
|
|
$qry_total = $this->db->query($sql_total, [$search, $number_limit]);
|
|
if ($qry_total) {
|
|
$tot_count = $qry_total->result_array()[0]["total"];
|
|
} else {
|
|
$this->db->trans_rollback();
|
|
$this->sys_error_db("kelainan count");
|
|
exit;
|
|
}
|
|
|
|
$sql_search = "SELECT Mcu_KelainanID,
|
|
Mcu_KelainanName,
|
|
Mcu_KelainanClasification
|
|
FROM mcu_kelainan
|
|
WHERE Mcu_KelainanIsActive = 'Y'
|
|
AND (Mcu_KelainanName LIKE ?)
|
|
LIMIT ?";
|
|
$qry_search = $this->db->query($sql_search, [$search, $number_limit]);
|
|
if ($qry_search) {
|
|
$rows = $qry_search->result_array();
|
|
} else {
|
|
$this->db->trans_rollback();
|
|
$this->sys_error_db("kelainan select error", $this->db);
|
|
exit;
|
|
}
|
|
|
|
$result = array(
|
|
"total" => $tot_count,
|
|
"total_display" => sizeof($rows),
|
|
"records" => $rows
|
|
);
|
|
$this->sys_ok($result);
|
|
} catch (Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
|
|
function getfitness()
|
|
{
|
|
try {
|
|
if (!$this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$this->db->trans_begin();
|
|
$prm = $this->sys_input;
|
|
$userid = $this->sys_user['M_UserID'];
|
|
|
|
$sql = "SELECT Mcu_FitnessCategoryID,
|
|
Mcu_FitnessCategoryName,
|
|
Mcu_FitnessCategoryEng,
|
|
CONCAT(Mcu_FitnessCategoryName,' ','(',Mcu_FitnessCategoryEng,')') as fitnessname,
|
|
Mcu_FitnessCategoryLevel
|
|
FROM mcu_fitness_category
|
|
WHERE Mcu_FitnessCategoryIsActive = 'Y'";
|
|
$qry = $this->db->query($sql);
|
|
if ($qry) {
|
|
$rows = $qry->result_array();
|
|
} else {
|
|
$this->sys_error_db("mcu fitness error", $this->db);
|
|
}
|
|
|
|
$result = array("records" => $rows, "total_display" => sizeof($rows));
|
|
$this->sys_ok($result);
|
|
} catch (Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
|
|
function addnewsummaryfisik()
|
|
{
|
|
try {
|
|
if (!$this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$this->db->trans_begin();
|
|
$prm = $this->sys_input;
|
|
$userid = $this->sys_user['M_UserID'];
|
|
|
|
$kelainanId = $prm['kelainanId'];
|
|
$fitnessId = $prm['fitnessId'];
|
|
$type = $prm['type'];
|
|
|
|
if ($kelainanId == null || $fitnessId == null) {
|
|
$errors = array();
|
|
if ($kelainanId == null) {
|
|
array_push($errors, array('field' => 'Fitness', 'msg' => 'Kelainan dipilih dulu dong'));
|
|
}
|
|
if ($fitnessId == null) {
|
|
array_push($errors, array('field' => 'Fitness', 'msg' => 'Fitness dipilih dulu dong'));
|
|
}
|
|
$result = array("total" => -1, "errors" => $errors, "records" => 0);
|
|
$this->sys_ok($result);
|
|
} else {
|
|
if ($prm['xid'] == 0) {
|
|
$sql = "INSERT INTO mcu_fisiksummary(
|
|
Mcu_FisikSummaryMcu_KelainanID,
|
|
Mcu_FisikSummaryMcu_FitnessCategoryID,
|
|
Mcu_FisikSummaryType,
|
|
Mcu_FisikSummaryIsActive,
|
|
Mcu_FisikSummaryCreated,
|
|
Mcu_FisikSummaryCreatedUserID) VALUES(?,?,?,'Y',NOW(),?)";
|
|
$qry = $this->db->query($sql, array(
|
|
$kelainanId,
|
|
$fitnessId,
|
|
$type,
|
|
$userid
|
|
));
|
|
|
|
if (!$qry) {
|
|
$this->sys_error_db("mcu fisik summary insert", $this->db);
|
|
exit;
|
|
}
|
|
|
|
$this->db->trans_commit();
|
|
$rst = array(
|
|
"total" => 1,
|
|
"records" => array("xid" => 0)
|
|
);
|
|
$this->sys_ok($rst);
|
|
}
|
|
}
|
|
} catch (Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
|
|
function updatesummaryfisik()
|
|
{
|
|
try {
|
|
if (!$this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$this->db->trans_begin();
|
|
$prm = $this->sys_input;
|
|
$userid = $this->sys_user['M_UserID'];
|
|
|
|
$kelainanId = $prm['kelainanId'];
|
|
$fitnessId = $prm['fitnessId'];
|
|
$type = $prm['type'];
|
|
|
|
if ($kelainanId == null || $fitnessId == null) {
|
|
$errors = array();
|
|
if ($kelainanId == null) {
|
|
array_push($errors, array('field' => 'Fitness', 'msg' => 'Kelainan dipilih dulu dong'));
|
|
}
|
|
if ($fitnessId == null) {
|
|
array_push($errors, array('field' => 'Fitness', 'msg' => 'Fitness dipilih dulu dong'));
|
|
}
|
|
$result = array("total" => -1, "errors" => $errors, "records" => 0);
|
|
$this->sys_ok($result);
|
|
} else {
|
|
if ($prm['xid'] != 0) {
|
|
$sql = "UPDATE mcu_fisiksummary SET
|
|
Mcu_FisikSummaryMcu_KelainanID = ?,
|
|
Mcu_FisikSummaryMcu_FitnessCategoryID = ?,
|
|
Mcu_FisikSummaryType = ?
|
|
WHERE Mcu_FisikSummaryID = ?";
|
|
$qry = $this->db->query($sql, array(
|
|
$kelainanId,
|
|
$fitnessId,
|
|
$type,
|
|
$prm['xid']
|
|
));
|
|
|
|
if (!$qry) {
|
|
$this->sys_error_db("mcu fisik summary update", $this->db);
|
|
exit;
|
|
}
|
|
|
|
$this->db->trans_commit();
|
|
$rst = array(
|
|
"total" => 1,
|
|
"records" => array("xid" => 0)
|
|
);
|
|
$this->sys_ok($rst);
|
|
}
|
|
}
|
|
} catch (Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
|
|
function deletesummaryfisik()
|
|
{
|
|
try {
|
|
if (!$this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$this->db->trans_begin();
|
|
$prm = $this->sys_input;
|
|
$userid = $this->sys_user['M_UserID'];
|
|
|
|
$sql = "UPDATE mcu_fisiksummary SET
|
|
Mcu_FisikSummaryIsActive = 'N'
|
|
WHERE Mcu_FisikSummaryID = ?";
|
|
$qry = $this->db->query($sql, array(
|
|
$prm['id']
|
|
));
|
|
|
|
if (!$qry) {
|
|
$this->sys_error_db("fisik summary delete");
|
|
exit;
|
|
}
|
|
|
|
$this->db->trans_commit();
|
|
$result = array("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
} catch (Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
|
|
function searchdetail()
|
|
{
|
|
try {
|
|
if (!$this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
|
|
$prm = $this->sys_input;
|
|
$userid = $this->sys_user['M_UserID'];
|
|
|
|
$search = "";
|
|
if (isset($prm["search"])) {
|
|
$search = trim($prm["search"]);
|
|
if ($search != "") {
|
|
$search = "%" . $prm["search"] . "%";
|
|
} else {
|
|
$search = "%%";
|
|
}
|
|
}
|
|
|
|
$number_offset = 0;
|
|
$number_limit = 10;
|
|
|
|
if ($prm["current_page"] > 0) {
|
|
$number_offset = ($prm["current_page"] - 1) * $number_limit;
|
|
}
|
|
|
|
$fifiksummaryId = $prm["fifiksummaryId"];
|
|
|
|
if ($fifiksummaryId != 0) {
|
|
$filter = " AND Mcu_FisikSummaryID = $fifiksummaryId";
|
|
}
|
|
|
|
$sql_total = "SELECT count(*) as total
|
|
FROM mcu_fisiksummarydetail
|
|
JOIN mcu_fisiksummary ON Mcu_FisikSummaryDetailMcu_FisikSummaryID = Mcu_FisikSummaryID
|
|
AND Mcu_FisikSummaryIsActive = 'Y'
|
|
LEFT JOIN fisik_template_code ON Mcu_FisikSummaryDetailCode = FisikTemplateCodeName
|
|
WHERE Mcu_FisikSummaryDetailIsActive = 'Y'
|
|
$filter
|
|
AND (Mcu_FisikSummaryDetailCode LIKE ? OR Mcu_FisikSummaryDetailValue LIKE ?)";
|
|
$qry_total = $this->db->query($sql_total, [$search, $search]);
|
|
$last_qry = $this->db->last_query();
|
|
$tot_count = 0;
|
|
$tot_page = 0;
|
|
if ($qry_total) {
|
|
$tot_count = $qry_total->result_array()[0]["total"];
|
|
$tot_page = ceil($tot_count / $number_limit);
|
|
} else {
|
|
$this->db->trans_rollback();
|
|
$message['last_qry'] = $last_qry;
|
|
$this->sys_error_db("mcu summary fisik detail count error", $this->db);
|
|
exit;
|
|
}
|
|
|
|
$sql = "SELECT Mcu_FisikSummaryDetailID,
|
|
Mcu_FisikSummaryDetailCode,
|
|
Mcu_FisikSummaryDetailType,
|
|
Mcu_FisikSummaryDetailValue,
|
|
FisikTemplateCodeID,
|
|
FisikTemplateCodeName,
|
|
FisikTemplateCodeLabel,
|
|
CONCAT(FisikTemplateCodeLabel,' ','[',FisikTemplateCodeName,']') AS templatecodename
|
|
FROM mcu_fisiksummarydetail
|
|
JOIN mcu_fisiksummary ON Mcu_FisikSummaryDetailMcu_FisikSummaryID = Mcu_FisikSummaryID
|
|
AND Mcu_FisikSummaryIsActive = 'Y'
|
|
LEFT JOIN fisik_template_code ON Mcu_FisikSummaryDetailCode = FisikTemplateCodeName
|
|
WHERE Mcu_FisikSummaryDetailIsActive = 'Y'
|
|
$filter
|
|
AND (Mcu_FisikSummaryDetailCode LIKE ? OR Mcu_FisikSummaryDetailValue LIKE ?)
|
|
LIMIT ? OFFSET ?";
|
|
$qry = $this->db->query($sql, [$search, $search, $number_limit, $number_offset]);
|
|
$last_qry = $this->db->last_query();
|
|
if (!$qry) {
|
|
$message = $this->db->error();
|
|
$message['last_qry'] = $last_qry;
|
|
$this->sys_error_db("mcu summary fisik detail select error", $this->db);
|
|
exit;
|
|
}
|
|
$rows = $qry->result_array();
|
|
$result = [
|
|
"total_page" => $tot_page,
|
|
"total" => $tot_count,
|
|
"records" => $rows,
|
|
"last_qry" => $last_qry
|
|
];
|
|
$this->sys_ok($result);
|
|
} catch (Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
|
|
function searchtemplatecode()
|
|
{
|
|
try {
|
|
if (!$this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$prm = $this->sys_input;
|
|
$userid = $this->sys_user['M_UserID'];
|
|
|
|
$number_limit = 10;
|
|
$tot_count = 0;
|
|
|
|
$search = "";
|
|
if (isset($prm['search'])) {
|
|
$search = trim($prm["search"]);
|
|
if ($search != "") {
|
|
$search = '%' . $prm['search'] . '%';
|
|
} else {
|
|
$search = '%%';
|
|
}
|
|
}
|
|
|
|
$sql_total = "SELECT count(*) as total
|
|
FROM fisik_template_code
|
|
WHERE FisikTemplateCodeIsActive = 'Y'
|
|
AND (CONCAT(FisikTemplateCodeLabel,' ','[',FisikTemplateCodeName,']') LIKE ?)";
|
|
$qry_total = $this->db->query($sql_total, [$search]);
|
|
if ($qry_total) {
|
|
$tot_count = $qry_total->result_array()[0]["total"];
|
|
} else {
|
|
$this->db->trans_rollback();
|
|
$this->sys_error_db("fisik_template_code count");
|
|
exit;
|
|
}
|
|
|
|
$sql_search = "SELECT FisikTemplateCodeID,
|
|
FisikTemplateCodeName,
|
|
FisikTemplateCodeLabel,
|
|
CONCAT(FisikTemplateCodeLabel,' ','[',FisikTemplateCodeName,']') AS templatecodename
|
|
FROM fisik_template_code
|
|
WHERE FisikTemplateCodeIsActive = 'Y'
|
|
AND (CONCAT(FisikTemplateCodeLabel,' ','[',FisikTemplateCodeName,']') LIKE ?)";
|
|
$qry_search = $this->db->query($sql_search, [$search]);
|
|
if ($qry_search) {
|
|
$rows = $qry_search->result_array();
|
|
} else {
|
|
$this->db->trans_rollback();
|
|
$this->sys_error_db("fisik_template_code select error", $this->db);
|
|
exit;
|
|
}
|
|
|
|
$result = array(
|
|
"total" => $tot_count,
|
|
"total_display" => sizeof($rows),
|
|
"records" => $rows
|
|
);
|
|
$this->sys_ok($result);
|
|
} catch (Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
|
|
function addnewdetail()
|
|
{
|
|
|
|
try {
|
|
if (!$this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$this->db->trans_begin();
|
|
$prm = $this->sys_input;
|
|
$userid = $this->sys_user['M_UserID'];
|
|
|
|
$fisiksummaryId = $prm["fisiksummaryId"];
|
|
$code = $prm["code"];
|
|
$type = $prm["type"];
|
|
$value = $prm["value"];
|
|
|
|
if ($fisiksummaryId == 0) {
|
|
$errors = array();
|
|
if ($fisiksummaryId == 0) {
|
|
array_push($errors, array('field' => 'Summary fisik', 'msg' => 'Anda belum memilih summary fisik'));
|
|
}
|
|
$result = array("total" => -1, "errors" => $errors, "records" => 0);
|
|
$this->sys_ok($result);
|
|
} else {
|
|
$sql = "INSERT INTO mcu_fisiksummarydetail(
|
|
Mcu_FisikSummaryDetailMcu_FisikSummaryID,
|
|
Mcu_FisikSummaryDetailCode,
|
|
Mcu_FisikSummaryDetailType,
|
|
Mcu_FisikSummaryDetailValue,
|
|
Mcu_FisikSummaryDetailCreated,
|
|
Mcu_FisikSummaryDetailUserID) VALUES(?,?,?,?,NOW(),?)";
|
|
$qry = $this->db->query($sql, array(
|
|
$fisiksummaryId,
|
|
$code,
|
|
$type,
|
|
$value,
|
|
$userid
|
|
));
|
|
|
|
if (!$qry) {
|
|
$this->sys_error_db("mcu_fisiksummarydetail insert", $this->db);
|
|
exit;
|
|
}
|
|
|
|
$this->db->trans_commit();
|
|
$rst = array(
|
|
"total" => 1,
|
|
"records" => array("xid" => 0)
|
|
);
|
|
$this->sys_ok($rst);
|
|
}
|
|
} catch (Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
|
|
function updatedetail()
|
|
{
|
|
|
|
try {
|
|
if (!$this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$this->db->trans_begin();
|
|
$prm = $this->sys_input;
|
|
$userid = $this->sys_user['M_UserID'];
|
|
|
|
$fisiksummaryId = $prm["fisiksummaryId"];
|
|
$code = $prm["code"];
|
|
$type = $prm["type"];
|
|
$value = $prm["value"];
|
|
|
|
if ($fisiksummaryId == 0) {
|
|
$errors = array();
|
|
if ($fisiksummaryId == 0) {
|
|
array_push($errors, array('field' => 'Summary fisik', 'msg' => 'Anda belum memilih summary fisik'));
|
|
}
|
|
$result = array("total" => -1, "errors" => $errors, "records" => 0);
|
|
$this->sys_ok($result);
|
|
} else {
|
|
$sql = "UPDATE mcu_fisiksummarydetail SET
|
|
Mcu_FisikSummaryDetailMcu_FisikSummaryID = ?,
|
|
Mcu_FisikSummaryDetailCode = ?,
|
|
Mcu_FisikSummaryDetailType = ?,
|
|
Mcu_FisikSummaryDetailValue = ?,
|
|
Mcu_FisikSummaryDetailUserID = ?
|
|
WHERE Mcu_FisikSummaryDetailID = ?";
|
|
$qry = $this->db->query($sql, array(
|
|
$fisiksummaryId,
|
|
$code,
|
|
$type,
|
|
$value,
|
|
$userid,
|
|
$prm["id"]
|
|
));
|
|
|
|
if (!$qry) {
|
|
$this->sys_error_db("mcu_fisiksummarydetail update", $this->db);
|
|
exit;
|
|
}
|
|
|
|
$this->db->trans_commit();
|
|
$rst = array(
|
|
"total" => 1,
|
|
"records" => array("xid" => 0)
|
|
);
|
|
$this->sys_ok($rst);
|
|
}
|
|
} catch (Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
|
|
function deletedetail()
|
|
{
|
|
try {
|
|
if (!$this->isLogin) {
|
|
$this->sys_error("Invalid Token");
|
|
exit;
|
|
}
|
|
$this->db->trans_begin();
|
|
$prm = $this->sys_input;
|
|
$userid = $this->sys_user['M_UserID'];
|
|
|
|
$sql = "UPDATE mcu_fisiksummarydetail SET
|
|
Mcu_FisikSummaryDetailIsActive = 'N',
|
|
Mcu_FisikSummaryDetailUserID = ?
|
|
WHERE Mcu_FisikSummaryDetailID = ?";
|
|
$qry = $this->db->query($sql, array(
|
|
$userid,
|
|
$prm['id']
|
|
));
|
|
|
|
if (!$qry) {
|
|
$this->sys_error_db("fisik mcu_fisiksummarydetail delete");
|
|
exit;
|
|
}
|
|
|
|
$this->db->trans_commit();
|
|
$result = array("total" => 1, "records" => array("xid" => 0));
|
|
$this->sys_ok($result);
|
|
} catch (Exception $exc) {
|
|
$message = $exc->getMessage();
|
|
$this->sys_error($message);
|
|
}
|
|
}
|
|
}
|