Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1.             Date effectiveStartDate =
  2.                 subscription.SBQQ__StartDate__c.day() == 1
  3.                 ? subscription.SBQQ__StartDate__c
  4.                 : subscription.SBQQ__StartDate__c.addMonths(1).toStartOfMonth();
  5.            
  6.             Integer monthsFromStart = effectiveStartDate.monthsBetween(Date.today());
  7.             Integer frequencyInMonths = PERIODIC_COMPENSATIONS.get(frequency);
  8.             Integer fullPeriods = monthsFromStart / frequencyInMonths;
  9.             // TO:DO think about better variable naming
  10.             Integer monthsToAdd = fullPeriods * frequencyInMonths;
  11.             // check if period is full/closed                        
  12.             if (Math.mod(monthsFromStart, frequencyInMonths) != 0) {
  13.                 monthsToAdd++;
  14.             }
  15.             payOutDate = effectiveStartDate.addMonths(monthsToAdd);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement