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

View File

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