v2 first commit
This commit is contained in:
55
app/Exports/Banking/Transactions.php
Normal file
55
app/Exports/Banking/Transactions.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Banking;
|
||||
|
||||
use App\Models\Banking\Transaction as Model;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class Transactions implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return Model::usingSearchString(request('search'))->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->type,
|
||||
$model->account_id,
|
||||
$model->paid_at,
|
||||
$model->amount,
|
||||
$model->currency_code,
|
||||
$model->currency_rate,
|
||||
$model->document_id,
|
||||
$model->contact_id,
|
||||
$model->payment_method,
|
||||
$model->reconciled,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'type',
|
||||
'account_id',
|
||||
'paid_at',
|
||||
'amount',
|
||||
'currency_code',
|
||||
'currency_rate',
|
||||
'document_id',
|
||||
'contact_id',
|
||||
'payment_method',
|
||||
'reconciled',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'transactions';
|
||||
}
|
||||
}
|
||||
62
app/Exports/Common/Items.php
Normal file
62
app/Exports/Common/Items.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Common;
|
||||
|
||||
use App\Models\Common\Item as Model;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class Items implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
{
|
||||
public $ids;
|
||||
|
||||
public function __construct($ids = null)
|
||||
{
|
||||
$this->ids = $ids;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->ids)) {
|
||||
$model->whereIn('id', (array) $this->ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->name,
|
||||
$model->description,
|
||||
$model->sale_price,
|
||||
$model->purchase_price,
|
||||
$model->category_id,
|
||||
$model->tax_id,
|
||||
$model->enabled,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'name',
|
||||
'description',
|
||||
'sale_price',
|
||||
'purchase_price',
|
||||
'category_id',
|
||||
'tax_id',
|
||||
'enabled',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'items';
|
||||
}
|
||||
}
|
||||
31
app/Exports/Common/Reports.php
Normal file
31
app/Exports/Common/Reports.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Common;
|
||||
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Maatwebsite\Excel\Concerns\FromView;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class Reports implements FromView, ShouldAutoSize, WithTitle
|
||||
{
|
||||
protected $view;
|
||||
|
||||
protected $class;
|
||||
|
||||
public function __construct($view, $class)
|
||||
{
|
||||
$this->view = $view;
|
||||
$this->class = $class;
|
||||
}
|
||||
|
||||
public function view(): View
|
||||
{
|
||||
return view($this->view, ['class' => $this->class]);
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'reports';
|
||||
}
|
||||
}
|
||||
33
app/Exports/Expenses/Bills.php
Normal file
33
app/Exports/Expenses/Bills.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Expenses;
|
||||
|
||||
use App\Exports\Expenses\Sheets\Bills as Base;
|
||||
use App\Exports\Expenses\Sheets\BillItems;
|
||||
use App\Exports\Expenses\Sheets\BillItemTaxes;
|
||||
use App\Exports\Expenses\Sheets\BillHistories;
|
||||
use App\Exports\Expenses\Sheets\BillPayments;
|
||||
use App\Exports\Expenses\Sheets\BillTotals;
|
||||
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
|
||||
|
||||
class Bills implements WithMultipleSheets
|
||||
{
|
||||
public $ids;
|
||||
|
||||
public function __construct($ids = null)
|
||||
{
|
||||
$this->ids = $ids;
|
||||
}
|
||||
|
||||
public function sheets(): array
|
||||
{
|
||||
return [
|
||||
'bills' => new Base($this->ids),
|
||||
'bill_items' => new BillItems($this->ids),
|
||||
'bill_item_taxes' => new BillItemTaxes($this->ids),
|
||||
'bill_histories' => new BillHistories($this->ids),
|
||||
'bill_payments' => new BillPayments($this->ids),
|
||||
'bill_totals' => new BillTotals($this->ids),
|
||||
];
|
||||
}
|
||||
}
|
||||
66
app/Exports/Expenses/Payments.php
Normal file
66
app/Exports/Expenses/Payments.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Expenses;
|
||||
|
||||
use App\Models\Banking\Transaction as Model;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class Payments implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
{
|
||||
public $ids;
|
||||
|
||||
public function __construct($ids = null)
|
||||
{
|
||||
$this->ids = $ids;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::type('expense')->usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->ids)) {
|
||||
$model->whereIn('id', (array) $this->ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->account_id,
|
||||
$model->paid_at,
|
||||
$model->amount,
|
||||
$model->currency_code,
|
||||
$model->currency_rate,
|
||||
$model->document_id,
|
||||
$model->contact_id,
|
||||
$model->payment_method,
|
||||
$model->reconciled,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'account_id',
|
||||
'paid_at',
|
||||
'amount',
|
||||
'currency_code',
|
||||
'currency_rate',
|
||||
'document_id',
|
||||
'contact_id',
|
||||
'payment_method',
|
||||
'reconciled',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'payments';
|
||||
}
|
||||
}
|
||||
56
app/Exports/Expenses/Sheets/BillHistories.php
Normal file
56
app/Exports/Expenses/Sheets/BillHistories.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Expenses\Sheets;
|
||||
|
||||
use App\Models\Expense\BillHistory as Model;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class BillHistories implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
{
|
||||
public $bill_ids;
|
||||
|
||||
public function __construct($bill_ids = null)
|
||||
{
|
||||
$this->bill_ids = $bill_ids;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->bill_ids)) {
|
||||
$model->whereIn('bill_id', (array) $this->bill_ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->bill_id,
|
||||
$model->status_code,
|
||||
$model->notify,
|
||||
$model->description,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'bill_id',
|
||||
'status_code',
|
||||
'notify',
|
||||
'description',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'bill_histories';
|
||||
}
|
||||
}
|
||||
58
app/Exports/Expenses/Sheets/BillItemTaxes.php
Normal file
58
app/Exports/Expenses/Sheets/BillItemTaxes.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Expenses\Sheets;
|
||||
|
||||
use App\Models\Expense\BillItemTax as Model;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class BillItemTaxes implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
{
|
||||
public $bill_ids;
|
||||
|
||||
public function __construct($bill_ids = null)
|
||||
{
|
||||
$this->bill_ids = $bill_ids;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->bill_ids)) {
|
||||
$model->whereIn('bill_id', (array) $this->bill_ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->bill_id,
|
||||
$model->bill_item_id,
|
||||
$model->tax_id,
|
||||
$model->name,
|
||||
$model->amount,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'bill_id',
|
||||
'bill_item_id',
|
||||
'tax_id',
|
||||
'name',
|
||||
'amount',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'bill_item_taxes';
|
||||
}
|
||||
}
|
||||
60
app/Exports/Expenses/Sheets/BillItems.php
Normal file
60
app/Exports/Expenses/Sheets/BillItems.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Expenses\Sheets;
|
||||
|
||||
use App\Models\Expense\BillItem as Model;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class BillItems implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
{
|
||||
public $bill_ids;
|
||||
|
||||
public function __construct($bill_ids = null)
|
||||
{
|
||||
$this->bill_ids = $bill_ids;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->bill_ids)) {
|
||||
$model->whereIn('bill_id', (array) $this->bill_ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->bill_id,
|
||||
$model->item_id,
|
||||
$model->name,
|
||||
$model->price,
|
||||
$model->total,
|
||||
$model->tax,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'bill_id',
|
||||
'item_id',
|
||||
'name',
|
||||
'price',
|
||||
'total',
|
||||
'tax',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'bill_items';
|
||||
}
|
||||
}
|
||||
66
app/Exports/Expenses/Sheets/BillPayments.php
Normal file
66
app/Exports/Expenses/Sheets/BillPayments.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Expenses\Sheets;
|
||||
|
||||
use App\Models\Banking\Transaction as Model;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class BillPayments implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
{
|
||||
public $bill_ids;
|
||||
|
||||
public function __construct($bill_ids = null)
|
||||
{
|
||||
$this->bill_ids = $bill_ids;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::type('expense')->isDocument()->usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->bill_ids)) {
|
||||
$model->whereIn('bill_id', (array) $this->bill_ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->account_id,
|
||||
$model->paid_at,
|
||||
$model->amount,
|
||||
$model->currency_code,
|
||||
$model->currency_rate,
|
||||
$model->document_id,
|
||||
$model->contact_id,
|
||||
$model->payment_method,
|
||||
$model->reconciled,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'account_id',
|
||||
'paid_at',
|
||||
'amount',
|
||||
'currency_code',
|
||||
'currency_rate',
|
||||
'document_id',
|
||||
'contact_id',
|
||||
'payment_method',
|
||||
'reconciled',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'bill_payments';
|
||||
}
|
||||
}
|
||||
58
app/Exports/Expenses/Sheets/BillTotals.php
Normal file
58
app/Exports/Expenses/Sheets/BillTotals.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Expenses\Sheets;
|
||||
|
||||
use App\Models\Expense\BillTotal as Model;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class BillTotals implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
{
|
||||
public $bill_ids;
|
||||
|
||||
public function __construct($bill_ids = null)
|
||||
{
|
||||
$this->bill_ids = $bill_ids;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->bill_ids)) {
|
||||
$model->whereIn('bill_id', (array) $this->bill_ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->bill_id,
|
||||
$model->code,
|
||||
$model->name,
|
||||
$model->amount,
|
||||
$model->sort_order,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'bill_id',
|
||||
'code',
|
||||
'name',
|
||||
'amount',
|
||||
'sort_order',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'bill_totals';
|
||||
}
|
||||
}
|
||||
81
app/Exports/Expenses/Sheets/Bills.php
Normal file
81
app/Exports/Expenses/Sheets/Bills.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Expenses\Sheets;
|
||||
|
||||
use App\Models\Expense\Bill as Model;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class Bills implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
{
|
||||
public $ids;
|
||||
|
||||
public function __construct($ids = null)
|
||||
{
|
||||
$this->ids = $ids;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->ids)) {
|
||||
$model->whereIn('id', (array) $this->ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->bill_number,
|
||||
$model->order_number,
|
||||
$model->bill_status_code,
|
||||
$model->billed_at,
|
||||
$model->due_at,
|
||||
$model->amount,
|
||||
$model->currency_code,
|
||||
$model->currency_rate,
|
||||
$model->contact_id,
|
||||
$model->contact_name,
|
||||
$model->contact_email,
|
||||
$model->contact_tax_number,
|
||||
$model->contact_phone,
|
||||
$model->contact_address,
|
||||
$model->notes,
|
||||
$model->category_id,
|
||||
$model->footer,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'bill_number',
|
||||
'order_number',
|
||||
'bill_status_code',
|
||||
'billed_at',
|
||||
'due_at',
|
||||
'amount',
|
||||
'currency_code',
|
||||
'currency_rate',
|
||||
'contact_id',
|
||||
'contact_name',
|
||||
'contact_email',
|
||||
'contact_tax_number',
|
||||
'contact_address',
|
||||
'notes',
|
||||
'category_id',
|
||||
'footer',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'bills';
|
||||
}
|
||||
}
|
||||
68
app/Exports/Expenses/Vendors.php
Normal file
68
app/Exports/Expenses/Vendors.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Expenses;
|
||||
|
||||
use App\Models\Common\Contact as Model;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class Vendors implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
{
|
||||
public $ids;
|
||||
|
||||
public function __construct($ids = null)
|
||||
{
|
||||
$this->ids = $ids;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::type('vendor')->usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->ids)) {
|
||||
$model->whereIn('id', (array) $this->ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->name,
|
||||
$model->email,
|
||||
$model->user_id,
|
||||
$model->tax_number,
|
||||
$model->phone,
|
||||
$model->address,
|
||||
$model->website,
|
||||
$model->currency_code,
|
||||
$model->reference,
|
||||
$model->enabled,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'name',
|
||||
'email',
|
||||
'user_id',
|
||||
'tax_number',
|
||||
'phone',
|
||||
'address',
|
||||
'website',
|
||||
'currency_code',
|
||||
'reference',
|
||||
'enabled',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'vendors';
|
||||
}
|
||||
}
|
||||
68
app/Exports/Incomes/Customers.php
Normal file
68
app/Exports/Incomes/Customers.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Incomes;
|
||||
|
||||
use App\Models\Common\Contact as Model;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class Customers implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
{
|
||||
public $ids;
|
||||
|
||||
public function __construct($ids = null)
|
||||
{
|
||||
$this->ids = $ids;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::type('customer')->usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->ids)) {
|
||||
$model->whereIn('id', (array) $this->ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->name,
|
||||
$model->email,
|
||||
$model->user_id,
|
||||
$model->tax_number,
|
||||
$model->phone,
|
||||
$model->address,
|
||||
$model->website,
|
||||
$model->currency_code,
|
||||
$model->reference,
|
||||
$model->enabled,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'name',
|
||||
'email',
|
||||
'user_id',
|
||||
'tax_number',
|
||||
'phone',
|
||||
'address',
|
||||
'website',
|
||||
'currency_code',
|
||||
'reference',
|
||||
'enabled',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'customers';
|
||||
}
|
||||
}
|
||||
33
app/Exports/Incomes/Invoices.php
Normal file
33
app/Exports/Incomes/Invoices.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Incomes;
|
||||
|
||||
use App\Exports\Incomes\Sheets\Invoices as Base;
|
||||
use App\Exports\Incomes\Sheets\InvoiceItems;
|
||||
use App\Exports\Incomes\Sheets\InvoiceItemTaxes;
|
||||
use App\Exports\Incomes\Sheets\InvoiceHistories;
|
||||
use App\Exports\Incomes\Sheets\InvoicePayments;
|
||||
use App\Exports\Incomes\Sheets\InvoiceTotals;
|
||||
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
|
||||
|
||||
class Invoices implements WithMultipleSheets
|
||||
{
|
||||
public $ids;
|
||||
|
||||
public function __construct($ids = null)
|
||||
{
|
||||
$this->ids = $ids;
|
||||
}
|
||||
|
||||
public function sheets(): array
|
||||
{
|
||||
return [
|
||||
'invoices' => new Base($this->ids),
|
||||
'invoice_items' => new InvoiceItems($this->ids),
|
||||
'invoice_item_taxes' => new InvoiceItemTaxes($this->ids),
|
||||
'invoice_histories' => new InvoiceHistories($this->ids),
|
||||
'invoice_payments' => new InvoicePayments($this->ids),
|
||||
'invoice_totals' => new InvoiceTotals($this->ids),
|
||||
];
|
||||
}
|
||||
}
|
||||
66
app/Exports/Incomes/Revenues.php
Normal file
66
app/Exports/Incomes/Revenues.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Incomes;
|
||||
|
||||
use App\Models\Banking\Transaction as Model;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class Revenues implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
{
|
||||
public $ids;
|
||||
|
||||
public function __construct($ids = null)
|
||||
{
|
||||
$this->ids = $ids;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::type('income')->usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->ids)) {
|
||||
$model->whereIn('id', (array) $this->ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->account_id,
|
||||
$model->paid_at,
|
||||
$model->amount,
|
||||
$model->currency_code,
|
||||
$model->currency_rate,
|
||||
$model->document_id,
|
||||
$model->contact_id,
|
||||
$model->payment_method,
|
||||
$model->reconciled,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'account_id',
|
||||
'paid_at',
|
||||
'amount',
|
||||
'currency_code',
|
||||
'currency_rate',
|
||||
'document_id',
|
||||
'contact_id',
|
||||
'payment_method',
|
||||
'reconciled',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'revenues';
|
||||
}
|
||||
}
|
||||
56
app/Exports/Incomes/Sheets/InvoiceHistories.php
Normal file
56
app/Exports/Incomes/Sheets/InvoiceHistories.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Incomes\Sheets;
|
||||
|
||||
use App\Models\Income\InvoiceHistory as Model;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class InvoiceHistories implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
{
|
||||
public $invoice_ids;
|
||||
|
||||
public function __construct($invoice_ids = null)
|
||||
{
|
||||
$this->invoice_ids = $invoice_ids;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->invoice_ids)) {
|
||||
$model->whereIn('invoice_id', (array) $this->invoice_ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->invoice_id,
|
||||
$model->status_code,
|
||||
$model->notify,
|
||||
$model->description,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'invoice_id',
|
||||
'status_code',
|
||||
'notify',
|
||||
'description',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'invoice_histories';
|
||||
}
|
||||
}
|
||||
58
app/Exports/Incomes/Sheets/InvoiceItemTaxes.php
Normal file
58
app/Exports/Incomes/Sheets/InvoiceItemTaxes.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Incomes\Sheets;
|
||||
|
||||
use App\Models\Income\InvoiceItemTax as Model;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class InvoiceItemTaxes implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
{
|
||||
public $invoice_ids;
|
||||
|
||||
public function __construct($invoice_ids = null)
|
||||
{
|
||||
$this->invoice_ids = $invoice_ids;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->invoice_ids)) {
|
||||
$model->whereIn('invoice_id', (array) $this->invoice_ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->invoice_id,
|
||||
$model->invoice_item_id,
|
||||
$model->tax_id,
|
||||
$model->name,
|
||||
$model->amount,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'invoice_id',
|
||||
'invoice_item_id',
|
||||
'tax_id',
|
||||
'name',
|
||||
'amount',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'invoice_item_taxes';
|
||||
}
|
||||
}
|
||||
60
app/Exports/Incomes/Sheets/InvoiceItems.php
Normal file
60
app/Exports/Incomes/Sheets/InvoiceItems.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Incomes\Sheets;
|
||||
|
||||
use App\Models\Income\InvoiceItem as Model;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class InvoiceItems implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
{
|
||||
public $invoice_ids;
|
||||
|
||||
public function __construct($invoice_ids = null)
|
||||
{
|
||||
$this->invoice_ids = $invoice_ids;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->invoice_ids)) {
|
||||
$model->whereIn('invoice_id', (array) $this->invoice_ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->invoice_id,
|
||||
$model->item_id,
|
||||
$model->name,
|
||||
$model->price,
|
||||
$model->total,
|
||||
$model->tax,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'invoice_id',
|
||||
'item_id',
|
||||
'name',
|
||||
'price',
|
||||
'total',
|
||||
'tax',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'invoice_items';
|
||||
}
|
||||
}
|
||||
66
app/Exports/Incomes/Sheets/InvoicePayments.php
Normal file
66
app/Exports/Incomes/Sheets/InvoicePayments.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Incomes\Sheets;
|
||||
|
||||
use App\Models\Banking\Transaction as Model;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class InvoicePayments implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
{
|
||||
public $invoice_ids;
|
||||
|
||||
public function __construct($invoice_ids = null)
|
||||
{
|
||||
$this->invoice_ids = $invoice_ids;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::type('income')->isDocument()->usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->invoice_ids)) {
|
||||
$model->whereIn('invoice_id', (array) $this->invoice_ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->account_id,
|
||||
$model->paid_at,
|
||||
$model->amount,
|
||||
$model->currency_code,
|
||||
$model->currency_rate,
|
||||
$model->document_id,
|
||||
$model->contact_id,
|
||||
$model->payment_method,
|
||||
$model->reconciled,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'account_id',
|
||||
'paid_at',
|
||||
'amount',
|
||||
'currency_code',
|
||||
'currency_rate',
|
||||
'document_id',
|
||||
'contact_id',
|
||||
'payment_method',
|
||||
'reconciled',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'invoice_payments';
|
||||
}
|
||||
}
|
||||
58
app/Exports/Incomes/Sheets/InvoiceTotals.php
Normal file
58
app/Exports/Incomes/Sheets/InvoiceTotals.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Incomes\Sheets;
|
||||
|
||||
use App\Models\Income\InvoiceTotal as Model;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class InvoiceTotals implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
{
|
||||
public $invoice_ids;
|
||||
|
||||
public function __construct($invoice_ids = null)
|
||||
{
|
||||
$this->invoice_ids = $invoice_ids;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->invoice_ids)) {
|
||||
$model->whereIn('invoice_id', (array) $this->invoice_ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->invoice_id,
|
||||
$model->code,
|
||||
$model->name,
|
||||
$model->amount,
|
||||
$model->sort_order,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'invoice_id',
|
||||
'code',
|
||||
'name',
|
||||
'amount',
|
||||
'sort_order',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'invoice_totals';
|
||||
}
|
||||
}
|
||||
81
app/Exports/Incomes/Sheets/Invoices.php
Normal file
81
app/Exports/Incomes/Sheets/Invoices.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Incomes\Sheets;
|
||||
|
||||
use App\Models\Income\Invoice as Model;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
|
||||
class Invoices implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||
{
|
||||
public $ids;
|
||||
|
||||
public function __construct($ids = null)
|
||||
{
|
||||
$this->ids = $ids;
|
||||
}
|
||||
|
||||
public function collection()
|
||||
{
|
||||
$model = Model::usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->ids)) {
|
||||
$model->whereIn('id', (array) $this->ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->invoice_number,
|
||||
$model->order_number,
|
||||
$model->invoice_status_code,
|
||||
$model->invoiced_at,
|
||||
$model->due_at,
|
||||
$model->amount,
|
||||
$model->currency_code,
|
||||
$model->currency_rate,
|
||||
$model->contact_id,
|
||||
$model->contact_name,
|
||||
$model->contact_email,
|
||||
$model->contact_tax_number,
|
||||
$model->contact_phone,
|
||||
$model->contact_address,
|
||||
$model->notes,
|
||||
$model->category_id,
|
||||
$model->footer,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return [
|
||||
'invoice_number',
|
||||
'order_number',
|
||||
'invoice_status_code',
|
||||
'invoiced_at',
|
||||
'due_at',
|
||||
'amount',
|
||||
'currency_code',
|
||||
'currency_rate',
|
||||
'contact_id',
|
||||
'contact_name',
|
||||
'contact_email',
|
||||
'contact_tax_number',
|
||||
'contact_address',
|
||||
'notes',
|
||||
'category_id',
|
||||
'footer',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'invoices';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user