internal void PayoffInstalment(Account account, Guid instrumentId, DateTime tradeDay, Dictionary <DateTime, TradeDayInfo> tradeDayDataDict)
 {
     foreach (var eachInstalmentParam in this.GetInstalmentParams(account, instrumentId, tradeDay, tradeDayDataDict))
     {
         InstalmentManager instalmentManager = new InstalmentManager(eachInstalmentParam);
         instalmentManager.Payoff();
     }
 }
Exemplo n.º 2
0
            private static void GenerateInstalmentDetails(PhysicalOrder order, int remainPeriod, int minSequence, bool isPayForInstalmentDebitInterest, DateTime tradeDay)
            {
                var lastInstalmentPolicyDetailModel = DBRepository.Default.GetLastInstalmentPolicyDetail(order.Owner.ExecuteTime.Value);
                var instalmentPolicyDetail          = lastInstalmentPolicyDetailModel == null?order.Instalment.InstalmentPolicyDetail(null) : new Settings.InstalmentPolicyDetail(lastInstalmentPolicyDetailModel);

                decimal instalmentAmount = order.PhysicalOriginValueBalance - Math.Abs(order.PaidPledgeBalance);

                order.GenerateInstalmentDetails(instalmentPolicyDetail, instalmentAmount, remainPeriod, tradeDay, minSequence);
                var instrument       = order.Owner.SettingInstrument();
                var account          = order.Owner.Owner;
                int currencyDecimals = account.IsMultiCurrency ? Settings.Setting.Default.GetCurrency(instrument.CurrencyId, tradeDay).Decimals : account.Setting(tradeDay).Currency(tradeDay).Decimals;

                foreach (var eachInstalmentDetail in order.InstalmentDetails)
                {
                    if (isPayForInstalmentDebitInterest)
                    {
                        eachInstalmentDetail.DebitInterest = InstalmentManager.CalculateDebitInterest(eachInstalmentDetail.Principal, eachInstalmentDetail.Interest, DateTime.Now.Date.GetDateDiff(eachInstalmentDetail.PaymentDateTimeOnPlan.Value), instalmentPolicyDetail.InterestRate,
                                                                                                      instalmentPolicyDetail.DebitInterestType, instalmentPolicyDetail.DebitInterestRatio, instalmentPolicyDetail.DebitFreeDays, instrument.InterestYearDays, currencyDecimals);
                    }
                }
            }
Exemplo n.º 3
0
        private static void UpdateInstalmentOrderDebitInterest(Transaction tran, Settings.Setting setting, DateTime?tradeDay)
        {
            if (!tran.IsPhysical)
            {
                return;
            }
            DateTime lastTradeDay = DateTime.Now.Date;
            int      currencyDecimals;

            if (tran.Owner.IsMultiCurrency)
            {
                var currency = setting.GetCurrency(tran.CurrencyId);
                currencyDecimals = currency.Decimals;
            }
            else
            {
                currencyDecimals = tran.Owner.Setting(tradeDay).Currency(tradeDay).Decimals;
            }
            foreach (var eachOrder in tran.Orders)
            {
                Physical.PhysicalOrder physicalOrder = (Physical.PhysicalOrder)eachOrder;
                if (physicalOrder.Instalment == null)
                {
                    return;
                }
                var instalmentPolicyDetail = physicalOrder.Instalment.InstalmentPolicyDetail(null);
                foreach (var eachInstalmentDetail in physicalOrder.Instalment.InstalmentDetails)
                {
                    if (eachInstalmentDetail.PaymentDateTimeOnPlan >= lastTradeDay)
                    {
                        continue;
                    }
                    eachInstalmentDetail.DebitInterest = InstalmentManager.CalculateDebitInterest(eachInstalmentDetail.Principal,
                                                                                                  eachInstalmentDetail.Interest, (lastTradeDay - eachInstalmentDetail.PaymentDateTimeOnPlan.Value).Days,
                                                                                                  instalmentPolicyDetail.InterestRate, instalmentPolicyDetail.DebitInterestType,
                                                                                                  instalmentPolicyDetail.DebitInterestRatio, instalmentPolicyDetail.DebitFreeDays, tran.SettingInstrument().InterestYearDays, currencyDecimals);
                }
            }
        }
        internal void PayoffInstalment(Account account, Guid instrumentId, DateTime tradeDay, TradeDayInfo tradeDayInfo)
        {
            InstalmentManager instalmentManager = new InstalmentManager(this.GetInstalmentParam(account, tradeDay, tradeDayInfo));

            instalmentManager.Payoff();
        }