falta que se actualize numProducto y los infomes

This commit is contained in:
2024-08-11 18:26:09 -03:00
parent cff13f1e47
commit 4262d66025
42 changed files with 724 additions and 471 deletions

View File

@@ -10,21 +10,24 @@ namespace Controladora
{ {
if (t == null) return "La Factura es nula, fallo la carga"; if (t == null) return "La Factura es nula, fallo la carga";
if (RepositorioFactura.Instance.ExistePorId(t.Id)) if (RepositorioFactura.Instance.ExistePorId(t.Id)) return $"La Factura con el ID {t.Id} ya existe";
{ if (t.Cliente == null || t.Cliente.Cuit == 0) return "Debe seleccionar un cliente antes de agregar la factura";
return $"La Factura con el ID {t.Id} ya existe";
}
// Verificar si el cliente está seleccionado string checkstock = "";
if (t.Cliente == null || t.Cliente.Cuit == 0) foreach (var detalle in t.MostrarDetalles())
{ {
return "Debe seleccionar un cliente antes de agregar la factura"; if (detalle.Cantidad > ControladoraLotes.Instance.MostrarStockDeProducto(detalle.Producto))
{
checkstock += $"No hay existencias en stock para realizar la venta de {detalle.Producto.Nombre}\n";
}
} }
if (checkstock != "") return checkstock;
try try
{ {
bool resultado = RepositorioFactura.Instance.Add(t); bool resultado = RepositorioFactura.Instance.Add(t);
return resultado ? string resultadolote = ControladoraLotes.Instance.DisminuirStock(t.MostrarDetalles());
return (resultado && (resultadolote == "Se Descontaron los productos")) ?
$"La Factura con el ID {t.Id} se cargó correctamente" : $"La Factura con el ID {t.Id} se cargó correctamente" :
$"Falló la carga de la Factura con el ID {t.Id}"; $"Falló la carga de la Factura con el ID {t.Id}";
} }
@@ -35,24 +38,6 @@ namespace Controladora
} }
} }
public string Eliminar(Factura t)
{
if (t == null) return "La Factura es nula, fallo la carga";
return (RepositorioFactura.Instance.Del(t)) ?
$"La Factura con el ID {t.Id} se eliminó correctamente" :
$"Falló la eliminación de la Factura con el ID {t.Id}";
}
public string Modificar(Factura t)
{
if (t == null) return "La Factura es nula, fallo la carga";
return (RepositorioFactura.Instance.Mod(t)) ?
$"La Factura con el ID {t.Id} se modificó correctamente" :
$"Falló la modificación de la Factura con el ID {t.Id}";
}
public ReadOnlyCollection<Factura> Listar() public ReadOnlyCollection<Factura> Listar()
{ {
return RepositorioFactura.Instance.Listar(); return RepositorioFactura.Instance.Listar();
@@ -65,6 +50,21 @@ namespace Controladora
return facturaalistar.MostrarDetalles(); return facturaalistar.MostrarDetalles();
} }
public ReadOnlyCollection<Producto> ListarProductos()
{
return RepositorioProductos.Instance.Listar()
.Where(x => x.Habilitado == true)
.ToList()
.AsReadOnly();
}
public ReadOnlyCollection<Cliente> ListarClientes()
{
return RepositorioClientes.Instance.Listar().Where(x => x.Habilitado == true)
.ToList()
.AsReadOnly();
}
} }
} }

View File

@@ -0,0 +1,42 @@
using Informes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
namespace Controladora
{
public class ControladoraInformes : Singleton<ControladoraInformes>
{
const string configpath = "settings.json";
public void GuardarConfig(ConfigEmail config)
{
try
{
string json = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText(configpath, json);
}
catch (IOException ex) { throw; }
}
public ConfigEmail RecuperarConfig()
{
try
{
if (!File.Exists(configpath))
{
string json = JsonSerializer.Serialize(new ConfigEmail { EmailAddr = "", EmailPass = "", EmailTarget = new List<String>() }, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText(configpath, json);
}
}
catch (IOException ex) { throw; }
string jsonString = File.ReadAllText(configpath);
return JsonSerializer.Deserialize<ConfigEmail>(jsonString);
}
}
}

View File

@@ -11,6 +11,7 @@ namespace Controladora
{ {
public class ControladoraLotes : Singleton<ControladoraLotes> public class ControladoraLotes : Singleton<ControladoraLotes>
{ {
/*
public string Añadir(Lote t) public string Añadir(Lote t)
{ {
if (t == null) return "El Lote es nulo, falló la carga"; if (t == null) return "El Lote es nulo, falló la carga";
@@ -64,21 +65,39 @@ namespace Controladora
return $"Ocurrió un error inesperado: {ex.Message}"; return $"Ocurrió un error inesperado: {ex.Message}";
} }
} }
*/
/*public ReadOnlyCollection<Lote> ListarPorFacturaId(int facturaId) public string DisminuirStock(ReadOnlyCollection<DetalleFactura> detalleFactura)
{ {
try var ret = false;
foreach (var detalle in detalleFactura)
{ {
var lotes = RepositorioLote.Instance.Listar(); if (detalle == null) return "El detalle es nulo";
var lotesPorFactura = lotes.Where(lote => lote.Id == facturaId).ToList(); if (detalle.Producto.Id < 0) return "Esta mal cargada la Id de producto";
return new ReadOnlyCollection<Lote>(lotesPorFactura); var productos = RepositorioProductos.Instance.Listar();
if (productos.Any(x => x.Id != detalle.Producto.Id)) return "No hay Productos con esa id";
ret = RepositorioLote.Instance.DisminuirStock(detalle);
} }
catch (Exception ex)
{ return (ret) ?
// Captura cualquier excepción no prevista "Se Descontaron los productos":
throw new InvalidOperationException($"Ocurrió un error inesperado: {ex.Message}"); "Se fallo al diminuir el stock";
}
}*/ }
public int MostrarStockDeProducto(Producto producto)
{
if (producto == null) return -1;
if (producto.Id < 0) return -1;
var lotes = RepositorioLote.Instance.Listar();
if (lotes.Any(x => x.Producto.Id != producto.Id)) return -1; // basicamente no hay productos con esa id
var CantidadStock = lotes
.Where(x => x.Producto.Id == producto.Id)
.Sum(x=> x.Cantidad);
return CantidadStock;
}
public ReadOnlyCollection<Lote> Listar() public ReadOnlyCollection<Lote> Listar()
{ {

View File

@@ -66,6 +66,41 @@ namespace Controladora
return ordenalistar.MostrarDetalles(); return ordenalistar.MostrarDetalles();
} }
public Presupuesto? MostrarPresupuestoPorId(Presupuesto? presupuesto)
{
if (presupuesto == null) return null;
if (presupuesto.Id < 0) return null;
var pres = RepositorioPresupuesto.Instance.Listar().First(x => x.Id == presupuesto.Id);
return pres;
}
public object ListarProveedores()
{
return RepositorioProveedor.Instance.Listar()
.Where(x => x.Habilitado == true)
.ToList()
.AsReadOnly();
}
public ReadOnlyCollection<DetallePresupuesto> ListarDetallesDePresupuesto(Presupuesto presupuesto)
{
Presupuesto pres = RepositorioPresupuesto.Instance.Listar().First(x => x.Id == presupuesto.Id);
if (pres == null) return new ReadOnlyCollection<DetallePresupuesto>(new List<DetallePresupuesto>());
return pres.MostrarDetalles();
}
public object ListarPresupuestosPorProveedorHabilitados(Proveedor proveedor)
{
if (proveedor == null) return null;
if (proveedor.Cuit < 0) return null;
var presupuestos = RepositorioPresupuesto.Instance.Listar()
.Where(x => x.Proveedor.Cuit == proveedor.Cuit)
.Where(x => x.Habilitado == true)
.ToList()
.AsReadOnly();
return presupuestos;
}
} }
} }

View File

@@ -49,15 +49,6 @@ namespace Controladora
.AsReadOnly(); .AsReadOnly();
} }
public ReadOnlyCollection<Presupuesto> ListarAceptado()
{
return RepositorioPresupuesto.Instance.Listar()
.Where(x => x.Habilitado == true)
.Where(x => x.Aceptado == true)
.ToList()
.AsReadOnly();
}
public ReadOnlyCollection<DetallePresupuesto> ListarDetalles(Presupuesto presupuesto) public ReadOnlyCollection<DetallePresupuesto> ListarDetalles(Presupuesto presupuesto)
{ {
Presupuesto pres = RepositorioPresupuesto.Instance.Listar().First(x=> x.Id == presupuesto.Id); Presupuesto pres = RepositorioPresupuesto.Instance.Listar().First(x=> x.Id == presupuesto.Id);
@@ -66,25 +57,26 @@ namespace Controladora
} }
public Presupuesto? MostrarPresupuestoPorId(Presupuesto presupuesto) public object ListarProductosPorProveedor(Proveedor proveedor)
{ {
if (presupuesto == null) return null; if (proveedor == null) return new List<Producto>().AsReadOnly();
if (presupuesto.Id < 0) return null; if (proveedor.Cuit < 0) return new List<Producto>().AsReadOnly();
var pres = RepositorioPresupuesto.Instance.Listar().First(x => x.Id == presupuesto.Id); var productos = RepositorioProductos.Instance
return pres; .Listar()
.Where(x => x.ListarProveedores()
} .Any(x => x.Cuit == proveedor.Cuit))
public ReadOnlyCollection<Presupuesto>? ListarPresupuestosPorProveedor(Proveedor proveedor)
{
if (proveedor == null) return null;
if (proveedor.Cuit < 0) return null;
var presupuestos = RepositorioPresupuesto.Instance.Listar()
.Where(x => x.Proveedor.Cuit == proveedor.Cuit)
.ToList() .ToList()
.AsReadOnly(); .AsReadOnly();
return presupuestos;
return productos;
}
public object ListarProveedores()
{
return RepositorioProveedor.Instance.Listar()
.Where(x => x.Habilitado == true)
.ToList()
.AsReadOnly();
} }
} }
} }

View File

@@ -60,5 +60,18 @@ namespace Controladora
} }
return null; return null;
} }
public ReadOnlyCollection<Proveedor> ListarProveedores()
{
return RepositorioProveedor.Instance.Listar()
.Where(x => x.Habilitado == true)
.ToList()
.AsReadOnly();
}
public ReadOnlyCollection<Categoria> ListarCategorias()
{
return RepositorioCategoria.Instance.Listar();
}
} }
} }

View File

@@ -49,5 +49,6 @@ namespace Controladora
.ToList() .ToList()
.AsReadOnly(); .AsReadOnly();
} }
} }
} }

View File

@@ -11,15 +11,18 @@ namespace Controladora
return RepositorioRemito.Instance.Listar(); return RepositorioRemito.Instance.Listar();
} }
public string Añadir(Remito t) public string Añadir(Remito t, OrdenDeCompra orden )
{ {
if (t == null) return "El Remito es nulo fallo la carga"; if (t == null) return "El Remito es nulo fallo la carga";
if (t.Id < 0) return "El id Esta Mal Cargado"; if (t.Id < 0) return "El id Esta Mal Cargado";
var retMarcarOrdenEntregada = RepositorioOrdenDeCompra.Instance.MarcarEntregado(orden);
if (retMarcarOrdenEntregada == false) return "La orden Esta Mal Cargada";
var retRemito = RepositorioRemito.Instance.Add(t); var retRemito = RepositorioRemito.Instance.Add(t);
if (retRemito == false) return "El Remito Esta Mal Cargado";
var retLotes = RepositorioLote.Instance.Add(t); var retLotes = RepositorioLote.Instance.Add(t);
return (!retLotes) ? return (retLotes) ?
$"El remito {t.Id} se cargo correctamente": $"El remito {t.Id} se cargo correctamente":
$"Fallo la carga del remito {t.Id}"; $"Fallo la carga del remito {t.Id}";
@@ -40,6 +43,42 @@ namespace Controladora
$"Fallo la Eliminacion del remito {t.Id}"; $"Fallo la Eliminacion del remito {t.Id}";
*/ */
} }
public object ListarLotes()
{
return RepositorioLote.Instance.Listar().Where(x => x.Habilitado == true)
.ToList().AsReadOnly();
}
public ReadOnlyCollection<OrdenDeCompra> ListarOrdenesSinEntregar()
{
return RepositorioOrdenDeCompra.Instance.Listar()
.Where(x => x.Entregado == false)
.ToList()
.AsReadOnly();
}
public object ListarDetallesOrdenesDeCompra(OrdenDeCompra orden)
{
var ordenalistar = RepositorioOrdenDeCompra.Instance.Listar().First(x => x.Id == orden.Id);
if (ordenalistar == null) return new ReadOnlyCollection<DetalleOrdenDeCompra>(new List<DetalleOrdenDeCompra>());
return ordenalistar.MostrarDetalles();
}
public OrdenDeCompra? MostrarOrdenDeCompraPorId(OrdenDeCompra ordenDeCompra)
{
if (ordenDeCompra == null) return null;
if (ordenDeCompra.Id < 0) return null;
return RepositorioOrdenDeCompra.Instance.Listar().First(x => x.Id == ordenDeCompra.Id);
}
public ReadOnlyCollection<Lote> ListarLotesPorRemito(Remito rem)
{
var remalistar = RepositorioRemito.Instance.Listar().First(x => x.Id == rem.Id);
if (remalistar == null) return new ReadOnlyCollection<Lote>(new List<Lote>());
return remalistar.MostrarLotes();
}
} }
} }

View File

@@ -6,5 +6,7 @@
public string EmailPass { get; set; } public string EmailPass { get; set; }
public List<string> EmailTarget { get; set; } public List<string> EmailTarget { get; set; }
public bool Informar { get; set; }
} }
} }

View File

@@ -3,8 +3,16 @@ namespace Entidades
{ {
public class Lote: Detalle<Producto> public class Lote: Detalle<Producto>
{ {
public int IdRemito { get; set; }
public DateTime Fecha { get; set; } public DateTime Fecha { get; set; }
public bool Habilitado { get; set; } public bool Habilitado { get; set; }
public string NombreProducto
{
get
{
return Producto.Nombre;
}
}
} }
} }

View File

@@ -8,6 +8,7 @@ namespace Entidades
public int Id { get; set; } public int Id { get; set; }
private List<DetalleOrdenDeCompra> detalles = new List<DetalleOrdenDeCompra>(); private List<DetalleOrdenDeCompra> detalles = new List<DetalleOrdenDeCompra>();
public Proveedor Proveedor { get; set; } public Proveedor Proveedor { get; set; }
public bool Entregado { get; set; }
public void AñadirDetalle(DetalleOrdenDeCompra detalle) public void AñadirDetalle(DetalleOrdenDeCompra detalle)
{ {

View File

@@ -21,7 +21,7 @@ namespace Entidades
} }
} }
public List<Proveedor> proveedores = new List<Proveedor>(); private List<Proveedor> proveedores = new List<Proveedor>();
public void AñadirProveedor(Proveedor proveedor) public void AñadirProveedor(Proveedor proveedor)
{ {
@@ -38,6 +38,7 @@ namespace Entidades
{ {
return proveedores.AsReadOnly(); return proveedores.AsReadOnly();
} }
private List<Categoria> categorias = new List<Categoria>(); private List<Categoria> categorias = new List<Categoria>();
public void AñadirCategoria(Categoria cat) { public void AñadirCategoria(Categoria cat) {

View File

@@ -23,5 +23,12 @@ namespace Entidades
throw; throw;
} }
} }
public string NombreProveedor
{
get
{
return Proveedor.Nombre;
}
}
} }
} }

View File

@@ -12,6 +12,8 @@ namespace Informes
/// Envia Informes por Email /// Envia Informes por Email
/// </summary> /// </summary>
public bool Informar { get; set; }
private static InformeEmail instance = new(); private static InformeEmail instance = new();
public static InformeEmail Instance public static InformeEmail Instance
{ {

View File

@@ -1,5 +1,9 @@
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
3fd66116ceaea5e07433507fe6494c4f357d71a3a526da0eea8f6d1df7fb86c5 3fd66116ceaea5e07433507fe6494c4f357d71a3a526da0eea8f6d1df7fb86c5
======= =======
100fa21bf2f76b06ab70964d65200e354f5837e3 100fa21bf2f76b06ab70964d65200e354f5837e3
>>>>>>> a9ebcff (añadida ¿Reactividad? a que se elija entre percedero o no) >>>>>>> a9ebcff (añadida ¿Reactividad? a que se elija entre percedero o no)
=======
b8f7575a0ad69c743b6dc87a6ac87340793ee335
>>>>>>> 8b80e42 (falta que se actualize numProducto y los infomes)

View File

@@ -80,5 +80,29 @@ namespace Modelo
return ret; return ret;
} }
public bool DisminuirStock(DetalleFactura detalleFactura)
{
bool ret = false;
while (detalleFactura.Cantidad >= 0)
{
var elementoAdisminuir = almacen.Where(x=> x.Habilitado == true)
.First(x => x.Producto.Id == detalleFactura.Producto.Id);
detalleFactura.Cantidad -= elementoAdisminuir.Cantidad;
if (detalleFactura.Cantidad > 0)
{
elementoAdisminuir.Cantidad = 0;
elementoAdisminuir.Habilitado = false;
}
else
{
elementoAdisminuir.Cantidad = -detalleFactura.Cantidad;
ret = true;
}
}
return ret;
}
} }
} }

