private async Task <Report> CreateReport(int year, int month)
        {
            Report report = new Report(year, month);
            IEnumerable <Department> activeDeps = await _departmentRepository.GetActiveAsync();

            foreach (var dep in activeDeps)
            {
                var depblock = new DepartmentReportBlock(dep.Name);
                IEnumerable <Employee> emps = await _employeeRepository.FindAllByDepartmentAsync(dep.Id);

                foreach (var emp in emps)
                {
                    var empBlock = new EmployeeReportBlock()
                    {
                        Name = emp.Name,
                        Inn  = emp.Inn
                    };
                    empBlock.BuhCode = await EmpCodeResolver.GetCode(emp.Inn);

                    empBlock.Salary = EmpSalaryService.Salary(empBlock);
                    depblock.AddEmployee(empBlock);
                }
                report.AddDepartmentBlocks(depblock);
            }
            return(report);
        }
Exemple #2
0
 public void AddDepartmentBlocks(DepartmentReportBlock block)
 {
     if (block == null)
     {
         return;
     }
     DepartmentBlocks.Add(block);
 }
Exemple #3
0
 private void ExportBlock(DepartmentReportBlock block)
 {
     _sb.AppendLine("");
     _sb.AppendLine("==================================");
     _sb.AppendLine(block.Name);
     block.Employees.All(e =>
     {
         ExportBlock(e);
         return(true);
     });
     _sb.AppendLine($"Всего по отделу {block.Sum}р");
 }