public function updateCategory()
 {
     $id = Input::get('categ_id_edit');
     $cat = MProdServCat::find($id);
     $cat->strCategName = Input::get('categ_name_edit');
     $cat->strCategDesc = Input::get('categ_desc_edit');
     $cat->strCategType = Input::get('categ_type_edit');
     $cat->save();
     return Redirect::to('/Categories');
 }
 public function maintenanceProduct()
 {
     $ids = DB::table('tblProduct')->select('strProdId')->orderBy('created_at', 'desc')->orderBy('strProdId', 'desc')->take(1)->get();
     $ID = $ids["0"]->strProdId;
     $newID = $this->smart($ID);
     $product = DB::table('tblProduct')->join('tblSupplier', 'tblProduct.strPSupp', '=', 'tblSupplier.strSuppId')->join('tblUOM', 'tblProduct.strPUOM', '=', 'tblUOM.strUOMId')->join('tblProdSerCat', 'tblProduct.strPCategory', '=', 'tblProdSerCat.strCategId')->select('tblProduct.*', 'tblSupplier.strSuppName', 'tblUOM.strUOMDesc', 'tblProdSerCat.strCategName')->get();
     $category = MProdServCat::all();
     $supplier = MSupplier::all();
     $uom = MUOM::all();
     return View::make('productMaintenance')->with('newID', $newID)->with('products', $product)->with('uom', $uom)->with('uom2', $uom)->with('categories', $category)->with('suppliers', $supplier);
 }
 public function maintenanceService()
 {
     $ids = DB::table('tblServ')->select('strServId')->orderBy('created_at', 'desc')->orderBy('strServId', 'desc')->take(1)->get();
     $ID = $ids["0"]->strServId;
     $newID = $this->smart($ID);
     $ids2 = DB::table('tblServPrice')->select('strServPriceId')->orderBy('created_at', 'desc')->orderBy('strServPriceId', 'desc')->take(1)->get();
     $ID2 = $ids2["0"]->strServPriceId;
     $priceID = $this->smart($ID);
     $category = MProdServCat::all();
     $cartype = MCarType::all();
     $products = DB::table('tblProduct')->join('tblUOM', 'tblProduct.strPUOM', '=', 'tblUOM.strUOMId')->select('tblProduct.*', 'tblUOM.strUOMDesc')->get();
     $ids3 = DB::table('tblServProd')->select('strServProd')->orderBy('created_at', 'desc')->orderBy('strServProd', 'desc')->take(1)->get();
     $ID3 = $ids3["0"]->strServProd;
     $spID = $this->smart($ID3);
     $price = DB::table('tblServPrice')->join('tblServ', 'tblServPrice.strSPServ', '=', 'tblServ.strServId')->select('tblServPrice.*')->orderBy('tblServPrice.dtmServPrice', 'asc')->get();
     $var = 0;
     $service = DB::table('tblServ')->join('tblProdSerCat', 'tblServ.strSServCat', '=', 'tblProdSerCat.strCategId')->join('tblCarType', 'tblServ.strSCarType', '=', 'tblCarType.strCarTypeId')->select('tblServ.*', 'tblProdSerCat.strCategName', 'tblCarType.strCarTypeName')->get();
     return View::make('serviceMaintenance')->with('newID', $newID)->with('spID', $spID)->with('categories', $category)->with('cartypes', $cartype)->with('services', $service)->with('servprice', $price)->with('var', $var)->with('priceId', $priceID)->with('product', $products);
 }
 public function maintenancePackage()
 {
     $ctr = 0;
     $ids = DB::table('tblPackage')->select('strPackId')->orderBy('created_at', 'desc')->orderBy('strPackId', 'desc')->take(1)->get();
     $ID = $ids["0"]->strPackId;
     $newID = $this->smart($ID);
     // $ids2 = DB::table('tblPackPrice')
     // 	->select('strPPId')
     // 	->orderBy('created_at', 'desc')
     // 	->orderBy('strPPId', 'desc')
     // 	->take(1)
     // 	->get();
     // $ID2 = $ids["0"]->strPPId;
     // $priceID = $this->smart($ID);
     $package = MPackage::all();
     $servprice = DB::table('tblServPrice')->join('tblServ', 'tblServPrice.strSPServ', '=', 'tblServ.strServId')->select('tblServPrice.*', 'tblServ.strServName')->orderBy('tblServPrice.dtmServPrice', 'asc')->get();
     $packprice = DB::table('tblPackPrice')->join('tblPackage', 'tblPackPrice.strPPPack', '=', 'tblPackage.strPackId')->select('tblPackPrice.*')->orderBy('tblPackPrice.dtmAsOf', 'asc')->get();
     $category = MProdServCat::all();
     $var = 0;
     return View::make('packageMaintenance')->with('newID', $newID)->with('pack', $package)->with('service', $servprice)->with('packprice', $packprice)->with('var', $var)->with('ctr', $ctr)->with('category', $category);
 }