class GuncelOdeme(db.Model): id = db.Column(db.Integer, primary_key=True) tutar = db.Column(db.Float, nullable=False) create_date = db.Column(db.Date, nullable=False) siparis_id = db.Column(db.Integer, db.ForeignKey('siparis.id'), nullable=False)
class Odeme(db.Model): id = db.Column(db.Integer, primary_key=True) tutar = db.Column(db.Float, nullable=False) create_date = db.Column(db.Date, nullable=False) musteri_id = db.Column(db.Integer, db.ForeignKey('musteri.id'), nullable=False)
class TumMusteriTahsilatlari(db.Model): id = db.Column(db.Integer, primary_key=True) musteri_adi_crm = db.Column(db.String) crm_kodu = db.Column(db.String) tahsilat_tutari = db.Column(db.Float) durum = db.Column(db.String, nullable=False, default="Onay Bekliyor") tahsilat_tarihi = db.Column(db.Date) aciklama = db.Column(db.String) dekont = db.Column(db.String, nullable=True) create_date = db.Column(db.Date, nullable=False, default=datetime.now()) user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
class Musteri(db.Model): id = db.Column(db.Integer, primary_key=True) isim = db.Column(db.String, nullable=False) telefon = db.Column(db.String, nullable=False) bakiye = db.Column(db.Float, nullable=False) guncel_bakiye = db.Column(db.Float, default=0.0) tahsilat = db.Column(db.Float, default=0.0) mail = db.Column(db.String) parasut_no = db.Column(db.String, nullable=False) parasut_odeme_linki = db.Column(db.String) tahsilatlar = db.relationship('Tahsilat', backref='musteri', lazy=True) odemeler = db.relationship('Odeme', backref='musteri', lazy=True) indirimler = db.relationship('Indirim', backref='musteri', lazy='dynamic') user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
class Tahsilat(db.Model): id = db.Column(db.Integer, primary_key=True) tutar = db.Column(db.Float, nullable=False) durum = db.Column(db.String, nullable=False, default="Onay Bekliyor") dekont = db.Column(db.String, nullable=True) aciklama = db.Column(db.Text, nullable=True) shortcode = db.Column(db.String, nullable=False) create_date = db.Column(db.Date, nullable=False, default=datetime.now()) parasut_id = db.Column(db.String) musteri_id = db.Column(db.Integer, db.ForeignKey('musteri.id'), nullable=False)
class BlogPost(db.Model): users = db.relationship(User) id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False) date = db.Column(db.DateTime, nullable=False, default=datetime.utcnow) title = db.Column(db.String(250), nullable=False) text = db.Column(db.Text, nullable=False) def __init__(self, title, text, user_id): self.title = title self.text = text self.user_id = user_id def __repr__(self): return f'Post ID: {self.id} -- Date: {self.date} --- {self.title}'
class Guncel_Tahsilat(db.Model): id = db.Column(db.Integer, primary_key=True) tutar = db.Column(db.Float) tahsilat_tarihi = db.Column(db.Date) aciklama = db.Column(db.String) dekont = db.Column(db.String, nullable=True) siparis_id = db.Column(db.Integer, db.ForeignKey('siparis.id'), nullable=False) durum = db.Column(db.String, nullable=False, default="Onay Bekliyor")
class User(db.Model, UserMixin): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) profile_image = db.Column(db.String(64), nullable=False, default='default_image.png') email = db.Column(db.String(64), unique=True, index=True) username = db.Column(db.String(64), unique=True, index=True) password_hash = db.Column(db.String(128)) posts = db.relationship('BlogPost', backref='author', lazy - True) def __init__(self, email, username, password): self.email = email self.username = username self.password_hash = generate_password_hash(password) def check_password(self, password): return check_password_hash(self.password_hash, password) def __repr__(self): return f'Username: {self.username}'
class Siparis(db.Model): id = db.Column(db.Integer, primary_key=True) proje_no = db.Column(db.String) musteri_adi = db.Column(db.String, nullable=False) siparis_tutari = db.Column(db.Float, nullable=False) son_odeme_tarihi = db.Column(db.Date) isin_alinma_tarihi = db.Column(db.Date) tahsilat = db.Column(db.Float, default=0) onceki_aydan_kalan = db.Column(db.Integer, default=0) siparis_son_durum = db.Column(db.String) evrak_cikis_tarihi = db.Column(db.Date) user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) tahsilatlar = db.relationship('Guncel_Tahsilat', backref='siparis', lazy=True) odeme = db.relationship('GuncelOdeme', backref='sipariss', lazy=True)
class TemsilciOranlari(db.Model): id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) siparis_date = db.Column(db.Date, nullable=False) toplam_siparis_miktari = db.Column(db.Integer, default=0.0) toplam_siparis_tahsilati = db.Column(db.Integer, default=0.0)
class Indirim(db.Model): id = db.Column(db.Integer, primary_key=True) indirim_tutari = db.Column(db.Float, nullable=False) musteri_id = db.Column(db.Integer, db.ForeignKey('musteri.id')) create_date = db.Column(db.Date)