Merge pull request 'now sorts correctly by practical and theorical hour' (#748) from 3219-salesMonitor_sort into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #748
Reviewed-by: Carlos Jimenez Ruiz <carlosjr@verdnatura.es>
This commit is contained in:
Carlos Jimenez Ruiz 2021-10-13 12:50:02 +00:00
commit b09e3ad72b
3 changed files with 15 additions and 9 deletions

View File

@ -196,7 +196,6 @@ module.exports = Self => {
t.id, t.id,
t.shipped, t.shipped,
CAST(DATE(t.shipped) AS CHAR) AS shippedDate, CAST(DATE(t.shipped) AS CHAR) AS shippedDate,
HOUR(t.shipped) AS shippedHour,
t.nickname, t.nickname,
t.refFk, t.refFk,
t.routeFk, t.routeFk,
@ -218,11 +217,10 @@ module.exports = Self => {
u.name AS userName, u.name AS userName,
c.salesPersonFk, c.salesPersonFk,
z.hour AS zoneLanding, z.hour AS zoneLanding,
HOUR(z.hour) AS zoneHour,
MINUTE(z.hour) AS zoneMinute,
z.name AS zoneName, z.name AS zoneName,
z.id AS zoneFk, z.id AS zoneFk,
CAST(z.hour AS CHAR) AS hour, th.preparationHour,
TIME_FORMAT(z.hour, '%H:%i') AS theoreticalhour,
TIME_FORMAT(zed.etc, '%H:%i') AS practicalHour TIME_FORMAT(zed.etc, '%H:%i') AS practicalHour
FROM ticket t FROM ticket t
LEFT JOIN invoiceOut io ON t.refFk = io.ref LEFT JOIN invoiceOut io ON t.refFk = io.ref
@ -236,7 +234,11 @@ module.exports = Self => {
LEFT JOIN client c ON c.id = t.clientFk LEFT JOIN client c ON c.id = t.clientFk
LEFT JOIN worker wk ON wk.id = c.salesPersonFk LEFT JOIN worker wk ON wk.id = c.salesPersonFk
LEFT JOIN account.user u ON u.id = wk.userFk LEFT JOIN account.user u ON u.id = wk.userFk
LEFT JOIN zoneEstimatedDelivery zed ON zed.zoneFk = t.zoneFk`); LEFT JOIN zoneEstimatedDelivery zed ON zed.zoneFk = t.zoneFk
JOIN (
SELECT t.id, TIME_FORMAT(t.shipped, '%H:%i') AS preparationHour
FROM ticket AS t
) AS th ON th.id = t.id`);
if (args.orderFk) { if (args.orderFk) {
stmt.merge({ stmt.merge({

View File

@ -3,7 +3,7 @@
params="::$ctrl.filterParams" params="::$ctrl.filterParams"
url="SalesMonitors/salesFilter" url="SalesMonitors/salesFilter"
limit="20" limit="20"
order="shippedDate DESC, shippedHour ASC, zoneLanding ASC, id"> order="shippedDate DESC, preparationHour ASC, zoneLanding ASC, id">
</vn-crud-model> </vn-crud-model>
<vn-portal slot="topbar"> <vn-portal slot="topbar">
<vn-searchbar <vn-searchbar
@ -37,8 +37,8 @@
<vn-th field="nickname">Client</vn-th> <vn-th field="nickname">Client</vn-th>
<vn-th field="salesPersonFk" class="expendable" shrink>Salesperson</vn-th> <vn-th field="salesPersonFk" class="expendable" shrink>Salesperson</vn-th>
<vn-th field="shipped" shrink-date>Date</vn-th> <vn-th field="shipped" shrink-date>Date</vn-th>
<vn-th>Prep.</vn-th> <vn-th field="preparationHour">Prep.</vn-th>
<vn-th field="hour" shrink>Theoretical</vn-th> <vn-th field="theoreticalHour">Theoretical</vn-th>
<vn-th field="practicalHour">Practical</vn-th> <vn-th field="practicalHour">Practical</vn-th>
<vn-th field="provinceFk" class="expendable">Province</vn-th> <vn-th field="provinceFk" class="expendable">Province</vn-th>
<vn-th field="stateFk">State</vn-th> <vn-th field="stateFk">State</vn-th>

View File

@ -68,8 +68,12 @@ export default class Controller extends Section {
return {'c.salesPersonFk': value}; return {'c.salesPersonFk': value};
case 'provinceFk': case 'provinceFk':
return {'a.provinceFk': value}; return {'a.provinceFk': value};
case 'hour': case 'theoreticalHour':
return {'z.hour': value}; return {'z.hour': value};
case 'practicalHour':
return {'zed.etc': value};
case 'preparationHour':
return {'th.preparationHour': value};
case 'shipped': case 'shipped':
return {'t.shipped': { return {'t.shipped': {
between: this.dateRange(value)} between: this.dateRange(value)}