how to determine total hours

Discussion for TimeTrex open source community developers.
Post Reply
joshsard
Posts: 55
Joined: Sun Feb 14, 2016 6:09 pm

how to determine total hours

Post by joshsard »

hi again :)

just a simple question, below is a screenshot of a sample weekly sched:
weekly_sched.JPG
how do i "get" the "total" number of hours scheduled for all of the dates shown in this current week?
i look at the codes particularly ScheduleFactory.php and ScheduleViewController.js,
but it seems like I could only get the start/end/total time per singular day (the one I'm editing or adding via New button)

any help would greatly be appreciated
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Re: how to determine total hours

Post by shaunw »

That is correct, you will need to add up the total time for each day in the period that you want a total for.
joshsard
Posts: 55
Joined: Sun Feb 14, 2016 6:09 pm

Re: how to determine total hours

Post by joshsard »

yeah, but i cant seem to find in the code where it cycles through all the days shown currently, and if its has a schedule (cell with value) or not (blank cell). i'm wishing you could help me in at least where it does this, thank you so much
joshsard
Posts: 55
Joined: Sun Feb 14, 2016 6:09 pm

Re: how to determine total hours

Post by joshsard »

i found something in the javascript file ScheduleViewController.js, when I do this
alert("week start: " + this.start_date.format());
alert("week end: " + this.end_date.format());

i get the monday and sunday date (start and end of the shown row),
but i would like these values to be acquired through the php class file,
particularly in ScheduleFactory.class.php inside the Validate function, how do I that?

i will use those dates to call the method "getByUserIdAndStartDateAndEndDate" of ScheduleListFactory to count the # of records, so i could get each scheduled day, then maybe each total hour and calculate the grand total hour
Post Reply