Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Calculating business hours Post Reply Post New Topic
Author Message
pollolly
Newbie
Newbie


Joined: 06 Aug 2012
Location: Australia
Online Status: Offline
Posts: 1
Quote pollolly Replybullet Topic: Calculating business hours
     Posted: 06 Aug 2012 at 7:28pm
Hi All
 
I have the formula below which allows me to calculate the business hours elapsed between the "occurred date" and the "solved date" on a ticket/ job.
 
I also want to calculate and display the business hours elapsed if the ticket / job are still open. How can I incorporate this into my existing formula....?
++++++++++++++++++++++++++++++++++++
Global TimeVar SLAHoursStart := CTime("08:00:00");
Global TimeVar SLAHoursEnd := CTime("18:00:00");
Global DateTimeVar DateLogged := {@Occurred On};
Global DateTimeVar DateSolved := {@Solved On};
Global NumberVar HoursOnStartDay;
Global NumberVar HoursOnEndDay;
Global NumberVar HoursOnToday;
Global NumberVar TotalHours;
Global NumberVar MinSat := DateDiff ("ww", DateLogged, DateSolved, crSaturday);
Global NumberVar MinSun := DateDiff ("ww", DateLogged, DateSolved, crSunday);
Global NumberVar RemDays;
Global NumberVar TotalBusDaysBetween2 := DateDiff("d",DateLogged,DateSolved);
Global NumberVar TotalBusDaysBetween := (TotalBusDaysBetween2 - (MinSat+MinSun))+1;

Global TimeVar TimeLogged := CTime({@Occurred On});
Global TimeVar TimeSolved := CTime({@Solved On});
TotalHours := DateDiff ("h",DateLogged,DateSolved);
HoursOnStartDay := (SLAHoursEnd - TimeLogged) / 3600; //Divide by 3600 to convert seconds to hours
HoursOnEndDay := (TimeSolved - SLAHoursStart) / 3600; //Divide by 3600 to convert seconds to hours
HoursOnToday := (CURRENTTIME - SLAHoursStart) / 3600; //Divide by 3600 to convert seconds to hours
 
If (cDate(DateLogged) - cDate(DateSolved)) = 0 Then
    (TimeSolved - TimeLogged) / 3600
Else If (cDate(DateLogged) - cDate(DateSolved)) = 1 Then
    HoursOnStartDay + HoursOnEndday
Else
    ((TotalBusDaysBetween * 10) - 20) + HoursOnStartDay + HoursOnEndday;

++++++++++++++++++++++++++++++++++++
 
Any advice greatly appreciated. :)
 
Regards
 
Paula
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum