//设置营业信息状态栏 private void setStatus() { BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString); if (!BathClass.getAuthority(db_new, LogIn.m_User, "营业信息查看")) { statusStrip2.Visible = false; return; } seatTotal.Text = db_new.HotelRoom.Count().ToString(); seatAvi.Text = db_new.HotelRoom.Where(x => x.status == 1).Count().ToString(); int count = 0; double pm = BathClass.get_paid_expense(db_new, thisTime, ref count); seatPaid.Text = count.ToString(); moneyPaid.Text = pm.ToString(); seatUnpaid.Text = db_new.HotelRoom.Where(x => x.status == 2 || x.status == 6 || x.status == 7 || x.status == 8).Count().ToString(); double upm = BathClass.get_unpaid_expense(db_new, LogIn.connectionString); moneyUnpaid.Text = upm.ToString(); moneyTotal.Text = (pm + upm).ToString(); }
private void setStatus() { BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString); if (!BathClass.getAuthority(db_new, LogIn.m_User, "营业信息查看")) { statusStrip2.Visible = false; return; } seatTotal.Text = db_new.Seat.Count().ToString(); seatAvi.Text = db_new.Seat.Where(x => x.status == 1).Count().ToString(); DateTime st = DateTime.Parse("2013-1-1 00:00:00"); if (db_new.ClearTable.Count() != 0) { st = db_new.ClearTable.ToList().Last().clearTime; } int count = 0; double pm = BathClass.get_paid_expense(db_new, st, ref count); seatPaid.Text = count.ToString(); moneyPaid.Text = pm.ToString(); seatUnpaid.Text = db_new.Seat.Where(x => x.status == 2 || x.status == 6 || x.status == 7 || x.status == 8).Count().ToString(); double upm = BathClass.get_unpaid_expense(db_new, LogIn.connectionString); moneyUnpaid.Text = upm.ToString(); moneyTotal.Text = (pm + upm).ToString(); }
//打印时间改变 private void ptTimeList_SelectedIndexChanged(object sender, EventArgs e) { get_print_time(); if (BathClass.getAuthority(db, LogIn.m_User, "收银报表")) dgv_show(); }
//锁定解锁 private void CtxLock_Click(object sender, EventArgs e) { BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString); var seat = getContextSenderSeat(db_new, sender); if (BathClass.getAuthority(db_new, LogIn.m_User, "锁定解锁")) { lock_unlock(seat, db_new, LogIn.m_User); return; } InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd(); if (inputEmployee.ShowDialog() != DialogResult.OK) { return; } if (!BathClass.getAuthority(db_new, inputEmployee.employee, "锁定解锁")) { BathClass.printErrorMsg("权限不够!"); return; } lock_unlock(seat, db_new, inputEmployee.employee); }
//消费录入 private void orderTool_Click(object sender, EventArgs e) { BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString); if (!BathClass.getAuthority(db_new, LogIn.m_User, "完整点单") && !BathClass.getAuthority(db_new, LogIn.m_User, "可见本人点单")) { BathClass.printErrorMsg("权限不够!"); return; } List <int> sLst = new List <int>(); sLst.Add(2); sLst.Add(6); var inputSeatForm = new InputRoomForm(sLst); if (inputSeatForm.ShowDialog() != DialogResult.OK) { return; } var seat = db_new.HotelRoom.FirstOrDefault(x => x.text == inputSeatForm.m_Seat.text); seat.ordering = true; db_new.SubmitChanges(); var orderForm = new HotelRoomOrderForm(inputSeatForm.m_Seat); orderForm.ShowDialog(); seat.ordering = false; db_new.SubmitChanges(); }
//扣卡 private void toolDeduct_Click(object sender, EventArgs e) { //if (m_thread != null && m_thread.IsAlive) // m_thread.Abort(); var dc = new BathDBDataContext(LogIn.connectionString); DeductedCardForm form = new DeductedCardForm(); if (BathClass.getAuthority(dc, LogIn.m_User, "扣卡")) { form.ShowDialog(); } else { InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd(); if (inputEmployee.ShowDialog() != DialogResult.OK) { return; } if (!BathClass.getAuthority(dc, inputEmployee.employee, "扣卡")) { BathClass.printErrorMsg(inputEmployee.employee.id + "不具有扣卡权限!"); return; } form.ShowDialog(); } }
//添加备注 private void CtxAddNote_Click(object sender, EventArgs e) { BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString); if (!BathClass.getAuthority(db_new, LogIn.m_User, "添加备注")) { BathClass.printErrorMsg("权限不够!"); return; } Seat seat = getContextSenderSeat(db_new, sender); if (seat.status != 2 && seat.status != 6) { BathClass.printErrorMsg("手牌未使用,不能添加备注"); return; } NoteForm noteForm = new NoteForm(); if (noteForm.ShowDialog() != DialogResult.OK) { return; } seat.note = noteForm.note; db_new.SubmitChanges(); }
//更换手牌 private void CtxChangeSeat_Click(object sender, EventArgs e) { BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString); Seat seat = getContextSenderSeat(db_new, sender); InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd(); if (inputEmployee.ShowDialog() != DialogResult.OK) { return; } if (!BathClass.getAuthority(db_new, inputEmployee.employee, "更换手牌")) { BathClass.printErrorMsg(inputEmployee.employee.id + "不具有更换手牌操作权限!"); return; } if (seat.status != 2) { BathClass.printErrorMsg("该手牌目前不在使用中,不能换台!"); return; } List <int> sLst = new List <int>(); sLst.Add(1); sLst.Add(3); InputSeatForm inputSeatForm = new InputSeatForm(sLst); if (inputSeatForm.ShowDialog() != DialogResult.OK) { return; } Seat newSeat = db_new.Seat.FirstOrDefault(x => x == inputSeatForm.m_Seat); var orders = db_new.Orders.Where(x => x.systemId == seat.systemId); foreach (Orders order in orders) { order.text = newSeat.text; } newSeat.systemId = seat.systemId; newSeat.name = seat.name; newSeat.population = seat.population; newSeat.openTime = BathClass.Now(LogIn.connectionString); newSeat.openEmployee = LogIn.m_User.name; newSeat.phone = seat.phone; newSeat.chainId = seat.chainId; newSeat.status = seat.status; newSeat.note = seat.note; newSeat.ordering = seat.ordering; BathClass.reset_seat(seat); db_new.SubmitChanges(); }
//留牌操作 F9 //private void toolKeep_Click(object sender, EventArgs e) //{ // List<int> sLst = new List<int>(); // sLst.Add(2); // sLst.Add(6); // sLst.Add(7); // InputSeatForm inputseatForm = new InputSeatForm(sLst); // if (inputseatForm.ShowDialog() != DialogResult.OK) // return; // var seat = inputseatForm.m_Seat; // if (m_Seats.FirstOrDefault(x=>x.text==seat.text) == null) // { // m_Seats.Add(seat); // var dc_new = new BathDBDataContext(LogIn.connectionString); // dc_new.HotelRoom.FirstOrDefault(x => x.text == inputseatForm.m_Seat.text).paying = false; // dc_new.SubmitChanges(); // } // dgvChain_show(); // dgvChain.CurrentCell = null; // //chain = true; // //dgvExpense_show(); // //setStatus(); //} //联牌账务 //private void btnChain_Click(object sender, EventArgs e) //{ // //chain = true; // dgvChain.CurrentCell = null; // dgvExpense_show(); // setStatus(); //} //退单 F10 private void toolReturn_Click(object sender, EventArgs e) { BathDBDataContext dc = new BathDBDataContext(LogIn.connectionString); if (dgvExpense.CurrentCell == null) { BathClass.printErrorMsg("需要输入订单!"); return; } int orderId = Convert.ToInt32(dgvExpense.CurrentRow.Cells[0].Value); var order = dc.Orders.FirstOrDefault(x => x.id == orderId); if (order == null || order.menu.Contains("套餐")) { BathClass.printErrorMsg("不能删除套餐优惠!"); return; } InputEmployeeByPwd inputServerForm = new InputEmployeeByPwd(); Employee del_employee; if (BathClass.getAuthority(dc, LogIn.m_User, "退单")) { del_employee = LogIn.m_User; } else if (inputServerForm.ShowDialog() != DialogResult.OK) { return; } else if (!BathClass.getAuthority(dc, inputServerForm.employee, "退单")) { BathClass.printErrorMsg("没有退单权限"); return; } else { del_employee = inputServerForm.employee; } order.deleteEmployee = del_employee.id.ToString(); Employee employee = dc.Employee.FirstOrDefault(x => x.id.ToString() == order.technician); if (employee != null) { employee.status = "空闲"; } dc.SubmitChanges(); find_combo(dc, order); dgvExpense_show(dc); setStatus(dc); }
//应付账款 private void btnPayableMoney_Click(object sender, EventArgs e) { var db = new BathDBDataContext(LogIn.connectionString); string pro = ((Button)sender).Text; if (!BathClass.getAuthority(db, LogIn.m_User, pro)) { GeneralClass.printErrorMsg("权限不够,不能访问!"); return; } }
//重新结账 private void CtxRepay_Click(object sender, EventArgs e) { //TableCashierCheckForm tableCashierSummaryForm = new TableCashierCheckForm(); //tableCashierSummaryForm.ShowDialog(); BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString); Seat seat = getContextSenderSeat(db_new, sender); InputEmployeeByPwd inputEmployee = new InputEmployeeByPwd(); if (inputEmployee.ShowDialog() != DialogResult.OK) { return; } if (!BathClass.getAuthority(db_new, inputEmployee.employee, "重新结账")) { BathClass.printErrorMsg("权限不够!"); return; } if (seat.status != 3) { BathClass.printErrorMsg("手牌未结账,不能重新结账"); return; } var act = db_new.Account.FirstOrDefault(x => x.systemId.Contains(seat.systemId) && x.abandon == null); var ids = act.systemId.Split('|'); var seats = db_new.Seat.Where(x => ids.Contains(x.systemId)); foreach (var s in seats) { if (s.status == 2 || s.status == 6 || s.status == 7) { BathClass.printErrorMsg("已经重新开牌,请先更换手牌"); return; } s.status = 8; var orders = db_new.Orders.Where(x => x.systemId == s.systemId); foreach (var order in orders) { order.paid = false; } } act.abandon = inputEmployee.employee.id; var cc = db_new.CardCharge.FirstOrDefault(x => act.systemId == x.CC_AccountNo); if (cc != null) { db_new.CardCharge.DeleteOnSubmit(cc); } db_new.SubmitChanges(); }
//读卡 private void btnRead_Click(object sender, EventArgs e) { if (!BathClass.getAuthority(db, LogIn.m_User, "读卡")) { BathClass.printErrorMsg("权限不够!"); return; } MemberShowForm memberReadForm = new MemberShowForm(); memberReadForm.ShowDialog(); }
//充值 private void btnPop_Click(object sender, EventArgs e) { if (!BathClass.getAuthority(db, LogIn.m_User, "充值")) { BathClass.printErrorMsg("权限不够!"); return; } MemberPopForm memberPopForm = new MemberPopForm(m_Seat); memberPopForm.ShowDialog(); }
//结账单据查询 private void btnBillTbale_Click(object sender, EventArgs e) { var db = new BathDBDataContext(LogIn.connectionString); if (!BathClass.getAuthority(db, LogIn.m_User, "收银单据查询")) { GeneralClass.printErrorMsg("权限不够,不能访问!"); return; } TableCashierCheckForm tableCashierCheckForm = new TableCashierCheckForm(); tableCashierCheckForm.ShowDialog(); }
//开牌登记 private void btnSeat_Click(object sender, EventArgs e) { var db = new BathDBDataContext(LogIn.connectionString); if (!BathClass.getAuthority(db, LogIn.m_User, "开牌")) { GeneralClass.printErrorMsg("不具有权限"); return; } ReceptionSeatForm receptionSeatForm = new ReceptionSeatForm(); receptionSeatForm.ShowDialog(); }
//客房管理 private void btnRoomManage_Click(object sender, EventArgs e) { var db = new BathDBDataContext(LogIn.connectionString); if (!BathClass.getAuthority(db, LogIn.m_User, "客房管理")) { GeneralClass.printErrorMsg("权限不够,不能访问!"); return; } RoomManagementForm roomForm = new RoomManagementForm(); roomForm.ShowDialog(); }
//会员卡售卡及续卡统计 private void btnMemberCardSale_Click(object sender, EventArgs e) { var db = new BathDBDataContext(LogIn.connectionString); if (!BathClass.getAuthority(db, LogIn.m_User, "会员售卡及充值统计")) { GeneralClass.printErrorMsg("权限不够,不能访问!"); return; } MemberCardSaleForm memberCardSaleForm = new MemberCardSaleForm(); memberCardSaleForm.ShowDialog(); }
//提成统计 private void btnBonusTable_Click(object sender, EventArgs e) { var db = new BathDBDataContext(LogIn.connectionString); if (!BathClass.getAuthority(db, LogIn.m_User, "提成统计")) { GeneralClass.printErrorMsg("权限不够,不能访问!"); return; } BonusTableForm bonusTableForm = new BonusTableForm(); bonusTableForm.ShowDialog(); }
//营业报表 private void btnOverallTable_Click(object sender, EventArgs e) { var db = new BathDBDataContext(LogIn.connectionString); if (!BathClass.getAuthority(db, LogIn.m_User, "营业报表")) { GeneralClass.printErrorMsg("权限不够,不能访问!"); return; } DayOperationForm tableOperationForm = new DayOperationForm(); tableOperationForm.ShowDialog(); }
//往来单位账目统计 private void btnAccountWithTable_Click(object sender, EventArgs e) { var db = new BathDBDataContext(LogIn.connectionString); if (!BathClass.getAuthority(db, LogIn.m_User, "往来单位账目")) { GeneralClass.printErrorMsg("权限不够,不能访问!"); return; } AccountWithTableForm accountWithTableForm = new AccountWithTableForm(); accountWithTableForm.ShowDialog(); }
//售卡 private void btnSale_Click(object sender, EventArgs e) { if (!BathClass.getAuthority(db, LogIn.m_User, "售卡")) { BathClass.printErrorMsg("权限不够!"); return; } OpenCardForm openCardForm = new OpenCardForm(m_Seat); if (openCardForm.ShowDialog() == DialogResult.OK) { this.Close(); } }
//客房 private void btnRoom_Click(object sender, EventArgs e) { BathDBDataContext db_new = new BathDBDataContext(LogIn.connectionString); if (!BathClass.getAuthority(db_new, LogIn.m_User, "包房管理")) { BathClass.printErrorMsg("权限不够!"); return; } RoomViewForm rmvForm = new RoomViewForm(); rmvForm.ShowDialog(); }
//进货入库 private void btnInStock_Click(object sender, EventArgs e) { var db = new BathDBDataContext(LogIn.connectionString); string pro = ((Button)sender).Text; if (!BathClass.getAuthority(db, LogIn.m_User, pro)) { GeneralClass.printErrorMsg("权限不够,不能访问!"); return; } IntoStockManagementForm inStockForm = new IntoStockManagementForm(); inStockForm.ShowDialog(); }
//录单汇总 private void toolAllOrder_Click(object sender, EventArgs e) { var db_new = new BathDBDataContext(LogIn.connectionString); if (!BathClass.getAuthority(db_new, LogIn.m_User, "录单汇总")) { BathClass.printErrorMsg("不具有权限"); return; } TableOrderTableForm orderTableForm = new TableOrderTableForm(LogIn.connectionString, LogIn.m_User); orderTableForm.ShowDialog(); }
//技师管理 private void toolTech_Click(object sender, EventArgs e) { var db_new = new BathDBDataContext(LogIn.connectionString); if (!BathClass.getAuthority(db_new, LogIn.m_User, "技师管理")) { BathClass.printErrorMsg("不具有权限"); return; } TechnicianSeclectForm technicianForm = new TechnicianSeclectForm(); technicianForm.ShowDialog(); }
//调货补货 private void btnAdjust_Click(object sender, EventArgs e) { var db = new BathDBDataContext(LogIn.connectionString); string pro = ((Button)sender).Text; if (!BathClass.getAuthority(db, LogIn.m_User, pro)) { GeneralClass.printErrorMsg("权限不够,不能访问!"); return; } TransferStockMangeForm transferStockMangeForm = new TransferStockMangeForm(); transferStockMangeForm.ShowDialog(); }
//开牌 private void open_seat(HotelRoom seat, BathDBDataContext db_new) { if (!BathClass.getAuthority(db_new, LogIn.m_User, "开牌")) { BathClass.printErrorMsg("权限不够!"); return; } OpenSeatForm openSeatForm = new OpenSeatForm(seat, true); openSeatForm.ShowDialog(); //updateTimer_Elapsed(null, null); dgv_shoe_show(); }
//卡入库 private void btnMemberPop_Click(object sender, EventArgs e) { var db = new BathDBDataContext(LogIn.connectionString); if (!BathClass.getAuthority(db, LogIn.m_User, "卡入库")) { GeneralClass.printErrorMsg("不具有权限"); return; } var form = new OpenCardForm(); form.ShowDialog(); }
//数据优化 private void btnOptimization_Click(object sender, EventArgs e) { var db = new BathDBDataContext(LogIn.connectionString); string pro = ((Button)sender).Text; if (!BathClass.getAuthority(db, LogIn.m_User, pro)) { GeneralClass.printErrorMsg("权限不够,不能访问!"); return; } OptimizationForm optimizationForm = new OptimizationForm(); optimizationForm.ShowDialog(); }
private void change_seat(BathDBDataContext db_new, HotelRoom seat) { if (!BathClass.getAuthority(db_new, LogIn.m_User, "更换手牌")) { BathClass.printErrorMsg(LogIn.m_User.name + "不具有更换房间操作权限!"); return; } if (seat.status != 2) { BathClass.printErrorMsg("该房间目前不在使用中,不能换房!"); return; } List <int> sLst = new List <int>(); sLst.Add(1); sLst.Add(3); InputHotelRoomForm inputSeatForm = new InputHotelRoomForm(sLst); if (inputSeatForm.ShowDialog() != DialogResult.OK) { return; } HotelRoom newSeat = db_new.HotelRoom.FirstOrDefault(x => x.text == inputSeatForm.m_Seat.text); var orders = db_new.Orders.Where(x => x.systemId == seat.systemId); foreach (Orders order in orders) { order.text = newSeat.text; } newSeat.systemId = seat.systemId; newSeat.name = seat.name; newSeat.population = seat.population; newSeat.openTime = BathClass.Now(LogIn.connectionString); newSeat.openEmployee = LogIn.m_User.name; //newSeat.money = seat.money; newSeat.phone = seat.phone; newSeat.chainId = seat.chainId; newSeat.status = seat.status; newSeat.note = seat.note; newSeat.ordering = seat.ordering; BathClass.reset_seat(seat); db_new.SubmitChanges(); dgv_shoe_show(); }