mirror of
https://github.com/brmlab/brmbar.git
synced 2025-06-08 13:24:01 +02:00
brmbar-cli: New command consolidate
to finalize inventory check
This commit is contained in:
parent
4f3bc87733
commit
617b466c77
2 changed files with 22 additions and 0 deletions
|
@ -188,3 +188,17 @@ class Shop:
|
|||
return True
|
||||
else:
|
||||
return False
|
||||
def consolidate(self):
|
||||
transaction = self._transaction(description = "BrmBar inventory consolidation")
|
||||
|
||||
excess_balance = self.excess.balance()
|
||||
if excess_balance != 0:
|
||||
print("Excess balance {} debited to profit".format(-excess_balance))
|
||||
self.excess.debit(transaction, -excess_balance, "Excess balance added to profit.")
|
||||
self.profits.debit(transaction, -excess_balance, "Excess balance added to profit.")
|
||||
deficit_balance = self.deficit.balance()
|
||||
if deficit_balance != 0:
|
||||
print("Deficit balance {} credited to profit".format(deficit_balance))
|
||||
self.deficit.credit(transaction, deficit_balance, "Deficit balance removed from profit.")
|
||||
self.profits.credit(transaction, deficit_balance, "Deficit balance removed from profit.")
|
||||
self.db.commit()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue