Вы находитесь на странице: 1из 15

Aplicacin Nro 03 01

i)

Diseo de Salida

ii)

Codigo Completo de la Aplicacin

//Prctica 03_01: ObjetosWindows.cs


// Versin 1.0
// Fecha: 6-Enero-2003
// Autor: JPSF
// Ilustra el uso de diversos objetos de Windows como Label, TextBox, Button, GroupBox, ComboBox. CheckBox,
// RadioButton, etc y sus principales propiedades
using
using
using
using
using
using

System;
System.Drawing;
System.Collections;
System.ComponentModel;
System.Windows.Forms;
System.Data;

namespace WindowsApplication1
{
/// <summary>
/// Descripcin breve de Form1.
/// </summary>
public class FrmBoletaDePago : System.Windows.Forms.Form
{
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.TextBox txtNroDepen;
private System.Windows.Forms.TextBox txtFecha;
private System.Windows.Forms.TextBox txtBoletaNro;
private System.Windows.Forms.ComboBox cbxUnidadOrg;
private System.Windows.Forms.TextBox txtNombres;
private System.Windows.Forms.TextBox txtApellidos;
private System.Windows.Forms.TextBox txtCodigo;
private System.Windows.Forms.RadioButton rbOperario;
private System.Windows.Forms.RadioButton rbMaestro;
private System.Windows.Forms.RadioButton rbCapataz;
private System.Windows.Forms.RadioButton rbContratado;
private System.Windows.Forms.RadioButton rbEstable;
private System.Windows.Forms.CheckBox chbIPSS;
private System.Windows.Forms.CheckBox chbFNP;
private System.Windows.Forms.CheckBox chbAFP;
private System.Windows.Forms.Button btnNuevo;
private System.Windows.Forms.Button btnCalcular;
private System.Windows.Forms.Button btnFinalizar;
private System.Windows.Forms.TextBox txtHrTrab;
private System.Windows.Forms.TextBox txtPagoHrNor;
private System.Windows.Forms.TextBox txtPagoHrExt;
private System.Windows.Forms.TextBox txtBonif;
private System.Windows.Forms.TextBox txtDesc;
private System.Windows.Forms.TextBox txtTotalBruto;
private System.Windows.Forms.TextBox txtTotalNeto;
/// <summary>
/// Variable del diseador requerida.
/// </summary>
private System.ComponentModel.Container components = null;
public FrmBoletaDePago()
{
//
// Necesario para admitir el Diseador de Windows Forms

//
InitializeComponent();

//
// TODO: Agregar cdigo de constructor despus de llamar a InitializeComponen
//
}
/// <summary>
/// Limpiar los recursos que se estn utilizando.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Mtodo necesario para admitir el Diseador, no se puede modificar
/// el contenido del mtodo con el editor de cdigo.
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label9 = new System.Windows.Forms.Label();
this.txtNroDepen = new System.Windows.Forms.TextBox();
this.txtHrTrab = new System.Windows.Forms.TextBox();
this.txtFecha = new System.Windows.Forms.TextBox();
this.txtBoletaNro = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.cbxUnidadOrg = new System.Windows.Forms.ComboBox();
this.txtNombres = new System.Windows.Forms.TextBox();
this.txtApellidos = new System.Windows.Forms.TextBox();
this.txtCodigo = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.rbOperario = new System.Windows.Forms.RadioButton();
this.rbMaestro = new System.Windows.Forms.RadioButton();
this.rbCapataz = new System.Windows.Forms.RadioButton();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.rbContratado = new System.Windows.Forms.RadioButton();
this.rbEstable = new System.Windows.Forms.RadioButton();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.chbIPSS = new System.Windows.Forms.CheckBox();
this.chbFNP = new System.Windows.Forms.CheckBox();
this.chbAFP = new System.Windows.Forms.CheckBox();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.txtTotalNeto = new System.Windows.Forms.TextBox();
this.txtTotalBruto = new System.Windows.Forms.TextBox();

this.txtDesc = new System.Windows.Forms.TextBox();


this.txtBonif = new System.Windows.Forms.TextBox();
this.txtPagoHrExt = new System.Windows.Forms.TextBox();
this.txtPagoHrNor = new System.Windows.Forms.TextBox();
this.label16 = new System.Windows.Forms.Label();
this.label15 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.label11 = new System.Windows.Forms.Label();
this.label10 = new System.Windows.Forms.Label();
this.btnNuevo = new System.Windows.Forms.Button();
this.btnCalcular = new System.Windows.Forms.Button();
this.btnFinalizar = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox6.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
this.label9,
this.txtNroDepen,
this.txtHrTrab,
this.txtFecha,
this.txtBoletaNro,
this.label8,
this.label7,
this.label6,
this.cbxUnidadOrg,
this.txtNombres,
this.txtApellidos,
this.txtCodigo,
this.label5,
this.label4,
this.label3,
this.label2});
this.groupBox1.Location = new System.Drawing.Point(8, 40);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(464, 120);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Datos";
//

