app/jobs/billing/issue_print_doc.rb in billing-0.1.0 vs app/jobs/billing/issue_print_doc.rb in billing-0.1.1
- old
+ new
@@ -28,31 +28,31 @@
s.print "#{bill.name}".truncate(30)
s.print "\r\n------------------------------\r\n"
bill.charges.each do |charge|
text = "#{charge.qty ? charge.qty : 1} x #{charge.name}"
- s.print "\r\n#{text.ljust(22)} #{charge.price.to_s.rjust(7)}\r\n"
+ s.print "\r\n#{text.truncate(22).ljust(22)} #{charge.price.to_s.rjust(7)}\r\n"
if charge.description
- s.print "#{charge.description.truncate(30)}\r\n"
+ s.print "#{charge.description.truncate(26)}\r\n"
end
if charge.modifier.present?
text = charge.modifier.percent_ratio.nil? ? "" : " #{charge.modifier.percentage}"
if charge.modifier.positive?
- text += " Surcharge"
+ text += " #{ bill.origin.receipt_config ? bill.origin.receipt_config.surcharge_text || 'Surcharge' : 'Surcharge' }"
else
- text += " Discount"
+ text += " #{ bill.origin.receipt_config ? bill.origin.receipt_config.discount_text || 'Discount' : 'Discount' }"
end
s.print "#{text.ljust(22)} #{(charge.value - charge.price).to_s.rjust(7)}\r\n"
end
end
s.print "-----------\r\n".rjust(32)
if bill.modifiers.global.any?
global_modifier = bill.modifiers.global.first
text = global_modifier.percent_ratio.nil? ? "" : " #{global_modifier.percentage}"
if global_modifier.positive?
- text += " Surcharge"
+ text += " #{ bill.origin.receipt_config ? bill.origin.receipt_config.surcharge_text || 'Surcharge' : 'Surcharge' }"
else
- text += " Discount"
+ text += " #{ bill.origin.receipt_config ? bill.origin.receipt_config.discount_text || 'Discount' : 'Discount' }"
end
s.print "#{text.ljust(22)} #{bill.global_modifier_value.to_s.rjust(7)}\r\n"
end
s.print "TOTAL: #{bill.total.to_s.rjust(20)}\r\n"
\ No newline at end of file