3Z4LPN - add ais monitoring transaction v4
This commit is contained in:
804
test/vuex/ais-monitoring-transaction-v4/Transaction.php
Normal file
804
test/vuex/ais-monitoring-transaction-v4/Transaction.php
Normal file
@@ -0,0 +1,804 @@
|
||||
<?php
|
||||
class Transaction extends MY_Controller
|
||||
{
|
||||
|
||||
var $db_onedev;
|
||||
public function index()
|
||||
{
|
||||
echo "Transaction API";
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->db_onedev = $this->load->database("onedev", true);
|
||||
$this->db_log = $this->load->database("log", true);
|
||||
$this->load->helper(array('form', 'url'));
|
||||
}
|
||||
|
||||
public function error_log($data,$userid=999)
|
||||
{
|
||||
|
||||
$sql = "INSERT INTO ais_error_log (
|
||||
AisErrorLogFnName,
|
||||
AisErrorLogMessage,
|
||||
AisErrorLogQuery,
|
||||
AisErrorLogJson,
|
||||
AisErrorLogUserID,
|
||||
AisErrorLogCreated
|
||||
)
|
||||
VALUES(
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
NOW()
|
||||
)";
|
||||
$qry = $this->db_log->query($sql, array($data['fn_name'],$data['message'],$data['query'],$data['json'],$userid));
|
||||
//echo $this->db_log->last_query();
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic POST request function
|
||||
* @param string $url API endpoint URL
|
||||
* @param array $data Request payload
|
||||
* @param array $headers Custom headers (optional)
|
||||
* @return array Response from API
|
||||
*/
|
||||
public function post_request($url, $data = array(), $headers = array())
|
||||
{
|
||||
// Default headers
|
||||
$default_headers = array(
|
||||
'Content-Type: application/json'
|
||||
);
|
||||
|
||||
// Merge custom headers with default headers
|
||||
$final_headers = array_merge($default_headers, $headers);
|
||||
|
||||
// Initialize cURL
|
||||
$ch = curl_init();
|
||||
|
||||
// Set cURL options
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $final_headers);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
|
||||
// Execute cURL request
|
||||
$response = curl_exec($ch);
|
||||
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
$error = curl_error($ch);
|
||||
|
||||
// Close cURL
|
||||
curl_close($ch);
|
||||
|
||||
// Prepare result
|
||||
$result = array(
|
||||
'success' => false,
|
||||
'http_code' => $http_code,
|
||||
'response' => null,
|
||||
'error' => null
|
||||
);
|
||||
|
||||
if ($error) {
|
||||
$result['error'] = $error;
|
||||
} else {
|
||||
$result = json_decode($response, true);
|
||||
$result['success'] = true;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function get_request($url, $headers = array())
|
||||
{
|
||||
// Retrieve configuration
|
||||
$config = $this->get_config();
|
||||
$token = $config['AisConfigAuthToken'] ?? 'default-token';
|
||||
$header_token = $config['AisConfigHeaderToken'];
|
||||
|
||||
// Default headers based on the curl command
|
||||
$default_headers = array(
|
||||
'Header-Token: ' . $header_token,
|
||||
'Authorization: Bearer ' . $token
|
||||
);
|
||||
|
||||
// Merge custom headers with default headers
|
||||
$final_headers = array_merge($default_headers, $headers);
|
||||
|
||||
// Initialize cURL
|
||||
$ch = curl_init();
|
||||
|
||||
// Set cURL options
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_HTTPGET, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $final_headers);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||
|
||||
// Execute cURL request
|
||||
$response = curl_exec($ch);
|
||||
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
$error = curl_error($ch);
|
||||
|
||||
// Close cURL
|
||||
curl_close($ch);
|
||||
|
||||
// Prepare result
|
||||
$result = array(
|
||||
'success' => false,
|
||||
'http_code' => $http_code,
|
||||
'response' => null,
|
||||
'error' => null
|
||||
);
|
||||
|
||||
if ($error) {
|
||||
$result['error'] = $error;
|
||||
} else {
|
||||
$decoded = json_decode($response, true);
|
||||
$result['response'] = $decoded;
|
||||
// Check if response is successful based on http code
|
||||
if ($http_code === 200) {
|
||||
$result['success'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function get_config()
|
||||
{
|
||||
$sql = "SELECT * FROM ais_config LIMIT 1";
|
||||
$qry = $this->db_onedev->query($sql);
|
||||
$dt_config = $qry->row_array();
|
||||
return $dt_config;
|
||||
}
|
||||
|
||||
/**
|
||||
* POST request to auth API
|
||||
* @param string $username Username for authentication
|
||||
* @param string $password Password for authentication
|
||||
* @return array Response from API
|
||||
*/
|
||||
public function post_auth()
|
||||
{
|
||||
$dt_config = $this->get_config();
|
||||
$baseUrl = $dt_config['AisConfigBaseUrl'];
|
||||
$url = $baseUrl.'/api/auth/auth.php';
|
||||
$headers = array(
|
||||
'Header-Token: '.$dt_config['AisConfigHeaderToken']
|
||||
);
|
||||
|
||||
$username = $dt_config['AisConfigUsername'];
|
||||
$password = $dt_config['AisConfigPassword'];
|
||||
|
||||
$data = array(
|
||||
'username' => $username,
|
||||
'password' => $password
|
||||
);
|
||||
|
||||
$result = $this->post_request($url, $data, $headers);
|
||||
$sql = "INSERT INTO ais_login_log(
|
||||
AisLoginLogUsername,
|
||||
AisLoginLogPassword,
|
||||
AisLoginLogHeaderToken,
|
||||
AisLoginLogResult,
|
||||
AisLoginLogCreated
|
||||
)
|
||||
VALUES(
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
NOW()
|
||||
)";
|
||||
$qry = $this->db_log->query($sql, array($username,$password,$dt_config['AisConfigHeaderToken'],json_encode($result)));
|
||||
|
||||
|
||||
if(!$qry){
|
||||
$this->error_log(array('fn_name'=>'post_auth','message'=>'ais_login_log insert','query'=>$sql,'json'=>json_encode($result)),999);
|
||||
exit;
|
||||
}
|
||||
//print_r($result);
|
||||
//exit;
|
||||
// Check if success
|
||||
if(!$result['success']){
|
||||
$this->error_log(array('fn_name'=>'post_auth','message'=>'failed auth','query'=>'','json'=>json_encode($result)),999);
|
||||
$errors = array('status' => 'error','message' => 'Gagal Login');
|
||||
return $errors;
|
||||
|
||||
}else{
|
||||
// Update token
|
||||
$token = $result['data']['token'];;
|
||||
$sql = "UPDATE ais_config SET AisConfigAuthToken = ? WHERE AisConfigID = 1";
|
||||
$qry = $this->db_onedev->query($sql, array($token));
|
||||
//echo $this->db_onedev->last_query();
|
||||
//exit;
|
||||
if(!$qry){
|
||||
$this->error_log(array('fn_name'=>'post_auth','message'=>'ais_config update','query'=>$sql,'json'=>''),999);
|
||||
$errors = array('status' => 'error','message' => 'Gagal Update Token');
|
||||
return $errors;
|
||||
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
function post_transaction($labnum='',$xdate=null)
|
||||
{
|
||||
// Auth Login
|
||||
$login = $this->post_auth();
|
||||
if (!$login['success']) {
|
||||
$this->error_log(array('fn_name' => 'post_transaction', 'message' => 'failed auth', 'query' => '', 'json' => json_encode($login)), 555);
|
||||
$errors = array('status' => 'error', 'message' => 'Gagal Login');
|
||||
echo json_encode($errors);
|
||||
exit;
|
||||
}
|
||||
// Get config
|
||||
$dt_config = $this->get_config();
|
||||
$baseUrl = $dt_config['AisConfigBaseUrl'];
|
||||
$url = $baseUrl . '/api/transaction_full/transaksi.php';
|
||||
|
||||
$headers = array(
|
||||
'Header-Token: ' . $dt_config['AisConfigHeaderToken'],
|
||||
'Authorization: Bearer ' . $dt_config['AisConfigAuthToken']
|
||||
);
|
||||
|
||||
|
||||
|
||||
if($labnum == ''){
|
||||
$xdate = $xdate == null ? date('Y-m-d') : $xdate;
|
||||
}
|
||||
// Get data
|
||||
$sql = "SELECT T_OrderHeaderID,
|
||||
T_OrderHeaderTotal as Total,
|
||||
T_OrderHeaderLabNumber as RegID,
|
||||
Mgm_McuM_BranchID as mgm_mcu_m_branch_id,
|
||||
M_PatientNoReg as MEDRECID,
|
||||
T_OrderHeaderDate as Tanggal,
|
||||
T_OrderHeaderDate as PulangTanggal,
|
||||
IF(Mgm_McuM_BranchID = 100,'',CorporateCode) as PerusahaanID,
|
||||
IF(Mgm_McuM_BranchID = 100,'',CorporateCode) as AsuransiID,
|
||||
T_PriceHeaderCode as GroupTarifID,
|
||||
M_PatientName as Nama,
|
||||
M_PatientIdentifierValue as NIK,
|
||||
DATE_FORMAT(M_PatientDOB, '%Y-%m-%d %H:%i:%s') as TglLahir,
|
||||
IF(M_PatientGender = 'male','L','P') as JnsKelamin,
|
||||
'' as NomorPolis,
|
||||
'' as NomerJaminan,
|
||||
'2' as JenisRegID,
|
||||
IF(Mgm_McuM_BranchID = 100,0,1) as JenisPasienID,
|
||||
'LAB-WESTERINDO-01' as DepartemenID,
|
||||
'Y' as Pulang,
|
||||
'Y' as BolehPulang,
|
||||
'' as Catatan,
|
||||
'Y' as Verified,
|
||||
'LABKLINIK' as KelasID,
|
||||
M_UserEmail as LoginBuat,
|
||||
T_OrderHeaderCreated as TanggalBuat,
|
||||
branch_order.M_BranchAis_branch_code as BranchCode,
|
||||
CorporateTypeais_pillar_code as PillarCode,
|
||||
'4569' as SiteCenterCode,
|
||||
M_UserEmail as VerifiedBy,
|
||||
T_OrderHeaderCreated as VerifiedDate,
|
||||
'' as TrxLayanan,
|
||||
'' as TrxItem,
|
||||
'' as TrxItemReturn,
|
||||
'' as RegpasNominal,
|
||||
'' as Trxtt,
|
||||
'' as TrxBayar,
|
||||
'' as TrxLain,
|
||||
'' as PaketDispenser
|
||||
FROM t_orderheader
|
||||
JOIN m_branch branch_order ON branch_order.M_BranchID = T_OrderHeaderM_BranchID
|
||||
JOIN m_patient ON M_PatientID = T_OrderHeaderM_PatientID
|
||||
JOIN corporate ON CorporateID = T_OrderHeaderCorporateID
|
||||
JOIN corporate_type ON CorporateTypeID = CorporateTypeID
|
||||
JOIN mgm_mcu ON T_OrderHeaderMgm_McuID = Mgm_McuID -- AND Mgm_McuID = 1566
|
||||
JOIN t_priceheader ON Mgm_McuT_PriceHeaderID = T_PriceHeaderID
|
||||
JOIN m_user ON T_OrderHeaderCreatedUserID = M_UserID
|
||||
LEFT JOIN cpone_log.ais_transaction ON Ais_TransactionOrderHeaderLabNumber = T_OrderHeaderLabNumber AND
|
||||
Ais_TransactionStatus = 'success'
|
||||
WHERE T_OrderHeaderIsActive = 'Y' AND
|
||||
T_OrderHeaderLabNumber = ? AND
|
||||
Ais_TransactionID IS NULL
|
||||
GROUP BY T_OrderHeaderID
|
||||
LIMIT 100";
|
||||
$qry = $this->db_onedev->query($sql, array($labnum));
|
||||
//echo $this->db_onedev->last_query();
|
||||
//exit;
|
||||
if (!$qry) {
|
||||
$this->error_log(array('fn_name' => 'post_transaction', 'message' => 't_orderheader select', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
|
||||
exit;
|
||||
}
|
||||
$raw_data = $qry->result_array();
|
||||
|
||||
$data = array();
|
||||
foreach ($raw_data as $key => $row) {
|
||||
|
||||
$row['TrxLayanan'] = [];
|
||||
$row['TrxItem'] = [];
|
||||
$row['TrxItemReturn'] = [];
|
||||
$row['RegpasNominal'] = [];
|
||||
$row['Trxtt'] = null;
|
||||
$row['TrxBayar'] = [];
|
||||
$row['TrxLain'] = null;
|
||||
$row['PaketDispenser'] = null;
|
||||
|
||||
$layanan = [];
|
||||
$sql = "SELECT * FROM (
|
||||
SELECT T_OrderDetailID as TrxLayananID,
|
||||
case
|
||||
when Nat_GroupID = 1 then '1100'
|
||||
when Nat_GroupID = 2 then '1200'
|
||||
when Nat_GroupID = 3 then '1200'
|
||||
when Nat_GroupID = 4 then '1303'
|
||||
end as ProfitCostCenterCode,
|
||||
'' as TrxDepartemenID,
|
||||
T_OrderDetailCreated as TanggalBuat,
|
||||
T_OrderDetailT_TestSasCode as LayananID,
|
||||
T_OrderDetailT_TestName as LayananName,
|
||||
doctorlab.M_DoctorCode as DokterID,
|
||||
0 as ShareRS,
|
||||
0 as ShareDokter,
|
||||
0 as ShareExternal,
|
||||
0 as ShareLain2,
|
||||
'' as PihakExternal,
|
||||
'' as PihakLain2,
|
||||
'Percentage' as ShareTipe,
|
||||
T_OrderDetailPrice as Harga,
|
||||
1 as Jumlah,
|
||||
1 as Rate,
|
||||
'N' as FOC,
|
||||
T_OrderDetailDiscTotal as Diskon,
|
||||
'Absolute' as TipeDiskon,
|
||||
'' as DepartemenID,
|
||||
IF(Mgm_McuM_BranchID = 100,T_OrderDetailTotal,0) as DitanggungPasien,
|
||||
IF(Mgm_McuM_BranchID = 100,0,T_OrderDetailTotal) as DitanggungPenjamin,
|
||||
0 as MarkUpCito,
|
||||
'N' as Cito,
|
||||
T_PacketSasCode as PaketID,
|
||||
'LABKLINIK' as KelasID,
|
||||
'' as TrxLayananDetail,
|
||||
'Y' as Tagihkan
|
||||
FROM t_orderdetail
|
||||
JOIN t_test ON T_TestID = T_OrderDetailT_TestID AND T_TestIsActive = 'Y'
|
||||
JOIN nat_test ON T_TestNat_TestID = Nat_TestID AND Nat_TestIsActive = 'Y'
|
||||
JOIN nat_group ON Nat_GroupID = Nat_TestNat_GroupID AND Nat_GroupIsActive = 'Y'
|
||||
JOIN t_orderdetailorder ON T_OrderDetailT_OrderDetailOrderID = T_OrderDetailOrderID AND
|
||||
T_OrderDetailOrderIsPacket = 'Y' AND T_OrderDetailOrderIsActive = 'Y'
|
||||
JOIN t_packet ON T_OrderDetailOrderT_PacketID = T_PacketID
|
||||
JOIN t_packetdetail ON T_PacketDetailT_PacketID = T_PacketID AND T_PacketDetailT_TestID = T_OrderDetailT_TestID AND
|
||||
T_PacketDetailIsActive = 'Y'
|
||||
JOIN t_orderheader ON T_OrderHeaderID = T_OrderDetailOrderT_OrderHeaderID
|
||||
JOIN mgm_mcu ON T_OrderHeaderMgm_McuID = Mgm_McuID
|
||||
JOIN m_doctor doctorlab ON T_OrderHeaderPjM_DoctorID = M_DoctorID
|
||||
LEFT JOIN f_payment ON T_OrderHeaderID = F_PaymentT_OrderHeaderID AND F_PaymentIsActive = 'Y'
|
||||
WHERE
|
||||
T_OrderDetailT_OrderHeaderID = ? AND
|
||||
T_OrderDetailIsActive = 'Y'
|
||||
UNION
|
||||
SELECT T_OrderDetailID as TrxLayananID,
|
||||
Nat_GroupID as ProfitCostCenterCode,
|
||||
'' as TrxDepartemenID,
|
||||
T_OrderDetailCreated as TanggalBuat,
|
||||
T_OrderDetailT_TestSasCode as LayananID,
|
||||
T_OrderDetailT_TestName as LayananName,
|
||||
doctorlab.M_DoctorCode as DokterID,
|
||||
0 as ShareRS,
|
||||
0 as ShareDokter,
|
||||
0 as ShareExternal,
|
||||
0 as ShareLain2,
|
||||
'' as PihakExternal,
|
||||
'' as PihakLain2,
|
||||
'Percentage' as ShareTipe,
|
||||
T_OrderDetailPrice as Harga,
|
||||
1 as Jumlah,
|
||||
1 as Rate,
|
||||
'N' as FOC,
|
||||
T_OrderDetailDiscTotal as Diskon,
|
||||
'Absolute' as TipeDiskon,
|
||||
'' as DepartemenID,
|
||||
IF(Mgm_McuM_BranchID = 100,T_OrderDetailTotal,0) as DitanggungPasien,
|
||||
IF(Mgm_McuM_BranchID = 100,0,T_OrderDetailTotal) as DitanggungPenjamin,
|
||||
0 as MarkUpCito,
|
||||
'N' as Cito,
|
||||
'' as PaketID,
|
||||
'LABKLINIK' as KelasID,
|
||||
NULL as TrxLayananDetail,
|
||||
'Y' as Tagihkan
|
||||
FROM `t_orderdetailorder`
|
||||
JOIN t_orderdetail ON T_OrderdetailT_OrderHeaderID = T_OrderDetailOrderT_OrderHeaderID AND
|
||||
T_OrderDetailIsActive = 'Y' AND T_OrderDetailT_OrderDetailOrderID = T_OrderDetailOrderID
|
||||
JOIN t_test ON T_TestID = T_OrderDetailT_TestID AND T_TestIsActive = 'Y'
|
||||
JOIN nat_test ON T_TestNat_TestID = Nat_TestID AND Nat_TestIsActive = 'Y'
|
||||
JOIN nat_group ON Nat_GroupID = Nat_TestNat_GroupID AND Nat_GroupIsActive = 'Y'
|
||||
JOIN t_orderheader ON T_OrderHeaderID = T_OrderDetailOrderT_OrderHeaderID
|
||||
JOIN mgm_mcu ON T_OrderHeaderMgm_McuID = Mgm_McuID
|
||||
JOIN m_doctor doctorlab ON T_OrderHeaderPjM_DoctorID = M_DoctorID
|
||||
LEFT JOIN f_payment ON T_OrderHeaderID = F_PaymentT_OrderHeaderID AND F_PaymentIsActive = 'Y'
|
||||
WHERE `T_OrderDetailOrderT_OrderHeaderID` = ? AND `T_OrderDetailOrderIsPacket` = 'N' AND
|
||||
T_OrderDetailOrderIsActive = 'Y'
|
||||
) AS t_orderdetailorder";
|
||||
$qry = $this->db_onedev->query($sql, array($row['T_OrderHeaderID'],$row['T_OrderHeaderID']));
|
||||
|
||||
if (!$qry) {
|
||||
$this->error_log(array('fn_name' => 'post_transaction', 'message' => 't_orderdetail select', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
|
||||
exit;
|
||||
}
|
||||
$total_layanan_debug = 0;
|
||||
$layanan = $qry->result_array();
|
||||
$raw_data[$key]['TrxLayanan'] = [];
|
||||
if(count($layanan) > 0){
|
||||
foreach($layanan as $key_layanan => $row_layanan){
|
||||
$total_layanan_debug += $row_layanan['Harga'];
|
||||
$layanan[$key_layanan]['TrxLayananDetail'] = [];
|
||||
$sql = "SELECT M_DoctorCode, M_DoctorID
|
||||
FROM `so_resultentry`
|
||||
JOIN t_orderdetail ON ? = So_ResultEntryT_OrderDetailID AND T_OrderDetailIsActive = 'Y'
|
||||
JOIN m_doctor ON M_DoctorID = So_ResultEntryM_DoctorID AND M_DoctorIsActive = 'Y'
|
||||
WHERE `So_ResultEntryT_OrderHeaderID` = ? AND
|
||||
`So_ResultEntryIsActive` = 'Y' AND `So_ResultEntryM_DoctorID` > '0'
|
||||
LIMIT 1
|
||||
";
|
||||
$qry = $this->db_onedev->query($sql, array($row_layanan['TrxLayananID'],$row['T_OrderHeaderID']));
|
||||
if (!$qry) {
|
||||
$this->error_log(array('fn_name' => 'post_transaction', 'message' => 'so_resultentry select', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
|
||||
exit;
|
||||
}
|
||||
$get_resultentry = $qry->result_array();
|
||||
if (count($get_resultentry) > 0) {
|
||||
$row_layanan['DokterID'] = $get_resultentry[0]['M_DoctorCode'];
|
||||
}
|
||||
$raw_data[$key]['TrxLayanan'][] = $row_layanan;
|
||||
}
|
||||
}
|
||||
|
||||
$regpasnominal = [];
|
||||
$jumlah_layanan_lab = 0;
|
||||
$sql = "SELECT IFNULL(SUM(T_OrderDetailTotal),0) as total_layanan_lab
|
||||
FROM t_orderdetail
|
||||
JOIN t_test ON T_OrderDetailT_TestID = T_TestID AND T_TestIsActive = 'Y'
|
||||
JOIN nat_test ON T_TestNat_TestID = Nat_TestID AND Nat_TestIsActive = 'Y'
|
||||
JOIN nat_group ON Nat_GroupID = Nat_TestNat_GroupID AND Nat_GroupIsActive = 'Y' AND
|
||||
Nat_GroupID = 1
|
||||
WHERE T_OrderDetailT_OrderHeaderID = ? AND T_OrderDetailIsActive = 'Y'
|
||||
";
|
||||
$qry = $this->db_onedev->query($sql, array($row['T_OrderHeaderID']));
|
||||
//echo $this->db_onedev->last_query();
|
||||
//exit;
|
||||
if (!$qry) {
|
||||
$this->error_log(array('fn_name' => 'post_transaction', 'message' => 't_orderdetail lab select', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
|
||||
exit;
|
||||
}
|
||||
|
||||
$get_layanan_lab = $qry->row_array();
|
||||
$jumlah_layanan_lab = $get_layanan_lab['total_layanan_lab'];
|
||||
|
||||
$jumlah_layanan_radiologi = 0;
|
||||
$sql = "SELECT IFNULL(SUM(T_OrderDetailTotal),0) as total_layanan_radiologi
|
||||
FROM t_orderdetail
|
||||
JOIN t_test ON T_OrderDetailT_TestID = T_TestID AND T_TestIsActive = 'Y'
|
||||
JOIN nat_test ON T_TestNat_TestID = Nat_TestID AND Nat_TestIsActive = 'Y'
|
||||
JOIN nat_group ON Nat_GroupID = Nat_TestNat_GroupID AND Nat_GroupIsActive = 'Y' AND
|
||||
Nat_GroupID = 3
|
||||
WHERE T_OrderDetailT_OrderHeaderID = ? AND T_OrderDetailIsActive = 'Y'
|
||||
";
|
||||
$qry = $this->db_onedev->query($sql, array($row['T_OrderHeaderID']));
|
||||
if (!$qry) {
|
||||
$this->error_log(array('fn_name' => 'post_transaction', 'message' => 't_orderdetail radiologi select', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
|
||||
exit;
|
||||
}
|
||||
$get_layanan_radiologi = $qry->row_array();
|
||||
$jumlah_layanan_radiologi = $get_layanan_radiologi['total_layanan_radiologi'];
|
||||
|
||||
$jumlah_layanan_lain = 0;
|
||||
$sql = "SELECT IFNULL(SUM(T_OrderDetailTotal),0) as total_layanan_lain
|
||||
FROM t_orderdetail
|
||||
JOIN t_test ON T_OrderDetailT_TestID = T_TestID AND T_TestIsActive = 'Y'
|
||||
JOIN nat_test ON T_TestNat_TestID = Nat_TestID AND Nat_TestIsActive = 'Y'
|
||||
JOIN nat_group ON Nat_GroupID = Nat_TestNat_GroupID AND Nat_GroupIsActive = 'Y' AND
|
||||
Nat_GroupID IN (2,4)
|
||||
WHERE T_OrderDetailT_OrderHeaderID = ? AND T_OrderDetailIsActive = 'Y'
|
||||
";
|
||||
$qry = $this->db_onedev->query($sql, array($row['T_OrderHeaderID']));
|
||||
if (!$qry) {
|
||||
$this->error_log(array('fn_name' => 'post_transaction', 'message' => 't_orderdetail lain select', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$get_layanan_lain = $qry->row_array();
|
||||
$jumlah_layanan_lain = $get_layanan_lain['total_layanan_lain'];
|
||||
|
||||
$total_layanan = 0;
|
||||
$sql = "SELECT SUM(T_OrderDetailTotal) as total_layanan, Mgm_McuM_BranchID as BranchID
|
||||
FROM t_orderdetail
|
||||
JOIN t_orderheader ON T_OrderDetailT_OrderHeaderID = T_OrderHeaderID
|
||||
JOIN mgm_mcu ON T_OrderHeaderMgm_McuID = Mgm_McuID
|
||||
WHERE T_OrderDetailT_OrderHeaderID = ? AND T_OrderDetailIsActive = 'Y'
|
||||
";
|
||||
$qry = $this->db_onedev->query($sql, array($row['T_OrderHeaderID']));
|
||||
if (!$qry) {
|
||||
$this->error_log(array('fn_name' => 'post_transaction', 'message' => 't_orderdetail total layanan select', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
|
||||
exit;
|
||||
}
|
||||
$total_layanan = $qry->row_array();
|
||||
$total_layanan = $total_layanan['total_layanan'];
|
||||
|
||||
|
||||
$total_bayar = 0;
|
||||
$sql = "SELECT F_PaymentTotal as total
|
||||
FROM f_payment
|
||||
WHERE F_PaymentT_OrderHeaderID = ? AND F_PaymentIsActive = 'Y'
|
||||
";
|
||||
$qry = $this->db_onedev->query($sql, array($row['T_OrderHeaderID']));
|
||||
if (!$qry) {
|
||||
$this->error_log(array('fn_name' => 'post_transaction', 'message' => 'f_payment select', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
|
||||
exit;
|
||||
}
|
||||
|
||||
$get_total_bayar = $qry->result_array();
|
||||
if (count($get_total_bayar) > 0) {
|
||||
foreach($get_total_bayar as $key_total_bayar => $row_total_bayar){
|
||||
$total_bayar += $row_total_bayar['total'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$mgm_mcu_m_branch_id = $row['mgm_mcu_m_branch_id'];
|
||||
|
||||
$total_ditanggung_pasien = $mgm_mcu_m_branch_id == 100 ? $total_layanan : 0;
|
||||
$total_ditanggung_penjamin = $mgm_mcu_m_branch_id == 100 ? 0 : $total_layanan;
|
||||
|
||||
$regpasnominal = array(
|
||||
"BiayaParamedik" => "0.00",
|
||||
"ParamedikDitanggungPasien" => "0.00",
|
||||
"ParamedikDitanggungPenjamin" => "0.00",
|
||||
"BiayaAdministrasi" => "0",
|
||||
"AdmDitanggungPasien" => "0.00",
|
||||
"AdmDitanggungPenjamin" => "0.00",
|
||||
"BiayaMaterai" => "0.00",
|
||||
"BiayaMateraiDitanggungPasien" => "0.00",
|
||||
"BiayaMateraiDitanggungPenjamin" => "0.00",
|
||||
"JumlahLayanan" => $jumlah_layanan_lain,
|
||||
"JumlahLayananRadiologi" => $jumlah_layanan_radiologi,
|
||||
"JumlahLayananLaboratorium" => $jumlah_layanan_lab,
|
||||
"JumlahItem" => 0,
|
||||
"JumlahItemRetur" => 0,
|
||||
"JumlahTT" => "0.00",
|
||||
"JumlahBiayaLain" => "0.00",
|
||||
"JumlahBayar" => $total_bayar,
|
||||
"TipeDiskonGlobal" => "Absolute",
|
||||
"DiskonGlobal" => "0.00",
|
||||
"TotalDitanggungPasien" => $total_ditanggung_pasien,
|
||||
"TotalDitanggungPenjamin" => $total_ditanggung_penjamin
|
||||
);
|
||||
|
||||
$raw_data[$key]['RegpasNominal'] = array(
|
||||
$regpasnominal
|
||||
);
|
||||
|
||||
//echo $total_bayar;
|
||||
$raw_data[$key]['TrxBayar'] = null;
|
||||
if($total_bayar > 0){
|
||||
$sql = "SELECT M_PatientNoReg as MEDRECID,
|
||||
F_PaymentDetailID as BayarID,
|
||||
IFNULL(F_PaymentDetailAmount,0) as Jumlah,
|
||||
F_PaymentDetailCreated as Tanggal,
|
||||
'Pelunasan' as JenisBayarID,
|
||||
CONCAT(F_PaymentNumber,'.',F_PaymentDetailID) as KwitansiID,
|
||||
CONCAT(F_PaymentDetailM_PaymentTypeID,F_PaymentDetailM_BankAccountID) as TipeBayarID,
|
||||
'N' as Dibatalkan
|
||||
FROM f_paymentdetail
|
||||
JOIN f_payment ON F_PaymentDetailF_PaymentID = F_PaymentID AND F_PaymentIsActive = 'Y'
|
||||
JOIN t_orderheader ON F_PaymentT_OrderHeaderID = T_OrderHeaderID
|
||||
JOIN m_patient ON T_OrderHeaderM_PatientID = M_PatientID AND M_PatientIsActive = 'Y'
|
||||
WHERE
|
||||
F_PaymentT_OrderHeaderID = ? AND F_PaymentDetailIsActive = 'Y'
|
||||
GROUP BY F_PaymentDetailID";
|
||||
$qry = $this->db_onedev->query($sql, array($row['T_OrderHeaderID']));
|
||||
if (!$qry) {
|
||||
$this->error_log(array('fn_name' => 'post_transaction', 'message' => 'f_payment select', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
|
||||
exit;
|
||||
}
|
||||
//echo $this->db_onedev->last_query();
|
||||
//exit;
|
||||
$bayar = $qry->result_array();
|
||||
|
||||
$raw_data[$key]['TrxBayar'] = $bayar;
|
||||
}
|
||||
|
||||
$raw_data[$key]['Trxtt'] = null;
|
||||
$raw_data[$key]['TrxLain'] = null;
|
||||
$raw_data[$key]['PaketDispenser'] = null;
|
||||
$errors = [];
|
||||
|
||||
//echo json_encode($raw_data[$key]);
|
||||
//exit;
|
||||
$result = $this->post_request($url, $raw_data[$key], $headers);
|
||||
|
||||
|
||||
if ($result['status'] == '400') {
|
||||
$sql = "INSERT INTO ais_transaction(
|
||||
Ais_TransactionOrderHeaderLabNumber,
|
||||
Ais_TransactionJson,
|
||||
Ais_TransactionStatus,
|
||||
Ais_TransactionResponse,
|
||||
Ais_TransactionUrl,
|
||||
Ais_TransactionUserID,
|
||||
Ais_TransactionCreated
|
||||
)
|
||||
VALUES(
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
NOW()
|
||||
)";
|
||||
$qry = $this->db_log->query($sql, array(
|
||||
$row['RegID'],
|
||||
json_encode($raw_data[$key]),
|
||||
'error',
|
||||
json_encode($result),
|
||||
$url,
|
||||
555
|
||||
));
|
||||
if (!$qry) {
|
||||
$this->error_log(array('fn_name' => 'post_transaction', 'message' => 'ais_transaction insert', 'query' => $this->db_log->last_query(), 'json' => json_encode($result)), 999);
|
||||
exit;
|
||||
}
|
||||
$this->error_log(array('fn_name' => 'post_transaction', 'message' => 'transaction insert', 'query' => $this->db_onedev->last_query(), 'json' => json_encode($result)), 999);
|
||||
|
||||
$errors[] = array('RegID' => $row['RegID'], 'error' => $result['message']);
|
||||
|
||||
|
||||
}else{
|
||||
//echo 'insert ais_transaction';
|
||||
$sql = "INSERT INTO ais_transaction(
|
||||
Ais_TransactionOrderHeaderLabNumber,
|
||||
Ais_TransactionJson,
|
||||
Ais_TransactionStatus,
|
||||
Ais_TransactionResponse,
|
||||
Ais_TransactionUrl,
|
||||
Ais_TransactionUserID,
|
||||
Ais_TransactionCreated
|
||||
)
|
||||
VALUES(
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
NOW()
|
||||
)";
|
||||
$qry = $this->db_log->query($sql, array(
|
||||
$row['RegID'],
|
||||
json_encode($raw_data[$key]),
|
||||
'success',
|
||||
json_encode($result),
|
||||
$url,
|
||||
555
|
||||
));
|
||||
|
||||
if (!$qry) {
|
||||
$this->error_log(array('fn_name' => 'post_transaction', 'message' => 'ais_transaction insert', 'query' => $this->db_log->last_query(), 'json' => json_encode($result)), 999);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(count($errors) > 0){
|
||||
$success = array('status' => 'error', 'message' => 'Gagal Post Transaction', 'errors' => $errors);
|
||||
echo json_encode($success);
|
||||
exit;
|
||||
}else{
|
||||
$success = array('status' => 'success', 'message' => 'Berhasil Post Transaction');
|
||||
echo json_encode($success);
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function get_transaction()
|
||||
{
|
||||
// Get id from query parameter
|
||||
$id = $this->input->get('id');
|
||||
|
||||
if (empty($id)) {
|
||||
$errors = array('status' => 'error', 'message' => 'ID parameter is required');
|
||||
echo json_encode($errors);
|
||||
exit;
|
||||
}
|
||||
|
||||
$login = $this->post_auth();
|
||||
if (!$login['success']) {
|
||||
$this->error_log(array('fn_name' => 'get_transaction_auth', 'message' => 'failed auth', 'query' => '', 'json' => json_encode($login)), 999);
|
||||
$errors = array('status' => 'error', 'message' => 'Gagal Login');
|
||||
echo json_encode($errors);
|
||||
exit;
|
||||
}
|
||||
|
||||
$dt_config = $this->get_config();
|
||||
$baseUrl = $dt_config['AisConfigBaseUrl'];
|
||||
$url = $baseUrl . '/api/transaksi?id=' . $id;
|
||||
|
||||
|
||||
$result = $this->get_request($url);
|
||||
if (!$result['success']) {
|
||||
$this->error_log(array('fn_name' => 'get_transaction', 'message' => 'failed get transaction', 'query' => '', 'json' => json_encode($result)), 999);
|
||||
$errors = array('status' => 'error', 'message' => 'Gagal Get Transaction');
|
||||
echo json_encode($errors);
|
||||
exit;
|
||||
}
|
||||
|
||||
$data = $result['response']['data'] ?? null;
|
||||
// $data = json_encode($data);
|
||||
$success = array('status' => 'success', 'message' => 'Berhasil Get Transaction', 'data' => $data);
|
||||
echo json_encode($success);
|
||||
exit;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function monitoring_transaction()
|
||||
{
|
||||
|
||||
$sql = "SELECT
|
||||
oh.T_OrderHeaderM_PatientID AS patient_id,
|
||||
p.M_PatientName AS patient_name,
|
||||
oh.T_OrderHeaderLabNumber AS lab_number,
|
||||
b.M_BranchCode AS branch_code,
|
||||
oh.T_OrderHeaderTotal AS total,
|
||||
at.Ais_TransactionStatus,
|
||||
IF(at.Ais_TransactionID IS NULL, 'N', 'Y') AS ais_status
|
||||
FROM t_orderheader oh
|
||||
JOIN m_patient p ON p.M_PatientID = oh.T_OrderHeaderM_PatientID
|
||||
JOIN m_branch b ON b.M_BranchID = oh.T_OrderHeaderM_BranchID
|
||||
LEFT JOIN " . $this->db_log->database . ".ais_transaction at ON at.Ais_TransactionOrderHeaderLabNumber = oh.T_OrderHeaderLabNumber
|
||||
";
|
||||
|
||||
// Ambil start_date dan end_date dari query parameter
|
||||
$start_date = $this->input->get('start_date');
|
||||
$end_date = $this->input->get('end_date');
|
||||
$params = [];
|
||||
|
||||
if ($start_date && $end_date) {
|
||||
$sql .= " WHERE DATE(oh.T_OrderHeaderDate) BETWEEN ? AND ?";
|
||||
$params = [$start_date, $end_date];
|
||||
} else {
|
||||
// Gunakan default jika tidak ada input tanggal
|
||||
$sql .= " WHERE date(oh.T_OrderHeaderDate) BETWEEN '2024-08-01' AND '2024-08-03'";
|
||||
}
|
||||
|
||||
$qry = $this->db_onedev->query($sql, $params);
|
||||
if (!$qry) {
|
||||
$this->error_log(array('fn_name' => 'monitoring_transaction', 'message' => 'select monitoring data failed', 'query' => $this->db_onedev->last_query(), 'json' => ''), 999);
|
||||
echo json_encode(array('status' => 'error', 'message' => 'Gagal mengambil data monitoring.'));
|
||||
exit;
|
||||
}
|
||||
|
||||
$data = $qry->result_array();
|
||||
echo json_encode(array('status' => 'success', 'message' => 'Berhasil mengambil data monitoring.', 'data' => $data));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
269
test/vuex/ais-monitoring-transaction-v4/api/patient.js
Normal file
269
test/vuex/ais-monitoring-transaction-v4/api/patient.js
Normal file
@@ -0,0 +1,269 @@
|
||||
const URL = "/one-api/ais/transactionv4/";
|
||||
const URL_MASTERDATA = "/one-api/ais/masterdata/";
|
||||
|
||||
function getTransactionBaseUrl(isStemcell) {
|
||||
return isStemcell === 'Y'
|
||||
? "/one-api/ais/transactionv5/"
|
||||
: "/one-api/ais/transactionv4/";
|
||||
}
|
||||
|
||||
export async function search(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'patient/search', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function download_data(token,prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL_YANKES + 'trx_order/get_order',{});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch(e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function sendresult(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL_YANKES + 'trx_order/sendresultorder',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch(e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function getlogs(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL_YANKES + 'trx_order/getlogs',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch(e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function monitoring_transaction(prm) {
|
||||
try {
|
||||
prm.token = one_token()
|
||||
var resp = await axios.get(URL+'monitoring_transaction', { params: prm});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
return resp.data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function get_corporate() {
|
||||
try {
|
||||
var resp = await axios.get(URL+'get_corporate');
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
return resp.data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function get_json_response(prm) {
|
||||
try {
|
||||
var resp = await axios.get(URL+'get_json_response', { params: prm });
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
return resp.data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function post_transaction_by_labnumber(prm) {
|
||||
try {
|
||||
console.log('in post_transaction_by_labnumber');
|
||||
var resp = await axios.post(getTransactionBaseUrl(prm.is_stemcell) + 'post_transaction_by_labnumber', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
return resp.data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function re_post_transaction_by_labnumber(prm) {
|
||||
try {
|
||||
var resp = await axios.post(getTransactionBaseUrl(prm.is_stemcell) + 're_post_transaction_by_labnumber', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
return resp.data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function delete_transaction_by_labnumber(prm) {
|
||||
try {
|
||||
prm.token = one_token()
|
||||
var resp = await axios.post(getTransactionBaseUrl(prm.is_stemcell) + 'delete_transaction_by_labnumber', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
return resp.data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function get_medrec_by_noreg(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL_MASTERDATA+'get_medrec_by_noreg', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
return resp.data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function post_medrec_by_noreg(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL_MASTERDATA+'post_medrec_by_noreg', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
return resp.data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function re_post_medrec_by_noreg(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL_MASTERDATA+'re_post_medrec_by_noreg', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
return resp.data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function check_exist_transaction(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL+'check_exist_transaction', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
return resp.data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
170
test/vuex/ais-monitoring-transaction-v4/api/payment.js
Normal file
170
test/vuex/ais-monitoring-transaction-v4/api/payment.js
Normal file
@@ -0,0 +1,170 @@
|
||||
const URL = "/one-api/mockup/fo/cashiernewpayment-v22/";
|
||||
var token = one_token()
|
||||
|
||||
export async function getlanguages(token) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'payment/getlanguages',{token:token});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function lookup_type(token) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'payment/lookup_type',{token:token});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function lookup_banks(token) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'payment/lookup_banks',{token:token});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function lookup_accounts(token) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'payment/lookup_accounts',{token:token});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function searchcard(token,prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'payment/searchcard',{token:token,search:prm});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch(e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function pay(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'payment/pay',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function delete_note(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'payment/delete_note',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function getLocations(prm) {
|
||||
try {
|
||||
prm.token = token
|
||||
var resp = await axios.post(URL + 'payment/getLocations', prm);
|
||||
|
||||
return resp.data
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function save_control(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'payment/save_control', prm);
|
||||
|
||||
return resp.data
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
193
test/vuex/ais-monitoring-transaction-v4/api/test.js
Normal file
193
test/vuex/ais-monitoring-transaction-v4/api/test.js
Normal file
@@ -0,0 +1,193 @@
|
||||
const URL = "/one-api/mockup/fo/supervisor_v8/";
|
||||
|
||||
|
||||
export async function lookup(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'supervisor/lookup_test',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function checkstatus(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'supervisor/checkstatus',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getcitos(prm){
|
||||
try {
|
||||
var resp = await axios.post(URL +'supervisor/getcitos',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getnewprice(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'supervisor/getnewprice',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function lookup_promises(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'supervisor/lookup_promises',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function savetestadditionalverification(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'supervisor/save_test_additional_verification',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function searchtest(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'supervisor/search_test',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch(e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function savetestadditional(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'supervisor/save_test_additional',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch(e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function checkpromisetests(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'supervisor/checkpromisetests',prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getchildrenprofil(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'supervisor/getchildrenprofil',{token:prm.token,data:prm.new});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<v-layout class="fill-height" column>
|
||||
<one-fo-cashier-search></one-fo-cashier-search>
|
||||
<one-fo-cashier-table></one-fo-cashier-table>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components : {
|
||||
'one-fo-cashier-search': httpVueLoader('./oneFoCashierSearch.vue'),
|
||||
'one-fo-cashier-table': httpVueLoader('./oneFoCashierTable.vue')
|
||||
},
|
||||
|
||||
mounted() {
|
||||
const today = new Date();
|
||||
|
||||
const yyyy = today.getFullYear();
|
||||
const mm = String(today.getMonth() + 1).padStart(2, "0");
|
||||
const dd = String(today.getDate()).padStart(2, "0");
|
||||
|
||||
const todayStr = `${yyyy}-${mm}-${dd}`;
|
||||
|
||||
this.$store.dispatch("patient/monitoring_transaction", {
|
||||
page: 1,
|
||||
start_date: todayStr,
|
||||
end_date: todayStr
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,681 @@
|
||||
<template>
|
||||
<v-layout column pb-2>
|
||||
<v-card class="mb-2">
|
||||
<v-layout row pa-2 align-center wrap >
|
||||
<table>
|
||||
<tr>
|
||||
<th class="text-md-center pt-2 pb-2"> NOTA </th>
|
||||
<th class="text-md-center pt-2 pb-2"> TIPE PEMBAYARAN </th>
|
||||
<th class="text-md-center pt-2 pb-2">JUMLAH</th>
|
||||
<th class="text-md-center pt-2 pb-2">USER</th>
|
||||
<th class="text-md-center pt-2 pb-2">AKSI</th>
|
||||
</tr>
|
||||
<tr class="mini-input" v-if="notes.length > 0" v-for="(note,index) in notes">
|
||||
<td width="30%" v-bind:class="{ 'red--text':note.note_active === 'N','primary--text':note.note_amount < 0}" style="text-align:center;vertical-align:center;" align="center" >{{note.note_number}}</td>
|
||||
<td width="30%" v-bind:class="{ 'red--text':note.note_active === 'N','primary--text':note.note_amount < 0}" class="text-md-center pl-3 pr-3">{{note.paymenttypes_name}}</td>
|
||||
<td width="15%" v-bind:class="{ 'red--text':note.note_active === 'N','primary--text':note.note_amount < 0}" class="text-md-right pl-3 pr-3">{{convertMoney(note.note_amount)}}</td>
|
||||
<td width="20%" v-bind:class="{ 'red--text':note.note_active === 'N','primary--text':note.note_amount < 0}" class="text-md-center pr-2">{{note.note_user}}</td>
|
||||
<td class="text-md-center">
|
||||
<span @click="printNote(note,index)" class="icon-medium-fill-base xs1 white--text grey darken-1 icon-print"></span>
|
||||
<!--<v-btn small @click="printNote(note,index)" color="primary" dark>
|
||||
Print
|
||||
</v-btn>
|
||||
|
||||
<v-btn small @click="deleteNote(note,index)" v-if="note.note_active === 'Y'" color="error" dark>
|
||||
Hapus
|
||||
</v-btn>-->
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="mini-input" v-if="notes.length === 0">
|
||||
<td colspan="5" class="text-md-center pr-2">
|
||||
Tidak ada data
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</v-layout>
|
||||
<v-layout style="border-top:1px dashed rgb(221,221,221)" row mt-1 mb-1></v-layout>
|
||||
<v-layout row mt-1 mb-1 pl-2 pr-2>
|
||||
<v-btn class="text-md-center" @click="printInvoice()" color="teal" dark>
|
||||
Invoice
|
||||
</v-btn>
|
||||
<v-btn class="text-md-center" @click="printKw()" color="print" dark>
|
||||
Kwitansi
|
||||
</v-btn>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
<v-card >
|
||||
<v-layout row pa-2 align-center wrap >
|
||||
<v-flex xs6>
|
||||
<v-layout row>
|
||||
<v-flex xs12>
|
||||
<div class="label-tagihan text-xs-left">Total Tagihan</div>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout pt-1 row>
|
||||
<v-flex xs9>
|
||||
<div class="text-xs-left warning--text">Minimun DP ({{xmindp_percent}}%)</div>
|
||||
</v-flex>
|
||||
<v-flex xs3>
|
||||
<div class="text-xs-right warning--text">{{convertMoney(xmindp_amount)}}</div>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
<v-flex xs6>
|
||||
<div class="text-tagihan text-xs-right"><kbd>{{convertMoney(restbill)}}</kbd></div>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout style="border-top:1px dashed rgb(221,221,221)" row mt-1 mb-1></v-layout>
|
||||
<div v-for="(type, index) in types">
|
||||
<v-layout row pt-2 pb-1 pl-2 align-center wrap >
|
||||
<v-flex xs12>
|
||||
<v-switch
|
||||
v-model="type.chex"
|
||||
@change="updateChx(type,index)"
|
||||
:label="type.chexlabel"
|
||||
></v-switch>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout pl-2 row align-center wrap >
|
||||
<v-flex xs4 class="pa-1">
|
||||
<!--<input type="text" @change="updateTotal()" :class="{ 'disabled-background':type.chex === false }" :disabled="!type.chex" v-model="type.leftvalue" class="input-plain text-xs-right font-weight-bold"/>-->
|
||||
<v-text-field
|
||||
label="Jumlah"
|
||||
:disabled="!type.chex" v-model="type.leftvalue"
|
||||
@change="updateTotal()"
|
||||
outline
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs4 v-if="type.code === 'CASH' || type.code === 'VOUCHER'" class="pa-1">
|
||||
<v-text-field
|
||||
v-if="type.code === 'CASH'"
|
||||
label="Kembali"
|
||||
:disabled="!type.chex" v-model="type.rightvalue"
|
||||
@change="updateTotal()"
|
||||
outline
|
||||
></v-text-field>
|
||||
<v-text-field
|
||||
v-if="type.code === 'VOUCHER'"
|
||||
label="Kode Voucher"
|
||||
:disabled="!type.chex" v-model="type.rightvalue"
|
||||
outline
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs4 v-if="type.code === 'DEBIT' || type.code === 'CREDIT'" class="pa-1">
|
||||
<v-autocomplete
|
||||
label="Kartu"
|
||||
v-model="type.selected_card"
|
||||
@change="changeCard('card',type.selected_card,index)"
|
||||
:disabled="!type.chex"
|
||||
:items="banks"
|
||||
auto-select-first
|
||||
no-filter
|
||||
outline
|
||||
item-text="name"
|
||||
item-value="id"
|
||||
return-object
|
||||
no-data-text=""
|
||||
>
|
||||
</v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex xs4 v-if="type.code === 'DEBIT' || type.code === 'CREDIT'" class="pa-1">
|
||||
<v-autocomplete
|
||||
label="EDC"
|
||||
v-model="type.selected_edc"
|
||||
@change="changeCard('edc',type.selected_card,index)"
|
||||
:disabled="!type.chex"
|
||||
:items="banks"
|
||||
auto-select-first
|
||||
outline
|
||||
no-filter
|
||||
item-text="name"
|
||||
item-value="id"
|
||||
return-object
|
||||
no-data-text=""
|
||||
>
|
||||
</v-autocomplete>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout style="border-top:1px dashed rgb(221,221,221)" row mt-1 mb-1></v-layout>
|
||||
</div>
|
||||
<v-layout row pa-2 align-center wrap >
|
||||
<v-flex xs6>
|
||||
<div class="label-tagihan text-xs-left">
|
||||
<v-btn v-if="xdisable_btn_pay === 'N'" @click="pay()" color="warning" dark>
|
||||
Bayar XXX
|
||||
</v-btn>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs6>
|
||||
<div class="text-tagihan text-xs-right"><kbd>{{convertMoney(totpay)}}</kbd></div>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
|
||||
|
||||
|
||||
<template>
|
||||
<v-dialog
|
||||
v-model="xdialogpaysuccess"
|
||||
max-width="30%"
|
||||
persistent
|
||||
>
|
||||
<v-card>
|
||||
<v-card-title
|
||||
class="headline success pt-2 pb-2"
|
||||
primary-title
|
||||
>
|
||||
<h4 style="color:#FFEBEE">Pembayaran Berhasil</h4>
|
||||
</v-card-title>
|
||||
<v-card-text class="pt-2 pb-2">
|
||||
<v-layout row>
|
||||
<v-flex xs12 d-flex>
|
||||
<v-layout row>
|
||||
<v-flex pb-1 xs12>
|
||||
<v-layout row>
|
||||
<v-flex pt-2 pr-2 v-html="xmsgpaysuccess" xs12>
|
||||
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
flat
|
||||
@click="doPrint()"
|
||||
>
|
||||
Print
|
||||
</v-btn>
|
||||
<v-btn
|
||||
color="error"
|
||||
flat
|
||||
@click="closeDialogPaySuccess(false)"
|
||||
>
|
||||
Tutup
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<template>
|
||||
|
||||
<v-dialog
|
||||
v-model="xdialogdelete"
|
||||
persistent
|
||||
max-width="30%"
|
||||
>
|
||||
<v-card>
|
||||
<v-card-title
|
||||
:class="{ 'red':!_.isEmpty(xnotadelete), 'success':_.isEmpty(xnotadelete) }"
|
||||
class="headline darken-1 pt-2 pb-2"
|
||||
primary-title
|
||||
>
|
||||
<h4 style="color:#FFEBEE">
|
||||
<span v-if="!_.isEmpty(xnotadelete)">Peringatan !</span>
|
||||
<span v-if="_.isEmpty(xnotadelete)">Berhasil !</span>
|
||||
</h4>
|
||||
</v-card-title>
|
||||
<v-card-text class="pt-2 pb-2">
|
||||
<v-layout row>
|
||||
<v-flex xs12 d-flex>
|
||||
<v-layout row>
|
||||
<v-flex pb-1 xs12>
|
||||
<v-layout row>
|
||||
<v-flex pt-2 pr-2 v-html="xmsgdelete" xs12>
|
||||
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout v-if="!_.isEmpty(xnotadelete)" row>
|
||||
<v-flex pt-2 pr-2 xs12>
|
||||
<input style="border: 1px solid black;padding: 5px;width: 100%;" type="text" placeholder="Catatan (*Wajib diisi)" v-model="xnotedelete" class="input-plain"/>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
color="error"
|
||||
v-if="!_.isEmpty(xnotadelete) && xnotedelete "
|
||||
flat
|
||||
@click="doDeleteNote()"
|
||||
>
|
||||
Yakin dong !
|
||||
</v-btn>
|
||||
|
||||
<v-btn
|
||||
v-if="!_.isEmpty(xnotadelete)"
|
||||
color="primary"
|
||||
flat
|
||||
@click="xdialogdelete = false"
|
||||
>
|
||||
Tutup
|
||||
</v-btn>
|
||||
<v-btn
|
||||
v-if="_.isEmpty(xnotadelete)"
|
||||
color="primary"
|
||||
flat
|
||||
@click="closeDialogDelete()"
|
||||
>
|
||||
Tutup
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
</template>
|
||||
<one-dialog-print :title="printtitle" :width="printwidth" :height="500" :status="openprintnote" :urlprint="urlprintnote" @close-dialog-print="openprintnote = false"></one-dialog-print>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.label-tagihan{
|
||||
text-align:left;
|
||||
font-size: 25px;
|
||||
font-family: open sans, tahoma, sans-serif;
|
||||
font-weight:700;
|
||||
}
|
||||
|
||||
.sub-header{
|
||||
text-align:left;
|
||||
font-size: 18px;
|
||||
font-family: open sans, tahoma, sans-serif;
|
||||
font-weight:700;
|
||||
}
|
||||
|
||||
.sub-title{
|
||||
text-align:left;
|
||||
font-size: 14px;
|
||||
font-family: open sans, tahoma, sans-serif;
|
||||
font-weight:700;
|
||||
}
|
||||
|
||||
.text-tagihan{
|
||||
text-align:left;
|
||||
font-size: 42px;
|
||||
font-family: open sans, tahoma, sans-serif;
|
||||
}
|
||||
|
||||
.disabled-background{
|
||||
background:#b7b7b7;
|
||||
}
|
||||
|
||||
.input-cash{
|
||||
width: 100%;
|
||||
padding: 8px 14px;
|
||||
box-sizing: border-box;
|
||||
border: 2px solid grey;
|
||||
border-radius: 4px;
|
||||
font-size: 22px;
|
||||
font-weight:700;
|
||||
text-align:right;
|
||||
}
|
||||
.input-plain{
|
||||
width: 100%;
|
||||
padding: 4px 8px;
|
||||
box-sizing: border-box;
|
||||
border: 2px solid grey;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.v-input, .v-input__slot, .v-messages{
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
min-height: 0px;
|
||||
}
|
||||
.v-input--selection-controls:not(.v-input--hide-details) .v-input__slot {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
table {
|
||||
font-family: arial, sans-serif;
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
background:white;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
th, td {
|
||||
border: 1px solid black;
|
||||
border-collapse: collapse;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
table>tr>td {
|
||||
padding: 8px;
|
||||
}
|
||||
table>tr>td:first {
|
||||
padding-left:15px!important;
|
||||
}
|
||||
.mini-input .v-input{
|
||||
margin-top: 0px;
|
||||
}
|
||||
|
||||
.mini-input .v-input, .mini-input .v-input--selection-controls,.mini-input .v-input__slot{
|
||||
margin-top: 0px;
|
||||
margin-bottom:0px;
|
||||
margin-left:3px;
|
||||
}
|
||||
.mini-input .v-messages{
|
||||
min-height:0px;
|
||||
}
|
||||
|
||||
.border-bottom-dashed{
|
||||
border-bottom : 1px dashed rgba(0,0,0,.12);
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
module.exports = {
|
||||
components : {
|
||||
'one-field-verification' : httpVueLoader('../../common/oneFieldVerificationSupply.vue'),
|
||||
'one-dialog-print':httpVueLoader('../../common/oneDialogPrintX.vue')
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
checkbox: true,
|
||||
radioGroup: 1,
|
||||
switchCash: true,
|
||||
switchDebit: false,
|
||||
switchKredit: false,
|
||||
dialog:false,
|
||||
urlprintnote:'',
|
||||
printtitle:'',
|
||||
printwidth:600,
|
||||
search_card:'',
|
||||
search_edc:'',
|
||||
isLoading:false,
|
||||
fajrihidebtnpay:'Y'
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("payment/lookup_type")
|
||||
},
|
||||
computed: {
|
||||
cards(){
|
||||
return this.$store.state.payment.cards
|
||||
},
|
||||
banks(){
|
||||
return this.$store.state.payment.banks
|
||||
},
|
||||
xmindp_percent(){
|
||||
if(this.$store.state.patient.selected_patient){
|
||||
return this.$store.state.patient.selected_patient.mindp_percent
|
||||
}
|
||||
else{
|
||||
return 0
|
||||
}
|
||||
},
|
||||
xmindp_amount(){
|
||||
if(this.$store.state.patient.selected_patient){
|
||||
return this.$store.state.patient.selected_patient.mindp_amount
|
||||
}
|
||||
else{
|
||||
return 0
|
||||
}
|
||||
},
|
||||
notes(){
|
||||
return this.$store.state.payment.notes
|
||||
},
|
||||
xdialogpaysuccess(){
|
||||
return this.$store.state.payment.dialog_pay_success
|
||||
},
|
||||
xmsgpaysuccess(){
|
||||
return this.$store.state.payment.paynumber
|
||||
},
|
||||
types() {
|
||||
return this.$store.state.payment.types
|
||||
},
|
||||
totpay() {
|
||||
return this.$store.state.payment.total_payment
|
||||
},
|
||||
restbill(){
|
||||
if(this.$store.state.patient.patients){
|
||||
return this.$store.state.patient.selected_patient.unpaid
|
||||
}
|
||||
else{
|
||||
return 0
|
||||
}
|
||||
|
||||
},
|
||||
xdialogdelete:{
|
||||
get() {
|
||||
return this.$store.state.payment.dialog_delete
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("payment/update_dialog_delete",val)
|
||||
}
|
||||
},
|
||||
xmsgdelete(){
|
||||
return this.$store.state.payment.msg_delete
|
||||
},
|
||||
xnotadelete(){
|
||||
return this.$store.state.payment.nota_delete
|
||||
},
|
||||
xnotedelete:{
|
||||
get() {
|
||||
return this.$store.state.payment.note_delete
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("payment/update_note_delete",val)
|
||||
}
|
||||
},
|
||||
openprintnote: {
|
||||
get() {
|
||||
return this.$store.state.payment.open_print_note
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("payment/update_open_print_note",false)
|
||||
}
|
||||
},
|
||||
selectedpatient(){
|
||||
return this.$store.state.patient.selected_patient
|
||||
},
|
||||
xdisable_btn_pay: {
|
||||
get() {
|
||||
return this.$store.state.patient.pay_disabled
|
||||
},
|
||||
set(val) {
|
||||
console.log(val)
|
||||
this.$store.commit("patient/update_pay_disabled",val)
|
||||
}
|
||||
},
|
||||
|
||||
},
|
||||
methods : {
|
||||
changeCard(type,value,idx){
|
||||
var types = this.$store.state.payment.types
|
||||
if(type === 'card')
|
||||
types[idx].selected_card = value
|
||||
|
||||
if(type === 'edc')
|
||||
types[idx].selected_edc = value
|
||||
},
|
||||
colorbginp(value){
|
||||
if(value.chex === false){
|
||||
return 'grey'
|
||||
}
|
||||
else{
|
||||
return 'white'
|
||||
}
|
||||
},
|
||||
convertMoney(money){
|
||||
return one_money(money)
|
||||
},
|
||||
closeDialogPaySuccess(){
|
||||
let arrpatient = this.$store.state.patient.patients
|
||||
var idx = _.findIndex(arrpatient, item => item.T_OrderHeaderID === this.$store.state.patient.selected_patient.T_OrderHeaderID)
|
||||
this.$store.commit("payment/update_dialog_pay_success",false)
|
||||
this.$store.commit("patient/update_selected_patient",{})
|
||||
this.$store.dispatch("patient/search",{
|
||||
startdate:this.$store.state.patient.start_date,
|
||||
enddate:this.$store.state.patient.end_date,
|
||||
search: this.$store.state.patient.search,
|
||||
status: this.$store.state.patient.selected_status.value,
|
||||
current_page:this.$store.state.patient.current_page,
|
||||
lastidx:idx
|
||||
})
|
||||
},
|
||||
updateTotal(){
|
||||
|
||||
var xval = this.$store.state.payment.types
|
||||
let xcash = _.filter(xval, {code: 'CASH'})
|
||||
let xother = _.filter(xval, type => type.code !== 'CASH')
|
||||
var valother = 0
|
||||
xother.forEach(function(obj){
|
||||
valother += parseInt(obj.leftvalue)
|
||||
})
|
||||
console.log('val other '+valother)
|
||||
let restother = this.restbill - valother
|
||||
|
||||
let xchange = parseInt(xcash[0].leftvalue) - restother
|
||||
xcash[0].rightvalue = Math.max(0, xchange)
|
||||
let idxcash = _.findIndex(xval, item => item.code === 'CASH')
|
||||
xval[idxcash] = xcash[0]
|
||||
this.$store.commit("payment/update_types",{records :xval,total:xval.length })
|
||||
let totpaid = valother + ( parseInt(xcash[0].leftvalue) - Math.max(0, xchange) )
|
||||
this.$store.commit("payment/update_total_payment",totpaid)
|
||||
|
||||
|
||||
var payments = this.$store.state.payment.types
|
||||
this.xdisable_btn_pay = 'N'
|
||||
let selected_payments = _.filter(payments, {chex: true})
|
||||
|
||||
selected_payments.forEach(function(obj){
|
||||
console.log(obj.leftvalue)
|
||||
if(obj.leftvalue === 0 || obj.leftvalue === '0'){
|
||||
console.log('harusnya Y')
|
||||
this.xdisable_btn_pay = 'Y'
|
||||
}
|
||||
})
|
||||
console.log(this.xdisable_btn_pay)
|
||||
},
|
||||
pay(){
|
||||
var xval = this.$store.state.payment.types
|
||||
var valpay = 0
|
||||
let xcash = _.filter(xval, {code: 'CASH'})
|
||||
xval.forEach(function(obj){
|
||||
valpay += parseInt(obj.leftvalue)
|
||||
})
|
||||
if(valpay > 0 || xcash[0].leftvalue ){
|
||||
let prm = {orderid:this.$store.state.patient.selected_patient.T_OrderHeaderID,payments:this.$store.state.payment.types}
|
||||
this.$store.dispatch("payment/pay",prm)
|
||||
}
|
||||
},
|
||||
deleteNote(note,idx){
|
||||
this.$store.commit("payment/update_note_delete","")
|
||||
this.$store.commit("payment/update_nota_delete",note)
|
||||
let xmsg = "Yakin , mau hapus nota nomor <span style='color:red'>"+note.note_number+"</span> ?"
|
||||
this.$store.commit("payment/update_msg_delete",xmsg)
|
||||
this.$store.commit("payment/update_dialog_delete",true)
|
||||
},
|
||||
doDeleteNote(){
|
||||
let prm = {catatan:this.$store.state.payment.note_delete,nota:this.$store.state.payment.nota_delete}
|
||||
this.$store.dispatch("payment/delete_note",prm)
|
||||
},
|
||||
closeDialogDelete(){
|
||||
let arrpatient = this.$store.state.patient.patients
|
||||
var idx = _.findIndex(arrpatient, item => item.T_OrderHeaderID === this.$store.state.patient.selected_patient.T_OrderHeaderID)
|
||||
this.$store.commit("payment/update_dialog_delete",false)
|
||||
this.$store.commit("patient/update_selected_patient",{})
|
||||
this.$store.dispatch("patient/search",{
|
||||
startdate:this.$store.state.patient.start_date,
|
||||
enddate:this.$store.state.patient.end_date,
|
||||
search: this.$store.state.patient.search,
|
||||
status: this.$store.state.patient.selected_status.value,
|
||||
lastidx:idx
|
||||
})
|
||||
},
|
||||
updateChx(val,idx){
|
||||
//this.check_disable_btn_status()
|
||||
let xobj = this.$store.state.payment.types
|
||||
xobj[idx].leftvalue = 0
|
||||
xobj[idx].rightvalue = 0
|
||||
if((xobj[idx].code === 'DEBIT' || xobj[idx].code === 'CREDIT') && val.chex === false){
|
||||
xobj[idx].selected_card = {id:0,name:''}
|
||||
xobj[idx].selected_edc = {id:0,name:''}
|
||||
}
|
||||
this.$store.commit("payment/update_types",{records :xobj,total:xobj.length })
|
||||
// this.check_disable_btn_status()
|
||||
this.updateTotal()
|
||||
},
|
||||
check_disable_btn_status(){
|
||||
this.xdisable_btn_pay = 'N'
|
||||
var payments = this.$store.state.payment.types
|
||||
let selected_payments = _.filter(payments, {chex: true})
|
||||
console.log(this.xdisable_btn_pay)
|
||||
selected_payments.forEach(function(obj){
|
||||
if(obj.leftvalue === 0){
|
||||
this.xdisable_btn_pay = 'Y'
|
||||
}
|
||||
if(obj.code === 'DEBIT' || obj.code === 'CREDIT'){
|
||||
console.log(obj)
|
||||
if(obj.selected_card.id === '0' || obj.selected_card.id === 0 || obj.selected_edc.id === '0' || obj.selected_edc.id === 0){
|
||||
this.xdisable_btn_pay = 'Y'
|
||||
console.log('oye')
|
||||
console.log(this.xdisable_btn_pay)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
printNote(val,idx){
|
||||
this.printwidth = 600
|
||||
this.printtitle = ""
|
||||
let user = one_user()
|
||||
var rpt = 'rpt_t_003'
|
||||
if(val.note_amount < 0)
|
||||
rpt = 'rpt_t_004'
|
||||
this.urlprintnote = "/birt/run?__report=report/one/fo/"+rpt+".rptdesign&__format=pdf&username="+user.M_UserUsername+"&PID="+val.note_id
|
||||
this.$store.commit("payment/update_open_print_note",true)
|
||||
},
|
||||
doPrint(){
|
||||
this.printtitle = ""
|
||||
this.closeDialogPaySuccess()
|
||||
let user = one_user()
|
||||
let payments = this.$store.state.payment.last_payments
|
||||
let xcash = _.filter(payments, {code: 'CASH'})
|
||||
var rpt = 'rpt_t_003'
|
||||
if(xcash[0].leftvalue < 0)
|
||||
rpt = 'rpt_t_004'
|
||||
this.urlprintnote = "/birt/run?__report=report/one/fo/"+rpt+".rptdesign&__format=pdf&username="+user.M_UserUsername+"&PID="+this.$store.state.payment.idx
|
||||
this.$store.commit("payment/update_open_print_note",true)
|
||||
},
|
||||
printKw(){
|
||||
this.printwidth = 800
|
||||
this.printtitle = ""
|
||||
let idx = this.$store.state.patient.selected_patient.T_OrderHeaderID
|
||||
let user = one_user()
|
||||
this.urlprintnote = "/birt/run?__report=report/one/fo/rpt_t_002.rptdesign&__format=pdf&username="+user.M_UserUsername+"&PID="+idx
|
||||
this.$store.commit("payment/update_open_print_note",true)
|
||||
},
|
||||
printInvoice(){
|
||||
this.printwidth = 800
|
||||
this.printtitle = ""
|
||||
let idx = this.$store.state.patient.selected_patient.T_OrderHeaderID
|
||||
let user = one_user()
|
||||
this.urlprintnote = "/birt/run?__report=report/one/fo/rpt_t_001.rptdesign&__format=pdf&username="+user.M_UserUsername+"&PID="+idx
|
||||
this.$store.commit("payment/update_open_print_note",true)
|
||||
},
|
||||
thr_search_card: _.debounce( function () {
|
||||
this.$store.dispatch("payment/searchcard",this.search_card)
|
||||
},2000)
|
||||
},
|
||||
watch: {
|
||||
search_card(val,old) {
|
||||
if (val == old ) return
|
||||
if (! val) return
|
||||
if (val.length < 1 ) return
|
||||
if (this.$store.state.payment.update_lookup_status == 1 ) return
|
||||
this.thr_search_card()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,264 @@
|
||||
<template>
|
||||
<v-card class="mb-2 pa-2 searchbox">
|
||||
<v-layout align-center wrap>
|
||||
<v-menu
|
||||
ref="menustartdate"
|
||||
v-model="menustartdate"
|
||||
:close-on-content-click="false"
|
||||
:nudge-right="0"
|
||||
lazy
|
||||
transition="scale-transition"
|
||||
offset-y
|
||||
full-width
|
||||
max-width="290px"
|
||||
min-width="290px"
|
||||
>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-text-field
|
||||
v-model="startDateFormatted"
|
||||
label="Tanggal Awal"
|
||||
readonly
|
||||
hide-details
|
||||
class="xs3 ma-1"
|
||||
outline
|
||||
v-on="on"
|
||||
@blur="deFormatedDate(startDateFormatted)"
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker v-model="xstartdate" no-title @input="menustartdate = false"></v-date-picker>
|
||||
</v-menu>
|
||||
<v-menu
|
||||
ref="menuenddate"
|
||||
v-model="menuenddate"
|
||||
:close-on-content-click="false"
|
||||
:nudge-right="0"
|
||||
lazy
|
||||
transition="scale-transition"
|
||||
offset-y
|
||||
full-width
|
||||
max-width="290px"
|
||||
min-width="290px"
|
||||
>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-text-field
|
||||
v-model="endDateFormatted"
|
||||
label="Tanggal Akhir"
|
||||
readonly
|
||||
hide-details
|
||||
class="xs3 ma-1"
|
||||
outline
|
||||
v-on="on"
|
||||
@blur="deFormatedDate(startDateFormatted)"
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker v-model="xenddate" no-title @input="menuenddate = false"></v-date-picker>
|
||||
</v-menu>
|
||||
|
||||
<v-text-field class="xs3 ma-1"
|
||||
label="Cari ..."
|
||||
placeholder="Nama / No Reg"
|
||||
v-on:keyup.enter="searchPatient"
|
||||
outline
|
||||
v-model="searchnamelab"
|
||||
hide-details
|
||||
></v-text-field>
|
||||
<v-autocomplete class="xs3 mini-select ma-1"
|
||||
:items="corporates"
|
||||
item-text="CorporateName"
|
||||
item-value="CorporateID"
|
||||
return-object
|
||||
v-model="selected_corporate"
|
||||
label="Corporate"
|
||||
outline
|
||||
hide-details
|
||||
>
|
||||
<template slot="item" slot-scope="data">
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title v-html="`${data.item.CorporateName}`"></v-list-tile-title>
|
||||
<v-list-tile-sub-title v-if="data.item.CorporateCode" v-html="`${data.item.CorporateCode}`"></v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
|
||||
<v-select class="xs3 mini-select ma-1" :items="statuses"
|
||||
item-text="name"
|
||||
return-object
|
||||
v-model="status"
|
||||
label="Status" outline hide-details>
|
||||
</v-select>
|
||||
<span @click="searchPatient" class="icon-medium-fill-base xs1 white--text warning iconsearch-search"></span>
|
||||
<v-divider vertical></v-divider>
|
||||
<v-btn title="Upload Data ke AIS" @click="uploadData" style="min-width: 25px!important; height: 30px!important;" color="primary">
|
||||
<v-icon>cloud_upload</v-icon>
|
||||
</v-btn>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
|
||||
<v-dialog v-model="loadingUpload" persistent max-width="300">
|
||||
<v-card>
|
||||
<v-card-text class="pt-4 text-xs-center">
|
||||
<v-progress-circular indeterminate color="primary" size="48" class="mb-3"></v-progress-circular>
|
||||
<div>Sedang mengupload data, harap tunggu...</div>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.searchbox .v-input.v-text-field .v-input__slot{
|
||||
min-height:40px;
|
||||
}
|
||||
.searchbox .v-btn {
|
||||
min-height:40px;
|
||||
}
|
||||
.v-messages{
|
||||
min-height:0px!important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
mounted() {
|
||||
var url_string = window.location.href
|
||||
var url = new URL(url_string);
|
||||
var id = url.searchParams.get("id")
|
||||
var xdate = url.searchParams.get("xdate")
|
||||
var type = url.searchParams.get("type")
|
||||
if (id) {
|
||||
this.xstartdate = xdate
|
||||
this.xenddate = xdate
|
||||
this.searchnamelab = id
|
||||
this.status = {name:'Semua',value:'A'}
|
||||
this.show_btn_back = true
|
||||
this.type_back_btn = type
|
||||
} else {
|
||||
this.$store.dispatch("patient/get_corporates");
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menustartdate:false,
|
||||
menuenddate:false,
|
||||
show_btn_back:false,
|
||||
type_back_btn:'',
|
||||
loadingUpload:false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
xstartdate:{
|
||||
get() { return this.$store.state.patient.start_date },
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_start_date",val)
|
||||
this.searchPatient()
|
||||
}
|
||||
},
|
||||
xenddate:{
|
||||
get() { return this.$store.state.patient.end_date },
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_end_date",val)
|
||||
this.searchPatient()
|
||||
}
|
||||
},
|
||||
searchnamelab:{
|
||||
get() { return this.$store.state.patient.search },
|
||||
set(val) { this.$store.commit("patient/update_search",val) }
|
||||
},
|
||||
statuses(){
|
||||
return this.$store.state.patient.statuses
|
||||
},
|
||||
status:{
|
||||
get() { return this.$store.state.patient.selected_status },
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_selected_status",val)
|
||||
this.searchPatient()
|
||||
}
|
||||
},
|
||||
corporates() {
|
||||
return this.$store.state.patient.corporates
|
||||
},
|
||||
selected_corporate: {
|
||||
get() { return this.$store.state.patient.selected_corporate },
|
||||
set(val) {
|
||||
this.$store.commit("patient/update_selected_corporate", val)
|
||||
this.searchPatient()
|
||||
}
|
||||
},
|
||||
startDateFormatted () {
|
||||
return this.formatDate(this.xstartdate)
|
||||
},
|
||||
endDateFormatted () {
|
||||
return this.formatDate(this.xenddate)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate (date) {
|
||||
if (!date) return null
|
||||
const [year, month, day] = date.split('-')
|
||||
return `${day}-${month}-${year}`
|
||||
},
|
||||
deFormatedDate (date) {
|
||||
if (!date) return null
|
||||
const [ day,month, year] = date.split('-')
|
||||
return `${year}-${month.padStart(2, '0')}-${day.padStart(2, '0')}`
|
||||
},
|
||||
searchPatient() {
|
||||
let params = {
|
||||
start_date: this.xstartdate,
|
||||
end_date: this.xenddate,
|
||||
corporate_id: this.selected_corporate.CorporateID,
|
||||
page: 1 // Selalu reset ke halaman 1 saat melakukan pencarian baru
|
||||
};
|
||||
|
||||
const searchVal = this.searchnamelab.trim();
|
||||
if (searchVal) {
|
||||
// Cek jika input kemungkinan adalah nomor lab (mengandung angka)
|
||||
if (/\d/.test(searchVal)) {
|
||||
params.lab_number = searchVal;
|
||||
} else {
|
||||
params.patient_name = searchVal;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.status.value !== 'A') {
|
||||
params.ais_status = this.status.value;
|
||||
}
|
||||
|
||||
this.$store.dispatch("patient/monitoring_transaction", params);
|
||||
},
|
||||
backToFoReceiver(){
|
||||
this.show_btn_back = false
|
||||
if(this.type_back_btn === 'fo')
|
||||
location.replace("/one-ui/test/vuex/one-fo-handover-patient/")
|
||||
if(this.type_back_btn === 'email')
|
||||
location.replace("/one-ui/test/vuex/one-fo-handover-email/")
|
||||
},
|
||||
async uploadData() {
|
||||
this.loadingUpload = true;
|
||||
try {
|
||||
console.log('in uploadData');
|
||||
var resp = await axios.get('/one-api/ais/transactionv4/post_transaction_daily_by_date/'+this.xstartdate+'/'+this.xenddate);
|
||||
console.log(resp);
|
||||
if (resp.status == 'OK') {
|
||||
alert(resp.data.message);
|
||||
} else {
|
||||
let errors = resp.data.errors;
|
||||
console.log(errors);
|
||||
let error_message = '';
|
||||
if(!errors || errors.length == 0){
|
||||
error_message = resp.data.message;
|
||||
} else {
|
||||
for(let i = 0; i < errors.length; i++){
|
||||
error_message += errors[i].RegID + ' : ' + errors[i].error + '\n';
|
||||
}
|
||||
}
|
||||
alert(error_message);
|
||||
}
|
||||
} catch (e) {
|
||||
alert(e.message);
|
||||
} finally {
|
||||
this.loadingUpload = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,424 @@
|
||||
<template>
|
||||
<v-layout row wrap>
|
||||
|
||||
<!-- ===================== LEFT CARD ===================== -->
|
||||
<v-flex xs6 pl-2 pr-1 pt-2 pb-2>
|
||||
<v-card>
|
||||
<v-layout row>
|
||||
<v-flex xs12 pl-2 pr-2 pt-2 pb-2>
|
||||
|
||||
<!-- TABLE PASIEN -->
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="patients"
|
||||
:loading="isLoading"
|
||||
hide-actions
|
||||
class="elevation-1"
|
||||
>
|
||||
<template slot="items" slot-scope="props">
|
||||
<td
|
||||
class="text-xs-left pa-2"
|
||||
:class="{ 'cyan lighten-4': isSelected(props.item) }"
|
||||
@click="selectPatient(props.item)"
|
||||
>
|
||||
<p class="mb-0">{{ props.item.patient_name }}</p>
|
||||
<p class="font-weight-black caption mb-0">{{ props.item.lab_number }}</p>
|
||||
</td>
|
||||
|
||||
<td
|
||||
class="text-xs-left pa-2"
|
||||
:class="{ 'cyan lighten-4': isSelected(props.item) }"
|
||||
@click="selectPatient(props.item)"
|
||||
>
|
||||
<p class="mb-0">{{ props.item.corporate_name }}</p>
|
||||
<p class="font-weight-black caption mb-0">{{ props.item.mgm_mcu_name }}</p>
|
||||
<p v-if="props.item.ais_pillar_name" class="caption mt-1 mb-0"><kbd>Pillar : {{ props.item.ais_pillar_name }}</kbd></p>
|
||||
<p v-if="!props.item.ais_pillar_name" class="caption mt-1 mb-0"><code>Pillar belum disetting</code></p>
|
||||
</td>
|
||||
|
||||
<td
|
||||
class="text-xs-left pa-2"
|
||||
:class="{ 'cyan lighten-4': isSelected(props.item) }"
|
||||
@click="selectPatient(props.item)"
|
||||
>
|
||||
{{ props.item.branch_name }} (<strong>{{ props.item.branch_code_lab }}</strong>)
|
||||
</td>
|
||||
<td
|
||||
class="text-xs-right pa-2"
|
||||
:class="{ 'cyan lighten-4': isSelected(props.item) }"
|
||||
@click="selectPatient(props.item)"
|
||||
>
|
||||
{{ formatNumber(props.item.total_amount) }}
|
||||
</td>
|
||||
<td
|
||||
class="text-xs-center pa-2"
|
||||
:class="{ 'cyan lighten-4': isSelected(props.item) }"
|
||||
@click="selectPatient(props.item)"
|
||||
>
|
||||
<v-icon center style="font-weight: bold;" :color="props.item.ais_status === 'Y' ? 'success' : 'error'">{{ props.item.ais_status === 'Y' ? 'check' : 'close' }}</v-icon>
|
||||
</td>
|
||||
<td class="text-xs-center pa-2" :class="{ 'cyan lighten-4': isSelected(props.item) }">
|
||||
<v-btn style="min-width: 15px!important; min-height: 15px!important;" color="primary" v-if="props.item.ais_status === 'N'" class="ma-0" @click.stop="sendTransaction(props.item)">
|
||||
<v-icon center>cloud_upload</v-icon>
|
||||
</v-btn>
|
||||
<v-btn style="min-width: 15px!important; min-height: 15px!important;" color="success" v-if="props.item.ais_status === 'Y'" class="ma-0" @click.stop="reSendTransaction(props.item)">
|
||||
<v-icon center>cloud_upload</v-icon>
|
||||
</v-btn>
|
||||
<v-btn style="min-width: 15px!important; min-height: 15px!important;" color="error" v-if="props.item.ais_status === 'Y'" class="ma-0" @click.stop="deleteTransaction(props.item)">
|
||||
<v-icon center>delete</v-icon>
|
||||
</v-btn>
|
||||
</td>
|
||||
</template>
|
||||
</v-data-table>
|
||||
|
||||
<v-divider></v-divider>
|
||||
|
||||
<!-- PAGINATION -->
|
||||
<v-pagination
|
||||
style="margin-top: 10px; margin-bottom: 10px"
|
||||
v-model="curr_page"
|
||||
:length="xtotal_page"
|
||||
@input="changePage"
|
||||
></v-pagination>
|
||||
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
|
||||
<!-- ===================== RIGHT CARD ===================== -->
|
||||
<v-flex xs6 pl-1 pr-2 pt-2 pb-2>
|
||||
<v-card >
|
||||
|
||||
<v-card-title class="blue-grey white--text">
|
||||
<span class="title">Logs</span>
|
||||
<v-spacer></v-spacer>
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text class="py-2" style="height: 560px; overflow-y: auto;">
|
||||
|
||||
<blockquote v-if="!transaction_log || transaction_log.length === 0"
|
||||
class="blockquote">
|
||||
Pilih transaksi untuk melihat log
|
||||
</blockquote>
|
||||
|
||||
<!--<v-timeline v-if="transaction_log && transaction_log.length > 0" dense>
|
||||
<v-slide-x-reverse-transition group hide-on-leave>
|
||||
|
||||
<v-timeline-item
|
||||
v-for="(log, index) in sorted_transaction_log"
|
||||
:key="index">
|
||||
|
||||
<kbd small>Created: {{ log.transaction_created }}</kbd>
|
||||
|
||||
<div class="font-weight-bold mt-2">Request:</div>
|
||||
<v-alert :value="true" color="info" class="mb-2 pa-2"
|
||||
style="white-space: pre-wrap; word-break: break-all;">
|
||||
<code>{{ JSON.stringify(log.transaction_json, null, 2) }}</code>
|
||||
</v-alert>
|
||||
|
||||
<div class="font-weight-bold">Response:</div>
|
||||
<v-alert :value="true" color="success" class="pa-2"
|
||||
style="white-space: pre-wrap; word-break: break-all;">
|
||||
<code>{{ JSON.stringify(log.transaction_response, null, 2) }}</code>
|
||||
</v-alert>
|
||||
|
||||
</v-timeline-item>
|
||||
|
||||
</v-slide-x-reverse-transition>
|
||||
</v-timeline>-->
|
||||
|
||||
<v-layout class="mt-2" v-for="(log, index) in sorted_transaction_log" :key="index" row>
|
||||
<v-flex xs12>
|
||||
<v-card class="mb-2 pa-2">
|
||||
<v-card-text>
|
||||
<div class="subtitle-1 mb-2"><span class="font-weight-bold pl-2 pb-2 pt-0">Dikirim ke AIS pada : {{log.transaction_created}} </span></div>
|
||||
<v-divider></v-divider>
|
||||
</v-card-text>
|
||||
<v-card-actions class="mt-2 pt-0">
|
||||
<v-btn block :color="log.transaction_response.error == null ? 'success' : 'error'" small v-if="log.show_log == 'N'" @click="log.show_log == 'N' ? log.show_log = 'Y' : log.show_log = 'N'" dark>Lihat Log</v-btn>
|
||||
<v-btn block :color="log.transaction_response.error == null ? 'success' : 'error'" small v-if="log.show_log == 'Y'" @click="log.show_log == 'Y' ? log.show_log = 'N' : log.show_log = 'Y'" dark>Tutup Log</v-btn>
|
||||
</v-card-actions>
|
||||
<v-slide-y-transition>
|
||||
<v-card-text v-show="log.show_log == 'Y'">
|
||||
<v-card color="grey darken-2" class="white--text mb-2 pa-2">
|
||||
<v-card-title primary-title>Request</v-card-title>
|
||||
<v-card-text>
|
||||
<pre>{{ JSON.stringify(log.transaction_json, null, 2) }}</pre>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
<v-card :color="log.transaction_response.error == null ? 'success' : 'error'" class="white--text">
|
||||
<v-card-title primary-title>Response</v-card-title>
|
||||
<v-card-text>
|
||||
<pre>{{ JSON.stringify(log.transaction_response, null, 2) }}</pre>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-card-text>
|
||||
</v-slide-y-transition>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
<!-- ALERTS -->
|
||||
<one-dialog-alert
|
||||
:status="openalertnopay"
|
||||
:msg="msgalertnopay"
|
||||
@forget-dialog-alert="forgetAlertNoPay()"
|
||||
@close-dialog-alert="closeAlertNoPay()">
|
||||
</one-dialog-alert>
|
||||
|
||||
<one-dialog-info
|
||||
:status="dialog_info"
|
||||
:msg="dialog_info_message"
|
||||
@close-dialog-info="closeDialogInfo()">
|
||||
</one-dialog-info>
|
||||
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
|
||||
<style scoped>
|
||||
table.v-table tbody td,table.v-table tbody th {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
table.v-table thead tr {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
table, td, th {
|
||||
border: .5px solid rgba(0,0,0,.12);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
// ============= TAMBAHKAN di bagian methods pada component Vue =============
|
||||
|
||||
module.exports = {
|
||||
components: {
|
||||
'one-dialog-info': httpVueLoader('../../common/oneDialogInfo.vue'),
|
||||
'one-dialog-alert':httpVueLoader('../../common/oneDialogAlert.vue')
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
headers: [
|
||||
{
|
||||
text: "NAMA PASIEN",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "patient_name",
|
||||
width: "15%",
|
||||
class: "pa-2 warning white--text"
|
||||
},
|
||||
{
|
||||
text: "CORPORATE",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "lab_number",
|
||||
width: "15%",
|
||||
class: "pa-2 warning white--text"
|
||||
},
|
||||
{
|
||||
text: "BRANCH",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "branch_code",
|
||||
width: "15%",
|
||||
class: "pa-2 warning white--text"
|
||||
},
|
||||
|
||||
{
|
||||
text: "TOTAL",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "branch_code",
|
||||
width: "10%",
|
||||
class: "pa-2 warning white--text"
|
||||
},
|
||||
|
||||
{
|
||||
text: "STATUS",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "ais_status",
|
||||
width: "10%",
|
||||
class: "pa-2 warning white--text"
|
||||
},
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "action",
|
||||
width: "20%",
|
||||
class: "pa-2 warning white--text"
|
||||
}
|
||||
],
|
||||
items_per_page: 10
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isLoading() {
|
||||
return this.$store.state.patient.monitoring_status === 1;
|
||||
},
|
||||
transaction_log() {
|
||||
return this.$store.state.patient.transaction_log;
|
||||
},
|
||||
sorted_transaction_log() {
|
||||
if (!this.transaction_log) return [];
|
||||
return [...this.transaction_log].sort((a, b) => {
|
||||
return new Date(b.transaction_created) - new Date(a.transaction_created);
|
||||
});
|
||||
},
|
||||
selected_patient(){
|
||||
return this.$store.state.patient.selected_patient
|
||||
},
|
||||
patients() {
|
||||
const monitoringData = this.$store.state.patient.monitoring_data || {};
|
||||
|
||||
// Debug log
|
||||
console.log('monitoring_data:', monitoringData);
|
||||
|
||||
// Pastikan data adalah array
|
||||
if (Array.isArray(monitoringData.data)) {
|
||||
console.log('patients array:', monitoringData.data);
|
||||
return monitoringData.data;
|
||||
}
|
||||
|
||||
console.log('patients fallback: empty array');
|
||||
return [];
|
||||
return this.$store.state.patient.monitoring_data?.data || [];
|
||||
},
|
||||
openalertnopay:{
|
||||
get() { return this.$store.state.patient.open_alert_no_pay },
|
||||
set(val) { this.$store.commit("patient/update_open_alert_no_pay",false) }
|
||||
},
|
||||
msgalertnopay(){
|
||||
return this.$store.state.patient.msg_alert_no_pay
|
||||
},
|
||||
curr_page: {
|
||||
get() { return this.$store.state.patient.current_page },
|
||||
set(val) { this.$store.commit("patient/update_current_page",val) }
|
||||
},
|
||||
xtotal_page: {
|
||||
get() { return this.$store.state.patient.total_page },
|
||||
set(val) { this.$store.commit("patient/update_total_page", val) }
|
||||
},
|
||||
dialog_info: {
|
||||
get() { return this.$store.state.patient.dialog_info },
|
||||
set(v) { this.$store.commit('patient/set_dialog_info', v) }
|
||||
},
|
||||
dialog_info_message() {
|
||||
return this.$store.state.patient.dialog_info_message
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
deleteTransaction(item) {
|
||||
this.$store.dispatch("patient/delete_transaction_by_labnumber", {
|
||||
labnumber: item.lab_number,
|
||||
is_stemcell: item.is_stemcell
|
||||
});
|
||||
},
|
||||
// ===== FIX: TAMBAHKAN METHOD isSelected =====
|
||||
isSelected(item) {
|
||||
if (!this.selected_patient || !item) return false;
|
||||
return this.selected_patient.lab_number === item.lab_number;
|
||||
},
|
||||
|
||||
convertMoney(money) {
|
||||
return one_money(money);
|
||||
},
|
||||
closeAlertNoPay(){
|
||||
this.$store.commit("patient/update_open_alert_no_pay",false)
|
||||
},
|
||||
async selectPatient(patient) {
|
||||
console.log('Selected patient:', patient);
|
||||
this.$store.commit("patient/update_selected_patient", patient);
|
||||
this.$store.dispatch("patient/get_json_response");
|
||||
await this.$store.dispatch("patient/check_exist_transaction", { labnumber: patient.lab_number });
|
||||
},
|
||||
sendTransaction(item) {
|
||||
this.$store.dispatch("patient/post_transaction_by_labnumber", {
|
||||
labnumber: item.lab_number,
|
||||
is_stemcell: item.is_stemcell
|
||||
});
|
||||
},
|
||||
reSendTransaction(item) {
|
||||
this.$store.dispatch("patient/re_post_transaction_by_labnumber", {
|
||||
labnumber: item.lab_number,
|
||||
is_stemcell: item.is_stemcell
|
||||
});
|
||||
},
|
||||
changePage(page) {
|
||||
this.$store.commit("patient/update_current_page", page);
|
||||
|
||||
let params = {
|
||||
start_date: this.$store.state.patient.start_date,
|
||||
end_date: this.$store.state.patient.end_date,
|
||||
corporate_id: this.$store.state.patient.selected_corporate.CorporateID,
|
||||
ais_status: this.$store.state.patient.selected_status.value,
|
||||
page: page
|
||||
};
|
||||
|
||||
const searchVal = this.$store.state.patient.search.trim();
|
||||
if (searchVal) {
|
||||
// Cek jika input kemungkinan adalah nomor lab (mengandung huruf dan angka)
|
||||
if (/[a-zA-Z]/.test(searchVal) && /\d/.test(searchVal)) {
|
||||
params.lab_number = searchVal;
|
||||
} else {
|
||||
params.patient_name = searchVal;
|
||||
}
|
||||
}
|
||||
|
||||
this.$store.dispatch("patient/monitoring_transaction", params);
|
||||
},
|
||||
closeDialogInfo() {
|
||||
this.$store.commit('patient/set_dialog_info', false);
|
||||
},
|
||||
forgetAlertNoPay(){
|
||||
var xval = this.$store.state.paymentnew.types
|
||||
var valpay = 0
|
||||
xval.forEach(function(obj){
|
||||
obj.chex = false
|
||||
obj.leftvalue = 0
|
||||
obj.rightvalue = 0
|
||||
obj.selected_card = {id:0,name:''}
|
||||
obj.selected_edc = {id:0,name:''}
|
||||
})
|
||||
this.$store.commit("paymentnew/update_total_payment",0)
|
||||
this.$store.commit("patient/update_open_alert_no_pay",false)
|
||||
},
|
||||
formatNumber(value) {
|
||||
if (value === null || value === undefined || value === '') {
|
||||
return '0';
|
||||
}
|
||||
// Convert to number
|
||||
const num = parseFloat(value);
|
||||
if (isNaN(num)) {
|
||||
return value;
|
||||
}
|
||||
// Split integer and decimal parts
|
||||
const parts = num.toString().split('.');
|
||||
// Format integer part with dot as thousand separator
|
||||
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
||||
// Join back with decimal part if exists
|
||||
return parts.join('.');
|
||||
}
|
||||
},
|
||||
|
||||
// ===== TAMBAHKAN mounted untuk debugging =====
|
||||
mounted() {
|
||||
console.log('Component mounted');
|
||||
console.log('Initial patients:', this.patients);
|
||||
console.log('Store state:', this.$store.state.patient);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,784 @@
|
||||
<template>
|
||||
<v-layout row justify-center>
|
||||
<v-dialog
|
||||
v-model="promisedialog"
|
||||
persistent
|
||||
max-width="30%"
|
||||
>
|
||||
<v-card>
|
||||
<v-card-title
|
||||
class="headline darken-1 pt-2 pb-2"
|
||||
primary-title
|
||||
>
|
||||
Konfirmasi
|
||||
</v-card-title>
|
||||
<v-card-text class="pt-2 pb-2">
|
||||
<v-layout row>
|
||||
<v-flex xs12 d-flex>
|
||||
<v-layout row>
|
||||
<v-flex pb-1 v-html="msgdialogpromise" xs12>
|
||||
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
color="black"
|
||||
flat
|
||||
@click="promisedialog = false"
|
||||
>
|
||||
Tutup
|
||||
</v-btn>
|
||||
<v-btn
|
||||
color="purple"
|
||||
flat
|
||||
@click="closeDialogPromise()"
|
||||
>
|
||||
Lanjutkan
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="testdialog" persistent max-width="50%">
|
||||
<v-card >
|
||||
<v-card-title
|
||||
dark
|
||||
class="headline warning pt-2 pb-2"
|
||||
primary-title
|
||||
style="color:white"
|
||||
>
|
||||
<h4>Pemeriksaan</h4>
|
||||
</v-card-title>
|
||||
<v-card-text class="pt-2 pb-2">
|
||||
<v-layout pa-2 row wrap>
|
||||
<v-flex xs12 pl-1>
|
||||
<v-card flat>
|
||||
<v-flex xs12 mb-2 pa-2>
|
||||
<v-layout row>
|
||||
<v-flex pt-2 xs4>
|
||||
<h4 class="mb-1">Tambah Pemeriksaan</h4>
|
||||
</v-flex>
|
||||
<v-flex style="text-align:right" pt-1 xs8>
|
||||
<v-progress-circular v-if="getdatastatus === 1"
|
||||
indeterminate
|
||||
color="primary"
|
||||
></v-progress-circular>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row>
|
||||
<v-flex pr-1 xs6>
|
||||
<v-autocomplete
|
||||
label="Pemeriksaan"
|
||||
v-model="vtest"
|
||||
outline
|
||||
:items="vtests"
|
||||
:search-input.sync="search_test"
|
||||
auto-select-first
|
||||
no-filter
|
||||
hide-details
|
||||
item-text="pxname"
|
||||
return-object
|
||||
:loading="isLoading"
|
||||
no-data-text="Cari Pemeriksaan ..."
|
||||
>
|
||||
<template
|
||||
slot="item"
|
||||
slot-scope="{ item }"
|
||||
>
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title v-text="item.pxname"></v-list-tile-title>
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
</v-flex>
|
||||
<v-flex class="xs6 pl-3">
|
||||
<v-btn
|
||||
small
|
||||
fab
|
||||
dark
|
||||
depressed
|
||||
color="warning"
|
||||
@click="addTestToAll()"
|
||||
>
|
||||
<v-icon>add</v-icon>
|
||||
</v-btn>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
</v-flex>
|
||||
</v-card>
|
||||
<v-card >
|
||||
<v-flex xs12 pa-0 pt-1 pb-1>
|
||||
<v-layout row>
|
||||
<v-flex pa-0 xs12>
|
||||
<v-flex text-md-right>
|
||||
<v-select
|
||||
|
||||
v-if="showdropdowncito === 'Y'"
|
||||
item-text="name"
|
||||
return-object
|
||||
:items="citos"
|
||||
v-model="selected_cito"
|
||||
label="Pilihan Cito"
|
||||
></v-select>
|
||||
</v-flex>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-layout row>
|
||||
<v-flex pa-0 pl-1 pr-1 pt-0 xs12>
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="testsall"
|
||||
:loading="isLoading"
|
||||
hide-actions>
|
||||
<template slot="items" slot-scope="props">
|
||||
<tr>
|
||||
<td class="text-xs-center pa-2 pl-2" >
|
||||
<v-checkbox color="warning" class="text-xs-center" primary hide-details @change="changeTestAll(props.item,props.item.status)" v-model="props.item.status"></v-checkbox>
|
||||
</td>
|
||||
<td class="text-xs-center pa-2" >
|
||||
<v-checkbox color="warning" class="text-xs-center" primary hide-details @change="changeTestCito(props.item)" v-model="props.item.cito"></v-checkbox>
|
||||
</td>
|
||||
<td class="text-xs-left pa-2" >
|
||||
{{ props.item.pxname }}
|
||||
<v-select
|
||||
v-if="(props.item.xid !== 0 || props.item.xid !== '0') && props.item.status === false"
|
||||
item-text="label"
|
||||
return-object
|
||||
:items="charges"
|
||||
hide-details
|
||||
|
||||
v-model="props.item.charge"
|
||||
@change="changeCharge(props.item,props.item.charge)"
|
||||
label="Pilihan potongan admin"
|
||||
></v-select>
|
||||
</td>
|
||||
<td class="text-xs-center pa-2">{{ convertMoney(props.item.bruto) }}</td>
|
||||
<td class="text-xs-center pa-2">{{ convertMoney(props.item.discount) }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<span v-if="(props.item.xid !== 0 || props.item.xid !== '0') && props.item.status">{{ convertMoney(props.item.total) }}</span>
|
||||
<span v-if="(props.item.xid !== 0 || props.item.xid !== '0') && props.item.status === false" style="text-decoration: line-through;">{{ convertMoney(props.item.total) }}</span>
|
||||
<span v-if="(props.item.xid !== 0 || props.item.xid !== '0') && props.item.status === false">{{totalRetur(props.item)}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-card>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-divider></v-divider>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn
|
||||
flat
|
||||
@click="closeDialogOrder"
|
||||
>
|
||||
Tutup
|
||||
</v-btn>
|
||||
<v-btn v-if="getdatastatus !== 1" style="margin-right:0" @click="checkPromiseOrderAdd()" flat color="warning" dark>Simpan</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<one-dialog-error :status="opendialogerror" :msg="msgerror" @close-dialog-error="opendialogerror = false"></one-dialog-error>
|
||||
</v-layout>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
table {
|
||||
font-family: arial, sans-serif;
|
||||
btest-collapse: collapse;
|
||||
width: 100%;
|
||||
background:white;
|
||||
btest: 1px solid #ddd!important;
|
||||
}
|
||||
|
||||
th, td {
|
||||
|
||||
|
||||
padding: .75rem 1.25rem;
|
||||
btest: 1px solid #ddd!important;
|
||||
}
|
||||
table>tr>td {
|
||||
padding: .75rem 1.25rem;
|
||||
btest: 1px solid #ddd!important;
|
||||
}
|
||||
table>tr>td:first {
|
||||
padding-left:15px!important;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
module.exports = {
|
||||
components : {
|
||||
'one-dialog-error':httpVueLoader('../../common/oneDialogErrorFajri.vue')
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
printwidth:600,
|
||||
search_test:'',
|
||||
orderid:-1,
|
||||
mouid:-1,
|
||||
is_loading:false,
|
||||
isLoading:false,
|
||||
error_promise:false,
|
||||
error_promise_dialog:false,
|
||||
selected_promise:{},
|
||||
opendialogerror:false,
|
||||
msgerror:"",
|
||||
promiseright:'-',
|
||||
charges:[{value:0,label:'0%'},{value:5,label:'5%'},{value:10,label:'10%'},{value:25,label:'25%'}],
|
||||
headers: [
|
||||
{
|
||||
text: "STATUS",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "status",
|
||||
width: "10%",
|
||||
class: "pa-1 warning white--text"
|
||||
},
|
||||
{
|
||||
text: "CITO",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "cito",
|
||||
width: "10%",
|
||||
class: "pa-1 warning white--text"
|
||||
},
|
||||
{
|
||||
text: "PEMERIKSAAN",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "testname",
|
||||
width: "30%",
|
||||
class: "pa-1 warning white--text"
|
||||
},
|
||||
|
||||
{
|
||||
text: "BRUTO",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "bruto",
|
||||
width: "20%",
|
||||
class: "pa-1 warning white--text"
|
||||
},
|
||||
{
|
||||
text: "DISKON",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "discount",
|
||||
width: "20%",
|
||||
class: "pa-1 warning white--text"
|
||||
},
|
||||
{
|
||||
text: "TOTAL",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "total",
|
||||
width: "20%",
|
||||
class: "pa-1 warning white--text"
|
||||
}
|
||||
],
|
||||
headerverifications :[
|
||||
{
|
||||
text: "STATUS",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "status",
|
||||
width: "7%",
|
||||
class: "pa-1 warning white--text"
|
||||
},
|
||||
{
|
||||
text: "CITO",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "cito",
|
||||
width: "7%",
|
||||
class: "pa-1 warning white--text"
|
||||
},
|
||||
{
|
||||
text: "PEMERIKSAAN",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "testname",
|
||||
width: "15%",
|
||||
class: "pa-1 warning white--text"
|
||||
},
|
||||
|
||||
{
|
||||
text: "BRUTO",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "bruto",
|
||||
width: "10%",
|
||||
class: "pa-1 warning white--text"
|
||||
},
|
||||
{
|
||||
text: "DISKON",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "discount",
|
||||
width: "10%",
|
||||
class: "pa-1 warning white--text"
|
||||
},
|
||||
{
|
||||
text: "TOTAL",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "total",
|
||||
width: "15%",
|
||||
class: "pa-1 warning white--text"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
testdialog:{
|
||||
get() {
|
||||
return this.$store.state.test.test_dialog
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("test/update_test_dialog",val)
|
||||
}
|
||||
},
|
||||
savestatusverification(){
|
||||
return this.$store.state.test.save_status_verification
|
||||
},
|
||||
vmsgsave(){
|
||||
return this.$store.state.test.save_message
|
||||
},
|
||||
vstatussave(){
|
||||
return this.$store.state.test.save_status
|
||||
},
|
||||
testsregistration(){
|
||||
return this.$store.state.test.test_registration
|
||||
},
|
||||
testsverification(){
|
||||
return this.$store.state.test.test_verification
|
||||
},
|
||||
testsall(){
|
||||
return this.$store.state.test.test_all
|
||||
},
|
||||
vtests(){
|
||||
return this.$store.state.test.tests
|
||||
},
|
||||
vtest:{
|
||||
get() {
|
||||
return this.$store.state.test.test
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("test/update_test",val)
|
||||
console.log(val.promise)
|
||||
this.promiseright = val.promise
|
||||
this.$store.commit("test/update_show_promise_right",true)
|
||||
}
|
||||
},
|
||||
vcito:{
|
||||
get() {
|
||||
return this.$store.state.test.cito
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("test/update_cito",val)
|
||||
}
|
||||
},
|
||||
citos(){
|
||||
return this.$store.state.test.citos
|
||||
},
|
||||
selected_cito:{
|
||||
get() {
|
||||
return this.$store.state.test.selected_cito
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("test/update_selected_cito",val)
|
||||
}
|
||||
},
|
||||
xpromises(){
|
||||
return this.$store.state.test.promises
|
||||
},
|
||||
xpromise:{
|
||||
get() {
|
||||
return this.$store.state.test.promise
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("test/update_promise",val)
|
||||
}
|
||||
},
|
||||
promisedialog:{
|
||||
get() {
|
||||
return this.$store.state.test.promise_dialog
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("test/update_promise_dialog",val)
|
||||
}
|
||||
},
|
||||
msgdialogpromise:{
|
||||
get() {
|
||||
return this.$store.state.test.msg_promise_dialog
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("test/update_msg_promise_dialog",val)
|
||||
}
|
||||
},
|
||||
showpromiseleft:{
|
||||
get() {
|
||||
return this.$store.state.test.show_promise_left
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("test/update_show_promise_left",val)
|
||||
}
|
||||
},
|
||||
showpromiseright:{
|
||||
get() {
|
||||
return this.$store.state.test.show_promise_right
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("test/update_show_promise_right",val)
|
||||
}
|
||||
},
|
||||
promiseleft:{
|
||||
get() {
|
||||
return this.$store.state.test.promise_left
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("test/update_promise_left",val)
|
||||
}
|
||||
},
|
||||
getdatastatus:{
|
||||
get() {
|
||||
return this.$store.state.test.save_status
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("test/update_save_status",val)
|
||||
}
|
||||
},
|
||||
showdropdowncito:{
|
||||
get() {
|
||||
return this.$store.state.test.show_cito_dropdown
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("test/update_show_cito_dropdown",val)
|
||||
}
|
||||
},
|
||||
},
|
||||
methods : {
|
||||
showExist() {
|
||||
this.opendialogerror = true
|
||||
this.msgerror = "Pemeriksaan Sudah Ada"
|
||||
},
|
||||
totalRetur(row){
|
||||
var charge = parseFloat(row.charge.value)
|
||||
var charge_amount = (charge/100) * parseFloat(row.total)
|
||||
var totalaftercharge = parseFloat(row.total) - (charge_amount)
|
||||
return one_money(totalaftercharge)
|
||||
},
|
||||
convertMoney(money){
|
||||
return one_money(money)
|
||||
},
|
||||
saveTestAdditionVerification(){
|
||||
let arrtest = this.$store.state.test.test_verification
|
||||
var prm = {
|
||||
orderid:this.$store.state.patient.selected_patient.orderid,
|
||||
tests:arrtest
|
||||
}
|
||||
this.$store.dispatch("test/savetestadditionalverification",prm)
|
||||
},
|
||||
changePromise(value){
|
||||
let arrtest = this.$store.state.test.test_verification
|
||||
var idx = _.findIndex(arrtest, item => item.idx === value.idx)
|
||||
arrtest[idx]['promise'] = value.promise
|
||||
this.$store.commit("test/update_test_verification",arrtest)
|
||||
},
|
||||
closeDialogOrder(){
|
||||
if(this.savestatus !== 2){
|
||||
this.$store.commit("test/update_test_dialog",false)
|
||||
}
|
||||
else{
|
||||
let arrpatient = this.$store.state.patient.patients
|
||||
var idx = _.findIndex(arrpatient, item => item.idx === this.$store.state.patient.selected_patient.idx)
|
||||
this.$store.dispatch("patient/search",{
|
||||
search: this.$store.state.patient.search,
|
||||
status: this.$store.state.patient.selected_status.value,
|
||||
lastidx:idx
|
||||
})
|
||||
this.$store.commit("test/update_test_dialog",false)
|
||||
}
|
||||
},
|
||||
changeCharge(row,value){
|
||||
var oldArr = this.$store.state.test.test_all
|
||||
var idx = _.findIndex(oldArr, row)
|
||||
oldArr[idx].active = 'Y'
|
||||
oldArr[idx].charge = value
|
||||
this.$store.commit("test/update_test_all",oldArr)
|
||||
},
|
||||
changeTestAll(row,value){
|
||||
var oldArr = this.$store.state.test.test_all
|
||||
var idx = _.findIndex(oldArr, row)
|
||||
let nowstatus = row.status
|
||||
if(nowstatus == false && row.xid != '0'){
|
||||
this.$store.dispatch("test/checkstatus",row)
|
||||
}
|
||||
else{
|
||||
oldArr[idx].active = 'Y'
|
||||
oldArr[idx].status = nowstatus
|
||||
this.$store.commit("test/update_test_all",oldArr)
|
||||
}
|
||||
},
|
||||
changeTestCito(value){
|
||||
this.$store.commit("test/update_selected_test",value)
|
||||
var prm = value
|
||||
prm.orderid = this.$store.state.patient.selected_patient.orderid
|
||||
this.$store.dispatch("test/getnewprice",prm)
|
||||
},
|
||||
thr_search_test: _.debounce( function () {
|
||||
var oldArr = this.$store.state.test.test_all
|
||||
this.promiseright = '-'
|
||||
|
||||
var prm = {
|
||||
orderid:this.$store.state.test.orderid,
|
||||
search: this.search_test,
|
||||
cito:this.$store.state.test.cito
|
||||
}
|
||||
this.$store.dispatch("test/searchtest",prm)
|
||||
},2000),
|
||||
addTestToAll(){
|
||||
var xtestall = this.$store.state.test.test_all
|
||||
var all_nattest = []
|
||||
var xchecked_test = _.filter(xtestall, function(o) { return o.status })
|
||||
xchecked_test = xchecked_test
|
||||
xchecked_test.forEach(function(test_a) {
|
||||
//console.log(test_a)
|
||||
//debugger
|
||||
|
||||
test_a.nat_test.forEach(function(x_test_a) {
|
||||
all_nattest.push(x_test_a)
|
||||
})
|
||||
})
|
||||
var xtestadditional = this.$store.state.test.test
|
||||
var is_exist = false
|
||||
var xnattest_now = xtestadditional.nat_test
|
||||
//debugger
|
||||
|
||||
//console.log(xnattest_now)
|
||||
//debugger
|
||||
xnattest_now.forEach(function(nattest_a) {
|
||||
var idx_check = _.findIndex(all_nattest, function(o) { return parseInt(o) === parseInt(nattest_a) })
|
||||
if(idx_check !== -1)
|
||||
is_exist = true
|
||||
})
|
||||
if(!is_exist){
|
||||
console.log(xtestadditional.type)
|
||||
if(xtestadditional.type !== 'PXR' && xtestadditional.type !== 'PR'){
|
||||
xtestall.push(xtestadditional)
|
||||
}
|
||||
else if(xtestadditional.type === 'PXR' || xtestadditional.type === 'PR'){
|
||||
var child_test = xtestadditional.child_test
|
||||
console.log(child_test)
|
||||
child_test.forEach(function(entry) {
|
||||
var new_test = {}
|
||||
new_test.xid = '0'
|
||||
new_test.nat_testid = entry.Nat_TestID
|
||||
new_test.nat_test = entry.nat_test
|
||||
new_test.is_packet = entry.is_packet
|
||||
new_test.packet_id = entry.packet_id
|
||||
new_test.type = entry.px_type
|
||||
new_test.pxid = entry.T_TestID
|
||||
new_test.pxcode = entry.pxcode
|
||||
new_test.pxsascode = entry.T_TestSasCode
|
||||
new_test.pxname = entry.T_TestSasCode+" "+entry.T_TestName
|
||||
new_test.test_name = entry.T_TestName
|
||||
new_test.isresult = entry.isresult
|
||||
new_test.bruto = entry.T_PriceAmount
|
||||
new_test.discountpersen = entry.T_PriceDisc
|
||||
new_test.discountrp = entry.T_PriceDiscRp
|
||||
new_test.discount = ( ( entry.T_PriceDisc / 100 ) * entry.T_PriceAmount ) + entry.T_PriceDiscRp
|
||||
//new_test.discount = ( ( entry.T_PriceDisc / 100 ) * entry.T_PriceAmount ) - entry.T_PriceDiscRp
|
||||
new_test.total = entry.T_PriceAmount - new_test.discount
|
||||
new_test.status = true
|
||||
new_test.cito = false
|
||||
new_test.cito_before = "N"
|
||||
new_test.promise = ""
|
||||
xtestall.push(new_test)
|
||||
})
|
||||
}
|
||||
|
||||
this.$store.commit("test/update_test_all",xtestall)
|
||||
this.$store.commit("test/update_test",{})
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
addTestToAllxx(){
|
||||
|
||||
var xtestall = this.$store.state.test.test_all
|
||||
var xtestadditional = this.$store.state.test.test
|
||||
//nat_testid tambaha/n
|
||||
let n_id = xtestadditional.nat_testid
|
||||
// all child_test
|
||||
let x_idx = _.findIndex(xtestall, function(p) {
|
||||
console.log('n_id', n_id)
|
||||
console.log('px_nat_testid', p.nat_testid)
|
||||
return n_id == parseInt(p.nat_testid)
|
||||
});
|
||||
let flag_exists = false
|
||||
if (x_idx > -1 ) flag_exists = true
|
||||
if (! flag_exists) {
|
||||
if(xtestadditional.child_test != ''){
|
||||
let add_ct = JSON.parse(xtestadditional.child_test)
|
||||
for(let idx =0; idx < add_ct.length ; idx++) {
|
||||
let add_ct_id = add_ct[idx].pxnat_testid
|
||||
let x_idx = _.findIndex(xtestall, function(p) {
|
||||
console.log('ct id', add_ct_id)
|
||||
console.log('px_nat_testid', p.nat_testid)
|
||||
return add_ct_id == parseInt(p.nat_testid)
|
||||
});
|
||||
if (x_idx > -1 ) {
|
||||
flag_exists = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (flag_exists) {
|
||||
this.showExist()
|
||||
return
|
||||
}
|
||||
var xnew = {
|
||||
xid:0,
|
||||
type:xtestadditional.type,
|
||||
status:'Y',
|
||||
cito:false,
|
||||
cito_before:'N',
|
||||
testid:xtestadditional.pxid,
|
||||
testcode:xtestadditional.pxcode,
|
||||
testsascode:xtestadditional.pxsascode,
|
||||
testname:xtestadditional.pxname,
|
||||
isresult:xtestadditional.isresult,
|
||||
bruto:xtestadditional.bruto,
|
||||
discount:xtestadditional.discounttotal,
|
||||
discountpersen:xtestadditional.discount,
|
||||
discountrp:xtestadditional.discountrp,
|
||||
charge:{value:0,label:'0%'},
|
||||
total:xtestadditional.total,
|
||||
nat_test:xtestadditional.nat_test,
|
||||
child_test:xtestadditional.child_test,
|
||||
is_packet:xtestadditional.is_packet,
|
||||
packet_id:xtestadditional.packet_id
|
||||
}
|
||||
|
||||
if(xnew.type === 'PN' || xnew.type === 'PX'){
|
||||
xtestall.push(xnew)
|
||||
this.$store.commit("test/update_test_all",xtestall)
|
||||
this.$store.commit("test/update_test",{})
|
||||
}
|
||||
|
||||
if(xnew.type === 'PXR'){
|
||||
xnew.orderid = this.$store.state.patient.selected_patient.orderid
|
||||
var params = {all:xtestall,new:xnew}
|
||||
this.$store.dispatch("test/getchildrenprofil",params)
|
||||
}
|
||||
|
||||
|
||||
if(xnew.type === 'SINGLE-PR'){
|
||||
var child_test = JSON.parse(xtestadditional.child_test)
|
||||
console.log(child_test)
|
||||
child_test.forEach(item => {
|
||||
var xxnew = {
|
||||
xid:0,
|
||||
type:'SINGLE',
|
||||
status:'Y',
|
||||
cito:false,
|
||||
cito_before:'N',
|
||||
testid:item.pxid,
|
||||
testcode:item.pxcode,
|
||||
testsascode:item.pxsascode,
|
||||
testname:item.pxname,
|
||||
isresult:item.isresult,
|
||||
bruto:item.bruto,
|
||||
discount:item.discounttotal,
|
||||
discountpersen:item.discount,
|
||||
discountrp:item.discountrp,
|
||||
charge:{value:0,label:'0%'},
|
||||
total:item.total
|
||||
}
|
||||
xtestall.push(xxnew)
|
||||
})
|
||||
|
||||
this.$store.commit("test/update_test_all",xtestall)
|
||||
this.$store.commit("test/update_test",{})
|
||||
}
|
||||
|
||||
},
|
||||
saveTestAdditional(){
|
||||
var prm = {
|
||||
orderid:this.$store.state.patient.selected_patient.orderid,
|
||||
testall: this.$store.state.test.test_all,
|
||||
selected_cito:this.$store.state.test.selected_cito
|
||||
}
|
||||
this.$store.dispatch("test/savetestadditional",prm)
|
||||
},
|
||||
checkPromiseOrderAdd(){
|
||||
this.$store.commit("test/update_act",'additional')
|
||||
var prm = {
|
||||
orderid:this.$store.state.patient.selected_patient.orderid,
|
||||
tests: this.$store.state.test.test_all
|
||||
}
|
||||
this.$store.dispatch("test/checkpromisetests",prm)
|
||||
},
|
||||
checkPromiseOrderVerification(){
|
||||
this.$store.commit("test/update_act",'verification')
|
||||
var prm = {
|
||||
orderid:this.$store.state.patient.selected_patient.orderid,
|
||||
tests: this.$store.state.test.test_verification
|
||||
}
|
||||
this.$store.dispatch("test/checkpromisetests",prm)
|
||||
},
|
||||
|
||||
openDialogPromise(value){
|
||||
this.error_promise_dialog = false
|
||||
this.selected_promise = {}
|
||||
this.$store.commit("test/update_selected_detail_verification",value)
|
||||
this.promisedialog = true
|
||||
},
|
||||
addPromiseTodetail(){
|
||||
if(this.selected_promise){
|
||||
let arrtest = this.$store.state.test.test_verification
|
||||
console.log(arrtest)
|
||||
var idx = _.findIndex(arrtest, item => item.idx === this.$store.state.test.selected_detail_verification.idx)
|
||||
arrtest[idx]['promise'] = this.selected_promise.id
|
||||
arrtest[idx]['promisename'] = this.selected_promise.name
|
||||
this.$store.commit("test/update_test_verification",arrtest)
|
||||
this.promisedialog = false
|
||||
}
|
||||
else{
|
||||
this.error_promise_dialog = true
|
||||
}
|
||||
|
||||
},
|
||||
closeDialogPromise(){
|
||||
var act = this.$store.state.test.act
|
||||
this.promisedialog = false
|
||||
if(act === 'additional')
|
||||
this.saveTestAdditional()
|
||||
else
|
||||
this.saveTestAdditionVerification()
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
search_test(val,old) {
|
||||
if (val == old ) return
|
||||
if (! val) return
|
||||
if (val == '') return
|
||||
if (val.length < 1 ) return
|
||||
if (this.$store.state.test.autocomplete_status == 1 ) return
|
||||
this.thr_search_test()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
96
test/vuex/ais-monitoring-transaction-v4/index.php
Normal file
96
test/vuex/ais-monitoring-transaction-v4/index.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>One</title>
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/google-fonts.css">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/icomoon-fonts.css">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/vuetify.min.css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Material+Icons" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div v-cloak id="app">
|
||||
<v-app id="smartApp" >
|
||||
<one-navbar></one-navbar>
|
||||
<v-content style="background:#F5E8DF!important" >
|
||||
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
|
||||
<v-layout column wrap >
|
||||
<one-fo-cashier-list></one-fo-cashier-list>
|
||||
|
||||
<!-- <v-flex xs6 class="right" fill-height pa-1>
|
||||
<one-fo-cashier-payment></one-fo-cashier-payment>
|
||||
<one-fo-cashier-test></one-fo-cashier-test>
|
||||
</v-flex> -->
|
||||
</v-layout>
|
||||
</v-container>
|
||||
</v-content>
|
||||
<one-footer> </one-footer>
|
||||
</v-app>
|
||||
</div>
|
||||
|
||||
<!-- Vendor -->
|
||||
<script src="../../../libs/vendor/moment.min.js"></script>
|
||||
<script src="../../../libs/vendor/numeral.min.js"></script>
|
||||
<script src="../../../libs/vendor/moment-locale-id.js"></script>
|
||||
<script src="../../../libs/vendor/lodash.js"></script>
|
||||
<script src="../../../libs/vendor/axios.min.js"></script>
|
||||
<script src="../../../libs/vendor/vue.js"></script>
|
||||
<script src="../../../libs/vendor/vuex.js"></script>
|
||||
<script src="../../../libs/vendor/vuetify.js"></script>
|
||||
<script src="../../../libs/vendor/httpVueLoader.js"></script>
|
||||
<script src="../../../libs/one_global.js"></script>
|
||||
<!-- App Script -->
|
||||
<?php
|
||||
$ts = "?ts=" . Date("ymdhis");
|
||||
?>
|
||||
<script type="module">
|
||||
window.calculate_age = function (inp_dob) {
|
||||
var now = moment(new Date())
|
||||
var dob = moment(new Date(inp_dob))
|
||||
var year = now.diff(dob,'years')
|
||||
dob.add(year,'years')
|
||||
var month = now.diff(dob,'months')
|
||||
dob.add(month,'months')
|
||||
var day = now.diff(dob,'days')
|
||||
if (isNaN(year)) return ''
|
||||
return `${year} tahun ${month} bulan ${day} hari`
|
||||
}
|
||||
|
||||
|
||||
import { store } from './store.js<?php echo $ts ?>';
|
||||
//for testing
|
||||
window.store = store;
|
||||
new Vue({
|
||||
store,
|
||||
el: '#app',
|
||||
methods: {
|
||||
tab_selected : function(tab) {
|
||||
return this.$store.state.tab_selected == tab
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
|
||||
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
|
||||
'one-fo-cashier-list': httpVueLoader('./components/oneFoCashierList.vue'),
|
||||
'one-fo-cashier-payment': httpVueLoader('./components/oneFoCashierPaymentNew.vue'),
|
||||
'one-fo-cashier-test': httpVueLoader('./components/oneFoCashierTest.vue')
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none
|
||||
}
|
||||
.left {
|
||||
}
|
||||
.right {
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
609
test/vuex/ais-monitoring-transaction-v4/modules/patient.js
Normal file
609
test/vuex/ais-monitoring-transaction-v4/modules/patient.js
Normal file
@@ -0,0 +1,609 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/patient.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
search_patient: 0,
|
||||
search_error_message: '',
|
||||
start_date:moment(new Date()).format('YYYY-MM-DD'),
|
||||
last_search_val: '',
|
||||
last_search_type: '',
|
||||
end_date:moment(new Date()).format('YYYY-MM-DD'),
|
||||
search:'',
|
||||
patients: [],
|
||||
total_patient: 0,
|
||||
selected_patient: {},
|
||||
save_error_message: '',
|
||||
statuses:[{name:'Semua',value:'A'},{name:'Sudah Terkirim',value:'Y'},{name:'Belum Terkirim',value:'N'}],
|
||||
selected_status:{name:'Semua',value:'A'},
|
||||
open_alert_no_pay: false,
|
||||
msg_alert_no_pay: "Loh ... Gak jadi bayar dong ?",
|
||||
current_page:1,
|
||||
total_page:0,
|
||||
pay_disabled:'Y',
|
||||
autocomplete_status:0,
|
||||
companies:[{id:0,name:'Semua'}],
|
||||
selected_company:{id:0,name:'Semua'},
|
||||
logs:[],
|
||||
unduhan:[],
|
||||
loading_download:false,
|
||||
loading_send:false,
|
||||
monitoring_data: [],
|
||||
monitoring_status: 0,
|
||||
monitoring_error_message: '',
|
||||
corporates: [],
|
||||
selected_corporate: { CorporateID: '0', CorporateName: 'Semua', CorporateCode: '' },
|
||||
transaction_log: null,
|
||||
dialog_info: false,
|
||||
dialog_info_message: ''
|
||||
},
|
||||
mutations: {
|
||||
set_last_search(state, { val, type }) {
|
||||
state.last_search_val = val;
|
||||
state.last_search_type = type;
|
||||
},
|
||||
|
||||
update_loading_send(state,val){
|
||||
state.loading_send = val
|
||||
},
|
||||
update_loading_download(state,val){
|
||||
state.loading_download = val
|
||||
},
|
||||
update_unduhan(state,val){
|
||||
state.unduhan = val
|
||||
},
|
||||
update_logs(state,val){
|
||||
state.logs = val
|
||||
},
|
||||
update_autocomplete_status(state,val){
|
||||
state.autocomplete_status = val
|
||||
},
|
||||
update_companies(state, val) {
|
||||
state.companies = val
|
||||
},
|
||||
update_selected_company(state, val) {
|
||||
state.selected_company = val
|
||||
},
|
||||
update_pay_disabled(state, val) {
|
||||
state.pay_disabled = val
|
||||
},
|
||||
update_total_page(state, val) {
|
||||
state.total_page = val
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_page = val
|
||||
},
|
||||
update_search_error_message(state, patient) {
|
||||
state.search_error_message = patient
|
||||
},
|
||||
update_search_patient(state, patient) {
|
||||
state.search_patient = patient
|
||||
},
|
||||
update_patients(state, data) {
|
||||
state.patients = data.records
|
||||
state.total_patient = data.total
|
||||
state.total_page = data.total
|
||||
},
|
||||
update_selected_patient(state, val) {
|
||||
state.selected_patient = val
|
||||
},
|
||||
update_start_date(state, val) {
|
||||
state.start_date = val
|
||||
},
|
||||
update_end_date(state, val) {
|
||||
state.end_date = val
|
||||
},
|
||||
update_search(state, val) {
|
||||
state.search = val
|
||||
},
|
||||
update_selected_status(state, val) {
|
||||
state.selected_status = val
|
||||
},
|
||||
update_open_alert_no_pay(state, val) {
|
||||
state.open_alert_no_pay = val
|
||||
},
|
||||
update_msg_alert_no_pay(state, val) {
|
||||
state.msg_alert_no_pay = val
|
||||
},
|
||||
set_monitoring_data(state, data) {
|
||||
state.monitoring_data = data;
|
||||
},
|
||||
set_monitoring_status(state, status) {
|
||||
state.monitoring_status = status;
|
||||
},
|
||||
set_monitoring_error_message(state, message) {
|
||||
state.monitoring_error_message = message;
|
||||
},
|
||||
update_corporates(state, data) {
|
||||
state.corporates = data;
|
||||
},
|
||||
update_selected_corporate(state, data) {
|
||||
state.selected_corporate = data;
|
||||
},
|
||||
set_transaction_log(state, payload) {
|
||||
state.transaction_log = payload;
|
||||
},
|
||||
set_dialog_info(state, status) {
|
||||
state.dialog_info = status;
|
||||
},
|
||||
set_dialog_info_message(state, message) {
|
||||
state.dialog_info_message = message;
|
||||
}
|
||||
|
||||
},
|
||||
actions: {
|
||||
async search(context, prm) {
|
||||
context.commit("update_search_patient", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
prm.company = context.state.selected_company.id
|
||||
let resp = await api.search(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_patient", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_patient", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_patients", data)
|
||||
context.commit("update_selected_patient", [])
|
||||
context.commit("update_total_page", data.total)
|
||||
/*if(prm.lastidx === 0){
|
||||
context.commit("update_selected_patient", data.records[0])
|
||||
if(!_.isEmpty(data.records[0]))
|
||||
context.commit("paymentnew/update_notes",data.records[0].notes,{root:true})
|
||||
else
|
||||
context.commit("paymentnew/update_notes",[],{root:true})
|
||||
}
|
||||
else{
|
||||
context.commit("update_selected_patient", data.records[prm.lastidx])
|
||||
context.commit("paymentnew/update_notes",data.records[prm.lastidx].notes,{root:true})
|
||||
}*/
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_patient", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async searchcompany(context,prm) {
|
||||
context.commit("update_autocomplete_status",1)
|
||||
try {
|
||||
let resp= await api.searchcompany(one_token(),prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
} else {
|
||||
context.commit("update_autocomplete_status",2)
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_companies",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
}
|
||||
},
|
||||
async download_data(context,prm) {
|
||||
context.commit("update_loading_download",true)
|
||||
try {
|
||||
let resp= await api.download_data(one_token(),prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading_download",false)
|
||||
} else {
|
||||
context.commit("update_loading_download",false)
|
||||
context.commit("update_unduhan",resp.data.records)
|
||||
context.commit("paymentnew/update_dialog_pay_success",true,{root:true})
|
||||
context.commit("update_autocomplete_status",2)
|
||||
context.dispatch("search",{
|
||||
startdate:context.state.start_date,
|
||||
enddate:context.state.start_date,
|
||||
search: context.state.search,
|
||||
status: context.state.selected_status.value,
|
||||
current_page:1,
|
||||
lastidx:0
|
||||
})
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_loading_download",false)
|
||||
}
|
||||
},
|
||||
async sendresult(context,prm) {
|
||||
context.commit("update_loading_send",true)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.sendresult(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading_send",false)
|
||||
} else {
|
||||
|
||||
context.dispatch("getlogs",{})
|
||||
//alert("Proses unduh selesai")
|
||||
context.commit("update_loading_send",false)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_loading_send",false)
|
||||
}
|
||||
},
|
||||
async getlogs(context,prm) {
|
||||
context.commit("update_autocomplete_status",1)
|
||||
try {
|
||||
prm = context.state.selected_patient
|
||||
prm.token = one_token()
|
||||
let resp= await api.getlogs(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
} else {
|
||||
|
||||
context.commit("update_logs",resp.data.records)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
}
|
||||
},
|
||||
// async monitoring_transaction(context, prm) {
|
||||
// context.commit("set_monitoring_status", 1);
|
||||
// try {
|
||||
// if (prm.lab_number) {
|
||||
// context.commit('set_last_search', { val: prm.lab_number, type: 'lab_number' });
|
||||
// } else if (prm.patient_name) {
|
||||
// context.commit('set_last_search', { val: prm.patient_name, type: 'patient_name' });
|
||||
// } else {
|
||||
// context.commit('set_last_search', { val: '', type: '' });
|
||||
// }
|
||||
|
||||
// let resp = await api.monitoring_transaction(prm);
|
||||
// if (resp.status !== "success") {
|
||||
// context.commit("set_monitoring_status", 3);
|
||||
// context.commit("set_monitoring_error_message", resp.message);
|
||||
// } else {
|
||||
// context.commit("set_monitoring_status", 2);
|
||||
// context.commit("set_monitoring_status", 2);
|
||||
// context.commit("set_monitoring_data", resp.data);
|
||||
// context.commit("set_monitoring_error_message", "");
|
||||
// const total_page = Math.ceil(resp.total / resp.limit);
|
||||
// context.commit("update_total_page", total_page);
|
||||
// context.commit("update_current_page", resp.page);
|
||||
|
||||
// }
|
||||
// } catch (e) {
|
||||
// context.commit("set_monitoring_status", 3);
|
||||
// context.commit("set_monitoring_error_message", e.message);
|
||||
// console.error(e);
|
||||
// }
|
||||
// },
|
||||
|
||||
// Di bagian actions -> monitoring_transaction, ubah commit ini:
|
||||
async monitoring_transaction(context, prm) {
|
||||
context.commit("set_monitoring_status", 1); // 1: LOADING
|
||||
try {
|
||||
// Simpan parameter pencarian terakhir untuk paginasi
|
||||
if (prm.lab_number) {
|
||||
context.commit('set_last_search', { val: prm.lab_number, type: 'lab_number' });
|
||||
} else if (prm.patient_name) {
|
||||
context.commit('set_last_search', { val: prm.patient_name, type: 'patient_name' });
|
||||
} else {
|
||||
context.commit('set_last_search', { val: '', type: '' });
|
||||
}
|
||||
|
||||
let resp = await api.monitoring_transaction(prm);
|
||||
if (resp.status !== "success") {
|
||||
context.commit("set_monitoring_status", 3); // 3: ERROR
|
||||
context.commit("set_monitoring_error_message", resp.message);
|
||||
} else {
|
||||
context.commit("set_monitoring_status", 2); // 2: SUCCESS
|
||||
|
||||
// FIX: Wrap response data dengan struktur yang sesuai
|
||||
const wrappedData = {
|
||||
data: resp.data, // Array dari API
|
||||
total: resp.total,
|
||||
page: resp.page,
|
||||
limit: resp.limit
|
||||
};
|
||||
|
||||
context.commit("set_monitoring_data", wrappedData);
|
||||
context.commit("set_monitoring_error_message", "");
|
||||
|
||||
const total_page = Math.ceil(resp.total / resp.limit);
|
||||
context.commit("update_total_page", total_page);
|
||||
context.commit("update_current_page", resp.page);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("set_monitoring_status", 3);
|
||||
context.commit("set_monitoring_error_message", e.message);
|
||||
console.error(e);
|
||||
}
|
||||
},
|
||||
|
||||
async check_exist_transaction(context, prm) {
|
||||
context.commit("set_monitoring_status", 1); // 1: LOADING
|
||||
try {
|
||||
// Simpan parameter pencarian terakhir untuk paginasi
|
||||
|
||||
let resp = await api.check_exist_transaction(prm);
|
||||
if (resp.status !== "success") {
|
||||
context.commit("set_monitoring_status", 3); // 3: ERROR
|
||||
context.commit("set_monitoring_error_message", resp.message);
|
||||
if(resp.status === 'error' && resp.message === 'Transaksi tidak ditemukan'){
|
||||
context.state.selected_patient.ais_status = 'N';
|
||||
}
|
||||
} else {
|
||||
context.commit("set_monitoring_status", 2); // 2: SUCCESS
|
||||
if(resp.status === 'success'){
|
||||
if(resp.data && resp.data.length > 0){
|
||||
context.state.selected_patient.ais_status = 'Y';
|
||||
} else {
|
||||
context.state.selected_patient.ais_status = 'N';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("set_monitoring_status", 3);
|
||||
context.commit("set_monitoring_error_message", e.message);
|
||||
console.error(e);
|
||||
}
|
||||
},
|
||||
|
||||
// Atau alternatif: ubah computed property di component
|
||||
// Di file Vue component, ganti computed patients menjadi:
|
||||
// Di computed patients
|
||||
patients() {
|
||||
console.log('monitoring_data:', this.$store.state.patient.monitoring_data);
|
||||
const monitoringData = this.$store.state.patient.monitoring_data || {};
|
||||
const result = Array.isArray(monitoringData.data) ? monitoringData.data : [];
|
||||
console.log('patients result:', result);
|
||||
return result;
|
||||
},
|
||||
|
||||
async get_corporates(context) {
|
||||
let resp = await api.get_corporate();
|
||||
if (resp.status === 'success') {
|
||||
let corporates = resp.data;
|
||||
corporates.unshift({ CorporateID: '0', CorporateName: 'Semua', CorporateCode: '' });
|
||||
context.commit('update_corporates', corporates);
|
||||
}
|
||||
},
|
||||
|
||||
async get_json_response({ commit, state }) {
|
||||
commit('set_transaction_log', null); // Reset log saat memulai
|
||||
commit('set_monitoring_status', 1); // Set status loading
|
||||
if (!state.selected_patient || !state.selected_patient.lab_number) {
|
||||
commit('set_monitoring_status', 2); // Selesai loading
|
||||
return;
|
||||
}
|
||||
|
||||
const params = {
|
||||
lab_number: state.selected_patient.lab_number
|
||||
};
|
||||
|
||||
const response = await api.get_json_response(params);
|
||||
|
||||
if (response.status === 'success' && response.data) {
|
||||
commit('set_transaction_log', response.data);
|
||||
} else {
|
||||
commit('set_transaction_log', null);
|
||||
console.error("Failed to get JSON response:", response.message);
|
||||
}
|
||||
commit('set_monitoring_status', 2); // Selesai loading
|
||||
},
|
||||
|
||||
async post_transaction_by_labnumber(context, prm) {
|
||||
context.commit("set_monitoring_status", 1);
|
||||
try {
|
||||
const response = await api.post_transaction_by_labnumber(prm);
|
||||
|
||||
if (response.status === 'success') {
|
||||
|
||||
const searchVal = context.state.search;
|
||||
let searchParams = {};
|
||||
|
||||
if (/[a-zA-Z]/.test(searchVal) && /\d/.test(searchVal)) {
|
||||
searchParams.lab_number = searchVal;
|
||||
} else {
|
||||
searchParams.patient_name = searchVal;
|
||||
}
|
||||
|
||||
await context.dispatch("monitoring_transaction", {
|
||||
start_date: context.state.start_date,
|
||||
end_date: context.state.end_date,
|
||||
...searchParams,
|
||||
corporate_id: context.state.selected_corporate.CorporateID,
|
||||
ais_status: context.state.selected_status.value,
|
||||
page: context.state.current_page
|
||||
});
|
||||
|
||||
const updatedItem = context.state.monitoring_data.data.find(item => item.lab_number === prm.labnumber);
|
||||
if (updatedItem) {
|
||||
context.commit("update_selected_patient", updatedItem);
|
||||
await context.dispatch("get_json_response");
|
||||
}
|
||||
|
||||
let selpat = context.state.selected_patient;
|
||||
console.log('selpat:', selpat);
|
||||
//alert(selpat.noreg);
|
||||
|
||||
await context.dispatch("get_medrec_by_noreg", {
|
||||
noreg: selpat.noreg
|
||||
});
|
||||
|
||||
context.commit("set_dialog_info_message", "Transaksi berhasil dikirim.");
|
||||
|
||||
} else {
|
||||
const errorMessage = response.message || "Gagal mengirim transaksi.";
|
||||
context.commit("set_dialog_info_message", errorMessage);
|
||||
}
|
||||
|
||||
context.commit("set_dialog_info", true);
|
||||
} catch (e) {
|
||||
context.commit("set_dialog_info_message", "Terjadi kesalahan: " + e.message);
|
||||
context.commit("set_dialog_info", true);
|
||||
} finally {
|
||||
context.commit("set_monitoring_status", 2);
|
||||
}
|
||||
},
|
||||
|
||||
async re_post_transaction_by_labnumber(context, prm) {
|
||||
context.commit("set_monitoring_status", 1);
|
||||
try {
|
||||
const response = await api.re_post_transaction_by_labnumber(prm);
|
||||
|
||||
if (response.status === 'success') {
|
||||
|
||||
const searchVal = context.state.search;
|
||||
let searchParams = {};
|
||||
|
||||
if (/[a-zA-Z]/.test(searchVal) && /\d/.test(searchVal)) {
|
||||
searchParams.lab_number = searchVal;
|
||||
} else {
|
||||
searchParams.patient_name = searchVal;
|
||||
}
|
||||
|
||||
await context.dispatch("monitoring_transaction", {
|
||||
start_date: context.state.start_date,
|
||||
end_date: context.state.end_date,
|
||||
...searchParams,
|
||||
corporate_id: context.state.selected_corporate.CorporateID,
|
||||
ais_status: context.state.selected_status.value,
|
||||
page: context.state.current_page
|
||||
});
|
||||
|
||||
const updatedItem = context.state.monitoring_data.data.find(item => item.lab_number === prm.labnumber);
|
||||
if (updatedItem) {
|
||||
context.commit("update_selected_patient", updatedItem);
|
||||
await context.dispatch("get_json_response");
|
||||
}
|
||||
|
||||
let selpat = context.state.selected_patient;
|
||||
await context.dispatch("get_medrec_by_noreg", {
|
||||
noreg: selpat.noreg
|
||||
});
|
||||
|
||||
context.commit("set_dialog_info_message", "Transaksi berhasil dikirim ulang.");
|
||||
|
||||
} else {
|
||||
const errorMessage = response.message || "Gagal mengirim ulang transaksi.";
|
||||
context.commit("set_dialog_info_message", errorMessage);
|
||||
}
|
||||
|
||||
context.commit("set_dialog_info", true);
|
||||
|
||||
} catch (e) {
|
||||
context.commit("set_dialog_info_message", "Terjadi kesalahan: " + e.message);
|
||||
context.commit("set_dialog_info", true);
|
||||
} finally {
|
||||
context.commit("set_monitoring_status", 2);
|
||||
}
|
||||
},
|
||||
async get_medrec_by_noreg(context, prm) {
|
||||
context.commit("set_monitoring_status", 1);
|
||||
try {
|
||||
const response = await api.get_medrec_by_noreg(prm);
|
||||
|
||||
if (response.status === 'success') {
|
||||
|
||||
let patient = response.data;
|
||||
let selpat = context.state.selected_patient;
|
||||
if(patient && patient.length > 0) {
|
||||
console.log('patient:', patient);
|
||||
await context.dispatch("re_post_medrec_by_noreg", {
|
||||
noreg: selpat.noreg
|
||||
});
|
||||
} else {
|
||||
console.log('patient not found');
|
||||
await context.dispatch("post_medrec_by_noreg", {
|
||||
noreg: selpat.noreg
|
||||
});
|
||||
}
|
||||
|
||||
} else {
|
||||
const errorMessage = response.message || "Gagal mengirim ulang transaksi.";
|
||||
context.commit("set_dialog_info_message", errorMessage);
|
||||
context.commit("set_dialog_info", true);
|
||||
}
|
||||
|
||||
|
||||
} catch (e) {
|
||||
context.commit("set_dialog_info_message", "Terjadi kesalahan: " + e.message);
|
||||
context.commit("set_dialog_info", true);
|
||||
} finally {
|
||||
context.commit("set_monitoring_status", 2);
|
||||
}
|
||||
},
|
||||
|
||||
async post_medrec_by_noreg(context, prm) {
|
||||
context.commit("set_monitoring_status", 1);
|
||||
try {
|
||||
const response = await api.post_medrec_by_noreg(prm);
|
||||
|
||||
if (response.status === 'success') {
|
||||
return response.data;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (e) {
|
||||
return null;
|
||||
} finally {
|
||||
context.commit("set_monitoring_status", 2);
|
||||
}
|
||||
},
|
||||
async re_post_medrec_by_noreg(context, prm) {
|
||||
context.commit("set_monitoring_status", 1);
|
||||
try {
|
||||
const response = await api.re_post_medrec_by_noreg(prm);
|
||||
|
||||
if (response.status === 'success') {
|
||||
return response.data;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (e) {
|
||||
return null;
|
||||
} finally {
|
||||
context.commit("set_monitoring_status", 2);
|
||||
}
|
||||
},
|
||||
async delete_transaction_by_labnumber(context, prm) {
|
||||
context.commit("set_monitoring_status", 1);
|
||||
try {
|
||||
const response = await api.delete_transaction_by_labnumber(prm);
|
||||
|
||||
if(response.status !== 'OK'){
|
||||
context.commit("set_dialog_info_message", response.message.message?response.message.message:"Gagal menghapus transaksi.");
|
||||
context.commit("set_dialog_info", true);
|
||||
return;
|
||||
}
|
||||
if(response.data.status === 'success'){
|
||||
context.commit("set_dialog_info_message", "Transaksi berhasil dihapus.");
|
||||
context.commit("set_dialog_info", true);
|
||||
await context.dispatch("monitoring_transaction", {
|
||||
start_date: context.state.start_date,
|
||||
end_date: context.state.end_date,
|
||||
lab_number: prm.labnumber,
|
||||
corporate_id: context.state.selected_corporate.CorporateID,
|
||||
ais_status: context.state.selected_status.value,
|
||||
page: 1
|
||||
});
|
||||
} else {
|
||||
context.commit("set_dialog_info_message", response.data.message?response.data.message:"Gagal menghapus transaksi.");
|
||||
context.commit("set_dialog_info", true);
|
||||
}
|
||||
} catch (e) {
|
||||
return null;
|
||||
} finally {
|
||||
context.commit("set_monitoring_status", 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
200
test/vuex/ais-monitoring-transaction-v4/modules/payment.js
Normal file
200
test/vuex/ais-monitoring-transaction-v4/modules/payment.js
Normal file
@@ -0,0 +1,200 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/payment.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
lookup_status:0,
|
||||
lookup_error_message:'',
|
||||
types: [],
|
||||
total_payment:0,
|
||||
reload_after_save: false,
|
||||
dialog_pay_success:false,
|
||||
paynumber :'',
|
||||
notes :[],
|
||||
dialog_delete:false,
|
||||
msg_delete:'',
|
||||
note_delete:'',
|
||||
nota_delete:{},
|
||||
open_print_note:false,
|
||||
idx:0,
|
||||
last_payments:{},
|
||||
payment_total: 0,
|
||||
banks:[],
|
||||
disable_btn_pay:'Y',
|
||||
fajri_hide_btn_pay:'Y'
|
||||
},
|
||||
mutations: {
|
||||
update_disable_btn_pay(state,val) {
|
||||
console.log('module')
|
||||
console.log(val)
|
||||
state.disable_btn_pay = val
|
||||
},
|
||||
update_banks(state,val) {
|
||||
state.banks = val
|
||||
},
|
||||
update_lookup_error_message(state,val) {
|
||||
state.lookup_error_message = val
|
||||
},
|
||||
update_lookup_status(state,status) {
|
||||
state.lookup_status = status
|
||||
},
|
||||
update_types(state,data) {
|
||||
state.types = data.records
|
||||
state.total_type = data.total
|
||||
},
|
||||
update_selected_status(state,val) {
|
||||
state.selected_status=val
|
||||
},
|
||||
update_total_payment(state,val) {
|
||||
state.total_payment=val
|
||||
},
|
||||
update_reload_after_save(state,val) {
|
||||
state.reload_after_save=val
|
||||
},
|
||||
update_dialog_pay_success(state,val) {
|
||||
state.dialog_pay_success=val
|
||||
},
|
||||
update_paynumber(state,val) {
|
||||
state.paynumber=val
|
||||
},
|
||||
update_notes(state,val) {
|
||||
state.notes=val
|
||||
},
|
||||
update_dialog_delete(state,val) {
|
||||
state.dialog_delete=val
|
||||
},
|
||||
update_note_delete(state,val) {
|
||||
state.note_delete=val
|
||||
},
|
||||
update_msg_delete(state,val) {
|
||||
state.msg_delete=val
|
||||
},
|
||||
update_nota_delete(state,val) {
|
||||
state.nota_delete=val
|
||||
},
|
||||
update_open_print_note(state,val) {
|
||||
state.open_print_note=val
|
||||
},
|
||||
update_idx(state,val) {
|
||||
state.idx=val
|
||||
},
|
||||
update_last_payments(state,val) {
|
||||
state.last_payments=val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async lookup_type(context) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
let resp= await api.lookup_type(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_types",data)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async lookup_banks(context) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
let resp= await api.lookup_banks(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_banks",data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async searchcard(context,prm) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
let resp= await api.searchcard(one_token(),prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_cards",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
}
|
||||
},
|
||||
async pay(context,prm) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.pay(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records.types,
|
||||
total: resp.data.total
|
||||
}
|
||||
let xnumber = resp.data.records.data.numberx
|
||||
let id = resp.data.records.data.idx
|
||||
context.commit("update_types",data)
|
||||
context.commit("update_last_payments",prm.payments)
|
||||
context.commit("update_idx",id)
|
||||
context.commit("update_total_payment",0)
|
||||
context.commit("update_paynumber","Pembayaran nomor <span style='color:red'>"+xnumber+"</span> telah berhasil")
|
||||
context.commit("update_dialog_pay_success",true)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async delete_note(context,prm) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.delete_note(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let xmsg = "Nota nomor <span style='color:red'>"+prm.nota.note_number+"</span> telah dihapus"
|
||||
context.commit("update_msg_delete",xmsg)
|
||||
context.commit("update_note_delete",'')
|
||||
context.commit("update_nota_delete",{})
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
358
test/vuex/ais-monitoring-transaction-v4/modules/paymentnew.js
Normal file
358
test/vuex/ais-monitoring-transaction-v4/modules/paymentnew.js
Normal file
@@ -0,0 +1,358 @@
|
||||
import * as api from "../api/payment.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
lookup_status:0,
|
||||
lookup_error_message:'',
|
||||
types: [],
|
||||
total_payment:0,
|
||||
total_last_payment:0,
|
||||
reload_after_save: false,
|
||||
dialog_pay_success:false,
|
||||
paynumber :'',
|
||||
notes :[],
|
||||
dialog_delete:false,
|
||||
msg_delete:'',
|
||||
note_delete:'',
|
||||
nota_delete:{},
|
||||
open_print_note:false,
|
||||
idx:0,
|
||||
last_payments:[],
|
||||
payment_total: 0,
|
||||
banks:[],
|
||||
disable_btn_pay:'Y',
|
||||
accounts:[],
|
||||
save_process:false,
|
||||
open_dialog_info:false,
|
||||
msg_info:'',
|
||||
languages:[],
|
||||
selected_language:{},
|
||||
data_station_location:[],
|
||||
setting_controll:false,
|
||||
urlprintnote:false
|
||||
},
|
||||
mutations: {
|
||||
update_urlprintnote (state, value) {
|
||||
state.urlprintnote = value
|
||||
},
|
||||
update_setting_controll (state, value) {
|
||||
state.setting_controll = value
|
||||
},
|
||||
update_data_station_location (state, value) {
|
||||
state.data_station_location = value
|
||||
},
|
||||
update_languages(state,val){
|
||||
state.languages = val
|
||||
},
|
||||
update_selected_language(state,val){
|
||||
state.selected_language = val
|
||||
},
|
||||
update_open_dialog_info(state,val){
|
||||
state.open_dialog_info = val
|
||||
},
|
||||
update_msg_info(state,val){
|
||||
state.msg_info = val
|
||||
},
|
||||
update_save_process(state,val){
|
||||
state.save_process = val
|
||||
},
|
||||
update_total_last_payment(state,val){
|
||||
state.total_last_payment
|
||||
},
|
||||
update_accounts(state,val) {
|
||||
state.accounts = val
|
||||
},
|
||||
update_disable_btn_pay(state,val) {
|
||||
state.disable_btn_pay = val
|
||||
},
|
||||
update_banks(state,val) {
|
||||
state.banks = val
|
||||
},
|
||||
update_lookup_error_message(state,val) {
|
||||
state.lookup_error_message = val
|
||||
},
|
||||
update_lookup_status(state,status) {
|
||||
state.lookup_status = status
|
||||
},
|
||||
update_types(state,data) {
|
||||
state.types = data.records
|
||||
state.total_type = data.total
|
||||
},
|
||||
update_selected_status(state,val) {
|
||||
state.selected_status=val
|
||||
},
|
||||
update_total_payment(state,val) {
|
||||
state.total_payment=val
|
||||
},
|
||||
update_reload_after_save(state,val) {
|
||||
state.reload_after_save=val
|
||||
},
|
||||
update_dialog_pay_success(state,val) {
|
||||
state.dialog_pay_success=val
|
||||
},
|
||||
update_paynumber(state,val) {
|
||||
state.paynumber=val
|
||||
},
|
||||
update_notes(state,val) {
|
||||
state.notes=val
|
||||
},
|
||||
update_dialog_delete(state,val) {
|
||||
state.dialog_delete=val
|
||||
},
|
||||
update_note_delete(state,val) {
|
||||
state.note_delete=val
|
||||
},
|
||||
update_msg_delete(state,val) {
|
||||
state.msg_delete=val
|
||||
},
|
||||
update_nota_delete(state,val) {
|
||||
state.nota_delete=val
|
||||
},
|
||||
update_open_print_note(state,val) {
|
||||
state.open_print_note=val
|
||||
},
|
||||
update_idx(state,val) {
|
||||
state.idx=val
|
||||
},
|
||||
update_last_payments(state,val) {
|
||||
state.last_payments=val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async save_control(context,prm) {
|
||||
// context.commit("update_search_status",1)
|
||||
try {
|
||||
|
||||
prm.token = one_token()
|
||||
let resp= await api.save_control(prm)
|
||||
console.log(resp)
|
||||
if (resp.status != "OK") {
|
||||
// context.commit("update_search_status",3)
|
||||
// context.commit("update_search_error_message",resp.message)
|
||||
alert(resp.message)
|
||||
} else {
|
||||
// context.commit("update_search_status",2)
|
||||
// context.commit("update_search_error_message","")
|
||||
context.commit("update_setting_controll",false)
|
||||
//context.dispatch('print_control', {order_id:context.rootState.patient.selected_patient.T_OrderHeaderID,time_start:context.rootState.order.show_time})
|
||||
|
||||
let idx = context.rootState.patient.selected_patient.T_OrderHeaderID
|
||||
let user = one_user()
|
||||
var tmx = Number(new Date());
|
||||
let urlprintnote = "/birt/run?__report=report/one/lab/rpt_fo_001.rptdesign&__format=pdf&username="+user.M_StaffName+"&PID="+idx+"?t="+tmx
|
||||
context.commit("update_urlprintnote",urlprintnote)
|
||||
context.commit("update_open_print_note",true)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
// context.commit("update_search_status",3)
|
||||
console.log('gagal')
|
||||
alert(e.message)
|
||||
}
|
||||
},
|
||||
async getLocations(context) {
|
||||
// context.commit("update_search_status",1)
|
||||
try {
|
||||
var prm = {}
|
||||
prm.order_id = context.rootState.patient.selected_patient.T_OrderHeaderID
|
||||
prm.token = one_token()
|
||||
let resp= await api.getLocations(prm)
|
||||
console.log(resp)
|
||||
if (resp.status != "OK") {
|
||||
// context.commit("update_search_status",3)
|
||||
// context.commit("update_search_error_message",resp.message)
|
||||
alert(resp.message)
|
||||
} else {
|
||||
// context.commit("update_search_status",2)
|
||||
// context.commit("update_search_error_message","")
|
||||
|
||||
let sl = resp.data.datas
|
||||
context.commit("update_data_station_location", sl)
|
||||
context.commit("update_setting_controll",true)
|
||||
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
// context.commit("update_search_status",3)
|
||||
console.log('gagal')
|
||||
alert(e.message)
|
||||
}
|
||||
},
|
||||
async getlanguages(context) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
let resp= await api.getlanguages(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
/*let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}*/
|
||||
context.commit("update_languages",resp.data)
|
||||
context.commit("update_selected_language",{})
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async lookup_type(context,prm) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
let resp= await api.lookup_type(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_types",data)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async lookup_banks(context) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
let resp= await api.lookup_banks(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_banks",data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async lookup_accounts(context) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
let resp= await api.lookup_accounts(one_token())
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_accounts",data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async searchcard(context,prm) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
let resp= await api.searchcard(one_token(),prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_cards",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
}
|
||||
},
|
||||
async pay(context,prm) {
|
||||
context.commit("update_lookup_status",1)
|
||||
|
||||
console.log(prm)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.pay(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records.types,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_save_process",false)
|
||||
var xpayments = resp.data.records.payments
|
||||
console.log(xpayments)
|
||||
context.commit("update_last_payments",xpayments)
|
||||
//console.log(prm.payments)
|
||||
let xnumber = resp.data.records.data.numberx
|
||||
let id = resp.data.records.data.idx
|
||||
var xobj = context.state.types
|
||||
//console.log(xobj)
|
||||
xobj.forEach(function(obj){
|
||||
obj.chex = false
|
||||
obj.leftvalue = 0
|
||||
obj.rightvalue = 0
|
||||
obj.selected_card = {id:0,name:''}
|
||||
obj.selected_edc = {id:0,name:''}
|
||||
obj.selected_account = {id:0,name:''}
|
||||
})
|
||||
var xray = {records:xobj,total:xobj.length}
|
||||
context.commit("update_types",xray)
|
||||
context.commit("update_disable_btn_pay",'Y')
|
||||
console.log(context.state.types)
|
||||
|
||||
context.commit("update_idx",id)
|
||||
context.commit("update_total_payment",0)
|
||||
context.commit("update_paynumber","Pembayaran nomor <span style='color:red'>"+xnumber+"</span> telah berhasil")
|
||||
context.commit("update_dialog_pay_success",true)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async delete_note(context,prm) {
|
||||
context.commit("update_lookup_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.delete_note(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_status",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let xmsg = "Nota nomor <span style='color:red'>"+prm.nota.note_number+"</span> telah dihapus"
|
||||
context.commit("update_msg_delete",xmsg)
|
||||
context.commit("update_note_delete",'')
|
||||
context.commit("update_nota_delete",{})
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_status",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
446
test/vuex/ais-monitoring-transaction-v4/modules/test.js
Normal file
446
test/vuex/ais-monitoring-transaction-v4/modules/test.js
Normal file
@@ -0,0 +1,446 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/test.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
act:'',
|
||||
lookup_test:0,
|
||||
lookup_error_message:'',
|
||||
get_data_status:0,
|
||||
test_dialog:false,
|
||||
test_message:'',
|
||||
status_done:'N',
|
||||
save_status:0,
|
||||
save_message:false,
|
||||
save_status_verification:0,
|
||||
save_error_message:'',
|
||||
autocomplete_status:0,
|
||||
test_registration:[],
|
||||
test_verification:[],
|
||||
test_all:[],
|
||||
tests:[],
|
||||
selected_test:{},
|
||||
test:{},
|
||||
promises:[],
|
||||
promise:{},
|
||||
cito:false,
|
||||
promise_dialog:false,
|
||||
msg_promise_dialog:'',
|
||||
selected_detail_verification:{},
|
||||
show_promise_left:false,
|
||||
showw_promise_right:false,
|
||||
promise_left:'',
|
||||
show_cito_dropdown:'N',
|
||||
selected_cito:{},
|
||||
citos:[],
|
||||
orderid:0,
|
||||
mouid:0,
|
||||
},
|
||||
mutations: {
|
||||
update_orderid(state, val) {
|
||||
state.orderid = val
|
||||
},
|
||||
update_mouid(state, val) {
|
||||
state.mouid = val
|
||||
},
|
||||
update_citos(state, val) {
|
||||
state.citos = val
|
||||
},
|
||||
update_selected_cito(state, val) {
|
||||
state.selected_cito = val
|
||||
},
|
||||
update_show_cito_dropdown(state, val) {
|
||||
state.show_cito_dropdown = val
|
||||
},
|
||||
update_selected_test(state, val) {
|
||||
state.selected_test = val
|
||||
},
|
||||
update_act(state, val) {
|
||||
state.act = val
|
||||
},
|
||||
update_lookup_test(state, val) {
|
||||
state.lookup_test = val
|
||||
},
|
||||
update_get_data_status(state, val) {
|
||||
state.get_data_status = val
|
||||
},
|
||||
update_lookup_error_message(state, val) {
|
||||
state.lookup_error_message = val
|
||||
},
|
||||
update_test_dialog(state, val) {
|
||||
state.test_dialog = val
|
||||
},
|
||||
update_test_message(state, val) {
|
||||
state.test_message = val
|
||||
},
|
||||
update_status_done(state, val) {
|
||||
state.status_done = val
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_status_verification(state, val) {
|
||||
state.save_status_verification = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_save_message(state, val) {
|
||||
state.save_message = val
|
||||
},
|
||||
update_autocomplete_status(state,val){
|
||||
state.autocomplete_status = val
|
||||
},
|
||||
update_test_registration(state,val){
|
||||
state.test_registration = val
|
||||
},
|
||||
update_test_verification(state,val){
|
||||
state.test_verification = val
|
||||
},
|
||||
update_test_all(state,val){
|
||||
state.test_all = val
|
||||
},
|
||||
update_tests(state,val){
|
||||
state.tests = val
|
||||
},
|
||||
update_test(state,val){
|
||||
state.test = val
|
||||
},
|
||||
update_promises(state,val){
|
||||
state.promises = val
|
||||
},
|
||||
update_promise(state,val){
|
||||
state.promise = val
|
||||
},
|
||||
update_cito(state,val){
|
||||
state.cito = val
|
||||
},
|
||||
update_promise_dialog(state,val){
|
||||
state.promise_dialog = val
|
||||
},
|
||||
update_msg_promise_dialog(state,val){
|
||||
state.msg_promise_dialog = val
|
||||
},
|
||||
update_selected_detail_verification(state,val){
|
||||
state.selected_detail_verification = val
|
||||
},
|
||||
update_show_promise_left(state,val){
|
||||
state.show_promise_left = val
|
||||
},
|
||||
update_show_promise_right(state,val){
|
||||
state.show_promise_right = val
|
||||
},
|
||||
update_promise_left(state,val){
|
||||
state.promise_left = val
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
async lookup(context,prm) {
|
||||
context.commit("update_lookup_test",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.lookup(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_test",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_test",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
let rtn = data.records
|
||||
|
||||
context.commit("update_test_registration",rtn.testregistration)
|
||||
context.commit("update_test_verification",rtn.testverification)
|
||||
if(rtn.testverification.length > 0){
|
||||
context.commit("update_promise_left",resp.data.promise)
|
||||
context.commit("update_show_promise_left",true)
|
||||
}
|
||||
context.commit("update_test_all",rtn.testall)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_test",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async lookup_promises(context,prm) {
|
||||
context.commit("update_lookup_test",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.lookup_promises(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_lookup_test",3)
|
||||
context.commit("update_lookup_error_message",resp.message)
|
||||
} else {
|
||||
context.commit("update_lookup_test",2)
|
||||
context.commit("update_lookup_error_message","")
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
let rtn = data.records
|
||||
|
||||
context.commit("update_promises",rtn)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_lookup_test",3)
|
||||
context.commit("update_lookup_error_message",e.message )
|
||||
}
|
||||
},
|
||||
async savetestadditionalverification(context,prm) {
|
||||
context.commit("update_save_status_verification",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.savetestadditionalverification(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status_verification", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_save_status_verification", 2)
|
||||
context.commit("update_save_error_message", "")
|
||||
|
||||
context.commit("update_test_registration",resp.data.records)
|
||||
context.commit("update_test_verification",[])
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status_verification", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async searchtest(context,prm) {
|
||||
context.commit("update_autocomplete_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.searchtest(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
} else {
|
||||
context.commit("update_autocomplete_status",2)
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_tests",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
}
|
||||
},
|
||||
async checkstatus(context,prm) {
|
||||
context.commit("update_autocomplete_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.checkstatus(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
} else {
|
||||
context.commit("update_autocomplete_status",2)
|
||||
let data = {
|
||||
status : resp.data.status,
|
||||
total: resp.data.total
|
||||
}
|
||||
var oldArr = context.state.test_all
|
||||
delete prm.token
|
||||
var idx = _.findIndex(oldArr, prm)
|
||||
if(data.status == 'OK'){
|
||||
|
||||
oldArr[idx].active = 'Y'
|
||||
oldArr[idx].status = false
|
||||
context.commit("update_test_all",oldArr)
|
||||
}
|
||||
else{
|
||||
oldArr[idx].status = true
|
||||
//oldArr[idx]["status === 'Y'"] = true
|
||||
context.commit("update_test_all",oldArr)
|
||||
console.log(oldArr)
|
||||
var msg = "Bang ... beli satenya 10 tusuk, pake lontong ya, kalo statusnya sdh divalidasi tidak bisa dihapus ya"
|
||||
context.commit('patient/update_errormsg',msg,{root:true})
|
||||
context.commit('patient/update_dialogerrormsg',msg,{root:true})
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
}
|
||||
},
|
||||
async savetestadditional(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.savetestadditional(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
console.log("dasdsa")
|
||||
context.commit("update_promise_dialog",false)
|
||||
context.commit("update_test_dialog",false)
|
||||
context.commit("update_test_all",resp.data.records.testall)
|
||||
context.commit("update_save_message", true)
|
||||
context.commit("update_show_cito_dropdown","N")
|
||||
context.commit("update_selected_cito",{})
|
||||
//setTimeout(() => context.commit("update_save_message", false), 3000)
|
||||
var snackbar = {value:true,text:"Data berhasil disimpan",timeout:4000}
|
||||
context.commit("patient/update_snackbar", snackbar,{root:true})
|
||||
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async getnewprice(context,prm) {
|
||||
context.commit("update_save_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.getnewprice(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status",3)
|
||||
} else {
|
||||
context.commit("update_save_status",2)
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
console.log(data.records.length)
|
||||
if(data.records.length === 0){
|
||||
var oldArr = context.state.test_all
|
||||
var idx = _.findIndex(oldArr, {pxid:prm.pxid})
|
||||
oldArr[idx].status = true
|
||||
oldArr[idx].active = 'Y'
|
||||
oldArr[idx].cito = false
|
||||
console.log(oldArr)
|
||||
context.commit("update_test_all",oldArr)
|
||||
|
||||
var msg = "Kala hujan di waktu pagi, cobalah sejenak untuk menepi, Jika harga belum diisi, tak ada yang bisa ditampilkan di sini"
|
||||
context.commit('patient/update_errormsg',msg,{root:true})
|
||||
context.commit('patient/update_dialogerrormsg',msg,{root:true})
|
||||
}else{
|
||||
var newprice = data.records[0]
|
||||
var oldArr = context.state.test_all
|
||||
var idx = _.findIndex(oldArr, {pxid:prm.pxid})
|
||||
delete prm.token
|
||||
delete prm.orderid
|
||||
|
||||
//var distot = ((parseFloat(newprice.T_PriceDisc)/100) * parseInt(newprice.T_PriceAmount)) + parseInt(newprice.T_PriceDiscRp)
|
||||
//var total = parseInt(newprice.T_PriceAmount) - distot
|
||||
//console.log(distot)
|
||||
prm.discountpersen = newprice.discountpersen
|
||||
prm.discountrp = newprice.discountrp
|
||||
prm.bruto = newprice.bruto
|
||||
prm.discount = newprice.discount
|
||||
prm.total = newprice.total
|
||||
prm.cito = newprice.cito
|
||||
prm.status = newprice.cito_before
|
||||
prm.active = 'Y'
|
||||
//console.log(prm)
|
||||
oldArr[idx] = prm
|
||||
|
||||
context.commit("update_test_all",oldArr)
|
||||
}
|
||||
//console.log(prm)
|
||||
context.commit("update_show_cito_dropdown","N")
|
||||
var rows = context.state.citos
|
||||
var row = _.filter(rows, function(o) { return o.xdefault === 'Y' })
|
||||
context.commit("update_selected_cito",row[0])
|
||||
console.log(prm.cito_before)
|
||||
console.log(prm.cito)
|
||||
if(prm.cito & prm.cito_before === 'N'){
|
||||
context.commit("update_show_cito_dropdown","Y")
|
||||
}
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_save_status",3)
|
||||
}
|
||||
},
|
||||
async getchildrenprofil(context,prm) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.getchildrenprofil(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_get_data_status",3)
|
||||
} else {
|
||||
context.commit("update_get_data_status",2)
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
var rows = data.records
|
||||
var xtestall = prm.all
|
||||
rows.forEach(function(entry) {
|
||||
xtestall.push(entry)
|
||||
})
|
||||
|
||||
context.commit("update_test_all",xtestall)
|
||||
context.commit("update_test",{})
|
||||
context.commit("update_tests",[])
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
},
|
||||
async getcitos(context,prm) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.getcitos(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_get_data_status",3)
|
||||
} else {
|
||||
context.commit("update_get_data_status",2)
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
var rows = data.records
|
||||
context.commit("update_citos",rows)
|
||||
var row = _.filter(rows, function(o) { return o.xdefault === 'Y' })
|
||||
context.commit("update_selected_cito",row)
|
||||
|
||||
context.commit("update_selected_cito","N")
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
},
|
||||
async checkpromisetests(context,prm) {
|
||||
context.commit("update_get_data_status",1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.checkpromisetests(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_get_data_status",3)
|
||||
} else {
|
||||
context.commit("update_get_data_status",2)
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
var msg = "<p>Janji hasil sebelum tambahan adalah <div class='pa-2 white--text info'>"+data.records.before+"</div></p>"+
|
||||
"<p>Janji hasil setelah tambahan adalah <div class='pa-2 white--text red'>"+data.records.after+"</div></p>"+
|
||||
"<h4 class='pt-2 text-uppercase font-weight-black'>YAKIN AKAN UPDATE ?</h4>"
|
||||
context.commit("update_msg_promise_dialog",msg)
|
||||
context.commit("update_promise_dialog", true)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_get_data_status",3)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
99
test/vuex/ais-monitoring-transaction-v4/oneFooter.vue
Normal file
99
test/vuex/ais-monitoring-transaction-v4/oneFooter.vue
Normal file
@@ -0,0 +1,99 @@
|
||||
<template>
|
||||
<v-footer color="blue lighten-2" app>
|
||||
<one-clock></one-clock>
|
||||
<v-spacer></v-spacer>
|
||||
<span class="one-footer white--text">
|
||||
<code class="mb-0">Auto logged out in <span>{{ secondsUntilExpire }}</span> seconds</code>
|
||||
</span>
|
||||
</v-footer>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
span.one-footer {
|
||||
margin-right:30px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data() {
|
||||
return {
|
||||
IDLE_TIMEOUT: 5 * 60, // Waktu idle dalam detik
|
||||
autologoutCounter: 0, // Counter idle dalam localStorage
|
||||
_idleSecondsTimer: null,
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
secondsUntilExpire() {
|
||||
return this.IDLE_TIMEOUT - this.autologoutCounter;
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
// Mengambil waktu logout yang disesuaikan jika tersedia
|
||||
if (localStorage.getItem("user")) {
|
||||
var retrievedObject = localStorage.getItem("user");
|
||||
var dtuser = JSON.parse(retrievedObject);
|
||||
if (dtuser.time_autologout && parseInt(dtuser.time_autologout) > 0) {
|
||||
this.IDLE_TIMEOUT = parseInt(dtuser.time_autologout) * 60;
|
||||
}
|
||||
}
|
||||
|
||||
// Inisialisasi autologout di localStorage jika belum ada
|
||||
if (localStorage.getItem("autologout") === null) {
|
||||
localStorage.setItem("autologout", 0);
|
||||
}
|
||||
localStorage.removeItem("logoutTriggered");
|
||||
|
||||
// Event listeners untuk reset idle timer saat ada aktivitas pengguna
|
||||
document.onclick = this.resetIdleTimer;
|
||||
document.onmousemove = this.resetIdleTimer;
|
||||
document.onkeypress = this.resetIdleTimer;
|
||||
|
||||
// Mulai interval untuk memeriksa idle time dan update counter
|
||||
this._idleSecondsTimer = setInterval(this.checkIdleTime, 1000);
|
||||
|
||||
// Event listener untuk perubahan `localStorage` guna sinkronkan logout antar tab
|
||||
window.addEventListener("storage", this.handleStorageChange);
|
||||
},
|
||||
|
||||
methods: {
|
||||
resetIdleTimer() {
|
||||
localStorage.setItem("autologout", 0);
|
||||
this.autologoutCounter = 0; // Reset counter di data reaktif
|
||||
},
|
||||
|
||||
checkIdleTime() {
|
||||
let xcounter = parseInt(localStorage.getItem("autologout"));
|
||||
xcounter++;
|
||||
localStorage.setItem("autologout", xcounter);
|
||||
this.autologoutCounter = xcounter; // Update counter di data reaktif
|
||||
|
||||
// Jika waktu idle telah habis, logout semua tab
|
||||
if (xcounter >= this.IDLE_TIMEOUT) {
|
||||
clearInterval(this._idleSecondsTimer);
|
||||
localStorage.setItem("logoutTriggered", true); // Set trigger logout
|
||||
localStorage.removeItem("autologout"); // Hapus autologout
|
||||
window.one_logout('/one-ui/test/vuex/one-login') // Arahkan ke login
|
||||
}
|
||||
},
|
||||
|
||||
handleStorageChange(event) {
|
||||
if (event.key === "logoutTriggered" && event.newValue === "true") {
|
||||
// Redirect semua tab ke halaman login jika logoutTriggered berubah
|
||||
window.one_logout('/one-ui/test/vuex/one-login')
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
beforeDestroy() {
|
||||
clearInterval(this._idleSecondsTimer);
|
||||
window.removeEventListener("storage", this.handleStorageChange);
|
||||
},
|
||||
|
||||
components: {
|
||||
'one-clock': httpVueLoader('./oneTanggal.vue')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
182
test/vuex/ais-monitoring-transaction-v4/oneNavbarComponent.vue
Normal file
182
test/vuex/ais-monitoring-transaction-v4/oneNavbarComponent.vue
Normal file
@@ -0,0 +1,182 @@
|
||||
<template>
|
||||
<div>
|
||||
<one-menu-drawer :drawer="drawer" > </one-menu-drawer>
|
||||
<one-menu-notification :drawer="drawer_notification" > </one-menu-notification>
|
||||
<v-toolbar color="blue lighten-2" dark fixed app>
|
||||
<v-toolbar-side-icon class="hidden-sm-and-down" @click.stop="togleDrawer()"></v-toolbar-side-icon>
|
||||
<v-layout row >
|
||||
<v-flex class="pt-2" xs8>
|
||||
<p class="mb-0"><a href="#" style="padding-bottom:0px;margin-bottom:0px;text-decoration:none;color:#fff;font-size:18px; font-weight:bold;">BISONE</a> </p>
|
||||
<p class="mb-0"><span style="text-decoration:none;color:#fff;font-size:12px;" class="ml-0 mt-0 bread-crumb">{{bread_crumb}}</span></p>
|
||||
|
||||
</v-flex>
|
||||
<v-flex xs4 class="mt-2 text-xs-right align-right">
|
||||
|
||||
|
||||
|
||||
|
||||
<a href="#" class="mt-3" style="min-height:10px;text-decoration:none;color:#fff;font-size:22px; margin-right:15px">{{ xusername }}</a>
|
||||
<v-badge color="red">
|
||||
|
||||
<v-btn class="pt-0 pb-2" icon @click.stop="drawer_notification = !drawer_notification" flat>
|
||||
<v-icon
|
||||
medium
|
||||
>
|
||||
notifications
|
||||
</v-icon>
|
||||
</v-btn>
|
||||
</v-badge>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- <v-btn class="ml-4" icon>
|
||||
<v-icon>apps</v-icon>
|
||||
</v-btn> -->
|
||||
|
||||
<!-- PROFILE MENU -->
|
||||
<v-menu
|
||||
:close-on-content-click="true"
|
||||
:nudge-width="200"
|
||||
offset-overflow
|
||||
left
|
||||
bottom
|
||||
>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-btn
|
||||
class="" icon
|
||||
v-on="on"
|
||||
>
|
||||
<v-icon>apps</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<v-card>
|
||||
<v-list>
|
||||
<v-list-tile avatar>
|
||||
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title>{{ xusername }}</v-list-tile-title>
|
||||
<v-list-tile-sub-title>{{xstaffname}}</v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
|
||||
</v-list-tile>
|
||||
</v-list>
|
||||
|
||||
<v-divider></v-divider>
|
||||
|
||||
<v-list>
|
||||
<v-list-tile @click="change_password" >
|
||||
<v-list-tile-action>
|
||||
<v-icon>security</v-icon>
|
||||
</v-list-tile-action>
|
||||
<v-list-tile-title>Change Password</v-list-tile-title>
|
||||
</v-list-tile>
|
||||
|
||||
</v-list>
|
||||
<v-list>
|
||||
<v-list-tile @click="logout" >
|
||||
<v-list-tile-action>
|
||||
<v-icon>no_meeting_room</v-icon>
|
||||
</v-list-tile-action>
|
||||
<v-list-tile-title>Log Out</v-list-tile-title>
|
||||
</v-list-tile>
|
||||
|
||||
</v-list>
|
||||
|
||||
|
||||
</v-card>
|
||||
</v-menu>
|
||||
<!-- End of PROFILE MENU -->
|
||||
|
||||
<one-cp></one-cp>
|
||||
</v-toolbar>
|
||||
</div>
|
||||
|
||||
</template>
|
||||
<style scoped>
|
||||
.bread-crumb {
|
||||
margin-left:20px;
|
||||
font-weight:normal!important;
|
||||
}
|
||||
.v-badge__badge{
|
||||
top:0px;
|
||||
right:0px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {
|
||||
'one-menu-drawer' : httpVueLoader('./oneMenuDrawer.vue'),
|
||||
'one-cp' : httpVueLoader('./oneChangePassword.vue'),
|
||||
'one-menu-notification' : httpVueLoader('./oneNotificationDrawer.vue')
|
||||
},
|
||||
|
||||
data: function() {
|
||||
return {
|
||||
drawer: false,
|
||||
drawer_notification: false
|
||||
}
|
||||
},
|
||||
watch : {
|
||||
is_page_allowed : function(new_ipa, old_ipa) {
|
||||
if(! new_ipa ) {
|
||||
var dashboard = this.$store.state.system.dashboard
|
||||
if (dashboard == "") {
|
||||
//this.logout()
|
||||
console.log('go-to','logout')
|
||||
} else {
|
||||
//window.location.href = '/' + dashboard
|
||||
console.log('go-to dashboard',dashboard)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
is_page_allowed() {
|
||||
return this.$store.state.system.is_page_allowed
|
||||
},
|
||||
bread_crumb() {
|
||||
return this.$store.state.system.bread_crumb
|
||||
},
|
||||
xusername() {
|
||||
var un = ''
|
||||
if(localStorage.getItem("user")){
|
||||
var retrievedObject = localStorage.getItem('user')
|
||||
var dtuser = JSON.parse(retrievedObject)
|
||||
|
||||
un = dtuser.M_UserUsername
|
||||
}
|
||||
return un
|
||||
},
|
||||
xstaffname() {
|
||||
var un = ''
|
||||
if(localStorage.getItem("user")){
|
||||
var retrievedObject = localStorage.getItem('user')
|
||||
var dtuser = JSON.parse(retrievedObject)
|
||||
|
||||
un = dtuser.M_StaffName
|
||||
}
|
||||
return un
|
||||
}
|
||||
},
|
||||
|
||||
methods : {
|
||||
togleDrawer() {
|
||||
this.drawer = ! this.drawer
|
||||
},
|
||||
change_password() {
|
||||
this.$store.commit("system/update_change_password_dialog",true)
|
||||
},
|
||||
logout () {
|
||||
window.one_logout('/one-ui/test/vuex/one-login')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
467
test/vuex/ais-monitoring-transaction-v4/patient.js
Normal file
467
test/vuex/ais-monitoring-transaction-v4/patient.js
Normal file
@@ -0,0 +1,467 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/patient.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
search_patient: 0,
|
||||
search_error_message: '',
|
||||
start_date:moment(new Date()).format('YYYY-MM-DD'),
|
||||
last_search_val: '',
|
||||
last_search_type: '',
|
||||
end_date:moment(new Date()).format('YYYY-MM-DD'),
|
||||
search:'',
|
||||
patients: [],
|
||||
total_patient: 0,
|
||||
selected_patient: {},
|
||||
save_error_message: '',
|
||||
statuses:[{name:'Semua',value:'A'},{name:'Sudah Terkirim',value:'Y'},{name:'Belum Terkirim',value:'N'}],
|
||||
selected_status:{name:'Semua',value:'A'},
|
||||
open_alert_no_pay: false,
|
||||
msg_alert_no_pay: "Loh ... Gak jadi bayar dong ?",
|
||||
current_page:1,
|
||||
total_page:0,
|
||||
pay_disabled:'Y',
|
||||
autocomplete_status:0,
|
||||
companies:[{id:0,name:'Semua'}],
|
||||
selected_company:{id:0,name:'Semua'},
|
||||
logs:[],
|
||||
unduhan:[],
|
||||
loading_download:false,
|
||||
loading_send:false,
|
||||
monitoring_data: [],
|
||||
monitoring_status: 0,
|
||||
monitoring_error_message: '',
|
||||
corporates: [],
|
||||
selected_corporate: { CorporateID: '0', CorporateName: 'Semua', CorporateCode: '' },
|
||||
transaction_log: null,
|
||||
dialog_info: false,
|
||||
dialog_info_message: ''
|
||||
},
|
||||
mutations: {
|
||||
set_last_search(state, { val, type }) {
|
||||
state.last_search_val = val;
|
||||
state.last_search_type = type;
|
||||
},
|
||||
|
||||
update_loading_send(state,val){
|
||||
state.loading_send = val
|
||||
},
|
||||
update_loading_download(state,val){
|
||||
state.loading_download = val
|
||||
},
|
||||
update_unduhan(state,val){
|
||||
state.unduhan = val
|
||||
},
|
||||
update_logs(state,val){
|
||||
state.logs = val
|
||||
},
|
||||
update_autocomplete_status(state,val){
|
||||
state.autocomplete_status = val
|
||||
},
|
||||
update_companies(state, val) {
|
||||
state.companies = val
|
||||
},
|
||||
update_selected_company(state, val) {
|
||||
state.selected_company = val
|
||||
},
|
||||
update_pay_disabled(state, val) {
|
||||
state.pay_disabled = val
|
||||
},
|
||||
update_total_page(state, val) {
|
||||
state.total_page = val
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_page = val
|
||||
},
|
||||
update_search_error_message(state, patient) {
|
||||
state.search_error_message = patient
|
||||
},
|
||||
update_search_patient(state, patient) {
|
||||
state.search_patient = patient
|
||||
},
|
||||
update_patients(state, data) {
|
||||
state.patients = data.records
|
||||
state.total_patient = data.total
|
||||
state.total_page = data.total
|
||||
},
|
||||
update_selected_patient(state, val) {
|
||||
state.selected_patient = val
|
||||
},
|
||||
update_start_date(state, val) {
|
||||
state.start_date = val
|
||||
},
|
||||
update_end_date(state, val) {
|
||||
state.end_date = val
|
||||
},
|
||||
update_search(state, val) {
|
||||
state.search = val
|
||||
},
|
||||
update_selected_status(state, val) {
|
||||
state.selected_status = val
|
||||
},
|
||||
update_open_alert_no_pay(state, val) {
|
||||
state.open_alert_no_pay = val
|
||||
},
|
||||
update_msg_alert_no_pay(state, val) {
|
||||
state.msg_alert_no_pay = val
|
||||
},
|
||||
set_monitoring_data(state, data) {
|
||||
state.monitoring_data = data;
|
||||
},
|
||||
set_monitoring_status(state, status) {
|
||||
state.monitoring_status = status;
|
||||
},
|
||||
set_monitoring_error_message(state, message) {
|
||||
state.monitoring_error_message = message;
|
||||
},
|
||||
update_corporates(state, data) {
|
||||
state.corporates = data;
|
||||
},
|
||||
update_selected_corporate(state, data) {
|
||||
state.selected_corporate = data;
|
||||
},
|
||||
set_transaction_log(state, payload) {
|
||||
state.transaction_log = payload;
|
||||
},
|
||||
set_dialog_info(state, status) {
|
||||
state.dialog_info = status;
|
||||
},
|
||||
set_dialog_info_message(state, message) {
|
||||
state.dialog_info_message = message;
|
||||
}
|
||||
|
||||
},
|
||||
actions: {
|
||||
async search(context, prm) {
|
||||
context.commit("update_search_patient", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
prm.company = context.state.selected_company.id
|
||||
let resp = await api.search(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_patient", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_search_patient", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_patients", data)
|
||||
context.commit("update_selected_patient", [])
|
||||
context.commit("update_total_page", data.total)
|
||||
/*if(prm.lastidx === 0){
|
||||
context.commit("update_selected_patient", data.records[0])
|
||||
if(!_.isEmpty(data.records[0]))
|
||||
context.commit("paymentnew/update_notes",data.records[0].notes,{root:true})
|
||||
else
|
||||
context.commit("paymentnew/update_notes",[],{root:true})
|
||||
}
|
||||
else{
|
||||
context.commit("update_selected_patient", data.records[prm.lastidx])
|
||||
context.commit("paymentnew/update_notes",data.records[prm.lastidx].notes,{root:true})
|
||||
}*/
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_patient", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async searchcompany(context,prm) {
|
||||
context.commit("update_autocomplete_status",1)
|
||||
try {
|
||||
let resp= await api.searchcompany(one_token(),prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
} else {
|
||||
context.commit("update_autocomplete_status",2)
|
||||
let data = {
|
||||
records : resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
context.commit("update_companies",resp.data.records)
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
}
|
||||
},
|
||||
async download_data(context,prm) {
|
||||
context.commit("update_loading_download",true)
|
||||
try {
|
||||
let resp= await api.download_data(one_token(),prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading_download",false)
|
||||
} else {
|
||||
context.commit("update_loading_download",false)
|
||||
context.commit("update_unduhan",resp.data.records)
|
||||
context.commit("paymentnew/update_dialog_pay_success",true,{root:true})
|
||||
context.commit("update_autocomplete_status",2)
|
||||
context.dispatch("search",{
|
||||
startdate:context.state.start_date,
|
||||
enddate:context.state.start_date,
|
||||
search: context.state.search,
|
||||
status: context.state.selected_status.value,
|
||||
current_page:1,
|
||||
lastidx:0
|
||||
})
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_loading_download",false)
|
||||
}
|
||||
},
|
||||
async sendresult(context,prm) {
|
||||
context.commit("update_loading_send",true)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp= await api.sendresult(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading_send",false)
|
||||
} else {
|
||||
|
||||
context.dispatch("getlogs",{})
|
||||
//alert("Proses unduh selesai")
|
||||
context.commit("update_loading_send",false)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_loading_send",false)
|
||||
}
|
||||
},
|
||||
async getlogs(context,prm) {
|
||||
context.commit("update_autocomplete_status",1)
|
||||
try {
|
||||
prm = context.state.selected_patient
|
||||
prm.token = one_token()
|
||||
let resp= await api.getlogs(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
} else {
|
||||
|
||||
context.commit("update_logs",resp.data.records)
|
||||
|
||||
}
|
||||
} catch(e) {
|
||||
context.commit("update_autocomplete_status",3)
|
||||
}
|
||||
},
|
||||
// async monitoring_transaction(context, prm) {
|
||||
// context.commit("set_monitoring_status", 1);
|
||||
// try {
|
||||
// if (prm.lab_number) {
|
||||
// context.commit('set_last_search', { val: prm.lab_number, type: 'lab_number' });
|
||||
// } else if (prm.patient_name) {
|
||||
// context.commit('set_last_search', { val: prm.patient_name, type: 'patient_name' });
|
||||
// } else {
|
||||
// context.commit('set_last_search', { val: '', type: '' });
|
||||
// }
|
||||
|
||||
// let resp = await api.monitoring_transaction(prm);
|
||||
// if (resp.status !== "success") {
|
||||
// context.commit("set_monitoring_status", 3);
|
||||
// context.commit("set_monitoring_error_message", resp.message);
|
||||
// } else {
|
||||
// context.commit("set_monitoring_status", 2);
|
||||
// context.commit("set_monitoring_status", 2);
|
||||
// context.commit("set_monitoring_data", resp.data);
|
||||
// context.commit("set_monitoring_error_message", "");
|
||||
// const total_page = Math.ceil(resp.total / resp.limit);
|
||||
// context.commit("update_total_page", total_page);
|
||||
// context.commit("update_current_page", resp.page);
|
||||
|
||||
// }
|
||||
// } catch (e) {
|
||||
// context.commit("set_monitoring_status", 3);
|
||||
// context.commit("set_monitoring_error_message", e.message);
|
||||
// console.error(e);
|
||||
// }
|
||||
// },
|
||||
|
||||
// Di bagian actions -> monitoring_transaction, ubah commit ini:
|
||||
async monitoring_transaction(context, prm) {
|
||||
context.commit("set_monitoring_status", 1); // 1: LOADING
|
||||
try {
|
||||
// Simpan parameter pencarian terakhir untuk paginasi
|
||||
if (prm.lab_number) {
|
||||
context.commit('set_last_search', { val: prm.lab_number, type: 'lab_number' });
|
||||
} else if (prm.patient_name) {
|
||||
context.commit('set_last_search', { val: prm.patient_name, type: 'patient_name' });
|
||||
} else {
|
||||
context.commit('set_last_search', { val: '', type: '' });
|
||||
}
|
||||
|
||||
let resp = await api.monitoring_transaction(prm);
|
||||
if (resp.status !== "success") {
|
||||
context.commit("set_monitoring_status", 3); // 3: ERROR
|
||||
context.commit("set_monitoring_error_message", resp.message);
|
||||
} else {
|
||||
context.commit("set_monitoring_status", 2); // 2: SUCCESS
|
||||
|
||||
// FIX: Wrap response data dengan struktur yang sesuai
|
||||
const wrappedData = {
|
||||
data: resp.data, // Array dari API
|
||||
total: resp.total,
|
||||
page: resp.page,
|
||||
limit: resp.limit
|
||||
};
|
||||
|
||||
context.commit("set_monitoring_data", wrappedData);
|
||||
context.commit("set_monitoring_error_message", "");
|
||||
|
||||
const total_page = Math.ceil(resp.total / resp.limit);
|
||||
context.commit("update_total_page", total_page);
|
||||
context.commit("update_current_page", resp.page);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("set_monitoring_status", 3);
|
||||
context.commit("set_monitoring_error_message", e.message);
|
||||
console.error(e);
|
||||
}
|
||||
},
|
||||
|
||||
// Atau alternatif: ubah computed property di component
|
||||
// Di file Vue component, ganti computed patients menjadi:
|
||||
// Di computed patients
|
||||
patients() {
|
||||
console.log('monitoring_data:', this.$store.state.patient.monitoring_data);
|
||||
const monitoringData = this.$store.state.patient.monitoring_data || {};
|
||||
const result = Array.isArray(monitoringData.data) ? monitoringData.data : [];
|
||||
console.log('patients result:', result);
|
||||
return result;
|
||||
},
|
||||
|
||||
async get_corporates(context) {
|
||||
let resp = await api.get_corporate();
|
||||
if (resp.status === 'success') {
|
||||
let corporates = resp.data;
|
||||
corporates.unshift({ CorporateID: '0', CorporateName: 'Semua', CorporateCode: '' });
|
||||
context.commit('update_corporates', corporates);
|
||||
}
|
||||
},
|
||||
|
||||
async get_json_response({ commit, state }) {
|
||||
commit('set_transaction_log', null); // Reset log saat memulai
|
||||
commit('set_monitoring_status', 1); // Set status loading
|
||||
if (!state.selected_patient || !state.selected_patient.lab_number) {
|
||||
commit('set_monitoring_status', 2); // Selesai loading
|
||||
return;
|
||||
}
|
||||
|
||||
const params = {
|
||||
lab_number: state.selected_patient.lab_number
|
||||
};
|
||||
|
||||
const response = await api.get_json_response(params);
|
||||
|
||||
if (response.status === 'success' && response.data) {
|
||||
commit('set_transaction_log', response.data);
|
||||
} else {
|
||||
commit('set_transaction_log', null);
|
||||
console.error("Failed to get JSON response:", response.message);
|
||||
}
|
||||
commit('set_monitoring_status', 2); // Selesai loading
|
||||
},
|
||||
|
||||
async post_transaction_by_labnumber(context, prm) {
|
||||
context.commit("set_monitoring_status", 1);
|
||||
try {
|
||||
const response = await api.post_transaction_by_labnumber(prm);
|
||||
|
||||
if (response.status === 'success') {
|
||||
|
||||
const searchVal = context.state.search;
|
||||
let searchParams = {};
|
||||
|
||||
if (/[a-zA-Z]/.test(searchVal) && /\d/.test(searchVal)) {
|
||||
searchParams.lab_number = searchVal;
|
||||
} else {
|
||||
searchParams.patient_name = searchVal;
|
||||
}
|
||||
|
||||
await context.dispatch("monitoring_transaction", {
|
||||
start_date: context.state.start_date,
|
||||
end_date: context.state.end_date,
|
||||
...searchParams,
|
||||
corporate_id: context.state.selected_corporate.CorporateID,
|
||||
ais_status: context.state.selected_status.value,
|
||||
page: context.state.current_page
|
||||
});
|
||||
|
||||
const updatedItem = context.state.monitoring_data.find(item => item.lab_number === prm.labnumber);
|
||||
if (updatedItem) {
|
||||
context.commit("update_selected_patient", updatedItem);
|
||||
await context.dispatch("get_json_response");
|
||||
}
|
||||
|
||||
context.commit("set_dialog_info_message", "Transaksi berhasil dikirim.");
|
||||
|
||||
} else {
|
||||
const errorMessage = response.message || "Gagal mengirim transaksi.";
|
||||
context.commit("set_dialog_info_message", errorMessage);
|
||||
}
|
||||
|
||||
context.commit("set_dialog_info", true);
|
||||
} catch (e) {
|
||||
context.commit("set_dialog_info_message", "Terjadi kesalahan: " + e.message);
|
||||
context.commit("set_dialog_info", true);
|
||||
} finally {
|
||||
context.commit("set_monitoring_status", 2);
|
||||
}
|
||||
},
|
||||
|
||||
async re_post_transaction_by_labnumber(context, prm) {
|
||||
context.commit("set_monitoring_status", 1);
|
||||
try {
|
||||
const response = await api.re_post_transaction_by_labnumber(prm);
|
||||
|
||||
if (response.status === 'success') {
|
||||
|
||||
const searchVal = context.state.search;
|
||||
let searchParams = {};
|
||||
|
||||
if (/[a-zA-Z]/.test(searchVal) && /\d/.test(searchVal)) {
|
||||
searchParams.lab_number = searchVal;
|
||||
} else {
|
||||
searchParams.patient_name = searchVal;
|
||||
}
|
||||
|
||||
await context.dispatch("monitoring_transaction", {
|
||||
start_date: context.state.start_date,
|
||||
end_date: context.state.end_date,
|
||||
...searchParams,
|
||||
corporate_id: context.state.selected_corporate.CorporateID,
|
||||
ais_status: context.state.selected_status.value,
|
||||
page: context.state.current_page
|
||||
});
|
||||
|
||||
const updatedItem = context.state.monitoring_data.find(item => item.lab_number === prm.labnumber);
|
||||
if (updatedItem) {
|
||||
context.commit("update_selected_patient", updatedItem);
|
||||
await context.dispatch("get_json_response");
|
||||
}
|
||||
|
||||
context.commit("set_dialog_info_message", "Transaksi berhasil dikirim ulang.");
|
||||
|
||||
} else {
|
||||
const errorMessage = response.message || "Gagal mengirim ulang transaksi.";
|
||||
context.commit("set_dialog_info_message", errorMessage);
|
||||
}
|
||||
|
||||
context.commit("set_dialog_info", true);
|
||||
|
||||
} catch (e) {
|
||||
context.commit("set_dialog_info_message", "Terjadi kesalahan: " + e.message);
|
||||
context.commit("set_dialog_info", true);
|
||||
} finally {
|
||||
context.commit("set_monitoring_status", 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
27
test/vuex/ais-monitoring-transaction-v4/store.js
Normal file
27
test/vuex/ais-monitoring-transaction-v4/store.js
Normal file
@@ -0,0 +1,27 @@
|
||||
import patient from "./modules/patient.js";
|
||||
import payment from "./modules/payment.js";
|
||||
import paymentnew from "./modules/paymentnew.js";
|
||||
import test from "./modules/test.js";
|
||||
import system from "../../../apps/modules/system/system.js";
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
patient: patient,
|
||||
payment: payment,
|
||||
test:test,
|
||||
paymentnew:paymentnew,
|
||||
system:system
|
||||
},
|
||||
state: {
|
||||
tab_selected: 'pasien-dokter'
|
||||
},
|
||||
mutations: {
|
||||
change_tab(state, ntab) {
|
||||
state.tab_selected = ntab
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
change_tab(context, ntab) {
|
||||
context.commit('change_tab', ntab)
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user