Advertisement
Guest User

crif

a guest
Apr 15th, 2019
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 0.89 KB | None | 0 0
  1. def minDueDate
  2. def elements = ctx.debt.schedules[0].schedulePayments
  3. def curDate = new Date()
  4.  
  5. curDate = curDate.clearTime()
  6.  
  7. if (
  8.      (ctx.debt.dictValue1 == 9) ||
  9.      (ctx.debt.dictValue1 == 11) ||
  10.      (ctx.debt.dictValue1 == 12) ||
  11.      (ctx.debt.dictValue1 == 13) ||
  12.      (ctx.debt.dictValue1 == 14) ||
  13.      (ctx.debt.dictValue1 == 16) ) {
  14.     return 2
  15. }else if (ctx.debt.dictValue1 == 17) {
  16.     return 31
  17. }else {
  18.     for(item in elements) {
  19.        
  20.         if (curDate <= item.date){
  21.             if (minDueDate==null){minDueDate=item.date}
  22.            
  23.             if (minDueDate>item.date){
  24.                 minDueDate=item.date
  25.             }
  26.         }
  27.        
  28.     }
  29.    
  30.     if (curDate==minDueDate){
  31.         return 0
  32.     } else {
  33.         if((minDueDate-curDate)>5){
  34.             return 5
  35.         } else {
  36.             return (minDueDate-curDate)
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement