private void btnThemMonAn_Click(object sender, EventArgs e) { if (tbIDBill.Text == "") { MessageBox.Show("Vui lòng nhập mã hóa đơn"); tbIDBill.Focus(); } else if (tbNameKH.Text == "") { MessageBox.Show("Vui lòng nhập tên khách hàng"); tbNameKH.Focus(); } else { int id_bill = Int32.Parse(tbIDBill.Text); int id_food = Int32.Parse(tbID.Text); String name_nv = tbNameNV.Text; String name_kh = tbNameKH.Text; float soluong = Int32.Parse(tbSoLuong.Text); Bill_info bill_Info = new Bill_info { id_bill = id_bill, customer_name = name_kh, employee_name = name_nv, id_food = id_food, count_food = soluong }; HoaDonService hoaDonService = new HoaDonService(); hoaDonService.addBillInfo(bill_Info); } btnXacNhan.Enabled = true; }
public OnePayController(HoaDonService hoaDonService, YourTourContext db, CommonService commonService) { this._hoaDonService = hoaDonService; this._db = db; this._commonService = commonService; }
private void btnXoaHD_Click(object sender, EventArgs e) { if (MessageBox.Show("Bạn có chắc xóa dòng này?", "Cảnh báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } var dtDSHD = grcDSHD.DataSource as DataTable; var dtCTHD = grcCTHD.DataSource as DataTable; if (grvCTHD.RowCount > 0) { grvCTHD.SelectAll(); grvCTHD.DeleteSelectedRows(); if (dtCTHD.GetChanges() == null || ChiTietHoaDonService.SaveChanges(dtCTHD) == false) { XtraMessageBox.Show("Xóa thất bại!"); return; } } grvDSHD.DeleteSelectedRows(); if (HoaDonService.SaveChanges(dtDSHD)) { XtraMessageBox.Show("Xóa thành công"); } else { XtraMessageBox.Show("Xóa thất bại"); } }
public ActionResult List(HoaDonSearchModel searchModel) { var pagedList = HoaDonService.Search(searchModel.ID, searchModel.CreateBy, searchModel.TuNgay, searchModel.DenNgay, searchModel.PageIndex); pagedList.SearchModel = searchModel; return(PartialView("_List", pagedList)); }
private void btnTimKiem_Click(object sender, EventArgs e) { string key = null; Nullable <DateTime> dateStart = null, dateEnd = null; if (chbTuKhoa.Checked == true) { if (txtTuKhoa.Text != "") { key = txtTuKhoa.Text; } } if (chbNgay.Checked == true) { if (deTuNgay.Text != "") { dateStart = deTuNgay.DateTime.Date; } if (deDenNgay.Text != "") { dateEnd = deDenNgay.DateTime.Date; } } if (key == null && dateStart == null && dateEnd == null) { grcDSHD.DataSource = HoaDonService.LoadDataTable(); } else { grcDSHD.DataSource = HoaDonService.Search(key, dateStart, dateEnd); } }
private void btnTao_Click(object sender, EventArgs e) { if (tbTable.Text == "") { MessageBox.Show("Vui lòng chọn bàn"); tbTable.Focus(); } else { DateTime checkIn = dtCheckin.Value; int table = Int32.Parse(tbTable.Text); Bill bill = new Bill { Datecheckin = checkIn, id_table = table, status = 0 }; TalbleFood talble = new TalbleFood { id_table = table, status = true }; HoaDonService hoaDonService = new HoaDonService(); TableService tableService = new TableService(); hoaDonService.addBill(bill); tableService.updateStatus(talble); } btnThemMonAn.Enabled = true; btnTao.Enabled = false; }
public ActionResult Edit(int id) { var model = HoaDonService.GetById(id); ViewBag.CreateBy = new SelectList(HoaDonService.GetNhanvien(), "ID", "FullName", model.CreateBy); //TODO return(View("CreateEdit", model)); }
public void LoadBill() { HoaDonService hoaDonService = new HoaDonService(); dtgBill.DataSource = hoaDonService.getBillStatus(1); tbTongBill.Text = hoaDonService.getSumBill().ToString(); tbTongDoanhThu.Text = hoaDonService.getSumPriceAllBill().ToString(); }
public ActionResult Detail(int id) { ViewBag.Type = WebUtil.GetEnumSelectList <Notifi_Type>(); ViewBag.UserCreate = new SelectList(HoaDonService.GetNhanvien(), "ID", "FullName"); var model = NotifyService.GetById(id); //TODO return(View("Detail", model)); }
private void btnXacNhan_Click(object sender, EventArgs e) { int id_bill = Int32.Parse(tbIDBill.Text); HoaDonService hoaDonService = new HoaDonService(); tbTong.Text = hoaDonService.getSumPrice(id_bill).ToString(); btnThemMonAn.Enabled = false; btnTao.Enabled = true; }
public DatTourController(DattourService dattourService, TourService tourService, IConfiguration configuration, HoaDonService hoaDonService, CommonService commonService, DiaDiemService diaDiemService, KhachSanService khachSanService) { this._dattourService = dattourService; this._tourService = tourService; this._configuration = configuration; this._hoaDonService = hoaDonService; this._commonService = commonService; this._diaDiemService = diaDiemService; this._khachSanService = khachSanService; }
private void btnInBaoCao_Click(object sender, EventArgs e) { if (!validate()) { return; } BaoCaoDoanhThu.TuNgay = dedTuNgay.DateTime.Date; BaoCaoDoanhThu.DenNgay = dedDenNgay.DateTime.Date; BaoCaoDoanhThu.NhanVienLap = (ProjectUltil.HoTenNhanVien != "") ? ProjectUltil.HoTenNhanVien : ""; BaoCaoDoanhThu bc = new BaoCaoDoanhThu(); bc.DataSource = HoaDonService.Search(null, dedTuNgay.DateTime.Date, dedDenNgay.DateTime.Date); bc.ShowPreviewDialog(); }
private void btnLapBaoCao_Click(object sender, EventArgs e) { if (!validate()) { return; } decimal doanhthu = 0; grcDoanhThu.DataSource = HoaDonService.Search(null, dedTuNgay.DateTime.Date, dedDenNgay.DateTime.Date); for (int i = 0; i < grvDoanhThu.RowCount; i++) { decimal tt = decimal.Parse(grvDoanhThu.GetRowCellValue(i, "TongTien").ToString()); doanhthu += tt; } lblTongDoanhThu.Text = "Tổng Doanh Thu: " + doanhthu + "(VNĐ)"; }
public AdminController(YourTourContext db, IHostingEnvironment hostingEnvironment, TravelService travelService, StaffService staffService, LocationService locationService, CommonService commonService, AdminService adminService, TourService tourService, HoaDonService hoaDonService, LienHeService lienHeService) { this._db = db; this._hostingEnvironment = hostingEnvironment; this._travelService = travelService; this._staffService = staffService; this._locationService = locationService; this._commonService = commonService; this._adminService = adminService; this._tourService = tourService; this._hoaDonService = hoaDonService; this._lienHeService = lienHeService; }
protected override void OnAppearing() { bienBan = (BienBanViPham)BindingContext; if (bienBan.HDNopPhat == null) { ChiTietHoaDonSL.IsVisible = false; } else { int hoaDon_id = (int)bienBan.HDNopPhat; hoaDonService = new HoaDonService(); var hoaDon = hoaDonService.GetHoaDonByID(hoaDon_id); ThanhToanSL.IsVisible = false; BindingContext = new { ThanhTien = hoaDon.ThanhTien, NgayThanhToan = hoaDon.NgayThanhToan }; } }
private void dtgBill_CellClick(object sender, DataGridViewCellEventArgs e) { int index = e.RowIndex; if (index < 0 || index >= dtgBill.RowCount) { return; } DataGridViewRow row = dtgBill.Rows[index]; int id_bill = Convert.ToInt32(row.Cells[0].Value); HoaDonService hoaDonService = new HoaDonService(); tbDoanhThuDon.Text = hoaDonService.getSumPrice(id_bill).ToString(); }
public void Init() { TongTien = 0; DiemThuong = 0; DiemTichLuy = 0; DiemTichLuyCapNhat = 0; TienGiam = 0; TienThanhToan = 0; isSaved = false; seSoLuong.ResetText(); chbKHTT.Checked = false; btnXoa.Enabled = false; btnLuu.Enabled = false; btnKiemTra.Enabled = false; txtMaKhachHang.Enabled = false; txtMaHoaDon.Text = HoaDonService.AutoGenerateId(); deNgayLap.DateTime = DateTime.Now; }
private void btnCheck_Click(object sender, EventArgs e) { DateTime from = dtFrom.Value; DateTime to = dtTo.Value; HoaDonService hoaDonService = new HoaDonService(); if (from > to) { MessageBox.Show("Điều kiện lọc sai"); } else { dtgBill.DataSource = hoaDonService.filterBill(from, to); tbTongBill.Text = hoaDonService.sumBillFilter(from, to).ToString(); tbTongDoanhThu.Text = hoaDonService.getSumFriceFilter(from, to).ToString(); } }
private void hoanThanh_Clicked(object sender, EventArgs e) { try { HoaDon hoaDon = new HoaDon { ThanhTien = Convert.ToDecimal(bienBan.TongTien), NgayThanhToan = DateTime.Now, HinhThucThanhToan_id = 1 }; HoaDonService createHoaDon = new HoaDonService(); var hd = createHoaDon.CreateHoaDon(hoaDon); if (hd == null) { DisplayAlert("Thành công", "Thanh toán thành công", "Tiếp tục"); return; } bienBan.HDNopPhat = hd.Id; //bienBan.HoaDon = hd; var htService = new BienBanViPhamService(); if (htService.UpdateBienBan(bienBan)) { DisplayAlert("Thành công", "Thanh toán thành công", "Tiếp tục"); ThanhToanSL.IsVisible = false; ChiTietHoaDonSL.IsVisible = true; BindingContext = new { ThanhTien = hd.ThanhTien, NgayThanhToan = hd.NgayThanhToan }; } else { try { DisplayAlert("Thành công", "Thanh toán thất bại", "Tiếp tục"); } catch (Exception ex) { throw ex; } } } catch (Exception ex1) { throw ex1; } }
public ActionResult CreateEdit1(BILL model) { if (Request["txtProductIdRow"] == null) { return(Json(new CommandResult() { Code = ResultCode.Fail, Message = "Xin vui lòng thêm sản phẩm " }, JsonRequestBehavior.AllowGet)); } var listSanPhamID = Request.Form.GetValues("txtProductIdRow"); var listSoLuong = Request.Form.GetValues("txtQuantityRow"); var listGia = Request.Form.GetValues("txtPriceRow"); if (model.ID == 0) { var user = UserService.GetUserInfo(); var result = HoaDonService.Create1(model, user.ID, listSanPhamID, listSoLuong, listGia); return (Json( new RedirectCommand() { Code = result.Code, Message = result.Message, Url = Url.Action("Index", new { id = model.ID }) }, JsonRequestBehavior.AllowGet)); } else { var user = UserService.GetUserInfo(); var result = HoaDonService.Edit1(model, user.ID, listSanPhamID, listSoLuong, listGia); return (Json( new RedirectCommand() { Code = result.Code, Message = result.Message, Url = Url.Action("Index", new { id = model.ID }) }, JsonRequestBehavior.AllowGet)); } }
private void dtgBill_CellClick(object sender, DataGridViewCellEventArgs e) { HoaDonService hoaDonService = new HoaDonService(); int index = e.RowIndex; if (index < 0 || index >= dtgBill.RowCount) { return; } DataGridViewRow row = dtgBill.Rows[index]; int id_bill = Convert.ToInt32(row.Cells[0].Value); DateTime checkin = Convert.ToDateTime(row.Cells[1].Value); String table = Convert.ToString(row.Cells[3].Value); tbIDBill.Text = id_bill.ToString(); dtCheckIN.Value = checkin; tbTable.Text = table; getBillInfoByID(id_bill); tbSum.Text = hoaDonService.getSumPrice(id_bill).ToString(); }
private void btnThanhToan_Click(object sender, EventArgs e) { HoaDonService hoaDonService = new HoaDonService(); TableService tableService = new TableService(); int id_bill = Int32.Parse(tbIDBill.Text); DateTime checkin = dtCheckIN.Value; DateTime checkout = dtCheckOUT.Value; int id_table = Int32.Parse(tbTable.Text); Bill bill = new Bill { id_bill = id_bill, Datecheckin = checkin, Datecheckout = checkout, id_table = id_table, status = 1 }; TalbleFood talble = new TalbleFood { id_table = id_table, status = false }; hoaDonService.updateBill(bill); tableService.updateStatus(talble); LoadBill(); dtgBillInfo.DataSource = null; }
private void getBillByTable(int id_table) { HoaDonService hoaDonService = new HoaDonService(); dtgBill.DataSource = hoaDonService.GetBillsByTable(id_table); }
private void btnLuu_Click(object sender, EventArgs e) { if (TongTien >= TienGiam) { DiemTichLuyCapNhat = DiemThuong; } else { DiemTichLuyCapNhat = Convert.ToInt32(TongTien / 1000) + DiemThuong; } HoaDon hd = new HoaDon(); hd.SoHoaDon = SoMaHoaDon.Text.Trim(); hd.MaKhachHang = txtMaKhachHang.Text.Trim(); hd.MaNhanVien = "NV0001"; hd.NgayLap = deNgayLap.DateTime; hd.TongTien = TienThanhToan; hd.TienGiam = TienGiam; hd.DiemThuong = DiemThuong; if (HoaDonService.Insert(hd)) { ChiTietHoaDon cthd = new ChiTietHoaDon(); cthd.SoHoaDon = hd.SoHoaDon; for (int i = 0; i < grvHoaDon.RowCount; i++) { cthd.MaHangHoa = grvHoaDon.GetRowCellValue(i, "MaHangHoa").ToString(); cthd.SoLuong = Convert.ToInt32(grvHoaDon.GetRowCellValue(i, "SoLuong").ToString()); DataRowView row = lueHangHoa.Properties.GetDataSourceRowByKeyValue(cthd.MaHangHoa) as DataRowView; cthd.DonGia = Convert.ToDecimal(row.Row["GiaBan"].ToString()); cthd.ThanhTien = cthd.SoLuong * cthd.DonGia; if (!ChiTietHoaDonService.Insert(cthd)) { XtraMessageBox.Show("Lưu thất bại!"); if (i > 0) { if (!ChiTietHoaDonService.Delete(hd.SoHoaDon)) { XtraMessageBox.Show("Roll back không thành công!"); return; } } if (HoaDonService.Delete(hd.SoHoaDon)) { XtraMessageBox.Show("Roll back thành công!"); } else { XtraMessageBox.Show("Roll back không thành công!"); } return; } DataTable dtHH = HangHoaService.GetById(cthd.MaHangHoa); int SL = Convert.ToInt32(dtHH.Rows[0][5].ToString()); dtHH.Rows[0][5] = SL - cthd.SoLuong; if (!HangHoaService.SaveChanges(dtHH)) { XtraMessageBox.Show("Không update được hàng hóa"); } } if (hd.MaKhachHang != "KH0000") { DataTable dtKT = KhachHangThanThietService.SearchMaKhachHang(hd.MaKhachHang); dtKT.Rows[0][5] = DiemTichLuyCapNhat; if (!KhachHangThanThietService.SaveChanges(dtKT)) { XtraMessageBox.Show("Không update được khách hàng thân thiết"); } } XtraMessageBox.Show("Lưu thành công!"); isSaved = true; } else { XtraMessageBox.Show("Lưu thất bại!"); isSaved = false; } }
public ActionResult GetViewListProduct(int id) { var model = HoaDonService.GetListCTHD(id); return(PartialView("_ListCTHD", model)); }
public ThanhToanController(HoaDonService hoaDonService) { this._hoaDonService = hoaDonService; }
private void LoadBill() { HoaDonService hoaDonService = new HoaDonService(); dtgBill.DataSource = hoaDonService.getBillStatus(0); }
private void getBillInfoByID(int id_bill) { HoaDonService hoaDonService = new HoaDonService(); dataGridView2.DataSource = hoaDonService.getBillInfoByid(id_bill); }
private void LoadBill() { HoaDonService hoaDonService = new HoaDonService(); dataGridView1.DataSource = hoaDonService.getBillStatus(0); }
private void btnLuu_Click(object sender, EventArgs e) { if (TongTien >= TienGiam) { DiemTichLuyCapNhat = DiemThuong; } else { DiemTichLuyCapNhat = Convert.ToInt32(TongTien / 1000) + DiemThuong; } HoaDon hd = new HoaDon(); hd.MaHoaDon = txtMaHoaDon.Text.Trim(); hd.MaKhachHang = txtMaKhachHang.Text.Trim(); hd.MaNhanVien = "NV0001"; hd.NgayLap = deNgayLap.DateTime; hd.TongTien = TienThanhToan; hd.TienGiam = TienGiam; hd.DiemThuong = DiemThuong; if (HoaDonService.Insert(hd)) { ChiTietHoaDon cthd = new ChiTietHoaDon(); cthd.MaHoaDon = hd.MaHoaDon; for (int i = 0; i < grvHoaDon.RowCount; i++) { cthd.MaHangHoa = grvHoaDon.GetRowCellValue(i, "MaHangHoa").ToString(); cthd.SoLuong = Convert.ToInt32(grvHoaDon.GetRowCellValue(i, "SoLuong").ToString()); if (!ChiTietHoaDonService.Insert(cthd)) { XtraMessageBox.Show("Lưu thất bại!"); if (i > 0) { if (!ChiTietHoaDonService.Delete(hd.MaHoaDon)) { XtraMessageBox.Show("Roll back không thành công!"); return; } } if (HoaDonService.Delete(hd.MaHoaDon)) { XtraMessageBox.Show("Roll back thành công!"); } else { XtraMessageBox.Show("Roll back không thành công!"); } return; } } if (hd.MaKhachHang != "KH0000") { DataTable dtKT = KhachHangThanThietService.SearchMaKhachHang(hd.MaKhachHang); dtKT.Rows[0][5] = DiemTichLuyCapNhat; } XtraMessageBox.Show("Lưu thành công!"); isSaved = true; } else { XtraMessageBox.Show("Lưu thất bại!"); isSaved = false; } }