View File

@@ -68,5 +68,20 @@ namespace Modelo
{ {
return orden.MostrarDetalles(); return orden.MostrarDetalles();
} }
public bool MarcarEntregado(OrdenDeCompra orden)
{
bool ret = false;
if (orden == null) return ret;
if (orden.Id < 0) return ret;
if (orden.Entregado == false) return ret;
var ordenAModificar = almacen.FindIndex(x => x.Id == orden.Id);
if (ordenAModificar > -1)
{
almacen[ordenAModificar].Entregado = true;
ret = true;
}
return ret;
}
} }
} }

View File

@@ -47,7 +47,7 @@ namespace Modelo
return ret; return ret;
} }
override public bool Del(Remito t) override public bool Del(Remito t)
{ {
@@ -70,10 +70,5 @@ namespace Modelo
return ret; return ret;
} }
public ReadOnlyCollection<Lote> MostrarLotes(Remito remito)
{
return remito.MostrarLotes();
}
} }
} }

View File

@@ -1,122 +0,0 @@
namespace Vista
{
partial class AddProducto
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
comboBox1 = new ComboBox();
label1 = new Label();
label2 = new Label();
numericUpDown1 = new NumericUpDown();
button1 = new Button();
button2 = new Button();
((System.ComponentModel.ISupportInitialize)numericUpDown1).BeginInit();
SuspendLayout();
//
// comboBox1
//
comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
comboBox1.FormattingEnabled = true;
comboBox1.Location = new Point(98, 37);
comboBox1.Name = "comboBox1";
comboBox1.Size = new Size(121, 23);
comboBox1.TabIndex = 0;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(26, 40);
label1.Name = "label1";
label1.Size = new Size(56, 15);
label1.TabIndex = 1;
label1.Text = "Producto";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(27, 86);
label2.Name = "label2";
label2.Size = new Size(55, 15);
label2.TabIndex = 2;
label2.Text = "Cantidad";
//
// numericUpDown1
//
numericUpDown1.Location = new Point(99, 78);
numericUpDown1.Maximum = new decimal(new int[] { 10000000, 0, 0, 0 });
numericUpDown1.Name = "numericUpDown1";
numericUpDown1.Size = new Size(120, 23);
numericUpDown1.TabIndex = 3;
//
// button1
//
button1.Location = new Point(12, 160);
button1.Name = "button1";
button1.Size = new Size(71, 23);
button1.TabIndex = 4;
button1.Text = "Guardar";
button1.UseVisualStyleBackColor = true;
button1.Click += button1_Click;
//
// button2
//
button2.Location = new Point(146, 160);
button2.Name = "button2";
button2.Size = new Size(73, 23);
button2.TabIndex = 5;
button2.Text = "Cancelar";
button2.UseVisualStyleBackColor = true;
button2.Click += button2_Click;
//
// AddProducto
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(236, 201);
Controls.Add(button2);
Controls.Add(button1);
Controls.Add(numericUpDown1);
Controls.Add(label2);
Controls.Add(label1);
Controls.Add(comboBox1);
Name = "AddProducto";
Text = "Form1";
((System.ComponentModel.ISupportInitialize)numericUpDown1).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private ComboBox comboBox1;
private Label label1;
private Label label2;
private NumericUpDown numericUpDown1;
private Button button1;
private Button button2;
}
}

View File

@@ -1,30 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Vista
{
public partial class AddProducto : Form
{
public AddProducto()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Close();
}
private void button2_Click(object sender, EventArgs e)
{
Close();
}
}
}

View File

@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -129,7 +129,7 @@ namespace Vista
// //
// BtnCancelar // BtnCancelar
// //
BtnCancelar.Location = new Point(158, 190); BtnCancelar.Location = new Point(190, 190);
BtnCancelar.Name = "BtnCancelar"; BtnCancelar.Name = "BtnCancelar";
BtnCancelar.Size = new Size(75, 23); BtnCancelar.Size = new Size(75, 23);
BtnCancelar.TabIndex = 11; BtnCancelar.TabIndex = 11;
@@ -144,7 +144,6 @@ namespace Vista
numCuit.Name = "numCuit"; numCuit.Name = "numCuit";
numCuit.Size = new Size(173, 23); numCuit.Size = new Size(173, 23);
numCuit.TabIndex = 12; numCuit.TabIndex = 12;
numCuit.ValueChanged += numCuit_ValueChanged;
// //
// FrmCliente // FrmCliente
// //
@@ -152,7 +151,7 @@ namespace Vista
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
CancelButton = BtnCancelar; CancelButton = BtnCancelar;
ClientSize = new Size(420, 245); ClientSize = new Size(304, 245);
ControlBox = false; ControlBox = false;
Controls.Add(numCuit); Controls.Add(numCuit);
Controls.Add(BtnCancelar); Controls.Add(BtnCancelar);

View File

@@ -103,13 +103,6 @@ namespace Vista
MessageBox.Show(msg, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(msg, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
Close(); Close();
} }
}
private void numCuit_ValueChanged(object sender, EventArgs e)
{
} }
} }
} }

View File

@@ -18,7 +18,7 @@
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value> <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>

View File

@@ -30,7 +30,7 @@ namespace Vista
private void ActualizarGrilla() private void ActualizarGrilla()
{ {
dgvProductos.DataSource = null; dgvProductos.DataSource = null;
dgvProductos.DataSource = ControladoraProductos.Instance.Listar(); dgvProductos.DataSource = ControladoraFacturas.Instance.ListarProductos();
dgvDetalles.AutoGenerateColumns = false; dgvDetalles.AutoGenerateColumns = false;
@@ -69,7 +69,7 @@ namespace Vista
private void CargarDatos() private void CargarDatos()
{ {
// Asignar la lista de clientes como origen de datos para el ComboBox // Asignar la lista de clientes como origen de datos para el ComboBox
cmbCliente.DataSource = ControladoraClientes.Instance.Listar(); cmbCliente.DataSource = ControladoraFacturas.Instance.ListarClientes();
// Establecer la propiedad para mostrar el nombre del cliente en el ComboBox // Establecer la propiedad para mostrar el nombre del cliente en el ComboBox
cmbCliente.DisplayMember = "NombreCompleto"; cmbCliente.DisplayMember = "NombreCompleto";
@@ -127,7 +127,7 @@ namespace Vista
factura.Total = Convert.ToDouble(numtotal.Value); factura.Total = Convert.ToDouble(numtotal.Value);
factura.Fecha = datepick.Value; factura.Fecha = datepick.Value;
factura.Id = Convert.ToInt32(numid.Value); factura.Id = Convert.ToInt32(numid.Value);
factura.Cliente = ControladoraClientes.Instance.Listar().First(x => x.NombreCompleto == cmbCliente.SelectedValue.ToString()); factura.Cliente = ControladoraFacturas.Instance.ListarClientes().First(x => x.NombreCompleto == cmbCliente.SelectedValue.ToString());
string mensaje = ControladoraFacturas.Instance.Añadir(factura); string mensaje = ControladoraFacturas.Instance.Añadir(factura);
MessageBox.Show(mensaje, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(mensaje, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);

View File

@@ -38,6 +38,7 @@
btnAñadir = new Button(); btnAñadir = new Button();
btnGuardar = new Button(); btnGuardar = new Button();
btnEliminar = new Button(); btnEliminar = new Button();
checkinfome = new CheckBox();
((System.ComponentModel.ISupportInitialize)dgvEmailTarget).BeginInit(); ((System.ComponentModel.ISupportInitialize)dgvEmailTarget).BeginInit();
SuspendLayout(); SuspendLayout();
// //
@@ -133,11 +134,22 @@
btnEliminar.UseVisualStyleBackColor = true; btnEliminar.UseVisualStyleBackColor = true;
btnEliminar.Click += btnEliminar_Click; btnEliminar.Click += btnEliminar_Click;
// //
// checkinfome
//
checkinfome.AutoSize = true;
checkinfome.Location = new Point(335, 22);
checkinfome.Name = "checkinfome";
checkinfome.Size = new Size(121, 19);
checkinfome.TabIndex = 10;
checkinfome.Text = "Habilitar Informes";
checkinfome.UseVisualStyleBackColor = true;
//
// FrmInforme // FrmInforme
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450); ClientSize = new Size(800, 450);
Controls.Add(checkinfome);
Controls.Add(btnEliminar); Controls.Add(btnEliminar);
Controls.Add(btnGuardar); Controls.Add(btnGuardar);
Controls.Add(btnAñadir); Controls.Add(btnAñadir);
@@ -168,5 +180,6 @@
private Button btnAñadir; private Button btnAñadir;
private Button btnGuardar; private Button btnGuardar;
private Button btnEliminar; private Button btnEliminar;
private CheckBox checkinfome;
} }
} }

View File

