private void Frcaigoutaizhang_Load(object sender, EventArgs e) { string sql1 = "select 付款 from tb_fukuan "; DataTable mingdan = SQLhelp1.GetDataTable(sql1, CommandType.Text); List <string> spaceminute1 = new List <string>(); for (int i = 0; i < mingdan.Rows.Count; i++) { string n = mingdan.Rows[i]["付款"].ToString(); spaceminute1.Add(n); } foreach (string s in spaceminute1) { repositoryItemComboBox2.Items.Add(s); } gridView4.Columns.ColumnByName("采购员").Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left; gridView4.Columns.ColumnByName("供方名称").Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left; gridView4.Columns.ColumnByName("合同号").Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left; gridView4.Columns.ColumnByName("合同总价").Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left; gridView4.Columns.ColumnByName("付款方式").Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left; gridView4.Columns.ColumnByName("合同登记时间").Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left; gridView4.Columns.ColumnByName("付款状态").Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left; gridView4.Columns.ColumnByName("发票状态").Fixed = DevExpress.XtraGrid.Columns.FixedStyle.Left; Reload(); }
private void cailiaozhongliang1_Load(object sender, EventArgs e) { textBox1.Text = gx1; textBox2.Text = gx2; textBox3.Text = gx3; textBox4.Text = gx4; comboBox1.Items.Clear(); string sql = "select 材料 from db_cailiaoguige "; DataTable dt = SQLhelp1.GetDataTable(sql, CommandType.Text); foreach (DataRow row in dt.Rows) { string a = row["材料"].ToString(); if (comboBox1.Items.Cast <object>().All(x => x.ToString() != a)) { comboBox1.Items.Add(a); } } comboBox2.Items.Clear(); string sql1 = "select 材料 from db_cailiaoguige "; DataTable dt1 = SQLhelp1.GetDataTable(sql1, CommandType.Text); foreach (DataRow row in dt1.Rows) { string a = row["材料"].ToString(); if (comboBox2.Items.Cast <object>().All(x => x.ToString() != a)) { comboBox2.Items.Add(a); } } comboBox3.Items.Clear(); string sql2 = "select 材料 from db_cailiaoguige "; DataTable dt2 = SQLhelp1.GetDataTable(sql2, CommandType.Text); foreach (DataRow row in dt2.Rows) { string a = row["材料"].ToString(); if (comboBox3.Items.Cast <object>().All(x => x.ToString() != a)) { comboBox3.Items.Add(a); } } comboBox4.Items.Clear(); string sql3 = "select 材料 from db_cailiaoguige "; DataTable dt3 = SQLhelp1.GetDataTable(sql3, CommandType.Text); foreach (DataRow row in dt3.Rows) { string a = row["材料"].ToString(); if (comboBox4.Items.Cast <object>().All(x => x.ToString() != a)) { comboBox4.Items.Add(a); } } }
private void simpleButton1_Click(object sender, EventArgs e) { string sql = "select * from tb_caigoutaizhang where id='" + id + "'"; DataTable dtt = SQLhelp1.GetDataTable(sql, CommandType.Text); string fapiaohao = dtt.Rows[0]["发票编号"].ToString(); string fapiaohao1 = fapiaohao + txtfapiaohao.Text + ";"; string fapiaojine = dtt.Rows[0]["发票金额"].ToString(); string fapiaojine1 = dtt.Rows[0]["发票金额"].ToString() + txtjine.Text + ";"; string fapiaoriqi = dtt.Rows[0]["发票开具日期"].ToString(); string fapiaoriqi1 = dtt.Rows[0]["发票开具日期"].ToString() + txtkaipiao.Text + ";"; string dangqianriqi = dtt.Rows[0]["发票收到日期"].ToString(); string dangqianriqi1 = dtt.Rows[0]["发票收到日期"].ToString() + DateTime.Now.ToString("yyyyMMdd") + ";"; double hetongzongjia = Convert.ToDouble(dtt.Rows[0]["合同总价"]); string[] sArray = fapiaojine1.Split(new char[1] { ';' }); double zongjia1 = 0; double zongjia = 0; for (int i = 0; i < sArray.Length; i++) { if (sArray[i] != "") { zongjia += Convert.ToDouble(sArray[i]); double c = Convert.ToDouble(sArray[i]); zongjia1 += c; string kn = (zongjia1).ToString("N2"); zongjia = Convert.ToDouble(kn); } } if (hetongzongjia == zongjia) { string sql3 = "update tb_caigoutaizhang set 发票状态='全到' where id='" + id + "' "; SQLhelp1.ExecuteScalar(sql3, CommandType.Text); } if (hetongzongjia > zongjia) { string sql3 = "update tb_caigoutaizhang set 发票状态='已到部分' where id='" + id + "' "; SQLhelp1.ExecuteScalar(sql3, CommandType.Text); } if (hetongzongjia < zongjia) { MessageBox.Show("发票金额大于合同金额!"); return; } string sql2 = "update tb_caigoutaizhang set 发票编号='" + fapiaohao1 + "' ,发票金额='" + fapiaojine1 + "' ,发票开具日期='" + fapiaoriqi1 + "',发票收到日期='" + dangqianriqi1 + "' where id='" + id + "' "; SQLhelp1.ExecuteScalar(sql2, CommandType.Text); string sql1111 = "insert into tb_fapiaodengjibiao (收到发票日期,供方名称,发票编号,发票日期,发票金额,合同号,采购员,提交人,备注) values('" + DateTime.Now.ToString("yyyyMMdd") + "' ,'" + gongfangmingcheng + "' ,'" + txtfapiaohao.Text + "' ,'" + txtkaipiao.Text + "' ,'" + txtjine.Text + "' ,'" + txthetonghao.Text + "' ,'" + caigouyuan + "','" + yonghu + "','" + txtbeizhu.Text + "')"; SQLhelp1.ExecuteScalar(sql1111, CommandType.Text); MessageBox.Show("提交成功!"); this.DialogResult = DialogResult.OK; this.Close(); }
private void tubiaoload() { string year = DateTime.Now.Year.ToString(); string sql = "select 销售部,SUM(销售额) 年度销售总额,SUM(产值) 年度总产值,SUM(开票额) 年度总开票额 from tb_xiaoshou where 提交时间>'" + year + "'group by 销售部"; DataTable dtt = SQLhelp1.GetDataTable(sql, CommandType.Text); for (int j = 0; j < dtt.Rows.Count; j++) { string b = Convert.ToString(dtt.Rows[j]["年度销售总额"]); if (b == "") { dtt.Rows[j]["年度销售总额"] = 0; } b = Convert.ToString(dtt.Rows[j]["年度总产值"]); if (b == "") { dtt.Rows[j]["年度总产值"] = 0; } b = Convert.ToString(dtt.Rows[j]["年度总开票额"]); if (b == "") { dtt.Rows[j]["年度总开票额"] = 0; } } Series Series1 = new Series("销售总额", ViewType.Bar); Series Series2 = new Series("总产值", ViewType.Bar); Series Series3 = new Series("开票总额", ViewType.Bar); Series1.ArgumentScaleType = ScaleType.Qualitative; Series2.ArgumentScaleType = ScaleType.Qualitative; Series3.ArgumentScaleType = ScaleType.Qualitative; DataTable table = new DataTable(); table.Columns.Add("Name", typeof(String)); table.Columns.Add("Value1", typeof(Double)); table.Columns.Add("Value2", typeof(Double)); table.Columns.Add("Value3", typeof(Double)); foreach (DataRow item in dtt.Rows) { var array = new object[] { item["销售部"], item["年度销售总额"], item["年度总产值"], item["年度总开票额"] }; table.Rows.Add(array); } Series1.ArgumentDataMember = "Name"; Series1.ValueDataMembers[0] = "Value1"; Series1.DataSource = table; Series1.Label.TextPattern = "{A}:{VP:0.00%}"; Series2.ArgumentDataMember = "Name"; Series2.ValueDataMembers[0] = "Value2"; Series2.DataSource = table; Series2.Label.TextPattern = "{A}:{VP:0.00%}"; Series3.ArgumentDataMember = "Name"; Series3.ValueDataMembers[0] = "Value3"; Series3.DataSource = table; Series3.Label.TextPattern = "{A}:{VP:0.00%}"; chartControl1.Series.Add(Series1); chartControl1.Series.Add(Series2); chartControl1.Series.Add(Series3); }
private void buttonItem1_Click(object sender, EventArgs e) { if (txthetonghao.Text.Trim() == "") { MessageBox.Show("请先输入合同号!"); return; } string sql = "select * from tb_caigoutaizhang where 合同号 like '%" + txthetonghao.Text + "%'"; gridControl4.DataSource = SQLhelp1.GetDataTable(sql, CommandType.Text); }
private void txthetonghao_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { if (txthetonghao.Text.Trim() == "") { MessageBox.Show("请先输入合同号!"); return; } string sql = "select * from tb_caigoutaizhang where 合同号 like '%" + txthetonghao.Text + "%'"; gridControl4.DataSource = SQLhelp1.GetDataTable(sql, CommandType.Text); } }
private void 撤回ToolStripMenuItem_Click(object sender, EventArgs e) { int[] a = gridView4.GetSelectedRows(); foreach (int i in a) { string shenhe = gridView4.GetRowCellValue(i, "审核确认").ToString(); if (shenhe == "1") { MessageBox.Show("已经确认,无法删除!"); return; } } foreach (int i in a) { string id = gridView4.GetRowCellValue(i, "id").ToString(); string hetonghao = gridView4.GetRowCellValue(i, "合同号").ToString(); string fapiaohao = gridView4.GetRowCellValue(i, "发票编号").ToString() + ";"; string fapiaoriqi = gridView4.GetRowCellValue(i, "发票日期").ToString() + ";"; string fapiaojine = gridView4.GetRowCellValue(i, "发票金额").ToString() + ";"; string kaijvriqi = gridView4.GetRowCellValue(i, "收到发票日期").ToString() + ";"; string sql = "select * from tb_caigoutaizhang where 合同号='" + hetonghao + "'"; DataTable dt = SQLhelp1.GetDataTable(sql, CommandType.Text); string fapiaobianhao = dt.Rows[0]["发票编号"].ToString(); string zuizhongfapiaohao = fapiaobianhao.Replace(fapiaohao, ""); string fapiaoriqi1 = dt.Rows[0]["发票开具日期"].ToString(); string zuifapiaoriqi1 = fapiaoriqi1.Replace(fapiaoriqi, ""); string fapiaojine11 = dt.Rows[0]["发票金额"].ToString(); string zuizhongfapiaojine = fapiaojine11.Replace(fapiaojine, ""); string kaijvriqi11 = dt.Rows[0]["发票收到日期"].ToString(); string zuizhongkaijvriqi = kaijvriqi11.Replace(kaijvriqi, ""); string sql1 = "update tb_caigoutaizhang set 发票编号='" + zuizhongfapiaohao + "',发票收到日期='" + zuizhongkaijvriqi + "',发票金额='" + zuizhongfapiaojine + "',发票开具日期='" + zuifapiaoriqi1 + "',发票状态=NULL where 合同号='" + hetonghao + "'"; SQLhelp1.ExecuteScalar(sql1, CommandType.Text); string sql12 = "delete from tb_fapiaodengjibiao where id='" + id + "'"; SQLhelp1.ExecuteScalar(sql12, CommandType.Text); } MessageBox.Show("撤回成功!"); Reload(); this.DialogResult = DialogResult.OK; }
private void comboBox5_Click(object sender, EventArgs e) { comboBox5.Items.Clear(); string sql = "select 规格 from db_cailiaoguige where 材料='" + comboBox1.Text.Trim() + "' "; string ret = Convert.ToString(SQLhelp1.ExecuteScalar(sql, CommandType.Text)); if (ret != "") { DataTable dt = SQLhelp1.GetDataTable(sql, CommandType.Text); foreach (DataRow row in dt.Rows) { string a = row["规格"].ToString(); if (comboBox5.Items.Cast <object>().All(x => x.ToString() != a)) { comboBox5.Items.Add(a); } } } }
private void 录入发票ToolStripMenuItem_Click(object sender, EventArgs e) { Frfapiaoluru form1 = new Frfapiaoluru(); string id = Convert.ToString(gridView4.GetRowCellValue(this.gridView4.FocusedRowHandle, "id")); if (id == "") { MessageBox.Show("请选择对应行!"); return; } form1.yonghu = yonghu; form1.id = Convert.ToString(gridView4.GetRowCellValue(this.gridView4.FocusedRowHandle, "id")); form1.hetonghao = Convert.ToString(gridView4.GetRowCellValue(this.gridView4.FocusedRowHandle, "合同号")); form1.hetongzongjia = Convert.ToString(gridView4.GetRowCellValue(this.gridView4.FocusedRowHandle, "合同总价")); form1.caigouyuan = Convert.ToString(gridView4.GetRowCellValue(this.gridView4.FocusedRowHandle, "采购员")); form1.gongfangmingcheng = Convert.ToString(gridView4.GetRowCellValue(this.gridView4.FocusedRowHandle, "供方名称")); form1.ShowDialog(); if (form1.DialogResult == DialogResult.OK) { string sql = "select * from tb_caigoutaizhang "; gridControl4.DataSource = SQLhelp1.GetDataTable(sql, CommandType.Text); } }
public void Reload() { string sql = "select * from tb_caigoutaizhang "; gridControl4.DataSource = SQLhelp1.GetDataTable(sql, CommandType.Text); }
private void buttonItem3_Click(object sender, EventArgs e) { string sql = "select * from tb_caigoutaizhang "; gridControl4.DataSource = SQLhelp1.GetDataTable(sql, CommandType.Text); }
private void load(string starttime, string endtime) { string xianlan = "select 销售额,产值,开票额 from tb_xiaoshou where 销售部='线缆装备销售部' and 提交时间 between '" + starttime + "'and'" + endtime + "'"; DataTable dt1 = SQLhelp1.GetDataTable(xianlan, CommandType.Text); string xiaoshoue; string chanzhi; string kaipiaoe; if (dt1.Rows.Count == 0) { xiaoshoue = "0"; chanzhi = "0"; kaipiaoe = "0"; } else { xiaoshoue = Convert.ToString(dt1.Rows[0]["销售额"]); chanzhi = Convert.ToString(dt1.Rows[0]["产值"]); kaipiaoe = Convert.ToString(dt1.Rows[0]["开票额"]); } tileBarItem1.Text = tileBarItem1.Text + "\n 销售额:" + xiaoshoue + "\n 产值:" + chanzhi + "\n 开票额:" + kaipiaoe; string shiying = "select 销售额,产值,开票额 from tb_xiaoshou where 销售部='石英装备销售部' and 提交时间 between '" + starttime + "'and'" + endtime + "'"; DataTable dt2 = SQLhelp1.GetDataTable(shiying, CommandType.Text); if (dt2.Rows.Count == 0) { xiaoshoue = "0"; chanzhi = "0"; kaipiaoe = "0"; } else { xiaoshoue = Convert.ToString(dt2.Rows[0]["销售额"]); chanzhi = Convert.ToString(dt2.Rows[0]["产值"]); kaipiaoe = Convert.ToString(dt2.Rows[0]["开票额"]); } tileBarItem2.Text = tileBarItem2.Text + "\n 销售额:" + xiaoshoue + "\n 产值:" + chanzhi + "\n 开票额:" + kaipiaoe; string bocai = "select 销售额,产值,开票额 from tb_xiaoshou where 销售部='薄材装备销售部' and 提交时间 between '" + starttime + "'and'" + endtime + "'"; DataTable dt3 = SQLhelp1.GetDataTable(bocai, CommandType.Text); if (dt3.Rows.Count == 0) { xiaoshoue = "0"; chanzhi = "0"; kaipiaoe = "0"; } else { xiaoshoue = Convert.ToString(dt3.Rows[0]["销售额"]); chanzhi = Convert.ToString(dt3.Rows[0]["产值"]); kaipiaoe = Convert.ToString(dt3.Rows[0]["开票额"]); } tileBarItem3.Text = tileBarItem3.Text + "\n 销售额:" + xiaoshoue + "\n 产值:" + chanzhi + "\n 开票额:" + kaipiaoe; string xincai = "select 销售额,产值,开票额 from tb_xiaoshou where 销售部='新材装备销售部' and 提交时间 between '" + starttime + "'and'" + endtime + "'"; DataTable dt4 = SQLhelp1.GetDataTable(xincai, CommandType.Text); if (dt4.Rows.Count == 0) { xiaoshoue = "0"; chanzhi = "0"; kaipiaoe = "0"; } else { xiaoshoue = Convert.ToString(dt4.Rows[0]["销售额"]); chanzhi = Convert.ToString(dt4.Rows[0]["产值"]); kaipiaoe = Convert.ToString(dt4.Rows[0]["开票额"]); } tileBarItem4.Text = tileBarItem4.Text + "\n 销售额:" + xiaoshoue + "\n 产值:" + chanzhi + "\n 开票额:" + kaipiaoe; string zhineng = "select 销售额,产值,开票额 from tb_xiaoshou where 销售部='智能装备销售部' and 提交时间 between '" + starttime + "'and'" + endtime + "'"; DataTable dt5 = SQLhelp1.GetDataTable(zhineng, CommandType.Text); if (dt5.Rows.Count == 0) { xiaoshoue = "0"; chanzhi = "0"; kaipiaoe = "0"; } else { xiaoshoue = Convert.ToString(dt5.Rows[0]["销售额"]); chanzhi = Convert.ToString(dt5.Rows[0]["产值"]); kaipiaoe = Convert.ToString(dt5.Rows[0]["开票额"]); } tileBarItem5.Text = tileBarItem5.Text + "\n 销售额:" + xiaoshoue + "\n 产值:" + chanzhi + "\n 开票额:" + kaipiaoe; string jinggong = "select 销售额,产值,开票额 from tb_xiaoshou where 销售部='精工配件销售部' and 提交时间 between '" + starttime + "'and'" + endtime + "'"; DataTable dt6 = SQLhelp1.GetDataTable(jinggong, CommandType.Text); if (dt6.Rows.Count == 0) { xiaoshoue = "0"; chanzhi = "0"; kaipiaoe = "0"; } else { xiaoshoue = Convert.ToString(dt6.Rows[0]["销售额"]); chanzhi = Convert.ToString(dt6.Rows[0]["产值"]); kaipiaoe = Convert.ToString(dt6.Rows[0]["开票额"]); } tileBarItem6.Text = tileBarItem6.Text + "\n 销售额:" + xiaoshoue + "\n 产值:" + chanzhi + "\n 开票额:" + kaipiaoe; string mujv = "select 销售额,产值,开票额 from tb_xiaoshou where 销售部='模具销售部' and 提交时间 between '" + starttime + "'and'" + endtime + "'"; DataTable dt7 = SQLhelp1.GetDataTable(mujv, CommandType.Text); if (dt7.Rows.Count == 0) { xiaoshoue = "0"; chanzhi = "0"; kaipiaoe = "0"; } else { xiaoshoue = Convert.ToString(dt7.Rows[0]["销售额"]); chanzhi = Convert.ToString(dt7.Rows[0]["产值"]); kaipiaoe = Convert.ToString(dt7.Rows[0]["开票额"]); } tileBarItem7.Text = tileBarItem7.Text + "\n 销售额:" + xiaoshoue + "\n 产值:" + chanzhi + "\n 开票额:" + kaipiaoe; }
public void Reload() { string sql = "select id,提交人,收到发票日期,供方名称,发票编号,发票日期,发票金额,合同号,采购员,审核确认,审核人,审核时间 from tb_fapiaodengjibiao"; gridControl4.DataSource = SQLhelp1.GetDataTable(sql, CommandType.Text); }
private void Frhetongliaodan_Load(object sender, EventArgs e) { string sql1 = "select 工作令号,项目名称,设备名称,名称,型号,单位,供方名称,合同号,实际采购数量,采购单价 from tb_caigouliaodan where 合同号='" + hetonghao + "'"; gridControl4.DataSource = SQLhelp1.GetDataTable(sql1, CommandType.Text); }