コード例 #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Requests\UpdateAndSaveCompany $request, Company $company)
 {
     $company->create($request->all());
     \Session::flash('message', 'You have successfully Created ' . $company->name);
     $companies = Company::orderBy('name')->paginate(15);
     $keyword = '';
     return view('company.list', compact('companies', 'keyword'));
 }
コード例 #2
0
ファイル: CompanyController.php プロジェクト: hmakauskas/mda
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $search = \Request::get('search');
     //<-- we use global request to get the param of URI
     if ($search) {
         $allCompanies = Company::whereRaw('store_name = ?', [$search])->orderBy('id', 'desc')->paginate(5);
     } else {
         $allCompanies = Company::orderBy('id', 'desc')->paginate(5);
     }
     return view('company.index', ['companies' => $allCompanies]);
 }
コード例 #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Requests\UpdateAndSaveCompany $request, Company $company)
 {
     $request->offsetSet('created_by', Auth::user()->id);
     $request->offsetSet('updated_by', Auth::user()->id);
     $request->offsetSet('status', 'ACTIVE');
     $company->create($request->all());
     $company = DB::table('companies')->where('name', $request->name)->first();
     $password = $request->password;
     $user = new User();
     $request->offsetSet('password', bcrypt($request->password));
     $request->offsetSet('created_by', Auth::user()->id);
     $request->offsetSet('updated_by', Auth::user()->id);
     $request->offsetSet('status', "NEW");
     $request->offsetSet('role_id', "4");
     $request->offsetSet('manager_id', 0);
     $request->offsetSet('company_id', $company->id);
     $user->create($request->all());
     $user = DB::table('users')->where('email', $request->email)->first();
     $goal = parent::assembleGoalSetting();
     $goal->user_id = $user->id;
     $goal->created_by = Auth::user()->id;
     $goal->updated_by = Auth::user()->id;
     $goal->save();
     $userPassword = new UserPassword();
     $userPassword->user_id = $user->id;
     $userPassword->crypt_password = \Crypt::encrypt($password);
     $userPassword->updated_at = new \DateTime();
     $userPassword->created_at = new \DateTime();
     $userPassword->save();
     $contactEmail = $user->email;
     $contactName = $user->first_name . ' ' . $user->last_name;
     Mail::send('emails.hello', array('first_name' => $user->first_name, 'user_name' => $user->email, 'password' => $password), function ($message) use($contactEmail, $contactName) {
         $message->from('*****@*****.**', 'Sales Performance Indicator');
         $message->to($contactEmail, $contactName)->subject('Welcome to Sales Performance Indicator!');
     });
     \Session::flash('message', 'You have successfully Created ' . $company->name);
     $companies = Company::orderBy('name')->paginate(15);
     $keyword = '';
     return view('company.list', compact('companies', 'keyword'));
 }
コード例 #4
0
 /**
  * @return \Illuminate\View\View
  */
 public function index()
 {
     $companies = Company::orderBy('name', 'asc')->paginate(10);
     return view('companies.index', compact('companies'));
 }
コード例 #5
0
	public function anyEntry(Request $request,$id=null)
	{
		if(isset($id) && $id!=null){
			$id_product = $id;
			$product = Product::find($id_product)->toArray();
			session(['current_product' => $product['id']]);
		}else{
			$id_product = session('current_product') !== null ? session('current_product') : 0;
			if($id_product){
				$product = Product::find($id_product)->toArray();
				if(count($product)){
					session(['current_product' => $product['id']]);
				}else{
					$product = Product::get()->last();
					if($product){
						$product= $product->toArray();
						session(['current_product' => $product['id']]);
					}else{
						$product = new Product;
						$product->created_by = \Auth::user()->id;
						$product->save();
						Log::create_log(\Auth::user()->id,'App\Product','Tạo mới sản phẩm số '.$product->id);
						session(['current_product' => $product->id]);
						$product->toArray();
					}
				}
			}else{
				$product = Product::get()->last();
				if($product){
					$product= $product->toArray();
					session(['current_product' => $product['id']]);
				}else{
					$product = new Product;
					$product->created_by = \Auth::user()->id;
					$product->save();
					Log::create_log(\Auth::user()->id,'App\Product','Tạo mới sản phẩm số '.$product->id);
					session(['current_product' => $product->id]);
					$product->toArray();
				}
			}
		}



		//Init array
		$distributes = array();
		$oums = array();
		$producttypes = array();
		$list_instock = array();


		//Get value array
		$distributes = Company::getDistributeList()->get()->toArray();
		$oums = Oum::orderBy('name')->get()->toArray();
		$producttypes = ProductType::get()->toArray();
		if($product['check_in_stock']){
			$list_instock = MProduct::select('m_products.*','product_stocks.in_stock')
						->with('company')->with('oum')
						->where('m_products.product_id','=',session('current_product'))
						->where('module_type','=','in_stock')
						->leftJoin('product_stocks','product_stocks.m_product_id','=','m_products.id')
						->get()->toArray();
		}
		
		$view_list_po = self::getListPo($request);
		$view_list_so = self::getListSo($request);
		$companies = array();
		$companies = Company::orderBy('name')->get()->toArray();
		$arr_create = Product::select('users.name','products.created_at')
					->leftJoin('users','users.id','=','products.created_by')
					->where('products.id','=',$product['id'])
					->get()->first()->toArray();

		$arr_update = Product::select('users.name','products.updated_at')
					->leftJoin('users','users.id','=','products.updated_by')
					->where('products.id','=',$product['id'])
					->get()->first()->toArray();
		$this->layout->arr_create = $arr_create;
		$this->layout->arr_update = $arr_update;
		$list_month =ReceiptMonth::select('month','year')
									->distinct()->where('month','>',0)
									->orderBy('year','DESC')
									->orderBy('month','DESC')
									->get()->toArray();
		
		$this->layout->content=view('product.entry', ['distributes'=>$distributes,
								'oums'=>$oums,
								'producttypes'=>$producttypes,
								'product' => $product,
								'view_list_po'	=> $view_list_po,
								'view_list_so'	=> $view_list_so,
								'list_instock' => $list_instock,
								'companies'	=> $companies,
								'list_month' => $list_month
							        ]);
	}
コード例 #6
0
ファイル: CompanyController.php プロジェクト: khanhpnk/sbds
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $companies = Company::orderBy('id', 'desc')->paginate(12);
     return view('front.companies.index', compact('companies'));
 }
コード例 #7
0
 public function companys_list()
 {
     $companys = Company::orderBy('name')->paginate(10);
     return view('company.list', compact('companys'));
 }
コード例 #8
0
 public function companysToAdd()
 {
     $companys = Company::orderBy('name')->get();
     $vista = view('patients.listOfCompanys', compact('companys'));
     return $vista;
 }
コード例 #9
0
 /**
  * Get all of the companies rodered by name ascending
  *
  * @return Collection
  */
 public function getAllOrderedByNameAsc()
 {
     return Company::orderBy('name', 'asc')->get();
 }
コード例 #10
0
ファイル: CompanyController.php プロジェクト: raulpulido/p4
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $companies = \App\Company::orderBy('id', 'DESC')->get();
     return view('pages.company.index')->with('companies', $companies);
 }