当前位置: 首页>>代码示例>>PHP>>正文


PHP Company::getDistributeList方法代码示例

本文整理汇总了PHP中app\Company::getDistributeList方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::getDistributeList方法的具体用法?PHP Company::getDistributeList怎么用?PHP Company::getDistributeList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Company的用法示例。


在下文中一共展示了Company::getDistributeList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDistribute

	public function getDistribute()
	{
		$distributes = array();
		$user = array();
		$distributes = Company::getDistributeList()->get()->toArray();
		$users = User::get()->toArray();
		$min_year = ReceiptMonth::min('year');
		if($min_year==0){
			$min_year = intval(date('Y'));
		}
		$this->layout->content = view('receipt.distribute',[
							'distributes'	=>	$distributes,
							'users'			=>	$users,
							'min_year' 	=>	$min_year
								]);
	}
开发者ID:kamitori,项目名称:khuongnhi2,代码行数:16,代码来源:ReceiptsController.php

示例2: anyImportProduct

	public function anyImportProduct(){
		
		\Excel::load('kho-2015.xls', function($reader) {
		    $results = $reader->get();
		    $company = Company::getDistributeList()->get()->toArray();
		    $arr_company = array();
		    foreach ($company as $key => $value) {
		    	$arr_company[$value['name']] = $value['id'];
		    }
		    // pr($arr_company);die;
		    $arr_oum = array();
		    $oums = Oum::orderBy('name')->get()->toArray();
		    foreach ($oums as $key => $value) {
		    	$arr_oum[$value['name']] = $value['id'];
		    }
		 	foreach ($results as $row) {

		 	 	$product = new Product;
				$product->name = $row['ten_san_pham'];
				$product->sku = $row['sku'];
				// $name_product = $row['ten_san_pham'];
				// $check1 = is_numeric(mb_strpos($name_product, "Áo"));
				// $check2 = is_numeric(mb_strpos($name_product, 'Váy'));
				// $check3 = is_numeric(mb_strpos($name_product, 'Quần'));
				// $check3 = is_numeric(mb_strpos($name_product, 'Đầm'));
				// $check4 = is_numeric(mb_strpos($name_product, 'Bộ')) && is_numeric(mb_strpos($name_product, 'ton'));
				// $check5 = is_numeric(mb_strpos($name_product, 'Bộ')) && is_numeric(mb_strpos($name_product, 'bo'));
				// $check6 = is_numeric(mb_strpos($name_product, 'Bộ')) && is_numeric(mb_strpos($name_product, 'thun'));
				// $check = $check1 || $check2 || $check3 || $check4 || $check5 || $check6;
				if($row['loai_san_pham'] == "Đồ dùng"){
					$product->product_type = 2;
				}else{
					$product->product_type = 1;
				}
				$product->status=0;
				$product->created_by = \Auth::user()->id;
				if($product->save()){
					$mproduct = new MProduct;
					$mproduct->product_id	=	$product->id;
					$mproduct->module_id	= 	0;
					$mproduct->company_id	= 	$arr_company[$row['nha_cung_cap']];
					$mproduct->module_type	=	'in_stock';
					$mproduct->specification	=	$row['quy_cach'];
					$mproduct->oum_id		=	$arr_oum[$row['don_vi_ban']];
					$mproduct->origin_price	=	intval(str_replace(",","",$row['gia_goc']));
					$mproduct->quantity		=	$row['so_luong'];
					$mproduct->invest		=	intval(str_replace(",","",$row['gia_goc']))*intval($row['so_luong'])*intval($row['quy_cach']);
					if($mproduct->save()){
						Product::where('id','=',$product->id)->update(['check_in_stock'=>1]);
						if(intval($row['gia_npp'])>0){
							$sell_price = new SellPrice;
							$sell_price->name = "Giá NPP";
							$sell_price->price = intval($row['gia_npp']);
							$sell_price->product_id = $product->id;
							$sell_price->m_product_id = $mproduct->id;
							$sell_price->save();
						}
						if(intval($row['dai_ly'])>0){
							$sell_price = new SellPrice;
							$sell_price->name = "Giá đại lý";
							$sell_price->price = intval($row['dai_ly']);
							$sell_price->product_id = $product->id;
							$sell_price->m_product_id = $mproduct->id;
							$sell_price->save();
						}
						if(intval($row['shop'])>0){
							$sell_price = new SellPrice;
							$sell_price->name = "Giá bán shop";
							$sell_price->price = intval($row['shop']);
							$sell_price->product_id = $product->id;
							$sell_price->m_product_id = $mproduct->id;
							$sell_price->save();
						}
						if(intval($row['ban_le'])>0){
							$sell_price = new SellPrice;
							$sell_price->name = "Giá bán lẻ";
							$sell_price->price = intval($row['ban_le']);
							$sell_price->product_id = $product->id;
							$sell_price->m_product_id = $mproduct->id;
							$sell_price->save();
						}
					}
				}
		 	}
		 	echo "Done";
		 	die;
		});
		
	}
