Reports refactor
gitea/salix/pipeline/head There was a failure building this commit Details

This commit is contained in:
Joan Sanchez 2022-09-26 13:33:27 +02:00
parent 85698410db
commit 7f78286d6b
58 changed files with 883 additions and 218 deletions

View File

@ -14,4 +14,13 @@ INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalTyp
('Client', 'letterDebtorNdHtml', 'READ', 'ALLOW', 'ROLE', 'employee'), ('Client', 'letterDebtorNdHtml', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'letterDebtorNdEmail', 'READ', 'ALLOW', 'ROLE', 'employee'), ('Client', 'letterDebtorNdEmail', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'clientDebtStatementHtml', 'READ', 'ALLOW', 'ROLE', 'employee'), ('Client', 'clientDebtStatementHtml', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'clientDebtStatementEmail', 'READ', 'ALLOW', 'ROLE', 'employee'); ('Client', 'clientDebtStatementEmail', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'incotermsAuthorizationHtml', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Client', 'incotermsAuthorizationEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('InvoiceOut', 'invoiceEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('InvoiceOut', 'exportationPdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Supplier', 'campaignMetricsPdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Supplier', 'campaignMetricsEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('Travel', 'extraCommunityPdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Travel', 'extraCommunityEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
('Entry', 'entryOrderPdf', 'READ', 'ALLOW', 'ROLE', 'employee');

View File

@ -3,30 +3,4 @@ alter table `vn`.`sample`
UPDATE vn.sample t UPDATE vn.sample t
SET t.model = 'Clients' SET t.model = 'Clients'
WHERE t.id = 13; WHERE t.id IN(13, 14, 15, 16, 18, 19, 20);
UPDATE vn.sample t
SET t.model = 'Clients'
WHERE t.id = 12;
UPDATE vn.sample t
SET t.model = 'Clients'
WHERE t.id = 14;
UPDATE vn.sample t
SET t.model = 'Clients'
WHERE t.id = 15;
UPDATE vn.sample t
SET t.model = 'Clients'
WHERE t.id = 18;
UPDATE vn.sample t
SET t.model = 'Clients'
WHERE t.id = 19;
UPDATE vn.sample t
SET t.model = 'Clients'
WHERE t.id = 16;

View File

@ -1765,11 +1765,6 @@ INSERT INTO `vn`.`claimDestination`(`id`, `description`, `addressFk`)
(4, 'Reclam.PRAG', 12), (4, 'Reclam.PRAG', 12),
(5, 'Corregido', 11); (5, 'Corregido', 11);
INSERT INTO `vn`.`claimResponsible`(`id`, `description`, `responsability`)
VALUES
(1, 'Buyers', 0),
(7, 'Quality', 0);
INSERT INTO `vn`.`claimDevelopment`(`id`, `claimFk`, `claimResponsibleFk`, `workerFk`, `claimReasonFk`, `claimResultFk`, `claimRedeliveryFk`, `claimDestinationFk`) INSERT INTO `vn`.`claimDevelopment`(`id`, `claimFk`, `claimResponsibleFk`, `workerFk`, `claimReasonFk`, `claimResultFk`, `claimRedeliveryFk`, `claimDestinationFk`)
VALUES VALUES
(1, 1, 1, 21, 1, 1, 2, 5), (1, 1, 1, 21, 1, 1, 2, 5),

View File

@ -0,0 +1,65 @@
const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('incotermsAuthorizationEmail', {
description: 'Sends the incoterms authorization email with an attached PDF',
accessType: 'WRITE',
accepts: [
{
arg: 'id',
type: 'number',
required: true,
description: 'The client id',
http: {source: 'path'}
},
{
arg: 'recipient',
type: 'string',
description: 'The recipient email',
required: true,
},
{
arg: 'replyTo',
type: 'string',
description: 'The sender email to reply to',
required: false
},
{
arg: 'recipientId',
type: 'number',
description: 'The recipient id to send to the recipient preferred language',
required: false
},
{
arg: 'companyId',
type: 'number',
description: 'The company id',
required: true
}
],
returns: {
type: ['object'],
root: true
},
http: {
path: '/:id/incoterms-authorization-email',
verb: 'POST'
}
});
Self.incotermsAuthorizationEmail = async ctx => {
const args = Object.assign({}, ctx.args);
const params = {
recipient: args.recipient,
lang: ctx.req.getLocale()
};
delete args.ctx;
for (const param in args)
params[param] = args[param];
const email = new Email('incoterms-authorization', params);
return email.send();
};
};

View File

@ -0,0 +1,64 @@
const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('incotermsAuthorizationHtml', {
description: 'Returns the incoterms authorization email preview',
accessType: 'READ',
accepts: [
{
arg: 'id',
type: 'number',
required: true,
description: 'The client id',
http: {source: 'path'}
},
{
arg: 'recipientId',
type: 'number',
description: 'The recipient id',
required: false
},
{
arg: 'companyId',
type: 'number',
description: 'The company id',
required: true
}
],
returns: [
{
arg: 'body',
type: 'file',
root: true
}, {
arg: 'Content-Type',
type: 'String',
http: {target: 'header'}
}, {
arg: 'Content-Disposition',
type: 'String',
http: {target: 'header'}
}
],
http: {
path: '/:id/incoterms-authorization-html',
verb: 'GET'
}
});
Self.incotermsAuthorizationHtml = async(ctx, id) => {
const args = Object.assign({}, ctx.args);
const params = {lang: ctx.req.getLocale()};
delete args.ctx;
for (const param in args)
params[param] = args[param];
params.isPreview = true;
const report = new Email('incoterms-authorization', params);
const html = await report.render();
return [html, 'text/html', `filename="mail-${id}.pdf"`];
};
};

View File

@ -40,4 +40,6 @@ module.exports = Self => {
require('../methods/client/clientDebtStatementEmail')(Self); require('../methods/client/clientDebtStatementEmail')(Self);
require('../methods/client/creditRequestHtml')(Self); require('../methods/client/creditRequestHtml')(Self);
require('../methods/client/creditRequestEmail')(Self); require('../methods/client/creditRequestEmail')(Self);
require('../methods/client/incotermsAuthorizationHtml')(Self);
require('../methods/client/incotermsAuthorizationEmail')(Self);
}; };

View File

