Oracle - Evolution 1.19.1.2

en una planilla de pago de aguinaldo con formulación en C# el cliente registró un descuento eventual y al generar la planilla dio el siguiente error:

2020-12-08 19:12:24,661 [87] INFO  c9f09da1-3a28-41b8-8009-97d7660c550e - Cerrando: [IngresosPlanillaAnterior]
2020-12-08 19:12:24,661 [48] INFO  c9f09da1-3a28-41b8-8009-97d7660c550e - Cerrando: [Emp_OtrosIngresos]
2020-12-08 19:12:24,786 [78] FATAL c9f09da1-3a28-41b8-8009-97d7660c550e - Error al actualizar en la base los cursores modificables de la formulación del tipo de planilla 3-Aguinaldo
System.AggregateException: One or more errors occurred. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at Oracle.ManagedDataAccess.Client.OracleDataAdapter.OnRowUpdated(RowUpdatedEventArgs value)
   at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
   at Oracle.ManagedDataAccess.Client.OracleDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
   at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
   at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
   at System.Data.Common.DbDataAdapter.Update(DataSet dataSet)
   at Aseinfo.VH4.MicroServices.GenPla.Ejecutores.NetLangCursor.CloseCursor() in C:\vh4\VH4\MicroServices\GenPla\NetLang\NetLangCursor.cs:line 78
   at Aseinfo.VH4.MicroServices.GenPla.Ejecutores.EjecutorFormulacionNetLang.<>c__DisplayClass7_0.<EjecutarFormulas>b__8(String key) in C:\vh4\VH4\MicroServices\GenPla\NetLang\EjecutorFormulacionNetLang.cs:line 155
   at System.Threading.Tasks.Parallel.<>c__DisplayClass31_0`2.<ForEachWorker>b__0(Int32 i)
   at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object <p0>)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
   at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IList`1 list, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
   at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)
   at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, Action`1 body)
   at Aseinfo.VH4.MicroServices.GenPla.Ejecutores.EjecutorFormulacionNetLang.EjecutarFormulas() in C:\vh4\VH4\MicroServices\GenPla\NetLang\EjecutorFormulacionNetLang.cs:line 149
---> (Inner Exception #0) System.NullReferenceException: Object reference not set to an instance of an object.
   at Oracle.ManagedDataAccess.Client.OracleDataAdapter.OnRowUpdated(RowUpdatedEventArgs value)
   at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
   at Oracle.ManagedDataAccess.Client.OracleDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
   at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
   at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
   at System.Data.Common.DbDataAdapter.Update(DataSet dataSet)
   at Aseinfo.VH4.MicroServices.GenPla.Ejecutores.NetLangCursor.CloseCursor() in C:\vh4\VH4\MicroServices\GenPla\NetLang\NetLangCursor.cs:line 78
   at Aseinfo.VH4.MicroServices.GenPla.Ejecutores.EjecutorFormulacionNetLang.<>c__DisplayClass7_0.<EjecutarFormulas>b__8(String key) in C:\vh4\VH4\MicroServices\GenPla\NetLang\EjecutorFormulacionNetLang.cs:line 155
   at System.Threading.Tasks.Parallel.<>c__DisplayClass31_0`2.<ForEachWorker>b__0(Int32 i)
   at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object <p0>)<---

2020-12-08 19:12:24,802 [78] ERROR c9f09da1-3a28-41b8-8009-97d7660c550e - Error al ejecutar las fórmulas del tipo de planilla Aguinaldo periodo 219

Revisando me dí cuenta que el error da si llama al procedimiento agrega descuentos historial revise el cursor de descuentos eventuales y justo solo regresa un registro y esta accesible para el tipo de planilla, verifiqué que el procedimiento insertaba a la tabla tmp dss descuentos, que el cursor DescuentosEstaPlanilla este accesible y que todos los campos esten visibles para el procedimiento, como la analogía de funcionamiento con el ingreso eventual es similar eliminé el descuento eventual y cree un ingreso eventual el cual pagó sin problema.

una característica de la formulación es que la formulación de salarios está en vbscript. a continuación, comparto el factor de descuentos eventuales, el procedimiento de histórico y la configuración del cursor "DescuentosEstaPlanilla".

