Ejemplo n.º 1
0
        private string Get_description_without_specific_qualifier(ICSVRecord match)
        {
            string new_description = match.Description;

            var qualifier_index_with_space_at_end = match.Description.IndexOf($"{_match_description_qualifier} ", StringComparison.CurrentCultureIgnoreCase);

            if (qualifier_index_with_space_at_end >= 0)
            {
                new_description = match.Description.Remove(qualifier_index_with_space_at_end, _match_description_qualifier.Length + 1);
            }
            else
            {
                var qualifier_index_with_space_at_start = match.Description.IndexOf($" {_match_description_qualifier}", StringComparison.CurrentCultureIgnoreCase);
                if (qualifier_index_with_space_at_start >= 0)
                {
                    new_description = match.Description.Remove(qualifier_index_with_space_at_start, _match_description_qualifier.Length + 1);
                }
                else
                {
                    var qualifier_index_no_space = match.Description.IndexOf(_match_description_qualifier, StringComparison.CurrentCultureIgnoreCase);
                    if (qualifier_index_no_space >= 0)
                    {
                        new_description = match.Description.Remove(qualifier_index_no_space, _match_description_qualifier.Length);
                    }
                }
            }


            new_description = $"{new_description} {match.Main_amount().To_csv_string(true)}";
            return(new_description);
        }
 public void Create_new_expenses_record_to_match_balance(ICSVRecord source_record, double balance)
 {
     if (File.Records != null)
     {
         File.Records.Add(new ExpectedIncomeRecord
         {
             Description         = ReconConsts.UnknownExpense,
             Unreconciled_amount = balance,
             Match      = source_record,
             Matched    = true,
             Date       = source_record.Date,
             Date_paid  = source_record.Date,
             Total_paid = source_record.Main_amount(),
             Code       = Codes.Expenses
         });
     }
 }
        public void Update_expected_income_record_when_matched(ICSVRecord source_record, ICSVRecord match)
        {
            if (File.Records != null)
            {
                var matching_records = File.Records.Where(
                    x => x.Description.Remove_punctuation() == match.Description.Remove_punctuation() &&
                    x.Date == match.Date &&
                    x.Main_amount() == match.Main_amount());

                if (matching_records.Count() == 1)
                {
                    var matching_record = matching_records.ElementAt(0);

                    matching_record.Match      = source_record;
                    matching_record.Matched    = true;
                    matching_record.Date_paid  = source_record.Date;
                    matching_record.Total_paid = source_record.Main_amount();
                }
            }
        }