private void Of_bind_Goods() { int li_PageIndex = 1; try { li_PageIndex = Convert.ToInt32(Lbl_PageIndex.Text); } catch { } string ls_SQL = @"select isnull((select ThumbnaiIimg from Goodsno_picture where Goo_code=goodsno.goo_code),'img/error.png')as ThumbnaiIimg, goodsno.goo_code,goodsno.goo_no,goodsno.specnum,goodsno.Goo_Type,goodsno.Goo_Mate,goodsno.goo_name,0.00 as UserPrice,goodsno.Spec, goodsno.Content,goodsno.Goo_unit,goodsno.getdetail_memo,0 as num,0 as piece from goodsno,goodmate,goodtype where 1=1 and goo_type=typeno and goo_mate*=matecode and goodsno.isweb='Y' and goodtype.isweb='Y' and goodmate.isweb='Y'"; ls_SQL += WebSet.GetShowGood_SQL("all"); n_findby_dw lnv_find = new n_findby_dw(); lnv_find.of_setSQL(ls_SQL); lnv_find.of_SetOr("Txt_GoodNo", "goo_no", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "GyNo", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "goo_name", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "barcode", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "content", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "CAST(saleprice as varchar(50))", "like", Txt_GoodNo.Text); lnv_find.of_SetCol("goo_mate", "goodsno.goo_mate", "=", DDL_GooMate.SelectedValue.Trim()); lnv_find.of_SetCol("goo_type", "goodsno.goo_type", "=", DDL_GooType.SelectedValue.Trim()); int count = 0; DataTable ldt_Goods = lnv_find.Of_GetPageDataTable("goodsno.goo_code", gi_PageSize, li_PageIndex, ref count);//PageDAL.Page(Page, baseclass.GysoftParameter.ChangeParameter(ll_Pa), out count); Log.WriteTextLog("Dw_OrderCarSql", "Log", lnv_find.AllSQL + " sql=" + ls_SQL, 9); if (li_PageIndex == 1) { if (count % gi_PageSize != 0) { Lbl_PageCount.Text = ((count / gi_PageSize) + 1).ToString(); } else { Lbl_PageCount.Text = (count / gi_PageSize).ToString(); } } #region 添加价格和采购量 Hashtable Hash = Shoping.GetHash(); for (int li_Rows = 0; li_Rows < ldt_Goods.Rows.Count; li_Rows++) { string ls_Price = UserInfo.ShowGoo_price(ldt_Goods.Rows[li_Rows]["goo_code"], ldt_Goods.Rows[li_Rows]["getdetail_memo"]); Decimal lde_Price = 0; try { lde_Price = Convert.ToDecimal(ls_Price); } catch { ldt_Goods.Rows[li_Rows]["UserPrice"] = 0.00; continue; } ldt_Goods.Rows[li_Rows]["UserPrice"] = lde_Price; if (Hash.ContainsKey(ldt_Goods.Rows[li_Rows]["goo_code"].ToString().Trim())) { try { Decimal num = Convert.ToDecimal(Hash[ldt_Goods.Rows[li_Rows]["goo_code"].ToString().Trim()]); int li_num = Convert.ToInt32(Decimal.Round(num, 0)); ldt_Goods.Rows[li_Rows]["num"] = li_num; ldt_Goods.Rows[li_Rows]["piece"] = li_num / Convert.ToDecimal(ldt_Goods.Rows[li_Rows]["specnum"]); } catch { ldt_Goods.Rows[li_Rows]["num"] = 0; ldt_Goods.Rows[li_Rows]["piece"] = 0; } } } #endregion if (Convert.ToInt32(Lbl_PageCount.Text) > 1) { Pages.Visible = true; } else { Pages.Visible = false; } Rep_GoodsNo.DataSource = ldt_Goods; Rep_GoodsNo.DataBind(); }
private void Of_bind_Goods() { int li_PageIndex = 1; try { li_PageIndex = Convert.ToInt32(Lbl_PageIndex.Text); } catch { } //isnull((select memo from Goodsno_picture where Goo_code=goodsno.goo_code),'')as memo, string ls_SQL = @"select isnull((select ThumbnaiIimg from Goodsno_picture where Goo_code=goodsno.goo_code),'img/error.png')as ThumbnaiIimg, goo_code,goo_no,specnum,Goo_Type,Goo_Mate,goo_name,0.00 as UserPrice,Spec, Content,Goo_unit,getdetail_memo,0 as num,0 as piece,'' as lasttime,saleprice,'' as discount from goodsno where 1=1 and isnull(goo_mate,'')<>'PR' and goo_code in ( select goods_code from outone,outmany where outone.out_no=outmany.out_no and outone.cus_code ='#cus_code' and outone.out_date >='#out_date' group by goods_code ) order by goo_name"; //GysoftParameter[] Pa ={new GysoftParameter("@cus_code",SysVisitor.Current.UserCode), // new GysoftParameter("@out_date",DateTime.Now.AddYears(-1).ToString())}; ls_SQL = ls_SQL.Replace("#cus_code", SysVisitor.Current.UserCode); ls_SQL = ls_SQL.Replace("#out_date", DateTime.Now.AddYears(-1).ToString()); n_findby_dw lnv_find = new n_findby_dw(); lnv_find.of_setSQL(ls_SQL); lnv_find.of_SetOr("Txt_GoodNo", "goo_no", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "GyNo", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "goo_name", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "barcode", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "content", "like", Txt_GoodNo.Text); lnv_find.of_SetOr("Txt_GoodNo", "CAST(saleprice as varchar(50))", "like", Txt_GoodNo.Text); lnv_find.of_SetCol("DDL_GooMate", "goo_mate", "=", DDL_GooMate.SelectedValue.ToString()); lnv_find.of_SetCol("DDL_GooType", "goo_type", "=", DDL_GooMate.SelectedValue.ToString()); int count = 0; DataTable ldt_Goods = new DataTable(); ldt_Goods = lnv_find.Of_GetPageDataTable("goodsno.goo_code", gi_PageSize, li_PageIndex, ref count); if (li_PageIndex == 1) { if (count % gi_PageSize != 0) { Lbl_PageCount.Text = ((count / gi_PageSize) + 1).ToString(); } else { Lbl_PageCount.Text = (count / gi_PageSize).ToString(); } } #region 添加价格和采购量 Hashtable Hash = Shoping.GetHash(); for (int li_Rows = 0; li_Rows < ldt_Goods.Rows.Count; li_Rows++)//discount { string ls_goodcode; ls_goodcode = ldt_Goods.Rows[li_Rows]["goo_code"].ToString().Trim(); string ls_getdetail_memo; ls_getdetail_memo = ldt_Goods.Rows[li_Rows]["getdetail_memo"].ToString(); string ls_key_goodcode; ls_key_goodcode = SysVisitor.Current.UserCode + "." + ls_goodcode + ".price"; string ls_Price; ls_Price = GyRedis.GyRedis.Get(ls_key_goodcode, ""); if (ls_Price == "") { ls_Price = UserInfo.ShowGoo_price(ls_goodcode, ls_getdetail_memo); GyRedis.GyRedis.Set(ls_key_goodcode, ls_Price); } Decimal lde_Price = 0; try { lde_Price = Convert.ToDecimal(ls_Price); } catch { ldt_Goods.Rows[li_Rows]["UserPrice"] = 0.00; continue; } ldt_Goods.Rows[li_Rows]["UserPrice"] = lde_Price; if (Hash.ContainsKey(ldt_Goods.Rows[li_Rows]["goo_code"].ToString().Trim())) { try { Decimal num = Convert.ToDecimal(Hash[ldt_Goods.Rows[li_Rows]["goo_code"].ToString().Trim()]); int li_num = Convert.ToInt32(Decimal.Round(num, 0)); ldt_Goods.Rows[li_Rows]["num"] = li_num; ldt_Goods.Rows[li_Rows]["piece"] = li_num / Convert.ToDecimal(ldt_Goods.Rows[li_Rows]["specnum"]); } catch { ldt_Goods.Rows[li_Rows]["num"] = 0; ldt_Goods.Rows[li_Rows]["piece"] = 0; } } //获取折扣率 //string ls_Discount = UserInfo.ShowGoo_price(ldt_Goods.Rows[li_Rows]["goo_code"], // ldt_Goods.Rows[li_Rows]["getdetail_memo"], "discount"); //ldt_Goods.Rows[li_Rows]["discount"] = ls_Discount.Substring(0,3); //string ls_SalePrice = ldt_Goods.Rows[li_Rows]["saleprice"].ToString(); //Decimal lde_SalePrice = 0; //try { lde_SalePrice = Convert.ToDecimal(ls_SalePrice); } //catch { } //ldt_Goods.Rows[li_Rows]["saleprice"] = lde_SalePrice.ToString("f2"); } #endregion #region 取得最后订货时间 for (int li_Rows = 0; li_Rows < ldt_Goods.Rows.Count; li_Rows++) { string ls_goodcode; ls_goodcode = ldt_Goods.Rows[li_Rows]["goo_code"].ToString().Trim(); string ls_key_goodcode; ls_key_goodcode = SysVisitor.Current.UserCode + "." + ls_goodcode; string ls_LastTime; ls_LastTime = GyRedis.GyRedis.Get(ls_key_goodcode, ""); if (ls_LastTime == "") { ls_LastTime = UserInfo.ShowLastTime(ls_goodcode); GyRedis.GyRedis.Set(ls_key_goodcode, ls_LastTime); } try { DateTime dt = Convert.ToDateTime(ls_LastTime); ls_LastTime = dt.ToString("yyyy-MM-dd"); } catch { ls_LastTime = ""; } ldt_Goods.Rows[li_Rows]["lasttime"] = ls_LastTime; } if (Convert.ToInt32(Lbl_PageCount.Text) > 1) { Pages.Visible = true; } else { Pages.Visible = false; } #endregion //#region 对图文信息进行转义 //for (int i = 0; i < ldt_Goods.Rows.Count; i++) //{ // ldt_Goods.Rows[i]["memo"] = SysVisitor.GetFormatHtmlStr(ldt_Goods.Rows[i]["memo"].ToString()); //} //#endregion Rep_GoodsNo.DataSource = ldt_Goods; Rep_GoodsNo.DataBind(); }
private void Of_bind_ShopCar() { Hashtable Hash = Shoping.GetHash(); StringBuilder ls_id = new StringBuilder(); foreach (string id in Hash.Keys) { if (ls_id.Length != 0) { ls_id.Append(",'" + id + "'"); } else { ls_id.Append("'" + id + "'"); } } if (ls_id.Length == 0) { return; } string StrSql = "SELECT goo_no,goo_name,goo_code,goo_type,goo_mate,0 as num,0 as piece," + "Specnum,getdetail_memo,Content,spec,0.00 as Total,Goo_unit FROM goodsno " + " where goo_code in (" + ls_id.ToString() + ") " + //WebSet.GetShowGood_SQL("Cus") + " order by goo_type,goo_no "; DataTable ldt_Goods = new DataTable(); ldt_Goods = SqlHelper.ExecuteDataTable(StrSql); DataColumn[] Keys = { ldt_Goods.Columns["goo_code"] }; ldt_Goods.PrimaryKey = Keys; Decimal ld_TotalAll = 0; foreach (string X in Hash.Keys) { try { Decimal num = Convert.ToDecimal(Hash[X]); int li_num = Convert.ToInt32(Decimal.Round(num, 0)); DataRow Dr = ldt_Goods.Rows.Find(X); Dr["num"] = li_num; Dr["piece"] = li_num / Convert.ToDecimal(Dr["specnum"]); string ls_price = UserInfo.ShowGoo_price(Dr["goo_code"], Dr["Getdetail_Memo"]); if (ls_price == "登陆可见") { continue; } Decimal price = Convert.ToDecimal(ls_price); Dr["Total"] = li_num * price; ld_TotalAll += li_num * price; } catch { } } Rep_GoodsNo.DataSource = ldt_Goods; Rep_GoodsNo.DataBind(); Lbl_TotalAll.Text = ld_TotalAll.ToString(); }