Merge branch 'master' of ssh://fedesrv.ddns.net:666/fede/Final_Das

This commit is contained in:
fedpo
2024-11-29 03:04:43 +00:00
15 changed files with 1210 additions and 61 deletions

View File

@@ -3,8 +3,9 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace Entidades
{
public class DetalleFactura: Detalle<Producto>
public class DetalleFactura: Detalle<Producto>, ICloneable
{
public DetalleFactura() { }
public int IdFactura { get; set; }
public double Subtotal
@@ -22,5 +23,17 @@ namespace Entidades
return Producto.Nombre;
}
}
private DetalleFactura(DetalleFactura detalle)
{
Id = detalle.Id;
IdFactura = detalle.IdFactura;
Producto = detalle.Producto;
Cantidad = detalle.Cantidad;
}
public object Clone()
{
return new DetalleFactura(this);
}
}
}

View File

@@ -8,6 +8,7 @@ namespace Entidades
public int IdRemito { get; set; }
public DateTime Fecha { get; set; }
public bool Habilitado { get; set; }
public int CantRecibida { get; set; }
[NotMapped]
public string NombreProducto
@@ -31,6 +32,7 @@ namespace Entidades
IdRemito = lote.IdRemito;
Fecha = lote.Fecha;
Habilitado = lote.Habilitado;
CantRecibida = CantRecibida;
}
public object Clone()

View File

@@ -23,8 +23,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Informes", "Informes\Inform
{78A331E5-86D4-427E-AA45-5879F9E5E98B} = {78A331E5-86D4-427E-AA45-5879F9E5E98B}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testing", "testing\testing.csproj", "{FC4E3D1E-306A-4F4E-8476-F7F37A6E9049}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -51,10 +49,6 @@ Global
{6C83A4AB-C70D-4D4E-A879-5E960C4A103A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C83A4AB-C70D-4D4E-A879-5E960C4A103A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6C83A4AB-C70D-4D4E-A879-5E960C4A103A}.Release|Any CPU.Build.0 = Release|Any CPU
{FC4E3D1E-306A-4F4E-8476-F7F37A6E9049}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FC4E3D1E-306A-4F4E-8476-F7F37A6E9049}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC4E3D1E-306A-4F4E-8476-F7F37A6E9049}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC4E3D1E-306A-4F4E-8476-F7F37A6E9049}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -0,0 +1,559 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Modelo;
#nullable disable
namespace Modelo.Migrations
{
[DbContext(typeof(Context))]
[Migration("20241016232125_PuseCantidadOriginalDeStock")]
partial class PuseCantidadOriginalDeStock
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.8");
modelBuilder.Entity("Entidades.Categoria", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Descripcion")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Categoria", (string)null);
});
modelBuilder.Entity("Entidades.Cliente", b =>
{
b.Property<long>("Cuit")
.HasColumnType("INTEGER");
b.Property<string>("Apellido")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("TEXT");
b.Property<string>("Correo")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("TEXT");
b.Property<string>("Direccion")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("TEXT");
b.HasKey("Cuit");
b.ToTable("Clientes", (string)null);
});
modelBuilder.Entity("Entidades.DetalleFactura", b =>
{
b.Property<int>("Id")
.HasColumnType("INTEGER");
b.Property<int>("IdFactura")
.HasColumnType("INTEGER");
b.Property<int>("Cantidad")
.HasColumnType("INTEGER");
b.Property<int>("ProductoId")
.HasColumnType("INTEGER");
b.HasKey("Id", "IdFactura");
b.HasIndex("IdFactura");
b.HasIndex("ProductoId");
b.ToTable("DetallesFacturas", (string)null);
});
modelBuilder.Entity("Entidades.DetalleOrdenDeCompra", b =>
{
b.Property<int>("Id")
.HasColumnType("INTEGER");
b.Property<int>("IdOrdenDeCompra")
.HasColumnType("INTEGER");
b.Property<int>("Cantidad")
.HasColumnType("INTEGER");
b.Property<int>("IdPresupuesto")
.HasColumnType("INTEGER");
b.Property<double>("MontoCU")
.HasColumnType("REAL");
b.Property<int>("ProductoId")
.HasColumnType("INTEGER");
b.HasKey("Id", "IdOrdenDeCompra");
b.HasIndex("IdOrdenDeCompra");
b.HasIndex("ProductoId");
b.ToTable("DetalleOrdenDeCompras");
});
modelBuilder.Entity("Entidades.DetallePresupuesto", b =>
{
b.Property<int>("Id")
.HasColumnType("INTEGER");
b.Property<int>("IdPresupuesto")
.HasColumnType("INTEGER");
b.Property<int>("Cantidad")
.HasColumnType("INTEGER");
b.Property<double>("MontoCUPropuesto")
.HasColumnType("REAL");
b.Property<int>("ProductoId")
.HasColumnType("INTEGER");
b.HasKey("Id", "IdPresupuesto");
b.HasIndex("IdPresupuesto");
b.HasIndex("ProductoId");
b.ToTable("DetallePresupuestos");
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long>("ClienteCuit")
.HasColumnType("INTEGER");
b.Property<DateTime>("Fecha")
.HasColumnType("TEXT");
b.Property<long>("IdCliente")
.HasColumnType("INTEGER");
b.Property<double>("Total")
.HasColumnType("REAL");
b.HasKey("Id");
b.HasIndex("ClienteCuit");
b.ToTable("Facturas", (string)null);
});
modelBuilder.Entity("Entidades.Lote", b =>
{
b.Property<int>("Id")
.HasColumnType("INTEGER");
b.Property<int>("IdRemito")
.HasColumnType("INTEGER");
b.Property<int>("CantOriginal")
.HasColumnType("INTEGER");
b.Property<int>("Cantidad")
.HasColumnType("INTEGER");
b.Property<DateTime>("Fecha")
.HasColumnType("TEXT");
b.Property<bool>("Habilitado")
.HasColumnType("INTEGER");
b.Property<int>("ProductoId")
.HasColumnType("INTEGER");
b.HasKey("Id", "IdRemito");
b.HasIndex("IdRemito");
b.HasIndex("ProductoId");
b.ToTable("Lotes");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("Entregado")
.HasColumnType("INTEGER");
b.Property<long>("IdProveedor")
.HasColumnType("INTEGER");
b.Property<long>("ProveedorCuit")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("OrdenDeCompras");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("Aceptado")
.HasColumnType("INTEGER");
b.Property<DateTime>("Fecha")
.HasColumnType("TEXT");
b.Property<bool>("Habilitado")
.HasColumnType("INTEGER");
b.Property<long>("IdProveedor")
.HasColumnType("INTEGER");
b.Property<long>("ProveedorCuit")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("Presupuestos");
});
modelBuilder.Entity("Entidades.Producto", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Discriminator")
.IsRequired()
.HasMaxLength(21)
.HasColumnType("TEXT");
b.Property<bool>("EsPerecedero")
.HasColumnType("INTEGER");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("TEXT");
b.Property<double>("Precio")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Producto");
b.HasDiscriminator().HasValue("Producto");
b.UseTphMappingStrategy();
});
modelBuilder.Entity("Entidades.Proveedor", b =>
{
b.Property<long>("Cuit")
.HasColumnType("INTEGER");
b.Property<string>("Direccion")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("TEXT");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("TEXT");
b.Property<string>("RazonSocial")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("TEXT");
b.HasKey("Cuit");
b.ToTable("Proveedores");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long>("ProveedorCuit")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("Remitos");
});
modelBuilder.Entity("ProductoCategoria", b =>
{
b.Property<int>("CategoriaId")
.HasColumnType("INTEGER");
b.Property<int>("ProductoId")
.HasColumnType("INTEGER");
b.HasKey("CategoriaId", "ProductoId");
b.HasIndex("ProductoId");
b.ToTable("ProductoCategoria");
});
modelBuilder.Entity("ProductoProveedor", b =>
{
b.Property<long>("ProveedorId")
.HasColumnType("INTEGER");
b.Property<int>("ProductoId")
.HasColumnType("INTEGER");
b.HasKey("ProveedorId", "ProductoId");
b.HasIndex("ProductoId");
b.ToTable("ProductoProveedor");
});
modelBuilder.Entity("Entidades.ProductoNoPercedero", b =>
{
b.HasBaseType("Entidades.Producto");
b.Property<string>("TipoDeEnvase")
.IsRequired()
.HasColumnType("TEXT");
b.HasDiscriminator().HasValue("ProductoNoPercedero");
});
modelBuilder.Entity("Entidades.ProductoPercedero", b =>
{
b.HasBaseType("Entidades.Producto");
b.Property<int>("MesesHastaConsumoPreferente")
.HasColumnType("INTEGER");
b.Property<int>("MesesHastaVencimiento")
.HasColumnType("INTEGER");
b.HasDiscriminator().HasValue("ProductoPercedero");
});
modelBuilder.Entity("Entidades.DetalleFactura", b =>
{
b.HasOne("Entidades.Factura", null)
.WithMany("Detalles")
.HasForeignKey("IdFactura")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.DetalleOrdenDeCompra", b =>
{
b.HasOne("Entidades.OrdenDeCompra", null)
.WithMany("detalles")
.HasForeignKey("IdOrdenDeCompra")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.DetallePresupuesto", b =>
{
b.HasOne("Entidades.Presupuesto", null)
.WithMany("detalles")
.HasForeignKey("IdPresupuesto")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.HasOne("Entidades.Cliente", "Cliente")
.WithMany()
.HasForeignKey("ClienteCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cliente");
});
modelBuilder.Entity("Entidades.Lote", b =>
{
b.HasOne("Entidades.Remito", null)
.WithMany("Lotes")
.HasForeignKey("IdRemito")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("ProductoCategoria", b =>
{
b.HasOne("Entidades.Categoria", null)
.WithMany()
.HasForeignKey("CategoriaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", null)
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ProductoProveedor", b =>
{
b.HasOne("Entidades.Producto", null)
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Proveedor", null)
.WithMany()
.HasForeignKey("ProveedorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.Navigation("Detalles");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.Navigation("detalles");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.Navigation("detalles");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.Navigation("Lotes");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,29 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Modelo.Migrations
{
/// <inheritdoc />
public partial class PuseCantidadOriginalDeStock : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "CantOriginal",
table: "Lotes",
type: "INTEGER",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CantOriginal",
table: "Lotes");
}
}
}

View File

@@ -0,0 +1,559 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Modelo;
#nullable disable
namespace Modelo.Migrations
{
[DbContext(typeof(Context))]
[Migration("20241016232600_RefactorNombre")]
partial class RefactorNombre
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.8");
modelBuilder.Entity("Entidades.Categoria", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Descripcion")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Categoria", (string)null);
});
modelBuilder.Entity("Entidades.Cliente", b =>
{
b.Property<long>("Cuit")
.HasColumnType("INTEGER");
b.Property<string>("Apellido")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("TEXT");
b.Property<string>("Correo")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("TEXT");
b.Property<string>("Direccion")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("TEXT");
b.HasKey("Cuit");
b.ToTable("Clientes", (string)null);
});
modelBuilder.Entity("Entidades.DetalleFactura", b =>
{
b.Property<int>("Id")
.HasColumnType("INTEGER");
b.Property<int>("IdFactura")
.HasColumnType("INTEGER");
b.Property<int>("Cantidad")
.HasColumnType("INTEGER");
b.Property<int>("ProductoId")
.HasColumnType("INTEGER");
b.HasKey("Id", "IdFactura");
b.HasIndex("IdFactura");
b.HasIndex("ProductoId");
b.ToTable("DetallesFacturas", (string)null);
});
modelBuilder.Entity("Entidades.DetalleOrdenDeCompra", b =>
{
b.Property<int>("Id")
.HasColumnType("INTEGER");
b.Property<int>("IdOrdenDeCompra")
.HasColumnType("INTEGER");
b.Property<int>("Cantidad")
.HasColumnType("INTEGER");
b.Property<int>("IdPresupuesto")
.HasColumnType("INTEGER");
b.Property<double>("MontoCU")
.HasColumnType("REAL");
b.Property<int>("ProductoId")
.HasColumnType("INTEGER");
b.HasKey("Id", "IdOrdenDeCompra");
b.HasIndex("IdOrdenDeCompra");
b.HasIndex("ProductoId");
b.ToTable("DetalleOrdenDeCompras");
});
modelBuilder.Entity("Entidades.DetallePresupuesto", b =>
{
b.Property<int>("Id")
.HasColumnType("INTEGER");
b.Property<int>("IdPresupuesto")
.HasColumnType("INTEGER");
b.Property<int>("Cantidad")
.HasColumnType("INTEGER");
b.Property<double>("MontoCUPropuesto")
.HasColumnType("REAL");
b.Property<int>("ProductoId")
.HasColumnType("INTEGER");
b.HasKey("Id", "IdPresupuesto");
b.HasIndex("IdPresupuesto");
b.HasIndex("ProductoId");
b.ToTable("DetallePresupuestos");
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long>("ClienteCuit")
.HasColumnType("INTEGER");
b.Property<DateTime>("Fecha")
.HasColumnType("TEXT");
b.Property<long>("IdCliente")
.HasColumnType("INTEGER");
b.Property<double>("Total")
.HasColumnType("REAL");
b.HasKey("Id");
b.HasIndex("ClienteCuit");
b.ToTable("Facturas", (string)null);
});
modelBuilder.Entity("Entidades.Lote", b =>
{
b.Property<int>("Id")
.HasColumnType("INTEGER");
b.Property<int>("IdRemito")
.HasColumnType("INTEGER");
b.Property<int>("CantRecibida")
.HasColumnType("INTEGER");
b.Property<int>("Cantidad")
.HasColumnType("INTEGER");
b.Property<DateTime>("Fecha")
.HasColumnType("TEXT");
b.Property<bool>("Habilitado")
.HasColumnType("INTEGER");
b.Property<int>("ProductoId")
.HasColumnType("INTEGER");
b.HasKey("Id", "IdRemito");
b.HasIndex("IdRemito");
b.HasIndex("ProductoId");
b.ToTable("Lotes");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("Entregado")
.HasColumnType("INTEGER");
b.Property<long>("IdProveedor")
.HasColumnType("INTEGER");
b.Property<long>("ProveedorCuit")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("OrdenDeCompras");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("Aceptado")
.HasColumnType("INTEGER");
b.Property<DateTime>("Fecha")
.HasColumnType("TEXT");
b.Property<bool>("Habilitado")
.HasColumnType("INTEGER");
b.Property<long>("IdProveedor")
.HasColumnType("INTEGER");
b.Property<long>("ProveedorCuit")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("Presupuestos");
});
modelBuilder.Entity("Entidades.Producto", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Discriminator")
.IsRequired()
.HasMaxLength(21)
.HasColumnType("TEXT");
b.Property<bool>("EsPerecedero")
.HasColumnType("INTEGER");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("TEXT");
b.Property<double>("Precio")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Producto");
b.HasDiscriminator().HasValue("Producto");
b.UseTphMappingStrategy();
});
modelBuilder.Entity("Entidades.Proveedor", b =>
{
b.Property<long>("Cuit")
.HasColumnType("INTEGER");
b.Property<string>("Direccion")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("TEXT");
b.Property<bool>("Habilitado")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(true);
b.Property<string>("Nombre")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("TEXT");
b.Property<string>("RazonSocial")
.IsRequired()
.HasMaxLength(60)
.HasColumnType("TEXT");
b.HasKey("Cuit");
b.ToTable("Proveedores");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<long>("ProveedorCuit")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ProveedorCuit");
b.ToTable("Remitos");
});
modelBuilder.Entity("ProductoCategoria", b =>
{
b.Property<int>("CategoriaId")
.HasColumnType("INTEGER");
b.Property<int>("ProductoId")
.HasColumnType("INTEGER");
b.HasKey("CategoriaId", "ProductoId");
b.HasIndex("ProductoId");
b.ToTable("ProductoCategoria");
});
modelBuilder.Entity("ProductoProveedor", b =>
{
b.Property<long>("ProveedorId")
.HasColumnType("INTEGER");
b.Property<int>("ProductoId")
.HasColumnType("INTEGER");
b.HasKey("ProveedorId", "ProductoId");
b.HasIndex("ProductoId");
b.ToTable("ProductoProveedor");
});
modelBuilder.Entity("Entidades.ProductoNoPercedero", b =>
{
b.HasBaseType("Entidades.Producto");
b.Property<string>("TipoDeEnvase")
.IsRequired()
.HasColumnType("TEXT");
b.HasDiscriminator().HasValue("ProductoNoPercedero");
});
modelBuilder.Entity("Entidades.ProductoPercedero", b =>
{
b.HasBaseType("Entidades.Producto");
b.Property<int>("MesesHastaConsumoPreferente")
.HasColumnType("INTEGER");
b.Property<int>("MesesHastaVencimiento")
.HasColumnType("INTEGER");
b.HasDiscriminator().HasValue("ProductoPercedero");
});
modelBuilder.Entity("Entidades.DetalleFactura", b =>
{
b.HasOne("Entidades.Factura", null)
.WithMany("Detalles")
.HasForeignKey("IdFactura")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.DetalleOrdenDeCompra", b =>
{
b.HasOne("Entidades.OrdenDeCompra", null)
.WithMany("detalles")
.HasForeignKey("IdOrdenDeCompra")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.DetallePresupuesto", b =>
{
b.HasOne("Entidades.Presupuesto", null)
.WithMany("detalles")
.HasForeignKey("IdPresupuesto")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.HasOne("Entidades.Cliente", "Cliente")
.WithMany()
.HasForeignKey("ClienteCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cliente");
});
modelBuilder.Entity("Entidades.Lote", b =>
{
b.HasOne("Entidades.Remito", null)
.WithMany("Lotes")
.HasForeignKey("IdRemito")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", "Producto")
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Producto");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.HasOne("Entidades.Proveedor", "Proveedor")
.WithMany()
.HasForeignKey("ProveedorCuit")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Proveedor");
});
modelBuilder.Entity("ProductoCategoria", b =>
{
b.HasOne("Entidades.Categoria", null)
.WithMany()
.HasForeignKey("CategoriaId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Producto", null)
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ProductoProveedor", b =>
{
b.HasOne("Entidades.Producto", null)
.WithMany()
.HasForeignKey("ProductoId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Entidades.Proveedor", null)
.WithMany()
.HasForeignKey("ProveedorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Entidades.Factura", b =>
{
b.Navigation("Detalles");
});
modelBuilder.Entity("Entidades.OrdenDeCompra", b =>
{
b.Navigation("detalles");
});
modelBuilder.Entity("Entidades.Presupuesto", b =>
{
b.Navigation("detalles");
});
modelBuilder.Entity("Entidades.Remito", b =>
{
b.Navigation("Lotes");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Modelo.Migrations
{
/// <inheritdoc />
public partial class RefactorNombre : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "CantOriginal",
table: "Lotes",
newName: "CantRecibida");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "CantRecibida",
table: "Lotes",
newName: "CantOriginal");
}
}
}

View File

@@ -179,6 +179,9 @@ namespace Modelo.Migrations
b.Property<int>("IdRemito")
.HasColumnType("INTEGER");
b.Property<int>("CantRecibida")
.HasColumnType("INTEGER");
b.Property<int>("Cantidad")
.HasColumnType("INTEGER");

View File

@@ -24,13 +24,25 @@ namespace Modelo
{
t.Cliente = context.Clientes.FirstOrDefault(x => x.Cuit == t.Cliente.Cuit);
var list = new List<DetalleFactura>();
int contador = 0;
foreach (var detalle in t.Detalles)
{
list.Add((DetalleFactura)detalle.Clone());
list.Last().Producto = detalle.Producto;
list.Last().Id = contador++;
}
foreach (var detalle in list)
{
detalle.Producto = (detalle.Producto.EsPerecedero) ?
context.ProductoPercederos.FirstOrDefault(x => x.Id == detalle.Producto.Id) :
context.ProductoNoPercederos.FirstOrDefault(x => x.Id == detalle.Producto.Id) ;
}
t.Detalles = list;
context.Facturas.Add(t);
}

View File

@@ -41,6 +41,7 @@ namespace Modelo
{
listaLotes.Add((Lote)lote.Clone());
listaLotes.Last().Producto = lote.Producto;
listaLotes.Last().CantRecibida = lote.Cantidad;
}
foreach (var lote in listaLotes)

View File

@@ -49,7 +49,7 @@ namespace Vista
foreach (DataGridViewColumn column in dgvDetallesRemito.Columns)
{
column.Visible = column.Name == "Id" || column.Name == "Fecha"
|| column.Name == "Cantidad" || column.Name == "NombreProducto";
|| column.Name == "Cantidad" || column.Name == "NombreProducto" || column.Name == "CantRecibida";
}
}
}

View File

@@ -1 +0,0 @@
global using NUnit.Framework;

View File

@@ -1,20 +0,0 @@
using Modelo;
namespace testing;
public class Tests
{
[SetUp]
public void Setup()
{
}
[Test]
public void TestConeccion()
{
Context c = new();
bool connect = c.Database.CanConnect();
Assert.That(connect, "true");
}
}

View File

@@ -1,30 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="NUnit" Version="4.1.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Modelo\Modelo.csproj" />
</ItemGroup>
</Project>