@@ -1,4 +1,5 @@
using Informes; using Controladora;
using Informes;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@@ -14,19 +15,11 @@ namespace Vista
{ {
public partial class FrmInforme : Form public partial class FrmInforme : Form
{ {
const string configpath = "settings.json";
public FrmInforme() public FrmInforme()
{ {
InitializeComponent(); InitializeComponent();
if (!File.Exists(configpath)) ConfigEmail config = ControladoraInformes.Instance.RecuperarConfig();
{
string json = JsonSerializer.Serialize(new ConfigEmail { EmailAddr = "", EmailPass = "", EmailTarget = new List<String>() }, new JsonSerializerOptions { WriteIndented = true });
File.WriteAllText(configpath, json);
}
string jsonString = File.ReadAllText(configpath);
ConfigEmail config = JsonSerializer.Deserialize<ConfigEmail>(jsonString);
CargaDatos(config); CargaDatos(config);
} }
@@ -60,11 +53,13 @@ namespace Vista
{ {
EmailAddr = txtEmailAddr.Text, EmailAddr = txtEmailAddr.Text,
EmailPass = txtEmailPass.Text, EmailPass = txtEmailPass.Text,
EmailTarget = emailTarget EmailTarget = emailTarget,
Informar = checkinfome.Checked
}; };
string json = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true }); ControladoraInformes.Instance.GuardarConfig(config);
File.WriteAllText(configpath, json);
} }
private void btnAñadir_Click(object sender, EventArgs e) private void btnAñadir_Click(object sender, EventArgs e)

View File

@@ -38,7 +38,7 @@ namespace Vista
} }
dgvProveedor.DataSource = null; dgvProveedor.DataSource = null;
dgvProveedor.DataSource = ControladoraProveedores.Instance.Listar(); dgvProveedor.DataSource = ControladoraOrdenDeCompras.Instance.ListarProveedores();
} }
@@ -53,7 +53,7 @@ namespace Vista
{ {
Id = Convert.ToInt32(selectedRow.Cells["Id"].Value.ToString()), Id = Convert.ToInt32(selectedRow.Cells["Id"].Value.ToString()),
}; };
pres = ControladoraPresupuestos.Instance.MostrarPresupuestoPorId(pres); pres = ControladoraOrdenDeCompras.Instance.MostrarPresupuestoPorId(pres);
if (pres == null) if (pres == null)
{ {
@@ -61,7 +61,7 @@ namespace Vista
return; return;
} }
var listadetalle = ControladoraPresupuestos.Instance.ListarDetalles(pres); var listadetalle = ControladoraOrdenDeCompras.Instance.ListarDetallesDePresupuesto(pres);
foreach (var detalle in listadetalle) foreach (var detalle in listadetalle)
{ {
@@ -106,7 +106,7 @@ namespace Vista
}; };
// Obtén los detalles del presupuesto usando el método de la controladora // Obtén los detalles del presupuesto usando el método de la controladora
var detallesPresupuesto = ControladoraPresupuestos.Instance.ListarDetalles(presupuesto); var detallesPresupuesto = ControladoraOrdenDeCompras.Instance.ListarDetallesDePresupuesto(presupuesto);
// Crea una lista para mostrar el proveedor y los detalles del presupuesto // Crea una lista para mostrar el proveedor y los detalles del presupuesto
var proveedorYDetalles = detallesPresupuesto.Select(d => new var proveedorYDetalles = detallesPresupuesto.Select(d => new
@@ -166,10 +166,10 @@ namespace Vista
var selectedRow = dgvProveedor.SelectedRows[0]; var selectedRow = dgvProveedor.SelectedRows[0];
var proveedor = new Proveedor var proveedor = new Proveedor
{ {
Cuit = Convert.ToInt32(selectedRow.Cells["Cuit"].Value), Cuit = Convert.ToInt64(selectedRow.Cells["Cuit"].Value),
}; };
var presupuestos = ControladoraPresupuestos.Instance.ListarPresupuestosPorProveedor(proveedor); var presupuestos = ControladoraOrdenDeCompras.Instance.ListarPresupuestosPorProveedorHabilitados(proveedor);
dgvPresupuesto.DataSource = null; dgvPresupuesto.DataSource = null;
dgvPresupuesto.DataSource = presupuestos; dgvPresupuesto.DataSource = presupuestos;

View File

@@ -58,7 +58,7 @@
dgvProducto.AllowUserToDeleteRows = false; dgvProducto.AllowUserToDeleteRows = false;
dgvProducto.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dgvProducto.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvProducto.EditMode = DataGridViewEditMode.EditProgrammatically; dgvProducto.EditMode = DataGridViewEditMode.EditProgrammatically;
dgvProducto.Location = new Point(244, 26); dgvProducto.Location = new Point(631, 32);
dgvProducto.MultiSelect = false; dgvProducto.MultiSelect = false;
dgvProducto.Name = "dgvProducto"; dgvProducto.Name = "dgvProducto";
dgvProducto.RowTemplate.Height = 25; dgvProducto.RowTemplate.Height = 25;
@@ -79,7 +79,7 @@
// label2 // label2
// //
label2.AutoSize = true; label2.AutoSize = true;
label2.Location = new Point(597, 8); label2.Location = new Point(249, 14);
label2.Name = "label2"; label2.Name = "label2";
label2.Size = new Size(55, 15); label2.Size = new Size(55, 15);
label2.TabIndex = 3; label2.TabIndex = 3;
@@ -139,13 +139,14 @@
dgvProveedor.AllowUserToDeleteRows = false; dgvProveedor.AllowUserToDeleteRows = false;
dgvProveedor.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dgvProveedor.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvProveedor.EditMode = DataGridViewEditMode.EditProgrammatically; dgvProveedor.EditMode = DataGridViewEditMode.EditProgrammatically;
dgvProveedor.Location = new Point(597, 26); dgvProveedor.Location = new Point(249, 32);
dgvProveedor.MultiSelect = false; dgvProveedor.MultiSelect = false;
dgvProveedor.Name = "dgvProveedor"; dgvProveedor.Name = "dgvProveedor";
dgvProveedor.RowTemplate.Height = 25; dgvProveedor.RowTemplate.Height = 25;
dgvProveedor.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvProveedor.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvProveedor.Size = new Size(376, 338); dgvProveedor.Size = new Size(376, 338);
dgvProveedor.TabIndex = 13; dgvProveedor.TabIndex = 13;
dgvProveedor.CellClick += dgvProveedor_CellClick;
// //
// dgvPedido // dgvPedido
// //
@@ -160,7 +161,7 @@
// label1 // label1
// //
label1.AutoSize = true; label1.AutoSize = true;
label1.Location = new Point(244, 8); label1.Location = new Point(626, 9);
label1.Name = "label1"; label1.Name = "label1";
label1.Size = new Size(56, 15); label1.Size = new Size(56, 15);
label1.TabIndex = 15; label1.TabIndex = 15;

View File

@@ -25,8 +25,8 @@ namespace Vista
private void CargarDatos() private void CargarDatos()
{ {
dgvProducto.DataSource = null; dgvProveedor.DataSource = null;
dgvProducto.DataSource = ControladoraProductos.Instance.Listar(); dgvProveedor.DataSource = ControladoraPresupuestos.Instance.ListarProveedores();
var presupuestolist = ControladoraPresupuestos.Instance.Listar(); var presupuestolist = ControladoraPresupuestos.Instance.Listar();
numId.Value = (presupuestolist.Count > 0) ? numId.Value = (presupuestolist.Count > 0) ?
@@ -144,26 +144,19 @@ namespace Vista
// Añadir el detalle al presupuesto // Añadir el detalle al presupuesto
presupuesto.AñadirDetalle(detalle); presupuesto.AñadirDetalle(detalle);
//bloqueamos el dgv de proveedor porque solo se puede cargar un presupuesto
//donde todos los productos provengan de un mismo proveedor.
dgvProveedor.Enabled = false;
// Actualizar el DataGridView // Actualizar el DataGridView
dgvPedido.DataSource = null; dgvPedido.DataSource = null;
dgvPedido.DataSource = presupuesto.MostrarDetalles(); dgvPedido.DataSource = presupuesto.MostrarDetalles();
// Configura las columnas a mostrar y sus encabezados // Configura las columnas a mostrar y sus encabezados
dgvPedido.Columns["IDPresupuesto"].Visible = true;
dgvPedido.Columns["Cantidad"].Visible = true;
dgvPedido.Columns["NombreDelProducto"].Visible = true;
dgvPedido.Columns["IDPresupuesto"].HeaderText = "ID Presupuesto";
dgvPedido.Columns["Cantidad"].HeaderText = "Cantidad";
dgvPedido.Columns["NombreDelProducto"].HeaderText = "Producto";
// Oculta todas las demás columnas
foreach (DataGridViewColumn column in dgvPedido.Columns) foreach (DataGridViewColumn column in dgvPedido.Columns)
{ {
if (column.Name != "IDPresupuesto" && column.Name != "Cantidad" && column.Name != "NombreDelProducto") column.Visible = column.Name == "IdPresupuesto" || column.Name == "Cantidad"
{ || column.Name == "NombreDelProducto";
column.Visible = false;
}
} }
} }
catch (OverflowException ex) catch (OverflowException ex)
@@ -186,14 +179,14 @@ namespace Vista
{ {
string ret = ""; string ret = "";
if (numCantidad.Value <= 0) ret += "Cantidad de productos invalida"; if (numCantidad.Value <= 0) ret += "Cantidad de productos invalida\n";
if (numPreciopropuesto.Value <= 0) ret += "Precio C/U Invalido"; if (numPreciopropuesto.Value <= 0) ret += "Precio C/U Invalido\n";
if (ret == "") if (ret == "")
{ {
return false; return false;
} }
MessageBox.Show("ret"); MessageBox.Show(ret);
return true; return true;
} }
@@ -263,15 +256,20 @@ namespace Vista
private void dgvProducto_CellClick(object sender, DataGridViewCellEventArgs e) private void dgvProducto_CellClick(object sender, DataGridViewCellEventArgs e)
{ {
if (dgvProducto.SelectedRows.Count == 0) return;
if (dgvProducto.SelectedRows.Count > 0) }
private void dgvProveedor_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (dgvProveedor.SelectedRows.Count == 0) return;
if (dgvProveedor.SelectedRows.Count > 0)
{ {
Producto producto = new Producto var proveedor = new Proveedor
{ {
Id = Convert.ToInt32(dgvProducto.SelectedRows[0].Cells["Id"].Value.ToString()), Cuit = Convert.ToInt64(dgvProveedor.SelectedRows[0].Cells["Cuit"].Value.ToString()),
}; };
dgvProveedor.DataSource = ControladoraProductos.Instance.ListarProveedores(producto); dgvProducto.DataSource = ControladoraPresupuestos.Instance.ListarProductosPorProveedor(proveedor);
} }
} }
} }

View File

@@ -64,7 +64,6 @@
// numtotal // numtotal
// //
numtotal.Enabled = false; numtotal.Enabled = false;
numtotal.ImeMode = ImeMode.NoControl;
numtotal.InterceptArrowKeys = false; numtotal.InterceptArrowKeys = false;
numtotal.Location = new Point(665, 263); numtotal.Location = new Point(665, 263);
numtotal.Maximum = new decimal(new int[] { -727379969, 232, 0, 0 }); numtotal.Maximum = new decimal(new int[] { -727379969, 232, 0, 0 });

View File

@@ -89,13 +89,8 @@ namespace Vista
|| column.Name == "Subtotal"; || column.Name == "Subtotal";
} }
numtotal.Value = Convert.ToDecimal(detallesPresupuesto.Sum(x => x.Subtotal).ToString());
numtotal.Value = Convert.ToDecimal(presupuesto.MostrarDetalles().Sum(x => x.Subtotal));
// Asegúrate de que solo las columnas que deseas mostrar están visibles
//foreach (DataGridViewColumn column in dgvdetallesPresupuesto.Columns)
//{
// column.Visible = column.Name == "NombreDelProducto" || column.Name == "Cantidad";
//}
} }
private void BtnEliminar_Click(object sender, EventArgs e) private void BtnEliminar_Click(object sender, EventArgs e)
@@ -125,8 +120,8 @@ namespace Vista
// Actualiza la grilla de presupuestos después de eliminar el presupuesto // Actualiza la grilla de presupuestos después de eliminar el presupuesto
ActualizarGrilla(); ActualizarGrilla();
// Limpia o actualiza el dgvDetalles para reflejar que el presupuesto ha sido eliminado
dgvdetallesPresupuesto.DataSource = null; // O actualiza el datasource si tienes uno dgvdetallesPresupuesto.DataSource = null;
MessageBox.Show("Presupuesto eliminado exitosamente."); MessageBox.Show("Presupuesto eliminado exitosamente.");
} }

View File

@@ -50,7 +50,7 @@ namespace Vista
private void CargarTabla() private void CargarTabla()
{ {
dgvProveedor.DataSource = null; dgvProveedor.DataSource = null;
dgvProveedor.DataSource = ControladoraProveedores.Instance.Listar(); dgvProveedor.DataSource = ControladoraProductos.Instance.ListarProveedores();
if (mod) if (mod)
{ {
foreach (Proveedor prov in ControladoraProductos.Instance.ListarProveedores(nuevoproducto)) foreach (Proveedor prov in ControladoraProductos.Instance.ListarProveedores(nuevoproducto))
@@ -135,7 +135,6 @@ namespace Vista
{ {
if (ValidarDatos()) if (ValidarDatos())
{ {
var proveedores = new List<Proveedor>(nuevoproducto.ListarProveedores());
if (checkBox1.Checked) // Producto Perecedero if (checkBox1.Checked) // Producto Perecedero
{ {
@@ -148,9 +147,13 @@ namespace Vista
Categoria = (Categoria)cmbCategoria.SelectedItem, Categoria = (Categoria)cmbCategoria.SelectedItem,
MesesHastaConsumoPreferente = (int)numericUpDown1.Value, MesesHastaConsumoPreferente = (int)numericUpDown1.Value,
MesesHastaVencimiento = (int)numericUpDown2.Value, MesesHastaVencimiento = (int)numericUpDown2.Value,
proveedores = proveedores
}; };
foreach (var proveedor in nuevoproducto.ListarProveedores())
{
productoPerecedero.AñadirProveedor(proveedor);
}
string mensaje = mod string mensaje = mod
? ControladoraProductos.Instance.Modificar(productoPerecedero) ? ControladoraProductos.Instance.Modificar(productoPerecedero)
: ControladoraProductos.Instance.Añadir(productoPerecedero); : ControladoraProductos.Instance.Añadir(productoPerecedero);
@@ -167,9 +170,12 @@ namespace Vista
Habilitado = checkHabilitado.Checked, Habilitado = checkHabilitado.Checked,
Categoria = (Categoria)cmbCategoria.SelectedItem, Categoria = (Categoria)cmbCategoria.SelectedItem,
TipoDeEnvase = (EnvaseTipo)comboBox1.SelectedItem, TipoDeEnvase = (EnvaseTipo)comboBox1.SelectedItem,
proveedores = proveedores
}; };
foreach (var proveedor in nuevoproducto.ListarProveedores())
{
productoNoPerecedero.AñadirProveedor(proveedor);
}
string mensaje = mod string mensaje = mod
? ControladoraProductos.Instance.Modificar(productoNoPerecedero) ? ControladoraProductos.Instance.Modificar(productoNoPerecedero)
: ControladoraProductos.Instance.Añadir(productoNoPerecedero); : ControladoraProductos.Instance.Añadir(productoNoPerecedero);

View File

@@ -43,16 +43,21 @@
dgvNoPercedero = new DataGridView(); dgvNoPercedero = new DataGridView();
label4 = new Label(); label4 = new Label();
label5 = new Label(); label5 = new Label();
label6 = new Label();
numStock = new NumericUpDown();
groupBox1.SuspendLayout(); groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dgvProveedores).BeginInit(); ((System.ComponentModel.ISupportInitialize)dgvProveedores).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvProductos).BeginInit(); ((System.ComponentModel.ISupportInitialize)dgvProductos).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvCategorias).BeginInit(); ((System.ComponentModel.ISupportInitialize)dgvCategorias).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvPercedero).BeginInit(); ((System.ComponentModel.ISupportInitialize)dgvPercedero).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvNoPercedero).BeginInit(); ((System.ComponentModel.ISupportInitialize)dgvNoPercedero).BeginInit();
((System.ComponentModel.ISupportInitialize)numStock).BeginInit();
SuspendLayout(); SuspendLayout();
// //
// groupBox1 // groupBox1
// //
groupBox1.Controls.Add(numStock);
groupBox1.Controls.Add(label6);
groupBox1.Controls.Add(btnModificar); groupBox1.Controls.Add(btnModificar);
groupBox1.Controls.Add(label3); groupBox1.Controls.Add(label3);
groupBox1.Controls.Add(dgvProveedores); groupBox1.Controls.Add(dgvProveedores);
@@ -62,7 +67,7 @@
groupBox1.Controls.Add(BtnEliminar); groupBox1.Controls.Add(BtnEliminar);
groupBox1.Location = new Point(12, 0); groupBox1.Location = new Point(12, 0);
groupBox1.Name = "groupBox1"; groupBox1.Name = "groupBox1";
groupBox1.Size = new Size(939, 305); groupBox1.Size = new Size(1196, 305);
groupBox1.TabIndex = 5; groupBox1.TabIndex = 5;
groupBox1.TabStop = false; groupBox1.TabStop = false;
// //
@@ -92,7 +97,7 @@
dgvProveedores.Name = "dgvProveedores"; dgvProveedores.Name = "dgvProveedores";
dgvProveedores.RowTemplate.Height = 25; dgvProveedores.RowTemplate.Height = 25;
dgvProveedores.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvProveedores.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvProveedores.Size = new Size(280, 235); dgvProveedores.Size = new Size(577, 235);
dgvProveedores.TabIndex = 9; dgvProveedores.TabIndex = 9;
// //
// label2 // label2
@@ -139,7 +144,7 @@
// //
// btnCrearCategoria // btnCrearCategoria
// //
btnCrearCategoria.Location = new Point(966, 263); btnCrearCategoria.Location = new Point(958, 582);
btnCrearCategoria.Name = "btnCrearCategoria"; btnCrearCategoria.Name = "btnCrearCategoria";
btnCrearCategoria.Size = new Size(128, 23); btnCrearCategoria.Size = new Size(128, 23);
btnCrearCategoria.TabIndex = 4; btnCrearCategoria.TabIndex = 4;
@@ -152,7 +157,7 @@
dgvCategorias.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgvCategorias.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dgvCategorias.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dgvCategorias.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvCategorias.EditMode = DataGridViewEditMode.EditProgrammatically; dgvCategorias.EditMode = DataGridViewEditMode.EditProgrammatically;
dgvCategorias.Location = new Point(966, 22); dgvCategorias.Location = new Point(958, 341);
dgvCategorias.Name = "dgvCategorias"; dgvCategorias.Name = "dgvCategorias";
dgvCategorias.RowTemplate.Height = 25; dgvCategorias.RowTemplate.Height = 25;
dgvCategorias.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvCategorias.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
@@ -162,7 +167,7 @@
// label1 // label1
// //
label1.AutoSize = true; label1.AutoSize = true;
label1.Location = new Point(969, 4); label1.Location = new Point(961, 323);
label1.Name = "label1"; label1.Name = "label1";
label1.Size = new Size(63, 15); label1.Size = new Size(63, 15);
label1.TabIndex = 7; label1.TabIndex = 7;
@@ -214,6 +219,23 @@
label5.TabIndex = 13; label5.TabIndex = 13;
label5.Text = "Productos Percederos"; label5.Text = "Productos Percederos";
// //
// label6
//
label6.AutoSize = true;
label6.Location = new Point(275, 271);
label6.Name = "label6";
label6.Size = new Size(36, 15);
label6.TabIndex = 12;
label6.Text = "Stock";
//
// numStock
//
numStock.Enabled = false;
numStock.Location = new Point(317, 269);
numStock.Name = "numStock";
numStock.Size = new Size(120, 23);
numStock.TabIndex = 13;
//
// FrmProductos // FrmProductos
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
@@ -237,6 +259,7 @@
((System.ComponentModel.ISupportInitialize)dgvCategorias).EndInit(); ((System.ComponentModel.ISupportInitialize)dgvCategorias).EndInit();
((System.ComponentModel.ISupportInitialize)dgvPercedero).EndInit(); ((System.ComponentModel.ISupportInitialize)dgvPercedero).EndInit();
((System.ComponentModel.ISupportInitialize)dgvNoPercedero).EndInit(); ((System.ComponentModel.ISupportInitialize)dgvNoPercedero).EndInit();
((System.ComponentModel.ISupportInitialize)numStock).EndInit();
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
} }
@@ -258,5 +281,7 @@
private DataGridView dgvNoPercedero; private DataGridView dgvNoPercedero;
private Label label4; private Label label4;
private Label label5; private Label label5;
private NumericUpDown numStock;
private Label label6;
} }
} }

