importe en venta hecho

This commit is contained in:
carlos
2024-06-09 16:55:52 -06:00
parent 91d1661d9a
commit 7569ef0f5a
27 changed files with 987 additions and 74 deletions
+2 -3
View File
@@ -1,10 +1,9 @@
{ {
"ExpandedNodes": [ "ExpandedNodes": [
"", "",
"\\Cuentas",
"\\database", "\\database",
"\\Principal" "\\Ventas"
], ],
"SelectedNode": "\\Solution.sln", "SelectedNode": "\\Ventas\\vender.cs",
"PreviewInSolutionExplorer": false "PreviewInSolutionExplorer": false
} }
Binary file not shown.
+2 -2
View File
@@ -108,7 +108,7 @@ namespace compabetov2
int numeroContador = int.Parse(txtStockAgregar.Text); int numeroContador = int.Parse(txtStockAgregar.Text);
txtStockAgregar.Text = (numeroContador - 1).ToString(); txtStockAgregar.Text = (numeroContador - 1).ToString();
} }
catch (Exception ex) catch (Exception)
{ {
txtStockAgregar.Text = "0"; txtStockAgregar.Text = "0";
} }
@@ -130,7 +130,7 @@ namespace compabetov2
{ {
int numeroContador = int.Parse(txtStockAgregar.Text); int numeroContador = int.Parse(txtStockAgregar.Text);
txtStockAgregar.Text = (numeroContador + 1).ToString(); txtStockAgregar.Text = (numeroContador + 1).ToString();
}catch (Exception ex) }catch (Exception)
{ {
txtStockAgregar.Text = "0"; txtStockAgregar.Text = "0";
} }
+58
View File
@@ -0,0 +1,58 @@
namespace compabetov2.Ventas
{
partial class Importe
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.panelImporte = new System.Windows.Forms.FlowLayoutPanel();
this.SuspendLayout();
//
// panelImporte
//
this.panelImporte.Location = new System.Drawing.Point(72, 46);
this.panelImporte.Name = "panelImporte";
this.panelImporte.Size = new System.Drawing.Size(596, 292);
this.panelImporte.TabIndex = 0;
//
// Importe
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(747, 406);
this.Controls.Add(this.panelImporte);
this.Name = "Importe";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Importe_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.FlowLayoutPanel panelImporte;
}
}
+154
View File
@@ -0,0 +1,154 @@
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;
using System.Windows.Forms;
namespace compabetov2.Ventas
{
public partial class Importe : Form
{
private vender ventanaPadre;
private List<ImporteModel> importes;
public Importe(vender ventaPadre)
{
InitializeComponent();
ventanaPadre = ventaPadre;
llenarPanel();
}
private void getData()
{
this.importes = service.conseguirImportes();
}
private void llenarPanel()
{
getData();
foreach (ImporteModel importe in importes)
{
TableLayoutPanel filaLayout = new TableLayoutPanel();
filaLayout.RowCount = 1;
filaLayout.ColumnCount = 2;
filaLayout.Height = 100;
filaLayout.Width = 830;
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;
informacionProducto.ColumnCount = 2;
informacionProducto.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
informacionProducto.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 80F));
informacionProducto.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
informacionProducto.Dock = DockStyle.Fill;
PictureBox imagen = new PictureBox();
string rutaImg = Path.Combine(Application.StartupPath, "Resources", importe.img);
imagen.Image = Image.FromFile(rutaImg);
imagen.Dock = DockStyle.Fill;
imagen.BackgroundImageLayout = ImageLayout.Stretch;
imagen.SizeMode = PictureBoxSizeMode.Zoom;
Label nombreStock = new Label();
nombreStock.Text = importe.tipo;
nombreStock.Font = new Font(nombreStock.Font.FontFamily, 16);
nombreStock.Dock = DockStyle.Fill;
nombreStock.TextAlign = ContentAlignment.MiddleCenter;
//panel de agregar stock
TableLayoutPanel agregarPanel = new TableLayoutPanel();
agregarPanel.Dock = DockStyle.Fill;
agregarPanel.RowCount = 1;
agregarPanel.ColumnCount = 3;
agregarPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 60F));
agregarPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
agregarPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
agregarPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
TextBox txtStockAgregar = new TextBox();
txtStockAgregar.Text = "0";
txtStockAgregar.Height = 60;
txtStockAgregar.Width = 200;
txtStockAgregar.Anchor = AnchorStyles.None;
txtStockAgregar.Font = new Font(txtStockAgregar.Font.FontFamily, 17);
Button btnMenos = new Button();
btnMenos.Text = "-";
btnMenos.Width = 60;
btnMenos.Height = 60;
btnMenos.Font = new Font(btnMenos.Font.FontFamily, 30);
btnMenos.ForeColor = Color.White;
btnMenos.FlatStyle = FlatStyle.Flat;
btnMenos.FlatAppearance.BorderSize = 0;
btnMenos.BackColor = Color.FromArgb(33, 90, 255);
btnMenos.Anchor = AnchorStyles.None;
btnMenos.Click += new EventHandler(delegate (object sender, EventArgs e)
{
try
{
int numeroContador = int.Parse(txtStockAgregar.Text);
txtStockAgregar.Text = (numeroContador - 1).ToString();
}
catch (Exception)
{
txtStockAgregar.Text = "0";
}
});
Button btnMas = new Button();
btnMas.Text = "+";
btnMas.Width = 60;
btnMas.Height = 60;
btnMas.Font = new Font(btnMas.Font.FontFamily, 30);
btnMas.ForeColor = Color.White;
btnMas.BackColor = Color.FromArgb(33, 90, 255);
btnMas.FlatStyle = FlatStyle.Flat;
btnMas.FlatAppearance.BorderSize = 0;
btnMas.Anchor = AnchorStyles.None;
btnMas.Click += new EventHandler(delegate (object sender, EventArgs e)
{
try
{
int numeroContador = int.Parse(txtStockAgregar.Text);
txtStockAgregar.Text = (numeroContador + 1).ToString();
}
catch (Exception)
{
txtStockAgregar.Text = "0";
}
});
informacionProducto.Controls.Add(imagen, 0, 0);
informacionProducto.Controls.Add(nombreStock, 1, 0);
agregarPanel.Controls.Add(txtStockAgregar, 0, 0);
agregarPanel.Controls.Add(btnMenos, 1, 0);
agregarPanel.Controls.Add(btnMas, 2, 0);
filaLayout.Controls.Add(informacionProducto, 0, 0);
filaLayout.Controls.Add(agregarPanel, 1, 0);
panelImporte.Controls.Add(filaLayout);
}
}
private void Importe_Load(object sender, EventArgs e)
{
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+72
View File
@@ -0,0 +1,72 @@
namespace compabetov2.Ventas
{
partial class Importe1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.panelImporte = new System.Windows.Forms.FlowLayoutPanel();
this.btnAceptar = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// panelImporte
//
this.panelImporte.Location = new System.Drawing.Point(55, 22);
this.panelImporte.Name = "panelImporte";
this.panelImporte.Size = new System.Drawing.Size(677, 364);
this.panelImporte.TabIndex = 1;
//
// btnAceptar
//
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);
//
// Importe1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.btnAceptar);
this.Controls.Add(this.panelImporte);
this.Name = "Importe1";
this.Text = "Importe1";
this.Load += new System.EventHandler(this.Importe1_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.FlowLayoutPanel panelImporte;
private System.Windows.Forms.Button btnAceptar;
}
}
+174
View File
@@ -0,0 +1,174 @@
using compabetov2.database.modelos;
using compabetov2.database;
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;
using System.Windows.Forms;
namespace compabetov2.Ventas
{
public partial class Importe1 : Form
{
private vender ventanaPadre;
private List<ImporteModel> importes;
private List<DetalleImporte> detalles = new List<DetalleImporte>();
public Importe1(vender ventaPadre)
{
InitializeComponent();
ventanaPadre = ventaPadre;
llenarPanel();
}
private void getData()
{
this.importes = service.conseguirImportes();
}
private void llenarPanel()
{
getData();
int i = 0;
foreach (ImporteModel importe in importes)
{
detalles.Add(new DetalleImporte(importe.idImporte,0,importe.precioImporte));
TableLayoutPanel filaLayout = new TableLayoutPanel();
filaLayout.RowCount = 1;
filaLayout.ColumnCount = 2;
filaLayout.Height = 100;
filaLayout.Width = 650;
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;
informacionProducto.ColumnCount = 2;
informacionProducto.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
informacionProducto.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 80F));
informacionProducto.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
informacionProducto.Dock = DockStyle.Fill;
PictureBox imagen = new PictureBox();
string rutaImg = Path.Combine(Application.StartupPath, "Resources", importe.img);
imagen.Image = Image.FromFile(rutaImg);
imagen.Dock = DockStyle.Fill;
imagen.BackgroundImageLayout = ImageLayout.Stretch;
imagen.SizeMode = PictureBoxSizeMode.Zoom;
Label nombreStock = new Label();
nombreStock.Text = importe.tipo;
nombreStock.Font = new Font(nombreStock.Font.FontFamily, 16);
nombreStock.Dock = DockStyle.Fill;
nombreStock.TextAlign = ContentAlignment.MiddleCenter;
//panel de agregar stock
TableLayoutPanel agregarPanel = new TableLayoutPanel();
agregarPanel.Dock = DockStyle.Fill;
agregarPanel.RowCount = 1;
agregarPanel.ColumnCount = 3;
agregarPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 60F));
agregarPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
agregarPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
agregarPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
TextBox txtStockAgregar = new TextBox();
txtStockAgregar.Text = "0";
txtStockAgregar.Height = 60;
txtStockAgregar.Width = 200;
txtStockAgregar.Anchor = AnchorStyles.None;
txtStockAgregar.Font = new Font(txtStockAgregar.Font.FontFamily, 17);
Button btnMenos = new Button();
btnMenos.Text = "-";
btnMenos.Width = 60;
btnMenos.Height = 60;
btnMenos.Font = new Font(btnMenos.Font.FontFamily, 30);
btnMenos.ForeColor = Color.White;
btnMenos.FlatStyle = FlatStyle.Flat;
btnMenos.FlatAppearance.BorderSize = 0;
btnMenos.BackColor = Color.FromArgb(33, 90, 255);
btnMenos.Anchor = AnchorStyles.None;
btnMenos.Click += new EventHandler(delegate (object sender, EventArgs e)
{
try
{
int numeroContador = int.Parse(txtStockAgregar.Text);
txtStockAgregar.Text = (numeroContador - 1).ToString();
modificarCantidad(numeroContador-1, importe.idImporte);
}
catch (Exception)
{
txtStockAgregar.Text = "0";
modificarCantidad(0, importe.idImporte);
}
});
Button btnMas = new Button();
btnMas.Text = "+";
btnMas.Width = 60;
btnMas.Height = 60;
btnMas.Font = new Font(btnMas.Font.FontFamily, 30);
btnMas.ForeColor = Color.White;
btnMas.BackColor = Color.FromArgb(33, 90, 255);
btnMas.FlatStyle = FlatStyle.Flat;
btnMas.FlatAppearance.BorderSize = 0;
btnMas.Anchor = AnchorStyles.None;
btnMas.Click += new EventHandler(delegate (object sender, EventArgs e)
{
try
{
int numeroContador = int.Parse(txtStockAgregar.Text);
txtStockAgregar.Text = (numeroContador + 1).ToString();
modificarCantidad(numeroContador+1, importe.idImporte);
}
catch (Exception)
{
txtStockAgregar.Text = "0";
modificarCantidad(0, importe.idImporte);
}
});
informacionProducto.Controls.Add(imagen, 0, 0);
informacionProducto.Controls.Add(nombreStock, 1, 0);
agregarPanel.Controls.Add(txtStockAgregar, 0, 0);
agregarPanel.Controls.Add(btnMenos, 1, 0);
agregarPanel.Controls.Add(btnMas, 2, 0);
filaLayout.Controls.Add(informacionProducto, 0, 0);
filaLayout.Controls.Add(agregarPanel, 1, 0);
panelImporte.Controls.Add(filaLayout);
i++;
}
}
private void modificarCantidad(int cantidad, int idImporte)
{
detalles[idImporte-1].catidad = cantidad;
}
private void Importe1_Load(object sender, EventArgs e)
{
}
private void btnAceptar_Click(object sender, EventArgs e)
{
ventanaPadre.importes = detalles;
ventanaPadre.actualizarImporteTotal();
this.Close();
}
}
}
+120
View File
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+36 -19
View File
@@ -51,6 +51,7 @@
this.responsablecb = new System.Windows.Forms.ComboBox(); this.responsablecb = new System.Windows.Forms.ComboBox();
this.btnFiar = new System.Windows.Forms.Button(); this.btnFiar = new System.Windows.Forms.Button();
this.btnEnviar = new System.Windows.Forms.Button(); this.btnEnviar = new System.Windows.Forms.Button();
this.btnImporte = new System.Windows.Forms.Button();
this.flowLayoutPanel2.SuspendLayout(); this.flowLayoutPanel2.SuspendLayout();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox9)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox9)).BeginInit();
@@ -98,7 +99,7 @@
this.flowLayoutPanel2.Controls.Add(this.label1); this.flowLayoutPanel2.Controls.Add(this.label1);
this.flowLayoutPanel2.Controls.Add(this.labeltotal); this.flowLayoutPanel2.Controls.Add(this.labeltotal);
this.flowLayoutPanel2.Location = new System.Drawing.Point(1204, -1); this.flowLayoutPanel2.Location = new System.Drawing.Point(1204, -1);
this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(2);
this.flowLayoutPanel2.Name = "flowLayoutPanel2"; this.flowLayoutPanel2.Name = "flowLayoutPanel2";
this.flowLayoutPanel2.Size = new System.Drawing.Size(243, 968); this.flowLayoutPanel2.Size = new System.Drawing.Size(243, 968);
this.flowLayoutPanel2.TabIndex = 11; this.flowLayoutPanel2.TabIndex = 11;
@@ -109,7 +110,7 @@
this.panel1.BackColor = System.Drawing.Color.Transparent; this.panel1.BackColor = System.Drawing.Color.Transparent;
this.panel1.Controls.Add(this.pictureBox9); this.panel1.Controls.Add(this.pictureBox9);
this.panel1.Location = new System.Drawing.Point(2, 2); this.panel1.Location = new System.Drawing.Point(2, 2);
this.panel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.panel1.Margin = new System.Windows.Forms.Padding(2);
this.panel1.Name = "panel1"; this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(234, 214); this.panel1.Size = new System.Drawing.Size(234, 214);
this.panel1.TabIndex = 8; this.panel1.TabIndex = 8;
@@ -118,7 +119,7 @@
// //
this.pictureBox9.Image = global::compabetov2.Properties.Resources.HomeroMenu; this.pictureBox9.Image = global::compabetov2.Properties.Resources.HomeroMenu;
this.pictureBox9.Location = new System.Drawing.Point(48, 28); this.pictureBox9.Location = new System.Drawing.Point(48, 28);
this.pictureBox9.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.pictureBox9.Margin = new System.Windows.Forms.Padding(2);
this.pictureBox9.Name = "pictureBox9"; this.pictureBox9.Name = "pictureBox9";
this.pictureBox9.Size = new System.Drawing.Size(190, 197); this.pictureBox9.Size = new System.Drawing.Size(190, 197);
this.pictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.pictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@@ -134,7 +135,7 @@
this.label1.Location = new System.Drawing.Point(2, 218); this.label1.Location = new System.Drawing.Point(2, 218);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(83, 31); this.label1.Size = new System.Drawing.Size(66, 25);
this.label1.TabIndex = 17; this.label1.TabIndex = 17;
this.label1.Text = "Total:"; this.label1.Text = "Total:";
this.label1.Click += new System.EventHandler(this.label1_Click); this.label1.Click += new System.EventHandler(this.label1_Click);
@@ -145,7 +146,7 @@
this.labeltotal.BackColor = System.Drawing.Color.Transparent; this.labeltotal.BackColor = System.Drawing.Color.Transparent;
this.labeltotal.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F); this.labeltotal.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F);
this.labeltotal.ForeColor = System.Drawing.Color.AliceBlue; this.labeltotal.ForeColor = System.Drawing.Color.AliceBlue;
this.labeltotal.Location = new System.Drawing.Point(89, 218); this.labeltotal.Location = new System.Drawing.Point(71, 174);
this.labeltotal.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.labeltotal.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.labeltotal.Name = "labeltotal"; this.labeltotal.Name = "labeltotal";
this.labeltotal.Size = new System.Drawing.Size(0, 31); this.labeltotal.Size = new System.Drawing.Size(0, 31);
@@ -160,7 +161,7 @@
this.flowLayoutPanel1.Controls.Add(this.button3); this.flowLayoutPanel1.Controls.Add(this.button3);
this.flowLayoutPanel1.Controls.Add(this.button5); this.flowLayoutPanel1.Controls.Add(this.button5);
this.flowLayoutPanel1.Location = new System.Drawing.Point(-1, 2); this.flowLayoutPanel1.Location = new System.Drawing.Point(-1, 2);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(2);
this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(243, 974); this.flowLayoutPanel1.Size = new System.Drawing.Size(243, 974);
this.flowLayoutPanel1.TabIndex = 8; this.flowLayoutPanel1.TabIndex = 8;
@@ -170,7 +171,7 @@
this.panel2.BackColor = System.Drawing.Color.Transparent; this.panel2.BackColor = System.Drawing.Color.Transparent;
this.panel2.Controls.Add(this.pictureBox7); this.panel2.Controls.Add(this.pictureBox7);
this.panel2.Location = new System.Drawing.Point(2, 2); this.panel2.Location = new System.Drawing.Point(2, 2);
this.panel2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.panel2.Margin = new System.Windows.Forms.Padding(2);
this.panel2.Name = "panel2"; this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(234, 214); this.panel2.Size = new System.Drawing.Size(234, 214);
this.panel2.TabIndex = 8; this.panel2.TabIndex = 8;
@@ -179,7 +180,7 @@
// //
this.pictureBox7.Image = global::compabetov2.Properties.Resources.HomeroMenu; this.pictureBox7.Image = global::compabetov2.Properties.Resources.HomeroMenu;
this.pictureBox7.Location = new System.Drawing.Point(48, 28); this.pictureBox7.Location = new System.Drawing.Point(48, 28);
this.pictureBox7.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.pictureBox7.Margin = new System.Windows.Forms.Padding(2);
this.pictureBox7.Name = "pictureBox7"; this.pictureBox7.Name = "pictureBox7";
this.pictureBox7.Size = new System.Drawing.Size(190, 197); this.pictureBox7.Size = new System.Drawing.Size(190, 197);
this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@@ -196,7 +197,7 @@
this.button1.Image = global::compabetov2.Properties.Resources.Menui1; this.button1.Image = global::compabetov2.Properties.Resources.Menui1;
this.button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button1.Location = new System.Drawing.Point(2, 220); this.button1.Location = new System.Drawing.Point(2, 220);
this.button1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.button1.Margin = new System.Windows.Forms.Padding(2);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); this.button1.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
this.button1.Size = new System.Drawing.Size(234, 93); this.button1.Size = new System.Drawing.Size(234, 93);
@@ -215,7 +216,7 @@
this.button2.Image = global::compabetov2.Properties.Resources.estadisticasi; this.button2.Image = global::compabetov2.Properties.Resources.estadisticasi;
this.button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button2.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button2.Location = new System.Drawing.Point(2, 317); this.button2.Location = new System.Drawing.Point(2, 317);
this.button2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.button2.Margin = new System.Windows.Forms.Padding(2);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); this.button2.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
this.button2.Size = new System.Drawing.Size(234, 93); this.button2.Size = new System.Drawing.Size(234, 93);
@@ -234,7 +235,7 @@
this.button3.Image = global::compabetov2.Properties.Resources.productoi; this.button3.Image = global::compabetov2.Properties.Resources.productoi;
this.button3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button3.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button3.Location = new System.Drawing.Point(2, 414); this.button3.Location = new System.Drawing.Point(2, 414);
this.button3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.button3.Margin = new System.Windows.Forms.Padding(2);
this.button3.Name = "button3"; this.button3.Name = "button3";
this.button3.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); this.button3.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
this.button3.Size = new System.Drawing.Size(234, 93); this.button3.Size = new System.Drawing.Size(234, 93);
@@ -252,7 +253,7 @@
this.button5.Image = global::compabetov2.Properties.Resources.sesionc; this.button5.Image = global::compabetov2.Properties.Resources.sesionc;
this.button5.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; this.button5.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.button5.Location = new System.Drawing.Point(2, 511); this.button5.Location = new System.Drawing.Point(2, 511);
this.button5.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.button5.Margin = new System.Windows.Forms.Padding(2);
this.button5.Name = "button5"; this.button5.Name = "button5";
this.button5.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0); this.button5.Padding = new System.Windows.Forms.Padding(38, 0, 0, 0);
this.button5.Size = new System.Drawing.Size(234, 93); this.button5.Size = new System.Drawing.Size(234, 93);
@@ -264,7 +265,7 @@
// //
this.flowLayoutPanel3.AutoScroll = true; this.flowLayoutPanel3.AutoScroll = true;
this.flowLayoutPanel3.Location = new System.Drawing.Point(247, 279); this.flowLayoutPanel3.Location = new System.Drawing.Point(247, 279);
this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(2);
this.flowLayoutPanel3.Name = "flowLayoutPanel3"; this.flowLayoutPanel3.Name = "flowLayoutPanel3";
this.flowLayoutPanel3.Size = new System.Drawing.Size(955, 593); this.flowLayoutPanel3.Size = new System.Drawing.Size(955, 593);
this.flowLayoutPanel3.TabIndex = 14; this.flowLayoutPanel3.TabIndex = 14;
@@ -274,7 +275,7 @@
// //
this.txtbusqueda.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txtbusqueda.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtbusqueda.Location = new System.Drawing.Point(247, 178); this.txtbusqueda.Location = new System.Drawing.Point(247, 178);
this.txtbusqueda.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.txtbusqueda.Margin = new System.Windows.Forms.Padding(2);
this.txtbusqueda.Name = "txtbusqueda"; this.txtbusqueda.Name = "txtbusqueda";
this.txtbusqueda.Size = new System.Drawing.Size(528, 30); this.txtbusqueda.Size = new System.Drawing.Size(528, 30);
this.txtbusqueda.TabIndex = 15; this.txtbusqueda.TabIndex = 15;
@@ -287,7 +288,7 @@
this.bntImprimir.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.bntImprimir.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
this.bntImprimir.ForeColor = System.Drawing.Color.Transparent; this.bntImprimir.ForeColor = System.Drawing.Color.Transparent;
this.bntImprimir.Location = new System.Drawing.Point(791, 171); this.bntImprimir.Location = new System.Drawing.Point(791, 171);
this.bntImprimir.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.bntImprimir.Margin = new System.Windows.Forms.Padding(2);
this.bntImprimir.Name = "bntImprimir"; this.bntImprimir.Name = "bntImprimir";
this.bntImprimir.Size = new System.Drawing.Size(113, 44); this.bntImprimir.Size = new System.Drawing.Size(113, 44);
this.bntImprimir.TabIndex = 17; this.bntImprimir.TabIndex = 17;
@@ -300,7 +301,7 @@
this.responsablecb.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.responsablecb.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
this.responsablecb.FormattingEnabled = true; this.responsablecb.FormattingEnabled = true;
this.responsablecb.Location = new System.Drawing.Point(1028, 177); this.responsablecb.Location = new System.Drawing.Point(1028, 177);
this.responsablecb.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.responsablecb.Margin = new System.Windows.Forms.Padding(2);
this.responsablecb.Name = "responsablecb"; this.responsablecb.Name = "responsablecb";
this.responsablecb.Size = new System.Drawing.Size(171, 33); this.responsablecb.Size = new System.Drawing.Size(171, 33);
this.responsablecb.TabIndex = 18; this.responsablecb.TabIndex = 18;
@@ -327,7 +328,7 @@
this.btnEnviar.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F); this.btnEnviar.Font = new System.Drawing.Font("Microsoft Sans Serif", 15F);
this.btnEnviar.ForeColor = System.Drawing.Color.Transparent; this.btnEnviar.ForeColor = System.Drawing.Color.Transparent;
this.btnEnviar.Location = new System.Drawing.Point(852, 219); this.btnEnviar.Location = new System.Drawing.Point(852, 219);
this.btnEnviar.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.btnEnviar.Margin = new System.Windows.Forms.Padding(2);
this.btnEnviar.Name = "btnEnviar"; this.btnEnviar.Name = "btnEnviar";
this.btnEnviar.Size = new System.Drawing.Size(113, 44); this.btnEnviar.Size = new System.Drawing.Size(113, 44);
this.btnEnviar.TabIndex = 20; this.btnEnviar.TabIndex = 20;
@@ -335,12 +336,27 @@
this.btnEnviar.UseVisualStyleBackColor = false; this.btnEnviar.UseVisualStyleBackColor = false;
this.btnEnviar.Click += new System.EventHandler(this.btnEnviar_Click); this.btnEnviar.Click += new System.EventHandler(this.btnEnviar_Click);
// //
// btnImporte
//
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.Name = "btnImporte";
this.btnImporte.Size = new System.Drawing.Size(113, 44);
this.btnImporte.TabIndex = 21;
this.btnImporte.Text = "Importe";
this.btnImporte.UseVisualStyleBackColor = false;
this.btnImporte.Click += new System.EventHandler(this.btnImporte_Click);
//
// vender // vender
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1028, 627); this.ClientSize = new System.Drawing.Size(1325, 627);
this.ControlBox = false; this.ControlBox = false;
this.Controls.Add(this.btnImporte);
this.Controls.Add(this.btnEnviar); this.Controls.Add(this.btnEnviar);
this.Controls.Add(this.btnFiar); this.Controls.Add(this.btnFiar);
this.Controls.Add(this.responsablecb); this.Controls.Add(this.responsablecb);
@@ -351,7 +367,7 @@
this.Controls.Add(this.lblhora); this.Controls.Add(this.lblhora);
this.Controls.Add(this.flowLayoutPanel2); this.Controls.Add(this.flowLayoutPanel2);
this.Controls.Add(this.flowLayoutPanel1); this.Controls.Add(this.flowLayoutPanel1);
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.Margin = new System.Windows.Forms.Padding(2);
this.Name = "vender"; this.Name = "vender";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized; this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.vender_Load); this.Load += new System.EventHandler(this.vender_Load);
@@ -393,5 +409,6 @@
private System.Windows.Forms.ComboBox responsablecb; private System.Windows.Forms.ComboBox responsablecb;
private System.Windows.Forms.Button btnFiar; private System.Windows.Forms.Button btnFiar;
private System.Windows.Forms.Button btnEnviar; private System.Windows.Forms.Button btnEnviar;
private System.Windows.Forms.Button btnImporte;
} }
} }
+57 -8
View File
@@ -30,6 +30,7 @@ namespace compabetov2
private LoginModel loginPrincipal; private LoginModel loginPrincipal;
private Dictionary<string, Image> imagenes = new Dictionary<string, Image>(); private Dictionary<string, Image> imagenes = new Dictionary<string, Image>();
private List<DetalleVentaModel> carrito = new List<DetalleVentaModel>(); private List<DetalleVentaModel> carrito = new List<DetalleVentaModel>();
public List<DetalleImporte> importes = new List<DetalleImporte>();
public vender(LoginModel loginPrincipal) public vender(LoginModel loginPrincipal)
@@ -173,7 +174,7 @@ namespace compabetov2
{ {
contador.Text = (numeroContador - 1).ToString(); contador.Text = (numeroContador - 1).ToString();
total -= producto.precio; total -= producto.precio;
label1.Text = $"Total: ${total}"; label1.Text = $"Total: ${total} - Importe: $";
// Obtener información del Label id y precio // Obtener información del Label id y precio
decimal precioProducto = producto.precio; decimal precioProducto = producto.precio;
@@ -214,7 +215,7 @@ namespace compabetov2
int numeroContador = int.Parse(contador.Text.ToString()); int numeroContador = int.Parse(contador.Text.ToString());
contador.Text = (numeroContador + 1).ToString(); contador.Text = (numeroContador + 1).ToString();
total += producto.precio; total += producto.precio;
label1.Text = $"Total: ${total}"; label1.Text = $"Total: ${total} - Importe:";
// Obtener información del Label id y precio // Obtener información del Label id y precio
int idProducto = int.Parse(id.Text); int idProducto = int.Parse(id.Text);
@@ -526,17 +527,18 @@ namespace compabetov2
if (resultado == DialogResult.Yes) if (resultado == DialogResult.Yes)
{ {
VentaModel ventaModel = new VentaModel(total, -1, "", VentaModel ventaModel = new VentaModel(total, -1, "",
responsablecb.Text.Equals("") ? loginPrincipal.usuario : responsablecb.Text responsablecb.Text.Equals("") ? loginPrincipal.usuario : responsablecb.Text,
0
); );
if (service.crearVentaDAO(ventaModel, carrito)) if (service.crearVentaDAO(ventaModel, carrito, importes))
{ {
MessageBox.Show("Venta hecha"); MessageBox.Show("Venta hecha");
ImprimirTicket(); ImprimirTicket();
eliminarProductosTocket(); eliminarProductosTocket();
llenarLayout(); llenarLayout();
total = 0; total = 0;
importes.Clear();
} }
} }
else else
@@ -547,7 +549,33 @@ namespace compabetov2
} }
else else
{ {
MessageBox.Show("No hay ningun producto agregado"); if(importes.Count > 0)
{
if (total < 0)
{
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))
{
MessageBox.Show("Importe devuelto");
llenarLayout();
total = 0;
importes.Clear();
}
}
}
else
{
MessageBox.Show("No puede vender un importe sin seleccionar un producto");
}
}
else
{
MessageBox.Show("No hay ningun producto agregado");
}
} }
} }
@@ -826,7 +854,7 @@ namespace compabetov2
c.Dispose(); c.Dispose();
flowLayoutPanel1.Controls.Remove(c); flowLayoutPanel1.Controls.Remove(c);
} }
label1.Text = "Total: 0"; label1.Text = "Total: 0 - Importe: 0";
txtbusqueda.Text = ""; txtbusqueda.Text = "";
carrito.Clear(); carrito.Clear();
@@ -838,5 +866,26 @@ namespace compabetov2
estadiscticas.Owner = this; estadiscticas.Owner = this;
estadiscticas.Show(); estadiscticas.Show();
} }
private void btnImporte_Click(object sender, EventArgs e)
{
Importe1 importe = new Importe1(this);
importe.Owner = this;
importe.Show();
}
public void actualizarImporteTotal()
{
string mensaje = "";
decimal totalImporte = 0;
foreach(DetalleImporte importe in importes)
{
totalImporte += importe.precioImporte * importe.catidad;
mensaje += $"importe: {importe.fkImporte} - cantidad: {importe.catidad}\n";
}
MessageBox.Show(mensaje);
total += totalImporte;
label1.Text = $"Total: ${total}";
}
} }
} }
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+20
View File
@@ -107,7 +107,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="database\modelos\DetalleEnvioModel.cs" /> <Compile Include="database\modelos\DetalleEnvioModel.cs" />
<Compile Include="database\modelos\DetalleImporte.cs" />
<Compile Include="database\modelos\Envio.cs" /> <Compile Include="database\modelos\Envio.cs" />
<Compile Include="database\modelos\ImporteModel.cs" />
<Compile Include="database\modelos\Variante.cs" /> <Compile Include="database\modelos\Variante.cs" />
<Compile Include="Empleados\AgregarEmpleado1.cs"> <Compile Include="Empleados\AgregarEmpleado1.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
@@ -246,6 +248,18 @@
<Compile Include="Ventas\datosEnvio.Designer.cs"> <Compile Include="Ventas\datosEnvio.Designer.cs">
<DependentUpon>datosEnvio.cs</DependentUpon> <DependentUpon>datosEnvio.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Ventas\Importe.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Ventas\Importe.Designer.cs">
<DependentUpon>Importe.cs</DependentUpon>
</Compile>
<Compile Include="Ventas\Importe1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Ventas\Importe1.Designer.cs">
<DependentUpon>Importe1.cs</DependentUpon>
</Compile>
<Compile Include="Ventas\vender.cs"> <Compile Include="Ventas\vender.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@@ -331,6 +345,12 @@
<EmbeddedResource Include="Ventas\datosEnvio.resx"> <EmbeddedResource Include="Ventas\datosEnvio.resx">
<DependentUpon>datosEnvio.cs</DependentUpon> <DependentUpon>datosEnvio.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Ventas\Importe.resx">
<DependentUpon>Importe.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Ventas\Importe1.resx">
<DependentUpon>Importe1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Ventas\vender.resx"> <EmbeddedResource Include="Ventas\vender.resx">
<DependentUpon>vender.cs</DependentUpon> <DependentUpon>vender.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
+93 -33
View File
@@ -575,35 +575,6 @@ namespace compabetov2.database
} }
} }
public static bool insertarCategoriaDAO(Categoria categoria)
{
var db_conexion = new Conexion();
try
{
using (SQLiteConnection conexion = db_conexion.get_connection())
{
conexion.Open();
string sql = "INSERT INTO Categoria (nombre, descripcion) " +
"VALUES (@nombre, @descripcion)";
using (SQLiteCommand command = new SQLiteCommand(sql, conexion))
{
command.Parameters.AddWithValue("@nombre", categoria.nombre);
command.Parameters.AddWithValue("@descripcion", categoria.descripcion);
int filasAfectadas = command.ExecuteNonQuery();
if (filasAfectadas > 0) { return true; }
else { return false; }
}
}
}
catch (SQLiteException ex)
{
MessageBox.Show(ex.Message);
return false;
}
}
public static bool insertarClienteDAO(Cliente cliente) public static bool insertarClienteDAO(Cliente cliente)
{ {
@@ -767,7 +738,7 @@ namespace compabetov2.database
} }
} }
public static bool crearVentaDAO(VentaModel venta, List<DetalleVentaModel> detalleVentas) public static bool crearVentaDAO(VentaModel venta, List<DetalleVentaModel> detalleVentas, List<DetalleImporte> importes)
{ {
var db_conexion = new Conexion(); var db_conexion = new Conexion();
try try
@@ -785,14 +756,16 @@ namespace compabetov2.database
string sqlIdVenta = "SELECT idVenta FROM venta ORDER BY idVenta DESC LIMIT 1"; string sqlIdVenta = "SELECT idVenta FROM venta ORDER BY idVenta DESC LIMIT 1";
string sqlProductoStock = "SELECT stock FROM Producto WHERE idproducto = @idproducto"; string sqlProductoStock = "SELECT stock FROM Producto WHERE idproducto = @idproducto";
string sqlProductoUpdate = "UPDATE Producto SET stock = @stock 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)";
// CREACION DE LA VENTA
SQLiteCommand commandVenta = new SQLiteCommand(sqlVenta, conexion); SQLiteCommand commandVenta = new SQLiteCommand(sqlVenta, conexion);
commandVenta.Parameters.AddWithValue("@fecha", DateTime.Now.ToString()); commandVenta.Parameters.AddWithValue("@fecha", DateTime.Now.ToString());
commandVenta.Parameters.AddWithValue("@total", venta.total); commandVenta.Parameters.AddWithValue("@total", venta.total);
commandVenta.Parameters.AddWithValue("@responzable", venta.responzable); commandVenta.Parameters.AddWithValue("@responzable", venta.responzable);
commandVenta.ExecuteNonQuery(); commandVenta.ExecuteNonQuery();
//CONSEGUIR EL ID DE LA VENTA PARA RELACIONARLO CON DETALLE VENTA
SQLiteCommand commandConsulta = new SQLiteCommand(sqlIdVenta, conexion); SQLiteCommand commandConsulta = new SQLiteCommand(sqlIdVenta, conexion);
SQLiteDataReader reader = commandConsulta.ExecuteReader(); SQLiteDataReader reader = commandConsulta.ExecuteReader();
@@ -802,6 +775,7 @@ namespace compabetov2.database
idVenta = reader.GetInt64(0); idVenta = reader.GetInt64(0);
} }
// CREACION DE DETALLE VENTA
foreach (DetalleVentaModel detalleVenta in detalleVentas) foreach (DetalleVentaModel detalleVenta in detalleVentas)
{ {
SQLiteCommand commandEmpleado = new SQLiteCommand(sqlDetalle, conexion); SQLiteCommand commandEmpleado = new SQLiteCommand(sqlDetalle, conexion);
@@ -821,10 +795,74 @@ namespace compabetov2.database
} }
//ACTUALIZACION DE STOCK
SQLiteCommand commandProdcutoUpdate = new SQLiteCommand(sqlProductoUpdate, conexion); SQLiteCommand commandProdcutoUpdate = new SQLiteCommand(sqlProductoUpdate, conexion);
commandProdcutoUpdate.Parameters.AddWithValue("@stock", stockActual - (detalleVenta.cantidad * detalleVenta.producto.cantidad)); commandProdcutoUpdate.Parameters.AddWithValue("@stock", stockActual - (detalleVenta.cantidad * detalleVenta.producto.cantidad));
commandProdcutoUpdate.Parameters.AddWithValue("@idproducto", detalleVenta.producto.fkProducto); commandProdcutoUpdate.Parameters.AddWithValue("@idproducto", detalleVenta.producto.fkProducto);
commandProdcutoUpdate.ExecuteNonQuery(); commandProdcutoUpdate.ExecuteNonQuery();
}
//creacion del importe
foreach (DetalleImporte importe in importes)
{
if (importe.catidad != 0)
{
SQLiteCommand commandDetalleImporte = new SQLiteCommand(sqlImporte, conexion);
commandDetalleImporte.Parameters.AddWithValue("@fk_importe", importe.fkImporte);
commandDetalleImporte.Parameters.AddWithValue("@cantidad", importe.catidad);
commandDetalleImporte.Parameters.AddWithValue("@precio", importe.precioImporte);
commandDetalleImporte.Parameters.AddWithValue("@fecha", DateTime.Now.ToString());
commandDetalleImporte.ExecuteNonQuery();
}
}
transaccion.Commit();
return true;
}
catch (SQLiteException ex)
{
transaccion.Rollback();
MessageBox.Show(ex.Message);
return false;
}
}
}
}
catch (SQLiteException ex)
{
MessageBox.Show(ex.Message);
return false;
}
}
public static bool devolverImporteDAO(List<DetalleImporte> importes)
{
var db_conexion = new Conexion();
try
{
using (SQLiteConnection conexion = db_conexion.get_connection())
{
conexion.Open();
using (var transaccion = conexion.BeginTransaction())
{
try
{
string sqlImporte = "INSERT INTO detalle_importe (fk_importe,cantidad,precio,fecha) VALUES (@fk_importe,@cantidad,@precio,@fecha)";
//creacion del importe
foreach (DetalleImporte importe in importes)
{
if (importe.catidad != 0)
{
SQLiteCommand commandDetalleImporte = new SQLiteCommand(sqlImporte, conexion);
commandDetalleImporte.Parameters.AddWithValue("@fk_importe", importe.fkImporte);
commandDetalleImporte.Parameters.AddWithValue("@cantidad", importe.catidad);
commandDetalleImporte.Parameters.AddWithValue("@precio", importe.precioImporte);
commandDetalleImporte.Parameters.AddWithValue("@fecha", DateTime.Now.ToString());
commandDetalleImporte.ExecuteNonQuery();
}
} }
transaccion.Commit(); transaccion.Commit();
@@ -1389,8 +1427,6 @@ namespace compabetov2.database
try try
{ {
string sqlCuenta = "UPDATE envios SET estado = @estado WHERE idEnvios = @idEnvios;"; string sqlCuenta = "UPDATE envios SET estado = @estado WHERE idEnvios = @idEnvios;";
string sqlStock = "select stock from Producto p where idproducto = @idProducto";
string sqlActualizarStock = "UPDATE Producto set stock = @stock WHERE idproducto = @idProducto";
SQLiteCommand command = new SQLiteCommand(sqlCuenta, conexion); SQLiteCommand command = new SQLiteCommand(sqlCuenta, conexion);
command.Parameters.AddWithValue("@idEnvios", envio.id); command.Parameters.AddWithValue("@idEnvios", envio.id);
@@ -1604,6 +1640,30 @@ namespace compabetov2.database
} }
} }
public static SQLiteDataReader conseguirImportesDAO()
{
SQLiteDataReader reader = null;
var db_conexion = new Conexion();
try
{
SQLiteConnection conexion = db_conexion.get_connection();
conexion.Open();
string sql = "SELECT * FROM importe";
SQLiteCommand command = new SQLiteCommand(sql, conexion);
reader = command.ExecuteReader();
return reader;
}
catch (SQLiteException ex)
{
MessageBox.Show(ex.Message);
return reader;
}
}
private static void crearDB() private static void crearDB()
{ {
var db_conexion = new Conexion(); var db_conexion = new Conexion();
+22
View File
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace compabetov2.database.modelos
{
public class DetalleImporte
{
public int fkImporte;
public int catidad;
public decimal precioImporte;
public DetalleImporte(int fkImporte, int cantidad, decimal precioImporte)
{
this.fkImporte = fkImporte;
this.catidad = cantidad;
this.precioImporte = precioImporte;
}
}
}
+25
View File
@@ -0,0 +1,25 @@
using compabetov2.Ventas;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace compabetov2.database.modelos
{
internal class ImporteModel
{
public int idImporte;
public string tipo;
public decimal precioImporte;
public string img;
public ImporteModel(int idImporte, string tipo, decimal precioImporte, string img) {
this.idImporte = idImporte;
this.tipo = tipo;
this.img = img;
this.precioImporte = precioImporte;
}
}
}
+4 -1
View File
@@ -12,12 +12,15 @@ namespace compabetov2.database.modelos
public string fecha; public string fecha;
public decimal total; public decimal total;
public string responzable; public string responzable;
public int importe;
public VentaModel(decimal total = 0, int id = -1, string fecha = "", string responzable = "") { public VentaModel(decimal total = 0, int id = -1, string fecha = "", string responzable = "", int importe = 0)
{
this.id = id; this.id = id;
this.fecha = fecha; this.fecha = fecha;
this.total = total; this.total = total;
this.responzable = responzable; this.responzable = responzable;
this.importe = importe;
} }
} }
} }
+25 -7
View File
@@ -69,11 +69,6 @@ namespace compabetov2.database
{ {
return DAO.insertarProductoDAO(producto); return DAO.insertarProductoDAO(producto);
} }
public static bool insertarCategoriaDAO(Categoria categoria)
{
return DAO.insertarCategoriaDAO(categoria);
}
public static bool insertarCliente(Cliente cliente) public static bool insertarCliente(Cliente cliente)
{ {
@@ -202,9 +197,14 @@ namespace compabetov2.database
return mermas; return mermas;
} }
public static bool crearVentaDAO(VentaModel venta, List<DetalleVentaModel> detalleVentas) public static bool crearVentaDAO(VentaModel venta, List<DetalleVentaModel> detalleVentas, List<DetalleImporte> importes)
{ {
return DAO.crearVentaDAO(venta, detalleVentas); return DAO.crearVentaDAO(venta, detalleVentas,importes);
}
public static bool devolverImporte(List<DetalleImporte> importes)
{
return DAO.devolverImporteDAO(importes);
} }
public static bool insertarMerma(Merma merma) public static bool insertarMerma(Merma merma)
@@ -520,5 +520,23 @@ namespace compabetov2.database
return variantes; return variantes;
} }
public static List<ImporteModel> conseguirImportes()
{
List<ImporteModel> importes = new List<ImporteModel>();
SQLiteDataReader reader = DAO.conseguirImportesDAO();
while (reader.Read())
{
ImporteModel importe = new ImporteModel(
(int)reader.GetInt64(0), //id
reader.GetString(1), //tipo
reader.GetDecimal(2), //precion
reader.GetString(3) //imagen
);
importes.Add(importe);
}
return importes;
}
} }
} }
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
e9fe970c95e178692c332067dd30d0ac1c7f5a7190013fcb65c40593ddd0ee2d afad5b5549ec219a4cd1dcd558a30f10f9712e8d73e654845b31f646b6d12d05
@@ -96,3 +96,5 @@ C:\Users\compa\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.a
C:\Users\compa\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.csproj.CopyComplete C:\Users\compa\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.csproj.CopyComplete
C:\Users\compa\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.exe C:\Users\compa\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.exe
C:\Users\compa\Source\Repos\aspermaster23yeh\compabetoOG\obj\Debug\compabetov2.pdb 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
Binary file not shown.
Binary file not shown.
Binary file not shown.