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

This commit is contained in:
Daniel Herrero 2018-03-14 13:59:04 +01:00
commit 8f0f71a3ca
9 changed files with 172 additions and 2 deletions

View File

@ -415,6 +415,29 @@ INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `pric
( 2, 1, 1, 'Gem of Time', 2 , 1.5, 0, 0, 0, CURDATE()),
( 3, 2, 2, 'Mjolnir' , 10, 4 , 0, 0, 0, CURDATE());
INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`)
VALUES
( 1, 0),
( 2, 1);
INSERT INTO `vn`.`componentTypeRate`(`id`, `type`)
VALUES
( 1, 'agency'),
( 2, 'client'),
( 3, 'company');
INSERT INTO `vn`.`componentRate`(`id`, `name`, `componentTypeRate`, `classRate`, `tax`, `isRenewable`)
VALUES
( 1, 'Special price', 1, NULL, NULL, 1),
( 2, 'Delivery', 2, NULL, NULL, 1),
( 3, 'Mana', 3, 1, NULL, 0 );
INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
VALUES
( 1, 1, 0.5),
( 2, 2, 1.2 );
INSERT INTO `vn`.`itemBarcode`(`id`, `itemFk`, `code`)
VALUES
(1, 1 ,1 ),

View File

@ -7,3 +7,5 @@ INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `pri
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('TicketPackaging', '*', '*', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Packaging', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Packaging', '*', 'WRITE', 'ALLOW', 'ROLE', 'logistic');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('SaleChecked', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('SaleComponent', '*', 'READ', 'ALLOW', 'ROLE', 'employee');

View File

@ -0,0 +1,11 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`saleChecked` AS
SELECT
`m`.`Id_Movimiento` AS `saleFk`,
`m`.`checked` AS `isChecked`
FROM
`vn2008`.`Movimientos_checked` `m`;

View File

@ -0,0 +1,30 @@
USE `vn`;
DROP procedure IF EXISTS `ticketVolume`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`ticketVolume`(IN vTicketId INT)
BEGIN
DECLARE vWarehouseId INTEGER;
DECLARE vShippedDate DATE;
DROP TEMPORARY TABLE IF EXISTS ticketVolume;
SELECT warehouseFk, shipped INTO vWarehouseId,vShippedDate FROM vn.ticket WHERE id = vTicketId;
CREATE TEMPORARY TABLE IF NOT EXISTS ticketVolume ENGINE MEMORY
SELECT itemFk,quantity, concept, VolUd as m3_uni, volume as m3, @m3:= @m3 + ifnull(volume,0) as m3_total
FROM
(
SELECT round(r.cm3 / 1000000,3) as VolUd ,s.quantity, round(r.cm3 * s.quantity / 1000000,3) as volume,
s.itemFk, s.concept, @m3:= 0, @vol:=0, t.agencyModeFk
FROM sale s
JOIN vn.ticket t on t.id = s.ticketFk
JOIN bi.rotacion r ON r.Id_Article = s.itemFk AND r.warehouse_id = t.warehouseFk
WHERE s.ticketFk = vTicketId
) sub;
END$$
DELIMITER ;

View File

@ -0,0 +1,39 @@
{
"name": "ComponentRate",
"base": "VnModel",
"options": {
"mysql": {
"table": "componentRate"
}
},
"properties": {
"id": {
"id": true,
"type": "Number",
"description": "Identifier"
},
"name": {
"type": "String"
},
"classRate": {
"type": "Number"
},
"tax": {
"type": "Number"
},
"isRenewable": {
"type": "Number"
},
"componentTypeRate": {
"type": "Number"
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

View File

@ -37,7 +37,7 @@
"relations": {
"item": {
"type": "belongsTo",
"model": "Iicket",
"model": "Item",
"foreignKey": "itemFk"
}
}

View File

@ -0,0 +1,24 @@
{
"name": "SaleChecked",
"base": "VnModel",
"options": {
"mysql": {
"table": "saleChecked"
}
},
"properties": {
"isChecked": {
"type": "Number"
},
"saleFk": {
"id": true
}
},
"relations": {
"sale": {
"type": "belongsTo",
"model": "Sale",
"foreignKey": "saleFk"
}
}
}

View File

@ -0,0 +1,29 @@
{
"name": "SaleComponent",
"base": "VnModel",
"options": {
"mysql": {
"table": "saleComponent"
}
},
"properties": {
"value": {
"type": "Number"
},
"saleFk": {
"id": true
}
},
"relations": {
"sale": {
"type": "belongsTo",
"model": "Sale",
"foreignKey": "saleFk"
},
"componentRate": {
"type": "belongsTo",
"model": "componentRate",
"foreignKey": "componentFk"
}
}
}

View File

@ -16,5 +16,17 @@
},
"Packaging": {
"dataSource": "vn"
},
"SaleChecked": {
"dataSource": "vn"
},
"ComponentRate": {
"dataSource": "vn"
},
"SaleComponent": {
"dataSource": "vn"
}
}