fixed conflict

This commit is contained in:
Nweni
2017-06-06 09:47:33 +06:30
36 changed files with 472 additions and 177 deletions

View File

@@ -25,9 +25,9 @@ class Sale < ApplicationRecord
#get all order attached to this booking and combine into 1 invoice
booking.booking_orders.each do |order|
if booking.sale_id
status, sale_id = generate_invoice_from_order(order.order_id, nil, requested_by)
status, sale_id = generate_invoice_from_order(order.order_id, nil, booking, requested_by)
else
status, sale_id = generate_invoice_from_order(order.order_id, booking.sale_id, requested_by)
status, sale_id = generate_invoice_from_order(order.order_id, booking.sale_id, booking, requested_by)
end
booking.sale_id = sale_id
end
@@ -37,7 +37,7 @@ class Sale < ApplicationRecord
end
end
def generate_invoice_from_order (order_id, sale_id, requested_by)
def generate_invoice_from_order (order_id, sale_id, booking, requested_by)
taxable = true
#if sale_id is exsit and validate
#add order to that invoice
@@ -68,8 +68,8 @@ class Sale < ApplicationRecord
add_item(item)
end
link_order_sale(order.id)
link_order_sale(order.id)
end
@@ -79,6 +79,11 @@ class Sale < ApplicationRecord
#Update the order items that is billed
order.update_items_status_to_billed(nil)
order.status = "billed"
order.save
booking.sale_id = self.id
booking.save
return true, self.id
end