Created
July 6, 2019 19:35
-
-
Save mabsboza/a6b9ce62e8fec3a3141edf8b6e67b622 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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