コード例 #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new PacienteBaul();
     $paciente = Paciente::model()->findByPk($_GET['idPaciente']);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['PacienteBaul'])) {
         $model->attributes = $_POST['PacienteBaul'];
         $model->paciente_id = $_GET['idPaciente'];
         $model->personal_id = Yii::app()->user->usuarioId;
         $model->detalle = $_POST['PacienteBaul']['detalle'];
         $model->fecha = date("Y-m-d H:i:s");
         if ($model->save()) {
             $losarchivos = TempImagenes::model()->findAll();
         }
         foreach ($losarchivos as $los_archivos) {
             $losAdjuntos = new PacienteBaulDetalle();
             //Tabla que queda
             $losAdjuntos->paciente_baul_id = $model->id;
             $losAdjuntos->archivo = $los_archivos->archivo;
             $losAdjuntos->save();
         }
         TempImagenes::model()->deleteAll();
         $this->redirect(array('view', 'id' => $model->id));
     }
     $this->render('create', array('model' => $model, 'paciente' => $paciente));
 }
コード例 #2
0
 public function actionIndex()
 {
     $pacientes = Paciente::model()->findAll();
     $pacientesSelect2 = array();
     $pacientesSelect2['html'] = ModelDataParser::toHtmlValueTag($pacientes, 'option', 'id', array('nombre1', 'apellido1'), true);
     if (isset($_GET['id'])) {
         $model = Paciente::model()->findByPk($_GET['id']);
         if (isset($model)) {
             $pacientesSelect2['selected'] = $model->id;
         } else {
             $pacientesSelect2['selected'] = '-1';
         }
     }
     $this->render('index', array('pacientes' => $pacientes, 'pacientesSelect2' => $pacientesSelect2));
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new SeguimientoComercial();
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['SeguimientoComercial'])) {
         $model->attributes = $_POST['SeguimientoComercial'];
         $model->personal_creador_id = $_POST['SeguimientoComercial']['id_personal'];
         //Cedula
         $lacedula = Paciente::model()->findByPk($_POST['SeguimientoComercial']['paciente_id']);
         $model->paciente_documento = $lacedula->n_identificacion;
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
コード例 #4
0
 public function actionPacienteAutoComplete()
 {
     $search = $_GET['term'];
     $criteria = new CDbCriteria();
     $criteria->compare('id', $search, true, 'OR');
     $criteria->compare('nombre1', $search, true, 'OR');
     $criteria->compare('nombre2', $search, true, 'OR');
     $criteria->compare('apellido1', $search, true, 'OR');
     $criteria->compare('apellido2', $search, true, 'OR');
     $criteria->order = 'nombre1';
     $pacientes = Paciente::model()->findAll($criteria);
     $array = array();
     foreach ($pacientes as $paciente) {
         $array[] = $paciente->id . " - " . $paciente->nombre1 . ' ' . $paciente->apellido1;
     }
     echo CJSON::encode($array);
 }
コード例 #5
0
 public function getEdoCivil($id)
 {
     //'0'=>'Soltera','1'=>'Casada','2'=>'Divorciada','3'=>'Viuda','4'=>'Concubino'
     $model = Paciente::model()->findByPk($id);
     if ($model->edo_civil == '0') {
         return 'Soltera';
     } else {
         if ($model->edo_civil == '1') {
             return 'Casada';
         } else {
             if ($model->edo_civil == '2') {
                 return 'Divorciada';
             } else {
                 if ($model->edo_civil == '3') {
                     return 'Viuda';
                 } else {
                     return 'Concubino';
                 }
             }
         }
     }
 }
コード例 #6
0
    $laCita = "0";
}
$elPaciente = $model->paciente_id;
$paciente = Paciente::model()->find("id={$elPaciente}");
$registros = HistorialNotasEnfermeriaDetalles::model()->findAll("historial_notas_enfermeria_id = {$model->id}");
?>


<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'historial-notas-enfermeria-form', 'htmlOptions' => array('onsubmit' => "onEnviar()"), 'enableAjaxValidation' => false));
?>


	<?php 
echo $form->errorSummary($model);
$datosPaciente = Paciente::model()->find("id={$elPaciente}");
?>
<div class="row">
		<h4 class="text-center">Datos de Paciente</h4>
		<div class="span1"></div>
		<div class="span5">
			<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $datosPaciente, 'attributes' => array('nombreCompleto', 'n_identificacion', 'edad')));
?>
		</div>
		<div class="span5">
			<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $datosPaciente, 'attributes' => array('email', 'telefono1', 'celular')));
?>
		</div>
		<div class="span1"></div>