// label9
//
this.label9.Location = new System.Drawing.Point(256, 16);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(100, 16);
this.label9.TabIndex = 15;
this.label9.Text = "Boleta Nro.";
//
// txtNroDepen
//
this.txtNroDepen.Location = new System.Drawing.Point(368, 88);
this.txtNroDepen.Name = "txtNroDepen";
this.txtNroDepen.Size = new System.Drawing.Size(80, 20);
this.txtNroDepen.TabIndex = 14;
this.txtNroDepen.Text = "";
this.txtNroDepen.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.txtNroDepen_KeyPress);
//
// txtHrTrab
//
this.txtHrTrab.Location = new System.Drawing.Point(368, 64);
this.txtHrTrab.Name = "txtHrTrab";
this.txtHrTrab.Size = new System.Drawing.Size(80, 20);
this.txtHrTrab.TabIndex = 13;
this.txtHrTrab.Text = "";
this.txtHrTrab.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.txtHrTrab_KeyPress);
//
// txtFecha
//
this.txtFecha.Location = new System.Drawing.Point(368, 40);
this.txtFecha.Name = "txtFecha";
this.txtFecha.Size = new System.Drawing.Size(80, 20);
this.txtFecha.TabIndex = 12;
this.txtFecha.Text = "";
this.txtFecha.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.txtFecha_KeyPress);
//
// txtBoletaNro
//
this.txtBoletaNro.Location = new System.Drawing.Point(368, 16);
this.txtBoletaNro.Name = "txtBoletaNro";
this.txtBoletaNro.Size = new System.Drawing.Size(80, 20);
this.txtBoletaNro.TabIndex = 11;
this.txtBoletaNro.Text = "";
this.txtBoletaNro.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.txtBoletaNro_KeyPress);
//
// label8
//
this.label8.Location = new System.Drawing.Point(256, 96);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(112, 16);
this.label8.TabIndex = 10;
this.label8.Text = "Nro de Dependientes";
//
// label7
//
this.label7.Location = new System.Drawing.Point(256, 64);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(100, 16);
this.label7.TabIndex = 9;
this.label7.Text = "Horas trabajadas";

//
// label6
//
this.label6.Location = new System.Drawing.Point(256, 40);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(100, 16);
this.label6.TabIndex = 8;
this.label6.Text = "Fecha";
//
// cbxUnidadOrg
//
this.cbxUnidadOrg.Items.AddRange(new object[] {
"Construccin",
"Acabado",
"Cimientos",
"Diseo"});
this.cbxUnidadOrg.Location = new System.Drawing.Point(120, 88);
this.cbxUnidadOrg.Name = "cbxUnidadOrg";
this.cbxUnidadOrg.Size = new System.Drawing.Size(120, 21);
this.cbxUnidadOrg.TabIndex = 7;
this.cbxUnidadOrg.Text = "Seleccione un valor";
this.cbxUnidadOrg.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.cbxUnidadOrg_KeyPress);
//
// txtNombres
//
this.txtNombres.Location = new System.Drawing.Point(120, 64);
this.txtNombres.Name = "txtNombres";
this.txtNombres.Size = new System.Drawing.Size(104, 20);
this.txtNombres.TabIndex = 6;
this.txtNombres.Text = "";
this.txtNombres.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.txtNombres_KeyPress);
//
// txtApellidos
//
this.txtApellidos.Location = new System.Drawing.Point(120, 40);
this.txtApellidos.Name = "txtApellidos";
this.txtApellidos.Size = new System.Drawing.Size(104, 20);
this.txtApellidos.TabIndex = 5;
this.txtApellidos.Text = "";
this.txtApellidos.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.txtApellidos_KeyPress);
//
// txtCodigo
//
this.txtCodigo.Location = new System.Drawing.Point(120, 16);
this.txtCodigo.Name = "txtCodigo";
this.txtCodigo.Size = new System.Drawing.Size(104, 20);
this.txtCodigo.TabIndex = 4;
this.txtCodigo.Text = "";
this.txtCodigo.KeyPress += new
System.Windows.Forms.KeyPressEventHandler(this.txtCodigo_KeyPress);
//
// label5
//
this.label5.Location = new System.Drawing.Point(8, 96);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(128, 16);

