public function actionACPersona()
 {
     if (isset($_GET['term'])) {
         $searchTerm = $_GET['term'];
         $result = array();
         $personal = Personal::model()->findAll('nombre LIKE :nombre OR apellido_pat LIKE :apell', array(':nombre' => '%' . $searchTerm . '%', ':apell' => '%' . $searchTerm . '%'));
         foreach ($personal as $persona) {
             $result[] = array('label' => $persona->nombre . ' ' . $persona->apellido_pat, 'value' => $persona->nombre . ' ' . $persona->apellido_pat, 'id' => $persona->id);
         }
         echo CJSON::encode($result);
     }
 }
}
?>

	<p class="note">Campos con <span class="required">*</span> son requeridos.</p>

	<?php 
echo $form->errorSummary($model);
?>

	<div class="row">
		<div class="span12">
			<?php 
echo $form->labelEx($model, 'personal_id');
?>
			<?php 
echo $form->dropDownList($model, 'personal_id', CHtml::listData(Personal::model()->findAll("activo = 'SI' ORDER BY nombres"), 'id', 'NombreCompleto'), array('class' => 'input-xxlarge'));
?>
			<?php 
echo $form->error($model, 'personal_id');
?>
		</div>
	</div>

	<div class="row">
		<div class="span12">
			<?php 
echo $form->labelEx($model, 'tarea');
?>
			<?php 
echo $form->textArea($model, 'tarea', array('rows' => 6, 'cols' => 50, 'class' => 'input-xxlarge'));
?>
<?php

/* @var $this UsuariosController */
/* @var $model Usuarios */
/* @var $form CActiveForm */
?>

<div class="form">

<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'usuarios-form', 'enableAjaxValidation' => false));
?>

<?php 
$elId = $_GET['id'];
$datosEmpleado = Personal::model()->findByPk("{$elId}");
?>

<div class="row">
	<div class="span4"></div>
	<div class="span4">
		<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $datosEmpleado, 'attributes' => array('idPerfil.nombre', 'nombres', 'apellidos')));
?>

	</div>
	<div class="span4"></div>
</div>


	<p class="note">Campos con <span class="required">*</span> son requeridos.</p>
    }
}
?>
<h1><?php 
echo $titulo;
?>
</h1>

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

		<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'seguimiento-comercial-abiertos-grid', 'dataProvider' => $model->search(), 'afterAjaxUpdate' => 'reinstallDatePickerSeguimiento', 'filter' => $model, 'columns' => array(array('header' => 'ID.', 'name' => 'id', 'value' => '$data->id', 'htmlOptions' => array('width' => '25')), array('header' => 'Fecha de acción', 'name' => 'fecha_accion', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('language' => 'es', 'model' => $model, 'attribute' => 'fecha_accion', 'options' => array('showAnim' => 'fold', 'language' => 'es', 'dateFormat' => 'dd-mm-yy', 'changeMonth' => true, 'changeYear' => true, 'yearRange' => '2014:2025'), 'htmlOptions' => array('id' => 'datepicker_for_fecha_accion', 'style' => 'height:20px;width:80px;'), 'defaultOptions' => array('showOn' => 'focus', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true)), true), 'value' => 'Yii::app()->dateformatter->format("dd-MM-yyyy",$data[\'fecha_accion\']);', 'htmlOptions' => array('width' => '80')), array('header' => 'Paciente', 'name' => 'paciente_id', 'filter' => CHtml::listData(Paciente::model()->findAll(array('order' => 'nombre ASC')), 'id', 'nombreCompleto'), 'value' => '$data->paciente->nombreCompleto', 'htmlOptions' => array('width' => '220')), 'n_identificacion', array('header' => 'Tema', 'name' => 'tema_id', 'filter' => CHtml::listData(SeguimientoTema::model()->findAll(array('order' => 'nombre ASC')), 'id', 'nombre'), 'value' => '$data[\'tema\'][\'nombre\']'), array('header' => 'Observaciones', 'name' => 'observaciones', 'value' => '$data->observaciones'), array('header' => 'Ultimo Seguimiento', 'name' => 'ultimo_seguimiento', 'value' => '$data->ultimo_seguimiento'), array('header' => 'Responsable de Seguimiento', 'name' => 'responsable_id', 'filter' => CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC', 'condition' => "activo = 'SI'")), 'id', 'nombreCompleto'), 'value' => '$data[\'responsable\'][\'nombreCompleto\']'), array('header' => 'Registrado por:', 'name' => 'id_personal', 'filter' => CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC', 'condition' => "activo = 'SI'")), 'id', 'nombreCompleto'), 'value' => '$data[\'idPersonal\'][\'nombreCompleto\']', 'htmlOptions' => array('width' => '220')))));
?>


	<?php 
Yii::app()->clientScript->registerScript('re-install-date-picker', "\nfunction reinstallDatePickerSeguimiento(id, data) {\n        //use the same parameters that you had set in your widget else the datepicker will be refreshed by default\n    \$('#datepicker_for_fecha_accion').datepicker(jQuery.extend({showMonthAfterYear:false},jQuery.datepicker.regional['es'],{'dateFormat':'dd-mm-yy'}));\n    //\$('#datepicker_for_fecha_accion').datepicker(\$.datepicker.regional[ 'es' ]);\n  //\$('#datepicker_for_fecha_accion').datepicker({dateFormat: 'dd-mm-yy'});\n}\n");
?>

<script>
    $(document).ready(function()
    {
        $('body').on('dblclick', '#seguimiento-comercial-abiertos-grid tbody tr', function(event)
        {
            var
                rowNum = $(this).index(),
                keys = $('#seguimiento-comercial-abiertos-grid > div.keys > span'),
} else {
    $ruta = "";
}
?>


<?php 
//Fecha de cita
$lafecha = date("d-m-Y");
$fechaBusqueda = date("Y-m-d");
//Seleccionar todas las consultas de la fecha seleccionada
//$citasProgramadas = Citas::model()->findAll("fecha_cita ='$fechaBusqueda'");
if (isset($npersonal)) {
    $losmedicos = Personal::model()->findAll("activo = 'si' and id_perfil= {$npersonal}");
} else {
    $losmedicos = Personal::model()->findAll("activo = 'si'");
}
?>

	<DIV style='height:650px; width:100%; overflow:scroll;'>
		<div style="width:300%;"><!-- Ancho de columnas de personal-->
	<table class="table">
		<tr>
			<?php 
foreach ($losmedicos as $los_medicos) {
    $nombreMedico = $los_medicos->nombres . ' ' . $los_medicos->apellidos;
    ?>
					<td style="width: 300px;">
						<?php 
    $this->beginWidget('zii.widgets.CPortlet', array('title' => "<small class='ultra_mini'>" . $nombreMedico . "</small>"));
    ?>
echo $form->labelEx($tabla_seguimiento, 'tema_id');
?>
					<?php 
echo $form->dropDownList($tabla_seguimiento, 'tema_id', CHtml::listData(SeguimientoTema::model()->findAll("estado = 'Activo' order by 'nombre'"), 'id', 'nombre'), array('class' => 'input-xlarge'));
?>
					<?php 
echo $form->error($tabla_seguimiento, 'tema_id');
?>
				</div>

				<div class='span7'>
					<?php 
echo $form->labelEx($tabla_seguimiento, 'responsable_id');
?>
					<?php 
echo $form->dropDownList($tabla_seguimiento, 'responsable_id', CHtml::listData(Personal::model()->findAll("activo = 'SI'"), 'id', 'nombreCompleto'), array('class' => 'input-xxlarge', 'options' => array(Yii::app()->user->usuarioId => array('selected' => true))));
?>
					<?php 
echo $form->error($tabla_seguimiento, 'responsable_id');
?>
				</div>	
								
				<div class = 'span10'>
					<?php 
echo $form->labelEx($tabla_seguimiento, 'observaciones');
?>
					<?php 
echo $form->textArea($tabla_seguimiento, 'observaciones', array('rows' => 4, 'cols' => 50, 'class' => 'input-xxlarge'));
?>
					<?php 
echo $form->error($tabla_seguimiento, 'observaciones');
?>

<h1>Relación de Productos - <a href="#exportar" class="btn btn-warning" role="button" data-toggle="modal"><i class="icon-share-alt icon-white"></i> Exportar</a></h1>

<?php 
//echo CHtml::link('Advanced Search','#',array('class'=>'search-button'));
?>
<div class="search-form" style="display:none">
<?php 
$this->renderPartial('_search', array('model' => $model));
$lasVentas = Ventas::model()->findAll();
?>
</div><!-- search-form -->

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'ventas-detalle-grid', 'dataProvider' => $model->search(), 'afterAjaxUpdate' => 'reinstallDatePickerVentas', 'filter' => $model, 'columns' => array(array('header' => 'ID.', 'name' => 'id', 'value' => '$data->id', 'htmlOptions' => array('width' => '30')), array('name' => 'nombre_paciente', 'value' => '$data->paciente->nombre', 'htmlOptions' => array('width' => '100'), 'headerHtmlOptions' => array('style' => 'width:150px;text-align:center;')), array('name' => 'apellido_paciente', 'value' => '$data->paciente->apellido', 'htmlOptions' => array('width' => '100'), 'headerHtmlOptions' => array('style' => 'width:150px;text-align:center;')), array('header' => 'Producto', 'name' => 'producto_id', 'filter' => CHtml::listData(ProductoInventario::model()->findAll(array('order' => 'nombre_producto ASC')), 'id', 'nombre_producto'), 'value' => '$data[\'producto\'][\'nombre_producto\']', 'htmlOptions' => array('width' => '250')), array('header' => 'Vendedor', 'name' => 'vendedor_id', 'value' => '$data->venta->vendedor->nombreCompleto', 'filter' => CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC')), 'id', 'nombreCompleto'), 'htmlOptions' => array('width' => '200'), 'headerHtmlOptions' => array('style' => 'width:150px;text-align:center;')), array('name' => 'cantidad', 'value' => '$data->cantidad', 'htmlOptions' => array('width' => '50'), 'footer' => "<h5>" . number_format($model->getTotal4($model->searchSuma())) . '</h5>'), array('name' => 'valor', 'value' => 'number_format($data->valor,2)', 'footer' => "<h5>\$ " . number_format($model->getTotal($model->searchSuma()), 2) . '</h5>'), array('name' => 'iva', 'value' => 'number_format($data->iva,2)', 'footer' => "<h5>\$ " . number_format($model->getTotal2($model->searchSuma()), 2) . '</h5>'), array('name' => 'total', 'value' => 'number_format($data->total,2)', 'footer' => "<h5>\$ " . number_format($model->getTotal3($model->searchSuma()), 2) . '</h5>'), array('header' => 'Fecha', 'name' => 'fecha', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('language' => 'es', 'model' => $model, 'attribute' => 'fecha', 'options' => array('showAnim' => 'fold', 'language' => 'es', 'dateFormat' => 'dd-mm-yy', 'changeMonth' => true, 'changeYear' => true, 'yearRange' => '2014:2025'), 'htmlOptions' => array('id' => 'datepicker_for_fecha', 'style' => 'height:20px;width:80px;'), 'defaultOptions' => array('showOn' => 'focus', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true)), true), 'value' => 'Yii::app()->dateformatter->format("dd-MM-yyyy",$data[\'fecha\']);', 'htmlOptions' => array('width' => '80')), array('class' => 'CButtonColumn', 'template' => '{view}'))));
Yii::app()->clientScript->registerScript('re-install-date-picker', "\nfunction reinstallDatePickerVentas(id, data) {\n        //use the same parameters that you had set in your widget else the datepicker will be refreshed by default\n    \$('#datepicker_for_fecha').datepicker(jQuery.extend({showMonthAfterYear:false},jQuery.datepicker.regional['es'],{'dateFormat':'dd-mm-yy'}));\n    //\$('#datepicker_for_fecha').datepicker(\$.datepicker.regional[ 'es' ]);\n  //\$('#datepicker_for_fecha').datepicker({dateFormat: 'dd-mm-yy'});\n}\n");
?>

<div id="exportar" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">Exportar a un archivo de Excel </h3>
  </div>
  <div class="modal-body">
  	<p>Seleccione las opciones de Exportar</p>
 	<form id="frmExportar" name="frmExportar" action="index.php?r=VentasDetalle/exportar&tipo=<?php 
$elTipo;
?>
" method = "post">
  		<div class="span5">
/* @var $this CajaEfectivoController */
/* @var $model CajaEfectivo */
$this->menu = array(array('label' => 'Listar Saldos', 'url' => array('index')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#caja-efectivo-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Buscar Saldos</h1>

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

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'caja-efectivo-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('header' => 'Personal', 'name' => 'personal_id', 'filter' => CHtml::listData(Personal::model()->findAll(), 'id', 'nombreCompleto'), 'value' => '$data[\'personal\'][\'nombreCompleto\']', 'htmlOptions' => array('width' => '220')), 'total', array('class' => 'CButtonColumn', 'template' => '{view}{update}'))));
?>

<script>
    $(document).ready(function()
    {
        $('body').on('dblclick', '#caja-efectivo-grid tbody tr', function(event)
        {
            var
                rowNum = $(this).index(),
                keys = $('#caja-efectivo-grid > div.keys > span'),
                rowId = keys.eq(rowNum).text();

            location.href = '<?php 
echo Yii::app()->createUrl('CajaEfectivo/view');
?>
						<?php 
echo $form->error($model, 'credito_fecha2');
?>
					</div>
				</div>
			</div>
		</div>
	</div>
	
	<div class="row">
		<div class="span12">
			<?php 
echo $form->labelEx($model, 'vendedor_id');
?>
			<?php 
echo $form->dropDownList($model, 'vendedor_id', CHtml::listData(Personal::model()->findAll("activo = 'SI'"), 'id', 'nombreCompleto'), array('class' => 'input-xxlarge', 'empty' => '(Seleccionar)'));
?>
			<?php 
echo $form->error($model, 'vendedor_id');
?>
		</div>
	</div>

	<div class="row">
		<h5 class="text-center">Dinero en Efectivo</h5>
		<div class="form-actions">
		<div class="span6 text-center">
			<?php 
echo $form->labelEx($model, 'dinero_recibido');
?>
			<?php 
 /**
  * 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 Personal the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Personal::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
} else {
    echo $form->textArea($model, 'descripcion', array('rows' => 6, 'cols' => 50, 'class' => 'input-xxlarge'));
}
?>
			<?php 
echo $form->error($model, 'descripcion');
?>

			<?php 
echo $form->labelEx($model, 'personal_seguimiento');
?>
				<?php 
//if ($losValores){
?>
					<?php 
echo $form->dropDownList($model, 'personal_seguimiento', CHtml::listData(Personal::model()->findAll(array('condition' => "activo = 'SI' and id > 0", 'order' => 'nombres ASC')), 'id', 'nombreCompleto'), array('class' => 'input-xxlarge', 'empty' => 'Ninguno'));
?>
	
		</div>
	</div>

	<div class="row">
		<div class="span6">
			<?php 
echo $form->labelEx($model, 'forma_pago');
?>
			<?php 
echo $form->dropDownList($model, 'forma_pago', array('Ninguna' => 'Ninguna', 'Efectivo' => 'Efectivo', 'Cheque' => 'Cheque', 'Tarjeta' => 'Tarjeta', 'Consignación' => 'Consignación', 'Transferencia' => 'Transferencia', 'Tarjeta Recargable' => 'Tarjeta Recargable', 'Unificación de Software' => 'Unificación de Software'), array('class' => 'input-large'));
?>
	
			<?php 
<?php

/* @var $this CitasController */
/* @var $model Citas */
if (isset($_GET['idpaciente'])) {
    $idpaciente = $_GET['idpaciente'];
    $idPersonal = $_GET['medico'];
    $elPersonal = Personal::model()->findByPk($idPersonal);
    $this->menu = array(array('label' => 'Listar Citas', 'url' => array('index')), array('label' => 'Buscar Citas', 'url' => array('admin')), array('label' => 'Regresar a Calendario', 'url' => array('calendario&idpaciente=' . $idpaciente . '&idpersonal=' . $elPersonal->id_perfil)));
} else {
    $this->menu = array(array('label' => 'Listar Citas', 'url' => array('index')), array('label' => 'Buscar Citas', 'url' => array('admin')), array('label' => 'Regresar a Calendario', 'url' => array('calendario')));
}
?>

<h1>Crear Cita</h1>

<?php 
$this->renderPartial('_form', array('model' => $model));
/* @var $this ProductoComprasController */
/* @var $model ProductoCompras */
$this->menu = array(array('label' => 'Crear Compra', 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#producto-compras-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Buscar Compras de Productos - <a href="#exportar" class="btn btn-warning" role="button" data-toggle="modal"><i class="icon-share-alt icon-white"></i> Exportar</a></h1>

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

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'producto-compras-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('header' => 'ID.', 'name' => 'id', 'value' => '$data->id', 'htmlOptions' => array('width' => '30')), array('header' => 'Proveedor', 'name' => 'producto_proveedor_id', 'filter' => CHtml::listData(ProductoProveedor::model()->findAll(array('order' => 'nombre ASC')), 'id', 'nombre'), 'value' => '$data[\'productoProveedor\'][\'nombre\']', 'htmlOptions' => array('width' => '220')), array('name' => 'nit', 'value' => '$data->nit', 'htmlOptions' => array('width' => '100')), 'factura_n', 'forma_pago', array('name' => 'total_compra', 'value' => 'number_format($data->total_compra,2)', 'footer' => "<h6>\$ " . number_format($model->getTotal($model->search()), 2) . '</h6>'), 'fecha', array('header' => 'Realizado por:', 'name' => 'personal_id', 'filter' => CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC', 'condition' => "activo = 'SI'")), 'id', 'nombreCompleto'), 'value' => '$data->personal->nombreCompleto', 'htmlOptions' => array('width' => '180')), array('name' => 'estado', 'filter' => array('Activo' => 'Activo', 'Anulada' => 'Anulada'), 'value' => '$data->estado'), array('class' => 'CButtonColumn', 'template' => '{view}'))));
?>

<div id="exportar" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">Exportar a un archivo de Excel </h3>
  </div>
  <div class="modal-body">
  	<p>Seleccione las opciones de Exportar</p>
 	<form id="frmExportar" name="frmExportar" action="index.php?r=productoCompras/exportar&tipo=<?php 
$elTipo;
?>
" method = "post">
  		<div class="span5">
			<label>Filtro:</label>
echo $form->labelEx($model, 'observaciones');
?>
		<?php 
echo $form->textArea($model, 'observaciones', array('rows' => 4, 'cols' => 50, 'class' => 'input-xxlarge'));
?>
		<?php 
echo $form->error($model, 'observaciones');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'vendedor');
?>
		<?php 
echo $form->dropDownList($model, 'vendedor', CHtml::listData(Personal::model()->findAll("activo = 'SI' order by 'nombres'"), 'id', 'nombres'), array('class' => 'input-xlarge'));
?>
		<?php 
echo $form->error($model, 'vendedor');
?>
	</div>

	<div class="row buttons">
		<?php 
echo CHtml::submitButton($model->isNewRecord ? 'Crear' : 'Guardar', array('class' => 'btn btn-info'));
?>
	</div>

<?php 
$this->endWidget();
?>
echo $form->labelEx($model, 'anestesiologo_id');
?>
			<?php 
echo $form->dropDownList($model, 'anestesiologo_id', CHtml::listData(Personal::model()->findAll("activo = 'SI'"), 'id', 'nombreCompleto'), array('class' => 'input-xxlarge', 'empty' => "(Seleccione)"));
?>
			<?php 
echo $form->error($model, 'anestesiologo_id');
?>
		</div>

		<div class="span6">
			<?php 
echo $form->labelEx($model, 'inst_quirurgico_id');
?>
			<?php 
echo $form->dropDownList($model, 'inst_quirurgico_id', CHtml::listData(Personal::model()->findAll("activo = 'SI'"), 'id', 'nombreCompleto'), array('class' => 'input-xxlarge', 'empty' => "(Seleccione)"));
?>
			<?php 
echo $form->error($model, 'inst_quirurgico_id');
?>
		</div>
	</div>

	<div class="row">
		<div class="span6">
			<div class="row">
				<div class="span4">
					<?php 
echo $form->labelEx($model, 'fecha_cirugia');
?>
					<div class="input-prepend">
/* @var $this InventarioPersonalController */
/* @var $model InventarioPersonal */
$this->menu = array(array('label' => 'Listar Inventario Personal', 'url' => array('index')), array('label' => 'Crear Inventario Personal', 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#inventario-personal-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Buscar Inventario Personal</h1>

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

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'inventario-personal-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('header' => 'Personal:', 'name' => 'personal_id', 'filter' => CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC', 'condition' => "activo = 'SI'")), 'id', 'nombreCompleto'), 'value' => '$data->personal->nombreCompleto', 'htmlOptions' => array('width' => '300')), array('class' => 'CButtonColumn', 'template' => '{view}'))));
?>


<script>
    $(document).ready(function()
    {
        $('body').on('dblclick', '#inventario-personal-grid tbody tr', function(event)
        {
            var
                rowNum = $(this).index(),
                keys = $('#inventario-personal-grid > div.keys > span'),
                rowId = keys.eq(rowNum).text();

            location.href = '<?php 
echo Yii::app()->createUrl('InventarioPersonal/view');
		</div>
	<?php 
    $campos++;
}
?>


		   </div>
		  	
		  <div>
			<br>
			<div class="row">
				<div class="span1"></div>
				<div class="span5">
					<?php 
$elPersonal = Personal::model()->findAll("activo = 'SI'");
?>
			<label>Vendedor:</label>
		  	<select name='vendedor_id' id='vendedor_id' class="input-xlarge">
					<?php 
foreach ($elPersonal as $el_personal) {
    if ($el_personal->id == $model->usuario_id) {
        ?>
	
						<option selected value='<?php 
        echo $el_personal->id;
        ?>
'><?php 
        echo $el_personal->nombreCompleto;
        ?>
</option>	
		   </tr>
		</table>
		</div>
	<?php 
    $campos++;
}
?>


		   </div>
		  	
		  <div>
		  	<label>Vendedor:</label>
		<select name='vendedor_id' id='vendedor_id'>
				<?php 
$losVendedores = Personal::model()->findAll("activo = 'SI' and id > 0 order by 'nombres'");
foreach ($losVendedores as $los_vendedores) {
    ?>
				<option value='<?php 
    echo $los_vendedores->id;
    ?>
'><?php 
    echo $los_vendedores->nombreCompleto;
    ?>
</option>
				<?php 
}
?>
			</select>
		
			  		<label>Observaciones:</label>
/* @var $this PresupuestoController */
/* @var $model Presupuesto */
$this->menu = array(array('label' => 'Listar Presupuestos', 'url' => array('index')), array('label' => 'Crear Presupuesto', 'url' => array('create')));
?>

<h1>Buscar Presupuesto - <a href="#exportar" class="btn btn-warning" role="button" data-toggle="modal"><i class="icon-share-alt icon-white"></i> Exportar</a></h1>

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

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'presupuesto-grid', 'dataProvider' => $model->search(), 'afterAjaxUpdate' => 'reinstallDatePickerVentas', 'filter' => $model, 'columns' => array(array('header' => 'ID.', 'name' => 'id', 'value' => '$data->id', 'htmlOptions' => array('width' => '30')), array('name' => 'nombre_paciente', 'value' => '$data->paciente->nombre', 'htmlOptions' => array('width' => '100'), 'headerHtmlOptions' => array('style' => 'width:150px;text-align:center;')), array('name' => 'apellido_paciente', 'value' => '$data->paciente->apellido', 'htmlOptions' => array('width' => '100'), 'headerHtmlOptions' => array('style' => 'width:150px;text-align:center;')), array('header' => 'Cedula', 'name' => 'n_identificacion', 'value' => '$data->paciente->n_identificacion', 'htmlOptions' => array('width' => '50'), 'headerHtmlOptions' => array('style' => 'width:150px;text-align:center;')), array('name' => 'estado', 'filter' => array('Contratado' => 'Contratado', 'Presupuestado' => 'Presupuestado'), 'value' => '$data->estado', 'htmlOptions' => array('width' => '150')), array('header' => 'Total ($)', 'name' => 'total', 'value' => 'number_format($data->total,2)'), array('header' => 'Fecha', 'name' => 'fecha', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('language' => 'es', 'model' => $model, 'attribute' => 'fecha', 'options' => array('showAnim' => 'fold', 'language' => 'es', 'dateFormat' => 'dd-mm-yy', 'changeMonth' => true, 'changeYear' => true, 'yearRange' => '2014:2025'), 'htmlOptions' => array('id' => 'datepicker_for_fecha', 'style' => 'height:20px;width:80px;'), 'defaultOptions' => array('showOn' => 'focus', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true)), true), 'value' => 'Yii::app()->dateformatter->format("dd-MM-yyyy",$data[\'fecha\']);', 'htmlOptions' => array('width' => '80')), array('header' => 'Elaborado Por:', 'name' => 'usuario_id', 'filter' => CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC', 'condition' => "activo = 'SI'")), 'id', 'nombreCompleto'), 'value' => '$data[\'elusuario\'][\'nombreCompleto\']'), array('class' => 'CButtonColumn', 'template' => '{view}'))));
Yii::app()->clientScript->registerScript('re-install-date-picker', "\nfunction reinstallDatePickerVentas(id, data) {\n        //use the same parameters that you had set in your widget else the datepicker will be refreshed by default\n    \$('#datepicker_for_fecha').datepicker(jQuery.extend({showMonthAfterYear:false},jQuery.datepicker.regional['es'],{'dateFormat':'dd-mm-yy'}));\n    //\$('#datepicker_for_fecha').datepicker(\$.datepicker.regional[ 'es' ]);\n  //\$('#datepicker_for_fecha').datepicker({dateFormat: 'dd-mm-yy'});\n}\n");
?>

<div id="exportar" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">Exportar a un archivo de Excel </h3>
  </div>
  <div class="modal-body">
  	<p>Seleccione las opciones de Exportar</p>
 	<form id="frmExportar" name="frmExportar" action="index.php?r=presupuesto/exportar&tipo=<?php 
$elTipo;
?>
" method = "post">
  		<div class="span5">
/* @var $this CitasEquipoController */
/* @var $model CitasEquipo */
$this->menu = array();
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#citas-equipo-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Agenda de Equipos</h1>

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

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'citas-equipo-grid', 'dataProvider' => $model->search(), 'afterAjaxUpdate' => 'reinstallDatePicker', 'filter' => $model, 'columns' => array(array('header' => 'Cita', 'name' => 'cita_id', 'value' => '$data->cita_id', 'htmlOptions' => array('width' => '50')), array('header' => 'Fecha', 'name' => 'fecha', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('language' => 'es', 'model' => $model, 'attribute' => 'fecha', 'options' => array('showAnim' => 'fold', 'language' => 'es', 'dateFormat' => 'dd-mm-yy', 'changeMonth' => true, 'changeYear' => true, 'yearRange' => '2014:2025'), 'htmlOptions' => array('id' => 'datepicker_for_fecha_cita', 'style' => 'height:20px;width:80px;'), 'defaultOptions' => array('showOn' => 'focus', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true)), true), 'value' => 'Yii::app()->dateformatter->format("dd-MM-yyyy",$data[\'fecha\']);', 'htmlOptions' => array('width' => '80')), array('name' => 'hora_inicio', 'filter' => CHtml::listData(HorasServicio::model()->findAll(), 'id', 'hora'), 'value' => '$data[\'horaInicio\'][\'hora\']', 'htmlOptions' => array('width' => '85')), array('name' => 'hora_fin_mostrar', 'filter' => CHtml::listData(HorasServicio::model()->findAll(), 'id', 'hora'), 'value' => '$data[\'horaFinMostrar\'][\'hora\']', 'htmlOptions' => array('width' => '85')), array('name' => 'equipo_id', 'filter' => CHtml::listData(Equipos::model()->findAll(array('order' => 'nombre ASC')), 'id', 'nombre'), 'value' => '$data[\'equipo\'][\'nombre\']', 'htmlOptions' => array('width' => '210')), 'equipo.numero', array('name' => 'linea_servicio_id', 'filter' => CHtml::listData(LineaServicio::model()->findAll(array('order' => 'nombre ASC')), 'id', 'nombre'), 'value' => '$data[\'lineaServicio\'][\'nombre\']', 'htmlOptions' => array('width' => '210')), array('name' => 'nombre_paciente', 'filter' => CHtml::listData(Paciente::model()->findAll(array('order' => 'nombre ASC')), 'id', 'nombreCompleto'), 'value' => '$data->cita->paciente->nombreCompleto', 'htmlOptions' => array('width' => '210')), array('name' => 'nombre_asistente', 'filter' => CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC')), 'id', 'nombreCompleto'), 'value' => '$data->cita->personal->nombreCompleto', 'htmlOptions' => array('width' => '210')), array('class' => 'CButtonColumn', 'template' => '{view}'))));
Yii::app()->clientScript->registerScript('re-install-date-picker', "\nfunction reinstallDatePicker(id, data) {\n        //use the same parameters that you had set in your widget else the datepicker will be refreshed by default\n    \$('#datepicker_for_fecha_cita').datepicker(jQuery.extend({showMonthAfterYear:false},jQuery.datepicker.regional['es'],{'dateFormat':'dd-mm-yy'}));\n}\n");
?>

<script>
    $(document).ready(function()
    {
        $('body').on('dblclick', '#citas-equipo-grid tbody tr', function(event)
        {
            var
                rowNum = $(this).index(),
                keys = $('#citas-equipo-grid > div.keys > span'),
                rowId = keys.eq(rowNum).text();

            location.href = '<?php 
echo Yii::app()->createUrl('citasEquipo/view');
<?php 
//Temporal
//$losProductos = ProductoInventario::model()->findAll("cantidad > 0");
$losProductos = ProductoInventarioDetalle::model()->findAll("existencia > 0");
?>

	<?php 
echo $form->errorSummary($model);
?>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'personal_id');
?>
		<?php 
echo $form->dropDownList($model, 'personal_id', CHtml::listData(Personal::model()->findAll("activo = 'SI' and NOT EXISTS(select personal_id from inventario_personal where inventario_personal.personal_id = id) ORDER BY nombres ASC"), 'id', 'nombreCompleto'), array('class' => 'input-xxlarge'));
?>
		<?php 
echo $form->error($model, 'personal_id');
?>
	</div>
	<input id='variable' name='variable' type='hidden' />
	

	<h5>Agregar Productos a Inventario Personal</h5>
	<a href='JavaScript:agregarCampo();' class="btn btn-primary"> Agregar Producto </a>
	<hr>
	<div class="row">

		<div class="span12">
/* @var $this VentasController */
/* @var $model Ventas */
$this->menu = array(array('label' => 'Crear Venta', 'url' => array('create')));
?>

<h1>Buscar Ventas - <a href="#exportar" class="btn btn-warning" role="button" data-toggle="modal"><i class="icon-share-alt icon-white"></i> Exportar</a> - <a href="index.php?r=ventas/create" class="btn btn-success" role="button" ><i class="icon-plus icon-white"></i> Crear Venta</a></h1>

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

<DIV style='width:150%; overflow:scroll;'>
<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'ventas-grid', 'dataProvider' => $model->search(), 'afterAjaxUpdate' => 'reinstallDatePickerVentas', 'filter' => $model, 'columns' => array(array('header' => 'ID.', 'name' => 'id', 'value' => '$data->id', 'htmlOptions' => array('width' => '30')), array('header' => 'Paciente', 'name' => 'paciente_id', 'filter' => CHtml::listData(Paciente::model()->findAll(array('order' => 'nombre ASC')), 'id', 'nombreCompleto'), 'value' => '$data[\'paciente\'][\'nombreCompleto\']', 'htmlOptions' => array('width' => '220')), array('name' => 'n_identificacion', 'value' => '$data->n_identificacion', 'htmlOptions' => array('width' => '100')), 'descripcion', array('name' => 'forma_pago', 'value' => '$data->forma_pago', 'filter' => array('Cheque' => 'Cheque', 'Crédito' => 'Crédito', 'Consignación' => 'Consignación', 'Efectivo' => 'Efectivo', 'Tarjeta' => 'Tarjeta')), array('name' => 'total1', 'value' => 'number_format($data->total1,2)', 'htmlOptions' => array('width' => '120'), 'footer' => "<h6>\$ " . number_format($model->getTotal6($model->searchSuma()), 2) . '</h6>'), array('name' => 'forma_pago2', 'value' => '$data->forma_pago2', 'filter' => array('Crédito' => 'Crédito', 'Consignación' => 'Consignación', 'Tarjeta' => 'Tarjeta'), 'htmlOptions' => array('width' => '80')), array('name' => 'total2', 'value' => 'number_format($data->total2,2)', 'htmlOptions' => array('width' => '120'), 'footer' => "<h6>\$ " . number_format($model->getTotal7($model->searchSuma()), 2) . '</h6>'), array('name' => 'tarjeta_tipo', 'value' => '$data->tarjeta_tipo', 'filter' => array('Debito Maestro' => 'Debito Maestro', 'Mastercard' => 'Mastercard', 'VISA' => 'VISA', 'American Express' => 'American Express', 'Diners Club' => 'Diners Club')), array('name' => 'tarjeta_aprobacion', 'value' => '$data->tarjeta_aprobacion'), array('name' => 'tarjeta_cuenta_banco', 'filter' => CHtml::listData(BancosCuentas::model()->findAll(array('order' => 'numero ASC')), 'id', 'numero'), 'value' => '$data[\'tarjetaCuentaBanco\'][\'numero\']', 'htmlOptions' => array('width' => '150')), array('name' => 'tarjeta_tipo2', 'value' => '$data->tarjeta_tipo2', 'filter' => array('Debito Maestro' => 'Debito Maestro', 'Mastercard' => 'Mastercard', 'VISA' => 'VISA', 'American Express' => 'American Express', 'Diners Club' => 'Diners Club')), array('name' => 'tarjeta_aprobacion2', 'value' => '$data->tarjeta_aprobacion2'), array('name' => 'tarjeta_cuenta_banco2', 'filter' => CHtml::listData(BancosCuentas::model()->findAll(array('order' => 'numero ASC')), 'id', 'numero'), 'value' => '$data[\'tarjetaCuentaBanco2\'][\'numero\']', 'htmlOptions' => array('width' => '150')), array('name' => 'sub_total', 'value' => 'number_format($data->sub_total,2)', 'htmlOptions' => array('width' => '120'), 'footer' => "<h6>\$ " . number_format($model->getTotal5($model->searchSuma()), 2) . '</h6>'), array('name' => 'total_iva', 'value' => 'number_format($data->total_iva,2)', 'htmlOptions' => array('width' => '120'), 'footer' => "<h6>\$ " . number_format($model->getTotal4($model->searchSuma()), 2) . '</h6>'), array('name' => 'descuento', 'filter' => array('Si' => 'Si', 'No' => 'No'), 'value' => '$data->descuento'), array('name' => 'descuento_valor', 'value' => 'number_format($data->descuento_valor,2)', 'htmlOptions' => array('width' => '120'), 'footer' => "<h6>\$ " . number_format($model->getTotal3($model->searchSuma()), 2) . '</h6>'), array('name' => 'descuento_total', 'value' => 'number_format($data->descuento_total,2)', 'htmlOptions' => array('width' => '120'), 'footer' => "<h6>\$ " . number_format($model->getTotal2($model->searchSuma()), 2) . '</h6>'), array('name' => 'total_venta', 'value' => 'number_format($data->total_venta,2)', 'htmlOptions' => array('width' => '120'), 'footer' => "<h6>\$ " . number_format($model->getTotal($model->searchSuma()), 2) . '</h6>'), array('header' => 'Vendido por:', 'name' => 'vendedor_id', 'filter' => CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC', 'condition' => "activo = 'SI'")), 'id', 'nombreCompleto'), 'value' => '$data->vendedor->nombreCompleto', 'htmlOptions' => array('width' => '180')), array('header' => 'Realizado por:', 'name' => 'personal', 'filter' => CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC', 'condition' => "activo = 'SI'")), 'id', 'nombreCompleto'), 'value' => '$data->personal0->nombreCompleto', 'htmlOptions' => array('width' => '180')), array('header' => 'Fecha', 'name' => 'fecha', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('language' => 'es', 'model' => $model, 'attribute' => 'fecha', 'options' => array('showAnim' => 'fold', 'language' => 'es', 'dateFormat' => 'dd-mm-yy', 'changeMonth' => true, 'changeYear' => true, 'yearRange' => '2014:2025'), 'htmlOptions' => array('id' => 'datepicker_for_fecha', 'style' => 'height:20px;width:80px;'), 'defaultOptions' => array('showOn' => 'focus', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true)), true), 'value' => 'Yii::app()->dateformatter->format("dd-MM-yyyy",$data[\'fecha\']);', 'htmlOptions' => array('width' => '80')), array('name' => 'estado', 'filter' => array('Activo' => 'Activo', 'Anulada' => 'Anulada'), 'value' => '$data->estado', 'htmlOptions' => array('width' => '150')), array('class' => 'CButtonColumn', 'template' => '{view}'))));
Yii::app()->clientScript->registerScript('re-install-date-picker', "\nfunction reinstallDatePickerVentas(id, data) {\n        //use the same parameters that you had set in your widget else the datepicker will be refreshed by default\n    \$('#datepicker_for_fecha').datepicker(jQuery.extend({showMonthAfterYear:false},jQuery.datepicker.regional['es'],{'dateFormat':'dd-mm-yy'}));\n    //\$('#datepicker_for_fecha').datepicker(\$.datepicker.regional[ 'es' ]);\n  //\$('#datepicker_for_fecha').datepicker({dateFormat: 'dd-mm-yy'});\n}\n");
?>

</div>


<div id="exportar" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">Exportar a un archivo de Excel </h3>
  </div>
  <div class="modal-body">
  	<p>Seleccione las opciones de Exportar</p>
 	<form id="frmExportar" name="frmExportar" action="index.php?r=Ventas/exportar&tipo=<?php 
$elTipo;
// 	//array('label'=>'Crear Ingreso', 'url'=>array('create')),
// );
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#ingresos-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Buscar Ingresos - Transferencias a Paciente - <a href="#exportar" class="btn btn-warning" role="button" data-toggle="modal"><i class="icon-share-alt icon-white"></i> Exportar</a></h1>

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

<DIV style='width:150%; overflow:scroll;'>
<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'ingresos-grid', 'template' => '{items}{summary}{pager}', 'dataProvider' => $model->searchTransferencias(), 'afterAjaxUpdate' => 'reinstallDatePickerIngresos', 'filter' => $model, 'columns' => array(array('header' => 'ID.', 'name' => 'id', 'value' => '$data->id', 'htmlOptions' => array('width' => '30')), array('name' => 'nombre_paciente', 'value' => '$data->paciente->nombre', 'htmlOptions' => array('width' => '100'), 'headerHtmlOptions' => array('style' => 'width:150px;text-align:center;')), array('name' => 'apellido_paciente', 'value' => '$data->paciente->apellido', 'htmlOptions' => array('width' => '100'), 'headerHtmlOptions' => array('style' => 'width:150px;text-align:center;')), 'n_identificacion', array('name' => 'valor', 'value' => 'number_format($data->valor,2)', 'htmlOptions' => array('width' => '100'), 'footer' => $model->searchSumaTransferencia()->itemCount === 0 ? '' : "<h6>\$ " . number_format($model->getTotal($model->searchSumaTransferencia()), 2) . '</h6>'), array('header' => 'Fecha', 'name' => 'fecha_sola', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('language' => 'es', 'model' => $model, 'attribute' => 'fecha_sola', 'options' => array('showAnim' => 'fold', 'language' => 'es', 'dateFormat' => 'dd-mm-yy', 'changeMonth' => true, 'changeYear' => true, 'yearRange' => '2014:2025'), 'htmlOptions' => array('id' => 'datepicker_for_fecha_sola', 'style' => 'height:20px;width:80px;'), 'defaultOptions' => array('showOn' => 'focus', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true)), true), 'value' => 'Yii::app()->dateformatter->format("dd-MM-yyyy",$data[\'fecha_sola\']);', 'htmlOptions' => array('width' => '80')), 'descripcion', 'forma_pago', array('header' => 'Vendido por:', 'name' => 'vendedor_id', 'filter' => CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC', 'condition' => "activo = 'SI'")), 'id', 'nombreCompleto'), 'value' => '$data->vendedor->nombreCompleto', 'htmlOptions' => array('width' => '150')), array('header' => 'Contrato', 'name' => 'contrato_id', 'value' => '$data->contrato_id', 'htmlOptions' => array('width' => '40')), array('name' => 'estado', 'filter' => array('Activo' => 'Activo', 'Anulado' => 'Anulado'), 'value' => '$data->estado'), array('name' => 'tarjeta_tipo', 'filter' => array('American Express' => 'American Express', 'Debito Maestro' => 'Debito Maestro', 'Diners Club' => 'Diners Club', 'Mastercard' => 'Mastercard', 'VISA' => 'VISA'), 'value' => '$data->tarjeta_tipo'), array('header' => 'Número de Autorización', 'name' => 'tarjeta_aprobacion', 'value' => '$data->tarjeta_aprobacion'), array('header' => 'Cuenta de Ingreso', 'name' => 'tarjeta_banco_cuenta_id', 'filter' => CHtml::listData(BancosCuentas::model()->findAll(array('order' => 'numero ASC')), 'id', 'numero'), 'value' => '$data[\'tarjetaBancoCuenta\'][\'numero\']', 'htmlOptions' => array('width' => '150')), array('header' => 'Realizado por:', 'name' => 'personal_id', 'filter' => CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC', 'condition' => "activo = 'SI'")), 'id', 'nombreCompleto'), 'value' => '$data->personal->nombreCompleto', 'htmlOptions' => array('width' => '150')), array('header' => 'Seguimiento:', 'name' => 'personal_seguimiento', 'filter' => CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC', 'condition' => "activo = 'SI'")), 'id', 'nombreCompleto'), 'value' => '$data->personalSeguimiento->nombreCompleto', 'htmlOptions' => array('width' => '150')), array('class' => 'CButtonColumn', 'template' => '{view}'))));
Yii::app()->clientScript->registerScript('re-install-date-picker', "\nfunction reinstallDatePickerIngresos(id, data) {\n        //use the same parameters that you had set in your widget else the datepicker will be refreshed by default\n    \$('#datepicker_for_fecha_sola').datepicker(jQuery.extend({showMonthAfterYear:false},jQuery.datepicker.regional['es'],{'dateFormat':'dd-mm-yy'}));\n    //\$('#datepicker_for_fecha_sola').datepicker(\$.datepicker.regional[ 'es' ]);\n  //\$('#datepicker_for_fecha_sola').datepicker({dateFormat: 'dd-mm-yy'});\n}\n");
// $countData = $model->search();
// $elTotal = 0;
// foreach ($countData->data as $count_data)
// {
// 	$elTotal = $elTotal + $count_data->valor;
// }
// echo "La suma: ".$elTotal;
?>
</div>

<div id="exportar" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">Exportar a un archivo de Excel </h3>
/* @var $model Citas */
$this->menu = array(array('label' => 'Listar Citas', 'url' => array('index')), array('label' => 'Agenda de Cita', 'url' => array('citas')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#citas-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Buscar Cita - <a href="#exportar" class="btn btn-warning" role="button" data-toggle="modal"><i class="icon-share-alt icon-white"></i> Exportar</a></h1>

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

<DIV style='width:175%; overflow:scroll;'>
<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'citas-grid', 'dataProvider' => $model->search(), 'afterAjaxUpdate' => 'reinstallDatePicker', 'filter' => $model, 'columns' => array(array('header' => 'ID.', 'name' => 'id', 'value' => '$data->id', 'htmlOptions' => array('width' => '30')), array('name' => 'nombre_paciente', 'value' => '$data->paciente->nombre', 'htmlOptions' => array('width' => '100'), 'headerHtmlOptions' => array('style' => 'width:150px;text-align:center;')), array('name' => 'apellido_paciente', 'value' => '$data->paciente->apellido', 'htmlOptions' => array('width' => '100'), 'headerHtmlOptions' => array('style' => 'width:150px;text-align:center;')), array('name' => 'cedula_paciente', 'value' => '$data->paciente->n_identificacion', 'headerHtmlOptions' => array('style' => 'width:150px;text-align:center;')), array('header' => 'Celular', 'value' => '$data[\'paciente\'][\'celular\']', 'htmlOptions' => array('width' => '100')), array('header' => 'Personal', 'name' => 'personal_id', 'filter' => CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC', 'condition' => "activo = 'SI'")), 'id', 'nombreCompleto'), 'value' => '$data[\'personal\'][\'nombreCompleto\']', 'htmlOptions' => array('width' => '220')), array('name' => 'linea_servicio_id', 'htmlOptions' => array('width' => '180'), 'filter' => CHtml::listData(LineaServicio::model()->findAll(array('order' => 'nombre ASC', 'condition' => "estado = 'activo'")), 'id', 'nombre'), 'value' => '$data[\'lineaServicio\'][\'nombre\']'), array('header' => 'Contrato', 'name' => 'contrato_id', 'value' => '$data->contrato_id', 'htmlOptions' => array('width' => '30')), array('name' => 'estado', 'filter' => array('Cancelada' => 'Cancelada', 'Completada' => 'Completada', 'Fallida' => 'Fallida', 'Programada' => 'Programada', 'Vencida' => 'Vencida', 'Reservado' => 'Reservado'), 'value' => '$data->estado'), array('header' => 'Fecha', 'name' => 'fecha_cita', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('language' => 'es', 'model' => $model, 'attribute' => 'fecha_cita', 'options' => array('showAnim' => 'fold', 'language' => 'es', 'dateFormat' => 'dd-mm-yy', 'changeMonth' => true, 'changeYear' => true, 'yearRange' => '2014:2025'), 'htmlOptions' => array('id' => 'datepicker_for_fecha_cita', 'style' => 'height:20px;width:80px;'), 'defaultOptions' => array('showOn' => 'focus', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true)), true), 'value' => 'Yii::app()->dateformatter->format("dd-MM-yyyy",$data[\'fecha_cita\']);', 'htmlOptions' => array('width' => '80')), array('name' => 'hora_inicio', 'filter' => CHtml::listData(HorasServicio::model()->findAll(), 'id', 'hora'), 'value' => '$data[\'horaInicio\'][\'hora\']', 'htmlOptions' => array('width' => '85')), array('name' => 'hora_fin_mostrar', 'filter' => CHtml::listData(HorasServicio::model()->findAll(), 'id', 'hora'), 'value' => '$data[\'horaFinMostrar\'][\'hora\']', 'htmlOptions' => array('width' => '85')), array('header' => 'Registrada por:', 'name' => 'usuario_id', 'filter' => CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC', 'condition' => "activo = 'SI'")), 'id', 'nombreCompleto'), 'value' => '$data[\'usuario\'][\'nombreCompleto\']', 'htmlOptions' => array('width' => '220')), array('name' => 'fecha_creacion', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('language' => 'es', 'model' => $model, 'attribute' => 'fecha_creacion', 'options' => array('showAnim' => 'fold', 'language' => 'es', 'dateFormat' => 'dd-mm-yy', 'changeMonth' => true, 'changeYear' => true, 'yearRange' => '2014:2025'), 'htmlOptions' => array('id' => 'datepicker_for_fecha_creacion', 'style' => 'height:20px;width:80px;'), 'defaultOptions' => array('showOn' => 'focus', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true)), true), 'value' => 'Yii::app()->dateformatter->format("dd-MM-yyyy",$data[\'fecha_creacion\']);', 'htmlOptions' => array('width' => '80')), array('header' => 'Confirmación', 'name' => 'confirmacion', 'value' => '$data[\'confirmacion\']'), array('header' => 'Comentario de Seguimiento', 'name' => 'comentario_cierre', 'value' => '$data[\'comentario_cierre\']', 'htmlOptions' => array('width' => '500')), array('header' => 'Comentario', 'name' => 'comentario', 'value' => '$data[\'comentario\']', 'htmlOptions' => array('width' => '500')), array('class' => 'CButtonColumn', 'template' => '{view}'))));
Yii::app()->clientScript->registerScript('re-install-date-picker', "\nfunction reinstallDatePicker(id, data) {\n        //use the same parameters that you had set in your widget else the datepicker will be refreshed by default\n    \$('#datepicker_for_fecha_cita').datepicker(jQuery.extend({showMonthAfterYear:false},jQuery.datepicker.regional['es'],{'dateFormat':'dd-mm-yy'}));\n    \$('#datepicker_for_fecha_creacion').datepicker(jQuery.extend({showMonthAfterYear:false},jQuery.datepicker.regional['es'],{'dateFormat':'dd-mm-yy'}));\n    //\$('#datepicker_for_fecha_cita').datepicker(\$.datepicker.regional[ 'es' ]);\n  //\$('#datepicker_for_fecha_cita').datepicker({dateFormat: 'dd-mm-yy'});\n}\n");
?>
</div>

 <div id="exportar" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">Exportar a un archivo de Excel </h3>
  </div>
  <div class="modal-body">
  	<p>Seleccione las opciones de Exportar</p>
 	<form id="frmExportar" name="frmExportar" action="index.php?r=Citas/exportar&tipo=<?php 
$elTipo;
?>
" method = "post">
}
?>

	<p class="note">Campos con <span class="required">*</span> son requeridos.</p>

	<?php 
echo $form->errorSummary($model);
?>

	<div class="row">
		<div class="span6">
			<?php 
echo $form->labelEx($model, 'personal_id');
?>
			<?php 
echo $form->dropDownList($model, 'personal_id', CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC', 'condition' => "activo = 'SI' and agenda= 'SI' and id != 1")), 'id', 'NombreCompleto'), array('options' => array('selected' => true), 'class' => 'input-xlarge', 'empty' => '(Seleccionar)'));
?>
			<?php 
echo $form->error($model, 'personal_id');
?>
		</div>
	</div>
	
	<div class="row">
		<div class="span6">
			<label for="">Seleccione la opción de bloqueo</label>
			<select name="opciones" id="opciones">
				<option value="Seleccione">(Seleccione)</option>
				<option value="Horas">Horas</option>
				<option value="Dias">Dias</option>
			</select>
}
?>

<h1>Buscar Tareas <?php 
echo $titulo;
?>
</h1>

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

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'personal-tareas-grid', 'dataProvider' => $model->search(), 'afterAjaxUpdate' => 'reinstallDatePickerTareas', 'filter' => $model, 'columns' => array(array('header' => 'ID.', 'name' => 'id', 'value' => '$data->id', 'htmlOptions' => array('width' => '30')), array('header' => 'Personal Asignado:', 'name' => 'personal_id', 'filter' => CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC', 'condition' => "activo = 'SI'")), 'id', 'nombreCompleto'), 'value' => '$data[\'personal\'][\'nombreCompleto\']'), array('name' => 'tarea', 'value' => '$data->tarea', 'htmlOptions' => array('width' => '200')), array('header' => 'Último Comentario', 'name' => 'comentario_cierre', 'value' => '$data->comentario_cierre', 'htmlOptions' => array('width' => '200')), array('header' => 'Fecha a Cumplir', 'name' => 'fecha_cumplir', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('language' => 'es', 'model' => $model, 'attribute' => 'fecha_cumplir', 'options' => array('showAnim' => 'fold', 'language' => 'es', 'dateFormat' => 'dd-mm-yy', 'changeMonth' => true, 'changeYear' => true, 'yearRange' => '2014:2025'), 'htmlOptions' => array('id' => 'datepicker_for_fecha_cumplir', 'style' => 'height:20px;width:80px;'), 'defaultOptions' => array('showOn' => 'focus', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true)), true), 'value' => 'Yii::app()->dateformatter->format("dd-MM-yyyy",$data[\'fecha_cumplir\']);', 'htmlOptions' => array('width' => '80')), array('name' => 'estado', 'filter' => array('Activa' => 'Activa', 'Completada' => 'Completada', 'Vencida' => 'Vencida'), 'value' => '$data->estado'), array('header' => 'Personal que Asigno:', 'name' => 'usuario_id', 'filter' => CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC', 'condition' => "activo = 'SI'")), 'id', 'nombreCompleto'), 'value' => '$data[\'usuario\'][\'nombreCompleto\']'), array('class' => 'CButtonColumn'))));
Yii::app()->clientScript->registerScript('re-install-date-picker', "\nfunction reinstallDatePickerTareas(id, data) {\n        //use the same parameters that you had set in your widget else the datepicker will be refreshed by default\n    \$('#datepicker_for_fecha_cumplir').datepicker(jQuery.extend({showMonthAfterYear:false},jQuery.datepicker.regional['es'],{'dateFormat':'dd-mm-yy'}));\n    //\$('#datepicker_for_fecha_cumplir').datepicker(\$.datepicker.regional[ 'es' ]);\n  //\$('#datepicker_for_fecha_cumplir').datepicker({dateFormat: 'dd-mm-yy'});\n}\n");
?>
<script>
    $(document).ready(function()
    {
        $('body').on('dblclick', '#personal-tareas-grid tbody tr', function(event)
        {
            var
                rowNum = $(this).index(),
                keys = $('#personal-tareas-grid > div.keys > span'),
                rowId = keys.eq(rowNum).text();

            location.href = '<?php 
echo Yii::app()->createUrl('personalTareas/view');
?>
Exemple #27
0
<br>

	<P>1. DATOS EVALUADOR. </P>

	

	<?php 
echo $form->errorSummary($model);
?>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'Instructor');
?>
		<?php 
echo $form->dropDownList($model, 'PE_ID', CHtml::listData(Personal::model()->findAll(), 'PE_ID', 'PE_NOMBRES'), array('empty' => 'Selecciona un Instructor'));
?>
		<?php 
echo $form->error($model, 'PE_ID');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'FECHA');
?>
		<?php 
$this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'FI_FECHA', 'language' => 'es', 'options' => array('dateFormat' => 'yy-mm-dd', 'minDate' => '2015-05-22', 'maxDate' => '2015-05-22')));
?>
		<?php 
echo $form->error($model, 'FI_FECHA');
?>
<!DOCTYPE html>
<html>
<body>
	<head>
	<h2>Bloquear Agenda a Personal</h2>
	<p>Seleccione el personal al que desea bloquear la agenda.</p>	
	</head>
	<div class="container">
		<div class="well">
		<form action="">
			<label for="">Persona:</label>
			<select name="personal" id="personal" class='input-xxlarge'>
				<option value="">(Seleccione)</option>
				<?php 
$elPersonal = Personal::model()->findAll("activo ='Si' and agenda='Si'");
foreach ($elPersonal as $el_personal) {
    ?>
							<option value=<?php 
    echo $el_personal->id;
    ?>
><?php 
    echo $el_personal->nombreCompleto;
    ?>
</option>
						<?php 
}
?>
			</select>
		</form>
		</div>
echo $form->labelEx($tabla_seguimiento, 'tema_id');
?>
					<?php 
echo $form->dropDownList($tabla_seguimiento, 'tema_id', CHtml::listData(SeguimientoTema::model()->findAll("estado = 'Activo' order by 'nombre'"), 'id', 'nombre'), array('class' => 'input-xlarge'));
?>
					<?php 
echo $form->error($tabla_seguimiento, 'tema_id');
?>
				</div>

				<div class = 'span7'>
					<?php 
