Merge branch 'dev' of https://git.verdnatura.es/salix into dev

This commit is contained in:
gerard 2018-07-09 09:48:11 +02:00
commit 67d689443a
7 changed files with 155 additions and 15 deletions

View File

@ -24,10 +24,10 @@
<vn-thead> <vn-thead>
<vn-tr> <vn-tr>
<vn-th>Date</vn-th> <vn-th>Date</vn-th>
<vn-th number>State</vn-th> <vn-th number>Id</vn-th>
<vn-th number>Origin</vn-th> <vn-th>State</vn-th>
<vn-th number>Reference</vn-th> <vn-th>Reference</vn-th>
<vn-th field="name">Worker</vn-th> <vn-th>Worker</vn-th>
<vn-th number>In</vn-th> <vn-th number>In</vn-th>
<vn-th number>Out</vn-th> <vn-th number>Out</vn-th>
<vn-th number>Balance</vn-th> <vn-th number>Balance</vn-th>
@ -37,9 +37,9 @@
<vn-tr ng-class="{'warning': $ctrl.isToday(sale.date)}" <vn-tr ng-class="{'warning': $ctrl.isToday(sale.date)}"
ng-repeat="sale in sales" vn-repeat-last on-last="$ctrl.scrollToActive()"> ng-repeat="sale in sales" vn-repeat-last on-last="$ctrl.scrollToActive()">
<vn-td>{{::sale.date | date:'dd/MM/yyyy HH:mm' }}</vn-td> <vn-td>{{::sale.date | date:'dd/MM/yyyy HH:mm' }}</vn-td>
<vn-td number>{{::sale.alertLevel | dashIfEmpty}}</vn-td>
<vn-td number>{{::sale.origin | dashIfEmpty}}</vn-td> <vn-td number>{{::sale.origin | dashIfEmpty}}</vn-td>
<vn-td number>{{::sale.reference | dashIfEmpty}}</vn-td> <vn-td>{{::sale.stateName | dashIfEmpty}}</vn-td>
<vn-td>{{::sale.reference | dashIfEmpty}}</vn-td>
<vn-td>{{sale.name | dashIfEmpty}}</vn-td> <vn-td>{{sale.name | dashIfEmpty}}</vn-td>
<vn-td number>{{::sale.in | dashIfEmpty}}</vn-td> <vn-td number>{{::sale.in | dashIfEmpty}}</vn-td>
<vn-td number>{{::sale.out | dashIfEmpty}}</vn-td> <vn-td number>{{::sale.out | dashIfEmpty}}</vn-td>

View File

@ -1,6 +1,6 @@
<vn-horizontal> <vn-horizontal>
<vn-one>{{::$ctrl.sale.concept}}</vn-one> <vn-one>{{::$ctrl.sale.concept}}</vn-one>
<vn-two class="ellipsize"> <vn-two>
<section <section
class="inline-tag ellipsize" ng-class="{'empty': !fetchedTag.value}" class="inline-tag ellipsize" ng-class="{'empty': !fetchedTag.value}"
ng-repeat="fetchedTag in $ctrl.sale.item.tags track by $index" ng-repeat="fetchedTag in $ctrl.sale.item.tags track by $index"

View File

@ -1,23 +1,41 @@
@import "colors"; @import "colors";
vn-fetched-tags { vn-fetched-tags {
@media screen and (max-width: 1700px){ @media screen and (max-width: 1600px){
& vn-horizontal { & vn-horizontal {
flex-direction: column; flex-direction: column;
text-align: center; text-align: center;
& vn-two { & vn-two {
text-align: center; text-align: center;
max-width: 10.5em;
margin: 0 auto margin: 0 auto
} }
.inline-tag {
font-size: 0.7em;
padding: 0.3em
}
} }
} }
@media screen and (max-width: 1200px){
& vn-horizontal {
.inline-tag {
font-size: 0.6em;
padding: 0.2em
}
}
}
& vn-one { & vn-one {
padding-top: 6px padding-top: 6px
} }
& vn-two {
white-space: nowrap
}
& .inline-tag { & .inline-tag {
background-color: $secondary-font-color; background-color: $secondary-font-color;
display: inline-block; display: inline-block;

View File

@ -0,0 +1,18 @@
USE `vn`;
CREATE TABLE `vn`.`alertLevel` (
`code` VARCHAR(45) CHARACTER SET 'utf8' NOT NULL,
`alertLevel` INT(11) NOT NULL,
PRIMARY KEY (`code`));
ALTER TABLE `vn`.`alertLevel`
ADD CONSTRAINT `fk_code_1`
FOREIGN KEY (`code`)
REFERENCES `vn2008`.`state` (`code`)
ON DELETE CASCADE
ON UPDATE CASCADE;
INSERT INTO `vn`.`alertLevel` (`code`, `alertLevel`) VALUES ('FREE', '0');
INSERT INTO `vn`.`alertLevel` (`code`, `alertLevel`) VALUES ('ON_PREPARATION', '1');
INSERT INTO `vn`.`alertLevel` (`code`, `alertLevel`) VALUES ('PACKED', '2');
INSERT INTO `vn`.`alertLevel` (`code`, `alertLevel`) VALUES ('DELIVERED', '3');

View File

@ -0,0 +1,105 @@
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();
-- 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,
name,
`in`,
`out`,
@a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance
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
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
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
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
UNION ALL
SELECT t.shipped as date,
NULL as `in`,
s.quantity as `out`,
IF(t.shipped < vCurdate,3,IF(t.shipped > vCurdate, 0, IFNULL(ts.alertLevel,0))) as alertLevel,
st.name AS stateName,
t.nickname as name,
t.refFk as reference,
t.id as origin
FROM vn.sale s
JOIN vn.ticket t ON t.id = s.ticketFk
LEFT JOIN vn.ticketState ts ON ts.ticket = t.id
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 > vCurdate THEN 0
ELSE IFNULL(ts.alertLevel, 0)
END
JOIN vn.state st ON st.code = al.code
WHERE t.shipped >= vDateInventory
AND s.itemFk = vItemId
AND vWarehouse =t.warehouseFk
) AS itemDiary
ORDER BY date, alertLevel, `in` DESC;
END$$
DELIMITER ;

View File

@ -26,7 +26,6 @@ module.exports = Self => {
}); });
Self.filter = async(filter, tags) => { Self.filter = async(filter, tags) => {
console.log(tags);
return await Self.find(filter); return await Self.find(filter);
}; };
}; };

View File

@ -3,8 +3,8 @@
"port": 3000, "port": 3000,
"debug": false, "debug": false,
"defaultLanguage": "es", "defaultLanguage": "es",
"senderMail": "noreply@localhost", "senderMail": "joan@verdnatura.es",
"senderName": "MySender" "senderName": "VerdNatura"
}, },
"mysql": { "mysql": {
"host": "localhost", "host": "localhost",
@ -14,12 +14,12 @@
"password": "root" "password": "root"
}, },
"smtp": { "smtp": {
"host": "localhost", "host": "smtp.verdnatura.es",
"port": 465, "port": 465,
"secure": true, "secure": true,
"auth": { "auth": {
"user": "noreply", "user": "joan",
"pass": "" "pass": "CLed3ejl$"
}, },
"tls": { "tls": {
"rejectUnauthorized": false "rejectUnauthorized": false