this.label5.TabIndex = 3;
this.label5.Text = "Unidad Organizacional";
//
// label4
//
this.label4.Location = new System.Drawing.Point(8, 72);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(100, 16);
this.label4.TabIndex = 2;
this.label4.Text = "Nombres";
//
// label3
//
this.label3.Location = new System.Drawing.Point(8, 48);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(100, 16);
this.label3.TabIndex = 1;
this.label3.Text = "Apellidos";
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 24);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(100, 16);
this.label2.TabIndex = 0;
this.label2.Text = "Cdigo";
//
// label1
//
this.label1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.label1.Font = new System.Drawing.Font("Comic Sans MS", 15.75F,
((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic)
| System.Drawing.FontStyle.Underline), System.Drawing.GraphicsUnit.Poin
((System.Byte)(0)));
this.label1.ForeColor = System.Drawing.SystemColors.HotTrack;
this.label1.Location = new System.Drawing.Point(168, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(176, 32);
this.label1.TabIndex = 1;
this.label1.Text = "Boleta de Pago";
//
// groupBox2
//
this.groupBox2.Controls.AddRange(new System.Windows.Forms.Control[] {
this.rbOperario,
this.rbMaestro,
this.rbCapataz});
this.groupBox2.Location = new System.Drawing.Point(64, 192);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(96, 112);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Puesto";
//
// rbOperario
//
this.rbOperario.Location = new System.Drawing.Point(16, 72);
this.rbOperario.Name = "rbOperario";
this.rbOperario.Size = new System.Drawing.Size(72, 24);
this.rbOperario.TabIndex = 2;

this.rbOperario.Text = "Operario";
//
// rbMaestro
//
this.rbMaestro.Location = new System.Drawing.Point(16, 48);
this.rbMaestro.Name = "rbMaestro";
this.rbMaestro.Size = new System.Drawing.Size(64, 24);
this.rbMaestro.TabIndex = 1;
this.rbMaestro.Text = "Maestro";
//
// rbCapataz
//
this.rbCapataz.Checked = true;
this.rbCapataz.Location = new System.Drawing.Point(16, 24);
this.rbCapataz.Name = "rbCapataz";
this.rbCapataz.Size = new System.Drawing.Size(64, 24);
this.rbCapataz.TabIndex = 0;
this.rbCapataz.TabStop = true;
this.rbCapataz.Text = "Capataz";
//
// groupBox3
//
this.groupBox3.Controls.AddRange(new System.Windows.Forms.Control[] {
this.rbContratado,
this.rbEstable});
this.groupBox3.Location = new System.Drawing.Point(200, 192);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(104, 104);
this.groupBox3.TabIndex = 3;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Modalidad";
//
// rbContratado
//
this.rbContratado.Location = new System.Drawing.Point(16, 56);
this.rbContratado.Name = "rbContratado";
this.rbContratado.Size = new System.Drawing.Size(80, 24);
this.rbContratado.TabIndex = 1;
this.rbContratado.Text = "Contratado";
//
// rbEstable
//
this.rbEstable.Checked = true;
this.rbEstable.Location = new System.Drawing.Point(16, 24);
this.rbEstable.Name = "rbEstable";
this.rbEstable.Size = new System.Drawing.Size(80, 24);
this.rbEstable.TabIndex = 0;
this.rbEstable.TabStop = true;
this.rbEstable.Text = "Estable";
//
// groupBox4
//
this.groupBox4.Controls.AddRange(new System.Windows.Forms.Control[] {
this.chbIPSS,
this.chbFNP,
this.chbAFP});
this.groupBox4.Location = new System.Drawing.Point(344, 192);
this.groupBox4.Name = "groupBox4";

this.groupBox4.Size = new System.Drawing.Size(80, 100);


this.groupBox4.TabIndex = 4;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Descuentos";
//
// chbIPSS
//
this.chbIPSS.Location = new System.Drawing.Point(16, 72);
this.chbIPSS.Name = "chbIPSS";
this.chbIPSS.Size = new System.Drawing.Size(56, 16);
this.chbIPSS.TabIndex = 2;
this.chbIPSS.Text = "IPSS";
//
// chbFNP
//
this.chbFNP.Location = new System.Drawing.Point(16, 48);
this.chbFNP.Name = "chbFNP";
this.chbFNP.Size = new System.Drawing.Size(48, 16);
this.chbFNP.TabIndex = 1;
this.chbFNP.Text = "FNP";
//
// chbAFP
//
this.chbAFP.Location = new System.Drawing.Point(16, 24);
this.chbAFP.Name = "chbAFP";
this.chbAFP.Size = new System.Drawing.Size(48, 16);
this.chbAFP.TabIndex = 0;
this.chbAFP.Text = "AFP";
//
// groupBox5
//
this.groupBox5.Location = new System.Drawing.Point(16, 176);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(456, 136);
this.groupBox5.TabIndex = 5;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Datos complementarios";
//
// groupBox6
//
this.groupBox6.Controls.AddRange(new System.Windows.Forms.Control[] {
this.txtTotalNeto,
this.txtTotalBruto,
this.txtDesc,
this.txtBonif,
this.txtPagoHrExt,
this.txtPagoHrNor,
this.label16,
this.label15,
this.label14,
this.label13,
this.label12,

this.label11,

this.label10});
this.groupBox6.Location = new System.Drawing.Point(16, 320);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(456, 128);
this.groupBox6.TabIndex = 6;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "groupBox6";
//
// txtTotalNeto
//
this.txtTotalNeto.Enabled = false;
this.txtTotalNeto.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.txtTotalNeto.Location = new System.Drawing.Point(336, 88);
this.txtTotalNeto.Name = "txtTotalNeto";
this.txtTotalNeto.TabIndex = 12;
this.txtTotalNeto.Text = "";
//
// txtTotalBruto
//
this.txtTotalBruto.Enabled = false;
this.txtTotalBruto.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.2
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.txtTotalBruto.Location = new System.Drawing.Point(128, 88);
this.txtTotalBruto.Name = "txtTotalBruto";
this.txtTotalBruto.TabIndex = 11;
this.txtTotalBruto.Text = "";
//
// txtDesc
//
this.txtDesc.Enabled = false;
this.txtDesc.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.txtDesc.Location = new System.Drawing.Point(336, 40);
this.txtDesc.Name = "txtDesc";
this.txtDesc.TabIndex = 10;
this.txtDesc.Text = "";
//
// txtBonif
//
this.txtBonif.Enabled = false;
this.txtBonif.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.txtBonif.Location = new System.Drawing.Point(336, 16);
this.txtBonif.Name = "txtBonif";
this.txtBonif.TabIndex = 9;
this.txtBonif.Text = "";
//
// txtPagoHrExt
//
this.txtPagoHrExt.Enabled = false;
this.txtPagoHrExt.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.txtPagoHrExt.Location = new System.Drawing.Point(128, 40);
this.txtPagoHrExt.Name = "txtPagoHrExt";
this.txtPagoHrExt.TabIndex = 8;
this.txtPagoHrExt.Text = "";
//
// txtPagoHrNor
//

this.txtPagoHrNor.Enabled = false;
this.txtPagoHrNor.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.txtPagoHrNor.Location = new System.Drawing.Point(128, 16);
this.txtPagoHrNor.Name = "txtPagoHrNor";
this.txtPagoHrNor.TabIndex = 7;
this.txtPagoHrNor.Text = "";
//
// label16
//
this.label16.Location = new System.Drawing.Point(16, 64);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(432, 16);
this.label16.TabIndex = 6;
this.label16.Text =
"____________________________________________________________________";
//
// label15
//
this.label15.Location = new System.Drawing.Point(256, 96);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(112, 16);
this.label15.TabIndex = 5;
this.label15.Text = "Total Neto";
//
// label14
//
this.label14.Location = new System.Drawing.Point(256, 48);
this.label14.Name = "label14";
this.label14.TabIndex = 4;
this.label14.Text = "Descuentos";
//
// label13
//
this.label13.Location = new System.Drawing.Point(256, 16);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(88, 23);
this.label13.TabIndex = 3;
this.label13.Text = "Bonificaciones";
//
// label12
//
this.label12.Location = new System.Drawing.Point(16, 96);
this.label12.Name = "label12";
this.label12.TabIndex = 2;
this.label12.Text = "Total Bruto";
//
// label11
//
this.label11.Location = new System.Drawing.Point(16, 48);
this.label11.Name = "label11";
this.label11.TabIndex = 1;
this.label11.Text = "Pago Horas Extras";
//
// label10
//
this.label10.Location = new System.Drawing.Point(16, 24);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(120, 23);
this.label10.TabIndex = 0;
this.label10.Text = "Pago Horas Normales";
//
// btnNuevo

//
this.btnNuevo.Location = new System.Drawing.Point(32, 472);
this.btnNuevo.Name = "btnNuevo";
this.btnNuevo.TabIndex = 7;
this.btnNuevo.Text = "&Nuevo";
this.btnNuevo.Click += new System.EventHandler(this.btnNuevo_Click);
//
// btnCalcular
//
this.btnCalcular.Location = new System.Drawing.Point(176, 472);
this.btnCalcular.Name = "btnCalcular";
this.btnCalcular.TabIndex = 8;
this.btnCalcular.Text = "&Calcular";
this.btnCalcular.Click += new System.EventHandler(this.btnCalcular_Click);
//
// btnFinalizar
//
this.btnFinalizar.Location = new System.Drawing.Point(328, 472);
this.btnFinalizar.Name = "btnFinalizar";
this.btnFinalizar.TabIndex = 9;
this.btnFinalizar.Text = "&Finalizar";
this.btnFinalizar.Click += new System.EventHandler(this.btnFinalizar_Click);
//
// FrmBoletaDePago
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(480, 533);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.btnFinalizar,
this.btnCalcular,
this.btnNuevo,
this.groupBox6,
this.groupBox4,
this.groupBox3,
this.groupBox2,
this.label1,
this.groupBox1,
this.groupBox5});
this.Name = "FrmBoletaDePago";
this.Text = "Boleta de Pago";
this.Activated += new System.EventHandler(this.FrmBoletaDePago_Activated);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.groupBox6.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// Punto de entrada principal de la aplicacin.

