private void btncheckout_Click(object sender, EventArgs e) { if (lsvBill.Tag == null) { MessageBox.Show("Hãy chọn bàn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } TableDTO table = lsvBill.Tag as TableDTO; int idtable = table.ID; int idbill = BillDAO.GetUncheckedBillIDByTableID(idtable); int giamgia = (int)nmGiamGia.Value; //double TongTien = Convert.ToDouble(txtTongTien.Text.Split(',')[0]); //double TongTienGiamGia = TongTien - (TongTien/100)*giamgia; float TongTienGiamGia = thanhtoan - (thanhtoan / 100) * giamgia; if (idbill != -1) { if (MessageBox.Show(string.Format("Bạn có chắc thanh toán hóa đơn với số tiền là {0}-({1}/100)*{2} = {3}", thanhtoan, thanhtoan, giamgia, TongTienGiamGia), "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { BillDAO.CheckOut(idbill, giamgia, TongTienGiamGia); Showbill(idtable); LoadTable(); } } nmGiamGia.Value = 0; }
private void btnPay_Click(object sender, EventArgs e) { Table table = listViewMenu.Tag as Table; BillDAO billDAO = new BillDAO(); var response = billDAO.GetUnPaidBill(table.id); String idCurrentBill = response.Content; if (idCurrentBill != "0") { if (MessageBox.Show("Bạn có chắc thanh toán cho " + table.title + " không?", "Thanh toán", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { billDAO.CheckOut(idCurrentBill, (float)numericUpDownDiscount.Value); if (numericUpDownDiscount.Value != 0) { double totalPrice = Convert.ToDouble(txbTotalPrice.Text.Split(',')[0]) * 1000; double final_price = totalPrice - (totalPrice / 100) * (float)numericUpDownDiscount.Value; string text = "Số tiền bạn cần thanh toán sau khi giảm giá " + numericUpDownDiscount.Value + "% là:\n" + totalPrice.ToString() + " - " + totalPrice.ToString() + " * " + numericUpDownDiscount.Value + "% =" + final_price.ToString() + " VND"; MessageBox.Show(text, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); //SẼ PHÁT TRIỂN THÊM IN HÓA ĐƠN FILE EXCEL } loadMenuByIdTable(table.id); CultureInfo culture = new CultureInfo("vi-VN"); int finalPrice = 0; txbTotalPrice.Text = finalPrice.ToString("c", culture); } } loadFinalTotalPrice(table.id); loadTable(table.id); //loadListTable(); numericUpDownDiscount.Value = 0; }
private void btnaddfood_Click(object sender, EventArgs e) { if (lsvBill.Tag == null) { MessageBox.Show("Hãy chọn bàn", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } lsvBill.Items.Clear(); TableDTO table = lsvBill.Tag as TableDTO; //mục đích: lấy id của bàn đang được chọn để thêm int idbill = BillDAO.GetUncheckedBillIDByTableID(table.ID); //từ id bàn => lấy được id của hóa đơn int idfood = (cbThucAn.SelectedItem as FoodDTO).Id; int count = (int)nmfoodcount.Value; if (idbill == -1)//case: chưa có hóa đơn, bàn còn trống { BillDAO.InsertBill(table.ID); //tham số idhoadon: hoa don them sau cung => co id la lon nhat //tham số id thức ăn: lấy từ combobox //tham số số lượng thức ăn lấy từ nmfoodcount BillInfoDAO.InsertBillInfo(BillDAO.GetMaxIdBill(), idfood, count); } else//case: hóa đơn đã tồn tại => sẽ thêm món mới hoặc cập nhật thêm số lượng món //kiểm tra món đã tồn tại hay chưa ta xử lí bên dưới server { BillInfoDAO.InsertBillInfo(idbill, idfood, count); } nmfoodcount.Value = 1; Showbill(table.ID); LoadTable(); }
public BaseResponse <decimal> GetAll() { var list = new BillDAO().GetRevenueMonth(); BaseResponse <decimal> response = new BaseResponse <decimal>(StatusResponse.Success, "", list.ToList()); return(response); }
public bool Handle(Bill bill) { bool kq = true; bool result = new BillDAO().InsertBill(bill); if (result) { foreach (var bdt in bill.ListBillDetail) { bool rs = new BillDetailDao().InsertBillDetail(bdt); if (rs) { continue; } else { kq = false; MessageBox.Show("Lỗi"); break; } } } else { kq = false; } return(kq); }
/** * Sự kiện chuyên qua trang xác nhận */ private void btnNext_Click(object sender, EventArgs e) { ticketID = frmRoom.ticketID; strl = frmRoom.strl; frmRoom.Visible = false; string str = ""; string str1 = ""; //load seat strl.ForEach(item => { str += item + " "; }); //load idseat ticketID.ForEach(item => { str1 += item + " "; }); BillDAO bill = new BillDAO(); frmConfirmTicket = new ConfirmTicket(str, str1); frmConfirmTicket.MdiParent = this; frmConfirmTicket.lblCinema.Text = C_Name; frmConfirmTicket.lblRoom.Text = Room_Name; frmConfirmTicket.lblSchedule.Text = sche_Name; frmConfirmTicket.lblFname.Text = F_Name; frmConfirmTicket.btnConfirm.Click += new System.EventHandler(this.btnConfirm_Click); frmConfirmTicket.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); frmConfirmTicket.Show(); }
//Doanh thu void LoadListBillByDate(DateTime ngayvao, DateTime ngayra) { dgvbill.DataSource = BillDAO.GetListBillDate(ngayvao, ngayra); dgvbill.Columns["tenban"].HeaderText = "Tên bàn"; dgvbill.Columns["TongTien"].HeaderText = "Tổng tiền"; dgvbill.Columns["ngayvao"].HeaderText = "Ngày vào"; dgvbill.Columns["ngayra"].HeaderText = "Ngày ra"; }
public ActionResult OrderDetail(int id) { //var user = Session["User"] as TMDT.Account; //if (user == null) // return RedirectToAction("Login", "Home"); var model = new BillDAO().GetDetailBill_BillID(id); return(View(model)); }
private void btnBookRoom_Click(object sender, EventArgs e) { var dao = new BillDAO(); var bill = dao.initializationBill(); var fBookRoom = new fBookRoom(bill, 0); fBookRoom.bookroomrEven += FbookroomEven; fBookRoom.ShowDialog(); }
public JsonResult checkStatus(int id) { var result = new BillDAO().changeStatus(id); return(Json(new { status = result })); }
public IHttpActionResult Get(int id) { var b = new BillDAO().Take(id); // Lay phan tu voi id tuong ung if (b == null) { return(NotFound()); } return(Ok(b)); }
public BaseResponse <BillDetail> CreateBill(List <BillDetail> obj) { var bill = new BillDAO().GetBill(obj[0].BillID); var result1 = new BillDetailDAO().Create(obj, bill.UserName); StatusResponse status = result1 ? StatusResponse.Success : StatusResponse.Fail; BaseResponse <BillDetail> response = new BaseResponse <BillDetail>(status, "", null); return(response); }
private void Confirm_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Are you sure?", "", MessageBoxButton.YesNo); switch (result) { case MessageBoxResult.Yes: //cap nhat database //cap nhat BillHistory //cap nhat Detail Bill //init //BaseDAO dao1 = BaseDAO int tmpIdCashier = LoginForm.Idcashier; //chuyen sale.basket sang dang directory Dictionary <int, int> tmpbasket = new Dictionary <int, int>(); foreach (infobasket t in sale.baskets) { tmpbasket.Add(t.ProductID, t.size); } //create new bill BillEntity bill = new BillEntity() { //set date BillDate = DateTime.Today, //add list product ListProduct = tmpbasket, //set ID cashier CashierID = tmpIdCashier }; //insert and get new bill ID BaseDAO dao = new BillDAO(); int billID = dao.insert(bill); //bao hieu cap nhat listitems flag = true; MessageBox.Show("Thanh toán thành công", "Result", MessageBoxButton.OK, MessageBoxImage.Information); Close(); sale.baskets.Clear(); break; case MessageBoxResult.No: break; } }
public IHttpActionResult Post([FromUri] JObject jsonResult) { if (!ModelState.IsValid) // Kiem tra tinh hop le cua giu lieu { return(BadRequest(ModelState)); } var x = JsonConvert.DeserializeObject <BillDTO>(jsonResult.ToString()); var last = new BillDAO().Add(x); return(Ok(last)); }
public ActionResult Sort(int?sort, int?date, int?sum) { var user = Session["User"] as TMDT.Account; if (user == null) { return(RedirectToAction("Login", "Home")); } List <Bill> listbill = new BillDAO().Sort(sort, date, sum, user.AccountID); return(View("Order", listbill)); }
public IHttpActionResult Delete(int id) { var dao = new BillDAO(); if (!dao.isExist(id)) // Kiem tra xem id co hop le hay khong { return(NotFound()); } var check = dao.Delete(id); // Kiem tra viec thuc hien Delete return(Ok(check)); }
public ActionResult OrderMerchant(int id) { var user = Session["User"] as TMDT.Account; if (user == null || user.Level != 1) { return(RedirectToAction("Login", "Home")); } var model = new BillDAO().GetDetailM_BillID(id, user.AccountID); ViewBag.CustomerInfo = new BillDAO().GetAccount_BillID(id); return(View(model)); }
public static BillListingEntity[] GetData(string fromdate, string todate) { var details = new List <BillListingEntity>(); try { details = new BillDAO().GetBillsList(fromdate, todate); } catch (Exception ex) { // details.Add(new DbStatusEntity(ex.Message)); } return(details.ToArray()); }
public static Int64[] CheckBillSettledEnrty(Int64 id) { List <Int64> lstvalues = new List <Int64>(); try { lstvalues = new BillDAO().CheckBillSettledEnrty(id); } catch (Exception ex) { // details.Add(new DbStatusEntity(ex.Message)); } return(lstvalues.ToArray()); }
public static BillEntity[] EditData(Int64 id) { var details = new List <BillEntity>(); try { details = new BillDAO().EditBill(id); } catch (Exception ex) { // details.Add(new DbStatusEntity(ex.Message)); } return(details.ToArray()); }
public ActionResult Search(string sdt) { ReadData(sdt); var HoaDonbySDT = new BillDAO().ListBySDT(sdt); ViewBag.HoaDonBySDT = HoaDonbySDT; var thuebao = new KhachHangDao().ListTheoSDT(sdt); ViewBag.SoDT = thuebao; IEnumerable <LogInfo> query = ViewBag.query; //Hiển thị kết quả bằng hộp thoại return(View(query.ToList())); }
public void TestGetUncheckBillIDByTableID() { int billId = Int32.Parse(TestContext.DataRow[0].ToString()); bool expected = Boolean.Parse(TestContext.DataRow[1].ToString()); BillDAO bill = new BillDAO(); bool actual = false; if (bill.GetUncheckBillIDByTableID(billId) != -1) { actual = true; } Assert.AreEqual(expected, actual); }
public ActionResult Order(int?index, int?limitTime, int?status, string email) { var user = Session["User"] as TMDT.Account; if (user != null) { var model = new BillDAO().ViewOrder(index, limitTime, status, user.AccountID); return(View(model)); } else { var model = new BillDAO().ViewOrder(index, limitTime, status, email); return(View(model)); } }
public IHttpActionResult Put([FromBody] JObject jsonResult) { if (!ModelState.IsValid) // Kiem tra tinh hop le cua giu lieu { return(BadRequest(ModelState)); } var x = JsonConvert.DeserializeObject <BillDTO>(jsonResult.ToString()); // Ep kieu Json sang DTO var dao = new BillDAO(); if (!dao.isExist(x.ID)) // Kiem tra id co hop le khong { return(NotFound()); } dao.Update(x); // Cap nhat return(Ok()); }
public ActionResult Payment(string mobile, string address, string shipName, string email) { var order = new Bill(); order.shipname = shipName; order.shipaddress = address; order.shipMobile = mobile; order.shipemail = email; try { var id = new BillDAO().Insert(order); var cart = (List <CartItem>)Session[CartSession]; var detailDao = new Model.DAO.BillDetailDAO(); double total = 0; foreach (var item in cart) { var orderDetail = new BillDetail(); orderDetail.id = item.book.id; orderDetail.idBill = id; orderDetail.price = item.book.price; orderDetail.quantity = item.quantity; detailDao.Insert(orderDetail); total += (item.book.price * item.quantity); } string content = System.IO.File.ReadAllText(Server.MapPath("~/assets/client/template/neworder.html")); content = content.Replace("{{CustomerName}}", shipName); content = content.Replace("{{Phone}}", mobile); content = content.Replace("{{Email}}", email); content = content.Replace("{{Address}}", address); content = content.Replace("{{Total}}", total.ToString("N0")); var toEmail = ConfigurationManager.AppSettings["ToEmailAddress"].ToString(); new MailHepler().SendMail(email, "Đơn hàng mới từ OnlineShop", content); new MailHepler().SendMail(toEmail, "Đơn hàng mới từ OnlineShop", content); } catch (Exception ex) { //ghi log return(Redirect("/loi-thanh-toan")); } return(Redirect("/hoan-thanh")); }
public IHttpActionResult GetAllUsers(int?number) { IEnumerable <BillDTO> ls; if (number == null) { ls = new BillDAO().List(); } else { ls = new BillDAO().List().Take((int)number); } if (ls == null) { return(NotFound()); } return(Ok(ls)); }
public ActionResult ShowDetailBill() { if (Regex.IsMatch(Request["OrderID"], "^\\d+$")) { int id = int.Parse(Request["OrderID"]); id -= 491999; OrderDetailDAO dao = new OrderDetailDAO(); List <OrderDetailDTO> listOrderDetail = dao.GetBillDetail(id); BillDAO daoBill = new BillDAO(); float discount = daoBill.GetDiscount(id); string state = daoBill.GetState(id); ViewBag.Discount = discount; ViewBag.State = state; ViewBag.ListOrderDetail = listOrderDetail; } return(View("ViewDetailBill")); }
/** * Click Thanh toan */ private void btnConfirm_Click(object sender, EventArgs e) { frmConfirmTicket.Visible = false; string str = ""; string str1 = ""; //load seat strl.ForEach(item => { str += item + " "; }); //load idseat BillDAO bill = new BillDAO(); BillDetailDAO bd = new BillDetailDAO(); bill.CreateBill(1, 1, frmConfirmTicket.lblTotal.Text); //this.Visible = false; int getvalue = bill.getMaxIdBill(); ticketID.ForEach(item => { bd.CreateBillDetail(Convert.ToInt32(item), getvalue); str1 += item + " "; new TicketDAO().changeStatusTicket(Convert.ToInt32(item)); }); //this.Visible = false; Console.WriteLine(str); Console.WriteLine(str1); TicketN = new frmTicket(str, str1); TicketN.MdiParent = this; TicketN.lblBillId.Text = getvalue.ToString(); TicketN.lblCinema.Text = C_Name; TicketN.lblRoom.Text = Room_Name; TicketN.lblSchedule.Text = sche_Name; TicketN.lblFName.Text = F_Name; TicketN.Show(); }
private void btn_cuocthang_Click(object sender, EventArgs e)// chưa xong { CuocBIZ c = new CuocBIZ(); BillDAO a = new BillDAO(); List <HoaDonCuoc> count = db.HoaDonCuocs.Select(b => b).ToList(); var q = a.ListTableBill(); if (q.Count == 0) { c.AddData(); } else { bill.DeletePayBill(); bill.DeleteBillInf(); bill.DeleteBill(); c.AddData(); } }
private void PrintBill_Click(object sender, RoutedEventArgs e) { if (Project.Instance.Bill.FullPrice == 0) { MessageBox.Show("Bill cannot be empty", "Congratulations", MessageBoxButton.OK, MessageBoxImage.Information); this.Close(); } if (IsValid() == false) { return; } Project.Instance.Bill.DateOfSale = DateTime.Now; Project.Instance.Bill.BillNo = DateTime.Now.Millisecond; BillDAO.Create(Project.Instance.Bill); foreach (var b in Project.Instance.Bill.FurnitureForSaleList) { foreach (var f in Project.Instance.FurnitureList) { if (f.ID == b.ID) { BillDAO.AddFurnitureOnBill(Project.Instance.Bill, f); f.Quantity -= b.Quantity; FurnitureDAO.Update(f); } } } foreach (var b in Project.Instance.Bill.AdditionalServiceList) { foreach (var a in Project.Instance.AdditionalServicesList) { BillDAO.AddAdditionalServiceOnBill(Project.Instance.Bill, a); } } MessageBox.Show("Success!", "Congratulations", MessageBoxButton.OK, MessageBoxImage.Information); Project.Instance.Bill = new Bill(); MainWindow.DeleteSoldFurniture(); this.Close(); }