public static IR2Command GetTerminateThisLeaseCmd(FilteredListVMBase listVM, string label = "Terminate this Lease") { return(LeaseCRUD1VM.NewCmd(listVM, label, listVM.AppArgs.CanTerminateteLease(false), (lse, crud) => { if (lse == null) { return; } var resp = MessageBox.Show($"Are you sure you want to terminate the lease for {L.f} {lse}?", " Confirm Termination", MessageBoxButton.YesNo, MessageBoxImage.Question); if (resp != MessageBoxResult.Yes) { return; } if (!PopUpInput.TryGetDate($"When is the last billable day for {L.f}{lse}?", out DateTime termDate, DateTime.Now.Date)) { return; } if (!PopUpInput.TryGetString("Why are you terminating this lease?", out string reason)) { return; } listVM.AppArgs.MarketState.DeactivateLease(lse, reason, termDate); }));
private void InputChequeDetails() { var req = ItemsList.CurrentItem; if (req == null) { return; } if (!req.Amount.HasValue) { Alert.Show("Amount requested should not be blank."); return; } var pbk = AppArgs.DCDR; if (!PopUpInput.TryGetInt("Cheque Number", out int num)) { return; } if (!PopUpInput.TryGetDate("Cheque Date", out DateTime date)) { return; } pbk.ToPreparedCheque(req, num, date); _mainWin.ClickRefresh(); }
public static IR2Command CreateLeaseJobCmd(int taskNumber, FilteredListVMBase listVM) { return(R2Command.Relay(() => { Action <LeaseDTO, ITenantDBsDir> job = null; string desc = null; switch (taskNumber) { case 1: job = SetToMonthly(out desc); break; case 2: if (!PopUpInput.TryGetDate("Look for Balances starting from", out DateTime date)) { break; } job = ForSpecificLease.FindMemosFrom(date, out desc); break; default: Alert.Show($"Unrecognized task number: [{taskNumber}]"); break; } Alert.Confirm($"Run “{desc}”?", async() => { listVM.Main.StartBeingBusy($"Running “{desc}” ..."); var dir = listVM.AppArgs; var lse = listVM.Rows.CurrentItem?.DTO; await Task.Run(() => job.Invoke(lse, dir)); listVM.Main.StopBeingBusy(); listVM.DoAfterSave.Invoke(); }); }, CanRun(listVM), $"Run Ad Hoc command {taskNumber}")); }
private void EditPRNumber(object seleectedItem) { if (!(seleectedItem is LeaseColxnRow row)) { return; } if (row.IntendedDTO == null && row.AmbulantDTO == null) { throw Null.Ref("LeaseColxnRow.DTO"); } var oldVal = row.IsAmbulant ? row.AmbulantDTO.PRNumber : row.IntendedDTO.PRNumber; if (!PopUpInput.TryGetInt("PR Number", out int newVal, oldVal)) { return; } row.DocumentRef = newVal.ToString(); SaveUpdatedRow(row); DailyStatusReportVM.Current.ClickRefresh(); CloseWindow(); }
protected override StallDTO GetNewDraft() { if (!PopUpInput.TryGetString("Section Name", out string name, "Section")) { return(null); } Section = SectionDTO.Named(name); return(GetDefaultStallTemplate(name)); }
protected override void RunMainMethod() { if (!PopUpInput.TryGetDate("Cleared Date", out DateTime date, DateTime.Now.Date)) { return; } AppArgs.Vouchers.SetAs_Cleared(ItemsList.CurrentItem, date); }
private void EditCurrent() { if (!PopUpInput.TryGetString("Section Name", out string name, Selected.Name)) { return; } Selected.Name = name; Crud.Section = Selected; Crud.EditCurrentRecord(Selected.StallTemplate); }
private void EditClearedDate(SoaRowDTO dto) { if (!PopUpInput.TryGetDate("Cleared Date", out DateTime date, dto.GetDate())) { return; } dto.DateOffset = date.SoaRowOffset(); _repo1.UpsertAndUpdateBalances(dto); ReloadFromDB(); }
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; } }
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)); }
public static void Launch(ITenantDBsDir dir) { var now = DateTime.Now.Date; var bgn = new DateTime(now.Year, now.Month, 1); var end = dir.Collections.LastPostedDate(); if (!PopUpInput.TryGetDateRange("Dates covered by GL Recap Report", out (DateTime Start, DateTime End)rng, bgn, end)) { return; } new GLRecapReport(rng.Start, rng.End, dir).ToExcel(); }
protected override void LoadRecordForEditing(RequestedChequeDTO rec) { if (!PopUpInput.TryGetInt("Cheque Number", out int num, rec.ChequeNumber)) { return; } if (!PopUpInput.TryGetDate("Cheque Date", out DateTime date, rec.ChequeDate)) { return; } rec.ChequeNumber = num; rec.ChequeDate = date; Repo.Update(rec); }
protected override void LoadRecordForEditing(RequestedChequeDTO rec) { if (!PopUpInput.TryGetString("Issued To", out string issuedTo, rec.IssuedTo)) { return; } if (!PopUpInput.TryGetDate("Date Issued", out DateTime issuedDate, rec.IssuedDate)) { return; } rec.IssuedTo = issuedTo; rec.IssuedDate = issuedDate; Repo.Update(rec); }
private void MarkAsCleared() { var chq = ItemsList.CurrentItem; if (chq == null) { return; } if (!PopUpInput.TryGetDate("Date Cleared", out DateTime clearedDate, chq.ChequeDate)) { return; } AppArgs.DCDR.ToBankTransaction(chq, clearedDate, _mainWin.GetSoaRepo()); _mainWin.ClickRefresh(); }
private async Task AddMultipleStalls(object cmdParam) { if (!PopUpInput.TryGetInt("How many stalls are we adding?", out int count, 10, "Please enter the number of stalls to add")) { return; } _main.StartBeingBusy($"Adding {count} stalls ..."); for (int i = 0; i < count; i++) { Crud.EncodeNewDraftCmd.ExecuteIfItCan(); await Task.Delay(100); await Crud.SaveDraftCmd.RunAsync(); } _main.StopBeingBusy(); }
protected override void RunMainMethod() { var chq = ItemsList.CurrentItem; if (!PopUpInput.TryGetDate("Issued Date", out DateTime date, DateTime.Now.Date)) { return; } if (!PopUpInput.TryGetString("Issued To", out string issuedTo, chq.Request.Payee)) { return; } AppArgs.Vouchers.SetAs_Issued(chq, date, issuedTo); }
protected override void RunMainMethod() { var req = ItemsList.CurrentItem; if (!PopUpInput.TryGetDate("Cheque Date", out DateTime date, DateTime.Now.Date)) { return; } if (!PopUpInput.TryGetInt("Cheque Number", out int num)) { return; } AppArgs.Vouchers.SetAs_Prepared(req, date, num); }
public static void Launch(AppArguments args) { var now = DateTime.Now.Date; var bgn = new DateTime(now.Year, now.Month, 1); var end = args.Collections.LastPostedDate(); if (!PopUpInput.TryGetDateRange ("Dates covered by Collection Summary Report", out (DateTime Start, DateTime End)rng, bgn, end)) { return; } var splash = new LoadingSplash(); new ColxnSummaryReport(rng.Start, rng.End, args).ToExcel(); splash.Close(); }
private void EditIssuanceDetails() { var e = ItemsList.CurrentItem; if (!PopUpInput.TryGetDate("Issued Date", out DateTime date, e.IssuedDate)) { return; } if (!PopUpInput.TryGetString("Issued To", out string issuedTo, e.IssuedTo)) { return; } e.IssuedDate = date; e.IssuedTo = issuedTo; AppArgs.Vouchers.PreparedCheques.Update(e); }
private void EditChequeDetails() { var e = ItemsList.CurrentItem; if (!PopUpInput.TryGetDate("Cheque Date", out DateTime date, e.ChequeDate)) { return; } if (!PopUpInput.TryGetInt("Cheque Number", out int num, e.ChequeNumber)) { return; } e.ChequeDate = date; e.ChequeNumber = num; AppArgs.Vouchers.PreparedCheques.Update(e); }
private void IssueChequeToPayee() { var chq = ItemsList.CurrentItem; if (chq == null) { return; } if (!PopUpInput.TryGetString("Issued To", out string issuedTo, chq.Request.Payee)) { return; } if (!PopUpInput.TryGetDate("Date Issued", out DateTime issuedDate)) { return; } AppArgs.DCDR.ToIssuedCheque(chq, issuedTo, issuedDate); _mainWin.ClickRefresh(); }
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(); }
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(); }
private void EditClearedDate() { var origDate = PassbookRow.TransactionDate; if (!PickedDate.HasValue) { if (!PopUpInput.TryGetDate("Cleared Date", out DateTime newDate, origDate)) { return; } PickedDate = newDate; } PassbookRepo.Delete(PassbookRow); PassbookRow.Id = 0; PassbookRow.DateOffset = PickedDate.Value.DaysSinceMin(); PassbookRepo.Insert(PassbookRow); PassbookRepo.RecomputeBalancesFrom(origDate); ClearedDateUpdated?.Invoke(this, EventArgs.Empty); CloseWindow(); }
private static bool IsUpdateConfirmed(out DailyBillDTO dtoForUpdate, SoaViewerVM vm) { var day1 = vm?.Rows?.LastOrDefault(); if (day1 == null) { throw Bad.Data("Day 1 row"); } dtoForUpdate = day1.DTO; var origVal = day1.Rights.OpeningBalance; var suggVal = GetSuggestedVal(day1.Rights, vm); var dte = $"{day1.Date:d-MMM-yyyy}"; var msg = $"[{dte}] Starting Rights (orig.val: {origVal:N2})"; var ok = PopUpInput.TryGetDecimal(msg, out decimal newVal, suggVal); if (!ok) { return(false); } EditBillRow(dtoForUpdate, newVal, vm); return(true); }
private void TerminateThisLease() { if (!TryGetPickedItem(out LeaseDTO lse)) { return; } var resp = MessageBox.Show($"Are you sure you want to terminate the lease for {L.f} {lse}?", " Confirm Termination", MessageBoxButton.YesNo, MessageBoxImage.Question); if (resp != MessageBoxResult.Yes) { return; } if (!PopUpInput.TryGetDate($"When is the last billable day for {L.f}{lse}?", out DateTime termDate, DateTime.Now.Date)) { return; } AppArgs.MarketState.DeactivateLease(lse, "Manual Termination", termDate); LeaseDeactivated?.Invoke(this, EventArgs.Empty); }