public static void BanHang(KaraokeEntities kara, BOBanHang banhang)
 {
     foreach (var chitiet in banhang._ListChiTietBanHang)
     {
         int          soluong     = chitiet.ChiTietBanHang.SoLuongBan * chitiet.ChiTietBanHang.KichThuocLoaiBan;
         LICHSUTONKHO lichSuDauKy = (from a in kara.LICHSUTONKHOes
                                     where a.MonID == chitiet.MenuKichThuocMon.MonID
                                     orderby a.ID descending
                                     select a).FirstOrDefault();
         LICHSUTONKHO lichSu = new LICHSUTONKHO();
         if (lichSuDauKy == null)
         {
             lichSu.DauKySoLuong = 0;
             lichSu.DauKyDonGia  = 0;
         }
         else
         {
             lichSu.DauKySoLuong = lichSuDauKy.CuoiKySoLuong;
             lichSu.DauKyDonGia  = lichSuDauKy.CuoiKyDonGia;
         }
         lichSu.XuatSoLuong    = soluong;
         lichSu.XuatDonGia     = chitiet.ChiTietBanHang.GiaBan;
         lichSu.CuoiKySoLuong  = lichSu.DauKySoLuong - lichSu.XuatSoLuong;
         lichSu.CuoiKyDonGia   = lichSu.CuoiKyDonGia;
         lichSu.NgayGhiNhan    = DateTime.Now;
         lichSu.MonID          = chitiet.MenuKichThuocMon.MonID;
         lichSu.KhoID          = banhang.KhoID;
         lichSu.LoaiPhatSinhID = 5;
         kara.LICHSUTONKHOes.AddObject(lichSu);
     }
 }
 public BOXuliTinhTien(Transit transit, BOBanHang banhang)
 {
     mTransit = transit;
     mBanHang = new BANHANG();
     Copy(banhang.BANHANG, mBanHang);
     mBanHang.TongTien = banhang.TongTien();
 }
示例#3
0
 public static IQueryable <BAN> GetAllTableInOrderPerArea(KHU khu, Transit transit)
 {
     return(from a in GetVisual(transit)
            join b in BOBanHang.GetAllNotCompleted(transit.KaraokeEntities) on a.BanID equals b.BanID
            where a.KhuID == khu.KhuID
            select a);
 }
示例#4
0
 public static void BanHang(KaraokeEntities kara, BOBanHang banhang)
 {
     foreach (var chitiet in banhang._ListChiTietBanHang)
     {
         int soluongBan = chitiet.ChiTietBanHang.SoLuongBan * chitiet.ChiTietBanHang.KichThuocLoaiBan;
         var dsTonKho   = GetTonKhoByMonID(kara, chitiet.MenuKichThuocMon.MonID, banhang.KhoID);
         foreach (var item in dsTonKho)
         {
             if (soluongBan > 0)
             {
                 if (soluongBan >= item.SoLuongTon)
                 {
                     soluongBan     -= item.SoLuongTon;
                     item.SoLuongTon = 0;
                 }
                 else
                 {
                     item.SoLuongTon -= soluongBan;
                     soluongBan       = 0;
                 }
             }
         }
         if (soluongBan > 0)
         {
             //xy ly sau KHOATRAN
         }
     }
 }
        public BOXuliTinhTien(Transit transit,BOBanHang banhang)
        {
            mTransit = transit;
            mBanHang = new BANHANG();            
            Copy(banhang.BANHANG, mBanHang);
            mBanHang.TongTien = banhang.TongTien();

        }
 public static IQueryable <BOTableStatus> GetAll(KaraokeEntities kara)
 {
     return(from a in BOBanHang.GetAllNotCompleted(kara)
            select new BOTableStatus
     {
         TableID = (int)a.BanID,
         Status = (int)a.TrangThaiID
     });
 }
