app/models/extface/driver/eltrade_tm_u220.rb in extface-0.2.3 vs app/models/extface/driver/eltrade_tm_u220.rb in extface-0.2.4

- old
+ new

@@ -78,21 +78,36 @@ end def non_fiscal_test device.session("Non Fiscal Text") do |s| s.notify "Printing Non Fiscal Text" - s.open_receipt Receipt::Variant::START_COMMENT_RECEIPT + s.open_non_fiscal_doc s.send_comment "********************************" s.send_comment "Extface Print Test".center(32) s.send_comment "********************************" s.send_comment "" s.send_comment "Driver: " + "#{self.class::NAME}".truncate(24) - s.close_receipt + s.close_non_fiscal_doc s.notify "Printing finished" end end + def open_non_fiscal_doc + open_receipt Receipt::Variant::START_COMMENT_RECEIPT + @print_session = true + end + + def print(text) + raise "Not in print session" unless @print_session + send_comment text + end + + def close_non_fiscal_doc + close_receipt + @print_session = false + end + def fiscal_test sale_and_pay_items_session([ { price: 0.01, text1: "Extface Test" } ]) end @@ -116,18 +131,21 @@ end end def sale_and_pay_items_session(items = [], operator = "1", password = "1") device.session("Fiscal Doc") do |s| - s.notify "Fiscal Doc Start" + s.notify "Open Fiscal Receipt" s.open_receipt + s.notify "Register Sale" items.each do |item| s.send_plu build_sale_data(item[:price], item[:text1], nil, item[:tax_group], item[:qty], nil, nil, item[:number]) s.send_comment(item[:text2]) unless item[:text2].blank? end + s.notify "Register Payment" s.send_payment + s.notify "Close Fiscal Receipt" s.close_receipt - s.notify "Fiscal Doc End" + s.notify "Fiscalization Completed!" end end def z_report_session device.session("Z Report") do |s| \ No newline at end of file