echo $form->labelEx($tabla_seguimiento, 'responsable_id');
?>
					<?php 
echo $form->dropDownList($tabla_seguimiento, 'responsable_id', CHtml::listData(Personal::model()->findAll("activo = 'SI' order by 'nombreCompleto'"), 'id', 'nombreCompleto'), array('class' => 'input-xlarge'));
?>
					<?php 
echo $form->error($tabla_seguimiento, 'responsable_id');
?>
				</div>

				<div class = 'span10'>
					<?php 
echo $form->labelEx($tabla_seguimiento, 'observaciones');
?>
					<?php 
echo $form->textArea($tabla_seguimiento, 'observaciones', array('rows' => 4, 'cols' => 50, 'class' => 'input-xxlarge'));
?>
					<?php 
echo $form->error($tabla_seguimiento, 'observaciones');
/* @var $this PagoCosmetologasController */
/* @var $model PagoCosmetologas */
$this->menu = array();
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#pago-cosmetologas-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Pago a Asistenciales - <a href="#exportar" class="btn btn-warning" role="button" data-toggle="modal"><i class="icon-share-alt icon-white"></i> Exportar</a></h1>

<div class="search-form" style="display:none">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->
<DIV style='width:150%; overflow:scroll;'>
<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'pago-cosmetologas-grid', 'dataProvider' => $model->search(), 'afterAjaxUpdate' => 'reinstallDatePickerPagoCosmetologa', 'filter' => $model, 'columns' => array(array('header' => 'ID.', 'name' => 'id', 'value' => '$data->id', 'htmlOptions' => array('width' => '20')), array('header' => '<small>Nombre Paciente</small>', 'name' => 'nombre_paciente', 'value' => '$data->paciente->nombre', 'htmlOptions' => array('width' => '100'), 'headerHtmlOptions' => array('style' => 'width:150px;text-align:center;')), array('header' => '<small>Apellido Paciente</small>', 'name' => 'apellido_paciente', 'value' => '$data->paciente->apellido', 'htmlOptions' => array('width' => '100'), 'headerHtmlOptions' => array('style' => 'width:150px;text-align:center;')), 'n_identificacion', array('header' => '<small>Asistencial</small>', 'name' => 'personal_id', 'filter' => CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC', 'condition' => "activo = 'SI'")), 'id', 'nombreCompleto'), 'value' => '$data[\'personal\'][\'nombreCompleto\']', 'htmlOptions' => array('width' => '220')), array('header' => '<small>Tratamiento Realizado</small>', 'name' => 'linea_servicio_id', 'filter' => CHtml::listData(LineaServicio::model()->findAll(array('order' => 'nombre ASC', 'condition' => "estado = 'activo'")), 'id', 'nombre'), 'value' => '$data[\'lineaServicio\'][\'nombre\']', 'htmlOptions' => array('width' => '220')), 'sesion', array('header' => '<small>Fecha de acción</small>', 'name' => 'fecha', 'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array('language' => 'es', 'model' => $model, 'attribute' => 'fecha', 'options' => array('showAnim' => 'fold', 'language' => 'es', 'dateFormat' => 'dd-mm-yy', 'changeMonth' => true, 'changeYear' => true, 'yearRange' => '2014:2025'), 'htmlOptions' => array('id' => 'datepicker_for_fecha', 'style' => 'height:20px;width:80px;'), 'defaultOptions' => array('showOn' => 'focus', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true)), true), 'value' => 'Yii::app()->dateformatter->format("dd-MM-yyyy",$data[\'fecha\']);', 'htmlOptions' => array('width' => '120')), 'contrato_id', array('name' => 'valor_tratamiento', 'value' => 'number_format($data->valor_tratamiento,2)', 'htmlOptions' => array('width' => '120'), 'footer' => "<h6>\$ " . number_format($model->getTotal($model->searchSuma()), 2) . '</h6>'), array('header' => '<small>Tratamiento con Descuento</small>', 'name' => 'valor_tratamiento_desc', 'value' => 'number_format($data->valor_tratamiento_desc,2)', 'htmlOptions' => array('width' => '120'), 'footer' => "<h6>\$ " . number_format($model->getTotal5($model->searchSuma()), 2) . '</h6>'), array('name' => 'valor_comision', 'value' => 'number_format($data->valor_comision,2)', 'htmlOptions' => array('width' => '120'), 'footer' => "<h6>\$ " . number_format($model->getTotal2($model->searchSuma()), 2) . '</h6>'), array('header' => 'Vendedor', 'name' => 'vendedor_id', 'filter' => CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC', 'condition' => "activo = 'SI'")), 'id', 'nombreCompleto'), 'value' => '$data[\'vendedor\'][\'nombreCompleto\']', 'htmlOptions' => array('width' => '220')), array('header' => 'Establecio estado', 'name' => 'aprobo_id', 'filter' => CHtml::listData(Personal::model()->findAll(array('order' => 'nombres ASC', 'condition' => "activo = 'SI'")), 'id', 'nombreCompleto'), 'value' => '$data[\'aprobo\'][\'nombreCompleto\']', 'htmlOptions' => array('width' => '220')), array('header' => 'Total de Pago', 'name' => 'total_pago', 'value' => 'number_format($data->total_pago,2)', 'htmlOptions' => array('width' => '120'), 'footer' => "<h6>\$ " . number_format($model->getTotal4($model->searchSuma()), 2) . '</h6>'), array('header' => 'Saldo a Favor', 'name' => 'saldo', 'value' => 'number_format($data->saldo,2)', 'htmlOptions' => array('width' => '120')))));
Yii::app()->clientScript->registerScript('re-install-date-picker', "\nfunction reinstallDatePickerPagoCosmetologa(id, data) {\n        //use the same parameters that you had set in your widget else the datepicker will be refreshed by default\n    \$('#datepicker_for_fecha').datepicker(jQuery.extend({showMonthAfterYear:false},jQuery.datepicker.regional['es'],{'dateFormat':'dd-mm-yy'}));\n    //\$('#datepicker_for_fecha').datepicker(\$.datepicker.regional[ 'es' ]);\n  //\$('#datepicker_for_fecha').datepicker({dateFormat: 'dd-mm-yy'});\n}\n");
?>
</div>
<div id="exportar" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalLabel">Exportar a un archivo de Excel </h3>
  </div>
  <div class="modal-body">
  	<p>Seleccione las opciones de Exportar</p>
 	<form id="frmExportar" name="frmExportar" action="index.php?r=PagoCosmetologas/exportar&tipo=<?php 
$elTipo;
?>
" method = "post">
  		<div class="span5">