add modules folder based on s_menu

This commit is contained in:
2026-06-30 10:16:11 +07:00
parent 315b657ee3
commit a1aab09ac9
625 changed files with 192283 additions and 794 deletions

View File

@@ -0,0 +1,267 @@
const URL = "/one-api/mockup/receive-item-po/ReceiveItemPoV2";
export async function search(params) {
try {
var resp = await axios.post(URL + '/searchRO', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function getSupplier(params) {
try {
var resp = await axios.post(URL + '/getSupplier', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function getPurchaseOrder(params) {
try {
var resp = await axios.post(URL + '/getPurchaseOrder', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function getWarehouse(params) {
try {
var resp = await axios.post(URL + '/getWarehouse', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function getItem(params) {
try {
var resp = await axios.post(URL + '/getItem', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function getItemUpdate(params) {
try {
var resp = await axios.post(URL + '/getItemUpdate', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function saveRO(params) {
try {
var resp = await axios.post(URL + '/saveRO', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function confirmRO(params) {
try {
var resp = await axios.post(URL + '/confirmRO', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function deleteRO(params) {
try {
var resp = await axios.post(URL + '/deleteRO', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function saveInspeksi(params) {
try {
var resp = await axios.post(URL + '/saveInspeksi', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function getItemDataInspeksi(params) {
try {
var resp = await axios.post(URL + '/getItemDataInspeksi', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function getListStaff(params) {
try {
var resp = await axios.post(URL + "/getListStaff", params)
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
}
}
let data = resp.data
return data
} catch (error) {
return {
status: "ERR",
message: error.message
}
}
}
export async function saveEditRO(params) {
try {
var resp = await axios.post(URL + '/saveEditRO', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function template(params) {
try {
var resp = await axios.post(URL + '/', params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}

View File

@@ -0,0 +1,206 @@
<template>
<v-dialog v-model="dialog_batch_item" persistent width="30vw">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
EDIT QTY, BATCH, dan ED {{ selected_item_forbatch.M_ItemCode }}
{{ selected_item_forbatch.M_ItemDesc }}
</v-card-title>
<v-card-text>
<p class="font-weight-bold">
Jumlah item yang dapat diterima : {{ selected_item_forbatch.qty }}
{{ selected_item_forbatch.ItemUnitName }}
</p>
<div v-for="(item, index) in item_batch_temp" class="mt-2" :key="index">
<v-layout row wrap>
<v-flex xs2 class="pr-1">
<v-text-field
v-model.number="item.qty" type="number" min="0"
hide-details label="qty" outline step="1"
></v-text-field>
</v-flex>
<v-flex xs5 class="pr-1">
<v-text-field
v-model="item.batchno" outline
hide-details label="batch number"
></v-text-field>
</v-flex>
<v-flex xs4 class="pr-1">
<v-menu
v-model="item.menuDate" lazy offset-y
:close-on-content-click="false" transition="scale-transition"
:nudge-right="40" max-width="290px" min-width="290px"
>
<template v-slot:activator="{ on }">
<v-text-field
:value="item.expiredate" label="Expired"
hide-details outline v-on="on" readonly
></v-text-field>
</template>
<v-date-picker
v-model="item.expiredate" no-title
@input="item.menuDate = false" hide-details
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs1>
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
outline small @click="removeInputRow(index)"
color="red lighten-2" icon
>
<v-icon small color="red" v-on="on">remove_circle</v-icon>
</v-btn>
</template>
<span>Hapus</span>
</v-tooltip>
</v-flex>
</v-layout>
<v-divider v-if="index + 1 < item_batch_temp.length" :key="`divider-${index}`" class="mt-1"></v-divider>
</div>
<v-btn flat block @click="addInputRow()" color="primary" outline>
Tambah
</v-btn>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="red" flat @click="tutupDialog()">Tutup</v-btn>
<v-btn color="green" flat @click="simpanBatch()">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
module.exports = {
data() {
return {
}
},
computed: {
dialog_batch_item: {
get() {
return this.$store.state.form.dialog_batch_item;
},
set(val) {
this.$store.commit("form/update_dialog_batch_item", val);
}
},
selected_item_forbatch: {
get() {
return this.$store.state.form.selected_item_forbatch;
},
set(val) {
this.$store.commit("form/update_selected_item_forbatch", val);
}
},
item_batch_temp: {
get() {
return this.$store.state.form.item_batch_temp;
},
set(val) {
this.$store.commit("form/update_item_batch_temp", val);
}
},
form_receive_item: {
get() {
return this.$store.state.form.form_receive_item;
},
set(val) {
this.$store.commit("form/update_form_receive_item", val);
}
}
},
methods: {
tutupDialog() {
this.selected_item_forbatch = {};
this.item_batch_temp = [];
this.dialog_batch_item = false;
},
simpanBatch() {
const temp = this.item_batch_temp;
let curr_item = JSON.parse(JSON.stringify(this.selected_item_forbatch));
let final_arr = [];
const maxQty = Number(curr_item.qty);
let total = 0;
let isError = false;
temp.forEach(item => {
if (curr_item.M_ItemItem_CategoryID == '1') {
if (item.batchno != '' && item.qty > 0) {
total = Number(item.qty) + total;
final_arr.push(item);
} else {
isError = true;
}
} else {
if (Number(item.qty) > 0) {
total = Number(item.qty) + total;
final_arr.push(item);
}
}
});
if (total > maxQty || total <= 0 || isError) {
this.$store.commit("ro/update_snackbar", {
color: 'error',
msg: 'Jumlah total melebihi jumlah yang dapat diterima',
isOpen: true
});
return;
}
let item_received = JSON.parse(JSON.stringify(this.form_receive_item));
item_received.forEach(obj => {
if (obj.keyID === curr_item.keyID) {
obj.batchlist = final_arr;
obj.receivedQty = total;
}
});
this.form_receive_item = item_received;
this.selected_item_forbatch = {};
this.item_batch_temp = [];
this.dialog_batch_item = false;
},
addInputRow() {
const input = {
qty: 0,
batchno: '',
expiredate: moment(new Date()).format('YYYY-MM-DD'),
menuDate: false
};
this.item_batch_temp.push(input);
},
reAddInputRow(data) {
if (!data.batchlist) {
return;
}
data.batchlist.forEach(element => {
let inputrow = {
qty: element.qty,
batchno: element.batchno,
expiredate: element.expiredate,
menuDate: false
};
this.item_batch_temp.push(inputrow);
});
},
removeInputRow(index) {
this.item_batch_temp.splice(index, 1)
}
},
watch: {
selected_item_forbatch(val, old) {
if (val == old) return;
if (!val) return;
this.reAddInputRow(val)
}
},
}
</script>

View File

@@ -0,0 +1,96 @@
<template>
<div>
<!-- dialog konfirmasi -->
<v-dialog v-model="dialog_confirmation" persistent width="500">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
KONFIRMASI
<p class="mb-0 p-0">{{ selected_ro.ReceiveOrderPoNumber }}</p>
</v-card-title>
<v-card-text>
<p>
Setelah dikonfirmasi RO
<span class="font-weight-bold">{{ selected_ro.ReceiveOrderPoNumber }}</span>
tidak bisa di edit dan auto buat jurnal, apakah anda yakin ?
</p>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="red" flat @click="dialog_confirmation = false">
TIDAK
</v-btn>
<v-btn color="green" flat @click="konfirmRO()">
YA
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<!-- dialog delete -->
<v-dialog v-model="dialog_delete" persistent width="500">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
KONFIRMASI HAPUS
<p class="mb-0 p-0">{{ selected_ro.ReceiveOrderPoNumber }}</p>
</v-card-title>
<v-card-text>
<p>
Apakah anda yakin menghapus data berikut
<span class="font-weight-bold">{{ selected_ro.ReceiveOrderPoNumber }}</span>
?
</p>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="red" flat outline @click="dialog_delete = false">
TIDAK
</v-btn>
<v-btn color="green" flat outline @click="deleteRO()">
YA
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</div>
</template>
<script>
module.exports = {
data() {
return {
}
},
computed: {
dialog_confirmation: {
get() {
return this.$store.state.ro.dialog_confirmation;
},
set(val) {
this.$store.commit("ro/update_dialog_confirmation", val);
}
},
dialog_delete: {
get() {
return this.$store.state.ro.dialog_delete;
},
set(val) {
this.$store.commit("ro/update_dialog_delete", val);
}
},
selected_ro() {
return this.$store.state.ro.selected_ro;
}
},
methods: {
konfirmRO() {
this.$store.dispatch("form/confirmRO");
},
deleteRO() {
this.$store.dispatch("ro/deleteRO");
}
},
}
</script>

View File

@@ -0,0 +1,317 @@
<template>
<v-dialog v-model="dialog_select_item" persistent width="60vw">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
TAMBAH ITEM
</v-card-title>
<v-card-text>
<v-autocomplete
v-model="selected_po" :items="list_po" hide-details
return-object flat label="Cari PO" outline class="mb-3"
item-text="PurchaseOrderNumber" @input="searchItem()"
></v-autocomplete>
<!-- list item per po -->
<v-data-table
v-model="select_item_temp" :headers="headers" :items="display_list_itempo"
hide-actions select-all item-key="PoItemReceiveID" class="elevation-1"
>
<template v-slot:headers="props">
<tr>
<th width="10%" class="blue lighten-3 white--text">
<v-checkbox
:input-value="props.all" :indeterminate="props.indeterminate"
primary hide-details @click.stop="toggleAll(props)"
></v-checkbox>
</th>
<th
v-for="header in props.headers" :key="header.text"
:width="header.width" :class="header.class"
>
{{ header.text }}
</th>
</tr>
</template>
<template v-slot:items="props">
<tr :active="props.selected" @click="selectItemRow(props)">
<td>
<v-checkbox
v-if="hideCheckbox(props)"
:input-value="props.selected"
primary hide-details
></v-checkbox>
</td>
<td class="text-xs-center">{{ props.item.M_ItemCode }}</td>
<td class="text-xs-center">
<p class="p-0 mb-0">{{ props.item.M_ItemDesc }}</p>
<p class="p-0 m-0">{{ props.item.WarehouseName }}</p>
</td>
<td class="text-xs-center">
{{ props.item.originalQty }} / {{ props.item.qtyRest }}
{{ props.item.ItemUnitName }}
</td>
<td class="text-xs-center">{{ props.item.qty }}</td>
</tr>
</template>
</v-data-table>
<div class="text-xs-center mt-2">
<v-pagination v-model="itempo_page" :length="total_selected_page" :total-visible="5"></v-pagination>
</div>
<!-- list item selected -->
<v-divider class="my-3"></v-divider>
<h3>ITEM DIPILIH</h3>
<v-data-table
:headers="headers_selected" :items="display_selected_item" hide-actions
item-key="PoItemReceiveID" class="elevation-1 mt-3"
>
<template v-slot:items="props">
<tr>
<td class="text-xs-center">{{ (props.index + 1) }}</td>
<td class="text-xs-left">{{ props.item.PurchaseOrderNumber }}</td>
<td class="text-xs-left">
<p class="p-0 mb-0">{{ props.item.M_ItemCode }}</p>
<p class="p-0 mb-0">{{ props.item.M_ItemDesc }}</p>
<p class="p-0 mb-0">{{ props.item.WarehouseName }}</p>
</td>
<td class="text-xs-center">
{{ props.item.originalQty }} / {{ props.item.qtyRest }}
{{ props.item.ItemUnitName }}
</td>
<td class="text-xs-center">
<v-text-field
v-model="props.item.qty" class="my-2" hide-details outline
type="number" min="0" :max="parseInt(props.item.qtyRest)" step="1"
></v-text-field>
</td>
<td class="text-xs-center">
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
style="min-width: 30px; height: 30px; margin: 0;" outline
small @click="removeItem(props)" color="red lighten-2"
>
<v-icon small color="red" v-on="on">delete</v-icon>
</v-btn>
</template>
<span>Hapus</span>
</v-tooltip>
</td>
</tr>
</template>
</v-data-table>
<div class="text-xs-center mt-2">
<v-pagination v-model="curr_sel_page" :length="total_selected_page" :total-visible="5"></v-pagination>
</div>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="red" flat @click="tutupDialog()">Tutup</v-btn>
<v-btn color="green" flat @click="simpanItem()">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
module.exports = {
data() {
return {
headers: [
{
text: "ITEM CODE ", align: "left", sortable: false, value: "M_ItemCode",
width: "20%", class: "pa-2 pl-2 blue lighten-3 white--text",
},
{
text: "NAME", align: "left", sortable: false, value: "M_ItemDesc",
width: "30%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY", align: "left", sortable: false, value: "ItemUnitName",
width: "25%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY RECEIVED", align: "left",sortable: false, value: "qty",
width: "25%", class: "pa-2 blue lighten-3 white--text",
},
],
itempo_page: 1,
itempo_perpage: 5,
headers_selected: [
{
text: "NO", align: "center", sortable: false, value: "no",
width: "5%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "No. PO", align: "center", sortable: false, value: "po",
width: "25%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "ITEM", align: "center", sortable: false, value: "ITEM",
width: "25%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY PO", align: "center", sortable: false, value: "qty",
width: "10%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY RECEIVED", align: "center", sortable: false, value: "qty_ro",
width: "10%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "", align: "center", sortable: false, value: "qty_ro",
width: "5%", class: "pa-2 blue lighten-3 white--text",
},
],
curr_sel_page: 1,
sel_perpage: 5
}
},
computed: {
dialog_select_item: {
get() {
return this.$store.state.form.dialog_select_item;
},
set(val) {
this.$store.commit("form/update_dialog_select_item", val);
}
},
selected_po: {
get() {
return this.$store.state.form.selected_po;
},
set(val) {
this.$store.commit("form/update_selected_po", val)
}
},
select_item_temp: {
get() {
return this.$store.state.form.select_item_temp;
},
set(val) {
this.$store.commit("form/update_select_item_temp", val)
}
},
list_po: {
get() {
return this.$store.state.form.list_po;
},
set(val) {
this.$store.commit("form/update_list_po", val)
}
},
list_item_po: {
get() {
return this.$store.state.form.list_item_po;
},
set(val) {
this.$store.commit("form/update_list_item_po", val)
}
},
shipping_info: {
get() {
return this.$store.state.form.shipping_info;
},
set(val) {
this.$store.commit("form/update_shipping_info", val)
}
},
total_itempo_page() {
if (this.list_item_po.length <= 0) {
return 1;
}
return Math.ceil(this.list_item_po.length / this.itempo_perpage);
},
display_list_itempo() {
const start = (this.itempo_page - 1) * this.itempo_perpage;
const end = start + this.itempo_perpage;
return this.list_item_po.slice(start, end);
},
total_selected_page() {
if (this.select_item_temp.length <= 0) {
return 1;
}
return Math.ceil(this.select_item_temp.length / this.sel_perpage);
},
display_selected_item() {
const start = (this.curr_sel_page - 1) * this.sel_perpage;
const end = start + this.sel_perpage;
return this.select_item_temp.slice(start, end);
}
},
methods: {
tutupDialog() {
this.list_po = [];
this.selected_po = {};
this.list_item_po = [];
this.select_item_temp = [];
this.dialog_select_item = false;
},
toggleAll(data) {
if (data.all) {
// this.select_item_temp = []
return
} else {
this.select_item_temp = this.list_item_po.slice()
}
},
selectItemRow(data) {
if (!data.selected) {
data.selected = !data.selected;
};
},
hideCheckbox(data) {
return !data.selected;
},
searchItem() {
this.$store.dispatch("form/getItem");
},
removeItem(props) {
let temp = JSON.parse(JSON.stringify(this.select_item_temp));
this.select_item_temp = temp.filter(ele => ele.PoItemReceiveID !== props.item.PoItemReceiveID);
},
simpanItem() {
let temp = JSON.parse(JSON.stringify(this.select_item_temp));
let shippinginfo = [];
let isError = false
temp.forEach(element => {
if (Number(element.qty) > Number(element.qtyRest)) {
isError = true;
return;
}
let ship = {
num_po: element.PurchaseOrderNumber,
cost: element.PurchaseOrderShippingCost,
isUpfront: element.PurchaseOrderShippingCostStatus
};
const isExist = shippinginfo.some(item => item.num_po == element.PurchaseOrderNumber)
if (!isExist) {
shippinginfo.push(ship);
}
});
if (isError) {
this.$store.commit("ro/update_snackbar", {
color: 'error',
msg: 'qty melebihi item yang dikirim',
isOpen: true
});
return;
}
this.$store.commit("form/update_form_receive_item", temp);
this.shipping_info = shippinginfo;
this.list_po = [];
this.selected_po = {};
this.list_item_po = [];
this.select_item_temp = [];
this.dialog_select_item = false;
}
},
}
</script>

View File

@@ -0,0 +1,247 @@
<template>
<v-dialog v-model="dialog_detail_view" width="80vw" persistent>
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
RECEIVE ITEM
<v-spacer></v-spacer>
</v-card-title>
<v-card-text>
<v-layout row wrap>
<!-- first row -->
<v-flex xs4>
<v-menu
v-model="menuReceiveDateForm" lazy offset-y
transition="scale-transition"max-width="290px"
min-width="290px" :nudge-right="40"
:close-on-content-click="false"
>
<template v-slot:activator="{ on }">
<v-text-field
:Value="receiveDateForm" label="Tanggal"
class="mr-2" hide-details outline readonly
></v-text-field>
</template>
<v-date-picker
no-title hide-details v-model="selected_ro.ReceiveOrderPoIDate"
@input="menuReceiveDateForm = false" readonly
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs4>
<v-autocomplete
:items="list_supplier" :value="selected_ro.SupplierID"
item-text="SupplierName" item-value="SupplierID" class="mr-2"
label="Supplier" outline hide-details readonly
></v-autocomplete>
</v-flex>
<v-flex xs4>
<v-text-field
label="Nomor Delivery Order (DO)" class="" readonly outline
v-model="selected_ro.ReceiveOrderPoDONumber" hide-details
></v-text-field>
</v-flex>
<!-- second row -->
<v-flex xs4>
<v-text-field
label="Referensi" class="mr-2" outline readonly
v-model="selected_ro.ReceiveOrderPoRefNumber" hide-details
></v-text-field>
</v-flex>
<v-flex xs4>
<v-autocomplete
:items="list_warehouse" :value="selected_ro.WarehouseID"
item-text="WarehouseName" item-value="WarehouseID" class="mr-2"
label="Gudang" outline hide-details readonly
></v-autocomplete>
</v-flex>
<v-flex xs4>
<v-text-field
label="Biaya Ekspedisi" class="" outline readonly
v-model="selected_ro.ReceiveOrderShippingCostAmount" hide-details
></v-text-field>
</v-flex>
<!-- third row -->
<v-flex xs12>
<v-textarea
v-model="selected_ro.ReceiveOrderPoNote" hide-details outline
auto-grow rows="1" label="Catatan" class="mt-3" readonly
></v-textarea>
</v-flex>
<!-- shipping info -->
<v-flex xs12 class="mt-3" v-if="shipping_info.length > 0">
<v-layout row wrap>
<v-flex v-for="shp in shipping_info" :key="shp.num_po" xs3>
<v-card class="pa-2 ma-2">
<div>
<span class="font-weight-bold">{{ shp.num_po }}</span><br/>
<span>Rp. {{ oneMoney(shp.cost) }}</span><br/>
<span v-if="shp.isUpfront === 'Y'" class="green--text">
Biaya Ekspedisi sudah di bayar
</span>
<span v-else class="red--text">
Biaya Ekspedisi belum di bayar
</span>
</div>
</v-card>
</v-flex>
</v-layout>
</v-flex>
<!-- list item received -->
<v-flex xs12 class="my-3">
<v-data-table
v-if="form_receive_item.length > 0"
:headers = "headers" :items="form_receive_item"
hide-actions item-key="keyID" class="elevation-1"
>
<template v-slot:items="props">
<tr>
<td class="text-xs-left">{{ props.item.PurchaseOrderNumber }}</td>
<td class="text-xs-left">
<p class="p-0 mb-0">{{ props.item.M_ItemCode }}</p>
<p class="p-0 mb-0">{{ props.item.M_ItemDesc }}</p>
<p class="p-0 mb-0">{{ props.item.WarehouseName }}</p>
</td>
<td class="text-xs-center">{{ props.item.qty }} {{ props.item.ItemUnitName }}</td>
<td class="text-xs-left">
<div v-if="props.item.M_ItemItem_CategoryID == 1">
<p class="mb-0 pb-0" v-for="batch in props.item.batchlist">
No. Batch: {{ batch.batchno || '' }},
Exp. Date: {{ batch.expiredate || ''}},
Qty: {{ batch.qty || ''}}
</p>
</div>
</td>
<td class="text-xs-center"></td>
</tr>
</template>
</v-data-table>
</v-flex>
</v-layout>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="info" flat outline @click="closeRO()">Tutup</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
module.exports = {
data() {
return {
menuReceiveDateForm: false,
headers: [
{
text: "PO NUMBER", align: "center", sortable: false, value: "ItemUnitName",
width: "20%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "ITEM", align: "center", sortable: false, value: "M_ItemDesc",
width: "30%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY", align: "center", sortable: false, value: "qty",
width: "10%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "No. Batch & Exp.Date", align: "center", sortable: false, value: "qty",
width: "25%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "AKSI", align: "center", sortable: false, value: "qty",
width: "15%", class: "pa-2 blue lighten-3 white--text",
},
]
}
},
computed: {
dialog_detail_view: {
get() {
return this.$store.state.ro.dialog_detail_view;
},
set(val) {
this.$store.commit("ro/update_dialog_detail_view", val);
}
},
receiveDateForm() {
return this.formatDate(this.selected_ro.ReceiveOrderPoIDate)
},
form_receive: {
get() {
return this.$store.state.form.form_receive;
},
set(val) {
this.$store.commit("form/update_form_receive", val)
}
},
form_receive_item: {
get() {
return this.$store.state.form.form_receive_item;
},
set(val) {
this.$store.commit("form/update_form_receive_item", val)
}
},
selected_ro() {
return this.$store.state.ro.selected_ro
},
list_supplier() {
return this.$store.state.ro.list_supplier
},
list_warehouse() {
return this.$store.state.ro.list_warehouse
},
shipping_info() {
return this.$store.state.form.shipping_info
}
},
methods: {
checkObjectEmpty(obj) {
if (obj === null || obj === undefined || typeof obj !== "object") {
return true;
}
return Object.keys(obj).length === 0 && obj.constructor === Object;
},
formatDate(date) {
if (!date) return null;
const [year, month, day] = date.split("-");
return `${day}-${month}-${year}`;
},
oneMoney(value) {
let cleanValue = String(value).replace(/\D/g, '');
const num = parseInt(cleanValue, 10);
if (isNaN(num)) {
return '';
}
return num.toLocaleString('id-ID');
},
pilihItemRO() {
let temp = this.form_receive_item
if (temp.length > 0) {
this.$store.commit("form/update_select_item_temp", temp);
}
this.$store.dispatch("form/getPurchaseOrder");
this.$store.commit("form/update_dialog_select_item", true);
},
removeItem(props) {
let temp = JSON.parse(JSON.stringify(this.form_receive_item));
let newt = temp.filter((item) => item.PoItemReceiveID !== props.item.PoItemReceiveID);
this.form_receive_item = newt;
},
closeRO() {
this.$store.dispatch("form/resetForm");
this.$store.commit("ro/update_selected_ro", {});
this.dialog_detail_view = false;
},
},
}
</script>

View File

@@ -0,0 +1,260 @@
<template>
<v-dialog v-model="dialog_form_inspeksi" persistent width="40vw">
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
FORM INSPEKSI ITEM {{ selected_item_received.M_ItemDesc }}
</v-card-title>
<v-card-text>
<v-layout row>
<v-flex xs6 pr-1>
<v-text-field
label="Jumlah Pesan" type="number" min="0" hide-details
v-model="form_inspeksi.qty_po" outline step="1"
></v-text-field>
</v-flex>
<v-flex xs6 pl-1>
<v-text-field
label="Jumlah Actual" type="number" min="0" hide-details
v-model="form_inspeksi.qty_ro" outline step="1"
></v-text-field>
</v-flex>
</v-layout>
<v-layout row mt-2>
<v-flex xs6 pr-1>
<v-text-field
label="Harga Pesan" type="number" min="0" hide-details
v-model="form_inspeksi.price_po" outline prefix="Rp."
></v-text-field>
</v-flex>
<v-flex xs6 pl-1>
<v-text-field
label="Harga Actual" type="number" min="0" hide-details
v-model="form_inspeksi.price_ro" outline prefix="Rp."
></v-text-field>
</v-flex>
</v-layout>
<v-layout row mt-2>
<v-flex xs6 pr-1>
<v-menu
v-model="menuDatePo" lazy offset-y max-width="290px"
full-width transition="scale-transition" min-width="290px"
:nudge-right="40" :close-on-content-click="false"
>
<template v-slot:activator="{ on }">
<v-text-field
:value="form_inspeksi.date_po" v-on="on" readonly
label="Tanggal Terima Pesan" outline hide-details
></v-text-field>
</template>
<v-date-picker
v-model="form_inspeksi.date_po" no-title
@input="menuDatePo = false"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs6 pl-1>
<v-menu
v-model="menuDateRo" lazy offset-y max-width="290px"
full-width transition="scale-transition" min-width="290px"
:nudge-right="40" :close-on-content-click="false"
>
<template v-slot:activator="{ on }">
<v-text-field
:value="form_inspeksi.date_ro" v-on="on" readonly
label="Tanggal Terima Actual" outline hide-details
></v-text-field>
</template>
<v-date-picker
v-model="form_inspeksi.date_ro" no-title
@input="menuDateRo = false"
></v-date-picker>
</v-menu>
</v-flex>
</v-layout>
<v-layout row mt-2>
<v-flex xs12>
<v-menu
v-model="menuExpired" lazy offset-y max-width="290px"
full-width transition="scale-transition" min-width="290px"
:nudge-right="40" :close-on-content-click="false"
>
<template v-slot:activator="{ on }">
<v-text-field
:value="form_inspeksi.expire_date" outline readonly
label="Tanggal Kadaluarsa" v-on="on" hide-details
></v-text-field>
</template>
<v-date-picker
v-model="form_inspeksi.expire_date" no-title
@input="menuExpired = false"
></v-date-picker>
</v-menu>
</v-flex>
</v-layout>
<v-layout row mt-2 wrap>
<v-flex xs12>
<v-radio-group
v-model="form_inspeksi.condt_kemasan"
label="Kondisi Kemasan" row hide-details
>
<v-radio label="Baik" value="1"></v-radio>
<v-radio label="Tidak Baik" value="2"></v-radio>
</v-radio-group>
<v-text-field
v-if="form_inspeksi.condt_kemasan == '2'" class="mt-2"
label="Catatan Kemasan" outline hide-details
v-model="form_inspeksi.catatan_kemasan"
></v-text-field>
</v-flex>
<v-flex xs12 mt-2>
<v-radio-group
v-model="form_inspeksi.condt_pengiriman"
label="Kondisi Pengiriman" row hide-details
>
<v-radio label="Sesuai" value="1"></v-radio>
<v-radio label="Tidak Sesuai" value="2"></v-radio>
</v-radio-group>
<v-text-field
v-if="form_inspeksi.condt_pengiriman == '2'" class="mt-2"
outline label="Catatan Pengiriman" hide-details
v-model="form_inspeksi.catatan_kirim"
></v-text-field>
</v-flex>
<v-flex xs12 mt-2>
<v-radio-group
v-model="form_inspeksi.summary" row
label="Kesimpulan" hide-details
>
<v-radio label="Diterima" value="accept"></v-radio>
<v-radio label="Ditolak" value="reject"></v-radio>
<v-radio label="Diterima dengan Catatan" value="acceptnote"></v-radio>
</v-radio-group>
</v-flex>
<v-flex xs12 mt-2>
<v-textarea
v-if="form_inspeksi.summary == 'reject' || form_inspeksi.summary == 'acceptnote'"
v-model="form_inspeksi.catatan" outline
auto-grow rows="1" label="Catatan" hide-details
></v-textarea>
</v-flex>
</v-layout>
<v-layout row mt-2>
<v-flex xs6 pr-1>
<v-autocomplete
label="Staff Penerima" outline hide-details
v-model="form_inspeksi.pemeriksa" :items="list_staff"
item-text="M_UserUsername" item-value="M_UserID"
></v-autocomplete>
</v-flex>
<v-flex xs6 pl-1>
<v-text-field
label="Petugas Pengirim" outline hide-details
v-model="form_inspeksi.pengirim"
></v-text-field>
</v-flex>
</v-layout>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="red" flat outline @click="closeInspeksi()">Tutup</v-btn>
<v-btn color="green" flat outline @click="simpanInspeksi()">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
module.exports = {
data() {
return {
menuDatePo: false,
menuDateRo: false,
menuExpired: false,
}
},
computed: {
dialog_form_inspeksi: {
get() {
return this.$store.state.form.dialog_form_inspeksi
},
set(val) {
this.$store.commit("form/update_dialog_form_inspeksi", val)
}
},
form_inspeksi: {
get() {
return this.$store.state.form.form_inspeksi
},
set(val) {
this.$store.commit("form/update_form_inspeksi", val)
}
},
selected_item_received: {
get() {
return this.$store.state.form.selected_item_received
},
set(val) {
this.$store.commit("form/update_selected_item_received", val)
}
},
form_receive_item: {
get() {
return this.$store.state.form.form_receive_item
},
set(val) {
this.$store.commit("form/update_form_receive_item", val);
}
},
list_staff() {
return this.$store.state.ro.list_staff
}
},
methods: {
closeInspeksi() {
let a = {
qty_po: 0,
qty_ro: 0,
price_po: 0.00,
price_ro: 0.00,
date_po: moment(new Date()).format('YYYY-MM-DD'),
date_ro: moment(new Date()).format('YYYY-MM-DD'),
expire_date: moment(new Date()).format('YYYY-MM-DD'),
condt_kemasan: '',
catatan_kemasan: '',
condt_pengiriman: '',
catatan_kirim: '',
summary: '',
catatan: '',
pemeriksa: '',
pengirim: ''
}
this.form_inspeksi = a
this.selected_item_received = {}
this.dialog_form_inspeksi = false
},
async simpanInspeksi() {
let data_inspeksi = JSON.parse(JSON.stringify(this.form_inspeksi));
let data_received = JSON.parse(JSON.stringify(this.selected_item_received));
let list_item_received = JSON.parse(JSON.stringify(this.form_receive_item));
data_received.inspeksi_item = data_inspeksi;
const idxToUpdate = list_item_received.findIndex(obj => obj.keyID == data_received.keyID);
if (idxToUpdate != -1) {
list_item_received[idxToUpdate].inspeksi_item = data_inspeksi;
}
this.form_receive_item = list_item_received;
this.closeInspeksi();
},
},
}
</script>

View File

@@ -0,0 +1,433 @@
<template>
<v-dialog v-model="dialog_form_receive_item" width="80vw" persistent>
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
RECEIVE ITEM
<v-spacer></v-spacer>
</v-card-title>
<v-card-text>
<v-form ref="formro" lazy-validation v-model="valid_formro">
<v-layout row>
<v-flex xs4 pr-1>
<v-menu
v-model="menuReceiveDateForm" lazy offset-y max-width="290px"
full-width transition="scale-transition" min-width="290px"
:nudge-right="40" :close-on-content-click="false"
>
<template v-slot:activator="{ on }">
<v-text-field
:value="receiveDateForm" label="Tanggal"
outline hide-details v-on="on" readonly
></v-text-field>
</template>
<v-date-picker
v-model="form_receive.receive_date" no-title
@input="menuReceiveDateForm = false"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs4 px-1>
<v-autocomplete
v-model="form_receive.supplier" :rules="rules_supplier"
:items="list_supplier" return-object outline item-value="SupplierID"
item-text="SupplierName" label="Supplier*" required
></v-autocomplete>
</v-flex>
<v-flex xs4 pl-1>
<v-text-field
label="Nomor Delivery Order (DO)*" outline required
v-model="form_receive.number_do" :rules="rules_do"
></v-text-field>
</v-flex>
</v-layout>
<v-layout row>
<v-flex xs4 pr-1>
<v-text-field
label="Referensi" outline hide-details
v-model="form_receive.referensi"
></v-text-field>
</v-flex>
<v-flex xs4 px-1>
<v-autocomplete
v-model="form_receive.warehouse" :rules="rules_warehouse"
:items="list_warehouse" outline required
item-text="WarehouseName" label="Gudang*" return-object
></v-autocomplete>
</v-flex>
<v-flex xs4 pl-1>
<v-text-field
label="Biaya Ekspedisi" outline prefix="Rp. "
v-model="form_receive.shipping_cost" hide-details
></v-text-field>
</v-flex>
</v-layout>
<v-layout row wrap>
<v-flex xs12>
<v-textarea
v-model="form_receive.note" hide-details
auto-grow rows="1" label="Catatan" outline
></v-textarea>
</v-flex>
<v-flex xs3>
<v-btn
block color="info" class="mt-2" @click="pilihItemRO()"
:disabled="checkObjectEmpty(form_receive.supplier) || checkObjectEmpty(form_receive.warehouse)"
>TAMBAH ITEM</v-btn>
</v-flex>
</v-layout>
<v-layout row mt-2 wrap>
<v-flex v-for="shp in shipping_info" :key="shp.num_po" xs3>
<v-card class="pa-2">
<div>
<span class="font-weight-bold">{{ shp.num_po }}</span><br/>
<span>Rp. {{ oneMoney(shp.cost) }}</span><br/>
<span v-if="shp.isUpfront === 'Y'" class="green--text">
Biaya Ekspedisi sudah dibayar
</span>
<span v-else class="red--text">
Biaya Ekspedisi belum dibayar
</span>
</div>
</v-card>
</v-flex>
</v-layout>
<v-layout row mt-4 wrap>
<v-flex xs12>
<v-data-table
v-if="form_receive_item.length > 0"
:headers = "headers" :items="form_receive_item"
hide-actions item-key="keyID" class="elevation-1"
>
<template v-slot:items="props">
<tr>
<td class="text-xs-left">{{ props.item.PurchaseOrderNumber }}</td>
<td class="text-xs-left">
<p class="p-0 mb-0">{{ props.item.M_ItemCode }}</p>
<p class="p-0 mb-0">{{ props.item.M_ItemDesc }}</p>
<p class="p-0 mb-0">{{ props.item.WarehouseName }}</p>
</td>
<td class="text-xs-center">{{ props.item.qty }} {{ props.item.ItemUnitName }}</td>
<td class="text-xs-left">
<div v-if="props.item.M_ItemItem_CategoryID == 1">
<p class="mb-0 pb-0" v-for="batch in props.item.batchlist">
No. Batch: {{ batch.batchno || '' }},
Exp. Date: {{ batch.expiredate || ''}},
Qty: {{ batch.qty || ''}}
</p>
</div>
</td>
<td class="text-xs-center">
<div v-if="props.item.inspeksi_item">
<p v-if="props.item.inspeksi_item.summary == 'accept'">
Diterima
</p>
<p v-else-if="props.item.inspeksi_item.summary == 'reject'"
class="mb-0 pb-0"
>
Ditolak <br>
{{ props.item.inspeksi_item.catatan }}
</p>
<p v-else class="mb-0 pb-0">
Diterima dengan Catatan <br>
{{ props.item.inspeksi_item.catatan }}
</p>
</div>
</td>
<td class="text-xs-center">
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
style="min-width: 30px; height: 30px; margin: 0;" outline
small @click="inspekItem(props)" color="green lighten-2"
>
<v-icon small color="green" v-on="on">note_add</v-icon>
</v-btn>
</template>
<span>Inspek Item</span>
</v-tooltip>
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
style="min-width: 30px; height: 30px; margin: 0;" outline
small @click="editBatch(props)" color="blue lighten-2"
>
<v-icon small color="blue" v-on="on">edit</v-icon>
</v-btn>
</template>
<span>Edit</span>
</v-tooltip>
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
style="min-width: 30px; height: 30px; margin: 0;" outline
small @click="removeItem(props)" color="red lighten-2"
>
<v-icon small color="red" v-on="on">delete</v-icon>
</v-btn>
</template>
<span>Hapus</span>
</v-tooltip>
</td>
</tr>
</template>
</v-data-table>
</v-flex>
</v-layout>
</v-form>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="red" flat outline @click="batalRO()">Batal</v-btn>
<v-btn color="green" flat outline @click="simpanRO()">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
module.exports = {
components: {},
data() {
return {
menuReceiveDateForm: false,
valid_formro: true,
rules_do: [v => !!v || 'Nomor DO harus diisi'],
rules_supplier: [v => (v && Object.keys(v).length > 0) || 'Supplier harus diisi'],
rules_warehouse: [v => (v && Object.keys(v).length > 0) || 'Warehouse harus diisi'],
headers: [
{
text: "PO NUMBER", align: "center", sortable: false, value: "ItemUnitName",
width: "18%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "ITEM", align: "center", sortable: false, value: "M_ItemDesc",
width: "25%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY", align: "center", sortable: false, value: "qty",
width: "10%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "No. Batch & Exp.Date", align: "center", sortable: false, value: "qty",
width: "22%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "INSPEKSI", align: "center", sortable: false, value: "inspeksi",
width: "10%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "AKSI", align: "center", sortable: false, value: "qty",
width: "15%", class: "pa-2 blue lighten-3 white--text",
},
]
}
},
computed: {
dialog_form_receive_item: {
get() {
return this.$store.state.form.dialog_form_receive_item;
},
set(val) {
this.$store.commit("form/update_dialog_form_receive_item", val);
}
},
receiveDateForm() {
return this.formatDate(this.form_receive.receive_date)
},
form_receive: {
get() {
return this.$store.state.form.form_receive;
},
set(val) {
this.$store.commit("form/update_form_receive", val)
}
},
form_receive_item: {
get() {
return this.$store.state.form.form_receive_item;
},
set(val) {
this.$store.commit("form/update_form_receive_item", val)
}
},
list_supplier() {
return this.$store.state.ro.list_supplier
},
list_warehouse() {
return this.$store.state.ro.list_warehouse
},
shipping_info() {
return this.$store.state.form.shipping_info
}
},
methods: {
checkObjectEmpty(obj) {
if (obj === null || obj === undefined || typeof obj !== "object") {
return true;
}
return Object.keys(obj).length === 0 && obj.constructor === Object;
},
formatDate(date) {
if (!date) return null;
const [year, month, day] = date.split("-");
return `${day}-${month}-${year}`;
},
oneMoney(value) {
if (typeof value !== 'number') {
value = parseFloat(value);
}
if (isNaN(value)) return '0,00';
// Bulatkan dulu ke 2 desimal
const fixed = value.toFixed(2); // hasil string, misal "16200000.00" atau "123456.70"
const splitValue = fixed.split(".");
const val = splitValue[0]; // bagian ribuan
const decimal = splitValue[1]; // bagian desimal
const formatted = val.replace(/\B(?=(\d{3})+(?!\d))/g, ".");
return `${formatted},${decimal}`;
},
pilihItemRO() {
let temp = this.form_receive_item
if (temp.length > 0) {
this.$store.commit("form/update_select_item_temp", temp);
}
this.$store.dispatch("form/getPurchaseOrder");
this.$store.commit("form/update_dialog_select_item", true);
},
editBatch(props) {
const curr_item = JSON.parse(JSON.stringify(props.item));
if (!curr_item.batchlist || curr_item.batchlist.length <= 0) {
let val = [
{
qty: 0,
batchno: '',
expiredate: moment(new Date()).format('YYYY-MM-DD'),
menuDate: false
}
];
this.$store.commit("form/update_item_batch_temp", val)
}
this.$store.commit("form/update_selected_item_forbatch", curr_item);
this.$store.commit("form/update_dialog_batch_item", true);
},
removeItem(props) {
let temp = JSON.parse(JSON.stringify(this.form_receive_item));
let newt = temp.filter((item) => item.PoItemReceiveID !== props.item.PoItemReceiveID);
let shipInfo = [];
newt.forEach(element => {
let ship = {
num_po: element.PurchaseOrderNumber,
cost: element.PurchaseOrderShippingCost,
isUpfront: element.PurchaseOrderShippingCostStatus
}
const isExist = this.shipping_info.some(
item => item.num_po == element.PurchaseOrderNumber
);
if (!isExist) {
shipInfo.push(ship);
}
});
this.form_receive_item = newt;
this.$store.commit("form/update_shipping_info", shipInfo);
},
inspekItem(props) {
const curr_item = JSON.parse(JSON.stringify(props.item));
this.$store.commit("form/update_selected_item_received", curr_item);
let inspeksi = this.$store.state.form.form_inspeksi
if (curr_item.inspeksi_item) {
inspeksi = curr_item.inspeksi_item
} else {
inspeksi.qty_po = curr_item.originalQty
inspeksi.qty_ro = curr_item.qty
inspeksi.price_po = curr_item.PoItemReceivePrice
inspeksi.price_ro = curr_item.PoItemReceivePrice
}
this.$store.dispatch("ro/getListStaff");
this.$store.commit("form/update_form_inspeksi", inspeksi);
this.$store.commit("form/update_dialog_form_inspeksi", true);
},
batalRO() {
this.$store.dispatch("form/resetForm");
this.$refs.formro.resetValidation()
this.error_num_do = false
this.error_supplier = false
this.error_warehouse = false
this.dialog_form_receive_item = false;
},
simpanRO() {
if (this.$refs.formro.validate()) {
const form_detail = JSON.parse(JSON.stringify(this.form_receive_item));
let empty = this.checkRODetail(form_detail);
if (empty.length == 0) {
for (const element of form_detail) {
let total = element.batchlist.reduce((sum, item) => sum + Number(item.qty), 0);
if (total != Number(element.qty)) {
this.$store.commit("ro/update_snackbar", {
color: 'warning',
msg: `Jumlah item ${element.M_ItemDesc} tidak sama dengan pengaturan batch`,
isOpen: true
}, {root: true});
return;
}
if (!element.inspeksi_item) {
this.$store.commit("ro/update_snackbar", {
color: 'warning',
msg: `Form inspeksi item ${element.M_ItemDesc} belum di-isi`,
isOpen: true
}, {root: true});
return;
}
}
this.$store.dispatch("form/saveRO");
this.$refs.formro.resetValidation();
} else {
const message = empty.map(item => item.M_ItemDesc).join(', ')
this.$store.commit("ro/update_snackbar", {
color: 'warning',
msg: 'Batch item berikut masih belum terisi ' + message,
isOpen: true
}, {root: true});
return;
}
}
},
checkRODetail(data) {
const emptyBatch = data.filter(element => {
return Array.isArray(element.batchlist) && element.batchlist.length === 0;
})
return emptyBatch
}
},
watch: {
dialog_form_receive_item(val) {
if (val) {
this.$nextTick(() => {
this.$refs.formro?.resetValidation();
});
}
}
},
}
</script>

View File

@@ -0,0 +1,376 @@
<template>
<v-dialog v-model="dialog_form_receive_item_edit" width="80vw" persistent>
<v-card>
<v-card-title class="headline grey lighten-2" primary-title>
EDIT RECEIVE ITEM
</v-card-title>
<v-card-text>
<v-layout row>
<v-flex xs4 pr-1>
<v-menu
v-model="menuReceiveDateForm" lazy offset-y max-width="290px"
full-width transition="scale-transition" min-width="290px"
:nudge-right="40" :close-on-content-click="false"
>
<template v-slot:activator="{ on }">
<v-text-field
:value="receiveDateForm" label="Tanggal"
outline hide-details v-on="on" readonly
></v-text-field>
</template>
<v-date-picker
v-model="form_receive.receive_date" no-title
@input="menuReceiveDateForm = false"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs4 px-1>
<v-autocomplete
v-model="form_receive.supplier" hide-details
:items="list_supplier" return-object outline
item-text="SupplierName" label="Supplier"
></v-autocomplete>
</v-flex>
<v-flex xs4 pl-1>
<v-text-field
label="Nomor Delivery Order (DO)" outline
v-model="form_receive.number_do" hide-details
></v-text-field>
</v-flex>
</v-layout>
<v-layout row mt-2>
<v-flex xs4 pr-1>
<v-text-field
label="Referensi" outline hide-details
v-model="form_receive.referensi"
></v-text-field>
</v-flex>
<v-flex xs4 px-1>
<v-autocomplete
v-model="form_receive.warehouse" hide-details
:items="list_warehouse" outline return-object
item-text="WarehouseName" label="Gudang"
></v-autocomplete>
</v-flex>
<v-flex xs4 pl-1>
<v-text-field
label="Biaya Ekspedisi" outline prefix="Rp. "
v-model="form_receive.shipping_cost" hide-details
></v-text-field>
</v-flex>
</v-layout>
<v-layout row mt-2 wrap>
<v-flex xs12>
<v-textarea
v-model="form_receive.note" hide-details
auto-grow rows="1" label="Catatan" outline
></v-textarea>
</v-flex>
<v-flex xs3>
<v-btn
block color="info" class="mt-2" @click="pilihItemRO()"
:disabled="checkObjectEmpty(form_receive.supplier) || checkObjectEmpty(form_receive.warehouse)"
>TAMBAH ITEM</v-btn>
</v-flex>
</v-layout>
<v-layout row mt-2 wrap>
<v-flex v-for="shp in shipping_info" :key="shp.num_po" xs3>
<v-card class="pa-2">
<div>
<span class="font-weight-bold">{{ shp.num_po }}</span><br/>
<span>Rp. {{ oneMoney(shp.cost) }}</span><br/>
<span v-if="shp.isUpfront === 'Y'" class="green--text">
Biaya Ekspedisi sudah dibayar
</span>
<span v-else class="red--text">
Biaya Ekspedisi belum dibayar
</span>
</div>
</v-card>
</v-flex>
</v-layout>
<v-layout row mt-4 wrap>
<v-flex xs12>
<v-data-table
v-if="form_receive_item.length > 0"
:headers = "headers" :items="form_receive_item"
hide-actions item-key="keyID" class="elevation-1"
>
<template v-slot:items="props">
<tr>
<td class="text-xs-left">{{ props.item.PurchaseOrderNumber }}</td>
<td class="text-xs-left">
<p class="p-0 mb-0">{{ props.item.M_ItemCode }}</p>
<p class="p-0 mb-0">{{ props.item.M_ItemDesc }}</p>
<p class="p-0 mb-0">{{ props.item.WarehouseName }}</p>
</td>
<td class="text-xs-center">{{ props.item.qty }} {{ props.item.ItemUnitName }}</td>
<td class="text-xs-left">
<div v-if="props.item.M_ItemItem_CategoryID == 1">
<p class="mb-0 pb-0" v-for="batch in props.item.batchlist">
No. Batch: {{ batch.batchno || '' }},
Exp. Date: {{ batch.expiredate || ''}},
Qty: {{ batch.qty || ''}}
</p>
</div>
</td>
<td class="text-xs-center">
<div v-if="props.item.inspeksi_item">
<p v-if="props.item.inspeksi_item.summary == 'accept'">
Diterima
</p>
<p v-else-if="props.item.inspeksi_item.summary == 'reject'"
class="mb-0 pb-0"
>
Ditolak <br>
{{ props.item.inspeksi_item.catatan }}
</p>
<p v-else class="mb-0 pb-0">
Diterima dengan Catatan <br>
{{ props.item.inspeksi_item.catatan }}
</p>
</div>
</td>
<td class="text-xs-center">
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
style="min-width: 30px; height: 30px; margin: 0;" outline
small @click="inspekItem(props)" color="green lighten-2"
>
<v-icon small color="green" v-on="on">note_add</v-icon>
</v-btn>
</template>
<span>Inspek Item</span>
</v-tooltip>
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
style="min-width: 30px; height: 30px; margin: 0;" outline
small @click="editBatch(props)" color="blue lighten-2"
>
<v-icon small color="blue" v-on="on">edit</v-icon>
</v-btn>
</template>
<span>Edit</span>
</v-tooltip>
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
style="min-width: 30px; height: 30px; margin: 0;" outline
small @click="removeItem(props)" color="red lighten-2"
>
<v-icon small color="red" v-on="on">delete</v-icon>
</v-btn>
</template>
<span>Hapus</span>
</v-tooltip>
</td>
</tr>
</template>
</v-data-table>
</v-flex>
</v-layout>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn color="red" outline flat @click="batalRO()">Batal</v-btn>
<v-btn color="green" outline flat @click="simpanEditRO()">Simpan</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<script>
module.exports = {
components: {},
data() {
return {
menuReceiveDateForm: false,
headers: [
{
text: "PO NUMBER", align: "center", sortable: false, value: "ItemUnitName",
width: "18%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "ITEM", align: "center", sortable: false, value: "M_ItemDesc",
width: "25%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "QTY", align: "center", sortable: false, value: "qty",
width: "10%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "No. Batch & Exp.Date", align: "center", sortable: false, value: "qty",
width: "22%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "INSPEKSI", align: "center", sortable: false, value: "inspeksi",
width: "10%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "AKSI", align: "center", sortable: false, value: "qty",
width: "15%", class: "pa-2 blue lighten-3 white--text",
},
]
}
},
computed: {
dialog_form_receive_item_edit: {
get() {
return this.$store.state.form.dialog_form_receive_item_edit
},
set(val) {
this.$store.commit("form/update_dialog_form_receive_item_edit", val);
}
},
form_receive: {
get() {
return this.$store.state.form.form_receive;
},
set(val) {
this.$store.commit("form/update_form_receive", val)
}
},
form_receive_item: {
get() {
return this.$store.state.form.form_receive_item;
},
set(val) {
this.$store.commit("form/update_form_receive_item", val)
}
},
form_receive_item_del: {
get() {
return this.$store.state.form.form_receive_item_del
},
set(val) {
this.$store.commit("form/update_form_receive_item_del", val)
}
},
receiveDateForm() {
return this.formatDate(this.form_receive.receive_date)
},
list_supplier() {
return this.$store.state.ro.list_supplier
},
list_warehouse() {
return this.$store.state.ro.list_warehouse
},
shipping_info() {
return this.$store.state.form.shipping_info
}
},
methods: {
checkObjectEmpty(obj) {
if (obj === null || obj === undefined || typeof obj !== "object") {
return true;
}
return Object.keys(obj).length === 0 && obj.constructor === Object;
},
formatDate(date) {
if (!date) return null;
const [year, month, day] = date.split("-");
return `${day}-${month}-${year}`;
},
oneMoney(value) {
if (typeof value !== 'number') {
value = parseFloat(value);
}
if (isNaN(value)) return '0,00';
const fixed = value.toFixed(2);
const splitValue = fixed.split(".");
const val = splitValue[0];
const decimal = splitValue[1];
const formatted = val.replace(/\B(?=(\d{3})+(?!\d))/g, ".");
return `${formatted},${decimal}`
},
batalRO() {
this.$store.dispatch("form/resetForm");
this.form_receive_item_del = [];
this.dialog_form_receive_item_edit = false
},
simpanEditRO() {
this.$store.dispatch("form/saveEditRO")
},
pilihItemRO() {
let temp = JSON.parse(JSON.stringify(this.form_receive_item));
if (temp.length > 0) {
this.$store.commit("form/update_select_item_temp", temp);
}
this.$store.dispatch("form/getPurchaseOrder");
this.$store.commit("form/update_dialog_select_item", true);
},
inspekItem(props) {
const curr_item = JSON.parse(JSON.stringify(props.item));
this.$store.commit("form/update_selected_item_received", curr_item);
let inspeksi = this.$store.state.form.form_inspeksi
if (curr_item.inspeksi_item) {
inspeksi = curr_item.inspeksi_item
} else {
inspeksi.qty_po = curr_item.originalQty
inspeksi.qty_ro = curr_item.qty
inspeksi.price_po = curr_item.PoItemReceivePrice
inspeksi.price_ro = curr_item.PoItemReceivePrice
}
this.$store.dispatch("ro/getListStaff");
this.$store.commit("form/update_form_inspeksi", inspeksi);
this.$store.commit("form/update_dialog_form_inspeksi", true);
},
removeItem(props) {
let temp = JSON.parse(JSON.stringify(this.form_receive_item));
let newt = temp.filter((item) => item.PoItemReceiveID !== props.item.PoItemReceiveID);
let del = temp.find((item) => item.PoItemReceiveID === props.item.PoItemReceiveID);
let shipInfo = [];
newt.forEach(element => {
let ship = {
num_po: element.PurchaseOrderNumber,
cost: element.PurchaseOrderShippingCost,
isUpfront: element.PurchaseOrderShippingCostStatus
};
const isExist = this.shipping_info.some(
item => item.num_po == element.PurchaseOrderNumber
);
if (!isExist) {
shipInfo.push(ship)
}
});
this.form_receive_item_del.push(del);
this.form_receive_item = newt;
this.$store.commit("form/update_shipping_info", shipInfo);
},
editBatch(props) {
const curr_item = JSON.parse(JSON.stringify(props.item));
if (!curr_item.batchlist || curr_item.batchlist.length <= 0) {
let val = [
{
qty: 0,
batchno: '',
expiredate: moment(new Date()).format('YYYY-MM-DD'),
menuDate: false
}
];
this.$store.commit("form/update_item_batch_temp", val)
}
this.$store.commit("form/update_selected_item_forbatch", curr_item);
this.$store.commit("form/update_dialog_batch_item", true);
}
},
}
</script>

View File

@@ -0,0 +1,307 @@
<template>
<div style="width: 100%;">
<v-toolbar dark color="primary">
<v-toolbar-title class="white--text">RECEIVE ITEM</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn flat icon color="white" @click="openDialogReceiveItem()">
<v-icon>add_box</v-icon>
</v-btn>
</v-toolbar>
<!-- Filter Listing -->
<v-card class="pa-2">
<v-layout row wrap>
<v-flex xs4>
<v-menu
v-model="menuStartDateFilter" lazy offset-y
transition="scale-transition" max-width="290px"
min-width="290px" :nudge-right="40"
:close-on-content-click="false"
>
<template v-slot:activator="{ on }">
<v-text-field
:value="startDateFilter" label="Tanggal Mulai"
hide-details readonly outline v-on="on" class="mr-2"
></v-text-field>
</template>
<v-date-picker
no-title hide-details v-model="filter.startdate"
@input="menuStartDateFilter = false"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs4>
<v-menu
v-model="menuEndDateFilter" lazy offset-y
transition="scale-transition" max-width="290px"
min-width="290px" :nudge-right="40"
:close-on-content-click="false"
>
<template v-slot:activator="{ on }">
<v-text-field
:value="endDateFilter" label="Tanggal Akhir"
hide-details readonly outline v-on="on" class="mr-2"
></v-text-field>
</template>
<v-date-picker
no-title hide-details v-model="filter.enddate"
@input="menuEndDateFilter = false"
></v-date-picker>
</v-menu>
</v-flex>
<v-flex xs4>
<v-text-field
label="Cari nomor GR, nomor DO" v-model="filter.search" hide-details outline
></v-text-field>
</v-flex>
</v-layout>
</v-card>
<!-- Table Listing -->
<v-card class="pa-2 mt-2">
<div style="overflow-y: scroll;">
<v-data-table
:items="list_data_ro.records" :headers="headers" :loading="false"
hide-actions class="elevation-1"
>
<template v-slot:items="props">
<tr>
<td class="text-xs-center">{{ props.item.ReceiveOrderPoNumber }}</td>
<td class="text-xs-center"> {{ props.item.ReceiveOrderPoIDate }} </td>
<td class="text-xs-center">{{ props.item.ReceiveOrderPoDONumber }}</td>
<td class="text-xs-center">{{ props.item.SupplierName }}</td>
<td class="text-xs-center">{{ props.item.WarehouseName }}</td>
<td class="text-xs-center">{{ props.item.ReceiveOrderPoNote }}</td>
<td class="text-xs-center">
<div v-if="props.item.ReceiveOrderPoConfirmed === 'Y'">
<v-chip color="green" text-color="white">
KONFIRMASI
</v-chip>
<kbd>{{ props.item.ReceiveOrderPoConfirmedDate }}</kbd>
</div>
<v-chip v-else color="red" text-color="white">
BELUM KONFIRMASI
</v-chip>
</td>
<td class="text-xs-center">
<div v-show="props.item.ReceiveOrderPoConfirmed === 'N'">
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
style="min-width: 30px; height: 30px; margin: 0;" outline
small @click="konfirmRO(props.item)" color="green lighten-2"
>
<v-icon small color="green" v-on="on">done_all</v-icon>
</v-btn>
</template>
<span>konfirmasi</span>
</v-tooltip>
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
style="min-width: 30px; height: 30px; margin: 0;" outline
small @click="editRO(props.item)" color="blue lighten-2"
>
<v-icon small color="blue" v-on="on">edit</v-icon>
</v-btn>
</template>
<span>Edit</span>
</v-tooltip>
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
style="min-width: 30px; height: 30px; margin: 0;" outline
small @click="deleteRO(props.item)" color="red lighten-2"
>
<v-icon small color="red" v-on="on">delete</v-icon>
</v-btn>
</template>
<span>Hapus</span>
</v-tooltip>
</div>
<div v-show="props.item.ReceiveOrderPoConfirmed === 'Y'">
<v-tooltip bottom>
<template v-slot:activator="{ on }">
<v-btn
style="min-width: 30px; height: 30px; margin: 0;" outline
small @click="detailView(props.item)" color="blue lighten-2"
>
<v-icon small color="blue" v-on="on">visibility</v-icon>
</v-btn>
</template>
<span>Lihat detail</span>
</v-tooltip>
</div>
</td>
</tr>
</template>
</v-data-table>
</div>
<v-divider></v-divider>
<div class="text-xs-center mt-2">
<v-pagination v-model="curr_page" :length="list_data_ro.total"></v-pagination>
</div>
</v-card>
<!-- dialog -->
<one-dialog-form-inspeksi></one-dialog-form-inspeksi>
<one-dialog-form-receive></one-dialog-form-receive>
<one-dialog-form-receive-edit></one-dialog-form-receive-edit>
<one-dialog-item-receive></one-dialog-item-receive>
<one-dialog-item-batch></one-dialog-item-batch>
<one-dialog-ro-layout></one-dialog-ro-layout>
<one-dialog-ro-view></one-dialog-ro-view>
<!-- snackbar -->
<v-snackbar
:color="snackbar.color" v-model="snackbar.isOpen"
:timeout="3000" multi-line top
>
{{ snackbar.msg }}
<v-btn class="ml-2" flat @click="snackbar.isOpen = false">Tutup</v-btn>
</v-snackbar>
</div>
</template>
<script>
module.exports = {
components: {
'one-dialog-item-receive': httpVueLoader('./dialogSelectItem.vue'),
'one-dialog-form-receive': httpVueLoader('./formReceiveItem.vue'),
'one-dialog-form-receive-edit': httpVueLoader('./formReceiveItemEdit.vue'),
'one-dialog-form-inspeksi': httpVueLoader('./formInspection.vue'),
'one-dialog-item-batch': httpVueLoader('./dialogBatchItem.vue'),
'one-dialog-ro-layout': httpVueLoader('./dialogRoLayout.vue'),
'one-dialog-ro-view': httpVueLoader('./dialogViewRO.vue'),
},
mounted() {
this.$store.dispatch("ro/search")
},
data() {
return {
menuStartDateFilter: false,
menuEndDateFilter: false,
headers: [
{
text: "GR NUMBER", align: "center", sortable: false, value: "grnumber",
width: "10%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "DATE", align: "center", sortable: false, value: "date",
width: "10%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "DO NUMBER", align: "center", sortable: false, value: "do",
width: "10%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "SUPPLIER", align: "center", sortable: false, value: "supplier",
width: "20%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "WAREHOUSE", align: "center", sortable: false, value: "wh",
width: "15%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "CATATAN", align: "center", sortable: false, value: "note",
width: "15%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "STATUS", align: "center", sortable: false, value: "status",
width: "10%", class: "pa-2 blue lighten-3 white--text",
},
{
text: "AKSI", align: "center", sortable: false, value: "act",
width: "10%", class: "pa-2 text-center blue lighten-3 white--text",
},
]
}
},
computed: {
filter: {
get() {
return this.$store.state.ro.filter;
},
set(val) {
this.$store.commit("ro/update_filter", val);
}
},
snackbar: {
get() {
return this.$store.state.ro.snackbar;
},
set(val) {
this.$store.commit("ro/update_snackbar", val);
}
},
startDateFilter() {
return this.formatDate(this.filter.startdate);
},
endDateFilter() {
return this.formatDate(this.filter.enddate);
},
curr_page: {
get() {
return this.$store.state.ro.curr_page;
},
set(val) {
this.$store.commit("ro/update_curr_page", val);
this.$store.dispatch("ro/search");
}
},
list_data_ro() {
return this.$store.state.ro.list_data_ro;
},
dialog_form_receive_item: {
get() {
return this.$store.state.form.dialog_form_receive_item;
},
set(val) {
this.$store.commit("form/update_dialog_form_receive_item", val);
}
}
},
methods: {
formatDate(date) {
if (!date) return null;
const [year, month, day] = date.split("-");
return `${day}-${month}-${year}`;
},
openDialogReceiveItem() {
this.$store.dispatch("ro/getSupplier");
this.$store.dispatch("ro/getWarehouse");
this.dialog_form_receive_item = true;
},
konfirmRO(data) {
this.$store.commit("ro/update_selected_ro", data);
this.$store.commit("ro/update_dialog_confirmation", true);
},
deleteRO(data) {
this.$store.commit("ro/update_selected_ro", data);
this.$store.commit("ro/update_dialog_delete", true);
},
detailView(data) {
this.$store.commit("ro/update_selected_ro", data);
this.$store.dispatch("ro/getSupplier");
this.$store.dispatch("ro/getWarehouse");
this.$store.dispatch("ro/getItemUpdate");
this.$store.commit("ro/update_dialog_detail_view", true);
},
editRO(data) {
this.$store.commit("ro/update_selected_ro", data);
this.$store.dispatch("ro/getSupplier");
this.$store.dispatch("ro/getWarehouse");
this.$store.dispatch("ro/getItemUpdate");
this.$store.commit("form/update_dialog_form_receive_item_edit", true);
}
},
watch: {
filter: {
handler(newVal, oldVal) {
this.$store.dispatch("ro/search")
},
deep: true
}
},
}
</script>

View File

@@ -0,0 +1,104 @@
<!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>ACCONE | Receive Item PO</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">
</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="px-1 py-2">
<v-layout row wrap>
<one-ro-layout></one-ro-layout>
</v-layout>
</v-container>
</v-content>
</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>
<script src="../../../libs/vendor/sheetjs-master/xlsx.full.min.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;
var ts = "?ts=" + Date.now();
new Vue({
store,
el: "#app",
methods: {
tab_selected: function(tab) {
return this.$store.state.tab_selected == tab
}
},
mounted: function() {
var url_string = window.location.href
var url = new URL(url_string);
var code = url.searchParams.get("code");
if (code != null) {
this.$store.commit('order/update_setupcode', code)
this.$store.commit("patient/update_patients", [])
this.$store.commit("patient/update_total_patients", 0)
this.$store.commit("patient/update_current_page", 1)
this.$store.dispatch("patient/generatesetup", {
setupcode: code
})
}
if (!one_token())
location.replace('/one-ui/test/vuex/one-login')
},
components: {
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
'one-ro-layout': httpVueLoader('./components/oneRoLayout.vue')
}
})
</script>
<style>
[v-cloak] {
display: none
}
.left {}
.right {}
</style>
</body>
</html>

View File

@@ -0,0 +1,352 @@
import * as api from "../api/api.js"
export default {
namespaced: true,
state: {
dialog_form_receive_item: false,
dialog_form_receive_item_edit: false,
dialog_select_item: false,
dialog_batch_item: false,
form_receive: {
receive_date: moment(new Date()).format('YYYY-MM-DD'),
number_do: '',
referensi: '',
supplier: {},
warehouse: {},
shipping_cost: 0,
note: ''
},
form_receive_item: [],
select_item_temp: [],
form_receive_item_del: [],
selected_po: {},
list_po: [],
list_item_po: [],
shipping_info: [],
selected_item_forbatch: {},
item_batch_temp: [],
dialog_form_inspeksi: false,
selected_item_received: {},
form_inspeksi: {
qty_po: 0,
qty_ro: 0,
price_po: 0.00,
price_ro: 0.00,
date_po: moment(new Date()).format('YYYY-MM-DD'),
date_ro: moment(new Date()).format('YYYY-MM-DD'),
expire_date: moment(new Date()).format('YYYY-MM-DD'),
condt_kemasan: '',
catatan_kemasan: '',
condt_pengiriman: '',
catatan_kirim: '',
summary: '',
catatan: '',
pemeriksa: '',
pengirim: ''
}
},
mutations: {
update_dialog_form_receive_item(state, data) {
state.dialog_form_receive_item = data
},
update_dialog_form_receive_item_edit(state, data) {
state.dialog_form_receive_item_edit = data
},
update_dialog_select_item(state, data) {
state.dialog_select_item = data
},
update_dialog_batch_item(state, data) {
state.dialog_batch_item = data
},
update_form_receive(state, val) {
state.form_receive = val
},
update_form_receive_item(state, val) {
state.form_receive_item = val
},
update_form_receive_item_del(state, val) {
state.form_receive_item_del = val
},
update_select_item_temp(state, val) {
state.select_item_temp = val
},
update_selected_po(state, val) {
state.selected_po = val
},
update_list_po(state, val) {
state.list_po = val
},
update_list_item_po(state, val) {
state.list_item_po = val
},
update_shipping_info(state, val) {
state.shipping_info = val
},
update_selected_item_forbatch(state, val) {
state.selected_item_forbatch = val
},
update_item_batch_temp(state, val) {
state.item_batch_temp = val
},
update_dialog_form_inspeksi(state, val) {
state.dialog_form_inspeksi = val
},
update_form_inspeksi(state, val) {
state.form_inspeksi = val
},
update_selected_item_received(state, val) {
state.selected_item_received = val
}
},
actions: {
resetForm(context) {
const form_receive = {
receive_date: moment(new Date()).format('YYYY-MM-DD'),
number_do: '',
referensi: '',
supplier: {},
warehouse: {},
shipping_cost: 0,
note: ''
}
context.state.form_receive = form_receive
context.state.form_receive_item = []
context.state.shipping_info = []
},
async getPurchaseOrder(context) {
try {
let param = {
token: one_token(),
SupplierID: context.state.form_receive.supplier.SupplierID,
search: '',
localPO_deleted: context.state.form_receive_item_del.map(item => item.PoItemReceiveID)
}
const resp = await api.getPurchaseOrder(param);
if (resp.status != 'OK') {
context.commit("ro/update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
}, {root: true});
} else {
context.commit("update_list_po", resp.data);
}
} catch (error) {
context.commit("ro/update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
}, {root: true});
}
},
async getItem(context) {
try {
let param = {
token: one_token(),
POID: context.state.selected_po.PurchaseOrderID,
WarehouseID: context.state.form_receive.warehouse.WarehouseID
}
const resp = await api.getItem(param);
if (resp.status != 'OK') {
context.commit("ro/update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
}, {root: true});
} else {
context.commit("update_list_item_po", resp.data);
}
} catch (error) {
context.commit("ro/update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
}, {root: true});
}
},
async saveRO(context) {
try {
const cekShipping = context.state.shipping_info.some(item => item.isUpfront === 'N');
let param = {
token: one_token(),
date: context.state.form_receive.receive_date,
supplierID: context.state.form_receive.supplier.SupplierID,
warehouseID: context.state.form_receive.warehouse.WarehouseID,
shippingCost: context.state.form_receive.shipping_cost,
shippingIsPaid: cekShipping ? 'N' : 'Y',
note: context.state.form_receive.note,
refNumber: context.state.form_receive.referensi,
DONumber: context.state.form_receive.number_do,
detail: context.state.form_receive_item
}
const resp = await api.saveRO(param);
if (resp.status != 'OK') {
context.commit("ro/update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
}, {root: true});
} else {
context.dispatch("ro/search", {}, {root: true});
context.dispatch("resetForm");
context.commit("ro/update_snackbar", {
color: 'success',
msg: resp.data,
isOpen: true
}, {root: true});
context.commit("update_dialog_form_receive_item", false);
}
} catch (error) {
context.commit("ro/update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
}, {root: true});
}
},
async saveDataInspeksi(context) {
try {
let param = {
token: one_token(),
ROdetailID: 0,
form_inspeksi: context.state.form_inspeksi
}
const resp = await api.saveInspeksi(param)
if (resp.status != 'OK') {
context.commit("ro/update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
}, {root: true});
} else {
context.commit("ro/update_snackbar", {
color: 'success',
msg: resp.data,
isOpen: true
}, {root: true});
context.commit("update_dialog_form_receive_item", false);
}
} catch (error) {
context.commit("ro/update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
}, {root: true});
}
},
async getDataItemInspeksi(context) {
try {
let param = {
token: one_token(),
ROdetailID: 0,
}
const resp = await api.getItemDataInspeksi(param)
if (resp.status != 'OK') {
context.commit("ro/update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
}, {root: true});
} else {
}
} catch (error) {
context.commit("ro/update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
}, {root: true});
}
},
async confirmRO(context) {
try {
let param = {
token: one_token(),
ROID: context.rootState.ro.selected_ro.ReceiveOrderPoID
}
const resp = await api.confirmRO(param)
if (resp.status != 'OK') {
context.commit("ro/update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
}, {root: true});
} else {
context.dispatch("ro/search", {}, {root: true});
context.dispatch("resetForm");
context.commit("ro/update_snackbar", {
color: 'success',
msg: resp.data,
isOpen: true
}, {root: true});
context.commit("ro/update_dialog_confirmation", false, {root: true});
}
} catch (error) {
context.commit("ro/update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
}, {root: true});
}
},
async saveEditRO(context) {
try {
const cekShipping = context.state.shipping_info.some(item => item.isUpfront === 'N');
let param = {
token: one_token(),
ReceiveOrderID: context.rootState.ro.selected_ro.ReceiveOrderPoID,
numGR: context.rootState.ro.selected_ro.ReceiveOrderPoNumber,
date: context.state.form_receive.receive_date,
supplierID: context.state.form_receive.supplier.SupplierID,
warehouseID: context.state.form_receive.warehouse.WarehouseID,
shippingCost: context.state.form_receive.shipping_cost,
shippingIsPaid: cekShipping ? 'N' : 'Y',
note: context.state.form_receive.note,
refNumber: context.state.form_receive.referensi,
DONumber: context.state.form_receive.number_do,
detail: context.state.form_receive_item
}
const resp = await api.saveEditRO(param)
if (resp.status != 'OK') {
context.commit("ro/update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
}, {root: true});
} else {
context.dispatch("ro/search", {}, {root: true});
context.dispatch("resetForm");
context.commit("ro/update_snackbar", {
color: 'success',
msg: resp.data,
isOpen: true
}, {root: true});
context.commit("update_dialog_form_receive_item_edit", false);
}
} catch (error) {
context.commit("ro/update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
}, {root: true});
}
}
}
}

View File

@@ -0,0 +1,252 @@
import * as api from "../api/api.js"
export default {
namespaced: true,
state: {
dialog_confirmation: false,
dialog_delete: false,
dialog_detail_view: false,
snackbar: {
color: 'success',
msg: '',
isOpen: false
},
filter: {
startdate: moment(new Date()).format('YYYY-MM-DD'),
enddate: moment(new Date()).format('YYYY-MM-DD'),
search: ''
},
curr_page: 1,
list_data_ro: {
records: [],
total: 1
},
list_supplier: [],
list_warehouse: [],
selected_ro: {},
list_staff: []
},
mutations: {
update_dialog_confirmation(state, data) {
state.dialog_confirmation = data
},
update_dialog_delete(state, data) {
state.dialog_delete = data
},
update_dialog_detail_view(state, data) {
state.dialog_detail_view = data
},
update_snackbar(state, data) {
state.snackbar = data
},
update_filter(state, data) {
state.filter = data
},
update_curr_page(state, data) {
state.curr_page = data
},
update_list_data_ro(state, data) {
state.list_data_ro = data
},
update_list_supplier(state, val) {
state.list_supplier = val
},
update_list_warehouse(state, val) {
state.list_warehouse = val
},
update_selected_ro(state, val) {
state.selected_ro = val
},
update_list_staff(state, val) {
state.list_staff = val
}
},
actions: {
async search(context) {
try {
let param = {
token: one_token(),
page: context.state.curr_page,
...context.state.filter
}
console.log("search OR");
let resp = await api.search(param);
if (resp.status != 'OK') {
context.commit("update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
});
} else {
context.commit("update_list_data_ro", resp.data);
}
} catch (error) {
context.commit("update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
});
}
},
async getSupplier(context) {
try {
let param = {
token: one_token(),
search: ''
}
const resp = await api.getSupplier(param);
if (resp.status != 'OK') {
context.commit("update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
});
} else {
context.commit("update_list_supplier", resp.data);
}
} catch (error) {
context.commit("update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
});
}
},
async getWarehouse(context) {
try {
let param = {
token: one_token()
}
const resp = await api.getWarehouse(param);
if (resp.status != 'OK') {
context.commit("update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
});
} else {
context.commit("update_list_warehouse", resp.data);
}
} catch (error) {
context.commit("update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
});
}
},
async getItemUpdate(context) {
try {
let param = {
token: one_token(),
ROID: context.state.selected_ro.ReceiveOrderPoID
}
const resp = await api.getItemUpdate(param);
if (resp.status != 'OK') {
context.commit("update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
});
} else {
let temp_ship = []
resp.data.forEach(element => {
let ship = {
num_po: element.PurchaseOrderNumber,
cost: element.PurchaseOrderShippingCost,
isUpfront: element.PurchaseOrderShippingCostStatus
}
const isExist = context.rootState.form.shipping_info.some(
item => item.num_po == element.PurchaseOrderNumber
);
if (!isExist) {
temp_ship.push(ship);
}
});
let form = {
receive_date: context.state.selected_ro.ReceiveOrderPoIDate,
number_do: context.state.selected_ro.ReceiveOrderPoDONumber,
referensi: context.state.selected_ro.ReceiveOrderPoRefNumber,
supplier: {
SupplierID: context.state.selected_ro.SupplierID,
SupplierName: context.state.selected_ro.SupplierName
},
warehouse: {
WarehouseID: context.state.selected_ro.WarehouseID,
WarehouseName: context.state.selected_ro.WarehouseName,
WarehouseCode: context.state.selected_ro.WarehouseCode
},
shipping_cost: context.state.selected_ro.ReceiveOrderShippingCostAmount,
note: context.state.selected_ro.ReceiveOrderPoNote
}
context.commit("form/update_form_receive", form, {root: true});
context.commit("form/update_shipping_info", temp_ship, {root: true});
context.commit("form/update_form_receive_item", resp.data, {root: true});
}
} catch (error) {
context.commit("update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
});
}
},
async deleteRO(context) {
try {
let param = {
token: one_token(),
ROID: context.state.selected_ro.ReceiveOrderPoID
}
const resp = await api.deleteRO(param);
if (resp.status != 'OK') {
context.commit("update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
});
} else {
context.commit("update_selected_ro", {});
context.dispatch("search", {});
context.commit("update_snackbar", {
color: 'success',
msg: resp.data,
isOpen: true
});
context.commit("update_dialog_delete", false);
}
} catch (error) {
context.commit("update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
});
}
},
async getListStaff(context) {
try {
let resp = await api.getListStaff({token: one_token()})
if (resp.status != 'OK') {
context.commit("update_snackbar", {
color: 'error',
msg: resp.message,
isOpen: true
});
} else {
context.commit("update_list_staff", resp.data)
}
} catch (error) {
context.commit("update_snackbar", {
color: 'error',
msg: error.message,
isOpen: true
});
}
}
}
}

View File

@@ -0,0 +1,23 @@
import system from "../../../apps/modules/system/system.js";
import form from "./modules/form.js";
import ro from "./modules/ro.js";
export const store = new Vuex.Store({
modules: {
system: system,
ro: ro,
form: form
},
state: {
tab_selected: 'pasien-dokter'
},
mutations: {
change_tab(state, ntab) {
state.tab_selected = ntab
}
},
actions: {
change_tab(context, ntab) {
context.commit('change_tab', ntab)
}
},
});