Preview de las estadisticas

This commit is contained in:
Michael Robles
2024-01-23 23:06:47 -07:00
24 changed files with 1237 additions and 487 deletions
+2 -1
View File
@@ -1,8 +1,9 @@
{
"ExpandedNodes": [
"",
"\\database",
"\\Principal"
],
"SelectedNode": "\\Principal\\MenuPrincipal.cs",
"SelectedNode": "\\database\\DAO.cs",
"PreviewInSolutionExplorer": false
}
Binary file not shown.
File diff suppressed because one or more lines are too long
+113 -70
View File
@@ -55,6 +55,7 @@ namespace compabetov2
foreach (Cuenta cuenta in cuentas)
{
TableLayoutPanel carta = new TableLayoutPanel();
carta.RowCount = 1;
carta.ColumnCount = 2;
@@ -63,7 +64,6 @@ namespace compabetov2
carta.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 55F));
carta.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 45F));
carta.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
carta.BackColor = Color.Gray;
FlowLayoutPanel infoPanel = new FlowLayoutPanel();
infoPanel.Dock = DockStyle.Fill;
@@ -71,105 +71,148 @@ namespace compabetov2
Label cliente = new Label();
cliente.Text = $"Cliente: {cuenta.cliente}";
cliente.Font = new Font(cliente.Font.FontFamily, 18);
cliente.Font = new Font(cliente.Font.FontFamily, 12);
cliente.Width = 600;
Label fecha = new Label();
fecha.Text = "Fecha: " + cuenta.fecha;
fecha.Font = new Font(fecha.Font.FontFamily, 18);
fecha.Font = new Font(fecha.Font.FontFamily, 12);
fecha.Width = 600;
Label total = new Label();
total.Text = "Total: $" + cuenta.total;
total.Font = new Font(total.Font.FontFamily, 18);
total.Font = new Font(total.Font.FontFamily, 12);
total.Width = 600;
Label estado = new Label();
estado.Text = $"Estado: {cuenta.estado}";
estado.Font = new Font(total.Font.FontFamily, 12);
estado.Width = 600;
infoPanel.Controls.Add(fecha);
infoPanel.Controls.Add(cliente);
infoPanel.Controls.Add(total);
infoPanel.Controls.Add(estado);
TableLayoutPanel HUDPanel = new TableLayoutPanel();
HUDPanel.Dock = DockStyle.Fill;
HUDPanel.RowCount = 1;
HUDPanel.ColumnCount = 3;
HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
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)
if (cuenta.estado.Equals("ACTIVO"))
{
List<DetalleCuentaModel> detalles = service.conseguirDetalleCuante(cuenta.id);
string mensaje = $"Cliente: {cuenta.cliente}\n";
foreach (DetalleCuentaModel detalle in detalles)
{
mensaje += $"{detalle.producto.nombre} - {detalle.cantidad}\n";
}
MessageBox.Show(mensaje);
});
TableLayoutPanel HUDPanel = new TableLayoutPanel();
HUDPanel.Dock = DockStyle.Fill;
HUDPanel.RowCount = 1;
HUDPanel.ColumnCount = 3;
HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
HUDPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
Button btnSaldar = new Button();
btnSaldar.Text = "Saldar";
btnSaldar.Dock = DockStyle.Fill;
btnSaldar.FlatStyle = FlatStyle.Flat;
btnSaldar.FlatAppearance.BorderSize = 0;
btnSaldar.BackColor = Color.FromArgb(33, 90, 255);
btnSaldar.Font = new Font(btnVer.Font.FontFamily, 16);
btnSaldar.ForeColor = Color.White;
btnSaldar.Click += new EventHandler(delegate (object sender, EventArgs e)
{
DialogResult result = MessageBox.Show("¿Está seguro de que desea saldar esta cuenta?",
"Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
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);
if (service.saldarCuenta(cuenta, detalles))
string mensaje = $"Cliente: {cuenta.cliente}\n";
foreach (DetalleCuentaModel detalle in detalles)
{
llenarPanel();
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 cancelar este registro?",
"Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
Button btnSaldar = new Button();
btnSaldar.Text = "Saldar";
btnSaldar.Dock = DockStyle.Fill;
btnSaldar.FlatStyle = FlatStyle.Flat;
btnSaldar.FlatAppearance.BorderSize = 0;
btnSaldar.BackColor = Color.FromArgb(33, 90, 255);
btnSaldar.Font = new Font(btnVer.Font.FontFamily, 16);
btnSaldar.ForeColor = Color.White;
btnSaldar.Click += new EventHandler(delegate (object sender, EventArgs e)
{
if (service.cancelarCuenta(cuenta.id))
DialogResult result = MessageBox.Show("¿Está seguro de que desea saldar esta cuenta?",
"Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
llenarPanel();
List<DetalleCuentaModel> detalles = service.conseguirDetalleCuante(cuenta.id);
if (service.saldarCuenta(cuenta, detalles))
{
llenarPanel();
}
}
}
});
});
HUDPanel.Controls.Add(btnVer);
HUDPanel.Controls.Add(btnSaldar);
HUDPanel.Controls.Add(btnEliminar);
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 cancelar este registro?",
"Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
if (service.cancelarCuenta(cuenta.id))
{
llenarPanel();
}
}
});
HUDPanel.Controls.Add(btnVer);
HUDPanel.Controls.Add(btnSaldar);
HUDPanel.Controls.Add(btnEliminar);
carta.Controls.Add(HUDPanel, 1, 0);
}
else
{
TableLayoutPanel HUDPanel = new TableLayoutPanel();
HUDPanel.Dock = DockStyle.Fill;
HUDPanel.RowCount = 1;
HUDPanel.ColumnCount = 3;
HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
HUDPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 33F));
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 = $"Cliente: {cuenta.cliente}\n";
foreach (DetalleCuentaModel detalle in detalles)
{
mensaje += $"{detalle.producto.nombre} - {detalle.cantidad}\n";
}
MessageBox.Show(mensaje);
});
HUDPanel.Controls.Add(btnVer,2,0);
carta.Controls.Add(HUDPanel, 1, 0);
}
carta.Controls.Add(infoPanel,0,0);
carta.Controls.Add(HUDPanel,1,0);
panelCuenta.Controls.Add(carta);
panelCuenta.BackColor = Color.Aqua;
}
}
+99 -337
View File
@@ -37,35 +37,18 @@
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.textBox5 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.txtCliente = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.textBox6 = new System.Windows.Forms.TextBox();
this.textBox7 = new System.Windows.Forms.TextBox();
this.label9 = new System.Windows.Forms.Label();
this.button9 = new System.Windows.Forms.Button();
this.button8 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.txtDireccion = new System.Windows.Forms.TextBox();
this.horafecha = new System.Windows.Forms.Timer(this.components);
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.timer2 = new System.Windows.Forms.Timer(this.components);
this.lblfecha = new System.Windows.Forms.Label();
this.lblhora = new System.Windows.Forms.Label();
this.responsablecb = new System.Windows.Forms.ComboBox();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label10 = new System.Windows.Forms.Label();
this.txtTelefono = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.panelEnvio = new System.Windows.Forms.FlowLayoutPanel();
this.flowLayoutPanel1.SuspendLayout();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox7)).BeginInit();
@@ -81,26 +64,26 @@
this.flowLayoutPanel1.Controls.Add(this.button4);
this.flowLayoutPanel1.Controls.Add(this.button5);
this.flowLayoutPanel1.Location = new System.Drawing.Point(-1, 2);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
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 = 9;
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.Transparent;
this.panel2.Controls.Add(this.pictureBox7);
this.panel2.Location = new System.Drawing.Point(3, 2);
this.panel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
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, 34);
this.pictureBox7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
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;
@@ -116,11 +99,11 @@
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, 269);
this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
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(51, 0, 0, 0);
this.button1.Size = new System.Drawing.Size(312, 114);
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;
@@ -135,11 +118,11 @@
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, 387);
this.button2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
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(51, 0, 0, 0);
this.button2.Size = new System.Drawing.Size(312, 114);
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;
@@ -154,11 +137,11 @@
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, 505);
this.button3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
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(51, 0, 0, 0);
this.button3.Size = new System.Drawing.Size(312, 114);
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;
@@ -172,11 +155,11 @@
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, 623);
this.button4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
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(51, 0, 0, 0);
this.button4.Size = new System.Drawing.Size(312, 114);
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;
@@ -190,238 +173,59 @@
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, 741);
this.button5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
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(51, 0, 0, 0);
this.button5.Size = new System.Drawing.Size(312, 114);
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;
//
// textBox1
// txtCliente
//
this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.textBox1.Location = new System.Drawing.Point(943, 368);
this.textBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(365, 55);
this.textBox1.TabIndex = 10;
//
// dateTimePicker1
//
this.dateTimePicker1.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
this.dateTimePicker1.Location = new System.Drawing.Point(592, 393);
this.dateTimePicker1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.Size = new System.Drawing.Size(296, 36);
this.dateTimePicker1.TabIndex = 29;
//
// textBox2
//
this.textBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.textBox2.Location = new System.Drawing.Point(1364, 372);
this.textBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(365, 55);
this.textBox2.TabIndex = 30;
//
// textBox3
//
this.textBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.textBox3.Location = new System.Drawing.Point(976, 545);
this.textBox3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(365, 55);
this.textBox3.TabIndex = 32;
//
// textBox4
//
this.textBox4.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.textBox4.Location = new System.Drawing.Point(555, 542);
this.textBox4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(365, 55);
this.textBox4.TabIndex = 31;
//
// textBox5
//
this.textBox5.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.textBox5.Location = new System.Drawing.Point(1373, 545);
this.textBox5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(365, 55);
this.textBox5.TabIndex = 33;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.label1.ForeColor = System.Drawing.Color.Navy;
this.label1.Location = new System.Drawing.Point(585, 327);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(112, 39);
this.label1.TabIndex = 38;
this.label1.Text = "Fecha";
this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.label2.ForeColor = System.Drawing.Color.Navy;
this.label2.Location = new System.Drawing.Point(936, 304);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(199, 39);
this.label2.TabIndex = 39;
this.label2.Text = "Destinatario";
this.label2.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.label3.ForeColor = System.Drawing.Color.Navy;
this.label3.Location = new System.Drawing.Point(1367, 304);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(160, 39);
this.label3.TabIndex = 40;
this.label3.Text = "Direccion";
this.label3.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.txtCliente.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.txtCliente.Location = new System.Drawing.Point(302, 340);
this.txtCliente.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtCliente.Name = "txtCliente";
this.txtCliente.Size = new System.Drawing.Size(275, 45);
this.txtCliente.TabIndex = 31;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.label4.ForeColor = System.Drawing.Color.Navy;
this.label4.Location = new System.Drawing.Point(548, 487);
this.label4.Location = new System.Drawing.Point(297, 296);
this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(134, 39);
this.label4.Size = new System.Drawing.Size(99, 31);
this.label4.TabIndex = 41;
this.label4.Text = "Colonia";
this.label4.Text = "Cliente";
this.label4.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.label5.ForeColor = System.Drawing.Color.Navy;
this.label5.Location = new System.Drawing.Point(969, 487);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(230, 39);
this.label5.TabIndex = 42;
this.label5.Text = "Codigo Postal";
this.label5.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.label6.ForeColor = System.Drawing.Color.Navy;
this.label6.Location = new System.Drawing.Point(1367, 487);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(182, 39);
this.label6.TabIndex = 43;
this.label6.Text = "Referencia";
this.label6.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.label4.Click += new System.EventHandler(this.label4_Click);
//
// label7
//
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.label7.ForeColor = System.Drawing.Color.Navy;
this.label7.Location = new System.Drawing.Point(559, 635);
this.label7.Location = new System.Drawing.Point(296, 416);
this.label7.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(217, 39);
this.label7.Size = new System.Drawing.Size(128, 31);
this.label7.TabIndex = 44;
this.label7.Text = "Responsable";
this.label7.Text = "Direccion";
this.label7.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// label8
// txtDireccion
//
this.label8.AutoSize = true;
this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.label8.ForeColor = System.Drawing.Color.Navy;
this.label8.Location = new System.Drawing.Point(980, 635);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(150, 39);
this.label8.TabIndex = 46;
this.label8.Text = "Telefono";
this.label8.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// textBox6
//
this.textBox6.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.textBox6.Location = new System.Drawing.Point(976, 694);
this.textBox6.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(365, 55);
this.textBox6.TabIndex = 45;
//
// textBox7
//
this.textBox7.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.textBox7.Location = new System.Drawing.Point(1373, 694);
this.textBox7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(365, 55);
this.textBox7.TabIndex = 47;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.label9.ForeColor = System.Drawing.Color.Navy;
this.label9.Location = new System.Drawing.Point(1377, 652);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(150, 39);
this.label9.TabIndex = 48;
this.label9.Text = "Telefono";
this.label9.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// button9
//
this.button9.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button9.Location = new System.Drawing.Point(1460, 815);
this.button9.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button9.Name = "button9";
this.button9.Size = new System.Drawing.Size(171, 70);
this.button9.TabIndex = 52;
this.button9.Text = "Eliminar";
this.button9.UseVisualStyleBackColor = true;
//
// button8
//
this.button8.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button8.Location = new System.Drawing.Point(1260, 815);
this.button8.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button8.Name = "button8";
this.button8.Size = new System.Drawing.Size(171, 70);
this.button8.TabIndex = 51;
this.button8.Text = "Editar";
this.button8.UseVisualStyleBackColor = true;
//
// button7
//
this.button7.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button7.Location = new System.Drawing.Point(1060, 815);
this.button7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(171, 70);
this.button7.TabIndex = 50;
this.button7.Text = "Buscar";
this.button7.UseVisualStyleBackColor = true;
//
// button6
//
this.button6.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.button6.Location = new System.Drawing.Point(861, 815);
this.button6.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(171, 70);
this.button6.TabIndex = 49;
this.button6.Text = "Agregar";
this.button6.UseVisualStyleBackColor = true;
this.txtDireccion.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.txtDireccion.Location = new System.Drawing.Point(302, 461);
this.txtDireccion.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtDireccion.Name = "txtDireccion";
this.txtDireccion.Size = new System.Drawing.Size(275, 45);
this.txtDireccion.TabIndex = 45;
//
// horafecha
//
@@ -433,9 +237,10 @@
this.lblfecha.AutoSize = true;
this.lblfecha.Font = new System.Drawing.Font("Microsoft Sans Serif", 30F);
this.lblfecha.ForeColor = System.Drawing.Color.Navy;
this.lblfecha.Location = new System.Drawing.Point(725, 142);
this.lblfecha.Location = new System.Drawing.Point(544, 115);
this.lblfecha.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblfecha.Name = "lblfecha";
this.lblfecha.Size = new System.Drawing.Size(159, 58);
this.lblfecha.Size = new System.Drawing.Size(126, 46);
this.lblfecha.TabIndex = 54;
this.lblfecha.Text = "label2";
this.lblfecha.TextAlign = System.Drawing.ContentAlignment.TopCenter;
@@ -445,87 +250,61 @@
this.lblhora.AutoSize = true;
this.lblhora.Font = new System.Drawing.Font("Microsoft Sans Serif", 60F);
this.lblhora.ForeColor = System.Drawing.Color.MediumBlue;
this.lblhora.Location = new System.Drawing.Point(913, 23);
this.lblhora.Location = new System.Drawing.Point(685, 19);
this.lblhora.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblhora.Name = "lblhora";
this.lblhora.Size = new System.Drawing.Size(318, 113);
this.lblhora.Size = new System.Drawing.Size(249, 91);
this.lblhora.TabIndex = 53;
this.lblhora.Text = "label1";
//
// responsablecb
// txtTelefono
//
this.responsablecb.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.responsablecb.FormattingEnabled = true;
this.responsablecb.Items.AddRange(new object[] {
"Fabian Herrera",
"Cristofer Perez ",
"Angel Alexander",
"Emilio Urenda"});
this.responsablecb.Location = new System.Drawing.Point(565, 711);
this.responsablecb.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.responsablecb.Name = "responsablecb";
this.responsablecb.Size = new System.Drawing.Size(353, 46);
this.responsablecb.TabIndex = 55;
this.txtTelefono.Font = new System.Drawing.Font("Microsoft Sans Serif", 25F);
this.txtTelefono.Location = new System.Drawing.Point(303, 586);
this.txtTelefono.Margin = new System.Windows.Forms.Padding(2);
this.txtTelefono.Name = "txtTelefono";
this.txtTelefono.Size = new System.Drawing.Size(275, 45);
this.txtTelefono.TabIndex = 56;
//
// comboBox1
// label1
//
this.comboBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Items.AddRange(new object[] {
"Enviado",
"Completado"});
this.comboBox1.Location = new System.Drawing.Point(421, 839);
this.comboBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(353, 46);
this.comboBox1.TabIndex = 56;
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.label1.ForeColor = System.Drawing.Color.Navy;
this.label1.Location = new System.Drawing.Point(297, 541);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(120, 31);
this.label1.TabIndex = 55;
this.label1.Text = "Telefono";
this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// label10
// panelEnvio
//
this.label10.AutoSize = true;
this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.label10.ForeColor = System.Drawing.Color.Navy;
this.label10.Location = new System.Drawing.Point(415, 788);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(123, 39);
this.label10.TabIndex = 57;
this.label10.Text = "Estado";
this.label10.TextAlign = System.Drawing.ContentAlignment.TopCenter;
this.label10.Click += new System.EventHandler(this.label10_Click);
this.panelEnvio.AutoScroll = true;
this.panelEnvio.Location = new System.Drawing.Point(650, 312);
this.panelEnvio.Name = "panelEnvio";
this.panelEnvio.Size = new System.Drawing.Size(708, 379);
this.panelEnvio.TabIndex = 57;
this.panelEnvio.Paint += new System.Windows.Forms.PaintEventHandler(this.panelEnvio_Paint);
//
// envios
//
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(1371, 965);
this.ClientSize = new System.Drawing.Size(1370, 772);
this.ControlBox = false;
this.Controls.Add(this.label10);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.responsablecb);
this.Controls.Add(this.panelEnvio);
this.Controls.Add(this.txtTelefono);
this.Controls.Add(this.label1);
this.Controls.Add(this.lblfecha);
this.Controls.Add(this.lblhora);
this.Controls.Add(this.button9);
this.Controls.Add(this.button8);
this.Controls.Add(this.button7);
this.Controls.Add(this.button6);
this.Controls.Add(this.label9);
this.Controls.Add(this.textBox7);
this.Controls.Add(this.label8);
this.Controls.Add(this.textBox6);
this.Controls.Add(this.txtDireccion);
this.Controls.Add(this.label7);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox5);
this.Controls.Add(this.textBox3);
this.Controls.Add(this.textBox4);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.dateTimePicker1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.txtCliente);
this.Controls.Add(this.flowLayoutPanel1);
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.Name = "envios";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.envios_Load);
@@ -548,34 +327,17 @@
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtCliente;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.TextBox textBox7;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Button button9;
private System.Windows.Forms.Button button8;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.TextBox txtDireccion;
private System.Windows.Forms.Timer horafecha;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Timer timer2;
private System.Windows.Forms.Label lblfecha;
private System.Windows.Forms.Label lblhora;
private System.Windows.Forms.ComboBox responsablecb;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.TextBox txtTelefono;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.FlowLayoutPanel panelEnvio;
}
}
+261 -1
View File
@@ -1,10 +1,12 @@
using compabetov2.database.modelos;
using compabetov2.database;
using compabetov2.database.modelos;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -17,9 +19,257 @@ namespace compabetov2
public envios(LoginModel loginPrincipal)
{
InitializeComponent();
llenarPanel();
this.loginPrincipal = loginPrincipal;
}
private void llenarPanel()
{
panelEnvio.Controls.Clear();
List<Envio> envios = service.conseguirEnvio();
foreach(Envio envio in envios)
{
if (envio.estado.Equals("EN PROCESO"))
{
TableLayoutPanel carta = new TableLayoutPanel();
carta.ColumnCount = 1;
carta.RowCount = 2;
carta.RowStyles.Add(new RowStyle(SizeType.Percent, 75F));
carta.RowStyles.Add(new RowStyle(SizeType.Percent, 25F));
carta.Width = 700;
carta.Height = 170;
FlowLayoutPanel infoPanel = new FlowLayoutPanel();
infoPanel.FlowDirection = FlowDirection.TopDown;
infoPanel.Dock = DockStyle.Fill;
Label lbFecha = new Label();
lbFecha.Text = $"Fecha: {envio.fecha}";
lbFecha.Font = new Font(lbFecha.Font.FontFamily, 12);
lbFecha.Width = 700;
Label lbDireaccion = new Label();
lbDireaccion.Text = $"Direccion: {envio.direccion}";
lbDireaccion.Font = new Font(lbDireaccion.Font.FontFamily, 12);
lbDireaccion.Width = 700;
Label lbTelefono = new Label();
lbTelefono.Text = $"Telefono: {envio.telefono} Estado: {envio.estado}";
lbTelefono.Font = new Font(lbTelefono.Font.FontFamily, 12);
lbTelefono.Width = 700;
Label lbCliente = new Label();
lbCliente.Text = $"Cliente: {envio.cliente}";
lbCliente.Font = new Font(lbCliente.Font.FontFamily, 12);
lbCliente.Width = 700;
Label lbResponzable = new Label();
lbResponzable.Text = $"Responzable: {envio.responsable}";
lbResponzable.Font = new Font(lbResponzable.Font.FontFamily, 12);
lbResponzable.Width = 700;
TableLayoutPanel botonesPanel = new TableLayoutPanel();
botonesPanel.RowCount = 1;
botonesPanel.ColumnCount = 4;
botonesPanel.Dock = DockStyle.Fill;
botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
botonesPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
Button btnDetalles = new Button();
btnDetalles.Text = "Detalles";
btnDetalles.Dock = DockStyle.Fill;
btnDetalles.FlatStyle = FlatStyle.Flat;
btnDetalles.FlatAppearance.BorderSize = 0;
btnDetalles.BackColor = Color.FromArgb(33, 90, 255);
btnDetalles.Font = new Font(btnDetalles.Font.FontFamily, 16);
btnDetalles.ForeColor = Color.White;
btnDetalles.Click += new EventHandler(delegate (object sender, EventArgs e)
{
List<DetalleEnvioModel> detalles = service.conseguirDetalleEnvio(envio.id);
string mensaje = "";
foreach (DetalleEnvioModel detalle in detalles)
{
mensaje += $"{detalle.producto.nombre} - {detalle.cantidad}\n";
}
mensaje += $"Total: {envio.total}";
MessageBox.Show(mensaje);
});
Button btnConcluir = new Button();
btnConcluir.Text = "Concluir";
btnConcluir.Dock = DockStyle.Fill;
btnConcluir.FlatStyle = FlatStyle.Flat;
btnConcluir.FlatAppearance.BorderSize = 0;
btnConcluir.BackColor = Color.FromArgb(33, 90, 255);
btnConcluir.Font = new Font(btnDetalles.Font.FontFamily, 16);
btnConcluir.ForeColor = Color.White;
btnConcluir.Click += new EventHandler(delegate (object sender, EventArgs e)
{
DialogResult result = MessageBox.Show($"¿Está seguro de que desea concluir este envio?",
"Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
List<DetalleEnvioModel> detalles = service.conseguirDetalleEnvio(envio.id);
if (service.concluirEnvio(envio, detalles))
{
llenarPanel();
}
}
});
Button btnCancelar = new Button();
btnCancelar.Text = "Cancelar";
btnCancelar.Dock = DockStyle.Fill;
btnCancelar.FlatStyle = FlatStyle.Flat;
btnCancelar.FlatAppearance.BorderSize = 0;
btnCancelar.BackColor = Color.Red;
btnCancelar.Font = new Font(btnDetalles.Font.FontFamily, 16);
btnCancelar.Click += new EventHandler(delegate (object sender, EventArgs e)
{
DialogResult result = MessageBox.Show($"¿Está seguro de que desea eliminar este envio?",
"Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
if (service.cancelarEnvio(envio.id))
{
llenarPanel();
}
}
});
Button btnAgregar = new Button();
btnAgregar.Text = "Agregar";
btnAgregar.Dock = DockStyle.Fill;
btnAgregar.FlatStyle = FlatStyle.Flat;
btnAgregar.FlatAppearance.BorderSize = 0;
btnAgregar.BackColor = Color.FromArgb(33, 90, 255);
btnAgregar.Font = new Font(btnDetalles.Font.FontFamily, 16);
btnAgregar.ForeColor = Color.White;
btnAgregar.Click += new EventHandler(delegate (object sender, EventArgs e)
{
Envio envioEditado = new Envio(envio.id, "",
txtDireccion.Text == "" ? envio.direccion : txtDireccion.Text,
txtTelefono.Text == "" ? envio.telefono : txtTelefono.Text
, "", "",
txtCliente.Text == "" ? envio.cliente : txtCliente.Text
, 0);
if (service.editarEnvio(envioEditado))
{
llenarPanel();
txtCliente.Text = "";
txtDireccion.Text = "";
txtTelefono.Text = "";
}
});
infoPanel.Controls.Add(lbFecha);
infoPanel.Controls.Add(lbResponzable);
infoPanel.Controls.Add(lbCliente);
infoPanel.Controls.Add(lbDireaccion);
infoPanel.Controls.Add(lbTelefono);
botonesPanel.Controls.Add(btnDetalles, 0, 0);
botonesPanel.Controls.Add(btnConcluir, 1, 0);
botonesPanel.Controls.Add(btnAgregar, 2, 0);
botonesPanel.Controls.Add(btnCancelar, 3, 0);
carta.Controls.Add(infoPanel, 0, 0);
carta.Controls.Add(botonesPanel, 0, 1);
panelEnvio.Controls.Add(carta);
}
else
{
TableLayoutPanel carta = new TableLayoutPanel();
carta.ColumnCount = 1;
carta.RowCount = 2;
carta.RowStyles.Add(new RowStyle(SizeType.Percent, 75F));
carta.RowStyles.Add(new RowStyle(SizeType.Percent, 25F));
carta.Width = 700;
carta.Height = 170;
FlowLayoutPanel infoPanel = new FlowLayoutPanel();
infoPanel.FlowDirection = FlowDirection.TopDown;
infoPanel.Dock = DockStyle.Fill;
Label lbFecha = new Label();
lbFecha.Text = $"Fecha: {envio.fecha}";
lbFecha.Font = new Font(lbFecha.Font.FontFamily, 12);
lbFecha.Width = 700;
Label lbDireaccion = new Label();
lbDireaccion.Text = $"Direccion: {envio.direccion}";
lbDireaccion.Font = new Font(lbDireaccion.Font.FontFamily, 12);
lbDireaccion.Width = 700;
Label lbTelefono = new Label();
lbTelefono.Text = $"Telefono: {envio.telefono} Estado: {envio.estado}";
lbTelefono.Font = new Font(lbTelefono.Font.FontFamily, 12);
lbTelefono.Width = 700;
Label lbCliente = new Label();
lbCliente.Text = $"Cliente: {envio.cliente}";
lbCliente.Font = new Font(lbCliente.Font.FontFamily, 12);
lbCliente.Width = 700;
Label lbResponzable = new Label();
lbResponzable.Text = $"Responzable: {envio.responsable}";
lbResponzable.Font = new Font(lbResponzable.Font.FontFamily, 12);
lbResponzable.Width = 700;
TableLayoutPanel botonesPanel = new TableLayoutPanel();
botonesPanel.RowCount = 1;
botonesPanel.ColumnCount = 4;
botonesPanel.Dock = DockStyle.Fill;
botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
botonesPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
Button btnDetalles = new Button();
btnDetalles.Text = "Detalles";
btnDetalles.Dock = DockStyle.Fill;
btnDetalles.FlatStyle = FlatStyle.Flat;
btnDetalles.FlatAppearance.BorderSize = 0;
btnDetalles.BackColor = Color.FromArgb(33, 90, 255);
btnDetalles.Font = new Font(btnDetalles.Font.FontFamily, 16);
btnDetalles.ForeColor = Color.White;
btnDetalles.Click += new EventHandler(delegate (object sender, EventArgs e)
{
List<DetalleEnvioModel> detalles = service.conseguirDetalleEnvio(envio.id);
string mensaje = "";
foreach (DetalleEnvioModel detalle in detalles)
{
mensaje += $"{detalle.producto.nombre} - {detalle.cantidad}\n";
}
MessageBox.Show(mensaje);
});
infoPanel.Controls.Add(lbFecha);
infoPanel.Controls.Add(lbResponzable);
infoPanel.Controls.Add(lbCliente);
infoPanel.Controls.Add(lbDireaccion);
infoPanel.Controls.Add(lbTelefono);
botonesPanel.Controls.Add(btnDetalles, 0, 0);
carta.Controls.Add(infoPanel, 0, 0);
carta.Controls.Add(botonesPanel, 0, 1);
panelEnvio.Controls.Add(carta);
}
}
}
private void button1_Click(object sender, EventArgs e)
{
// Cerrar el formulario de ventas
@@ -63,5 +313,15 @@ namespace compabetov2
{
}
private void label4_Click(object sender, EventArgs e)
{
}
private void panelEnvio_Paint(object sender, PaintEventArgs e)
{
}
}
}
+39
View File
@@ -0,0 +1,39 @@
namespace compabetov2
{
partial class Estadiscticas
{
/// <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()
{
this.components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Text = "Estadiscticas";
}
#endregion
}
}
+20
View File
@@ -0,0 +1,20 @@
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 compabetov2
{
public partial class Estadiscticas : Form
{
public Estadiscticas()
{
InitializeComponent();
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?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>
+81 -66
View File
@@ -50,6 +50,7 @@
this.bntImprimir = new System.Windows.Forms.Button();
this.responsablecb = new System.Windows.Forms.ComboBox();
this.btnFiar = new System.Windows.Forms.Button();
this.btnEnviar = new System.Windows.Forms.Button();
this.flowLayoutPanel2.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox9)).BeginInit();
@@ -68,9 +69,10 @@
this.lblfecha.AutoSize = true;
this.lblfecha.Font = new System.Drawing.Font("Microsoft Sans Serif", 30F);
this.lblfecha.ForeColor = System.Drawing.Color.Navy;
this.lblfecha.Location = new System.Drawing.Point(619, 128);
this.lblfecha.Location = new System.Drawing.Point(464, 104);
this.lblfecha.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblfecha.Name = "lblfecha";
this.lblfecha.Size = new System.Drawing.Size(159, 58);
this.lblfecha.Size = new System.Drawing.Size(126, 46);
this.lblfecha.TabIndex = 13;
this.lblfecha.Text = "label2";
this.lblfecha.TextAlign = System.Drawing.ContentAlignment.TopCenter;
@@ -81,9 +83,10 @@
this.lblhora.AutoSize = true;
this.lblhora.Font = new System.Drawing.Font("Microsoft Sans Serif", 60F);
this.lblhora.ForeColor = System.Drawing.Color.MediumBlue;
this.lblhora.Location = new System.Drawing.Point(807, 9);
this.lblhora.Location = new System.Drawing.Point(605, 7);
this.lblhora.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblhora.Name = "lblhora";
this.lblhora.Size = new System.Drawing.Size(318, 113);
this.lblhora.Size = new System.Drawing.Size(249, 91);
this.lblhora.TabIndex = 12;
this.lblhora.Text = "label1";
this.lblhora.Click += new System.EventHandler(this.lblhora_Click);
@@ -94,10 +97,10 @@
this.flowLayoutPanel2.Controls.Add(this.panel1);
this.flowLayoutPanel2.Controls.Add(this.label1);
this.flowLayoutPanel2.Controls.Add(this.labeltotal);
this.flowLayoutPanel2.Location = new System.Drawing.Point(1605, -1);
this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.flowLayoutPanel2.Location = new System.Drawing.Point(1204, -1);
this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(2);
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
this.flowLayoutPanel2.Size = new System.Drawing.Size(324, 1191);
this.flowLayoutPanel2.Size = new System.Drawing.Size(243, 968);
this.flowLayoutPanel2.TabIndex = 11;
this.flowLayoutPanel2.Paint += new System.Windows.Forms.PaintEventHandler(this.flowLayoutPanel2_Paint);
//
@@ -105,17 +108,17 @@
//
this.panel1.BackColor = System.Drawing.Color.Transparent;
this.panel1.Controls.Add(this.pictureBox9);
this.panel1.Location = new System.Drawing.Point(3, 2);
this.panel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel1.Location = new System.Drawing.Point(2, 2);
this.panel1.Margin = new System.Windows.Forms.Padding(2);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(312, 263);
this.panel1.Size = new System.Drawing.Size(234, 214);
this.panel1.TabIndex = 8;
//
// pictureBox9
//
this.pictureBox9.Image = global::compabetov2.Properties.Resources.HomeroMenu;
this.pictureBox9.Location = new System.Drawing.Point(64, 34);
this.pictureBox9.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.pictureBox9.Location = new System.Drawing.Point(48, 28);
this.pictureBox9.Margin = new System.Windows.Forms.Padding(2);
this.pictureBox9.Name = "pictureBox9";
this.pictureBox9.Size = new System.Drawing.Size(190, 197);
this.pictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@@ -128,9 +131,10 @@
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.label1.ForeColor = System.Drawing.Color.AliceBlue;
this.label1.Location = new System.Drawing.Point(3, 267);
this.label1.Location = new System.Drawing.Point(2, 218);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(102, 39);
this.label1.Size = new System.Drawing.Size(83, 31);
this.label1.TabIndex = 17;
this.label1.Text = "Total:";
this.label1.Click += new System.EventHandler(this.label1_Click);
@@ -141,9 +145,10 @@
this.labeltotal.BackColor = System.Drawing.Color.Transparent;
this.labeltotal.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.labeltotal.ForeColor = System.Drawing.Color.AliceBlue;
this.labeltotal.Location = new System.Drawing.Point(111, 267);
this.labeltotal.Location = new System.Drawing.Point(89, 218);
this.labeltotal.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.labeltotal.Name = "labeltotal";
this.labeltotal.Size = new System.Drawing.Size(0, 39);
this.labeltotal.Size = new System.Drawing.Size(0, 31);
this.labeltotal.TabIndex = 18;
//
// flowLayoutPanel1
@@ -155,26 +160,26 @@
this.flowLayoutPanel1.Controls.Add(this.button3);
this.flowLayoutPanel1.Controls.Add(this.button5);
this.flowLayoutPanel1.Location = new System.Drawing.Point(-1, 2);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(2);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(324, 1199);
this.flowLayoutPanel1.Size = new System.Drawing.Size(243, 974);
this.flowLayoutPanel1.TabIndex = 8;
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.Transparent;
this.panel2.Controls.Add(this.pictureBox7);
this.panel2.Location = new System.Drawing.Point(3, 2);
this.panel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel2.Location = new System.Drawing.Point(2, 2);
this.panel2.Margin = new System.Windows.Forms.Padding(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, 34);
this.pictureBox7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.pictureBox7.Location = new System.Drawing.Point(48, 28);
this.pictureBox7.Margin = new System.Windows.Forms.Padding(2);
this.pictureBox7.Name = "pictureBox7";
this.pictureBox7.Size = new System.Drawing.Size(190, 197);
this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@@ -190,11 +195,11 @@
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, 269);
this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button1.Location = new System.Drawing.Point(2, 220);
this.button1.Margin = new System.Windows.Forms.Padding(2);
this.button1.Name = "button1";
this.button1.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0);
this.button1.Size = new System.Drawing.Size(312, 114);
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;
@@ -209,11 +214,11 @@
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, 387);
this.button2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button2.Location = new System.Drawing.Point(2, 317);
this.button2.Margin = new System.Windows.Forms.Padding(2);
this.button2.Name = "button2";
this.button2.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0);
this.button2.Size = new System.Drawing.Size(312, 114);
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.UseVisualStyleBackColor = false;
@@ -227,11 +232,11 @@
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, 505);
this.button3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button3.Location = new System.Drawing.Point(2, 414);
this.button3.Margin = new System.Windows.Forms.Padding(2);
this.button3.Name = "button3";
this.button3.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0);
this.button3.Size = new System.Drawing.Size(312, 114);
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;
@@ -245,11 +250,11 @@
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, 623);
this.button5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.button5.Location = new System.Drawing.Point(2, 511);
this.button5.Margin = new System.Windows.Forms.Padding(2);
this.button5.Name = "button5";
this.button5.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0);
this.button5.Size = new System.Drawing.Size(312, 114);
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;
@@ -257,32 +262,32 @@
// flowLayoutPanel3
//
this.flowLayoutPanel3.AutoScroll = true;
this.flowLayoutPanel3.Location = new System.Drawing.Point(325, 283);
this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.flowLayoutPanel3.Location = new System.Drawing.Point(244, 230);
this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(2);
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
this.flowLayoutPanel3.Size = new System.Drawing.Size(1273, 946);
this.flowLayoutPanel3.Size = new System.Drawing.Size(955, 769);
this.flowLayoutPanel3.TabIndex = 14;
this.flowLayoutPanel3.Paint += new System.Windows.Forms.PaintEventHandler(this.flowLayoutPanel3_Paint);
//
// txtbusqueda
//
this.txtbusqueda.Font = new System.Drawing.Font("Poppins", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtbusqueda.Location = new System.Drawing.Point(329, 219);
this.txtbusqueda.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.txtbusqueda.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtbusqueda.Location = new System.Drawing.Point(247, 178);
this.txtbusqueda.Margin = new System.Windows.Forms.Padding(2);
this.txtbusqueda.Name = "txtbusqueda";
this.txtbusqueda.Size = new System.Drawing.Size(702, 45);
this.txtbusqueda.Size = new System.Drawing.Size(528, 30);
this.txtbusqueda.TabIndex = 15;
this.txtbusqueda.TextChanged += new System.EventHandler(this.txtbusqueda_TextChanged);
//
// bntImprimir
//
this.bntImprimir.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(104)))), ((int)(((byte)(255)))));
this.bntImprimir.Font = new System.Drawing.Font("Poppins", 15F);
this.bntImprimir.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
this.bntImprimir.ForeColor = System.Drawing.Color.Transparent;
this.bntImprimir.Location = new System.Drawing.Point(1055, 210);
this.bntImprimir.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.bntImprimir.Location = new System.Drawing.Point(791, 171);
this.bntImprimir.Margin = new System.Windows.Forms.Padding(2);
this.bntImprimir.Name = "bntImprimir";
this.bntImprimir.Size = new System.Drawing.Size(151, 54);
this.bntImprimir.Size = new System.Drawing.Size(113, 44);
this.bntImprimir.TabIndex = 17;
this.bntImprimir.Text = "Vender";
this.bntImprimir.UseVisualStyleBackColor = false;
@@ -290,40 +295,49 @@
//
// responsablecb
//
this.responsablecb.Font = new System.Drawing.Font("Poppins", 15F);
this.responsablecb.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
this.responsablecb.FormattingEnabled = true;
this.responsablecb.Items.AddRange(new object[] {
"Fabian Herrera",
"Cristofer Perez ",
"Angel Alexander",
"Emilio Urenda"});
this.responsablecb.Location = new System.Drawing.Point(1371, 212);
this.responsablecb.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.responsablecb.Location = new System.Drawing.Point(1028, 172);
this.responsablecb.Margin = new System.Windows.Forms.Padding(2);
this.responsablecb.Name = "responsablecb";
this.responsablecb.Size = new System.Drawing.Size(227, 52);
this.responsablecb.Size = new System.Drawing.Size(171, 33);
this.responsablecb.TabIndex = 18;
this.responsablecb.SelectedIndexChanged += new System.EventHandler(this.responsablecb_SelectedIndexChanged);
//
// btnFiar
//
this.btnFiar.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(104)))), ((int)(((byte)(255)))));
this.btnFiar.Font = new System.Drawing.Font("Poppins", 15F);
this.btnFiar.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
this.btnFiar.ForeColor = System.Drawing.Color.Transparent;
this.btnFiar.Location = new System.Drawing.Point(1213, 210);
this.btnFiar.Margin = new System.Windows.Forms.Padding(4);
this.btnFiar.Location = new System.Drawing.Point(910, 171);
this.btnFiar.Name = "btnFiar";
this.btnFiar.Size = new System.Drawing.Size(151, 54);
this.btnFiar.Size = new System.Drawing.Size(113, 44);
this.btnFiar.TabIndex = 19;
this.btnFiar.Text = "Cuenta";
this.btnFiar.UseVisualStyleBackColor = false;
this.btnFiar.Click += new System.EventHandler(this.btnFiar_Click);
//
// btnEnviar
//
this.btnEnviar.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(104)))), ((int)(((byte)(255)))));
this.btnEnviar.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
this.btnEnviar.ForeColor = System.Drawing.Color.Transparent;
this.btnEnviar.Location = new System.Drawing.Point(791, 111);
this.btnEnviar.Margin = new System.Windows.Forms.Padding(2);
this.btnEnviar.Name = "btnEnviar";
this.btnEnviar.Size = new System.Drawing.Size(113, 44);
this.btnEnviar.TabIndex = 20;
this.btnEnviar.Text = "Enviar";
this.btnEnviar.UseVisualStyleBackColor = false;
this.btnEnviar.Click += new System.EventHandler(this.btnEnviar_Click);
//
// vender
//
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(1827, 884);
this.ClientSize = new System.Drawing.Size(1300, 627);
this.ControlBox = false;
this.Controls.Add(this.btnEnviar);
this.Controls.Add(this.btnFiar);
this.Controls.Add(this.responsablecb);
this.Controls.Add(this.bntImprimir);
@@ -333,7 +347,7 @@
this.Controls.Add(this.lblhora);
this.Controls.Add(this.flowLayoutPanel2);
this.Controls.Add(this.flowLayoutPanel1);
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.Margin = new System.Windows.Forms.Padding(2);
this.Name = "vender";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.vender_Load);
@@ -374,5 +388,6 @@
private System.Windows.Forms.Button bntImprimir;
private System.Windows.Forms.ComboBox responsablecb;
private System.Windows.Forms.Button btnFiar;
private System.Windows.Forms.Button btnEnviar;
}
}
+68
View File
@@ -36,9 +36,19 @@ namespace compabetov2
InitializeComponent();
getData();
llenarLayout();
llenarComBox();
this.loginPrincipal = loginPrincipal;
}
private void llenarComBox()
{
List<Empleado> empleados = service.conseguirEmpleados();
foreach(Empleado empleado in empleados)
{
responsablecb.Items.Add(empleado.nombre);
}
}
private void llenarLayout()
{
foreach (Producto producto in productos)
@@ -662,6 +672,64 @@ namespace compabetov2
{
}
private List<DetalleEnvioModel> listaProductosEnvio()
{
List<DetalleEnvioModel> detallesEnvio = new List<DetalleEnvioModel>();
int contador_saltar_2_vueltas = 1;
foreach (var item in flowLayoutPanel2.Controls)
{
if (contador_saltar_2_vueltas <= 3)
{
contador_saltar_2_vueltas++;
continue;
}
TableLayoutPanel panelProducto = item as TableLayoutPanel;
TableLayoutPanel panelInfo = panelProducto.Controls[1] as TableLayoutPanel;
PictureBox pic = panelProducto.Controls[0] as PictureBox;
Label idLabel = null;
foreach (Control control in pic.Controls)
{
if (control is Label)
{
idLabel = (Label)control;
break;
}
}
int idProducto = int.Parse(idLabel.Text);
Producto producto = new Producto(idProducto);
Label Lbcantidad = panelInfo.Controls[2] as Label;
string textcantidad = Lbcantidad.Text;
string[] cantidadCadenas = textcantidad.Split(' ');
int cantidad = int.Parse(cantidadCadenas[1]);
DetalleEnvioModel detalleEnvio = new DetalleEnvioModel(-1, producto, cantidad);
detallesEnvio.Add(detalleEnvio);
}
return detallesEnvio;
}
private void btnEnviar_Click(object sender, EventArgs e)
{
List<DetalleEnvioModel> detallesEnvio = listaProductosEnvio();
string responsable = responsablecb.Text.Equals("") ? loginPrincipal.usuario : responsablecb.Text;
Envio envio = new Envio(-1, DateTime.Now.ToString(), "", "", responsable,"","",total+10);
if(detallesEnvio.Count > 0){
if (service.crearEnvio(envio, detallesEnvio))
{
MessageBox.Show("Envio hecho");
}
else
{
MessageBox.Show("No hay ningun producto agregado");
}
}
}
}
}
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+2
View File
@@ -106,6 +106,8 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="database\modelos\DetalleEnvioModel.cs" />
<Compile Include="database\modelos\Envio.cs" />
<Compile Include="Empleados\AgregarEmpleado1.cs">
<SubType>Form</SubType>
</Compile>
+305 -4
View File
@@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Data.SQLite;
using System.Diagnostics.Contracts;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Security.Policy;
@@ -170,8 +171,6 @@ namespace compabetov2.database
SQLiteCommand commandEmpleado = new SQLiteCommand(sqlEmpleado, conexion);
commandEmpleado.Parameters.AddWithValue("@fklogin", fkLogin);
commandEmpleado.Parameters.AddWithValue("@idempleado", idempleado);
commandEmpleado.ExecuteNonQuery();
transaccion.Commit();
@@ -325,7 +324,7 @@ namespace compabetov2.database
conexion.Open();
string sql = "SELECT * FROM Empleado";
string sql = "SELECT * FROM Empleado WHERE idempleado > 1";
SQLiteCommand command = new SQLiteCommand(sql, conexion);
reader = command.ExecuteReader();
@@ -915,7 +914,7 @@ namespace compabetov2.database
conexion.Open();
string sql = "SELECT * FROM cuenta WHERE estado = 'ACTIVO'";
string sql = "SELECT * FROM cuenta ORDER BY idCuenta DESC";
SQLiteCommand command = new SQLiteCommand(sql, conexion);
reader = command.ExecuteReader();
@@ -1098,6 +1097,7 @@ namespace compabetov2.database
SQLiteCommand commandCuenta = new SQLiteCommand(sqlCuenta, conexion);
commandCuenta.Parameters.AddWithValue("@idCuenta", cuenta.id);
commandCuenta.ExecuteNonQuery();
SQLiteCommand commandConsulta = new SQLiteCommand(sqlIdVenta, conexion);
SQLiteDataReader reader = commandConsulta.ExecuteReader();
@@ -1162,6 +1162,300 @@ namespace compabetov2.database
}
}
public static Dictionary<string, dynamic> filtrarVentaFechaMes(DateTime fecha)
{
Dictionary<string, dynamic> estadisticas = new Dictionary<string, dynamic>();
SQLiteDataReader reader = DAO.filtrarVentaFechaMesDAO(fecha);
string formatoFecha = "dd/MM/yyyy";
decimal totalDia = 0;
decimal totalMes = 0;
List<VentaModel> ventas = new List<VentaModel>();
while (reader.Read())
{
VentaModel venta = new VentaModel(
(decimal)reader["total"],
(int)reader.GetInt64(0),
reader.GetString(1)
);
string[] cadenasFech = venta.fecha.Split(' ');
DateTime.TryParseExact(cadenasFech[0], formatoFecha, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime fechaVenta);
if (fecha.Day == fechaVenta.Day)
{
totalDia += venta.total;
}
totalMes += venta.total;
ventas.Add(venta);
}
estadisticas.Add("ventasDia", totalDia);
estadisticas.Add("ventasMes", totalMes);
return estadisticas;
}
public static bool crearEnvio(Envio envio, List<DetalleEnvioModel> detallesEnvio)
{
return DAO.crearEnvioDAO(envio, detallesEnvio);
}
public static bool crearEnvioDAO(Envio envio, List<DetalleEnvioModel> detallesEnvio)
{
var db_conexion = new Conexion();
try
{
using (SQLiteConnection conexion = db_conexion.get_connection())
{
conexion.Open();
using (var transaccion = conexion.BeginTransaction())
{
try
{
string sqlEnvio = "INSERT INTO envios (fecha, direccion, telefono,responzable,total) VALUES(@fecha,@direccion , @telefono, @responzable, @total);";
string sqlDetalle = "INSERT INTO detalle_envios (fk_envios, fk_producto, cantidad) VALUES(@fk_envios, @fk_producto, @cantidad);";
string sqlIdCuenta = "SELECT idEnvios FROM envios ORDER BY idEnvios DESC LIMIT 1";
SQLiteCommand commandCuenta = new SQLiteCommand(sqlEnvio, conexion);
commandCuenta.Parameters.AddWithValue("@fecha", envio.fecha);
commandCuenta.Parameters.AddWithValue("@direccion", "");
commandCuenta.Parameters.AddWithValue("@telefono", "");
commandCuenta.Parameters.AddWithValue("@responzable", envio.responsable);
commandCuenta.Parameters.AddWithValue("@total", envio.total);
commandCuenta.ExecuteNonQuery();
SQLiteCommand commandConsulta = new SQLiteCommand(sqlIdCuenta, conexion);
SQLiteDataReader reader = commandConsulta.ExecuteReader();
long idEnvio = -1;
while (reader.Read())
{
idEnvio = reader.GetInt64(0);
}
foreach (DetalleEnvioModel detalleEnvio in detallesEnvio)
{
SQLiteCommand commandDetalle = new SQLiteCommand(sqlDetalle, conexion);
commandDetalle.Parameters.AddWithValue("@fk_envios", idEnvio);
commandDetalle.Parameters.AddWithValue("@fk_producto", detalleEnvio.producto.idProducto);
commandDetalle.Parameters.AddWithValue("@cantidad", detalleEnvio.cantidad);
commandDetalle.ExecuteNonQuery();
}
transaccion.Commit();
return true;
}
catch (SQLiteException ex)
{
transaccion.Rollback();
MessageBox.Show(ex.Message);
return false;
}
}
}
}
catch (SQLiteException ex)
{
MessageBox.Show(ex.Message);
return false;
}
}
public static SQLiteDataReader conseguirEnvioDAO()
{
SQLiteDataReader reader = null;
var db_conexion = new Conexion();
try
{
SQLiteConnection conexion = db_conexion.get_connection();
conexion.Open();
string sql = "SELECT * FROM envios ORDER BY idEnvios DESC";
SQLiteCommand command = new SQLiteCommand(sql, conexion);
reader = command.ExecuteReader();
return reader;
}
catch (SQLiteException ex)
{
MessageBox.Show(ex.Message);
return reader;
}
}
public static SQLiteDataReader conseguirDetalleEnvioDAO(int idEnvio)
{
SQLiteDataReader reader = null;
var db_conexion = new Conexion();
try
{
SQLiteConnection conexion = db_conexion.get_connection();
conexion.Open();
string sql = "Select p.idproducto, p.nombre , de.cantidad from detalle_envios de, Producto p WHERE de.fk_producto = p.idproducto and de.fk_envios = @fk_envios;";
SQLiteCommand command = new SQLiteCommand(sql, conexion);
command.Parameters.AddWithValue("@fk_envios", idEnvio);
reader = command.ExecuteReader();
return reader;
}
catch (SQLiteException ex)
{
MessageBox.Show(ex.Message);
return reader;
}
}
public static bool editarEnvioDAO(Envio envio)
{
var db_conexion = new Conexion();
try
{
using (SQLiteConnection conexion = db_conexion.get_connection())
{
conexion.Open();
using (var transaccion = conexion.BeginTransaction())
{
try
{
string sqlCuenta = "UPDATE envios SET direccion = @direccion, telefono = @telefono, cliente = @cliente WHERE idEnvios = @idEnvios;";
SQLiteCommand command = new SQLiteCommand(sqlCuenta, conexion);
command.Parameters.AddWithValue("@idEnvios", envio.id);
command.Parameters.AddWithValue("@direccion", envio.direccion);
command.Parameters.AddWithValue("@telefono", envio.telefono);
command.Parameters.AddWithValue("@cliente", envio.cliente);
command.ExecuteNonQuery();
transaccion.Commit();
return true;
}
catch (SQLiteException ex)
{
transaccion.Rollback();
MessageBox.Show(ex.Message);
return false;
}
}
}
}
catch (SQLiteException ex)
{
MessageBox.Show(ex.Message);
return false;
}
}
public static bool cancelarEnvioDAO(int idEnvio)
{
var db_conexion = new Conexion();
try
{
using (SQLiteConnection conexion = db_conexion.get_connection())
{
conexion.Open();
using (var transaccion = conexion.BeginTransaction())
{
try
{
string sqlCuenta = "UPDATE envios SET estado = @estado WHERE idEnvios = @idEnvios;";
SQLiteCommand command = new SQLiteCommand(sqlCuenta, conexion);
command.Parameters.AddWithValue("@idEnvios", idEnvio);
command.Parameters.AddWithValue("@estado", "CANCELADO");
command.ExecuteNonQuery();
transaccion.Commit();
return true;
}
catch (SQLiteException ex)
{
transaccion.Rollback();
MessageBox.Show(ex.Message);
return false;
}
}
}
}
catch (SQLiteException ex)
{
MessageBox.Show(ex.Message);
return false;
}
}
public static bool concluirEnvioDAO(Envio envio, List<DetalleEnvioModel> detallesEnvio)
{
var db_conexion = new Conexion();
try
{
using (SQLiteConnection conexion = db_conexion.get_connection())
{
conexion.Open();
using (var transaccion = conexion.BeginTransaction())
{
try
{
string sqlVenta = "INSERT INTO venta (fecha, total) VALUES(@fecha, @total);";
string sqlDetalle = "INSERT INTO detalle_venta (fk_venta, fk_producto, cantidad) VALUES(@idVenta, @idProducto, @cantidada);";
string sqlEnvio = "UPDATE envios SET estado ='CONCLUIDO' WHERE idEnvios = @idEnvios;";
string sqlIdVenta = "SELECT idVenta FROM venta ORDER BY idVenta DESC LIMIT 1";
SQLiteCommand commandVenta = new SQLiteCommand(sqlVenta, conexion);
commandVenta.Parameters.AddWithValue("@fecha", DateTime.Now.ToString());
commandVenta.Parameters.AddWithValue("@total", envio.total);
commandVenta.ExecuteNonQuery();
SQLiteCommand commandEnvio = new SQLiteCommand(sqlEnvio, conexion);
commandEnvio.Parameters.AddWithValue("@idEnvios", envio.id);
commandEnvio.ExecuteNonQuery();
SQLiteCommand commandConsulta = new SQLiteCommand(sqlIdVenta, conexion);
SQLiteDataReader reader = commandConsulta.ExecuteReader();
long idVenta = -1;
while (reader.Read())
{
idVenta = reader.GetInt64(0);
}
foreach (DetalleEnvioModel detalleEnvio in detallesEnvio)
{
SQLiteCommand commandEmpleado = new SQLiteCommand(sqlDetalle, conexion);
commandEmpleado.Parameters.AddWithValue("@idVenta", idVenta);
commandEmpleado.Parameters.AddWithValue("@idProducto", detalleEnvio.producto.idProducto);
commandEmpleado.Parameters.AddWithValue("@cantidada", detalleEnvio.cantidad);
commandEmpleado.ExecuteNonQuery();
}
transaccion.Commit();
return true;
}
catch (SQLiteException ex)
{
transaccion.Rollback();
MessageBox.Show(ex.Message);
return false;
}
}
}
}
catch (SQLiteException ex)
{
MessageBox.Show(ex.Message);
return false;
}
}
private static void crearDB()
{
var db_conexion = new Conexion();
@@ -1181,6 +1475,8 @@ namespace compabetov2.database
"DROP TABLE IF EXISTS venta",
"DROP TABLE IF EXISTS detalle_cuenta",
"DROP TABLE IF EXISTS cuenta",
"DROP TABLE IF EXISTS detalle_envios",
"DROP TABLE IF EXISTS envios",
"CREATE TABLE Login (idlogin INTEGER PRIMARY KEY AUTOINCREMENT, tipo TEXT NOT NULL, usuario TEXT NOT NULL, "+
"contra TEXT NOT NULL)",
@@ -1212,6 +1508,11 @@ namespace compabetov2.database
"CREATE TABLE detalle_cuenta (fk_cuenta INTEGER, fk_producto INTEGER,cantidad INTEGER, PRIMARY KEY (fk_cuenta, fk_producto), " +
"FOREIGN KEY (fk_cuenta) REFERENCES Cuenta(idCuenta),FOREIGN KEY (fk_producto) REFERENCES producto(idproducto))",
"CREATE TABLE envios (idEnvios INTEGER PRIMARY KEY AUTOINCREMENT, fecha TEXT, direccion TEXT, telefono TEXT,responzable TEXT DEFAULT '',estado TEXT DEFAULT 'EN PROCESO')",
"CREATE TABLE detalle_envios (fk_envios INTEGER, fk_producto INTEGER,cantidad INTEGER, PRIMARY KEY (fk_envios, fk_producto), " +
"FOREIGN KEY (fk_envios) REFERENCES envios(idEnvios),FOREIGN KEY (fk_producto) REFERENCES producto(idproducto))",
"INSERT INTO Login ( tipo, usuario, contra) VALUES('admin', 'admin', '12345');",
"INSERT INTO Empleado ( nombre, apellidos, calle, fecha_contratacion,estado, colonia, cp, no_ext,no_int, referencia, fecha_nac, telefono,fk_idLogin) VALUES('jefe', '', '', '', '', '', '', '', '', '', '', '',1);",
+22
View File
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace compabetov2.database.modelos
{
public class DetalleEnvioModel
{
public int idEnvio;
public Producto producto;
public int cantidad;
public DetalleEnvioModel(int idEnvio, Producto producto, int cantidad)
{
this.idEnvio = idEnvio;
this.producto = producto;
this.cantidad = cantidad;
}
}
}
+31
View File
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace compabetov2.database.modelos
{
public class Envio
{
public int id;
public string fecha;
public string direccion;
public string telefono;
public string responsable;
public string estado;
public string cliente;
public decimal total;
public Envio(int id, string fecha, string direccion, string telefono, string responsable,string estado,string cliente, decimal total) {
this.id = id;
this.fecha = fecha;
this.direccion = direccion;
this.telefono = telefono;
this.responsable = responsable;
this.estado = estado;
this.cliente = cliente;
this.total = total;
}
}
}
+68 -5
View File
@@ -125,11 +125,9 @@ namespace compabetov2.database
while (reader.Read())
{
int fkIdLogin = -1;
try {
long fkIdLoginTemp = reader.GetInt64(13);
fkIdLogin = Convert.ToInt32(fkIdLoginTemp);
}catch (Exception ex) { }
long fkIdLoginTemp = reader.GetInt64(14);
int fkIdLogin = Convert.ToInt32(fkIdLoginTemp);
long id = reader.GetInt64(0);
Empleado empleado = new Empleado(
Convert.ToInt32(id),
@@ -315,5 +313,70 @@ namespace compabetov2.database
return estadisticas;
}
public static bool crearEnvio(Envio envio, List<DetalleEnvioModel> detallesEnvio)
{
return DAO.crearEnvio(envio, detallesEnvio);
}
public static List<Envio> conseguirEnvio()
{
List<Envio> envios = new List<Envio>();
SQLiteDataReader reader = DAO.conseguirEnvioDAO();
while (reader.Read())
{
Envio envio = new Envio(
(int)reader.GetInt64(0),
reader.GetString(1),
reader.GetString(2),
reader.GetString(3),
reader.GetString(4),
reader.GetString(5),
reader.GetString(7),
reader.GetDecimal(6)
) ;
envios.Add(envio);
}
return envios;
}
public static List<DetalleEnvioModel> conseguirDetalleEnvio(int idEnvio)
{
List<DetalleEnvioModel> detallesEnvio = new List<DetalleEnvioModel>();
SQLiteDataReader reader = DAO.conseguirDetalleEnvioDAO(idEnvio);
while (reader.Read())
{
int idProducto = (int)reader.GetInt64(0);
DetalleEnvioModel detalleEnvio = new DetalleEnvioModel(
idEnvio,
new Producto(idProducto, reader["nombre"].ToString()),
(int)reader.GetInt64(2)
);
detallesEnvio.Add(detalleEnvio);
}
return detallesEnvio;
}
public static bool editarEnvio(Envio envio)
{
return DAO.editarEnvioDAO(envio);
}
public static bool cancelarEnvio(int idEnvio)
{
return DAO.cancelarEnvioDAO(idEnvio);
}
public static bool concluirEnvio(Envio envio, List<DetalleEnvioModel> detallesEnvio)
{
return DAO.concluirEnvioDAO(envio, detallesEnvio);
}
}
}
@@ -1 +1 @@
c3fae808d3f85efa42b7f49a590857079d7d8c73d25abc018ba096b666adc8e2
8c55401a55ae9b86950368a6d6d466458a0cd51b6070f789aecfd894857df381
@@ -122,3 +122,6 @@ C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.Empleados.AgregarEmpl
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.Empleados.AgregarLogin1.resources
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.Empleados.EditarEmpleado1.resources
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.AgregarLogin1.resources
C:\Users\carsu\Source\Repos\compabetoOG\obj\Debug\compabetov2.Empleados.AgregarEmpleado1.resources
C:\Users\carsu\Source\Repos\compabetoOG\obj\Debug\compabetov2.AgregarLogin1.resources
C:\Users\carsu\Source\Repos\compabetoOG\obj\Debug\compabetov2.Empleados.EditarEmpleado1.resources
Binary file not shown.
Binary file not shown.
Binary file not shown.