credit request

This commit is contained in:
Joan Sanchez 2022-09-22 09:42:04 +02:00
parent 68f3544477
commit 92a476bd05
8 changed files with 50 additions and 38 deletions

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');
const attachment = new Component('attachment'); const attachment = new Component('attachment');
@ -15,7 +15,7 @@ module.exports = {
return {attachments}; return {attachments};
}, },
props: { props: {
recipientId: { id: {
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');
const attachment = new Component('attachment'); const attachment = new Component('attachment');

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: 'client-debt-statement', name: 'client-debt-statement',
async serverPrefetch() { async serverPrefetch() {
this.client = await this.fetchClient(this.recipientId); this.client = await this.fetchClient(this.id);
this.sales = await this.fetchSales(this.recipientId, this.from); this.sales = await this.fetchSales(this.id, this.from);
if (!this.client) if (!this.client)
throw new Error('Something went wrong'); throw new Error('Something went wrong');
@ -22,21 +22,21 @@ module.exports = {
return {totalBalance: 0.00}; return {totalBalance: 0.00};
}, },
methods: { methods: {
fetchClient(clientId) { fetchClient(id) {
return this.findOneFromDef('client', [clientId]); return this.findOneFromDef('client', [id]);
}, },
fetchSales(clientId, from) { fetchSales(id, from) {
return this.rawSqlFromDef('sales', [ return this.rawSqlFromDef('sales', [
from, from,
clientId, id,
from, from,
clientId, id,
from, from,
clientId, id,
from, from,
clientId, id,
from, from,
clientId id
]); ]);
}, },
getBalance(sale) { getBalance(sale) {
@ -68,7 +68,7 @@ module.exports = {
'report-footer': reportFooter.build() 'report-footer': reportFooter.build()
}, },
props: { props: {
recipientId: { id: {
type: [Number, String], type: [Number, String],
required: true required: true
}, },

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');