@ -1,4 +1,5 @@
const UserError = require('vn-loopback/util/user-error'); const UserError = require('vn-loopback/util/user-error');
const LoopBackContext = require('loopback-context');
module.exports = Self => { module.exports = Self => {
Self.validatesPresenceOf('typeFk', { Self.validatesPresenceOf('typeFk', {
@ -6,10 +7,10 @@ module.exports = Self => {
}); });
Self.observe('before save', async function(ctx) { Self.observe('before save', async function(ctx) {
let models = Self.app.models; const models = Self.app.models;
let changes = ctx.data || ctx.instance; const changes = ctx.data || ctx.instance;
let sample = await models.Sample.findById(changes.typeFk); const sample = await models.Sample.findById(changes.typeFk);
if (sample.hasCompany && !changes.companyFk) if (sample.hasCompany && !changes.companyFk)
throw new UserError('Choose a company'); throw new UserError('Choose a company');
@ -25,11 +26,11 @@ module.exports = Self => {
// Renew mandate // Renew mandate
if (mandate) { if (mandate) {
let mandateType = await models.MandateType.findOne({ const mandateType = await models.MandateType.findOne({
where: {name: mandate.type} where: {name: mandate.type}
}); });
let oldMandate = await models.Mandate.findOne({ const oldMandate = await models.Mandate.findOne({
where: { where: {
clientFk: changes.clientFk, clientFk: changes.clientFk,
companyFk: changes.companyFk, companyFk: changes.companyFk,
@ -50,10 +51,8 @@ module.exports = Self => {
}); });
} }
// Apply workerFk const loopBackContext = LoopBackContext.getCurrentContext();
let filter = {where: {userFk: ctx.options.accessToken.userId}};
let worker = await Self.app.models.Worker.findOne(filter);
changes.workerFk = worker.id; changes.userFk = loopBackContext.active.accessToken.userId;
}); });
}; };

View File

@ -32,9 +32,6 @@
}, },
"model": { "model": {
"type": "string" "type": "string"
},
"property": {
"type": "string"
} }
}, },
"scopes": { "scopes": {

View File

@ -0,0 +1,54 @@
const {Report} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('entryOrderPdf', {
description: 'Returns the entry order pdf',
accepts: [
{
arg: 'id',
type: 'number',
required: true,
http: {source: 'path'}
},
{
arg: 'recipientId',
type: 'number',
description: 'The recipient id',
required: false
}
],
returns: [
{
arg: 'body',
type: 'file',
root: true
}, {
arg: 'Content-Type',
type: 'String',
http: {target: 'header'}
}, {
arg: 'Content-Disposition',
type: 'String',
http: {target: 'header'}
}
],
http: {
path: '/:id/entry-order-pdf',
verb: 'GET'
}
});
Self.entryOrderPdf = async(ctx, id) => {
const args = Object.assign({}, ctx.args);
const params = {lang: ctx.req.getLocale()};
delete args.ctx;
for (const param in args)
params[param] = args[param];
const report = new Report('entry-order', params);
const stream = await report.toPdfStream();
return [stream, 'application/pdf', `filename="doc-${id}.pdf"`];
};
};

View File

@ -6,4 +6,5 @@ module.exports = Self => {
require('../methods/entry/importBuys')(Self); require('../methods/entry/importBuys')(Self);
require('../methods/entry/importBuysPreview')(Self); require('../methods/entry/importBuysPreview')(Self);
require('../methods/entry/lastItemBuys')(Self); require('../methods/entry/lastItemBuys')(Self);
require('../methods/entry/entryOrderPdf')(Self);
}; };

View File

@ -86,9 +86,7 @@ class Controller extends Descriptor {
} }
showEntryReport() { showEntryReport() {
this.vnReport.show('entry-order', { this.vnReport.show(`Entries/${this.id}/entry-order-pdf`);
entryId: this.entry.id
});
} }
} }

View File

@ -0,0 +1,54 @@
const {Report} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('exportationPdf', {
description: 'Returns the exportation pdf',
accepts: [
{
arg: 'ref',
type: 'string',
required: true,
http: {source: 'path'}
},
{
arg: 'recipientId',
type: 'number',
description: 'The recipient id',
required: false
}
],
returns: [
{
arg: 'body',
type: 'file',
root: true
}, {
arg: 'Content-Type',
type: 'String',
http: {target: 'header'}
}, {
arg: 'Content-Disposition',
type: 'String',
http: {target: 'header'}
}
],
http: {
path: '/:ref/exportation-pdf',
verb: 'GET'
}
});
Self.exportationPdf = async(ctx, ref) => {
const args = Object.assign({}, ctx.args);
const params = {lang: ctx.req.getLocale()};
delete args.ctx;
for (const param in args)
params[param] = args[param];
const report = new Report('exportation', params);
const stream = await report.toPdfStream();
return [stream, 'application/pdf', `filename="doc-${ref}.pdf"`];
};
};

View File

@ -0,0 +1,58 @@
const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('invoiceEmail', {
description: 'Sends the invoice email with an attached PDF',
accessType: 'WRITE',
accepts: [
{
arg: 'ref',
type: 'string',
required: true,
http: {source: 'path'}
},
{
arg: 'recipient',
type: 'string',
description: 'The recipient email',
required: true,
},
{
arg: 'replyTo',
type: 'string',
description: 'The sender email to reply to',
required: false
},
{
arg: 'recipientId',
type: 'number',
description: 'The recipient id to send to the recipient preferred language',
required: false
}
],
returns: {
type: ['object'],
root: true
},
http: {
path: '/:ref/invoice-email',
verb: 'POST'
}
});
Self.invoiceEmail = async ctx => {
const args = Object.assign({}, ctx.args);
const params = {
recipient: args.recipient,
lang: ctx.req.getLocale()
};
delete args.ctx;
for (const param in args)
params[param] = args[param];
const email = new Email('invoice', params);
return email.send();
};
};

View File

@ -9,4 +9,6 @@ module.exports = Self => {
require('../methods/invoiceOut/createManualInvoice')(Self); require('../methods/invoiceOut/createManualInvoice')(Self);
require('../methods/invoiceOut/globalInvoicing')(Self); require('../methods/invoiceOut/globalInvoicing')(Self);
require('../methods/invoiceOut/refund')(Self); require('../methods/invoiceOut/refund')(Self);
require('../methods/invoiceOut/invoiceEmail')(Self);
require('../methods/invoiceOut/exportationPdf')(Self);
}; };

