Esempio n. 1
0
        private void PrintReport()
        {
            ClearStatusMessage();

            if (!(ExtractAggregateData?.Any() ?? false))
            {
                return;
            }

            try
            {
                var report = new AccountTransferImportReport();
                var title  = "口座振替依頼データ作成";
                report.lblTitle.Text               = title;
                report.lblTransferResult.Text      = "出力可否";
                report.txtTransferResult.DataField = nameof(AccountTransferImportReport.ReportRow.CreateResult);
                report.Name = $"{title}_{DateTime.Today:yyyyMMdd_HHmmss}";
                IEnumerable <AccountTransferImportReport.ReportRow> printSource = null;
                ProgressDialog.Start(ParentForm, Task.Run(() =>
                {
                    printSource = ConvertToReportRow(ExtractAggregateData);
                }), false, SessionKey);

                report.SetBasicPageSetting(Company.Code, Company.Name);
                report.SetData(printSource);
                report.Run(false);

                ShowDialogPreview(ParentForm, report, OutputDirectory);
            }
            catch (Exception ex)
            {
                NLogHandler.WriteErrorLog(this, ex, SessionKey);
                ShowWarningDialog(MsgErrCreateReportError);
            }
        }
Esempio n. 2
0
        public async Task <byte[]> GetAsync(AccountTransferImportSource source, CancellationToken token = default(CancellationToken))
        {
            var importDataId = source.ImportDataId ?? 0;

            var importDataTask = importDataProcessor.GetAsync(importDataId, token: token);
            var companyTask    = companyGetByIdsQueryProcessor.GetByIdsAsync(new[] { source.CompanyId }, token);

            await Task.WhenAll(importDataTask, companyTask);

            var importData = importDataTask.Result;
            var company    = companyTask.Result.First();
            var sources    = importData.Details.Select(x => serializer.UnpackSingleObject(x.RecordItem)).ToArray();

            var reportSource = sources.Select(x => new AccountTransferImportReport.ReportRow
            {
                Billing              = x.Billings?.Single(b => b.Id == x.Billings.Min(y => y.Id)),
                TransferResultCode   = x.TransferResultCode,
                TransferAmount       = x.TransferAmount,
                TransferBankName     = x.TransferBankName,
                TransferBranchName   = x.TransferBranchName,
                TransferCustomerCode = x.TransferCustomerCode,
                TransferAccountName  = x.TransferAccountName,
            }).ToArray();

            if (!(reportSource?.Any() ?? false))
            {
                return(null);
            }

            var report = new AccountTransferImportReport()
            {
                Name = $"口座振替結果データ一覧_{DateTime.Now:yyyyMMdd_HHmmss}"
            };

            // 帳票生成
            report.SetBasicPageSetting(company.Code, company.Name);
            report.SetData(reportSource);
            report.Run();

            return(report.Convert());
        }
Esempio n. 3
0
        private void RePrintReport()
        {
            ClearStatusMessage();

            var ids = GetSelectedLogIds();

            if (!ids.Any())
            {
                grid.Focus();
                ShowWarningDialog(MsgWngSelectionRequired, "再印刷を行う履歴");
                return;
            }

            try
            {
                var report = new AccountTransferImportReport();
                var title  = "口座振替依頼データ作成";
                report.lblTitle.Text               = title;
                report.lblTransferResult.Text      = "出力可否";
                report.txtTransferResult.DataField = nameof(AccountTransferImportReport.ReportRow.CreateResult);
                report.Name = $"{title}_{DateTime.Today:yyyyMMdd_HHmmss}";
                IEnumerable <AccountTransferImportReport.ReportRow> printSource = null;
                ProgressDialog.Start(ParentForm, Task.Run(() =>
                {
                    var getTask = GetAccountTransferDetailAsync(GetReOutputSearchOption(ids));
                    var source  = getTask.Result;
                    printSource = ConvertToReportRow(source);
                }), false, SessionKey);

                report.SetBasicPageSetting(Company.Code, Company.Name);
                report.SetData(printSource);
                report.Run(false);

                ShowDialogPreview(ParentForm, report, OutputDirectory);
            }
            catch (Exception ex)
            {
                NLogHandler.WriteErrorLog(this, ex, SessionKey);
                ShowWarningDialog(MsgErrCreateReportError);
            }
        }
        private void F03_OutputReport()
        {
            ClearStatusMessage();

            if (MatchingResultList == null || MatchingResultList.IsEmpty())
            {
                return;
            }

            try
            {
                var report = new AccountTransferImportReport()
                {
                    Name = $"口座振替結果データ一覧_{DateTime.Now:yyyyMMdd_HHmmss}"
                };

                var paymentFileFormatId = PaymentAgencyList.Single(pa => pa.Code == txtPaymentAgencyCode.Text).FileFormatId;
                var serverPath          = "";

                ProgressDialog.Start(ParentForm, Task.Run(() =>
                {
                    var reportRowList = MatchingResultList.Select(mr =>
                    {
                        Billing billing = null;
                        if (mr.Billings != null)                        // 照合済の場合
                        {
                            var minimumId = mr.Billings.Min(b => b.Id); // 複数時はIdが一番若い請求データ

                            billing = mr.Billings.Single(b => b.Id == minimumId);
                        }

                        return(new AccountTransferImportReport.ReportRow
                        {
                            // 請求書情報 ※ 登録後の更新値ではなく照合時の値を出力
                            Billing = billing,
                            // 口座振替情報(ファイル記述情報)
                            TransferResultCode = mr.TransferResultCode,
                            TransferAmount = mr.TransferAmount,
                            TransferBankName = mr.TransferBankName,
                            TransferBranchName = mr.TransferBranchName,
                            TransferCustomerCode = mr.TransferCustomerCode,
                            TransferAccountName = mr.TransferAccountName,
                        });
                    });

                    // 帳票生成
                    report.SetBasicPageSetting(Company.Code, Company.Name);
                    report.SetData(reportRowList);
                    report.Run(false);

                    // サーバパス設定取得
                    serverPath = GetGeneralSetting(SessionKey, CompanyId, "サーバパス").Value;
                }), false, SessionKey);

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