public function actionPendientes()
 {
     //Aca cargaremos todos los modelos
     $citasHoy = Citas::model()->count("fecha_cita = '" . date('Y-m-d') . "' and estado = 'Programada' and personal_id = " . Yii::app()->user->usuarioId);
     $seguimientosHoy = SeguimientoComercial::model()->count("fecha_accion = '" . date('Y-m-d') . "' and estado = 'Abierto' and responsable_id = " . Yii::app()->user->usuarioId);
     $citasVencidas = Citas::model()->count("estado = 'Vencida' and personal_id = " . Yii::app()->user->usuarioId);
     $seguimientosVencidos = SeguimientoComercial::model()->count("estado = 'Vencido' and responsable_id = " . Yii::app()->user->usuarioId);
     $tareas = PersonalTareas::model()->count("estado = 'Activa' and personal_id = " . Yii::app()->user->usuarioId);
     $tareasVencidas = PersonalTareas::model()->count("estado = 'Vencida' and personal_id = " . Yii::app()->user->usuarioId);
     $this->layout = 'main';
     $this->render('pendientes', array('citasHoy' => $citasHoy, 'seguimientosHoy' => $seguimientosHoy, 'citasVencidas' => $citasVencidas, 'seguimientosVencidos' => $seguimientosVencidos, 'tareas' => $tareas, 'tareasVencidas' => $tareasVencidas));
 }
    ?>
		                	</table>
		                </div>
	                <?php 
}
?>
	               
	              </div>
	            </div>
			</div>
			<div class="span2"></div>
		</div>


<?php 
$elSeguimiento = SeguimientoComercial::model()->findAll("paciente_id = {$model->id}");
if (count($elSeguimiento) > 0) {
    ?>
	<div class="row">
		<div class="span1"></div>
		<div class="span10">
			<h2 class="text-center">Seguimiento Comercial</h2>
			<table class="table table-striped">
					<tr>
						<th>Registrado</th>
						<th>Programada</th>
						<th>Estado</th>
						<th>Tema</th>
						<th>Responsable</th>
						<th>Registrado por:</th>
						<th></th>
			<h2>Smadia Clinic</h2>
		</td>
		<td>
		<img src="images/empleados.png"/></div>
		</td>
		</tr>
		</table>		
	</header>
</div>


<!--Contadores -->
<?php 
$pacientes = Paciente::model()->count();
$citas = Citas::model()->count("fecha_cita = '" . date('Y-m-d') . "' and estado = 'Programada'");
$seguimientos = SeguimientoComercial::model()->count("fecha_accion = '" . date('Y-m-d') . "'");
$vencidas = Citas::model()->count("estado = 'Vencida'");
$inventario = InventarioPersonal::model()->count("personal_id = " . Yii::app()->user->usuarioId);
$tareas = 0;
if (!Yii::app()->user->isGuest) {
    $tareas = PersonalTareas::model()->count("estado = 'Activa' and personal_id = " . Yii::app()->user->usuarioId);
}
?>


<div class="row">
	<div class = "span4">
		<?php 
$this->beginWidget('zii.widgets.CPortlet', array('title' => "<b>Pacientes Registrados</b>"));
?>
		<div class="row">
 public function actionCerrar()
 {
     $id = $_GET['idSeguimiento'];
     $model = SeguimientoComercial::model()->findByPk($_GET['idSeguimiento']);
     if (isset($_POST['SeguimientoComercial'])) {
         $model->estado = "Cerrado";
         //$seguimientoActual->$_POST['SeguimientoComercial']['comentario_estado'];
         $model->comentario_estado = $_POST['SeguimientoComercial']['comentario_estado'];
         $model->save();
     }
     $this->render('view', array('model' => $this->loadModel($model->id)));
 }
                            ?>
" role="button" class="btn btn-mini btn-primary" data-toggle="modal" title="Ver Cita"><i class="icon-star icon-white"></i></a></small>
									<?php 
                        }
                        if ($citas_programadas->estado == "Vencida") {
                            ?>
										<small><a href="index.php?r=citas/view&id=<?php 
                            echo $citas_programadas->id;
                            ?>
" role="button" class="btn btn-mini btn-primary" data-toggle="modal" title="Ver Cita Vencida"><i class="icon-bell icon-white"></i></a></small>
									<?php 
                        }
                        //if (($citas_programadas->estado != "Cancelada" or $citas_programadas->estado != "Vencida") and $citas_programadas->omitir_seguimiento != "Si")
                        if ($citas_programadas->omitir_seguimiento == "No") {
                            //Para seguimiento
                            $losseguimientos = SeguimientoComercial::model()->find("cita_id = {$citas_programadas->id}");
                            ?>
										<small><a href="index.php?r=seguimientoComercial/view&id=<?php 
                            echo $losseguimientos->id;
                            ?>
" role="button" class="btn btn-mini btn-warning" data-toggle="modal" title="Ver Seguimiento"><i class="icon-flag icon-white"></i></a></small>
									<?php 
                        }
                    }
                    ?>
							</td>
						</tr>
						<?php 
                }
            }
        } else {
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return SeguimientoComercial the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = SeguimientoComercial::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }