Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. select
  2.  
  3. CASE
  4. WHEN status IN ('OPEN','ACTIVE') then '1open'
  5. WHEN status IN ('SUBMITTED','IN_VALIDATION') or (statusid IN (14,15,30) and scoringmodel is null) then '11inprocess'
  6. WHEN statusid IN (21,27) THEN '2autoreject'
  7. WHEN statusid IN (24,25,26,28) THEN '3premodelreject'
  8. WHEN statusid IN (23) THEN '4modelreject'
  9. WHEN statusid IN (29) THEN '5cbreject'
  10. WHEN scoringmodel is not null and status IN ('REVIEW','REVIEW_DOCUMENTS','MISSING_DOCUMENTS','ACCEPTED','ACCEPTED_LIMIT','WAITING_PAYOUT','PRECONFIRMED') THEN '6acceptedWaiting'
  11. WHEN scoringmodel is not null and status IN ('CANCELLED','TIMED_OUT') THEN '66acceptedLost'
  12. WHEN status IN ('CONFIRMED','DUE','REPAID','REPAID_PENDING','SETTLED','DUE','FACTORING','FACTORING_PENDING','COLLECTION','COURT','DEFAULT') or status like '%OVERDUE%' THEN '7paidout'
  13. ELSE status||statusid END as workflowPoint,
  14. count(id),client
  15.  
  16. from application
  17. where date(createdat) >= date(current_Timestamp - interval '1 days') and (firstapplication=true or status='REJECT')
  18. group by client,workflowPoint
  19. order by client,workflowPoint
  20.  
  21. -- high level dashboard (share with marketing and rest of company)
  22. -- total number of leads (11+2+3+4+5+6+66+7)
  23. -- acceptance ratio = (6+66+7) / (3+4+5+6+7)
  24. -- loss after acceptance ratio = 66/(6+66+7)
  25. -- Payout rate = paidout/num applications accepted = 7/(6+66+7)
  26.  
  27.  
  28. -- operational dashboard (internal) global
  29. -- split of cases in 2,3,4,5,6,66,7 (full workflow) as ratios over (2+3+4+5+6+66+7)
  30.  
  31. -- operational dashboard (internal) reject reasons
  32. -- split of cases per statusid (21,22,23,24,25,26,27,28,29), out of all rejects
  33.  
  34. -- operational dashboard (internal) stuck applications
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement