예제 #1
0
        public int AddOrUpdateLoan(LoanInfo loan, string ipAddress)
        {
            int        newInsertedLoanID = 0;
            var        dt  = new DataTable();
            SqlCommand cmd = new SqlCommand();

            cmd.Connection  = conn;
            cmd.CommandText = "dbo.sp_AddOrUpdateStudentLoan";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Clear();
            cmd.Parameters.AddWithValue("@loanId", loan.LoanId);
            cmd.Parameters.AddWithValue("@stcode", loan.StudentCode);
            cmd.Parameters.AddWithValue("@loanType", loan.LoanType);
            cmd.Parameters.AddWithValue("@term", loan.Term);
            cmd.Parameters.AddWithValue("@status", loan.Status);
            cmd.Parameters.AddWithValue("@reqRegisterDate", loan.ReqRegisterDate);
            cmd.Parameters.AddWithValue("@message", loan.Message);
            cmd.Parameters.AddWithValue("@ipAddress", ipAddress);
            //cmd.Parameters.AddWithValue("@newID", SqlDbType.Int).Direction=ParameterDirection.Output;
            try
            {
                conn.Open();
                //SqlDataReader rd= cmd.ExecuteReader();
                //dt.Load(rd);
                //newInsertedLoanID =(int)cmd.Parameters["@newID"].Value;
                newInsertedLoanID = Convert.ToInt32(cmd.ExecuteScalar());
                conn.Close();
            }
            catch (Exception x) { throw x; }
            //if (dt != null && dt.Rows.Count > 0)
            //{
            //    newInsertedLoanID = Convert.ToInt32(dt.Rows[0][0]);
            //}
            return(newInsertedLoanID);
        }
예제 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         if (this.Request.QueryString["WorkItemId"] != null)
         {
             string           workItemId = this.Request.QueryString["WorkItemId"];
             IWorkflowSession wflsession = RuntimeContextExamples.GetRuntimeContext().getWorkflowSession();
             IWorkItem        wi         = wflsession.findWorkItemById(workItemId);
             String           sn         = (String)wi.TaskInstance.AliveProcessInstance.getProcessInstanceVariable("sn");
             LoanInfoDAO      lid        = new LoanInfoDAO();
             LoanInfo         ti         = lid.findBySn(sn);
             if (ti != null)
             {
                 HWorkItemId.Value        = workItemId;
                 applicantName.Text       = ti.ApplicantName;
                 applicantId.Text         = ti.ApplicantId;
                 address.Text             = ti.Address;
                 salary.Text              = ti.Salary.ToString();
                 loanValue.Text           = ti.LoanValue.ToString();
                 returnDate.Text          = ti.ReturnDate;
                 loanteller.Text          = ti.Loanteller;
                 appInfoInputDate.Text    = ti.AppInfoInputDate.ToString("yyyy-MM-dd hh:mm:ss");
                 salaryIsReal.Text        = ti.SalaryIsReal ? "属实" : "不属实";
                 creditStatus.Text        = ti.CreditStatus ? "合格" : "不合格";
                 riskEvaluator.Text       = ti.RiskEvaluator;
                 riskInfoInputDate.Text   = ti.RiskInfoInputDate.ToString("yyyy-MM-dd hh:mm:ss");
                 rejectInfoInputTime.Text = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
             }
         }
     }
 }
예제 #3
0
        private dynamic BindUpLoanInfo(LoanInfo loan)
        {
            dynamic  loanInfo = new System.Dynamic.ExpandoObject();
            LoanFile loanFile = loan.Open(true);

            List <LoanAttribute> _attrs = CalyxConnEngine.Attributes;

            if (_attrs == null || _attrs.Count() == 0)
            {
                loanInfo.Error = "OOPS! Failed to Bind Loan Fields.";
            }
            else
            {
                loanInfo.Error = "";
                List <PointField> pointFields = new List <PointField>();
                foreach (LoanAttribute attr in _attrs)
                {
                    try
                    {
                        pointFields.Add(new PointField()
                        {
                            PointFieldID = attr.PointFieldID,
                            Description  = attr.PointFieldName,
                            Data         = PointFieldValue(loanFile.GetData(attr.PointFieldID, Calyx.Point.Data.Common.BorrowerSetPositionType.Borrower))
                        });
                    }
                    catch { }
                }
                loanInfo.PointFields = pointFields;
            }
            return(loanInfo);
        }
예제 #4
0
        public ActionResult LoanPartial()
        {
            Params param = new Params()
            {
                Parameter = new Dictionary <string, string>()
            };

            string accountno  = Request["accountNo"];
            string loannumber = Request["loanNumber"];
            char   pad        = '0';

            param.RequestTransType = "GetLoanInfoDetail";
            param.Parameter.Add("acctNo", accountno);
            param.Parameter.Add("noteNo", loannumber.PadLeft(5, pad));

            LoanInfo model = ProductInquiry.Loan(param);

            if (model != null && model.LoanNumber != null)
            {
                ViewBag.searchResults          = model;
                ViewBag.searchResultsCount     = 1;
                ViewBag.searchResultsList      = model.Installments;
                ViewBag.searchResultsListCount = model.Installments.Count;
            }

            return(PartialView("_Loan", model));
        }
예제 #5
0
        protected override void MarkAsActiva(DataGridViewRow row)
        {
            LoanInfo item = row.DataBoundItem as LoanInfo;

            item.Vinculado = Library.Store.Resources.Labels.SET_PAGO;
            base.MarkAsActiva(row);
        }
예제 #6
0
        public IActionResult OnGet(int id)
        {
            using (this.db)
            {
                var loan = db.Loans
                           .Include(l => l.Book)
                           .Include(l => l.Borrower)
                           .FirstOrDefault(l => l.Id == id);

                if (loan == null)
                {
                    return(this.RedirectToPage("/Messages", new { id = 3 }));
                }

                this.Loan = new LoanInfo()
                {
                    Id           = loan.Id,
                    BookId       = loan.BookId,
                    BookTitle    = loan.Book.Title,
                    BorrowerId   = loan.BorrowerId,
                    BorrowerName = loan.Borrower.Name,
                    DateOfLoan   = loan.DateOfLoan.ToShortDateString(),
                    DueDate      = loan.DueDate.ToShortDateString(),
                    Status       = loan.IsOverdue() == false ? "OK" : "Overdue",
                    IsReturned   = loan.IsReturned
                };

                return(this.Page());
            }
        }
예제 #7
0
        public void Save_Click(object sender, AjaxEventArgs e)
        {
            string           workItemId = HWorkItemId.Value.ToString();
            IWorkflowSession wflsession = RuntimeContextExamples.GetRuntimeContext().getWorkflowSession();
            IWorkItem        wi         = wflsession.findWorkItemById(workItemId);

            String      sn       = (String)wi.TaskInstance.AliveProcessInstance.getProcessInstanceVariable("sn");
            LoanInfoDAO lid      = new LoanInfoDAO();
            LoanInfo    loanInfo = lid.findBySn(sn);

            loanInfo.RejectInfoInputTime = DateTime.Parse(rejectInfoInputTime.Text);//lendMoneyInfo
            loanInfo.RejectInfo          = comments.Text;

            //4、完成工单
            try
            {
                if (wi != null)
                {
                    if (wi.ActorId == this.User.Identity.Name)
                    {
                        wi.complete(comments.Text);
                    }
                }
            }
            catch
            {
                throw;
            }
        }
예제 #8
0
        public ActionResult Index(LoanInfo item, string LoanType)
        {
            //LoanInfo item


            try
            {
                if (!ModelState.IsValid)
                {
                    return(View());
                }
                item.LoanType = LoanType;

                _logger.Info(item.LoanType);
                _db.Add(item);

                Session["item"] = item;
            }
            catch (Exception e)
            {
                //Logger logger = LogManager.GetLogger("fileLogger");

                // add custom message and pass in the exception
                _logger.Error(e, "Whoops!");
            }
            return(RedirectToAction("FilteredResult", "Loan"));
        }
예제 #9
0
        protected void LinkLineAction(DataGridViewRow row)
        {
            if (row == null)
            {
                return;
            }

            if (_entity.EMedioPago != EMedioPago.CompensacionFactura)
            {
                if (_deallocated == 0)
                {
                    UnlinkLineAction(row);
                    return;
                }
            }

            LoanInfo item = row.DataBoundItem as LoanInfo;

            if (item == null)
            {
                return;
            }

            _entity.InsertNewTransactionPayment(item, _deallocated);

            UpdateAllocated();

            MarkAsNoActiva(row);
        }
예제 #10
0
        public override void DeleteObject(long oid)
        {
            LoanInfo    prestamo = LoanInfo.Get(ActiveOID, false);
            PaymentList pagos    = PaymentList.GetListByPrestamo(prestamo, false);

            PaymentInfo p = pagos.FirstOrDefault(x => x.EEstado != moleQule.Base.EEstado.Anulado);

            if (pagos != null && (pagos.FirstOrDefault(x => x.EEstado != moleQule.Base.EEstado.Anulado) != default(PaymentInfo)))
            {
                PgMng.ShowErrorException(Resources.Messages.PRESTAMO_CON_PAGOS_ASOCIADOS);
                _action_result = DialogResult.Cancel;
            }
            else
            {
                if (prestamo.OidPago != 0)
                {
                    PgMng.ShowErrorException(Resources.Messages.PRESTAMO_ASOCIADO_PAGO_FACTURA);
                    _action_result = DialogResult.Cancel;
                }
                else
                {
                    Loan.Delete(oid);
                    _action_result = DialogResult.OK;
                }
            }
        }
예제 #11
0
        /// <summary>
        ///     从上次计息日后一日起计算单利利息并整理还款
        /// </summary>
        /// <param name="info">借款信息</param>
        /// <param name="capitalIntegral">剩余本金</param>
        /// <param name="interestIntegral">剩余利息</param>
        /// <param name="lastSettlement">上次计息日</param>
        /// <param name="finalDay">截止日期</param>
        private void Regularize(LoanInfo info, ref double capitalIntegral, ref double interestIntegral,
            DateTime? lastSettlement, DateTime finalDay)
        {
            var capitalPattern = info.AsCapital();
            var interestPattern = info.AsInterest();
            DateFilter rng = lastSettlement.HasValue
                ? new(lastSettlement.Value.AddDays(1), finalDay)
                : new(null, finalDay);
            foreach (var grp in
                Accountant
                    .RunVoucherQuery($"{info.QueryMajor()} {rng.AsDateRange()}")
                    .GroupBy(v => v.Date)
                    .OrderBy(grp => grp.Key, new DateComparer()))
            {
                var key = grp.Key ?? throw new ApplicationException("无法处理无穷长时间以前的利息收入");

                lastSettlement ??= key;

                // Settle Interest
                interestIntegral += SettleInterest(
                    info,
                    capitalIntegral,
                    key.Subtract(lastSettlement.Value).Days,
                    grp.SingleOrDefault(
                        v =>
                            v.Details.Any(d => d.IsMatch(interestPattern, Dir())))
                    ?? new() { Date = key, Details = new() });
        public CashFlowCalculation GetCashFlowData(int clientId, int planId, int riskProfileId)
        {
            _clientId      = clientId;
            _planId        = planId;
            _riskProfileId = riskProfileId;

            ClientPersonalInfo clientPersonalInfo = new ClientPersonalInfo();

            PersonalInformation personalInfo = clientPersonalInfo.Get(clientId);

            fillPersonalData(personalInfo);

            _riskProfileInfo = new RiskProfileInfo();

            PlannerAssumption plannerAssumption = new PlannerAssumptionInfo().GetAll(_planId);

            if (plannerAssumption != null)
            {
                fillCashFlowFromPlannerAssumption(plannerAssumption);
            }

            IList <Income>   incomes  = new IncomeInfo().GetAll(_planId);
            IList <Expenses> expenses = new ExpensesInfo().GetAll(_planId);
            IList <Loan>     loans    = new LoanInfo().GetAll(_planId);
            IList <Goals>    goals    = new GoalsInfo().GetAll(_planId);

            fillCashFlowFromIncomes(incomes);
            fillCashFlowFromExpenses(expenses);
            fillCashFlowFromLoans(loans);
            fillCashFlowFromGoals(goals);
            return(_cashFlow);
        }
        public async Task <IActionResult> Edit(Guid id, [Bind("PersonName,Amount,Remarks,ID")] LoanInfo loanInfo)
        {
            if (id != loanInfo.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(loanInfo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LoanInfoExists(loanInfo.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(loanInfo));
        }
예제 #14
0
        protected override void AddAllPaymentsAction()
        {
            DateTime payment_date = _entity.InicioPago;
            LoanInfo entity_info  = _entity.GetInfo();

            for (int i = 1; i <= _entity.NCuotas; i++)
            {
                Payment payment = _entity.Payments.GetItemByDueDate(payment_date);

                if (payment == null)
                {
                    payment = _entity.Payments.NewItem(entity_info, payment_date);
                    TransactionPayment transaction = payment.Operations.NewItem(payment, _entity, ETipoPago.Prestamo);
                    transaction.Cantidad = payment.Importe;
                }
                else if (payment.Vencimiento >= DateTime.Today)
                {
                    payment.SetCuota(entity_info);
                }

                payment.Observaciones = "PLAZO " + i + "/" + _entity.NCuotas;

                payment_date = payment_date.AddMonths(1);
            }

            UpdatePayments();
        }
예제 #15
0
        public void TestLoanPayment3()
        {
            var loanInfo = new LoanInfo()
            {
                Amortization           = "EqualPrincipalAndInterest",
                Coupon                 = 0.05,
                Currency               = "CNY",
                DayCount               = "B30360",
                FirstPaymentDate       = "20141209",
                FloatingRateMultiplier = 1,
                Frequency              = "Monthly",
                IndexType              = "Gjj5YAbove",
                IsFloatingRate         = false,
                MaturityDate           = "20441109",
                Notional               = 10000000.00,
                NumOfPayment           = 360,
                ResetDate              = "20150101",
                StartDate              = "20141109",
                MortgageCalcMethod     = "Simple",
                AbsPrepaymentModel     = "Psa",
                AbsDefaultModel        = "Sda",
                SdaMultiplier          = 1,
                PsaMultiplier          = 0
            };

            var market = new MarketInfo("testMarket", "20160202")
            {
                HistoricalIndexRates = new Dictionary <string, Dictionary <string, double> >
                {
                    { "Gjj5YAbove", new Dictionary <string, double> {
                          { "20140101", 0.0425 }
                      } },
                    { "Gjj5Y", new Dictionary <string, double> {
                          { "20150825", 0.0275 }
                      } }
                }
            };

            QdpMarket qdpMarket;

            MarketFunctions.BuildMarket(market, out qdpMarket);
            var loanVf = new LoanVf(loanInfo);

            var result = loanVf.ValueTrade(qdpMarket, PricingRequest.Cashflow);
            var cfs    = result.Cashflows;

            var p =
                cfs.Where(x => x.CashflowType == CashflowType.Principal || x.CashflowType == CashflowType.PrincipalLossOnDefault)
                .Sum(x => x.PaymentAmount);

            Assert.AreEqual(p, loanInfo.Notional, 1e-4);
            //Assert.AreEqual(Math.Round(cfs[8].PaymentAmount, 2), 12115.23);
            //Assert.AreEqual(Math.Round(cfs[9].PaymentAmount, 2), 41564.25);
            //Assert.AreEqual(Math.Round(cfs[11].PaymentAmount, 2), 498.30);

            //Assert.AreEqual(Math.Round(cfs[1435].PaymentAmount, 2), 1.28);
            //Assert.AreEqual(Math.Round(cfs[1436].PaymentAmount, 2), 51141.30);
            //Assert.AreEqual(Math.Round(cfs[1437].PaymentAmount, 2), 213.09);
        }
        public LoanInfo Add(LoanInfo loaninfo)
        {
            var sqlQuery   = "INSERT INTO LoanInfo (CUId, CustomerId, LTV, Rate, Term, ApprovalAmt, PreApprovExpirationDate, LoanDoc, Active) VALUES(@CUId, @CustomerId, @LTV, @Rate, @Term, @ApprovalAmt, @PreApprovExpirationDate, @LoanDoc, 1); " + "SELECT CAST(SCOPE_IDENTITY() as int)";
            var LoanInfoId = this._db.Query <int>(sqlQuery, loaninfo).Single();

            loaninfo.id = LoanInfoId;
            return(loaninfo);
        }
예제 #17
0
 public ActionResult Edit([Bind(Include = "id,CUId, CustomerId, LTV, Rate, Term, ApprovalAmt, PreApprovExpirationDate, LoanDoc")] LoanInfo loaninfo, int id)
 {
     if (ModelState.IsValid)
     {
         _dashboard.Update(loaninfo);
         return(RedirectToAction("Index"));
     }
     return(View(loaninfo));
 }
예제 #18
0
        protected override void SetRowFormat(DataGridViewRow row)
        {
            if (row.IsNewRow)
            {
                return;
            }

            LoanInfo item = (LoanInfo)row.DataBoundItem;

            Face.Common.ControlTools.Instance.SetRowColor(row, item.EEstado != moleQule.Base.EEstado.Anulado && item.CapitalPendiente == 0 ? moleQule.Base.EEstado.Pagado : item.EEstado);
        }
        public async Task <IActionResult> Create([Bind("PersonName,Amount,Remarks,ID")] LoanInfo loanInfo)
        {
            if (ModelState.IsValid)
            {
                loanInfo.ID = Guid.NewGuid();
                _context.Add(loanInfo);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(loanInfo));
        }
예제 #20
0
        public void Save_Click(object sender, AjaxEventArgs e)
        {
            string           workItemId = HWorkItemId.Value.ToString();
            IWorkflowSession wflsession = RuntimeContextExamples.GetRuntimeContext().getWorkflowSession();
            IWorkItem        wi         = wflsession.findWorkItemById(workItemId);
            String           sn         = (String)wi.TaskInstance.AliveProcessInstance.getProcessInstanceVariable("sn");
            LoanInfoDAO      lid        = new LoanInfoDAO();
            LoanInfo         loanInfo   = lid.findBySn(sn);

            loanInfo.SalaryIsReal      = Boolean.Parse(salaryIsReal.SelectedItem.Value);
            loanInfo.CreditStatus      = Boolean.Parse(creditStatus.SelectedItem.Value);
            loanInfo.RiskEvaluator     = riskEvaluator.Text;
            loanInfo.RiskInfoInputDate = DateTime.Parse(riskInfoInputDate.Text);


            //1、首先通过"收入状况是否属实"和"信用状况是否合格"这两项指标来设置RiskFlag流程变量
            if (loanInfo.SalaryIsReal && loanInfo.CreditStatus)
            {
                loanInfo.RiskFlag = false;//false表示风险评估通过
            }
            else
            {
                loanInfo.RiskFlag = true;//表示有风险
            }
            //2、将RiskFlag设置到流程变量
            try
            {
                wi.TaskInstance.AliveProcessInstance.setProcessInstanceVariable("RiskFlag", loanInfo.RiskFlag);
            }
            catch
            {
                throw;
            }

            //3、保存业务数据
            lid.attachDirty(loanInfo);
            try
            {
                if (wi != null)
                {
                    if (wi.ActorId == this.User.Identity.Name)
                    {
                        wi.complete(comments.Text);
                    }
                }
            }
            catch
            {
                throw;
            }
        }
예제 #21
0
        public JsonResult GetLoanData(string _accountno = null, string _loannumber = null)
        {
            Params param = new Params()
            {
                Parameter = new Dictionary <string, string>()
            };

            param.RequestTransType = "GetLoanInfoDetail";
            param.Parameter.Add("acctNo", _accountno);
            param.Parameter.Add("noteNo", _loannumber);
            LoanInfo loan = ProductInquiry.Loan(param);

            return(Json(loan, JsonRequestBehavior.AllowGet));
        }
예제 #22
0
        private static LoanInfo GetLoanInfo(PointUserLoginResults loginResult, string loanFileName)
        {
            LoanInfo loanInfo = null;

            DataFolderInfo dataFolder = loginResult.UserInfo.DataFolders.FirstOrDefault();

            GetLoanResults loanResults = dataFolder.GetLoans(SearchLoanType.Borrower, SearchByType.FileName, Calyx.Point.Data.DataFolderServices.SearchOption.MatchesWith, loanFileName, "");

            foreach (var loan in loanResults.Loans)
            {
                loanInfo = loan;
            }

            return(loanInfo);
        }
예제 #23
0
        protected void UnlinkLineAction(DataGridViewRow row)
        {
            if (row == null)
            {
                return;
            }

            LoanInfo item = row.DataBoundItem as LoanInfo;

            _entity.DeleteTransactionPayment(item);

            UpdateAllocated();

            MarkAsActiva(row);
        }
        public LoanInfo Update(LoanInfo loaninfo)
        {
            var sqlQuery =
                "UPDATE LoanInfo " +
                "SET CUId = @CUId, " +
                " CustomerId = @CustomerId, " +
                " LTV = @LTV, " +
                " Rate = @Rate, " +
                " Term = @Term, " +
                " ApprovalAmt = @ApprovalAmt, " +
                " PreApprovExpirationDate = @PreApprovExpirationDate, " +
                " LoanDoc = @LoanDoc " +
                "WHERE id = @id";

            this._db.Execute(sqlQuery, loaninfo);
            return(loaninfo);
        }
예제 #25
0
        private static void PutLoan(UpdateLoanRequest request)
        {
            try
            {
                PointUserLoginResults loginResult = CreateSession(request.userName, request.password);
                LoanInfo loanInfo = GetLoanInfo(loginResult, request.loanID);
                if (loanInfo != null)
                {
                    LoanFile loanFile = loanInfo.Open(false);
                    foreach (LoanField loanField in request.loanFields)
                    {
                        Bind_FieldID_Name();
                        int fieldID = GetFieldID(loanField.fieldName.ToLower().Trim());
                        if (fieldID > 0)
                        {
                            BorrowerSetPositionType positionType = (BorrowerSetPositionType)loanField.borrowerPosition;

                            loanFile.SetData(fieldID, BorrowerSetPositionType.Borrower, loanField.fieldValue);
                        }
                        else
                        {
                            OutputResult($"The field name : { loanField.fieldName } is invalid.");
                            return;
                        }
                    }

                    loanFile.Save();
                    loanFile.Close();
                    OutputResult($"Loan Updated Successfully With LoanFile Name : { loanFile.Info.Attributes.FileName}");
                }
                else
                {
                    string message = $"loanID : { request.loanID } is invalid or doesn't exists.";
                    OutputResult(message);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                CloseSession();
            }
        }
예제 #26
0
        protected override void EditLineAllocationAction(DataGridViewRow row)
        {
            InputDecimalForm form = new InputDecimalForm();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                LoanInfo item = row.DataBoundItem as LoanInfo;

                _deallocated += item.Asignado;

                _entity.EditTransactionPayment(item, form.Value);

                LinkLineAction(row);
                SetUnlinkedGridValues(Lineas_DGW.Name);
                Datos_Lineas.ResetBindings(false);
                SetGridColors(Lineas_DGW);
            }
        }
        protected override void GetFormSourceData(object[] parameters)
        {
            if (parameters[0] == null)
            {
                _loan   = (Loan)parameters[2];
                _entity = Payment.New(_loan.GetInfo(false));
                _entity.BeginEdit();
                _entity.Oid = -1;
                _loans      = LoanList.NewList(_loan);

                PaymentList pagos = PaymentList.GetListByPrestamo(_loans[0], false);

                _loans[0].TotalPagado = 0;
                _loans[0].Asignado    = 0;

                foreach (PaymentInfo pago in pagos)
                {
                    if (pago.EEstado == moleQule.Base.EEstado.Anulado)
                    {
                        continue;
                    }

                    _loans[0].TotalPagado += pago.Importe;
                }

                _loans[0].Pendiente        = _loans[0].Importe - _loans[0].TotalPagado;
                _loans[0].PendienteAsignar = _loans[0].Pendiente;
            }
            else
            {
                _entity = (Payment)parameters[0];
                _entity.BeginEdit();
                _entity.Oid = -1;
                _loans      = LoanList.GetPendientesList(_entity.GetInfo(false));
            }


            //Asociamos los gastos previamente vinculados
            foreach (TransactionPayment item in _entity.Operations)
            {
                LoanInfo prestamo = _loans.GetItem(item.OidOperation);
                prestamo.Vincula();
            }
        }
예제 #28
0
        protected override void GetFormSourceData(long oid, object[] parameters)
        {
            ETipoPago tipo = ETipoPago.Prestamo;

            if (parameters[1] != null)
            {
                _loan = (LoanInfo)parameters[1];
            }

            _entity  = PaymentInfo.Get(oid, tipo, true);
            _mf_type = ManagerFormType.MFView;


            _loans = _loan != null?
                     LoanList.NewList(_loan)
                         : LoanList.GetByPagoAndPendientesList(_entity);

            //if (_prestamo != null)
            {
                PaymentList pagos = PaymentList.GetListByPrestamo(_loans[0], false);

                TransactionPaymentInfo pf = _entity.Operations != null?_entity.Operations.GetItemByFactura(_loans[0].Oid) : null;

                if (pf != null)
                {
                    _loans[0].Asignado    = pf.Cantidad;
                    _loans[0].TotalPagado = 0;

                    foreach (PaymentInfo pago in pagos)
                    {
                        if (pago.EEstado == moleQule.Base.EEstado.Anulado)
                        {
                            continue;
                        }

                        _loans[0].TotalPagado += pago.Importe;
                    }
                }

                _loans[0].Pendiente        = _loans[0].Importe - _loans[0].TotalPagado + _loans[0].Asignado;
                _loans[0].PendienteAsignar = _loans[0].Pendiente - _loans[0].Asignado;
            }
        }
예제 #29
0
        private static void PostLoan(PostNewLoanRequest request)
        {
            try
            {
                PointUserLoginResults loginResult = CreateSession(request.userName, request.password);

                string loanFileName = Guid.NewGuid().ToString();

                DataFolderInfo dataFolder = loginResult.UserInfo.DataFolders.FirstOrDefault();
                if (dataFolder != null)
                {
                    LoanFile loanFile = LoanInfo.Create(Calyx.Point.Data.Common.LoanType.Borrower);
                    foreach (LoanField loanField in request.loanFields)
                    {
                        Bind_FieldID_Name();
                        int fieldID = GetFieldID(loanField.fieldName.ToLower().Trim());
                        if (fieldID > 0)
                        {
                            BorrowerSetPositionType positionType = (BorrowerSetPositionType)loanField.borrowerPosition;
                            loanFile.SetData(fieldID, BorrowerSetPositionType.Borrower, loanField.fieldValue);
                        }
                        else
                        {
                            OutputResult($"The field name : { loanField.fieldName } is invalid.");
                            return;
                        }
                    }

                    loanFile.Save(loanFileName, dataFolder);
                    loanFile.Close();
                    OutputResult($"Loan Created Successfully With LoanFile Name : { loanFile.Info.Attributes.FileName }");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                CloseSession();
            }
        }
예제 #30
0
        /// <summary>
        ///     计算利息
        /// </summary>
        /// <param name="info">借款信息</param>
        /// <param name="capitalIntegral">剩余本金</param>
        /// <param name="delta">间隔日数</param>
        /// <param name="voucher">记账凭证</param>
        /// <returns>利息</returns>
        private double SettleInterest(LoanInfo info, double capitalIntegral, int delta, Voucher voucher)
        {
            var interest = delta * info.Rate * capitalIntegral;
            var create = new List<VoucherDetail>
                {
                    info.AsInterest(this, interest),
                    info.AsMinor(this, -interest)
                };

            // ReSharper disable once PossibleInvalidOperationException
            var detail = voucher.Details.SingleOrDefault(d => d.IsMatch(info.AsInterest(this)));

            if (interest.IsZero())
            {
                if (detail != null)
                {
                    if (!voucher.Details.All(d => d.IsMatch(info.AsInterest(this)) || d.IsMatch(info.AsMinor(this))))
                        throw new ArgumentException("该记账凭证包含计息以外的细目", nameof(voucher));

                    Accountant.DeleteVoucher(voucher.ID);
                }

                return 0;
            }

            if (detail == null)
            {
                voucher.Details = create;
                Accountant.Upsert(voucher);
            }
            // ReSharper disable once PossibleInvalidOperationException
            else if (!(detail.Fund.Value - interest).IsZero())
            {
                if (!voucher.Details.All(d => d.IsMatch(info.AsInterest(this)) || d.IsMatch(info.AsMinor(this))))
                    throw new ArgumentException("该记账凭证包含计息以外的细目", nameof(voucher));

                voucher.Details = create;
                Accountant.Upsert(voucher);
            }

            return interest;
        }