110,534
社区成员
发帖
与我相关
我的任务
分享
private void button6_Click(object sender, EventArgs e)
{
int a = dgvAreaInfo.Rows.Count;
for (int b = 0; b < a; b++)
{
//获取内部工票价格
try
{
SqlDataReader sqlread = boperate.getread("SELECT sum(gpjg) as gpjg FROM tb_gpdd where '" + riqistart.Text.Trim() + "' <= ccrq and ccrq <= '" + riqiend.Text.Trim() + "' and cph='" + Convert.ToString(dgvAreaInfo.Rows[b].Cells[0].Value).Trim() + "' and jsfs = '内部用车' ");
if (sqlread.Read())
{
string zhi1 = sqlread["gpjg"].ToString();
this.dgvAreaInfo.Rows[b].Cells[5].Value = zhi1.ToString();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
}
//获取内部客车补助
try
{
SqlDataReader sqlread = boperate.getread("SELECT sum(kcbz) as kcbz FROM tb_gpdd where '" + riqistart.Text.Trim() + "' <= ccrq and ccrq <= '" + riqiend.Text.Trim() + "' and cph='" + Convert.ToString(dgvAreaInfo.Rows[b].Cells[0].Value).Trim() + "' and jsfs = '内部用车' ");
if (sqlread.Read())
{
string zhi2 = sqlread["kcbz"].ToString();
this.dgvAreaInfo.Rows[b].Cells[6].Value = zhi2.ToString();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
}
//获取内部货车补助
try
{
SqlDataReader sqlread = boperate.getread("SELECT sum(buzhu) as buzhu FROM tb_gpdd where '" + riqistart.Text.Trim() + "' <= ccrq and ccrq <= '" + riqiend.Text.Trim() + "' and cph='" + Convert.ToString(dgvAreaInfo.Rows[b].Cells[0].Value).Trim() + "' and jsfs = '内部用车' ");
if (sqlread.Read())
{
string zhi3 = sqlread["buzhu"].ToString();
this.dgvAreaInfo.Rows[b].Cells[7].Value = zhi3.ToString();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
}
//获取内部过路票
try
{
SqlDataReader sqlread = boperate.getread("SELECT sum(glp) as glp FROM tb_gpdd where '" + riqistart.Text.Trim() + "' <= ccrq and ccrq <= '" + riqiend.Text.Trim() + "' and cph='" + Convert.ToString(dgvAreaInfo.Rows[b].Cells[0].Value).Trim() + "' and jsfs = '内部用车' ");
if (sqlread.Read())
{
string zhi4 = sqlread["glp"].ToString();
this.dgvAreaInfo.Rows[b].Cells[8].Value = zhi4.ToString();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
}
//获取现金工票
try
{
SqlDataReader sqlread = boperate.getread("SELECT sum(gpjg) as xjgpjg FROM tb_gpdd where '" + riqistart.Text.Trim() + "' <= ccrq and ccrq <= '" + riqiend.Text.Trim() + "' and cph='" + Convert.ToString(dgvAreaInfo.Rows[b].Cells[0].Value).Trim() + "' and jsfs = '现金' ");
if (sqlread.Read())
{
string zhi5 = sqlread["xjgpjg"].ToString();
this.dgvAreaInfo.Rows[b].Cells[9].Value = zhi5.ToString();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
}
//获取现金客车补助
try
{
SqlDataReader sqlread = boperate.getread("SELECT sum(kcbz) as xjkcbz FROM tb_gpdd where '" + riqistart.Text.Trim() + "' <= ccrq and ccrq <= '" + riqiend.Text.Trim() + "' and cph='" + Convert.ToString(dgvAreaInfo.Rows[b].Cells[0].Value).Trim() + "' and jsfs = '现金' ");
if (sqlread.Read())
{
string zhi6 = sqlread["xjkcbz"].ToString();
this.dgvAreaInfo.Rows[b].Cells[10].Value = zhi6.ToString();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
}
//获取现金货车补助
try
{
SqlDataReader sqlread = boperate.getread("SELECT sum(buzhu) as xjbuzhu FROM tb_gpdd where '" + riqistart.Text.Trim() + "' <= ccrq and ccrq <= '" + riqiend.Text.Trim() + "' and cph='" + Convert.ToString(dgvAreaInfo.Rows[b].Cells[0].Value).Trim() + "' and jsfs = '现金' ");
if (sqlread.Read())
{
string zhi7 = sqlread["xjbuzhu"].ToString();
this.dgvAreaInfo.Rows[b].Cells[11].Value = zhi7.ToString();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
}
//获取现金过路票
try
{
SqlDataReader sqlread = boperate.getread("SELECT sum(glp) as xjglp FROM tb_gpdd where '" + riqistart.Text.Trim() + "' <= ccrq and ccrq <= '" + riqiend.Text.Trim() + "' and cph='" + Convert.ToString(dgvAreaInfo.Rows[b].Cells[0].Value).Trim() + "' and jsfs = '现金' ");
if (sqlread.Read())
{
string zhi8 = sqlread["xjglp"].ToString();
this.dgvAreaInfo.Rows[b].Cells[12].Value = zhi8.ToString();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
}
}
}