protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { |
||
GridDataItem item; | ||
//if (!this.Radgrid2BindFirstTime && Twice<2) { | ||
if (e.Item is GridDataItem) { | ||
item = (GridDataItem)e.Item; | ||
DataRowView groupDataRow = (DataRowView)e.Item.DataItem; | ||
if (Convert.ToString(groupDataRow[9]) == "") | ||
{ | ||
this.SumaFCPercent += (System.Decimal)groupDataRow[3]; | ||
item["Cantidad"].Text = ((System.Boolean)groupDataRow[6]) ? Convert.ToString(Math.Round((System.Decimal)groupDataRow[4], 3)) + " Kg" : Convert.ToString(Math.Round((System.Decimal)groupDataRow[4] * 1000, 3)) + " gr"; | ||
//Add min, max weight by PHP Nov 24 09 | ||
item["Min weight"].Text = ((System.Boolean)groupDataRow[6]) ? Convert.ToString(Math.Round(Convert.ToDouble(groupDataRow[4]) * (Convert.ToDouble(groupDataRow[7])), 3)) + " Kg" : Convert.ToString(Math.Round(Convert.ToDouble(groupDataRow[4]) * 1000 * (Convert.ToDouble(groupDataRow[7])), 3)) + " gr"; | ||
item["Max weight"].Text = ((System.Boolean)groupDataRow[6]) ? Convert.ToString(Math.Round(Convert.ToDouble(groupDataRow[4]) * (Convert.ToDouble(groupDataRow[8])), 3)) + " Kg" : Convert.ToString(Math.Round(Convert.ToDouble(groupDataRow[4]) * 1000 * (Convert.ToDouble(groupDataRow[8])), 3)) + " gr"; | ||
item["Actual weight"].Text = ((System.Boolean)groupDataRow[6]) ? "Kg" : "gr"; | ||
////----------------------------------- | ||
if (!(System.Boolean)groupDataRow[6]) | ||
{ | ||
/*DARLE FORMATO A LAS CANTIDADES EN GRAMOS*/ | ||
item["Cantidad"].BorderWidth = 3; | ||
item["Cantidad"].BorderStyle = BorderStyle.Solid; | ||
item["Cantidad"].BorderColor = System.Drawing.Color.DimGray; | ||
item["Cantidad"].BackColor = System.Drawing.Color.FromArgb(201, 205, 224); | ||
} | ||
//item["Cantidad"].Text = Convert.ToString(groupDataRow[5]) + (((System.Boolean)groupDataRow[7]) ? " Kg" : " gr"); | ||
if ((System.Boolean)groupDataRow[6]) | ||
{ | ||
//Cantidad expresada en Kilos | ||
} | ||
//item.Cells[4].Text += " <strong>" + Math.Round(this.SumaFC, 2) + "</strong>"; | ||
//item.DataCell.Text += ((System.Decimal)groupDataRow["CorrectCostUsageWoScrap"] / (int.Parse(groupDataRow["TotalUsageVal"].ToString()))).ToString(); | ||
} | ||
else | ||
{ | ||
if (((System.Boolean)groupDataRow[6]) ? Math.Round((System.Decimal)groupDataRow[4], 3) >= Convert.ToDecimal(groupDataRow[9]) : Math.Round((System.Decimal)groupDataRow[4] * 1000, 3) >= (Convert.ToDecimal(groupDataRow[9]) * 1000)) | ||
{ | ||
item["Min weight"].Text = ""; | ||
item["Max weight"].Text = ""; | ||
item["Actual weight"].Text = ""; | ||
item["Cantidad"].Text = ""; | ||
item["FCPercent"].Text = ""; | ||
item["TrueName"].Text = ""; | ||
item["code"].Text = ""; | ||
item["column"].Text = ""; | ||
item["column1"].Text = ""; | ||
item["column2"].Text = ""; | ||
} | ||
else | ||
{ | ||
this.SumaFCPercent += (System.Decimal)groupDataRow[3]; | ||
item["Cantidad"].Text = ((System.Boolean)groupDataRow[6]) ? Convert.ToString(Math.Round((System.Decimal)groupDataRow[4], 3)) + " Kg" : Convert.ToString(Math.Round((System.Decimal)groupDataRow[4] * 1000, 3)) + " gr"; | ||
//Add min, max weight by PHP Nov 24 09 | ||
item["Min weight"].Text = ((System.Boolean)groupDataRow[6]) ? Convert.ToString(Math.Round(Convert.ToDouble(groupDataRow[4]) * (Convert.ToDouble(groupDataRow[7])), 3)) + " Kg" : Convert.ToString(Math.Round(Convert.ToDouble(groupDataRow[4]) * 1000 * (Convert.ToDouble(groupDataRow[7])), 3)) + " gr"; | ||
item["Max weight"].Text = ((System.Boolean)groupDataRow[6]) ? Convert.ToString(Math.Round(Convert.ToDouble(groupDataRow[4]) * (Convert.ToDouble(groupDataRow[8])), 3)) + " Kg" : Convert.ToString(Math.Round(Convert.ToDouble(groupDataRow[4]) * 1000 * (Convert.ToDouble(groupDataRow[8])), 3)) + " gr"; | ||
item["Actual weight"].Text = ((System.Boolean)groupDataRow[6]) ? "Kg" : "gr"; | ||
////----------------------------------- | ||
if (!(System.Boolean)groupDataRow[6]) | ||
{ | ||
/*DARLE FORMATO A LAS CANTIDADES EN GRAMOS*/ | ||
item["Cantidad"].BorderWidth = 3; | ||
item["Cantidad"].BorderStyle = BorderStyle.Solid; | ||
item["Cantidad"].BorderColor = System.Drawing.Color.DimGray; | ||
item["Cantidad"].BackColor = System.Drawing.Color.FromArgb(201, 205, 224); | ||
} | ||
} | ||
} | ||
} | ||
if (e.Item is GridFooterItem) | ||
{ | ||
GridFooterItem item_ = (GridFooterItem)e.Item; | ||
item_["FCPercent"].Text += Math.Round(this.SumaFCPercent, 3) + "%"; | ||
item_["Cantidad"].Text += Math.Round((this.SumaFCPercent / 100) * Convert.ToDecimal(this.systemcap), 3) + "Kg"; | ||
//DataRowView groupDataRow = (DataRowView)e.Item.DataItem; | ||
//item.Cells[4].Text += this.SumaFC.ToString(); | ||
} | ||
//foreach (Item) | ||
//{ | ||
// e.Item.OwnerTableView.PerformDelete(item, true); | ||
//} | ||
} |