Usesystem
Enviado por Pamalicex • 10 de Diciembre de 2012 • 5.000 Palabras (20 Páginas) • 231 Visitas
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Exámen_Final
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
Limpiar.Enabled = true;
}
private void textBox9_TextChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
articulolb.Items.Add(articulos1.SelectedItem.ToString());
cantlb.Items.Add(cant1.Value);
unidadlb.Items.Add(precio.SelectedItem);
decimal importe;
importe = Convert.ToDecimal(precio.SelectedItem);
importelb.Items.Add(cant1.Value * importe);
articulos1.Text = "";
precio.Text = "";
cant1.Value = 1;
agregar.Enabled = false;
}
private void button5_Click(object sender, EventArgs e)
{
Close();
}
private void articulos1_SelectedIndexChanged(object sender, EventArgs e)
{
Limpiar.Enabled = true; int indice;
indice = articulos1.SelectedIndex;
precio.SelectedIndex = indice;
agregar.Enabled = true;
}
private void Form1_Load(object sender, EventArgs e)
{
agregar.Enabled = false;
quitar.Enabled = false;
Limpiar.Enabled = false;
}
private void precio_SelectedIndexChanged(object sender, EventArgs e)
{
int indice;
indice = articulos1.SelectedIndex;
precio.SelectedIndex = indice;
}
private void quitar_Click(object sender, EventArgs e)
{
int indice;
indice = articulolb.SelectedIndex;
if (indice >= 0)
{
articulolb.Items.RemoveAt(indice);
cantlb.Items.RemoveAt(indice);
unidadlb.Items.RemoveAt(indice);
importelb.Items.RemoveAt(indice);
}
else
{ }
quitar.Enabled = false;
}
private void cantlb_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void articulolb_SelectedIndexChanged(object sender, EventArgs e)
{
quitar.Enabled = true;
}
private void calcular_Click(object sender, EventArgs e)
{
int i;
double sub = 0;
for (i = 0; i < importelb.Items.Count; i++)
{
sub += Convert.ToDouble(importelb.Items[i]);
}
if (sub != 0)
{
textBox6.Text = string.Format("S/.{0:F2}", sub);
double a;
a = sub + (sub * 0.18);
textBox9.Text = sub.ToString();
}
else
{
textBox6.Text = "";
MessageBox.Show("Seleccione al menos un producto");
}
}
private void Limpiar_Click(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
textBox6.Text = "";
textBox8.Text = "";
textBox9.Text = "";
contado.Checked = true;
cant1.Value = 1;
articulos1.Text = "";
precio.Text = "";
numlb.Items.Clear();
cantlb.Items.Clear();
articulolb.Items.Clear();
unidadlb.Items.Clear();
importelb.Items.Clear();
Limpiar.Enabled = false;
}
private void print_Click(object sender, EventArgs e)
{
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
Limpiar.Enabled = true;
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
Limpiar.Enabled = true;
}
private void textBox4_TextChanged(object sender, EventArgs e)
{
Limpiar.Enabled = true;
}
private void textBox5_TextChanged(object sender, EventArgs e)
{
Limpiar.Enabled = true;
}
private void credito_CheckedChanged(object sender, EventArgs e)
{
articulos1.Text = "";
precio.Text = "";
cant1.Value = 1;
Limpiar.Enabled = true;
precio.Items.Clear();
precio.Items.Add(400 + (400 * 0.15));
precio.Items.Add(15 + (15 * 0.15));
precio.Items.Add(2500 + (2500 * 0.15));
precio.Items.Add(2800 + (2800 * 0.15));
precio.Items.Add(2700 + (2700 * 0.15));
precio.Items.Add(600 + (600 * 0.15));
precio.Items.Add(90 + (90 * 0.15));
precio.Items.Add(120 + (120 * 0.15));
}
...