Guest User

Untitled

a guest
Sep 7th, 2016
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.90 KB | None | 0 0
  1. https://portal.systemadmin.com/csa_agent_week.asp?testid=51722&date_from=7/1/2015&date_to=7/9/2016&Submit=Submit
  2. please add a table like this http://prntscr.com/byt2ri to the bottom of this page
  3. table title: Rebill Commissions Status
  4. have 4 weeks worth of data on it like in the example table with options to change date range
  5. have the following columns:
  6. Date | Queue | CustomerID | Rebill Date | Rebill Status | Commission
  7.  
  8. For rebill date you will be displaying the first bill date
  9. for rebill status you will be displaying the status of the first bill
  10. for commission display the $ of commission they made from it
  11. in general here you need to display every customer that the agent sold and can potentially be eligible to earn rebill commissions
  12.  
  13.  
  14. User: Task
  15. Date: 8/3/2016 4:04:46 PM
  16. Status: Comments Added
  17. User: ETsoi
  18. Date: 8/11/2016 5:44:28 PM
  19. Status: In progress
  20. User: ETsoi
  21. Date: 8/30/2016 5:06:40 PM
  22. Status: Done
  23. ASP:
  24. portal.systemadmin.com\csa_agent_week.asp
  25.  
  26. SQL:
  27. ccp.dbo.ccf_calls_agent_total_get
  28. ccp.dbo.callcenterreport_agent_weeks_get_forRebill
  29. User: Task
  30. Date: 8/31/2016 10:13:07 AM
  31. Status: Comments Added
  32.  
  33. <Last Edited: 9/6/2016 10:26:04 AM by Task>
  34. Please update the query to this:
  35.  
  36. select distinct
  37. cus.email
  38. ,cus.contactFname
  39. ,cus.contactLname
  40. ,addr_bill.phone
  41. ,p.insertDT
  42. --,p.dn_cardtoken
  43. ,case when authmessage like '%insufficient%' or authmessage like '%floor%' then 'Card Declined - Insufficient Funds'
  44. when authmessage like '%stolen%'
  45. or authmessage like '%processor decline%'
  46. or authmessage like '%restraint%'
  47. or authmessage like '%fraud%'
  48. or authmessage like '%accterror%' then 'Bad Card'
  49. when authmessage like '%donothonor%'
  50. or authmessage like '%do not honor%'
  51. or authmessage like '%denied%' then 'Card Declined - check personal information'
  52. when authmessage like '%expired%' then 'Card Declined - Card expired'
  53. when isapproved = 0 then 'Card Declined'
  54. else '-' end as 'Decline Reason'
  55. ,case when p.isapproved = 1 and ord.dn_status not in (59,74,79) then '$20'
  56. when ord.dn_status = 74 then '-$20' else '$0' end as 'Payment_due'
  57. ,case when item.number like '%M' then 'Rebill'
  58. when item.number like '%MT%' and dateadd(wk, datediff(wk, 0, p.insertDT), 0) = dateadd(wk, datediff(wk, 0, ord.insertDT), 0) then 'New First Bill' else 'Old First Bill'
  59. end as Rebill_status
  60. --,er.cnt
  61. --into #NoShow
  62. --into #noshow2
  63. from om_key..bo_orders ord (nolock)
  64. left join om_key..bo_customers cus (nolock) on cus.id = ord.bo_customersid
  65. left join om_key..bo_address addr_bill (nolock) on addr_bill.bo_Addressgroupid = ord.bo_addressgroupid and addr_bill.type = 0
  66. left join om_key..bo_orderdetails det (nolock) on det.bo_ordersid = ord.id
  67. left join om_key..bo_items item (nolock) on item.id = det.bo_itemsid
  68. left join om_key..bo_payment p (nolock) on /*p.bo_ordersID = ord.id--*/p.id = (select max(id) FROM om_key..bo_payment (nolock) WHERE bo_ordersID = ord.id and insertDT between '8-21-2016 00:00' and '8-27-2016 23:59')
  69. --left join (select bo_ordersID, count(id) as cnt from om_key..bo_payment (nolock) where isduplicate = 0 and insertDT < '8-20-2016 23:59' group by bo_ordersID ) er on er.bo_ordersID = ord.id
  70. where p.insertDT between '8-21-2016 00:00' and '8-27-2016 23:59'
  71. and item.id in (2575,2576,2573,2572)
  72. and email not in (select email from #NoShow where payment_due != '$20')
  73. and email in (select email from #noshow2 where payment_due = '$20')
  74. order by 7 desc, 1 asc
  75.  
  76.  
  77.  
  78. STEP 1:
  79. Run query for 2 weeks ago
  80. insert into a new table with these exact columns
  81.  
  82. STEP 2:
  83. Run query for last week
  84. -exclude every customer who we didn't collect from last week and 2 weeks ago either
  85.  
  86. NOTES:
  87. -make sure to edit the payment date on the payment join and the where clause as well
  88. -make sure to not exclude customers who declined 2 weeks ago but approved last week
  89. for step 1 you can create a reconcile table in our system
  90. and just query against that
  91. so we don't have to make this 2 steps
Add Comment
Please, Sign In to add comment