1117 lines
42 KiB
JavaScript
1117 lines
42 KiB
JavaScript
// 1 => LOADING
|
|
// 2 => DONE
|
|
// 3 => ERROR
|
|
import * as api from "../api/receivereference.js"
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state: {
|
|
last_id: -1,
|
|
last_saved_id: -1,
|
|
x_pat_id: 0,
|
|
act: 'edit',
|
|
act_comp: 'new',
|
|
act_pat: 'new',
|
|
act_send: 'N',
|
|
get_data_status: 0,
|
|
search_receivereference: 0,
|
|
search_status: 0,
|
|
search_error_message: '',
|
|
dialog_form_order: false,
|
|
dialog_form_add: false,
|
|
dialog_form_update: false,
|
|
dialog_form_print: false,
|
|
dialog_form_print_tagihan: false,
|
|
dialog_edit_form_order: false,
|
|
dialog_status_order: false,
|
|
norm: '',
|
|
selected_patient: {},
|
|
indeterminatex: false,
|
|
receivereference_name: '',
|
|
receivereferences: [],
|
|
total_receivereferences: 0,
|
|
listmous: [],
|
|
receivereference_patient: [],
|
|
date: '',
|
|
note: 'medical check up',
|
|
dueday: 0,
|
|
noref: '',
|
|
picname: '',
|
|
pichp: '',
|
|
picemail: '',
|
|
sdate: moment(new Date()).format('YYYY-MM-DD'),
|
|
rdate: '',
|
|
companies: [],
|
|
staff: {},
|
|
deliveryorders: [],
|
|
deliveryorder: {},
|
|
mous: [],
|
|
mou: {},
|
|
banks: [],
|
|
bank: {},
|
|
total_receivereference: 0,
|
|
selected_receivereference: {},
|
|
save_status: 0,
|
|
btn_save_seen: true,
|
|
pgrs_save: false,
|
|
save_error_message: '',
|
|
no_save: 0,
|
|
open_alert_confirmation: false,
|
|
alert_success: false,
|
|
msg_success: "",
|
|
dialog_success: false,
|
|
dialog_confirmation_delete: false,
|
|
msg_confirmation_delete: "",
|
|
dialog_confirmation_send: false,
|
|
msg_confirmation_send: "",
|
|
dialog_confirmation_delete_pat: false,
|
|
msg_confirmation_delete_pat: "",
|
|
autocomplete_status: 0,
|
|
dialog_form_patient: false,
|
|
errors: [],
|
|
patients: [],
|
|
noref: '',
|
|
namapasien: '',
|
|
dob: '',
|
|
sexes: [],
|
|
selected_sex: {},
|
|
reports: [],
|
|
selected_report: {},
|
|
cetaks: [],
|
|
selected_cetak: {},
|
|
orderautotests: [],
|
|
orderautotest: {},
|
|
ordertests: [],
|
|
deleted_ordertests: [],
|
|
statuss: [],
|
|
bar_chx_all: false,
|
|
indeterminatex: false,
|
|
statuses: [{
|
|
name: 'Semua',
|
|
value: 'A'
|
|
},
|
|
{
|
|
name: 'Baru',
|
|
value: 'O'
|
|
}, {
|
|
name: 'Surat Jalan',
|
|
value: 'N'
|
|
}, {
|
|
name: 'Proses',
|
|
value: 'P'
|
|
}, {
|
|
name: 'Selesai',
|
|
value: 'D'
|
|
}],
|
|
selected_status: {
|
|
name: 'Semua',
|
|
value: 'A'
|
|
},
|
|
open_print_note: false,
|
|
init_idate: moment(new Date()).format('YYYY-MM-DD'),
|
|
init_sdate: moment(new Date()).format('YYYY-MM-DD'),
|
|
init_edate: moment(new Date()).format('YYYY-MM-DD'),
|
|
in_saving: false,
|
|
image_url:'',
|
|
close_image_url:false,
|
|
image_url_send:'',
|
|
close_image_url_send:false,
|
|
xsearch: '',
|
|
sumtotal: 0,
|
|
ctotal: 0,
|
|
isallmou:false,
|
|
nomor:''
|
|
},
|
|
mutations: {
|
|
update_init_idate(state, val) {
|
|
state.init_idate = val
|
|
},
|
|
update_isallmou(state, val) {
|
|
state.isallmou = val
|
|
},
|
|
update_nomor(state, val) {
|
|
state.nomor = val
|
|
},
|
|
update_sumtotal(state, val) {
|
|
state.sumtotal = val
|
|
},
|
|
update_ctotal(state, val) {
|
|
state.ctotal = val
|
|
},
|
|
update_xsearch(state, val) {
|
|
state.xsearch = val
|
|
},
|
|
update_rdate(state, val) {
|
|
state.rdate = val
|
|
},
|
|
update_image_url(state, val) {
|
|
state.image_url = val
|
|
},
|
|
update_close_image_url(state, val) {
|
|
state.close_image_url = val
|
|
},
|
|
update_image_url_send(state, val) {
|
|
state.image_url_send = val
|
|
},
|
|
update_close_image_url_send(state, val) {
|
|
state.close_image_url_send = val
|
|
},
|
|
update_noref(state, val) {
|
|
state.noref = val
|
|
},
|
|
update_picname(state, val) {
|
|
state.picname = val
|
|
},
|
|
update_pichp(state, val) {
|
|
state.pichp = val
|
|
},
|
|
update_picemail(state, val) {
|
|
state.picemail = val
|
|
},
|
|
update_in_saving(state, val) {
|
|
state.in_saving = val
|
|
},
|
|
update_init_sdate(state, val) {
|
|
state.init_sdate = val
|
|
},
|
|
update_init_edate(state, val) {
|
|
state.init_edate = val
|
|
},
|
|
update_indeterminatex(state, val) {
|
|
state.indeterminatex = val
|
|
},
|
|
update_bar_chx_all(state, val) {
|
|
state.bar_chx_all = val
|
|
},
|
|
update_x_pat_id(state, val) {
|
|
state.x_pat_id = val
|
|
},
|
|
update_last_id(state, val) {
|
|
state.last_id = val
|
|
},
|
|
update_last_saved_id(state, val) {
|
|
state.last_saved_id = val
|
|
},
|
|
update_selected_patient(state, val) {
|
|
state.selected_patient = val
|
|
},
|
|
update_act(state, val) {
|
|
state.act = val
|
|
},
|
|
update_act_comp(state, val) {
|
|
state.act_comp = val
|
|
},
|
|
update_act_pat(state, val) {
|
|
state.act_pat = val
|
|
},
|
|
update_act_send(state, val) {
|
|
state.act_send = val
|
|
},
|
|
update_get_data_status(state, val) {
|
|
state.get_data_status = val
|
|
},
|
|
update_search_error_message(state, receivereference) {
|
|
state.search_error_message = receivereference
|
|
},
|
|
update_search_receivereference(state, receivereference) {
|
|
state.search_receivereference = receivereference
|
|
},
|
|
update_dialog_form_order(state, val) {
|
|
state.dialog_form_order = val
|
|
},
|
|
update_dialog_form_add(state, val) {
|
|
state.dialog_form_add = val
|
|
},
|
|
update_dialog_form_update(state, val) {
|
|
state.dialog_form_update = val
|
|
},
|
|
update_dialog_form_print(state, val) {
|
|
state.dialog_form_print = val
|
|
},
|
|
update_dialog_form_print_tagihan(state, val) {
|
|
state.dialog_form_print_tagihan = val
|
|
},
|
|
update_dialog_edit_form_order(state, val) {
|
|
state.dialog_edit_form_order = val
|
|
},
|
|
update_dialog_status_order(state, val) {
|
|
state.dialog_status_order = val
|
|
},
|
|
update_receivereference_name(state, val) {
|
|
state.receivereference_name = val
|
|
},
|
|
update_date(state, val) {
|
|
state.date = val
|
|
},
|
|
update_note(state, val) {
|
|
state.note = val
|
|
},
|
|
update_dueday(state, val) {
|
|
state.dueday = val
|
|
},
|
|
update_sdate(state, val) {
|
|
state.sdate = val
|
|
},
|
|
update_receivereferences(state, data) {
|
|
state.receivereferences = data
|
|
},
|
|
update_listmous(state, data) {
|
|
state.listmous = data
|
|
},
|
|
update_selected_receivereference(state, val) {
|
|
state.selected_receivereference = val
|
|
},
|
|
update_save_status(state, val) {
|
|
state.save_status = val
|
|
},
|
|
update_btn_save_seen(state, val) {
|
|
state.btn_save_seen = val
|
|
},
|
|
update_pgrs_save(state, val) {
|
|
state.pgrs_save = val
|
|
},
|
|
update_save_error_message(state, msg) {
|
|
state.save_error_message = ''
|
|
},
|
|
update_no_save(state, val) {
|
|
state.no_save = val
|
|
},
|
|
update_open_alert_confirmation(state, val) {
|
|
state.open_alert_confirmation = val
|
|
},
|
|
update_alert_success(state, val) {
|
|
state.alert_success = val
|
|
},
|
|
update_msg_success(state, val) {
|
|
state.msg_success = val
|
|
},
|
|
update_dialog_success(state, val) {
|
|
state.dialog_success = val
|
|
},
|
|
update_dialog_confirmation_delete(state, val) {
|
|
state.dialog_confirmation_delete = val
|
|
},
|
|
update_msg_confirmation_delete(state, val) {
|
|
state.msg_confirmation_delete = val
|
|
},
|
|
update_dialog_confirmation_send(state, val) {
|
|
state.dialog_confirmation_send = val
|
|
},
|
|
update_msg_confirmation_send(state, val) {
|
|
state.msg_confirmation_send = val
|
|
},
|
|
update_dialog_confirmation_delete_pat(state, val) {
|
|
state.dialog_confirmation_delete_pat = val
|
|
},
|
|
update_msg_confirmation_delete_pat(state, val) {
|
|
state.msg_confirmation_delete_pat = val
|
|
},
|
|
update_patients(state, val) {
|
|
state.patients = val
|
|
},
|
|
update_autocomplete_status(state, val) {
|
|
state.autocomplete_status = val
|
|
},
|
|
update_dialog_form_patient(state, val) {
|
|
state.dialog_form_patient = val
|
|
},
|
|
update_label_patient(state, val) {
|
|
state.label_patient = val
|
|
},
|
|
update_companies(state, val) {
|
|
state.companies = val
|
|
},
|
|
update_staff(state, val) {
|
|
state.staff = val
|
|
},
|
|
update_deliveryorders(state, val) {
|
|
state.deliveryorders = val
|
|
},
|
|
update_deliveryorder(state, val) {
|
|
state.deliveryorder = val
|
|
},
|
|
update_mous(state, val) {
|
|
state.mous = val
|
|
},
|
|
update_mou(state, val) {
|
|
state.mou = val
|
|
},
|
|
update_banks(state, val) {
|
|
state.banks = val
|
|
},
|
|
update_bank(state, val) {
|
|
state.bank = val
|
|
},
|
|
update_search_status(state, val) {
|
|
state.search_status = val
|
|
},
|
|
update_errors(state, val) {
|
|
state.errors = val
|
|
},
|
|
update_total_receivereferences(state, val) {
|
|
state.total_receivereferences = val
|
|
},
|
|
update_dob(state, val) {
|
|
state.dob = val
|
|
},
|
|
update_noref(state, val) {
|
|
state.noref = val
|
|
},
|
|
update_nama_pasien(state, val) {
|
|
state.namapasien = val
|
|
},
|
|
update_sexes(state, val) {
|
|
state.sexes = val
|
|
},
|
|
update_reports(state, val) {
|
|
state.reports = val
|
|
},
|
|
update_cetaks(state, val) {
|
|
state.cetaks = val
|
|
},
|
|
update_selected_sex(state, val) {
|
|
state.selected_sex = val
|
|
},
|
|
update_selected_report(state, val) {
|
|
state.selected_report = val
|
|
},
|
|
update_selected_cetak(state, val) {
|
|
state.selected_cetak = val
|
|
},
|
|
update_orderautotests(state, data) {
|
|
state.orderautotests = data
|
|
},
|
|
update_orderautotest(state, val) {
|
|
state.orderautotest = val
|
|
},
|
|
update_ordertests(state, data) {
|
|
state.ordertests = data
|
|
},
|
|
update_deleted_ordertests(state, data) {
|
|
state.deleted_ordertests = data
|
|
},
|
|
update_statuss(state, data) {
|
|
state.statuss = data
|
|
},
|
|
update_selected_status(state, val) {
|
|
state.selected_status = val
|
|
},
|
|
update_open_print_note(state, val) {
|
|
state.open_print_note = val
|
|
}
|
|
},
|
|
actions: {
|
|
async upload(context,prm) {
|
|
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.upload(prm)
|
|
|
|
if (resp.status != "OK") {
|
|
|
|
} else {
|
|
console.log(resp.data)
|
|
context.commit('update_close_image_url', false);
|
|
context.commit('update_image_url', resp.data.url);
|
|
var selected_receivereference = context.state.selected_receivereference
|
|
selected_receivereference.HS_DeliveryOrderConfirmIssueImg = resp.data.url
|
|
selected_receivereference.HS_DeliveryOrderConfirmIssueReceiveDate = prm.rdate
|
|
context.commit('update_selected_receivereference', selected_receivereference);
|
|
context.commit("update_last_id", prm.idbill)
|
|
}
|
|
} catch(e) {
|
|
console.log(e)
|
|
}
|
|
},
|
|
async uploadsend(context,prm) {
|
|
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.uploadsend(prm)
|
|
|
|
if (resp.status != "OK") {
|
|
|
|
} else {
|
|
console.log(resp.data)
|
|
context.commit('update_close_image_url_send', false);
|
|
context.commit('update_image_url_send', resp.data.url);
|
|
var selected_receivereference = context.state.selected_receivereference
|
|
selected_receivereference.HS_DeliveryOrderConfirmIssueImgSend = resp.data.url
|
|
selected_receivereference.HS_DeliveryOrderConfirmIssueSenDate = prm.rdate
|
|
context.commit('update_selected_receivereference', selected_receivereference);
|
|
context.commit("update_last_id", prm.idbill)
|
|
}
|
|
} catch(e) {
|
|
console.log(e)
|
|
}
|
|
},
|
|
async save_patient(context, prm) {
|
|
context.commit("update_search_receivereference", 1)
|
|
try {
|
|
let resp = await api.save_patient(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_search_receivereference", 3)
|
|
context.commit("update_search_error_message", resp.message)
|
|
} else {
|
|
context.commit("update_search_receivereference", 2)
|
|
context.commit("update_search_error_message", "")
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_search_receivereference", 3)
|
|
context.commit("update_search_error_message", e.message)
|
|
}
|
|
},
|
|
async search(context, prm) {
|
|
context.commit("update_search_receivereference", 1)
|
|
try {
|
|
let resp = await api.search(one_token(), prm.name, prm.snorm, prm.status, prm.startdate, prm.enddate)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_search_receivereference", 3)
|
|
context.commit("update_search_error_message", resp.message)
|
|
} else {
|
|
context.commit("update_search_receivereference", 2)
|
|
context.commit("update_search_error_message", "")
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
context.commit("update_receivereferences", data.records)
|
|
context.commit("update_total_receivereferences", data.total)
|
|
|
|
context.commit("update_no_save", 0)
|
|
if (prm.lastid === -1 && data.total > 0) {
|
|
context.commit("update_selected_receivereference", data.records[0])
|
|
var pat = data.records[0]
|
|
|
|
context.commit("update_receivereference_name", pat.M_StaffName)
|
|
context.dispatch("getpatient", {
|
|
id: pat.HS_DeliveryOrderID,
|
|
startdate: pat.HS_DeliveryOrderDateHS,
|
|
userid: pat.M_UserID,
|
|
search: ''
|
|
})
|
|
|
|
}else if (prm.lastid !== -1 && data.total > 0) {
|
|
context.commit("update_selected_receivereference", data.records[prm.lastid])
|
|
var pat = data.records[prm.lastid]
|
|
context.commit("update_receivereference_name", pat.M_StaffName)
|
|
context.dispatch("getpatient", {
|
|
id: pat.HS_DeliveryOrderID,
|
|
startdate: pat.HS_DeliveryOrderDateHS,
|
|
userid: pat.M_UserID,
|
|
search: ''
|
|
})
|
|
|
|
} else {
|
|
context.commit("update_selected_receivereference", '')
|
|
var pat = ''
|
|
context.commit("update_receivereference_name", '')
|
|
context.dispatch("getpatient", {
|
|
id: 0,
|
|
startdate: moment().format("YYYY-MM-DD"),
|
|
userid: 0,
|
|
search: ''
|
|
})
|
|
|
|
}
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_search_receivereference", 3)
|
|
context.commit("update_search_error_message", e.message)
|
|
}
|
|
},
|
|
async getsexreg(context) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
let resp = await api.getsexreg(one_token())
|
|
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
|
|
}
|
|
context.commit("update_sexes", data.records.sexes)
|
|
context.commit("update_reports", data.records.reports)
|
|
context.commit("update_cetaks", data.records.cetaks)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async save(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.save(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_last_id", prm.T_ReceiveReferenceHeaderID)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Data pasien " + prm.M_PatientName + " sudah terupdate dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async newreceivereference(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.newreceivereference(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
var data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
if(data.total !== -1){
|
|
context.commit("update_save_status", 2)
|
|
console.log(resp.data.id)
|
|
context.commit("update_last_id", resp.data.id)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Data berhasil disimpan"
|
|
context.commit("update_msg_success", msg)
|
|
context.commit("update_dialog_form_order", false)
|
|
context.commit("update_in_saving", false)
|
|
}else{
|
|
context.commit("update_errors", resp.data.errors)
|
|
context.commit("update_in_saving", false)
|
|
}
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async editbill(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.editbill(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
console.log(resp.data.id)
|
|
context.commit("update_last_id", resp.data.id)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Data berhasil diubah"
|
|
context.commit("update_msg_success", msg)
|
|
context.commit("update_dialog_form_order", false)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async addbill(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.addbill(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
console.log(resp.data.id)
|
|
context.commit("update_last_id", resp.data.id)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Data berhasil ditambahkan"
|
|
context.commit("update_msg_success", msg)
|
|
context.commit("update_dialog_form_add", false)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async updatebill(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.updatebill(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
console.log(resp.data.id)
|
|
context.commit("update_last_id", resp.data.id)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Jadwal Home Service berhasil diubah"
|
|
context.commit("update_msg_success", msg)
|
|
context.commit("update_dialog_form_update", false)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async deletebill(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.deletebill(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
console.log(resp.data.id)
|
|
context.commit("update_last_id", resp.data.id)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Transaksi berhasil dibatalkan"
|
|
context.commit("update_msg_success", msg)
|
|
context.commit("update_dialog_form_order", false)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async notifbill(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.notifbill(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
console.log(resp.data.id)
|
|
context.commit("update_last_id", resp.data.id)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Penagihan telah di konfirmasi"
|
|
context.commit("update_msg_success", msg)
|
|
context.commit("update_dialog_form_order", false)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async sendbill(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.sendbill(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
var msg = resp.data.pesan
|
|
alert(msg)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
console.log(resp.data.id)
|
|
context.commit("update_last_id", resp.data.id)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = resp.data.pesan
|
|
context.commit("update_msg_success", msg)
|
|
context.commit("update_dialog_form_order", false)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async sendbillbaru(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.sendbill(prm)
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_save_error_message", resp.message)
|
|
|
|
var msg = resp.data.pesan
|
|
alert(msg)
|
|
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
console.log(e)
|
|
}
|
|
},
|
|
async delete(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.xdelete(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_last_id", 0)
|
|
context.commit("update_dialog_confirmation_delete", false)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Data pasien " + prm.M_PatientName + " sudah dihapus dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
context.commit("update_receivereference_name", '')
|
|
context.commit("update_selected_title", {})
|
|
context.commit("update_selected_sex", {})
|
|
context.commit("update_selected_religion", {})
|
|
context.commit("update_dob", '')
|
|
context.commit("update_hp", '')
|
|
context.commit("update_phone", '')
|
|
context.commit("update_email", '')
|
|
context.commit("update_selected_kartuidentitas", {})
|
|
context.commit("update_noidentitas", '')
|
|
context.commit("update_note", '')
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async sendorder(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.sendorder(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_dialog_confirmation_send", false)
|
|
context.commit("update_last_id", prm.T_ReceiveReferenceHeaderID)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Permintaan nomor " + prm.T_ReceiveReferenceHeaderNumber + " sudah berhasil dikirim ..."
|
|
context.commit("update_msg_success", msg)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async getpatient(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.getpatient(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,
|
|
sumtotal: resp.data.sumtotal,
|
|
ctotal: resp.data.ctotal
|
|
}
|
|
context.commit("update_sumtotal", data.sumtotal)
|
|
context.commit("update_ctotal", data.ctotal)
|
|
context.commit("update_patients", data.records)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async searchstaff(context, prm) {
|
|
context.commit("update_autocomplete_status", 1)
|
|
try {
|
|
let resp = await api.searchstaff(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 searchdeliveryorder(context, prm) {
|
|
context.commit("update_autocomplete_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.searchdeliveryorder(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_deliveryorders", resp.data.records)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_autocomplete_status", 3)
|
|
}
|
|
},
|
|
async searchbank(context, prm) {
|
|
context.commit("update_autocomplete_status", 1)
|
|
try {
|
|
let resp = await api.searchbank(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_banks", resp.data.records)
|
|
if(prm == ""){
|
|
var pat = data.records[0]
|
|
context.commit("update_bank", { M_BankAccountID: pat.M_BankAccountID,M_BankAccountName: pat.M_BankAccountName
|
|
})
|
|
}
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_autocomplete_status", 3)
|
|
}
|
|
},
|
|
async getmou(context, prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
let resp = await api.getmou(one_token(), 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
|
|
}
|
|
context.commit("update_mous", resp.data.records)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async listmou(context, prm) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
let resp = await api.listmou(one_token(), 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
|
|
}
|
|
context.commit("update_listmous", resp.data.records)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async getnomor(context) {
|
|
context.commit("update_get_data_status", 1)
|
|
try {
|
|
let resp = await api.getnomor(one_token())
|
|
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
|
|
}
|
|
// context.commit("update_noref", resp.data.records)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_get_data_status", 3)
|
|
}
|
|
},
|
|
async searchtest(context, prm) {
|
|
context.commit("update_autocomplete_status", 1)
|
|
try {
|
|
let resp = await api.searchtest(one_token(), prm.tes, prm.mouid)
|
|
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_orderautotests", resp.data.records)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_autocomplete_status", 3)
|
|
}
|
|
},
|
|
async getpatientbeforesave(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.getpatient(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,
|
|
sumtotal: resp.data.sumtotal,
|
|
ctotal: resp.data.ctotal
|
|
}
|
|
context.commit("update_sumtotal", data.sumtotal)
|
|
context.commit("update_ctotal", data.ctotal)
|
|
context.commit("update_patients", data.records)
|
|
//context.dispatch("savenewpatient", prm)
|
|
|
|
let patients = context.state.patients
|
|
let pat = _.filter(patients, function (it) {
|
|
return it.checx == 'Y'
|
|
})
|
|
var xprm = {}
|
|
xprm.billID = prm.id
|
|
xprm.M_StaffName = prm.staff
|
|
xprm.patients = pat
|
|
context.dispatch("savenewpatient", xprm)
|
|
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async savenewpatient(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.savenewpatient(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_dialog_form_patient", false)
|
|
context.commit("update_last_id", prm.HS_DeliveryOrderDetailHS_DeliveryOrderID)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Penambahan data tagihan perusahaan " + prm.M_StaffName + " sudah berhasil dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
context.commit("update_in_saving", false)
|
|
|
|
context.dispatch("savebillmou", prm.HS_DeliveryOrderDetailHS_DeliveryOrderID)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async savebillmou(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.savebillmou(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_dialog_form_patient", false)
|
|
context.commit("update_last_id", prm.HS_DeliveryOrderDetailHS_DeliveryOrderID)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Penambahan data tagihan perusahaan " + prm.M_StaffName + " sudah berhasil dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
context.commit("update_in_saving", false)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async saveall_tempbill(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.saveall_tempbill(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
let data = {
|
|
sumtotal: resp.data.sumtotal,
|
|
ctotal: resp.data.ctotal
|
|
}
|
|
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_last_id", prm.billID)
|
|
context.dispatch("getpatient", {
|
|
id: prm.billID,
|
|
startdate: prm.startdate,
|
|
userid: prm.userid,
|
|
search: prm.search
|
|
})
|
|
context.commit("update_in_saving", false)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async save_tempbill(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.save_tempbill(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
let data = {
|
|
sumtotal: resp.data.sumtotal,
|
|
ctotal: resp.data.ctotal
|
|
}
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_last_id", prm.billid)
|
|
context.commit("update_in_saving", false)
|
|
context.dispatch("getpatient", {
|
|
id: prm.billid,
|
|
userid: prm.userid,
|
|
startdate: prm.startdate,
|
|
search: prm.search
|
|
})
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async saveeditpatient(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.saveeditpatient(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_dialog_form_patient", false)
|
|
context.commit("update_last_id", prm.T_ReceiveReferencePatientT_ReceiveReferenceHeaderID)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Penambahan data pasien perusahaan " + prm.M_StaffName + " sudah berhasil dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
},
|
|
async deletepatient(context, prm) {
|
|
context.commit("update_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.deletepatient(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_save_status", 3)
|
|
} else {
|
|
context.commit("update_save_status", 2)
|
|
context.commit("update_dialog_confirmation_delete_pat", false)
|
|
context.commit("update_last_id", prm.HS_DeliveryOrderDetailID)
|
|
context.commit("update_dialog_success", true)
|
|
var msg = "Penghapusan data pasien sudah berhasil dong ..."
|
|
context.commit("update_msg_success", msg)
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_save_status", 3)
|
|
}
|
|
}
|
|
}
|
|
} |