public async Task <byte[]> GetAsync(CustomerFeeSearch option, CancellationToken token = default(CancellationToken)) { var companyTask = companyQueryProcessor.GetAsync(new CompanySearch { Id = option.CompanyId, }, token); var appControlTask = applicationControlGetByCompanyQueryProcessor.GetAsync(option.CompanyId.Value, token); var masterLoadTask = customerFeeQueryProcessor.GetAsync(option, token); await Task.WhenAll(companyTask, appControlTask, masterLoadTask); var company = companyTask.Result.First(); var appCon = appControlTask.Result; var items = masterLoadTask.Result.ToList(); var precision = appCon.UseForeignCurrency == 0 ? 0 : items.Max(x => x.CurrencyPrecision); if (!items.Any()) { return(null); } var report = new CustomerFeeSectionReport(); report.Name = "登録手数料一覧" + DateTime.Now.ToString("yyyyMMdd"); report.SetBasicPageSetting(company.Code, company.Name); report.SetData(items, appCon.UseForeignCurrency); report.Precision = precision; report.Run(); return(report.Convert()); }
private void PrintCustomerMaster() { ZeroLeftPaddingWithoutValidated(); if (!RequiredCheck()) { return; } CustomerSearch customerSearch = CreateSearchCondition(); ClearStatusMessage(); Task task = null; GrapeCity.ActiveReports.SectionReport report = null; string serverPath = null; if (rdoCustomerMasterList.Checked) { task = ServiceProxyFactory.LifeTime(async factory => { serverPath = await GetServerPath(); var service = factory.Create <CustomerMasterClient>(); CustomersResult result = await service.GetItemsAsync(SessionKey, CompanyId, customerSearch); if (result.ProcessResult.Result) { var customerList = new List <Customer>(result.Customers); if (customerList.Any()) { var cusReport = new CustomerSectionReport(); cusReport.SetBasicPageSetting(Login.CompanyCode, Login.CompanyName); cusReport.Name = "得意先マスター一覧" + DateTime.Today.ToString("yyyyMMdd"); cusReport.SetData(customerList); cusReport.Run(false); report = cusReport; } } }); } else if (rdoCustomerLedger.Checked) { ClearStatusMessage(); task = ServiceProxyFactory.LifeTime(async factory => { serverPath = await GetServerPath(); var service = factory.Create <CustomerMasterClient>(); CustomersResult result = await service.GetItemsAsync(SessionKey, CompanyId, customerSearch); if (result.ProcessResult.Result) { var ledgerList = new List <Customer>(result.Customers); if (ledgerList.Any()) { var cusAccReport = new CustomerAccountSectionReport(); cusAccReport.SetBasicPageSetting(Login.CompanyCode, Login.CompanyName); cusAccReport.Name = "得意先台帳" + DateTime.Now.ToString("yyyyMMdd"); cusAccReport.SetData(ledgerList, UsePublishInvoice, UseReminder); cusAccReport.Run(false); report = cusAccReport; } } }); } else { ClearStatusMessage(); task = ServiceProxyFactory.LifeTime(async factory => { serverPath = await GetServerPath(); var service = factory.Create <CustomerFeeMasterClient>(); CustomerFeesResult result = await service.GetForPrintAsync(SessionKey, CompanyId); if (result.ProcessResult.Result) { var cusFeeList = new List <CustomerFee>(result.CustomerFeePrint); int precision = 0; if (UseForeignCurrency) { precision = cusFeeList.Select(x => x.CurrencyPrecision).Max(); } if (cusFeeList.Any()) { CustomerFeeSectionReport cusFeeReport = new CustomerFeeSectionReport(); cusFeeReport.SetBasicPageSetting(Login.CompanyCode, Login.CompanyName); cusFeeReport.Name = "登録手数料一覧" + DateTime.Now.ToString("yyyyMMdd"); cusFeeReport.Precision = precision; cusFeeReport.SetData(cusFeeList, ApplicationControl.UseForeignCurrency); cusFeeReport.Run(false); report = cusFeeReport; } } }); } if (task != null) { ProgressDialog.Start(ParentForm, Task.Run(() => task), false, SessionKey); if (report == null) { ShowWarningDialog(MsgWngPrintDataNotExist); return; } ShowDialogPreview(ParentForm, report, serverPath); } }