Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By herrerajhr
#814166
Hello everybody.

I write because I have one problem with calculated fields in grids of dynaform.

I have two grids, one for the evaluation of some providers and the other to choose the provider that has the best evaluation according to some criteria, which are shown in the upper part of the image attached.

The evaluation grid and the values of the criteria are entered manually, and the supplier selection grid is determined by means of a trigger, which is shown below.
Code: Select all
@=ProveedoresGanadores = array();

// Obtener el valor promedio de los criterios para un proveedor
function valuacion_proveedor($prov) {
    var grid = @=ValidacionProveedor;
    
    for ($i = 1; $i <= count($grid); $i++) {
        if ($grid[$i]['ProvValuacion'] == $prov) 
              return($grid[$i]['TotalPonderado']);
    }
}

 grid = @=RequisicionProveedores;
 grid_ganadores = @=ProveedoresGanadores; 


 for ($i = 1; $i <= count(@=RequisicionProveedores); $i++) {
    $provseleccionado = @=RequisicionProveedores[$i]['proveedor1'];
    $provseleccionado_label = @=RequisicionProveedores[$i]['proveedor1_label'];
    $precioseleccionado = @=RequisicionProveedores[$i]['precio_unitario1'];
    $IGVseleccionado = @=RequisicionProveedores[$i]['IGV1'];
    $ponderacion = valuacion_proveedor($grid[$i]['proveedor1']);
    
    $ponderacion2 = valuacion_proveedor($grid[$i]['proveedor2']);
    
    if ($ponderacion2 > $ponderacion) {
        $provseleccionado = $grid[$i]['proveedor2'];
        $provseleccionado_label = $grid[$i]['proveedor2_label'];
        $precioseleccionado = $grid[$i]['precio_unitario2'];
        $IGVseleccionado = $grid[$i]['IGV2'];
        $ponderacion = valuacion_proveedor($grid[$i]['proveedor2']);        
    }
    
    $ponderacion3 = valuacion_proveedor($grid[$i]['proveedor3']);
    
    if ($ponderacion3 > $ponderacion) {
        $provseleccionado = $grid[$i]['proveedor3'];
        $provseleccionado_label = $grid[$i]['proveedor3_label'];
        $precioseleccionado = $grid[$i]['precio_unitario3'];
        $IGVseleccionado = $grid[$i]['IGV3'];
        $ponderacion = valuacion_proveedor($grid[$i]['proveedor3']);        
    }     
    
    @=ProveedoresGanadores[$i] = array(
        'ItemGanador' => $grid[$i]['item'],
        'ProductoGanador' => $grid[$i]['producto'],
        'CantidadGanador' => $grid[$i]['cantidad'],
        'ProvGanador' => $provseleccionado,
        'ProvGanador_label' => $provseleccionado_label,
        'PrecioGanador' => $precioseleccionado,    
        'TotalIGV' => $IGVseleccionado,
        'Checked' => 0    
    );
     
} 
 
The problem I have is that the calculation operations that I do with the fields of the supplier evaluation grid are not executed or are not assigned to the grid of winning suppliers.
Attachments
Valuation_Image.png
Valuation_Image.png (47.33 KiB) Viewed 2399 times
(608.61 KiB) Downloaded 234 times

Hello. For rental housing, there are software solu[…]

Experience heightened pleasure with Cenforce 100 M[…]

Get an instant solution to move emails to MBOX for[…]

Most Demanding OST to PST Converter

The most demanding OST to PST Converter is TrijaT[…]