estadisticas terminadas con detalle del mejor vendedor

This commit is contained in:
Carlos Sandoval
2024-06-30 03:09:38 -06:00
parent d81f706053
commit 8e6571fbc9
15 changed files with 469 additions and 311 deletions
+118 -72
View File
@@ -48,16 +48,19 @@
this.totalNetoMes = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.totalNetoMes = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.lbProductDia = new System.Windows.Forms.Label(); this.lbProductDia = new System.Windows.Forms.Label();
this.lbVendedorDia = new System.Windows.Forms.Label(); this.lbVendedorDia = new System.Windows.Forms.Label();
this.lbTotalDia = new System.Windows.Forms.Label(); this.lbUtilidadDia = new System.Windows.Forms.Label();
this.lbTotalMes = new System.Windows.Forms.Label(); this.lbUtilidadMes = new System.Windows.Forms.Label();
this.lbVendedorMes = new System.Windows.Forms.Label(); this.lbVendedorMes = new System.Windows.Forms.Label();
this.lbProductoMes = new System.Windows.Forms.Label(); this.lbProductoMes = new System.Windows.Forms.Label();
this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.lbDiaSEnvio = new System.Windows.Forms.Label(); this.lbGananciasBrutasDia = new System.Windows.Forms.Label();
this.lbMesSEnvio = new System.Windows.Forms.Label(); this.lbGananciasBrutasMes = new System.Windows.Forms.Label();
this.lbTotalDiaNeto = new System.Windows.Forms.Label(); this.lbTotalImporteDia = new System.Windows.Forms.Label();
this.btnVentasDia = new System.Windows.Forms.Button(); this.btnVentasDia = new System.Windows.Forms.Button();
this.btnVentasMes = new System.Windows.Forms.Button(); this.btnVentasMes = new System.Windows.Forms.Button();
this.lbEnviosDia = new System.Windows.Forms.Label();
this.lbTotalImporteMes = new System.Windows.Forms.Label();
this.lbEnvioMes = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.dgvDia)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvDia)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dgvMes)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvMes)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
@@ -160,7 +163,7 @@
this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.BackColor = System.Drawing.Color.Transparent;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.ForeColor = System.Drawing.Color.Transparent; this.label2.ForeColor = System.Drawing.Color.Transparent;
this.label2.Location = new System.Drawing.Point(27, 387); this.label2.Location = new System.Drawing.Point(33, 482);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(121, 17); this.label2.Size = new System.Drawing.Size(121, 17);
this.label2.TabIndex = 4; this.label2.TabIndex = 4;
@@ -176,7 +179,7 @@
this.dataGridViewTextBoxColumn3, this.dataGridViewTextBoxColumn3,
this.dataGridViewTextBoxColumn4, this.dataGridViewTextBoxColumn4,
this.totalNetoMes}); this.totalNetoMes});
this.dgvMes.Location = new System.Drawing.Point(24, 406); this.dgvMes.Location = new System.Drawing.Point(30, 501);
this.dgvMes.Name = "dgvMes"; this.dgvMes.Name = "dgvMes";
this.dgvMes.RowHeadersWidth = 51; this.dgvMes.RowHeadersWidth = 51;
this.dgvMes.Size = new System.Drawing.Size(599, 150); this.dgvMes.Size = new System.Drawing.Size(599, 150);
@@ -251,29 +254,30 @@
this.lbVendedorDia.Text = "Mejor vendedos:"; this.lbVendedorDia.Text = "Mejor vendedos:";
this.lbVendedorDia.Click += new System.EventHandler(this.lbVendedorDia_Click); this.lbVendedorDia.Click += new System.EventHandler(this.lbVendedorDia_Click);
// //
// lbTotalDia // lbUtilidadDia
// //
this.lbTotalDia.AutoSize = true; this.lbUtilidadDia.AutoSize = true;
this.lbTotalDia.BackColor = System.Drawing.Color.Transparent; this.lbUtilidadDia.BackColor = System.Drawing.Color.Transparent;
this.lbTotalDia.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbUtilidadDia.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbTotalDia.ForeColor = System.Drawing.Color.Transparent; this.lbUtilidadDia.ForeColor = System.Drawing.Color.Transparent;
this.lbTotalDia.Location = new System.Drawing.Point(333, 356); this.lbUtilidadDia.Location = new System.Drawing.Point(419, 355);
this.lbTotalDia.Name = "lbTotalDia"; this.lbUtilidadDia.Name = "lbUtilidadDia";
this.lbTotalDia.Size = new System.Drawing.Size(90, 17); this.lbUtilidadDia.Size = new System.Drawing.Size(105, 17);
this.lbTotalDia.TabIndex = 8; this.lbUtilidadDia.TabIndex = 8;
this.lbTotalDia.Text = "Total del dia:"; this.lbUtilidadDia.Text = "Utilidad del dia:";
this.lbUtilidadDia.Click += new System.EventHandler(this.lbTotalDia_Click);
// //
// lbTotalMes // lbUtilidadMes
// //
this.lbTotalMes.AutoSize = true; this.lbUtilidadMes.AutoSize = true;
this.lbTotalMes.BackColor = System.Drawing.Color.Transparent; this.lbUtilidadMes.BackColor = System.Drawing.Color.Transparent;
this.lbTotalMes.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbUtilidadMes.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbTotalMes.ForeColor = System.Drawing.Color.Transparent; this.lbUtilidadMes.ForeColor = System.Drawing.Color.Transparent;
this.lbTotalMes.Location = new System.Drawing.Point(333, 575); this.lbUtilidadMes.Location = new System.Drawing.Point(419, 664);
this.lbTotalMes.Name = "lbTotalMes"; this.lbUtilidadMes.Name = "lbUtilidadMes";
this.lbTotalMes.Size = new System.Drawing.Size(97, 17); this.lbUtilidadMes.Size = new System.Drawing.Size(112, 17);
this.lbTotalMes.TabIndex = 9; this.lbUtilidadMes.TabIndex = 9;
this.lbTotalMes.Text = "Total del Mes:"; this.lbUtilidadMes.Text = "Utilidad del mes:";
// //
// lbVendedorMes // lbVendedorMes
// //
@@ -281,7 +285,7 @@
this.lbVendedorMes.BackColor = System.Drawing.Color.Transparent; this.lbVendedorMes.BackColor = System.Drawing.Color.Transparent;
this.lbVendedorMes.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbVendedorMes.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbVendedorMes.ForeColor = System.Drawing.Color.Transparent; this.lbVendedorMes.ForeColor = System.Drawing.Color.Transparent;
this.lbVendedorMes.Location = new System.Drawing.Point(659, 457); this.lbVendedorMes.Location = new System.Drawing.Point(665, 552);
this.lbVendedorMes.Name = "lbVendedorMes"; this.lbVendedorMes.Name = "lbVendedorMes";
this.lbVendedorMes.Size = new System.Drawing.Size(111, 17); this.lbVendedorMes.Size = new System.Drawing.Size(111, 17);
this.lbVendedorMes.TabIndex = 11; this.lbVendedorMes.TabIndex = 11;
@@ -294,7 +298,7 @@
this.lbProductoMes.BackColor = System.Drawing.Color.Transparent; this.lbProductoMes.BackColor = System.Drawing.Color.Transparent;
this.lbProductoMes.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbProductoMes.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbProductoMes.ForeColor = System.Drawing.Color.Transparent; this.lbProductoMes.ForeColor = System.Drawing.Color.Transparent;
this.lbProductoMes.Location = new System.Drawing.Point(657, 387); this.lbProductoMes.Location = new System.Drawing.Point(663, 482);
this.lbProductoMes.Name = "lbProductoMes"; this.lbProductoMes.Name = "lbProductoMes";
this.lbProductoMes.Size = new System.Drawing.Size(153, 17); this.lbProductoMes.Size = new System.Drawing.Size(153, 17);
this.lbProductoMes.TabIndex = 10; this.lbProductoMes.TabIndex = 10;
@@ -306,7 +310,7 @@
this.pictureBox2.BackColor = System.Drawing.Color.Transparent; this.pictureBox2.BackColor = System.Drawing.Color.Transparent;
this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.pictureBox2.Image = global::compabetov2.Properties.Resources.check1; this.pictureBox2.Image = global::compabetov2.Properties.Resources.check1;
this.pictureBox2.Location = new System.Drawing.Point(785, 560); this.pictureBox2.Location = new System.Drawing.Point(911, 680);
this.pictureBox2.Margin = new System.Windows.Forms.Padding(2); this.pictureBox2.Margin = new System.Windows.Forms.Padding(2);
this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(75, 56); this.pictureBox2.Size = new System.Drawing.Size(75, 56);
@@ -314,45 +318,45 @@
this.pictureBox2.TabStop = false; this.pictureBox2.TabStop = false;
this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click); this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click);
// //
// lbDiaSEnvio // lbGananciasBrutasDia
// //
this.lbDiaSEnvio.AutoSize = true; this.lbGananciasBrutasDia.AutoSize = true;
this.lbDiaSEnvio.BackColor = System.Drawing.Color.Transparent; this.lbGananciasBrutasDia.BackColor = System.Drawing.Color.Transparent;
this.lbDiaSEnvio.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbGananciasBrutasDia.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbDiaSEnvio.ForeColor = System.Drawing.Color.Transparent; this.lbGananciasBrutasDia.ForeColor = System.Drawing.Color.Transparent;
this.lbDiaSEnvio.Location = new System.Drawing.Point(266, 373); this.lbGananciasBrutasDia.Location = new System.Drawing.Point(358, 398);
this.lbDiaSEnvio.Name = "lbDiaSEnvio"; this.lbGananciasBrutasDia.Name = "lbGananciasBrutasDia";
this.lbDiaSEnvio.Size = new System.Drawing.Size(157, 17); this.lbGananciasBrutasDia.Size = new System.Drawing.Size(166, 17);
this.lbDiaSEnvio.TabIndex = 29; this.lbGananciasBrutasDia.TabIndex = 29;
this.lbDiaSEnvio.Text = "Total del dia sin envios:"; this.lbGananciasBrutasDia.Text = "Ganancias brutas del dia";
// //
// lbMesSEnvio // lbGananciasBrutasMes
// //
this.lbMesSEnvio.AutoSize = true; this.lbGananciasBrutasMes.AutoSize = true;
this.lbMesSEnvio.BackColor = System.Drawing.Color.Transparent; this.lbGananciasBrutasMes.BackColor = System.Drawing.Color.Transparent;
this.lbMesSEnvio.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbGananciasBrutasMes.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbMesSEnvio.ForeColor = System.Drawing.Color.Transparent; this.lbGananciasBrutasMes.ForeColor = System.Drawing.Color.Transparent;
this.lbMesSEnvio.Location = new System.Drawing.Point(266, 601); this.lbGananciasBrutasMes.Location = new System.Drawing.Point(352, 719);
this.lbMesSEnvio.Name = "lbMesSEnvio"; this.lbGananciasBrutasMes.Name = "lbGananciasBrutasMes";
this.lbMesSEnvio.Size = new System.Drawing.Size(164, 17); this.lbGananciasBrutasMes.Size = new System.Drawing.Size(171, 17);
this.lbMesSEnvio.TabIndex = 30; this.lbGananciasBrutasMes.TabIndex = 30;
this.lbMesSEnvio.Text = "Total del mes sin envios:"; this.lbGananciasBrutasMes.Text = "Ganancias Brutas del dia:";
// //
// lbTotalDiaNeto // lbTotalImporteDia
// //
this.lbTotalDiaNeto.AutoSize = true; this.lbTotalImporteDia.AutoSize = true;
this.lbTotalDiaNeto.BackColor = System.Drawing.Color.Transparent; this.lbTotalImporteDia.BackColor = System.Drawing.Color.Transparent;
this.lbTotalDiaNeto.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbTotalImporteDia.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbTotalDiaNeto.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.lbTotalImporteDia.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.lbTotalDiaNeto.Location = new System.Drawing.Point(70, 356); this.lbTotalImporteDia.Location = new System.Drawing.Point(70, 356);
this.lbTotalDiaNeto.Name = "lbTotalDiaNeto"; this.lbTotalImporteDia.Name = "lbTotalImporteDia";
this.lbTotalDiaNeto.Size = new System.Drawing.Size(114, 16); this.lbTotalImporteDia.Size = new System.Drawing.Size(133, 16);
this.lbTotalDiaNeto.TabIndex = 31; this.lbTotalImporteDia.TabIndex = 31;
this.lbTotalDiaNeto.Text = "Total neto del dia:"; this.lbTotalImporteDia.Text = "Total Importe del dia:";
// //
// btnVentasDia // btnVentasDia
// //
this.btnVentasDia.Location = new System.Drawing.Point(876, 232); this.btnVentasDia.Location = new System.Drawing.Point(660, 313);
this.btnVentasDia.Name = "btnVentasDia"; this.btnVentasDia.Name = "btnVentasDia";
this.btnVentasDia.Size = new System.Drawing.Size(110, 23); this.btnVentasDia.Size = new System.Drawing.Size(110, 23);
this.btnVentasDia.TabIndex = 32; this.btnVentasDia.TabIndex = 32;
@@ -362,7 +366,7 @@
// //
// btnVentasMes // btnVentasMes
// //
this.btnVentasMes.Location = new System.Drawing.Point(876, 421); this.btnVentasMes.Location = new System.Drawing.Point(666, 611);
this.btnVentasMes.Name = "btnVentasMes"; this.btnVentasMes.Name = "btnVentasMes";
this.btnVentasMes.Size = new System.Drawing.Size(110, 23); this.btnVentasMes.Size = new System.Drawing.Size(110, 23);
this.btnVentasMes.TabIndex = 33; this.btnVentasMes.TabIndex = 33;
@@ -370,6 +374,42 @@
this.btnVentasMes.UseVisualStyleBackColor = true; this.btnVentasMes.UseVisualStyleBackColor = true;
this.btnVentasMes.Click += new System.EventHandler(this.btnVentasMes_Click); this.btnVentasMes.Click += new System.EventHandler(this.btnVentasMes_Click);
// //
// lbEnviosDia
//
this.lbEnviosDia.AutoSize = true;
this.lbEnviosDia.BackColor = System.Drawing.Color.Transparent;
this.lbEnviosDia.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbEnviosDia.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.lbEnviosDia.Location = new System.Drawing.Point(70, 399);
this.lbEnviosDia.Name = "lbEnviosDia";
this.lbEnviosDia.Size = new System.Drawing.Size(147, 16);
this.lbEnviosDia.TabIndex = 34;
this.lbEnviosDia.Text = "Total de envios del dia:";
//
// lbTotalImporteMes
//
this.lbTotalImporteMes.AutoSize = true;
this.lbTotalImporteMes.BackColor = System.Drawing.Color.Transparent;
this.lbTotalImporteMes.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbTotalImporteMes.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.lbTotalImporteMes.Location = new System.Drawing.Point(84, 665);
this.lbTotalImporteMes.Name = "lbTotalImporteMes";
this.lbTotalImporteMes.Size = new System.Drawing.Size(140, 16);
this.lbTotalImporteMes.TabIndex = 35;
this.lbTotalImporteMes.Text = "Total Importe del mes:";
//
// lbEnvioMes
//
this.lbEnvioMes.AutoSize = true;
this.lbEnvioMes.BackColor = System.Drawing.Color.Transparent;
this.lbEnvioMes.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbEnvioMes.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.lbEnvioMes.Location = new System.Drawing.Point(70, 719);
this.lbEnvioMes.Name = "lbEnvioMes";
this.lbEnvioMes.Size = new System.Drawing.Size(154, 16);
this.lbEnvioMes.TabIndex = 36;
this.lbEnvioMes.Text = "Total de envios del mes:";
//
// Estadiscticas // Estadiscticas
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -379,16 +419,19 @@
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.ClientSize = new System.Drawing.Size(1038, 772); this.ClientSize = new System.Drawing.Size(1038, 772);
this.ControlBox = false; this.ControlBox = false;
this.Controls.Add(this.lbEnvioMes);
this.Controls.Add(this.lbTotalImporteMes);
this.Controls.Add(this.lbEnviosDia);
this.Controls.Add(this.btnVentasMes); this.Controls.Add(this.btnVentasMes);
this.Controls.Add(this.btnVentasDia); this.Controls.Add(this.btnVentasDia);
this.Controls.Add(this.lbTotalDiaNeto); this.Controls.Add(this.lbTotalImporteDia);
this.Controls.Add(this.lbMesSEnvio); this.Controls.Add(this.lbGananciasBrutasMes);
this.Controls.Add(this.lbDiaSEnvio); this.Controls.Add(this.lbGananciasBrutasDia);
this.Controls.Add(this.pictureBox2); this.Controls.Add(this.pictureBox2);
this.Controls.Add(this.lbVendedorMes); this.Controls.Add(this.lbVendedorMes);
this.Controls.Add(this.lbProductoMes); this.Controls.Add(this.lbProductoMes);
this.Controls.Add(this.lbTotalMes); this.Controls.Add(this.lbUtilidadMes);
this.Controls.Add(this.lbTotalDia); this.Controls.Add(this.lbUtilidadDia);
this.Controls.Add(this.lbVendedorDia); this.Controls.Add(this.lbVendedorDia);
this.Controls.Add(this.lbProductDia); this.Controls.Add(this.lbProductDia);
this.Controls.Add(this.dgvMes); this.Controls.Add(this.dgvMes);
@@ -419,13 +462,13 @@
private System.Windows.Forms.DataGridView dgvMes; private System.Windows.Forms.DataGridView dgvMes;
private System.Windows.Forms.Label lbProductDia; private System.Windows.Forms.Label lbProductDia;
private System.Windows.Forms.Label lbVendedorDia; private System.Windows.Forms.Label lbVendedorDia;
private System.Windows.Forms.Label lbTotalDia; private System.Windows.Forms.Label lbUtilidadDia;
private System.Windows.Forms.Label lbTotalMes; private System.Windows.Forms.Label lbUtilidadMes;
private System.Windows.Forms.Label lbVendedorMes; private System.Windows.Forms.Label lbVendedorMes;
private System.Windows.Forms.Label lbProductoMes; private System.Windows.Forms.Label lbProductoMes;
private System.Windows.Forms.PictureBox pictureBox2; private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.Label lbDiaSEnvio; private System.Windows.Forms.Label lbGananciasBrutasDia;
private System.Windows.Forms.Label lbMesSEnvio; private System.Windows.Forms.Label lbGananciasBrutasMes;
private System.Windows.Forms.DataGridViewTextBoxColumn Producto; private System.Windows.Forms.DataGridViewTextBoxColumn Producto;
private System.Windows.Forms.DataGridViewTextBoxColumn Precio; private System.Windows.Forms.DataGridViewTextBoxColumn Precio;
private System.Windows.Forms.DataGridViewTextBoxColumn precioCompra; private System.Windows.Forms.DataGridViewTextBoxColumn precioCompra;
@@ -438,8 +481,11 @@
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3; private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4; private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
private System.Windows.Forms.DataGridViewTextBoxColumn totalNetoMes; private System.Windows.Forms.DataGridViewTextBoxColumn totalNetoMes;
private System.Windows.Forms.Label lbTotalDiaNeto; private System.Windows.Forms.Label lbTotalImporteDia;
private System.Windows.Forms.Button btnVentasDia; private System.Windows.Forms.Button btnVentasDia;
private System.Windows.Forms.Button btnVentasMes; private System.Windows.Forms.Button btnVentasMes;
private System.Windows.Forms.Label lbEnviosDia;
private System.Windows.Forms.Label lbTotalImporteMes;
private System.Windows.Forms.Label lbEnvioMes;
} }
} }
+98 -90
View File
@@ -10,13 +10,15 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml.Serialization.Configuration;
namespace compabetov2 namespace compabetov2
{ {
public partial class Estadiscticas : Form public partial class Estadiscticas : Form
{ {
private List<VentaModel> ventasDia; Dictionary<string, List<Dictionary<string, dynamic>>> resumen;
private List<VentaModel> ventasMes; decimal costosCompraProductos;
decimal ganaciaBrutaProductos;
public Estadiscticas() public Estadiscticas()
{ {
@@ -35,120 +37,102 @@ namespace compabetov2
string fechaBuscaStr = dtpBuscar.Text; string fechaBuscaStr = dtpBuscar.Text;
DateTime.TryParseExact(fechaBuscaStr, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime fechaBuscar); DateTime.TryParseExact(fechaBuscaStr, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime fechaBuscar);
ventasDia = service.conseguirVentasDia(fechaBuscar); resumen = service.estadisticas(fechaBuscar);
ventasMes = service.conseguirVentasMes(fechaBuscar);
List<DetalleVentaModel> productosMes = estadisticasMes(); List<DetalleVentaModel> productosMes = estadisticasMes();
List<DetalleVentaModel> productosDia = estadisticasDia(); List<DetalleVentaModel> productosDia = estadisticasDia();
decimal totalmes = totalMes(); decimal importeMes = calcularImporte(resumen["mes"]);
decimal totaldia = totalDia(); decimal importeDia = calcularImporte(resumen["dia"]);
decimal totaldianeto = totalDiaNeto();
Dictionary<string, List<Envio>> envios = service.conseguirEnvioMes(fechaBuscar); Dictionary<string, List<Envio>> envios = service.conseguirEnvioMes(fechaBuscar);
int enviosMes = cantidadEnvios(envios["mes"]);
int enviosDia = cantidadEnvios(envios["dia"]);
decimal utilidadMes = calcularUtilidad(resumen["mes"], importeMes, enviosMes);
Dictionary<string,dynamic> estadisticas = new Dictionary<string, dynamic> Dictionary<string,dynamic> estadisticas = new Dictionary<string, dynamic>
{ {
{ "mes", new Dictionary<string, dynamic>{ { "mes", new Dictionary<string, dynamic>{
{ "productos", productosMes }, { "productos", productosMes },
{ "productoMasVendido", prodctoMasVendido(productosMes) }, { "productoMasVendido", prodctoMasVendido(productosMes) },
{ "mejorVendedor", mejorVenderdorMes() }, { "mejorVendedor", "yo"/*mejorVenderdorMes()*/ },
{ "totalMes", totalmes }, { "EnvioCantidad", enviosMes },
{ "EnvioCantidad", totalMesSinEnvio(envios) }, { "totalImportes", importeMes },
} }
}, },
{ "dia", new Dictionary<string, dynamic>{ { "dia", new Dictionary<string, dynamic>{
{ "productos", productosDia }, { "productos", productosDia },
{ "productoMasVendido", prodctoMasVendido(productosDia) }, { "productoMasVendido", prodctoMasVendido(productosDia) },
{ "mejorVendedor", mejorVenderdorDia() }, { "mejorVendedor", "yo"/*mejorVenderdorMes()*/ },
{ "totalDia", totalDia()}, { "EnvioCantidad", enviosDia },
{ "totalNetoDia", totaldianeto }, { "totalImportes", importeDia },
{ "EnvioCantidad", totalDiaSinEnvio(envios) },
} }
} }
}; };
mostrarDatos(estadisticas); mostrarDatos(estadisticas);
} }
private int totalMesSinEnvio(Dictionary<string, List<Envio>> envios)
{
return envios["mes"].Count; private int cantidadEnvios(List<Envio> envios)
{
return envios.Count;
} }
private int totalDiaSinEnvio(Dictionary<string, List<Envio>> envios) private decimal calcularUtilidad(List<Dictionary<string, dynamic>> resumen, decimal totalImportes, int cantidadEnvios)
{ {
return envios["dia"].Count; decimal utilidad = 0;
}
private decimal totalMes() costosCompraProductos = 0;
{ ganaciaBrutaProductos = 0;
decimal total = 0;
foreach(VentaModel venta in ventasMes)
foreach (Dictionary<string, dynamic> venta_y_detalles in resumen)
{ {
total += venta.total; foreach(DetalleVentaModel detalle in venta_y_detalles["detalles"])
}
return total;
}
private decimal totalDia()
{
decimal total = 0;
foreach (VentaModel venta in ventasDia)
{
total += venta.total;
}
return total;
}
private decimal totalDiaNeto()
{
decimal total = 0;
foreach (VentaModel venta in ventasDia)
{
List<DetalleVentaModel> detalles = service.conseguirDetallesVenta(venta);
decimal totalDetalle = 0;
foreach(DetalleVentaModel detalle in detalles)
{ {
totalDetalle += detalle.cantidad * (detalle.producto.precio - detalle.producto.precioCompra); ganaciaBrutaProductos += detalle.cantidad * detalle.producto.precio;
costosCompraProductos += detalle.cantidad * detalle.producto.precioCompra;
} }
total += totalDetalle;
} }
return total;
utilidad = ganaciaBrutaProductos - costosCompraProductos;
ganaciaBrutaProductos += totalImportes + (cantidadEnvios * 10);
utilidad += totalImportes + (cantidadEnvios * 10);
return utilidad;
} }
private List<DetalleVentaModel> estadisticasMes() private List<DetalleVentaModel> estadisticasMes()
{ {
List<Dictionary<string, dynamic>> mes = resumen["mes"];
List<DetalleVentaModel> detallesMes = new List<DetalleVentaModel>(); List<DetalleVentaModel> detallesMes = new List<DetalleVentaModel>();
//recorre las ventas del mes foreach (Dictionary<string, dynamic> venta_y_detalles in mes)
foreach (VentaModel venta in ventasMes)
{ {
//consigue los detalles de la venta
List<DetalleVentaModel> detallesVenta = service.conseguirDetallesVenta(venta);
//recorre los detalles de la venta foreach (DetalleVentaModel detallesVenta in venta_y_detalles["detalles"])
foreach (DetalleVentaModel detalle in detallesVenta)
{ {
int totalElementos = detallesMes.Count; int totalElementos = detallesMes.Count;
int contador = 0;
for (int i = 0; i <= totalElementos; i++) for (int i = 0; i <= totalElementos; i++)
{ {
//si no encuentra el producto lo agrega contador++;
//si no existe el producto lo agrega
if (i == totalElementos) if (i == totalElementos)
{ {
DetalleVentaModel detalleAgregar = new DetalleVentaModel(detalle.cantidad, detalle.producto, detalle.idVenta); DetalleVentaModel detalleAgregar = new DetalleVentaModel(detallesVenta.cantidad, detallesVenta.producto, detallesVenta.idVenta);
detallesMes.Add(detalleAgregar); detallesMes.Add(detalleAgregar);
break; break;
} }
DetalleVentaModel producto = detallesMes[i]; DetalleVentaModel producto = detallesMes[i];
//si encuentra el produco solo aumneta la cantidad //si existe el producto solo aumenta la cantidad
if (producto.producto.nombre.Equals(detalle.producto.nombre)) if (producto.producto.nombre.Equals(detallesVenta.producto.nombre))
{ {
producto.cantidad += detalle.cantidad; producto.cantidad += detallesVenta.cantidad;
break; break;
} }
} }
} }
} }
@@ -158,36 +142,34 @@ namespace compabetov2
private List<DetalleVentaModel> estadisticasDia() private List<DetalleVentaModel> estadisticasDia()
{ {
//solo copie y pegue le metodo estadisticas dia y cambie el key en resumen de mes a dia
List<Dictionary<string, dynamic>> dia = resumen["dia"];
List<DetalleVentaModel> detallesDia = new List<DetalleVentaModel>(); List<DetalleVentaModel> detallesDia = new List<DetalleVentaModel>();
//recorre las ventas del mes foreach (Dictionary<string, dynamic> venta_y_detalles in dia) {
foreach (VentaModel venta in ventasDia)
{
//consigue los detalles de la venta
List<DetalleVentaModel> detallesVenta = service.conseguirDetallesVenta(venta);
//recorre los detalles de la venta foreach (DetalleVentaModel detallesVenta in venta_y_detalles["detalles"])
foreach (DetalleVentaModel detalle in detallesVenta)
{ {
int totalElementos = detallesDia.Count; int totalElementos = detallesDia.Count;
int contador = 0; int contador = 0;
for (int i = 0; i <= totalElementos; i++) for (int i = 0; i <= totalElementos; i++)
{ {
contador++; contador++;
//si no encuentra el producto lo agrega //si no existe el producto lo agrega
if (i == totalElementos) if (i == totalElementos)
{ {
DetalleVentaModel detalleAgregar = new DetalleVentaModel(detalle.cantidad, detalle.producto, detalle.idVenta); DetalleVentaModel detalleAgregar = new DetalleVentaModel(detallesVenta.cantidad, detallesVenta.producto, detallesVenta.idVenta);
detallesDia.Add(detalleAgregar); detallesDia.Add(detalleAgregar);
break; break;
} }
DetalleVentaModel producto = detallesDia[i]; DetalleVentaModel producto = detallesDia[i];
//si encuentra el produco solo aumneta la cantidad //si existe el producto solo aumenta la cantidad
if (producto.producto.nombre.Equals(detalle.producto.nombre)) if (producto.producto.nombre.Equals(detallesVenta.producto.nombre))
{ {
producto.cantidad += detalle.cantidad; producto.cantidad += detallesVenta.cantidad;
break; break;
} }
} }
} }
} }
@@ -235,11 +217,13 @@ namespace compabetov2
// Agregar la nueva fila al DataGridView // Agregar la nueva fila al DataGridView
dgvMes.Rows.Add(nuevaFila); dgvMes.Rows.Add(nuevaFila);
} }
decimal totalSinEnvioMes = estadisticas["mes"]["totalMes"] - (estadisticas["mes"]["EnvioCantidad"] *10);
lbTotalMes.Text = $"Total de mes: ${estadisticas["mes"]["totalMes"]}"; lbUtilidadMes.Text = $"Utilidad del mes: ${calcularUtilidad(resumen["mes"], estadisticas["mes"]["totalImportes"], estadisticas["mes"]["EnvioCantidad"])}";
lbProductoMes.Text = $"Producto mas vendido: {estadisticas["mes"]["productoMasVendido"]}"; lbProductoMes.Text = $"Producto mas vendido: {estadisticas["mes"]["productoMasVendido"]}";
lbVendedorMes.Text = $"Mejor vendedor: {estadisticas["mes"]["mejorVendedor"]}"; lbVendedorMes.Text = $"Mejor vendedor: {estadisticas["mes"]["mejorVendedor"]}";
lbMesSEnvio.Text = $"Total del mes sin envios: ${totalSinEnvioMes}"; lbGananciasBrutasMes.Text = $"Ganancias Brutas mes: ${ganaciaBrutaProductos}";
lbTotalImporteMes.Text = $"Total importe del Mes: ${estadisticas["mes"]["totalImportes"]}";
lbEnvioMes.Text = $"Total de envios del mes: ${estadisticas["mes"]["EnvioCantidad"] * 10}";
//dia //dia
List<DetalleVentaModel> detallesDia = estadisticas["dia"]["productos"]; List<DetalleVentaModel> detallesDia = estadisticas["dia"]["productos"];
@@ -278,12 +262,12 @@ namespace compabetov2
dgvDia.Rows.Add(nuevaFila); dgvDia.Rows.Add(nuevaFila);
} }
decimal totalSinEnvioDia = estadisticas["dia"]["totalDia"] - (estadisticas["dia"]["EnvioCantidad"] * 10); lbUtilidadDia.Text = $"Utilidad del dia: ${calcularUtilidad(resumen["dia"], estadisticas["dia"]["totalImportes"], estadisticas["dia"]["EnvioCantidad"])}";
lbTotalDia.Text = $"Total de dia: ${estadisticas["dia"]["totalDia"]}";
lbProductDia.Text = $"Producto mas vendido: {estadisticas["dia"]["productoMasVendido"]}"; lbProductDia.Text = $"Producto mas vendido: {estadisticas["dia"]["productoMasVendido"]}";
lbVendedorDia.Text = $"Mejor vendedor: {estadisticas["dia"]["mejorVendedor"]}"; lbVendedorDia.Text = $"Mejor vendedor: {estadisticas["dia"]["mejorVendedor"]}";
lbDiaSEnvio.Text = $"Total del dia sin envios: ${totalSinEnvioDia}"; lbGananciasBrutasDia.Text = $"Ganancias Brutas dia: ${ganaciaBrutaProductos}";
lbTotalDiaNeto.Text = $"Total neto del dia: ${estadisticas["dia"]["totalNetoDia"]}"; lbTotalImporteDia.Text = $"Total importe del dia: ${estadisticas["dia"]["totalImportes"]}";
lbEnviosDia.Text = $"Total de envios del dia: ${estadisticas["dia"]["EnvioCantidad"] * 10}";
} }
@@ -293,10 +277,11 @@ namespace compabetov2
string mejorVendedor = ""; string mejorVendedor = "";
int contadorNumeroVentas = 0; int contadorNumeroVentas = 0;
Dictionary<string,int> empleados = new Dictionary<string,int>(); List<Dictionary<string, dynamic>> mes = resumen["mes"];
foreach(VentaModel venta in ventasMes) Dictionary<string, int> empleados = new Dictionary<string, int>();
foreach (Dictionary<string, dynamic> venta_y_detalle in mes)
{ {
VentaModel venta = venta_y_detalle["venta"];
if (empleados.ContainsKey(venta.responzable)) if (empleados.ContainsKey(venta.responzable))
{ {
empleados[venta.responzable] += 1; empleados[venta.responzable] += 1;
@@ -342,10 +327,11 @@ namespace compabetov2
string mejorVendedor = ""; string mejorVendedor = "";
int contadorNumeroVentas = 0; int contadorNumeroVentas = 0;
List<Dictionary<string, dynamic>> dia = resumen["dia"];
Dictionary<string, int> empleados = new Dictionary<string, int>(); Dictionary<string, int> empleados = new Dictionary<string, int>();
foreach (VentaModel venta in ventasDia) foreach (Dictionary<string, dynamic> venta_y_detalle in dia)
{ {
VentaModel venta = venta_y_detalle["venta"];
if (empleados.ContainsKey(venta.responzable)) if (empleados.ContainsKey(venta.responzable))
{ {
empleados[venta.responzable] += 1; empleados[venta.responzable] += 1;
@@ -368,6 +354,23 @@ namespace compabetov2
return mejorVendedor; return mejorVendedor;
} }
private decimal calcularImporte(List<Dictionary<string, dynamic>> resumen)
{
decimal totalImporte = 0;
foreach(Dictionary<string, dynamic> informacion in resumen)
{
List<DetalleImporte> importes = informacion["importes"];
foreach(DetalleImporte importe in importes)
{
totalImporte += importe.cantidad * importe.precioImporte;
}
}
return totalImporte;
}
private void label5_Click(object sender, EventArgs e) private void label5_Click(object sender, EventArgs e)
{ {
@@ -410,16 +413,21 @@ namespace compabetov2
private void btnVentasDia_Click(object sender, EventArgs e) private void btnVentasDia_Click(object sender, EventArgs e)
{ {
RegistroVentas ventana = new RegistroVentas(ventasDia,this); RegistroVentas ventana = new RegistroVentas(resumen["dia"],this);
ventana.Owner = this; ventana.Owner = this;
ventana.Show(); ventana.Show();
} }
private void btnVentasMes_Click(object sender, EventArgs e) private void btnVentasMes_Click(object sender, EventArgs e)
{ {
RegistroVentas ventana = new RegistroVentas(ventasMes, this); RegistroVentas ventana = new RegistroVentas(resumen["mes"], this);
ventana.Owner = this; ventana.Owner = this;
ventana.Show(); ventana.Show();
} }
private void lbTotalDia_Click(object sender, EventArgs e)
{
}
} }
} }
-36
View File
@@ -135,42 +135,6 @@
<metadata name="totalNeto.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="totalNeto.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="Producto.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Precio.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="precioCompra.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Cantidad.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Total.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="totalNeto.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn2.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="PrecioCompraMes.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn3.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn4.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="totalNetoMes.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="dataGridViewTextBoxColumn1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
+3 -1
View File
@@ -39,7 +39,7 @@
this.panelVentas.AutoScroll = true; this.panelVentas.AutoScroll = true;
this.panelVentas.Location = new System.Drawing.Point(23, 48); this.panelVentas.Location = new System.Drawing.Point(23, 48);
this.panelVentas.Name = "panelVentas"; this.panelVentas.Name = "panelVentas";
this.panelVentas.Size = new System.Drawing.Size(393, 547); this.panelVentas.Size = new System.Drawing.Size(422, 547);
this.panelVentas.TabIndex = 0; this.panelVentas.TabIndex = 0;
// //
// lbContador // lbContador
@@ -84,7 +84,9 @@
this.Controls.Add(this.lbContador); this.Controls.Add(this.lbContador);
this.Controls.Add(this.panelVentas); this.Controls.Add(this.panelVentas);
this.Name = "RegistroVentas"; this.Name = "RegistroVentas";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "RegistroVentas"; this.Text = "RegistroVentas";
this.Load += new System.EventHandler(this.RegistroVentas_Load);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
+76 -17
View File
@@ -14,27 +14,39 @@ namespace compabetov2
{ {
public partial class RegistroVentas : Form public partial class RegistroVentas : Form
{ {
List<VentaModel> ventas; List<Dictionary<string, dynamic>> ventasYDetalles;
Estadiscticas ventanaPadre; Estadiscticas ventanaPadre;
public RegistroVentas(List<VentaModel> ventas,Estadiscticas ventanaPadre) int cantidadVentas;
int cotaInferior = 0;
int cotaSuperior;
public RegistroVentas(List<Dictionary<string, dynamic>> ventasYDetalles, Estadiscticas ventanaPadre)
{ {
InitializeComponent(); InitializeComponent();
this.ventanaPadre = ventanaPadre; this.ventanaPadre = ventanaPadre;
this.ventas = ventas; this.ventasYDetalles = ventasYDetalles;
cantidadVentas = ventasYDetalles.Count;
lbContador.Text = $"0 - {cantidadVentas}";
cotaSuperior = cantidadVentas > 20 ? 20 : cantidadVentas;
llenarPanel(); llenarPanel();
} }
private void llenarPanel() private void llenarPanel()
{ {
foreach(VentaModel venta in ventas) panelVentas.Controls.Clear();
for(int i = cotaInferior; i < cotaSuperior; i++)
{ {
Dictionary<string, dynamic> ventaYDetalles = ventasYDetalles[i];
VentaModel venta = ventaYDetalles["venta"];
TableLayoutPanel carta = new TableLayoutPanel(); TableLayoutPanel carta = new TableLayoutPanel();
carta.ColumnCount = 1; carta.ColumnCount = 1;
carta.RowCount = 2; carta.RowCount = 2;
carta.RowStyles.Add(new RowStyle(SizeType.Percent, 75F)); carta.RowStyles.Add(new RowStyle(SizeType.Percent, 70F));
carta.RowStyles.Add(new RowStyle(SizeType.Percent, 25F)); carta.RowStyles.Add(new RowStyle(SizeType.Percent, 30F));
carta.Width = 700; carta.Width = 385;
carta.Height = 170; carta.Height = 150;
carta.BackColor = Color.FromArgb(200, 200, 200);
FlowLayoutPanel infoPanel = new FlowLayoutPanel(); FlowLayoutPanel infoPanel = new FlowLayoutPanel();
infoPanel.FlowDirection = FlowDirection.TopDown; infoPanel.FlowDirection = FlowDirection.TopDown;
@@ -42,27 +54,25 @@ namespace compabetov2
Label lbFecha = new Label(); Label lbFecha = new Label();
lbFecha.Text = $"Fecha: {venta.fecha}"; lbFecha.Text = $"Fecha: {venta.fecha}";
lbFecha.Font = new Font(lbFecha.Font.FontFamily, 12); lbFecha.Font = new Font(lbFecha.Font.FontFamily, 16);
lbFecha.Width = 700; lbFecha.Width = 700;
Label lbResponzable = new Label(); Label lbResponzable = new Label();
lbResponzable.Text = $"Responzable: {venta.responzable}"; lbResponzable.Text = $"Responsable: {venta.responzable}";
lbResponzable.Font = new Font(lbResponzable.Font.FontFamily, 12); lbResponzable.Font = new Font(lbResponzable.Font.FontFamily, 16);
lbResponzable.Width = 700; lbResponzable.Width = 700;
Label lbTotal = new Label(); Label lbTotal = new Label();
lbTotal.Text = $"Total: {venta.total}"; lbTotal.Text = $"Total: {venta.total}";
lbTotal.Font = new Font(lbTotal.Font.FontFamily, 12); lbTotal.Font = new Font(lbTotal.Font.FontFamily, 16);
lbTotal.Width = 700; lbTotal.Width = 700;
TableLayoutPanel botonesPanel = new TableLayoutPanel(); TableLayoutPanel botonesPanel = new TableLayoutPanel();
botonesPanel.RowCount = 1; botonesPanel.RowCount = 1;
botonesPanel.ColumnCount = 4; botonesPanel.ColumnCount = 2;
botonesPanel.Dock = DockStyle.Fill; botonesPanel.Dock = DockStyle.Fill;
botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F));
botonesPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); botonesPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
Button btnDetalles = new Button(); Button btnDetalles = new Button();
@@ -74,6 +84,26 @@ namespace compabetov2
btnDetalles.Font = new Font(btnDetalles.Font.FontFamily, 16); btnDetalles.Font = new Font(btnDetalles.Font.FontFamily, 16);
btnDetalles.ForeColor = Color.White; btnDetalles.ForeColor = Color.White;
btnDetalles.Click += new EventHandler(delegate (object sender, EventArgs e) btnDetalles.Click += new EventHandler(delegate (object sender, EventArgs e)
{
List<DetalleVentaModel> detalles = ventaYDetalles["detalles"];
string mensaje = "";
foreach (DetalleVentaModel detalle in detalles)
{
mensaje += $"{detalle.producto.nombre} - {detalle.cantidad}\n";
}
mensaje += $"Total: {venta.total}";
MessageBox.Show(mensaje);
});
Button btnImprimir = new Button();
btnImprimir.Text = "Ticket";
btnImprimir.Dock = DockStyle.Fill;
btnImprimir.FlatStyle = FlatStyle.Flat;
btnImprimir.FlatAppearance.BorderSize = 0;
btnImprimir.BackColor = Color.Yellow;
btnImprimir.Font = new Font(btnImprimir.Font.FontFamily, 16);
btnImprimir.ForeColor = Color.Black;
btnImprimir.Click += new EventHandler(delegate (object sender, EventArgs e)
{ {
}); });
@@ -82,20 +112,49 @@ namespace compabetov2
infoPanel.Controls.Add(lbResponzable); infoPanel.Controls.Add(lbResponzable);
botonesPanel.Controls.Add(btnDetalles, 0, 0); botonesPanel.Controls.Add(btnDetalles, 0, 0);
botonesPanel.Controls.Add(btnImprimir, 1, 0);
carta.Controls.Add(infoPanel, 0, 0); carta.Controls.Add(infoPanel, 0, 0);
carta.Controls.Add(botonesPanel, 0, 1); carta.Controls.Add(botonesPanel, 0, 1);
panelVentas.Controls.Add(carta); panelVentas.Controls.Add(carta);
} }
foreach (Dictionary<string,dynamic> ventaYDetalles in ventasYDetalles)
{
VentaModel venta = ventaYDetalles["venta"];
}
} }
private void btnMenos_Click(object sender, EventArgs e) private void btnMenos_Click(object sender, EventArgs e)
{ {
cotaInferior -= 20;
cotaInferior = cotaInferior > 0 ? cotaInferior : 0;
cotaSuperior -= 20;
cotaSuperior = cotaInferior == 0 ? 20 : cotaSuperior;
llenarPanel();
lbContador.Text = $"{cotaInferior} - {cantidadVentas}";
} }
private void btnMas_Click(object sender, EventArgs e) private void btnMas_Click(object sender, EventArgs e)
{
cotaSuperior += 20;
cotaSuperior = cotaSuperior > cantidadVentas ? cantidadVentas : cotaSuperior;
cotaInferior += 20;
cotaInferior = cotaSuperior == cantidadVentas ? cotaSuperior - 20 : cotaInferior;
llenarPanel();
lbContador.Text = $"{cotaInferior} - {cantidadVentas}";
}
private void RegistroVentas_Load(object sender, EventArgs e)
{ {
} }
+66 -63
View File
@@ -70,9 +70,10 @@
this.lblfecha.AutoSize = true; this.lblfecha.AutoSize = true;
this.lblfecha.Font = new System.Drawing.Font("Microsoft Sans Serif", 30F); this.lblfecha.Font = new System.Drawing.Font("Microsoft Sans Serif", 30F);
this.lblfecha.ForeColor = System.Drawing.Color.Navy; 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.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.TabIndex = 13;
this.lblfecha.Text = "label2"; this.lblfecha.Text = "label2";
this.lblfecha.TextAlign = System.Drawing.ContentAlignment.TopCenter; this.lblfecha.TextAlign = System.Drawing.ContentAlignment.TopCenter;
@@ -83,9 +84,10 @@
this.lblhora.AutoSize = true; this.lblhora.AutoSize = true;
this.lblhora.Font = new System.Drawing.Font("Microsoft Sans Serif", 60F); this.lblhora.Font = new System.Drawing.Font("Microsoft Sans Serif", 60F);
this.lblhora.ForeColor = System.Drawing.Color.MediumBlue; 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.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.TabIndex = 12;
this.lblhora.Text = "label1"; this.lblhora.Text = "label1";
this.lblhora.Click += new System.EventHandler(this.lblhora_Click); this.lblhora.Click += new System.EventHandler(this.lblhora_Click);
@@ -96,10 +98,10 @@
this.flowLayoutPanel2.Controls.Add(this.panel1); this.flowLayoutPanel2.Controls.Add(this.panel1);
this.flowLayoutPanel2.Controls.Add(this.label1); this.flowLayoutPanel2.Controls.Add(this.label1);
this.flowLayoutPanel2.Controls.Add(this.labeltotal); this.flowLayoutPanel2.Controls.Add(this.labeltotal);
this.flowLayoutPanel2.Location = new System.Drawing.Point(1605, -1); this.flowLayoutPanel2.Location = new System.Drawing.Point(1204, -1);
this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.flowLayoutPanel2.Name = "flowLayoutPanel2"; 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.TabIndex = 11;
this.flowLayoutPanel2.Paint += new System.Windows.Forms.PaintEventHandler(this.flowLayoutPanel2_Paint); this.flowLayoutPanel2.Paint += new System.Windows.Forms.PaintEventHandler(this.flowLayoutPanel2_Paint);
// //
@@ -107,17 +109,17 @@
// //
this.panel1.BackColor = System.Drawing.Color.Transparent; this.panel1.BackColor = System.Drawing.Color.Transparent;
this.panel1.Controls.Add(this.pictureBox9); this.panel1.Controls.Add(this.pictureBox9);
this.panel1.Location = new System.Drawing.Point(3, 2); this.panel1.Location = new System.Drawing.Point(2, 2);
this.panel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.panel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.panel1.Name = "panel1"; 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; this.panel1.TabIndex = 8;
// //
// pictureBox9 // pictureBox9
// //
this.pictureBox9.Image = global::compabetov2.Properties.Resources.HomeroMenu; this.pictureBox9.Image = global::compabetov2.Properties.Resources.HomeroMenu;
this.pictureBox9.Location = new System.Drawing.Point(64, 34); this.pictureBox9.Location = new System.Drawing.Point(48, 28);
this.pictureBox9.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pictureBox9.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.pictureBox9.Name = "pictureBox9"; this.pictureBox9.Name = "pictureBox9";
this.pictureBox9.Size = new System.Drawing.Size(190, 197); this.pictureBox9.Size = new System.Drawing.Size(190, 197);
this.pictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.pictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@@ -130,9 +132,10 @@
this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F); this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.label1.ForeColor = System.Drawing.Color.AliceBlue; 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.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.TabIndex = 17;
this.label1.Text = "Total:"; this.label1.Text = "Total:";
this.label1.Click += new System.EventHandler(this.label1_Click); this.label1.Click += new System.EventHandler(this.label1_Click);
@@ -143,9 +146,10 @@
this.labeltotal.BackColor = System.Drawing.Color.Transparent; this.labeltotal.BackColor = System.Drawing.Color.Transparent;
this.labeltotal.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F); this.labeltotal.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.labeltotal.ForeColor = System.Drawing.Color.AliceBlue; 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.Name = "labeltotal";
this.labeltotal.Size = new System.Drawing.Size(0, 39); this.labeltotal.Size = new System.Drawing.Size(0, 31);
this.labeltotal.TabIndex = 18; this.labeltotal.TabIndex = 18;
// //
// flowLayoutPanel1 // flowLayoutPanel1
@@ -157,26 +161,26 @@
this.flowLayoutPanel1.Controls.Add(this.button3); this.flowLayoutPanel1.Controls.Add(this.button3);
this.flowLayoutPanel1.Controls.Add(this.button5); this.flowLayoutPanel1.Controls.Add(this.button5);
this.flowLayoutPanel1.Location = new System.Drawing.Point(-1, 2); 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.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(324, 1199); this.flowLayoutPanel1.Size = new System.Drawing.Size(243, 974);
this.flowLayoutPanel1.TabIndex = 8; this.flowLayoutPanel1.TabIndex = 8;
// //
// panel2 // panel2
// //
this.panel2.BackColor = System.Drawing.Color.Transparent; this.panel2.BackColor = System.Drawing.Color.Transparent;
this.panel2.Controls.Add(this.pictureBox7); this.panel2.Controls.Add(this.pictureBox7);
this.panel2.Location = new System.Drawing.Point(3, 2); this.panel2.Location = new System.Drawing.Point(2, 2);
this.panel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.panel2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.panel2.Name = "panel2"; 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; this.panel2.TabIndex = 8;
// //
// pictureBox7 // pictureBox7
// //
this.pictureBox7.Image = global::compabetov2.Properties.Resources.HomeroMenu; this.pictureBox7.Image = global::compabetov2.Properties.Resources.HomeroMenu;
this.pictureBox7.Location = new System.Drawing.Point(64, 34); this.pictureBox7.Location = new System.Drawing.Point(48, 28);
this.pictureBox7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pictureBox7.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.pictureBox7.Name = "pictureBox7"; this.pictureBox7.Name = "pictureBox7";
this.pictureBox7.Size = new System.Drawing.Size(190, 197); this.pictureBox7.Size = new System.Drawing.Size(190, 197);
this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@@ -192,11 +196,11 @@
this.button1.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.button1.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button1.Image = global::compabetov2.Properties.Resources.Menui1; this.button1.Image = global::compabetov2.Properties.Resources.Menui1;
this.button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button1.Location = new System.Drawing.Point(3, 269); this.button1.Location = new System.Drawing.Point(2, 220);
this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0); this.button1.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
this.button1.Size = new System.Drawing.Size(312, 114); this.button1.Size = new System.Drawing.Size(234, 93);
this.button1.TabIndex = 8; this.button1.TabIndex = 8;
this.button1.Text = "Menú"; this.button1.Text = "Menú";
this.button1.UseVisualStyleBackColor = false; this.button1.UseVisualStyleBackColor = false;
@@ -211,11 +215,11 @@
this.button2.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.button2.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button2.Image = global::compabetov2.Properties.Resources.estadisticasi; this.button2.Image = global::compabetov2.Properties.Resources.estadisticasi;
this.button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button2.Location = new System.Drawing.Point(3, 387); this.button2.Location = new System.Drawing.Point(2, 317);
this.button2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0); this.button2.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
this.button2.Size = new System.Drawing.Size(312, 114); this.button2.Size = new System.Drawing.Size(234, 93);
this.button2.TabIndex = 9; this.button2.TabIndex = 9;
this.button2.Text = "Reportes"; this.button2.Text = "Reportes";
this.button2.UseVisualStyleBackColor = false; this.button2.UseVisualStyleBackColor = false;
@@ -230,11 +234,11 @@
this.button3.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.button3.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button3.Image = global::compabetov2.Properties.Resources.productoi; this.button3.Image = global::compabetov2.Properties.Resources.productoi;
this.button3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button3.Location = new System.Drawing.Point(3, 505); this.button3.Location = new System.Drawing.Point(2, 414);
this.button3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button3.Name = "button3"; this.button3.Name = "button3";
this.button3.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0); this.button3.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
this.button3.Size = new System.Drawing.Size(312, 114); this.button3.Size = new System.Drawing.Size(234, 93);
this.button3.TabIndex = 10; this.button3.TabIndex = 10;
this.button3.Text = "Productos"; this.button3.Text = "Productos";
this.button3.UseVisualStyleBackColor = false; this.button3.UseVisualStyleBackColor = false;
@@ -248,11 +252,11 @@
this.button5.ForeColor = System.Drawing.SystemColors.ButtonHighlight; this.button5.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.button5.Image = global::compabetov2.Properties.Resources.sesionc; this.button5.Image = global::compabetov2.Properties.Resources.sesionc;
this.button5.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button5.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button5.Location = new System.Drawing.Point(3, 623); this.button5.Location = new System.Drawing.Point(2, 511);
this.button5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button5.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.button5.Name = "button5"; this.button5.Name = "button5";
this.button5.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0); this.button5.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
this.button5.Size = new System.Drawing.Size(312, 114); this.button5.Size = new System.Drawing.Size(234, 93);
this.button5.TabIndex = 12; this.button5.TabIndex = 12;
this.button5.Text = "Salir"; this.button5.Text = "Salir";
this.button5.UseVisualStyleBackColor = false; this.button5.UseVisualStyleBackColor = false;
@@ -260,20 +264,20 @@
// flowLayoutPanel3 // flowLayoutPanel3
// //
this.flowLayoutPanel3.AutoScroll = true; this.flowLayoutPanel3.AutoScroll = true;
this.flowLayoutPanel3.Location = new System.Drawing.Point(329, 343); this.flowLayoutPanel3.Location = new System.Drawing.Point(247, 279);
this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.flowLayoutPanel3.Name = "flowLayoutPanel3"; this.flowLayoutPanel3.Name = "flowLayoutPanel3";
this.flowLayoutPanel3.Size = new System.Drawing.Size(1273, 730); this.flowLayoutPanel3.Size = new System.Drawing.Size(955, 593);
this.flowLayoutPanel3.TabIndex = 14; this.flowLayoutPanel3.TabIndex = 14;
this.flowLayoutPanel3.Paint += new System.Windows.Forms.PaintEventHandler(this.flowLayoutPanel3_Paint); this.flowLayoutPanel3.Paint += new System.Windows.Forms.PaintEventHandler(this.flowLayoutPanel3_Paint);
// //
// txtbusqueda // txtbusqueda
// //
this.txtbusqueda.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); 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(329, 219); this.txtbusqueda.Location = new System.Drawing.Point(247, 178);
this.txtbusqueda.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txtbusqueda.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.txtbusqueda.Name = "txtbusqueda"; this.txtbusqueda.Name = "txtbusqueda";
this.txtbusqueda.Size = new System.Drawing.Size(703, 36); this.txtbusqueda.Size = new System.Drawing.Size(528, 30);
this.txtbusqueda.TabIndex = 15; this.txtbusqueda.TabIndex = 15;
this.txtbusqueda.TextChanged += new System.EventHandler(this.txtbusqueda_TextChanged); this.txtbusqueda.TextChanged += new System.EventHandler(this.txtbusqueda_TextChanged);
// //
@@ -283,10 +287,10 @@
this.bntImprimir.Enabled = false; this.bntImprimir.Enabled = false;
this.bntImprimir.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.bntImprimir.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
this.bntImprimir.ForeColor = System.Drawing.Color.Transparent; this.bntImprimir.ForeColor = System.Drawing.Color.Transparent;
this.bntImprimir.Location = new System.Drawing.Point(1055, 210); this.bntImprimir.Location = new System.Drawing.Point(791, 171);
this.bntImprimir.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.bntImprimir.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.bntImprimir.Name = "bntImprimir"; 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.TabIndex = 17;
this.bntImprimir.Text = "Vender"; this.bntImprimir.Text = "Vender";
this.bntImprimir.UseVisualStyleBackColor = false; this.bntImprimir.UseVisualStyleBackColor = false;
@@ -296,10 +300,10 @@
// //
this.responsablecb.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.responsablecb.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
this.responsablecb.FormattingEnabled = true; this.responsablecb.FormattingEnabled = true;
this.responsablecb.Location = new System.Drawing.Point(1371, 218); this.responsablecb.Location = new System.Drawing.Point(1028, 177);
this.responsablecb.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.responsablecb.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.responsablecb.Name = "responsablecb"; this.responsablecb.Name = "responsablecb";
this.responsablecb.Size = new System.Drawing.Size(227, 37); this.responsablecb.Size = new System.Drawing.Size(171, 33);
this.responsablecb.TabIndex = 18; this.responsablecb.TabIndex = 18;
this.responsablecb.SelectedIndexChanged += new System.EventHandler(this.responsablecb_SelectedIndexChanged); this.responsablecb.SelectedIndexChanged += new System.EventHandler(this.responsablecb_SelectedIndexChanged);
// //
@@ -309,10 +313,9 @@
this.btnFiar.Enabled = false; this.btnFiar.Enabled = false;
this.btnFiar.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.btnFiar.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
this.btnFiar.ForeColor = System.Drawing.Color.Transparent; this.btnFiar.ForeColor = System.Drawing.Color.Transparent;
this.btnFiar.Location = new System.Drawing.Point(1213, 210); this.btnFiar.Location = new System.Drawing.Point(910, 171);
this.btnFiar.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.btnFiar.Name = "btnFiar"; 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.TabIndex = 19;
this.btnFiar.Text = "Cuenta"; this.btnFiar.Text = "Cuenta";
this.btnFiar.UseVisualStyleBackColor = false; this.btnFiar.UseVisualStyleBackColor = false;
@@ -324,10 +327,10 @@
this.btnEnviar.Enabled = false; this.btnEnviar.Enabled = false;
this.btnEnviar.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.btnEnviar.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
this.btnEnviar.ForeColor = System.Drawing.Color.Transparent; this.btnEnviar.ForeColor = System.Drawing.Color.Transparent;
this.btnEnviar.Location = new System.Drawing.Point(1213, 273); this.btnEnviar.Location = new System.Drawing.Point(910, 222);
this.btnEnviar.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnEnviar.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnEnviar.Name = "btnEnviar"; this.btnEnviar.Name = "btnEnviar";
this.btnEnviar.Size = new System.Drawing.Size(151, 54); this.btnEnviar.Size = new System.Drawing.Size(113, 44);
this.btnEnviar.TabIndex = 20; this.btnEnviar.TabIndex = 20;
this.btnEnviar.Text = "Enviar"; this.btnEnviar.Text = "Enviar";
this.btnEnviar.UseVisualStyleBackColor = false; this.btnEnviar.UseVisualStyleBackColor = false;
@@ -338,10 +341,10 @@
this.btnImporte.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(104)))), ((int)(((byte)(255))))); this.btnImporte.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(104)))), ((int)(((byte)(255)))));
this.btnImporte.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.btnImporte.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
this.btnImporte.ForeColor = System.Drawing.Color.Transparent; this.btnImporte.ForeColor = System.Drawing.Color.Transparent;
this.btnImporte.Location = new System.Drawing.Point(1056, 273); this.btnImporte.Location = new System.Drawing.Point(792, 222);
this.btnImporte.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnImporte.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnImporte.Name = "btnImporte"; this.btnImporte.Name = "btnImporte";
this.btnImporte.Size = new System.Drawing.Size(151, 54); this.btnImporte.Size = new System.Drawing.Size(113, 44);
this.btnImporte.TabIndex = 21; this.btnImporte.TabIndex = 21;
this.btnImporte.Text = "Importe"; this.btnImporte.Text = "Importe";
this.btnImporte.UseVisualStyleBackColor = false; this.btnImporte.UseVisualStyleBackColor = false;
@@ -349,9 +352,9 @@
// //
// vender // 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.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1767, 772); this.ClientSize = new System.Drawing.Size(1166, 627);
this.ControlBox = false; this.ControlBox = false;
this.Controls.Add(this.btnImporte); this.Controls.Add(this.btnImporte);
this.Controls.Add(this.btnEnviar); this.Controls.Add(this.btnEnviar);
@@ -364,7 +367,7 @@
this.Controls.Add(this.lblhora); this.Controls.Add(this.lblhora);
this.Controls.Add(this.flowLayoutPanel2); this.Controls.Add(this.flowLayoutPanel2);
this.Controls.Add(this.flowLayoutPanel1); 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 = "vender"; this.Name = "vender";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.vender_Load); this.Load += new System.EventHandler(this.vender_Load);
+2 -1
View File
@@ -558,7 +558,8 @@ namespace compabetov2
DialogResult resultado = MessageBox.Show("¿Quieres hacer la devolucion del importe?", "Confirmación devolucion de importe", MessageBoxButtons.YesNo, MessageBoxIcon.Question); DialogResult resultado = MessageBox.Show("¿Quieres hacer la devolucion del importe?", "Confirmación devolucion de importe", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (resultado == DialogResult.Yes) if (resultado == DialogResult.Yes)
{ {
if (service.devolverImporte(importes)) VentaModel venta = new VentaModel(total,-1,DateTime.Now.ToString(),responsablecb.Text);
if (service.devolverImporte(venta, importes))
{ {
MessageBox.Show("Importe devuelto"); MessageBox.Show("Importe devuelto");
llenarLayout(); llenarLayout();
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+51 -3
View File
@@ -872,8 +872,9 @@ namespace compabetov2.database
} }
} }
public static bool devolverImporteDAO(List<DetalleImporte> importes) public static bool devolverImporteDAO(VentaModel venta, List<DetalleImporte> importes)
{ {
var db_conexion = new Conexion(); var db_conexion = new Conexion();
try try
{ {
@@ -885,7 +886,28 @@ namespace compabetov2.database
{ {
try try
{ {
string sqlImporte = "INSERT INTO detalle_importe (fk_importe,cantidad,precio,fecha) VALUES (@fk_importe,@cantidad,@precio,@fecha)"; string sqlVenta = "INSERT INTO venta (fecha, total,responzable) VALUES(@fecha, @total,@responzable);";
string sqlIdVenta = "SELECT idVenta FROM venta ORDER BY idVenta DESC LIMIT 1";
string sqlImporte = "INSERT INTO detalle_importe (fk_importe,cantidad,precio,fk_venta) VALUES (@fk_importe,@cantidad,@precio,@fk_venta)";
// CREACION DE LA VENTA
SQLiteCommand commandVenta = new SQLiteCommand(sqlVenta, conexion);
commandVenta.Parameters.AddWithValue("@fecha", DateTime.Now.ToString());
commandVenta.Parameters.AddWithValue("@total", venta.total);
commandVenta.Parameters.AddWithValue("@responzable", venta.responzable);
commandVenta.ExecuteNonQuery();
//CONSEGUIR EL ID DE LA VENTA PARA RELACIONARLO CON DETALLE VENTA
SQLiteCommand commandConsulta = new SQLiteCommand(sqlIdVenta, conexion);
SQLiteDataReader reader = commandConsulta.ExecuteReader();
long idVenta = -1;
while (reader.Read())
{
idVenta = reader.GetInt64(0);
}
//creacion del importe //creacion del importe
foreach (DetalleImporte importe in importes) foreach (DetalleImporte importe in importes)
{ {
@@ -895,7 +917,7 @@ namespace compabetov2.database
commandDetalleImporte.Parameters.AddWithValue("@fk_importe", importe.fkImporte); commandDetalleImporte.Parameters.AddWithValue("@fk_importe", importe.fkImporte);
commandDetalleImporte.Parameters.AddWithValue("@cantidad", importe.cantidad); commandDetalleImporte.Parameters.AddWithValue("@cantidad", importe.cantidad);
commandDetalleImporte.Parameters.AddWithValue("@precio", importe.precioImporte); commandDetalleImporte.Parameters.AddWithValue("@precio", importe.precioImporte);
commandDetalleImporte.Parameters.AddWithValue("@fecha", DateTime.Now.ToString()); commandDetalleImporte.Parameters.AddWithValue("@fk_venta", idVenta);
commandDetalleImporte.ExecuteNonQuery(); commandDetalleImporte.ExecuteNonQuery();
} }
} }
@@ -1917,6 +1939,32 @@ namespace compabetov2.database
} }
} }
public static SQLiteDataReader conseguirImportesVentaDAO(VentaModel venta)
{
SQLiteDataReader reader = null;
var db_conexion = new Conexion();
try
{
SQLiteConnection conexion = db_conexion.get_connection();
conexion.Open();
string sql = "SELECT * FROM detalle_importe WHERE fk_venta = @fk_venta;";
SQLiteCommand command = new SQLiteCommand(sql, conexion);
command.Parameters.AddWithValue("@fk_venta", venta.id);
reader = command.ExecuteReader();
return reader;
}
catch (SQLiteException ex)
{
MessageBox.Show(ex.Message);
return reader;
}
}
private static void crearDB() private static void crearDB()
{ {
var db_conexion = new Conexion(); var db_conexion = new Conexion();
+54 -27
View File
@@ -209,9 +209,9 @@ namespace compabetov2.database
return DAO.crearVentaDAO(venta, detalleVentas,importes); return DAO.crearVentaDAO(venta, detalleVentas,importes);
} }
public static bool devolverImporte(List<DetalleImporte> importes) public static bool devolverImporte(VentaModel venta,List<DetalleImporte> importes)
{ {
return DAO.devolverImporteDAO(importes); return DAO.devolverImporteDAO(venta,importes);
} }
public static bool insertarMerma(Merma merma) public static bool insertarMerma(Merma merma)
@@ -427,49 +427,76 @@ namespace compabetov2.database
return DAO.concluirEnvioDAO(envio, detallesEnvio, importes); return DAO.concluirEnvioDAO(envio, detallesEnvio, importes);
} }
public static List<VentaModel> conseguirVentasMes(DateTime fecha) public static Dictionary<string, List<Dictionary<string, dynamic>>> estadisticas(DateTime fecha)
{ {
List<VentaModel> ventasMes = new List<VentaModel>(); Dictionary<string, List<Dictionary<string, dynamic>>> resumen = new Dictionary<string, List<Dictionary<string, dynamic>>>();
SQLiteDataReader readerVentas = DAO.conseguirVentasMesDAO(fecha); List<Dictionary<string, dynamic>> listMes = new List<Dictionary<string, dynamic>>();
List<Dictionary<string, dynamic>> listDia = new List<Dictionary<string, dynamic>>();
while (readerVentas.Read())
{
VentaModel venta = new VentaModel(
readerVentas.GetDecimal(2),//total
(int)readerVentas.GetInt64(0),//id
readerVentas.GetString(1),//fecha
readerVentas.GetString(3)//resposable
);
ventasMes.Add(venta);
}
return ventasMes;
}
public static List<VentaModel> conseguirVentasDia(DateTime fecha)
{
List<VentaModel> ventasDia = new List<VentaModel>();
SQLiteDataReader readerVentas = DAO.conseguirVentasMesDAO(fecha); SQLiteDataReader readerVentas = DAO.conseguirVentasMesDAO(fecha);
string formato = "dd/MM/yyyy"; string formato = "dd/MM/yyyy";
while (readerVentas.Read()) while (readerVentas.Read())
{ {
Dictionary<string, dynamic> dicVenta = new Dictionary<string, dynamic>();
VentaModel venta = new VentaModel( VentaModel venta = new VentaModel(
readerVentas.GetDecimal(2), readerVentas.GetDecimal(2),//total
(int)readerVentas.GetInt64(0), (int)readerVentas.GetInt64(0),//id
readerVentas.GetString(1), readerVentas.GetString(1),//fecha
readerVentas.GetString(3) readerVentas.GetString(3)//responzable
);
List<DetalleVentaModel> detallesVenta = new List<DetalleVentaModel>();
SQLiteDataReader readerDetalleVenta = DAO.conseguirDetalleVenta(venta);
while (readerDetalleVenta.Read())
{
decimal precioCompra = readerDetalleVenta.GetDecimal(3);
DetalleVentaModel detalleVenta = new DetalleVentaModel(
(int)readerDetalleVenta.GetInt64(2),// cantidad
new Variante((int)readerDetalleVenta.GetInt64(5),//id
readerDetalleVenta["nombre"].ToString(),//nombre
readerDetalleVenta.GetDecimal(4),//precioVenta
(int)readerDetalleVenta.GetInt64(8),//cantidad
"",//img
(int)readerDetalleVenta.GetInt64(10),//fkProducto
precioCompra)
); );
detallesVenta.Add(detalleVenta);
}
List<DetalleImporte> importes = new List<DetalleImporte>();
SQLiteDataReader readerImporte = DAO.conseguirImportesVentaDAO(venta);
while (readerImporte.Read())
{
DetalleImporte importe = new DetalleImporte(
(int)readerImporte.GetInt64(1),//fkImporte
(int)readerImporte.GetInt64(2),//cantidad
readerImporte.GetDecimal(3),//precio
(int)readerImporte.GetInt64(4)//fkVenta
);
importes.Add(importe);
}
string[] fecha_hora = venta.fecha.Split(' '); string[] fecha_hora = venta.fecha.Split(' ');
string fechaVentaStr = fecha_hora[0]; string fechaVentaStr = fecha_hora[0];
dicVenta.Add("venta", venta);
dicVenta.Add("detalles", detallesVenta as List<DetalleVentaModel>);
dicVenta.Add("importes", importes);
DateTime.TryParseExact(fechaVentaStr, formato, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime fechaVenta); DateTime.TryParseExact(fechaVentaStr, formato, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime fechaVenta);
if (fecha.Day == fechaVenta.Day) if (fecha.Day == fechaVenta.Day)
{ {
ventasDia.Add(venta); listDia.Add(dicVenta);
} }
listMes.Add(dicVenta);
} }
return ventasDia;
resumen.Add("mes", listMes);
resumen.Add("dia", listDia);
return resumen;
} }
public static List<Variante> conseguirProductosFiltrados(string nombreProducto) public static List<Variante> conseguirProductosFiltrados(string nombreProducto)
Binary file not shown.
Binary file not shown.
Binary file not shown.