waste and spoil report
This commit is contained in:
@@ -86,7 +86,7 @@ class Sale < ApplicationRecord
|
||||
# InventoryJob.perform_now(self.id)
|
||||
InventoryDefinition.calculate_product_count(saleObj)
|
||||
|
||||
|
||||
|
||||
|
||||
# dining charges
|
||||
charges = DiningCharge.where('dining_facility_id=?',booking.dining_facility_id).take
|
||||
@@ -1084,13 +1084,15 @@ def self.get_item_query(type)
|
||||
elsif type == "promotion"
|
||||
sale_type = "#{check_product} and i.status = 'promotion'"
|
||||
end
|
||||
query = Sale.select("acc.title as account_name,
|
||||
query = Sale.select("sales.sale_id,acc.title as account_name,
|
||||
i.item_instance_code as item_code,i.account_id as account_id, " +
|
||||
"SUM(i.qty * i.unit_price) as grand_total,
|
||||
SUM(i.qty) as total_item,i.qty as qty," +
|
||||
"i.status as status_type,i.remark as remark,"+
|
||||
"i.unit_price,i.price as price,i.product_name as product_name, " +
|
||||
"i.menu_category_name,i.menu_category_code as menu_category_id ")
|
||||
"i.menu_category_name,i.menu_category_code as menu_category_id, " +
|
||||
"date_format(CONVERT_TZ(receipt_date,'+00:00', '+06:30'), '%I %p')
|
||||
as date_format")
|
||||
|
||||
query = query.joins("JOIN sale_items i ON i.sale_id = sales.sale_id" +
|
||||
" JOIN shift_sales sh ON sh.`id` = sales.shift_sale_id")
|
||||
@@ -1182,7 +1184,8 @@ def self.get_by_shift_items(shift_sale_range, shift, from, to, status,type,accou
|
||||
|
||||
else
|
||||
query = query.where("sales.receipt_date between ? and ? #{account_type} and sale_status='completed'",from,to)
|
||||
|
||||
logger.debug 'get_by_shift_items??????????????????????????????????????'
|
||||
logger.debug query.to_json
|
||||
if type.nil? || type == 'all' || type == "other"
|
||||
other_charges = other_charges.where("sales.receipt_date between ? and ? and sale_status='completed'",from,to)
|
||||
end
|
||||
@@ -1639,6 +1642,13 @@ end
|
||||
end
|
||||
|
||||
def self.hourly_sales(today,current_user,from,to,from_time,to_time)
|
||||
logger.debug 'hourly_sales<<<<<<<<<<<<<<<<<<<<<<<<'
|
||||
logger.debug today
|
||||
logger.debug current_user.to_json
|
||||
logger.debug from
|
||||
logger.debug to
|
||||
logger.debug from_time
|
||||
logger.debug to_time
|
||||
if (!from.nil? && !to.nil?) && (from != "" && to!="")
|
||||
if current_user.nil?
|
||||
query = Sale.hourly_sale_data(today,nil,from,to,from_time,to_time)
|
||||
@@ -2775,6 +2785,8 @@ def self.hourly_sale_data(today,shift=nil,from=nil,to=nil,from_time=nil,to_time=
|
||||
end
|
||||
query = query.group("date_format(CONVERT_TZ(receipt_date,'+00:00', '+06:30'), '%I %p')")
|
||||
.order('receipt_date')
|
||||
logger.debug 'sales data>>>>>>>>>>>>>>>>>>>>>>>'
|
||||
logger.debug query.to_json
|
||||
end
|
||||
|
||||
return query
|
||||
|
||||
Reference in New Issue
Block a user