Ejemplo n.º 1
0
class Projects(db.Model):
    __tablename_ = "Projects"
    proj_id = db.Column(db.Integer(),
                        primary_key=True,
                        autoincrement=True,
                        nullable=False)
    proj_manager = db.Column(db.NVARCHAR(20),
                             db.ForeignKey("project_managers.manager_code"),
                             nullable=False)
    proj_budget = db.Column(db.Numeric, nullable=False)
    proj_name = db.Column(db.NVARCHAR(40), nullable=False)
    proj_approval = db.Column(db.Boolean)
    proj_deadline = db.Column(db.DateTime)
    proj_hours = db.Column(db.Numeric)
    proj_client = db.Column(db.NVARCHAR(20),
                            db.ForeignKey("clients.client_id"))
    proj_description = db.Column(db.NVARCHAR(1000))
    proj_type = db.Column(db.Integer, db.ForeignKey("project_types.type_id"))
    proj_currency = db.Column(db.Integer, db.ForeignKey("currency.curr_id"))
    proj_create_date = db.Column(db.Date,
                                 default=datetime.date.today,
                                 nullable=False)

    proj_disbs = db.relationship("ProjectDisbursements",
                                 lazy="dynamic",
                                 backref="project")
    proj_tasks = db.relationship("ProjectTasks",
                                 lazy="dynamic",
                                 backref="project")
    proj_material = db.relationship("WarehouseReqs",
                                    lazy="dynamic",
                                    backref="project")
Ejemplo n.º 2
0
class WarehouseUnits(db.Model):
    __tablename_ = "warehouse_units"
    units_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    units_name = db.Column(db.VARCHAR(40), nullable=False)
    units_abbr = db.Column(db.NVARCHAR(15), nullable=False)

    product = db.relationship("WarehouseProducts",
                              lazy="dynamic",
                              backref="unitnames")
Ejemplo n.º 3
0
class WarehouseProducts(db.Model):
    __tablename_ = "warehouse_products"
    product_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    product_name = db.Column(db.VARCHAR(60), nullable=False)
    product_type = db.Column(db.Integer,
                             db.ForeignKey("warehouse_categories.cat_id"),
                             nullable=False)
    product_creator = db.Column(db.NVARCHAR(15),
                                db.ForeignKey("warehouse_users.user_empcode"))
    product_reorder = db.Column(db.Numeric, nullable=False)
    product_approver = db.Column(db.NVARCHAR(15))
    product_units = db.Column(db.Integer,
                              db.ForeignKey("warehouse_units.units_id"),
                              nullable=False)

    requisitions = db.relationship("WarehouseReqs",
                                   lazy="dynamic",
                                   backref="product")
Ejemplo n.º 4
0
class WarehouseCategories(db.Model):
    __tablename_ = "warehouse_categories"
    cat_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    cat_name = db.Column(db.VARCHAR(40), nullable=False)
    cat_creator = db.Column(db.NVARCHAR(15),
                            db.ForeignKey(WarehouseUsers.user_empcode))

    products = db.relationship("WarehouseProducts",
                               lazy="dynamic",
                               backref="categoryNames")
Ejemplo n.º 5
0
class WarehouseReceipts(db.Model):
    __tablename_ = "warehouse_receipts"
    receipt_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    receipt_date = db.Column(db.DateTime,
                             default=datetime.datetime.today,
                             nullable=False)
    receipt_description = db.Column(db.VARCHAR(5000), nullable=False)
    receipt_product = db.Column(db.NVARCHAR(10), nullable=False)
    receipt_supplier = db.Column(db.VARCHAR(10), nullable=False)
    receipt_receiver = db.Column(db.NVARCHAR(15),
                                 db.ForeignKey(WarehouseUsers.user_empcode))
    receipt_qty = db.Column(db.Numeric, nullable=False)
    receipt_barcode = db.Column(db.VARCHAR(40), nullable=True)
    receipts_warehouse = db.Column(
        db.Integer, db.ForeignKey("warehouse_locations.location_id"))
    receipt_total_cost = db.Column(db.Numeric, nullable=False)
    receipt_document_no = db.Column(db.DateTime,
                                    default=datetime.datetime.today,
                                    nullable=False)
Ejemplo n.º 6
0
class ProjectDisbursements(db.Model):
    __tablename_ = "project_disbursements"
    disb_id = db.Column(db.Integer, primary_key=True)
    disb_amt = db.Column(db.VARCHAR(30), nullable=False)
    disb_approver = db.Column(db.NVARCHAR(20))
    disb_status = db.Column(db.Boolean)
    disb_desc = db.Column(db.VARCHAR(10000), nullable=False)
    disb_proj = db.Column(db.Integer, db.ForeignKey(Projects.proj_id))
    disb_date = db.Column(db.DateTime,
                          default=datetime.datetime.today,
                          nullable=False)
