private void btnCondition_Click(object sender, EventArgs e) { this.dgvDetail.Rows.Clear(); this.dgvCollect.Rows.Clear(); int index = this.tabStock.SelectedIndex; string contion = "ShopID="+PublicState.Master.ShopID; if (this.txtContent.Text.Trim().ToString() == "") { contion += " and CreateTime between '" + this.lblStartTime.Value.ToString() + "' and '" + this.lblEndTime.Value.AddHours(DateTime.Now.Hour).AddMinutes(DateTime.Now.Minute).AddSeconds(DateTime.Now.Second).ToString("yyyy-MM-dd HH:mm:ss") + "' "; } else if (this.txtContent.Text.Trim().ToString() != "") { contion += "and (GoodsCode like '%" + this.txtContent.Text.Trim().ToString() + "%' or GoodsName like '%" + this.txtContent.Text.Trim().ToString() + "%') and CreateTime between '" + this.lblStartTime.Value.ToString() + "' and '" + this.lblEndTime.Value.AddHours(DateTime.Now.Hour).AddMinutes(DateTime.Now.Minute).AddSeconds(DateTime.Now.Second).ToString("yyyy-MM-dd HH:mm:ss") + "' "; } if (index == 0) //采购详细 { DataSet ds = new VipSoft.BLL.OrderGoods().GetList(contion + " order by CreateTime desc"); foreach (DataRow dr in ds.Tables[0].Rows) { this.dgvDetail.Rows.Add(dr["CreateTime"], dr["GoodsCode"], dr["GoodsName"], dr["GoodsUnit"], dr["Price"], dr["Number"], dr["TotalMoney"], dr["MasterName"]); } } else if (index == 1) //采购汇总 { DataSet ds = new VipSoft.BLL.OrderGoods().GetListCollect("SELECT GoodsCode,GoodsName,GoodsUnit,sum(Number) as sumNumber from OrderGoods where " + contion + " group by GoodsCode,goodsName,goodsUnit"); foreach (DataRow dr in ds.Tables[0].Rows) { this.dgvCollect.Rows.Add(dr["GoodsCode"], dr["GoodsName"], dr["GoodsUnit"], dr["sumNumber"]); } } }
/// <summary> /// 绑定进货历史 /// </summary> public void BindHistory() { DataSet ds = new VipSoft.BLL.OrderGoods().GetListCollect(sql); foreach (DataRow dr in ds.Tables[0].Rows) { this.dgvAnnalList.Rows.Add(dr["CreateTime"], dr["Price"], dr["Number"], dr["TotalMoney"]); } }
public void BindLater() { this.dgvEarlyTimeList.Rows.Clear(); DataSet ds = new VipSoft.BLL.OrderGoods().GetListCollect(" select top 10 * from OrderGoods where Type=0 and ShopID="+PublicState.Master.ShopID+" order by CreateTime desc"); foreach (DataRow dr in ds.Tables[0].Rows) { this.dgvEarlyTimeList.Rows.Add(dr["GoodsID"], dr["GoodsCode"], dr["GoodsName"], dr["Number"], dr["Price"], dr["GoodsUnit"], dr["CreateTime"]); } }
private void btnOK_Click(object sender, EventArgs e) { int type = 0; if (orderType == "采购进货") { type = 0; } else //退货 { type = 1; } List<VipSoft.Model.OrderGoods> list = new List<VipSoft.Model.OrderGoods>(); VipSoft.Model.OrderGoods orderInfo = null; for (int i = 0; i < this.dgvSelectedList.Rows.Count; i++) { orderInfo = new Model.OrderGoods(); orderInfo.GoodsID = int.Parse(this.dgvSelectedList.Rows[i].Cells[0].Value.ToString()); orderInfo.GoodsCode = this.dgvSelectedList.Rows[i].Cells[1].Value.ToString(); orderInfo.GoodsName = this.dgvSelectedList.Rows[i].Cells[2].Value.ToString(); orderInfo.type = type; orderInfo.GoodsUnit = this.dgvSelectedList.Rows[i].Cells[3].Value.ToString(); orderInfo.Price = decimal.Parse(this.dgvSelectedList.Rows[i].Cells[4].Value.ToString().Replace("¥", "")); orderInfo.Number = int.Parse(this.dgvSelectedList.Rows[i].Cells[5].Value.ToString()); orderInfo.TotalMoney = decimal.Parse(this.dgvSelectedList.Rows[i].Cells[6].Value.ToString().Replace("¥", "")); orderInfo.CreateTime = DateTime.Now; orderInfo.MasterID = PublicState.Master.ID; orderInfo.MasterName = PublicState.Master.Name; orderInfo.ShopID = PublicState.Master.ShopID; orderInfo.ShopName = PublicState.Master.ShopName; list.Add(orderInfo); } bool isTrue = new VipSoft.BLL.OrderGoods().Add(list); this.Close(); }