Exemplo n.º 1
0
        private void PickingListReport(DebtorOrderClient dbOrder)
        {
            InvoiceAPI Invapi = new InvoiceAPI(api);
            var        debtor = dbOrder.Debtor;
            string     debtorName = string.Empty, accountName = string.Empty;
            bool       showSendByMail = false;

            if (debtor != null)
            {
                debtorName     = debtor._Name ?? dbOrder._DCAccount;
                accountName    = string.Format("{0} ({1})", dbOrder._DCAccount, dbOrder.Name);
                showSendByMail = !string.IsNullOrEmpty(debtor.InvoiceEmail) || debtor.EmailDocuments;
            }

#if !SILVERLIGHT
            var cwPickingList = new CWGeneratePickingList(accountName, true, true, debtorName, showSendByMail);
            cwPickingList.DialogTableId = 2000000049;
#else
            var cwPickingList = new CWGeneratePickingList();
#endif
            cwPickingList.Closed += async delegate
            {
                if (cwPickingList.DialogResult == true)
                {
                    var selectedDate = cwPickingList.SelectedDate;

#if !SILVERLIGHT
                    var printDoc = cwPickingList.PrintDocument;
#else
                    var printDoc = false;
#endif
                    var invoicePostingResult = new InvoicePostingPrintGenerator(api, this);
                    invoicePostingResult.SetUpInvoicePosting(dbOrder, null, CompanyLayoutType.PickingList, selectedDate, null, false, cwPickingList.ShowDocument, false, printDoc, cwPickingList.NumberOfPages,
                                                             cwPickingList.SendByEmail, cwPickingList.SendByOutlook, cwPickingList.sendOnlyToThisEmail, cwPickingList.EmailList, false, null, false);

                    busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("GeneratingPage");
                    busyIndicator.IsBusy      = true;
                    var result = await invoicePostingResult.Execute();

                    busyIndicator.IsBusy = false;

                    if (result)
                    {
                        Updatedata(dbOrder, CompanyLayoutType.PickingList);
                    }
                    else
                    {
                        Utility.ShowJournalError(invoicePostingResult.PostingResult.ledgerRes, dgDebtorOrdersGrid);
                    }
                }
            };
            cwPickingList.Show();
        }
Exemplo n.º 2
0
        private void PickingListReport(DebtorOrderClient dbOrder)
        {
            InvoiceAPI Invapi     = new InvoiceAPI(api);
            var        debtor     = dbOrder.Debtor;
            string     debtorName = debtor?._Name ?? dbOrder._DCAccount;

            var cwPickingList = new CWGeneratePickingList();

#if !SILVERLIGHT
            cwPickingList.DialogTableId = 2000000049;
#endif
            cwPickingList.Closed += async delegate
            {
                if (cwPickingList.DialogResult == true)
                {
                    var selectedDate = cwPickingList.SelectedDate;

#if !SILVERLIGHT
                    var printDoc = cwPickingList.PrintDocument;
#else
                    var printDoc = false;
#endif
                    var invoicePostingResult = new InvoicePostingPrintGenerator(api, this, dbOrder, null, selectedDate, 0, false, CompanyLayoutType.PickingList, true, printDoc,
                                                                                cwPickingList.NumberOfPages, cwPickingList.EmailList);

                    busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("GeneratingPage");
                    busyIndicator.IsBusy      = true;
                    var result = await invoicePostingResult.Execute();

                    busyIndicator.IsBusy = false;

                    if (result)
                    {
                        Updatedata(dbOrder, CompanyLayoutType.PickingList);
                    }
                    else
                    {
                        Utility.ShowJournalError(invoicePostingResult.PostingResult.ledgerRes, dgDebtorOrdersGrid);
                    }
                }
            };
            cwPickingList.Show();
        }
Exemplo n.º 3
0
        private void PickList()
        {
#if SILVERLIGHT
            packListPosted = new List <InvoicePostingResult>();
#else
            packListPosted = new Dictionary <InvoicePostingResult, DebtorOrderClient>();
#endif
            var cwPickingList = new CWGeneratePickingList(false, false);
#if !SILVERLIGHT
            cwPickingList.DialogTableId = 2000000024;
#endif
            cwPickingList.Closed += async delegate
            {
                if (cwPickingList.DialogResult == true)
                {
                    var selectedDate = cwPickingList.SelectedDate;
                    busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("LoadingMsg");
                    busyIndicator.IsBusy      = true;
                    InvoiceAPI Invapi          = new InvoiceAPI(api);
                    int        cnt             = 0;
                    var        errorList       = new List <string>();
                    var        dbVisibleOrders = dgMultiInvGrid.GetVisibleRows() as IEnumerable <DebtorOrderClient>;
                    foreach (var dbOrder in dbVisibleOrders)
                    {
                        var result = await Invapi.PostInvoice(dbOrder, null, selectedDate, 0, false, new DebtorInvoiceClient(), new DebtorInvoiceLines(), false, cwPickingList.ShowDocument || cwPickingList.PrintDocument,
                                                              CompanyLayoutType.PickingList);

                        if (result.Err == ErrorCodes.Succes)
                        {
#if SILVERLIGHT
                            packListPosted.Add(result);
#else
                            packListPosted.Add(result, dbOrder);
#endif
                            cnt++;
                        }
                        else
                        {
                            string error = string.Format("{0}:{1}", dbOrder.OrderNumber, Uniconta.ClientTools.Localization.lookup(result.Err.ToString()));
                            errorList.Add(error);
                        }
                    }
                    busyIndicator.IsBusy = false;

                    int    picklistPreviewCount = packListPosted.Count;
                    string updatedMsg           = string.Format(Uniconta.ClientTools.Localization.lookup("MulitDocPrintConfirmationMsg"), picklistPreviewCount,
                                                                string.Format("{0} {1}", Uniconta.ClientTools.Localization.lookup(CompanyLayoutType.PickingList.ToString()), Uniconta.ClientTools.Localization.lookup("Documents")));

                    if (errorList.Count == 0)
                    {
                        InitMultiplePreviewDocument(updatedMsg, CompanyLayoutType.PickingList, cwPickingList.PrintDocument);
                    }
                    else
                    {
                        CWErrorBox errorDialog = new CWErrorBox(errorList.ToArray(), true);
                        errorDialog.Closed += delegate { InitMultiplePreviewDocument(updatedMsg, CompanyLayoutType.PickingList, cwPickingList.PrintDocument); };
                        errorDialog.Show();
                    }
                }
            };
            cwPickingList.Show();
        }