feat: refs #8119 itemCampaignQuantity #3117
|
@ -12,13 +12,15 @@ proc: BEGIN
|
||||||
* @param vDateTo Fecha hasta
|
* @param vDateTo Fecha hasta
|
||||||
* @param vCampaign Código de la campaña
|
* @param vCampaign Código de la campaña
|
||||||
*/
|
*/
|
||||||
DECLARE vYesterday INT;
|
DECLARE vCurdate DATE;
|
||||||
|
DECLARE vYesterday DATE;
|
||||||
DECLARE vDefaultCampaign VARCHAR(100);
|
DECLARE vDefaultCampaign VARCHAR(100);
|
||||||
DECLARE vPreviousDaysToInsert INT;
|
DECLARE vPreviousDaysToInsert INT;
|
||||||
DECLARE vDateSumFrom DATE;
|
DECLARE vDateSumFrom DATE;
|
||||||
DECLARE vDateSumTo DATE;
|
DECLARE vDateSumTo DATE;
|
||||||
DECLARE vScopeDays DATE;
|
DECLARE vScopeDays DATE;
|
||||||
|
|
||||||
|
SET vCurdate = util.VN_CURDATE();
|
||||||
SET vYesterday = util.yesterday();
|
SET vYesterday = util.yesterday();
|
||||||
|
|
||||||
IF vDateFrom IS NULL THEN
|
IF vDateFrom IS NULL THEN
|
||||||
|
@ -47,7 +49,7 @@ proc: BEGIN
|
||||||
|
|
||||||
SELECT dated, scopeDays INTO vDateSumTo, vScopeDays
|
SELECT dated, scopeDays INTO vDateSumTo, vScopeDays
|
||||||
FROM campaign
|
FROM campaign
|
||||||
WHERE dated > util.VN_CURDATE()
|
WHERE dated > vCurdate
|
||||||
AND code = vCampaign
|
AND code = vCampaign
|
||||||
ORDER BY dated
|
ORDER BY dated
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
|
@ -56,7 +58,7 @@ proc: BEGIN
|
||||||
CALL util.throw('Missing data in campaign table');
|
CALL util.throw('Missing data in campaign table');
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
IF NOT util.VN_CURDATE() BETWEEN vDateSumTo - INTERVAL vPreviousDaysToInsert DAY
|
IF NOT vCurdate BETWEEN vDateSumTo - INTERVAL vPreviousDaysToInsert DAY
|
||||||
AND vDateSumTo THEN
|
AND vDateSumTo THEN
|
||||||
LEAVE proc;
|
LEAVE proc;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
Loading…
Reference in New Issue