private void KhoiTaoBan(string MaKV) { PanelControl p1 = new PanelControl(); p1.Text = MaKV; p1.Dock = DockStyle.Fill; p1.Visible = true; this.Controls.Add(p1); lPan.Add(p1); p1.BringToFront(); string sql = "select * from dmban where MaPOSArea='" + MaKV + "'"; DataTable tb = db.GetDataTable(sql); int x = 0; int y = 0; foreach (DataRow dr in tb.Rows) { cBan cb = new cBan(dr["MaBan"].ToString()); cb.Top = y; cb.Left = x; cb.Visible = true; p1.Controls.Add(cb); cb.ChonBan += new EventHandler(cb_ChonBan); if (x > this.Width - 2 * cb.Width) { x = 0; y += cb.Height + 2; } else { x += cb.Width + 2; } } }
private void simpleButton2_Click(object sender, EventArgs e) { _cban.Thanhtoan(); cBan cban = new cBan(_Maban); this.Ban = cban; //this.Close(); }
void cb_ChonBan(object sender, EventArgs e) { if (TrangThai == 0) { cBan cb = sender as cBan; if (fMoBan == null) { fMoBan = new fMoban(); } fMoBan.Ban = cb; fMoBan.ShowDialog(); } }
void cb_ChonBan(object sender, EventArgs e) { if (TrangThai == 0) { cBan cb = sender as cBan; if (fMoBan == null) { fMoBan = new fMoban(cb.MaPOSArea); fMoBan.dmposGia = this.dmposGia; fMoBan.dmposLoaiGia = this.dmposLoaiGia; fMoBan.dmtk = this.dmtk; fMoBan.ctBieuphi = this.ctBieuphi; fMoBan.dmloaithe = this.dmloaithe; } fMoBan.Ban = cb; fMoBan.ShowDialog(); } }
private void fMoban_Load(object sender, EventArgs e) { //Khởi tạo nhóm món fChonKV fchonkv = new fChonKV(1); fchonkv.ShowDialog(); if (fchonkv.MaKV != "") { printerPOS = fchonkv.PrinterPos; printerBEP = fchonkv.PrinterBep; string sql = "select top 1 * from dmban where maposarea='" + fchonkv.MaKV + "' order by maban"; DataTable tb = db.GetDataTable(sql); if (tb != null && tb.Rows.Count != 0) { _Maban = tb.Rows[0]["MaBan"].ToString(); cBan cban = new cBan(_Maban); this.Ban = cban; } } }