public static ReportDataSource GetInstallment(ITInstallmentRepository installmentRepository, string loanAcc, int installmentNo)
        {
            IEnumerable <TInstallment> installments = installmentRepository.GetInstallment(loanAcc, installmentNo);

            var list = from ins in installments
                       select new
            {
                ins.Id,
                ins.LoanId.LoanCode,
                CustomerName = ins.LoanId.PersonId.PersonName,
                ins.InstallmentMaturityDate,
                ins.InstallmentTotal,
                ins.InstallmentFine,
                ins.InstallmentMustPaid,
                ins.InstallmentReceiptNo,
                CustomerAddress = ins.LoanId.AddressId.AddressLine1,
                ins.InstallmentNo,
                ins.LoanId.LoanTenor,
                ins.LoanId.LoanUnits[0].UnitName,
                ins.LoanId.LoanUnits[0].UnitType
            }
            ;

            ReportDataSource reportDataSource = new ReportDataSource("InstallmentViewModel", list.ToList());

            return(reportDataSource);
        }
        public static InstallmentPaymentFormViewModel Create(ITInstallmentRepository installmentRepository, IMEmployeeRepository mEmployeeRepository, string loanCode)
        {
            installmentRepository.DbContext.BeginTransaction();
            InstallmentPaymentFormViewModel viewModel = new InstallmentPaymentFormViewModel();
            TInstallment ins = installmentRepository.GetLastInstallment(loanCode);

            if (ins == null)
            {
                ins = new TInstallment();
            }
            viewModel.installment = ins;
            viewModel.installment.InstallmentPaymentDate = DateTime.Today;
            installmentRepository.DbContext.RollbackTransaction();

            var       listEmployee = mEmployeeRepository.GetEmployeeByDept(EnumDepartment.COL.ToString());
            MEmployee employee     = new MEmployee();

            //mCustomer.SupplierName = "-Pilih Supplier-";
            listEmployee.Insert(0, employee);

            var collector = from emp in listEmployee
                            //where emp.DepartmentId.DepartmentName == "COLLECTOR"
                            select new { Id = emp.Id, Name = emp.PersonId != null ? emp.PersonId.PersonName : "-Pilih Kolektor-" };

            viewModel.CollectorList = new SelectList(collector, "Id", "Id", string.Empty);

            return(viewModel);
        }
        public InstallmentController(ITLoanRepository loanRepository, ITInstallmentRepository installmentRepository, IMEmployeeRepository mEmployeeRepository)
        {
            Check.Require(loanRepository != null, "loanRepository may not be null");
            Check.Require(installmentRepository != null, "installmentRepository may not be null");
            Check.Require(mEmployeeRepository != null, "mEmployeeRepository may not be null");

            this._loanRepository        = loanRepository;
            this._installmentRepository = installmentRepository;
            this._mEmployeeRepository   = mEmployeeRepository;
        }
Example #4
0
        public ReportController(ITLoanRepository loanRepository, ITInstallmentRepository installmentRepository, ITCommissionRepository tCommissionRepository, ITRecPeriodRepository tRecPeriodRepository, IMPartnerRepository mPartnerRepository)
        {
            Check.Require(loanRepository != null, "loanRepository may not be null");
            Check.Require(installmentRepository != null, "installmentRepository may not be null");
            Check.Require(tCommissionRepository != null, "tCommissionRepository may not be null");
            Check.Require(tRecPeriodRepository != null, "tRecPeriodRepository may not be null");
            Check.Require(mPartnerRepository != null, "mPartnerRepository may not be null");

            this._loanRepository        = loanRepository;
            this._installmentRepository = installmentRepository;
            this._tCommissionRepository = tCommissionRepository;
            this._tRecPeriodRepository  = tRecPeriodRepository;
            this._mPartnerRepository    = mPartnerRepository;
        }
        public static DetailLoanViewModel Create(ITLoanRepository loanRepository, ITInstallmentRepository installmentRepository, string loanCode)
        {
            DetailLoanViewModel viewModel = new DetailLoanViewModel();

            viewModel.Loan = loanRepository.GetLoanByLoanCode(loanCode);

            var l = from t in viewModel.Loan.Installments
                    where
                    t.InstallmentStatus == EnumInstallmentStatus.Not_Paid.ToString() &&
                    t.InstallmentMaturityDate < DateTime.Today
                    select t;

            viewModel.InstallmentLate = l.Count();

            viewModel.InstallmentMore =
                (viewModel.Loan.Installments).Where(x => x.InstallmentStatus == EnumInstallmentStatus.Paid.ToString()).
                Sum(x => x.InstallmentSisa).Value;

            viewModel.InstallmentMinus =
                (viewModel.Loan.Installments).Where(x => x.InstallmentStatus == EnumInstallmentStatus.Paid.ToString()).
                Sum(x => x.InstallmentSisa).Value;

            viewModel.InstallmentFine =
                (viewModel.Loan.Installments).Where(x => x.InstallmentStatus == EnumInstallmentStatus.Paid.ToString()).
                Sum(x => x.InstallmentFine).Value;

            string separator = "|";

            string[] photos = viewModel.Loan.LoanDesc.Split(separator.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            viewModel.Photo1 = "~/Content/Images/no_photo104_on.jpg";
            viewModel.Photo2 = "~/Content/Images/no_photo104_on.jpg";
            if (photos.Count() > 0)
            {
                viewModel.Photo1 = photos[0];
            }
            if (photos.Count() > 1)
            {
                viewModel.Photo2 = photos[1];
            }
            return(viewModel);
        }
Example #6
0
        public ClosingController(ITLoanRepository loanRepository, ITInstallmentRepository installmentRepository, IMEmployeeRepository mEmployeeRepository, ITRecPeriodRepository tRecPeriodRepository, IMCommissionRepository mCommissionRepository, IMCommissionDetRepository mCommissionDetRepository, ITLoanSurveyRepository tLoanSurveyRepository, ITCommissionRepository tCommissionRepository, IMZoneEmployeeRepository mZoneEmployeeRepository)
        {
            Check.Require(loanRepository != null, "loanRepository may not be null");
            Check.Require(installmentRepository != null, "installmentRepository may not be null");
            Check.Require(mEmployeeRepository != null, "mEmployeeRepository may not be null");
            Check.Require(tRecPeriodRepository != null, "tRecPeriodRepository may not be null");
            Check.Require(mCommissionRepository != null, "mCommissionRepository may not be null");
            Check.Require(mCommissionDetRepository != null, "mCommissionDetRepository may not be null");
            Check.Require(tLoanSurveyRepository != null, "tLoanSurveyRepository may not be null");
            Check.Require(tCommissionRepository != null, "tCommissionRepository may not be null");
            Check.Require(mZoneEmployeeRepository != null, "mZoneEmployeeRepository may not be null");

            this._loanRepository           = loanRepository;
            this._installmentRepository    = installmentRepository;
            this._mEmployeeRepository      = mEmployeeRepository;
            this._tRecPeriodRepository     = tRecPeriodRepository;
            this._mCommissionRepository    = mCommissionRepository;
            this._mCommissionDetRepository = mCommissionDetRepository;
            this._tLoanSurveyRepository    = tLoanSurveyRepository;
            this._tCommissionRepository    = tCommissionRepository;
            this._mZoneEmployeeRepository  = mZoneEmployeeRepository;
        }