call the same field 2 times

call the same field 2 times

rrzavaletarrzavaleta Posts: 78Questions: 52Answers: 2

Hi, I 'm with a contedo of days based on a function date1 is in the database and the optengo date2 php .

But now I have a conflict with the call from the same field , this time I need normally displayed.

the field is :
MVR_ORDEN.F_INGRESO

How I can send him to call otravez but showing your data unchanged .. ?

Ie tango call 2 times the same field in the table, but with its normal date format and the other with the result of the function applied

{Data : " MVR_ORDEN.F_INGRESO " width: "5%" } , // display the date in standard format
{Data : " MVR_ORDEN.F_INGRESO " width: "5%" } , // displaying the integer result of the function

this is the script

// Alias Editor classes so they are easy to use
function dias_transcurridos($fecha_i,$fecha_f)
{
$dias = (strtotime($fecha_i)-strtotime($fecha_f))/86400;
$dias = abs($dias); $dias = floor($dias);
return $dias;
}

//echo $fecha;

use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Join,
DataTables\Editor\Validate;

// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'MVR_ORDEN' )
->pkey( 'ID_ORDEN')
->fields(
Field::inst( 'MVR_ORDEN.ID_ORDEN'),
Field::inst( 'MVR_ORDEN.ID_ASEGURADORA'),
Field::inst( 'ING_PERSONA.NOM_RAZON_SOCIAL' ),

    Field::inst( 'MVR_ORDEN.ID_CENTRO_REP'),
    Field::inst( 'MVR_CENTRO_REP.CENTRO' ),

    Field::inst( 'MVR_ORDEN.NUM_SINIESTRO'),        
    Field::inst( 'MVR_ORDEN.ID_TIPO_ESTILO'),
    Field::inst( 'ING_ESTILOS.DESC_TIPO_ESTILO' ),  

    Field::inst( 'MVR_ORDEN.NUM_ORDEN'),
    Field::inst( 'MVR_ORDEN.SIT_ORDEN'),
    Field::inst( 'ING_VALOR_CAMPO.DESC_VALOR' ),

    Field::inst('MVR_ORDEN.F_INGRESO')
                 ->getFormatter( function  ( $val ) {
              $fechadebase = $val;
              $fechaactual=date("Y/m/d");
              $val = dias_transcurridos($fechadebase,$fechaactual);
              return($val);  

        } ),        
    Field::inst( 'MVR_ORDEN.CVE_proceso') //CAMBIAR A CVE_ETAPA



                 )
 ->leftJoin( 'ING_PERSONA', 'ING_PERSONA.ID_ASEGURADORA', '=', 'MVR_ORDEN.ID_ASEGURADORA' )
 ->leftJoin( 'MVR_CENTRO_REP', 'MVR_CENTRO_REP.ID_CENTRO_REP', '=', 'MVR_ORDEN.ID_CENTRO_REP' ) 
  ->leftJoin( 'ING_ESTILOS', 'ING_ESTILOS.ID_ESTILO', '=', 'MVR_ORDEN.ID_TIPO_ESTILO' ) 
  ->leftJoin( 'ING_VALOR_CAMPO', 'ING_VALOR_CAMPO.VAL_CAMPO', '=', 'MVR_ORDEN.SIT_ORDEN' ) 
->process( $_POST )
->json();
This discussion has been closed.