예제 #1
0
        private void localMenu_OnItemClicked(string ActionType)
        {
            IEnumerable <DebtorInvoiceClient> selectedInvoiceUBL;
            var    selectedItem = dgInvoicesGrid.SelectedItem as DebtorInvoiceClient;
            string salesHeader  = string.Empty;

            if (selectedItem != null)
            {
                salesHeader = string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Orders"), selectedItem._OrderNumber);
            }
            switch (ActionType)
            {
            case "EditRow":
                if (selectedItem == null)
                {
                    return;
                }
                object[] EditParam = new object[2];
                EditParam[0] = selectedItem;
                EditParam[1] = true;
                AddDockItem(TabControls.InvoicePage2, EditParam, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Invoices"), selectedItem.Name));
                break;

            case "InvoiceLine":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.DebtorInvoiceLines, dgInvoicesGrid.syncEntity, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("InvoiceNumber"), selectedItem.InvoiceNum));
                }
                break;

            case "ShowInvoice":
            case "ShowPackNote":
                if (dgInvoicesGrid.SelectedItem == null || dgInvoicesGrid.SelectedItems == null)
                {
                    return;
                }
                var selectedItems = dgInvoicesGrid.SelectedItems.Cast <DebtorInvoiceClient>();
                if (ActionType == "ShowInvoice")
                {
                    ShowDocument(selectedItems, true);
                }
                else
                {
                    ShowDocument(selectedItems, false);
                }
                break;

            case "Trans":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.PostedTransactions, selectedItem, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Transactions"), selectedItem.InvoiceNum));
                }
                break;

            case "SendInvoice":
                if (dgInvoicesGrid.SelectedItem == null || dgInvoicesGrid.SelectedItems == null)
                {
                    return;
                }
                var selectedInvoiceEmails = dgInvoicesGrid.SelectedItems.Cast <DebtorInvoiceClient>();
                SendInvoice(selectedInvoiceEmails);
                break;

            case "AddDoc":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.UserDocsPage, selectedItem, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Documents"), selectedItem.InvoiceNum));
                }
                break;

            case "CreateOrder":
                if (selectedItem != null)
                {
                    CWOrderFromInvoice cwOrderInvoice = new CWOrderFromInvoice(api);
#if !SILVERLIGHT
                    cwOrderInvoice.DialogTableId = 2000000032;
#endif
                    cwOrderInvoice.Closed += async delegate
                    {
                        if (cwOrderInvoice.DialogResult == true)
                        {
                            var  orderApi       = new OrderAPI(api);
                            var  inversign      = cwOrderInvoice.InverSign;
                            var  account        = cwOrderInvoice.Account;
                            var  copyDelAddress = cwOrderInvoice.copyDeliveryAddress;
                            var  reCalPrices    = cwOrderInvoice.reCalculatePrices;
                            Type t;
                            if (cwOrderInvoice.Offer == true)
                            {
                                t = typeof(DebtorOfferClient);
                            }
                            else
                            {
                                t = typeof(DebtorOrderClient);
                            }
                            var dcOrder = this.CreateGridObject(t) as DCOrder;
                            dcOrder._DeliveryDate = cwOrderInvoice.DeliveryDate;
                            var result = await orderApi.CreateOrderFromInvoice(selectedItem, dcOrder, account, inversign, CopyDeliveryAddress : copyDelAddress, RecalculatePrices : reCalPrices);

                            if (result != ErrorCodes.Succes)
                            {
                                UtilDisplay.ShowErrorCode(result);
                            }
                            else
                            {
                                ShowOrderLines(dcOrder);
                            }
                        }
                    };
                    cwOrderInvoice.Show();
                }
                break;

