
<?php
/* @var $this CobroController */
/* @var $dataProvider CActiveDataProvider */
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});

$('.search-form form').submit(function(){
	$('#rendicion-grid').yiiGridView('update', {
		data: $(this).serialize()
	});
        $('#total').yiiGridView('update', {
		data: $(this).serialize()
	});
	return false;
});
");

$v='FALSE';

    if(!empty($_SESSION['id_perfil']) and (($_SESSION['id_perfil']=='1' ))){
        $v='TRUE';
    }


?>


            <div class="row justify-content-end">
                <div class="col-4 ">
               <?php
        $pageSize = Yii::app()->user->getState('pageSize', Yii::app()->params['defaultPageSize']);
        echo
        'Ver ' .
         CHtml::dropDownList('pageSize', $pageSize, Utility::listaPageSize(), array(
            'onchange' => "$.fn.yiiGridView.update('cobro-grid',{ data:{pageSize: $(this).val() }})",
        ))
         . ' Registros';
        ?>
                    
                </div>
                <div class="col-8 text-right" >
                    
                    
                                  <?php
                     $this->widget('booster.widgets.TbButton', array(
                        'context'=>'primary',
                         'label'=>'AGREGAR',
                         'buttonType' => 'link',
                         'icon' => 'fa fa-plus fa-lg',
                         'url'=>Yii::app()->createUrl('rendicion/create'),
                          'htmlOptions' => array(
                                                'data-toggle' => "tooltip",
                                                'data-original-title' => 'AGREGAR',
                                    
                                            ),  
                     ));
                     ?> 
                    
    
              
                    
                         <?php
                         $this->widget('booster.widgets.TbButton', array(
                        'context'=>'info',
                  
                          'label' => 'BUSCAR',
                                            'icon' => 'fa fa-search',
                                            'htmlOptions' => array(
                                                'class' => 'search-button ',
                                                'data-toggle' => "tooltip",
                                                'data-original-title' => 'BUSCAR',
                                        
                                            ),
                                            'url' => '#',
                     ));
                     ?> 
                    
                                        <?php
                         $this->widget('booster.widgets.TbButton', array(
                        'context'=>'danger',
                         'buttonType' => 'link',
                             
                              'label' => ' REFRESCAR',
                                            'icon' => 'fa fa-refresh ',
                                            'htmlOptions' => array(
                                                'class'=>'text-capitalize',
                                                'data-toggle' => "tooltip",
                                                'data-original-title' => 'REFRESCAR LISTA',
                                                'onClick' => 'window.location="' . Yii::app()->createUrl('rendicion') . '"; ',
                                 
                                            ),
                                              'url' => '#',
                     ));
                     ?>



     </div>
        </div>

   

<div class="search-form" style="display: none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div>


