Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CalcularDiasColombia {
- public class BusinessDays{
- public BusinessHours bHours;
- public BusinessDays(String businessHoursName){
- bHours = [SELECT Id FROM BusinessHours WHERE Name =: businessHoursName];
- }
- public BusinessDays(){
- bHours = [SELECT Id FROM BusinessHours WHERE IsDefault = true];
- }
- public Datetime addDays(Datetime startDate, Integer days){
- BusinessDays bd = new BusinessDays('BusinessHours');
- bd.addDays (Date.today (), 3);
- startDate = BusinessHours.nextStartDate(bHours.Id, startDate);
- for (Integer elapsed = 0; elapsed < days; elapsed++){
- startDate = startDate.addDays(1);
- if (!BusinessHours.isWithin(bHours.Id, startDate)){
- startDate = BusinessHours.nextStartDate(bHours.Id, startDate);
- }
- }
- return startDate;
- }
- }
- }
- @isTest
- public class CaluclarDiasColombiaTest {
- /*Test.startTest();
- Test.stopTest();*/
- //System.assertEquals();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement