我正在开发一个估算应用程序,我很难编写给出预期结果的公式,如下所示:
Quantity / Production * Non productive % = Labor Hours
上述公式应以数学方式回答,如下所示:
1000 SF / 300 SF per hour * @10% Non Productive= 3.6 Labor hours
我的问题是如何编写一个公式来正确计算工时?
谢谢
这是我的代码:
private void dgv1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
double cell2 = Convert.ToSingle(dgv1.CurrentRow.Cells[2].Value);
double cell4 = Convert.ToSingle(dgv1.CurrentRow.Cells[4].Value);
double cell5 = Convert.ToSingle(dgv1.CurrentRow.Cells[5].Value);
double cell6 = Convert.ToSingle(dgv1.CurrentRow.Cells[6].Value);
double cell7 = Convert.ToSingle(dgv1.CurrentRow.Cells[7].Value);
double cell8 = Convert.ToSingle(dgv1.CurrentRow.Cells[8].Value);
double cell9 = Convert.ToSingle(dgv1.CurrentRow.Cells[9].Value);
double cell10 = Convert.ToSingle(dgv1.CurrentRow.Cells[10].Value);
double cell11 = Convert.ToSingle(dgv1.CurrentRow.Cells[11].Value);
double cell12 = Convert.ToSingle(dgv1.CurrentRow.Cells[12].Value);
double cell13 = Convert.ToSingle(dgv1.CurrentRow.Cells[13].Value);
double cell14 = Convert.ToSingle(dgv1.CurrentRow.Cells[14].Value);
double cell15 = Convert.ToSingle(dgv1.CurrentRow.Cells[15].Value);
double cell16 = Convert.ToSingle(dgv1.CurrentRow.Cells[16].Value);
double cell17 = Convert.ToSingle(dgv1.CurrentRow.Cells[17].Value);
if (2.ToString() != "" && cell4.ToString() != "" && cell5.ToString() != "" && cell6.ToString() != "" && cell7.ToString() != "" && cell8.ToString() != "" && cell9.ToString() != "" && cell10.ToString() != "" && cell11.ToString() != "" && cell12.ToString() != "" && cell13.ToString() != "" && cell14.ToString() != "" && cell15.ToString() != "" && cell16.ToString() != "" && cell17.ToString() != "")
{
dgv1.CurrentRow.Cells[6].Value = cell2 / cell4 * cell5; // <------ This is the formula I'm talking about//
dgv1.CurrentRow.Cells[10].Value = cell6 * cell7 *cell8 *cell9;
dgv1.CurrentRow.Cells[13].Value = cell2 / cell11;
dgv1.CurrentRow.Cells[17].Value = cell13 * cell14 * cell15 * cell16;
}
}