Exemplo n.º 1
0
        public async Task <byte[]> GetAsync(CustomerSearch option, CancellationToken token = default(CancellationToken))
        {
            var report = new CustomerSectionReport();

            return((await report.BuildAsync("得意先マスター一覧" + DateTime.Today.ToString("yyyyMMdd"),
                                            companyQueryProcessor.GetAsync(new CompanySearch {
                Id = option.CompanyId
            }, token),
                                            customerQueryProcessor.GetAsync(option, token)))?.Convert());
        }
Exemplo n.º 2
0
        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);
            }
        }