clean shop code
This commit is contained in:
@@ -36,7 +36,6 @@ class AssignedOrderItem < ApplicationRecord
|
||||
assigned_order_item.order_queue_station = order_queue_station
|
||||
assigned_order_item.print_status = false
|
||||
assigned_order_item.delivery_status = false
|
||||
assigned_order_item.shop_code =order.shop_code
|
||||
assigned_order_item.save!
|
||||
end
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ class InventoryDefinition < ApplicationRecord
|
||||
logger.debug saleObj.sale_items.to_json
|
||||
if !saleObj.nil?
|
||||
saleObj.sale_items.each do |item|
|
||||
found, inventory_definition = find_product_in_inventory(item,saleObj.shop_code)
|
||||
found, inventory_definition = find_product_in_inventory(item)
|
||||
if found
|
||||
check_balance(item,inventory_definition)
|
||||
end
|
||||
|
||||
@@ -62,9 +62,9 @@ class Menu < ApplicationRecord
|
||||
# Account.create(id:row["id"], title: row["title"],account_type: row["account_type"],discount: row["discount"],point: row["point"],bonus: row["bonus"],rebate: row["rebate"])
|
||||
account = Account.find_by_id(row["id"])
|
||||
if account
|
||||
Account.create(title: row["title"],account_type: row["account_type"],discount: row["discount"],point: row["point"],bonus: row["bonus"],rebate: row["rebate"],shop_code: shop.shop_code)
|
||||
Account.create(title: row["title"],account_type: row["account_type"],discount: row["discount"],point: row["point"],bonus: row["bonus"],rebate: row["rebate"])
|
||||
else
|
||||
Account.create(id:row["id"], title: row["title"],account_type: row["account_type"],discount: row["discount"],point: row["point"],bonus: row["bonus"],rebate: row["rebate"],shop_code: shop.shop_code)
|
||||
Account.create(id:row["id"], title: row["title"],account_type: row["account_type"],discount: row["discount"],point: row["point"],bonus: row["bonus"],rebate: row["rebate"])
|
||||
end
|
||||
elsif sheet_name == "Item Set"
|
||||
# ItemSet.create(id:row["id"], name: row[name], alt_name: row[alt_name], min_selectable_qty: row[min_selectable_qty], max_selectable_qty: row[max_selectable_qty])
|
||||
@@ -93,9 +93,9 @@ class Menu < ApplicationRecord
|
||||
elsif sheet_name == "Menu"
|
||||
menu = Menu.find_by_id(row["id"])
|
||||
if menu
|
||||
Menu.create(name: row["name"], is_active: row["is_active"], is_ordering: row["is_ordering"], valid_days: row["valid_days"],valid_time_from: row["valid_time_from"], valid_time_to: row["valid_time_to"], created_by: row["created_by"],shop_code: shop.shop_code)
|
||||
Menu.create(name: row["name"], is_active: row["is_active"], is_ordering: row["is_ordering"], valid_days: row["valid_days"],valid_time_from: row["valid_time_from"], valid_time_to: row["valid_time_to"], created_by: row["created_by"])
|
||||
else
|
||||
Menu.create(id:row["id"], name: row["name"], is_active: row["is_active"], is_ordering: row["is_ordering"], valid_days: row["valid_days"],valid_time_from: row["valid_time_from"], valid_time_to: row["valid_time_to"], created_by: row["created_by"],shop_code: shop.shop_code)
|
||||
Menu.create(id:row["id"], name: row["name"], is_active: row["is_active"], is_ordering: row["is_ordering"], valid_days: row["valid_days"],valid_time_from: row["valid_time_from"], valid_time_to: row["valid_time_to"], created_by: row["created_by"])
|
||||
end
|
||||
elsif sheet_name == "Menu Category"
|
||||
# MenuCategory.create(id:row["id"], menu_id: row["menu_id"], code: row["code"], name: row["name"], alt_name: row["alt_name"], order_by: row["order_by"], created_by: row["created_by"], menu_category_id: row["menu_category_id"], is_available: row["is_available"])
|
||||
@@ -155,7 +155,7 @@ class Menu < ApplicationRecord
|
||||
menu = sheet.row(1)[1]
|
||||
is_ordering = sheet.row(1)[3]?sheet.row(1)[3]:0
|
||||
|
||||
imported_menu = Menu.create({name: menu, is_active: true, is_ordering: is_ordering, valid_days: "1,2,3,4,5,6,7",valid_time_from: "00:00:00", valid_time_to: "23:59:59", created_by: created_by,shop_code: shop.shop_code})
|
||||
imported_menu = Menu.create({name: menu, is_active: true, is_ordering: is_ordering, valid_days: "1,2,3,4,5,6,7",valid_time_from: "00:00:00", valid_time_to: "23:59:59", created_by: created_by})
|
||||
|
||||
(4..sheet.last_row).each do |ii|
|
||||
row = Hash[[sheet.row(3),sheet.row(ii)].transpose]
|
||||
@@ -194,7 +194,7 @@ class Menu < ApplicationRecord
|
||||
if !menu_itm
|
||||
account = Account.find_by_title(row["Account"])
|
||||
if account.nil?
|
||||
account = Account.create({title: row["Account"], account_type: "0",shop_code: shop.shop_code})
|
||||
account = Account.create({title: row["Account"], account_type: "0"})
|
||||
end
|
||||
|
||||
image_path = ""
|
||||
|
||||
@@ -8,7 +8,6 @@ class PaymentJournal < ApplicationRecord
|
||||
self.payment_status = 'paid'
|
||||
self.payment_method_references = payment_method_reference
|
||||
self.created_by = current_user.id
|
||||
self.shop_code = current_user.shop_code
|
||||
self.save
|
||||
end
|
||||
|
||||
@@ -18,7 +17,6 @@ class PaymentJournal < ApplicationRecord
|
||||
self.debit_amount = amount
|
||||
self.payment_status = 'paid'
|
||||
self.created_by = current_user.id
|
||||
self.shop_code = current_user.shop_code
|
||||
self.save
|
||||
end
|
||||
|
||||
|
||||
@@ -847,7 +847,7 @@ def self.get_by_range_by_saleitems(from,to,status,report_type)
|
||||
query = query.where("(receipt_date between ? and ? and sale_status=?) AND i.unit_price <> 0",from,to,status)
|
||||
end
|
||||
|
||||
def self.get_by_shiftsales(from,to,shift,shop_code)
|
||||
def self.get_by_shiftsales(from,to,shift)
|
||||
if !shift.blank?
|
||||
query = ShiftSale.where("shift_sales.id =?",shift.id)
|
||||
else
|
||||
@@ -972,7 +972,7 @@ def self.get_other_charges()
|
||||
query = query.group("i.sale_item_id")
|
||||
end
|
||||
|
||||
def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type,account_type,shop_code)
|
||||
def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type,account_type)
|
||||
# date_type_selection = get_sql_function_for_report_type(report_type)
|
||||
if account_type.blank?
|
||||
account_type = ''
|
||||
@@ -1254,7 +1254,7 @@ def self.get_shift_sales_by_receipt_no_detail(shift_sale_range,shift,from,to,pay
|
||||
return query
|
||||
end
|
||||
|
||||
def self.get_by_shift_sale_credit_payment(shift_sale_range,shift,from,to,filter,order_source,shop_code)
|
||||
def self.get_by_shift_sale_credit_payment(shift_sale_range,shift,from,to,filter,order_source)
|
||||
payments_for_credits = SalePayment.select("
|
||||
sales.sale_id,
|
||||
DATE_FORMAT(CONVERT_TZ(sale_payments.created_at,'+00:00','+06:30'),'%d %b %y %h:%i%p') as credit_payment_receipt_date,
|
||||
@@ -1310,7 +1310,7 @@ def self.get_by_shift_sale_credit_payment(shift_sale_range,shift,from,to,filter,
|
||||
credits = credits.group("sale_payments.sale_payment_id, sales_sale_payments.sale_id")
|
||||
end
|
||||
|
||||
def self.get_void_sale(shift,from,to,shop_code)
|
||||
def self.get_void_sale(shift,from,to)
|
||||
sale_arr = Array.new
|
||||
|
||||
query = Sale.select("sales.receipt_no,sales.receipt_date, sales.payment_status, sales.sale_status,sales.total_amount,sales.grand_total, sales.rounding_adjustment")
|
||||
|
||||
@@ -83,7 +83,6 @@ class ShiftSale < ApplicationRecord
|
||||
self.shift_started_at = DateTime.now
|
||||
self.employee_id = current_user.id
|
||||
self.opening_balance = opening_balance
|
||||
self.shop_code = current_user.shop_code
|
||||
self.other_sales = 0
|
||||
self.save
|
||||
end
|
||||
|
||||
@@ -26,8 +26,7 @@ class StockJournal < ApplicationRecord
|
||||
inventory_definition_id: inventory_definition.id,
|
||||
remark: stock_message,
|
||||
trans_ref: trans_ref,
|
||||
trans_type: trans_type,
|
||||
shop_code: inventory_definition.shop_code
|
||||
trans_type: trans_type
|
||||
)
|
||||
end
|
||||
|
||||
@@ -39,7 +38,7 @@ class StockJournal < ApplicationRecord
|
||||
stock_journal = StockJournal.where("item_code=?", item.item_code).order("id DESC").first
|
||||
if stock_journal.nil?
|
||||
old_blance = 0
|
||||
inventory_definition_id = InventoryDefinition.find_by_item_code_and_shop_code(item.item_code,shop.shop_code).id
|
||||
inventory_definition_id = InventoryDefinition.find_by_item_code(item.item_code).id
|
||||
else
|
||||
old_blance = stock_journal.balance
|
||||
inventory_definition_id = stock_journal.inventory_definition_id
|
||||
@@ -54,7 +53,6 @@ class StockJournal < ApplicationRecord
|
||||
journal.remark = StockJournal::STOCK_CHECK_TRANS
|
||||
journal.trans_ref = item.id
|
||||
journal.trans_type = StockJournal::STOCK_CHECK_TRANS
|
||||
journal.shop_code = shop.shop_code
|
||||
journal.save
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user