Skip to content

Instantly share code, notes, and snippets.

@mabsboza
Created July 6, 2019 19:35
Show Gist options
  • Save mabsboza/a6b9ce62e8fec3a3141edf8b6e67b622 to your computer and use it in GitHub Desktop.
Save mabsboza/a6b9ce62e8fec3a3141edf8b6e67b622 to your computer and use it in GitHub Desktop.
class UpdateExpenseOrderSummary
def initialize(id:)
Apartment::Tenant.switch! 'aidelrio'
@order_id = id
update_finance_order_summary
end
def get_all_expense_orders
Finance::ExpenseOrder.where(id: @order_id)
end
def update_finance_order_summary
get_all_expense_orders.each do |order|
Finance::SummaryExpenseOrderItemByProfitCenter.where(finance_expense_order_id: order).delete_all
Finance::SummaryExpenseOrderItemByProfitCenter.create_summary(order)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment