Exemplo n.º 1
0
 private void AddNewItem(string amtType, decimal multiplier)
 {
     if (!PopUpInput.TryGetIndex($"GL Account ({amtType})", out int index, _accts))
     {
         return;
     }
     if (!PopUpInput.TryGetDecimal($"{amtType} Amount", out decimal amount, GetSuggestedAmount()))
     {
         return;
     }
     Items.Add(new AllocationVM(_accts[index], amount * multiplier));
 }
Exemplo n.º 2
0
        private void AllocationsListVM_ItemOpened(object sender, AccountAllocation e)
        {
            var oldIndx = _glAccts.FindIndex(_ => _.Id == e.Account.Id);

            if (!PopUpInput.TryGetIndex("GL Account",
                                        out int newIndx, _glAccts, oldIndx))
            {
                return;
            }

            if (!PopUpInput.TryGetDecimal("Amount",
                                          out decimal amt, Math.Abs(e.SubAmount), allowZero: false))
            {
                return;
            }

            e.Account   = _glAccts[newIndx];
            e.SubAmount = amt * (e.IsDebit ? -1M : 1M);

            UpdateUILists();
        }
Exemplo n.º 3
0
        private void AddEntry(decimal multiplier)
        {
            var typ = multiplier < 0 ? "Debit" : "Credit";

            if (!PopUpInput.TryGetIndex($"GL Account for {typ}",
                                        out int idx, _glAccts))
            {
                return;
            }

            if (!PopUpInput.TryGetDecimal($"{typ} Amount",
                                          out decimal amt, allowZero: false))
            {
                return;
            }

            _list.Add(AccountAllocation
                      .NewItem(_glAccts[idx], amt, multiplier));

            UpdateUILists();
        }