update receipt no twice and sale order double and report changes
This commit is contained in:
@@ -91,7 +91,7 @@ class Sale < ApplicationRecord
|
||||
add_item(item)
|
||||
end
|
||||
|
||||
link_order_sale(order.id)
|
||||
# link_order_sale(order.id)
|
||||
|
||||
end
|
||||
self.save!
|
||||
@@ -352,7 +352,7 @@ class Sale < ApplicationRecord
|
||||
|
||||
if saleOrder.nil?
|
||||
sale_order = SaleOrder.new
|
||||
sale_order.create_sale_order(self.id, order_id)
|
||||
sale = sale_order.create_sale_order(self.id, order_id)
|
||||
end
|
||||
# if (SaleOrder.where("sale_id = #{self.id} and order_id=#{order_id}").nil?)
|
||||
# SaleOrder.create(:sale_id => self.id, :order_id => order_id)
|
||||
@@ -662,18 +662,18 @@ end
|
||||
def self.get_void_sale(shift,from,to)
|
||||
sale_arr = Array.new
|
||||
|
||||
account= Sale.select("sales.receipt_no,sales.receipt_date, sales.payment_status, sales.sale_status,sales.total_amount,sales.grand_total, sales.rounding_adjustment")
|
||||
.joins("INNER JOIN shift_sales sh ON sh.id = sales.shift_sale_id")
|
||||
.where("sales.sale_status = 'void' and (sh.shift_started_at between ? and ?
|
||||
OR sh.shift_closed_at between ? and ? )", from ,to, from, to)
|
||||
query = Sale.select("sales.receipt_no,sales.receipt_date, sales.payment_status, sales.sale_status,sales.total_amount,sales.grand_total, sales.rounding_adjustment")
|
||||
# .joins("INNER JOIN shift_sales sh ON sh.id = sales.shift_sale_id")
|
||||
# .where("sales.sale_status = 'void' and (sh.shift_started_at between ? and ?
|
||||
# OR sh.shift_closed_at between ? and ? )", from ,to, from, to)
|
||||
|
||||
if shift.present?
|
||||
query = query.where("sales.sale_status = 'void' and s.shift_sale_id in (?)",shift.to_a)
|
||||
query = query.where("sales.sale_status = 'void' and sales.shift_sale_id in (?)",shift.to_a)
|
||||
else
|
||||
query = query.where("payment_method='creditnote' and s.sale_status = 'completed' and s.receipt_date between ? and ? ",from,to)
|
||||
query = query.where("sales.sale_status = 'void' and sales.receipt_date between ? and ? ",from,to)
|
||||
end
|
||||
|
||||
out = {:items => account}
|
||||
out = {:items => query}
|
||||
sale_arr.push(out)
|
||||
return sale_arr
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user