コード例 #7
0
/* @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');
コード例 #8
0
 /**
  * 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 Paciente the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Paciente::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #9
0
/* @var $this ContratosController */
/* @var $model Contratos */
$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\$('#contratos-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Cuentas por Cobrar</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' => 'contratos-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('header' => 'Contrato', 'name' => 'id', 'value' => '$data->id', 'htmlOptions' => array('width' => '30')), array('header' => 'Paciente', 'name' => 'paciente_id', 'filter' => CHtml::listData(Paciente::model()->findAll(), 'id', 'nombreCompleto'), 'value' => '$data[\'paciente\'][\'nombreCompleto\']', 'htmlOptions' => array('width' => '250')), array('header' => 'Cedula', 'name' => 'n_identificacion', 'value' => '$data[\'n_identificacion\']', 'htmlOptions' => array('width' => '250')), array('header' => 'Saldo de deuda ($)', 'name' => 'saldo', 'value' => 'number_format($data->saldo,2)', 'footer' => "<h5>\$ " . number_format($model->search()->itemCount === 0 ? '' : $model->getTotal($model->search()), 2) . '</h5>'), array('header' => 'Total de deuda ($)', 'name' => 'total', 'value' => 'number_format($data->total,2)', 'footer' => "<h5>\$ " . number_format($model->search()->itemCount === 0 ? '' : $model->getTotal2($model->search()), 2) . '</h5>'), array('class' => 'CButtonColumn', 'template' => '{view}'))));
?>

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

            location.href = '<?php 
echo Yii::app()->createUrl('contratos/view');
?>
コード例 #10
0
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     //Yii::app()->clientScript->registerScript('uniqueid', 'alert("ok");alert("ok2");');
     $model = new Evento('search');
     $model_paciente = Paciente::model()->findAll();
     $autoCompletePaciente = Base::toAutoCompleteFormat($model_paciente);
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Evento'])) {
         $model->attributes = $_GET['Evento'];
     }
     $this->render('admin', array('model' => $model, 'calendarJSON' => $this->cargarEventos(), 'model_paciente' => $model_paciente, 'autoCompletePaciente' => $autoCompletePaciente));
 }
コード例 #11
0
		<td width=75%>
			<h1>Smadia Clinic</h1>
			<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>"));
コード例 #12
0
/* @var $form CActiveForm */
?>

<div class="form">

<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'hoja-gastos-form', 'enableAjaxValidation' => false));
if (isset($_GET['idCita'])) {
    $laCita = $_GET['idCita'];
} else {
    $laCita = "0";
}
if (isset($_GET['idPaciente'])) {
    $idPaciente = $_GET['idPaciente'];
    //$idPaciente = $datosCita->paciente_id;
    $paciente = Paciente::model()->findByPk($idPaciente);
} else {
    $idPaciente = "0";
}
$datosCita = Citas::model()->findByPk($laCita);
if ($laCita != 0) {
    ?>
	<?php 
    echo $form->errorSummary($model);
    ?>

	<div class="row">
		
		<div class="span1"></div>
		<div class="span5">
			<h4 class="text-center">Datos de Paciente</h4>
コード例 #13
0
 public function actionAnular()
 {
     $id = $_GET['id'];
     if ($_POST['clave'] == "super") {
         //Proceso de anulación
         $elIngreso = Ingresos::model()->findByPk($id);
         $ingresoActual = $elIngreso->valor;
         $elIngreso->valor = $elIngreso->valor - $elIngreso->valor * 2;
         $elIngreso->estado = "Anulado";
         $elIngreso->observacion_anular = $_POST['observacion_anular'];
         $iddepaciente = $elIngreso->paciente_id;
         if ($elIngreso->save()) {
             if ($elIngreso->contrato_id != NULL) {
                 //Actualizar Saldo de contrato
                 $datoContrato = Contratos::model()->findByPk($elIngreso->contrato_id);
                 $datoContrato->saldo = $datoContrato->saldo + $ingresoActual;
                 $datoContrato->save();
             } else {
                 //Buscar Caja Personal de Paciente
                 $cajaPersonal = Paciente::model()->findByPk($iddepaciente);
                 $cajaPersonal->saldo = $cajaPersonal->saldo - $ingresoActual;
                 $cajaPersonal->update();
                 //Movimientos
                 $movimientosCaja = new PacienteMovimientos();
                 $movimientosCaja->paciente_id = $iddepaciente;
                 $movimientosCaja->valor = $ingresoActual * -1;
                 $movimientosCaja->tipo = "Anulado";
                 $movimientosCaja->ingreso_id = $id;
                 $movimientosCaja->sub_tipo = "Ingreso sin Contrato Anulado";
                 $movimientosCaja->descripcion = "Se anula ingreso a caja personal";
                 $movimientosCaja->usuario_id = Yii::app()->user->usuarioId;
                 $movimientosCaja->fecha = date("Y-m-d H:i:s");
                 $movimientosCaja->save();
             }
             //Actualizar caja si es efectivo
             if ($elIngreso->forma_pago == "Efectivo") {
                 $datoCaja = CajaEfectivo::model()->findByPk($elIngreso->personal_id);
                 $datoCaja->total = $datoCaja->total - $ingresoActual;
                 $datoCaja->save();
                 $datoCajaDetalle = CajaEfectivoDetalle::model()->find("ingreso_id = {$elIngreso->id}");
                 $datoCajaDetalle->tipo = "Ingreso Anulado";
                 $datoCajaDetalle->monto = $datoCajaDetalle->monto * -1;
                 $datoCajaDetalle->update();
             }
             Yii::app()->user->setFlash('success', "Se ha realizado con éxito la anulación");
             $this->redirect(array('view', 'id' => $id));
         }
     } else {
         Yii::app()->user->setFlash('error', "Usted no esta autorizado para realizar esta anulación");
         $this->redirect(array('view', 'id' => $id));
     }
 }
コード例 #14
0
/* @var $this CuentasXcController */
/* @var $model CuentasXc */
$this->menu = array(array('label' => 'Cuentas por Paciente', 'url' => "index.php?r=cuentasXc/admin"), array('label' => 'Cuentas por Contrato', 'url' => "index.php?r=cuentasXcDetalle/contratos"), array('label' => 'Cuentas por Servicio', 'url' => "index.php?r=cuentasXcDetalle/servicio"));
?>

<h1>Cuentas por Cobrar por Linea de Servicio sin Contrato</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' => 'cuentas-xc-grid', 'dataProvider' => $model->search2(), '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(), 'id', 'nombreCompleto'), 'value' => '$data[\'paciente\'][\'nombreCompleto\']', 'htmlOptions' => array('width' => '220')), 'n_identificacion', array('header' => 'Linea de Servicio', 'name' => 'linea_servicio_id', 'filter' => CHtml::listData(LineaServicio::model()->findAll(), 'id', 'nombre'), 'value' => '$data[\'linea\'][\'nombre\']'), 'cita_id', array('name' => 'saldo', 'value' => 'number_format($data->saldo,2)', 'htmlOptions' => array('width' => '120'), 'footer' => "<h5>\$ " . number_format($model->search()->itemCount === 0 ? '' : $model->getTotal2($model->search2()), 2) . '</h5>'), array('class' => 'CButtonColumn', 'template' => ''))));
?>


