# Generated by Django 5.1.4 on 2026-05-25 09:31

import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('finance_and_accounting', '0013_journal_entry_gl_architecture'),
        ('human_resource', '0007_alter_payrollsheet_payroll_sheet_total_commission_value_and_more'),
        ('system_administration', '0004_companysecuritysettings_loginotpchallenge'),
    ]

    operations = [
        migrations.AlterField(
            model_name='accountmapping',
            name='mapping_type',
            field=models.CharField(choices=[('payment_method', 'Payment Method'), ('expense_category', 'Expense Category'), ('deposit_source', 'Deposit Source'), ('tax', 'Tax'), ('invoice_posting', 'Invoice Posting'), ('payment_posting_sale', 'Payment Posting – Sales'), ('payment_posting_expense', 'Payment Posting – Expenses'), ('delivery_posting', 'Delivery / COGS Posting'), ('purchase_posting', 'Purchase Bill Posting'), ('credit_note_posting', 'Credit Note Posting'), ('payroll_posting', 'Payroll Posting')], max_length=30),
        ),
        migrations.CreateModel(
            name='PettyCashFund',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('fund_number', models.CharField(default='', max_length=50, unique=True)),
                ('fund_name', models.CharField(default='', max_length=120)),
                ('imprest_amount', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('current_balance', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('is_active', models.BooleanField(default=True)),
                ('notes', models.TextField(blank=True, default='')),
                ('recycle_bin', models.BooleanField(default=False)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('last_updated_on', models.DateTimeField(auto_now=True)),
                ('timestamp', models.DateTimeField(default=django.utils.timezone.now)),
                ('bank_account', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='petty_cash_replenish_bank_accounts', to='finance_and_accounting.chartofaccount')),
                ('company_branch', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='petty_cash_funds', to='system_administration.companybranch')),
                ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='petty_cash_funds_created', to='human_resource.staffprofile')),
                ('custodian', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='petty_cash_custodian_funds', to='human_resource.staffprofile')),
                ('employee_advances_account', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='employee_advances_fund_accounts', to='finance_and_accounting.chartofaccount')),
                ('petty_cash_account', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='petty_cash_fund_accounts', to='finance_and_accounting.chartofaccount')),
            ],
            options={
                'ordering': ['-id'],
            },
        ),
        migrations.CreateModel(
            name='PettyCashReplenishment',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('replenishment_number', models.CharField(default='', max_length=50, unique=True)),
                ('amount', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('posted', 'Posted')], default='draft', max_length=20)),
                ('replenished_on', models.DateTimeField(blank=True, null=True)),
                ('notes', models.TextField(blank=True, default='')),
                ('timestamp', models.DateTimeField(default=django.utils.timezone.now)),
                ('bank_account', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='petty_cash_replenishments', to='finance_and_accounting.chartofaccount')),
                ('fund', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='replenishments', to='finance_and_accounting.pettycashfund')),
                ('journal_entry', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='petty_cash_replenishment_journals', to='finance_and_accounting.manualjournalentry')),
                ('replenished_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='petty_cash_replenishments', to='human_resource.staffprofile')),
            ],
            options={
                'ordering': ['-id'],
            },
        ),
        migrations.CreateModel(
            name='PettyCashRequest',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('request_number', models.CharField(default='', max_length=50, unique=True)),
                ('purpose', models.TextField(default='')),
                ('amount', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('pending_approval', 'Pending Approval'), ('approved', 'Approved'), ('rejected', 'Rejected'), ('disbursed', 'Disbursed'), ('cancelled', 'Cancelled')], default='draft', max_length=30)),
                ('approved_on', models.DateTimeField(blank=True, null=True)),
                ('rejection_reason', models.TextField(blank=True, default='')),
                ('recycle_bin', models.BooleanField(default=False)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('last_updated_on', models.DateTimeField(auto_now=True)),
                ('timestamp', models.DateTimeField(default=django.utils.timezone.now)),
                ('approved_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='petty_cash_requests_approved', to='human_resource.staffprofile')),
                ('fund', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='requests', to='finance_and_accounting.pettycashfund')),
                ('requested_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='petty_cash_requests', to='human_resource.staffprofile')),
            ],
            options={
                'ordering': ['-id'],
            },
        ),
        migrations.CreateModel(
            name='PettyCashDisbursement',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('disbursement_number', models.CharField(default='', max_length=50, unique=True)),
                ('amount', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('disbursed_on', models.DateTimeField(auto_now_add=True)),
                ('timestamp', models.DateTimeField(default=django.utils.timezone.now)),
                ('disbursed_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='petty_cash_disbursements', to='human_resource.staffprofile')),
                ('journal_entry', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='petty_cash_disbursements', to='finance_and_accounting.manualjournalentry')),
                ('request', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='disbursement', to='finance_and_accounting.pettycashrequest')),
            ],
            options={
                'ordering': ['-id'],
            },
        ),
        migrations.CreateModel(
            name='PettyCashRetirement',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('retirement_number', models.CharField(default='', max_length=50, unique=True)),
                ('retired_amount', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('receipt_reference', models.CharField(blank=True, default='', max_length=120)),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('posted', 'Posted')], default='draft', max_length=20)),
                ('retired_on', models.DateTimeField(blank=True, null=True)),
                ('timestamp', models.DateTimeField(default=django.utils.timezone.now)),
                ('disbursement', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='retirement', to='finance_and_accounting.pettycashdisbursement')),
                ('journal_entry', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='petty_cash_retirements', to='finance_and_accounting.manualjournalentry')),
                ('retired_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='petty_cash_retirements', to='human_resource.staffprofile')),
            ],
            options={
                'ordering': ['-id'],
            },
        ),
        migrations.CreateModel(
            name='PettyCashRetirementLine',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('description', models.CharField(blank=True, default='', max_length=250)),
                ('amount', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('expense_account', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='petty_cash_retirement_lines', to='finance_and_accounting.chartofaccount')),
                ('retirement', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='lines', to='finance_and_accounting.pettycashretirement')),
            ],
        ),
        migrations.CreateModel(
            name='PettyCashReconciliation',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('reconciliation_number', models.CharField(default='', max_length=50, unique=True)),
                ('period_date', models.DateField()),
                ('book_balance', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('physical_count', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('variance', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('status', models.CharField(choices=[('pending', 'Pending'), ('reconciled', 'Reconciled')], default='pending', max_length=20)),
                ('notes', models.TextField(blank=True, default='')),
                ('reconciled_on', models.DateTimeField(blank=True, null=True)),
                ('timestamp', models.DateTimeField(default=django.utils.timezone.now)),
                ('fund', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='reconciliations', to='finance_and_accounting.pettycashfund')),
                ('reconciled_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='petty_cash_reconciliations', to='human_resource.staffprofile')),
            ],
            options={
                'ordering': ['-period_date', '-id'],
                'unique_together': {('fund', 'period_date')},
            },
        ),
    ]
