caboose-store 0.0.26 → 0.0.27

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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTNkNWVhMzg2NGY1Njg0MDg1MTE5ZmVjODU0NTliZTI5ZjA0NzBlYw==
4
+ OTlhYWY2MDc3YjY0YmYyZGE3YTBjODRjNDUxNzI2OTY1OGJmZmRjNQ==
5
5
  data.tar.gz: !binary |-
6
- ZDYyZDNjNjU3MTMyNDY5MTJhZjIzNGQxNDg3ZDQ4YmE4NGIzNTBkYg==
6
+ YWQ2Y2I1NmJkZTU4YzJmYjM2MzAwOTllMzQ4MDcwZTA4Yzg4Yzg1Yg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MmNjN2JjZTFkNzBiMGVlMWEzODE1ZDRiN2I3NTQ0OTk3NmUxZmIwNDNlZDBl
10
- Y2NkMmYwZDVlODAzNjkzODNhMDc3MWVkMzI1OGQ4MjI3OTM1MTg3MjFmYTdk
11
- MDEzMDZjMmZhMGY4N2QwMzRmZDVlMGYwZGM0MzgwMGE3Mzg3NDQ=
9
+ NjVkYWY1MDM0YjI4MDEzZWU1NTBiZjEzNGMwMGI3YjhlOGUxYTM3YzZhOGUw
10
+ ZWM5MzU3YTVjNDA1NDM3OTVjOWM1OWMzZTYyYmQ0YTFhNzI4MjJiZTZmNGM0
11
+ OGNmMWExNWMzYmVmM2NlYjQ1MzFlMjZmODc4NWJkMzJmMzJjNGE=
12
12
  data.tar.gz: !binary |-
13
- Y2Y1YzhlMmU4NWIyYWJiM2QyYTFkYzk3YzQxY2Q4OTM3NWFlMDc1NmZlYTU1
14
- ODdiYzZjNTc3NjA3OWEwYjI2YTJlNzAxMWVhZjE1OTY3NzliMjQxYTA5ZDEw
15
- ZDU0ZmY5Y2RlMmMyYjA2ZGI3ZTdiNTFhNzU4NDkyOTZjZjJiZWM=
13
+ YzQ3MWQ5ODczNTYwYmIwM2U4OTAwYzAzMjc4ODM2MDlmZTMzMjg2YjM1Yjk3
14
+ YjQzN2IwMzRlZjY3NmM3NDU5OTAzMTc2MzI2ZGIzMzEzNTI4ZWY4ZTJiZjhj
15
+ MDc2MWYzOGFlNzQ5YWE0ZjVkYTA2ODlkMjY2NTJhNWVlZjExYWE=
@@ -72,6 +72,10 @@ module CabooseStore
72
72
  :product => { :images => self.variant.product.product_images }
73
73
  })
74
74
  end
75
+
76
+ def subtotal
77
+ return self.quantity * self.price
78
+ end
75
79
  end
76
80
  end
77
81
 
@@ -182,6 +182,10 @@ module CabooseStore
182
182
  def calculate_total
183
183
  [self.subtotal, self.tax, self.shipping, self.handling].compact.inject { |sum, price| sum + price }
184
184
  end
185
+
186
+ def shipping_and_handling
187
+ (self.shipping ? self.shipping : 0.0) + (self.handling ? self.handling : 0.0)
188
+ end
185
189
  end
186
190
  end
187
191
 
@@ -53,8 +53,7 @@ module CabooseStore
53
53
  { :content => "Item" , :align => :center, :valign => :bottom },
54
54
  { :content => "Tracking Number" , :align => :center, :valign => :bottom },
55
55
  { :content => "Unit Price" , :align => :center, :valign => :bottom },
56
- { :content => "Qty Ordered" , :align => :center, :valign => :bottom },
57
- { :content => "Qty Shipped" , :align => :center, :valign => :bottom },
56
+ { :content => "Quantity" , :align => :center, :valign => :bottom },
58
57
  { :content => "Subtotal" , :align => :center, :valign => :bottom, :width => 60 }
59
58
  ]
60
59
 
@@ -63,16 +62,15 @@ module CabooseStore
63
62
  "#{li.variant.product.title}\n#{li.variant.sku}\n#{li.variant.title}",
64
63
  { :content => li.tracking_number },
65
64
  { :content => sprintf("%.2f", li.variant.price) , :align => :right },
66
- { :content => "#{li.quantity}" , :align => :right },
67
- { :content => "#{li.quantity_shipped}" , :align => :right },
65
+ { :content => "#{li.quantity}" , :align => :right },
68
66
  { :content => sprintf("%.2f", li.subtotal) , :align => :right }
69
67
  ]
70
68
  end
71
- tbl << [{ :content => "Subtotal" , :colspan => 5, :align => :right }, { :content => sprintf("%.2f", order.subtotal ) , :align => :right }]
72
- tbl << [{ :content => "Tax" , :colspan => 5, :align => :right }, { :content => sprintf("%.2f", order.tax ) , :align => :right }]
73
- tbl << [{ :content => "#{order.shipping_method} Shipping & Handling" , :colspan => 5, :align => :right }, { :content => sprintf("%.2f", order.shipping + order.handling) , :align => :right }]
74
- tbl << [{ :content => "Discount" , :colspan => 5, :align => :right }, { :content => sprintf("%.2f", order.discount ) , :align => :right }]
75
- tbl << [{ :content => "Total" , :colspan => 5, :align => :right }, { :content => sprintf("%.2f", order.total ) , :align => :right }]
69
+ tbl << [{ :content => "Subtotal" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.subtotal ) , :align => :right }]
70
+ tbl << [{ :content => "Tax" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.tax ? order.tax : 0.0 ) , :align => :right }]
71
+ tbl << [{ :content => "#{order.shipping_method} Shipping & Handling" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.shipping_and_handling ) , :align => :right }]
72
+ tbl << [{ :content => "Discount" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.discount ? order.discount : 0.0 ) , :align => :right }]
73
+ tbl << [{ :content => "Total" , :colspan => 4, :align => :right }, { :content => sprintf("%.2f", order.total ) , :align => :right }]
76
74
 
77
75
  table tbl
78
76
  end
@@ -1,3 +1,3 @@
1
1
  module CabooseStore
2
- VERSION = '0.0.26'
2
+ VERSION = '0.0.27'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.26
4
+ version: 0.0.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-25 00:00:00.000000000 Z
11
+ date: 2014-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: caboose-cms