# Generated by Django 5.1.4 on 2026-06-29 07:56

import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('finance_and_accounting', '0016_employee_advance_recovery_terms'),
        ('human_resource', '0011_staffdeductionscheme_overrides'),
        ('procurement', '0002_productpurchaseinstance_input_vat'),
        ('system_administration', '0005_companysmsettings'),
    ]

    operations = [
        migrations.AddField(
            model_name='scheduledpaymentreminder',
            name='last_error',
            field=models.CharField(blank=True, default='', max_length=300),
        ),
        migrations.AlterField(
            model_name='employeeadvance',
            name='recovery_module',
            field=models.CharField(choices=[('full', 'Full Balance'), ('percentage', 'Percentage of Balance'), ('fixed', 'Fixed Installment')], default='fixed', max_length=20),
        ),
        migrations.CreateModel(
            name='BatchPayment',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('batch_number', models.CharField(default='', max_length=50, unique=True)),
                ('payment_date', models.DateField()),
                ('total_amount', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('executed', 'Executed'), ('cancelled', 'Cancelled')], default='draft', max_length=20)),
                ('notes', models.CharField(blank=True, default='', max_length=300)),
                ('executed_on', models.DateTimeField(blank=True, null=True)),
                ('recycle_bin', models.BooleanField(default=False)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('timestamp', models.DateTimeField(default=django.utils.timezone.now)),
                ('company_branch', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='batch_payments', to='system_administration.companybranch')),
                ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='batch_payment_created_by', to='human_resource.staffprofile')),
                ('executed_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='batch_payment_executed_by', to='human_resource.staffprofile')),
                ('journal_entry', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='batch_payments', to='finance_and_accounting.manualjournalentry')),
                ('payable_account', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='batch_payment_payable_accounts', to='finance_and_accounting.chartofaccount')),
                ('source_account', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='batch_payment_source_accounts', to='finance_and_accounting.chartofaccount')),
            ],
            options={
                'ordering': ['-id'],
            },
        ),
        migrations.CreateModel(
            name='BatchPaymentLine',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('supplier_name', models.CharField(blank=True, default='', max_length=200)),
                ('amount', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('wht_amount', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('net_amount', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('reference', models.CharField(blank=True, default='', max_length=120)),
                ('batch_payment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='lines', to='finance_and_accounting.batchpayment')),
                ('purchase_order', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='batch_payment_lines', to='procurement.purchaseorder')),
            ],
        ),
        migrations.CreateModel(
            name='MpesaApiConfig',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('environment', models.CharField(choices=[('sandbox', 'Sandbox'), ('production', 'Production')], default='sandbox', max_length=20)),
                ('consumer_key', models.CharField(blank=True, default='', max_length=200)),
                ('consumer_secret', models.CharField(blank=True, default='', max_length=200)),
                ('short_code', models.CharField(blank=True, default='', max_length=20)),
                ('pass_key', models.CharField(blank=True, default='', max_length=200)),
                ('initiator_name', models.CharField(blank=True, default='', max_length=100)),
                ('security_credential', models.TextField(blank=True, default='')),
                ('is_active', models.BooleanField(default=False)),
                ('last_synced_on', models.DateTimeField(blank=True, null=True)),
                ('updated_on', models.DateTimeField(auto_now=True)),
                ('company_branch', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='mpesa_api_config', to='system_administration.companybranch')),
                ('mpesa_account', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='mpesa_api_accounts', to='finance_and_accounting.chartofaccount')),
                ('updated_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='mpesa_config_updated_by', to='human_resource.staffprofile')),
            ],
        ),
        migrations.CreateModel(
            name='WithholdingTaxEntry',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('tax_type', models.CharField(choices=[('vat_withholding', 'Withholding VAT (2%)'), ('income_withholding', 'Withholding Income Tax')], default='vat_withholding', max_length=30)),
                ('supplier_name', models.CharField(blank=True, default='', max_length=200)),
                ('supplier_pin', models.CharField(blank=True, default='', max_length=30)),
                ('invoice_number', models.CharField(blank=True, default='', max_length=100)),
                ('gross_amount', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('wht_rate', models.DecimalField(decimal_places=2, default=2, max_digits=6)),
                ('wht_amount', models.DecimalField(decimal_places=2, default=0, max_digits=15)),
                ('certificate_number', models.CharField(blank=True, default='', max_length=80)),
                ('period_date', models.DateField()),
                ('status', models.CharField(choices=[('pending', 'Pending Filing'), ('filed', 'Filed')], default='pending', max_length=20)),
                ('notes', models.CharField(blank=True, default='', max_length=300)),
                ('recycle_bin', models.BooleanField(default=False)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('company_branch', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='withholding_tax_entries', to='system_administration.companybranch')),
                ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='withholding_tax_created_by', to='human_resource.staffprofile')),
                ('purchase_order', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='withholding_tax_entries', to='procurement.purchaseorder')),
                ('supplier', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='withholding_tax_entries', to='procurement.supplier')),
                ('vendor_invoice', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='withholding_tax_entries', to='finance_and_accounting.vendorinvoice')),
            ],
            options={
                'ordering': ['-period_date', '-id'],
            },
        ),
    ]
