diff --git a/print/common/css/layout.css b/print/common/css/layout.css index 3e302d6753..ce63ca5084 100644 --- a/print/common/css/layout.css +++ b/print/common/css/layout.css @@ -99,6 +99,10 @@ width: 35.4px } +.emptyField { + border-bottom: 1px dotted grey +} + .field.rectangle span { height: 2em; width: 8em @@ -185,20 +189,45 @@ table { color: #888 } - .line { border-bottom: 1px solid #DDD; border-right: 1px solid #DDD; border-left: 1px solid #DDD; + position: relative; + margin-left: -1px; + margin-right: 1px; margin-top: 10px; color: #999; - padding: 5px + padding: 5px 0 +} + +.line .vertical-aligned { + position: absolute; + text-align: center; + width: 100%; + } .line span { background-color: #FFF; - margin: -5px 0 0 50px; - display: block; - padding: 5px; - float: left + padding: 5px } + +.signature { + width: 100%; +} + +.signature td { + text-align: center; + margin: auto; + width: 40%; + padding: 0 50px 0 50px; +} + +.signature-image { + height: 150px; +} + +.signature-line { + border-bottom: 1px solid #DDD; +} \ No newline at end of file diff --git a/print/config/routes.json b/print/config/routes.json index 69b94a6e43..6e287131fb 100644 --- a/print/config/routes.json +++ b/print/config/routes.json @@ -14,6 +14,7 @@ {"type": "report", "name": "rpt-receipt"}, {"type": "report", "name": "rpt-zone"}, {"type": "report", "name": "rpt-route"}, + {"type": "report", "name": "rpt-lcr"}, {"type": "static", "name": "email-header"}, {"type": "static", "name": "email-footer"}, {"type": "static", "name": "report-header"}, diff --git a/print/report/rpt-lcr/assets/css/index.js b/print/report/rpt-lcr/assets/css/index.js new file mode 100644 index 0000000000..515dea7503 --- /dev/null +++ b/print/report/rpt-lcr/assets/css/index.js @@ -0,0 +1,8 @@ +const CssReader = require(`${appPath}/lib/cssReader`); + +module.exports = new CssReader([ + `${appPath}/common/css/layout.css`, + `${appPath}/common/css/report.css`, + `${appPath}/common/css/misc.css`, + `${__dirname}/style.css`]) + .mergeStyles(); diff --git a/print/report/rpt-lcr/assets/css/style.css b/print/report/rpt-lcr/assets/css/style.css new file mode 100644 index 0000000000..fa128e9336 --- /dev/null +++ b/print/report/rpt-lcr/assets/css/style.css @@ -0,0 +1,19 @@ +.payment-type { + width: auto +} + +.payment-type th:nth-child(2), .payment-type th:nth-child(5) { + padding: 10px !important +} + +.payment-type th:nth-child(3){ + padding: 0 50px !important +} + +.table-margin { + margin-top: 20px +} + +.grey-background { + background-color: #DDD +} \ No newline at end of file diff --git a/print/report/rpt-lcr/assets/images/signature.png b/print/report/rpt-lcr/assets/images/signature.png new file mode 100644 index 0000000000..c69cc4798e Binary files /dev/null and b/print/report/rpt-lcr/assets/images/signature.png differ diff --git a/print/report/rpt-lcr/index.html b/print/report/rpt-lcr/index.html new file mode 100644 index 0000000000..9a72efd73f --- /dev/null +++ b/print/report/rpt-lcr/index.html @@ -0,0 +1,197 @@ + + + +
+ + + +
+

{{$t('title')}}

+
+
{{$t('Creditor')}}
+
+ + + + + + + + + + + + + + + + + + + +
{{$t('supplier.name')}}:{{supplierName}}
{{$t('supplier.street')}}:{{supplierStreet}}
{{supplierPostCode}}, {{supplierCity}} ({{supplierProvince}})
{{supplierCountry}}
+
+
+
+
{{$t('Deptor')}}
+
+ + + + + + + + + + + + + + + + + + + + + + + +
{{$t('client.name')}}:{{clientName}}
{{$t('client.street')}}:{{clientStreet}}
{{clientPostCode}}, {{clientCity}} ({{clientProvince}})
{{clientCountry}}
{{$t('client.fi')}}: +
+ {{fi.charAt(i)}} +
+
+
+
+

{{$t('description')}}

+
+
{{$t('Bank')}}
+
+
+ {{$t('client.toCompleteByClient')}} +
+ + + + + + + + + + + +
{{$t('bank.name')}}:
{{$t('bank.street')}}:
+ + + + + + + + + + + + + + + + + + + + +
{{$t('bank.account')}}:
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+
+ {{$t('bank.bankCode')}} +
+
+
+
+
+ {{$t('bank.agencyCode')}} +
+
+
+
+
+ {{$t('bank.accountNumber')}} +
+
+
+
+
+ {{$t('bank.ribKey')}} +
+
+
+ + + + + + + + + + + +
IBAN:
+
+ F + R + +
+
+
+
+

{{$t('authorization')}}

+ + + + + + + + + +
+ +
+

(signature autorisée du tiré)

+
+
+
+

(lieu et date)

+
+
+ + + + +
+ + \ No newline at end of file diff --git a/print/report/rpt-lcr/index.js b/print/report/rpt-lcr/index.js new file mode 100755 index 0000000000..d4342764c1 --- /dev/null +++ b/print/report/rpt-lcr/index.js @@ -0,0 +1,80 @@ +const strftime = require('strftime'); +const database = require(`${appPath}/lib/database`); +const UserException = require(`${appPath}/lib/exceptions/userException`); + +module.exports = { + name: 'rpt-lcr', + async asyncData(ctx, params) { + if (!params.clientFk) + throw new UserException('No client id specified'); + + if (!params.companyFk) + throw new UserException('No company id specified'); + + return this.methods.fetchClient(params.clientFk, params.companyFk) + .then(([[client]]) => { + if (!client) + throw new UserException('No client data found'); + + return client; + }); + }, + created() { + if (this.locale) + this.$i18n.locale = this.locale; + + const embeded = []; + this.files.map(file => { + embeded[file] = `file://${__dirname + file}`; + }); + this.embeded = embeded; + }, + data() { + return { + files: ['/assets/images/signature.png'] + }; + }, + methods: { + fetchClient(clientFk, companyFk) { + return database.pool.query( + `SELECT + c.id clientId, + u.lang locale, + m.code mandateCode, + c.socialName AS clientName, + c.street AS clientStreet, + c.postcode AS clientPostCode, + c.city AS clientCity, + c.fi, + p.name AS clientProvince, + ct.country AS clientCountry, + s.name AS supplierName, + s.street AS supplierStreet, + sc.country AS supplierCountry, + s.postCode AS supplierPostCode, + s.city AS supplierCity, + sp.name AS supplierProvince + FROM client c + JOIN account.user u ON u.id = c.id + JOIN country ct ON ct.id = c.countryFk + LEFT JOIN mandate m ON m.clientFk = c.id + AND m.companyFk = ? AND m.finished IS NULL + LEFT JOIN supplier s ON s.id = m.companyFk + LEFT JOIN country sc ON sc.id = s.countryFk + LEFT JOIN province sp ON sp.id = s.provinceFk + LEFT JOIN province p ON p.id = c.provinceFk + WHERE (m.companyFk = ? OR m.companyFk IS NULL) AND c.id = ? + ORDER BY m.created DESC LIMIT 1`, [companyFk, companyFk, clientFk]); + }, + dated: () => { + return strftime('%d-%m-%Y', new Date()); + }, + toISOString: date => { + return strftime('%d-%m-%Y', date); + }, + }, + components: { + 'report-header': require('../report-header'), + 'report-footer': require('../report-footer'), + }, +}; diff --git a/print/report/rpt-lcr/locale.js b/print/report/rpt-lcr/locale.js new file mode 100644 index 0000000000..d2906a68ac --- /dev/null +++ b/print/report/rpt-lcr/locale.js @@ -0,0 +1,44 @@ +module.exports = { + messages: { + es: { + title: 'Autorisation pour débit', + Creditor: 'Tireur', + Deptor: 'Tiré', + Bank: 'Banque', + description: `Nous, soussignés, autorisons que tout effet émis par le tireur , susmentionné, et tiré sur notre Société, + soit automatiquement débité dans notre compte selon les suivants détails de domiciliation:`, + authorization: `Cette autorisation maintient sa validité jusqu'à à la réception de + nouvelles instructions.`, + supplier: { + name: 'Nom', + street: 'Adresse' + }, + bank: { + name: 'Nom', + street: 'Adresse', + account: 'RIB', + bankCode: 'Code banque', + agencyCode: 'Code agence', + accountNumber: 'Numero de compte', + ribKey: 'Clé RIB' + }, + client: { + name: 'Nom', + street: 'Adresse', + fi: 'Siren', + location: 'CP - Población - Provincia', + country: 'País del deudor', + swift: 'Swift BIC', + accountNumber: 'Número de cuenta - IBAN', + accountNumberFormat: 'En España el IBAN consta de 24 posiciones comenzando siempre por ES', + paymentType: 'Tipo de pago', + recurrent: 'Recurrente', + unique: 'Único', + signLocation: 'Fecha - Localidad', + sign: 'Firma del deudor y sello', + toCompleteByClient: 'À remplir par le débiteur', + }, + order: 'Ord. domiciliación {0}', + }, + }, +};