diff --git a/src/composables/getTotal.js b/src/composables/getTotal.js
new file mode 100644
index 000000000..41c4330c4
--- /dev/null
+++ b/src/composables/getTotal.js
@@ -0,0 +1,10 @@
+import { toCurrency } from 'src/filters';
+
+export function getTotal(rows, key, opts = {}) {
+ const { currency, cb } = opts;
+ const total = rows.reduce((acc, row) => acc + +(cb ? cb(row) : row[key] || 0), 0);
+
+ return currency
+ ? toCurrency(total, currency == 'default' ? undefined : currency)
+ : total;
+}
diff --git a/src/i18n/locale/en.yml b/src/i18n/locale/en.yml
index fae22b06d..0c416a046 100644
--- a/src/i18n/locale/en.yml
+++ b/src/i18n/locale/en.yml
@@ -252,6 +252,7 @@ globals:
ldap: LDAP
samba: Samba
serial: Serial
+ supplier: Supplier
created: Created
worker: Worker
now: Now
@@ -738,56 +739,6 @@ parking:
searchBar:
info: You can search by parking code
label: Search parking...
-invoiceIn:
- list:
- ref: Reference
- supplier: Supplier
- supplierRef: Supplier ref.
- serialNumber: Serial number
- serial: Serial
- file: File
- issued: Issued
- isBooked: Is booked
- awb: AWB
- amount: Amount
- card:
- issued: Issued
- amount: Amount
- client: Client
- company: Company
- customerCard: Customer card
- ticketList: Ticket List
- vat: Vat
- dueDay: Due day
- intrastat: Intrastat
- summary:
- supplier: Supplier
- supplierRef: Supplier ref.
- currency: Currency
- docNumber: Doc number
- issued: Expedition date
- operated: Operation date
- bookEntried: Entry date
- bookedDate: Booked date
- sage: Sage withholding
- vat: Undeductible VAT
- company: Company
- booked: Booked
- expense: Expense
- taxableBase: Taxable base
- rate: Rate
- sageVat: Sage vat
- sageTransaction: Sage transaction
- dueDay: Date
- bank: Bank
- amount: Amount
- foreignValue: Foreign value
- dueTotal: Due day
- noMatch: Do not match
- code: Code
- net: Net
- stems: Stems
- country: Country
order:
field:
salesPersonFk: Sales Person
diff --git a/src/i18n/locale/es.yml b/src/i18n/locale/es.yml
index e1946515c..946ee5e54 100644
--- a/src/i18n/locale/es.yml
+++ b/src/i18n/locale/es.yml
@@ -254,6 +254,7 @@ globals:
ldap: LDAP
samba: Samba
serial: Facturas por serie
+ supplier: Proveedor
created: Fecha creación
worker: Trabajador
now: Ahora
@@ -782,54 +783,6 @@ parking:
searchBar:
info: Puedes buscar por código de parking
label: Buscar parking...
-invoiceIn:
- list:
- ref: Referencia
- supplier: Proveedor
- supplierRef: Ref. proveedor
- serialNumber: Num. serie
- shortIssued: F. emisión
- serial: Serie
- file: Fichero
- issued: Fecha emisión
- isBooked: Conciliada
- awb: AWB
- amount: Importe
- card:
- issued: Fecha emisión
- amount: Importe
- client: Cliente
- company: Empresa
- customerCard: Ficha del cliente
- ticketList: Listado de tickets
- vat: Iva
- dueDay: Fecha de vencimiento
- summary:
- supplier: Proveedor
- supplierRef: Ref. proveedor
- currency: Divisa
- docNumber: Número documento
- issued: Fecha de expedición
- operated: Fecha operación
- bookEntried: Fecha asiento
- bookedDate: Fecha contable
- sage: Retención sage
- vat: Iva no deducible
- company: Empresa
- booked: Contabilizada
- expense: Gasto
- taxableBase: Base imp.
- rate: Tasa
- sageTransaction: Sage transación
- dueDay: Fecha
- bank: Caja
- amount: Importe
- foreignValue: Divisa
- dueTotal: Vencimiento
- code: Código
- net: Neto
- stems: Tallos
- country: País
department:
pageTitles:
basicData: Basic data
diff --git a/src/pages/InvoiceIn/Card/InvoiceInBasicData.vue b/src/pages/InvoiceIn/Card/InvoiceInBasicData.vue
index ede9af825..045517a3f 100644
--- a/src/pages/InvoiceIn/Card/InvoiceInBasicData.vue
+++ b/src/pages/InvoiceIn/Card/InvoiceInBasicData.vue
@@ -223,6 +223,10 @@ async function onSubmit() {
autofocus
/>
+
+
+
+
-
-
-
-
{
-
+
diff --git a/src/pages/InvoiceIn/Card/InvoiceInDueDay.vue b/src/pages/InvoiceIn/Card/InvoiceInDueDay.vue
index 7dbd0fe9e..f5e1d835d 100644
--- a/src/pages/InvoiceIn/Card/InvoiceInDueDay.vue
+++ b/src/pages/InvoiceIn/Card/InvoiceInDueDay.vue
@@ -5,6 +5,7 @@ import { useI18n } from 'vue-i18n';
import axios from 'axios';
import { toDate } from 'src/filters';
import { useArrayData } from 'src/composables/useArrayData';
+import { getTotal } from 'src/composables/getTotal';
import CrudModel from 'src/components/CrudModel.vue';
import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
@@ -71,7 +72,7 @@ async function insert() {
await invoiceInFormRef.value.reload();
notify(t('globals.dataSaved'), 'positive');
}
-const getTotalAmount = (rows) => rows.reduce((acc, { amount }) => acc + +amount, 0);
+// const getTotal = (rows, key) => rows.reduce((acc, row) => acc + +row[key], 0);
rows.reduce((acc, { amount }) => acc + +amount,
- {{
- toCurrency(getTotalAmount(rows), invoiceIn.currency.code)
- }}
+ {{ getTotal(rows, 'amount', { currency: 'default' }) }}
+
+
+
+ {{
+ getTotal(rows, 'foreignValue', {
+ currency: invoiceIn.currency.code,
+ })
+ }}
+
-
diff --git a/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue b/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue
index 481698832..18630dba9 100644
--- a/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue
+++ b/src/pages/InvoiceIn/Card/InvoiceInIntrastat.vue
@@ -3,6 +3,7 @@ import { computed, ref } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { toCurrency } from 'src/filters';
+import { getTotal } from 'src/composables/getTotal';
import CrudModel from 'src/components/CrudModel.vue';
import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
@@ -72,9 +73,6 @@ const columns = computed(() => [
},
]);
-const getTotal = (data, key) =>
- data.reduce((acc, cur) => acc + +String(cur[key] || 0).replace(',', '.'), 0);
-
const formatOpt = (row, { model, options }, prop) => {
const obj = row[model];
const option = options.find(({ id }) => id == obj);
@@ -154,7 +152,7 @@ const formatOpt = (row, { model, options }, prop) => {
- {{ toCurrency(getTotal(rows, 'amount'), currency) }}
+ {{ getTotal(rows, 'amount', { currency: 'default' }) }}
{{ getTotal(rows, 'net') }}
diff --git a/src/pages/InvoiceIn/Card/InvoiceInSummary.vue b/src/pages/InvoiceIn/Card/InvoiceInSummary.vue
index 644b472e2..bf2e7db48 100644
--- a/src/pages/InvoiceIn/Card/InvoiceInSummary.vue
+++ b/src/pages/InvoiceIn/Card/InvoiceInSummary.vue
@@ -35,7 +35,7 @@ const vatColumns = ref([
name: 'landed',
label: 'invoiceIn.summary.taxableBase',
field: (row) => row.taxableBase,
- format: (value) => toCurrency(value, currency.value),
+ format: (value) => toCurrency(value),
sortable: true,
align: 'left',
},
@@ -64,7 +64,7 @@ const vatColumns = ref([
name: 'rate',
label: 'invoiceIn.summary.rate',
field: (row) => taxRate(row.taxableBase, row.taxTypeSage?.rate),
- format: (value) => toCurrency(value, currency.value),
+ format: (value) => toCurrency(value),
sortable: true,
align: 'left',
},
@@ -72,7 +72,7 @@ const vatColumns = ref([
name: 'currency',
label: 'invoiceIn.summary.currency',
field: (row) => row.foreignValue,
- format: (value) => value,
+ format: (val) => val && toCurrency(val, currency.value),
sortable: true,
align: 'left',
},
@@ -97,7 +97,7 @@ const dueDayColumns = ref([
name: 'amount',
label: 'invoiceIn.summary.amount',
field: (row) => row.amount,
- format: (value) => toCurrency(value, currency.value),
+ format: (value) => toCurrency(value),
sortable: true,
align: 'left',
},
@@ -105,7 +105,7 @@ const dueDayColumns = ref([
name: 'landed',
label: 'invoiceIn.summary.foreignValue',
field: (row) => row.foreignValue,
- format: (value) => value,
+ format: (val) => val && toCurrency(val, currency.value),
sortable: true,
align: 'left',
},
@@ -124,7 +124,7 @@ const intrastatColumns = ref([
{
name: 'amount',
label: 'invoiceIn.summary.amount',
- field: (row) => toCurrency(row.amount, currency.value),
+ field: (row) => toCurrency(row.amount),
sortable: true,
align: 'left',
},
@@ -179,7 +179,6 @@ const getTotalTax = (tax) =>
const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
-
`#/invoice-in/${entityId.value}/${param}`;
:label="t('invoiceIn.summary.currency')"
:value="entity.currency?.code"
/>
-
+
@@ -293,12 +289,9 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
-
+
`#/invoice-in/${entityId.value}/${param}`;
: t('invoiceIn.summary.dueTotal')
"
>
- {{ toCurrency(entity.totals.totalDueDay, currency) }}
+ {{ toCurrency(entity.totals.totalDueDay) }}
@@ -350,15 +343,17 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
+ {{ toCurrency(entity.totals.totalTaxableBase) }}
+
+
+ {{ toCurrency(getTotalTax(entity.invoiceInTax)) }}
{{
- toCurrency(entity.totals.totalTaxableBase, currency)
+ entity.totals.totalTaxableBaseForeignValue &&
+ toCurrency(
+ entity.totals.totalTaxableBaseForeignValue,
+ currency
+ )
}}
-
-
- {{
- toCurrency(getTotalTax(entity.invoiceInTax, currency))
- }}
-
@@ -384,9 +379,17 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
- {{ toCurrency(entity.totals.totalDueDay, currency) }}
+ {{ toCurrency(entity.totals.totalDueDay) }}
+
+
+ {{
+ entity.totals.totalDueDayForeignValue &&
+ toCurrency(
+ entity.totals.totalDueDayForeignValue,
+ currency
+ )
+ }}
-
@@ -421,7 +424,7 @@ const getLink = (param) => `#/invoice-in/${entityId.value}/${param}`;
- {{ toCurrency(intrastatTotals.amount, currency) }}
+ {{ toCurrency(intrastatTotals.amount) }}
{{ intrastatTotals.net }}
{{ intrastatTotals.stems }}
diff --git a/src/pages/InvoiceIn/Card/InvoiceInVat.vue b/src/pages/InvoiceIn/Card/InvoiceInVat.vue
index 4dac5058e..4428f3c80 100644
--- a/src/pages/InvoiceIn/Card/InvoiceInVat.vue
+++ b/src/pages/InvoiceIn/Card/InvoiceInVat.vue
@@ -5,6 +5,7 @@ import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
import axios from 'axios';
import { useArrayData } from 'src/composables/useArrayData';
+import { getTotal } from 'src/composables/getTotal';
import { toCurrency } from 'src/filters';
import FetchData from 'src/components/FetchData.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
@@ -56,7 +57,7 @@ const columns = computed(() => [
{
name: 'taxablebase',
label: t('Taxable base'),
- field: (row) => toCurrency(row.taxableBase, currency.value),
+ field: (row) => row.taxableBase,
model: 'taxableBase',
sortable: true,
tabIndex: 2,
@@ -91,7 +92,7 @@ const columns = computed(() => [
label: t('Rate'),
sortable: true,
tabIndex: 5,
- field: (row) => toCurrency(taxRate(row, row.taxTypeSageFk), currency.value),
+ field: (row) => taxRate(row, row.taxTypeSageFk),
align: 'left',
},
{
@@ -162,9 +163,11 @@ async function addExpense() {
});
}
}
-const getTotalTaxableBase = (rows) =>
- rows.reduce((acc, { taxableBase }) => acc + +(taxableBase || 0), 0);
-const getTotalRate = (rows) => rows.reduce((acc, cur) => acc + +taxRate(cur), 0);
+
+const formatTotal = (rows, key, cb) => {
+ const total = rows.reduce((acc, row) => acc + +(cb ? cb(row) : row[key] || 0), 0);
+ return toCurrency(total, key == 'foreignValue' ? currency.value : undefined);
+};
const formatOpt = (row, { model, options }, prop) => {
const obj = row[model];
@@ -324,12 +327,24 @@ const formatOpt = (row, { model, options }, prop) => {
- {{ toCurrency(getTotalTaxableBase(rows), currency) }}
+ {{ getTotal(rows, 'taxableBase', { currency: 'default' }) }}
- {{ toCurrency(getTotalRate(rows), currency) }}
-
+
+ {{
+ getTotal(rows, null, { cb: taxRate, currency: 'default' })
+ }}
+
+
+ {{
+ getTotal(rows, 'foreignValue', {
+ currency: invoiceIn.currency.code,
+ })
+ }}
+
+
diff --git a/src/pages/InvoiceIn/InvoiceInFilter.vue b/src/pages/InvoiceIn/InvoiceInFilter.vue
index 2f87c2b2e..bf4e023a9 100644
--- a/src/pages/InvoiceIn/InvoiceInFilter.vue
+++ b/src/pages/InvoiceIn/InvoiceInFilter.vue
@@ -28,6 +28,16 @@ const activities = ref([]);
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -179,6 +154,7 @@ en:
correctedFk: Rectified
issued: Issued
to: To
+ from: From
awbCode: AWB
correctingFk: Rectificative
supplierActivityFk: Supplier activity
@@ -201,6 +177,8 @@ es:
correctedFk: Rectificada
correctingFk: Rectificativa
supplierActivityFk: Actividad proveedor
+ from: Desde
+ to: Hasta
From: Desde
To: Hasta
Amount: Importe
diff --git a/src/pages/InvoiceIn/InvoiceInList.vue b/src/pages/InvoiceIn/InvoiceInList.vue
index 234cfb50f..0cad09378 100644
--- a/src/pages/InvoiceIn/InvoiceInList.vue
+++ b/src/pages/InvoiceIn/InvoiceInList.vue
@@ -47,12 +47,6 @@ const cols = computed(() => [
name: 'supplierRef',
label: t('invoiceIn.list.supplierRef'),
},
-
- {
- align: 'left',
- name: 'serialNumber',
- label: t('invoiceIn.list.serialNumber'),
- },
{
align: 'left',
name: 'serial',
@@ -141,7 +135,7 @@ const cols = computed(() => [
v-model="data.supplierFk"
url="Suppliers"
:fields="['id', 'nickname']"
- :label="t('Supplier')"
+ :label="t('globals.supplier')"
option-value="id"
option-label="nickname"
:filter-options="['id', 'name']"
@@ -162,7 +156,7 @@ const cols = computed(() => [
/>