private function exportnew() { $fecha = Input::get('invoice_date'); $dt = Carbon::parse($fecha); $month = $dt->month; $year = $dt->year; $fechaSearch = $month . "/" . $year; $output = fopen('php://output', 'w') or Utils::fatalError(); header('Content-Type:application/csv'); header('Content-Disposition:attachment;filename=Libro_Ventas.csv'); $BookSale = DB::table('book_sales')->select('invoice_date', 'invoice_number', 'number_autho', 'status', 'client_nit', 'client_name', 'amount', 'ice_amount', 'export_amount', 'grav_amount', 'subtotal', 'disc_bonus_amount', 'base_fiscal_debit_amount', 'fiscal_debit_amount', 'control_code')->where('account_id', '=', Auth::user()->account_id)->where('invoice_date', 'LIKE', '%' . $fechaSearch)->orderBy('invoice_date', 'asc')->get(); AccountController::exportBooksale($output, Utils::toArray($BookSale)); fclose($output); exit; }