// **************************************************************************** // Binh private void btThongKe_Click(object sender, EventArgs e) { dvwTotal.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; BilDAL billDAL = new BilDAL(); DataTable data = billDAL.LoadDSByTime(Convert.ToDateTime(dtFrom.Value), Convert.ToDateTime(dtTo.Value)); dvwTotal.DataSource = data; int total = 0; foreach (DataRow row in data.Rows) { total += Convert.ToInt32(row.ItemArray[4].ToString()); } lblTotal.Text = total.ToString(); }
private void btTable_Click(object sender, EventArgs e) { Table tb = (sender as Button).Tag as Table; if (tb.Status == 0) { BilDAL billDAL = new BilDAL(); string dt = DateTime.Today.ToString().Trim(); DateTime d = Convert.ToDateTime(dt); billDAL.insertBill(tb.Id, d); TableDAL tableDAL = new TableDAL(); tb = tableDAL.getTableById(tb.Id); } this.Hide(); FrmOrder frOrder = new FrmOrder(tb.Id); frOrder.ShowDialog(); }
// 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); }