fixed star printer setting
This commit is contained in:
11
README.md
11
README.md
@@ -82,13 +82,16 @@ For ReceiptBillA5Pdf
|
||||
For ReceiptBillAltName options
|
||||
1) settings/lookups => { type:print_settings, name:ReceiptBillAltName, value:1 }
|
||||
|
||||
For CloseCashierPrint with Star Printer
|
||||
1) settings/print_settings
|
||||
a) Unique Code => CloseCashierStarPdf
|
||||
For Using Star Printer
|
||||
*** Need to change these print settings
|
||||
1) settings/print_settings => OrderItemStarPdf
|
||||
2) settings/print_settings => ReceiptBillStarPdf
|
||||
3) settings/print_settings => SaleItemsStarPdf
|
||||
*** Other print settings aren't need to change.
|
||||
|
||||
For Sale Items Summary Include at CloseCashierPrint
|
||||
1) settings/print_settings
|
||||
a) Check => Shift Sale Items
|
||||
a) Check => Shift Sale Items
|
||||
|
||||
For Bank Integration setting
|
||||
1) rake db:migrate for card_sale_trans, card_settle_trans
|
||||
|
||||
@@ -37,7 +37,7 @@ $(document).on('turbolinks:load', function() {
|
||||
// oqs_id = $(this).find(".oqs-id").text();
|
||||
$("#oqs_active").attr('data-id',$('.oqs_click').val());
|
||||
var url = 'oqs/get_items/'+$('.oqs_click').val();
|
||||
|
||||
|
||||
show_details(url,null);
|
||||
}
|
||||
|
||||
@@ -49,11 +49,11 @@ $(document).on('turbolinks:load', function() {
|
||||
$(".tables").on("click", function(){
|
||||
|
||||
active = $(this).hasClass('selected-table');
|
||||
if (active) {
|
||||
if (active) {
|
||||
$(this).removeClass('bg-blue');
|
||||
$(this).addClass('green');
|
||||
$(this).removeClass('selected-table');
|
||||
}else{
|
||||
}else{
|
||||
$(this).removeClass('green');
|
||||
$(this).addClass('bg-blue');
|
||||
$(this).addClass('selected-table');
|
||||
@@ -63,7 +63,7 @@ $(document).on('turbolinks:load', function() {
|
||||
var table_id =[];
|
||||
for (i = 0; i < list.length; i++) {
|
||||
table_id.push(list[i].value);
|
||||
}
|
||||
}
|
||||
console.log(table_id)
|
||||
$('#table').val(table_id);
|
||||
|
||||
@@ -75,7 +75,7 @@ $(document).on('turbolinks:load', function() {
|
||||
}else{
|
||||
var table = null
|
||||
}
|
||||
|
||||
|
||||
if (oqs_id > 0 || status != "All" || table != null) {
|
||||
$(".oqs_click").removeClass('oqs_active');
|
||||
$(".queue_station").removeClass('queue_station_box');
|
||||
@@ -86,7 +86,7 @@ $(document).on('turbolinks:load', function() {
|
||||
// oqs_id = $(this).find(".oqs-id").text();
|
||||
$("#oqs_active").attr('data-id',oqs_id);
|
||||
var url = 'oqs/get_items/'+oqs_id;
|
||||
|
||||
|
||||
show_details(url,table,status);
|
||||
}else{
|
||||
$("#completed").removeClass('hide')
|
||||
@@ -95,7 +95,7 @@ $(document).on('turbolinks:load', function() {
|
||||
});
|
||||
|
||||
// $(".oqs_click").on("click", function(){
|
||||
$(document).on('change', '.oqs_click', function(event){
|
||||
$(document).on('change', '.oqs_click', function(event){
|
||||
oqs_id = $(this).val();
|
||||
status = $("#status").val();
|
||||
var table_id = $('#table_id').val();
|
||||
@@ -104,7 +104,7 @@ $(document).on('turbolinks:load', function() {
|
||||
}else{
|
||||
var table = null
|
||||
}
|
||||
|
||||
|
||||
if (oqs_id > 0 || status != "All" || table_id != null) {
|
||||
$(".oqs_click").removeClass('oqs_active');
|
||||
$(".queue_station").removeClass('queue_station_box');
|
||||
@@ -115,7 +115,7 @@ $(document).on('turbolinks:load', function() {
|
||||
// oqs_id = $(this).find(".oqs-id").text();
|
||||
$("#oqs_active").attr('data-id',oqs_id);
|
||||
var url = 'oqs/get_items/'+oqs_id;
|
||||
|
||||
|
||||
show_details(url,table,status);
|
||||
}else{
|
||||
$("#completed").removeClass('hide')
|
||||
@@ -124,7 +124,7 @@ $(document).on('turbolinks:load', function() {
|
||||
}); //End Click
|
||||
|
||||
// $(".status_click").on("click", function(){
|
||||
$(document).on('change', '.status_click', function(event){
|
||||
$(document).on('change', '.status_click', function(event){
|
||||
oqs_id = $("#oqs_id").val();
|
||||
status = $(this).val();
|
||||
var table_id = $('#table_id').val();
|
||||
@@ -144,7 +144,7 @@ $(document).on('turbolinks:load', function() {
|
||||
// oqs_id = $(this).find(".oqs-id").text();
|
||||
$("#oqs_active").attr('data-id',oqs_id);
|
||||
var url = 'oqs/get_items/'+oqs_id;
|
||||
|
||||
|
||||
show_details(url,table,status);
|
||||
}else{
|
||||
$("#completed").removeClass('hide')
|
||||
@@ -152,17 +152,17 @@ $(document).on('turbolinks:load', function() {
|
||||
}
|
||||
|
||||
}); //End Click
|
||||
|
||||
function show_details(url,table_id,status){
|
||||
|
||||
function show_details(url,table_id,status){
|
||||
console.log(table_id)
|
||||
var oqs_append = $('.oqs_append');
|
||||
oqs_append.empty();
|
||||
var filter = $('.filter').text();
|
||||
|
||||
|
||||
//Start Ajax
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
data: {'filter':filter,'table_id':table_id,'status':status},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
@@ -175,7 +175,7 @@ $(document).on('turbolinks:load', function() {
|
||||
var options = data[field]["options"];
|
||||
}
|
||||
|
||||
var date = new Date(data[field]["created_at"]);
|
||||
var date = new Date(data[field]["created_at"]);
|
||||
// var show_date = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear() + ' ' + date.getHours()+ ':' + date.getMinutes();
|
||||
var show_date =date.getHours()+ ':' + date.getMinutes() +' '+(date.getHours() >= 12 ? 'PM' : 'AM');
|
||||
var set_menu_items = data[field]["set_menu_items"];
|
||||
@@ -193,7 +193,7 @@ $(document).on('turbolinks:load', function() {
|
||||
table_type = data[field]["table_type"] +'-'+data[field]["zone"]
|
||||
}else{
|
||||
table_type = "No Table"
|
||||
|
||||
|
||||
}
|
||||
var delivery_status = ''
|
||||
if (data[field]["delivery_status"] == true) {
|
||||
@@ -235,24 +235,24 @@ $(document).on('turbolinks:load', function() {
|
||||
+'</span>'
|
||||
+'</div>'
|
||||
|
||||
+'</div>';
|
||||
|
||||
+'</div>';
|
||||
|
||||
$('.oqs_append').append(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//end Ajax
|
||||
//end Ajax
|
||||
}
|
||||
|
||||
$(document).on('click', '.queue_station', function(event){
|
||||
$(document).on('click', '.queue_station', function(event){
|
||||
$('#print_order_item').removeAttr("disabled","");
|
||||
$('#print_order_summary').removeAttr("disabled","");
|
||||
var orderNo = $(this).attr('data-order-no');
|
||||
var orderNo = $(this).attr('data-order-no');
|
||||
var orderZone=$(this).children().children().children('.order-zone').text().trim();
|
||||
var orderZoneType=$(this).children().children().children('.order-zone-type').text().trim();
|
||||
// var orderItem=$(this).children().children().children('.order-item').text();
|
||||
var assigned_item_id = $(this).children().find(".assigned-order-item").text();
|
||||
var orderQty = $(this).children().children().children('.order-qty').text();
|
||||
var orderQty = $(this).children().children().children('.order-qty').text();
|
||||
var orderBy = $(this).children().children().children().children('.order-by').text();
|
||||
var orderAt = $(this).children().children().children().children('.order-at').text();
|
||||
var orderCustomer = $(this).children().children('.order-customer').text();
|
||||
@@ -272,10 +272,10 @@ $(document).on('turbolinks:load', function() {
|
||||
data: { 'status' : order_status },
|
||||
success: function(res){
|
||||
// console.log(res);
|
||||
for (i = 0; i < res["items"].length; i++) {
|
||||
var data = JSON.stringify(res["items"][i]);
|
||||
var parse_data = JSON.parse(data);
|
||||
var assigned_order_items = [];
|
||||
for (i = 0; i < res["items"].length; i++) {
|
||||
var data = JSON.stringify(res["items"][i]);
|
||||
var parse_data = JSON.parse(data);
|
||||
var assigned_order_items = [];
|
||||
var assigned_order_item_id = '';
|
||||
if(res["assigned_order_items"]!= undefined && res["assigned_order_items"]!=''){
|
||||
assigned_order_items = JSON.parse(JSON.stringify(res["assigned_order_items"]));
|
||||
@@ -286,7 +286,7 @@ $(document).on('turbolinks:load', function() {
|
||||
});
|
||||
}
|
||||
// console.log(assigned_order_item_id);
|
||||
|
||||
|
||||
var set_menu_items = parse_data.set_menu_items;
|
||||
var set_instance_items = "";
|
||||
if(set_menu_items!=null){
|
||||
@@ -309,16 +309,16 @@ $(document).on('turbolinks:load', function() {
|
||||
"<td class='order-qty' style='width:20%; text-align:right'>" + parse_data.qty + "</td>" +
|
||||
"</tr>";
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
var order_item_row = "<tr>" +
|
||||
"<td class='order-items' style='width:80%; text-align:left'>" + parse_data.item_name + set_instance_items + "</td>" +
|
||||
"<td class='order-qty' style='width:20%; text-align:right'>" + parse_data.qty + "</td>" +
|
||||
"</tr>";
|
||||
}
|
||||
|
||||
|
||||
$("#oqs-order-details-table").children("tbody").append(order_item_row);
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -329,21 +329,21 @@ $(document).on('turbolinks:load', function() {
|
||||
$(this).addClass('selected-item');
|
||||
});
|
||||
|
||||
$(document).on('click', '.order-item-edit', function(event){
|
||||
$(document).on('click', '.order-item-edit', function(event){
|
||||
var _self = $(this); // To know in ajax return
|
||||
var assigned_item_id=$(this).attr('id').substr(5);
|
||||
window.location.href = '/oqs/'+ assigned_item_id + "/edit/oqs";
|
||||
});
|
||||
|
||||
// complete for queue item
|
||||
|
||||
$(document).on('click', '.order-complete', function(event){
|
||||
|
||||
$(document).on('click', '.order-complete', function(event){
|
||||
//e.preventDefault();
|
||||
var _self = $(this); // To know in ajax return
|
||||
var assigned_item_id=$(this).attr('id').substr(15);
|
||||
var params = { 'id':assigned_item_id };
|
||||
|
||||
// Call update_delivery_status() for changed delivery and move to delivery
|
||||
|
||||
// Call update_delivery_status() for changed delivery and move to delivery
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: '/oqs/update_delivery',
|
||||
@@ -383,7 +383,7 @@ $(document).on('turbolinks:load', function() {
|
||||
}
|
||||
else {
|
||||
window.location.href = "/origami/room/" + table_id
|
||||
}
|
||||
}
|
||||
});
|
||||
// Page reload
|
||||
location.reload();
|
||||
@@ -392,7 +392,7 @@ $(document).on('turbolinks:load', function() {
|
||||
});
|
||||
|
||||
// Print Order Item
|
||||
$(document).on('click', '#print_order_item', function(event){
|
||||
$(document).on('click', '#print_order_item', function(event){
|
||||
$(this).attr("disabled","disabled");
|
||||
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();
|
||||
|
||||
@@ -5,12 +5,14 @@ class Oqs::PrintController < ApplicationController
|
||||
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
order_slim_pdf = Lookup.collection_of("print_settings") #print_settings with name:OrderSlimPdf
|
||||
printer = PrintSetting.all
|
||||
unique_code="OrderItemPdf"
|
||||
unique_code="OrderItemStarPdf"
|
||||
if !order_slim_pdf.empty?
|
||||
if !printer.empty?
|
||||
printer.each do |printer_setting|
|
||||
if printer_setting.unique_code == 'OrderItemPdf'
|
||||
if printer_setting.unique_code == 'OrderItemPdf'
|
||||
unique_code="OrderItemPdf"
|
||||
elsif printer_setting.unique_code == 'OrderItemStarPdf'
|
||||
unique_code="OrderItemStarPdf"
|
||||
elsif printer_setting.unique_code == 'OrderItemSlimPdf'
|
||||
unique_code="OrderItemSlimPdf"
|
||||
elsif printer_setting.unique_code == 'OrderSetItemPdf'
|
||||
@@ -18,17 +20,17 @@ class Oqs::PrintController < ApplicationController
|
||||
elsif printer_setting.unique_code == 'OrderItemCustomisePdf'
|
||||
unique_code="OrderItemCustomisePdf"
|
||||
elsif printer_setting.unique_code == 'OrderSetItemCustomisePdf'
|
||||
unique_code="OrderSetItemCustomisePdf"
|
||||
unique_code="OrderSetItemCustomisePdf"
|
||||
elsif printer_setting.unique_code == 'OrderItemSlimCustomisePdf'
|
||||
unique_code="OrderItemSlimCustomisePdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
assigned_item_id = params[:id]
|
||||
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 + "'")
|
||||
|
||||
# order queue stations
|
||||
@@ -38,28 +40,28 @@ class Oqs::PrintController < ApplicationController
|
||||
# Check Printed
|
||||
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)
|
||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||
filename, receipt_no, cashier_printer = 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
|
||||
assigned_items.each do |ai|
|
||||
ai.print_status=true
|
||||
ai.save
|
||||
ai.save
|
||||
end
|
||||
|
||||
# filename, receipt_no, cashier_printer = 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_detail, "Frt",current_balance,nil,other_amount)
|
||||
# filename, receipt_no, cashier_printer = 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_detail, "Frt",current_balance,nil,other_amount)
|
||||
if ENV["SERVER_MODE"] == "cloud"
|
||||
result = {
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
result = {
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
}
|
||||
# Mobile Print
|
||||
render :json => result.to_json
|
||||
render :json => result.to_json
|
||||
end
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
# Print Order Details with booking id
|
||||
@@ -71,7 +73,7 @@ class Oqs::PrintController < ApplicationController
|
||||
if !order_slim_pdf.empty?
|
||||
if !printer.empty?
|
||||
printer.each do |printer_setting|
|
||||
if printer_setting.unique_code == 'OrderSummaryPdf'
|
||||
if printer_setting.unique_code == 'OrderSummaryPdf'
|
||||
unique_code="OrderSummaryPdf"
|
||||
elsif printer_setting.unique_code == 'OrderSummarySlimPdf'
|
||||
unique_code="OrderSummarySlimPdf"
|
||||
@@ -80,17 +82,17 @@ class Oqs::PrintController < ApplicationController
|
||||
elsif printer_setting.unique_code == 'OrderSummaryCustomisePdf'
|
||||
unique_code="OrderSummaryCustomisePdf"
|
||||
elsif printer_setting.unique_code == 'OrderSummarySetCustomisePdf'
|
||||
unique_code="OrderSummarySetCustomisePdf"
|
||||
unique_code="OrderSummarySetCustomisePdf"
|
||||
elsif printer_setting.unique_code == 'OrderSummarySlimCustomisePdf'
|
||||
unique_code="OrderSummarySlimCustomisePdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
assigned_item_id = params[:id]
|
||||
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 + "'");
|
||||
|
||||
# order queue stations
|
||||
@@ -105,8 +107,8 @@ class Oqs::PrintController < ApplicationController
|
||||
|
||||
# Get Booking ID
|
||||
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)
|
||||
order_queue_printer = Printer::OrderQueuePrinter.new(print_settings)
|
||||
filename, receipt_no, cashier_printer = order_queue_printer.print_booking_summary(print_settings,oqs, booking_id, print_status)
|
||||
@@ -114,20 +116,20 @@ class Oqs::PrintController < ApplicationController
|
||||
# update print status for completed same order items
|
||||
assigned_items.each do |ai|
|
||||
ai.print_status = true
|
||||
ai.save
|
||||
ai.save
|
||||
end
|
||||
|
||||
# filename, receipt_no, cashier_printer = 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_detail, "Frt",current_balance,nil,other_amount)
|
||||
# filename, receipt_no, cashier_printer = 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_detail, "Frt",current_balance,nil,other_amount)
|
||||
if ENV["SERVER_MODE"] == "cloud"
|
||||
result = {
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
result = {
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
}
|
||||
# Mobile Print
|
||||
render :json => result.to_json
|
||||
render :json => result.to_json
|
||||
end
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -121,8 +121,8 @@ class Reports::SaleitemController < BaseReportController
|
||||
|
||||
|
||||
# get printer info
|
||||
print_settings = PrintSetting.find_by_unique_code('CloseCashierPdf') # SaleItemsPdf
|
||||
print_settings_star = PrintSetting.find_by_unique_code('CloseCashierStarPdf')
|
||||
print_settings = PrintSetting.find_by_unique_code('SaleItemsPdf') # SaleItemsPdf
|
||||
print_settings_star = PrintSetting.find_by_unique_code('SaleItemsStarPdf')
|
||||
|
||||
if print_settings.nil?
|
||||
if !print_settings_star.nil?
|
||||
|
||||
@@ -84,13 +84,11 @@ class Printer::CashierStationPrinter < Printer::PrinterWorker
|
||||
def print_sale_items_report(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items)
|
||||
filename = "tmp/reports_sale_items.pdf"
|
||||
|
||||
if print_settings.unique_code == "CloseCashierPdf"
|
||||
if print_settings.unique_code == "SaleItemsPdf"
|
||||
pdf = SaleItemsPdf.new(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, nil, nil, nil)
|
||||
puts 'Printing!!!!'
|
||||
end
|
||||
if print_settings.unique_code == "CloseCashierStarPdf"
|
||||
if print_settings.unique_code == "SaleItemsStarPdf"
|
||||
pdf = SaleItemsStarPdf.new(print_settings, shop_details, period_name, type, account, from_date, to_date, shift_name, sale_items, nil, nil, nil)
|
||||
puts 'PrintingStar!!!!'
|
||||
end
|
||||
|
||||
pdf.render_file filename
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
def print_order_item(print_settings,oqs, order_id, order_item_id, print_status, before_updated_qty="", options="")
|
||||
# Must be one print
|
||||
# Must be one print
|
||||
if print_settings.print_copies == 0
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
end
|
||||
|
||||
order_item = print_query('order_item', order_item_id) #OrderItem.find_by_item_code(item_code)
|
||||
order_item = print_query('order_item', order_item_id) #OrderItem.find_by_item_code(item_code)
|
||||
options = order_item[0].options
|
||||
# filename = "tmp/order_item_#{order_id}_#{order_item_id}" + ".pdf"
|
||||
# filename = "tmp/order_item_#{order_id}_#{order_item_id}" + ".pdf"
|
||||
|
||||
pdf = OrderItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
|
||||
print_setting = PrintSetting.all
|
||||
|
||||
# check for item not to show
|
||||
# check for item not to show
|
||||
|
||||
# if order_item[0].price != 0
|
||||
# if order_item[0].price != 0
|
||||
if !print_setting.empty?
|
||||
print_setting.each do |print_settings|
|
||||
if print_settings.unique_code == 'OrderItemPdf'
|
||||
@@ -29,7 +29,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
pdf = OrderSetItemPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
|
||||
elsif print_settings.unique_code == 'OrderItemCustomisePdf'
|
||||
pdf = OrderItemCustomisePdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
|
||||
elsif print_settings.unique_code == 'OrderSetItemCustomisePdf'
|
||||
elsif print_settings.unique_code == 'OrderSetItemCustomisePdf'
|
||||
pdf = OrderSetItemCustomisePdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
|
||||
elsif print_settings.unique_code == 'OrderItemSlimCustomisePdf'
|
||||
pdf = OrderItemSlimCustomisePdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
|
||||
@@ -42,15 +42,15 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
directory_name = 'public/orders_'+shop.shop_code
|
||||
Dir.mkdir(directory_name) unless File.exists?(directory_name)
|
||||
|
||||
filename = directory_name + "/order_item_#{order_id}_#{order_item_id}" + ".pdf"
|
||||
filename = directory_name + "/order_item_#{order_id}_#{order_item_id}" + ".pdf"
|
||||
|
||||
pdf.render_file filename
|
||||
|
||||
pdf.render_file filename
|
||||
|
||||
if oqs.print_copy
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
end
|
||||
#For print copy
|
||||
# pdf.render_file filename.gsub(".","-copy.")
|
||||
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
@@ -61,24 +61,24 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return filename, order_id, oqs.printer_name
|
||||
return filename, order_id, oqs.printer_name
|
||||
end
|
||||
|
||||
# Query for per order
|
||||
def print_order_summary(print_settings,oqs, order_id, order_items, print_status, before_updated_qty="", options="")
|
||||
#Use CUPS service
|
||||
#Generate PDF
|
||||
#Print
|
||||
# Must be one print
|
||||
#Print
|
||||
# Must be one print
|
||||
if print_settings.print_copies == 0
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
end
|
||||
end
|
||||
|
||||
print_setting = PrintSetting.all.order("id ASC")
|
||||
order=print_query('order_summary', order_id)
|
||||
order=print_query('order_summary', order_id)
|
||||
|
||||
shop = Shop.first
|
||||
directory_name = 'public/orders_'+shop.shop_code
|
||||
@@ -90,12 +90,12 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
order_items.each do|odi|
|
||||
odi_item=print_query('order_item', odi.order_items_id)
|
||||
|
||||
filename = directory_name + "/order_item_#{order_id}" + ".pdf"
|
||||
# filename = "tmp/order_item_#{order_id}" + ".pdf"
|
||||
filename = directory_name + "/order_item_#{order_id}" + ".pdf"
|
||||
# filename = "tmp/order_item_#{order_id}" + ".pdf"
|
||||
# For Item Options
|
||||
options = odi.options == "[]"? "" : odi.options
|
||||
|
||||
# check for item not to show
|
||||
# check for item not to show
|
||||
#if odi.price != 0
|
||||
pdf = OrderItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name,before_updated_qty)
|
||||
if !print_setting.empty?
|
||||
@@ -103,7 +103,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
if print_settings.unique_code == 'OrderItemPdf'
|
||||
pdf = OrderItemPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name,before_updated_qty)
|
||||
elsif print_settings.unique_code == 'OrderItemStarPdf'
|
||||
pdf = OrderItemStarPdfnew(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
|
||||
pdf = OrderItemStarPdf.new(print_settings,order_item[0], print_status, options, oqs.use_alternate_name, before_updated_qty)
|
||||
elsif print_settings.unique_code == 'OrderItemSlimPdf'
|
||||
pdf = OrderItemSlimPdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name,before_updated_qty)
|
||||
elsif print_settings.unique_code == 'OrderSetItemPdf'
|
||||
@@ -116,13 +116,13 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
pdf = OrderItemSlimCustomisePdf.new(print_settings,odi_item[0], print_status, options, oqs.use_alternate_name,before_updated_qty)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# pdf.render_file "tmp/order_item.pdf"
|
||||
pdf.render_file filename
|
||||
if oqs.print_copy
|
||||
if oqs.print_copy
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, oqs.printer_name)
|
||||
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
end
|
||||
@@ -134,11 +134,11 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
end
|
||||
#end
|
||||
#end
|
||||
end
|
||||
# For Print Order Summary
|
||||
else
|
||||
filename = directory_name + "/order_summary_#{order_id}" + ".pdf"
|
||||
else
|
||||
filename = directory_name + "/order_summary_#{order_id}" + ".pdf"
|
||||
# filename = "tmp/order_summary_#{order_id}" + ".pdf"
|
||||
pdf = OrderSummaryPdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name,before_updated_qty)
|
||||
if !print_setting.empty?
|
||||
@@ -157,14 +157,14 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
pdf = OrderSummarySlimCustomisePdf.new(print_settings,order, print_status, order_items, oqs.use_alternate_name,before_updated_qty)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
pdf.render_file filename
|
||||
if oqs.print_copy
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
#For print copy
|
||||
# pdf.render_file filename.gsub(".","-copy.")
|
||||
# self.print(filename.gsub(".","-copy."), oqs.printer_name)
|
||||
@@ -172,7 +172,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
end
|
||||
@@ -182,11 +182,13 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
|
||||
# Print for orders in booking
|
||||
def print_booking_summary(print_settings,oqs, booking_id, print_status,before_updated_qty="")
|
||||
# Must be one print
|
||||
puts 'PrintSetting!!!'
|
||||
puts print_setting.print_copies
|
||||
# Must be one print
|
||||
if print_settings.print_copies == 0
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
end
|
||||
end
|
||||
|
||||
print_setting = PrintSetting.all.order("id ASC")
|
||||
|
||||
@@ -204,9 +206,9 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
# For Item Options
|
||||
options = odi.options == "[]"? "" : odi.options
|
||||
|
||||
# check for item not to show
|
||||
# check for item not to show
|
||||
#if odi.price != 0
|
||||
pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name,before_updated_qty)
|
||||
pdf = OrderItemPdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name,before_updated_qty)
|
||||
if !print_setting.empty?
|
||||
print_setting.each do |print_settings|
|
||||
if print_settings.unique_code == 'OrderItemPdf'
|
||||
@@ -225,12 +227,12 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
pdf = OrderItemSlimCustomisePdf.new(print_settings,odi, print_status, options,oqs.use_alternate_name,before_updated_qty)
|
||||
end
|
||||
end
|
||||
end
|
||||
pdf.render_file filename
|
||||
end
|
||||
pdf.render_file filename
|
||||
|
||||
if oqs.print_copy
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
#For print copy
|
||||
@@ -240,16 +242,16 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
#end
|
||||
end
|
||||
# For Print Order Summary
|
||||
else
|
||||
# filename = "tmp/booking_summary_#{booking_id}" + ".pdf"
|
||||
filename = directory_name + "/booking_summary_#{booking_id}" + ".pdf"
|
||||
else
|
||||
# filename = "tmp/booking_summary_#{booking_id}" + ".pdf"
|
||||
filename = directory_name + "/booking_summary_#{booking_id}" + ".pdf"
|
||||
pdf = OrderSummaryPdf.new(print_settings,order, print_status,oqs.use_alternate_name,before_updated_qty)
|
||||
|
||||
if !print_setting.empty?
|
||||
@@ -268,12 +270,12 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
pdf = OrderSummarySlimCustomisePdf.new(print_settings,order, print_status,oqs.use_alternate_name,before_updated_qty)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
pdf.render_file filename
|
||||
if oqs.print_copy
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
#For print copy
|
||||
@@ -283,7 +285,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, oqs.printer_name)
|
||||
end
|
||||
end
|
||||
@@ -295,7 +297,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
def print_query(type, id)
|
||||
if type == "order_item"
|
||||
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, order_items.set_menu_items, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
|
||||
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
||||
left join bookings AS b ON b.booking_id = bo.booking_id
|
||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||
@@ -303,7 +305,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
left join menu_items as item ON item.item_code = order_items.item_code")
|
||||
.where("order_items.order_items_id = '#{ id }'")
|
||||
.group("order_items.item_code")
|
||||
elsif type == "order_summary"
|
||||
elsif type == "order_summary"
|
||||
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, order_items.set_menu_items, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
|
||||
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||
left join booking_orders AS bo ON bo.order_id=order_items.order_id
|
||||
@@ -313,7 +315,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
left join menu_items as item ON item.item_code = order_items.item_code")
|
||||
.where("orders.order_id = '#{ id }'")
|
||||
.group("order_items.order_items_id")
|
||||
else
|
||||
else
|
||||
# order summary for booking
|
||||
OrderItem.select("order_items.order_id, order_items.item_code, order_items.item_name, order_items.qty, order_items.price, order_items.options, order_items.item_order_by as order_by, order_items.created_at as order_at, order_items.set_menu_items, cus.name as customer, df.type, df.name as dining,item.alt_name as alt_name")
|
||||
.joins("left join orders ON orders.order_id = order_items.order_id
|
||||
@@ -322,7 +324,7 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
left join dining_facilities AS df ON df.id = b.dining_facility_id
|
||||
left join customers as cus ON cus.customer_id = orders.customer_id
|
||||
left join menu_items as item ON item.item_code = order_items.item_code")
|
||||
.where("b.booking_id = '#{ id }'")
|
||||
.where("b.booking_id = '#{ id }'")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -332,12 +334,12 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
#Generate PDF
|
||||
#Print
|
||||
sale_id = booking.sale_id
|
||||
filename = "tmp/check_in_out_#{sale_id}" + ".pdf"
|
||||
filename = "tmp/check_in_out_#{sale_id}" + ".pdf"
|
||||
|
||||
pdf = CheckInOutPdf.new(print_settings,booking, table)
|
||||
print_setting = PrintSetting.all
|
||||
|
||||
# if order_item[0].price != 0
|
||||
# if order_item[0].price != 0
|
||||
if !print_setting.empty?
|
||||
print_setting.each do |print_settings|
|
||||
if print_settings.unique_code == 'CheckInOutPdf'
|
||||
@@ -346,9 +348,9 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
end
|
||||
end
|
||||
|
||||
pdf.render_file filename
|
||||
pdf.render_file filename
|
||||
|
||||
# Must be one print
|
||||
# Must be one print
|
||||
if print_settings.print_copies == 0
|
||||
print_settings.print_copies = 1
|
||||
print_settings.save!
|
||||
@@ -357,8 +359,8 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
|
||||
# print_settings.save!
|
||||
|
||||
#no print in cloud server
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
if ENV["SERVER_MODE"] != "cloud"
|
||||
self.print(filename, print_settings.printer_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,19 +2,19 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
include ActionView::Helpers::NumberHelper
|
||||
|
||||
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width, :description_width, :price_num_width, :line_move
|
||||
|
||||
|
||||
def initialize(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,current_balance,card_data,other_charges_amount,latest_order_no,card_balance_amount)
|
||||
self.page_width = printer_settings.page_width
|
||||
self.page_height = printer_settings.page_height
|
||||
self.header_font_size = printer_settings.header_font_size.to_i
|
||||
self.item_font_size = printer_settings.item_font_size.to_i
|
||||
self.margin = 0
|
||||
self.price_width = 50
|
||||
self.qty_width = 23
|
||||
self.total_width = 50
|
||||
self.item_width = self.page_width - ((self.qty_width + self.price_width + self.total_width))
|
||||
self.price_width = 60
|
||||
self.qty_width = 20
|
||||
self.total_width = 40
|
||||
self.item_width = 73
|
||||
self.item_height = 15
|
||||
self.item_description_width = (self.page_width-20) / 2
|
||||
self.item_description_width = (self.page_width-30) / 2
|
||||
self.label_width = 90
|
||||
|
||||
self.description_width = 140
|
||||
@@ -101,7 +101,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
if shop_details.note && !shop_details.note.nil?
|
||||
shop_note(shop_details)
|
||||
end
|
||||
|
||||
|
||||
footer(printed_status)
|
||||
end
|
||||
|
||||
@@ -129,7 +129,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
text "OrderNo : #{ latest_order_no }", :size => self.header_font_size,:align => :left
|
||||
end
|
||||
move_down line_move
|
||||
|
||||
|
||||
# move_down 2
|
||||
y_position = cursor
|
||||
bounding_box([0,y_position], :width =>self.description_width + self.price_num_width, :height => self.item_height) do
|
||||
@@ -146,7 +146,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "W: #{sale_data.requested_by}" , :size => self.item_font_size, :align => :left
|
||||
end
|
||||
end
|
||||
bounding_box([self.label_width - 2,y_position], :width =>self.label_width, :height => self.item_height) do
|
||||
text "C: #{sale_data.cashier_name}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
@@ -164,7 +164,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
end
|
||||
|
||||
# bounding_box([self.item_description_width,y_position], :width =>self.label_width+5) do
|
||||
# text "(#{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') }
|
||||
# text "(#{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') }
|
||||
# - #{ sale_data.bookings[0].checkin_at.utc.getlocal.strftime('%I:%M %p') })" ,
|
||||
# :size => self.item_font_size,:align => :right
|
||||
# end
|
||||
@@ -201,7 +201,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
end
|
||||
|
||||
def add_line_item_row(sale_items,precision,delimiter)
|
||||
|
||||
|
||||
if precision.to_i > 0
|
||||
item_name_width = (self.item_width+self.price_width)
|
||||
item_qty_front_width = (self.item_width+self.price_width) + 2
|
||||
@@ -222,14 +222,14 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
total_qty = 0.0
|
||||
show_price = Lookup.find_by_lookup_type("show_price")
|
||||
sale_items.each do |item|
|
||||
# check for item not to show
|
||||
|
||||
# check for item not to show
|
||||
|
||||
if item.status != 'Discount' && item.qty > 0
|
||||
if !show_price.nil? && show_price.value.to_i > 0 && item.price == 0
|
||||
total_qty += item.qty
|
||||
total_qty += item.qty
|
||||
else
|
||||
if item.price != 0
|
||||
total_qty += item.qty
|
||||
total_qty += item.qty
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -246,9 +246,9 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
qty = item.qty
|
||||
total_price = item.price #item.qty*item.unit_price - comment for room charges
|
||||
price = item.unit_price
|
||||
|
||||
|
||||
# end
|
||||
|
||||
|
||||
|
||||
if !show_price.nil? && show_price.value.to_i>0
|
||||
item_row(item,precision,delimiter,product_name,price,qty ,total_price)
|
||||
@@ -257,7 +257,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
item_row(item,precision,delimiter,product_name,price,qty ,total_price)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
stroke_horizontal_rule
|
||||
@@ -291,10 +291,10 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
bounding_box([0,y_position], :width =>self.item_width) do
|
||||
text "#{product_name}", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
# text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size
|
||||
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
# text_box "#{product_name}", :at =>[0,y_position], :width => self.item_width, :size => self.item_font_size
|
||||
text_box "#{number_with_precision(price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[self.item_width,y_position], :width => self.price_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(qty, :precision => precision.to_i)}", :at =>[item_qty_front_width,y_position], :width => item_qty_end_width, :size => self.item_font_size, :align => :center, :overflow => :shrink_to_fix
|
||||
text_box "#{number_with_precision(total_price, :precision => precision.to_i, :delimiter => delimiter)}", :at =>[item_total_front_width,y_position], :width =>item_total_end_width, :size => self.item_font_size, :align => :right, :overflow => :shrink_to_fix
|
||||
|
||||
if show_alt_name
|
||||
if !(item.product_alt_name).empty?
|
||||
@@ -367,7 +367,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{sale_data.rounding_adjustment}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
move_down line_move
|
||||
@@ -380,11 +380,11 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
text "#{number_with_precision(sale_data.grand_total, :precision => precision.to_i, :delimiter => delimiter)}" , :style => :bold, :size => self.header_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
|
||||
sale_payment(sale_data,precision,delimiter)
|
||||
|
||||
sale_payment(sale_data,precision,delimiter)
|
||||
end
|
||||
|
||||
def sale_payment(sale_data,precision,delimiter)
|
||||
def sale_payment(sale_data,precision,delimiter)
|
||||
stroke_horizontal_rule
|
||||
#move_down line_move
|
||||
sql = "SELECT SUM(payment_amount)
|
||||
@@ -416,13 +416,13 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
text "#{payment.payment_method.capitalize} Payment", :size => self.item_font_size,:align => :left
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(payment.payment_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
end
|
||||
if sale_data.amount_received > 0
|
||||
if sale_data.amount_received > 0
|
||||
y_position = cursor
|
||||
move_down line_move
|
||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||
@@ -437,7 +437,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
|
||||
# show member information
|
||||
def member_info(member_info,customer_name,rebate_amount,sale_data,precision,delimiter,current_balance)
|
||||
if rebate_amount != nil
|
||||
if rebate_amount != nil
|
||||
if rebate_amount["status"] == true
|
||||
stroke_horizontal_rule
|
||||
total = 0
|
||||
@@ -466,8 +466,8 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
# Total Rebate Amount if birthday
|
||||
if res["receipt_no"]== sale_data.receipt_no && res["account_status"]== "RebatebonusAccount" && res["status"]== "Rebate"
|
||||
rebate_balance = rebate_balance + res["deposit"]
|
||||
@@ -479,7 +479,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{number_with_precision(res["deposit"], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
end
|
||||
#end Total rebate if birthday
|
||||
end
|
||||
|
||||
@@ -502,7 +502,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
text "#{number_with_precision(current_balance, :precision => precision.to_i, :delimiter => delimiter)}", :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -512,7 +512,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
|
||||
if res["accountable_type"] == "RebateAccount" || res["accountable_type"] == "RebatebonusAccount"
|
||||
total_balance = total_balance + res["balance"]
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
move_down line_move
|
||||
@@ -524,7 +524,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
text "#{number_with_precision(total_balance, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
def customer(customer_name)
|
||||
@@ -554,7 +554,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "(" + "#{ number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter) }" + ")" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
end
|
||||
move_down line_move
|
||||
end
|
||||
end
|
||||
@@ -571,7 +571,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
text "#{number_with_precision(ipa[:price], :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
move_down line_move
|
||||
end
|
||||
end
|
||||
|
||||
@@ -583,7 +583,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
text "#{number_with_precision(other_amount, :precision => precision.to_i, :delimiter => delimiter)}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
move_down line_move
|
||||
move_down line_move
|
||||
end
|
||||
|
||||
#individual payment per person
|
||||
@@ -623,17 +623,17 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
JOIN sale_audits sa
|
||||
ON SUBSTRING_INDEX(sa.remark,'||',1)=sale_payment_id
|
||||
where sa.sale_id='#{sale_data.sale_id}')) = 0
|
||||
THEN payment_method!='creditnote' ELSE 1 END) AND sale_id = ?", sale_data.sale_id).each do |payment|
|
||||
THEN payment_method!='creditnote' ELSE 1 END) AND sale_id = ?", sale_data.sale_id).each do |payment|
|
||||
if payment.payment_method == "creditnote"
|
||||
|
||||
y_position = cursor
|
||||
stroke_horizontal_rule
|
||||
|
||||
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
move_down 70
|
||||
stroke_horizontal_rule
|
||||
end
|
||||
|
||||
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
move_down 73
|
||||
text "Approved By" , :size => self.item_font_size,:align => :center
|
||||
@@ -650,7 +650,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
move_down 70
|
||||
stroke_horizontal_rule
|
||||
end
|
||||
|
||||
|
||||
if sale_data.payment_status == "foc"
|
||||
bounding_box([self.label_width,y_position], :width =>self.item_description_width) do
|
||||
move_down 73
|
||||
@@ -661,9 +661,9 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
move_down 73
|
||||
text "Approved By" , :size => self.item_font_size,:align => :center
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
def shop_note(shop)
|
||||
@@ -673,8 +673,8 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
|
||||
move_down line_move
|
||||
y_position = cursor
|
||||
|
||||
text "#{shop.note}", :size => self.item_font_size, :align => :left
|
||||
|
||||
text "#{shop.note}", :size => self.item_font_size, :align => :left
|
||||
|
||||
move_down line_move
|
||||
end
|
||||
@@ -688,10 +688,10 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width =>self.label_width) do
|
||||
text "#{printed_status}",:style => :bold, :size => header_font_size,:align => :left
|
||||
end
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width+20, :height => self.item_height) do
|
||||
text "Thank You! See you Again", :left_margin => -5, :size => self.item_font_size,:align => :left
|
||||
end
|
||||
end
|
||||
|
||||
move_down line_move
|
||||
end
|
||||
@@ -729,7 +729,7 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
y_position = cursor
|
||||
bounding_box([0, y_position], :width =>self.label_width) do
|
||||
text "Card Balance: ",:style => :bold, :size => header_font_size,:align => :left
|
||||
end
|
||||
end
|
||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||
text "#{card_balance_amount}" , :size => self.item_font_size,:align => :right
|
||||
end
|
||||
@@ -753,4 +753,4 @@ class ReceiptBillStarPdf < Prawn::Document
|
||||
end
|
||||
return status
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user