# In this scheme, negative numbers represent money the house owes
# the user, and positive numbers represent money the user owes the
# house
# In this scheme, negative numbers represent money the house owes
# the user, and positive numbers represent money the user owes the
# house
# Next, debit everyone for expenditures that they have an
# investment in (i.e. splits)
# Next, debit everyone for expenditures that they have an
# investment in (i.e. splits)
add_column(sqlalchemy.func.sum(model.Split.share).label('total_split')).\
group_by(model.Split.user_id)
add_column(sqlalchemy.func.sum(model.Split.share).label('total_split')).\
group_by(model.Split.user_id)
add_column(sqlalchemy.func.sum(model.Transfer.amount).label('total_amount'))
total_debits = transfer_q.group_by(model.Transfer.debtor_id)
total_credits = transfer_q.group_by(model.Transfer.creditor_id)
add_column(sqlalchemy.func.sum(model.Transfer.amount).label('total_amount'))
total_debits = transfer_q.group_by(model.Transfer.debtor_id)
total_credits = transfer_q.group_by(model.Transfer.creditor_id)