void SaveAttachment(GLTransClient selectedItem, VouchersClient doc) { CWForAllTrans cwconfirm = new CWForAllTrans(); cwconfirm.Closing += async delegate { if (cwconfirm.DialogResult == true) { if (selectedItem._DocumentRef != 0) { VoucherCache.RemoveGlobalVoucherCache(selectedItem.CompanyId, selectedItem._DocumentRef); } busyIndicator.IsBusy = true; var errorCodes = await postingApiInv.AddPhysicalVoucher(selectedItem, doc, cwconfirm.ForAllTransactions, cwconfirm.AppendDoc); busyIndicator.IsBusy = false; if (errorCodes == ErrorCodes.Succes) { BindGrid(); } else { UtilDisplay.ShowErrorCode(errorCodes); } } }; cwconfirm.Show(); }
async void SetNewDim(GLTransClient selectedItem, CWChangeDimension ChangeDimensionDialog) { var postingApiInv = this.postingApiInv; var nDim = postingApiInv.CompanyEntity.NumberOfDimensions; var accs = postingApiInv.CompanyEntity.GetCache(typeof(Uniconta.DataModel.GLAccount)); var acc = (Uniconta.DataModel.GLAccount)accs.Get(selectedItem._Account); if ((nDim >= 1 && ChangeDimensionDialog.Dimension1.HasValue && !acc.GetDimUsed(1)) || (nDim >= 2 && ChangeDimensionDialog.Dimension2.HasValue && !acc.GetDimUsed(2)) || (nDim >= 3 && ChangeDimensionDialog.Dimension3.HasValue && !acc.GetDimUsed(3)) || (nDim >= 4 && ChangeDimensionDialog.Dimension4.HasValue && !acc.GetDimUsed(4)) || (nDim >= 5 && ChangeDimensionDialog.Dimension5.HasValue && !acc.GetDimUsed(5))) { UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("NoDimActivedForAccount"), Uniconta.ClientTools.Localization.lookup("Information"), MessageBoxButton.OK); } busyIndicator.IsBusy = true; var errorCodes = await postingApiInv.SetNewDimensions(selectedItem, ChangeDimensionDialog.AllLine, ChangeDimensionDialog.Dimension1, ChangeDimensionDialog.Dimension2, ChangeDimensionDialog.Dimension3, ChangeDimensionDialog.Dimension4, ChangeDimensionDialog.Dimension5, ChangeDimensionDialog.GLAccount); busyIndicator.IsBusy = false; UtilDisplay.ShowErrorCode(errorCodes); if (errorCodes == ErrorCodes.Succes) { BindGrid(); } }
async private void JournalPosted(GLTransClient selectedItem) { var result = await api.Query(new GLDailyJournalPostedClient(), new UnicontaBaseEntity[] { selectedItem }, null); if (result != null && result.Length == 1) { CWGLPostedClientFormView cwPostedClient = new CWGLPostedClientFormView(result[0]); cwPostedClient.Show(); } }
async void SetChangeQuantity(GLTransClient selectedItem, CWChangeDimension ChangeTextDialog) { busyIndicator.IsBusy = true; var errorCodes = await postingApiInv.UpdateTransQty(selectedItem, ChangeTextDialog.Quantity, ChangeTextDialog.AllLine); busyIndicator.IsBusy = false; UtilDisplay.ShowErrorCode(errorCodes); if (errorCodes == ErrorCodes.Succes && ribbonControl != null) { BindGrid(); } }
async void SetChangeReference(GLTransClient selectedITem, CWChangeDimension ChangeReferenceDialog) { busyIndicator.IsBusy = true; var errorCodes = await postingApiInv.UpdateTransReference(selectedITem, ChangeReferenceDialog.Text, ChangeReferenceDialog.AllLine); busyIndicator.IsBusy = false; UtilDisplay.ShowErrorCode(errorCodes); if (errorCodes == ErrorCodes.Succes) { BindGrid(); } }
async void ShowVoucherInfo(GLTransClient voucherRef) { busyIndicator.IsBusy = true; var record = await api.Query <VouchersClient>(new UnicontaBaseEntity[] { voucherRef }, null); busyIndicator.IsBusy = false; if (record != null && record.Length > 0) { var voucherInfo = record[0]; var viewer = new CWDocumentViewer(voucherInfo); viewer.Show(); } }
private void AddVoucher(GLTransClient selectedItem, string actionType) { CWAddVouchers addVouchersDialog = null; #if !SILVERLIGHT if (actionType == "DragDrop") { var dragDropWindow = new UnicontaDragDropWindow(false); dragDropWindow.Closed += delegate { if (dragDropWindow.DialogResult == true) { var vouchersClient = new VouchersClient(); var fileInfo = dragDropWindow.FileInfoList?.SingleOrDefault(); if (fileInfo != null) { vouchersClient._Data = fileInfo.FileBytes; vouchersClient._Text = fileInfo.FileName; vouchersClient._Fileextension = DocumentConvert.GetDocumentType(fileInfo.FileExtension); } addVouchersDialog = new CWAddVouchers(api, vouchersClient, true); } }; dragDropWindow.Show(); } else #endif addVouchersDialog = new CWAddVouchers(api, false, null); if (addVouchersDialog == null) { return; } addVouchersDialog.Closed += delegate { if (addVouchersDialog.DialogResult == true) { if (addVouchersDialog.VoucherRowIds.Length > 0 && addVouchersDialog.vouchersClient != null) { SaveAttachment(selectedItem, addVouchersDialog.vouchersClient); } } }; addVouchersDialog.Show(); }
void SetNewAccount(GLTransClient selectedItem) { var cwObj = new CwEditTransaction(api, hideComments: true, hideVat: true, IsCreditor: (selectedItem._DCType == GLTransRefType.Creditor)); cwObj.Closed += async delegate { if (cwObj.DialogResult == true) { busyIndicator.IsBusy = true; var errorCodes = await postingApiInv.SetNewDCAccount(selectedItem, cwObj.DCAccount); busyIndicator.IsBusy = false; UtilDisplay.ShowErrorCode(errorCodes); if (errorCodes == ErrorCodes.Succes) { BindGrid(); } } }; cwObj.Show(); }
void AddVat(GLTransClient selectedItem) { var cwObj = new CwEditTransaction(api); cwObj.Closed += async delegate { if (cwObj.DialogResult == true) { busyIndicator.IsBusy = true; var errorCodes = await postingApiInv.AddVat(selectedItem, cwObj.Vat, cwObj.Comment); busyIndicator.IsBusy = false; UtilDisplay.ShowErrorCode(errorCodes); if (errorCodes == ErrorCodes.Succes) { BindGrid(); } } }; cwObj.Show(); }
void InvertSign(GLTransClient selectedItem) { CWConfirmationBox dialog = new CWConfirmationBox(Uniconta.ClientTools.Localization.lookup("AreYouSureToContinue"), Uniconta.ClientTools.Localization.lookup("Confirmation"), false, Uniconta.ClientTools.Localization.lookup("InvertSign")); dialog.Closing += async delegate { if (dialog.ConfirmationResult == CWConfirmationBox.ConfirmationResultEnum.Yes) { busyIndicator.IsBusy = true; var errorCodes = await postingApiInv.InvertSignOnVoucher(selectedItem); busyIndicator.IsBusy = false; UtilDisplay.ShowErrorCode(errorCodes); if (errorCodes == ErrorCodes.Succes) { BindGrid(); } } }; dialog.Show(); }
async void SetChangeDate(GLTransClient selectedItem, DateTime NewDate) { var date = selectedItem._Date; var jour = selectedItem._JournalPostedId; var voucher = selectedItem._Voucher; string dc = null; GLTransRefType DCType = 0; var lst = (IEnumerable <GLTrans>)dgAccountsTransGrid.ItemsSource; foreach (var rec in lst) { if (rec._DCType > 0 && rec._DCAccount != null && rec._JournalPostedId == jour && rec._Voucher == voucher && rec._Date == date) { if (dc == null) { dc = rec._DCAccount; DCType = rec._DCType; } /* * else if (rec._DCType != DCType && rec._DCAccount != dc) * { * UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("MoreThanOneDC"), Uniconta.ClientTools.Localization.lookup("Warning"), MessageBoxButton.OK); * return; * } */ } } busyIndicator.IsBusy = true; selectedItem._DCType = DCType; selectedItem._DCAccount = dc; var errorCodes = await postingApiInv.UpdateTransDate(selectedItem, NewDate); busyIndicator.IsBusy = false; UtilDisplay.ShowErrorCode(errorCodes); if (errorCodes == ErrorCodes.Succes) { foreach (var rec in lst) { if (rec._DCType > 0 && rec._DCAccount != null && rec._JournalPostedId == jour && rec._Voucher == voucher && rec._Date == date) { rec._Date = date; } } foreach (var rec in masterlist) { var post = rec as GLTrans; if (post != null) { post._Date = NewDate; } else { var post2 = rec as DCTrans; if (post2 != null) { post2._Date = NewDate; } else { var post3 = rec as DCTransOpen; if (post3 != null) { post3.Trans._Date = NewDate; } } } } dgAccountsTransGrid.RefreshData(); } }