Exemple #1
0
 public DailyTxnConverterBase2(PeriodRowVM periodRowVM)
 {
     _row      = periodRowVM;
     _rntDir   = _row.MainWindow.AppArgs;
     _rntCache = _row.MainWindow.RntCache;
     _byfCache = _row.MainWindow.ByfCache;
     _client   = _row.MainWindow.ByfServer.Client;
 }
Exemple #2
0
        protected override async void OnWindowLoaded()
        {
            RntCache.RefillFrom(AppArgs);
            await ByfServer.SetURL(Default.ServerURL);

            if (ByfServer.IsOnline)
            {
                await ByfCache.RefillFromServer(ByfServer);
            }
        }
Exemple #3
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),
            });
        }
Exemple #4
0
        protected override async Task OnRefreshClickedAsync()
        {
            if (PickedList == null)
            {
                return;
            }
            StartBeingBusy($"Loading {PickedListName} ...");
            await Task.Delay(1);

            await Task.Run(() =>
                           Parallel.Invoke(() => PickedList.ReloadList(),
                                           () => RntCache.RefillFrom(AppArgs)));

            StopBeingBusy();
        }
 public DailyTxnConverterBase(MainWindowVM mainWindowVM)
 {
     _rntDir   = mainWindowVM.AppArgs;
     _rntCache = mainWindowVM.RntCache;
     _byfCache = mainWindowVM.ByfCache;
 }
        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)
            });
        }
Exemple #7
0
        private static Dictionary <int, List <AccountAllocation> > GroupItemsByHeader(List <dynamic> byfItems, RntCache cache)
        {
            var dict = new Dictionary <int, List <AccountAllocation> >();

            foreach (var byf in byfItems)
            {
                var alloc = CastAsAllocation(byf, cache, out int headrId);

                if (!dict.TryGetValue(headrId, out List <AccountAllocation> list))
                {
                    dict[headrId] = list = new List <AccountAllocation>();
                }

                list.Add(alloc);
            }
            return(dict);
        }