private void dgDSKetCa_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (dgDSKetCa.SelectedItem != null)
     {
         ketCaSelect = CCa_BUS.find(dgDSKetCa.SelectedValue.ToString());
     }
 }
示例#2
0
 public static bool kiemTraThongTin(KetCa ketCa)
 {
     if (ketCa.tienDauCa < 0)
     {
         MessageBox.Show("tiền đầu ca phải lớn hơn hoặc bằng 0");
         return(false);
     }
     return(true);
 }
 private void hienThiThongTin(KetCa ca)
 {
     txtMaNhanVien.Text   = nhanVien.maNhanVien;
     txtTenNhanVien.Text  = nhanVien.hoNhanVien + " " + nhanVien.tenNhanVien;
     txtGioBatDau.Text    = String.Format("{0:hh:mm:ss tt}", ca.gioBatDau);
     txtGioKetThuc.Text   = String.Format("{0:hh:mm:ss tt}", ca.gioKetThuc);
     txtTongSoHoaDon.Text = ca.soLuong.ToString();
     txtTienBanDuoc.Text  = String.Format("{0:#,###,0 VND;(#,###,0 VND);0 VND}", ca.tongTienBan);
     txtTongDoanhThu.Text = String.Format("{0:#,###,0 VND;(#,###,0 VND);0 VND}", ca.tongDoanhThu);
 }
 public frmXemHoaDonKetCa(KetCa ketCa = null)
 {
     InitializeComponent();
     if (ketCa == null)
     {
         ketCaSelect = new KetCa();
     }
     else
     {
         ketCaSelect = ketCa;
         hienThiHoaDon(ketCaSelect.HoaDons.ToList());
         txtTongDoanhThu.Text = String.Format("{0:#,###,0 VND;(#,###,0 VND);0 VND}", ketCaSelect.tongTienBan);
     }
 }
        public frmKetCa(NhanVien nv = null)
        {
            InitializeComponent();

            nhanVien = nv;
            if (nhanVien == null)
            {
                nhanVien = new NhanVien();
            }

            ketCa = new KetCa();
            DateTime gioKetThuc = DateTime.Now;

            ketCa.maKetCa                = CServices.taoMa <KetCa>(CCa_BUS.toList());
            ketCa.maNhanVien             = nhanVien.maNhanVien;
            ketCa.gioBatDau              = CCa_BUS.CaLamViec.GioBatDau;
            ketCa.gioKetThuc             = gioKetThuc;
            ketCa.ngayLap                = gioKetThuc;
            CCa_BUS.CaLamViec.GioKetThuc = DateTime.Now;

            List <HoaDon> hoaDons = new List <HoaDon>();

            hoaDons = CHoaDon_BUS.toList(CCa_BUS.CaLamViec);
            foreach (HoaDon hoaDon in hoaDons)
            {
                hoaDon.maKetCa = ketCa.maKetCa;
            }

            ketCa.soLuong = hoaDons.Count();
            double tongTienBan = CHoaDon_BUS.tongTienBan(hoaDons);

            ketCa.tongTienBan  = tongTienBan;
            ketCa.tienDauCa    = 0;
            ketCa.tongDoanhThu = tongTienBan;
            ketCa.HoaDons      = hoaDons;

            hienThiThongTin(ketCa);
        }