Commit f937eb1a authored by Michael Rouse's avatar Michael Rouse

Added total hours to the result of a report.

parent e168a515
......@@ -194,6 +194,7 @@ static void perform_report_action(args_t args)
printf("\t%s: %0.2f\n", report->Entries[i].Date, report->Entries[i].Hours);
}
printf("\nTotal Hours: %0.2f\n", report->TotalHours);
printf("\n");
TimeSlime_FreeReport(&report);
}
......
......@@ -262,11 +262,13 @@ TIMESLIME_STATUS_t TimeSlime_GetReport(TIMESLIME_DATE_t start, TIMESLIME_DATE_t
if (report == NULL)
return TIMESLIME_UNKOWN_ERROR;
report->TotalHours = 0;
report->NumberOfEntries = number_of_results;
for (i = 0; i < number_of_results; i++)
{
// Build report entries
report->Entries[i].Hours = database_results[i]->TotalHours;
report->TotalHours += report->Entries[i].Hours;
strcpy(report->Entries[i].Date, database_results[i]->TimeSheetDate);
}
......
......@@ -81,6 +81,7 @@ typedef struct TIMESLIME_REPORT_ENTRY_STRUCT TIMESLIME_REPORT_ENTRY_t;
struct TIMESLIME_REPORT_STRUCT
{
int NumberOfEntries;
float TotalHours;
TIMESLIME_REPORT_ENTRY_t Entries[];
};
typedef struct TIMESLIME_REPORT_STRUCT TIMESLIME_REPORT_t;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment