public WeekTotalForBank(DepartmentSection parentDepartment) : base(parentDepartment) { _parentDepartment = parentDepartment; Checks = new List <Check>(); IsTotalPerDay = false; }
private void AttachTotal(WeekReportModel report) { DailyReportModel day = report.DailyReports.FirstOrDefault(); DailyReportModel totalForDay = new DailyReportModel(report); foreach (var dept in day.SectionsPerDepartment) { var totalForDepartment = new DepartmentSection(totalForDay); totalForDepartment.Department = dept.Department; totalForDay.SectionsPerDepartment.Add(totalForDepartment); foreach (var bank in dept.BankSections) { if (bank.IsTotalPerDay) { var totalForBank = new DayTotal(totalForDepartment); totalForBank.Bank = new Bank() { Id = 0, BankName = "Sub Total" }; totalForDepartment.BankSections.Add(totalForBank); } else { var totalForBank = new WeekTotalForBank(totalForDepartment); totalForBank.Bank = bank.Bank; totalForDepartment.BankSections.Add(totalForBank); } } } report.DailyReports.Add(totalForDay); }
private void CreateSectionsPerDepartment(DailyReportModel reportModel) { foreach (var currentDept in _depts) { var deptSection = new DepartmentSection(reportModel); reportModel.SectionsPerDepartment.Add(deptSection); deptSection.Department = currentDept; var banksInDepartment = _banks.Where(b => b.Department.Id == currentDept.Id).ToList(); CreateSectionsPerBank(banksInDepartment, deptSection); } }
private void CreateSectionsPerBank(List <Bank> banksInDepartment, DepartmentSection deptSection) { foreach (var b in banksInDepartment) { var bankSection = new BankSection(deptSection); bankSection.Bank = b; bankSection.Checks = _checks.Where(c => c.Bank.Id == b.Id).ToList(); deptSection.BankSections.Add(bankSection); } //This will add total at the bottom. DayTotal total = new DayTotal(deptSection); total.Bank = new Bank() { Id = 0, BankName = "Total" }; deptSection.BankSections.Add(total); }
public BankSection(DepartmentSection parentDepartment) { _parentDepartment = parentDepartment; Checks = new List <Check>(); }