clean shop code
This commit is contained in:
@@ -40,7 +40,6 @@ class Crm::DiningQueuesController < BaseCrmController
|
||||
# POST /crm/dining_queues.json
|
||||
def create
|
||||
@dining_queue = DiningQueue.new(dining_queue_params)
|
||||
@dining_queue.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @dining_queue.save
|
||||
|
||||
|
||||
@@ -135,7 +135,6 @@ class Foodcourt::AddordersController < BaseFoodcourtController
|
||||
@order.new_booking = true
|
||||
@order.waiters = current_login_employee.name
|
||||
@order.employee_name = current_login_employee.name
|
||||
@order.shop_code = @shop.shop_code
|
||||
@order.is_extra_time = is_extra_time
|
||||
@order.extra_time = extra_time
|
||||
|
||||
|
||||
@@ -76,7 +76,6 @@ class Foodcourt::SurveysController < BaseFoodcourtController
|
||||
@survey = Survey.new(survey_params)
|
||||
@survey.shift_id = shift_by_terminal.id
|
||||
@survey.foreigner = params["survey"]["foreigner"].to_json
|
||||
@survey.shop_code = @shop.shop_code
|
||||
# respond_to do |format|
|
||||
if @survey.save
|
||||
redirect_to @url
|
||||
|
||||
@@ -39,7 +39,6 @@ class Inventory::InventoryDefinitionsController < BaseInventoryController
|
||||
@inventory_definition.min_order_level = params[:min_order_level]
|
||||
@inventory_definition.max_stock_level = inventory.max_stock_level.to_i + params[:max_stock_level].to_i
|
||||
end
|
||||
@inventory_definition.shop_code = @shop.shop_code
|
||||
@inventory_definition.created_by = current_user.id
|
||||
if @inventory_definition.save
|
||||
result = {:status=> true, :message => "Inventory definition was created successfully",:data=> @inventory_definition}
|
||||
|
||||
@@ -25,7 +25,6 @@ class StockJournalsController < ApplicationController
|
||||
# POST /stock_journals.json
|
||||
def create
|
||||
@stock_journal = StockJournal.new(stock_journal_params)
|
||||
@stock_journal.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @stock_journal.save
|
||||
format.html { redirect_to @stock_journal, notice: 'Stock journal was successfully created.' }
|
||||
|
||||
@@ -76,7 +76,6 @@ class Origami::SurveysController < BaseOrigamiController
|
||||
@survey = Survey.new(survey_params)
|
||||
@survey.shift_id = shift_by_terminal.id
|
||||
@survey.foreigner = params["survey"]["foreigner"].to_json
|
||||
@survey.shop_code = @shop.shop_code
|
||||
# respond_to do |format|
|
||||
if @survey.save
|
||||
redirect_to @url
|
||||
|
||||
@@ -30,7 +30,6 @@ class PrintSettingsController < ApplicationController
|
||||
# POST /print_settings.json
|
||||
def create
|
||||
@print_setting = PrintSetting.new(print_setting_params)
|
||||
@print_setting.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @print_setting.save
|
||||
format.html { redirect_to @print_setting, notice: 'Print setting was successfully created.' }
|
||||
|
||||
@@ -20,7 +20,7 @@ authorize_resource :class => false
|
||||
|
||||
@filter = params[:filter_check]
|
||||
@order_source = params[:order_source]
|
||||
@sale_data = Sale.get_by_shift_sale_credit_payment(@shift_sale_range,@shift,from,to,@filter,@order_source,@shop.shop_code)
|
||||
@sale_data = Sale.get_by_shift_sale_credit_payment(@shift_sale_range,@shift,from,to,@filter,@order_source)
|
||||
|
||||
@from = from
|
||||
@to = to
|
||||
|
||||
@@ -21,7 +21,7 @@ class Reports::PaymentMethodController < BaseReportController
|
||||
end
|
||||
end
|
||||
@payment_type = params[:payment_type]
|
||||
@sale_data,@pyament_method = Sale.get_payment_method_by_shift(@shift_sale_range,@shift,from,to,@payment_type,@shop.shop_code)
|
||||
@sale_data,@pyament_method = Sale.get_payment_method_by_shift(@shift_sale_range,@shift,from,to,@payment_type)
|
||||
@from = from
|
||||
@to = to
|
||||
# get printer info
|
||||
|
||||
@@ -25,7 +25,7 @@ class Reports::SaleitemController < BaseReportController
|
||||
|
||||
account_type = params[:account_type]
|
||||
@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_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)
|
||||
|
||||
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
|
||||
@account_cate_count = Hash.new {|hash, key| hash[key] = 0}
|
||||
@@ -114,7 +114,7 @@ class Reports::SaleitemController < BaseReportController
|
||||
@type = params[:period_type]
|
||||
period_name = get_period_name(params[:period])
|
||||
|
||||
@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_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)
|
||||
other_charges = Sale.get_other_charges()
|
||||
if shift.present?
|
||||
@total_other_charges = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",shift.to_a)
|
||||
|
||||
@@ -8,7 +8,7 @@ class Reports::ShiftsaleController < BaseReportController
|
||||
if params[:shift_name].to_i != 0
|
||||
@shift = ShiftSale.find(params[:shift_name])
|
||||
end
|
||||
@sale_data = Sale.get_by_shiftsales(from,to,@shift,@shop.shop_code)
|
||||
@sale_data = Sale.get_by_shiftsales(from,to,@shift)
|
||||
@from = from
|
||||
@to = to
|
||||
if @shift.present?
|
||||
|
||||
@@ -32,7 +32,7 @@ class Reports::StaffMealController < BaseReportController
|
||||
|
||||
account_type = params[:account_type]
|
||||
|
||||
@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_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)
|
||||
|
||||
@sale_taxes = Sale.get_separate_tax(shift_sale_range,shift,from,to,nil)
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ authorize_resource :class => false
|
||||
end
|
||||
end
|
||||
|
||||
@sale_data = Sale.get_void_sale(@shift,from,to,@shop.shop_code)
|
||||
@sale_data = Sale.get_void_sale(@shift,from,to)
|
||||
|
||||
@from = from
|
||||
@to = to
|
||||
|
||||
@@ -28,7 +28,6 @@ class Settings::AccountsController < ApplicationController
|
||||
def create
|
||||
|
||||
@settings_account = Account.new(account_params)
|
||||
@settings_account.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_account.save
|
||||
format.html { redirect_to settings_accounts_url, notice: 'Account was successfully created.' }
|
||||
|
||||
@@ -29,7 +29,6 @@ class Settings::CashierTerminalsController < ApplicationController
|
||||
def create
|
||||
|
||||
@settings_cashier_terminal = CashierTerminal.new(settings_cashier_terminal_params)
|
||||
@settings_cashier_terminal.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_cashier_terminal.save
|
||||
format.html { redirect_to settings_cashier_terminals_path, notice: 'Cashier terminal was successfully created.' }
|
||||
|
||||
@@ -31,7 +31,6 @@ class Settings::CommissionersController < ApplicationController
|
||||
|
||||
@commissioner = Commissioner.new(commissioner_params)
|
||||
@commissioner.created_by = current_user.id
|
||||
@commissioner.shop_code = @shop.shop_code
|
||||
unless @commissioner.joined_date.nil?
|
||||
@commissioner.joined_date = @commissioner.joined_date.utc.getlocal.strftime('%Y-%b-%d')
|
||||
end
|
||||
|
||||
@@ -32,7 +32,6 @@ class Settings::CommissionsController < ApplicationController
|
||||
@commission = Commission.new(commission_params)
|
||||
@commission.product_type = 'menu_item'
|
||||
@commission.product_code = "[]"
|
||||
@commission.shop_code = @shop.shop_code
|
||||
|
||||
respond_to do |format|
|
||||
if @commission.save
|
||||
|
||||
@@ -31,7 +31,6 @@ class Settings::EmployeesController < ApplicationController
|
||||
# POST /employees.json
|
||||
def create
|
||||
@employee = Employee.new(employee_params)
|
||||
@employee.shop_code =@shop.shop_code
|
||||
respond_to do |format|
|
||||
if @employee.save
|
||||
format.html { redirect_to settings_employees_path, notice: 'Employee was successfully created.' }
|
||||
|
||||
@@ -25,7 +25,6 @@ class Settings::LookupsController < ApplicationController
|
||||
# POST /settings/lookups.json
|
||||
def create
|
||||
@settings_lookup = Lookup.new(settings_lookup_params)
|
||||
@settings_lookup.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_lookup.save
|
||||
format.html { redirect_to settings_lookups_path, notice: 'Lookup was successfully created.' }
|
||||
|
||||
@@ -27,7 +27,6 @@ class Settings::MembershipActionsController < ApplicationController
|
||||
def create
|
||||
|
||||
@settings_membership_action = MembershipAction.new(settings_membership_action_params)
|
||||
@settings_membership_action.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_membership_action.save
|
||||
format.html { redirect_to settings_membership_actions_path, notice: 'Membership action was successfully created.' }
|
||||
|
||||
@@ -27,7 +27,6 @@ class Settings::MembershipSettingsController < ApplicationController
|
||||
def create
|
||||
|
||||
@settings_membership_setting = MembershipSetting.new(settings_membership_setting_params)
|
||||
@settings_membership_setting.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_membership_setting.save
|
||||
format.html { redirect_to settings_membership_settings_path, notice: 'Membership setting was successfully created.' }
|
||||
|
||||
@@ -34,7 +34,6 @@ class Settings::MenusController < ApplicationController
|
||||
|
||||
@settings_menu = Menu.new(settings_menu_params)
|
||||
@settings_menu.created_by = current_login_employee.name
|
||||
@settings_menu.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_menu.save
|
||||
format.html { redirect_to settings_menus_path, notice: 'Menu was successfully created.' }
|
||||
|
||||
@@ -33,7 +33,6 @@ class Settings::OrderQueueStationsController < ApplicationController
|
||||
@settings_order_queue_station = OrderQueueStation.new(settings_order_queue_station_params)
|
||||
@settings_order_queue_station.created_by = current_login_employee.name
|
||||
@settings_order_queue_station.processing_items = "[]"
|
||||
@settings_order_queue_station.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_order_queue_station.save
|
||||
format.html { redirect_to settings_order_queue_stations_path, notice: 'Order queue station was successfully created.' }
|
||||
|
||||
@@ -26,7 +26,6 @@ class Settings::PaymentMethodSettingsController < ApplicationController
|
||||
# POST /settings/payment_method_settings.json
|
||||
def create
|
||||
@settings_payment_method_setting = PaymentMethodSetting.new(settings_payment_method_setting_params)
|
||||
@settings_payment_method_setting.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_payment_method_setting.save
|
||||
format.html { redirect_to settings_payment_method_settings_path, notice: 'Payment method setting was successfully created.' }
|
||||
|
||||
@@ -29,7 +29,6 @@ load_and_authorize_resource except: [:create]
|
||||
|
||||
@settings_product = Product.new(settings_product_params)
|
||||
@settings_product.created_by = current_user.name
|
||||
@settings_product.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_product.save
|
||||
format.html { redirect_to settings_products_path, notice: 'Product was successfully created.' }
|
||||
|
||||
@@ -31,7 +31,6 @@ class Settings::PromotionsController < ApplicationController
|
||||
|
||||
@promotion = Promotion.new(promotion_params)
|
||||
@promotion.created_by = current_login_employee.id
|
||||
@promotion.shop_code = @shop.shop_code
|
||||
if !@promotion.promo_start_hour.nil?
|
||||
@promotion.promo_start_hour = @promotion.promo_start_hour.to_datetime.advance(hours: +6, minutes: +30)
|
||||
end
|
||||
|
||||
@@ -30,7 +30,6 @@ class Settings::RoomsController < ApplicationController
|
||||
@settings_room.type = DiningFacility::ROOM_TYPE
|
||||
@settings_room.zone_id = params[:zone_id]
|
||||
@settings_room.created_by = current_login_employee.name
|
||||
@settings_room.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_room.save
|
||||
format.html { redirect_to settings_zone_path(@zone), notice: 'Room was successfully created.' }
|
||||
|
||||
@@ -29,7 +29,6 @@ class Settings::TablesController < ApplicationController
|
||||
@settings_table = Table.new(settings_table_params)
|
||||
@settings_table.type = DiningFacility::TABLE_TYPE
|
||||
@settings_table.zone_id = params[:zone_id]
|
||||
@settings_table.shop_code = @shop.shop_code
|
||||
@settings_table.created_by = current_login_employee.name
|
||||
respond_to do |format|
|
||||
if @settings_table.save
|
||||
|
||||
@@ -48,7 +48,6 @@ class Settings::TaxProfilesController < ApplicationController
|
||||
|
||||
@settings_tax_profile = TaxProfile.new(settings_tax_profile_params)
|
||||
@settings_tax_profile.created_by = current_login_employee.name
|
||||
@settings_tax_profile.shop_code = @shop.shop_code
|
||||
respond_to do |format|
|
||||
if @settings_tax_profile.save
|
||||
format.html { redirect_to settings_tax_profiles_path, notice: 'Tax profile was successfully created.' }
|
||||
|
||||
@@ -30,7 +30,6 @@ class Settings::ZonesController < ApplicationController
|
||||
def create
|
||||
|
||||
@settings_zone = Zone.new(settings_zone_params)
|
||||
@settings_zone.shop_code =@shop.shop_code
|
||||
@settings_zone.created_by = current_login_employee.name
|
||||
respond_to do |format|
|
||||
if @settings_zone.save
|
||||
|
||||
@@ -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