conflict data
This commit is contained in:
@@ -229,8 +229,11 @@ class Api::OrdersController < Api::ApiController
|
|||||||
|
|
||||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||||
# print
|
# print
|
||||||
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
|
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 + "'")
|
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'")
|
||||||
|
end
|
||||||
|
|
||||||
if !assigned_items.nil?
|
if !assigned_items.nil?
|
||||||
assigned_items.each do |assign_item|
|
assigned_items.each do |assign_item|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class Oqs::EditController < BaseOqsController
|
|||||||
|
|
||||||
if ENV["SERVER_MODE"] != "cloud" && order.source == 'cashier' #no print in cloud server
|
if ENV["SERVER_MODE"] != "cloud" && order.source == 'cashier' #no print in cloud server
|
||||||
# print
|
# print
|
||||||
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
|
assigned_item = AssignedOrderItem.find_by_instance_code_and_order_id(order_item.item_instance_code, order_item.order_id)
|
||||||
assigned_items = nil
|
assigned_items = nil
|
||||||
if !assigned_item.nil?
|
if !assigned_item.nil?
|
||||||
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 + "'")
|
||||||
|
|||||||
@@ -96,8 +96,8 @@ class Origami::AddordersController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
Rails.logger.debug "Order Source - " + params[:order_source].to_s
|
# Rails.logger.debug "Order Source - " + params[:order_source].to_s
|
||||||
Rails.logger.debug "Table ID - " + params[:table_id].to_s
|
# Rails.logger.debug "Table ID - " + params[:table_id].to_s
|
||||||
is_extra_time = false
|
is_extra_time = false
|
||||||
extra_time = ''
|
extra_time = ''
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,9 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@rooms = Room.unscoped.all.active.order('status desc')
|
@rooms = Room.unscoped.all.active.order('status desc')
|
||||||
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
@complete = Sale.where("DATE_FORMAT(created_at,'%Y-%m-%d') = ? and sale_status != 'new'",DateTime.now.strftime('%Y-%m-%d'))
|
||||||
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
@orders = Order.includes("sale_orders").where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status != 'billed' and source != 'quick_service'",DateTime.now.strftime('%Y-%m-%d')).order('date desc')
|
||||||
@shop = Shop.first
|
|
||||||
@customers = Customer.pluck("customer_id, name")
|
@customers = Customer.pluck("customer_id, name")
|
||||||
|
@shop = shop_detail
|
||||||
# @shift = ShiftSale.current_open_shift(current_user.id)
|
# @shift = ShiftSale.current_open_shift(current_user.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -27,7 +28,7 @@ class Origami::HomeController < BaseOrigamiController
|
|||||||
@status_sale = ""
|
@status_sale = ""
|
||||||
@sale_array = Array.new
|
@sale_array = Array.new
|
||||||
|
|
||||||
@shop = Shop.first
|
@shop = shop_detail
|
||||||
@membership = MembershipSetting::MembershipSetting
|
@membership = MembershipSetting::MembershipSetting
|
||||||
@payment_methods = PaymentMethodSetting.all
|
@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("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}' ")
|
||||||
|
|||||||
@@ -44,11 +44,11 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
|
|
||||||
#shop detail
|
#shop detail
|
||||||
shop_details = Shop.first
|
## shop_detail = Shop.first
|
||||||
# customer= Customer.where('customer_id=' +.customer_id)
|
# customer= Customer.where('customer_id=' +.customer_id)
|
||||||
customer = Customer.find(sale_data.customer_id)
|
customer = Customer.find(sale_data.customer_id)
|
||||||
# rounding adjustment
|
# rounding adjustment
|
||||||
if shop_details.is_rounding_adj
|
if shop_detail.is_rounding_adj
|
||||||
a = sale_data.grand_total % 25 # Modulus
|
a = sale_data.grand_total % 25 # Modulus
|
||||||
b = sale_data.grand_total / 25 # Division
|
b = sale_data.grand_total / 25 # Division
|
||||||
#not calculate rounding if modulus is 0 and division is even
|
#not calculate rounding if modulus is 0 and division is even
|
||||||
@@ -79,7 +79,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
|
||||||
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_details, "Frt",current_balance,nil)
|
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)
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
:filepath => filename,
|
:filepath => filename,
|
||||||
@@ -102,9 +102,9 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
if(Sale.exists?(sale_id))
|
if(Sale.exists?(sale_id))
|
||||||
saleObj = Sale.find(sale_id)
|
saleObj = Sale.find(sale_id)
|
||||||
sale_items = SaleItem.get_all_sale_items(sale_id)
|
sale_items = SaleItem.get_all_sale_items(sale_id)
|
||||||
shop_details = Shop.first
|
#shop_detail = Shop.first
|
||||||
# rounding adjustment
|
# rounding adjustment
|
||||||
if shop_details.is_rounding_adj
|
if shop_detail.is_rounding_adj
|
||||||
a = saleObj.grand_total % 25 # Modulus
|
a = saleObj.grand_total % 25 # Modulus
|
||||||
b = saleObj.grand_total / 25 # Division
|
b = saleObj.grand_total / 25 # Division
|
||||||
#not calculate rounding if modulus is 0 and division is even
|
#not calculate rounding if modulus is 0 and division is even
|
||||||
@@ -123,16 +123,10 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
rebate_amount = nil
|
rebate_amount = nil
|
||||||
|
|
||||||
# For Cashier by Zone
|
# For Cashier by Zone
|
||||||
bookings = Booking.where("sale_id='#{sale_id}'")
|
# bookings = Booking.where("sale_id='#{sale_id}'")
|
||||||
# if bookings.count > 1
|
bookings = Booking.find_by_sale_id(sale_id)
|
||||||
# # for Multiple Booking
|
if bookings.dining_facility_id.to_i > 0
|
||||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
table = DiningFacility.find(bookings.dining_facility_id)
|
||||||
# else
|
|
||||||
# table = DiningFacility.find(bookings[0].dining_facility_id)
|
|
||||||
# end
|
|
||||||
|
|
||||||
if bookings[0].dining_facility_id.to_i > 0
|
|
||||||
table = DiningFacility.find(bookings[0].dining_facility_id)
|
|
||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
cashier_zone = CashierTerminalByZone.find_by_zone_id(table.zone_id)
|
||||||
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
cashier_terminal = CashierTerminal.find(cashier_zone.cashier_terminal_id)
|
||||||
|
|
||||||
@@ -216,7 +210,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Paid",current_balance,card_data)
|
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Paid",current_balance,card_data)
|
||||||
|
|
||||||
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
|
render json: JSON.generate({:status => saleObj.rebate_status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name})
|
||||||
|
|
||||||
@@ -255,7 +249,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
if !@lookup_pdf.nil?
|
if !@lookup_pdf.nil?
|
||||||
@pdf_view = @lookup_pdf.value
|
@pdf_view = @lookup_pdf.value
|
||||||
end
|
end
|
||||||
@shop = Shop.first #show shop info
|
@shop = shop_detail #show shop info
|
||||||
|
|
||||||
@customer_lists = Customer.where("customer_id = 'CUS-000000000001' or customer_id = 'CUS-000000000002'")
|
@customer_lists = Customer.where("customer_id = 'CUS-000000000001' or customer_id = 'CUS-000000000002'")
|
||||||
|
|
||||||
@@ -435,7 +429,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
customer= Customer.find(saleObj.customer_id)
|
customer= Customer.find(saleObj.customer_id)
|
||||||
|
|
||||||
#shop detail
|
#shop detail
|
||||||
shop_details = Shop.first
|
#shop_detail = Shop.first
|
||||||
# get member information
|
# get member information
|
||||||
rebate = MembershipSetting.find_by_rebate(1)
|
rebate = MembershipSetting.find_by_rebate(1)
|
||||||
if customer.membership_id != nil && rebate
|
if customer.membership_id != nil && rebate
|
||||||
@@ -464,7 +458,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items)
|
||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "Re-print",current_balance,card_data)
|
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Re-print",current_balance,card_data)
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
:status => true,
|
:status => true,
|
||||||
@@ -539,7 +533,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
customer= Customer.find(saleObj.customer_id)
|
customer= Customer.find(saleObj.customer_id)
|
||||||
|
|
||||||
#shop detail
|
#shop detail
|
||||||
shop_details = Shop.first
|
#shop_detail = Shop.first
|
||||||
|
|
||||||
# get printer info
|
# get printer info
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
@@ -549,7 +543,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
|
|
||||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||||
|
|
||||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_details, "FOC",nil,nil)
|
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings,cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "FOC",nil,nil)
|
||||||
result = {
|
result = {
|
||||||
:status => true,
|
:status => true,
|
||||||
:filepath => filename,
|
:filepath => filename,
|
||||||
@@ -579,7 +573,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
|||||||
def rounding_adj
|
def rounding_adj
|
||||||
|
|
||||||
saleObj = Sale.find(params[:sale_id])
|
saleObj = Sale.find(params[:sale_id])
|
||||||
@shop = Shop.find_by_id(1)
|
@shop = shop_detail
|
||||||
|
|
||||||
if @shop.is_rounding_adj
|
if @shop.is_rounding_adj
|
||||||
a = saleObj.grand_total % 25 # Modulus
|
a = saleObj.grand_total % 25 # Modulus
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ class Origami::ShiftsController < BaseOrigamiController
|
|||||||
cashier_terminal.save
|
cashier_terminal.save
|
||||||
|
|
||||||
#add shift_sale_id to card_settle_trans
|
#add shift_sale_id to card_settle_trans
|
||||||
|
bank_integration = Lookup.find_by_lookup_type('bank_integration')
|
||||||
|
if !bank_integration.nil?
|
||||||
card_settle_trans = CardSettleTran.select('id').where(['shift_sale_id IS NULL and status IS NOT NULL'])
|
card_settle_trans = CardSettleTran.select('id').where(['shift_sale_id IS NULL and status IS NOT NULL'])
|
||||||
|
|
||||||
card_settle_trans.each do |data|
|
card_settle_trans.each do |data|
|
||||||
@@ -60,6 +62,7 @@ class Origami::ShiftsController < BaseOrigamiController
|
|||||||
card_sett_trans.shift_sale_id = @shift.id
|
card_sett_trans.shift_sale_id = @shift.id
|
||||||
card_sett_trans.save()
|
card_sett_trans.save()
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||||
|
|
||||||
@@ -77,7 +80,7 @@ class Origami::ShiftsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
shop_details = Shop.find(1)
|
shop_details = shop_detail
|
||||||
#get tax
|
#get tax
|
||||||
shift_obj = ShiftSale.where('id =?',@shift.id)
|
shift_obj = ShiftSale.where('id =?',@shift.id)
|
||||||
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
|
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
|
||||||
|
|||||||
@@ -44,8 +44,9 @@ class Order < ApplicationRecord
|
|||||||
|
|
||||||
if self.table_id.to_i > 0
|
if self.table_id.to_i > 0
|
||||||
table = DiningFacility.find(self.table_id)
|
table = DiningFacility.find(self.table_id)
|
||||||
table.status = "occupied"
|
table.update_attributes(status:"occupied")
|
||||||
table.save
|
# table.status = "occupied"
|
||||||
|
# table.save
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -144,7 +145,7 @@ class Order < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
#if (!menu_item.nil?)
|
#if (!menu_item.nil?)
|
||||||
Rails.logger.debug menu_item
|
# Rails.logger.debug menu_item
|
||||||
set_order_items = Array.new
|
set_order_items = Array.new
|
||||||
##If menu Item set item - must add child items to order as well, where price is only take from menu_item
|
##If menu Item set item - must add child items to order as well, where price is only take from menu_item
|
||||||
if (menu_item[:type] == "SetMenuItem")
|
if (menu_item[:type] == "SetMenuItem")
|
||||||
@@ -189,16 +190,18 @@ class Order < ApplicationRecord
|
|||||||
|
|
||||||
def update_items_status_to_billed(items)
|
def update_items_status_to_billed(items)
|
||||||
if (items.nil?)
|
if (items.nil?)
|
||||||
|
OrderItem.where({ order_items_id: '#{self.order_items.pluck(:order_items_id)}'}).update_all(order_item_status: "billed")
|
||||||
##Update the order status to ensure that reflect the stage
|
##Update the order status to ensure that reflect the stage
|
||||||
self.order_items.each do |item|
|
# self.order_items.each do |item|
|
||||||
item.order_item_status = "billed"
|
# item.order_item_status = "billed"
|
||||||
item.save
|
# item.save
|
||||||
end
|
# end
|
||||||
else
|
else
|
||||||
items.each do |item|
|
OrderItem.where({ order_items_id: '#{items.pluck(:order_items_id)}'}).update_all(order_item_status: "billed")
|
||||||
item.order_item_status = "billed"
|
# items.each do |item|
|
||||||
item.save
|
# item.order_item_status = "billed"
|
||||||
end
|
# item.save
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -232,12 +232,15 @@ class OrderQueueStation < ApplicationRecord
|
|||||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||||
order_queue_printer.print_order_summary(print_settings, oqs,order.order_id, order_items, print_status="")
|
order_queue_printer.print_order_summary(print_settings, oqs,order.order_id, order_items, print_status="")
|
||||||
|
|
||||||
AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai|
|
assigned =AssignedOrderItem.where("order_id = '#{ order.order_id }'").pluck(:assigned_order_item_id)
|
||||||
# update print status for order items
|
AssignedOrderItem.where({ order_id: '#{assigned}'}).update_all(print_status: true)
|
||||||
ai.print_status=true
|
# assigned_items =AssignedOrderItem.where("order_id = '#{ order.order_id }'")
|
||||||
ai.save
|
|
||||||
end
|
|
||||||
|
|
||||||
|
# assigned_items.each do |ai|
|
||||||
|
# # update print status for order items
|
||||||
|
# ai.print_status=true
|
||||||
|
# ai.save
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
#Print order_item in 1 slip per item
|
#Print order_item in 1 slip per item
|
||||||
@@ -273,9 +276,12 @@ class OrderQueueStation < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
# update print status for completed same order items
|
# update print status for completed same order items
|
||||||
AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai|
|
# AssignedOrderItem.where("order_id = '#{ order.order_id }'").update_all(print_status: true)
|
||||||
ai.print_status=true
|
# AssignedOrderItem.where("order_id = '#{ order.order_id }'").find_each do |ai|
|
||||||
ai.save
|
# ai.print_status=true
|
||||||
end
|
# ai.save
|
||||||
|
# end
|
||||||
|
assigned =AssignedOrderItem.where("order_id = '#{ order.order_id }'").pluck(:assigned_order_item_id)
|
||||||
|
AssignedOrderItem.where({ order_id: '#{assigned}'}).update_all(print_status: true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -412,7 +412,7 @@ class Sale < ApplicationRecord
|
|||||||
|
|
||||||
# Tax Re-Calculte
|
# Tax Re-Calculte
|
||||||
def compute_tax(sale, total_taxable, total_discount = 0, order_source = nil, tax_type=nil)
|
def compute_tax(sale, total_taxable, total_discount = 0, order_source = nil, tax_type=nil)
|
||||||
shop = Shop.first();
|
shop = Shop.first
|
||||||
|
|
||||||
#if tax is not apply create new record
|
#if tax is not apply create new record
|
||||||
SaleTax.where("sale_id='#{sale.sale_id}'").find_each do |existing_tax|
|
SaleTax.where("sale_id='#{sale.sale_id}'").find_each do |existing_tax|
|
||||||
@@ -495,7 +495,7 @@ class Sale < ApplicationRecord
|
|||||||
|
|
||||||
# Tax Calculate
|
# Tax Calculate
|
||||||
def apply_tax(total_taxable, order_source = nil)
|
def apply_tax(total_taxable, order_source = nil)
|
||||||
shop = Shop.first();
|
shop = Shop.first
|
||||||
|
|
||||||
#if tax is not apply create new record
|
#if tax is not apply create new record
|
||||||
SaleTax.where("sale_id='#{self.sale_id}'").find_each do |existing_tax|
|
SaleTax.where("sale_id='#{self.sale_id}'").find_each do |existing_tax|
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ class SaleOrder < ApplicationRecord
|
|||||||
belongs_to :order
|
belongs_to :order
|
||||||
|
|
||||||
def create_sale_order(sale, order)
|
def create_sale_order(sale, order)
|
||||||
self.sale_id = sale
|
sale_order = SaleOrder.new
|
||||||
self.order_id = order
|
sale_order.sale_id = sale
|
||||||
self.save
|
sale_order.order_id = order
|
||||||
|
sale_order.save!
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -71,10 +71,12 @@ class SalePayment < ApplicationRecord
|
|||||||
# update complete order items in oqs
|
# update complete order items in oqs
|
||||||
booking = Booking.find_by_sale_id(sale_id)
|
booking = Booking.find_by_sale_id(sale_id)
|
||||||
booking.booking_orders.each do |sodr|
|
booking.booking_orders.each do |sodr|
|
||||||
AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").find_each do |aoi|
|
assigned =AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").pluck(:assigned_order_item_id)
|
||||||
aoi.delivery_status = 1
|
AssignedOrderItem.where({ order_id: '#{assigned}'}).update_all(print_status: true)
|
||||||
aoi.save
|
# AssignedOrderItem.where("order_id = '#{ sodr.order_id }'").find_each do |aoi|
|
||||||
end
|
# aoi.delivery_status = 1
|
||||||
|
# aoi.save
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
return true, self.save,membership_data
|
return true, self.save,membership_data
|
||||||
@@ -616,8 +618,9 @@ class SalePayment < ApplicationRecord
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if status && sale_count == 0
|
if status && sale_count == 0
|
||||||
table.status = "available"
|
table.update_attributes(status: "available")
|
||||||
table.save
|
# table.status = "available"
|
||||||
|
# table.save
|
||||||
end
|
end
|
||||||
|
|
||||||
# type = 'payment'
|
# type = 'payment'
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ class ShiftSale < ApplicationRecord
|
|||||||
belongs_to :employee, :foreign_key => 'employee_id'
|
belongs_to :employee, :foreign_key => 'employee_id'
|
||||||
|
|
||||||
def self.current_shift
|
def self.current_shift
|
||||||
today_date = DateTime.now.strftime("%Y-%m-%d")
|
# today_date = DateTime.now.strftime("%Y-%m-%d")
|
||||||
shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null").take
|
shift = ShiftSale.where("shift_started_at is not null and shift_closed_at is null").first
|
||||||
return shift
|
return shift
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -199,9 +199,9 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
move_down line_move
|
move_down line_move
|
||||||
sub_total = 0.0
|
sub_total = 0.0
|
||||||
total_qty = 0.0
|
total_qty = 0.0
|
||||||
|
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
|
||||||
show_price = Lookup.find_by_lookup_type("show_price")
|
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
@@ -6,25 +6,21 @@ if @zones
|
|||||||
#List all tables
|
#List all tables
|
||||||
json.tables zone.tables do |table|
|
json.tables zone.tables do |table|
|
||||||
if table.is_active
|
if table.is_active
|
||||||
booking = table.get_current_booking
|
|
||||||
json.id table.id
|
json.id table.id
|
||||||
json.name table.name
|
json.name table.name
|
||||||
json.status table.status
|
json.status table.status
|
||||||
json.zone_id table.zone_id #Add this zone_id to keep data structure consistance
|
json.zone_id table.zone_id #Add this zone_id to keep data structure consistance
|
||||||
json.current_booking booking.booking_id rescue ""
|
json.current_booking table.get_current_booking.booking_id rescue ""
|
||||||
json.sale_id booking.sale_id rescue ""
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
json.rooms zone.rooms do |room|
|
json.rooms zone.rooms do |room|
|
||||||
if room.is_active
|
if room.is_active
|
||||||
booking = room.get_current_booking
|
|
||||||
json.id room.id
|
json.id room.id
|
||||||
json.name room.name
|
json.name room.name
|
||||||
json.status room.status
|
json.status room.status
|
||||||
json.zone_id room.zone_id #Add this zone_id to keep data structure consistance
|
json.zone_id room.zone_id #Add this zone_id to keep data structure consistance
|
||||||
json.current_booking booking.booking_id rescue ""
|
json.current_booking room.get_current_booking.booking_id rescue ""
|
||||||
json.sale_id booking.sale_id rescue ""
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -32,25 +28,21 @@ if @zones
|
|||||||
else #list all tables and rooms with out zones
|
else #list all tables and rooms with out zones
|
||||||
json.tables @all_tables do |table|
|
json.tables @all_tables do |table|
|
||||||
if table.is_active
|
if table.is_active
|
||||||
booking = table.get_current_booking
|
|
||||||
json.id table.id
|
json.id table.id
|
||||||
json.name table.name
|
json.name table.name
|
||||||
json.status table.status
|
json.status table.status
|
||||||
json.zone_id table.zone_id #Add this zone_id to keep data structure consistance
|
json.zone_id table.zone_id #Add this zone_id to keep data structure consistance
|
||||||
json.current_booking booking.booking_id rescue ""
|
json.current_booking table.get_current_booking.booking_id rescue ""
|
||||||
json.sale_id booking.sale_id rescue ""
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
json.rooms @all_rooms do |room|
|
json.rooms @all_rooms do |room|
|
||||||
if room.is_active
|
if room.is_active
|
||||||
booking = room.get_current_booking
|
|
||||||
json.id room.id
|
json.id room.id
|
||||||
json.name room.name
|
json.name room.name
|
||||||
json.status room.status
|
json.status room.status
|
||||||
json.zone_id room.zone_id #Add this zone_id to keep data structure consistance
|
json.zone_id room.zone_id #Add this zone_id to keep data structure consistance
|
||||||
json.current_booking booking.booking_id rescue ""
|
json.current_booking room.get_current_booking.booking_id rescue ""
|
||||||
json.sale_id booking.sale_id rescue ""
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user