Пример #1
0
        public override void SonLoad()
        {
            if (!IsPostBack)
            {
                string accounts = Request.QueryString["accounts"];
                term.Value      = DateTime.Now.ToString();
                accountst.Value = accounts;
                Bind(accounts);
                BindPtype();
                BLL.room_type bllrt = new BLL.room_type();
                if (Request.QueryString["type"] == "edit")//编辑
                {
                    int id = Convert.ToInt32(Request.QueryString["id"]);
                    BindInfo(id);
                    BLL.cprotocolPrice bllcprice = new BLL.cprotocolPrice();
                    rep1.DataSource = bllcprice.GetModelList("Accounts='" + accounts + "' and cpID=" + id);
                    rep1.DataBind();
                }
                else   //添加
                {
                    List <Model.room_type> listrt1 = bllrt.GetModelList("");
                    foreach (Model.room_type item in listrt1)
                    {
                        sbPrice.Append("<tr>");
                        sbPrice.Append("<td width=\"15%\" typeid='" + item.id + "' class=\"roomType\">" + item.room_name + "</td>");
                        sbPrice.Append("<td width=\"15%\" class=\"Price\">" + Convert.ToDecimal(item.room_listedmoney).ToString("0.##") + "</td>");
                        sbPrice.Append("<td width=\"15%\" class=\"zdPrice\">1</td>");
                        sbPrice.Append("<td width=\"15%\" class=\"protoPrice\">" + Convert.ToDecimal(item.room_listedmoney).ToString("0.##") + "</td>");
                        sbPrice.Append("<td width=\"15%\" class=\"mothPrice\">" + Convert.ToDecimal(item.Room_Moth_price).ToString("0.##") + "</td>");
                        sbPrice.Append("<td width=\"15%\" class=\"commission\">0</td>");
                        sbPrice.Append("<td width=\"16%\" ><a href=\"#\" onclick=\"RowEdit(this)\"><img src=\"../images/037.gif\" width=\"10\" height=\"10\" ></a><a href=\"#\"onclick=\"RowDelete(this)\"><img src=\"../images/010.gif\" width=\"10\" height=\"10\" ></a></td>");
                        sbPrice.Append("</tr>");
                    }
                }


                List <Model.room_type> listrt = bllrt.GetModelList("");
                foreach (Model.room_type item in listrt)
                {
                    sbtext.Append("<option value='" + item.id + "'>" + item.room_name + "</option>");


                    //Model.mtPrice modelmt = new Model.mtPrice();
                    //modelmt.RoomType = item.id;
                    //modelmt.zdPrice = 1;
                    //modelmt.Price = Convert.ToInt32(item.room_listedmoney);
                    //modelmt.Dayprice = Convert.ToInt32(item.room_listedmoney);
                    //modelmt.lcPrice = Convert.ToInt32(item.room_listedmoney);
                    //BLL.mtPrice bllm = new BLL.mtPrice();
                    //bllm.Add(modelmt);
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 所有价格列表
        /// </summary>
        private void Getpice()
        {
            System.Text.StringBuilder sbtext = new System.Text.StringBuilder();
            int id = Convert.ToInt32(context.Request.QueryString["id"]);

            //判断是不是使用固定折扣值
            BLL.cprotocol   bllcp   = new BLL.cprotocol();
            Model.cprotocol modelcp = bllcp.GetModel(id);
            if (!modelcp.Isdiscount)
            { //如果使用自定义折扣
                BLL.cprotocolPrice          bllcpp  = new BLL.cprotocolPrice();
                List <Model.cprotocolPrice> listcpp = bllcpp.GetModelList("cpID=" + id);
                BLL.room_type          bllty        = new BLL.room_type();
                List <Model.room_type> listrt       = bllty.GetModelList("");
                foreach (Model.room_type item in listrt)
                {
                    List <Model.cprotocolPrice> newcpp = listcpp.Where(d => d.RoomType == item.id).ToList();
                    if (newcpp.Count > 0)
                    {
                        sbtext.Append("<tr><td>" + GetFxName(Convert.ToInt32(newcpp[0].RoomType)) + "</td><td>" + Convert.ToDecimal(newcpp[0].Price).ToString("0.##") + "</td><td>" + Convert.ToDecimal(newcpp[0].protoPrice).ToString("0.##") + "</td><td>" + Convert.ToDecimal(newcpp[0].mothPrice).ToString("0.##") + "</td></tr>");
                    }
                    else
                    {
                        sbtext.Append("<tr><td>" + GetFxName(item.id) + "</td><td>" + Convert.ToDecimal(item.room_listedmoney).ToString("0.##") + "</td><td>" + Convert.ToDecimal(item.room_listedmoney).ToString("0.##") + "</td><td>" + Convert.ToDecimal(item.Room_Moth_price).ToString("0.##") + "</td></tr>");
                    }
                }
            }
            else
            {
                decimal                duding = Convert.ToDecimal(modelcp.discount);
                BLL.room_type          bllty  = new BLL.room_type();
                List <Model.room_type> listrt = bllty.GetModelList("");
                foreach (Model.room_type item in listrt)
                {
                    sbtext.Append("<tr><td>" + GetFxName(item.id) + "</td><td>" + Convert.ToDecimal(item.room_listedmoney).ToString("0.##") + "</td><td>" + Convert.ToDecimal(item.room_listedmoney * duding).ToString("0.##") + "</td><td>" + Convert.ToDecimal(item.Room_Moth_price * duding).ToString("0.##") + "</td></tr>");
                }
            }

            context.Response.Write(sbtext.ToString());
        }
 /// <summary>
 /// 协议入住费用转
 /// </summary>
 private void XieYi()
 {
     if (accounts.Value != "")   //如果是协议单位入住,更新入住天数    并要把设置计算佣金
     {
         Model.occu_infor modelocc = fmOc.GetModel(ids);
         TimeSpan         ts       = Convert.ToDateTime(modelocc.depar_time) - Convert.ToDateTime(modelocc.occ_time);
         int mydays = ts.Days;
         if (mydays <= 0)
         {
             mydays = 1;
         }
         Model.customer modelcus = bllcus.GetAccounts(accounts.Value);
         modelcus.occNum += mydays;
         bllcus.Update(modelcus);
         /*计算佣金*/
         string accou = account.Value;
         if (modelocc.CpID != null)
         {
             Model.cprotocol modelcp = bllcp.GetModel(Convert.ToInt32(modelocc.CpID));
             if (modelcp != null)
             {
                 bool dayhire    = modelcp.Dayhire;                     //是否每日计佣
                 int  Commission = Convert.ToInt32(modelcp.Commission); //佣金
                 bool ishire     = modelcp.ishire;                      //是否按房类计佣
                 int  day        = ts.Days;
                 int  sum        = 0;                                   //总佣金
                 if (ishire)                                            //如果 是按房类记算佣金
                 {
                     BLL.cprotocolPrice          bllcpp  = new BLL.cprotocolPrice();
                     List <Model.cprotocolPrice> listcpp = bllcpp.GetModelList("cpID=" + modelcp.ID + " and RoomType=" + modelocc.real_type_id);
                     if (listcpp.Count > 0)
                     {
                         Commission = Convert.ToInt32(listcpp[0].commission);
                     }
                 }
                 if (dayhire)
                 {
                     sum = Commission * day;
                 }
                 else
                 {
                     sum = Commission;
                 }
                 BLL.Commission   bllcomm   = new BLL.Commission();
                 Model.Commission modelcomm = new Model.Commission();
                 modelcomm.Accounts   = accounts.Value;
                 modelcomm.CommDesp   = "";
                 modelcomm.CommDate   = DateTime.Now;
                 modelcomm.CommSum    = sum;
                 modelcomm.IsBack     = false;
                 modelcomm.GoodNumber = modelocc.occ_no;
                 modelcomm.IsEveryDay = modelcp.Dayhire;
                 modelcomm.DayComm    = modelcp.Commission;
                 modelcomm.CommRemark = "";
                 bllcomm.Add(modelcomm);
             }
         }
     }
     if (idids.Value != "")   //如果是协议单位
     {
         List <Model.goods_account> listga = bllga.GetModelList1("ID in (" + idids.Value + ")");
         if (listga.Count > 0)
         {
             foreach (Model.goods_account item in listga)
             {
                 item.Ga_Account = account.Value;
                 item.ga_Type    = 204;
                 bllga.Update(item);
             }
         }
     }
 }