public ForexSettleFifoAlgorithm(XPObjectSpace objSpace, ForexSettleFifoParam paramObj)
        {
            this.objSpace = objSpace;
            this.paramObj = paramObj;

            if (paramObj.FromDate <= SqlDateTime.MinValue.Value)
            {
                this.fromDate = SqlDateTime.MinValue.Value;
            }
            else
            {
                this.fromDate = paramObj.FromDate;
            }

            if (paramObj.ToDate <= SqlDateTime.MinValue.Value)
            {
                this.toDate = SqlDateTime.MaxValue.Value;
            }
            else
            {
                this.toDate = paramObj.ToDate;
            }

            this.currentSnapshot = CashFlowHelper.GetCurrentSnapshot(objSpace.Session);
        }
Beispiel #2
0
        public override CompileResult Execute(IEnumerable <FunctionArgument> arguments, ParsingContext context)
        {
            ValidateArguments(arguments, 2);
            var rate = ArgToDecimal(arguments, 0);
            var nPer = ArgToDecimal(arguments, 1);
            var pmt  = 0d;

            if (arguments.Count() >= 3)
            {
                pmt = ArgToDecimal(arguments, 2);
            }
            var fv = 0d;

            if (arguments.Count() >= 4)
            {
                fv = ArgToDecimal(arguments, 3);
            }
            var type = 0;

            if (arguments.Count() >= 5)
            {
                type = ArgToInt(arguments, 4);
            }
            var retVal = CashFlowHelper.Pv(rate, nPer, pmt, fv, (PmtDue)type);

            return(CreateResult(retVal, DataType.Decimal));
        }
Beispiel #3
0
        public override CompileResult Execute(IEnumerable <FunctionArgument> arguments, ParsingContext context)
        {
            ValidateArguments(arguments, 2);
            var rate   = ArgToDecimal(arguments, 0);
            var args   = ArgsToDoubleEnumerable(false, true, arguments, context).ToList();
            var retVal = CashFlowHelper.Npv(rate, args.Skip(1).Select(x => (double)x));

            return(CreateResult(retVal, DataType.Decimal));
        }
Beispiel #4
0
 public static DateTime GetMaxActualTranDate(Session session)
 {
     return(CashFlowHelper.GetMaxActualTranDate(session));
 }