Пример #1
0
class Project(db.Model):
    __tablename__ = 'projects'

    url = db.Column(db.String(), nullable=False, primary_key=True)
    name = db.Column(db.String())
    contact = db.Column(db.String())
    budget = db.Column(db.Integer())
    is_ir35 = db.Column(db.Boolean())
    status = db.Column(db.String())
    budget_units = db.Column(db.String())
    normal_billing_rate = db.Column(db.Numeric(precision=10, scale=2))
    hours_per_day = db.Column(db.Numeric(precision=10, scale=2))
    uses_project_invoice_sequence = db.Column(db.Boolean())
    currency = db.Column(db.String())
    billing_period = db.Column(db.String())
    created_at = db.Column(db.DateTime())
    updated_at = db.Column(db.DateTime())

    def __init__(self, created_at=datetime.now(), updated_at=datetime.now(), **kwargs):
        """Mostly rely on default declarative SQLAlchemy constructor. Additionally set the timestamps on object creation."""
        super(Project, self).__init__(**kwargs)  # use the default declarative constructor
        self.created_at = created_at
        self.updated_at = updated_at

    def __repr__(self):
        return '<url {}>'.format(self.url)
Пример #2
0
class BankTransaction(db.Model):
    __tablename__ = 'bank_transactions'
    url = db.Column(db.String(), nullable=False, primary_key=True)
    bank_account = db.Column(db.String(), nullable=False)
    amount = db.Column(db.Numeric(precision=10, scale=2))
    dated_on = db.Column(db.Date())
    description = db.Column(db.String())
    full_description = db.Column(db.String())
    is_manual = db.Column(db.Boolean())
    unexplained_amount = db.Column(db.Numeric(precision=10, scale=2))
    uploaded_at = db.Column(db.Date())
    created_at = db.Column(db.DateTime())
    updated_at = db.Column(db.DateTime())

    def __init__(self,
                 created_at=datetime.now(),
                 updated_at=datetime.now(),
                 **kwargs):
        """Mostly rely on default declarative SQLAlchemy constructor. Additionally set the timestamps on object creation."""
        super(
            BankTransaction,
            self).__init__(**kwargs)  # use the default declarative constructor
        self.created_at = created_at
        self.updated_at = updated_at

    def __repr__(self):
        return '<url {}>'.format(self.url)
Пример #3
0
class Bill(db.Model):
    __tablename__ = 'bills'
    url = db.Column(db.String(), nullable=False, primary_key=True)
    category = db.Column(db.String(), nullable=False)
    project = db.Column(db.String())
    comments = db.Column(db.String())
    contact = db.Column(db.String())
    dated_on = db.Column(db.Date())
    due_on = db.Column(db.Date())
    due_value = db.Column(db.Numeric(precision=10, scale=2))
    paid_value = db.Column(db.Numeric(precision=10, scale=2))
    reference = db.Column(db.String())
    sales_tax_rate = db.Column(db.Numeric(precision=10, scale=2))
    sales_tax_value = db.Column(db.Numeric(precision=10, scale=2))
    status = db.Column(db.String())
    total_value = db.Column(db.Numeric(precision=10, scale=2))
    created_at = db.Column(db.DateTime())
    updated_at = db.Column(db.DateTime())

    def __init__(self,
                 created_at=datetime.now(),
                 updated_at=datetime.now(),
                 **kwargs):
        """Mostly rely on default declarative SQLAlchemy constructor. Additionally set the timestamps on object creation."""
        super(
            Bill,
            self).__init__(**kwargs)  # use the default declarative constructor
        self.created_at = created_at
        self.updated_at = updated_at

    def __repr__(self):
        return '<url {}>'.format(self.url)
Пример #4
0
class BankTransactionExplanation(db.Model):
    __tablename__ = 'bank_transaction_explanations'
    url = db.Column(db.String(), nullable=False, primary_key=True)
    bank_transaction = db.Column(db.String(), nullable=False)
    bank_account = db.Column(db.String(), nullable=False)
    category = db.Column(db.String())
    dated_on = db.Column(db.Date())
    description = db.Column(db.String())
    gross_value = db.Column(db.Numeric(precision=10, scale=2))
    paid_bill = db.Column(db.String())
    paid_invoice = db.Column(db.String())
    paid_user = db.Column(db.String())
    receipt_reference = db.Column(db.String())
    sales_tax_rate = db.Column(db.Numeric(precision=10, scale=2))
    created_at = db.Column(db.DateTime())
    updated_at = db.Column(db.DateTime())

    def __init__(self, created_at=datetime.now(), updated_at=datetime.now(), **kwargs):
        """Mostly rely on default declarative SQLAlchemy constructor. Additionally set the timestamps on object creation."""
        super(BankTransactionExplanation, self).__init__(**kwargs)  # use the default declarative constructor
        self.created_at = created_at
        self.updated_at = updated_at

    def __repr__(self):
        return '<url {}>'.format(self.url)
Пример #5
0
class User(db.Model):
    __tablename__ = 'users'

    url = db.Column(db.String(), nullable=False, primary_key=True)
    first_name = db.Column(db.String())
    last_name = db.Column(db.String())
    email = db.Column(db.String())
    role = db.Column(db.String())
    permission_level = db.Column(db.Integer())
    opening_mileage = db.Column(
        db.Numeric(precision=10, scale=2)
    )  # returns a decimal.Decimal object to prevent rounding errors. Pass asdecimal=False to this constructor if you want to just get floats out.
    created_at = db.Column(db.DateTime())
    updated_at = db.Column(db.DateTime())

    def __init__(self,
                 created_at=datetime.now(),
                 updated_at=datetime.now(),
                 **kwargs):
        """Mostly rely on default declarative SQLAlchemy constructor. Additionally set the timestamps on object creation."""
        super(
            User,
            self).__init__(**kwargs)  # use the default declarative constructor
        self.created_at = created_at
        self.updated_at = updated_at

    def __repr__(self):
        return '<url {}>'.format(self.url)
Пример #6
0
class ServerCost(db.Model):
    __tablename__ = 'server_costs'

    project_url = db.Column(db.String(),
                            sa.ForeignKey('projects.url'),
                            nullable=False,
                            primary_key=True)
    value = db.Column(
        db.Numeric(precision=10, scale=2), nullable=True
    )  # returns a decimal.Decimal object to prevent rounding errors. Pass asdecimal=False to this constructor if you want to just get floats out.
    created_at = db.Column(db.DateTime())
    updated_at = db.Column(db.DateTime())

    def __init__(self,
                 created_at=datetime.now(),
                 updated_at=datetime.now(),
                 **kwargs):
        """Mostly rely on default declarative SQLAlchemy constructor. Additionally set the timestamps on object creation."""
        super(
            ServerCost,
            self).__init__(**kwargs)  # use the default declarative constructor
        self.created_at = created_at
        self.updated_at = updated_at

    def __repr__(self):
        return '<project url {0} value {1}>'.format(self.url, self.value)
Пример #7
0
class Expense(db.Model):
    __tablename__ = 'expenses'
    url = db.Column(db.String(), nullable=False, primary_key=True)
    category = db.Column(db.String())
    currency = db.Column(db.String())
    dated_on = db.Column(db.Date())
    description = db.Column(db.String())
    gross_value = db.Column(db.Numeric(precision=10, scale=2))
    manual_sales_tax_amount = db.Column(db.Numeric(precision=10, scale=2))
    native_gross_value = db.Column(db.Numeric(precision=10, scale=2))
    native_sales_tax_value = db.Column(db.Numeric(precision=10, scale=2))
    project = db.Column(db.String())
    receipt_reference = db.Column(db.String())
    sales_tax_rate = db.Column(db.Numeric(precision=10, scale=2))
    sales_tax_value = db.Column(db.Numeric(precision=10, scale=2))
    user = db.Column(db.String())
    rebill_factor = db.Column(db.Numeric(precision=10, scale=2))
    created_at = db.Column(db.DateTime())
    updated_at = db.Column(db.DateTime())

    def __init__(self, created_at=datetime.now(), updated_at=datetime.now(), **kwargs):
        """Mostly rely on default declarative SQLAlchemy constructor. Additionally set the timestamps on object creation."""
        super(Expense, self).__init__(**kwargs)  # use the default declarative constructor
        self.created_at = created_at
        self.updated_at = updated_at

    def __repr__(self):
        return '<url {}>'.format(self.url)
Пример #8
0
class Invoice(db.Model):
    __tablename__ = 'invoices'
    url = db.Column(db.String(), nullable=False, primary_key=True)
    always_show_bic_and_iban = db.Column(db.Boolean())
    comments = db.Column(db.String())
    contact = db.Column(db.String())
    currency = db.Column(db.String())
    dated_on = db.Column(db.Date())
    discount_percent = db.Column(db.Numeric(precision=10, scale=2))
    due_on = db.Column(db.Date())
    due_value = db.Column(db.Numeric(precision=10, scale=2))
    exchange_rate = db.Column(db.Numeric(precision=10, scale=2))
    involves_sales_tax = db.Column(db.Boolean())
    is_interim_uk_vat = db.Column(db.Boolean())
    net_value = db.Column(db.Numeric(precision=10, scale=2))
    omit_header = db.Column(db.Boolean())
    paid_on = db.Column(db.Date())
    paid_value = db.Column(db.Numeric(precision=10, scale=2))
    payment_terms_in_days = db.Column(db.Integer())
    po_reference = db.Column(db.String())
    project = db.Column(db.String())
    reference = db.Column(db.String())
    sales_tax_value = db.Column(db.Numeric(precision=10, scale=2))
    show_project_name = db.Column(db.Boolean())
    status = db.Column(db.String())
    total_value = db.Column(db.Numeric(precision=10, scale=2))
    written_off_date = db.Column(db.Date())
    send_reminder_emails = db.Column(db.Boolean())
    send_thank_you_emails = db.Column(db.Boolean())
    send_new_invoice_emails = db.Column(db.Boolean())
    include_timeslips = db.Column(db.String())
    recurring_invoice = db.Column(db.String())
    billed_grouped_by_single_timeslip = db.Column(db.Boolean())
    bank_account = db.Column(db.String())
    client_contact_name = db.Column(db.String())
    created_at = db.Column(db.DateTime())
    updated_at = db.Column(db.DateTime())

    def __init__(self,
                 created_at=datetime.now(),
                 updated_at=datetime.now(),
                 **kwargs):
        """Mostly rely on default declarative SQLAlchemy constructor. Additionally set the timestamps on object creation."""
        super(
            Invoice,
            self).__init__(**kwargs)  # use the default declarative constructor
        self.created_at = created_at
        self.updated_at = updated_at

    def __repr__(self):
        return '<url {}>'.format(self.url)
Пример #9
0
class Contact(db.Model):
    __tablename__ = 'contacts'
    url = db.Column(db.String(), nullable=False, primary_key=True)
    account_balance = db.Column(db.Numeric(precision=10, scale=2))
    address1 = db.Column(db.String())
    address2 = db.Column(db.String())
    address3 = db.Column(db.String())
    billing_email = db.Column(db.String())
    charge_sales_tax = db.Column(db.String())
    contact_name_on_invoices = db.Column(db.Boolean())
    country = db.Column(db.String())
    email = db.Column(db.String())
    first_name = db.Column(db.String())
    is_deletable = db.Column(db.Boolean())
    last_name = db.Column(db.String())
    locale = db.Column(db.String())
    mobile = db.Column(db.String())
    phone_number = db.Column(db.String())
    organisation_name = db.Column(db.String())
    postcode = db.Column(db.String())
    region = db.Column(db.String())
    status = db.Column(db.String())
    sales_tax_registration_number = db.Column(db.String())
    town = db.Column(db.String())
    uses_contact_invoice_sequence = db.Column(db.Boolean())
    active_projects_count = db.Column(db.Integer())
    created_at = db.Column(db.DateTime())
    updated_at = db.Column(db.DateTime())

    def __init__(self, created_at=datetime.now(), updated_at=datetime.now(), **kwargs):
        """Mostly rely on default declarative SQLAlchemy constructor. Additionally set the timestamps on object creation."""
        super(Contact, self).__init__(**kwargs)  # use the default declarative constructor
        self.created_at = created_at
        self.updated_at = updated_at

    def __repr__(self):
        return '<url {}>'.format(self.url)