add modules folder based on s_menu
This commit is contained in:
@@ -0,0 +1,308 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- Dialog View -->
|
||||
<v-dialog v-model="dialogRiwayat" persistent width="85vw">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
RIWAYAT PURCHASE ORDER BY SUPPLIER
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
<v-layout row wrap class="px-2 py-2">
|
||||
<!-- TABEL ITEM VIEW -->
|
||||
<v-flex xs12>
|
||||
<v-data-table :headers="headers" :items="riwayatPoList" :loading="loading" hide-actions class="elevation-1">
|
||||
<template v-slot:items="props">
|
||||
<td class="text-xs-center">{{ formatDate(props.item.PurchaseOrderCreated) }}</td>
|
||||
<td class="text-xs-center">{{ props.item.SupplierName }}</td>
|
||||
<td class="text-xs-center">{{ props.item.PurchaseOrderNumber }}</td>
|
||||
<td class="text-xs-right">
|
||||
{{ props.item.PurchaseOrderGrandTotal != null ? oneMoney(props.item.PurchaseOrderGrandTotal) : '0' }}
|
||||
</td>
|
||||
|
||||
<td class="text-xs-center">
|
||||
<v-chip color="blue" v-if="props.item.PurchaseOrderStatus === 'Draft'" text-color="white">{{
|
||||
props.item.PurchaseOrderStatus }}
|
||||
</v-chip>
|
||||
<v-chip color="warning" v-else-if="props.item.PurchaseOrderStatus === 'Pending'" text-color="white">{{
|
||||
props.item.PurchaseOrderStatus }}
|
||||
</v-chip>
|
||||
<v-chip color="green" v-else-if="props.item.PurchaseOrderStatus === 'Approved'" text-color="white">{{
|
||||
props.item.PurchaseOrderStatus }}
|
||||
</v-chip>
|
||||
<v-chip color="red" v-else-if="props.item.PurchaseOrderStatus === 'Rejected'" text-color="white">{{
|
||||
props.item.PurchaseOrderStatus }}
|
||||
</v-chip>
|
||||
<v-chip color="primary" v-else-if="props.item.PurchaseOrderStatus === 'Completed'" text-color="white">{{
|
||||
props.item.PurchaseOrderStatus }}
|
||||
</v-chip>
|
||||
<v-chip v-else text-color="white">{{ props.item.PurchaseOrderStatus }}
|
||||
</v-chip>
|
||||
</td>
|
||||
<td class="text-xs-center">
|
||||
<v-tooltip bottom>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-btn icon :disabled="loading" @click="openDialogView(props.item)" v-on="on" class="mx-0 px-0">
|
||||
<v-icon color="blue">visibility</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<span>View Detail</span>
|
||||
</v-tooltip>
|
||||
</td>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
<v-pagination
|
||||
style="margin-top: 10px; margin-bottom: 10px;"
|
||||
v-model="currPageRiwayatPo"
|
||||
:length="riwayatPoPage"
|
||||
></v-pagination>
|
||||
</v-card-text>
|
||||
|
||||
<v-divider></v-divider>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="green" flat @click="dialogRiwayat = false">
|
||||
TUTUP
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data() {
|
||||
return {
|
||||
headers: [
|
||||
{
|
||||
text: "TANGGAL",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "date",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "SUPPLIER",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "supplier",
|
||||
width: "25%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "NO PO",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "PoQty",
|
||||
width: "25%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TOTAL",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "Total",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "STATUS",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "status",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "action",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
riwayatPoList() {
|
||||
return this.$store.state.po.riwayatPoList;
|
||||
},
|
||||
dialogRiwayat: {
|
||||
get() {
|
||||
return this.$store.state.po.dialogRiwayat;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_dialogRiwayat", val);
|
||||
},
|
||||
},
|
||||
selected_riwayatPo: {
|
||||
get() {
|
||||
return this.$store.state.po.selected_riwayatPo;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_selected_riwayatPo", val);
|
||||
},
|
||||
},
|
||||
loading: {
|
||||
get() {
|
||||
return this.$store.state.po.loading;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_loading", val);
|
||||
},
|
||||
},
|
||||
riwayatPoPage: {
|
||||
get() {
|
||||
return this.$store.state.po.riwayatPoPage;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_riwayatPoPage", val);
|
||||
},
|
||||
},
|
||||
currPageRiwayatPo: {
|
||||
get() {
|
||||
return this.$store.state.po.currPageRiwayatPo;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_currPageRiwayatPo", val);
|
||||
this.$store.dispatch("po/getPoBySupplier");
|
||||
},
|
||||
},
|
||||
selectedPO: {
|
||||
get() {
|
||||
return this.$store.state.po.selectedPO;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_selectedPO", val);
|
||||
},
|
||||
},
|
||||
dialogView: {
|
||||
get() {
|
||||
return this.$store.state.po.dialogView;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_dialogView", val);
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
openDialogView(data) {
|
||||
this.selectedPO = data;
|
||||
this.dialogView = true;
|
||||
this.dialogRiwayat = false;
|
||||
this.$store.dispatch("po/getItemUpdate");
|
||||
this.$store.commit("po/update_dialogForm", false);
|
||||
// this.$store.dispatch("po/resetForm");
|
||||
// this.$store.commit("update_selectedDateForm", moment(new Date()).format('YYYY-MM-DD'));
|
||||
// this.$store.commit("update_selectedWarehouse", {});
|
||||
// this.$store.commit("update_defaultWarehouse", {});
|
||||
// this.$store.commit("update_warehouseType", 'Single');
|
||||
// this.$store.commit("update_refNumber", '');
|
||||
// this.$store.commit("update_taxPpn", 0);
|
||||
// this.$store.commit("update_taxPph", 0);
|
||||
// this.$store.commit("update_paymentTerm", 0);
|
||||
// this.$store.commit("update_discountType", 'Percentage');
|
||||
// this.$store.commit("update_discountAmount", 0);
|
||||
// this.$store.commit("update_note", '');
|
||||
|
||||
// this.$store.commit("update_selectedItemTemp", []);
|
||||
// this.$store.commit("update_selectedItem", []);
|
||||
// this.$store.commit("update_deletedItem", []);
|
||||
// this.$store.commit("update_selectedItemCategory", {});
|
||||
// this.$store.commit("update_summary", []);
|
||||
|
||||
// this.$store.commit("update_shippingCost", 0);
|
||||
// this.$store.commit("update_shippingCostStatus", true);
|
||||
|
||||
// this.$store.commit("update_itemList", []);
|
||||
// this.$store.commit("update_searchItem", '');
|
||||
|
||||
// this.$store.commit("update_warehouseList", []);
|
||||
// this.$store.commit("update_searchSupplier", 'null');
|
||||
// this.$store.commit("update_supplierList", []);
|
||||
// this.$store.commit("update_summaryTotal", {
|
||||
// total: 0,
|
||||
// tax: 0,
|
||||
// ppn: 0,
|
||||
// pph: 0,
|
||||
// discount: 0,
|
||||
// finalTotal: 0,
|
||||
// });
|
||||
// this.$store.commit("update_itemTotal", {
|
||||
// total: 0,
|
||||
// tax: 0,
|
||||
// ppn: 0,
|
||||
// pph: 0,
|
||||
// discount: 0,
|
||||
// finalTotal: 0,
|
||||
// });
|
||||
},
|
||||
formatDate(date) {
|
||||
if (!date) return null;
|
||||
|
||||
// Pisahkan tanggal dan waktu
|
||||
const [datePart, timePart] = date.split(" ");
|
||||
|
||||
const [year, month, day] = datePart.split("-");
|
||||
let formatted = `${day}-${month}-${year}`;
|
||||
|
||||
if (timePart) {
|
||||
const [hour, minute, second] = timePart.split(":");
|
||||
formatted += ` ${hour}:${minute}:${second}`;
|
||||
}
|
||||
|
||||
return formatted;
|
||||
},
|
||||
oneMoney(value) {
|
||||
//return one_money(value);
|
||||
// let splitValue = value.toString().split(".");
|
||||
// if(splitValue.length > 1) {
|
||||
// let val = splitValue[0]
|
||||
// return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".") + "," + this.roundToThreeSignificantDigits(splitValue[1]);
|
||||
// } else {
|
||||
// return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||
// }
|
||||
// Ubah ke float jika belum angka
|
||||
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}`;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.label-value subheading mb-2 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-weight: bold;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-size: 1rem;
|
||||
}
|
||||
</style>
|
||||
593
test/vuex/acc-one-purchase-order-v2/components/dialogView.vue
Normal file
593
test/vuex/acc-one-purchase-order-v2/components/dialogView.vue
Normal file
@@ -0,0 +1,593 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- Dialog View -->
|
||||
<v-dialog v-model="dialogView" persistent width="85vw">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
DETAIL PURCHASE ORDER {{ selectedPO.PurchaseOrderNumber ?? "" }}
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
<v-layout row wrap class="px-2 py-2">
|
||||
<!-- HEADER PO VIEW -->
|
||||
<v-layout row wrap class="pa-0 ma-0">
|
||||
<!-- Tanggal -->
|
||||
<v-flex xs3>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="label">Nomor PO</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs9>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="value">: {{ selectedPO.PurchaseOrderNumber }}</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<!-- Tanggal -->
|
||||
<v-flex xs3>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="label">Tanggal</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs9>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="value">: {{ selectedPO.DisplayDate }}</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
|
||||
<!-- Nomor Referensi -->
|
||||
<v-flex xs3>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="label">Nomor Referensi</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs9>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="value">: {{ selectedPO.PurchaseOrderRefNumber }}</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
|
||||
<!-- Pajak Pendapatan (PPN) -->
|
||||
<v-flex xs3>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="label">Pajak Pendapatan (PPN):</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs9>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="value">: {{ selectedPO.PurchaseOrderTaxPercentPpn }}%</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
|
||||
<!-- Pajak Penghasilan (PPH) -->
|
||||
<v-flex xs3>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="label">Pajak Penghasilan (PPH)</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs9>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="value">: {{ selectedPO.PurchaseOrderTaxPercentPph }}%</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
|
||||
<!-- Vendor -->
|
||||
<v-flex xs3>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="label">Vendor</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs9>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="label">: {{ selectedPO.SupplierCode }}
|
||||
{{ selectedPO.SupplierName }}
|
||||
</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
|
||||
<!-- Diskon Vendor -->
|
||||
<v-flex xs3>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="label">Diskon Vendor(Tipe Diskon)</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs9>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span v-if="selectedPO.DiscountType == 'Percentage'" class="label">: {{ selectedPO.PurchaseOrderDiscountPercent }}% (Percentage)</span>
|
||||
<span v-if="selectedPO.DiscountType == 'Absolute'" class="label">: Rp {{ selectedPO.PurchaseOrderDiscountAmount }} (Absolut)</span>
|
||||
<span v-if="selectedPO.DiscountType == ''" class="label">: - (-)</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
|
||||
<!-- Jangka Waktu Pembayaran -->
|
||||
<v-flex xs3>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="label">Jangka Waktu Pembayaran</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs9>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="value">: {{ selectedPO.PurchaseOrderPaymentTerm }} hari</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
|
||||
<!-- Tipe Gudang -->
|
||||
<v-flex xs3>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="label">Tipe Gudang</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<!-- Tipe Gudang -->
|
||||
<v-flex xs9>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="value">: {{ selectedPO.PurchaseOrderWarehouseType }}</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
|
||||
<!-- Gudang -->
|
||||
<v-flex xs3 v-if="selectedPO.PurchaseOrderWarehouseType === 'Single'">
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="label">Gudang</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs9 v-if="selectedPO.PurchaseOrderWarehouseType === 'Single'">
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="value">: {{ selectedPO.WarehouseName }}</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
|
||||
<!-- Keterangan -->
|
||||
<v-flex xs3>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="label">Biaya Ekspedisi</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs9>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="value">: {{ selectedPO && selectedPO.PurchaseOrderShippingCost != null
|
||||
? oneMoney(selectedPO.PurchaseOrderShippingCost) : '0' }}
|
||||
<span v-if="selectedPO.PurchaseOrderShippingCostStatus === 'Y'">Sudah dibayar
|
||||
</span>
|
||||
<span v-if="selectedPO.PurchaseOrderShippingCostStatus === 'N'">Belum dibayar
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
|
||||
<!-- Keterangan -->
|
||||
<v-flex xs3>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="label">Keterangan</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
<v-flex xs9>
|
||||
<div class="label-value subheading mb-2">
|
||||
<span class="value">: {{ selectedPO.PurchaseOrderNote }}</span>
|
||||
</div>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<!-- TABEL ITEM VIEW -->
|
||||
<v-flex xs12>
|
||||
<v-data-table v-if="summary.length > 0" :headers="summaryHeaders" :items="summary" :loading="loading"
|
||||
hide-actions class="elevation-1 mt-4" expand item-key="M_ItemID">
|
||||
|
||||
<!-- Tabel Item -->
|
||||
<template slot="items" slot-scope="props">
|
||||
<tr @click="props.expanded = !props.expanded">
|
||||
<td class="text-xs-center">
|
||||
<v-icon>{{
|
||||
props.expanded
|
||||
? "keyboard_arrow_down"
|
||||
: "keyboard_arrow_right"
|
||||
}}</v-icon>
|
||||
</td>
|
||||
<td class="">
|
||||
<kbd>{{ props.item.M_ItemCode }}</kbd>
|
||||
{{ props.item.M_ItemDesc }}
|
||||
</td>
|
||||
|
||||
<td class="text-xs-center">
|
||||
{{ props.item.TotalPoQty }} {{ props.item.PoItemUnitName }}
|
||||
</td>
|
||||
<td class="text-xs-center">
|
||||
{{ oneMoney(props.item.RealPrice) }}
|
||||
</td>
|
||||
<td class="text-xs-right">
|
||||
<div v-if="props.item.discountType === 'R'">
|
||||
{{ oneMoney(props.item.discount) }}
|
||||
</div>
|
||||
<div v-if="props.item.discountType === 'P'">
|
||||
<kbd>{{ props.item.discount }}%</kbd>
|
||||
{{ oneMoney(props.item.summaryDiscountAmount) }}
|
||||
</div>
|
||||
</td>
|
||||
<td class="text-xs-right">
|
||||
{{ oneMoney(props.item.Price) }}
|
||||
</td>
|
||||
<td class="text-xs-right">
|
||||
{{ oneMoney(props.item.Total) }}
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
|
||||
<!-- Detail per Baris Item -->
|
||||
<template slot="expand" slot-scope="props">
|
||||
<v-card flat>
|
||||
<v-card-text class="pl-3">
|
||||
<div class="ml-3 mb-3">
|
||||
<v-data-table :headers="detailHeaders" :items="props.item.Details" hide-actions
|
||||
class="elevation-0">
|
||||
<template slot="items" slot-scope="detailProps">
|
||||
<td class="">
|
||||
<kbd>{{ detailProps.item.M_ItemCode }}</kbd>
|
||||
|
||||
{{ detailProps.item.M_ItemDesc }}
|
||||
</td>
|
||||
<td class="">
|
||||
{{
|
||||
detailProps.item.PurchaseRequestNumber
|
||||
}}
|
||||
</td>
|
||||
<td class="">
|
||||
{{
|
||||
detailProps.item.M_BranchName ??
|
||||
detailProps.item.S_RegionalName
|
||||
}}
|
||||
</td>
|
||||
<td class="py-1">
|
||||
{{ detailProps.item.warehouse.WarehouseName }}
|
||||
</td>
|
||||
<td class="text-xs-center">
|
||||
{{ detailProps.item.PoQty }}
|
||||
{{ detailProps.item.PoItemUnitName }}
|
||||
</td>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<!-- Tabel di bawah Item -->
|
||||
<template v-slot:footer>
|
||||
<tr>
|
||||
<td :colspan="4">
|
||||
<strong class="ml-2">TOTAL HARGA TANPA DISKON</strong>
|
||||
</td>
|
||||
<td :colspan="3" class="text-xs-right">
|
||||
<strong>{{
|
||||
selectedPO && selectedPO.TotalRealPrice != null
|
||||
? oneMoney(selectedPO.TotalRealPrice) : '0'
|
||||
}}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td :colspan="4">
|
||||
<strong class="ml-2">TOTAL DISKON PER ITEM</strong>
|
||||
</td>
|
||||
<td :colspan="3" class="text-xs-right">
|
||||
<strong>{{
|
||||
selectedPO && selectedPO.TotalDiskonPerItem != null
|
||||
? oneMoney(selectedPO.TotalDiskonPerItem) : '0'
|
||||
}}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td :colspan="4">
|
||||
<strong class="ml-2">DISKON VENDOR</strong>
|
||||
</td>
|
||||
<td :colspan="3" class="text-xs-right">
|
||||
<strong>{{
|
||||
selectedPO && selectedPO.DiscountAmount != null
|
||||
? oneMoney(selectedPO.DiscountAmount) : '0'
|
||||
}}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td :colspan="4">
|
||||
<strong class="ml-5">PAJAK PENDAPATAN(PPN)</strong>
|
||||
</td>
|
||||
<td :colspan="3" class="text-xs-right">
|
||||
<strong>{{
|
||||
selectedPO && selectedPO.PurchaseOrderTaxAmountPpn != null
|
||||
? oneMoney(selectedPO.PurchaseOrderTaxAmountPpn) : '0'
|
||||
}}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td :colspan="4">
|
||||
<strong class="ml-5">PAJAK PENGHASILAN(PPH)</strong>
|
||||
</td>
|
||||
<td :colspan="3" class="text-xs-right">
|
||||
<strong>{{
|
||||
selectedPO && selectedPO.PurchaseOrderTaxAmountPph != null
|
||||
? oneMoney(selectedPO.PurchaseOrderTaxAmountPph) : '0'
|
||||
}}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td :colspan="4">
|
||||
<strong class="ml-2">PAJAK</strong>
|
||||
</td>
|
||||
<td :colspan="3" class="text-xs-right">
|
||||
<strong>{{ selectedPO && selectedPO.TaxAmount != null
|
||||
? oneMoney(selectedPO.TaxAmount) : '0' }}</strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td :colspan="4">
|
||||
<strong>TOTAL</strong>
|
||||
</td>
|
||||
<td :colspan="3" class="text-xs-right">
|
||||
<strong>{{
|
||||
selectedPO && selectedPO.PurchaseOrderGrandTotal != null
|
||||
? oneMoney(selectedPO.PurchaseOrderGrandTotal) : '0'
|
||||
}}</strong>
|
||||
</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="green" flat @click="dialogView = false">
|
||||
TUTUP
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data() {
|
||||
return {
|
||||
selectedDateForm: null,
|
||||
refNumber: "",
|
||||
taxPpn: 0,
|
||||
taxPph: 0,
|
||||
selectedSupplier: {},
|
||||
paymentTerm: 0,
|
||||
warehouseType: "",
|
||||
selectedWarehouse: {},
|
||||
note: "",
|
||||
selectedItem: [],
|
||||
detailHeaders: [
|
||||
// {
|
||||
// text: "KODE ITEM",
|
||||
// align: "center",
|
||||
// sortable: false,
|
||||
// value: "M_ItemCode",
|
||||
// width: "15%",
|
||||
// class: "blue lighten-4 black--text",
|
||||
// },
|
||||
{
|
||||
text: "NAMA PRODUK",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "M_ItemDesc",
|
||||
width: "20%",
|
||||
class: "blue lighten-4 black--text",
|
||||
},
|
||||
{
|
||||
text: "PR NUMBER",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "M_ItemDesc",
|
||||
width: "10%",
|
||||
class: "blue lighten-4 black--text",
|
||||
},
|
||||
{
|
||||
text: "CABANG",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "M_BranchName",
|
||||
width: "20%",
|
||||
class: "blue lighten-4 black--text",
|
||||
},
|
||||
{
|
||||
text: "GUDANG",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "M_BranchName",
|
||||
width: "30%",
|
||||
class: "blue lighten-4 black--text",
|
||||
},
|
||||
// {
|
||||
// text: "UNIT",
|
||||
// align: "center",
|
||||
// sortable: false,
|
||||
// value: "ItemUnitName",
|
||||
// width: "10%",
|
||||
// class: "blue lighten-4 black--text",
|
||||
// },
|
||||
{
|
||||
text: "QTY",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "PoQty",
|
||||
width: "15%",
|
||||
class: "blue lighten-4 black--text",
|
||||
},
|
||||
],
|
||||
summaryHeaders: [
|
||||
{
|
||||
text: "",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "expand",
|
||||
width: "5%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "ITEM",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "M_ItemCode",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "QTY",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "PoQty",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "HARGA",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "price",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "DISKON",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "price",
|
||||
width: "20%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "HARGA SETELAH DISKON",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "price",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TOTAL",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "Total",
|
||||
width: "20%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
statusOptions() {
|
||||
return this.$store.state.po.statusOptions;
|
||||
},
|
||||
dialogView: {
|
||||
get() {
|
||||
return this.$store.state.po.dialogView;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_dialogView", val);
|
||||
},
|
||||
},
|
||||
selectedPO: {
|
||||
get() {
|
||||
return this.$store.state.po.selectedPO;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_selectedPO", val);
|
||||
},
|
||||
},
|
||||
summary: {
|
||||
get() {
|
||||
return this.$store.state.po.summary;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_summary", val);
|
||||
},
|
||||
},
|
||||
loading: {
|
||||
get() {
|
||||
return this.$store.state.po.loading;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_loading", val);
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
roundToThreeSignificantDigits(num) {
|
||||
if (num === 0) return 0;
|
||||
|
||||
// Hitung jumlah digit
|
||||
const absNum = Math.abs(num);
|
||||
const magnitude = Math.floor(Math.log10(absNum)) + 1;
|
||||
|
||||
// Jika kurang dari 3 digit, tidak perlu dibulatkan
|
||||
if (magnitude <= 3) return num;
|
||||
|
||||
// Hitung faktor pembulatan
|
||||
const factor = Math.pow(10, magnitude - 3);
|
||||
|
||||
// Bulatkan
|
||||
return Math.round(num / factor) * factor;
|
||||
},
|
||||
oneMoney(value) {
|
||||
//return one_money(value);
|
||||
// let splitValue = value.toString().split(".");
|
||||
// if(splitValue.length > 1) {
|
||||
// let val = splitValue[0]
|
||||
// return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".") + "," + this.roundToThreeSignificantDigits(splitValue[1]);
|
||||
// } else {
|
||||
// return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||
// }
|
||||
// Ubah ke float jika belum angka
|
||||
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}`;
|
||||
},
|
||||
formatDate(date) {
|
||||
if (!date) return null;
|
||||
|
||||
const [year, month, day] = date.split("-");
|
||||
return `${day}-${month}-${year}`;
|
||||
},
|
||||
formatRupiah(angka) {
|
||||
const format = new Intl.NumberFormat("id-ID", {
|
||||
style: "currency",
|
||||
currency: "IDR",
|
||||
minimumFractionDigits: 0,
|
||||
});
|
||||
return "Rp " + format.format(angka).replace("Rp", "").trim();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.label-value subheading mb-2 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-weight: bold;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-size: 1rem;
|
||||
}
|
||||
</style>
|
||||
655
test/vuex/acc-one-purchase-order-v2/components/po.vue
Normal file
655
test/vuex/acc-one-purchase-order-v2/components/po.vue
Normal file
@@ -0,0 +1,655 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-dialog v-model="dialogDelete" persistent width="500">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
KONFIRMASI
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
Apakah anda yakin untuk menghapus
|
||||
<span style="font-weight: bold;">{{
|
||||
selectedPO.PurchaseOrderNumber
|
||||
}}</span>
|
||||
??
|
||||
</v-card-text>
|
||||
|
||||
<v-divider></v-divider>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="red" :disabled="loading" :loading="loading" flat @click="dialogDelete = false">
|
||||
Tidak
|
||||
</v-btn>
|
||||
<v-btn color="green" :disabled="loading" :loading="loading" flat @click="deletePO()">
|
||||
Ya
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
<v-dialog v-model="dialogConfirmation" persistent width="500">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
KONFIRMASI
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
Apakah anda yakin untuk mengunci
|
||||
<span style="font-weight: bold;">{{
|
||||
selectedPO.PurchaseOrderNumber
|
||||
}}</span>
|
||||
untuk melanjutkan ke proses approve?
|
||||
<p style="font-style: italic;" class="mt-3">
|
||||
*Setelah dikunci PO tidak dapat di edit
|
||||
</p>
|
||||
</v-card-text>
|
||||
|
||||
<v-divider></v-divider>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="red" :disabled="loading" :loading="loading" flat @click="dialogConfirmation = false">
|
||||
Tidak
|
||||
</v-btn>
|
||||
<v-btn color="green" :disabled="loading" :loading="loading" flat @click="requestOrder()">
|
||||
Ya
|
||||
</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<v-snackbar v-model="snackbar.state" :color="snackbar.type" :timeout="6000" multi-line top>
|
||||
{{ snackbar.message }}
|
||||
<v-btn flat @click="snackbar.state = false">
|
||||
Close
|
||||
</v-btn>
|
||||
</v-snackbar>
|
||||
<v-toolbar color="primary" dark>
|
||||
<v-toolbar-title class="white--text">PURCHASE ORDER</v-toolbar-title>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn icon @click="openDialogAdd()">
|
||||
<v-icon>add_box</v-icon>
|
||||
</v-btn>
|
||||
</v-toolbar>
|
||||
<v-card>
|
||||
<v-layout row wrap class="px-2 py-2">
|
||||
<v-flex xs3>
|
||||
<v-menu v-model="menuSelectedDate" :close-on-content-click="false" transition="scale-transition"
|
||||
:nudge-right="40" lazy offset-y max-width="290px" min-width="290px">
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-text-field :value="selectedDateFormatted" label="Tanggal Mulai" readonly class="mr-2"
|
||||
outline hide-details v-on="on"></v-text-field>
|
||||
</template>
|
||||
<v-date-picker no-title hide-details v-model="selectedDate"
|
||||
@input="menuSelectedDate = false"></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs3>
|
||||
<v-menu v-model="menuSelectedDateEnd" :close-on-content-click="false" transition="scale-transition"
|
||||
:nudge-right="40" lazy offset-y max-width="290px" min-width="290px">
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-text-field :value="endDateFormatted" label="Tanggal Akhir" readonly class="mr-2" outline
|
||||
hide-details v-on="on"></v-text-field>
|
||||
</template>
|
||||
<v-date-picker no-title hide-details v-model="selectedDateEnd"
|
||||
@input="menuSelectedDateEnd = false"></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs3>
|
||||
<v-select :items="statusOptions" label="Status" hide-details class="mini-select mr-2" v-model="selectedStatus"
|
||||
item-text="title" return-object outline></v-select>
|
||||
</v-flex>
|
||||
<v-flex xs3>
|
||||
<v-text-field v-model="search" label="Cari..." placeholder="NO. PO" class="mr-2" outline hide-details>
|
||||
</v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
<v-card class="pa-2 mt-2">
|
||||
<div style="height: 60vh; overflow-y: scroll;">
|
||||
<v-data-table :headers="headers" :items="poList" :loading="loading" hide-actions class="elevation-1">
|
||||
<template v-slot:items="props">
|
||||
<td class="text-xs-center">{{ props.item.PurchaseOrderNumber }}</td>
|
||||
<td class="text-xs-center">{{ deFormatedDate(props.item.PurchaseOrderDate) }}</td>
|
||||
<td class="text-xs-left">{{ props.item.SupplierName }}</td>
|
||||
<td class="text-xs-center">
|
||||
<p class="my-0 p-0">
|
||||
<kbd>{{ props.item.PurchaseOrderWarehouseType }}</kbd>
|
||||
</p>
|
||||
<p class="my-0 p-0">
|
||||
{{ props.item.WarehouseName }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="text-xs-left">{{ props.item.PurchaseOrderNote }}</td>
|
||||
<td class="text-xs-right">
|
||||
{{ props.item.PurchaseOrderGrandTotal != null ? oneMoney(props.item.PurchaseOrderGrandTotal) : '0' }}
|
||||
</td>
|
||||
|
||||
<td class="text-xs-center">
|
||||
<v-chip color="blue" v-if="props.item.PurchaseOrderStatus === 'Draft'" text-color="white">{{
|
||||
props.item.PurchaseOrderStatus }}
|
||||
</v-chip>
|
||||
<v-chip color="warning" v-else-if="props.item.PurchaseOrderStatus === 'Pending'" text-color="white">{{
|
||||
props.item.PurchaseOrderStatus }}
|
||||
</v-chip>
|
||||
<v-chip color="green" v-else-if="props.item.PurchaseOrderStatus === 'Approved'" text-color="white">{{
|
||||
props.item.PurchaseOrderStatus }}
|
||||
</v-chip>
|
||||
<v-chip color="red" v-else-if="props.item.PurchaseOrderStatus === 'Rejected'" text-color="white">{{
|
||||
props.item.PurchaseOrderStatus }}
|
||||
</v-chip>
|
||||
<v-chip color="primary" v-else-if="props.item.PurchaseOrderStatus === 'Completed'" text-color="white">{{
|
||||
props.item.PurchaseOrderStatus }}
|
||||
</v-chip>
|
||||
<v-chip v-else text-color="white">{{ props.item.PurchaseOrderStatus }}
|
||||
</v-chip>
|
||||
</td>
|
||||
|
||||
<td class="text-xs-center">
|
||||
<div v-if="props.item.PurchaseOrderStatus === 'Draft'" class="gap-0">
|
||||
<v-tooltip bottom>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-btn icon :disabled="loading" @click="openDialogConfirmation(props.item)" v-on="on" class="mx-0 px-0">
|
||||
<v-icon color="blue">check_circle</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<span>Confirm PO</span>
|
||||
</v-tooltip>
|
||||
|
||||
<v-tooltip bottom>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-btn icon :disabled="loading" @click="openDialogDelete(props.item)" v-on="on" class="mx-0 px-0">
|
||||
<v-icon color="red">delete</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<span>Delete PO</span>
|
||||
</v-tooltip>
|
||||
|
||||
<v-tooltip bottom>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-btn icon :disabled="loading || props.item.PurchaseOrderStatus !== 'Draft'" @click="openDialogEdit(props.item)" v-on="on" class="mx-0 px-0">
|
||||
<v-icon color="blue">edit</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<span>Edit PO</span>
|
||||
</v-tooltip>
|
||||
</div>
|
||||
|
||||
<div v-if="props.item.PurchaseOrderStatus !== 'Draft'">
|
||||
<!-- * Update 1 Juli 2025: * -->
|
||||
<!-- ** Approval dipisah ke halaman 'Approval PO' -->
|
||||
<!-- <v-tooltip bottom>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-btn icon :disabled="loading || props.item.PurchaseOrderStatus == 'Approved'"
|
||||
@click="approvePO(props.item)" v-on="on" class="mx-0 px-0">
|
||||
<v-icon color="green">done_all</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<span>Approve PO</span>
|
||||
</v-tooltip> -->
|
||||
|
||||
<v-tooltip bottom>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-btn icon :disabled="loading" @click="openDialogView(props.item)" v-on="on" class="mx-0 px-0">
|
||||
<v-icon color="blue">visibility</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<span>View PO</span>
|
||||
</v-tooltip>
|
||||
|
||||
<v-tooltip bottom>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-btn icon :disabled="loading" @click="doPrint(props.item)" v-on="on" class="mx-0 px-0">
|
||||
<v-icon color="red">picture_as_pdf</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
<span>PDF PO</span>
|
||||
</v-tooltip>
|
||||
</div>
|
||||
</td>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</div>
|
||||
</v-card>
|
||||
<v-card class="text-xs-left pa-2">
|
||||
<v-pagination v-model="selectedPage" :length="totalPage"></v-pagination>
|
||||
</v-card>
|
||||
<po-form></po-form>
|
||||
<po-view></po-view>
|
||||
<one-dialog-print :title="printtitle" :width="printwidth" :height="700" :status="openprint" :urlprint="urlprint"
|
||||
@close-dialog-print="openprint = false"></one-dialog-print>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.date-type-table {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.flex-items-center {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.table.v-table tbody td,
|
||||
.table.v-table tbody tr {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.table.v-table thead tr {
|
||||
height: 40px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
components: {
|
||||
"po-form": httpVueLoader("./poForm.vue"),
|
||||
"po-view": httpVueLoader("./dialogView.vue"),
|
||||
'one-dialog-print': httpVueLoader('../../common/oneDialogPrintX.vue'),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menuSelectedDate: false,
|
||||
menuSelectedDateEnd: false,
|
||||
msgAlertDeleteOrReject: "",
|
||||
dialogAlertRejectRequest: false,
|
||||
dialogAlertDeleteDetail: false,
|
||||
amountRules: [(v) => v >= 0 || "Jumlah harus diisi"],
|
||||
validationDetail: false,
|
||||
formatreport: "pdf",
|
||||
urlprint: "",
|
||||
printtitle: '',
|
||||
printwidth: '100%',
|
||||
headers: [
|
||||
{
|
||||
text: "NO PO",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "5%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TANGGAL",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "5%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "VENDOR",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "20%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "GUDANG",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "KETERANGAN",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "",
|
||||
width: "25%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TOTAL",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "STATUS",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "",
|
||||
width: "10%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
],
|
||||
detailHeaders: [
|
||||
{
|
||||
text: "KODE ITEM",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "no",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "NAMA ITEM",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "requestDate",
|
||||
width: "35%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "QTY",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "requestDate",
|
||||
width: "15%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "HARGA",
|
||||
align: "left",
|
||||
sortable: false,
|
||||
value: "requestDate",
|
||||
width: "25%",
|
||||
class: "blue lighten-3 white--text",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("po/searchData");
|
||||
this.$store.dispatch("po/getItemCategory");
|
||||
},
|
||||
computed: {
|
||||
statusOptions() {
|
||||
return this.$store.state.po.statusOptions;
|
||||
},
|
||||
selectedDate: {
|
||||
get() {
|
||||
return this.$store.state.po.selectedDate;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_selectedDate", val);
|
||||
this.$store.dispatch("po/searchData");
|
||||
},
|
||||
},
|
||||
selectedStatus: {
|
||||
get() {
|
||||
return this.$store.state.po.selectedStatus;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_selectedStatus", val);
|
||||
this.$store.dispatch("po/searchData");
|
||||
},
|
||||
},
|
||||
statusOptions: {
|
||||
get() {
|
||||
return this.$store.state.po.statusOptions;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_statusOptions", val);
|
||||
},
|
||||
},
|
||||
selectedPO: {
|
||||
get() {
|
||||
return this.$store.state.po.selectedPO;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_selectedPO", val);
|
||||
},
|
||||
},
|
||||
dialogConfirmation: {
|
||||
get() {
|
||||
return this.$store.state.po.dialogConfirmation;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_dialogConfirmation", val);
|
||||
},
|
||||
},
|
||||
selectedDateEnd: {
|
||||
get() {
|
||||
return this.$store.state.po.selectedDateEnd;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_selectedDateEnd", val);
|
||||
this.$store.dispatch("po/searchData");
|
||||
},
|
||||
},
|
||||
|
||||
search: {
|
||||
get() {
|
||||
return this.$store.state.po.search;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_search", val);
|
||||
this.$store.dispatch("po/searchData");
|
||||
},
|
||||
},
|
||||
selectedDateFormatted() {
|
||||
return this.formatDate(this.selectedDate);
|
||||
},
|
||||
endDateFormatted() {
|
||||
return this.formatDate(this.selectedDateEnd);
|
||||
},
|
||||
poList() {
|
||||
return this.$store.state.po.poList;
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.po.snackbar;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_snackbar", val);
|
||||
},
|
||||
},
|
||||
totalPage: {
|
||||
get() {
|
||||
return this.$store.state.po.totalPage;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_totalPage", val);
|
||||
},
|
||||
},
|
||||
selectedPage: {
|
||||
get() {
|
||||
return this.$store.state.po.selectedPage;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_selectedPage", val);
|
||||
this.$store.dispatch("po/searchData");
|
||||
},
|
||||
},
|
||||
loading: {
|
||||
get() {
|
||||
return this.$store.state.po.loading;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_loading", val);
|
||||
},
|
||||
},
|
||||
dialogForm: {
|
||||
get() {
|
||||
return this.$store.state.po.dialogForm;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_dialogForm", val);
|
||||
},
|
||||
},
|
||||
dialogFormAct: {
|
||||
get() {
|
||||
return this.$store.state.po.dialogFormAct;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_dialogFormAct", val);
|
||||
},
|
||||
},
|
||||
dialogDelete: {
|
||||
get() {
|
||||
return this.$store.state.po.dialogDelete;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_dialogDelete", val);
|
||||
},
|
||||
},
|
||||
dialogView: {
|
||||
get() {
|
||||
return this.$store.state.po.dialogView;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_dialogView", val);
|
||||
},
|
||||
},
|
||||
openprint: {
|
||||
get() {
|
||||
return this.$store.state.po.open_print;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("po/update_open_print", val);
|
||||
},
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
doPrint(val) {
|
||||
// console.log(val)
|
||||
this.printwidth = 1028
|
||||
this.printtitle = ""
|
||||
let user = one_user()
|
||||
tm = Date.now()
|
||||
var rptname = 'rpt_po_001'
|
||||
var formatrpt = this.formatreport
|
||||
|
||||
this.urlprint = "/birt/run?__report=report/one/accounting/" + rptname + ".rptdesign&__format=" + formatrpt + "&PID=" + val.PurchaseOrderID + "&username=" + user.M_StaffName + "&tm=" + tm
|
||||
// console.log(this.urlprint)
|
||||
|
||||
this.$store.commit("po/update_open_print", true)
|
||||
},
|
||||
roundToThreeSignificantDigits(num) {
|
||||
if (num === 0) return 0;
|
||||
|
||||
// Hitung jumlah digit
|
||||
const absNum = Math.abs(num);
|
||||
const magnitude = Math.floor(Math.log10(absNum)) + 1;
|
||||
|
||||
// Jika kurang dari 3 digit, tidak perlu dibulatkan
|
||||
if (magnitude <= 3) return num;
|
||||
|
||||
// Hitung faktor pembulatan
|
||||
const factor = Math.pow(10, magnitude - 3);
|
||||
|
||||
// Bulatkan
|
||||
return Math.round(num / factor) * factor;
|
||||
},
|
||||
oneMoney(value) {
|
||||
//return one_money(value);
|
||||
// let splitValue = value.toString().split(".");
|
||||
// if(splitValue.length > 1) {
|
||||
// let val = splitValue[0]
|
||||
// return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".") + "," + this.roundToThreeSignificantDigits(splitValue[1]);
|
||||
// } else {
|
||||
// return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||
// }
|
||||
// Ubah ke float jika belum angka
|
||||
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}`;
|
||||
},
|
||||
openDialogConfirmation(data) {
|
||||
this.selectedPO = data;
|
||||
this.dialogConfirmation = true;
|
||||
},
|
||||
openDialogDelete(data) {
|
||||
this.selectedPO = data;
|
||||
this.dialogDelete = true;
|
||||
},
|
||||
async requestOrder() {
|
||||
try {
|
||||
// First, update the backend
|
||||
await this.$store.dispatch("po/requestOrder");
|
||||
|
||||
setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 1000); // Short delay to allow the snackbar to be visible
|
||||
} catch (error) {
|
||||
console.error("Error confirming order:", error);
|
||||
this.snackbar = {
|
||||
state: true,
|
||||
type: "error",
|
||||
message: "Gagal mengkonfirmasi Purchase Order"
|
||||
};
|
||||
}
|
||||
},
|
||||
deletePO() {
|
||||
this.$store.dispatch("po/deleteOrder");
|
||||
},
|
||||
openDialogAdd() {
|
||||
this.$store.dispatch("po/resetForm");
|
||||
this.dialogForm = true;
|
||||
},
|
||||
openDialogView(data) {
|
||||
this.selectedPO = data;
|
||||
this.$store.dispatch("po/resetForm");
|
||||
this.dialogView = true;
|
||||
this.$store.dispatch("po/getItemUpdate");
|
||||
},
|
||||
openDialogEdit(data) {
|
||||
console.log("Open Dialog Edit dengan Param: ", JSON.parse(JSON.stringify(data)));
|
||||
this.selectedPO = data;
|
||||
this.dialogFormAct = "EDIT";
|
||||
this.dialogForm = true;
|
||||
this.$store.dispatch("po/assignEdit");
|
||||
this.$store.dispatch("po/getItemUpdate");
|
||||
},
|
||||
formatRupiah(angka) {
|
||||
const format = new Intl.NumberFormat("id-ID", {
|
||||
style: "currency",
|
||||
currency: "IDR",
|
||||
minimumFractionDigits: 0,
|
||||
});
|
||||
return "Rp " + format.format(angka).replace("Rp", "").trim();
|
||||
},
|
||||
formatDate(date) {
|
||||
if (!date) return null;
|
||||
|
||||
const [year, month, day] = date.split("-");
|
||||
return `${day}-${month}-${year}`;
|
||||
},
|
||||
deFormatedDate(date) {
|
||||
if (!date) return null;
|
||||
|
||||
const [day, month, year] = date.split("-");
|
||||
return `${year}-${month.padStart(2, "0")}-${day.padStart(2, "0")}`;
|
||||
},
|
||||
approvePO(data) {
|
||||
if (data.PurchaseOrderID != '') {
|
||||
this.$store.dispatch("po/approveOrder", { poID: data.PurchaseOrderID });
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogApprove(val, old) { },
|
||||
},
|
||||
};
|
||||
</script>
|
||||
1642
test/vuex/acc-one-purchase-order-v2/components/poForm.vue
Normal file
1642
test/vuex/acc-one-purchase-order-v2/components/poForm.vue
Normal file
File diff suppressed because it is too large
Load Diff
1761
test/vuex/acc-one-purchase-order-v2/components/poForm_bckp.vue
Normal file
1761
test/vuex/acc-one-purchase-order-v2/components/poForm_bckp.vue
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user