# Generated by Django 5.2.7 on 2026-02-22 12:17 import django.db.models.deletion import django.utils.timezone from decimal import Decimal from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Worker', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=200)), ('id_number', models.CharField(max_length=50, unique=True)), ('phone_number', models.CharField(blank=True, max_length=20)), ('monthly_salary', models.DecimalField(decimal_places=2, max_digits=10)), ('photo', models.ImageField(blank=True, null=True, upload_to='workers/photos/')), ('id_document', models.FileField(blank=True, null=True, upload_to='workers/documents/')), ('employment_date', models.DateField(default=django.utils.timezone.now)), ('notes', models.TextField(blank=True)), ('active', models.BooleanField(default=True)), ], ), migrations.CreateModel( name='ExpenseReceipt', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('date', models.DateField(default=django.utils.timezone.now)), ('vendor_name', models.CharField(max_length=200)), ('description', models.TextField(blank=True)), ('payment_method', models.CharField(choices=[('Cash', 'Cash'), ('Card', 'Card'), ('EFT', 'EFT'), ('Other', 'Other')], max_length=20)), ('vat_type', models.CharField(choices=[('Included', 'Included'), ('Excluded', 'Excluded'), ('None', 'None')], max_length=20)), ('subtotal', models.DecimalField(decimal_places=2, max_digits=12)), ('vat_amount', models.DecimalField(decimal_places=2, default=Decimal('0.00'), max_digits=12)), ('total_amount', models.DecimalField(decimal_places=2, max_digits=12)), ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='expense_receipts', to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( name='ExpenseLineItem', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('product_name', models.CharField(max_length=200)), ('amount', models.DecimalField(decimal_places=2, max_digits=12)), ('receipt', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='line_items', to='core.expensereceipt')), ], ), migrations.CreateModel( name='Project', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=200)), ('description', models.TextField(blank=True)), ('active', models.BooleanField(default=True)), ('supervisors', models.ManyToManyField(related_name='assigned_projects', to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( name='UserProfile', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( name='Team', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=200)), ('active', models.BooleanField(default=True)), ('supervisor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='supervised_teams', to=settings.AUTH_USER_MODEL)), ('workers', models.ManyToManyField(related_name='teams', to='core.worker')), ], ), migrations.CreateModel( name='Loan', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('principal_amount', models.DecimalField(decimal_places=2, max_digits=10)), ('remaining_balance', models.DecimalField(decimal_places=2, max_digits=10)), ('date', models.DateField(default=django.utils.timezone.now)), ('reason', models.TextField(blank=True)), ('active', models.BooleanField(default=True)), ('worker', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='loans', to='core.worker')), ], ), migrations.CreateModel( name='WorkLog', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('date', models.DateField(default=django.utils.timezone.now)), ('notes', models.TextField(blank=True)), ('overtime_amount', models.DecimalField(choices=[(Decimal('0.00'), 'None'), (Decimal('0.25'), '1/4 Day'), (Decimal('0.50'), '1/2 Day'), (Decimal('0.75'), '3/4 Day'), (Decimal('1.00'), 'Full Day')], decimal_places=2, default=Decimal('0.00'), max_digits=3)), ('priced_workers', models.ManyToManyField(blank=True, related_name='priced_overtime_logs', to='core.worker')), ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='work_logs', to='core.project')), ('supervisor', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='work_logs_created', to=settings.AUTH_USER_MODEL)), ('team', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='work_logs', to='core.team')), ('workers', models.ManyToManyField(related_name='work_logs', to='core.worker')), ], ), migrations.CreateModel( name='PayrollRecord', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('date', models.DateField(default=django.utils.timezone.now)), ('amount_paid', models.DecimalField(decimal_places=2, max_digits=10)), ('worker', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payroll_records', to='core.worker')), ('work_logs', models.ManyToManyField(related_name='payroll_records', to='core.worklog')), ], ), migrations.CreateModel( name='PayrollAdjustment', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('amount', models.DecimalField(decimal_places=2, max_digits=10)), ('date', models.DateField(default=django.utils.timezone.now)), ('description', models.TextField(blank=True)), ('type', models.CharField(choices=[('Bonus', 'Bonus'), ('Overtime', 'Overtime'), ('Deduction', 'Deduction'), ('Loan Repayment', 'Loan Repayment'), ('New Loan', 'New Loan'), ('Advance Payment', 'Advance Payment')], max_length=50)), ('loan', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='repayments', to='core.loan')), ('payroll_record', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='adjustments', to='core.payrollrecord')), ('project', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='adjustments_by_project', to='core.project')), ('worker', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='adjustments', to='core.worker')), ('work_log', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='adjustments_by_work_log', to='core.worklog')), ], ), ]