<?php
$dir=mysqli_query($con,"SELECT * FROM cliente where clie_id='$cliente'") or die(mysqli_error($con)); 
$clie=mysqli_fetch_array($dir);
$clie_departamento=$clie['clie_departamento'];
$clie_ciudad=$clie['clie_ciudad'];

$dep=mysqli_query($api,"SELECT * from departments where id='$clie_departamento'");
$depa=mysqli_fetch_array($dep);
$name_departameto=$depa['name'];

$ciu=mysqli_query($api,"SELECT * from municipalities where id='$clie_ciudad'");
$ciud=mysqli_fetch_array($ciu);
$name=$ciud['name'];
?>
<page backtop="1mm" backbottom="5mm" backleft="5mm" backright="5mm" style="font-size: 11pt; font-family: arial" >
    <table cellspacing="0" style="width: 100%;" >
        <tr>
            <td style="width: 48%; color: #444444;">
                <img style="width: 60%;" src="../../../img/<?php echo $empresa;?>.png" alt="Logo"><br>
            </td>
			<td style="width: 40%;font-size:12px;text-align:center;">
				<strong style="font-size:15px"><?php echo $emp_nombre;?></strong><br>
				<strong>Nit: <?php echo $emp_nit;?></strong> <br>
				<strong><?php echo $emp_direccion;?></strong><br>
				<strong><?php echo $emp_correo;?></strong><br>
				<strong>Tel: <?php echo $emp_cel;?> / <?php echo $emp_telefono;?></strong><br>
				<!--<strong>Responsable de IVA </strong><br> 
				<strong>Agente de retención en el impuesto sobre las ventas</strong>-->
			</td>
        </tr>
    </table>
    <table cellspacing="0" style="width: 100%;" >
        <tr>
            <td style="width: 100%;">
            	<table cellspacing="0" style="width: 100%;">
			        <tr>
						<td colspan="2" style="width: 50%;color:white;background-color:#bdc3c7;padding:2px;text-align:center;"> 
							<strong style="font-size:10px;color: #000" >DATOS DEL CLIENTE</strong>
						</td>
					</tr>
					<tr>
						<td style="width: 100%;text-align:left;border:solid 1px #bdc3c7;font-size:10px ;padding-left: 15px"> 
							<p style="padding:-10px;"><strong>NOMBRE: </strong><?php echo $clie['clie_nombre'];?></p>
							<p style="padding:-10px;"><strong>DOCUMENTO: </strong><?php echo $clie['clie_cc'];?></p>
							<p style="padding:-10px;"><strong>TELEFONO: </strong><?php echo $clie['clie_telefono'];?></p>
							<p style="padding:-10px;"><strong>DIRECCION: </strong><?php echo $clie['clie_direccion'];?> </p>
							<p style="padding:-10px;"><strong>CIUDAD: </strong> <?php echo mb_strtoupper($name_departameto);?> - <?php echo mb_strtoupper($name);?></p>
							<p style="padding:-10px;"><strong>CORREO: </strong><?php echo mb_strtoupper($clie['clie_correo']);?> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
						</td>
					</tr>
			    </table>
            </td>
		</tr>
    </table>

 	
	<table  style="width: 100%;">
		<tr>
			<td style="width: 10%; color:white;background-color:#bdc3c7;padding:2px;text-align:center"> 
				<strong style="font-size:10px;color: #000">NUMERO</strong>
			</td>
			<td style="width: 20%; color:white;background-color:#bdc3c7;padding:2px;text-align:center"> 
				<strong style="font-size:10px;color: #000">FECHA</strong>
			</td>
			<td style="width: 50%; color:white;background-color:#bdc3c7;padding:2px;text-align:center"> 
				<strong style="font-size:10px;color: #000">DESCRIPCION</strong>
			</td>
			<td style="width: 20%; color:white;background-color:#bdc3c7;padding:2px;text-align:center"> 
				<strong style="font-size:10px;color: #000">TOTAL</strong>
			</td>
		</tr>
	<?php
	 	$total_abono=0;
		$can2=mysqli_query($con,"SELECT * FROM movimientos where mov_id IN('".$mov_id."')") or die(mysqli_error($con));  
		while($row2=mysqli_fetch_array($can2))
		{
	?>
		<tr style="border:solid 1px #bdc3c7;">
			<td style="width:10%;padding:2px;text-align:center;border-left:solid 1px #bdc3c7; border-bottom:solid 1px #bdc3c7;font-size:10px"> 
				<?php echo $row2['mov_numero'];?>
			</td>
			<td style="width:20%;padding:2px;text-align:center;border-left:solid 1px #bdc3c7; border-bottom:solid 1px #bdc3c7;font-size:10px"> 
				<?php echo $row2['mov_fecha'];?>
			</td>
			<td style="width:50%;padding:2px;text-align:center;border-left:solid 1px #bdc3c7; border-bottom:solid 1px #bdc3c7;font-size:10px"> 
				<?php echo $row2['mov_detalle'];?>
			</td>
			<td style="width: 9%;padding:2px;text-align:right;border-left:solid 1px #bdc3c7;border-right:solid 1px #bdc3c7; border-bottom:solid 1px #bdc3c7;font-size:10px"> 
				<?php echo number_format($row2['mov_total'],0);?>
			</td>

			
		</tr>
	<?php  $total_abono+=$row2['mov_total']; } ?>
		<tr style="border:solid 1px #bdc3c7;">
			<td colspan="3" style="width: 9%;padding:2px;text-align:right;border-left:solid 1px #bdc3c7; border-bottom:solid 1px #bdc3c7;font-size:10px"> 
			</td>
			<td style="width: 9%;padding:2px;text-align:right;border-left:solid 1px #bdc3c7;border-right:solid 1px #bdc3c7; border-bottom:solid 1px #bdc3c7;font-size:10px"> 
				<strong><?php echo number_format($total_abono,0);?></strong>
			</td>
		</tr>
	</table>

<table cellspacing="0" style="width: 100%;padding-top: 5px;">
    <tr>
    	<td style="width:30%;"></td>
        <td style="width:69%;">
        	<table cellspacing="0" style="width: 100%;">
				<tr>
					<td>
						<table cellspacing="0" style="width: 100%;" >
							<tr>
								<td colspan="3" style="width: 100%;padding-bottom: 36px"></td>
							</tr>
							<tr>
								<td style="width: 45%;">_______________________________</td>
								<td style="width: 5%;"></td>
								<td style="width: 45%;">_____________________________</td>	
							</tr>
							<tr>
								<td style="width: 45%;font-size:8px;">ELABORADO POR</td>
								<td style="width: 5%;"></td>
								<td style="width: 45%;font-size:8px;">ACEPTADO POR</td>		
							</tr>
					    </table>
					</td>
				</tr>
		    </table>
        </td>
        <td style="width: 1%;"></td>
	</tr>
</table>

<div style="width:100%; border-top:dashed 1px;margin-top:1mm;"></div>
	
</page>	  