Exemplo n.º 1
0
 public function nuevoAction()
 {
     $tipoQuery = \TipoQuery::create()->find();
     $tipoArray = array();
     foreach ($tipoQuery as $tipo) {
         $tipoArray[$tipo->getIdtipo()] = $tipo->getTipoNombre();
     }
     $productoForm = new ProductoForm($tipoArray);
     $request = $this->getRequest();
     if ($request->isPost()) {
         $productoFilter = new ProductoFilter();
         $productoForm->setInputFilter($productoFilter->getInputFilter());
         $productoForm->setData($request->getPost());
         if ($productoForm->isValid()) {
             if (\ArticuloQuery::create()->filterByArticuloNombre($request->getPost()->articulo_nombre)->exists()) {
                 $ProductoQuery = \ArticuloQuery::create()->filterByArticuloNombre($request->getPost()->articulo_nombre)->findOne();
                 if (\PropiedadQuery::create()->filterByPropiedadNombre($request->getPost()->propiedad_nombre)->exists()) {
                     $PropiedadQuery = \PropiedadQuery::create()->filterByPropiedadNombre($request->getPost()->propiedad_nombre)->findOne();
                     $Propiedadvalor = new \Propiedadvalor();
                     $Propiedadvalor->setIdarticulo($ProductoQuery->getIdarticulo());
                     $Propiedadvalor->setIdpropiedad($PropiedadQuery->getIdpropiedad());
                     $Propiedadvalor->setPropiedadvalorNombre($request->getPost()->propiedadvalor_nombre);
                     $Propiedadvalor->save();
                 }
             }
             $Producto = new \Articulo();
             foreach ($productoForm->getData() as $ProductoKey => $ProductoValue) {
                 if ($ProductoKey != 'idarticulo' && $ProductoKey != 'propiedad_nombre' && $ProductoKey != 'idpropiedad' && $ProductoKey != 'propiedadvalor_nombre' && $ProductoKey != 'submit') {
                     $Producto->setByName($ProductoKey, $ProductoValue, BasePeer::TYPE_FIELDNAME);
                 }
             }
             $Producto->save();
             $Propiedad = new \Propiedad();
             $Propiedad->setIdarticulo($Producto->getIdarticulo());
             $Propiedad->setPropiedadNombre($request->getPost()->propiedad_nombre);
             $Propiedad->save();
             $Propiedadvalor = new \Propiedadvalor();
             $Propiedadvalor->setIdarticulo($Producto->getIdarticulo());
             $Propiedadvalor->setIdpropiedad($Propiedad->getIdpropiedad());
             $Propiedadvalor->setPropiedadvalorNombre($request->getPost()->propiedadvalor_nombre);
             $Propiedadvalor->save();
             $propiedadvalorQuery = \PropiedadvalorQuery::create()->filterByPropiedadvalorNombre($Propiedadvalor->getPropiedadvalorNombre())->find();
             $propiedadvalorArray = array();
             foreach ($propiedadvalorQuery as $propiedadvalorEntity) {
                 $propiedadvalorArray[$propiedadvalorEntity->getIdpropiedadvalor()] = $propiedadvalorEntity->getPropiedadvalorNombre();
             }
             /*
             return array(
                 'productoForm' => $productoForm,
                 'propiedadvalor' => $propiedadvalorArray,
             );
             */
             if ($error = !null) {
                 return $this->redirect()->toRoute('producto');
             }
         }
     }
     return array('productoForm' => $productoForm);
 }
Exemplo n.º 2
0
 /**
  * Resets all references to other model objects or collections of model objects.
  *
  * This method is a user-space workaround for PHP's inability to garbage collect
  * objects with circular references (even in PHP 5.3). This is currently necessary
  * when using Propel in certain daemon or large-volume/high-memory operations.
  *
  * @param boolean $deep Whether to also clear the references on all referrer objects.
  */
 public function clearAllReferences($deep = false)
 {
     if ($deep && !$this->alreadyInClearAllReferencesDeep) {
         $this->alreadyInClearAllReferencesDeep = true;
         if ($this->collArticulovariantevalors) {
             foreach ($this->collArticulovariantevalors as $o) {
                 $o->clearAllReferences($deep);
             }
         }
         if ($this->aArticulo instanceof Persistent) {
             $this->aArticulo->clearAllReferences($deep);
         }
         if ($this->aPropiedad instanceof Persistent) {
             $this->aPropiedad->clearAllReferences($deep);
         }
         $this->alreadyInClearAllReferencesDeep = false;
     }
     // if ($deep)
     if ($this->collArticulovariantevalors instanceof PropelCollection) {
         $this->collArticulovariantevalors->clearIterator();
     }
     $this->collArticulovariantevalors = null;
     $this->aArticulo = null;
     $this->aPropiedad = null;
 }
 /**
  * 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);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Departamento'])) {
         $model->attributes = $_POST['Departamento'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $propiedades = Propiedad::model()->findAll(array('select' => 'id,nombre'));
     $this->render('update', array('model' => $model, 'propiedades' => $propiedades));
 }
Exemplo n.º 4
0
 /**
  * Resets all references to other model objects or collections of model objects.
  *
  * This method is a user-space workaround for PHP's inability to garbage collect
  * objects with circular references (even in PHP 5.3). This is currently necessary
  * when using Propel in certain daemon or large-volume/high-memory operations.
  *
  * @param boolean $deep Whether to also clear the references on all referrer objects.
  */
 public function clearAllReferences($deep = false)
 {
     if ($deep && !$this->alreadyInClearAllReferencesDeep) {
         $this->alreadyInClearAllReferencesDeep = true;
         if ($this->aArticulo instanceof Persistent) {
             $this->aArticulo->clearAllReferences($deep);
         }
         if ($this->aArticulovariante instanceof Persistent) {
             $this->aArticulovariante->clearAllReferences($deep);
         }
         if ($this->aPropiedad instanceof Persistent) {
             $this->aPropiedad->clearAllReferences($deep);
         }
         if ($this->aPropiedadvalor instanceof Persistent) {
             $this->aPropiedadvalor->clearAllReferences($deep);
         }
         $this->alreadyInClearAllReferencesDeep = false;
     }
     // if ($deep)
     $this->aArticulo = null;
     $this->aArticulovariante = null;
     $this->aPropiedad = null;
     $this->aPropiedadvalor = null;
 }
