# Generated by Django 3.1.4 on 2021-11-12 09:19

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('product', '0029_auto_20211104_1105'),
    ]

    operations = [
        migrations.CreateModel(
            name='ContractType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('company_id', models.IntegerField(verbose_name='企业ID')),
                ('code', models.CharField(blank=True, max_length=10, null=True, verbose_name='编码')),
                ('name', models.CharField(max_length=50, verbose_name='名称')),
            ],
            options={
                'verbose_name': '合同类型',
                'verbose_name_plural': '合同类型',
                'unique_together': {('company_id', 'code')},
            },
        ),
        migrations.CreateModel(
            name='DiscountItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('company_id', models.IntegerField(verbose_name='企业ID')),
                ('code', models.CharField(blank=True, max_length=10, null=True, verbose_name='编码')),
                ('name', models.CharField(max_length=50, verbose_name='名称')),
            ],
            options={
                'verbose_name': '折扣项目',
                'verbose_name_plural': '折扣项目',
            },
        ),
        migrations.CreateModel(
            name='FinaceAccount',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('company_id', models.IntegerField(verbose_name='企业ID')),
                ('financecat', models.SmallIntegerField(choices=[(1, '资产类'), (2, '负债类'), (3, '共同类'), (4, '所有者权益类'), (5, '成本类'), (6, '损益类')], verbose_name='科目分类')),
                ('code', models.CharField(blank=True, max_length=10, null=True, verbose_name='编码')),
                ('name', models.CharField(max_length=30, verbose_name='名称')),
            ],
            options={
                'verbose_name': '会计科目',
                'verbose_name_plural': '会计科目',
                'unique_together': {('company_id', 'code')},
            },
        ),
        migrations.CreateModel(
            name='InvoiceType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('company_id', models.IntegerField(verbose_name='企业ID')),
                ('code', models.CharField(blank=True, max_length=10, null=True, verbose_name='编码')),
                ('name', models.CharField(max_length=50, verbose_name='名称')),
            ],
            options={
                'verbose_name': '发票类别',
                'verbose_name_plural': '发票类别',
                'unique_together': {('company_id', 'code')},
            },
        ),
        migrations.CreateModel(
            name='OrderType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('company_id', models.IntegerField(verbose_name='企业ID')),
                ('code', models.CharField(blank=True, max_length=10, null=True, verbose_name='编码')),
                ('name', models.CharField(max_length=50, verbose_name='名称')),
            ],
            options={
                'verbose_name': '订单类别',
                'verbose_name_plural': '订单类别',
                'unique_together': {('company_id', 'code')},
            },
        ),
        migrations.CreateModel(
            name='SalesOrder',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('company_id', models.IntegerField(verbose_name='企业ID')),
                ('customer_id', models.IntegerField(blank=True, null=True, verbose_name='客户ID')),
                ('customer_name', models.CharField(blank=True, max_length=100, null=True, verbose_name='客户名称')),
                ('code', models.CharField(blank=True, max_length=50, null=True, verbose_name='订单编码')),
                ('delivery_addres', models.CharField(blank=True, max_length=100, null=True, verbose_name='送货地点')),
                ('delivery_method', models.CharField(blank=True, max_length=50, null=True, verbose_name='提货方式')),
                ('delivery_date', models.DateField(blank=True, null=True, verbose_name='期望交货日期')),
                ('invoice_address', models.CharField(blank=True, max_length=50, null=True, verbose_name='收票地址')),
                ('contacts', models.CharField(blank=True, max_length=20, null=True, verbose_name='联系人')),
                ('cellphone', models.CharField(blank=True, max_length=20, null=True, verbose_name='联系电话')),
                ('salesmen', models.JSONField(blank=True, default=list, null=True, verbose_name='销售员')),
                ('dt', models.DateField(auto_now_add=True, verbose_name='日期')),
                ('tm', models.DateTimeField(auto_now_add=True, verbose_name='时间')),
                ('remark', models.CharField(blank=True, max_length=100, null=True, verbose_name='备注说明')),
                ('contracttype', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='erp.contracttype', verbose_name='合同类型')),
                ('invoicetype', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='erp.invoicetype', verbose_name='发票类别')),
                ('ordertype', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='erp.ordertype', verbose_name='订单类别')),
            ],
            options={
                'verbose_name': '销售订单',
                'verbose_name_plural': '销售订单',
                'unique_together': {('company_id', 'code')},
            },
        ),
        migrations.CreateModel(
            name='SalesOrderDetails',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('company_id', models.IntegerField(verbose_name='企业ID')),
                ('product_code', models.CharField(blank=True, max_length=10, null=True, verbose_name='产品编码')),
                ('product_name', models.CharField(max_length=50, verbose_name='产品名称')),
                ('product_aging', models.CharField(blank=True, max_length=20, null=True, verbose_name='产品年份')),
                ('qty', models.IntegerField(verbose_name='数量')),
                ('unit_id', models.IntegerField(blank=True, null=True, verbose_name='计量单位ID')),
                ('unit_name', models.CharField(blank=True, max_length=20, null=True, verbose_name='单位名称')),
                ('tax_rate', models.DecimalField(blank=True, decimal_places=4, max_digits=10, null=True, verbose_name='税率')),
                ('price', models.DecimalField(blank=True, decimal_places=4, max_digits=10, null=True, verbose_name='销售单价')),
                ('price_discount', models.DecimalField(blank=True, decimal_places=4, max_digits=10, null=True, verbose_name='折扣单价')),
                ('price_strategy', models.DecimalField(blank=True, decimal_places=4, max_digits=10, null=True, verbose_name='战略价')),
                ('price_invoice', models.DecimalField(blank=True, decimal_places=4, max_digits=10, null=True, verbose_name='开票单价')),
                ('amt_total', models.DecimalField(blank=True, decimal_places=4, max_digits=14, null=True, verbose_name='总金额')),
                ('amt_invoice', models.DecimalField(blank=True, decimal_places=4, max_digits=14, null=True, verbose_name='开票总金额')),
                ('discountitem_code', models.CharField(blank=True, max_length=20, null=True, verbose_name='折扣项目编码')),
                ('discountitme_name', models.CharField(blank=True, max_length=50, null=True, verbose_name='折扣项目名称')),
                ('financeaccount_code', models.CharField(blank=True, max_length=20, null=True, verbose_name='费用科目名称')),
                ('tm', models.DateTimeField(auto_now_add=True, verbose_name='时间')),
                ('remark', models.CharField(blank=True, max_length=50, null=True, verbose_name='备注说明')),
                ('discountitem', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='erp.discountitem', verbose_name='折扣项目')),
                ('financeaccount', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='erp.finaceaccount', verbose_name='对应财务费用科目')),
                ('ordertype', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='erp.ordertype', verbose_name='订单类别')),
                ('product', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='product.product', verbose_name='对应产品ID')),
                ('salesorder', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='erp.salesorder', verbose_name='销售订单')),
            ],
            options={
                'verbose_name': '销售订单明细',
                'verbose_name_plural': '销售订单明细',
            },
        ),
        migrations.CreateModel(
            name='ObjCls',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('app_name', models.CharField(max_length=30, verbose_name='app名称')),
                ('app_description', models.CharField(blank=True, max_length=50, null=True, verbose_name='app说明')),
                ('model_name', models.CharField(max_length=30, verbose_name='model名称')),
                ('model_description', models.CharField(blank=True, max_length=50, null=True, verbose_name='model说明')),
                ('obj_name', models.CharField(max_length=30, verbose_name='对像名称')),
                ('obj_description', models.CharField(blank=True, max_length=50, null=True, verbose_name='对像说明')),
                ('remark', models.CharField(blank=True, max_length=50, null=True, verbose_name='备注说明')),
            ],
            options={
                'verbose_name': '对像映射表',
                'verbose_name_plural': '对像映射表',
                'unique_together': {('app_name', 'obj_name')},
            },
        ),
        migrations.AddField(
            model_name='discountitem',
            name='objcls',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='erp.objcls', verbose_name='对像映射'),
        ),
        migrations.AlterUniqueTogether(
            name='discountitem',
            unique_together={('company_id', 'code')},
        ),
    ]
