5120-reports_loopback #1389
|
@ -62,6 +62,11 @@
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Bank",
|
"model": "Bank",
|
||||||
"foreignKey": "bankFk"
|
"foreignKey": "bankFk"
|
||||||
|
},
|
||||||
|
"supplier": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Supplier",
|
||||||
|
"foreignKey": "companyFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,18 +7,18 @@
|
||||||
<h3 style="text-align: center; margin-top: 8%">{{$t('Compensation') | uppercase}}</h3>
|
<h3 style="text-align: center; margin-top: 8%">{{$t('Compensation') | uppercase}}</h3>
|
||||||
<p style="margin-top: 8%">{{$t('In one hand')}}:</p>
|
<p style="margin-top: 8%">{{$t('In one hand')}}:</p>
|
||||||
<p style="text-align: justify">
|
<p style="text-align: justify">
|
||||||
{{company.name}} {{$t('CIF')}} {{company.nif}} {{$t('Home')}} {{company.street}},
|
{{receipt.supplier().name}} {{$t('CIF')}} {{receipt.supplier().nif}} {{$t('Home')}} {{receipt.supplier().street}},
|
||||||
{{company.city}}.
|
{{receipt.supplier().city}}.
|
||||||
</p>
|
</p>
|
||||||
<p style="margin-top: 5%">{{$t('In other hand')}}:</p>
|
<p style="margin-top: 5%">{{$t('In other hand')}}:</p>
|
||||||
<p style="text-align: justify">
|
<p style="text-align: justify">
|
||||||
{{$t('Sr')}} {{client.name}} {{$t('NIF')}} {{client.fi}} {{$t('Home')}} {{client.street}},
|
{{$t('Sr')}} {{receipt.client().name}} {{$t('NIF')}} {{receipt.client().fi}} {{$t('Home')}} {{receipt.client().street}},
|
||||||
{{client.city}}.
|
{{receipt.client().city}}.
|
||||||
</p>
|
</p>
|
||||||
<h4 style="text-align: center; margin-top: 10%">{{$t('Agree') | uppercase}}</h4>
|
<h4 style="text-align: center; margin-top: 10%">{{$t('Agree') | uppercase}}</h4>
|
||||||
<p style="margin-top: 8%; text-align: justify">
|
<p style="margin-top: 8%; text-align: justify">
|
||||||
{{$t('Date')}} {{formatDate(client.payed, '%d-%m-%Y')}} {{$t('Compensate')}} {{client.amountPaid}} €
|
{{$t('Date')}} {{formatDate(receipt.payed, '%d-%m-%Y')}} {{$t('Compensate')}} {{receipt.amountPaid}} €
|
||||||
{{$t('From client')}} {{client.name}} {{$t('Toclient')}} {{company.name}}.
|
{{$t('From client')}} {{receipt.client().name}} {{$t('To client')}} {{receipt.supplier().name}}.
|
||||||
</p>
|
</p>
|
||||||
<p style="margin-top: 8%">
|
<p style="margin-top: 8%">
|
||||||
{{$t('Reception')}} <span style="color: blue">administracion@verdnatura.es</span>
|
{{$t('Reception')}} <span style="color: blue">administracion@verdnatura.es</span>
|
||||||
|
|
|
@ -1,12 +1,28 @@
|
||||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
|
const app = require('vn-loopback/server/server');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'balance-compensation',
|
name: 'balance-compensation',
|
||||||
mixins: [vnReport],
|
mixins: [vnReport],
|
||||||
async serverPrefetch() {
|
async serverPrefetch() {
|
||||||
this.client = await this.findOneFromDef('client', [this.id]);
|
this.receipt = await app.models.Receipt.findOne({
|
||||||
this.checkMainEntity(this.client);
|
fields: ['amountPaid', 'payed', 'clientFk', 'companyFk'],
|
||||||
this.company = await this.findOneFromDef('company', [this.id]);
|
include: [
|
||||||
|
{
|
||||||
|
relation: 'client',
|
||||||
|
scope: {
|
||||||
|
fields: ['name', 'street', 'fi', 'city'],
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
relation: 'supplier',
|
||||||
|
scope: {
|
||||||
|
fields: ['name', 'street', 'nif', 'city'],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
where: {id: this.id}
|
||||||
|
});
|
||||||
|
this.checkMainEntity(this.receipt);
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
id: {
|
id: {
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
SELECT
|
|
||||||
c.name,
|
|
||||||
c.socialName,
|
|
||||||
c.street,
|
|
||||||
c.fi,
|
|
||||||
c.city,
|
|
||||||
r.amountPaid,
|
|
||||||
r.payed
|
|
||||||
FROM client c
|
|
||||||
JOIN receipt r ON r.clientFk = c.id
|
|
||||||
WHERE r.id = ?
|
|
|
@ -1,8 +0,0 @@
|
||||||
SELECT
|
|
||||||
s.name,
|
|
||||||
s.nif,
|
|
||||||
s.street,
|
|
||||||
s.city
|
|
||||||
FROM supplier s
|
|
||||||
JOIN receipt r ON r.companyFk = s.id
|
|
||||||
WHERE r.id = ?;
|
|
Loading…
Reference in New Issue