diff --git a/corepos/db/office_arch/model.py b/corepos/db/office_arch/model.py index 49b0bbd..bf01a4d 100644 --- a/corepos/db/office_arch/model.py +++ b/corepos/db/office_arch/model.py @@ -2,7 +2,7 @@ ################################################################################ # # pyCOREPOS -- Python Interface to CORE POS -# Copyright © 2018-2024 Lance Edgar +# Copyright © 2018-2023 Lance Edgar # # This file is part of pyCOREPOS. # @@ -26,25 +26,14 @@ CORE Office "arch" data model from sqlalchemy import orm -from corepos.db.office_trans.model import DTransactionBase, DLogBase +from corepos.db.office_trans.model import TransactionDetailBase Base = orm.declarative_base() -class BigArchive(DTransactionBase, Base): +class TransactionDetail(TransactionDetailBase, Base): """ - Represents a record from ``bigArchive`` table. + Represents a POS transaction detail record. """ __tablename__ = 'bigArchive' - - -# TODO: deprecate / remove this -TransactionDetail = BigArchive - - -class DLogBig(DLogBase, Base): - """ - Represents a record from ``dlogBig`` view. - """ - __tablename__ = 'dlogBig' diff --git a/corepos/db/office_op/model.py b/corepos/db/office_op/model.py index 5e9a34a..8590375 100644 --- a/corepos/db/office_op/model.py +++ b/corepos/db/office_op/model.py @@ -169,25 +169,6 @@ class Store(Base): return self.description or "" -class MasterSuperDepartment(Base): - """ - A department may belong to more than one superdepartment, but has - one "master" superdepartment. This avoids duplicating rows in - some reports. By convention, a department's "master" - superdepartment is the one with the lowest superID. - """ - __tablename__ = 'MasterSuperDepts' - - super_id = sa.Column('superID', sa.Integer(), primary_key=True, autoincrement=False, nullable=False) - - department_id = sa.Column('dept_ID', sa.Integer(), primary_key=True, autoincrement=False, nullable=False) - - super_name = sa.Column(sa.String(length=50), nullable=True) - - def __str__(self): - return self.super_name or "" - - class SuperDepartment(Base): """ Represents a "super" (parent/child) department mapping. @@ -1037,9 +1018,6 @@ class MemberType(Base): ssi = sa.Column(sa.Boolean(), nullable=True) - ignoreSales = sa.Column(sa.Boolean(), nullable=True, default=False) - ignore_sales = orm.synonym('ignoreSales') - # TODO: this was apparently added "recently" - isn't present in all DBs # (need to figure out how to conditionally include it in model?) # sales_code = sa.Column('salesCode', sa.Integer(), nullable=True) diff --git a/corepos/db/office_trans/model.py b/corepos/db/office_trans/model.py index b4659cd..2848af5 100644 --- a/corepos/db/office_trans/model.py +++ b/corepos/db/office_trans/model.py @@ -2,7 +2,7 @@ ################################################################################ # # pyCOREPOS -- Python Interface to CORE POS -# Copyright © 2018-2024 Lance Edgar +# Copyright © 2018-2023 Lance Edgar # # This file is part of pyCOREPOS. # @@ -68,7 +68,7 @@ class EquityLiveBalance(Base): start_date = sa.Column('startdate', sa.DateTime(), nullable=True) -class TransactionDetailBase: +class TransactionDetailBase(object): """ Represents a POS transaction detail record. """ @@ -86,12 +86,10 @@ class TransactionDetailBase: transaction_number = sa.Column('trans_no', sa.Integer(), nullable=True) transaction_type = sa.Column('trans_type', sa.String(length=1), nullable=True) transaction_subtype = sa.Column('trans_subtype', sa.String(length=2), nullable=True) + transaction_status = sa.Column('trans_status', sa.String(length=1), nullable=True) - trans_status = sa.Column(sa.String(length=1), nullable=True) - - @declared_attr - def transaction_status(self): - return orm.synonym('trans_status') + # timestamps + date_time = sa.Column('datetime', sa.DateTime(), nullable=True) # cashier employee_number = sa.Column('emp_no', sa.Integer(), nullable=True) @@ -117,11 +115,7 @@ class TransactionDetailBase: cost = sa.Column(sa.Numeric(precision=10, scale=2), nullable=True) - unitPrice = sa.Column('unitPrice', sa.Numeric(precision=10, scale=2), nullable=True) - - @declared_attr - def unit_price(self): - return orm.synonym('unitPrice') + unit_price = sa.Column('unitPrice', sa.Numeric(precision=10, scale=2), nullable=True) total = sa.Column(sa.Numeric(precision=10, scale=2), nullable=True) @@ -167,22 +161,8 @@ class TransactionDetailBase: return self.description or '' -class DTransactionBase(TransactionDetailBase): - - date_time = sa.Column('datetime', sa.DateTime(), nullable=True) - - -class DLogBase(TransactionDetailBase): - - date_time = sa.Column('tdate', sa.DateTime(), nullable=True) - - -class DTransaction(DTransactionBase, Base): +class TransactionDetail(TransactionDetailBase, Base): """ - Represents a record from ``dtransactions`` table. + Represents a POS transaction detail record. """ __tablename__ = 'dtransactions' - - -# TODO: deprecate / remove this -TransactionDetail = DTransaction