// 予算 public bool PlanningCont_StoreDgv(DataTable dt, DataGridView dgv) { DataRow dr; decimal qty; for (int i = 0; i < dt.Rows.Count; i++) { dr = dt.Rows[i]; storeItemsToDgv(dgv.Rows[i], dr); qty = Convert.ToDecimal(dr["Quantity"]); if (Convert.ToString(dr["Unit"]) != "") { dgv.Rows[i].Cells["Quantity"].Value = qty; dgv.Rows[i].Cells["Unit"].Value = Convert.ToString(dr["Unit"]); dgv.Rows[i].Cells["Cost0"].Value = DHandling.DecimaltoStr(Convert.ToDecimal(dr["Cost0"]), "#,0"); dgv.Rows[i].Cells["Amount0"].Value = DHandling.DecimaltoStr(qty * Convert.ToDecimal(dr["Cost0"]), "#,0"); dgv.Rows[i].Cells["Cost1"].Value = DHandling.DecimaltoStr(Convert.ToDecimal(dr["Cost1"]), "#,0"); dgv.Rows[i].Cells["Amount1"].Value = DHandling.DecimaltoStr(qty * Convert.ToDecimal(dr["Cost1"]), "#,0"); dgv.Rows[i].Cells["Cost2"].Value = DHandling.DecimaltoStr(Convert.ToDecimal(dr["Cost2"]), "#,0"); dgv.Rows[i].Cells["Amount2"].Value = DHandling.DecimaltoStr(qty * Convert.ToDecimal(dr["Cost2"]), "#,0"); } } return(true); }
//--------------------------------------------------------------------- // SubRoutine //--------------------------------------------------------------------- private static string decFormat(decimal decNum) { return(DHandling.DecimaltoStr(decNum, "#,0")); }