848 lines
35 KiB
Vue
848 lines
35 KiB
Vue
<template>
|
|
<v-layout column pb-2 v-if="testdialog == 1">
|
|
<v-dialog v-model="dialogprogress" persistent max-width="350">
|
|
<v-card>
|
|
<v-card-title color="warning" class="headline">Proses sedang berjalan</v-card-title>
|
|
<v-card-text>
|
|
<v-layout row>
|
|
<v-flex xs12>
|
|
<v-progress-linear :indeterminate="true"></v-progress-linear>
|
|
</v-flex>
|
|
</v-layout>
|
|
<v-layout row>
|
|
<v-flex xs12>
|
|
<p>Mohon menunggu, penggantian paket membutuhkan waktu lebih</p>
|
|
<p>...</p>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card-text>
|
|
<v-card-actions>
|
|
<v-spacer></v-spacer>
|
|
<!--<v-btn color="green darken-1" flat @click="dialogprogress">OK</v-btn>-->
|
|
</v-card-actions>
|
|
</v-card>
|
|
</v-dialog>
|
|
<v-dialog v-model="replacedialog" persistent max-width="60%">
|
|
<v-card>
|
|
<v-card-title dark class="headline green pt-2 pb-2" primary-title style="color:white">
|
|
<h4>Paket Pengganti</h4>
|
|
</v-card-title>
|
|
<v-card-text class="pt-2 pb-2">
|
|
<v-layout row>
|
|
<v-flex pr-1 xs4 class="text-xs-center pa-2">
|
|
{{msgdialogpromise}}
|
|
</v-flex>
|
|
</v-layout>
|
|
<v-layout row>
|
|
<v-flex pa-2 xs12>
|
|
<v-data-table :headers="headers_packet" :items="packetall" :loading="isLoading"
|
|
hide-actions>
|
|
<template slot="items" slot-scope="props">
|
|
<tr>
|
|
<td class="text-xs-left pa-2">
|
|
<p style="color:#800000" class="mb-0 font-weight-bold caption"> {{ props.item.pxname }}</p> {{ props.item.px_detail }}
|
|
<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">
|
|
<span>{{ convertMoney(props.item.total) }}</span>
|
|
</td>
|
|
<td class="text-xs-center pa-2"><v-btn color="green" dark
|
|
@click="confirmReplaceTest(props.item)">
|
|
Pilih Paket
|
|
</v-btn>
|
|
</td>
|
|
</tr>
|
|
</template>
|
|
</v-data-table>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card-text>
|
|
<v-divider></v-divider>
|
|
<v-card-actions>
|
|
<v-spacer></v-spacer>
|
|
<v-btn color="black" flat @click="replacedialog = false">
|
|
Tutup
|
|
</v-btn>
|
|
</v-card-actions>
|
|
|
|
</v-card>
|
|
</v-dialog>
|
|
<v-dialog v-model="confirmdialog" persistent max-width="60%">
|
|
<v-card>
|
|
<v-card-title dark class="headline green pt-2 pb-2" primary-title style="color:white">
|
|
<h4>Konfirmasi</h4>
|
|
</v-card-title>
|
|
|
|
<v-card-text class="pt-2 pb-2">
|
|
<v-layout row>
|
|
<v-flex pr-1 xs12 class="text-xs-left pa-2">
|
|
Yakin mengganti {{msgdialogpromise}} menjadi <p style="color:#800000"> {{packetnewname}}</p>
|
|
</v-flex>
|
|
</v-layout>
|
|
</v-card-text>
|
|
<v-divider></v-divider>
|
|
<v-card-actions>
|
|
<v-spacer></v-spacer>
|
|
<v-btn color="black" flat @click="confirmdialog = false">
|
|
Tutup
|
|
</v-btn>
|
|
<v-btn style="margin-right:0" @click="updateReplaceTest()" flat
|
|
color="primary" dark>Yakin</v-btn>
|
|
</v-card-actions>
|
|
|
|
</v-card>
|
|
</v-dialog>
|
|
<v-card>
|
|
<v-card-title dark class="headline green pt-2 pb-2" primary-title style="color:white">
|
|
<h4>Ganti Paket</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>
|
|
<v-flex xs12 pa-2>
|
|
<v-layout row>
|
|
<v-flex pa-2 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-2 xs12>
|
|
<v-data-table :headers="headers" :items="testsall" :loading="isLoading"
|
|
hide-actions>
|
|
<template slot="items" slot-scope="props">
|
|
<tr>
|
|
<td class="text-xs-left pa-2">
|
|
<p style="color:#800000" class="mb-0 font-weight-bold caption"> {{ props.item.pxname }}</p> {{ props.item.px_detail }}
|
|
<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">
|
|
<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>
|
|
<td class="text-xs-center pa-2"><v-btn color="green" dark
|
|
@click="openFormTest(props.item)">
|
|
Ganti Paket
|
|
</v-btn>
|
|
</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="primary" dark>Simpan</v-btn>
|
|
</v-card-actions> -->
|
|
</v-card>
|
|
<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: '',
|
|
is_loading: false,
|
|
isLoading: false,
|
|
error_promise: false,
|
|
error_replace_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: "PAKET",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "testname",
|
|
width: "40%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
},
|
|
|
|
{
|
|
text: "TOTAL",
|
|
align: "center",
|
|
sortable: false,
|
|
value: "total",
|
|
width: "10%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
},
|
|
{
|
|
text: "AKSI",
|
|
align: "center",
|
|
sortable: false,
|
|
value: "total",
|
|
width: "30%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
}
|
|
],
|
|
headers_packet: [
|
|
{
|
|
text: "PAKET",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "testname",
|
|
width: "40%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
},
|
|
|
|
{
|
|
text: "TOTAL",
|
|
align: "center",
|
|
sortable: false,
|
|
value: "total",
|
|
width: "10%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
},
|
|
{
|
|
text: "AKSI",
|
|
align: "center",
|
|
sortable: false,
|
|
value: "total",
|
|
width: "30%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
}
|
|
],
|
|
headerverifications: [
|
|
{
|
|
text: "STATUS",
|
|
align: "center",
|
|
sortable: false,
|
|
value: "status",
|
|
width: "7%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
},
|
|
{
|
|
text: "CITO",
|
|
align: "center",
|
|
sortable: false,
|
|
value: "cito",
|
|
width: "7%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
},
|
|
{
|
|
text: "PEMERIKSAAN",
|
|
align: "left",
|
|
sortable: false,
|
|
value: "testname",
|
|
width: "15%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
},
|
|
|
|
{
|
|
text: "BRUTO",
|
|
align: "center",
|
|
sortable: false,
|
|
value: "bruto",
|
|
width: "10%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
},
|
|
{
|
|
text: "DISKON",
|
|
align: "center",
|
|
sortable: false,
|
|
value: "discount",
|
|
width: "10%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
},
|
|
{
|
|
text: "TOTAL",
|
|
align: "center",
|
|
sortable: false,
|
|
value: "total",
|
|
width: "15%",
|
|
class: "pa-2 blue lighten-3 white--text"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
computed: {
|
|
testdialog: {
|
|
get() {
|
|
return this.$store.state.packet.test_dialog
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_test_dialog", val)
|
|
}
|
|
},
|
|
dialogprogress: {
|
|
get() {
|
|
return this.$store.state.packet.dialog_progress
|
|
},
|
|
set(v) {
|
|
this.$store.commit("packet/update_dialog_progress", v)
|
|
}
|
|
},
|
|
savestatusverification() {
|
|
return this.$store.state.packet.save_status_verification
|
|
},
|
|
vmsgsave() {
|
|
return this.$store.state.packet.save_message
|
|
},
|
|
vstatussave() {
|
|
return this.$store.state.packet.save_status
|
|
},
|
|
testsregistration() {
|
|
return this.$store.state.packet.test_registration
|
|
},
|
|
testsverification() {
|
|
return this.$store.state.packet.test_verification
|
|
},
|
|
testsall: {
|
|
get() {
|
|
return this.$store.state.packet.test_all
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_test_all", val)
|
|
}
|
|
},
|
|
packetall: {
|
|
get() {
|
|
return this.$store.state.packet.packet_all
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_packet_all", val)
|
|
}
|
|
},
|
|
testnew: {
|
|
get() {
|
|
return this.$store.state.packet.testnew
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_testnew", val)
|
|
}
|
|
},
|
|
vtests() {
|
|
return this.$store.state.packet.tests
|
|
},
|
|
vtest: {
|
|
get() {
|
|
return this.$store.state.packet.test
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_test", val)
|
|
console.log(val.promise)
|
|
this.promiseright = val.promise
|
|
this.$store.commit("packet/update_show_promise_right", true)
|
|
}
|
|
},
|
|
vcito: {
|
|
get() {
|
|
return this.$store.state.packet.cito
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_cito", val)
|
|
}
|
|
},
|
|
citos() {
|
|
return this.$store.state.packet.citos
|
|
},
|
|
selected_cito: {
|
|
get() {
|
|
return this.$store.state.packet.selected_cito
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_selected_cito", val)
|
|
}
|
|
},
|
|
xpromises() {
|
|
return this.$store.state.packet.promises
|
|
},
|
|
xpromise: {
|
|
get() {
|
|
return this.$store.state.packet.promise
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_promise", val)
|
|
}
|
|
},
|
|
replacedialog: {
|
|
get() {
|
|
return this.$store.state.packet.replace_dialog
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_replace_dialog", val)
|
|
}
|
|
},
|
|
confirmdialog: {
|
|
get() {
|
|
return this.$store.state.packet.confirm_dialog
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_confirm_dialog", val)
|
|
}
|
|
},
|
|
msgdialogpromise: {
|
|
get() {
|
|
return this.$store.state.packet.msg_replace_dialog
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_msg_replace_dialog", val)
|
|
}
|
|
},
|
|
showpromiseleft: {
|
|
get() {
|
|
return this.$store.state.packet.show_promise_left
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_show_promise_left", val)
|
|
}
|
|
},
|
|
showpromiseright: {
|
|
get() {
|
|
return this.$store.state.packet.show_promise_right
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_show_promise_right", val)
|
|
}
|
|
},
|
|
promiseleft: {
|
|
get() {
|
|
return this.$store.state.packet.promise_left
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_promise_left", val)
|
|
}
|
|
},
|
|
getdatastatus: {
|
|
get() {
|
|
return this.$store.state.packet.save_status
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_save_status", val)
|
|
}
|
|
},
|
|
showdropdowncito: {
|
|
get() {
|
|
return this.$store.state.packet.show_cito_dropdown
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_show_cito_dropdown", val)
|
|
}
|
|
},
|
|
packetold: {
|
|
get() {
|
|
return this.$store.state.packet.packetold
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_packetold", val)
|
|
}
|
|
},
|
|
packetnew: {
|
|
get() {
|
|
return this.$store.state.packet.packetnew
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_packetnew", val)
|
|
}
|
|
},
|
|
packetnewname: {
|
|
get() {
|
|
return this.$store.state.packet.packetnewname
|
|
},
|
|
set(val) {
|
|
this.$store.commit("packet/update_packetnewname", val)
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
showExist() {
|
|
this.opendialogerror = true
|
|
this.msgerror = "Paket 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.packet.test_verification
|
|
var prm = {
|
|
orderid: this.$store.state.patient.selected_patient.orderid,
|
|
tests: arrtest
|
|
}
|
|
this.$store.dispatch("packet/savetestadditionalverification", prm)
|
|
},
|
|
changePromise(value) {
|
|
let arrtest = this.$store.state.packet.test_verification
|
|
var idx = _.findIndex(arrtest, item => item.idx === value.idx)
|
|
arrtest[idx]['promise'] = value.promise
|
|
this.$store.commit("packet/update_test_verification", arrtest)
|
|
},
|
|
closeDialogOrder() {
|
|
if (this.savestatus !== 2) {
|
|
this.$store.commit("packet/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("packet/update_test_dialog", false)
|
|
}
|
|
},
|
|
changeCharge(row, value) {
|
|
var oldArr = this.$store.state.packet.test_all
|
|
var idx = _.findIndex(oldArr, row)
|
|
oldArr[idx].active = 'Y'
|
|
oldArr[idx].charge = value
|
|
this.$store.commit("packet/update_test_all", oldArr)
|
|
},
|
|
changeTestAll(row, value) {
|
|
var oldArr = this.$store.state.packet.test_all
|
|
var idx = _.findIndex(oldArr, row)
|
|
let nowstatus = row.status
|
|
if (nowstatus == false && row.xid != '0') {
|
|
this.$store.dispatch("packet/checkstatus", row)
|
|
}
|
|
else {
|
|
oldArr[idx].active = 'Y'
|
|
oldArr[idx].status = nowstatus
|
|
this.$store.commit("packet/update_test_all", oldArr)
|
|
}
|
|
},
|
|
changeTestCito(value) {
|
|
this.$store.commit("packet/update_selected_test", value)
|
|
var prm = value
|
|
prm.orderid = this.$store.state.patient.selected_patient.orderid
|
|
this.$store.dispatch("packet/getnewprice", prm)
|
|
},
|
|
thr_search_test: _.debounce(function () {
|
|
var oldArr = this.$store.state.packet.test_all
|
|
this.promiseright = '-'
|
|
|
|
var prm = {
|
|
orderid: this.$store.state.patient.selected_patient.orderid,
|
|
search: this.search_test,
|
|
cito: this.$store.state.packet.cito
|
|
}
|
|
this.$store.dispatch("packet/searchtest", prm)
|
|
}, 2000),
|
|
addTestToAll() {
|
|
var xtestall = this.$store.state.packet.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.packet.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("packet/update_test_all", xtestall)
|
|
this.$store.commit("packet/update_test", {})
|
|
}
|
|
|
|
|
|
},
|
|
addTestToAllxx() {
|
|
|
|
var xtestall = this.$store.state.packet.test_all
|
|
var xtestadditional = this.$store.state.packet.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("packet/update_test_all", xtestall)
|
|
this.$store.commit("packet/update_test", {})
|
|
}
|
|
|
|
if (xnew.type === 'PXR') {
|
|
xnew.orderid = this.$store.state.patient.selected_patient.orderid
|
|
var params = { all: xtestall, new: xnew }
|
|
this.$store.dispatch("packet/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("packet/update_test_all", xtestall)
|
|
this.$store.commit("packet/update_test", {})
|
|
}
|
|
|
|
},
|
|
saveTestAdditional() {
|
|
var prm = {
|
|
orderid: this.$store.state.patient.selected_patient.orderid,
|
|
testall: this.$store.state.packet.test_all,
|
|
selected_cito: this.$store.state.packet.selected_cito
|
|
}
|
|
this.$store.dispatch("packet/savetestadditional", prm)
|
|
},
|
|
checkPromiseOrderAdd() {
|
|
this.$store.commit("packet/update_act", 'additional')
|
|
var prm = {
|
|
orderid: this.$store.state.patient.selected_patient.orderid,
|
|
tests: this.$store.state.packet.test_all
|
|
}
|
|
this.$store.dispatch("packet/checkpromisetests", prm)
|
|
},
|
|
checkPromiseOrderVerification() {
|
|
this.$store.commit("packet/update_act", 'verification')
|
|
var prm = {
|
|
orderid: this.$store.state.patient.selected_patient.orderid,
|
|
tests: this.$store.state.packet.test_verification
|
|
}
|
|
this.$store.dispatch("packet/checkpromisetests", prm)
|
|
},
|
|
openFormTest(val) {
|
|
this.$store.commit("packet/update_selected_test", val)
|
|
this.$store.commit("packet/update_replace_dialog", true)
|
|
this.$store.commit("packet/update_msg_replace_dialog", val.pxname)
|
|
this.$store.commit("packet/update_packetold", val.pxcode)
|
|
},
|
|
confirmReplaceTest(val) {
|
|
this.$store.commit("packet/update_packetnew", val.pxcode)
|
|
this.$store.commit("packet/update_packetnewname", val.pxname)
|
|
this.$store.commit("packet/update_confirm_dialog", true)
|
|
},
|
|
updateReplaceTest() {
|
|
this.dialogprogress = true
|
|
var prm = {
|
|
orderid: this.$store.state.patient.selected_patient.orderid,
|
|
number: this.$store.state.patient.selected_patient.labnumber,
|
|
packetold: this.packetold,
|
|
packetnew: this.packetnew
|
|
}
|
|
this.$store.dispatch("packet/savetestadditional", prm)
|
|
this.$store.commit("packet/update_confirm_dialog", false)
|
|
this.$store.commit("packet/update_replace_dialog", false)
|
|
},
|
|
addPromiseTodetail() {
|
|
if (this.selected_promise) {
|
|
let arrtest = this.$store.state.packet.test_verification
|
|
console.log(arrtest)
|
|
var idx = _.findIndex(arrtest, item => item.idx === this.$store.state.packet.selected_detail_verification.idx)
|
|
arrtest[idx]['promise'] = this.selected_promise.id
|
|
arrtest[idx]['promisename'] = this.selected_promise.name
|
|
this.$store.commit("packet/update_test_verification", arrtest)
|
|
this.replacedialog = false
|
|
}
|
|
else {
|
|
this.error_replace_dialog = true
|
|
}
|
|
|
|
},
|
|
closeDialogPromise() {
|
|
var act = this.$store.state.packet.act
|
|
this.replacedialog = 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.packet.autocomplete_status == 1) return
|
|
this.thr_search_test()
|
|
}
|
|
}
|
|
}
|
|
</script>
|