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; } }
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; } }
async void ShowVoucherInfo(GLTransClientTotal selectedItem) { busyIndicator.IsBusy = true; var record = await api.Query <VouchersClient>(new UnicontaBaseEntity[] { selectedItem }, null); busyIndicator.IsBusy = false; if (record != null && record.Length > 0) { var voucherInfo = record[0]; #if SILVERLIGHT var viewer = new CWDocumentViewer(voucherInfo); viewer.Show(); #endif } }
private void Initialize(UnicontaBaseEntity[] simulatedTransactions) { InitializeComponent(); dgSimulatedTran.api = api; if (simulatedTransactions != null && simulatedTransactions.Length > 0) { var lst = new GLTransClientTotal[simulatedTransactions.Length]; long total = 0, vouchertotal = 0; int i = 0; int voucher = 0; foreach (var t in (IEnumerable <GLTransClientTotal>)simulatedTransactions) { if (t._Voucher != voucher) { voucher = t._Voucher; if (vouchertotal != 0) { lst[i - 1]._VoucherTotal = vouchertotal; vouchertotal = 0; ShowVoucherTotal = true; } } vouchertotal += t._AmountCent; total += t._AmountCent; t._Total = total; lst[i++] = t; } if (vouchertotal != 0) { lst[i - 1]._VoucherTotal = vouchertotal; ShowVoucherTotal = true; } ShowTotal = (total != 0); dgSimulatedTran.ClearSorting(); dgSimulatedTran.SetSource(lst); } SetRibbonControl(localMenu, dgSimulatedTran); dgSimulatedTran.BusyIndicator = busyIndicator; localMenu.OnItemClicked += LocalMenu_OnItemClicked;; dgSimulatedTran.ShowTotalSummary(); LedgerCache = this.api.GetCache(typeof(GLAccount)); }