Beispiel #1
0
        public async Task <byte[]> GetAsync(BillingAgingListSearch option, CancellationToken token = default(CancellationToken))
        {
            var companyTask = companyQueryProcessor.GetAsync(new CompanySearch {
                Id = option.CompanyId,
            }, token);
            var columnTask = columnNameSettingQueryProcessor.GetAsync(new ColumnNameSetting {
                CompanyId  = option.CompanyId,
                TableName  = nameof(Billing),
                ColumnName = nameof(Billing.Note1),
            }, token);
            var loadTask = billingAgingListQueryProcessor.GetDetailsAsync(option, token);

            await Task.WhenAll(companyTask, columnTask, loadTask);

            var items = loadTask.Result.ToList();

            if (!items.Any())
            {
                return(null);
            }

            var company = companyTask.Result.First();
            var column  = columnTask.Result.First();
            var title   = $"請求残高年齢表(明細){ DateTime.Today:yyyyMMdd}";

            var report = new BillingAgingListDetailSectionReport();

            report.SetBasicPageSetting(company.Code, company.Name);
            report.Name = title;
            report.SetData(items, option.Precision, column);

            report.Run();

            return(report.Convert());
        }
Beispiel #2
0
        private void PrintBillingAgingDetail()
        {
            try
            {
                var source = grdBillingAgingDetail.DataSource as BindingSource;
                var list   = source?.DataSource as List <BillingAgingListDetail> ?? new List <BillingAgingListDetail>();

                if (!list.Any())
                {
                    ShowWarningDialog(MsgWngPrintDataNotExist);
                    return;
                }
                BillingAgingListDetailSectionReport report = null;
                var serverPath = string.Empty;
                var task       = Task.Run(async() =>
                {
                    serverPath = await GetServerPathAsync();
                    if (!Directory.Exists(serverPath))
                    {
                        serverPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                    }

                    report    = new BillingAgingListDetailSectionReport();
                    var title = $"請求残高年齢表(明細){ DateTime.Today:yyyyMMdd}";
                    report.SetBasicPageSetting(Login.CompanyCode, Login.CompanyName);
                    report.Name = title;
                    report.SetData(list, Precision, BillingNote1ColumnNameSetting);

                    var searchReport = new SearchConditionSectionReport();
                    searchReport.SetBasicPageSetting(Login.CompanyCode, Login.CompanyName, "請求残高年齢表(明細)");
                    searchReport.Name = title;
                    searchReport.SetPageDataSetting(ReportCondition);

                    report.Run(false);
                    searchReport.SetPageNumber(report.Document.Pages.Count);
                    searchReport.Run(false);

                    report.Document.Pages.AddRange((GrapeCity.ActiveReports.Document.Section.PagesCollection)searchReport.Document.Pages.Clone());
                });

                ProgressDialog.Start(ParentForm, task, false, SessionKey);

                ShowDialogPreview(ParentForm, report, serverPath);
            }
            catch (Exception ex)
            {
                Debug.Fail(ex.ToString());
                NLogHandler.WriteErrorLog(this, ex, SessionKey);
                ShowWarningDialog(MsgErrCreateReportError);
            }
        }