class Sequence(db.Model): uuid = db.Column(db.UUID(as_uuid=True), default=uuid.uuid4, primary_key=True) name = db.Column(db.String(50), unique=True) prefix = db.Column(db.String(10), unique=True) increment = db.Column(db.Integer) current = db.Column(db.Integer)
class Contribution(db.Model): uuid = db.Column(db.UUID(as_uuid=True), default=uuid.uuid4, primary_key=True) member_code = db.Column(db.String(20)) period = db.Column(db.String(7)) # YYYY-MM amount = db.Column(db.Float) is_approved = db.Column(db.Boolean) # disable edit contribution remarks = db.Column(db.String(50))
class Company(db.Model): uuid = db.Column(db.UUID(as_uuid=True), default=uuid.uuid4, primary_key=True) company_name = db.Column(db.String(50)) address = db.Column(db.String(100)) phone = db.Column(db.String(50)) mobile = db.Column(db.String(50)) total_fund = db.Column(db.Float) available_fund = db.Column(db.Float) lended_fund = db.Column(db.Float) total_profit = db.Column(db.Float) interest_rate = db.Column(db.Float)
class LoanDetail(db.Model): uuid = db.Column(db.UUID(as_uuid=True), default=uuid.uuid4, primary_key=True) loan_code = db.Column(db.String(20)) type_line = db.Column(db.String(20)) # amortization or penalty term = db.Column(db.Integer) amount_base = db.Column(db.Float) amount_interest = db.Column(db.Float) amount_to_pay = db.Column(db.Float) amount_payed = db.Column(db.Float) date_to_pay = db.Column(db.Date) date_payed = db.Column(db.Date)
class Borrower(db.Model): uuid = db.Column(db.UUID(as_uuid=True), default=uuid.uuid4, primary_key=True) code = db.Column(db.String(20), unique=True) first_name = db.Column(db.String(50)) last_name = db.Column(db.String(50)) address = db.Column(db.String(50)) phone = db.Column(db.String(50)) mobile = db.Column(db.String(50)) email = db.Column(db.String(50)) date_joined = db.Column(db.DateTime, default=datetime.utcnow) interest_rate = db.Column(db.Float) penalty_rate = db.Column(db.Float) balance = db.Column(db.Float)
class Loan(db.Model): uuid = db.Column(db.UUID(as_uuid=True), default=uuid.uuid4, primary_key=True) code = db.Column(db.String(20), unique=True) borrower_code = db.Column(db.String(20)) type_loan = db.Column(db.String(20)) # quote or loan date_loan = db.Column(db.DateTime, default=datetime.utcnow) date_start = db.Column(db.Date) date_end = db.Column(db.Date) terms = db.Column(db.Integer) type_schedule = db.Column(db.String(20)) # semi-montly or monthly is_approved = db.Column(db.Boolean) # disable edit of loan is_settled = db.Column(db.Boolean) amount = db.Column(db.Float) amount_gross = db.Column(db.Float) interest_rate = db.Column(db.Float) interest_amount = db.Column(db.Float) remarks = db.Column(db.String(50))
class User(UserMixin, db.Model): uuid = db.Column(db.UUID(as_uuid=True), default=uuid.uuid4, primary_key=True) username = db.Column(db.String(20), unique=True) password = db.Column(db.String(200)) display_name = db.Column(db.String(30)) created_at = db.Column(db.DateTime, default=datetime.utcnow) def hash_password(self, password): self.password = generate_password_hash(password) def check_password(self, password): return check_password_hash(self.password, password) def get_id(self): return (self.uuid)
class Member(db.Model): uuid = db.Column(db.UUID(as_uuid=True), default=uuid.uuid4, primary_key=True) code = db.Column(db.String(20), unique=True) first_name = db.Column(db.String(50)) last_name = db.Column(db.String(50)) address = db.Column(db.String(50)) phone = db.Column(db.String(50)) mobile = db.Column(db.String(50)) email = db.Column(db.String(50)) date_joined = db.Column(db.Date) monthly_contribution = db.Column(db.Float) search_tag = db.Column(db.String(100)) created_by = db.Column(db.String(20)) created_at = db.Column(db.DateTime, default=datetime.utcnow) updated_by = db.Column(db.String(20)) updated_at = db.Column(db.DateTime, default=datetime.utcnow)