no print for cloud

This commit is contained in:
Yan
2017-12-12 18:51:13 +06:30
parent dcb3a37a81
commit c660097d28
14 changed files with 242 additions and 254 deletions

View File

@@ -217,30 +217,29 @@ $(document).on('turbolinks:load', function() {
}); });
// Print Order Item // Print Order Item
$(document).on('click', '#print_order_item', function(event){ // $(document).on('click', '#print_order_item', function(event){
var assigned_item_id = $('.selected-item').children('.card-block').children('.assigned-order-item').text(); // var assigned_item_id = $('.selected-item').children('.card-block').children('.assigned-order-item').text();
var options = $('.selected-item').children('.card-block').find('.item-options').text(); // var options = $('.selected-item').children('.card-block').find('.item-options').text();
var params = { 'options':options }; // var params = { 'options':options };
$.ajax({ // $.ajax({
type: 'GET', // type: 'GET',
url: '/oqs/print/print/'+assigned_item_id, // url: '/oqs/print/print/'+assigned_item_id,
success: function(data){ } // success: function(data){ }
}); // });
}); // });
// Print Order Summary // Print Order Summary
// $('#print_order_summary').on('click',function(){ // $(document).on('click', '#print_order_summary', function(event){
$(document).on('click', '#print_order_summary', function(event){ // var orderNo = $('.selected-item').attr('data-order-no');
var orderNo = $('.selected-item').attr('data-order-no'); // var table_name=$('.selected-item').children().children().children('.order-zone').text().trim();
var table_name=$('.selected-item').children().children().children('.order-zone').text().trim(); // var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text();
var assigned_item_id=$('.selected-item').children('.card-block').children('.assigned-order-item').text(); // var params = { 'table_name':table_name };
var params = { 'table_name':table_name }; // $.ajax({
$.ajax({ // type: 'GET',
type: 'GET', // url: '/oqs/print/print_order_summary/'+assigned_item_id,
url: '/oqs/print/print_order_summary/'+assigned_item_id, // data: params,
data: params, // success: function(data){ }
success: function(data){ } // });
}); // });
});
}); });

View File

@@ -45,13 +45,13 @@ class Crm::DiningQueuesController < BaseCrmController
respond_to do |format| respond_to do |format|
if @dining_queue.save if @dining_queue.save
unique_code = "QueueNoPdf" # unique_code = "QueueNoPdf"
# get printer info # # get printer info
print_settings = PrintSetting.find_by_unique_code(unique_code) # print_settings = PrintSetting.find_by_unique_code(unique_code)
printer = Printer::ReceiptPrinter.new(print_settings) # printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_queue_no(print_settings,@dining_queue) # printer.print_queue_no(print_settings,@dining_queue)
format.html { redirect_to crm_dining_queues_path, notice: 'Queue was successfully created.' } format.html { redirect_to crm_dining_queues_path, notice: 'Queue was successfully created.' }
format.json { render :show, status: :created, location: @dining_queue } format.json { render :show, status: :created, location: @dining_queue }

View File

@@ -33,13 +33,13 @@ class Crm::HomeController < BaseCrmController
end end
unique_code="CrmOrderPdf" # unique_code="CrmOrderPdf"
print_settings = PrintSetting.find_by_unique_code(unique_code) # print_settings = PrintSetting.find_by_unique_code(unique_code)
printer = Printer::ReceiptPrinter.new(print_settings) # printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_crm_order(@booking,order_items,print_settings) # printer.print_crm_order(@booking,order_items,print_settings)
end end

View File

@@ -17,14 +17,14 @@ class Oqs::EditController < BaseOqsController
order_item.save order_item.save
# print # print
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code) # assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
# order queue stations # # order queue stations
oqs = assigned_item.order_queue_station # oqs = assigned_item.order_queue_station
unique_code="OrderItemPdf" # unique_code="OrderItemPdf"
print_settings=PrintSetting.find_by_unique_code(unique_code) # print_settings=PrintSetting.find_by_unique_code(unique_code)
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) # order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Updated)" ) # order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Updated)" )
end end
end end

View File

@@ -1,61 +1,61 @@
class Oqs::PrintController < ApplicationController class Oqs::PrintController < ApplicationController
# Print Order Item # Print Order Item
def print def print
unique_code="OrderItemPdf" # unique_code="OrderItemPdf"
assigned_item_id = params[:id] # assigned_item_id = params[:id]
options = params[:options] # options = params[:options]
assigned_item = AssignedOrderItem.find(assigned_item_id) # assigned_item = AssignedOrderItem.find(assigned_item_id)
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'"); # assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
# order queue stations # # order queue stations
oqs = assigned_item.order_queue_station # oqs = assigned_item.order_queue_station
order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first() # order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
# Check Printed # # Check Printed
print_status = assigned_item.print_status == true ? " (Re-Print)" : "" # print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
# print when complete click # # print when complete click
print_settings = PrintSetting.find_by_unique_code(unique_code) # print_settings = PrintSetting.find_by_unique_code(unique_code)
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings) # order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, order_item.order_items_id, print_status, options ) # order_queue_printer.print_order_item(print_settings,oqs, assigned_item.order_id, order_item.order_items_id, print_status, options )
# update print status for completed same order items # # update print status for completed same order items
assigned_items.each do |ai| # assigned_items.each do |ai|
ai.print_status=true # ai.print_status=true
ai.save # ai.save
end # end
end end
# Print Order Details with booking id # Print Order Details with booking id
def print_order_summary def print_order_summary
unique_code="OrderSummaryPdf" # unique_code="OrderSummaryPdf"
assigned_item_id = params[:id] # assigned_item_id = params[:id]
table_name = params[:table_name] # table_name = params[:table_name]
assigned_item = AssignedOrderItem.find(assigned_item_id) # assigned_item = AssignedOrderItem.find(assigned_item_id)
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'"); # assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'");
# order queue stations # # order queue stations
oqs = assigned_item.order_queue_station # oqs = assigned_item.order_queue_station
# Check Printed # # Check Printed
print_status = assigned_item.print_status == true ? " (Re-Print)" : "" # print_status = assigned_item.print_status == true ? " (Re-Print)" : ""
# get dining # # get dining
# dining = DiningFacility.find_by_name(table_name); # # dining = DiningFacility.find_by_name(table_name);
# booking = Booking.find_by_dining_facility_id(dining.id) # # booking = Booking.find_by_dining_facility_id(dining.id)
# Get Booking ID # # Get Booking ID
booking_id = BookingOrder.where("order_id='#{assigned_item.order_id}'").pluck(:booking_id)[0] # booking_id = BookingOrder.where("order_id='#{assigned_item.order_id}'").pluck(:booking_id)[0]
# print when complete click # # print when complete click
print_settings = PrintSetting.find_by_unique_code(unique_code) # print_settings = PrintSetting.find_by_unique_code(unique_code)
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings) # order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_booking_summary(print_settings,oqs, booking_id, print_status) # order_queue_printer.print_booking_summary(print_settings,oqs, booking_id, print_status)
# update print status for completed same order items # # update print status for completed same order items
assigned_items.each do |ai| # assigned_items.each do |ai|
ai.print_status = true # ai.print_status = true
ai.save # ai.save
end # end
end end
end end

View File

@@ -22,29 +22,29 @@ class Origami::PaymentsController < BaseOrigamiController
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id) cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
# Print for First Bill to Customer # Print for First Bill to Customer
unique_code = "ReceiptBillPdf" # unique_code = "ReceiptBillPdf"
#shop detail # #shop detail
shop_details = Shop::ShopDetail # shop_details = Shop::ShopDetail
# customer= Customer.where('customer_id=' +.customer_id) # # customer= Customer.where('customer_id=' +.customer_id)
customer= Customer.find(sale_data.customer_id) # customer= Customer.find(sale_data.customer_id)
# get member information # # get member information
rebate = MembershipSetting.find_by_rebate(1) # rebate = MembershipSetting.find_by_rebate(1)
if customer.membership_id != nil && rebate # if customer.membership_id != nil && rebate
member_info = Customer.get_member_account(customer) # member_info = Customer.get_member_account(customer)
end # end
# get printer info # # get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code) # print_settings=PrintSetting.find_by_unique_code(unique_code)
# find order id by sale id # # find order id by sale id
# sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id) # # sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id)
# Calculate price_by_accounts # # Calculate price_by_accounts
item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale_items) # item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale_items)
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale_items) # discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale_items)
printer = Printer::ReceiptPrinter.new(print_settings) # printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt") # printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,sale_data,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, shop_details, "Frt")
end end
def create def create
@@ -83,24 +83,24 @@ class Origami::PaymentsController < BaseOrigamiController
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id) cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
# For Print # For Print
unique_code = "ReceiptBillPdf" # unique_code = "ReceiptBillPdf"
customer= Customer.find(saleObj.customer_id) # customer= Customer.find(saleObj.customer_id)
# get member information # # get member information
rebate = MembershipSetting.find_by_rebate(1) # rebate = MembershipSetting.find_by_rebate(1)
if customer.membership_id != nil && rebate # if customer.membership_id != nil && rebate
member_info = Customer.get_member_account(customer) # member_info = Customer.get_member_account(customer)
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) # rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
end # end
# get printer info # # get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code) # print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total # # Calculate Food and Beverage Total
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items) # item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items) # discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings) # printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid") # printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid")
end end
end end
@@ -202,26 +202,26 @@ class Origami::PaymentsController < BaseOrigamiController
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id) cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id) cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
unique_code = "ReceiptBillPdf" # unique_code = "ReceiptBillPdf"
customer= Customer.find(saleObj.customer_id) # customer= Customer.find(saleObj.customer_id)
#shop detail # #shop detail
shop_details = Shop::ShopDetail # shop_details = Shop::ShopDetail
# get member information # # get member information
rebate = MembershipSetting.find_by_rebate(1) # rebate = MembershipSetting.find_by_rebate(1)
if customer.membership_id != nil && rebate # if customer.membership_id != nil && rebate
member_info = Customer.get_member_account(customer) # member_info = Customer.get_member_account(customer)
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) # rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
end # end
# get printer info # # get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code) # print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate price_by_accounts # # Calculate price_by_accounts
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items) # item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items) # discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings) # printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Re-print") # printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Re-print")
end end
def foc def foc
@@ -251,20 +251,20 @@ class Origami::PaymentsController < BaseOrigamiController
# Re-call Sale Data # Re-call Sale Data
saleObj = Sale.find(sale_id) saleObj = Sale.find(sale_id)
unique_code = "ReceiptBillPdf" # unique_code = "ReceiptBillPdf"
customer= Customer.find(saleObj.customer_id) # customer= Customer.find(saleObj.customer_id)
#shop detail # #shop detail
shop_details = Shop::ShopDetail # shop_details = Shop::ShopDetail
# get printer info # # get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code) # print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total # # Calculate Food and Beverage Total
item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items) # item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items)
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items) # discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings) # printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC") # printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC")
end end
end end

View File

@@ -46,24 +46,24 @@ class Origami::ShiftsController < BaseOrigamiController
cashier_terminal.save cashier_terminal.save
unique_code = "CloseCashierPdf" # unique_code = "CloseCashierPdf"
shop_details = Shop.find(1) # shop_details = Shop.find(1)
#get tax # #get tax
shift_obj = ShiftSale.where('id =?',@shift.id) # shift_obj = ShiftSale.where('id =?',@shift.id)
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='') # @sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
#other payment details for mpu or visa like card # #other payment details for mpu or visa like card
@other_payment = ShiftSale.get_by_shift_other_payment(@shift) # @other_payment = ShiftSale.get_by_shift_other_payment(@shift)
# Calculate price_by_accounts # # Calculate price_by_accounts
@total_amount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'amount') # @total_amount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'amount')
@total_discount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'discount') # @total_discount_by_account = ShiftSale.calculate_total_price_by_accounts(@shift,'discount')
@total_member_discount = ShiftSale.get_total_member_discount(@shift) # @total_member_discount = ShiftSale.get_total_member_discount(@shift)
# get printer info # # get printer info
print_settings = PrintSetting.find_by_unique_code(unique_code) # print_settings = PrintSetting.find_by_unique_code(unique_code)
printer = Printer::CashierStationPrinter.new(print_settings) # printer = Printer::CashierStationPrinter.new(print_settings)
printer.print_close_cashier(print_settings,cashier_terminal,@shift,shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount) # printer.print_close_cashier(print_settings,cashier_terminal,@shift,shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount)
end end

View File

