<?php
	session_start();
	$ruta="../../../";
	include_once($ruta."class/individualcredito.php");
	$individualcredito=new individualcredito;
	include_once($ruta."class/credito.php");
	$credito=new credito;

	extract($_POST);

	foreach($credito->mostrarTodo("idgrupocredito=".$idicred." and tipocredito=1") as $f)//mantiene el nombre
    {
    	$credito->eliminar($f['idcredito']);
    }
    $individualcredito->eliminar($idicred);
    ?>
		<script  type="text/javascript">
			swal({
				title: "Exito !",
				text: "El crédito fué eliminado correctamente ",
				type: "success",
				showCancelButton: false,
				confirmButtonColor: "#28e29e",
				confirmButtonText: "OK",
				closeOnConfirm: false
			}, function () {      
				location.reload();
			});				
		</script>
	<?php
?>