diff --git a/Vista/FrmCategorias.Designer.cs b/Vista/FrmCategorias.Designer.cs index 548e5be..27ad89d 100644 --- a/Vista/FrmCategorias.Designer.cs +++ b/Vista/FrmCategorias.Designer.cs @@ -43,12 +43,12 @@ dgvCategorias.MultiSelect = false; dgvCategorias.Name = "dgvCategorias"; dgvCategorias.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dgvCategorias.Size = new Size(498, 289); + dgvCategorias.Size = new Size(498, 470); dgvCategorias.TabIndex = 0; // // btnAñadir // - btnAñadir.Location = new Point(516, 12); + btnAñadir.Location = new Point(12, 488); btnAñadir.Name = "btnAñadir"; btnAñadir.Size = new Size(75, 23); btnAñadir.TabIndex = 1; @@ -60,7 +60,7 @@ // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); + ClientSize = new Size(527, 523); Controls.Add(btnAñadir); Controls.Add(dgvCategorias); Name = "FrmCategorias"; diff --git a/Vista/FrmClientes.Designer.cs b/Vista/FrmClientes.Designer.cs index 7afeae9..1a8a63f 100644 --- a/Vista/FrmClientes.Designer.cs +++ b/Vista/FrmClientes.Designer.cs @@ -39,7 +39,7 @@ // // BtnModificar // - BtnModificar.Location = new Point(108, 302); + BtnModificar.Location = new Point(87, 466); BtnModificar.Name = "BtnModificar"; BtnModificar.Size = new Size(75, 23); BtnModificar.TabIndex = 1; @@ -49,7 +49,7 @@ // // BtnEliminar // - BtnEliminar.Location = new Point(215, 302); + BtnEliminar.Location = new Point(168, 466); BtnEliminar.Name = "BtnEliminar"; BtnEliminar.Size = new Size(75, 23); BtnEliminar.TabIndex = 2; @@ -65,13 +65,13 @@ groupBox1.Controls.Add(BtnModificar); groupBox1.Location = new Point(12, 2); groupBox1.Name = "groupBox1"; - groupBox1.Size = new Size(1206, 341); + groupBox1.Size = new Size(1206, 495); groupBox1.TabIndex = 3; groupBox1.TabStop = false; // // BtnAceptar // - BtnAceptar.Location = new Point(6, 302); + BtnAceptar.Location = new Point(6, 466); BtnAceptar.Name = "BtnAceptar"; BtnAceptar.Size = new Size(75, 23); BtnAceptar.TabIndex = 4; @@ -90,7 +90,7 @@ dgvCliente.Name = "dgvCliente"; dgvCliente.ReadOnly = true; dgvCliente.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dgvCliente.Size = new Size(1194, 235); + dgvCliente.Size = new Size(1194, 438); dgvCliente.TabIndex = 3; // // FrmClientes diff --git a/Vista/FrmFactura.Designer.cs b/Vista/FrmFactura.Designer.cs index ef58e64..d0269c9 100644 --- a/Vista/FrmFactura.Designer.cs +++ b/Vista/FrmFactura.Designer.cs @@ -37,7 +37,6 @@ datepick = new DateTimePicker(); label3 = new Label(); label4 = new Label(); - cmbCliente = new ComboBox(); dgvProductos = new DataGridView(); dgvDetalles = new DataGridView(); numCantidad = new NumericUpDown(); @@ -46,16 +45,18 @@ label5 = new Label(); label6 = new Label(); btnEliminar = new Button(); + dgvClientes = new DataGridView(); ((System.ComponentModel.ISupportInitialize)numid).BeginInit(); ((System.ComponentModel.ISupportInitialize)numtotal).BeginInit(); ((System.ComponentModel.ISupportInitialize)dgvProductos).BeginInit(); ((System.ComponentModel.ISupportInitialize)dgvDetalles).BeginInit(); ((System.ComponentModel.ISupportInitialize)numCantidad).BeginInit(); + ((System.ComponentModel.ISupportInitialize)dgvClientes).BeginInit(); SuspendLayout(); // // btnAceptar // - btnAceptar.Location = new Point(12, 395); + btnAceptar.Location = new Point(10, 380); btnAceptar.Name = "btnAceptar"; btnAceptar.Size = new Size(82, 26); btnAceptar.TabIndex = 0; @@ -65,7 +66,7 @@ // // btnCancelar // - btnCancelar.Location = new Point(873, 395); + btnCancelar.Location = new Point(1174, 380); btnCancelar.Name = "btnCancelar"; btnCancelar.Size = new Size(80, 26); btnCancelar.TabIndex = 1; @@ -75,7 +76,7 @@ // // numid // - numid.Location = new Point(60, 14); + numid.Location = new Point(37, 351); numid.Maximum = new decimal(new int[] { 1215752191, 23, 0, 0 }); numid.Name = "numid"; numid.Size = new Size(120, 23); @@ -84,7 +85,7 @@ // label1 // label1.AutoSize = true; - label1.Location = new Point(32, 22); + label1.Location = new Point(10, 353); label1.Name = "label1"; label1.Size = new Size(18, 15); label1.TabIndex = 3; @@ -93,7 +94,7 @@ // numtotal // numtotal.Enabled = false; - numtotal.Location = new Point(60, 45); + numtotal.Location = new Point(202, 351); numtotal.Maximum = new decimal(new int[] { 1215752191, 23, 0, 0 }); numtotal.Name = "numtotal"; numtotal.ReadOnly = true; @@ -103,7 +104,7 @@ // label2 // label2.AutoSize = true; - label2.Location = new Point(22, 53); + label2.Location = new Point(164, 355); label2.Name = "label2"; label2.Size = new Size(32, 15); label2.TabIndex = 5; @@ -111,7 +112,7 @@ // // datepick // - datepick.Location = new Point(60, 76); + datepick.Location = new Point(378, 353); datepick.Name = "datepick"; datepick.Size = new Size(120, 23); datepick.TabIndex = 6; @@ -119,7 +120,7 @@ // label3 // label3.AutoSize = true; - label3.Location = new Point(12, 82); + label3.Location = new Point(334, 357); label3.Name = "label3"; label3.Size = new Size(38, 15); label3.TabIndex = 7; @@ -128,21 +129,12 @@ // label4 // label4.AutoSize = true; - label4.Location = new Point(12, 112); + label4.Location = new Point(10, 6); label4.Name = "label4"; label4.Size = new Size(44, 15); label4.TabIndex = 8; label4.Text = "Cliente"; // - // cmbCliente - // - cmbCliente.DropDownStyle = ComboBoxStyle.DropDownList; - cmbCliente.FormattingEnabled = true; - cmbCliente.Location = new Point(62, 109); - cmbCliente.Name = "cmbCliente"; - cmbCliente.Size = new Size(121, 23); - cmbCliente.TabIndex = 10; - // // dgvProductos // dgvProductos.AllowUserToAddRows = false; @@ -150,11 +142,10 @@ dgvProductos.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgvProductos.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dgvProductos.EditMode = DataGridViewEditMode.EditProgrammatically; - dgvProductos.Location = new Point(237, 30); + dgvProductos.Location = new Point(428, 27); dgvProductos.Name = "dgvProductos"; - dgvProductos.RowTemplate.Height = 25; dgvProductos.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dgvProductos.Size = new Size(350, 318); + dgvProductos.Size = new Size(413, 318); dgvProductos.TabIndex = 11; // // dgvDetalles @@ -164,16 +155,15 @@ dgvDetalles.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgvDetalles.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; dgvDetalles.EditMode = DataGridViewEditMode.EditProgrammatically; - dgvDetalles.Location = new Point(593, 30); + dgvDetalles.Location = new Point(847, 27); dgvDetalles.Name = "dgvDetalles"; - dgvDetalles.RowTemplate.Height = 25; dgvDetalles.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - dgvDetalles.Size = new Size(360, 318); + dgvDetalles.Size = new Size(407, 318); dgvDetalles.TabIndex = 12; // // numCantidad // - numCantidad.Location = new Point(309, 354); + numCantidad.Location = new Point(586, 355); numCantidad.Name = "numCantidad"; numCantidad.Size = new Size(120, 23); numCantidad.TabIndex = 13; @@ -181,7 +171,7 @@ // Unidades // Unidades.AutoSize = true; - Unidades.Location = new Point(235, 362); + Unidades.Location = new Point(512, 363); Unidades.Name = "Unidades"; Unidades.Size = new Size(56, 15); Unidades.TabIndex = 14; @@ -189,7 +179,7 @@ // // btnAddDetalle // - btnAddDetalle.Location = new Point(235, 385); + btnAddDetalle.Location = new Point(716, 351); btnAddDetalle.Name = "btnAddDetalle"; btnAddDetalle.Size = new Size(80, 31); btnAddDetalle.TabIndex = 15; @@ -200,7 +190,7 @@ // label5 // label5.AutoSize = true; - label5.Location = new Point(593, 9); + label5.Location = new Point(847, 6); label5.Name = "label5"; label5.Size = new Size(48, 15); label5.TabIndex = 16; @@ -209,7 +199,7 @@ // label6 // label6.AutoSize = true; - label6.Location = new Point(237, 5); + label6.Location = new Point(428, 9); label6.Name = "label6"; label6.Size = new Size(61, 15); label6.TabIndex = 17; @@ -217,7 +207,7 @@ // // btnEliminar // - btnEliminar.Location = new Point(321, 385); + btnEliminar.Location = new Point(802, 351); btnEliminar.Name = "btnEliminar"; btnEliminar.Size = new Size(80, 31); btnEliminar.TabIndex = 18; @@ -225,11 +215,25 @@ btnEliminar.UseVisualStyleBackColor = true; btnEliminar.Click += btnEliminar_Click; // + // dgvClientes + // + dgvClientes.AllowUserToAddRows = false; + dgvClientes.AllowUserToDeleteRows = false; + dgvClientes.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; + dgvClientes.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; + dgvClientes.EditMode = DataGridViewEditMode.EditProgrammatically; + dgvClientes.Location = new Point(10, 27); + dgvClientes.Name = "dgvClientes"; + dgvClientes.SelectionMode = DataGridViewSelectionMode.FullRowSelect; + dgvClientes.Size = new Size(412, 318); + dgvClientes.TabIndex = 19; + // // FrmFactura // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(965, 428); + ClientSize = new Size(1266, 413); + Controls.Add(dgvClientes); Controls.Add(btnEliminar); Controls.Add(label6); Controls.Add(label5); @@ -238,7 +242,6 @@ Controls.Add(numCantidad); Controls.Add(dgvDetalles); Controls.Add(dgvProductos); - Controls.Add(cmbCliente); Controls.Add(label4); Controls.Add(label3); Controls.Add(datepick); @@ -255,6 +258,7 @@ ((System.ComponentModel.ISupportInitialize)dgvProductos).EndInit(); ((System.ComponentModel.ISupportInitialize)dgvDetalles).EndInit(); ((System.ComponentModel.ISupportInitialize)numCantidad).EndInit(); + ((System.ComponentModel.ISupportInitialize)dgvClientes).EndInit(); ResumeLayout(false); PerformLayout(); } @@ -270,7 +274,6 @@ private DateTimePicker datepick; private Label label3; private Label label4; - private ComboBox cmbCliente; private DataGridView dgvProductos; private DataGridView dgvDetalles; private NumericUpDown numCantidad; @@ -279,5 +282,6 @@ private Label label5; private Label label6; private Button btnEliminar; + private DataGridView dgvClientes; } } \ No newline at end of file diff --git a/Vista/FrmFactura.cs b/Vista/FrmFactura.cs index 756ceab..b8b1144 100644 --- a/Vista/FrmFactura.cs +++ b/Vista/FrmFactura.cs @@ -22,9 +22,7 @@ namespace Vista InitializeComponent(); ActualizarGrilla(); CargarDatos(); - - cmbCliente.DisplayMember = "Cliente"; - cmbCliente.SelectedIndex = -1; + } private void ActualizarGrilla() @@ -68,11 +66,7 @@ namespace Vista private void CargarDatos() { - // Asignar la lista de clientes como origen de datos para el ComboBox - cmbCliente.DataSource = ControladoraFacturas.Instance.ListarClientes(); - - // Establecer la propiedad para mostrar el nombre del cliente en el ComboBox - cmbCliente.DisplayMember = "NombreCompleto"; + var listdetalle = ControladoraFacturas.Instance.Listar(); numid.Value = (listdetalle.Count > 0) ? @@ -106,7 +100,7 @@ namespace Vista string devolucion = ""; if (string.IsNullOrEmpty(numid.Text)) devolucion += "El ID no puede ser nulo o vacío\n"; - if (cmbCliente.SelectedIndex == -1) devolucion += "Debe seleccionar un cliente\n"; + //if (cmbCliente.SelectedIndex == -1) devolucion += "Debe seleccionar un cliente\n"; if (devolucion == "") { @@ -127,7 +121,7 @@ namespace Vista factura.Total = Convert.ToDouble(numtotal.Value); factura.Fecha = datepick.Value; factura.Id = Convert.ToInt32(numid.Value); - factura.Cliente = ControladoraFacturas.Instance.ListarClientes().First(x => x.NombreCompleto == cmbCliente.SelectedValue.ToString()); + string mensaje = ControladoraFacturas.Instance.Añadir(factura); MessageBox.Show(mensaje, "Información", MessageBoxButtons.OK, MessageBoxIcon.Information); diff --git a/Vista/FrmFactura.resx b/Vista/FrmFactura.resx index a395bff..8b2ff64 100644 --- a/Vista/FrmFactura.resx +++ b/Vista/FrmFactura.resx @@ -1,7 +1,7 @@