public static string Del_C_Supplier(string midlist) { string[] arr = midlist.Split(','); int succ = 0; int erro = 0; foreach (string mid in arr) { Model.C_Supplier supp = BLL.C_Supplier.GetModel(Convert.ToInt32(mid)); if (supp == null) { erro++; continue; } if (Convert.ToInt32(BLL.CommonBase.GetSingle("select COUNT(*) from C_CarTast where SupplierName='" + supp.ID + "';")) > 0) { erro++; continue; } if (DbHelperSQL.ExecuteSql(string.Format("update C_Supplier set IsDelete=1 where ID={0}", mid)) > 0) { succ++; } else { erro++; } } return("成功:" + succ.ToString() + " , 失败:" + erro.ToString()); }
protected override void SetValue(string id) { Model.C_CarTast c = BLL.C_CarTast.GetModel(int.Parse(id)); supplier = BLL.C_Supplier.GetModel(int.Parse(c.SupplierName)); cartast = c; Name.Value = c.Name; TType.Value = c.TType.ToString(); Spare2.Value = c.Spare2.ToString(); CSpare2.Value = c.CSpare2.ToString(); CarSJ1.Value = c.CarSJ1.ToString(); CarSJ2.Value = c.CarSJ2.ToString(); ocode.Value = c.OCode; fid.Value = c.ID.ToString(); oid.Value = c.OCode.ToString(); ComDate.Value = c.ComDate.ToString(); if (!string.IsNullOrEmpty(Request.QueryString["oid"])) { ocode.Value = Request.QueryString["oid"]; } if (c.TState != -1 && c.TState != 0) { subview.Visible = false; } }
protected override void SetPowerZone() { listbank = BLL.C_SuppBank.GetModelList("1=1"); cid = Request.QueryString["cid"]; listacc = BLL.Account.GetModelList(" id in(" + cid + "); "); hcid.Value = cid; decimal money = listacc.Sum(a => a.TotalMoney); htotalmoney.Value = money.ToString(); totalmoney = money; Random rd = new Random(); string xx = rd.Next(10000, 99999).ToString(); acode = DateTime.Now.ToString("yyyyMMddHHmmss") + xx; Model.C_Supplier supplier = BLL.C_Supplier.GetModel(Convert.ToInt32(Request.QueryString["suppid"])); suppname = supplier.Name; blanmoney = supplier.OverMoney; hsuppid.Value = supplier.ID.ToString(); hacode.Value = acode; }
protected override void SetValue(string id) { cartast = BLL.C_CarTast.GetModel(int.Parse(id)); supplier = BLL.C_Supplier.GetModel(int.Parse(cartast.SupplierName)); cid.Value = id; if (!string.IsNullOrEmpty(cartast.OCode)) { order = BLL.Order.GetModel(cartast.OCode); listord = order.OrderDetail; } if (order != null) { listcost = BLL.C_CostDetalis.GetModelList(" CID=" + order.Id); } if (cartast.TState == 1 || !TModel.Role.SiJi) { anbtn.Visible = false; } Model.Member zm = BLL.Member.GetModelByMID(cartast.CarSJ1); if (zm != null) { zhusiji = zm.MName; } Model.Member fm = BLL.Member.GetModelByMID(cartast.CarSJ2); if (fm != null) { fusiji = fm.MName; } }
protected string getsupplier(string id) { Model.C_Supplier supp = BLL.C_Supplier.GetModel(Convert.ToInt32(id)); if (supp != null) { return(supp.Name); } else { return(""); } }
protected override string btnModify_Click() { Hashtable MyHs = new Hashtable(); Model.Account ac = BLL.Account.GetModel(int.Parse(Request.Form["fid"])); Model.AccountDetails c = new Model.AccountDetails(); Model.C_Supplier cs = BLL.C_Supplier.GetModel(ac.SupplierID); c.AID = ac.ID; c.CName = ac.CName; c.TotalMoney = ac.TotalMoney; c.ReMoney = ac.ReMoney; c.PayMoney = Convert.ToDecimal(Request.Form["PayMoney"]); c.Spare = Request.Form["Spare"]; ac.ReMoney += c.PayMoney; //已付款加上 cs.OverMoney -= c.PayMoney; //预付款减少 if (c.PayMoney < 0) { return("输入金额有误"); } if (ac.ReMoney > ac.TotalMoney) { return("超出付款总金额"); } if (ac.TotalMoney <= ac.ReMoney) { ac.comDate = DateTime.Now; ac.AStutas = 1; } if (Request.Form["PayType"] == "1")//如若抵扣 { if (c.PayMoney > cs.OverMoney) { return("预付款不足,请重新输入"); } BLL.C_Supplier.Update(cs, MyHs); } BLL.Account.Update(ac, MyHs); BLL.AccountDetails.Update(c, MyHs); if (BLL.CommonBase.RunHashtable(MyHs)) { return("结账成功"); } else { return("结账失败"); } }
protected override string btnModify_Click() { Hashtable MyHs = new Hashtable(); Model.C_Supplier supplier = BLL.C_Supplier.GetModel(Convert.ToInt32(Request.Form["hsuppid"])); decimal blanmoney = 0; //if (Request.Form["JZType"] == "3") //{ // blanmoney = supplier.OverMoney; //} if (Request.Form["JZType"] == "2") { decimal money = Convert.ToDecimal(Request.Form["PayMoney"]) - Convert.ToDecimal(Request.Form["htotalmoney"]); supplier.OverMoney += money; BLL.C_Supplier.Update(supplier, MyHs); } if (Request.Form["JZType"] == "3") { decimal money = (Convert.ToDecimal(Request.Form["PayMoney"]) + blanmoney) - Convert.ToDecimal(Request.Form["htotalmoney"]); supplier.OverMoney += money; BLL.C_Supplier.Update(supplier, MyHs); } Model.SubAccount account = new Model.SubAccount(); account.ACode = Request.Form["hacode"]; account.PayMoney = Convert.ToDecimal(Request.Form["PayMoney"]); account.SuppID = supplier.ID; account.SuppName = supplier.Name; account.SuppType = supplier.Type; account.Balance = blanmoney; account.JZType = Convert.ToInt32(Request.Form["JZType"]); account.UserName = Request.Form["UserName"]; BLL.SubAccount.Add(account, MyHs); if (BLL.CommonBase.RunHashtable(MyHs)) { return("结账成功"); } else { return("结账失败"); } }
protected override void SetValue(string id) { Model.C_Supplier c = BLL.C_Supplier.GetModel(int.Parse(id)); sType.Value = c.Type.ToString(); Name.Value = c.Name; SHCode.Value = c.SHCode; UserCode.Value = c.UserCode; ZQDate.Value = c.ZQDate.ToString(); ZZValue.Value = c.ZZValue; TelName.Value = c.TelName; Tel.Value = c.Tel; Address.Value = c.Address; QCMoney.Value = c.QCMoney.ToString(); OverMoney.Value = c.OverMoney.ToString(); Remark.Value = c.Remark; fid.Value = c.ID.ToString(); }
protected override string btnModify_Click() { Model.C_Supplier c = new Model.C_Supplier(); c.Type = int.Parse(Request.Form["sType"]); c.Name = Request.Form["Name"]; c.SHCode = Request.Form["SHCode"]; c.UserCode = Request.Form["UserCode"]; c.ZQDate = int.Parse(Request.Form["ZQDate"]); c.ZZValue = Request.Form["ZZValue"]; c.TelName = Request.Form["TelName"]; c.Tel = Request.Form["Tel"]; c.Address = Request.Form["Address"]; c.QCMoney = decimal.Parse(Request.Form["QCMoney"]); c.Remark = Request.Form["Remark"]; if (string.IsNullOrEmpty(Request.Form["fid"])) { c.OverMoney = decimal.Parse(Request.Form["OverMoney"]); if (BLL.C_Supplier.Add(c) > 0) { return("添加成功"); } else { return("添加失败"); } } else { c.ID = int.Parse(Request.Form["fid"]); Model.C_Supplier csu = BLL.C_Supplier.GetModel(c.ID); c.OverMoney = csu.OverMoney; if (BLL.C_Supplier.Update(c)) { return("修改成功"); } else { return("修改失败"); } } }
protected override string btnAdd_Click() { try { string req = Request.Form["id"]; Model.C_Supplier cc = BLL.C_Supplier.GetModel(int.Parse(req)); if (cc != null) { return(cc.Address + "^" + cc.TelName + "^" + cc.Tel); } else { return("-1"); } } catch (Exception e) { return("-1"); } }
protected override string btnModify_Click() { int oid = Convert.ToInt32(Request.Form["oid"]); Model.SubAccount submodel = BLL.SubAccount.GetModel(oid); Model.C_Supplier suppmodel = BLL.C_Supplier.GetModel(submodel.SuppID); if (submodel == null) { return("未查询到数据"); } Hashtable MyHs = new Hashtable(); List <Model.AccountDetails> listad = BLL.AccountDetails.GetModelList(" Spare1='" + submodel.ACode + "' "); suppmodel.OverMoney += submodel.PayMoney; BLL.C_Supplier.Update(suppmodel, MyHs); MyHs.Add("delete subaccount where id=" + oid + ";", null); foreach (var item in listad) { MyHs.Add("delete AccountDetails where id=" + item.ID + ";", null); Model.Account mamodel = BLL.Account.GetModelName(item.CName); mamodel.AStutas = 0; mamodel.ReMoney = 0; mamodel.comDate = DateTime.MaxValue; BLL.Account.Update(mamodel, MyHs); } if (BLL.CommonBase.RunHashtable(MyHs)) { return("反结账成功"); } else { return("反结账失败"); } }
protected override string btnModify_Click() { Hashtable MyHs = new Hashtable(); List <Model.Account> listaccx = BLL.Account.GetModelList(" id in(" + Request.Form["hcid"] + "); "); Model.C_Supplier supplier = BLL.C_Supplier.GetModel(Convert.ToInt32(Request.Form["hsuppid"])); if (Request.Form["JZType"] == "1")//如若抵扣 { if (Convert.ToDecimal(Request.Form["htotalmoney"]) > supplier.OverMoney) { return("预付款不足,不能结账"); } supplier.OverMoney -= Convert.ToDecimal(Request.Form["htotalmoney"]); BLL.C_Supplier.Update(supplier, MyHs); } decimal blanmoney = 0; if (Request.Form["JZType"] == "3") { blanmoney = supplier.OverMoney; } foreach (var ac in listaccx) { if (ac.AStutas == 1) { return("请勿重复结账"); } //Model.Account ac = BLL.Account.GetModel(int.Parse(Request.Form["fid"])); Model.AccountDetails c = new Model.AccountDetails(); c.AID = ac.ID; c.CName = ac.CName; c.TotalMoney = ac.TotalMoney; c.ReMoney = ac.ReMoney; c.Remark = Request.Form["Remark"]; c.PayMoney = ac.TotalMoney; c.Spare1 = Request.Form["hacode"]; if (Request.Form["JZType"] == "2") { if (Convert.ToDecimal(Request.Form["htotalmoney"]) > Convert.ToDecimal(Request.Form["PayMoney"])) { return("收款金额不能低于结账金额"); } Model.C_SuppBank suppbank = BLL.C_SuppBank.GetModel(Convert.ToInt32(Request.Form["FKAccount"])); c.Spare = suppbank.AccountName; } if (Request.Form["JZType"] == "3") { if (Convert.ToDecimal(Request.Form["htotalmoney"]) > blanmoney + Convert.ToDecimal(Request.Form["PayMoney"])) { return("收款金额不能低于结账金额"); } if (supplier.OverMoney >= Convert.ToDecimal(Request.Form["PayMoney"])) { return("余额足够结账,请选择余额结账"); } else { Model.C_SuppBank suppbank = BLL.C_SuppBank.GetModel(Convert.ToInt32(Request.Form["FKAccount"])); c.Spare = suppbank.AccountName; } } ac.comDate = DateTime.Now; ac.AStutas = 1; ac.ReMoney += c.PayMoney;//已付款加上 BLL.Account.Update(ac, MyHs); BLL.AccountDetails.Add(c, MyHs); } if (Request.Form["JZType"] == "2") { decimal money = Convert.ToDecimal(Request.Form["PayMoney"]) - Convert.ToDecimal(Request.Form["htotalmoney"]); supplier.OverMoney += money; BLL.C_Supplier.Update(supplier, MyHs); } if (Request.Form["JZType"] == "3") { decimal money = (Convert.ToDecimal(Request.Form["PayMoney"]) + blanmoney) - Convert.ToDecimal(Request.Form["htotalmoney"]); supplier.OverMoney = money; BLL.C_Supplier.Update(supplier, MyHs); } Model.SubAccount account = new Model.SubAccount(); account.ACode = Request.Form["hacode"]; account.PayMoney = Convert.ToDecimal(Request.Form["htotalmoney"]); account.SuppID = supplier.ID; account.SuppName = supplier.Name; account.SuppType = supplier.Type; account.Balance = blanmoney; account.Spare2 = Request.Form["Remark"]; account.JZType = Convert.ToInt32(Request.Form["JZType"]); account.UserName = Request.Form["UserName"]; BLL.SubAccount.Add(account, MyHs); if (BLL.CommonBase.RunHashtable(MyHs)) { return("结账成功"); } else { return("结账失败"); } }
protected override void SetPowerZone() { txtGood.DataSource = BLL.Goods.GetList(" IsDeleted = 0 order by GID"); txtGood.DataTextField = "GName"; txtGood.DataValueField = "GID"; txtGood.DataBind(); txtGood.Items.Insert(0, "--请选择--"); SupplierName.DataSource = BLL.C_Supplier.GetList(" IsDelete = 0 and (Spare3 is null or Spare3='') and Type=1 order by ID"); SupplierName.DataTextField = "Name"; SupplierName.DataValueField = "ID"; SupplierName.DataBind(); SupplierName.Items.Insert(0, "--请选择--"); SupplierName2.DataSource = BLL.C_Supplier.GetList(" IsDelete = 0 and (Spare3 is null or Spare3='') and Type=2 order by ID"); SupplierName2.DataTextField = "Name"; SupplierName2.DataValueField = "ID"; SupplierName2.DataBind(); SupplierName2.Items.Insert(0, "--请选择--"); SupplierName3.DataSource = BLL.C_Supplier.GetList(" IsDelete = 0 and (Spare3 is null or Spare3='') order by ID"); SupplierName3.DataTextField = "Name"; SupplierName3.DataValueField = "ID"; SupplierName3.DataBind(); SupplierName3.Items.Insert(0, "--请选择--"); Name.Value = DateTime.Now.ToString("yyyyMMddHHmmssfff"); if (!string.IsNullOrEmpty(Request.QueryString["oid"])) { ocode.Value = Request.QueryString["oid"]; oid.Value = Request.QueryString["oid"]; } else { } if (!string.IsNullOrEmpty(Request.QueryString["id"])) { Model.C_CarTast ct = BLL.C_CarTast.GetModel(Convert.ToInt32(Request.QueryString["id"])); Name.Value = ct.Name; sid.Value = ct.SupplierName; if (ct.TType == 1) { SupplierName.Value = ct.SupplierName; } else if (ct.TType == 2) { SupplierName2.Value = ct.SupplierName; } else { SupplierName3.Value = ct.SupplierName; } SupplierAddress.Value = ct.SupplierAddress; Model.OrderDetail od = BLL.OrderDetail.GetModelCode(ct.OCode); if (od != null) { txtGood.Value = od.GId.ToString(); txtGoodCount.Value = od.GCount.ToString(); txtGoodPrice.Value = od.BuyPrice.ToString(); } //装车信息 if (ct.TType != 1) { xcView.Visible = false; tcode = ct.TCode; CTModel = BLL.C_CarTast.GetModelname(tcode); if (CTModel != null) { SuppModel = BLL.C_Supplier.GetModel(Convert.ToInt32(CTModel.SupplierName)); if (!string.IsNullOrEmpty(CTModel.OCode)) { OdModel = BLL.OrderDetail.GetList(" ordercode='" + CTModel.OCode + "'; ").FirstOrDefault(); Good = BLL.Goods.GetModel(OdModel.GId); } } } else { zcView.Visible = false; List <Model.C_CarTast> carList = BLL.C_CarTast.GetModelList(" TCode='" + ct.Name + "' "); foreach (var item in carList) { CarTast cModel = new CarTast(); cModel.Code = item.Name; cModel.Supp = BLL.C_Supplier.GetModel(Convert.ToInt32(item.SupplierName)).Name; Model.OrderDetail XCod = BLL.OrderDetail.GetModelCode(item.OCode); if (XCod != null) { cModel.Count = XCod.GCount; cModel.ReCount = XCod.ReCount; cModel.GoodName = BLL.Goods.GetModel(Convert.ToInt32(XCod.GId)).GName; } cModel.CreateTime = item.CreateDate; XCList.Add(cModel); } } } //ocode.Disabled = true; }
protected override void SetPowerZone() { tcode = Request.QueryString["tcode"]; CTModel = BLL.C_CarTast.GetModelname(tcode); SuppModel = BLL.C_Supplier.GetModel(Convert.ToInt32(CTModel.SupplierName)); if (!string.IsNullOrEmpty(CTModel.OCode)) { OdModel = BLL.OrderDetail.GetList(" ordercode='" + CTModel.OCode + "'; ").FirstOrDefault(); Good = BLL.Goods.GetModel(OdModel.GId); } txtGood.DataSource = BLL.Goods.GetList(" IsDeleted = 0 order by GID"); txtGood.DataTextField = "GName"; txtGood.DataValueField = "GID"; txtGood.DataBind(); txtGood.Items.Insert(0, "--请选择--"); SupplierName.DataSource = BLL.C_Supplier.GetList(" IsDelete = 0 and (Spare3 is null or Spare3='') and Type=1 order by ID"); SupplierName.DataTextField = "Name"; SupplierName.DataValueField = "ID"; SupplierName.DataBind(); SupplierName.Items.Insert(0, "--请选择--"); SupplierName2.DataSource = BLL.C_Supplier.GetList(" IsDelete = 0 and (Spare3 is null or Spare3='') and Type=2 order by ID"); SupplierName2.DataTextField = "Name"; SupplierName2.DataValueField = "ID"; SupplierName2.DataBind(); SupplierName2.Items.Insert(0, "--请选择--"); SupplierName3.DataSource = BLL.C_Supplier.GetList(" IsDelete = 0 and (Spare3 is null or Spare3='') order by ID"); SupplierName3.DataTextField = "Name"; SupplierName3.DataValueField = "ID"; SupplierName3.DataBind(); SupplierName3.Items.Insert(0, "--请选择--"); Name.Value = DateTime.Now.ToString("yyyyMMddHHmmssfff"); if (!string.IsNullOrEmpty(Request.QueryString["oid"])) { ocode.Value = Request.QueryString["oid"]; oid.Value = Request.QueryString["oid"]; } else { } if (!string.IsNullOrEmpty(Request.QueryString["id"])) { Model.C_CarTast ct = BLL.C_CarTast.GetModel(Convert.ToInt32(Request.QueryString["id"])); Name.Value = ct.Name; sid.Value = ct.SupplierName; if (ct.TType == 1) { SupplierName.Value = ct.SupplierName; } else if (ct.TType == 2) { SupplierName2.Value = ct.SupplierName; } else { SupplierName3.Value = ct.SupplierName; } SupplierAddress.Value = ct.SupplierAddress; Model.OrderDetail od = BLL.OrderDetail.GetModelCode(ct.OCode); if (od != null) { txtGood.Value = od.GId.ToString(); txtGoodCount.Value = od.GCount.ToString(); txtGoodPrice.Value = od.BuyPrice.ToString(); } } }
protected override string btnAdd_Click() { lock (obj) { Model.C_CarTast cartast = BLL.C_CarTast.GetModel(int.Parse(Request.Form["cid"])); decimal retotalMoney = 0;//实际总额 if (cartast.TState == 1) { return("状态已改变,请勿重复提交"); } cartast.TState = 1; decimal recount = 0; decimal reprice = 0; if (cartast.TType == 1 || cartast.TType == 2) { if (string.IsNullOrEmpty(cartast.BDImg)) { return("请上传磅单图片"); } List <Model.OrderDetail> listord2 = null; if (!string.IsNullOrEmpty(cartast.OCode)) { order = BLL.Order.GetModel(cartast.OCode); listord2 = order.OrderDetail; Model.OrderDetail od = BLL.OrderDetail.GetModelCode(cartast.OCode); if (od != null) { retotalMoney = od.ReCount * od.BuyPrice; recount = od.ReCount; reprice = od.BuyPrice; } } //if (listord2.Sum(m => m.ReCount) <= 0) // return "未查询到实际装车/卸车数量,不能完成"; } Hashtable MyHs = new Hashtable(); Model.C_Car c1 = BLL.C_Car.GetModelByCode(cartast.Spare2); c1.Spare1 = ""; BLL.C_Car.Update(c1, MyHs); Model.C_Car c2 = BLL.C_Car.GetModelByCode(cartast.CSpare2); if (c2 != null) { c2.Spare1 = ""; BLL.C_Car.Update(c2, MyHs); } BLL.C_CarTast.Update(cartast, MyHs); if (cartast.TType == 1 || cartast.TType == 2) { Model.Account acc = new Model.Account(); acc.CID = cartast.ID; acc.CName = cartast.Name; acc.AType = cartast.TType == 1 ? 0 : 1; acc.SupplierID = Convert.ToInt32(cartast.SupplierName); supplier = BLL.C_Supplier.GetModel(int.Parse(cartast.SupplierName)); acc.SupplierName = supplier.Name; acc.TotalMoney = retotalMoney; acc.ReMoney = 0; acc.CreateDate = DateTime.Now; acc.AStutas = 0; acc.comDate = DateTime.MaxValue; acc.OrderCount = recount; acc.OrderPrice = reprice; BLL.Account.Add(acc, MyHs); } if (BLL.CommonBase.RunHashtable(MyHs)) { return("结束任务成功"); } else { return("数据有误,结束任务失败"); } } }
protected override void SetValue(string id) { cartast = BLL.C_CarTast.GetModel(int.Parse(id)); supplier = BLL.C_Supplier.GetModel(int.Parse(cartast.SupplierName)); cid.Value = id; if (!string.IsNullOrEmpty(cartast.OCode)) { order = BLL.Order.GetModel(cartast.OCode); listord = order.OrderDetail; } if (order != null) { listcost = BLL.C_CostDetalis.GetModelList(" CID=" + order.Id); } if (cartast.TState == 1 || !TModel.Role.SiJi) { anbtn.Visible = false; } Model.Member zm = BLL.Member.GetModelByMID(cartast.CarSJ1); if (zm != null) { zhusiji = zm.MName; } Model.Member fm = BLL.Member.GetModelByMID(cartast.CarSJ2); if (fm != null) { fusiji = fm.MName; } //装车信息 if (cartast.TType != 1) { xcView.Visible = false; tcode = cartast.TCode; CTModel = BLL.C_CarTast.GetModelname(tcode); if (CTModel != null) { SuppModel = BLL.C_Supplier.GetModel(Convert.ToInt32(CTModel.SupplierName)); if (!string.IsNullOrEmpty(CTModel.OCode)) { OdModel = BLL.OrderDetail.GetList(" ordercode='" + CTModel.OCode + "'; ").FirstOrDefault(); Good = BLL.Goods.GetModel(OdModel.GId); } } } else { zcView.Visible = false; List <Model.C_CarTast> carList = BLL.C_CarTast.GetModelList(" TCode='" + cartast.Name + "' "); foreach (var item in carList) { CarTast cModel = new CarTast(); cModel.Code = item.Name; cModel.Supp = BLL.C_Supplier.GetModel(Convert.ToInt32(item.SupplierName)).Name; Model.OrderDetail XCod = BLL.OrderDetail.GetModelCode(item.OCode); if (XCod != null) { cModel.Count = XCod.GCount; cModel.ReCount = XCod.ReCount; cModel.GoodName = BLL.Goods.GetModel(Convert.ToInt32(XCod.GId)).GName; } cModel.CreateTime = item.CreateDate; XCList.Add(cModel); } } }