# 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'),
        ),
    ]
