add modules folder based on s_menu
This commit is contained in:
@@ -0,0 +1,147 @@
|
||||
<template>
|
||||
<v-dialog v-model="dialog_adjustment" persistent max-width="500px">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
FORM PENAMBAHAN HARGA
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-form ref="formAdj" v-model="validationAdj" lazy-validation>
|
||||
<v-text-field
|
||||
v-model="formatted_original" label="Harga Awal"
|
||||
required outline hide-details prefix="Rp. " readonly
|
||||
></v-text-field>
|
||||
<v-text-field
|
||||
v-model="formatted_adjustment" label="Harga Tambahan"
|
||||
required outline hide-details prefix="Rp ." class="mt-2"
|
||||
@blur="onBlurInput" @focus="onFocusInput"
|
||||
></v-text-field>
|
||||
<v-autocomplete
|
||||
v-model="selected_account" :items="list_account" outline
|
||||
label="Account Tambahan" hide-details class="mt-2"
|
||||
item-text="coaDescription" item-value="coaAccountNo"
|
||||
>
|
||||
<template slot="item" slot-scope="{item}">
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title>{{ item.coaDescription }}</v-list-tile-title>
|
||||
<v-list-tile-sub-title>{{ item.coaSubDescription }}</v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
</v-form>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="error" flat @click="cancelAdjusment()" outline>Batal</v-btn>
|
||||
<v-btn color="primary" @click="simpanAdjustment()" dark>Simpan</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
data() {
|
||||
return {
|
||||
validationAdj: false,
|
||||
price_original: 0,
|
||||
price_adjustment: 0,
|
||||
rules: [v => !!v || "tidak boleh kosong"]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
dialog_adjustment: {
|
||||
get() {
|
||||
return this.$store.state.voucher.dialog_adjustment;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_dialog_adjustment", val);
|
||||
}
|
||||
},
|
||||
formatted_original() {
|
||||
return this.price_original;
|
||||
},
|
||||
formatted_adjustment: {
|
||||
get() {
|
||||
return this.price_adjustment;
|
||||
},
|
||||
set(val) {
|
||||
const raw = val.replace(/\./g, '').replace(',', '.');
|
||||
this.selected_detail_voucher.PurchaseRequestDirectAdjustment = Number(raw);
|
||||
}
|
||||
},
|
||||
selected_detail_voucher: {
|
||||
get() {
|
||||
return this.$store.state.voucher.selected_detail_voucher;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_selected_detail_voucher", val);
|
||||
}
|
||||
},
|
||||
selected_account: {
|
||||
get() {
|
||||
return this.selected_detail_voucher.PurchaseRequestDirectAdjustmentAccount
|
||||
},
|
||||
set(val) {
|
||||
this.selected_detail_voucher.PurchaseRequestDirectAdjustmentAccount = val
|
||||
}
|
||||
},
|
||||
list_account() {
|
||||
return this.$store.state.voucher.list_account
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
oneMoney(value) {
|
||||
let splitvalue = value.toString().split(".");
|
||||
if (splitvalue.length > 1) {
|
||||
const real = splitvalue[0];
|
||||
const deci = parseInt(splitvalue[1], 10);
|
||||
|
||||
let decimal = 0
|
||||
if (isNaN(deci) || deci <= 0) {
|
||||
decimal = '00';
|
||||
} else {
|
||||
const scale = 10 ** splitvalue[1].length;
|
||||
decimal = Math.round((deci / scale) * 100);
|
||||
}
|
||||
|
||||
return real.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".") + "," + decimal;
|
||||
} else {
|
||||
return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||
}
|
||||
},
|
||||
onBlurInput() {
|
||||
const price_adjst = this.selected_detail_voucher.PurchaseRequestDirectAdjustment;
|
||||
this.price_adjustment = this.oneMoney(price_adjst);
|
||||
},
|
||||
onFocusInput() {
|
||||
const price_adjst = this.selected_detail_voucher.PurchaseRequestDirectAdjustment;
|
||||
this.price_adjustment = price_adjst.toString().replace('.', ',');
|
||||
},
|
||||
cancelAdjusment() {
|
||||
this.price_adjustment = 0;
|
||||
this.price_original = 0;
|
||||
this.selected_detail_voucher = {};
|
||||
|
||||
this.$refs.formAdj.resetValidation();
|
||||
this.dialog_adjustment = false;
|
||||
},
|
||||
simpanAdjustment() {
|
||||
if (this.$refs.formAdj.validate()) {
|
||||
this.$store.dispatch("voucher/updateAdjusment");
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialog_adjustment(val) {
|
||||
if (val) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.formAdj?.resetValidation();
|
||||
const detail = this.selected_detail_voucher
|
||||
this.price_original = this.oneMoney(detail.PaymentVoucherDetailTotal);
|
||||
this.price_adjustment = this.oneMoney(detail.PurchaseRequestDirectAdjustment);
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,178 @@
|
||||
<template>
|
||||
<div style="width: 100%;" class="pa-1">
|
||||
<v-card class="pa-2">
|
||||
<v-layout row>
|
||||
<v-flex xs class="pr-1">
|
||||
<p class="mb-0">
|
||||
Nomor:
|
||||
<strong>{{ selected_voucher.PaymentVoucherNumber ?? "-" }}</strong>
|
||||
</p>
|
||||
<p class="mb-0">
|
||||
Sumber Dana:
|
||||
<strong>{{ selected_voucher.coaDescriptionSource ?? "-" }}</strong>
|
||||
</p>
|
||||
<p class="mb-0">
|
||||
Tampungan Sementara:
|
||||
<strong>{{ selected_voucher.coaDescriptionTemporary ?? "-" }}</strong>
|
||||
</p>
|
||||
</v-flex>
|
||||
<v-flex shrink class="pl-1">
|
||||
<v-btn
|
||||
v-if="selected_voucher.PaymentVoucherRealitationApproved == 'N'"
|
||||
color="primary" outline
|
||||
@click="approveRealisasi()"
|
||||
>
|
||||
Verifikasi
|
||||
</v-btn>
|
||||
<v-btn v-else dark color="primary" @click="{}">Verfified</v-btn>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<v-data-table
|
||||
:items="list_detail_voucher.records" :headers="headers"
|
||||
class="elevation-1 mt-2" hide-actions
|
||||
>
|
||||
<template slot="items" slot-scope="props">
|
||||
<tr>
|
||||
<td class="pa-2 text-xs-center">
|
||||
{{ props.index + 1 }}
|
||||
</td>
|
||||
<td class="pa-2 text-xs-center">
|
||||
{{ props.item.PurchaseRequestDirectNumber }}
|
||||
</td>
|
||||
<td class="pa-2 text-xs-center">
|
||||
Rp. {{ one_money(props.item.PaymentVoucherDetailTotal) }}
|
||||
</td>
|
||||
<td class="pa-2 text-xs-center">
|
||||
Rp. {{ one_money(props.item.PurchaseRequestDirectAdjustment) }}
|
||||
</td>
|
||||
<td class="pa-2 text-xs-center">
|
||||
<v-btn
|
||||
style="min-width: 25px; height: 25px; margin: 0;" outline
|
||||
small color="blue lighten-2" @click="editDetailVoucher(props.item)"
|
||||
:disabled="selected_voucher.PaymentVoucherRealitationApproved == 'Y'"
|
||||
>
|
||||
<v-icon small color="info">edit</v-icon>
|
||||
</v-btn>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<div class="mt-2 text-xs-center">
|
||||
<v-pagination
|
||||
v-model="detail_table_page" :total-visible="10"
|
||||
:length="calcTableLength()"
|
||||
></v-pagination>
|
||||
</div>
|
||||
</v-card>
|
||||
|
||||
<dialog-edit></dialog-edit>
|
||||
|
||||
<v-snackbar
|
||||
v-model="snackbar.isOpen" :timeout="3000" :multi-line="false"
|
||||
:vertical="false" :top="true" :color="snackbar.color"
|
||||
>
|
||||
{{ snackbar.message }}
|
||||
<v-btn class="px-2" flat @click="snackbar.isOpen = false">Tutup</v-btn>
|
||||
</v-snackbar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
module.exports = {
|
||||
components: {
|
||||
'dialog-edit': httpVueLoader('./adjustment_form.vue'),
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
headers: [
|
||||
{
|
||||
text: "NO", align: "center", sortable: false,
|
||||
value: "no", width: "10%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "NOMOR REQUEST", align: "center", sortable: false,
|
||||
value: "supplier", width: "35%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TOTAL", align: "center", sortable: false,
|
||||
value: "total", width: "20%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TAMBAHAN", align: "center", sortable: false,
|
||||
value: "total", width: "20%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI", align: "center", sortable: false,
|
||||
value: "status", width: "15%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
selected_voucher() {
|
||||
return this.$store.state.voucher.selected_voucher;
|
||||
},
|
||||
list_detail_voucher() {
|
||||
return this.$store.state.voucher.list_detail_voucher;
|
||||
},
|
||||
detail_table_page: {
|
||||
get() {
|
||||
return this.$store.state.voucher.detail_table_page;
|
||||
},
|
||||
set(val) {
|
||||
this,$store.commit("voucher/update_detail_table_page", val);
|
||||
this.$store.dispatch("voucher/searchDetail");
|
||||
}
|
||||
},
|
||||
snackbar: {
|
||||
get() {
|
||||
return this.$store.state.voucher.snackbar
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_snackbar", val);
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate(date) {
|
||||
if (!date) return null;
|
||||
const [year, month, day] = date.split("-");
|
||||
return `${day}-${month}-${year}`;
|
||||
},
|
||||
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.roundtoThreeDecimal(splitValue[1]);
|
||||
} else {
|
||||
return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||
}
|
||||
},
|
||||
roundtoThreeDecimal(digit) {
|
||||
const num = parseInt(digit, 10)
|
||||
if (isNaN(num) || num <= 0) {
|
||||
return '00';
|
||||
}
|
||||
|
||||
const scale = 10 ** digit.length;
|
||||
const decimal = num / scale;
|
||||
return Math.round(decimal * 100);
|
||||
},
|
||||
calcTableLength() {
|
||||
const total = this.list_detail_voucher.total;
|
||||
if (total == undefined || total == 0) return 1;
|
||||
return Math.ceil(total/10);
|
||||
},
|
||||
editDetailVoucher(item) {
|
||||
this.$store.commit("voucher/update_selected_detail_voucher", item)
|
||||
this.$store.commit("voucher/update_dialog_adjustment", true);
|
||||
},
|
||||
approveRealisasi() {
|
||||
this.$store.dispatch("voucher/approveRealisasi")
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,212 @@
|
||||
<template>
|
||||
<div style="width: 100%;" class="pa-1">
|
||||
<v-toolbar color="primary" dark>
|
||||
<v-toolbar-title class="white--text">APPROVE REALISASI</v-toolbar-title>
|
||||
</v-toolbar>
|
||||
|
||||
<v-card class="pa-2">
|
||||
<v-layout row>
|
||||
<v-flex xs class="pr-1">
|
||||
<v-menu
|
||||
:close-on-content-click="false" max-width="290px" full-width
|
||||
:nudge-right="40" lazy offset-y min width="290px"
|
||||
transition="scale-transition" v-model="menuStartDate"
|
||||
>
|
||||
<template v-slot:activator="{on}">
|
||||
<v-text-field
|
||||
label="Tanggal Awal" v-model="formatted_startdate"
|
||||
outline v-on="on" hide-details readonly
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker
|
||||
no-title v-model="filter.startdate"
|
||||
@input="menuStartDate = false"
|
||||
></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs class="px-1">
|
||||
<v-menu
|
||||
:close-on-content-click="false" max-width="290px" full-width
|
||||
:nudge-right="40" lazy offset-y min width="290px"
|
||||
transition="scale-transition" v-model="menuEndDate"
|
||||
>
|
||||
<template v-slot:activator="{on}">
|
||||
<v-text-field
|
||||
label="Tanggal Akhir" v-model="formatted_enddate"
|
||||
outline v-on="on" hide-details readonly
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker
|
||||
no-title v-model="filter.enddate"
|
||||
@input="menuEndDate = false"
|
||||
></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs class="px-1">
|
||||
<v-text-field
|
||||
label="Cari ..." placeholder="nomor"
|
||||
outline hide-details v-model="filter.search"
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex shrink class="pl-1 self-end">
|
||||
<v-btn
|
||||
dark color="primary" @click="searchVoucher()"
|
||||
style="min-width: 50px; height: 50px; margin: 0"
|
||||
>
|
||||
<v-icon>search</v-icon>
|
||||
</v-btn>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card>
|
||||
<v-card class="mt-2 pa-2">
|
||||
<v-data-table
|
||||
:items="listing_voucher.records" :headers="headers"
|
||||
hide-actions class="elevation-1"
|
||||
>
|
||||
<template slot="items" slot-scope="props">
|
||||
<tr
|
||||
:class="{'amber lighten-4': isSelected(props.item) }"
|
||||
@click="selectVoucher(props.item)"
|
||||
>
|
||||
<td class="text-xs-left pa-2">
|
||||
<p class="mb-0 font-weight-bold">{{ props.item.PaymentVoucherNumber }}</p>
|
||||
<p class="mb-0 info--text mono font-weight-bold caption">
|
||||
{{ props.item.PaymentVoucherDate }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="text-xs-left pa-2">
|
||||
<p class="mb-0">{{ props.item.M_BranchName }}</p>
|
||||
<p class="mb-0 font-weight-bold" style="color:#000000">
|
||||
Total : Rp {{ one_money(props.item.PaymentVoucherTotal) }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="text-xs-left pa-2">
|
||||
{{ props.item.PaymentVoucherRealitationDate }}
|
||||
</td>
|
||||
<td class="text-xs-left pa-2">
|
||||
<v-chip small>
|
||||
{{ props.item.PaymentVoucherRealitationApproved == "N" ? 'Not Verified' : 'Verified'}}
|
||||
</v-chip>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
<div class="mt-2 text-xs-center">
|
||||
<v-pagination
|
||||
v-model="main_table_page" :total-visible="5"
|
||||
:length="calcTableLength()"
|
||||
></v-pagination>
|
||||
</div>
|
||||
</v-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
mounted() {
|
||||
this.$store.dispatch("voucher/search")
|
||||
this.$store.dispatch("voucher/getListAccount")
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
menuStartDate: false,
|
||||
menuEndDate: false,
|
||||
headers: [
|
||||
{
|
||||
text: "NO / TANGGAL", align: "left", sortable: false,
|
||||
value: "no", width: "25%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "PENERIMA", align: "left", sortable: false,
|
||||
value: "supplier", width: "30%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "TANGGAL REALISASI", align: "left", sortable: false,
|
||||
value: "total", width: "25%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "STATUS", align: "left", sortable: false,
|
||||
value: "status", width: "25%", class: "blue lighten-3 white--text",
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
filter: {
|
||||
get() {
|
||||
return this.$store.state.voucher.filter;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_filter", val);
|
||||
}
|
||||
},
|
||||
main_table_page: {
|
||||
get() {
|
||||
return this.$store.state.voucher.main_table_page;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("voucher/update_main_table_page", val);
|
||||
this.$store.dispatch("voucher/search");
|
||||
}
|
||||
},
|
||||
selected_voucher() {
|
||||
return this.$store.state.voucher.selected_voucher;
|
||||
},
|
||||
listing_voucher() {
|
||||
return this.$store.state.voucher.listing_voucher;
|
||||
},
|
||||
formatted_startdate() {
|
||||
return this.formatDate(this.filter.startdate);
|
||||
},
|
||||
formatted_enddate() {
|
||||
return this.formatDate(this.filter.enddate);
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
formatDate(date) {
|
||||
if (!date) return null;
|
||||
const [year, month, day] = date.split("-");
|
||||
return `${day}-${month}-${year}`;
|
||||
},
|
||||
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.roundtoThreeDecimal(splitValue[1]);
|
||||
} else {
|
||||
return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||
}
|
||||
},
|
||||
roundtoThreeDecimal(digit) {
|
||||
const num = parseInt(digit, 10)
|
||||
if (isNaN(num) || num <= 0) {
|
||||
return '00';
|
||||
}
|
||||
|
||||
const scale = 10 ** digit.length;
|
||||
const decimal = num / scale
|
||||
return Math.round(decimal * 100);
|
||||
},
|
||||
searchVoucher() {
|
||||
this.$store.dispatch("voucher/search")
|
||||
},
|
||||
isSelected(item) {
|
||||
let selected = this.selected_voucher
|
||||
|
||||
if (selected) {
|
||||
return (item.PaymentVoucherNumber == selected.PaymentVoucherNumber);
|
||||
}
|
||||
},
|
||||
selectVoucher(item) {
|
||||
this.$store.commit("voucher/update_selected_voucher", item);
|
||||
this.$store.dispatch("voucher/searchDetail")
|
||||
},
|
||||
calcTableLength() {
|
||||
const total = this.listing_voucher.total;
|
||||
if (total == undefined || total == 0) return 1;
|
||||
return Math.ceil(total / 8);
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user