private void mnuContextMenu_Click(object sender, RoutedEventArgs e)
        {
            MenuItem mnu  = (sender as MenuItem);
            string   name = mnu.Name;

            if (name.Equals("mnuEdit"))
            {
                showEditWindow();
            }
            else if (name.Equals("mnuCorrection"))
            {
                MLogImportIssue v    = (MLogImportIssue)currentObj;
                int             type = CUtil.StringToInt(v.DocumentType);

                String caption = "";

                if (type == (int)AccountDocumentType.AcctDocCashSale)
                {
                    caption = CLanguage.getValue("sale_cash_saling");
                    if (!CHelper.VerifyAccessRight("SALE_CSHSALE_ADD"))
                    {
                        return;
                    }
                }
                else if (type == (int)AccountDocumentType.AcctDocDebtSale)
                {
                    caption = CLanguage.getValue("sale_debt_saling");
                    if (!CHelper.VerifyAccessRight("SALE_DBTSALE_MENU"))
                    {
                        return;
                    }
                }

                WinAddEditAccountSaleDoc w = new WinAddEditAccountSaleDoc("E", (AccountDocumentType)type, null, v);
                w.Caption = CLanguage.getValue("bill_correction") + " " + caption;
                w.ShowDialog();
            }
        }
Esempio n. 2
0
        private void cmdAdd_Click(object sender, RoutedEventArgs e)
        {
            int    type    = 1;
            String caption = "";

            if (docType == AccountDocumentType.AcctDocCashSale)
            {
                caption = CLanguage.getValue("sale_cash_saling");
                if (!CHelper.VerifyAccessRight("SALE_BYCASH_ADD"))
                {
                    return;
                }
            }
            else if (docType == AccountDocumentType.AcctDocDebtSale)
            {
                caption = CLanguage.getValue("sale_debt_saling");
                if (!CHelper.VerifyAccessRight("SALE_BYCREDIT_ADD"))
                {
                    return;
                }
            }
            else if (docType == AccountDocumentType.AcctDocDrNote)
            {
                type    = 2;
                caption = CLanguage.getValue("sale_debit_note");
                if (!CHelper.VerifyAccessRight("SALE_DRNOTE_ADD"))
                {
                    return;
                }
            }
            else if (docType == AccountDocumentType.AcctDocCrNote)
            {
                type    = 2;
                caption = CLanguage.getValue("sale_credit_note");
                if (!CHelper.VerifyAccessRight("SALE_CRNOTE_ADD"))
                {
                    return;
                }
            }
            else if (docType == AccountDocumentType.AcctDocBillSummary)
            {
                type    = 6;
                caption = CLanguage.getValue("bill_summary");
                if (!CHelper.VerifyAccessRight("SALE_BILLSUM_ADD"))
                {
                    return;
                }
            }
            else if (docType == AccountDocumentType.AcctDocArReceipt)
            {
                type    = 3;
                caption = CLanguage.getValue("sale_ar_receipt");
                if (!CHelper.VerifyAccessRight("SALE_RECEIPT_ADD"))
                {
                    return;
                }
            }
            else if (docType == AccountDocumentType.AcctDocMiscRevenue)
            {
                type    = 4;
                caption = CLanguage.getValue("sale_misc");
                if (!CHelper.VerifyAccessRight("SALE_MISC_ADD"))
                {
                    return;
                }
            }
            else if (docType == AccountDocumentType.AcctDocCashDepositAr)
            {
                type    = 5;
                caption = CLanguage.getValue("cash_deposit_ar");
                if (!CHelper.VerifyAccessRight("SALE_DEPOSIT_ADD"))
                {
                    return;
                }
            }
            else if (docType == AccountDocumentType.AcctDocSaleOrder)
            {
                type    = 1;
                caption = CLanguage.getValue("sale_order");
                if (!CHelper.VerifyAccessRight("SALE_ORDER_ADD"))
                {
                    return;
                }
            }

            if (type == 1)
            {
                MAccountDoc ad = null;

                Boolean isPromotion = false;
                String  cpt         = caption;

                if (sender is MenuItem)
                {
                    MenuItem mnu = (MenuItem)sender;

                    if (mnu.Name.Equals("mnuAddWithPromotion"))
                    {
                        isPromotion = true;
                        cpt         = (String)mnu.Header + caption;
                    }
                    else if (mnu.Name.Equals("mnuAddFromQuotation"))
                    {
                        //Create from Quotation
                        ad = createSaleOrderFromQuotation();
                        if (ad == null)
                        {
                            return;
                        }

                        cpt = caption;
                    }
                    else if (mnu.Name.Equals("mnuAddWithSaleOrder"))
                    {
                        //Create from SaleOrder
                        ad = createInvoiceFromSaleOrder();
                        if (ad == null)
                        {
                            return;
                        }

                        cpt = caption;
                    }
                }

                WinAddEditAccountSaleDoc w = new WinAddEditAccountSaleDoc("A", docType, itemSources, ad, isPromotion);
                w.Caption = cpt;
                w.ShowDialog();
                w.ItemAddedHandler = ItemAddedEvent;
                if (w.IsPreviewNeed)
                {
                    WinFormPrinting wp = new WinFormPrinting(docTypeToReportGroup(docType), getAccountDocObject(w.CreatedID));
                    wp.ShowDialog();
                }
            }
            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();
                //w.ItemAddedHandler = ItemAddedEvent;
                if (w.IsPreviewNeed)
                {
                    WinFormPrinting wp = new WinFormPrinting(docTypeToReportGroup(docType), getAccountDocObject(w.CreatedID));
                    wp.ShowDialog();
                }
            }
            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)
                {
                    WinFormPrinting wp = new WinFormPrinting(docTypeToReportGroup(docType), getAccountDocObject(w.CreatedID));
                    wp.ShowDialog();
                }
            }
            else if (type == 5)
            {
                WinAddEditCashDeposit w = new WinAddEditCashDeposit("A", docType, itemSources, (MAccountDoc)null);
                //w.Caption = (String)(sender as Button).Content + " " + caption;
                w.ShowDialog();
            }
            else if (type == 6)
            {
                WinAddEditBillSummary w = new WinAddEditBillSummary("A", docType, itemSources, (MAccountDoc)null);
                w.Caption = (String)(sender as Button).Content + " " + caption;
                w.ShowDialog();
                //if (w.IsPreviewNeed)
                //{
                //    WinFormPrinting wp = new WinFormPrinting(docTypeToReportGroup(docType), getAccountDocObject(w.CreatedID));
                //    wp.ShowDialog();
                //}
            }
        }
