8093-devToTest_2442_3 #3100

Merged
alexm merged 284 commits from 8093-devToTest_2442_3 into test 2024-10-15 06:51:43 +00:00
1 changed files with 24 additions and 15 deletions
Showing only changes of commit 71362baa66 - Show all commits

View File

@ -221,24 +221,33 @@ module.exports = Self => {
JOIN vn.currency cu ON cu.id = e.currencyFk`
);
if (ctx.args.daysOnward) {
stmt.merge({
sql: `
AND t.shipped <= util.VN_CURDATE() + INTERVAL ? DAY
AND t.shipped >= util.VN_CURDATE()
`,
params: [ctx.args.daysOnward]
});
}
const {daysAgo, daysOnward} = ctx.args;
if (ctx.args.daysAgo) {
stmt.merge({
sql: `
if (daysAgo || daysOnward) {
let sql = '';
const params = [];
if (daysAgo && daysOnward) {
sql = `
AND t.shipped >= util.VN_CURDATE() - INTERVAL ? DAY
AND t.shipped <= util.VN_CURDATE() + INTERVAL ? DAY
`;
params.push(daysAgo, daysOnward);
} else if (daysAgo) {
sql = `
AND t.shipped >= util.VN_CURDATE() - INTERVAL ? DAY
AND t.shipped < util.VN_CURDATE()
`,
params: [ctx.args.daysAgo]
});
`;
params.push(daysAgo);
} else if (daysOnward) {
sql = `
AND t.shipped <= util.VN_CURDATE() + INTERVAL ? DAY
AND t.shipped >= util.VN_CURDATE()
`;
params.push(daysOnward);
}
stmt.merge({sql, params});
}
stmt.merge(conn.makeSuffix(filter));