/// </summary>
[STAThread]
static void Main()
{
Application.Run(new FrmBoletaDePago());
}
private void btnFinalizar_Click(object sender, System.EventArgs e)
{
Close();
Application.Exit();
}
private void btnNuevo_Click(object sender, System.EventArgs e)
{
// Cajas de texto
txtCodigo.Clear();
txtNombres.Clear();
txtApellidos.Clear();
// Establece un mensaje inicial en el combobox
cbxUnidadOrg.Text="Seleccione un valor";
//cbxUnidadOrg.SelectedIndex=0; Selecciona el elemento 0
txtBoletaNro.Clear();
txtFecha.Clear();
txtHrTrab.Clear();
txtNroDepen.Clear();
// Botones de radio
rbCapataz.Checked=true;
rbMaestro.Checked=false;
rbOperario.Checked=false;
rbEstable.Checked=true;
rbContratado.Checked=false;
// Cajas de chequeo
chbAFP.Checked=false;
chbFNP.Checked=false;
chbIPSS.Checked=false;
// Cajas de texto
txtPagoHrNor.Clear();
txtPagoHrExt.Clear();
txtTotalBruto.Clear();
txtBonif.Clear();
txtDesc.Clear();
txtTotalNeto.Clear();
// Botones
btnNuevo.Enabled=false;
btnCalcular.Enabled=true;
// Enfocar a txtCodigo
txtCodigo.Focus();
}
private void btnCalcular_Click(object sender, System.EventArgs e)
{
// Declaracin de variables
int hrTrab = Int32.Parse(txtHrTrab.Text);
int nroDepen = Int32.Parse(txtNroDepen.Text);
int hrNor, hrExt;
double AFP, FNP, IPSS;
double pagoHr=0, pagoHrNor, pagoHrExt, totalBruto;
double bonif=0, desc, totalNeto;
// Lectura de datos
hrTrab = Int32.Parse(txtHrTrab.Text);
nroDepen = Int32.Parse(txtNroDepen.Text);

// Clculo de horas normales y horas extras


if (hrTrab <= 40) // horas normales
{
hrNor = hrTrab;
hrExt = 0;
}
else
// horas extras
{
hrNor = 40;
hrExt = hrTrab-40;
}
// Clculo de pago por hora segn Puesto
if (rbCapataz.Checked)
pagoHr = 20.0;
if (rbMaestro.Checked)
pagoHr = 15.0;
if (rbOperario.Checked)
pagoHr = 10.0;
// Clculo de pago de horas normales y extras
pagoHrNor = hrNor*pagoHr;
pagoHrExt = hrExt*pagoHr*1.5;
// Clculo Total Bruto
totalBruto = pagoHrNor+pagoHrExt;
// Clculo de bonificaciones segn Modalidad
if (rbEstable.Checked)
bonif = totalBruto*0.10;
if (rbContratado.Checked)
bonif = totalBruto*0.08;
// Clculo de bonificacin por nro de dependientes
bonif += nroDepen*10.0;
// Clculo de descuentos
AFP=FNP=IPSS=0;
if (chbAFP.Checked)
AFP = 0.035;
if (chbFNP.Checked)
FNP = 0.03;
if (chbIPSS.Checked)
IPSS = 0.025;
desc = (AFP+FNP+IPSS)*totalBruto;
// Clculo del Total Neto
totalNeto = totalBruto + bonif - desc;
// Impresiones con Formato
txtPagoHrNor.Text = String.Format( "{0:F2}", pagoHrNor);
txtPagoHrExt.Text = String.Format( "{0:F2}", pagoHrExt);
txtTotalBruto.Text = String.Format( "{0:F2}", totalBruto);
// Impresiones sin Formato
txtBonif.Text = bonif.ToString();
txtDesc.Text = desc.ToString();
txtTotalNeto.Text = totalNeto.ToString();
// Enfoca a btnNuevo
btnNuevo.Enabled = true;
btnNuevo.Focus();
}

