#6942 improve invoiceIn #220

Merged
jorgep merged 63 commits from 6942-improveInvoceIn into dev 2024-05-29 07:03:46 +00:00
5 changed files with 65 additions and 70 deletions
Showing only changes of commit 4a6d09ae2c - Show all commits

View File

@ -370,7 +370,10 @@ const createInvoiceInCorrection = async () => {
<template #body="{ entity }">
<VnLv :label="t('invoiceIn.card.issued')" :value="toDate(entity.issued)" />
<VnLv :label="t('invoiceIn.summary.booked')" :value="toDate(entity.booked)" />
<VnLv :label="t('invoiceIn.card.amount')" :value="toCurrency(totalAmount)" />
<VnLv
:label="t('invoiceIn.card.amount')"
:value="toCurrency(totalAmount, entity.currency?.code)"
/>
<VnLv :label="t('invoiceIn.summary.supplier')">
<template #value>
<span class="link">

View File

@ -23,11 +23,7 @@ const invoiceId = route.params.id;
const placeholder = 'yyyy/mm/dd';
const filter = {
where: {
invoiceInFk: invoiceId,
},
};
const filter = { where: { invoiceInFk: invoiceId } };
const columns = computed(() => [
{
@ -192,8 +188,9 @@ const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount,
<QTd />
<QTd />
<QTd>
jorgep marked this conversation as resolved
Review

http://localhost:9000/#/invoice-in/4/due-day al entrar en esta seccion me dice Access Denied en ingles con developer, cuando en realidad esta seccion la deben de poder usar el rol administrative.

http://localhost:9000/#/invoice-in/4/due-day al entrar en esta seccion me dice Access Denied en ingles con developer, cuando en realidad esta seccion la deben de poder usar el rol administrative.
Review

A mi no me da ningún fallo . Compruebalo de nuevo y me dices.

A mi no me da ningún fallo . Compruebalo de nuevo y me dices.
Review

No me da fallo.
Pregunta: la fecha y el placeholder está como yyyy/mm/dd, es correcto?

No me da fallo. Pregunta: la fecha y el placeholder está como yyyy/mm/dd, es correcto?
Review

@jsegarra Ahora se usa VnInputDate.

@jsegarra Ahora se usa VnInputDate.
{{ getTotalAmount(rows) }} ||
{{ toCurrency(getTotalAmount(rows)) }}
{{
toCurrency(getTotalAmount(rows), invoiceIn.currency.code)
}}
</QTd>
<QTd />
</QTr>

View File

@ -6,26 +6,18 @@ import { toCurrency } from 'src/filters';
import CrudModel from 'src/components/CrudModel.vue';
import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import VnLv from 'src/components/ui/VnLv.vue';
import { useArrayData } from 'src/composables/useArrayData';
const { t } = useI18n();
const route = useRoute();
const currency = computed(() => useArrayData('invoiceIn').store.data?.currency?.code);
const invoceInIntrastat = ref([]);
const amountTotal = computed(() => getTotal('amount'));
const netTotal = computed(() => getTotal('net'));
const stemsTotal = computed(() => getTotal('stems'));
const rowsSelected = ref([]);
const countries = ref([]);
const intrastats = ref([]);
const invoiceInFormRef = ref();
const filter = {
where: {
invoiceInFk: route.params.id,
},
};
const invoiceInId = computed(() => +useRoute().params.id);
const filter = { where: { invoiceInFk: invoiceInId.value } };
const columns = computed(() => [
{
name: 'code',
@ -77,13 +69,8 @@ const columns = computed(() => [
},
]);
function getTotal(type) {
if (!invoceInIntrastat.value.length) return 0.0;
return invoceInIntrastat.value.reduce(
(total, intrastat) => total + intrastat[type],
0.0
);
}
const getTotal = (data, key) =>
data.reduce((acc, cur) => acc + +String(cur[key]).replace(',', '.'), 0);

Si se escribe la coma, te devuelve NaN

Si se escribe la coma, te devuelve NaN
</script>
<template>
<FetchData
@ -99,30 +86,12 @@ function getTotal(type) {
@on-fetch="(data) => (intrastats = data)"
/>
<div class="invoiceIn-intrastat">
<QCard v-if="invoceInIntrastat.length" class="full-width q-mb-md q-pa-sm">
<QItem class="justify-end">
<div>
<QItemLabel>
<VnLv
:label="t('Total amount')"
:value="toCurrency(amountTotal)"
/>
</QItemLabel>
<QItemLabel>
<VnLv :label="t('Total net')" :value="netTotal" />
</QItemLabel>
<QItemLabel>
<VnLv :label="t('Total stems')" :value="stemsTotal" />
</QItemLabel>
</div>
</QItem>
</QCard>
<CrudModel
ref="invoiceInFormRef"
data-key="InvoiceInIntrastats"
url="InvoiceInIntrastats"
auto-load
:data-required="{ invoiceInFk: route.params.id }"
:auto-load="!currency"

espera a que se carguen los datos de arrayData, ya que hace falta saber el currency

espera a que se carguen los datos de arrayData, ya que hace falta saber el currency
:data-required="{ invoiceInFk: invoiceInId }"
:filter="filter"
v-model:selected="rowsSelected"
@on-fetch="(data) => (invoceInIntrastat = data)"
@ -172,6 +141,22 @@ function getTotal(type) {
/>
</QTd>
</template>
<template #bottom-row>
<QTr class="bg">
<QTd />
<QTd />
<QTd>
{{ toCurrency(getTotal(rows, 'amount'), currency) }}
</QTd>
<QTd>
{{ getTotal(rows, 'net') }}
</QTd>
<QTd>
{{ getTotal(rows, 'stems') }}
</QTd>
<QTd />
</QTr>
</template>
<template #item="props">
<div class="q-pa-xs col-xs-12 col-sm-6 grid-style-transition">
<QCard>

View File

@ -16,7 +16,7 @@ const { t } = useI18n();
const entityId = computed(() => props.id || useRoute().params.id);
const invoiceIn = computed(() => useArrayData('InvoiceIn').store.data);
const currency = computed(() => invoiceIn.value?.currency?.code);
const invoiceInUrl = ref();
const amountsNotMatch = ref(null);
const intrastatTotals = ref({ amount: 0, net: 0, stems: 0 });
@ -33,7 +33,7 @@ const vatColumns = ref([
name: 'landed',
label: 'invoiceIn.summary.taxableBase',
field: (row) => row.taxableBase,
format: (value) => toCurrency(value),
format: (value) => toCurrency(value, currency.value),
sortable: true,
align: 'left',
},
@ -62,7 +62,7 @@ const vatColumns = ref([
name: 'rate',
label: 'invoiceIn.summary.rate',
field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate),
format: (value) => toCurrency(value),
format: (value) => toCurrency(value, currency.value),
sortable: true,
align: 'left',
},
@ -95,7 +95,7 @@ const dueDayColumns = ref([
name: 'amount',
label: 'invoiceIn.summary.amount',
field: (row) => row.amount,
format: (value) => toCurrency(value),
format: (value) => toCurrency(value, currency.value),
sortable: true,
align: 'left',
},
@ -122,7 +122,7 @@ const intrastatColumns = ref([
{
name: 'amount',
label: 'invoiceIn.summary.amount',
field: (row) => toCurrency(row.amount),
field: (row) => toCurrency(row.amount, currency.value),
sortable: true,
align: 'left',
},
@ -278,7 +278,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
/>
<VnLv
:label="t('invoiceIn.summary.booked')"
:value="invoiceIn.isBooked"
:value="invoiceIn?.isBooked"
/>
</QCard>
<QCard class="vn-one">
@ -291,9 +291,12 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<QCardSection class="q-pa-none">
<VnLv
:label="t('invoiceIn.summary.taxableBase')"
:value="toCurrency(entity.totals.totalTaxableBase)"
:value="toCurrency(entity.totals.totalTaxableBase, currency)"
/>
<VnLv
label="Total"
:value="toCurrency(entity.totals.totalVat, currency)"
/>
<VnLv label="Total" :value="toCurrency(entity.totals.totalVat)" />
<VnLv :label="t('invoiceIn.summary.dueTotal')">
<template #value>
<QChip
@ -306,7 +309,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
: t('invoiceIn.summary.dueTotal')
"
>
{{ toCurrency(entity.totals.totalDueDay) }}
{{ toCurrency(entity.totals.totalDueDay, currency) }}
</QChip>
</template>
jorgep marked this conversation as resolved Outdated

lo pongo aqui pero no es esta linea
en la seccion iva del summary en los campos sage vat y sage transaccion quieren en la columna sage vat que aparezca:
8 : H.P. IVA 21% CEE
20 : Adquisic.intracomunitarias de bienes y serv.corr.

es decir, añadir la clave primaria

lo pongo aqui pero no es esta linea en la seccion iva del summary en los campos sage vat y sage transaccion quieren en la columna sage vat que aparezca: 8 : H.P. IVA 21% CEE 20 : Adquisic.intracomunitarias de bienes y serv.corr. es decir, añadir la clave primaria
</VnLv>
@ -335,10 +338,14 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<template #bottom-row>
<QTr class="bg">
<QTd></QTd>
<QTd>{{ toCurrency(entity.totals.totalTaxableBase) }}</QTd>
<QTd>{{
toCurrency(entity.totals.totalTaxableBase, currency)
}}</QTd>
<QTd></QTd>
<QTd></QTd>
<QTd>{{ toCurrency(getTotalTax(entity.invoiceInTax)) }}</QTd>
<QTd>{{
toCurrency(getTotalTax(entity.invoiceInTax, currency))
}}</QTd>
<QTd></QTd>
</QTr>
</template>
@ -368,7 +375,9 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<QTr class="bg">
<QTd></QTd>
<QTd></QTd>
<QTd>{{ toCurrency(entity.totals.totalDueDay) }}</QTd>
<QTd>{{
toCurrency(entity.totals.totalDueDay, currency)
}}</QTd>
<QTd></QTd>
</QTr>
</template>
@ -399,7 +408,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
<template #bottom-row>
<QTr class="bg">
<QTd></QTd>
<QTd>{{ toCurrency(intrastatTotals.amount) }}</QTd>
<QTd>{{ toCurrency(intrastatTotals.amount, currency) }}</QTd>
<QTd>{{ intrastatTotals.net }}</QTd>
<QTd>{{ intrastatTotals.stems }}</QTd>
<QTd></QTd>

View File

@ -17,8 +17,8 @@ const quasar = useQuasar();
const arrayData = useArrayData('InvoiceIn');
const invoiceIn = computed(() => arrayData.store.data);
const invoiceId = currentRoute.value.params.id;
const invoiceId = +currentRoute.value.params.id;
const currency = computed(() => invoiceIn.value?.currency?.code);
const expenses = ref([]);
const sageTaxTypes = ref([]);
const sageTransactionTypes = ref([]);
@ -56,7 +56,7 @@ const columns = computed(() => [
{
name: 'taxablebase',
label: t('Taxable base'),
field: (row) => toCurrency(row.taxableBase),
field: (row) => toCurrency(row.taxableBase, currency.value),
model: 'taxableBase',
sortable: true,
tabIndex: 2,
@ -91,7 +91,7 @@ const columns = computed(() => [
label: t('Rate'),
sortable: true,
tabIndex: 5,
field: (row) => toCurrency(taxRate(row, row.taxTypeSageFk)),
field: (row) => toCurrency(taxRate(row, row.taxTypeSageFk), currency.value),
align: 'left',
},
{
@ -162,8 +162,9 @@ async function addExpense() {
});
}
}
const getTotalTaxableBase = (rows) => rows.reduce((acc, cur) => acc + cur.taxableBase, 0);
const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + taxRate(cur), 0);
const getTotalTaxableBase = (rows) =>
rows.reduce((acc, { taxableBase }) => acc + +taxableBase, 0);
const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0);
</script>
<template>
<FetchData
@ -312,11 +313,11 @@ const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + taxRate(cur), 0);
<QTd />
<QTd />
<QTd>
{{ toCurrency(getTotalTaxableBase(rows)) }}
{{ toCurrency(getTotalTaxableBase(rows), currency) }}
</QTd>
<QTd />
jorgep marked this conversation as resolved
Review

En esta seccion en los desplegables Sage iva, transactionTypeSageFk no quieren ver la descripcion solo la clave primaria de la tabla. si despliegan veran el valor

En esta seccion en los desplegables Sage iva, transactionTypeSageFk no quieren ver la descripcion solo la clave primaria de la tabla. si despliegan veran el valor
<QTd />
<QTd> {{ toCurrency(getTotalRate(rows)) }}</QTd>
<QTd> {{ toCurrency(getTotalRate(rows), currency) }}</QTd>
<QTd />
</QTr>
</template>
@ -408,7 +409,7 @@ const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + taxRate(cur), 0);
</VnSelect>
</QItem>
<QItem>
{{ toCurrency(taxRate(props.row)) }}
{{ toCurrency(taxRate(props.row), currency) }}
</QItem>
<QItem>
<QInput