added delivery-note report

This commit is contained in:
Joan Sanchez 2019-02-07 07:47:09 +01:00
parent b7f8a642be
commit ee7fa03d62
15 changed files with 146 additions and 61 deletions

View File

@ -2,6 +2,10 @@
text-transform: uppercase
}
.justified {
text-align: justify
}
.centered {
text-align: center
}

View File

@ -106,6 +106,9 @@ module.exports = {
const options = {
format: 'A4',
border: '1.5cm',
header: {
height: '80px',
},
footer: {
height: '60px',
}

View File

@ -16,8 +16,8 @@ module.exports = app => {
app.get(`/api/report/${name}`, (request, response, next) => {
reportEngine.toPdf(name, request).then(stream => {
// response.setHeader('Content-Disposition', `attachment; filename="${name}.pdf"`);
// response.setHeader('Content-type', 'application/pdf');
response.setHeader('Content-Disposition', `attachment; filename="${name}.pdf"`);
response.setHeader('Content-type', 'application/pdf');
stream.pipe(response);
}).catch(e => {
next(e);

View File

@ -1,13 +1,14 @@
header {
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
border-bottom: 1px solid #DDD;
padding-bottom: 10px;
margin-bottom: 40px;
text-align: center;
font-size: 0.65em;
color: #555
font-size: 0.60em;
color: #555;
zoom: 0.65
}
header img {
margin-bottom: 10px;
width: 350px
}
}

View File

@ -3,7 +3,9 @@
<body>
<section class="container">
<!-- Header component -->
<report-header :locale="locale"></report-header>
<report-header id="pageHeader-first"
:locale="locale">
</report-header>
<!-- End header component -->
<section class="main">
<section class="columns">

View File

@ -3,7 +3,9 @@
<body>
<section class="container" id="report">
<!-- Header component -->
<report-header :locale="locale"></report-header>
<report-header id="pageHeader-first"
:locale="locale">
</report-header>
<!-- End header component -->
<section class="main">
<section class="columns">
@ -50,19 +52,24 @@
<table class="column-oriented">
<thead>
<tr>
<th>{{$t('date')}}</th>
<th>{{$t('reference')}}</th>
<th>{{$t('quantity')}}</th>
<th>{{$t('concept')}}</th>
<th class="number">{{$t('invoiced')}}</th>
<th class="number">{{$t('payed')}}</th>
<th class="number">{{$t('balance')}}</th>
<th class="number">{{$t('size')}}</th>
<th>{{$t('cat')}}</th>
<th>{{$t('col')}}</th>
<th>{{$t('VAT')}}</th>
<th>{{$t('price')}}</th>
<th>{{$t('%')}}</th>
<th>{{$t('amount')}}</th>
</tr>
</thead>
<tbody>
<tr v-for="sale in sales" :key="sale.id">
<td>{{toISOString(sale.issued)}}</td>
<td>{{sale.ref}}</td>
<td class="number">{{sale.debtOut}}</td>
<td class="number">{{sale.debtIn}}</td>
<td>{{sale.ref</td>
<td>{{sale}}</td>
<td class="number">{{sale}}</td>
<td class="number">{{sale}}</td>
<td class="number">{{a}}</td>
</tr>
</tbody>

View File

@ -12,16 +12,16 @@ module.exports = {
throw new UserException('No ticket id specified');
promises.push(this.methods.fetchClient(params.ticketFk));
// promises.push(this.methods.fetchSales(params.ticketFk));
promises.push(this.methods.fetchSales(params.ticketFk));
return Promise.all(promises).then(result => {
const [[client]] = result[0];
// const [[sales]] = result[1];
const [sales] = result[1];
if (!client)
throw new UserException('No client data found');
Object.assign(data, client);
Object.assign(data, client, {sales});
return data;
});
@ -64,16 +64,60 @@ module.exports = {
LEFT JOIN dms d ON d.id = dt.dmsFk
WHERE t.id = ?`, [ticketFk]);
},
fetchSales(clientFk, companyFk) {
fetchSales(ticketFk) {
return database.pool.query(
`CALL vn.clientGetDebtDiary(?, ?)`, [clientFk, companyFk]);
`SELECT
s.id,
s.itemFk,
s.concept,
s.quantity,
s.price,
s.price - SUM(IF(ctr.id = 6,
sc.value,
0)) netPrice,
s.discount,
i.size,
i.stems,
ic.type taxType,
i.category,
it.id itemTypeId,
o.code AS origin,
i.inkFk,
s.ticketFk,
ita.tag1,
ita.val1,
ita.tag2,
ita.val2,
ita.tag3,
ita.val3
FROM sale s
LEFT JOIN saleComponent sc ON sc.saleFk = s.id
LEFT JOIN componentRate cr ON cr.id = sc.componentFk
LEFT JOIN componentTypeRate ctr ON ctr.id = cr.componentTypeRate
LEFT JOIN item i ON i.id = s.itemFk
LEFT JOIN ticket t ON t.id = s.ticketFk
LEFT JOIN origin o ON o.id = i.originFk
INNER JOIN supplier sp ON sp.id = t.companyFk
INNER JOIN itemType it ON it.id = i.typeFk
LEFT JOIN
(SELECT *
FROM
(SELECT tt.countryFk, tcc.taxClassFk, tc.type
FROM taxClassCode tcc
JOIN taxCode tc ON tc.id = tcc.taxCodeFk
JOIN taxType tt ON tt.id = tc.taxTypeFk
WHERE tcc.effectived <= '2019-01-29 13:00:00'
ORDER BY tcc.effectived DESC) tx
GROUP BY tx.countryFk, tx.taxClassFk) ic ON ic.countryFk = sp.countryFk
AND ic.taxClassFk = i.taxClassFk
JOIN vn.itemTagArranged ita ON ita.itemFk = s.itemFk
WHERE s.ticketFk = ?
GROUP BY s.id
ORDER BY (it.isPackaging), s.concept, s.itemFk`, [ticketFk]);
},
dated: () => {
return strftime('%d-%m-%Y', new Date());
},
toISOString: date => {
return strftime('%d-%m-%Y', date);
},
},
components: {
'report-header': require('../report-header'),

View File

@ -1,3 +1,25 @@
table.column-oriented {
margin-top: 50px !important
p {
font-size: 1.2em;
margin: 0
}
.main {
position: relative;
height: 100%
}
.content {
position: absolute;
margin-top: -200px;
height: 400px;
top: 50%
}
.signature {
text-align: center;
margin-top: 150px
}
.signature img {
width: 400px
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

View File

@ -3,28 +3,24 @@
<body>
<section class="container" id="report">
<!-- Header component -->
<report-header :locale="locale"></report-header>
<report-header id="pageHeader-first"
:locale="locale">
</report-header>
<!-- End header component -->
<section class="main">
<!-- Report start -->
<h1 class="title">{{$t('title')}}</h1>
<p>{{$t('date')}} {{dated()}}</p>
<table class="column-oriented">
<thead>
<tr>
<th>Id</th>
<th>{{$t('concept')}}</th>
<th>{{$t('quantity')}}</th>
</tr>
</thead>
<tbody>
<tr v-for="sale in sales" :key="sale.id">
<td class="font gray">{{sale.id}}</td>
<td>{{sale.concept}}</td>
<td>{{sale.quantity}}</td>
</tr>
</tbody>
</table>
<section class="content">
<h1 class="title centered uppercase">{{$t('title')}}</h1>
<p class="centered">
Recibo de <strong class="uppercase">LEON LLORENS LUIS ENRIQUE</strong>,
la cantidad de <strong>259,96 €</strong> en concepto de 'entrega a cuenta', quedando pendiente en la cuenta del cliente
un saldo de <strong>0,00 €</strong>.
</p>
<section class="signature">
<img :src="embeded['/assets/images/signature.png']">
<p class="centered">{{$t('dated', ['Silla', '20', 'enero', '2019'])}}</p>
</section>
</section>
<!-- Report end -->
</section>
<!-- Footer component -->

View File

@ -5,25 +5,26 @@ module.exports = {
created() {
if (this.locale)
this.$i18n.locale = this.locale;
const embeded = [];
this.files.map(file => {
embeded[file] = `file://${__dirname + file}`;
});
this.embeded = embeded;
},
data() {
return {
client: {
id: 10252,
name: 'Batman',
id: 101,
name: 'Batman'
},
sales: [
{id: 1, concept: 'My item 1', quantity: 25},
{id: 2, concept: 'My item 2', quantity: 50},
{id: 3, concept: 'My item 3', quantity: 150}
],
locale: 'es'
files: ['/assets/images/signature.png'],
};
},
methods: {
dated: () => {
/* dated: () => {
return strftime('%d-%m-%Y', new Date());
},
}, */
},
components: {
'report-header': require('../report-header'),

View File

@ -1,10 +1,9 @@
module.exports = {
messages: {
es: {
title: 'Sample report',
title: 'Recibo',
date: 'Fecha',
quantity: 'Cantidad',
concept: 'Concepto',
dated: 'En {0}, a {1} de {2} de {3}',
client: 'Cliente {0}',
},
},

View File

@ -3,7 +3,9 @@
<body>
<section class="container">
<!-- Header component -->
<report-header :locale="locale"></report-header>
<report-header id="pageHeader-first"
:locale="locale">
</report-header>
<!-- End header component -->
<section class="main">
<section class="columns">

View File

@ -3,7 +3,9 @@
<body>
<section class="container">
<!-- Header component -->
<report-header :locale="locale"></report-header>
<report-header id="pageHeader-first"
:locale="locale">
</report-header>
<!-- End header component -->
<section class="main">
<h1 class="title centered">{{$t('title')}}</h1>

View File

@ -3,7 +3,9 @@
<body>
<section class="container" id="report">
<!-- Header component -->
<report-header :locale="locale"></report-header>
<report-header id="pageHeader-first"
:locale="locale">
</report-header>
<!-- End header component -->
<section class="main">
<!-- Report start -->