private void RptBind(string _strWhere, string _orderby) { this.page = AXRequest.GetQueryInt("page", 1); if (this.depot_category_id > 0) { this.ddldepot_category_id.SelectedValue = this.depot_category_id.ToString(); } if (this.depot_id > 0) { this.ddldepot_id.SelectedValue = this.depot_id.ToString(); } txtNote_no.Text = this.note_no; txtstart_time.Value = this.start_time; txtstop_time.Value = this.stop_time; ps_salse_depot bll = new ps_salse_depot(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //this.Literal_go_price.Text = MyConvert(bll.GetTitleSum(_strWhere, "sum(goods_price)")); //this.Literal_zongprice.Text = MyConvert(bll.GetTitleSum(_strWhere, "sum(real_price)")); //this.Literal_zongprice_sj.Text = MyConvert(bll.GetTitleSum(_strWhere, "sum(quantity)")); this.Literal_lrprice.Text = MyConvert(Convert.ToDecimal(bll.GetTitleSum(_strWhere, " sum(real_price*quantity)")) - Convert.ToDecimal(bll.GetTitleSum(_strWhere, "sum(goods_price*quantity)"))); this.Literal_hj.Text = MyConvert(Convert.ToDecimal(bll.GetTitleSum(_strWhere, "sum(real_price*quantity)"))); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("sales_list.aspx", "depot_category_id={0}&depot_id={1}&start_time={2}&stop_time={3}¬e_no={4}&page={5}", this.depot_category_id.ToString(), this.depot_id.ToString(), this.txtstart_time.Value, this.txtstop_time.Value, txtNote_no.Text, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
// 单个删除 protected void lbtnDelCa_Click(object sender, EventArgs e) { // 当前点击的按钮 LinkButton lb = (LinkButton)sender; int caId = int.Parse(lb.CommandArgument); ps_manager bll = new ps_manager(); bll.GetModel(caId); string title = bll.user_name; ps_join_depot bllqd = new ps_join_depot(); bllqd.user_id = caId; ps_salse_depot bllss = new ps_salse_depot(); bllss.user_id = caId; if (!bllqd.ExistsYH() && !bllss.ExistsCZXS()) { bll.Delete(caId); mym.AddAdminLog("删除", "删除用户名(账号):" + title + ""); //记录日志 mym.JscriptMsg(this.Page, " 成功删除用户名(账号):" + title + "", Utils.CombUrlTxt("manager_list.aspx", "status={0}&category_id={1}&depot_id={2}&keywords={3}&page={4}", this.status.ToString(), this.category_id.ToString(), this.depot_id.ToString(), this.keywords, this.page.ToString()), "Success"); } else { mym.JscriptMsg(this.Page, "系统中有该用户的相关操作记录,不能删除!可以通过修改禁用该用户!", "", "Error"); return; } }
//绑定记录 public void binddr() { string sqlstr = ""; string _strWhere = ""; ps_salse_depot bll = new ps_salse_depot(); if (Convert.ToInt32(Session["DepotID"]) == 0 && Convert.ToInt32(Session["DepotCatID"]) == 0) { _strWhere = "id>0 "; } _strWhere = _strWhere + CombSqlTxt(this.depot_category_id, this.depot_id, this.note_no, this.start_time, this.stop_time); sqlstr = _strWhere + " order by add_time desc,id desc"; DataView dv = bll.GetList(sqlstr).Tables[0].DefaultView; repCategory.DataSource = dv; repCategory.DataBind(); //合计 this.Literal_lrprice.Text = MyConvert(Convert.ToDecimal(bll.GetTitleSum(_strWhere, " sum(real_price*quantity)")) - Convert.ToDecimal(bll.GetTitleSum(_strWhere, "sum(goods_price*quantity)"))); this.Literal_hj.Text = MyConvert(Convert.ToDecimal(bll.GetTitleSum(_strWhere, "sum(real_price*quantity)"))); }
protected void salesTopBind() { string _start_time = DateTime.Now.AddDays(-7).ToString("d") + " 00:00:00"; string _stop_time = DateTime.Now.ToString("d") + " 23:59:59"; ps_salse_depot bll = new ps_salse_depot(); string salesTop = ""; DataTable dt = bll.GetListSql("select top 10 depot_id,zongprice,zongcount from (select depot_id,sum(real_price*quantity) as zongprice ,count(id) as zongcount from [ps_salse_depot] where add_time between '" + DateTime.Parse(_start_time) + "' and '" + DateTime.Parse(_stop_time) + "' group by depot_id) a order by a.zongprice desc").Tables[0]; foreach (DataRow dr in dt.Rows) { salesTop = salesTop + new ps_depot().GetTitle(Convert.ToInt32(dr["depot_id"].ToString())) + " 购买金额:" + MyConvert(dr["zongprice"].ToString()) + " 购买量:" + dr["zongcount"].ToString() + ","; } string salesTop_price = ""; DataTable dtp = bll.GetListSql("select top 10 depot_id,zongprice from (select depot_id,sum(real_price*quantity) as zongprice from [ps_salse_depot] where add_time between '" + DateTime.Parse(_start_time) + "' and '" + DateTime.Parse(_stop_time) + "' group by depot_id) a order by a.zongprice desc").Tables[0]; foreach (DataRow dr in dtp.Rows) { salesTop_price = salesTop_price + dr["zongprice"].ToString() + ","; } DataTable dtmy = bll.GetListSql("select top 1 depot_id,zongprice,zongcount from (select depot_id,sum(real_price*quantity) as zongprice ,count(id) as zongcount from [ps_salse_depot] where depot_id=" + Convert.ToInt32(Session["DepotID"]) + " and add_time between '" + DateTime.Parse(_start_time) + "' and '" + DateTime.Parse(_stop_time) + "' group by depot_id) a order by a.zongprice desc").Tables[0]; foreach (DataRow dr in dtmy.Rows) { Lit_mysalse.Text = "<font color=red>" + new ps_depot().GetTitle(Convert.ToInt32(dr["depot_id"].ToString())) + " 购买金额:" + MyConvert(dr["zongprice"].ToString()) + " 购买量:" + dr["zongcount"].ToString() + "</font>"; } XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(Server.MapPath("piedata.xml")); //获得节点列表 XmlNode xmlNode = xmlDoc.DocumentElement.ChildNodes.Item(0); xmlNode["pie_num"].InnerText = Utils.DelLastComma(salesTop_price); xmlNode["pie_name"].InnerText = Utils.DelLastComma(salesTop); xmlDoc.Save(Server.MapPath("piedata.xml")); }