billing 0.1.2 → 0.1.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88ff829bdbd83ab185e5ca53228d2b21c617ced3
|
4
|
+
data.tar.gz: 8a1e290b31270563089268bcd39e3368641e831f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5daaed3e3b140280f2b91cdfe780350f4755e1e8f64ca3f144a910b0dd5b35afffa7add8e3bd4ef587243ee6c921e1b47a0a34fb4da8c13576b147557930a1de
|
7
|
+
data.tar.gz: 9f6946cd864e9280b30de05cac0c14654130900419dd61a42cef8f452cefed6ac9f251c956ac01fc3fb07cbaaf0a1f6f8075d0d1b566bce2ab50c8428a2b9251
|
@@ -22,17 +22,17 @@ module Billing
|
|
22
22
|
bill.print_job.runtime do |s|
|
23
23
|
return unless bill.printable?
|
24
24
|
s.notify "Print Doc Start"
|
25
|
+
|
26
|
+
s.print "#{bill.origin.print_header}\r\n"
|
27
|
+
s.print_center_row "******"
|
28
|
+
s.print "#{bill.name}\r\n"
|
29
|
+
s.print_fill_row "-"
|
25
30
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
s.print "\r\n------------------------------\r\n"
|
30
|
-
|
31
|
-
bill.charges.each do |charge|
|
32
|
-
text = "#{charge.qty ? charge.qty : 1} x #{charge.name}"
|
33
|
-
s.print "\r\n#{text.truncate(22).ljust(22)} #{charge.price.to_s.rjust(7)}\r\n"
|
31
|
+
bill.charges.each_with_index do |charge, index|
|
32
|
+
s.print "\r\n" unless index == 0
|
33
|
+
s.print_text_price_row "#{charge.qty ? charge.qty : 1} x #{charge.name}", charge.price
|
34
34
|
if charge.description
|
35
|
-
s.
|
35
|
+
s.print_ljust_row charge.description, ' ', 4
|
36
36
|
end
|
37
37
|
if charge.modifier.present?
|
38
38
|
text = charge.modifier.percent_ratio.nil? ? "" : " #{charge.modifier.percentage}"
|
@@ -41,10 +41,10 @@ module Billing
|
|
41
41
|
else
|
42
42
|
text += " #{ bill.origin.receipt_config ? bill.origin.receipt_config.discount_text || 'Discount' : 'Discount' }"
|
43
43
|
end
|
44
|
-
s.
|
44
|
+
s.print_text_price_row text, (charge.value - charge.price)
|
45
45
|
end
|
46
46
|
end
|
47
|
-
s.
|
47
|
+
s.print_rjust_row "-----------"
|
48
48
|
if bill.modifiers.global.any?
|
49
49
|
global_modifier = bill.modifiers.global.first
|
50
50
|
text = global_modifier.percent_ratio.nil? ? "" : " #{global_modifier.percentage}"
|
@@ -53,20 +53,18 @@ module Billing
|
|
53
53
|
else
|
54
54
|
text += " #{ bill.origin.receipt_config ? bill.origin.receipt_config.discount_text || 'Discount' : 'Discount' }"
|
55
55
|
end
|
56
|
-
s.
|
56
|
+
s.print_text_price_row text, bill.global_modifier_value
|
57
57
|
end
|
58
|
-
s.
|
59
|
-
|
60
|
-
# s.print "..............................\r\n"
|
61
|
-
# bill.payments.each do |payment|
|
62
|
-
# s.print "#{payment.payment_type.name.humanize}\r\n"
|
63
|
-
# end
|
58
|
+
s.print_text_price_row "TOTAL:", bill.total
|
64
59
|
|
65
|
-
s.
|
66
|
-
s.print bill.origin.print_footer
|
67
|
-
s.
|
68
|
-
s.
|
60
|
+
s.print_center_row "******"
|
61
|
+
s.print "#{bill.origin.print_footer}\r\n"
|
62
|
+
s.print_fill_row "-"
|
63
|
+
s.print_edges_row bill.number, Time.now.strftime("%Y-%d-%m %T")
|
69
64
|
s.print "\r\n\r\n\r\n"
|
65
|
+
s.try :autocut if bill.origin.receipt_config.try(:paper_cut)
|
66
|
+
s.try :beep if bill.origin.receipt_config.try(:sound_signal)
|
67
|
+
s.try :pulse if bill.origin.receipt_config.try(:open_cash_drawer)
|
70
68
|
s.notify "Print Doc End"
|
71
69
|
end
|
72
70
|
rescue Resque::TermException
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module Billing
|
2
2
|
class ReceiptConfig < ActiveRecord::Base
|
3
|
-
has_many :origins, inverse_of: :receipt_config
|
3
|
+
has_many :origins, inverse_of: :receipt_config, dependent: :restrict_with_exception
|
4
|
+
validates :name, presence: true, uniqueness: { scope: :master_id }
|
4
5
|
end
|
5
6
|
end
|
data/lib/billing/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: billing
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Vangelov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -181,6 +181,7 @@ files:
|
|
181
181
|
- db/migrate/20160824235224_add_print_headers_to_billing_origin.rb
|
182
182
|
- db/migrate/20160828145106_create_billing_receipt_configs.rb
|
183
183
|
- db/migrate/20160828145448_add_receipt_config_to_billing_origin.rb
|
184
|
+
- db/migrate/20160831231640_add_paper_cut_to_billing_receipt_config.rb
|
184
185
|
- lib/billing.rb
|
185
186
|
- lib/billing/billable.rb
|
186
187
|
- lib/billing/engine.rb
|