refs #6925 fix(invoice): incoterms error
This commit is contained in:
parent
e971070f2f
commit
b1a8fcf968
|
@ -15,10 +15,11 @@ BEGIN
|
||||||
JOIN agencyMode am ON am.id = t.agencyModeFk
|
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||||
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
||||||
JOIN alertLevel al ON al.id = ts.alertLevel
|
JOIN alertLevel al ON al.id = ts.alertLevel
|
||||||
WHERE al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered')
|
WHERE (al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered'))
|
||||||
AND t.id = vTicketFk
|
AND t.id = vTicketFk
|
||||||
AND t.refFk IS NULL
|
AND t.refFk IS NULL
|
||||||
GROUP BY t.id);
|
GROUP BY t.id
|
||||||
|
);
|
||||||
|
|
||||||
CALL ticket_close();
|
CALL ticket_close();
|
||||||
|
|
||||||
|
|
|
@ -344,5 +344,6 @@
|
||||||
"CountryFK cannot be empty": "El país no puede estar vacío",
|
"CountryFK cannot be empty": "El país no puede estar vacío",
|
||||||
"Cmr file does not exist": "El archivo del cmr no existe",
|
"Cmr file does not exist": "El archivo del cmr no existe",
|
||||||
"You are not allowed to modify the alias": "No estás autorizado a modificar el alias",
|
"You are not allowed to modify the alias": "No estás autorizado a modificar el alias",
|
||||||
"No tickets to invoice": "No hay tickets para facturar"
|
"No tickets to invoice": "No hay tickets para facturar",
|
||||||
|
"The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
module.exports = () => {
|
module.exports = () => {
|
||||||
Date.vnUTC = (env = process.env.NODE_ENV) => {
|
Date.vnUTC = (env = process.env.NODE_ENV) => {
|
||||||
if (!env || env === 'development')
|
// if (!env || env === 'development')
|
||||||
return new Date(Date.UTC(2001, 0, 1, 11));
|
// return new Date(Date.UTC(2001, 0, 1, 11));
|
||||||
|
|
||||||
return new Date();
|
return new Date();
|
||||||
};
|
};
|
||||||
|
|
|
@ -30,7 +30,7 @@ module.exports = Self => {
|
||||||
// Prevent closure for current day
|
// Prevent closure for current day
|
||||||
if (toDate >= todayMinDate && toDate <= todayMaxDate)
|
if (toDate >= todayMinDate && toDate <= todayMaxDate)
|
||||||
throw new UserError('You cannot close tickets for today');
|
throw new UserError('You cannot close tickets for today');
|
||||||
|
console.log(toDate, toDate);
|
||||||
const tickets = await Self.rawSql(`
|
const tickets = await Self.rawSql(`
|
||||||
SELECT t.id,
|
SELECT t.id,
|
||||||
t.clientFk,
|
t.clientFk,
|
||||||
|
@ -57,6 +57,7 @@ module.exports = Self => {
|
||||||
AND t.refFk IS NULL
|
AND t.refFk IS NULL
|
||||||
GROUP BY t.id
|
GROUP BY t.id
|
||||||
`, [toDate, toDate]);
|
`, [toDate, toDate]);
|
||||||
|
console.log('tickets: ', tickets);
|
||||||
|
|
||||||
await closure(ctx, Self, tickets);
|
await closure(ctx, Self, tickets);
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ module.exports = async function(ctx, Self, tickets, reqArgs = {}) {
|
||||||
JOIN company cny ON cny.id = io.companyFk
|
JOIN company cny ON cny.id = io.companyFk
|
||||||
WHERE t.id = ?
|
WHERE t.id = ?
|
||||||
`, [ticket.id]);
|
`, [ticket.id]);
|
||||||
|
console.log('invoiceOut: ', invoiceOut);
|
||||||
|
|
||||||
const mailOptions = {
|
const mailOptions = {
|
||||||
overrideAttachments: true,
|
overrideAttachments: true,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const vnReport = require('../../../core/mixins/vn-report.js');
|
const vnReport = require('../../../core/mixins/vn-report.js');
|
||||||
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'invoice-incoterms',
|
name: 'invoice-incoterms',
|
||||||
|
@ -7,7 +8,9 @@ module.exports = {
|
||||||
this.invoice = await this.findOneFromDef('invoice', [this.reference]);
|
this.invoice = await this.findOneFromDef('invoice', [this.reference]);
|
||||||
this.checkMainEntity(this.invoice);
|
this.checkMainEntity(this.invoice);
|
||||||
this.client = await this.findOneFromDef('client', [this.reference]);
|
this.client = await this.findOneFromDef('client', [this.reference]);
|
||||||
this.incoterms = await this.findOneFromDef('incoterms', [this.reference, this.reference, this.reference, this.reference]);
|
this.incoterms =
|
||||||
|
await this.findOneFromDef('incoterms', [this.reference, this.reference, this.reference, this.reference]);
|
||||||
|
if (!this.incoterms) throw new UserError(`The client should be informed of the incoterms`);
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
reference: {
|
reference: {
|
||||||
|
|
Loading…
Reference in New Issue