edit for shop_code query
This commit is contained in:
@@ -62,13 +62,13 @@ class Api::OrdersController < Api::ApiController
|
||||
def create
|
||||
Rails.logger.debug "Order Source - " + params[:order_source].to_s
|
||||
Rails.logger.debug "Table ID - " + params[:table_id].to_s
|
||||
@shop = Shop.find_by_shop_code(params[:shop_code])
|
||||
|
||||
current_shift = ShiftSale.current_shift
|
||||
if current_shift.nil?
|
||||
@status = false
|
||||
@message = "No Current Open Shift for This Employee"
|
||||
else
|
||||
current_user =Employee.find(current_shift.employee_id)
|
||||
current_user = Employee.find(current_shift.employee_id)
|
||||
if checkin_checkout_time(params[:booking_id])
|
||||
|
||||
table = DiningFacility.find(params[:table_id]) if params[:table_id].present?
|
||||
|
||||
@@ -27,11 +27,10 @@ class Api::PaymentsController < Api::ApiController
|
||||
if !sale.nil?
|
||||
sale_id =sale.sale_id
|
||||
sale_items = SaleItem.get_all_sale_items(sale_id)
|
||||
@shop =Shop.find_by_shop_code(sale.shop_code)
|
||||
if sale.sale_status == "new"
|
||||
if !params[:card_no].empty?
|
||||
current_shift = ShiftSale.current_shift
|
||||
current_login_employee =Employee.find(current_shift.employee_id)
|
||||
current_login_employee = Employee.find(current_shift.employee_id)
|
||||
@status, @message = send_account_paymal(sale.grand_total, params[:card_no], sale.receipt_no,current_login_employee)
|
||||
if @status
|
||||
sale_payment = SalePayment.new
|
||||
@@ -192,9 +191,9 @@ class Api::PaymentsController < Api::ApiController
|
||||
action_by = current_login_employee.name
|
||||
@status = true
|
||||
@message = ""
|
||||
membership_setting = MembershipSetting.find_by_membership_type_and_shop_code("paypar_url",sale.shop_code)
|
||||
membership_setting = MembershipSetting.find_by_membership_type("paypar_url")
|
||||
if membership_setting.gateway_url
|
||||
member_actions =MembershipAction.find_by_membership_type_and_shop_code("get_account_balance",sale.shop_code)
|
||||
member_actions =MembershipAction.find_by_membership_type("get_account_balance")
|
||||
if member_actions.gateway_url
|
||||
@campaign_type_id = nil
|
||||
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s
|
||||
|
||||
@@ -48,7 +48,6 @@ class Crm::CustomersController < BaseCrmController
|
||||
@crm_customers.membership_type = response["customer_data"]["member_group_id"]
|
||||
@crm_customers.customer_type = "Dinein"
|
||||
@crm_customers.tax_profiles = ["1", "2"]
|
||||
@crm_customers.shop_code = @shop.shop_code
|
||||
@crm_customers.save
|
||||
@crm_customers = Customer.search(filter)
|
||||
flash[:member_notice]='Customer was successfully created.'
|
||||
@@ -263,7 +262,6 @@ class Crm::CustomersController < BaseCrmController
|
||||
if @checked_contact.nil?
|
||||
respond_to do |format|
|
||||
@crm_customers = Customer.new(customer_params)
|
||||
@crm_customers.shop_code = @shop.shop_code
|
||||
if @crm_customers.save
|
||||
# update tax profile
|
||||
customer = Customer.find(@crm_customers.customer_id)
|
||||
|
||||
@@ -87,8 +87,9 @@ class Foodcourt::CustomersController < BaseFoodcourtController
|
||||
@count_customer = Customer.count_customer
|
||||
|
||||
# @taxes = TaxProfile.where(:group_type => 'cashier')
|
||||
@taxes = TaxProfile.unscoped.select("id, (CONCAT(name,'(',(SELECT name FROM lookups WHERE lookup_type='tax_profiles' AND value=group_type),')')) as name")
|
||||
.order("group_type ASC,order_by ASC")
|
||||
@taxes = TaxProfile.unscope(:order).select("tax_profiles.id, CONCAT(tax_profiles.name, '(', lookups.name, ')') as name")
|
||||
.joins(:lookup)
|
||||
.order("group_type ASC, order_by ASC")
|
||||
# if flash["errors"]
|
||||
# @crm_customer.valid?
|
||||
# end
|
||||
|
||||
@@ -118,7 +118,7 @@ class Foodcourt::SaleEditController < BaseFoodcourtController
|
||||
|
||||
sale.compute_by_sale_items(sale.total_discount, nil, order_source)
|
||||
|
||||
ProductCommission.edit_product_commission(saleitemObj,sale.shop_code)
|
||||
ProductCommission.edit_product_commission(saleitemObj)
|
||||
end
|
||||
|
||||
# make cancel void item
|
||||
|
||||
@@ -92,7 +92,7 @@ class Foodcourt::ShiftsController < BaseFoodcourtController
|
||||
#get tax
|
||||
shift_obj = ShiftSale.where('id =?',@shift.id)
|
||||
sale_items = ''
|
||||
@lookup = Lookup.shift_sale_items_lookup_value(@shop.shop_code)
|
||||
@lookup = Lookup.shift_sale_items_lookup_value
|
||||
if @lookup.to_i == 1
|
||||
@sale_items = Sale.get_shift_sale_items(@shift.id)
|
||||
other_charges = Sale.get_other_charges()
|
||||
|
||||
@@ -91,7 +91,6 @@ class Inventory::InventoryDefinitionsController < BaseInventoryController
|
||||
format.json { head :no_content }
|
||||
end
|
||||
|
||||
# inventory = InventoryDefinition.find_by_id_and_shop_code(params[:id],@shop.shop_code)
|
||||
StockJournal.delete_stock_journal(inventory.item_code,@shop)
|
||||
StockCheckItem.delete_stock_check_item(inventory.item_code,@shop)
|
||||
if !inventory.nil?
|
||||
|
||||
@@ -87,8 +87,9 @@ class Origami::CustomersController < BaseOrigamiController
|
||||
@count_customer = Customer.count_customer
|
||||
|
||||
# @taxes = TaxProfile.where(:group_type => 'cashier')
|
||||
@taxes = TaxProfile.unscope(:order).select("id, (CONCAT(name,'(',(SELECT name FROM lookups WHERE lookup_type='tax_profiles' AND value=group_type),')')) as name")
|
||||
.order("group_type ASC,order_by ASC")
|
||||
@taxes = TaxProfile.unscope(:order).select("tax_profiles.id, CONCAT(tax_profiles.name, '(', lookups.name, ')') as name")
|
||||
.joins(:lookup)
|
||||
.order("group_type ASC, order_by ASC")
|
||||
# if flash["errors"]
|
||||
# @crm_customer.valid?
|
||||
# end
|
||||
|
||||
@@ -65,7 +65,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
end
|
||||
end
|
||||
|
||||
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, status, qr, cashier_terminal, sale_items, sale_data, customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, @shop, "Frt", current_balance, nil, other_amount, nil, nil, nil)
|
||||
filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, status, qr, cashier_terminal, sale_items, sale_data, customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, nil, @shop, "Frt", current_balance, nil, other_amount, nil, nil, nil)
|
||||
|
||||
result = {
|
||||
:filepath => filename,
|
||||
@@ -202,7 +202,7 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
other_amount = SaleItem.calculate_other_charges(sale_items)
|
||||
|
||||
printer = Printer::ReceiptPrinter.new(print_settings)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, "Paid",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil)
|
||||
filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal, sale_items, saleObj, customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, rebate_amount, @shop, "Paid", current_balance, card_data, other_amount, latest_order_no, card_balance_amount, nil)
|
||||
|
||||
#end
|
||||
end
|
||||
|
||||
@@ -163,7 +163,7 @@ class Origami::SaleEditController < BaseOrigamiController
|
||||
# end
|
||||
# end
|
||||
|
||||
ProductCommission.edit_product_commission(saleitemObj,sale.shop_code)
|
||||
ProductCommission.edit_product_commission(saleitemObj)
|
||||
end
|
||||
|
||||
# make cancel void item
|
||||
|
||||
@@ -91,7 +91,7 @@ class Origami::ShiftsController < BaseOrigamiController
|
||||
#get tax
|
||||
shift_obj = ShiftSale.where('id =?',@shift.id)
|
||||
sale_items = ''
|
||||
@lookup = Lookup.shift_sale_items_lookup_value(@shop.shop_code)
|
||||
@lookup = Lookup.shift_sale_items_lookup_value
|
||||
if @lookup.to_i == 1
|
||||
@sale_items = Sale.get_shift_sale_items(@shift.id)
|
||||
other_charges = Sale.get_other_charges()
|
||||
|
||||
@@ -11,7 +11,7 @@ class PrintSettingsController < ApplicationController
|
||||
# GET /print_settings/1
|
||||
# GET /print_settings/1.json
|
||||
def show
|
||||
@lookup = Lookup.shift_sale_items_lookup_value(@shop.shop_code)
|
||||
@lookup = Lookup.shift_sale_items_lookup_value
|
||||
end
|
||||
|
||||
# GET /print_settings/new
|
||||
@@ -22,7 +22,7 @@ class PrintSettingsController < ApplicationController
|
||||
|
||||
# GET /print_settings/1/edit
|
||||
def edit
|
||||
@lookup = Lookup.shift_sale_items_lookup_value(@shop.shop_code)
|
||||
@lookup = Lookup.shift_sale_items_lookup_value
|
||||
@server_mode = ENV["SERVER_MODE"]
|
||||
end
|
||||
|
||||
@@ -48,7 +48,7 @@ class PrintSettingsController < ApplicationController
|
||||
respond_to do |format|
|
||||
if @print_setting.update(print_setting_params)
|
||||
if @print_setting.unique_code == 'CloseCashierPdf'
|
||||
Lookup.save_shift_sale_items_settings(params[:shift_sale_items],@shop.shop_code)
|
||||
Lookup.save_shift_sale_items_settings(params[:shift_sale_items])
|
||||
end
|
||||
|
||||
format.html { redirect_to @print_setting, notice: 'Print setting was successfully updated.' }
|
||||
|
||||
@@ -19,7 +19,7 @@ class Reports::IndutyController < BaseReportController
|
||||
end
|
||||
|
||||
@commissioner = params[:commissioner]
|
||||
@induty_data = InDuty.get_induty_by_shift(@shift_sale_range,@shift,from,to,@commissioner).where("sales.shop_code='#{@shop.shop_code}'")
|
||||
@induty_data = InDuty.get_induty_by_shift(@shift_sale_range,@shift,from,to,@commissioner)
|
||||
|
||||
@from = from
|
||||
@to = to
|
||||
|
||||
@@ -27,7 +27,7 @@ class Reports::OrderReservationController < BaseReportController
|
||||
|
||||
provider = params[:provider]
|
||||
payment_type = params[:payment_type]
|
||||
@order_reservation_data = OrderReservation.get_order_reservation_by_shift(@shift_sale_range,@shift,from,to,provider,payment_type).where("sales.shop_code='#{@shop.shop_code}'")
|
||||
@order_reservation_data = OrderReservation.get_order_reservation_by_shift(@shift_sale_range,@shift,from,to,provider,payment_type)
|
||||
@from = from
|
||||
@to = to
|
||||
# get printer info
|
||||
@@ -49,7 +49,7 @@ class Reports::OrderReservationController < BaseReportController
|
||||
def show
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
|
||||
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
|
||||
@@ -9,7 +9,7 @@ class Reports::PaymentMethodController < BaseReportController
|
||||
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
|
||||
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
@shift = ''
|
||||
if params[:shift_name].to_i != 0
|
||||
@@ -43,7 +43,7 @@ class Reports::PaymentMethodController < BaseReportController
|
||||
def show
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
|
||||
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
|
||||
@@ -10,7 +10,7 @@ authorize_resource :class => false
|
||||
@shift = ''
|
||||
if params[:shift_name].to_i != 0
|
||||
|
||||
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
|
||||
@shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
@shift_sale = ShiftSale.find(params[:shift_name])
|
||||
if to.blank?
|
||||
@@ -26,12 +26,12 @@ authorize_resource :class => false
|
||||
|
||||
@lookup = Lookup.find_by_lookup_type('reprint_receipt')
|
||||
if @lookup.nil?
|
||||
@lookup = Lookup.create_reprint_receipt_lookup(@shop.shop_code)
|
||||
@lookup = Lookup.create_reprint_receipt_lookup
|
||||
end
|
||||
|
||||
payment_type = params[:payment_type]
|
||||
@sale_data = Sale.get_shift_sales_by_receipt_no(@shift_sale_range,@shift,from,to,payment_type).where("sales.shop_code='#{@shop.shop_code}'")
|
||||
@sale_taxes = Sale.get_separate_tax(@shift_sale_range,@shift,from,to,payment_type).where("sales.shop_code='#{@shop.shop_code}'")
|
||||
@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.group('name').order('order_by asc') #.limit(2)
|
||||
|
||||
@from = from
|
||||
@@ -55,7 +55,7 @@ authorize_resource :class => false
|
||||
def show
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
|
||||
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
|
||||
@@ -26,7 +26,7 @@ authorize_resource :class => false
|
||||
|
||||
payment_type = params[:payment_type]
|
||||
|
||||
@sale_data = Sale.get_shift_sales_by_receipt_no_detail(@shift_sale_range,@shift,from,to,payment_type).where("sales.shop_code='#{@shop.shop_code}'")
|
||||
@sale_data = Sale.get_shift_sales_by_receipt_no_detail(@shift_sale_range,@shift,from,to,payment_type)
|
||||
|
||||
|
||||
@from = from
|
||||
@@ -50,7 +50,7 @@ authorize_resource :class => false
|
||||
def show
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
|
||||
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
|
||||
@@ -9,7 +9,7 @@ class Reports::SaleitemController < BaseReportController
|
||||
shift = ''
|
||||
if params[:shift_name].to_i != 0
|
||||
|
||||
shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
|
||||
shift_sale_range = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
shift_sale = ShiftSale.find(params[:shift_name])
|
||||
if to.blank?
|
||||
@@ -27,7 +27,7 @@ class Reports::SaleitemController < BaseReportController
|
||||
@type = params[:sale_type]
|
||||
@sale_data, @other_charges,@product, @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,@type,account_type,@shop.shop_code)
|
||||
|
||||
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil).where("sales.shop_code='#{@shop.shop_code}'")
|
||||
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
|
||||
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
|
||||
@sale_data.each {|acc_cate| @account_cate_count[acc_cate.account_id] += 1}
|
||||
|
||||
@@ -60,7 +60,7 @@ class Reports::SaleitemController < BaseReportController
|
||||
|
||||
def show
|
||||
from, to, report_type = get_date_range_from_params
|
||||
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
|
||||
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
|
||||
@@ -29,7 +29,7 @@ class Reports::ShiftsaleController < BaseReportController
|
||||
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
|
||||
@sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
@@ -77,7 +77,7 @@ class Reports::ShiftsaleController < BaseReportController
|
||||
|
||||
shop_details = shop_detail
|
||||
cashier_terminal = @shift.cashier_terminal
|
||||
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='').where("sales.shop_code='#{@shop.shop_code}'")
|
||||
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
|
||||
@total_waste = Sale.get_total_waste(shift_id).sum(:grand_total)
|
||||
@total_spoile = Sale.get_total_spoile(shift_id).sum(:grand_total)
|
||||
#other payment details for mpu or visa like card
|
||||
|
||||
@@ -34,7 +34,7 @@ class Reports::StaffMealController < BaseReportController
|
||||
|
||||
@sale_data, @other_charges,@product, @discount_data , @cash_data , @card_data , @credit_data , @foc_data , @grand_total , @change_amount = Sale.get_staff_meal_items(shift_sale_range,shift, from, to, Sale::SALE_STATUS_COMPLETED,account_type,customer_id,@shop.shop_code)
|
||||
|
||||
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil).where("sales.shop_code='#{@shop.shop_code}'")
|
||||
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
|
||||
|
||||
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
|
||||
@sale_data.each {|acc_cate| @account_cate_count[acc_cate.account_id] += 1}
|
||||
|
||||
@@ -29,7 +29,7 @@ class Reports::StockCheckController < BaseReportController
|
||||
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
|
||||
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
|
||||
@@ -39,7 +39,7 @@ authorize_resource :class => false
|
||||
def show
|
||||
from, to = get_date_range_from_params
|
||||
|
||||
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'")
|
||||
@sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED)
|
||||
|
||||
date_arr = Array.new
|
||||
@sale_data.each do |sale|
|
||||
|
||||
@@ -4,7 +4,7 @@ authorize_resource :class => false
|
||||
|
||||
from, to = get_date_range_from_params
|
||||
@sale_type = params[:sale_type]
|
||||
@sale_data = Sale.get_wastes_and_spoilages(from,to,@sale_type).where("sales.shop_code='#{@shop.shop_code}'")
|
||||
@sale_data = Sale.get_wastes_and_spoilages(from,to,@sale_type)
|
||||
@from = from
|
||||
@to = to
|
||||
# get printer info
|
||||
|
||||
@@ -38,7 +38,7 @@ class Transactions::ShiftSalesController < ApplicationController
|
||||
|
||||
#get tax
|
||||
shift_obj = ShiftSale.where('id =?',@shift.id)
|
||||
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='').where("sales.shop_code='#{@shop.shop_code}'")
|
||||
@sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='')
|
||||
#other payment details for mpu or visa like card
|
||||
@other_payment = ShiftSale.get_by_shift_other_payment(@shift)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user