/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $a = $this->loadModel($id); $b = Tallas::model()->findByAttributes(array('id' => $a->id_talla)); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Empleados'], $_POST['Tallas'])) { $a->attributes = $_POST['Empleados']; $b->attributes = $_POST['Tallas']; $valid = $a->validate(); $valid = $b->validate() && $valid; if ($valid) { $b->save(false); $a->id_talla = $b->id; $a->save(false); date_default_timezone_set('America/Caracas'); $auditoria = new Auditoria(); $auditoria->id_user = Yii::app()->user->getId(); $auditoria->accion = 3; $auditoria->modelo = $this->modelo; $auditoria->id_registro = $a->id; $auditoria->fecha = date("Y-m-d h:i:s"); $auditoria->save(false); $this->redirect(array('admin')); } /*if($model->save()) $this->redirect(array('view','id'=>$model->id));*/ } $this->render('update', array('a' => $a, 'b' => $b)); }
public function getShowItem($id) { $art = Items::where('item.id', '=', $id)->first(array('item.*')); $a = new stdClass(); $a->id = $art->id; $a->item_nomb = $art->item_nomb; $a->item_desc = $art->item_desc; $a->item_cod = $art->item_cod; $a->item_precio = $art->item_precio; if (!is_null($art->percent)) { $a->percent = $art->percent; } $a->misc = array(); $a->tallas = array(); $a->colores = array(); //$misc = Misc::where('item_id','=',$art->id)->first(); $misc = Misc::where('item_id', '=', $art->id)->get(); $aux = array(); $i = 0; foreach ($misc as $m) { $aux[$i] = Images::where('misc_id', '=', $m->id)->where('deleted', '=', 0)->get(); $i++; } $a->images = $aux; $t = Misc::where('item_id', '=', $art->id)->groupBy('item_talla')->get(array('item_talla')); $c = Misc::where('item_id', '=', $art->id)->get(array('item_color', 'item_talla')); $a->tallas = $t; $a->colores = $c; $tallas = Tallas::get(); $colores = Colores::get(); $title = $art->item_nomb; if (Auth::check() && Auth::user()->role == 1) { $layout = 'admin'; } else { $layout = 'default'; } $option = array(); $tallas = Tallas::get(); $colores = Colores::get(); return View::make('indexs.artSelf')->with('title', $title)->with('art', $a)->with('layout', $layout)->with('tallas', $tallas)->with('colores', $colores); }
public function getProcesePurchase($id) { $title = "Metodo de pago | Nia Boutique.com"; $fac = Facturas::find($id); $x = FacturaItem::where('factura_id', '=', $id)->sum('item_qty'); $aux = FacturaItem::where('factura_id', '=', $id)->get(array('item_id', 'item_qty', 'item_talla', 'item_color', 'item_precio')); $i = 0; $auxT = 0; $auxQ = 0; $p = ''; foreach ($aux as $a) { $b = Items::where('item.id', '=', $a->item_id)->first(); $p = $p . $b->item_nomb . ', '; $b->qty = $a->item_qty; $b->precio = $a->item_precio; $b->item_talla = Tallas::where('id', '=', $a->item_talla)->pluck('talla_desc'); $b->item_color = Colores::where('id', '=', $a->item_color)->pluck('color_desc'); $auxT = $auxT + $b->qty * $b->item_precio; $auxQ = $auxQ + $b->qty; $aux = Misc::where('item_id', '=', $a->item_id)->where('deleted', '=', 0)->first(); $b->img = Images::where('misc_id', '=', $aux->id)->where('deleted', '=', 0)->first(); $item[$i] = $b; $i++; } $total = 0; $method = 'hola'; $bancos = Bancos::where('deleted', '=', 0)->get(); return View::make('indexs.showCart')->with('title', $title)->with('method', $method)->with('total', $total)->with('items', $item)->with('id', $id)->with('bancos', $bancos); }
static function showTallas() { $tallas = Tallas::where('deleted', '=', 0)->get(); return $tallas; }
public function getNewMisc($id) { $title = "Nueva Caracteristica"; $item = Items::find($id); $misc = Misc::where('item_id', '=', $item->id)->get(); $item->misc = $misc; $cat = Cat::where('deleted', '=', 0)->get(); $tallas = Tallas::where('deleted', '=', 0)->get(); $colors = Colores::where('deleted', '=', 0)->get(); return View::make('admin.newMisc')->with('title', $title)->with('item', $item)->with('cat', $cat)->with('tallas', $tallas)->with('colores', $colors); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Tallas the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Tallas::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }