public void Merge_bespoke_data_with_pending_file( IInputOutput input_output, ISpreadsheet spreadsheet, ICSVFile <CredCard2InOutRecord> pending_file, BudgetingMonths budgeting_months, DataLoadingInformation <CredCard2Record, CredCard2InOutRecord> data_loading_info) { var most_recent_cred_card_direct_debit = spreadsheet.Get_most_recent_row_containing_text <BankRecord>( MainSheetNames.Bank_out, ReconConsts.Cred_card2_dd_description, new List <int> { ReconConsts.DescriptionColumn, ReconConsts.DdDescriptionColumn }); var statement_date = new DateTime(); var next_date = most_recent_cred_card_direct_debit.Date.AddMonths(1); var input = input_output.Get_input(string.Format( ReconConsts.AskForCredCardDirectDebit, ReconConsts.Cred_card2_name, next_date.ToShortDateString())); double new_balance = 0; while (input != "0") { if (double.TryParse(input, out new_balance)) { new_balance = new_balance * -1; pending_file.Records.Add(new CredCard2InOutRecord { Date = next_date, Description = ReconConsts.Cred_card2_regular_pymt_description, Unreconciled_amount = new_balance }); } statement_date = next_date.AddMonths(-1); next_date = next_date.Date.AddMonths(1); input = input_output.Get_input(string.Format( ReconConsts.AskForCredCardDirectDebit, ReconConsts.Cred_card2_name, next_date.ToShortDateString())); } if (!new_balance.Double_equals(0)) { spreadsheet.Update_balance_on_totals_sheet( Codes.Cred_card2_bal, new_balance, string.Format( ReconConsts.CredCardBalanceDescription, ReconConsts.Cred_card2_name, $"{statement_date.ToString("MMM")} {statement_date.Year}"), balance_column: 5, text_column: 6, code_column: 4, input_output: input_output); } }
private bool Confirm_budgeting(string confirmation_message) { bool result = false; var input = _input_output.Get_input(confirmation_message); if (!string.IsNullOrEmpty(input) && input.ToUpper() == "Y") { result = true; } return(result); }
private DateTime Get_next_unplanned_month(ISpreadsheet spreadsheet) { DateTime default_month = DateTime.Today; DateTime next_unplanned_month = default_month; bool bad_input = false; try { next_unplanned_month = spreadsheet.Get_next_unplanned_month(); } catch (Exception) { string new_month = _input_output.Get_input(ReconConsts.CantFindMortgageRow); try { if (!String.IsNullOrEmpty(new_month) && Char.IsDigit(new_month[0])) { int actual_month = Convert.ToInt32(new_month); if (actual_month < 1 || actual_month > 12) { bad_input = true; } else { var year = default_month.Year; if (actual_month < default_month.Month) { year++; } next_unplanned_month = new DateTime(year, actual_month, 1); } } else { bad_input = true; } } catch (Exception) { bad_input = true; } } if (bad_input) { _input_output.Output_line(ReconConsts.DefaultUnplannedMonth); next_unplanned_month = default_month; } return(next_unplanned_month); }
private void Show_warnings() { var num_matched_third_party_records = Reconciliator.Num_matched_third_party_records(); var num_matched_owned_records = Reconciliator.Num_matched_owned_records(); var num_third_party_records = Reconciliator.Num_third_party_records(); var num_owned_records = Reconciliator.Num_owned_records(); if (num_matched_third_party_records != num_matched_owned_records) { _input_output.Output_line(ReconConsts.BadTallyMatchedItems); _input_output.Get_input(ReconConsts.EnterAnyKeyToContinue); } if (num_matched_third_party_records > num_owned_records) { _input_output.Output_line(ReconConsts.BadTallyNumMatchedThirdParty); _input_output.Get_input(ReconConsts.EnterAnyKeyToContinue); } if (num_matched_owned_records > num_third_party_records) { _input_output.Output_line(ReconConsts.BadTallyNumMatchedOwned); _input_output.Get_input(ReconConsts.EnterAnyKeyToContinue); } }
private void Update_owed_CHB(IInputOutput input_output, ISpreadsheet spreadsheet, BudgetingMonths budgeting_months) { var input = input_output.Get_input("Do you want to add to the CHB total? The answer is probably No if you're not doing monthly transaction budgeting this time. Enter y/Y for Yes."); if (!String.IsNullOrEmpty(input) && input.ToUpper() == "Y") { spreadsheet.Update_owed_CHB(budgeting_months); } }
public string Set_path() { _input_output.Output_line(""); _input_output.Output_line("Would you like to enter a file path or use the default?"); _input_output.Output_options(new List <string> { "1. Enter a path", $"2. Use default ({ReconConsts.Default_file_path})" }); string input = _input_output.Get_generic_input(ReconConsts.PathOrDefault); switch (input) { case "1": _path = _input_output.Get_input(ReconConsts.EnterCsvPath); break; case "2": _path = ReconConsts.Default_file_path; break; } return(_path); }
private void Add_most_recent_credit_card_direct_debits( IInputOutput input_output, ISpreadsheet spreadsheet, ICSVFile <BankRecord> pending_file, string cred_card_name, string direct_debit_description) { var most_recent_cred_card_direct_debit = spreadsheet.Get_most_recent_row_containing_text <BankRecord>( MainSheetNames.Bank_out, direct_debit_description, new List <int> { ReconConsts.DescriptionColumn, ReconConsts.DdDescriptionColumn }); var next_date = most_recent_cred_card_direct_debit.Date.AddMonths(1); var input = input_output.Get_input(string.Format( ReconConsts.AskForCredCardDirectDebit, cred_card_name, next_date.ToShortDateString())); while (input != "0") { double amount; if (double.TryParse(input, out amount)) { pending_file.Records.Add(new BankRecord { Date = next_date, Description = direct_debit_description, Type = "POS", Unreconciled_amount = amount }); } next_date = next_date.Date.AddMonths(1); input = input_output.Get_input(string.Format( ReconConsts.AskForCredCardDirectDebit, cred_card_name, next_date.ToShortDateString())); } }
private DateTime Decide_date(DateTime date, string day_name, string context_description, string start_or_end) { _input_output.Output_line($"1. {date.ToShortDateString()}"); _input_output.Output_line($"2. {date.AddDays(7).ToShortDateString()}"); var choice = _input_output.Get_input($"Which {day_name} do you want to {start_or_end} with for {context_description}? Enter 1 or 2:"); if (choice == "2") { date = date.AddDays(7); } return(date); }
private void Update_monthly_item( IInputOutput input_output, ISpreadsheet spreadsheet, BudgetingMonths budgeting_months, string item, string budget_code, string expected_out_code) { var input = input_output.Get_input(Num_months_question(budgeting_months, item)); var num_months = 0; if (int.TryParse(input, out num_months)) { spreadsheet.Update_expected_out(num_months, budget_code, expected_out_code); } }
public void Debug_preliminary_stuff <TThirdPartyType, TOwnedType>(IReconciliator <TThirdPartyType, TOwnedType> reconciliator) where TThirdPartyType : ICSVRecord, new() where TOwnedType : ICSVRecord, new() { List <ConsoleLine> all_expense_transactions_from_actual_bank_in = Get_all_expense_transactions_from_actual_bank_in(reconciliator); _input_output.Output_line("***********"); _input_output.Output_line("All Expense Transactions From ActualBank In:"); _input_output.Output_all_lines(all_expense_transactions_from_actual_bank_in); List <ConsoleLine> all_expense_transactions_from_expected_in = Get_all_wages_rows_and_expense_transactions_from_expected_in(reconciliator); _input_output.Output_line("***********"); _input_output.Output_line("All Expense Transactions From Expected In:"); _input_output.Output_all_lines(all_expense_transactions_from_expected_in); reconciliator.Refresh_files(); _input_output.Get_input(ReconConsts.EnterAnyKeyToContinue); }
private void CheckExit() { // Get_generic_input will throw another exception if they type Exit again. _input_output.Get_input(ReconConsts.CheckExit); Proceed_after_showing_matching_results(); }