public static AcquittanceViewModel Create(ITLoanRepository loanRepository, IMEmployeeRepository mEmployeeRepository, string loanCode) { AcquittanceViewModel viewModel = new AcquittanceViewModel(); TLoan loan = loanRepository.GetLoanByLoanCode(loanCode); viewModel.BasicPrice = loan.LoanBasicPrice; viewModel.CreditPrice = loan.LoanCreditPrice; viewModel.Installment = loan.LoanBasicInstallment; viewModel.LoanTenor = loan.LoanTenor; viewModel.PaidInstallment = (loan.Installments).Where(x => x.InstallmentStatus == EnumInstallmentStatus.Paid.ToString()).Count(); viewModel.RequiredInstallment = Math.Ceiling(loan.LoanTenor.Value * 0.75m); viewModel.RequiredInstallmentTotal = (viewModel.RequiredInstallment - viewModel.PaidInstallment) * viewModel.Installment; viewModel.LoseSort = viewModel.LoanTenor - viewModel.RequiredInstallment; viewModel.LoseSortTotal = viewModel.LoseSort * (viewModel.CreditPrice / viewModel.LoanTenor); viewModel.Provision = viewModel.LoseSortTotal.Value * 0.1m; viewModel.MustPaid = viewModel.RequiredInstallmentTotal + viewModel.LoseSortTotal + viewModel.Provision; var listEmployee = mEmployeeRepository.GetEmployeeByDept(EnumDepartment.COL.ToString()); MEmployee employee = new MEmployee(); listEmployee.Insert(0, employee); var collector = from emp in listEmployee 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 static LoanSummary Create(ITLoanRepository tLoanRepository, DateTime month) { LoanSummary summary = new LoanSummary(); summary.Month = month; //calculate loan total IList list = tLoanRepository.GetTotalByMonth(month); if (list != null) { if (list.Count > 0) { object[] obj = (object[])list[0]; summary.TotalHD = (decimal)obj[0]; summary.TotalHT = (decimal)obj[1]; summary.TotalInstallment = (decimal)obj[2]; } } //calculate loan count summary.TotalLoanApprove = tLoanRepository.GetCountByLoanStatus(month, EnumLoanStatus.Approve); summary.TotalLoanReject = tLoanRepository.GetCountByLoanStatus(month, EnumLoanStatus.Reject); summary.TotalLoanPostpone = tLoanRepository.GetCountByLoanStatus(month, EnumLoanStatus.Postpone); summary.TotalLoanCancel = tLoanRepository.GetCountByLoanStatus(month, EnumLoanStatus.Cancel); summary.TotalLoan = summary.TotalLoanApprove + summary.TotalLoanReject + summary.TotalLoanPostpone + summary.TotalLoanCancel; //calculate installment summary.TotalMustPaidInstallment = tLoanRepository.GetTotalInstallmentByStatus(month, "%"); summary.TotalPaidInstallment = tLoanRepository.GetTotalInstallmentByStatus(month, EnumInstallmentStatus.Paid.ToString()); return(summary); }
public static HomeViewModel Create(ITNewsRepository tNewsRepository, ITLoanRepository tLoanRepository) { var viewModel = new HomeViewModel(); TNews news = tNewsRepository.GetByType(EnumNewsType.Promo); if (news == null) { news = new TNews(); } viewModel.PromoNews = news; news = tNewsRepository.GetByType(EnumNewsType.Announcement); if (news == null) { news = new TNews(); } viewModel.AnnouncementNews = news; DateTime currentMonth = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1); viewModel.CurrentLoanSummary = LoanSummary.Create(tLoanRepository, currentMonth); viewModel.OneMonthAgoLoanSummary = LoanSummary.Create(tLoanRepository, currentMonth.AddMonths(-1)); viewModel.OneMonthAgoAchievement = AchievementSummary.Create(tLoanRepository, currentMonth.AddMonths(-1)); 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; }
public static FeedbackViewModel Create(ITLoanRepository tLoanRepository, ITLoanFeedbackRepository tLoanFeedbackRepository, string loanId) { var viewModel = new FeedbackViewModel(); if (!string.IsNullOrEmpty(loanId)) { viewModel.LoanFeedbackCommon = GetLoanFeedback(tLoanFeedbackRepository, loanId, EnumLoanFeedbackType.Common); viewModel.LoanFeedbackPaymentCharacter = GetLoanFeedback(tLoanFeedbackRepository, loanId, EnumLoanFeedbackType.PaymentCharacter); viewModel.LoanFeedbackProblem = GetLoanFeedback(tLoanFeedbackRepository, loanId, EnumLoanFeedbackType.Problem); viewModel.LoanFeedbackSolution = GetLoanFeedback(tLoanFeedbackRepository, loanId, EnumLoanFeedbackType.Solution); } return(viewModel); }
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 AchievementSummary Create(ITLoanRepository tLoanRepository, DateTime month) { AchievementSummary summary = new AchievementSummary(); summary.Month = month; //get collector IList listCol = tLoanRepository.GetMaxCollector(month); if (listCol != null) { if (listCol.Count > 0) { object[] obj = (object[])listCol[0]; summary.CollectorName = obj[0].ToString(); summary.CollectorTarget = (decimal)obj[1]; summary.CollectorAchievement = (decimal)obj[2]; } } //get tls IList listTLS = tLoanRepository.GetMaxTLS(month); if (listTLS != null) { if (listTLS.Count > 0) { object[] obj = (object[])listTLS[0]; summary.LTSName = obj[0].ToString(); summary.LTSAchievement = (decimal)obj[1]; summary.LTSTarget = (decimal)obj[2]; } } //get sales IList listSalesman = tLoanRepository.GetMaxSalesman(month); if (listSalesman != null) { if (listSalesman.Count > 0) { object[] obj = (object[])listSalesman[0]; summary.SalesmanName = obj[0].ToString(); summary.SalesmanAchievement = (decimal)obj[1]; summary.SalesmanTarget = (decimal)obj[2]; } } return(summary); }
public HomeController(IMEmployeeRepository mEmployeeRepository, IRefAddressRepository refAddressRepository, IRefPersonRepository refPersonRepository, IMDepartmentRepository mDepartmentRepository, ITNewsRepository tNewsRepository, ITLoanRepository tLoanRepository) { Check.Require(mEmployeeRepository != null, "mEmployeeRepository may not be null"); Check.Require(refAddressRepository != null, "refAddressRepository may not be null"); Check.Require(refPersonRepository != null, "refPersonRepository may not be null"); Check.Require(mDepartmentRepository != null, "mDepartmentRepository may not be null"); Check.Require(tNewsRepository != null, "tNewsRepository may not be null"); Check.Require(tLoanRepository != null, "tLoanRepository may not be null"); this._mEmployeeRepository = mEmployeeRepository; this._refAddressRepository = refAddressRepository; this._refPersonRepository = refPersonRepository; this._mDepartmentRepository = mDepartmentRepository; this._tNewsRepository = tNewsRepository; this._tLoanRepository = tLoanRepository; }
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); }
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; }
public static CRFormViewModel CreateCRFormViewModel(ITLoanRepository tLoanRepository, IMEmployeeRepository mEmployeeRepository, string loanCustomerRequestId) { CRFormViewModel viewModel = new CRFormViewModel(); viewModel.CanEditId = true; TLoan loan = null; TLoanUnit loanUnit = null; RefPerson person = new RefPerson(); RefAddress address = new RefAddress(); if (!string.IsNullOrEmpty(loanCustomerRequestId)) { loan = tLoanRepository.Get(loanCustomerRequestId); person = loan.PersonId; address = loan.AddressId; if (loan.LoanUnits.Count > 0) { loanUnit = loan.LoanUnits[0]; } else { loanUnit = new TLoanUnit(); } viewModel.CanEditId = false; } if (loan == null) { MEmployee emp = new MEmployee(); MCustomer cust = new MCustomer(); loan = new TLoan(); loanUnit = new TLoanUnit(); loan.TLSId = emp; loan.CustomerId = cust; loan.CustomerId.PersonId = person; loan.CustomerId.AddressId = address; } viewModel.Loan = loan; viewModel.LoanUnit = loanUnit; if (loan.LoanAdminFee != null) { if (loan.LoanAdminFee == 25000) { viewModel.LoanAdminFee1 = true; } else if (loan.LoanAdminFee == 50000) { viewModel.LoanAdminFee2 = true; } else if (loan.LoanAdminFee == 75000) { viewModel.LoanAdminFee3 = true; } } if (loan.LoanMateraiFee != null) { viewModel.LoanMateraiFee = true; } viewModel.Photo1 = "~/Content/Images/no_photo104_on.jpg"; viewModel.Photo2 = "~/Content/Images/no_photo104_on.jpg"; if (!string.IsNullOrEmpty(loan.LoanDesc)) { string separator = "|"; string[] photos = loan.LoanDesc.Split(separator.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (photos.Count() > 0) { viewModel.Photo1 = photos[0]; } if (photos.Count() > 1) { viewModel.Photo2 = photos[1]; } } MEmployee employee = new MEmployee(); var listTlsEmployee = mEmployeeRepository.GetEmployeeByDept(EnumDepartment.TLS.ToString()); listTlsEmployee.Insert(0, employee); var tls = from emps in listTlsEmployee select new { Id = emps.Id, Name = emps.PersonId != null ? emps.PersonId.PersonName : "-Pilih Team Leader-" }; viewModel.TLSList = new SelectList(tls, "Id", "Id", loan.TLSId != null ? loan.TLSId.Id : string.Empty); var listSaEmployee = mEmployeeRepository.GetEmployeeByDept(EnumDepartment.SA.ToString()); listSaEmployee.Insert(0, employee); var salesman = from emps in listSaEmployee select new { Id = emps.Id, Name = emps.PersonId != null ? emps.PersonId.PersonName : "-Pilih Salesman-" }; viewModel.SalesmanList = new SelectList(salesman, "Id", "Id", loan.SalesmanId != null ? loan.SalesmanId.Id : string.Empty); var listSuEmployee = mEmployeeRepository.GetEmployeeByDept(EnumDepartment.SU.ToString()); listSuEmployee.Insert(0, employee); var surveyor = from emps in listSuEmployee select new { Id = emps.Id, Name = emps.PersonId != null ? emps.PersonId.PersonName : "-Pilih Surveyor-" }; viewModel.SurveyorList = new SelectList(surveyor, "Id", "Id", loan.SurveyorId != null ? loan.SurveyorId.Id : string.Empty); return(viewModel); }