@@ -55,40 +55,40 @@ class Origami::VoidController < BaseOrigamiController
# For Print # For Print
member_info = nil # member_info = nil
rebate_amount = nil # rebate_amount = nil
# For Cashier by Zone # # For Cashier by Zone
bookings = Booking.where("sale_id='#{sale_id}'") # bookings = Booking.where("sale_id='#{sale_id}'")
if bookings.count > 1 # if bookings.count > 1
# for Multiple Booking # # for Multiple Booking
table = DiningFacility.find(bookings[0].dining_facility_id) # table = DiningFacility.find(bookings[0].dining_facility_id)
else # else
table = DiningFacility.find(bookings[0].dining_facility_id) # table = DiningFacility.find(bookings[0].dining_facility_id)
end # end
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id) # cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id) # cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
unique_code = "ReceiptBillPdf" # unique_code = "ReceiptBillPdf"
customer= Customer.find(sale.customer_id) # customer= Customer.find(sale.customer_id)
#shop detail # #shop detail
shop_details = Shop.find(1) # shop_details = Shop.find(1)
# get member information # # get member information
rebate = MembershipSetting.find_by_rebate(1) # rebate = MembershipSetting.find_by_rebate(1)
if customer.membership_id != nil && rebate # if customer.membership_id != nil && rebate
member_info = Customer.get_member_account(customer) # member_info = Customer.get_member_account(customer)
rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no) # rebate_amount = Customer.get_membership_transactions(customer,saleObj.receipt_no)
end # end
# get printer info # # get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code) # print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total # # Calculate Food and Beverage Total
item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale.sale_items) # item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale.sale_items)
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items) # discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
printer = Printer::ReceiptPrinter.new(print_settings) # printer = Printer::ReceiptPrinter.new(print_settings)
printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID") # printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID")
#end print #end print

View File

@@ -78,22 +78,13 @@ class OrderQueueStation < ApplicationRecord
end end
end end
if oqs.auto_print
if oqs_order_items.length > 0
print_slip(oqs, order, oqs_order_items)
is_auto_printed = true
end
end
end
# if oqs.id == oqpbz.order_queue_station_id
# # Auto Printing
# if oqs.auto_print # if oqs.auto_print
# if oqs_order_items.length > 0 # if oqs_order_items.length > 0
# print_slip(oqs, order, oqs_order_items) # print_slip(oqs, order, oqs_order_items)
# is_auto_printed = true # is_auto_printed = true
# end # end
# end # end
# end end
end end
# end # end
end end
@@ -101,33 +92,32 @@ class OrderQueueStation < ApplicationRecord
private private
#Print order_items in 1 slip #Print order_items in 1 slip
def print_slip(oqs, order, order_items) def print_slip(oqs, order, order_items)
unique_code="OrderSummaryPdf" # unique_code="OrderSummaryPdf"
print_settings=PrintSetting.find_by_unique_code(unique_code) # print_settings=PrintSetting.find_by_unique_code(unique_code)
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) # order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_summary(print_settings, oqs,order.order_id, order_items, print_status="") # order_queue_printer.print_order_summary(print_settings, oqs,order.order_id, order_items, print_status="")
AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai|
# update print status for order items
ai.print_status=true
ai.save
end
# AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai|
# # update print status for order items
# ai.print_status=true
# ai.save
# end
end end
#Print order_item in 1 slip per item #Print order_item in 1 slip per item
def print_slip_item(oqs, assigned_item) def print_slip_item(oqs, assigned_item)
unique_code="OrderItemPdf" # unique_code="OrderItemPdf"
order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first() # order_item = OrderItem.where("order_id='#{assigned_item.order_id}' AND item_instance_code='#{assigned_item.instance_code}'").first()
# print when complete click # # print when complete click
print_settings=PrintSetting.find_by_unique_code(unique_code) # print_settings=PrintSetting.find_by_unique_code(unique_code)
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings) # order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
order_queue_printer.print_order_item(print_settings, oqs,item.order_id, order_item.order_items_id, print_status="" ) # order_queue_printer.print_order_item(print_settings, oqs,item.order_id, order_item.order_items_id, print_status="" )
# update print status for completed same order items # # update print status for completed same order items
assigned_order_item.each do |ai| # assigned_order_item.each do |ai|
ai.print_status=true # ai.print_status=true
ai.save # ai.save
end # end
end end
end end

View File

