private async Task <ExcelReport <DetailedExpenseForJobReportCriteria> > GetExpenseBreakDownReportCriteria(bool isCurrentUserAdmin)
        {
            var vm = new DetailedExpenseForJobReportCriteria();

            vm.AvailableJobs = (await jobService.GetAsync()).OrderBy(x => x.FullJobCodeWithName).ToList();
            var rpt = new ExcelReport <DetailedExpenseForJobReportCriteria>(DetailedExpenseForJobReportCriteria.DETAILED_EXPENSE_REPORT_NAME, vm, isCurrentUserAdmin);

            return(rpt);
        }
        public async Task <ReportDTO <DetailedExpenseForJobReportDTO> > RunAsync(DetailedExpenseForJobReportCriteria settings)
        {
            try
            {
                var data = new DetailedExpenseForJobReportDTO();
                data.ArcFlashLabel = await LoadSection(GetArcFlashLabelExpenseQuery, MapToArcFlashlabelSection, int.Parse(settings.SelectedJobId));

                data.CompanyVehicle = await LoadSection(GetCompanyVehicleExpenseQuery, MapToCompanyVehicleSectionRow, int.Parse(settings.SelectedJobId));

                data.SubContractor = await LoadSection(GetContractorExpenseQuery, MapToSubContractorSectionRow, int.Parse(settings.SelectedJobId));

                data.TimeAndExpense = await LoadSection(GetTimeAndExpenseQuery, MapToTimeAndExposeSectionRow, int.Parse(settings.SelectedJobId));

                data.Misc = await LoadSection(GetMiscExpenseQuery, MapToMiscSectionRow, int.Parse(settings.SelectedJobId));

                data.PeriodStart = new DateTime(2021, 1, 1, 10, 0, 0, DateTimeKind.Local);
                data.PeriodEnd   = DateTimeWithZone.EasternStandardTime;

                var j = await jobsRepository.GetForJobId(int.Parse(settings.SelectedJobId));

                data.JobCode    = j.CoreInfo.JobCode;
                data.JobName    = j.CoreInfo.JobName;
                data.SiteName   = j.Site.SiteName;
                data.ClientName = j.Client.ClientName;

                return(new ReportDTO <DetailedExpenseForJobReportDTO>()
                {
                    Data = data,
                    ReportName = "Detailed Expense Report",
                    RunSettings = new Dictionary <string, string>()
                    {
                        { "Generated", $"{DateTimeWithZone.EasternStandardTime.ToShortDateString()} at {DateTimeWithZone.EasternStandardTime.ToShortTimeString()}" },
                        { "Company", $"Orion Engineering Co., Inc." },
                    }
                });
            }
            catch (Exception e)
            {
                _logger.Error(e, "error creating report");
                throw;
            }
        }
예제 #3
0
 public async Task <ReportDTO <DetailedExpenseForJobReportDTO> > CreateDetailedExpenseReport(DetailedExpenseForJobReportCriteria criteria)
 {
     return(await detailedExpenseForJobReportQuery.RunAsync(criteria));
 }