diff --git a/loopback/locale/en.json b/loopback/locale/en.json index 1e0607813..6bdaddd9b 100644 --- a/loopback/locale/en.json +++ b/loopback/locale/en.json @@ -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" } \ No newline at end of file diff --git a/modules/client/back/methods/client/createReceipt.js b/modules/client/back/methods/client/createReceipt.js index 976ff7cf2..cb7d7aaba 100644 --- a/modules/client/back/methods/client/createReceipt.js +++ b/modules/client/back/methods/client/createReceipt.js @@ -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 diff --git a/modules/route/back/methods/route/getSuggestedTickets.js b/modules/route/back/methods/route/getSuggestedTickets.js index 12bde1684..c2afd60b4 100644 --- a/modules/route/back/methods/route/getSuggestedTickets.js +++ b/modules/route/back/methods/route/getSuggestedTickets.js @@ -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: [ {