<?
/*
Autor: Lic. Carlos Alberto Vaca Coronado
Version: 3.2.0
*/
session_name('portal_absa');
session_start();
if(!isset($_SESSION['usuario_p_prov_absa']) || trim($_SESSION['usuario_p_prov_absa']) == "" || trim(strtoupper($_SESSION["URL_PORTAL"]."admin.php")) != trim(strtoupper($_SERVER['HTTP_REFERER']))){
	?><script>window.location.href="<?=$_SESSION["URL_PORTAL"]."index.php"?>"</script><?
	exit;
}
require 'conexion/conectar.php';

$conexion = new CONDB();
$conexion->conectar();

$comprobacion = base64_decode($_GET['comprobacion']);

$query_enc = "select fecha_comprobacion,nombre,comentario_comprobacion from recibedoce r, usuariosweb u where upper(concat(comprobacion_prefijo,'-',comprobacion_no))=upper('$comprobacion') and comprobacion_prefijo=prefijo limit 1";


$result_enc = mysqli_query($conexion->CONEXION,$query_enc);

if(mysqli_num_rows($result_enc) > 0){
    $temp_enc = mysqli_fetch_array($result_enc,MYSQLI_ASSOC);
}

$query = "select nombreemi,rfcemisor,serie,folio,uuid,fechadocto,tipomoneda,total from recibedoce where concat(comprobacion_prefijo,'-',comprobacion_no)='$comprobacion'";


$result = mysqli_query($conexion->CONEXION,$query);


?>
<table>
    <tr>
        <td align="left" width="800">
            <img src="Imagenes/logoVimifos.png" width="298" height="92"/>
        </td>
    </tr>
    <tr>
        <td style="border-top: 2px #000000 solid"></td>
    </tr>
	<tr>
        <th align="left">
            Concepto: <?=$temp_enc['comentario_comprobacion']?>
        </th>
    </tr>
    <tr>
        <th align="left">
            Fecha: <?=$temp_enc['fecha_comprobacion']?>
        </th>
    </tr>
    <tr>
        <th align="left">
            Folio - Fisico: <?=strtoupper($comprobacion)?>
        </th>
    </tr>
    <tr>
        <th align="left">
            Funcionario: <?=$temp_enc['nombre']?>
        </th>
    </tr>
    <tr>
        <th align="left">
            Centro de Costos:
        </th>
    </tr>
    <tr>
        <td align="left">
            Facturas
        </td>
    </tr>
    <tr>
        <td>
            <table border="0" style="font-family: Arial; font-size: 10px">
                <tr>
					<th style="background-color: #AAAAAA; border: 1px solid" align="center" width="100">
                        RFC Emisor
                    </th>
                    <th style="background-color: #AAAAAA; border: 1px solid" align="center" width="190">
                        Emisor
                    </th>
                    <th style="background-color: #AAAAAA; border: 1px solid" align="center" width="40">
                        Serie
                    </th>
                    <th style="background-color: #AAAAAA; border: 1px solid" align="center" width="40">
                        Folio
                    </th>
                    <th style="background-color: #AAAAAA; border: 1px solid" align="center" width="150">
                        uuid
                    </th>
                    <th style="background-color: #AAAAAA; border: 1px solid" align="center" width="140">
                        Fecha
                    </th>
                    <th style="background-color: #AAAAAA; border: 1px solid" align="center" width="40">
                        Moneda
                    </th>
                    <th style="background-color: #AAAAAA; border: 1px solid" align="center" width="140">
                        Total
                    </th>
                </tr>
                <?
                $total=0.0000;
                if(mysqli_num_rows($result) > 0){
                    while($temp=  mysqli_fetch_array($result,MYSQLI_ASSOC)){
                ?>
                <tr>
					<td style="border: 1px solid"><?=$temp['rfcemisor']?></td>
					<td style="border: 1px solid"><?=wordwrap($temp['nombreemi'],25,"<br/>")?></td>
                    <td style="border: 1px solid"><?=$temp['serie']?></td>
                    <td style="border: 1px solid"><?=$temp['folio']?></td>
                    <td style="border: 1px solid"><?=$temp['uuid']?></td>
                    <td style="border: 1px solid"><?=$temp['fechadocto']?></td>
                    <td style="border: 1px solid"><?=$temp['tipomoneda']?></td>
                    <td style="border: 1px solid" align="right"><?=number_format($temp['total'], 4, '.',',');?></td>
                </tr>
                <?
                    $total+=(integer) $temp['total'];
                    }
                }
?>
                
                <tr>
                    <td colspan="8" hieght="100px" style=" border: none; border-bottom: 2px #000000 solid;">&nbsp;</td>
                </tr>
                <tr>
                    <th colspan="6" style="border: none"></th>
                    <th align="left" style="border: none">Total:</th>
                    <th align="right" style="border: none"><?=number_format($total, 4, '.',',');?></th>
                </tr>
            </table>
        </td>
    </tr>
</table>
<input type="button" value="Imprimir" onClick="window.print();"/>