header("Location: paso.php?c=3"); } else { include "../ReglasNegocio/bodega.php"; include "../ReglasNegocio/custodia.php"; include "../ReglasNegocio/asociado.php"; include "../ReglasNegocio/unidad.php"; include "../ReglasNegocio/material.php"; $ingresado_por = $_POST['NombreF']; if ($ingresado_por == "") { $_SESSION["MensajeIC"] = "NO HA INGRESADO NOMBRE DE FUNCIONARIO"; } else { $procedencia = $_POST['unidadp']; $id_bodega = $_POST['Bodegas']; $observacion = $_POST['ObservacionC']; $tipo = $_POST['Tipos']; $custodia = new custodia(); $fecha = time(); $fechaactual = date("Y-m-d", $fecha); $reservado = 0; //checkbox if ($_POST['reservado'] == "on") { $reservado = 1; } //arreglo lista de materiales en custodia $arr = $_SESSION["custodia"]; if (count($arr) == 0) { $_SESSION["MensajeIC"] = "NO HAY MATERIAL PARA INGRESAR A CUSTODIA"; } else { //insertar en custodia $custodia->Add($ingresado_por, $fechaactual, $tipo, $observacion, $reservado); //obtener id custodia
$listmaterial = $material->Select($numeroi); if ($listmaterial == null) { $_SESSION["mensaje"] = "NO EXISTE EL MATERIAL EN CUSTODIA"; } else { $asociado = new asociado(); $listaa = $asociado->SelectM($numeroi); $arr2 = mysql_fetch_array($listaa); if ($arr2 == null) { $_SESSION["mensaje"] = "NO EXISTE EL MATERIAL EN CUSTODIA"; } else { if ($arr2["ESTADO_RETIRO_ASOCIADO"] == 1) { $_SESSION["mensaje"] = "EL MATERIAL YA FUE RETIRADO"; } else { //resto a una fecha la otra $idcustodia = $arr2["ID_CUSTODIA"]; $custodia = new custodia(); $scustodia = $custodia->Select($idcustodia); $rowcustodia = mysql_fetch_array($scustodia); $timestamp2 = $rowcustodia["FECHAINGRESO_CUSTODIA"]; $fecha = time(); ${$timestamp1} = date("Y-m-d", $fecha); $segundos_diferencia = $timestamp1 - $timestamp2; //echo $segundos_diferencia; //convierto segundos en días $dias_diferencia = $segundos_diferencia / (60 * 60 * 24); //obtengo el valor absoulto de los días (quito el posible signo negativo) $dias_diferencia = abs($dias_diferencia); //quito los decimales a los días de diferencia $dias_diferencia = floor($dias_diferencia); //echo $dias_diferencia; $rowmaterial = mysql_fetch_array($listmaterial);