public function makeSheet() { $input = Input::get('name'); $arr = []; for ($i = 0; $i < 10; $i++) { $arr[$i] = []; for ($j = 0; $j < 10; $j++) { if ($i == $j) { $arr[$i][$j] = "lol"; } else { $arr[$i][$j] = "hi"; } } } \Excel::create($input, function ($excel) { global $input; $excel->setTitle("hello " . $input); $excel->sheet('Sheeeeet!', function ($sheet) { $sheet->cell('A1', function ($cell) { $cell->setValue('hurr,'); }); $sheet->cell('A2', function ($cell) { $cell->setValue('durr.'); }); }); })->download('xls'); // Won't work lol return View::make("excel", ["message" => "Did stuff " . $input . "!"]); }
public function indexToExcel($fecha_inicio, $fecha_fin) { $egresos = Egreso::whereBetween('fecha', [$fecha_inicio, $fecha_fin])->whereCuentaBancariaId(1)->withTrashed()->with('benef', 'proyectos.fondos', 'cuentaBancaria', 'user', 'ocs', 'solicitudes')->orderBy('fecha', 'DESC')->get(); foreach ($egresos as $egreso) { !empty($egreso->cheque) ? $cheque_poliza = $egreso->cheque : ($cheque_poliza = $egreso->poliza); $proyectos = ''; $fondos = ''; if ($egreso->cuenta_id == 1 || $egreso->cuenta_id == 2) { foreach ($egreso->proyectos as $proyecto) { $proyectos .= $proyecto->proyecto; $fondos .= $proyecto->fondos[0]->fondo; } } else { $proyectos = '---'; $fondos = '---'; } $id_afin = ''; if (count($egreso->solicitudes) > 0) { foreach ($egreso->solicitudes as $solicitud) { $id_afin = $solicitud->no_afin; } } $arr_egresos[] = ['Cta. Bancaria' => $egreso->cuentaBancaria->cuenta_bancaria, 'Cheque/Póliza' => $cheque_poliza, 'Fecha' => $egreso->fecha_info, 'Beneficiario' => $egreso->benef->benef, 'Concepto' => $egreso->concepto, 'Monto' => $egreso->monto, 'Cuenta Clasificadora' => $egreso->cuenta->cuenta, 'Proyecto' => $proyectos, 'Fondo' => $fondos, 'ID AFIN' => $id_afin]; } \Excel::create('Egresos', function ($excel) use($arr_egresos) { $excel->sheet('Jul-Sep', function ($sheet) use($arr_egresos) { $sheet->fromArray($arr_egresos); }); })->download('xls'); }
public function report() { //add security to avoid stealing of information $user = Auth::user(); $club = $user->Clubs()->FirstOrFail(); $type = Input::get('expType'); $from = date('Ymd', strtotime(Input::get('expFrom'))); $to = date('Ymd', strtotime(Input::get('expTo'))); $payments = Payment::where('club_id', '=', $club->id)->with('player')->whereBetween('created_at', array($from, $to))->get(); $param = array('transaction_type' => 'cc', 'action_type' => 'refund,sale', 'condition' => 'pendingsettlement,complete,failed', 'club' => $club->id, 'start_date' => $from . '000000', 'end_date' => $to . '235959'); $payment = new Payment(); $transactions = $payment->ask($param); //return $transactions; //return json_decode(json_encode($transactions->transaction),true); // return View::make('export.lacrosse.accounting.all') // ->with('payments', $transactions->transaction); //return json_decode(json_encode($transactions->transaction),true); Excel::create('transactions', function ($excel) use($transactions) { $excel->sheet('Sheetname', function ($sheet) use($transactions) { $sheet->setOrientation('landscape'); // first row styling and writing content $sheet->loadView('export.lacrosse.accounting.all')->with('payments', $transactions->transaction); }); })->download('xlsx'); }
public function postPurchases() { $input_start_date = \Input::get('start_date'); if ($input_start_date == "") { $input_start_date = "01/01/1900"; } $start_date = \DateTime::createFromFormat('d/m/Y', $input_start_date); $input_end_date = \Input::get('end_date'); if ($input_end_date == "") { $end_date = new \DateTime("NOW"); } else { $end_date = \DateTime::createFromFormat('d/m/Y', $input_end_date); } $data = UserPricelist::where('created_at', '>=', $start_date)->where('created_at', '<=', $end_date)->orderBy('created_at', 'desc')->get(); if (count($data) == 0) { $errors = new \Illuminate\Support\MessageBag(); $errors->add('downloadError', "There's no data within the dates specified."); return \Redirect::to('admin/purchases')->withErrors($errors); } \Excel::create('Redooor_Purchases_Report', function ($excel) use($data) { $excel->sheet('Purchases Report', function ($sheet) use($data) { $sheet->loadView('redminportal::reports/purchases')->with('data', $data); }); })->download('csv'); }
public static function Ajax($param) { switch ($param) { case 'byCategory': $id = e(Input::get('id')); $productos = Producto::where('categoria', "=", $id)->take(20)->get()->toJson(); echo $productos; break; case 'excelByCategory': // print_r(Input::all()); $catName = utf8_decode(utf8_encode(Input::get('catName'))); $id = Input::get('id'); $productos = Producto::where("categoria", "=", $id)->get()->toArray(); $lista = self::formatExcel($productos); Excel::create("CAT" . $id, function ($excel) use($lista) { $excel->sheet('productos', function ($sheet) use($lista) { $sheet->fromArray($lista, null, 'A0', true); }); })->store('xls', public_path('/exports/categoria')); echo url("exports/categoria/CAT" . $id . ".xls"); break; default: # code... break; } }
public static function getRelatorioOperacoes() { Excel::create('Planilha de Controle da Farmacia - Ocorrencias', function ($excel) { $excel->sheet('Ref. ', function ($sheet) { $sheet->mergeCells('A1:J5'); $sheet->setHeight(1, 50); $sheet->row(1, function ($row) { $row->setFontFamily('Arial'); $row->setFontSize(20); }); $sheet->cell('A1', function ($cell) { $cell->setAlignment('center'); }); $sheet->getStyle('D')->getAlignment()->setWrapText(true); $sheet->row(1, array('Frizelo Frigorificos Ltda.')); $periodo = explode('-', Input::get('periodo')); $a = []; foreach (Ocorrencia::whereBetween('data_hora', $periodo)->get() as $val) { $a[] = ['Nome' => $val->colaborador->nome, 'Setor' => !empty($val->colaborador->setor->descricao) ? $val->colaborador->setor->descricao : null, 'Data' => $val->data_hora, 'Queixa' => empty($val->queixa->descricao) ? null : $val->queixa->descricao, 'Descrição / Motivo' => $val->relato . ' - ' . $val->diagnostico, 'Conduta / Destino' => $val->conduta . ' - ' . $val->destino]; } $sheet->setAutoFilter('A6:J6'); $sheet->setOrientation('landscape'); $sheet->fromArray($a, null, 'A6', true); }); })->export('xls'); }
/** * Export students (query in session) to excel * * @return mixed */ public function export() { $students = $this->search->createQuery(session('students')) ? $this->search->createQuery(session('students'))->get() : Student::get(); return \Excel::create('Students', function ($excel) use($students) { $excel->sheet('students', function ($sheet) use($students) { $sheet->fromArray($students->toArray()); }); })->download('xls'); }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { $devices = Device::all(); \Excel::create("Device List", function ($excel) use($devices) { $excel->sheet('Sheet1', function ($sheet) use($devices) { $sheet->fromModel($devices, null, 'A1', true); })->download('xls'); }); }
public function writeExcel() { dd(\Schema::getColumnListing()); Excel::create('Filename', function ($excel) { $excel->sheet('Sheetname', function ($sheet) { // Sheet manipulation }); })->store('xlsx', storage_path('excel')); }
/** * Export students (query in session) to excel * * @return mixed */ public function export() { $students = session()->has('students') ? session('students')->get() : Student::get(); return \Excel::create('Students', function ($excel) use($students) { $excel->sheet('students', function ($sheet) use($students) { $sheet->fromArray($students->toArray()); }); })->download('xls'); }
private function generarExcel($vista, $data) { $nom_reporte = $this->nombreReporte($vista); \Excel::create($nom_reporte, function ($excel) use($vista, $data) { $excel->sheet('Hoja 1', function ($sheet) use($vista, $data) { $sheet->loadView($vista, $data); //$sheet->getStyle('A:E')->getAlignment()->setWrapText(true); }); })->download('xls'); }
/** * Show the form for creating a new resource. * * @return Response */ public function getsheet() { $inputs = Input::all(); $input = (object) $inputs; $subjects = Subject::select('name')->where('class', $input->class)->orderby('code', 'asc')->get(); if (count($subjects) < 1) { return Redirect::to('/tabulation')->withInput(Input::all())->with("error", "There are not subjects for this class!"); } $students = Student::select('regiNo', 'firstName', 'middleName', 'lastName')->where('class', $input->class)->where('section', $input->section)->where('session', trim($input->session))->where('shift', $input->shift)->get(); if (count($students) < 1) { return Redirect::to('/tabulation')->withInput(Input::all())->with("error", "There are not student for this class!"); } $merit = DB::table('MeritList')->select('regiNo', 'grade', 'point', 'totalNo')->where('exam', $input->exam)->where('class', $input->class)->where('session', trim($input->session))->orderBy('point', 'DESC')->orderBy('totalNo', 'DESC')->get(); if (count($merit) < 1) { return Redirect::to('/tabulation')->withInput(Input::all())->with("error", "Marks not submit or result not generate for this exam!"); } foreach ($students as $student) { $marks = Marks::select('written', 'mcq', 'practical', 'ca', 'total', 'grade', 'point')->where('regiNo', $student->regiNo)->where('exam', $input->exam)->orderby('subject', 'asc')->get(); if (count($marks) < 1) { return Redirect::to('/tabulation')->withInput(Input::all())->with("error", "Marks not submited yet!"); } /*$marks = DB::table('Marks') ->join('MeritList', 'Marks.regiNo', '=', 'MeritList.regiNo') ->select('Marks.written','Marks.mcq', 'Marks.practical', 'Marks.ca', 'Marks.total', 'Marks.grade', 'Marks.point', 'MeritList.totalNo', 'MeritList.grade as tgrade','MeritList.point as tpoint') ->where('Marks.regiNo',$student->regiNo) ->where('Marks.exam', '=',$input->exam) ->orderby('Marks.subject','asc') ->get();*/ $meritdata = new Meritdata(); $position = 0; foreach ($merit as $m) { $position++; if ($m->regiNo === $student->regiNo) { $meritdata->regiNo = $m->regiNo; $meritdata->point = $m->point; $meritdata->grade = $m->grade; $meritdata->position = $position; $meritdata->totalNo = $m->totalNo; break; } } $student->marks = $marks; $student->meritdata = $meritdata; } $cl = ClassModel::Select('name')->where('code', $input->class)->first(); $input->class = $cl->name; $fileName = $input->class . '-' . $input->section . '-' . $input->session . '-' . $input->exam; // return $students; Excel::create($fileName, function ($excel) use($input, $subjects, $students) { $excel->sheet('New sheet', function ($sheet) use($input, $subjects, $students) { $sheet->loadView('app.excel', compact('subjects', 'input', 'students')); }); })->download('xlsx'); }
/** * Show the application welcome screen to the user. * * @return Response */ public function export($orders, $details = null) { \Excel::create('Export Commandes', function ($excel) use($orders, $details) { $excel->sheet('Export_Commandes', function ($sheet) use($orders, $details) { $names = config('columns.names'); $view = isset($details) ? 'details' : 'orders'; $sheet->setOrientation('landscape'); $sheet->loadView('backend.export.' . $view, ['orders' => $orders, 'generator' => $this->generator, 'names' => $names]); }); })->export('xls'); }
public static function getExcel($data, $filename = null) { if (!$filename) { $filename = \Str::slug('statistics' . '_' . time()); } return \Excel::create($filename, function ($excel) use($data) { $excel->sheet('sheet1', function ($sheet) use($data) { $sheet->fromModel($data, null, 'A1', true); }); })->download('xls'); }
public function xlStockOut() { $data = StockOut::getAllProductsStackOutExl(); $data = array_map(function ($data) { return json_decode(json_encode($data), true); }, $data); Excel::create('Stock_Out_Product_List', function ($excel) use($data) { $excel->sheet('Sheetname', function ($sheet) use($data) { $sheet->fromArray($data); }); })->export('xls'); }
public function export($data, $filename = '') { $excel = \Excel::create($filename, function ($excel) use($data) { $excel->sheet('export', function ($sheet) use($data) { $sheet->fromArray($data); }); }); if (app()->environment('testing')) { $excel->store('csv'); } return $excel->export('csv')->download('xls'); }
/** * Display a listing of the resource. * GET /modules * * @return Response */ public function index() { // return Excel::create('Mastersheet BQu version', function ($excel) { $excel->sheet('Marks-Input Sheet', function ($sheet) { $sheet->loadView('export.input_sheet')->with('student_module_marks_input', StudentModuleMarksInput::all()->reverse())->with('module_element', ModuleElement::all())->with('modules', Module::all())->with('courses', ApplicationCourse::all())->with('users', User::all()); }); $excel->setcreator('BQu'); $excel->setlastModifiedBy('BQu'); $excel->setcompany('BQuServices(PVT)LTD'); $excel->setmanager('Rajitha'); })->download('xls'); }
public function getGenerate($desde, $hasta) { $reportes = Reporte::where('fecha', '>=', $desde)->where('fecha', '<=', $hasta)->get(); $facturas = Factura::all(); $agente = Agente::find(1); $proveedores = Proveedor::all(); $code = str_random(10); Excel::create('Facturas desde ' . $desde . ' hasta ' . $hasta . '-' . $code, function ($excel) use($reportes, $facturas, $agente, $proveedores) { $excel->sheet('Reportes', function ($sheet) use($reportes, $facturas, $agente, $proveedores) { $sheet->loadView('excel.generate')->with('reportes', $reportes)->with('facturas', $facturas)->with('agente', $agente)->with('proveedores', $proveedores); }); })->export('xls'); }
public function excelDownload() { return \Excel::create(\Carbon\Carbon::now()->format('jFYhis'), function ($excel) { $excel->setTitle('Entradas Breaking Bind - Halloween 2015'); $excel->setCreator('Fundaseth, S.L.')->setCompany('Fundaseth, S.L.'); $excel->setDescription('Registro de las Inscripciones del acto de sensibilización "Súmate al Efecto Mariposa"'); $excel->sheet('First sheet', function ($sheet) { $allRegistrations = $this->registrations->all(['activity']); $allRegistrations = $allRegistrations->sortBy('timeslot')->sortBy('name'); $sheet->loadView('templates.excel-download')->with('allRegistrations', $allRegistrations); }); })->download('xlsx'); }
public function create_excel() { Excel::create('Filename', function ($excel) { $excel->sheet('Sheetname', function ($sheet) { $sheet->row(1, array('correos', 'fecha')); $count = 3; $correos = DB::table('correos')->where('check', 'si')->get(); foreach ($correos as $key) { $sheet->row($count, array($key->email, $key->fecha)); } }); })->export('xls'); }
public function export($entity, $fileType) { $appHelper = new libs\AppHelper(); $className = $appHelper->getNameSpace() . $entity; $data = $className::get(); if (strcmp($fileType, "excel") == 0) { $excel = \App::make('Excel'); \Excel::create($entity, function ($excel) use($data) { $excel->sheet('Sheet1', function ($sheet) use($data) { $sheet->fromModel($data); }); })->export('xls'); } }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { \Excel::create('test', function ($excel) { $excel->setTitle('test excel'); $excel->setCreator('kotamat')->setCompany('A+'); $excel->setDescription('test description'); $excel->sheet('sheet1', function ($sheet) { /* $sheet->row(1, ['attr1', 'attr2']); $sheet->row(2, ['test1', 'test2']); */ $sheet->fromArray([['attr1', 'attr2'], ['test1', 'test2'], ['test1', 'test2'], ['test1', 'test2'], ['test1', 'test2']], null, 'A1', false, false); }); })->store('csv'); }
public function excel() { $transaksi = \DB::table('transaksis')->join('users', 'users.id', '=', 'transaksis.user_id')->join('nasabahs', 'nasabahs.id', '=', 'transaksis.nasabah_id')->get(); \Excel::create('Data Transaksi', function ($excel) use($transaksi) { $excel->sheet('data transaksi', function ($sheet) use($transaksi) { $row = 1; $sheet->row($row, array('No', 'Tanggal', 'No. Rekening', 'Nama', 'Jumlah', 'Operator')); $no = 1; foreach ($transaksi as $t) { $sheet->row(++$row, array($no, tgl_id($t->created_at), $t->no_rekening, $t->nama_lengkap, $t->total, $t->name)); $no++; } }); })->export('xls'); }
public function actionImprimirExcel() { $tUsuario = TUsuario::whereRaw('nombreUsuario=?', [Session::get('usuario')])->get(); $listaTDirectorio = TDirectorio::whereRaw('idUsuario=?', [$tUsuario[0]->idUsuario])->get(); Excel::create('Lista de directorio', function ($excel) use($listaTDirectorio) { $excel->sheet('Sheetname', function ($sheet) use($listaTDirectorio) { $data = []; array_push($data, array('USUARIO', 'NOMBRE CONTACTO', 'DIRECCION', 'TELEFONO', 'FECHA DE NACIMINETO', 'FECHA DE REGISTRO')); foreach ($listaTDirectorio as $key => $value) { array_push($data, array($value->tUsuario->nombreUsuario, $value->nombreCompleto, $value->direccion, $value->telefono, (string) $value->fechaNacimiento, (string) $value->created_at)); } // array_push($data,array('Kevin','','','Arnold','Arias','Figueroa')); $sheet->fromArray($data, null, 'A1', false, false); }); })->download('xlsx'); }
public function exportarEmail() { Excel::create('Clientes' . date('Ymd'), function ($excel) { $excel->sheet('Clientes', function ($sheet) { $clientes = Cliente::select('email')->distinct()->get(); $datos = array(array('Email')); foreach ($clientes as $cliente) { array_push($datos, array($cliente->email)); } $sheet->fromModel($datos, null, 'A1', false, false); $sheet->row(1, function ($row) { // call cell manipulation methods $row->setFontWeight('bold'); }); }); })->download('xls'); }
public function Excelcarini() { Excel::create('Contactos', function ($excel) { $excel->sheet('CrH', function ($sheet) { $data = array(); $results = DB::select("SELECT id_formulario, nombre, cedula, correo, telfijo, celular, departamento, municipio, ingresos, prestamo, (CASE WHEN A = 0 THEN 'NO' ELSE 'SI' END ) 'Banco de Bogotá', (CASE WHEN B = 0 THEN 'NO' ELSE 'SI' END ) 'Banco de Occidente', (CASE WHEN C = 0 THEN 'NO' ELSE 'SI' END ) 'Banco Popular', (CASE WHEN D = 0 THEN 'NO' ELSE 'SI' END ) 'Banco AV Villas', habeasdata, llamar, created_at FROM(SELECT id_formulario, nombre, cedula, correo, telfijo, celular, departamento, municipio, ingresos, prestamo, Sum(CASE WHEN formulariob.id_banco = 1 THEN formulariob.id_banco ELSE 0 END ) as A, Sum(CASE WHEN formulariob.id_banco = 2 THEN formulariob.id_banco ELSE 0 END ) as B, Sum(CASE WHEN formulariob.id_banco = 3 THEN formulariob.id_banco ELSE 0 END ) as C, Sum(CASE WHEN formulariob.id_banco = 4 THEN formulariob.id_banco ELSE 0 END ) as D, (CASE WHEN habeasdata = 1 THEN 'SI' ELSE 'NO' END) habeasdata, (CASE WHEN llamar = 1 THEN 'SI' ELSE 'NO' END) llamar, created_at FROM(SELECT formularioa.id_formulario, formularioa.nombre, formularioa.cedula, formularioa.correo, formularioa.telfijo, formularioa.celular, formularioa.departamento, formularioa.municipio, formularioa.ingresos, formularioa.prestamo, fromubanco.id_banco, formularioa.habeasdata, formularioa.llamar, formularioa.created_at FROM(SELECT formulario.id_formulario, formulario.nombre, formulario.cedula, formulario.correo, formulario.telfijo, formulario.celular, municipios.DEPTO as departamento, municipios.MUNICIPIO as municipio, formulario.ingresos, formulario.prestamo, formulario.habeasdata, formulario.llamar, formulario.created_at FROM formulario INNER JOIN municipios ON formulario.municipio = municipios.CODANE) as formularioa INNER JOIN fromubanco ON formularioa.id_formulario = fromubanco.id_formulario) as formulariob group by formulariob.id_formulario) as formulariofinal"); foreach ($results as $result) { $data[] = (array) $result; } $sheet->with($data); $sheet->freezeFirstRow(); $sheet->setAutoFilter(); $sheet->cells('A1:R1', function ($cells) { $cells->setBackground('#dadae3'); }); })->download('xlsx'); }); }
public function getExportExcel() { if ($_SESSION["dataEX"]) { $this->dataEX['lists'] = $_SESSION["dataEX"]; $this->dataEX['siteName'] = $_SESSION["dataSiteName"]; $this->dataEX['date'] = $_SESSION["dataDate"]; } else { return Redirect::to(Route('ReportPublisherShowList')); } $excel = App::make('excel'); $name = 'report-earnings-' . date('d-m-Y H:i:s'); Excel::create($name, function ($excel) { $excel->sheet('Publisher Advanced Report', function ($sheet) { $sheet->loadView('viewExcel', $this->dataEX); }); })->export('xlsx'); return View::make('viewExcel')->with('lists', $this->dataEX); }
public function exportExcel($data) { $excel = Excel::create('Payment', function ($excel) { // Set the title $excel->setTitle('Payment Request'); // Chain the setters $excel->setCreator('Yomedia Adnetwork'); $excel->setCompany('Pinetech'); // Call them separately $excel->setDescription('Publisher payment request'); }); $excel->sheet('PaymentRequest', function ($sheet) use($data) { $sheet->loadView('advertiser_manager.publisher_advertiser_manager.reportPaymentRequest', $data); $sheet->setColumnFormat(array('C' => '#,##0', 'D' => '#,##0', 'E' => '#,##0')); }); ob_end_clean(); $excel->download('xls'); exit; }
/** * Funcion para obtener el reporte con todos los cursos de un ciclo escolar * @author Rebeca Abigail * @param $ciclo Identificación de ciclo escolar */ public function getReporteByCiclo($ciclo) { $cursos = Cursos::where('ciclo_escolar', 'like', $ciclo)->get(); $store = \Excel::create('ReporteDeCicloEscolar_' . $ciclo, function ($excel) use(&$cursos) { foreach ($cursos as $curso) { $name_curso = strlen($curso->name) > 31 ? substr($curso->name, 0, 30) : $curso->name; $excel->sheet($name_curso, function ($sheet) use(&$curso) { $detalle_curso = Detalle_cursos::join('users', function ($join) { $join->on('users.id', '=', 'detalle_cursos.id'); })->join('departamentos', function ($join) { $join->on('departamentos.id_departamento', '=', 'users.id_departamento'); })->select(['detalle_cursos.id_curso', 'users.name', 'departamentos.name AS departamento'])->where('detalle_cursos.id_curso', $curso->id_curso)->get(); $data = ['name_curso' => $curso->name, 'asistentes' => $detalle_curso]; $sheet->loadView('reporte', ['info' => $data]); }); } })->store('xlsx', false, true); return response()->json($store); }
public function postDownloadFile(Request $request) { if (Auth::guest()) { return Redirect()->to('/'); } else { //dd($request->all()); //$this->cuestionarios =(array) \DB::table('cuestionarios') // ->where('created_at', '>=', $request->fecha_inicio) // ->where('created_at', '<=', $request->fecha_fin) // ->get(); $this->cuestionarios = Cuestionarios::select('cuestionarios.idCuestionario as Identificador', 'cuestionarios.sexo as Sexo', 'cuestionarios.utilidad as Utilidad', 'cuestionarios.observaciones as Observaciones', 'cuestionarios.created_at as Fecha')->where('created_at', '>=', $request->fecha_inicio)->where('created_at', '<=', $request->fecha_fin)->get(); //$this->cuestionarios =(array) \DB::select('select * from cuestionarios where created_at >= ? and created_at <= ?', // [$request->fecha_inicio,$request->fecha_fin]); \Excel::create('Listado de Cuestionarios', function ($excel) { $excel->sheet('Cuestionarios', function ($sheet) { $sheet->fromArray($this->cuestionarios); }); })->download('xls'); } }