# Generated by Django 3.0.6 on 2020-05-09 09:48

import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('organ', '0001_initial'),
        ('basedata', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='SaleOrder',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('begin', models.DateField(blank=True, null=True, verbose_name='begin date')),
                ('end', models.DateField(blank=True, null=True, verbose_name='end date')),
                ('creator', models.CharField(blank=True, max_length=20, null=True, verbose_name='creator')),
                ('modifier', models.CharField(blank=True, max_length=20, null=True, verbose_name='modifier')),
                ('creation', models.DateTimeField(auto_now_add=True, null=True, verbose_name='creation')),
                ('modification', models.DateTimeField(auto_now=True, null=True, verbose_name='modification')),
                ('code', models.CharField(blank=True, max_length=20, null=True, verbose_name='code')),
                ('order_date', models.DateField(verbose_name='order date')),
                ('deliver_date', models.DateField(verbose_name='deliver date')),
                ('title', models.CharField(max_length=40, verbose_name='title')),
                ('description', models.TextField(blank=True, null=True, verbose_name='memo')),
                ('contact', models.CharField(blank=True, max_length=20, null=True, verbose_name='contacts')),
                ('phone', models.CharField(blank=True, max_length=20, null=True, verbose_name='phone')),
                ('fax', models.CharField(blank=True, max_length=20, null=True, verbose_name='fax')),
                ('deliver_address', models.CharField(blank=True, max_length=120, null=True, verbose_name='deliver address')),
                ('invoice_type', models.CharField(choices=[('10', '普通发票'), ('20', '增值税专用发票'), ('30', '专业发票')], default='10', max_length=6, verbose_name='invoice type')),
                ('amount', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True, verbose_name='money amount')),
                ('discount_amount', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True, verbose_name='discount amount')),
                ('status', models.CharField(choices=[('0', 'NEW'), ('1', 'IN PROGRESS'), ('4', 'DROP'), ('9', 'APPROVED'), ('99', 'ALREADY STOCK OUT')], default='0', max_length=2, verbose_name='status')),
                ('org', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='organ.Organization', verbose_name='organization')),
                ('partner', models.ForeignKey(limit_choices_to={'partner_type': 'C'}, on_delete=django.db.models.deletion.CASCADE, to='basedata.Partner', verbose_name='partner')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='sales man')),
            ],
            options={
                'verbose_name': 'sale order',
                'verbose_name_plural': 'sale order',
            },
        ),
        migrations.CreateModel(
            name='SaleItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('cnt', models.DecimalField(decimal_places=4, max_digits=14, verbose_name='count')),
                ('stock_price', models.DecimalField(blank=True, decimal_places=4, max_digits=14, null=True, verbose_name='stock price')),
                ('sale_price', models.DecimalField(blank=True, decimal_places=4, max_digits=14, null=True, verbose_name='sale price')),
                ('discount_price', models.DecimalField(blank=True, decimal_places=4, max_digits=14, null=True, verbose_name='discount price')),
                ('tax', models.CharField(choices=[('0.00', '0%'), ('0.03', '3%'), ('0.05', '5%'), ('0.07', '7%'), ('0.10', '10%'), ('0.17', '17%')], default='0.00', max_length=6, verbose_name='tax rate')),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='create time')),
                ('status', models.BooleanField(default=0, verbose_name='executed')),
                ('event_time', models.DateTimeField(blank=True, null=True, verbose_name='event time')),
                ('master', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sale.SaleOrder')),
                ('material', models.ForeignKey(blank=True, limit_choices_to={'can_sale': '1', 'is_virtual': '0'}, null=True, on_delete=django.db.models.deletion.CASCADE, to='basedata.Material', verbose_name='material')),
                ('measure', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='basedata.Measure', verbose_name='measure')),
            ],
            options={
                'verbose_name': 'order detail',
                'verbose_name_plural': 'order detail',
            },
        ),
        migrations.CreateModel(
            name='PaymentCollection',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('begin', models.DateField(blank=True, null=True, verbose_name='begin date')),
                ('end', models.DateField(blank=True, null=True, verbose_name='end date')),
                ('creator', models.CharField(blank=True, max_length=20, null=True, verbose_name='creator')),
                ('modifier', models.CharField(blank=True, max_length=20, null=True, verbose_name='modifier')),
                ('creation', models.DateTimeField(auto_now_add=True, null=True, verbose_name='creation')),
                ('modification', models.DateTimeField(auto_now=True, null=True, verbose_name='modification')),
                ('collection_date', models.DateField(blank=True, default=datetime.date.today, null=True, verbose_name='collection date')),
                ('code', models.CharField(blank=True, max_length=20, null=True, verbose_name='collection code')),
                ('order_amount', models.DecimalField(blank=True, decimal_places=4, max_digits=14, null=True, verbose_name='order amount')),
                ('collection_amount', models.DecimalField(decimal_places=4, max_digits=14, verbose_name='collection amount')),
                ('memo', models.TextField(blank=True, null=True, verbose_name='memo')),
                ('bank', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='basedata.BankAccount', verbose_name='bank account')),
                ('org', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='organ.Organization', verbose_name='organization')),
                ('partner', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='basedata.Partner', verbose_name='partner')),
                ('so', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sale.SaleOrder', verbose_name='sale order')),
            ],
            options={
                'verbose_name': 'Payment Collection',
                'verbose_name_plural': 'Payment Collection',
            },
        ),
        migrations.CreateModel(
            name='OfferSheet',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('begin', models.DateField(blank=True, null=True, verbose_name='begin date')),
                ('end', models.DateField(blank=True, null=True, verbose_name='end date')),
                ('creator', models.CharField(blank=True, max_length=20, null=True, verbose_name='creator')),
                ('modifier', models.CharField(blank=True, max_length=20, null=True, verbose_name='modifier')),
                ('creation', models.DateTimeField(auto_now_add=True, null=True, verbose_name='creation')),
                ('modification', models.DateTimeField(auto_now=True, null=True, verbose_name='modification')),
                ('code', models.CharField(blank=True, max_length=20, null=True, verbose_name='code')),
                ('offer_date', models.DateField(verbose_name='offer date')),
                ('deliver_date', models.DateField(verbose_name='deliver date')),
                ('title', models.CharField(max_length=40, verbose_name='title')),
                ('description', models.TextField(blank=True, null=True, verbose_name='memo')),
                ('amount', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True, verbose_name='money amount')),
                ('discount_amount', models.DecimalField(blank=True, decimal_places=2, default=0.0, max_digits=12, null=True, verbose_name='discount amount')),
                ('attach', models.FileField(blank=True, help_text='您可导入报价明细，模板请参考文档FD0006', null=True, upload_to='offer sheet', verbose_name='offer sheet file')),
                ('status', models.BooleanField(default=0, verbose_name='executed')),
                ('event_time', models.DateTimeField(blank=True, null=True, verbose_name='event time')),
                ('org', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='organ.Organization', verbose_name='organization')),
                ('partner', models.ForeignKey(limit_choices_to={'partner_type': 'C'}, on_delete=django.db.models.deletion.CASCADE, to='basedata.Partner', verbose_name='partner')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='offer man')),
            ],
            options={
                'verbose_name': 'offer sheet',
                'verbose_name_plural': 'offer sheet',
            },
        ),
        migrations.CreateModel(
            name='OfferItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('cnt', models.DecimalField(decimal_places=4, max_digits=14, verbose_name='count')),
                ('brand', models.CharField(blank=True, max_length=20, null=True, verbose_name='brand')),
                ('cost_price', models.DecimalField(blank=True, decimal_places=4, max_digits=14, null=True, verbose_name='cost price')),
                ('stock_price', models.DecimalField(blank=True, decimal_places=4, max_digits=14, null=True, verbose_name='stock price')),
                ('sale_price', models.DecimalField(blank=True, decimal_places=4, max_digits=14, null=True, verbose_name='sale price')),
                ('discount_price', models.DecimalField(blank=True, decimal_places=4, max_digits=14, null=True, verbose_name='discount price')),
                ('tax', models.CharField(choices=[('0.00', '0%'), ('0.03', '3%'), ('0.05', '5%'), ('0.07', '7%'), ('0.10', '10%'), ('0.17', '17%')], default='0.00', max_length=6, verbose_name='tax rate')),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='create time')),
                ('status', models.BooleanField(default=0, verbose_name='executed')),
                ('event_time', models.DateTimeField(blank=True, null=True, verbose_name='event time')),
                ('master', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='sale.OfferSheet')),
                ('material', models.ForeignKey(blank=True, limit_choices_to={'can_sale': '1', 'is_virtual': '0'}, null=True, on_delete=django.db.models.deletion.CASCADE, to='basedata.Material', verbose_name='material')),
                ('measure', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='basedata.Measure', verbose_name='measure')),
            ],
            options={
                'verbose_name': 'offer detail',
                'verbose_name_plural': 'offer detail',
            },
        ),
    ]
