public void loadListOrder2() { try { flowLayoutPanel1.Controls.Clear(); bool colorFlag; for (int i = 0; i < lstCT.Count; i++) { colorFlag = true; DoUongGioHang_Item item; item = new DoUongGioHang_Item(lstCT[i].tblThucDon.TenMon, lstCT[i].SoLuong, double.Parse(lstCT[i].tblThucDon.DonGia), colorFlag, lstCT[i].MaMon); item.Dock = DockStyle.Top; flowLayoutPanel1.Controls.Add(item); } double sum1 = (double)lstCT.Sum(t => t.TongTien); List <Item> lstCart = ca.getCart2(); for (int i = 0; i < lstCart.Count; i++) { colorFlag = false; DoUongGioHang_Item item; item = new DoUongGioHang_Item(lstCart[i].tenMon, lstCart[i].sl, lstCart[i].donGia, colorFlag, lstCart[i].maMon); item.Dock = DockStyle.Top; flowLayoutPanel1.Controls.Add(item); } double sum2 = lstCart.Sum(t => t.tongTien); lblTongTien.Text = mc.convertCurrency((sum1 + sum2)) + ""; } catch (Exception ee) { } }
private void Form_BangKeHoaDon_Load(object sender, EventArgs e) { lbl_NgayHD.Text = "Ngày " + ngayHD; loadGirdViewNgayHD(); //Lấy tổng giá trị hóa đơn trên datagirdview try { double total = dtGridHDNgay.Rows.Cast <DataGridViewRow>().Sum(t => Convert.ToDouble(t.Cells[4].Value)); ModuleConvert module = new ModuleConvert(); lbl_TongTien.Text = "Tổng tiền " + module.convertCurrency(total) + " VNĐ"; } catch (Exception ex) { MessageBox.Show("Lỗi tổng tiền"); } }
public DoUongGioHang_Item_Temp(String tenDoUong, int sl, double giaBan, bool colorFlag, int maMon) { try { InitializeComponent(); lbl_TenDoUong.Text = tenDoUong; lbl_TenDoUong.Tag = maMon; mau = colorFlag; lbl_SoLuong.Text = sl.ToString(); //lbl_ThanhTien.Text = (sl*giaBan).ToString(); lbl_ThanhTien.Text = mc.convertCurrency((sl * giaBan)) + ""; if (colorFlag) { tableLayoutPanel1.BackColor = Color.FromArgb(100, 244, 244, 244); } } catch (Exception ee) { } }
public void loadDataToLabel() { ModuleConvert module = new ModuleConvert(); lbl_MaHD.Text = "Số HĐ: " + hoaDon.MaHD; try { lbl_SoTien.Text = module.convertCurrency(Convert.ToDouble(hoaDon.TongTienTT)) + " VNĐ"; } catch (Exception ex) { MessageBox.Show("Trường tiền không hợp lệ"); } lbl_TGRa.Text = "Thời gian ra: " + hoaDon.TGRa; lbl_TGVao.Text = "Thời gian vào: " + hoaDon.TGVao; if (nv.getTenNhanVienByMaNV(hoaDon.MaNV) == null || nv.getTenNhanVienByMaNV(hoaDon.MaNV) == String.Empty) { MessageBox.Show("Tên nhân viên không hợp lệ"); lbl_ThuNgan.Text = "Thu ngân: " + " unknown"; } else { lbl_ThuNgan.Text = "Thu ngân: " + nv.getTenNhanVienByMaNV(hoaDon.MaNV); } tblBan ban_cls = new tblBan(); if (ban.getBanByID(hoaDon.MaBan) == null) { MessageBox.Show("Mã bàn không hợp lệ"); lbl_ban.Text = "Bàn: " + "unknown"; lbl_KhuVuc.Text = "Khu vực: " + "unknown"; } else { ban_cls = ban.getBanByID(hoaDon.MaBan); lbl_ban.Text = ban_cls.TenBan; lbl_KhuVuc.Text = "Khu vực: " + ban_cls.KhuVuc; } }
private void Form_ThanhToan_Load(object sender, EventArgs e) { try { if (ca.getCart().Count > 0) { load1(); //lbl_ThanhTien.Text = ca.tinhTong() + ""; //lbl_TongThanhToan.Text = ca.tinhTong() + ""; lbl_ThanhTien.Text = mc.convertCurrency(ca.tinhTong()) + ""; lbl_TongThanhToan.Text = mc.convertCurrency(ca.tinhTong()) + ""; lbl_TenBan.Text = "Bàn số: " + ca.getMaBan(); lbl_ThoiGianVao.Text = DateTime.Now + ""; } else if (ca.getCart2().Count == 0) { load2(); tblHoaDon h = hd.getMaHDTheoBan(ca.getMaBan()); List <tblChiTietHD> lstCT = (List <tblChiTietHD>)ct.getCTByMaHD(h.MaHD); //lbl_TongThanhToan.Text = lstCT.Sum(t => t.TongTien) + ""; lbl_ThanhTien.Text = mc.convertCurrency((double)lstCT.Sum(t => t.TongTien)) + ""; lbl_TongThanhToan.Text = mc.convertCurrency((double)lstCT.Sum(t => t.TongTien)) + ""; lbl_TenBan.Text = "Bàn số: " + ca.getMaBan(); lbl_ThoiGianVao.Text = h.TGVao + ""; } else if (ca.getCart2().Count > 0) { load3(); tblHoaDon h = hd.getMaHDTheoBan(ca.getMaBan()); List <tblChiTietHD> lstCT = (List <tblChiTietHD>)ct.getCTByMaHD(h.MaHD); double sum = ca.tinhTong2(); //lbl_ThanhTien.Text = ((double)lstCT.Sum(t => t.TongTien)+sum) + ""; //lbl_TongThanhToan.Text = ((double)lstCT.Sum(t => t.TongTien)+sum) + ""; lbl_ThanhTien.Text = mc.convertCurrency((double)lstCT.Sum(t => t.TongTien) + sum) + ""; lbl_TongThanhToan.Text = mc.convertCurrency((double)lstCT.Sum(t => t.TongTien) + sum) + ""; lbl_TenBan.Text = "Bàn số: " + ca.getMaBan(); lbl_ThoiGianVao.Text = h.TGVao + ""; } } catch (Exception ee) { } }