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); } }
public DailyReportModel GetDaily(ReportParameter param) { _depts = new List <Department>(); _banks = new List <Bank>(); _checks = new List <Check>(); QueryChecksBasedOnInputParameter(param); DailyReportModel reportModel = new DailyReportModel(); reportModel.CheckFlag = param.CheckFlag; reportModel.Day = param.Day; reportModel.DateGenerated = DateTime.Now; CreateSectionsPerDepartment(reportModel); return(reportModel); }
public DepartmentSection(DailyReportModel parentReport) { _parentReport = parentReport; BankSections = new List <BankSection>(); }