# Generated by Django 2.1.7 on 2020-11-22 11:57

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    dependencies = [
        ('company', '0071_auto_20201120_1548'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('sales', '0082_channelrebateredeemed_bank_receipt'),
    ]

    operations = [
        migrations.CreateModel(
            name='RebateClosing',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50, verbose_name='会计期名称')),
                ('period', models.SmallIntegerField(choices=[(1, '月结'), (2, '季结'), (3, '年结')], verbose_name='期结类型')),
                ('dt_fr', models.DateField(verbose_name='开始日期')),
                ('dt_to', models.DateField(verbose_name='结束日期')),
                ('payable_counting', models.IntegerField(verbose_name='应付帐单笔数')),
                ('payable_amount', models.DecimalField(decimal_places=2, max_digits=12, verbose_name='应付款金额')),
                ('tm_payable_checked', models.DateTimeField(blank=True, null=True, verbose_name='应付款审核时间')),
                ('paid_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True, verbose_name='实际付款金额')),
                ('paid_counting', models.IntegerField(blank=True, null=True, verbose_name='实际付款笔数')),
                ('tm_paid_checked', models.DateTimeField(blank=True, null=True, verbose_name='实际付款审核时间')),
                ('dt', models.DateField(db_index=True, default=django.utils.timezone.now, verbose_name='日期')),
                ('tm', models.DateTimeField(default=django.utils.timezone.now, verbose_name='时间')),
                ('remark', models.CharField(blank=True, max_length=100, null=True, verbose_name='备注说明')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rebateclosing_company', to='company.Company', verbose_name='公司名称')),
                ('paid_checker', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='rebateclosing_checkerpaid', to=settings.AUTH_USER_MODEL, verbose_name='实际付款审核人')),
                ('payable_checker', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='rebateclosing_checkerpayable', to=settings.AUTH_USER_MODEL, verbose_name='应付款审核人')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rebateclosing_user', to=settings.AUTH_USER_MODEL, verbose_name='期结操作人')),
            ],
            options={
                'verbose_name': '促销返利期结',
                'verbose_name_plural': '促销返利期结',
            },
        ),
        migrations.CreateModel(
            name='RebatePaid',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('company_id', models.IntegerField(db_index=True, verbose_name='公司ID')),
                ('agent_name', models.CharField(max_length=100, verbose_name='经销商名称')),
                ('amount', models.DecimalField(decimal_places=2, max_digits=12, verbose_name='已付款金额')),
                ('bank_receipt', models.CharField(blank=True, max_length=50, null=True, verbose_name='银行回单')),
                ('dt', models.DateField(db_index=True, default=django.utils.timezone.now, verbose_name='日期')),
                ('tm', models.DateTimeField(default=django.utils.timezone.now, verbose_name='时间')),
                ('tm_chceked', models.DateTimeField(blank=True, null=True, verbose_name='审核时间')),
                ('remark', models.CharField(blank=True, max_length=100, null=True, verbose_name='备注说明')),
                ('agent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='rebatepaid_agent', to='company.Company', verbose_name='经销商ID')),
                ('rebateclosing', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rebatepaid_closing', to='sales.RebateClosing', verbose_name='会计期')),
            ],
            options={
                'verbose_name': '会计期返利已付款明细',
                'verbose_name_plural': '会计期返利已付款明细',
            },
        ),
        migrations.CreateModel(
            name='RebatePayable',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('company_id', models.IntegerField(db_index=True, verbose_name='公司ID')),
                ('agent_name', models.CharField(max_length=100, verbose_name='经销商名称')),
                ('parent_id', models.IntegerField(verbose_name='上级经销商')),
                ('parent_name', models.CharField(max_length=100, verbose_name='上级经销商名称')),
                ('level_id', models.SmallIntegerField(verbose_name='经销商层级')),
                ('amount', models.DecimalField(decimal_places=2, max_digits=12, verbose_name='应付款金额')),
                ('dt', models.DateField(db_index=True, default=django.utils.timezone.now, verbose_name='日期')),
                ('tm', models.DateTimeField(default=django.utils.timezone.now, verbose_name='时间')),
                ('tm_chceked', models.DateTimeField(blank=True, null=True, verbose_name='审核时间')),
                ('remark', models.CharField(blank=True, max_length=100, null=True, verbose_name='备注说明')),
                ('agent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rebatepayable_agent', to='company.Company', verbose_name='经销商ID')),
                ('rebateclosing', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rebatepayable_closing', to='sales.RebateClosing', verbose_name='会计期')),
            ],
            options={
                'verbose_name': '会计期返利应付款明细',
                'verbose_name_plural': '会计期返利应付款明细',
            },
        ),
        migrations.AddField(
            model_name='channelrebateredeemed',
            name='ancestor_id',
            field=models.IntegerField(default=0, verbose_name='族系'),
            preserve_default=False,
        ),
    ]
