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
+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.btnFiar = new System.Windows.Forms.Button();
this.btnEnviar = new System.Windows.Forms.Button();
this.btnImporte = new System.Windows.Forms.Button();
this.flowLayoutPanel2.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox9)).BeginInit();
@@ -98,7 +99,7 @@
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, 2, 2, 2);
this.flowLayoutPanel2.Margin = new System.Windows.Forms.Padding(2);
this.flowLayoutPanel2.Name = "flowLayoutPanel2";
this.flowLayoutPanel2.Size = new System.Drawing.Size(243, 968);
this.flowLayoutPanel2.TabIndex = 11;
@@ -109,7 +110,7 @@
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, 2, 2, 2);
this.panel1.Margin = new System.Windows.Forms.Padding(2);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(234, 214);
this.panel1.TabIndex = 8;
@@ -118,7 +119,7 @@
//
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, 2, 2, 2);
this.pictureBox9.Margin = new System.Windows.Forms.Padding(2);
this.pictureBox9.Name = "pictureBox9";
this.pictureBox9.Size = new System.Drawing.Size(190, 197);
this.pictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@@ -134,7 +135,7 @@
this.label1.Location = new System.Drawing.Point(2, 218);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(83, 31);
this.label1.Size = new System.Drawing.Size(66, 25);
this.label1.TabIndex = 17;
this.label1.Text = "Total:";
this.label1.Click += new System.EventHandler(this.label1_Click);
@@ -145,7 +146,7 @@
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(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.Name = "labeltotal";
this.labeltotal.Size = new System.Drawing.Size(0, 31);
@@ -160,7 +161,7 @@
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, 2, 2, 2);
this.flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(2);
this.flowLayoutPanel1.Name = "flowLayoutPanel1";
this.flowLayoutPanel1.Size = new System.Drawing.Size(243, 974);
this.flowLayoutPanel1.TabIndex = 8;
@@ -170,7 +171,7 @@
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, 2, 2, 2);
this.panel2.Margin = new System.Windows.Forms.Padding(2);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(234, 214);
this.panel2.TabIndex = 8;
@@ -179,7 +180,7 @@
//
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, 2, 2, 2);
this.pictureBox7.Margin = new System.Windows.Forms.Padding(2);
this.pictureBox7.Name = "pictureBox7";
this.pictureBox7.Size = new System.Drawing.Size(190, 197);
this.pictureBox7.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
@@ -196,7 +197,7 @@
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, 2, 2, 2);
this.button1.Margin = new System.Windows.Forms.Padding(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);
@@ -215,7 +216,7 @@
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, 2, 2, 2);
this.button2.Margin = new System.Windows.Forms.Padding(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);
@@ -234,7 +235,7 @@
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, 2, 2, 2);
this.button3.Margin = new System.Windows.Forms.Padding(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);
@@ -252,7 +253,7 @@
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, 2, 2, 2);
this.button5.Margin = new System.Windows.Forms.Padding(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);
@@ -264,7 +265,7 @@
//
this.flowLayoutPanel3.AutoScroll = true;
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.Size = new System.Drawing.Size(955, 593);
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.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.Size = new System.Drawing.Size(528, 30);
this.txtbusqueda.TabIndex = 15;
@@ -287,7 +288,7 @@
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, 2, 2, 2);
this.bntImprimir.Margin = new System.Windows.Forms.Padding(2);
this.bntImprimir.Name = "bntImprimir";
this.bntImprimir.Size = new System.Drawing.Size(113, 44);
this.bntImprimir.TabIndex = 17;
@@ -300,7 +301,7 @@
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, 2, 2, 2);
this.responsablecb.Margin = new System.Windows.Forms.Padding(2);
this.responsablecb.Name = "responsablecb";
this.responsablecb.Size = new System.Drawing.Size(171, 33);
this.responsablecb.TabIndex = 18;
@@ -327,7 +328,7 @@
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, 2, 2, 2);
this.btnEnviar.Margin = new System.Windows.Forms.Padding(2);
this.btnEnviar.Name = "btnEnviar";
this.btnEnviar.Size = new System.Drawing.Size(113, 44);
this.btnEnviar.TabIndex = 20;
@@ -335,12 +336,27 @@
this.btnEnviar.UseVisualStyleBackColor = false;
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
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
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.Controls.Add(this.btnImporte);
this.Controls.Add(this.btnEnviar);
this.Controls.Add(this.btnFiar);
this.Controls.Add(this.responsablecb);
@@ -351,7 +367,7 @@
this.Controls.Add(this.lblhora);
this.Controls.Add(this.flowLayoutPanel2);
this.Controls.Add(this.flowLayoutPanel1);
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.Margin = new System.Windows.Forms.Padding(2);
this.Name = "vender";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.vender_Load);
@@ -393,5 +409,6 @@
private System.Windows.Forms.ComboBox responsablecb;
private System.Windows.Forms.Button btnFiar;
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 Dictionary<string, Image> imagenes = new Dictionary<string, Image>();
private List<DetalleVentaModel> carrito = new List<DetalleVentaModel>();
public List<DetalleImporte> importes = new List<DetalleImporte>();
public vender(LoginModel loginPrincipal)
@@ -173,7 +174,7 @@ namespace compabetov2
{
contador.Text = (numeroContador - 1).ToString();
total -= producto.precio;
label1.Text = $"Total: ${total}";
label1.Text = $"Total: ${total} - Importe: $";
// Obtener información del Label id y precio
decimal precioProducto = producto.precio;
@@ -214,7 +215,7 @@ namespace compabetov2
int numeroContador = int.Parse(contador.Text.ToString());
contador.Text = (numeroContador + 1).ToString();
total += producto.precio;
label1.Text = $"Total: ${total}";
label1.Text = $"Total: ${total} - Importe:";
// Obtener información del Label id y precio
int idProducto = int.Parse(id.Text);
@@ -526,17 +527,18 @@ namespace compabetov2
if (resultado == DialogResult.Yes)
{
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");
ImprimirTicket();
eliminarProductosTocket();
llenarLayout();
total = 0;
importes.Clear();
}
}
else
@@ -547,7 +549,33 @@ namespace compabetov2
}
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();
flowLayoutPanel1.Controls.Remove(c);
}
label1.Text = "Total: 0";
label1.Text = "Total: 0 - Importe: 0";
txtbusqueda.Text = "";
carrito.Clear();
@@ -838,5 +866,26 @@ namespace compabetov2
estadiscticas.Owner = this;
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}";
}
}
}