Ejemplo n.º 1
0
        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();
            }
        }
Ejemplo n.º 2
0
        private void btnXoaBan_Click(object sender, System.EventArgs e)
        {
            if (listView1.SelectedItems.Count == 0) return;

            using (KhuVucBUS bus = new KhuVucBUS())
            {
                if (new XacNhan { Text = @"Bạn có chắc chắn muốn xóa bàn " + listView1.SelectedItems[0].Text }.ShowDialog() == DialogResult.Yes)
                    bus.DeleteBan(listView1.SelectedItems[0].Tag.ToString());
            }

            RefreshBan();
        }
Ejemplo n.º 3
0
        private void btnThemKV_Click(object sender, System.EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtTenKhuVuc.Text))
            {
                errorProvider1.SetError(txtTenKhuVuc, "Vui lòng điền tên khu vực muốn thêm");
                return;
            }

            errorProvider1.SetError(txtTenKhuVuc, string.Empty);

            try
            {
                using (KhuVucBUS bus = new KhuVucBUS())
                    bus.InsertKhuVuc(txtTenKhuVuc.Text);
            }
            catch (SqlException ex)
            {
                if (ex.Number == DbConnection.MssqlEng002627)
                    errorProvider1.SetError(txtTenKhuVuc, "Khu vực đã tồn tại");
                else throw;
            }

            RefreshKhuVuc();
        }
Ejemplo n.º 4
0
        private void btnThemBan_Click(object sender, System.EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(txtTenBan.Text))
            {
                errorProvider1.SetError(txtTenBan, "Vui lòng điền tên bàn muốn thêm");
                return;
            }

            errorProvider1.SetError(txtTenBan, string.Empty);

            try
            {
                using (KhuVucBUS bus = new KhuVucBUS())
                    bus.InsertBan(treeView1.SelectedNode.Text, txtTenBan.Text);
            }
            catch (SqlException ex)
            {
                if (ex.Number == DbConnection.MssqlEng002627)
                    errorProvider1.SetError(txtTenBan, "Bàn đã tồn tại trong khu vực");
                else throw;
            }

               RefreshBan();
        }
Ejemplo n.º 5
0
        private void QuanLyBan_Load(object sender, EventArgs e)
        {
            using (HangHoaBUS bus = new HangHoaBUS())
                dataGridView2.DataSource = bus.ListHangHoa2();

            using (KhuVucBUS bus = new KhuVucBUS())
            {
                foreach (DataRow row in bus.ListKhuVuc().Rows)
                {
                    var group = new ListViewGroup(row["TenKhuVuc"].ToString());
                    listView1.Groups.Add(group);

                    foreach (DataRow r in bus.ListBan(row["TenKhuVuc"].ToString()).Rows)
                        listView1.Items.Add(new ListViewItem(r["TenBan"].ToString(),
                            bus.IsAvailable(r["MaSoBan"].ToString()) ? 0 : 1, group)).Tag = r["MaSoBan"];

                    listView1.Items[0].Selected = true;
                }
            }

            using (QuanLyBanBUS bus = new QuanLyBanBUS())
                txtSoHoaDon.Text = bus.GetSoHoaDon().ToString();
        }
Ejemplo n.º 6
0
        private void btnXoaKV_Click(object sender, System.EventArgs e)
        {
            using (KhuVucBUS bus = new KhuVucBUS())
            {
                if (new XacNhan {Text = @"Bạn có chắc chắn muốn xóa khu vực " + treeView1.SelectedNode.Text }.ShowDialog() == DialogResult.Yes)
                    bus.DeleteKhuVuc(treeView1.SelectedNode.Text);
            }

            RefreshKhuVuc();
        }
Ejemplo n.º 7
0
        private void RefreshKhuVuc()
        {
            treeView1.Nodes.Clear();

            using (KhuVucBUS bus = new KhuVucBUS())
            {
                foreach (DataRow row in bus.ListKhuVuc().Rows)
                    treeView1.Nodes.Add(row[0].ToString());
            }

            treeView1.SelectedNode = treeView1.TopNode;
        }
Ejemplo n.º 8
0
        private void RefreshBan()
        {
            listView1.Items.Clear();

            using (KhuVucBUS bus = new KhuVucBUS())
            {
                foreach (DataRow row in bus.ListBan(treeView1.SelectedNode.Text).Rows)
                    listView1.Items.Add(row[1].ToString(), 1).Tag = row[0];
            }
        }