main
parent
67827f4bbc
commit
317b2a0427
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,50 @@ |
||||
# Generated by Django 5.1.4 on 2024-12-17 22:48 |
||||
|
||||
import django.db.models.deletion |
||||
from django.db import migrations, models |
||||
|
||||
|
||||
class Migration(migrations.Migration): |
||||
|
||||
dependencies = [ |
||||
('Inventario', '0003_remove_articulo_codigo_articulo_articulo_medida'), |
||||
] |
||||
|
||||
operations = [ |
||||
migrations.RemoveField( |
||||
model_name='inventario', |
||||
name='precio', |
||||
), |
||||
migrations.RemoveField( |
||||
model_name='movimiento_inventario', |
||||
name='precio', |
||||
), |
||||
migrations.AddField( |
||||
model_name='articulo', |
||||
name='precio_compra', |
||||
field=models.DecimalField(decimal_places=2, max_digits=10, null=True), |
||||
), |
||||
migrations.AddField( |
||||
model_name='articulo', |
||||
name='precio_venta', |
||||
field=models.DecimalField(decimal_places=2, max_digits=10, null=True), |
||||
), |
||||
migrations.AlterField( |
||||
model_name='movimiento_inventario', |
||||
name='fecha', |
||||
field=models.DateTimeField(auto_now_add=True, null=True), |
||||
), |
||||
migrations.CreateModel( |
||||
name='Venta', |
||||
fields=[ |
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
||||
('fecha', models.DateTimeField(auto_now_add=True)), |
||||
('cantidad', models.PositiveIntegerField()), |
||||
('precio_unitario', models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True)), |
||||
('total', models.DecimalField(blank=True, decimal_places=2, max_digits=12)), |
||||
('observaciones', models.TextField(blank=True)), |
||||
('articulo', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Inventario.articulo')), |
||||
('bodega', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Inventario.bodega')), |
||||
], |
||||
), |
||||
] |
||||
Binary file not shown.
@ -0,0 +1,30 @@ |
||||
{% extends "Base.html" %} |
||||
|
||||
{% block content %} |
||||
|
||||
<main class="conteiner"> |
||||
<div class="row"> |
||||
<div class="col-md-8 offset-md-2 mt-4"> |
||||
<form action="/ventas/nueva_venta/" method="POST"> |
||||
<div class="card"> |
||||
<div class="card-header text-bg-secondary"> |
||||
<h4 class="text-center">Registrar nueva venta</h4> |
||||
|
||||
</div> |
||||
<div class="card-body"> |
||||
{% csrf_token %} |
||||
{{form.as_p}} |
||||
</div> |
||||
<div class="card-footer"> |
||||
<div class="gap-3 d-md-flex justify-content-md-end mb-3"> |
||||
<a class="btn btn-danger" href="{% url 'lista_ventas' %}">Cancelar</a> |
||||
<button class="btn btn-primary ">Nueva venta</button> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
</main> |
||||
|
||||
{% endblock %} |
||||
@ -0,0 +1,54 @@ |
||||
{% extends "Base.html" %} |
||||
|
||||
{% block content %} |
||||
<main class="conteiner"> |
||||
<div class="row"> |
||||
<div class="col-md-10 offset-md-1 mt-4"> |
||||
<form action="/ventas/" method="POST"> |
||||
<div class="card-header"> |
||||
<h3 class="text-center">Tabla de Bodega</h3> |
||||
</div> |
||||
<div class="table-responsive"> |
||||
<table class="table mt-3"> |
||||
<thead class="table-dark"> |
||||
<tr> |
||||
<th scope="col">#</th> |
||||
<th scope="col">Fecha</th> |
||||
<th scope="col">Bodega</th> |
||||
<th scope="col">Artículo</th> |
||||
<th scope="col">Cantidad</th> |
||||
<th scope="col">Precio Unitario</th> |
||||
<th scope="col">Total</th> |
||||
<th scope="col">Observaciones</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody> |
||||
{% for venta in ventas %} |
||||
<tr> |
||||
<th scope="row"> {{venta.id}} </th> |
||||
<td>{{ venta.fecha }}</td> |
||||
<td>{{ venta.bodega }}</td> |
||||
<td>{{ venta.articulo.nombre_articulo }}</td> |
||||
<td>{{ venta.cantidad }}</td> |
||||
<td>${{ venta.precio_unitario }}</td> |
||||
<td>${{ venta.total }}</td> |
||||
<td>{{ venta.observaciones }}</td> |
||||
</tr> |
||||
{% endfor %} |
||||
</tbody> |
||||
</table> |
||||
</div> |
||||
|
||||
</form> |
||||
</div> |
||||
</div> |
||||
<div class="fixed-bottom col-12 mc-3"> |
||||
<di class="gap-2 d-md-flex justify-content-md-end mb-3"> |
||||
<a class="btn btn-success rounded-pill btn-lg" href="{% url 'nueva_venta' %}" >💾</a> |
||||
<br> |
||||
<br> |
||||
</div> |
||||
</div> |
||||
</main> |
||||
|
||||
{% endblock %} |
||||
Binary file not shown.
Loading…
Reference in new issue