This commit is contained in:
parent
9fcad457a7
commit
fe0afe30bf
|
@ -6,9 +6,11 @@
|
|||
SET @notificationFk =LAST_INSERT_ID();
|
||||
|
||||
INSERT IGNORE INTO util.notificationAcl (notificationFk, roleFk)
|
||||
SELECT @notificationFk, 108
|
||||
FROM util.notification;
|
||||
|
||||
SELECT @notificationFk,id
|
||||
FROM account.role
|
||||
WHERE name ='administrative';
|
||||
|
||||
INSERT IGNORE INTO util.notificationSubscription (notificationFk, userFk)
|
||||
SELECT @notificationFk, 108
|
||||
FROM util.notification;
|
||||
SELECT @notificationFk, id
|
||||
FROM account.`user`
|
||||
WHERE `name` = 'admon';
|
||||
|
|
|
@ -53,8 +53,8 @@ module.exports = Self => {
|
|||
JOIN province p ON p.id = c.provinceFk
|
||||
JOIN country co ON co.id = p.countryFk
|
||||
LEFT JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk
|
||||
WHERE (al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered'))
|
||||
AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) AND util.dayEnd(?)
|
||||
WHERE (al.code = 'PACKED' OR (am.code = 'refund' AND al.code <> 'delivered'))
|
||||
AND DATE(t.shipped) BETWEEN ? - INTERVAL 2 DAY AND util.dayEnd(?)
|
||||
AND t.refFk IS NULL
|
||||
GROUP BY t.id
|
||||
`, [toDate, toDate]);
|
||||
|
@ -66,20 +66,19 @@ module.exports = Self => {
|
|||
JSON_ARRAYAGG(
|
||||
JSON_OBJECT(
|
||||
'ticketId', ticketFk,
|
||||
'reason',
|
||||
LEFT(reason,LENGTH(reason) - 2)
|
||||
'reason', reason
|
||||
)
|
||||
)
|
||||
)errors
|
||||
FROM (
|
||||
SELECT ticketFk,
|
||||
CONCAT_WS('',
|
||||
IF(hasErrorToInvoice, 'Facturar, ', ''),
|
||||
IF(hasErrorTaxDataChecked, 'Datos comprobados, ', ''),
|
||||
IF(hasErrorDeleted, 'Eliminado, ', ''),
|
||||
IF(hasErrorItemTaxCountry, 'Impuesto no informado, ', ''),
|
||||
IF(hasErrorAddress, 'Sin dirección, ', ''),
|
||||
IF(hasErrorInfoTaxAreaWorld, 'Datos exportaciones, ', '')) reason
|
||||
CONCAT_WS(', ',
|
||||
IF(hasErrorToInvoice, 'Facturar', NULL),
|
||||
IF(hasErrorTaxDataChecked, 'Datos comprobados', NULL),
|
||||
IF(hasErrorDeleted, 'Eliminado', NULL),
|
||||
IF(hasErrorItemTaxCountry, 'Impuesto no informado', NULL),
|
||||
IF(hasErrorAddress, 'Sin dirección', NULL),
|
||||
IF(hasErrorInfoTaxAreaWorld, 'Datos exportaciones', NULL)) reason
|
||||
FROM (
|
||||
SELECT t.id ticketFk,
|
||||
SUM(NOT c.hasToInvoice) hasErrorToInvoice,
|
||||
|
@ -109,7 +108,7 @@ module.exports = Self => {
|
|||
LEFT JOIN vn.invoiceOutSerial ios ON ios.taxAreaFk = 'WORLD'
|
||||
AND ios.code = invoiceSerial(t.clientFk, t.companyFk, 'M')
|
||||
WHERE (al.code = 'PACKED' OR (am.code = 'refund' AND al.code <> 'delivered'))
|
||||
AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY) AND util.dayEnd(?)
|
||||
AND DATE(t.shipped) BETWEEN ? - INTERVAL 2 DAY AND util.dayEnd(?)
|
||||
AND t.refFk IS NULL
|
||||
AND IFNULL(a.hasDailyInvoice, co.hasDailyInvoice)
|
||||
GROUP BY ticketFk
|
||||
|
@ -136,8 +135,7 @@ module.exports = Self => {
|
|||
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
||||
JOIN zone z ON z.id = t.zoneFk
|
||||
SET t.routeFk = NULL
|
||||
WHERE DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY)
|
||||
AND util.dayEnd(?)
|
||||
WHERE DATE(t.shipped) BETWEEN ? - INTERVAL 2 DAY AND util.dayEnd(?)
|
||||
AND al.code NOT IN('DELIVERED','PACKED')
|
||||
AND t.routeFk
|
||||
AND z.name LIKE '%MADRID%'`, [toDate, toDate], {userId: ctx.req.accessToken.userId});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
subject: Nightly ticket closing process report
|
||||
title: Nightly ticket closing process report
|
||||
reason: Reason
|
||||
ticketId: Ticket No
|
||||
ticketId: Ticket
|
|
@ -1,4 +1,4 @@
|
|||
subject: Informe proceso de cierre de tickets nocturno
|
||||
title: Informe proceso de cierre de tickets nocturno
|
||||
reason: Motivo
|
||||
ticketId: Ticket nº
|
||||
ticketId: Ticket
|
Loading…
Reference in New Issue