class Admin(dbase.Model): __tablename__ = 'admin' username = dbase.Column(dbase.String(50), nullable=False, primary_key=True) password = dbase.Column(dbase.String(100), nullable=False) def __init__(self, username, password): self.username = username self.password = generate_password_hash(password, method='sha256')
class Employee(dbase.Model): __tablename__ = 'employee' employeeid = dbase.Column(dbase.Integer, primary_key=True, autoincrement= True) employeestatus = dbase.Column(dbase.Integer, default=0) fname = dbase.Column(dbase.String(50)) mname = dbase.Column(dbase.String(50)) lname = dbase.Column(dbase.String(50)) position = dbase.Column(dbase.String(30)) code = dbase.Column(dbase.String(100), unique = True) contact = dbase.Column(dbase.String(15)) email = dbase.Column(dbase.String(30)) birth_date = dbase.Column(dbase.DATE, nullable=False) gender = dbase.Column(dbase.String(6), nullable=False) address = dbase.Column(dbase.String(50)) late = dbase.Column(dbase.Integer, default=0) absent = dbase.Column(dbase.Integer, default=0) overtimes = dbase.Column(dbase.Integer, default=0) attendance1 = dbase.relationship('Attendance', backref='employee', lazy=True) overtime = dbase.relationship('Overtime', backref='employee', lazy=True) def __init__(self, fname, mname, lname, position, code, contact, email, birth_date, gender, employeestatus, address): self.employeestatus = employeestatus self.fname = fname self.mname = mname self.lname = lname self.position = position self.code = code self.contact = contact self.email = email self.birth_date = str(birth_date) self.gender = gender self.address = address
class Admin(UserMixin, dbase.Model): __tablename__ = 'admin' id = dbase.Column(dbase.Integer, primary_key=True) username = dbase.Column(dbase.String(50), nullable=False) password = dbase.Column(dbase.String(256), nullable=False) morning_time_in_start = dbase.Column(dbase.Time) morning_time_out_start = dbase.Column(dbase.Time) morning_time_out_end = dbase.Column(dbase.Time) afternoon_time_in_start = dbase.Column(dbase.Time) afternoon_time_out_start = dbase.Column(dbase.Time) afternoon_time_out_end = dbase.Column(dbase.Time) def __init__(self, username, password): self.username = username self.password = generate_password_hash(password, method='sha256')
class Logs(dbase.Model): __tablename__ = 'logs' log_id = dbase.Column(dbase.Integer, primary_key=True) log_details = dbase.Column(dbase.String(100)) log_date = dbase.Column(dbase.DateTime) def __init__(self, log_details, log_date): self.log_details = log_details self.log_date = log_date
class Logs(dbase.Model): __tablename__ = "logs" logID = dbase.Column(dbase.Integer, primary_key=True, autoincrement=True) details = dbase.Column(dbase.String(60)) log_date = dbase.Column(dbase.DateTime) def __init__(self, details, log_date): self.details = details self.log_date = log_date
class Attendance(dbase.Model): __tablename__ = 'attendance' AttendanceId = dbase.Column(dbase.Integer, primary_key=True) employeeid = dbase.Column(dbase.Integer, dbase.ForeignKey('employee.employeeid')) lateTotal = dbase.Column(dbase.Integer, default=0) absentTotal = dbase.Column(dbase.Integer, default=0) morningTimeIn = dbase.Column(dbase.DateTime) morningTimeOut = dbase.Column(dbase.DateTime) morningStatus = dbase.Column(dbase.Integer, default=0, nullable =False) morningDailyStatus = dbase.Column(dbase.String(8)) morningRemark = dbase.Column(dbase.String(50)) afterTimeIn = dbase.Column(dbase.DateTime) afterTimeOut = dbase.Column(dbase.DateTime) afterStatus = dbase.Column(dbase.Integer, default=0, nullable = False) afterDailyStatus = dbase.Column(dbase.String(8)) afterRemark = dbase.Column(dbase.String(50)) date = dbase.Column(dbase.DATE) week_number = dbase.Column(dbase.Integer) def __init__(self, employeeid): self.employeeid = employeeid
class Overtimelist(dbase.Model): __tablename__ = 'overtimelist' overtime_id = dbase.Column(dbase.Integer, primary_key=True) overtimer_code = dbase.Column(dbase.String(20)) overtime_status = dbase.Column(dbase.Integer) overtime_request_date = dbase.Column(dbase.Date) time_in = dbase.Column(dbase.DateTime) time_out = dbase.Column(dbase.DateTime) time_status = dbase.Column(dbase.Integer) def __init__(self, overtimer_code, overtime_status): self.overtimer_code = overtimer_code self.overtime_status = overtime_status
class Attendance(dbase.Model): __tablename__ = 'attendance' attendance_id = dbase.Column(dbase.Integer, primary_key=True) employee_code = dbase.Column(dbase.String(50)) attendance_date = dbase.Column(dbase.Date) morning_time_in = dbase.Column(dbase.Time) morning_time_out = dbase.Column(dbase.Time) morning_attendance_status = dbase.Column(dbase.Integer) morning_remarks = dbase.Column(dbase.String(50)) afternoon_time_in = dbase.Column(dbase.Time) afternoon_time_out = dbase.Column(dbase.Time) afternoon_attendance_status = dbase.Column(dbase.Integer) afternoon_remarks = dbase.Column(dbase.String(50)) def __init__(self, employee_code, attendance_date, morning_attendance_status, afternoon_attendance_status, morning_remarks, afternoon_remarks): self.employee_code = employee_code self.attendance_date = attendance_date self.morning_remarks = morning_remarks self.afternoon_remarks = afternoon_remarks self.morning_attendance_status = morning_attendance_status self.afternoon_attendance_status = afternoon_attendance_status
class Trash(dbase.Model): __tablename__ = 'trash' id = dbase.Column(dbase.Integer, primary_key=True) lat = dbase.Column(dbase.Float) lng = dbase.Column(dbase.Float) location = dbase.Column(dbase.String(200)) height = dbase.Column(dbase.Float) weight = dbase.Column(dbase.Float) def __init__(self, lat='',lng='',location='',height='',weight=''): self.lat = lat self.lng = lng self.location = location self.height = height self.weight = weight
class Attendance(dbase.Model): __tablename__ = 'attendance' id = dbase.Column(dbase.Integer, primary_key=True) employeeid = dbase.Column(dbase.Integer, dbase.ForeignKey('employee.employeeid')) lateTotal = dbase.Column(dbase.Integer, default=0) absentTotal = dbase.Column(dbase.Integer, default=0) timeIn = dbase.Column(dbase.DateTime) timeOut = dbase.Column(dbase.DateTime) status = dbase.Column(dbase.Integer, default=0) dailyStatus = dbase.Column(dbase.String(6)) def __init__(self, lateTotal, absentTotal, timeIn, timeOut, status, dailyStatus, employeeid): self.lateTotal = lateTotal self.absentTotal = absentTotal self.timeIn = timeIn self.timeOut = timeOut self.status = 0 self.dailyStatus = dailyStatus self.employeeid = employeeid
class Employee(dbase.Model): __tablename__ = 'employee' employee_id = dbase.Column(dbase.Integer, primary_key=True) firstname = dbase.Column(dbase.String(50)) middlename = dbase.Column(dbase.String(50)) lastname = dbase.Column(dbase.String(50)) birthday = dbase.Column(dbase.DATE) gender = dbase.Column(dbase.String(6)) status = dbase.Column(dbase.String(20)) nationality = dbase.Column(dbase.String(30)) address = dbase.Column(dbase.String(100)) code = dbase.Column(dbase.String(20), unique=True) position = dbase.Column(dbase.String(30)) email = dbase.Column(dbase.String(50)) contact_number = dbase.Column(dbase.String(11)) employee_status = dbase.Column(dbase.Integer) department = dbase.Column(dbase.String(50)) qr_url = dbase.Column(dbase.String(100)) profile_url = dbase.Column(dbase.String(100)) def __init__(self, firstname, middlename, department, contact_number, email, lastname, birthday, gender, address, code, position, employee_status, nationality, status): self.firstname = firstname self.middlename = middlename self.lastname = lastname self.birthday = birthday self.gender = gender self.address = address self.code = code self.position = position self.employee_status = employee_status self.nationality = nationality self.status = status self.email = email self.contact_number = contact_number self.department = department