diff --git a/.vs/compabetoOG/v17/.wsuo b/.vs/compabetoOG/v17/.wsuo index c31e3f9..d191d6a 100644 Binary files a/.vs/compabetoOG/v17/.wsuo and b/.vs/compabetoOG/v17/.wsuo differ diff --git a/Cuentas/cuentas.cs b/Cuentas/cuentas.cs index 7fc9336..fa4499d 100644 --- a/Cuentas/cuentas.cs +++ b/Cuentas/cuentas.cs @@ -116,11 +116,20 @@ namespace compabetov2 btnVer.Click += new EventHandler(delegate (object sender, EventArgs e) { List detalles = service.conseguirDetalleCuante(cuenta.id); + List importes = service.conseguirImportesCuenta(cuenta.id); string mensaje = $"Cliente: {cuenta.cliente}\n"; foreach (DetalleCuentaModel detalle in detalles) { mensaje += $"{detalle.producto.nombre} - {detalle.cantidad}\n"; } + + decimal totalImporte = 0; + foreach (DetalleImporteCuenta importe in importes) + { + totalImporte += importe.cantidad * importe.precioImporte; + } + mensaje += $"Importe: {totalImporte}\n"; + MessageBox.Show(mensaje); }); @@ -139,7 +148,8 @@ namespace compabetov2 if (result == DialogResult.Yes) { List detalles = service.conseguirDetalleCuante(cuenta.id); - if (service.saldarCuenta(cuenta, detalles)) + List importes = service.conseguirImportesCuenta(cuenta.id); + if (service.saldarCuenta(cuenta, detalles, importes)) { llenarPanel(); } @@ -196,11 +206,18 @@ namespace compabetov2 btnVer.Click += new EventHandler(delegate (object sender, EventArgs e) { List detalles = service.conseguirDetalleCuante(cuenta.id); + List importes = service.conseguirImportesCuenta(cuenta.id); string mensaje = $"Cliente: {cuenta.cliente}\n"; foreach (DetalleCuentaModel detalle in detalles) { mensaje += $"{detalle.producto.nombre} - {detalle.cantidad}\n"; } + decimal totalImporte = 0; + foreach (DetalleImporteCuenta importe in importes) + { + totalImporte += importe.cantidad * importe.precioImporte; + } + mensaje += $"Importe: {totalImporte}\n"; MessageBox.Show(mensaje); }); diff --git a/Envios/envios.cs b/Envios/envios.cs index 4136381..257c038 100644 --- a/Envios/envios.cs +++ b/Envios/envios.cs @@ -68,9 +68,10 @@ namespace compabetov2 private void llenarPanel() { panelEnvio.Controls.Clear(); - List envios = service.conseguirEnvio(); - foreach(Envio envio in envios) + List> envios_importes_list = service.conseguirEnvio(); + foreach(Dictionary envio_importes in envios_importes_list) { + Envio envio = envio_importes["envio"]; if (envio.estado.Equals("EN PROCESO")) { TableLayoutPanel carta = new TableLayoutPanel(); @@ -133,11 +134,20 @@ namespace compabetov2 { List detalles = service.conseguirDetalleEnvio(envio.id); string mensaje = ""; + decimal cantidadImportes = 0; foreach (DetalleEnvioModel detalle in detalles) { mensaje += $"{detalle.producto.nombre} - {detalle.cantidad}\n"; + + foreach(DetalleImporteEnvio importe in envio_importes["importes"]) + { + cantidadImportes = importe.cantidad * importe.precioImporte; + } + } + mensaje += $"Importe: {cantidadImportes}\n"; mensaje += $"Total: {envio.total}"; + MessageBox.Show(mensaje); }); @@ -156,7 +166,7 @@ namespace compabetov2 if (result == DialogResult.Yes) { List detalles = service.conseguirDetalleEnvio(envio.id); - if (service.concluirEnvio(envio, detalles)) + if (service.concluirEnvio(envio, detalles, envio_importes["importes"])) { llenarPanel(); ImprimirTicketConcluido(envio); diff --git a/Merma/agregarmermas.Designer.cs b/Merma/agregarmermas.Designer.cs index 65f8acc..c11d9e1 100644 --- a/Merma/agregarmermas.Designer.cs +++ b/Merma/agregarmermas.Designer.cs @@ -165,6 +165,7 @@ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Name = "agregarmermas"; + this.Load += new System.EventHandler(this.agregarmermas_Load); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); diff --git a/Merma/agregarmermas.cs b/Merma/agregarmermas.cs index 8476c67..a0345a8 100644 --- a/Merma/agregarmermas.cs +++ b/Merma/agregarmermas.cs @@ -66,5 +66,10 @@ namespace compabetov2 { this.Close (); } + + private void agregarmermas_Load(object sender, EventArgs e) + { + + } } } diff --git a/Ventas/Importe1.Designer.cs b/Ventas/Importe1.Designer.cs index f537f23..03600f2 100644 --- a/Ventas/Importe1.Designer.cs +++ b/Ventas/Importe1.Designer.cs @@ -29,37 +29,66 @@ private void InitializeComponent() { this.panelImporte = new System.Windows.Forms.FlowLayoutPanel(); - this.btnAceptar = new System.Windows.Forms.Button(); + this.pictureBox2 = new System.Windows.Forms.PictureBox(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // // panelImporte // - this.panelImporte.Location = new System.Drawing.Point(55, 22); + this.panelImporte.BackColor = System.Drawing.Color.Transparent; + this.panelImporte.Location = new System.Drawing.Point(132, 182); + this.panelImporte.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panelImporte.Name = "panelImporte"; - this.panelImporte.Size = new System.Drawing.Size(677, 364); + this.panelImporte.Size = new System.Drawing.Size(903, 448); this.panelImporte.TabIndex = 1; + this.panelImporte.Paint += new System.Windows.Forms.PaintEventHandler(this.panelImporte_Paint); // - // btnAceptar + // pictureBox2 // - this.btnAceptar.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnAceptar.Location = new System.Drawing.Point(338, 382); - this.btnAceptar.Name = "btnAceptar"; - this.btnAceptar.Size = new System.Drawing.Size(105, 46); - this.btnAceptar.TabIndex = 2; - this.btnAceptar.Text = "Aceptar"; - this.btnAceptar.UseVisualStyleBackColor = true; - this.btnAceptar.Click += new System.EventHandler(this.btnAceptar_Click); + 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(456, 679); + this.pictureBox2.Name = "pictureBox2"; + this.pictureBox2.Size = new System.Drawing.Size(100, 69); + this.pictureBox2.TabIndex = 22; + this.pictureBox2.TabStop = false; + this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click_1); + // + // 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(582, 679); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(100, 69); + this.pictureBox1.TabIndex = 21; + this.pictureBox1.TabStop = false; + this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); // // Importe1 // - 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(800, 450); - this.Controls.Add(this.btnAceptar); + 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(1151, 825); + this.ControlBox = false; + this.Controls.Add(this.pictureBox2); + this.Controls.Add(this.pictureBox1); this.Controls.Add(this.panelImporte); + this.DoubleBuffered = true; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "Importe1"; - this.Text = "Importe1"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Load += new System.EventHandler(this.Importe1_Load); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); } @@ -67,6 +96,7 @@ #endregion private System.Windows.Forms.FlowLayoutPanel panelImporte; - private System.Windows.Forms.Button btnAceptar; + private System.Windows.Forms.PictureBox pictureBox2; + private System.Windows.Forms.PictureBox pictureBox1; } } \ No newline at end of file diff --git a/Ventas/Importe1.cs b/Ventas/Importe1.cs index b4ef03d..83955ef 100644 --- a/Ventas/Importe1.cs +++ b/Ventas/Importe1.cs @@ -156,7 +156,7 @@ namespace compabetov2.Ventas private void modificarCantidad(int cantidad, int idImporte) { - detalles[idImporte-1].catidad = cantidad; + detalles[idImporte-1].cantidad = cantidad; } private void Importe1_Load(object sender, EventArgs e) @@ -170,5 +170,29 @@ namespace compabetov2.Ventas ventanaPadre.actualizarImporteTotal(); this.Close(); } + + private void pictureBox1_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void pictureBox2_Click(object sender, EventArgs e) + { + ventanaPadre.importes = detalles; + ventanaPadre.actualizarImporteTotal(); + this.Close(); + } + + private void pictureBox2_Click_1(object sender, EventArgs e) + { + ventanaPadre.importes = detalles; + ventanaPadre.actualizarImporteTotal(); + this.Close(); + } + + private void panelImporte_Paint(object sender, PaintEventArgs e) + { + + } } } diff --git a/Ventas/datosCuenta.cs b/Ventas/datosCuenta.cs index 5d4f15c..492f7d4 100644 --- a/Ventas/datosCuenta.cs +++ b/Ventas/datosCuenta.cs @@ -17,12 +17,14 @@ namespace compabetov2.Ventas private Cuenta ventaModel; private List detalles; private vender ventanaPadre; - public datosCuenta(Cuenta ventaModel, List detalles, vender ventanaPadre) + private List importes; + public datosCuenta(Cuenta ventaModel, List detalles, List importes, vender ventanaPadre) { InitializeComponent(); this.ventaModel = ventaModel; this.detalles = detalles; this.ventanaPadre = ventanaPadre; + this.importes = importes; } private void datosCuenta_Load(object sender, EventArgs e) @@ -33,12 +35,13 @@ namespace compabetov2.Ventas private void btnAceptar_Click(object sender, EventArgs e) { ventaModel.cliente = txtCliente.Text; - if (service.crearCuenta(ventaModel, detalles)) + if (service.crearCuenta(ventaModel, detalles, importes)) { MessageBox.Show("Fiado"); ventanaPadre.eliminarProductosTocket(); ventanaPadre.llenarLayout(); ventanaPadre.total = 0; + ventanaPadre.importes.Clear(); Close(); } } diff --git a/Ventas/datosEnvio.cs b/Ventas/datosEnvio.cs index 1a6b758..f3d953f 100644 --- a/Ventas/datosEnvio.cs +++ b/Ventas/datosEnvio.cs @@ -21,13 +21,15 @@ namespace compabetov2.Ventas public string Telefono => txtTelefono.Text; private Envio envio; List detallesEnvio; + List importes; vender ventanaPadre; - public datosEnvio(Envio envio, List detallesEnvio, vender ventanaPadre) + public datosEnvio(Envio envio, List detallesEnvio, List importes, vender ventanaPadre) { InitializeComponent(); this.envio = envio; this.detallesEnvio = detallesEnvio; this.ventanaPadre = ventanaPadre; + this.importes = importes; txtTelefono.KeyPress += new KeyPressEventHandler(txtTelefono_KeyPress); } @@ -38,14 +40,15 @@ namespace compabetov2.Ventas envio.cliente = txtCliente.Text; envio.direccion = txtDireccion.Text; envio.telefono = txtTelefono.Text; - if (service.crearEnvio(envio, detallesEnvio)) + + if (service.crearEnvio(envio, detallesEnvio, importes)) { MessageBox.Show("Envio hecho"); ImprimirTicketEnvio(); ventanaPadre.eliminarProductosTocket(); ventanaPadre.llenarLayout(); ventanaPadre.total = 0; - + ventanaPadre.importes.Clear(); this.Close(); } } @@ -197,7 +200,7 @@ namespace compabetov2.Ventas envio.cliente = txtCliente.Text; envio.direccion = txtDireccion.Text; envio.telefono = txtTelefono.Text; - if (service.crearEnvio(envio, detallesEnvio)) + if (service.crearEnvio(envio, detallesEnvio, importes)) { MessageBox.Show("Envio hecho"); ImprimirTicketEnvio(); diff --git a/Ventas/vender.Designer.cs b/Ventas/vender.Designer.cs index 1de6210..76297f3 100644 --- a/Ventas/vender.Designer.cs +++ b/Ventas/vender.Designer.cs @@ -70,10 +70,9 @@ 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(464, 104); - this.lblfecha.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.lblfecha.Location = new System.Drawing.Point(619, 128); this.lblfecha.Name = "lblfecha"; - this.lblfecha.Size = new System.Drawing.Size(126, 46); + this.lblfecha.Size = new System.Drawing.Size(159, 58); this.lblfecha.TabIndex = 13; this.lblfecha.Text = "label2"; this.lblfecha.TextAlign = System.Drawing.ContentAlignment.TopCenter; @@ -84,10 +83,9 @@ 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(605, 7); - this.lblhora.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.lblhora.Location = new System.Drawing.Point(807, 9); this.lblhora.Name = "lblhora"; - this.lblhora.Size = new System.Drawing.Size(249, 91); + this.lblhora.Size = new System.Drawing.Size(318, 113); this.lblhora.TabIndex = 12; this.lblhora.Text = "label1"; this.lblhora.Click += new System.EventHandler(this.lblhora_Click); @@ -98,10 +96,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(1204, -1); - this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(2); + this.flowLayoutPanel2.Location = new System.Drawing.Point(1605, -1); + this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.flowLayoutPanel2.Name = "flowLayoutPanel2"; - this.flowLayoutPanel2.Size = new System.Drawing.Size(243, 968); + this.flowLayoutPanel2.Size = new System.Drawing.Size(324, 1191); this.flowLayoutPanel2.TabIndex = 11; this.flowLayoutPanel2.Paint += new System.Windows.Forms.PaintEventHandler(this.flowLayoutPanel2_Paint); // @@ -109,17 +107,17 @@ // this.panel1.BackColor = System.Drawing.Color.Transparent; this.panel1.Controls.Add(this.pictureBox9); - this.panel1.Location = new System.Drawing.Point(2, 2); - this.panel1.Margin = new System.Windows.Forms.Padding(2); + this.panel1.Location = new System.Drawing.Point(3, 2); + this.panel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(234, 214); + this.panel1.Size = new System.Drawing.Size(312, 263); this.panel1.TabIndex = 8; // // pictureBox9 // this.pictureBox9.Image = global::compabetov2.Properties.Resources.HomeroMenu; - this.pictureBox9.Location = new System.Drawing.Point(48, 28); - this.pictureBox9.Margin = new System.Windows.Forms.Padding(2); + this.pictureBox9.Location = new System.Drawing.Point(64, 34); + this.pictureBox9.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pictureBox9.Name = "pictureBox9"; this.pictureBox9.Size = new System.Drawing.Size(190, 197); this.pictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -132,10 +130,9 @@ 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(2, 218); - this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.label1.Location = new System.Drawing.Point(3, 267); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(66, 25); + this.label1.Size = new System.Drawing.Size(102, 39); this.label1.TabIndex = 17; this.label1.Text = "Total:"; this.label1.Click += new System.EventHandler(this.label1_Click); @@ -146,10 +143,9 @@ 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(71, 174); - this.labeltotal.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); + this.labeltotal.Location = new System.Drawing.Point(111, 267); this.labeltotal.Name = "labeltotal"; - this.labeltotal.Size = new System.Drawing.Size(0, 31); + this.labeltotal.Size = new System.Drawing.Size(0, 39); this.labeltotal.TabIndex = 18; // // flowLayoutPanel1 @@ -161,26 +157,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(2); + this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(243, 974); + this.flowLayoutPanel1.Size = new System.Drawing.Size(324, 1199); 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(2, 2); - this.panel2.Margin = new System.Windows.Forms.Padding(2); + this.panel2.Location = new System.Drawing.Point(3, 2); + this.panel2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(234, 214); + this.panel2.Size = new System.Drawing.Size(312, 263); this.panel2.TabIndex = 8; // // pictureBox7 // this.pictureBox7.Image = global::compabetov2.Properties.Resources.HomeroMenu; - this.pictureBox7.Location = new System.Drawing.Point(48, 28); - this.pictureBox7.Margin = new System.Windows.Forms.Padding(2); + this.pictureBox7.Location = new System.Drawing.Point(64, 34); + this.pictureBox7.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pictureBox7.Name = "pictureBox7"; this.pictureBox7.Size = new System.Drawing.Size(190, 197); this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; @@ -196,11 +192,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(2, 220); - this.button1.Margin = new System.Windows.Forms.Padding(2); + this.button1.Location = new System.Drawing.Point(3, 269); + this.button1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button1.Name = "button1"; - this.button1.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); - this.button1.Size = new System.Drawing.Size(234, 93); + this.button1.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0); + this.button1.Size = new System.Drawing.Size(312, 114); this.button1.TabIndex = 8; this.button1.Text = "Menú"; this.button1.UseVisualStyleBackColor = false; @@ -215,11 +211,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(2, 317); - this.button2.Margin = new System.Windows.Forms.Padding(2); + this.button2.Location = new System.Drawing.Point(3, 387); + this.button2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button2.Name = "button2"; - this.button2.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); - this.button2.Size = new System.Drawing.Size(234, 93); + this.button2.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0); + this.button2.Size = new System.Drawing.Size(312, 114); this.button2.TabIndex = 9; this.button2.Text = "Reportes"; this.button2.UseVisualStyleBackColor = false; @@ -234,11 +230,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(2, 414); - this.button3.Margin = new System.Windows.Forms.Padding(2); + this.button3.Location = new System.Drawing.Point(3, 505); + this.button3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button3.Name = "button3"; - this.button3.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); - this.button3.Size = new System.Drawing.Size(234, 93); + this.button3.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0); + this.button3.Size = new System.Drawing.Size(312, 114); this.button3.TabIndex = 10; this.button3.Text = "Productos"; this.button3.UseVisualStyleBackColor = false; @@ -252,11 +248,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(2, 511); - this.button5.Margin = new System.Windows.Forms.Padding(2); + this.button5.Location = new System.Drawing.Point(3, 623); + this.button5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.button5.Name = "button5"; - this.button5.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); - this.button5.Size = new System.Drawing.Size(234, 93); + this.button5.Padding = new System.Windows.Forms.Padding(51, 0, 0, 0); + this.button5.Size = new System.Drawing.Size(312, 114); this.button5.TabIndex = 12; this.button5.Text = "Salir"; this.button5.UseVisualStyleBackColor = false; @@ -264,20 +260,20 @@ // flowLayoutPanel3 // this.flowLayoutPanel3.AutoScroll = true; - this.flowLayoutPanel3.Location = new System.Drawing.Point(247, 279); - this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(2); + this.flowLayoutPanel3.Location = new System.Drawing.Point(329, 343); + this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.flowLayoutPanel3.Name = "flowLayoutPanel3"; - this.flowLayoutPanel3.Size = new System.Drawing.Size(955, 593); + this.flowLayoutPanel3.Size = new System.Drawing.Size(1273, 730); 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(247, 178); - this.txtbusqueda.Margin = new System.Windows.Forms.Padding(2); + this.txtbusqueda.Location = new System.Drawing.Point(329, 219); + this.txtbusqueda.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.txtbusqueda.Name = "txtbusqueda"; - this.txtbusqueda.Size = new System.Drawing.Size(528, 30); + this.txtbusqueda.Size = new System.Drawing.Size(703, 36); this.txtbusqueda.TabIndex = 15; this.txtbusqueda.TextChanged += new System.EventHandler(this.txtbusqueda_TextChanged); // @@ -287,10 +283,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(791, 171); - this.bntImprimir.Margin = new System.Windows.Forms.Padding(2); + this.bntImprimir.Location = new System.Drawing.Point(1055, 210); + this.bntImprimir.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.bntImprimir.Name = "bntImprimir"; - this.bntImprimir.Size = new System.Drawing.Size(113, 44); + this.bntImprimir.Size = new System.Drawing.Size(151, 54); this.bntImprimir.TabIndex = 17; this.bntImprimir.Text = "Vender"; this.bntImprimir.UseVisualStyleBackColor = false; @@ -300,10 +296,10 @@ // this.responsablecb.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.responsablecb.FormattingEnabled = true; - this.responsablecb.Location = new System.Drawing.Point(1028, 177); - this.responsablecb.Margin = new System.Windows.Forms.Padding(2); + this.responsablecb.Location = new System.Drawing.Point(1371, 218); + this.responsablecb.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.responsablecb.Name = "responsablecb"; - this.responsablecb.Size = new System.Drawing.Size(171, 33); + this.responsablecb.Size = new System.Drawing.Size(227, 37); this.responsablecb.TabIndex = 18; this.responsablecb.SelectedIndexChanged += new System.EventHandler(this.responsablecb_SelectedIndexChanged); // @@ -313,9 +309,10 @@ 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(910, 171); + this.btnFiar.Location = new System.Drawing.Point(1213, 210); + this.btnFiar.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnFiar.Name = "btnFiar"; - this.btnFiar.Size = new System.Drawing.Size(113, 44); + this.btnFiar.Size = new System.Drawing.Size(151, 54); this.btnFiar.TabIndex = 19; this.btnFiar.Text = "Cuenta"; this.btnFiar.UseVisualStyleBackColor = false; @@ -327,10 +324,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(852, 219); - this.btnEnviar.Margin = new System.Windows.Forms.Padding(2); + this.btnEnviar.Location = new System.Drawing.Point(1213, 273); + this.btnEnviar.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnEnviar.Name = "btnEnviar"; - this.btnEnviar.Size = new System.Drawing.Size(113, 44); + this.btnEnviar.Size = new System.Drawing.Size(151, 54); this.btnEnviar.TabIndex = 20; this.btnEnviar.Text = "Enviar"; this.btnEnviar.UseVisualStyleBackColor = false; @@ -341,10 +338,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(735, 222); - this.btnImporte.Margin = new System.Windows.Forms.Padding(2); + this.btnImporte.Location = new System.Drawing.Point(1056, 273); + this.btnImporte.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.btnImporte.Name = "btnImporte"; - this.btnImporte.Size = new System.Drawing.Size(113, 44); + this.btnImporte.Size = new System.Drawing.Size(151, 54); this.btnImporte.TabIndex = 21; this.btnImporte.Text = "Importe"; this.btnImporte.UseVisualStyleBackColor = false; @@ -352,9 +349,9 @@ // // vender // - 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(1325, 627); + this.ClientSize = new System.Drawing.Size(1767, 772); this.ControlBox = false; this.Controls.Add(this.btnImporte); this.Controls.Add(this.btnEnviar); @@ -367,7 +364,7 @@ this.Controls.Add(this.lblhora); this.Controls.Add(this.flowLayoutPanel2); this.Controls.Add(this.flowLayoutPanel1); - this.Margin = new System.Windows.Forms.Padding(2); + this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 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 490cab5..1c9e130 100644 --- a/Ventas/vender.cs +++ b/Ventas/vender.cs @@ -777,7 +777,7 @@ namespace compabetov2 { Cuenta ventaModel = new Cuenta(total); - datosCuenta datoCuenta = new datosCuenta(ventaModel, detallesCuenta, this); + datosCuenta datoCuenta = new datosCuenta(ventaModel, detallesCuenta,importes, this); datoCuenta.Show(); } @@ -837,7 +837,7 @@ namespace compabetov2 Envio envio = new Envio(-1, DateTime.Now.ToString(), "", "", responsable, "", "", total); if (detallesEnvio.Count > 0) { - datosEnvio datosEnvio = new datosEnvio(envio, detallesEnvio, this); + datosEnvio datosEnvio = new datosEnvio(envio, detallesEnvio,importes ,this); datosEnvio.Show(); } else @@ -879,7 +879,7 @@ namespace compabetov2 decimal totalImporte = 0; foreach(DetalleImporte importe in importes) { - totalImporte += importe.precioImporte * importe.catidad; + totalImporte += importe.precioImporte * importe.cantidad; } total += totalImporte; label1.Text = $"Total: ${total}"; diff --git a/bin/Debug/compabetov2.exe b/bin/Debug/compabetov2.exe index 7fbf413..9c7e5e7 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 6495c12..98ad5f7 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 c782e82..caef42a 100644 Binary files a/bin/Debug/data.db and b/bin/Debug/data.db differ diff --git a/compabetov2.csproj b/compabetov2.csproj index 3fd4e54..191ef8d 100644 --- a/compabetov2.csproj +++ b/compabetov2.csproj @@ -108,6 +108,8 @@ + + diff --git a/database/DAO.cs b/database/DAO.cs index daad4ec..2002fa3 100644 --- a/database/DAO.cs +++ b/database/DAO.cs @@ -440,7 +440,7 @@ namespace compabetov2.database conexion.Open(); - string sql = "SELECT * FROM Producto INNER JOIN Categoria ON Producto.fk_idcategoria = Categoria.idcategoria"; + string sql = "SELECT * FROM Producto"; SQLiteCommand command = new SQLiteCommand(sql, conexion); reader = command.ExecuteReader(); @@ -756,7 +756,7 @@ namespace compabetov2.database string sqlIdVenta = "SELECT idVenta FROM venta ORDER BY idVenta DESC LIMIT 1"; string sqlProductoStock = "SELECT stock FROM Producto WHERE idproducto = @idproducto"; string sqlProductoUpdate = "UPDATE Producto SET stock = @stock WHERE idproducto = @idproducto"; - string sqlImporte = "INSERT INTO detalle_importe (fk_importe,cantidad,precio,fecha) VALUES (@fk_importe,@cantidad,@precio,@fecha)"; + 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); @@ -807,13 +807,13 @@ namespace compabetov2.database //creacion del importe foreach (DetalleImporte importe in importes) { - if (importe.catidad != 0) + if (importe.cantidad != 0) { SQLiteCommand commandDetalleImporte = new SQLiteCommand(sqlImporte, conexion); commandDetalleImporte.Parameters.AddWithValue("@fk_importe", importe.fkImporte); - commandDetalleImporte.Parameters.AddWithValue("@cantidad", importe.catidad); + 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(); } } @@ -854,11 +854,11 @@ namespace compabetov2.database //creacion del importe foreach (DetalleImporte importe in importes) { - if (importe.catidad != 0) + if (importe.cantidad != 0) { SQLiteCommand commandDetalleImporte = new SQLiteCommand(sqlImporte, conexion); commandDetalleImporte.Parameters.AddWithValue("@fk_importe", importe.fkImporte); - commandDetalleImporte.Parameters.AddWithValue("@cantidad", importe.catidad); + commandDetalleImporte.Parameters.AddWithValue("@cantidad", importe.cantidad); commandDetalleImporte.Parameters.AddWithValue("@precio", importe.precioImporte); commandDetalleImporte.Parameters.AddWithValue("@fecha", DateTime.Now.ToString()); commandDetalleImporte.ExecuteNonQuery(); @@ -968,7 +968,7 @@ namespace compabetov2.database } } - public static bool crearCuentaDAO(Cuenta cuenta, List detalleCuentas) + public static bool crearCuentaDAO(Cuenta cuenta, List detalleCuentas, List importes) { var db_conexion = new Conexion(); try @@ -986,6 +986,7 @@ namespace compabetov2.database string sqlIdCuenta = "SELECT idCuenta FROM cuenta ORDER BY idCuenta DESC LIMIT 1"; string sqlProductoStock = "SELECT stock FROM Producto WHERE idproducto = @idproducto"; string sqlProductoUpdate = "UPDATE Producto SET stock = @stock WHERE idproducto = @idproducto"; + string sqlImporte = "INSERT INTO detalle_importe_cuenta (fk_importe, cantidad, precio, fk_cuenta) VALUES(@fk_importe, @cantidad, @precio, @fk_cuenta);"; SQLiteCommand commandCuenta = new SQLiteCommand(sqlCuenta, conexion); commandCuenta.Parameters.AddWithValue("@fecha", DateTime.Now.ToString()); @@ -1029,6 +1030,18 @@ namespace compabetov2.database commandProdcutoUpdate.ExecuteNonQuery(); } + foreach(DetalleImporte importe in importes) + { + if(importe.cantidad != 0) { + SQLiteCommand commandImportes = new SQLiteCommand(sqlImporte, conexion); + commandImportes.Parameters.AddWithValue("@fk_importe", importe.fkImporte); + commandImportes.Parameters.AddWithValue("@cantidad", importe.cantidad); + commandImportes.Parameters.AddWithValue("@precio", importe.precioImporte); + commandImportes.Parameters.AddWithValue("@fk_cuenta", idCuenta); + commandImportes.ExecuteNonQuery(); + } + } + transaccion.Commit(); return true; } @@ -1074,6 +1087,31 @@ namespace compabetov2.database } } + public static SQLiteDataReader conseguirImportesCuentaDAO(int idCuenta) + { + SQLiteDataReader reader = null; + var db_conexion = new Conexion(); + try + { + SQLiteConnection conexion = db_conexion.get_connection(); + + conexion.Open(); + + string sql = "SELECT * FROM detalle_importe_cuenta WHERE fk_cuenta = @fk_cuenta;"; + SQLiteCommand command = new SQLiteCommand(sql, conexion); + command.Parameters.AddWithValue("@fk_cuenta", idCuenta); + reader = command.ExecuteReader(); + + return reader; + + } + catch (SQLiteException ex) + { + MessageBox.Show(ex.Message); + return reader; + } + } + public static bool cancelarCuentaDAO(int idCuenta) { var db_conexion = new Conexion(); @@ -1113,7 +1151,7 @@ namespace compabetov2.database } } - public static bool saldarCuentaDAO(Cuenta cuenta, List detallesCuentas) + public static bool saldarCuentaDAO(Cuenta cuenta, List detallesCuentas, List importes) { var db_conexion = new Conexion(); try @@ -1130,6 +1168,8 @@ namespace compabetov2.database string sqlDetalle = "INSERT INTO detalle_venta (fk_venta, fk_variante, cantidad) VALUES(@idVenta, @fk_variante, @cantidada);"; string sqlCuenta = "UPDATE cuenta SET estado ='SALDADO' WHERE idCuenta = @idCuenta;"; 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)"; + SQLiteCommand commandVenta = new SQLiteCommand(sqlVenta, conexion); @@ -1158,6 +1198,19 @@ namespace compabetov2.database commandEmpleado.ExecuteNonQuery(); } + foreach (DetalleImporteCuenta importe in importes) + { + if (importe.cantidad != 0) + { + SQLiteCommand commandDetalleImporte = new SQLiteCommand(sqlImporte, conexion); + commandDetalleImporte.Parameters.AddWithValue("@fk_importe", importe.fkImporte); + commandDetalleImporte.Parameters.AddWithValue("@cantidad", importe.cantidad); + commandDetalleImporte.Parameters.AddWithValue("@precio", importe.precioImporte); + commandDetalleImporte.Parameters.AddWithValue("@fk_venta", idVenta); + commandDetalleImporte.ExecuteNonQuery(); + } + } + transaccion.Commit(); return true; } @@ -1253,12 +1306,12 @@ namespace compabetov2.database } } - public static bool crearEnvio(Envio envio, List detallesEnvio) + public static bool crearEnvio(Envio envio, List detallesEnvio, List importes) { - return DAO.crearEnvioDAO(envio, detallesEnvio); + return DAO.crearEnvioDAO(envio, detallesEnvio, importes); } - public static bool crearEnvioDAO(Envio envio, List detallesEnvio) + public static bool crearEnvioDAO(Envio envio, List detallesEnvio, List importes) { var db_conexion = new Conexion(); try @@ -1274,6 +1327,7 @@ namespace compabetov2.database string sqlEnvio = "INSERT INTO envios (fecha, direccion, telefono,responzable,total,cliente) VALUES(@fecha,@direccion , @telefono, @responzable, @total,@cliente);"; string sqlDetalle = "INSERT INTO detalle_envios (fk_envios, fk_variante, cantidad) VALUES(@fk_envios, @fk_variante, @cantidad);"; string sqlIdCuenta = "SELECT idEnvios FROM envios ORDER BY idEnvios DESC LIMIT 1"; + string sqlImporte = "INSERT INTO detalle_importe_envio (fk_importe, cantidad, precio, fk_envio) VALUES(@fk_importe, @cantidad, @precio, @fk_envio);"; SQLiteCommand commandCuenta = new SQLiteCommand(sqlEnvio, conexion); commandCuenta.Parameters.AddWithValue("@fecha", envio.fecha); @@ -1302,6 +1356,19 @@ namespace compabetov2.database commandDetalle.ExecuteNonQuery(); } + //creacion de importes + foreach(DetalleImporte importe in importes) + { + if(importe.cantidad != 0) { + SQLiteCommand commandImportes = new SQLiteCommand(sqlImporte, conexion); + commandImportes.Parameters.AddWithValue("@fk_importe", importe.fkImporte); + commandImportes.Parameters.AddWithValue("@cantidad", importe.cantidad); + commandImportes.Parameters.AddWithValue("@precio", importe.precioImporte); + commandImportes.Parameters.AddWithValue("@fk_envio", idEnvio); + commandImportes.ExecuteNonQuery(); + } + } + transaccion.Commit(); return true; } @@ -1345,6 +1412,31 @@ namespace compabetov2.database } } + public static SQLiteDataReader conseguirImporteEnvio(int idEnvio) + { + SQLiteDataReader reader = null; + var db_conexion = new Conexion(); + try + { + SQLiteConnection conexion = db_conexion.get_connection(); + + conexion.Open(); + + string sql = "SELECT * FROM detalle_importe_envio where fk_envio = @idEnvio"; + SQLiteCommand command = new SQLiteCommand(sql, conexion); + command.Parameters.AddWithValue("@idEnvio", idEnvio); + reader = command.ExecuteReader(); + + return reader; + + } + catch (SQLiteException ex) + { + MessageBox.Show(ex.Message); + return reader; + } + } + public static SQLiteDataReader conseguirDetalleEnvioDAO(int idEnvio) { SQLiteDataReader reader = null; @@ -1515,7 +1607,7 @@ namespace compabetov2.database } - public static bool concluirEnvioDAO(Envio envio, List detallesEnvio) + public static bool concluirEnvioDAO(Envio envio, List detallesEnvio, List importes) { var db_conexion = new Conexion(); try @@ -1534,6 +1626,7 @@ namespace compabetov2.database string sqlIdVenta = "SELECT idVenta FROM venta ORDER BY idVenta DESC LIMIT 1"; string sqlStock = "select stock from Producto p where idproducto = @idProducto"; string sqlActualizarStock = "UPDATE Producto set stock = @stock WHERE idproducto = @idProducto"; + string sqlImporte = "INSERT INTO detalle_importe (fk_importe, cantidad, precio, fk_venta) VALUES(@fk_importe, @cantidad, @precio, @fk_venta);"; SQLiteCommand commandVenta = new SQLiteCommand(sqlVenta, conexion); commandVenta.Parameters.AddWithValue("@fecha", DateTime.Now.ToString()); @@ -1572,6 +1665,19 @@ namespace compabetov2.database commandActualizarStock.ExecuteNonQuery(); } + foreach(DetalleImporteEnvio importe in importes) + { + if (importe.cantidad != 0) + { + SQLiteCommand commandImporte = new SQLiteCommand(sqlImporte, conexion); + commandImporte.Parameters.AddWithValue("@fk_importe", importe.fkImporte); + commandImporte.Parameters.AddWithValue("@cantidad", importe.cantidad); + commandImporte.Parameters.AddWithValue("@precio", importe.precioImporte); + commandImporte.Parameters.AddWithValue("@fk_venta", idVenta); + commandImporte.ExecuteNonQuery(); + } + } + transaccion.Commit(); return true; } diff --git a/database/modelos/DetalleImporte.cs b/database/modelos/DetalleImporte.cs index d7cac40..e18d508 100644 --- a/database/modelos/DetalleImporte.cs +++ b/database/modelos/DetalleImporte.cs @@ -9,14 +9,16 @@ namespace compabetov2.database.modelos public class DetalleImporte { public int fkImporte; - public int catidad; + public int cantidad; public decimal precioImporte; + public int fkVenta; - public DetalleImporte(int fkImporte, int cantidad, decimal precioImporte) + public DetalleImporte(int fkImporte, int cantidad, decimal precioImporte, int fkVenta = -1) { this.fkImporte = fkImporte; - this.catidad = cantidad; + this.cantidad = cantidad; this.precioImporte = precioImporte; + this.fkVenta = fkVenta; } } } diff --git a/database/modelos/DetalleImporteCuenta.cs b/database/modelos/DetalleImporteCuenta.cs new file mode 100644 index 0000000..a54d7a2 --- /dev/null +++ b/database/modelos/DetalleImporteCuenta.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace compabetov2.database.modelos +{ + public class DetalleImporteCuenta + { + public int fkImporte; + public int cantidad; + public decimal precioImporte; + public int fkCuenta; + + public DetalleImporteCuenta(int fkImporte, int cantidad, decimal precioImporte, int fkCuenta = -1) + { + this.fkImporte = fkImporte; + this.cantidad = cantidad; + this.precioImporte = precioImporte; + this.fkCuenta = fkCuenta; + } + } +} diff --git a/database/modelos/DetalleImporteEnvio.cs b/database/modelos/DetalleImporteEnvio.cs new file mode 100644 index 0000000..a0edf99 --- /dev/null +++ b/database/modelos/DetalleImporteEnvio.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace compabetov2.database.modelos +{ + public class DetalleImporteEnvio + { + public int fkImporte; + public int cantidad; + public decimal precioImporte; + public int fkEnvio; + + public DetalleImporteEnvio(int fkImporte, int cantidad, decimal precioImporte, int fkEnvio = -1) + { + this.fkImporte = fkImporte; + this.cantidad = cantidad; + this.precioImporte = precioImporte; + this.fkEnvio = fkEnvio; + } + } +} diff --git a/database/service.cs b/database/service.cs index 93e5526..d6db13e 100644 --- a/database/service.cs +++ b/database/service.cs @@ -222,9 +222,9 @@ namespace compabetov2.database return DAO.actualizarMermaDAO(merma); } - public static bool crearCuenta(Cuenta cuenta, List detalleCuentas) + public static bool crearCuenta(Cuenta cuenta, List detalleCuentas, List importes) { - return DAO.crearCuentaDAO(cuenta, detalleCuentas); + return DAO.crearCuentaDAO(cuenta, detalleCuentas, importes); } public static List conseguirCuentaDAO() @@ -273,14 +273,35 @@ namespace compabetov2.database return detallesCuentas; } + public static List conseguirImportesCuenta(int idCuenta) + { + List importes = new List(); + + SQLiteDataReader reader = DAO.conseguirImportesCuentaDAO(idCuenta); + + while (reader.Read()) + { + int idImporte = (int)reader.GetInt64(1); + DetalleImporteCuenta importe = new DetalleImporteCuenta( + idImporte, + (int)reader.GetInt64(2),//cantidad + (int)reader.GetDecimal(3),// precio + (int)reader.GetInt64(4)//fk_cuenta + ); + importes.Add(importe); + } + + return importes; + } + public static bool cancelarCuenta(int idCuenta) { return DAO.cancelarCuentaDAO(idCuenta); } - public static bool saldarCuenta(Cuenta cuenta, List detallesCuentas) + public static bool saldarCuenta(Cuenta cuenta, List detallesCuentas, List importes) { - return DAO.saldarCuentaDAO(cuenta, detallesCuentas); + return DAO.saldarCuentaDAO(cuenta, detallesCuentas, importes); } /*public static Dictionary filtrarVentaFechaMes(DateTime fecha) @@ -314,18 +335,19 @@ namespace compabetov2.database return estadisticas; }*/ - public static bool crearEnvio(Envio envio, List detallesEnvio) + public static bool crearEnvio(Envio envio, List detallesEnvio, List importes) { - return DAO.crearEnvio(envio, detallesEnvio); + return DAO.crearEnvio(envio, detallesEnvio,importes); } - public static List conseguirEnvio() + public static List> conseguirEnvio() { - List envios = new List(); + List> envios = new List>(); SQLiteDataReader reader = DAO.conseguirEnvioDAO(); while (reader.Read()) { + Dictionary dict = new Dictionary(); decimal total = reader.GetDecimal(6); Envio envio = new Envio( (int)reader.GetInt64(0), @@ -338,7 +360,23 @@ namespace compabetov2.database total ) ; - envios.Add(envio); + dict.Add("envio", envio); + + List importes = new List(); + SQLiteDataReader readerImporte = DAO.conseguirImporteEnvio(envio.id); + while (readerImporte.Read()) + { + decimal precio = readerImporte.GetDecimal(3); + importes.Add(new DetalleImporteEnvio( + (int)readerImporte.GetInt64(1),//id + (int)readerImporte.GetInt64(2),//cantidad + precio,//precio + (int)readerImporte.GetInt64(4)//fk_envio + )); + } + + dict.Add("importes",importes); + envios.Add(dict); } return envios; @@ -375,9 +413,9 @@ namespace compabetov2.database return DAO.cancelarEnvioDAO(envio, detalles); } - public static bool concluirEnvio(Envio envio, List detallesEnvio) + public static bool concluirEnvio(Envio envio, List detallesEnvio, List importes) { - return DAO.concluirEnvioDAO(envio, detallesEnvio); + return DAO.concluirEnvioDAO(envio, detallesEnvio, importes); } public static Dictionary>> estadisticas(DateTime fecha) diff --git a/obj/Debug/compabetov2.csproj.AssemblyReference.cache b/obj/Debug/compabetov2.csproj.AssemblyReference.cache index 3e96430..6ae8e14 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 5c110f6..b1fed38 100644 --- a/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache +++ b/obj/Debug/compabetov2.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -afad5b5549ec219a4cd1dcd558a30f10f9712e8d73e654845b31f646b6d12d05 +5d392fc74da50dbed51f65b8c7104959751c8057f234f2b9efe46f857530069e diff --git a/obj/Debug/compabetov2.csproj.FileListAbsolute.txt b/obj/Debug/compabetov2.csproj.FileListAbsolute.txt index 43fb6f0..2ed2a54 100644 --- a/obj/Debug/compabetov2.csproj.FileListAbsolute.txt +++ b/obj/Debug/compabetov2.csproj.FileListAbsolute.txt @@ -98,3 +98,54 @@ C:\Users\compa\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.e C:\Users\compa\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.pdb C:\Users\carsu\source\repos\compabetoOG\obj\Debug\compabetov2.Ventas.Importe.resources C:\Users\carsu\source\repos\compabetoOG\obj\Debug\compabetov2.Ventas.Importe1.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\bin\Debug\SqlServerTypes\x64\msvcr120.dll +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\bin\Debug\SqlServerTypes\x64\SqlServerSpatial140.dll +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\bin\Debug\SqlServerTypes\x86\msvcr120.dll +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\bin\Debug\SqlServerTypes\x86\SqlServerSpatial140.dll +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\bin\Debug\compabetov2.exe.config +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\bin\Debug\compabetov2.exe.manifest +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\bin\Debug\compabetov2.application +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\bin\Debug\compabetov2.exe +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\bin\Debug\compabetov2.pdb +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\bin\Debug\EntityFramework.dll +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\bin\Debug\EntityFramework.SqlServer.dll +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\bin\Debug\Microsoft.SqlServer.Types.dll +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\bin\Debug\System.Data.SQLite.dll +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\bin\Debug\System.Data.SQLite.EF6.dll +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\bin\Debug\System.Data.SQLite.Linq.dll +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\bin\Debug\EntityFramework.xml +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\bin\Debug\EntityFramework.SqlServer.xml +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\bin\Debug\System.Data.SQLite.xml +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.csproj.AssemblyReference.cache +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.Empleados.AgregarEmpleado1.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.AgregarLogin1.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.Empleados.EditarEmpleado1.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.Estadiscticas.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.ActualizarMerma.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.AgregarEmpleado.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.AgregarLogin.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.agregarmermas.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.cuentas.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.EditarEmpleado.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.envios.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.inventario.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.login.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.MenuPrincipal.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.mermas.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.ModificarContra.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.personal.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.Confirmacion.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.Properties.Resources.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.Ventas.datosCuenta.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.Ventas.datosEnvio.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.Ventas.Importe.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.Ventas.Importe1.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.vender.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.verMerma.resources +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.csproj.GenerateResource.cache +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.csproj.CoreCompileInputs.cache +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.exe.manifest +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.application +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabet.5C4A9C0C.Up2Date +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.exe +C:\Users\Googl\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.pdb diff --git a/obj/Debug/compabetov2.exe b/obj/Debug/compabetov2.exe index 7fbf413..9c7e5e7 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 6495c12..98ad5f7 100644 Binary files a/obj/Debug/compabetov2.pdb and b/obj/Debug/compabetov2.pdb differ