#8388 fixInvoiceIn #1321
|
@ -171,7 +171,8 @@ onMounted(() => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const arrayDataKey =
|
const arrayDataKey =
|
||||||
$props.dataKey ?? ($props.url?.length > 0 ? $props.url : $attrs.name ?? $attrs.label);
|
$props.dataKey ??
|
||||||
|
($props.url?.length > 0 ? $props.url : ($attrs.name ?? $attrs.label));
|
||||||
|
|
||||||
const arrayData = useArrayData(arrayDataKey, {
|
const arrayData = useArrayData(arrayDataKey, {
|
||||||
url: $props.url,
|
url: $props.url,
|
||||||
|
@ -220,7 +221,7 @@ async function fetchFilter(val) {
|
||||||
optionFilterValue.value ??
|
optionFilterValue.value ??
|
||||||
(new RegExp(/\d/g).test(val)
|
(new RegExp(/\d/g).test(val)
|
||||||
? optionValue.value
|
? optionValue.value
|
||||||
: optionFilter.value ?? optionLabel.value);
|
: (optionFilter.value ?? optionLabel.value));
|
||||||
|
|
||||||
let defaultWhere = {};
|
let defaultWhere = {};
|
||||||
if ($props.filterOptions.length) {
|
if ($props.filterOptions.length) {
|
||||||
|
@ -239,7 +240,7 @@ async function fetchFilter(val) {
|
||||||
|
|
||||||
const { data } = await arrayData.applyFilter(
|
const { data } = await arrayData.applyFilter(
|
||||||
{ filter: filterOptions },
|
{ filter: filterOptions },
|
||||||
{ updateRouter: false }
|
{ updateRouter: false },
|
||||||
);
|
);
|
||||||
setOptions(data);
|
setOptions(data);
|
||||||
return data;
|
return data;
|
||||||
|
@ -272,7 +273,7 @@ async function filterHandler(val, update) {
|
||||||
ref.setOptionIndex(-1);
|
ref.setOptionIndex(-1);
|
||||||
ref.moveOptionSelection(1, true);
|
ref.moveOptionSelection(1, true);
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +309,7 @@ function handleKeyDown(event) {
|
||||||
if (inputValue) {
|
if (inputValue) {
|
||||||
const matchingOption = myOptions.value.find(
|
const matchingOption = myOptions.value.find(
|
||||||
(option) =>
|
(option) =>
|
||||||
option[optionLabel.value].toLowerCase() === inputValue.toLowerCase()
|
option[optionLabel.value].toLowerCase() === inputValue.toLowerCase(),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (matchingOption) {
|
if (matchingOption) {
|
||||||
|
@ -320,11 +321,11 @@ function handleKeyDown(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const focusableElements = document.querySelectorAll(
|
const focusableElements = document.querySelectorAll(
|
||||||
'a:not([disabled]), button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), details:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])'
|
'a:not([disabled]), button:not([disabled]), input:not([disabled]), textarea:not([disabled]), select:not([disabled]), details:not([disabled]), [tabindex]:not([tabindex="-1"]):not([disabled])',
|
||||||
);
|
);
|
||||||
const currentIndex = Array.prototype.indexOf.call(
|
const currentIndex = Array.prototype.indexOf.call(
|
||||||
focusableElements,
|
focusableElements,
|
||||||
event.target
|
event.target,
|
||||||
);
|
);
|
||||||
if (currentIndex >= 0 && currentIndex < focusableElements.length - 1) {
|
if (currentIndex >= 0 && currentIndex < focusableElements.length - 1) {
|
||||||
focusableElements[currentIndex + 1].focus();
|
focusableElements[currentIndex + 1].focus();
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { computed } from 'vue';
|
|
||||||
import VnSelect from 'components/common/VnSelect.vue';
|
import VnSelect from 'components/common/VnSelect.vue';
|
||||||
|
|
||||||
const model = defineModel({ type: [String, Number, Object] });
|
const model = defineModel({ type: [String, Number, Object] });
|
||||||
const url = 'Suppliers';
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -11,10 +9,11 @@ const url = 'Suppliers';
|
||||||
:label="$t('globals.supplier')"
|
:label="$t('globals.supplier')"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
v-model="model"
|
v-model="model"
|
||||||
:url="url"
|
url="Suppliers"
|
||||||
option-value="id"
|
option-value="id"
|
||||||
option-label="nickname"
|
option-label="nickname"
|
||||||
:fields="['id', 'name', 'nickname', 'nif']"
|
:fields="['id', 'name', 'nickname', 'nif']"
|
||||||
|
:filter-options="['id', 'name', 'nickname', 'nif']"
|
||||||
sort-by="name ASC"
|
sort-by="name ASC"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
|
|
|
@ -352,7 +352,7 @@ globals:
|
||||||
from: Desde
|
from: Desde
|
||||||
to: Hasta
|
to: Hasta
|
||||||
supplierFk: Proveedor
|
supplierFk: Proveedor
|
||||||
supplierRef: Ref. proveedor
|
supplierRef: Nº factura
|
||||||
serial: Serie
|
serial: Serie
|
||||||
amount: Importe
|
amount: Importe
|
||||||
awbCode: AWB
|
awbCode: AWB
|
||||||
|
|
|
@ -125,7 +125,7 @@ function deleteFile(dmsFk) {
|
||||||
<VnInput
|
<VnInput
|
||||||
clearable
|
clearable
|
||||||
clear-icon="close"
|
clear-icon="close"
|
||||||
:label="t('Supplier ref')"
|
:label="t('invoiceIn.supplierRef')"
|
||||||
v-model="data.supplierRef"
|
v-model="data.supplierRef"
|
||||||
/>
|
/>
|
||||||
</VnRow>
|
</VnRow>
|
||||||
|
@ -310,7 +310,6 @@ function deleteFile(dmsFk) {
|
||||||
supplierFk: Supplier
|
supplierFk: Supplier
|
||||||
es:
|
es:
|
||||||
supplierFk: Proveedor
|
supplierFk: Proveedor
|
||||||
Supplier ref: Ref. proveedor
|
|
||||||
Expedition date: Fecha expedición
|
Expedition date: Fecha expedición
|
||||||
Operation date: Fecha operación
|
Operation date: Fecha operación
|
||||||
Undeductible VAT: Iva no deducible
|
Undeductible VAT: Iva no deducible
|
||||||
|
|
|
@ -186,7 +186,7 @@ const createInvoiceInCorrection = async () => {
|
||||||
clickable
|
clickable
|
||||||
@click="book(entityId)"
|
@click="book(entityId)"
|
||||||
>
|
>
|
||||||
<QItemSection>{{ t('invoiceIn.descriptorMenu.toBook') }}</QItemSection>
|
<QItemSection>{{ t('invoiceIn.descriptorMenu.book') }}</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
</template>
|
</template>
|
||||||
</InvoiceInToBook>
|
</InvoiceInToBook>
|
||||||
|
@ -197,7 +197,7 @@ const createInvoiceInCorrection = async () => {
|
||||||
@click="triggerMenu('unbook')"
|
@click="triggerMenu('unbook')"
|
||||||
>
|
>
|
||||||
<QItemSection>
|
<QItemSection>
|
||||||
{{ t('invoiceIn.descriptorMenu.toUnbook') }}
|
{{ t('invoiceIn.descriptorMenu.unbook') }}
|
||||||
</QItemSection>
|
</QItemSection>
|
||||||
</QItem>
|
</QItem>
|
||||||
<QItem
|
<QItem
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed, onBeforeMount } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
@ -12,6 +12,7 @@ import VnSelect from 'src/components/common/VnSelect.vue';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
import VnInputDate from 'src/components/common/VnInputDate.vue';
|
||||||
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
import VnInputNumber from 'src/components/common/VnInputNumber.vue';
|
||||||
|
import { toCurrency } from 'filters/index';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
@ -26,7 +27,7 @@ const invoiceInFormRef = ref();
|
||||||
const invoiceId = +route.params.id;
|
const invoiceId = +route.params.id;
|
||||||
const filter = { where: { invoiceInFk: invoiceId } };
|
const filter = { where: { invoiceInFk: invoiceId } };
|
||||||
const areRows = ref(false);
|
const areRows = ref(false);
|
||||||
|
const totals = ref();
|
||||||
const columns = computed(() => [
|
const columns = computed(() => [
|
||||||
{
|
{
|
||||||
name: 'duedate',
|
name: 'duedate',
|
||||||
|
@ -66,6 +67,8 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const totalAmount = computed(() => getTotal(invoiceInFormRef.value.formData, 'amount'));
|
||||||
|
|
||||||
const isNotEuro = (code) => code != 'EUR';
|
const isNotEuro = (code) => code != 'EUR';
|
||||||
|
|
||||||
async function insert() {
|
async function insert() {
|
||||||
|
@ -73,6 +76,10 @@ async function insert() {
|
||||||
await invoiceInFormRef.value.reload();
|
await invoiceInFormRef.value.reload();
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
totals.value = (await axios.get(`InvoiceIns/${invoiceId}/getTotals`)).data;
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -153,7 +160,7 @@ async function insert() {
|
||||||
<QTd />
|
<QTd />
|
||||||
<QTd />
|
<QTd />
|
||||||
<QTd>
|
<QTd>
|
||||||
{{ getTotal(rows, 'amount', { currency: 'default' }) }}
|
{{ toCurrency(totalAmount) }}
|
||||||
</QTd>
|
</QTd>
|
||||||
<QTd>
|
<QTd>
|
||||||
<template v-if="isNotEuro(invoiceIn.currency.code)">
|
<template v-if="isNotEuro(invoiceIn.currency.code)">
|
||||||
|
@ -235,7 +242,16 @@ async function insert() {
|
||||||
v-shortcut="'+'"
|
v-shortcut="'+'"
|
||||||
size="lg"
|
size="lg"
|
||||||
round
|
round
|
||||||
@click="!areRows ? insert() : invoiceInFormRef.insert()"
|
@click="
|
||||||
|
() => {
|
||||||
|
if (!areRows) insert();
|
||||||
|
|||||||
|
else
|
||||||
|
invoiceInFormRef.insert({
|
||||||
|
amount: (totals.totalTaxableBase - totalAmount).toFixed(2),
|
||||||
|
invoiceInFk: invoiceId,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</QPageSticky>
|
</QPageSticky>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -193,7 +193,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
<InvoiceIntoBook>
|
<InvoiceIntoBook>
|
||||||
<template #content="{ book }">
|
<template #content="{ book }">
|
||||||
<QBtn
|
<QBtn
|
||||||
:label="t('To book')"
|
:label="t('Book')"
|
||||||
color="orange-11"
|
color="orange-11"
|
||||||
text-color="black"
|
text-color="black"
|
||||||
@click="book(entityId)"
|
@click="book(entityId)"
|
||||||
|
@ -224,10 +224,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
</span>
|
</span>
|
||||||
</template>
|
</template>
|
||||||
</VnLv>
|
</VnLv>
|
||||||
<VnLv
|
<VnLv :label="t('invoiceIn.supplierRef')" :value="entity.supplierRef" />
|
||||||
:label="t('invoiceIn.list.supplierRef')"
|
|
||||||
:value="entity.supplierRef"
|
|
||||||
/>
|
|
||||||
<VnLv
|
<VnLv
|
||||||
:label="t('invoiceIn.summary.currency')"
|
:label="t('invoiceIn.summary.currency')"
|
||||||
:value="entity.currency?.code"
|
:value="entity.currency?.code"
|
||||||
|
@ -357,7 +354,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
entity.totals.totalTaxableBaseForeignValue &&
|
entity.totals.totalTaxableBaseForeignValue &&
|
||||||
toCurrency(
|
toCurrency(
|
||||||
entity.totals.totalTaxableBaseForeignValue,
|
entity.totals.totalTaxableBaseForeignValue,
|
||||||
currency
|
currency,
|
||||||
)
|
)
|
||||||
}}</QTd>
|
}}</QTd>
|
||||||
</QTr>
|
</QTr>
|
||||||
|
@ -392,7 +389,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
entity.totals.totalDueDayForeignValue &&
|
entity.totals.totalDueDayForeignValue &&
|
||||||
toCurrency(
|
toCurrency(
|
||||||
entity.totals.totalDueDayForeignValue,
|
entity.totals.totalDueDayForeignValue,
|
||||||
currency
|
currency,
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
</QTd>
|
</QTd>
|
||||||
|
@ -472,5 +469,5 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
|
||||||
Search invoice: Buscar factura recibida
|
Search invoice: Buscar factura recibida
|
||||||
You can search by invoice reference: Puedes buscar por referencia de la factura
|
You can search by invoice reference: Puedes buscar por referencia de la factura
|
||||||
Totals: Totales
|
Totals: Totales
|
||||||
To book: Contabilizar
|
Book: Contabilizar
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed, nextTick } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useRoute } from 'vue-router';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
@ -25,7 +25,6 @@ const sageTaxTypes = ref([]);
|
||||||
const sageTransactionTypes = ref([]);
|
const sageTransactionTypes = ref([]);
|
||||||
const rowsSelected = ref([]);
|
const rowsSelected = ref([]);
|
||||||
const invoiceInFormRef = ref();
|
const invoiceInFormRef = ref();
|
||||||
const expenseRef = ref();
|
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
actionIcon: {
|
actionIcon: {
|
||||||
|
@ -97,6 +96,20 @@ const columns = computed(() => [
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const taxableBaseTotal = computed(() => {
|
||||||
|
return getTotal(invoiceInFormRef.value.formData, 'taxableBase');
|
||||||
|
});
|
||||||
|
|
||||||
|
const taxRateTotal = computed(() => {
|
||||||
|
return getTotal(invoiceInFormRef.value.formData, null, {
|
||||||
|
cb: taxRate,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const combinedTotal = computed(() => {
|
||||||
|
return +taxableBaseTotal.value + +taxRateTotal.value;
|
||||||
|
});
|
||||||
|
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: [
|
fields: [
|
||||||
'id',
|
'id',
|
||||||
|
@ -125,7 +138,7 @@ function taxRate(invoiceInTax) {
|
||||||
return ((taxTypeSage / 100) * taxableBase).toFixed(2);
|
return ((taxTypeSage / 100) * taxableBase).toFixed(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function autocompleteExpense(evt, row, col) {
|
function autocompleteExpense(evt, row, col, ref) {
|
||||||
const val = evt.target.value;
|
const val = evt.target.value;
|
||||||
if (!val) return;
|
if (!val) return;
|
||||||
|
|
||||||
|
@ -134,22 +147,17 @@ function autocompleteExpense(evt, row, col) {
|
||||||
({ id }) => id == useAccountShortToStandard(param),
|
({ id }) => id == useAccountShortToStandard(param),
|
||||||
);
|
);
|
||||||
|
|
||||||
expenseRef.value.vnSelectDialogRef.vnSelectRef.toggleOption(lookup);
|
ref.vnSelectDialogRef.vnSelectRef.toggleOption(lookup);
|
||||||
}
|
}
|
||||||
|
|
||||||
const taxableBaseTotal = computed(() => {
|
function setCursor(ref) {
|
||||||
return getTotal(invoiceInFormRef.value.formData, 'taxableBase');
|
nextTick(() => {
|
||||||
});
|
const select = ref.vnSelectDialogRef
|
||||||
|
? ref.vnSelectDialogRef.vnSelectRef
|
||||||
const taxRateTotal = computed(() => {
|
: ref.vnSelectRef;
|
||||||
return getTotal(invoiceInFormRef.value.formData, null, {
|
select.$el.querySelector('input').setSelectionRange(0, 0);
|
||||||
cb: taxRate,
|
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
const combinedTotal = computed(() => {
|
|
||||||
return +taxableBaseTotal.value + +taxRateTotal.value;
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<FetchData
|
<FetchData
|
||||||
|
@ -187,14 +195,24 @@ const combinedTotal = computed(() => {
|
||||||
<template #body-cell-expense="{ row, col }">
|
<template #body-cell-expense="{ row, col }">
|
||||||
<QTd>
|
<QTd>
|
||||||
<VnSelectDialog
|
<VnSelectDialog
|
||||||
ref="expenseRef"
|
:ref="`expenseRef-${row.$index}`"
|
||||||
v-model="row[col.model]"
|
v-model="row[col.model]"
|
||||||
:options="col.options"
|
:options="col.options"
|
||||||
:option-value="col.optionValue"
|
:option-value="col.optionValue"
|
||||||
:option-label="col.optionLabel"
|
:option-label="col.optionLabel"
|
||||||
:filter-options="['id', 'name']"
|
:filter-options="['id', 'name']"
|
||||||
:tooltip="t('Create a new expense')"
|
:tooltip="t('Create a new expense')"
|
||||||
@keydown.tab="autocompleteExpense($event, row, col)"
|
@keydown.tab="
|
||||||
|
autocompleteExpense(
|
||||||
|
$event,
|
||||||
|
row,
|
||||||
|
col,
|
||||||
|
$refs[`expenseRef-${row.$index}`],
|
||||||
|
)
|
||||||
|
"
|
||||||
|
@update:model-value="
|
||||||
|
setCursor($refs[`expenseRef-${row.$index}`])
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
@ -210,7 +228,7 @@ const combinedTotal = computed(() => {
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-taxablebase="{ row }">
|
<template #body-cell-taxablebase="{ row }">
|
||||||
<QTd>
|
<QTd shrink>
|
||||||
<VnInputNumber
|
<VnInputNumber
|
||||||
clear-icon="close"
|
clear-icon="close"
|
||||||
v-model="row.taxableBase"
|
v-model="row.taxableBase"
|
||||||
|
@ -221,12 +239,16 @@ const combinedTotal = computed(() => {
|
||||||
<template #body-cell-sageiva="{ row, col }">
|
<template #body-cell-sageiva="{ row, col }">
|
||||||
<QTd>
|
<QTd>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
:ref="`sageivaRef-${row.$index}`"
|
||||||
v-model="row[col.model]"
|
v-model="row[col.model]"
|
||||||
:options="col.options"
|
:options="col.options"
|
||||||
:option-value="col.optionValue"
|
:option-value="col.optionValue"
|
||||||
:option-label="col.optionLabel"
|
:option-label="col.optionLabel"
|
||||||
:filter-options="['id', 'vat']"
|
:filter-options="['id', 'vat']"
|
||||||
data-cy="vat-sageiva"
|
data-cy="vat-sageiva"
|
||||||
|
@update:model-value="
|
||||||
|
setCursor($refs[`sageivaRef-${row.$index}`])
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
@ -244,11 +266,15 @@ const combinedTotal = computed(() => {
|
||||||
<template #body-cell-sagetransaction="{ row, col }">
|
<template #body-cell-sagetransaction="{ row, col }">
|
||||||
<QTd>
|
<QTd>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
:ref="`sagetransactionRef-${row.$index}`"
|
||||||
v-model="row[col.model]"
|
v-model="row[col.model]"
|
||||||
:options="col.options"
|
:options="col.options"
|
||||||
:option-value="col.optionValue"
|
:option-value="col.optionValue"
|
||||||
:option-label="col.optionLabel"
|
:option-label="col.optionLabel"
|
||||||
:filter-options="['id', 'transaction']"
|
:filter-options="['id', 'transaction']"
|
||||||
|
@update:model-value="
|
||||||
|
setCursor($refs[`sagetransactionRef-${row.$index}`])
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template #option="scope">
|
<template #option="scope">
|
||||||
<QItem v-bind="scope.itemProps">
|
<QItem v-bind="scope.itemProps">
|
||||||
|
@ -266,7 +292,7 @@ const combinedTotal = computed(() => {
|
||||||
</QTd>
|
</QTd>
|
||||||
</template>
|
</template>
|
||||||
<template #body-cell-foreignvalue="{ row }">
|
<template #body-cell-foreignvalue="{ row }">
|
||||||
<QTd>
|
<QTd shrink>
|
||||||
<VnInputNumber
|
<VnInputNumber
|
||||||
:class="{
|
:class="{
|
||||||
'no-pointer-events': !isNotEuro(currency),
|
'no-pointer-events': !isNotEuro(currency),
|
||||||
|
|
|
@ -56,7 +56,7 @@ const cols = computed(() => [
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
name: 'supplierRef',
|
name: 'supplierRef',
|
||||||
label: t('invoiceIn.list.supplierRef'),
|
label: t('invoiceIn.supplierRef'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
align: 'left',
|
align: 'left',
|
||||||
|
@ -177,7 +177,7 @@ const cols = computed(() => [
|
||||||
:required="true"
|
:required="true"
|
||||||
/>
|
/>
|
||||||
<VnInput
|
<VnInput
|
||||||
:label="t('invoiceIn.list.supplierRef')"
|
:label="t('invoiceIn.supplierRef')"
|
||||||
v-model="data.supplierRef"
|
v-model="data.supplierRef"
|
||||||
/>
|
/>
|
||||||
<VnSelect
|
<VnSelect
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { useQuasar } from 'quasar';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
import VnConfirm from 'src/components/ui/VnConfirm.vue';
|
||||||
import { useArrayData } from 'src/composables/useArrayData';
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
|
import qs from 'qs';
|
||||||
const { notify, dialog } = useQuasar();
|
const { notify, dialog } = useQuasar();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
@ -12,29 +13,51 @@ defineExpose({ checkToBook });
|
||||||
const { store } = useArrayData();
|
const { store } = useArrayData();
|
||||||
|
|
||||||
async function checkToBook(id) {
|
async function checkToBook(id) {
|
||||||
let directBooking = true;
|
let messages = [];
|
||||||
|
|
||||||
|
const hasProblemWithTax = (
|
||||||
|
await axios.get('InvoiceInTaxes/count', {
|
||||||
|
params: {
|
||||||
|
where: JSON.stringify({
|
||||||
|
invoiceInFk: id,
|
||||||
|
or: [{ taxTypeSageFk: null }, { transactionTypeSageFk: null }],
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
).data?.count;
|
||||||
|
|
||||||
|
if (hasProblemWithTax)
|
||||||
|
messages.push(t('The VAT and Transaction fields have not been informed'));
|
||||||
|
|
||||||
const { data: totals } = await axios.get(`InvoiceIns/${id}/getTotals`);
|
const { data: totals } = await axios.get(`InvoiceIns/${id}/getTotals`);
|
||||||
const taxableBaseNotEqualDueDay = totals.totalDueDay != totals.totalTaxableBase;
|
const taxableBaseNotEqualDueDay = totals.totalDueDay != totals.totalTaxableBase;
|
||||||
const vatNotEqualDueDay = totals.totalDueDay != totals.totalVat;
|
const vatNotEqualDueDay = totals.totalDueDay != totals.totalVat;
|
||||||
|
|
||||||
if (taxableBaseNotEqualDueDay && vatNotEqualDueDay) directBooking = false;
|
if (taxableBaseNotEqualDueDay && vatNotEqualDueDay)
|
||||||
|
messages.push(t('The sum of the taxable bases does not match the due dates'));
|
||||||
|
|
||||||
const { data: dueDaysCount } = await axios.get('InvoiceInDueDays/count', {
|
const dueDaysCount = (
|
||||||
where: {
|
await axios.get('InvoiceInDueDays/count', {
|
||||||
invoiceInFk: id,
|
params: {
|
||||||
dueDated: { gte: Date.vnNew() },
|
where: JSON.stringify({
|
||||||
},
|
invoiceInFk: id,
|
||||||
});
|
dueDated: { gte: Date.vnNew() },
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
).data?.count;
|
||||||
|
|
||||||
if (dueDaysCount) directBooking = false;
|
if (dueDaysCount) messages.push(t('Some due dates are less than or equal to today'));
|
||||||
|
|
||||||
if (directBooking) return toBook(id);
|
if (!messages.length) toBook(id);
|
||||||
|
else
|
||||||
dialog({
|
dialog({
|
||||||
component: VnConfirm,
|
component: VnConfirm,
|
||||||
componentProps: { title: t('Are you sure you want to book this invoice?') },
|
componentProps: {
|
||||||
}).onOk(async () => await toBook(id));
|
title: t('Are you sure you want to book this invoice?'),
|
||||||
|
message: messages.reduce((acc, msg) => `${acc}<p>${msg}</p>`, ''),
|
||||||
|
},
|
||||||
|
}).onOk(() => toBook(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function toBook(id) {
|
async function toBook(id) {
|
||||||
|
@ -59,4 +82,7 @@ async function toBook(id) {
|
||||||
es:
|
es:
|
||||||
Are you sure you want to book this invoice?: ¿Estás seguro de querer asentar esta factura?
|
Are you sure you want to book this invoice?: ¿Estás seguro de querer asentar esta factura?
|
||||||
It was not able to book the invoice: No se pudo contabilizar la factura
|
It was not able to book the invoice: No se pudo contabilizar la factura
|
||||||
|
Some due dates are less than or equal to today: Algún vencimiento tiene una fecha menor o igual que hoy
|
||||||
|
The sum of the taxable bases does not match the due dates: La suma de las bases imponibles no coincide con la de los vencimientos
|
||||||
|
The VAT and Transaction fields have not been informed: No se han informado los campos de iva y/o transacción
|
||||||
</i18n>
|
</i18n>
|
||||||
|
|
|
@ -3,10 +3,10 @@ invoiceIn:
|
||||||
searchInfo: Search incoming invoices by ID or supplier fiscal name
|
searchInfo: Search incoming invoices by ID or supplier fiscal name
|
||||||
serial: Serial
|
serial: Serial
|
||||||
isBooked: Is booked
|
isBooked: Is booked
|
||||||
|
supplierRef: Invoice nº
|
||||||
list:
|
list:
|
||||||
ref: Reference
|
ref: Reference
|
||||||
supplier: Supplier
|
supplier: Supplier
|
||||||
supplierRef: Supplier ref.
|
|
||||||
file: File
|
file: File
|
||||||
issued: Issued
|
issued: Issued
|
||||||
dueDated: Due dated
|
dueDated: Due dated
|
||||||
|
@ -19,8 +19,6 @@ invoiceIn:
|
||||||
unbook: Unbook
|
unbook: Unbook
|
||||||
delete: Delete
|
delete: Delete
|
||||||
clone: Clone
|
clone: Clone
|
||||||
toBook: To book
|
|
||||||
toUnbook: To unbook
|
|
||||||
deleteInvoice: Delete invoice
|
deleteInvoice: Delete invoice
|
||||||
invoiceDeleted: invoice deleted
|
invoiceDeleted: invoice deleted
|
||||||
cloneInvoice: Clone invoice
|
cloneInvoice: Clone invoice
|
||||||
|
@ -70,4 +68,3 @@ invoiceIn:
|
||||||
isBooked: Is booked
|
isBooked: Is booked
|
||||||
account: Ledger account
|
account: Ledger account
|
||||||
correctingFk: Rectificative
|
correctingFk: Rectificative
|
||||||
|
|
|
@ -3,10 +3,10 @@ invoiceIn:
|
||||||
searchInfo: Buscar facturas recibidas por ID o nombre fiscal del proveedor
|
searchInfo: Buscar facturas recibidas por ID o nombre fiscal del proveedor
|
||||||
serial: Serie
|
serial: Serie
|
||||||
isBooked: Contabilizada
|
isBooked: Contabilizada
|
||||||
|
supplierRef: Nº factura
|
||||||
list:
|
list:
|
||||||
ref: Referencia
|
ref: Referencia
|
||||||
supplier: Proveedor
|
supplier: Proveedor
|
||||||
supplierRef: Ref. proveedor
|
|
||||||
issued: F. emisión
|
issued: F. emisión
|
||||||
dueDated: F. vencimiento
|
dueDated: F. vencimiento
|
||||||
file: Fichero
|
file: Fichero
|
||||||
|
@ -15,12 +15,10 @@ invoiceIn:
|
||||||
descriptor:
|
descriptor:
|
||||||
ticketList: Listado de tickets
|
ticketList: Listado de tickets
|
||||||
descriptorMenu:
|
descriptorMenu:
|
||||||
book: Asentar
|
book: Contabilizar
|
||||||
unbook: Desasentar
|
unbook: Descontabilizar
|
||||||
delete: Eliminar
|
delete: Eliminar
|
||||||
clone: Clonar
|
clone: Clonar
|
||||||
toBook: Contabilizar
|
|
||||||
toUnbook: Descontabilizar
|
|
||||||
deleteInvoice: Eliminar factura
|
deleteInvoice: Eliminar factura
|
||||||
invoiceDeleted: Factura eliminada
|
invoiceDeleted: Factura eliminada
|
||||||
cloneInvoice: Clonar factura
|
cloneInvoice: Clonar factura
|
||||||
|
@ -68,4 +66,3 @@ invoiceIn:
|
||||||
isBooked: Contabilizada
|
isBooked: Contabilizada
|
||||||
account: Cuenta contable
|
account: Cuenta contable
|
||||||
correctingFk: Rectificativa
|
correctingFk: Rectificativa
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
if (!areRows) return insert();
te evita el else
(Es solo comentario)