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); }
/** * 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'); }
/** * 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')); } }
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'); }
/** * 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'); }
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()); }); }
public function exportar() { Excel::create('Usuarios', function ($excel) { $excel->sheet('Usuarios', function ($sheet) { $usuarios = \JLcourier\Entities\User::all(); $sheet->fromArray($usuarios); }); })->export('xls'); }
public function download(Request $request) { $items = $this->inventoryRepo->search($request)->get(); Excel::create('inventario', function ($excel) use($items) { $excel->sheet('Listado', function ($sheet) use($items) { $sheet->loadView('inventories.partials.table', compact('items')); }); })->export('xls'); }
public function process() { $self = $this; Excel::create($this->getFileName(), function ($excel) use($self) { ExcelHelper::genBasicSheet($excel, '銷貨', ['C' => '@', 'G' => '@', 'I' => '@'], 'K', $self->getSaleQuery(), $self->getExportHead()['sale']); ExcelHelper::genBasicSheet($excel, '退貨', ['C' => '@', 'G' => '@', 'I' => '@'], 'K', $self->getBackQuery(), $self->getExportHead()['back']); })->store('xls', storage_path('excel/exports')); return $msg = $this->send(); }
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 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 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'); }
public function download(Request $request) { $users = $this->userRepo->search($request)->get(); Excel::create('Usuarios', function ($excel) use($users) { $excel->sheet('Listado', function ($sheet) use($users) { $sheet->loadView('users.partials.table', compact('users')); }); })->export('xls'); }
public function exportar() { Excel::create('Clientes', function ($excel) { $excel->sheet('Clientes', function ($sheet) { $clientes = \JLcourier\Entities\Cliente::all(); $sheet->fromArray($clientes); }); })->export('xls'); }
public function download(Request $request) { $brands = $this->brandRepo->search($request)->get(); Excel::create('Laboratorios', function ($excel) use($brands) { $excel->sheet('Listado', function ($sheet) use($brands) { $sheet->loadView('brands.partials.table', compact('brands')); }); })->export('xls'); }
public function getAllRequestsToExcel() { $requests = \App\Request::select('id', 'first_name', 'last_name', 'description', 'created_at')->get(); Excel::create('requests', function ($excel) use($requests) { $excel->sheet('Sheet 1', function ($sheet) use($requests) { $sheet->fromArray($requests); }); })->export('xls'); }
public function export() { $data = Member::all(); Excel::create('Filename', function ($excel) use($data) { $excel->sheet('Sheetname', function ($sheet) use($data) { $sheet->fromArray($data); }); })->download('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'); }
public function download(Request $request) { $resolutions = $this->resolutionRepo->listing(); Excel::create('resoluciones', function ($excel) use($resolutions) { $excel->sheet('Listado', function ($sheet) use($resolutions) { $sheet->loadView('resolutions.partials.table', compact('resolutions')); }); })->export('xls'); }
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 ExportFacturas(Request $request) { $s = $request->input('search'); $data = null; if ($s != 1) { $data = VFacturasLineas::take(1000)->groupby('id')->get(['Fecha factura', 'serie', 'Nº', 'Nombre', 'DNI', 'Domicilio', 'Localidad', 'CP', 'Base Imponible', 'IVA', 'Total factura']); } else { if ($s == 1) { $titular = $request->input('titular'); $difunto = $request->input('difunto'); $dni = $request->input('dni'); $calle = $request->input('calle'); $desde = $request->input('desde'); $hasta = $request->input('hasta'); $concepto = $request->input('concepto'); $data = VFacturasLineas::orderBy('id', 'DESC')->where(function ($facturas) use($titular, $difunto, $dni, $calle, $desde, $hasta, $concepto) { if ($titular != "") { $facturas->where('nombre_titular', 'like', "%{$titular}%"); } if ($difunto != "") { $facturas->where('nom_difunto', 'like', "%{$difunto}%"); } if ($dni != "") { $facturas->where('dni_titular', 'like', "%{$dni}%"); } if ($calle != "") { $facturas->where('calle', 'like', "%{$calle}%"); } if ($concepto != "") { $facturas->where('concepto', 'like', "%{$concepto}%"); } if ($desde != "" && $hasta != "") { $facturas->whereBetween('inicio', array($desde, $hasta)); } else { if ($desde != "") { $facturas->where('inicio', '>=', $desde); } else { if ($hasta != "") { $facturas->where('inicio', '<=', $hasta); } } } })->groupby('id')->get(['Fecha factura', 'serie', 'Nº', 'Nombre', 'DNI', 'Domicilio', 'Localidad', 'CP', 'Base Imponible', 'IVA', 'Total factura']); } } Excel::create('Filename', function ($excel) use($data) { $excel->setTitle('Facturas'); $excel->sheet('Facturas', function ($sheet) use($data) { $sheet->fromModel($data, null, 'A1', false, true); $sheet->row(1, function ($row) { // call cell manipulation methods $row->setFontWeight('bold'); }); }); })->download('xls'); }
/** * 导出日志到 excel * * @param $cell */ public function exportExcel($cell) { // 文件名 Excel::create('系统日志', function ($excel) use($cell) { // 表名 $excel->sheet('system_logs', function ($sheet) use($cell) { $sheet->rows($cell); }); })->export('xls'); }
public function process() { set_time_limit(0); ini_set('memory_limit', '512M'); $self = $this; Excel::create($this->getFileName(), function ($excel) use($self) { ExcelHelper::genBasicSheet($excel, '表格', ['A' => '@', 'B' => '@', 'L' => '@', 'N' => '@', 'O' => '@'], 'Q', $self->getQuery(), $self->getExportHead()); })->store('xls', storage_path('excel/exports')); return $msg = $this->send(); }
public function aexcel() { Excel::create('Listado de giros', function ($excel) { $excel->sheet('Giros', function ($sheet) { /*$products = Product::all();*/ $giros = giros::select('id', 'codigo', 'name', 'afecto', 'cat_tribut')->get(); $sheet->fromArray($giros); }); })->download('xls'); }
/** * Export the given data into an Excel-compatible format. * * @param string $data * @param string $type * * @return mixed */ protected function export($data, $type) { if (!$data instanceof Collection) { $data = new Collection($data); } return Excel::create($this->filename . '-' . time(), function ($excel) use($data) { $excel->sheet('Data', function ($sheet) use($data) { $sheet->fromArray($data); }); })->export($type); }
public function getPdf($results) { Excel::create('New file', function ($excel) use($results) { $excel->sheet('New sheet', function ($sheet) use($results) { $sheet->setAutoSize(true); $sheet->setOrientation('landscape'); $sheet->setAllBorders('thin'); $sheet->loadView('results', array('report' => $results)); }); })->export('pdf'); }
public function exportData(Request $request) { $data = Product::all(); #return dd($data); Excel::create('product', function ($excel) { $excel->sheet('noname', function ($sheet) { $sheet->with(Product::all()); }); })->export('csv'); return redirect()->route('/'); }
/** * Show the form for creating a new resource. * * @return Response */ public function inventario() { Excel::create('Productos en inventario al' . Carbon::now()->format('d-m-Y') . '', function ($excel) { $excel->sheet('Productos', function ($sheet) { $products = DB::table('inventario_seriales')->join('inventario', 'inventario_seriales.id_detalle', '=', 'inventario.id_detalle')->join('renglones', 'inventario_seriales.id_renglon', '=', 'renglones.id_renglon')->where('inventario_seriales.estatus', '=', 'Stock')->select('inventario_seriales.*', 'inventario.*', 'renglones.descrip_renglon')->get(); foreach ($products as $product) { $sheet->appendRow(array($product->id_detalle, $product->descrip_renglon, $product->serial, $product->unidad_medida, $product->estatus, $product->cantidad_existencia)); } }); })->export('xls'); }
/** * 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'; }