USP_DATAFORMTEMPLATE_ADD_BANKACCOUNTDEPOSITCREDITPAYMENT
The save procedure used by the add dataform template "Bank Account Deposit Credit Payment Add Data Form".
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | INOUT | The output parameter indicating the ID of the record added. |
@DEPOSITID | uniqueidentifier | IN | Input parameter indicating the context ID for the record being added. |
@CHANGEAGENTID | uniqueidentifier | IN | Input parameter indicating the ID of the change agent invoking the procedure. |
@CREDITPAYMENTID | uniqueidentifier | IN | Refund of order |
Definition
Copy
CREATE procedure dbo.USP_DATAFORMTEMPLATE_ADD_BANKACCOUNTDEPOSITCREDITPAYMENT
(
@ID uniqueidentifier = null output
,@DEPOSITID uniqueidentifier
,@CHANGEAGENTID uniqueidentifier = null
,@CREDITPAYMENTID uniqueidentifier= null
)
as
set nocount on;
if @ID is null
set @ID = @CREDITPAYMENTID;
if @ID is not null
begin
if @CHANGEAGENTID is null
exec dbo.USP_CHANGEAGENT_GETORCREATECHANGEAGENT @CHANGEAGENTID output
declare @CURRENTDATE datetime
set @CURRENTDATE = getdate()
begin try
if exists(select 1 from dbo.BANKACCOUNTDEPOSITCREDITPAYMENT where ID = @CREDITPAYMENTID)
begin
update dbo.BANKACCOUNTDEPOSITCREDITPAYMENT set
DEPOSITID = @DEPOSITID
,CHANGEDBYID = @CHANGEAGENTID
,DATECHANGED = @CURRENTDATE
where ID = @CREDITPAYMENTID
exec dbo.USP_BANKACCOUNTDEPOSIT_OVERWRITECREDITPAYMENTCREDITACCOUNTS @CREDITPAYMENTID, @DEPOSITID, @CHANGEAGENTID, @CURRENTDATE;
end
else
exec dbo.USP_BANKACCOUNTDEPOSITCREDITPAYMENT_ADD @CREDITPAYMENTID, @DEPOSITID, @CHANGEAGENTID
end try
begin catch
exec dbo.USP_RAISE_ERROR
return 1
end catch
end
return 0