示例#1
0
        private static void RebuildSoaFor(LeaseDTO lse, DateTime minDate, ITenantDBsDir dir)
        {
            var repo = dir.Balances.GetRepo(lse);

            DeleteRowsEarlierThan(minDate, repo);
            repo.RecomputeFrom(minDate);
        }
示例#2
0
        private static void ZeroOutRentBalances(ITenantDBsDir dir)
        {
            //var adjs = (dir.Collections.For      (terminationDate)
            //         ?? dir.Collections.CreateFor(terminationDate))
            //        .BalanceAdjs;

            var inactvs = dir.MarketState.InactiveLeases.GetAll();

            foreach (var lse in inactvs)
            {
                var bill   = dir.Balances.GetRepo(lse.Id)?.Latest();
                var endBal = bill?.For(BillCode.Rent)?.ClosingBalance ?? 0;
                if (endBal == 0)
                {
                    continue;
                }

                var adjs = dir.Collections.For(bill.GetBillDate())
                           .BalanceAdjs;

                adjs.Insert(new BalanceAdjustmentDTO
                {
                    DocumentRef  = "[system-auto]",
                    Reason       = "Market Renovation",
                    LeaseId      = lse.Id,
                    BillCode     = BillCode.Rent,
                    AmountOffset = endBal * -1,
                });
            }
        }
示例#3
0
        public SectionColxnsRow(SectionDTO sec, DateTime date, ITenantDBsDir dir)
        {
            Section   = sec;
            ColxnDate = date;
            var db = dir.Collections.For(date);

            Collector = GetSectionCollector(sec, db);
            var colxns = GetLeaseColxns(sec, date, db, dir);

            Rent     = colxns.Sum(_ => _.Rent ?? 0);
            Rights   = colxns.Sum(_ => _.Rights ?? 0);
            Electric = colxns.Sum(_ => _.Electric ?? 0);
            Water    = colxns.Sum(_ => _.Water ?? 0);
            Ambulant = colxns.Sum(_ => _.Ambulant ?? 0);

            Details.SetItems(colxns);
            Details.SetSummary(new LeaseColxnRow()
            {
                Rent     = Rent,
                Rights   = Rights,
                Electric = Electric,
                Water    = Water,
                Ambulant = Ambulant,
            });
        }
示例#4
0
        public MainWindowVM(DateTime unclosedDate, ITenantDBsDir tenantDBsDir, bool clickRefresh = true) : base(tenantDBsDir)
        {
            Date      = unclosedDate;
            CanReview = AppArgs.CanPostAndClose(false);
            CanEncode = AppArgs.CanEncodeCollections(false);
            if (!IsPrivilegedUser())
            {
                return;
            }

            ColxnsDB = CheckIfDbExists(Date);
            if (ColxnsDB == null)
            {
                return;
            }

            SectionTabs     = new TabsListVM(this);
            CashierColxns   = new CashierColxnsVM(this);
            OtherColxns     = new OtherColxnsVM(this);
            BankDeposits    = new BankDepositsVM(this);
            ApprovalAwaiter = new ApprovalRequesterVM(this);
            PostAndClose    = new PostAndCloseVM(this);
            NextDayOpener   = new NextDayOpenerVM(this);

            if (clickRefresh)
            {
                ClickRefresh();
            }
            SetCaption("");
        }
示例#5
0
        public static List <Action> GetActions(ICollectionsDB colxnsDB, ITenantDBsDir dir, string postedBy)
        {
            var jobs = new List <Action>();

            jobs.Add(() => colxnsDB.MarkAsPosted(postedBy));

            return(jobs);
        }
示例#6
0
        private static string GetInactivesDir(ITenantDBsDir dir)
        {
            var mktDir  = Path.GetDirectoryName(dir.MarketState.DatabasePath);
            var dirPath = Path.Combine(mktDir, DIR_NAME);

            Directory.CreateDirectory(dirPath);
            return(dirPath);
        }
示例#7
0
 public CollectionsLocalDir(ITenantDBsDir tenantDBsDir)
 {
     _dir = tenantDBsDir;
     _mkt = _dir.MarketState;
     //_mkt             = marketStateDB;
     _foldrPath       = FindCollectionsDir(_mkt.DatabasePath);
     _mkt.Collections = this;
 }
示例#8
0
 public PrintPreviewWindowVM(ChequeVoucherDTO dto, ITenantDBsDir dir) //: base(dto, dir)
 {
     AppArgs     = dir;
     CurrentItem = dto;
     AllocationTotals.SetItems(GetAllocationsSummary(dto));
     ReviewerName = Default.ReviewerName;
     ApproverName = Default.ApproverName;
 }
示例#9
0
 public BalancesLocalDir(ITenantDBsDir tenantDBsDir)
 {
     _dir = tenantDBsDir;
     _mkt = _dir.MarketState;
     //_mkt = marketStateDB;
     _foldrPath    = FindBalancesDir(_mkt.DatabasePath);
     _mkt.Balances = this;
 }
示例#10
0
 public static void Show(LeaseDTO lse, ITenantDBsDir args)
 {
     if (lse == null || args == null)
     {
         return;
     }
     new SoaViewerVM(lse, args).Show <SoaViewerWindow>();
 }
示例#11
0
 public DailyTxnConverterBase2(PeriodRowVM periodRowVM)
 {
     _row      = periodRowVM;
     _rntDir   = _row.MainWindow.AppArgs;
     _rntCache = _row.MainWindow.RntCache;
     _byfCache = _row.MainWindow.ByfCache;
     _client   = _row.MainWindow.ByfServer.Client;
 }
示例#12
0
 public static void DecommissionOldStalls
     (ITenantDBsDir dir, int oldSectionsMaxId, DateTime terminationDate)
 {
     dir.Credentials.HumanName = "AdHoc Admin";
     TerminateOldLeases(dir, oldSectionsMaxId, terminationDate);
     ZeroOutRentBalances(dir);
     MarkOldStallsAsNonOperational(dir, oldSectionsMaxId);
     MarkNewStallsAsOperational(dir, oldSectionsMaxId);
 }
示例#13
0
        private BalanceAdjustmentDTO FindRntDTO(BalanceAdjConverter1 conv, ITenantDBsDir dir, out DateTime date)
        {
            date = conv._adjDates[Id];
            var colxns = dir.Collections.For(date);

            _repo = colxns?.BalanceAdjs;
            return(_repo?.Find(Id, false));
            //return _repo?.GetAll().SingleOrDefault(_ => _.Id == Id);
        }
示例#14
0
        private static string GetInactiveRequestsPath(ITenantDBsDir dir)
        {
            var dbPath = Path.Combine(GetInactivesDir(dir), REQUESTS_FILE);

            //if (!File.Exists(dbPath))
            //    throw Missing.File(dbPath, "Inactive Requests DB file");

            return(dbPath);
        }
示例#15
0
        private void FillMainList(ITenantDBsDir dir)
        {
            this.Clear();

            foreach (var date in StartDate.EachDayUpTo(EndDate))
            {
                this.Add(new DailyColxnsReport(date, dir));
            }
        }
示例#16
0
        public void RefillFrom(ITenantDBsDir dir)
        {
            var mkt = dir.MarketState;

            _lsesById      = mkt.GetAllLeases().ToDictionary(_ => _.Id);
            _bankAcctsById = mkt.BankAccounts.GetAll().ToDictionary(_ => _.Id);
            _colctrsById   = mkt.Collectors.GetAll().ToDictionary(_ => _.Id);
            _glAcctsById   = mkt.GLAccounts.GetAll().ToDictionary(_ => _.Id);
        }
示例#17
0
        public AdHocJobCmdsVM(MainWindowVM mainWindowVM)
        {
            _main = mainWindowVM;
            _dir  = _main.AppArgs;

            AdHocJobCmd1 = R2Command.Relay(_ => RunAdHoc(1), _ => _dir.CanRunAdHocTask(false), "Run Ad Hoc Command 1");
            AdHocJobCmd2 = R2Command.Relay(_ => RunAdHoc(2), _ => _dir.CanRunAdHocTask(false), "Run Ad Hoc Command 2");
            AdHocJobCmd3 = R2Command.Relay(_ => RunAdHoc(3), _ => _dir.CanRunAdHocTask(false), "Run Ad Hoc Command 3");
        }
