This commit is contained in:
parent
96becec9d3
commit
765e4ed332
|
@ -15,7 +15,8 @@ module.exports = {
|
|||
if (entity == null)
|
||||
throw new NotFoundError();
|
||||
},
|
||||
dated: function(filters, date, format) {
|
||||
formatDate: function(date, format) {
|
||||
const filters = this.$options.filters;
|
||||
return filters.date(date, format);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div class="grid-block">
|
||||
<div class="columns">
|
||||
<div class="size50">
|
||||
<p style="text-align: right">{{$t('Place')}} {{currentDate()}}</p>
|
||||
<p style="text-align: right">{{$t('Place')}} {{formatDate(new Date(), '%d-%m-%Y')}}</p>
|
||||
<h3 style="text-align: center; margin-top: 8%">{{$t('Compensation') | uppercase}}</h3>
|
||||
<p style="margin-top: 8%">{{$t('In one hand')}}:</p>
|
||||
<p style="text-align: justify">
|
||||
|
@ -17,7 +17,7 @@
|
|||
</p>
|
||||
<h4 style="text-align: center; margin-top: 10%">{{$t('Agree') | uppercase}}</h4>
|
||||
<p style="margin-top: 8%; text-align: justify">
|
||||
{{$t('Date')}} {{client.payed | date('%d-%m-%Y')}} {{$t('Compensate')}} {{client.amountPaid}} €
|
||||
{{$t('Date')}} {{formatDate(client.payed, '%d-%m-%Y')}} {{$t('Compensate')}} {{client.amountPaid}} €
|
||||
{{$t('From client')}} {{client.name}} {{$t('Toclient')}} {{company.name}}.
|
||||
</p>
|
||||
<p style="margin-top: 8%">
|
||||
|
|
|
@ -1,28 +1,12 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'balance-compensation',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.client = await this.fetchClient(this.id);
|
||||
this.company = await this.fetchCompany(this.id);
|
||||
},
|
||||
methods: {
|
||||
fetchClient(id) {
|
||||
return this.findOneFromDef('client', [id]);
|
||||
},
|
||||
fetchCompany(id) {
|
||||
return this.findOneFromDef('company', [id]);
|
||||
},
|
||||
|
||||
currentDate() {
|
||||
const current = new Date();
|
||||
const date = `${current.getDate()}/${current.getMonth() + 1}/${current.getFullYear()}`;
|
||||
return date;
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build()
|
||||
this.client = await this.findOneFromDef('client', [this.id]);
|
||||
this.checkMainEntity(this.client);
|
||||
this.company = await this.findOneFromDef('company', [this.id]);
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="font gray">{{$t('From')}}</td>
|
||||
<th>{{from | date('%d-%m-%Y')}}</th>
|
||||
<th>{{formatDate(from, '%d-%m-%Y')}}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font gray">{{$t('To')}}</td>
|
||||
<th>{{to | date('%d-%m-%Y')}}</th>
|
||||
<th>{{formatDate(to, '%d-%m-%Y')}}</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -1,27 +1,12 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const reportFooter = new Component('report-footer');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'campaign-metrics',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.client = await this.fetchClient(this.id);
|
||||
this.sales = await this.fetchSales(this.id, this.from, this.to);
|
||||
|
||||
if (!this.client)
|
||||
throw new Error('Something went wrong');
|
||||
},
|
||||
methods: {
|
||||
fetchClient(id) {
|
||||
return this.findOneFromDef('client', [id]);
|
||||
},
|
||||
fetchSales(id, from, to) {
|
||||
return this.rawSqlFromDef('sales', [id, from, to]);
|
||||
},
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build(),
|
||||
'report-footer': reportFooter.build()
|
||||
this.client = await this.findOneFromDef('client', [this.id]);
|
||||
this.checkMainEntity(this.client);
|
||||
this.sales = await this.rawSqlFromDef('sales', [this.id, this.from, this.to]);
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="font gray uppercase">{{$t('date')}}</td>
|
||||
<th>{{dated}}</th>
|
||||
<th>{{formatDate(new Date(), '%d-%m-%Y')}}</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -1,36 +1,12 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const reportFooter = new Component('report-footer');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'claim-pickup-order',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
// FORCE FAIL FOR TEST
|
||||
throw new Error('Something went wrong');
|
||||
this.client = await this.fetchClient(this.id);
|
||||
this.sales = await this.fetchSales(this.id);
|
||||
|
||||
if (!this.client)
|
||||
throw new Error('Something went wrong');
|
||||
},
|
||||
computed: {
|
||||
dated: function() {
|
||||
const filters = this.$options.filters;
|
||||
|
||||
return filters.date(new Date(), '%d-%m-%Y');
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fetchClient(id) {
|
||||
return this.findOneFromDef('client', [id]);
|
||||
},
|
||||
fetchSales(id) {
|
||||
return this.rawSqlFromDef('sales', [id]);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build(),
|
||||
'report-footer': reportFooter.build()
|
||||
this.client = await this.findOneFromDef('client', [this.id]);
|
||||
this.checkMainEntity(this.client);
|
||||
this.sales = await this.rawSqlFromDef('sales', [this.id]);
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
|
@ -38,5 +14,5 @@ module.exports = {
|
|||
required: true,
|
||||
description: 'The claim id'
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="font gray uppercase">{{$t('date')}}</td>
|
||||
<th>{{dated}}</th>
|
||||
<th>{{formatDate(new Date(), '%d-%m-%Y');}}</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -44,7 +44,7 @@
|
|||
</thead>
|
||||
<tbody v-for="sale in sales" :key="sale.id">
|
||||
<tr>
|
||||
<td>{{sale.issued | date('%d-%m-%Y')}}</td>
|
||||
<td>{{formatDate(sale.issued, '%d-%m-%Y');}}</td>
|
||||
<td>{{sale.ref}}</td>
|
||||
<td class="number">{{sale.debtOut}}</td>
|
||||
<td class="number">{{sale.debtIn}}</td>
|
||||
|
|
|
@ -1,44 +1,18 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const reportFooter = new Component('report-footer');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'client-debt-statement',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.client = await this.fetchClient(this.id);
|
||||
this.sales = await this.fetchSales(this.id, this.from);
|
||||
|
||||
if (!this.client)
|
||||
throw new Error('Something went wrong');
|
||||
},
|
||||
computed: {
|
||||
dated: function() {
|
||||
const filters = this.$options.filters;
|
||||
|
||||
return filters.date(new Date(), '%d-%m-%Y');
|
||||
}
|
||||
this.client = await this.findOneFromDef('client', [this.id]);
|
||||
this.checkMainEntity(this.client);
|
||||
this.sales = await this.rawSqlFromDef('sales',
|
||||
[this.from, this.id, this.from, this.id, this.from, this.id, this.from, this.id, this.from, this.id]);
|
||||
},
|
||||
data() {
|
||||
return {totalBalance: 0.00};
|
||||
},
|
||||
methods: {
|
||||
fetchClient(id) {
|
||||
return this.findOneFromDef('client', [id]);
|
||||
},
|
||||
fetchSales(id, from) {
|
||||
return this.rawSqlFromDef('sales', [
|
||||
from,
|
||||
id,
|
||||
from,
|
||||
id,
|
||||
from,
|
||||
id,
|
||||
from,
|
||||
id,
|
||||
from,
|
||||
id
|
||||
]);
|
||||
},
|
||||
getBalance(sale) {
|
||||
if (sale.debtOut)
|
||||
this.totalBalance += parseFloat(sale.debtOut);
|
||||
|
@ -63,10 +37,6 @@ module.exports = {
|
|||
return debtIn.toFixed(2);
|
||||
},
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build(),
|
||||
'report-footer': reportFooter.build()
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
type: Number,
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const jsBarcode = require('jsbarcode');
|
||||
const {DOMImplementation, XMLSerializer} = require('xmldom');
|
||||
const UserError = require('vn-loopback/util/user-error');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'collection-label',
|
||||
mixins: [vnReport],
|
||||
props: {
|
||||
id: {
|
||||
type: Number,
|
||||
|
@ -30,8 +29,7 @@ module.exports = {
|
|||
ticketIds = [this.id];
|
||||
|
||||
this.labelsData = await this.rawSqlFromDef('labelsData', [ticketIds]);
|
||||
if (!this.labelsData.length)
|
||||
throw new UserError('Empty data source');
|
||||
this.checkMainEntity(this.labelsData);
|
||||
},
|
||||
methods: {
|
||||
getBarcode(id) {
|
||||
|
@ -62,7 +60,4 @@ module.exports = {
|
|||
return value;
|
||||
},
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build()
|
||||
},
|
||||
};
|
||||
|
|
|
@ -159,6 +159,6 @@
|
|||
</div>
|
||||
</div>
|
||||
<template v-slot:footer>
|
||||
<report-footer id="pageFooter" v-bind:left-text="dated" v-bind="$props"> </report-footer>
|
||||
<report-footer id="pageFooter" v-bind:left-text="formatDate(new Date(), '%d-%m-%Y')" v-bind="$props"> </report-footer>
|
||||
</template>
|
||||
</report-body>
|
||||
|
|
|
@ -1,20 +1,7 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body')
|
||||
const reportFooter = new Component('report-footer');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
|
||||
const rptCreditRequest = {
|
||||
module.exports = {
|
||||
name: 'credit-request',
|
||||
computed: {
|
||||
dated: function() {
|
||||
const filters = this.$options.filters;
|
||||
|
||||
return filters.date(new Date(), '%d-%m-%Y');
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build(),
|
||||
'report-footer': reportFooter.build()
|
||||
}
|
||||
mixins: [vnReport],
|
||||
};
|
||||
|
||||
module.exports = rptCreditRequest;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="font gray uppercase">{{$t('date')}}</td>
|
||||
<th>{{ticket.shipped | date('%d-%m-%Y')}}</th>
|
||||
<th>{{formatDate(ticket.shipped, '%d-%m-%Y')}}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font gray uppercase">{{$t('packages')}}</td>
|
||||
|
@ -231,7 +231,7 @@
|
|||
<div class="header">{{$t('digitalSignature')}}</div>
|
||||
<div class="body centered">
|
||||
<img v-bind:src="dmsPath" />
|
||||
<div>{{signature.created | date('%d-%m-%Y')}}</div>
|
||||
<div>{{formatDate(signature.created, '%d-%m-%Y')}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,25 +1,21 @@
|
|||
const config = require(`vn-print/core/config`);
|
||||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const reportHeader = new Component('report-header');
|
||||
const reportFooter = new Component('report-footer');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
const md5 = require('md5');
|
||||
const fs = require('fs-extra');
|
||||
|
||||
module.exports = {
|
||||
name: 'delivery-note',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.client = await this.fetchClient(this.id);
|
||||
this.ticket = await this.fetchTicket(this.id);
|
||||
this.sales = await this.fetchSales(this.id);
|
||||
this.address = await this.fetchAddress(this.id);
|
||||
this.services = await this.fetchServices(this.id);
|
||||
this.taxes = await this.fetchTaxes(this.id);
|
||||
this.packagings = await this.fetchPackagings(this.id);
|
||||
this.signature = await this.fetchSignature(this.id);
|
||||
|
||||
if (!this.ticket)
|
||||
throw new Error('Something went wrong');
|
||||
this.ticket = await this.findOneFromDef('ticket', [this.id]);
|
||||
this.checkMainEntity(this.ticket);
|
||||
this.client = await this.findOneFromDef('client', [this.id]);
|
||||
this.sales = await this.rawSqlFromDef('sales', [this.id]);
|
||||
this.address = await this.findOneFromDef(`address`, [this.id]);
|
||||
this.services = await this.rawSqlFromDef('services', [this.id]);
|
||||
this.taxes = await this.rawSqlFromDef('taxes', [this.id]);
|
||||
this.packagings = await this.rawSqlFromDef('packagings', [this.id]);
|
||||
this.signature = await this.findOneFromDef('signature', [this.id]);
|
||||
},
|
||||
data() {
|
||||
return {totalBalance: 0.00};
|
||||
|
@ -61,31 +57,6 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
fetchClient(id) {
|
||||
return this.findOneFromDef('client', [id]);
|
||||
},
|
||||
fetchTicket(id) {
|
||||
return this.findOneFromDef('ticket', [id]);
|
||||
},
|
||||
fetchAddress(id) {
|
||||
return this.findOneFromDef(`address`, [id]);
|
||||
},
|
||||
fetchSignature(id) {
|
||||
return this.findOneFromDef('signature', [id]);
|
||||
},
|
||||
fetchTaxes(id) {
|
||||
return this.findOneFromDef(`taxes`, [id]);
|
||||
},
|
||||
fetchSales(id) {
|
||||
return this.rawSqlFromDef('sales', [id]);
|
||||
},
|
||||
fetchPackagings(id) {
|
||||
return this.rawSqlFromDef('packagings', [id]);
|
||||
},
|
||||
fetchServices(id) {
|
||||
return this.rawSqlFromDef('services', [id]);
|
||||
},
|
||||
|
||||
getSubTotal() {
|
||||
let subTotal = 0.00;
|
||||
this.sales.forEach(sale => {
|
||||
|
@ -125,11 +96,6 @@ module.exports = {
|
|||
).join(', ');
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build(),
|
||||
'report-header': reportHeader.build(),
|
||||
'report-footer': reportFooter.build()
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
type: Number,
|
||||
|
|
|
@ -16,13 +16,13 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<th class="font gray align-right">{{$t('date')}}</th>
|
||||
<td>{{route.created | date('%d-%m-%Y')}}</td>
|
||||
<td>{{formatDate(route.created, '%d-%m-%Y')}}</td>
|
||||
<th class="font gray align-right">{{$t('vehicle')}}</th>
|
||||
<td>{{route.vehicleTradeMark}} {{route.vehicleModel}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="font gray align-right">{{$t('time')}}</th>
|
||||
<td>{{route.time | date('%H:%M')}}</td>
|
||||
<td>{{formatDate(route.time, '%H:%M')}}</td>
|
||||
<td></td>
|
||||
<td>{{route.plateNumber}}</td>
|
||||
</tr>
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const reportFooter = new Component('report-footer');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'driver-route',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
let ids = this.id;
|
||||
|
||||
|
@ -11,8 +10,8 @@ module.exports = {
|
|||
if (hasMultipleRoutes)
|
||||
ids = this.id.split(',');
|
||||
|
||||
const routes = await this.fetchRoutes(ids);
|
||||
const tickets = await this.fetchTickets(ids);
|
||||
const routes = await this.rawSqlFromDef('routes', [ids]);
|
||||
const tickets = await this.rawSqlFromDef('tickets', [ids, ids]);
|
||||
|
||||
const map = new Map();
|
||||
|
||||
|
@ -27,20 +26,7 @@ module.exports = {
|
|||
|
||||
this.routes = routes;
|
||||
|
||||
if (!this.routes)
|
||||
throw new Error('Something went wrong');
|
||||
},
|
||||
methods: {
|
||||
fetchRoutes(ids) {
|
||||
return this.rawSqlFromDef('routes', [ids]);
|
||||
},
|
||||
fetchTickets(ids) {
|
||||
return this.rawSqlFromDef('tickets', [ids, ids]);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build(),
|
||||
'report-footer': reportFooter.build()
|
||||
this.checkMainEntity(this.routes);
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="font gray uppercase">{{$t('date')}}</td>
|
||||
<th>{{entry.landed | date('%d-%m-%Y')}}</th>
|
||||
<th>{{formatDate(entry.landed,'%d-%m-%Y')}}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font gray uppercase">{{$t('ref')}}</td>
|
||||
|
|
|
@ -1,31 +1,18 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const reportHeader = new Component('report-header');
|
||||
const reportFooter = new Component('report-footer');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'entry-order',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.supplier = await this.fetchSupplier(this.id);
|
||||
this.entry = await this.fetchEntry(this.id);
|
||||
this.buys = await this.fetchBuys(this.id);
|
||||
|
||||
if (!this.entry)
|
||||
throw new Error('Something went wrong');
|
||||
this.entry = await this.findOneFromDef('entry', [this.id]);
|
||||
this.checkMainEntity(this.entry);
|
||||
this.supplier = await this.findOneFromDef('supplier', [this.id]);
|
||||
this.buys = await this.rawSqlFromDef('buys', [this.id]);
|
||||
},
|
||||
data() {
|
||||
return {totalBalance: 0.00};
|
||||
},
|
||||
methods: {
|
||||
fetchSupplier(id) {
|
||||
return this.findOneFromDef('supplier', [id]);
|
||||
},
|
||||
fetchEntry(id) {
|
||||
return this.findOneFromDef('entry', [id]);
|
||||
},
|
||||
fetchBuys(id) {
|
||||
return this.rawSqlFromDef('buys', [id]);
|
||||
},
|
||||
getTotal() {
|
||||
let total = 0.00;
|
||||
this.buys.forEach(buy => {
|
||||
|
@ -35,11 +22,6 @@ module.exports = {
|
|||
return total;
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build(),
|
||||
'report-header': reportHeader.build(),
|
||||
'report-footer': reportFooter.build()
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
type: Number,
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
const jsBarcode = require('jsbarcode');
|
||||
const {DOMImplementation, XMLSerializer} = require('xmldom');
|
||||
const UserError = require('vn-loopback/util/user-error');
|
||||
const qrcode = require('qrcode');
|
||||
|
||||
module.exports = {
|
||||
name: 'expedition-pallet-label',
|
||||
mixins: [vnReport],
|
||||
props: {
|
||||
id: {
|
||||
type: Number,
|
||||
|
@ -33,8 +32,7 @@ module.exports = {
|
|||
});
|
||||
|
||||
this.QR = await this.getQR(QRdata);
|
||||
if (!this.labelsData.length)
|
||||
throw new UserError('Empty data source');
|
||||
this.checkMainEntity(this.labelsData);
|
||||
},
|
||||
methods: {
|
||||
getQR(id) {
|
||||
|
@ -56,7 +54,4 @@ module.exports = {
|
|||
return xmlSerializer.serializeToString(svgNode);
|
||||
},
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build()
|
||||
},
|
||||
};
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<div class="grid-block">
|
||||
<h1 class="title centered uppercase">{{$t('title')}}</h1>
|
||||
<p>{{$t('toAttention')}}</p>
|
||||
<p v-html="$t('declaration', [invoice.ref, issued])"></p>
|
||||
<p v-html="$t('declaration', [invoice.ref, formatDate(invoice.issued, '%d-%m-%Y')])"></p>
|
||||
<p>
|
||||
<ul>
|
||||
<li v-for="responsibility in $t('responsibilities')">
|
||||
|
|
|
@ -1,33 +1,13 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const reportFooter = new Component('report-footer');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'exportation',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.invoice = await this.fetchInvoice(this.reference);
|
||||
|
||||
if (!this.invoice)
|
||||
throw new Error('Something went wrong');
|
||||
|
||||
this.invoice = await this.findOneFromDef('invoice', [this.reference]);
|
||||
this.checkMainEntity(this.invoice);
|
||||
this.company = await this.findOneFromDef('company', [this.invoice.companyFk]);
|
||||
},
|
||||
methods: {
|
||||
fetchInvoice(reference) {
|
||||
return this.findOneFromDef('invoice', [reference]);
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
issued: function() {
|
||||
const filters = this.$options.filters;
|
||||
|
||||
return filters.date(this.invoice.issued, '%d-%m-%Y');
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build(),
|
||||
'report-footer': reportFooter.build()
|
||||
},
|
||||
props: {
|
||||
reference: {
|
||||
type: Number,
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<th class="font gray align-right">{{$t('shipped')}}</th>
|
||||
<td>{{travel.shipped | date('%d-%m-%Y')}}</td>
|
||||
<td>{{formatDate(travel.shipped, '%d-%m-%Y')}}</td>
|
||||
<th class="font gray align-right">{{$t('physicalKg')}}</th>
|
||||
<td>{{travel.loadedKg | number($i18n.locale)}}</td>
|
||||
</tr>
|
||||
|
@ -62,6 +62,6 @@
|
|||
</div>
|
||||
</div>
|
||||
<template v-slot:footer>
|
||||
<report-footer id="pageFooter" v-bind:left-text="dated" v-bind="$props"></report-footer>
|
||||
<report-footer id="pageFooter" v-bind:left-text="formatDate(new Date(), '%d-%m-%Y')" v-bind="$props"></report-footer>
|
||||
</template>
|
||||
</report-body>
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const reportFooter = new Component('report-footer');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
const db = require(`vn-print/core/database`);
|
||||
|
||||
module.exports = {
|
||||
name: 'extra-community',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.filters = this.$options.filters;
|
||||
const args = {
|
||||
landedTo: this.landedEnd,
|
||||
shippedFrom: this.shippedStart,
|
||||
|
@ -21,8 +19,9 @@ module.exports = {
|
|||
};
|
||||
|
||||
const travels = await this.fetchTravels(args);
|
||||
this.checkMainEntity(travels);
|
||||
const travelIds = travels.map(travel => travel.id);
|
||||
const entries = await this.fetchEntries(travelIds);
|
||||
const entries = await this.rawSqlFromDef('entries', [travelIds]);
|
||||
|
||||
const map = new Map();
|
||||
for (let travel of travels)
|
||||
|
@ -35,23 +34,15 @@ module.exports = {
|
|||
}
|
||||
|
||||
this.travels = travels;
|
||||
|
||||
if (!this.travels)
|
||||
throw new Error('Something went wrong');
|
||||
},
|
||||
computed: {
|
||||
dated: function() {
|
||||
return this.filters.date(new Date(), '%d-%m-%Y');
|
||||
},
|
||||
landedEnd: function() {
|
||||
if (!this.landedTo) return;
|
||||
|
||||
return this.filters.date(this.landedTo, '%Y-%m-%d');
|
||||
return formatDate(this.landedTo, '%Y-%m-%d');
|
||||
},
|
||||
shippedStart: function() {
|
||||
if (!this.shippedFrom) return;
|
||||
|
||||
return this.filters.date(this.shippedFrom, '%Y-%m-%d');
|
||||
return formatDate(this.shippedFrom, '%Y-%m-%d');
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -94,14 +85,6 @@ module.exports = {
|
|||
|
||||
return this.rawSql(query);
|
||||
},
|
||||
|
||||
fetchEntries(travelIds) {
|
||||
return this.rawSqlFromDef('entries', [travelIds]);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build(),
|
||||
'report-footer': reportFooter.build()
|
||||
},
|
||||
props: [
|
||||
'landedTo',
|
||||
|
|
|
@ -1,23 +1,12 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const reportFooter = new Component('report-footer');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'incoterms-authorization',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.client = await this.findOneFromDef('client', [this.id]);
|
||||
this.checkMainEntity(this.client);
|
||||
this.company = await this.findOneFromDef('company', [this.companyId]);
|
||||
if (!this.client)
|
||||
throw new Error('Something went wrong');
|
||||
},
|
||||
computed: {
|
||||
issued: function() {
|
||||
return new Date();
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build(),
|
||||
'report-footer': reportFooter.build()
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="font gray uppercase">{{$t('date')}}</td>
|
||||
<th>{{invoice.issued | date('%d-%m-%Y')}}</th>
|
||||
<th>{{formatDate(invoice.issued, '%d-%m-%Y')}}</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -1,34 +1,13 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const reportHeader = new Component('report-header');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'invoice-incoterms',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.invoice = await this.fetchInvoice(this.reference);
|
||||
this.client = await this.fetchClient(this.reference);
|
||||
this.incoterms = await this.fetchIncoterms(this.reference);
|
||||
|
||||
if (!this.invoice)
|
||||
throw new Error('Something went wrong');
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
methods: {
|
||||
fetchInvoice(reference) {
|
||||
return this.findOneFromDef('invoice', [reference]);
|
||||
},
|
||||
fetchClient(reference) {
|
||||
return this.findOneFromDef('client', [reference]);
|
||||
},
|
||||
fetchIncoterms(reference) {
|
||||
return this.findOneFromDef('incoterms', [reference, reference, reference]);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build(),
|
||||
'report-header': reportHeader.build()
|
||||
this.invoice = await this.findOneFromDef('invoice', [this.reference]);
|
||||
this.checkMainEntity(this.invoice);
|
||||
this.client = await this.findOneFromDef('client', [this.reference]);
|
||||
this.incoterms = await this.findOneFromDef('incoterms', [this.reference, this.reference, this.reference]);
|
||||
},
|
||||
props: {
|
||||
reference: {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="font gray uppercase">{{$t('date')}}</td>
|
||||
<th>{{invoice.issued | date('%d-%m-%Y')}}</th>
|
||||
<th>{{formatDate(invoice.issued, '%d-%m-%Y')}}</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -53,7 +53,7 @@
|
|||
<tbody>
|
||||
<tr v-for="row in rectified">
|
||||
<td>{{row.ref}}</td>
|
||||
<td>{{row.issued | date}}</td>
|
||||
<td>{{formatDate(row.issued, '%d-%m-%Y')}}</td>
|
||||
<td class="number">{{row.amount | currency('EUR', $i18n.locale)}}</td>
|
||||
<td width="50%">{{row.description}}</td>
|
||||
</tr>
|
||||
|
@ -75,7 +75,7 @@
|
|||
</div>
|
||||
<div class="pull-left">
|
||||
<div class="field rectangle">
|
||||
<span>{{ticket.shipped | date}}</span>
|
||||
<span>{{formatDate(ticket.shipped, '%d-%m-%Y')}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<span id="nickname" class="pull-right">
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const Report = require(`vn-print/core/report`);
|
||||
const reportBody = new Component('report-body');
|
||||
const reportHeader = new Component('report-header');
|
||||
const reportFooter = new Component('report-footer');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
const invoiceIncoterms = new Report('invoice-incoterms');
|
||||
|
||||
module.exports = {
|
||||
name: 'invoice',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.invoice = await this.fetchInvoice(this.reference);
|
||||
this.client = await this.fetchClient(this.reference);
|
||||
this.taxes = await this.fetchTaxes(this.reference);
|
||||
this.intrastat = await this.fetchIntrastat(this.reference);
|
||||
this.rectified = await this.fetchRectified(this.reference);
|
||||
this.hasIncoterms = await this.fetchHasIncoterms(this.reference);
|
||||
this.invoice = await this.findOneFromDef('invoice', [this.reference]);
|
||||
this.checkMainEntity(this.invoice);
|
||||
this.client = await this.findOneFromDef('client', [this.reference]);
|
||||
this.taxes = await this.rawSqlFromDef(`taxes`, [this.reference]);
|
||||
this.intrastat = await this.rawSqlFromDef(`intrastat`, [this.reference, this.reference, this.reference]);
|
||||
this.rectified = await this.rawSqlFromDef(`rectified`, [this.reference]);
|
||||
this.hasIncoterms = await this.findValueFromDef(`hasIncoterms`, [this.reference]);
|
||||
|
||||
const tickets = await this.fetchTickets(this.reference);
|
||||
const sales = await this.fetchSales(this.reference);
|
||||
const tickets = await this.rawSqlFromDef('tickets', [this.reference]);
|
||||
const sales = await this.rawSqlFromDef('sales', [this.reference, this.reference]);
|
||||
|
||||
const map = new Map();
|
||||
|
||||
|
@ -33,9 +32,6 @@ module.exports = {
|
|||
}
|
||||
|
||||
this.tickets = tickets;
|
||||
|
||||
if (!this.invoice)
|
||||
throw new Error('Something went wrong');
|
||||
},
|
||||
data() {
|
||||
return {totalBalance: 0.00};
|
||||
|
@ -66,30 +62,6 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
fetchInvoice(reference) {
|
||||
return this.findOneFromDef('invoice', [reference]);
|
||||
},
|
||||
fetchClient(reference) {
|
||||
return this.findOneFromDef('client', [reference]);
|
||||
},
|
||||
fetchTickets(reference) {
|
||||
return this.rawSqlFromDef('tickets', [reference]);
|
||||
},
|
||||
fetchSales(reference) {
|
||||
return this.rawSqlFromDef('sales', [reference, reference]);
|
||||
},
|
||||
fetchTaxes(reference) {
|
||||
return this.rawSqlFromDef(`taxes`, [reference]);
|
||||
},
|
||||
fetchIntrastat(reference) {
|
||||
return this.rawSqlFromDef(`intrastat`, [reference, reference, reference]);
|
||||
},
|
||||
fetchRectified(reference) {
|
||||
return this.rawSqlFromDef(`rectified`, [reference]);
|
||||
},
|
||||
fetchHasIncoterms(reference) {
|
||||
return this.findValueFromDef(`hasIncoterms`, [reference]);
|
||||
},
|
||||
saleImport(sale) {
|
||||
const price = sale.quantity * sale.price;
|
||||
|
||||
|
@ -111,9 +83,6 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build(),
|
||||
'report-header': reportHeader.build(),
|
||||
'report-footer': reportFooter.build(),
|
||||
'invoice-incoterms': invoiceIncoterms.build()
|
||||
},
|
||||
props: {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="font gray uppercase">{{$t('date')}}</td>
|
||||
<th>{{invoice.created | date('%d-%m-%Y')}}</th>
|
||||
<th>{{formatDate(invoice.created, '%d-%m-%Y')}}</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -54,7 +54,7 @@
|
|||
</div>
|
||||
<div class="pull-left">
|
||||
<div class="field rectangle">
|
||||
<span>{{entry.landed | date}}</span>
|
||||
<span>{{formatDate(entry.landed, '%d-%m-%Y')}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<span id="nickname" class="pull-right">
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const reportHeader = new Component('report-header');
|
||||
const reportFooter = new Component('report-footer');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'invoiceIn',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.invoice = await this.fetchInvoice(this.id);
|
||||
this.invoice = await this.findOneFromDef('invoice', [this.id]);
|
||||
this.checkMainEntity(this.invoice);
|
||||
this.taxes = await this.fetchTaxes(this.id);
|
||||
|
||||
let defaultTax = await this.fetchDefaultTax();
|
||||
let defaultTax = await this.findOneFromDef('defaultTax');
|
||||
|
||||
if (defaultTax) {
|
||||
defaultTax = Object.assign(defaultTax, {
|
||||
|
@ -19,11 +18,8 @@ module.exports = {
|
|||
this.taxes.push(defaultTax);
|
||||
}
|
||||
|
||||
if (!this.invoice)
|
||||
throw new Error('Something went wrong');
|
||||
|
||||
const entries = await this.fetchEntry(this.id);
|
||||
const buys = await this.fetchBuy(this.id);
|
||||
const entries = await this.rawSqlFromDef('entry', [this.id]);
|
||||
const buys = await this.rawSqlFromDef('buy', [this.id]);
|
||||
|
||||
const map = new Map();
|
||||
|
||||
|
@ -41,21 +37,7 @@ module.exports = {
|
|||
|
||||
this.entries = entries;
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
methods: {
|
||||
fetchInvoice(id) {
|
||||
return this.findOneFromDef('invoice', [id]);
|
||||
},
|
||||
fetchEntry(id) {
|
||||
return this.rawSqlFromDef('entry', [id]);
|
||||
},
|
||||
fetchBuy(id) {
|
||||
return this.rawSqlFromDef('buy', [id]);
|
||||
},
|
||||
fetchDefaultTax() {
|
||||
return this.findOneFromDef('defaultTax');
|
||||
},
|
||||
async fetchTaxes(id) {
|
||||
const taxes = await this.rawSqlFromDef(`taxes`, [id]);
|
||||
return this.taxVat(taxes);
|
||||
|
@ -95,11 +77,6 @@ module.exports = {
|
|||
return base + vat;
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build(),
|
||||
'report-header': reportHeader.build(),
|
||||
'report-footer': reportFooter.build(),
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
type: Number,
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<div class="details">
|
||||
<div class="package">
|
||||
<div class="packing">{{packing()}}</div>
|
||||
<div class="dated">{{dated}}</div>
|
||||
<div class="dated">{{formatDate(new Date(), '%W/%d')}}</div>
|
||||
<div class="labelNumber">{{labelPage}}</div>
|
||||
</div>
|
||||
<div class="size">{{item.size}}</div>
|
||||
|
|
|
@ -1,24 +1,17 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
const qrcode = require('qrcode');
|
||||
|
||||
module.exports = {
|
||||
name: 'item-label',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.item = await this.fetchItem(this.id, this.warehouseId);
|
||||
this.item = await this.findOneFromDef('item', [this.id, this.warehouseId]);
|
||||
this.checkMainEntity(this.item);
|
||||
this.tags = await this.fetchItemTags(this.id);
|
||||
this.barcode = await this.getBarcodeBase64(this.id);
|
||||
|
||||
if (!this.item)
|
||||
throw new Error('Something went wrong');
|
||||
},
|
||||
|
||||
computed: {
|
||||
dated() {
|
||||
const filters = this.$options.filters;
|
||||
|
||||
return filters.date(new Date(), '%W/%d');
|
||||
},
|
||||
labelPage() {
|
||||
const labelNumber = this.labelNumber ? this.labelNumber : 1;
|
||||
const totalLabels = this.totalLabels ? this.totalLabels : 1;
|
||||
|
@ -27,9 +20,6 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
fetchItem(id, warehouseId) {
|
||||
return this.findOneFromDef('item', [id, warehouseId]);
|
||||
},
|
||||
fetchItemTags(id) {
|
||||
return this.rawSqlFromDef('itemTags', [id]).then(rows => {
|
||||
const tags = {};
|
||||
|
@ -48,9 +38,6 @@ module.exports = {
|
|||
return `${this.item.packing}x${stems}`;
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build()
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
type: Number,
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="font gray uppercase">{{$t('date')}}</td>
|
||||
<th>{{dated}}</th>
|
||||
<th>{{formatDate(new Date(), '%d-%m-%Y')}}</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -44,7 +44,7 @@
|
|||
</thead>
|
||||
<tbody v-for="sale in sales" :key="sale.id">
|
||||
<tr>
|
||||
<td>{{sale.issued | date('%d-%m-%Y')}}</td>
|
||||
<td>{{formatDate(sale.issued, '%d-%m-%Y')}}</td>
|
||||
<td>{{sale.ref}}</td>
|
||||
<td class="number">{{sale.debtOut}}</td>
|
||||
<td class="number">{{sale.debtIn}}</td>
|
||||
|
|
|
@ -1,36 +1,17 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const reportFooter = new Component('report-footer');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'letter-debtor',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.client = await this.fetchClient(this.id);
|
||||
this.sales = await this.fetchSales(this.id, this.companyId);
|
||||
|
||||
if (!this.client)
|
||||
throw new Error('Something went wrong');
|
||||
},
|
||||
computed: {
|
||||
dated: function() {
|
||||
const filters = this.$options.filters;
|
||||
|
||||
return filters.date(new Date(), '%d-%m-%Y');
|
||||
}
|
||||
this.client = await this.findOneFromDef('client', [this.id]);
|
||||
this.checkMainEntity(this.client);
|
||||
this.sales = await this.findOneFromDef('sales', [this.id, this.companyId]);
|
||||
},
|
||||
data() {
|
||||
return {totalBalance: 0.00};
|
||||
},
|
||||
methods: {
|
||||
fetchClient(id) {
|
||||
return this.findOneFromDef('client', [id]);
|
||||
},
|
||||
fetchSales(id, companyId) {
|
||||
return this.findOneFromDef('sales', [
|
||||
id,
|
||||
companyId
|
||||
]);
|
||||
},
|
||||
getBalance(sale) {
|
||||
if (sale.debtOut)
|
||||
this.totalBalance += parseFloat(sale.debtOut);
|
||||
|
@ -57,10 +38,6 @@ module.exports = {
|
|||
return debtIn.toFixed(2);
|
||||
},
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build(),
|
||||
'report-footer': reportFooter.build()
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
type: Number,
|
||||
|
|
|
@ -1,36 +1,24 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
const qrcode = require('qrcode');
|
||||
const UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = {
|
||||
name: 'previa-label',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.previa = await this.fetchPrevia(this.id);
|
||||
this.sector = await this.fetchSector(this.id);
|
||||
this.sector = await this.findOneFromDef('sector', [this.id]);
|
||||
this.checkMainEntity(this.sector);
|
||||
this.previa = await this.findOneFromDef('previa', [this.id]);
|
||||
this.barcode = await this.getBarcodeBase64(this.id);
|
||||
|
||||
if (this.previa)
|
||||
this.previa = this.previa[0];
|
||||
|
||||
if (!this.sector)
|
||||
throw new UserError('Something went wrong - no sector found');
|
||||
},
|
||||
methods: {
|
||||
fetchPrevia(id) {
|
||||
return this.findOneFromDef('previa', [id]);
|
||||
},
|
||||
getBarcodeBase64(id) {
|
||||
const data = String(id);
|
||||
|
||||
return qrcode.toDataURL(data, {margin: 0});
|
||||
},
|
||||
fetchSector(id) {
|
||||
return this.findOneFromDef('sector', [id]);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build()
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
|
|
|
@ -1,27 +1,12 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const reportFooter = new Component('report-footer');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'receipt',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.client = await this.fetchClient(this.id);
|
||||
this.receipt = await this.fetchReceipt(this.id);
|
||||
|
||||
if (!this.receipt)
|
||||
throw new Error('Something went wrong');
|
||||
},
|
||||
methods: {
|
||||
fetchClient(id) {
|
||||
return this.findOneFromDef('client', [id]);
|
||||
},
|
||||
fetchReceipt(id) {
|
||||
return this.findOneFromDef('receipt', [id]);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build(),
|
||||
'report-footer': reportFooter.build()
|
||||
this.receipt = await this.findOneFromDef('receipt', [this.id]);
|
||||
this.checkMainEntity(this.receipt);
|
||||
this.client = await this.findOneFromDef('client', [this.id]);
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
|
|
|
@ -147,7 +147,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>{{$t('client.signLocation')}}</td>
|
||||
<th>{{dated}}, {{client.province}}</th>
|
||||
<th>{{formatDate(new Date(), '%d-%m-%Y')}}, {{client.province}}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{$t('client.sign')}}</td>
|
||||
|
|
|
@ -1,44 +1,12 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const reportHeader = new Component('report-header');
|
||||
const reportFooter = new Component('report-footer');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
|
||||
const rptSepaCore = {
|
||||
module.exports = {
|
||||
name: 'sepa-core',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.client = await this.fetchClient(this.id, this.companyId);
|
||||
this.supplier = await this.fetchSupplier(this.id, this.companyId);
|
||||
|
||||
if (!this.client)
|
||||
throw new Error('Something went wrong');
|
||||
},
|
||||
computed: {
|
||||
dated: function() {
|
||||
const filters = this.$options.filters;
|
||||
|
||||
return filters.date(new Date(), '%d-%m-%Y');
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
fetchClient(id, companyId) {
|
||||
return this.findOneFromDef('client', [
|
||||
companyId,
|
||||
companyId,
|
||||
id
|
||||
]);
|
||||
},
|
||||
fetchSupplier(id, companyId) {
|
||||
return this.findOneFromDef('supplier', [
|
||||
companyId,
|
||||
companyId,
|
||||
id
|
||||
]);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build(),
|
||||
'report-header': reportHeader.build(),
|
||||
'report-footer': reportFooter.build()
|
||||
this.client = await this.findOneFromDef('client', [this.companyId, this.companyId, this.id]);
|
||||
this.checkMainEntity(this.client);
|
||||
this.supplier = await this.findOneFromDef('supplier', [this.companyId, this.companyId, this.id]);
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
|
@ -52,5 +20,3 @@ const rptSepaCore = {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = rptSepaCore;
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="font gray">{{$t('From')}}</td>
|
||||
<th>{{from | date('%d-%m-%Y')}}</th>
|
||||
<th>{{formatDate(from, '%d-%m-%Y')}}</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="font gray">{{$t('To')}}</td>
|
||||
<th>{{to | date('%d-%m-%Y')}}</th>
|
||||
<th>{{formatDate(to, '%d-%m-%Y')}}</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
@ -38,7 +38,7 @@
|
|||
<div v-for="entry in entries" v-if="entry.buys">
|
||||
<h2>
|
||||
<span>{{$t('entry')}} {{entry.id}}</span>
|
||||
<span>{{$t('dated')}} {{entry.shipped | date('%d-%m-%Y')}}</span>
|
||||
<span>{{$t('dated')}} {{formatDate(entry.shipped, '%d-%m-%Y')}}</span>
|
||||
<span class="pull-right">{{$t('reference')}} {{entry.reference}}</span>
|
||||
</h2>
|
||||
<table class="column-oriented repeatable">
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const reportFooter = new Component('report-footer');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'supplier-campaign-metrics',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.supplier = await this.fetchSupplier(this.id);
|
||||
let entries = await this.fetchEntries(this.id, this.from, this.to);
|
||||
this.supplier = await this.findOneFromDef('supplier', [this.id]);
|
||||
this.checkMainEntity(this.supplier);
|
||||
let entries = await this.rawSqlFromDef('entries', [this.id, this.from, this.to]);
|
||||
|
||||
const entriesId = [];
|
||||
|
||||
for (let entry of entries)
|
||||
entriesId.push(entry.id);
|
||||
|
||||
const buys = await this.fetchBuys(entriesId);
|
||||
const buys = await this.rawSqlFromDef('buys', [entriesId]);
|
||||
|
||||
const entriesMap = new Map();
|
||||
for (let entry of entries)
|
||||
|
@ -29,23 +29,6 @@ module.exports = {
|
|||
}
|
||||
|
||||
this.entries = entries;
|
||||
if (!this.supplier)
|
||||
throw new Error('Something went wrong');
|
||||
},
|
||||
methods: {
|
||||
fetchSupplier(supplierId) {
|
||||
return this.findOneFromDef('supplier', [supplierId]);
|
||||
},
|
||||
fetchEntries(supplierId, from, to) {
|
||||
return this.rawSqlFromDef('entries', [supplierId, from, to]);
|
||||
},
|
||||
fetchBuys(entriesId) {
|
||||
return this.rawSqlFromDef('buys', [entriesId]);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build(),
|
||||
'report-footer': reportFooter.build()
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<tr>
|
||||
<td>{{vehicleEvent.numberPlate}}</td>
|
||||
<td>{{vehicleEvent.description}}</td>
|
||||
<td>{{vehicleEvent.finished | date('%d-%m-%Y')}}</td>
|
||||
<td>{{formatDate(vehicleEvent.finished, '%d-%m-%Y')}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
@ -1,21 +1,10 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
module.exports = {
|
||||
name: 'vehicle-event-expired',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.vehicleEvents = await this.fetchVehicleEvent(this.eventIds);
|
||||
|
||||
if (!this.vehicleEvents)
|
||||
throw new Error('Something went wrong');
|
||||
},
|
||||
methods: {
|
||||
fetchVehicleEvent(vehicleEventIds) {
|
||||
return this.rawSqlFromDef('vehicleEvents', [vehicleEventIds]);
|
||||
},
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build()
|
||||
this.vehicleEvents = await this.rawSqlFromDef('vehicleEvents', [this.eventIds]);
|
||||
this.checkMainEntity(this.vehicleEvents);
|
||||
},
|
||||
props: {
|
||||
eventIds: {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<report-body v-bind="$props">
|
||||
<div class="text">{{zone.agencyName}}</div>
|
||||
<div class="text">{{zone.id}}</div>
|
||||
<div class="text">{{zone.plateNumber}} {{zone.time | date('%H:%M')}}</div>
|
||||
<div class="text">{{zone.plateNumber}} {{formatDate(zone.time, '%H:%M')}}</div>
|
||||
</report-body>
|
||||
|
|
|
@ -1,21 +1,11 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const reportBody = new Component('report-body');
|
||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'zone',
|
||||
mixins: [vnReport],
|
||||
async serverPrefetch() {
|
||||
this.zone = await this.fetchZone(this.id);
|
||||
|
||||
if (!this.zone)
|
||||
throw new Error('Something went wrong');
|
||||
},
|
||||
methods: {
|
||||
fetchZone(id) {
|
||||
return this.findOneFromDef('zone', [id]);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
'report-body': reportBody.build()
|
||||
this.zone = await this.findOneFromDef('zone', [this.id]);
|
||||
this.checkMainEntity(this.zone);
|
||||
},
|
||||
props: {
|
||||
id: {
|
||||
|
|
Loading…
Reference in New Issue