Exemplo n.º 5
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $deptos = new Departamento('search');
     $deptos->unsetAttributes();
     if (isset($_GET['Departamento'])) {
         $deptos->attributes = $_GET['Departamento'];
     }
     $model = new Prestacion();
     $model->fecha = date('d/m/Y');
     // 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);
         $ok = true;
         $propiedad = null;
         if ($model->general_prop) {
             $propiedad = Propiedad::model()->findByPk($model->propiedad_id);
             if ($propiedad == null) {
                 $ok = false;
             }
         }
         if ($ok) {
             if ($model->save()) {
                 if ($model->general_prop != "1") {
                     if (isset($_POST['chbDepartamentoId'])) {
                         $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") {
                                     //se crean los cargos para el depto
                                     $cargo = new Movimiento();
                                     $depto = Departamento::model()->findByPk($departamento);
                                     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();
                                 }
                             }
                         }
                     }
                 } else {
                     //general_prop == "1"
                     if ($model->genera_cargos == "1") {
                         //se crean los cargos para el depto
                         $departamentos = Departamento::model()->getVigentesDePropiedad($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();
                             }
                         }
                     }
                 }
                 Yii::app()->user->setFlash('success', 'Prestación creada correctamente.');
                 $model = new Prestacion();
             } else {
                 Yii::app()->user->setFlash('error', 'Error: No se pudo crear la Prestación. Reintente.');
             }
         } else {
             Yii::app()->user->setFlash('error', 'Debe seleccionar una propiedad válida.');
         }
     }
     $this->render('create', array('model' => $model, 'departamentos' => $deptos));
 }
Exemplo n.º 6
0
 public function estaAsociadoPropietario($user_id, $propiedad_id)
 {
     $propietario_id = Propietario::model()->getId($user_id);
     $response = Propiedad::model()->exists(array('condition' => 'propietario_id=:propietarioID AND t.id=:propiedadID', 'params' => array(':propietarioID' => $propietario_id, ':propiedadID' => $propiedad_id)));
     return $response;
 }
