/** * @inheritdoc */ public function upload() { if ($this->validate()) { $this->url->saveAs('uploads/' . $this->url->baseName . '.' . $this->url->extension); $documento = new Documento(); $documento->url = $this->url->baseName . '.' . $this->url->extension; $documento->nombre = $this->url->baseName; $documento->save(false); $proyecto = Proyecto::findOne($this->id_proyecto); $proyecto->id_Anteproyecto = $documento->id_Documento; $proyecto->save(false); return true; } else { return false; } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Documento::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]); $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->andFilterWhere(['like', 'numeroDocumentoEmisor', $this->numeroDocumentoEmisor])->andFilterWhere(['like', 'serieNumero', $this->serieNumero])->andFilterWhere(['like', 'tipoDocumento', $this->tipoDocumento])->andFilterWhere(['like', 'tipoDocumentoEmisor', $this->tipoDocumentoEmisor])->andFilterWhere(['like', 'bl_cdr', $this->bl_cdr])->andFilterWhere(['like', 'bl_estadoProceso', $this->bl_estadoProceso])->andFilterWhere(['like', 'bl_estadoRegistro', $this->bl_estadoRegistro])->andFilterWhere(['like', 'codigoLeyenda_1', $this->codigoLeyenda_1])->andFilterWhere(['like', 'correoAdquiriente', $this->correoAdquiriente])->andFilterWhere(['like', 'correoEmisor', $this->correoEmisor])->andFilterWhere(['like', 'departamentoAdquiriente', $this->departamentoAdquiriente])->andFilterWhere(['like', 'departamentoEmisor', $this->departamentoEmisor])->andFilterWhere(['like', 'direccionEmisor', $this->direccionEmisor])->andFilterWhere(['like', 'distritoAdquiriente', $this->distritoAdquiriente])->andFilterWhere(['like', 'distritoEmisor', $this->distritoEmisor])->andFilterWhere(['like', 'distritoPtoLlegada', $this->distritoPtoLlegada])->andFilterWhere(['like', 'distritoPtoPartida', $this->distritoPtoPartida])->andFilterWhere(['like', 'fechaVencimiento', $this->fechaVencimiento])->andFilterWhere(['like', 'lugarDestino', $this->lugarDestino])->andFilterWhere(['like', 'nombreComercialEmisor', $this->nombreComercialEmisor])->andFilterWhere(['like', 'numeroDocumentoAdquiriente', $this->numeroDocumentoAdquiriente])->andFilterWhere(['like', 'paisEmisor', $this->paisEmisor])->andFilterWhere(['like', 'razonSocialAdquiriente', $this->razonSocialAdquiriente])->andFilterWhere(['like', 'razonSocialEmisor', $this->razonSocialEmisor])->andFilterWhere(['like', 'textoLeyenda_1', $this->textoLeyenda_1])->andFilterWhere(['like', 'tipoDocumentoAdquiriente', $this->tipoDocumentoAdquiriente])->andFilterWhere(['like', 'tipoMoneda', $this->tipoMoneda])->andFilterWhere(['like', 'totalDescuentos', $this->totalDescuentos])->andFilterWhere(['like', 'totalIgv', $this->totalIgv])->andFilterWhere(['like', 'totalValorVentaNetoOpExonerada', $this->totalValorVentaNetoOpExonerada])->andFilterWhere(['like', 'totalValorVentaNetoOpGratuitas', $this->totalValorVentaNetoOpGratuitas])->andFilterWhere(['like', 'totalValorVentaNetoOpGravadas', $this->totalValorVentaNetoOpGravadas])->andFilterWhere(['like', 'totalValorVentaNetoOpNoGravada', $this->totalValorVentaNetoOpNoGravada])->andFilterWhere(['like', 'totalVenta', $this->totalVenta])->andFilterWhere(['like', 'ubigeoEmisor', $this->ubigeoEmisor])->andFilterWhere(['like', 'urbanizacion', $this->urbanizacion])->andFilterWhere(['between', 'fechaEmision', $this->fechaEmisiondesde, $this->fechaEmisionhasta]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Documento::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->andFilterWhere(['id' => $this->id, 'usuariocrea' => $this->usuariocrea, 'fechacrea' => $this->fechacrea, 'usuariomodifica' => $this->usuariomodifica, 'fechamodifica' => $this->fechamodifica]); $query->andFilterWhere(['like', 'documento', $this->documento]); return $dataProvider; }
public function search($input) { $query = Documento::query(); $columns = Schema::getColumnListing('Documentos'); $attributes = array(); foreach ($columns as $attribute) { if (isset($input[$attribute]) and !empty($input[$attribute])) { $query->where($attribute, $input[$attribute]); $attributes[$attribute] = $input[$attribute]; } else { $attributes[$attribute] = null; } } return [$query->get(), $attributes]; }
/** * Finds the Documento model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Documento the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Documento::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getDocumento() { return $this->hasOne(Documento::className(), ['id' => 'documentoid']); }
/** * Finds the Documento model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $numeroDocumentoEmisor * @param string $serieNumero * @param string $tipoDocumento * @param string $tipoDocumentoEmisor * @return Documento the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($numeroDocumentoEmisor, $serieNumero, $tipoDocumento, $tipoDocumentoEmisor) { if (($model = Documento::findOne(['numeroDocumentoEmisor' => $numeroDocumentoEmisor, 'serieNumero' => $serieNumero, 'tipoDocumento' => $tipoDocumento, 'tipoDocumentoEmisor' => $tipoDocumentoEmisor])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }