<?php
$mov_id=$_GET['mov_id'];
?>
<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>
    <?php
    	$can1=mysqli_query($con,"SELECT * FROM movimientos where mov_id='$mov_id'") or die(mysqli_error($con));  
		$row1=mysqli_fetch_array($can1);
	?>
 	<table cellspacing="0" style="width: 100%;" >
        <tr>
            <td style="width: 70%;">
            	
            </td>
			<td style="width: 30%;">
				<table cellspacing="0" style="width: 100%; padding-left:5px">
			        <tr>
						<td style="width: 100%;color:white;background-color:#bdc3c7;padding:2px;text-align:center"> 
							<strong style="font-size:10px;color: #000">RECIBO N°</strong>
						</td>
					</tr>
					<tr>
						<td style="width: 100%;padding:2px;text-align:center;border:solid 1px #bdc3c7;font-size:12px"> 
							<strong style="color: red"><?php echo $row1['mov_numero'];?></strong>
						</td>
					</tr>
			    </table>
			</td>
		</tr>
    </table>

<?php if ($row1['mov_tipo_movimiento']=='Abono cxc') { 
	$can2=mysqli_query($con,"SELECT * FROM venta_abonos where mov_id='$mov_id'") or die(mysqli_error($con));  
	$row2=mysqli_fetch_array($can2);
	$ventas_ven_id=$row2['ventas_ven_id'];
	$can3=mysqli_query($con,"SELECT * FROM ventas where ven_id ='$ventas_ven_id'") or die(mysqli_error($con));  
	$row3=mysqli_fetch_array($can3);
	$ven_nombre=$row3['ven_nombre'];
?>

	<table cellspacing="0" style="width: 100%; border-top:solid 1px #bdc3c7;border-bottom:solid 1px #bdc3c7;border-left:solid 1px #bdc3c7;border-right:solid 1px #bdc3c7;padding-left: 15px;padding-right: 15px;" >
        <tr>
			<td style="width:30%;padding:2px;text-align:left; font-size:15px;padding-top: 15px;"> 
				RECIBO DE:
			</td>
			<td style="width:70%;padding:2px;text-align:left; border-bottom:solid 1px #bdc3c7;font-size:15px;padding-top: 15px;"> 
				<?php echo $ven_nombre;?>
			</td>
		</tr>
		<tr>
			<td style="width:30%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"> 
				LA SUMA DE:
			</td>
			<td style="width:70%;padding:2px;text-align:left; border-bottom:solid 1px #bdc3c7;font-size:15px;padding-top: 15px;"> 
				<?php echo number_format($row1['mov_total'],0);?> (<?php echo $row1['medio_pago'];?>)
			</td>
		</tr>
		<tr>
			<td style="width:30%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"> 
				POR CONCEPTO DE:
			</td>
			<td style="width:70%;padding:2px;text-align:left; border-bottom:solid 1px #bdc3c7;font-size:15px;padding-top: 15px;"> 
				<?php echo $row1['mov_detalle'];?>
			</td>
		</tr>
		<tr>
			<td colspan="2" style="width:100%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"></td>
		</tr>
    </table>
<?php } ?>
<?php if ($row1['mov_tipo_movimiento']=='Abono apartado') { 
	$can2=mysqli_query($con,"SELECT * FROM venta_apartada_abonos where mov_id='$mov_id'") or die(mysqli_error($con));  
	$row2=mysqli_fetch_array($can2);
	$ventas_apartadas_vena_id=$row2['ventas_apartadas_vena_id'];
	$can3=mysqli_query($con,"SELECT * FROM ventas_apartadas where vena_id='$ventas_apartadas_vena_id'") or die(mysqli_error($con));  
	$row3=mysqli_fetch_array($can3);
	$vena_nombre=$row3['vena_nombre'];
?> 
	<table cellspacing="0" style="width: 100%; border-top:solid 1px #bdc3c7;border-bottom:solid 1px #bdc3c7;border-left:solid 1px #bdc3c7;border-right:solid 1px #bdc3c7;padding-left: 15px;padding-right: 15px;" >
        <tr>
			<td style="width:30%;padding:2px;text-align:left; font-size:15px;padding-top: 15px;"> 
				RECIBO DE:
			</td>
			<td style="width:70%;padding:2px;text-align:left; border-bottom:solid 1px #bdc3c7;font-size:15px;padding-top: 15px;"> 
				<?php echo $vena_nombre;?>
			</td>
		</tr>
		<tr>
			<td style="width:30%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"> 
				LA SUMA DE:
			</td>
			<td style="width:70%;padding:2px;text-align:left; border-bottom:solid 1px #bdc3c7;font-size:15px;padding-top: 15px;"> 
				<?php echo number_format($row1['mov_total'],0);?> (<?php echo $row1['medio_pago'];?>)
			</td>
		</tr>
		<tr>
			<td style="width:30%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"> 
				POR CONCEPTO DE:
			</td>
			<td style="width:70%;padding:2px;text-align:left; border-bottom:solid 1px #bdc3c7;font-size:15px;padding-top: 15px;"> 
				<?php echo $row1['mov_detalle'];?>
			</td>
		</tr>
		<tr>
			<td colspan="2" style="width:100%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"></td>
		</tr>
    </table>

<?php } ?>
<?php if ($row1['mov_tipo_movimiento']=='Abono adelantado') { 
	$can2=mysqli_query($con,"SELECT * FROM abono_adelantado where movimientos_mov_id='$mov_id'") or die(mysqli_error($con));  
	$row2=mysqli_fetch_array($can2);
	$abo_clie_nombre=$row2['abo_clie_nombre'];
	
?> 
	<table cellspacing="0" style="width: 100%; border-top:solid 1px #bdc3c7;border-bottom:solid 1px #bdc3c7;border-left:solid 1px #bdc3c7;border-right:solid 1px #bdc3c7;padding-left: 15px;padding-right: 15px;" >
        <tr>
			<td style="width:30%;padding:2px;text-align:left; font-size:15px;padding-top: 15px;"> 
				RECIBO DE:
			</td>
			<td style="width:70%;padding:2px;text-align:left; border-bottom:solid 1px #bdc3c7;font-size:15px;padding-top: 15px;"> 
				<?php echo $abo_clie_nombre;?>
			</td>
		</tr>
		<tr>
			<td style="width:30%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"> 
				LA SUMA DE:
			</td>
			<td style="width:70%;padding:2px;text-align:left; border-bottom:solid 1px #bdc3c7;font-size:15px;padding-top: 15px;"> 
				<?php echo number_format($row1['mov_total'],0);?> (<?php echo $row1['medio_pago'];?>)
			</td>
		</tr>
		<tr>
			<td style="width:30%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"> 
				POR CONCEPTO DE:
			</td>
			<td style="width:70%;padding:2px;text-align:left; border-bottom:solid 1px #bdc3c7;font-size:15px;padding-top: 15px;"> 
				<?php echo $row1['mov_detalle'];?>
			</td>
		</tr>

		<tr>
			<td style="width:30%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"> 
				TOTAL A PAGAR:
			</td>
			<td style="width:70%;padding:2px;text-align:left; border-bottom:solid 1px #bdc3c7;font-size:15px;padding-top: 15px;"> 
				<?php echo  number_format($row2['abo_saldo']+$row2['abo_valor'],0);?>
			</td>
		</tr>
		<tr>
			<td style="width:30%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"> 
				SALDO PENDIENTE:
			</td>
			<td style="width:70%;padding:2px;text-align:left; border-bottom:solid 1px #bdc3c7;font-size:15px;padding-top: 15px;"> 
				<?php echo number_format($row2['abo_saldo'],0);?>
			</td>
		</tr>
		<tr>
			<td colspan="2" style="width:100%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"></td>
		</tr>
    </table>
<?php } ?>
<?php if ($row1['mov_tipo_movimiento']=='Devolucion de efectivo') { 
	$can2=mysqli_query($con,"SELECT * FROM devolucion_nota_credito where mov_id='$mov_id'") or die(mysqli_error($con));  
	$row2=mysqli_fetch_array($can2);
	$dnc_cliente=$row2['dnc_cliente'];
	$can3=mysqli_query($con,"SELECT * FROM cliente where clie_id ='$dnc_cliente'") or die(mysqli_error($con));  
	$row3=mysqli_fetch_array($can3);
	$clie_nombre=$row3['clie_nombre'];
?>
	<table cellspacing="0" style="width: 100%; border-top:solid 1px #bdc3c7;border-bottom:solid 1px #bdc3c7;border-left:solid 1px #bdc3c7;border-right:solid 1px #bdc3c7;padding-left: 15px;padding-right: 15px;" >
        <tr>
			<td style="width:30%;padding:2px;text-align:left; font-size:15px;padding-top: 15px;"> 
				PAGADO A:
			</td>
			<td style="width:70%;padding:2px;text-align:left; border-bottom:solid 1px #bdc3c7;font-size:15px;padding-top: 15px;"> 
				<?php echo $clie_nombre;?>
			</td>
		</tr>
		<tr>
			<td style="width:30%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"> 
				LA SUMA DE:
			</td>
			<td style="width:70%;padding:2px;text-align:left; border-bottom:solid 1px #bdc3c7;font-size:15px;padding-top: 15px;"> 
				<?php echo number_format($row1['mov_total'],0);?> (<?php echo $row1['medio_pago'];?>)
			</td>
		</tr>
		<tr>
			<td style="width:30%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"> 
				POR CONCEPTO DE:
			</td>
			<td style="width:70%;padding:2px;text-align:left; border-bottom:solid 1px #bdc3c7;font-size:15px;padding-top: 15px;"> 
				<?php echo $row1['mov_detalle'];?>
			</td>
		</tr>
		<tr>
			<td colspan="2" style="width:100%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"></td>
		</tr>
    </table>
<?php } ?>
<?php if ($row1['mov_tipo_movimiento']=='Comprobante de Egreso') { ?> 
<table cellspacing="0" style="width: 100%; border-top:solid 1px #bdc3c7;border-bottom:solid 1px #bdc3c7;border-left:solid 1px #bdc3c7;border-right:solid 1px #bdc3c7;padding-left: 15px;padding-right: 15px;" >
        
		<tr>
			<td style="width:30%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"> 
				EGRESO DE:
			</td>
			<td style="width:70%;padding:2px;text-align:left; border-bottom:solid 1px #bdc3c7;font-size:15px;padding-top: 15px;"> 
				<?php echo number_format($row1['mov_total'],0);?> (<?php echo $row1['medio_pago'];?>)
			</td>
		</tr>
		<tr>
			<td style="width:30%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"> 
				POR CONCEPTO DE:
			</td>
			<td style="width:70%;padding:2px;text-align:left; border-bottom:solid 1px #bdc3c7;font-size:15px;padding-top: 15px;"> 
				<?php echo $row1['mov_detalle'];?>
			</td>
		</tr>
		<tr>
			<td colspan="2" style="width:100%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"></td>
		</tr>
    </table>
<?php } ?>
<?php if ($row1['mov_tipo_movimiento']=='Abono orden de servicio') { 
	$can2=mysqli_query($con,"SELECT * FROM orden_abonos where mov_id='$mov_id'") or die(mysqli_error($con));  
	$row2=mysqli_fetch_array($can2);
	$orden_servicios_ord_id=$row2['orden_servicios_ord_id'];
	$can3=mysqli_query($con,"SELECT * FROM orden_servicios where ord_id='$orden_servicios_ord_id'") or die(mysqli_error($con));  
	$row3=mysqli_fetch_array($can3);
	$ord_clie_nombre=$row3['ord_clie_nombre'];?> 
	<table cellspacing="0" style="width: 100%; border-top:solid 1px #bdc3c7;border-bottom:solid 1px #bdc3c7;border-left:solid 1px #bdc3c7;border-right:solid 1px #bdc3c7;padding-left: 15px;padding-right: 15px;" >
        <tr>
			<td style="width:30%;padding:2px;text-align:left; font-size:15px;padding-top: 15px;"> 
				RECIBI DE:
			</td>
			<td style="width:70%;padding:2px;text-align:left; border-bottom:solid 1px #bdc3c7;font-size:15px;padding-top: 15px;"> 
				<?php echo $ord_clie_nombre;?>
			</td>
		</tr>
		<tr>
			<td style="width:30%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"> 
				LA SUMA DE:
			</td>
			<td style="width:70%;padding:2px;text-align:left; border-bottom:solid 1px #bdc3c7;font-size:15px;padding-top: 15px;"> 
				<?php echo number_format($row1['mov_total'],0);?> (<?php echo $row1['medio_pago'];?>)
			</td>
		</tr>
		<tr>
			<td style="width:30%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"> 
				POR CONCEPTO DE:
			</td>
			<td style="width:70%;padding:2px;text-align:left; border-bottom:solid 1px #bdc3c7;font-size:15px;padding-top: 15px;"> 
				<?php echo $row1['mov_detalle'];?>
			</td>
		</tr>
		<tr>
			<td colspan="2" style="width:100%;padding:2px;text-align:left;font-size:15px;padding-top: 15px;"></td>
		</tr>
    </table>

<?php } ?>

    <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>	  