#6243 generalize cmr section #2406

Merged
jorgep merged 10 commits from 6243-generalizeCmrSection into dev 2024-06-11 07:41:21 +00:00
1 changed files with 9 additions and 3 deletions
Showing only changes of commit a13581ed97 - Show all commits

View File

@ -47,6 +47,10 @@ module.exports = Self => {
type: 'date',
description: 'The to date filter',
},
{
arg: 'warehouseFk',
type: 'integer',
}
],
returns: {
type: ['object'],
@ -58,9 +62,10 @@ module.exports = Self => {
}
});
Self.cmrs = async(filter, cmrFk, ticketFk, routeFk, country, clientFk, hasCmrDms, shipped, options
Self.cmrs = async(
filter, cmrFk, ticketFk, routeFk, country, clientFk, hasCmrDms, shipped, warehouseFk, options
) => {
const params = {cmrFk, ticketFk, routeFk, country, clientFk, hasCmrDms, shipped};
const params = {cmrFk, ticketFk, routeFk, country, clientFk, hasCmrDms, warehouseFk, shipped};
const conn = Self.dataSource.connector;
let where = buildFilter(params, (param, value) => {
@ -89,7 +94,8 @@ module.exports = Self => {
co.name country,
t.clientFk,
IF(sub.id, TRUE, FALSE) hasCmrDms,
DATE(t.shipped) shipped
DATE(t.shipped) shipped,
t.warehouseFk
FROM ticket t
JOIN ticketState ts ON ts.ticketFk = t.id
JOIN state s ON s.id = ts.stateFk