diff --git a/Estadiscticas.Designer.cs b/Estadiscticas.Designer.cs index c190fae..ed7fd3d 100644 --- a/Estadiscticas.Designer.cs +++ b/Estadiscticas.Designer.cs @@ -32,25 +32,35 @@ this.dgvDia = new System.Windows.Forms.DataGridView(); this.Producto = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Precio = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.precioCompra = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Cantidad = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.Total = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.totalNeto = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.btnBuscar = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.dgvMes = new System.Windows.Forms.DataGridView(); this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.PrecioCompraMes = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.totalNetoMes = 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.lbUtilidadDia = new System.Windows.Forms.Label(); + this.lbUtilidadMes = new System.Windows.Forms.Label(); this.lbVendedorMes = new System.Windows.Forms.Label(); this.lbProductoMes = new System.Windows.Forms.Label(); this.pictureBox2 = new System.Windows.Forms.PictureBox(); - this.lbDiaSEnvio = new System.Windows.Forms.Label(); - this.lbMesSEnvio = new System.Windows.Forms.Label(); + this.lbGananciasBrutasDia = new System.Windows.Forms.Label(); + this.lbGananciasBrutasMes = new System.Windows.Forms.Label(); + this.lbTotalImporteDia = new System.Windows.Forms.Label(); + this.btnVentasDia = 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.dgvMes)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); @@ -70,13 +80,16 @@ this.dgvDia.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.Producto, this.Precio, + this.precioCompra, this.Cantidad, - this.Total}); + this.Total, + this.totalNeto}); this.dgvDia.Location = new System.Drawing.Point(24, 199); this.dgvDia.Name = "dgvDia"; this.dgvDia.RowHeadersWidth = 51; - this.dgvDia.Size = new System.Drawing.Size(443, 150); + this.dgvDia.Size = new System.Drawing.Size(599, 150); this.dgvDia.TabIndex = 1; + this.dgvDia.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvDia_CellContentClick); // // Producto // @@ -84,7 +97,7 @@ this.Producto.MinimumWidth = 6; this.Producto.Name = "Producto"; this.Producto.ReadOnly = true; - this.Producto.Width = 125; + this.Producto.Width = 250; // // Precio // @@ -92,7 +105,13 @@ this.Precio.MinimumWidth = 6; this.Precio.Name = "Precio"; this.Precio.ReadOnly = true; - this.Precio.Width = 125; + this.Precio.Width = 50; + // + // precioCompra + // + this.precioCompra.HeaderText = "Precio Compra"; + this.precioCompra.Name = "precioCompra"; + this.precioCompra.Width = 50; // // Cantidad // @@ -100,14 +119,20 @@ this.Cantidad.MinimumWidth = 6; this.Cantidad.Name = "Cantidad"; this.Cantidad.ReadOnly = true; - this.Cantidad.Width = 125; + this.Cantidad.Width = 50; // // Total // this.Total.HeaderText = "Total"; this.Total.MinimumWidth = 6; this.Total.Name = "Total"; - this.Total.Width = 125; + this.Total.Width = 70; + // + // totalNeto + // + this.totalNeto.HeaderText = "Total Neto"; + this.totalNeto.Name = "totalNeto"; + this.totalNeto.Width = 70; // // btnBuscar // @@ -138,7 +163,7 @@ 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.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.Size = new System.Drawing.Size(121, 17); this.label2.TabIndex = 4; @@ -150,12 +175,14 @@ this.dgvMes.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.dataGridViewTextBoxColumn1, this.dataGridViewTextBoxColumn2, + this.PrecioCompraMes, this.dataGridViewTextBoxColumn3, - this.dataGridViewTextBoxColumn4}); - this.dgvMes.Location = new System.Drawing.Point(24, 406); + this.dataGridViewTextBoxColumn4, + this.totalNetoMes}); + this.dgvMes.Location = new System.Drawing.Point(30, 501); this.dgvMes.Name = "dgvMes"; this.dgvMes.RowHeadersWidth = 51; - this.dgvMes.Size = new System.Drawing.Size(443, 150); + this.dgvMes.Size = new System.Drawing.Size(599, 150); this.dgvMes.TabIndex = 5; // // dataGridViewTextBoxColumn1 @@ -164,7 +191,7 @@ this.dataGridViewTextBoxColumn1.MinimumWidth = 6; this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1"; this.dataGridViewTextBoxColumn1.ReadOnly = true; - this.dataGridViewTextBoxColumn1.Width = 125; + this.dataGridViewTextBoxColumn1.Width = 250; // // dataGridViewTextBoxColumn2 // @@ -172,7 +199,13 @@ this.dataGridViewTextBoxColumn2.MinimumWidth = 6; this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2"; this.dataGridViewTextBoxColumn2.ReadOnly = true; - this.dataGridViewTextBoxColumn2.Width = 125; + this.dataGridViewTextBoxColumn2.Width = 50; + // + // PrecioCompraMes + // + this.PrecioCompraMes.HeaderText = "Precio Compra"; + this.PrecioCompraMes.Name = "PrecioCompraMes"; + this.PrecioCompraMes.Width = 50; // // dataGridViewTextBoxColumn3 // @@ -180,14 +213,20 @@ this.dataGridViewTextBoxColumn3.MinimumWidth = 6; this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3"; this.dataGridViewTextBoxColumn3.ReadOnly = true; - this.dataGridViewTextBoxColumn3.Width = 125; + this.dataGridViewTextBoxColumn3.Width = 50; // // dataGridViewTextBoxColumn4 // this.dataGridViewTextBoxColumn4.HeaderText = "Total"; this.dataGridViewTextBoxColumn4.MinimumWidth = 6; this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4"; - this.dataGridViewTextBoxColumn4.Width = 125; + this.dataGridViewTextBoxColumn4.Width = 70; + // + // totalNetoMes + // + this.totalNetoMes.HeaderText = "Total Neto"; + this.totalNetoMes.Name = "totalNetoMes"; + this.totalNetoMes.Width = 70; // // lbProductDia // @@ -195,7 +234,7 @@ this.lbProductDia.BackColor = System.Drawing.Color.Transparent; this.lbProductDia.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbProductDia.ForeColor = System.Drawing.Color.Transparent; - this.lbProductDia.Location = new System.Drawing.Point(586, 197); + this.lbProductDia.Location = new System.Drawing.Point(657, 199); this.lbProductDia.Name = "lbProductDia"; this.lbProductDia.Size = new System.Drawing.Size(153, 17); this.lbProductDia.TabIndex = 6; @@ -208,36 +247,37 @@ this.lbVendedorDia.BackColor = System.Drawing.Color.Transparent; this.lbVendedorDia.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbVendedorDia.ForeColor = System.Drawing.Color.Transparent; - this.lbVendedorDia.Location = new System.Drawing.Point(586, 257); + this.lbVendedorDia.Location = new System.Drawing.Point(657, 261); this.lbVendedorDia.Name = "lbVendedorDia"; this.lbVendedorDia.Size = new System.Drawing.Size(113, 17); this.lbVendedorDia.TabIndex = 7; this.lbVendedorDia.Text = "Mejor vendedos:"; this.lbVendedorDia.Click += new System.EventHandler(this.lbVendedorDia_Click); // - // lbTotalDia + // lbUtilidadDia // - this.lbTotalDia.AutoSize = true; - this.lbTotalDia.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.lbTotalDia.ForeColor = System.Drawing.Color.Transparent; - this.lbTotalDia.Location = new System.Drawing.Point(333, 356); - this.lbTotalDia.Name = "lbTotalDia"; - this.lbTotalDia.Size = new System.Drawing.Size(90, 17); - this.lbTotalDia.TabIndex = 8; - this.lbTotalDia.Text = "Total del dia:"; + this.lbUtilidadDia.AutoSize = true; + this.lbUtilidadDia.BackColor = System.Drawing.Color.Transparent; + this.lbUtilidadDia.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbUtilidadDia.ForeColor = System.Drawing.Color.Transparent; + this.lbUtilidadDia.Location = new System.Drawing.Point(419, 355); + this.lbUtilidadDia.Name = "lbUtilidadDia"; + this.lbUtilidadDia.Size = new System.Drawing.Size(105, 17); + this.lbUtilidadDia.TabIndex = 8; + this.lbUtilidadDia.Text = "Utilidad del dia:"; + this.lbUtilidadDia.Click += new System.EventHandler(this.lbTotalDia_Click); // - // lbTotalMes + // lbUtilidadMes // - this.lbTotalMes.AutoSize = true; - this.lbTotalMes.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.lbTotalMes.ForeColor = System.Drawing.Color.Transparent; - this.lbTotalMes.Location = new System.Drawing.Point(330, 560); - this.lbTotalMes.Name = "lbTotalMes"; - this.lbTotalMes.Size = new System.Drawing.Size(97, 17); - this.lbTotalMes.TabIndex = 9; - this.lbTotalMes.Text = "Total del Mes:"; + this.lbUtilidadMes.AutoSize = true; + this.lbUtilidadMes.BackColor = System.Drawing.Color.Transparent; + this.lbUtilidadMes.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbUtilidadMes.ForeColor = System.Drawing.Color.Transparent; + this.lbUtilidadMes.Location = new System.Drawing.Point(419, 664); + this.lbUtilidadMes.Name = "lbUtilidadMes"; + this.lbUtilidadMes.Size = new System.Drawing.Size(112, 17); + this.lbUtilidadMes.TabIndex = 9; + this.lbUtilidadMes.Text = "Utilidad del mes:"; // // lbVendedorMes // @@ -245,7 +285,7 @@ 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.ForeColor = System.Drawing.Color.Transparent; - this.lbVendedorMes.Location = new System.Drawing.Point(588, 454); + this.lbVendedorMes.Location = new System.Drawing.Point(665, 552); this.lbVendedorMes.Name = "lbVendedorMes"; this.lbVendedorMes.Size = new System.Drawing.Size(111, 17); this.lbVendedorMes.TabIndex = 11; @@ -258,7 +298,7 @@ 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.ForeColor = System.Drawing.Color.Transparent; - this.lbProductoMes.Location = new System.Drawing.Point(588, 396); + this.lbProductoMes.Location = new System.Drawing.Point(663, 482); this.lbProductoMes.Name = "lbProductoMes"; this.lbProductoMes.Size = new System.Drawing.Size(153, 17); this.lbProductoMes.TabIndex = 10; @@ -270,37 +310,105 @@ this.pictureBox2.BackColor = System.Drawing.Color.Transparent; this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.pictureBox2.Image = global::compabetov2.Properties.Resources.check1; - this.pictureBox2.Location = new System.Drawing.Point(785, 560); - this.pictureBox2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.pictureBox2.Location = new System.Drawing.Point(911, 680); + this.pictureBox2.Margin = new System.Windows.Forms.Padding(2); this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.Size = new System.Drawing.Size(75, 56); this.pictureBox2.TabIndex = 28; this.pictureBox2.TabStop = false; this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click); // - // lbDiaSEnvio + // lbGananciasBrutasDia // - this.lbDiaSEnvio.AutoSize = true; - this.lbDiaSEnvio.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.lbDiaSEnvio.ForeColor = System.Drawing.Color.Transparent; - this.lbDiaSEnvio.Location = new System.Drawing.Point(266, 373); - this.lbDiaSEnvio.Name = "lbDiaSEnvio"; - this.lbDiaSEnvio.Size = new System.Drawing.Size(157, 17); - this.lbDiaSEnvio.TabIndex = 29; - this.lbDiaSEnvio.Text = "Total del dia sin envios:"; + this.lbGananciasBrutasDia.AutoSize = true; + this.lbGananciasBrutasDia.BackColor = System.Drawing.Color.Transparent; + this.lbGananciasBrutasDia.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbGananciasBrutasDia.ForeColor = System.Drawing.Color.Transparent; + this.lbGananciasBrutasDia.Location = new System.Drawing.Point(358, 398); + this.lbGananciasBrutasDia.Name = "lbGananciasBrutasDia"; + this.lbGananciasBrutasDia.Size = new System.Drawing.Size(166, 17); + this.lbGananciasBrutasDia.TabIndex = 29; + this.lbGananciasBrutasDia.Text = "Ganancias brutas del dia"; // - // lbMesSEnvio + // lbGananciasBrutasMes // - this.lbMesSEnvio.AutoSize = true; - this.lbMesSEnvio.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.lbMesSEnvio.ForeColor = System.Drawing.Color.Transparent; - this.lbMesSEnvio.Location = new System.Drawing.Point(270, 577); - this.lbMesSEnvio.Name = "lbMesSEnvio"; - this.lbMesSEnvio.Size = new System.Drawing.Size(164, 17); - this.lbMesSEnvio.TabIndex = 30; - this.lbMesSEnvio.Text = "Total del mes sin envios:"; + this.lbGananciasBrutasMes.AutoSize = true; + this.lbGananciasBrutasMes.BackColor = System.Drawing.Color.Transparent; + this.lbGananciasBrutasMes.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbGananciasBrutasMes.ForeColor = System.Drawing.Color.Transparent; + this.lbGananciasBrutasMes.Location = new System.Drawing.Point(352, 719); + this.lbGananciasBrutasMes.Name = "lbGananciasBrutasMes"; + this.lbGananciasBrutasMes.Size = new System.Drawing.Size(171, 17); + this.lbGananciasBrutasMes.TabIndex = 30; + this.lbGananciasBrutasMes.Text = "Ganancias Brutas del dia:"; + // + // lbTotalImporteDia + // + this.lbTotalImporteDia.AutoSize = true; + this.lbTotalImporteDia.BackColor = System.Drawing.Color.Transparent; + this.lbTotalImporteDia.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbTotalImporteDia.ForeColor = System.Drawing.SystemColors.ButtonHighlight; + this.lbTotalImporteDia.Location = new System.Drawing.Point(70, 356); + this.lbTotalImporteDia.Name = "lbTotalImporteDia"; + this.lbTotalImporteDia.Size = new System.Drawing.Size(133, 16); + this.lbTotalImporteDia.TabIndex = 31; + this.lbTotalImporteDia.Text = "Total Importe del dia:"; + // + // btnVentasDia + // + this.btnVentasDia.Location = new System.Drawing.Point(660, 313); + this.btnVentasDia.Name = "btnVentasDia"; + this.btnVentasDia.Size = new System.Drawing.Size(110, 23); + this.btnVentasDia.TabIndex = 32; + this.btnVentasDia.Text = "Ventas del dia"; + this.btnVentasDia.UseVisualStyleBackColor = true; + this.btnVentasDia.Click += new System.EventHandler(this.btnVentasDia_Click); + // + // btnVentasMes + // + this.btnVentasMes.Location = new System.Drawing.Point(666, 611); + this.btnVentasMes.Name = "btnVentasMes"; + this.btnVentasMes.Size = new System.Drawing.Size(110, 23); + this.btnVentasMes.TabIndex = 33; + this.btnVentasMes.Text = "Ventas del Mes"; + this.btnVentasMes.UseVisualStyleBackColor = true; + 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 // @@ -309,15 +417,21 @@ this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(104)))), ((int)(((byte)(255))))); this.BackgroundImage = global::compabetov2.Properties.Resources.Form; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.ClientSize = new System.Drawing.Size(955, 627); + this.ClientSize = new System.Drawing.Size(1038, 772); this.ControlBox = false; - this.Controls.Add(this.lbMesSEnvio); - this.Controls.Add(this.lbDiaSEnvio); + this.Controls.Add(this.lbEnvioMes); + this.Controls.Add(this.lbTotalImporteMes); + this.Controls.Add(this.lbEnviosDia); + this.Controls.Add(this.btnVentasMes); + this.Controls.Add(this.btnVentasDia); + this.Controls.Add(this.lbTotalImporteDia); + this.Controls.Add(this.lbGananciasBrutasMes); + this.Controls.Add(this.lbGananciasBrutasDia); this.Controls.Add(this.pictureBox2); this.Controls.Add(this.lbVendedorMes); this.Controls.Add(this.lbProductoMes); - this.Controls.Add(this.lbTotalMes); - this.Controls.Add(this.lbTotalDia); + this.Controls.Add(this.lbUtilidadMes); + this.Controls.Add(this.lbUtilidadDia); this.Controls.Add(this.lbVendedorDia); this.Controls.Add(this.lbProductDia); this.Controls.Add(this.dgvMes); @@ -342,26 +456,36 @@ 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.Label label2; 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 lbUtilidadDia; + private System.Windows.Forms.Label lbUtilidadMes; private System.Windows.Forms.Label lbVendedorMes; private System.Windows.Forms.Label lbProductoMes; private System.Windows.Forms.PictureBox pictureBox2; - private System.Windows.Forms.Label lbDiaSEnvio; - private System.Windows.Forms.Label lbMesSEnvio; + private System.Windows.Forms.Label lbGananciasBrutasDia; + private System.Windows.Forms.Label lbGananciasBrutasMes; + private System.Windows.Forms.DataGridViewTextBoxColumn Producto; + private System.Windows.Forms.DataGridViewTextBoxColumn Precio; + private System.Windows.Forms.DataGridViewTextBoxColumn precioCompra; + private System.Windows.Forms.DataGridViewTextBoxColumn Cantidad; + private System.Windows.Forms.DataGridViewTextBoxColumn Total; + private System.Windows.Forms.DataGridViewTextBoxColumn totalNeto; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2; + private System.Windows.Forms.DataGridViewTextBoxColumn PrecioCompraMes; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4; + private System.Windows.Forms.DataGridViewTextBoxColumn totalNetoMes; + private System.Windows.Forms.Label lbTotalImporteDia; + private System.Windows.Forms.Button btnVentasDia; + private System.Windows.Forms.Button btnVentasMes; + private System.Windows.Forms.Label lbEnviosDia; + private System.Windows.Forms.Label lbTotalImporteMes; + private System.Windows.Forms.Label lbEnvioMes; } } \ No newline at end of file diff --git a/Estadiscticas.cs b/Estadiscticas.cs index 4f3c930..cccc074 100644 --- a/Estadiscticas.cs +++ b/Estadiscticas.cs @@ -10,12 +10,16 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using System.Xml.Serialization.Configuration; namespace compabetov2 { public partial class Estadiscticas : Form { Dictionary>> resumen; + decimal costosCompraProductos; + decimal ganaciaBrutaProductos; + public Estadiscticas() { InitializeComponent(); @@ -34,80 +38,78 @@ namespace compabetov2 DateTime.TryParseExact(fechaBuscaStr, "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime fechaBuscar); resumen = service.estadisticas(fechaBuscar); + List productosMes = estadisticasMes(); List productosDia = estadisticasDia(); - decimal totalmes = totalMes(); - decimal totaldia = totalDia(); + decimal importeMes = calcularImporte(resumen["mes"]); + decimal importeDia = calcularImporte(resumen["dia"]); + Dictionary> envios = service.conseguirEnvioMes(fechaBuscar); + int enviosMes = cantidadEnvios(envios["mes"]); + int enviosDia = cantidadEnvios(envios["dia"]); + + + decimal utilidadMes = calcularUtilidad(resumen["mes"], importeMes, enviosMes); + Dictionary estadisticas = new Dictionary { { "mes", new Dictionary{ { "productos", productosMes }, { "productoMasVendido", prodctoMasVendido(productosMes) }, - { "mejorVendedor", mejorVenderdorMes() }, - { "totalMes", totalmes }, - { "EnvioCantidad", totalMesSinEnvio(envios) }, + { "mejorVendedor", "yo"/*mejorVenderdorMes()*/ }, + { "EnvioCantidad", enviosMes }, + { "totalImportes", importeMes }, } }, { "dia", new Dictionary{ { "productos", productosDia }, { "productoMasVendido", prodctoMasVendido(productosDia) }, - { "mejorVendedor", mejorVenderdorDia() }, - { "totalDia", totalDia()}, - { "EnvioCantidad", totalDiaSinEnvio(envios) }, + { "mejorVendedor", "yo"/*mejorVenderdorMes()*/ }, + { "EnvioCantidad", enviosDia }, + { "totalImportes", importeDia }, } } }; mostrarDatos(estadisticas); } - private int totalMesSinEnvio(Dictionary> envios) - { - return envios["mes"].Count; + private int cantidadEnvios(List envios) + { + return envios.Count; } - private int totalDiaSinEnvio(Dictionary> envios) + private decimal calcularUtilidad(List> resumen, decimal totalImportes, int cantidadEnvios) { - return envios["dia"].Count; - } + decimal utilidad = 0; - private decimal totalMes() - { - List> mes = resumen["mes"]; + costosCompraProductos = 0; + ganaciaBrutaProductos = 0; - return calcularTotal(mes); - } - private decimal totalDia() - { - List> dia = resumen["dia"]; - - return calcularTotal(dia); - } - - private decimal calcularTotal(List> resumen) - { - decimal total = 0; foreach (Dictionary venta_y_detalles in resumen) { - VentaModel venta = venta_y_detalles["venta"]; - - total += venta.total; + foreach(DetalleVentaModel detalle in venta_y_detalles["detalles"]) + { + ganaciaBrutaProductos += detalle.cantidad * detalle.producto.precio; + costosCompraProductos += detalle.cantidad * detalle.producto.precioCompra; + } } - return total; + utilidad = ganaciaBrutaProductos - costosCompraProductos; + ganaciaBrutaProductos += totalImportes + (cantidadEnvios * 10); + utilidad += totalImportes + (cantidadEnvios * 10); + return utilidad; } - private List estadisticasDia() + private List estadisticasMes() { - //solo copie y pegue le metodo estadisticas dia y cambie el key en resumen de mes a dia - List> mes = resumen["dia"]; - + List> mes = resumen["mes"]; List detallesMes = new List(); foreach (Dictionary venta_y_detalles in mes) { + foreach (DetalleVentaModel detallesVenta in venta_y_detalles["detalles"]) { int totalElementos = detallesMes.Count; @@ -115,6 +117,7 @@ namespace compabetov2 for (int i = 0; i <= totalElementos; i++) { contador++; + //si no existe el producto lo agrega if (i == totalElementos) { DetalleVentaModel detalleAgregar = new DetalleVentaModel(detallesVenta.cantidad, detallesVenta.producto, detallesVenta.idVenta); @@ -123,27 +126,57 @@ namespace compabetov2 } DetalleVentaModel producto = detallesMes[i]; - + //si existe el producto solo aumenta la cantidad 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 List estadisticasDia() + { + //solo copie y pegue le metodo estadisticas dia y cambie el key en resumen de mes a dia + List> dia = resumen["dia"]; + List detallesDia = new List(); + foreach (Dictionary venta_y_detalles in dia) { + + foreach (DetalleVentaModel detallesVenta in venta_y_detalles["detalles"]) + { + int totalElementos = detallesDia.Count; + int contador = 0; + for (int i = 0; i <= totalElementos; i++) + { + contador++; + //si no existe el producto lo agrega + if (i == totalElementos) + { + DetalleVentaModel detalleAgregar = new DetalleVentaModel(detallesVenta.cantidad, detallesVenta.producto, detallesVenta.idVenta); + detallesDia.Add(detalleAgregar); + break; + } + + DetalleVentaModel producto = detallesDia[i]; + //si existe el producto solo aumenta la cantidad + if (producto.producto.nombre.Equals(detallesVenta.producto.nombre)) + { + producto.cantidad += detallesVenta.cantidad; + break; + } + + } + } + } + + return detallesDia; + } + private void mostrarDatos(Dictionary estadisticas) { dgvDia.Rows.Clear(); @@ -159,29 +192,38 @@ namespace compabetov2 // Crear celdas para la nueva fila DataGridViewCell productoN = new DataGridViewTextBoxCell(); DataGridViewCell precio = new DataGridViewTextBoxCell(); + DataGridViewCell precioCompra = new DataGridViewTextBoxCell(); DataGridViewCell cantidad = new DataGridViewTextBoxCell(); DataGridViewCell total = new DataGridViewTextBoxCell(); + DataGridViewCell totalNeto = new DataGridViewTextBoxCell(); // Establecer los valores de las celdas (puedes ajustar según tu necesidad) productoN.Value = $"{producto.producto.nombre}"; precio.Value = $"{producto.producto.precio}"; + precioCompra.Value = $"{producto.producto.precioCompra}"; cantidad.Value = $"{producto.cantidad}"; total.Value = $"{producto.cantidad * producto.producto.precio}"; + + totalNeto.Value = $"{producto.cantidad * (producto.producto.precio - producto.producto.precioCompra)}"; // Agregar las celdas a la fila nuevaFila.Cells.Add(productoN); nuevaFila.Cells.Add(precio); + nuevaFila.Cells.Add(precioCompra); nuevaFila.Cells.Add(cantidad); nuevaFila.Cells.Add(total); + nuevaFila.Cells.Add(totalNeto); // Agregar la nueva fila al DataGridView 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"]}"; 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 List detallesDia = estadisticas["dia"]["productos"]; @@ -195,86 +237,51 @@ namespace compabetov2 // Crear celdas para la nueva fila DataGridViewCell productoN = new DataGridViewTextBoxCell(); DataGridViewCell precio = new DataGridViewTextBoxCell(); + DataGridViewCell precioCompra = new DataGridViewTextBoxCell(); DataGridViewCell cantidad = new DataGridViewTextBoxCell(); DataGridViewCell total = new DataGridViewTextBoxCell(); + DataGridViewCell totalNeto = new DataGridViewTextBoxCell(); // Establecer los valores de las celdas (puedes ajustar según tu necesidad) productoN.Value = $"{producto.producto.nombre}"; precio.Value = $"{producto.producto.precio}"; + precioCompra.Value = $"{producto.producto.precioCompra}"; cantidad.Value = $"{producto.cantidad}"; total.Value = $"{producto.cantidad * producto.producto.precio}"; + totalNeto.Value = $"{producto.cantidad * (producto.producto.precio - producto.producto.precioCompra)}"; // Agregar las celdas a la fila nuevaFila.Cells.Add(productoN); nuevaFila.Cells.Add(precio); + nuevaFila.Cells.Add(precioCompra); nuevaFila.Cells.Add(cantidad); nuevaFila.Cells.Add(total); + nuevaFila.Cells.Add(totalNeto); // Agregar la nueva fila al DataGridView dgvDia.Rows.Add(nuevaFila); } - decimal totalSinEnvioDia = estadisticas["dia"]["totalDia"] - (estadisticas["dia"]["EnvioCantidad"] * 10); - lbTotalDia.Text = $"Total de dia: ${estadisticas["dia"]["totalDia"]}"; + lbUtilidadDia.Text = $"Utilidad del dia: ${calcularUtilidad(resumen["dia"], estadisticas["dia"]["totalImportes"], estadisticas["dia"]["EnvioCantidad"])}"; lbProductDia.Text = $"Producto mas vendido: {estadisticas["dia"]["productoMasVendido"]}"; lbVendedorDia.Text = $"Mejor vendedor: {estadisticas["dia"]["mejorVendedor"]}"; - lbDiaSEnvio.Text = $"Total del dia sin envios: ${totalSinEnvioDia}"; + lbGananciasBrutasDia.Text = $"Ganancias Brutas dia: ${ganaciaBrutaProductos}"; + lbTotalImporteDia.Text = $"Total importe del dia: ${estadisticas["dia"]["totalImportes"]}"; + lbEnviosDia.Text = $"Total de envios del dia: ${estadisticas["dia"]["EnvioCantidad"] * 10}"; } - private List estadisticasMes() - { - List> mes = resumen["mes"]; - - List detallesMes = new List(); - foreach (Dictionary 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++; - //si no encuentra el producto lo agrega - if (i == totalElementos) - { - DetalleVentaModel detalleAgregar = new DetalleVentaModel(detallesVenta.cantidad, detallesVenta.producto, detallesVenta.idVenta); - detallesMes.Add(detalleAgregar); - break; - } - - DetalleVentaModel producto = detallesMes[i]; - //si encuentra el produco solo aumneta la cantidad - 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> mes = resumen["mes"]; string mejorVendedor = ""; int contadorNumeroVentas = 0; - Dictionary empleados = new Dictionary(); - foreach(Dictionary venta_y_detalle in mes) + List> mes = resumen["mes"]; + Dictionary empleados = new Dictionary(); + foreach (Dictionary venta_y_detalle in mes) { VentaModel venta = venta_y_detalle["venta"]; - if (empleados.ContainsKey(venta.responzable)) { empleados[venta.responzable] += 1; @@ -303,7 +310,6 @@ namespace compabetov2 string productoMasVendido = ""; int cantidadProducto = 0; - foreach(DetalleVentaModel producto in productos) { if(producto.cantidad > cantidadProducto) @@ -318,15 +324,14 @@ namespace compabetov2 private string mejorVenderdorDia() { - List> mes = resumen["dia"]; string mejorVendedor = ""; int contadorNumeroVentas = 0; + List> dia = resumen["dia"]; Dictionary empleados = new Dictionary(); - foreach (Dictionary venta_y_detalle in mes) + foreach (Dictionary venta_y_detalle in dia) { VentaModel venta = venta_y_detalle["venta"]; - if (empleados.ContainsKey(venta.responzable)) { empleados[venta.responzable] += 1; @@ -349,6 +354,23 @@ namespace compabetov2 return mejorVendedor; } + private decimal calcularImporte(List> resumen) + { + decimal totalImporte = 0; + + foreach(Dictionary informacion in resumen) + { + List importes = informacion["importes"]; + + foreach(DetalleImporte importe in importes) + { + totalImporte += importe.cantidad * importe.precioImporte; + } + } + + return totalImporte; + } + private void label5_Click(object sender, EventArgs e) { @@ -383,5 +405,29 @@ namespace compabetov2 { this.Close(); } + + private void dgvDia_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + + } + + private void btnVentasDia_Click(object sender, EventArgs e) + { + RegistroVentas ventana = new RegistroVentas(resumen["dia"],this); + ventana.Owner = this; + ventana.Show(); + } + + private void btnVentasMes_Click(object sender, EventArgs e) + { + RegistroVentas ventana = new RegistroVentas(resumen["mes"], this); + ventana.Owner = this; + ventana.Show(); + } + + private void lbTotalDia_Click(object sender, EventArgs e) + { + + } } } diff --git a/Estadiscticas.resx b/Estadiscticas.resx index 3d753bc..a4d2de6 100644 --- a/Estadiscticas.resx +++ b/Estadiscticas.resx @@ -123,22 +123,34 @@ True + + True + True True + + True + True True + + True + True True + + True + \ No newline at end of file diff --git a/RegistroVentas.Designer.cs b/RegistroVentas.Designer.cs new file mode 100644 index 0000000..e41eca2 --- /dev/null +++ b/RegistroVentas.Designer.cs @@ -0,0 +1,112 @@ +namespace compabetov2 +{ + partial class RegistroVentas + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.panelVentas = new System.Windows.Forms.FlowLayoutPanel(); + this.lbContador = new System.Windows.Forms.Label(); + this.btnMenos = new System.Windows.Forms.Button(); + this.btnMas = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // panelVentas + // + this.panelVentas.AutoScroll = true; + this.panelVentas.Location = new System.Drawing.Point(304, 321); + this.panelVentas.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.panelVentas.Name = "panelVentas"; + this.panelVentas.Size = new System.Drawing.Size(563, 673); + this.panelVentas.TabIndex = 0; + // + // lbContador + // + this.lbContador.AutoSize = true; + this.lbContador.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbContador.Location = new System.Drawing.Point(519, 232); + this.lbContador.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lbContador.Name = "lbContador"; + this.lbContador.Size = new System.Drawing.Size(125, 29); + this.lbContador.TabIndex = 0; + this.lbContador.Text = "1000-1000"; + // + // btnMenos + // + this.btnMenos.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnMenos.Location = new System.Drawing.Point(394, 231); + this.btnMenos.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnMenos.Name = "btnMenos"; + this.btnMenos.Size = new System.Drawing.Size(100, 37); + this.btnMenos.TabIndex = 1; + this.btnMenos.Text = "-"; + this.btnMenos.UseVisualStyleBackColor = true; + this.btnMenos.Click += new System.EventHandler(this.btnMenos_Click); + // + // btnMas + // + this.btnMas.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnMas.Location = new System.Drawing.Point(680, 232); + this.btnMas.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnMas.Name = "btnMas"; + this.btnMas.Size = new System.Drawing.Size(100, 37); + this.btnMas.TabIndex = 2; + this.btnMas.Text = "+"; + this.btnMas.UseVisualStyleBackColor = true; + this.btnMas.Click += new System.EventHandler(this.btnMas_Click); + // + // RegistroVentas + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(104)))), ((int)(((byte)(255))))); + this.BackgroundImage = global::compabetov2.Properties.Resources.Form; + this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.ClientSize = new System.Drawing.Size(1153, 1047); + this.ControlBox = false; + this.Controls.Add(this.btnMas); + this.Controls.Add(this.btnMenos); + this.Controls.Add(this.lbContador); + this.Controls.Add(this.panelVentas); + this.DoubleBuffered = true; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.Name = "RegistroVentas"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Load += new System.EventHandler(this.RegistroVentas_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.FlowLayoutPanel panelVentas; + private System.Windows.Forms.Label lbContador; + private System.Windows.Forms.Button btnMenos; + private System.Windows.Forms.Button btnMas; + } +} \ No newline at end of file diff --git a/RegistroVentas.cs b/RegistroVentas.cs new file mode 100644 index 0000000..ceb4c80 --- /dev/null +++ b/RegistroVentas.cs @@ -0,0 +1,162 @@ +using compabetov2.database; +using compabetov2.database.modelos; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace compabetov2 +{ + public partial class RegistroVentas : Form + { + List> ventasYDetalles; + Estadiscticas ventanaPadre; + int cantidadVentas; + int cotaInferior = 0; + int cotaSuperior; + public RegistroVentas(List> ventasYDetalles, Estadiscticas ventanaPadre) + { + InitializeComponent(); + this.ventanaPadre = ventanaPadre; + this.ventasYDetalles = ventasYDetalles; + cantidadVentas = ventasYDetalles.Count; + lbContador.Text = $"0 - {cantidadVentas}"; + cotaSuperior = cantidadVentas > 20 ? 20 : cantidadVentas; + llenarPanel(); + } + + private void llenarPanel() + { + panelVentas.Controls.Clear(); + + for(int i = cotaInferior; i < cotaSuperior; i++) + { + Dictionary ventaYDetalles = ventasYDetalles[i]; + VentaModel venta = ventaYDetalles["venta"]; + + TableLayoutPanel carta = new TableLayoutPanel(); + carta.ColumnCount = 1; + carta.RowCount = 2; + carta.RowStyles.Add(new RowStyle(SizeType.Percent, 70F)); + carta.RowStyles.Add(new RowStyle(SizeType.Percent, 30F)); + carta.Width = 385; + carta.Height = 150; + carta.BackColor = Color.FromArgb(200, 200, 200); + + FlowLayoutPanel infoPanel = new FlowLayoutPanel(); + infoPanel.FlowDirection = FlowDirection.TopDown; + infoPanel.Dock = DockStyle.Fill; + + Label lbFecha = new Label(); + lbFecha.Text = $"Fecha: {venta.fecha}"; + lbFecha.Font = new Font(lbFecha.Font.FontFamily, 16); + lbFecha.Width = 700; + + Label lbResponzable = new Label(); + lbResponzable.Text = $"Responsable: {venta.responzable}"; + lbResponzable.Font = new Font(lbResponzable.Font.FontFamily, 16); + lbResponzable.Width = 700; + + Label lbTotal = new Label(); + lbTotal.Text = $"Total: {venta.total}"; + lbTotal.Font = new Font(lbTotal.Font.FontFamily, 16); + lbTotal.Width = 700; + + TableLayoutPanel botonesPanel = new TableLayoutPanel(); + botonesPanel.RowCount = 1; + botonesPanel.ColumnCount = 2; + botonesPanel.Dock = DockStyle.Fill; + botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); + botonesPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); + botonesPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); + + Button btnDetalles = new Button(); + btnDetalles.Text = "Detalles"; + btnDetalles.Dock = DockStyle.Fill; + btnDetalles.FlatStyle = FlatStyle.Flat; + btnDetalles.FlatAppearance.BorderSize = 0; + btnDetalles.BackColor = Color.FromArgb(33, 90, 255); + btnDetalles.Font = new Font(btnDetalles.Font.FontFamily, 16); + btnDetalles.ForeColor = Color.White; + btnDetalles.Click += new EventHandler(delegate (object sender, EventArgs e) + { + List 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) + { + }); + + infoPanel.Controls.Add(lbFecha); + infoPanel.Controls.Add(lbTotal); + infoPanel.Controls.Add(lbResponzable); + + botonesPanel.Controls.Add(btnDetalles, 0, 0); + botonesPanel.Controls.Add(btnImprimir, 1, 0); + + carta.Controls.Add(infoPanel, 0, 0); + carta.Controls.Add(botonesPanel, 0, 1); + + panelVentas.Controls.Add(carta); + } + + foreach (Dictionary ventaYDetalles in ventasYDetalles) + { + VentaModel venta = ventaYDetalles["venta"]; + + + } + } + + 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) + { + 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) + { + + } + } +} diff --git a/RegistroVentas.resx b/RegistroVentas.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/RegistroVentas.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Ventas/vender.Designer.cs b/Ventas/vender.Designer.cs index 76297f3..9680030 100644 --- a/Ventas/vender.Designer.cs +++ b/Ventas/vender.Designer.cs @@ -70,9 +70,10 @@ this.lblfecha.AutoSize = true; this.lblfecha.Font = new System.Drawing.Font("Microsoft Sans Serif", 30F); this.lblfecha.ForeColor = System.Drawing.Color.Navy; - this.lblfecha.Location = new System.Drawing.Point(619, 128); + this.lblfecha.Location = new System.Drawing.Point(464, 104); + this.lblfecha.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblfecha.Name = "lblfecha"; - this.lblfecha.Size = new System.Drawing.Size(159, 58); + this.lblfecha.Size = new System.Drawing.Size(126, 46); this.lblfecha.TabIndex = 13; this.lblfecha.Text = "label2"; this.lblfecha.TextAlign = System.Drawing.ContentAlignment.TopCenter; @@ -83,9 +84,10 @@ this.lblhora.AutoSize = true; this.lblhora.Font = new System.Drawing.Font("Microsoft Sans Serif", 60F); this.lblhora.ForeColor = System.Drawing.Color.MediumBlue; - this.lblhora.Location = new System.Drawing.Point(807, 9); + this.lblhora.Location = new System.Drawing.Point(605, 7); + this.lblhora.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.lblhora.Name = "lblhora"; - this.lblhora.Size = new System.Drawing.Size(318, 113); + this.lblhora.Size = new System.Drawing.Size(249, 91); this.lblhora.TabIndex = 12; this.lblhora.Text = "label1"; this.lblhora.Click += new System.EventHandler(this.lblhora_Click); @@ -96,10 +98,10 @@ this.flowLayoutPanel2.Controls.Add(this.panel1); this.flowLayoutPanel2.Controls.Add(this.label1); this.flowLayoutPanel2.Controls.Add(this.labeltotal); - this.flowLayoutPanel2.Location = new System.Drawing.Point(1605, -1); - this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.flowLayoutPanel2.Location = new System.Drawing.Point(1204, -1); + this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; - this.flowLayoutPanel2.Size = new System.Drawing.Size(324, 1191); + this.flowLayoutPanel2.Size = new System.Drawing.Size(243, 968); this.flowLayoutPanel2.TabIndex = 11; this.flowLayoutPanel2.Paint += new System.Windows.Forms.PaintEventHandler(this.flowLayoutPanel2_Paint); // @@ -107,17 +109,17 @@ // this.panel1.BackColor = System.Drawing.Color.Transparent; this.panel1.Controls.Add(this.pictureBox9); - this.panel1.Location = new System.Drawing.Point(3, 2); - this.panel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.panel1.Location = new System.Drawing.Point(2, 2); + this.panel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(312, 263); + this.panel1.Size = new System.Drawing.Size(234, 214); this.panel1.TabIndex = 8; // // pictureBox9 // this.pictureBox9.Image = global::compabetov2.Properties.Resources.HomeroMenu; - this.pictureBox9.Location = new System.Drawing.Point(64, 34); - this.pictureBox9.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.pictureBox9.Location = new System.Drawing.Point(48, 28); + this.pictureBox9.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.pictureBox9.Name = "pictureBox9"; this.pictureBox9.Size = new System.Drawing.Size(190, 197); this.pictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -130,9 +132,10 @@ this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F); this.label1.ForeColor = System.Drawing.Color.AliceBlue; - this.label1.Location = new System.Drawing.Point(3, 267); + this.label1.Location = new System.Drawing.Point(2, 218); + this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(102, 39); + this.label1.Size = new System.Drawing.Size(83, 31); this.label1.TabIndex = 17; this.label1.Text = "Total:"; this.label1.Click += new System.EventHandler(this.label1_Click); @@ -143,9 +146,10 @@ this.labeltotal.BackColor = System.Drawing.Color.Transparent; this.labeltotal.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F); this.labeltotal.ForeColor = System.Drawing.Color.AliceBlue; - this.labeltotal.Location = new System.Drawing.Point(111, 267); + this.labeltotal.Location = new System.Drawing.Point(89, 218); + this.labeltotal.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.labeltotal.Name = "labeltotal"; - this.labeltotal.Size = new System.Drawing.Size(0, 39); + this.labeltotal.Size = new System.Drawing.Size(0, 31); this.labeltotal.TabIndex = 18; // // flowLayoutPanel1 @@ -157,26 +161,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, 1199); + this.flowLayoutPanel1.Size = new System.Drawing.Size(243, 974); this.flowLayoutPanel1.TabIndex = 8; // // panel2 // this.panel2.BackColor = System.Drawing.Color.Transparent; this.panel2.Controls.Add(this.pictureBox7); - this.panel2.Location = new System.Drawing.Point(3, 2); - this.panel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.panel2.Location = new System.Drawing.Point(2, 2); + this.panel2.Margin = new System.Windows.Forms.Padding(2, 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; @@ -192,11 +196,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; @@ -211,11 +215,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 = "Reportes"; this.button2.UseVisualStyleBackColor = false; @@ -230,11 +234,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; @@ -248,11 +252,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; @@ -260,20 +264,20 @@ // flowLayoutPanel3 // this.flowLayoutPanel3.AutoScroll = true; - this.flowLayoutPanel3.Location = new System.Drawing.Point(329, 343); - this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.flowLayoutPanel3.Location = new System.Drawing.Point(247, 279); + this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 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.Paint += new System.Windows.Forms.PaintEventHandler(this.flowLayoutPanel3_Paint); // // txtbusqueda // 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.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.txtbusqueda.Location = new System.Drawing.Point(247, 178); + this.txtbusqueda.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 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.TextChanged += new System.EventHandler(this.txtbusqueda_TextChanged); // @@ -283,10 +287,10 @@ this.bntImprimir.Enabled = false; this.bntImprimir.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.bntImprimir.ForeColor = System.Drawing.Color.Transparent; - this.bntImprimir.Location = new System.Drawing.Point(1055, 210); - this.bntImprimir.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.bntImprimir.Location = new System.Drawing.Point(791, 171); + this.bntImprimir.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.bntImprimir.Name = "bntImprimir"; - this.bntImprimir.Size = new System.Drawing.Size(151, 54); + this.bntImprimir.Size = new System.Drawing.Size(113, 44); this.bntImprimir.TabIndex = 17; this.bntImprimir.Text = "Vender"; this.bntImprimir.UseVisualStyleBackColor = false; @@ -296,10 +300,10 @@ // this.responsablecb.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.responsablecb.FormattingEnabled = true; - this.responsablecb.Location = new System.Drawing.Point(1371, 218); - this.responsablecb.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.responsablecb.Location = new System.Drawing.Point(1028, 177); + this.responsablecb.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 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.SelectedIndexChanged += new System.EventHandler(this.responsablecb_SelectedIndexChanged); // @@ -309,10 +313,9 @@ this.btnFiar.Enabled = false; this.btnFiar.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.btnFiar.ForeColor = System.Drawing.Color.Transparent; - this.btnFiar.Location = new System.Drawing.Point(1213, 210); - this.btnFiar.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.btnFiar.Location = new System.Drawing.Point(910, 171); this.btnFiar.Name = "btnFiar"; - this.btnFiar.Size = new System.Drawing.Size(151, 54); + this.btnFiar.Size = new System.Drawing.Size(113, 44); this.btnFiar.TabIndex = 19; this.btnFiar.Text = "Cuenta"; this.btnFiar.UseVisualStyleBackColor = false; @@ -324,10 +327,10 @@ this.btnEnviar.Enabled = false; this.btnEnviar.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.btnEnviar.ForeColor = System.Drawing.Color.Transparent; - this.btnEnviar.Location = new System.Drawing.Point(1213, 273); - this.btnEnviar.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.btnEnviar.Location = new System.Drawing.Point(910, 222); + this.btnEnviar.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 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.Text = "Enviar"; 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.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.btnImporte.ForeColor = System.Drawing.Color.Transparent; - this.btnImporte.Location = new System.Drawing.Point(1056, 273); - this.btnImporte.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.btnImporte.Location = new System.Drawing.Point(792, 222); + this.btnImporte.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); 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.Text = "Importe"; this.btnImporte.UseVisualStyleBackColor = false; @@ -349,9 +352,9 @@ // // vender // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1767, 772); + this.ClientSize = new System.Drawing.Size(1166, 627); this.ControlBox = false; this.Controls.Add(this.btnImporte); this.Controls.Add(this.btnEnviar); @@ -364,7 +367,7 @@ this.Controls.Add(this.lblhora); this.Controls.Add(this.flowLayoutPanel2); this.Controls.Add(this.flowLayoutPanel1); - this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.Name = "vender"; this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.Load += new System.EventHandler(this.vender_Load); diff --git a/Ventas/vender.cs b/Ventas/vender.cs index 6d93327..fcf1ed1 100644 --- a/Ventas/vender.cs +++ b/Ventas/vender.cs @@ -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); 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"); llenarLayout(); diff --git a/admin/Variantes.Designer.cs b/admin/Variantes.Designer.cs index 3905724..b5f01f4 100644 --- a/admin/Variantes.Designer.cs +++ b/admin/Variantes.Designer.cs @@ -36,18 +36,20 @@ // this.VariantePanel.AutoScroll = true; this.VariantePanel.BackColor = System.Drawing.SystemColors.Control; - this.VariantePanel.Location = new System.Drawing.Point(13, 59); + this.VariantePanel.Location = new System.Drawing.Point(17, 144); + this.VariantePanel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.VariantePanel.Name = "VariantePanel"; - this.VariantePanel.Size = new System.Drawing.Size(1146, 516); + this.VariantePanel.Size = new System.Drawing.Size(1551, 564); this.VariantePanel.TabIndex = 16; this.VariantePanel.Paint += new System.Windows.Forms.PaintEventHandler(this.VariantePanel_Paint); // // btnAgregar // this.btnAgregar.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnAgregar.Location = new System.Drawing.Point(543, 12); + this.btnAgregar.Location = new System.Drawing.Point(1423, 87); + this.btnAgregar.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnAgregar.Name = "btnAgregar"; - this.btnAgregar.Size = new System.Drawing.Size(94, 40); + this.btnAgregar.Size = new System.Drawing.Size(125, 49); this.btnAgregar.TabIndex = 17; this.btnAgregar.Text = "Agregar"; this.btnAgregar.UseVisualStyleBackColor = true; @@ -55,14 +57,20 @@ // // Variantes // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1171, 587); + this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(104)))), ((int)(((byte)(255))))); + this.BackgroundImage = global::compabetov2.Properties.Resources.Form; + this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; + this.ClientSize = new System.Drawing.Size(1561, 722); + this.ControlBox = false; this.Controls.Add(this.btnAgregar); this.Controls.Add(this.VariantePanel); - this.Margin = new System.Windows.Forms.Padding(2); + this.DoubleBuffered = true; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Name = "Variantes"; - this.Text = "Variantes"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Load += new System.EventHandler(this.Variantes_Load); this.ResumeLayout(false); diff --git a/admin/Variantes.cs b/admin/Variantes.cs index 596b08c..deee1dc 100644 --- a/admin/Variantes.cs +++ b/admin/Variantes.cs @@ -95,7 +95,9 @@ namespace compabetov2.admin btnEditar.Dock = DockStyle.Fill; btnEditar.Click += new EventHandler(delegate (object sender, EventArgs e) { - + editarvariante editarvariante = new editarvariante(variante, this); + editarvariante.Owner = this; + editarvariante.Show(); }); diff --git a/admin/addvariante.Designer.cs b/admin/addvariante.Designer.cs index 1638cb1..cf8268e 100644 --- a/admin/addvariante.Designer.cs +++ b/admin/addvariante.Designer.cs @@ -48,10 +48,9 @@ // txtPrecio // this.txtPrecio.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtPrecio.Location = new System.Drawing.Point(251, 252); - this.txtPrecio.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtPrecio.Location = new System.Drawing.Point(188, 205); this.txtPrecio.Name = "txtPrecio"; - this.txtPrecio.Size = new System.Drawing.Size(399, 30); + this.txtPrecio.Size = new System.Drawing.Size(300, 26); this.txtPrecio.TabIndex = 37; // // label2 @@ -60,20 +59,18 @@ this.label2.BackColor = System.Drawing.Color.Transparent; this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label2.ForeColor = System.Drawing.Color.Transparent; - this.label2.Location = new System.Drawing.Point(245, 209); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label2.Location = new System.Drawing.Point(184, 170); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(89, 29); + this.label2.Size = new System.Drawing.Size(69, 24); this.label2.TabIndex = 38; this.label2.Text = "Precio:"; // // txtNombre // this.txtNombre.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtNombre.Location = new System.Drawing.Point(251, 162); - this.txtNombre.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtNombre.Location = new System.Drawing.Point(188, 132); this.txtNombre.Name = "txtNombre"; - this.txtNombre.Size = new System.Drawing.Size(399, 30); + this.txtNombre.Size = new System.Drawing.Size(300, 26); this.txtNombre.TabIndex = 35; // // label1 @@ -82,20 +79,18 @@ this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.Color.Transparent; - this.label1.Location = new System.Drawing.Point(245, 121); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Location = new System.Drawing.Point(184, 98); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(107, 29); + this.label1.Size = new System.Drawing.Size(84, 24); this.label1.TabIndex = 36; this.label1.Text = "Nombre:"; // // txtCantidad // this.txtCantidad.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtCantidad.Location = new System.Drawing.Point(251, 337); - this.txtCantidad.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtCantidad.Location = new System.Drawing.Point(188, 274); this.txtCantidad.Name = "txtCantidad"; - this.txtCantidad.Size = new System.Drawing.Size(399, 30); + this.txtCantidad.Size = new System.Drawing.Size(300, 26); this.txtCantidad.TabIndex = 39; // // label3 @@ -104,21 +99,20 @@ this.label3.BackColor = System.Drawing.Color.Transparent; this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label3.ForeColor = System.Drawing.Color.Transparent; - this.label3.Location = new System.Drawing.Point(245, 294); - this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label3.Location = new System.Drawing.Point(184, 239); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(115, 29); + this.label3.Size = new System.Drawing.Size(92, 24); this.label3.TabIndex = 40; - this.label3.Text = "Cantidad:"; + this.label3.Text = "Volumen:"; // // button1 // this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.button1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText; - this.button1.Location = new System.Drawing.Point(251, 393); - this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button1.Location = new System.Drawing.Point(188, 319); + this.button1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(103, 46); + this.button1.Size = new System.Drawing.Size(77, 37); this.button1.TabIndex = 42; this.button1.Text = "Subir"; this.button1.UseVisualStyleBackColor = true; @@ -130,20 +124,18 @@ this.lbImg.BackColor = System.Drawing.Color.Transparent; this.lbImg.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbImg.ForeColor = System.Drawing.Color.Transparent; - this.lbImg.Location = new System.Drawing.Point(360, 399); - this.lbImg.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lbImg.Location = new System.Drawing.Point(270, 324); this.lbImg.Name = "lbImg"; - this.lbImg.Size = new System.Drawing.Size(99, 29); + this.lbImg.Size = new System.Drawing.Size(78, 24); this.lbImg.TabIndex = 41; this.lbImg.Text = "Imagen:"; // // txtPrecioCompra // this.txtPrecioCompra.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtPrecioCompra.Location = new System.Drawing.Point(251, 487); - this.txtPrecioCompra.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.txtPrecioCompra.Location = new System.Drawing.Point(188, 396); this.txtPrecioCompra.Name = "txtPrecioCompra"; - this.txtPrecioCompra.Size = new System.Drawing.Size(399, 30); + this.txtPrecioCompra.Size = new System.Drawing.Size(300, 26); this.txtPrecioCompra.TabIndex = 43; // // label4 @@ -152,10 +144,9 @@ this.label4.BackColor = System.Drawing.Color.Transparent; this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label4.ForeColor = System.Drawing.Color.Transparent; - this.label4.Location = new System.Drawing.Point(245, 455); - this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label4.Location = new System.Drawing.Point(184, 370); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(181, 29); + this.label4.Size = new System.Drawing.Size(141, 24); this.label4.TabIndex = 44; this.label4.Text = "Precio Compra:"; // @@ -164,10 +155,10 @@ this.pictureBox2.BackColor = System.Drawing.Color.Transparent; this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.pictureBox2.Image = global::compabetov2.Properties.Resources.check1; - this.pictureBox2.Location = new System.Drawing.Point(353, 540); - this.pictureBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.pictureBox2.Location = new System.Drawing.Point(265, 439); + this.pictureBox2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.pictureBox2.Name = "pictureBox2"; - this.pictureBox2.Size = new System.Drawing.Size(100, 69); + this.pictureBox2.Size = new System.Drawing.Size(75, 56); this.pictureBox2.TabIndex = 46; this.pictureBox2.TabStop = false; this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click); @@ -177,10 +168,10 @@ this.pictureBox1.BackColor = System.Drawing.Color.Transparent; this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.pictureBox1.Image = global::compabetov2.Properties.Resources.cancel1; - this.pictureBox1.Location = new System.Drawing.Point(459, 540); - this.pictureBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.pictureBox1.Location = new System.Drawing.Point(344, 439); + this.pictureBox1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(100, 69); + this.pictureBox1.Size = new System.Drawing.Size(75, 56); this.pictureBox1.TabIndex = 45; this.pictureBox1.TabStop = false; this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); @@ -191,21 +182,20 @@ this.label5.BackColor = System.Drawing.Color.Transparent; this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label5.ForeColor = System.Drawing.Color.Transparent; - this.label5.Location = new System.Drawing.Point(13, 9); - this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label5.Location = new System.Drawing.Point(10, 7); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(193, 29); + this.label5.Size = new System.Drawing.Size(152, 24); this.label5.TabIndex = 47; this.label5.Text = "Agregar Variante"; // // addvariante // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(104)))), ((int)(((byte)(255))))); this.BackgroundImage = global::compabetov2.Properties.Resources.Form; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.ClientSize = new System.Drawing.Size(897, 622); + this.ClientSize = new System.Drawing.Size(673, 505); this.ControlBox = false; this.Controls.Add(this.label5); this.Controls.Add(this.pictureBox2); @@ -222,7 +212,7 @@ this.Controls.Add(this.label1); this.DoubleBuffered = true; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; - this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.Name = "addvariante"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); diff --git a/admin/addvariante.cs b/admin/addvariante.cs index f6e1154..0945530 100644 --- a/admin/addvariante.cs +++ b/admin/addvariante.cs @@ -45,6 +45,9 @@ namespace compabetov2.admin if (service.insertarVariante(NuevaVariante)) { + string destinationFolder = Path.Combine(Application.StartupPath, "Resources"); + string destinationFile = Path.Combine(destinationFolder, Path.GetFileName(imagePath)); + File.Copy(imagePath, destinationFile, true); Close(); ventanaPadre.llenarLayout(); } diff --git a/admin/agregarproducto.Designer.cs b/admin/agregarproducto.Designer.cs index e395189..248911c 100644 --- a/admin/agregarproducto.Designer.cs +++ b/admin/agregarproducto.Designer.cs @@ -32,8 +32,6 @@ this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.lbImg = new System.Windows.Forms.Label(); - this.txtPrecio = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); this.txtNombre = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label(); @@ -45,9 +43,10 @@ // this.btnSubir.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnSubir.ForeColor = System.Drawing.SystemColors.ActiveCaptionText; - this.btnSubir.Location = new System.Drawing.Point(243, 312); + this.btnSubir.Location = new System.Drawing.Point(182, 254); + this.btnSubir.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.btnSubir.Name = "btnSubir"; - this.btnSubir.Size = new System.Drawing.Size(103, 46); + this.btnSubir.Size = new System.Drawing.Size(77, 37); this.btnSubir.TabIndex = 38; this.btnSubir.Text = "Subir"; this.btnSubir.UseVisualStyleBackColor = true; @@ -58,9 +57,10 @@ this.pictureBox2.BackColor = System.Drawing.Color.Transparent; this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.pictureBox2.Image = global::compabetov2.Properties.Resources.check1; - this.pictureBox2.Location = new System.Drawing.Point(348, 424); + this.pictureBox2.Location = new System.Drawing.Point(261, 344); + this.pictureBox2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.pictureBox2.Name = "pictureBox2"; - this.pictureBox2.Size = new System.Drawing.Size(100, 69); + this.pictureBox2.Size = new System.Drawing.Size(75, 56); this.pictureBox2.TabIndex = 37; this.pictureBox2.TabStop = false; this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click); @@ -70,9 +70,10 @@ this.pictureBox1.BackColor = System.Drawing.Color.Transparent; this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.pictureBox1.Image = global::compabetov2.Properties.Resources.cancel1; - this.pictureBox1.Location = new System.Drawing.Point(454, 424); + this.pictureBox1.Location = new System.Drawing.Point(340, 344); + this.pictureBox1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(100, 69); + this.pictureBox1.Size = new System.Drawing.Size(75, 56); this.pictureBox1.TabIndex = 36; this.pictureBox1.TabStop = false; this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); @@ -83,42 +84,18 @@ this.lbImg.BackColor = System.Drawing.Color.Transparent; this.lbImg.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbImg.ForeColor = System.Drawing.Color.Transparent; - this.lbImg.Location = new System.Drawing.Point(353, 318); - this.lbImg.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lbImg.Location = new System.Drawing.Point(265, 258); this.lbImg.Name = "lbImg"; - this.lbImg.Size = new System.Drawing.Size(99, 29); + this.lbImg.Size = new System.Drawing.Size(78, 24); this.lbImg.TabIndex = 35; this.lbImg.Text = "Imagen:"; // - // txtPrecio - // - this.txtPrecio.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtPrecio.Location = new System.Drawing.Point(243, 258); - this.txtPrecio.Margin = new System.Windows.Forms.Padding(4); - this.txtPrecio.Name = "txtPrecio"; - this.txtPrecio.Size = new System.Drawing.Size(399, 30); - this.txtPrecio.TabIndex = 33; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.BackColor = System.Drawing.Color.Transparent; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.ForeColor = System.Drawing.Color.Transparent; - this.label2.Location = new System.Drawing.Point(238, 215); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(89, 29); - this.label2.TabIndex = 34; - this.label2.Text = "Precio:"; - // // txtNombre // this.txtNombre.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtNombre.Location = new System.Drawing.Point(243, 169); - this.txtNombre.Margin = new System.Windows.Forms.Padding(4); + this.txtNombre.Location = new System.Drawing.Point(182, 192); this.txtNombre.Name = "txtNombre"; - this.txtNombre.Size = new System.Drawing.Size(399, 30); + this.txtNombre.Size = new System.Drawing.Size(300, 26); this.txtNombre.TabIndex = 31; // // label1 @@ -127,10 +104,9 @@ this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.Color.Transparent; - this.label1.Location = new System.Drawing.Point(238, 127); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Location = new System.Drawing.Point(178, 158); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(107, 29); + this.label1.Size = new System.Drawing.Size(84, 24); this.label1.TabIndex = 32; this.label1.Text = "Nombre:"; // @@ -140,34 +116,32 @@ this.label3.BackColor = System.Drawing.Color.Transparent; this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label3.ForeColor = System.Drawing.Color.Transparent; - this.label3.Location = new System.Drawing.Point(13, 9); - this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label3.Location = new System.Drawing.Point(10, 7); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(202, 29); + this.label3.Size = new System.Drawing.Size(159, 24); this.label3.TabIndex = 39; this.label3.Text = "Agregar Producto"; // // agregarproducto // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(104)))), ((int)(((byte)(255))))); this.BackgroundImage = global::compabetov2.Properties.Resources.Form; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.ClientSize = new System.Drawing.Size(897, 575); + this.ClientSize = new System.Drawing.Size(673, 467); this.ControlBox = false; this.Controls.Add(this.label3); this.Controls.Add(this.btnSubir); this.Controls.Add(this.pictureBox2); this.Controls.Add(this.pictureBox1); this.Controls.Add(this.lbImg); - this.Controls.Add(this.txtPrecio); - this.Controls.Add(this.label2); this.Controls.Add(this.txtNombre); this.Controls.Add(this.label1); this.DoubleBuffered = true; this.ForeColor = System.Drawing.SystemColors.ControlLightLight; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.Name = "agregarproducto"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); @@ -183,8 +157,6 @@ private System.Windows.Forms.PictureBox pictureBox2; private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.Label lbImg; - private System.Windows.Forms.TextBox txtPrecio; - private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox txtNombre; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label3; diff --git a/admin/agregarproducto.cs b/admin/agregarproducto.cs index 1e32297..d68a848 100644 --- a/admin/agregarproducto.cs +++ b/admin/agregarproducto.cs @@ -28,7 +28,7 @@ namespace compabetov2.admin try { string nombre = txtNombre.Text; - decimal precio = decimal.Parse(txtPrecio.Text); + decimal precio = 0; //valida que se haya colocado alguna imagen if (!imagePath.Equals("")) { Producto producto = new Producto(-1, nombre, "", precio, imagePath, 0); diff --git a/admin/crud.cs b/admin/crud.cs index bef003a..c162974 100644 --- a/admin/crud.cs +++ b/admin/crud.cs @@ -29,7 +29,7 @@ namespace compabetov2.admin AdminPanel.Controls.Clear(); productos.Clear(); productos = service.conseguirProductos(); - + foreach (Producto producto in productos) { @@ -41,7 +41,7 @@ namespace compabetov2.admin filaLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); filaLayout.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); filaLayout.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); - + TableLayoutPanel informacionProducto = new TableLayoutPanel(); informacionProducto.RowCount = 1; @@ -133,27 +133,10 @@ namespace compabetov2.admin { //eliminar imagen antigua string destinationFolder = Path.Combine(Application.StartupPath, "Resources"); - string imagenEliminada = Path.Combine(destinationFolder, producto.img); + string imagenEliminar = Path.Combine(destinationFolder, producto.img); llenarLayout(); //se pone a esperar 1 segundo antes de eliminar la imagen //esto para que al programa le de tiempo de dejar de utilizar la imagen y no lance una excepcion - Timer timer = new Timer(); - timer.Interval = 1000; // 1 segundos - timer.Tick += delegate (object sender2, EventArgs e2) - { - try - { - File.Delete(imagenEliminada); - timer.Stop(); - } - catch (Exception ex) - { - // Manejar la excepción de eliminación de archivo temporal - Console.WriteLine("Error al eliminar archivo temporal: " + ex.Message); - } - }; - timer.Start(); - } } }); @@ -172,7 +155,7 @@ namespace compabetov2.admin AdminPanel.Controls.Add(filaLayout); } } - + private void crud_Load(object sender, EventArgs e) { @@ -211,5 +194,9 @@ namespace compabetov2.admin agregarproducto.Owner = this; agregarproducto.Show(); } + + } + + } diff --git a/admin/editar.Designer.cs b/admin/editar.Designer.cs index c4bb429..e58c530 100644 --- a/admin/editar.Designer.cs +++ b/admin/editar.Designer.cs @@ -30,8 +30,6 @@ { this.txtNombre = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); - this.txtPrecio = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); this.lbImg = new System.Windows.Forms.Label(); this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); @@ -43,10 +41,9 @@ // txtNombre // this.txtNombre.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtNombre.Location = new System.Drawing.Point(240, 210); - this.txtNombre.Margin = new System.Windows.Forms.Padding(4); + this.txtNombre.Location = new System.Drawing.Point(180, 212); this.txtNombre.Name = "txtNombre"; - this.txtNombre.Size = new System.Drawing.Size(399, 30); + this.txtNombre.Size = new System.Drawing.Size(300, 26); this.txtNombre.TabIndex = 5; // // label1 @@ -55,45 +52,21 @@ this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.Color.Transparent; - this.label1.Location = new System.Drawing.Point(235, 168); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Location = new System.Drawing.Point(176, 177); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(107, 29); + this.label1.Size = new System.Drawing.Size(84, 24); this.label1.TabIndex = 6; this.label1.Text = "Nombre:"; // - // txtPrecio - // - this.txtPrecio.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtPrecio.Location = new System.Drawing.Point(240, 299); - this.txtPrecio.Margin = new System.Windows.Forms.Padding(4); - this.txtPrecio.Name = "txtPrecio"; - this.txtPrecio.Size = new System.Drawing.Size(399, 30); - this.txtPrecio.TabIndex = 7; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.BackColor = System.Drawing.Color.Transparent; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.ForeColor = System.Drawing.Color.Transparent; - this.label2.Location = new System.Drawing.Point(235, 256); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(89, 29); - this.label2.TabIndex = 8; - this.label2.Text = "Precio:"; - // // lbImg // this.lbImg.AutoSize = true; this.lbImg.BackColor = System.Drawing.Color.Transparent; this.lbImg.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbImg.ForeColor = System.Drawing.Color.Transparent; - this.lbImg.Location = new System.Drawing.Point(350, 359); - this.lbImg.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lbImg.Location = new System.Drawing.Point(262, 292); this.lbImg.Name = "lbImg"; - this.lbImg.Size = new System.Drawing.Size(99, 29); + this.lbImg.Size = new System.Drawing.Size(78, 24); this.lbImg.TabIndex = 10; this.lbImg.Text = "Imagen:"; // @@ -102,9 +75,10 @@ this.pictureBox2.BackColor = System.Drawing.Color.Transparent; this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.pictureBox2.Image = global::compabetov2.Properties.Resources.check1; - this.pictureBox2.Location = new System.Drawing.Point(345, 465); + this.pictureBox2.Location = new System.Drawing.Point(259, 378); + this.pictureBox2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.pictureBox2.Name = "pictureBox2"; - this.pictureBox2.Size = new System.Drawing.Size(100, 69); + this.pictureBox2.Size = new System.Drawing.Size(75, 56); this.pictureBox2.TabIndex = 29; this.pictureBox2.TabStop = false; this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click); @@ -114,9 +88,10 @@ this.pictureBox1.BackColor = System.Drawing.Color.Transparent; this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.pictureBox1.Image = global::compabetov2.Properties.Resources.cancel1; - this.pictureBox1.Location = new System.Drawing.Point(451, 465); + this.pictureBox1.Location = new System.Drawing.Point(338, 378); + this.pictureBox1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(100, 69); + this.pictureBox1.Size = new System.Drawing.Size(75, 56); this.pictureBox1.TabIndex = 28; this.pictureBox1.TabStop = false; this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); @@ -124,9 +99,10 @@ // button1 // this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.button1.Location = new System.Drawing.Point(240, 353); + this.button1.Location = new System.Drawing.Point(180, 287); + this.button1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(103, 46); + this.button1.Size = new System.Drawing.Size(77, 37); this.button1.TabIndex = 30; this.button1.Text = "Subir"; this.button1.UseVisualStyleBackColor = true; @@ -134,23 +110,22 @@ // // editar // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(104)))), ((int)(((byte)(255))))); this.BackgroundImage = global::compabetov2.Properties.Resources.Form; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.ClientSize = new System.Drawing.Size(897, 575); + this.ClientSize = new System.Drawing.Size(673, 467); this.ControlBox = false; this.Controls.Add(this.button1); this.Controls.Add(this.pictureBox2); this.Controls.Add(this.pictureBox1); this.Controls.Add(this.lbImg); - this.Controls.Add(this.txtPrecio); - this.Controls.Add(this.label2); this.Controls.Add(this.txtNombre); this.Controls.Add(this.label1); this.DoubleBuffered = true; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.Name = "editar"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Load += new System.EventHandler(this.editar_Load); @@ -165,8 +140,6 @@ private System.Windows.Forms.TextBox txtNombre; private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox txtPrecio; - private System.Windows.Forms.Label label2; private System.Windows.Forms.Label lbImg; private System.Windows.Forms.PictureBox pictureBox2; private System.Windows.Forms.PictureBox pictureBox1; diff --git a/admin/editar.cs b/admin/editar.cs index 77728b6..b548368 100644 --- a/admin/editar.cs +++ b/admin/editar.cs @@ -47,7 +47,6 @@ namespace compabetov2.admin private void cargarInto() { txtNombre.Text = producto.nombre; - txtPrecio.Text = producto.precion.ToString(); lbImg.Text = $"Imagen: {Path.GetFileName(imagePath)}"; ; } @@ -58,8 +57,8 @@ namespace compabetov2.admin private void pictureBox2_Click(object sender, EventArgs e) { - try { - decimal precio = decimal.Parse(txtPrecio.Text); + try { + decimal precio = 0; string nombre = txtNombre.Text; //en caso de que descida cambiar la imagen if (!imagePath.Equals("")) diff --git a/admin/editarvariante.Designer.cs b/admin/editarvariante.Designer.cs index 83140fb..7b98dd3 100644 --- a/admin/editarvariante.Designer.cs +++ b/admin/editarvariante.Designer.cs @@ -36,11 +36,11 @@ this.lbImg = new System.Windows.Forms.Label(); this.txtCantidad = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); - this.txtPrecio = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); this.txtNombre = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.txtPrecio = new System.Windows.Forms.TextBox(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); @@ -50,32 +50,33 @@ this.pictureBox2.BackColor = System.Drawing.Color.Transparent; this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.pictureBox2.Image = global::compabetov2.Properties.Resources.check1; - this.pictureBox2.Location = new System.Drawing.Point(357, 541); - this.pictureBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.pictureBox2.Location = new System.Drawing.Point(268, 440); + this.pictureBox2.Margin = new System.Windows.Forms.Padding(2); this.pictureBox2.Name = "pictureBox2"; - this.pictureBox2.Size = new System.Drawing.Size(100, 69); + this.pictureBox2.Size = new System.Drawing.Size(75, 56); this.pictureBox2.TabIndex = 58; this.pictureBox2.TabStop = false; + this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click); // // pictureBox1 // this.pictureBox1.BackColor = System.Drawing.Color.Transparent; this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.pictureBox1.Image = global::compabetov2.Properties.Resources.cancel1; - this.pictureBox1.Location = new System.Drawing.Point(463, 541); - this.pictureBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.pictureBox1.Location = new System.Drawing.Point(347, 440); + this.pictureBox1.Margin = new System.Windows.Forms.Padding(2); this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.Size = new System.Drawing.Size(100, 69); + this.pictureBox1.Size = new System.Drawing.Size(75, 56); this.pictureBox1.TabIndex = 57; this.pictureBox1.TabStop = false; + this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); // // txtPrecioCompra // this.txtPrecioCompra.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtPrecioCompra.Location = new System.Drawing.Point(255, 488); - this.txtPrecioCompra.Margin = new System.Windows.Forms.Padding(4); + this.txtPrecioCompra.Location = new System.Drawing.Point(191, 396); this.txtPrecioCompra.Name = "txtPrecioCompra"; - this.txtPrecioCompra.Size = new System.Drawing.Size(399, 30); + this.txtPrecioCompra.Size = new System.Drawing.Size(300, 26); this.txtPrecioCompra.TabIndex = 55; // // label4 @@ -84,10 +85,9 @@ this.label4.BackColor = System.Drawing.Color.Transparent; this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label4.ForeColor = System.Drawing.Color.Transparent; - this.label4.Location = new System.Drawing.Point(249, 456); - this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label4.Location = new System.Drawing.Point(187, 370); this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(181, 29); + this.label4.Size = new System.Drawing.Size(141, 24); this.label4.TabIndex = 56; this.label4.Text = "Precio Compra:"; // @@ -95,13 +95,14 @@ // this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.button1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText; - this.button1.Location = new System.Drawing.Point(255, 394); - this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); + this.button1.Location = new System.Drawing.Point(191, 320); + this.button1.Margin = new System.Windows.Forms.Padding(2); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(103, 46); + this.button1.Size = new System.Drawing.Size(77, 37); this.button1.TabIndex = 54; this.button1.Text = "Subir"; this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); // // lbImg // @@ -109,20 +110,18 @@ this.lbImg.BackColor = System.Drawing.Color.Transparent; this.lbImg.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbImg.ForeColor = System.Drawing.Color.Transparent; - this.lbImg.Location = new System.Drawing.Point(364, 400); - this.lbImg.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.lbImg.Location = new System.Drawing.Point(273, 325); this.lbImg.Name = "lbImg"; - this.lbImg.Size = new System.Drawing.Size(99, 29); + this.lbImg.Size = new System.Drawing.Size(78, 24); this.lbImg.TabIndex = 53; this.lbImg.Text = "Imagen:"; // // txtCantidad // this.txtCantidad.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtCantidad.Location = new System.Drawing.Point(255, 338); - this.txtCantidad.Margin = new System.Windows.Forms.Padding(4); + this.txtCantidad.Location = new System.Drawing.Point(191, 275); this.txtCantidad.Name = "txtCantidad"; - this.txtCantidad.Size = new System.Drawing.Size(399, 30); + this.txtCantidad.Size = new System.Drawing.Size(300, 26); this.txtCantidad.TabIndex = 51; // // label3 @@ -131,42 +130,19 @@ this.label3.BackColor = System.Drawing.Color.Transparent; this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label3.ForeColor = System.Drawing.Color.Transparent; - this.label3.Location = new System.Drawing.Point(249, 295); - this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label3.Location = new System.Drawing.Point(187, 240); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(115, 29); + this.label3.Size = new System.Drawing.Size(92, 24); this.label3.TabIndex = 52; - this.label3.Text = "Cantidad:"; - // - // txtPrecio - // - this.txtPrecio.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtPrecio.Location = new System.Drawing.Point(255, 253); - this.txtPrecio.Margin = new System.Windows.Forms.Padding(4); - this.txtPrecio.Name = "txtPrecio"; - this.txtPrecio.Size = new System.Drawing.Size(399, 30); - this.txtPrecio.TabIndex = 49; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.BackColor = System.Drawing.Color.Transparent; - this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label2.ForeColor = System.Drawing.Color.Transparent; - this.label2.Location = new System.Drawing.Point(249, 210); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(89, 29); - this.label2.TabIndex = 50; - this.label2.Text = "Precio:"; + this.label3.Text = "Volumen:"; + this.label3.Click += new System.EventHandler(this.label3_Click); // // txtNombre // this.txtNombre.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtNombre.Location = new System.Drawing.Point(255, 163); - this.txtNombre.Margin = new System.Windows.Forms.Padding(4); + this.txtNombre.Location = new System.Drawing.Point(191, 132); this.txtNombre.Name = "txtNombre"; - this.txtNombre.Size = new System.Drawing.Size(399, 30); + this.txtNombre.Size = new System.Drawing.Size(300, 26); this.txtNombre.TabIndex = 47; // // label1 @@ -175,10 +151,9 @@ this.label1.BackColor = System.Drawing.Color.Transparent; this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label1.ForeColor = System.Drawing.Color.Transparent; - this.label1.Location = new System.Drawing.Point(249, 122); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Location = new System.Drawing.Point(187, 99); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(107, 29); + this.label1.Size = new System.Drawing.Size(84, 24); this.label1.TabIndex = 48; this.label1.Text = "Nombre:"; // @@ -188,21 +163,40 @@ this.label5.BackColor = System.Drawing.Color.Transparent; this.label5.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.label5.ForeColor = System.Drawing.Color.Transparent; - this.label5.Location = new System.Drawing.Point(13, 9); - this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label5.Location = new System.Drawing.Point(10, 7); this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(170, 29); + this.label5.Size = new System.Drawing.Size(132, 24); this.label5.TabIndex = 59; this.label5.Text = "Editar Variante"; // + // label2 + // + this.label2.AutoSize = true; + this.label2.BackColor = System.Drawing.Color.Transparent; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.ForeColor = System.Drawing.Color.Transparent; + this.label2.Location = new System.Drawing.Point(187, 171); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(69, 24); + this.label2.TabIndex = 50; + this.label2.Text = "Precio:"; + // + // txtPrecio + // + this.txtPrecio.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txtPrecio.Location = new System.Drawing.Point(191, 206); + this.txtPrecio.Name = "txtPrecio"; + this.txtPrecio.Size = new System.Drawing.Size(300, 26); + this.txtPrecio.TabIndex = 49; + // // editarvariante // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(27)))), ((int)(((byte)(104)))), ((int)(((byte)(255))))); this.BackgroundImage = global::compabetov2.Properties.Resources.Form; this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.ClientSize = new System.Drawing.Size(897, 622); + this.ClientSize = new System.Drawing.Size(673, 505); this.ControlBox = false; this.Controls.Add(this.label5); this.Controls.Add(this.pictureBox2); @@ -219,6 +213,7 @@ this.Controls.Add(this.label1); this.DoubleBuffered = true; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Margin = new System.Windows.Forms.Padding(2); this.Name = "editarvariante"; this.Load += new System.EventHandler(this.editarvariante_Load); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); @@ -238,10 +233,10 @@ private System.Windows.Forms.Label lbImg; private System.Windows.Forms.TextBox txtCantidad; private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox txtPrecio; - private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox txtNombre; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label5; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.TextBox txtPrecio; } } \ No newline at end of file diff --git a/admin/editarvariante.cs b/admin/editarvariante.cs index 970b6e1..7137bba 100644 --- a/admin/editarvariante.cs +++ b/admin/editarvariante.cs @@ -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.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -12,14 +15,114 @@ namespace compabetov2.admin { public partial class editarvariante : Form { - public editarvariante() + private Variante variante; + private Variantes ventanaPadre; + private string imagePath; + public editarvariante(Variante variante, Variantes ventanaPadre) { InitializeComponent(); + this.variante = variante; + this.ventanaPadre = ventanaPadre; + llenarCampos(); + } + + private void llenarCampos() + { + txtNombre.Text = variante.nombre; + txtCantidad.Text = variante.cantidad.ToString(); + txtPrecio.Text = variante.precio.ToString(); + txtPrecioCompra.Text = variante.precioCompra.ToString(); + lbImg.Text = "Imagen: " + variante.img.ToString(); + imagePath = variante.img; } private void editarvariante_Load(object sender, EventArgs e) { } + + private void button1_Click(object sender, EventArgs e) + { + OpenFileDialog openFileDialog1 = new OpenFileDialog(); + + openFileDialog1.Filter = "Archivos de imagen (*.jpg, *.jpeg, *.png, *.bmp)|*.jpg;*.jpeg;*.png;*.bmp"; + openFileDialog1.Title = "Seleccionar imagen"; + + if (openFileDialog1.ShowDialog() == DialogResult.OK) + { + imagePath = openFileDialog1.FileName; + lbImg.Text = $"Imagen: {Path.GetFileName(imagePath)}"; + } + } + + private void pictureBox1_Click(object sender, EventArgs e) + { + Close(); + } + + private static bool isInt(string cadena) + { + try + { + int.Parse(cadena); + return true; + } + catch + { + MessageBox.Show("Por favor introduzca un precio valido", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + return false; + } + } + + private static bool isDecimal(string cadena) + { + try + { + Decimal.Parse(cadena); + return true; + } + catch + { + MessageBox.Show("Por favor introduzca un precio valido", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + + return false; + } + } + + private void pictureBox2_Click(object sender, EventArgs e) + { + if (isInt(txtCantidad.Text) && isDecimal(txtPrecio.Text) && isDecimal(txtPrecioCompra.Text)) + { + Variante NuevaVariante = new Variante( + variante.idVariante, + txtNombre.Text, + Decimal.Parse(txtPrecio.Text), + int.Parse(txtCantidad.Text), + imagePath, + variante.fkProducto, + Decimal.Parse(txtPrecioCompra.Text) + ); + + if (service.editarVariante(NuevaVariante)) + { + if (!NuevaVariante.img.Equals(variante.img)) + { + string destinationFolder = Path.Combine(Application.StartupPath, "Resources"); + string destinationFile = Path.Combine(destinationFolder, Path.GetFileName(imagePath)); + File.Copy(imagePath, destinationFile, true); + } + Close(); + ventanaPadre.llenarLayout(); + //borrar imagen + // + + } + } + } + + private void label3_Click(object sender, EventArgs e) + { + + } } } diff --git a/bin/Debug/Resources/retrato.jpeg b/bin/Debug/Resources/retrato.jpeg new file mode 100644 index 0000000..8952ec7 Binary files /dev/null and b/bin/Debug/Resources/retrato.jpeg differ diff --git a/bin/Debug/compabetov2.exe b/bin/Debug/compabetov2.exe index aa150c0..df682ce 100644 Binary files a/bin/Debug/compabetov2.exe and b/bin/Debug/compabetov2.exe differ diff --git a/bin/Debug/compabetov2.pdb b/bin/Debug/compabetov2.pdb index 50ddfd5..ac9dacc 100644 Binary files a/bin/Debug/compabetov2.pdb and b/bin/Debug/compabetov2.pdb differ diff --git a/bin/Debug/data.db b/bin/Debug/data.db index 13f9ed8..acf9349 100644 Binary files a/bin/Debug/data.db and b/bin/Debug/data.db differ diff --git a/bin/Debug/produtos_img/retrato.jpeg b/bin/Debug/produtos_img/retrato.jpeg new file mode 100644 index 0000000..8952ec7 Binary files /dev/null and b/bin/Debug/produtos_img/retrato.jpeg differ diff --git a/compabetov2.csproj b/compabetov2.csproj index 5fad195..b67e6c0 100644 --- a/compabetov2.csproj +++ b/compabetov2.csproj @@ -273,6 +273,12 @@ + + Form + + + RegistroVentas.cs + Form @@ -395,6 +401,9 @@ Resources.resx True + + RegistroVentas.cs + datosCuenta.cs diff --git a/database/DAO.cs b/database/DAO.cs index 09ce953..b949225 100644 --- a/database/DAO.cs +++ b/database/DAO.cs @@ -872,8 +872,9 @@ namespace compabetov2.database } } - public static bool devolverImporteDAO(List importes) + public static bool devolverImporteDAO(VentaModel venta, List importes) { + var db_conexion = new Conexion(); try { @@ -885,7 +886,28 @@ namespace compabetov2.database { 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 foreach (DetalleImporte importe in importes) { @@ -895,7 +917,7 @@ namespace compabetov2.database commandDetalleImporte.Parameters.AddWithValue("@fk_importe", importe.fkImporte); commandDetalleImporte.Parameters.AddWithValue("@cantidad", importe.cantidad); commandDetalleImporte.Parameters.AddWithValue("@precio", importe.precioImporte); - commandDetalleImporte.Parameters.AddWithValue("@fecha", DateTime.Now.ToString()); + commandDetalleImporte.Parameters.AddWithValue("@fk_venta", idVenta); commandDetalleImporte.ExecuteNonQuery(); } } @@ -1862,6 +1884,37 @@ namespace compabetov2.database } } + public static bool editarVarianteDAO(Variante variante) + { + var db_conexion = new Conexion(); + try + { + SQLiteConnection conexion = db_conexion.get_connection(); + conexion.Open(); + + string sql = "UPDATE variantes SET nombre = @nombre, precio = @precio, cantidad = @cantidad, img = @img, " + + "fk_producto = @fk_producto, precioCompra = @precioCompra WHERE idVariante = @idVariante; "; + + + SQLiteCommand command = new SQLiteCommand(sql, conexion); + command.Parameters.AddWithValue("@nombre", variante.nombre); + command.Parameters.AddWithValue("@precio", variante.precio); + command.Parameters.AddWithValue("@cantidad", variante.cantidad); + command.Parameters.AddWithValue("@img", variante.img); + command.Parameters.AddWithValue("@fk_producto", variante.fkProducto); + command.Parameters.AddWithValue("@precioCompra", variante.precioCompra); + command.Parameters.AddWithValue("@idVariante", variante.idVariante); + command.ExecuteNonQuery(); + + return true; + } + catch (SQLiteException ex) + { + MessageBox.Show(ex.Message); + return false; + } + } + public static SQLiteDataReader conseguirImportesDAO() { SQLiteDataReader reader = null; @@ -1886,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() { var db_conexion = new Conexion(); diff --git a/database/service.cs b/database/service.cs index 2b38dd0..ea51aaa 100644 --- a/database/service.cs +++ b/database/service.cs @@ -209,9 +209,9 @@ namespace compabetov2.database return DAO.crearVentaDAO(venta, detalleVentas,importes); } - public static bool devolverImporte(List importes) + public static bool devolverImporte(VentaModel venta,List importes) { - return DAO.devolverImporteDAO(importes); + return DAO.devolverImporteDAO(venta,importes); } public static bool insertarMerma(Merma merma) @@ -427,60 +427,72 @@ namespace compabetov2.database return DAO.concluirEnvioDAO(envio, detallesEnvio, importes); } - public static Dictionary>> estadisticas(DateTime fecha) + public static Dictionary>> estadisticas(DateTime fecha) { Dictionary>> resumen = new Dictionary>>(); List> listMes = new List>(); List> listDia = new List>(); + SQLiteDataReader readerVentas = DAO.conseguirVentasMesDAO(fecha); string formato = "dd/MM/yyyy"; while (readerVentas.Read()) { - Dictionary dicVenta = new Dictionary(); - + Dictionary dicVenta = new Dictionary(); VentaModel venta = new VentaModel( - readerVentas.GetDecimal(2), - (int)readerVentas.GetInt64(0), - readerVentas.GetString(1), - readerVentas.GetString(3) - ); + readerVentas.GetDecimal(2),//total + (int)readerVentas.GetInt64(0),//id + readerVentas.GetString(1),//fecha + readerVentas.GetString(3)//responzable + ); List detallesVenta = new List(); SQLiteDataReader readerDetalleVenta = DAO.conseguirDetalleVenta(venta); while (readerDetalleVenta.Read()) { - decimal precioCompra = readerDetalleVenta.GetOrdinal("precioCompra"); + decimal precioCompra = readerDetalleVenta.GetDecimal(3); DetalleVentaModel detalleVenta = new DetalleVentaModel( - (int)readerDetalleVenta.GetInt64(2), - new Variante((int)readerDetalleVenta.GetInt64(3), - readerDetalleVenta["nombre"].ToString(), - readerDetalleVenta.GetDecimal(5), - (int)readerDetalleVenta.GetInt64(6), - "", - (int)readerDetalleVenta.GetInt64(8), - precioCompra) + (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 ); + detallesVenta.Add(detalleVenta); } - dicVenta.Add("venta", venta); - dicVenta.Add("detalles", detallesVenta as List); + List importes = new List(); + 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 fechaVentaStr = fecha_hora[0]; + dicVenta.Add("venta", venta); + dicVenta.Add("detalles", detallesVenta as List); + dicVenta.Add("importes", importes); + 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); @@ -519,6 +531,30 @@ namespace compabetov2.database return productos; } + public static List conseguirDetallesVenta(VentaModel venta) + { + List detallesVenta = new List(); + SQLiteDataReader readerDetalleVenta = DAO.conseguirDetalleVenta(venta); + while (readerDetalleVenta.Read()) + { + decimal precioCompra = readerDetalleVenta.GetDecimal(3); + Variante variante = 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); + + DetalleVentaModel detalleVenta = new DetalleVentaModel( + (int)readerDetalleVenta.GetInt64(2), + variante + ); + detallesVenta.Add( detalleVenta ); + } + return detallesVenta; + } public static Dictionary> conseguirEnvioMes(DateTime fecha) { @@ -613,6 +649,11 @@ namespace compabetov2.database return DAO.eliminarVarianteDAO(idVariante); } + public static bool editarVariante(Variante variante) + { + return DAO.editarVarianteDAO(variante); + } + public static List conseguirImportes() { List importes = new List(); diff --git a/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/obj/Debug/DesignTimeResolveAssemblyReferences.cache index 1c35a3c..10a1a65 100644 Binary files a/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/obj/Debug/compabetov2.csproj.AssemblyReference.cache b/obj/Debug/compabetov2.csproj.AssemblyReference.cache index 176b530..c5cc70b 100644 Binary files a/obj/Debug/compabetov2.csproj.AssemblyReference.cache and b/obj/Debug/compabetov2.csproj.AssemblyReference.cache differ diff --git a/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache b/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache index 214cb75..5b82059 100644 --- a/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache +++ b/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -a9bc43144c688823697090e74a55f122470d105d2557473669418d9f299656f6 +dc59a92235705ffed340a9d882657e3aec1c9a8bb08508bf171d109e3b7e4937 diff --git a/obj/Debug/compabetov2.csproj.FileListAbsolute.txt b/obj/Debug/compabetov2.csproj.FileListAbsolute.txt index b326809..18057e1 100644 --- a/obj/Debug/compabetov2.csproj.FileListAbsolute.txt +++ b/obj/Debug/compabetov2.csproj.FileListAbsolute.txt @@ -164,3 +164,6 @@ C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.a C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.admin.agregarproducto.resources C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.admin.editarvariante.resources C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.admin.Variantes.resources +C:\Users\carsu\source\repos\compabetoOG\obj\Debug\compabetov2.admin.editarvariante.resources +C:\Users\carsu\source\repos\compabetoOG\obj\Debug\compabetov2.RegistroVentas.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.RegistroVentas.resources diff --git a/obj/Debug/compabetov2.csproj.GenerateResource.cache b/obj/Debug/compabetov2.csproj.GenerateResource.cache index 2421cd8..53217ab 100644 Binary files a/obj/Debug/compabetov2.csproj.GenerateResource.cache and b/obj/Debug/compabetov2.csproj.GenerateResource.cache differ diff --git a/obj/Debug/compabetov2.exe b/obj/Debug/compabetov2.exe index aa150c0..df682ce 100644 Binary files a/obj/Debug/compabetov2.exe and b/obj/Debug/compabetov2.exe differ diff --git a/obj/Debug/compabetov2.pdb b/obj/Debug/compabetov2.pdb index 50ddfd5..ac9dacc 100644 Binary files a/obj/Debug/compabetov2.pdb and b/obj/Debug/compabetov2.pdb differ