print service

This commit is contained in:
code2lab
2019-06-05 13:54:03 +06:30
17 changed files with 357 additions and 297 deletions

View File

@@ -84,12 +84,12 @@ For ReceiptBillAltName options
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
1) settings/print_settings/unique_code => OrderItemStarPdf
2) settings/print_settings/unique_code => ReceiptBillStarPdf
3) settings/print_settings/unique_code => SaleItemsStarPdf
*** Other print settings aren't need to change.
For Sale Items Summary Include at CloseCashierPrint
For Show Sale Items Summary at CloseCashierPrint
1) settings/print_settings
a) Check => Shift Sale Items

View File

@@ -49,8 +49,7 @@ class Oqs::EditController < BaseOqsController
oqs = assign_item.order_queue_station
printer = PrintSetting.all
unique_code="OrderItemPdf"
unique_code= ""
if !printer.empty?
printer.each do |printer_setting|
if printer_setting.unique_code == 'OrderItemPdf'
@@ -65,6 +64,8 @@ class Oqs::EditController < BaseOqsController
unique_code="OrderSetItemCustomisePdf"
elsif printer_setting.unique_code == 'OrderItemSlimCustomisePdf'
unique_code="OrderItemSlimCustomisePdf"
elsif printer_setting.unique_code == 'OrderItemStarPdf'
unique_code="OrderItemStarPdf"
end
end
end

View File

@@ -635,12 +635,25 @@ class Origami::PaymentsController < BaseOrigamiController
saleObj = Sale.find(sale_id)
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
unique_code = "ReceiptBillPdf"
# unique_code = "ReceiptBillPdf"
customer= Customer.find(saleObj.customer_id)
#shop detail
#shop_detail = Shop.first
printer = PrintSetting.all
unique_code="ReceiptBillPdf"
if !printer.empty?
printer.each do |printer_setting|
if printer_setting.unique_code == 'ReceiptBillPdf'
unique_code="ReceiptBillPdf"
elsif printer_setting.unique_code == 'ReceiptBillA5Pdf'
unique_code="ReceiptBillA5Pdf"
elsif printer_setting.unique_code == 'ReceiptBillStarPdf'
unique_code="ReceiptBillStarPdf"
end
end
end
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total

View File

@@ -30,13 +30,15 @@ class Origami::QuickServiceController < ApplicationController
end
#checked quick_service only
@quick_service_only = true
lookup_dine_in = Lookup.collection_of('dinein_cashier')
@quick_service_only = false
lookup_dine_in = Lookup.collection_of('quickservice_add_order')
puts 'lookup_dine_in!!!!'
puts lookup_dine_in
if !lookup_dine_in.empty?
lookup_dine_in.each do |dine_in|
if dine_in[0].downcase == "dineincashier"
if dine_in[0].downcase == "quickserviceaddorder"
if dine_in[1] == '1'
@quick_service_only = false
@quick_service_only = true
end
end
end

View File

@@ -105,7 +105,15 @@ class Origami::VoidController < BaseOrigamiController
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
unique_code = "ReceiptBillPdf"
# get printer info
# print_settings = PrintSetting.find_by_unique_code('ReceiptBillPdf') # SaleItemsPdf
#
# if !print_settings.nil?
# unique_code = 'ReceiptBillPdf'
# elsif
# unique_code = 'ReceiptBillStarPdf'
# end
customer= Customer.find(sale.customer_id)
#shop detail
@@ -119,6 +127,20 @@ class Origami::VoidController < BaseOrigamiController
current_balance = 0
end
printer = PrintSetting.all
unique_code="ReceiptBillPdf"
if !printer.empty?
printer.each do |printer_setting|
if printer_setting.unique_code == 'ReceiptBillPdf'
unique_code="ReceiptBillPdf"
elsif printer_setting.unique_code == 'ReceiptBillA5Pdf'
unique_code="ReceiptBillA5Pdf"
elsif printer_setting.unique_code == 'ReceiptBillStarPdf'
unique_code="ReceiptBillStarPdf"
end
end
end
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total

