export abstract
This commit is contained in:
parent
88dade86b6
commit
569f6c314f
55
app/Abstracts/Export.php
Normal file
55
app/Abstracts/Export.php
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Abstracts;
|
||||||
|
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
use Jenssegers\Date\Date;
|
||||||
|
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;
|
||||||
|
|
||||||
|
abstract class Export implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
||||||
|
{
|
||||||
|
public $ids;
|
||||||
|
|
||||||
|
public function __construct($ids = null)
|
||||||
|
{
|
||||||
|
$this->ids = $ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function title(): string
|
||||||
|
{
|
||||||
|
return Str::snake((new \ReflectionClass($this))->getShortName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function fields(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function map($model): array
|
||||||
|
{
|
||||||
|
$map = [];
|
||||||
|
|
||||||
|
$date_fields = ['paid_at', 'invoiced_at', 'billed_at', 'due_at', 'issued_at', 'created_at'];
|
||||||
|
|
||||||
|
foreach ($this->fields() as $field) {
|
||||||
|
$value = $model->$field;
|
||||||
|
|
||||||
|
if (in_array($field, $date_fields)) {
|
||||||
|
$value = Date::parse($value)->format('Y-m-d');
|
||||||
|
}
|
||||||
|
|
||||||
|
$map[] = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $map;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function headings(): array
|
||||||
|
{
|
||||||
|
return $this->fields();
|
||||||
|
}
|
||||||
|
}
|
@ -2,41 +2,17 @@
|
|||||||
|
|
||||||
namespace App\Exports\Banking;
|
namespace App\Exports\Banking;
|
||||||
|
|
||||||
|
use App\Abstracts\Export;
|
||||||
use App\Models\Banking\Transaction as Model;
|
use App\Models\Banking\Transaction as Model;
|
||||||
use Jenssegers\Date\Date;
|
|
||||||
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
|
class Transactions extends Export
|
||||||
{
|
{
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
return Model::usingSearchString(request('search'))->get();
|
return Model::usingSearchString(request('search'))->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map($model): array
|
public function fields(): array
|
||||||
{
|
|
||||||
return [
|
|
||||||
$model->type,
|
|
||||||
Date::parse($model->paid_at)->format('Y-m-d'),
|
|
||||||
$model->amount,
|
|
||||||
$model->currency_code,
|
|
||||||
$model->currency_rate,
|
|
||||||
$model->account_id,
|
|
||||||
$model->document_id,
|
|
||||||
$model->contact_id,
|
|
||||||
$model->category_id,
|
|
||||||
$model->description,
|
|
||||||
$model->payment_method,
|
|
||||||
$model->reference,
|
|
||||||
$model->reconciled,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function headings(): array
|
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'type',
|
'type',
|
||||||
@ -54,9 +30,4 @@ class Transactions implements FromCollection, ShouldAutoSize, WithHeadings, With
|
|||||||
'reconciled',
|
'reconciled',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function title(): string
|
|
||||||
{
|
|
||||||
return 'transactions';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,22 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Exports\Common;
|
namespace App\Exports\Common;
|
||||||
|
|
||||||
|
use App\Abstracts\Export;
|
||||||
use App\Models\Common\Item as Model;
|
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
|
class Items extends Export
|
||||||
{
|
{
|
||||||
public $ids;
|
|
||||||
|
|
||||||
public function __construct($ids = null)
|
|
||||||
{
|
|
||||||
$this->ids = $ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
$model = Model::usingSearchString(request('search'));
|
$model = Model::usingSearchString(request('search'));
|
||||||
@ -29,20 +18,7 @@ class Items implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping
|
|||||||
return $model->get();
|
return $model->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map($model): array
|
public function fields(): 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 [
|
return [
|
||||||
'name',
|
'name',
|
||||||
@ -54,9 +30,4 @@ class Items implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping
|
|||||||
'enabled',
|
'enabled',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function title(): string
|
|
||||||
{
|
|
||||||
return 'items';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,23 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Exports\Purchases;
|
namespace App\Exports\Purchases;
|
||||||
|
|
||||||
|
use App\Abstracts\Export;
|
||||||
use App\Models\Banking\Transaction as Model;
|
use App\Models\Banking\Transaction as Model;
|
||||||
use Jenssegers\Date\Date;
|
|
||||||
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
|
class Payments extends Export
|
||||||
{
|
{
|
||||||
public $ids;
|
|
||||||
|
|
||||||
public function __construct($ids = null)
|
|
||||||
{
|
|
||||||
$this->ids = $ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
$model = Model::type('expense')->usingSearchString(request('search'));
|
$model = Model::type('expense')->usingSearchString(request('search'));
|
||||||
@ -30,25 +18,7 @@ class Payments implements FromCollection, ShouldAutoSize, WithHeadings, WithMapp
|
|||||||
return $model->get();
|
return $model->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map($model): array
|
public function fields(): array
|
||||||
{
|
|
||||||
return [
|
|
||||||
Date::parse($model->paid_at)->format('Y-m-d'),
|
|
||||||
$model->amount,
|
|
||||||
$model->currency_code,
|
|
||||||
$model->currency_rate,
|
|
||||||
$model->account_id,
|
|
||||||
$model->document_id,
|
|
||||||
$model->contact_id,
|
|
||||||
$model->category_id,
|
|
||||||
$model->description,
|
|
||||||
$model->payment_method,
|
|
||||||
$model->reference,
|
|
||||||
$model->reconciled,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function headings(): array
|
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'paid_at',
|
'paid_at',
|
||||||
@ -65,9 +35,4 @@ class Payments implements FromCollection, ShouldAutoSize, WithHeadings, WithMapp
|
|||||||
'reconciled',
|
'reconciled',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function title(): string
|
|
||||||
{
|
|
||||||
return 'payments';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,44 +2,23 @@
|
|||||||
|
|
||||||
namespace App\Exports\Purchases\Sheets;
|
namespace App\Exports\Purchases\Sheets;
|
||||||
|
|
||||||
|
use App\Abstracts\Export;
|
||||||
use App\Models\Purchase\BillHistory as Model;
|
use App\Models\Purchase\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
|
class BillHistories extends Export
|
||||||
{
|
{
|
||||||
public $bill_ids;
|
|
||||||
|
|
||||||
public function __construct($bill_ids = null)
|
|
||||||
{
|
|
||||||
$this->bill_ids = $bill_ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
$model = Model::usingSearchString(request('search'));
|
$model = Model::usingSearchString(request('search'));
|
||||||
|
|
||||||
if (!empty($this->bill_ids)) {
|
if (!empty($this->ids)) {
|
||||||
$model->whereIn('bill_id', (array) $this->bill_ids);
|
$model->whereIn('bill_id', (array) $this->ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $model->get();
|
return $model->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map($model): array
|
public function fields(): array
|
||||||
{
|
|
||||||
return [
|
|
||||||
$model->bill_id,
|
|
||||||
$model->status,
|
|
||||||
$model->notify,
|
|
||||||
$model->description,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function headings(): array
|
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'bill_id',
|
'bill_id',
|
||||||
@ -48,9 +27,4 @@ class BillHistories implements FromCollection, ShouldAutoSize, WithHeadings, Wit
|
|||||||
'description',
|
'description',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function title(): string
|
|
||||||
{
|
|
||||||
return 'bill_histories';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,45 +2,23 @@
|
|||||||
|
|
||||||
namespace App\Exports\Purchases\Sheets;
|
namespace App\Exports\Purchases\Sheets;
|
||||||
|
|
||||||
|
use App\Abstracts\Export;
|
||||||
use App\Models\Purchase\BillItemTax as Model;
|
use App\Models\Purchase\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
|
class BillItemTaxes extends Export
|
||||||
{
|
{
|
||||||
public $bill_ids;
|
|
||||||
|
|
||||||
public function __construct($bill_ids = null)
|
|
||||||
{
|
|
||||||
$this->bill_ids = $bill_ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
$model = Model::usingSearchString(request('search'));
|
$model = Model::usingSearchString(request('search'));
|
||||||
|
|
||||||
if (!empty($this->bill_ids)) {
|
if (!empty($this->ids)) {
|
||||||
$model->whereIn('bill_id', (array) $this->bill_ids);
|
$model->whereIn('bill_id', (array) $this->ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $model->get();
|
return $model->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map($model): array
|
public function fields(): array
|
||||||
{
|
|
||||||
return [
|
|
||||||
$model->bill_id,
|
|
||||||
$model->bill_item_id,
|
|
||||||
$model->tax_id,
|
|
||||||
$model->name,
|
|
||||||
$model->amount,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function headings(): array
|
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'bill_id',
|
'bill_id',
|
||||||
@ -50,9 +28,4 @@ class BillItemTaxes implements FromCollection, ShouldAutoSize, WithHeadings, Wit
|
|||||||
'amount',
|
'amount',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function title(): string
|
|
||||||
{
|
|
||||||
return 'bill_item_taxes';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Exports\Purchases\Sheets;
|
namespace App\Exports\Purchases\Sheets;
|
||||||
|
|
||||||
|
use App\Abstracts\Export;
|
||||||
use App\Models\Purchase\BillItem as Model;
|
use App\Models\Purchase\BillItem as Model;
|
||||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
|
||||||
@ -9,40 +10,20 @@ use Maatwebsite\Excel\Concerns\WithHeadings;
|
|||||||
use Maatwebsite\Excel\Concerns\WithMapping;
|
use Maatwebsite\Excel\Concerns\WithMapping;
|
||||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||||
|
|
||||||
class BillItems implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
class BillItems extends Export
|
||||||
{
|
{
|
||||||
public $bill_ids;
|
|
||||||
|
|
||||||
public function __construct($bill_ids = null)
|
|
||||||
{
|
|
||||||
$this->bill_ids = $bill_ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
$model = Model::usingSearchString(request('search'));
|
$model = Model::usingSearchString(request('search'));
|
||||||
|
|
||||||
if (!empty($this->bill_ids)) {
|
if (!empty($this->ids)) {
|
||||||
$model->whereIn('bill_id', (array) $this->bill_ids);
|
$model->whereIn('bill_id', (array) $this->ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $model->get();
|
return $model->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map($model): array
|
public function fields(): array
|
||||||
{
|
|
||||||
return [
|
|
||||||
$model->bill_id,
|
|
||||||
$model->item_id,
|
|
||||||
$model->name,
|
|
||||||
$model->quantity,
|
|
||||||
$model->price,
|
|
||||||
$model->total,
|
|
||||||
$model->tax,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function headings(): array
|
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'bill_id',
|
'bill_id',
|
||||||
@ -54,9 +35,4 @@ class BillItems implements FromCollection, ShouldAutoSize, WithHeadings, WithMap
|
|||||||
'tax',
|
'tax',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function title(): string
|
|
||||||
{
|
|
||||||
return 'bill_items';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,45 +2,24 @@
|
|||||||
|
|
||||||
namespace App\Exports\Purchases\Sheets;
|
namespace App\Exports\Purchases\Sheets;
|
||||||
|
|
||||||
|
use App\Abstracts\Export;
|
||||||
use App\Models\Purchase\BillTotal as Model;
|
use App\Models\Purchase\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
|
class BillTotals extends Export
|
||||||
{
|
{
|
||||||
public $bill_ids;
|
|
||||||
|
|
||||||
public function __construct($bill_ids = null)
|
|
||||||
{
|
|
||||||
$this->bill_ids = $bill_ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
$model = Model::usingSearchString(request('search'));
|
$model = Model::usingSearchString(request('search'));
|
||||||
|
|
||||||
if (!empty($this->bill_ids)) {
|
if (!empty($this->ids)) {
|
||||||
$model->whereIn('bill_id', (array) $this->bill_ids);
|
$model->whereIn('bill_id', (array) $this->ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $model->get();
|
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
|
public function fields(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'bill_id',
|
'bill_id',
|
||||||
@ -50,9 +29,4 @@ class BillTotals implements FromCollection, ShouldAutoSize, WithHeadings, WithMa
|
|||||||
'sort_order',
|
'sort_order',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function title(): string
|
|
||||||
{
|
|
||||||
return 'bill_totals';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,53 +2,23 @@
|
|||||||
|
|
||||||
namespace App\Exports\Purchases\Sheets;
|
namespace App\Exports\Purchases\Sheets;
|
||||||
|
|
||||||
|
use App\Abstracts\Export;
|
||||||
use App\Models\Banking\Transaction as Model;
|
use App\Models\Banking\Transaction as Model;
|
||||||
use Jenssegers\Date\Date;
|
|
||||||
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 BillTransactions implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
class BillTransactions extends Export
|
||||||
{
|
{
|
||||||
public $bill_ids;
|
|
||||||
|
|
||||||
public function __construct($bill_ids = null)
|
|
||||||
{
|
|
||||||
$this->bill_ids = $bill_ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
$model = Model::type('expense')->isDocument()->usingSearchString(request('search'));
|
$model = Model::type('expense')->isDocument()->usingSearchString(request('search'));
|
||||||
|
|
||||||
if (!empty($this->bill_ids)) {
|
if (!empty($this->ids)) {
|
||||||
$model->whereIn('document_id', (array) $this->bill_ids);
|
$model->whereIn('document_id', (array) $this->ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $model->get();
|
return $model->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map($model): array
|
public function fields(): array
|
||||||
{
|
|
||||||
return [
|
|
||||||
Date::parse($model->paid_at)->format('Y-m-d'),
|
|
||||||
$model->amount,
|
|
||||||
$model->currency_code,
|
|
||||||
$model->currency_rate,
|
|
||||||
$model->account_id,
|
|
||||||
$model->document_id,
|
|
||||||
$model->contact_id,
|
|
||||||
$model->category_id,
|
|
||||||
$model->description,
|
|
||||||
$model->payment_method,
|
|
||||||
$model->reference,
|
|
||||||
$model->reconciled,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function headings(): array
|
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'paid_at',
|
'paid_at',
|
||||||
@ -65,9 +35,4 @@ class BillTransactions implements FromCollection, ShouldAutoSize, WithHeadings,
|
|||||||
'reconciled',
|
'reconciled',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function title(): string
|
|
||||||
{
|
|
||||||
return 'bill_transactions';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,23 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Exports\Purchases\Sheets;
|
namespace App\Exports\Purchases\Sheets;
|
||||||
|
|
||||||
|
use App\Abstracts\Export;
|
||||||
use App\Models\Purchase\Bill as Model;
|
use App\Models\Purchase\Bill as Model;
|
||||||
use Jenssegers\Date\Date;
|
|
||||||
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
|
class Bills extends Export
|
||||||
{
|
{
|
||||||
public $ids;
|
|
||||||
|
|
||||||
public function __construct($ids = null)
|
|
||||||
{
|
|
||||||
$this->ids = $ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
$model = Model::usingSearchString(request('search'));
|
$model = Model::usingSearchString(request('search'));
|
||||||
@ -30,30 +18,7 @@ class Bills implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping
|
|||||||
return $model->get();
|
return $model->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map($model): array
|
public function fields(): array
|
||||||
{
|
|
||||||
return [
|
|
||||||
$model->bill_number,
|
|
||||||
$model->order_number,
|
|
||||||
$model->status,
|
|
||||||
Date::parse($model->billed_at)->format('Y-m-d'),
|
|
||||||
Date::parse($model->due_at)->format('Y-m-d'),
|
|
||||||
$model->amount,
|
|
||||||
$model->currency_code,
|
|
||||||
$model->currency_rate,
|
|
||||||
$model->category_id,
|
|
||||||
$model->contact_id,
|
|
||||||
$model->contact_name,
|
|
||||||
$model->contact_email,
|
|
||||||
$model->contact_tax_number,
|
|
||||||
$model->contact_phone,
|
|
||||||
$model->contact_address,
|
|
||||||
$model->notes,
|
|
||||||
$model->footer,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function headings(): array
|
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'bill_number',
|
'bill_number',
|
||||||
@ -75,9 +40,4 @@ class Bills implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping
|
|||||||
'footer',
|
'footer',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function title(): string
|
|
||||||
{
|
|
||||||
return 'bills';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,22 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Exports\Purchases;
|
namespace App\Exports\Purchases;
|
||||||
|
|
||||||
|
use App\Abstracts\Export;
|
||||||
use App\Models\Common\Contact as Model;
|
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
|
class Vendors extends Export
|
||||||
{
|
{
|
||||||
public $ids;
|
|
||||||
|
|
||||||
public function __construct($ids = null)
|
|
||||||
{
|
|
||||||
$this->ids = $ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
$model = Model::type('vendor')->usingSearchString(request('search'));
|
$model = Model::type('vendor')->usingSearchString(request('search'));
|
||||||
@ -29,23 +18,7 @@ class Vendors implements FromCollection, ShouldAutoSize, WithHeadings, WithMappi
|
|||||||
return $model->get();
|
return $model->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map($model): array
|
public function fields(): array
|
||||||
{
|
|
||||||
return [
|
|
||||||
$model->name,
|
|
||||||
$model->email,
|
|
||||||
$model->tax_number,
|
|
||||||
$model->phone,
|
|
||||||
$model->address,
|
|
||||||
$model->website,
|
|
||||||
$model->currency_code,
|
|
||||||
$model->reference,
|
|
||||||
$model->enabled,
|
|
||||||
$model->user_id,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function headings(): array
|
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name',
|
'name',
|
||||||
@ -60,9 +33,4 @@ class Vendors implements FromCollection, ShouldAutoSize, WithHeadings, WithMappi
|
|||||||
'user_id',
|
'user_id',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function title(): string
|
|
||||||
{
|
|
||||||
return 'vendors';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,22 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Exports\Sales;
|
namespace App\Exports\Sales;
|
||||||
|
|
||||||
|
use App\Abstracts\Export;
|
||||||
use App\Models\Common\Contact as Model;
|
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
|
class Customers extends Export
|
||||||
{
|
{
|
||||||
public $ids;
|
|
||||||
|
|
||||||
public function __construct($ids = null)
|
|
||||||
{
|
|
||||||
$this->ids = $ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
$model = Model::type('customer')->usingSearchString(request('search'));
|
$model = Model::type('customer')->usingSearchString(request('search'));
|
||||||
@ -29,23 +18,7 @@ class Customers implements FromCollection, ShouldAutoSize, WithHeadings, WithMap
|
|||||||
return $model->get();
|
return $model->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map($model): array
|
public function fields(): array
|
||||||
{
|
|
||||||
return [
|
|
||||||
$model->name,
|
|
||||||
$model->email,
|
|
||||||
$model->tax_number,
|
|
||||||
$model->phone,
|
|
||||||
$model->address,
|
|
||||||
$model->website,
|
|
||||||
$model->currency_code,
|
|
||||||
$model->reference,
|
|
||||||
$model->enabled,
|
|
||||||
$model->user_id,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function headings(): array
|
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name',
|
'name',
|
||||||
@ -60,9 +33,4 @@ class Customers implements FromCollection, ShouldAutoSize, WithHeadings, WithMap
|
|||||||
'user_id',
|
'user_id',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function title(): string
|
|
||||||
{
|
|
||||||
return 'customers';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,23 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Exports\Sales;
|
namespace App\Exports\Sales;
|
||||||
|
|
||||||
|
use App\Abstracts\Export;
|
||||||
use App\Models\Banking\Transaction as Model;
|
use App\Models\Banking\Transaction as Model;
|
||||||
use Jenssegers\Date\Date;
|
|
||||||
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
|
class Revenues extends Export
|
||||||
{
|
{
|
||||||
public $ids;
|
|
||||||
|
|
||||||
public function __construct($ids = null)
|
|
||||||
{
|
|
||||||
$this->ids = $ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
$model = Model::type('income')->usingSearchString(request('search'));
|
$model = Model::type('income')->usingSearchString(request('search'));
|
||||||
@ -30,25 +18,7 @@ class Revenues implements FromCollection, ShouldAutoSize, WithHeadings, WithMapp
|
|||||||
return $model->get();
|
return $model->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map($model): array
|
public function fields(): array
|
||||||
{
|
|
||||||
return [
|
|
||||||
Date::parse($model->paid_at)->format('Y-m-d'),
|
|
||||||
$model->amount,
|
|
||||||
$model->currency_code,
|
|
||||||
$model->currency_rate,
|
|
||||||
$model->account_id,
|
|
||||||
$model->document_id,
|
|
||||||
$model->contact_id,
|
|
||||||
$model->category_id,
|
|
||||||
$model->description,
|
|
||||||
$model->payment_method,
|
|
||||||
$model->reference,
|
|
||||||
$model->reconciled,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function headings(): array
|
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'paid_at',
|
'paid_at',
|
||||||
@ -65,9 +35,4 @@ class Revenues implements FromCollection, ShouldAutoSize, WithHeadings, WithMapp
|
|||||||
'reconciled',
|
'reconciled',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function title(): string
|
|
||||||
{
|
|
||||||
return 'revenues';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,44 +2,23 @@
|
|||||||
|
|
||||||
namespace App\Exports\Sales\Sheets;
|
namespace App\Exports\Sales\Sheets;
|
||||||
|
|
||||||
|
use App\Abstracts\Export;
|
||||||
use App\Models\Sale\InvoiceHistory as Model;
|
use App\Models\Sale\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
|
class InvoiceHistories extends Export
|
||||||
{
|
{
|
||||||
public $invoice_ids;
|
|
||||||
|
|
||||||
public function __construct($invoice_ids = null)
|
|
||||||
{
|
|
||||||
$this->invoice_ids = $invoice_ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
$model = Model::usingSearchString(request('search'));
|
$model = Model::usingSearchString(request('search'));
|
||||||
|
|
||||||
if (!empty($this->invoice_ids)) {
|
if (!empty($this->ids)) {
|
||||||
$model->whereIn('invoice_id', (array) $this->invoice_ids);
|
$model->whereIn('invoice_id', (array) $this->ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $model->get();
|
return $model->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map($model): array
|
public function fields(): array
|
||||||
{
|
|
||||||
return [
|
|
||||||
$model->invoice_id,
|
|
||||||
$model->status,
|
|
||||||
$model->notify,
|
|
||||||
$model->description,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function headings(): array
|
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'invoice_id',
|
'invoice_id',
|
||||||
@ -48,9 +27,4 @@ class InvoiceHistories implements FromCollection, ShouldAutoSize, WithHeadings,
|
|||||||
'description',
|
'description',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function title(): string
|
|
||||||
{
|
|
||||||
return 'invoice_histories';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,45 +2,23 @@
|
|||||||
|
|
||||||
namespace App\Exports\Sales\Sheets;
|
namespace App\Exports\Sales\Sheets;
|
||||||
|
|
||||||
|
use App\Abstracts\Export;
|
||||||
use App\Models\Sale\InvoiceItemTax as Model;
|
use App\Models\Sale\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
|
class InvoiceItemTaxes extends Export
|
||||||
{
|
{
|
||||||
public $invoice_ids;
|
|
||||||
|
|
||||||
public function __construct($invoice_ids = null)
|
|
||||||
{
|
|
||||||
$this->invoice_ids = $invoice_ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
$model = Model::usingSearchString(request('search'));
|
$model = Model::usingSearchString(request('search'));
|
||||||
|
|
||||||
if (!empty($this->invoice_ids)) {
|
if (!empty($this->ids)) {
|
||||||
$model->whereIn('invoice_id', (array) $this->invoice_ids);
|
$model->whereIn('invoice_id', (array) $this->ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $model->get();
|
return $model->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map($model): array
|
public function fields(): array
|
||||||
{
|
|
||||||
return [
|
|
||||||
$model->invoice_id,
|
|
||||||
$model->invoice_item_id,
|
|
||||||
$model->tax_id,
|
|
||||||
$model->name,
|
|
||||||
$model->amount,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function headings(): array
|
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'invoice_id',
|
'invoice_id',
|
||||||
@ -50,9 +28,4 @@ class InvoiceItemTaxes implements FromCollection, ShouldAutoSize, WithHeadings,
|
|||||||
'amount',
|
'amount',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function title(): string
|
|
||||||
{
|
|
||||||
return 'invoice_item_taxes';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,47 +2,23 @@
|
|||||||
|
|
||||||
namespace App\Exports\Sales\Sheets;
|
namespace App\Exports\Sales\Sheets;
|
||||||
|
|
||||||
|
use App\Abstracts\Export;
|
||||||
use App\Models\Sale\InvoiceItem as Model;
|
use App\Models\Sale\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
|
class InvoiceItems extends Export
|
||||||
{
|
{
|
||||||
public $invoice_ids;
|
|
||||||
|
|
||||||
public function __construct($invoice_ids = null)
|
|
||||||
{
|
|
||||||
$this->invoice_ids = $invoice_ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
$model = Model::usingSearchString(request('search'));
|
$model = Model::usingSearchString(request('search'));
|
||||||
|
|
||||||
if (!empty($this->invoice_ids)) {
|
if (!empty($this->ids)) {
|
||||||
$model->whereIn('invoice_id', (array) $this->invoice_ids);
|
$model->whereIn('invoice_id', (array) $this->ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $model->get();
|
return $model->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map($model): array
|
public function fields(): array
|
||||||
{
|
|
||||||
return [
|
|
||||||
$model->invoice_id,
|
|
||||||
$model->item_id,
|
|
||||||
$model->name,
|
|
||||||
$model->quantity,
|
|
||||||
$model->price,
|
|
||||||
$model->total,
|
|
||||||
$model->tax,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function headings(): array
|
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'invoice_id',
|
'invoice_id',
|
||||||
@ -54,9 +30,4 @@ class InvoiceItems implements FromCollection, ShouldAutoSize, WithHeadings, With
|
|||||||
'tax',
|
'tax',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function title(): string
|
|
||||||
{
|
|
||||||
return 'invoice_items';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,45 +2,23 @@
|
|||||||
|
|
||||||
namespace App\Exports\Sales\Sheets;
|
namespace App\Exports\Sales\Sheets;
|
||||||
|
|
||||||
|
use App\Abstracts\Export;
|
||||||
use App\Models\Sale\InvoiceTotal as Model;
|
use App\Models\Sale\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
|
class InvoiceTotals extends Export
|
||||||
{
|
{
|
||||||
public $invoice_ids;
|
|
||||||
|
|
||||||
public function __construct($invoice_ids = null)
|
|
||||||
{
|
|
||||||
$this->invoice_ids = $invoice_ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
$model = Model::usingSearchString(request('search'));
|
$model = Model::usingSearchString(request('search'));
|
||||||
|
|
||||||
if (!empty($this->invoice_ids)) {
|
if (!empty($this->ids)) {
|
||||||
$model->whereIn('invoice_id', (array) $this->invoice_ids);
|
$model->whereIn('invoice_id', (array) $this->ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $model->get();
|
return $model->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map($model): array
|
public function fields(): array
|
||||||
{
|
|
||||||
return [
|
|
||||||
$model->invoice_id,
|
|
||||||
$model->code,
|
|
||||||
$model->name,
|
|
||||||
$model->amount,
|
|
||||||
$model->sort_order,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function headings(): array
|
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'invoice_id',
|
'invoice_id',
|
||||||
@ -50,9 +28,4 @@ class InvoiceTotals implements FromCollection, ShouldAutoSize, WithHeadings, Wit
|
|||||||
'sort_order',
|
'sort_order',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function title(): string
|
|
||||||
{
|
|
||||||
return 'invoice_totals';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,53 +2,23 @@
|
|||||||
|
|
||||||
namespace App\Exports\Sales\Sheets;
|
namespace App\Exports\Sales\Sheets;
|
||||||
|
|
||||||
|
use App\Abstracts\Export;
|
||||||
use App\Models\Banking\Transaction as Model;
|
use App\Models\Banking\Transaction as Model;
|
||||||
use Jenssegers\Date\Date;
|
|
||||||
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 InvoiceTransactions implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithTitle
|
class InvoiceTransactions extends Export
|
||||||
{
|
{
|
||||||
public $invoice_ids;
|
|
||||||
|
|
||||||
public function __construct($invoice_ids = null)
|
|
||||||
{
|
|
||||||
$this->invoice_ids = $invoice_ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
$model = Model::type('income')->isDocument()->usingSearchString(request('search'));
|
$model = Model::type('income')->isDocument()->usingSearchString(request('search'));
|
||||||
|
|
||||||
if (!empty($this->invoice_ids)) {
|
if (!empty($this->ids)) {
|
||||||
$model->whereIn('document_id', (array) $this->invoice_ids);
|
$model->whereIn('document_id', (array) $this->ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $model->get();
|
return $model->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map($model): array
|
public function fields(): array
|
||||||
{
|
|
||||||
return [
|
|
||||||
Date::parse($model->paid_at)->format('Y-m-d'),
|
|
||||||
$model->amount,
|
|
||||||
$model->currency_code,
|
|
||||||
$model->currency_rate,
|
|
||||||
$model->account_id,
|
|
||||||
$model->document_id,
|
|
||||||
$model->contact_id,
|
|
||||||
$model->category_id,
|
|
||||||
$model->description,
|
|
||||||
$model->payment_method,
|
|
||||||
$model->reference,
|
|
||||||
$model->reconciled,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function headings(): array
|
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'paid_at',
|
'paid_at',
|
||||||
@ -65,9 +35,4 @@ class InvoiceTransactions implements FromCollection, ShouldAutoSize, WithHeading
|
|||||||
'reconciled',
|
'reconciled',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function title(): string
|
|
||||||
{
|
|
||||||
return 'invoice_transactions';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,23 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Exports\Sales\Sheets;
|
namespace App\Exports\Sales\Sheets;
|
||||||
|
|
||||||
|
use App\Abstracts\Export;
|
||||||
use App\Models\Sale\Invoice as Model;
|
use App\Models\Sale\Invoice as Model;
|
||||||
use Jenssegers\Date\Date;
|
|
||||||
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
|
class Invoices extends Export
|
||||||
{
|
{
|
||||||
public $ids;
|
|
||||||
|
|
||||||
public function __construct($ids = null)
|
|
||||||
{
|
|
||||||
$this->ids = $ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collection()
|
public function collection()
|
||||||
{
|
{
|
||||||
$model = Model::usingSearchString(request('search'));
|
$model = Model::usingSearchString(request('search'));
|
||||||
@ -30,30 +18,7 @@ class Invoices implements FromCollection, ShouldAutoSize, WithHeadings, WithMapp
|
|||||||
return $model->get();
|
return $model->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function map($model): array
|
public function fields(): array
|
||||||
{
|
|
||||||
return [
|
|
||||||
$model->invoice_number,
|
|
||||||
$model->order_number,
|
|
||||||
$model->status,
|
|
||||||
Date::parse($model->invoiced_at)->format('Y-m-d'),
|
|
||||||
Date::parse($model->due_at)->format('Y-m-d'),
|
|
||||||
$model->amount,
|
|
||||||
$model->currency_code,
|
|
||||||
$model->currency_rate,
|
|
||||||
$model->category_id,
|
|
||||||
$model->contact_id,
|
|
||||||
$model->contact_name,
|
|
||||||
$model->contact_email,
|
|
||||||
$model->contact_tax_number,
|
|
||||||
$model->contact_phone,
|
|
||||||
$model->contact_address,
|
|
||||||
$model->notes,
|
|
||||||
$model->footer,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function headings(): array
|
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'invoice_number',
|
'invoice_number',
|
||||||
@ -75,9 +40,4 @@ class Invoices implements FromCollection, ShouldAutoSize, WithHeadings, WithMapp
|
|||||||
'footer',
|
'footer',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function title(): string
|
|
||||||
{
|
|
||||||
return 'invoices';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user