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

	extract($_POST);

	foreach($credito->mostrarTodo("idgrupocredito=".$idgcred." and tipocredito=0") as $f)
    {
    	$credito->eliminar($f['idcredito']);
    }
    $grupocredito->eliminar($idgcred);
    ?>
		<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
?>