2022-12-24 12:31:45 +11:00
|
|
|
# DrCr: Web-based double-entry bookkeeping framework
|
2023-01-02 18:08:30 +11:00
|
|
|
# Copyright (C) 2022–2023 Lee Yingtong Li (RunasSudo)
|
2022-12-24 12:31:45 +11:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Affero General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Affero General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
2023-01-02 16:59:12 +11:00
|
|
|
from ..database import db
|
2023-01-02 18:08:30 +11:00
|
|
|
from ..models import Amount
|
2022-12-24 17:39:18 +11:00
|
|
|
|
2023-01-02 16:59:12 +11:00
|
|
|
class BalanceAssertion(db.Model):
|
2022-12-24 17:39:18 +11:00
|
|
|
__tablename__ = 'balance_assertions'
|
|
|
|
|
2023-01-02 16:59:12 +11:00
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
2022-12-24 17:39:18 +11:00
|
|
|
|
2023-01-02 16:59:12 +11:00
|
|
|
dt = db.Column(db.DateTime)
|
|
|
|
description = db.Column(db.String)
|
|
|
|
account = db.Column(db.String)
|
|
|
|
quantity = db.Column(db.Integer)
|
|
|
|
commodity = db.Column(db.String)
|
2022-12-24 17:39:18 +11:00
|
|
|
|
|
|
|
def balance(self):
|
|
|
|
return Amount(self.quantity, self.commodity)
|