public double GT_otrosdescuentos_a()
{

    double valor =0.00;
    double liquido = 0.00;
    double sum = 0.00;
    short tipo_des = 0;

    liquido = Convert.ToDouble(Factores["GT_TotalIngresos_a"].Value);

    NetLangCursor rs = Emp_OtrosDescuentos;

    if(!rs.BOF) 
    {
    rs.MoveFirst();

        while(!rs.EOF) 
        {
            valor = Convert.ToDouble(rs.Fields("ods_valor_a_descontar").Value);

            if (valor < liquido )
            {
                liquido = liquido - valor;
                sum = sum + valor;
                tipo_des = Convert.ToInt16(rs.Fields("ods_codtdc").Value);

                agrega_descuentos_historial_cs( Cursores["DescuentosEstaPlanilla"],
                                                Convert.ToInt32(Emp_InfoSalario.Fields("EMP_CODIGO").Value),
                                                Convert.ToInt32(Pla_Periodo.Fields("ppl_codigo").Value),
                                                tipo_des,
                                                valor,
                                                0,
                                                0,
                                                Pla_Periodo.Fields("tpl_codmon").Value.ToString(),                                                      
                                                0,
                                                "Dias"
                                            );

                //rs.Fields("ods_aplicado_planilla").Value = 1;
            }
            else
            {
                //rs.Fields("ods_aplicado_planilla").Value = 0;
            }

            rs.MoveNext();
        }

    }

    return sum;

}

    public void agrega_descuentos_historial_cs(NetLangCursor dss_descuentos, int codEMP, int codPPL, short codTDC, double Valor, double ValorPatronal, double IngresoAfecto, string codMON, double Tiempo, string UnidadTiempo) {

    dss_descuentos.AddNew();

    dss_descuentos.Fields("dss_codppl").Value = codPPL;
    dss_descuentos.Fields("dss_codemp").Value = codEMP;
    dss_descuentos.Fields("dss_codtdc").Value = codTDC;
    dss_descuentos.Fields("dss_valor").Value = Valor;
    dss_descuentos.Fields("dss_valor_patronal").Value = ValorPatronal;
    dss_descuentos.Fields("dss_ingreso_afecto").Value = IngresoAfecto;
    dss_descuentos.Fields("dss_codmon").Value = codMON;
    dss_descuentos.Fields("dss_tiempo").Value = Tiempo;

    if(String.IsNullOrEmpty(UnidadTiempo))
    {
        dss_descuentos.Fields("dss_unidad_tiempo").Value = "";
    }
    else
    {
        dss_descuentos.Fields("dss_unidad_tiempo").Value = UnidadTiempo;
    }

    Agrupadores.SumaRubro("D", codTDC, Valor);
}

cursor (la prueba también se hizo con select * from ...)

select dss_codigo, dss_codppl, dss_codemp, dss_codtdc, dss_valor, dss_valor_patronal, dss_ingreso_afecto, dss_codmon, dss_tiempo, dss_unidad_tiempo, dss_usuario_grabacion, dss_fecha_grabacion
from tmp_dss_descuentos
where dss_codppl = $$CODPPL$$
   and sal.empleado_en_gen_planilla('$$SESSIONID$$', dss_codemp) = 1

alt text

asked 08 Dec '20, 19:39

Jimy%20Tobar's gravatar image

Jimy Tobar ♦♦
(suspended)
accept rate: 56%

edited 09 Dec '20, 12:43


Si gustas verificar en la formulación que nos esta funcionado utilizamos el procedimiento agrega_descuentos_historial siguiente

public void agrega_descuentos_historial(NetLangCursor dss_descuentos, int codEMP, int codPPL, short codTDC, double Valor, double ValorPatronal, double IngresoAfecto, string codMON, double Tiempo, string UnidadTiempo) {

    dss_descuentos.AddNew();

    dss_descuentos.Fields("dss_codppl").Value = codPPL;
    dss_descuentos.Fields("dss_codemp").Value = codEMP;
    dss_descuentos.Fields("dss_codtdc").Value = codTDC;
    dss_descuentos.Fields("dss_valor").Value = Valor;
    dss_descuentos.Fields("dss_valor_patronal").Value = ValorPatronal;
    dss_descuentos.Fields("dss_ingreso_afecto").Value = IngresoAfecto;
    dss_descuentos.Fields("dss_codmon").Value = codMON;
    dss_descuentos.Fields("dss_tiempo").Value = Tiempo;

    if(String.IsNullOrEmpty(UnidadTiempo))
        dss_descuentos.Fields("dss_unidad_tiempo").Value = " ";
    else
        dss_descuentos.Fields("dss_unidad_tiempo").Value = UnidadTiempo;

    Agrupadores.SumaRubro("D", codTDC, Valor);
}

