Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public override async Task<DialogTurnResult> BeginDialogAsync(DialogContext dc,
{
employee.NormalizeAppointments(dc);
var nextUnavailability = EmployeesHelper.GetNextUnavailability(employee, date, out var freeDays);
int billableDays = EmployeesHelper.GetTotalBilledDays(employee.Projects, out var billableHours);
int billableDays = EmployeesHelper.GetBilledDays(employee, employee.Projects.FirstOrDefault(), out var billableHours);
return new FreeEmployeeModel
{
FirstName = employee.FirstName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static List<EmployeeBillableItemModel> GetBillableEmployees(
foreach (var employeeProject in employeeProjects)
{
double billableHours = employeeProject.BillableHours;
int billedDays = GetBilledDays(billableHours);
int billedDays = GetBilledDays(e, employeeProject, out billableHours);
billedProjects.Add(new BilledProject
{
BilledDays = billedDays,
Expand Down Expand Up @@ -174,28 +174,44 @@ public static BookingStatus GetBookingStatus(GetEmployeeModel employee, DateTime
return BookingStatus.Unknown;
}

public static int GetBilledDays(double billableHours)
{
const int HOURS_PER_DAY = 8;

return (int)Math.Ceiling(billableHours / HOURS_PER_DAY);
}

public static int GetTotalBilledDays(List<GetEmployeeProjectModel> Projects, out double billableHours)
{
billableHours = 0;

if (Projects == null || !Projects.Any())
{
return 0;
}

foreach (var project in Projects)
{
billableHours += project.BillableHours;
}

return GetBilledDays(billableHours);
// public static int GetBilledDays(double billableHours)
// {
// const int HOURS_PER_DAY = 8;
//
// return (int)Math.Ceiling(billableHours / HOURS_PER_DAY);
// }
//
// public static int GetTotalBilledDays(List<GetEmployeeProjectModel> Projects, out double billableHours)
// {
// billableHours = 0;
//
// if (Projects == null || !Projects.Any())
// {
// return 0;
// }
//
// foreach (var project in Projects)
// {
// billableHours += project.BillableHours;
// }
//
// return GetBilledDays(billableHours);
// }

public static int GetBilledDays(GetEmployeeModel employee, GetEmployeeProjectModel project, out double billableHours)
{


if (project != null && project.CustomerName != "SSW")
{
billableHours = project?.BillableHours ?? 0;
}
else {
billableHours = 0;
}


return billableHours == 0 ? 0 : (int)Math.Ceiling(billableHours / 8);
}

public static int GetBookedDays(GetEmployeeModel employee, DateTime startDate)
Expand Down