private void AddSplitRateEntries(ref int entryIndex, Timesheet timesheet, InvoiceConfiguration invoiceConfiguration)
        {
            if (!timesheet.IsSplitRate())
            {
                MessageBox.Show("InvoiceGenerator.AddSplitRateEntries(...) encountered a problem; parameter 'timesheet' must be a 'split rate' Timesheet (e.g Timesheet.IsSplitRate() == true).");
                return;
            }

            decimal ratePerHour   = 0;
            decimal billableHours = 0;

            IEnumerable <TimesheetDate> timesheetDates = timesheet.Dates.Where(p => p.IsValidDate);

            foreach (TimesheetDate timesheetDate in timesheetDates)
            {
                if (ratePerHour == 0)
                {
                    ratePerHour    = timesheetDate.RatePerHour;
                    billableHours += timesheetDate.BillableHours;
                }
                else if (timesheetDate.RatePerHour != ratePerHour)
                {
                    // Add Entries...
                    AddEntry(++entryIndex, billableHours, ratePerHour, timesheet.WeekNumber, timesheet.StartDate.Date, timesheet.EndDate.Date, invoiceConfiguration, true);

                    // Reset our counters...
                    ratePerHour   = timesheetDate.RatePerHour;
                    billableHours = timesheetDate.BillableHours;
                }
                else
                {
                    // Roll up totals...
                    billableHours += timesheetDate.BillableHours;
                }
            }

            // Get the last entry...
            if (timesheetDates != null)
            {
                AddEntry(++entryIndex, billableHours, ratePerHour, timesheet.WeekNumber, timesheet.StartDate.Date, timesheet.EndDate.Date, invoiceConfiguration, true);
            }
        }
        private void AddSplitRateEntries(ref int entryIndex, Timesheet timesheet, InvoiceConfiguration invoiceConfiguration)
        {
            if (!timesheet.IsSplitRate()) {
                MessageBox.Show("InvoiceGenerator.AddSplitRateEntries(...) encountered a problem; parameter 'timesheet' must be a 'split rate' Timesheet (e.g Timesheet.IsSplitRate() == true).");
                return;
            }

            decimal ratePerHour = 0;
            decimal billableHours = 0;

            IEnumerable<TimesheetDate> timesheetDates = timesheet.Dates.Where(p => p.IsValidDate);
            foreach (TimesheetDate timesheetDate in timesheetDates) {
                if (ratePerHour == 0) {
                    ratePerHour = timesheetDate.RatePerHour;
                    billableHours += timesheetDate.BillableHours;
                } else if (timesheetDate.RatePerHour != ratePerHour) {
                    // Add Entries...
                    AddEntry(++entryIndex, billableHours, ratePerHour, timesheet.WeekNumber, timesheet.StartDate.Date, timesheet.EndDate.Date, invoiceConfiguration, true);

                    // Reset our counters...
                    ratePerHour = timesheetDate.RatePerHour;
                    billableHours = timesheetDate.BillableHours;
                } else {
                    // Roll up totals...
                    billableHours += timesheetDate.BillableHours;
                }
            }

            // Get the last entry...
            if (timesheetDates != null) {
                AddEntry(++entryIndex, billableHours, ratePerHour, timesheet.WeekNumber, timesheet.StartDate.Date, timesheet.EndDate.Date, invoiceConfiguration, true);
            }
        }