View File

@ -92,10 +92,9 @@ class Controller extends Section {
if (!$data.email) if (!$data.email)
return this.vnApp.showError(this.$t(`The email can't be empty`)); return this.vnApp.showError(this.$t(`The email can't be empty`));
return this.vnEmail.send('invoice', { return this.vnEmail.send(`InvoiceOuts/${this.invoiceOut.ref}/invoice-email`, {
recipientId: this.invoiceOut.client.id, recipientId: this.invoiceOut.client.id,
recipient: $data.email, recipient: $data.email
refFk: this.invoiceOut.ref
}); });
} }
@ -111,7 +110,7 @@ class Controller extends Section {
} }
showExportationLetter() { showExportationLetter() {
this.vnReport.show('exportation', { this.vnReport.show(`InvoiceOuts/${this.invoiceOut.ref}/exportation-pdf`, {
recipientId: this.invoiceOut.client.id, recipientId: this.invoiceOut.client.id,
refFk: this.invoiceOut.ref refFk: this.invoiceOut.ref
}); });

View File

@ -0,0 +1,68 @@
const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('campaignMetricsEmail', {
description: 'Sends the campaign metrics email with an attached PDF',
accessType: 'WRITE',
accepts: [
{
arg: 'id',
type: 'number',
required: true,
http: {source: 'path'}
},
{
arg: 'recipient',
type: 'string',
description: 'The recipient email',
required: true,
},
{
arg: 'replyTo',
type: 'string',
description: 'The sender email to reply to',
required: false
},
{
arg: 'recipientId',
type: 'number',
description: 'The recipient id to send to the recipient preferred language',
required: false
},
{
arg: 'from',
type: 'string',
required: true
},
{
arg: 'to',
type: 'string',
required: true
}
],
returns: {
type: ['object'],
root: true
},
http: {
path: '/:id/campaign-metrics-email',
verb: 'POST'
}
});
Self.campaignMetricsEmail = async ctx => {
const args = Object.assign({}, ctx.args);
const params = {
recipient: args.recipient,
lang: ctx.req.getLocale()
};
delete args.ctx;
for (const param in args)
params[param] = args[param];
const email = new Email('supplier-campaign-metrics', params);
return email.send();
};
};

View File

@ -0,0 +1,65 @@
const {Report} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('campaignMetricsPdf', {
description: 'Returns the campaign metrics pdf',
accessType: 'READ',
accepts: [
{
arg: 'id',
type: 'number',
required: true,
http: {source: 'path'}
},
{
arg: 'recipientId',
type: 'number',
description: 'The recipient id',
required: false
},
{
arg: 'from',
type: 'string',
required: true
},
{
arg: 'to',
type: 'string',
required: true
}
],
returns: [
{
arg: 'body',
type: 'file',
root: true
}, {
arg: 'Content-Type',
type: 'String',
http: {target: 'header'}
}, {
arg: 'Content-Disposition',
type: 'String',
http: {target: 'header'}
}
],
http: {
path: '/:id/campaign-metrics-pdf',
verb: 'GET'
}
});
Self.campaignMetricsPdf = async(ctx, id) => {
const args = Object.assign({}, ctx.args);
const params = {lang: ctx.req.getLocale()};
delete args.ctx;
for (const param in args)
params[param] = args[param];
const report = new Report('supplier-campaign-metrics', params);
const stream = await report.toPdfStream();
return [stream, 'application/pdf', `filename="doc-${id}.pdf"`];
};
};

View File