#if !SILVERLIGHT
            case "GenerateOioXml":
                if (selectedItem != null)
                {
                    GenerateOIOXmlForAll(new[] { selectedItem });
                }
                break;

            case "GenerateMarkedOioXml":
                selectedInvoiceUBL = dgInvoicesGrid.SelectedItems?.Cast <DebtorInvoiceClient>();
                if (selectedInvoiceUBL != null)
                {
                    GenerateOIOXmlForAll(selectedInvoiceUBL, true);
                }
                break;

            case "GenerateAllOioXml":
                GenerateOIOXmlForAll(dgInvoicesGrid.GetVisibleRows() as IEnumerable <DebtorInvoiceClient>);
                break;

            case "SendUBL":
                selectedInvoiceUBL = dgInvoicesGrid.SelectedItems?.Cast <DebtorInvoiceClient>();
                if (selectedInvoiceUBL != null)
                {
                    SendUBL(selectedInvoiceUBL);
                }
                break;

            case "SendAsOutlook":
                if (selectedItem != null)
                {
                    OpenOutLook(selectedItem);
                }
                break;
#endif
            case "RefreshGrid":
                InitQuery();
                break;

            case "PostedBy":
                if (selectedItem != null)
                {
                    JournalPosted(selectedItem);
                }
                break;

            case "PreviousAddresses":
                if (selectedItem?.Debtor != null)
                {
                    AddDockItem(TabControls.DCPreviousAddressPage, selectedItem.Debtor, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("PreviousAddresses"), selectedItem.Debtor._Name));
                }
                break;

#if !SILVERLIGHT
            case "DocSendLog":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.DocsSendLogGridPage, dgInvoicesGrid.syncEntity);
                }
                break;
#endif
            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
예제 #2
0
        private void localMenu_OnItemClicked(string ActionType)
        {
            var    selectedItem = dgInvoicesGrid.SelectedItem as DebtorInvoiceLocal;
            string salesHeader  = string.Empty;

            if (selectedItem != null)
            {
                salesHeader = string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Orders"), selectedItem._OrderNumber);
            }
            switch (ActionType)
            {
            case "InvoiceLine":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.DebtorInvoiceLines, dgInvoicesGrid.syncEntity, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("InvoiceNumber"), selectedItem._InvoiceNumber));
                }
                break;

            case "ShowInvoice":
                if (dgInvoicesGrid.SelectedItem == null || dgInvoicesGrid.SelectedItems == null)
                {
                    return;
                }

                var selectedItems = dgInvoicesGrid.SelectedItems.Cast <DebtorInvoiceLocal>();
                ShowInvoice(selectedItems);

                break;

            case "ShowPackNote":
                if (dgInvoicesGrid.SelectedItem == null || dgInvoicesGrid.SelectedItems == null)
                {
                    return;
                }

                var items = dgInvoicesGrid.SelectedItems.Cast <DebtorInvoiceLocal>();
                ShowInvoiceForPackNote(items);
                break;

            case "Trans":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.PostedTransactions, selectedItem, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Transactions"), selectedItem._InvoiceNumber));
                }
                break;

            case "SendInvoice":
                if (dgInvoicesGrid.SelectedItem == null || dgInvoicesGrid.SelectedItems == null)
                {
                    return;
                }
                var selectedInvoiceEmails = dgInvoicesGrid.SelectedItems.Cast <DebtorInvoiceLocal>();
                SendInvoice(selectedInvoiceEmails);
                break;

            case "AddDoc":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.UserDocsPage, selectedItem, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Documents"), selectedItem._InvoiceNumber));
                }
                break;

            case "CreateOrder":
                if (selectedItem != null)
                {
                    CWOrderFromInvoice cwOrderInvoice = new CWOrderFromInvoice(api);
#if !SILVERLIGHT
                    cwOrderInvoice.DialogTableId = 2000000032;
#endif
                    cwOrderInvoice.Closed += async delegate
                    {
                        if (cwOrderInvoice.DialogResult == true)
                        {
                            var  orderApi       = new OrderAPI(api);
                            var  inversign      = cwOrderInvoice.InverSign;
                            var  account        = cwOrderInvoice.Account;
                            var  copyDelAddress = cwOrderInvoice.copyDeliveryAddress;
                            var  reCalPrices    = cwOrderInvoice.reCalculatePrices;
                            Type t;
                            if (cwOrderInvoice.Offer == true)
                            {
                                t = typeof(DebtorOfferClient);
                            }
                            else
                            {
                                t = typeof(DebtorOrderClient);
                            }
                            var dcOrder = this.CreateGridObject(t) as DCOrder;
                            var result  = await orderApi.CreateOrderFromInvoice(selectedItem, dcOrder, account, inversign, CopyDeliveryAddress : copyDelAddress, RecalculatePrices : reCalPrices);

                            if (result != ErrorCodes.Succes)
                            {
                                UtilDisplay.ShowErrorCode(result);
                            }
                            else
                            {
                                ShowOrderLines(dcOrder);
                            }
                        }
                    };
                    cwOrderInvoice.Show();
                }
                break;

