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