//添加进货信息 public void AddIteam(InHuoTJ jinhuo) { if (ID == null) { return; } string str = "insert into InHuoTJ" + ID + "(HuoNumber,HuoName,HuoType,HuoMoney,HuoCount,HuoSum,HuoDate,HuoSale,HuoDianName) values(@HuoNumber,@HuoName,@HuoType,@HuoMoney,@HuoCount,@HuoSum,@HuoDate,@HuoSale,@HuoDianName)"; SqlParameter[] pms = new SqlParameter[] { new SqlParameter("@HuoNumber", jinhuo.HuoNumber), new SqlParameter("@HuoName", jinhuo.HuoName), new SqlParameter("@HuoType", jinhuo.HuoType), new SqlParameter("@HuoMoney", jinhuo.HuoMoney), new SqlParameter("@HuoCount", jinhuo.HuoCount), new SqlParameter("@HuoSum", jinhuo.HuoSum), new SqlParameter("@HuoDate", SqlDbType.SmallDateTime) { Value = jinhuo.HuoDate }, new SqlParameter("@HuoSale", jinhuo.HuoSale), new SqlParameter("@HuoDianName", jinhuo.HuoDianName) }; SqlHelper.ExecuteNonQuery(str, pms); }
private static IWorkbook huoinpirent <T>(List <T> list, ISheet sheet) { int rowIndex = 0; IRow row = sheet.CreateRow(rowIndex); #region MyRegion//表头 row.CreateCell(0).SetCellValue("库存号"); row.CreateCell(1).SetCellValue("商品名称"); row.CreateCell(2).SetCellValue("商品类型"); row.CreateCell(3).SetCellValue("金额"); row.CreateCell(4).SetCellValue("进货数量"); row.CreateCell(5).SetCellValue("总库存"); row.CreateCell(6).SetCellValue("进货日期"); row.CreateCell(7).SetCellValue("业务员"); row.CreateCell(8).SetCellValue("店铺名称"); rowIndex++; #endregion foreach (T item in list) { InHuoTJ model = item as InHuoTJ; //每遍历一条数据创建一行 row = sheet.CreateRow(rowIndex); //创建行中的单元格 row.CreateCell(0).SetCellValue(model.HuoNumber); row.CreateCell(1).SetCellValue(model.HuoName); row.CreateCell(2).SetCellValue(model.HuoType); row.CreateCell(3).SetCellValue(model.HuoMoney); row.CreateCell(4).SetCellValue(model.HuoCount); row.CreateCell(5).SetCellValue(model.HuoSum); row.CreateCell(6).SetCellValue(model.HuoDate); row.CreateCell(7).SetCellValue(model.HuoSale); row.CreateCell(8).SetCellValue(model.HuoDianName); rowIndex++; } return(sheet.Workbook); }
private void button1_Click_1(object sender, EventArgs e) { GoodInfo gd = new GoodInfo() { Gname = nametextBox.Text.ToString(), Gno = notextBox.Text.ToString(), Gprice = Convert.ToDecimal(pricetextBox.Text), Gbid = Convert.ToDecimal(bidtextBox.Text), Gremark = remarktextBox.Text.ToString(), Gtype = typetextBox.Text.ToString(), //目前剩余的商品数量 Gstock = Convert.ToInt32(sumtextBox.Text), Gsum = Convert.ToInt32(label9.Text.Trim()) }; if (gdbll.Adds(Convert.ToInt32(addtextBox.Text), gd)) { sp._load(); Loadevent(); InHuoTJ jinhuo = new InHuoTJ() { HuoCount = addtextBox.Text.Trim(), HuoDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), HuoDianName = FilterClass.DianPu1.UserName.Trim(), HuoMoney = bidtextBox.Text.Trim(), HuoName = nametextBox.Text.ToString().Trim(), HuoNumber = notextBox.Text.ToString().Trim(), HuoSale = FilterClass.DianPu1.LoginName.Trim(), HuoSum = sumtextBox.Text.Trim(), HuoType = typetextBox.Text.ToString().Trim() }; tjbbbll.AddIteam(jinhuo); MessageBox.Show("补货成功!"); this.Close(); } }
//统计报表中的进货统计 public List <InHuoTJ> selectListTJ(string begindate, string enddate, string yginfo, string name) { string dianpu = FilterClass.DianPu1.UserName.Trim(); List <InHuoTJ> list = new List <InHuoTJ>(); InHuoTJ model; string str = ""; //SqlParameter[] pms; if (dianpu == "admin") { if (name == "全部") { if (yginfo.Trim() == "全部") { foreach (KeyValuePair <string, int> iteam in FilterClass.dic) { str += "select * from "; str += "InHuoTJ" + iteam.Value + ""; str += " where HuoDate between '" + begindate + "' and '" + enddate + "'"; str += " union all "; } str = str.Substring(0, str.Length - 10); //str = "select * from InHuoTJ where HuoDate between '" + begindate + "' and '" + enddate + "'"; //pms = new SqlParameter[] { //}; } else { foreach (KeyValuePair <string, int> iteam in FilterClass.dic) { str += "select * from "; str += "InHuoTJ" + iteam.Value + ""; str += " where HuoDate between '" + begindate + "' and '" + enddate + "' and HuoSale='" + yginfo.Trim() + "'"; str += " union all "; } str = str.Substring(0, str.Length - 10); //str = "select * from InHuoTJ where HuoSale=@HuoSale and HuoDate between '" + begindate + "' and '" + enddate + "'"; //pms = new SqlParameter[] { //new SqlParameter("@HuoSale",yginfo.Trim()) //}; } } else { int id = FilterClass.dic[name]; if (yginfo.Trim() == "全部") { str = "select * from InHuoTJ" + id + " where HuoDate between '" + begindate + "' and '" + enddate + "'"; //pms = new SqlParameter[] { // new SqlParameter("@HuoDianName",name) //}; } else { str = "select * from InHuoTJ" + id + " where HuoSale='" + yginfo.Trim() + "' and HuoDate between '" + begindate + "' and '" + enddate + "'"; //pms = new SqlParameter[] { //new SqlParameter("@HuoSale",yginfo.Trim()), //new SqlParameter("@HuoDianName",name) //}; } } } else { if (yginfo.Trim() == "全部") { str = "select * from InHuoTJ" + ID + " where HuoDate between '" + begindate + "' and '" + enddate + "'"; //pms = new SqlParameter[] { //new SqlParameter("@HuoDianName",dianpu) //}; } else { str = "select * from InHuoTJ" + ID + " where HuoSale='" + yginfo.Trim() + "' and HuoDate between '" + begindate + "' and '" + enddate + "'"; //pms = new SqlParameter[] { //new SqlParameter("@HuoDianName",dianpu), //new SqlParameter("@HuoSale",yginfo.Trim()) //}; } } SqlDataReader read = SqlHelper.ExecuteReader(str); while (read.Read()) { if (read.HasRows) { model = new InHuoTJ(); model.HuoCount = read["HuoCount"].ToString().Trim(); model.HuoDate = read["HuoDate"].ToString().Trim(); model.HuoDianName = read["HuoDianName"].ToString().Trim(); model.HuoMoney = read["HuoMoney"].ToString().Trim(); model.HuoName = read["HuoName"].ToString().Trim(); model.HuoNumber = read["HuoNumber"].ToString().Trim(); model.HuoSale = read["HuoSale"].ToString().Trim(); model.HuoSum = read["HuoSum"].ToString().Trim(); model.HuoType = read["HuoType"].ToString().Trim(); list.Add(model); } } return(list); }
public void AddIteam(InHuoTJ jinhuo) { dal.AddIteam(jinhuo); }