Merge branch 'develop'
This commit is contained in:
commit
35fbedd74f
8 changed files with 131 additions and 56 deletions
|
|
@ -57,11 +57,18 @@ const currentBtnOpen = ref<{ title: string; opened: boolean[] }[]>([
|
|||
]);
|
||||
|
||||
function calcPrice(c: (typeof rows.value)[number]) {
|
||||
const price = c.pricePerUnit * c.amount;
|
||||
const originalPrice = c.pricePerUnit;
|
||||
const finalPriceWithVat = precisionRound(
|
||||
originalPrice +
|
||||
(c.product.vatIncluded || c.vat !== 0
|
||||
? 0
|
||||
: originalPrice * (config.value?.vat || 0.07)),
|
||||
);
|
||||
const finalPriceNoVat = finalPriceWithVat / (1 + (config.value?.vat || 0.07));
|
||||
|
||||
const price = finalPriceNoVat * c.amount;
|
||||
const vat = c.product.calcVat
|
||||
? (c.pricePerUnit * (c.discount ? c.amount : 1) - c.discount) *
|
||||
(config.value?.vat || 0.07) *
|
||||
(!c.discount ? c.amount : 1)
|
||||
? (finalPriceNoVat * c.amount - c.discount) * (config.value?.vat || 0.07)
|
||||
: 0;
|
||||
return precisionRound(price + vat);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ defineEmits<{
|
|||
|
||||
<q-td v-if="visibleColumns.includes('workName')">
|
||||
<div class="column">
|
||||
<div class="col-6">{{ props.row.workName }}</div>
|
||||
<div class="col-6">{{ props.row.workName || '-' }}</div>
|
||||
<div class="col-6 app-text-muted">{{ props.row.code }}</div>
|
||||
</div>
|
||||
</q-td>
|
||||
|
|
@ -83,7 +83,7 @@ defineEmits<{
|
|||
</q-td>
|
||||
|
||||
<q-td v-if="visibleColumns.includes('contactName')">
|
||||
{{ props.row.contactName }}
|
||||
{{ props.row.contactName || '-' }}
|
||||
</q-td>
|
||||
|
||||
<q-td v-if="visibleColumns.includes('actor')">
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ const pageState = reactive({
|
|||
hideStat: false,
|
||||
inputSearch: '',
|
||||
fieldSelected: [''],
|
||||
gridView: true,
|
||||
gridView: false,
|
||||
total: 0,
|
||||
|
||||
currentTab: 'Issued',
|
||||
|
|
|
|||
|
|
@ -242,18 +242,26 @@ function getPrice(
|
|||
return a;
|
||||
}
|
||||
|
||||
const price = c.pricePerUnit * c.amount;
|
||||
const originalPrice = c.pricePerUnit;
|
||||
const finalPriceWithVat = precisionRound(
|
||||
originalPrice +
|
||||
(c.product.vatIncluded
|
||||
? 0
|
||||
: originalPrice * (config.value?.vat || 0.07)),
|
||||
);
|
||||
const finalPriceNoVat =
|
||||
finalPriceWithVat / (1 + (config.value?.vat || 0.07));
|
||||
|
||||
const price = finalPriceNoVat * c.amount;
|
||||
const vat =
|
||||
(c.pricePerUnit * (c.discount ? c.amount : 1) - c.discount) *
|
||||
(config.value?.vat || 0.07) *
|
||||
(!c.discount ? c.amount : 1);
|
||||
(finalPriceNoVat * c.amount - c.discount) * (config.value?.vat || 0.07);
|
||||
|
||||
a.totalPrice = precisionRound(a.totalPrice + price);
|
||||
a.totalDiscount = precisionRound(a.totalDiscount + Number(c.discount));
|
||||
a.vat = c.product.calcVat ? precisionRound(a.vat + vat) : a.vat;
|
||||
a.vatExcluded = c.product.calcVat
|
||||
? a.vatExcluded
|
||||
: precisionRound(a.vat + vat);
|
||||
: precisionRound(a.vatExcluded + vat);
|
||||
a.finalPrice = precisionRound(
|
||||
a.totalPrice -
|
||||
a.totalDiscount +
|
||||
|
|
@ -704,12 +712,12 @@ function handleUpdateProductTable(
|
|||
const pricePerUnit = c.pricePerUnit || 0;
|
||||
const discount = c.discount || 0;
|
||||
|
||||
return precisionRound(
|
||||
return (
|
||||
pricePerUnit * c.amount -
|
||||
discount +
|
||||
(c.product.calcVat
|
||||
? (pricePerUnit * c.amount - discount) * (config.value?.vat || 0.07)
|
||||
: 0),
|
||||
discount +
|
||||
(c.product.calcVat
|
||||
? (pricePerUnit * c.amount - discount) * (config.value?.vat || 0.07)
|
||||
: 0)
|
||||
);
|
||||
};
|
||||
|
||||
|
|
@ -767,17 +775,15 @@ function toggleDeleteProduct(index: number) {
|
|||
? currProduct.product.agentPrice
|
||||
: currProduct.product.price;
|
||||
const pricePerUnit = currProduct.product.vatIncluded
|
||||
? precisionRound(price / (1 + (config.value?.vat || 0.07)))
|
||||
? price / (1 + (config.value?.vat || 0.07))
|
||||
: price;
|
||||
const vat = precisionRound(
|
||||
const vat =
|
||||
(pricePerUnit * currProduct.amount - currProduct.discount) *
|
||||
(config.value?.vat || 0.07),
|
||||
);
|
||||
const finalPrice = precisionRound(
|
||||
(config.value?.vat || 0.07);
|
||||
const finalPrice =
|
||||
pricePerUnit * currProduct.amount +
|
||||
vat -
|
||||
Number(currProduct.discount || 0),
|
||||
);
|
||||
vat -
|
||||
Number(currProduct.discount || 0);
|
||||
|
||||
currTempPaySplit.amount = currPaySplit.amount - finalPrice;
|
||||
currPaySplit.amount = currTempPaySplit.amount;
|
||||
|
|
|
|||
|
|
@ -228,23 +228,33 @@ onMounted(async () => {
|
|||
|
||||
productList.value =
|
||||
(data?.value?.productServiceList ?? data.value?.productServiceList).map(
|
||||
(v) => ({
|
||||
id: v.product.id,
|
||||
code: v.product.code,
|
||||
detail: v.product.name,
|
||||
amount: v.amount || 0,
|
||||
priceUnit: v.pricePerUnit || 0,
|
||||
discount: v.discount || 0,
|
||||
vat: v.vat || 0,
|
||||
value: precisionRound(
|
||||
(v.pricePerUnit || 0) * v.amount -
|
||||
(v.discount || 0) +
|
||||
(v.product.calcVat
|
||||
? ((v.pricePerUnit || 0) * v.amount - (v.discount || 0)) *
|
||||
(config.value?.vat || 0.07)
|
||||
: 0),
|
||||
),
|
||||
}),
|
||||
(v) => {
|
||||
const originalPrice = v.pricePerUnit;
|
||||
const finalPriceWithVat = precisionRound(
|
||||
originalPrice +
|
||||
(v.product.vatIncluded || v.vat !== 0
|
||||
? 0
|
||||
: originalPrice * (config.value?.vat || 0.07)),
|
||||
);
|
||||
const finalPriceNoVat =
|
||||
finalPriceWithVat / (1 + (config.value?.vat || 0.07));
|
||||
|
||||
const price = finalPriceNoVat * v.amount;
|
||||
const vat =
|
||||
(finalPriceNoVat * v.amount - v.discount) *
|
||||
(config.value?.vat || 0.07);
|
||||
|
||||
return {
|
||||
id: v.product.id,
|
||||
code: v.product.code,
|
||||
detail: v.product.name,
|
||||
amount: v.amount || 0,
|
||||
priceUnit: v.pricePerUnit || 0,
|
||||
discount: v.discount || 0,
|
||||
vat: v.vat || 0,
|
||||
value: precisionRound(price + (v.product.calcVat ? vat : 0)),
|
||||
};
|
||||
},
|
||||
) || [];
|
||||
}
|
||||
|
||||
|
|
@ -253,18 +263,26 @@ onMounted(async () => {
|
|||
[]
|
||||
).reduce(
|
||||
(a, c) => {
|
||||
const price = precisionRound((c.pricePerUnit || 0) * c.amount);
|
||||
const vat = precisionRound(
|
||||
((c.pricePerUnit || 0) * c.amount - (c.discount || 0)) *
|
||||
(config.value?.vat || 0.07),
|
||||
const originalPrice = c.pricePerUnit;
|
||||
const finalPriceWithVat = precisionRound(
|
||||
originalPrice +
|
||||
(c.product.vatIncluded || c.vat !== 0
|
||||
? 0
|
||||
: originalPrice * (config.value?.vat || 0.07)),
|
||||
);
|
||||
const finalPriceNoVat =
|
||||
finalPriceWithVat / (1 + (config.value?.vat || 0.07));
|
||||
|
||||
const price = finalPriceNoVat * c.amount;
|
||||
const vat =
|
||||
(finalPriceNoVat * c.amount - c.discount) * (config.value?.vat || 0.07);
|
||||
|
||||
a.totalPrice = precisionRound(a.totalPrice + price);
|
||||
a.totalDiscount = precisionRound(a.totalDiscount + Number(c.discount));
|
||||
a.vat = c.product.calcVat ? precisionRound(a.vat + vat) : a.vat;
|
||||
a.vatExcluded = c.product.calcVat
|
||||
? a.vatExcluded
|
||||
: precisionRound(a.vat + vat);
|
||||
: precisionRound(a.vatExcluded + vat);
|
||||
a.finalPrice = precisionRound(
|
||||
a.totalPrice -
|
||||
a.totalDiscount +
|
||||
|
|
|
|||
|
|
@ -116,6 +116,10 @@ function openReceiveDialog(scan?: boolean) {
|
|||
pageState.receiveDialog = true;
|
||||
}
|
||||
|
||||
async function deleteTaskOrder() {
|
||||
console.log('delete');
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
navigatorStore.current.title = 'taskOrder.title';
|
||||
navigatorStore.current.path = [{ text: 'taskOrder.caption', i18n: true }];
|
||||
|
|
@ -441,6 +445,8 @@ watch(
|
|||
: triggerTaskOrder({ statusDialog: 'info', id: v.id });
|
||||
}
|
||||
"
|
||||
@edit="console.log('edit')"
|
||||
@delete="deleteTaskOrder"
|
||||
/>
|
||||
</article>
|
||||
|
||||
|
|
|
|||
|
|
@ -105,6 +105,8 @@ function openList(index: number, data: TaskOrder) {
|
|||
|
||||
const emit = defineEmits<{
|
||||
(e: 'view', data: TaskOrder): void;
|
||||
(e: 'edit', data: TaskOrder): void;
|
||||
(e: 'delete', data: TaskOrder): void;
|
||||
(e: 'clickSubRow', index: number, data: TaskOrder): void;
|
||||
}>();
|
||||
</script>
|
||||
|
|
@ -205,14 +207,16 @@ const emit = defineEmits<{
|
|||
flat
|
||||
@click.stop="$emit('view', props.row)"
|
||||
/>
|
||||
|
||||
<KebabAction
|
||||
v-if="false"
|
||||
v-if="
|
||||
!receive && props.row.taskOrderStatus === TaskOrderStatus.Pending
|
||||
"
|
||||
:idName="`btn-kebab-${props.row.taskName}`"
|
||||
status="'ACTIVE'"
|
||||
hide-toggle
|
||||
:hide-edit="true"
|
||||
@view="$emit('view', props.row)"
|
||||
@edit="$emit('edit', props.row)"
|
||||
@delete="$emit('delete', props.row)"
|
||||
/>
|
||||
</q-td>
|
||||
<q-td v-else>
|
||||
|
|
@ -254,8 +258,10 @@ const emit = defineEmits<{
|
|||
<QuotationCard
|
||||
:status="$t(taskOrderStatus(props.row.taskOrderStatus, 'status'))"
|
||||
:badge-color="taskOrderStatus(props.row.taskOrderStatus, 'color')"
|
||||
hide-action
|
||||
hidePreview
|
||||
hide-preview
|
||||
:hide-action="
|
||||
receive || props.row.taskOrderStatus !== TaskOrderStatus.Pending
|
||||
"
|
||||
:code="props.row.code"
|
||||
:title="props.row.taskName"
|
||||
:custom-data="[
|
||||
|
|
@ -296,6 +302,8 @@ const emit = defineEmits<{
|
|||
},
|
||||
]"
|
||||
@view="$emit('view', props.row)"
|
||||
@edit="$emit('edit', props.row)"
|
||||
@delete="$emit('delete', props.row)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,12 @@ import AdditionalFileExpansion from '../expansion/AdditionalFileExpansion.vue';
|
|||
import RemarkExpansion from '../expansion/RemarkExpansion.vue';
|
||||
import InfoMessengerExpansion from '../expansion/receive/InfoMessengerExpansion.vue';
|
||||
import TableEmployee from '../TableEmployee.vue';
|
||||
import { SaveButton, MainButton, EditButton } from 'src/components/button';
|
||||
import {
|
||||
SaveButton,
|
||||
MainButton,
|
||||
EditButton,
|
||||
UndoButton,
|
||||
} from 'src/components/button';
|
||||
import FormGroupHead from 'src/pages/08_request-list/FormGroupHead.vue';
|
||||
import FailRemarkDialog from '../receive_view/FailRemarkDialog.vue';
|
||||
|
||||
|
|
@ -412,6 +417,26 @@ function openProductDialog() {
|
|||
pageState.productDialog = true;
|
||||
}
|
||||
|
||||
async function closeTab() {
|
||||
if (state.value.mode === 'edit' && !!currentFormData.value.id) {
|
||||
taskOrderFormStore.resetForm();
|
||||
await taskOrderFormStore.assignFormData(currentFormData.value.id, 'edit');
|
||||
} else {
|
||||
dialogWarningClose(t, {
|
||||
message: t('dialog.message.close'),
|
||||
action: () => {
|
||||
window.close();
|
||||
},
|
||||
cancel: () => {},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function undo() {
|
||||
if (!currentFormData.value) return;
|
||||
taskOrderFormStore.assignFormData(currentFormData.value?.id || '', 'info');
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
initTheme();
|
||||
initLang();
|
||||
|
|
@ -1124,13 +1149,18 @@ watch([currentFormData.value.taskStatus], () => {
|
|||
{{ $t('general.view', { msg: $t('general.example') }) }}
|
||||
</MainButton>
|
||||
<div class="row" style="gap: var(--size-2)">
|
||||
<template v-if="state.mode === 'create'">
|
||||
<!-- <UndoButton outlined @click="undo()" v-if="state.mode === 'edit'" />
|
||||
<template
|
||||
v-if="
|
||||
fullTaskOrder?.taskOrderStatus === TaskOrderStatus.Pending ||
|
||||
state.mode === 'create'
|
||||
"
|
||||
>
|
||||
<UndoButton outlined @click="undo()" v-if="state.mode === 'edit'" />
|
||||
<CancelButton
|
||||
@click="closeTab()"
|
||||
v-if="state.mode === 'info'"
|
||||
outlined
|
||||
/> -->
|
||||
/>
|
||||
<SaveButton
|
||||
v-if="state.mode && ['create', 'edit'].includes(state.mode)"
|
||||
@click="() => formDocument.submit()"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue