<?php


$mpdf = Yii::createComponent('application.extensions.MPDF52.mpdf');

//$html=''.$model->fecha_comprobante.'<br>'.$model->fecha_final.'<br>'.$model->id_cuenta.'<br>'.$model->cuenta_hasta.'';
$f1=$_GET['fecha1'];
$f2=$_GET['fecha2'];
$c1=$_GET['c1'];
$c2=$_GET['c2'];
$hd=$_GET['hd'];
$tipo=$_GET['tipo'];

//------------------------------------------------------------------------------
ob_start();
?>
<style type="text/css">
    
    .titulo{
        text-align: center; 
        font-weight: bold;
        border: 1px solid black;
    }
    
    .cuenta_alto_nivel{
        text-transform: uppercase;
        font-weight: bold;
        border-bottom: 1px solid black;
        padding-top: 10px;
    }
    
    .listado{
        font-size: 12px;     
    }
    .listado td{
        padding-left: 8px;
        padding-right: 8px;
    }
    
    .total{
        font-size: 14px;
        font-weight: bold;
        background-color: Gainsboro;
    }
    
    @media print {
        thead { display: table-header-group; }
    }
    
    
</style>



<?php

$criteria = new CDbCriteria;
#Armamos la condición
$criteria->condition = "fecha >= '2015-01-01' AND fecha <= '2016-12-01'"; 
#Enviamos el query al modelo
$model_detalle = MayorAnaliticoDetalle::model()->findAll($criteria);

?>
<table class="listado" style="width: 100%;" border="0" cellpadding="0" cellspacing="0">    
    <thead>
        <tr>
            <th class="titulo" style="width: auto;">Fecha</th>
            <th class="titulo" style="width: auto;">Nro. Comprobante</th>
            <th class="titulo" style="width: auto;">Ref.</th>
            <th class="titulo" style="width: auto;">Descripcion</th>
            <th class="titulo" style="width: auto;">Monto Debe</th>
            <th class="titulo" style="width: auto;">Monto Haber</th>
            <th class="titulo" style="width: auto;">Saldo</th>
            <th class="titulo" style="width: auto;">Fecha asiento</th>
        </tr>
    </thead>
    <tbody>
        <?php foreach($model_detalle as $detalle):  ?>
        <tr>
            <td style="width: auto;"><?=$detalle->fecha?></td>
            <td style="width: auto;"><?=$detalle->nro_comprobante?></td>
            <td style="width: auto;"><?=""?></td>
            <td style="width: auto;"><?=$detalle->descripcion?></td>
            <td style="width: auto;"><?=$detalle->monto_debe?></td>
            <td style="width: auto;"><?=$detalle->monto_haber?></td>
            <td style="width: auto;"><?=$detalle->monto_debe-$detalle->monto_haber?></td>
            <td style="width: auto;"><?=$detalle->fecha_creado?></td>
        </tr>
        <?php endforeach;  ?>
    </tbody>
    <!--tbody>
    </tbody-->
</table>
        
        
        
</>
<?php
//die();//CAMB
$contenido = ob_get_clean();

//echo $contenido;

//cabecera pagina
ob_start();
?>
<div style="text-align: center; font-weight: bold; width: 100%;">
    <?=Empresa::RazonSocial()?>
    <br/>
    <?="SECTOR: ".Empresa::Sector()."&nbsp;&nbsp;&nbsp; NÚMERO DE REGISTRO: ".Empresa::RegistroSUDECA()?>
    <br/>
    <?='MAYOR ANALITICO AL '?>
    <br/>
    <?='(EXPRESADO EN Bs.)'?>
<br/><br/>   

<?php
$cabecera = ob_get_clean();



$mpdf=new mPDF('win-1252','LETTER','','',9,9,35,10,5,5);
$mpdf->SetHTMLHeader($cabecera);
$mpdf->SetFooter("Emitido: ".date('d/m/Y h:i:s a')." - Página {PAGENO} de {nb}");
$mpdf->WriteHTML($contenido);
$mpdf->Output();
exit;
//echo $html;
?>