using com.hnshituo.pur.vo; using Core.Mes.Client.Comm; using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Format; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Tool; using CoreFS.CA06; using Infragistics.Win.UltraWinGrid; using Pur.Entity; using Pur.Entity.configureEntity; using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Pur.Report { public partial class PurSuppPerReport : FrmPmsBase { public PurSuppPerReport() { InitializeComponent(); } private void PurSuppPerReport_Load(object sender, EventArgs e) { EntityHelper.ShowGridCaption(ultraGrid1.DisplayLayout.Bands[0]); //StartTime.Value = DateTime.Now.ToString("YYYY"); //DateTime now = DateTime.Now; //StartTime.Value = now.ToString("yyyy-"); DateTime now = DateTime.Now; DateTime dtNow = new DateTime(now.Year, now.Month, 1);//当月第一天 DateTime dt1 = new DateTime(now.Year, 1, 1);//取年第一天 DateTime dt2 = dtNow.AddMonths(1).AddDays(-1);//当月最后一天 this.StartTime.Value = DateTime.Parse(dt1.ToString("yyyy-MM-dd") + " 00:00:00"); this.EndTime.Value = DateTime.Parse(dt2.ToString("yyyy-MM-dd") + " 23:59:59"); DataTable dt = ServerHelper.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage.getDept", new object[] { }, ob); unit.DataSource = dt; unit.DisplayMember = "BUYER_DEPT_DESC"; unit.ValueMember = "ROWNUM"; txtResult.Value = "0"; txtSupp.Value = "0"; } /// /// 重写基类方法 /// /// /// public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "DoQuery": QuerySinglePlan(); //计算 break; case "DoUpdate": doUpdate(); //查询 break; case "Doremedy": doRemedy();//添加 break; case "DoSave": doSave();//保存 break; case "Query": QueryHis();//查询历史数据 break; case "doExcel"://导出excel doExcel(); break; case "doOver"://结转 doOver(); break; case "Close": this.Close(); break; } } private void QueryHis() { this.ultraGrid1.UpdateData(); string startTime = ""; string txtunit = ""; this.ultraGrid1.UpdateData(); if (StartTime.Text != "") { startTime = StartTime.Value.ToString("yyyy"); } if (unit.Text != "") { txtunit = unit.Text; } else { txtunit = ""; } List listSource = EntityHelper.GetData( "com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage.doQueryHis", new object[] { startTime, txtunit }, this.ob); PurPerformanceMbindingSource1.DataSource = listSource; } private void doSave() { ArrayList list1 = new ArrayList(); foreach(UltraGridRow row in ultraGrid1.Rows) { if(row==null) { MessageUtil.ShowTips("没有数据,请查询!"); return; } ArrayList list = new ArrayList(); list.Add(row.Cells["PerformanceYear"].Value); list.Add(row.Cells["SuppCode"].Value); list.Add(row.Cells["SuppName"].Value); list.Add(row.Cells["Values1"].Value); list.Add(row.Cells["Values2"].Value); list.Add(row.Cells["Values3"].Value); list.Add(row.Cells["Values4"].Value); list.Add(row.Cells["Values5"].Value); list.Add(row.Cells["Values6"].Value); list.Add(row.Cells["Values7"].Value); list.Add(row.Cells["Values8"].Value); list.Add(row.Cells["Values9"].Value); list.Add(row.Cells["Values10"].Value); list.Add(row.Cells["Values11"].Value); list.Add(row.Cells["Values12"].Value); list.Add(row.Cells["Values13"].Value); list.Add(row.Cells["Values14"].Value); list.Add(row.Cells["Values16"].Value); list.Add(row.Cells["Values17"].Value); list.Add(row.Cells["Values18"].Value); list.Add(row.Cells["Values19"].Value); list.Add(row.Cells["Values20"].Value); list.Add(row.Cells["Values21"].Value); list.Add(row.Cells["Values22"].Value); list.Add(row.Cells["Values23"].Value); list.Add(row.Cells["BuyerUnitCode"].Value); list.Add(row.Cells["BuyerUnitDesc"].Value); list1.Add(list); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage"; ccp.MethodName = "doPurPerSave"; ccp.ServerParams = new object[] { list1 }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("保存成功!")) { MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } private void doOver() { string txtTime = ""; string txtunit = ""; this.ultraGrid1.UpdateData(); if (StartTime.Text != "") { txtTime = StartTime.Text; } else { txtTime = ""; } if (unit.Text != "") { txtunit = unit.Text; } else { txtunit = ""; } CoreClientParam ccp = new CoreClientParam(); foreach(UltraGridRow urg in ultraGrid1.Rows) { ArrayList list = new ArrayList(); list.Add(urg.Cells["PerformanceYear"].Text); list.Add(urg.Cells["SuppCode"].Text); list.Add(urg.Cells["SuppName"].Text); list.Add(urg.Cells["VALUES7"].Text);//二房认证 list.Add(urg.Cells["VALUES1"].Text);//以前的供应商 list.Add(urg.Cells["BuyerUnitCode"].Text); list.Add(urg.Cells["BuyerUnitDesc"].Text); //DataTable dt1 = ServerHelper.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage.doUpdatePer", new Object[] { list }, ob); ccp.ServerName = "com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage"; ccp.MethodName = "doOver"; ccp.ServerParams = new object[] { list }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); } if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("结转成功!")) { MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } private void doExcel() { try { this.Cursor = Cursors.WaitCursor; ArrayList alUltraGrid = new ArrayList(); alUltraGrid.Add(ultraGrid1); ArrayList alSheeft = new ArrayList(); alSheeft.Add("供应商绩效报表"); if (ultraGrid1.Rows.Count > 0) { GridHelper.ulGridToExcel(alUltraGrid, alSheeft, "供应商绩效报表");//导出excel } } catch (Exception e) { MessageUtil.ShowTips("导出失败" + e.Message); } finally { this.Cursor = Cursors.Default; } } private void QuerySinglePlan() { this.ultraGrid1.UpdateData(); getLar(); } private void doUpdate() { string txtTime = ""; string endTime = ""; string txtunit = ""; this.ultraGrid1.UpdateData(); if(StartTime.Text!="") { txtTime = StartTime.Text; endTime = EndTime.Text; } if(unit.Text!="") { txtunit = unit.Text; }else { txtunit = ""; } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage"; ccp.MethodName = "doUpdate"; ccp.ServerParams = new object[] { txtTime,endTime, txtunit}; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("查询成功!")) { Query(); MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } private void Query() { this.ultraGrid1.UpdateData(); List listSource = EntityHelper.GetData( "com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage.doQuery", null, this.ob); PurPerformanceMbindingSource1.DataSource = listSource; } private void doRemedy() { string suppCode = ""; this.ultraGrid1.UpdateData(); IQueryable checkMags = this.ultraGrid1.Rows.AsQueryable().Where(" CHK = 'True'"); if(checkMags.Count() == 0) { MessageUtil.ShowTips("请勾选需要添加的数据行!"); return; } ArrayList parmList = new ArrayList(); foreach (UltraGridRow row in checkMags) { ArrayList list = new ArrayList(); suppCode = row.Cells["SuppCode"].Value.ToString(); string check = "0"; string result = "0"; string supp = "0"; if (txtCheck.Text != "") { check = txtCheck.Text.Trim(); if (check.Equals("一档")) { check = "65%"; } else if (check.Equals("二挡")) { check = "45%"; } else if (check.Equals("三挡")) { check = "15%"; } else if (check.Equals("四挡")) { check = "0%"; } row.Cells["VALUES7"].Value = check; } if (txtResult.Text != "") { result = txtResult.Text.Trim(); if (Convert.ToDouble(txtResult.Text) / 100 > 0.05) { MessageUtil.ShowTips("其它绩效不能大于5%"); return; } row.Cells["VALUES22"].Value = result + "%"; row.Cells["VALUES21"].Value = result + "%"; } if (txtSupp.Text != "") { supp = txtSupp.Text.Trim(); if (Convert.ToDouble(txtSupp.Text) / 100 > 0.05) { MessageUtil.ShowTips("特别供货不能大于5%"); return; } row.Cells["VALUES11"].Value = supp + "%"; row.Cells["VALUES12"].Value = supp + "%"; } row.Cells["VALUES8"].Value = (Convert.ToDouble(row.Cells["VALUES4"].Text.Replace("%", "")) * 0.27 + Convert.ToDouble(row.Cells["VALUES6"].Text.Replace("%", "")) * 0.55 + Convert.ToDouble(row.Cells["VALUES7"].Text.Replace("%", "")) * 0.18) + "%"; row.Cells["VALUES20"].Value = (Convert.ToDouble(row.Cells["VALUES17"].Text.Replace("%", "")) * 0.5 + Convert.ToDouble(row.Cells["VALUES19"].Text.Replace("%", "")) * 0.5) + "%"; row.Cells["VALUES2"].Value = (Convert.ToDouble(row.Cells["VALUES8"].Text.Replace("%", "")) * 0.4 + Convert.ToDouble(row.Cells["VALUES13"].Text.Replace("%", "")) * 0.15 + Convert.ToDouble(row.Cells["VALUES14"].Text.Replace("%", "")) * 0.15 + Convert.ToDouble(row.Cells["VALUES20"].Text.Replace("%", "")) * 0.15 + Convert.ToDouble(row.Cells["VALUES22"].Text.Replace("%", "")) * 1 + Convert.ToDouble(row.Cells["VALUES12"].Text.Replace("%", "")) * 1).ToString("f2") + "%"; if (row.Cells["VALUES23"].Text == null || row.Cells["VALUES23"].Text == "") { row.Cells["Values1"].Value = (Convert.ToDouble(row.Cells["VALUES2"].Text.Replace("%", ""))).ToString("f2") + "%"; } else { row.Cells["Values1"].Value = (Convert.ToDouble(row.Cells["VALUES2"].Text.Replace("%", "")) + Convert.ToDouble(row.Cells["VALUES23"].Text.Replace("%", "")) * 0.1).ToString("f2") + "%"; } if (check == "" && result == "" && supp == "") { MessageUtil.ShowTips("二方审核、其它绩效、特别供货不能全为空"); } list.Add(check); list.Add(result); list.Add(supp); list.Add(suppCode); parmList.Add(list); } CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage"; ccp.MethodName = "doRemedy"; ccp.ServerParams = new object[] { parmList }; ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (ccp.ReturnCode != -1) { if (ccp.ReturnInfo.Equals("添加成功!")) { MessageUtil.ShowTips(ccp.ReturnInfo); } else { MessageUtil.ShowTips(ccp.ReturnInfo); } } } private void getLar() { string txtTime = ""; string startTime = ""; string endTime = ""; string txtunit = ""; if (StartTime.Text != "") { txtTime = StartTime.Text; startTime = StartTime.Value.ToString("yyyy"); endTime = EndTime.Text; } if (unit.Text != "") { txtunit = unit.Text; } else { txtunit = ""; } string lar = ""; string larScore = ""; List rows = ComHelper.UltraGridGetOtherRows(ultraGrid1, "CHK"); foreach (UltraGridRow urg in rows) { ArrayList list = new ArrayList(); list.Add(txtTime); list.Add(endTime); list.Add(urg.Cells["SuppCode"].Text); list.Add(txtTime); list.Add(endTime); list.Add(urg.Cells["SuppCode"].Text); ArrayList list1 = new ArrayList(); list1.Add(startTime); list1.Add(urg.Cells["SuppCode"].Text); ArrayList list2 = new ArrayList(); list2.Add(txtTime); list2.Add(endTime); list2.Add(urg.Cells["SuppCode"].Text); //查询供应商绩效期初表 DataTable dtPerE = ServerHelper.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage.doQueryPerE", new Object[] { list1 }, ob); if(dtPerE.Rows.Count>0) { urg.Cells["VALUES7"].Value = dtPerE.Rows[0]["VALUES1"].ToString(); urg.Cells["VALUES23"].Value = dtPerE.Rows[0]["VALUES2"].ToString(); } //lar DataTable dt1 = ServerHelper.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage.doReportDataDivider", new Object[] { list2 }, ob); if(dt1.Rows.Count > 0) { lar = dt1.Rows[0]["COUNT"].ToString(); } if (lar.Equals("0")) { urg.Cells["VALUES3"].Value = "0%"; lar = "0"; } else { DataTable dt = ServerHelper.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage.doReportData", new Object[] { list }, ob); if (dt.Rows.Count > 0) { urg.Cells["VALUES3"].Value = dt.Rows[0]["LAR"].ToString(); lar = dt.Rows[0]["LAR"].ToString().Replace("%", "").Trim(); } } if (Convert.ToDouble(lar)/100 >= 0.8 && Convert.ToDouble(lar)/100 < 0.9) { larScore = "80%"; } else if (Convert.ToDouble(lar)/100 >= 0.7 && Convert.ToDouble(lar)/100 < 0.8) { larScore = "70%"; } else if (Convert.ToDouble(lar)/100 >= 0.6 && Convert.ToDouble(lar)/100 < 0.7) { larScore = "60%"; } else if (Convert.ToDouble(lar)/100 >= 0.5 && Convert.ToDouble(lar)/100 < 0.6) { larScore = "50%"; } else if (Convert.ToDouble(lar)/100 >= 0.4 && Convert.ToDouble(lar)/100 < 0.5) { larScore = "40%"; } else if (Convert.ToDouble(lar)/100 >= 0.3 && Convert.ToDouble(lar)/100 < 0.4) { larScore = "30%"; } else if (Convert.ToDouble(lar)/100 >= 0.2 && Convert.ToDouble(lar)/100 < 0.3) { larScore = "20%"; } else if (Convert.ToDouble(lar)/100 >= 0.1 && Convert.ToDouble(lar)/100 < 0.2) { larScore = "10%"; } else if (Convert.ToDouble(lar)/100 >= 0.0 && Convert.ToDouble(lar)/100 < 0.1) { larScore = "0%"; } else if (Convert.ToDouble(lar)/100 >= 0.9 && Convert.ToDouble(lar)/100 < 1) { larScore = "90%"; } else if (Convert.ToDouble(lar)/100 >= 1) { larScore = "100%"; } urg.Cells["VALUES4"].Value = larScore; //ppm string ppm = ""; string ppmScore = ""; DataTable dtPm = ServerHelper.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage.doReportDataPpmDivider", new Object[] { list2 }, ob); if (dtPm.Rows.Count > 0) { ppm = dtPm.Rows[0]["DIVIDER"].ToString(); } if (ppm.Equals("0")) { urg.Cells["VALUES5"].Value = "0%"; ppm = "0"; } else { DataTable dtPmscore = ServerHelper.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage.doReportDataPpmData", new Object[] { list2 }, ob); if (dtPmscore.Rows.Count > 0) { urg.Cells["VALUES5"].Value = dtPmscore.Rows[0]["ppm"]; ppm = dtPmscore.Rows[0]["ppm"].ToString().Replace("%", "").Trim(); } } if (Convert.ToDouble(ppm)/100 < 0.0003) { ppmScore = "90%"; } else if(Convert.ToDouble(ppm)/100>=0.0003&&Convert.ToDouble(ppm)/100<0.0005){ ppmScore = "80%"; } else if (Convert.ToDouble(ppm)/100 >= 0.0005 && Convert.ToDouble(ppm)/100 < 0.001) { ppmScore = "60%"; } else if(Convert.ToDouble(ppm)/100>=0.001) { ppmScore = "0%"; } urg.Cells["VALUES6"].Value = larScore; //供货占比 string supply = "0"; string supplyScore = ""; double hege = 0.0; double hege1 = 0.0; ArrayList Arr = new ArrayList(); Arr.Add(txtTime); Arr.Add(endTime); Arr.Add(txtTime); Arr.Add(endTime); Arr.Add(urg.Cells["SuppCode"].Text); ArrayList arrayList = new ArrayList(); arrayList.Add(txtTime); arrayList.Add(endTime); arrayList.Add(urg.Cells["SuppCode"].Text); arrayList.Add(txtTime); arrayList.Add(endTime); arrayList.Add(urg.Cells["SuppCode"].Text); arrayList.Add(txtTime); arrayList.Add(endTime); arrayList.Add(txtTime); arrayList.Add(endTime); arrayList.Add(urg.Cells["SuppCode"].Text); DataTable dtPriceFenMu = ServerHelper.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage.doReportDataFenMu", new Object[] { Arr }, ob); if (dtPriceFenMu.Rows[0]["HEGE"].ToString() != "0") { DataTable dtSupply = ServerHelper.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage.doReportDataSupply", new Object[] { arrayList }, ob); if (dtSupply.Rows.Count > 0) { urg.Cells["VALUES9"].Value = (Convert.ToDouble(dtSupply.Rows[0]["HEGE"].ToString()) * 100).ToString("f2") + "%"; supply = dtSupply.Rows[0]["HEGE"].ToString(); } } else { urg.Cells["VALUES9"].Value = "0%"; } if(Convert.ToDouble(supply)>=0.30) { supplyScore = "100%"; }else if(Convert.ToDouble(supply)>=0.20&&Convert.ToDouble(supply)<0.30) { supplyScore = "80%"; }else if(Convert.ToDouble(supply)>=0.10&&Convert.ToDouble(supply)<0.20) { supplyScore = "50%"; }else if(Convert.ToDouble(supply)<0.10) { supplyScore = "10%"; } urg.Cells["VALUES10"].Value = supplyScore; urg.Cells["VALUES13"].Value = supplyScore; //反应能力评分和特别供货是相等的 //otd string orderId = ""; double time = 0.0; double ave = 0.0; DataTable dtOrder = ServerHelper.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage.doReportDataOrderDivider", new Object[] { list2 }, ob); if (dtOrder.Rows.Count > 0) { for (int i = 0; i < dtOrder.Rows.Count; i++) { orderId = dtOrder.Rows[i]["ORDER_ID"].ToString(); ArrayList List = new ArrayList(); List.Add(txtTime); List.Add(endTime); List.Add(urg.Cells["SuppCode"].Text); List.Add(orderId); DataTable dtOtd = ServerHelper.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage.doReportDataOtdData", new Object[] { List }, ob); if(dtOtd.Rows.Count>0) { time = Convert.ToInt64(dtOtd.Rows[0]["CHATIME"].ToString()); ave += (1 - time * 0.01) / dtOrder.Rows.Count; // ave = Convert.ToInt64(ave * 100 + "%"); } } } urg.Cells["VALUES14"].Value = (ave*100).ToString("f2")+"%"; //成交价格波动 string deal = "0"; string dealScore = ""; ////先求供应商对应的物料种类 //ArrayList arrayList1 = new ArrayList(); //arrayList1.Add(txtTime); //arrayList1.Add(urg.Cells["SuppCode"].Text); //DataTable dtItem1 = ServerHelper.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage.doReportDataItem", new Object[] { arrayList1 }, ob); ArrayList arrayList1 = new ArrayList(); arrayList1.Add(txtTime); arrayList1.Add(endTime); arrayList1.Add(urg.Cells["SuppCode"].Text); arrayList1.Add(txtTime); arrayList1.Add(endTime); arrayList1.Add(urg.Cells["SuppCode"].Text); arrayList1.Add(txtTime); arrayList1.Add(endTime); arrayList1.Add(urg.Cells["SuppCode"].Text); arrayList1.Add(txtTime); arrayList1.Add(endTime); arrayList1.Add(urg.Cells["SuppCode"].Text); arrayList1.Add(txtTime); arrayList1.Add(endTime); arrayList1.Add(urg.Cells["SuppCode"].Text); DataTable dtPrice1 = ServerHelper.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage.doReportDataPrice", new Object[] { arrayList1 }, ob); if (dtPrice1.Rows.Count > 0) { urg.Cells["VALUES16"].Value = System.Math.Abs(((Convert.ToDouble(dtPrice1.Rows[0]["BID"].ToString()) * 100) - 100)).ToString("f2") + "%"; deal = System.Math.Abs(Convert.ToDouble(dtPrice1.Rows[0]["BID"].ToString()) - 1).ToString("f2"); } if (Convert.ToDouble(deal) < 0.1) { dealScore = "100%"; } else if (Convert.ToDouble(deal) >= 0.1 && Convert.ToDouble(deal) < 0.2) { dealScore = "70%"; } else if (Convert.ToDouble(deal) >= 0.2 && Convert.ToDouble(deal) < 0.4) { dealScore = "30%"; } else if (Convert.ToDouble(deal) >= 0.4) { dealScore = "0%"; } urg.Cells["VALUES17"].Value = dealScore; //报价价格波动 string price = ""; string priceScore = ""; DataTable dtPrice = ServerHelper.GetData("com.hnshituo.pur.balance.service.impl.FrmBalanceOutBillManage.doReportDataWavePriceDivider", new Object[] { list2 }, ob); if (dtPrice.Rows.Count > 0) { if(Convert.ToDouble(dtPrice.Rows[0]["COUNT"].ToString())==0.0) { price = "0"; } else { if (dtPrice.Rows[0]["RES_WITH_TAX_PRICE"].ToString() == null||dtPrice.Rows[0]["RES_WITH_TAX_PRICE"].ToString() =="") { price = "0"; } else { price = (Convert.ToDouble(dtPrice.Rows[0]["RES_WITH_TAX_PRICE"].ToString()) / Convert.ToDouble(dtPrice.Rows[0]["COUNT"].ToString())).ToString("f2"); } } } urg.Cells["VALUES18"].Value = (100 - Convert.ToDouble(price) * 100) + "%"; if (Convert.ToDouble(1 - Convert.ToDouble(price)) <= 0.03) { priceScore = "100%"; } else if (Convert.ToDouble(1 - Convert.ToDouble(price)) > 0.03 && Convert.ToDouble(1 - Convert.ToDouble(price)) <= 0.05) { priceScore = "70%"; } else if (Convert.ToDouble(1 - Convert.ToDouble(price)) > 0.05 && Convert.ToDouble(1 - Convert.ToDouble(price)) <= 0.1) { priceScore = "30%"; } else if (Convert.ToDouble(1 - Convert.ToDouble(price)) > 0.1) { priceScore = "0%"; } urg.Cells["VALUES19"].Value = priceScore; ultraGrid1.UpdateData(); } } private void ultraGrid1_AfterRowActivate(object sender, EventArgs e) { UltraGridRow urg = ultraGrid1.ActiveRow; if(urg==null) { return; } ultraGrid1.UpdateData(); // txtCheck.Text = urg.Cells["VALUES7"].Text; if (urg.Cells["VALUES7"].Text == "65.00%") { txtCheck.SelectedIndex = 0; } else if (urg.Cells["VALUES7"].Text == "45.00%") { txtCheck.SelectedIndex = 1; } else if (urg.Cells["VALUES7"].Text == "15.00%") { txtCheck.SelectedIndex = 2; } else if (urg.Cells["VALUES7"].Text == "0.00%" || urg.Cells["VALUES7"].Text == "") { txtCheck.SelectedIndex = 3; } } } }