cuenta a la mitad

This commit is contained in:
carlos
2024-01-22 02:50:41 -06:00
parent 068491d22e
commit 9f07542364
12 changed files with 199 additions and 137 deletions
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+44 -133
View File
@@ -36,15 +36,7 @@
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.textBox8 = new System.Windows.Forms.TextBox();
this.textBox9 = new System.Windows.Forms.TextBox();
this.textBox11 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.textBox5 = new System.Windows.Forms.TextBox();
this.textBox6 = new System.Windows.Forms.TextBox();
this.textBox7 = new System.Windows.Forms.TextBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.txtnombreproducto = new System.Windows.Forms.TextBox();
this.panelCuenta = new System.Windows.Forms.FlowLayoutPanel();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).BeginInit();
this.flowLayoutPanel1.SuspendLayout();
@@ -54,15 +46,17 @@
//
this.panel2.BackColor = System.Drawing.Color.Transparent;
this.panel2.Controls.Add(this.pictureBox7);
this.panel2.Location = new System.Drawing.Point(3, 3);
this.panel2.Location = new System.Drawing.Point(2, 2);
this.panel2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(312, 263);
this.panel2.Size = new System.Drawing.Size(234, 214);
this.panel2.TabIndex = 8;
//
// pictureBox7
//
this.pictureBox7.Image = global::compabetov2.Properties.Resources.HomeroMenu;
this.pictureBox7.Location = new System.Drawing.Point(64, 35);
this.pictureBox7.Location = new System.Drawing.Point(48, 28);
this.pictureBox7.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.pictureBox7.Name = "pictureBox7";
this.pictureBox7.Size = new System.Drawing.Size(190, 197);
this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@@ -74,14 +68,15 @@
this.button1.BackColor = System.Drawing.Color.Transparent;
this.button1.FlatAppearance.BorderSize = 0;
this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button1.Font = new System.Drawing.Font("Poppins SemiBold", 15F);
this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
this.button1.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button1.Image = global::compabetov2.Properties.Resources.Menui1;
this.button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button1.Location = new System.Drawing.Point(3, 272);
this.button1.Location = new System.Drawing.Point(2, 220);
this.button1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button1.Name = "button1";
this.button1.Padding = new System.Windows.Forms.Padding(50, 0, 0, 0);
this.button1.Size = new System.Drawing.Size(312, 115);
this.button1.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
this.button1.Size = new System.Drawing.Size(234, 93);
this.button1.TabIndex = 8;
this.button1.Text = "Menú";
this.button1.UseVisualStyleBackColor = false;
@@ -92,14 +87,15 @@
this.button2.BackColor = System.Drawing.Color.Transparent;
this.button2.FlatAppearance.BorderSize = 0;
this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button2.Font = new System.Drawing.Font("Poppins SemiBold", 15F);
this.button2.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
this.button2.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button2.Image = global::compabetov2.Properties.Resources.estadisticasi;
this.button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button2.Location = new System.Drawing.Point(3, 393);
this.button2.Location = new System.Drawing.Point(2, 317);
this.button2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button2.Name = "button2";
this.button2.Padding = new System.Windows.Forms.Padding(50, 0, 0, 0);
this.button2.Size = new System.Drawing.Size(312, 115);
this.button2.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
this.button2.Size = new System.Drawing.Size(234, 93);
this.button2.TabIndex = 9;
this.button2.Text = "Estadisticas";
this.button2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
@@ -110,14 +106,15 @@
this.button3.BackColor = System.Drawing.Color.Transparent;
this.button3.FlatAppearance.BorderSize = 0;
this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button3.Font = new System.Drawing.Font("Poppins SemiBold", 15F);
this.button3.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
this.button3.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button3.Image = global::compabetov2.Properties.Resources.productoi;
this.button3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button3.Location = new System.Drawing.Point(3, 514);
this.button3.Location = new System.Drawing.Point(2, 414);
this.button3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button3.Name = "button3";
this.button3.Padding = new System.Windows.Forms.Padding(50, 0, 0, 0);
this.button3.Size = new System.Drawing.Size(312, 115);
this.button3.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
this.button3.Size = new System.Drawing.Size(234, 93);
this.button3.TabIndex = 10;
this.button3.Text = "Productos";
this.button3.UseVisualStyleBackColor = false;
@@ -127,14 +124,15 @@
this.button4.BackColor = System.Drawing.Color.Transparent;
this.button4.FlatAppearance.BorderSize = 0;
this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button4.Font = new System.Drawing.Font("Poppins SemiBold", 15F);
this.button4.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
this.button4.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button4.Image = global::compabetov2.Properties.Resources.reportesi;
this.button4.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button4.Location = new System.Drawing.Point(3, 635);
this.button4.Location = new System.Drawing.Point(2, 511);
this.button4.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button4.Name = "button4";
this.button4.Padding = new System.Windows.Forms.Padding(50, 0, 0, 0);
this.button4.Size = new System.Drawing.Size(312, 115);
this.button4.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
this.button4.Size = new System.Drawing.Size(234, 93);
this.button4.TabIndex = 11;
this.button4.Text = "Reportes";
this.button4.UseVisualStyleBackColor = false;
@@ -144,14 +142,15 @@
this.button5.BackColor = System.Drawing.Color.Transparent;
this.button5.FlatAppearance.BorderSize = 0;
this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button5.Font = new System.Drawing.Font("Poppins SemiBold", 15F);
this.button5.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
this.button5.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button5.Image = global::compabetov2.Properties.Resources.sesionc;
this.button5.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button5.Location = new System.Drawing.Point(3, 756);
this.button5.Location = new System.Drawing.Point(2, 608);
this.button5.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button5.Name = "button5";
this.button5.Padding = new System.Windows.Forms.Padding(50, 0, 0, 0);
this.button5.Size = new System.Drawing.Size(312, 115);
this.button5.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
this.button5.Size = new System.Drawing.Size(234, 93);
this.button5.TabIndex = 12;
this.button5.Text = "Salir";
this.button5.UseVisualStyleBackColor = false;
@@ -166,106 +165,27 @@
this.flowLayoutPanel1.Controls.Add(this.button4);
this.flowLayoutPanel1.Controls.Add(this.button5);
this.flowLayoutPanel1.Location = new System.Drawing.Point(-1, -1);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(324, 1061);
this.flowLayoutPanel1.Size = new System.Drawing.Size(243, 862);
this.flowLayoutPanel1.TabIndex = 8;
//
// textBox8
// panelCuenta
//
this.textBox8.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.textBox8.Location = new System.Drawing.Point(1465, 521);
this.textBox8.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox8.Name = "textBox8";
this.textBox8.Size = new System.Drawing.Size(299, 55);
this.textBox8.TabIndex = 33;
//
// textBox9
//
this.textBox9.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.textBox9.Location = new System.Drawing.Point(1148, 310);
this.textBox9.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox9.Name = "textBox9";
this.textBox9.Size = new System.Drawing.Size(299, 55);
this.textBox9.TabIndex = 32;
//
// textBox11
//
this.textBox11.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.textBox11.Location = new System.Drawing.Point(494, 521);
this.textBox11.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox11.Name = "textBox11";
this.textBox11.Size = new System.Drawing.Size(299, 55);
this.textBox11.TabIndex = 31;
//
// textBox4
//
this.textBox4.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.textBox4.Location = new System.Drawing.Point(1465, 414);
this.textBox4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(299, 55);
this.textBox4.TabIndex = 30;
//
// textBox5
//
this.textBox5.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.textBox5.Location = new System.Drawing.Point(819, 521);
this.textBox5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(299, 55);
this.textBox5.TabIndex = 29;
//
// textBox6
//
this.textBox6.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.textBox6.Location = new System.Drawing.Point(819, 414);
this.textBox6.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(299, 55);
this.textBox6.TabIndex = 28;
//
// textBox7
//
this.textBox7.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.textBox7.Location = new System.Drawing.Point(494, 414);
this.textBox7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(299, 55);
this.textBox7.TabIndex = 27;
//
// textBox1
//
this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.textBox1.Location = new System.Drawing.Point(819, 310);
this.textBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(299, 55);
this.textBox1.TabIndex = 26;
//
// txtnombreproducto
//
this.txtnombreproducto.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.txtnombreproducto.Location = new System.Drawing.Point(494, 310);
this.txtnombreproducto.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtnombreproducto.Name = "txtnombreproducto";
this.txtnombreproducto.Size = new System.Drawing.Size(299, 55);
this.txtnombreproducto.TabIndex = 25;
this.panelCuenta.Location = new System.Drawing.Point(393, 237);
this.panelCuenta.Name = "panelCuenta";
this.panelCuenta.Size = new System.Drawing.Size(831, 439);
this.panelCuenta.TabIndex = 9;
this.panelCuenta.Paint += new System.Windows.Forms.PaintEventHandler(this.panelCuenta_Paint);
//
// cuentas
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1924, 1055);
this.Controls.Add(this.textBox8);
this.Controls.Add(this.textBox9);
this.Controls.Add(this.textBox11);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.textBox5);
this.Controls.Add(this.textBox6);
this.Controls.Add(this.textBox7);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.txtnombreproducto);
this.ClientSize = new System.Drawing.Size(1370, 749);
this.Controls.Add(this.panelCuenta);
this.Controls.Add(this.flowLayoutPanel1);
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.Name = "cuentas";
this.Text = "cuentas";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
@@ -274,7 +194,6 @@
((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).EndInit();
this.flowLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
@@ -288,14 +207,6 @@
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.TextBox textBox8;
private System.Windows.Forms.TextBox textBox9;
private System.Windows.Forms.TextBox textBox11;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.TextBox textBox7;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox txtnombreproducto;
private System.Windows.Forms.FlowLayoutPanel panelCuenta;
}
}
+104 -1
View File
@@ -1,4 +1,5 @@
using compabetov2.database.modelos;
using compabetov2.database;
using compabetov2.database.modelos;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -18,6 +19,7 @@ namespace compabetov2
{
InitializeComponent();
this.loginPrincipal = loginPrincipal;
llenarPanel();
}
private void button1_Click(object sender, EventArgs e)
@@ -45,5 +47,106 @@ namespace compabetov2
menuprincipalForm.BringToFront();
}
}
private void llenarPanel()
{
List<Cuenta> cuentas = service.conseguirCuentaDAO();
foreach (Cuenta cuenta in cuentas)
{
TableLayoutPanel carta = new TableLayoutPanel();
carta.RowCount = 1;
carta.ColumnCount = 2;
carta.Height = 100;
carta.Width = 820;
carta.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 70F));
carta.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 30F));
carta.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
carta.BackColor = Color.Gray;
FlowLayoutPanel infoPanel = new FlowLayoutPanel();
infoPanel.Dock = DockStyle.Fill;
infoPanel.FlowDirection = FlowDirection.TopDown;
Label cliente = new Label();
cliente.Text = $"Cliente: {cuenta.cliente}";
cliente.Font = new Font(cliente.Font.FontFamily, 18);
cliente.Width = 600;
Label fecha = new Label();
fecha.Text = "Fecha: " + cuenta.fecha;
fecha.Font = new Font(fecha.Font.FontFamily, 18);
fecha.Width = 600;
Label total = new Label();
total.Text = "Total: $" + cuenta.total;
total.Font = new Font(total.Font.FontFamily, 18);
total.Width = 600;
infoPanel.Controls.Add(fecha);
infoPanel.Controls.Add(cliente);
infoPanel.Controls.Add(total);
TableLayoutPanel HUDPanel = new TableLayoutPanel();
HUDPanel.Dock = DockStyle.Fill;
HUDPanel.RowCount = 1;
HUDPanel.ColumnCount = 2;
HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
HUDPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
Button btnVer = new Button();
btnVer.Text = "Ver";
btnVer.Dock = DockStyle.Fill;
btnVer.FlatStyle = FlatStyle.Flat;
btnVer.FlatAppearance.BorderSize = 0;
btnVer.BackColor = Color.FromArgb(33, 90, 255);
btnVer.Font = new Font(btnVer.Font.FontFamily, 16);
btnVer.ForeColor = Color.White;
btnVer.Click += new EventHandler(delegate (object sender, EventArgs e)
{
List<DetalleCuentaModel> detalles = service.conseguirDetalleCuante(cuenta.id);
string mensaje = "";
foreach (DetalleCuentaModel detalle in detalles)
{
mensaje += $"{detalle.producto.nombre} - {detalle.cantidad}\n";
}
MessageBox.Show(mensaje);
});
Button btnEliminar = new Button();
btnEliminar.Text = "Cancelar";
btnEliminar.Dock = DockStyle.Fill;
btnEliminar.BackColor = Color.Red;
btnEliminar.FlatStyle = FlatStyle.Flat;
btnEliminar.FlatAppearance.BorderSize = 0;
btnEliminar.Font = new Font(btnVer.Font.FontFamily, 16);
btnEliminar.ForeColor = Color.White;
btnEliminar.Click += new EventHandler(delegate (object sender, EventArgs e)
{
DialogResult result = MessageBox.Show("¿Está seguro de que desea eliminar este registro?",
"Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
}
});
HUDPanel.Controls.Add(btnVer);
HUDPanel.Controls.Add(btnEliminar);
carta.Controls.Add(infoPanel,0,0);
carta.Controls.Add(HUDPanel,1,0);
panelCuenta.Controls.Add(carta);
panelCuenta.BackColor = Color.Aqua;
}
}
private void panelCuenta_Paint(object sender, PaintEventArgs e)
{
}
}
}
+25
View File
@@ -989,6 +989,31 @@ namespace compabetov2.database
}
}
public static SQLiteDataReader conseguirDetalleCuanteDAO(int idCuenta)
{
SQLiteDataReader reader = null;
var db_conexion = new Conexion();
try
{
SQLiteConnection conexion = db_conexion.get_connection();
conexion.Open();
string sql = "Select p.nombre , dc.cantidad from detalle_cuenta dc, Producto p WHERE dc.fk_producto = p.idproducto and dc.fk_cuenta = @fk_cuenta;";
SQLiteCommand command = new SQLiteCommand(sql, conexion);
command.Parameters.AddWithValue("@fk_cuenta", idCuenta);
reader = command.ExecuteReader();
return reader;
}
catch (SQLiteException ex)
{
MessageBox.Show(ex.Message);
return reader;
}
}
private static void crearDB()
{
+3 -1
View File
@@ -14,13 +14,15 @@ namespace compabetov2.database.modelos
public string fecha;
public string estado;
public string descripcion;
public string cliente;
public Cuenta(decimal total = 0, string fecha = "", string estado = "", string descripcion = "", int id = -1) {
public Cuenta(decimal total = 0, string fecha = "", string estado = "", string descripcion = "", string cliente = "",int id = -1) {
this.id = id;
this.total = total;
this.fecha = fecha;
this.estado = estado;
this.descripcion = descripcion;
this.cliente = cliente;
}
}
}
+3 -2
View File
@@ -11,13 +11,14 @@ namespace compabetov2.database.modelos
public int idCuenta;
public Producto producto;
public int cantidad;
public string nombreProducto;
public DetalleCuentaModel(Producto producto, int cantidad, int idCuenta =-1)
public DetalleCuentaModel(Producto producto, int cantidad, int idCuenta =-1, string nombreProducto = "")
{
this.idCuenta = idCuenta;
this.producto = producto;
this.cantidad = cantidad;
this.nombreProducto = nombreProducto;
}
}
}
+20
View File
@@ -240,17 +240,37 @@ namespace compabetov2.database
string fecha = reader["fecha"].ToString();
string estado = reader["estado"].ToString();
string descripcion = reader["descripcion"].ToString();
string cliente = reader["cliente"].ToString();
Cuenta cuenta = new Cuenta(
(int) total,
fecha,
estado,
descripcion,
cliente,
(int)idCuenta
);
cuentas.Add(cuenta);
}
return cuentas;
}
public static List<DetalleCuentaModel> conseguirDetalleCuante(int idCuenta)
{
List<DetalleCuentaModel> detallesCuentas = new List<DetalleCuentaModel>();
SQLiteDataReader reader = DAO.conseguirDetalleCuanteDAO(idCuenta);
while (reader.Read())
{
DetalleCuentaModel detalleCuenta = new DetalleCuentaModel(
new Producto(0, reader["nombre"].ToString()),
(int)reader.GetInt64(1)
);
detallesCuentas.Add(detalleCuenta);
}
return detallesCuentas;
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.