class Printer::ReceiptPrinter < Printer::PrinterWorker

  def print_receipt(receipt_no)
    #Use CUPS service
    #Generate PDF
    #Print
    pdf = OrderItemPdf.new
    pdf.render_file "tmp/order_item_queue_#{order_id}_#{order_item_id}" + ".pdf"
    self.print("tmp/receipt.pdf")
  end

  def print_receipt_payment_by_card(booking_id)
    #Use CUPS service
    #Generate PDF
    #Print
    filename = "tmp/order_summary_#{booking_id}" + ".pdf"
    pdf = OrderSummaryPdf.new
    pdf.render_file filename

    self.print(filename)
  end

  def print_receipt_payment_by_account(sale_id)
    #Use CUPS service
    #Generate PDF
    #Print
    filename = "tmp/order_summary_#{booking_id}" + ".pdf"
    pdf = OrderSummaryPdf.new
    pdf.render_file filename

    self.print(filename)
  end

  def print_receipt_payment_by_vochure(sale_id)
    #Use CUPS service
    #Generate PDF
    #Print
    filename = "tmp/order_summary_#{booking_id}" + ".pdf"
    pdf = OrderSummaryPdf.new
    pdf.render_file filename

    self.print(filename)
  end

  def print_receipt_payment_by_giftcard(sale_id)
    #Use CUPS service
    #Generate PDF
    #Print
    filename = "tmp/order_summary_#{booking_id}" + ".pdf"
    pdf = OrderSummaryPdf.new
    pdf.render_file filename

    self.print(filename)
  end

  def print_receipt_payment_by_foc(sale_id)
    #Use CUPS service
    #Generate PDF
    #Print
    filename = "tmp/order_summary_#{booking_id}" + ".pdf"
    pdf = OrderSummaryPdf.new
    pdf.render_file filename

    self.print(filename)
  end

  #Bill Receipt Print
  def print_receipt_bill(printer_settings,sale_items,sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info = nil,rebate_amount=nil,shop_details, printed_status)
    #Use CUPS service
    #Generate PDF
    #Print

    pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details,printed_status)

    # print as print copies in printer setting
    count = printer_settings.print_copies
    begin 
      pdf.render_file "tmp/receipt_bill.pdf"
      self.print("tmp/receipt_bill.pdf")
      count -= 1
    end until count == 0      
  end

  #Queue No Print
  def print_queue_no(printer_settings,queue)
    #Use CUPS service
    #Generate PDF
    #Print
    pdf = QueueNoPdf.new(printer_settings,queue)
        pdf.render_file "tmp/print_queue_no.pdf"
    self.print("tmp/print_queue_no.pdf")
  end

  #Bill Receipt Print
  def print_crm_order(booking,order_items,setting)
    #Use CUPS service
    #Generate PDF
    #Print
    pdf = CrmOrderPdf.new(booking,order_items,setting)
        pdf.render_file "tmp/print_crm_order.pdf"
    self.print("tmp/print_crm_order.pdf")
  end
end
