Beispiel #1
0
 private void btDelete_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Bạn có chắc muốn xóa món?", "Thông báo", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
     {
         int         idMenuSelect = Convert.ToInt32(cbMenu.SelectedValue.ToString());
         BillInfoDAL billInfoDAL  = new BillInfoDAL();
         billInfoDAL.DeleteBillInfo(table.Status, idMenuSelect);
         loadBill(this.table.Status);
     }
     else
     {
         MessageBox.Show(" Có lỗi khi xóa món", "Thông báo");
     }
 }
        private void btEdit_Click(object sender, EventArgs e)
        {
            int soLuong;
            int idMenu = Convert.ToInt32(cbMenu.SelectedValue.ToString());

            if (checkNumber(tbSoLuong.Text))
            {
                soLuong = Convert.ToInt32(tbSoLuong.Text);
                int         idMenuSelect = Convert.ToInt32(cbMenu.SelectedValue.ToString());
                BillInfoDAL billInfoDAL  = new BillInfoDAL();
                billInfoDAL.editBillInfo(table.Status, idMenuSelect, soLuong);
                loadBill(this.table.Status);
            }
        }
Beispiel #3
0
        // action button them mon
        private void btThemMon_Click(object sender, EventArgs e)
        {
            int soLuong;
            int idMenu = Convert.ToInt32(cbMenu.SelectedValue.ToString());

            if (checkNumber(tbSoLuong.Text))
            {
                soLuong = Convert.ToInt32(tbSoLuong.Text);
                int         idMenuSelect = Convert.ToInt32(cbMenu.SelectedValue.ToString());
                BillInfoDAL billInfoDAL  = new BillInfoDAL();
                billInfoDAL.insertBillInfo(table.Status, idMenuSelect, soLuong);
                //   Thread.Sleep(2);
                MessageBox.Show("Bạn đã Thêm món thành công", "Thông báo");
                loadBill(this.table.Status);
            }
        }
Beispiel #4
0
        // hiển thị hóa đơn
        public void loadBill(int id)
        {
            dgrBillInfo.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            BillInfoDAL billInfoDAL = new BillInfoDAL();
            DataTable   data        = billInfoDAL.getBillInfoByIdBill(id);

            dgrBillInfo.DataSource = data;

            // hien thi tổng tiền hiện tại

            this.total = 0;
            foreach (DataRow row in data.Rows)
            {
                this.total = total + Convert.ToInt32(row.ItemArray[5].ToString());
            }
            lbTotal.Text = total.ToString();
            // cap nhat lai tong tin hao don
            BilDAL billDAL = new BilDAL();

            billDAL.updateTotalBill(id, total);
        }
Beispiel #5
0
        private void _CreateReceipt(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            Graphics graphic    = e.Graphics;
            Font     font       = new Font("Courier New", 12);
            float    FontHeight = font.GetHeight();
            int      startX     = 10;
            int      startY     = 10;
            int      offset     = 40;


            graphic.DrawString("       NHÀ HÀNG ẨM THỰC ADNB", new Font("Courier New", 18), new SolidBrush(Color.Black), startX, startY);
            offset = offset + (int)FontHeight + 5;
            graphic.DrawString("         HOÁ ĐƠN BÁN HÀNG", new Font("Courier New", 18), new SolidBrush(Color.Black), startX, startY + offset);

            offset = offset + (int)FontHeight + 20;


            string top = "Tên Sản Phẩm".PadRight(24) + "Số lượng".PadRight(10) + "Đơn giá".PadRight(10) + "Thành Tiền";

            graphic.DrawString(top, font, new SolidBrush(Color.Black), startX, startY + offset);
            offset = offset + (int)FontHeight;
            graphic.DrawString("--------------------------------------------------------------", font, new SolidBrush(Color.Black), startX, startY + offset);
            offset = offset + (int)FontHeight + 5;

            BillInfoDAL billInfoDAL = new BillInfoDAL();
            DataTable   data        = billInfoDAL.getBillInfoByIdBill(idBill);



            for (int i = 0; i < data.Rows.Count; i++)
            {
                graphic.DrawString(data.Rows[i].ItemArray[1].ToString(), font, new SolidBrush(Color.Black), startX, startY + offset);
                graphic.DrawString(data.Rows[i].ItemArray[3].ToString(), font, new SolidBrush(Color.Black), startX + 250, startY + offset);
                graphic.DrawString(data.Rows[i].ItemArray[4].ToString(), font, new SolidBrush(Color.Black), startX + 350, startY + offset);
                graphic.DrawString(data.Rows[i].ItemArray[5].ToString(), font, new SolidBrush(Color.Black), startX + 450, startY + offset);


                offset = offset + (int)FontHeight + 5; //xuong 1 dong
            }



            offset = offset + 10;

            graphic.DrawString("--------------------------------------------------------------", font, new SolidBrush(Color.Black), startX, startY + offset);

            offset = offset + 10;

            graphic.DrawString("TỔNG TIỀN TRẢ ", new Font("Courier New", 12, FontStyle.Bold), new SolidBrush(Color.Black), startX, startY + offset);
            graphic.DrawString(this.total.ToString(), new Font("Courier New", 12, FontStyle.Bold), new SolidBrush(Color.Black), startX + 450, startY + offset);

            try
            {
                AccountDAL accDAL = new AccountDAL();
                Employee   emp    = accDAL.getEmployeeByAccount(this.acc.UserName);

                offset = offset + (int)FontHeight + 10;
                graphic.DrawString("Nhân viên : " + emp.Name, font, new SolidBrush(Color.Black), startX, startY + offset);
            }
            catch
            {
            }


            offset = offset + (int)FontHeight + 15;
            graphic.DrawString("              CẢM ƠN BẠN ĐÃ GHÉ THĂM!,", font, new SolidBrush(Color.Black), startX, startY + offset);
            offset = offset + (int)FontHeight + 5;
            graphic.DrawString("             HI VỌNG BẠN SẼ GHÉ THĂM LẠI!", font, new SolidBrush(Color.Black), startX, startY + offset);
        }