From a8f8248c41618c914873b3ad4e4215437b08b9a1 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 13 Oct 2021 12:33:48 +0200 Subject: [PATCH 1/5] feat(diary): Add column claim --- modules/item/front/diary/index.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/item/front/diary/index.html b/modules/item/front/diary/index.html index 9a983a0eb..9f3937d03 100644 --- a/modules/item/front/diary/index.html +++ b/modules/item/front/diary/index.html @@ -29,6 +29,7 @@ + Date Id State @@ -48,6 +49,14 @@ vn-repeat-last on-last="$ctrl.scrollToLine(sale.lastPreparedLineFk)" ng-attr-id="vnItemDiary-{{::sale.lineFk}}"> + + + + + + From 1684c1bf87dc6a1ea1ed6d87fe23211639751311 Mon Sep 17 00:00:00 2001 From: alexm Date: Wed, 13 Oct 2021 14:03:06 +0200 Subject: [PATCH 2/5] feat(diary): modify sql item_getBalance --- .../10370-pickles/00-item_getBalance.sql | 144 ++++++++++++++++++ modules/item/front/diary/index.html | 6 +- 2 files changed, 147 insertions(+), 3 deletions(-) create mode 100644 db/changes/10370-pickles/00-item_getBalance.sql diff --git a/db/changes/10370-pickles/00-item_getBalance.sql b/db/changes/10370-pickles/00-item_getBalance.sql new file mode 100644 index 000000000..91e5c3681 --- /dev/null +++ b/db/changes/10370-pickles/00-item_getBalance.sql @@ -0,0 +1,144 @@ +DROP PROCEDURE IF EXISTS vn.item_getBalance; + +DELIMITER $$ +$$ +CREATE + definer = root@`%` procedure vn.item_getBalance(IN vItemId int, IN vWarehouse int) +BEGIN + DECLARE vDateInventory DATETIME; + DECLARE vCurdate DATE DEFAULT CURDATE(); + DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate); + + SELECT inventoried INTO vDateInventory FROM config; + SET @a = 0; + SET @currentLineFk = 0; + SET @shipped = ''; + + SELECT DATE(@shipped:= shipped) shipped, + alertLevel, + stateName, + origin, + reference, + clientFk, + name, + `in` AS invalue, + `out`, + @a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance, + @currentLineFk := IF (@shipped < CURDATE() + OR (@shipped = CURDATE() AND (isPicked OR alertLevel >= 2)), + lineFk,@currentLineFk) lastPreparedLineFk, + isTicket, + lineFk, + isPicked, + clientType, + claimFk + FROM + ( SELECT tr.landed AS shipped, + b.quantity AS `in`, + NULL AS `out`, + al.id AS alertLevel, + st.name AS stateName, + s.name AS name, + e.ref AS reference, + e.id AS origin, + s.id AS clientFk, + IF(al.id = 3, TRUE, FALSE) isPicked, + FALSE AS isTicket, + b.id lineFk, + NULL `order`, + NULL AS clientType, + NULL AS claimFk + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN supplier s ON s.id = e.supplierFk + JOIN alertLevel al ON al.id = + CASE + WHEN tr.shipped < CURDATE() THEN 3 + WHEN tr.shipped = CURDATE() AND tr.isReceived = TRUE THEN 3 + ELSE 0 + END + JOIN state st ON st.code = al.code + WHERE tr.landed >= vDateInventory + AND vWarehouse = tr.warehouseInFk + AND b.itemFk = vItemId + AND e.isInventory = FALSE + AND e.isRaid = FALSE + UNION ALL + + SELECT tr.shipped, + NULL, + b.quantity, + al.id, + st.name, + s.name, + e.ref, + e.id, + s.id, + IF(al.id = 3, TRUE, FALSE), + FALSE, + b.id, + NULL, + NULL, + NULL + FROM buy b + JOIN entry e ON e.id = b.entryFk + JOIN travel tr ON tr.id = e.travelFk + JOIN warehouse w ON w.id = tr.warehouseOutFk + JOIN supplier s ON s.id = e.supplierFk + JOIN alertLevel al ON al.id = + CASE + WHEN tr.shipped < CURDATE() THEN 3 + WHEN tr.shipped = CURDATE() AND tr.isReceived = TRUE THEN 3 + ELSE 0 + END + JOIN state st ON st.code = al.code + WHERE tr.shipped >= vDateInventory + AND vWarehouse =tr.warehouseOutFk + AND s.id <> 4 + AND b.itemFk = vItemId + AND e.isInventory = FALSE + AND w.isFeedStock = FALSE + AND e.isRaid = FALSE + UNION ALL + + SELECT DATE(t.shipped), + NULL, + s.quantity, + al.id, + st.name, + t.nickname, + t.refFk, + t.id, + t.clientFk, + stk.id, + TRUE, + s.id, + st.`order`, + ct.code, + cl.id + FROM sale s + JOIN ticket t ON t.id = s.ticketFk + LEFT JOIN ticketState ts ON ts.ticket = t.id + LEFT JOIN state st ON st.code = ts.code + JOIN client c ON c.id = t.clientFk + JOIN clientType ct ON ct.id = c.clientTypeFk + JOIN alertLevel al ON al.id = + CASE + WHEN t.shipped < curdate() THEN 3 + WHEN t.shipped > util.dayEnd(curdate()) THEN 0 + ELSE IFNULL(ts.alertLevel, 0) + END + LEFT JOIN state stPrep ON stPrep.`code` = 'PREPARED' + LEFT JOIN saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = stPrep.id + LEFT JOIN claim cl ON cl.ticketFk = t.id + WHERE t.shipped >= vDateInventory + AND s.itemFk = vItemId + AND vWarehouse =t.warehouseFk + ORDER BY shipped, alertLevel DESC, isTicket, `order` DESC, isPicked DESC, `in` DESC, `out` DESC + ) AS itemDiary; + +END; +$$ +DELIMITER ; + diff --git a/modules/item/front/diary/index.html b/modules/item/front/diary/index.html index 9f3937d03..2f5bce197 100644 --- a/modules/item/front/diary/index.html +++ b/modules/item/front/diary/index.html @@ -50,10 +50,10 @@ on-last="$ctrl.scrollToLine(sale.lastPreparedLineFk)" ng-attr-id="vnItemDiary-{{::sale.lineFk}}"> - + + ng-show="sale.claimFk" + vn-tooltip="{{::$ctrl.$t('Claim')}}: {{::sale.claimFk}}"> From 6d05b046e8289c0dbe7c9695b59a5f2b229154a4 Mon Sep 17 00:00:00 2001 From: vicent Date: Fri, 15 Oct 2021 10:34:32 +0200 Subject: [PATCH 3/5] feat(last-entries): add dateTo & delete style.scss --- modules/item/front/last-entries/index.html | 23 +++++++++---- modules/item/front/last-entries/index.js | 40 ++++++++++++++++------ modules/item/front/last-entries/style.scss | 24 ------------- 3 files changed, 46 insertions(+), 41 deletions(-) delete mode 100644 modules/item/front/last-entries/style.scss diff --git a/modules/item/front/last-entries/index.html b/modules/item/front/last-entries/index.html index 820085654..af7bbd751 100644 --- a/modules/item/front/last-entries/index.html +++ b/modules/item/front/last-entries/index.html @@ -7,17 +7,26 @@ order="landed DESC, buyFk DESC" limit="20"> - - - + + + + + + + + + + class="vn-mb-xl vn-w-xl vn-pa-md"> diff --git a/modules/item/front/last-entries/index.js b/modules/item/front/last-entries/index.js index d6a2a9913..a92ec4858 100644 --- a/modules/item/front/last-entries/index.js +++ b/modules/item/front/last-entries/index.js @@ -1,17 +1,16 @@ import ngModule from '../module'; import Section from 'salix/components/section'; -import './style.scss'; class Controller extends Section { constructor($element, $) { super($element, $); const from = new Date(); - from.setDate(from.getDate() - 75); + from.setDate(from.getDate()); from.setHours(0, 0, 0, 0); const to = new Date(); - to.setDate(to.getDate() + 60); + to.setDate(to.getDate() + 10); to.setHours(23, 59, 59, 59); this.filter = { @@ -22,19 +21,19 @@ class Controller extends Section { } } }; - this._date = from; + this._dateFrom = from; + this._dateTo = to; } - set date(value) { - this._date = value; + set dateFrom(value) { + this._dateFrom = value; if (!value) return; const from = new Date(value); from.setHours(0, 0, 0, 0); - const to = new Date(); - to.setDate(to.getDate() + 60); + const to = new Date(this._dateTo); to.setHours(23, 59, 59, 59); this.filter.where.shipped = { @@ -43,8 +42,29 @@ class Controller extends Section { this.$.model.refresh(); } - get date() { - return this._date; + set dateTo(value) { + this._dateTo = value; + + if (!value) return; + + const from = new Date(this._dateFrom); + from.setHours(0, 0, 0, 0); + + const to = new Date(value); + to.setHours(23, 59, 59, 59); + + this.filter.where.shipped = { + between: [from, to] + }; + this.$.model.refresh(); + } + + get dateFrom() { + return this._dateFrom; + } + + get dateTo() { + return this._dateTo; } exprBuilder(param, value) { diff --git a/modules/item/front/last-entries/style.scss b/modules/item/front/last-entries/style.scss deleted file mode 100644 index 6188daabc..000000000 --- a/modules/item/front/last-entries/style.scss +++ /dev/null @@ -1,24 +0,0 @@ -@import "variables"; - -vn-item-last-entries { - .round { - background-color: $color-spacer; - border-radius: 25px; - float: right; - width: 25px; - color: $color-font-dark; - text-align: center; - font-weight: bold; - } - vn-horizontal { - justify-content: center; - } - vn-date-picker { - flex: none !important; - } - @media screen and (max-width: 1440px) { - .expendable { - display: none; - } - } -} From e6899d50c38b057bd6baf71545757022997a82ad Mon Sep 17 00:00:00 2001 From: carlosjr Date: Mon, 18 Oct 2021 16:09:07 +0200 Subject: [PATCH 4/5] refactor(e2e): removed animations and transitios for the e2e tests --- e2e/helpers/puppeteer.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/e2e/helpers/puppeteer.js b/e2e/helpers/puppeteer.js index 97ec49260..70546b080 100644 --- a/e2e/helpers/puppeteer.js +++ b/e2e/helpers/puppeteer.js @@ -47,6 +47,13 @@ export async function getBrowser() { }); page = extendPage(page); page.setDefaultTimeout(5000); + await page.addStyleTag({ + content: `* { + transition: none!important; + animation: none!important; + }` + }); + await page.goto(defaultURL, {waitUntil: 'load'}); return {page, close: browser.close.bind(browser)}; } From 23a01a8e590bad184eff1b960049c1116f81c678 Mon Sep 17 00:00:00 2001 From: carlosjr Date: Mon, 18 Oct 2021 16:10:29 +0200 Subject: [PATCH 5/5] refactor(e2e): added waitForTimeout --- e2e/paths/04-item/08_regularize.spec.js | 1 + e2e/paths/09-invoice-out/03_manualInvoice.spec.js | 1 + 2 files changed, 2 insertions(+) diff --git a/e2e/paths/04-item/08_regularize.spec.js b/e2e/paths/04-item/08_regularize.spec.js index d7bab3b7b..a18f81e53 100644 --- a/e2e/paths/04-item/08_regularize.spec.js +++ b/e2e/paths/04-item/08_regularize.spec.js @@ -38,6 +38,7 @@ describe('Item regularize path', () => { }); it('should open the regularize dialog and check the warehouse matches the local user settings', async() => { + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.itemDescriptor.moreMenu); await page.waitToClick(selectors.itemDescriptor.moreMenuRegularizeButton); const result = await page.waitToGetProperty(selectors.itemDescriptor.regularizeWarehouse, 'value'); diff --git a/e2e/paths/09-invoice-out/03_manualInvoice.spec.js b/e2e/paths/09-invoice-out/03_manualInvoice.spec.js index d32ab3f3c..71ece0030 100644 --- a/e2e/paths/09-invoice-out/03_manualInvoice.spec.js +++ b/e2e/paths/09-invoice-out/03_manualInvoice.spec.js @@ -18,6 +18,7 @@ describe('InvoiceOut manual invoice path', () => { it('should open the manual invoice form', async() => { await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.invoiceOutIndex.createInvoice); + await page.waitForTimeout(1000); // initialization of functionality takes about 1000ms to work await page.waitToClick(selectors.invoiceOutIndex.createManualInvoice); await page.waitForSelector(selectors.invoiceOutIndex.manualInvoiceForm); });