You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
4.0 KiB

1 year ago
  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[proc_uploadFile] Script Date: 9/27/2019 1:30:14 PM ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8. CREATE proc [dbo].[proc_uploadFile]
  9. (
  10. @flag varchar(1),
  11. @rowId int = 0 output,
  12. @controlNo VARCHAR(50) =NULL,
  13. @fileDesc varchar(max) = null,
  14. @fileType varchar(200) = null,
  15. @createdBy varchar(100) = null,
  16. @createdDate varchar(50) = null,
  17. @agentId int = null
  18. )
  19. as
  20. declare @tranId as int,@encryptedControlNo as varchar(200)
  21. select @tranId=id from remitTran where controlNo=dbo.FNAEncryptString(@controlNo)
  22. set @encryptedControlNo=dbo.FNAEncryptString(@controlNo)
  23. if @flag = 'i'--inserted deposit slip in log
  24. begin
  25. --select dbo.FNADecryptString(controlNo),* from tranModifyLog order by rowid desc
  26. --select * from remitTran
  27. --select dbo.FNADecryptString(controlNo),* from remitTran WHERE tranStatus='paid'
  28. INSERT INTO tranModifyLog(
  29. tranId,controlNo,message,
  30. createdBy,createdDate,fileType
  31. )
  32. VALUES
  33. (
  34. @tranId,@encryptedControlNo,@fileDesc,@createdBy,GETDATE(),@fileType
  35. )
  36. set @rowId = SCOPE_IDENTITY()
  37. end
  38. else if @flag = 'd'
  39. begin
  40. delete from tranModifyLog where rowId=@rowId
  41. end
  42. else if @flag='a'--checking multiple deposit slip upload
  43. begin
  44. if exists(select 'X' from tranModifyLog
  45. where (tranId=@tranId OR controlNo=@encryptedControlNo) AND fileType IS NOT NULL)
  46. begin
  47. select '1' msg
  48. end
  49. else
  50. begin
  51. select '0' msg
  52. end
  53. end
  54. ELSE IF @flag='s'--search txn for upload deposit slip(ADMIN PANEL)
  55. BEGIN
  56. SELECT id,pAgent,pAgentName FROM remitTran
  57. WHERE controlNo=@encryptedControlNo and paymentMethod='Bank Deposit' and tranStatus='Paid'
  58. END
  59. ELSE IF @flag='s1'--search txn for upload deposit slip (AGENT PANEL)
  60. BEGIN
  61. SELECT id,pAgent,pAgentName FROM remitTran
  62. WHERE controlNo=@encryptedControlNo and paymentMethod='Bank Deposit' and tranStatus='Paid'
  63. AND pBranch=@agentId
  64. END
  65. GO