/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); $departamento = Departamento::model()->findByPk($model->departamento_id); $propiedad = $departamento->propiedad; $model->propiedad_id = $propiedad->id; // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Mueble'])) { $model->attributes = $_POST['Mueble']; $model->fecha_compra = Tools::fixFecha($model->fecha_compra); $model->departamento_id = $_POST['Mueble']['departamento_id']; if ($model->save()) { $this->redirect(array('admin', 'id' => $model->id)); } } $this->render('update', array('model' => $model)); }
public function actionGetDepartamentosAll() { if (isset($_POST['Mueble']['propiedad_id'])) { $propiedad_id = $_POST['Mueble']['propiedad_id']; $departamentos = Departamento::model()->findAllByAttributes(array('propiedad_id' => $propiedad_id)); echo "<option value=''>Seleccione un Departamento</option>"; foreach ($departamentos as $departamento) { echo "<option value=" . $departamento->id . ">" . $departamento->numero . "</option>"; } } if (isset($_POST['Egreso']['propiedad_id'])) { $propiedad_id = $_POST['Egreso']['propiedad_id']; $departamentos = Departamento::model()->findAllByAttributes(array('propiedad_id' => $propiedad_id)); echo "<option value=''>Seleccione Departamento</option>"; echo "<option value='-1'>Todos de esta Propiedad</option>"; foreach ($departamentos as $departamento) { echo "<option value=" . $departamento->id . ">" . $departamento->numero . "</option>"; } } }
</select> </div> </div> <div class="col-md-4 col-sm-12 col-xs-12" style="display:block;"> <div class="form-group"> <label class="control-label required" for="Profile_id_departamento"> Departamento <span class="required">*</span> </label> <?php #$list=array(); if ($datos->profile->id_privilegio == 1) { $modell = Departamento::model()->findAll(); $list = CHtml::listData($modell, 'id', 'nombre_departamento'); echo CHtml::dropDownList('Profile[id_departamento]', 0, $list, array('options' => array($profile->id_departamento => array('selected' => true)), 'empty' => 'Seleccione una Opción', 'class' => 'form-control')); } else { $modell = Departamento::model()->findByPk($datos->profile->id_departamento); ?> <input class="form-control" type="hidden" value="<?php echo $datos->profile->id_departamento; ?> " name="Profile[id_departamento]"> <div disabled class="form-control"><?php echo $datos->profile->depto->nombre_departamento; ?> </div> <?php } ?> </div> </div> <div class="col-md-4 col-sm-12 col-xs-12 oficinas-comboBox" style="display:block;">
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); if (isset($_POST['Contrato'])) { $model->attributes = $_POST['Contrato']; $model->propiedad_id = Departamento::model()->findByPk($model->departamento_id)->propiedad->id; //$model->monto_primer_mes = $_POST['Contrato']['monto_primer_mes']; //$model->dias_primer_mes = $_POST['Contrato']['dias_primer_mes']; //$model->monto_cheque = $_POST['Contrato']['monto_cheque']; //$model->monto_castigado = $_POST['Contrato']['monto_castigado']; $model->imagen = CUploadedFile::getInstance($model, 'imagen'); if ($model->validate()) { if ($model->imagen != null) { $model->imagen->saveAs(Yii::app()->basePath . '/documentos/contratos/Contrato_' . $model->folio . '.jpg'); Yii::app()->user->setFlash('success', 'Imagen de escaneo de contrato firmado subida correctamente.'); $this->redirect(array('admin')); } else { $model->addError("documento", "Debe ser una imagen .jpg"); } } } $this->render('update', array('model' => $model)); }
</div> <div class="row"> <?php echo $form->labelEx($model, 'departamento_id'); ?> <?php if ($model->isNewRecord) { ?> <?php echo $form->dropDownList($model, 'departamento_id', array(), array('prompt' => 'Seleccione un departamento', 'id' => 'departamento_id')); ?> <?php } else { ?> <?php echo $form->dropDownList($model, 'departamento_id', CHtml::listData(Departamento::model()->findAllByAttributes(array('propiedad_id' => $model->propiedad_id)), 'id', 'numero'), array('prompt' => 'Seleccione un departamento', 'id' => 'departamento_id')); ?> <?php } ?> <?php echo $form->error($model, 'departamento_id'); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Crear' : 'Guardar', array('class' => 'btn')); ?> </div>
/** * 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 Departamento the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Departamento::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); $model->fecha = Tools::backFecha($model->fecha); $deptos = new Departamento('search'); $deptos->unsetAttributes(); if (isset($_GET['Departamento'])) { $deptos->attributes = $_GET['Departamento']; } // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Prestacion'])) { $model->attributes = $_POST['Prestacion']; $model->fecha = Tools::fixFecha($model->fecha); if ($model->save()) { $movimientosPrestacion = PrestacionGeneraMovimiento::model()->findAllByAttributes(array('prestacion_id' => $model->id)); foreach ($movimientosPrestacion as $mov) { $movimiento = $mov->movimiento; if ($movimiento->tipo == Tools::MOVIMIENTO_TIPO_CARGO) { $movimiento->actualizaSaldosPosteriores($movimiento->monto); } $mov->delete(); $movimiento->delete(); } PrestacionADepartamento::model()->deleteAllByAttributes(array('prestacion_id' => $model->id)); if (isset($_POST['chbDepartamentoId']) && !$model->general_prop) { $cant_deptos = count($_POST['chbDepartamentoId']); if ($cant_deptos != 0) { $monto = (int) $model->monto / $cant_deptos; } foreach ($_POST['chbDepartamentoId'] as $i => $departamento) { $prest_depto = new PrestacionADepartamento(); $prest_depto->departamento_id = $departamento; $prest_depto->prestacion_id = $model->id; if ($prest_depto->validate()) { $prest_depto->save(); } if ($model->genera_cargos == "1") { $cargo = new Movimiento(); $contrato = Contrato::model()->findByAttributes(array('departamento_id' => $departamento, 'vigente' => 1)); if ($contrato != null) { if ($contrato->vigente) { $cargo->cuenta_corriente_id = $contrato->cuentaCorriente->id; } else { continue; } } else { continue; } $cargo->fecha = $model->fecha; $cargo->tipo = Tools::MOVIMIENTO_TIPO_CARGO; $cargo->monto = $monto; $cargo->detalle = "PRESTACIÓN REALIZADA: " . $model->descripcion; $cargo->validado = 1; $cargo->saldo_cuenta = $cargo->ultimoSaldo(); $cargo->save(); $cargo->actualizaSaldosPosteriores(-$monto); $prestacionMovimiento = new PrestacionGeneraMovimiento(); $prestacionMovimiento->prestacion_id = $model->id; $prestacionMovimiento->movimiento_id = $cargo->id; $prestacionMovimiento->save(); } } } if ($model->general_prop) { if ($model->genera_cargos == "1") { //se crean los cargos para los deptos $departamentos = Departamento::model()->getVigentesDePropiedad($model->propiedad_id); $cant_deptos = count($departamentos); if ($cant_deptos != 0) { $monto = (int) $model->monto / $cant_deptos; foreach ($departamentos as $depto) { $cargo = new Movimiento(); if ($depto->contrato != null) { if ($depto->contrato->vigente) { $cargo->cuenta_corriente_id = $depto->contrato->cuentaCorriente->id; } else { continue; } } else { continue; } $cargo->fecha = $model->fecha; $cargo->tipo = Tools::MOVIMIENTO_TIPO_CARGO; $cargo->monto = $monto; $cargo->detalle = "PRESTACIÓN REALIZADA: " . $model->descripcion; $cargo->validado = 1; $cargo->saldo_cuenta = $cargo->ultimoSaldo(); $cargo->save(); $cargo->actualizaSaldosPosteriores(-$monto); $prestacionMovimiento = new PrestacionGeneraMovimiento(); $prestacionMovimiento->prestacion_id = $model->id; $prestacionMovimiento->movimiento_id = $cargo->id; $prestacionMovimiento->save(); } } } } $this->redirect(array('view', 'id' => $model->id)); } } $this->render('update', array('model' => $model, 'departamentos' => $deptos)); }
<?php $form = $this->beginWidget('CActiveForm', array('id' => 'departamento-producto-form', 'enableAjaxValidation' => false)); ?> <p class="note">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <div class="row"> <?php echo $form->labelEx($model, 'dpprod_dpto_id'); ?> <?php echo $form->dropDownList($model, 'dpprod_dpto_id', CHtml::listData(Departamento::model()->findAll(), 'dpto_id', 'dpto_nombre')); ?> <?php //echo $form->textField($model,'dpprod_dpto_id'); ?> <?php echo $form->error($model, 'dpprod_dpto_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'dpprod_prod_id'); ?> <?php echo $form->dropDownList($model, 'dpprod_prod_id', CHtml::listData(Producto::model()->findAll(), 'prod_id', 'prod_nombre'));
public function actionExportarXLS() { // generate a resultset $data = Departamento::model()->with('propiedad')->findAll(); $this->toExcel($data, array('propiedad.nombre', 'numero', 'mt2', 'dormitorios', 'estacionamientos', 'renta'), 'Departamentos', array()); }
public function getListaDepartamentos() { return CHtml::listData(Departamento::model()->findAll(), 'id', 'name'); }
public function actionPlanillaIngresos() { $model = new IngresosForm(); $propiedades = Propiedad::model()->getDeUsuario(Yii::app()->user->id); $meses = array(); for ($i = 1; $i <= 12; $i++) { $meses[] = array('id' => str_pad($i, 2, "0", STR_PAD_LEFT), 'nombre' => Tools::fixMes($i)); } $agnos = array(); $agnoInicio = 2000; $agnoFin = (int) date('Y') + 10; for ($i = $agnoInicio; $i < $agnoFin; $i++) { $agnos[] = array('id' => $i, 'nombre' => $i); } $model->agnoH = date('Y'); $model->mesH = date('m'); if ($model->mesH == '01') { $model->mesD = '12'; $model->agnoD = (int) $model->agnoH - 1; } else { $mes = (int) $model->mesH; $model->mesD = str_pad($mes - 1, 2, "0", STR_PAD_LEFT); $model->agnoD = $model->agnoH; } if (isset($_POST['IngresosForm'])) { $model->attributes = $_POST['IngresosForm']; $propiedad = Propiedad::model()->findByPk($model->propiedad_id); if ($propiedad != null) { Yii::import('ext.phpexcel.XPHPExcel'); $objPHPExcel = XPHPExcel::createPHPExcel(); $sheet = $objPHPExcel->getActiveSheet(); $sheet->setCellValue('A1', 'Planilla de Ingresos por Propiedad'); $sheet->mergeCells("A1:K1"); $sheet->getStyle("A1")->getFont()->setSize(20); $sheet->setCellValue('A2', 'Propiedad: ' . $propiedad->nombre); $sheet->mergeCells("A2:K2"); $sheet->setCellValue('A3', 'Rango de Fechas: Desde ' . Tools::fixMes($model->mesD) . " de " . $model->agnoD . " hasta " . Tools::fixMes($model->mesH) . " de " . $model->agnoH); $sheet->mergeCells("A3:K3"); $sheet->getStyle("A2")->getFont()->setSize(15); $sheet->getStyle("A3")->getFont()->setSize(15); $i = 5; $sheet->setCellValue('A' . $i, 'Departamento'); $meses = Tools::arregloMeses($model->mesD, $model->agnoD, $model->mesH, $model->agnoH); $sheet->getStyleByColumnAndRow(0, $i)->getFont()->setBold(true); $j = 2; if (!$model->abonosYCargos) { $j = 1; } foreach ($meses as $mesArr) { $sheet->setCellValueByColumnAndRow($j, $i, $mesArr['mesNombre'] . " de " . $mesArr['agno']); $sheet->getStyleByColumnAndRow($j, $i)->getFont()->setBold(true); $j++; } $i++; $departamentos = Departamento::model()->findAllByAttributes(array('propiedad_id' => $propiedad->id)); foreach ($departamentos as $departamento) { $j = 0; $sheet->setCellValueByColumnAndRow($j, $i, $departamento->numero); $sheet->getStyleByColumnAndRow($j, $i)->getFont()->setBold(true); if ($model->abonosYCargos) { $j++; $sheet->setCellValueByColumnAndRow($j, $i, "Cargos"); $sheet->setCellValueByColumnAndRow($j, $i + 1, "Abonos"); $sheet->getStyleByColumnAndRow($j, $i, $j, $i + 1)->getFont()->setBold(true); $j++; } else { $j = 1; } if ($departamento->contrato != null) { if ($departamento->contrato->cuentaCorriente != null) { foreach ($meses as $mesArr) { $saldoMes = $departamento->contrato->cuentaCorriente->saldoMes($mesArr['mes'], $mesArr['agno']); if ($model->abonosYCargos) { $sheet->setCellValueByColumnAndRow($j, $i, $saldoMes['cargos']); $sheet->setCellValueByColumnAndRow($j, $i + 1, $saldoMes['abonos']); } else { $sheet->setCellValueByColumnAndRow($j, $i, $saldoMes['abonos']); } $j++; } } } if ($model->abonosYCargos) { $i += 2; } else { $i++; } } $objPHPExcel->setActiveSheetIndex(0); header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment;filename="Movimientos Propietario.xls"'); header('Cache-Control: max-age=0'); // If you're serving to IE 9, then the following may be needed header('Cache-Control: max-age=1'); // If you're serving to IE over SSL, then the following may be needed header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified header('Cache-Control: cache, must-revalidate'); // HTTP/1.1 header('Pragma: public'); // HTTP/1.0 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objWriter->save('php://output'); Yii::app()->end(); } else { $model->addError("propiedad_id", "ERROR: Por favor seleccione propiedad válida."); } } $this->render('planillaIngresos', array('model' => $model, 'meses' => $meses, 'agnos' => $agnos, 'propiedades' => $propiedades)); }
public function actionClientesMorosos() { // Including js for table pagination $baseUrl = Yii::app()->baseUrl; $cs = Yii::app()->getClientScript(); $cs->registerCssFile($baseUrl . '/css/footable.core.css'); $cs->registerScriptFile($baseUrl . '/js/footable.js'); $cs->registerScriptFile($baseUrl . '/js/footable.paginate.js'); $departamentos = Departamento::model()->findAll(); $deptos_morosos = array(); foreach ($departamentos as $depto) { if (!$depto->estaAlDia()) { $deptos_morosos[] = $depto; } } $this->render('clientesMorosos', array('departamentos' => $deptos_morosos)); }
echo $form->textField($model, 'cedula'); ?> <?php echo $form->error($model, 'cedula'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'id_departamento'); ?> <?php /*echo $form->textField($model,'id_departamento');*/ ?> <?php echo $form->dropDownList($model, 'id_departamento', CHtml::listData(Departamento::model()->findAll(), 'id', 'nombre')); ?> <?php echo $form->error($model, 'id_departamento'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'direccion_ip'); ?> <?php echo $form->textField($model, 'direccion_ip', array('size' => 15, 'maxlength' => 15)); ?> <?php
<p> Generar copia global de la basé de datos y fotos tomadas para sincronizarla con el servidor central via web. </p> <button onclick="copiaBdSinc();" class="btn btn-primary"> <span>Copiar BD y archivos</span> </button> </li> <li style="width: 100%"> <p>Procesos para consolidar información</p> <div style="width: 100%"> <div id="divSelDepartamento"> <?php echo CHtml::label('Departamento', ''); ?> <?php echo CHtml::dropDownList('mentenimientodpto', '', GxHtml::listDataEx(Departamento::model()->findAll(), 'codigo', 'departamento'), array('prompt' => 'Seleccione...', 'onchange' => "carga_municipios('#mentenimientomun',this.value);", 'class' => 'Ccombo')); ?> </div> <div id="divSelDepartamento"> <?php echo CHtml::label('Municipio', ''); echo CHtml::dropDownList('mentenimientomun', '', $valores, array('prompt' => 'Seleccione...', 'onchange' => "cargaInstituciones('institucion',this,document.getElementById('mentenimientodpto').value);", 'class' => 'Ccombo')); ?> </div> <label for="institucion" >Institución</label> <?php echo CHtml::dropDownList('institucion', '', $valores, array('prompt' => 'Seleccione...', 'sytle' => 'width:100%; min-width: 2000px;', 'name' => 'institucion', 'class' => 'Ccombo', 'onchange' => "cambiaInsti(this.value)")); ?> </div> <label for="selsede">Sede</label> <select id="selsede">
<div class="col-md-6"> <?php echo $form->dropDownListGroup($model, 'comuna_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => CHtml::listData(Comuna::model()->findAllByAttributes(array('region_id' => $model->region_id), array("select" => "nombre,id")), 'id', 'nombre'), 'htmlOptions' => array('prompt' => 'Seleccione Comuna')))); ?> </div> <div class="col-md-6"> <?php echo $form->textFieldGroup($model, 'direccion', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'))); ?> </div> <div class="col-md-6"> <?php echo $form->dropDownListGroup($model, 'departamento_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => CHtml::listData(Departamento::model()->findAll(), 'id', 'nombre'), 'htmlOptions' => array('prompt' => 'Seleccione Departamento')))); ?> </div> <div class="col-md-6"> <?php echo $form->dropDownListGroup($model, 'empresa_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => CHtml::listData(Empresa::model()->findAll(), 'id', 'nombre'), 'htmlOptions' => array('prompt' => 'Seleccione Empresa')))); ?> </div> <div class="form-actions col-md-12" > <?php $this->widget('booster.widgets.TbButton', array('buttonType' => 'submit', 'context' => 'primary', 'label' => 'Guardar')); ?> <?php
<br> La transferencia de usuario consiste en, ... <br> Una vez realizada la transferencia con éxito ya no tendrá jerarquía con el departamento actual. <br> <input name="Transferencia[depto1]" value="<?php echo $model->profile->id_departamento; ?> " type="hidden"> <input name="Transferencia[idUser]" value="<?php echo $_GET['id']; ?> " type="hidden"> <label>Departamento a transferir</label> <?php $modell = Departamento::model()->findAll(); $list = CHtml::listData($modell, 'id', 'nombre_departamento'); ?> <?php echo CHtml::dropDownList('Transferencia[depto2]', 0, $list, array('options' => array($profile->idDepartamento => array('selected' => true)), 'empty' => 'Seleccione una Opción', 'class' => 'form-control')); ?> </div> <div class="modal-footer clearfix"> <div class="pull-right"> <button class="btn btn-block btn-success btn-sm" type="success">Transferir</button> </div> <div class="pull-left"> <button class="btn btn-block btn-danger btn-sm" type="button" data-dismiss="modal" >Cancelar</button> </div> </div> </form>
<td> <?php echo $form->labelEx($model, 'CODDPTO'); ?> <?php if ($dpt != "") { echo $form->dropDownList($model, 'CODDPTO', CHtml::listData(Departamento::model()->findAll(), 'codigo', 'departamento'), array('prompt' => 'Seleccione...', 'class' => 'Ccombo', 'options' => array($dpt => array('selected' => true)))); } else { if ($model->CODDPTO != "") { $valtemp = $model->CODDPTO; } elseif ($modelold->CODDPTO != "") { $valtemp = $modelold->CODDPTO; } else { $valtemp = ""; } echo $form->dropDownList($model, 'CODDPTO', CHtml::listData(Departamento::model()->findAll(), 'codigo', 'departamento'), array('prompt' => 'Seleccione...', 'class' => 'Ccombo', 'options' => array($valtemp => array('selected' => true)))); } ?> <?php echo $form->error($model, 'CODDPTO'); ?> </td> <td colspan="2"> <?php echo $form->labelEx($model, 'CODMUN'); ?> <?php $munisel = ""; if (is_numeric($model->CODMUN)) { $valores = array($model->CODMUN => $model->CODMUN); $munisel = $model->CODMUN;
/** * Displays a particular model. * @param integer $id the ID of the model to be displayed */ public function actionView($id) { $departamentos = Departamento::model()->searchEgreso($id); $this->render('view', array('model' => $this->loadModel($id), 'departamentos' => $departamentos)); }
} } ?> </div> <div id="form-estado" > <div> <h3> Auditar </h3> <table class="table table-condensed" > <tr> <td> <label for ="departamento">Departamento</label> <?php echo CHtml::dropDownList("departamento", "", CHtml::listData(Departamento::model()->findAll(), 'codigo', 'departamento'), array("empty" => "Seleccione..", "class" => "Ccombo add-form")); ?> </td> <td> <label for ="municipio">Municipio</label> <?php echo CHtml::dropDownList("municipio", "", array(), array("empty" => "Seleccione..", "class" => "Ccombo add-form")); ?> </td> </tr> <tr> <td> <label for ="institucion">Establecimiento Educativo</label> <?php echo CHtml::dropDownList("institucion", "", array(), array("empty" => "Seleccione..", "class" => "Ccombo add-form")); ?>
<div class="wide form"> <?php $form = $this->beginWidget('GxActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get')); ?> <div class="row"> <?php echo $form->label($model, 'CODDPTO'); ?> <?php echo $form->dropDownList($model, 'CODDPTO', GxHtml::listDataEx(Departamento::model()->findAll(), 'codigo', 'departamento'), array('prompt' => 'Seleccione...', 'class' => 'Ccombo')); ?> </div> <div class="row"> <?php echo $form->label($model, 'CODMUN'); ?> <?php echo $form->dropDownList($model, 'CODMUN', array(), array('prompt' => 'Seleccione...', 'class' => 'Ccombo')); ?> </div> <div class="row"> <?php echo $form->label($model, 'CODIGO_DANE_ESTABLEDUCATIVO'); ?> <?php echo $form->dropDownList($model, 'CODIGO_DANE_ESTABLEDUCATIVO', array(), array('prompt' => 'Seleccione...', 'class' => 'Ccombo')); ?>
public function estaAsociadoPropietario($user_id, $departamento_id) { $propietario_id = Propietario::model()->getId($user_id); $response = Departamento::model()->exists(array('join' => 'JOIN propiedad p ON p.id = t.propiedad_id', 'condition' => 'propietario_id=:propietarioID AND t.id=:departamentoID', 'params' => array(':propietarioID' => $propietario_id, ':departamentoID' => $departamento_id))); return $response; }