Esempio n. 3
0
        public static void ShowEditWindowEx(AccountDocumentType docType, MAccountDoc v, GenericAccountDocCallback printCallBack)
        {
            int type = 1;

            String caption = "";

            if (docType == AccountDocumentType.AcctDocCashSale)
            {
                caption = CLanguage.getValue("sale_cash_saling");
                if (!CHelper.VerifyAccessRight("SALE_BYCASH_VIEW"))
                {
                    return;
                }
            }
            else if (docType == AccountDocumentType.AcctDocDebtSale)
            {
                caption = CLanguage.getValue("sale_debt_saling");
                if (!CHelper.VerifyAccessRight("SALE_BYCREDIT_VIEW"))
                {
                    return;
                }
            }
            else if (docType == AccountDocumentType.AcctDocDrNote)
            {
                type = 2;

                caption = CLanguage.getValue("sale_debit_note");
                if (!CHelper.VerifyAccessRight("SALE_DRNOTE_VIEW"))
                {
                    return;
                }
            }
            else if (docType == AccountDocumentType.AcctDocCrNote)
            {
                type = 2;

                caption = CLanguage.getValue("sale_credit_note");
                if (!CHelper.VerifyAccessRight("SALE_CRNOTE_VIEW"))
                {
                    return;
                }
            }
            else if (docType == AccountDocumentType.AcctDocArReceipt)
            {
                type    = 3;
                caption = CLanguage.getValue("sale_ar_receipt");
                if (!CHelper.VerifyAccessRight("SALE_RECEIPT_VIEW"))
                {
                    return;
                }
            }
            else if (docType == AccountDocumentType.AcctDocBillSummary)
            {
                type    = 6;
                caption = CLanguage.getValue("bill_summary");
                if (!CHelper.VerifyAccessRight("SALE_BILLSUM_VIEW"))
                {
                    return;
                }
            }
            else if (docType == AccountDocumentType.AcctDocMiscRevenue)
            {
                type    = 4;
                caption = CLanguage.getValue("sale_misc");
                if (!CHelper.VerifyAccessRight("SALE_MISC_VIEW"))
                {
                    return;
                }
            }
            else if (docType == AccountDocumentType.AcctDocCashDepositAr)
            {
                type    = 5;
                caption = CLanguage.getValue("cash_deposit_ar");
                if (!CHelper.VerifyAccessRight("SALE_DEPOSIT_VIEW"))
                {
                    return;
                }
            }
            else if (docType == AccountDocumentType.AcctDocSaleOrder)
            {
                type    = 1;
                caption = CLanguage.getValue("sale_order");
                if (!CHelper.VerifyAccessRight("SALE_ORDER_VIEW"))
                {
                    return;
                }
            }

            if (type == 1)
            {
                WinAddEditAccountSaleDoc w = new WinAddEditAccountSaleDoc("E", docType, null, v, v.IsPromotionMode);
                w.Caption = CLanguage.getValue("edit") + " " + caption;
                w.ShowDialog();

                if (w.IsPreviewNeed)
                {
                    printCallBack?.Invoke(v, w.CreatedID, docType);
                }
            }
            else if (type == 2)
            {
                WinAddEditDrCrNote w = new WinAddEditDrCrNote("E", docType, null, v);
                w.Caption = CLanguage.getValue("edit") + " " + caption;
                w.ShowDialog();
            }
            else if (type == 3)
            {
                WinAddEditReceiptDoc w = new WinAddEditReceiptDoc("E", docType, null, v);
                w.Caption = CLanguage.getValue("edit") + " " + caption;
                w.ShowDialog();

                if (w.IsPreviewNeed)
                {
                    printCallBack?.Invoke(v, w.CreatedID, docType);
                }
            }
            else if (type == 4)
            {
                WinAddEditAccountMiscDoc w = new WinAddEditAccountMiscDoc("E", docType, null, v);
                w.Caption = CLanguage.getValue("edit") + " " + caption;
                w.ShowDialog();

                if (w.IsPreviewNeed)
                {
                    printCallBack?.Invoke(v, w.CreatedID, docType);
                }
            }
            else if (type == 5)
            {
                WinAddEditCashDeposit w = new WinAddEditCashDeposit("E", docType, null, v);
                //w.Caption = CLanguage.getValue("edit") + " " + caption;
                w.ShowDialog();

                if (w.IsPreviewNeed)
                {
                    printCallBack?.Invoke(v, w.CreatedID, docType);
                }
            }
            else if (type == 6)
            {
                WinAddEditBillSummary w = new WinAddEditBillSummary("E", docType, null, v);
                w.Caption = CLanguage.getValue("edit") + " " + caption;
                w.ShowDialog();

                //if (w.IsPreviewNeed)
                //{
                //    printCallBack?.Invoke(v, w.CreatedID, docType);
                //}
            }
        }