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));
 }
Exemple #2
0
 /**
  *
  */
 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);
 }
 /**
  * @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);
 }
 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');
 }
Exemple #5
0
 public static function _loadXls($url)
 {
     $data = Excel::load($url, function ($reader) {
         return $reader->all();
     });
     return $data;
 }
 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));
 }
 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";
     }
 }
 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));
 }
 /**
  * 
  */
 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');
 }
 /**
  * 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'));
     }
 }
Exemple #11
0
 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;
 }
 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));
 }
 /**
  * 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');
 }
Exemple #14
0
 /**
  * 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();
 }
 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));
 }
 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);
 }
Exemple #17
0
 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;
 }
 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));
 }
Exemple #19
0
 /**
  * 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');
 }
Exemple #20
0
 public function export()
 {
     Excel::create('Personal', function ($excel) {
         $excel->sheet('Sheetname', function ($sheet) {
             $sheet->fromArray($this->final);
         });
     })->export('xls');
 }
 /**
  * @param $date
  * @param $subscriptions
  * @return mixed
  */
 private function exportToExcel($date, $subscriptions)
 {
     return Excel::create('InscricoesParlamentoJuvenil-' . $date, function ($excel) use($subscriptions) {
         $excel->sheet('Inscricoes', function ($sheet) use($subscriptions) {
             $sheet->fromArray($subscriptions);
         });
     })->download('xls');
 }
 protected function genCreditCardDealReport($filename)
 {
     $self = $this;
     return Excel::create($filename, function ($excel) use($self) {
         $formatArr = ['J' => '@', 'K' => '@', 'L' => '@', 'M' => '@', 'N' => '@', 'O' => '@', 'P' => '@', 'Q' => '@', 'R' => '@', 'S' => '@', 'T' => '@', 'U' => '@', 'V' => '0', 'B' => '@', 'H' => '@', 'F' => '0', 'G' => '0'];
         ExcelHelper::genBasicSheet($excel, '表格', $formatArr, 'V', $self->getCreditCardDealQuery(), $self->genCreditCardDealHead());
     });
 }
Exemple #23
0
 public function exportar()
 {
     Excel::create('Usuarios', function ($excel) {
         $excel->sheet('Usuarios', function ($sheet) {
             $usuarios = \JLcourier\Entities\User::all();
             $sheet->fromArray($usuarios);
         });
     })->export('xls');
 }
Exemple #24
0
 public function datapeserta_excel()
 {
     $datapeserta = DataPeserta::all();
     Excel::create('datapeserta', function ($excel) use($datapeserta) {
         $excel->sheet('Sheet 1', function ($sheet) use($datapeserta) {
             $sheet->fromArray($datapeserta);
         });
     })->export('xls');
 }
 public function download(Request $request)
 {
     $products = $this->productRepo->search($request)->get();
     Excel::create('Productos', function ($excel) use($products) {
         $excel->sheet('Listado', function ($sheet) use($products) {
             $sheet->loadView('products.partials.table', compact('products'));
         });
     })->export('xls');
 }
Exemple #26
0
 public function exportar()
 {
     Excel::create('Ordenes', function ($excel) {
         $excel->sheet('Ordenes', function ($sheet) {
             $ordenes = \JLcourier\Entities\Cliente::join('orden_servicios', 'clientes.id', '=', 'orden_servicios.cliente_id')->select('orden_servicios.fecha_inicio', 'orden_servicios.nro_orden', 'nombre', 'orden_servicios.tipo', 'orden_servicios.tiempo', 'orden_servicios.estado')->get();
             $sheet->fromArray($ordenes);
         });
     })->export('xls');
 }
Exemple #27
0
 public function excel()
 {
     $qdn = Info::all();
     Excel::create('QDN', function ($excel) use($qdn) {
         $excel->sheet($this->yearNow(), function ($sheet) use($qdn) {
             $sheet->fromArray($qdn);
         });
     })->download('csv');
 }
 public function gestionesRealizadasExport(Request $request)
 {
     Excel::create('Gestiones Realizadas', function ($excel) {
         $excel->sheet('Gestiones', function ($sheet) {
             $tweets = Tweet::all();
             $sheet->fromArray($tweets, null, 'A1', false, false);
         });
     })->export('csv');
 }
 public function import()
 {
     Excel::load('public/books.csv', function ($reader) {
         foreach ($reader->get() as $book) {
             Renglon::create(['descrip_renglon' => $book->id_tipo_, 'id_marca' => $book->unidad_medida, 'id_modelo' => $book->cantidad, 'unidad_medida' => $book->unidad_medida, 'cantidad' => $book->cantidad, 'existencia_minima' => $book->existencia_minima, 'foto_producto' => $book->foto_producto, 'cod_usua' => $book->cod_usua]);
         }
     });
     return Renglon::all();
 }
 /**
  * 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';
 }