farmingengineers 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{farmingengineers}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matt Burke"]
12
- s.date = %q{2010-10-16}
12
+ s.date = %q{2010-10-17}
13
13
  s.description = %q{Invoice generators, etc.}
14
14
  s.email = %q{mr.matt.burke@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -30,7 +30,6 @@ Gem::Specification.new do |s|
30
30
  "lib/egg_csa_invoice.rb",
31
31
  "lib/farming_engineers.rb",
32
32
  "lib/farming_engineers/invoices.rb",
33
- "lib/farming_engineers/invoices/.eggs.rb.swp",
34
33
  "lib/farming_engineers/invoices/common.rb",
35
34
  "lib/farming_engineers/invoices/eggs.rb",
36
35
  "lib/instance_eval_attr.rb",
data/invoice.rb CHANGED
@@ -8,4 +8,6 @@ egg_csa_invoice do
8
8
  address ['123 Street', 'City, IN', '317-xxx-xxxx']
9
9
  deposit '8/1/2010', 50
10
10
  deliver '10/11/2010', 4
11
+ purchase '11/1/2010', 'Doughnuts', 10
12
+ notes 'Notes to customer'
11
13
  end
@@ -2,6 +2,8 @@ require 'ruport'
2
2
  require 'ruport/util'
3
3
  require 'farming_engineers'
4
4
 
5
+ module EggCsaInvoice
6
+
5
7
  $invoice_count = 0
6
8
  def egg_csa_invoice(&block)
7
9
  invoice = FarmingEngineers::Invoices::Eggs::Invoice.new
@@ -11,7 +13,7 @@ def egg_csa_invoice(&block)
11
13
  balance = 0
12
14
  invoice.history.each do |line|
13
15
  balance += line.total
14
- t << [line.date, line.description, line.quantity, line.total, balance]
16
+ t << [line.date, line.description, line.quantity, d(line.total), d(balance)]
15
17
  end
16
18
  end
17
19
 
@@ -24,7 +26,8 @@ def egg_csa_invoice(&block)
24
26
  )
25
27
 
26
28
  invoice_id = "#{Date.today.strftime('%Y%m%d')}-#{$invoice_count += 1}"
27
- invoice_file = "invoice-#{invoice_id}.pdf"
29
+ invoice_file = File.expand_path("../invoice-#{invoice_id}.pdf", $0)
30
+ puts invoice_file
28
31
 
29
32
  Ruport::Controller::Invoice.render :pdf, :file => invoice_file do |i|
30
33
  i.data = history_table
@@ -40,3 +43,13 @@ def egg_csa_invoice(&block)
40
43
  end
41
44
  end
42
45
  end
46
+ def d(amount)
47
+ '$%0.2f' % amount
48
+ end
49
+
50
+ extend self
51
+ end
52
+
53
+ def egg_csa_invoice(&block)
54
+ EggCsaInvoice.egg_csa_invoice(&block)
55
+ end
@@ -16,6 +16,10 @@ module FarmingEngineers ; module Invoices ; module Common
16
16
  def deposit date, amount
17
17
  push Deposit.new(date, amount)
18
18
  end
19
+
20
+ def purchase date, description, amount
21
+ push Purchase.new(date, description, amount)
22
+ end
19
23
  end
20
24
  class HistoryItem
21
25
  attr_reader :date, :description, :quantity, :total
@@ -27,4 +31,11 @@ module FarmingEngineers ; module Invoices ; module Common
27
31
  @total = -amount
28
32
  end
29
33
  end
34
+ class Purchase < HistoryItem
35
+ def initialize(date, description, amount)
36
+ @date = date
37
+ @description = description
38
+ @total = amount
39
+ end
40
+ end
30
41
  end ; end ; end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: farmingengineers
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Burke
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-16 00:00:00 -04:00
18
+ date: 2010-10-17 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -103,7 +103,6 @@ files:
103
103
  - lib/egg_csa_invoice.rb
104
104
  - lib/farming_engineers.rb
105
105
  - lib/farming_engineers/invoices.rb
106
- - lib/farming_engineers/invoices/.eggs.rb.swp
107
106
  - lib/farming_engineers/invoices/common.rb
108
107
  - lib/farming_engineers/invoices/eggs.rb
109
108
  - lib/instance_eval_attr.rb