gnucash-invoice 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@ require 'gnucash/invoice/version'
4
4
  require 'gnucash/invoice/entry'
5
5
  require 'gnucash/invoice/customer'
6
6
  require 'gnucash/invoice/currency'
7
+ require 'gnucash/invoice/terms'
7
8
  require 'gnucash/invoice/supplier'
8
9
  require 'gnucash/invoice/printer'
9
10
  require 'gnucash/invoice/runner'
@@ -50,6 +51,13 @@ module GnuCash
50
51
  end
51
52
 
52
53
 
54
+ def terms
55
+ unless @raw[:terms].nil?
56
+ @terms ||= Terms.find @raw[:terms]
57
+ end
58
+ end
59
+
60
+
53
61
  def total
54
62
  entries.inject(0){ |memo,entry| memo + entry.total }
55
63
  end
@@ -7,7 +7,7 @@ module GnuCash
7
7
  include Timestamps
8
8
 
9
9
 
10
- attr_reader :id, :name
10
+ attr_reader :id, :name, :addr_name
11
11
 
12
12
 
13
13
  def initialize data
@@ -15,6 +15,7 @@ module GnuCash
15
15
 
16
16
  @id = data[:id]
17
17
  @name = data[:name]
18
+ @addr_name = data[:addr_name]
18
19
  end
19
20
 
20
21
 
@@ -0,0 +1,33 @@
1
+ module GnuCash
2
+ class Invoice
3
+ class Terms
4
+
5
+ attr_reader :raw, :description
6
+
7
+
8
+ def initialize data
9
+ @raw = data
10
+
11
+ @description = data[:description]
12
+ end
13
+
14
+ alias :to_s :description
15
+
16
+ def self.find guid
17
+ unless data = dataset.where(:guid => guid).first
18
+ raise TermsNotFound, "GUID: #{guid}"
19
+ end
20
+
21
+ new(data)
22
+ end
23
+
24
+
25
+ private
26
+
27
+
28
+ def self.dataset
29
+ GnuCash.connection[:billterms]
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,5 +1,5 @@
1
1
  module GnuCash
2
2
  class Invoice
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
5
5
  end
@@ -49,3 +49,6 @@ html
49
49
  tr.total
50
50
  td colspan=5 TOTAL
51
51
  td.price = "#{invoice.currency} %0.2f" % invoice.total
52
+
53
+ - if invoice.terms
54
+ p = invoice.terms
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gnucash-invoice
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-07-16 00:00:00.000000000 Z
14
+ date: 2013-07-26 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: sequel
@@ -133,6 +133,7 @@ files:
133
133
  - lib/gnucash/invoice/printer.rb
134
134
  - lib/gnucash/invoice/runner.rb
135
135
  - lib/gnucash/invoice/supplier.rb
136
+ - lib/gnucash/invoice/terms.rb
136
137
  - lib/gnucash/invoice/version.rb
137
138
  - lib/gnucash/options.rb
138
139
  - lib/gnucash/timestamps.rb
@@ -162,6 +163,6 @@ rubyforge_project:
162
163
  rubygems_version: 1.8.23
163
164
  signing_key:
164
165
  specification_version: 3
165
- summary: gnucash-invoice-0.1.1
166
+ summary: gnucash-invoice-0.1.2
166
167
  test_files: []
167
168
  has_rdoc: