1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-18 00:53:10 +01:00

Improved data export

This commit is contained in:
Hillel Coren 2015-11-12 22:36:28 +02:00
parent 933b94e8b5
commit f574a79fe6
31 changed files with 1851 additions and 329 deletions

View File

@ -28,12 +28,24 @@ class SendRenewalInvoices extends Command
{ {
$this->info(date('Y-m-d').' Running SendRenewalInvoices...'); $this->info(date('Y-m-d').' Running SendRenewalInvoices...');
$today = new DateTime(); $today = new DateTime();
$sentTo = [];
// get all accounts with pro plans expiring in 10 days // get all accounts with pro plans expiring in 10 days
$accounts = Account::whereRaw('datediff(curdate(), pro_plan_paid) = 355')->get(); $accounts = Account::whereRaw('datediff(curdate(), pro_plan_paid) = 355')
->orderBy('id')
->get();
$this->info(count($accounts).' accounts found'); $this->info(count($accounts).' accounts found');
foreach ($accounts as $account) { foreach ($accounts as $account) {
// don't send multiple invoices to multi-company users
if ($userAccountId = $this->accountRepo->getUserAccountId($account)) {
if (isset($sentTo[$userAccountId])) {
continue;
} else {
$sentTo[$userAccountId] = true;
}
}
$client = $this->accountRepo->getNinjaClient($account); $client = $this->accountRepo->getNinjaClient($account);
$invitation = $this->accountRepo->createNinjaInvoice($client); $invitation = $this->accountRepo->createNinjaInvoice($client);
@ -43,6 +55,7 @@ class SendRenewalInvoices extends Command
$invoice->save(); $invoice->save();
$this->mailer->sendInvoice($invoice); $this->mailer->sendInvoice($invoice);
$this->info("Sent invoice to {$client->getDisplayName()}");
} }
$this->info('Done'); $this->info('Done');

View File

@ -62,7 +62,7 @@ class AccountApiController extends BaseAPIController
public function show() public function show()
{ {
$account = Auth::user()->account; $account = Auth::user()->account;
$account->load('clients.getInvoices.invoice_items', 'users'); $account->loadAllData();
$account = $this->createItem($account, new AccountTransformer); $account = $this->createItem($account, new AccountTransformer);
$response = [ $response = [

View File

@ -0,0 +1,149 @@
<?php namespace App\Http\Controllers;
use Auth;
use Excel;
use Illuminate\Http\Request;
use League\Fractal\Manager;
use League\Fractal\Resource\Item;
use App\Ninja\Serializers\ArraySerializer;
use App\Ninja\Transformers\AccountTransformer;
use App\Models\Client;
use App\Models\Contact;
use App\Models\Credit;
use App\Models\Task;
use App\Models\Invoice;
use App\Models\Payment;
class ImportExportController extends BaseController
{
public function doExport(Request $request)
{
$format = $request->input('format');
$date = date('Y-m-d');
$fileName = "invoice-ninja-{$date}";
if ($format === 'JSON') {
return $this->returnJSON($request, $fileName);
} elseif ($format === 'CSV') {
return $this->returnCSV($request, $fileName);
} else {
return $this->returnXLS($request, $fileName);
}
}
private function returnJSON($request, $fileName)
{
$output = fopen('php://output', 'w') or Utils::fatalError();
header('Content-Type:application/json');
header("Content-Disposition:attachment;filename={$fileName}.json");
$manager = new Manager();
$manager->setSerializer(new ArraySerializer());
$account = Auth::user()->account;
$account->loadAllData();
$resource = new Item($account, new AccountTransformer);
$data = $manager->createData($resource)->toArray();
return response()->json($data);
}
private function returnCSV($request, $fileName)
{
$data = $this->getData($request);
return Excel::create($fileName, function($excel) use ($data) {
$excel->sheet('', function($sheet) use ($data) {
$sheet->loadView('export', $data);
});
})->download('csv');
}
private function returnXLS($request, $fileName)
{
$user = Auth::user();
$data = $this->getData($request);
return Excel::create($fileName, function($excel) use ($user, $data) {
$excel->setTitle($data['title'])
->setCreator($user->getDisplayName())
->setLastModifiedBy($user->getDisplayName())
->setDescription('')
->setSubject('')
->setKeywords('')
->setCategory('')
->setManager('')
->setCompany($user->account->getDisplayName());
foreach ($data as $key => $val) {
if ($key === 'account' || $key === 'title' || $key === 'multiUser') {
continue;
}
$label = trans("texts.{$key}");
$excel->sheet($label, function($sheet) use ($key, $data) {
if ($key === 'quotes') {
$key = 'invoices';
$data['entityType'] = ENTITY_QUOTE;
}
$sheet->loadView("export.{$key}", $data);
});
}
})->download('xls');
}
private function getData($request)
{
$account = Auth::user()->account;
$data = [
'account' => $account,
'title' => 'Invoice Ninja v' . NINJA_VERSION . ' - ' . $account->formatDateTime($account->getDateTime()),
'multiUser' => $account->users->count() > 1
];
if ($request->input(ENTITY_CLIENT)) {
$data['clients'] = Client::scope()
->with('user', 'contacts', 'country')
->get();
$data['contacts'] = Contact::scope()
->with('user', 'client.contacts')
->get();
$data['credits'] = Credit::scope()
->with('user', 'client.contacts')
->get();
}
if ($request->input(ENTITY_TASK)) {
$data['tasks'] = Task::scope()
->with('user', 'client.contacts')
->get();
}
if ($request->input(ENTITY_INVOICE)) {
$data['invoices'] = Invoice::scope()
->with('user', 'client.contacts', 'invoice_status')
->where('is_quote', '=', false)
->where('is_recurring', '=', false)
->get();
$data['quotes'] = Invoice::scope()
->with('user', 'client.contacts', 'invoice_status')
->where('is_quote', '=', true)
->where('is_recurring', '=', false)
->get();
}
if ($request->input(ENTITY_PAYMENT)) {
$data['payments'] = Payment::scope()
->with('user', 'client.contacts', 'payment_type', 'invoice', 'account_gateway.gateway')
->get();
}
return $data;
}
}

View File

@ -131,6 +131,7 @@ Route::group(['middleware' => 'auth'], function() {
Route::post('user/setTheme', 'UserController@setTheme'); Route::post('user/setTheme', 'UserController@setTheme');
Route::post('remove_logo', 'AccountController@removeLogo'); Route::post('remove_logo', 'AccountController@removeLogo');
Route::post('account/go_pro', 'AccountController@enableProPlan'); Route::post('account/go_pro', 'AccountController@enableProPlan');
Route::post('/export', 'ImportExportController@doExport');
Route::resource('gateways', 'AccountGatewayController'); Route::resource('gateways', 'AccountGatewayController');
Route::get('api/gateways', array('as'=>'api.gateways', 'uses'=>'AccountGatewayController@getDatatable')); Route::get('api/gateways', array('as'=>'api.gateways', 'uses'=>'AccountGatewayController@getDatatable'));
@ -505,19 +506,15 @@ if (!defined('CONTACT_EMAIL')) {
/* /*
// Log all SQL queries to laravel.log // Log all SQL queries to laravel.log
Event::listen('illuminate.query', function($query, $bindings, $time, $name) if (Utils::isNinjaDev()) {
{ Event::listen('illuminate.query', function($query, $bindings, $time, $name) {
$data = compact('bindings', 'time', 'name'); $data = compact('bindings', 'time', 'name');
// Format binding data for sql insertion // Format binding data for sql insertion
foreach ($bindings as $i => $binding) foreach ($bindings as $i => $binding) {
{ if ($binding instanceof \DateTime) {
if ($binding instanceof \DateTime)
{
$bindings[$i] = $binding->format('\'Y-m-d H:i:s\''); $bindings[$i] = $binding->format('\'Y-m-d H:i:s\'');
} } elseif (is_string($binding)) {
else if (is_string($binding))
{
$bindings[$i] = "'$binding'"; $bindings[$i] = "'$binding'";
} }
} }
@ -527,7 +524,8 @@ Event::listen('illuminate.query', function($query, $bindings, $time, $name)
$query = vsprintf($query, $bindings); $query = vsprintf($query, $bindings);
Log::info($query, $data); Log::info($query, $data);
}); });
}
*/ */
/* /*

View File

@ -202,6 +202,20 @@ class Account extends Eloquent
return $date->format($this->getCustomDateFormat()); return $date->format($this->getCustomDateFormat());
} }
public function formatDateTime($date)
{
if (!$date) {
return null;
}
return $date->format($this->getCustomDateTimeFormat());
}
public function getCustomDateTimeFormat()
{
return $this->datetime_format ? $this->datetime_format->format : DEFAULT_DATETIME_FORMAT;
}
public function getGatewayByType($type = PAYMENT_TYPE_ANY) public function getGatewayByType($type = PAYMENT_TYPE_ANY)
{ {
foreach ($this->account_gateways as $gateway) { foreach ($this->account_gateways as $gateway) {
@ -423,6 +437,11 @@ class Account extends Eloquent
$this->save(); $this->save();
} }
public function loadAllData()
{
$this->load('clients.getInvoices.invoice_items', 'clients.getQuotes.invoice_items', 'users', 'clients.contacts');
}
public function loadLocalizationSettings($client = false) public function loadLocalizationSettings($client = false)
{ {
$this->load('timezone', 'date_format', 'datetime_format', 'language'); $this->load('timezone', 'date_format', 'datetime_format', 'language');

View File

@ -5,11 +5,16 @@ use DB;
use Carbon; use Carbon;
use App\Events\ClientWasCreated; use App\Events\ClientWasCreated;
use App\Events\ClientWasUpdated; use App\Events\ClientWasUpdated;
use Laracasts\Presenter\PresentableTrait;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
class Client extends EntityModel class Client extends EntityModel
{ {
use PresentableTrait;
use SoftDeletes; use SoftDeletes;
protected $presenter = 'App\Ninja\Presenters\ClientPresenter';
protected $dates = ['deleted_at']; protected $dates = ['deleted_at'];
protected $fillable = [ protected $fillable = [

View File

@ -27,6 +27,11 @@ class Contact extends EntityModel
return $this->belongsTo('App\Models\Account'); return $this->belongsTo('App\Models\Account');
} }
public function user()
{
return $this->belongsTo('App\Models\User');
}
public function client() public function client()
{ {
return $this->belongsTo('App\Models\Client'); return $this->belongsTo('App\Models\Client');

View File

@ -2,18 +2,26 @@
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use App\Events\CreditWasCreated; use App\Events\CreditWasCreated;
use Laracasts\Presenter\PresentableTrait;
class Credit extends EntityModel class Credit extends EntityModel
{ {
use SoftDeletes; use SoftDeletes;
use PresentableTrait;
protected $dates = ['deleted_at']; protected $dates = ['deleted_at'];
protected $presenter = 'App\Ninja\Presenters\CreditPresenter';
public function account() public function account()
{ {
return $this->belongsTo('App\Models\Account'); return $this->belongsTo('App\Models\Account');
} }
public function user()
{
return $this->belongsTo('App\Models\User');
}
public function invoice() public function invoice()
{ {
return $this->belongsTo('App\Models\Invoice')->withTrashed(); return $this->belongsTo('App\Models\Invoice')->withTrashed();

View File

@ -2,11 +2,15 @@
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use App\Events\PaymentWasCreated; use App\Events\PaymentWasCreated;
use Laracasts\Presenter\PresentableTrait;
class Payment extends EntityModel class Payment extends EntityModel
{ {
use PresentableTrait;
use SoftDeletes; use SoftDeletes;
protected $dates = ['deleted_at']; protected $dates = ['deleted_at'];
protected $presenter = 'App\Ninja\Presenters\PaymentPresenter';
public function invoice() public function invoice()
{ {
@ -38,6 +42,16 @@ class Payment extends EntityModel
return $this->belongsTo('App\Models\Contact'); return $this->belongsTo('App\Models\Contact');
} }
public function account_gateway()
{
return $this->belongsTo('App\Models\AccountGateway');
}
public function payment_type()
{
return $this->belongsTo('App\Models\PaymentType');
}
public function getRoute() public function getRoute()
{ {
return "/payments/{$this->public_id}/edit"; return "/payments/{$this->public_id}/edit";

View File

@ -3,10 +3,14 @@
use DB; use DB;
use Utils; use Utils;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
use Laracasts\Presenter\PresentableTrait;
class Task extends EntityModel class Task extends EntityModel
{ {
use SoftDeletes; use SoftDeletes;
use PresentableTrait;
protected $presenter = 'App\Ninja\Presenters\TaskPresenter';
public function account() public function account()
{ {
@ -18,6 +22,11 @@ class Task extends EntityModel
return $this->belongsTo('App\Models\Invoice'); return $this->belongsTo('App\Models\Invoice');
} }
public function user()
{
return $this->belongsTo('App\Models\User');
}
public function client() public function client()
{ {
return $this->belongsTo('App\Models\Client')->withTrashed(); return $this->belongsTo('App\Models\Client')->withTrashed();

View File

@ -0,0 +1,28 @@
<?php namespace App\Ninja\Presenters;
use Utils;
use Laracasts\Presenter\Presenter;
class ClientPresenter extends Presenter {
public function balance()
{
$amount = $this->entity->balance;
$currencyId = $this->entity->currency_id;
return Utils::formatMoney($amount, $currencyId);
}
public function paid_to_date()
{
$amount = $this->entity->paid_to_date;
$currencyId = $this->entity->currency_id;
return Utils::formatMoney($amount, $currencyId);
}
public function country()
{
return $this->entity->country ? $this->entity->country->name : '';
}
}

View File

@ -0,0 +1,35 @@
<?php namespace App\Ninja\Presenters;
use Utils;
use Laracasts\Presenter\Presenter;
class CreditPresenter extends Presenter {
public function client()
{
return $this->entity->client ? $this->entity->client->getDisplayName() : '';
}
public function credit_date()
{
return Utils::fromSqlDate($this->entity->credit_date);
}
public function amount()
{
$amount = $this->entity->amount;
$currencyId = $this->entity->client->currency_id;
return Utils::formatMoney($amount, $currencyId);
}
public function balance()
{
$amount = $this->entity->balance;
$currencyId = $this->entity->client->currency_id;
return Utils::formatMoney($amount, $currencyId);
}
}

View File

@ -5,6 +5,16 @@ use Laracasts\Presenter\Presenter;
class InvoicePresenter extends Presenter { class InvoicePresenter extends Presenter {
public function client()
{
return $this->entity->client ? $this->entity->client->getDisplayName() : '';
}
public function user()
{
return $this->entity->user->getDisplayName();
}
public function balance_due() public function balance_due()
{ {
$amount = $this->entity->getRequestedAmount(); $amount = $this->entity->getRequestedAmount();
@ -13,4 +23,47 @@ class InvoicePresenter extends Presenter {
return Utils::formatMoney($amount, $currencyId); return Utils::formatMoney($amount, $currencyId);
} }
public function status()
{
$status = $this->entity->invoice_status ? $this->entity->invoice_status->name : 'draft';
$status = strtolower($status);
return trans("texts.status_{$status}");
}
public function balance()
{
$amount = $this->entity->balance;
$currencyId = $this->entity->client->currency_id;
return Utils::formatMoney($amount, $currencyId);
}
public function amount()
{
$amount = $this->entity->amount;
$currencyId = $this->entity->client->currency_id;
return Utils::formatMoney($amount, $currencyId);
}
public function discount()
{
if ($this->entity->is_amount_discount) {
$currencyId = $this->entity->client->currency_id;
return Utils::formatMoney($this->entity->discount, $currencyId);
} else {
return $this->entity->discount . '%';
}
}
public function invoice_date()
{
return Utils::fromSqlDate($this->entity->invoice_date);
}
public function due_date()
{
return Utils::fromSqlDate($this->entity->due_date);
}
} }

View File

@ -0,0 +1,35 @@
<?php namespace App\Ninja\Presenters;
use Utils;
use Laracasts\Presenter\Presenter;
class PaymentPresenter extends Presenter {
public function client()
{
return $this->entity->client ? $this->entity->client->getDisplayName() : '';
}
public function payment_date()
{
return Utils::fromSqlDate($this->entity->payment_date);
}
public function amount()
{
$amount = $this->entity->amount;
$currencyId = $this->entity->client->currency_id;
return Utils::formatMoney($amount, $currencyId);
}
public function method()
{
if ($this->entity->account_gateway) {
return $this->entity->account_gateway->gateway->name;
} elseif ($this->entity->payment_type) {
return $this->entity->payment_type->name;
}
}
}

View File

@ -0,0 +1,18 @@
<?php namespace App\Ninja\Presenters;
use Utils;
use Laracasts\Presenter\Presenter;
class TaskPresenter extends Presenter {
public function client()
{
return $this->entity->client ? $this->entity->client->getDisplayName() : '';
}
public function user()
{
return $this->entity->user->getDisplayName();
}
}

View File

@ -508,4 +508,12 @@ class AccountRepository
$token->save(); $token->save();
} }
} }
public function getUserAccountId($account)
{
$user = $account->users()->first();
$userAccount = $this->findUserAccounts($user->id);
return $userAccount ? $userAccount->id : false;
}
} }

View File

@ -11,7 +11,7 @@ class QuoteTransformer extends EntityTransformer
public function includeInvoiceItems($invoice) public function includeInvoiceItems($invoice)
{ {
return $this->collection($invoice->invoice_items, new InvoiceItemTransformer); return $this->collection($invoice->invoice_items, new InvoiceItemTransformer($this->account));
} }
public function transform(Invoice $invoice) public function transform(Invoice $invoice)

View File

@ -36,7 +36,7 @@
"omnipay/bitpay": "dev-master", "omnipay/bitpay": "dev-master",
"guzzlehttp/guzzle": "~5.0", "guzzlehttp/guzzle": "~5.0",
"laravelcollective/html": "~5.0", "laravelcollective/html": "~5.0",
"wildbit/laravel-postmark-provider": "dev-master", "wildbit/laravel-postmark-provider": "1.0",
"Dwolla/omnipay-dwolla": "dev-master", "Dwolla/omnipay-dwolla": "dev-master",
"laravel/socialite": "~2.0", "laravel/socialite": "~2.0",
"simshaun/recurr": "dev-master", "simshaun/recurr": "dev-master",
@ -60,7 +60,8 @@
"labs7in0/omnipay-wechat": "dev-master", "labs7in0/omnipay-wechat": "dev-master",
"collizo4sky/omnipay-wepay": "~1.0", "collizo4sky/omnipay-wepay": "~1.0",
"laracasts/presenter": "dev-master", "laracasts/presenter": "dev-master",
"jlapp/swaggervel": "master-dev" "jlapp/swaggervel": "master-dev",
"maatwebsite/excel": "~2.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.0", "phpunit/phpunit": "~4.0",

340
composer.lock generated
View File

@ -1,11 +1,10 @@
{ {
"_readme": [ "_readme": [
"This file locks the dependencies of your project to a known state", "This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "fb15622e77287d516219e55ebb01ea3e", "hash": "b6c2660a613f4e94f13f226ec19c66eb",
"content-hash": "25cba035ae6f43a8c06493812b4e4d4d",
"packages": [ "packages": [
{ {
"name": "agmscode/omnipay-agms", "name": "agmscode/omnipay-agms",
@ -506,7 +505,7 @@
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Chumper/Datatable/zipball/b44834db3d4e560d4368c1a04248b9e6a422ccff", "url": "https://api.github.com/repos/Chumper/Datatable/zipball/7fa47cb5469f07c620fb69dee94b8e1a96943ee2",
"reference": "7fa47cb", "reference": "7fa47cb",
"shasum": "" "shasum": ""
}, },
@ -518,7 +517,7 @@
}, },
"require-dev": { "require-dev": {
"mockery/mockery": "dev-master", "mockery/mockery": "dev-master",
"orchestra/testbench": "3.1.*", "orchestra/testbench": "2.1.*",
"phpunit/phpunit": "3.7.*" "phpunit/phpunit": "3.7.*"
}, },
"type": "library", "type": "library",
@ -547,7 +546,7 @@
"jquery", "jquery",
"laravel" "laravel"
], ],
"time": "2015-10-26 01:21:31" "time": "2015-04-20 09:21:21"
}, },
{ {
"name": "classpreloader/classpreloader", "name": "classpreloader/classpreloader",
@ -3243,6 +3242,73 @@
], ],
"time": "2015-10-07 09:33:48" "time": "2015-10-07 09:33:48"
}, },
{
"name": "maatwebsite/excel",
"version": "v2.0.10",
"source": {
"type": "git",
"url": "https://github.com/Maatwebsite/Laravel-Excel.git",
"reference": "be63dcef4394a4bbeaf524e7fe89340b7dab6b7a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Maatwebsite/Laravel-Excel/zipball/be63dcef4394a4bbeaf524e7fe89340b7dab6b7a",
"reference": "be63dcef4394a4bbeaf524e7fe89340b7dab6b7a",
"shasum": ""
},
"require": {
"illuminate/cache": "5.0.*|5.1.*",
"illuminate/config": "5.0.*|5.1.*",
"illuminate/filesystem": "5.0.*|5.1.*",
"illuminate/support": "5.0.*|5.1.*",
"nesbot/carbon": "~1.0",
"php": ">=5.4",
"phpoffice/phpexcel": "1.8.*",
"tijsverkoyen/css-to-inline-styles": "~1.5"
},
"require-dev": {
"mockery/mockery": "~0.9",
"orchestra/testbench": "3.0.*",
"phpseclib/phpseclib": "~1.0",
"phpunit/phpunit": "~4.0"
},
"suggest": {
"illuminate/http": "5.0.*|5.1.*",
"illuminate/routing": "5.0.*|5.1.*",
"illuminate/view": "5.0.*|5.1.*"
},
"type": "library",
"autoload": {
"classmap": [
"src/Maatwebsite/Excel",
"tests/TestCase.php"
],
"psr-0": {
"Maatwebsite\\Excel\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL"
],
"authors": [
{
"name": "Maatwebsite.nl",
"email": "patrick@maatwebsite.nl"
}
],
"description": "An eloquent way of importing and exporting Excel and CSV in Laravel 4 with the power of PHPExcel",
"keywords": [
"PHPExcel",
"batch",
"csv",
"excel",
"export",
"import",
"laravel"
],
"time": "2015-10-26 11:52:19"
},
{ {
"name": "maximebf/debugbar", "name": "maximebf/debugbar",
"version": "v1.10.5", "version": "v1.10.5",
@ -5520,6 +5586,63 @@
], ],
"time": "2015-02-03 12:10:50" "time": "2015-02-03 12:10:50"
}, },
{
"name": "phpoffice/phpexcel",
"version": "1.8.1",
"source": {
"type": "git",
"url": "https://github.com/PHPOffice/PHPExcel.git",
"reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/372c7cbb695a6f6f1e62649381aeaa37e7e70b32",
"reference": "372c7cbb695a6f6f1e62649381aeaa37e7e70b32",
"shasum": ""
},
"require": {
"ext-xml": "*",
"ext-xmlwriter": "*",
"php": ">=5.2.0"
},
"type": "library",
"autoload": {
"psr-0": {
"PHPExcel": "Classes/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL"
],
"authors": [
{
"name": "Maarten Balliauw",
"homepage": "http://blog.maartenballiauw.be"
},
{
"name": "Mark Baker"
},
{
"name": "Franck Lefevre",
"homepage": "http://blog.rootslabs.net"
},
{
"name": "Erik Tilt"
}
],
"description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
"homepage": "http://phpexcel.codeplex.com",
"keywords": [
"OpenXML",
"excel",
"php",
"spreadsheet",
"xls",
"xlsx"
],
"time": "2015-05-01 07:00:55"
},
{ {
"name": "psr/http-message", "name": "psr/http-message",
"version": "1.0", "version": "1.0",
@ -5998,12 +6121,12 @@
"target-dir": "Symfony/Component/Console", "target-dir": "Symfony/Component/Console",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/Console.git",
"reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359" "reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/0e5e18ae09d3f5c06367759be940e9ed3f568359", "url": "https://api.github.com/repos/symfony/Console/zipball/0e5e18ae09d3f5c06367759be940e9ed3f568359",
"reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359", "reference": "0e5e18ae09d3f5c06367759be940e9ed3f568359",
"shasum": "" "shasum": ""
}, },
@ -6050,18 +6173,68 @@
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2015-07-26 09:08:40" "time": "2015-07-26 09:08:40"
}, },
{
"name": "symfony/css-selector",
"version": "v2.7.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
"reference": "e1b865b26be4a56d22a8dee398375044a80c865b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/e1b865b26be4a56d22a8dee398375044a80c865b",
"reference": "e1b865b26be4a56d22a8dee398375044a80c865b",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\CssSelector\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jean-François Simon",
"email": "jeanfrancois.simon@sensiolabs.com"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
"time": "2015-10-11 09:39:48"
},
{ {
"name": "symfony/debug", "name": "symfony/debug",
"version": "v2.6.11", "version": "v2.6.11",
"target-dir": "Symfony/Component/Debug", "target-dir": "Symfony/Component/Debug",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/debug.git", "url": "https://github.com/symfony/Debug.git",
"reference": "fca5696e0c9787722baa8f2ad6940dfd7a6a6941" "reference": "fca5696e0c9787722baa8f2ad6940dfd7a6a6941"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/fca5696e0c9787722baa8f2ad6940dfd7a6a6941", "url": "https://api.github.com/repos/symfony/Debug/zipball/fca5696e0c9787722baa8f2ad6940dfd7a6a6941",
"reference": "fca5696e0c9787722baa8f2ad6940dfd7a6a6941", "reference": "fca5696e0c9787722baa8f2ad6940dfd7a6a6941",
"shasum": "" "shasum": ""
}, },
@ -6270,12 +6443,12 @@
"target-dir": "Symfony/Component/HttpFoundation", "target-dir": "Symfony/Component/HttpFoundation",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/http-foundation.git", "url": "https://github.com/symfony/HttpFoundation.git",
"reference": "e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c" "reference": "e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c", "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c",
"reference": "e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c", "reference": "e8fd1b73ac1c3de1f76c73801ddf1a8ecb1c1c9c",
"shasum": "" "shasum": ""
}, },
@ -6324,12 +6497,12 @@
"target-dir": "Symfony/Component/HttpKernel", "target-dir": "Symfony/Component/HttpKernel",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/http-kernel.git", "url": "https://github.com/symfony/HttpKernel.git",
"reference": "a3f0ed713255c0400a2db38b3ed01989ef4b7322" "reference": "a3f0ed713255c0400a2db38b3ed01989ef4b7322"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/a3f0ed713255c0400a2db38b3ed01989ef4b7322", "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/a3f0ed713255c0400a2db38b3ed01989ef4b7322",
"reference": "a3f0ed713255c0400a2db38b3ed01989ef4b7322", "reference": "a3f0ed713255c0400a2db38b3ed01989ef4b7322",
"shasum": "" "shasum": ""
}, },
@ -6698,6 +6871,53 @@
], ],
"time": "2015-07-01 10:03:42" "time": "2015-07-01 10:03:42"
}, },
{
"name": "tijsverkoyen/css-to-inline-styles",
"version": "1.5.4",
"source": {
"type": "git",
"url": "https://github.com/tijsverkoyen/CssToInlineStyles.git",
"reference": "3065b197f54c83392a4e0ba355678a5080dd9ee2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/zipball/3065b197f54c83392a4e0ba355678a5080dd9ee2",
"reference": "3065b197f54c83392a4e0ba355678a5080dd9ee2",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
"symfony/css-selector": "~2.1"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.5.x-dev"
}
},
"autoload": {
"psr-4": {
"TijsVerkoyen\\CssToInlineStyles\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD"
],
"authors": [
{
"name": "Tijs Verkoyen",
"email": "css_to_inline_styles@verkoyen.eu",
"role": "Developer"
}
],
"description": "CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very useful when you're sending emails.",
"homepage": "https://github.com/tijsverkoyen/CssToInlineStyles",
"time": "2015-04-01 14:40:03"
},
{ {
"name": "true/punycode", "name": "true/punycode",
"version": "v2.0.1", "version": "v2.0.1",
@ -6943,16 +7163,16 @@
}, },
{ {
"name": "wildbit/laravel-postmark-provider", "name": "wildbit/laravel-postmark-provider",
"version": "dev-master", "version": "1.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/wildbit/laravel-postmark-provider.git", "url": "https://github.com/wildbit/laravel-postmark-provider.git",
"reference": "3cab780369d206e1c7eaae3f576ca7f0c4f5edc6" "reference": "f5ca5ef198320ae6eb36b8556d75152eddecd9ed"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/wildbit/laravel-postmark-provider/zipball/3cab780369d206e1c7eaae3f576ca7f0c4f5edc6", "url": "https://api.github.com/repos/wildbit/laravel-postmark-provider/zipball/f5ca5ef198320ae6eb36b8556d75152eddecd9ed",
"reference": "3cab780369d206e1c7eaae3f576ca7f0c4f5edc6", "reference": "f5ca5ef198320ae6eb36b8556d75152eddecd9ed",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -6969,8 +7189,7 @@
"license": [ "license": [
"MIT" "MIT"
], ],
"description": "An officially supported mail provider to send mail from Laravel through Postmark, see instructions for integrating it here: https://github.com/wildbit/laravel-postmark-provider/blob/master/README.md", "time": "2015-03-19 13:19:51"
"time": "2015-03-19 13:32:47"
}, },
{ {
"name": "wildbit/swiftmailer-postmark", "name": "wildbit/swiftmailer-postmark",
@ -7121,16 +7340,16 @@
}, },
{ {
"name": "codeception/codeception", "name": "codeception/codeception",
"version": "2.1.3", "version": "2.1.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Codeception/Codeception.git", "url": "https://github.com/Codeception/Codeception.git",
"reference": "cd810cb78a869408602e17271f9b7368b09a7ca8" "reference": "6a812e8a0d1b1db939a29b4dc14cb398b21b6112"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Codeception/Codeception/zipball/cd810cb78a869408602e17271f9b7368b09a7ca8", "url": "https://api.github.com/repos/Codeception/Codeception/zipball/6a812e8a0d1b1db939a29b4dc14cb398b21b6112",
"reference": "cd810cb78a869408602e17271f9b7368b09a7ca8", "reference": "6a812e8a0d1b1db939a29b4dc14cb398b21b6112",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7197,7 +7416,7 @@
"functional testing", "functional testing",
"unit testing" "unit testing"
], ],
"time": "2015-10-02 09:38:59" "time": "2015-11-12 03:57:06"
}, },
{ {
"name": "doctrine/instantiator", "name": "doctrine/instantiator",
@ -7255,16 +7474,16 @@
}, },
{ {
"name": "facebook/webdriver", "name": "facebook/webdriver",
"version": "1.0.3", "version": "1.0.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/facebook/php-webdriver.git", "url": "https://github.com/facebook/php-webdriver.git",
"reference": "d843e33fd19b49db5ac9daaef2610079daab0bad" "reference": "a6e209a309bf7cd71acf15476f40b11a25d5a79d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/facebook/php-webdriver/zipball/d843e33fd19b49db5ac9daaef2610079daab0bad", "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/a6e209a309bf7cd71acf15476f40b11a25d5a79d",
"reference": "d843e33fd19b49db5ac9daaef2610079daab0bad", "reference": "a6e209a309bf7cd71acf15476f40b11a25d5a79d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7294,7 +7513,7 @@
"selenium", "selenium",
"webdriver" "webdriver"
], ],
"time": "2015-11-01 20:09:34" "time": "2015-11-03 22:17:22"
}, },
{ {
"name": "fzaninotto/faker", "name": "fzaninotto/faker",
@ -7761,16 +7980,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "4.8.16", "version": "4.8.18",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "625f8c345606ed0f3a141dfb88f4116f0e22978e" "reference": "fa33d4ad96481b91df343d83e8c8aabed6b1dfd3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/625f8c345606ed0f3a141dfb88f4116f0e22978e", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fa33d4ad96481b91df343d83e8c8aabed6b1dfd3",
"reference": "625f8c345606ed0f3a141dfb88f4116f0e22978e", "reference": "fa33d4ad96481b91df343d83e8c8aabed6b1dfd3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7829,7 +8048,7 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2015-10-23 06:48:33" "time": "2015-11-11 11:32:49"
}, },
{ {
"name": "phpunit/phpunit-mock-objects", "name": "phpunit/phpunit-mock-objects",
@ -8312,56 +8531,6 @@
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2015-10-23 14:47:27" "time": "2015-10-23 14:47:27"
}, },
{
"name": "symfony/css-selector",
"version": "v2.7.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
"reference": "e1b865b26be4a56d22a8dee398375044a80c865b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/e1b865b26be4a56d22a8dee398375044a80c865b",
"reference": "e1b865b26be4a56d22a8dee398375044a80c865b",
"shasum": ""
},
"require": {
"php": ">=5.3.9"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.7-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Component\\CssSelector\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jean-François Simon",
"email": "jeanfrancois.simon@sensiolabs.com"
},
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony CssSelector Component",
"homepage": "https://symfony.com",
"time": "2015-10-11 09:39:48"
},
{ {
"name": "symfony/dom-crawler", "name": "symfony/dom-crawler",
"version": "v2.7.6", "version": "v2.7.6",
@ -8472,7 +8641,6 @@
"alfaproject/omnipay-neteller": 20, "alfaproject/omnipay-neteller": 20,
"alfaproject/omnipay-skrill": 20, "alfaproject/omnipay-skrill": 20,
"omnipay/bitpay": 20, "omnipay/bitpay": 20,
"wildbit/laravel-postmark-provider": 20,
"dwolla/omnipay-dwolla": 20, "dwolla/omnipay-dwolla": 20,
"simshaun/recurr": 20, "simshaun/recurr": 20,
"meebio/omnipay-creditcall": 20, "meebio/omnipay-creditcall": 20,

View File

@ -151,6 +151,7 @@ return [
'Illuminate\Html\HtmlServiceProvider', 'Illuminate\Html\HtmlServiceProvider',
'Laravel\Socialite\SocialiteServiceProvider', 'Laravel\Socialite\SocialiteServiceProvider',
'Jlapp\Swaggervel\SwaggervelServiceProvider', 'Jlapp\Swaggervel\SwaggervelServiceProvider',
'Maatwebsite\Excel\ExcelServiceProvider',
/* /*
* Application Service Providers... * Application Service Providers...
@ -209,7 +210,6 @@ return [
'Validator' => 'Illuminate\Support\Facades\Validator', 'Validator' => 'Illuminate\Support\Facades\Validator',
'View' => 'Illuminate\Support\Facades\View', 'View' => 'Illuminate\Support\Facades\View',
// Added Class Aliases // Added Class Aliases
'Utils' => 'App\Libraries\Utils', 'Utils' => 'App\Libraries\Utils',
'Form' => 'Collective\Html\FormFacade', 'Form' => 'Collective\Html\FormFacade',
@ -245,6 +245,7 @@ return [
'Carbon' => 'Carbon\Carbon', 'Carbon' => 'Carbon\Carbon',
'Rocketeer' => 'Rocketeer\Facades\Rocketeer', 'Rocketeer' => 'Rocketeer\Facades\Rocketeer',
'Socialite' => 'Laravel\Socialite\Facades\Socialite', 'Socialite' => 'Laravel\Socialite\Facades\Socialite',
'Excel' => 'Maatwebsite\Excel\Facades\Excel',
], ],

683
config/excel.php Normal file
View File

@ -0,0 +1,683 @@
<?php
return array(
'cache' => array(
/*
|--------------------------------------------------------------------------
| Enable/Disable cell caching
|--------------------------------------------------------------------------
*/
'enable' => true,
/*
|--------------------------------------------------------------------------
| Caching driver
|--------------------------------------------------------------------------
|
| Set the caching driver
|
| Available methods:
| memory|gzip|serialized|igbinary|discISAM|apc|memcache|temp|wincache|sqlite|sqlite3
|
*/
'driver' => 'memory',
/*
|--------------------------------------------------------------------------
| Cache settings
|--------------------------------------------------------------------------
*/
'settings' => array(
'memoryCacheSize' => '32MB',
'cacheTime' => 600
),
/*
|--------------------------------------------------------------------------
| Memcache settings
|--------------------------------------------------------------------------
*/
'memcache' => array(
'host' => 'localhost',
'port' => 11211,
),
/*
|--------------------------------------------------------------------------
| Cache dir (for discISAM)
|--------------------------------------------------------------------------
*/
'dir' => storage_path('cache')
),
'properties' => array(
'creator' => 'Maatwebsite',
'lastModifiedBy' => 'Maatwebsite',
'title' => 'Spreadsheet',
'description' => 'Default spreadsheet export',
'subject' => 'Spreadsheet export',
'keywords' => 'maatwebsite, excel, export',
'category' => 'Excel',
'manager' => 'Maatwebsite',
'company' => 'Maatwebsite',
),
/*
|--------------------------------------------------------------------------
| Sheets settings
|--------------------------------------------------------------------------
*/
'sheets' => array(
/*
|--------------------------------------------------------------------------
| Default page setup
|--------------------------------------------------------------------------
*/
'pageSetup' => array(
'orientation' => 'portrait',
'paperSize' => '9',
'scale' => '100',
'fitToPage' => false,
'fitToHeight' => true,
'fitToWidth' => true,
'columnsToRepeatAtLeft' => array('', ''),
'rowsToRepeatAtTop' => array(0, 0),
'horizontalCentered' => false,
'verticalCentered' => false,
'printArea' => null,
'firstPageNumber' => null,
),
),
/*
|--------------------------------------------------------------------------
| Creator
|--------------------------------------------------------------------------
|
| The default creator of a new Excel file
|
*/
'creator' => 'Maatwebsite',
'csv' => array(
/*
|--------------------------------------------------------------------------
| Delimiter
|--------------------------------------------------------------------------
|
| The default delimiter which will be used to read out a CSV file
|
*/
'delimiter' => ',',
/*
|--------------------------------------------------------------------------
| Enclosure
|--------------------------------------------------------------------------
*/
'enclosure' => '"',
/*
|--------------------------------------------------------------------------
| Line endings
|--------------------------------------------------------------------------
*/
'line_ending' => "\r\n"
),
'export' => array(
/*
|--------------------------------------------------------------------------
| Autosize columns
|--------------------------------------------------------------------------
|
| Disable/enable column autosize or set the autosizing for
| an array of columns ( array('A', 'B') )
|
*/
'autosize' => true,
/*
|--------------------------------------------------------------------------
| Autosize method
|--------------------------------------------------------------------------
|
| --> PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX
| The default is based on an estimate, which does its calculation based
| on the number of characters in the cell value (applying any calculation
| and format mask, and allowing for wordwrap and rotation) and with an
| "arbitrary" adjustment based on the font (Arial, Calibri or Verdana,
| defaulting to Calibri if any other font is used) and a proportional
| adjustment for the font size.
|
| --> PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT
| The second method is more accurate, based on actual style formatting as
| well (bold, italic, etc), and is calculated by generating a gd2 imagettf
| bounding box and using its dimensions to determine the size; but this
| method is significantly slower, and its accuracy is still dependent on
| having the appropriate fonts installed.
|
*/
'autosize-method' => PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX,
/*
|--------------------------------------------------------------------------
| Auto generate table heading
|--------------------------------------------------------------------------
|
| If set to true, the array indices (or model attribute names)
| will automatically be used as first row (table heading)
|
*/
'generate_heading_by_indices' => true,
/*
|--------------------------------------------------------------------------
| Auto set alignment on merged cells
|--------------------------------------------------------------------------
*/
'merged_cell_alignment' => 'left',
/*
|--------------------------------------------------------------------------
| Pre-calculate formulas during export
|--------------------------------------------------------------------------
*/
'calculate' => false,
/*
|--------------------------------------------------------------------------
| Include Charts during export
|--------------------------------------------------------------------------
*/
'includeCharts' => false,
/*
|--------------------------------------------------------------------------
| Default sheet settings
|--------------------------------------------------------------------------
*/
'sheets' => array(
/*
|--------------------------------------------------------------------------
| Default page margin
|--------------------------------------------------------------------------
|
| 1) When set to false, default margins will be used
| 2) It's possible to enter a single margin which will
| be used for all margins.
| 3) Alternatively you can pass an array with 4 margins
| Default order: array(top, right, bottom, left)
|
*/
'page_margin' => false,
/*
|--------------------------------------------------------------------------
| Value in source array that stands for blank cell
|--------------------------------------------------------------------------
*/
'nullValue' => null,
/*
|--------------------------------------------------------------------------
| Insert array starting from this cell address as the top left coordinate
|--------------------------------------------------------------------------
*/
'startCell' => 'A1',
/*
|--------------------------------------------------------------------------
| Apply strict comparison when testing for null values in the array
|--------------------------------------------------------------------------
*/
'strictNullComparison' => false
),
/*
|--------------------------------------------------------------------------
| Store settings
|--------------------------------------------------------------------------
*/
'store' => array(
/*
|--------------------------------------------------------------------------
| Path
|--------------------------------------------------------------------------
|
| The path we want to save excel file to
|
*/
'path' => storage_path('exports'),
/*
|--------------------------------------------------------------------------
| Return info
|--------------------------------------------------------------------------
|
| Whether we want to return information about the stored file or not
|
*/
'returnInfo' => false
),
/*
|--------------------------------------------------------------------------
| PDF Settings
|--------------------------------------------------------------------------
*/
'pdf' => array(
/*
|--------------------------------------------------------------------------
| PDF Drivers
|--------------------------------------------------------------------------
| Supported: DomPDF, tcPDF, mPDF
*/
'driver' => 'DomPDF',
/*
|--------------------------------------------------------------------------
| PDF Driver settings
|--------------------------------------------------------------------------
*/
'drivers' => array(
/*
|--------------------------------------------------------------------------
| DomPDF settings
|--------------------------------------------------------------------------
*/
'DomPDF' => array(
'path' => base_path('vendor/dompdf/dompdf/')
),
/*
|--------------------------------------------------------------------------
| tcPDF settings
|--------------------------------------------------------------------------
*/
'tcPDF' => array(
'path' => base_path('vendor/tecnick.com/tcpdf/')
),
/*
|--------------------------------------------------------------------------
| mPDF settings
|--------------------------------------------------------------------------
*/
'mPDF' => array(
'path' => base_path('vendor/mpdf/mpdf/')
),
)
)
),
'filters' => array(
/*
|--------------------------------------------------------------------------
| Register read filters
|--------------------------------------------------------------------------
*/
'registered' => array(
'chunk' => 'Maatwebsite\Excel\Filters\ChunkReadFilter'
),
/*
|--------------------------------------------------------------------------
| Enable certain filters for every file read
|--------------------------------------------------------------------------
*/
'enabled' => array()
),
'import' => array(
/*
|--------------------------------------------------------------------------
| Has heading
|--------------------------------------------------------------------------
|
| The sheet has a heading (first) row which we can use as attribute names
|
| Options: true|false|slugged|slugged_with_count|ascii|numeric|hashed|trans|original
|
*/
'heading' => 'slugged',
/*
|--------------------------------------------------------------------------
| First Row with data or heading of data
|--------------------------------------------------------------------------
|
| If the heading row is not the first row, or the data doesn't start
| on the first row, here you can change the start row.
|
*/
'startRow' => 1,
/*
|--------------------------------------------------------------------------
| Cell name word separator
|--------------------------------------------------------------------------
|
| The default separator which is used for the cell names
| Note: only applies to 'heading' settings 'true' && 'slugged'
|
*/
'separator' => '_',
/*
|--------------------------------------------------------------------------
| Include Charts during import
|--------------------------------------------------------------------------
*/
'includeCharts' => false,
/*
|--------------------------------------------------------------------------
| Sheet heading conversion
|--------------------------------------------------------------------------
|
| Convert headings to ASCII
| Note: only applies to 'heading' settings 'true' && 'slugged'
|
*/
'to_ascii' => true,
/*
|--------------------------------------------------------------------------
| Import encoding
|--------------------------------------------------------------------------
*/
'encoding' => array(
'input' => 'UTF-8',
'output' => 'UTF-8'
),
/*
|--------------------------------------------------------------------------
| Calculate
|--------------------------------------------------------------------------
|
| By default cells with formulas will be calculated.
|
*/
'calculate' => true,
/*
|--------------------------------------------------------------------------
| Ignore empty cells
|--------------------------------------------------------------------------
|
| By default empty cells are not ignored
|
*/
'ignoreEmpty' => false,
/*
|--------------------------------------------------------------------------
| Force sheet collection
|--------------------------------------------------------------------------
|
| For a sheet collection even when there is only 1 sheets.
| When set to false and only 1 sheet found, the parsed file will return
| a row collection instead of a sheet collection.
| When set to true, it will return a sheet collection instead.
|
*/
'force_sheets_collection' => false,
/*
|--------------------------------------------------------------------------
| Date format
|--------------------------------------------------------------------------
|
| The format dates will be parsed to
|
*/
'dates' => array(
/*
|--------------------------------------------------------------------------
| Enable/disable date formatting
|--------------------------------------------------------------------------
*/
'enabled' => true,
/*
|--------------------------------------------------------------------------
| Default date format
|--------------------------------------------------------------------------
|
| If set to false, a carbon object will return
|
*/
'format' => false,
/*
|--------------------------------------------------------------------------
| Date columns
|--------------------------------------------------------------------------
*/
'columns' => array()
),
/*
|--------------------------------------------------------------------------
| Import sheets by config
|--------------------------------------------------------------------------
*/
'sheets' => array(
/*
|--------------------------------------------------------------------------
| Example sheet
|--------------------------------------------------------------------------
|
| Example sheet "test" will grab the firstname at cell A2
|
*/
'test' => array(
'firstname' => 'A2'
)
)
),
'views' => array(
/*
|--------------------------------------------------------------------------
| Styles
|--------------------------------------------------------------------------
|
| The default styles which will be used when parsing a view
|
*/
'styles' => array(
/*
|--------------------------------------------------------------------------
| Table headings
|--------------------------------------------------------------------------
*/
'th' => array(
'font' => array(
'bold' => true,
'size' => 12,
)
),
/*
|--------------------------------------------------------------------------
| Strong tags
|--------------------------------------------------------------------------
*/
'strong' => array(
'font' => array(
'bold' => true,
'size' => 12,
)
),
/*
|--------------------------------------------------------------------------
| Bold tags
|--------------------------------------------------------------------------
*/
'b' => array(
'font' => array(
'bold' => true,
'size' => 12,
)
),
/*
|--------------------------------------------------------------------------
| Italic tags
|--------------------------------------------------------------------------
*/
'i' => array(
'font' => array(
'italic' => true,
'size' => 12,
)
),
/*
|--------------------------------------------------------------------------
| Heading 1
|--------------------------------------------------------------------------
*/
'h1' => array(
'font' => array(
'bold' => true,
'size' => 24,
)
),
/*
|--------------------------------------------------------------------------
| Heading 2
|--------------------------------------------------------------------------
*/
'h2' => array(
'font' => array(
'bold' => true,
'size' => 18,
)
),
/*
|--------------------------------------------------------------------------
| Heading 2
|--------------------------------------------------------------------------
*/
'h3' => array(
'font' => array(
'bold' => true,
'size' => 13.5,
)
),
/*
|--------------------------------------------------------------------------
| Heading 4
|--------------------------------------------------------------------------
*/
'h4' => array(
'font' => array(
'bold' => true,
'size' => 12,
)
),
/*
|--------------------------------------------------------------------------
| Heading 5
|--------------------------------------------------------------------------
*/
'h5' => array(
'font' => array(
'bold' => true,
'size' => 10,
)
),
/*
|--------------------------------------------------------------------------
| Heading 6
|--------------------------------------------------------------------------
*/
'h6' => array(
'font' => array(
'bold' => true,
'size' => 7.5,
)
),
/*
|--------------------------------------------------------------------------
| Hyperlinks
|--------------------------------------------------------------------------
*/
'a' => array(
'font' => array(
'underline' => true,
'color' => array('argb' => 'FF0000FF'),
)
),
/*
|--------------------------------------------------------------------------
| Horizontal rules
|--------------------------------------------------------------------------
*/
'hr' => array(
'borders' => array(
'bottom' => array(
'style' => 'thin',
'color' => array('FF000000')
),
)
)
)
)
);

View File

@ -80,3 +80,4 @@ If you'd like to use our code to sell your own invoicing app email us for detail
* [josdejong/jsoneditor](https://github.com/josdejong/jsoneditor/) - A web-based tool to view, edit and format JSON * [josdejong/jsoneditor](https://github.com/josdejong/jsoneditor/) - A web-based tool to view, edit and format JSON
* [simshaun/recurr](https://github.com/simshaun/recurr) - PHP library for working with recurrence rules * [simshaun/recurr](https://github.com/simshaun/recurr) - PHP library for working with recurrence rules
* [quilljs/quill](https://github.com/quilljs/quill/) - A cross browser rich text editor with an API * [quilljs/quill](https://github.com/quilljs/quill/) - A cross browser rich text editor with an API
* [Maatwebsite/Laravel-Excel](https://github.com/Maatwebsite/Laravel-Excel) - An eloquent way of importing and exporting Excel and CSV files for Laravel

View File

@ -913,5 +913,9 @@ return array(
'after' => 'After', 'after' => 'After',
'reset_terms_help' => 'Reset to the default account terms', 'reset_terms_help' => 'Reset to the default account terms',
'reset_footer_help' => 'Reset to the default account footer', 'reset_footer_help' => 'Reset to the default account footer',
'export_data' => 'Export Data',
'user' => 'User',
'country' => 'Country',
'include' => 'Include',
); );

View File

@ -18,12 +18,29 @@
{!! Former::close() !!} {!! Former::close() !!}
{!! Former::open('settings/' . ACCOUNT_EXPORT) !!} {!! Former::open('/export') !!}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h3 class="panel-title">{!! trans('texts.export_clients') !!}</h3> <h3 class="panel-title">{!! trans('texts.export_data') !!}</h3>
</div> </div>
<div class="panel-body"> <div class="panel-body">
{!! Former::select('format')
->onchange('setEntityTypesVisible()')
->addOption('CSV', 'CSV')
->addOption('XLS', 'XLS')
->addOption('JSON', 'JSON')
->style('max-width: 200px') !!}
{!! Former::checkbox('entity_types')
->label('include')
->addGroupClass('entity-types')
->checkboxes([
trans('texts.clients') => array('name' => ENTITY_CLIENT, 'value' => 1),
trans('texts.tasks') => array('name' => ENTITY_TASK, 'value' => 1),
trans('texts.invoices') => array('name' => ENTITY_INVOICE, 'value' => 1),
trans('texts.payments') => array('name' => ENTITY_PAYMENT, 'value' => 1),
])->check(ENTITY_CLIENT)->check(ENTITY_TASK)->check(ENTITY_INVOICE)->check(ENTITY_PAYMENT) !!}
{!! Former::actions( Button::primary(trans('texts.download'))->submit()->large()->appendIcon(Icon::create('download-alt'))) !!} {!! Former::actions( Button::primary(trans('texts.download'))->submit()->large()->appendIcon(Icon::create('download-alt'))) !!}
</div> </div>
</div> </div>
@ -75,6 +92,15 @@
$('form.cancel-account').submit(); $('form.cancel-account').submit();
} }
function setEntityTypesVisible() {
var selector = '.entity-types input[type=checkbox]';
if ($('#format').val() === 'JSON') {
$(selector).attr('disabled', true);
} else {
$(selector).removeAttr('disabled');
}
}
</script> </script>
@stop @stop

View File

@ -0,0 +1,43 @@
<html>
<tr>
<td>{{ $title }}</td>
</tr>
<tr><td></td></tr>
@if (isset($clients) && $clients && count($clients))
<tr><td>{{ strtoupper(trans('texts.clients')) }}</td></tr>
@include('export.clients')
@endif
@if (isset($contacts) && $contacts && count($contacts))
<tr><td>{{ strtoupper(trans('texts.contacts')) }}</td></tr>
@include('export.contacts')
@endif
@if (isset($credits) && $credits && count($credits))
<tr><td>{{ strtoupper(trans('texts.credits')) }}</td></tr>
@include('export.credits')
@endif
@if (isset($tasks) && $tasks && count($tasks))
<tr><td>{{ strtoupper(trans('texts.tasks')) }}</td></tr>
@include('export.tasks')
@endif
@if (isset($invoices) && $invoices && count($invoices))
<tr><td>{{ strtoupper(trans('texts.invoices')) }}</td></tr>
@include('export.invoices')
@endif
@if (isset($quotes) && $quotes && count($quotes))
<tr><td>{{ strtoupper(trans('texts.quotes')) }}</td></tr>
@include('export.invoices', ['entityType' => ENTITY_QUOTE])
@endif
@if (isset($payments) && $payments && count($payments))
<tr><td>{{ strtoupper(trans('texts.payments')) }}</td></tr>
@include('export.payments')
@endif
</html>

View File

@ -0,0 +1,45 @@
<tr>
<td>{{ trans('texts.name') }}</td>
@if ($multiUser)
<td>{{ trans('texts.user') }}</td>
@endif
<td>{{ trans('texts.balance') }}</td>
<td>{{ trans('texts.paid_to_date') }}</td>
<td>{{ trans('texts.address1') }}</td>
<td>{{ trans('texts.address2') }}</td>
<td>{{ trans('texts.city') }}</td>
<td>{{ trans('texts.state') }}</td>
<td>{{ trans('texts.postal_code') }}</td>
<td>{{ trans('texts.country') }}</td>
@if ($account->custom_client_label1)
<td>{{ $account->custom_client_label1 }}</td>
@endif
@if ($account->custom_client_label2)
<td>{{ $account->custom_client_label2 }}</td>
@endif
</tr>
@foreach ($clients as $client)
<tr>
<td>{{ $client->getDisplayName() }}</td>
@if ($multiUser)
<td>{{ $client->user->getDisplayName() }}</td>
@endif
<td>{{ $client->present()->balance }}</td>
<td>{{ $client->present()->paid_to_date }}</td>
<td>{{ $client->address1 }}</td>
<td>{{ $client->address2 }}</td>
<td>{{ $client->city }}</td>
<td>{{ $client->state }}</td>
<td>{{ $client->postal_code }}</td>
<td>{{ $client->present()->country }}</td>
@if ($account->custom_client_label1)
<td>{{ $client->custom_value1 }}</td>
@endif
@if ($account->custom_client_label2)
<td>{{ $client->custom_value2 }}</td>
@endif
</tr>
@endforeach
<tr><td></td></tr>

View File

@ -0,0 +1,25 @@
<tr>
<td>{{ trans('texts.client') }}</td>
@if ($multiUser)
<td>{{ trans('texts.user') }}</td>
@endif
<td>{{ trans('texts.first_name') }}</td>
<td>{{ trans('texts.last_name') }}</td>
<td>{{ trans('texts.email') }}</td>
<td>{{ trans('texts.phone') }}</td>
</tr>
@foreach ($contacts as $contact)
<tr>
<td>{{ $contact->client->getDisplayName() }}</td>
@if ($multiUser)
<td>{{ $contact->user->getDisplayName() }}</td>
@endif
<td>{{ $contact->first_name }}</td>
<td>{{ $contact->last_name }}</td>
<td>{{ $contact->email }}</td>
<td>{{ $contact->phone }}</td>
</tr>
@endforeach
<tr><td></td></tr>

View File

@ -0,0 +1,23 @@
<tr>
<td>{{ trans('texts.name') }}</td>
@if ($multiUser)
<td>{{ trans('texts.user') }}</td>
@endif
<td>{{ trans('texts.amount') }}</td>
<td>{{ trans('texts.balance') }}</td>
<td>{{ trans('texts.credit_date') }}</td>
</tr>
@foreach ($credits as $credit)
<tr>
<td>{{ $credit->client->getDisplayName() }}</td>
@if ($multiUser)
<td>{{ $credit->user->getDisplayName() }}</td>
@endif
<td>{{ $credit->present()->amount }}</td>
<td>{{ $credit->present()->balance }}</td>
<td>{{ $credit->present()->credit_date }}</td>
</tr>
@endforeach
<tr><td></td></tr>

View File

@ -0,0 +1,55 @@
<tr>
<td>{{ trans('texts.client') }}</td>
@if ($multiUser)
<td>{{ trans('texts.user') }}</td>
@endif
<td>{{ trans(isset($entityType) && $entityType == ENTITY_QUOTE ? 'texts.quote_number' : 'texts.invoice_number') }}</td>
<td>{{ trans('texts.balance') }}</td>
<td>{{ trans('texts.amount') }}</td>
<td>{{ trans('texts.po_number') }}</td>
<td>{{ trans('texts.status') }}</td>
<td>{{ trans(isset($entityType) && $entityType == ENTITY_QUOTE ? 'texts.quote_date' : 'texts.invoice_date') }}</td>
<td>{{ trans('texts.due_date') }}</td>
@if ($account->custom_invoice_label1)
<td>{{ $account->custom_invoice_label1 }}</td>
@endif
@if ($account->custom_invoice_label2)
<td>{{ $account->custom_invoice_label2 }}</td>
@endif
@if ($account->custom_invoice_text_label1)
<td>{{ $account->custom_invoice_text_label1 }}</td>
@endif
@if ($account->custom_invoice_text_label2)
<td>{{ $account->custom_invoice_text_label2 }}</td>
@endif
</tr>
@foreach ($invoices as $invoice)
<tr>
<td>{{ $invoice->present()->client }}</td>
@if ($multiUser)
<td>{{ $invoice->present()->user }}</td>
@endif
<td>{{ $invoice->invoice_number }}</td>
<td>{{ $invoice->present()->balance }}</td>
<td>{{ $invoice->present()->amount }}</td>
<td>{{ $invoice->po_number }}</td>
<td>{{ $invoice->present()->status }}</td>
<td>{{ $invoice->present()->invoice_date }}</td>
<td>{{ $invoice->present()->due_date }}</td>
@if ($account->custom_invoice_label1)
<td>{{ $invoice->custom_value1 }}</td>
@endif
@if ($account->custom_invoice_label2)
<td>{{ $invoice->custom_value2 }}</td>
@endif
@if ($account->custom_invoice_label1)
<td>{{ $invoice->custom_text_value1 }}</td>
@endif
@if ($account->custom_invoice_label2)
<td>{{ $invoice->custom_text_value2 }}</td>
@endif
</tr>
@endforeach
<tr><td></td></tr>

View File

@ -0,0 +1,27 @@
<tr>
<td>{{ trans('texts.client') }}</td>
@if ($multiUser)
<td>{{ trans('texts.user') }}</td>
@endif
<td>{{ trans('texts.invoice_number') }}</td>
<td>{{ trans('texts.amount') }}</td>
<td>{{ trans('texts.payment_date') }}</td>
<td>{{ trans('texts.method') }}</td>
<td>{{ trans('texts.transaction_reference') }}</td>
</tr>
@foreach ($payments as $payment)
<tr>
<td>{{ $payment->present()->client }}</td>
@if ($multiUser)
<td>{{ $payment->user->getDisplayName() }}</td>
@endif
<td>{{ $payment->invoice->invoice_number }}</td>
<td>{{ $payment->present()->amount }}</td>
<td>{{ $payment->present()->payment_date }}</td>
<td>{{ $payment->present()->method }}</td>
<td>{{ $payment->transaction_reference }}</td>
</tr>
@endforeach
<tr><td></td></tr>

View File

@ -0,0 +1,23 @@
<tr>
<td>{{ trans('texts.client') }}</td>
@if ($multiUser)
<td>{{ trans('texts.user') }}</td>
@endif
<td>{{ trans('texts.start_date') }}</td>
<td>{{ trans('texts.duration') }}</td>
<td>{{ trans('texts.description') }}</td>
</tr>
@foreach ($tasks as $task)
<tr>
<td>{{ $task->present()->client }}</td>
@if ($multiUser)
<td>{{ $task->present()->user }}</td>
@endif
<td>{{ $task->getStartTime() }}</td>
<td>{{ $task->getDuration() }}</td>
<td>{{ $task->description }}</td>
</tr>
@endforeach
<tr><td></td></tr>