ALTER TABLE [dbo].[tbl_transaction_details]
 ADD  RefundReferenceNo varchar(50)

 /****** Object:  StoredProcedure [DealerSelection].[usp_get_BookingDetail_OnBookingId]    Script Date: 1/2/2024 12:08:07 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE     PROCEDURE [DealerSelection].[usp_get_BookingDetail_OnBookingId]
(
@bookingId VARCHAR(50),
@transactionId VARCHAR(50)
 )
AS
BEGIN

SELECT t.BuId,t.RecordId,t.AmountPaid FROM tbl_transaction_details t
where t.BookingId=@bookingId and t.CCTransactionId=@transactionId
END
GO

/****** Object:  StoredProcedure [DealerSelection].[usp_update_RefundStatus]    Script Date: 1/2/2024 12:08:07 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
	CREATE     PROCEDURE [DealerSelection].[usp_update_RefundStatus]
	(
	-- Add the parameters for the stored procedure here
	@BuId INT,
	@BookingId varchar(50),
	@CCTransactionId varchar(50),
	@RefundReferenceNo varchar(50),
	@CCTransactionStatus varchar(50),  
	@CCTransactionStatusReason varchar(100)
	)
	AS
	BEGIN	
	SET NOCOUNT ON  
 
	UPDATE [dbo].[tbl_transaction_details]
	SET  
	RefundReferenceNo=@RefundReferenceNo,
	CCTransactionStatus=@CCTransactionStatus,
	CCTransactionStatusReason = @CCTransactionStatusReason
	WHERE BookingId=@BookingId  and CCTransactionId = @CCTransactionId and BuId=@BuId	 
	  	 
	END
GO