Ocultar campo <div> segun fecha
Publicado por Sil (13 intervenciones) el 08/10/2019 16:29:52
Buenas ! necesito ayuda. Quiero ocultar el campo "Datos SB" cuándo pasaron más de 12 meses según la fecha de ingreso del registro.
Mi código es el siguiente:
HTML_
PHP_
Mi código es el siguiente:
HTML_
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<h2>Datos SB</h2>
<div class='itemResultado'>
<!--<div class='itemResultadoLinea'>
<b>DATOS DE SB </b>
</div>-->
<div class='itemResultadoLinea'>
<label>Equipo recibido</label>
<span>
{if $editar==1}
<select id='sltEquipoRecibido'>
<option {if $d.equipo_recibido_sb=='Si'}selected='selected'{/if}>Si</option>
<option {if $d.equipo_recibido_sb!='Si'}selected='selected'{/if}>No</option>
</select>
{else}
{$d.equipo_recibido_sb}
{/if}
</span>
</div>
<div class='itemResultadoLinea'>
<label>Fecha recibido</label>
<span>
{if $editar==1}
<input id='txtFechaRecibido' class='campoFecha' type='text' value='{$d.fecha_recibido_sb}'/>
{else}
{$d.fecha_recibido_sb}
{/if}
</span>
</div>
<div class='itemResultadoLinea'>
<label>Reparado</label>
<span>
{if $editar==1}
<select id='sltReparado'>
<option {if $d.equipo_reparado_sb=='Si'}selected='selected'{/if}>Si</option>
<option {if $d.equipo_reparado_sb!='Si'}selected='selected'{/if}>No</option>
</select>
{else}
{$d.equipo_reparado_sb}
{/if}
</span>
</div>
<div class='itemResultadoLinea'>
<label>Fecha fin de reparación</label>
<span>
{if $editar==1}
<input id='txtFechaReparado' class='campoFecha' type='text' value='{$d.fecha_fin_reparacion_sb}'/>
{else}
{$d.fecha_fin_reparacion_sb}
{/if}
</span>
</div>
<div class='itemResultadoLinea'>
<label>Fecha de entregado</label>
<span>
{if $editar==1}
<input id='txtFechaEntregado' class='campoFecha' type='text' value='{$d.equipo_entregado}'/>
{else}
{$d.equipo_entregado}
{/if}
</span>
</div>
<div class='itemResultadoLinea' style='margin-top:5px;'>
<label style='height:50px;float:left;margin-top:0;'>Comentarios</label>
<span style='float:left;margin-left:5px;'>
{if $editar==1}
<textarea id='txtComentarios' style='height:43px;width:167px;'>{$d.comentarios_sb}</textarea>
{else}
{$d.comentarios_sb}
{/if}
</span>
</div>
<div class='itemResultadoLinea' style='margin-top:5px;'>
<input onclick="guardarCambiosSB('{$d.phone_number}','{$d.nro_cliente}')" type='button' value='Guardar' class='botonUI'/>
</div>
</div>
</div>
{/foreach}
{/if}
PHP_
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
if(isset($_REQUEST['q'])){
_add('q',$_REQUEST['q']);
$texto=trim($_REQUEST['q']);
$texto=str_replace(" ","%",$texto);
$movil=(int)trim($_REQUEST['q']);
$sql="SELECT
TOP 1 *
FROM
beneficio_sb
WHERE
phone_number LIKE '".$movil."%'
OR document LIKE '".$texto."'
OR nro_cliente LIKE '".$texto."'
OR nro_ba LIKE '".$texto."'
OR titular LIKE '%".$texto."%'
OR IMEI LIKE '".$texto."'
ORDER BY
ALTA_BENEFICIO ";
$result=$BASE2->query($sql);
$datos=array();
if($result!=NULL){
if(count($result)>0){
foreach($result as $row){
$alta=date('d/m/Y H:i',strtotime($row['ALTA_BENEFICIO']));
$vencimiento=date('d/m/Y H:i',strtotime($row['VENCIMIENTO_BENEFICIO']));
$orden_reparacion_solicitada=date('d/m/Y H:i',strtotime($row['ORDEN_REPARACION_SOLICITADA']));
if( date('Y',strtotime($row['ORDEN_REPARACION_SOLICITADA']))<=2017 ){
$orden_reparacion_solicitada="";
}
$activo=0;
if(date('d/m/Y H:i')<strtotime($row['VENCIMIENTO_BENEFICIO'])){ $activo=1; }
$fechaRecibido="";
if($row['fecha_recibido_sb']!=NULL){
$fechaRecibido=date('d/m/Y',strtotime($row['fecha_recibido_sb']));
}
$fechaReparado="";
if($row['fecha_fin_reparacion_sb']!=NULL){
$fechaReparado=date('d/m/Y',strtotime($row['fecha_fin_reparacion_sb']));
}
$fechaEntregado="";
if($row['equipo_entregado']!=NULL){
$fechaEntregado=date('d/m/Y',strtotime($row['equipo_entregado']));
}
$datos[]=array(
'phone_number'=>$row['phone_number'],
'document'=>trim($row['document']),
'tipo_doc'=>trim($row['tipo_doc']),
'nro_cliente'=>trim($row['nro_cliente']),
'nro_ba'=>trim($row['nro_ba']),
'titular'=>utf8_decode(trim($row['titular'])),
'codigo_plan'=>$row['codigo_plan'],
'ALTA_BENEFICIO'=>$alta,
'VENCIMIENTO_BENEFICIO'=>$vencimiento,
'ORDEN_REPARACION_SOLICITADA'=>$orden_reparacion_solicitada,
'EQUIPO'=>$row['EQUIPO'],
'IMEI'=>$row['IMEI'],
'equipo_recibido_sb'=>$row['equipo_recibido_sb'],
'fecha_recibido_sb'=>$fechaRecibido,
'equipo_reparado_sb'=>$row['equipo_reparado_sb'],
'fecha_fin_reparacion_sb'=>$fechaReparado,
'equipo_entregado'=>$fechaEntregado,
'comentarios_bgh'=>utf8_decode($row['comentarios_bgh']),
'fecha_generacion'=>date('d/m/Y H:i',strtotime($row['fecha_generacion'])),
'activo'=>$activo
);
//print_r($datos);
}
}
}
_add('datos',$datos);
}
?>
Valora esta pregunta


0