extface 0.2.3 → 0.2.4

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26e194d96503291176e30f033e6da0fd08c0c8d3
4
- data.tar.gz: 1a5245753295ef5bdede712a3b1f3630a951d5ee
3
+ metadata.gz: c5694ea075490fadb29202d3113d02a0963ab8d1
4
+ data.tar.gz: 0fccac085b944d300d7571da5652e8e7687e24e0
5
5
  SHA512:
6
- metadata.gz: 721dcf1ed4d2262cd581dc468bae1c149a1a9c8e0d7d19ae0ef08c065faea54e44b2698a7c349da443c47b2764e15ddc1273e02dd84fad37dddaa0217ba8464a
7
- data.tar.gz: fb5a48ef620c50c217c5bab0b6f3c077fab1a7a8a7c5693ddcb2554bf80538f647b6fbfaacf20e4973813570bd3cdaf713e43415fb4867728d8cf5f00079c2df
6
+ metadata.gz: 5cd19d2b097b1891328347a7c1780c6d45bb6a8e9ae3d346e731f28aa8f1ff3aab457845e305a7ba79aad1a42bf19817664fc93599df0516a07637736972b064
7
+ data.tar.gz: a8d425df6a8f08ac450401a09d1d48c445fc8b3036785c79e99e33996824e32bdb8e3e7a21b7fe01b3c211959f58ba0886eece123052260afb6eba24bb52ee78
@@ -51,7 +51,21 @@ module Extface
51
51
 
52
52
  def test_page
53
53
  set_device
54
- @job = @device.driver.print_test_page if params[:test_page]
54
+ if @device.fiscal?
55
+ @job = @device.session("Print Test") do |s|
56
+ s.notify "Printing Text"
57
+ s.open_non_fiscal_doc
58
+ s.print "********************************"
59
+ s.print "Extface Print Test".center(32)
60
+ s.print "********************************"
61
+ s.print ""
62
+ s.print "Driver: " + "#{@device.driver.class::NAME}".truncate(24)
63
+ s.close_non_fiscal_doc
64
+ s.notify "Printing finished"
65
+ end
66
+ else
67
+ @job = @device.driver.print_test_page if params[:test_page]
68
+ end
55
69
  render action: :show
56
70
  end
57
71
 
@@ -36,5 +36,16 @@ module Extface
36
36
  end
37
37
  end
38
38
 
39
+ def driver_control(driver)
40
+ content_tag(:div, class: 'panel panel-default') do
41
+ content_tag(:div, class: 'panel-heading') do
42
+ "#{driver.class::NAME} #{t('.control_panel')}".html_safe
43
+ end +
44
+ content_tag(:div, class: 'panel-body') do
45
+ render "extface/driver/#{driver.class.name.demodulize.underscore}/control"
46
+ end
47
+ end
48
+ end
49
+
39
50
  end
40
51
  end
@@ -74,6 +74,21 @@ module Extface
74
74
  end
75
75
  end
76
76
 
77
+ def open_non_fiscal_doc
78
+ fsend Sales::START_NON_FISCAL_DOC
79
+ @print_session = true
80
+ end
81
+
82
+ def print(text)
83
+ raise "Not in print session" unless @print_session
84
+ fsend Sales::PRINT_NON_FISCAL_TEXT, text
85
+ end
86
+
87
+ def close_non_fiscal_doc
88
+ fsend Sales::END_NON_FISCAL_DOC
89
+ @print_session = false
90
+ end
91
+
77
92
  def fiscal_test
78
93
  sale_and_pay_items_session([
79
94
  { price: 0.01, text1: "Extface Test" }
@@ -80,17 +80,32 @@ module Extface
80
80
  def non_fiscal_test
81
81
  device.session("Non Fiscal Text") do |s|
82
82
  s.notify "Printing Non Fiscal Text"
83
- s.open_receipt Receipt::Variant::START_COMMENT_RECEIPT
83
+ s.open_non_fiscal_doc
84
84
  s.send_comment "********************************"
85
85
  s.send_comment "Extface Print Test".center(32)
86
86
  s.send_comment "********************************"
87
87
  s.send_comment ""
88
88
  s.send_comment "Driver: " + "#{self.class::NAME}".truncate(24)
89
- s.close_receipt
89
+ s.close_non_fiscal_doc
90
90
  s.notify "Printing finished"
91
91
  end
92
92
  end
93
93
 
94
+ def open_non_fiscal_doc
95
+ open_receipt Receipt::Variant::START_COMMENT_RECEIPT
96
+ @print_session = true
97
+ end
98
+
99
+ def print(text)
100
+ raise "Not in print session" unless @print_session
101
+ send_comment text
102
+ end
103
+
104
+ def close_non_fiscal_doc
105
+ close_receipt
106
+ @print_session = false
107
+ end
108
+
94
109
  def fiscal_test
95
110
  sale_and_pay_items_session([
96
111
  { price: 0.01, text1: "Extface Test" }
@@ -118,15 +133,18 @@ module Extface
118
133
 
119
134
  def sale_and_pay_items_session(items = [], operator = "1", password = "1")
120
135
  device.session("Fiscal Doc") do |s|
121
- s.notify "Fiscal Doc Start"
136
+ s.notify "Open Fiscal Receipt"
122
137
  s.open_receipt
138
+ s.notify "Register Sale"
123
139
  items.each do |item|
124
140
  s.send_plu build_sale_data(item[:price], item[:text1], nil, item[:tax_group], item[:qty], nil, nil, item[:number])
125
141
  s.send_comment(item[:text2]) unless item[:text2].blank?
126
142
  end
143
+ s.notify "Register Payment"
127
144
  s.send_payment
145
+ s.notify "Close Fiscal Receipt"
128
146
  s.close_receipt
129
- s.notify "Fiscal Doc End"
147
+ s.notify "Fiscalization Completed!"
130
148
  end
131
149
  end
132
150
 
@@ -66,7 +66,9 @@
66
66
 
67
67
  <hr />
68
68
 
69
- <% if @device.print? %>
69
+ <%= driver_control @device.driver %>
70
+
71
+ <% if true #@device.print? %>
70
72
  <%= button_to 'Print Test Page', test_page_device_path(@device), remote: true, name: :test_page, value: true, class: 'btn btn-warning' %>
71
73
  <% end %>
72
74
  <% if @device.fiscal? %>
@@ -0,0 +1 @@
1
+ <%= __FILE__.gsub(Rails.root.to_s, "") %>
@@ -0,0 +1,12 @@
1
+ <ul class='nav nav-tabs'>
2
+ <li class='active'><%= link_to t('.status'), '#status', data: { toggle: :tab } %></li>
3
+ <li><%= link_to t('.reports'), '#reports', data: { toggle: :tab } %></li>
4
+ </ul>
5
+ <div class='tab-content'>
6
+ <div class='tab-pane active' id='status'>
7
+ Status Pane
8
+ </div>
9
+ <div class='tab-pane' id='reports'>
10
+ Reports Pane
11
+ </div>
12
+ </div>
@@ -0,0 +1 @@
1
+ <%= __FILE__.gsub(Rails.root.to_s, "") %>
@@ -0,0 +1 @@
1
+ <%= __FILE__.gsub(Rails.root.to_s, "") %>
@@ -0,0 +1 @@
1
+ <%= __FILE__.gsub(Rails.root.to_s, "") %>
@@ -1,3 +1,3 @@
1
1
  module Extface
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extface
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Vangelov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-02 00:00:00.000000000 Z
11
+ date: 2014-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -109,10 +109,15 @@ files:
109
109
  - app/views/extface/devices/form.html.erb
110
110
  - app/views/extface/devices/index.html.erb
111
111
  - app/views/extface/devices/show.html.erb
112
+ - app/views/extface/driver/daisy_fx1200/_control.html.erb
112
113
  - app/views/extface/driver/daisy_fx1200/_settings.html.erb
114
+ - app/views/extface/driver/eltrade_tm_u220/_control.html.erb
113
115
  - app/views/extface/driver/eltrade_tm_u220/_settings.html.erb
116
+ - app/views/extface/driver/generic_pos/_control.html.erb
114
117
  - app/views/extface/driver/generic_pos/_settings.html.erb
118
+ - app/views/extface/driver/star_scp700/_control.html.erb
115
119
  - app/views/extface/driver/star_scp700/_settings.html.erb
120
+ - app/views/extface/driver/star_tsp200/_control.html.erb
116
121
  - app/views/extface/driver/star_tsp200/_settings.html.erb
117
122
  - app/views/extface/jobs/_form.html.erb
118
123
  - app/views/extface/jobs/edit.html.erb