public void CheckDisbursementVoucher(int id) { if (SystemClass.CheckConnection()) { ImusCityHallEntities db = new ImusCityHallEntities(); List <DisbursementVoucherModel> DVList = new List <DisbursementVoucherModel>(); db = new ImusCityHallEntities(); DVList = new List <DisbursementVoucherModel>(); var disburse = db.GetDisbursementVoucher(id).ToList(); CDSSignatory signatories = db.CDSSignatories.FirstOrDefault(); foreach (var x in disburse) { DisbursementVoucherModel dvl = new DisbursementVoucherModel(); dvl.Amount = x.Amount.HasValue ? x.Amount.Value : 0; dvl.Certification = x.Certification; dvl.CompanyAddress = x.CompanyAddress; dvl.CompanyName = x.CompanyName; dvl.DateCreated = x.DateCreated.Value; dvl.DepartmentCode = x.DepartmentCode; dvl.Description = x.Explanation; dvl.DocumentCompleted = x.DocumentCompleted; dvl.Obligated = x.Obligated; dvl.ObligationRequestNo = x.ObligationRequestNo; dvl.TIN_EmpNo = x.TIN_EmpNo; dvl.Unit_Project = x.Unit_Project; dvl.VoucherNo = x.VoucherNo; dvl.PaymentName = x.PaymentType; dvl.Name = x.FundName; dvl.Signatory = SystemClass.GetSignatory(signatories.CityAccountant); dvl.Signatory2 = SystemClass.GetSignatory(signatories.CityTreasurer); dvl.Signatory3 = SystemClass.GetSignatory(signatories.CityMayor); DVList.Add(dvl); } ReportDocument report; report = new DisbursementVoucherReport(); report.SetDataSource(DVList); report.SetParameterValue("employee", "Generated By: " + SystemClass.Employee(App.EmployeeID)); report.SetParameterValue("actingmayor", signatories.UseActingMayor); reportviewer.ViewerCore.ReportSource = report; } else { MessageBox.Show(SystemClass.DBConnectionErrorMessage); } }