<div class='table-responsive'>   
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'rendicion-grid',
	'dataProvider'=>$model->search(),
        'pager' => array('cssFile' => Yii::app()->baseUrl.'/public/css/tablas.css'),
	'filter'=>$model,
	'columns'=>array(
	
            array(
                'value' => '$data->id',
                'type' => 'text',
                'name' => 'id',
                'htmlOptions' => array('class' => 'text-center'),
                ),
                 array(
                'filter'=> Gestor::lista(),
                'value' => 'Gestor::descripcion($data->id_gestor)',
                'type' => 'text',
                'name' => 'id_gestor',
                'htmlOptions' => array('class' => 'text-center'),
                ),
                 array(
                'value' => '$data->fecha',
                'type' => 'text',
                'name' => 'fecha',
                'htmlOptions' => array('class' => 'text-center'),
                ),
             
                array(
                'value' => '$data->efectivo',
                'type' => 'text',
                'name' => 'efectivo',
                'htmlOptions' => array('class' => 'text-center'),
                ),
  array(
                'value' => '$data->deposito',
                'type' => 'text',
                'name' => 'deposito',
                'htmlOptions' => array('class' => 'text-center'),
                ),
array(
                'value' => '$data->total',
                'type' => 'text',
                'name' => 'total',
                'htmlOptions' => array('class' => 'text-center'),
                ),

		array(
                  'header' => 'ACCION',
                  'class' => 'CButtonColumn',
                  'deleteButtonImageUrl' => false,
                  'updateButtonImageUrl' => false,
                  'viewButtonImageUrl' => false,
                  'htmlOptions' => array('width' => '100', 'class' => 'text-center'),
                  'template' => '{view}{update}{delete}',
                  'buttons' => array(
                      'view' => array(
                          'label' => ' ',
                          'options' => array(
                              'class' => 'mdi mdi-18px mdi-eye m-r-10 text-primary',
                              'title' => 'VER',
                          ),
                          'visible' =>$v,
                      ),
                        'update' => array(
                          'label' => ' ',
                          'options' => array(
                              'class' => 'mdi mdi-18px mdi-pencil m-r-10 text-primary',
                              'title' => 'ACTUALIZAR',
                          ),
                          'visible' => $v,
                      ),
                        'delete' => array(
                            'label' => ' ',
                            'options' => array(
                                'class' => 'mdi mdi-18px mdi-trash-can-outline m-r-10 text-primary',
                                'title' => 'ELIMINAR',
                          ),
                            'visible' => $v,
                      ),
                  )
              ),
	),
)); ?>
    
    
    
    
</div> 
  
            
          <fieldset class="col-12 px-3">
            <legend>RESUMEN GENERAL:</legend> 
            <div class="row justify-content-center " >

                <div class="col-12 col-sm-12 col-md-3 text-center  p-2 bg-lighten-primary"  >
                    <label>TOTAL REGISTROS</label>
                </div>    
                
                <div class="col-12 col-sm-12 col-md-3 text-center p-2 bg-lighten-success">
                    <label>EFECTIVO</label>
                </div>
                 <div class="col-12 col-sm-12 col-md-3 text-center p-2 bg-lighten-success">
                    <label>DEPOSITO</label>
                </div>
                
                 <div class="col-12 col-sm-12 col-md-3 text-center p-2 bg-lighten-success">
                    <label>TOTAL</label>
                </div>
                
                
            </div>
            <div class="row justify-content-center m-b-20" id="total" style="font-size: 20;font-weight: bold;">
             
                <?php
                    if(!empty($datos)){
                ?>     
                     <div class="col-12 col-sm-12 col-md-3 text-center  p-2 bg-lighten-primary" >
                <?php
                
                    echo $datos['num']; 
                ?> 
                </div>
                <div class="col-12 col-sm-12 col-md-3 text-center  p-2  bg-lighten-success"  >
                    <?php
                          echo $datos['efectivo'];
                    ?> 
                </div>
         <div class="col-12 col-sm-12 col-md-3 text-center  p-2  bg-lighten-success"  >
                    <?php
                          echo $datos['deposito'];
                    ?> 
                </div>
                
                  <div class="col-12 col-sm-12 col-md-3 text-center  p-2  bg-lighten-success"  >
                    <?php
                          echo $datos['total'];
                    ?> 
                </div>
                  <?php    
                      
                  }  else {
                     ?>
                   <div class="col-12 col-sm-12 col-md-3 text-center  p-2 bg-lighten-primary"  >
                       0
                   </div>
                   <div class="col-12 col-sm-12 col-md-3 text-center  p-2 bg-lighten-primary" >
                       0,00
                   </div>
                   <div class="col-12 col-sm-12 col-md-3 text-center  p-2 bg-lighten-primary" >
                       0,00
                   </div>
                 <div class="col-12 col-sm-12 col-md-3 text-center  p-2 bg-lighten-primary" >
                       0,00
                   </div>
                <?php
                  }
                 
                  ?>
            

           
          </fieldset>
       

