Procediment emmagatzemat SBO_SP_PostTransactionNotice a ECOALF
DROP PROCEDURE SBO_SP_PostTransactionNotice;
CREATE PROCEDURE SBO_SP_PostTransactionNotice
(
in object_type nvarchar(30), -- SBO Object Type
in transaction_type nchar(1), -- [A]dd, [U]pdate, [D]elete, [C]ancel, C[L]ose
in num_of_cols_in_key int,
in list_of_key_cols_tab_del nvarchar(255),
in list_of_cols_val_tab_del nvarchar(255)
)
LANGUAGE SQLSCRIPT
AS
uDim1 nvarchar(50);
uDim2 nvarchar(50);
uDim3 nvarchar(50);
uCardCode nvarchar(50);
-- Return values
error int; -- Result (0 for no error)
error_message nvarchar (200); -- Error string to be displayed
begin
error := 0;
error_message := N'Ok';
-- Inici del codi INTRX1
-- Actualitzar els centres de cost a les comandes i a les factures
-- Autor: David Marti
-- Última modificacio: 26/7/2019
if :object_type='17' and (:transaction_type='A' or :transaction_type='U') then
select "CardCode" into uCardCode from ORDR where "DocEntry"=:list_of_cols_val_tab_del;
select "U_ECO_DIM1" into uDim1 from OCRD where "CardCode"=:uCardCode;
select "U_ECO_DIM2" into uDim2 from OCRD where "CardCode"=:uCardCode;
select "U_ECO_DIM3" into uDim3 from OCRD where "CardCode"=:uCardCode;
update RDR1
set "OcrCode"=:uDim1,"OcrCode2"=:uDim2,"OcrCode3"=:uDim3
where "DocEntry"=:list_of_cols_val_tab_del and ("OcrCode" is null or "OcrCode2" is null or "OcrCode3" is null);
end if;
if :object_type='13' and (:transaction_type='A' or :transaction_type='U') then
select "CardCode" into uCardCode from ORDR where "DocEntry"=:list_of_cols_val_tab_del;
select "U_ECO_DIM1" into uDim1 from OCRD where "CardCode"=:uCardCode;
select "U_ECO_DIM2" into uDim2 from OCRD where "CardCode"=:uCardCode;
select "U_ECO_DIM3" into uDim3 from OCRD where "CardCode"=:uCardCode;
update INV1
set "OcrCode"=:uDim1,"OcrCode2"=:uDim2,"OcrCode3"=:uDim3
where "DocEntry"=:list_of_cols_val_tab_del and ("OcrCode" is null or "OcrCode2" is null or "OcrCode3" is null);
end if;
-- Fi del codi INTRX1
--INICIO DEL CODIGO INSERTADO AUTOMATICAMENTE | INTAREX - IIS | NO MODIFICAR | Wednesday, December 19, 2018
CALL IISDB_SP_POSTTRANSACTIONNOTICE (object_type, transaction_type, num_of_cols_in_key, list_of_key_cols_tab_del, list_of_cols_val_tab_del);
-- FIN DEL CODIGO INSERTADO AUTOMATICAMENTE (Para cualquier problema con este codigo contactar con david.marti@intarex.com)
-- Select the return values
select :error, :error_message FROM dummy;
end;