Ejemplo n.º 7
0
class Users(UserMixin, db.Model):
    __tablename_ = "users"
    user_email = db.Column(db.VARCHAR(40), nullable=False)
    user_name = db.Column(db.VARCHAR(30), nullable=False)
    user_password = db.Column(db.VARCHAR(200))
    user_empcode = db.Column(db.NVARCHAR(15), nullable=False, primary_key=True)
    user_approver_rights = db.Column(db.Boolean, nullable=False)
    disbursements_approval_rights = db.Column(db.Boolean, nullable=False)

    responses = db.relationship("IssueResponse",
                                lazy="dynamic",
                                backref="user")
Ejemplo n.º 8
0
class IssueResponse(db.Model):
    __tablename_ = "issue_response"
    issue_id = db.Column(db.Integer,
                         db.ForeignKey(ProjectIssues.issue_id),
                         nullable=False)
    response_id = db.Column(db.Integer, nullable=False, primary_key=True)
    issue_responder = db.Column(db.NVARCHAR(15),
                                db.ForeignKey(Users.user_empcode),
                                nullable=False)
    issue_response = db.Column(db.VARCHAR(10000), nullable=True)
    response_date = db.Column(db.Date,
                              default=datetime.date.today,
                              nullable=False)
Ejemplo n.º 9
0
class WarehouseUsers(db.Model):
    __tablename_ = "warehouse_users"
    user_email = db.Column(db.VARCHAR(200))
    user_password = db.Column(db.VARCHAR(200))
    user_empcode = db.Column(db.NVARCHAR(15), nullable=False, primary_key=True)
    user_approver_rights = db.Column(db.Boolean, nullable=False)
    ####
    receipts = db.relationship("WarehouseReceipts",
                               lazy="dynamic",
                               backref="user")
    products = db.relationship("WarehouseProducts",
                               lazy="dynamic",
                               backref="user")
    requisitions = db.relationship("WarehouseReqs",
                                   lazy="dynamic",
                                   backref="requestor")
    categories = db.relationship("WarehouseCategories",
                                 lazy="dynamic",
                                 backref="creator")
Ejemplo n.º 10
0
class WarehouseReqs(db.Model):
    __tablename_ = "warehouse_reqs"
    req_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    req_date = db.Column(db.DateTime,
                         default=datetime.datetime.today,
                         nullable=False)
    req_description = db.Column(db.VARCHAR(5000), nullable=False)
    req_product = db.Column(db.Integer,
                            db.ForeignKey(WarehouseProducts.product_id),
                            nullable=False)
    req_project = db.Column(db.Integer,
                            db.ForeignKey(Projects.proj_id),
                            nullable=False)
    req_requestor = db.Column(db.NVARCHAR(15),
                              db.ForeignKey(WarehouseUsers.user_empcode))
    req_qty = db.Column(db.Numeric, nullable=False)
    #req_document_no = db.Column(db.DateTime, default=datetime.datetime.today, nullable=False)
    req_deadline = db.Column(db.DateTime, nullable=False)
    req_approval = db.Column(db.Boolean, default=False, nullable=True)
    req_approval_date = db.Column(db.DateTime, nullable=True)
Ejemplo n.º 11
0
class ProjectManagers(db.Model):
    __tablename_ = "project_managers"
    manager_email = db.Column(db.VARCHAR(40), nullable=False)
    manager_name = db.Column(db.VARCHAR(30), nullable=False)
    manager_code = db.Column(db.NVARCHAR(20), primary_key=True)
    project = db.relationship("Projects", backref="manager", lazy="dynamic")
Ejemplo n.º 12
0
class Currency(db.Model):
    __tablename_ = "currency"
    curr_name = db.Column(db.NVARCHAR(10), nullable=False)
    curr_id = db.Column(db.Integer, primary_key=True)
    project = db.relationship(Projects, backref="currency", lazy="dynamic")
Ejemplo n.º 13
0
class Clients(db.Model):
    __tablename_ = "clients"
    client_id = db.Column(db.NVARCHAR(20), primary_key=True)
    client_name = db.Column(db.NVARCHAR(40), nullable=False)
    project = db.relationship("Projects", backref="client", lazy="dynamic")
Ejemplo n.º 14
0
class Employees(db.Model):
    __tablename_ = "employees"
    emp_id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    emp_name = db.Column(db.VARCHAR(60), nullable=False)
    emp_code = db.Column(db.NVARCHAR(15), nullable=False)
    emp_email = db.Column(db.VARCHAR(60), nullable=False)