View File

@@ -86,7 +86,7 @@ class Origami::WasteSpoileController < BaseOrigamiController
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
unique_code = "ReceiptBillPdf"
# unique_code = "ReceiptBillPdf"
customer= Customer.find(sale.customer_id)
#shop detail
@@ -100,6 +100,21 @@ class Origami::WasteSpoileController < BaseOrigamiController
current_balance = 0
end
printer = PrintSetting.all
unique_code="ReceiptBillPdf"
if !printer.empty?
printer.each do |printer_setting|
if printer_setting.unique_code == 'ReceiptBillPdf'
unique_code="ReceiptBillPdf"
elsif printer_setting.unique_code == 'ReceiptBillA5Pdf'
unique_code="ReceiptBillA5Pdf"
elsif printer_setting.unique_code == 'ReceiptBillStarPdf'
unique_code="ReceiptBillStarPdf"
end
end
end
# get printer info
print_settings=PrintSetting.find_by_unique_code(unique_code)
# Calculate Food and Beverage Total

View File

@@ -124,6 +124,11 @@ class Reports::SaleitemController < BaseReportController
print_settings = PrintSetting.find_by_unique_code('SaleItemsPdf') # SaleItemsPdf
print_settings_star = PrintSetting.find_by_unique_code('SaleItemsStarPdf')
# if print_settings.nil? && print_settings_star.nil?
# @print_setting = PrintSetting.new(name: "SaleItemsPdf", unique_code: "SaleItemsPdf", template: "",font: "Zawgyi-One", header_font_size: "10", item_font_size: "8", printer_name: "", api_settings: "", brand_name: nil, printer_type: nil, page_width: "210", page_height: "1450", print_copies: "1", precision: "0", delimiter: "0", heading_space: "5" )
# @print_setting.save
# end
if print_settings.nil?
if !print_settings_star.nil?
printer = Printer::CashierStationPrinter.new(print_settings_star)

View File

@@ -11,11 +11,11 @@ class Printer::OrderQueuePrinter < Printer::PrinterWorker
options = order_item[0].options
# 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
# check for item not to show
pdf = ''
# if order_item[0].price != 0
if !print_setting.empty?
print_setting.each do |print_settings|

View File