adicional, la formula de OtrosDescuentos de tipo Money

public double OtrosDescuentos() {
    double sum = 0;
    double desc = 0;
    double liquido = cDbl(Factores["TotalIngresos"].Value) - cDbl(Factores["TotalDescuentos"].Value);

    var existeProteccion = cInt(PeriodoPlanilla.Fields("tpl_garantia_ingreso_minimo").Value) == 1;
    string tipoProteccion = (string)PeriodoPlanilla.Fields("tpl_tipo_garantia").Value;
    double valorProteccion = cDbl(PeriodoPlanilla.Fields("tpl_ingreso_minimo").Value);
    double tiempo = 0.00;
    string unidad = "";

    if (tipoProteccion == "Porcentaje"){
        valorProteccion = Math.Round(cDbl(Factores["TotalIngresos"].Value) * valorProteccion / 100.00 + 0.000001, 2);
    }

    while (!Emp_OtrosDescuentos.EOF){

        if (cInt(Emp_OtrosDescuentos.Fields("ods_es_valor_fijo").Value)==1){
            tiempo = 0;
            unidad = " ";
            desc = cDbl(Emp_OtrosDescuentos.Fields("ods_valor_a_descontar").Value);

        }else{
            tiempo = cDbl(Emp_OtrosDescuentos.Fields("ods_num_horas").Value);
            unidad = "Horas";
            desc = Math.Round(cDbl(Factores["SalarioMensual"].Value)/240.00*tiempo,2);
        }

        if (liquido - desc > 0){
            if (existeProteccion){
                if (liquido - desc < valorProteccion){
                    Emp_OtrosDescuentos.Fields("ods_aplicado_planilla").Value = 0;
                }else{
                    liquido += -desc;
                    sum += desc;

                    Emp_OtrosDescuentos.Fields("ods_aplicado_planilla").Value = 1;

                    agrega_descuentos_historial(Cursores["DescuentosEstaPlanilla"],
                        cInt(Emp_OtrosDescuentos.Fields("ods_codemp").Value),
                        cInt(PeriodoPlanilla.Fields("ppl_codigo").Value),
                        (short)cInt(Emp_OtrosDescuentos.Fields("ods_codtdc").Value),
                        desc,
                        0,
                        0,
                        (string)Emp_OtrosDescuentos.Fields("ods_codmon").Value,
                        tiempo,
                        unidad);  
                }
            }else{
                liquido += - desc;
                sum += desc;
                Emp_OtrosDescuentos.Fields("ods_aplicado_planilla").Value = 1;

                agrega_descuentos_historial(Cursores["DescuentosEstaPlanilla"],
                    cInt(Emp_OtrosDescuentos.Fields("ods_codemp").Value),
                    cInt(PeriodoPlanilla.Fields("ppl_codigo").Value),
                    (short)cInt(Emp_OtrosDescuentos.Fields("ods_codtdc").Value),
                    desc,
                    0,
                    0,
                    (string)Emp_OtrosDescuentos.Fields("ods_codmon").Value,
                    tiempo,
                    unidad);
            }
        }else{
            Emp_OtrosDescuentos.Fields("ods_aplicado_planilla").Value = 0;
        }

        Emp_OtrosDescuentos.MoveNext();
    }

    Factores["TotalDescuentos"].Value = cDbl(Factores["TotalDescuentos"].Value) + sum;
    return sum;
}
link

answered 09 Dec '20, 10:11

Hazel%20Paz's gravatar image

Hazel Paz
(suspended)
accept rate: 0%

edited 09 Dec '20, 10:17

sbarahona's gravatar image

sbarahona ♦♦
(suspended)

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Evolution en BitBucket

En este sitio puede acceder al código fuente, centro de descargas y reportar bugs, propuestas y mejoras para Evolution.

Evolution en JIRA

En este sitio puedes sugerir nueva funcionalidad para Evolution, o puedes votar por la funcionalidad ya propuesta por otros usuarios.

Tags:

×1
×1

Asked: 08 Dec '20, 19:39

Seen: 592 times

Last updated: 09 Dec '20, 12:43

Related questions

[Acerca de] [Preguntas Frecuentes] [Privacidad] [Soporte] [Contacto]
Copyright 2013-2018. Asesores en Informática