fixed sepa core preview for clients without mandate
gitea/salix/dev This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-05-07 07:33:21 +02:00
parent cc78169707
commit 8336db59d4
2 changed files with 33 additions and 17 deletions

View File

@ -17,7 +17,7 @@
<tbody>
<tr>
<td>{{$t('supplier.orderReference')}}</td>
<th>{{mandateCode}}</td>
<th>{{mandateCode}}</th>
</tr>
<tr>
<td>{{$t('supplier.identifier')}}</td>
@ -62,19 +62,19 @@
{{$t('client.name')}}
<section class="description">{{$t('client.accountHolder')}}</section>
</td>
<th>{{clientName}}</td>
<th>{{clientName}}</th>
</tr>
<tr>
<td>{{$t('client.street')}}</td>
<th>{{clientStreet}}</td>
<th>{{clientStreet}}</th>
</tr>
<tr>
<td>{{$t('client.location')}}</td>
<th>{{clientPostCode}}, {{clientCity}} ({{clientProvince}})</td>
<th>{{clientPostCode}}, {{clientCity}} ({{clientProvince}})</th>
</tr>
<tr>
<td>{{$t('client.country')}}</td>
<th>{{clientCountry}}</td>
<th>{{clientCountry}}</th>
</tr>
<tr>
<td>{{$t('client.swift')}}</td>
@ -82,7 +82,7 @@
<section class="field square">
<span v-for="i in 11"></span>
</section>
</td>
</th>
</tr>
<tr>
<td colspan="2">{{$t('client.accountNumber')}}</td>
@ -123,15 +123,15 @@
<th>{{$t('client.unique')}}</th>
</tr>
</table>
</td>
</th>
</tr>
<tr>
<td>{{$t('client.signLocation')}}</td>
<th>{{dated()}}, {{supplierProvince}}</td>
<th>{{dated()}}, {{supplierProvince}}</th>
</tr>
<tr>
<td>{{$t('client.sign')}}</td>
<th></td>
<th></th>
</tr>
</tbody>
</table>

View File

@ -1,10 +1,19 @@
const fs = require('fs');
const strftime = require('strftime');
const database = require(`${appPath}/lib/database`);
const template = fs.readFileSync(__dirname + '/index.html').toString();
const lang = require('./locale.js');
const UserException = require(`${appPath}/lib/exceptions/userException`);
module.exports = {
const rptSepaCore = {
name: 'rpt-sepa-core',
async asyncData(ctx, params) {
serverPrefetch() {
this.clientName = 'Name123';
},
/* async asyncData(ctx, params) {
if (!params.clientFk)
throw new UserException('No client id specified');
@ -18,8 +27,9 @@ module.exports = {
return client;
});
},
}, */
created() {
this.clientId = 101;
if (this.locale)
this.$i18n.locale = this.locale;
},
@ -46,13 +56,13 @@ module.exports = {
FROM client c
JOIN account.user u ON u.id = c.id
JOIN country ct ON ct.id = c.countryFk
JOIN mandate m ON m.clientFk = c.id
LEFT JOIN mandate m ON m.clientFk = c.id
AND m.companyFk = ? AND m.finished IS NULL
JOIN supplier s ON s.id = m.companyFk
JOIN country sc ON sc.id = s.countryFk
JOIN province sp ON sp.id = s.provinceFk
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 = ? AND c.id = ?
WHERE (m.companyFk = ? OR m.companyFk IS NULL) AND c.id = ?
ORDER BY m.created DESC LIMIT 1`, [companyFk, companyFk, clientFk]);
},
dated: () => {
@ -66,4 +76,10 @@ module.exports = {
'report-header': require('../report-header'),
'report-footer': require('../report-footer'),
},
template: template,
i18n: lang,
props: ['test']
};
module.exports = rptSepaCore;