Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        public void CheckReport(int id)
        {
            if (SystemClass.CheckConnection())
            {
                ImusCityHallEntities db          = new ImusCityHallEntities();
                CDSSignatory         signatories = db.CDSSignatories.FirstOrDefault();
                CheckModel           check       = new CheckModel();
                ImusCityGovernmentSystem.Model.Check checklist = db.Checks.Find(id);
                check.CheckNo     = checklist.CheckNo;
                check.CheckDate   = checklist.DateCreated.Value;
                check.CompanyName = checklist.Disbursement.Payee == null ? checklist.Disbursement.PayeeName : checklist.Disbursement.Payee.CompanyName;
                CurrencyToWords convert = new CurrencyToWords();
                double          amount  = Convert.ToDouble(checklist.Amount.Value);
                check.AmountInWords    = convert.NumberToWords(amount).ToUpper();
                check.CheckDescription = checklist.CheckDescription;
                check.VoucherNo        = checklist.Disbursement.VoucherNo;
                check.Amount           = checklist.Amount.Value;
                check.Signatory1       = SystemClass.GetSignatory(signatories.CityMayor);
                check.Signatory2       = SystemClass.GetSignatory(signatories.CityTreasurer);
                ReportDocument report;
                switch (bankName)
                {
                case "LB":
                    report = new LBCheckReport();
                    report.SetDataSource(new[] { check });
                    reportviewer.ViewerCore.ReportSource = report;
                    break;

                case "UCPB":
                    report = new UCPBCheckReport();
                    report.SetDataSource(new[] { check });
                    reportviewer.ViewerCore.ReportSource = report;
                    break;

                case "DBP":
                    report = new DBPCheckReport();
                    report.SetDataSource(new[] { check });
                    reportviewer.ViewerCore.ReportSource = report;
                    break;
                }
            }
            else
            {
                MessageBox.Show(SystemClass.DBConnectionErrorMessage);
            }
        }