Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 1838-searchbar_refactor
This commit is contained in:
commit
efa6ddc0f1
|
@ -0,0 +1,119 @@
|
|||
USE `vn`;
|
||||
DROP procedure IF EXISTS `itemDiary`;
|
||||
|
||||
DELIMITER $$
|
||||
USE `vn`$$
|
||||
CREATE DEFINER=`root`@`%` PROCEDURE `itemDiary`(IN vItemId INT, IN vWarehouse INT)
|
||||
BEGIN
|
||||
DECLARE vDateInventory DATETIME;
|
||||
DECLARE vCurdate DATE DEFAULT CURDATE();
|
||||
DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate);
|
||||
-- traduccion: date, alertLevel, origin, reference, name, In, Out, Balance
|
||||
SELECT Fechainventario INTO vDateInventory FROM vn2008.tblContadores;
|
||||
SET @a = 0;
|
||||
SELECT DATE(date) AS date,
|
||||
alertLevel,
|
||||
stateName,
|
||||
origin,
|
||||
reference,
|
||||
clientFk,
|
||||
name,
|
||||
`in`,
|
||||
`out`,
|
||||
@a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance,
|
||||
isPicked,
|
||||
isTicket
|
||||
FROM
|
||||
( SELECT tr.landed as date,
|
||||
b.quantity as `in`,
|
||||
NULL as `out`,
|
||||
IF(tr.isReceived != FALSE,3, IF(tr.isDelivered,1,0)) as alertLevel,
|
||||
st.name AS stateName,
|
||||
s.name as name,
|
||||
e.ref as reference,
|
||||
e.id as origin,
|
||||
s.id as clientFk,
|
||||
TRUE isPicked,
|
||||
FALSE AS isTicket
|
||||
FROM vn.buy b
|
||||
JOIN vn.entry e ON e.id = b.entryFk
|
||||
JOIN vn.travel tr ON tr.id = e.travelFk
|
||||
JOIN vn.supplier s ON s.id = e.supplierFk
|
||||
JOIN vn.alertLevel al ON al.alertLevel =
|
||||
CASE
|
||||
WHEN tr.isReceived != FALSE THEN 3
|
||||
WHEN tr.isDelivered THEN 1
|
||||
ELSE 0
|
||||
END
|
||||
JOIN vn.state st ON st.code = al.code
|
||||
WHERE tr.landed >= vDateInventory
|
||||
AND vWarehouse = tr.warehouseInFk
|
||||
AND b.itemFk = vItemId
|
||||
AND e.isInventory = 0
|
||||
AND e.isRaid = 0
|
||||
UNION ALL
|
||||
|
||||
SELECT tr.shipped as date,
|
||||
NULL as `in`,
|
||||
b.quantity as `out`,
|
||||
IF(tr.isReceived != FALSE,3, IF(tr.isDelivered,1,0)) as alertLevel,
|
||||
st.name AS stateName,
|
||||
s.name as name,
|
||||
e.ref as reference,
|
||||
e.id as origin,
|
||||
s.id as clientFk,
|
||||
TRUE isPicked,
|
||||
FALSE AS isTicket
|
||||
FROM vn.buy b
|
||||
JOIN vn.entry e ON e.id = b.entryFk
|
||||
JOIN vn.travel tr ON tr.id = e.travelFk
|
||||
JOIN vn.warehouse w ON w.id = tr.warehouseOutFk
|
||||
JOIN vn.supplier s ON s.id = e.supplierFk
|
||||
JOIN vn.alertLevel al ON al.alertLevel =
|
||||
CASE
|
||||
WHEN tr.isReceived != FALSE THEN 3
|
||||
WHEN tr.isDelivered THEN 1
|
||||
ELSE 0
|
||||
END
|
||||
JOIN vn.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 = 0
|
||||
AND w.isFeedStock = 0
|
||||
AND e.isRaid = 0
|
||||
UNION ALL
|
||||
|
||||
SELECT t.shipped as date,
|
||||
NULL as `in`,
|
||||
s.quantity as `out`,
|
||||
al.alertLevel as alertLevel,
|
||||
st.name AS stateName,
|
||||
t.nickname as name,
|
||||
t.refFk as reference,
|
||||
t.id as origin,
|
||||
t.clientFk,
|
||||
stk.id as isPicked, -- TRUE as isPicked
|
||||
TRUE as isTicket
|
||||
FROM vn.sale s
|
||||
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||
LEFT JOIN vn.ticketState ts ON ts.ticket = t.id
|
||||
LEFT JOIN vn.state st ON st.code = ts.code
|
||||
JOIN vn.client c ON c.id = t.clientFk
|
||||
JOIN vn.alertLevel al ON al.alertLevel =
|
||||
CASE
|
||||
WHEN t.shipped < vCurdate THEN 3
|
||||
WHEN t.shipped > vDayEnd THEN 0
|
||||
ELSE IFNULL(ts.alertLevel, 0)
|
||||
END
|
||||
LEFT JOIN vn.saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = 14 -- comentar
|
||||
WHERE t.shipped >= vDateInventory
|
||||
AND s.itemFk = vItemId
|
||||
AND vWarehouse =t.warehouseFk
|
||||
) AS itemDiary
|
||||
ORDER BY date, isTicket, alertLevel DESC, isPicked DESC, `in` DESC, `out` DESC;
|
||||
END$$
|
||||
|
||||
DELIMITER ;
|
||||
|
|
@ -103,7 +103,7 @@ vn-table {
|
|||
text-align: center;
|
||||
}
|
||||
&[expand] {
|
||||
max-width: 10em;
|
||||
max-width: 25em;
|
||||
min-width: 0;
|
||||
}
|
||||
vn-icon.bright, i.bright {
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<vn-thead>
|
||||
<vn-tr>
|
||||
<vn-th expand>Date</vn-th>
|
||||
<vn-th number order="DESC">Ticket/Entry</vn-th>
|
||||
<vn-th number order="DESC">Id</vn-th>
|
||||
<vn-th>State</vn-th>
|
||||
<vn-th>Reference</vn-th>
|
||||
<vn-th>Client</vn-th>
|
||||
|
|
|
@ -37,8 +37,8 @@ module.exports = Self => {
|
|||
switch (param) {
|
||||
case 'search':
|
||||
return {or: [
|
||||
{ticketFk: value},
|
||||
{clientFk: value}
|
||||
{'t.id': value},
|
||||
{'c.id': value}
|
||||
]};
|
||||
}
|
||||
});
|
||||
|
|
|
@ -14,11 +14,11 @@
|
|||
<vn-tr>
|
||||
<vn-th shrink></vn-th>
|
||||
<vn-th field="itemFk" number>Item</vn-th>
|
||||
<vn-th>Description</vn-th>
|
||||
<vn-th expand>Description</vn-th>
|
||||
<vn-th field="quantity" number>Quantity</vn-th>
|
||||
<vn-th field="originalQuantity" number>Original</vn-th>
|
||||
<vn-th field="workerFk">Worker</vn-th>
|
||||
<vn-th field="state">State</vn-th>
|
||||
<vn-th field="state" shrink>State</vn-th>
|
||||
<vn-th field="created">Created</vn-th>
|
||||
</vn-tr>
|
||||
</vn-thead>
|
||||
|
@ -56,7 +56,7 @@
|
|||
{{::sale.userNickname | dashIfEmpty}}
|
||||
</span>
|
||||
</vn-td>
|
||||
<vn-td>{{::sale.state}}</vn-td>
|
||||
<vn-td shrink>{{::sale.state}}</vn-td>
|
||||
<vn-td>{{::sale.created | date: 'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
|
|
Loading…
Reference in New Issue