@@ -168,9 +168,8 @@
<div class="col-lg-1 col-md-1 col-sm-1"> <div class="col-lg-1 col-md-1 col-sm-1">
<!-- OQS Buttons --> <!-- OQS Buttons -->
<a href="<%= dashboard_path %>" class="btn btn-sm btn-block btn-default waves-effect" role="button" aria-haspopup="true"><i class="material-icons">reply</i> Back </a> <a href="<%= dashboard_path %>" class="btn btn-sm btn-block btn-default waves-effect" role="button" aria-haspopup="true"><i class="material-icons">reply</i> Back </a>
<button type="button" title="Print Order Item" id="print_order_item" class="btn bg-blue btn-block btn-lg waves-effect">Print</a> <!-- <button type="button" title="Print Order Item" id="print_order_item" class="btn bg-blue btn-block btn-lg waves-effect">Print</a>
<button type="button" class="btn bg-blue btn-block btn-lg waves-effect" id="print_order_summary">Print <br/>Order<br/>Summary</button> <button type="button" class="btn bg-blue btn-block btn-lg waves-effect" id="print_order_summary">Print <br/>Order<br/>Summary</button> -->
<!-- <button type="button" class="" id="print_order_summary">Print <br/>Order<br/>Summary</button> -->
</div> </div>
</div> </div>

View File

@@ -389,7 +389,7 @@
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button> <button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button> <button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button> <!-- <button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button> -->
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button> <button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" active="<%= can? :overall_void, :void %>"> Void</button> <button type="button" id="void" class="btn btn-block bg-blue waves-effect" active="<%= can? :overall_void, :void %>"> Void</button>
<% end %> <% end %>
@@ -472,12 +472,12 @@
}); });
$('#re-print').click(function () { // $('#re-print').click(function () {
var sale_id = $('#sale_id').val(); // var sale_id = $('#sale_id').val();
window.location.href = '/origami/' + sale_id + "/reprint" // window.location.href = '/origami/' + sale_id + "/reprint"
return false; // return false;
}); // });
// Add Other Charges // Add Other Charges
$('#other-charges').click(function () { $('#other-charges').click(function () {
@@ -519,18 +519,18 @@
}); });
// Print for first bill // Print for first bill
$("#first_bill").on('click', function () { // $("#first_bill").on('click', function () {
var sale_id = $('#sale_id').val(); // var sale_id = $('#sale_id').val();
var ajax_url = "/origami/sale/" + sale_id + "/first_bill"; // var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
$.ajax({ // $.ajax({
type: "GET", // type: "GET",
url: ajax_url, // url: ajax_url,
success: function (result) { // success: function (result) {
location.reload(); // location.reload();
} // }
}); // });
}); // });
// $('#pay').on('click', function () { // $('#pay').on('click', function () {
// var sale_id = $('#sale_id').val(); // var sale_id = $('#sale_id').val();

View File

@@ -369,7 +369,7 @@
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button> <button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
<!-- <button type="button" class="btn bg-blue btn-block" id='move' disabled="">Move</button> --> <!-- <button type="button" class="btn bg-blue btn-block" id='move' disabled="">Move</button> -->
<!-- <button type="button" id="request_bills" class="btn bg-blue btn-block" disabled> Req.Bill</button> --> <!-- <button type="button" id="request_bills" class="btn bg-blue btn-block" disabled> Req.Bill</button> -->
<button type="button" id="first_bill" class="btn bg-blue btn-block">First Bill</button> <!-- <button type="button" id="first_bill" class="btn bg-blue btn-block">First Bill</button> -->
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button> <button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
<button type="button" id="void" class="btn bg-blue btn-block" > Void </button> <button type="button" id="void" class="btn bg-blue btn-block" > Void </button>
<% end %> <% end %>

View File

@@ -201,7 +201,7 @@
<% if @sale.sale_status != 'void' %> <% if @sale.sale_status != 'void' %>
<button type="button" id="void" class="btn bg-danger btn-block">VOID</button> <button type="button" id="void" class="btn bg-danger btn-block">VOID</button>
<% end %> <% end %>
<button type="button" id="re-print" class="btn bg-blue btn-block">Re.Print</button> <!-- <button type="button" id="re-print" class="btn bg-blue btn-block">Re.Print</button> -->
</div> </div>
</div> </div>
</div> </div>
@@ -271,10 +271,10 @@ $('#back').on('click',function(){
}); });
}); });
$('#re-print').click(function() { // $('#re-print').click(function() {
var sale_id = $('#sale_id').val(); // var sale_id = $('#sale_id').val();
window.location.href = '/origami/'+ sale_id + "/reprint" // window.location.href = '/origami/'+ sale_id + "/reprint"
return false; // return false;
}); // });
</script> </script>