示例#1
0
        private void LocalMenu_OnItemClicked(string ActionType)
        {
            var selectedItem = dgMultiInvGrid.SelectedItem as CreditorOrderClient;

            switch (ActionType)
            {
            case "EditRow":
                if (selectedItem == null)
                {
                    return;
                }
                string salesHeader = string.Format("{0}:{1}", Uniconta.ClientTools.Localization.lookup("Orders"), selectedItem._OrderNumber);
                if (dgMultiInvGrid.masterRecords != null)
                {
                    object[] arr = new object[2] {
                        selectedItem, dgMultiInvGrid.masterRecord
                    };
                    AddDockItem(TabControls.CreditorOrdersPage2, arr, salesHeader);
                }
                else
                {
                    AddDockItem(TabControls.CreditorOrdersPage2, selectedItem, salesHeader);
                }
                break;

            case "DeleteRow":
                dgMultiInvGrid.DeleteRow();
                break;

            case "OrderLine":
                if (selectedItem == null)
                {
                    return;
                }
                var olheader = string.Format("{0}:{1},{2}", Uniconta.ClientTools.Localization.lookup("PurchaseLines"), selectedItem._OrderNumber, selectedItem.Name);
                AddDockItem(TabControls.CreditorOrderLines, dgMultiInvGrid.syncEntity, olheader);
                break;

            case "GenerateInvoice":
                if (Utility.HasControlRights("GenerateInvoice", api.CompanyEntity))
                {
                    GenerateInvoice();
                }
                else
                {
                    UtilDisplay.ShowControlAccessMsg("GenerateInvoice");
                }
                break;

            case "RefVoucher":
                if (selectedItem == null)
                {
                    return;
                }
                var _refferedVouchers = new List <int>();
                if (selectedItem._DocumentRef != 0)
                {
                    _refferedVouchers.Add(selectedItem._DocumentRef);
                }

                AddDockItem(TabControls.AttachVoucherGridPage, new object[1] {
                    _refferedVouchers
                }, true);
                break;

            case "ViewVoucher":
                if (selectedItem == null)
                {
                    return;
                }
                busyIndicator.IsBusy = true;
                ViewVoucher(TabControls.VouchersPage3, selectedItem);
                busyIndicator.IsBusy = false;
                break;

            case "ImportVoucher":
                if (selectedItem == null)
                {
                    return;
                }
                var voucher = new VouchersClient();
                voucher._Content         = ContentTypes.PurchaseInvoice;
                voucher._PurchaseNumber  = selectedItem._OrderNumber;
                voucher._CreditorAccount = selectedItem._InvoiceAccount ?? selectedItem._DCAccount;
                CWAddVouchers addVouvhersDialog = new CWAddVouchers(api, false, voucher);
                addVouvhersDialog.Closed += delegate
                {
                    if (addVouvhersDialog.DialogResult == true)
                    {
                        if (addVouvhersDialog.VoucherRowIds.Length > 0)
                        {
                            selectedItem._DocumentRef = addVouvhersDialog.VoucherRowIds[0];
                        }
                    }
                };
                addVouvhersDialog.Show();
                break;

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

            case "UpdateRequisition":
                UpdateDocument(CompanyLayoutType.Requisition);
                break;

            case "UpdatePurchaseOrder":
                UpdateDocument(CompanyLayoutType.PurchaseOrder);
                break;

            case "UpdateDeliveryNote":
                UpdateDocument(CompanyLayoutType.PurchasePacknote);
                break;

            case "RecalculateOrderPrices":
                RecalculateOrderPrices();
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
示例#2
0
        private void localMenu_OnItemClicked(string ActionType)
        {
            switch (ActionType)
            {
            case "AddRow":
                var row = dgCreditorOrderLineGrid.AddRow() as DCOrderLine;
                row._ExchangeRate = this.exchangeRate;
                break;

            case "CopyRow":
                dgCreditorOrderLineGrid.CopyRow();
                break;

            case "DeleteRow":
                dgCreditorOrderLineGrid.DeleteRow();
                break;

            case "Storage":
                AddDockItem(TabControls.InvItemStoragePage, dgCreditorOrderLineGrid.syncEntity, true);
                break;

            case "ShowInvoice":
            case "GenerateInvoice":
                if (!string.IsNullOrEmpty(Order.Account))
                {
                    if (Utility.HasControlRights("GenerateInvoice", api.CompanyEntity))
                    {
                        GenerateInvoice(Order, ActionType == "ShowInvoice" ? true: false);
                    }
                    else
                    {
                        UtilDisplay.ShowControlAccessMsg("GenerateInvoice");
                    }
                }
                else
                {
                    string strmg = string.Format(Uniconta.ClientTools.Localization.lookup("CannotBeBlank"),
                                                 Uniconta.ClientTools.Localization.lookup("Account"));
                    UnicontaMessageBox.Show(strmg, Uniconta.ClientTools.Localization.lookup("Error"),
                                            MessageBoxButton.OK);
                }
                break;

            case "RefVoucher":
                var _refferedVouchers = new List <int>();
                if (Order._DocumentRef != 0)
                {
                    _refferedVouchers.Add(Order._DocumentRef);
                }

                AddDockItem(TabControls.AttachVoucherGridPage, new object[1] {
                    _refferedVouchers
                }, true);
                break;

            case "ShowVoucher":
                busyIndicator.IsBusy = true;
                ViewVoucher(TabControls.VouchersPage3, Order);
                busyIndicator.IsBusy = false;
                break;

            case "ImportVoucher":
                if (Order == null)
                {
                    return;
                }
                VouchersClient voucher = new VouchersClient();
                voucher._Content         = ContentTypes.PurchaseInvoice;
                voucher._Amount          = Order.InvoiceAmount;
                voucher._CreditorAccount = Order._DCAccount;
                CWAddVouchers addVouvhersDialog = new CWAddVouchers(api, voucher: voucher);
                addVouvhersDialog.Closed += delegate
                {
                    if (addVouvhersDialog.DialogResult == true)
                    {
                        if (addVouvhersDialog.VoucherRowIds.Length > 0)
                        {
                            Order.DocumentRef   = addVouvhersDialog.VoucherRowIds[0];
                            Order.InvoiceAmount = addVouvhersDialog.vouchersClient._Amount;
                            Order.InvoiceNumber = addVouvhersDialog.vouchersClient.Invoice;
                        }
                    }
                };
                addVouvhersDialog.Show();
                break;

            case "RemoveVoucher":
                RemoveVoucher(Order);
                break;

            case "InsertSubTotal":
                var dbOrderLineClient = new CreditorOrderLineClient {
                    Subtotal = true
                };
                dgCreditorOrderLineGrid.AddRow(dbOrderLineClient);
                break;

            case "ReadOIOUBL":
                ReadOIOUBL();
                break;

            case "StockLines":
                if (dgCreditorOrderLineGrid.SelectedItem == null)
                {
                    return;
                }

                var credOrderLine = dgCreditorOrderLineGrid.SelectedItem as CreditorOrderLineClient;
                if (!string.IsNullOrEmpty(credOrderLine._Item))
                {
                    AddDockItem(TabControls.CreditorInvoiceLine, credOrderLine, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("InvTransaction"), credOrderLine._Item));
                }
                break;

            case "AttachDoc":
                AttachDocuments();
                break;

            case "AddItems":
                if (this.items == null)
                {
                    return;
                }
                object[] paramArray = new object[3] {
                    new InvItemPurchaseCacheFilter(this.items), dgCreditorOrderLineGrid.TableTypeUser, Order
                };
                AddDockItem(TabControls.AddMultipleInventoryItem, paramArray, true,
                            string.Format(Uniconta.ClientTools.Localization.lookup("AddOBJ"), Uniconta.ClientTools.Localization.lookup("InventoryItems")), null, floatingLoc: Utility.GetDefaultLocation());
                break;

            case "AddVariants":
                if (dgCreditorOrderLineGrid.SelectedItem == null)
                {
                    return;
                }
                var orderLine = dgCreditorOrderLineGrid.SelectedItem as CreditorOrderLineClient;
                var itm       = orderLine?.InvItem;
                if (itm?._StandardVariant != null)
                {
                    var paramItem = new object[] { orderLine, Order };
                    dgCreditorOrderLineGrid.SetLoadedRow(orderLine);
                    AddDockItem(TabControls.ItemVariantAddPage, paramItem, true,
                                string.Format(Uniconta.ClientTools.Localization.lookup("AddOBJ"), Uniconta.ClientTools.Localization.lookup("Variants")), null, floatingLoc: Utility.GetDefaultLocation());
                }
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
            RecalculateAmount();
        }
        private void localMenu_OnItemClicked(string ActionType)
        {
            var selectedItem = getBSLSelecteditem();

            dgBankStatementLine.tableView.CloseEditor();
            switch (ActionType)
            {
            case "Save":
                saveGrid();
                break;

            case "Pre":
                SetFilter(-1);
                break;

            case "Next":
                SetFilter(1);
                break;

            case "Interval":
                setInterval();
                break;

            case "RefVoucher":
                if (selectedItem == null)
                {
                    return;
                }

                var source = (IList)dgBankStatementLine.ItemsSource;
                if (source != null)
                {
                    var _refferedVouchers = new List <int>();
                    IEnumerable <BankStatementLineGridClient> gridItems = source.Cast <BankStatementLineGridClient>();
                    foreach (var statementLine in gridItems)
                    {
                        if (statementLine._DocumentRef != 0)
                        {
                            _refferedVouchers.Add(statementLine._DocumentRef);
                        }
                    }

                    AddDockItem(TabControls.AttachVoucherGridPage, new object[1] {
                        _refferedVouchers
                    }, true);
                }
                break;

            case "ViewVoucher":
                if (selectedItem == null)
                {
                    return;
                }
                dgBankStatementLine.syncEntity.Row = selectedItem;
                busyIndicator.IsBusy = true;
                ViewVoucher(TabControls.VouchersPage3, dgBankStatementLine.syncEntity);
                busyIndicator.IsBusy = false;
                break;

            case "ImportVoucher":
                CWAddVouchers addVouvhersDialog = new CWAddVouchers(api);
                addVouvhersDialog.Show();
                break;

            case "RemoveVoucher":
                if (selectedItem == null)
                {
                    return;
                }
                if (selectedItem._DocumentRef != 0)
                {
                    selectedItem.VoucherReference = 0;
                }
                else
                {
                    UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("NoVoucherExist"), Uniconta.ClientTools.Localization.lookup("Information"), MessageBoxButton.OK);
                }
                break;

            case "TransferBankStatement":
                saveGrid();
                TransferBankStatementToJournal();
                break;

            case "ShowHideGreenLines":
                hideGreen = !hideGreen;
                setShowHideGreen(hideGreen);
                string filterString = dgBankStatementLine.FilterString;
                if (filterString.Contains("[State]"))
                {
                    filterString = "";
                }
                else
                {
                    filterString = "[State]<2";
                }
                dgBankStatementLine.FilterString = filterString;
                break;

            case "ShowAmount":
                ShowAmountWindow();
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }