/// <summary> /// lấy danh sách chi tiết trả nợ của khách hàng cho 1 khoản nợ nào đó /// </summary> /// <param name="pMaHoaDon">mã hóa đơn nợ</param> /// <returns>danh sách chi tiết phiểu trả nợ</returns> public List <eChiTietPhieuTraNoKhachHang> GetListChiTietTraNoKH(string pMaHoaDon) { List <eChiTietPhieuTraNoKhachHang> l = new List <eChiTietPhieuTraNoKhachHang>(); foreach (var ct in db.ChiTietPhieuTraNoKhachHangs.Where(e => e.MaHoaDonBanSi == pMaHoaDon)) { eChiTietPhieuTraNoKhachHang ect = new eChiTietPhieuTraNoKhachHang(); ect.SoTien = ct.SoTien; ect.GhiChu = ct.GhiChu; ect.MaHoaDonBanSi = ct.MaHoaDonBanSi; ect.MaChiTietPhieuTraNoKH = ct.MaChiTietPhieuTraNoKH; ect.MaNhanVien = ct.MaNhanVien; ect.NgayTra = ct.NgayTra; l.Add(ect); } return(l); }
public eChiTietPhieuTraNoKhachHang ThuNoKH(string pMaHoaDonBanSi, string pMaNhanVien, decimal pSoTien, string pGhiChu) { KiemTraTraNoKH(pMaHoaDonBanSi, pSoTien); ChiTietPhieuTraNoKhachHang ct = new ChiTietPhieuTraNoKhachHang(); eChiTietPhieuTraNoKhachHang ect = new eChiTietPhieuTraNoKhachHang(); ct.MaChiTietPhieuTraNoKH = ect.MaChiTietPhieuTraNoKH = TaoMaChiTietPhieuTraNoKH(); ct.SoTien = ect.SoTien = pSoTien; ct.MaNhanVien = ect.MaNhanVien = pMaNhanVien; ct.NgayTra = ect.NgayTra = DateTime.Now; ct.MaHoaDonBanSi = ect.MaHoaDonBanSi = pMaHoaDonBanSi; ct.GhiChu = ect.GhiChu = pGhiChu; try { db.ChiTietPhieuTraNoKhachHangs.InsertOnSubmit(ct); db.SubmitChanges(); return(ect); } catch { return(null); } }