private void localMenu_OnItemClicked(string ActionType)
        {
            var selectedItem = dgCreditorTranOpenGrid.SelectedItem as CreditorTransOpenClient;

            switch (ActionType)
            {
            case "EditRow":
                if (selectedItem == null)
                {
                    return;
                }
                AddDockItem(TabControls.CreditorTranOpenPage2, selectedItem, Uniconta.ClientTools.Localization.lookup("AmountToPay"), "Edit_16x16.png");
                break;

            case "SettleTran":
                Settle();
                break;

            case "Settlements":
                if (selectedItem == null)
                {
                    return;
                }
                string header = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("Settlements"), selectedItem.Voucher);
                AddDockItem(TabControls.CreditorSettlements, selectedItem.Trans, header);
                break;

            case "ViewDownloadRow":
                if (selectedItem == null)
                {
                    return;
                }
                DebtorTransactions.ShowVoucher(dgCreditorTranOpenGrid.syncEntity, api, busyIndicator);
                break;

            case "SaveGrid":
                saveGrid();
                break;

            case "ReopenAll":
                ReOpenAllTrans();
                break;

            case "AutoSettlement":
                AutoSettlementTrans();
                break;

            case "VoucherTransactions":
                if (selectedItem != null)
                {
                    string vheader = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("VoucherTransactions"), selectedItem.Voucher);
                    AddDockItem(TabControls.AccountsTransaction, dgCreditorTranOpenGrid.syncEntity, vheader);
                }
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
        private void localMenu_OnItemClicked(string ActionType)
        {
            var selectedItem = dgDebtorTransOpen.SelectedItem as DebtorTransOpenClient;

            switch (ActionType)
            {
            case "EditRow":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.DebtorTranPage2, selectedItem, Uniconta.ClientTools.Localization.lookup("TransactionOutstanding"), ";component/Assets/img/Edit_16x16.png");
                }
                break;

            case "ViewDownloadRow":
                if (selectedItem != null)
                {
                    DebtorTransactions.ShowVoucher(dgDebtorTransOpen.syncEntity, api, busyIndicator);
                }
                break;

            case "VoucherTransactions":
                if (selectedItem?.Trans == null)
                {
                    return;
                }
                string vheader = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("VoucherTransactions"), selectedItem.Trans._Voucher);
                AddDockItem(TabControls.AccountsTransaction, dgDebtorTransOpen.syncEntity, vheader);
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
示例#3
0
        void LocalMenu_OnItemClicked(string ActionType)
        {
            GLTransClientTotal selectedItem = dgGLTrans.View.MasterRootRowsContainer.FocusedView.DataControl.CurrentItem as GLTransClientTotal;

            switch (ActionType)
            {
            case "PostedTransaction":
                if (selectedItem == null)
                {
                    return;
                }
                string header = string.Format("{0} / {1}", Uniconta.ClientTools.Localization.lookup("PostedTransactions"), selectedItem._JournalPostedId);
                AddDockItem(TabControls.PostedTransactions, selectedItem, header);
                break;

            case "ViewDownloadRow":
                var selectedRow = childDgGLTrans.SelectedItem as GLTransClientTotal;
                if (selectedRow != null)
                {
                    DebtorTransactions.ShowVoucher(childDgGLTrans.syncEntity, api, busyIndicator);
                }
                break;

            case "VoucherTransactions":
                if (selectedItem == null)
                {
                    return;
                }
                string vheader = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("VoucherTransactions"), selectedItem._Voucher);
                AddDockItem(TabControls.AccountsTransaction, childDgGLTrans.syncEntity, vheader);
                break;

            case "ExpandAndCollapse":
                if (dgGLTrans.ItemsSource != null)
                {
                    IsCollapsed = dgGLTrans.IsMasterRowExpanded(0);
                    SetExpandAndCollapse(IsCollapsed);
                }
                break;

            case "Search":
                LoadGLTrans();
                break;

            case "ExpandCollapseCurrent":
                if (dgGLTrans.SelectedItem != null)
                {
                    SetExpandAndCollapseCurrent(true, false);
                }
                else if (childDgGLTrans.SelectedItem != null)
                {
                    SetExpandAndCollapseCurrent(true, true);
                }
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
        private void localMenu_OnItemClicked(string ActionType)
        {
            var selectedItem = dgFamTransGrid.SelectedItem as GLTransClient;

            switch (ActionType)
            {
            case "PostedTransaction":
                if (selectedItem == null)
                {
                    return;
                }
                string header = string.Format("{0} / {1}", Uniconta.ClientTools.Localization.lookup("PostedTransactions"), selectedItem._JournalPostedId);
                AddDockItem(TabControls.PostedTransactions, selectedItem, header);
                break;

            case "ViewDownloadRow":
                if (selectedItem == null)
                {
                    return;
                }
                DebtorTransactions.ShowVoucher(dgFamTransGrid.syncEntity, api, busyIndicator);
                break;

            case "VoucherTransactions":
                if (selectedItem == null)
                {
                    return;
                }
                string vheader = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("VoucherTransactions"), selectedItem._Voucher);
                AddDockItem(TabControls.AccountsTransaction, dgFamTransGrid.syncEntity, vheader);
                break;

            case "AccountsTransaction":
                if (selectedItem != null)
                {
                    var glAccount = selectedItem.Master;
                    if (glAccount == null)
                    {
                        return;
                    }
                    string accHeader = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("AccountsTransaction"), selectedItem._Account);
                    AddDockItem(TabControls.AccountsTransaction, glAccount, accHeader);
                }
                break;

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

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
示例#5
0
        private void HasVoucherImage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            var gLTransClientTotal = (sender as Image).Tag as GLTransClientTotal;

            if (gLTransClientTotal != null)
            {
                DebtorTransactions.ShowVoucher(childDgGLTrans.syncEntity, api, busyIndicator);
            }
        }
