Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim PurchaseDate = Loan.Fields("3567").Value
- Dim firstPmtDate = Loan.Fields("3570").Value
- Dim endDate As Date
- Dim beginDate As Date
- Dim beginDay = Day(beginDate)
- Dim endDay = Day(endDate)
- 'Find the endDate & beginDate from PurchaseDate
- If Day(PurchaseDate) < 14 Then
- endDate = firstPmtDate
- beginDate = PurchaseDate
- Else
- endDate = Month(DateAdd("m", -1, firstPmtDate)) & "/" & "01" & "/" & Year(DateAdd("m", -1, firstPmtDate))
- beginDate = PurchaseDate
- End If
- 'Set endDay = 30 if beginDate and endDate are the last day of February
- If Month(beginDate) = 2 And (beginDay = 28 Or beginDay = 29) And Month(endDate) = 2 And (endDay = 28 Or endDay = 29) Then
- endDay = 30
- End If
- 'Set beginDay = 30 if endDate is last day of February and beginDate is on the 31st
- If beginDay = 31 And Month(endDate) = 2 And (endDay = 28 Or endDay = 29) Then
- beginDay = 30
- End If
- 'Set endDay = 30 if beginDate is on the 30th and endDate is on the 31st
- If beginDay = 30 And endDay = 31 Then
- endDay = 30
- End If
- 'Calc to find the # of Interest Accrued Days(3581)
- 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