refs #5000 InvoiceOut
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Andrés 2023-03-14 09:34:41 +01:00
parent 2a6848c09a
commit 6b375cbaaa
5 changed files with 11 additions and 38 deletions

View File

@ -1,30 +0,0 @@
DROP FUNCTION IF EXISTS `vn`.`invoiceOut_getWeight`;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost` FUNCTION `vn`.`invoiceOut_getWeight`(vInvoiceRef VARCHAR(15)) RETURNS decimal(10,2)
READS SQL DATA
BEGIN
/**
* Calcula el peso de una factura emitida
*
* @param vInvoiceRef referencia de la factura
* @return vTotalWeight peso de la factura
*/
DECLARE vTotalWeight DECIMAL(10,2);
SELECT SUM(CAST(IFNULL(i.stems, 1)
* s.quantity
* IF(ic.grams, ic.grams, IFNULL(i.weightByPiece, 0)) / 1000 AS DECIMAL(10,2)))
INTO vTotalWeight
FROM ticket t
JOIN sale s ON s.ticketFk = t.id
JOIN item i ON i.id = s.itemFk
JOIN itemCost ic ON ic.itemFk = i.id
AND ic.warehouseFk = t.warehouseFk
WHERE t.refFk = vInvoiceRef
AND i.intrastatFk;
RETURN vTotalWeight;
END$$
DELIMITER ;

View File

@ -2,13 +2,15 @@ DROP FUNCTION IF EXISTS `vn`.`invoiceOut_getWeight`;
DELIMITER $$ DELIMITER $$
$$ $$
CREATE DEFINER=`root`@`localhost` FUNCTION `vn`.`invoiceOut_getWeight`(vInvoice VARCHAR(15)) RETURNS decimal(10,2) CREATE DEFINER=`root`@`localhost` FUNCTION `vn`.`invoiceOut_getWeight`(
vInvoiceRef VARCHAR(15)
)RETURNS decimal(10,2)
READS SQL DATA READS SQL DATA
BEGIN BEGIN
/** /**
* Calcula el peso de una factura emitida * Calcula el peso de una factura emitida
* *
* @param vInvoice Id de la factura * @param vInvoiceRef referencia de la factura
* @return vTotalWeight peso de la factura * @return vTotalWeight peso de la factura
*/ */
DECLARE vTotalWeight DECIMAL(10,2); DECLARE vTotalWeight DECIMAL(10,2);
@ -22,7 +24,7 @@ BEGIN
JOIN item i ON i.id = s.itemFk JOIN item i ON i.id = s.itemFk
JOIN itemCost ic ON ic.itemFk = i.id JOIN itemCost ic ON ic.itemFk = i.id
AND ic.warehouseFk = t.warehouseFk AND ic.warehouseFk = t.warehouseFk
WHERE t.refFk = vInvoice WHERE t.refFk = vInvoiceRef
AND i.intrastatFk; AND i.intrastatFk;
RETURN vTotalWeight; RETURN vTotalWeight;

View File

@ -54,11 +54,11 @@ BEGIN
FROM ticketConfig; FROM ticketConfig;
IF vWarehouseInventory IS NULL THEN IF vWarehouseInventory IS NULL THEN
CALL util.throw('Warehouse inventory not seted'); CALL util.throw('Warehouse inventory not set');
END IF; END IF;
IF vComponentCost IS NULL THEN IF vComponentCost IS NULL THEN
CALL util.throw('Component cost not seted'); CALL util.throw('Component cost not set');
END IF; END IF;
SET vDateEnd = vDated + INTERVAL 1 DAY; SET vDateEnd = vDated + INTERVAL 1 DAY;

View File

@ -68382,11 +68382,11 @@ BEGIN
FROM ticketConfig; FROM ticketConfig;
IF vWarehouseInventory IS NULL THEN IF vWarehouseInventory IS NULL THEN
CALL util.throw('Warehouse inventory not seted'); CALL util.throw('Warehouse inventory not set');
END IF; END IF;
IF vComponentCost IS NULL THEN IF vComponentCost IS NULL THEN
CALL util.throw('Component cost not seted'); CALL util.throw('Component cost not set');
END IF; END IF;
SET vDateEnd = vDated + INTERVAL 1 DAY; SET vDateEnd = vDated + INTERVAL 1 DAY;

View File

@ -152,6 +152,7 @@
"It is not possible to modify sales that their articles are from Floramondo": "It is not possible to modify sales that their articles are from Floramondo", "It is not possible to modify sales that their articles are from Floramondo": "It is not possible to modify sales that their articles are from Floramondo",
"It is not possible to modify cloned sales": "It is not possible to modify cloned sales", "It is not possible to modify cloned sales": "It is not possible to modify cloned sales",
"Valid priorities: 1,2,3": "Valid priorities: 1,2,3", "Valid priorities: 1,2,3": "Valid priorities: 1,2,3",
"Warehouse inventory not seted": "Warehouse inventory not seted", "Warehouse inventory not set": "Almacén inventario no está establecido",
"Component cost not set": "Componente coste no está estabecido",
"Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº 2": "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº 2" "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº 2": "Tickets with associated refunds can't be deleted. This ticket is associated with refund Nº 2"
} }