private void FrmBoletaDePago_Activated(object sender, System.EventArgs e)


{
btnCalcular.Enabled = false;
btnNuevo.Focus();
}

private void txtCodigo_KeyPress(object sender, System.Windows.Forms.KeyPressEventAr


e)
{
if (e.KeyChar==13) // Puls tecla ENTER
txtApellidos.Focus();
}
private void txtApellidos_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar==13) // Puls tecla ENTER
txtNombres.Focus();
}

private void txtNombres_KeyPress(object sender, System.Windows.Forms.KeyPressEventA


e)
{
if (e.KeyChar==13) // Puls tecla ENTER
cbxUnidadOrg.Focus();
}
private void cbxUnidadOrg_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar==13) // Puls tecla ENTER
txtBoletaNro.Focus();
}
private void txtBoletaNro_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar==13) // Puls tecla ENTER
txtFecha.Focus();
}

private void txtFecha_KeyPress(object sender, System.Windows.Forms.KeyPressEventArg


e)
{
if (e.KeyChar==13) // Puls tecla ENTER
txtHrTrab.Focus();
}

private void txtHrTrab_KeyPress(object sender, System.Windows.Forms.KeyPressEventAr


e)
{
if (e.KeyChar==13) // Puls tecla ENTER
txtNroDepen.Focus();
}
private void txtNroDepen_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar==13) // Puls tecla ENTER
rbCapataz.Focus();
}
}
}

Вам также может понравиться