/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Cliente::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]); $query->andFilterWhere(['like', 'nome', $this->nome])->andFilterWhere(['like', 'telefone', $this->telefone])->andFilterWhere(['like', 'celular', $this->celular])->andFilterWhere(['like', 'endereco', $this->endereco]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Cliente::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(['idCliente' => $this->idCliente]); $query->andFilterWhere(['like', 'Nombre', $this->Nombre])->andFilterWhere(['like', 'Telefono', $this->Telefono])->andFilterWhere(['like', 'Mail', $this->Mail])->andFilterWhere(['like', 'Direccion', $this->Direccion])->andFilterWhere(['like', 'Descripcion', $this->Descripcion]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Cliente::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(['idcliente' => $this->idcliente, 'numero' => $this->numero, 'longe_od_esferico' => $this->longe_od_esferico, 'longe_od_cilindrico' => $this->longe_od_cilindrico, 'longe_od_eixo' => $this->longe_od_eixo, 'longe_od_dnp' => $this->longe_od_dnp, 'longe_oe_esferico' => $this->longe_oe_esferico, 'longe_oe_cilindrico' => $this->longe_oe_cilindrico, 'longe_oe_eixo' => $this->longe_oe_eixo, 'longe_oe_dnp' => $this->longe_oe_dnp, 'perto_od_esferico' => $this->perto_od_esferico, 'perto_od_cilindrico' => $this->perto_od_cilindrico, 'perto_od_eixo' => $this->perto_od_eixo, 'perto_od_dnp' => $this->perto_od_dnp, 'perto_oe_esferico' => $this->perto_oe_esferico, 'perto_oe_cilindrico' => $this->perto_oe_cilindrico, 'perto_oe_eixo' => $this->perto_oe_eixo, 'perto_oe_dnp' => $this->perto_oe_dnp, 'ad' => $this->ad, 'data_receituario' => $this->data_receituario, 'datanascimento' => $this->datanascimento, 'renda' => $this->renda]); $query->andFilterWhere(['like', 'nome', $this->nome])->andFilterWhere(['like', 'cpf', $this->cpf])->andFilterWhere(['like', 'rg', $this->rg])->andFilterWhere(['like', 'sexo', $this->sexo])->andFilterWhere(['like', 'telefone1', $this->telefone1])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'observacao', $this->observacao])->andFilterWhere(['like', 'logradouro', $this->logradouro])->andFilterWhere(['like', 'complemento', $this->complemento])->andFilterWhere(['like', 'bairro', $this->bairro])->andFilterWhere(['like', 'cidade', $this->cidade])->andFilterWhere(['like', 'estado', $this->estado])->andFilterWhere(['like', 'cep', $this->cep])->andFilterWhere(['like', 'observacao_lentes', $this->observacao_lentes])->andFilterWhere(['like', 'naturalidade_uf', $this->naturalidade_uf])->andFilterWhere(['like', 'profissao', $this->profissao])->andFilterWhere(['like', 'mae', $this->mae])->andFilterWhere(['like', 'pai', $this->pai])->andFilterWhere(['like', 'estadocivil', $this->estadocivil])->andFilterWhere(['like', 'conjuge', $this->conjuge])->andFilterWhere(['like', 'telefone2', $this->telefone2])->andFilterWhere(['like', 'referencia1', $this->referencia1])->andFilterWhere(['like', 'telefone11', $this->telefone11])->andFilterWhere(['like', 'referencia2', $this->referencia2])->andFilterWhere(['like', 'telefone21', $this->telefone21]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Cliente::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(['clien_codigo' => $this->clien_codigo, 'clien_tipo' => $this->clien_tipo, 'muni_codigo' => $this->muni_codigo]); $query->andFilterWhere(['like', 'clien_nome', $this->clien_nome])->andFilterWhere(['like', 'clien_cpf_cnpj', $this->clien_cpf_cnpj])->andFilterWhere(['like', 'clien_email', $this->clien_email]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Cliente::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, 'dni' => $this->dni, 'fecha_nacimiento' => $this->fecha_nacimiento, 'localidad_id' => $this->localidad_id]); $query->andFilterWhere(['like', 'apellido', $this->apellido])->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'domicilio', $this->domicilio]); return $dataProvider; }
public function search2($params) { $query = Cliente::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(['idCliente' => $this->idCliente]); $query->andFilterWhere(['like', 'razonSocial', $this->razonSocial])->andFilterWhere(['like', 'direccion', $this->direccion])->andFilterWhere(['like', 'barrio', $this->barrio])->andFilterWhere(['like', 'telefono', $this->telefono])->andFilterWhere(['like', 'nit', $this->nit])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'ruta', $this->ruta])->andFilterWhere(['like', 'dia', $this->dia]); return $dataProvider; }
use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; /* @var $this yii\web\View */ /* @var $model app\models\Pedido */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="pedido-form"> <?php $form = ActiveForm::begin(['enableClientValidation' => false]); ?> <?php $rows = \app\models\Cliente::find()->all(); $data = ArrayHelper::map($rows, 'clien_codigo', 'clien_nome'); echo $form->field($model, 'clien_codigo')->dropDownList($data, ['prompt' => 'Selecione um cliente']); ?> <?php $rows = \app\models\FormaPagamento::find()->all(); $data = ArrayHelper::map($rows, 'fopa_codigo', 'fopa_nome'); echo $form->field($model, 'fopa_codigo')->dropDownList($data, ['prompt' => 'Selecione uma forma de pagamento']); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Cadastrar' : 'Alterar', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div>
public function actionImprimir() { // get your HTML raw content without any layouts or scrip $Empleado = Cliente::find()->all(); $pdf = Yii::$app->pdf; $pdf->content = $this->renderPartial('_imprimir', ['Cliente' => $Cliente]); return $pdf->render(); }
public static function clientesFrecuentes($reservaciones) { $clientes = array(); $idCliente = null; $cliente = null; $again = false; foreach ($reservaciones as $reservacion) { do { if ($idCliente == null) { $cliente = Cliente::find($reservacion->id_cliente); $cliente->visitas = 0; $idCliente = $cliente->id; $again = false; } if ($reservacion->id_cliente == $idCliente) { $cliente->visitas += 1; } if ($reservacion->id_cliente != $idCliente) { $idCliente = null; array_push($clientes, $cliente); $cliente = null; $again = true; } } while ($again); } return $clientes; }
use yii\helpers\ArrayHelper; use kartik\widgets\Select2; use kartik\datecontrol\DateControl; /* @var $this yii\web\View */ /* @var $model app\models\Pedido */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="pedido-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'cliente_idCliente')->widget(Select2::classname(), ['data' => ArrayHelper::map(Cliente::find()->all(), 'idCliente', 'razonSocial'), 'options' => ['placeholder' => 'Seleccione une opción'], 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'fechaEntrega')->widget(DateControl::classname(), ['type' => DateControl::FORMAT_DATE]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>
/* @var $this yii\web\View */ /* @var $model app\models\Pedido */ /* @var $form yii\widgets\ActiveForm */ $stats = ArrayHelper::getColumn(Situacao::find()->all(), function ($element) { return $element['status']; }); $statuses = array_combine($stats, $stats); $entregadores = ArrayHelper::getColumn(Entregador::find()->all(), function ($element) { return $element['nome']; }); $entregadores = array_combine($entregadores, $entregadores); $clientes = ArrayHelper::getColumn(Cliente::find()->all(), function ($element) { return $element['nome']; }); $clientes = array_combine($clientes, $clientes); $tels = ArrayHelper::getColumn(Cliente::find()->all(), function ($element) { return $element['tel']; }); $tels = array_combine($tels, $tels); ?> <div class="pedido-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'cliente_nome')->dropDownList($clientes, ['prompt' => 'Selecione...']); ?>
public function actionRelatorioInadimplentes() { /*$query = GaleriaFoto::find() ->select("galeria_foto.id_foto, galeria_foto.username as instagram_username, galeria_foto.url_standard_resolution, galeria_foto.url_low_resolution, galeria_foto.url_thumbnail, c.instagram_foto_perfil, count(l.id_foto) as likes, g.fama") ->where("galeria_foto.ativa = 1 AND MATCH (galeria_foto.username, galeria_foto.tags, galeria_foto.legenda) AGAINST ('$q' IN NATURAL LANGUAGE MODE)") ->innerJoin('galeria g', 'galeria_foto.username=g.username') ->innerJoin('cliente c', 'galeria_foto.username=c.instagram_username AND c.galeria_aberta=1') ->leftJoin('galeria_foto_likes l', 'galeria_foto.id_foto=l.id_foto') ->groupBy('galeria_foto.id_foto') ->orderBy('g.recomendado, g.fama DESC, likes DESC, galeria_foto.data_adicao DESC') ;*/ $query = Cliente::find()->select("*")->with(['vendas', 'vendas.parcelas'])->where("idcliente in(SELECT cliente_idcliente FROM `sgo-v1-final`.venda where idvenda in(SELECT venda_idvenda FROM `sgo-v1-final`.parcela where (data_pagamento is null and data_vencimento < DATE(NOW()))))"); $dataProvider = new ActiveDataProvider(['query' => $query]); /*if(Yii::$app->user->identity->perfil != 'Administrador'){ $query->andFilterWhere([ 'venda.loja_idloja' => Yii::$app->user->identity->loja_idloja, ]); }*/ //VarDumper::dump($query->all(),10,true);die; return $this->render('relatorio-inadimplentes', ['dataProvider' => $dataProvider]); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(ClientesRequest $request, $id) { $cliente = Cliente::find($id); $cliente->update($request->all()); if ($request->contato) { $this->insertContatos($request->contato, $cliente); } if ($request->endereco) { $this->insertEnderecos($request->endereco, $cliente); } flash()->success('Cliente atualizado com sucesso'); return redirect('/clientes'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $cliente = Cliente::find($id); try { if (File::deleteDirectory(public_path() . '/imagenes/clientes/' . $id)) { } else { } } catch (Exception $e) { } Funciones::BorrarFotosCliente($id); $cliente->delete(); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $cliente = Cliente::find($id); $cliente->delete(); return \Response::json(array('datos' => DB::select('SELECT c.id , c.razon_social , c.ruc , (SELECT dc.id_cliente FROM ts_detallecliente dc WHERE dc.id_cliente = c.id AND dc.id_indicadorDireccion = 1) AS id_cliente , (SELECT dc.id FROM ts_detallecliente dc WHERE dc.id_cliente = c.id AND dc.id_indicadorDireccion = 1) AS id_direccion_principal , (SELECT dc.direccion_cliente FROM ts_detallecliente dc WHERE dc.id_cliente = c.id AND dc.id_indicadorDireccion = 1) AS direccion_principal , (SELECT dc.id FROM ts_detallecliente dc WHERE dc.id_cliente = c.id AND dc.id_indicadorDireccion = 2) AS id_direccion_secundaria , (SELECT dc.direccion_cliente FROM ts_detallecliente dc WHERE dc.id_cliente = c.id AND dc.id_indicadorDireccion = 2) AS direccion_secundaria , c.agente_retenedor FROM ts_cliente c WHERE c.deleted_at IS NULL'))); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $reservacion = Reservacion::find($id); if ($reservacion != null && $reservacion->factura == 0) { $cliente = Cliente::find($reservacion->id_cliente); $cliente->visitas = $cliente->visitas - 1; $cliente->save(); $reservacion->delete(); } else { return "La reservación ya se encuentra cancelada."; } }