@@ -1,12 +1,13 @@
class MoveTablePdf < 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
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
def initialize(printer_settings,to,from,shop_detail,date,type,moved_by,order_items)
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.margin_top = 7
self.price_width = 40 # No Need for item
self.qty_width = 40
self.total_width = 40 # No Need for item
@@ -15,7 +16,7 @@ class MoveTablePdf < Prawn::Document
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
self.label_width=90
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
super(:margin => [self.margin_top, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
# db font setup
if printer_settings.font != ""

View File

@@ -1,6 +1,6 @@
class OrderItemPdf < 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
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
def initialize(print_settings,order_item, print_status, options, alt_name, before_updated_qty)
self.page_width = print_settings.page_width
@@ -8,6 +8,7 @@ class OrderItemPdf < Prawn::Document
self.header_font_size = print_settings.header_font_size.to_i
self.item_font_size = print_settings.item_font_size.to_i
self.margin = 0
self.margin_top = 7
self.price_width = 40 # No Need for item
self.qty_width = 40
self.total_width = 40 # No Need for item
@@ -16,7 +17,7 @@ class OrderItemPdf < Prawn::Document
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
self.label_width=90
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
super(:margin => self.margin_top, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
# db font setup

View File

@@ -1,6 +1,6 @@
class OrderItemStarPdf < 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
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :price_width, :item_width, :header_font_size, :item_font_size,:item_height,:qty_width,:total_width,:item_description_width
def initialize(print_settings,order_item, print_status, options, alt_name, before_updated_qty)
self.page_width = print_settings.page_width
@@ -8,6 +8,7 @@ class OrderItemStarPdf < Prawn::Document
self.header_font_size = print_settings.header_font_size.to_i
self.item_font_size = print_settings.item_font_size.to_i
self.margin = 0
self.margin_top = 7
self.price_width = 40 # No Need for item
self.qty_width = 38
self.total_width = 40 # No Need for item
@@ -16,7 +17,7 @@ class OrderItemStarPdf < Prawn::Document
self.item_description_width = self.page_width - (self.price_width + self.qty_width + self.total_width)
self.label_width=90
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
super(:margin => [self.margin_top, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
# db font setup

View File

@@ -1,7 +1,7 @@
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
attr_accessor :label_width,:price_column_width,:page_width, :page_height, :margin, :margin_top, :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
@@ -9,6 +9,7 @@ class ReceiptBillStarPdf < Prawn::Document
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.margin_top = 10
self.price_width = 60
self.qty_width = 20
self.total_width = 40
@@ -25,7 +26,7 @@ class ReceiptBillStarPdf < Prawn::Document
# @double = @qty_width * 1.3
# @half_qty = @qty_width / 2
#setting page margin and width
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
super(:margin => [self.margin_top, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
#precision checked
if printer_settings.precision.to_i > 2

View File

@@ -165,15 +165,15 @@
Back
</button>
<% if @quick_service_only %>
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-9" id='pending_order' style="padding: .5rem 0.15rem !important;">Pending Order
</button>
<% else %>
<%# <% if @quick_service_only %>
<!-- <button type="button" class="btn btn-lg btn-primary waves-effect col-md-9" id='pending_order' style="padding: .5rem 0.15rem !important;">Pending Order
</button> -->
<%# <% else %>
<button type="button" class="btn btn-lg btn-primary waves-effect col-md-6" id='pending_order' style="padding: .5rem 0.15rem !important;">Pending Order
</button>
<a class="btn btn-lg bg-blue waves-effect select_table col-md-3" data-toggle="modal" data-target="#TableModal" style=" padding: .5rem 0.15rem !important;">Select</a>
<input type="hidden" name="table_id" value="" id="table_id">
<% end %>
<%# <% end %>
<%else%>
<button type="button" class="btn btn-lg btn-block btn-default waves-effect" id='back'>
<i class="material-icons">reply</i>Back
@@ -281,7 +281,7 @@
<button type="button" class="btn btn-primary action-btn create col-md-7" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Add Order</button>
<% end %>
<%end%>
<% if !@quick_service_only && current_user.role == "waiter"%>
<% if @quick_service_only && current_user.role == "waiter"%>
<button type="button" class="btn btn-primary action-btn create col-md-7" id="create_order" disabled="disabled" style="padding-top:15px !important;padding-bottom:15px !important;">Add Order</button>
<%end%>
<%else%>

View File

@@ -46,8 +46,6 @@
</tr>
</thead>
<tbody>
<% puts 'testing!!!!!!' %>
<% puts @print_settings.precision.to_i %>
<% if @print_settings.precision.to_i > 0
precision = @print_settings.precision
else

View File

@@ -21,11 +21,11 @@ class ActionController::Base
end
else
# check for license file
#if check_license
#current_license(ENV["SX_PROVISION_URL"])
#else
#redirect_to activate_path
#end
if check_license
current_license(ENV["SX_PROVISION_URL"])
else
redirect_to activate_path
end
end
end

View File

@@ -1,10 +1,10 @@
#application_path="#{File.expand_path("../..", __FILE__)}"
#directory application_path
application_path="#{File.expand_path("../..", __FILE__)}"
directory application_path
#environment ENV.fetch("RAILS_ENV") { "production" }
#environment "production"
#pidfile "#{application_path}/tmp/puma/pid"
#state_path "#{application_path}/tmp/puma/state"
#stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
#port ENV.fetch("PORT") { 62158 }
#workers 2
#preload_app!
environment "production"
pidfile "#{application_path}/tmp/puma/pid"
state_path "#{application_path}/tmp/puma/state"
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
port ENV.fetch("PORT") { 62158 }
workers 2
preload_app!