Exemplo n.º 7
0
 /**
  * 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);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Egreso'])) {
         $model->attributes = $_POST['Egreso'];
         $model->fecha = Tools::fixFecha($model->fecha);
         $propiedad = null;
         if ($model->centroCosto != null) {
             $ok = $model->validate();
             if ($model->centroCosto->carga_a == '1') {
                 $propiedad = Propiedad::model()->findByPk($model->propiedad_id);
                 if ($propiedad == null) {
                     $model->addError("propiedad_id", "Propiedad no puede ser nulo.");
                     $ok = false;
                 }
             }
             if ($ok) {
                 if ($model->save()) {
                     EgresoPropiedad::model()->deleteAllByAttributes(array('egreso_id' => $model->id));
                     if ($model->centroCosto->carga_a == '1') {
                         $egPro = new EgresoPropiedad();
                         $egPro->egreso_id = $model->id;
                         $egPro->propiedad_id = $model->propiedad_id;
                         $egPro->save();
                     }
                     if ($model->centroCosto->carga_a == '2') {
                         if (isset($_POST['chbDepartamentoId'])) {
                             $cant_deptos = count($_POST['chbDepartamentoId']);
                             if ($cant_deptos > 0) {
                                 EgresoDepartamento::model()->deleteAllByAttributes(array('egreso_id' => $model->id));
                                 foreach ($_POST['chbDepartamentoId'] as $i => $departamento) {
                                     $egDpto = new EgresoDepartamento();
                                     $egDpto->departamento_id = $departamento;
                                     $egDpto->egreso_id = $model->id;
                                     if ($egDpto->validate()) {
                                         $egDpto->save();
                                     }
                                 }
                             }
                         }
                     }
                     $this->redirect(array('admin'));
                 } else {
                     Yii::app()->user->setFlash('error', CHtml::errorSummary($model));
                 }
             } else {
                 Yii::app()->user->setFlash('error', CHtml::errorSummary($model));
             }
         } else {
             Yii::app()->user->setFlash('error', 'ERROR: Centro de costo no puede ser nulo.');
         }
         $model->fecha = Tools::backFecha($model->fecha);
     }
     $conceptos = ConceptoPredefinido::model()->findAll();
     $cptos = array();
     foreach ($conceptos as $concepto) {
         $cptos[] = $concepto->nombre;
     }
     $deptos = new Departamento('search');
     $deptos->unsetAttributes();
     if (isset($_GET['Departamento'])) {
         $deptos->attributes = $_GET['Departamento'];
     }
     $this->render('update', array('model' => $model, 'conceptos' => $cptos, 'departamentos' => $deptos));
 }
Exemplo n.º 8
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param Propiedad $obj A Propiedad object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool($obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getIdpropiedad();
         }
         // if key === null
         PropiedadPeer::$instances[$key] = $obj;
     }
 }
Exemplo n.º 9
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $this->layout = "column1";
     $ultimoContrato = Contrato::model()->findAll(array('order' => 'folio DESC'));
     $ultimoFolio = 0;
     if ($ultimoContrato != null) {
         $ultimoFolio = (int) $ultimoContrato[0]->folio;
     }
     $folio = $ultimoFolio + 1;
     // @todo: cambiar el modelo y el formulario para contratos de 1,2,3,4,5,6 meses o indefinido
     // @todo: Impedir la creación de contratos para deptos que ya tienen
     $model = new Contrato();
     $model->folio = $folio;
     $model->dia_pago = 1;
     $model->fecha_inicio = date('d/m/Y');
     $cuentaModel = new CuentaCorriente();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     $valid = false;
     if (isset($_POST['Contrato'])) {
         // generando cuenta corriente asociada al contrato
         $model->attributes = $_POST['Contrato'];
         $model->monto_gastovariable = $_POST['Contrato']['monto_gastovariable'];
         $model->monto_mueble = $_POST['Contrato']['monto_mueble'];
         $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->reajusta_meses = $_POST['Contrato']['reajusta_meses'];
         $model->dia_pago = $_POST['Contrato']['dia_pago'];
         $model->fecha_inicio = Tools::fixFecha($model->fecha_inicio);
         $model->vigente = 1;
         $model->reajusta = 1;
         $valid = $model->validate();
         if ($valid) {
             $cuentaModel->attributes = $_POST['CuentaCorriente'];
             $cliente = $model->cliente;
             $departamento = $model->departamento;
             $cuentaModel->nombre = str_replace("-", "", $cliente->rut) . "-" . $departamento->propiedad->nombre . " (Depto." . $departamento->numero . ")";
             $model->save(FALSE);
             $cuentaModel->contrato_id = $model->id;
             $valid = $valid && $cuentaModel->validate();
             if ($valid) {
                 $cuentaModel->save(FALSE);
                 if ($valid) {
                     $model->crearDeudaMes(date('Y-m-d'));
                     $usuario = $cliente->usuario;
                     $propiedad = $departamento->propiedad;
                     //una vez que está creado el contrato, guardar la copia del docx
                     $this->doccy->newFile($model->tipo_contrato_id . '.docx');
                     $this->doccy->phpdocx->assignToHeader("", "");
                     $this->doccy->phpdocx->assignToFooter("", "");
                     $this->doccy->phpdocx->assign("#CONTRATO_FOLIO#", $model->folio);
                     $this->doccy->phpdocx->assign("#CONTRATO_FECHA_INICIO#", Tools::backFecha($model->fecha_inicio));
                     $this->doccy->phpdocx->assign("#CONTRATO_MONTO_RENTA#", Tools::formateaPlata($model->monto_renta));
                     $this->doccy->phpdocx->assign("#CONTRATO_MONTO_GASTO_COMUN#", Tools::formateaPlata($model->monto_gastocomun));
                     $this->doccy->phpdocx->assign("#CONTRATO_MONTO_PRIMER_MES#", Tools::formateaPlata($model->monto_primer_mes));
                     $this->doccy->phpdocx->assign("#CONTRATO_DIAS_PRIMER_MES#", $model->dias_primer_mes);
                     $this->doccy->phpdocx->assign("#CONTRATO_MONTO_CHEQUE#", Tools::formateaPlata($model->monto_cheque));
                     $this->doccy->phpdocx->assign("#CONTRATO_MONTO_CASTIGADO#", Tools::formateaPlata($model->monto_castigado));
                     $this->doccy->phpdocx->assign("#CONTRATO_MONTO_MUEBLE#", Tools::formateaPlata($model->monto_mueble));
                     $this->doccy->phpdocx->assign("#CONTRATO_MONTO_GASTO_VARIABLE#", Tools::formateaPlata($model->monto_gastovariable));
                     $this->doccy->phpdocx->assign("#CONTRATO_REAJUSTA_MESES#", $model->reajusta_meses);
                     $this->doccy->phpdocx->assign("#CONTRATO_DIA_PAGO#", $model->dia_pago);
                     $this->doccy->phpdocx->assign("#CONTRATO_PLAZO#", $model->plazo);
                     $this->doccy->phpdocx->assign("#CLIENTE_RUT#", $cliente->rut);
                     $this->doccy->phpdocx->assign("#CLIENTE_NOMBRE#", $usuario->nombre);
                     $this->doccy->phpdocx->assign("#CLIENTE_APELLIDO#", $usuario->apellido);
                     $this->doccy->phpdocx->assign("#CLIENTE_EMAIL#", $usuario->email);
                     $this->doccy->phpdocx->assign("#CLIENTE_DIRECCION#", $cliente->direccion_alternativa);
                     $this->doccy->phpdocx->assign("#CLIENTE_TELEFONO#", $cliente->telefono);
                     $this->doccy->phpdocx->assign("#CLIENTE_OCUPACION#", $cliente->ocupacion);
                     $this->doccy->phpdocx->assign("#CLIENTE_RENTA#", Tools::formateaPlata($cliente->renta));
                     $this->doccy->phpdocx->assign("#PROPIEDAD_NOMBRE#", $propiedad->nombre);
                     $this->doccy->phpdocx->assign("#PROPIEDAD_DIRECCION#", $propiedad->direccion);
                     $this->doccy->phpdocx->assign("#DEPARTAMENTO_NUMERO#", $departamento->numero);
                     $this->doccy->phpdocx->assign("#DEPARTAMENTO_MT2#", $departamento->mt2);
                     $this->doccy->phpdocx->assign("#DEPARTAMENTO_DORMITORIOS#", $departamento->dormitorios);
                     $this->doccy->phpdocx->assign("#DEPARTAMENTO_ESTACIONAMIENTOS#", $departamento->estacionamientos);
                     $this->doccy->phpdocx->assign("#DEPARTAMENTO_RENTA#", Tools::formateaPlata($departamento->renta));
                     $this->renderDocx("Contrato_" . $model->folio . ".docx", false);
                     $this->redirect(array('admin'));
                 } else {
                     $model->delete();
                     $cuentaModel->delete();
                     $model->addError('id', 'No fue posible crear la cuenta asociada al contrato. Intente nuevamente');
                 }
             } else {
                 $model->delete();
             }
         }
         if (!$valid) {
             $model->fecha_inicio = Tools::backFecha($model->fecha_inicio);
         }
     }
     //$departamentos = Departamento::model()->getListWithoutContract();
     $propiedades = Propiedad::model()->findAll();
     $clientes = Cliente::model()->getList();
     $tiposContrato = TipoContrato::model()->getList();
     $this->render('create', array('model' => $model, 'ctaModel' => $cuentaModel, 'propiedades' => $propiedades, 'clientes' => $clientes, 'tiposContrato' => $tiposContrato));
 }
Exemplo n.º 10
0
 public function relacionadosConPropietario($propietario_id)
 {
     $clientes = array();
     $propiedades = Propiedad::model()->findAllByAttributes(array('propietario_id' => $propietario_id));
     foreach ($propiedades as $propiedad) {
         $departamentos = $propiedad->departamentos;
         foreach ($departamentos as $departamento) {
             $contrato = $departamento->contrato;
             if (isset($contrato->cliente_id)) {
                 $cliente_id = $contrato->cliente_id;
                 $clientes[] = $cliente_id;
             }
         }
     }
     return $clientes;
 }
 public function actionIngresosCliente()
 {
     $model = new IngresosClienteForm();
     $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['IngresosClienteForm'])) {
         $model->attributes = $_POST['IngresosClienteForm'];
         Yii::import('ext.phpexcel.XPHPExcel');
         $objPHPExcel = XPHPExcel::createPHPExcel();
         $sheet = $objPHPExcel->getActiveSheet();
         $sheet->setCellValue('A1', 'Planilla de Ingresos de Cliente');
         $sheet->mergeCells("A1:K1");
         $sheet->getStyle("A1")->getFont()->setSize(20);
         $sheet->setCellValue('A2', 'Rango de Fechas: Desde ' . Tools::fixMes($model->mesD) . " de " . $model->agnoD . " hasta " . Tools::fixMes($model->mesH) . " de " . $model->agnoH);
         $sheet->mergeCells("A2:K2");
         $sheet->getStyle("A2")->getFont()->setSize(15);
         $i = 4;
         $sheet->setCellValue('A' . $i, 'Fecha');
         $sheet->setCellValue('B' . $i, 'Propiedad');
         $sheet->setCellValue('C' . $i, 'Departamento');
         $sheet->setCellValue('D' . $i, 'Nombre');
         $sheet->setCellValue('E' . $i, 'Monto');
         $sheet->getStyleByColumnAndRow(0, $i, 4, $i)->getFont()->setBold(true);
         $fDesde = $model->agnoD . "-" . str_pad($model->mesD, 2, "0", STR_PAD_LEFT) . "-01";
         $fHasta = $model->agnoH . "-" . str_pad($model->mesH, 2, "0", STR_PAD_LEFT) . "-01";
         $i++;
         $movimientos = Movimiento::model()->getIngresosDePropietarioEntreFechas(Yii::app()->user->id, $fDesde, $fHasta);
         foreach ($movimientos as $movimiento) {
             $sheet->setCellValue('A' . $i, Tools::backFecha($movimiento->fecha));
             $sheet->setCellValue('B' . $i, $movimiento->cuentaCorriente->contrato->departamento->propiedad->nombre);
             $sheet->setCellValue('C' . $i, $movimiento->cuentaCorriente->contrato->departamento->numero);
             $sheet->setCellValue('D' . $i, $movimiento->cuentaCorriente->contrato->cliente->usuario->nombre . " " . $movimiento->cuentaCorriente->contrato->cliente->usuario->apellido . " (" . $movimiento->cuentaCorriente->contrato->cliente->rut . ")");
             $sheet->setCellValue('E' . $i, $movimiento->monto);
             $i++;
         }
         /*                $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 Cliente.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();
     }
     $this->render('ingresosCliente', array('model' => $model, 'meses' => $meses, 'agnos' => $agnos, 'propiedades' => $propiedades));
 }
Exemplo n.º 12
0
 public function actionInforme()
 {
     $form = new InformeForm();
     if (isset($_POST['InformeForm'])) {
         $form->attributes = $_POST['InformeForm'];
         Yii::import('ext.phpexcel.XPHPExcel');
         $objPHPExcel = XPHPExcel::createPHPExcel();
         $sheet = $objPHPExcel->getActiveSheet();
         $styleCenter = array('alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER));
         $sheet->setCellValue('A1', 'Informe de Movimientos de Propietario');
         $sheet->getStyle("A1")->getFont()->setSize(20);
         $sheet->setCellValue('A2', 'Desde: ' . $form->fechaDesde . ' Hasta: ' . $form->fechaHasta);
         $sheet->getStyle("A2")->getFont()->setSize(16);
         $fechaDesdeArr = explode('-', $form->fechaDesde);
         if (count($fechaDesdeArr) == 3) {
             $mesInicio = $fechaDesdeArr[1];
             $agnoInicio = $fechaDesdeArr[0];
         } else {
             $mesInicio = date('m');
             $agnoInicio = date('Y');
             $form->fechaDesde = date('Y-m-d');
         }
         $fechaHastaArr = explode('-', $form->fechaHasta);
         if (count($fechaHastaArr) == 3) {
             $mesFin = $fechaHastaArr[1];
             $agnoFin = $fechaHastaArr[0];
         } else {
             $mesFin = date('m');
             $agnoFin = date('Y');
             $form->fechaHasta = date('Y-m-d');
         }
         $meses = Tools::arregloMeses($mesInicio, $agnoInicio, $mesFin, $agnoFin);
         $propietario_id = Propietario::model()->getId(Yii::app()->user->id);
         $propietario = Propietario::model()->findByPk($propietario_id);
         $propiedades = Propiedad::model()->findAllByAttributes(array('propietario_id' => $propietario_id));
         $row = 4;
         foreach ($propiedades as $propiedad) {
             $sheet->setCellValueByColumnAndRow(0, $row, "PROPIEDAD: " . $propiedad->nombre);
             $row++;
             foreach ($propiedad->departamentos as $departamento) {
                 if ($departamento->contrato != null) {
                     $rmax = 0;
                     $sheet->setCellValueByColumnAndRow(0, $row, "Departamento: " . $departamento->numero . ", Contrato: " . $departamento->contrato->folio . ", Arrendatario: " . $departamento->contrato->cliente->rut . " " . $departamento->contrato->cliente->usuario->nombre . " " . $departamento->contrato->cliente->usuario->apellido);
                     $row++;
                     $sheet->setCellValueByColumnAndRow(0, $row, "Movimientos de la cuenta");
                     $col = 0;
                     $cuentaCorriente = $departamento->contrato->cuentaCorriente;
                     $saldo = 0;
                     foreach ($meses as $mesArreglo) {
                         $nDias = cal_days_in_month(CAL_GREGORIAN, $mesArreglo['mes'], $mesArreglo['agno']);
                         $sheet->mergeCellsByColumnAndRow($col, $row, $col + 1, $row);
                         $sheet->getStyleByColumnAndRow($col, $row)->applyFromArray($styleCenter);
                         $sheet->setCellValueByColumnAndRow($col, $row, $mesArreglo['mesNombre'] . " " . $mesArreglo['agno']);
                         $sheet->setCellValueByColumnAndRow($col, $row + 1, Tools::MOVIMIENTO_TIPO_ABONO);
                         $sheet->setCellValueByColumnAndRow($col + 1, $row + 1, Tools::MOVIMIENTO_TIPO_CARGO);
                         $movimientos = Movimiento::model()->findAll(array('condition' => 'fecha >= :fIni and fecha <= :fFin and cuenta_corriente_id = :cta', 'params' => array(':fIni' => $mesArreglo['agno'] . "-" . $mesArreglo['mes'] . "-01", ':fFin' => $mesArreglo['agno'] . "-" . $mesArreglo['mes'] . "-" . $nDias, ':cta' => $cuentaCorriente->id)));
                         if (count($movimientos) > $rmax) {
                             $rmax = count($movimientos);
                         }
                         $iMov = 0;
                         while ($iMov < count($movimientos)) {
                             $movimiento = $movimientos[$iMov];
                             if ($movimiento->tipo == Tools::MOVIMIENTO_TIPO_ABONO) {
                                 if ($movimiento->validado == 1) {
                                     $sheet->setCellValueByColumnAndRow($col, $row + 2 + $iMov, $movimiento->monto);
                                     $saldo += $movimiento->monto;
                                 }
                             }
                             if ($movimiento->tipo == Tools::MOVIMIENTO_TIPO_CARGO) {
                                 $sheet->setCellValueByColumnAndRow($col + 1, $row + 2 + $iMov, $movimiento->monto);
                                 $saldo -= $movimiento->monto;
                             }
                             $iMov++;
                         }
                         $sheet->mergeCellsByColumnAndRow($col, $row + 2 + $iMov, $col + 1, $row + 2 + $iMov);
                         $sheet->setCellValueByColumnAndRow($col, $row + 2 + $iMov, $saldo);
                         $sheet->getStyleByColumnAndRow($col, $row + 2 + $iMov)->applyFromArray($styleCenter);
                         if ($saldo < 0) {
                             $sheet->getStyleByColumnAndRow($col, $row + 2 + $iMov)->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => 'FF0000'))));
                         } else {
                             $sheet->getStyleByColumnAndRow($col, $row + 2 + $iMov)->applyFromArray(array('fill' => array('type' => PHPExcel_Style_Fill::FILL_SOLID, 'color' => array('rgb' => '0000FF'))));
                         }
                         $col += 2;
                     }
                     $row += $rmax + 1;
                 }
             }
             $row += 3;
         }
         // Set active sheet index to the first sheet, so Excel opens this as the first sheet
         $objPHPExcel->setActiveSheetIndex(0);
         header('Content-Type: application/vnd.ms-excel');
         header('Content-Disposition: attachment;filename="Movimientos Propietario ' . $propietario->usuario->nombre . ' ' . $propietario->usuario->apellido . '.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 {
         $form->fechaHasta = date('Y-m-d');
     }
     $this->render('informe', array('model' => $form));
 }
Exemplo n.º 13
0
<?php

session_start();
require_once 'lib/Conexion.php';
require_once 'lib/Propiedad.php';
$conexion = new Conexion();
$conexion = $conexion->conectar();
$resultado = $conexion->query('SELECT zona FROM tblpropiedad');
while ($zona = $resultado->fetch_object()) {
    $zonas[] = $zona;
}
$propiedad = new Propiedad();
$arriendos = $propiedad->todosAlquiler($conexion);
$ventas = $propiedad->todosVenta($conexion);
require_once 'lib/Header.php';
require_once 'lib/Menu-Pagina.php';
?>
   
      <div class="contenedor centrado white">
        <h2 class="titulo left">Alquilado <a href="login.php" class="icon-enter texto-small float-right font-azul"> Ingresar</a></h2>
        <div class="col-50 border-right relative">
          <a class="after azul-claro" data="0">&laquo;</a>
          <h3 class="titulo-2 icon-banknote center azul-claro padding-10 font-white"> Alquiler</h3>
          <div class="slide-alquiler slide">
            <?php 
foreach ($arriendos as $a) {
    ?>
            <section>
            <a href="item.php?codigo=<?php 
    echo $a->codigo;
    ?>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php 
try {
    //Subir imagen al servidor
    $rutaServer = '../images';
    $rutaTemp = $_FILES['imagen']['tmp_name'];
    $nombreIma = $_FILES['imagen']['name'];
    $rutaDestino = $rutaServer . "/" . $nombreIma;
    move_uploaded_file($rutaTemp, $rutaDestino);
    //Instanciamos las clases
    $propiedadDal = new PropiedadDal();
    $p = new Propiedad();
    //Capturamos los datos del JSP
    $p->setCodigoPropiedad($_POST['txt_codigo']);
    $p->setFoto($nombreIma);
    $p->setPrecioUF($_POST['txt_precio_uf']);
    $p->setMetrosConstruidos($_POST['txt_metros_construidos']);
    $p->setMetrosTotal($_POST['txt_metros_total']);
    $p->setNumeroDormitorios($_POST['sp_dormitorios']);
    $p->setNumeroBanios($_POST['sp_banios']);
    $p->setTipoPropiedad($_POST['dll_tipo_propiedad']);
    $p->setComuna($_POST['dll_comunas']);
    $p->setDescripcion($_POST['txt_descripcion']);
    //Preguntamos si la inserción es = a 1 creé dicho propiedad
    if ($propiedadDal->insertProp($p)) {
        header('Location: ../Intranet/propiedad_creada.php');
    } else {
Exemplo n.º 15
0
<?php

/* @var $this PrestacionController */
/* @var $model Prestacion */
$this->breadcrumbs = array('Prestaciones' => array('admin'), 'Prestación #' . $model->id);
$this->menu = array(array('label' => 'Crear Prestación', 'url' => array('create')), array('label' => 'Editar Prestación', 'url' => array('update', 'id' => $model->id)), array('label' => 'Eliminar Prestación', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Seguro quiere eliminar esta prestación?')), array('label' => 'Administrar Prestaciones', 'url' => array('admin')));
?>

<?php 
$this->widget('zii.widgets.CDetailView', array('data' => $model, 'attributes' => array(array('name' => 'fecha', 'value' => Tools::backFecha($model->fecha)), array('name' => 'propiedad', 'value' => $model->propiedad_id != null ? Propiedad::model()->findByPk($model->propiedad_id)->nombre : '', 'visible' => $model->propiedad_id != null), 'monto', 'documento', 'descripcion', array('name' => 'tipo_prestacion_nombre', 'value' => $model->tipoPrestacion->nombre), array('name' => 'ejecutor', 'value' => $model->ejecutor->nombre), array('name' => 'genera_cargos', 'value' => Tools::backGeneraCargos($model->genera_cargos)), array('name' => 'general_prop', 'value' => Tools::backGeneraCargos($model->general_prop)))));
?>

<fieldset>
    <legend>Departamentos en los que se ejecutó la prestación</legend>
    <?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'departamentos-grid', 'dataProvider' => $departamentos, 'columns' => array(array('name' => 'propiedad_nombre', 'value' => '$data->propiedad->nombre'), 'numero', 'mt2', 'dormitorios', 'estacionamientos', 'renta')));
?>
</fieldset>

<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php 
try {
    //Instanciamos las Clases
    $propiedadDal = new PropiedadDal();
    $p = new Propiedad();
    //p = (Propiedad)request.getSession().getAttribute("propiedad");
    $p->setCodigoPropiedad($_POST['txt_codigo_prop']);
    $p->setTipoPropiedad($_POST['ddl_tipo_propiedad']);
    $p->setPrecioUF($_POST['spn_precio_uf']);
    $p->setMetrosTotal($_POST['spn_metros_total']);
    $p->setMetrosConstruidos($_POST['spn_metros_construidos']);
    $p->setNumeroDormitorios($_POST['spn_dormitorios']);
    $p->setNumeroBanios($_POST['spn_banios']);
    $p->setComuna($_POST['ddl_comunas']);
    $p->setDescripcion($_POST['txt_descripcion']);
    if (isset($_POST['btn_guardar']) && $propiedadDal->updateProp($p)) {
        //Notificación de ingreso correcto.
        header('Location: ../Intranet/propiedad_modificada.php');
    } else {
        if (isset($_POST['btn_eliminar_propiedad']) && $propiedadDal->deleteProp($p)) {
Exemplo n.º 17
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 Propiedad the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Propiedad::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemplo n.º 18
0
Arquivo: intra.php Projeto: aetexd/sun
?>
</h3>
                  <p>Clientes</p>
                </div>
                <div class="icon">
                  <i class="fa fa-users"></i>
                </div>
                <a href="?r=cliente/create" class="small-box-footer">Nuevos Clientes<i class="fa fa-arrow-circle-right"></i></a>
              </div>
            </div><!-- ./col -->
            <div class="col-lg-3 col-xs-6">
              <!-- small box -->
              <div class="small-box bg-green">
                <div class="inner">
                    <h3><?php 
echo Propiedad::model()->count();
?>
</h3>
                  <p>Propiedades</p>
                </div>
                <div class="icon">
                  <i class="fa fa-home"></i>
                </div>
                <a href="?r=propiedad/index" class="small-box-footer">Nuevas Propiedades <i class="fa fa-arrow-circle-right"></i></a>
              </div>
            </div><!-- ./col -->
            <div class="col-lg-3 col-xs-6">
              <!-- small box -->
              <div class="small-box bg-yellow">
                <div class="inner">
                  <h3>5</h3>
Exemplo n.º 19
0
 /**
  * Filter the query by a related Propiedad object
  *
  * @param   Propiedad|PropelObjectCollection $propiedad  the related object to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 ArticuloQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByPropiedad($propiedad, $comparison = null)
 {
     if ($propiedad instanceof Propiedad) {
         return $this->addUsingAlias(ArticuloPeer::IDARTICULO, $propiedad->getIdarticulo(), $comparison);
     } elseif ($propiedad instanceof PropelObjectCollection) {
         return $this->usePropiedadQuery()->filterByPrimaryKeys($propiedad->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByPropiedad() only accepts arguments of type Propiedad or PropelCollection');
     }
 }
Exemplo n.º 20
0
 /**
  * Exclude object from result
  *
  * @param   Propiedad $propiedad Object to remove from the list of results
  *
  * @return PropiedadQuery The current query, for fluid interface
  */
 public function prune($propiedad = null)
 {
     if ($propiedad) {
         $this->addUsingAlias(PropiedadPeer::IDPROPIEDAD, $propiedad->getIdpropiedad(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Exemplo n.º 21
0
echo $form->labelEx($model, 'fecha_compra');
?>
		<?php 
$this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'fecha_compra', 'language' => 'es', 'htmlOptions' => array('id' => 'datepicker_for_fecha', 'size' => '10', 'maxlength' => '10', 'value' => $fecha, 'readonly' => 'readonly'), 'defaultOptions' => array('showOn' => 'focus', 'dateFormat' => 'dd/mm/yy', 'showOtherMonths' => true, 'selectOtherMonths' => true, 'changeMonth' => true, 'changeYear' => true, 'showButtonPanel' => true)));
?>
		<?php 
echo $form->error($model, 'fecha_compra');
?>
	</div>
    
        <div class="row">
            <?php 
echo $form->labelEx($model, 'propiedad_id');
?>
            <?php 
echo $form->dropDownList($model, 'propiedad_id', CHtml::listData(Propiedad::model()->getDeUsuario(Yii::app()->user->id), 'id', 'nombre'), array('ajax' => array('type' => 'POST', 'url' => CController::createUrl('//propiedad/getDepartamentosAll'), 'update' => '#departamento_id'), 'prompt' => 'Seleccione una Propiedad'));
?>
            <?php 
echo $form->error($model, 'propiedad_id');
?>
        </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'));
    ?>
Exemplo n.º 22
0
 public function actionExportarXLS()
 {
     // generate a resultset
     $data = Propiedad::model()->with('propietario')->findAll();
     $this->toExcel($data, array('propietario.rut', 'nombre', 'direccion', 'mt_construidos', 'mt_terreno', 'cant_estacionamientos', 'inscripcion'), 'Propiedades', array());
 }
Exemplo n.º 23
0
                 unlink($url . $imagen_3);
                 $imagen_3 = $propiedad->cambianNombre(3);
             }
             move_uploaded_file($_FILES['imagen_1']['tmp_name'], $url . $imagen_1);
             move_uploaded_file($_FILES['imagen_2']['tmp_name'], $url . $imagen_2);
             move_uploaded_file($_FILES['imagen_3']['tmp_name'], $url . $imagen_3);
         } else {
             $_SESSION['mensaje-flash'] = 'Error al actualizar la propiedad';
             header('Location: ../admin/propiedades.php');
             $_SESSION['color'] = 'red';
         }
     } else {
         $imagen_1 = $_POST['imagen_1'];
         $imagen_2 = $_POST['imagen_2'];
         $imagen_3 = $_POST['imagen_3'];
         $propiedad = new Propiedad($codigo, $precio, $zona, $tipo, $habitaciones, $banos, $imagen_1, $imagen_2, $imagen_3);
     }
     if ($propiedad->Editar($conexion)) {
         $_SESSION['mensaje-flash'] = 'Propiedad actualizada correctamente';
         header('Location: ../admin/propiedades.php');
         $_SESSION['color'] = 'verde';
     } else {
         $_SESSION['mensaje-flash'] = 'Error al actualizar la propiedad';
         header('Location: ../admin/propiedades.php');
         $_SESSION['color'] = 'red';
     }
     break;
 case 'pagina-buscador':
     if ($_POST['codigo']) {
         $codigo = $_POST['codigo'];
     } else {
Exemplo n.º 24
0
<?php

session_start();
require_once 'lib/Conexion.php';
require_once 'lib/Propiedad.php';
$conexion = new Conexion();
$conexion = $conexion->conectar();
$codigo = $_GET['codigo'];
$propiedad = new Propiedad($codigo);
$item = $propiedad->Buscar($conexion);
$items = $propiedad->listaItemsAlquiler($conexion);
require_once 'lib/Header.php';
require_once 'lib/Menu-Pagina.php';
?>
      <div class="contenedor centrado white padding-10">
        <h2 class="titulo">Propiedad con codigo: <?php 
echo $item->codigo;
?>
</h2>
        <div class="col-70 relative">
          <a class="after azul-claro" data="0">&laquo;</a>
          <div class="slide-alquiler items slide">
            <section>
              <img src="contenido/<?php 
echo $item->imagen_1;
?>
">
            </section>
            <section>
              <img src="contenido/<?php 
echo $item->imagen_2;
Exemplo n.º 25
0
<?php

require_once '../../lib/Propiedad.php';
require_once "../../lib/Conexion.php";
$conexion = new Conexion();
$conexion = $conexion->conectar();
$propiedad = new Propiedad();
$opcion = $_POST['opcion'];
switch ($opcion) {
    case 'add':
        ?>
        <h3>Agregar propiedad</h3>
            <form action="../lib/AppController.php" method="POST" enctype="multipart/form-data">
                <input type="text" name="txtcodigo" class="gray caja no-float" required placeholder="Codigo" />
                <input type="text" name="txtprecio" class="gray caja no-float" required placeholder="Precio" />
                <input type="text" name="txtzona" class="gray caja no-float" required placeholder="Zona" />
                <select name="txttipo" id="" class="gray dosis font-weight" required>
                    <option value="">Seleccione el Tipo</option>
                    <option value="0">Alquiler</option>
                    <option value="1">Venta</option>
                </select>
                <input type="text" name="txthabitaciones" class="gray caja no-float" required placeholder="Nro de Habitaciones" />
                <input type="text" name="txtbanos" class="gray caja no-float" required placeholder="Nro de Baños" />
                <input type="file" name="imagen_1" class="caja no-float gray">
                <input type="file" name="imagen_2" class="caja no-float gray">
                <input type="file" name="imagen_3" class="caja no-float gray">
                <input type="hidden" name="accion" value="add-propiedad">
                <button class="btn azul-claro dosis font-weight">Guardar</button>
            </form>
        <?php 
        break;
 function deleteProp(Propiedad $p)
 {
     include_once '../conexion.php';
     try {
         $sql = "DELETE FROM propiedad WHERE idPropiedad = " . $p->getCodigoPropiedad() . ";";
         $query = mysql_query($sql);
         return $query;
     } catch (Exception $exc) {
         echo $exc->getTraceAsString();
     }
 }
Exemplo n.º 27
0
<?php

session_start();
if (!isset($_SESSION['username'])) {
    header("Location: ../login.php");
}
require_once "../lib/Propiedad.php";
require_once "../lib/Usuario.php";
require_once "../lib/Conexion.php";
$conexion = new Conexion();
$conexion = $conexion->conectar();
$propiedad = new Propiedad();
$todos = $propiedad->Todos($conexion);
$usuario = new Usuario();
require_once '../lib/Header.php';
if (isset($_SESSION['mensaje-flash'])) {
    ?>
        <div class="mensajes-flash <?php 
    echo $_SESSION['color'];
    ?>
">
            <?php 
    echo $_SESSION['mensaje-flash'];
    ?>
            <?php 
    unset($_SESSION['mensaje-flash']);
    ?>
        </div>
<?php 
}
?>
Exemplo n.º 28
0
<?php

session_start();
if (!isset($_SESSION['username'])) {
    header("Location: ../login}.php");
}
require_once "../lib/Propiedad.php";
require_once "../lib/Usuario.php";
require_once "../lib/Conexion.php";
$conexion = new Conexion();
$conexion = $conexion->conectar();
$propiedad = new Propiedad();
$usuario = new Usuario();
require_once '../lib/Header.php';
require_once '../lib/Menu.php';
?>
    <div class="contenedor-menu">
        <div class="datos-section verde">
            <p class="dosis right white-font"><span class="float-left">Alquilados©</span>Bienvenido: <strong> <i class="icon-user"></i> <?php 
echo $_SESSION['username'];
?>
</strong></p>
        </div>
    <div class="col-50 padding-20">
        <h2 class="titulo">Propiedades <i class="icon-home"></i></h2>
        <h3 class="titulo-interno"><i class="icon-mountains"></i> Cantidad</h3>
        <div class="contenedor-interno">
            <p class="margin-font"><i class="icon-key font-aqua"></i>&nbsp;Total propiedades en alquiler:<span><?php 
echo $propiedad->totalAlquiler($conexion);
?>
</span></p>
Exemplo n.º 29
0
    <div class="span12" id="deptos">
        <span><big>¿En qué departamentos va a ejecutar la Prestación?</big></span>
            <?php 
$this->widget('ext.selgridview.SelGridView', array('id' => 'departamentos-grid', 'filter' => $departamentos, 'dataProvider' => $departamentos->searchChb(), 'selectableRows' => 2, 'columns' => array(array('class' => 'CCheckBoxColumn', 'checked' => '$data["id"]', 'checkBoxHtmlOptions' => array('name' => 'chbDepartamentoId[]'), 'value' => '$data->id'), array('name' => 'propiedad_nombre', 'value' => '$data->propiedad->nombre'), 'numero', 'mt2', 'dormitorios', 'estacionamientos', 'renta')));
?>
        <span class="note">Solo los departamentos que estén seleccionados quedarán asociados a la prestación.</span>
        
    </div>
    <div class="span12" id="propiedad">
        <div class="span10">
        <span><big>¿En qué propiedad va a ejecutar la Prestación?</big></span><br/><br/>
        </div>
        <div class="clearfix"></div>
        <div class="span4">
            <?php 
echo $form->dropDownList($model, 'propiedad_id', CHtml::listData(Propiedad::model()->getDeUsuario(Yii::app()->user->id), 'id', 'nombre'), array('prompt' => 'Seleccione Propiedad'));
?>
            <?php 
echo $form->error($model, 'propiedad_id');
?>
        </div>
    </div>
    <div class="clearfix"></div>
    <br/>
    <div class="span2">
            <?php 
echo CHtml::submitButton('Guardar', array('class' => 'btn'));
?>
    </div>
<br/>
<?php 
Exemplo n.º 30
0
 /**
  * Filter the query by a related Propiedad object
  *
  * @param   Propiedad|PropelObjectCollection $propiedad The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 PropiedadvalorQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByPropiedad($propiedad, $comparison = null)
 {
     if ($propiedad instanceof Propiedad) {
         return $this->addUsingAlias(PropiedadvalorPeer::IDPROPIEDAD, $propiedad->getIdpropiedad(), $comparison);
     } elseif ($propiedad instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(PropiedadvalorPeer::IDPROPIEDAD, $propiedad->toKeyValue('PrimaryKey', 'Idpropiedad'), $comparison);
     } else {
         throw new PropelException('filterByPropiedad() only accepts arguments of type Propiedad or PropelCollection');
     }
 }