public Boolean editar_sys() { bgw_pagos.RunWorkerAsync(); avance = new Progress_Form(); avance.ShowDialog(); return(true); }
private void bt_calcular_Click(object sender, EventArgs e) { if (planeación()) { bgw_calculos.RunWorkerAsync(); avance = new Progress_Form(); avance.ShowDialog(); } else { MessageBox.Show("No existen registros para el rango de fechas especificado"); } }
private void bt_calcular_Click(object sender, EventArgs e) { if (planeacion()) { bg_calcular_aguinaldo.RunWorkerAsync(); avance = new Progress_Form(); avance.ShowDialog(); } else { MessageBox.Show("No existen pagos en el periodo especificado"); } }
public void gestion() { Int32 avance = 0; Int32 flag = 0; DateTime fecha = DateTime.Now.Date; aguinaldos = new List <Aguinaldo>(); Int32 id_general = Convert.ToInt32(fecha.Day + "" + fecha.Month + "" + fecha.Year); Decimal total_aguinaldo = 0; foreach (Colaborador c in colaboradores) { Horario horario = set_horario(c.Id_horario); Decimal salario_diario = c.Precio * (horario.Horas - 1); Decimal salario_mensual = salario_diario * 30; Decimal horas = 0; Decimal extras = 0; Int32 mes = 0; foreach (Pago p in pagos) { if (p.Id_colaborador == c.Id) { if (mes == 0) { mes = p.FechaPago.Month; } horas += p.HorasLaboradas; extras += p.HorasExtra; } } if (horas != 0) { Decimal salario_anual = salario_mensual * 12; BusinessLogic.Configuracion config = new BusinessLogic.Configuracion().obtener_Configuracion(); Decimal salario_extras = (c.Precio * config.Porcentaje_Hora_Extra) * extras; Decimal salario_final = (salario_anual / 12) + salario_extras; total_aguinaldo += salario_final; aguinaldos.Add(new Aguinaldo(c.Id, c.Id, fecha, salario_final, "No disponible", true, id_general)); } avance = ((++flag) * 100) / colaboradores.Count; bg_calcular_aguinaldo.ReportProgress(avance); Thread.Sleep(500); } aguinaldo_general = new Aguinaldo_General(id_general, fecha, total_aguinaldo, true); }
private void bgw_registros_DoWork(object sender, DoWorkEventArgs e) { Int32 flag = 0; Int32 avance = 0; String f = dg_horas_totales.Rows[0].Cells["horas_totales"].Value.ToString(); foreach (DataGridViewRow row in dg_registros.Rows) { if (Convert.ToBoolean(row.Cells["review"].Value)) { agregar_sys(row); avance = ((++flag) * 100) / dg_registros.Rows.Count; bgw_registros.ReportProgress(avance); System.Threading.Thread.Sleep(500); } } }
public void calcular_planillas() { Decimal total = 0; Int32 avance = 0; Int32 flag = 0; foreach (Pago p in pagos) { total += p.SalarioNeto; avance = ((++flag) * 100) / pagos.Count; bgw_calculos.ReportProgress(avance); Thread.Sleep(500); } Int32 id = Convert.ToInt32(fin.Day.ToString() + fin.Month.ToString() + fin.Year.ToString()); planillas = new List <Planilla>(); planilla = new Planilla(id, inicio, fin, total, tipo, true); planillas.Add(planilla); }
public void gestion() { Int32 flag = 0; Int32 avance; Planilla planilla = new Planilla(); foreach (Pago p in lista) { planilla.Id = p.Id_planilla; planilla.Total += p.SalarioNeto; List <Int32> lista = validar_cambios(p); if (lista.Count != 0) { p.editar(lista); avance = ((++flag) * 100) / lista.Count; bgw_pagos.ReportProgress(avance); System.Threading.Thread.Sleep(500); } } planilla.set_total(); }
private void bt_guardar_Click(object sender, EventArgs e) { if (registro == null) { colaborador = new Colaborador(); colaborador.Id = Int32.Parse(cb_colaborador.SelectedValue.ToString()); bgw_registros.RunWorkerAsync(); avance = new Progress_Form(); avance.ShowDialog(); } else { if (editar_sys()) { parent.cancelar_button(); } else { MessageBox.Show("Ocurrió un error", "Ups!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public Boolean gestion() { pagos = new List <Pago>(); Int32 flag = 0; Decimal horas = 0; Decimal extras = 0; Decimal bruto = 0; Decimal neto = 0; Decimal seguro = 0; Decimal adelanto = 0; Decimal vacacion = 0; Decimal aguinaldo = 0; Int32 avance = 0; foreach (Colaborador c in colaboradores) { if (c.Tipo_planilla == tipo) { horas = 0; extras = 0; bruto = 0; neto = 0; seguro = 0; adelanto = 0; vacacion = 0; aguinaldo = 0; foreach (Registro r in registros) { if (c.Id == r.Id_Colaborador) { horas += r.Horas; extras += r.Extras; } } if (horas != 0) { foreach (Vacacion v in vacaciones) { if (v.Id_Colaborador == c.Id) { vacacion += v.Salario; } } foreach (Aguinaldo a in aguinaldos) { if (a.IdColaborador == c.Id) { aguinaldo += a.Salario; } } foreach (Adelanto a in adelantos) { if (a.IdColaborador == c.Id) { adelanto += a.Monto; } } bruto = (horas * c.Precio) + (extras * (c.Precio * config.Porcentaje_Hora_Extra)) + vacacion + aguinaldo; seguro = (bruto * (tipo == 14 ? (config.Porcentaje_Seguro / 2) : config.Porcentaje_Seguro)) / 100; neto = bruto - (seguro) - adelanto; Int32 id = Convert.ToInt32(fin.Day.ToString() + fin.Month.ToString() + fin.Year.ToString()); pagos.Add(new Pago(flag, c.Id, DateTime.Now.Date, bruto, neto, 0, horas, extras, "No disponible", true, 0, false, vacacion, aguinaldo, adelanto, seguro, id)); avance = ((++flag) * 100) / colaboradores.Count; bgw_calculos.ReportProgress(avance); Thread.Sleep(500); } } } return(true); }