View File

@@ -168,7 +168,7 @@ namespace Vista
dgvProductos.DataSource = null; dgvProductos.DataSource = null;
dgvCategorias.DataSource = null; dgvCategorias.DataSource = null;
var categorias = ControladoraCategorias.Instance.Listar(); var categorias = ControladoraProductos.Instance.ListarCategorias();
dgvCategorias.DataSource = categorias; dgvCategorias.DataSource = categorias;
// Obtener la lista de productos y proyectar los datos // Obtener la lista de productos y proyectar los datos
@@ -245,12 +245,12 @@ namespace Vista
Id = Convert.ToInt32(selectedRow.Cells["Id"].Value) Id = Convert.ToInt32(selectedRow.Cells["Id"].Value)
}; };
bool esPercedero = Convert.ToBoolean(selectedRow.Cells["EsPerecedero"].Value); bool esPercedero = Convert.ToBoolean(selectedRow.Cells["EsPerecedero"].Value);
if(esPercedero) if (esPercedero)
{ {
ProductoPercedero prod = (ProductoPercedero)ControladoraProductos.Instance.MostrarPorId(Producto); ProductoPercedero prod = (ProductoPercedero)ControladoraProductos.Instance.MostrarPorId(Producto);
if (prod == null) return; if (prod == null) return;
dgvPercedero.DataSource = new List<ProductoPercedero>{ prod }; dgvPercedero.DataSource = new List<ProductoPercedero> { prod };
} }
else else
{ {

View File

@@ -28,12 +28,121 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.components = new System.ComponentModel.Container(); dgvOrdenDeCompra = new DataGridView();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; label1 = new Label();
this.ClientSize = new System.Drawing.Size(800, 450); label2 = new Label();
this.Text = "Remito"; dgvDetalles = new DataGridView();
BtnAdd = new Button();
label3 = new Label();
numId = new NumericUpDown();
((System.ComponentModel.ISupportInitialize)dgvOrdenDeCompra).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvDetalles).BeginInit();
((System.ComponentModel.ISupportInitialize)numId).BeginInit();
SuspendLayout();
//
// dgvOrdenDeCompra
//
dgvOrdenDeCompra.AllowUserToAddRows = false;
dgvOrdenDeCompra.AllowUserToDeleteRows = false;
dgvOrdenDeCompra.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dgvOrdenDeCompra.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvOrdenDeCompra.EditMode = DataGridViewEditMode.EditProgrammatically;
dgvOrdenDeCompra.Location = new Point(12, 23);
dgvOrdenDeCompra.Name = "dgvOrdenDeCompra";
dgvOrdenDeCompra.RowTemplate.Height = 25;
dgvOrdenDeCompra.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvOrdenDeCompra.Size = new Size(368, 235);
dgvOrdenDeCompra.TabIndex = 4;
dgvOrdenDeCompra.CellClick += dgvOrdenDeCompra_CellClick;
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(12, 5);
label1.Name = "label1";
label1.Size = new Size(102, 15);
label1.TabIndex = 7;
label1.Text = "Orden de Compra";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(386, 9);
label2.Name = "label2";
label2.Size = new Size(48, 15);
label2.TabIndex = 8;
label2.Text = "Detalles";
//
// dgvDetalles
//
dgvDetalles.AllowUserToAddRows = false;
dgvDetalles.AllowUserToDeleteRows = false;
dgvDetalles.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dgvDetalles.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvDetalles.EditMode = DataGridViewEditMode.EditProgrammatically;
dgvDetalles.Location = new Point(386, 23);
dgvDetalles.Name = "dgvDetalles";
dgvDetalles.RowTemplate.Height = 25;
dgvDetalles.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvDetalles.Size = new Size(368, 235);
dgvDetalles.TabIndex = 9;
//
// BtnAdd
//
BtnAdd.Location = new Point(12, 264);
BtnAdd.Name = "BtnAdd";
BtnAdd.Size = new Size(165, 23);
BtnAdd.TabIndex = 10;
BtnAdd.Text = "Certificar Llegada Productos";
BtnAdd.UseVisualStyleBackColor = true;
BtnAdd.Click += BtnAdd_Click;
//
// label3
//
label3.AutoSize = true;
label3.Location = new Point(225, 269);
label3.Name = "label3";
label3.Size = new Size(17, 15);
label3.TabIndex = 11;
label3.Text = "Id";
//
// numId
//
numId.Enabled = false;
numId.Location = new Point(248, 266);
numId.Name = "numId";
numId.Size = new Size(120, 23);
numId.TabIndex = 12;
//
// FrmRemito
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 293);
Controls.Add(numId);
Controls.Add(label3);
Controls.Add(BtnAdd);
Controls.Add(dgvDetalles);
Controls.Add(label2);
Controls.Add(label1);
Controls.Add(dgvOrdenDeCompra);
Name = "FrmRemito";
Text = "Remito";
((System.ComponentModel.ISupportInitialize)dgvOrdenDeCompra).EndInit();
((System.ComponentModel.ISupportInitialize)dgvDetalles).EndInit();
((System.ComponentModel.ISupportInitialize)numId).EndInit();
ResumeLayout(false);
PerformLayout();
} }
#endregion #endregion
private DataGridView dgvOrdenDeCompra;
private Label label1;
private Label label2;
private DataGridView dgvDetalles;
private Button BtnAdd;
private Label label3;
private NumericUpDown numId;
} }
} }

View File

@@ -1,4 +1,6 @@
using System; using Controladora;
using Entidades;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
@@ -15,6 +17,76 @@ namespace Vista
public FrmRemito() public FrmRemito()
{ {
InitializeComponent(); InitializeComponent();
ActualizarTablaOrdendeCompra();
}
private void ActualizarTablaOrdendeCompra()
{
dgvOrdenDeCompra.DataSource = null;
dgvOrdenDeCompra.DataSource = ControladoraRemito.Instance.ListarOrdenesSinEntregar();
foreach (DataGridViewColumn column in dgvOrdenDeCompra.Columns)
{
column.Visible = column.Name == "Id" || column.Name == "NombreProveedor"
|| column.Name == "MontoTotal";
}
numId.Value = (ControladoraRemito.Instance.Listar().Count) > 0 ?
ControladoraRemito.Instance.Listar().Max(x=> x.Id+1):
0;
}
private void dgvOrdenDeCompra_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (dgvOrdenDeCompra.SelectedRows.Count == 0) return;
int ordenid = Convert.ToInt32(dgvOrdenDeCompra.SelectedRows[0].Cells["Id"].Value.ToString());
var orden = new OrdenDeCompra { Id = ordenid };
var detallesorden = ControladoraRemito.Instance.ListarDetallesOrdenesDeCompra(orden);
dgvDetalles.DataSource = null;
dgvDetalles.DataSource = detallesorden;
foreach (DataGridViewColumn column in dgvDetalles.Columns)
{
column.Visible = column.Name == "IdPresupuesto" || column.Name == "NombreProducto" || column.Name == "MontoCU"
|| column.Name == "Cantidad" || column.Name == "SubTotal";
}
}
private void BtnAdd_Click(object sender, EventArgs e)
{
if (dgvOrdenDeCompra.SelectedRows.Count <= 0) return;
var selectedRow = dgvOrdenDeCompra.SelectedRows[0];
var orden = new OrdenDeCompra
{
Id = Convert.ToInt32(selectedRow.Cells["Id"].Value.ToString()),
};
orden = ControladoraRemito.Instance.MostrarOrdenDeCompraPorId(orden);
orden.Entregado = true;
if (orden == null) return;
var remito = new Remito
{
Id = Convert.ToInt32(numId.Value),
Proveedor = orden.Proveedor
};
foreach (var detalle in orden.MostrarDetalles())
{
Lote lote = new Lote
{
Id = detalle.Id,
Cantidad = detalle.Cantidad,
Fecha = DateTime.Now,
Habilitado = true,
IdRemito = remito.Id,
Producto = detalle.Producto,
};
remito.AñadirLote(lote);
}
var msg = ControladoraRemito.Instance.Añadir(remito, orden);
MessageBox.Show(msg);
this.Close();
} }
} }
} }

View File

@@ -1,24 +1,24 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<root> <root>
<!-- <!--
Microsoft ResX Schema Microsoft ResX Schema
Version 2.0 Version 2.0
The primary goals of this format is to allow a simple XML format The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes various data types are done through the TypeConverter classes
associated with the data types. associated with the data types.
Example: Example:
... ado.net/XML headers & schema ... ... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader> <resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value> <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>
@@ -26,36 +26,36 @@
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment> <comment>This is a comment</comment>
</data> </data>
There are any number of "resheader" rows that contain simple There are any number of "resheader" rows that contain simple
name/value pairs. name/value pairs.
Each data row contains a name, and value. The row also contains a Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture. text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the Classes that don't support this are serialized and stored with the
mimetype set. mimetype set.
The mimetype is used for serialized objects, and tells the The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly: extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below. read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64 mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64 mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64 mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter : using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding. : and then encoded with base64 encoding.
--> -->

View File

@@ -29,24 +29,93 @@
private void InitializeComponent() private void InitializeComponent()
{ {
groupBox1 = new GroupBox(); groupBox1 = new GroupBox();
label3 = new Label();
label2 = new Label();
label1 = new Label();
dgvTodosLotes = new DataGridView();
dgvDetallesRemito = new DataGridView();
dgvRemito = new DataGridView(); dgvRemito = new DataGridView();
BtnAdd = new Button(); BtnAdd = new Button();
groupBox1.SuspendLayout(); groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dgvTodosLotes).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvDetallesRemito).BeginInit();
((System.ComponentModel.ISupportInitialize)dgvRemito).BeginInit(); ((System.ComponentModel.ISupportInitialize)dgvRemito).BeginInit();
SuspendLayout(); SuspendLayout();
// //
// groupBox1 // groupBox1
// //
groupBox1.Controls.Add(label3);
groupBox1.Controls.Add(label2);
groupBox1.Controls.Add(label1);
groupBox1.Controls.Add(dgvTodosLotes);
groupBox1.Controls.Add(dgvDetallesRemito);
groupBox1.Controls.Add(dgvRemito); groupBox1.Controls.Add(dgvRemito);
groupBox1.Controls.Add(BtnAdd); groupBox1.Controls.Add(BtnAdd);
groupBox1.Location = new Point(12, 12); groupBox1.Location = new Point(12, 12);
groupBox1.Name = "groupBox1"; groupBox1.Name = "groupBox1";
groupBox1.Size = new Size(776, 351); groupBox1.Size = new Size(1183, 432);
groupBox1.TabIndex = 5; groupBox1.TabIndex = 5;
groupBox1.TabStop = false; groupBox1.TabStop = false;
// //
// label3
//
label3.AutoSize = true;
label3.Location = new Point(6, 301);
label3.Name = "label3";
label3.Size = new Size(90, 15);
label3.TabIndex = 8;
label3.Text = "Todos Los Lotes";
//
// label2
//
label2.AutoSize = true;
label2.Location = new Point(562, 4);
label2.Name = "label2";
label2.Size = new Size(48, 15);
label2.TabIndex = 7;
label2.Text = "Detalles";
//
// label1
//
label1.AutoSize = true;
label1.Location = new Point(6, 4);
label1.Name = "label1";
label1.Size = new Size(50, 15);
label1.TabIndex = 6;
label1.Text = "Remitos";
//
// dgvTodosLotes
//
dgvTodosLotes.AllowUserToAddRows = false;
dgvTodosLotes.AllowUserToDeleteRows = false;
dgvTodosLotes.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dgvTodosLotes.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvTodosLotes.EditMode = DataGridViewEditMode.EditProgrammatically;
dgvTodosLotes.Location = new Point(0, 319);
dgvTodosLotes.Name = "dgvTodosLotes";
dgvTodosLotes.RowTemplate.Height = 25;
dgvTodosLotes.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvTodosLotes.Size = new Size(1171, 107);
dgvTodosLotes.TabIndex = 5;
//
// dgvDetallesRemito
//
dgvDetallesRemito.AllowUserToAddRows = false;
dgvDetallesRemito.AllowUserToDeleteRows = false;
dgvDetallesRemito.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dgvDetallesRemito.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvDetallesRemito.EditMode = DataGridViewEditMode.EditProgrammatically;
dgvDetallesRemito.Location = new Point(562, 22);
dgvDetallesRemito.Name = "dgvDetallesRemito";
dgvDetallesRemito.RowTemplate.Height = 25;
dgvDetallesRemito.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvDetallesRemito.Size = new Size(609, 235);
dgvDetallesRemito.TabIndex = 4;
//
// dgvRemito // dgvRemito
// //
dgvRemito.AllowUserToAddRows = false;
dgvRemito.AllowUserToDeleteRows = false;
dgvRemito.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgvRemito.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dgvRemito.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dgvRemito.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dgvRemito.EditMode = DataGridViewEditMode.EditProgrammatically; dgvRemito.EditMode = DataGridViewEditMode.EditProgrammatically;
@@ -56,26 +125,31 @@
dgvRemito.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvRemito.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvRemito.Size = new Size(550, 235); dgvRemito.Size = new Size(550, 235);
dgvRemito.TabIndex = 3; dgvRemito.TabIndex = 3;
dgvRemito.CellClick += dgvRemito_CellClick;
// //
// BtnAdd // BtnAdd
// //
BtnAdd.Location = new Point(6, 302); BtnAdd.Location = new Point(6, 263);
BtnAdd.Name = "BtnAdd"; BtnAdd.Name = "BtnAdd";
BtnAdd.Size = new Size(75, 23); BtnAdd.Size = new Size(75, 23);
BtnAdd.TabIndex = 0; BtnAdd.TabIndex = 0;
BtnAdd.Text = "Añadir"; BtnAdd.Text = "Añadir";
BtnAdd.UseVisualStyleBackColor = true; BtnAdd.UseVisualStyleBackColor = true;
BtnAdd.Click += BtnAdd_Click;
// //
// FrmRemitos // FrmRemitos
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 450); ClientSize = new Size(1281, 450);
Controls.Add(groupBox1); Controls.Add(groupBox1);
Name = "FrmRemitos"; Name = "FrmRemitos";
Text = "Remitos"; Text = "Remitos";
WindowState = FormWindowState.Maximized; WindowState = FormWindowState.Maximized;
groupBox1.ResumeLayout(false); groupBox1.ResumeLayout(false);
groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)dgvTodosLotes).EndInit();
((System.ComponentModel.ISupportInitialize)dgvDetallesRemito).EndInit();
((System.ComponentModel.ISupportInitialize)dgvRemito).EndInit(); ((System.ComponentModel.ISupportInitialize)dgvRemito).EndInit();
ResumeLayout(false); ResumeLayout(false);
} }
@@ -85,5 +159,10 @@
private GroupBox groupBox1; private GroupBox groupBox1;
private DataGridView dgvRemito; private DataGridView dgvRemito;
private Button BtnAdd; private Button BtnAdd;
private Label label3;
private Label label2;
private Label label1;
private DataGridView dgvTodosLotes;
private DataGridView dgvDetallesRemito;
} }
} }

