# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-04-18 16:46
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Categoria',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nombre_categoria', models.CharField(max_length=100, unique=True)),
                ('descripcion', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='Cliente',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('cedula', models.CharField(max_length=13, unique=True)),
                ('nombres', models.CharField(max_length=100)),
                ('apellidos', models.CharField(max_length=100)),
                ('direccion', models.CharField(max_length=200)),
                ('telefono', models.CharField(max_length=10)),
                ('email', models.EmailField(max_length=100)),
            ],
        ),
        migrations.CreateModel(
            name='Compra',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('numCompra', models.IntegerField(default=0, verbose_name='Compra Nro.')),
                ('numFactura', models.IntegerField(default=0, verbose_name='Nro. Factura Proveedor')),
                ('fechaCompra', models.DateField(default=django.utils.timezone.now)),
                ('totalCompra', models.DecimalField(decimal_places=2, default=0, max_digits=6)),
                ('descripcion', models.CharField(default='', max_length=200)),
                ('comprobante', models.ImageField(null=True, upload_to='Comprobantes')),
                ('formaPago', models.CharField(default='CONTADO', max_length=7)),
                ('plazoPago', models.IntegerField(default=0)),
                ('estadoPago', models.CharField(default='REGISTRADO', max_length=10)),
                ('fechaLimite', models.DateField(default=django.utils.timezone.now)),
            ],
        ),
        migrations.CreateModel(
            name='DetalleCompra',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('cantidad', models.IntegerField(default=0)),
            ],
        ),
        migrations.CreateModel(
            name='DetalleFactura',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('cantidad', models.IntegerField(default=1, verbose_name='Cantidad')),
                ('concepto', models.CharField(max_length=100, verbose_name='Concepto')),
                ('valorUnitario', models.DecimalField(decimal_places=2, max_digits=6, verbose_name='Valor Unitario')),
                ('valorTotal', models.DecimalField(decimal_places=2, max_digits=6, verbose_name='Valor Total')),
            ],
        ),
        migrations.CreateModel(
            name='Empresa',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nombre_empresa', models.CharField(max_length=50)),
                ('ruc', models.CharField(max_length=13)),
                ('direccion', models.CharField(max_length=200)),
                ('telefono', models.CharField(max_length=10)),
                ('email', models.EmailField(max_length=100)),
                ('logo', models.ImageField(null=True, upload_to='Logos')),
            ],
        ),
        migrations.CreateModel(
            name='Factura',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('serie', models.IntegerField(default=0)),
                ('numero', models.CharField(max_length=7, unique=True, verbose_name='N\xb0 de Factura')),
                ('tipoPago', models.CharField(choices=[('EFECTIVO', 'EFECTIVO'), ('CR\xc9DITO', 'CR\xc9DITO')], max_length=50)),
                ('pagado', models.BooleanField(default=False)),
                ('fecha', models.DateTimeField(auto_now_add=True)),
                ('subtotal', models.DecimalField(decimal_places=2, default=0, max_digits=6)),
                ('descuento', models.DecimalField(decimal_places=2, default=0, max_digits=6)),
                ('iva0', models.DecimalField(decimal_places=2, default=0, max_digits=6)),
                ('iva12', models.DecimalField(decimal_places=2, default=0, max_digits=6)),
                ('valorTotal', models.DecimalField(decimal_places=2, default=0, max_digits=6)),
                ('cliente', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='Farmacia.Cliente')),
                ('detalleFactura', models.ManyToManyField(to='Farmacia.DetalleFactura')),
            ],
        ),
        migrations.CreateModel(
            name='Pago',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('valorPago', models.DecimalField(decimal_places=2, default=0, max_digits=6)),
                ('fechaPago', models.DateField(default=django.utils.timezone.now)),
                ('compra', models.ForeignKey(default=0, on_delete=django.db.models.deletion.CASCADE, to='Farmacia.Compra')),
            ],
        ),
        migrations.CreateModel(
            name='Presentacion',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('nombre_presentacion', models.CharField(max_length=60, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Producto',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('producto_id', models.CharField(max_length=10, unique=True)),
                ('codigo_producto', models.CharField(max_length=10, unique=True)),
                ('nombre_producto', models.CharField(max_length=100)),
                ('nombre_generico', models.CharField(max_length=100)),
                ('fecha_expiracion', models.DateField()),
                ('fecha_elaboracion', models.DateField()),
                ('detalle_producto', models.TextField()),
                ('stock', models.IntegerField(default=0)),
                ('valor_Compra', models.DecimalField(decimal_places=2, default=0.0, max_digits=5)),
                ('precio_producto', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
                ('valor_venta_cajas', models.DecimalField(decimal_places=2, default=0.0, max_digits=5)),
                ('descuento', models.DecimalField(decimal_places=2, default=0, max_digits=6)),
            ],
        ),
        migrations.CreateModel(
            name='Proveedor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ruc', models.CharField(max_length=13, unique=True)),
                ('distribuidora', models.CharField(max_length=50)),
                ('empresa', models.CharField(max_length=100)),
                ('nombre_responsable', models.CharField(max_length=100)),
                ('direccion', models.CharField(max_length=100)),
                ('telefono_empresa', models.CharField(max_length=10)),
                ('telefono_responsable', models.CharField(max_length=10)),
                ('email', models.EmailField(max_length=50)),
            ],
        ),
        migrations.AddField(
            model_name='producto',
            name='casa_comercial',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='Farmacia.Proveedor'),
        ),
        migrations.AddField(
            model_name='producto',
            name='categoria',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='Farmacia.Categoria'),
        ),
        migrations.AddField(
            model_name='producto',
            name='presentacion',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='Farmacia.Presentacion'),
        ),
        migrations.AddField(
            model_name='detallefactura',
            name='producto',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='Farmacia.Producto'),
        ),
        migrations.AddField(
            model_name='detallecompra',
            name='producto',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='Farmacia.Producto'),
        ),
        migrations.AddField(
            model_name='compra',
            name='detalleCompra',
            field=models.ManyToManyField(to='Farmacia.DetalleCompra'),
        ),
        migrations.AddField(
            model_name='compra',
            name='proveedor',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='Farmacia.Proveedor'),
        ),
        migrations.AlterUniqueTogether(
            name='factura',
            unique_together=set([('serie', 'numero')]),
        ),
    ]
