# Generated by Django 6.0.4 on 2026-04-20 13:11

import django.core.validators
import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('people', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='MonthlyPaySlip',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('pay_slip_number', models.CharField(max_length=100, unique=True)),
                ('month', models.PositiveIntegerField(validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(12)])),
                ('year', models.PositiveIntegerField(validators=[django.core.validators.MinValueValidator(2000), django.core.validators.MaxValueValidator(2100)])),
                ('pay_structure_snapshot', models.JSONField(blank=True, default=dict, help_text="Snapshot of teacher's pay structure at generation time", null=True)),
                ('status', models.CharField(choices=[('DRAFT', 'Draft'), ('PENDING', 'Pending Approval'), ('APPROVED', 'Approved'), ('PAID', 'Paid'), ('CANCELLED', 'Cancelled')], default='DRAFT', max_length=20)),
                ('base_salary', models.DecimalField(decimal_places=2, default=0.0, max_digits=12)),
                ('dearness_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('house_rent_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('city_compensatory_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('travel_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('medical_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('special_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('education_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('telephone_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('performance_incentive', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('special_class_incentive', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('subject_expert_incentive', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('leadership_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('festival_bonus', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('annual_bonus', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('overtime_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('variable_pay', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('additional_earnings', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('other_allowances', models.JSONField(blank=True, default=dict, null=True)),
                ('provident_fund_employee', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('provident_fund_employer', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('esi_deduction', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('professional_tax', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('income_tax', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('loan_deduction', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('advance_deduction', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('attendance_deduction', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('other_deductions', models.JSONField(blank=True, default=dict, null=True)),
                ('casual_leave_taken', models.DecimalField(blank=True, decimal_places=1, default=0.0, max_digits=5, null=True)),
                ('sick_leave_taken', models.DecimalField(blank=True, decimal_places=1, default=0.0, max_digits=5, null=True)),
                ('earned_leave_taken', models.DecimalField(blank=True, decimal_places=1, default=0.0, max_digits=5, null=True)),
                ('unpaid_leave_days', models.DecimalField(blank=True, decimal_places=1, default=0.0, max_digits=5, null=True)),
                ('total_working_days', models.PositiveIntegerField(blank=True, null=True)),
                ('days_present', models.PositiveIntegerField(blank=True, null=True)),
                ('days_absent', models.PositiveIntegerField(blank=True, null=True)),
                ('late_days', models.PositiveIntegerField(blank=True, null=True)),
                ('total_earnings', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('total_deductions', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('net_pay', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('remarks', models.TextField(blank=True, null=True)),
                ('hr_remarks', models.TextField(blank=True, null=True)),
                ('approved_at', models.DateTimeField(blank=True, null=True)),
                ('is_acknowledged', models.BooleanField(default=False)),
                ('acknowledged_at', models.DateTimeField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('is_active', models.BooleanField(default=True)),
                ('approved_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='approved_pay_slips', to='people.teacher')),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_pay_slips', to='people.teacher')),
                ('teacher', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='monthly_pay_slips', to='people.teacher')),
            ],
            options={
                'verbose_name': 'Monthly Pay Slip',
                'verbose_name_plural': 'Monthly Pay Slips',
                'db_table': 'monthly_pay_slips',
                'ordering': ['-year', '-month'],
                'unique_together': {('teacher', 'month', 'year')},
            },
        ),
        migrations.CreateModel(
            name='PaymentTransaction',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('payment_type', models.CharField(choices=[('FULL', 'Full Payment'), ('PARTIAL', 'Partial Payment'), ('ADVANCE', 'Advance Payment'), ('BONUS', 'Bonus Payment'), ('REIMBURSEMENT', 'Reimbursement')], default='FULL', max_length=20)),
                ('amount', models.DecimalField(decimal_places=2, max_digits=12)),
                ('payment_method', models.CharField(choices=[('BANK_TRANSFER', 'Bank Transfer'), ('CASH', 'Cash'), ('CHEQUE', 'Cheque'), ('ONLINE', 'Online Payment')], max_length=20)),
                ('payment_date', models.DateTimeField(default=django.utils.timezone.now)),
                ('transaction_id', models.CharField(blank=True, max_length=100, null=True)),
                ('bank_reference', models.CharField(blank=True, max_length=100, null=True)),
                ('cheque_number', models.CharField(blank=True, max_length=50, null=True)),
                ('upi_id', models.CharField(blank=True, max_length=100, null=True)),
                ('bank_name', models.CharField(blank=True, max_length=255, null=True)),
                ('bank_account_number', models.CharField(blank=True, max_length=50, null=True)),
                ('bank_ifsc_code', models.CharField(blank=True, max_length=20, null=True)),
                ('status', models.CharField(choices=[('PENDING', 'Pending'), ('COMPLETED', 'Completed'), ('FAILED', 'Failed'), ('REFUNDED', 'Refunded')], default='PENDING', max_length=20)),
                ('remarks', models.TextField(blank=True, null=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('pay_slip', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payment_transactions', to='payslips.monthlypayslip')),
                ('recorded_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='recorded_payments', to='people.teacher')),
                ('teacher', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='payment_transactions', to='people.teacher')),
            ],
            options={
                'verbose_name': 'Payment Transaction',
                'verbose_name_plural': 'Payment Transactions',
                'db_table': 'payment_transactions',
                'ordering': ['-payment_date'],
            },
        ),
        migrations.CreateModel(
            name='PaySlipTemplate',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
                ('description', models.TextField(blank=True, null=True)),
                ('designation', models.CharField(blank=True, max_length=255, null=True)),
                ('base_salary', models.DecimalField(decimal_places=2, default=0.0, max_digits=12)),
                ('dearness_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('house_rent_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('city_compensatory_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('travel_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('medical_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('special_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('education_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('telephone_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('provident_fund_percentage', models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True)),
                ('esi_percentage', models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True)),
                ('professional_tax_fixed', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=10, null=True)),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('applicable_teachers', models.ManyToManyField(blank=True, related_name='pay_slip_templates', to='people.teacher')),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_pay_templates', to='people.teacher')),
            ],
            options={
                'verbose_name': 'Pay Slip Template',
                'verbose_name_plural': 'Pay Slip Templates',
                'db_table': 'pay_slip_templates',
            },
        ),
        migrations.CreateModel(
            name='TeacherPayStructure',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('effective_from', models.DateField(blank=True, help_text='Date from which this pay structure is effective', null=True)),
                ('effective_to', models.DateField(blank=True, help_text='Date until which this pay structure is valid (null = current)', null=True)),
                ('base_salary', models.DecimalField(decimal_places=2, default=0.0, help_text='Base monthly salary', max_digits=12)),
                ('dearness_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('house_rent_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('city_compensatory_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('travel_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('medical_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('special_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('education_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('telephone_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('provident_fund_percentage', models.DecimalField(blank=True, decimal_places=2, help_text='PF percentage of base salary (e.g., 12%)', max_digits=5, null=True)),
                ('esi_percentage', models.DecimalField(blank=True, decimal_places=2, help_text='ESI percentage of base salary', max_digits=5, null=True)),
                ('professional_tax_fixed', models.DecimalField(blank=True, decimal_places=2, default=0.0, help_text='Fixed professional tax per month', max_digits=10, null=True)),
                ('default_performance_incentive', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('default_special_class_incentive', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('default_subject_expert_incentive', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('default_leadership_allowance', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True)),
                ('is_active', models.BooleanField(default=True)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_pay_structures', to='people.teacher')),
                ('teacher', models.OneToOneField(help_text='Teacher this pay structure belongs to', on_delete=django.db.models.deletion.CASCADE, related_name='pay_structure', to='people.teacher')),
            ],
            options={
                'verbose_name': 'Teacher Pay Structure',
                'verbose_name_plural': 'Teacher Pay Structures',
                'db_table': 'teacher_pay_structures',
                'ordering': ['-effective_from'],
            },
        ),
    ]
