# Generated by Django 3.1.5 on 2021-03-12 18:33

import django.contrib.auth.models
import django.contrib.auth.validators
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0012_alter_user_first_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='MyUserModel',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
                ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
                ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
                ('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
                ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
                ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
                ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
                ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
                ('email', models.EmailField(max_length=254, unique=True)),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
                'abstract': False,
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='COA_Master',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('company_code', models.CharField(blank=True, max_length=5, null=True)),
                ('account_code', models.CharField(max_length=15)),
                ('account_name', models.CharField(max_length=255)),
                ('wk_group_row', models.CharField(blank=True, max_length=10, null=True)),
                ('account_date_create', models.DateTimeField(auto_now_add=True)),
                ('account_date_update', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Company_Master',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('company_code', models.CharField(max_length=5, unique=True)),
                ('company_name', models.CharField(max_length=100, unique=True)),
                ('company_type', models.CharField(choices=[('Parent', 'Parent'), ('Subsidiary', 'Subsidiary'), ('Associate', 'Associate'), ('Investment', 'Investment')], max_length=100)),
                ('parent_company', models.CharField(blank=True, max_length=5, null=True)),
                ('company_est_date', models.DateField()),
                ('country', models.CharField(default='Thailand', max_length=100)),
                ('currency', models.CharField(default='THB', max_length=3)),
                ('consolidation_rate', models.FloatField(default='100')),
                ('company_start_date', models.DateField()),
                ('company_end_date', models.DateField(blank=True, null=True)),
                ('company_date_create', models.DateTimeField(auto_now_add=True)),
                ('company_date_update', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Conso',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('period_code', models.CharField(max_length=7)),
                ('data_source', models.CharField(blank=True, max_length=10, null=True)),
                ('company_code', models.CharField(blank=True, max_length=5, null=True)),
                ('account_code', models.CharField(max_length=15)),
                ('account_name', models.CharField(max_length=255)),
                ('fs_group_row', models.CharField(max_length=10)),
                ('fs_group_name', models.CharField(max_length=255)),
                ('wk_group_row', models.CharField(max_length=10)),
                ('wk_group_name', models.CharField(max_length=255)),
                ('tb_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=15, null=True)),
                ('journal_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=15, null=True)),
                ('rpt_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=15, null=True)),
                ('conso_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=15, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='FS_grouping_Master',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('company_code', models.CharField(blank=True, max_length=5, null=True)),
                ('fs_group_row', models.CharField(max_length=10)),
                ('fs_group_name', models.CharField(max_length=255)),
                ('wk_group_row', models.CharField(max_length=10)),
                ('wk_group_name', models.CharField(max_length=255)),
                ('account_type', models.CharField(choices=[('สินทรัพย์', 'สินทรัพย์'), ('หนี้สิน', 'หนี้สิน'), ('ส่วนของผู้ถือหุ้น', 'ส่วนของผู้ถือหุ้น'), ('รายได้', 'รายได้'), ('ค่าใช้จ่าย', 'ค่าใช้จ่าย')], max_length=255)),
                ('account_subtype', models.CharField(choices=[('สินทรัพย์', 'สินทรัพย์'), ('สินทรัพย์หมุนเวียน', 'สินทรัพย์หมุนเวียน'), ('สินทรัพย์ไม่หมุนเวียน', 'สินทรัพย์ไม่หมุนเวียน'), ('หนี้สิน', 'หนี้สิน'), ('หนี้สินหมุนเวียน', 'หนี้สินหมุนเวียน'), ('หนี้สินไม่หมุนเวียน', 'หนี้สินไม่หมุนเวียน'), ('ส่วนของผู้ถือหุ้น', 'ส่วนของผู้ถือหุ้น'), ('ทุนเรือนหุ้น', 'ทุนเรือนหุ้น'), ('ทุนจดทะเบียน', 'ทุนจดทะเบียน'), ('ทุนที่ออกและชำระแล้ว', 'ทุนที่ออกและชำระแล้ว'), ('ส่วนเกิน (ต่ำกว่า) มูลค่าหุ้น', 'ส่วนเกิน (ต่ำกว่า) มูลค่าหุ้น'), ('กำไร (ขาดทุน) สะสม', 'กำไร (ขาดทุน) สะสม'), ('กำไร (ขาดทุน) สะสม-จัดสรรแล้ว', 'กำไร (ขาดทุน) สะสม-จัดสรรแล้ว'), ('หุ้นกู้ที่มีลักษณะคล้ายทุน', 'หุ้นกู้ที่มีลักษณะคล้ายทุน'), ('รายได้', 'รายได้'), ('ต้นทุน', 'ต้นทุน'), ('ค่าใช้จ่าย', 'ค่าใช้จ่าย'), ('กำไร (ขาดทุน) เบ็ดเสร็จอื่น', 'กำไร (ขาดทุน) เบ็ดเสร็จอื่น')], max_length=255)),
                ('fs_show_status', models.CharField(choices=[('Show', 'Show'), ('No show', 'No show')], default='Show', max_length=10)),
                ('fs_date_create', models.DateTimeField(auto_now_add=True)),
                ('fs_date_update', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Interco_transactions',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('company_code', models.CharField(max_length=5)),
                ('period_code', models.CharField(max_length=7)),
                ('rpt_interco_code', models.CharField(max_length=5)),
                ('account_code', models.CharField(max_length=15)),
                ('rpt_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=15, null=True)),
                ('rpt_date_create', models.DateTimeField(auto_now=True, null=True)),
                ('rpt_file_name', models.CharField(blank=True, max_length=255, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='JournalHeader',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('journal_no', models.CharField(blank=True, max_length=15, null=True)),
                ('period_code', models.CharField(max_length=7)),
                ('Parent_company_code', models.CharField(blank=True, max_length=5, null=True)),
                ('company_code', models.CharField(blank=True, max_length=5, null=True)),
                ('journal_type', models.CharField(blank=True, max_length=255, null=True)),
                ('journal_description', models.CharField(max_length=1000)),
                ('journal_date_create', models.DateTimeField(auto_now_add=True)),
                ('journal_date_update', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Journals',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('journal_no', models.CharField(blank=True, max_length=15, null=True)),
                ('company_code', models.CharField(blank=True, max_length=5, null=True)),
                ('rpt_interco_code', models.CharField(blank=True, max_length=5, null=True)),
                ('account_code', models.CharField(max_length=15)),
                ('account_name', models.CharField(max_length=255)),
                ('debit', models.DecimalField(blank=True, decimal_places=2, max_digits=15, null=True, validators=[django.core.validators.MinValueValidator(0)])),
                ('credit', models.DecimalField(blank=True, decimal_places=2, max_digits=15, null=True, validators=[django.core.validators.MinValueValidator(0)])),
                ('journal_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=15, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Periods',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('company_code', models.CharField(blank=True, max_length=5, null=True)),
                ('period_code', models.CharField(max_length=7)),
                ('period_description', models.CharField(max_length=100)),
                ('period_date_from', models.DateField()),
                ('period_date_to', models.DateField()),
                ('period_status', models.CharField(choices=[('Open', 'Open'), ('Closed', 'Closed'), ('Never Open', 'Never Open')], default='Never Open', max_length=50)),
                ('period_create', models.DateTimeField(auto_now_add=True)),
                ('period_update', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Trial_balance',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('company_code', models.CharField(max_length=5)),
                ('period_code', models.CharField(max_length=7)),
                ('account_code', models.CharField(max_length=15)),
                ('tb_amount', models.DecimalField(blank=True, decimal_places=2, max_digits=15, null=True)),
                ('tb_date_create', models.DateTimeField(auto_now=True, null=True)),
                ('tb_file_name', models.CharField(blank=True, max_length=255, null=True)),
            ],
        ),
        migrations.AddConstraint(
            model_name='periods',
            constraint=models.UniqueConstraint(fields=('company_code', 'period_code'), name='Aconstraint'),
        ),
        migrations.AddConstraint(
            model_name='periods',
            constraint=models.UniqueConstraint(condition=models.Q(period_status='Open'), fields=('company_code', 'period_status'), name='Bconstraint'),
        ),
        migrations.AddField(
            model_name='journals',
            name='JournalHeader',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='Journals', to='iConso.journalheader'),
        ),
        migrations.AddConstraint(
            model_name='fs_grouping_master',
            constraint=models.UniqueConstraint(fields=('company_code', 'wk_group_row'), name='Groupconstraint'),
        ),
        migrations.AddConstraint(
            model_name='coa_master',
            constraint=models.UniqueConstraint(fields=('company_code', 'account_code'), name='COAconstraint'),
        ),
        migrations.AddField(
            model_name='myusermodel',
            name='company_code',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='MyUser', to='iConso.company_master'),
        ),
        migrations.AddField(
            model_name='myusermodel',
            name='groups',
            field=models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups'),
        ),
        migrations.AddField(
            model_name='myusermodel',
            name='user_permissions',
            field=models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions'),
        ),
    ]
