diff --git a/corepos/db/lane_op/model.py b/corepos/db/lane_op/model.py index b3e5901..80051ab 100644 --- a/corepos/db/lane_op/model.py +++ b/corepos/db/lane_op/model.py @@ -208,3 +208,71 @@ class Product(Base): # TODO: some older DB's might not have this? guess we'll see last_sold = sa.Column(sa.DateTime(), nullable=True) + + +class CustData(Base): + """ + Represents a customer of the organization. + + https://github.com/CORE-POS/IS4C/blob/master/pos/is4c-nf/lib/models/op/CustdataModel.php + """ + __tablename__ = 'custdata' + # __table_args__ = ( + # sa.ForeignKeyConstraint(['memType'], ['memtype.memtype']), + # ) + + id = sa.Column(sa.Integer(), nullable=False, primary_key=True, autoincrement=True) + + card_number = sa.Column('CardNo', sa.Integer(), nullable=True) + + person_number = sa.Column('personNum', sa.SmallInteger(), nullable=True) + + first_name = sa.Column('FirstName', sa.String(length=30), nullable=True) + + last_name = sa.Column('LastName', sa.String(length=30), nullable=True) + + cash_back = sa.Column('CashBack', sa.Numeric(precision=10, scale=2), nullable=True) + + balance = sa.Column('Balance', sa.Numeric(precision=10, scale=2), nullable=True) + + discount = sa.Column('Discount', sa.SmallInteger(), nullable=True) + + member_discount_limit = sa.Column('MemDiscountLimit', sa.Numeric(precision=10, scale=2), nullable=True) + + charge_limit = sa.Column('ChargeLimit', sa.Numeric(precision=10, scale=2), nullable=True) + + charge_ok = sa.Column('ChargeOk', sa.Boolean(), nullable=True, default=True) + + write_checks = sa.Column('WriteChecks', sa.Boolean(), nullable=True, default=True) + + store_coupons = sa.Column('StoreCoupons', sa.Boolean(), nullable=True, default=True) + + type = sa.Column('Type', sa.String(length=10), nullable=True, default='PC') + + member_type_id = sa.Column('memType', sa.SmallInteger(), nullable=True) + # member_type = orm.relationship( + # MemberType, + # primaryjoin=MemberType.id == member_type_id, + # foreign_keys=[member_type_id], + # doc=""" + # Reference to the :class:`MemberType` to which this member belongs. + # """) + + staff = sa.Column(sa.Boolean(), nullable=True, default=False) + + ssi = sa.Column('SSI', sa.Boolean(), nullable=True, default=False) + + purchases = sa.Column('Purchases', sa.Numeric(precision=10, scale=2), nullable=True, default=0) + + number_of_checks = sa.Column('NumberOfChecks', sa.SmallInteger(), nullable=True, default=0) + + member_coupons = sa.Column('memCoupons', sa.Integer(), nullable=True, default=1) + + blue_line = sa.Column('blueLine', sa.String(length=50), nullable=True) + + shown = sa.Column('Shown', sa.Boolean(), nullable=True, default=True) + + last_change = sa.Column('LastChange', sa.DateTime(), nullable=True) + + def __str__(self): + return "{} {}".format(self.first_name or '', self.last_name or '').strip() diff --git a/corepos/db/office_op/model.py b/corepos/db/office_op/model.py index 97c61d0..ce43a59 100644 --- a/corepos/db/office_op/model.py +++ b/corepos/db/office_op/model.py @@ -1156,15 +1156,15 @@ class CustData(Base): last_name = sa.Column('LastName', sa.String(length=30), nullable=True) - cash_back = sa.Column('CashBack', sa.Float(), nullable=False, default=60) + cash_back = sa.Column('CashBack', sa.Numeric(precision=10, scale=2), nullable=False, default=60) - balance = sa.Column('Balance', sa.Float(), nullable=False, default=0) + balance = sa.Column('Balance', sa.Numeric(precision=10, scale=2), nullable=False, default=0) discount = sa.Column('Discount', sa.SmallInteger(), nullable=True) - member_discount_limit = sa.Column('MemDiscountLimit', sa.Float(), nullable=False, default=0) + member_discount_limit = sa.Column('MemDiscountLimit', sa.Numeric(precision=10, scale=2), nullable=False, default=0) - charge_limit = sa.Column('ChargeLimit', sa.Float(), nullable=False, default=0) + charge_limit = sa.Column('ChargeLimit', sa.Numeric(precision=10, scale=2), nullable=False, default=0) charge_ok = sa.Column('ChargeOk', sa.Boolean(), nullable=False, default=False) @@ -1187,7 +1187,7 @@ class CustData(Base): ssi = sa.Column('SSI', sa.Boolean(), nullable=False, default=False) - purchases = sa.Column('Purchases', sa.Float(), nullable=False, default=0) + purchases = sa.Column('Purchases', sa.Numeric(precision=10, scale=2), nullable=False, default=0) number_of_checks = sa.Column('NumberOfChecks', sa.SmallInteger(), nullable=False, default=0)