From 4d602aadfdff4734fc5d6d18bc8f443aaa8dfdfd Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 11 Nov 2024 11:53:28 +0100 Subject: [PATCH 1/9] feat: refs #7134 #7134 Create SupplierBalance layout --- src/pages/Supplier/Card/SupplierBalance.vue | 329 ++++++++++++++++++++ 1 file changed, 329 insertions(+) create mode 100644 src/pages/Supplier/Card/SupplierBalance.vue diff --git a/src/pages/Supplier/Card/SupplierBalance.vue b/src/pages/Supplier/Card/SupplierBalance.vue new file mode 100644 index 000000000..bc6e987fc --- /dev/null +++ b/src/pages/Supplier/Card/SupplierBalance.vue @@ -0,0 +1,329 @@ + + + + + +en: + bill: 'N/INV {ref}' +es: + Company: Empresa + Total by company: Total por empresa + New payment: Añadir pago + 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? + + + -- 2.40.1 From 8d2ad235fbf2088d8b7a43b238f5fda63220dd05 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 11 Nov 2024 11:54:53 +0100 Subject: [PATCH 2/9] feat: refs #7134 #7134 Create new route --- src/router/modules/Supplier.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/router/modules/Supplier.js b/src/router/modules/Supplier.js index 143d7c824..86fb8cf77 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', -- 2.40.1 From da99d8250423e9c2fd5d94bafa0ad07c7a14f182 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 11 Nov 2024 11:55:28 +0100 Subject: [PATCH 3/9] perf: refs #7134 #7134 global dialog newPayment and composable getRisk --- src/components/CreateNewPayment.vue | 333 ++++++++++++++++++ src/composables/getRisk.js | 22 ++ src/pages/Customer/Card/CustomerBalance.vue | 2 +- .../components/CustomerNewPayment.vue | 2 +- .../Supplier/composables/getSupplierRisk.js | 12 + 5 files changed, 369 insertions(+), 2 deletions(-) create mode 100644 src/components/CreateNewPayment.vue create mode 100644 src/composables/getRisk.js create mode 100644 src/pages/Supplier/composables/getSupplierRisk.js diff --git a/src/components/CreateNewPayment.vue b/src/components/CreateNewPayment.vue new file mode 100644 index 000000000..2267d5643 --- /dev/null +++ b/src/components/CreateNewPayment.vue @@ -0,0 +1,333 @@ + + + + + +es: + New payment: Añadir pago + Date: Fecha + Company: Empresa + Bank: Caja + Amount: Importe + Reference: Referencia + Cash: Efectivo + 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/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/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) }, + }); +} -- 2.40.1 From 7b8093c048d0c0d17eaaddb1dd515a3644fda799 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 11 Nov 2024 14:22:18 +0100 Subject: [PATCH 4/9] feat: refs #7134 #7134 split newPayment --- src/pages/Supplier/Card/SupplierBalance.vue | 12 ++- .../Supplier/Card/SupplierNewPayment.vue} | 77 +++++++++++++++---- 2 files changed, 70 insertions(+), 19 deletions(-) rename src/{components/CreateNewPayment.vue => pages/Supplier/Card/SupplierNewPayment.vue} (83%) diff --git a/src/pages/Supplier/Card/SupplierBalance.vue b/src/pages/Supplier/Card/SupplierBalance.vue index bc6e987fc..9f36b8707 100644 --- a/src/pages/Supplier/Card/SupplierBalance.vue +++ b/src/pages/Supplier/Card/SupplierBalance.vue @@ -18,7 +18,7 @@ import VnInput from 'components/common/VnInput.vue'; import VnSubToolbar from 'components/ui/VnSubToolbar.vue'; import VnFilter from 'components/VnTable/VnFilter.vue'; -import CreateNewPayment from 'src/components/CreateNewPayment.vue'; +import SupplierNewPayment from 'src/pages/Supplier/Card/SupplierNewPayment.vue'; import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue'; const { openConfirmationModal } = useVnConfirm(); @@ -36,6 +36,7 @@ const supplierRisk = ref([]); const tableRef = ref(); const companyId = ref(); const companyUser = ref(user.value.companyFk); +const bankUser = ref(user.value.localBankFk); const balances = ref([]); const vnFilterRef = ref({}); const filter = computed(() => { @@ -200,11 +201,14 @@ async function onFetch(data) { } const showNewPaymentDialog = () => { + debugger; quasar.dialog({ - component: CreateNewPayment, + component: SupplierNewPayment, componentProps: { companyId: companyId.value, + bankId: bankUser.value, totalCredit: supplierRisk.value[0]?.amount, + extraFields: ['currencyFk', 'orderBy'], promise: () => tableRef.value.reload(), }, }); @@ -241,7 +245,7 @@ const showBalancePdf = ({ id }) => { { - urlCreate.value = `Clients/${route.params.id}/createReceipt`; + urlCreate.value = `Suppliers/${route.params.id}/createReceipt`; }); function setPaymentType(accounting) { @@ -112,7 +123,7 @@ function onBeforeSave(data) { return notify(t('Amount exceeded', { maxAmount: maxAmount.value }), 'negative'); if (isCash.value && shouldSendEmail.value && !data.email) - return notify(t('There is no assigned email for this client'), 'negative'); + return notify(t(`There is no assigned email for this supplier`), 'negative'); data.bankFk = data.bankFk.id; return data; @@ -153,12 +164,11 @@ async function accountShortToStandard({ target: { value } }) { async function getAmountPaid() { const filter = { where: { - clientFk: route.params.id, + supplierFk: route.params.id, companyFk: initialData.companyFk, }, }; - - const { data } = await getClientRisk(filter); + const { data } = await getSupplierRisk(filter); initialData.amountPaid = (data?.length && data[0].amount) || undefined; } @@ -177,10 +187,17 @@ async function getAmountPaid() { url="Accountings" /> + - + {{ data }}
{{ t('New payment') }}
- + + + + + + +
Date: Mon, 11 Nov 2024 14:46:57 +0100 Subject: [PATCH 5/9] feat: refs #7134 use VnAccountNumber --- src/pages/Supplier/Card/SupplierBalance.vue | 1 - src/pages/Supplier/Card/SupplierNewPayment.vue | 11 ++++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/pages/Supplier/Card/SupplierBalance.vue b/src/pages/Supplier/Card/SupplierBalance.vue index 9f36b8707..d9e79288d 100644 --- a/src/pages/Supplier/Card/SupplierBalance.vue +++ b/src/pages/Supplier/Card/SupplierBalance.vue @@ -201,7 +201,6 @@ async function onFetch(data) { } const showNewPaymentDialog = () => { - debugger; quasar.dialog({ component: SupplierNewPayment, componentProps: { diff --git a/src/pages/Supplier/Card/SupplierNewPayment.vue b/src/pages/Supplier/Card/SupplierNewPayment.vue index fc78a5495..b7f8dd477 100644 --- a/src/pages/Supplier/Card/SupplierNewPayment.vue +++ b/src/pages/Supplier/Card/SupplierNewPayment.vue @@ -15,6 +15,7 @@ import VnInputDate from 'components/common/VnInputDate.vue'; import VnInputNumber from 'components/common/VnInputNumber.vue'; import VnSelect from 'src/components/common/VnSelect.vue'; import VnInput from 'src/components/common/VnInput.vue'; +import VnAccountNumber from 'src/components/common/VnAccountNumber.vue'; const { t } = useI18n(); const route = useRoute(); @@ -180,12 +181,7 @@ async function getAmountPaid() { auto-load url="Companies" /> - + - -- 2.40.1 From 3404bc6d0b2c943ad904184f3e98b7d06b2992e5 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Mon, 11 Nov 2024 15:59:05 +0100 Subject: [PATCH 6/9] feat: refs #7134 apply supplierBalanceFilter --- src/pages/Supplier/Card/SupplierBalance.vue | 30 +++-- .../Supplier/Card/SupplierBalanceFilter.vue | 123 ++++++++++++++++++ 2 files changed, 141 insertions(+), 12 deletions(-) create mode 100644 src/pages/Supplier/Card/SupplierBalanceFilter.vue diff --git a/src/pages/Supplier/Card/SupplierBalance.vue b/src/pages/Supplier/Card/SupplierBalance.vue index d9e79288d..9fb424220 100644 --- a/src/pages/Supplier/Card/SupplierBalance.vue +++ b/src/pages/Supplier/Card/SupplierBalance.vue @@ -6,6 +6,7 @@ import { useAcl } from 'src/composables/useAcl'; import axios from 'axios'; import { useQuasar } from 'quasar'; import { getSupplierRisk } from 'src/composables/getRisk'; +import RightMenu from 'src/components/common/RightMenu.vue'; import { toCurrency, toDate, toDateHourMin } from 'src/filters'; import { useState } from 'composables/useState'; @@ -20,6 +21,7 @@ import VnFilter from 'components/VnTable/VnFilter.vue'; import SupplierNewPayment from 'src/pages/Supplier/Card/SupplierNewPayment.vue'; import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescriptorProxy.vue'; +import SupplierBalanceFilter from './SupplierBalanceFilter.vue'; const { openConfirmationModal } = useVnConfirm(); const { sendEmail, openReport } = usePrintService(); @@ -187,17 +189,18 @@ async function getCurrentBalance() { } async function onFetch(data) { - balances.value = []; - for (const [index, balance] of data.entries()) { - if (index === 0) { - balance.balance = await getCurrentBalance(); - continue; - } - const previousBalance = data[index - 1]; - balance.balance = - previousBalance?.balance - (previousBalance?.debit - previousBalance?.credit); - } - balances.value = data; + return; + // balances.value = []; + // for (const [index, balance] of data.entries()) { + // if (index === 0) { + // balance.balance = await getCurrentBalance(); + // continue; + // } + // const previousBalance = data[index - 1]; + // balance.balance = + // previousBalance?.balance - (previousBalance?.debit - previousBalance?.credit); + // } + // balances.value = data; } const showNewPaymentDialog = () => { @@ -241,9 +244,12 @@ const showBalancePdf = ({ id }) => {
+ + + +import { useI18n } from 'vue-i18n'; +import VnFilterPanel from 'src/components/ui/VnFilterPanel.vue'; +import VnSelect from 'src/components/common/VnSelect.vue'; +import VnInput from 'src/components/common/VnInput.vue'; +import VnInputDate from 'src/components/common/VnInputDate.vue'; + +const { t } = useI18n(); +defineProps({ + dataKey: { + type: String, + required: true, + }, +}); + + + + + +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 + -- 2.40.1 From 78e70f2b698e8bada5503e5ac7e190993003eddd Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 20 Nov 2024 14:28:41 +0100 Subject: [PATCH 7/9] feat: refs #7134 #7124 handle columns --- src/pages/Supplier/Card/SupplierBalance.vue | 98 ++++++++++----------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/src/pages/Supplier/Card/SupplierBalance.vue b/src/pages/Supplier/Card/SupplierBalance.vue index 9fb424220..dcfa7c72b 100644 --- a/src/pages/Supplier/Card/SupplierBalance.vue +++ b/src/pages/Supplier/Card/SupplierBalance.vue @@ -6,9 +6,8 @@ import { useAcl } from 'src/composables/useAcl'; import axios from 'axios'; import { useQuasar } from 'quasar'; import { getSupplierRisk } from 'src/composables/getRisk'; -import RightMenu from 'src/components/common/RightMenu.vue'; -import { toCurrency, toDate, toDateHourMin } from 'src/filters'; +import { dashIfEmpty, toCurrency, toDate, toDateHourMin } from 'src/filters'; import { useState } from 'composables/useState'; import { useStateStore } from 'stores/useStateStore'; import { usePrintService } from 'composables/usePrintService'; @@ -74,40 +73,41 @@ const companyFilterColumn = { }; const columns = computed(() => [ + // { + // align: 'left', + // name: 'payed', + // label: t('Date'), + // format: ({ payed }) => toDate(payed), + // cardVisible: true, + // }, { align: 'left', - name: 'payed', - label: t('Date'), - format: ({ payed }) => toDate(payed), - cardVisible: true, - }, - { - align: 'left', - name: 'created', + name: 'dated', label: t('Creation date'), - format: ({ created }) => toDateHourMin(created), + format: ({ dated }) => toDateHourMin(dated), cardVisible: true, }, + // { + // align: 'left', + // label: t('Employee'), + // columnField: { + // component: 'userLink', + // attrs: ({ row }) => { + // return { + // workerId: row.workerFk, + // name: row.userName, + // }; + // }, + // }, + // cardVisible: true, + // }, { align: 'left', - label: t('Employee'), - columnField: { - component: 'userLink', - attrs: ({ row }) => { - return { - workerId: row.workerFk, - name: row.userName, - }; - }, - }, - cardVisible: true, - }, - { - align: 'left', - name: 'description', + name: 'sref', label: t('Reference'), isTitle: true, class: 'extend', + format: ({ sref }) => dashIfEmpty(sref), }, { align: 'left', @@ -117,23 +117,23 @@ const columns = computed(() => [ }, { align: 'left', - name: 'debit', + name: 'invoiceEuros', label: t('Debit'), - format: ({ debit }) => debit && toCurrency(debit), + format: ({ invoiceEuros }) => invoiceEuros && toCurrency(invoiceEuros), isId: true, }, { align: 'left', - name: 'credit', + name: 'paymentEuros', label: t('Havings'), - format: ({ credit }) => credit && toCurrency(credit), + format: ({ paymentEuros }) => paymentEuros && toCurrency(paymentEuros), cardVisible: true, }, { align: 'left', - name: 'balance', + name: 'euroBalance', label: t('Balance'), - format: ({ balance }) => toCurrency(balance), + format: ({ euroBalance }) => toCurrency(euroBalance), cardVisible: true, }, { @@ -146,23 +146,23 @@ const columns = computed(() => [ align: 'left', name: 'tableActions', actions: [ - { - title: t('globals.downloadPdf'), - icon: 'cloud_download', - show: (row) => row.isInvoice, - action: (row) => showBalancePdf(row), - }, - { - title: t('Send compensation'), - icon: 'outgoing_mail', - show: (row) => !!row.isCompensation, - action: ({ id }) => - openConfirmationModal( - t('Send compensation'), - t('Do you want to report compensation to the supplier by mail?'), - () => sendEmail(`Receipts/${id}/balance-compensation-email`) - ), - }, + // { + // title: t('globals.downloadPdf'), + // icon: 'cloud_download', + // show: (row) => row.isInvoice, + // action: (row) => showBalancePdf(row), + // }, + // { + // title: t('Send compensation'), + // icon: 'outgoing_mail', + // show: (row) => !!row.isCompensation, + // action: ({ id }) => + // openConfirmationModal( + // t('Send compensation'), + // t('Do you want to report compensation to the supplier by mail?'), + // () => sendEmail(`Receipts/${id}/balance-compensation-email`) + // ), + // }, ], }, ]); -- 2.40.1 From 09804e06c751ae1702300a36c52b2be7295f0175 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Wed, 20 Nov 2024 14:28:47 +0100 Subject: [PATCH 8/9] feat: refs #7134 #7124 handle filter --- src/pages/Supplier/Card/SupplierBalanceFilter.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pages/Supplier/Card/SupplierBalanceFilter.vue b/src/pages/Supplier/Card/SupplierBalanceFilter.vue index 4d5b4f99c..2f75ccfc3 100644 --- a/src/pages/Supplier/Card/SupplierBalanceFilter.vue +++ b/src/pages/Supplier/Card/SupplierBalanceFilter.vue @@ -23,6 +23,7 @@ defineProps({