Post Transaction Notification
-- B1 DEPENDS: BEFORE:PT:PROCESS_START DROP PROCEDURE SBO_SP_TransactionNotification; CREATE PROCEDURE SBO_SP_TransactionNotification ( 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 -- Return values error int; -- Result (0 for no error) error_message nvarchar (200); -- Error string to be displayed -- Variable necesaries INTRX uDim1 nvarchar(50); uDim2 nvarchar(50); uDim3 nvarchar(50); uCardCode nvarchar(50); uTipusIC nvarchar(1); begin error := 0; error_message := N'Ok'; -- No deixar crear un client sense centres de cost -- Autor: David Marti (Última modificacio 7/5/2019) if (:object_type='2' and (:transaction_type='A' or :transaction_type='U')) then uCardCode:=:list_of_cols_val_tab_del; select "CardType" into uTipusIC from OCRD where "CardCode"=:uCardCode; if (uTipusIC='C') then 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; if (uDim1='' or uDim2='' or uDim3='' or uDim1 is null or uDim2 is null or uDim3 is null) then error:=-100; error_message:='No se puede crear o modificar un cliente sin centros de coste'; end if; end if; end if; -- Select the return values select :error, :error_message FROM dummy; end;
Post Transaction Notice
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 -- Return values error int; -- Result (0 for no error) error_message nvarchar (200); -- Error string to be displayed -- Variable necesaries INTRX uDim1 nvarchar(50); uDim2 nvarchar(50); uDim3 nvarchar(50); uCardCode nvarchar(50); begin error := 0; error_message := N'Ok'; -- Assignació de centres de cost a les comandes de clients segons la informació del mestre de clients -- Assignació de centres de cost en devolucions i abonaments -- Autor: David Marti (última modificació 07/05/2019) if (:object_type='14' or :object_type='17' or :object_type='16') 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; end if; -- Assignació de centres de cost a les comandes de compres fixe, segons indicacions del client (ECOALF) -- Autor: David Marti (última modificació 11/04/2019) if :object_type='22' and (:transaction_type='A' or :transaction_type='U') then update RDR1 set "OcrCode"='ST_STR',"OcrCode2"='ST_S001',"OcrCode3"='DP_SOU' where "DocEntry"=:list_of_cols_val_tab_del; end if; --INICIO DEL CODIGO INSERTADO AUTOMATICAMENTE | INTAREX - IIS | NO MODIFICAR | Wednesday, April 10, 2019 | SYSTEM/ECOAPP/ECOALF 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;