using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using Ajax; public partial class Common_cgrk : System.Web.UI.Page { //创建一个共用的送货单bll层 Maticsoft.BLL.nr_z_cgrk cgrkbll = new Maticsoft.BLL.nr_z_cgrk(); //创建一个共用的生产单模板 Maticsoft.Model.nr_z_cgrk cgrkmodel = new Maticsoft.Model.nr_z_cgrk(); //创建一个共用的订单bll层 Maticsoft.BLL.nr_z_dd ddbll = new Maticsoft.BLL.nr_z_dd(); //创建一个共用的客户bll层 Maticsoft.BLL.nr_z_kehu kehubll = new Maticsoft.BLL.nr_z_kehu(); //创建一个操作记录模板 Maticsoft.Model.nr_sys_rizhi rizhi = new Maticsoft.Model.nr_sys_rizhi(); //创建一个操作记录bll Maticsoft.BLL.nr_sys_rizhi rizhibll = new Maticsoft.BLL.nr_sys_rizhi(); public string userinfo = ""; protected void Page_Load(object sender, EventArgs e) { Utility.RegisterTypeForAjax(typeof(Common_cgrk)); if (!IsPostBack) { if (Session["user"] == null) { Response.Redirect("../index.aspx"); } Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]); string uid = Request["uid"].ToString(); initdata(uid); } DataTable dtuserinfo = DBHlper.Execute("select mingcheng,logourl from nr_sysuserinfo").Tables[0]; if (dtuserinfo.Rows.Count > 0) { userinfo = dtuserinfo.Rows[0]["mingcheng"].ToString(); img_logo.Src = "../UseFile/" + dtuserinfo.Rows[0]["logourl"].ToString(); } else { img_logo.Visible = false; } } #region 获取真正数据值 private void initdata(string sid) { int shdid=Convert.ToInt32(sid); DataTable dt = DBHlper.Execute("select * from view_nr_z_cgrk where id=" + shdid).Tables[0]; if (dt != null && dt.Rows.Count > 0) { gysmc.Text = dt.Rows[0]["gysmc"].ToString(); jsr.Text = dt.Rows[0]["jsr"].ToString(); } } #endregion #region 用来加载项目 [Ajax.AjaxMethod] public string getms(string ids) { //修改页面时,首先吧项目明细的表头加载出来 string biao = "" + "" + "" + ""; //查询数据视图,获取当前订单下的所有明细 string cmd = "select * from view_nr_z_cgrk where id in(" + ids + ") order by id "; DataSet ds = DBHlper.Execute(cmd); DataTable dtgx = new DataTable(); string bz = ""; if (ds != null && ds.Tables[0].Rows.Count > 0) { //如果当前订单下存在明细就加载成tr行 foreach (DataRow r in ds.Tables[0].Rows) { biao += "" + "" + "" + "" + "" + "" + "" + "" + "" + ""; if (r["bz"].ToString()!="") { bz += "" + r["bz"].ToString() + ";"; } } } string zje = DBHlper.getfirstcolmn("select sum(je) from view_nr_z_cgrk where id in(" + ids + ") "); string dxzje = DBHlper.ConvertToChineseNum(zje); biao += ""; if (bz != "") { biao += ""; } else { biao += ""; } biao += "
采购单号物料名称库房物料种类" + "物料规格物料单位数量单价金额
" + r["cgdh"].ToString() + "" + r["mingcheng"].ToString() + "" + r["kufang"].ToString() + "" + r["zhonglei"].ToString() + "" + r["guige"].ToString() + "" + r["danwei"].ToString() + "" + r["sl"].ToString() + " ¥" + r["dj"].ToString() + "¥" + r["je"].ToString() + "
合计大写" + dxzje + "合计¥" + zje + "
备注" + bz + "
备注
"; return biao; } #endregion #region 加载联数 [Ajax.AjaxMethod] public string getls() { string ls = ""; DataTable dt = DBHlper.Execute("select ls from nr_z_ls where mokuan='送货单'").Tables[0]; if (dt.Rows.Count == 0) { DBHlper.excutecmd("insert into nr_z_ls(mokuan,ls) values('送货单','')"); } else { ls = dt.Rows[0]["ls"].ToString(); } return ls; } #endregion #region 保存联数 [Ajax.AjaxMethod] public void savels(string ls) { DBHlper.excutecmd("update nr_z_ls set ls='" + ls + "' where mokuan='送货单'"); } #endregion #region 加载送货条款 [Ajax.AjaxMethod] public string gettk() { string ls = ""; DataTable dt = DBHlper.Execute("select ls from nr_z_ls where mokuan='送货条款'").Tables[0]; ls = dt.Rows[0]["ls"].ToString(); return ls; } #endregion #region 保存送货条款 [Ajax.AjaxMethod] public void savetk(string ls) { DBHlper.excutecmd("update nr_z_ls set ls='" + ls + "' where mokuan='送货条款'"); } #endregion }