<link rel="stylesheet" type="text/css" href="src/css/bootstrap.min.css">


<link rel="stylesheet" type="text/css" href="src/datatable.css">
<link rel="stylesheet" type="text/css" href="src/css/bootstrap-theme.css">
<script src="src/jquery.js"></script>
<script src="src/js/bootstrap.min.js"></script>
<script src="src/moment1.js"></script>
<script src="src/datatables.js"></script>
<script src="src/bootstrap_datatable.js"></script>


<style>
.panel{

}
h3{
    padding:2px;
}
a{
    font-size:18;
}

h1{
    margin:0;
}
.label{
    font-size:18;
}



table{
	font-size:12px;
	color:gray;
	
}

@body{
background: rgb(241,241,241);
background: linear-gradient(0deg, rgba(241,241,241,1) 29%, rgba(223,223,223,1) 49%);
}
body{
    background:#f0f0f0;
}

</style>	

	<br>	<br>
<div class="container" style="width:90%; background:white;">
<div class="row">
	<h3 class="text-primary" align="center"><i class="glyphicon glyphicon-list-alt"></i> Cartera actual</h3>
				<hr>
	<div class="col-md-3">	
	
	<div class="panel panel-default">
		    <div class="panel-heading">
				<div class="tittle">
				<i class="glyphicon glyphicon-euro "></i> TODOS LOS PRESTAMOS
				</div>
				
				</div>
		<div class="panel-body">

 <span>Cant. prestamos</span><span class="pull-right" id="cprestamo1">0.00</span><br>
 <span>Capital prestado</span><span class="pull-right" id="prestado1">0.00</span><br>
   <span>Importe</span><span class="pull-right" id="importe1">0.00</span><br>
 <span>BALNCE TOTAL: </span><span class="pull-right" id="balance1">0.00</span><br>
   </div>
 </div>
 </div>

	<div class="col-md-3">	
   	<div class="panel panel-default">
		    <div class="panel-heading">
				<div class="tittle">
				<i class="glyphicon glyphicon-euro "></i> PRESTAMOS POR FECHA
				</div>
				
				</div>
		<div class="panel-body">

 <span>Cant. prestamos</span><span class="pull-right" id="cprestamo2">0.00</span><br>
 <span>Capital prestado</span><span class="pull-right" id="prestado2">0.00</span><br>
  <span>Importe</span><span class="pull-right" id="importe2">0.00</span><br>
 <span>BALANCE TOTAL: </span ><span class="pull-right label label-success" id="balanc2">0.00</span><br><br>
 
   </div>
 </div>
</div>


	<div class="col-md-3">	
   	<div class="panel panel-default">
		    <div class="panel-heading">
				<div class="tittle">
				<i class="glyphicon glyphicon-euro "></i> COBROS
				</div>
				
				</div>
		<div class="panel-body">

 <span>Cant. cobros</span><span class="pull-right" id="ccobros">0.00</span><br>
 <span>Abonos: </span><span class="pull-right" id="abono">0.00</span><br>
 <span>Redito: </span><span class="pull-right" id="redito">0.00</span><br>
 <span>Mora: </span><span class="pull-right" id="mora">0.00</span><br>
 <hr>
  <span>Cobros movil: </span><span class="pull-right" id="movil">0.00</span><br>
 <span>TOTAL: </span><span class="label label-warning pull-right" id="total_cobro">0.00</span><br>
   </div>
 </div>
</div>



	<div class="col-md-3">	
   	<div class="panel panel-default">
		    <div class="panel-heading">
				<div class="tittle">
				<i class="glyphicon glyphicon-euro "></i> GANANCIAS
				</div>
				
				</div>
		<div class="panel-body">

 <span>TOTAL: </span><span class="label label-primary pull-right" id="ganancia">0.00</span><br>
   </div>
 </div>
</div>



</div>
<br>
<div>
<button onClick="window.location.href='fecha_cartera.php'" class="btn btn-primary">
 	<i class="glyphicon glyphicon-calendar"></i>
 	Cambiar fecha
 </button>

 <button onClick="window.location.href='index.php'" class="btn btn-secundary">
 	<i class="glyphicon glyphicon-home"></i>
 	Salir
 </button>

</div>
<br>

<script type="text/javascript">

	$(document).ready(function(){
		cartera();
	});

function cartera(){
	var f1 = "<?php echo $_GET['fecha1']?>";
	var f2 = "<?php echo $_GET['fecha2']?>";
	var param = "fecha1="+f1+"&fecha2="+f2;
	$.ajax({
		url:"src/cartera.php",
		type:"POST",
		data:{fecha1:f1, fecha2:f2},
		success:function(data){
			data = JSON.parse(data);
			$("#cprestamo1").html(data.prestamos_todo);
			$("#importe1").html(data.importe_todo);
			$("#prestado1").html(data.monto_todo);
			$("#balance1").html(data.balance_todo);

			$("#cprestamo2").html(data.prestamos_por_fecha);
			$("#importe2").html(data.importe_por_fecha);
			$("#prestado2").html(data.monto_por_fecha);
			$("#balance2").html(data.balance_por_fecha);

			$("#abono").html(data.abono);
			$("#redito").html(data.redito);
			$("#mora").html(data.mora);
			$("#total_cobro").html(data.total);
			$("#movil").html(data.movil);
			$("#ccobros").html(data.c_cobros);
			$("#ganancia").html(data.ganancia);

		}
	});

}
</script>