コード例 #1
0
echo $form->textField($model, 'rte_cree_valor', array('size' => 10, 'maxlength' => 10, 'readOnly' => 'readOnly'));
?>
			<?php 
echo $form->error($model, 'rte_cree_valor');
?>
		</div>
	</div>

	<hr>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'centro_costo_id');
?>
		<?php 
echo $form->dropDownList($model, 'centro_costo_id', CHtml::listData(CentroCosto::model()->findAll("tipo = 'Egreso' and id > 0 order by 'nombre'"), 'id', 'nombre'), array('class' => 'input-xxlarge', 'empty' => 'Ninguno'));
?>
		<?php 
echo $form->error($model, 'centro_costo_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'total_egreso');
?>
		<?php 
echo $form->textField($model, 'total_egreso', array('size' => 10, 'maxlength' => 10, 'readOnly' => 'readOnly'));
?>
		<?php 
echo $form->error($model, 'total_egreso');
コード例 #2
0
// 	//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 - <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->search(), '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->searchSuma()->itemCount === 0 ? '' : "<h6>\$ " . number_format($model->getTotal($model->searchSuma()), 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', array('header' => 'Centro de Costo', 'name' => 'centro_costo_id', 'filter' => CHtml::listData(CentroCosto::model()->findAll(array('order' => 'nombre ASC')), 'id', 'nombre'), 'value' => '$data[\'centroCosto\'][\'nombre\']', 'htmlOptions' => array('width' => '200')), '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>
コード例 #3
0
 public function searchSumaTransferencia()
 {
     // @todo Please modify the following code to remove attributes that should not be searched.
     $buscar = "'Transferencia a Paciente'";
     $centro = CentroCosto::model()->find("nombre = {$buscar}");
     $centroid = $centro->id;
     $criteria = new CDbCriteria();
     $criteria->compare('t.id', $this->id);
     $criteria->compare('paciente_id', $this->paciente_id);
     $criteria->compare('contrato_id', $this->contrato_id);
     $criteria->compare('cita_id', $this->cita_id);
     $criteria->compare('t.n_identificacion', $this->n_identificacion, true);
     $criteria->compare('valor', $this->valor, true);
     $criteria->compare('descripcion', $this->descripcion, true);
     $criteria->compare('centro_costo_id', $this->centro_costo_id);
     $criteria->compare('forma_pago', $this->forma_pago, true);
     $criteria->compare('fecha', $this->fecha, true);
     //$criteria->compare('fecha_sola',$this->fecha_sola,true);
     $criteria->compare('DATE_FORMAT(fecha_sola, \'%d-%m-%Y\')', $this->fecha_sola, true);
     $criteria->compare('cheques_cantidad', $this->cheques_cantidad);
     $criteria->compare('cheques_banco_cuenta_id', $this->cheques_banco_cuenta_id);
     $criteria->compare('cheques_total', $this->cheques_total, true);
     $criteria->compare('tarjeta_tipo', $this->tarjeta_tipo, true);
     $criteria->compare('tarjeta_aprobacion', $this->tarjeta_aprobacion, true);
     $criteria->compare('tarjeta_entidad', $this->tarjeta_entidad, true);
     $criteria->compare('t.estado', $this->estado, true);
     $criteria->compare('tarjeta_banco_cuenta_id', $this->tarjeta_banco_cuenta_id);
     $criteria->compare('consigna_banco_o', $this->consigna_banco_o, true);
     $criteria->compare('consigna_cuenta_o', $this->consigna_cuenta_o, true);
     $criteria->compare('consigna_banco_d_cuenta_id', $this->consigna_banco_d_cuenta_id);
     $criteria->compare('personal_id', $this->personal_id);
     $criteria->compare('vendedor_id', $this->vendedor_id);
     $criteria->compare('personal_seguimiento', $this->personal_seguimiento);
     $criteria->addCondition("centro_costo_id = {$centroid}");
     $criteria->with = array('paciente');
     $criteria->compare('paciente.nombre', $this->nombre_paciente, true);
     return new CActiveDataProvider($this, array('criteria' => $criteria, 'pagination' => array('pageSize' => 900000)));
 }
コード例 #4
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 CentroCosto the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = CentroCosto::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #5
0
        echo $form->textField($model, 'valor', array('size' => 20, 'maxlength' => 20, 'value' => $saldoCita->saldo, 'readOnly' => 'readOnly', 'autocomplete' => "off"));
    } else {
        echo $form->textField($model, 'valor', array('size' => 20, 'maxlength' => 20, 'autocomplete' => "off"));
    }
}
?>
			</div>
			<?php 
echo $form->error($model, 'valor');
?>

			<?php 
echo $form->labelEx($model, 'centro_costo_id');
?>
			<?php 
echo $form->dropDownList($model, 'centro_costo_id', CHtml::listData(CentroCosto::model()->findAll(array('condition' => "tipo = 'Ingreso' and id > 0", 'order' => "nombre ASC")), 'id', 'nombre'), array('class' => 'input-xxlarge', 'empty' => 'Ninguno'));
?>
			<?php 
echo $form->error($model, 'centro_costo_id');
?>

			<div class="row">
				<?php 
echo $form->labelEx($model, 'vendedor_id');
?>
				<?php 
//if ($losValores){
?>
					<?php 
echo $form->dropDownList($model, 'vendedor_id', CHtml::listData(Personal::model()->findAll(array('condition' => "activo = 'SI' and id > 0", 'order' => 'nombres ASC')), 'id', 'nombreCompleto'), array('class' => 'input-xxlarge', 'options' => array($losValoresVendedor => array('selected' => true))));
?>
コード例 #6
0
 public function actionLiquidar()
 {
     $idContrato = $_GET['id'];
     $datosContrato = Contratos::model()->findByPk($idContrato);
     $datosContrato->comentario_liquidado = $_POST['Contratos']['comentario_liquidado'];
     if ($datosContrato->comentario_liquidado == "") {
         Yii::app()->user->setFlash('error', "No se liquido el contrato. No se coloco comentario de liquidación.");
         $this->redirect(array('view', 'id' => $datosContrato->id));
     }
     //Detalle de contrato
     $total_tratamiento = 0;
     $total_tratamientos_realizados = 0;
     $total_vu = 0;
     $total_vu_descuento = 0;
     $total_vu_suma = 0;
     $total_vu_descuento_suma = 0;
     $sumaIngresos = 0;
     $total_cxc = 0;
     $total_nota_credito = 0;
     $saldo_favor = 0;
     $tipo_accion = "";
     $tratamiendo_sindescuento = 0;
     $tratamiento_condescuento = 0;
     //Saldo a Favor*****************
     $tratamientosRealizados = ContratosTratamientoRealizados::model()->findAll("contrato_id = {$datosContrato->id}");
     if ($tratamientosRealizados) {
         foreach ($tratamientosRealizados as $tratamientos_realizados) {
             $preciosTratamiento = ContratoDetalle::model()->find("contrato_id = {$tratamientos_realizados->contrato_id} and linea_servicio_id = {$tratamientos_realizados->linea_servicio_id}");
             $tratamiendo_sindescuento = $tratamiendo_sindescuento + $preciosTratamiento->vu;
             $tratamiento_condescuento = $tratamiento_condescuento + $preciosTratamiento->vu_desc;
         }
     }
     if ($datosContrato->saldo == $datosContrato->total) {
         if ($datosContrato->descuento == "Si") {
             $saldo_favor = $tratamiento_condescuento * -1;
         } else {
             $saldo_favor = $tratamiendo_sindescuento * -1;
         }
     } else {
         if ($datosContrato->descuento == "Si") {
             $saldo_favor = $datosContrato->total - $datosContrato->saldo - $tratamiento_condescuento;
         } else {
             $saldo_favor = $datosContrato->total - $datosContrato->saldo - $tratamiendo_sindescuento;
         }
     }
     //$saldo_favor = ($datosContrato->total - $datosContrato->saldo)-$tratamiento_condescuento;
     //Suma de ingresos
     $detalleIngresos = Ingresos::model()->findAll("contrato_id = {$idContrato} and estado = 'Activo'");
     if ($detalleIngresos) {
         foreach ($detalleIngresos as $detalle_ingreso) {
             $sumaIngresos = $sumaIngresos + $detalle_ingreso->valor;
         }
     }
     $datosContratoDetalle = ContratoDetalle::model()->findAll("contrato_id = {$idContrato}");
     foreach ($datosContratoDetalle as $datos_Contrato_Detalle) {
         $total_tratamiento = $total_tratamiento + $datos_Contrato_Detalle->cantidad;
         $total_tratamientos_realizados = $total_tratamientos_realizados + $datos_Contrato_Detalle->realizadas;
         $total_vu = $total_vu + $datos_Contrato_Detalle->vu;
         $total_vu_descuento = $total_vu_descuento + $datos_Contrato_Detalle->vu_desc;
         $total_vu_suma = $total_vu_suma + $datos_Contrato_Detalle->vu * $datos_Contrato_Detalle->realizadas;
         $total_vu_descuento_suma = $total_vu_descuento_suma + $datos_Contrato_Detalle->vu_desc * $datos_Contrato_Detalle->realizadas;
     }
     //$saldo_favor = $total_vu_suma;
     //se esta liquidando un contrato inclumplido = Valores sin descuento
     if ($datosContrato->descuento == "No") {
         if ($datosContrato->saldo == 0) {
             //$saldo_favor = $sumaIngresos - $total_vu_descuento;
             $saldo_favor = $sumaIngresos - $total_vu_suma;
         }
         if ($total_tratamientos_realizados <= $total_tratamiento) {
             $saldo_favor = $sumaIngresos - $total_vu_suma;
         }
     }
     //---->>>***** Aca es donde se depositara a la caja personal
     if ($saldo_favor > 0) {
         //Ingreso a caja Personal
         $PacienteCaja = Paciente::model()->findByPk($datosContrato->paciente_id);
         $PacienteCaja->saldo = $PacienteCaja->saldo + $saldo_favor;
         if ($PacienteCaja->update()) {
             $movimientosCaja = new PacienteMovimientos();
             $movimientosCaja->paciente_id = $PacienteCaja->id;
             //$movimientosCaja->valor = $PacienteCaja->saldo;
             $movimientosCaja->valor = $saldo_favor;
             $movimientosCaja->tipo = "Ingreso";
             $movimientosCaja->sub_tipo = "Nota de Crédito";
             $movimientosCaja->contrato_id = $datosContrato->id;
             $movimientosCaja->descripcion = "Ingreso a caja de paciente con nota de crédito por liquidación de contrato N°. " . $datosContrato->id;
             $movimientosCaja->usuario_id = Yii::app()->user->usuarioId;
             $movimientosCaja->fecha = date("Y-m-d H:i:s");
             //$movimientosCaja->save();
             if ($movimientosCaja->save()) {
                 $notadeCredito = new NotaCredito();
                 $notadeCredito->paciente_id = $datosContrato->paciente_id;
                 $notadeCredito->n_identificacion = $datosContrato->n_identificacion;
                 $notadeCredito->contrato_id = $datosContrato->id;
                 $notadeCredito->valor = $saldo_favor;
                 $notadeCredito->fecha = date("Y-m-d");
                 $notadeCredito->fecha_hora = date("Y-m-d H:i:s");
                 $notadeCredito->personal_id = Yii::app()->user->usuarioId;
                 $notadeCredito->save();
                 //Buscar Centro de Costo
                 $centrodecosto = CentroCosto::model()->find("nombre = 'Nota Credito'");
                 $nuevoIngreso = new Ingresos();
                 $nuevoIngreso->paciente_id = $datosContrato->paciente_id;
                 $nuevoIngreso->n_identificacion = $datosContrato->n_identificacion;
                 //$nuevoIngreso->contrato_id = $datosContrato->id;
                 $nuevoIngreso->valor = $saldo_favor;
                 $nuevoIngreso->descripcion = "Ingreso a caja de paciente por Nota de Crédito N° " . $notadeCredito->id;
                 $nuevoIngreso->centro_costo_id = $centrodecosto->id;
                 $nuevoIngreso->forma_pago = "Nota de Crédito";
                 $nuevoIngreso->fecha_sola = date("Y-m-d");
                 $nuevoIngreso->fecha = date("Y-m-d H:i:s");
                 $nuevoIngreso->personal_id = Yii::app()->user->usuarioId;
                 $nuevoIngreso->estado = "Activo";
                 $nuevoIngreso->vendedor_id = Yii::app()->user->usuarioId;
                 $nuevoIngreso->personal_seguimiento = Yii::app()->user->usuarioId;
                 $nuevoIngreso->save();
                 $datosContrato->estado = "Liquidado";
                 $datosContrato->update();
                 foreach ($datosContratoDetalle as $datos_contrato_detalle) {
                     $datos_contrato_detalle->estado = "Liquidado";
                     $datos_contrato_detalle->update();
                 }
                 $this->redirect(array('view', 'id' => $datosContrato->id));
             }
         }
     }
     if ($saldo_favor < 0) {
         if ($datosContrato->saldo == 0) {
             // $datosContrato->estado = "Liquidado";
             // $datosContrato->update();
             // foreach ($datosContratoDetalle as $datos_contrato_detalle)
             // {
             // 		$datos_contrato_detalle->estado = "Liquidado";
             // 		$datos_contrato_detalle->update();
             // }
             // $this->redirect(array('view','id'=>$datosContrato->id));
         }
         //Comentado
         // if ($datosContrato->saldo > 0) //No ha pagado contrato, los tratamientos van sin descuento
         // {
         // 	$datosContrato->estado = "Liquidado";
         // 	$datosContrato->update();
         // 	foreach ($datosContratoDetalle as $datos_contrato_detalle)
         // 	{
         // 			$datos_contrato_detalle->estado = "Liquidado";
         // 			$datos_contrato_detalle->update();
         // 	}
         // 	$this->redirect(array('view','id'=>$datosContrato->id));
         // }
         //Buscar si hay cuenta por cobrar madre
         $laCuenta = CuentasXc::model()->find("paciente_id = {$datosContrato->paciente_id}");
         if ($laCuenta) {
             $laCuentaExiste = CuentasXcDetalle::model()->find("contrato_id = {$datosContrato->id}");
             if ($laCuentaExiste) {
                 $laCuentaExiste->saldo = $saldo_favor * -1;
                 $laCuentaExiste->update();
                 $sumadetalles = CuentasXcDetalle::model()->findAll("paciente_id = {$datosContrato->paciente_id}");
                 $total_detalles = 0;
                 foreach ($sumadetalles as $suma_detalles) {
                     $total_detalles = $total_detalles + $suma_detalles->saldo;
                 }
                 $cuentaPrincipal = CuentasXc::model()->find("paciente_id = {$datosContrato->paciente_id}");
                 $cuentaPrincipal->saldo = $total_detalles;
                 $cuentaPrincipal->update();
             } else {
                 $detallesCuenta = new CuentasXcDetalle();
                 $detallesCuenta->cuentas_xc_id = $laCuenta->id;
                 $detallesCuenta->paciente_id = $datosContrato->paciente_id;
                 $detallesCuenta->n_identificacion = $datosContrato->n_identificacion;
                 $detallesCuenta->contrato_id = $datosContrato->id;
                 $detallesCuenta->saldo = $saldo_favor * -1;
                 $detallesCuenta->save();
                 $sumadetalles = CuentasXcDetalle::model()->findAll("paciente_id = {$datosContrato->paciente_id}");
                 $total_detalles = 0;
                 foreach ($sumadetalles as $suma_detalles) {
                     $total_detalles = $total_detalles + $suma_detalles->saldo;
                 }
                 $laCuenta->saldo = $total_detalles;
                 $laCuenta->update();
             }
         } else {
             $nuevaCuenta = new CuentasXc();
             $nuevaCuenta->paciente_id = $datosContrato->paciente_id;
             $nuevaCuenta->n_identificacion = $datosContrato->n_identificacion;
             $nuevaCuenta->saldo = $saldo_favor * -1;
             $nuevaCuenta->save();
             $detallesCuenta = new CuentasXcDetalle();
             $detallesCuenta->cuentas_xc_id = $nuevaCuenta->id;
             $detallesCuenta->paciente_id = $nuevaCuenta->paciente_id;
             $detallesCuenta->n_identificacion = $nuevaCuenta->n_identificacion;
             $detallesCuenta->contrato_id = $datosContrato->id;
             $detallesCuenta->saldo = $nuevaCuenta->saldo;
             $detallesCuenta->save();
         }
         //if ($datosContrato->saldo > 0) //No ha pagado contrato, los tratamientos van sin descuento
         //{
         $datosContrato->estado = "Liquidado";
         $datosContrato->update();
         foreach ($datosContratoDetalle as $datos_contrato_detalle) {
             $datos_contrato_detalle->estado = "Liquidado";
             $datos_contrato_detalle->update();
         }
         $this->redirect(array('view', 'id' => $datosContrato->id));
         //}
     }
     if ($saldo_favor == 0) {
         # code...
     }
     Yii::app()->user->setFlash('error', $saldo_favor);
     //Contrato Pagado
     if ($datosContrato->saldo == 0) {
         //Verificar si todos los tratamientos ya estan realizados
     }
 }
コード例 #7
0
ファイル: _form.php プロジェクト: crmoya/inmobiliaria
echo CHtml::submitButton($model->isNewRecord ? 'Crear' : 'Guardar', array('class' => 'btn'));
?>
	</div>
    <br>

<?php 
$this->endWidget();
?>

</div><!-- form -->
<script>
$(document).ready(function(e){
    
    var arrToggle = Array();
    <?php 
$centros = CentroCosto::model()->findAll();
foreach ($centros as $centro) {
    echo "arrToggle[" . $centro->id . "]='" . $centro->carga_a . "';";
}
?>
    togglePropDep();
    function togglePropDep(){
        var valor = $('#centro_costo').val();
        if(arrToggle[valor] == '1'){
            $('#div_propiedad').show();
            $('#div_departamento').hide();
        }
        else if(arrToggle[valor] == '2'){
            $('#div_propiedad').hide();
            $('#div_departamento').show();
        }
コード例 #8
0
/* @var $this EgresosController */
/* @var $model Egresos */
$this->menu = array(array('label' => 'Crear Egresos', '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\$('#egresos-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h1>Buscar Egresos - <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=egresos/create" class="btn btn-success" role="button" ><i class="icon-plus icon-white"></i> Crear Egreso</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' => 'egresos-grid', 'dataProvider' => $model->search(), 'afterAjaxUpdate' => 'reinstallDatePickerEgreso', 'filter' => $model, 'columns' => array(array('header' => 'ID.', 'name' => 'id', 'value' => '$data->id', 'htmlOptions' => array('width' => '30')), array('header' => 'Proveedor', 'name' => 'nombre_proveedor', 'value' => '$data->proveedor->nombre', 'htmlOptions' => array('width' => '220'), 'headerHtmlOptions' => array('style' => 'width:150px;text-align:center;')), array('name' => 'n_identificacion', 'value' => '$data[\'n_identificacion\']', 'htmlOptions' => array('width' => '150')), 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')), array('header' => 'Factura', 'name' => 'factura_id', 'value' => '$data[\'factura\'][\'factura_n\']', 'htmlOptions' => array('width' => '80')), array('name' => 'forma_pago', 'filter' => array('Efectivo' => 'Efectivo', 'Consignación' => 'Consignación'), 'value' => '$data->forma_pago', 'htmlOptions' => array('width' => '100')), array('name' => 'valor_egreso', 'value' => 'number_format($data->valor_egreso,2)', 'htmlOptions' => array('width' => '100'), 'footer' => $model->searchSuma()->itemCount === 0 ? '' : "<h6>\$ " . number_format($model->getTotal3($model->searchSuma()), 2) . '</h6>'), array('name' => 'iva_valor', 'value' => 'number_format($data->iva_valor,2)', 'htmlOptions' => array('width' => '100'), 'footer' => $model->searchSuma()->itemCount === 0 ? '' : "<h6>\$ " . number_format($model->getTotal2($model->searchSuma()), 2) . '</h6>'), array('header' => 'Centro de Costo', 'name' => 'centro_costo_id', 'filter' => CHtml::listData(CentroCosto::model()->findAll(array('order' => 'nombre ASC')), 'id', 'nombre'), 'value' => '$data[\'centroCosto\'][\'nombre\']', 'htmlOptions' => array('width' => '200')), array('name' => 'total_egreso', 'value' => 'number_format($data->total_egreso,2)', 'htmlOptions' => array('width' => '120'), 'footer' => $model->searchSuma()->itemCount === 0 ? '' : "<h6>\$ " . number_format($model->getTotal($model->searchSuma()), 2) . '</h6>'), 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', 'Anulado' => 'Anulado'), 'value' => '$data->estado'), array('class' => 'CButtonColumn', 'template' => '{view}'))));
Yii::app()->clientScript->registerScript('re-install-date-picker', "\nfunction reinstallDatePickerEgreso(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");
?>

<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=Egresos/exportar&tipo=<?php 
$elTipo;
?>
" method = "post">
  		<div class="span4">