private static int GetBankAcctId(FundRequestDTO hdr, MainWindowVM2 main)
        {
            var cache = main.ByfCache;

            foreach (var row in hdr.Allocations)
            {
                //if (row.IsDebit) continue;
                var glAcct    = row.Account.Id;
                var bnkAcctId = cache.BankAcctByGlAcct.GetOrDefault(glAcct);
                if (bnkAcctId != 0)
                {
                    return(bnkAcctId);
                }
            }
            //throw Bad.Data($"No valid bank acct row from voucher items [hdr:{hdr.Id}].");
            return(0);
        }
Ejemplo n.º 2
0
        public static BillAmounts GetBalances(this MainWindowVM2 main, LeaseDTO lse)
        {
            var dir       = main.AppArgs;
            var repo      = dir.Balances.GetRepo(lse.Id);
            var lastPostd = main.ByfServer.LastPostedDate;
            var rowId     = lastPostd.DaysSinceMin();
            var row       = repo.Find(rowId, false);

            if (row == null)
            {
                return(null);
            }
            return(new BillAmounts
            {
                Rent = row.For(BillCode.Rent)?.ClosingBalance,
                Rights = row.For(BillCode.Rights)?.ClosingBalance,
            });
        }
Ejemplo n.º 3
0
 public MemosByDateListVM(MainWindowVM2 mainWindowVM2)
 {
     MainWindow = mainWindowVM2;
     MainWindow.ByfServer.GotMinMaxDates += ByfServer_GotMinMaxDates;
 }
        private static List <ChequeVoucherDTO> CastAsAllByfs(List <dynamic> byfHeadrs, List <dynamic> byfItems, MainWindowVM2 main)
        {
            var headrsDict = byfHeadrs.Select(_ => (ChequeVoucherDTO)CastAsCheckDTO(_, main.ByfCache))
                             .ToDictionary(_ => _.Id);

            var itemsList = byfItems.Select(_ => CastAsAllocation(_, main.RntCache)).ToList();

            foreach ((int HeaderId, AccountAllocation Allocation)tupl in itemsList)
            {
                if (tupl.HeaderId == 0)
                {
                    continue;
                }
                headrsDict[tupl.HeaderId].Request.Allocations.Add(tupl.Allocation);
            }

            foreach (var hdr in headrsDict.Values)
            {
                hdr.Request.BankAccountId = GetBankAcctId(hdr.Request, main);
            }

            return(headrsDict.Values
                   .Where(_ => _.Request.BankAccountId != 0)
                   .ToList());
        }
Ejemplo n.º 5
0
        private static List <JournalVoucherDTO> CastAsAllByfs(List <dynamic> byfHeadrs, List <dynamic> byfItems, MainWindowVM2 main)
        {
            var headrs    = byfHeadrs.Select(_ => (JournalVoucherDTO)CastAsVoucherDTO(_)).ToList();
            var itemsDict = GroupItemsByHeader(byfItems, main.RntCache);

            foreach (var kvp in itemsDict)
            {
                var headr = headrs.SingleOrDefault(_ => _.Id == kvp.Key);
                if (headr == null)
                {
                    throw No.Match <JournalVoucherDTO>("Id", kvp.Key);
                }

                if (!headr.IsBalanced)
                {
                    throw Bad.State <JournalVoucherDTO>("balanced", "not balanced");
                }

                headr.Allocations = kvp.Value;
                headr.Amount      = headr.TotalCredit;
            }
            return(headrs);
        }
Ejemplo n.º 6
0
 public LeasesListVM(MainWindowVM2 mainWindowVM2)
 {
     MainWindow       = mainWindowVM2;
     this.ItemOpened += (s, e)
                        => SoaViewer.Show(e.Lease, MainWindow.AppArgs);
 }
Ejemplo n.º 7
0
 public SectionConverter2(MainWindowVM2 mainWindowVM2) : base(mainWindowVM2)
 {
 }
Ejemplo n.º 8
0
 public CollectorConverter2(MainWindowVM2 mainWindowVM2) : base(mainWindowVM2)
 {
 }
Ejemplo n.º 9
0
 public BalanceAdjConverter1(LeaseDTO lease, MainWindowVM2 mainWindowVM2) : base(mainWindowVM2)
 {
     _lse = lease;
 }
Ejemplo n.º 10
0
 public PeriodsListVM(MainWindowVM2 mainWindowVM2)
 {
     MainWindow = mainWindowVM2;
 }
Ejemplo n.º 11
0
 public BankMemosPaneVM(MainWindowVM2 mainWindowVM2)
 {
     Rows      = new MemosByDateListVM(mainWindowVM2);
     ToggleCmd = R2Command.Relay(ToggleRun, null, "Run");
     ToggleCmd.UpdateLabelOnRun = false;
 }
Ejemplo n.º 12
0
 public static IR2Command CreateADTPBCmd(this MainWindowVM2 main)
 => R2Command.Async(() => RemediateAll(main), null, "Add Deposits to Passbook");
Ejemplo n.º 13
0
 public CheckVouchersPaneVM(MainWindowVM2 mainWindowVM2)
 {
     Rows      = new CVsByDateListVM(mainWindowVM2);
     ToggleCmd = R2Command.Relay(ToggleRun, null, "Run");
     ToggleCmd.UpdateLabelOnRun = false;
 }
Ejemplo n.º 14
0
 public GLAccountConverter2(MainWindowVM2 mainWindowVM2) : base(mainWindowVM2)
 {
 }
Ejemplo n.º 15
0
 public LeaseConverter2(MainWindowVM2 mainWindowVM2) : base(mainWindowVM2)
 {
 }
Ejemplo n.º 16
0
 public MasterDataPaneVM(MainWindowVM2 main)
 {
     Converters = new ConvertersListVM(main);
 }
Ejemplo n.º 17
0
 public StallConverter2(MainWindowVM2 mainWindowVM2) : base(mainWindowVM2)
 {
     _lses = Main.AppArgs.MarketState.GetAllLeases();
 }