public function index()
 {
     // Obtenemos los consultores
     $consultor = new Consultor();
     $consultores = $consultor->getAllConsultores();
     $cliente = new Cliente();
     $clientes = $cliente->getAllClientes();
     return view('comercial.performance')->with('clientes', $clientes)->with('consultores', $consultores);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  ClienteStoreRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(ClienteStoreRequest $request)
 {
     // store
     Cliente::insert($request->all());
     // Redirect
     return redirect()->route('clientes.index');
 }
 public function clientesFrecuentesFecha($fecha)
 {
     $clientes = Cliente::clientesFrecuentes($fecha);
     $clientes = Funciones::limparCeros($clientes);
     $cantidadclientes = count($clientes);
     return view('principal.consultas.clientesfrecuentesfecha', compact('clientes', 'cantidadclientes'));
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $json = File::get(database_path() . '/data/clienti.json');
     $data = json_decode($json);
     foreach ($data as $obj) {
         Cliente::create(array('id' => $obj->id, 'nome' => $obj->nome, 'cognome' => $obj->cognome, 'societa' => $obj->societa, 'indirizzo' => $obj->indirizzo, 'cap' => $obj->cap, 'comune' => $obj->comune, 'provincia' => $obj->provincia, 'nazione' => $obj->nazione, 'telefono' => $obj->telefono, 'fax' => $obj->fax, 'utente' => $obj->utente, 'cancellato' => $obj->cancellato));
     }
     $this->command->info("tabella clienti popolata");
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $venda = Venda::find($id);
     $clientes = Cliente::orderBy('fantasia')->get(['id', 'fantasia', 'nome_razao']);
     /*if ($venda->status == 2) {
         flash()->error('Venda não pode ser alterar, a mesma já está concluída');
         return redirect('/vendas');
       }*/
     return view('vendas.edit', compact('venda', 'clientes'));
 }
Example #6
0
 /**
  * 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;
 }
Example #7
0
 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;
 }
Example #8
0
 /**
  * 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;
 }
Example #10
0
 /**
  * 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;
 }
Example #11
0
 /**
  * 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;
 }
Example #12
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(UserCreateRequest $request)
 {
     $persona = new Persona();
     $persona->fill($request->all());
     $persona->contacto_id = 1;
     $persona->fecha_nacimiento = Carbon::createFromTimestamp(strtotime($persona->fecha_nacimiento))->format('Y-m-d');
     $persona->save();
     $cliente = new Cliente();
     $cliente->numero_cliente = 0;
     $cliente->curp = '';
     $cliente->rfc = '';
     $cliente->razon_social = '';
     $cliente->actividad_economica = '';
     $cliente->fecha_registro = Carbon::now();
     $cliente->persona_id = $persona->id;
     $cliente->save();
     $user = new User();
     $user->fill($request->all());
     $user->password = bcrypt($request->password);
     $user->cliente_id = $cliente->id;
     $user->save();
     $user->roles()->sync($request->roles);
     return redirect()->route('usuario.index');
 }
Example #13
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getClienCodigo()
 {
     return $this->hasOne(Cliente::className(), ['clien_codigo' => 'clien_codigo']);
 }
Example #14
0
 /**
  * Finds the Cliente model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Cliente the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Cliente::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #15
0
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>
Example #16
0
 public function createByCliente($id)
 {
     $cliente = Cliente::findOrFail($id);
     $cliente_id = $cliente->id;
     $asociado = new Asociado();
     $cliente_id_field = \Form::hidden('cliente_id', $cliente->id);
     $form_data = ['route' => 'asociado.store'];
     $title = 'Agregar asociado de cliente: ' . $cliente->persona->primer_nombre;
     return view('asociado.form')->with(compact('cliente', 'asociado', 'cliente_id_field', 'cliente_id', 'form_data', 'title'));
 }
Example #17
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdCliente()
 {
     return $this->hasOne(Cliente::className(), ['id' => 'id_cliente']);
 }
Example #18
0
 public function getClientAccount($id)
 {
     $cliente = Cliente::findOrFail($id);
     $coches = $cliente->coches->lists('modelo', 'id');
     $title = 'Cuenta de cliente';
     return view('sell.clientaccount')->with(compact('cliente', 'title', 'coches'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $cheque = Cheque::find($id);
     $bancos = Banco::all()->lists('nome', 'id');
     $clientes = Cliente::orderBy('fantasia')->get();
     $fornecedores = Fornecedor::orderBy('fantasia')->get();
     if ($cheque->lancamento->status != '2' || $cheque->lancamento->status != '3') {
         return view('cheques.edit', compact('cheque', 'bancos', 'clientes', 'fornecedores'));
     }
     flash('Cheque já está pago');
     return redirect('/cheques');
 }
Example #20
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getClienteIdCliente()
 {
     return $this->hasOne(Cliente::className(), ['idCliente' => 'Cliente_idCliente']);
 }
Example #21
0
 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;
 }
Example #22
0
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();
?>
Example #23
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCliente()
 {
     return $this->hasOne(Cliente::className(), ['id' => 'cliente_did']);
 }
Example #24
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getClientes()
 {
     return $this->hasMany(Cliente::className(), ['estatus_did' => 'id']);
 }
Example #25
0
 public function actionPromissoria2($id, $idvenda)
 {
     //Criação de objetos para a geração do relatório
     $model = Cliente::findOne($id);
     $model2 = Venda::findOne($idvenda);
     //Adicionado Promissoria
     $searchModel2 = new VendaSearch();
     $searchModel2->cliente_idcliente = $id;
     $dataProvider2 = $searchModel2->search(Yii::$app->request->queryParams);
     $content = $this->renderPartial('promissoria', ['model' => $model, 'model2' => $model2, 'dataProvider2' => $dataProvider2]);
     $pdf = new Pdf(['format' => Pdf::FORMAT_A4, 'orientation' => Pdf::ORIENT_PORTRAIT, 'destination' => Pdf::DEST_BROWSER, 'content' => $content, 'cssFile' => '@vendor/kartik-v/yii2-mpdf/assets/kv-mpdf-bootstrap.min.css', 'cssInline' => '.kv-heading-1{font-size:18px}', 'options' => ['title' => 'SGO - Nota Promissória - Cliente'], 'methods' => ['SetHeader' => ['SGO - Nota Promissória - Cliente'], 'SetFooter' => ['{PAGENO}']]]);
     return $pdf->render();
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $boleto = Boleto::find($id);
     $clientes = Cliente::orderBy('fantasia')->get();
     $fornecedores = Fornecedor::orderBy('fantasia')->get();
     $edit = true;
     if ($boleto->lancamento->status == '1') {
         return view('boletos.edit', compact('boleto', 'fornecedores', 'clientes'));
     }
     flash('Boleto já está pago');
     return redirect('/boletos');
 }
Example #27
0
 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();
 }
Example #28
0
/* @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...']);
?>
Example #29
0
 /**
  * Finds the Cliente model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $nome
  * @param string $tel
  * @return Cliente the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($nome, $tel)
 {
     if (($model = Cliente::findOne(['nome' => $nome, 'tel' => $tel])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #30
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getClientes()
 {
     return $this->hasMany(Cliente::className(), ['emp_rut' => 'emp_rut']);
 }