2024-01-15 11:31:03 +00:00
|
|
|
DELIMITER $$
|
2024-07-22 09:52:42 +00:00
|
|
|
CREATE OR REPLACE DEFINER=`vn-admin`@`localhost` PROCEDURE `vn`.`worker_updateBalance`(vSelf INT(11), vCredit DECIMAL(10,2), vDebit DECIMAL(10,2))
|
2024-01-15 11:31:03 +00:00
|
|
|
BEGIN
|
|
|
|
/**
|
|
|
|
* Actualiza la columna balance de worker.
|
|
|
|
*
|
|
|
|
* @param selfFk, credit, debit
|
|
|
|
*/
|
|
|
|
UPDATE worker
|
|
|
|
SET balance = IFNULL(balance, 0) + IFNULL(vCredit, 0) - IFNULL(vDebit, 0)
|
2024-05-02 15:05:10 +00:00
|
|
|
WHERE id = vSelf;
|
2024-01-15 11:31:03 +00:00
|
|
|
END$$
|
|
|
|
DELIMITER ;
|