vn2008 structure update for credit employee
This commit is contained in:
parent
b3ddeaf4a7
commit
b3eac25e8a
|
@ -906,32 +906,15 @@ BEGIN
|
|||
CALL pbx.phoneIsValid (NEW.fax);
|
||||
END IF;
|
||||
|
||||
-- Actualiza el crédito
|
||||
-- Actualiza el crédito
|
||||
|
||||
SELECT Id_Trabajador INTO vEmployee
|
||||
FROM Trabajadores WHERE user_id = account.userGetId();
|
||||
|
||||
IF vEmployee IS NULL THEN
|
||||
SET vEmployee = 20;
|
||||
END IF;
|
||||
|
||||
IF !(NEW.Credito <=> OLD.Credito) AND IFNULL(NEW.Credito, 0) >= 0
|
||||
IF !(NEW.Credito <=> OLD.Credito) AND IFNULL(NEW.Credito, 0) >= 0
|
||||
THEN
|
||||
INSERT INTO credit SET
|
||||
Id_Cliente = NEW.Id_Cliente,
|
||||
amount = NEW.Credito,
|
||||
Id_Trabajador = vEmployee;
|
||||
END IF;
|
||||
|
||||
-- Avisar al comercial si ha llegado la documentación sepa/core
|
||||
|
||||
IF NEW.sepavnl AND !OLD.sepavnl THEN
|
||||
SET vText = 'Sepa de VNL';
|
||||
END IF;
|
||||
|
||||
IF NEW.corevnl AND !OLD.corevnl THEN
|
||||
SET vText = 'Core de VNL';
|
||||
END IF;
|
||||
INSERT INTO credit SET
|
||||
Id_Cliente = NEW.Id_Cliente,
|
||||
amount = NEW.Credito,
|
||||
Id_Trabajador = account.userGetId();
|
||||
END IF;
|
||||
|
||||
IF vText IS NOT NULL
|
||||
THEN
|
||||
|
|
Loading…
Reference in New Issue