export abstract
This commit is contained in:
@@ -2,44 +2,23 @@
|
||||
|
||||
namespace App\Exports\Sales\Sheets;
|
||||
|
||||
use App\Abstracts\Export;
|
||||
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()
|
||||
{
|
||||
$model = Model::usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->invoice_ids)) {
|
||||
$model->whereIn('invoice_id', (array) $this->invoice_ids);
|
||||
if (!empty($this->ids)) {
|
||||
$model->whereIn('invoice_id', (array) $this->ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->invoice_id,
|
||||
$model->status,
|
||||
$model->notify,
|
||||
$model->description,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
public function fields(): array
|
||||
{
|
||||
return [
|
||||
'invoice_id',
|
||||
@@ -48,9 +27,4 @@ class InvoiceHistories implements FromCollection, ShouldAutoSize, WithHeadings,
|
||||
'description',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'invoice_histories';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,45 +2,23 @@
|
||||
|
||||
namespace App\Exports\Sales\Sheets;
|
||||
|
||||
use App\Abstracts\Export;
|
||||
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()
|
||||
{
|
||||
$model = Model::usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->invoice_ids)) {
|
||||
$model->whereIn('invoice_id', (array) $this->invoice_ids);
|
||||
if (!empty($this->ids)) {
|
||||
$model->whereIn('invoice_id', (array) $this->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
|
||||
public function fields(): array
|
||||
{
|
||||
return [
|
||||
'invoice_id',
|
||||
@@ -50,9 +28,4 @@ class InvoiceItemTaxes implements FromCollection, ShouldAutoSize, WithHeadings,
|
||||
'amount',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'invoice_item_taxes';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,47 +2,23 @@
|
||||
|
||||
namespace App\Exports\Sales\Sheets;
|
||||
|
||||
use App\Abstracts\Export;
|
||||
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()
|
||||
{
|
||||
$model = Model::usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->invoice_ids)) {
|
||||
$model->whereIn('invoice_id', (array) $this->invoice_ids);
|
||||
if (!empty($this->ids)) {
|
||||
$model->whereIn('invoice_id', (array) $this->ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
return [
|
||||
$model->invoice_id,
|
||||
$model->item_id,
|
||||
$model->name,
|
||||
$model->quantity,
|
||||
$model->price,
|
||||
$model->total,
|
||||
$model->tax,
|
||||
];
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
public function fields(): array
|
||||
{
|
||||
return [
|
||||
'invoice_id',
|
||||
@@ -54,9 +30,4 @@ class InvoiceItems implements FromCollection, ShouldAutoSize, WithHeadings, With
|
||||
'tax',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'invoice_items';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,45 +2,23 @@
|
||||
|
||||
namespace App\Exports\Sales\Sheets;
|
||||
|
||||
use App\Abstracts\Export;
|
||||
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()
|
||||
{
|
||||
$model = Model::usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->invoice_ids)) {
|
||||
$model->whereIn('invoice_id', (array) $this->invoice_ids);
|
||||
if (!empty($this->ids)) {
|
||||
$model->whereIn('invoice_id', (array) $this->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
|
||||
public function fields(): array
|
||||
{
|
||||
return [
|
||||
'invoice_id',
|
||||
@@ -50,9 +28,4 @@ class InvoiceTotals implements FromCollection, ShouldAutoSize, WithHeadings, Wit
|
||||
'sort_order',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'invoice_totals';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,53 +2,23 @@
|
||||
|
||||
namespace App\Exports\Sales\Sheets;
|
||||
|
||||
use App\Abstracts\Export;
|
||||
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()
|
||||
{
|
||||
$model = Model::type('income')->isDocument()->usingSearchString(request('search'));
|
||||
|
||||
if (!empty($this->invoice_ids)) {
|
||||
$model->whereIn('document_id', (array) $this->invoice_ids);
|
||||
if (!empty($this->ids)) {
|
||||
$model->whereIn('document_id', (array) $this->ids);
|
||||
}
|
||||
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): 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
|
||||
public function fields(): array
|
||||
{
|
||||
return [
|
||||
'paid_at',
|
||||
@@ -65,9 +35,4 @@ class InvoiceTransactions implements FromCollection, ShouldAutoSize, WithHeading
|
||||
'reconciled',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'invoice_transactions';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,23 +2,11 @@
|
||||
|
||||
namespace App\Exports\Sales\Sheets;
|
||||
|
||||
use App\Abstracts\Export;
|
||||
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()
|
||||
{
|
||||
$model = Model::usingSearchString(request('search'));
|
||||
@@ -30,30 +18,7 @@ class Invoices implements FromCollection, ShouldAutoSize, WithHeadings, WithMapp
|
||||
return $model->get();
|
||||
}
|
||||
|
||||
public function map($model): 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
|
||||
public function fields(): array
|
||||
{
|
||||
return [
|
||||
'invoice_number',
|
||||
@@ -75,9 +40,4 @@ class Invoices implements FromCollection, ShouldAutoSize, WithHeadings, WithMapp
|
||||
'footer',
|
||||
];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return 'invoices';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user