USP_TAXDECLARATION_DELETE

Executes the "Tax Declaration: Delete" record operation.

Parameters

Parameter Parameter Type Mode Description
@ID uniqueidentifier IN Input parameter indicating the ID of the record being deleted.
@CHANGEAGENTID uniqueidentifier IN Input parameter indicating the ID of the change agent invoking the delete.

Definition

Copy


                    CREATE procedure dbo.USP_TAXDECLARATION_DELETE
                    (
                        @ID uniqueidentifier,
                        @CHANGEAGENTID uniqueidentifier
                    )
                    as 
                    begin
                        declare 
                            @CONSTITUENTID uniqueidentifier,
                            @PAYSTAXCODE tinyint;

                        select
                            @CONSTITUENTID = CONSTITUENTID,
                            @PAYSTAXCODE = PAYSTAXCODE
                        from dbo.TAXDECLARATION
                        where ID = @ID;

                        -- use the system generated delete routine to allow proper recording of the deleting agent

                        exec USP_TAXDECLARATION_DELETEBYID_WITHCHANGEAGENTID @ID, @CHANGEAGENTID

                        -- Only refresh if this was a 'Yes' declaration.  Any other values means the eligibility hasn't changed

                        if @PAYSTAXCODE = 1
                            exec dbo.USP_REVENUETRIBUTETAXCLAIMAMOUNT_ADDUPDATEBYCONSTITUENT @CONSTITUENTID, @CHANGEAGENTID, null;

                        return 0;
                    end