diff --git a/print/templates/reports/vehicle-event-expired/assets/css/import.js b/print/templates/reports/vehicle-event-expired/assets/css/import.js new file mode 100644 index 0000000000..fd8796c2bf --- /dev/null +++ b/print/templates/reports/vehicle-event-expired/assets/css/import.js @@ -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(); diff --git a/print/templates/reports/vehicle-event-expired/assets/css/style.css b/print/templates/reports/vehicle-event-expired/assets/css/style.css new file mode 100644 index 0000000000..1b6428d3ce --- /dev/null +++ b/print/templates/reports/vehicle-event-expired/assets/css/style.css @@ -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; +} \ No newline at end of file diff --git a/print/templates/reports/vehicle-event-expired/campaign-metrics.html b/print/templates/reports/vehicle-event-expired/campaign-metrics.html new file mode 100644 index 0000000000..60b8dd717b --- /dev/null +++ b/print/templates/reports/vehicle-event-expired/campaign-metrics.html @@ -0,0 +1,47 @@ + + + + + + + + + +
+ + + +
+
+
+
+

{{$t('title')}}

+
+
+ + + + + + + + + + + + + + + +
{{$t('Plate')}}{{$t('Concept')}}{{$t('expirationDate')}}
{{sale.itemFk | zerofill('000000')}}{{Math.trunc(sale.subtotal)}}{{sale.concept}}
+
+
+ + + +
+ + \ No newline at end of file diff --git a/print/templates/reports/vehicle-event-expired/campaign-metrics.js b/print/templates/reports/vehicle-event-expired/campaign-metrics.js new file mode 100755 index 0000000000..6669ce0679 --- /dev/null +++ b/print/templates/reports/vehicle-event-expired/campaign-metrics.js @@ -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 + } + } +}; diff --git a/print/templates/reports/vehicle-event-expired/locale/es.yml b/print/templates/reports/vehicle-event-expired/locale/es.yml new file mode 100644 index 0000000000..e73c8ef982 --- /dev/null +++ b/print/templates/reports/vehicle-event-expired/locale/es.yml @@ -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 \ No newline at end of file diff --git a/print/templates/reports/vehicle-event-expired/sql/client.sql b/print/templates/reports/vehicle-event-expired/sql/client.sql new file mode 100644 index 0000000000..9f392c97eb --- /dev/null +++ b/print/templates/reports/vehicle-event-expired/sql/client.sql @@ -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 = ? \ No newline at end of file diff --git a/print/templates/reports/vehicle-event-expired/sql/sales.sql b/print/templates/reports/vehicle-event-expired/sql/sales.sql new file mode 100644 index 0000000000..2daa72aaa6 --- /dev/null +++ b/print/templates/reports/vehicle-event-expired/sql/sales.sql @@ -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 \ No newline at end of file