#if !SILVERLIGHT
            case "GenerateOioXml":
                if (selectedItem != null)
                {
                    GenerateOIOXmlForAll(new List <DebtorInvoiceLocal>()
                    {
                        selectedItem
                    });
                }
                break;

            case "GenerateMarkedOioXml":
                var selected = dgInvoicesGrid.SelectedItems;
                if (selected != null)
                {
                    GenerateOIOXmlForAll(selected, true);
                }
                break;

            case "GenerateAllOioXml":
                var filteredRows = dgInvoicesGrid.GetVisibleRows();
                GenerateOIOXmlForAll(filteredRows);
                break;
#endif
            case "RefreshGrid":
                InitQuery();
                break;

            case "PostedBy":
                if (selectedItem != null)
                {
                    JournalPosted(selectedItem);
                }
                break;

            case "PreviousAddresses":
                if (selectedItem != null && selectedItem?.Debtor != null)
                {
                    AddDockItem(TabControls.DCPreviousAddressPage, selectedItem.Debtor, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("PreviousAddresses"), selectedItem.Debtor._Name));
                }
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
예제 #3
0
        private void localMenu_OnItemClicked(string ActionType)
        {
            var selectedItem = dgProjectOrderGrid.SelectedItem as ProjectOrderClient;

            switch (ActionType)
            {
            case "InvTransactions":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.DebtorInvoiceLines, dgProjectOrderGrid.syncEntity, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("ProjectOrder"), selectedItem._OrderNumber));
                }
                break;

            case "Trans":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.PostedTransactions, selectedItem, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Transactions"), selectedItem._Voucher));
                }
                break;

            case "AddDoc":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.UserDocsPage, selectedItem, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Documents"), selectedItem._Voucher));
                }
                break;

            case "CreateOrder":
                if (selectedItem != null)
                {
                    CWOrderFromInvoice cwOrderInvoice = new CWOrderFromInvoice(api);
                    cwOrderInvoice.DialogTableId = 2000000032;
                    cwOrderInvoice.Closed       += async delegate
                    {
                        if (cwOrderInvoice.DialogResult == true)
                        {
                            var  orderApi       = new OrderAPI(api);
                            var  inversign      = cwOrderInvoice.InverSign;
                            var  account        = cwOrderInvoice.Account;
                            var  copyDelAddress = cwOrderInvoice.copyDeliveryAddress;
                            var  reCalPrices    = cwOrderInvoice.reCalculatePrices;
                            Type t;
                            if (cwOrderInvoice.Offer == true)
                            {
                                t = typeof(DebtorOfferClient);
                            }
                            else
                            {
                                t = typeof(DebtorOrderClient);
                            }
                            var dcOrder = this.CreateGridObject(t) as DCOrder;
                            var result  = await orderApi.CreateOrderFromInvoice(selectedItem, dcOrder, account, inversign, CopyDeliveryAddress : copyDelAddress, RecalculatePrices : reCalPrices);

                            if (result != ErrorCodes.Succes)
                            {
                                UtilDisplay.ShowErrorCode(result);
                            }
                            else
                            {
                                ShowOrderLines(dcOrder);
                            }
                        }
                    };
                    cwOrderInvoice.Show();
                }
                break;

            case "RefreshGrid":
                InitQuery();
                break;

            case "PostedBy":
                if (selectedItem != null)
                {
                    JournalPosted(selectedItem);
                }
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
예제 #4
0
        private void localMenu_OnItemClicked(string ActionType)
        {
            var    selectedItem = dgCrdInvoicesGrid.SelectedItem as CreditorInvoiceLocal;
            string salesHeader  = string.Empty;

            if (selectedItem != null)
            {
                salesHeader = string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Orders"), selectedItem._OrderNumber);
            }
            switch (ActionType)
            {
            case "EditRow":
                if (selectedItem == null)
                {
                    return;
                }
                object[] EditParam = new object[2];
                EditParam[0] = selectedItem;
                EditParam[1] = true;
                AddDockItem(TabControls.CreditorInvoicePage2, EditParam, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Invoices"), selectedItem.Name));
                break;

            case "InvoiceLine":
                if (selectedItem == null)
                {
                    return;
                }
                AddDockItem(TabControls.CreditorInvoiceLine, dgCrdInvoicesGrid.syncEntity, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("InvoiceNumber"), selectedItem.InvoiceNum));
                break;

            case "ShowInvoice":
            case "ShowPackNote":
                if (dgCrdInvoicesGrid.SelectedItems == null || dgCrdInvoicesGrid.SelectedItem == null)
                {
                    return;
                }
                if (ActionType == "ShowInvoice")
                {
                    ShowDocument(true);
                }
                else
                {
                    ShowDocument(false);
                }
                break;

            case "CreateOrder":
                if (selectedItem != null)
                {
                    CWOrderFromInvoice cwOrderInvoice = new CWOrderFromInvoice(api, true);
#if !SILVERLIGHT
                    cwOrderInvoice.DialogTableId = 2000000033;
#endif
                    cwOrderInvoice.Closed += async delegate
                    {
                        if (cwOrderInvoice.DialogResult == true)
                        {
                            var orderApi       = new OrderAPI(api);
                            var inversign      = cwOrderInvoice.InverSign;
                            var account        = cwOrderInvoice.Account;
                            var dcOrder        = this.CreateGridObject(typeof(CreditorOrderClient)) as CreditorOrderClient;
                            var copyDelAddress = cwOrderInvoice.copyDeliveryAddress;
                            var reCalPrices    = cwOrderInvoice.reCalculatePrices;
                            dcOrder._DeliveryDate = cwOrderInvoice.DeliveryDate;
                            var result = await orderApi.CreateOrderFromInvoice(selectedItem, dcOrder, account, inversign, CopyDeliveryAddress : copyDelAddress, RecalculatePrices : reCalPrices);

                            if (result != ErrorCodes.Succes)
                            {
                                UtilDisplay.ShowErrorCode(result);
                            }
                            else
                            {
                                ShowOrderLines(dcOrder);
                            }
                        }
                    };
                    cwOrderInvoice.Show();
                }
                break;

            case "Trans":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.PostedTransactions, selectedItem, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Transactions"), selectedItem.InvoiceNum));
                }
                break;

            case "PurchaseCharges":
                if (selectedItem == null)
                {
                    return;
                }
                var header = string.Format("{0}: {1}, {2}", Uniconta.ClientTools.Localization.lookup("PurchaseCharges"), selectedItem.InvoiceNum, selectedItem._DCAccount);
                AddDockItem(TabControls.CreditorOrderCostLinePage, dgCrdInvoicesGrid.syncEntity, header);
                break;

            case "PostedBy":
                if (selectedItem != null)
                {
                    JournalPosted(selectedItem);
                }
                break;

            case "SendInvoice":
                if (dgCrdInvoicesGrid.SelectedItem == null || dgCrdInvoicesGrid.SelectedItems == null)
                {
                    return;
                }
                var selectedInvoiceEmails = dgCrdInvoicesGrid.SelectedItems.Cast <CreditorInvoiceLocal>();
                SendInvoice(selectedInvoiceEmails);
                break;

            case "AddDoc":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.UserDocsPage, dgCrdInvoicesGrid.syncEntity, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("Documents"), selectedItem.InvoiceNum));
                }
                break;

#if !SILVERLIGHT
            case "SendAsOutlook":
                if (selectedItem != null)
                {
                    OpenOutLook(selectedItem);
                }
                break;
#endif
            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }