diff --git a/db/changes/240401/00-supplier.sql b/db/changes/240401/00-supplier.sql
new file mode 100644
index 000000000..e60707eca
--- /dev/null
+++ b/db/changes/240401/00-supplier.sql
@@ -0,0 +1,12 @@
+ALTER TABLE `vn`.`company` MODIFY COLUMN `supplierAccountFk` mediumint(8) unsigned DEFAULT NULL NULL COMMENT 'Cuenta por defecto para ingresos desde este pais';
+
+
+ALTER TABLE `vn`.`supplierAccount`
+ADD COLUMN `countryFk` mediumint(8) unsigned DEFAULT NULL,
+ADD CONSTRAINT `fk_supplierAccount_country`
+ FOREIGN KEY (`countryFk`) REFERENCES `country` (`id`) ON UPDATE CASCADE;
+
+ALTER TABLE `vn`.`supplierAccount`
+ADD UNIQUE KEY `uk_supplier_country` (`supplierFk`, `countryFk`);
+
+
diff --git a/db/changes/240401/01-supplierAccount.sql b/db/changes/240401/01-supplierAccount.sql
new file mode 100644
index 000000000..1c0f1ef43
--- /dev/null
+++ b/db/changes/240401/01-supplierAccount.sql
@@ -0,0 +1,9 @@
+UPDATE vn.supplierAccount sa
+ JOIN vn.country c ON sa.countryFk = c.id AND c.code = 'FR'
+ SET countryFk = c.id
+ WHERE iban = 'FR7630003012690002801121597';
+
+UPDATE vn.supplierAccount sa
+ JOIN vn.country c ON sa.countryFk = c.id AND c.code = 'PT'
+ SET countryFk = c.id
+ WHERE iban = 'PT50001000005813059150168';
diff --git a/modules/supplier/back/models/supplier-account.json b/modules/supplier/back/models/supplier-account.json
index 460c435e2..0af34fe90 100644
--- a/modules/supplier/back/models/supplier-account.json
+++ b/modules/supplier/back/models/supplier-account.json
@@ -20,6 +20,9 @@
},
"beneficiary": {
"type": "string"
+ },
+ "supplierFk": {
+ "type": "string"
}
},
"relations": {
diff --git a/print/templates/email/letter-debtor-nd/letter-debtor-nd.html b/print/templates/email/letter-debtor-nd/letter-debtor-nd.html
index 44a34a9b4..01bab7939 100644
--- a/print/templates/email/letter-debtor-nd/letter-debtor-nd.html
+++ b/print/templates/email/letter-debtor-nd/letter-debtor-nd.html
@@ -45,4 +45,4 @@
-
\ No newline at end of file
+
diff --git a/print/templates/email/letter-debtor-nd/letter-debtor-nd.js b/print/templates/email/letter-debtor-nd/letter-debtor-nd.js
index 54ed9fed6..41b6f1af8 100755
--- a/print/templates/email/letter-debtor-nd/letter-debtor-nd.js
+++ b/print/templates/email/letter-debtor-nd/letter-debtor-nd.js
@@ -1,14 +1,33 @@
const Component = require(`vn-print/core/component`);
const emailBody = new Component('email-body');
const attachment = new Component('attachment');
+const db = require('../../../core/database');
module.exports = {
name: 'letter-debtor-nd',
async serverPrefetch() {
- this.debtor = await this.fetchDebtor(this.id, this.companyId);
-
- if (!this.debtor)
- throw new Error('Something went wrong');
+ this.debtor = await db.findOne(`
+ SELECT sa.id,
+ sa.iban,
+ be.name bankName,
+ sa.countryFk,
+ c.countryFk
+ FROM supplierAccount sa
+ JOIN bankEntity be ON sa.bankEntityFk = be.id
+ LEFT JOIN company co ON co.supplierAccountFk = sa.id
+ JOIN client c ON c.countryFk = sa.countryFk
+ WHERE c.id = ?;
+ `, [this.id]);
+ if (!this.debtor) {
+ this.debtor = await db.findOne(`
+ SELECT sa.iban,
+ be.name bankName
+ FROM supplierAccount sa
+ JOIN bankEntity be ON sa.bankEntityFk = be.id
+ JOIN company co ON co.supplierAccountFk = sa.id
+ WHERE co.id = ?;
+ `, [this.companyId]);
+ }
},
data() {
return {
diff --git a/print/templates/email/letter-debtor-nd/locale/en.yml b/print/templates/email/letter-debtor-nd/locale/en.yml
new file mode 100644
index 000000000..9fb334339
--- /dev/null
+++ b/print/templates/email/letter-debtor-nd/locale/en.yml
@@ -0,0 +1,21 @@
+subject: Reminder of Outstanding Balance Notice
+title: Reminder Notice
+sections:
+ introduction:
+ title: Dear Customer
+ description: We are writing to you once again to inform you that your debt with our company remains unpaid, as you can verify in the attached statement.
+ terms: Since the agreed payment deadlines have significantly passed, there should be no further delay in settling the outstanding amount.
+ payMethod:
+ description: To do so, you have the following payment options
+ options:
+ - Online payment through our website.
+ - Deposit or transfer to the account number provided at the bottom of this letter, indicating your customer number.
+ legalAction:
+ description: If this payment reminder is not heeded, we will be compelled to initiate the necessary legal actions, which may include
+ options:
+ - Inclusion in negative credit and financial solvency records.
+ - Legal proceedings.
+ - Debt assignment to a debt collection agency.
+contactPhone: For inquiries, you can reach us at 96 324 21 00.
+conclusion: We look forward to hearing from you.
Thank you for your attention.
+transferAccount: Bank Transfer Details
diff --git a/print/templates/email/letter-debtor-nd/locale/fr.yml b/print/templates/email/letter-debtor-nd/locale/fr.yml
new file mode 100644
index 000000000..3ea3501d7
--- /dev/null
+++ b/print/templates/email/letter-debtor-nd/locale/fr.yml
@@ -0,0 +1,26 @@
+subject: Réitération de l'avis de solde débiteur
+title: Avis réitéré
+sections:
+ introduction:
+ title: Cher client
+ description: Nous vous écrivons à nouveau pour vous informer qu'il est toujours en attente
+ votre dette envers notre société, comme vous pouvez le voir dans le relevé ci-joint.
+ terms: Étant donné que les délais de paiement convenus sont largement dépassés, il n'est pas approprié
+ retard plus important dans le règlement du montant dû.
+ payMethod:
+ description: Pour cela, vous disposez des modes de paiement suivants
+ options:
+ - Paiement en ligne depuis notre site internet.
+ - Revenu ou virement sur le numéro de compte que nous détaillons en bas de ce courrier,
+ indiquant le numéro de client.
+ legalAction:
+ description: Si cette obligation de paiement n'est pas remplie, nous serons contraints de
+ d'engager les actions judiciaires qui se déroulent, parmi lesquelles
+ options:
+ - Inclusion dans les dossiers négatifs sur la solvabilité financière et le crédit.
+ - Réclamation judiciaire.
+ - Cession de créance à une société de gestion de recouvrement.
+contactPhone: Pour toute demande, vous pouvez nous contacter au 96
+ 324 21 00.
+conclusion: En attente de vos nouvelles.
Merci pour ton attention.
+transferAccount: Données pour virement bancaire
\ No newline at end of file
diff --git a/print/templates/email/letter-debtor-nd/locale/pt.yml b/print/templates/email/letter-debtor-nd/locale/pt.yml
new file mode 100644
index 000000000..f4acbd1d3
--- /dev/null
+++ b/print/templates/email/letter-debtor-nd/locale/pt.yml
@@ -0,0 +1,26 @@
+subject: Reiteração de aviso de saldo devedor
+title: Aviso reiterado
+sections:
+ introduction:
+ title: Estimado cliente
+ description: Estamos escrevendo para você novamente para informar que ainda está pendente
+ sua dívida para com nossa empresa, conforme demonstrativo anexo.
+ terms: Dado que os prazos de pagamento acordados são largamente excedidos, não é adequado
+ maior atraso na liquidação do valor devido.
+ payMethod:
+ description: Para isso você tem as seguintes formas de pagamento
+ options:
+ - Pagamento online em nosso site.
+ - Renda ou transferência para o número da conta que detalhamos no final desta carta,
+ indicando o número do cliente.
+ legalAction:
+ description: Se esta obrigação de pagamento não for cumprida, seremos obrigados a
+ para iniciar as ações legais que procedem, entre as quais estão
+ options:
+ - Inclusão em processos negativos de solvência financeira e de crédito.
+ - Reivindicação judicial.
+ - Cessão de dívida a uma empresa de gestão de cobranças.
+contactPhone: Para consultas, você pode entrar em contato conosco em 96
+ 324 21 00.
+conclusion: Aguardando suas notícias.
Agradecimentos para sua atenção.
+transferAccount: Dados para transferência bancária
\ No newline at end of file
diff --git a/print/templates/email/letter-debtor-nd/sql/client.sql b/print/templates/email/letter-debtor-nd/sql/client.sql
index d5da5d0d5..013a3b7d6 100644
--- a/print/templates/email/letter-debtor-nd/sql/client.sql
+++ b/print/templates/email/letter-debtor-nd/sql/client.sql
@@ -1,10 +1,9 @@
-SELECT
- c.dueDay,
- c.iban,
- sa.iban,
- be.name AS bankName
-FROM client c
- JOIN company AS cny
- JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk
- JOIN bankEntity be ON be.id = sa.bankEntityFk
-WHERE c.id = ? AND cny.id = ?
\ No newline at end of file
+SELECT c.dueDay,
+ sa.iban,
+ be.name bankName
+ FROM client c
+ JOIN supplierAccount sa ON sa.id = cny.supplierAccountFk
+ JOIN bankEntity be ON be.id = sa.bankEntityFk
+ JOIN company cny
+ WHERE c.id = ?
+ AND cny.id = ?
diff --git a/print/templates/email/letter-debtor-st/letter-debtor-st.html b/print/templates/email/letter-debtor-st/letter-debtor-st.html
index 36f300c98..6679567c0 100644
--- a/print/templates/email/letter-debtor-st/letter-debtor-st.html
+++ b/print/templates/email/letter-debtor-st/letter-debtor-st.html
@@ -28,4 +28,4 @@
-
\ No newline at end of file
+
diff --git a/print/templates/email/letter-debtor-st/letter-debtor-st.js b/print/templates/email/letter-debtor-st/letter-debtor-st.js
index e0a690f81..b168f969f 100755
--- a/print/templates/email/letter-debtor-st/letter-debtor-st.js
+++ b/print/templates/email/letter-debtor-st/letter-debtor-st.js
@@ -1,14 +1,33 @@
const Component = require(`vn-print/core/component`);
const emailBody = new Component('email-body');
const attachment = new Component('attachment');
+const db = require('../../../core/database');
module.exports = {
name: 'letter-debtor-st',
async serverPrefetch() {
- this.debtor = await this.fetchDebtor(this.id, this.companyId);
-
- if (!this.debtor)
- throw new Error('Something went wrong');
+ this.debtor = await db.findOne(`
+ SELECT sa.id,
+ sa.iban,
+ be.name bankName,
+ sa.countryFk,
+ c.countryFk
+ FROM supplierAccount sa
+ JOIN bankEntity be ON sa.bankEntityFk = be.id
+ LEFT JOIN company co ON co.supplierAccountFk = sa.id
+ JOIN client c ON c.countryFk = sa.countryFk
+ WHERE c.id = ?;
+ `, [this.id]);
+ if (!this.debtor) {
+ this.debtor = await db.findOne(`
+ SELECT sa.iban,
+ be.name bankName
+ FROM supplierAccount sa
+ JOIN bankEntity be ON sa.bankEntityFk = be.id
+ JOIN company co ON co.supplierAccountFk = sa.id
+ WHERE co.id = ?;
+ `, [this.companyId]);
+ }
},
data() {
return {
diff --git a/print/templates/email/letter-debtor-st/locale/en.yml b/print/templates/email/letter-debtor-st/locale/en.yml
new file mode 100644
index 000000000..42b3bb504
--- /dev/null
+++ b/print/templates/email/letter-debtor-st/locale/en.yml
@@ -0,0 +1,11 @@
+subject: Initial Notice for Outstanding Balance
+title: Initial Notice for Outstanding Balance
+sections:
+ introduction:
+ title: Dear Customer
+ description: Through this letter, we would like to inform you that, according to our accounting records, your account has an outstanding balance that needs to be settled.
+checkExtract: We kindly request you to verify that the attached statement corresponds to the information you have. Our administration department will be happy to clarify any questions you may have and provide any documents you may request.
+checkValidData: If, upon reviewing the provided information, everything appears to be accurate, we kindly ask you to proceed with rectifying your situation.
+payMethod: If you prefer not to visit our offices in person, you can make the payment through a bank transfer to the account listed at the bottom of this communication, indicating your customer number. Alternatively, you can make the payment online through our website.
+conclusion: We sincerely appreciate your kind cooperation.
+transferAccount: Bank Transfer Details
diff --git a/print/templates/email/letter-debtor-st/sql/client.sql b/print/templates/email/letter-debtor-st/sql/client.sql
index d5da5d0d5..013a3b7d6 100644
--- a/print/templates/email/letter-debtor-st/sql/client.sql
+++ b/print/templates/email/letter-debtor-st/sql/client.sql
@@ -1,10 +1,9 @@
-SELECT
- c.dueDay,
- c.iban,
- sa.iban,
- be.name AS bankName
-FROM client c
- JOIN company AS cny
- JOIN supplierAccount AS sa ON sa.id = cny.supplierAccountFk
- JOIN bankEntity be ON be.id = sa.bankEntityFk
-WHERE c.id = ? AND cny.id = ?
\ No newline at end of file
+SELECT c.dueDay,
+ sa.iban,
+ be.name bankName
+ FROM client c
+ JOIN supplierAccount sa ON sa.id = cny.supplierAccountFk
+ JOIN bankEntity be ON be.id = sa.bankEntityFk
+ JOIN company cny
+ WHERE c.id = ?
+ AND cny.id = ?
diff --git a/print/templates/reports/sepa-core/locale/es.yml b/print/templates/reports/sepa-core/locale/es.yml
index 5f3f08fc3..2737dc313 100644
--- a/print/templates/reports/sepa-core/locale/es.yml
+++ b/print/templates/reports/sepa-core/locale/es.yml
@@ -45,4 +45,4 @@ instructions:
title: Instrucciones
accountFields: Rellenar los campos relativos a la cuenta bancaria
signDocument: Firmar y sellar el documento. Para que tenga validez, en el sello debe aparecer el CIF/NIF. De no ser así, deberá acompañarse la solicitud de un certificado de titularidad de la cuenta.
- thanks: ¡Gracias por su colaboración!
\ No newline at end of file
+ thanks: ¡Gracias por su colaboración!
diff --git a/print/templates/reports/sepa-core/locale/fr.yml b/print/templates/reports/sepa-core/locale/fr.yml
index 354c06114..355b880a1 100644
--- a/print/templates/reports/sepa-core/locale/fr.yml
+++ b/print/templates/reports/sepa-core/locale/fr.yml
@@ -1,11 +1,11 @@
reportName: direct-debit
title: Direct Debit
-description: En signant ce formulaire de mandat, vous autorisez VERDNATURA LEVANTE SL
- à envoyer des instructions à votre banque pour débiter votre compte, et (B) votre banque
- à débiter votre compte conformément aux instructions de VERDNATURA LEVANTE SL.
- Vous bénéficiez d’un droit au remboursement par votre banque selon les conditions décrites
- dans la convention que vous avez passée avec elle. Toute demande de remboursement doit être
- présentée dans les 8 semaines suivant la date de débit de votre compte.
+description: En signant ce formulaire de mandat, vous autorisez VERDNATURA LEVANTE SL
+ à envoyer des instructions à votre banque pour débiter votre compte, et (B) votre banque
+ à débiter votre compte conformément aux instructions de VERDNATURA LEVANTE SL.
+ Vous bénéficiez d’un droit au remboursement par votre banque selon les conditions décrites
+ dans la convention que vous avez passée avec elle. Toute demande de remboursement doit être
+ présentée dans les 8 semaines suivant la date de débit de votre compte.
Votre banque peut vous renseigner au sujet de vos droits relatifs à ce mandat.
documentCopy: Veuillez dater, signer et retourner ce document à votre banque.
mandatoryFields: TOUS LES CHAMPS DOIVENT ÊTRE REINSEGNÉS IMPÉRATIVEMENT.
@@ -42,4 +42,4 @@ instructions:
title: instructions
accountFields: Remplissez les champs relatifs au compte bancaire
signDocument: Signez et scellez le document. Pour être valide, le CIF / NIF doit apparaître sur le cachet. Sinon, la demande de certificat de propriété du compte doit être jointe.
- thanks: Merci de votre collaboration!
\ No newline at end of file
+ thanks: Merci de votre collaboration!
diff --git a/print/templates/reports/sepa-core/sepa-core.html b/print/templates/reports/sepa-core/sepa-core.html
index a8c270ad5..363ebdfe5 100644
--- a/print/templates/reports/sepa-core/sepa-core.html
+++ b/print/templates/reports/sepa-core/sepa-core.html
@@ -27,8 +27,8 @@