0
嘗試計算百分比量,但它總是返回0。錯誤比率計算
的foreach(在dataGridView1.Rows的DataGridViewRow行) { 雙igst_amt;
double amt = (Convert.ToDouble(row.Cells[dataGridView1.Columns[4].Index].Value)) * (Convert.ToDouble(row.Cells[dataGridView1.Columns[5].Index].Value));
row.Cells[dataGridView1.Columns[6].Index].Value = Convert.ToString(amt);
igst_amt = (igst/100)*(amt);
MessageBox.Show(Convert.ToString(igst_amt));
if (state == "o")
{
row.Cells[dataGridView1.Columns[9].Index].Value =Convert.ToString((cgst/100) *(amt));
row.Cells[dataGridView1.Columns[11].Index].Value =Convert.ToString((sgst/100) * (amt));
}
else if (state == "i")
{
row.Cells[dataGridView1.Columns[7].Index].Value = igst_amt;
}
double g_total = igst_amt + amt;
row.Cells[dataGridView1.Columns[13].Index].Value = Convert.ToString(g_total);
double t_g_total=0;
t_g_total+= g_total;
}
'igst'的類型是什麼? –
數據類型爲雙精度型 double igst = 0; double cgst = 0; double sgst = 0; –
'igst'是否變成非零? –