@ -8,6 +8,8 @@ module.exports = Self => {
require('../methods/supplier/updateFiscalData')(Self); require('../methods/supplier/updateFiscalData')(Self);
require('../methods/supplier/consumption')(Self); require('../methods/supplier/consumption')(Self);
require('../methods/supplier/freeAgencies')(Self); require('../methods/supplier/freeAgencies')(Self);
require('../methods/supplier/campaignMetricsPdf')(Self);
require('../methods/supplier/campaignMetricsEmail')(Self);
Self.validatesPresenceOf('name', { Self.validatesPresenceOf('name', {
message: 'The social name cannot be empty' message: 'The social name cannot be empty'

View File

@ -33,7 +33,8 @@ class Controller extends Section {
} }
showReport() { showReport() {
this.vnReport.show('supplier-campaign-metrics', this.reportParams); const path = `Suppliers/${this.supplier.id}/campaign-metrics-pdf`;
this.vnReport.show(path, this.reportParams);
} }
sendEmail() { sendEmail() {
@ -52,7 +53,9 @@ class Controller extends Section {
const params = Object.assign({ const params = Object.assign({
recipient: contact.email recipient: contact.email
}, this.reportParams); }, this.reportParams);
this.vnEmail.send('supplier-campaign-metrics', params);
const path = `Suppliers/${this.supplier.id}/campaign-metrics-email`;
this.vnEmail.send(path, params);
} else { } else {
const message = this.$t(`This supplier doesn't have a contact with an email address`); const message = this.$t(`This supplier doesn't have a contact with an email address`);
this.vnApp.showError(message); this.vnApp.showError(message);

View File

@ -0,0 +1,92 @@
const {Email} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('extraCommunityEmail', {
description: 'Sends the extra community email with an attached PDF',
accessType: 'WRITE',
accepts: [
{
arg: 'recipient',
type: 'string',
description: 'The recipient email',
required: true,
},
{
arg: 'replyTo',
type: 'string',
description: 'The sender email to reply to',
required: false
},
{
arg: 'recipientId',
type: 'number',
description: 'The recipient id to send to the recipient preferred language',
required: false
},
{
arg: 'landedTo',
type: 'date'
},
{
arg: 'shippedFrom',
type: 'date'
},
{
arg: 'continent',
type: 'string'
},
{
arg: 'ref',
type: 'string'
},
{
arg: 'id',
type: 'number'
},
{
arg: 'agencyModeFk',
type: 'number'
},
{
arg: 'warehouseOutFk',
type: 'number'
},
{
arg: 'warehouseInFk',
type: 'number'
},
{
arg: 'totalEntries',
type: 'number'
},
{
arg: 'cargoSupplierFk',
type: 'number'
}
],
returns: {
type: ['object'],
root: true
},
http: {
path: '/extra-community-email',
verb: 'POST'
}
});
Self.extraCommunityEmail = async ctx => {
const args = Object.assign({}, ctx.args);
const params = {
recipient: args.recipient,
lang: ctx.req.getLocale()
};
delete args.ctx;
for (const param in args)
params[param] = args[param];
const email = new Email('extra-community', params);
return email.send();
};
};

View File

@ -0,0 +1,89 @@
const {Report} = require('vn-print');
module.exports = Self => {
Self.remoteMethodCtx('extraCommunityPdf', {
description: 'Returns the extra community pdf',
accessType: 'READ',
accepts: [
{
arg: 'recipientId',
type: 'number',
description: 'The recipient id',
required: false
},
{
arg: 'landedTo',
type: 'date'
},
{
arg: 'shippedFrom',
type: 'date'
},
{
arg: 'continent',
type: 'string'
},
{
arg: 'ref',
type: 'string'
},
{
arg: 'id',
type: 'number'
},
{
arg: 'agencyModeFk',
type: 'number'
},
{
arg: 'warehouseOutFk',
type: 'number'
},
{
arg: 'warehouseInFk',
type: 'number'
},
{
arg: 'totalEntries',
type: 'number'
},
{
arg: 'cargoSupplierFk',
type: 'number'
}
],
returns: [
{
arg: 'body',
type: 'file',
root: true
}, {
arg: 'Content-Type',
type: 'String',
http: {target: 'header'}
}, {
arg: 'Content-Disposition',
type: 'String',
http: {target: 'header'}
}
],
http: {
path: '/extra-community-pdf',
verb: 'GET'
}
});
Self.extraCommunityPdf = async ctx => {
const args = Object.assign({}, ctx.args);
const params = {lang: ctx.req.getLocale()};
delete args.ctx;
for (const param in args)
params[param] = args[param];
const report = new Report('extra-community', params);
const stream = await report.toPdfStream();
return [stream, 'application/pdf', `filename="extra-community.pdf"`];
};
};

View File

@ -10,6 +10,8 @@ module.exports = Self => {
require('../methods/travel/extraCommunityFilter')(Self); require('../methods/travel/extraCommunityFilter')(Self);
require('../methods/travel/getAverageDays')(Self); require('../methods/travel/getAverageDays')(Self);
require('../methods/travel/cloneWithEntries')(Self); require('../methods/travel/cloneWithEntries')(Self);
require('../methods/travel/extraCommunityPdf')(Self);
require('../methods/travel/extraCommunityEmail')(Self);
Self.rewriteDbError(function(err) { Self.rewriteDbError(function(err) {
if (err.code === 'ER_DUP_ENTRY') if (err.code === 'ER_DUP_ENTRY')

View File

@ -157,7 +157,7 @@ class Controller extends Section {
} }
showReport() { showReport() {
this.vnReport.show('extra-community', this.reportParams); this.vnReport.show(`Travels/extra-community-pdf`, this.reportParams);
} }
} }

View File

@ -1,4 +1,4 @@
const Component = require(`vn-report/core/component`); const Component = require(`vn-print/core/component`);
const emailHeader = new Component('email-header'); const emailHeader = new Component('email-header');
const emailFooter = new Component('email-footer'); const emailFooter = new Component('email-footer');
const attachment = new Component('attachment'); const attachment = new Component('attachment');

View File

@ -1,8 +1,11 @@
const Stylesheet = require(`${appPath}/core/stylesheet`); const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([ module.exports = new Stylesheet([
`${appPath}/common/css/spacing.css`, `${vnPrintPath}/common/css/spacing.css`,
`${appPath}/common/css/misc.css`, `${vnPrintPath}/common/css/misc.css`,
`${appPath}/common/css/layout.css`, `${vnPrintPath}/common/css/layout.css`,
`${appPath}/common/css/email.css`]) `${vnPrintPath}/common/css/email.css`])
.mergeStyles(); .mergeStyles();

View File

@ -1,15 +1,15 @@
const Component = require(`${appPath}/core/component`); const Component = require(`vn-print/core/component`);
const emailHeader = new Component('email-header'); const emailHeader = new Component('email-header');
const emailFooter = new Component('email-footer'); const emailFooter = new Component('email-footer');
module.exports = { module.exports = {
name: 'invoice', name: 'invoice',
async serverPrefetch() { async serverPrefetch() {
this.invoice = await this.fetchInvoice(this.refFk); this.invoice = await this.fetchInvoice(this.ref);
}, },
methods: { methods: {
fetchInvoice(refFk) { fetchInvoice(ref) {
return this.findOneFromDef('invoice', [refFk]); return this.findOneFromDef('invoice', [ref]);
}, },
}, },
components: { components: {
@ -17,7 +17,7 @@ module.exports = {
'email-footer': emailFooter.build() 'email-footer': emailFooter.build()
}, },
props: { props: {
refFk: { ref: {
type: [Number, String], type: [Number, String],
required: true required: true
} }

View File

@ -1,8 +1,11 @@
const Stylesheet = require(`${appPath}/core/stylesheet`); const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([ module.exports = new Stylesheet([
`${appPath}/common/css/spacing.css`, `${vnPrintPath}/common/css/spacing.css`,
`${appPath}/common/css/misc.css`, `${vnPrintPath}/common/css/misc.css`,
`${appPath}/common/css/layout.css`, `${vnPrintPath}/common/css/layout.css`,
`${appPath}/common/css/email.css`]) `${vnPrintPath}/common/css/email.css`])
.mergeStyles(); .mergeStyles();

View File

@ -1,4 +1,4 @@
const Component = require(`${appPath}/core/component`); const Component = require(`vn-print/core/component`);
const emailHeader = new Component('email-header'); const emailHeader = new Component('email-header');
const emailFooter = new Component('email-footer'); const emailFooter = new Component('email-footer');
@ -20,7 +20,7 @@ module.exports = {
'email-footer': emailFooter.build() 'email-footer': emailFooter.build()
}, },
props: { props: {
recipientId: { id: {
type: [Number, String], type: [Number, String],
required: true required: true
}, },

View File

@ -26,7 +26,8 @@ module.exports = {
props: { props: {
id: { id: {
type: [Number, String], type: [Number, String],
required: true required: true,
description: 'The client id'
}, },
from: { from: {
required: true required: true

View File

@ -37,7 +37,8 @@ module.exports = {
props: { props: {
id: { id: {
type: [Number, String], type: [Number, String],
required: true required: true,
description: 'The claim id'
} }
} }
}; };

View File

@ -70,7 +70,8 @@ module.exports = {
props: { props: {
id: { id: {
type: [Number, String], type: [Number, String],
required: true required: true,
description: 'The client id'
}, },
from: { from: {
required: true required: true

View File

@ -128,7 +128,8 @@ module.exports = {
props: { props: {
id: { id: {
type: [Number, String], type: [Number, String],
required: true required: true,
description: 'The ticket id'
}, },
type: { type: {
type: String, type: String,

View File

@ -45,7 +45,8 @@ module.exports = {
props: { props: {
id: { id: {
type: [Number, String], type: [Number, String],
required: true required: true,
description: 'The route id'
} }
} }
}; };

View File

@ -1,9 +1,12 @@
const Stylesheet = require(`${appPath}/core/stylesheet`); const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([ module.exports = new Stylesheet([
`${appPath}/common/css/spacing.css`, `${vnPrintPath}/common/css/spacing.css`,
`${appPath}/common/css/misc.css`, `${vnPrintPath}/common/css/misc.css`,
`${appPath}/common/css/layout.css`, `${vnPrintPath}/common/css/layout.css`,
`${appPath}/common/css/report.css`, `${vnPrintPath}/common/css/report.css`,
`${__dirname}/style.css`]) `${__dirname}/style.css`])
.mergeStyles(); .mergeStyles();

View File

@ -1,13 +1,13 @@
const Component = require(`${appPath}/core/component`); const Component = require(`vn-print/core/component`);
const reportHeader = new Component('report-header'); const reportHeader = new Component('report-header');
const reportFooter = new Component('report-footer'); const reportFooter = new Component('report-footer');
module.exports = { module.exports = {
name: 'entry-order', name: 'entry-order',
async serverPrefetch() { async serverPrefetch() {
this.supplier = await this.fetchSupplier(this.entryId); this.supplier = await this.fetchSupplier(this.id);
this.entry = await this.fetchEntry(this.entryId); this.entry = await this.fetchEntry(this.id);
this.buys = await this.fetchBuys(this.entryId); this.buys = await this.fetchBuys(this.id);
if (!this.entry) if (!this.entry)
throw new Error('Something went wrong'); throw new Error('Something went wrong');
@ -16,14 +16,14 @@ module.exports = {
return {totalBalance: 0.00}; return {totalBalance: 0.00};
}, },
methods: { methods: {
fetchSupplier(entryId) { fetchSupplier(id) {
return this.findOneFromDef('supplier', [entryId]); return this.findOneFromDef('supplier', [id]);
}, },
fetchEntry(entryId) { fetchEntry(id) {
return this.findOneFromDef('entry', [entryId]); return this.findOneFromDef('entry', [id]);
}, },
fetchBuys(entryId) { fetchBuys(id) {
return this.rawSqlFromDef('buys', [entryId]); return this.rawSqlFromDef('buys', [id]);
}, },
getTotal() { getTotal() {
let total = 0.00; let total = 0.00;
@ -39,9 +39,10 @@ module.exports = {
'report-footer': reportFooter.build() 'report-footer': reportFooter.build()
}, },
props: { props: {
entryId: { id: {
type: [Number, String], type: [Number, String],
required: true required: true,
description: 'The entry id'
} }
} }
}; };

View File

@ -1,8 +1,12 @@
const Stylesheet = require(`${appPath}/core/stylesheet`); const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([ module.exports = new Stylesheet([
`${appPath}/common/css/layout.css`, `${vnPrintPath}/common/css/spacing.css`,
`${appPath}/common/css/report.css`, `${vnPrintPath}/common/css/misc.css`,
`${appPath}/common/css/misc.css`, `${vnPrintPath}/common/css/layout.css`,
`${vnPrintPath}/common/css/report.css`,
`${__dirname}/style.css`]) `${__dirname}/style.css`])
.mergeStyles(); .mergeStyles();

View File

@ -31,9 +31,9 @@
<p><em>({{$t('signature')}})</em></p> <p><em>({{$t('signature')}})</em></p>
<img v-bind:src="getReportSrc('signature.png')"> <img v-bind:src="getReportSrc('signature.png')">
<p> <p>
<div>{{$t('signer.name')}}: JUAN VICENTE FERRER ROIG</div> <div>{{$t('signer.name')}}: {{company.manager}}</div>
<div>{{$t('signer.ID')}}: 73943586N</div> <div>{{$t('signer.ID')}}: {{company.managerFi}}</div>
<div>{{$t('signer.position')}}: ADMINISTRADOR</div> <div>{{$t('signer.position')}}: {{$t('manager')}}</div>
</p> </p>
</div> </div>
</div> </div>

View File

@ -1,18 +1,20 @@
const Component = require(`${appPath}/core/component`); const Component = require(`vn-print/core/component`);
const reportHeader = new Component('report-header'); const reportHeader = new Component('report-header');
const reportFooter = new Component('report-footer'); const reportFooter = new Component('report-footer');
module.exports = { module.exports = {
name: 'exportation', name: 'exportation',
async serverPrefetch() { async serverPrefetch() {
this.invoice = await this.fetchInvoice(this.refFk); this.invoice = await this.fetchInvoice(this.ref);
if (!this.invoice) if (!this.invoice)
throw new Error('Something went wrong'); throw new Error('Something went wrong');
this.company = await this.findOneFromDef('company', [this.invoice.companyFk]);
}, },
methods: { methods: {
fetchInvoice(refFk) { fetchInvoice(ref) {
return this.findOneFromDef('invoice', [refFk]); return this.findOneFromDef('invoice', [ref]);
} }
}, },
computed: { computed: {
@ -27,9 +29,10 @@ module.exports = {
'report-footer': reportFooter.build() 'report-footer': reportFooter.build()
}, },
props: { props: {
refFk: { ref: {
type: [Number, String], type: [Number, String],
required: true required: true,
description: 'The invoice ref'
} }
} }
}; };

View File

@ -36,6 +36,7 @@ signer:
name: Nombre del firmante name: Nombre del firmante
ID: DNI del firmante ID: DNI del firmante
position: Cargo del firmante position: Cargo del firmante
manager: Gerente
months: months:
- 'Enero' - 'Enero'
- 'Febrero' - 'Febrero'

View File

@ -0,0 +1,9 @@
SELECT
s.name,
s.city,
cl.name AS manager,
cl.fi AS managerFi
FROM company c
JOIN supplier s ON s.id = c.id
JOIN client cl ON cl.id = c.workerManagerFk
WHERE c.id = ?

View File

@ -1,7 +1,8 @@
SELECT SELECT
io.id, io.id,
io.ref, io.ref,
io.issued io.issued,
io.companyFk
FROM invoiceOut io FROM invoiceOut io
LEFT JOIN ticket t ON t.refFk = io.ref LEFT JOIN ticket t ON t.refFk = io.ref
WHERE t.refFk = ? WHERE t.refFk = ?

View File

@ -1,9 +1,12 @@
const Stylesheet = require(`${appPath}/core/stylesheet`); const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([ module.exports = new Stylesheet([
`${appPath}/common/css/spacing.css`, `${vnPrintPath}/common/css/spacing.css`,
`${appPath}/common/css/misc.css`, `${vnPrintPath}/common/css/misc.css`,
`${appPath}/common/css/layout.css`, `${vnPrintPath}/common/css/layout.css`,
`${appPath}/common/css/report.css`, `${vnPrintPath}/common/css/report.css`,
`${__dirname}/style.css`]) `${__dirname}/style.css`])
.mergeStyles(); .mergeStyles();

View File

@ -1,7 +1,7 @@
const Component = require(`${appPath}/core/component`); const Component = require(`vn-print/core/component`);
const reportHeader = new Component('report-header'); const reportHeader = new Component('report-header');
const reportFooter = new Component('report-footer'); const reportFooter = new Component('report-footer');
const db = require(`${appPath}/core/database`); const db = require(`vn-print/core/database`);
module.exports = { module.exports = {
name: 'extra-community', name: 'extra-community',
@ -82,7 +82,15 @@ module.exports = {
let query = this.getSqlFromDef('travels'); let query = this.getSqlFromDef('travels');
query = db.merge(query, where); query = db.merge(query, where);
query = db.merge(query, 'GROUP BY t.id'); query = db.merge(query, 'GROUP BY t.id');
query = db.merge(query, 'ORDER BY `shipped` ASC, `landed` ASC, `travelFk`, `loadPriority`, `agencyModeFk`, `evaNotes`'); query = db.merge(query, `
ORDER BY
shipped ASC,
landed ASC,
travelFk,
loadPriority,
agencyModeFk,
evaNotes
`);
return this.rawSql(query); return this.rawSql(query);
}, },

View File

@ -22,7 +22,8 @@ module.exports = {
props: { props: {
id: { id: {
type: [Number, String], type: [Number, String],
required: true required: true,
description: 'The client id'
}, },
companyId: { companyId: {
type: [Number, String], type: [Number, String],

View File

@ -1,9 +1,12 @@
const Stylesheet = require(`${appPath}/core/stylesheet`); const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([ module.exports = new Stylesheet([
`${appPath}/common/css/spacing.css`, `${vnPrintPath}/common/css/spacing.css`,
`${appPath}/common/css/misc.css`, `${vnPrintPath}/common/css/misc.css`,
`${appPath}/common/css/layout.css`, `${vnPrintPath}/common/css/layout.css`,
`${appPath}/common/css/report.css`, `${vnPrintPath}/common/css/report.css`,
`${__dirname}/style.css`]) `${__dirname}/style.css`])
.mergeStyles(); .mergeStyles();

View File

@ -1,13 +1,13 @@
const Component = require(`${appPath}/core/component`); const Component = require(`vn-print/core/component`);
const reportHeader = new Component('report-header'); const reportHeader = new Component('report-header');
const reportFooter = new Component('report-footer'); const reportFooter = new Component('report-footer');
module.exports = { module.exports = {
name: 'invoice-incoterms', name: 'invoice-incoterms',
async serverPrefetch() { async serverPrefetch() {
this.invoice = await this.fetchInvoice(this.refFk); this.invoice = await this.fetchInvoice(this.ref);
this.client = await this.fetchClient(this.refFk); this.client = await this.fetchClient(this.ref);
this.incoterms = await this.fetchIncoterms(this.refFk); this.incoterms = await this.fetchIncoterms(this.ref);
if (!this.invoice) if (!this.invoice)
throw new Error('Something went wrong'); throw new Error('Something went wrong');
@ -16,14 +16,14 @@ module.exports = {
}, },
methods: { methods: {
fetchInvoice(refFk) { fetchInvoice(ref) {
return this.findOneFromDef('invoice', [refFk]); return this.findOneFromDef('invoice', [ref]);
}, },
fetchClient(refFk) { fetchClient(ref) {
return this.findOneFromDef('client', [refFk]); return this.findOneFromDef('client', [ref]);
}, },
fetchIncoterms(refFk) { fetchIncoterms(ref) {
return this.findOneFromDef('incoterms', [refFk, refFk, refFk]); return this.findOneFromDef('incoterms', [ref, ref, ref]);
} }
}, },
components: { components: {
@ -31,9 +31,10 @@ module.exports = {
'report-footer': reportFooter.build() 'report-footer': reportFooter.build()
}, },
props: { props: {
refFk: { ref: {
type: [Number, String], type: [Number, String],
required: true required: true,
description: 'The invoice ref'
} }
} }
}; };

View File

@ -1,9 +1,12 @@
const Stylesheet = require(`${appPath}/core/stylesheet`); const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([ module.exports = new Stylesheet([
`${appPath}/common/css/spacing.css`, `${vnPrintPath}/common/css/spacing.css`,
`${appPath}/common/css/misc.css`, `${vnPrintPath}/common/css/misc.css`,
`${appPath}/common/css/layout.css`, `${vnPrintPath}/common/css/layout.css`,
`${appPath}/common/css/report.css`, `${vnPrintPath}/common/css/report.css`,
`${__dirname}/style.css`]) `${__dirname}/style.css`])
.mergeStyles(); .mergeStyles();

View File

@ -1,5 +1,5 @@
const Component = require(`${appPath}/core/component`); const Component = require(`vn-print/core/component`);
const Report = require(`${appPath}/core/report`); const Report = require(`vn-print/core/report`);
const reportHeader = new Component('report-header'); const reportHeader = new Component('report-header');
const reportFooter = new Component('report-footer'); const reportFooter = new Component('report-footer');
const invoiceIncoterms = new Report('invoice-incoterms'); const invoiceIncoterms = new Report('invoice-incoterms');
@ -7,15 +7,15 @@ const invoiceIncoterms = new Report('invoice-incoterms');
module.exports = { module.exports = {
name: 'invoice', name: 'invoice',
async serverPrefetch() { async serverPrefetch() {
this.invoice = await this.fetchInvoice(this.refFk); this.invoice = await this.fetchInvoice(this.ref);
this.client = await this.fetchClient(this.refFk); this.client = await this.fetchClient(this.ref);
this.taxes = await this.fetchTaxes(this.refFk); this.taxes = await this.fetchTaxes(this.ref);
this.intrastat = await this.fetchIntrastat(this.refFk); this.intrastat = await this.fetchIntrastat(this.ref);
this.rectified = await this.fetchRectified(this.refFk); this.rectified = await this.fetchRectified(this.ref);
this.hasIncoterms = await this.fetchHasIncoterms(this.refFk); this.hasIncoterms = await this.fetchHasIncoterms(this.ref);
const tickets = await this.fetchTickets(this.refFk); const tickets = await this.fetchTickets(this.ref);
const sales = await this.fetchSales(this.refFk); const sales = await this.fetchSales(this.ref);
const map = new Map(); const map = new Map();
@ -65,29 +65,29 @@ module.exports = {
} }
}, },
methods: { methods: {
fetchInvoice(refFk) { fetchInvoice(ref) {
return this.findOneFromDef('invoice', [refFk]); return this.findOneFromDef('invoice', [ref]);
}, },
fetchClient(refFk) { fetchClient(ref) {
return this.findOneFromDef('client', [refFk]); return this.findOneFromDef('client', [ref]);
}, },
fetchTickets(refFk) { fetchTickets(ref) {
return this.rawSqlFromDef('tickets', [refFk]); return this.rawSqlFromDef('tickets', [ref]);
}, },
fetchSales(refFk) { fetchSales(ref) {
return this.rawSqlFromDef('sales', [refFk, refFk]); return this.rawSqlFromDef('sales', [ref, ref]);
}, },
fetchTaxes(refFk) { fetchTaxes(ref) {
return this.rawSqlFromDef(`taxes`, [refFk]); return this.rawSqlFromDef(`taxes`, [ref]);
}, },
fetchIntrastat(refFk) { fetchIntrastat(ref) {
return this.rawSqlFromDef(`intrastat`, [refFk, refFk, refFk]); return this.rawSqlFromDef(`intrastat`, [ref, ref, ref]);
}, },
fetchRectified(refFk) { fetchRectified(ref) {
return this.rawSqlFromDef(`rectified`, [refFk]); return this.rawSqlFromDef(`rectified`, [ref]);
}, },
fetchHasIncoterms(refFk) { fetchHasIncoterms(ref) {
return this.findValueFromDef(`hasIncoterms`, [refFk]); return this.findValueFromDef(`hasIncoterms`, [ref]);
}, },
saleImport(sale) { saleImport(sale) {
const price = sale.quantity * sale.price; const price = sale.quantity * sale.price;
@ -115,8 +115,9 @@ module.exports = {
'invoice-incoterms': invoiceIncoterms.build() 'invoice-incoterms': invoiceIncoterms.build()
}, },
props: { props: {
refFk: { ref: {
type: String type: String,
description: 'The invoice ref'
} }
} }
}; };

View File

@ -1,9 +1,12 @@
const Stylesheet = require(`${appPath}/core/stylesheet`); const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([ module.exports = new Stylesheet([
`${appPath}/common/css/spacing.css`, `${vnPrintPath}/common/css/spacing.css`,
`${appPath}/common/css/misc.css`, `${vnPrintPath}/common/css/misc.css`,
`${appPath}/common/css/layout.css`, `${vnPrintPath}/common/css/layout.css`,
`${appPath}/common/css/report.css`, `${vnPrintPath}/common/css/report.css`,
`${__dirname}/style.css`]) `${__dirname}/style.css`])
.mergeStyles(); .mergeStyles();

View File

@ -1,4 +1,4 @@
const Component = require(`${appPath}/core/component`); const Component = require(`vn-print/core/component`);
const reportHeader = new Component('report-header'); const reportHeader = new Component('report-header');
const reportFooter = new Component('report-footer'); const reportFooter = new Component('report-footer');
const qrcode = require('qrcode'); const qrcode = require('qrcode');
@ -6,9 +6,9 @@ const qrcode = require('qrcode');
module.exports = { module.exports = {
name: 'item-label', name: 'item-label',
async serverPrefetch() { async serverPrefetch() {
this.item = await this.fetchItem(this.itemId, this.warehouseId); this.item = await this.fetchItem(this.id, this.warehouseId);
this.tags = await this.fetchItemTags(this.itemId); this.tags = await this.fetchItemTags(this.id);
this.barcode = await this.getBarcodeBase64(this.itemId); this.barcode = await this.getBarcodeBase64(this.id);
if (!this.item) if (!this.item)
throw new Error('Something went wrong'); throw new Error('Something went wrong');
@ -31,16 +31,16 @@ module.exports = {
fetchItem(id, warehouseId) { fetchItem(id, warehouseId) {
return this.findOneFromDef('item', [id, warehouseId]); return this.findOneFromDef('item', [id, warehouseId]);
}, },
fetchItemTags(itemId) { fetchItemTags(id) {
return this.rawSqlFromDef('itemTags', [itemId]).then(rows => { return this.rawSqlFromDef('itemTags', [id]).then(rows => {
const tags = {}; const tags = {};
rows.forEach(row => tags[row.code] = row.value); rows.forEach(row => tags[row.code] = row.value);
return tags; return tags;
}); });
}, },
getBarcodeBase64(itemId) { getBarcodeBase64(id) {
return qrcode.toDataURL(itemId, {margin: 0}); return qrcode.toDataURL(id, {margin: 0});
}, },
packing() { packing() {
const stems = this.item.stems ? this.item.stems : 1; const stems = this.item.stems ? this.item.stems : 1;
@ -52,8 +52,9 @@ module.exports = {
'report-footer': reportFooter.build() 'report-footer': reportFooter.build()
}, },
props: { props: {
itemId: { id: {
required: true required: true,
description: 'The item id'
}, },
warehouseId: { warehouseId: {
required: true required: true

View File

@ -64,7 +64,8 @@ module.exports = {
props: { props: {
id: { id: {
type: [Number, String], type: [Number, String],
required: true required: true,
description: 'The client id'
}, },
companyId: { companyId: {
type: [Number, String], type: [Number, String],

View File

@ -1,8 +1,12 @@
const Stylesheet = require(`${appPath}/core/stylesheet`); const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([ module.exports = new Stylesheet([
`${appPath}/common/css/layout.css`, `${vnPrintPath}/common/css/spacing.css`,
`${appPath}/common/css/report.css`, `${vnPrintPath}/common/css/misc.css`,
`${appPath}/common/css/misc.css`, `${vnPrintPath}/common/css/layout.css`,
`${vnPrintPath}/common/css/report.css`,
`${__dirname}/style.css`]) `${__dirname}/style.css`])
.mergeStyles(); .mergeStyles();

View File

@ -1,22 +1,22 @@
const Component = require(`${appPath}/core/component`); const Component = require(`vn-print/core/component`);
const reportHeader = new Component('report-header'); const reportHeader = new Component('report-header');
const reportFooter = new Component('report-footer'); const reportFooter = new Component('report-footer');
module.exports = { module.exports = {
name: 'receipt', name: 'receipt',
async serverPrefetch() { async serverPrefetch() {
this.client = await this.fetchClient(this.receiptId); this.client = await this.fetchClient(this.id);
this.receipt = await this.fetchReceipt(this.receiptId); this.receipt = await this.fetchReceipt(this.id);
if (!this.receipt) if (!this.receipt)
throw new Error('Something went wrong'); throw new Error('Something went wrong');
}, },
methods: { methods: {
fetchClient(receiptId) { fetchClient(id) {
return this.findOneFromDef('client', [receiptId]); return this.findOneFromDef('client', [id]);
}, },
fetchReceipt(receiptId) { fetchReceipt(id) {
return this.findOneFromDef('receipt', [receiptId]); return this.findOneFromDef('receipt', [id]);
} }
}, },
components: { components: {
@ -24,9 +24,10 @@ module.exports = {
'report-footer': reportFooter.build() 'report-footer': reportFooter.build()
}, },
props: { props: {
receiptId: { id: {
type: [Number, String], type: [Number, String],
required: true required: true,
description: 'Receipt id'
} }
} }
}; };

View File

@ -41,7 +41,8 @@ const rptSepaCore = {
props: { props: {
id: { id: {
type: [Number, String], type: [Number, String],
required: true required: true,
description: 'The client id'
}, },
companyId: { companyId: {
type: [Number, String], type: [Number, String],

View File

@ -1,9 +1,12 @@
const Stylesheet = require(`${appPath}/core/stylesheet`); const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([ module.exports = new Stylesheet([
`${appPath}/common/css/spacing.css`, `${vnPrintPath}/common/css/spacing.css`,
`${appPath}/common/css/misc.css`, `${vnPrintPath}/common/css/misc.css`,
`${appPath}/common/css/layout.css`, `${vnPrintPath}/common/css/layout.css`,
`${appPath}/common/css/report.css`, `${vnPrintPath}/common/css/report.css`,
`${__dirname}/style.css`]) `${__dirname}/style.css`])
.mergeStyles(); .mergeStyles();

View File

@ -1,12 +1,12 @@
const Component = require(`${appPath}/core/component`); const Component = require(`vn-print/core/component`);
const reportHeader = new Component('report-header'); const reportHeader = new Component('report-header');
const reportFooter = new Component('report-footer'); const reportFooter = new Component('report-footer');
module.exports = { module.exports = {
name: 'supplier-campaign-metrics', name: 'supplier-campaign-metrics',
async serverPrefetch() { async serverPrefetch() {
this.supplier = await this.fetchSupplier(this.recipientId); this.supplier = await this.fetchSupplier(this.id);
let entries = await this.fetchEntries(this.recipientId, this.from, this.to); let entries = await this.fetchEntries(this.id, this.from, this.to);
const entriesId = []; const entriesId = [];
@ -48,9 +48,10 @@ module.exports = {
'report-footer': reportFooter.build() 'report-footer': reportFooter.build()
}, },
props: { props: {
recipientId: { id: {
type: [Number, String], type: [Number, String],
required: true required: true,
description: 'The supplier id'
}, },
from: { from: {
required: true required: true

View File

@ -1,8 +1,12 @@
const Stylesheet = require(`${appPath}/core/stylesheet`); const Stylesheet = require(`vn-print/core/stylesheet`);
const path = require('path');
const vnPrintPath = path.resolve('print');
module.exports = new Stylesheet([ module.exports = new Stylesheet([
`${appPath}/common/css/layout.css`, `${vnPrintPath}/common/css/spacing.css`,
`${appPath}/common/css/report.css`, `${vnPrintPath}/common/css/misc.css`,
`${appPath}/common/css/misc.css`, `${vnPrintPath}/common/css/layout.css`,
`${vnPrintPath}/common/css/report.css`,
`${__dirname}/style.css`]) `${__dirname}/style.css`])
.mergeStyles(); .mergeStyles();

View File

@ -1,20 +1,21 @@
module.exports = { module.exports = {
name: 'zone', name: 'zone',
async serverPrefetch() { async serverPrefetch() {
this.zone = await this.fetchZone(this.routeId); this.zone = await this.fetchZone(this.id);
if (!this.zone) if (!this.zone)
throw new Error('Something went wrong'); throw new Error('Something went wrong');
}, },
methods: { methods: {
fetchZone(routeId) { fetchZone(id) {
return this.findOneFromDef('zone', [routeId]); return this.findOneFromDef('zone', [id]);
} }
}, },
props: { props: {
routeId: { id: {
type: [Number, String], type: [Number, String],
required: true required: true,
description: 'The zone id'
} }
} }
}; };