示例#7
0
 /// <summary>
 /// neu ko co item thi tra ve false
 /// </summary>
 /// <param name="chitiet"></param>
 /// <param name="ban"></param>
 /// <returns></returns>
 public bool ThemTachBan(BOChiTietBanHang chitiet, BAN ban)
 {
     if (_CurrentBanHang == null)
     {
         BOBanHang banhang = GetBanHang(ban);
         banhang.AddChiTietBanHang(chitiet);
         this.AddBanHang(banhang);
         _CurrentBanHang = banhang;
         return(false);
     }
     _CurrentBanHang.AddChiTietBanHang(chitiet);
     return(true);
 }
示例#8
0
        public void LoadBanHang(BAN ban)
        {
            BAN = ban;
            BOBanHang bh = null;

            if (ban != null)
            {
                bh = GetAllBanHang(ban).FirstOrDefault();
            }
            if (bh != null)
            {
                BANHANG   = bh.BANHANG;
                KHACHHANG = bh.KHACHHANG;
                LoadChiTiet();
                ReloadGioKaraoke();
            }
            else
            {
                BANHANG            = new BANHANG();
                BANHANG.NhanVienID = mTransit.NhanVien.NhanVienID;
                if (BANHANG.NhanVienID == 0)
                {
                    BANHANG.NhanVienID = null;
                }
                if (ban != null)
                {
                    BANHANG.BanID = ban.BanID;
                }
                BANHANG.NgayBan     = BANHANG.NgayKetThuc = DateTime.Now;
                BANHANG.MaHoaDon    = String.Format("HD-{0:00}-{1:000000}", mTransit.ThamSo.SoMay, mTransit.ThamSo.ThuTuMaHoaDon);
                BANHANG.TrangThaiID = 1;
                if (_CAIDATBANHANG.ChoPhepPhiDichVu)
                {
                    BANHANG.PhiDichVu = _CAIDATBANHANG.PhiDichVu;
                }
                if (_CAIDATBANHANG.ChoPhepThueVAT)
                {
                    BANHANG.ThueVAT = _CAIDATBANHANG.ThueVAT;
                }
            }
        }
示例#9
0
 public void LoadBanHang(BAN ban)
 {            
     _BanHang = new Data.BOBanHang(mTransit,mKaraokeEntities);
     _BanHang.LoadBanHang(ban);
 }
示例#10
0
 public void LoadBanHang(BAN ban)
 {
     _BanHang = new Data.BOBanHang(mTransit, mKaraokeEntities);
     _BanHang.LoadBanHang(ban);
 }
 public static void BanHang(KaraokeEntities kara, BOBanHang banhang)
 {
     foreach (var chitiet in banhang._ListChiTietBanHang)
     {                
         int soluong = chitiet.ChiTietBanHang.SoLuongBan * chitiet.ChiTietBanHang.KichThuocLoaiBan;
         LICHSUTONKHO lichSuDauKy = (from a in kara.LICHSUTONKHOes
                                     where a.MonID == chitiet.MenuKichThuocMon.MonID
                                     orderby a.ID descending
                                     select a).FirstOrDefault();
         LICHSUTONKHO lichSu = new LICHSUTONKHO();
         if (lichSuDauKy == null)
         {
             lichSu.DauKySoLuong = 0;
             lichSu.DauKyDonGia = 0;
         }
         else
         {
             lichSu.DauKySoLuong = lichSuDauKy.CuoiKySoLuong;
             lichSu.DauKyDonGia = lichSuDauKy.CuoiKyDonGia;
         }
         lichSu.XuatSoLuong = soluong;
         lichSu.XuatDonGia = chitiet.ChiTietBanHang.GiaBan;
         lichSu.CuoiKySoLuong = lichSu.DauKySoLuong - lichSu.XuatSoLuong;
         lichSu.CuoiKyDonGia = lichSu.CuoiKyDonGia;
         lichSu.NgayGhiNhan = DateTime.Now;
         lichSu.MonID = chitiet.MenuKichThuocMon.MonID;
         lichSu.KhoID = banhang.KhoID;
         lichSu.LoaiPhatSinhID = 5;
         kara.LICHSUTONKHOes.AddObject(lichSu);
     }
 }