diff --git a/src/components/VnTable/filters/tableFooter.js b/src/components/VnTable/filters/tableFooter.js new file mode 100644 index 000000000..9c7d080f6 --- /dev/null +++ b/src/components/VnTable/filters/tableFooter.js @@ -0,0 +1,12 @@ +export default function (initialFooter, data) { + const footer = data.reduce( + (acc, row) => { + Object.entries(initialFooter).forEach(([key, initialValue]) => { + acc[key] += row?.[key] !== undefined ? row[key] : initialValue; + }); + return acc; + }, + { ...initialFooter } + ); + return footer; +} diff --git a/src/composables/getRisk.js b/src/composables/getRisk.js new file mode 100644 index 000000000..6c7f75ad2 --- /dev/null +++ b/src/composables/getRisk.js @@ -0,0 +1,22 @@ +import axios from 'axios'; + +export async function getClientRisk(_filter) { + const filter = { + ..._filter, + include: { relation: 'company', scope: { fields: ['code'] } }, + }; + + return await axios(`ClientRisks`, { + params: { filter: JSON.stringify(filter) }, + }); +} +export async function getSupplierRisk(_filter) { + const filter = { + ..._filter, + include: { relation: 'company', scope: { fields: ['code'] } }, + }; + + return await axios(`ClientRisks`, { + params: { filter: JSON.stringify(filter) }, + }); +} diff --git a/src/pages/Customer/Card/CustomerBalance.vue b/src/pages/Customer/Card/CustomerBalance.vue index f6fc3eed2..a45ebc778 100644 --- a/src/pages/Customer/Card/CustomerBalance.vue +++ b/src/pages/Customer/Card/CustomerBalance.vue @@ -5,7 +5,7 @@ import { useRoute } from 'vue-router'; import { useAcl } from 'src/composables/useAcl'; import axios from 'axios'; import { useQuasar } from 'quasar'; -import { getClientRisk } from '../composables/getClientRisk'; +import { getClientRisk } from 'src/composables/getRisk'; import { toCurrency, toDate, toDateHourMin } from 'src/filters'; import { useState } from 'composables/useState'; diff --git a/src/pages/Customer/components/CustomerNewPayment.vue b/src/pages/Customer/components/CustomerNewPayment.vue index 291f28642..2267d5643 100644 --- a/src/pages/Customer/components/CustomerNewPayment.vue +++ b/src/pages/Customer/components/CustomerNewPayment.vue @@ -3,7 +3,7 @@ import { onBeforeMount, reactive, ref } from 'vue'; import { useI18n } from 'vue-i18n'; import { useRoute } from 'vue-router'; import axios from 'axios'; -import { getClientRisk } from '../composables/getClientRisk'; +import { getClientRisk } from 'src/composables/getRisk'; import { useDialogPluginComponent } from 'quasar'; import { usePrintService } from 'composables/usePrintService'; diff --git a/src/pages/Supplier/Card/SupplierBalance.vue b/src/pages/Supplier/Card/SupplierBalance.vue new file mode 100644 index 000000000..75cbcc673 --- /dev/null +++ b/src/pages/Supplier/Card/SupplierBalance.vue @@ -0,0 +1,348 @@ + + + + + + + {{ t('Total by company') }} + + {{ supplierRisk[0].company.code }}: + {{ toCurrency(supplierRisk[0].amount) }} + + + + + + + + + + + + + + + {{ toCurrency(balances[rowIndex]?.balance) }} + + + + {{ t('bill', { ref: row.description }) }} + + + + {{ row.description }} + + + value != row.description && + axios.patch(`Receipts/${row.id}`, { description: value }) + " + auto-save + > + + + + + + + + {{ t('New payment') }} + + + + + +en: + bill: 'N/INV {ref}' +es: + Company: Empresa + Total by company: Total por empresa + New payment: Añadir pago + supplierNewpayment: Añadir pago de proveedor + clientNewpayment: Añadir pago de cliente + Date: Fecha + Creation date: Fecha de creación + Employee: Empleado + Reference: Referencia + bill: 'N/FRA {ref}' + Bank: Caja + Debit: Debe + Havings: Haber + Balance: Balance + Conciliated: Conciliado + Send compensation: Enviar compensación + Do you want to report compensation to the supplier by mail?: ¿Desea informar de la compensación al cliente por correo? + + + diff --git a/src/pages/Supplier/Card/SupplierBalanceFilter.vue b/src/pages/Supplier/Card/SupplierBalanceFilter.vue new file mode 100644 index 000000000..2f75ccfc3 --- /dev/null +++ b/src/pages/Supplier/Card/SupplierBalanceFilter.vue @@ -0,0 +1,124 @@ + + + + + + + {{ t(`params.${tag.label}`) }}: + {{ formatFn(tag.value) }} + + + + {{ params }} + + + + + + + + + + + + + {{ scope.opt.id }}: {{ scope.opt.bank }} + + + + + + + + + + + + + + + + + + + + + + + + + + +en: + params: + search: General search + itemId: Item id + buyerId: Buyer + typeId: Type + categoryId: Category + from: From + to: To +es: + + params: + isConciliated: Conciliado + currencyFk: Moneda + New payment: Añadir pago + Date: Fecha + Company: Empresa + bank: Caja + Amount: Importe + Reference: Referencia + Cash: Efectivo + diff --git a/src/pages/Supplier/Card/SupplierNewPayment.vue b/src/pages/Supplier/Card/SupplierNewPayment.vue new file mode 100644 index 000000000..b7f8dd477 --- /dev/null +++ b/src/pages/Supplier/Card/SupplierNewPayment.vue @@ -0,0 +1,375 @@ + + + + + (companyOptions = data)" + auto-load + url="Companies" + /> + + (initialData.email = email)" + /> + (currenciesOptions = data)" + auto-load + /> + + + + + + {{ data }} + {{ t('New payment') }} + + + + + + setPaymentType(value, options) + " + :emit-value="false" + > + + + + + {{ scope.opt.id }}: {{ scope.opt.bank }} + + + + + + + + + + {{ t('Compensation') }} + + + + + + + + + {{ t('Cash') }} + + + + + + + + + + + + + + + + + + + + + + + + + + +es: + New payment: Añadir pago + Date: Fecha + Company: Empresa + Bank: Caja + Amount: Importe + Reference: Referencia + Cash: Efectivo + currencyFk: Moneda + Type: Tipo + Delivered amount: Cantidad entregada + Amount to return: Cantidad a devolver + View recipt: Ver recibido + Send email: Enviar correo + Compensation: Compensación + Compensation account: Cuenta para compensar + Supplier Compensation Reference: ({supplierId}) Ntro Proveedor {supplierName} + Client Compensation Reference: ({clientId}) Ntro Cliente {clientName} + There is no assigned email for this client: No hay correo asignado para este cliente + Amount exceeded: Según ley contra el fraude no se puede recibir cobros por importe igual o superior a {maxAmount} + diff --git a/src/pages/Supplier/composables/getSupplierRisk.js b/src/pages/Supplier/composables/getSupplierRisk.js new file mode 100644 index 000000000..ebaf545ee --- /dev/null +++ b/src/pages/Supplier/composables/getSupplierRisk.js @@ -0,0 +1,12 @@ +import axios from 'axios'; + +export async function getClientRisk(_filter) { + const filter = { + ..._filter, + include: { relation: 'company', scope: { fields: ['code'] } }, + }; + + return await axios(`ClientRisks`, { + params: { filter: JSON.stringify(filter) }, + }); +} diff --git a/src/router/modules/Supplier.js b/src/router/modules/Supplier.js index c08fb5961..bf5312316 100644 --- a/src/router/modules/Supplier.js +++ b/src/router/modules/Supplier.js @@ -21,6 +21,7 @@ export default { 'SupplierAccounts', 'SupplierContacts', 'SupplierAddresses', + 'SupplierBalance', 'SupplierConsumption', 'SupplierAgencyTerm', 'SupplierDms', @@ -144,6 +145,16 @@ export default { component: () => import('src/pages/Supplier/Card/SupplierAddressesCreate.vue'), }, + { + path: 'balance', + name: 'SupplierBalance', + meta: { + title: 'balance', + icon: 'balance', + }, + component: () => + import('src/pages/Supplier/Card/SupplierBalance.vue'), + }, { path: 'consumption', name: 'SupplierConsumption',