Example #1
0
        private static AccountAllocation CastAsAllocation(dynamic byf, RntCache cache, out int headrId)
        {
            headrId = As.ID(byf.headernid);
            var absAmt   = As.Decimal(byf.amount);
            var isCredit = As.Bool_(byf.cr_dr) ?? false;

            return(new AccountAllocation
            {
                Account = cache.GLAcctById(As.ID(byf.glaccountnid)),
                SubAmount = absAmt * (isCredit ? 1M : -1M),
            });
        }
        private static (int HeaderId, AccountAllocation Allocation) CastAsAllocation(dynamic byf, RntCache cache)
        {
            var hdrId    = As.ID_(byf.parentnid) ?? 0;
            var isCredit = (int)As.ID(byf.cr_dr) == 1;
            var absAmt   = (decimal)As.Decimal(byf.amount);
            var glAcctId = As.ID(byf.glaccountnid);

            return(hdrId, new AccountAllocation
            {
                SubAmount = absAmt * (isCredit ? 1M : -1M),
                Account = cache.GLAcctById(glAcctId)
            });
        }