include "../ReglasNegocio/es_retirado.php";
    include "../ReglasNegocio/retiros_custodia.php";
    $nombre = $_POST['NombreRC'];
    $obs = $_POST['obs'];
    if ($nombre == "" || $obs == "") {
        $_SESSION["mensaje"] = "NO HA INGRESADO NOMBRE U OBSERVACION";
    } else {
        $arr = $_SESSION["rcustodia"];
        if (count($arr) == 0) {
            $_SESSION["mensaje"] = "NO HAY MATERIAL PARA INGRESAR";
        } else {
            $retiros = new retiros_custodia();
            $fecha = time();
            $fechaactual = date("Y-m-d h:m:s", $fecha);
            $retiros->Add($nombre, $obs, $fechaactual);
            $listaretiro = $retiros->Select($nombre, $obs, $fechaactual);
            $rowretiros = mysql_fetch_array($listaretiro);
            $id_retiro = $rowretiros["ID_RETIRO_CUSTODIA"];
            $material = new material();
            $asociado = new asociado();
            $folio = $_SESSION["folio_rcustodia"];
            $es_retirado = new es_retirado();
            for ($i = 0; $i < count($arr); $i++) {
                $asociado->Update($arr[$i][0]);
                $material->Update2($arr[$i][0]);
                $es_retirado->Add($arr[$i][0], $id_retiro, $folio, $fechaactual);
            }
        }
    }
    header("Location: paso.php?c=6");
}