public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var organisationId = UserOrganisationId; var candidateFee = NidanBusinessService.RetrieveCandidateFee(organisationId, id.Value); // var paymentmodes = NidanBusinessService.RetrievePaymentModes(organisationId, e => true); if (candidateFee == null) { return(HttpNotFound()); } var viewModel = new CandidateFeeViewModel { CandidateFeeId = candidateFee.CandidateFeeId, CandidateFee = candidateFee, PaymentModes = new SelectList(NidanBusinessService.RetrievePaymentModes(UserOrganisationId, e => true).ToList(), "PaymentModeId", "Name"), }; return(View(viewModel)); }
public ActionResult TotalFee(int?id) { var organisationId = UserOrganisationId; var data = NidanBusinessService.RetrieveCandidateInstallment(organisationId, id.Value, e => true); var candidateFeeData = NidanBusinessService.RetrieveCandidateFeeGrid(organisationId, e => e.CandidateInstallmentId == id.Value); var totalPaid = candidateFeeData.Items.Sum(e => e.PaidAmount); var courseFee = data.PaymentMethod == "MonthlyInstallment" ? data.CourseFee : data.LumpsumAmount; var balanceAmount = data.PaymentMethod == "MonthlyInstallment" ? data.CourseFee - totalPaid : data.LumpsumAmount - totalPaid; var candidateFeeModel = new CandidateFeeViewModel { TotalPaidFee = totalPaid, BalanceFee = balanceAmount, CourseFee = courseFee }; return(this.JsonNet(candidateFeeModel)); }
public ActionResult Detail(int?id) { var organisationId = UserOrganisationId; var data = NidanBusinessService.RetrieveCandidateInstallment(organisationId, id.Value, e => true); var enquiry = NidanBusinessService.RetrieveEnquiries(organisationId, e => e.StudentCode == data.StudentCode).ToList().FirstOrDefault(); //var candidateFeeData = NidanBusinessService.RetrieveCandidateFees(organisationId, e => e.CandidateInstallmentId == id.Value); //var candidateFeeData = NidanBusinessService.RetrieveCandidateFeeGrid(organisationId, e => e.CandidateInstallmentId == id.Value); var candidateInstallmentGrid = NidanBusinessService.RetrieveCandidateInstallmentGrid(organisationId, e => e.CandidateInstallmentId == id.Value).Items.FirstOrDefault(); var totalPaid = candidateInstallmentGrid.PaidAmount; var courseFee = candidateInstallmentGrid.TotalFee; var balanceAmount = candidateInstallmentGrid.PendingAmount; var candidateFeeModel = new CandidateFeeViewModel { CandidateName = String.Format("{0} {1} {2} {3}", enquiry?.Title, enquiry?.FirstName, enquiry?.MiddleName, enquiry?.LastName), CandidateInstallmentId = id.Value, TotalPaidFee = totalPaid, BalanceFee = balanceAmount, CourseFee = courseFee, }; return(View(candidateFeeModel)); }
public ActionResult SaveFee(CandidateFeeViewModel candidateFeeViewModel) { var organisationId = UserOrganisationId; try { var candidateFeeData = NidanBusinessService.RetrieveCandidateFee(organisationId, candidateFeeViewModel.CandidateFee.CandidateFeeId); var candidateInstallmentData = NidanBusinessService.RetrieveCandidateFees(organisationId, e => e.CandidateFeeId > candidateFeeData.CandidateFeeId && e.CandidateInstallmentId == candidateFeeData.CandidateInstallmentId).Items.FirstOrDefault(); candidateFeeViewModel.CandidateFee.OrganisationId = organisationId; candidateFeeViewModel.CandidateFee.CentreId = UserCentreId; candidateFeeData.PaymentDate = candidateFeeViewModel.CandidateFee.PaymentDate; candidateFeeData.FeeTypeId = (int)Business.Enum.FeeType.Installment; candidateFeeData.FiscalYear = DateTime.UtcNow.FiscalYear(); candidateFeeData.IsPaymentDone = true; candidateFeeData.BankName = candidateFeeViewModel.CandidateFee.BankName; candidateFeeData.ChequeDate = candidateFeeViewModel.CandidateFee.ChequeDate; candidateFeeData.IsPaidAmountOverride = candidateFeeViewModel.CandidateFee.IsPaidAmountOverride; candidateFeeData.PaymentModeId = candidateFeeViewModel.CandidateFee.PaymentModeId; candidateFeeData.ChequeNumber = candidateFeeViewModel.CandidateFee.ChequeNumber; candidateFeeData.HaveReceipt = candidateFeeViewModel.CandidateFee.HaveReceipt; candidateFeeData.ReferenceReceiptNumber = candidateFeeViewModel.CandidateFee.ReferenceReceiptNumber; candidateFeeData.PersonnelId = UserPersonnelId; if (candidateFeeViewModel.CandidateFee.IsPaidAmountOverride && candidateFeeViewModel.CandidateFee.PaidAmount != null) { if (candidateFeeViewModel.CandidateFee.PaidAmount < candidateFeeData.InstallmentAmount) { candidateFeeData.BalanceInstallmentAmount = candidateFeeData.InstallmentAmount - candidateFeeViewModel.CandidateFee.PaidAmount; if (candidateInstallmentData != null) { candidateFeeData.PaidAmount = candidateFeeViewModel.CandidateFee.PaidAmount; NidanBusinessService.UpdateCandidateFee(organisationId, candidateFeeData); AdjustInstallment(candidateFeeData.CandidateInstallmentId, 0, candidateFeeData.BalanceInstallmentAmount); return(this.JsonNet(true)); } } if (candidateFeeViewModel.CandidateFee.PaidAmount > candidateFeeData.InstallmentAmount) { candidateFeeData.AdvancedAmount = candidateFeeViewModel.CandidateFee.PaidAmount - candidateFeeData.InstallmentAmount; if (candidateInstallmentData != null) { candidateFeeData.PaidAmount = candidateFeeViewModel.CandidateFee.PaidAmount; NidanBusinessService.UpdateCandidateFee(organisationId, candidateFeeData); AdjustInstallment(candidateFeeData.CandidateInstallmentId, candidateFeeData.AdvancedAmount, 0); return(this.JsonNet(true)); } } if (candidateInstallmentData != null) { NidanBusinessService.UpdateCandidateFee(organisationId, candidateInstallmentData); } candidateFeeData.PaidAmount = candidateFeeViewModel.CandidateFee.PaidAmount; } else { candidateFeeData.PaidAmount = candidateFeeData.InstallmentAmount; } candidateFeeViewModel.CandidateFee = NidanBusinessService.UpdateCandidateFee(organisationId, candidateFeeData); return(this.JsonNet(true)); } catch (Exception e) { return(this.JsonNet(false)); } }