Beispiel #1
0
 public function lph($seguro, $id)
 {
     $criteria = new CDbCriteria();
     $criteria->order = 'Fecha DESC';
     $empleado = Empleados::model()->findByAttributes(array('id' => $id));
     $cargo = Cargos::model()->findByAttributes(array('id' => $empleado->id_cargo));
     $concepto = Conceptos::model()->findByAttributes(array('tipo_bono' => 9), $criteria);
     if ($seguro == 0) {
         return $seguro;
     } else {
         if ($cargo->tipo_sueldo == 1) {
             $sueldo = $cargo->sueldo;
         } else {
             $sueldo = $cargo->sueldo / 2;
         }
         $lph = $sueldo * ($concepto->bono / 100);
         return $lph;
     }
 }
 /**
  * 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 Conceptos the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Conceptos::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }