示例#1
0
        private void PrintProjectInvoicePostingResult(ProjectClient selectedItem)
        {
            var generateInvoiceDialog = new CWProjectGenerateInvoice(api, BasePage.GetSystemDefaultDate(), showToFromDate: true, showEmailList: true, showSendOnlyEmailCheck: true);

#if SILVERLIGHT
            generateInvoiceDialog.Height = 360.0d;
#else
            generateInvoiceDialog.DialogTableId = 2000000047;
#endif
            generateInvoiceDialog.Closed += async delegate
            {
                if (generateInvoiceDialog.DialogResult == true)
                {
                    busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("GeneratingPage");
                    busyIndicator.IsBusy      = true;
                    var isSimulated = generateInvoiceDialog.IsSimulation;
#if !SILVERLIGHT
                    var invoicePostingResult = new UnicontaClient.Pages.InvoicePostingPrintGenerator(
#elif SILVERLIGHT
                    var invoicePostingResult = new InvoicePostingPrintGenerator(
#endif
                        api, this);
                    invoicePostingResult.SetUpInvoicePosting(selectedItem, null, generateInvoiceDialog.GenrateDate, isSimulated, CompanyLayoutType.Invoice, generateInvoiceDialog.ShowInvoice, generateInvoiceDialog.InvoiceQuickPrint,
                                                             generateInvoiceDialog.NumberOfPages, generateInvoiceDialog.SendByEmail, generateInvoiceDialog.EmailList, generateInvoiceDialog.SendOnlyEmail, generateInvoiceDialog.FromDate, generateInvoiceDialog.ToDate,
                                                             generateInvoiceDialog.InvoiceCategory, generateInvoiceDialog.GenerateOIOUBLClicked, null);

                    var result = await invoicePostingResult.Execute();

                    busyIndicator.IsBusy = false;

                    if (result)
                    {
                        Task reloadTask = null;
                        if (!isSimulated)
                        {
                            reloadTask = Filter();
                        }
                    }
                    else
                    {
                        Utility.ShowJournalError(invoicePostingResult.PostingResult.ledgerRes, dgProjectGrid);
                    }
                }
            };
            generateInvoiceDialog.Show();
        }
        private void GenerateInvoice(ProjectClient dbProject)
        {
            var Invapi   = new Uniconta.API.Project.InvoiceAPI(api);
            var savetask = saveGrid();
            CWProjectGenerateInvoice GenrateInvoiceDialog = new CWProjectGenerateInvoice(api, GetSystemDefaultDate(), true, true, true, true, true);

#if SILVERLIGHT
            GenrateInvoiceDialog.Height = 210.0d;
#else
            GenrateInvoiceDialog.DialogTableId = 2000000047;
#endif
            GenrateInvoiceDialog.Closed += async delegate
            {
                if (GenrateInvoiceDialog.DialogResult == true)
                {
                    busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("GeneratingPage");
                    busyIndicator.IsBusy      = true;
                    if (savetask != null)
                    {
                        await savetask;
                    }

                    var invoicePostingResult = new InvoicePostingPrintGenerator(api, this);
                    invoicePostingResult.SetUpInvoicePosting(dbProject, GenrateInvoiceDialog.GenrateDate, GenrateInvoiceDialog.IsSimulation, GenrateInvoiceDialog.InvoiceCategory, GenrateInvoiceDialog.ShowInvoice,
                                                             GenrateInvoiceDialog.InvoiceQuickPrint, GenrateInvoiceDialog.NumberOfPages, GenrateInvoiceDialog.SendByEmail, GenrateInvoiceDialog.GenerateOIOUBLClicked, null, false);
                    var result = await invoicePostingResult.Execute();

                    busyIndicator.IsBusy = false;

                    if (result)
                    {
                        Task reloadTask = null;
                        if (!GenrateInvoiceDialog.IsSimulation)
                        {
                            reloadTask = Filter(null);
                        }
                    }
                    else
                    {
                        Utility.ShowJournalError(invoicePostingResult.PostingResult.ledgerRes, dgProjectOnAccountInvoiceLineGrid);
                    }
                }
            };
            GenrateInvoiceDialog.Show();
        }