public void Bind() { sbhtml.Clear(); Dictionary <string, string> dicstr = new Dictionary <string, string>(); Dictionary <string, string> dicCz = new Dictionary <string, string>(); /*计算边房对应的图标*/ List <Model.occu_infor> listocc = fmmx.GetModelList("occ_with='否' and state_id=0"); dicstr = Session["dic"] as Dictionary <string, string>; dicCz = Session["iscz"] as Dictionary <string, string>; StrWheres(); DivContent.InnerHtml = ""; string sjsj = ""; string img = ""; string GoodNo = ""; Model.room_number frmfh = new Model.room_number(); Model.floor_manage frmlc = new Model.floor_manage(); DataTable dt = fmlc.GetListYou(); List <Model.room_number> listrn = bllrn.GetModelList(""); if (listrn.Count > 0) { allroom = listrn.Count; } DataSet dts = null; foreach (DataRow dr in dt.Rows) { dts = brBll.GetList(stwhere + " and Rn_floor=" + dr["floor_id"].ToString() + ""); //if (txt_Namesp.Value == "") //{ // dts = brBll.GetList(stwhere + " and Rn_floor=" + dr["floor_id"].ToString() + ""); //} //else if (txt_Namesp.Value == "欠费") //{ // string SQL = "select (SUM(ga_price)-SUM(ga_sum_price)) as c,ga_occuid from dbo.goods_account where ga_occuid in (select order_id from dbo.occu_infor where state_id=0) group by ga_occuid"; // spanqianf.Attributes.Add("class", "bor"); // dtQX = fmgood.GoodsQX(SQL); // foreach (DataRow drqf in dtQX.Tables[0].Rows) // { // if (Convert.ToDouble(drqf["c"]) < 0) // { // if (GoodNo == "") // { // drqfsb.Append("'" + drqf["ga_occuid"].ToString() + "'"); // } // else { drqfsb.Append("," + "'" + drqf["ga_occuid"].ToString() + "'"); } // } // } // if (drqfsb.ToString() == "") //如果没有欠费 // { // dts = brBll.GetList("1!=1"); // } // else//查询出来所有的欠费房间 // { // dts = brBll.GetListed(stwhere + " and Rn_floor=" + dr["floor_id"].ToString() + " and b.order_id in(" + drqfsb.ToString() + ")", " left join occu_infor as b on a.Rn_roomNum=b.room_number left join real_mode as c on b.real_mode_id=c.real_mode_id "); // } //} //else if (txt_Namesp.Value == "催帐") { // dts = brBll.GetListed("", "inner join( select * from occu_infor as oi inner join (select SUM(ga_price)-SUM(ga_sum_price) as sa,ga_occuid as t from goods_account where ga_isys=1 group by ga_occuid) as u on u.t =oi.order_id where u.sa<oi.real_price and datediff(D,[depar_time],'"+DateTime.Now.ToString()+"')=0) as uio on uio.room_number=a.Rn_roomNum and Rn_floor=" + dr["floor_id"].ToString() + ""); //} //else if (txt_Namesp.Value == "将走房") { // dts = brBll.GetList("Rn_floor=" + dr["floor_id"].ToString() + ""); //} //else //{ // dts = brBll.GetListed(stwhere + " and Rn_floor=" + dr["floor_id"].ToString() + "", " left join occu_infor as b on a.Rn_roomNum=b.room_number left join real_mode as c on b.real_mode_id=c.real_mode_id "); //} if (dts.Tables[0].Rows.Count > 0) { sbhtml.Append("<ul class='main'>"); foreach (DataRow drs in dts.Tables[0].Rows) { price = ""; Names = ""; xuzhu = ""; jzfimg = ""; LFimg = ""; totime = ""; numDay = ""; if ((drs["Rn_state"]) == null || drs["Rn_state"].ToString() == "") { drs["Rn_state"] = "0"; } FtNames = fmft.GetModel(Convert.ToInt32(drs["Rn_state"])).room_state_name; GetClass(Convert.ToInt32(drs["Rn_state"])); if (FtNames == "干净房") { sjsj = "ondblclick=\"ShowTabt('在住房信息'," + drs["id"].ToString() + ",0,this)\""; } else { sjsj = ""; } if (txt_Namesp.Value == "催帐") { czico = "<img src='/admin/images/iconcuizhang.png' />"; czCount++; } if (FtNames == "在住房" || FtNames == "脏住房") { try { a = drs["Rn_roomNum"].ToString(); lfcounts = 0; modelocc = fmmx.GetModels(" where occ_with='否' and state_id=0 and room_number='" + a + "'"); Names = modelocc.occ_name; totime = modelocc.occ_time.ToString("g"); real_mode_id = modelocc.real_mode_id; drs["id"] = modelocc.occ_id; switch (real_mode_id) { case 2: price = "<img src='../../images/sicon04.png' class=\"zdf\"/>"; zdfang++; break; case 19: price = "<img src='../../images/sicon01.png' class=\"yuezhu\"/>"; yzf++; break; case 5: price = "<img src='../../images/sicon03.png' class=\"lccio\" />"; lingcfang++; break; case 20: price = "<img src='/admin/images/iconfree.png' class=\"free\"/>"; mfcount++; break; default: break; } //str1 = "u.sa < " + modelocc.real_price + " and"; //if (modelfs.showday) //{ // str1 = "u.sa < " + Convert.ToInt32(modelfs.daynum) * modelocc.real_price + " and"; //} //else //{ // str1 = ""; //} //if (modelfs.showyue) //{ // str1 += " u.sa<" + modelfs.moneyNum + " and"; //} //dstable = brBll.GetProc(str1, Convert.ToInt32(dr["floor_id"]), a, DateTime.Now.ToString()); //dstable = brBll.GetListed("", "inner join( select * from occu_infor as oi inner join (select SUM(ga_price)-SUM(ga_sum_price) as sa,ga_occuid as t from goods_account where ga_isys=1 group by ga_occuid) as u on u.t =oi.order_id where " + str1 + " datediff(D,[depar_time],'" + DateTime.Now.ToString() + "')=0) as uio on uio.room_number=a.Rn_roomNum and Rn_floor=" + dr["floor_id"].ToString() + " and room_number='" + a + "'"); //if (dstable.Tables[0].Rows.Count > 0) //{ // if (modelfs.showyjb) // { // czico = "<img src='/admin/images/iconcuizhang.png'/>"; // } // czCount++; //} if (dicCz.ContainsKey(a.ToString())) { if (dicCz[a.ToString()].ToString() == "1") { if (modelfs.showyjb) { czico = "<img src='/admin/images/iconcuizhang.png'/>"; } czCount++; bs = true; } } date1 = Convert.ToDateTime(fmmx.GetModels(" where occ_with='否' and state_id=0 and real_mode_Id!=2 and real_mode_Id!=19 and room_number='" + a.ToString() + "'").depar_time.ToString()); date2 = System.DateTime.Now; cc = date1.Day - date2.Day; if (cc < 0) { cc = (Convert.ToDateTime(date1.ToString("yyyy-MM-dd")) - Convert.ToDateTime(date2.ToString("yyyy-MM-dd"))).Days; } if (modelfs.yuliDay) {//只是当日预离 if (cc == 0) { if (modelfs.showYuli) { //jzfimg = "<img src=\"/admin/images/iconjiangzou.png\">"; } jzhouf++; } } else if (modelfs.showDayTime) { //多少天内预离显示 if (Convert.ToInt32(cc) <= Convert.ToInt32(modelfs.dayNumYl)) { if (Convert.ToInt32(cc) == 0 || cc < 0) { numDay = "<span class=\"numday\"> </span>"; } else { numDay = "<span class=\"numday\">" + cc + "</span>"; } if (modelfs.showYuli) { //jzfimg = "<img src=\"/admin/images/iconjiangzou.png\">"; } jzhouf++; } } countxuzhu = fmmx.GetRecordCount(" where continuelive=" + modelocc.occ_id + ""); if (countxuzhu > 0) { xuzhu = "<img src=\"/admin/images/iconxz.png\">"; xuzhufang++; } countLF = fmmx.GetRecordCount(" where order_id='" + modelocc.order_id + "'"); if (listocc.Count > 1) { LFimg = dicstr[a.ToString()]; LFcount++; } //SQLlf = "select order_id from occu_infor where order_id in (select order_id from occu_infor group by order_id having count(order_id) > 1) group by order_id"; //DtLF = fmgood.GoodsQX(SQLlf); //LFcount = DtLF.Tables[0].Rows.Count; } catch { } } b = drs["Rn_roomNum"].ToString(); if (drs["Room_suod"].ToString().Trim() == "是")//是否为锁房间 { img = "<img src='/admin/images/iconsuofang.png' class=\"suofang\">"; sjsj = ""; suofang++; } else { img = ""; } yudao = string.Empty; string yustr = string.Empty; string yudaoDay = string.Empty; if (drs["Rn_Tobe"] != null)//是否为预定房间 { if (Convert.ToInt32(drs["Rn_Tobe"]) == 1) { yudao = GetYuDao(b); yustr = "yuding"; DateTime datestr = Convert.ToDateTime(yudao); DateTime dataend = Convert.ToDateTime(DateTime.Now); int days = datestr.Day - dataend.Day; if (days < 0) { TimeSpan tss = (Convert.ToDateTime(datestr.ToString("yyyy-MM-dd")) - Convert.ToDateTime(dataend.ToString("yyyy-MM-dd"))); days = tss.Days; } if (days <= 0) { yudaoDay = "<div class=\"yuding hrj\"> </div>"; yudao = Convert.ToDateTime(yudao).ToString("hh:mm"); } else { yudao = ""; yudaoDay = "<div class=\"yuding hrj\">" + days + "</div>"; } } } sbhtml.Append("<li class=\"hidli\" rooms=" + b + "><ul><li rooms=" + b + " id=" + Convert.ToInt32(drs["id"].ToString()) + " state=" + Convert.ToInt32(drs["Rn_state"]) + " " + sjsj + " class='" + yustr + " " + Style + "'><a href='#'><span class='span01'>" + b + "</span>" + numDay + "<span style='color:yellow'>" + ZC(drs["Rn_roomNum"].ToString()) + "</span><br /><span class=\"fxhrj\">" + fxdic[Convert.ToInt32(drs["Rn_room"])] + "</span> <p>" + img + "<span class=\"icospan\">" + price + "</span><span class=\"lfico\">" + LFimg + "</span><span class=\"qianfei\"></span> <span class=\"xuzhu\">" + xuzhu + "</span><span class=\"czimg\">" + czico + "</span><span class=\"jzfimg\">" + jzfimg + "</span><span class='totime'>" + totime + "</span></p><br /><span class='zuofu'>" + Names + "</span><span class='youfu'>" + Convert.ToDecimal(drs["Rn_price"].ToString()).ToString("0.##") + "</span><span class=\"yue1\"></span><span class=\"stime\"></span><span class=\"shengyu\"></span></a><span class=\"yudao\">" + yudao + "</span></span>" + yudaoDay + "</li></ul></li>"); czico = ""; bs = false; } sbhtml.Append("</ul>"); } } DivContent.InnerHtml = sbhtml.ToString(); }
/// <summary> /// 换房 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdds_Click(object sender, EventArgs e) { Model.occu_infor mode = new Model.occu_infor(); string SQl = "update room_number set Rn_state=4 where Rn_roomNum='" + labfh.Text + "';update room_number set Rn_state=2 where Rn_roomNum='" + txt_RoomNum.Value + "'";; Model.occu_infor Ocmodels = new Model.occu_infor(); Ocmodels.state_id = 2; Ocmodels.continuelive = ids; Ocmodels.occ_time = System.DateTime.Now; Ocmodels.room_number = (txt_RoomNum.Value).ToString(); Ocmodels.real_price = Convert.ToDecimal(txt_Money.Value); Ocmodels.remark = txt_Remaker.Value; Ocmodels.state_id = 0; Ocmodels.occ_no = fmrzInfo.GetModel(ids).occ_no; Ocmodels.occ_name = fmrzInfo.GetModel(ids).occ_name; Ocmodels.occ_with = "否"; Ocmodels.stay_day = fmrzInfo.GetModel(ids).stay_day; Ocmodels.depar_time = fmrzInfo.GetModel(ids).depar_time; Ocmodels.sex = fmrzInfo.GetModel(ids).sex; Ocmodels.card_id = fmrzInfo.GetModel(ids).card_id; Ocmodels.brithday = fmrzInfo.GetModel(ids).brithday; Ocmodels.family_name = fmrzInfo.GetModel(ids).family_name; Ocmodels.address = fmrzInfo.GetModel(ids).address; Ocmodels.meth_pay_id = fmrzInfo.GetModel(ids).meth_pay_id; Ocmodels.deposit = fmrzInfo.GetModel(ids).deposit; Ocmodels.remark = fmrzInfo.GetModel(ids).remark; Ocmodels.lordRoomid = (txt_RoomNum.Value).ToString(); Ocmodels.phonenum = fmrzInfo.GetModel(ids).phonenum; Ocmodels.Room_type_model = fmrzInfo.GetModel(ids).Room_type_model; Ocmodels.source_id = fmrzInfo.GetModel(ids).source_id; Ocmodels.real_mode_id = fmrzInfo.GetModel(ids).real_mode_id; Ocmodels.real_scheme_id = fmrzInfo.GetModel(ids).real_scheme_id; Ocmodels.real_type_id = fmrzInfo.GetModel(ids).real_type_id; Ocmodels.order_id = fmrzInfo.GetModel(ids).order_id; Ocmodels.tuifaId = "0"; string noces = System.DateTime.Now.ToString().Replace("-", "").Replace(":", "").Replace(" ", ""); string strsql = ""; if (fmrzInfo.GetRecordCount("where order_id='" + Ocmodels.order_id + "'") == 1) { strsql = "update occu_infor set state_id=2,tuifaId=2,continuelive=1 ,order_id='" + noces + "' where occ_id='" + ids + "'"; } else { // strsql = "update occu_infor set state_id=3,tuifaId=2,continuelive=1 where order_id=" + Ocmodels.order_id + ""; strsql = "update occu_infor set state_id=2,tuifaId=2,continuelive=1 where occ_id=" + ids + ""; } fmrzInfo.Updates(strsql); CdHotelManage.Model.goods_account model = new CdHotelManage.Model.goods_account(); CdHotelManage.BLL.goods_account bll = new CdHotelManage.BLL.goods_account(); double money = double.Parse(txt_Money.Value) - double.Parse(labSymoney.Text); if (money > 0) { money = double.Parse(labSymoney.Text) - double.Parse(txt_Money.Value); } else { money = double.Parse(labSymoney.Text); } string Remaker = labname.Text + "从" + labfh.Text + "换到" + txt_RoomNum.Value + " 从" + labkffs.Text + "(" + labSymoney.Text + ")调整为天房(" + txt_Money.Value + ") 操作时间:" + System.DateTime.Now; string beizhu = fmGoods.GetModels(" where ga_Type=8 order by ga_date ").ga_remker + Remaker + ","; string Date = fmGoods.GetModels(" where ga_Type=8 order by ga_date ").ga_date.ToString(); string upsql = "update goods_account set ga_sum_price='" + money + "',ga_remker='" + beizhu + "' where ga_Type=8 and datediff(SS,ga_date,'" + Date + "')=0 and ga_occuid='" + Ocmodels.order_id + "'"; fmGoods.Updates(upsql); if (fhBll.Updates(SQl) && fmrzInfo.Add(Ocmodels) > 0) { Helper.AddRoom(Ocmodels.room_number); Helper.AddRoom(Ocmodels.lordRoomid); //Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", ""); ClientScript.RegisterStartupScript(GetType(), "message", "<script language='javascript'>if(confirm('换房成功,是否打换房单')){Show(" + ids + ");}else{ parent.location.reload(); };</script>"); } else { Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存失败!", ""); } }
//根据条件分页查询 public void BindGv(int pageSize, int pageindex) { Shwere(); string sort = "order_id"; string order = "DESC"; int currentPage = Pager.CurrentPageIndex; IList <Model.occu_infor> list = brBll.GetBookRoomPager(sort, order, currentPage, pageSize, stwhere); foreach (Model.occu_infor item in list) { if (orsort == "") { orsort = item.occ_id.ToString(); } else { orsort += "," + item.occ_id.ToString(); } } if (list.Count > 0) { GetListRoom(list); } #region DataSet dt = brBll.GetLists(stwhere); foreach (DataRow dr in dt.Tables[0].Rows) { try { if (dr["amount_rece"] == null || dr["amount_rece"].ToString() == "") { dr["amount_rece"] = 0; } if (dr["amount_money"] == null || dr["amount_money"].ToString() == "") { dr["amount_money"] = 0; } //Days += ldDays(Convert.ToDateTime(dr["occ_time"].ToString())); //FjMoneys += Convert.ToDouble(dr["real_price"]); //CSGZMoneys += GetFZ(ldDays(Convert.ToDateTime(dr["occ_time"].ToString())), dr["real_price"]); //YEMoneys += GetYE(dr["occ_no"]); //SKMoneys += GetSK(dr["occ_no"]); //XFMoneys += GetXF(dr["occ_no"]); } catch { } } Pager.RecordCount = brBll.GetRecordCount(stwhere); Pager.ShowCustomInfoSection = Wuqi.Webdiyer.ShowCustomInfoSection.Right; //Pager.PageSize = pageSize; //Pager.CurrentPageIndex = pageindex; #endregion if (Pager != null) { if (Pager.RecordCount != 0) { Pager.ShowPageIndex = true; Pager.ShowDisabledButtons = true; Pager.CustomInfoSectionWidth = new System.Web.UI.WebControls.Unit("40%"); Pager.ShowPageIndexBox = Wuqi.Webdiyer.ShowPageIndexBox.Always; Pager.CustomInfoHTML = " 记录总数:<b>" + Pager.RecordCount.ToString() + "</b>"; Pager.CustomInfoHTML += " 总页数:<b>" + Pager.PageCount.ToString() + "</b>"; Pager.CustomInfoHTML += " 当前页:<font color=\"red\"><b>" + Pager.CurrentPageIndex.ToString() + "</b></font>"; } else { Pager.ShowPageIndex = false; Pager.ShowDisabledButtons = false; Pager.ShowPageIndexBox = Wuqi.Webdiyer.ShowPageIndexBox.Never; Pager.CustomInfoSectionWidth = new System.Web.UI.WebControls.Unit("100%"); Pager.CustomInfoHTML = "<div class='norecord'><span>当前无记录</span></div>"; } } return; }