feat: add new report vehicleExpired
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
fe71e485aa
commit
9f1c90387b
|
@ -0,0 +1,9 @@
|
|||
const Stylesheet = require(`${appPath}/core/stylesheet`);
|
||||
|
||||
module.exports = new Stylesheet([
|
||||
`${appPath}/common/css/spacing.css`,
|
||||
`${appPath}/common/css/misc.css`,
|
||||
`${appPath}/common/css/layout.css`,
|
||||
`${appPath}/common/css/report.css`,
|
||||
`${__dirname}/style.css`])
|
||||
.mergeStyles();
|
|
@ -0,0 +1,19 @@
|
|||
.column-oriented {
|
||||
margin-top: 50px !important;
|
||||
}
|
||||
|
||||
.bottom-line > tr {
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.bottom-line tr:nth-last-child() {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.report-info {
|
||||
font-size: 20px
|
||||
}
|
||||
|
||||
.description strong {
|
||||
text-transform: uppercase;
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE html>
|
||||
<html v-bind:lang="$i18n.locale">
|
||||
<body>
|
||||
<table class="grid">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<!-- Header block -->
|
||||
<report-header v-bind="$props"></report-header>
|
||||
<!-- Block -->
|
||||
<div class="grid-row">
|
||||
<div class="grid-block">
|
||||
<div class="columns">
|
||||
<div class="size50">
|
||||
<h1 class="title uppercase">{{$t('title')}}</h1>
|
||||
</div>
|
||||
</div>
|
||||
<table class="column-oriented">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{$t('Plate')}}</th>
|
||||
<th>{{$t('Concept')}}</th>
|
||||
<th>{{$t('expirationDate')}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody v-for="sale in sales">
|
||||
<tr>
|
||||
<td>{{sale.itemFk | zerofill('000000')}}</td>
|
||||
<td>{{Math.trunc(sale.subtotal)}}</td>
|
||||
<td>{{sale.concept}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Footer block -->
|
||||
<report-footer id="pageFooter"
|
||||
v-bind:left-text="$t('client', [client.id])"
|
||||
v-bind:center-text="client.socialName"
|
||||
v-bind="$props">
|
||||
</report-footer>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,38 @@
|
|||
const Component = require(`${appPath}/core/component`);
|
||||
const reportHeader = new Component('report-header');
|
||||
const reportFooter = new Component('report-footer');
|
||||
|
||||
module.exports = {
|
||||
name: 'campaign-metrics',
|
||||
async serverPrefetch() {
|
||||
this.client = await this.fetchClient(this.recipientId);
|
||||
this.sales = await this.fetchSales(this.recipientId, this.from, this.to);
|
||||
|
||||
if (!this.client)
|
||||
throw new Error('Something went wrong');
|
||||
},
|
||||
methods: {
|
||||
fetchClient(clientId) {
|
||||
return this.findOneFromDef('client', [clientId]);
|
||||
},
|
||||
fetchSales(clientId, from, to) {
|
||||
return this.rawSqlFromDef('sales', [clientId, from, to]);
|
||||
},
|
||||
},
|
||||
components: {
|
||||
'report-header': reportHeader.build(),
|
||||
'report-footer': reportFooter.build()
|
||||
},
|
||||
props: {
|
||||
recipientId: {
|
||||
type: [Number, String],
|
||||
required: true
|
||||
},
|
||||
from: {
|
||||
required: true
|
||||
},
|
||||
to: {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
};
|
|
@ -0,0 +1,12 @@
|
|||
reportName: consumo-cliente
|
||||
title: Expiración Tarjetas Vehículos
|
||||
Client: Cliente
|
||||
clientData: Datos del cliente
|
||||
dated: Fecha
|
||||
From: Desde
|
||||
To: Hasta
|
||||
client: Cliente {0}
|
||||
Stems: Tallos
|
||||
Plate: Matrícula
|
||||
Concept: Concepto
|
||||
expirationDate: Fecha caducidad
|
|
@ -0,0 +1,13 @@
|
|||
SELECT
|
||||
c.street,
|
||||
c.socialName,
|
||||
c.city,
|
||||
c.postcode,
|
||||
c.id,
|
||||
c.name AS clientName,
|
||||
p.name AS province,
|
||||
co.country
|
||||
FROM client c
|
||||
JOIN province p ON c.provinceFk = p.id
|
||||
JOIN country co ON c.countryFk = co.id
|
||||
WHERE c.id = ?
|
|
@ -0,0 +1,20 @@
|
|||
SELECT
|
||||
SUM(s.quantity) AS subtotal,
|
||||
s.itemFk,
|
||||
s.concept,
|
||||
i.subName,
|
||||
i.tag5,
|
||||
i.value5,
|
||||
i.tag6,
|
||||
i.value6,
|
||||
i.tag7,
|
||||
i.value7
|
||||
FROM sale s
|
||||
JOIN ticket t ON t.id = s.ticketFk
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
WHERE
|
||||
t.clientFk = ? AND it.isPackaging = FALSE
|
||||
AND DATE(t.shipped) BETWEEN ? AND ?
|
||||
GROUP BY s.itemFk
|
||||
ORDER BY i.typeFk , i.name
|
Loading…
Reference in New Issue