private Boolean pu_Validar()
        {
            try {
                if (txtUtilidadPorDerechoIndividual.Text == "")
                {
                    MessageBox.Show("El Valor de la Utilidad por Derecho Individual es Obligatorio, revise por favor", "ATENCION", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    txtUtilidadPorDerechoIndividual.Focus();
                    return(false);
                }

                if (txtUtilidadPorCargaFamiliar.Text == "")
                {
                    MessageBox.Show("El Valor de la Utilidad por Carga Familiar es Obligatorio, revise por favor", "ATENCION", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    txtUtilidadPorCargaFamiliar.Focus();
                    return(false);
                }


                if (Convert.ToDouble(txtUtilidadPorDerechoIndividual.Text) <= 0)
                {
                    MessageBox.Show("El Valor de la Utilidad por Derecho Individual debe ser mayor que cero, revise por favor", "ADVERTENCIA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtUtilidadPorDerechoIndividual.Focus();
                    return(false);
                }

                if (Convert.ToDouble(txtUtilidadPorCargaFamiliar.Text) <= 0)
                {
                    MessageBox.Show("El Valor de la Utilidad por Carga Familiar  debe ser mayor que cero, revise por favor", "ADVERTENCIA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtUtilidadPorCargaFamiliar.Focus();
                    return(false);
                }

                if (cmbPeriodos.EditValue == null)
                {
                    MessageBox.Show("Seleccione el periodo", "ADVERTENCIA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtUtilidadPorCargaFamiliar.Focus();
                    return(false);
                }

                if (cmbnomina.EditValue == null)
                {
                    MessageBox.Show("Seleccione la nomina", "ADVERTENCIA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtUtilidadPorCargaFamiliar.Focus();
                    return(false);
                }

                if (cmbnominaTipo.EditValue == null)
                {
                    MessageBox.Show("Seleccione la el proceso", "ADVERTENCIA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtUtilidadPorCargaFamiliar.Focus();
                    return(false);
                }


                if (Convert.ToDouble(TxtUtilidadRepartir.Text) <= 0)
                {
                    MessageBox.Show("El Valor de la Utilidad a repartir debe ser mayor que cero, revise por favor", "ADVERTENCIA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    TxtUtilidadRepartir.Focus();
                    return(false);
                }



                if (TxtUtilidadRepartir.Text == "")
                {
                    MessageBox.Show("Ingres valor de Utilidad a repartir", "ADVERTENCIA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    TxtUtilidadRepartir.Focus();
                    return(false);
                }

                if (cmbnomina.EditValue == null)
                {
                    MessageBox.Show("Seleccione la nomina", "ADVERTENCIA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return(false);
                }
                if (cmbnominaTipo.EditValue == null)
                {
                    MessageBox.Show("Seleccione el tipo de nomina", "ADVERTENCIA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return(false);
                }

                if (cmbPeriodos.EditValue == null)
                {
                    MessageBox.Show("Seleccione el periodo", "ADVERTENCIA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return(false);
                }
                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                Log_Error_bus.Log_Error(ex.ToString()); return(false);
            }
        }
        private void pu_Calcular()
        {
            try {
                TxtUtilidadRepartir.Focus();

                if (pu_Validar())
                {
                    double valorUtilidadIndividual     = 0;
                    double valorUtilidadCarga          = 0;
                    double valorTotalDiasTrab          = 0;
                    double valorAlicuotaIndividual     = 0;
                    double valorAlicuotaCarga          = 0;
                    double valorLimiteDistribucionIESS = 0;
                    double factorB = 0;

                    valorUtilidadIndividual = Convert.ToDouble(txtUtilidadPorDerechoIndividual.Text);
                    valorUtilidadCarga      = Convert.ToDouble(txtUtilidadPorCargaFamiliar.Text);
                    valorTotalDiasTrab      = Convert.ToDouble(colDiasTrab.SummaryText);

                    valorAlicuotaIndividual = valorUtilidadIndividual / valorTotalDiasTrab;

                    //CALCULAR UTILIDAD POR DERECHO INDIVIDUAL
                    foreach (ro_Participacion_Utilidad_Empleado_Info item in oListRo_Empleado_Info)
                    {
                        item.alicuotaIndividual = valorAlicuotaIndividual;
                        item.subTotalIndividual = item.DiasTrabajados * valorAlicuotaIndividual;

                        item.valorEntregar = item.subTotalIndividual + item.subTotalCarga;

                        if (item.cargas > 0)
                        {
                            item.diasTrabAnual = item.diasTrabajo;
                            item.factorA       = item.cargas * item.diasTrabajo;
                            factorB           += item.factorA;
                        }
                    }

                    if (factorB > 0)
                    {
                        valorAlicuotaCarga = valorUtilidadCarga / factorB;
                    }
                    else
                    {
                        valorAlicuotaCarga = 0;
                    }


                    //CALCULAR UTILIDAD POR CARGA FAMILIAR
                    foreach (ro_Participacion_Utilidad_Empleado_Info item in oListRo_Empleado_Info)
                    {
                        item.subTotalCarga = item.factorA * valorAlicuotaCarga;
                        item.alicuotaCarga = valorAlicuotaCarga;

                        item.valorEntregar = item.subTotalIndividual + item.subTotalCarga;


                        if (item.valorEntregar > valorLimiteDistribucionIESS)
                        {
                            item.exedenteIESS  = item.valorEntregar - valorLimiteDistribucionIESS;
                            item.valorEntregar = valorLimiteDistribucionIESS;
                        }
                    }

                    gridEmpleados.RefreshDataSource();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                Log_Error_bus.Log_Error(ex.ToString());
            }
        }
Exemplo n.º 3
0
        private Boolean pu_Validar()
        {
            try {
                if (txtUtilidadPorDerechoIndividual.Text == "")
                {
                    MessageBox.Show("El Valor de la Utilidad por Derecho Individual es Obligatorio, revise por favor", "ATENCION", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    txtUtilidadPorDerechoIndividual.Focus();
                    return(false);
                }

                if (txtUtilidadPorCargaFamiliar.Text == "")
                {
                    MessageBox.Show("El Valor de la Utilidad por Carga Familiar es Obligatorio, revise por favor", "ATENCION", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    txtUtilidadPorCargaFamiliar.Focus();
                    return(false);
                }

                if (txtLimiteDistribucionUtilidad.Text == "")
                {
                    MessageBox.Show("El Valor del Límite de Distribución de la Utilidad es Obligatorio, revise por favor", "ATENCION", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    txtLimiteDistribucionUtilidad.Focus();
                    return(false);
                }

                if (Convert.ToDouble(txtLimiteDistribucionUtilidad.Text) <= 0)
                {
                    MessageBox.Show("El Valor del Límite de Distribución de la Utilidad debe ser mayor que cero, revise por favor", "ATENCION", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    txtLimiteDistribucionUtilidad.Focus();
                    return(false);
                }

                if (Convert.ToDouble(txtUtilidadPorDerechoIndividual.Text) <= 0)
                {
                    MessageBox.Show("El Valor de la Utilidad por Derecho Individual debe ser mayor que cero, revise por favor", "ADVERTENCIA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtUtilidadPorDerechoIndividual.Focus();
                }

                if (Convert.ToDouble(txtUtilidadPorCargaFamiliar.Text) <= 0)
                {
                    MessageBox.Show("El Valor de la Utilidad por Carga Familiar  debe ser mayor que cero, revise por favor", "ADVERTENCIA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtUtilidadPorCargaFamiliar.Focus();
                }



                if (Convert.ToDouble(TxtUtilidadRepartir.Text) <= 0)
                {
                    MessageBox.Show("El Valor de la Utilidad a repartir debe ser mayor que cero, revise por favor", "ADVERTENCIA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    TxtUtilidadRepartir.Focus();
                }



                if (TxtUtilidadRepartir.Text == "")
                {
                    MessageBox.Show("Ingres valor de Utilidad a repartir", "ADVERTENCIA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    TxtUtilidadRepartir.Focus();
                }


                return(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                Log_Error_bus.Log_Error(ex.ToString()); return(false);
            }
        }