public function montoAccion(PresupuestoPartidaAcciones $accion)
 {
     $monto = 0;
     $usuario = Usuarios::model()->findByPk(Yii::app()->user->getId());
     $partidasAcciones = PresupuestoPartidaAcciones::model()->findAllByAttributes(array('accion_id' => $accion->accion_id, 'ente_organo_id' => $usuario->enteOrgano->ente_organo_id, 'anho' => Yii::app()->params['trimestresFechas'][Yii::app()->session['trimestreSeleccionado']]['anho']));
     foreach ($partidasAcciones as $key => $partidaAcciones) {
         $monto += $partidaAcciones->presupuestoPartida->monto_presupuestado;
     }
     return $monto;
 }
 /**
  *Busca la lista de partidas de la acción
  *@return Partidas[] $partidas
  **/
 public function presuPartidas($id)
 {
     $presuPartidas = array();
     foreach (PresupuestoPartidaAcciones::model()->findAllByAttributes(array('accion_id' => $id, 'ente_organo_id' => Usuarios::model()->actual()->ente_organo_id, 'anho' => Yii::app()->params['trimestresFechas'][Yii::app()->session['trimestreSeleccionado']]['anho'])) as $key => $prePar) {
         if (!empty($prePar)) {
             $presuPartidas[$key] = $prePar->presupuestoPartida;
         }
     }
     return $presuPartidas;
 }
Example #3
0
 public function partidaAsignada($attribute, $params)
 {
     $criteria = new CDbCriteria();
     $usuario = Usuarios::model()->findByPk(Yii::app()->user->getId());
     if ($this->nombre) {
         $accion = Acciones::model()->find('codigo=:codigo', array(':codigo' => $this->nombre));
         $presupuestopartidaproyecto = PresupuestoPartidaAcciones::model()->findAll('accion_id=:accion_id and ente_organo_id=:ente_organo_id and anho=:anho', array(':accion_id' => $accion->accion_id, ':ente_organo_id' => $usuario->ente_organo_id, ':anho' => Yii::app()->params['trimestresFechas'][Yii::app()->session['trimestreSeleccionado']]['anho']));
         foreach ($presupuestopartidaproyecto as $key => $value) {
             $value->presupuesto_partida_id;
             $partida = PresupuestoPartidas::model()->find('presupuesto_partida_id=:presupuesto_partida_id and ente_organo_id=:ente_organo_id and tipo=:tipo and anho=:anho', array(':ente_organo_id' => $usuario->ente_organo_id, ':presupuesto_partida_id' => $value->presupuesto_partida_id, ':tipo' => 'A', ':anho' => Yii::app()->params['trimestresFechas'][Yii::app()->session['trimestreSeleccionado']]['anho']));
             if ($partida->partida_id == $this->{$attribute}) {
                 $this->addError($attribute, 'Esta partida ya tiene asignado dinero para esta acción centralizada!');
                 //$partida = $attribute['especifica'];
                 break;
             }
         }
     }
     //$criteria->condition = "ente_organo_id=".$usuario->ente_organo_id ;
     //$criteria->addSearchCondition('t.nombre', $this->nombre);
     //$criteria->compare('LOWER(nombre)',strtolower($this->nombre),true);
 }
 public function buscarPartidasProyectoAccion($id)
 {
     if (strstr($id, 'a')) {
         //Es un id de accion
         $accionId = PresupuestoPartidaAcciones::model()->accionId($id);
         $presuPartidas = PresupuestoPartidaAcciones::model()->presuPartidas($accionId);
     } else {
         //Es un id de proyecto
         $proyectoSel = Proyectos::model()->findByPk($id);
         if (Usuarios::model()->actual()->ente_organo_id != $proyectoSel->ente_organo_id) {
             throw new CHttpException(403, "No se puede procesar la solicitud.");
         }
         $presuPartidas = $proyectoSel->getPresuPartidas();
     }
     $listPresuPartidas = CHtml::listData($presuPartidas, function ($presuPartida) {
         return $presuPartida->presupuesto_partida_id;
     }, function ($presuPartida) {
         return $presuPartida->partida->etiquetaPartida();
     });
     echo CHtml::tag('option', array('value' => ''), CHtml::encode(''), true);
     foreach ($listPresuPartidas as $value => $name) {
         echo CHtml::tag('option', array('value' => $value), CHtml::encode($name), true);
     }
 }
Example #5
0
						'hint' => 'Selecciona la Acción o Proyecto.'
					)
				); 


			$list = array();
			//
			//print_r($proyectoSel->findByPk($proyectoSel->proyecto_id)->presupuestoPartidas);
			//exit();
			if(!empty($proyectoSel->proyecto_id)){
				if(strstr($proyectoSel->proyecto_id, 'a'))
				{//Es un id de accion	

					$accionId = Proyectos::model()->accionId($proyectoSel->proyecto_id);
					
					$presuPartidas = PresupuestoPartidaAcciones::model()->presuPartidas($accionId);

				}else{//Es un id de proyecto

					$proyectoSel = Proyectos::model()->findByPk($proyectoSel->proyecto_id);

					if(Usuarios::model()->actual()->ente_organo_id != $proyectoSel->ente_organo_id)
						throw new CHttpException(403, "No se puede procesar la solicitud.");
					
					$presuPartidas = $proyectoSel->getPresuPartidas();
				}	
					$list = CHtml::listData($presuPartidas,'presupuesto_partida_id',function($presuPartida){return $presuPartida->partida->etiquetaPartida();});

			}
			
				echo $form->select2Group(
 public function actionVistaparcial()
 {
     $usuario = Usuarios::model()->findByPk(Yii::app()->user->getId());
     $proyectos = $usuario->enteOrgano->proyectos;
     $criteria = new CDbCriteria();
     $criteria->distinct = true;
     $criteria->condition = "ente_organo_id=" . $usuario->ente_organo_id . " and anho=" . Yii::app()->params['trimestresFechas'][Yii::app()->session['trimestreSeleccionado']]['anho'];
     $criteria->select = 'codigo_accion, accion_id, ente_organo_id';
     $acciones = PresupuestoPartidaAcciones::model()->findAll($criteria);
     $this->render('vistaparcial', array('proyectos' => $proyectos, 'acciones' => $acciones));
 }
Example #7
0
			    		?>
			    		<table data-toggle="table" data-url="" data-cache="false" data-height="" width="100%">
					    <thead>
					        <tr class="principaltr">
					            <th colspan="2" data-field="conapre">Código</th>
					            <th colspan="2" data-field="nombreoue">Denominación</th>
					            <th colspan="2" data-field="tipo">Bs. Solicitados</th>
					            <th colspan="2" data-field="tipo"></th>
					        </tr>
					    	</thead>
						    <tbody>
				    		<tr>
					    		<td colspan="2"><?php echo $accion->codigo_accion; ?></td>
				    			<td colspan="2"><?php echo $accion->accion->nombre; ?></td>
				    			<?php
				    				$accionOrgano = PresupuestoPartidaAcciones::model()->findAllByAttributes(array('accion_id'=>$accion->accion_id, 'ente_organo_id'=>$this->usuario()->ente_organo_id, 'anho'=>Yii::app()->params['trimestresFechas'][Yii::app()->session['trimestreSeleccionado']]['anho']));
									$valor = 0;
				    			?>
				    			<td colspan="2"><?php echo number_format($monto,2,',','.') ?></td>
				    			<td colspan="2"></td>
			    			</tr>
			    			<tr>
			    			<div>
			    				
							    
							        <tr class="principaltr">
							            <th data-field="conapre">Nombre</th>
							            <th data-field="nombreoue">Partida</th>
							            <th data-field="tipo">General</th>
							            <th data-field="tipo">Especifica</th>
							            <th data-field="tipo">Subespecifica</th>
Example #8
0
					        <tr class="principaltr">
					            <th data-field="conapre">Código</th>
					            <th data-field="nombreoue">Denominación</th>
					            <th data-field="tipo">Bs. Solicitados</th>
					            <th data-field="tipo"></th>
					            <th data-field="tipo"></th>
					            <th data-field="tipo"></th>
					            <!--<th data-field="tipo"></th>-->
					        </tr>
					    	</thead>
						    <tbody>
				    		<tr>
					    		<td><?php echo $accion->codigo_accion; ?></td>
				    			<td><?php echo $accion->accion->nombre; ?></td>
				    			<?php
				    				$accionOrgano = PresupuestoPartidaAcciones::model()->findAllByAttributes(array('accion_id'=>$accion->accion_id, 'ente_organo_id'=>$this->usuario()->ente_organo_id));
									$valor = 0;
				    			?>
				    			<td><?php echo number_format($monto,2,',','.') ?></td>
				    			<td></td>
			    			</tr>
			    			<tr>
			    			
			    			<div>
							        <tr class="principaltr">
							            <th data-field="conapre">Nombre</th>
							            <th data-field="nombreoue">Número de partida</th>
							            <th data-field="tipo">Monto asignado</th>
							            <th data-field="tipo">Monto ejecutado</th>
							            <th data-field="tipo">Monto disponible</th>
							           <!-- <th data-field="tipo">% Carga</th>-->