app/models/extface/driver/daisy_fx1200.rb in extface-0.6.1 vs app/models/extface/driver/daisy_fx1200.rb in extface-0.6.2
- old
+ new
@@ -207,11 +207,11 @@
fsend(Info::STATUS) # return 6 byte status
errors.empty?
end
def build_packet(cmd, data = "")
- String.new.tap() do |packet|
+ "".b.tap() do |packet|
packet << STX
packet << 0x20 + 4 + data.length
packet << sequence_number
packet << cmd
packet << data
@@ -292,20 +292,20 @@
return rframe
end
private
def build_sale_data(item)
- encoded_text1 = device.encoding.present? ? item.text1.encode(device.encoding) : item.text1
+ encoded_text1 = device.encoding.present? ? item.text1.encode(device.encoding).b : item.text1
encoded_text1 = encoded_text1.mb_chars.limit(27).to_s + '...' if encoded_text1 && encoded_text1.b.length > 30
- encoded_text2 = device.encoding.present? ? item.text2.encode(device.encoding) : item.text2
+ encoded_text2 = device.encoding.present? ? item.text2.encode(device.encoding).b : item.text2
encoded_text2 = encoded_text1.mb_chars.limit(27).to_s + '...' if encoded_text2 && encoded_text2.b.length > 30
- "".tap() do |data|
+ "".b.tap() do |data|
data << encoded_text1 unless encoded_text1.blank?
data << "\x0a#{encoded_text2}" unless encoded_text2.blank?
data << "\t"
- data << TAX_GROUPS_MAP[item.tax_group || 2]
+ data << TAX_GROUPS_MAP[item.tax_group || 2].b
data << ("%.2f" % item.price)
data << "*#{item.qty.to_s}" unless item.qty.blank?
data << ",#{item.percent}" unless item.percent.blank?
data << "$#{'%.2f' % item.neto}" unless item.neto.blank?
end
\ No newline at end of file