# Generated by Django 4.2.11 on 2025-01-19 22:13

import base.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import payroll.models.models
import simple_history.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('employee', '0001_initial'),
        ('asset', '0001_initial'),
        ('leave', '0001_initial'),
        ('horilla_audit', '0001_initial'),
        ('base', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('attendance', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Allowance',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Created At')),
                ('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
                ('title', models.CharField(help_text='Title of the allowance', max_length=255)),
                ('one_time_date', models.DateField(blank=True, help_text='The one-time allowance in which the allowance will apply to the payslips             if the date between the payslip period', null=True)),
                ('include_active_employees', models.BooleanField(default=False, help_text='Target allowance to all active employees in the company', verbose_name='Include all active employees')),
                ('is_taxable', models.BooleanField(default=True, help_text='This field is used to calculate the taxable allowances')),
                ('is_condition_based', models.BooleanField(default=False, help_text="This field is used to target allowance         to the specific employees when the condition satisfies with the employee's information")),
                ('field', models.CharField(blank=True, choices=[('children', 'Children'), ('marital_status', 'Marital Status'), ('experience', 'Experience'), ('employee_work_info__experience', 'Company Experience'), ('gender', 'Gender'), ('country', 'Country'), ('state', 'State'), ('contract_set__pay_frequency', 'Pay Frequency'), ('contract_set__wage_type', 'Wage Type'), ('contract_set__department__department', 'Department on Contract')], help_text='The related field of the employees', max_length=255, null=True)),
                ('condition', models.CharField(blank=True, choices=[('equal', 'Equal (==)'), ('notequal', 'Not Equal (!=)'), ('lt', 'Less Than (<)'), ('gt', 'Greater Than (>)'), ('le', 'Less Than or Equal To (<=)'), ('ge', 'Greater Than or Equal To (>=)'), ('icontains', 'Contains')], max_length=255, null=True)),
                ('value', models.CharField(blank=True, help_text='The value must be like the data stored in the database', max_length=255, null=True)),
                ('is_fixed', models.BooleanField(default=True, help_text='To specify, the allowance is fixed or not')),
                ('amount', models.FloatField(blank=True, help_text='Fixed amount for this allowance', null=True, validators=[payroll.models.models.min_zero])),
                ('based_on', models.CharField(blank=True, choices=[('basic_pay', 'Basic Pay'), ('children', 'Children'), ('overtime', 'Overtime'), ('shift_id', 'Shift'), ('work_type_id', 'Work Type'), ('attendance', 'Attendance')], default='basic_pay', help_text='If the allowance is not fixed then specifies how the allowance provided', max_length=255, null=True)),
                ('rate', models.FloatField(blank=True, help_text='The percentage of based on', null=True, validators=[payroll.models.models.rate_validator])),
                ('per_attendance_fixed_amount', models.FloatField(blank=True, default=0.0, help_text='The attendance fixed amount for one validated attendance', null=True, validators=[payroll.models.models.min_zero])),
                ('per_children_fixed_amount', models.FloatField(blank=True, default=0.0, help_text='The fixed amount per children', null=True, validators=[payroll.models.models.min_zero])),
                ('shift_per_attendance_amount', models.FloatField(blank=True, default=0.0, help_text='The fixed amount for one validated attendance with that shift', null=True, validators=[payroll.models.models.min_zero])),
                ('amount_per_one_hr', models.FloatField(blank=True, default=0.0, help_text='The fixed amount for one hour overtime that are validated             and approved the overtime attendance', null=True, validators=[payroll.models.models.min_zero])),
                ('work_type_per_attendance_amount', models.FloatField(blank=True, default=0.0, help_text='The fixed amount for one validated attendance with that work type', null=True, validators=[payroll.models.models.min_zero])),
                ('has_max_limit', models.BooleanField(default=False, help_text='Limit the allowance amount', verbose_name='Has max limit for allowance')),
                ('maximum_amount', models.FloatField(blank=True, help_text='The maximum amount for the allowance', null=True, validators=[payroll.models.models.min_zero])),
                ('maximum_unit', models.CharField(choices=[('month_working_days', 'For working days on month')], default='month_working_days', help_text='The maximum amount for ?', max_length=20, null=True)),
                ('if_choice', models.CharField(choices=[('basic_pay', 'Basic Pay')], default='basic_pay', help_text='The pay head for the if condition', max_length=10)),
                ('if_condition', models.CharField(choices=[('equal', 'Equal (==)'), ('notequal', 'Not Equal (!=)'), ('lt', 'Less Than (<)'), ('gt', 'Greater Than (>)'), ('le', 'Less Than or Equal To (<=)'), ('ge', 'Greater Than or Equal To (>=)'), ('range', 'Range')], default='gt', help_text='Apply for those, if the pay-head conditions satisfy', max_length=10)),
                ('if_amount', models.FloatField(default=0.0, help_text='The amount of the pay-head')),
                ('start_range', models.FloatField(blank=True, help_text='The start amount of the pay-head range', null=True)),
                ('end_range', models.FloatField(blank=True, help_text='The end amount of the pay-head range', null=True)),
                ('only_show_under_employee', models.BooleanField(default=False, editable=False)),
                ('is_loan', models.BooleanField(default=False, editable=False)),
                ('company_id', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.PROTECT, to='base.company')),
                ('created_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Created By')),
                ('exclude_employees', models.ManyToManyField(blank=True, help_text='To ignore the allowance to the employees when target them by all employees             or through condition-based', related_name='allowance_excluded', to='employee.employee', verbose_name='Exclude Employees')),
                ('modified_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_modified_by', to=settings.AUTH_USER_MODEL, verbose_name='Modified By')),
            ],
            options={
                'verbose_name': 'Allowance',
            },
        ),
        migrations.CreateModel(
            name='Contract',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Created At')),
                ('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
                ('contract_name', models.CharField(help_text='Contract Title.', max_length=250, verbose_name='Contract')),
                ('contract_start_date', models.DateField(verbose_name='Start Date')),
                ('contract_end_date', models.DateField(blank=True, null=True, verbose_name='End Date')),
                ('wage_type', models.CharField(choices=[('daily', 'Daily'), ('monthly', 'Monthly'), ('hourly', 'Hourly')], default='monthly', max_length=250, verbose_name='Wage Type')),
                ('pay_frequency', models.CharField(choices=[('weekly', 'Weekly'), ('monthly', 'Monthly'), ('semi_monthly', 'Semi-Monthly')], default='monthly', max_length=20, null=True, verbose_name='Pay Frequency')),
                ('wage', models.FloatField(default=0, null=True, verbose_name='Basic Salary')),
                ('contract_status', models.CharField(choices=[('draft', 'Draft'), ('active', 'Active'), ('expired', 'Expired'), ('terminated', 'Terminated')], default='draft', max_length=250, verbose_name='Status')),
                ('notice_period_in_days', models.IntegerField(default=30, help_text='Notice period in total days.', validators=[payroll.models.models.min_zero], verbose_name='Notice Period')),
                ('contract_document', models.FileField(blank=True, null=True, upload_to='uploads/')),
                ('deduct_leave_from_basic_pay', models.BooleanField(default=True, help_text='Deduct the leave amount from basic pay.', verbose_name='Deduct From Basic Pay')),
                ('calculate_daily_leave_amount', models.BooleanField(default=True, help_text='Leave amount will be calculated by dividing the basic pay by number of working days.', verbose_name='Calculate Daily Leave Amount')),
                ('deduction_for_one_leave_amount', models.FloatField(blank=True, default=0, null=True, verbose_name='Deduction For One Leave Amount')),
                ('note', models.TextField(blank=True, max_length=255, null=True)),
                ('created_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Created By')),
                ('department', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='contracts', to='base.department', verbose_name='Department')),
                ('employee_id', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='contract_set', to='employee.employee', verbose_name='Employee')),
            ],
        ),
        migrations.CreateModel(
            name='Deduction',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Created At')),
                ('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
                ('title', models.CharField(help_text='Title of the deduction', max_length=255)),
                ('one_time_date', models.DateField(blank=True, help_text='The one-time deduction in which the deduction will apply to the payslips             if the date between the payslip period', null=True)),
                ('include_active_employees', models.BooleanField(default=False, help_text='Target deduction to all active employees in the company', verbose_name='Include all active employees')),
                ('is_tax', models.BooleanField(default=False, help_text='To specify the deduction is tax or normal deduction')),
                ('is_pretax', models.BooleanField(default=True, help_text='To find taxable gross,             taxable_gross = (basic_pay + taxable_deduction)-pre_tax_deductions ')),
                ('is_condition_based', models.BooleanField(default=False, help_text="This field is used to target deduction         to the specific employees when the condition satisfies with the employee's information")),
                ('field', models.CharField(blank=True, choices=[('children', 'Children'), ('marital_status', 'Marital Status'), ('experience', 'Experience'), ('employee_work_info__experience', 'Company Experience'), ('gender', 'Gender'), ('country', 'Country'), ('state', 'State'), ('contract_set__pay_frequency', 'Pay Frequency'), ('contract_set__wage_type', 'Wage Type'), ('contract_set__department__department', 'Department on Contract')], help_text='The related field of the employees', max_length=255, null=True)),
                ('condition', models.CharField(blank=True, choices=[('equal', 'Equal (==)'), ('notequal', 'Not Equal (!=)'), ('lt', 'Less Than (<)'), ('gt', 'Greater Than (>)'), ('le', 'Less Than or Equal To (<=)'), ('ge', 'Greater Than or Equal To (>=)'), ('icontains', 'Contains')], max_length=255, null=True)),
                ('value', models.CharField(blank=True, help_text='The value must be like the data stored in the database', max_length=255, null=True)),
                ('update_compensation', models.CharField(blank=True, choices=[('basic_pay', 'Basic pay'), ('gross_pay', 'Gross Pay'), ('net_pay', 'Net Pay')], help_text='Update compensation is used to update                    pay-head before any other deduction calculation starts', max_length=10, null=True)),
                ('is_fixed', models.BooleanField(default=True, help_text='To specify, the deduction is fixed or not')),
                ('amount', models.FloatField(blank=True, help_text='Fixed amount for this deduction', null=True, validators=[payroll.models.models.min_zero])),
                ('based_on', models.CharField(blank=True, choices=[('basic_pay', 'Basic Pay'), ('gross_pay', 'Gross Pay'), ('taxable_gross_pay', 'Taxable Gross Pay'), ('net_pay', 'Net Pay')], help_text='If the deduction is not fixed then specifies how the deduction provided', max_length=255, null=True)),
                ('rate', models.FloatField(blank=True, default=0.0, help_text='The percentage of based on', null=True, validators=[payroll.models.models.rate_validator], verbose_name='Employee rate')),
                ('employer_rate', models.FloatField(default=0.0, validators=[payroll.models.models.rate_validator])),
                ('has_max_limit', models.BooleanField(default=False, help_text='Limit the deduction', verbose_name='Has max limit for deduction')),
                ('maximum_amount', models.FloatField(blank=True, help_text='The maximum amount for the deduction', null=True, validators=[payroll.models.models.min_zero])),
                ('maximum_unit', models.CharField(choices=[('month_working_days', 'For working days on month')], default='month_working_days', help_text='The maximum amount for ?', max_length=20, null=True)),
                ('if_choice', models.CharField(choices=[('basic_pay', 'Basic Pay'), ('gross_pay', 'Gross Pay')], default='basic_pay', help_text='The pay head for the if condition', max_length=10)),
                ('if_condition', models.CharField(choices=[('equal', 'Equal (==)'), ('notequal', 'Not Equal (!=)'), ('lt', 'Less Than (<)'), ('gt', 'Greater Than (>)'), ('le', 'Less Than or Equal To (<=)'), ('ge', 'Greater Than or Equal To (>=)'), ('range', 'Range')], default='gt', help_text='Apply for those, if the pay-head conditions satisfy', max_length=10)),
                ('if_amount', models.FloatField(default=0.0, help_text='The amount of the pay-head')),
                ('start_range', models.FloatField(blank=True, help_text='The start amount of the pay-head range', null=True)),
                ('end_range', models.FloatField(blank=True, help_text='The end amount of the pay-head range', null=True)),
                ('only_show_under_employee', models.BooleanField(default=False, editable=False)),
                ('is_installment', models.BooleanField(default=False, editable=False)),
                ('company_id', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.PROTECT, to='base.company')),
                ('created_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Created By')),
                ('exclude_employees', models.ManyToManyField(blank=True, help_text='To ignore the deduction to the employees when target them by all employees             or through condition-based', related_name='deduction_exclude', to='employee.employee', verbose_name='Exclude Employees')),
                ('modified_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_modified_by', to=settings.AUTH_USER_MODEL, verbose_name='Modified By')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='EncashmentGeneralSettings',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('bonus_amount', models.IntegerField(default=1)),
                ('leave_amount', models.IntegerField(blank=True, null=True, verbose_name='Amount')),
            ],
        ),
        migrations.CreateModel(
            name='FilingStatus',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Created At')),
                ('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
                ('filing_status', models.CharField(max_length=30, verbose_name='Filing status')),
                ('based_on', models.CharField(choices=[('basic_pay', 'Basic Pay'), ('gross_pay', 'Gross Pay'), ('taxable_gross_pay', 'Taxable Gross Pay')], default='taxable_gross_pay', max_length=255, verbose_name='Based on')),
                ('use_py', models.BooleanField(default=False, verbose_name='Python Code')),
                ('python_code', models.TextField(null=True)),
                ('description', models.TextField(blank=True, max_length=255, verbose_name='Description')),
                ('company_id', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.PROTECT, to='base.company')),
                ('created_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Created By')),
                ('modified_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_modified_by', to=settings.AUTH_USER_MODEL, verbose_name='Modified By')),
            ],
            options={
                'ordering': ['-id'],
            },
        ),
        migrations.CreateModel(
            name='MultipleCondition',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('field', models.CharField(max_length=255)),
                ('condition', models.CharField(blank=True, choices=[('equal', 'Equal (==)'), ('notequal', 'Not Equal (!=)'), ('lt', 'Less Than (<)'), ('gt', 'Greater Than (>)'), ('le', 'Less Than or Equal To (<=)'), ('ge', 'Greater Than or Equal To (>=)'), ('icontains', 'Contains')], max_length=255, null=True)),
                ('value', models.CharField(blank=True, help_text='The value must be like the data stored in the database', max_length=255, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='OverrideAttendance',
            fields=[
                ('attendance_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='attendance.attendance')),
            ],
            options={
                'abstract': False,
            },
            bases=('attendance.attendance',),
        ),
        migrations.CreateModel(
            name='OverrideLeaveRequest',
            fields=[
                ('leaverequest_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='leave.leaverequest')),
            ],
            options={
                'abstract': False,
            },
            bases=('leave.leaverequest',),
        ),
        migrations.CreateModel(
            name='Reimbursement',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Created At')),
                ('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
                ('title', models.CharField(max_length=50)),
                ('type', models.CharField(choices=[('reimbursement', 'Reimbursement'), ('bonus_encashment', 'Bonus Point Encashment'), ('leave_encashment', 'Leave Encashment')], default='reimbursement', max_length=16)),
                ('allowance_on', models.DateField()),
                ('attachment', models.FileField(null=True, upload_to='payroll/reimbursements')),
                ('ad_to_encash', models.FloatField(default=0, help_text='Available Days to encash', verbose_name='Available days')),
                ('cfd_to_encash', models.FloatField(default=0, help_text='Carry Forward Days to encash', verbose_name='Carry forward days')),
                ('bonus_to_encash', models.IntegerField(default=0, help_text='Bonus points to encash', verbose_name='Bonus points')),
                ('amount', models.FloatField(default=0)),
                ('status', models.CharField(choices=[('requested', 'Requested'), ('approved', 'Approved'), ('rejected', 'Rejected')], default='requested', editable=False, max_length=10)),
                ('description', models.TextField(max_length=255, null=True)),
                ('allowance_id', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to='payroll.allowance')),
                ('approved_by', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='approved_by', to='employee.employee')),
                ('created_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Created By')),
                ('employee_id', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='employee.employee', verbose_name='Employee')),
                ('leave_type_id', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='leave.leavetype', verbose_name='Leave type')),
                ('modified_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_modified_by', to=settings.AUTH_USER_MODEL, verbose_name='Modified By')),
            ],
            options={
                'ordering': ['-id'],
            },
        ),
        migrations.CreateModel(
            name='ReimbursementFile',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('file', models.FileField(upload_to='payroll/request_files')),
            ],
        ),
        migrations.CreateModel(
            name='ReimbursementMultipleAttachment',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('attachment', models.FileField(upload_to='payroll/reimbursements')),
            ],
        ),
        migrations.CreateModel(
            name='WorkRecord',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('record_name', models.CharField(blank=True, max_length=250, null=True)),
                ('work_record_type', models.CharField(choices=[('FDP', 'Present'), ('HDP', 'Half Day Present'), ('ABS', 'Absent'), ('HD', 'Holiday/Company Leave'), ('CONF', 'Conflict'), ('DFT', 'Draft')], max_length=5, null=True)),
                ('date', models.DateField(blank=True, null=True)),
                ('at_work', models.CharField(blank=True, default='00:00', max_length=5, null=True, validators=[base.models.validate_time_format])),
                ('min_hour', models.CharField(blank=True, default='00:00', max_length=5, null=True, validators=[base.models.validate_time_format])),
                ('at_work_second', models.IntegerField(blank=True, default=0, null=True)),
                ('min_hour_second', models.IntegerField(blank=True, default=0, null=True)),
                ('note', models.TextField(max_length=255)),
                ('message', models.CharField(blank=True, max_length=30, null=True)),
                ('is_attendance_record', models.BooleanField(default=False)),
                ('is_leave_record', models.BooleanField(default=False)),
                ('day_percentage', models.FloatField(default=0)),
                ('last_update', models.DateTimeField(blank=True, null=True)),
                ('employee_id', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='employee.employee', verbose_name='Employee')),
            ],
        ),
        migrations.CreateModel(
            name='TaxBracket',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Created At')),
                ('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
                ('min_income', models.FloatField(verbose_name='Min. Income')),
                ('max_income', models.FloatField(blank=True, null=True, verbose_name='Max. Income')),
                ('tax_rate', models.FloatField(default=0.0, verbose_name='Tax Rate')),
                ('created_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Created By')),
                ('filing_status_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='payroll.filingstatus', verbose_name='Filing status')),
                ('modified_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_modified_by', to=settings.AUTH_USER_MODEL, verbose_name='Modified By')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='ReimbursementrequestComment',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
                ('comment', models.TextField(max_length=255, null=True, verbose_name='Comment')),
                ('created_at', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Created At')),
                ('created_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Created By')),
                ('employee_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='employee.employee')),
                ('files', models.ManyToManyField(blank=True, to='payroll.reimbursementfile')),
                ('modified_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_modified_by', to=settings.AUTH_USER_MODEL, verbose_name='Modified By')),
                ('request_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='payroll.reimbursement')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='reimbursement',
            name='other_attachments',
            field=models.ManyToManyField(blank=True, editable=False, to='payroll.reimbursementmultipleattachment'),
        ),
        migrations.CreateModel(
            name='PayslipAutoGenerate',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('generate_day', models.CharField(choices=[('last day', 'Last Day'), ('1', '1st'), ('2', '2nd'), ('3', '3rd'), ('4', '4th'), ('5', '5th'), ('6', '6th'), ('7', '7th'), ('8', '8th'), ('9', '9th'), ('10', '10th'), ('11', '11th'), ('12', '12th'), ('13', '13th'), ('14', '14th'), ('15', '15th'), ('16', '16th'), ('17', '17th'), ('18', '18th'), ('19', '19th'), ('20', '20th'), ('21', '21th'), ('22', '22th'), ('23', '23th'), ('24', '24th'), ('25', '25th'), ('26', '26th'), ('27', '27th'), ('28', '28th'), ('29', '29th'), ('30', '30th'), ('31', '31th')], default='1', help_text='On this day of every month,Payslip will auto generate', max_length=30, verbose_name='Payslip Generate Day')),
                ('auto_generate', models.BooleanField(default=False)),
                ('company_id', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='base.company', verbose_name='Company')),
            ],
        ),
        migrations.CreateModel(
            name='Payslip',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Created At')),
                ('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
                ('group_name', models.CharField(blank=True, max_length=50, null=True, verbose_name='Batch name')),
                ('reference', models.CharField(blank=True, max_length=255, null=True)),
                ('start_date', models.DateField()),
                ('end_date', models.DateField()),
                ('pay_head_data', models.JSONField()),
                ('contract_wage', models.FloatField(default=0, null=True)),
                ('basic_pay', models.FloatField(default=0, null=True)),
                ('gross_pay', models.FloatField(default=0, null=True)),
                ('deduction', models.FloatField(default=0, null=True)),
                ('net_pay', models.FloatField(default=0, null=True)),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('review_ongoing', 'Review Ongoing'), ('confirmed', 'Confirmed'), ('paid', 'Paid')], default='draft', max_length=20, null=True)),
                ('sent_to_employee', models.BooleanField(default=False, null=True)),
                ('created_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Created By')),
                ('employee_id', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='employee.employee', verbose_name='Employee')),
                ('installment_ids', models.ManyToManyField(editable=False, to='payroll.deduction')),
                ('modified_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_modified_by', to=settings.AUTH_USER_MODEL, verbose_name='Modified By')),
            ],
            options={
                'ordering': ['-end_date'],
            },
        ),
        migrations.CreateModel(
            name='PayrollSettings',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Created At')),
                ('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
                ('currency_symbol', models.CharField(default='$', max_length=5, null=True)),
                ('position', models.CharField(choices=[('prefix', 'Prefix'), ('postfix', 'Postfix')], default='postfix', max_length=15, null=True)),
                ('company_id', models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='base.company')),
                ('created_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Created By')),
                ('modified_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_modified_by', to=settings.AUTH_USER_MODEL, verbose_name='Modified By')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='PayrollGeneralSetting',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('notice_period', models.IntegerField(default=30, help_text='Notice period in days', validators=[payroll.models.models.min_zero])),
                ('company_id', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='base.company')),
            ],
        ),
        migrations.CreateModel(
            name='LoanAccount',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, null=True, verbose_name='Created At')),
                ('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
                ('type', models.CharField(choices=[('loan', 'Loan'), ('advanced_salary', 'Advanced Salary'), ('fine', 'Penalty / Fine')], default='loan', max_length=15)),
                ('title', models.CharField(max_length=20)),
                ('loan_amount', models.FloatField(default=0, verbose_name='Amount')),
                ('provided_date', models.DateField()),
                ('description', models.TextField(max_length=255, null=True)),
                ('is_fixed', models.BooleanField(default=True, editable=False)),
                ('rate', models.FloatField(default=0, editable=False)),
                ('installment_amount', models.FloatField(blank=True, null=True, verbose_name='installment Amount')),
                ('installments', models.IntegerField(verbose_name='Total installments')),
                ('installment_start_date', models.DateField(help_text='From the start date deduction will apply')),
                ('apply_on', models.CharField(default='end_of_month', editable=False, max_length=20)),
                ('settled', models.BooleanField(default=False)),
                ('settled_date', models.DateTimeField(null=True)),
                ('allowance_id', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to='payroll.allowance')),
                ('asset_id', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.PROTECT, to='asset.asset')),
                ('created_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='Created By')),
                ('deduction_ids', models.ManyToManyField(editable=False, to='payroll.deduction')),
                ('employee_id', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='employee.employee', verbose_name='Employee')),
                ('modified_by', models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_modified_by', to=settings.AUTH_USER_MODEL, verbose_name='Modified By')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='HistoricalPayslip',
            fields=[
                ('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('created_at', models.DateTimeField(blank=True, editable=False, null=True, verbose_name='Created At')),
                ('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
                ('history_title', models.CharField(blank=True, max_length=20, null=True)),
                ('history_description', models.TextField(null=True)),
                ('history_highlight', models.BooleanField(default=False, null=True)),
                ('group_name', models.CharField(blank=True, max_length=50, null=True, verbose_name='Batch name')),
                ('reference', models.CharField(blank=True, max_length=255, null=True)),
                ('start_date', models.DateField()),
                ('end_date', models.DateField()),
                ('pay_head_data', models.JSONField()),
                ('contract_wage', models.FloatField(default=0, null=True)),
                ('basic_pay', models.FloatField(default=0, null=True)),
                ('gross_pay', models.FloatField(default=0, null=True)),
                ('deduction', models.FloatField(default=0, null=True)),
                ('net_pay', models.FloatField(default=0, null=True)),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('review_ongoing', 'Review Ongoing'), ('confirmed', 'Confirmed'), ('paid', 'Paid')], default='draft', max_length=20, null=True)),
                ('sent_to_employee', models.BooleanField(default=False, null=True)),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField(db_index=True)),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('created_by', models.ForeignKey(blank=True, db_constraint=False, editable=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='Created By')),
                ('employee_id', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='employee.employee', verbose_name='Employee')),
                ('history_relation', models.ForeignKey(db_constraint=False, on_delete=django.db.models.deletion.DO_NOTHING, related_name='history_set', to='payroll.payslip')),
                ('history_tags', models.ManyToManyField(to='horilla_audit.audittag')),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('modified_by', models.ForeignKey(blank=True, db_constraint=False, editable=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='Modified By')),
            ],
            options={
                'verbose_name': 'historical payslip',
                'verbose_name_plural': 'historical payslips',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': ('history_date', 'history_id'),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalContract',
            fields=[
                ('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('created_at', models.DateTimeField(blank=True, editable=False, null=True, verbose_name='Created At')),
                ('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
                ('history_title', models.CharField(blank=True, max_length=20, null=True)),
                ('history_description', models.TextField(null=True)),
                ('history_highlight', models.BooleanField(default=False, null=True)),
                ('contract_name', models.CharField(help_text='Contract Title.', max_length=250, verbose_name='Contract')),
                ('contract_start_date', models.DateField(verbose_name='Start Date')),
                ('contract_end_date', models.DateField(blank=True, null=True, verbose_name='End Date')),
                ('wage_type', models.CharField(choices=[('daily', 'Daily'), ('monthly', 'Monthly'), ('hourly', 'Hourly')], default='monthly', max_length=250, verbose_name='Wage Type')),
                ('pay_frequency', models.CharField(choices=[('weekly', 'Weekly'), ('monthly', 'Monthly'), ('semi_monthly', 'Semi-Monthly')], default='monthly', max_length=20, null=True, verbose_name='Pay Frequency')),
                ('wage', models.FloatField(default=0, null=True, verbose_name='Basic Salary')),
                ('contract_status', models.CharField(choices=[('draft', 'Draft'), ('active', 'Active'), ('expired', 'Expired'), ('terminated', 'Terminated')], default='draft', max_length=250, verbose_name='Status')),
                ('notice_period_in_days', models.IntegerField(default=30, help_text='Notice period in total days.', validators=[payroll.models.models.min_zero], verbose_name='Notice Period')),
                ('contract_document', models.TextField(blank=True, max_length=100, null=True)),
                ('deduct_leave_from_basic_pay', models.BooleanField(default=True, help_text='Deduct the leave amount from basic pay.', verbose_name='Deduct From Basic Pay')),
                ('calculate_daily_leave_amount', models.BooleanField(default=True, help_text='Leave amount will be calculated by dividing the basic pay by number of working days.', verbose_name='Calculate Daily Leave Amount')),
                ('deduction_for_one_leave_amount', models.FloatField(blank=True, default=0, null=True, verbose_name='Deduction For One Leave Amount')),
                ('note', models.TextField(blank=True, max_length=255, null=True)),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField(db_index=True)),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('created_by', models.ForeignKey(blank=True, db_constraint=False, editable=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='Created By')),
                ('department', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='base.department', verbose_name='Department')),
                ('employee_id', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='employee.employee', verbose_name='Employee')),
                ('filing_status', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='payroll.filingstatus', verbose_name='Filing Status')),
                ('history_relation', models.ForeignKey(db_constraint=False, on_delete=django.db.models.deletion.DO_NOTHING, related_name='history_set', to='payroll.contract')),
                ('history_tags', models.ManyToManyField(to='horilla_audit.audittag')),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('job_position', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='base.jobposition', verbose_name='Job Position')),
                ('job_role', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='base.jobrole', verbose_name='Job Role')),
                ('modified_by', models.ForeignKey(blank=True, db_constraint=False, editable=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='Modified By')),
                ('shift', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='base.employeeshift', verbose_name='Shift')),
                ('work_type', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='base.worktype', verbose_name='Work Type')),
            ],
            options={
                'verbose_name': 'historical contract',
                'verbose_name_plural': 'historical contracts',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': ('history_date', 'history_id'),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.AddField(
            model_name='deduction',
            name='other_conditions',
            field=models.ManyToManyField(blank=True, editable=False, to='payroll.multiplecondition'),
        ),
        migrations.AddField(
            model_name='deduction',
            name='specific_employees',
            field=models.ManyToManyField(blank=True, help_text='Target deduction to the specific employees', related_name='deduction_specific', to='employee.employee', verbose_name='Employees Specific'),
        ),
        migrations.AddField(
            model_name='contract',
            name='filing_status',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='contracts', to='payroll.filingstatus', verbose_name='Filing Status'),
        ),
        migrations.AddField(
            model_name='contract',
            name='job_position',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='contracts', to='base.jobposition', verbose_name='Job Position'),
        ),
        migrations.AddField(
            model_name='contract',
            name='job_role',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='contracts', to='base.jobrole', verbose_name='Job Role'),
        ),
        migrations.AddField(
            model_name='contract',
            name='modified_by',
            field=models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='%(class)s_modified_by', to=settings.AUTH_USER_MODEL, verbose_name='Modified By'),
        ),
        migrations.AddField(
            model_name='contract',
            name='shift',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='contracts', to='base.employeeshift', verbose_name='Shift'),
        ),
        migrations.AddField(
            model_name='contract',
            name='work_type',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='contracts', to='base.worktype', verbose_name='Work Type'),
        ),
        migrations.AddField(
            model_name='allowance',
            name='other_conditions',
            field=models.ManyToManyField(blank=True, editable=False, to='payroll.multiplecondition'),
        ),
        migrations.AddField(
            model_name='allowance',
            name='shift_id',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='base.employeeshift', verbose_name='Shift'),
        ),
        migrations.AddField(
            model_name='allowance',
            name='specific_employees',
            field=models.ManyToManyField(blank=True, help_text='Target allowance to the specific employees', related_name='allowance_specific', to='employee.employee', verbose_name='Employees Specific'),
        ),
        migrations.AddField(
            model_name='allowance',
            name='work_type_id',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='base.worktype', verbose_name='Work Type'),
        ),
        migrations.AlterUniqueTogether(
            name='contract',
            unique_together={('employee_id', 'contract_start_date', 'contract_end_date')},
        ),
        migrations.AlterUniqueTogether(
            name='allowance',
            unique_together={('title', 'is_taxable', 'is_condition_based', 'field', 'condition', 'value', 'is_fixed', 'amount', 'based_on', 'rate', 'per_attendance_fixed_amount', 'shift_id', 'shift_per_attendance_amount', 'amount_per_one_hr', 'work_type_id', 'work_type_per_attendance_amount')},
        ),
    ]
