#1284 Print - Informe zona
This commit is contained in:
parent
b6daab114c
commit
17f5e46497
|
@ -355,15 +355,15 @@ INSERT INTO `vn`.`creditInsurance`(`id`, `creditClassification`, `credit`, `crea
|
|||
(2, 2 , 6000, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), NULL),
|
||||
(3, 3, 10000 , DATE_ADD(CURDATE(), INTERVAL -3 MONTH), NULL);
|
||||
|
||||
INSERT INTO `vn`.`route`(`id`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`)
|
||||
INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`)
|
||||
VALUES
|
||||
(1, 56, CURDATE(), 1, 1, 'first route', null, 10, CURDATE(), CURDATE()),
|
||||
(2, 56, CURDATE(), 1, 1, 'second route', 4.2, 20, CURDATE(), CURDATE()),
|
||||
(3, 56, CURDATE(), 2, 7, 'third route', 5.3, 30, CURDATE(), CURDATE()),
|
||||
(4, 56, CURDATE(), 3, 7, 'fourth route', 6.4, 40, CURDATE(), CURDATE()),
|
||||
(5, 56, CURDATE(), 4, 8, 'fifth route', 7.5, 50, CURDATE(), CURDATE()),
|
||||
(6, 57, CURDATE(), 5, 8, 'sixth route', 8.6, 60, CURDATE(), CURDATE()),
|
||||
(7, 57, CURDATE(), 6, null, 'seventh route', 9.7, 70, CURDATE(), CURDATE());
|
||||
(1, '1899-12-30 12:15:00', 56, CURDATE(), 1, 1, 'first route', null, 10, CURDATE(), CURDATE()),
|
||||
(2, '1899-12-30 13:20:00', 56, CURDATE(), 1, 1, 'second route', 4.2, 20, CURDATE(), CURDATE()),
|
||||
(3, '1899-12-30 14:30:00', 56, CURDATE(), 2, 7, 'third route', 5.3, 30, CURDATE(), CURDATE()),
|
||||
(4, '1899-12-30 15:45:00', 56, CURDATE(), 3, 7, 'fourth route', 6.4, 40, CURDATE(), CURDATE()),
|
||||
(5, '1899-12-30 16:00:00', 56, CURDATE(), 4, 8, 'fifth route', 7.5, 50, CURDATE(), CURDATE()),
|
||||
(6, null, 57, CURDATE(), 5, 8, 'sixth route', 8.6, 60, CURDATE(), CURDATE()),
|
||||
(7, null, 57, CURDATE(), 6, null, 'seventh route', 9.7, 70, CURDATE(), CURDATE());
|
||||
|
||||
INSERT INTO `vn2008`.`empresa_grupo`(`empresa_grupo_id`, `grupo`)
|
||||
VALUES
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
{"type": "report", "name": "rpt-letter-debtor"},
|
||||
{"type": "report", "name": "rpt-sepa-core"},
|
||||
{"type": "report", "name": "rpt-receipt"},
|
||||
{"type": "report", "name": "rpt-route"},
|
||||
{"type": "static", "name": "email-header"},
|
||||
{"type": "static", "name": "email-footer"},
|
||||
{"type": "static", "name": "report-header"},
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
const CssReader = require(`${appPath}/lib/cssReader`);
|
||||
|
||||
module.exports = new CssReader([
|
||||
`${appPath}/common/css/layout.css`,
|
||||
`${appPath}/common/css/report.css`,
|
||||
`${__dirname}/style.css`])
|
||||
.mergeStyles();
|
|
@ -0,0 +1,9 @@
|
|||
section .text {
|
||||
font-family: Tahoma;
|
||||
font-weight: bold;
|
||||
color: white;
|
||||
font-size: 7.5em;
|
||||
text-align: center;
|
||||
background-color: black;
|
||||
margin-bottom: 0.2em
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<body>
|
||||
<section class="container" id="report">
|
||||
<section class="main">
|
||||
<!-- Report start -->
|
||||
<section class="text">{{route.agencyName}}</section>
|
||||
<section class="text">{{route.id}}</section>
|
||||
<section class="text">{{route.plateNumber}} {{routeTime(route.time)}}</section>
|
||||
<section></section>
|
||||
<!-- Report end -->
|
||||
</section>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,36 @@
|
|||
const strftime = require('strftime');
|
||||
const database = require(`${appPath}/lib/database`);
|
||||
const UserException = require(`${appPath}/lib/exceptions/userException`);
|
||||
|
||||
module.exports = {
|
||||
name: 'rpt-route',
|
||||
async asyncData(ctx, params) {
|
||||
if (!params.routeFk)
|
||||
throw new UserException('No route id specified');
|
||||
|
||||
let [[route]] = await this.methods.fetchRoute(params.routeFk);
|
||||
|
||||
if (!route)
|
||||
throw new UserException('Route not ready');
|
||||
|
||||
return {route};
|
||||
},
|
||||
methods: {
|
||||
fetchRoute(routeFk) {
|
||||
return database.pool.query(
|
||||
`SELECT
|
||||
r.id,
|
||||
r.time,
|
||||
am.name agencyName,
|
||||
v.numberPlate plateNumber
|
||||
FROM route r
|
||||
JOIN agencyMode am ON am.id = r.agencyModeFk
|
||||
JOIN vehicle v ON v.id = r.vehicleFk
|
||||
WHERE r.id = ?`, [routeFk]);
|
||||
},
|
||||
routeTime: routeTime => {
|
||||
if (routeTime)
|
||||
return strftime('%H:%M', routeTime);
|
||||
},
|
||||
},
|
||||
};
|
Loading…
Reference in New Issue