// Timesheet Totals ListView Members // -------------------------------------------------------------------------- #region Timesheet Totals ListView Members private void InsertTimesheetTotalsListViewItem() { ListViewItem totalListViewItem = CreateEmptyTimesheetTotalListViewItem(); totalListViewItem.SubItems[3].Text = m_monthlyTimesheets.GetBillableHours().ToString(); totalListViewItem.SubItems[4].Text = m_monthlyTimesheets.GetFormattedInvoiceAmount(); m_timesheetsListView.Items.Add(totalListViewItem); }
public void Recalculate() { MonthlyTimesheets monthlyTimesheets = this.MonthlyTimesheets; int executiveOrderCount = monthlyTimesheets.GetDayTypeCount(DayType.ExecutiveOrder); int flexDayCount = monthlyTimesheets.GetDayTypeCount(DayType.FlexDay); int halfDayCount = monthlyTimesheets.GetDayTypeCount(DayType.HalfDay); int NACount = monthlyTimesheets.GetDayTypeCount(DayType.NA); int otherCount = monthlyTimesheets.GetDayTypeCount(DayType.Other); int personalDayCount = monthlyTimesheets.GetDayTypeCount(DayType.PersonalDay); int sickDayCount = monthlyTimesheets.GetDayTypeCount(DayType.SickDay); int vacationDayCount = monthlyTimesheets.GetDayTypeCount(DayType.VacationDay); int workDayCount = monthlyTimesheets.GetDayTypeCount(DayType.WorkDay); int weekendCount = monthlyTimesheets.GetDayTypeCount(DayType.Weekend); // Real work days... int realWorkDayCount = monthlyTimesheets.GetWeekdayCount() - executiveOrderCount; m_realWorkDays.Text = realWorkDayCount.ToString(); // Work days... m_workDays.Text = workDayCount.ToString(); // Max billable hours decimal maxBillableHours = (realWorkDayCount * Configuration.Instance.MiscellaneousConfiguration.DefaultMaxBillableHoursPerWorkDay); m_maxBillableHours.Text = maxBillableHours.ToString(Constants.HoursFormatString); // Weekends... m_weekends.Text = weekendCount.ToString(); // Executive orders... m_executiveOrders.Text = executiveOrderCount.ToString(); // Flex days... m_flexDays.Text = flexDayCount.ToString(); // Vacation days... m_vacationDays.Text = vacationDayCount.ToString(); // Half days... m_halfDays.Text = halfDayCount.ToString(); // Sick days... m_sickDays.Text = sickDayCount.ToString(); // "Other" days... m_otherDays.Text = otherCount.ToString(); // N/A? // Billable hours... decimal billableHours = monthlyTimesheets.GetBillableHours(); m_billableHours.Text = billableHours.ToString(Constants.HoursFormatString); // Check... decimal hoursWorkedCheckDifference = (billableHours - maxBillableHours); m_hoursWorkedCheckDifference.Tag = hoursWorkedCheckDifference; m_hoursWorkedCheckDifference.Text = (hoursWorkedCheckDifference > 0.00m) ? "+" : ""; m_hoursWorkedCheckDifference.Text += hoursWorkedCheckDifference.ToString(); bool isOver = hoursWorkedCheckDifference > 0.00m; m_hoursWorkedCheckDifference.ForeColor = isOver ? Color.DarkRed : Color.DarkGreen; m_billableHoursCheckLabel.ForeColor = isOver ? Color.DarkRed : Color.DarkGreen; m_billableHoursCheckInformation.ForeColor = isOver ? Color.DarkRed : Color.DarkGreen; m_hoursWorkedCheckDifferenceLabel.ForeColor = isOver ? Color.DarkRed : Color.DarkGreen; m_billableHoursCheckPictureBox.BackColor = isOver ? Color.DarkRed : Color.DarkGreen; DoBillableHoursCheck(); }