Update
This commit is contained in:
@@ -22,6 +22,22 @@ class Api::BillController < Api::ApiController
|
||||
@status, @sale_id = @sale.generate_invoice_from_order(params[:order_id], current_login_employee)
|
||||
|
||||
end
|
||||
|
||||
unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.where('customer_id=' + @sale.customer_id)
|
||||
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
# find order id by sale id
|
||||
# sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
|
||||
|
||||
# Calculate Food and Beverage Total
|
||||
food_total, beverage_total = SaleItem.calculate_food_beverage(@sale.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,@sale.sale_items,@sale,customer.name, food_total, beverage_total)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
sale_payment = SalePayment.new
|
||||
sale_payment.process_payment(saleObj, @user, cash, "cash")
|
||||
|
||||
unique_code = "ReceiptBillPdf"
|
||||
unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.find(saleObj.customer_id)
|
||||
|
||||
# get member information
|
||||
@@ -20,11 +20,10 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
# Calculate Food and Beverage Total
|
||||
food_total, beverage_total = SaleItem.calculate_food_beverage(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, food_total, beverage_total, member_info)
|
||||
end
|
||||
end
|
||||
@@ -41,7 +40,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@sale_data = Sale.find_by_sale_id(sale_id)
|
||||
|
||||
#get customer amount
|
||||
@customer = Customer.find(@sale_data.customer_id)
|
||||
@customer = Customer.find(@sale_data.customer_id)
|
||||
|
||||
# get member information
|
||||
response = Customer.get_member_account(@customer)
|
||||
@@ -84,19 +83,19 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
|
||||
saleObj = Sale.find(sale_id)
|
||||
|
||||
unique_code = "ReceiptBillPdf"
|
||||
unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.find(saleObj.customer_id)
|
||||
|
||||
# get member information
|
||||
member_info = Customer.get_member_account(customer)
|
||||
|
||||
|
||||
# get printer info
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
|
||||
# Calculate Food and Beverage Total
|
||||
food_total, beverage_total = SaleItem.calculate_food_beverage(saleObj.sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
printer.print_receipt_bill(print_settings,saleObj.sale_items,saleObj,customer.name, food_total, beverage_total, member_info)
|
||||
end
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
|
||||
self.print(filename)
|
||||
end
|
||||
|
||||
|
||||
def print_receipt_payment_by_foc(sale_id)
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
@@ -70,6 +70,7 @@ class Printer::ReceiptPrinter < Printer::PrinterWorker
|
||||
#Generate PDF
|
||||
#Print
|
||||
pdf = ReceiptBillPdf.new(printer_settings, sale_items, sale_data, customer_name, food_total, beverage_total, member_info)
|
||||
|
||||
pdf.render_file "tmp/receipt_bill.pdf"
|
||||
self.print("tmp/receipt_bill.pdf")
|
||||
end
|
||||
|
||||
@@ -11,7 +11,6 @@ class ReceiptBillPdf < Prawn::Document
|
||||
self.item_height = 15
|
||||
self.item_description_width = (self.page_width-20) / 2
|
||||
self.label_width = 100
|
||||
|
||||
# @item_width = self.page_width.to_i / 2
|
||||
# @qty_width = @item_width.to_i / 3
|
||||
# @double = @qty_width * 1.3
|
||||
@@ -36,7 +35,6 @@ class ReceiptBillPdf < Prawn::Document
|
||||
if member_info != nil
|
||||
member_info(member_info)
|
||||
end
|
||||
|
||||
footer
|
||||
end
|
||||
|
||||
@@ -206,10 +204,10 @@ class ReceiptBillPdf < Prawn::Document
|
||||
|
||||
# show member information
|
||||
def member_info(member_info)
|
||||
|
||||
|
||||
move_down 7
|
||||
if member_info["status"] == true
|
||||
member_info["data"].each do |res|
|
||||
if member_info["status"] == true
|
||||
member_info["data"].each do |res|
|
||||
|
||||
move_down 5
|
||||
y_position = cursor
|
||||
@@ -219,9 +217,9 @@ class ReceiptBillPdf < Prawn::Document
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{ res["balance"] }" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def footer
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
<div class="form-inputs">
|
||||
<%= f.input :station_name %>
|
||||
<%= f.input :is_active %>
|
||||
|
||||
|
||||
<%= f.input :printer_name %>
|
||||
<%= f.input :font_size %>
|
||||
<%= f.input :print_copy %>
|
||||
<%= f.input :cut_per_item %>
|
||||
<%= f.input :use_alternate_name %>
|
||||
<%= f.input :processing_items, as: :hidden %>
|
||||
|
||||
<%= f.input :auto_print %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<tr>
|
||||
<td><%= link_to settings_order_queue_station.station_name, settings_order_queue_station_path(settings_order_queue_station) %></td>
|
||||
<td><%= settings_order_queue_station.is_active %></td>
|
||||
|
||||
<td><%= settings_order_queue_station.auto_print %></td>
|
||||
<td><%= settings_order_queue_station.print_copy %></td>
|
||||
<td><%= settings_order_queue_station.printer_name %></td>
|
||||
<td><%= settings_order_queue_station.cut_per_item %></td>
|
||||
|
||||
Reference in New Issue
Block a user