Пример #1
0
 public void AddCreditInsuranceEvent(CreditInsuranceEvent pEvent, SqlTransaction pSqlTransac)
 {
     const string q = @"
                 INSERT INTO [dbo].[CreditInsuranceEvents]
                ([id]
                ,[commission]
                 ,[principal])
                  VALUES
                (@id
                ,@commission
                ,@principal)";
     using (OpenCbsCommand c = new OpenCbsCommand(q, pSqlTransac.Connection, pSqlTransac))
     {
         SetCreditInsuranceEvent(pEvent, c);
         c.ExecuteNonQuery();
     }
 }
Пример #2
0
 private void CreditInsuranceOrigination(CreditInsuranceEvent insuranceEvent, Loan contract, SqlTransaction sqlTransaction)
 {
     insuranceEvent.Id =
         _eventManagement.AddLoanEventHead(insuranceEvent, contract.Id, sqlTransaction);
     _eventManagement.AddCreditInsuranceEvent(insuranceEvent, sqlTransaction);
 }
Пример #3
0
 private CreditInsuranceEvent GetCreditInsuranceEvent(LoanDisbursmentEvent disbursmentEvent)
 {
     CreditInsuranceEvent cie = new CreditInsuranceEvent
                                    {
                                        Date = disbursmentEvent.Date,
                                        Cancelable = true,
                                        User = User.CurrentUser,
                                        Code = "LCIE",
                                        Principal = 0,
                                        Commission = Amount * Insurance / 100,
                                        TellerId = disbursmentEvent.TellerId
                                    };
     return cie;
 }
Пример #4
0
        public CreditInsuranceEvent GenerateCreditInsuranceEventForWriteOff(DateTime onDate)
        {
            if (Insurance == 0) return null;
            //lciw ~ Loan Credit Insurance write-off
            CreditInsuranceEvent cieOrigination = Events.GetCreditInsuranceEvent();

            CreditInsuranceEvent lciw = new CreditInsuranceEvent
                                            {
                                                User = User.CurrentUser,
                                                Date = onDate,
                                                Principal = 0,
                                                Cancelable = true,
                                                Code = "LCIW",
                                                Commission = cieOrigination != null ? cieOrigination.Commission : 0
                                            };

            return lciw;
        }
Пример #5
0
        public CreditInsuranceEvent GenerateCreditInsuranceEvent(int installmentNumber)
        {
            foreach (RepaymentEvent item in Events.GetRepaymentEvents())
            {
                if (item.Code == "ATR" && item.Deleted == false && Insurance != 0)
                {
                    installmentNumber = item.InstallmentNumber - installmentNumber;
                }
            }

            decimal sumOfInstallations = 0;

            for (int i = 1; i <= InstallmentList.Count; i++)
                sumOfInstallations += i;

            decimal sumOfNotPaidInstallations = 0;

            for (int i = InstallmentList.Count - installmentNumber + 1; i <= InstallmentList.Count; i++)
            {
                sumOfNotPaidInstallations += i;
            }

            CreditInsuranceEvent cieOrigination = Events.GetCreditInsuranceEvent();
            OCurrency insuranceAmount = 0;

            if (cieOrigination != null)
                insuranceAmount = cieOrigination.Commission.Value;

            int roundPoint = UseCents ? 2 : 0;
            OCurrency earnedPremiumCurrencyValue =
                Math.Round(insuranceAmount.Value * sumOfNotPaidInstallations / sumOfInstallations, roundPoint,
                           MidpointRounding.AwayFromZero);

            OCurrency sumToRefund = Math.Round(insuranceAmount.Value - earnedPremiumCurrencyValue.Value, roundPoint,
                                               MidpointRounding.AwayFromZero);

            CreditInsuranceEvent creditInsuranceEvent = new CreditInsuranceEvent
                                                 {
                                                     Code = "LCIP",
                                                     User = User.CurrentUser,
                                                     Commission = earnedPremiumCurrencyValue,
                                                     Principal = sumToRefund,
                                                     Cancelable = true,
                                                     TellerId = Teller.CurrentTeller.Id
                                                 };
            return creditInsuranceEvent;
        }
Пример #6
0
 private void SetCreditInsuranceEvent(CreditInsuranceEvent pEvent, OpenCbsCommand c)
 {
     c.AddParam("@id", pEvent.Id);
     c.AddParam("@commission", pEvent.Commission.Value);
     c.AddParam("@principal", pEvent.Principal.Value);
 }
Пример #7
0
 private static Event GetCreditInsuranceEvent(OpenCbsReader r)
 {
     CreditInsuranceEvent cie = new CreditInsuranceEvent();
     cie.Id = r.GetInt("cie_id");
     cie.Commission = r.GetDecimal("cie_commission");
     cie.Principal = r.GetDecimal("cie_principal");
     return cie;
 }
Пример #8
0
        private static OCurrency GetValue(CreditInsuranceEvent eventItem, ContractAccountingRule rule)
        {
            OCurrency amount = 0;

            if (rule.EventAttribute.Name.ToLower() == "principal")
            {
                amount = eventItem.Principal;
            }

            if (rule.EventAttribute.Name.ToLower() == "commission")
            {
                amount = eventItem.Commission;
            }
            return amount;
        }