From 515731adf83570b71df0669505343b27f0f641f1 Mon Sep 17 00:00:00 2001 From: "alejandro.lara" Date: Fri, 22 Mar 2024 13:07:43 -0600 Subject: [PATCH] Formatos de fechas --- action/solicitud_insert.php | 18 ++++++++++++------ action/solicitud_update.php | 22 +++++++++++++--------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/action/solicitud_insert.php b/action/solicitud_insert.php index 1c17fd4..dc1a7c4 100644 --- a/action/solicitud_insert.php +++ b/action/solicitud_insert.php @@ -67,6 +67,9 @@ $hora = $hora_ini.":".$min_ini.":00"; switch($tipo){ case 1://Reposición + $fecha_nueva = $fecha; + $fecha_clase = $fecha_falta; + $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $dia_new = date('w', strtotime($fecha_new)); @@ -82,27 +85,30 @@ switch($tipo){ echo intval($dia)." != ".intval($dia_falta);*/ exit(); } - $fecha_nueva = date('d/m/Y', strtotime($fecha_new)); - $fecha_clase = date('d/m/Y', strtotime($fecha_falta)); + break; case 2://Cambio + $fecha_nueva = $fecha_cambio; + $fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d'); $dia_falta = date('w', strtotime($fecha_cambio)); - $fecha_nueva = date('d/m/Y', strtotime($fecha_cambio)); break; case 3://Solicitud de espacio + $fecha_nueva = $fecha; + $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $dia_new = date('w', strtotime($fecha_new)); - $fecha_nueva = date('d/m/Y', strtotime($fecha_new)); break; case 4://Cambio permanente + $fecha_nueva = $fecha_new; + $fecha_clase = $fecha_cambio; + $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; + $fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d')." ".$hora; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $dia_new = date('w', strtotime($fecha_new)); - $fecha_nueva = date('d/m/Y', strtotime($fecha_new)); - $fecha_clase = date('d/m/Y', strtotime($fecha_cambio)); break; } diff --git a/action/solicitud_update.php b/action/solicitud_update.php index 9e0806f..96c497e 100644 --- a/action/solicitud_update.php +++ b/action/solicitud_update.php @@ -64,6 +64,9 @@ $hora = $hora_ini.":".$min_ini.":00"; switch($tipo){ case 1://Reposición + $fecha_nueva = $fecha; + $fecha_clase = $fecha_falta; + $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $dia_new = date('w', strtotime($fecha_new)); @@ -79,27 +82,28 @@ switch($tipo){ echo intval($dia)." != ".intval($dia_falta);*/ exit(); } - $fecha_nueva = date('d/m/Y', strtotime($fecha_new)); - $fecha_clase = date('d/m/Y', strtotime($fecha_falta)); + break; case 2://Cambio + $fecha_nueva = $fecha_cambio; + $fecha_cambio = DateTime::createFromFormat('d/m/Y', $fecha_cambio)->format('Y-m-d'); $dia_falta = date('w', strtotime($fecha_cambio)); - $fecha_nueva = date('d/m/Y', strtotime($fecha_cambio)); break; case 3://Solicitud de espacio + $fecha_nueva = $fecha; + $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $dia_new = date('w', strtotime($fecha_new)); - $fecha_nueva = date('d/m/Y', strtotime($fecha_new)); break; case 4://Cambio permanente + $fecha_nueva = $fecha_new; + $fecha_clase = $fecha_cambio; + $fecha_new = DateTime::createFromFormat('d/m/Y', $fecha)->format('Y-m-d')." ".$hora; $fecha_fin_new = date("Y-m-d", strtotime($fecha_new))." ".$duracion_tiempo; $dia_new = date('w', strtotime($fecha_new)); - - $fecha_nueva = date('d/m/Y', strtotime($fecha_new)); - $fecha_clase = date('d/m/Y', strtotime($fecha_cambio)); break; } @@ -164,11 +168,11 @@ switch($tipo){ break; case 4: $db_params=[ - "id"=>$id, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof, + "id"=>$id, ":f_falta"=>$fecha_clase, ":f_nueva"=>$fecha_new, ":hora_nueva"=>$hora, ":prof"=>$prof, ":desc"=>$comentario, ":alumnos"=>$alumnos, ":aula"=>$aula, ":duracion"=>$duracion_tiempo, ":hor"=>$horario, ":bloque"=>$bloque, ":ciclo"=>$ciclo ]; - $query = ":id, NULL, :f_nueva, :hora_nueva, :prof, :desc, NULL, :alumnos, :aula, NULL, :duracion, :hor, :bloque, :ciclo, NULL, NULL"; + $query = ":id, :f_falta, :f_nueva, :hora_nueva, :prof, :desc, NULL, :alumnos, :aula, NULL, :duracion, :hor, :bloque, :ciclo, NULL, NULL"; $asunto = "Solicitud - Cambio permanente"; $texto = "

Se actualizó una solicitud de asignación de salón permanente.

"; $texto .= "

".mb_strtoupper($materia_rs["materia_nombre"])." del día ".$fecha_clase." a las ".$hora_orig." hrs. se propone cambiar para el ".$fecha_nueva." a las ".$hora." hrs.";