• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Facades\Excel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Maatwebsite\Excel\Facades\Excel的典型用法代码示例。如果您正苦于以下问题:PHP Excel类的具体用法?PHP Excel怎么用?PHP Excel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: importdata

 public function importdata(Request $request)
 {
     $results = null;
     //        $results = $reader->get();
     //
     //        $ret = $results->toArray();
     $file = $request->file('exelimport');
     $request->file('exelimport')->move(storage_path() . '/public/import/', 'import.xlsx');
     //$request->file('exelimport')
     //        $results =    Excel::load($request->file('exelimport'))->toArray();
     $ret = Excel::filter('chunk')->load(storage_path('/public/import/import.xlsx'))->chunk(250, function ($results) {
         $data = array();
         foreach ($results as $index => $value) {
             //
             $im_date_start = $value["change_saving_rate_date"];
             $ret_data_start = str_replace("'", "", $im_date_start);
             $im_date_modify = $value["effective_date"];
             $ret_data_modify = str_replace("'", "", $im_date_modify);
             //                var_dump($ret_data_start);
             $date_start = new Date($ret_data_start);
             $date_modify = new Date($ret_data_modify);
             $EMP_ID = $value["emp_id"];
             //             $PERIOD = $value["period"];
             $allquery = "SELECT COUNT(EMP_ID) AS total FROM TBL_USER_SAVING_RATE  WHERE EMP_ID= '" . $EMP_ID . "' AND CHANGE_SAVING_RATE_DATE='" . $date_start . "'";
             $all = DB::select(DB::raw($allquery));
             $total = $all[0]->total;
             if ($total == 0) {
                 array_push($data, array('EMP_ID' => $value["emp_id"], 'USER_SAVING_RATE' => $value["user_saving_rate"], 'CHANGE_SAVING_RATE_DATE' => $date_start, 'EFFECTIVE_DATE' => $date_modify, 'MODIFY_COUNT' => $value["modify_count"], 'MODIFY_BY' => $value["modify_by"]));
             }
         }
         DB::table('TBL_USER_SAVING_RATE')->insert($data);
     });
     return response()->json(array('success' => true, 'html' => $ret));
 }
开发者ID:FreelanceDArkman,项目名称:MEA,代码行数:34,代码来源:UserManageCurrentController.php


示例2: importData

 /**
  *
  */
 public function importData($url, $program_id, $feed_id, $custom_categorie)
 {
     $fileLocation = storage_path() . '/' . $program_id . '.' . $feed_id . '.csv';
     $this->downloadAndSaveFeed($url, $fileLocation);
     $this->filterBestand($fileLocation);
     $chunkSize = Config::get('daisycon.chunksize', 500);
     Excel::filter('chunk')->load($fileLocation)->chunk($chunkSize, function ($results) use($program_id, $feed_id, $custom_categorie) {
         foreach ($results as $row) {
             /**
              * Lege values eruit filteren
              */
             $arr = array_filter($row->toArray());
             try {
                 /**
                  * Merge 'program_id' in gegevens uit XML
                  */
                 $inserted_array = array_merge($arr, array('program_id' => $program_id, 'feed_id' => $feed_id, 'custom_categorie' => $custom_categorie));
                 Data::create($inserted_array);
             } catch (Exception $e) {
                 dd($e->getMessage());
             }
         }
     });
     Data::where(function ($query) {
         $query->whereTitle('title')->orWhere('title', 'like', '#%');
     })->delete();
     Data::whereTemp(0)->update(array('temp' => 1));
     \File::delete($fileLocation);
 }
开发者ID:bahjaat,项目名称:daisycon,代码行数:32,代码来源:CsvDataImport.php


示例3: postImportContacts

 /**
  * @param Request $request
  * @return View
  */
 public function postImportContacts(Request $request)
 {
     $start = microtime(true);
     $authenticated_user = $request->user();
     $creation_data = new CRUDResultData();
     $file = Input::file('imported_contacts');
     if (is_null($file)) {
         $extension = 'ERROR';
         $creation_data->extra_info .= 'No file uploaded. ';
     } else {
         $extension = $file->getClientOriginalExtension();
     }
     if ($extension == 'xls' or $extension == 'xlsx') {
         $php_excel = Excel::load($file->getPathname());
         $worksheet = $php_excel->setActiveSheetIndex(0)->toArray();
         $validation_data = $this->validateExcel($worksheet);
         if ($validation_data->success == false) {
             $creation_data = $validation_data;
         } else {
             $creation_data->success = true;
             $creation_data->extra_info = $validation_data->extra_info;
             $this->insertFromExcel($worksheet, $authenticated_user);
         }
     } elseif ($extension == 'csv' or $extension == 'tsv') {
     }
     $creation_data->extra_info .= 'Time to finish: ' . round((microtime(true) - $start) * 1000, 3) . ' ms. ';
     $creation_data->extra_info .= 'Uploaded by: ' . $authenticated_user->name . ' - ' . $authenticated_user->email . '. ';
     $this->logImportResult($creation_data, $authenticated_user);
     return View('contacts/import_contact')->with('creation_data', $creation_data);
 }
开发者ID:jsrc1115,项目名称:VOIQTest,代码行数:34,代码来源:ImportController.php


示例4: updateIpExt

 public function updateIpExt()
 {
     $self = $this;
     Excel::selectSheets('全區')->load(__DIR__ . '/../../../../storage/excel/example/ip_ext.xls', $this->updateClosure());
     Session::flash('success', '全部人員<b>Ip</b>以及<b>分機</b>更新完成');
     return redirect('user');
 }
开发者ID:jocoonopa,项目名称:lubri,代码行数:7,代码来源:FeatureController.php


示例5: _loadXls

 public static function _loadXls($url)
 {
     $data = Excel::load($url, function ($reader) {
         return $reader->all();
     });
     return $data;
 }
开发者ID:RMMusic,项目名称:CSE,代码行数:7,代码来源:Excel_.php


示例6: importdata

 public function importdata(Request $request)
 {
     $results = null;
     //        $results = $reader->get();
     //
     //        $ret = $results->toArray();
     $file = $request->file('exelimport');
     $request->file('exelimport')->move(storage_path() . '/public/import/', 'import.xlsx');
     //$request->file('exelimport')
     //        $results =    Excel::load($request->file('exelimport'))->toArray();
     $ret = Excel::filter('chunk')->load(storage_path('/public/import/import.xlsx'))->chunk(250, function ($results) {
         foreach ($results as $index => $value) {
             //
             //                $rest = substr("abcdef", -1);    // returns "f"
             //                $rest = substr("abcdef", -2);    // returns "ef"
             //                $rest = substr("abcdef", -3, 1);
             $im_date_start = $value["contribution_start_date"];
             $ret_data_start = str_replace("'", "", $im_date_start);
             $im_date_end = $value["contribution_end_date"];
             $ret_data_end = str_replace("'", "", $im_date_end);
             $im_date_modify = $value["contribution_modify_date"];
             $ret_data_modify = str_replace("'", "", $im_date_modify);
             //                var_dump($ret_data_start);
             //                var_dump($ret_data_start);
             $date_start = new Date($ret_data_start);
             $date_end = new Date($ret_data_end);
             $date_modify = new Date($ret_data_modify);
             $update = array('EMP_ID' => $value["emp_id"], 'CONTRIBUTION_START_DATE' => $date_start, 'CONTRIBUTION_END_DATE' => $date_end, 'CONTRIBUTION_MODIFY_DATE' => $date_modify, 'CONTRIBUTION_RATE_OLD' => $value["contribution_rate_old"], 'CONTRIBUTION_RATE_NEW' => $value["contribution_rate_new"]);
             DB::table('TBL_EMPLOYEE_INFO')->where('EMP_ID', "=", $value["emp_id"])->update($update);
         }
     });
     return response()->json(array('success' => true, 'html' => $ret));
 }
开发者ID:FreelanceDArkman,项目名称:MEA,代码行数:33,代码来源:UserManageExtendController.php


示例7: insertArticles

 private function insertArticles($filename)
 {
     $i = 0;
     $filename = 'storage/app/' . $filename;
     Excel::load($filename, function ($reader) use($i) {
         $results = $reader->get();
         foreach ($results as $article) {
             $NoEstaEnLaBD = is_null(Article::where('product_code', $article['codigo'])->first());
             if ($NoEstaEnLaBD) {
                 // si el articulo _NO_ se encuentra en la base de datos
                 if (is_null($article['serializable'])) {
                     $serializable = 0;
                 } else {
                     $serializable = $article['serializable'];
                 }
                 $a = Article::create(['product_code' => $article['codigo'], 'unit' => $article['ub'], 'name' => $article['descripcion'], 'barcode' => $article['barcode'], 'fav' => $article['fav'], 'serializable' => $serializable, 'active' => $article['activo']]);
                 $i++;
             } else {
                 // si el codigo se encuentra en la base de datos
             }
         }
     });
     // Fin del Excel::load
     return $i;
 }
开发者ID:johanWP,项目名称:pandora,代码行数:25,代码来源:ImportController.php


示例8: index

 /**
  * Create or update a note
  *
  * @param Request $request
  * @return \Illuminate\Http\JsonResponse
  */
 public function index(Request $request)
 {
     $linehaul = $request->input('linehaul', null);
     $postalCode = $request->input('postalcode', null);
     $fresh = $request->input('fresh', false);
     $dummy = $request->input('dummy', false);
     //Damn strings
     if ($fresh == 'false') {
         $fresh = false;
     }
     if ($fresh) {
         $postalCodes = $this->getPostalCodes($linehaul, $postalCode);
     } else {
         $postalCodes = Cache::remember('postal_codes', 24 * 60, function () use($linehaul, $postalCode) {
             return $this->getPostalCodes($linehaul, $postalCode);
         });
     }
     if (!$dummy) {
         return Excel::create('PostalCodes' . Carbon::now()->toDateString(), function ($excel) use($postalCodes) {
             $excel->sheet('postalcodes', function ($sheet) use($postalCodes) {
                 $sheet->fromArray($postalCodes);
             });
         })->download('xls');
     }
     return 'DB UPDATED';
 }
开发者ID:dagmawiyehenew,项目名称:laravel-levapp,代码行数:32,代码来源:PostalCodeController.php


示例9: importdata

 public function importdata(Request $request)
 {
     $results = null;
     //        $results = $reader->get();
     //
     //        $ret = $results->toArray();
     $file = $request->file('exelimport');
     $request->file('exelimport')->move(storage_path() . '/public/import/', 'import.xlsx');
     //$request->file('exelimport')
     //        $results =    Excel::load($request->file('exelimport'))->toArray();
     $ret = Excel::filter('chunk')->load(storage_path('/public/import/import.xlsx'))->chunk(250, function ($results) {
         $data = array();
         //            $results = $reader->toArray();
         foreach ($results as $index => $value) {
             $EMP_ID = $value["emp_id"];
             //                $PERIOD = $value["period"];
             //                $user = DB::table('TBL_MEMBER_BENEFITS')->where('EMP_ID', $EMP_ID)->where('PERIOD', $PERIOD)->count();
             $allquery = "SELECT COUNT(EMP_ID) AS total FROM TBL_USER_BENEFICIARY  WHERE EMP_ID= '" . $EMP_ID . "'";
             $all = DB::select(DB::raw($allquery));
             $total = $all[0]->total;
             $date = new Date();
             //                array_push($data,'asd','asda');
             if ($total == 0) {
                 array_push($data, array('EMP_ID' => $value["emp_id"], 'FULL_NAME' => $value["full_name"], 'FILE_NO' => $value["file_no"], 'FILE_PATH' => $value["file_path"], 'CREATE_DATE' => $value["create_date"], 'CREATE_BY' => $value["create_by"], 'FILE_NAME' => $value["file_name"]));
             }
         }
         //            var_dump($data);
         DB::table('TBL_USER_BENEFICIARY')->insert($data);
         //DB::insert(DB::raw($insert));
     });
     return response()->json(array('success' => true, 'html' => $ret));
 }
开发者ID:FreelanceDArkman,项目名称:MEA,代码行数:32,代码来源:UserManageBenefitController.php


示例10: import

 /**
  * 
  */
 public function import(Request $request)
 {
     Excel::filter('chunk')->load($request->only('file')['file'], 'UTF-8')->chunk(100, function ($language) {
         // Loop through all rows
         $language->each(function ($row) {
             $default = Locale::find(1);
             $locales = Locale::lists('id', 'name');
             $langs = [];
             foreach ($row as $lang => $translation) {
                 if (array_key_exists(ucfirst($lang), $locales->toArray())) {
                     // if imported lang exist
                     $ilang_id = $locales[ucfirst($lang)];
                     //
                     if ($ilang_id == $default->id) {
                         $langs[ucfirst($lang)]['translation'] = $translation;
                         $langs[ucfirst($lang)]['id'] = $ilang_id;
                     } else {
                         $langs['child'][ucfirst($lang)]['translation'] = $translation;
                         $langs['child'][ucfirst($lang)]['id'] = $ilang_id;
                     }
                 }
             }
             $new_trans = LocaleTranslation::firstOrNew(['locale_id' => $langs[$default->name]['id'], 'translation' => $langs[$default->name]['translation']]);
             $new_trans->save();
             foreach ($langs['child'] as $cland => $ctrans) {
                 $new_ctrans = LocaleTranslation::firstOrNew(['locale_id' => $ctrans['id'], 'translation_id' => $new_trans->id]);
                 $new_ctrans->translation = $ctrans['translation'];
                 $new_ctrans->save();
             }
         });
     });
     return redirect()->route('admin.language.index')->withFlashSuccess('Imported');
 }
开发者ID:herzcthu,项目名称:Laravel-HS,代码行数:36,代码来源:LocalizationController.php


示例11: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $requested = Input::get('request');
     $message = '';
     if ($requested == null || $requested == '' || $requested == 'showAll') {
         $users = $this->getActiveCompanyUsers(null);
         $keyword = '';
         if (count($users) == 25) {
             $message = "There are more users than are currently displayed. Please use the search filter.";
         }
         return view('goalSettings.list', compact('users', 'keyword', 'message'));
     } elseif ($requested == 'excel') {
         $keyword = Input::get('keyword');
         $users = $this->getActiveCompanyUsers($keyword);
         $data = array(array('Member Name', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'ANNUAL'));
         foreach ($users as $user) {
             array_push($data, array($user->first_name . ' ' . $user->last_name, $user->goalManagement->jan, $user->goalManagement->feb, $user->goalManagement->mar, $user->goalManagement->apr, $user->goalManagement->may, $user->goalManagement->jun, $user->goalManagement->jul, $user->goalManagement->aug, $user->goalManagement->sep, $user->goalManagement->oct, $user->goalManagement->nov, $user->goalManagement->dec, $user->goalManagement->annual));
         }
         Excel::create('revenueGoalSettings', function ($excel) use($data) {
             $excel->sheet('Revenue Goal Settings', function ($sheet) use($data) {
                 $sheet->fromArray($data);
             });
         })->export('xlsx');
     } else {
         $keyword = Input::get('keyword');
         $users = $this->getActiveCompanyUsers($keyword);
         if (count($users) == 25) {
             $message = "There are more users than are currently displayed. Please use the search filter.";
         }
         return view('goalSettings.list', compact('users', 'keyword', 'message'));
     }
 }
开发者ID:keiwerkgvr,项目名称:salesperformanceindicator,代码行数:37,代码来源:GoalSettingController.php


示例12: csvToRespondents

 static function csvToRespondents($file, $project_id)
 {
     $respondents = Excel::load($file, function ($reader) {
         $reader->toArray();
     });
     $respondents = $respondents->parsed;
     $count = null;
     foreach ($respondents as $respondent) {
         $count++;
         $new = Respondent::create(['first_name' => $respondent->first_name, 'last_name' => $respondent->last_name, 'gender' => $respondent->gender, 'dob' => $respondent->dob, 'project_id' => $project_id]);
         if (isset($respondent->email) && $respondent->email != null) {
             $email = RespondentEmail::firstOrCreate(['project_id' => $project_id, 'address' => $respondent->email]);
             $email->type = $respondent->type;
             $email->save();
             $new->emails()->save($email);
         }
         if (isset($respondent->phone) && $respondent->phone != null) {
             $ph_num = Uploader::cleanPhoneNumber($respondent->phone);
             $phone = RespondentPhone::firstOrCreate(['project_id' => $project_id, 'number' => $ph_num]);
             $phone->type = $respondent->phone_type;
             $phone->save();
             $new->phones()->save($phone);
         }
         if (isset($respondent->email) && $respondent->email != null) {
             $address = RespondentAddress::firstOrCreate(['project_id' => $project_id, 'street_number' => $respondent->street_number, 'street_name' => $respondent->street_name, 'apt' => $respondent->apt, 'city' => $respondent->city, 'state' => $respondent->state, 'zip' => $respondent->zip, 'type' => $respondent->address_type]);
             $new->addresses()->save($address);
         }
     }
     return $count;
 }
开发者ID:salaback,项目名称:nable,代码行数:30,代码来源:Uploader.php


示例13: importdata

 public function importdata(Request $request)
 {
     $results = null;
     //        $results = $reader->get();
     //
     //        $ret = $results->toArray();
     $file = $request->file('exelimport');
     $request->file('exelimport')->move(storage_path() . '/public/import/', 'import.xlsx');
     //$request->file('exelimport')
     //        $results =    Excel::load($request->file('exelimport'))->toArray();
     $ret = Excel::filter('chunk')->load(storage_path('/public/import/import.xlsx'))->chunk(250, function ($results) {
         $data = array();
         //            $results = $reader->toArray();
         foreach ($results as $index => $value) {
             $EMP_ID = $value["emp_id"];
             $PERIOD = $value["period"];
             //                $user = DB::table('TBL_MEMBER_BENEFITS')->where('EMP_ID', $EMP_ID)->where('PERIOD', $PERIOD)->count();
             $allquery = "SELECT COUNT(EMP_ID) AS total FROM TBL_MEMBER_BENEFITS  WHERE EMP_ID= '" . $EMP_ID . "' AND (PERIOD='" . $PERIOD . "' OR PERIOD IS NULL)";
             $all = DB::select(DB::raw($allquery));
             $total = $all[0]->total;
             //                array_push($data,'asd','asda');
             if ($total == 0) {
                 array_push($data, array('EMP_ID' => $value["emp_id"], 'FULL_NAME' => $value["full_name"], 'PATH_CODE' => $value["path_code"], 'DEP_CODE' => $value["dep_code"], 'DIV_CODE' => $value["div_code"], 'SEC_CODE' => $value["sec_code"], 'PATH_NAME' => $value["path_name"], 'DEP_NAME' => $value["dep_name"], 'DIV_NAME' => $value["div_name"], 'SEC_NAME' => $value["sec_name"], 'HIRE_DATE' => $value["hire_date"], 'END_DATE' => $value["end_date"], 'POSITION_CODE' => $value["position_code"], 'POSITION_NAME' => $value["position_name"], 'JOB_LINE' => $value["job_line"], 'LEVEL_CODE' => $value["level_code"], 'EXE_NAME' => $value["exe_name"], 'EXE1_NAME' => $value["exe1_name"], 'AGE_YEAR' => $value["age_year"], 'AGE_DAY' => $value["age_day"], 'JOB_YEAR' => $value["job_year"], 'JOB_DAY' => $value["job_day"], 'EMPLOYER_CONTRIBUTION_1' => $value["employer_contribution_1"], 'EMPLOYER_EARNING_2' => $value["employer_earning_2"], 'MEMBER_CONTRIBUTION_3' => $value["member_contribution_3"], 'MEMBER_EARNING_4' => $value["member_earning_4"], 'TAX_1' => $value["tax_1"], 'TAX_12' => $value["tax_12"], 'TAX_124' => $value["tax_124"], 'TAX_1234' => $value["tax_1234"], 'GRATUITY' => $value["gratuity"], 'GRATUITY_TAX' => $value["gratuity_tax"], 'RECORD_DATE' => $value["record_date"], 'PERIOD' => $value["period"]));
             }
         }
         //            var_dump($data);
         DB::table('TBL_MEMBER_BENEFITS')->insert($data);
         //DB::insert(DB::raw($insert));
     });
     return response()->json(array('success' => true, 'html' => $ret));
 }
开发者ID:FreelanceDArkman,项目名称:MEA,代码行数:31,代码来源:UserManageFundController.php


示例14: export

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function export($report)
 {
     $data = null;
     $title = null;
     if ($report == '1') {
         $data = session()->get('funciones');
         $title = 'Funciones';
     }
     if ($report == '2') {
         $data = session()->get('paises');
         $title = 'Paises';
     }
     if ($report == '3') {
         $data = session()->get('sedes');
         $title = 'Sedes';
     }
     if ($report == '4') {
         $data = session()->get('programas');
         $title = 'Programas';
     }
     if ($report == '5') {
         $data = session()->get('festivales');
         $title = 'Festivales';
     }
     $fechaIni = $data[0]['Fecha inicial'];
     $fechaFin = $data[0]['Fecha final'];
     Excel::create('Reporte DocumentaQro ' . $title . ' de ' . $fechaIni . ' hasta ' . $fechaFin, function ($excel) use($data) {
         $excel->sheet('Export', function ($sheet) use($data) {
             $sheet->fromArray($data);
         });
     })->export('xls');
 }
开发者ID:saulzini,项目名称:DocumentaQro,代码行数:37,代码来源:ExcelController.php


示例15: handle

 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $order_id = $this->order->id;
     //
     try {
         //解析文件 录入数据库
         Excel::filter('chunk')->selectSheets('Sheet1')->load(public_path($this->order->sub_file))->chunk(300, function ($results) use($order_id) {
             foreach ($results as $row) {
                 if ($row['序号'] != null) {
                     $subOrder = new SubOrder();
                     $subOrder->order_id = $order_id;
                     $subOrder->excel_id = (int) $row['序号'];
                     $subOrder->fw_number = $row['国外运单号'];
                     $subOrder->name = $row['姓名'];
                     $subOrder->mobile = $row['电话'];
                     $subOrder->address = $row['地址'];
                     $subOrder->zip_code = $row['邮编'];
                     $subOrder->weight = $row['重量'];
                     $subOrder->id_number = $row['身份证号'];
                     try {
                         $subOrder->save();
                     } catch (\Exception $exception) {
                         return array('success' => false, 'errors' => array($exception->getMessage()));
                     }
                     //存入订单产品
                     $product = new OrderProduct();
                     $product->sub_order_id = $subOrder->id;
                     $product->name = $row['品名'];
                     $product->count = $row['数量'];
                     try {
                         $product->save();
                     } catch (\Exception $exception) {
                         return array('success' => false, 'errors' => array($exception->getMessage()));
                     }
                 } else {
                     //存入子订单
                     $subOrder = SubOrder::where('excel_id', (int) $row['子序号'])->where('order_id', $order_id)->first();
                     //TODO 检查子订单是否存在
                     //存入订单产品
                     $product = new OrderProduct();
                     $product->sub_order_id = $subOrder['id'];
                     $product->name = $row['品名'];
                     $product->count = $row['数量'];
                     try {
                         $product->save();
                     } catch (\Exception $exception) {
                         return array('success' => false, 'errors' => array($exception->getMessage()));
                     }
                 }
             }
         });
     } catch (\Exception $e) {
         return array('success' => false, 'errors' => array($e->getMessage()));
     }
     //文件解析成功 更新子订单数量
     //获取分单数量
     $sub_total = SubOrder::where('order_id', $this->order->id)->count();
     $this->order->sub_total = $sub_total;
     $this->order->save();
 }
开发者ID:abcn,项目名称:excel,代码行数:65,代码来源:ImportExcel.php


示例16: importdata

 public function importdata(Request $request)
 {
     $results = null;
     $type = $request->input('type');
     $retdate = Excel::load($request->file('exelimport'), function ($reader) use($type) {
         $results = $reader->get();
         $ret = $results->toArray();
         //            var_dump($ret);
         foreach ($ret as $index => $value) {
             $EMP_ID = $value["emp_id"];
             $PLAN_ID = $value["plan_id"];
             $EQUITY_RATE = $value["equity_rate"];
             $DEBT_RATE = $value["debt_rate"];
             $MODIFY_DATE = $value["modify_date"];
             $EFFECTIVE_DATE = $value["effective_date"];
             $MODIFY_COUNT = $value["modify_count"];
             $MODIFY_COUNT_TIMESTAMP = $value["modify_count_timestamp"];
             $MODIFY_BY = $value["modify_by"];
             $insert = "INSERT INTO TBL_USER_FUND_CHOOSE (PLAN_ID,EMP_ID,EQUITY_RATE,DEBT_RATE,MODIFY_DATE,EFFECTIVE_DATE,MODIFY_COUNT,MODIFY_COUNT_TIMESTAMP,MODIFY_BY) VALUES(" . $PLAN_ID . ",'" . $EMP_ID . "'," . $EQUITY_RATE . "," . $DEBT_RATE . ",'" . $MODIFY_DATE . "','" . $EFFECTIVE_DATE . "'," . $MODIFY_COUNT . ",'" . $MODIFY_COUNT_TIMESTAMP . "','" . $MODIFY_BY . "')";
             DB::insert(DB::raw($insert));
         }
         $staturet = true;
         $data = "ok";
     });
     return response()->json(array('success' => true, 'html' => $retdate));
 }
开发者ID:FreelanceDArkman,项目名称:MEA,代码行数:26,代码来源:UserManagePlanController.php


示例17: exportOneSheet

 public function exportOneSheet($collection, array $columns, $title, $filename, $format = 'xls', $creator = '', $company = '')
 {
     $rows = [];
     $rows[] = array_values($columns);
     foreach ($collection as $item) {
         $row = [];
         foreach ($columns as $attribute => $title) {
             $pos = strpos($attribute, '.');
             if ($pos !== false) {
                 $right = $attribute;
                 while ($pos !== false) {
                     $left = substr($right, 0, $pos);
                     $right = substr($right, $pos + 1);
                     $pos = strpos($right, '.');
                     $relation = $item->{$left};
                 }
                 $row[] = $relation->{$right};
             } else {
                 $row[] = $item->{$attribute};
             }
         }
         $rows[] = $row;
     }
     return \Maatwebsite\Excel\Facades\Excel::create($filename, function ($excel) use($rows, $title, $creator, $company) {
         $excel->setTitle($title);
         $excel->setCreator($creator)->setCompany($company);
         $excel->sheet($title, function ($sheet) use($rows) {
             $sheet->fromArray($rows, null, 'A1', true, false);
         });
     })->download($format);
 }
开发者ID:am2studio,项目名称:laravel-exporter,代码行数:31,代码来源:Exporter.php


示例18: excel

 public function excel(Request $request)
 {
     try {
         Log::info(Input::file('input_excel'));
         Excel::load($request->file('input_excel'), function ($reader) {
             $array = $reader->toArray();
             Log::info($array);
             $banqueId = $this->gestSession->addBanqueByExcel($array[0]);
             Log::info("IdBanque1 " . $banqueId);
             $i = 1;
             while ($i < sizeof($array)) {
                 Log::info($array);
                 $titreIdGItem = $this->gestSession->addTitreGItemByExcel($array[$i]);
                 Log::info("IdTitreGItem " . $titreIdGItem);
                 $i++;
                 while ($i < sizeof($array) && $array[$i]["label_item"] != null) {
                     $this->gestSession->addItemByExcel($array[$i], $banqueId, $titreIdGItem);
                     $i++;
                 }
             }
         });
         return Redirect::back();
     } catch (\Exception $e) {
         echo "Format Incorrect";
     }
 }
开发者ID:S4M37,项目名称:Project_GangOfThree,代码行数:26,代码来源:BanqueController.php


示例19: importdata

 public function importdata(Request $request)
 {
     $results = null;
     //        $results = $reader->get();
     //
     //        $ret = $results->toArray();
     $file = $request->file('exelimport');
     $request->file('exelimport')->move(storage_path() . '/public/import/', 'import.xlsx');
     //$request->file('exelimport')
     //        $results =    Excel::load($request->file('exelimport'))->toArray();
     $ret = Excel::filter('chunk')->load(storage_path('/public/import/import.xlsx'))->chunk(250, function ($results) {
         $data = array();
         //            $results = $reader->toArray();
         foreach ($results as $index => $value) {
             //                $EMP_ID = $value["emp_id"];
             //                $PERIOD = $value["period"];
             //                $user = DB::table('TBL_MEMBER_BENEFITS')->where('EMP_ID', $EMP_ID)->where('PERIOD', $PERIOD)->count();
             //                $allquery = "SELECT COUNT(EMP_ID) AS total FROM TBL_MEMBER_BENEFITS  WHERE EMP_ID= '".$EMP_ID."' AND (PERIOD='".$PERIOD."' OR PERIOD IS NULL)";
             //                $all = DB::select(DB::raw($allquery));
             //               $total =  $all[0]->total;
             $date = new Date();
             //                array_push($data,'asd','asda');
             //                if ($total == 0) {
             array_push($data, array('EMP_ID' => $value["emp_id"], 'INVESTMENT_PLAN' => $value["investment_plan"], 'EQUITY' => $value["equity"], 'DEBT' => $value["debt"], 'EQUITY_FUNDS' => $value["equity_funds"], 'BOND_FUNDS' => $value["bond_funds"], 'INVESTMENT_MONEY' => $value["investment_money"], 'REFERENCE_DATE' => $value["reference_date"], 'MEMBER_STATUS' => $value["member_status"], 'CREATE_DATE' => $date));
             //                }
         }
         //            var_dump($data);
         DB::table('TBL_INFORMATION_FROM_ASSET')->insert($data);
         //DB::insert(DB::raw($insert));
     });
     return response()->json(array('success' => true, 'html' => $ret));
 }
开发者ID:FreelanceDArkman,项目名称:MEA,代码行数:32,代码来源:UserManageProfitController.php


示例20: exportFileTest

 /**
  * Generates exported excel files
  *
  * @return excel file
  */
 public static function exportFileTest($reportArray = array(), $filename = 'Filenaname_here')
 {
     Excel::create($filename, function ($excel) use($reportArray) {
         $excel->sheet('Sheetname', function ($sheet) use($reportArray) {
             $sheet->fromArray($reportArray, null, 'A1', false, false);
         });
     })->export('xls');
 }
开发者ID:aXeLbEn12,项目名称:ReliefOps,代码行数:13,代码来源:ExcelExporter.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Fixture\CatalogCategory类代码示例发布时间:2022-05-23
下一篇:
PHP models\Unitbarang类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap