protected override IntendedColxnDTO CastToDTO(dynamic byf) { var lseNid = (int)As.ID(byf.leasenid); var rntLease = _rntCache.LeaseById(lseNid, false); if (rntLease != null) { var secId = rntLease.Stall.Section.Id; _secCollectors[secId] = As.ID(byf.collectornid); } var actuals = new BillAmounts { Rent = As.Decimal(byf.rent) + As.Decimal(byf.surcharge), Rights = As.Decimal(byf.rights), Electric = As.Decimal(byf.electric), Water = As.Decimal(byf.water), }; return(new IntendedColxnDTO { Id = As.ID(byf.nid), PRNumber = As.ID(byf.prnumber), Actuals = actuals, Targets = actuals, Lease = rntLease, StallSnapshot = rntLease?.Stall, Remarks = As.Text(byf.remarks), }); }
private async Task <(List <LeaseBalanceRow> Rows, BillAmounts Totals)> GetRowsAndTotal() { BillAmounts total = null; List <LeaseBalanceRow> rows = null; await Task.Run(() => rows = AppArgs.Balances.GetOverdueLeases(out total, PickedSection)); return(rows.OrderByDescending(_ => _.Rent).ToList(), total); }
public void UpdateAll() { try { Overdues = _args.Balances.TotalOverdues(); } catch (Exception ex) { Alert.Show(ex, "Getting total overdues"); } }
protected override IntendedColxnDTO CastToDTO(dynamic byf) { var lseNid = (int)byf.LeaseNid; var rntLease = _rntCache.LeaseById(lseNid, false); var actuals = new BillAmounts { Rent = byf.Rent + byf.Surcharge, Rights = byf.Rights, Electric = byf.Electric, Water = byf.Water, }; return(new IntendedColxnDTO { Id = byf.nid, PRNumber = byf.PrNumber, Actuals = actuals, Targets = actuals, Lease = rntLease, StallSnapshot = rntLease?.Stall, Remarks = byf.Remarks, }); }
private List <LeaseBalanceRow> FilterOverdueLeases(int sectionId, out BillAmounts totals, DateTime?asOfDate = null) { var list = new List <LeaseBalanceRow>(); var mkt = GetMarketState(); var date = asOfDate ?? mkt.Collections.LastPostedDate(); foreach (var lse in mkt.ActiveLeases.GetAll()) { if (sectionId == 0 || lse.Stall.Section.Id == sectionId) { list.Add(GetBalance(lse, date)); } } var inactvs = GetInactiveLeases(mkt, date); foreach (var lse in inactvs) { if (sectionId == 0 || lse.Stall.Section.Id == sectionId) { list.Add(GetBalance(lse, null)); } } list.RemoveAll(_ => NoOverdue(_, date)); totals = new BillAmounts { Rent = list.Sum(_ => _.Rent.ZeroIfNullOrNegative()), Rights = list.Where(_ => IsRightsOverdue(_, date)) .Sum(_ => _.Rights.ZeroIfNullOrNegative()), Electric = list.Sum(_ => _.Electric.ZeroIfNullOrNegative()), Water = list.Sum(_ => _.Water.ZeroIfNullOrNegative()), }; return(list); }
public List <LeaseBalanceRow> GetOverdueLeases(out BillAmounts totals, SectionDTO section, DateTime?asOfDate = null) => FilterOverdueLeases(section.Id, out totals, asOfDate);
public List <LeaseBalanceRow> GetOverdueLeases(out BillAmounts totals, DateTime?asOfDate = null) => FilterOverdueLeases(0, out totals, asOfDate);