feat(invoice): refs #8388 update tax calculations and improve date filtering logic
gitea/salix-front/pipeline/pr-dev This commit is unstable Details

This commit is contained in:
Jorge Penadés 2025-04-22 18:18:42 +02:00
parent 753fa8489c
commit 1c594173fe
4 changed files with 10 additions and 3 deletions

View File

@ -26,7 +26,12 @@ const invoiceId = +route.params.id;
const filter = { where: { invoiceInFk: invoiceId } }; const filter = { where: { invoiceInFk: invoiceId } };
const areRows = ref(false); const areRows = ref(false);
const totalTaxableBase = ref(); const totalTaxableBase = ref();
const noMatch = computed(() => totalAmount.value != totalTaxableBase.value); const totalVat = ref();
const noMatch = computed(
() =>
totalAmount.value != totalTaxableBase.value &&
totalAmount.value != totalVat.value,
);
const columns = computed(() => [ const columns = computed(() => [
{ {
name: 'duedate', name: 'duedate',
@ -78,6 +83,7 @@ async function insert() {
async function setTaxableBase() { async function setTaxableBase() {
const { data } = await axios.get(`InvoiceIns/${invoiceId}/getTotals`); const { data } = await axios.get(`InvoiceIns/${invoiceId}/getTotals`);
totalTaxableBase.value = data.totalTaxableBase; totalTaxableBase.value = data.totalTaxableBase;
totalVat.value = data.totalVat;
} }
onBeforeMount(async () => await setTaxableBase()); onBeforeMount(async () => await setTaxableBase());

View File

@ -363,6 +363,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<QTd>{{ toCurrency(entity.totals.totalTaxableBase) }}</QTd> <QTd>{{ toCurrency(entity.totals.totalTaxableBase) }}</QTd>
<QTd></QTd> <QTd></QTd>
<QTd></QTd> <QTd></QTd>
<QTd></QTd>
<QTd>{{ toCurrency(getTotalTax(entity.invoiceInTax)) }}</QTd> <QTd>{{ toCurrency(getTotalTax(entity.invoiceInTax)) }}</QTd>
<QTd>{{ <QTd>{{
entity.totals.totalTaxableBaseForeignValue && entity.totals.totalTaxableBaseForeignValue &&

View File

@ -470,7 +470,7 @@ function setCursor(ref) {
size="lg" size="lg"
v-shortcut="'+'" v-shortcut="'+'"
round round
@click="invoiceInFormRef.insert()" @click="invoiceInFormRef.insert({ isDeductible: true })"
> >
<QTooltip>{{ t('Add tax') }}</QTooltip> <QTooltip>{{ t('Add tax') }}</QTooltip>
</QBtn> </QBtn>

View File

@ -41,7 +41,7 @@ async function checkToBook(id) {
params: { params: {
where: JSON.stringify({ where: JSON.stringify({
invoiceInFk: id, invoiceInFk: id,
dueDated: { gte: Date.vnNew() }, dueDated: { lte: Date.vnNew() },
}), }),
}, },
}) })