-
This commit is contained in:
@@ -21,6 +21,7 @@ class Api::ApiController < ActionController::API
|
||||
|
||||
def current_login_employee
|
||||
@employee = Employee.find_by_token_session(current_token)
|
||||
puts @employee.to_json
|
||||
end
|
||||
|
||||
# def lookup_domain
|
||||
|
||||
@@ -43,7 +43,7 @@ class Api::BillController < Api::ApiController
|
||||
if booking
|
||||
if booking.sale_id.nil?
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, cashier, order.source)
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(params[:booking_id], current_login_employee, cashier, order.source,params[:current_checkin_induties_count])
|
||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
else
|
||||
@status = true
|
||||
@@ -177,7 +177,7 @@ class Api::BillController < Api::ApiController
|
||||
|
||||
if @booking.sale_id.nil?
|
||||
@sale = Sale.new
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(@booking.booking_id, current_login_employee, cashier, order.source)
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(@booking.booking_id, current_login_employee, cashier, order.source,params[:current_checkin_induties_count])
|
||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
else
|
||||
@status = true
|
||||
|
||||
60
app/controllers/api/payment/mobilepayment_controller.rb
Normal file
60
app/controllers/api/payment/mobilepayment_controller.rb
Normal file
@@ -0,0 +1,60 @@
|
||||
class Api::Payment::MobilepaymentController < Api::ApiController
|
||||
|
||||
# skip_before_action :authenticate
|
||||
|
||||
def cash
|
||||
|
||||
cash = params[:cash]
|
||||
sale_id = params[:sale_id]
|
||||
cashier_id = params[:cashier_id]
|
||||
|
||||
current_user = Employee.find(cashier_id)
|
||||
|
||||
if(Sale.exists?(sale_id))
|
||||
|
||||
saleObj = Sale.find(sale_id)
|
||||
sale_items = SaleItem.get_all_sale_items(sale_id)
|
||||
shop_detail = Shop.first
|
||||
|
||||
# rounding adjustment
|
||||
if !path.include? ("credit_payment")
|
||||
if shop_detail.is_rounding_adj
|
||||
a = saleObj.grand_total % 25 # Modulus
|
||||
b = saleObj.grand_total / 25 # Division
|
||||
#not calculate rounding if modulus is 0 and division is even
|
||||
#calculate rounding if modulus is zero or not zero and division are not even
|
||||
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||
|
||||
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||
rounding_adj = new_total-saleObj.grand_total
|
||||
saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj)
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
# end rounding adjustment
|
||||
|
||||
sale_payment = SalePayment.new
|
||||
|
||||
sale_payment =sale_payment.process_payment(saleObj, current_user, cash, "cash")
|
||||
if sale_payment[0]
|
||||
@cash ={"change_amount"=>sale_payment[3],"balance_amount"=>sale_payment[4] ,"receipt_url"=>''}
|
||||
end
|
||||
@out = true,@cash
|
||||
|
||||
else
|
||||
@out =false,"Something wrong!"
|
||||
sale_payment = SalePayment.new
|
||||
sale_payment = sale_payment.process_payment(saleObj, current_user, cash, "cash")
|
||||
if sale_payment[0]
|
||||
@cash = {"change_amount"=>sale_payment[3],"balance_amount"=>sale_payment[4] ,"receipt_url"=>''}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def kbz_pay
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
@@ -13,5 +13,8 @@ class Api::SyncController < Api::ApiController
|
||||
ShiftSale.sync_shift_sale_records(params[:shift_sales])
|
||||
Booking.sync_booking_records(params[:bookings])
|
||||
AssignedOrderItem.sync_assigned_order_item_records(params[:assigned_order_items])
|
||||
SeedGenerator.sync_seed_generator_records(params[:seed_generators])
|
||||
|
||||
# render :json => { :status => true, :message => "Hello!" }
|
||||
end
|
||||
end
|
||||
@@ -8,7 +8,7 @@ class Crm::CustomersController < BaseCrmController
|
||||
filter = params[:filter]
|
||||
filter_card_no = params[:filter_card_no]
|
||||
type = params[:type]
|
||||
@customer_update_phone_email =false
|
||||
@customer_update_phone_email_membertype =false
|
||||
if filter_card_no==""
|
||||
@crm_customers = Customer.all
|
||||
elsif !filter_card_no.nil?
|
||||
@@ -46,13 +46,16 @@ class Crm::CustomersController < BaseCrmController
|
||||
else
|
||||
@crm_customers.each do |customer|
|
||||
if customer.contact_no != response["customer_data"]["phone"]
|
||||
@customer_update_phone_email =true
|
||||
@customer_update_phone_email_membertype =true
|
||||
end
|
||||
if customer.email != response["customer_data"]["email"]
|
||||
@customer_update_phone_email =true
|
||||
@customer_update_phone_email_membertype =true
|
||||
end
|
||||
if customer.name != response["customer_data"]["name"]
|
||||
@customer_update_phone_email =true
|
||||
@customer_update_phone_email_membertype =true
|
||||
end
|
||||
if customer.membership_type.to_i != response["customer_data"]["member_group_id"]
|
||||
@customer_update_phone_email_membertype =true
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -122,7 +125,6 @@ class Crm::CustomersController < BaseCrmController
|
||||
#get customer amount
|
||||
@customer = Customer.find(params[:id])
|
||||
@response = Customer.get_membership_transactions(@customer)
|
||||
puts @response.to_json
|
||||
|
||||
Rails.logger.debug "get membership transactions response"
|
||||
Rails.logger.debug @response.to_json
|
||||
@@ -555,13 +557,14 @@ class Crm::CustomersController < BaseCrmController
|
||||
end
|
||||
end
|
||||
|
||||
def customer_update_phone_email
|
||||
def customer_update_phone_email_member_type
|
||||
@customer = Customer.find(params[:id])
|
||||
response = Customer.search_paypar_account_no(@customer.paypar_account_no)
|
||||
if response["status"] == true
|
||||
@customer.name =response["customer_data"]["name"]
|
||||
@customer.contact_no =response["customer_data"]["phone"]
|
||||
@customer.email =response["customer_data"]["email"]
|
||||
@customer.membership_type =response["customer_data"]["member_group_id"]
|
||||
@customer.save
|
||||
respond_to do |format|
|
||||
format.html { redirect_to crm_customers_path }
|
||||
|
||||
71
app/controllers/induties/assign_in_duties_controller.rb
Normal file
71
app/controllers/induties/assign_in_duties_controller.rb
Normal file
@@ -0,0 +1,71 @@
|
||||
class Induties::AssignInDutiesController < ApplicationController
|
||||
def index
|
||||
@commissioners =[]
|
||||
@commiss=Commissioner.active.all.order(created_at: :desc)
|
||||
@commiss.each do|commissioner|
|
||||
check_in_count =InDuty.where('commissioner_ids =? and out_time is null', commissioner.id.to_json).count;
|
||||
@commissioners.push({ "id"=>commissioner.id,
|
||||
"name"=>commissioner.name,
|
||||
"image_path"=>commissioner.image_path.url,
|
||||
"check_in_count"=>check_in_count
|
||||
})
|
||||
|
||||
end
|
||||
@booking_id = params[:booking_id]
|
||||
|
||||
end
|
||||
|
||||
def get_all_occupied_dining
|
||||
commissionerIds =params[:id]
|
||||
@check_in_commissioner =InDuty.select("in_duties.*,dining_facilities.type as dinning_type")
|
||||
.joins(" LEFT JOIN dining_facilities on dining_facilities.id = in_duties.dinning_id").where('commissioner_ids =? and out_time is null', commissionerIds).order(created_at: :asc);
|
||||
respond_to do |format|
|
||||
format.json { render json: @check_in_commissioner.to_json }
|
||||
end
|
||||
end
|
||||
def induties_create
|
||||
commissioner_ids =params[:commissionerId]
|
||||
booking_id =params[:booking_id]
|
||||
dinning_id = params[:dinning_id]
|
||||
induty = InDuty.new
|
||||
induty.dinning_id = dinning_id
|
||||
induty.booking_id = booking_id
|
||||
induty.commissioner_ids = commissioner_ids
|
||||
induty.by_name = params[:by_name]
|
||||
induty.in_time = Time.now.utc
|
||||
if induty.save
|
||||
dinning = DiningFacility.find(induty.dinning_id)
|
||||
@induty= {"id"=>induty.id,
|
||||
"dinning_id"=>induty.dinning_id,
|
||||
"in_time"=>induty.in_time,
|
||||
"out_time"=>induty.out_time,
|
||||
"dinning_type"=>dinning.type }
|
||||
respond_to do |format|
|
||||
format.json { render json: @induty.to_json }
|
||||
end
|
||||
end
|
||||
end
|
||||
def induties_checkout
|
||||
induty_id = params[:induty_id]
|
||||
induty = InDuty.find(induty_id)
|
||||
induty.out_time = Time.now.utc
|
||||
induty.save
|
||||
@induty =induty
|
||||
respond_to do |format|
|
||||
format.json { render json: @induty.to_json }
|
||||
end
|
||||
end
|
||||
def induties_remove
|
||||
induty_id = params[:induty_id]
|
||||
induty = InDuty.find(induty_id)
|
||||
induty.destroy
|
||||
end
|
||||
def get_current_booking
|
||||
@current_booking =InDuty.select("in_duties.*,dining_facilities.type as dinning_type")
|
||||
.joins(" LEFT JOIN dining_facilities on dining_facilities.id = in_duties.dinning_id").where('booking_id =? and out_time is null', params[:booking_id]).order(created_at: :asc);
|
||||
respond_to do |format|
|
||||
format.json { render json: @current_booking.to_json }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -38,22 +38,21 @@ class Oqs::EditController < BaseOqsController
|
||||
|
||||
if ENV["SERVER_MODE"] != "cloud" #&& order.source == 'cashier' #no print in cloud server
|
||||
# print
|
||||
assigned_item = AssignedOrderItem.find_by_instance_code_and_order_id(order_item.item_instance_code, order_item.order_id)
|
||||
assigned_item = AssignedOrderItem.find_by_instance_code_and_order_id(order_item.item_instance_code, order_item.order_id)
|
||||
assigned_items = nil
|
||||
if !assigned_item.nil?
|
||||
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'")
|
||||
end
|
||||
end
|
||||
if !assigned_items.nil?
|
||||
assigned_items.each do |assign_item|
|
||||
# order queue stations
|
||||
oqs = assign_item.order_queue_station
|
||||
|
||||
printer = PrintSetting.all
|
||||
|
||||
unique_code="OrderItemPdf"
|
||||
printer = PrintSetting.all
|
||||
unique_code= ""
|
||||
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 == 'OrderItemSlimPdf'
|
||||
unique_code="OrderItemSlimPdf"
|
||||
@@ -62,12 +61,14 @@ class Oqs::EditController < BaseOqsController
|
||||
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
|
||||
elsif printer_setting.unique_code == 'OrderItemStarPdf'
|
||||
unique_code="OrderItemStarPdf"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
|
||||
@@ -17,6 +17,7 @@ class Origami::HomeController < BaseOrigamiController
|
||||
|
||||
# origami table detail
|
||||
def show
|
||||
|
||||
@webview = check_mobile
|
||||
|
||||
@tables = Table.unscoped.all.active.order('status desc')
|
||||
@@ -35,7 +36,7 @@ class Origami::HomeController < BaseOrigamiController
|
||||
@payment_methods = PaymentMethodSetting.all
|
||||
@dining_booking = @dining.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.today.prev_day}' ")
|
||||
#@dining_booking = @dining.bookings.active.where("created_at between '#{DateTime.now.utc - 12.hours}' and '#{DateTime.now.utc}'")
|
||||
@order_items = Array.new
|
||||
@order_items = Array.new
|
||||
@dining_booking.each do |booking|
|
||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
@order_items = Array.new
|
||||
@@ -144,6 +145,7 @@ class Origami::HomeController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def check_emp_access_code
|
||||
|
||||
@@ -641,12 +641,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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -28,7 +28,7 @@ class Origami::RequestBillsController < ApplicationController
|
||||
|
||||
if check_booking.sale_id.nil?
|
||||
# Create Sale if it doesn't exist
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, current_user, order.source)
|
||||
@status, @sale_id = @sale.generate_invoice_from_booking(check_booking.id,current_login_employee, current_user, order.source, params[:current_checkin_induties_count])
|
||||
@sale_data = Sale.find_by_sale_id(@sale_id)
|
||||
@sale_items = SaleItem.where("sale_id=?",@sale_id)
|
||||
|
||||
@@ -38,6 +38,7 @@ class Origami::RequestBillsController < ApplicationController
|
||||
in_duties.each do |in_duty|
|
||||
induty = InDuty.find(in_duty.id)
|
||||
induty.sale_id = @sale_id
|
||||
induty.out_time =Time.now.utc
|
||||
induty.save
|
||||
end
|
||||
end
|
||||
|
||||
@@ -120,7 +120,7 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
if booking
|
||||
if booking.sale_id.nil?
|
||||
sale = Sale.new
|
||||
status, sale_id = sale.generate_invoice_from_booking(params[:booking_id], current_user, current_user, cashier_type)
|
||||
status, sale_id = sale.generate_invoice_from_booking(params[:booking_id], current_user, current_user, cashier_type,params[:current_checkin_induties_count])
|
||||
sale_data = Sale.find_by_sale_id(sale_id)
|
||||
else
|
||||
status = true
|
||||
@@ -333,7 +333,7 @@ class Origami::SplitBillController < BaseOrigamiController
|
||||
end
|
||||
|
||||
sale = Sale.new
|
||||
status, sale_id = sale.generate_invoice_from_booking(booking.booking_id, current_user, current_user, cashier_type)
|
||||
status, sale_id = sale.generate_invoice_from_booking(booking.booking_id, current_user, current_user, cashier_type ,params[:current_checkin_induties_count])
|
||||
end
|
||||
|
||||
Promotion.promo_activate(sale)
|
||||
|
||||
@@ -28,7 +28,7 @@ class Origami::VoidController < BaseOrigamiController
|
||||
shift.save
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
sale.rounding_adjustment = 0.0
|
||||
sale.payment_status = 'void'
|
||||
sale.sale_status = 'void'
|
||||
@@ -71,16 +71,16 @@ class Origami::VoidController < BaseOrigamiController
|
||||
table = nil
|
||||
end
|
||||
|
||||
# FOr Sale Audit
|
||||
# FOr Sale Audit
|
||||
action_by = current_user.name
|
||||
if access_code != "null" && current_user.role == "cashier"
|
||||
action_by = Employee.find_by_emp_id(access_code).name
|
||||
end
|
||||
|
||||
|
||||
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
|
||||
sale_audit = SaleAudit.record_audit_for_edit(sale_id,current_user.name, action_by,remark,"SALEVOID" )
|
||||
|
||||
# For Print
|
||||
# For Print
|
||||
|
||||
member_info = nil
|
||||
rebate_amount = nil
|
||||
@@ -88,7 +88,7 @@ class Origami::VoidController < BaseOrigamiController
|
||||
|
||||
# For Cashier by Zone
|
||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||
if bookings.count > 1
|
||||
if bookings.count > 1
|
||||
# for Multiple Booking
|
||||
if bookings[0].dining_facility_id.to_i>0
|
||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
@@ -102,12 +102,20 @@ class Origami::VoidController < BaseOrigamiController
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||
end
|
||||
|
||||
|
||||
|
||||
# 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
|
||||
shop_details = current_shop
|
||||
# get member information
|
||||
@@ -119,34 +127,48 @@ 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
|
||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale.sale_items)
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
|
||||
other_amount = SaleItem.calculate_other_charges(sale.sale_items)
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil,other_amount,nil,nil,nil)
|
||||
result = {
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "VOID",current_balance,nil,other_amount,nil,nil,nil)
|
||||
result = {
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
}
|
||||
|
||||
# Mobile Print
|
||||
render :json => result.to_json
|
||||
# end
|
||||
|
||||
|
||||
#end print
|
||||
|
||||
# update complete order items in oqs
|
||||
SaleOrder.where("sale_id = '#{ sale_id }'").find_each do |sodr|
|
||||
SaleOrder.where("sale_id = '#{ sale_id }'").find_each do |sodr|
|
||||
AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").find_each do |aoi|
|
||||
aoi.delivery_status = 1
|
||||
aoi.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -18,7 +18,7 @@ class Origami::WasteSpoileController < BaseOrigamiController
|
||||
# sale.compute_by_sale_items(sale_id, sale.sale_items,0,order_source)
|
||||
# add to sale item with foc
|
||||
# sale_items = SaleItem.where("sale_id='#{ sale_id }' and status is null")
|
||||
|
||||
|
||||
sale.sale_items.each do|item|
|
||||
# SaleItem.update_existing_item(item.qty, item, sale_id, remark, item.unit_price, item.price)
|
||||
item.status = remark
|
||||
@@ -53,7 +53,7 @@ class Origami::WasteSpoileController < BaseOrigamiController
|
||||
table = nil
|
||||
end
|
||||
|
||||
# FOr Sale Audit
|
||||
# FOr Sale Audit
|
||||
action_by = current_user.name
|
||||
if access_code != "null" && current_user.role == "cashier"
|
||||
action_by = Employee.find_by_emp_id(access_code).name
|
||||
@@ -61,7 +61,7 @@ class Origami::WasteSpoileController < BaseOrigamiController
|
||||
# remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}"
|
||||
sale_audit = SaleAudit.record_audit_for_edit(sale_id,current_user.name, action_by,remark,remark )
|
||||
|
||||
# For Print
|
||||
# For Print
|
||||
|
||||
member_info = nil
|
||||
rebate_amount = nil
|
||||
@@ -69,7 +69,7 @@ class Origami::WasteSpoileController < BaseOrigamiController
|
||||
|
||||
# For Cashier by Zone
|
||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
||||
if bookings.count > 1
|
||||
if bookings.count > 1
|
||||
# for Multiple Booking
|
||||
if bookings[0].dining_facility_id.to_i>0
|
||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
||||
@@ -83,12 +83,12 @@ class Origami::WasteSpoileController < BaseOrigamiController
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
cashier_terminal = CashierTerminal.find(shift.cashier_terminal_id)
|
||||
end
|
||||
|
||||
|
||||
|
||||
# if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||
unique_code = "ReceiptBillPdf"
|
||||
# unique_code = "ReceiptBillPdf"
|
||||
customer= Customer.find(sale.customer_id)
|
||||
|
||||
|
||||
#shop detail
|
||||
shop_details = current_shop
|
||||
# get member information
|
||||
@@ -100,34 +100,49 @@ 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
|
||||
item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale.sale_items)
|
||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items)
|
||||
other_amount = SaleItem.calculate_other_charges(sale.sale_items)
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, remark,current_balance,nil,other_amount,nil,nil,nil)
|
||||
result = {
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, remark,current_balance,nil,other_amount,nil,nil,nil)
|
||||
result = {
|
||||
:filepath => filename,
|
||||
:printer_model => print_settings.brand_name,
|
||||
:printer_url => print_settings.api_settings
|
||||
}
|
||||
|
||||
# Mobile Print
|
||||
render :json => result.to_json
|
||||
# end
|
||||
|
||||
|
||||
#end print
|
||||
|
||||
# update complete order items in oqs
|
||||
SaleOrder.where("sale_id = '#{ sale_id }'").find_each do |sodr|
|
||||
SaleOrder.where("sale_id = '#{ sale_id }'").find_each do |sodr|
|
||||
AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").find_each do |aoi|
|
||||
aoi.delivery_status = 1
|
||||
aoi.save
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -77,6 +77,7 @@ authorize_resource :class => false
|
||||
# url = "http://192.168.1.176:3000/en/api/sync_data"
|
||||
url = Lookup.sync_url
|
||||
token = Lookup.get_sync_token
|
||||
@message = ''
|
||||
# token = Lookup.token
|
||||
|
||||
unless url.nil? and token.nil?
|
||||
@@ -118,11 +119,12 @@ authorize_resource :class => false
|
||||
|
||||
puts url
|
||||
puts response
|
||||
end
|
||||
@message = @result.parsed_response['message']
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to '/en/reports/receipt_no/', notice: 'Sync Record Completed.'}
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html { redirect_to '/en/reports/receipt_no/', notice: @message}
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
@@ -130,6 +130,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)
|
||||
|
||||
@@ -18,6 +18,7 @@ class Settings::CommissionersController < ApplicationController
|
||||
def new
|
||||
@commissioner = Commissioner.new
|
||||
@employee = Employee.all.order('name asc')
|
||||
|
||||
end
|
||||
|
||||
# GET /commissioners/1/edit
|
||||
@@ -35,14 +36,21 @@ class Settings::CommissionersController < ApplicationController
|
||||
unless @commissioner.resigned_date.nil?
|
||||
@commissioner.resigned_date = @commissioner.resigned_date.utc.getlocal.strftime('%Y-%b-%d')
|
||||
end
|
||||
respond_to do |format|
|
||||
if @commissioner.save
|
||||
format.html {redirect_to settings_commissioners_path, notice: 'Commissioner was successfully created.'}
|
||||
format.json {render :show, status: :created, location: @commissioner}
|
||||
else
|
||||
format.html {render :new}
|
||||
format.json {render json: @commissioner.errors, status: :unprocessable_entity}
|
||||
# puts params[:from_induty].length
|
||||
if (params[:from_induty] != "true")
|
||||
respond_to do |format|
|
||||
if @commissioner.save
|
||||
format.html {redirect_to settings_commissioners_path, notice: 'Commissioner was successfully created.'}
|
||||
format.json {render :show, status: :created, location: @commissioner}
|
||||
else
|
||||
format.html {render :new}
|
||||
format.json {render json: @commissioner.errors, status: :unprocessable_entity}
|
||||
end
|
||||
end
|
||||
else
|
||||
@commissioner.save
|
||||
flash[:notice] = 'Commissioner was successfully created.'
|
||||
redirect_to induties_assign_in_duties_path(params[:booking_id])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user