
<?php
/* @var $this RendicionClienteController */
/* @var $model RendicionCliente */
?>


<?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-12 col-md-3  ">
        <?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-9 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('rendicionCliente/create'),
                          'htmlOptions' => array(
                                                'data-toggle' => "tooltip",
                                                'data-original-title' => 'AGREGAR',
                
                                            ),  
                     ));
                     ?> 
                    
                    <?php
                        $this->widget('booster.widgets.TbButton', array(
                        'context'=>'danger',
                         'buttonType' => 'link',
                         'label'=>'GENERAR PDF',
                         'icon' => 'fa fa-file-pdf fa-lg',
                         'url' => Yii::app()->createUrl('rendicion/reporte'),
                          'htmlOptions' => array(
                                                'data-toggle' => "tooltip",
                                                'data-original-title' => 'GENERAR PDF',
                          
                                
                                            ),  
                     ));
                     
                     
                     
                     ?> 
           
                         <?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('rendicionCliente') . '"; ',
                                   
                                            ),
                                              'url' => '#',
                     ));
                     ?>

         
                          <?php
                        $this->widget('booster.widgets.TbButton', array(
                        'context'=>'success',
                         'buttonType' => 'link',
                         'label'=>'RENDICION',
                         'icon' => '',
                         'url' => Yii::app()->createUrl('rendicion'),
                          'htmlOptions' => array(
                                                'data-toggle' => "tooltip",
                                                'data-original-title' => 'RENDICION',
             
                                                'style'=>'background-color:#066100;',

                                            ),  
                     ));
                     
                     
                     
                     ?> 
                    
     <?php
                        $this->widget('booster.widgets.TbButton', array(
                        'context'=>'primary',
                         'buttonType' => 'link',
                         'label'=>'CIERRE DEL DIA',
                         'icon' => '',
                         'url' => Yii::app()->createUrl('rendicion/cierre'),
                          'htmlOptions' => array(
                                                'data-toggle' => "tooltip",
                                                'data-original-title' => 'CIERRE DEL DIA',
                                                

                                            ),  
                     ));
                     
                     
                     
                     ?> 
     </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(
		'id',
            
                 array(
                'filter'=> Gestor::lista(),
                'value' => 'Gestor::descripcion($data->id_gestor)',
                'type' => 'text',
                'name' => 'id_gestor',
                'htmlOptions' => array('class' => 'text-center'),
                ),
	 array(
                'filter'=> Captador::lista(),
                'value' => 'Captador::descripcion($data->id_captador)',
                'type' => 'text',
                'name' => 'id_captador',
                'htmlOptions' => array('class' => 'text-center'),
                ),
	
                 array(
                'value' => '$data->fecha',
                'type' => 'text',
                'name' => 'fecha',
                'htmlOptions' => array('class' => 'text-center'),
                ),
             array(
                'value' => '$data->dni',
                'type' => 'text',
                'name' => 'dni',
                'htmlOptions' => array('class' => 'text-center'),
                ),
            array(
                'value' => '$data->nombres',
                'type' => 'text',
                'name' => 'nombres',
                'htmlOptions' => array('class' => 'text-center'),
                ),
                array(
                'value' => '$data->apellidos',
                'type' => 'text',
                'name' => 'apellidos',
                'htmlOptions' => array('class' => 'text-center'),
                ),
                array(
                'value' => '$data->monto',
                'type' => 'text',
                'name' => 'monto',
                '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-4 text-center  p-2 bg-lighten-primary"  >
                    <label>TOTAL REGISTROS</label>
                </div>    
                
                <div class="col-12 col-sm-12 col-md-4 text-center p-2 bg-lighten-success">
                    <label>MONTO</label>
                </div>
            </div>
            <div class="row justify-content-center m-b-20" id="total" style="font-size: 16px; font-weight: bold;">
             
                <?php
                    if(!empty($datos)){
                ?>     
                     <div class="col-12 col-sm-12 col-md-4 text-center  p-2 bg-lighten-primary" >
                <?php
                    echo $datos['num']; 
                ?> 
                </div>
                <div class="col-12 col-sm-12 col-md-4 text-center  p-2  bg-lighten-success"  >
                    <?php
                          echo $datos['monto'];
                    ?> 
                </div>
       
                
                  <?php    
                      
                  }  else {
                     ?>
                   <div class="col-12 col-sm-12 col-md-4 text-center  p-2 bg-lighten-primary"  >
                       0
                   </div>
                   <div class="col-12 col-sm-12 col-md-4 text-center  p-2 bg-lighten-primary" >
                       0,00
                   </div>
                <?php
                  }
                 
                  ?>
            

           
          </fieldset>
       
  