diff --git a/core/__pycache__/admin.cpython-311.pyc b/core/__pycache__/admin.cpython-311.pyc index a5ed392..7aa9e0c 100644 Binary files a/core/__pycache__/admin.cpython-311.pyc and b/core/__pycache__/admin.cpython-311.pyc differ diff --git a/core/__pycache__/models.cpython-311.pyc b/core/__pycache__/models.cpython-311.pyc index e061640..b0b8df2 100644 Binary files a/core/__pycache__/models.cpython-311.pyc and b/core/__pycache__/models.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 2a36fd6..37a3157 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/admin.py b/core/admin.py index 8c38f3f..c1f1d66 100644 --- a/core/admin.py +++ b/core/admin.py @@ -1,3 +1,24 @@ from django.contrib import admin +from .models import Firma, Fatura, FaturaKalemi -# Register your models here. +@admin.register(Firma) +class FirmaAdmin(admin.ModelAdmin): + list_display = ('ad', 'vergi_no', 'olusturulma_tarihi') + search_fields = ('ad', 'vergi_no') + +class FaturaKalemiInline(admin.TabularInline): + model = FaturaKalemi + extra = 1 + +@admin.register(Fatura) +class FaturaAdmin(admin.ModelAdmin): + list_display = ('fatura_no', 'firma', 'tarih', 'genel_toplam', 'islenmis') + list_filter = ('islenmis', 'tarih', 'firma') + search_fields = ('fatura_no', 'firma__ad') + inlines = [FaturaKalemiInline] + +@admin.register(FaturaKalemi) +class FaturaKalemiAdmin(admin.ModelAdmin): + list_display = ('urun_adi', 'fatura', 'adet', 'toplam_tutar') + list_filter = ('fatura__firma',) + search_fields = ('urun_adi', 'fatura__fatura_no') \ No newline at end of file diff --git a/core/migrations/0001_initial.py b/core/migrations/0001_initial.py new file mode 100644 index 0000000..b57c41f --- /dev/null +++ b/core/migrations/0001_initial.py @@ -0,0 +1,71 @@ +# Generated by Django 5.2.7 on 2026-02-05 22:03 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Fatura', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('fatura_no', models.CharField(max_length=50, unique=True, verbose_name='Fatura No')), + ('tarih', models.DateField(verbose_name='Fatura Tarihi')), + ('ara_toplam', models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Ara Toplam')), + ('kdv_toplam', models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='KDV Toplam')), + ('genel_toplam', models.DecimalField(decimal_places=2, default=0, max_digits=12, verbose_name='Genel Toplam')), + ('pdf_dosyasi', models.FileField(upload_to='faturalar/%Y/%m/', verbose_name='PDF Dosyası')), + ('islenmis', models.BooleanField(default=False, verbose_name='İşlendi mi?')), + ('olusturulma_tarihi', models.DateTimeField(auto_now_add=True)), + ], + options={ + 'verbose_name': 'Fatura', + 'verbose_name_plural': 'Faturalar', + 'ordering': ['-tarih'], + }, + ), + migrations.CreateModel( + name='Firma', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('ad', models.CharField(max_length=255, verbose_name='Firma Adı')), + ('vergi_no', models.CharField(max_length=20, unique=True, verbose_name='Vergi No / TC Kimlik No')), + ('mersis_no', models.CharField(blank=True, max_length=30, null=True, verbose_name='MERSİS No')), + ('adres', models.TextField(blank=True, null=True, verbose_name='Adres')), + ('olusturulma_tarihi', models.DateTimeField(auto_now_add=True)), + ], + options={ + 'verbose_name': 'Firma', + 'verbose_name_plural': 'Firmalar', + }, + ), + migrations.CreateModel( + name='FaturaKalemi', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('urun_adi', models.CharField(max_length=255, verbose_name='Ürün Adı')), + ('adet', models.DecimalField(decimal_places=2, default=1, max_digits=10, verbose_name='Adet')), + ('birim_fiyat', models.DecimalField(decimal_places=2, max_digits=12, verbose_name='Birim Fiyat')), + ('kdv_orani', models.DecimalField(decimal_places=2, default=20, max_digits=5, verbose_name='KDV Oranı (%)')), + ('kdv_tutari', models.DecimalField(decimal_places=2, max_digits=12, verbose_name='KDV Tutarı')), + ('toplam_tutar', models.DecimalField(decimal_places=2, max_digits=12, verbose_name='Toplam Tutar')), + ('fatura', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='kalemler', to='core.fatura', verbose_name='Fatura')), + ], + options={ + 'verbose_name': 'Fatura Kalemi', + 'verbose_name_plural': 'Fatura Kalemleri', + }, + ), + migrations.AddField( + model_name='fatura', + name='firma', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='faturalar', to='core.firma', verbose_name='Firma'), + ), + ] diff --git a/core/migrations/__pycache__/0001_initial.cpython-311.pyc b/core/migrations/__pycache__/0001_initial.cpython-311.pyc new file mode 100644 index 0000000..ecc9c64 Binary files /dev/null and b/core/migrations/__pycache__/0001_initial.cpython-311.pyc differ diff --git a/core/models.py b/core/models.py index 71a8362..017449a 100644 --- a/core/models.py +++ b/core/models.py @@ -1,3 +1,50 @@ from django.db import models -# Create your models here. +class Firma(models.Model): + ad = models.CharField(max_length=255, verbose_name="Firma Adı") + vergi_no = models.CharField(max_length=20, unique=True, verbose_name="Vergi No / TC Kimlik No") + mersis_no = models.CharField(max_length=30, blank=True, null=True, verbose_name="MERSİS No") + adres = models.TextField(blank=True, null=True, verbose_name="Adres") + olusturulma_tarihi = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return self.ad + + class Meta: + verbose_name = "Firma" + verbose_name_plural = "Firmalar" + +class Fatura(models.Model): + firma = models.ForeignKey(Firma, on_delete=models.CASCADE, related_name="faturalar", verbose_name="Firma") + fatura_no = models.CharField(max_length=50, unique=True, verbose_name="Fatura No") + tarih = models.DateField(verbose_name="Fatura Tarihi") + ara_toplam = models.DecimalField(max_digits=12, decimal_places=2, default=0, verbose_name="Ara Toplam") + kdv_toplam = models.DecimalField(max_digits=12, decimal_places=2, default=0, verbose_name="KDV Toplam") + genel_toplam = models.DecimalField(max_digits=12, decimal_places=2, default=0, verbose_name="Genel Toplam") + pdf_dosyasi = models.FileField(upload_to="faturalar/%Y/%m/", verbose_name="PDF Dosyası") + islenmis = models.BooleanField(default=False, verbose_name="İşlendi mi?") + olusturulma_tarihi = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return f"{self.fatura_no} - {self.firma.ad}" + + class Meta: + verbose_name = "Fatura" + verbose_name_plural = "Faturalar" + ordering = ['-tarih'] + +class FaturaKalemi(models.Model): + fatura = models.ForeignKey(Fatura, on_delete=models.CASCADE, related_name="kalemler", verbose_name="Fatura") + urun_adi = models.CharField(max_length=255, verbose_name="Ürün Adı") + adet = models.DecimalField(max_digits=10, decimal_places=2, default=1, verbose_name="Adet") + birim_fiyat = models.DecimalField(max_digits=12, decimal_places=2, verbose_name="Birim Fiyat") + kdv_orani = models.DecimalField(max_digits=5, decimal_places=2, default=20, verbose_name="KDV Oranı (%)") + kdv_tutari = models.DecimalField(max_digits=12, decimal_places=2, verbose_name="KDV Tutarı") + toplam_tutar = models.DecimalField(max_digits=12, decimal_places=2, verbose_name="Toplam Tutar") + + def __str__(self): + return f"{self.urun_adi} ({self.fatura.fatura_no})" + + class Meta: + verbose_name = "Fatura Kalemi" + verbose_name_plural = "Fatura Kalemleri" diff --git a/core/templates/base.html b/core/templates/base.html index 1e7e5fb..43c2f26 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -1,25 +1,173 @@ - - + - - {% block title %}Knowledge Base{% endblock %} - {% if project_description %} - - - - {% endif %} - {% if project_image_url %} - - - {% endif %} - {% load static %} - - {% block head %}{% endblock %} + + + {% block title %}Fatura Yönetim Sistemi{% endblock %} + + + + + + {% load static %} + + {% block extra_css %}{% endblock %} - - {% block content %}{% endblock %} - +
+ + + + +
+ + + {% block content %}{% endblock %} +
+
+ + + {% block extra_js %}{% endblock %} + + \ No newline at end of file diff --git a/core/templates/core/index.html b/core/templates/core/index.html index faec813..6a573d6 100644 --- a/core/templates/core/index.html +++ b/core/templates/core/index.html @@ -1,145 +1,137 @@ {% extends "base.html" %} -{% block title %}{{ project_name }}{% endblock %} - -{% block head %} - - - - -{% endblock %} +{% block title %}Gösterge Paneli | FaturaYol{% endblock %} {% block content %} -
-
-

Analyzing your requirements and generating your app…

-
- Loading… +
+
+
+

Gösterge Paneli

+

Fatura yönetim sistemine genel bakış.

+
-

AppWizzy AI is collecting your requirements and applying the first changes.

-

This page will refresh automatically as the plan is implemented.

-

- Runtime: Django {{ django_version }} · Python {{ python_version }} - — UTC {{ current_time|date:"Y-m-d H:i:s" }} -

-
-
- -{% endblock %} \ No newline at end of file + + +
+
+
+
+ +
+
+
Toplam Firma
+

{{ toplam_firma }}

+
+
+
+
+
+
+ +
+
+
Toplam Fatura
+

{{ toplam_fatura }}

+
+
+
+
+
+
+ +
+
+
Toplam Harcama
+

₺{{ toplam_harcama|floatformat:2 }}

+
+
+
+
+ +
+ +
+
+
+
Son Eklenen Faturalar
+ Tümünü Gör +
+
+
+ + + + + + + + + + + + + {% for fatura in son_faturalar %} + + + + + + + + + {% empty %} + + + + {% endfor %} + +
Fatura NoFirmaTarihToplamDurumİşlem
{{ fatura.fatura_no }}{{ fatura.firma.ad }}{{ fatura.tarih|date:"d.m.Y" }}₺{{ fatura.genel_toplam }} + {% if fatura.islenmis %} + İşlendi + {% else %} + Bekliyor + {% endif %} + + +
Henüz fatura eklenmemiş.
+
+
+
+
+ + +
+
+
+
Hızlı İşlemler
+
+
+
+ + + +
+
+
+
+
+ +{% endblock %} diff --git a/core/views.py b/core/views.py index c9aed12..5057928 100644 --- a/core/views.py +++ b/core/views.py @@ -1,25 +1,19 @@ -import os -import platform - -from django import get_version as django_version from django.shortcuts import render -from django.utils import timezone - +from django.db.models import Sum, Count +from .models import Firma, Fatura def home(request): - """Render the landing screen with loader and environment details.""" - host_name = request.get_host().lower() - agent_brand = "AppWizzy" if host_name == "appwizzy.com" else "Flatlogic" - now = timezone.now() + """Fatura Yönetimi Gösterge Paneli.""" + toplam_firma = Firma.objects.count() + toplam_fatura = Fatura.objects.count() + toplam_harcama = Fatura.objects.aggregate(Sum('genel_toplam'))['genel_toplam__sum'] or 0 + son_faturalar = Fatura.objects.select_related('firma').all()[:10] context = { - "project_name": "New Style", - "agent_brand": agent_brand, - "django_version": django_version(), - "python_version": platform.python_version(), - "current_time": now, - "host_name": host_name, - "project_description": os.getenv("PROJECT_DESCRIPTION", ""), - "project_image_url": os.getenv("PROJECT_IMAGE_URL", ""), + "toplam_firma": toplam_firma, + "toplam_fatura": toplam_fatura, + "toplam_harcama": toplam_harcama, + "son_faturalar": son_faturalar, + "active_menu": "dashboard" } - return render(request, "core/index.html", context) + return render(request, "core/index.html", context) \ No newline at end of file