app/models/extface/driver/eltrade_tm_u220.rb in extface-0.4.1b vs app/models/extface/driver/eltrade_tm_u220.rb in extface-0.4.2a

- old
+ new

@@ -73,19 +73,19 @@ s.notify "X Report End" end end def period_report_session(from, to, detailed = true) - device.session("FP Report #{from.to_date.human} = #{to.to_date.human}") do |s| + device.session("FP Report #{from.to_date.human} - #{to.to_date.human} (#{ detailed ? 'detailed' : 'short' })") do |s| dates_bytes = "".b - dates_bytes << from.day - dates_bytes << from.month - dates_bytes << from.year - 2000 + dates_bytes << pbcd(from.day) + dates_bytes << pbcd(from.month) + dates_bytes << pbcd(from.year - 2000) dates_bytes << 0 - dates_bytes << to.day - dates_bytes << to.month - dates_bytes << to.year - 2000 + dates_bytes << pbcd(to.day) + dates_bytes << pbcd(to.month) + dates_bytes << pbcd(to.year - 2000) dates_bytes << 0 s.notify "FP Report Start" s.fsend detailed ? Reports::FP_DETAILED_DATES : Reports::FP_GENERAL_DATES, dates_bytes status = s.get_printer_status s.notify "FP Report End" @@ -264,9 +264,13 @@ return Frame.new(frame_bytes.b) else errors.add :base, "No data received from device" return nil end + end + + def pbcd(byte) + ((byte / 10) << 4) | (byte % 10) end private def open_receipt(variant = nil) fsend Receipt::OPEN_RECEIPT \ No newline at end of file