private void btnThanhToan_Click(object sender, EventArgs e) { if (IsInputErr()) return; using (QuanLyBanBUS bus = new QuanLyBanBUS()) { BanHangDTO info = new BanHangDTO { Msnv = ThuNgan.MsnvLogin, MaSoBan = QuanLyBanBUS.Masoban, SoHoaDon = Convert.ToInt32(txtSoHoaDon.Text), GioRa = DateTime.Now, GhiChu = txtGhiChu.Text, KhuyenMai = nudThue.Value, TongTien = int.Parse(lblTongTien.Text, NumberStyles.AllowThousands, CultureInfo.CreateSpecificCulture("vi-VN")), ChiTiet = bus.LoadHangHoa() }; bus.BanHang(info); } using (QuanLyBanBUS bus = new QuanLyBanBUS()) bus.ClearHangHoa(); RefreshHangHoa(); }
public BanHangReport(BanHangDTO info) { Thread.CurrentThread.CurrentCulture = new CultureInfo("vi-VN"); InitializeComponent(); var materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT; materialSkinManager.ColorScheme = new ColorScheme(Primary.Teal500, Primary.Teal700, Primary.Teal500, Accent.Red700, TextShade.WHITE); using (KhuVucBUS bus = new KhuVucBUS()) { HoaDonBanHang hdbh = new HoaDonBanHang(); var lblSoPhieu = hdbh.ReportDefinition.ReportObjects["lblSoPhieu"] as TextObject; lblSoPhieu.Text = "Số phiếu: " + info.SoHoaDon; var lblKhu = hdbh.ReportDefinition.ReportObjects["lblKhu"] as TextObject; lblKhu.Text = "Khu: " + bus.GetChiTiet(info.MaSoBan).Rows[0].Field <string>("TenKhuVuc"); var lblBan = hdbh.ReportDefinition.ReportObjects["lblBan"] as TextObject; lblBan.Text = "Bàn: " + bus.GetChiTiet(info.MaSoBan).Rows[0].Field <string>("TenBan"); var lblGioRa = hdbh.ReportDefinition.ReportObjects["lblGioRa"] as TextObject; lblGioRa.Text = "Giờ ra: " + info.GioRa.ToString("dd/MM/yyyy H:mm"); var lblTongCong = hdbh.ReportDefinition.ReportObjects["lblTongCong"] as TextObject; lblTongCong.Text = info.ChuaThue.ToString("N0"); var lblKhuyenMai = hdbh.ReportDefinition.ReportObjects["lblKhuyenMai"] as TextObject; lblKhuyenMai.Text = info.KhuyenMai + " %"; var lblThanhToan = hdbh.ReportDefinition.ReportObjects["lblThanhToan"] as TextObject; lblThanhToan.Text = info.TongTien.ToString("N0"); hdbh.SetDataSource(info.ChiTiet); crystalReportViewer1.ReportSource = hdbh; crystalReportViewer1.Refresh(); } }
private void btnThanhToan_Click(object sender, EventArgs e) { if (IsInputErr()) { return; } using (QuanLyBanBUS bus = new QuanLyBanBUS()) { BanHangDTO info = new BanHangDTO { Msnv = ThuNgan.MsnvLogin, MaSoBan = QuanLyBanBUS.Masoban, SoHoaDon = Convert.ToInt32(txtSoHoaDon.Text), GioRa = DateTime.Now, GhiChu = txtGhiChu.Text, KhuyenMai = nudThue.Value, TongTien = int.Parse(lblTongTien.Text, NumberStyles.AllowThousands, CultureInfo.CreateSpecificCulture("vi-VN")), ChiTiet = bus.LoadHangHoa() }; bus.BanHang(info); } using (QuanLyBanBUS bus = new QuanLyBanBUS()) bus.ClearHangHoa(); RefreshHangHoa(); }
public BanHangReport(BanHangDTO info) { Thread.CurrentThread.CurrentCulture = new CultureInfo("vi-VN"); InitializeComponent(); var materialSkinManager = MaterialSkinManager.Instance; materialSkinManager.AddFormToManage(this); materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT; materialSkinManager.ColorScheme = new ColorScheme(Primary.Teal500, Primary.Teal700, Primary.Teal500, Accent.Red700, TextShade.WHITE); using (KhuVucBUS bus = new KhuVucBUS()) { HoaDonBanHang hdbh = new HoaDonBanHang(); var lblSoPhieu = hdbh.ReportDefinition.ReportObjects["lblSoPhieu"] as TextObject; lblSoPhieu.Text = "Số phiếu: " + info.SoHoaDon; var lblKhu = hdbh.ReportDefinition.ReportObjects["lblKhu"] as TextObject; lblKhu.Text = "Khu: " + bus.GetChiTiet(info.MaSoBan).Rows[0].Field<string>("TenKhuVuc"); var lblBan = hdbh.ReportDefinition.ReportObjects["lblBan"] as TextObject; lblBan.Text = "Bàn: " + bus.GetChiTiet(info.MaSoBan).Rows[0].Field<string>("TenBan"); var lblGioRa = hdbh.ReportDefinition.ReportObjects["lblGioRa"] as TextObject; lblGioRa.Text = "Giờ ra: " + info.GioRa.ToString("dd/MM/yyyy H:mm"); var lblTongCong = hdbh.ReportDefinition.ReportObjects["lblTongCong"] as TextObject; lblTongCong.Text = info.ChuaThue.ToString("N0"); var lblKhuyenMai = hdbh.ReportDefinition.ReportObjects["lblKhuyenMai"] as TextObject; lblKhuyenMai.Text = info.KhuyenMai + " %"; var lblThanhToan = hdbh.ReportDefinition.ReportObjects["lblThanhToan"] as TextObject; lblThanhToan.Text = info.TongTien.ToString("N0"); hdbh.SetDataSource(info.ChiTiet); crystalReportViewer1.ReportSource = hdbh; crystalReportViewer1.Refresh(); } }
public void BanHang(BanHangDTO info) { string sql = $"INSERT INTO HoaDonBanHang VALUES(N'{info.SoHoaDon}', N'{info.Msnv}', N'{info.MaSoBan}', N'{info.GioRa}', N'{info.GhiChu}', N'{info.KhuyenMai}', N'{info.TongTien}')"; _dbconnection.ExcuteNonQuery(sql); foreach (DataRow row in info.ChiTiet.Rows) { _dbconnection.ExcuteNonQuery($"INSERT INTO ChiTietDonBanHang VALUES(N'{info.SoHoaDon}', N'{row.Field<string>("TenHangHoa")}', N'{row.Field<int>("DonGia")}', N'{row.Field<int>("SoLuong")}', N'{row.Field<int>("ThanhTien")}')"); _dbconnection.ExcuteNonQuery($"UPDATE HangHoa SET SoLuongTon=SoLuongTon - {row.Field<int>("SoLuong")} WHERE TenHangHoa=N'{row.Field<string>("TenHangHoa")}'"); } }
public void BanHang(BanHangDTO info) { string sql = $"INSERT INTO HoaDonBanHang VALUES(N'{info.SoHoaDon}', N'{info.Msnv}', N'{info.MaSoBan}', N'{info.GioRa}', N'{info.GhiChu}', N'{info.KhuyenMai}', N'{info.TongTien}')"; _dbconnection.ExcuteNonQuery(sql); foreach (DataRow row in info.ChiTiet.Rows) { _dbconnection.ExcuteNonQuery($"INSERT INTO ChiTietDonBanHang VALUES(N'{info.SoHoaDon}', N'{row.Field<string>("TenHangHoa")}', N'{row.Field<int>("DonGia")}', N'{row.Field<int>("SoLuong")}', N'{row.Field<int>("ThanhTien")}')"); _dbconnection.ExcuteNonQuery($"UPDATE HangHoa SET SoLuongTon=SoLuongTon - {row.Field<int>("SoLuong")} WHERE TenHangHoa=N'{row.Field<string>("TenHangHoa")}'"); } }
private void btnIn_Click(object sender, EventArgs e) { if(IsInputErr()) return; using (QuanLyBanBUS bus = new QuanLyBanBUS()) { BanHangDTO info = new BanHangDTO { MaSoBan = QuanLyBanBUS.Masoban, SoHoaDon = Convert.ToInt32(txtSoHoaDon.Text), GioRa = DateTime.Now, GhiChu = txtGhiChu.Text, ChuaThue = int.Parse(lblExclTax.Text, NumberStyles.AllowThousands, CultureInfo.CreateSpecificCulture("vi-VN")), KhuyenMai = nudThue.Value, TongTien = int.Parse(lblTongTien.Text, NumberStyles.AllowThousands, CultureInfo.CreateSpecificCulture("vi-VN")), ChiTiet = bus.LoadHangHoa() }; new BanHangReport(info).ShowDialog(); } }
private void btnIn_Click(object sender, EventArgs e) { if (IsInputErr()) { return; } using (QuanLyBanBUS bus = new QuanLyBanBUS()) { BanHangDTO info = new BanHangDTO { MaSoBan = QuanLyBanBUS.Masoban, SoHoaDon = Convert.ToInt32(txtSoHoaDon.Text), GioRa = DateTime.Now, GhiChu = txtGhiChu.Text, ChuaThue = int.Parse(lblExclTax.Text, NumberStyles.AllowThousands, CultureInfo.CreateSpecificCulture("vi-VN")), KhuyenMai = nudThue.Value, TongTien = int.Parse(lblTongTien.Text, NumberStyles.AllowThousands, CultureInfo.CreateSpecificCulture("vi-VN")), ChiTiet = bus.LoadHangHoa() }; new BanHangReport(info).ShowDialog(); } }
public void BanHang(BanHangDTO info) { _quanlybanDAO.BanHang(info); }
public void BanHang(BanHangDTO info) { _quanlybanDAO.BanHang(info); }