public function getPedidos($id)
 {
     $client = Client::find($id);
     $pedido = Pedido::with('client')->where('client_id', '=', $id)->get();
     //dd($pedido->toArray());
     return view("data_clients.pedidos")->with(array('client' => $client, 'pedido' => $pedido));
     return redirect()->back();
 }
示例#2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Pedido::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(['pedi_codigo' => $this->pedi_codigo, 'pedi_data_criacao' => $this->pedi_data_criacao, 'pedi_data_alteracao' => $this->pedi_data_alteracao, 'clien_codigo' => $this->clien_codigo, 'usua_codigo' => $this->usua_codigo, 'fopa_codigo' => $this->fopa_codigo]);
     return $dataProvider;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Pedido::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(['idPedido' => $this->idPedido, 'cantCajas' => $this->cantCajas, 'cantPallets' => $this->cantPallets, 'RRHH_idRRHH' => $this->RRHH_idRRHH, 'tiporrhh_idTipoRRHH' => $this->tiporrhh_idTipoRRHH, 'Cliente_idCliente' => $this->Cliente_idCliente, 'Fecha' => $this->Fecha, 'Hora' => $this->Hora]);
     return $dataProvider;
 }
示例#4
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Pedido::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(['codigo' => $this->codigo]);
     $query->andFilterWhere(['like', 'cliente_nome', $this->cliente_nome])->andFilterWhere(['like', 'cliente_tel', $this->cliente_tel])->andFilterWhere(['like', 'entregador', $this->entregador])->andFilterWhere(['like', 'situacao_status', $this->situacao_status]);
     return $dataProvider;
 }
示例#5
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Pedido::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(['NUMPEDIDO' => $this->NUMPEDIDO]);
     $query->andFilterWhere(['like', 'NOMBRE', $this->NOMBRE]);
     return $dataProvider;
 }
示例#6
0
 public function cambiar_estado($id)
 {
     $data['pedido'] = Pedido::findOrFail($id);
     $data['titulo'] = 'Cambio de estado del pedido del comprador ' . $data['pedido']->comprador;
     $data['accion'] = ['PedidosController@update_estado', $data['pedido']->id];
     $data['metodo'] = 'PATCH';
     $data['boton'] = 'Guardar';
     $data['cancelar'] = action('PedidosController@index');
     if (\Request::ajax()) {
         $html = view('backend.pedidos.cambiar_estado', $data);
         $response = array("title" => '<span class="glyphicon glyphicon-circle-arrow-up"></span> ' . $data['titulo'], "html" => utf8_encode($html));
         return \Response::json($response);
     } else {
         return view('backend.productos.update_stock', $data);
     }
 }
示例#7
0
 public function search2($params)
 {
     $query = Pedido::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');
         $query->joinWith(['clienteIdCliente']);
         return $dataProvider;
     }
     $query->andFilterWhere(['pedido.owner' => Yii::$app->user->identity->getId(), 'idPedido' => $this->idPedido, 'cliente_idCliente' => $this->cliente_idCliente, 'fechaEntrega' => $this->fechaEntrega, 'fechaOrden' => $this->fechaOrden, 'estado_idEstado' => $this->estado_idEstado]);
     $query->joinWith(['clienteIdCliente' => function ($q) {
         $q->where('cliente.nit LIKE "' . $this->nitCliente . '%"');
     }]);
     return $dataProvider;
 }
 /**
  * Updates an existing Itempedido model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $idPedido
  * @param integer $idProduto
  * @return mixed
  */
 public function actionUpdate($idPedido, $idProduto)
 {
     $model = $this->findModel($idPedido, $idProduto);
     $oldIdProduto = $idProduto;
     $oldQtdProdutoVenda = $model->quantidade;
     $pedidos = ArrayHelper::map(Pedido::find()->all(), 'idPedido', 'idPedido');
     $produtosvenda = ArrayHelper::map(Produto::find()->where(['isInsumo' => 0])->all(), 'idProduto', 'nome');
     if ($model->load(Yii::$app->request->post())) {
         $itempedido = Yii::$app->request->post()['Itempedido'];
         $produtoVenda = Produto::find()->where(['idProduto' => $itempedido['idProduto']])->one();
         $model->total = $produtoVenda->valorVenda * $itempedido['quantidade'];
         $model->save();
         $itempedido = Yii::$app->request->post()['Itempedido'];
         Insumos::atualizaQtdNoEstoqueUpdate($itempedido['idProduto'], $oldIdProduto, $itempedido['quantidade'], $oldQtdProdutoVenda);
         return $this->redirect(['view', 'idPedido' => $model->idPedido, 'idProduto' => $model->idProduto]);
     } else {
         return $this->render('update', ['model' => $model, 'produtosvenda' => $produtosvenda, 'pedidos' => $pedidos]);
     }
 }
 /**
  * Finds the Pedido model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $idPedido
  * @param integer $RRHH_idRRHH
  * @param integer $tiporrhh_idTipoRRHH
  * @param integer $Cliente_idCliente
  * @return Pedido the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($idPedido, $RRHH_idRRHH, $tiporrhh_idTipoRRHH, $Cliente_idCliente)
 {
     if (($model = Pedido::findOne(['idPedido' => $idPedido, 'RRHH_idRRHH' => $RRHH_idRRHH, 'tiporrhh_idTipoRRHH' => $tiporrhh_idTipoRRHH, 'Cliente_idCliente' => $Cliente_idCliente])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#10
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPedidoIdPedido()
 {
     return $this->hasOne(Pedido::className(), ['idPedido' => 'pedido_idPedido']);
 }
示例#11
0
 public static function consultarRegistrosVentasMes($mes)
 {
     $now = new \DateTime();
     $year = $now->format('Y');
     $day = "1";
     $fechai = new \DateTime($year . '-' . $mes . '-' . $day);
     $fechaf = new \DateTime($year . '-' . (intval($mes) + 1) . '-' . $day);
     $fechaf = $fechaf->sub(new \DateInterval('P0Y0M1D'));
     return Pedido::consultarRegistroVentas($fechai->format('Y-m-d'), $fechaf->format('Y-m-d'));
 }
示例#12
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPedidos()
 {
     return $this->hasMany(Pedido::className(), ['situacao_status' => 'status']);
 }
 public function getDatasParaCalculoDeLucro($dataInicio, $dataFinal)
 {
     //Guarda as datas dos Pedidos Concluidos
     $datasPedidosConcluidos = [];
     $pedidosConcluidos = Pedido::find()->joinWith('pagamento')->joinWith('pagamento.contasareceber')->where(['between', 'dataHora', $dataInicio, $dataFinal])->andFilterWhere(['idSituacaoAtual' => 2])->all();
     foreach ($pedidosConcluidos as $pedConc) {
         //Guarda a data do pedido
         $data = date('Y-m-d', strtotime($pedConc['pagamento']['contasareceber']->dataHora));
         if (!in_array($data, $datasPedidosConcluidos)) {
             array_push($datasPedidosConcluidos, $data);
         }
     }
     return $datasPedidosConcluidos;
 }
示例#14
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPedidos()
 {
     return $this->hasMany(Pedido::className(), ['cliente_nome' => 'nome', 'cliente_tel' => 'tel']);
 }
示例#15
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPedidos()
 {
     return $this->hasMany(Pedido::className(), ['estado_idEstado' => 'idEstado']);
 }
示例#16
0
 /**
  * Finds the Pedido model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $idPedido
  * @param integer $cliente_idCliente
  * @param integer $estado_idEstado
  * @return Pedido the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($idPedido, $cliente_idCliente, $estado_idEstado)
 {
     if (($model = Pedido::findOne(['idPedido' => $idPedido, 'cliente_idCliente' => $cliente_idCliente, 'estado_idEstado' => $estado_idEstado])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#17
0
 public function searchItensPedidoViewPedido($idPedido)
 {
     $query = Pedido::find()->joinWith('itempedidos')->joinWith('itempedidos.produto')->where(['pedido.idPedido' => $idPedido])->all();
     // add conditions that should always apply here
     return $query;
 }
示例#18
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPedidos()
 {
     return $this->hasMany(Pedido::className(), ['tiporrhh_idTipoRRHH' => 'idTipoRRHH']);
 }
示例#19
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPedidos()
 {
     return $this->hasMany(Pedido::className(), ['RRHH_idRRHH' => 'idRRHH']);
 }
示例#20
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPedidos()
 {
     return $this->hasMany(Pedido::className(), ['fopa_codigo' => 'fopa_codigo']);
 }
示例#21
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPediCodigo()
 {
     return $this->hasOne(Pedido::className(), ['pedi_codigo' => 'pedi_codigo']);
 }
示例#22
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPedidos()
 {
     return $this->hasMany(Pedido::className(), ['entregador' => 'nome']);
 }
示例#23
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdPedidos()
 {
     return $this->hasMany(Pedido::className(), ['idPedido' => 'idPedido'])->viaTable('itempedido', ['idProduto' => 'idProduto']);
 }
示例#24
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPedidos()
 {
     return $this->hasMany(Pedido::className(), ['idPedido' => 'idPedido'])->viaTable('historicosituacao', ['idSituacaoPedido' => 'idSituacaoPedido']);
 }
 public function make_order(CarritoPedidoRequest $request)
 {
     $input = $request->all();
     $carrito = Cart::content();
     $total = Cart::total();
     $input['estado'] = 0;
     $input['total'] = $total;
     $pedido = Pedido::create($input);
     \Mail::send('emails.carrito.pedido_generado', ['carrito' => $carrito, 'pedido' => $pedido], function ($message) use($pedido) {
         $message->from('*****@*****.**', 'La Previa Delivery');
         $message->to($pedido->email, $pedido)->subject('Pedido generado');
     });
     \Mail::send('emails.carrito.nuevo_pedido', ['carrito' => $carrito, 'pedido' => $pedido], function ($message) use($pedido) {
         $message->from('*****@*****.**', 'La Previa Delivery');
         $message->to('*****@*****.**', $pedido)->subject('NUEVO Penerado');
     });
     Cart::destroy();
     \Session::flash('noticia', 'Pedido generado con &eacute;xito. Muchas gracias ' . $pedido->comprador . ', se le enviar&aacute; un email con los detalles del mismo.');
     return redirect('');
 }
示例#26
0
 /**
  * Finds the Pedido model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Pedido the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Pedido::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#27
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPedidos()
 {
     return $this->hasMany(Pedido::className(), ['Cliente_idCliente' => 'idCliente']);
 }