Compare commits
3 commits
310a261b48
...
47c23a65ae
Author | SHA1 | Date | |
---|---|---|---|
|
47c23a65ae | ||
|
464f107a88 | ||
|
cb6ed15eb8 |
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# pyCOREPOS -- Python Interface to CORE POS
|
||||
# Copyright © 2018-2023 Lance Edgar
|
||||
# Copyright © 2018-2024 Lance Edgar
|
||||
#
|
||||
# This file is part of pyCOREPOS.
|
||||
#
|
||||
|
@ -26,14 +26,25 @@ CORE Office "arch" data model
|
|||
|
||||
from sqlalchemy import orm
|
||||
|
||||
from corepos.db.office_trans.model import TransactionDetailBase
|
||||
from corepos.db.office_trans.model import DTransactionBase, DLogBase
|
||||
|
||||
|
||||
Base = orm.declarative_base()
|
||||
|
||||
|
||||
class TransactionDetail(TransactionDetailBase, Base):
|
||||
class BigArchive(DTransactionBase, Base):
|
||||
"""
|
||||
Represents a POS transaction detail record.
|
||||
Represents a record from ``bigArchive`` table.
|
||||
"""
|
||||
__tablename__ = 'bigArchive'
|
||||
|
||||
|
||||
# TODO: deprecate / remove this
|
||||
TransactionDetail = BigArchive
|
||||
|
||||
|
||||
class DLogBig(DLogBase, Base):
|
||||
"""
|
||||
Represents a record from ``dlogBig`` view.
|
||||
"""
|
||||
__tablename__ = 'dlogBig'
|
||||
|
|
|
@ -169,6 +169,25 @@ 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.
|
||||
|
@ -1018,6 +1037,9 @@ 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)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
################################################################################
|
||||
#
|
||||
# pyCOREPOS -- Python Interface to CORE POS
|
||||
# Copyright © 2018-2023 Lance Edgar
|
||||
# Copyright © 2018-2024 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(object):
|
||||
class TransactionDetailBase:
|
||||
"""
|
||||
Represents a POS transaction detail record.
|
||||
"""
|
||||
|
@ -86,10 +86,12 @@ class TransactionDetailBase(object):
|
|||
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)
|
||||
|
||||
# timestamps
|
||||
date_time = sa.Column('datetime', sa.DateTime(), nullable=True)
|
||||
trans_status = sa.Column(sa.String(length=1), nullable=True)
|
||||
|
||||
@declared_attr
|
||||
def transaction_status(self):
|
||||
return orm.synonym('trans_status')
|
||||
|
||||
# cashier
|
||||
employee_number = sa.Column('emp_no', sa.Integer(), nullable=True)
|
||||
|
@ -115,7 +117,11 @@ class TransactionDetailBase(object):
|
|||
|
||||
cost = sa.Column(sa.Numeric(precision=10, scale=2), nullable=True)
|
||||
|
||||
unit_price = sa.Column('unitPrice', 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')
|
||||
|
||||
total = sa.Column(sa.Numeric(precision=10, scale=2), nullable=True)
|
||||
|
||||
|
@ -161,8 +167,22 @@ class TransactionDetailBase(object):
|
|||
return self.description or ''
|
||||
|
||||
|
||||
class TransactionDetail(TransactionDetailBase, Base):
|
||||
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):
|
||||
"""
|
||||
Represents a POS transaction detail record.
|
||||
Represents a record from ``dtransactions`` table.
|
||||
"""
|
||||
__tablename__ = 'dtransactions'
|
||||
|
||||
|
||||
# TODO: deprecate / remove this
|
||||
TransactionDetail = DTransaction
|
||||
|
|
Loading…
Reference in a new issue