Merge branch 'master' into license
This commit is contained in:
@@ -2,7 +2,7 @@ class Oqs::EditController < BaseOqsController
|
||||
def index
|
||||
assigned_item_id = params[:id]
|
||||
assigned_item = AssignedOrderItem.find(assigned_item_id)
|
||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_code='#{ assigned_item.item_code }'");
|
||||
@order_item = OrderItem.where("order_id='#{ assigned_item.order_id }' AND item_instance_code='#{ assigned_item.instance_code }'");
|
||||
end
|
||||
|
||||
def update
|
||||
@@ -17,7 +17,7 @@ class Oqs::EditController < BaseOqsController
|
||||
order_item.save
|
||||
|
||||
# print
|
||||
assigned_item = AssignedOrderItem.find_by_item_code(order_item.item_code)
|
||||
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
|
||||
# order queue stations
|
||||
oqs = assigned_item.order_queue_station
|
||||
|
||||
@@ -25,6 +25,6 @@ class Oqs::EditController < BaseOqsController
|
||||
|
||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||
order_queue_printer.print_order_item(print_settings, oqs,assigned_item.order_id, assigned_item.item_code, print_status=" (Edited)" )
|
||||
order_queue_printer.print_order_item(print_settings, oqs,assigned_item.order_id, assigned_item.instance_code, print_status=" (Edited)" )
|
||||
end
|
||||
end
|
||||
|
||||
@@ -58,6 +58,9 @@ class Origami::AddordersController < ApplicationController#BaseOrigamiController
|
||||
items_arr.push(items)
|
||||
}
|
||||
|
||||
puts "sssssssssss"
|
||||
puts params[:customer_id]
|
||||
puts params.to_json
|
||||
# begin
|
||||
@order = Order.new
|
||||
@order.source = params[:order_source]
|
||||
|
||||
@@ -8,7 +8,7 @@ class Origami::CreditPaymentsController < BaseOrigamiController
|
||||
@creditcount = 0
|
||||
others = 0
|
||||
sale_data.sale_payments.each do |sale_payment|
|
||||
if sale_payment.payment_method == "visa"
|
||||
if sale_payment.payment_method == "creditnote"
|
||||
@creditcount = @creditcount + sale_payment.payment_amount
|
||||
else
|
||||
others = others + sale_payment.payment_amount
|
||||
|
||||
@@ -29,14 +29,19 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
# sale.grand_total = (sub_total.to_f - overall_discount.to_f) + sale.total_tax;
|
||||
# sale.save
|
||||
if discount_items.length > 0
|
||||
puts discount_items.to_json
|
||||
puts "dddddddddddd"
|
||||
|
||||
#save sale item for discount
|
||||
discount_items.each do |di|
|
||||
origin_sale_item = SaleItem.find(di["id"])
|
||||
puts origin_sale_item.to_json
|
||||
sale_item = SaleItem.new
|
||||
|
||||
sale_item.sale_id = sale_id
|
||||
sale_item.product_code = origin_sale_item != nil ? origin_sale_item.product_code : sale_id
|
||||
sale_item.product_name = di["name"]
|
||||
sale_item.item_instance_code = origin_sale_item.item_instance_code
|
||||
sale_item.product_alt_name = ""
|
||||
sale_item.remark = "Discount"
|
||||
|
||||
@@ -156,9 +161,9 @@ class Origami::DiscountsController < BaseOrigamiController
|
||||
sale = Sale.find(sale_id)
|
||||
|
||||
# Check for Card Payment
|
||||
is_card_payment = SaleItem.get_sale_payments_by_card(sale.sale_payments)
|
||||
is_card_payment = SalePayment.get_sale_payments_by_card(sale.sale_payments)
|
||||
|
||||
if is_card_payment != true
|
||||
if is_card != "true"
|
||||
account_types = Account.where("discount=?",true)
|
||||
table_id = sale.bookings[0].dining_facility_id
|
||||
table_type = DiningFacility.find(table_id).type
|
||||
|
||||
@@ -43,7 +43,7 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
@newsaleitem = saleitemObj.dup
|
||||
@newsaleitem.save
|
||||
@newsaleitem.qty = saleitemObj.qty * -1
|
||||
@newsaleitem.unit_price = saleitemObj.unit_price * -1
|
||||
@newsaleitem.unit_price = saleitemObj.unit_price * 1
|
||||
@newsaleitem.taxable_price = saleitemObj.taxable_price * -1
|
||||
@newsaleitem.price = saleitemObj.price * -1
|
||||
@newsaleitem.product_name = saleitemObj.product_name + ' (FOC)'
|
||||
|
||||
@@ -8,12 +8,19 @@ class Origami::VoidController < BaseOrigamiController
|
||||
sale = Sale.find_by_sale_id(sale_id)
|
||||
|
||||
# update count for shift sale
|
||||
# if(sale.sale_status == "completed")
|
||||
if(sale.sale_status == "completed")
|
||||
if sale.shift_sale_id != nil
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
shift.calculate(sale_id, "void")
|
||||
end
|
||||
# end
|
||||
else
|
||||
# void before sale payment complete
|
||||
if sale.shift_sale_id != nil
|
||||
shift = ShiftSale.find(sale.shift_sale_id)
|
||||
shift.total_void = shift.total_void + sale.grand_total
|
||||
shift.save
|
||||
end
|
||||
end
|
||||
|
||||
sale.payment_status = 'void'
|
||||
sale.sale_status = 'void'
|
||||
@@ -93,6 +100,5 @@ class Origami::VoidController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -20,7 +20,11 @@ authorize_resource :class => false
|
||||
payment_type = params[:payment_type]
|
||||
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type)
|
||||
@sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type)
|
||||
@tax_profiles = TaxProfile.order('order_by asc')
|
||||
|
||||
puts @sale_taxes.to_json
|
||||
puts "sssssss"
|
||||
puts @tax_profiles.to_json
|
||||
@from = from
|
||||
@to = to
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class Reports::SaleitemController < BaseReportController
|
||||
end
|
||||
end
|
||||
@sale_data, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_by_shift_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
|
||||
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
|
||||
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
|
||||
respond_to do |format|
|
||||
if @settings_menu_item_instances.save
|
||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
|
||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].split(" ")
|
||||
@settings_menu_item_instances.save
|
||||
format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @settings_menu_item_instances }
|
||||
@@ -105,9 +105,9 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
|
||||
if @settings_menu_item_instances.update(settings_menu_item_instance_params)
|
||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
|
||||
#@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].reject(&:blank?)
|
||||
@settings_menu_item_instances.item_attributes = params[:menu_item_instance][:item_attributes].split(" ")
|
||||
@settings_menu_item_instances.save
|
||||
format.html { redirect_to settings_menu_category_simple_menu_item_path(category,catID), notice: 'Menu item instance was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @settings_menu_item_instances }
|
||||
@@ -154,6 +154,9 @@ class Settings::MenuItemInstancesController < ApplicationController
|
||||
else
|
||||
@item = MenuItem.find(params[:set_menu_item_id])
|
||||
end
|
||||
|
||||
# To Only show in Menu item selected attrs
|
||||
@item.item_attributes = MenuItemAttribute.where(id: @item.item_attributes).select("id, name").map { |e| [e.name, e.id] }
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
|
||||
@@ -29,8 +29,12 @@ class Settings::PromotionsController < ApplicationController
|
||||
def create
|
||||
@promotion = Promotion.new(promotion_params)
|
||||
@promotion.created_by = current_login_employee.id
|
||||
@promotion.promo_start_hour = @promotion.promo_start_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
@promotion.promo_end_hour = @promotion.promo_end_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
if !@promotion.promo_start_hour.nil?
|
||||
@promotion.promo_start_hour = @promotion.promo_start_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
end
|
||||
if !@promotion.promo_end_hour.nil?
|
||||
@promotion.promo_end_hour = @promotion.promo_end_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
end
|
||||
respond_to do |format|
|
||||
if @promotion.save
|
||||
promo_pros = @promotion.promotion_products
|
||||
@@ -95,16 +99,23 @@ class Settings::PromotionsController < ApplicationController
|
||||
|
||||
def find_parent_item
|
||||
res = []
|
||||
item = MenuItemInstance.find_by_item_instance_code(params[:item_instance_code])
|
||||
if item.nil?
|
||||
arr_inst = []
|
||||
item_inst = MenuItemInstance.find_by_item_instance_code(params[:item_instance_code])
|
||||
if item_inst.nil?
|
||||
product = Product.where("item_code = ?",params[:item_instance_code]).pluck(:name,:item_code)
|
||||
res.push(product.name)
|
||||
res.push(product.item_code)
|
||||
else
|
||||
# menu_item = item.menu_item.pluck(:name,:item_code)
|
||||
res.push(item.item_instance_name)
|
||||
res.push(item.menu_item.item_code)
|
||||
# menu_item = item_inst.menu_item.pluck(:name,:item_code)
|
||||
# res.push(item_inst.item_instance_name)
|
||||
# res.push(item_inst.menu_item.item_code)
|
||||
item_inst.menu_item.menu_item_instances.each do |inst|
|
||||
arr_inst.push({inst.item_instance_code => inst.item_instance_name})
|
||||
end
|
||||
res.push({item_inst.menu_item.item_code => arr_inst})
|
||||
end
|
||||
puts "res"
|
||||
p res
|
||||
render json: res
|
||||
end
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ class Transactions::BookingsController < ApplicationController
|
||||
|
||||
def index
|
||||
|
||||
filter = params[:filter]
|
||||
filter = params[:receipt_no]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
|
||||
|
||||
@@ -14,7 +14,8 @@ class Transactions::CreditNotesController < ApplicationController
|
||||
to = params[:to]
|
||||
|
||||
if filter.nil? && from.nil? && to.nil? && customer.nil?
|
||||
@credit_notes = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
|
||||
@credit_notes = Sale.where('payment_status = ?', Sale::SALE_STATUS_OUTSTANDING)
|
||||
@credit_notes = Kaminari.paginate_array(@credit_notes).page(params[:page]).per(20)
|
||||
else
|
||||
sale = Sale.search_credit_sales(customer,filter,from,to)
|
||||
if sale.count > 0
|
||||
|
||||
@@ -3,16 +3,13 @@ class Transactions::OrdersController < ApplicationController
|
||||
def index
|
||||
|
||||
filter = params[:filter]
|
||||
count = params[:count]
|
||||
from = params[:from]
|
||||
to = params[:to]
|
||||
|
||||
if filter.nil? && from.nil? && to.nil? && count.nil?
|
||||
if filter.nil? && from.nil? && to.nil?
|
||||
orders = Order.order("order_id desc")
|
||||
|
||||
else
|
||||
orders = Order.search(filter,from,to,count)
|
||||
|
||||
orders = Order.search(filter,from,to)
|
||||
end
|
||||
|
||||
if !orders.nil?
|
||||
|
||||
Reference in New Issue
Block a user