Descargo Cambios de CARLOS010224
This commit is contained in:
Binary file not shown.
Generated
+238
-77
@@ -28,105 +28,254 @@
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.dtpBuscar = new System.Windows.Forms.DateTimePicker();
|
||||
this.dgvDia = new System.Windows.Forms.DataGridView();
|
||||
this.Producto = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Precio = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Cantidad = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.Total = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.btnBuscar = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.dgvMes = new System.Windows.Forms.DataGridView();
|
||||
this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.lbProductDia = new System.Windows.Forms.Label();
|
||||
this.lbVendedorDia = new System.Windows.Forms.Label();
|
||||
this.lbTotalDia = new System.Windows.Forms.Label();
|
||||
this.lbTotalMes = new System.Windows.Forms.Label();
|
||||
this.lbVendedorMes = new System.Windows.Forms.Label();
|
||||
this.lbProductoMes = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvDia)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvMes)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// dtpBuscar
|
||||
//
|
||||
this.dtpBuscar.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.dtpBuscar.Location = new System.Drawing.Point(16, 15);
|
||||
this.dtpBuscar.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.dtpBuscar.Name = "dtpBuscar";
|
||||
this.dtpBuscar.Size = new System.Drawing.Size(341, 26);
|
||||
this.dtpBuscar.TabIndex = 0;
|
||||
//
|
||||
// dgvDia
|
||||
//
|
||||
this.dgvDia.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvDia.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.Producto,
|
||||
this.Precio,
|
||||
this.Cantidad,
|
||||
this.Total});
|
||||
this.dgvDia.Location = new System.Drawing.Point(12, 69);
|
||||
this.dgvDia.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.dgvDia.Name = "dgvDia";
|
||||
this.dgvDia.RowHeadersWidth = 51;
|
||||
this.dgvDia.Size = new System.Drawing.Size(591, 185);
|
||||
this.dgvDia.TabIndex = 1;
|
||||
//
|
||||
// Producto
|
||||
//
|
||||
this.Producto.HeaderText = "Producto";
|
||||
this.Producto.MinimumWidth = 6;
|
||||
this.Producto.Name = "Producto";
|
||||
this.Producto.ReadOnly = true;
|
||||
this.Producto.Width = 125;
|
||||
//
|
||||
// Precio
|
||||
//
|
||||
this.Precio.HeaderText = "Precio";
|
||||
this.Precio.MinimumWidth = 6;
|
||||
this.Precio.Name = "Precio";
|
||||
this.Precio.ReadOnly = true;
|
||||
this.Precio.Width = 125;
|
||||
//
|
||||
// Cantidad
|
||||
//
|
||||
this.Cantidad.HeaderText = "Cantidad";
|
||||
this.Cantidad.MinimumWidth = 6;
|
||||
this.Cantidad.Name = "Cantidad";
|
||||
this.Cantidad.ReadOnly = true;
|
||||
this.Cantidad.Width = 125;
|
||||
//
|
||||
// Total
|
||||
//
|
||||
this.Total.HeaderText = "Total";
|
||||
this.Total.MinimumWidth = 6;
|
||||
this.Total.Name = "Total";
|
||||
this.Total.Width = 125;
|
||||
//
|
||||
// btnBuscar
|
||||
//
|
||||
this.btnBuscar.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.btnBuscar.Location = new System.Drawing.Point(399, 14);
|
||||
this.btnBuscar.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.btnBuscar.Name = "btnBuscar";
|
||||
this.btnBuscar.Size = new System.Drawing.Size(100, 28);
|
||||
this.btnBuscar.TabIndex = 2;
|
||||
this.btnBuscar.Text = "Buscar";
|
||||
this.btnBuscar.UseVisualStyleBackColor = true;
|
||||
this.btnBuscar.Click += new System.EventHandler(this.btnBuscar_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(329, 93);
|
||||
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label1.Location = new System.Drawing.Point(16, 46);
|
||||
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(178, 16);
|
||||
this.label1.TabIndex = 0;
|
||||
this.label1.Text = "Selector de fecha con el filtro";
|
||||
//
|
||||
// dateTimePicker1
|
||||
//
|
||||
this.dateTimePicker1.Location = new System.Drawing.Point(323, 122);
|
||||
this.dateTimePicker1.Name = "dateTimePicker1";
|
||||
this.dateTimePicker1.Size = new System.Drawing.Size(200, 22);
|
||||
this.dateTimePicker1.TabIndex = 1;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(547, 122);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(147, 23);
|
||||
this.button1.TabIndex = 2;
|
||||
this.button1.Text = "Buscar";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.label2);
|
||||
this.groupBox1.Location = new System.Drawing.Point(220, 175);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(728, 138);
|
||||
this.groupBox1.TabIndex = 3;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "groupBox1";
|
||||
this.label1.Size = new System.Drawing.Size(134, 20);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Resumen del dia";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(215, 64);
|
||||
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label2.Location = new System.Drawing.Point(20, 330);
|
||||
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(226, 16);
|
||||
this.label2.Size = new System.Drawing.Size(144, 20);
|
||||
this.label2.TabIndex = 4;
|
||||
this.label2.Text = "Aquí mostrar las ventas del dia fijado";
|
||||
this.label2.Text = "Resumen del mes";
|
||||
//
|
||||
// label3
|
||||
// dgvMes
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(1101, 129);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(178, 16);
|
||||
this.label3.TabIndex = 5;
|
||||
this.label3.Text = "Producto que mas se vendio";
|
||||
this.dgvMes.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvMes.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.dataGridViewTextBoxColumn1,
|
||||
this.dataGridViewTextBoxColumn2,
|
||||
this.dataGridViewTextBoxColumn3,
|
||||
this.dataGridViewTextBoxColumn4});
|
||||
this.dgvMes.Location = new System.Drawing.Point(16, 354);
|
||||
this.dgvMes.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.dgvMes.Name = "dgvMes";
|
||||
this.dgvMes.RowHeadersWidth = 51;
|
||||
this.dgvMes.Size = new System.Drawing.Size(591, 185);
|
||||
this.dgvMes.TabIndex = 5;
|
||||
//
|
||||
// label4
|
||||
// dataGridViewTextBoxColumn1
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(1101, 221);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(157, 16);
|
||||
this.label4.TabIndex = 6;
|
||||
this.label4.Text = "Persona que mas vendió";
|
||||
this.dataGridViewTextBoxColumn1.HeaderText = "Producto";
|
||||
this.dataGridViewTextBoxColumn1.MinimumWidth = 6;
|
||||
this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
|
||||
this.dataGridViewTextBoxColumn1.ReadOnly = true;
|
||||
this.dataGridViewTextBoxColumn1.Width = 125;
|
||||
//
|
||||
// label5
|
||||
// dataGridViewTextBoxColumn2
|
||||
//
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(1101, 318);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(164, 16);
|
||||
this.label5.TabIndex = 7;
|
||||
this.label5.Text = "Promedio de ventas al dia";
|
||||
this.label5.Click += new System.EventHandler(this.label5_Click);
|
||||
this.dataGridViewTextBoxColumn2.HeaderText = "Precio";
|
||||
this.dataGridViewTextBoxColumn2.MinimumWidth = 6;
|
||||
this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
|
||||
this.dataGridViewTextBoxColumn2.ReadOnly = true;
|
||||
this.dataGridViewTextBoxColumn2.Width = 125;
|
||||
//
|
||||
// dataGridViewTextBoxColumn3
|
||||
//
|
||||
this.dataGridViewTextBoxColumn3.HeaderText = "Cantidad";
|
||||
this.dataGridViewTextBoxColumn3.MinimumWidth = 6;
|
||||
this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
|
||||
this.dataGridViewTextBoxColumn3.ReadOnly = true;
|
||||
this.dataGridViewTextBoxColumn3.Width = 125;
|
||||
//
|
||||
// dataGridViewTextBoxColumn4
|
||||
//
|
||||
this.dataGridViewTextBoxColumn4.HeaderText = "Total";
|
||||
this.dataGridViewTextBoxColumn4.MinimumWidth = 6;
|
||||
this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
|
||||
this.dataGridViewTextBoxColumn4.Width = 125;
|
||||
//
|
||||
// lbProductDia
|
||||
//
|
||||
this.lbProductDia.AutoSize = true;
|
||||
this.lbProductDia.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lbProductDia.Location = new System.Drawing.Point(669, 110);
|
||||
this.lbProductDia.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lbProductDia.Name = "lbProductDia";
|
||||
this.lbProductDia.Size = new System.Drawing.Size(180, 20);
|
||||
this.lbProductDia.TabIndex = 6;
|
||||
this.lbProductDia.Text = "Producto mas vendido:";
|
||||
//
|
||||
// lbVendedorDia
|
||||
//
|
||||
this.lbVendedorDia.AutoSize = true;
|
||||
this.lbVendedorDia.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lbVendedorDia.Location = new System.Drawing.Point(669, 183);
|
||||
this.lbVendedorDia.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lbVendedorDia.Name = "lbVendedorDia";
|
||||
this.lbVendedorDia.Size = new System.Drawing.Size(132, 20);
|
||||
this.lbVendedorDia.TabIndex = 7;
|
||||
this.lbVendedorDia.Text = "Mejor vendedos:";
|
||||
//
|
||||
// lbTotalDia
|
||||
//
|
||||
this.lbTotalDia.AutoSize = true;
|
||||
this.lbTotalDia.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lbTotalDia.Location = new System.Drawing.Point(424, 262);
|
||||
this.lbTotalDia.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lbTotalDia.Name = "lbTotalDia";
|
||||
this.lbTotalDia.Size = new System.Drawing.Size(105, 20);
|
||||
this.lbTotalDia.TabIndex = 8;
|
||||
this.lbTotalDia.Text = "Total del dia:";
|
||||
//
|
||||
// lbTotalMes
|
||||
//
|
||||
this.lbTotalMes.AutoSize = true;
|
||||
this.lbTotalMes.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lbTotalMes.Location = new System.Drawing.Point(424, 543);
|
||||
this.lbTotalMes.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lbTotalMes.Name = "lbTotalMes";
|
||||
this.lbTotalMes.Size = new System.Drawing.Size(115, 20);
|
||||
this.lbTotalMes.TabIndex = 9;
|
||||
this.lbTotalMes.Text = "Total del Mes:";
|
||||
//
|
||||
// lbVendedorMes
|
||||
//
|
||||
this.lbVendedorMes.AutoSize = true;
|
||||
this.lbVendedorMes.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lbVendedorMes.Location = new System.Drawing.Point(669, 471);
|
||||
this.lbVendedorMes.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lbVendedorMes.Name = "lbVendedorMes";
|
||||
this.lbVendedorMes.Size = new System.Drawing.Size(132, 20);
|
||||
this.lbVendedorMes.TabIndex = 11;
|
||||
this.lbVendedorMes.Text = "Mejor vendedos:";
|
||||
//
|
||||
// lbProductoMes
|
||||
//
|
||||
this.lbProductoMes.AutoSize = true;
|
||||
this.lbProductoMes.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lbProductoMes.Location = new System.Drawing.Point(669, 399);
|
||||
this.lbProductoMes.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||
this.lbProductoMes.Name = "lbProductoMes";
|
||||
this.lbProductoMes.Size = new System.Drawing.Size(180, 20);
|
||||
this.lbProductoMes.TabIndex = 10;
|
||||
this.lbProductoMes.Text = "Producto mas vendido:";
|
||||
//
|
||||
// Estadiscticas
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1397, 730);
|
||||
this.Controls.Add(this.label5);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.groupBox1);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.dateTimePicker1);
|
||||
this.ClientSize = new System.Drawing.Size(1067, 593);
|
||||
this.Controls.Add(this.lbVendedorMes);
|
||||
this.Controls.Add(this.lbProductoMes);
|
||||
this.Controls.Add(this.lbTotalMes);
|
||||
this.Controls.Add(this.lbTotalDia);
|
||||
this.Controls.Add(this.lbVendedorDia);
|
||||
this.Controls.Add(this.lbProductDia);
|
||||
this.Controls.Add(this.dgvMes);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.btnBuscar);
|
||||
this.Controls.Add(this.dgvDia);
|
||||
this.Controls.Add(this.dtpBuscar);
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
|
||||
this.Name = "Estadiscticas";
|
||||
this.Text = "Estadiscticas";
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
this.groupBox1.PerformLayout();
|
||||
this.Load += new System.EventHandler(this.Estadiscticas_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvDia)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvMes)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
@@ -134,13 +283,25 @@
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.DateTimePicker dtpBuscar;
|
||||
private System.Windows.Forms.DataGridView dgvDia;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Producto;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Precio;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Cantidad;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Total;
|
||||
private System.Windows.Forms.Button btnBuscar;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.DateTimePicker dateTimePicker1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.DataGridView dgvMes;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
|
||||
private System.Windows.Forms.Label lbProductDia;
|
||||
private System.Windows.Forms.Label lbVendedorDia;
|
||||
private System.Windows.Forms.Label lbTotalDia;
|
||||
private System.Windows.Forms.Label lbTotalMes;
|
||||
private System.Windows.Forms.Label lbVendedorMes;
|
||||
private System.Windows.Forms.Label lbProductoMes;
|
||||
}
|
||||
}
|
||||
+289
-1
@@ -1,8 +1,11 @@
|
||||
using System;
|
||||
using compabetov2.database;
|
||||
using compabetov2.database.modelos;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -12,14 +15,299 @@ namespace compabetov2
|
||||
{
|
||||
public partial class Estadiscticas : Form
|
||||
{
|
||||
Dictionary<string, List<Dictionary<string, dynamic>>> resumen;
|
||||
public Estadiscticas()
|
||||
{
|
||||
InitializeComponent();
|
||||
darFormatoDTP();
|
||||
}
|
||||
|
||||
private void darFormatoDTP()
|
||||
{
|
||||
dtpBuscar.Format = DateTimePickerFormat.Custom;
|
||||
dtpBuscar.CustomFormat = "dd/MM/yyyy";
|
||||
}
|
||||
|
||||
private void btnBuscar_Click(object sender, EventArgs e)
|
||||
{
|
||||
string fechaBuscaStr = dtpBuscar.Text;
|
||||
|
||||
DateTime.TryParseExact(fechaBuscaStr, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime fechaBuscar);
|
||||
resumen = service.estadisticas(fechaBuscar);
|
||||
List<DetalleVentaModel> productosMes = estadisticasMes();
|
||||
List<DetalleVentaModel> productosDia = estadisticasDia();
|
||||
|
||||
Dictionary<string,dynamic> estadisticas = new Dictionary<string, dynamic>
|
||||
{
|
||||
{ "mes", new Dictionary<string, dynamic>{
|
||||
{ "productos", productosMes },
|
||||
{ "productoMasVendido", prodctoMasVendido(productosMes) },
|
||||
{ "mejorVendedor", mejorVenderdorMes() },
|
||||
}
|
||||
},
|
||||
{ "dia", new Dictionary<string, dynamic>{
|
||||
{ "productos", productosDia },
|
||||
{ "productoMasVendido", prodctoMasVendido(productosDia) },
|
||||
{ "mejorVendedor", mejorVenderdorDia() },
|
||||
}
|
||||
}
|
||||
};
|
||||
mostrarDatos(estadisticas);
|
||||
}
|
||||
|
||||
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>> mes = resumen["dia"];
|
||||
|
||||
List<DetalleVentaModel> detallesMes = new List<DetalleVentaModel>();
|
||||
foreach (Dictionary<string, dynamic> venta_y_detalles in mes)
|
||||
{
|
||||
foreach (DetalleVentaModel detallesVenta in venta_y_detalles["detalles"])
|
||||
{
|
||||
int totalElementos = detallesMes.Count;
|
||||
int contador = 0;
|
||||
for (int i = 0; i <= totalElementos; i++)
|
||||
{
|
||||
contador++;
|
||||
if (i == totalElementos)
|
||||
{
|
||||
DetalleVentaModel detalleAgregar = new DetalleVentaModel(detallesVenta.cantidad, detallesVenta.producto, detallesVenta.idVenta);
|
||||
detallesMes.Add(detalleAgregar);
|
||||
break;
|
||||
}
|
||||
|
||||
DetalleVentaModel producto = detallesMes[i];
|
||||
|
||||
if (producto.producto.nombre.Equals(detallesVenta.producto.nombre))
|
||||
{
|
||||
producto.cantidad += detallesVenta.cantidad;
|
||||
break;
|
||||
}
|
||||
|
||||
//si no existe el producto lo agrega
|
||||
|
||||
}
|
||||
|
||||
if (contador == 0)
|
||||
{
|
||||
detallesMes.Add(detallesVenta);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return detallesMes;
|
||||
}
|
||||
|
||||
private void mostrarDatos(Dictionary<string, dynamic> estadisticas)
|
||||
{
|
||||
dgvDia.Rows.Clear();
|
||||
dgvMes.Rows.Clear();
|
||||
List<DetalleVentaModel> detallesMes = estadisticas["mes"]["productos"];
|
||||
decimal totalVendidoMes = 0;
|
||||
foreach (DetalleVentaModel producto in detallesMes)
|
||||
{
|
||||
totalVendidoMes += producto.cantidad * producto.producto.precion;
|
||||
// Crear una nueva fila
|
||||
DataGridViewRow nuevaFila = new DataGridViewRow();
|
||||
|
||||
// Crear celdas para la nueva fila
|
||||
DataGridViewCell productoN = new DataGridViewTextBoxCell();
|
||||
DataGridViewCell precio = new DataGridViewTextBoxCell();
|
||||
DataGridViewCell cantidad = new DataGridViewTextBoxCell();
|
||||
DataGridViewCell total = new DataGridViewTextBoxCell();
|
||||
|
||||
// Establecer los valores de las celdas (puedes ajustar según tu necesidad)
|
||||
productoN.Value = $"{producto.producto.nombre}";
|
||||
precio.Value = $"{producto.producto.precion}";
|
||||
cantidad.Value = $"{producto.cantidad}";
|
||||
total.Value = $"{producto.cantidad * producto.producto.precion}";
|
||||
|
||||
// Agregar las celdas a la fila
|
||||
nuevaFila.Cells.Add(productoN);
|
||||
nuevaFila.Cells.Add(precio);
|
||||
nuevaFila.Cells.Add(cantidad);
|
||||
nuevaFila.Cells.Add(total);
|
||||
|
||||
// Agregar la nueva fila al DataGridView
|
||||
dgvMes.Rows.Add(nuevaFila);
|
||||
}
|
||||
|
||||
lbTotalMes.Text = $"Total de mes: ${totalVendidoMes}";
|
||||
lbProductoMes.Text = $"Producto mas vendido: {estadisticas["mes"]["productoMasVendido"]}";
|
||||
lbVendedorMes.Text = $"Mejor vendedor: {estadisticas["mes"]["mejorVendedor"]}";
|
||||
|
||||
//dia
|
||||
List<DetalleVentaModel> detallesDia = estadisticas["dia"]["productos"];
|
||||
decimal totalVendidoDia = 0;
|
||||
foreach (DetalleVentaModel producto in detallesDia)
|
||||
{
|
||||
totalVendidoDia += producto.cantidad * producto.producto.precion;
|
||||
// Crear una nueva fila
|
||||
DataGridViewRow nuevaFila = new DataGridViewRow();
|
||||
|
||||
// Crear celdas para la nueva fila
|
||||
DataGridViewCell productoN = new DataGridViewTextBoxCell();
|
||||
DataGridViewCell precio = new DataGridViewTextBoxCell();
|
||||
DataGridViewCell cantidad = new DataGridViewTextBoxCell();
|
||||
DataGridViewCell total = new DataGridViewTextBoxCell();
|
||||
|
||||
// Establecer los valores de las celdas (puedes ajustar según tu necesidad)
|
||||
productoN.Value = $"{producto.producto.nombre}";
|
||||
precio.Value = $"{producto.producto.precion}";
|
||||
cantidad.Value = $"{producto.cantidad}";
|
||||
total.Value = $"{producto.cantidad * producto.producto.precion}";
|
||||
|
||||
// Agregar las celdas a la fila
|
||||
nuevaFila.Cells.Add(productoN);
|
||||
nuevaFila.Cells.Add(precio);
|
||||
nuevaFila.Cells.Add(cantidad);
|
||||
nuevaFila.Cells.Add(total);
|
||||
|
||||
// Agregar la nueva fila al DataGridView
|
||||
dgvDia.Rows.Add(nuevaFila);
|
||||
}
|
||||
|
||||
lbTotalDia.Text = $"Total de dia: ${totalVendidoDia}";
|
||||
lbProductDia.Text = $"Producto mas vendido: {estadisticas["dia"]["productoMasVendido"]}";
|
||||
lbVendedorDia.Text = $"Mejor vendedor: {estadisticas["dia"]["mejorVendedor"]}";
|
||||
}
|
||||
|
||||
private List<DetalleVentaModel> estadisticasMes()
|
||||
{
|
||||
List<Dictionary<string, dynamic>> mes = resumen["mes"];
|
||||
|
||||
List <DetalleVentaModel> detallesMes = new List<DetalleVentaModel>();
|
||||
foreach (Dictionary<string, dynamic> venta_y_detalles in mes)
|
||||
{
|
||||
foreach (DetalleVentaModel detallesVenta in venta_y_detalles["detalles"])
|
||||
{
|
||||
int totalElementos = detallesMes.Count;
|
||||
int contador = 0;
|
||||
for(int i = 0; i <= totalElementos; i++) {
|
||||
contador++;
|
||||
if (i == totalElementos)
|
||||
{
|
||||
DetalleVentaModel detalleAgregar = new DetalleVentaModel(detallesVenta.cantidad, detallesVenta.producto, detallesVenta.idVenta);
|
||||
detallesMes.Add(detalleAgregar);
|
||||
break;
|
||||
}
|
||||
|
||||
DetalleVentaModel producto = detallesMes[i];
|
||||
|
||||
if (producto.producto.nombre.Equals(detallesVenta.producto.nombre))
|
||||
{
|
||||
producto.cantidad += detallesVenta.cantidad;
|
||||
break;
|
||||
}
|
||||
|
||||
//si no existe el producto lo agrega
|
||||
|
||||
}
|
||||
|
||||
if(contador == 0)
|
||||
{
|
||||
detallesMes.Add(detallesVenta);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return detallesMes;
|
||||
}
|
||||
|
||||
private string mejorVenderdorMes()
|
||||
{
|
||||
List<Dictionary<string, dynamic>> mes = resumen["mes"];
|
||||
string mejorVendedor = "";
|
||||
int contadorNumeroVentas = 0;
|
||||
|
||||
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))
|
||||
{
|
||||
empleados[venta.responzable] += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
empleados.Add(venta.responzable, 1);
|
||||
}
|
||||
}
|
||||
|
||||
foreach(string empleado in empleados.Keys)
|
||||
{
|
||||
if (empleados[empleado] > contadorNumeroVentas)
|
||||
{
|
||||
contadorNumeroVentas = empleados[empleado];
|
||||
mejorVendedor = empleado;
|
||||
}
|
||||
}
|
||||
|
||||
return mejorVendedor;
|
||||
}
|
||||
|
||||
|
||||
private string prodctoMasVendido(List<DetalleVentaModel> productos)
|
||||
{
|
||||
string productoMasVendido = "";
|
||||
int cantidadProducto = 0;
|
||||
|
||||
|
||||
foreach(DetalleVentaModel producto in productos)
|
||||
{
|
||||
if(producto.cantidad > cantidadProducto)
|
||||
{
|
||||
productoMasVendido = producto.producto.nombre;
|
||||
cantidadProducto = producto.cantidad;
|
||||
|
||||
}
|
||||
}
|
||||
return productoMasVendido;
|
||||
}
|
||||
|
||||
private string mejorVenderdorDia()
|
||||
{
|
||||
List<Dictionary<string, dynamic>> mes = resumen["dia"];
|
||||
string mejorVendedor = "";
|
||||
int contadorNumeroVentas = 0;
|
||||
|
||||
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))
|
||||
{
|
||||
empleados[venta.responzable] += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
empleados.Add(venta.responzable, 1);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string empleado in empleados.Keys)
|
||||
{
|
||||
if (empleados[empleado] > contadorNumeroVentas)
|
||||
{
|
||||
contadorNumeroVentas = empleados[empleado];
|
||||
mejorVendedor = empleado;
|
||||
}
|
||||
}
|
||||
|
||||
return mejorVendedor;
|
||||
}
|
||||
|
||||
private void label5_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Estadiscticas_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,4 +117,28 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<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="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="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="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>
|
||||
</root>
|
||||
Generated
+51
-50
@@ -72,9 +72,9 @@
|
||||
this.panel1.Controls.Add(this.pictureBox1);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
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.Size = new System.Drawing.Size(1924, 938);
|
||||
this.panel1.Size = new System.Drawing.Size(1294, 627);
|
||||
this.panel1.TabIndex = 4;
|
||||
this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
|
||||
//
|
||||
@@ -83,9 +83,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(776, 112);
|
||||
this.lblfecha.Location = new System.Drawing.Point(582, 91);
|
||||
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 = 9;
|
||||
this.lblfecha.Text = "label2";
|
||||
this.lblfecha.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
@@ -96,9 +97,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(953, -6);
|
||||
this.lblhora.Location = new System.Drawing.Point(715, -5);
|
||||
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 = 8;
|
||||
this.lblhora.Text = "label1";
|
||||
this.lblhora.Click += new System.EventHandler(this.lblhora_Click);
|
||||
@@ -112,26 +114,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, 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 = 7;
|
||||
//
|
||||
// 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;
|
||||
@@ -147,11 +149,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;
|
||||
@@ -166,11 +168,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.UseVisualStyleBackColor = false;
|
||||
@@ -185,11 +187,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;
|
||||
@@ -203,11 +205,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, 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;
|
||||
@@ -216,10 +218,10 @@
|
||||
// pictureBox4
|
||||
//
|
||||
this.pictureBox4.Image = global::compabetov2.Properties.Resources.inventario;
|
||||
this.pictureBox4.Location = new System.Drawing.Point(1451, 603);
|
||||
this.pictureBox4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.pictureBox4.Location = new System.Drawing.Point(1088, 490);
|
||||
this.pictureBox4.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.pictureBox4.Name = "pictureBox4";
|
||||
this.pictureBox4.Size = new System.Drawing.Size(293, 282);
|
||||
this.pictureBox4.Size = new System.Drawing.Size(220, 229);
|
||||
this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.pictureBox4.TabIndex = 6;
|
||||
this.pictureBox4.TabStop = false;
|
||||
@@ -228,10 +230,10 @@
|
||||
// pictureBox5
|
||||
//
|
||||
this.pictureBox5.Image = global::compabetov2.Properties.Resources.Cuentas;
|
||||
this.pictureBox5.Location = new System.Drawing.Point(584, 603);
|
||||
this.pictureBox5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.pictureBox5.Location = new System.Drawing.Point(438, 490);
|
||||
this.pictureBox5.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.pictureBox5.Name = "pictureBox5";
|
||||
this.pictureBox5.Size = new System.Drawing.Size(293, 282);
|
||||
this.pictureBox5.Size = new System.Drawing.Size(220, 229);
|
||||
this.pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.pictureBox5.TabIndex = 5;
|
||||
this.pictureBox5.TabStop = false;
|
||||
@@ -240,10 +242,10 @@
|
||||
// pictureBox6
|
||||
//
|
||||
this.pictureBox6.Image = global::compabetov2.Properties.Resources.mermas;
|
||||
this.pictureBox6.Location = new System.Drawing.Point(1013, 603);
|
||||
this.pictureBox6.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.pictureBox6.Location = new System.Drawing.Point(760, 490);
|
||||
this.pictureBox6.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.pictureBox6.Name = "pictureBox6";
|
||||
this.pictureBox6.Size = new System.Drawing.Size(293, 282);
|
||||
this.pictureBox6.Size = new System.Drawing.Size(220, 229);
|
||||
this.pictureBox6.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.pictureBox6.TabIndex = 4;
|
||||
this.pictureBox6.TabStop = false;
|
||||
@@ -252,10 +254,10 @@
|
||||
// pictureBox3
|
||||
//
|
||||
this.pictureBox3.Image = global::compabetov2.Properties.Resources.Envios;
|
||||
this.pictureBox3.Location = new System.Drawing.Point(1451, 209);
|
||||
this.pictureBox3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.pictureBox3.Location = new System.Drawing.Point(1088, 170);
|
||||
this.pictureBox3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.pictureBox3.Name = "pictureBox3";
|
||||
this.pictureBox3.Size = new System.Drawing.Size(293, 282);
|
||||
this.pictureBox3.Size = new System.Drawing.Size(220, 229);
|
||||
this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.pictureBox3.TabIndex = 3;
|
||||
this.pictureBox3.TabStop = false;
|
||||
@@ -264,10 +266,10 @@
|
||||
// pictureBox2
|
||||
//
|
||||
this.pictureBox2.Image = global::compabetov2.Properties.Resources.Vender;
|
||||
this.pictureBox2.Location = new System.Drawing.Point(584, 209);
|
||||
this.pictureBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.pictureBox2.Location = new System.Drawing.Point(438, 170);
|
||||
this.pictureBox2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.pictureBox2.Name = "pictureBox2";
|
||||
this.pictureBox2.Size = new System.Drawing.Size(293, 282);
|
||||
this.pictureBox2.Size = new System.Drawing.Size(220, 229);
|
||||
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.pictureBox2.TabIndex = 2;
|
||||
this.pictureBox2.TabStop = false;
|
||||
@@ -276,10 +278,10 @@
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.Image = global::compabetov2.Properties.Resources.Personal;
|
||||
this.pictureBox1.Location = new System.Drawing.Point(1013, 209);
|
||||
this.pictureBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.pictureBox1.Location = new System.Drawing.Point(760, 170);
|
||||
this.pictureBox1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(293, 282);
|
||||
this.pictureBox1.Size = new System.Drawing.Size(220, 229);
|
||||
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.pictureBox1.TabIndex = 1;
|
||||
this.pictureBox1.TabStop = false;
|
||||
@@ -292,13 +294,12 @@
|
||||
//
|
||||
// MenuPrincipal
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1924, 938);
|
||||
this.ClientSize = new System.Drawing.Size(1294, 627);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.panel1);
|
||||
this.IsMdiContainer = true;
|
||||
this.Margin = new System.Windows.Forms.Padding(4);
|
||||
this.Name = "MenuPrincipal";
|
||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
this.Load += new System.EventHandler(this.MenuPrincipal_Load);
|
||||
|
||||
@@ -171,7 +171,8 @@ namespace compabetov2
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
Estadiscticas estadiscticas = new Estadiscticas();
|
||||
estadiscticas.Show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Generated
+1
-1
@@ -332,7 +332,7 @@
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1885, 772);
|
||||
this.ClientSize = new System.Drawing.Size(1370, 627);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.btnEnviar);
|
||||
this.Controls.Add(this.btnFiar);
|
||||
|
||||
+20
-1
@@ -51,6 +51,7 @@ namespace compabetov2
|
||||
|
||||
private void llenarLayout()
|
||||
{
|
||||
flowLayoutPanel3.Controls.Clear();
|
||||
foreach (Producto producto in productos)
|
||||
{
|
||||
|
||||
@@ -422,11 +423,15 @@ namespace compabetov2
|
||||
List<DetalleVentaModel> detalleVentas = listaProductosVenta();
|
||||
if (detalleVentas.Count > 0)
|
||||
{
|
||||
VentaModel ventaModel = new VentaModel(total);
|
||||
VentaModel ventaModel = new VentaModel(total,-1,"",
|
||||
responsablecb.Text.Equals("") ? loginPrincipal.usuario : responsablecb.Text
|
||||
);
|
||||
|
||||
if (service.crearVentaDAO(ventaModel, detalleVentas))
|
||||
{
|
||||
MessageBox.Show("Venta hecha");
|
||||
eliminarProductosTocket();
|
||||
llenarLayout();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -612,6 +617,8 @@ namespace compabetov2
|
||||
if (service.crearCuenta(ventaModel, detallesCuenta))
|
||||
{
|
||||
MessageBox.Show("Fiado");
|
||||
eliminarProductosTocket();
|
||||
llenarLayout();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -723,6 +730,8 @@ namespace compabetov2
|
||||
if (service.crearEnvio(envio, detallesEnvio))
|
||||
{
|
||||
MessageBox.Show("Envio hecho");
|
||||
eliminarProductosTocket();
|
||||
llenarLayout();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -731,5 +740,15 @@ namespace compabetov2
|
||||
}
|
||||
|
||||
}
|
||||
private void eliminarProductosTocket()
|
||||
{
|
||||
for (int i = flowLayoutPanel2.Controls.Count -1; i > 2; i--)
|
||||
{
|
||||
Control c = flowLayoutPanel2.Controls[i];
|
||||
c.Dispose();
|
||||
flowLayoutPanel1.Controls.Remove(c);
|
||||
}
|
||||
label1.Text = "Total: 0";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+34
-7
@@ -777,7 +777,7 @@ namespace compabetov2.database
|
||||
{
|
||||
try
|
||||
{
|
||||
string sqlVenta = "INSERT INTO venta (fecha, total) VALUES(@fecha, @total);";
|
||||
string sqlVenta = "INSERT INTO venta (fecha, total,responzable) VALUES(@fecha, @total,@responzable);";
|
||||
string sqlDetalle = "INSERT INTO detalle_venta (fk_venta, fk_producto, cantidad) VALUES(@idVenta, @idProducto, @cantidada);";
|
||||
string sqlIdVenta = "SELECT idVenta FROM venta ORDER BY idVenta DESC LIMIT 1";
|
||||
string sqlProductoStock = "SELECT stock FROM Producto WHERE idproducto = @idproducto";
|
||||
@@ -787,6 +787,7 @@ namespace compabetov2.database
|
||||
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();
|
||||
|
||||
SQLiteCommand commandConsulta = new SQLiteCommand(sqlIdVenta, conexion);
|
||||
@@ -1137,7 +1138,7 @@ namespace compabetov2.database
|
||||
}
|
||||
|
||||
|
||||
public static SQLiteDataReader filtrarVentaFechaMesDAO(DateTime fecha)
|
||||
public static SQLiteDataReader conseguirVentasMesDAO(DateTime fecha)
|
||||
{
|
||||
SQLiteDataReader reader = null;
|
||||
var db_conexion = new Conexion();
|
||||
@@ -1147,9 +1148,9 @@ namespace compabetov2.database
|
||||
|
||||
conexion.Open();
|
||||
|
||||
string sql = "SELECT * FROM venta WHERE fecha LIKE '%@fecha%'";
|
||||
string sql = "SELECT * FROM venta WHERE fecha LIKE @fecha";
|
||||
SQLiteCommand command = new SQLiteCommand(sql, conexion);
|
||||
command.Parameters.AddWithValue("@fecha", $"{fecha.Month}/{fecha.Year}");
|
||||
command.Parameters.AddWithValue("@fecha", $"%{fecha.Month}/{fecha.Year}%");
|
||||
reader = command.ExecuteReader();
|
||||
|
||||
return reader;
|
||||
@@ -1162,7 +1163,32 @@ namespace compabetov2.database
|
||||
}
|
||||
}
|
||||
|
||||
public static Dictionary<string, dynamic> filtrarVentaFechaMes(DateTime fecha)
|
||||
public static SQLiteDataReader conseguirDetalleVenta(VentaModel venta)
|
||||
{
|
||||
SQLiteDataReader reader = null;
|
||||
var db_conexion = new Conexion();
|
||||
try
|
||||
{
|
||||
SQLiteConnection conexion = db_conexion.get_connection();
|
||||
|
||||
conexion.Open();
|
||||
|
||||
string sql = "select * from detalle_venta dv, Producto p WHERE dv.fk_producto = p.idproducto and dv.fk_venta = @idVenta";
|
||||
SQLiteCommand command = new SQLiteCommand(sql, conexion);
|
||||
command.Parameters.AddWithValue("@idVenta", venta.id);
|
||||
reader = command.ExecuteReader();
|
||||
|
||||
return reader;
|
||||
|
||||
}
|
||||
catch (SQLiteException ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
return reader;
|
||||
}
|
||||
}
|
||||
|
||||
/*public static SQLiteDataReader filtrarVentaFechaMes(DateTime fecha)
|
||||
{
|
||||
Dictionary<string, dynamic> estadisticas = new Dictionary<string, dynamic>();
|
||||
SQLiteDataReader reader = DAO.filtrarVentaFechaMesDAO(fecha);
|
||||
@@ -1191,7 +1217,7 @@ namespace compabetov2.database
|
||||
estadisticas.Add("ventasMes", totalMes);
|
||||
|
||||
return estadisticas;
|
||||
}
|
||||
}*/
|
||||
|
||||
public static bool crearEnvio(Envio envio, List<DetalleEnvioModel> detallesEnvio)
|
||||
{
|
||||
@@ -1405,7 +1431,7 @@ namespace compabetov2.database
|
||||
{
|
||||
try
|
||||
{
|
||||
string sqlVenta = "INSERT INTO venta (fecha, total) VALUES(@fecha, @total);";
|
||||
string sqlVenta = "INSERT INTO venta (fecha, total,responzable) VALUES(@fecha, @total,@responzable);";
|
||||
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";
|
||||
@@ -1414,6 +1440,7 @@ namespace compabetov2.database
|
||||
SQLiteCommand commandVenta = new SQLiteCommand(sqlVenta, conexion);
|
||||
commandVenta.Parameters.AddWithValue("@fecha", DateTime.Now.ToString());
|
||||
commandVenta.Parameters.AddWithValue("@total", envio.total);
|
||||
commandVenta.Parameters.AddWithValue("@responzable", envio.responsable);
|
||||
commandVenta.ExecuteNonQuery();
|
||||
|
||||
SQLiteCommand commandEnvio = new SQLiteCommand(sqlEnvio, conexion);
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace compabetov2.database.modelos
|
||||
{
|
||||
public class DetalleVentaModel
|
||||
{
|
||||
public int id;
|
||||
public int idVenta;
|
||||
public int cantidad;
|
||||
public Producto producto;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace compabetov2.database.modelos
|
||||
{
|
||||
this.cantidad = cantidad;
|
||||
this.producto = producto;
|
||||
this.id = id;
|
||||
this.idVenta = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,11 +11,13 @@ namespace compabetov2.database.modelos
|
||||
public int id;
|
||||
public string fecha;
|
||||
public decimal total;
|
||||
public string responzable;
|
||||
|
||||
public VentaModel(decimal total = 0, int id = -1, string fecha = "") {
|
||||
public VentaModel(decimal total = 0, int id = -1, string fecha = "", string responzable = "") {
|
||||
this.id = id;
|
||||
this.fecha = fecha;
|
||||
this.total = total;
|
||||
this.responzable = responzable;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+63
-2
@@ -283,7 +283,7 @@ namespace compabetov2.database
|
||||
return DAO.saldarCuentaDAO(cuenta, detallesCuentas);
|
||||
}
|
||||
|
||||
public static Dictionary<string, dynamic> filtrarVentaFechaMes(DateTime fecha)
|
||||
/*public static Dictionary<string, dynamic> filtrarVentaFechaMes(DateTime fecha)
|
||||
{
|
||||
Dictionary<string, dynamic> estadisticas = new Dictionary<string, dynamic>();
|
||||
SQLiteDataReader reader = DAO.filtrarVentaFechaMesDAO(fecha);
|
||||
@@ -312,7 +312,7 @@ namespace compabetov2.database
|
||||
MessageBox.Show($"{totalDia} -- {totalMes}");
|
||||
|
||||
return estadisticas;
|
||||
}
|
||||
}*/
|
||||
|
||||
public static bool crearEnvio(Envio envio, List<DetalleEnvioModel> detallesEnvio)
|
||||
{
|
||||
@@ -378,5 +378,66 @@ namespace compabetov2.database
|
||||
{
|
||||
return DAO.concluirEnvioDAO(envio, detallesEnvio);
|
||||
}
|
||||
|
||||
public static Dictionary<string, List<Dictionary<string,dynamic>>> estadisticas(DateTime fecha)
|
||||
{
|
||||
Dictionary<string, List<Dictionary<string, dynamic>>> resumen = new Dictionary<string, List<Dictionary<string, dynamic>>>();
|
||||
List<Dictionary<string, dynamic>> listMes = new List<Dictionary<string, dynamic>>();
|
||||
List<Dictionary<string, dynamic>> listDia = new List<Dictionary<string, dynamic>>();
|
||||
SQLiteDataReader readerVentas = DAO.conseguirVentasMesDAO(fecha);
|
||||
string formato = "dd/MM/yyyy";
|
||||
|
||||
while (readerVentas.Read())
|
||||
{
|
||||
Dictionary<string,dynamic> dicVenta = new Dictionary<string,dynamic>();
|
||||
|
||||
VentaModel venta = new VentaModel(
|
||||
readerVentas.GetDecimal(2),
|
||||
(int)readerVentas.GetInt64(0),
|
||||
readerVentas.GetString(1),
|
||||
readerVentas.GetString(3)
|
||||
);
|
||||
|
||||
List<DetalleVentaModel> detallesVenta = new List<DetalleVentaModel>();
|
||||
SQLiteDataReader readerDetalleVenta = DAO.conseguirDetalleVenta(venta);
|
||||
while (readerDetalleVenta.Read())
|
||||
{
|
||||
DetalleVentaModel detalleVenta = new DetalleVentaModel(
|
||||
(int)readerDetalleVenta.GetInt64(2),
|
||||
new Producto(
|
||||
(int)readerDetalleVenta.GetInt64(1),
|
||||
readerDetalleVenta["nombre"].ToString(),
|
||||
readerDetalleVenta["descripcion"].ToString(),
|
||||
readerDetalleVenta.GetDecimal(6),
|
||||
readerDetalleVenta["img"].ToString(),
|
||||
(int)readerDetalleVenta.GetInt64(8)
|
||||
),
|
||||
(int)readerDetalleVenta.GetInt64(0)
|
||||
) ;
|
||||
detallesVenta.Add( detalleVenta );
|
||||
}
|
||||
|
||||
dicVenta.Add("venta", venta);
|
||||
dicVenta.Add("detalles", detallesVenta as List<DetalleVentaModel>);
|
||||
|
||||
string[] fecha_hora = venta.fecha.Split(' ');
|
||||
string fechaVentaStr = fecha_hora[0];
|
||||
|
||||
DateTime.TryParseExact(fechaVentaStr, formato, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime fechaVenta);
|
||||
if (fecha.Day == fechaVenta.Day)
|
||||
{
|
||||
listDia.Add(dicVenta);
|
||||
}
|
||||
|
||||
listMes.Add(dicVenta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
resumen.Add("mes", listMes);
|
||||
resumen.Add("dia", listDia);
|
||||
|
||||
return resumen;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -126,3 +126,5 @@ C:\Users\carsu\Source\Repos\compabetoOG\obj\Debug\compabetov2.Empleados.AgregarE
|
||||
C:\Users\carsu\Source\Repos\compabetoOG\obj\Debug\compabetov2.AgregarLogin1.resources
|
||||
C:\Users\carsu\Source\Repos\compabetoOG\obj\Debug\compabetov2.Empleados.EditarEmpleado1.resources
|
||||
C:\Users\Googl\Documents\compabetoOG\obj\Debug\compabetov2.Estadiscticas.resources
|
||||
C:\Users\carsu\source\repos\compabetoOG\obj\Debug\compabetov2.Estadiscticas.resources
|
||||
>>>>>>> 50722c223445e6db2543329a4b1d825e6fc26343
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user