2863 - Added monitor module #618

Merged
joan merged 12 commits from 2863-monitor_module into dev 2021-05-12 12:09:35 +00:00
3 changed files with 6 additions and 14 deletions
Showing only changes of commit e22da9b0d5 - Show all commits

View File

@ -96,5 +96,6 @@
"Swift / BIC cannot be empty": "Swift / BIC cannot be empty",
"Role name must be written in camelCase": "Role name must be written in camelCase",
"Client assignment has changed": "I did change the salesperson ~*\"<{{previousWorkerName}}>\"*~ by *\"<{{currentWorkerName}}>\"* from the client [{{clientName}} ({{clientId}})]({{{url}}})",
"None": "None"
"None": "None",
"error densidad = 0": "error densidad = 0"
}

View File

@ -83,12 +83,11 @@ module.exports = function(Self) {
throw new UserError('Invalid account');
await Self.rawSql(
`CALL vn.ledger_doCompensation(?, ?, ?, ?, ?, ?, ?)`,
`CALL vn.ledger_doCompensation(CURDATE(), ?, ?, ?, ?, ?, ?)`,
[
Date(),
args.compensationAccount,
args.bankFk,
accountingType.receiptDescription + args.compensationAccount,
accountingType.receiptDescription + clientOriginal.accountingAccount,
args.amountPaid,
args.companyFk,
clientOriginal.accountingAccount

View File

@ -20,12 +20,6 @@ module.exports = Self => {
});
Self.getSuggestedTickets = async id => {
const ticketsInRoute = await Self.app.models.Ticket.find({
where: {routeFk: id},
fields: ['id']
});
const idsToExclude = ticketsInRoute.map(ticket => ticket.id);
const route = await Self.app.models.Route.findById(id);
const zoneAgencyModes = await Self.app.models.ZoneAgencyMode.find({
@ -37,19 +31,17 @@ module.exports = Self => {
const zoneIds = [];
for (let zoneAgencyMode of zoneAgencyModes)
zoneIds.push(zoneAgencyMode.zoneFk);
const minDate = new Date(route.created);
minDate.setHours(0, 0, 0, 0);
const maxDate = new Date(route.created);
maxDate.setHours(23, 59, 59, 59);
let tickets = await Self.app.models.Ticket.find({
where: {
agencyModeFk: route.agencyModeFk,
zoneFk: {inq: zoneIds},
id: {nin: idsToExclude},
created: {between: [minDate, maxDate]}
routeFk: null,
shipped: {between: [minDate, maxDate]}
},
include: [
{