protected void btnAllOfferReceieved_Click(object sender, EventArgs e) { LinkButton btn = (LinkButton)sender; objWorkFlow = new WorkFlow(); objWorkFlow.WFID = Convert.ToInt32(btn.CommandArgument); objWorkFlow.UserId = Request.QueryString["u"]; objWorkFlow.WF_Status = "All Offer Received"; int res = objWorkFlow.UpdateWF_Status(); objWorkFlow.UpdateWF_StatusInBAANTable(); // Dump Preorder Data TO BAAN table change 25/08/2018 sagar if (res > 0) { InsertPreHistory(Convert.ToInt32(btn.CommandArgument), "All Offer Received"); // GetData(); //ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Status Changed to All Offer Received');", true); } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Some technical issue');", true); } DataTable dt12 = objWorkFlow.GetWFById(); if (dt12.Rows.Count > 0) { foreach (DataRow dr12 in dt12.Rows) { objWorkFlow.Project = dr12["Project"].ToString().Substring(0, 6); } } string WFID = objWorkFlow.WFID.ToString(); string PMDLDocNo = ""; string PMDLDocs = ""; DataTable dtPMDL = objWorkFlow.GetMultiPMDL(WFID); if (dtPMDL.Rows.Count > 0) { foreach (DataRow dr in dtPMDL.Rows) { objWorkFlow.PMDLdocDesc = dr["PMDLDocNo"].ToString(); DataTable dataTable = objWorkFlow.GetRaisedEnquiryDate(); if (dataTable.Rows.Count > 0) { objWorkFlow.ItemReference = (string)dataTable.Rows[0]["t_iref"]; string Itemref_Typ = objWorkFlow.GetItemRefType(); DataTable dtPMDLbyWFID = objWorkFlow.GetPMDLbyWFID(); if (dtPMDLbyWFID.Rows.Count > 0) { for (int i = 0; i < dtPMDLbyWFID.Rows.Count; i++) { if (i == 0) { PMDLDocNo = "'" + dtPMDLbyWFID.Rows[0]["PMDLDocNo"].ToString() + "'"; } else { PMDLDocNo += ",'" + dtPMDLbyWFID.Rows[i]["PMDLDocNo"].ToString() + "'"; } } } // objWorkFlow.UpdateAllTechOfferReceived(); //earlier TechOfferReceieved percentage is to be set to 100 now logic change- //change date - 14-09-2018 #region Progress Update of Offer Received Percentage on All Offer Received button click double nOfferReceiveDrawing_Count = 0; double nOfferReceivedDrawing_Weight = 0; double nTotalOfferReceived_Count = 0; double nToatlOfferReceived_Weight = 0; double percentageTechOfferReceivedDrawing_byCount = 0; double percentageTechOfferReceivedDrawing_byWeight = 0; nTotalOfferReceived_Count = objWorkFlow.GetTotalInquirySentCount(); nOfferReceiveDrawing_Count = objWorkFlow.GeTechOfferReceievedDrawingCount(PMDLDocNo); nOfferReceivedDrawing_Weight = objWorkFlow.GetCuurentRFQ_OfferReceivedDrawingWeight(PMDLDocNo); //objWorkFlow.GetTechOfferReceivedDrawingWeight(); nToatlOfferReceived_Weight = objWorkFlow.GetTotalDrawingWeight(); //objWorkFlow.GetTotalDrawingWeight(); if (nTotalOfferReceived_Count != 0) { percentageTechOfferReceivedDrawing_byCount = Math.Round((nOfferReceiveDrawing_Count / nTotalOfferReceived_Count) * 100, 4); } if (nToatlOfferReceived_Weight != 0) { percentageTechOfferReceivedDrawing_byWeight = Math.Round((nOfferReceivedDrawing_Weight / nToatlOfferReceived_Weight) * 100, 4); } objWorkFlow.WF_Status = "All Offer Received"; objWorkFlow.BusinessObjectHandle = "CT_RFQOFFERECEIVED"; objWorkFlow.Parent_WFID = objWorkFlow.WFID; double percentage_byCount = 0; double percentage_byWeight = 0; objWorkFlow.InsertIntoItemReferencewiseProgressTable(percentageTechOfferReceivedDrawing_byWeight, percentageTechOfferReceivedDrawing_byCount); //DataTable dtPercentage = objWorkFlow.GetTechnoComNegotiationPercentagebyCount_Weight(); DataTable dtPercentage1 = objWorkFlow.GetPercentagebyCount_Weight(); if (dtPercentage1.Rows.Count > 0) { foreach (DataRow dr1 in dtPercentage1.Rows) { objWorkFlow.Project = dr1["Project"].ToString(); objWorkFlow.ItemReference = dr1["ItemReference"].ToString(); //double percentage_byCount = Convert.ToDouble(dr1["CountPercentage"]); //double percentage_byWeight = Convert.ToDouble(dr1["WeightPercentage"]); percentage_byCount += Convert.ToDouble(dr1["CountPercentage"]); percentage_byWeight += Convert.ToDouble(dr1["WeightPercentage"]); } } if (percentage_byCount < 100.00 && percentage_byWeight < 100.00) { if ((percentage_byCount >= percentage_byWeight)) { // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount); } else { if (Itemref_Typ == "4")// when item reference typ=="Self Engineered" { // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byWeight); } else { // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount); } } } else { if (percentage_byCount >= 100) { // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(100); } else { // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount); } } #endregion #region Progress Update for Tecno Comm. Negotiation on All Offer Received Button Click DataTable dtPMDLDoc = objWorkFlow.GetPMDLFromItemRef(); if (dtPMDLDoc.Rows.Count > 0) { for (int i = 0; i < dtPMDLDoc.Rows.Count; i++) { if (i == 0) { PMDLDocs = "'" + dtPMDLDoc.Rows[0]["t_docn"].ToString() + "'"; } else { PMDLDocs += ",'" + dtPMDLDoc.Rows[i]["t_docn"].ToString() + "'"; } } } double nTechnoComNegotiationDrawing_Count = 0; double nTechnoComNegotiationDrawing_Weight = 0; double nTotalTechnoComNegotiation_Count = 0; double nTotalTechnoComNegotiation_Weight = 0; double percentageTechnoComNegotiation_byCount = 0; double percentageTechnoComNegotiatio_byWeight = 0; // nTotalTechnoComNegotiation_Count = objWorkFlow.GetTotalChildRecordCount(PMDLDocNo); nTotalTechnoComNegotiation_Count = objWorkFlow.AllOfferReceieved_ChildRecordCount(PMDLDocNo); //3 nTechnoComNegotiationDrawing_Count = objWorkFlow.GetTechnoCommercialChildRecordCount(PMDLDocNo); //objWorkFlow.GetCuurentRFQ_OfferReceivedDrawingWeight nTechnoComNegotiationDrawing_Weight = objWorkFlow.GetCuurentRFQComNegotiation_OfferReceivedDrawingWeight(PMDLDocNo); nTotalTechnoComNegotiation_Weight = objWorkFlow.GetTotalDrawingWeight(); if (nTotalTechnoComNegotiation_Count != 0 && nTotalOfferReceived_Count != 0) { percentageTechnoComNegotiation_byCount = Math.Round((nTechnoComNegotiationDrawing_Count / nTotalTechnoComNegotiation_Count) * (nOfferReceiveDrawing_Count / nTotalOfferReceived_Count) * 100, 4); } if (nToatlOfferReceived_Weight != 0 && nTotalTechnoComNegotiation_Weight != 0) { // percentageTechnoComNegotiatio_byWeight = Math.Round((nTechnoComNegotiationDrawing_Weight / nTotalTechnoComNegotiation_Weight) * (nOfferReceivedDrawing_Weight / nToatlOfferReceived_Weight) * 100, 4); percentageTechnoComNegotiatio_byWeight = Math.Round((nTechnoComNegotiationDrawing_Weight / nTotalTechnoComNegotiation_Weight) * (nTechnoComNegotiationDrawing_Count / nTotalTechnoComNegotiation_Count) * 100, 4); } objWorkFlow.Parent_WFID = objWorkFlow.WFID; objWorkFlow.BusinessObjectHandle = "CT_RFQCOMMERCIALFINALISED"; objWorkFlow.WF_Status = "All Offer Received"; objWorkFlow.InsertIntoItemReferencewiseProgressTable(percentageTechnoComNegotiatio_byWeight, percentageTechnoComNegotiation_byCount); //DataTable dtPercentage = objWorkFlow.GetTechnoComNegotiationPercentagebyCount_Weight(); DataTable dtPercentage = objWorkFlow.GetPercentagebyCount_Weight(); double percentage_byCount1 = 0; double percentage_byWeight1 = 0; if (dtPercentage.Rows.Count > 0) { foreach (DataRow dr2 in dtPercentage.Rows) { objWorkFlow.Project = dr2["Project"].ToString(); objWorkFlow.ItemReference = dr2["ItemReference"].ToString(); //double percentage_byCount1 = Convert.ToDouble(dr2["CountPercentage"]); //double percentage_byWeight1 = Convert.ToDouble(dr2["WeightPercentage"]); percentage_byCount1 += Convert.ToDouble(dr2["CountPercentage"]); percentage_byWeight1 += Convert.ToDouble(dr2["WeightPercentage"]); } } if (percentage_byCount1 < 100.00 && percentage_byWeight1 < 100.00) { if ((percentage_byCount1 >= percentage_byWeight1)) { // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount1); } else { if (Itemref_Typ == "4")// when item reference typ=="Self Engineered" { // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byWeight1); } else { // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount1); } } } else { if (percentage_byCount1 >= 100) { // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(100); } else { // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount1); } } // } //} #endregion // } // } } } } else { } GetData(); ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Status Changed to All Offer Received');", true); }
protected void btnSendEnquiry_Click(object sender, EventArgs e) { WorkFlow objWorkFlow = new WorkFlow(); objWorkFlow.WFID = Convert.ToInt32(Request.QueryString["WFID"]); DataTable dt1 = objWorkFlow.GetWFById(); objWorkFlow.Parent_WFID = Convert.ToInt32(dt1.Rows[0]["Parent_WFID"]); objWorkFlow.WF_Status = "Enquiry For Techno Commercial Negotiation Completed"; objWorkFlow.Project = dt1.Rows[0]["Project"].ToString().Substring(0, 6); //int res = objWorkFlow.UpdateEnquiryRaised(); int res = objWorkFlow.UpdateTechnoCommercialNegotiationCompleted(); objWorkFlow.UpdateWF_StatusInBAANTable();// Dump Preorder Data TO BAAN table change 25/08/2018 sagar if (res > 0) { InsertPreHistory(Convert.ToInt32(Request.QueryString["WFID"]), "Enquiry For Techno Commercial Negotiation Completed"); } #region ERP Transaction Update for Control Tower //if (Request.QueryString["Status"] == "Enquiry Raised" || Request.QueryString["Status"] == "Technical offer Received") // { objWorkFlow.TransactionDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); objWorkFlow.BusinessObjectHandle = "CT_RFQCOMMERCIALFINALISED"; objWorkFlow.IndexValue = (Request.QueryString["WFID"]).ToString(); int SerialNoCount = objWorkFlow.GetSerialNumber(); SerialNoCount++; objWorkFlow.SLNO_WFID = SerialNoCount; string[] Project = txtProject.Text.Split('-'); objWorkFlow.Project = Project[0]; string[] Element = txtElement.Text.Split('-'); objWorkFlow.Element = Element[0]; objWorkFlow.UserId = Request.QueryString["u"]; int nRecordInserted = objWorkFlow.InsertPreOrderDatatoControlTower(); if (nRecordInserted > 0) { // for each PMDL doc insert a new record ( Sagar new change 11-July-2018) // 2 ways- comma seperated substring or select PMDLDoc for given WFID from WF1_PreOrderPMDL table //and loop through each PMDL doc. int DetailSerialNoCount = 0; DataTable dtPMDL = objWorkFlow.GetMultiPMDL(hdfParentWFID.Value); if (dtPMDL.Rows.Count > 0) { foreach (DataRow dr in dtPMDL.Rows) { DetailSerialNoCount = objWorkFlow.GetDetailSerialNumber(); DetailSerialNoCount++; objWorkFlow.DetailSerialCount = DetailSerialNoCount; objWorkFlow.PMDLdocDesc = dr["PMDLDocNo"].ToString(); DataTable dt = objWorkFlow.GetPartItemCount_Weight(); if (dt.Rows.Count > 0) { if (dt.Rows[0]["PartItemCount"].ToString() != "") { objWorkFlow.PartItemCount = (int)dt.Rows[0]["PartItemCount"]; } else { objWorkFlow.PartItemCount = 0; } if (dt.Rows[0]["PartItenWeight"].ToString() != "") { objWorkFlow.PartItemWeight = (double)dt.Rows[0]["PartItenWeight"]; } else { objWorkFlow.PartItemWeight = 0; } } else { objWorkFlow.PartItemCount = 0; objWorkFlow.PartItemWeight = 0; } objWorkFlow.InsertPreOrderDatatoControlTowerChildTable(); //if (Request.QueryString["Status"] == "Technical offer Received") //{ double nTechnoComNegotiationrawingCount = 0; double nTotalDrawingCount = 0; double nTotalChildRecordCount = 0; double nTechnoCommNegotiationWeight = 0; double nTotalWeight = 0; double nQualifiedforTechnoCommercial = 0; double nTechnoCommercialChildRecordCount = 0; string PMDLDocs = ""; string PMDLDocuments = ""; string PMDLDocNo = ""; double percentageTechnoCommercial_byCount; double percentageTechnoCommercial_byWeight; DataTable dataTable1 = objWorkFlow.GetTechnoCommercialItemReference(); objWorkFlow.ItemReference = (string)dataTable1.Rows[0]["t_iref"]; string Itemref_Typ = objWorkFlow.GetItemRefType(); if (dataTable1.Rows[0]["TechnoCommercialDate"].ToString() == "01-01-1970" || dataTable1.Rows[0]["TechnoCommercialDate"].ToString() == "01-01-1900") { string CurrentDate = DateTime.Now.ToString("yyyy-MM-dd"); // objWorkFlow.UpdateTechnoCommercialDate(CurrentDate); objWorkFlow.UpdateTechnoCommercialNegotiationDate(CurrentDate); } DataTable dtPMDLDoc = objWorkFlow.GetPMDLFromItemRef(); if (dtPMDLDoc.Rows.Count > 0) { for (int i = 0; i < dtPMDLDoc.Rows.Count; i++) { if (i == 0) { PMDLDocs = "'" + dtPMDLDoc.Rows[0]["t_docn"].ToString() + "'"; } else { PMDLDocs += ",'" + dtPMDLDoc.Rows[i]["t_docn"].ToString() + "'"; } } } DataTable dtPMDLDocForTechnoCommNegotiation = objWorkFlow.GetPMDLDocForTechnoCommNegotiation(); if (dtPMDLDocForTechnoCommNegotiation.Rows.Count > 0) { for (int i = 0; i < dtPMDLDocForTechnoCommNegotiation.Rows.Count; i++) { if (i == 0) { PMDLDocuments = "'" + dtPMDLDocForTechnoCommNegotiation.Rows[0]["t_docn"].ToString() + "'"; } else { PMDLDocuments += ",'" + dtPMDLDocForTechnoCommNegotiation.Rows[i]["t_docn"].ToString() + "'"; } } } int nWFID = objWorkFlow.WFID; objWorkFlow.WFID = objWorkFlow.Parent_WFID; DataTable dtStatus = objWorkFlow.GetWFById(); string sCurrentWFID_Status = dtStatus.Rows[0]["WF_Status"].ToString(); DataTable dtPMDLbyWFID = objWorkFlow.GetPMDLbyWFID(); objWorkFlow.WFID = nWFID; if (dtPMDLbyWFID.Rows.Count > 0) { for (int i = 0; i < dtPMDLbyWFID.Rows.Count; i++) { if (i == 0) { PMDLDocNo = "'" + dtPMDLbyWFID.Rows[0]["PMDLDocNo"].ToString() + "'"; } else { PMDLDocNo += ",'" + dtPMDLbyWFID.Rows[i]["PMDLDocNo"].ToString() + "'"; } } } nTechnoCommNegotiationWeight = objWorkFlow.GetTotalWeight(PMDLDocNo); nTotalWeight = objWorkFlow.GetTotalWeight(); nTechnoComNegotiationrawingCount += objWorkFlow.GetTechnoComNegotiationrawingCount(PMDLDocNo); nTotalDrawingCount = objWorkFlow.GeTotalDrawingCount(); // nQualifiedforTechnoCommercial += objWorkFlow.GetQualifiedforTechnoCommercialCount(); if (sCurrentWFID_Status == "All Offer Received") { nTotalChildRecordCount = objWorkFlow.GetTotalChildRecordCount_AllOfferReceived(PMDLDocNo); } else { nTotalChildRecordCount = objWorkFlow.GetTotalChildRecordCount(PMDLDocNo); } //3 nTechnoCommercialChildRecordCount += objWorkFlow.GetTechnoCommercialChildRecordCount(PMDLDocs); //4 //objWorkFlow.UpdateTechnoCommercialCount(nTechnoCommercialChildRecordCount); double Technicalvettingpercentage = objWorkFlow.GetTechnicalvettingpercentage(); if (nTotalChildRecordCount != 0 && nTotalDrawingCount != 0) { percentageTechnoCommercial_byCount = Math.Round((nTechnoCommercialChildRecordCount / nTotalChildRecordCount) * (nTechnoComNegotiationrawingCount / nTotalDrawingCount) * 100, 2); } else { percentageTechnoCommercial_byCount = 0; } //percentageTechnoCommercial_byWeight if (nTotalWeight != 0 && nTotalDrawingCount != 0) { // percentageTechnoCommercial_byWeight = Math.Round((nTechnoCommNegotiationWeight / nTotalWeight) * (nTechnoComNegotiationrawingCount / nTotalDrawingCount)*100, 2); percentageTechnoCommercial_byWeight = Math.Round((nTechnoCommNegotiationWeight / nTotalWeight) * (nTechnoCommercialChildRecordCount / nTotalChildRecordCount) * 100, 2); } else { percentageTechnoCommercial_byWeight = 0; } objWorkFlow.InsertIntoItemReferencewiseProgressTable(percentageTechnoCommercial_byWeight, percentageTechnoCommercial_byCount); //DataTable dtPercentage = objWorkFlow.GetTechnoComNegotiationPercentagebyCount_Weight(); DataTable dtPercentage = new DataTable(); if (sCurrentWFID_Status == "All Offer Received") { dtPercentage = objWorkFlow.GetPercentagebyCount_Weight_AllOfferReceievd(); } else { dtPercentage = objWorkFlow.GetPercentagebyCount_Weight(); } double percentage_byCount = 0; double percentage_byWeight = 0; if (dtPercentage.Rows.Count > 0) { foreach (DataRow dr2 in dtPercentage.Rows) { objWorkFlow.Project = dr2["Project"].ToString(); objWorkFlow.ItemReference = dr2["ItemReference"].ToString(); //double percentage_byCount = Convert.ToDouble(dr2["CountPercentage"]); //double percentage_byWeight = Convert.ToDouble(dr2["WeightPercentage"]); percentage_byCount += Convert.ToDouble(dr2["CountPercentage"]); percentage_byWeight += Convert.ToDouble(dr2["WeightPercentage"]); } } if (percentage_byCount < 100.00 && percentage_byWeight < 100.00) { if ((percentage_byCount >= percentage_byWeight)) { //objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount); } else { if (Itemref_Typ == "4") // when item reference typ=="Self Engineered" { // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byWeight); } else { // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount); } } } else { if (percentage_byCount >= 100) { // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(100); } else { // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount); } } // } //} //if (percentageTechnoCommercial_byCount>= 100.00 || percentageTechnoCommercial_byWeight>=100.00) //{ // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(100); //} //else if ((percentageTechnoCommercial_byCount >= percentageTechnoCommercial_byWeight)) //{ // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentageTechnoCommercial_byCount); //} //else //{ // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentageTechnoCommercial_byWeight); //} // objWorkFlow.UpdateTechnoCommercialpercentage(percentageTechnoCommercial_byCount); DateTime MinTechnoCommecrialDate = objWorkFlow.GetMinTechnoCommecrialDate(); if (MinTechnoCommecrialDate != default(DateTime)) { string OfferReceieveDate = MinTechnoCommecrialDate.ToString("yyyy-MM-dd hh:mm:ss"); // objWorkFlow.UpdateTechnoCommercialDate(OfferReceieveDate); } } } else { Response.Redirect("RaisedEnquiry.aspx?u=" + Request.QueryString["u"] + "&WFPID=" + hdfParentWFID.Value); } #endregion //if (Request.QueryString["Status"] == "Enquiry Raised") //{ // Response.Redirect("EnquiryInProcess.aspx?u=" + Request.QueryString["u"]); //} //if (Request.QueryString["Status"] == "Technical offer Received" || Request.QueryString["Status"] == "Commercial offer Received") //{ // Response.Redirect("RaisedEnquiry.aspx?u=" + Request.QueryString["u"] + "&WFPID=" + Request.QueryString["WFPID"]); //} //if (Request.QueryString["Status"] == "Isgec Comment Submitted") //{ // Response.Redirect("ReleaseComments.aspx?u=" + Request.QueryString["u"]); //} // ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('" + Request.QueryString["Status"] + "');", true); } Response.Redirect("RaisedEnquiry.aspx?u=" + Request.QueryString["u"] + "&WFPID=" + hdfParentWFID.Value); }
//protected void OnRowCommand(object sender, GridViewCommandEventArgs e) //{ // //Get the Command Name. // string commandName = e.CommandName; // //Get the Row Index. // int rowIndex = Convert.ToInt32(e.CommandArgument); // //Get the Row reference in which Button was clicked. // GridViewRow row = gvData.Rows[rowIndex]; //} protected void btnClosed_Click(object sender, EventArgs e) { LinkButton btn = (LinkButton)sender; objWorkFlow = new WorkFlow(); objWorkFlow.WFID = Convert.ToInt32(btn.CommandArgument); objWorkFlow.UserId = Request.QueryString["u"]; objWorkFlow.WF_Status = "Commercial offer Finalized"; string PMDLDocNo = ""; int res = objWorkFlow.UpdateWF_Status(); objWorkFlow.UpdateWF_StatusInBAANTable(); // Dump Preorder Data TO BAAN table change 25/08/2018 sagar if (res > 0) { InsertPreHistory(Convert.ToInt32(btn.CommandArgument), "Commercial offer Finalized"); GetData(); // ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Commercial offer Finalized');", true); GridViewRow row = (btn.NamingContainer as GridViewRow); //Get the Row Index. int rowIndex = row.RowIndex; Label lProject = row.FindControl("Project") as Label; Label lElement = row.FindControl("Element") as Label; Label lPMDLDoc = row.FindControl("PMDLDocNo") as Label; string Project = ""; string Element = ""; string PMDLDoc = ""; double percentageTechOfferReceivedDrawing_byWeight = 0; double percentageTechOfferReceivedDrawing_byCount = 0; if (lProject != null) { Project = lProject.Text; } else { Project = ""; } if (lElement != null) { Element = lElement.Text; } else { Element = ""; } if (lPMDLDoc != null) { PMDLDoc = lPMDLDoc.Text; } else { PMDLDoc = ""; } // Convert.ToString(gvData.DataKeys[rowIndex].Values[2] // string Project = (gvData.Rows[rowIndex].Cells[2].Text).ToString(); //string Element = (gvData.Rows[rowIndex].Cells[3].Text).ToString(); //string PMDLDoc =(gvData.Rows[rowIndex].Cells[5].Text).ToString(); #region ERP Transaction Update for Control Tower // Change - 26 June 2018 -- ERP Transaction Update for Control Tower // Insert data into ttpisg229200 objWorkFlow.TransactionDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); objWorkFlow.BusinessObjectHandle = "CT_RFQCOMMERCIALFINALISED"; objWorkFlow.IndexValue = objWorkFlow.WFID.ToString(); //(Request.QueryString["WFID"]).ToString(); int SerialNoCount = objWorkFlow.GetSerialNumber(); SerialNoCount++; objWorkFlow.SLNO_WFID = SerialNoCount; string[] sProject = Project.Split('-'); objWorkFlow.Project = sProject[0]; string[] sElement = Element.Split('-'); objWorkFlow.Element = sElement[0]; objWorkFlow.UserId = Request.QueryString["u"]; int nRecordInserted = objWorkFlow.InsertPreOrderDatatoControlTower(); if (nRecordInserted > 0) { objWorkFlow.WFID = Convert.ToInt32(btn.CommandArgument); DataTable dt2 = objWorkFlow.GetWFById(); //objWorkFlow.Parent_WFID = Convert.ToInt32(dt2.Rows[0]["Parent_WFID"]); DataTable dtPMDL1 = objWorkFlow.GetMultiPMDL(objWorkFlow.WFID.ToString()); if (dtPMDL1.Rows.Count > 0) { foreach (DataRow dr2 in dtPMDL1.Rows) { long DetailSerialNoCount = objWorkFlow.GetDetailSerialNumber(); DetailSerialNoCount++; objWorkFlow.DetailSerialCount = DetailSerialNoCount; objWorkFlow.PMDLdocDesc = dr2["PMDLDocNo"].ToString(); //PMDLDoc.ToString(); DataTable dt = objWorkFlow.GetPartItemCount_Weight(); if (dt.Rows.Count > 0) { if (dt.Rows[0]["PartItemCount"].ToString() != "") { objWorkFlow.PartItemCount = (int)dt.Rows[0]["PartItemCount"]; } else { objWorkFlow.PartItemCount = 0; } if (dt.Rows[0]["PartItenWeight"].ToString() != "") { objWorkFlow.PartItemWeight = (double)dt.Rows[0]["PartItenWeight"]; } else { objWorkFlow.PartItemWeight = 0; } } else { objWorkFlow.PartItemCount = 0; objWorkFlow.PartItemWeight = 0; } objWorkFlow.InsertPreOrderDatatoControlTowerChildTable(); } } DataTable dtPMDL = objWorkFlow.GetMultiPMDL(Convert.ToInt32(btn.CommandArgument).ToString()); if (dtPMDL.Rows.Count > 0) { foreach (DataRow dr in dtPMDL.Rows) { objWorkFlow.PMDLdocDesc = dr["PMDLDocNo"].ToString(); DataTable dataTable = objWorkFlow.GetRaisedEnquiryDate(); objWorkFlow.ItemReference = (string)dataTable.Rows[0]["t_iref"]; // objWorkFlow.UpdateTechCommercialNegotiaitionpercentage();// Change in the logic date-14-09-2018 sagar objWorkFlow.WFID = Convert.ToInt32(btn.CommandArgument); DataTable dtPMDLbyWFID = objWorkFlow.GetPMDLbyWFID(); if (dtPMDLbyWFID.Rows.Count > 0) { for (int i = 0; i < dtPMDLbyWFID.Rows.Count; i++) { if (i == 0) { PMDLDocNo = "'" + dtPMDLbyWFID.Rows[0]["PMDLDocNo"].ToString() + "'"; } else { PMDLDocNo += ",'" + dtPMDLbyWFID.Rows[i]["PMDLDocNo"].ToString() + "'"; } } } double nTechnoComNegotiationrawingCount = objWorkFlow.GetTechnoComNegotiationrawingCount(PMDLDocNo); // double nTotalDrawingCount = objWorkFlow.GeTotalDrawingCount(); double nTotalDrawingCount = objWorkFlow.TechnoComNegotiation_ChildRecordCount(PMDLDocNo); double nTechnoComNegotiationDrawing_Weight = objWorkFlow.GetTechnoComNegotiationWeight(PMDLDocNo); double nTotalTechnoComNegotiation_Weight = objWorkFlow.GetTotalWeight(); if (nTotalDrawingCount != 0) { percentageTechOfferReceivedDrawing_byCount = Math.Round((nTechnoComNegotiationrawingCount / nTotalDrawingCount) * 100, 4); } if (nTotalTechnoComNegotiation_Weight != 0) { percentageTechOfferReceivedDrawing_byWeight = Math.Round((nTechnoComNegotiationDrawing_Weight / nTotalTechnoComNegotiation_Weight) * 100, 4); } objWorkFlow.BusinessObjectHandle = "CT_RFQCOMMERCIALFINALISED"; objWorkFlow.WF_Status = "Commercial offer Finalized"; objWorkFlow.Parent_WFID = objWorkFlow.WFID; objWorkFlow.InsertIntoItemReferencewiseProgressTable(percentageTechOfferReceivedDrawing_byWeight, percentageTechOfferReceivedDrawing_byCount); //DataTable dtPercentage = objWorkFlow.GetTechnoComNegotiationPercentagebyCount_Weight(); DataTable dtPercentage1 = objWorkFlow.GetPercentagebyCount_Weight(); objWorkFlow.BusinessObjectHandle = "CT_RFQOFFERECEIVED"; objWorkFlow.WF_Status = "Commercial offer Finalized"; objWorkFlow.Parent_WFID = objWorkFlow.WFID; objWorkFlow.InsertIntoItemReferencewiseProgressTable(percentageTechOfferReceivedDrawing_byWeight, percentageTechOfferReceivedDrawing_byCount); //DataTable dtPercentage = objWorkFlow.GetTechnoComNegotiationPercentagebyCount_Weight(); DataTable dtPercentage2 = objWorkFlow.GetPercentagebyCount_Weight(); double percentage_byCount_ComFinalized = 0; double percentage_byWeight_ComFinalized = 0; double percentage_byCount_OfferReceieved = 0; double percentage_byWeight_OfferReceieved = 0; string Itemref_Typ = objWorkFlow.GetItemRefType(); if (dtPercentage1.Rows.Count > 0) { foreach (DataRow dr1 in dtPercentage1.Rows) { objWorkFlow.Project = dr1["Project"].ToString(); objWorkFlow.ItemReference = dr1["ItemReference"].ToString(); //double percentage_byCount = Convert.ToDouble(dr1["CountPercentage"]); //double percentage_byWeight = Convert.ToDouble(dr1["WeightPercentage"]); percentage_byCount_ComFinalized += Convert.ToDouble(dr1["CountPercentage"]); percentage_byWeight_ComFinalized += Convert.ToDouble(dr1["WeightPercentage"]); } } if (dtPercentage2.Rows.Count > 0) { foreach (DataRow dr2 in dtPercentage2.Rows) { objWorkFlow.Project = dr2["Project"].ToString(); objWorkFlow.ItemReference = dr2["ItemReference"].ToString(); //double percentage_byCount = Convert.ToDouble(dr1["CountPercentage"]); //double percentage_byWeight = Convert.ToDouble(dr1["WeightPercentage"]); percentage_byCount_OfferReceieved += Convert.ToDouble(dr2["CountPercentage"]); percentage_byWeight_OfferReceieved += Convert.ToDouble(dr2["WeightPercentage"]); } } // since it is now being globally updated now commenting out local update. if (percentage_byCount_OfferReceieved < 100.00 && percentage_byWeight_ComFinalized < 100.00) { if ((percentage_byCount_OfferReceieved >= percentage_byWeight_OfferReceieved)) { objWorkFlow.BusinessObjectHandle = "CT_RFQOFFERECEIVED"; // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount_OfferReceieved); } else { if (Itemref_Typ == "4")// when item reference typ=="Self Engineered" { objWorkFlow.BusinessObjectHandle = "CT_RFQOFFERECEIVED"; //objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byWeight_OfferReceieved); } else { objWorkFlow.BusinessObjectHandle = "CT_RFQOFFERECEIVED"; // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount_OfferReceieved); } } } else { if (percentage_byCount_OfferReceieved >= 100) { objWorkFlow.BusinessObjectHandle = "CT_RFQOFFERECEIVED"; // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(100); } else { objWorkFlow.BusinessObjectHandle = "CT_RFQOFFERECEIVED"; // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount_OfferReceieved); } } if (percentage_byCount_ComFinalized < 100.00 && percentage_byWeight_ComFinalized < 100.00) { if ((percentage_byCount_ComFinalized >= percentage_byWeight_ComFinalized)) { objWorkFlow.BusinessObjectHandle = "CT_RFQCOMMERCIALFINALISED"; //objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount_ComFinalized); } else { if (Itemref_Typ == "4")// when item reference typ=="Self Engineered" { objWorkFlow.BusinessObjectHandle = "CT_RFQCOMMERCIALFINALISED"; // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byWeight_ComFinalized); } else { objWorkFlow.BusinessObjectHandle = "CT_RFQCOMMERCIALFINALISED"; //objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount_ComFinalized); } } } else { if (percentage_byCount_ComFinalized >= 100) { objWorkFlow.BusinessObjectHandle = "CT_RFQCOMMERCIALFINALISED"; // objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(100); } else { objWorkFlow.BusinessObjectHandle = "CT_RFQCOMMERCIALFINALISED"; //objWorkFlow.UpdateTechOfferReceivedDrawingpercentage(percentage_byCount_ComFinalized); } } // } //objWorkFlow.UpdateTechnicalClearancepercentage(); // } } } else { } #endregion } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Some technical issue');", true); } } }