Merge branch 'dev' into 2423-hide_leftMenu
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2021-10-18 18:28:35 +00:00
commit 9d51c2a6a9
8 changed files with 208 additions and 41 deletions

View File

@ -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 ;

View File

@ -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)};
}

View File

@ -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');

View File

@ -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);
});

View File

@ -29,6 +29,7 @@
<vn-table model="model">
<vn-thead>
<vn-tr>
<vn-th shrink></vn-th>
<vn-th expand>Date</vn-th>
<vn-th number order="DESC" shrink>Id</vn-th>
<vn-th>State</vn-th>
@ -48,6 +49,14 @@
vn-repeat-last
on-last="$ctrl.scrollToLine(sale.lastPreparedLineFk)"
ng-attr-id="vnItemDiary-{{::sale.lineFk}}">
<vn-td shrink>
<a ui-sref="claim.card.basicData({id: sale.claimFk})">
<vn-icon icon="icon-claims"
ng-show="sale.claimFk"
vn-tooltip="{{::$ctrl.$t('Claim')}}: {{::sale.claimFk}}">
</vn-icon>
</a>
</vn-td>
<vn-td expand>
<span class="chip"
ng-class="::{warning: $ctrl.today == sale.shipped}">

View File

@ -7,17 +7,26 @@
order="landed DESC, buyFk DESC"
limit="20">
</vn-crud-model>
<vn-card class="vn-mb-md vn-w-xl vn-pa-lg">
<vn-date-picker
vn-none
<vn-card class="vn-w-md vn-pa-md">
<vn-horizontal>
<vn-date-picker class="vn-pa-xs"
vn-one
label="Since"
ng-model="$ctrl.date">
ng-model="$ctrl.dateFrom">
</vn-date-picker>
<vn-date-picker class="vn-pa-xs"
vn-one
label="To"
ng-model="$ctrl.dateTo">
</vn-date-picker>
</vn-horizontal>
</vn-card>
<vn-data-viewer
model="model"
class="vn-mb-xl vn-w-xl">
class="vn-mb-xl vn-w-xl vn-pa-md">
<vn-card class="vn-pa-lg">
<vn-vertical>
<vn-table model="model">

View File

@ -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) {

View File

@ -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;
}
}
}