private void cboEmpleado_SelectionChangeCommitted(object sender, EventArgs e) { try { if (this.cboEmpleado.SelectedIndex == 0) { this.txtEmpleadoCodigo.Clear(); this.txtEmpleadoFechaIngreso.Clear(); this.txtEmpleadoSueldo.Text = "0.00"; this.txtEmpleadoAsignacionFamilar.Text = "0.00"; this.txtBancoNombre.Clear(); this.txtBancoCuenta.Clear(); } else { var beRecord = (BE.Record) this.cboEmpleado.SelectedItem; var beEmpleado = new LN.Empleado().Obtener(beRecord.Codigo, true); if (beEmpleado != null && beEmpleado.Recurso != null) { this.txtEmpleadoCodigo.Text = beEmpleado.Codigo; this.txtEmpleadoFechaIngreso.Text = beEmpleado.Recurso.FechaInicio.ToString("dd/MM/yyyy"); this.txtEmpleadoSueldo.Text = beEmpleado.Recurso.Sueldo.ToString("N2"); double asigFam = 0.0; if (beEmpleado.Recurso.NumeroHijos > 0) { var beSueldo = new LN.SueldoMinimo().Actual(DateTime.Now); if (beSueldo != null) { asigFam = beSueldo.Monto / 10; } } this.txtEmpleadoAsignacionFamilar.Text = asigFam.ToString("N2"); this.txtBancoNombre.Text = beEmpleado.Recurso.BancoCTS.Nombre; this.txtBancoCuenta.Text = beEmpleado.Recurso.CuentaCTS; } } } catch (Exception ex) { Util.ErrorMessage(ex.Message); } }
private void CargarSueldosMinimos() { try { var lstSueldosMinimos = new LN.SueldoMinimo().Listar(); var source = new BindingSource(); source.DataSource = lstSueldosMinimos; this.dgvSueldosMinimos.DataSource = source; } catch (Exception ex) { throw ex; } }
private void btnBuscar_Click(object sender, EventArgs e) { try { #region Validar if (this.cboPeriodoFiltro.SelectedIndex == 0) { this.cboPeriodoFiltro.Focus(); throw new Exception("Seleccione un periodo"); } if (this.cboEmpleadoFiltro.SelectedIndex == 0) { this.cboEmpleadoFiltro.Focus(); throw new Exception("Seleccione un empleado"); } #endregion #region Cargar en memoria var beRecord = (BE.Record) this.cboEmpleadoFiltro.SelectedItem; this.uiGratificacion.EmpleadoCodigo = beRecord.Codigo; this.uiGratificacion.EmpleadoNombres = beRecord.Nombre; var beEmpleado = new LN.Empleado().Obtener(beRecord.Codigo); this.uiGratificacion.SueldoBase = beEmpleado.Recurso.Sueldo; this.uiGratificacion.DescuentoRetencioJudicial = 0.0; var beSueldoMinimo = new LN.SueldoMinimo().Actual(DateTime.Now); var beParametros = new BE.Parametros(beSueldoMinimo.Monto); this.uiGratificacion.AsignacionFamiliar = beParametros.AsignacionFamiliar; #endregion #region Resumen y Detalle this.txtPeriodo.Text = this.uiGratificacion.Periodo; this.txtDias.Text = this.uiGratificacion.Dias.ToString(); this.txtFechaInicial.Text = this.uiGratificacion.FechaInicial.ToString("dd/MM/yyyy"); this.txtFechaFinal.Text = this.uiGratificacion.FechaFinal.ToString("dd/MM/yyyy"); this.txtEmpleadoCodigo.Text = this.uiGratificacion.EmpleadoCodigo; this.txtEmpleadoNombres.Text = this.uiGratificacion.EmpleadoNombres; this.txtSueldoBase.Text = this.uiGratificacion.SueldoBase.ToString("N2"); this.txtSueldoAsigFam.Text = this.uiGratificacion.AsignacionFamiliar.ToString("N2"); int anho = this.uiGratificacion.Anho; int mesIni = this.uiGratificacion.FechaInicial.Month; int mesFin = this.uiGratificacion.FechaFinal.Month; string codEmpleado = this.uiGratificacion.EmpleadoCodigo; double bonoNocturnoTotal = 0; double bonoHorasExtrasTotal = 0; int diasCalculo = 0; this.uiGratificacion.Detalle = new List <BE.UI.GratificacionDetalle>(); for (int mes = mesIni; mes <= mesFin; mes++) { double bonoNocturno = 0; double bonoHorasExtras = 0; int diasMes = DateTime.DaysInMonth(anho, mes); int diasInasistencias = 0; var uiPlantillaDetalle = new LN.Planilla(anho, mes).ObtenerPlantillaDetalle(codEmpleado); if (uiPlantillaDetalle != null) { bonoNocturno = uiPlantillaDetalle.BonoNocturnoTotal; bonoHorasExtras = uiPlantillaDetalle.BonoHorasExtrasTotal; double inasistencias = uiPlantillaDetalle.DescuentoInasistenciaCantidad; switch (uiPlantillaDetalle.CalcularPor) { case "M": diasInasistencias = (int)inasistencias / 360; break; case "H": diasInasistencias = (int)inasistencias / 60; break; default: diasInasistencias = (int)inasistencias; break; } } bonoNocturnoTotal += bonoNocturno; bonoHorasExtrasTotal += bonoHorasExtras; diasCalculo += diasMes - diasInasistencias; var uiGratificacionDetalle = new BE.UI.GratificacionDetalle(); uiGratificacionDetalle.Anho = anho; uiGratificacionDetalle.MesId = mes; uiGratificacionDetalle.MesNombre = Util.GetNameOfMonth(mes); uiGratificacionDetalle.EmpleadoCodigo = codEmpleado; uiGratificacionDetalle.BonoNocturno = bonoNocturno; uiGratificacionDetalle.BonoHorasExtras = bonoHorasExtras; uiGratificacionDetalle.DiasMes = DateTime.DaysInMonth(anho, mes); uiGratificacionDetalle.DiasInasistencias = diasInasistencias; uiGratificacionDetalle.DiasCalculo = uiGratificacionDetalle.DiasMes - uiGratificacionDetalle.DiasInasistencias; this.uiGratificacion.Detalle.Add(uiGratificacionDetalle); } var source = new BindingSource(); source.DataSource = this.uiGratificacion.Detalle; this.dgvDetalleGratificaciones.DataSource = source; this.FormatoDetalleGratificacion(); this.txtDetalleBonoNocturno.Text = bonoNocturnoTotal.ToString("N2"); this.txtDetalleBonoHorasExtras.Text = bonoHorasExtrasTotal.ToString("N2"); this.txtDetalleDiasCalculo.Text = diasCalculo.ToString(); this.uiGratificacion.BonoNocturno = bonoNocturnoTotal / 6; this.uiGratificacion.BonoHorasExtras = bonoHorasExtrasTotal / 6; this.uiGratificacion.DiasCalculo = diasCalculo; this.txtBonoNocturno.Text = this.uiGratificacion.BonoNocturno.ToString("N2"); this.txtBonoExtra.Text = this.uiGratificacion.BonoHorasExtras.ToString("N2"); this.txtDescuentoRJ.Text = this.uiGratificacion.DescuentoRetencioJudicial.ToString("N2"); this.txtDescuentoImpuesto.Text = this.uiGratificacion.DescuentoImpuestos.ToString("N2"); double gratificacionBruta = this.uiGratificacion.BonoNocturno + this.uiGratificacion.BonoHorasExtras + this.uiGratificacion.SueldoBase + this.uiGratificacion.AsignacionFamiliar; this.uiGratificacion.GratificacionBruta = (gratificacionBruta / this.uiGratificacion.Dias) * this.uiGratificacion.DiasCalculo; this.txtGratificacionBruta.Text = this.uiGratificacion.GratificacionBruta.ToString("N2"); this.uiGratificacion.GratificacionBono = gratificacionBruta * beParametros.EsSaludFactor; this.txtGratificacionBonificacion.Text = this.uiGratificacion.GratificacionBono.ToString("N2"); this.uiGratificacion.GratificacionNeta = this.uiGratificacion.GratificacionBruta + this.uiGratificacion.GratificacionBono; this.txtGratificacionNeta.Text = this.uiGratificacion.GratificacionNeta.ToString("N2"); this.uiGratificacion.GratificacionPago = this.uiGratificacion.GratificacionNeta - this.uiGratificacion.DescuentoRetencioJudicial - this.uiGratificacion.DescuentoImpuestos; this.txtGratificacionPago.Text = this.uiGratificacion.GratificacionPago.ToString("N2"); #endregion this.txtDescuentoImpuesto.ReadOnly = false; } catch (Exception ex) { Util.ErrorMessage(ex.Message); } }