/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Contrato::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->joinWith('iDCOL');
     $query->andFilterWhere(['ID_CONTRACT' => $this->ID_CONTRACT, 'ID_ADMIN' => $this->ID_ADMIN]);
     $query->andFilterWhere(['like', 'DETAIL', $this->DETAIL])->andFilterWhere(['like', 'perfil_colaborador.NAME_COL', $this->ID_COL]);
     //nombre de la tabla y su atributo comparado con el id
     return $dataProvider;
 }
Esempio n. 2
0
 public static function AtualizaAluguel()
 {
     $teste = "-";
     $contratos = models\Contrato::getAtivos();
     foreach ($contratos as $item) {
         $contrato = models\Contrato::findOne($item->id);
         if (\app\models\Despesa::verificaAluguel($contrato->id)) {
             $despesa = \app\models\Despesa::verificaAluguel($contrato->id);
             if (Setup::VerificaDia($despesa->data)) {
                 $aluguel = models\Despesa::LancaAluguel(Setup::VerificaDia($despesa->data), $contrato->id);
             }
         } else {
             if (Setup::VerificaDia($contrato->data_inicio)) {
                 $aluguel = models\Despesa::LancaAluguel($contrato->data_inicio, $contrato->id);
             }
         }
     }
 }
Esempio n. 3
0
 public function deleteDestroy($id)
 {
     $user = User::fromToken();
     $contr = Contrato::destroy($id);
     return $contr;
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getContratos()
 {
     return $this->hasMany(Contrato::className(), ['ID_COL' => 'ID_COL']);
 }
Esempio n. 5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getContratos()
 {
     return $this->hasMany(Contrato::className(), ['colaborador_id' => 'id']);
 }
Esempio n. 6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getContratos()
 {
     return $this->hasMany(Contrato::className(), ['staff_id' => 'id']);
 }
 /**
  * Finds the Contrato model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Contrato the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Contrato::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }