moneymanager 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d12b2140748dad9d3d6eda4bdc9bb3000932eeba
4
- data.tar.gz: 59f8c42433720e5875a1098a40a49b2a2572323a
3
+ metadata.gz: c07fde9f3699dfb8fe2264cfd3fbe5d935bc3e57
4
+ data.tar.gz: 596525dc60a1324c392f750a047e31165d349aa0
5
5
  SHA512:
6
- metadata.gz: 57ae82ff42ba946498532d090b752293eaf5134e3a63afb986de516a7df120df2a92516ec3ce481a36f7823047c7249320863880f451b991f4ee89f8d0a2b0af
7
- data.tar.gz: 489c85decc4ae67e7d2ec5314681a2088a1e6ce0fc8f84e43339fa885b35036305050e872b064f9ccb9bf6ddacd19c3a24262755f23a993e19f85081a17ccc63
6
+ metadata.gz: e3f41e6655efd33ee4e8f187bd73553f7d3d5fca7162fd90374d9db44f352bb5bcf2373e0c6e441c5e91e2af9a8a4455687c9174d6d816c9926edc3d05529b3a
7
+ data.tar.gz: 1b73623c3070702ecaff7fb6042d7e6a08fe6b5ebf6501f6b973038a13f395af8d2837c6df1c3781da7d824d6b8f3e28b1dd90aa16145873eaf66d8f1338f4dd
data/README.md CHANGED
@@ -1,24 +1,34 @@
1
1
  # Moneymanager
2
2
 
3
- This is ruby app I wrote to help me managing my personal finance. Some features are still missing, I'll add in the future.
4
- I ended up writing my own tool instead of using MoneyWiz et simila is that all the tools I tried are either overcomplicated or dont'have the basic information I need (and also because I like writing Ruby code)
3
+ This is ruby app I wrote to help me managing my personal finance. My needs are quite basic:
4
+
5
+ - Review all the bank transactions to find any fraud or issue
6
+ - Tags the important expenses and incomes to monitor the trend overtime
7
+
8
+ I wrote my own tool instead of using MoneyWiz because I like writing ruby code and all the commercial apps are overcomplicated for me
5
9
 
6
10
  ## Features
7
11
 
8
12
  * Import transactions from a `CSV - CAMT` file. I'm not sure about your bank, but SparkasseBerlin has this option.
9
- * The import process is idempotent. Import same transaction multiple times doesn't get duplicate.
13
+ * The import process is idempotent, the already imported transactions are just skipped.
10
14
  * Print the list of transacions.
11
- * Review the transaction and flag all the approved ones.
12
- * Tag the transaction and assign a tag to each one
13
- * Print the summary of income/expense general or divided by category.
14
- * All the actions have an options to consider only a specific month.
15
+ * Review the transaction and put a checkmarks on the approved ones.
16
+ * Tag the transactions
17
+ * Analize the transaction with the reports
18
+
19
+ ## Reports
20
+
21
+ * Total income
22
+ * Total expense
23
+ * All incomes grouped by category
24
+ * All expenses grouped by category
25
+ * Trend of tag overtime
15
26
 
16
27
  ## Why you shouldn't use this
17
28
 
29
+ * Probably your needs are different from mine.
18
30
  * The database is just a plain, non-encrypted file.
19
- * There are no fancy charts.
20
- * The filter is _monthly_ based. If you have undreds of transaction per month this tool can be tedious.
21
- *
31
+ * There are no fancy charts (so far)
22
32
 
23
33
  ## Usage
24
34
 
@@ -77,7 +87,7 @@ Flag all the approved transaction.
77
87
 
78
88
  #### Tag each transaction
79
89
 
80
- Assign a tag to each (or not) transaction. To generate hierarchy of tags, use a `/` like `Car/Insurance`s
90
+ Assign a tag to a transaction. To generate hierarchy of tags, use a `/` like `Car/Insurance`
81
91
 
82
92
  $ mm tag
83
93
  +----------+------------------------------------------------------+
@@ -117,7 +127,9 @@ Assign a tag to each (or not) transaction. To generate hierarchy of tags, use a
117
127
 
118
128
  ## Reporting
119
129
 
120
- #### Total
130
+ #### Total (Incomes or Expenses)
131
+
132
+ Print the total of the incomes or expenses on the whole archive or on the selected month
121
133
 
122
134
  $ mm report --month 8
123
135
 
@@ -135,9 +147,11 @@ Assign a tag to each (or not) transaction. To generate hierarchy of tags, use a
135
147
  | 99999.0 € |
136
148
  +-----------+
137
149
 
150
+
138
151
  #### All Incomes/Expenses
139
152
 
140
-
153
+ Print the list of all the incomes (or expenses) grouped by tag. The entries without a tag are grouped into the `Unknown` tag.
154
+
141
155
  $ mm report
142
156
  Which type of report? (Use arrow keys, press Enter to select)
143
157
  Total (Incomes)
@@ -151,10 +165,10 @@ Assign a tag to each (or not) transaction. To generate hierarchy of tags, use a
151
165
  Which type of report? All Incomes
152
166
  +--------------+----------+
153
167
  | Kindergeld | 999.0 € |
154
- | Rimborsi | 998.0 € |
155
- | Stipendio | 8998.0 € |
168
+ | Salary | 999.0 € |
169
+ | Investments | 9999.0 € |
156
170
  | Stockoptions | 9999.0 € |
157
- | Unknown | 888.0 € |
171
+ | Unknown | 999.0 € |
158
172
  +--------------+----------+
159
173
  | 9999999.0 € |
160
174
  +--------------+----------+
@@ -162,6 +176,7 @@ Assign a tag to each (or not) transaction. To generate hierarchy of tags, use a
162
176
 
163
177
  #### One tag grouped by month
164
178
 
179
+ Print al list in which the entries with the selected tag are grouped by month. This is the report you want to use to understand if your heating bill is becoming bigger overtime.
165
180
 
166
181
  $ mm report
167
182
  Which type of report? (Use arrow keys, press Enter to select)
@@ -178,25 +193,28 @@ Assign a tag to each (or not) transaction. To generate hierarchy of tags, use a
178
193
  Car/Insurance
179
194
  Car/Tire
180
195
 
181
- Select a tag. Kita
182
- +---+---------+
183
- | 8 | -99.0 € |
184
- | 9 | -99.0 € |
185
- +---+---------+
186
- | -198.0 € |
187
- +---+---------+
196
+ Select a tag. Heating
197
+ +-----------+---------+
198
+ | August | -99.0 € |
199
+ | September | -99.0 € |
200
+ +-----------+---------+
201
+ | -198.0 € |
202
+ +-----------+---------+
188
203
 
189
204
 
190
205
 
191
206
 
192
207
  ## To do
193
208
 
209
+ * [x] Filter by one single entry
210
+ * [x] Report for one tag splitted by month
194
211
  * [ ] Report for nested tags ( Car/Gasoline, Car/Insurance etc)
195
212
  * [ ] Multiple tags
196
- * [x] Report for one tag splitted by month
197
213
  * [ ] Add a backup options
198
214
  * [ ] Manage multiple banck account
199
215
  * [ ] Exclude account transfer from the list of expenses/incomes
216
+ * [ ] Print fancy chart in html
217
+
200
218
 
201
219
  ## Contributing
202
220
 
data/exe/mm CHANGED
@@ -32,8 +32,9 @@ command :print do |c|
32
32
  c.syntax = 'mm print [--month <month>]'
33
33
  c.description = 'Print the list of transactions'
34
34
  c.option '--month INTEGER', Integer, 'Specify the month to print.'
35
+ c.option '--entry STRING', String, 'Specify the entry to print.'
35
36
  c.action do |_args, options|
36
- entries = get_entries(options.month)
37
+ entries = get_entries(options.month, options.entry)
37
38
  Layout.print_multiple(entries)
38
39
  end
39
40
  end
@@ -42,8 +43,9 @@ command :tag do |c|
42
43
  c.syntax = 'mm tags'
43
44
  c.description = 'Print the list of transactions'
44
45
  c.option '--month INTEGER', Integer, 'Specify the month to tag.'
46
+ c.option '--entry STRING', String, 'Specify the entry to tag.'
45
47
  c.action do |_args, options|
46
- entries = get_entries(options.month)
48
+ entries = get_entries(options.month, options.entry)
47
49
  Tagger.new.retag(entries)
48
50
  end
49
51
  end
@@ -52,8 +54,9 @@ command :review do |c|
52
54
  c.syntax = 'mm review'
53
55
  c.description = 'Start the review process'
54
56
  c.option '--month INTEGER', Integer, 'Specify the month to review.'
57
+ c.option '--entry STRING', String, 'Specify the entry to review.'
55
58
  c.action do |_args, options|
56
- entries = get_entries(options.month)
59
+ entries = get_entries(options.month, options.entry)
57
60
  Reviewer.new.review(entries)
58
61
  end
59
62
  end
@@ -63,7 +66,7 @@ command :report do |c|
63
66
  c.description = 'Print all the revenues and all the expenses grouped by tag'
64
67
  c.option '--month INTEGER', Integer, 'Specify the month to report.'
65
68
  c.action do |_args, options|
66
- entries = get_entries(options.month)
69
+ entries = get_entries(options.month, nil)
67
70
 
68
71
  prompt = TTY::Prompt.new
69
72
  command = prompt.select('Which type of report?') do |menu|
@@ -88,17 +91,27 @@ command :report do |c|
88
91
  tags = archiver.tags.sort!
89
92
  tag = prompt.select('Select a tag.', tags, per_page: 30)
90
93
  report.print_group_by_month_report(entries,tag)
91
- end
94
+ end
92
95
  end
93
96
  end
94
97
 
95
98
 
96
99
 
97
- def get_entries(month)
100
+ def get_entries(month, entry_id)
98
101
  archiver = Moneymanager::Archiver.new
99
- if month.nil?
100
- archiver.all_entries
101
- else
102
- archiver.all_entries_per_month(month)
102
+ result = archiver.all_entries
103
+
104
+ unless month.nil?
105
+ result = result.select do |entry|
106
+ entry.date.month == month
107
+ end
103
108
  end
109
+
110
+ unless entry_id.nil?
111
+ result = result.select do |entry|
112
+ entry.digest.start_with?(entry_id)
113
+ end
114
+ end
115
+ result
104
116
  end
117
+
@@ -50,12 +50,6 @@ module Moneymanager
50
50
  @db[:entries].sort_by(&:date)
51
51
  end
52
52
 
53
- def all_entries_per_month(month)
54
- @db[:entries].sort_by(&:date).select do |entry|
55
- entry.date.month == month
56
- end
57
- end
58
-
59
53
  def tags
60
54
  @db[:tags]
61
55
  end
@@ -1,16 +1,21 @@
1
1
  class Layout
2
2
  def self.print_multiple(entries)
3
- clear
4
- rows = entries.map { |entry| [entry.formatted_approved, entry.date.strftime('%y/%m/%d'), entry.tag, entry.reason[0...50], entry.formatted_amount] }
3
+ if entries.count == 1
4
+ print_single(entries.first)
5
+ else
6
+ clear
7
+ rows = entries.map { |entry| [entry.formatted_approved, entry.date.strftime('%y/%m/%d'), entry.tag, entry.reason[0...50], entry.formatted_amount, entry.digest[0...6]] }
5
8
 
6
- table = Terminal::Table.new headings: ['✔/✖︎', 'Date', 'Tag', 'Reason', 'Amount'], rows: rows
7
- table.align_column(4, :right)
8
- table.align_column(0, :center)
9
+ table = Terminal::Table.new headings: ['✔/✖︎', 'Date', 'Tag', 'Reason', 'Amount', 'SHA1'], rows: rows
10
+ table.align_column(4, :right)
11
+ table.align_column(0, :center)
9
12
 
10
- puts table
13
+ puts table
14
+ end
11
15
  end
12
16
 
13
17
  def self.print_single(entry)
18
+ clear
14
19
  hash = {
15
20
  date: entry.date,
16
21
  reason: entry.reason,
@@ -24,7 +29,7 @@ class Layout
24
29
  end
25
30
 
26
31
  def self.formatted_amount(amount)
27
- s = amount.to_s + ' €'
32
+ s = sprintf('%.2f €', amount)
28
33
  amount < 0 ? s.red : s.green
29
34
  end
30
35
 
@@ -33,7 +33,7 @@ module Moneymanager
33
33
  entry = Entry.new
34
34
  entry.date = Date.strptime(row[:buchungstag], '%d.%m.%y')
35
35
  entry.reason = row[:verwendungszweck].squeeze(' ')
36
- entry.amount = row[:betrag].to_f
36
+ entry.amount = row[:betrag].to_s.gsub(',', '.').to_f
37
37
  entry.company = row[:beguenstigterzahlungspflichtiger].squeeze(' ')
38
38
  entry.raw = row.to_csv.squeeze(' ')
39
39
  entries << entry
@@ -27,7 +27,7 @@ class Report
27
27
  entries = entries.select { |entry|
28
28
  entry.tag == tag
29
29
  }.each_with_object(Hash.new(0)) { | current, sum |
30
- month = current.date.month
30
+ month = current.date.strftime("%B")
31
31
  sum[month] += current.amount
32
32
  }
33
33
  Layout.print_generic_rows(entries)
@@ -2,7 +2,6 @@ class Reviewer
2
2
  def review(entries)
3
3
  archiver = Moneymanager::Archiver.new
4
4
  entries.each do |entry|
5
- Layout.clear
6
5
  Layout.print_single(entry)
7
6
  prompt = TTY::Prompt.new
8
7
  action = prompt.select('Do you recognize?', %i[yes no skip abort], per_page: 30)
@@ -1,3 +1,3 @@
1
1
  module Moneymanager
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.3.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moneymanager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ignazioc
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-15 00:00:00.000000000 Z
11
+ date: 2017-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander