public void Process(IEnumerable <BankStmt> bankStmts, IEnumerable <FinAccount> accountMaps, IEnumerable <FinActivity> activityMaps)
        {
            var genLedgerFinActivityJoin = new List <GenLedgerFinActivityJoin>();

            foreach (BankStmt bsi in bankStmts)
            {
                // use the same Account Map for each Bank Statement Item
                var accountMap = accountMaps.FirstOrDefault(m => m.Account == bsi.Account);
                genLedgerFinActivityJoin.Clear();

                foreach (var activityMap in activityMaps)
                {
                    if (activityMap.FromActivity != bsi.Activity ||
                        !(activityMap.TargetObject == FinJournalTargetObject.BankStmt ||
                          activityMap.TargetObject == FinJournalTargetObject.All))
                    {
                        continue;
                    }

                    #region Create Journal Items
                    GenLedger activityGli = CreateActivityJournalItem(bsi, activityMap);
                    #endregion

                    #region Evaluate Amount

                    // Evaluate Amount Expression
                    var genLedgerKey = new GenLedgerKey()
                    {
                        FunctionalCcyAmt = EvalFunctionalCcyAmt(bsi, activityMap, genLedgerFinActivityJoin)
                    };
                    activityGli.FunctionalCcyAmt = genLedgerKey.FunctionalCcyAmt * -1.00M;

                    // Join GenLedger with FinActivity so you can get the sum of all previous GenLedger.FinActivity.Token
                    genLedgerFinActivityJoin.Add(new GenLedgerFinActivityJoin()
                    {
                        FinActivity = activityMap, GenLedgerKey = genLedgerKey
                    });

                    #endregion
                }
            }
        }
Exemplo n.º 2
0
        public void Process(IEnumerable <CashFlow> cashFlows, IEnumerable <FinAccount> accountMaps, IEnumerable <FinActivity> activityMaps)
        {
            var genLedgerFinActivityJoin = new List <GenLedgerFinActivityJoin>();

            foreach (CashFlow cf in cashFlows)
            {
                // use the same Account Map for each Bank Statement Item
                var accountMap = accountMaps.FirstOrDefault(m => m.Account == cf.Account);
                genLedgerFinActivityJoin.Clear();
                foreach (var activityMap in activityMaps)
                {
                    if (activityMap.FromActivity != cf.Activity ||
                        !(activityMap.TargetObject == FinJournalTargetObject.CashFlow ||
                          activityMap.TargetObject == FinJournalTargetObject.All))
                    {
                        continue;
                    }

                    GenLedger activityGli = CreateActivityJournalItem(cf, activityMap);

                    // Evaluate Amount Expression
                    var genLedgerKey = new GenLedgerKey()
                    {
                        FunctionalCcyAmt =
                            EvalFunctionalCcyAmt(cf, activityMap, genLedgerFinActivityJoin) /* TODO: may be zero*/
                    };
                    activityGli.FunctionalCcyAmt = genLedgerKey.FunctionalCcyAmt * -1.00M;

                    // Join GenLedger with FinActivity so you can get the sum of all previous GenLedger.FinActivity.Token
                    // we use accountGli as the FunctionCcyAmt's sign is not reversed like in actvitiyGli
                    genLedgerFinActivityJoin.Add(new GenLedgerFinActivityJoin()
                    {
                        FinActivity = activityMap, GenLedgerKey = genLedgerKey
                    });
                }
            }
        }