<script>
$(document).ready(function()
    {
        $('body').on('dblclick', '#cuentas-xc-grid tbody tr', function(event)
        {
                var citaID= $(this).find('td:nth-child(5)').text();
                
            location.href = '<?php 
echo Yii::app()->createUrl('citas/view');
?>
&id=' + citaID;
        });
コード例 #15
0
ファイル: _form.php プロジェクト: edarkzero/GineObs
echo $form->labelEx($model, 'paga');
?>
		<?php 
echo $form->textField($model, 'paga');
?>
		<?php 
echo $form->error($model, 'paga');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'paciente_id');
?>
		<?php 
echo $form->dropDownList($model, 'paciente_id', CHtml::listData(Paciente::model()->findAll(array('order' => 'nombre1')), 'id', 'nombreCompleto'), array('empty' => 'Seleccione paciente'));
?>
		<?php 
echo $form->error($model, 'paciente_id');
?>
	</div>

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

<?php 
$this->endWidget();
?>
コード例 #16
0
 public function actionGuardarContratos()
 {
     if (!isset($_GET['idPaciente'])) {
         $model = new Contratos();
         //Buscar Presupuesto
         $elpresupuesto = Presupuesto::model()->findByPk($_GET['idpresupuesto']);
         $model->presupuesto_id = $elpresupuesto->id;
         $model->paciente_id = $elpresupuesto->paciente_id;
         $model->total = $elpresupuesto->total;
         $model->saldo = $elpresupuesto->total;
         $model->n_identificacion = $elpresupuesto->paciente->n_identificacion;
         $model->estado = "Sin Confirmar";
         $model->fecha_sola = date("Y-m-d");
         $model->fechahora = date("Y-m-d H:i:s");
         $model->vendedor_id = $elpresupuesto->vendedor_id;
         $model->usuario_id = $elpresupuesto->usuario_id;
         $model->observaciones = $elpresupuesto->observaciones;
         if ($model->save()) {
             $detallePresupuesto = PresupuestoDetalle::model()->findAll("presupuesto_id={$elpresupuesto->id}");
             foreach ($detallePresupuesto as $detalle_presupuesto) {
                 $detalleContrato = new ContratoDetalle();
                 $detalleContrato->contrato_id = $model->id;
                 $detalleContrato->linea_servicio_id = $detalle_presupuesto->linea_servicio_id;
                 $detalleContrato->cantidad = $detalle_presupuesto->cantidad;
                 $detalleContrato->vu = $detalle_presupuesto->vu;
                 $detalleContrato->desc = $detalle_presupuesto->desc;
                 $detalleContrato->vu_desc = $detalle_presupuesto->vu_desc;
                 $detalleContrato->vt_sin_desc = $detalle_presupuesto->vt_sin_desc;
                 $detalleContrato->vt_con_desc = $detalle_presupuesto->vt_con_desc;
                 $detalleContrato->estado = "Activo";
                 $detalleContrato->total = $detalle_presupuesto->total;
                 $detalleContrato->save();
             }
             $elpresupuesto->estado = "Contratado";
             $elpresupuesto->save();
             $ElTratamiento = ContratoDetalle::model()->find("contrato_id = {$model->id}");
             $paraTotal = Contratos::model()->findByPk($model->id);
             $paraTotal->tratamiento = $ElTratamiento->lineaServicio->nombre;
             $paraTotal->save();
         }
         $this->redirect(array('view', 'id' => $model->id));
         //
     } else {
         $model = new Contratos();
         // Uncomment the following line if AJAX validation is needed
         // $this->performAjaxValidation($model);
         // if(isset($_POST['Presupuesto']))
         // {
         //$model->attributes=$_POST['Presupuesto'];
         $datoPaciente = Paciente::model()->findByPk($_GET['idPaciente']);
         $model->paciente_id = $_GET['idPaciente'];
         $model->estado = "Activo";
         $model->n_identificacion = $datoPaciente->n_identificacion;
         $model->fechahora = date("Y-m-d H:i:s");
         $model->vendedor_id = $_POST['vendedor_id'];
         $model->observaciones = $_POST['observaciones'];
         $model->usuario_id = Yii::app()->user->usuarioId;
         if ($model->save()) {
             $eltotal = 0;
             for ($i = 0; $i <= $_POST['variable']; $i++) {
                 //$x = $i+1;
                 //
                 if (isset($_POST['linea_' . $i])) {
                     $detalleP = new ContratoDetalle();
                     $detalleP->contrato_id = $model->id;
                     $detalleP->linea_servicio_id = $_POST['linea_' . $i];
                     $detalleP->cantidad = $_POST['cantidad_' . $i];
                     $detalleP->vu = $_POST['vu_' . $i];
                     $detalleP->desc = $_POST['desc_' . $i];
                     $detalleP->vu_desc = $_POST['vu_desc_' . $i];
                     $detalleP->vt_sin_desc = $_POST['vt_sin_desc_' . $i];
                     $detalleP->vt_con_desc = $_POST['vt_con_desc_' . $i];
                     $detalleP->total = $_POST['total_' . $i];
                     $detalleP->estado = "Activo";
                     $eltotal = $eltotal + $_POST['total_' . $i];
                     $detalleP->save();
                 }
             }
             $ElTratamiento = ContratoDetalle::model()->find("contrato_id = {$model->id}");
             $paraTotal = Contratos::model()->findByPk($model->id);
             $paraTotal->tratamiento = $ElTratamiento->lineaServicio->nombre;
             $paraTotal->total = $eltotal;
             $paraTotal->saldo = $eltotal;
             $paraTotal->save();
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
 }
コード例 #17
0
 public function actionViewCaja($id)
 {
     $this->render('viewCaja', array('model' => $ingreso = Paciente::model()->findByPk($id)));
 }
コード例 #18
0
/* @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;
コード例 #19
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Citas();
     $model->scenario = 'nueva';
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     if (isset($_POST['Citas'])) {
         $fechaCita = Yii::app()->dateformatter->format("yyyy-MM-dd", $_POST['Citas']['fecha_cita']);
         $horadeFin = $_POST['Citas']['hora_fin'];
         $horadeInicio = $_POST['Citas']['hora_inicio'];
         $laLineaServicio = $_POST['Citas']['linea_servicio_id'];
         /////Agregar equipo a reserva
         //Buscar equipo de la linea de servicio seleccionada.
         //$equiposDisponibles = Equipos::model()->findAll("linea_servicio_id = $laLineaServicio");
         $equiposDisponibles = EquiposLineaServicio::model()->findAll("linea_servicio_id = {$laLineaServicio}");
         if ($equiposDisponibles) {
             $sihayDisponible = 0;
             $lasuperllave = 0;
             $laInsidencia = 0;
             $lallave = 0;
             $conteoEquipo = 0;
             $hayuno = 0;
             //Consultar en agenda de equipos reservados //Buscar equipo que tenga esa linea de servicio
             //Contar cuantos equipos hay
             // $agendaEquipos = CitasEquipo::model()->findAll("fecha = '$fechaCita' and linea_servicio_id = $laLineaServicio");
             foreach ($equiposDisponibles as $equipos_disponibles) {
                 //Verificar si hay mas de 1 equipo desponible
                 $agendaEquipos = CitasEquipo::model()->findAll("fecha = '{$fechaCita}' and equipo_id = {$equipos_disponibles->equipo_id}");
                 if ($agendaEquipos) {
                     $conteoEquipo = 1;
                 } else {
                     $numerodeEquipo = $equipos_disponibles->equipo_id;
                 }
             }
             if ($conteoEquipo == 1) {
                 //Verificar equipo en la agenda
                 $agendaEquipos = CitasEquipo::model()->findAll("fecha = '{$fechaCita}'");
                 foreach ($equiposDisponibles as $equipos_disponibles) {
                     $lallave = 0;
                     $laInsidencia = 0;
                     foreach ($agendaEquipos as $agenda_equipos) {
                         if ($equipos_disponibles->equipo_id == $agenda_equipos->equipo_id) {
                             $lallave = 1;
                             //Si hay uno
                             if ($horadeInicio >= $agenda_equipos->hora_inicio and $horadeInicio <= $agenda_equipos->hora_fin and $agenda_equipos->fecha == $fechaCita and $agenda_equipos->equipo_id == $equipos_disponibles->equipo_id) {
                                 $laInsidencia = 1;
                             }
                             if ($horadeFin >= $agenda_equipos->hora_inicio and $horadeFin <= $agenda_equipos->hora_fin and $agenda_equipos->fecha == $fechaCita and $agenda_equipos->equipo_id == $equipos_disponibles->equipo_id) {
                                 $laInsidencia = 1;
                             }
                         }
                         //Si hay
                         if ($laInsidencia == 0) {
                             $hayuno = $equipos_disponibles->equipo_id;
                         }
                     }
                     if ($hayuno > 0) {
                         $laInsidencia = 0;
                         $equipos_disponibles->equipo_id = $hayuno;
                     }
                     if ($laInsidencia == 0 and $lallave == 1) {
                         $numerodeEquipo = $equipos_disponibles->equipo_id;
                     }
                     //Comienza ingreso de equipo a reserva
                     if ($laInsidencia == 0) {
                         if ($lasuperllave == 0) {
                             $lasuperllave = 1;
                             $lallave = 2;
                             //Guardo
                             $reservaEquipos = new CitasEquipo();
                             $reservaEquipos->fecha = $fechaCita;
                             //$reservaEquipos->equipo_id = $equipos_disponibles->equipo_id;
                             $reservaEquipos->equipo_id = $numerodeEquipo;
                             $reservaEquipos->linea_servicio_id = $laLineaServicio;
                         }
                     }
                     //Evaluar llave
                     if ($lallave == 0) {
                         if ($sihayDisponible == 0) {
                             $numerodeEquipo = $equipos_disponibles->equipo_id;
                             //$sihayDisponible = 1; EVALUAR
                         }
                     }
                 }
             } else {
                 $unEquipo = EquiposLineaServicio::model()->find("linea_servicio_id = {$laLineaServicio}");
                 //Es este :D
                 $reservaEquipos = new CitasEquipo();
                 $reservaEquipos->fecha = $fechaCita;
                 $reservaEquipos->equipo_id = $numerodeEquipo;
                 $reservaEquipos->linea_servicio_id = $laLineaServicio;
                 //Yii::app()->user->setFlash('error',"No debe de hacerlo aqui".$unEquipo->id);
             }
             if ($sihayDisponible == 1) {
                 $reservaEquipos = new CitasEquipo();
                 $reservaEquipos->fecha = $fechaCita;
                 $reservaEquipos->equipo_id = $numerodeEquipo;
                 $reservaEquipos->linea_servicio_id = $laLineaServicio;
                 //Yii::app()->user->setFlash('error',"Esta es una maravilla".$equipos_disponibles->id);
             }
         } else {
             $reservaEquipos = new CitasEquipo();
             $laInsidencia = 0;
             //Ojo con esto
         }
         $elPaciente = Paciente::model()->findByPk($_POST['Citas']['paciente_id']);
         $model->attributes = $_POST['Citas'];
         $model->fecha_cita = $fechaCita;
         $model->n_identificacion = $elPaciente->n_identificacion;
         $model->hora_fin = $_POST['Citas']['hora_fin'] - 1;
         $model->hora_fin_mostrar = $_POST['Citas']['hora_fin'];
         $model->contrato_id = $_POST['elContrato'];
         $model->usuario_id = Yii::app()->user->usuarioId;
         $model->estado = "Programada";
         //$model->equipo_adicional = $_POST['Citas']['equipo_adicional'];
         $model->fecha_creacion = date("Y-m-d");
         $model->fecha_hora_creacion = date("Y-m-d H:i:s");
         if ($laInsidencia == 1) {
             Yii::app()->user->setFlash('error', "No hay equipos disponibles para esta cita");
             $this->redirect(array('citas/create&hora=1&idpaciente=' . $model->paciente_id . '&medico=' . $model->personal_id . '&fecha=' . $model->fecha_cita));
         } else {
             if ($model->save()) {
                 //Actualizar estado de Detalle de Contrato
                 if ($model->contrato_id != NULL) {
                     //Buscar Detalle
                     $detalleContrato = ContratoDetalle::model()->findAll("contrato_id = {$model->contrato_id} and estado = 'Activo'");
                     foreach ($detalleContrato as $detalle_contrato) {
                         if ($model->linea_servicio_id == $detalle_contrato->linea_servicio_id) {
                             $paraActualizar = ContratoDetalle::model()->findByPk($detalle_contrato->id);
                             $paraActualizar->estado = "Programada";
                             $paraActualizar->save();
                         }
                     }
                 }
                 //Terminar consulta de reserva de equipo
                 $reservaEquipos->hora_inicio = $model->hora_inicio;
                 $reservaEquipos->hora_fin = $model->hora_fin;
                 $reservaEquipos->hora_fin_mostrar = $model->hora_fin + 1;
                 $reservaEquipos->cita_id = $model->id;
                 $reservaEquipos->save();
                 //Envio de Correo
                 if ($model->correo == "Si") {
                     $this->actionEnvioCorreo($model->id);
                 }
                 $this->redirect(array('view', 'id' => $model->id));
             }
         }
     }
     $this->render('create', array('model' => $model));
 }
コード例 #20
0
    }
}
?>
<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'),
コード例 #21
0
 public function actionCreate()
 {
     $model = new Ventas();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Ventas'])) {
         //Datos de Paciente
         $elPaciente = Paciente::model()->findByPk($_POST['elpaciente_id']);
         if ($_POST['Ventas']['credito_fecha'] == "") {
             $fechaCredito = "0000-00-00";
         } else {
             $fechaCredito = Yii::app()->dateformatter->format("yyyy-MM-dd", $_POST['Ventas']['credito_fecha']);
         }
         if ($_POST['Ventas']['credito_fecha2'] == "") {
             $fechaCredito2 = "0000-00-00";
         } else {
             $fechaCredito2 = Yii::app()->dateformatter->format("yyyy-MM-dd", $_POST['Ventas']['credito_fecha2']);
         }
         $model->attributes = $_POST['Ventas'];
         $model->forma_pago = $_POST['Ventas']['forma_pago'];
         $model->descripcion = $_POST['Ventas']['descripcion'];
         $model->paciente_id = $_POST['elpaciente_id'];
         $model->n_identificacion = $elPaciente->n_identificacion;
         $model->credito_fecha = $fechaCredito;
         $model->fecha = date("Y-m-d");
         $model->fecha_hora = date("Y-m-d H:i:s");
         $model->estado = "Activo";
         $model->personal = Yii::app()->user->usuarioId;
         $model->vendedor_id = $_POST['Ventas']['vendedor_id'];
         //Mas de una forma de pago
         $model->forma_pago2 = $_POST['Ventas']['forma_pago2'];
         $model->credito_fecha2 = $fechaCredito2;
         $model->total1 = $_POST['Ventas']['total1'];
         $model->total2 = $_POST['Ventas']['total2'];
         $model->credito_dias2 = $_POST['Ventas']['credito_dias2'];
         $model->tarjeta_tipo2 = $_POST['Ventas']['tarjeta_tipo2'];
         $model->tarjeta_aprobacion2 = $_POST['Ventas']['tarjeta_aprobacion2'];
         $model->tarjeta_entidad2 = $_POST['Ventas']['tarjeta_entidad2'];
         $model->tarjeta_cuenta_banco2 = $_POST['Ventas']['tarjeta_cuenta_banco2'];
         $model->consignacion_cuenta_banco2 = $_POST['Ventas']['consignacion_cuenta_banco2'];
         $model->consignacion_banco2 = $_POST['Ventas']['consignacion_banco2'];
         $model->consignacion_cuenta2 = $_POST['Ventas']['consignacion_cuenta2'];
         if ($model->save()) {
             //Los detalles de la Compra
             for ($i = 0; $i <= $_POST['variable']; $i++) {
                 if (isset($_POST['producto_' . $i])) {
                     $detalleC = new VentasDetalle();
                     $detalleC->venta_id = $model->id;
                     $detalleC->producto_id = $_POST['producto_' . $i];
                     $detalleC->cantidad = $_POST['cantidad_' . $i];
                     $detalleC->valor = $_POST['valor_' . $i];
                     $detalleC->iva = $_POST['iva_' . $i];
                     $detalleC->total = $_POST['total_' . $i];
                     $detalleC->paciente_id = $model->paciente_id;
                     $detalleC->fecha = $model->fecha;
                     $detalleC->save();
                     //Aumentar inventario
                     $elProducto = ProductoInventario::model()->findByPk($_POST['producto_' . $i]);
                     $elProducto->cantidad = $elProducto->cantidad - $_POST['cantidad_' . $i];
                     $elProducto->save();
                 }
             }
             if ($model->forma_pago == "Cheque") {
                 //Los detalles de la Compra
                 for ($i = 0; $i <= $_POST['variablec']; $i++) {
                     if (isset($_POST['numero_' . $i])) {
                         $detalleC = new VentasCheques();
                         $detalleC->ingresos_id = $model->id;
                         $detalleC->numero = $_POST['numero_' . $i];
                         $detalleC->entidad = $_POST['entidad_' . $i];
                         $detalleC->valor = $_POST['valor_' . $i];
                         $detalleC->f_cobro = Yii::app()->dateformatter->format("yyyy-MM-dd", $_POST['fecha_cobro_' . $i]);
                         $detalleC->save();
                     }
                 }
             }
             if ($model->forma_pago == "Efectivo") {
                 //$this->actionEnvioCorreoVenta($model->id);
                 $laCaja = CajaEfectivo::model()->findByPk($model->personal);
                 if ($laCaja === null) {
                     //Nueva Caja
                     $nuevaCaja = new CajaEfectivo();
                     $nuevaCaja->personal_id = $model->personal;
                     if ($model->total2 > 0) {
                         $nuevaCaja->total = $model->total1;
                     } else {
                         $nuevaCaja->total = $model->total_venta;
                     }
                     $nuevaCaja->save();
                     //Registrar Ingreso en el detalle de caja
                     $nuevaCajaDetalle = new CajaEfectivoDetalle();
                     $nuevaCajaDetalle->caja_efectivo_id = $nuevaCaja->personal_id;
                     if ($model->total2 > 0) {
                         $nuevaCajaDetalle->monto = $model->total1;
                     } else {
                         $nuevaCajaDetalle->monto = $model->total_venta;
                     }
                     $nuevaCajaDetalle->tipo = "Venta";
                     $nuevaCajaDetalle->venta_id = $model->id;
                     $nuevaCajaDetalle->fecha = date("Y-m-d H:i:s");
                     $nuevaCajaDetalle->save();
                 } else {
                     //Actualizar Caja
                     if ($model->total2 > 0) {
                         $laCaja->total = $laCaja->total + $model->total1;
                     } else {
                         $laCaja->total = $laCaja->total + $model->total_venta;
                     }
                     $laCaja->save();
                     //Registrar Ingreso en el detalle de caja
                     $nuevaCajaDetalle = new CajaEfectivoDetalle();
                     $nuevaCajaDetalle->caja_efectivo_id = $model->personal;
                     if ($model->total2 > 0) {
                         $nuevaCajaDetalle->monto = $model->total1;
                     } else {
                         $nuevaCajaDetalle->monto = $model->total_venta;
                     }
                     $nuevaCajaDetalle->tipo = "Venta";
                     $nuevaCajaDetalle->venta_id = $model->id;
                     $nuevaCajaDetalle->fecha = date("Y-m-d H:i:s");
                     $nuevaCajaDetalle->save();
                 }
             }
             //Render de Vista
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
コード例 #22
0
?>
<div class="alert alert-info">
 <b>Atención:</b> Si al presionar el botón de Crear no sucede nada es debido a que no hay equipo disponible a la fecha y hora indicada.
</div>
	<p class="note">Campos con <span class="required">*</span> son requeridos.</p>

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

	<div class="row">
		<?php 
echo $form->labelEx($model, 'paciente_id');
?>
		<?php 
echo $form->dropDownList($model, 'paciente_id', CHtml::listData(Paciente::model()->findAll("id = {$elpaciente}"), 'id', 'NombreCompleto'), array('class' => 'input-xxlarge'));
?>
		<?php 
echo $form->error($model, 'paciente_id');
?>
	</div>

	<div class="row">
		<div class="span4">
			<?php 
echo $form->labelEx($model, 'personal_id');
?>
			<?php 
echo $form->dropDownList($model, 'personal_id', CHtml::listData(Personal::model()->findAll("activo = 'SI'"), 'id', 'NombreCompleto'), array('options' => array($elmedico => array('selected' => true)), 'class' => 'input-xlarge'));
?>
			<?php 
コード例 #23
0
?>

<?php 
if (isset($_GET['idpersonal'])) {
    $npersonal = $_GET['idpersonal'];
    $elpersonal = Perfil::model()->find("id={$npersonal}");
    echo "<h1>Crear Cita - {$elpersonal->nombre}</h1>";
} else {
    echo "<h1>Crear Cita</h1>";
}
?>

<?php 
if (isset($_GET['idpaciente'])) {
    $npaciente = $_GET['idpaciente'];
    $paciente = Paciente::model()->find("id={$npaciente}");
    $nombrePaciente = $paciente->nombre . ' ' . $paciente->apellido;
    echo "<h3>Paciente: <span class='text-error'>{$nombrePaciente}</span></h3>";
    $ruta = "&idpaciente={$npaciente}";
} 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'");
コード例 #24
0
</small>
										</td>
										<td>
											<?php 
                    if (strtotime($lahorafin->hora) < strtotime(date('h:ia'))) {
                        echo "<i class='icon-warning-sign'></i>";
                    }
                    if ($citas_programadas->llego_clinica > '2005-01-01') {
                        echo "<div class='text-center'><br><br><small class='text-error'>Paciente en Clinica</small></div>";
                    }
                    ?>
										</td>
										<?php 
                    //Valoración Inicial
                    if ($citas_programadas->linea_servicio_id == 29) {
                        $eltratamientointeres = Paciente::model()->find("id={$citas_programadas->paciente_id}");
                        if ($eltratamientointeres->tratamiento_interes_id != "") {
                            echo "<td><small><b>Tratamiento de Interes:</b><br>" . $eltratamientointeres->tratamientoInteres->name . "</small></td>";
                        } else {
                            echo "<td><small><b>Tratamiento de Interes:</b><br>NINGUNO</small></td>";
                        }
                    }
                    ?>
									</tr>
									<tr>
										<td><small><b>Observaciones: </b><?php 
                    echo substr($citas_programadas->comentario, 0, 100);
                    ?>
</small></td>
									</tr>
								</table>
コード例 #25
0
/* @var $model HistorialFormulacion */
/* @var $form CActiveForm */
?>

<?php 
if (isset($_GET['idPaciente'])) {
    $elPaciente = $_GET['idPaciente'];
} else {
    $elPaciente = "0";
}
if (isset($_GET['idCita'])) {
    $laCita = $_GET['idCita'];
} else {
    $laCita = "0";
}
$model = Paciente::model()->find("id={$elPaciente}");
//Calculo de Edad
$anio_nacimiento = Yii::app()->dateformatter->format("yyyy", $model->fecha_nacimiento);
$edadpaciente = date("Y") - $anio_nacimiento;
//array('name'=>'Edad', 'value'=>$edadpaciente, ''),
$formulaciones = Formulacion::model()->findAll(array("condition" => "id > 0", 'order' => 'nombre asc'));
?>
<div class="row">
		<h4 class="text-center">Datos de Paciente</h4>
		<div class="span1"></div>
		<div class="span5">
			<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array('nombreCompleto', 'n_identificacion', array('name' => 'Edad', 'value' => $edadpaciente, ''))));
?>
		</div>
		<div class="span5">
コード例 #26
0
/* @var $this NotaCreditoController */
/* @var $model NotaCredito */
$this->menu = array();
?>

<h1>Nota de Crédito - <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' => 'nota-credito-grid', 'dataProvider' => $model->search(), 'afterAjaxUpdate' => 'reinstallDatePickerNotaCredito', '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' => '250')), 'n_identificacion', 'contrato_id', array('header' => 'Valor ($)', 'name' => 'valor', 'value' => 'number_format($data->valor,2)', 'footer' => $model->search()->itemCount === 0 ? '' : "<h5>\$ " . number_format($model->getTotal($model->search()), 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 reinstallDatePickerNotaCredito(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=notaCredito/exportar&tipo=<?php 
$elTipo;
?>
" method = "post">
  		<div class="span5">