示例#18
0
 public AllActiveLeasesVM(MainWindowVM main, ITenantDBsDir dir) : base(main, dir)
 {
     AddStallToTenantCmd   = LeaseCRUD1VM.GetAddStallToTenantCmd(this);
     EditThisLeaseCmd      = LeaseCRUD1VM.GetEditThisLeaseCmd(this);
     EditTenantInfoCmd     = LeaseCRUD1VM.GetEditTenantInfoCmd(this);
     TerminateThisLeaseCmd = LeaseCRUD1VM.GetTerminateThisLeaseCmd(this);
     AdhocLeaseJobCmd1     = AdhocLeaseJobs.CreateLeaseJobCmd(1, this);
     AdhocLeaseJobCmd2     = AdhocLeaseJobs.CreateLeaseJobCmd(2, this);
     AdhocLeaseJobCmd3     = AdhocLeaseJobs.CreateLeaseJobCmd(3, this);
 }
示例#19
0
 public static Action FixBDO1ImportBug(ITenantDBsDir dir, out string jobDesc)
 {
     jobDesc = "Fix BDO-1 Import Bug";
     return(() =>
     {
         ProcessRequests(dir.Vouchers.PreparedCheques);
         ProcessRequests(dir.Vouchers.ActiveRequests);
         ProcessRequests(dir.Vouchers.InactiveRequests);
     });
 }
示例#20
0
 public MainWindowVM(ITenantDBsDir tenantDBsDir) : base(tenantDBsDir)
 {
     DailyTxns = new DailyTransactionsVM(this);
     Enlist("Leases", () => new LeaseConverter1(this));
     Enlist("Stalls", () => new StallConverter1(this));
     Enlist("Sections", () => new SectionConverter1(this));
     Enlist("Collectors", () => new CollectorConverter1(this));
     Enlist("Bank Accts", () => new BankAccountConverter1(this));
     Enlist("GL Accts", () => new GLAccountConverter1(this));
 }
示例#21
0
 public AllInactiveLeasesVM(MainWindowVM main, ITenantDBsDir dir) : base(main, dir)
 {
     AddStallToTenantCmd   = LeaseCRUD1VM.GetAddStallToTenantCmd(this);
     RenewInactiveLeaseCmd = LeaseCRUD1VM.GetRenewInactiveLeaseCmd(this);
     UndoTerminationCmd    = R2Command.Relay(UndoTermination,
                                             _ => AppArgs.CanUndoLeaseTermination(false),
                                             "Undo Lease Termination");
     RebuildSoaCmd = R2Command.Async(RebuildSoA, _ => AppArgs.CanRunAdHocTask(false),
                                     "Rebuild Statement of Account");
 }
示例#22
0
 public static Action SetYearsBack_1(ITenantDBsDir dir,
                                     out string jobDesc, out bool canRun)
 {
     canRun  = dir.CanRunAdHocTask(false);
     jobDesc = "Set YearsBackCount to [1]";
     return(() =>
     {
         dir.MarketState.YearsBackCount = 1;
     });
 }
示例#23
0
 public AdHocJobCmdsVM(MainWindowVM mainWindowVM)
 {
     _main        = mainWindowVM;
     _dir         = _main.AppArgs;
     AdHocJobCmd1 = R2Command.Relay(_ => RunAdHoc(1), null, "Run Ad Hoc Command 1");
     AdHocJobCmd2 = R2Command.Relay(_ => RunAdHoc(2), null, "Run Ad Hoc Command 2");
     AdHocJobCmd3 = R2Command.Relay(_ => RunAdHoc(3), null, "Run Ad Hoc Command 3");
     AdHocJobCmd4 = R2Command.Relay(_ => RunAdHoc(4), null, "Run Ad Hoc Command 4");
     AdHocJobCmd5 = R2Command.Relay(_ => RunAdHoc(5), null, "Run Ad Hoc Command 5");
 }
示例#24
0
 public MainToolbarVM(MainWindowVM mainWindowVM)
 {
     _main = mainWindowVM;
     _args = _main.AppArgs;
     WithOverduesReportCmd = WithOverduesReport.CreateLauncherCmd(_args);
     PrintCurrentListCmd   = R2Command.Relay(PrintCurrentList, null, "Print Current List");
     ExportListToExcelCmd  = R2Command.Relay(ExportListToExcel, null, "Export List to Excel");
     //RunAdHocTask1Cmd      = R2Command.Relay(_ => RunAdHocTask(1), _ => _args.CanRunAdHocTask(false), "Run Ad Hoc Script 1");
     //RunAdHocTask2Cmd      = R2Command.Relay(_ => RunAdHocTask(2), _ => _args.CanRunAdHocTask(false), "Run Ad Hoc Script 2");
     //RunAdHocTask3Cmd      = R2Command.Relay(_ => RunAdHocTask(3), _ => _args.CanRunAdHocTask(false), "Run Ad Hoc Script 3");
 }
示例#25
0
        private void FillSectionTotals(ITenantDBsDir dir)
        {
            SectionTotals.Clear();

            foreach (var sec in dir.MarketState.Sections.GetAll())
            {
                SectionTotals.Add(sec.Id, GetCollectionAmounts(sec.Id));
            }

            SectionTotals.Add(0, GetCollectionAmounts(0));
        }
        public static CVsByDateCell GetCheckVouchers(this ITenantDBsDir dir, DateTime date)
        {
            var db = dir.Vouchers;

            return(new CVsByDateCell
            {
                ActiveRequests = GetActiveRequests(db, date),
                InactiveRequests = GetInactiveRequests(db, date),
                PreparedCheques = GetPreparedCheques(db, date),
            });
        }
示例#27
0
        private static void ExecuteRateIncrease(LeaseDTO origLse, ITenantDBsDir dir)
        {
            var mkt     = dir.MarketState;
            var lastDte = 28.Feb(2019);
            var reason  = "2019 Rate Increase";
            var inactv  = mkt.DeactivateLease(origLse, reason, lastDte);
            var newActv = CreateNewActive(inactv, lastDte);

            mkt.ActiveLeases.Insert(newActv);
            inactv.ForwardBalancesTo(newActv, dir);
        }
示例#28
0
 public static void All_AR_Others(ITenantDBsDir dir)
 {
     dir.AddIfNone("A/R Others - Fortune Balagtas", GLAcctType.Asset);
     dir.AddIfNone("A/R Others - Fortune Marilao", GLAcctType.Asset);
     dir.AddIfNone("A/R Others - Fortune Norzagaray", GLAcctType.Asset);
     dir.AddIfNone("A/R Others - Fortune Meycauayan", GLAcctType.Asset);
     dir.AddIfNone("A/R Others - Fortune Bignay", GLAcctType.Asset);
     dir.AddIfNone("A/R Others - BK Balagtas", GLAcctType.Asset);
     dir.AddIfNone("A/R Others - BK Meycauayan", GLAcctType.Asset);
     dir.AddIfNone("A/R Others - BK Bignay", GLAcctType.Asset);
 }
示例#29
0
        public static void Launch(ITenantDBsDir dir)
        {
            var now = DateTime.Now.Date;
            var bgn = new DateTime(now.Year, now.Month - 1, 1);
            var end = bgn.AddMonths(1).AddDays(-1);

            if (!PopUpInput.TryGetDateRange("Clearing Dates of Checks", out (DateTime Start, DateTime End)rng, bgn, end))
            {
                return;
            }
        }
示例#30
0
        public static List <Action> GetActions(ICollectionsDB colxnsDB, ITenantDBsDir dir)
        {
            var jobs    = new List <Action>();
            var balancd = colxnsDB.Date.AddDays(-1);

            EnqueueBalanceUpdates(jobs, balancd, dir);

            jobs.Add(() => dir.AddDepositsToPassbook(balancd, true));
            jobs.Add(() => colxnsDB.MarkAsOpened());
            jobs.Add(() => TerminateExpiredLeases(dir));
            return(jobs);
        }