/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); DB::statement('SET FOREIGN_KEY_CHECKS=0;'); DB::table('divisions')->truncate(); DB::table('categories')->truncate(); DB::table('sub_categories')->truncate(); DB::table('brands')->truncate(); DB::table('skus')->truncate(); $reader = ReaderFactory::create(Type::XLSX); // for XLSX files $filePath = 'database/seeds/seed_files/Items.xlsx'; $reader->open($filePath); foreach ($reader->getSheetIterator() as $sheet) { if ($sheet->getName() == 'SKU Data') { $rowcnt = 0; foreach ($sheet->getRowIterator() as $row) { if ($rowcnt > 1) { if (!is_null($row[0])) { $division = Division::firstOrCreate(['division' => $row[8]]); $category = Category::firstOrCreate(['category_short' => strtoupper($row[1]), 'category_long' => strtoupper($row[0])]); $sub_category = SubCategory::firstOrCreate(['subcategory' => strtoupper($row[6])]); $brand = Brand::firstOrCreate(['brand' => strtoupper($row[7])]); $sku = Sku::firstOrCreate(['division_id' => $division->id, 'category_id' => $category->id, 'sub_category_id' => $sub_category->id, 'brand_id' => $brand->id, 'sku_code' => $row[2], 'item_desc' => $row[3], 'sku_desc' => $row[4], 'conversion' => $row[5]]); } } $rowcnt++; } } } $reader->close(); DB::statement('SET FOREIGN_KEY_CHECKS=1;'); Model::reguard(); }
public function getEdit($id) { $categories = new Category(); $allCategory = $categories->getCategoriesDropDown(); $branches = new Branch(); $branchAll = $branches->getBranchesDropDown(); $subCategories = new SubCategory(); $allSubCategory = $subCategories->getSubCategoriesDropDown(); $products = Product::find($id); return view('Products.edit', compact('branchAll'))->with('products', $products)->with('categoryAll', $allCategory)->with('subCategoryAll', $allSubCategory); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(Request $request) { $subCategory = SubCategory::where('id', $request['subCategoryID'])->first(); $subCategory->name = $request['name']; $subCategory->save(); \Session::flash('success', $request['name'] . ' has been successfully updated!'); return redirect()->back(); }
public function getDelete($id) { $del = SubCategory::find($id); try { $del->delete(); Session::flash('message', 'Sub Category has been Successfully Deleted.'); } catch (Exception $e) { Session::flash('message', 'This Sub Category can\'t delete because it is used to file'); } return Redirect::to('productsubcategories/index'); }
public function getProduct($type) { $branch = Input::get('data'); $productsName = Product::where('product_type', '=', $type)->where('branch_id', '=', $branch)->get(); foreach ($productsName as $productName) { $category = $productName->category->name; if ($productName->sub_category_id) { $subCategory = SubCategory::find($productName->sub_category_id); $subCategoryName = $subCategory->name; } else { $subCategoryName = ''; } echo "<option value = {$productName->id} > {$productName->name} ({$category}) ({$subCategoryName})</option> "; } }
public function getResponders(Request $request) { $subCategory = $request['sub_category']; $objSubCategory = SubCategory::where('slug', '=', $subCategory)->first(); $objCaseResponder = CaseResponder::where('category', '=', $objSubCategory->category)->where('sub_category', '=', $objSubCategory->id)->first(); if ($objCaseResponder->sub_sub_category == 0) { $firstResponders = explode(",", $objCaseResponder->first_responder); $response = array(); foreach ($firstResponders as $firstResponder) { $user = \DB::table('users')->join('departments', 'users.department', '=', 'departments.id')->join('positions', 'users.position', '=', 'positions.id')->where('users.id', '=', $firstResponder)->select(\DB::raw("\n `users`.`id`,\n `users`.`email`,\n (select CONCAT(`users`.`name`, ' ',`users`.`surname`) ) as names,\n `departments`.`name` as department,\n `positions`.`name` as position\n\n "))->first(); $response[] = $user; } return $response; } }
public function getProducts($type) { $productsName = Product::where('product_type', '=', $type)->where('branch_id', '=', Input::get('data'))->get(); $product_id = Input::get('data'); foreach ($productsName as $productName) { $category = $productName->category->name; if ($productName->sub_category_id) { $subCategory = SubCategory::find($productName->sub_category_id); $subCategoryName = $subCategory->name; } else { $subCategoryName = ''; } if ($productName->id == $product_id) { echo '<option value = "' . $productName->id . '" selected> ' . $productName->name . ' (' . $category . ') (' . $subCategoryName . ')</option> '; } else { echo "<option value = {$productName->id} > {$productName->name} ({$category}) ({$subCategoryName})</option> "; } } }
if ($from == 'category') { $object = Category::where('slug', '=', $name)->first(); $listing = DB::table('sub_categories')->where('category', '=', $object->id)->lists('name', 'slug'); } if ($from == 'sub_category') { $object = SubCategory::where('slug', '=', $name)->first(); $listing = DB::table('sub_sub_categories')->where('sub_category', '=', $object->id)->lists('name', 'slug'); } return $listing; }); Route::get('/api/dropdownCategory/{to}/{from}', function ($to, $from) { $name = Input::get('option'); if ($from == 'category') { $object = Category::where('slug', '=', $name)->first(); } else { $object = SubCategory::where('slug', '=', $name)->first(); } if ($from == 'category') { $listing = DB::table('sub-categories')->where('category', '=', $object->id)->lists('name', 'slug'); } else { $listing = DB::table('sub-sub-categories')->where('sub_category', '=', $object->id)->lists('name', 'slug'); } return $listing; }); Route::post('postChat', ['middleware' => 'auth', 'uses' => 'ChatController@postChat']); Event::listen('auth.login', function () { $user = User::find(\Auth::user()->id); $user->availability = 1; $user->last_login = new DateTime(); $user->save(); });
<th>Product Name</th> <th>Stock Name</th> <th>Entry Type</th> <th>Quantity</th> <th>Remarks</th> <th>Consignment Name</th> </tr> </thead> <tbody> @foreach($results as $result ) <?php $categoryName = \App\Category::find($result->cid); $subCategoryName = \App\SubCategory::find($result->sid); ?> <tr class="odd gradeX"> <td>{{$result->pName.'('.$categoryName->name.')'.'('.$subCategoryName->name.')'}}</td> <td>{{$result->sName}}</td> <td>{{$result->entry_type}}</td> <td>{{$result->product_quantity}}</td> <td>{{$result->remarks}}</td> <td>{{$result->consignment_name}}</td> </tr> @endforeach </tbody> </table> @else
public static function getList() { return SubCategory::all()->toArray(); }
private function stockDetailConvertToArray($stockDetails) { $array = array(); $stockName = StockInfo::find($stockDetails->stock_info_id); $tostockName = StockInfo::find($stockDetails->to_stock_info_id); //var_dump($stockDetails->to_stock_info_id); die(); $branchName = Branch::find($stockDetails->branch_id); $array['id'] = $stockDetails->id; $array['branch_id'] = $branchName->name; $array['stock_info_id'] = $stockName->name; $array['product_type'] = $stockDetails->product_type; $productsName = Product::find($stockDetails->product_id); $category = $productsName->category->name; $subCategoryName = ''; if ($productsName->sub_category_id) { $subCategory = SubCategory::find($productsName->sub_category_id); $subCategoryName = '(' . $subCategory->name . ')'; } $array['product_id'] = $stockDetails->product->name . ' (' . $category . ') ' . $subCategoryName; if ($tostockName != null) { $array['to_stock_info_id'] = $tostockName->name; } $array['entry_type'] = $stockDetails->entry_type; $array['product_quantity'] = $stockDetails->quantity; $array['remarks'] = $stockDetails->remarks; $array['consignment_name'] = $stockDetails->consignment_name; return $array; }
<th>Total Sale</th> </tr> </thead> <tbody> <?php $totalSale = 0; $invoiceSave = array(); ?> @foreach($results as $result ) <?php $products = \App\Product::find($result->product_id); $stocks = \App\StockInfo::find($result->stock); $categories = \App\Category::find($result->category_id); $subCategories = \App\SubCategory::find($result->sub_category_id); if ($result->sub_category_id) { $subCategoryName = '(' . $subCategories->name . ')'; } else { $subCategoryName = ''; } ?> <tr class="odd gradeX"> <td> @if(in_array($result->invoice,$invoiceSave)) @else <a target="_blank" href="{{URL::to('sales?invoice_id='.$result->invoice)}}">{{$result->invoice}}</a> @endif </td>
public function getProducts($branch_id) { $poductsNames = Product::where('branch_id', '=', $branch_id)->get(); foreach ($poductsNames as $product) { $category = $product->category->name; if ($product->sub_category_id) { $subCategory = SubCategory::find($product->sub_category_id); $subCategoryName = '(' . $subCategory->name . ')'; } else { $subCategoryName = ''; } echo "<option value = {$product->id} > {$product->name} ({$category}) {$subCategoryName}</option> "; } }
<th>Category Name</th> <th>Sub-Category Name</th> <th>Total Quantity On Hand</th> </tr> </thead> <tbody> <?php $grandTotal = 0; ?> @foreach($results as $result ) <?php $pName = \App\Product::find($result->product_id); $categoryName = \App\Category::find($pName->category_id); $subCategoryName = \App\SubCategory::find($pName->sub_category_id); $grandTotal = $grandTotal + $result->product_quantity; ?> <tr class="odd gradeX"> <td>{{$pName->name}}</td> <td>{{$categoryName->name}}</td> <td>{{$subCategoryName->name}}</td> <td>{{$result->product_quantity}}</td> </tr> @endforeach <tr> <td>Total</td>
public function deleteSubCategory($id) { $sub_category = \App\SubCategory::findOrFail($id); $sub_category->delete(); return redirect("admin/sub_categories")->with('success', 'Sub Category deleted successfully!'); }
<th>Remarks</th> <th>Action</th> </tr> </thead> <tbody> <?php $total = 0; ?> @foreach($purchaseInvoiceDetails as $purchaseInvoiceDetail ) <?php $stocks = new \App\StockInfo(); $branch = new \App\Branch(); $stockName = \App\StockInfo::find($purchaseInvoiceDetail->stock_info_id); $branchName = \App\Branch::find($purchaseInvoiceDetail->branch_id); $categoryName = \App\Category::find($purchaseInvoiceDetail->product->category_id); $subCategoryName = \App\SubCategory::find($purchaseInvoiceDetail->product->sub_category_id); ?> <tr class="odd gradeX"> <td>{{$branchName->name}}</td> <td>{{$stockName->name}}</td> <td>{{$purchaseInvoiceDetail->product_type}}</td> <td>{{$purchaseInvoiceDetail->product->name.'('.$categoryName->name.')'.'('.$subCategoryName->name.')'}}</td> <td>{{$purchaseInvoiceDetail->price}}</td> <td>{{$purchaseInvoiceDetail->quantity}}</td> <td>{{$purchaseInvoiceDetail->quantity * $purchaseInvoiceDetail->price}}</td> <td> @if($purchaseInvoiceDetail->remarks) {{ $purchaseInvoiceDetail->remarks }} @else {{"Not Available"}} @endif
public function getProducts($category) { $productsNames = Product::where('category_id', '=', $category)->get(); foreach ($productsNames as $productName) { $category = Category::find($productName->category_id); if ($productName->sub_category_id) { $subCategory = SubCategory::find($productName->sub_category_id); $subCategoryName = $subCategory->name; } else { $subCategoryName = ''; } echo "<option value = {$productName->id} > {$productName->name} ({$category->name}) ({$subCategoryName})</option> "; } }
/** * Bootstrap any application services. * * @return void */ public function boot() { if (\Schema::hasTable('positions')) { $positions = Position::orderBy('name', 'ASC')->get(); $selectPositions = array(); $selectPositions[0] = "Select / All"; foreach ($positions as $position) { $selectPositions[$position->slug] = $position->name; } \View::share('selectPositions', $selectPositions); } if (\Schema::hasTable('departments')) { $departments = Department::orderBy('name', 'ASC')->get(); $selectDepartments = array(); $selectDepartments[0] = "Select / All"; foreach ($departments as $department) { $selectDepartments[$department->slug] = $department->name; } \View::share('selectDepartments', $selectDepartments); } if (\Schema::hasTable('provinces')) { $provinces = Province::all(); $selectProvinces = array(); $selectProvinces[0] = "Select / All"; foreach ($provinces as $Province) { $selectProvinces[$Province->slug] = $Province->name; } \View::share('selectProvinces', $selectProvinces); } if (\Schema::hasTable('districts')) { $districts = District::all(); $selectDistrict = array(); $selectDistricts[0] = "Select / All"; foreach ($districts as $district) { $selectDistricts[$district->slug] = $district->name; } \View::share('selectDistricts', $selectDistricts); } if (\Schema::hasTable('municipalities')) { $municipalities = Municipality::all(); $selectMunicipalities = array(); $selectMunicipalities[0] = "Select / All"; foreach ($municipalities as $municipality) { $selectMunicipalities[$municipality->slug] = $municipality->name; } \View::share('selectMunicipalities', $selectMunicipalities); } if (\Schema::hasTable('categories')) { $categories = Category::all(); $selectCategories = array(); $selectCategories[0] = "Select / All"; foreach ($categories as $category) { $selectCategories[$category->slug] = $category->name; } \View::share('selectCategories', $selectCategories); } if (\Schema::hasTable('sub-categories')) { $subCategories = SubCategory::all(); $selectSubCategories = array(); $selectSubCategories[0] = "Select / All"; foreach ($subCategories as $subCategory) { $selectSubCategories[$subCategory->slug] = $subCategory->name; } \View::share('selectSubCategories', $selectSubCategories); } if (\Schema::hasTable('sub-sub-categories')) { $subSubCategories = SubSubCategory::all(); $selectSubSubCategories = array(); $selectSubSubCategories[0] = "Select / All"; foreach ($subSubCategories as $subSubCategory) { $selectSubSubCategories[$subSubCategory->slug] = $subSubCategory->name; } \View::share('selectSubSubCategories', $selectSubSubCategories); } if (\Schema::hasTable('relationships')) { $relationships = Relationship::all(); $selectRelationships = array(); $selectRelationships[0] = "Select / All"; foreach ($relationships as $relationship) { $selectRelationships[$relationship->id] = $relationship->name; } \View::share('selectRelationships', $selectRelationships); } if (\Schema::hasTable('cases')) { $cases = \DB::table('cases')->join('users', 'cases.reporter', '=', 'users.id')->select(\DB::raw("\n IF(`cases`.`addressbook` = 1,(SELECT CONCAT(`FirstName`, ' ', `Surname`) FROM `addressbook` WHERE `addressbook`.`id`= `cases`.`reporter`), (SELECT CONCAT(users.`name`, ' ', users.`surname`) FROM `users` WHERE `users`.`id`= `cases`.`reporter`)) as reporterName\n\n "))->get(); $reporters = array(); $reporters[0] = "Select / All"; foreach ($cases as $case) { $reporters[$case->reporterName] = $case->reporterName; } \View::share('selectReporters', $reporters); } View()->composer('master', function ($view) { $view->with('addressBookNumber', addressbook::all()); if (\Auth::check()) { $number = addressbook::where('user', '=', \Auth::user()->id)->get(); $view->with('addressBookNumber', $number); $allUsers = User::where('id', '<>', \Auth::user()->id)->get(); $view->with('loggedInUsers', $allUsers); $noPrivateMessages = Message::where('to', '=', \Auth::user()->id)->where('read', '=', 0)->where('online', '=', 0)->get(); $view->with('noPrivateMessages', $noPrivateMessages); $noInboxMessages = Message::where('to', '=', \Auth::user()->id)->where('online', '=', 0)->get(); $view->with('noInboxMessages', $noInboxMessages); } }); }
<th>Quantity</th> <th>Discount Percentage </th> <th style="text-align: right;">Return Amount</th> </tr> </thead> <tbody> <?php $total = 0; ?> @foreach($results as $result ) <?php $products = \App\Product::find($result->product_id); $categories = \App\Category::find($products->category_id); $subCategories = \App\SubCategory::find($products->sub_category_id); if ($products->sub_category_id) { $subCategoryName = '(' . $subCategories->name . ')'; } else { $subCategoryName = ''; } ?> <tr class="odd gradeX"> <td>{{\App\Transaction::convertDate($result->date)}}</td> <td>{{$result->invoice_id}}</td> <td>{{$products->name.'('.$categories->name.')'.$subCategoryName}}</td> <td>{{$result->unit_price}}</td> <td>{{$result->quantity}}</td> <td>{{$result->discount_percentage}}</td> <td style="text-align: right;">{{$result->return_amount }}</td>
public function storeSubCategory() { $input = Input::all(); $validate = Validator::make(Input::all(), ['category_id' => 'required', 'name' => 'required', 'liter_per_item' => 'required|numeric', 'alcohol_content_per_item' => 'required|numeric']); if (!$validate->fails()) { $sub_category = new \App\SubCategory(); $sub_category->category_id = Input::get('category_id'); $sub_category->name = Input::get('name'); $sub_category->description = Input::get('description'); $sub_category->liter_per_item = Input::get('liter_per_item'); $sub_category->alcohol_content_per_item = Input::get('alcohol_content_per_item'); $sub_category->save(); return redirect("admin/sub_categories")->with('success', 'Sub Category added successfully!'); } else { return Redirect::back()->with('error', 'Error: Invalid data'); } }
/** * Bootstrap any application services. * * @return void */ public function boot() { if (\Schema::hasTable('positions')) { $positions = Position::all(); $selectPositions = array(); $selectPositions[0] = "Select / All"; foreach ($positions as $position) { $selectPositions[$position->slug] = $position->name; } \View::share('selectPositions', $selectPositions); } if (\Schema::hasTable('cases_priorities')) { $priorities = CasePriority::all(); $selectPriorities = array(); $selectPriorities[0] = "Select / All"; foreach ($priorities as $priority) { $selectPriorities[$priority->slug] = $priority->name; } \View::share('selectPriorities', $selectPriorities); } if (\Schema::hasTable('titles')) { $titles = Title::all(); $selectTitles = array(); $selectTitles[0] = "Select / All"; foreach ($titles as $title) { $selectTitles[$title->slug] = $title->name; } \View::share('selectTitles', $selectTitles); } if (\Schema::hasTable('languages')) { $languages = Language::all(); $selectLanguages = array(); $selectLanguages[0] = "Select / All"; foreach ($languages as $language) { $selectLanguages[$language->slug] = $language->name; } \View::share('selectLanguages', $selectLanguages); } if (\Schema::hasTable('departments')) { $departments = Department::all(); $selectDepartments = array(); $selectDepartments[0] = "Select / All"; foreach ($departments as $department) { $selectDepartments[$department->slug] = $department->name; } \View::share('selectDepartments', $selectDepartments); } if (\Schema::hasTable('users_roles')) { $roles = UserRole::all(); $selectRoles = array(); $selectRoles[0] = "Select / All"; foreach ($roles as $role) { $selectRoles[$role->slug] = $role->name; } \View::share('selectRoles', $selectRoles); } if (\Schema::hasTable('provinces')) { $provinces = Province::all(); $selectProvinces = array(); $selectProvinces[0] = "Select / All"; foreach ($provinces as $Province) { $selectProvinces[$Province->slug] = $Province->name; } \View::share('selectProvinces', $selectProvinces); } if (\Schema::hasTable('districts')) { $districts = District::all(); $selectDistrict = array(); $selectDistricts[0] = "Select / All"; foreach ($districts as $district) { $selectDistricts[$district->slug] = $district->name; } \View::share('selectDistricts', $selectDistricts); } if (\Schema::hasTable('municipalities')) { $municipalities = Municipality::all(); $selectMunicipalities = array(); $selectMunicipalities[0] = "Select / All"; foreach ($municipalities as $municipality) { $selectMunicipalities[$municipality->slug] = $municipality->name; } \View::share('selectMunicipalities', $selectMunicipalities); } if (\Schema::hasTable('wards')) { $wards = Ward::all(); $selectWards = array(); $selectWards[0] = "Select / All"; foreach ($wards as $ward) { $selectWards[$ward->slug] = $ward->name; } \View::share('selectWards', $selectWards); } if (\Schema::hasTable('categories')) { $categories = Category::all(); $selectCategories = array(); $selectCategories[0] = "Select / All"; foreach ($categories as $category) { $selectCategories[$category->slug] = $category->name; } \View::share('selectCategories', $selectCategories); } if (\Schema::hasTable('sub_categories')) { $subCategories = SubCategory::all(); $selectSubCategories = array(); $selectSubCategories[0] = "Select / All"; foreach ($subCategories as $subCategory) { $selectSubCategories[$subCategory->slug] = $subCategory->name; } \View::share('selectSubCategories', $selectSubCategories); } if (\Schema::hasTable('sub_sub_categories')) { $subSubCategories = SubSubCategory::all(); $selectSubSubCategories = array(); $selectSubSubCategories[0] = "Select / All"; foreach ($subSubCategories as $subSubCategory) { $selectSubSubCategories[$subSubCategory->slug] = $subSubCategory->name; } \View::share('selectSubSubCategories', $selectSubSubCategories); } if (\Schema::hasTable('relationships')) { $relationships = Relationship::all(); $selectRelationships = array(); $selectRelationships[0] = "Select / All"; foreach ($relationships as $relationship) { $selectRelationships[$relationship->id] = $relationship->name; } \View::share('selectRelationships', $selectRelationships); } if (\Schema::hasTable('cases')) { $cases = \DB::table('cases')->join('users', 'cases.reporter', '=', 'users.id')->select(\DB::raw("\n IF(`cases`.`addressbook` = 1,(SELECT CONCAT(`first_name`, ' ', `surname`) FROM `addressbook` WHERE `addressbook`.`id`= `cases`.`reporter`), (SELECT CONCAT(users.`name`, ' ', users.`surname`) FROM `users` WHERE `users`.`id`= `cases`.`reporter`)) as reporterName\n\n "))->get(); $reporters = array(); $reporters[0] = "Select / All"; foreach ($cases as $case) { $reporters[$case->reporterName] = $case->reporterName; } \View::share('selectReporters', $reporters); } View()->composer('master', function ($view) { $view->with('addressBookNumber', addressbook::all()); if (\Auth::check()) { $number = addressbook::where('user', '=', \Auth::user()->id)->get(); $view->with('addressBookNumber', $number); $allUsers = User::where('id', '<>', \Auth::user()->id)->get(); $view->with('loggedInUsers', $allUsers); $noPrivateMessages = Message::where('to', '=', \Auth::user()->id)->where('read', '=', 0)->where('message_type', '=', 0)->get(); $view->with('noPrivateMessages', $noPrivateMessages); $noInboxMessages = Message::where('to', '=', \Auth::user()->id)->where('message_type', '=', 0)->get(); $view->with('noInboxMessages', $noInboxMessages); $noDepartments = Department::all(); $view->with('noDepartments', $noDepartments); $noUsers = User::all(); $view->with('noUsers', $noUsers); $noRoles = UserRole::all(); $view->with('noRoles', $noRoles); $noPositions = Position::all(); $view->with('noPositions', $noPositions); $noRelationships = Relationship::all(); $view->with('noRelationships', $noRelationships); $noProvinces = Province::all(); $view->with('noProvinces', $noProvinces); $noCaseStatuses = CaseStatus::all(); $view->with('noCaseStatuses', $noCaseStatuses); $userRole = UserRole::where('id', '=', \Auth::user()->role)->first(); $view->with('systemRole', $userRole); $noCasesPriorities = CasePriority::all(); $view->with('noCasesPriorities', $noCasesPriorities); } }); }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function captureCase(Request $request) { $reporter = $request['caseReporter']; $caseSeverity = $request['caseSeverity']; $userObj = User::where('username', '=', $reporter)->first(); if (sizeof($userObj) <= 0) { $userAddressbookObj = addressbook::where('email', '=', $reporter)->first(); } $user = sizeof($userObj) <= 0 ? $userAddressbookObj->id : $userObj->id; $addressbook = sizeof($userObj) <= 0 ? 1 : 0; $userName = sizeof($userObj) <= 0 ? $userAddressbookObj->FirstName : $userObj->name; $userSurname = sizeof($userObj) <= 0 ? $userAddressbookObj->Surname : $userObj->surname; $userEmail = sizeof($userObj) <= 0 ? $userAddressbookObj->email : $userObj->username; $cell = sizeof($userObj) <= 0 ? $userAddressbookObj->cellphone : $userObj->email; $caseDescription = $request['caseDescription']; $precinctObj = Municipality::where('slug', '=', $request['caseMunicipality'])->first(); $categoryObj = Category::where('slug', '=', $request['caseCategory'])->first(); $subCategoryObj = SubCategory::where('slug', '=', $request['caseSubCategory'])->first(); if ($request['caseSubSubCategory'] > 0) { $subSubCategoryObj = SubSubCategory::where('slug', '=', $request['caseSubSubCategory'])->first(); $subSubCategory = $subSubCategoryObj->id; } else { $subSubCategory = 0; } $gps = explode(",", $request['GPS']); $caseObj = new CaseReport(); $caseObj->description = htmlentities($caseDescription); $caseObj->user = \Auth::user()->id; $caseObj->reporter = $user; $caseObj->addressbook = $addressbook; $caseObj->precinct = $precinctObj->id; $caseObj->category = $categoryObj->id; $caseObj->sub_category = $subCategoryObj->id; $caseObj->sub_sub_category = $subSubCategory; $caseObj->gps_lat = $gps[0]; $caseObj->gps_lng = $gps[1]; $caseObj->severity = $caseSeverity; $caseObj->status = "Pending"; $caseObj->save(); $data = array('name' => $userName, 'caseID' => $caseObj->id, 'caseDesc' => $caseObj->description); $caseOwner = new CaseOwner(); $caseOwner->user = $user; $caseOwner->caseId = $caseObj->id; $caseOwner->type = 0; $caseOwner->active = 1; $caseOwner->save(); \Mail::send('emails.sms', $data, function ($message) use($userEmail) { $message->from('*****@*****.**', 'Siyaleader'); $message->to($userEmail)->subject("Siyaleader Notification - New Case Reported:"); }); if ($caseSeverity <= 4) { $severityData = array('severity' => $caseObj->severity, 'name' => $userName . ' ' . $userSurname, 'cell' => $cell, 'category' => $categoryObj->name, 'caseId' => $caseObj->id); \Mail::send('emails.severity', $severityData, function ($message) { $message->from('*****@*****.**', 'Siyaleader'); $message->to('*****@*****.**')->subject("SEVERE"); }); $criticalTeam = CriticalTeam::all(); foreach ($criticalTeam as $critical) { $caseOwner = new CaseOwner(); $caseOwner->user = $critical->user; $caseOwner->caseId = $caseObj->id; $caseOwner->type = 5; //Critical Team $caseOwner->active = 1; $caseOwner->save(); \Mail::send('emails.severity', $severityData, function ($message) use($critical) { $userObj = User::find($critical->user); $message->from('*****@*****.**', 'Siyaleader'); $message->to($userObj->username)->subject("Siyaleader Notification - New Severe Case Reported:"); }); } } if ($subSubCategory > 0) { $subSubCatResponders = CaseResponder::where('sub_sub_category', '=', $subSubCategory)->first(); if (sizeof($subSubCatResponders) > 0) { if ($subSubCatResponders->firstResponder) { $firstResponderUser = User::find($subSubCatResponders->firstResponder); $caseOwner = new CaseOwner(); $caseOwner->user = $subSubCatResponders->firstResponder; $caseOwner->caseId = $caseObj->id; $caseOwner->type = 1; $caseOwner->active = 1; $caseOwner->save(); $data = array('name' => $firstResponderUser->name, 'caseID' => $caseObj->id, 'caseDesc' => $caseObj->description, 'caseReporter' => $caseObj->description); \Mail::send('emails.responder', $data, function ($message) use($firstResponderUser) { $message->from('*****@*****.**', 'Siyaleader'); $message->to($firstResponderUser->username)->subject("Siyaleader Notification - New Case Reported:"); }); } if ($subSubCatResponders->secondResponder) { $secondResponderUser = User::find($subSubCatResponders->secondResponder); $caseOwner = new CaseOwner(); $caseOwner->user = $subSubCatResponders->secondResponder; $caseOwner->caseId = $caseObj->id; $caseOwner->type = 2; $caseOwner->active = 1; $caseOwner->save(); $data = array('name' => $secondResponderUser->name, 'caseID' => $caseObj->id, 'caseDesc' => $caseObj->description, 'caseReporter' => $caseObj->description); \Mail::send('emails.responder', $data, function ($message) use($secondResponderUser) { $message->from('*****@*****.**', 'Siyaleader'); $message->to($secondResponderUser->username)->subject("Siyaleader Notification - New Case Reported:"); }); } if ($subSubCatResponders->thirdResponder) { $thirdResponderUser = User::find($subSubCatResponders->thirdResponder); $caseOwner = new CaseOwner(); $caseOwner->user = $subSubCatResponders->thirdResponder; $caseOwner->caseId = $caseObj->id; $caseOwner->type = 3; $caseOwner->active = 1; $caseOwner->save(); $data = array('name' => $thirdResponderUser->name, 'caseID' => $caseObj->id, 'caseDesc' => $caseObj->description, 'caseReporter' => $caseObj->description); \Mail::send('emails.responder', $data, function ($message) use($thirdResponderUser) { $message->from('*****@*****.**', 'Siyaleader'); $message->to($thirdResponderUser->username)->subject("Siyaleader Notification - New Case Reported:"); }); } } } if ($subSubCategory == 0) { $subCatResponders = CaseResponder::where('sub_category', '=', $subCategoryObj->id)->first(); if (sizeof($subCatResponders) > 0) { if ($subCatResponders->firstResponder) { $firstResponderUser = User::find($subCatResponders->firstResponder); $caseOwner = new CaseOwner(); $caseOwner->user = $subCatResponders->firstResponder; $caseOwner->caseId = $caseObj->id; $caseOwner->type = 1; $caseOwner->active = 1; $caseOwner->save(); $data = array('name' => $firstResponderUser->name, 'caseID' => $caseObj->id, 'caseDesc' => $caseObj->description, 'caseReporter' => $caseObj->description); \Mail::send('emails.responder', $data, function ($message) use($firstResponderUser) { $message->from('*****@*****.**', 'Siyaleader'); $message->to($firstResponderUser->username)->subject("Siyaleader Notification - New Case Reported:"); }); } if ($subCatResponders->secondResponder) { $secondResponderUser = User::find($subCatResponders->secondResponder); $caseOwner = new CaseOwner(); $caseOwner->user = $subCatResponders->secondResponder; $caseOwner->caseId = $caseObj->id; $caseOwner->type = 2; $caseOwner->active = 1; $caseOwner->save(); $data = array('name' => $secondResponderUser->name, 'caseID' => $caseObj->id, 'caseDesc' => $caseObj->description, 'caseReporter' => $caseObj->description); \Mail::send('emails.responder', $data, function ($message) use($secondResponderUser) { $message->from('*****@*****.**', 'Siyaleader'); $message->to($secondResponderUser->username)->subject("Siyaleader Notification - New Case Reported:"); }); } if ($subCatResponders->thirdResponder) { $thirdResponderUser = User::find($subCatResponders->thirdResponder); $caseOwner = new CaseOwner(); $caseOwner->user = $subCatResponders->thirdResponder; $caseOwner->caseId = $caseObj->id; $caseOwner->type = 3; $caseOwner->active = 1; $caseOwner->save(); $data = array('name' => $thirdResponderUser->name, 'caseID' => $caseObj->id, 'caseDesc' => $caseObj->description, 'caseReporter' => $caseObj->description); \Mail::send('emails.responder', $data, function ($message) use($thirdResponderUser) { $message->from('*****@*****.**', 'Siyaleader'); $message->to($thirdResponderUser->username)->subject("Siyaleader Notification - New Case Reported:"); }); } } } return redirect()->back(); }
<th class="numeric">Issued</th> <th class="numeric">Remaining</th> <th>Remarks</th> <th>Created By</th> <!-- <th>Status</th>--> <th>Action</th> </tr> </thead> <tbody> <?php $sl = 1; ?> @foreach($requisitions as $requisition ) <?php $branchName = \App\Branch::find($requisition->branch_id); $subCategory = \App\SubCategory::find($requisition->product->sub_category_id); $subCategoryName = '(' . $subCategory->name . ')'; ?> <tr class="odd gradeX"> <td><?php echo $sl; ?> </td> <td>{{$branchName->name}}</td> <td>{{$requisition->product->name."(".$requisition->product->category->name.")".$subCategoryName}}</td> <td>{{$requisition->party->name}}</td> <td>{{$requisition->requisition_id}}</td> <td class="numeric">{{$requisition->requisition_quantity}}</td> <td class="numeric">{{$requisition->issued_quantity}}</td> <td class="numeric">{{$requisition->requisition_quantity-$requisition->issued_quantity}}</td> <td>{{$requisition->remarks}}</td>
public function ShowSubCategoryItems($id) { $data['slider'] = Slide::orderBy('created_at', 'asc')->get(); $data['sideslider'] = SideSlider::orderBy('created_at', 'asc')->get(); $data['partner'] = Partner::orderBy('created_at', 'asc')->get(); $data['category'] = Category::with('SubCategory')->orderBy('created_at', 'asc')->get(); $data['categoryex'] = Category::findOrFail($id); $data['categoryex'] = Category::with('SubCategory')->findOrFail($id); $data['subcategory'] = SubCategory::findOrFail($id); $data['item'] = Items::where('subcategory_id', $id)->orderBy('created_at', 'asc')->paginate(12); return view('site.category-item-list', $data); }
public function child_category($slug) { $category = SubSubCategory::where('slug', '=', $slug)->first(); $keyword = Input::has('keyword') ? Input::get('keyword') : null; $cat_id = $category->category_id; $sub_cat_id = $category->sub_category_id; $main_cat = Category::where('id', '=', $cat_id)->first(); $sub_cat = SubCategory::where('id', '=', $sub_cat_id)->first(); if ($category === null) { return redirect('/search'); } else { $products = $this->searchProduct(null, null, $slug); //$products = Product::where('sub_sub_category_id', $category->id)->paginate(12); return view('search.search', compact('products', 'category', 'main_cat', 'sub_cat', 'keyword')); } }
<th>Category</th> <th>Sub Category</th> <th>Total Qty</th> <th>Created By</th> <th>Action</th> </tr> </thead> <tbody> <?php $sl = 1; ?> @foreach($products as $product ) <?php $subCategoryName = \App\SubCategory::find($product->sub_category_id); ?> <tr class="odd gradeX"> <td><?php echo $sl; ?> </td> <td>{{$product->name}}</td> <td>{{$product->branch->name}}</td> <td>{{$product->category->name}}</td> @if($product->sub_category_id == 0) <td>N/A</td> @else <td>{{$subCategoryName->name}}</td> @endif
<th>#</th> <th>Product</th> <th class="hidden-480">Description</th> <th style="text-align: right;" class="hidden-480">Quantity</th> </tr> </thead> <tbody> <?php $i = 1; $total = 0; ?> @foreach($saleDetails as $saleDetail ) <?php $products = \App\Product::find($saleDetail->product_id); $categoryName = \App\Category::find($saleDetail->product->category_id); $subCategoryName = \App\SubCategory::find($saleDetail->product->sub_category_id); ?> <tr> <td>{{$i}}</td> <td>{{$saleDetail->product->name.'('.$categoryName->name.')'.'('.$subCategoryName->name.')'}}</td> <td>{{$products->origin}}</td> <td style="text-align: right;">{{$saleDetail->quantity}}</td> </tr> @endforeach </tbody> </table> <div class="row">
$totalDuty = 0; $totalLandingCost = 0; ?> @foreach($imports as $importt ) <tr class="odd gradeX"> <?php $value = $importt->po_cash * 100 / ($grandTotalCrf * $importt->dollar_to_bd_rate); $duty = $importt->total_cfr_price * $importt->dollar_to_bd_rate * $value / 100; $totalQuantity = $totalQuantity + $importt->quantity; $totalBookingPrice = $totalBookingPrice + $importt->total_booking_price * $importt->quantity; $totalCrfPrice = $totalCrfPrice + $importt->total_cfr_price * $importt->quantity; $totalDuty = $totalDuty + $duty * $importt->quantity; $landingCost = ($ttCharge[0]['tt_charge'] + $totalBankCost[0]['total_bank_cost'] + $totalCnfCost[0]['total_cnf_cost']) / $totalQuantitySum + $importt->total_booking_price * $importt->dollar_to_bd_rate + $duty; $totalLandingCost = $totalLandingCost + $landingCost * $importt->quantity; $categoryName = \App\Category::find($importt->category_id); $subCategoryName = \App\SubCategory::find($importt->sub_category_id); ?> <td>{{ $i }}</td> <td>{{ $importt->name.'('.$categoryName->name.')'.'('.$subCategoryName->name.')' }}</td> <td style="text-align: right;">{{ $importt->total_booking_price }}</td> <td style="text-align: right;">{{ $importt->total_booking_price * $importt->dollar_to_bd_rate }}</td> <td style="text-align: right;">{{ $importt->total_cfr_price }}</td> <td style="text-align: right;">{{ $importt->total_cfr_price * $importt->dollar_to_bd_rate }}</td> <td style="text-align: right;">{{ $importt->quantity }}</td> <td style="text-align: right;">{{ round($duty,2) }}</td> <td style="text-align: right;">{{ round($landingCost,2) }}</td> <td style="text-align: right;">{{ $importt->quantity * $importt->total_booking_price }}</td> <td style="text-align: right;">{{ $importt->quantity * $importt->total_cfr_price }}</td> <td style="text-align: right;">{{ round($duty * $importt->quantity,2) }}</td> <td style="text-align: right;">{{ round($landingCost * $importt->quantity,2)}}</td>
</thead> <tbody> <?php $grandTotalStockIn = 0; $grandTotalStockOut = 0; $grandTotalStockWastage = 0; $grandTotalStockBf = 0; $grandTotalStockInBf = 0; $grandTotalBalance = 0; ?> @foreach($results as $result ) <?php $stocks = new \App\Report(); $sub_category = new \App\SubCategory(); $sub_categoryName = \App\SubCategory::find($result->subCategory); $bfIn = $stocks->getStockBf($product_type, $date1, $result->product_id); $bfOut = $stocks->getStockBfOut($product_type, $date1, $result->product_id); $stockIn = $stocks->getStockIn($product_type, $date1, $date2, $result->product_id); $stockOut = $stocks->getStockOut($product_type, $date1, $date2, $result->product_id); $wastage = $stocks->getStockWastage($product_type, $date1, $date2, $result->product_id); $bf = $bfIn[0]->stockBf - $bfOut[0]->stockBfOut; $totalIn = $bf + $stockIn[0]->stockIn; $balance = $totalIn - $stockOut[0]->stockOut; ?> <tr class="odd gradeX"> <td>{{$result->pName.'('.$result->category.')'.'('.$sub_categoryName->name.')'}}</td> <td style="text-align: right;">@if($stockIn[0]->stockIn){{ $stockIn[0]->stockIn }}@else {{ 0 }}@endif</td> <td style="text-align: right;">@if($bf){{ $bf }}@else {{ 0 }}@endif</td>
public function getSubCategories($id) { $subcategories = SubCategory::where('category_id', '=', $id)->get(); return $subcategories; }