开发者ID:kamitori,项目名称:khuongnhi2,代码行数:89,代码来源:ProductsController.php

示例3: getListProduct

	public function getListProduct(){
		$id = session('current_returnpurchaseorder');
		$returnpurchaseorder = ReturnPurchaseorder::select('status','company_id')->where('id','=',$id)->first()->toArray();
		//Init array
		$distributes = array();
		$oums = array();
		$list_product = array();

		//Get value
		$distributes = Company::getDistributeList()->with('address')->get()->toArray();
		$oums = Oum::orderBy('name')->get()->toArray();
		$list_product = MProduct::select('m_products.*','products.sku','products.name')->where('module_type','=','App\ReturnPurchaseorder')
						->where('module_id','=',$id)
						->where('company_id','=',$returnpurchaseorder['company_id'])
						->leftJoin('products','products.id','=','m_products.product_id')
						->addSelect('oums.name as oum_name')
						->leftJoin('oums','oums.id','=','m_products.oum_id')
						->get()->toArray();


		Session::forget('product_of_rpo'.session('current_returnpurchaseorder'));
		foreach ($list_product as $key => $value) {
			Session::put('product_of_rpo'.session('current_returnpurchaseorder').".".$value['m_product_id'] , $value['m_product_id']);
		}

		\Cache::put('list_product_rpo'.\Auth::user()->id, $list_product, 30);
		return view('returnpurchaseorder.list-product',[	'distributes'=>$distributes,
							'oums'=>$oums,
							'list_product'=>$list_product,
							'returnpurchaseorder'=>$returnpurchaseorder
						]);
	}
开发者ID:kamitori,项目名称:khuongnhi2,代码行数:32,代码来源:ReturnPurchaseordersController.php

示例4: getListProduct

	public function getListProduct(){
		$id = session('current_saleorder');
		$saleorder = Saleorder::select('status','company_id')->where('id','=',$id)->first()->toArray();
		//Init array
		$distributes = array();
		$oums = array();
		$list_product = array();

		//Get value
		$distributes = Company::getDistributeList()->with('address')->get()->toArray();
		$oums = Oum::orderBy('name')->get()->toArray();
		$list_product = MProduct::select('m_products.*','products.sku','products.name')->where('module_type','=','App\Saleorder')
						->where('module_id','=',$id)
						->where('company_id','=',$saleorder['company_id'])
						->leftJoin('products','products.id','=','m_products.product_id')
						->addSelect('oums.name as oum_name')
						->leftJoin('oums','oums.id','=','m_products.oum_id')
						->with('getsellprices')
						->orderBy('order','asc')
						->get()->toArray();
		\Cache::put('list_product_so'.\Auth::user()->id, $list_product, 30);
		return view('saleorder.list-product',[	'distributes'=>$distributes,
							'oums'=>$oums,
							'list_product'=>$list_product,
							'saleorder'=>$saleorder
						]);
	}
开发者ID:kamitori,项目名称:khuongnhi2,代码行数:27,代码来源:SaleordersController.php


注:本文中的app\Company::getDistributeList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。