extface 0.4.5 → 0.4.6a
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/extface/api_driver.rb +4 -0
- data/app/models/extface/driver/base/fiscal.rb +0 -2
- data/app/models/extface/driver/clock/pms.rb +5 -0
- data/app/models/extface/driver/daisy_fx1200.rb +2 -2
- data/app/models/extface/driver/datecs/commands_v1.rb +38 -0
- data/app/models/extface/driver/datecs/fp550.rb +119 -0
- data/app/views/extface/driver/_control_fiscal.html.erb +1 -1
- data/app/views/extface/driver/datecs/fp550/_control.html.erb +11 -1
- data/lib/extface/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6a5e92df95302c771ddb50d19300c437e18b089
|
4
|
+
data.tar.gz: d371929e63c4779cf028f6464d03266fc5e00e7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 213e8d580c1e35bf442b3c49c3f4251cf7e0d47843beccc245254ef2705445931adea025c0589390e72c800a61d1c3b854a60166521f3d6142753a6ab0ee1861
|
7
|
+
data.tar.gz: fe4b57ffe2d57fc16f6e2958543fa43bcbaba43fc333c170d60d1d9a2ec0c13e4b827d61fb4bdec45b279cfc8ed3332ed84ee134a9bf540ed3474bda8ed65e7b
|
@@ -48,8 +48,6 @@ module Extface
|
|
48
48
|
def add_total_modifier(fixed_value = nil, percent_ratio = nil) raise_not_implemented end
|
49
49
|
def total_payment() raise_not_implemented end #auto calculated total default payment
|
50
50
|
def close_fiscal_doc() raise_not_implemented end
|
51
|
-
|
52
|
-
def cancel_doc_session() raise_not_implemented end #repair from broken doc session
|
53
51
|
|
54
52
|
#fiscal basket session of Extface::Driver::Base::Fiscal::SaleItem instances
|
55
53
|
def sale_and_pay_items_session(sale_items = [], operator = '', password = '') raise_not_implemented end
|
@@ -27,5 +27,43 @@ module Extface
|
|
27
27
|
PAPER_MOVE = 0x2C
|
28
28
|
PAPER_CUT = 0x2D
|
29
29
|
end
|
30
|
+
|
31
|
+
module Sales
|
32
|
+
START_NON_FISCAL_DOC = 0x26 #other
|
33
|
+
END_NON_FISCAL_DOC = 0x27 #other
|
34
|
+
PRINT_NON_FISCAL_TEXT = 0x2a #other
|
35
|
+
START_FISCAL_DOC = 0x30
|
36
|
+
SALE = 0x31
|
37
|
+
SUBTOTAL = 0x33
|
38
|
+
SALE_AND_SHOW = 0x34
|
39
|
+
TOTAL = 0x35
|
40
|
+
PRINT_FISCAL_TEXT = 0x36
|
41
|
+
END_FISCAL_DOC = 0x38
|
42
|
+
PRINT_INFO_FOR_CLIENT = 0x39
|
43
|
+
SALE_ITEM = 0x3a
|
44
|
+
CANCEL_FISCAL_DOC = 0x3c
|
45
|
+
PRINT_BARCODE = 0x54
|
46
|
+
PRINT_DUPLICATE_DOC = 0x6d
|
47
|
+
end
|
48
|
+
|
49
|
+
module Reports
|
50
|
+
REPORT_FP_BY_NUMBER = 0x49
|
51
|
+
COMPACT_REPORT_FP_BY_DATE = 0x4f
|
52
|
+
REPORT_FP_BY_DATE = 0x5e
|
53
|
+
COMPACT_REPORT_FP_BY_NUM = 0x5f
|
54
|
+
REPORT_BY_OPERATORS = 0x69
|
55
|
+
REPORT_BY_ITEMS = 0x6F
|
56
|
+
end
|
57
|
+
|
58
|
+
module Closure
|
59
|
+
DAY_FIN_REPORT = 0x45
|
60
|
+
EXPANDED_DAY_FIN_REPORT = 0x6c
|
61
|
+
EXPANDED_DAY_FIN_REPORT_BY_DEPS = 0x75
|
62
|
+
EXPANDED_DAY_FIN_REPORT_BY_ITEMS = 0x76
|
63
|
+
end
|
64
|
+
|
65
|
+
module Other
|
66
|
+
PAYED_RECV_ACCOUNT = 0x46
|
67
|
+
end
|
30
68
|
end
|
31
69
|
end
|
@@ -16,12 +16,129 @@ module Extface
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
#tests
|
20
|
+
def non_fiscal_test
|
21
|
+
device.session("Non Fiscal Text") do |s|
|
22
|
+
s.notify "Printing Non Fiscal Text"
|
23
|
+
s.open_non_fiscal_doc
|
24
|
+
s.print "********************************"
|
25
|
+
s.print "Extface Print Test".center(32)
|
26
|
+
s.print "********************************"
|
27
|
+
s.fsend Printer::PAPER_MOVE, "1"
|
28
|
+
s.print "Driver: " + "#{self.class::NAME}".truncate(24)
|
29
|
+
s.close_non_fiscal_doc
|
30
|
+
s.notify "Printing finished"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def fiscal_test
|
35
|
+
sale_and_pay_items_session([
|
36
|
+
SaleItem.new( price: 0.01, text1: "Extface Test" )
|
37
|
+
])
|
38
|
+
end
|
39
|
+
|
40
|
+
#reports
|
41
|
+
def z_report_session
|
42
|
+
device.session("Z Report") do |s|
|
43
|
+
s.notify "Z Report Start"
|
44
|
+
s.fsend Closure::DAY_FIN_REPORT, "0"
|
45
|
+
s.notify "Z Report End"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def x_report_session
|
50
|
+
device.session("X Report") do |s|
|
51
|
+
s.notify "X Report Start"
|
52
|
+
s.fsend Closure::DAY_FIN_REPORT, "2"
|
53
|
+
s.notify "X Report End"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
#print
|
58
|
+
def open_non_fiscal_doc
|
59
|
+
fsend Sales::START_NON_FISCAL_DOC
|
60
|
+
@print_session = true
|
61
|
+
end
|
62
|
+
|
63
|
+
def print(text) #up to 38 sybols, TODO check
|
64
|
+
raise "Not in print session" unless @print_session
|
65
|
+
fsend Sales::PRINT_NON_FISCAL_TEXT, text
|
66
|
+
end
|
67
|
+
|
68
|
+
def close_non_fiscal_doc
|
69
|
+
fsend Sales::END_NON_FISCAL_DOC
|
70
|
+
@print_session = false
|
71
|
+
end
|
72
|
+
|
19
73
|
def check_status
|
20
74
|
flush #clear receive buffer
|
21
75
|
fsend(Info::GET_STATUS, 'X') # get 6 bytes status
|
22
76
|
errors.empty?
|
23
77
|
end
|
24
78
|
|
79
|
+
#fiscal
|
80
|
+
def open_fiscal_doc(operator = "1", password = "1")
|
81
|
+
fsend Sales::START_FISCAL_DOC, "#{operator.presence || "1"},#{password.presence || "1"},00001"
|
82
|
+
@fiscal_session = true
|
83
|
+
end
|
84
|
+
|
85
|
+
def close_fiscal_doc
|
86
|
+
raise "Not in fiscal session" unless @fiscal_session
|
87
|
+
fsend Sales::END_FISCAL_DOC
|
88
|
+
@fiscal_session = false
|
89
|
+
end
|
90
|
+
|
91
|
+
def add_sale(sale_item)
|
92
|
+
raise "Not in fiscal session" unless @fiscal_session
|
93
|
+
fsend Sales::SALE_AND_SHOW, build_sale_data(sale_item)
|
94
|
+
end
|
95
|
+
|
96
|
+
def add_comment(text)
|
97
|
+
raise "Not in fiscal session" unless @fiscal_session
|
98
|
+
end
|
99
|
+
|
100
|
+
def add_payment(value = nil, type_num = nil)
|
101
|
+
raise "Not in fiscal session" unless @fiscal_session
|
102
|
+
payment_data = "".tap() do |data|
|
103
|
+
data << "\t"
|
104
|
+
data << PAYMENT_TYPE_MAP[type_num || 1]
|
105
|
+
data << ("%.2f" % value) unless value.blank?
|
106
|
+
end
|
107
|
+
fsend(Sales::TOTAL, payment_data)
|
108
|
+
end
|
109
|
+
|
110
|
+
def total_payment
|
111
|
+
raise "Not in fiscal session" unless @fiscal_session
|
112
|
+
fsend(Sales::TOTAL, "\t")
|
113
|
+
end
|
114
|
+
|
115
|
+
#basket
|
116
|
+
def sale_and_pay_items_session(items = [], operator = "1", password = "1")
|
117
|
+
device.session("Fiscal Doc") do |s|
|
118
|
+
s.notify "Fiscal Doc Start"
|
119
|
+
s.open_fiscal_doc
|
120
|
+
s.notify "Register Sale"
|
121
|
+
items.each do |item|
|
122
|
+
s.add_sale(item)
|
123
|
+
end
|
124
|
+
s.notify "Register Payment"
|
125
|
+
s.total_payment
|
126
|
+
s.notify "Close Fiscal Receipt"
|
127
|
+
s.close_fiscal_doc
|
128
|
+
s.notify "Fiscal Doc End"
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
def cancel_doc_session
|
133
|
+
device.session("Doc cancel") do |s|
|
134
|
+
s.notify "Doc Cancel Start"
|
135
|
+
s.fsend Sales::CANCEL_FISCAL_DOC
|
136
|
+
s.paper_cut
|
137
|
+
s.notify "Doc Cancel End"
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
#common
|
25
142
|
def fsend(cmd, data = "") #return data or nil
|
26
143
|
packet_data = build_packet(cmd, data) #store packet to be able to re-transmit it with the same sequence number
|
27
144
|
result = false
|
@@ -96,6 +213,8 @@ module Extface
|
|
96
213
|
errors.add :base, "Date & Time Not Set" unless (status_0 & 0x04).zero?
|
97
214
|
errors.add :base, "Syntax Error" unless (status_0 & 0x02).zero?
|
98
215
|
status_1 = status[1].ord
|
216
|
+
errors.add :base, "Unpermitted Command In This Mode" unless (status_1 & 0x02).zero?
|
217
|
+
errors.add :base, "Field Overflow" unless (status_1 & 0x01).zero?
|
99
218
|
end
|
100
219
|
|
101
220
|
private
|
@@ -4,5 +4,5 @@
|
|
4
4
|
<%= button_to 'X Report', fiscal_device_path(@device), remote: true, name: :x_report, value: true, class: 'btn btn-warning' %>
|
5
5
|
<%= button_to 'Z Report', fiscal_device_path(@device), remote: true, name: :z_report, value: true, class: 'btn btn-warning' %>
|
6
6
|
|
7
|
-
<%= button_to 'Cancel Fiscal Doc', fiscal_device_path(@device), remote: true, name: :cancel_fiscal_doc, value: true, class: 'btn btn-
|
7
|
+
<%= button_to 'Cancel Fiscal Doc', fiscal_device_path(@device), remote: true, name: :cancel_fiscal_doc, value: true, class: 'btn btn-danger' %>
|
8
8
|
|
@@ -1,2 +1,12 @@
|
|
1
1
|
|
2
|
-
<%= button_to 'Paper Cut', fiscal_device_path(@device), remote: true, name: :paper_cut, value: true %>
|
2
|
+
<%= button_to 'Paper Cut', fiscal_device_path(@device), remote: true, name: :paper_cut, value: true, class: 'btn btn-warning' %>
|
3
|
+
|
4
|
+
<%= button_to 'Non Fiscal Test', fiscal_device_path(@device), remote: true, name: :non_fiscal_test, value: true, class: 'btn btn-warning' %>
|
5
|
+
|
6
|
+
<%= button_to 'Fiscal Test', fiscal_device_path(@device), remote: true, name: :fiscal_test, value: true, class: 'btn btn-warning' %>
|
7
|
+
|
8
|
+
<%= button_to 'X Report', fiscal_device_path(@device), remote: true, name: :x_report, value: true, class: 'btn btn-warning' %>
|
9
|
+
<%= button_to 'Z Report', fiscal_device_path(@device), remote: true, name: :z_report, value: true, class: 'btn btn-warning' %>
|
10
|
+
|
11
|
+
<%= button_to 'Cancel Fiscal Doc', fiscal_device_path(@device), remote: true, name: :cancel_fiscal_doc, value: true, class: 'btn btn-danger' %>
|
12
|
+
|
data/lib/extface/version.rb
CHANGED
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.4.
|
4
|
+
version: 0.4.6a
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Vangelov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -109,9 +109,11 @@ files:
|
|
109
109
|
- app/helpers/extface/devices_helper.rb
|
110
110
|
- app/helpers/extface/jobs_helper.rb
|
111
111
|
- app/helpers/extface/sse_helper.rb
|
112
|
+
- app/models/extface/api_driver.rb
|
112
113
|
- app/models/extface/device.rb
|
113
114
|
- app/models/extface/driver.rb
|
114
115
|
- app/models/extface/driver/base/fiscal.rb
|
116
|
+
- app/models/extface/driver/clock/pms.rb
|
115
117
|
- app/models/extface/driver/daisy/commands_fx1200.rb
|
116
118
|
- app/models/extface/driver/daisy_fx1200.rb
|
117
119
|
- app/models/extface/driver/datecs/commands_v1.rb
|
@@ -240,9 +242,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
240
242
|
version: '0'
|
241
243
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
242
244
|
requirements:
|
243
|
-
- - "
|
245
|
+
- - ">"
|
244
246
|
- !ruby/object:Gem::Version
|
245
|
-
version:
|
247
|
+
version: 1.3.1
|
246
248
|
requirements: []
|
247
249
|
rubyforge_project:
|
248
250
|
rubygems_version: 2.4.6
|