caboose-cms 0.7.22 → 0.7.23

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: 2e182d08ac2a4fca718512f594b68708314e0112
4
- data.tar.gz: 3e5e26f3e94a5a89a962d08ce1b2779c31998b2c
3
+ metadata.gz: c8810565edf656b06963523a73967f29337b972e
4
+ data.tar.gz: eba8b83636c10406bf936a241647987e8c3c0e13
5
5
  SHA512:
6
- metadata.gz: f997c33c5c238784ac84c5890a0059ab126f054eccb46243850ca756ccff3f97187d36d85af8382cf877542ddc72d5e1368a1523cd9fe1e0246f2ffb0c1761c6
7
- data.tar.gz: 39b5dd79ba6253c421ba0a3ea0f334625a6c1f8c24e349cf31ee002d475d74d27ae2e7b778fd00d11cb20a14fed34a6b3411b8d612e0ea605e646c88f6923103
6
+ metadata.gz: 02e65e232cc93d3b7e3251e7f2e10adabe6322df9d97b14228896e862595009f41a7de74d454ee42b4ae0a48c4e4e5aec03af828c84505b972c1c995683bb2f2
7
+ data.tar.gz: 079facdd0116807c2b3d6be50bbef2ad8d157bff7f9f576b66a10e1fba1cd32894eaa5e49458fa94381560f7ebfcc02590a52f7d4bf2d8396e26785e6e421f79
@@ -1,11 +1,11 @@
1
1
  <div class="wrapper">
2
2
  <form action="/register" method="post">
3
- <input name="first_name" type="text" placeholder="First Name" />
4
- <input name="last_name" type="text" placeholder="Last Name" />
5
- <input name="email" type="text" placeholder="Email" />
6
- <input name="phone" type="text" placeholder="Phone" />
7
- <input name="pass1" type="password" placeholder="Password" />
8
- <input name="pass2" type="password" placeholder="Confirm Password" />
3
+ <input name="first_name" type="text" placeholder="First Name" />
4
+ <input name="last_name" type="text" placeholder="Last Name" />
5
+ <input name="email" type="text" placeholder="Email" />
6
+ <input name="phone" type="text" placeholder="Phone" />
7
+ <input name="pass1" type="password" placeholder="Password" />
8
+ <input name="pass2" type="password" placeholder="Confirm Password" />
9
9
  <input type="submit" value="Submit" />
10
10
  </form>
11
11
  </div>
@@ -18,18 +18,18 @@ module Caboose
18
18
  order by concat(date_part('year', date_authorized), '-', date_part('month', date_authorized), '-', date_part('day', date_authorized))",
19
19
  @site.id, 'authorized', 'captured', @d1, @d2]
20
20
  rows = ActiveRecord::Base.connection.select_rows(ActiveRecord::Base.send(:sanitize_sql_array, q))
21
- return rows.collect { |row|
22
- {
23
- 'user_id' => row[0],
24
- 'facility_id' => row[1],
25
- 'amount' => row[2],
26
- 'first_name' => row[3],
27
- 'last_name' => row[4],
28
- 'facility_name' => row[5],
29
- 'vendor_type_name' => row[6],
30
- 'anniversary_date' => row[7]
21
+ return rows.collect { |row|
22
+ {
23
+ 'user_id' => row[0],
24
+ 'facility_id' => row[1],
25
+ 'amount' => row[2],
26
+ 'first_name' => row[3],
27
+ 'last_name' => row[4],
28
+ 'facility_name' => row[5],
29
+ 'vendor_type_name' => row[6],
30
+ 'anniversary_date' => row[7]
31
+ }
31
32
  }
32
- }
33
33
 
34
34
  @pager = Caboose::PageBarGenerator.new(params, {
35
35
  'site_id' => @site.id,
@@ -1,11 +1,15 @@
1
-
2
1
  module Caboose
3
2
  class OrderReporter
4
3
 
5
4
  def OrderReporter.summary_report(site_id, d1, d2)
6
5
  q = ["select
7
6
  concat(date_part('year', date_authorized), '-', date_part('month', date_authorized), '-', date_part('day', date_authorized)),
8
- count(*),
7
+ count(*),
8
+ sum(subtotal),
9
+ sum(tax),
10
+ sum(shipping),
11
+ sum(handling),
12
+ sum(discount),
9
13
  sum(total)
10
14
  from store_orders
11
15
  where site_id = ?
@@ -21,9 +25,14 @@ module Caboose
21
25
  rows.each do |row|
22
26
  arr = row[0].split('-')
23
27
  days << Caboose::StdClass.new(
24
- :date => Date.new(arr[0].to_i, arr[1].to_i, arr[2].to_i),
25
- :count => row[1],
26
- :total => row[2]
28
+ :date => Date.new(arr[0].to_i, arr[1].to_i, arr[2].to_i),
29
+ :count => row[1].to_i,
30
+ :subtotal => row[2].to_f,
31
+ :tax => row[3].to_f,
32
+ :shipping => row[4].to_f,
33
+ :handling => row[5].to_f,
34
+ :discount => row[6].to_f,
35
+ :total => row[7].to_f
27
36
  )
28
37
  end
29
38
  days.sort_by!{ |h| h.date }
@@ -32,26 +41,26 @@ module Caboose
32
41
  days2 = []
33
42
  days.each do |h|
34
43
  while (h.date - last_day) > 1
35
- days2 << Caboose::StdClass.new(:date => last_day + 1.day, :count => 0, :total => 0.0)
44
+ days2 << Caboose::StdClass.new(
45
+ :date => last_day + 1.day,
46
+ :count => 0,
47
+ :subtotal => 0.0,
48
+ :tax => 0.0,
49
+ :shipping => 0.0,
50
+ :handling => 0.0,
51
+ :discount => 0.0,
52
+ :total => 0.0
53
+ )
36
54
  last_day = last_day + 1.day
37
55
  end
38
56
  days2 << h
39
57
  last_day = h.date
40
58
  end
41
- days2.each do |h|
42
- puts "#{h.date} #{h.count} #{h.total}"
43
- end
44
- return days2
45
-
46
- #return rows.collect { |row|
47
- # arr = row[0].split('-')
48
- # Caboose::StdClass.new(
49
- # :date => Date.new(arr[0].to_i, arr[1].to_i, arr[2].to_i),
50
- # :count => row[1],
51
- # :total => row[2]
52
- # )
53
- #}
59
+ #days2.each do |h|
60
+ # puts "#{h.date} #{h.count} #{h.total}"
61
+ #end
62
+ return days2
54
63
  end
55
64
 
56
65
  end
57
- end
66
+ end
@@ -1,3 +1,23 @@
1
+ <%
2
+ count = 0
3
+ subtotal = 0.0
4
+ tax = 0.0
5
+ shipping = 0.0
6
+ handling = 0.0
7
+ discount = 0.0
8
+ total = 0.0
9
+ @rows.each do |row|
10
+ count = count + row.count
11
+ subtotal = subtotal + row.subtotal
12
+ tax = tax + row.tax
13
+ shipping = shipping + row.shipping
14
+ handling = handling + row.handling
15
+ discount = discount + row.discount
16
+ total = total + row.total
17
+ end
18
+ day_count = @rows.count
19
+ %>
20
+
1
21
  <h1>Order Summary Report</h1>
2
22
 
3
23
  <form action='/admin/orders/summary-report' method='get' id='search_form'>
@@ -8,6 +28,17 @@
8
28
  </p>
9
29
  </form>
10
30
 
31
+ <table class='data'>
32
+ <tr><th>&nbsp;</th><th>Total</th><th>Daily Average</th></tr>
33
+ <tr><td>Count </td><td align='right'><%= count %></td><td align='right'><%= sprintf('%.1f', count.to_f / day_count) %></td></tr>
34
+ <tr><td>Subtotal </td><td align='right'>$<%= sprintf('%.2f', subtotal ) %></td><td align='right'>$<%= sprintf('%.2f', subtotal / day_count) %></td></tr>
35
+ <tr><td>Tax </td><td align='right'>$<%= sprintf('%.2f', tax ) %></td><td align='right'>$<%= sprintf('%.2f', tax / day_count) %></td></tr>
36
+ <tr><td>Shipping </td><td align='right'>$<%= sprintf('%.2f', shipping ) %></td><td align='right'>$<%= sprintf('%.2f', shipping / day_count) %></td></tr>
37
+ <tr><td>Handling </td><td align='right'>$<%= sprintf('%.2f', handling ) %></td><td align='right'>$<%= sprintf('%.2f', handling / day_count) %></td></tr>
38
+ <tr><td>Discount </td><td align='right'>$<%= sprintf('%.2f', discount ) %></td><td align='right'>$<%= sprintf('%.2f', discount / day_count) %></td></tr>
39
+ <tr><td>Total </td><td align='right'>$<%= sprintf('%.2f', total ) %></td><td align='right'>$<%= sprintf('%.2f', total / day_count) %></td></tr>
40
+ </table><br />
41
+
11
42
  <div id='counts_chart'></div>
12
43
  <div id='totals_chart'></div>
13
44
  <p></p>
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.7.22'
2
+ VERSION = '0.7.23'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.22
4
+ version: 0.7.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-07 00:00:00.000000000 Z
11
+ date: 2015-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg