public static void NhapKho(KaraokeEntities kara, BOChiTietNhapKho chitiet,BONhapKho nhapKho) { LICHSUTONKHO lichSuDauKy = (from a in kara.LICHSUTONKHOes where a.MonID == chitiet.MenuKichThuocMon.MenuKichThuocMon.MonID && a.KhoID==nhapKho.NhapKho.KhoID 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; } int soluong = chitiet.ChiTietNhapKho.SoLuongNhap * chitiet.MenuKichThuocMon.MenuKichThuocMon.KichThuocLoaiBan; lichSu.NhapSoLuong = soluong; lichSu.NhapDonGia = chitiet.ChiTietNhapKho.GiaNhap / chitiet.MenuKichThuocMon.MenuKichThuocMon.KichThuocLoaiBan; lichSu.CuoiKySoLuong = lichSu.DauKySoLuong + lichSu.NhapSoLuong; lichSu.CuoiKyDonGia = lichSu.CuoiKyDonGia; lichSu.NgayGhiNhan = DateTime.Now; lichSu.MonID = chitiet.MenuKichThuocMon.MenuKichThuocMon.MonID; lichSu.KhoID = nhapKho.NhapKho.KhoID; lichSu.LoaiPhatSinhID = 1; kara.LICHSUTONKHOes.AddObject(lichSu); }
public static void NhapKho(KaraokeEntities kara, BOChiTietNhapKho chitiet, BONhapKho nhapKho) { LICHSUTONKHO lichSuDauKy = (from a in kara.LICHSUTONKHOes where a.MonID == chitiet.MenuKichThuocMon.MenuKichThuocMon.MonID && a.KhoID == nhapKho.NhapKho.KhoID 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; } int soluong = chitiet.ChiTietNhapKho.SoLuongNhap * chitiet.MenuKichThuocMon.MenuKichThuocMon.KichThuocLoaiBan; lichSu.NhapSoLuong = soluong; lichSu.NhapDonGia = chitiet.ChiTietNhapKho.GiaNhap / chitiet.MenuKichThuocMon.MenuKichThuocMon.KichThuocLoaiBan; lichSu.CuoiKySoLuong = lichSu.DauKySoLuong + lichSu.NhapSoLuong; lichSu.CuoiKyDonGia = lichSu.CuoiKyDonGia; lichSu.NgayGhiNhan = DateTime.Now; lichSu.MonID = chitiet.MenuKichThuocMon.MenuKichThuocMon.MonID; lichSu.KhoID = nhapKho.NhapKho.KhoID; lichSu.LoaiPhatSinhID = 1; kara.LICHSUTONKHOes.AddObject(lichSu); }
public static void NhapKhoTong(KaraokeEntities kara, BOChiTietNhapKho chitiet, BONhapKho nhapkho) { int soluongNhap = chitiet.ChiTietNhapKho.SoLuongNhap * chitiet.MenuKichThuocMon.KichThuocLoaiBan; TONKHO tonkho = new TONKHO(); tonkho.KhoID = nhapkho.NhapKho.KhoID; tonkho.MonID = chitiet.MenuKichThuocMon.MenuKichThuocMon.MonID; tonkho.SoLuongNhap = soluongNhap; tonkho.SoLuongTon = soluongNhap; tonkho.NgayNhap = DateTime.Now; tonkho.NgaySanXuat = chitiet.ChiTietNhapKho.NgaySanXuat; tonkho.NgayHetHan = chitiet.ChiTietNhapKho.NgayHetHan; tonkho.GiaNhap = chitiet.ChiTietNhapKho.GiaNhap; tonkho.GiaBan = chitiet.ChiTietNhapKho.GiaBan; tonkho.LoaiPhatSinhID = 1; tonkho.Visual = true; kara.TONKHOes.AddObject(tonkho); }