Advertisement
Guest User

Untitled

a guest
Nov 17th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dim PurchaseDate = Loan.Fields("3567").Value
  2. Dim firstPmtDate = Loan.Fields("3570").Value
  3. Dim endDate As Date
  4. Dim beginDate As Date
  5. Dim beginDay = Day(beginDate)
  6. Dim endDay = Day(endDate)
  7.  
  8. 'Find the endDate & beginDate from PurchaseDate
  9. If Day(PurchaseDate) < 14 Then
  10.     endDate = firstPmtDate
  11.     beginDate = PurchaseDate
  12. Else
  13.     endDate = Month(DateAdd("m", -1, firstPmtDate)) & "/" & "01" & "/" & Year(DateAdd("m", -1, firstPmtDate))
  14.     beginDate = PurchaseDate
  15. End If
  16.  
  17. 'Set endDay = 30 if beginDate and endDate are the last day of February
  18. If Month(beginDate) = 2 And (beginDay = 28 Or beginDay = 29) And Month(endDate) = 2 And (endDay = 28 Or endDay = 29) Then
  19.     endDay = 30
  20. End If
  21.  
  22. 'Set beginDay = 30 if endDate is last day of February and beginDate is on the 31st
  23. If beginDay = 31 And Month(endDate) = 2 And (endDay = 28 Or endDay = 29) Then
  24.     beginDay = 30
  25. End If
  26.  
  27. 'Set endDay = 30 if beginDate is on the 30th and endDate is on the 31st
  28. If beginDay = 30 And endDay = 31 Then
  29.     endDay = 30
  30. End If
  31.  
  32. 'Calc to find the # of Interest Accrued Days(3581)
  33. Dim days = ((Year(endDate) - Year(beginDate)) * 360 + (Month(endDate) - Month(beginDate)) * 30 + (endDay - beginDay)) * -1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement