# Generated by Django 3.0.4 on 2020-07-22 14:07

from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Cliente',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('razon_social', models.CharField(max_length=50)),
                ('sigla', models.CharField(blank=True, default='', max_length=50)),
                ('nit', models.CharField(blank=True, default='', max_length=50)),
                ('direccion', models.CharField(blank=True, default='', max_length=100)),
                ('telefono', models.CharField(blank=True, default='', max_length=50)),
                ('pagina_web', models.CharField(blank=True, default='', max_length=50)),
                ('email_facturacion', models.EmailField(blank=True, default='', max_length=50, verbose_name='Email Facturación')),
                ('observaciones_cm', models.CharField(blank=True, default='', max_length=50, verbose_name='Observación comercial')),
            ],
            options={
                'verbose_name': 'cliente',
                'verbose_name_plural': 'clientes',
            },
        ),
        migrations.CreateModel(
            name='Cotizacion',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('contacto', models.CharField(default='', max_length=25)),
                ('observacion', models.TextField(blank=True, default='')),
                ('fecha', models.DateField(auto_now_add=True)),
                ('fecha_entrega', models.DateField(blank=True, default=None, null=True)),
                ('forma_pago', models.CharField(choices=[('CR', 'Crédito'), ('CO', 'Contado'), ('AC', 'Acordar')], default='AC', max_length=3)),
                ('dias_entrega', models.PositiveIntegerField(default=8, validators=[django.core.validators.MinValueValidator(8)])),
                ('autor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'cotización',
                'verbose_name_plural': 'cotizaciones',
            },
        ),
        migrations.CreateModel(
            name='Equipo',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('denominacion', models.CharField(max_length=20)),
                ('ancho', models.IntegerField(default=0)),
                ('largo', models.IntegerField(default=0)),
                ('distancias', models.CharField(blank=True, max_length=50)),
                ('observacion', models.CharField(blank=True, max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='PrecioMallaCriba',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('referencia', models.CharField(max_length=10)),
                ('hueco_p', models.CharField(max_length=10)),
                ('hueco_mm', models.DecimalField(decimal_places=2, max_digits=5)),
                ('precio_z1', models.IntegerField()),
                ('precio_z2', models.IntegerField()),
                ('precio_z3', models.IntegerField()),
                ('precio_z4', models.IntegerField()),
                ('precio_z5', models.IntegerField()),
                ('precio_z6', models.IntegerField()),
                ('precio_z7', models.IntegerField()),
                ('precio_z8', models.IntegerField()),
                ('tipo_malla', models.CharField(choices=[('TC', 'Trenzada estándar'), ('TR', 'Tr. h. rectangular'), ('TG', 'Tr. tipo guitarra'), ('A', 'Autolimpiante'), ('S', 'Soldada')], default='TC', max_length=3)),
                ('diametro', models.DecimalField(decimal_places=2, max_digits=5)),
            ],
        ),
        migrations.CreateModel(
            name='ZonaComercial',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nombre', models.CharField(max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name='Planta',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('denominacion', models.CharField(blank=True, max_length=50)),
                ('coordenadas', models.CharField(blank=True, max_length=50)),
                ('direccion', models.CharField(blank=True, max_length=50)),
                ('lugar', models.CharField(blank=True, max_length=50)),
                ('observaciones_pn', models.CharField(blank=True, default='', max_length=50, verbose_name='Observación producción')),
                ('cliente', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='gestion.Cliente')),
            ],
            options={
                'verbose_name': 'Planta',
                'verbose_name_plural': 'Plantas',
            },
        ),
        migrations.CreateModel(
            name='Perfil',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('celular', models.CharField(max_length=15)),
                ('prefijo', models.CharField(max_length=3)),
                ('bio', models.TextField()),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='MallaCribaGenerica',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ancho', models.IntegerField(default=0)),
                ('largo', models.IntegerField(default=0)),
                ('mallas_por_tendido', models.IntegerField(default=1)),
                ('tipo_gancho', models.CharField(choices=[('U', 'U'), ('C', 'C'), ('N', 'N'), ('S', 'Sin gancho'), ('I', 'Indefinido')], default='N', max_length=3)),
                ('tipo_enganche', models.CharField(choices=[('N', 'Normal'), ('Z', 'Zeta'), ('S', 'Sin enganche'), ('I', 'Indefinido')], default='N', max_length=3)),
                ('observacion', models.CharField(blank=True, max_length=50)),
                ('equipo', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gestion.Equipo')),
            ],
        ),
        migrations.CreateModel(
            name='ItemMallaCribaHistorico',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('hueco', models.DecimalField(decimal_places=2, max_digits=5)),
                ('diametro', models.DecimalField(decimal_places=2, max_digits=5)),
                ('tipo_malla', models.CharField(choices=[('TC', 'Trenzada estándar'), ('TR', 'Tr. h. rectangular'), ('TG', 'Tr. tipo guitarra'), ('A', 'Autolimpiante'), ('S', 'Soldada')], default='', max_length=3)),
                ('tipo_gancho', models.CharField(choices=[('U', 'U'), ('C', 'C'), ('N', 'N')], default='N', max_length=3)),
                ('ancho', models.IntegerField(default=0)),
                ('largo', models.IntegerField(default=0)),
                ('cantidad', models.IntegerField(default=0)),
                ('no_odp', models.IntegerField(default=0)),
                ('observacion', models.CharField(default='', max_length=64)),
                ('fecha', models.DateField(default=None, null=True)),
                ('malla_generica', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='gestion.MallaCribaGenerica')),
                ('planta', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='gestion.Planta')),
            ],
        ),
        migrations.CreateModel(
            name='ItemMallaCriba',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('material', models.CharField(choices=[('1018', 'Acero 1018'), ('1045', 'Acero 1045'), ('1070', 'Acero 1070')], default='1045', max_length=6)),
                ('ancho', models.IntegerField(default=0)),
                ('largo', models.IntegerField(default=0)),
                ('cantidad', models.IntegerField(default=0)),
                ('cotizacion', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='gestion.Cotizacion')),
                ('malla_generica', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='gestion.MallaCribaGenerica')),
                ('precio', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='gestion.PrecioMallaCriba')),
            ],
            options={
                'verbose_name': 'item malla criba',
                'verbose_name_plural': 'items malla criba',
            },
        ),
        migrations.AddField(
            model_name='equipo',
            name='planta',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gestion.Planta'),
        ),
        migrations.CreateModel(
            name='Departamento',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nombre', models.CharField(max_length=50)),
                ('abreviatura', models.CharField(max_length=4)),
                ('zona', models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='gestion.ZonaComercial')),
            ],
        ),
        migrations.AddField(
            model_name='cotizacion',
            name='planta',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gestion.Planta'),
        ),
        migrations.CreateModel(
            name='Contacto',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nombre', models.CharField(max_length=50, verbose_name='Nombre')),
                ('cargo', models.CharField(max_length=50, verbose_name='Cargo')),
                ('email', models.CharField(max_length=50, verbose_name='E-mail')),
                ('telefono', models.CharField(max_length=50)),
                ('cliente', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='gestion.Cliente', verbose_name='Empresa')),
                ('planta', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='gestion.Planta', verbose_name='Planta')),
            ],
            options={
                'verbose_name': 'Persona de Contacto',
                'verbose_name_plural': 'Personas de Contactos',
            },
        ),
        migrations.AddField(
            model_name='cliente',
            name='departamento',
            field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, to='gestion.Departamento'),
        ),
    ]
