Пример #1
0
        /// <summary>
        /// 撤销结账
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btncxSava_Click(object sender, EventArgs e)
        {
            if (ddlState.SelectedValue == "4")
            {
                string SQls = "update room_number set Rn_state=2 where Rn_roomNum='" + brBll.GetModel(Convert.ToInt32(txt_room.Value)).room_number + "'";
                string strs = "update occu_infor set state_id='0', tuifaId='0',occ_TfTime=null where occ_id=" + txt_room.Value + "";

                if (fmroom.Updates(SQls) && brBll.Updates(strs))
                {
                    Maticsoft.Common.MessageBox.ShowAndRedirect(this, "撤销挂单成功!", "");
                }
            }
            else
            {
                List <Model.goods_account> listga = bllga.GetModelList1("ga_occuid='" + brBll.GetModel(Convert.ToInt32(txt_room.Value)).order_id + "' and ga_isjz=1");
                if (listga != null && listga.Count > 0)
                {
                    Maticsoft.Common.MessageBox.ShowAndRedirect(this, "已交班不能撤销结账!", "");
                }
                else
                {
                    string strsql = "update goods_account set ga_sfacount='否' where ga_occuid='" + brBll.GetModel(Convert.ToInt32(txt_room.Value)).order_id + "'";
                    string SQl    = string.Empty;
                    if (rooms.Value != "")
                    {
                        SQl = "update room_number set Rn_state=2 where Rn_roomNum in(" + rooms.Value + ")";
                    }
                    string strs = "update occu_infor set state_id='0', tuifaId='0' where order_id=" + brBll.GetModel(Convert.ToInt32(txt_room.Value)).order_id + "";
                    string SQls = "delete from goods_account where ga_Type in(4,6) and ga_occuid='" + brBll.GetModel(Convert.ToInt32(txt_room.Value)).order_id + "'";
                    if (fmroom.Updates(SQl) && brBll.Updates(strs))
                    {
                        fmgoods.Updates(strsql);
                        fmgoods.Deletes(SQls);
                        string up = rooms.Value.Replace("'", "");
                        Helper.AddRoom(brBll.GetModel(Convert.ToInt32(txt_room.Value)).room_number, up + ",");
                        Maticsoft.Common.MessageBox.ShowAndRedirect(this, "撤销结账成功!", "");
                    }
                    else
                    {
                        Maticsoft.Common.MessageBox.ShowAndRedirect(this, "撤销结账失败!", "");
                    }
                }
            }
        }