From d6d72ed289e44e4d44349d6d5351e9c3d9adfbe8 Mon Sep 17 00:00:00 2001 From: carlossa Date: Wed, 24 May 2023 12:35:07 +0200 Subject: [PATCH] refs #5635 smart-table, counter, filter --- CHANGELOG.md | 2 +- .../ticket/back/methods/expedition/filter.js | 62 +++++---- modules/ticket/front/expedition/index.html | 120 ++++++++++-------- modules/ticket/front/expedition/index.js | 24 ++++ 4 files changed, 123 insertions(+), 85 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b8d3a97c9..913b9c487 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - (Trabajadores -> Nuevo trabajador) Los clientes se crean sin 'TR' pero se añade tipo de negocio 'Trabajador' - +- (Tickets -> Expediciones) Interfaz mejorada y contador añadido ### Fixed - (Tickets -> Líneas) Se permite hacer split de líneas al mismo ticket diff --git a/modules/ticket/back/methods/expedition/filter.js b/modules/ticket/back/methods/expedition/filter.js index fcf0bd1b3..43be14349 100644 --- a/modules/ticket/back/methods/expedition/filter.js +++ b/modules/ticket/back/methods/expedition/filter.js @@ -24,40 +24,46 @@ module.exports = Self => { Self.filter = async(filter, options) => { const myOptions = {}; + const conn = Self.dataSource.connector; if (typeof options == 'object') Object.assign(myOptions, options); const stmt = new ParameterizedSQL( - `SELECT - e.id, - e.ticketFk, - e.freightItemFk, - e.workerFk, - i1.name packageItemName, - e.counter, - i2.name freightItemName, - u.name userName, - e.created, - e.externalId, - i3.name packagingName, - i3.id packagingItemFk, - e.packagingFk, - es.workerFk expeditionScanWorkerFk, - su.name scannerUserName, - es.scanned, - est.description state - FROM vn.expedition e - LEFT JOIN vn.expeditionStateType est ON est.id = e.stateTypeFk - INNER JOIN vn.item i1 ON i1.id = e.freightItemFk - LEFT JOIN vn.packaging p ON p.id = e.packagingFk - LEFT JOIN vn.item i3 ON i3.id = p.itemFk - LEFT JOIN vn.item i2 ON i2.id = p.itemFk - LEFT JOIN account.user u ON u.id = e.workerFk - LEFT JOIN vn.expeditionScan es ON es.expeditionFk = e.id - LEFT JOIN account.user su ON su.id = es.workerFk + `SELECT * + FROM ( + SELECT + e.id, + e.ticketFk, + e.freightItemFk, + e.workerFk, + i1.name packageItemName, + e.counter, + i2.name freightItemName, + u.name userName, + e.created, + e.externalId, + i3.name packagingName, + i3.id packagingItemFk, + e.packagingFk, + es.workerFk expeditionScanWorkerFk, + su.name scannerUserName, + es.scanned, + est.description state + FROM vn.expedition e + LEFT JOIN vn.expeditionStateType est ON est.id = e.stateTypeFk + INNER JOIN vn.item i1 ON i1.id = e.freightItemFk + LEFT JOIN vn.packaging p ON p.id = e.packagingFk + LEFT JOIN vn.item i3 ON i3.id = p.itemFk + LEFT JOIN vn.item i2 ON i2.id = p.itemFk + LEFT JOIN account.user u ON u.id = e.workerFk + LEFT JOIN vn.expeditionScan es ON es.expeditionFk = e.id + LEFT JOIN account.user su ON su.id = es.workerFk + ) e `); - stmt.merge(Self.buildSuffix(filter, 'e')); + stmt.merge(conn.makeWhere(filter.where)); + stmt.merge(conn.makeOrderBy(filter.order)); + stmt.merge(conn.makeLimit(filter)); return Self.rawStmt(stmt, myOptions); }; diff --git a/modules/ticket/front/expedition/index.html b/modules/ticket/front/expedition/index.html index 7186154f7..831b8ef7e 100644 --- a/modules/ticket/front/expedition/index.html +++ b/modules/ticket/front/expedition/index.html @@ -7,10 +7,12 @@ order="created DESC" auto-load="true"> - - - - + + + - - -

Subtotal {{$ctrl.ticket.totalWithoutVat | currency: 'EUR':2}}

-

VAT {{$ctrl.ticket.totalWithVat - $ctrl.ticket.totalWithoutVat | currency: 'EUR':2}}

-

Total {{$ctrl.ticket.totalWithVat | currency: 'EUR':2}}

-
-
- + @@ -42,51 +34,67 @@ model="model"> - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + +
ExpeditionItemNamePackage typeCounterexternalIdCreatedState + Expedition + + Item + + Name + + Package Type + + Counter + + externalId + + Created + + State +
+ + + {{expedition.id}} + + {{expedition.packagingItemFk}} + + {{::expedition.packageItemName}}{{::expedition.freightItemName}}{{::expedition.counter}}{{::expedition.externalId}}{{::expedition.created | date:'dd/MM/yyyy HH:mm'}}{{::expedition.state}} + + +
- - - - - - - {{expedition.id}} - - - {{expedition.packagingFk}} - - - {{::expedition.packageItemName}} - {{::expedition.freightItemName}} - {{::expedition.counter}} - {{::expedition.externalId}} - {{::expedition.created | date:'dd/MM/yyyy HH:mm'}} - {{::expedition.state}} - - - - - - - -
-
+ +