change query

This commit is contained in:
Aung Kyaw Phyoe
2019-02-13 14:48:01 +06:30
parent d7d437e1d9
commit 9ec189ab54
2 changed files with 3 additions and 3 deletions

View File

@@ -1167,7 +1167,7 @@ def self.get_shift_sales_by_receipt_no(shift_sale_range,shift,from,to,payment_ty
end
query = Sale.all.select("sales.*,sale_payments.*,df.name,df.type")
.where("#{payment_type} and sale_status= 'completed' and sale_payments.payment_amount != 0")
.where("sale_status= 'completed' and sale_payments.payment_amount != 0 #{payment_type}")
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
.joins("join bookings on bookings.sale_id = sales.sale_id")
.joins("left join dining_facilities df on df.id = bookings.dining_facility_id")
@@ -1191,7 +1191,7 @@ def self.get_shift_sales_by_receipt_no_detail(shift_sale_range,shift,from,to,pay
end
query = Sale.select("sales.*,bookings.dining_facility_id as table_id")
.where("#{payment_type} and sale_status= 'completed' and sale_payments.payment_amount != 0")
.where("sale_status= 'completed' and sale_payments.payment_amount != 0 #{payment_type}")
.joins("join sale_payments on sale_payments.sale_id = sales.sale_id")
.joins("join bookings on bookings.sale_id = sales.sale_id")
.group("sales.sale_id")

View File

@@ -94,7 +94,7 @@
%>
<%if @sale_data %>
<%if !@sale_data.nil? %>
<% @sale_data.each do |result| %>
<% grand_total +=result.grand_total.to_f %>