protected void OK_SUBMIT_Click(object sender, EventArgs e)
        {
            PopupSubmitMRPList.ShowOnPageLoad = false;
            //ScriptManager.RegisterStartupScript(this.Page, typeof(string), "Resize", "changeWidth.resizeWidth();", true);
            //MRPClass.Submit_MRP(docNum.ToString(), Convert.ToInt32(PK), 1, entCode, buCode, Convert.ToInt32(Session["CreatorKey"]));

            MRPSubmitClass.MRP_Submit(docNum.ToString(), Convert.ToInt32(PK), dteCreated, 0, entCode, buCode, Convert.ToInt32(Session["CreatorKey"]));


            BindMRP(Convert.ToInt32(Session["viewAllMRP"]), Session["EntityCode"].ToString(), Session["BUCode"].ToString());

            MRPNotify.HeaderText        = "Info";
            MRPNotificationMessage.Text = "Successfully Submitted!";
            MRPNotify.ShowOnPageLoad    = true;

            //ASPxHiddenField text = MainTable.FindHeaderTemplateControl(MainTable.Columns[0], "MRPHiddenVal") as ASPxHiddenField;
            //text["hidden_value"] = "submitted";
        }
        protected void OK_SUBMIT_Click(object sender, EventArgs e)
        {
            CheckCreatorKey();

            if (MRPClass.MRP_Line_Status(mrp_key, wrkflwln) == 0)
            {
                bool isAllowed = false;
                if (GlobalClass.IsSuperAdmin(Convert.ToInt32(Session["CreatorKey"])))
                {
                    isAllowed = true;
                }
                else
                {
                    switch (wrkflwln)

                    {
                    case 1:
                    {
                        isAllowed = GlobalClass.IsAllowed(Convert.ToInt32(Session["CreatorKey"]), "MOPBULead", dateCreated, entitycode, buCode);
                        break;
                    }

                    case 2:
                    {
                        isAllowed = GlobalClass.IsAllowed(Convert.ToInt32(Session["CreatorKey"]), "MOPInventoryAnalyst", dateCreated);
                        break;
                    }

                    //case 3:
                    //    {
                    //        isAllowed = GlobalClass.IsAllowed(Convert.ToInt32(Session["CreatorKey"]), "MOPBudget_PerEntBU", dateCreated, entitycode, buCode);
                    //        break;
                    //    }
                    case 3:
                    {
                        isAllowed = GlobalClass.IsAllowed(Convert.ToInt32(Session["CreatorKey"]), "MOPInventoryAnalyst", dateCreated);
                        break;
                    }
                    }
                }


                if (isAllowed == true)
                {
                    PopupSubmitPreviewAnal.ShowOnPageLoad = false;
                    //MRPClass.Submit_MRP(docnumber.ToString(), mrp_key, wrkflwln + 1, entitycode, buCode, Convert.ToInt32(Session["CreatorKey"]));

                    //ScriptManager.RegisterStartupScript(this.Page, typeof(string), "Resize", "changeWidth.resizeWidth();", true);

                    MRPSubmitClass.MRP_Submit(docnumber.ToString(), mrp_key, dateCreated, wrkflwln, entitycode, buCode, Convert.ToInt32(Session["CreatorKey"]));

                    Submit.Enabled = false;

                    ModalPopupExtenderLoading.Hide();

                    MRPNotificationMessage.Text      = MRPClass.successfully_submitted;
                    MRPNotificationMessage.ForeColor = System.Drawing.Color.Black;
                    MRPNotify.HeaderText             = "Info";
                    MRPNotify.ShowOnPageLoad         = true;
                }
                else
                {
                    MRPNotificationMessage.Text      = "You have no permission to perform this command!" + Environment.NewLine + "Access Denied!";
                    MRPNotificationMessage.ForeColor = System.Drawing.Color.Red;
                    MRPNotify.HeaderText             = "Info";
                    MRPNotify.ShowOnPageLoad         = true;
                }
            }
            else
            {
                //ScriptManager.RegisterStartupScript(this.Page, typeof(string), "Resize", "changeWidth.resizeWidth();", true);
            }

            //}
        }
        protected void Submit_Click(object sender, EventArgs e)
        {
            CheckCreatorKey();

            iStatusKey = MRPClass.MRP_Line_Status(mrp_key, wrkflwln);

            //if (wrkflwln == 0)
            //{
            //    if (iStatusKey == 1)
            //    {

            //        //MRPClass.Submit_MRP(docnumber.ToString(), mrp_key, wrkflwln + 1, entitycode, buCode, Convert.ToInt32(Session["CreatorKey"]));
            //        PopupSubmit.ShowOnPageLoad = false;
            //        ScriptManager.RegisterStartupScript(this.Page, typeof(string), "Resize", "changeWidth.resizeWidth();", true);

            //        MRPSubmitClass.MRP_Submit(docnumber.ToString(), mrp_key, dateCreated, wrkflwln, entitycode, buCode, Convert.ToInt32(Session["CreatorKey"]));
            //        Load_MRP(docnumber);

            //        BindDirectMaterials(docnumber);
            //        BindOpex(docnumber);
            //        BindManPower(docnumber);
            //        BindCapex(docnumber);

            //        MRPNotificationMessage.Text = "Successfully Submitted";
            //        MRPNotify.HeaderText = "Info";
            //        MRPNotify.ShowOnPageLoad = true;

            //    }
            //    else
            //    {

            //        ScriptManager.RegisterStartupScript(this.Page, typeof(string), "Resize", "changeWidth.resizeWidth();", true);

            //        MRPNotificationMessage.Text = "Document already submitted to BU / SSU Lead for review.";
            //        MRPNotify.HeaderText = "Alert";
            //        MRPNotify.ShowOnPageLoad = true;
            //        //MRPNotify.
            //    }
            //}
            //else
            //{
            if (MRPClass.MRP_Line_Status(mrp_key, wrkflwln) == 0)
            {
                //MRPClass.Submit_MRP(docnumber.ToString(), mrp_key, wrkflwln + 1, entitycode, buCode, Convert.ToInt32(Session["CreatorKey"]));
                PopupSubmit.ShowOnPageLoad = false;
                //ScriptManager.RegisterStartupScript(this.Page, typeof(string), "Resize", "changeWidth.resizeWidth();", true);

                MRPSubmitClass.MRP_Submit(docnumber.ToString(), mrp_key, dateCreated, wrkflwln, entitycode, buCode, Convert.ToInt32(Session["CreatorKey"]));

                Load_MRP(docnumber);
                BindDirectMaterials(docnumber);
                BindOpex(docnumber);
                BindManPower(docnumber);
                BindCapex(docnumber);
                //BindRevenue(docnumber);

                MRPNotificationMessage.Text = "Successfully Submitted";
                MRPNotify.HeaderText        = "Info";
                MRPNotify.ShowOnPageLoad    = true;
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, typeof(string), "Resize", "changeWidth.resizeWidth();", true);

                MRPNotificationMessage.Text = "Document already submitted to Inventory Analyst for review.";
                MRPNotify.HeaderText        = "Alert";
                MRPNotify.ShowOnPageLoad    = true;
            }

            //}
        }