v2 first commit
This commit is contained in:
		
							
								
								
									
										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