CARGA
CARGA
This commit is contained in:
0
inventarioalmacen/__init__.py
Normal file
0
inventarioalmacen/__init__.py
Normal file
BIN
inventarioalmacen/__pycache__/__init__.cpython-310.pyc
Normal file
BIN
inventarioalmacen/__pycache__/__init__.cpython-310.pyc
Normal file
Binary file not shown.
BIN
inventarioalmacen/__pycache__/__init__.cpython-39.pyc
Normal file
BIN
inventarioalmacen/__pycache__/__init__.cpython-39.pyc
Normal file
Binary file not shown.
BIN
inventarioalmacen/__pycache__/admin.cpython-310.pyc
Normal file
BIN
inventarioalmacen/__pycache__/admin.cpython-310.pyc
Normal file
Binary file not shown.
BIN
inventarioalmacen/__pycache__/admin.cpython-39.pyc
Normal file
BIN
inventarioalmacen/__pycache__/admin.cpython-39.pyc
Normal file
Binary file not shown.
BIN
inventarioalmacen/__pycache__/apps.cpython-310.pyc
Normal file
BIN
inventarioalmacen/__pycache__/apps.cpython-310.pyc
Normal file
Binary file not shown.
BIN
inventarioalmacen/__pycache__/apps.cpython-39.pyc
Normal file
BIN
inventarioalmacen/__pycache__/apps.cpython-39.pyc
Normal file
Binary file not shown.
BIN
inventarioalmacen/__pycache__/forms.cpython-310.pyc
Normal file
BIN
inventarioalmacen/__pycache__/forms.cpython-310.pyc
Normal file
Binary file not shown.
BIN
inventarioalmacen/__pycache__/forms.cpython-39.pyc
Normal file
BIN
inventarioalmacen/__pycache__/forms.cpython-39.pyc
Normal file
Binary file not shown.
BIN
inventarioalmacen/__pycache__/models.cpython-310.pyc
Normal file
BIN
inventarioalmacen/__pycache__/models.cpython-310.pyc
Normal file
Binary file not shown.
BIN
inventarioalmacen/__pycache__/models.cpython-39.pyc
Normal file
BIN
inventarioalmacen/__pycache__/models.cpython-39.pyc
Normal file
Binary file not shown.
BIN
inventarioalmacen/__pycache__/views.cpython-310.pyc
Normal file
BIN
inventarioalmacen/__pycache__/views.cpython-310.pyc
Normal file
Binary file not shown.
BIN
inventarioalmacen/__pycache__/views.cpython-39.pyc
Normal file
BIN
inventarioalmacen/__pycache__/views.cpython-39.pyc
Normal file
Binary file not shown.
11
inventarioalmacen/admin.py
Normal file
11
inventarioalmacen/admin.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from django.contrib import admin
|
||||
from .models import pieza, equipo, marca, ubicacion, area, rentrada, rsalida
|
||||
|
||||
# Register your models here.
|
||||
admin.site.register(pieza)
|
||||
admin.site.register(equipo)
|
||||
admin.site.register(marca)
|
||||
admin.site.register(ubicacion)
|
||||
admin.site.register(area)
|
||||
admin.site.register(rentrada)
|
||||
admin.site.register(rsalida)
|
||||
6
inventarioalmacen/apps.py
Normal file
6
inventarioalmacen/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class InventarioalmacenConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'inventarioalmacen'
|
||||
44
inventarioalmacen/forms.py
Normal file
44
inventarioalmacen/forms.py
Normal file
@@ -0,0 +1,44 @@
|
||||
from django import forms
|
||||
from .models import pieza, equipo, marca, ubicacion, rentrada, rsalida, area
|
||||
|
||||
|
||||
class Formulariopieza(forms.ModelForm):
|
||||
class Meta:
|
||||
model = pieza
|
||||
fields = ('referencia', 'equipo', 'descripcion_etiqueta', 'descripcion_pieza', 'marca', 'estatus', 'ubicacion', 'cantidad')
|
||||
|
||||
|
||||
class Formularioequipo(forms.ModelForm):
|
||||
class Meta:
|
||||
model = equipo
|
||||
fields = ('nombre',)
|
||||
|
||||
|
||||
class Formulariomarca(forms.ModelForm):
|
||||
class Meta:
|
||||
model = marca
|
||||
fields = ('nombre',)
|
||||
|
||||
|
||||
class Formularioarea(forms.ModelForm):
|
||||
class Meta:
|
||||
model = area
|
||||
fields = ('nombre','ib',)
|
||||
|
||||
|
||||
class Formularioubicacion(forms.ModelForm):
|
||||
class Meta:
|
||||
model = ubicacion
|
||||
fields = ('nombre',)
|
||||
|
||||
|
||||
class Formularioentrada(forms.ModelForm):
|
||||
class Meta:
|
||||
model = rentrada
|
||||
fields = ('n_pedido', 'referencia', 'cantidad')
|
||||
|
||||
|
||||
class Formulariosalida(forms.ModelForm):
|
||||
class Meta:
|
||||
model = rsalida
|
||||
fields = ('referencia', 'cantidad')
|
||||
78
inventarioalmacen/migrations/0001_initial.py
Normal file
78
inventarioalmacen/migrations/0001_initial.py
Normal file
@@ -0,0 +1,78 @@
|
||||
# Generated by Django 3.2.7 on 2021-09-11 09:40
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import tinymce.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='equipo',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('nombre', models.CharField(max_length=200, unique=True, verbose_name='Nombre')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Equipo',
|
||||
'verbose_name_plural': 'Equipos',
|
||||
'ordering': ['nombre'],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='marca',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('nombre', models.CharField(max_length=200, unique=True, verbose_name='Nombre')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Marca',
|
||||
'verbose_name_plural': 'Marcas',
|
||||
'ordering': ['nombre'],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='ubicacion',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('nombre', models.CharField(max_length=200, unique=True, verbose_name='Nombre')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Ubicacion',
|
||||
'verbose_name_plural': 'Ubicacion',
|
||||
'ordering': ['nombre'],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='pieza',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('n_pedido', models.CharField(blank=True, max_length=200, null=True, verbose_name='No. Pedido')),
|
||||
('referencia', models.CharField(max_length=200, unique=True, verbose_name='Referencia')),
|
||||
('descripcion_etiqueta', models.CharField(max_length=250, verbose_name='Descripción de Etiqueta')),
|
||||
('descripcion_pieza', tinymce.models.HTMLField(verbose_name='Descripción de la Pieza')),
|
||||
('estatus', models.CharField(choices=[('Nuevo', 'Nuevo'), ('Usado', 'Usado')], default='Nuevo', max_length=20, verbose_name='Estatus')),
|
||||
('cantidad', models.IntegerField(verbose_name='Cantidad')),
|
||||
('fecha_alta', models.DateField(auto_now_add=True, verbose_name='Fecha alta')),
|
||||
('fecha_actualizacion', models.DateField(auto_now=True, verbose_name='Fecha de Actualización')),
|
||||
('Column1', models.CharField(blank=True, max_length=100, null=True, verbose_name='Column1')),
|
||||
('equipo', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventarioalmacen.equipo', verbose_name='Equipo')),
|
||||
('marca', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventarioalmacen.marca', verbose_name='Marca')),
|
||||
('ubicacion', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventarioalmacen.ubicacion', verbose_name='Ubicacion')),
|
||||
('usuario', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'pieza',
|
||||
'verbose_name_plural': 'piezas',
|
||||
'ordering': ['ubicacion'],
|
||||
},
|
||||
),
|
||||
]
|
||||
23
inventarioalmacen/migrations/0002_auto_20210912_0310.py
Normal file
23
inventarioalmacen/migrations/0002_auto_20210912_0310.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 3.2.7 on 2021-09-12 08:10
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('inventarioalmacen', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='pieza',
|
||||
name='Column1',
|
||||
field=models.CharField(blank=True, default='', max_length=100, null=True, verbose_name='Column1'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pieza',
|
||||
name='n_pedido',
|
||||
field=models.CharField(blank=True, default='', max_length=200, null=True, verbose_name='No. Pedido'),
|
||||
),
|
||||
]
|
||||
23
inventarioalmacen/migrations/0003_auto_20210912_0315.py
Normal file
23
inventarioalmacen/migrations/0003_auto_20210912_0315.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 3.2.7 on 2021-09-12 08:15
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('inventarioalmacen', '0002_auto_20210912_0310'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='pieza',
|
||||
name='Column1',
|
||||
field=models.CharField(blank=True, default=' ', max_length=100, null=True, verbose_name='Column1'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pieza',
|
||||
name='n_pedido',
|
||||
field=models.CharField(blank=True, default=' ', max_length=200, null=True, verbose_name='No. Pedido'),
|
||||
),
|
||||
]
|
||||
47
inventarioalmacen/migrations/0004_rentrada_rsalida.py
Normal file
47
inventarioalmacen/migrations/0004_rentrada_rsalida.py
Normal file
@@ -0,0 +1,47 @@
|
||||
# Generated by Django 3.2.7 on 2021-09-13 07:51
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('inventarioalmacen', '0003_auto_20210912_0315'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='rsalida',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('cantidad', models.IntegerField(verbose_name='Cantidad')),
|
||||
('fecha_alta', models.DateField(auto_now_add=True, verbose_name='Fecha alta')),
|
||||
('referencia', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventarioalmacen.pieza', verbose_name='Referencia')),
|
||||
('usuario', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Salida',
|
||||
'verbose_name_plural': 'Salidas',
|
||||
'ordering': ['-id'],
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='rentrada',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('n_pedido', models.CharField(blank=True, max_length=200, null=True, verbose_name='No. Pedido')),
|
||||
('cantidad', models.IntegerField(verbose_name='Cantidad')),
|
||||
('fecha_alta', models.DateField(auto_now_add=True, verbose_name='Fecha Entrada')),
|
||||
('referencia', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='inventarioalmacen.pieza', verbose_name='Referencia')),
|
||||
('usuario', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Entrada',
|
||||
'verbose_name_plural': 'Entradas',
|
||||
'ordering': ['-id'],
|
||||
},
|
||||
),
|
||||
]
|
||||
18
inventarioalmacen/migrations/0005_rsalida_autor.py
Normal file
18
inventarioalmacen/migrations/0005_rsalida_autor.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.2.7 on 2021-09-13 11:39
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('inventarioalmacen', '0004_rentrada_rsalida'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='rsalida',
|
||||
name='autor',
|
||||
field=models.CharField(blank=True, max_length=250, null=True),
|
||||
),
|
||||
]
|
||||
18
inventarioalmacen/migrations/0006_rentrada_autor.py
Normal file
18
inventarioalmacen/migrations/0006_rentrada_autor.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.2.7 on 2021-09-13 12:04
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('inventarioalmacen', '0005_rsalida_autor'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='rentrada',
|
||||
name='autor',
|
||||
field=models.CharField(blank=True, max_length=250, null=True),
|
||||
),
|
||||
]
|
||||
25
inventarioalmacen/migrations/0007_area.py
Normal file
25
inventarioalmacen/migrations/0007_area.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Generated by Django 3.2.7 on 2021-10-06 12:24
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('inventarioalmacen', '0006_rentrada_autor'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='area',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('nombre', models.CharField(max_length=200, unique=True, verbose_name='Nombre')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Area',
|
||||
'verbose_name_plural': 'Areas',
|
||||
'ordering': ['nombre'],
|
||||
},
|
||||
),
|
||||
]
|
||||
17
inventarioalmacen/migrations/0008_alter_equipo_options.py
Normal file
17
inventarioalmacen/migrations/0008_alter_equipo_options.py
Normal file
@@ -0,0 +1,17 @@
|
||||
# Generated by Django 3.2.7 on 2021-10-08 10:08
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('inventarioalmacen', '0007_area'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='equipo',
|
||||
options={'ordering': ['nombre'], 'verbose_name': 'Tipo de Equipo', 'verbose_name_plural': 'Tipo de Equipos'},
|
||||
),
|
||||
]
|
||||
21
inventarioalmacen/migrations/0009_area_ib.py
Normal file
21
inventarioalmacen/migrations/0009_area_ib.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# Generated by Django 3.2.7 on 2021-10-10 07:03
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('inventarioalmacen', '0008_alter_equipo_options'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='area',
|
||||
name='ib',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Asignado IB'),
|
||||
),
|
||||
]
|
||||
21
inventarioalmacen/migrations/0010_auto_20211020_0520.py
Normal file
21
inventarioalmacen/migrations/0010_auto_20211020_0520.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# Generated by Django 3.2.8 on 2021-10-20 10:20
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('inventarioalmacen', '0009_area_ib'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='rentrada',
|
||||
options={'ordering': ['referencia'], 'verbose_name': 'Entrada', 'verbose_name_plural': 'Entradas'},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='rsalida',
|
||||
options={'ordering': ['id'], 'verbose_name': 'Salida', 'verbose_name_plural': 'Salidas'},
|
||||
),
|
||||
]
|
||||
18
inventarioalmacen/migrations/0011_alter_pieza_cantidad.py
Normal file
18
inventarioalmacen/migrations/0011_alter_pieza_cantidad.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.2.8 on 2021-10-25 15:28
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('inventarioalmacen', '0010_auto_20211020_0520'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='pieza',
|
||||
name='cantidad',
|
||||
field=models.IntegerField(blank=True, null=True, verbose_name='Cantidad'),
|
||||
),
|
||||
]
|
||||
18
inventarioalmacen/migrations/0012_alter_pieza_cantidad.py
Normal file
18
inventarioalmacen/migrations/0012_alter_pieza_cantidad.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.2.7 on 2021-10-25 19:17
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('inventarioalmacen', '0011_alter_pieza_cantidad'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='pieza',
|
||||
name='cantidad',
|
||||
field=models.IntegerField(blank=True, default=0, null=True, verbose_name='Cantidad'),
|
||||
),
|
||||
]
|
||||
21
inventarioalmacen/migrations/0013_auto_20211103_2233.py
Normal file
21
inventarioalmacen/migrations/0013_auto_20211103_2233.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# Generated by Django 3.2.8 on 2021-11-04 04:33
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('inventarioalmacen', '0012_alter_pieza_cantidad'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='rentrada',
|
||||
options={'ordering': ['-id'], 'verbose_name': 'Entrada', 'verbose_name_plural': 'Entradas'},
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='rsalida',
|
||||
options={'ordering': ['-id'], 'verbose_name': 'Salida', 'verbose_name_plural': 'Salidas'},
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,39 @@
|
||||
# Generated by Django 4.0.5 on 2022-07-09 07:18
|
||||
|
||||
from django.db import migrations, models
|
||||
import tinymce.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('inventarioalmacen', '0013_auto_20211103_2233'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='area',
|
||||
name='nombre',
|
||||
field=models.CharField(max_length=250, unique=True, verbose_name='Nombre'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='equipo',
|
||||
name='nombre',
|
||||
field=models.CharField(max_length=250, unique=True, verbose_name='Nombre'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='marca',
|
||||
name='nombre',
|
||||
field=models.CharField(max_length=250, unique=True, verbose_name='Nombre'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pieza',
|
||||
name='descripcion_etiqueta',
|
||||
field=tinymce.models.HTMLField(null=True, verbose_name='Descripción de Etiqueta'),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='pieza',
|
||||
name='descripcion_pieza',
|
||||
field=tinymce.models.HTMLField(null=True, verbose_name='Descripción de la Pieza'),
|
||||
),
|
||||
]
|
||||
0
inventarioalmacen/migrations/__init__.py
Normal file
0
inventarioalmacen/migrations/__init__.py
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
inventarioalmacen/migrations/__pycache__/__init__.cpython-39.pyc
Normal file
BIN
inventarioalmacen/migrations/__pycache__/__init__.cpython-39.pyc
Normal file
Binary file not shown.
118
inventarioalmacen/models.py
Normal file
118
inventarioalmacen/models.py
Normal file
@@ -0,0 +1,118 @@
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
import os
|
||||
from tinymce import models as tinymce_models
|
||||
from model_utils import Choices
|
||||
|
||||
# Create your models here.
|
||||
class area(models.Model):
|
||||
nombre = models.CharField(max_length=250, null=False, unique=True, verbose_name='Nombre')
|
||||
ib = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True, verbose_name='Asignado IB')
|
||||
def __str__(self):
|
||||
return self.nombre
|
||||
|
||||
class Meta:
|
||||
verbose_name = 'Area'
|
||||
verbose_name_plural = 'Areas'
|
||||
ordering = ['nombre']
|
||||
|
||||
|
||||
class equipo(models.Model):
|
||||
nombre = models.CharField(max_length=250, null=False, unique=True, verbose_name='Nombre')
|
||||
def __str__(self):
|
||||
return self.nombre
|
||||
|
||||
class Meta:
|
||||
verbose_name = 'Tipo de Equipo'
|
||||
verbose_name_plural = 'Tipo de Equipos'
|
||||
ordering = ['nombre']
|
||||
|
||||
|
||||
class marca(models.Model):
|
||||
nombre = models.CharField(max_length=250, null=False, unique=True, verbose_name='Nombre')
|
||||
def __str__(self):
|
||||
return self.nombre
|
||||
|
||||
class Meta:
|
||||
verbose_name = 'Marca'
|
||||
verbose_name_plural = 'Marcas'
|
||||
ordering = ['nombre']
|
||||
|
||||
|
||||
class ubicacion(models.Model):
|
||||
nombre = models.CharField(max_length=200, null=False, unique=True, verbose_name='Nombre')
|
||||
def __str__(self):
|
||||
return self.nombre
|
||||
|
||||
class Meta:
|
||||
verbose_name = 'Ubicacion'
|
||||
verbose_name_plural = 'Ubicacion'
|
||||
ordering = ['nombre']
|
||||
|
||||
|
||||
class pieza(models.Model):
|
||||
STATUS = Choices('Nuevo', 'Usado')
|
||||
usuario = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True)
|
||||
n_pedido = models.CharField(max_length=200, null=True, blank=True, verbose_name='No. Pedido', default=' ')
|
||||
referencia = models.CharField(max_length=200, unique=True, null=False, verbose_name='Referencia')
|
||||
equipo = models.ForeignKey(equipo, on_delete=models.CASCADE, null=False, blank=False, verbose_name='Equipo')
|
||||
descripcion_etiqueta = tinymce_models.HTMLField(null=True, verbose_name='Descripción de Etiqueta')
|
||||
descripcion_pieza = tinymce_models.HTMLField(null=True, verbose_name='Descripción de la Pieza')
|
||||
marca = models.ForeignKey(marca, on_delete=models.CASCADE, null=False, blank=False, verbose_name='Marca')
|
||||
estatus = models.CharField(choices=STATUS, default=STATUS.Nuevo, max_length=20, verbose_name='Estatus')
|
||||
ubicacion = models.ForeignKey(ubicacion, on_delete=models.CASCADE, null=False, blank=False, verbose_name='Ubicacion')
|
||||
cantidad = models.IntegerField(null=True, blank=True, default=0, verbose_name='Cantidad')
|
||||
fecha_alta = models.DateField(auto_now_add=True, verbose_name='Fecha alta')
|
||||
fecha_actualizacion = models.DateField(auto_now=True, verbose_name='Fecha de Actualización')
|
||||
Column1 = models.CharField(max_length=100, null=True, blank=True, verbose_name='Column1', default=' ')
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
if os.path.isfile(self.imagen.path):
|
||||
os.remove(self.imagen.path)
|
||||
super(pieza, self).delete(*args, **kwargs)
|
||||
|
||||
def __str__(self):
|
||||
return self.referencia
|
||||
|
||||
class Meta:
|
||||
verbose_name = 'pieza'
|
||||
verbose_name_plural = 'piezas'
|
||||
ordering = ['ubicacion']
|
||||
|
||||
|
||||
class rentrada(models.Model):
|
||||
usuario = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True)
|
||||
autor = models.CharField(max_length=250, null=True, blank=True)
|
||||
n_pedido = models.CharField(max_length=200, null=True, blank=True, verbose_name='No. Pedido')
|
||||
referencia = models.ForeignKey(pieza, on_delete=models.CASCADE, null=False, blank=False, verbose_name='Referencia')
|
||||
cantidad = models.IntegerField(verbose_name='Cantidad')
|
||||
fecha_alta = models.DateField(auto_now_add=True, verbose_name='Fecha Entrada')
|
||||
|
||||
def __str__(self):
|
||||
return self.referencia
|
||||
|
||||
class Meta:
|
||||
verbose_name = 'Entrada'
|
||||
verbose_name_plural = 'Entradas'
|
||||
ordering = ['-id']
|
||||
|
||||
|
||||
class rsalida(models.Model):
|
||||
usuario = models.ForeignKey(User, on_delete=models.CASCADE, null=True, blank=True)
|
||||
autor = models.CharField(max_length=250, null=True, blank=True)
|
||||
referencia = models.ForeignKey(pieza, on_delete=models.CASCADE, null=False, blank=False, verbose_name='Referencia')
|
||||
cantidad = models.IntegerField(verbose_name='Cantidad')
|
||||
fecha_alta = models.DateField(auto_now_add=True, verbose_name='Fecha alta')
|
||||
|
||||
def delete(self, *args, **kwargs):
|
||||
if os.path.isfile(self.imagen.path):
|
||||
os.remove(self.imagen.path)
|
||||
super(pieza, self).delete(*args, **kwargs)
|
||||
|
||||
def __str__(self):
|
||||
return self.referencia
|
||||
|
||||
class Meta:
|
||||
verbose_name = 'Salida'
|
||||
verbose_name_plural = 'Salidas'
|
||||
ordering = ['-id']
|
||||
3
inventarioalmacen/tests.py
Normal file
3
inventarioalmacen/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
446
inventarioalmacen/views.py
Normal file
446
inventarioalmacen/views.py
Normal file
@@ -0,0 +1,446 @@
|
||||
from django.shortcuts import render, redirect, get_object_or_404
|
||||
from .forms import Formulariopieza, Formularioequipo, Formulariomarca, Formularioubicacion, Formularioentrada, Formulariosalida, Formularioarea
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from .models import pieza, rentrada, rsalida, equipo, marca, ubicacion
|
||||
from openpyxl import Workbook
|
||||
from django.http.response import HttpResponse
|
||||
import datetime
|
||||
from datetime import date
|
||||
|
||||
|
||||
# Create your views here.
|
||||
def invalmacen(request):
|
||||
datos = pieza.objects.all()
|
||||
return render(request, 'tables.html', {"datos": datos})
|
||||
|
||||
|
||||
@login_required(login_url='/acceder')
|
||||
def crear_pieza(request):
|
||||
if request.method == "POST":
|
||||
form = Formulariopieza(request.POST)
|
||||
if form.is_valid():
|
||||
post = form.save(commit=False)
|
||||
post.save()
|
||||
titulo = form.cleaned_data.get("referencia")
|
||||
messages.success(request, f"La referencia {titulo} se ha creado correctamente")
|
||||
return redirect("invalmacen")
|
||||
else:
|
||||
for field, items in form.errors.items():
|
||||
for item in items:
|
||||
messages.error(request, '{}: {}'.format(field, item))
|
||||
|
||||
datosequipo = equipo.objects.all()
|
||||
datosmarca = marca.objects.all()
|
||||
datosubicacion = ubicacion.objects.all()
|
||||
form = Formulariopieza()
|
||||
return render(request, "crear_pieza.html", {"form": form, "datosequipo": datosequipo, "datosmarca": datosmarca, "datosubicacion": datosubicacion})
|
||||
|
||||
|
||||
@login_required(login_url='/acceder')
|
||||
def ActualizarPieza(request, pieza_id):
|
||||
instance= get_object_or_404(pieza, pk=pieza_id)
|
||||
form = Formulariopieza(request.POST or None, instance=instance)
|
||||
context= {'form': form}
|
||||
if form.is_valid():
|
||||
obj= form.save(commit= False)
|
||||
obj.save()
|
||||
messages.success(request, "La pieza fue actualizada")
|
||||
return redirect("invalmacen")
|
||||
|
||||
else:
|
||||
context= {'form': form, 'error': 'Error al actualizar'}
|
||||
return render(request,'actualizar_pieza.html' , context)
|
||||
|
||||
|
||||
############################################
|
||||
@login_required(login_url='/acceder')
|
||||
def crear_equipo(request):
|
||||
if request.method == "POST":
|
||||
form = Formularioequipo(request.POST)
|
||||
if form.is_valid():
|
||||
post = form.save(commit=False)
|
||||
post.save()
|
||||
titulo = form.cleaned_data.get("nombre")
|
||||
messages.success(request, f"El equipo {titulo} se ha creado correctamente")
|
||||
return redirect("crear_pieza")
|
||||
else:
|
||||
for field, items in form.errors.items():
|
||||
for item in items:
|
||||
messages.error(request, '{}: {}'.format(field, item))
|
||||
|
||||
form = Formularioequipo()
|
||||
return render(request, "crearequipo.html", {"form": form})
|
||||
|
||||
|
||||
@login_required(login_url='/acceder')
|
||||
def crear_marca(request):
|
||||
if request.method == "POST":
|
||||
form = Formulariomarca(request.POST)
|
||||
if form.is_valid():
|
||||
post = form.save(commit=False)
|
||||
post.save()
|
||||
titulo = form.cleaned_data.get("nombre")
|
||||
messages.success(request, f"La marca {titulo} se ha creado correctamente")
|
||||
return redirect("crear_pieza")
|
||||
else:
|
||||
for field, items in form.errors.items():
|
||||
for item in items:
|
||||
messages.error(request, '{}: {}'.format(field, item))
|
||||
|
||||
form = Formulariomarca()
|
||||
return render(request, "crearmarca.html", {"form": form})
|
||||
|
||||
|
||||
@login_required(login_url='/acceder')
|
||||
def crear_ubicacion(request):
|
||||
if request.method == "POST":
|
||||
form = Formularioubicacion(request.POST)
|
||||
if form.is_valid():
|
||||
post = form.save(commit=False)
|
||||
post.save()
|
||||
titulo = form.cleaned_data.get("nombre")
|
||||
messages.success(request, f"La ubicacion {titulo} se ha creado correctamente")
|
||||
return redirect("crear_pieza")
|
||||
else:
|
||||
for field, items in form.errors.items():
|
||||
for item in items:
|
||||
messages.error(request, '{}: {}'.format(field, item))
|
||||
|
||||
form = Formularioubicacion()
|
||||
return render(request, "crearubicacion.html", {"form": form})
|
||||
|
||||
|
||||
@login_required(login_url='/acceder')
|
||||
def crear_area(request):
|
||||
if request.method == "POST":
|
||||
form = Formularioarea(request.POST)
|
||||
if form.is_valid():
|
||||
post = form.save(commit=False)
|
||||
post.save()
|
||||
titulo = form.cleaned_data.get("nombre")
|
||||
messages.success(request, f"El area {titulo} se ha creado correctamente")
|
||||
return redirect("crear_inventrada")
|
||||
else:
|
||||
for field, items in form.errors.items():
|
||||
for item in items:
|
||||
messages.error(request, '{}: {}'.format(field, item))
|
||||
|
||||
form = Formularioarea()
|
||||
return render(request, "crear_area.html", {"form": form})
|
||||
|
||||
|
||||
############################################################
|
||||
def invalmacenentrada(request):
|
||||
datos = rentrada.objects.all()
|
||||
return render(request, 'invrentrada.html', {"datos": datos})
|
||||
|
||||
|
||||
@login_required(login_url='/acceder')
|
||||
def crear_inventrada(request, id):
|
||||
if request.method == "POST":
|
||||
form = Formularioentrada(request.POST)
|
||||
if form.is_valid():
|
||||
post = form.save(commit=False)
|
||||
post.autor = request.user
|
||||
post.save()
|
||||
titulo = form.cleaned_data.get("referencia")
|
||||
refex = form.cleaned_data.get("referencia")
|
||||
y = form.cleaned_data.get("cantidad")
|
||||
x = pieza.objects.only('referencia').filter(referencia=refex)[0]
|
||||
nuevo = x.cantidad + y
|
||||
dateact = date.today()
|
||||
update = pieza.objects.values('cantidad').filter(referencia=refex).update(cantidad=nuevo)
|
||||
update = pieza.objects.values('fecha_actualizacion').filter(referencia=refex).update(fecha_actualizacion=dateact)
|
||||
messages.success(request, f"La entrada con referencia {titulo} se ha creado correctamente")
|
||||
return redirect("invalmacen")
|
||||
else:
|
||||
for field, items in form.errors.items():
|
||||
for item in items:
|
||||
messages.error(request, '{}: {}'.format(field, item))
|
||||
|
||||
datos = pieza.objects.get(id=id)
|
||||
return render(request, "crearinventrada.html", {"datos": datos})
|
||||
|
||||
|
||||
|
||||
def invalmacensalida(request):
|
||||
datos = rsalida.objects.all()
|
||||
return render(request, 'invrsalida.html', {"datos": datos})
|
||||
|
||||
|
||||
@login_required(login_url='/acceder')
|
||||
def crear_invsalida(request, id):
|
||||
if request.method == "POST":
|
||||
form = Formulariosalida(request.POST)
|
||||
if form.is_valid():
|
||||
post = form.save(commit=False)
|
||||
post.autor = request.user
|
||||
post.save()
|
||||
titulo = form.cleaned_data.get("referencia")
|
||||
refex = form.cleaned_data.get("referencia")
|
||||
y = form.cleaned_data.get("cantidad")
|
||||
x = pieza.objects.only('referencia').filter(referencia=refex)[0]
|
||||
nuevo = x.cantidad - y
|
||||
dateact = date.today()
|
||||
update = pieza.objects.values('cantidad').filter(referencia=refex).update(cantidad=nuevo)
|
||||
update = pieza.objects.values('fecha_actualizacion').filter(referencia=refex).update(fecha_actualizacion=dateact)
|
||||
messages.success(request, f"La salida {titulo} se ha creado correctamente")
|
||||
return redirect("invalmacen")
|
||||
else:
|
||||
for field, items in form.errors.items():
|
||||
for item in items:
|
||||
messages.error(request, '{}: {}'.format(field, item))
|
||||
|
||||
datos = pieza.objects.get(referencia=id)
|
||||
return render(request, "crearinvsalida.html", {"datos": datos})
|
||||
|
||||
##Busqueda####################################################################
|
||||
|
||||
@login_required(login_url='/acceder')
|
||||
def buscar(request):
|
||||
if request.method == "POST":
|
||||
datospieza = request.POST['referencia']
|
||||
datosequipo = request.POST['equipo']
|
||||
datosmarca = request.POST['marca']
|
||||
datosubicacion = request.POST['ubicacion']
|
||||
datosbuscar = request.POST['buscar']
|
||||
if datospieza == "" and datosequipo == "Selecciona un Equipo" and datosmarca == "Selecciona una Marca" and datosubicacion == "Selecciona una Ubicacion" and datosbuscar == "" :
|
||||
xdatospieza = pieza.objects.all()
|
||||
xdatosequipo = equipo.objects.all()
|
||||
xdatosmarca = marca.objects.all()
|
||||
xdatosubicacion = ubicacion.objects.all()
|
||||
datos = pieza.objects.all()
|
||||
return render(request, "buscar.html", {"datos": datos, "datospieza": xdatospieza, "datosequipo": xdatosequipo, "datosmarca": xdatosmarca, "datosubicacion": xdatosubicacion})
|
||||
elif datospieza == "" and datosequipo == "Selecciona un Equipo" and datosmarca == "Selecciona una Marca" and datosubicacion == "Selecciona una Ubicacion" :
|
||||
xdatospieza = pieza.objects.all()
|
||||
xdatosequipo = equipo.objects.all()
|
||||
xdatosmarca = marca.objects.all()
|
||||
xdatosubicacion = ubicacion.objects.all()
|
||||
datos = pieza.objects.filter(descripcion_pieza__icontains=datosbuscar)
|
||||
return render(request, "buscar.html", {"datos": datos, "datospieza": xdatospieza, "datosequipo": xdatosequipo, "datosmarca": xdatosmarca, "datosubicacion": xdatosubicacion})
|
||||
elif datosequipo == "Selecciona un Equipo" and datosmarca == "Selecciona una Marca" and datosubicacion == "Selecciona una Ubicacion" and datosbuscar == "" :
|
||||
xdatospieza = pieza.objects.all()
|
||||
xdatosequipo = equipo.objects.all()
|
||||
xdatosmarca = marca.objects.all()
|
||||
xdatosubicacion = ubicacion.objects.all()
|
||||
datos = pieza.objects.filter(referencia__icontains=datospieza)
|
||||
return render(request, "buscar.html", {"datos": datos, "datospieza": xdatospieza, "datosequipo": xdatosequipo, "datosmarca": xdatosmarca, "datosubicacion": xdatosubicacion})
|
||||
elif datospieza == "" and datosmarca == "Selecciona una Marca" and datosubicacion == "Selecciona una Ubicacion" and datosbuscar == "" :
|
||||
xdatospieza = pieza.objects.all()
|
||||
xdatosequipo = equipo.objects.all()
|
||||
xdatosmarca = marca.objects.all()
|
||||
xdatosubicacion = ubicacion.objects.all()
|
||||
datos = pieza.objects.filter(equipo_id=datosequipo)
|
||||
return render(request, "buscar.html", {"datos": datos, "datospieza": xdatospieza, "datosequipo": xdatosequipo, "datosmarca": xdatosmarca, "datosubicacion": xdatosubicacion})
|
||||
elif datosequipo == "Selecciona un Equipo" and datospieza == "" and datosubicacion == "Selecciona una Ubicacion" and datosbuscar == "" :
|
||||
xdatospieza = pieza.objects.all()
|
||||
xdatosequipo = equipo.objects.all()
|
||||
xdatosmarca = marca.objects.all()
|
||||
xdatosubicacion = ubicacion.objects.all()
|
||||
datos = pieza.objects.filter(marca_id=datosmarca)
|
||||
return render(request, "buscar.html", {"datos": datos, "datospieza": xdatospieza, "datosequipo": xdatosequipo, "datosmarca": xdatosmarca, "datosubicacion": xdatosubicacion})
|
||||
elif datosequipo == "Selecciona un Equipo" and datosmarca == "Selecciona una Marca" and datospieza == "" and datosbuscar == "" :
|
||||
xdatospieza = pieza.objects.all()
|
||||
xdatosequipo = equipo.objects.all()
|
||||
xdatosmarca = marca.objects.all()
|
||||
xdatosubicacion = ubicacion.objects.all()
|
||||
datos = pieza.objects.filter(ubicacion_id=datosubicacion)
|
||||
return render(request, "buscar.html", {"datos": datos, "datospieza": xdatospieza, "datosequipo": xdatosequipo, "datosmarca": xdatosmarca, "datosubicacion": xdatosubicacion})
|
||||
elif datospieza == "" and datosubicacion == "Selecciona una Ubicacion" and datosbuscar == "" :
|
||||
xdatospieza = pieza.objects.all()
|
||||
xdatosequipo = equipo.objects.all()
|
||||
xdatosmarca = marca.objects.all()
|
||||
xdatosubicacion = ubicacion.objects.all()
|
||||
datos = pieza.objects.filter(equipo_id=datosequipo).filter(marca_id=datosmarca)
|
||||
return render(request, "buscar.html", {"datos": datos, "datospieza": xdatospieza, "datosequipo": xdatosequipo, "datosmarca": xdatosmarca, "datosubicacion": xdatosubicacion})
|
||||
elif datospieza == "" and datosmarca == "Selecciona una Marca" and datosbuscar == "" :
|
||||
xdatospieza = pieza.objects.all()
|
||||
xdatosequipo = equipo.objects.all()
|
||||
xdatosmarca = marca.objects.all()
|
||||
xdatosubicacion = ubicacion.objects.all()
|
||||
datos = pieza.objects.filter(equipo_id=datosequipo).filter(ubicacion_id=datosubicacion)
|
||||
return render(request, "buscar.html", {"datos": datos, "datospieza": xdatospieza, "datosequipo": xdatosequipo, "datosmarca": xdatosmarca, "datosubicacion": xdatosubicacion})
|
||||
elif datospieza == "" and datosequipo == "Selecciona un Equipo" and datosbuscar == "" :
|
||||
xdatospieza = pieza.objects.all()
|
||||
xdatosequipo = equipo.objects.all()
|
||||
xdatosmarca = marca.objects.all()
|
||||
xdatosubicacion = ubicacion.objects.all()
|
||||
datos = pieza.objects.filter(marca_id=datosmarca).filter(ubicacion_id=datosubicacion)
|
||||
return render(request, "buscar.html", {"datos": datos, "datospieza": xdatospieza, "datosequipo": xdatosequipo, "datosmarca": xdatosmarca, "datosubicacion": xdatosubicacion})
|
||||
|
||||
datospieza = pieza.objects.all()
|
||||
datosequipo = equipo.objects.all()
|
||||
datosmarca = marca.objects.all()
|
||||
datosubicacion = ubicacion.objects.all()
|
||||
return render(request, "buscar.html", {"datospieza": datospieza, "datosequipo": datosequipo, "datosmarca": datosmarca, "datosubicacion": datosubicacion})
|
||||
|
||||
|
||||
####### EXCEL #########################################################################
|
||||
|
||||
@login_required(login_url='/acceder')
|
||||
def ReporteExcelInventario(request):
|
||||
inventarios = pieza.objects.all()
|
||||
datosequipo = equipo.objects.all()
|
||||
datosmarca = marca.objects.all()
|
||||
datosubicacion = ubicacion.objects.all()
|
||||
fecha = datetime.datetime.now()
|
||||
fe = str(fecha)
|
||||
wb = Workbook()
|
||||
ws = wb.active
|
||||
ws['B1'] = 'REPORTE DE INVENTARIO'
|
||||
|
||||
ws.merge_cells('B1:L1')
|
||||
|
||||
ws['B2'] = datetime.datetime.now()
|
||||
|
||||
ws.merge_cells('B2:D2')
|
||||
|
||||
ws['B3'] = 'No. DE PEDIDO'
|
||||
ws['C3'] = 'REFERENCIA'
|
||||
ws['D3'] = 'EQUIPO'
|
||||
ws['E3'] = 'DESCRIPCIÓN DE ETIQUETA'
|
||||
ws['F3'] = 'DESCRIPCIÓN'
|
||||
ws['G3'] = 'MARCA'
|
||||
ws['H3'] = 'ESTATUS'
|
||||
ws['I3'] = 'UBICACION'
|
||||
ws['J3'] = 'CANTIDAD'
|
||||
ws['K3'] = 'FECHA DE ACTUALIZACION'
|
||||
ws['L3'] = 'COLUMN1'
|
||||
|
||||
cont = 4
|
||||
|
||||
for inventario in inventarios:
|
||||
for datoequipo in datosequipo:
|
||||
if inventario.equipo_id == datoequipo.id:
|
||||
excelequipo = datoequipo.nombre
|
||||
for datomarca in datosmarca:
|
||||
if inventario.marca_id == datomarca.id:
|
||||
excelmarca = datomarca.nombre
|
||||
for datoubicacion in datosubicacion:
|
||||
if inventario.ubicacion_id == datoubicacion.id:
|
||||
excelubicacion = datoubicacion.nombre
|
||||
ws.cell(row=cont, column=2).value = inventario.n_pedido
|
||||
ws.cell(row=cont, column=3).value = inventario.referencia
|
||||
ws.cell(row=cont, column=4).value = excelequipo
|
||||
ws.cell(row=cont, column=5).value = inventario.descripcion_etiqueta
|
||||
ws.cell(row=cont, column=6).value = inventario.descripcion_pieza
|
||||
ws.cell(row=cont, column=7).value = excelmarca
|
||||
ws.cell(row=cont, column=8).value = inventario.estatus
|
||||
ws.cell(row=cont, column=9).value = excelubicacion
|
||||
ws.cell(row=cont, column=10).value = inventario.cantidad
|
||||
ws.cell(row=cont, column=11).value = inventario.fecha_actualizacion
|
||||
ws.cell(row=cont, column=12).value = inventario.Column1
|
||||
cont += 1
|
||||
|
||||
nombre_archivo = "ReporteInventario "+fe+".xlsx"
|
||||
response = HttpResponse(content_type="application/ms-excel")
|
||||
content = "attachment; filename = {0}".format(nombre_archivo)
|
||||
response['Content-Disposition'] = content
|
||||
wb.save(response)
|
||||
return response
|
||||
|
||||
|
||||
@login_required(login_url='/acceder')
|
||||
def ReporteExcelInvEntrada(request):
|
||||
inventarios = pieza.objects.all()
|
||||
datosentrada = rentrada.objects.all()
|
||||
fecha = datetime.datetime.now()
|
||||
fe = str(fecha)
|
||||
wb = Workbook()
|
||||
ws = wb.active
|
||||
ws['B1'] = 'REPORTE DE INVENTARIO ENTRADA'
|
||||
|
||||
ws.merge_cells('B1:L1')
|
||||
|
||||
ws['B2'] = datetime.datetime.now()
|
||||
|
||||
ws.merge_cells('B2:D2')
|
||||
|
||||
ws['B3'] = 'NO. PEDIDO o contrato'
|
||||
ws['C3'] = 'REFERENCIA'
|
||||
ws['D3'] = 'CANTIDAD'
|
||||
ws['E3'] = 'FECHA ALTA'
|
||||
|
||||
cont = 4
|
||||
|
||||
for datoentrada in datosentrada:
|
||||
for inventario in inventarios:
|
||||
if datoentrada.referencia_id == inventario.id:
|
||||
excelreferencia = inventario.referencia
|
||||
ws.cell(row=cont, column=2).value = datoentrada.n_pedido
|
||||
ws.cell(row=cont, column=3).value = excelreferencia
|
||||
ws.cell(row=cont, column=4).value = datoentrada.cantidad
|
||||
ws.cell(row=cont, column=5).value = datoentrada.fecha_alta
|
||||
cont += 1
|
||||
|
||||
nombre_archivo = "ReporteInventarioEntrada "+fe+".xlsx"
|
||||
response = HttpResponse(content_type="application/ms-excel")
|
||||
content = "attachment; filename = {0}".format(nombre_archivo)
|
||||
response['Content-Disposition'] = content
|
||||
wb.save(response)
|
||||
return response
|
||||
|
||||
|
||||
@login_required(login_url='/acceder')
|
||||
def ReporteExcelInvSalida(request):
|
||||
inventarios = pieza.objects.all()
|
||||
datossalida = rsalida.objects.all()
|
||||
datosequipo = equipo.objects.all()
|
||||
datosmarca = marca.objects.all()
|
||||
datosubicacion = ubicacion.objects.all()
|
||||
fecha = datetime.datetime.now()
|
||||
fe = str(fecha)
|
||||
wb = Workbook()
|
||||
ws = wb.active
|
||||
ws['B1'] = 'REPORTE DE INVENTARIO SALIDA'
|
||||
|
||||
ws.merge_cells('B1:L1')
|
||||
|
||||
ws['B2'] = datetime.datetime.now()
|
||||
|
||||
ws.merge_cells('B2:D2')
|
||||
|
||||
ws['B3'] = 'QUIEN RETIRA'
|
||||
ws['C3'] = 'REFERENCIA'
|
||||
ws['D3'] = 'EQUIPO'
|
||||
ws['E3'] = 'MARCA'
|
||||
ws['F3'] = 'UBICACION'
|
||||
ws['G3'] = 'CANTIDAD'
|
||||
ws['H3'] = 'FECHA'
|
||||
|
||||
cont = 4
|
||||
|
||||
for datosalida in datossalida:
|
||||
for inventario in inventarios:
|
||||
if datosalida.referencia_id == inventario.id:
|
||||
excelreferencia = inventario.referencia
|
||||
for datoequipo in datosequipo:
|
||||
if inventario.equipo_id == datoequipo.id:
|
||||
excelequipo = datoequipo.nombre
|
||||
for datomarca in datosmarca:
|
||||
if inventario.marca_id == datomarca.id:
|
||||
excelmarca = datomarca.nombre
|
||||
for datoubicacion in datosubicacion:
|
||||
if inventario.ubicacion_id == datoubicacion.id:
|
||||
excelubicacion = datoubicacion.nombre
|
||||
ws.cell(row=cont, column=2).value = datosalida.autor
|
||||
ws.cell(row=cont, column=3).value = excelreferencia
|
||||
ws.cell(row=cont, column=4).value = excelequipo
|
||||
ws.cell(row=cont, column=5).value = excelmarca
|
||||
ws.cell(row=cont, column=6).value = excelubicacion
|
||||
ws.cell(row=cont, column=7).value = datosalida.cantidad
|
||||
ws.cell(row=cont, column=8).value = datosalida.fecha_alta
|
||||
cont += 1
|
||||
|
||||
nombre_archivo = "ReporteInventarioSalida "+fe+".xlsx"
|
||||
response = HttpResponse(content_type="application/ms-excel")
|
||||
content = "attachment; filename = {0}".format(nombre_archivo)
|
||||
response['Content-Disposition'] = content
|
||||
wb.save(response)
|
||||
return response
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user