private void cmdAdd_Click(object sender, RoutedEventArgs e) { int type = 1; String caption = ""; if (docType == AccountDocumentType.AcctDocCashPurchase) { caption = CLanguage.getValue("purchase_cash"); if (!CHelper.VerifyAccessRight("PURCHASE_BYCASH_ADD")) { return; } } else if (docType == AccountDocumentType.AcctDocDebtPurchase) { caption = CLanguage.getValue("purchase_debt"); if (!CHelper.VerifyAccessRight("PURCHASE_BYCREDIT_ADD")) { return; } } else if (docType == AccountDocumentType.AcctDocDrNotePurchase) { type = 2; caption = CLanguage.getValue("purchase_debit_note"); if (!CHelper.VerifyAccessRight("PURCHASE_DRNOTE_ADD")) { return; } } else if (docType == AccountDocumentType.AcctDocCrNotePurchase) { type = 2; caption = CLanguage.getValue("purchase_credit_note"); if (!CHelper.VerifyAccessRight("PURCHASE_CRNOTE_ADD")) { return; } } else if (docType == AccountDocumentType.AcctDocApReceipt) { type = 3; caption = CLanguage.getValue("purchase_ap_receipt"); if (!CHelper.VerifyAccessRight("PURCHASE_RECEIPT_ADD")) { return; } } else if (docType == AccountDocumentType.AcctDocMiscExpense) { type = 4; caption = CLanguage.getValue("purchase_misc"); if (!CHelper.VerifyAccessRight("PURCHASE_MISC_ADD")) { return; } } if (type == 1) { WinAddEditAccountPurchaseDoc w = new WinAddEditAccountPurchaseDoc("A", docType, itemSources, (MAccountDoc)null); w.Caption = (String)(sender as Button).Content + " " + caption; w.ShowDialog(); w.ItemAddedHandler = ItemAddedEvent; if (w.IsPreviewNeed) { printPreview(null, w.CreatedID, docType); } } else if (type == 2) { WinAddEditDrCrNote w = new WinAddEditDrCrNote("A", docType, itemSources, null); w.Caption = (String)(sender as Button).Content + " " + caption; w.ShowDialog(); } else if (type == 3) { WinAddEditReceiptDoc w = new WinAddEditReceiptDoc("A", docType, itemSources, (MAccountDoc)null); w.Caption = (String)(sender as Button).Content + " " + caption; w.ShowDialog(); if (w.IsPreviewNeed) { printPreview(null, w.CreatedID, docType); } } else if (type == 4) { WinAddEditAccountMiscDoc w = new WinAddEditAccountMiscDoc("A", docType, itemSources, (MAccountDoc)null); w.Caption = (String)(sender as Button).Content + " " + caption; w.ShowDialog(); if (w.IsPreviewNeed) { printPreview(null, w.CreatedID, docType); } } }
public static void ShowEditWindowEx(AccountDocumentType dt, MAccountDoc actDoc, GenericAccountDocCallback printCallBack) { int type = 1; String caption = ""; if (dt == AccountDocumentType.AcctDocCashPurchase) { caption = CLanguage.getValue("purchase_cash"); if (!CHelper.VerifyAccessRight("PURCHASE_BYCASH_VIEW")) { return; } } else if (dt == AccountDocumentType.AcctDocDebtPurchase) { caption = CLanguage.getValue("purchase_debt"); if (!CHelper.VerifyAccessRight("PURCHASE_BYCREDIT_VIEW")) { return; } } else if (dt == AccountDocumentType.AcctDocDrNotePurchase) { type = 2; caption = CLanguage.getValue("purchase_debit_note"); if (!CHelper.VerifyAccessRight("PURCHASE_DRNOTE_VIEW")) { return; } } else if (dt == AccountDocumentType.AcctDocCrNotePurchase) { type = 2; caption = CLanguage.getValue("purchase_credit_note"); if (!CHelper.VerifyAccessRight("PURCHASE_CRNOTE_VIEW")) { return; } } else if (dt == AccountDocumentType.AcctDocApReceipt) { type = 3; caption = CLanguage.getValue("purchase_ap_receipt"); if (!CHelper.VerifyAccessRight("PURCHASE_RECEIPT_VIEW")) { return; } } else if (dt == AccountDocumentType.AcctDocMiscExpense) { type = 4; caption = CLanguage.getValue("purchase_misc"); if (!CHelper.VerifyAccessRight("PURCHASE_MISC_VIEW")) { return; } } MAccountDoc v = (MAccountDoc)actDoc; if (type == 1) { WinAddEditAccountPurchaseDoc w = new WinAddEditAccountPurchaseDoc("E", dt, null, v); w.Caption = CLanguage.getValue("edit") + " " + caption; w.ShowDialog(); if (w.IsPreviewNeed) { printCallBack?.Invoke(v, w.CreatedID, dt); } } else if (type == 2) { WinAddEditDrCrNote w = new WinAddEditDrCrNote("E", dt, null, v); w.Caption = CLanguage.getValue("edit") + caption; w.ShowDialog(); } else if (type == 3) { WinAddEditReceiptDoc w = new WinAddEditReceiptDoc("E", dt, null, v); w.Caption = CLanguage.getValue("edit") + " " + caption; w.ShowDialog(); if (w.IsPreviewNeed) { printCallBack?.Invoke(v, w.CreatedID, dt); } } else if (type == 4) { WinAddEditAccountMiscDoc w = new WinAddEditAccountMiscDoc("E", dt, null, v); w.Caption = CLanguage.getValue("edit") + " " + caption; w.ShowDialog(); if (w.IsPreviewNeed) { printCallBack?.Invoke(v, w.CreatedID, dt); } } }