View File

@@ -1,4 +1,6 @@
using System; using Controladora;
using Entidades;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
@@ -15,6 +17,48 @@ namespace Vista
public FrmRemitos() public FrmRemitos()
{ {
InitializeComponent(); InitializeComponent();
ActualizarGrilla();
}
private void ActualizarGrilla()
{
dgvTodosLotes.DataSource = null;
dgvTodosLotes.DataSource = ControladoraRemito.Instance.ListarLotes();
foreach (DataGridViewColumn column in dgvTodosLotes.Columns)
{
column.Visible = column.Name == "Id" || column.Name == "Fecha"
|| column.Name == "Cantidad" || column.Name == "NombreProducto";
}
dgvRemito.DataSource = null;
dgvRemito.DataSource = ControladoraRemito.Instance.Listar();
foreach (DataGridViewColumn column in dgvRemito.Columns)
{
column.Visible = column.Name == "Id" || column.Name == "NombreProveedor";
}
}
private void BtnAdd_Click(object sender, EventArgs e)
{
var form = new FrmRemito();
form.ShowDialog();
ActualizarGrilla();
}
private void dgvRemito_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (dgvRemito.SelectedRows.Count == 0) return;
int ordenid = Convert.ToInt32(dgvRemito.SelectedRows[0].Cells["Id"].Value.ToString());
var rem = new Remito { Id = ordenid };
var detallesrem = ControladoraRemito.Instance.ListarLotesPorRemito(rem);
dgvDetallesRemito.DataSource = null;
dgvDetallesRemito.DataSource = detallesrem;
foreach (DataGridViewColumn column in dgvDetallesRemito.Columns)
{
column.Visible = column.Name == "Id" || column.Name == "Fecha"
|| column.Name == "Cantidad" || column.Name == "NombreProducto";
}
} }
} }
} }

View File

@@ -62,49 +62,49 @@
// clientesToolStripMenuItem // clientesToolStripMenuItem
// //
clientesToolStripMenuItem.Name = "clientesToolStripMenuItem"; clientesToolStripMenuItem.Name = "clientesToolStripMenuItem";
clientesToolStripMenuItem.Size = new Size(180, 22); clientesToolStripMenuItem.Size = new Size(164, 22);
clientesToolStripMenuItem.Text = "Clientes"; clientesToolStripMenuItem.Text = "Clientes";
clientesToolStripMenuItem.Click += clientesToolStripMenuItem_Click; clientesToolStripMenuItem.Click += clientesToolStripMenuItem_Click;
// //
// ventasToolStripMenuItem // ventasToolStripMenuItem
// //
ventasToolStripMenuItem.Name = "ventasToolStripMenuItem"; ventasToolStripMenuItem.Name = "ventasToolStripMenuItem";
ventasToolStripMenuItem.Size = new Size(180, 22); ventasToolStripMenuItem.Size = new Size(164, 22);
ventasToolStripMenuItem.Text = "Ventas"; ventasToolStripMenuItem.Text = "Ventas";
ventasToolStripMenuItem.Click += ventasToolStripMenuItem_Click; ventasToolStripMenuItem.Click += ventasToolStripMenuItem_Click;
// //
// proveedoresToolStripMenuItem // proveedoresToolStripMenuItem
// //
proveedoresToolStripMenuItem.Name = "proveedoresToolStripMenuItem"; proveedoresToolStripMenuItem.Name = "proveedoresToolStripMenuItem";
proveedoresToolStripMenuItem.Size = new Size(180, 22); proveedoresToolStripMenuItem.Size = new Size(164, 22);
proveedoresToolStripMenuItem.Text = "Proveedores"; proveedoresToolStripMenuItem.Text = "Proveedores";
proveedoresToolStripMenuItem.Click += proveedoresToolStripMenuItem_Click; proveedoresToolStripMenuItem.Click += proveedoresToolStripMenuItem_Click;
// //
// productosToolStripMenuItem // productosToolStripMenuItem
// //
productosToolStripMenuItem.Name = "productosToolStripMenuItem"; productosToolStripMenuItem.Name = "productosToolStripMenuItem";
productosToolStripMenuItem.Size = new Size(180, 22); productosToolStripMenuItem.Size = new Size(164, 22);
productosToolStripMenuItem.Text = "Productos"; productosToolStripMenuItem.Text = "Productos";
productosToolStripMenuItem.Click += productosToolStripMenuItem_Click; productosToolStripMenuItem.Click += productosToolStripMenuItem_Click;
// //
// remitosToolStripMenuItem // remitosToolStripMenuItem
// //
remitosToolStripMenuItem.Name = "remitosToolStripMenuItem"; remitosToolStripMenuItem.Name = "remitosToolStripMenuItem";
remitosToolStripMenuItem.Size = new Size(180, 22); remitosToolStripMenuItem.Size = new Size(164, 22);
remitosToolStripMenuItem.Text = "Remitos"; remitosToolStripMenuItem.Text = "Remitos";
remitosToolStripMenuItem.Click += remitosToolStripMenuItem_Click; remitosToolStripMenuItem.Click += remitosToolStripMenuItem_Click;
// //
// ordenDeCompraToolStripMenuItem // ordenDeCompraToolStripMenuItem
// //
ordenDeCompraToolStripMenuItem.Name = "ordenDeCompraToolStripMenuItem"; ordenDeCompraToolStripMenuItem.Name = "ordenDeCompraToolStripMenuItem";
ordenDeCompraToolStripMenuItem.Size = new Size(180, 22); ordenDeCompraToolStripMenuItem.Size = new Size(164, 22);
ordenDeCompraToolStripMenuItem.Text = "OrdenDeCompra"; ordenDeCompraToolStripMenuItem.Text = "OrdenDeCompra";
ordenDeCompraToolStripMenuItem.Click += ordenDeCompraToolStripMenuItem_Click; ordenDeCompraToolStripMenuItem.Click += ordenDeCompraToolStripMenuItem_Click;
// //
// pedidosPresupuestoToolStripMenuItem // pedidosPresupuestoToolStripMenuItem
// //
pedidosPresupuestoToolStripMenuItem.Name = "pedidosPresupuestoToolStripMenuItem"; pedidosPresupuestoToolStripMenuItem.Name = "pedidosPresupuestoToolStripMenuItem";
pedidosPresupuestoToolStripMenuItem.Size = new Size(180, 22); pedidosPresupuestoToolStripMenuItem.Size = new Size(164, 22);
pedidosPresupuestoToolStripMenuItem.Text = "Presupuesto"; pedidosPresupuestoToolStripMenuItem.Text = "Presupuesto";
pedidosPresupuestoToolStripMenuItem.Click += pedidosPresupuestoToolStripMenuItem_Click; pedidosPresupuestoToolStripMenuItem.Click += pedidosPresupuestoToolStripMenuItem_Click;
// //
@@ -131,7 +131,7 @@
IsMdiContainer = true; IsMdiContainer = true;
MainMenuStrip = menuStrip1; MainMenuStrip = menuStrip1;
Name = "PantallaPrincipal"; Name = "PantallaPrincipal";
Text = "Form1"; Text = "Sistema Control de Stock";
WindowState = FormWindowState.Maximized; WindowState = FormWindowState.Maximized;
menuStrip1.ResumeLayout(false); menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout(); menuStrip1.PerformLayout();

View File

@@ -5,9 +5,6 @@
<Compile Update="AddCategoria.cs"> <Compile Update="AddCategoria.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Update="AddProducto.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="FrmCliente.cs"> <Compile Update="FrmCliente.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>