protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ScriptManager.RegisterStartupScript(this.Page, typeof(string), "Resize", "changeWidth.resizeWidth();", true); //Session["mrp_docNum"] = docnumber.ToString(); //Session["mrp_wrkLine"] = wrkflwln.ToString(); //string docnumber = Request.Params["DocNum"].ToString(); string docnumber = Session["mrp_docNum"].ToString(); int source = Convert.ToInt32(Session["mrp_source"]); string query = "SELECT dbo.tbl_MRP_List.DocNumber, dbo.tbl_MRP_List.MRPMonth, dbo.tbl_MRP_List.MRPYear, dbo.tbl_MRP_List.DateCreated, dbo.vw_AXEntityTable.NAME AS EntityName, dbo.vw_AXOperatingUnitTable.NAME AS BU, dbo.tbl_Users.Firstname, dbo.tbl_Users.Lastname, dbo.tbl_MRP_Status.StatusName FROM dbo.tbl_MRP_List LEFT OUTER JOIN dbo.vw_AXEntityTable ON dbo.tbl_MRP_List.EntityCode = dbo.vw_AXEntityTable.ID LEFT OUTER JOIN dbo.vw_AXOperatingUnitTable ON dbo.tbl_MRP_List.BUCode = dbo.vw_AXOperatingUnitTable.OMOPERATINGUNITNUMBER LEFT OUTER JOIN dbo.tbl_Users ON dbo.tbl_MRP_List.CreatorKey = dbo.tbl_Users.PK LEFT OUTER JOIN dbo.tbl_MRP_Status ON dbo.tbl_MRP_List.StatusKey = dbo.tbl_MRP_Status.PK WHERE DocNumber = '" + docnumber + "'"; SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString()); conn.Open(); SqlCommand cmd = new SqlCommand(query, conn); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { DocNum.Text = reader["DocNumber"].ToString(); Month.Text = Convertion.INDEX_TO_MONTH(Convert.ToInt32(reader["MRPMonth"].ToString())); Year.Text = reader["MRPYear"].ToString(); Entity.Text = reader["EntityName"].ToString(); Department.Text = reader["BU"].ToString(); Status.Text = reader["StatusName"].ToString(); Creator.Text = EncryptionClass.Decrypt(reader["Firstname"].ToString()) + " " + EncryptionClass.Decrypt(reader["Lastname"].ToString()); DateCreated.Text = reader["DateCreated"].ToString(); } BindGrid(docnumber); } }
private void Load_MRP(string docnumber) { string query = "SELECT TOP (100) PERCENT tbl_MRP_List.*, vw_AXEntityTable.NAME AS EntityCodeDesc, vw_AXOperatingUnitTable.NAME AS BUCodeDesc, tbl_MRP_Status.StatusName, tbl_Users.Lastname, tbl_Users.Firstname FROM tbl_MRP_List LEFT OUTER JOIN tbl_Users ON tbl_MRP_List.CreatorKey = tbl_Users.PK LEFT OUTER JOIN vw_AXOperatingUnitTable ON tbl_MRP_List.BUCode = vw_AXOperatingUnitTable.OMOPERATINGUNITNUMBER LEFT OUTER JOIN tbl_MRP_Status ON tbl_MRP_List.StatusKey = tbl_MRP_Status.PK LEFT OUTER JOIN vw_AXEntityTable ON tbl_MRP_List.EntityCode = vw_AXEntityTable.ID WHERE dbo.tbl_MRP_List.DocNumber = '" + docnumber + "' ORDER BY dbo.tbl_MRP_List.DocNumber DESC"; SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString()); conn.Open(); SqlCommand cmd = new SqlCommand(query, conn); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { mrp_key = Convert.ToInt32(reader["PK"].ToString()); entitycode = reader["EntityCode"].ToString(); DocNum.Text = reader["DocNumber"].ToString(); DateCreated.Text = reader["DateCreated"].ToString(); EntityCode.Text = reader["EntityCodeDesc"].ToString(); BUCode.Text = reader["BUCodeDesc"].ToString(); buCode = reader["BUCode"].ToString(); Month.Text = MRPClass.Month_Name(Int32.Parse(reader["MRPMonth"].ToString())); Year.Text = reader["MRPYear"].ToString(); Status.Text = reader["StatusName"].ToString(); firstname = reader["Firstname"].ToString(); lastname = reader["Lastname"].ToString(); } reader.Close(); conn.Close(); Creator.Text = EncryptionClass.Decrypt(firstname) + " " + EncryptionClass.Decrypt(lastname); iStatusKey = MRPClass.MRP_Line_Status(mrp_key, wrkflwln); }
private void Load_MRP(string docnum) { //string query = "SELECT TOP (100) PERCENT dbo.tbl_MRP_List.PK, dbo.tbl_MRP_List.DocNumber, " + // " dbo.tbl_MRP_List.DateCreated, dbo.tbl_MRP_List.EntityCode, dbo.vw_AXEntityTable.NAME AS EntityCodeDesc, " + // " dbo.tbl_MRP_List.BUCode, dbo.vw_AXOperatingUnitTable.NAME AS BUCodeDesc, dbo.tbl_MRP_List.MRPMonth, " + // " dbo.tbl_MRP_List.MRPYear, dbo.tbl_MRP_List.StatusKey, dbo.tbl_MRP_Status.StatusName, " + // " dbo.tbl_MRP_List.CreatorKey, dbo.tbl_MRP_List.LastModified " + // " FROM dbo.tbl_MRP_List LEFT OUTER JOIN " + // " dbo.vw_AXOperatingUnitTable ON dbo.tbl_MRP_List.BUCode = dbo.vw_AXOperatingUnitTable.OMOPERATINGUNITNUMBER LEFT OUTER JOIN " + // " dbo.tbl_MRP_Status ON dbo.tbl_MRP_List.StatusKey = dbo.tbl_MRP_Status.PK LEFT OUTER JOIN " + // " dbo.vw_AXEntityTable ON dbo.tbl_MRP_List.EntityCode = dbo.vw_AXEntityTable.ID " + // " WHERE(dbo.tbl_MRP_List.DocNumber = '" + DocNum.Text.ToString().Trim() + "') " + // " ORDER BY dbo.tbl_MRP_List.DocNumber DESC"; string query = "SELECT tbl_MRP_List.*, " + " vw_AXEntityTable.NAME AS EntityCodeDesc, " + " vw_AXOperatingUnitTable.NAME AS BUCodeDesc, " + " tbl_MRP_Status.StatusName, tbl_Users.Lastname, " + " tbl_Users.Firstname, tbl_MRP_List.EntityCode, " + " tbl_MRP_List.BUCode " + " FROM tbl_MRP_List LEFT OUTER JOIN tbl_Users ON tbl_MRP_List.CreatorKey = tbl_Users.PK " + " LEFT OUTER JOIN vw_AXOperatingUnitTable ON tbl_MRP_List.BUCode = vw_AXOperatingUnitTable.OMOPERATINGUNITNUMBER " + " LEFT OUTER JOIN tbl_MRP_Status ON tbl_MRP_List.StatusKey = tbl_MRP_Status.PK " + " LEFT OUTER JOIN vw_AXEntityTable ON tbl_MRP_List.EntityCode = vw_AXEntityTable.ID " + " WHERE dbo.tbl_MRP_List.DocNumber = '" + docnum + "' " + " ORDER BY dbo.tbl_MRP_List.DocNumber DESC"; SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString()); conn.Open(); SqlCommand cmd = new SqlCommand(query, conn); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { DocNum.Text = reader["DocNumber"].ToString(); //DateCreated.Text = reader["DateCreated"].ToString(); dateCreated = Convert.ToDateTime(reader["DateCreated"]); mrp_key = Convert.ToInt32(reader["PK"]); entitycode = reader["EntityCode"].ToString(); EntityCode.Text = reader["EntityCodeDesc"].ToString(); buCode = reader["BUCode"].ToString(); BUCode.Text = reader["BUCodeDesc"].ToString(); Month.Text = MRPClass.Month_Name(Int32.Parse(reader["MRPMonth"].ToString())); Year.Text = reader["MRPYear"].ToString(); //Status.Text = reader["StatusName"].ToString(); Creator.Text = EncryptionClass.Decrypt(reader["Firstname"].ToString()) + " " + EncryptionClass.Decrypt(reader["Lastname"].ToString()); Status.Text = reader["StatusName"].ToString(); } reader.Close(); conn.Close(); iStatusKey = MRPClass.MRP_ApprvLine_Status(mrp_key, appflwln); StatusHidden["hidden_preview_iStatusKey"] = iStatusKey; WorkLineHidden["hidden_preview_wrkflwln"] = appflwln; BindAll(); }
protected void FloatCallbackPanel_Callback(object sender, CallbackEventArgsBase e) { //string type = e.Parameter.Substring(0, e.Parameter.IndexOf("-")); //int PK = Convert.ToInt32(e.Parameter.Substring(e.Parameter.IndexOf("-") + 1, e.Parameter.Length - (e.Parameter.IndexOf("-") + 1))); dvMOPSidePanel.Visible = false; dvItemSidePanel.Visible = false; string param = e.Parameter; string[] arrParam = param.Split('^'); string type = arrParam[0].ToString(); //MRPClass.PrintString(type + " - " + PK.ToString() + " - " + sEntCode + " - " + sBuCode + " - " + arrParam[4].ToString()) ; string description = "Description"; string descdata = "", sItemCode = ""; //SqlCommand cmd = new SqlCommand(); string query_1 = ""; string query_2 = ""; SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString()); conn.Open(); DataTable dt = new DataTable(); SqlCommand cmd = null; SqlDataAdapter adp; if (type == "MOPList") { dvMOPSidePanel.Visible = true; int mopKey = Convert.ToInt32(arrParam[1].ToString()); string mopNum = ""; query_1 = "SELECT tbl_MRP_List.* FROM tbl_MRP_List WHERE (PK = " + mopKey + ")"; cmd = new SqlCommand(query_1); cmd.Connection = conn; adp = new SqlDataAdapter(cmd); adp.Fill(dt); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { mopNum = row["DocNumber"].ToString(); MOPDucNumber.Text = row["DocNumber"].ToString(); DataTable dtRecord = MRPClass.POListDetails(mopNum); grdMOPPOList.DataSource = dtRecord; grdMOPPOList.DataBind(); } } dt.Clear(); } else { dvItemSidePanel.Visible = true; int PK = Convert.ToInt32(arrParam[1]); string sEntCode = arrParam[2].ToString(); string sBuCode = arrParam[3].ToString(); List <object> fieldValues = new List <object>(); //this is for comment section ArrayList loggersFirstName = new ArrayList(); ArrayList loggersLastName = new ArrayList(); ArrayList logsArr = new ArrayList(); switch (type) { case materialsIdentifier: //ASPxGridView grid = DirectMaterialsGrid as ASPxGridView; //ASPxTextBox txtid = (ASPxTextBox)ContentPlaceHolder1.FindControl("txtTest"); //ASPxGridView grid = (ASPxGridView)ContentPlaceHolder1.FindControl("DirectMaterialsGrid"); if (PK == 0) { sItemCode = arrParam[4].ToString(); query_1 = "SELECT ITEMID, NAMEALIAS " + " FROM dbo.vw_AXInventTable " + " WHERE(DATAAREAID = '" + sEntCode + "') " + " AND(ITEMID = '" + sItemCode + "')"; cmd = new SqlCommand(query_1); cmd.Connection = conn; adp = new SqlDataAdapter(cmd); adp.Fill(dt); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { lblItemCode.Text = row["ITEMID"].ToString(); lblDescription.Text = row["NAMEALIAS"].ToString(); DataTable dtRecord = ItemInfoClass.Item_Invent_OnHand(sEntCode, lblItemCode.Text); grdOnHand.DataSource = dtRecord; grdOnHand.DataBind(); DataTable dtRecord1 = ItemInfoClass.Item_Pending_PO(sEntCode, sBuCode, lblItemCode.Text); grdPendingPO.DataSource = dtRecord1; grdPendingPO.DataBind(); DataTable dtRecord2 = ItemInfoClass.Item_Inventory_Movement(sEntCode, sBuCode, lblItemCode.Text); grdInventMovement.DataSource = dtRecord2; grdInventMovement.DataBind(); } } dt.Clear(); } else { query_1 = "SELECT [ItemDescription], [ItemCode] FROM [dbo].[tbl_MRP_List_DirectMaterials] where [PK] = '" + PK + "'"; cmd = new SqlCommand(query_1); cmd.Connection = conn; adp = new SqlDataAdapter(cmd); adp.Fill(dt); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { descdata = row["ItemDescription"].ToString(); lblItemCode.Text = row["ItemCode"].ToString(); lblDescription.Text = row["ItemDescription"].ToString(); DataTable dtRecord = ItemInfoClass.Item_Invent_OnHand(sEntCode, lblItemCode.Text); grdOnHand.DataSource = dtRecord; grdOnHand.DataBind(); DataTable dtRecord1 = ItemInfoClass.Item_Pending_PO(sEntCode, sBuCode, lblItemCode.Text); grdPendingPO.DataSource = dtRecord1; grdPendingPO.DataBind(); DataTable dtRecord2 = ItemInfoClass.Item_Inventory_Movement(sEntCode, sBuCode, lblItemCode.Text); grdInventMovement.DataSource = dtRecord2; grdInventMovement.DataBind(); } } dt.Clear(); //cmd = new SqlCommand(query_1, conn); //SqlDataReader reader = cmd.ExecuteReader(); //while (reader.Read()) //{ // descdata = reader[0].ToString(); // lblItemCode.Text = reader[1].ToString(); // lblDescription.Text = reader[0].ToString(); // DataTable dtRecord = ItemInfoClass.Item_Invent_OnHand(sEntCode, lblItemCode.Text); // grdOnHand.DataSource = dtRecord; // grdOnHand.DataBind(); //} //reader.Close(); } query_2 = "SELECT tbl_MRP_List_DirectMaterials_Logs.Remarks, tbl_Users.Firstname, tbl_Users.Lastname FROM tbl_MRP_List_DirectMaterials_Logs LEFT OUTER JOIN tbl_Users ON tbl_MRP_List_DirectMaterials_Logs.UserKey = tbl_Users.PK WHERE MasterKey = '" + PK + "'"; cmd = new SqlCommand(query_2); cmd.Connection = conn; adp = new SqlDataAdapter(cmd); adp.Fill(dt); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { logsArr.Add(row["Remarks"].ToString()); loggersFirstName.Add(row["Firstname"].ToString()); loggersLastName.Add(row["Lastname"].ToString()); } } dt.Clear(); //cmd = new SqlCommand(query_2, conn); //SqlDataReader reader = cmd.ExecuteReader(); //reader = cmd.ExecuteReader(); //while (reader.Read()) //{ // logsArr.Add(reader[0].ToString()); // loggersFirstName.Add(reader[1].ToString()); // loggersLastName.Add(reader[2].ToString()); //} //reader.Close(); break; case opexIdentifier: //ASPxGridView grid1 = (ASPxGridView)ContentPlaceHolder1.FindControl("DirectMaterialsGrid"); if (PK == 0) { sItemCode = arrParam[4].ToString(); query_1 = "SELECT ITEMID, NAMEALIAS " + " FROM dbo.vw_AXInventTable " + " WHERE(DATAAREAID = '" + sEntCode + "') " + " AND(ITEMID = '" + sItemCode + "')"; cmd = new SqlCommand(query_1); cmd.Connection = conn; adp = new SqlDataAdapter(cmd); adp.Fill(dt); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { lblItemCode.Text = row["ITEMID"].ToString(); lblDescription.Text = row["NAMEALIAS"].ToString(); DataTable dtRecord = ItemInfoClass.Item_Invent_OnHand(sEntCode, lblItemCode.Text); grdOnHand.DataSource = dtRecord; grdOnHand.DataBind(); DataTable dtRecord1 = ItemInfoClass.Item_Pending_PO(sEntCode, sBuCode, lblItemCode.Text); grdPendingPO.DataSource = dtRecord1; grdPendingPO.DataBind(); DataTable dtRecord2 = ItemInfoClass.Item_Inventory_Movement(sEntCode, sBuCode, lblItemCode.Text); grdInventMovement.DataSource = dtRecord2; grdInventMovement.DataBind(); } } dt.Clear(); } else { query_1 = "SELECT [Description], [ItemCode] FROM [dbo].[tbl_MRP_List_OPEX] where [PK] = '" + PK + "'"; cmd = new SqlCommand(query_1); cmd.Connection = conn; adp = new SqlDataAdapter(cmd); adp.Fill(dt); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { descdata = row["Description"].ToString(); lblItemCode.Text = row["ItemCode"].ToString(); lblDescription.Text = row["Description"].ToString(); DataTable dtRecord = ItemInfoClass.Item_Invent_OnHand(sEntCode, lblItemCode.Text); grdOnHand.DataSource = dtRecord; grdOnHand.DataBind(); DataTable dtRecord1 = ItemInfoClass.Item_Pending_PO(sEntCode, sBuCode, lblItemCode.Text); grdPendingPO.DataSource = dtRecord1; grdPendingPO.DataBind(); DataTable dtRecord2 = ItemInfoClass.Item_Inventory_Movement(sEntCode, sBuCode, lblItemCode.Text); grdInventMovement.DataSource = dtRecord2; grdInventMovement.DataBind(); } } dt.Clear(); } query_2 = "SELECT tbl_MRP_List_OPEX_Logs.Remarks, tbl_Users.Firstname, tbl_Users.Lastname FROM tbl_MRP_List_OPEX_Logs LEFT OUTER JOIN tbl_Users ON tbl_MRP_List_OPEX_Logs.UserKey = tbl_Users.PK WHERE MasterKey = '" + PK + "'"; cmd = new SqlCommand(query_2); cmd.Connection = conn; adp = new SqlDataAdapter(cmd); adp.Fill(dt); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { logsArr.Add(row["Remarks"].ToString()); loggersFirstName.Add(row["Firstname"].ToString()); loggersLastName.Add(row["Lastname"].ToString()); } } dt.Clear(); break; case manpowerIdentifier: query_1 = "SELECT [Description] FROM [dbo].[tbl_MRP_List_ManPower] where [PK] = '" + PK + "'"; cmd = new SqlCommand(query_1); cmd.Connection = conn; adp = new SqlDataAdapter(cmd); adp.Fill(dt); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { descdata = row["Description"].ToString(); lblItemCode.Text = ""; //reader[1].ToString(); lblDescription.Text = row["Description"].ToString(); } } dt.Clear(); query_2 = "SELECT tbl_MRP_List_ManPower_Logs.Remarks, tbl_Users.Firstname, tbl_Users.Lastname FROM tbl_MRP_List_ManPower_Logs LEFT OUTER JOIN tbl_Users ON tbl_MRP_List_ManPower_Logs.UserKey = tbl_Users.PK WHERE MasterKey = '" + PK + "'"; cmd = new SqlCommand(query_2); cmd.Connection = conn; adp = new SqlDataAdapter(cmd); adp.Fill(dt); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { logsArr.Add(row["Remarks"].ToString()); loggersFirstName.Add(row["Firstname"].ToString()); loggersLastName.Add(row["Lastname"].ToString()); } } dt.Clear(); break; case capexIdentifier: query_1 = "SELECT [Description] FROM [dbo].[tbl_MRP_List_CAPEX] where [PK] = '" + PK + "'"; cmd = new SqlCommand(query_1); cmd.Connection = conn; adp = new SqlDataAdapter(cmd); adp.Fill(dt); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { descdata = row["Description"].ToString(); lblItemCode.Text = ""; //reader[1].ToString(); lblDescription.Text = row["Description"].ToString(); } } dt.Clear(); query_2 = "SELECT tbl_MRP_List_CAPEX_Logs.Remarks, tbl_Users.Firstname, tbl_Users.Lastname FROM tbl_MRP_List_CAPEX_Logs LEFT OUTER JOIN tbl_Users ON tbl_MRP_List_CAPEX_Logs.UserKey = tbl_Users.PK WHERE MasterKey = '" + PK + "'"; cmd = new SqlCommand(query_2); cmd.Connection = conn; adp = new SqlDataAdapter(cmd); adp.Fill(dt); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { logsArr.Add(row["Remarks"].ToString()); loggersFirstName.Add(row["Firstname"].ToString()); loggersLastName.Add(row["Lastname"].ToString()); } } dt.Clear(); break; case revenueIdentifier: query_1 = "SELECT [FarmName] FROM [dbo].[tbl_MRP_List_RevenueAssumptions] where [PK] = '" + PK + "'"; cmd = new SqlCommand(query_1); cmd.Connection = conn; adp = new SqlDataAdapter(cmd); adp.Fill(dt); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { descdata = row["FarmName"].ToString(); lblItemCode.Text = ""; //reader[1].ToString(); lblDescription.Text = row["FarmName"].ToString(); } } dt.Clear(); query_2 = "SELECT tbl_MRP_List_RevenueAssumptions_Logs.Remarks, tbl_Users.Firstname, tbl_Users.Lastname FROM tbl_Users LEFT OUTER JOIN tbl_MRP_List_RevenueAssumptions_Logs ON tbl_Users.PK = tbl_MRP_List_RevenueAssumptions_Logs.UserKey WHERE MasterKey = '" + PK + "'"; cmd = new SqlCommand(query_2); cmd.Connection = conn; adp = new SqlDataAdapter(cmd); adp.Fill(dt); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { logsArr.Add(row["Remarks"].ToString()); loggersFirstName.Add(row["Firstname"].ToString()); loggersLastName.Add(row["Lastname"].ToString()); } } dt.Clear(); break; } for (int i = 0; i < loggersFirstName.Count; i++) { string fname = EncryptionClass.Decrypt(loggersFirstName[i].ToString()); loggersFirstName[i] = fname; string lname = EncryptionClass.Decrypt(loggersLastName[i].ToString()); loggersLastName[i] = lname; } } conn.Close(); }
protected void Page_Load(object sender, EventArgs e) { CheckCreatorKey(); if (!Page.IsPostBack) { //Rsize ScriptManager.RegisterStartupScript(this.Page, typeof(string), "Resize", "changeWidth.resizeWidth();", true); docnumber = Request.Params["DocNum"].ToString(); string query = "SELECT TOP (100) PERCENT tbl_MRP_List.*, vw_AXEntityTable.NAME AS EntityCodeDesc, vw_AXOperatingUnitTable.NAME AS BUCodeDesc, tbl_MRP_Status.StatusName, tbl_Users.Lastname, tbl_Users.Firstname FROM tbl_MRP_List LEFT OUTER JOIN tbl_Users ON tbl_MRP_List.CreatorKey = tbl_Users.PK LEFT OUTER JOIN vw_AXOperatingUnitTable ON tbl_MRP_List.BUCode = vw_AXOperatingUnitTable.OMOPERATINGUNITNUMBER LEFT OUTER JOIN tbl_MRP_Status ON tbl_MRP_List.StatusKey = tbl_MRP_Status.PK LEFT OUTER JOIN vw_AXEntityTable ON tbl_MRP_List.EntityCode = vw_AXEntityTable.ID WHERE dbo.tbl_MRP_List.DocNumber = '" + docnumber + "' ORDER BY dbo.tbl_MRP_List.DocNumber DESC"; SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString()); conn.Open(); string firstname = "", lastname = ""; SqlCommand cmd = new SqlCommand(query, conn); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { mrp_key = Convert.ToInt32(reader["PK"].ToString()); entitycode = reader["EntityCode"].ToString(); DocNum.Text = reader["DocNumber"].ToString(); DateCreated.Text = reader["DateCreated"].ToString(); EntityCode.Text = reader["EntityCodeDesc"].ToString(); BUCode.Text = reader["BUCodeDesc"].ToString(); Month.Text = MRPClass.Month_Name(Int32.Parse(reader["MRPMonth"].ToString())); Year.Text = reader["MRPYear"].ToString(); Status.Text = reader["StatusName"].ToString(); firstname = reader["Firstname"].ToString(); lastname = reader["Lastname"].ToString(); } reader.Close(); conn.Close(); Creator.Text = EncryptionClass.Decrypt(firstname) + " " + EncryptionClass.Decrypt(lastname); DirectMaterialsRoundPanel.HeaderText = "[" + DocNum.Text.ToString().Trim() + "] Direct Materials"; OpexRoundPanel.HeaderText = "[" + DocNum.Text.ToString().Trim() + "] Operational Expense"; ManpowerRoundPanel.HeaderText = "[" + DocNum.Text.ToString().Trim() + "] Man Power"; CapexRoundPanel.HeaderText = "[" + DocNum.Text.ToString().Trim() + "] Capital Expenditure"; DirectMaterialsRoundPanel.Font.Bold = true; OpexRoundPanel.Font.Bold = true; ManpowerRoundPanel.Font.Bold = true; CapexRoundPanel.Font.Bold = true; DirectMaterialsRoundPanel.Collapsed = true; OpexRoundPanel.Collapsed = true; ManpowerRoundPanel.Collapsed = true; CapexRoundPanel.Collapsed = true; ASPxPageControl1.Font.Bold = true; ASPxPageControl1.Font.Size = 12; } BindDirectMaterials(docnumber); BindOpex(docnumber); BindManPower(docnumber); BindCapex(docnumber); }
private void Load_MRP(string docnumber) { string query = "SELECT tbl_MRP_List.*, " + " vw_AXEntityTable.NAME AS EntityCodeDesc, " + " vw_AXOperatingUnitTable.NAME AS BUCodeDesc, " + " tbl_MRP_Status.StatusName, tbl_Users.Lastname, " + " tbl_Users.Firstname, tbl_MRP_List.EntityCode, " + " tbl_MRP_List.BUCode " + " FROM tbl_MRP_List LEFT OUTER JOIN tbl_Users ON tbl_MRP_List.CreatorKey = tbl_Users.PK " + " LEFT OUTER JOIN vw_AXOperatingUnitTable ON tbl_MRP_List.BUCode = vw_AXOperatingUnitTable.OMOPERATINGUNITNUMBER " + " LEFT OUTER JOIN tbl_MRP_Status ON tbl_MRP_List.StatusKey = tbl_MRP_Status.PK " + " LEFT OUTER JOIN vw_AXEntityTable ON tbl_MRP_List.EntityCode = vw_AXEntityTable.ID " + " WHERE dbo.tbl_MRP_List.DocNumber = '" + docnumber + "' " + " ORDER BY dbo.tbl_MRP_List.DocNumber DESC"; SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString()); conn.Open(); SqlCommand cmd = new SqlCommand(query, conn); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { //DocNum.Text = reader["DocNumber"].ToString(); //DateCreated.Text = reader["DateCreated"].ToString(); mrp_key = Convert.ToInt32(reader["PK"]); entitycode = reader["EntityCode"].ToString(); dateCreated = Convert.ToDateTime(reader["DateCreated"]); EntityCode.Text = reader["EntityCodeDesc"].ToString(); buCode = reader["BUCode"].ToString(); BUCode.Text = reader["BUCodeDesc"].ToString(); Month.Text = MRPClass.Month_Name(Int32.Parse(reader["MRPMonth"].ToString())); Year.Text = reader["MRPYear"].ToString(); Creator.Text = EncryptionClass.Decrypt(reader["Firstname"].ToString()) + " " + EncryptionClass.Decrypt(reader["Lastname"].ToString()); Status.Text = reader["StatusName"].ToString(); //Status.Text = reader["StatusName"].ToString(); } reader.Close(); conn.Close(); iStatusKey = MRPClass.MRP_Line_Status(mrp_key, wrkflwln); StatusHidden["hidden_preview_iStatusKey"] = iStatusKey; WrkFlowHidden["hidden_preview_wrkflwln"] = wrkflwln; //MRPClass.PrintString(entitycode); string docnum = DocNum.Text.ToString(); RevListView.DataSource = Preview.Preview_Revenue(docnum, entitycode); RevListView.DataBind(); TARevenue.InnerText = Preview.preview_total_revenue(docnum); SummaryListView.DataSource = Preview.MRP_PrevTotalSummary(DocNum.Text.ToString(), entitycode); SummaryListView.DataBind(); TotalSummary.InnerText = Preview.Prev_Summary_Total(); DMListView.DataSource = Preview.Preview_DM(DocNum.Text.ToString(), entitycode); DMListView.DataBind(); TotalDM.InnerText = Preview.preview_total_directmaterials(docnum); TotalEDM.InnerText = Preview.preview_requestedtotal_directmaterials(docnum); OpexListView.DataSource = Preview.Preview_OP(DocNum.Text.ToString(), entitycode); OpexListView.DataBind(); TotalOpex.InnerText = Preview.preview_total_opex(docnum); TotalEOpex.InnerText = Preview.preview_requestedtotal_opex(docnum); ManListView.DataSource = Preview.Preview_MAN(DocNum.Text.ToString(), entitycode); ManListView.DataBind(); TotalManpower.InnerText = Preview.preview_total_manpower(docnum); TotalEManpower.InnerText = Preview.preview_requestedtotal_manpower(docnum); CapexListView.DataSource = Preview.Preview_CA(docnum, entitycode); CapexListView.DataBind(); TotalCapex.InnerText = Preview.preview_total_capex(docnum); TotalECapex.InnerText = Preview.preview_requestedtotal_capex(docnum); }
private void Load_MRP(string docnumber) { ASPxHiddenField hidStatusKey = Page.FindControl("StatusKey") as ASPxHiddenField; string query = "SELECT tbl_MRP_List.*, " + " vw_AXEntityTable.NAME AS EntityCodeDesc, " + " vw_AXOperatingUnitTable.NAME AS BUCodeDesc, " + " tbl_MRP_Status.StatusName, tbl_Users.Lastname, " + " tbl_Users.Firstname, tbl_MRP_List.EntityCode, " + " tbl_MRP_List.BUCode " + " FROM tbl_MRP_List LEFT OUTER JOIN tbl_Users ON tbl_MRP_List.CreatorKey = tbl_Users.PK " + " LEFT OUTER JOIN vw_AXOperatingUnitTable ON tbl_MRP_List.BUCode = vw_AXOperatingUnitTable.OMOPERATINGUNITNUMBER " + " LEFT OUTER JOIN tbl_MRP_Status ON tbl_MRP_List.StatusKey = tbl_MRP_Status.PK " + " LEFT OUTER JOIN vw_AXEntityTable ON tbl_MRP_List.EntityCode = vw_AXEntityTable.ID " + " WHERE dbo.tbl_MRP_List.DocNumber = '" + docnumber + "' " + " ORDER BY dbo.tbl_MRP_List.DocNumber DESC"; SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString()); conn.Open(); string firstname = "", lastname = ""; SqlCommand cmd = new SqlCommand(query, conn); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { mrp_key = Convert.ToInt32(reader["PK"].ToString()); entitycode = reader["EntityCode"].ToString(); DocNum.Text = reader["DocNumber"].ToString(); DateCreated.Text = reader["DateCreated"].ToString(); dateCreated = Convert.ToDateTime(reader["DateCreated"]); EntityCode.Text = reader["EntityCodeDesc"].ToString(); BUCode.Text = reader["BUCodeDesc"].ToString(); Month.Text = MRPClass.Month_Name(Int32.Parse(reader["MRPMonth"].ToString())); Year.Text = reader["MRPYear"].ToString(); Status.Text = reader["StatusName"].ToString(); iStatusKey = Convert.ToInt32(reader["StatusKey"]); firstname = reader["Firstname"].ToString(); lastname = reader["Lastname"].ToString(); entitycode = reader["EntityCode"].ToString(); Entity.Text = reader["EntityCode"].ToString(); BU.Text = reader["BUCode"].ToString(); buCode = reader["BUCode"].ToString(); Creator.Text = EncryptionClass.Decrypt(firstname) + " " + EncryptionClass.Decrypt(lastname); } reader.Close(); iStatusKey = MRPClass.MRP_Line_Status(mrp_key, wrkflwln); WorkFlowLineLbl.Text = wrkflwln.ToString(); WorkFlowLineTxt.Text = wrkflwln.ToString(); StatusKeyLbl.Text = iStatusKey.ToString(); StatusKeyTxt.Text = iStatusKey.ToString(); Creator.Text = EncryptionClass.Decrypt(firstname) + " " + EncryptionClass.Decrypt(lastname); DirectMaterialsRoundPanel.HeaderText = "[" + DocNum.Text.ToString().Trim() + "] Direct Materials"; OpexRoundPanel.HeaderText = "[" + DocNum.Text.ToString().Trim() + "] Operational Expense"; ManpowerRoundPanel.HeaderText = "[" + DocNum.Text.ToString().Trim() + "] Man Power"; CapexRoundPanel.HeaderText = "[" + DocNum.Text.ToString().Trim() + "] Capital Expenditure"; //ASPxPageControl pageControl = grid.FindEditFormTemplateControl("RevenuePageControl") as ASPxPageControl; ASPxHiddenField hfwrkLine = ASPxPageControl1.FindControl("ASPxHiddenFieldDMWrkFlwLnInventAnal") as ASPxHiddenField; ASPxHiddenField hfstatKey = ASPxPageControl1.FindControl("ASPxHiddenFieldDMStatusKeyInventAnal") as ASPxHiddenField; hfwrkLine["hidden_value"] = wrkflwln.ToString(); hfstatKey["hidden_value"] = iStatusKey.ToString(); }