示例#6
0
        void localMenu_OnItemClicked(string ActionType)
        {
            GLTransClientTotal selectedItem = dgGLTran.SelectedItem as GLTransClientTotal;

            switch (ActionType)
            {
            case "PostedTransaction":
                if (selectedItem == null)
                {
                    return;
                }
                string header = string.Format("{0} / {1}", Uniconta.ClientTools.Localization.lookup("PostedTransactions"), selectedItem._JournalPostedId);
                AddDockItem(TabControls.PostedTransactions, selectedItem, header);
                break;

            case "RefreshGrid":
                if (gridControl != null)
                {
                    LoadGlTran(true);
                }
                break;

            case "ViewDownloadRow":
                if (selectedItem == null)
                {
                    return;
                }
                DebtorTransactions.ShowVoucher(dgGLTran.syncEntity, api, busyIndicator);
                break;

            case "VoucherTransactions":
                if (selectedItem == null)
                {
                    return;
                }
                string vheader = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("VoucherTransactions"), selectedItem._Voucher);
                AddDockItem(TabControls.AccountsTransaction, dgGLTran.syncEntity, vheader);
                break;

            case "ViewTransactions":
                if (selectedItem == null)
                {
                    return;
                }
                AddDockItem(TabControls.AccountsTransaction, selectedItem, string.Format("{0} : {1}", Uniconta.ClientTools.Localization.lookup("VoucherTransactions"), selectedItem._Account));
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
        private void LocalMenu_OnItemClicked(string ActionType)
        {
            var selectedItem = dgOpenTransactionGrid.SelectedItem;

            switch (ActionType)
            {
            case "Generate":
                Generate();
                break;

            case "Cancel":
                Close();
                break;

            case "ViewDownloadRow":
                if (selectedItem != null)
                {
                    DebtorTransactions.ShowVoucher(dgOpenTransactionGrid.syncEntity, api, busyIndicator);
                }
                break;

            case "EditRow":
                if (selectedItem != null)
                {
                    if (selectedItem is DebtorTransOpenClientExtended)
                    {
                        AddDockItem(TabControls.DebtorTranPage2, selectedItem, Uniconta.ClientTools.Localization.lookup("TransactionOutstanding"), "Edit_16x16.png");
                    }
                    else if (selectedItem is CreditorTransOpenClientExtended)
                    {
                        AddDockItem(TabControls.CreditorTranOpenPage2, selectedItem, Uniconta.ClientTools.Localization.lookup("AmountToPay"), "Edit_16x16.png");
                    }
                }
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
示例#8
0
        private void localMenu_OnItemClicked(string ActionType)
        {
            var selectedItem  = dgDebtorTranOpenGrid.SelectedItem as DebtorTransDirectDebit;
            var selectedItems = dgDebtorTranOpenGrid.SelectedItems;

            switch (ActionType)
            {
            case "SaveGrid":
                dgDebtorTranOpenGrid.SelectedItem = null;
                dgDebtorTranOpenGrid.SaveData();
                break;

            case "Validate":
                if (dgDebtorTranOpenGrid.ItemsSource == null)
                {
                    return;
                }
                CallValidatePayment();
                break;

            case "MergeUnMergePaym":
                if (dgDebtorTranOpenGrid.ItemsSource == null)
                {
                    return;
                }
                MergePaym();
                break;

            case "ExpandGroups":
                if (dgDebtorTranOpenGrid.ItemsSource == null)
                {
                    return;
                }
                ExpandGroups();
                break;

            case "CollapseGroups":
                if (dgDebtorTranOpenGrid.ItemsSource == null)
                {
                    return;
                }
                CollapseGroups();
                break;

            case "ExportFile":
                if (dgDebtorTranOpenGrid.ItemsSource == null)
                {
                    return;
                }
                ExportFile();
                break;

            case "ImportFile":
                if (dgDebtorTranOpenGrid.ItemsSource == null)
                {
                    return;
                }
                ImportFile();
                break;

            case "StatusNone":
                if (selectedItems == null)
                {
                    return;
                }
                ChangeStatus(PaymentStatusLevel.None, selectedItems);
                break;

            case "StatusResend":
                if (selectedItems == null)
                {
                    return;
                }
                ChangeStatus(PaymentStatusLevel.Resend, selectedItems);
                break;

            case "StatusStopPayment":
                if (selectedItems == null)
                {
                    return;
                }
                ChangeStatus(PaymentStatusLevel.StopPayment, selectedItems);
                break;

            case "StatusOnhold":
                if (selectedItems == null)
                {
                    return;
                }
                ChangeStatus(PaymentStatusLevel.OnHold, selectedItems);
                break;

            case "ViewDownloadRow":
                if (selectedItem == null)
                {
                    return;
                }
                DebtorTransactions.ShowVoucher(dgDebtorTranOpenGrid.syncEntity, api, busyIndicator);
                break;

            case "GenerateJournalLines":
                if (dgDebtorTranOpenGrid.ItemsSource == null)
                {
                    return;
                }
                GenerateJournalLines();
                break;

            case "RefreshGrid":
                if (dgDebtorTranOpenGrid.HasUnsavedData)
                {
                    Utility.ShowConfirmationOnRefreshGrid(dgDebtorTranOpenGrid);
                }

                btnSerach_Click(null, null);
                setMergeUnMergePaym(false);
                break;

            case "Filter":
                if (dgDebtorTranOpenGrid.HasUnsavedData)
                {
                    Utility.ShowConfirmationOnRefreshGrid(dgDebtorTranOpenGrid);
                }

                gridRibbon_BaseActions(ActionType);
                setMergeUnMergePaym(false);
                break;

            case "EnableStatusInfoSection":
                hideStatusInfoSection = !hideStatusInfoSection;
                SetShowHideStatusInfoSection(hideStatusInfoSection);
                break;

            case "EnableTextSection":
                hideTextSection = !hideTextSection;
                SetShowHideTextSection();
                break;

            case "FileArchive":
                AddDockItem(TabControls.DebtorPaymentFileReport, null, Uniconta.ClientTools.Localization.lookup("FileArchive"));
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
        private void localMenu_OnItemClicked(string ActionType)
        {
            var selectedItem = dgDebtorTransOpen.SelectedItem as DebtorTransOpenClient;

            switch (ActionType)
            {
            case "EditAll":
                if (dgDebtorTransOpen.Visibility == System.Windows.Visibility.Visible)
                {
                    EditAll();
                }
                break;

            case "EditRow":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.DebtorTranPage2, selectedItem, Uniconta.ClientTools.Localization.lookup("TransactionOutstanding"), "Edit_16x16.png");
                }
                break;

            case "ViewDownloadRow":
                if (selectedItem != null)
                {
                    DebtorTransactions.ShowVoucher(dgDebtorTransOpen.syncEntity, api, busyIndicator);
                }
                break;

            case "VoucherTransactions":
                if (selectedItem?.Trans == null)
                {
                    return;
                }
                string vheader = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("VoucherTransactions"), selectedItem.Trans._Voucher);
                AddDockItem(TabControls.AccountsTransaction, dgDebtorTransOpen.syncEntity, vheader);
                break;

            case "SaveGrid":
                saveGrid();
                break;

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

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

            case "Invoices":
                if (selectedItem != null)
                {
                    string header = string.Format("{0}/{1}", Uniconta.ClientTools.Localization.lookup("DebtorInvoice"), selectedItem.Account);
                    AddDockItem(TabControls.Invoices, dgDebtorTransOpen.syncEntity, header);
                }
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
        private void LocalMenu_OnItemClicked(string ActionType)
        {
            switch (ActionType)
            {
            case "ExpandAndCollapse":
                if (dgCreditorTrans.ItemsSource == null)
                {
                    return;
                }
                IsCollapsed = dgCreditorTrans.IsMasterRowExpanded(0);
                SetExpandAndCollapse(IsCollapsed);
                break;

            case "ViewDownloadRow":
                var selectedItem = dgChildCreditorTrans.SelectedItem as CreditorTransClientTotal;
                if (selectedItem != null)
                {
                    DebtorTransactions.ShowVoucher(dgChildCreditorTrans.syncEntity, api, busyIndicator);
                }
                break;

            case "ViewTransactions":
                var item = dgChildCreditorTrans.SelectedItem as CreditorTransClientTotal;
                if (item != null)
                {
                    AddDockItem(TabControls.AccountsTransaction, item, string.Format("{0} : {1}", Uniconta.ClientTools.Localization.lookup("CreditorTransactions"), item._Account));
                }
                break;

            case "VoucherTransactions":
                var selItem = dgChildCreditorTrans.SelectedItem as CreditorTransClientTotal;
                if (selItem != null)
                {
                    AddDockItem(TabControls.AccountsTransaction, dgChildCreditorTrans.syncEntity, string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("VoucherTransactions"), selItem._Voucher));
                }
                break;

            case "CreditorFilter":
                if (creditorFilterDialog == null)
                {
                    if (creditorFilterCleared)
                    {
                        creditorFilterDialog = new CWServerFilter(api, typeof(CreditorClient), null, null, CreditorUserFields);
                    }
                    else
                    {
                        creditorFilterDialog = new CWServerFilter(api, typeof(CreditorClient), null, null, CreditorUserFields);
                    }
                    creditorFilterDialog.Closing += creditorFilterDialog_Closing;
#if !SILVERLIGHT
                    creditorFilterDialog.Show();
                }
                else
                {
                    creditorFilterDialog.Show(true);
                }
#elif SILVERLIGHT
                }
                creditorFilterDialog.Show();
#endif
                break;
示例#11
0
        private void LocalMenu_OnItemClicked(string ActionType)
        {
            var selectedItem = dgProjectTransaction.SelectedItem as ProjectTransClient;

            switch (ActionType)
            {
            case "EditAll":
                if (dgProjectTransaction.Visibility == Visibility.Visible)
                {
                    EditAll();
                }
                break;

            case "VoucherTransactions":
                if (selectedItem != null)
                {
                    string vheader = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("VoucherTransactions"), selectedItem._Voucher);
                    AddDockItem(TabControls.AccountsTransaction, dgProjectTransaction.syncEntity, vheader);
                }
                break;

            case "ViewDownloadRow":
                if (selectedItem != null)
                {
                    DebtorTransactions.ShowVoucher(dgProjectTransaction.syncEntity, api, busyIndicator);
                }
                break;

            case "InvTransactions":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.InvTransactions, dgProjectTransaction.syncEntity);
                }
                break;

            case "Save":
                SaveGrid();
                break;

            case "RefreshGrid":
                if (dgProjectTransaction.HasUnsavedData)
                {
                    Utility.ShowConfirmationOnRefreshGrid(dgProjectTransaction);
                }
                else
                {
                    InitQuery();
                }
                break;

            case "Filter":
                if (dgProjectTransaction.HasUnsavedData)
                {
                    Utility.ShowConfirmationOnRefreshGrid(dgProjectTransaction);
                }
                gridRibbon_BaseActions(ActionType);
                break;

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

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
示例#12
0
        private void localMenu_OnItemClicked(string ActionType)
        {
            var selectedItem = dgDebtorTranOpenGrid.SelectedItem as DebtorTransOpenClient;

            switch (ActionType)
            {
            case "DeleteRow":
                dgDebtorTranOpenGrid.RemoveFocusedRowFromGrid();
                break;

            case "SaveGrid":
                saveGrid();
                break;

            case "ViewDownloadRow":
                if (selectedItem != null)
                {
                    DebtorTransactions.ShowVoucher(dgDebtorTranOpenGrid.syncEntity, api, busyIndicator);
                }
                break;

            case "GenerateJournalLines":
                if (dgDebtorTranOpenGrid.ItemsSource == null)
                {
                    return;
                }
                CWImportToLine cwLine = new CWImportToLine(api, GetSystemDefaultDate());
#if !SILVERLIGHT
                cwLine.DialogTableId = 2000000034;
#endif
                cwLine.Closed
                    += async delegate
                    {
                    if (cwLine.DialogResult == true && !string.IsNullOrEmpty(cwLine.Journal))
                    {
                        busyIndicator.IsBusy = true;
                        Uniconta.API.GeneralLedger.PostingAPI posApi = new Uniconta.API.GeneralLedger.PostingAPI(api);
                        var LineNumber = (int)(await posApi.MaxLineNumber(cwLine.Journal)) + 2;

                        NumberSerieAPI numberserieApi    = new NumberSerieAPI(posApi);
                        int            nextVoucherNumber = 0;

                        SQLCache payments = api.GetCache(typeof(Uniconta.DataModel.PaymentTerm));
                        string   payment  = (from pay in (IEnumerable <Uniconta.DataModel.PaymentTerm>)payments.GetNotNullArray where pay._UseForCollection select pay._Payment).FirstOrDefault();

                        SQLCache journalCache   = api.GetCache(typeof(Uniconta.DataModel.GLDailyJournal));
                        var      DJclient       = (Uniconta.DataModel.GLDailyJournal)journalCache.Get(cwLine.Journal);
                        var      listLineClient = new List <Uniconta.DataModel.GLDailyJournalLine>();

                        if (!DJclient._GenerateVoucher && !DJclient._ManualAllocation)
                        {
                            nextVoucherNumber = (int)await numberserieApi.ViewNextNumber(DJclient._NumberSerie);
                        }

                        var visibleRows = dgDebtorTranOpenGrid.GetVisibleRows() as IEnumerable <DebtorTransPayment>;
                        var rows        = visibleRows.Where(p => p._FeeAmount > 0.0d && p._OnHold == false);
                        if (cwLine.AggregateAmount)
                        {
                            string lastAcc     = null;
                            var    rowsGroupBy = rows.GroupBy(a => a.Account);
                            foreach (var group in rowsGroupBy)
                            {
                                string invoice;
                                double FeeAmount, Charge;
                                var    rec = group.FirstOrDefault();
                                if (group.Count() > 1)
                                {
                                    FeeAmount = group.Sum(p => p._FeeAmount);
                                    Charge    = group.Sum(p => p._PaymentCharge);
                                    invoice   = null;
                                }
                                else
                                {
                                    FeeAmount = rec._FeeAmount;
                                    Charge    = rec._PaymentCharge;
                                    invoice   = rec.InvoiceAN;
                                }
                                if (group.Key == lastAcc)
                                {
                                    continue;
                                }
                                lastAcc = group.Key;
                                CreateGLDailyJournalLine(listLineClient, lastAcc, FeeAmount, Charge, invoice, DJclient, LineNumber, cwLine.Date, cwLine.TransType, cwLine.BankAccount, rec.Currency, nextVoucherNumber, payment);
                                if (nextVoucherNumber != 0)
                                {
                                    nextVoucherNumber++;
                                }
                            }
                        }
                        else
                        {
                            DebtorTransPayment lastRec = null;
                            foreach (var row in rows)
                            {
                                if (!object.ReferenceEquals(row, lastRec))
                                {
                                    lastRec = row;
                                    CreateGLDailyJournalLine(listLineClient, row.Account, row._FeeAmount, row._PaymentCharge, row.InvoiceAN, DJclient, LineNumber, cwLine.Date, cwLine.TransType, cwLine.BankAccount, row.Currency, nextVoucherNumber, payment);
                                    if (nextVoucherNumber != 0)
                                    {
                                        nextVoucherNumber++;
                                    }
                                }
                            }
                        }

                        if (listLineClient.Count > 0)
                        {
                            ErrorCodes errorCode = await api.Insert(listLineClient);

                            busyIndicator.IsBusy = false;
                            if (errorCode != ErrorCodes.Succes)
                            {
                                UtilDisplay.ShowErrorCode(errorCode);
                            }
                            else
                            {
                                if (nextVoucherNumber != 0)
                                {
                                    numberserieApi.SetNumber(DJclient._NumberSerie, nextVoucherNumber - 1);
                                }

                                var text = string.Concat(Uniconta.ClientTools.Localization.lookup("GenerateJournalLines"), "; ", Uniconta.ClientTools.Localization.lookup("Completed"),
                                                         Environment.NewLine, string.Format(Uniconta.ClientTools.Localization.lookup("GoTo"), Uniconta.ClientTools.Localization.lookup("Journallines")), " ?");
                                var select = UnicontaMessageBox.Show(text, Uniconta.ClientTools.Localization.lookup("Information"), MessageBoxButton.OKCancel);
                                if (select == MessageBoxResult.OK)
                                {
                                    AddDockItem(TabControls.GL_DailyJournalLine, DJclient, null, null, true);
                                }
                            }
                        }
                    }
                    busyIndicator.IsBusy = false;
                    };
                cwLine.Show();
                break;

            case "AddInterest":
                if (selectedItem != null)
                {
                    SetFee(true);
                }
                break;

            case "AddCollection":
                if (selectedItem != null)
                {
                    SetFee(false);
                }
                break;

            case "SendAllEmail":
                SendReport((IEnumerable <DebtorTransPayment>)dgDebtorTranOpenGrid.GetVisibleRows());
                break;

            case "SendMarkedEmail":
                var markedRows = dgDebtorTranOpenGrid.SelectedItems?.Cast <DebtorTransPayment>();
                if (markedRows != null)
                {
                    SendReport(markedRows);
                }
                break;

            case "SendCurrentEmail":
                if (dgDebtorTranOpenGrid.SelectedItem != null)
                {
                    var cwSendInvoice = new CWSendInvoice();
#if !SILVERLIGHT
                    cwSendInvoice.DialogTableId = 2000000031;
#endif
                    cwSendInvoice.Closed += delegate
                    {
                        var selectedRow = new DebtorTransPayment[] { (DebtorTransPayment)dgDebtorTranOpenGrid.SelectedItem };
                        SendReport(selectedRow, cwSendInvoice.Emails, cwSendInvoice.sendOnlyToThisEmail);
                    };
                    cwSendInvoice.Show();
                }
                break;

#if !SILVERLIGHT
            case "SendAsOutlook":
                if (dgDebtorTranOpenGrid.SelectedItem != null)
                {
                    OpenOutlook();
                }
                break;
#endif
            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
        private void LocalMenu_OnItemClicked(string ActionType)
        {
            switch (ActionType)
            {
            case "ExpandAndCollapse":
                if (dgDebtorTrans.ItemsSource == null)
                {
                    return;
                }
                SetExpandAndCollapse(dgDebtorTrans.IsMasterRowExpanded(0));
                break;

            case "ViewDownloadRow":
                var selectedItem = childDgDebtorTrans.SelectedItem as DebtorTransClientTotal;
                if (selectedItem != null)
                {
                    DebtorTransactions.ShowVoucher(childDgDebtorTrans.syncEntity, api, busyIndicator);
                }
                break;

            case "SendAsEmail":
                if (dgDebtorTrans.ItemsSource == null)
                {
                    UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("zeroRecords"), Uniconta.ClientTools.Localization.lookup("Information"), MessageBoxButton.OK);
                    return;
                }
                SendMail();
                break;

            case "ViewTransactions":
                var item = childDgDebtorTrans.SelectedItem as DebtorTransClientTotal;
                if (item != null)
                {
                    AddDockItem(TabControls.AccountsTransaction, item, string.Format("{0} : {1}", Uniconta.ClientTools.Localization.lookup("DebtorTransactions"), item._Account));
                }
                break;

            case "VoucherTransactions":
                var selItem = childDgDebtorTrans.SelectedItem as DebtorTransClientTotal;
                if (selItem != null)
                {
                    AddDockItem(TabControls.AccountsTransaction, childDgDebtorTrans.syncEntity, string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("VoucherTransactions"), selItem._Voucher));
                }
                break;

            case "DebtorFilter":

                if (debtorFilterDialog == null)
                {
                    if (debtorFilterCleared)
                    {
                        debtorFilterDialog = new CWServerFilter(api, typeof(DebtorClient), null, null, DebtorUserFields);
                    }
                    else
                    {
                        debtorFilterDialog = new CWServerFilter(api, typeof(DebtorClient), null, null, DebtorUserFields);
                    }
                    debtorFilterDialog.Closing += debtorFilterDialog_Closing;
#if !SILVERLIGHT
                    debtorFilterDialog.Show();
                }
                else
                {
                    debtorFilterDialog.Show(true);
                }
#elif SILVERLIGHT
                }
                debtorFilterDialog.Show();
#endif
                break;
示例#14
0
        private void localMenu_OnItemClicked(string ActionType)
        {
            string header;
            var    selectedItem = dgAccountsTransGrid.SelectedItem as GLTransClient;

            switch (ActionType)
            {
            case "PostedTransaction":
                if (selectedItem == null)
                {
                    return;
                }
                header = string.Format("{0} / {1}", Uniconta.ClientTools.Localization.lookup("PostedTransactions"), selectedItem._JournalPostedId);
                AddDockItem(TabControls.PostedTransactions, selectedItem, header);
                break;

            case "ViewDownloadRow":
                if (selectedItem != null)
                {
                    DebtorTransactions.ShowVoucher(dgAccountsTransGrid.syncEntity, api, busyIndicator);
                }
                break;

            case "VoucherTransactions":
                if (selectedItem == null)
                {
                    return;
                }
                header = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("VoucherTransactions"), selectedItem._Voucher);
                AddDockItem(TabControls.AccountsTransaction, dgAccountsTransGrid.syncEntity, header);
                break;

            case "AccountsTransaction":
                if (selectedItem != null)
                {
                    var glAccount = selectedItem.Master;
                    if (glAccount == null)
                    {
                        return;
                    }
                    string accHeader = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("AccountsTransaction"), selectedItem._Account);
                    AddDockItem(TabControls.AccountsTransaction, glAccount, accHeader);
                }
                break;

            case "DragDrop":
            case "ImportVoucher":
                if (selectedItem != null)
                {
                    AddVoucher(selectedItem, ActionType);
                }
                break;

            case "CancelVoucher":
                if (selectedItem == null)
                {
                    return;
                }
                CWCommentsDialogBox commentsDialog = new CWCommentsDialogBox(Uniconta.ClientTools.Localization.lookup("CancelVoucher"),
                                                                             true, selectedItem.Date);
#if !SILVERLIGHT
                commentsDialog.DialogTableId = 2000000035;
#endif
                commentsDialog.Closing += async delegate
                {
                    if (commentsDialog.DialogResult == true)
                    {
                        busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("SendingWait");
                        busyIndicator.IsBusy      = true;

                        var comments   = commentsDialog.Comments;
                        var date       = commentsDialog.Date;
                        var errorCodes = await postingApiInv.CancelVoucher(selectedItem, comments, date);

                        busyIndicator.IsBusy = false;

                        if (errorCodes != ErrorCodes.Succes)
                        {
                            UtilDisplay.ShowErrorCode(errorCodes);
                        }
                        else
                        {
                            UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("TransCanceled"), Uniconta.ClientTools.Localization.lookup("Error"));
                            BindGrid();
                        }
                    }
                };
                commentsDialog.Show();
                break;

            case "DeleteVoucher":
                if (selectedItem == null)
                {
                    return;
                }
                var deleteDialog = new DeletePostedJournal();
                deleteDialog.Closed += async delegate
                {
                    if (deleteDialog.DialogResult == true)
                    {
                        PostingAPI pApi = new PostingAPI(api);
                        ErrorCodes res  = await pApi.DeletePostedVoucher(selectedItem, deleteDialog.Comment);

                        UtilDisplay.ShowErrorCode(res);
                        if (res == ErrorCodes.Succes)
                        {
                            dgAccountsTransGrid.ItemsSource = new GLTransClient[0];
                        }
                    }
                };
                deleteDialog.Show();
                break;

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

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

                var _refferedVouchers = new List <int>();
                var source            = (IList)dgAccountsTransGrid.ItemsSource;
                if (source != null)
                {
                    foreach (var statementLine in (IEnumerable <GLTrans>)source)
                    {
                        if (statementLine._DocumentRef != 0)
                        {
                            _refferedVouchers.Add(statementLine._DocumentRef);
                        }
                    }
                }
                CWAttachVouchers attachVouchersDialog = new CWAttachVouchers(api, _refferedVouchers);
                attachVouchersDialog.Closing += delegate
                {
                    if (attachVouchersDialog.DialogResult == true)
                    {
                        if (attachVouchersDialog.VoucherReference != 0 && selectedItem != null)
                        {
                            SaveAttachment(selectedItem, attachVouchersDialog.Voucher);
                        }
                    }
                };
                attachVouchersDialog.Show();
                break;

            case "RemoveVoucher":
                if (selectedItem == null || selectedItem._DocumentRef == 0)
                {
                    return;
                }
                if (UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("AskRemoveDocument"), Uniconta.ClientTools.Localization.lookup("Confirmation"), MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    postingApiInv.AddPhysicalVoucher(selectedItem, null, true);
                    selectedItem._DocumentRef = 0;
                }
                break;

            case "ChangeDimension":
                if (selectedItem != null)
                {
                    CWChangeDimension ChangeDimensionDialog = new CWChangeDimension(api, isChangeText: false);
                    ChangeDimensionDialog.Closing += delegate
                    {
                        if (ChangeDimensionDialog.DialogResult == true)
                        {
                            SetNewDim(selectedItem, ChangeDimensionDialog);
                        }
                    };
                    ChangeDimensionDialog.Show();
                }
                break;

            case "ChangeText":
                if (selectedItem != null)
                {
                    CWChangeDimension ChangeTextDialog = new CWChangeDimension(api, isChangeDimension: false);
                    ChangeTextDialog.Closing += delegate
                    {
                        if (ChangeTextDialog.DialogResult == true)
                        {
                            SetChangeText(selectedItem, ChangeTextDialog);
                        }
                    };
                    ChangeTextDialog.Show();
                }
                break;

            case "ChangeReference":
                if (selectedItem != null)
                {
                    CWChangeDimension updateReferenceDialog = new CWChangeDimension(api, isChangeDimension: false);
                    updateReferenceDialog.Closing += delegate
                    {
                        if (updateReferenceDialog.DialogResult == true)
                        {
                            SetChangeReference(selectedItem, updateReferenceDialog);
                        }
                    };
                    updateReferenceDialog.Show();
                }
                break;

            case "ChangeQuantity":
                if (selectedItem != null)
                {
                    CWChangeDimension ChangeQtyDialog = new CWChangeDimension(api, isChangeDimension: false, isChangeText: false);
                    ChangeQtyDialog.Closing += delegate
                    {
                        if (ChangeQtyDialog.DialogResult == true)
                        {
                            SetChangeQuantity(selectedItem, ChangeQtyDialog);
                        }
                    };
                    ChangeQtyDialog.Show();
                }
                break;

            case "AddEditNote":
                if (selectedItem != null)
                {
                    CWAddEditNote cwAddEditNote = new CWAddEditNote(api, null, selectedItem);
                    cwAddEditNote.Closed += delegate
                    {
                        if (cwAddEditNote.DialogResult == true)
                        {
                            if (cwAddEditNote.result == ErrorCodes.Succes)
                            {
                                BindGrid();
                            }
                        }
                    };
                    cwAddEditNote.Show();
                }
                break;

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

            case "ChangeDate":
                if (selectedItem == null)
                {
                    return;
                }
                var dateSelector = new CWDateSelector(selectedItem.Date, true);
#if !SILVERLIGHT
                dateSelector.DialogTableId = 2000000058;
#endif
                dateSelector.Closed += delegate
                {
                    if (dateSelector.DialogResult == true)
                    {
                        SetChangeDate(selectedItem, dateSelector.SelectedDate);
                    }
                };
                dateSelector.Show();
                break;

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

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

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

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

            case "ExportVouchers":
                var glTrans = ((IEnumerable <GLTransClient>)dgAccountsTransGrid.GetVisibleRows())?.Where(x => x._DocumentRef != 0);
                AddDockItem(TabControls.VoucherExportPage, new object[] { glTrans }, Uniconta.ClientTools.Localization.lookup("ExportVouchers"));
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
        private void localMenu_OnItemClicked(string ActionType)
        {
            var selectedItem = dgInvTransGrid.SelectedItem as InvTransClient;

            switch (ActionType)
            {
            case "SeriesBatch":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.InvSeriesBatch, dgInvTransGrid.syncEntity, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("SerialBatchNumbers"), selectedItem._Item));
                }
                break;

            case "AttachSerialBatch":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.AttachInvSeriesBatch, selectedItem, Uniconta.ClientTools.Localization.lookup("SerialBatchNumbers"));
                }
                break;

            case "ChangeVariant":
                if (selectedItem == null)
                {
                    return;
                }
                var cwChangeVaraints = new CWModifyVariants(api, selectedItem);
                cwChangeVaraints.Closing += delegate
                {
                    if (cwChangeVaraints.DialogResult == true)
                    {
                        gridRibbon_BaseActions("RefreshGrid");
                    }
                };
                cwChangeVaraints.Show();
                break;

            case "ChangeStorage":
                if (selectedItem == null)
                {
                    return;
                }
                var cwchangeStorage = new CWModiyStorage(api, selectedItem);
                cwchangeStorage.Closing += delegate
                {
                    if (cwchangeStorage.DialogResult == true)
                    {
                        gridRibbon_BaseActions("RefreshGrid");
                    }
                };
                cwchangeStorage.Show();
                break;

            case "VoucherTransactions":
                if (selectedItem == null)
                {
                    return;
                }
                string arg;
                if (selectedItem._JournalPostedId != 0)
                {
                    arg = string.Format("{0}={1}", Uniconta.ClientTools.Localization.lookup("JournalPostedId"), selectedItem._JournalPostedId);
                }
                else if (selectedItem._InvoiceNumber != 0)
                {
                    arg = string.Format("{0}={1}", Uniconta.ClientTools.Localization.lookup("Invoice"), selectedItem._InvoiceNumber);
                }
                else if (selectedItem._InvJournalPostedId != 0)
                {
                    arg = string.Format("{0} ({1})={2}", Uniconta.ClientTools.Localization.lookup("JournalPostedId"), Uniconta.ClientTools.Localization.lookup("Inventory"), selectedItem._InvJournalPostedId);
                }
                else
                {
                    arg = string.Format("{0}={1}", Uniconta.ClientTools.Localization.lookup("Account"), selectedItem.AccountName);
                }
                string vheader = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("VoucherTransactions"), arg);
                AddDockItem(TabControls.AccountsTransaction, dgInvTransGrid.syncEntity, vheader);
                break;

            case "TransInBOM":
                if (selectedItem != null && selectedItem._MovementType == (byte)InvMovementType.ReportAsFinished)
                {
                    string header = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("TransInBOM"), selectedItem._Item);
                    AddDockItem(TabControls.InventoryTransactions, dgInvTransGrid.syncEntity, header);
                }
                break;

            case "SeriesBatchInBom":
                if (selectedItem != null && selectedItem._MovementType == (byte)InvMovementType.ReportAsFinished)
                {
                    string header = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("SeriesBatchInBom"), selectedItem._Item);
                    AddDockItem(TabControls.InventoryTransactionStatement, selectedItem, header);
                }
                break;

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

            case "Invoice":
                if (selectedItem == null)
                {
                    return;
                }
                if (selectedItem._MovementType == (byte)InvMovementType.Debtor)
                {
                    var debtHeader = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("DebtorInvoice"), selectedItem._Item);
                    AddDockItem(TabControls.Invoices, selectedItem, debtHeader);
                }
                else if (selectedItem._MovementType == (byte)InvMovementType.Creditor)
                {
                    var credHeader = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("CreditorInvoice"), selectedItem._Item);
                    AddDockItem(TabControls.CreditorInvoice, selectedItem, credHeader);
                }
                break;

            case "ViewDownloadRow":
                if (selectedItem != null)
                {
                    DebtorTransactions.ShowVoucher(dgInvTransGrid.syncEntity, api, busyIndicator);
                }
                break;

            case "ProductionPosted":
                if (selectedItem != null)
                {
                    AddDockItem(TabControls.ProductionPostedGridPage, selectedItem, string.Format("{0}: {1}", Uniconta.ClientTools.Localization.lookup("ProductionPosted"), selectedItem._Item));
                }
                break;

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

            case "MarkOrderLineAgnstInvTrans":
                if (selectedItem?._Item == null)
                {
                    return;
                }
                object[] param = new object[] { selectedItem };
                AddDockItem(TabControls.InventoryTransactionsMarkedPage, param, true);
                break;

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }
示例#16
0
        private void localMenu_OnItemClicked(string ActionType)
        {
            CreditorTransClient selectedItem = dgCreditorTrans.SelectedItem as CreditorTransClient;

            switch (ActionType)
            {
            case "ViewDownloadRow":
                if (selectedItem != null)
                {
                    DebtorTransactions.ShowVoucher(dgCreditorTrans.syncEntity, api, busyIndicator);
                }
                break;

            case "Settlements":
                if (selectedItem != null)
                {
                    string header = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("Settlements"), selectedItem._Voucher);
                    AddDockItem(TabControls.CreditorSettlements, dgCreditorTrans.syncEntity, true, header);
                }
                break;

            case "VoucherTransactions":
                if (selectedItem != null)
                {
                    string vheader = string.Format("{0} ({1})", Uniconta.ClientTools.Localization.lookup("VoucherTransactions"), selectedItem._Voucher);
                    AddDockItem(TabControls.AccountsTransaction, dgCreditorTrans.syncEntity, vheader);
                }
                break;

            case "SaveGrid":
                Save();
                break;

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

            case "RefreshGrid":
                FilterGrid(gridControl, master == null, false);
                break;

            case "Invoices":
                if (selectedItem != null)
                {
                    string header = string.Format("{0}/{1}", Uniconta.ClientTools.Localization.lookup("CreditorInvoice"), selectedItem._Account);
                    AddDockItem(TabControls.CreditorInvoice, dgCreditorTrans.syncEntity, header);
                }
                break;

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

            default:
                gridRibbon_BaseActions(ActionType);
                break;
            }
        }