export abstract
This commit is contained in:
		@@ -2,44 +2,23 @@
 | 
			
		||||
 | 
			
		||||
namespace App\Exports\Purchases\Sheets;
 | 
			
		||||
 | 
			
		||||
use App\Abstracts\Export;
 | 
			
		||||
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()
 | 
			
		||||
    {
 | 
			
		||||
        $model = Model::usingSearchString(request('search'));
 | 
			
		||||
 | 
			
		||||
        if (!empty($this->bill_ids)) {
 | 
			
		||||
            $model->whereIn('bill_id', (array) $this->bill_ids);
 | 
			
		||||
        if (!empty($this->ids)) {
 | 
			
		||||
            $model->whereIn('bill_id', (array) $this->ids);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $model->get();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function map($model): array
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            $model->bill_id,
 | 
			
		||||
            $model->status,
 | 
			
		||||
            $model->notify,
 | 
			
		||||
            $model->description,
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function headings(): array
 | 
			
		||||
    public function fields(): array
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            'bill_id',
 | 
			
		||||
@@ -48,9 +27,4 @@ class BillHistories implements FromCollection, ShouldAutoSize, WithHeadings, Wit
 | 
			
		||||
            'description',
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function title(): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'bill_histories';
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,45 +2,23 @@
 | 
			
		||||
 | 
			
		||||
namespace App\Exports\Purchases\Sheets;
 | 
			
		||||
 | 
			
		||||
use App\Abstracts\Export;
 | 
			
		||||
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()
 | 
			
		||||
    {
 | 
			
		||||
        $model = Model::usingSearchString(request('search'));
 | 
			
		||||
 | 
			
		||||
        if (!empty($this->bill_ids)) {
 | 
			
		||||
            $model->whereIn('bill_id', (array) $this->bill_ids);
 | 
			
		||||
        if (!empty($this->ids)) {
 | 
			
		||||
            $model->whereIn('bill_id', (array) $this->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
 | 
			
		||||
    public function fields(): array
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            'bill_id',
 | 
			
		||||
@@ -50,9 +28,4 @@ class BillItemTaxes implements FromCollection, ShouldAutoSize, WithHeadings, Wit
 | 
			
		||||
            'amount',
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function title(): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'bill_item_taxes';
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@
 | 
			
		||||
 | 
			
		||||
namespace App\Exports\Purchases\Sheets;
 | 
			
		||||
 | 
			
		||||
use App\Abstracts\Export;
 | 
			
		||||
use App\Models\Purchase\BillItem as Model;
 | 
			
		||||
use Maatwebsite\Excel\Concerns\FromCollection;
 | 
			
		||||
use Maatwebsite\Excel\Concerns\ShouldAutoSize;
 | 
			
		||||
@@ -9,40 +10,20 @@ use Maatwebsite\Excel\Concerns\WithHeadings;
 | 
			
		||||
use Maatwebsite\Excel\Concerns\WithMapping;
 | 
			
		||||
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()
 | 
			
		||||
    {
 | 
			
		||||
        $model = Model::usingSearchString(request('search'));
 | 
			
		||||
 | 
			
		||||
        if (!empty($this->bill_ids)) {
 | 
			
		||||
            $model->whereIn('bill_id', (array) $this->bill_ids);
 | 
			
		||||
        if (!empty($this->ids)) {
 | 
			
		||||
            $model->whereIn('bill_id', (array) $this->ids);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $model->get();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function map($model): array
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            $model->bill_id,
 | 
			
		||||
            $model->item_id,
 | 
			
		||||
            $model->name,
 | 
			
		||||
            $model->quantity,
 | 
			
		||||
            $model->price,
 | 
			
		||||
            $model->total,
 | 
			
		||||
            $model->tax,
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function headings(): array
 | 
			
		||||
    public function fields(): array
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            'bill_id',
 | 
			
		||||
@@ -54,9 +35,4 @@ class BillItems implements FromCollection, ShouldAutoSize, WithHeadings, WithMap
 | 
			
		||||
            'tax',
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function title(): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'bill_items';
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,45 +2,24 @@
 | 
			
		||||
 | 
			
		||||
namespace App\Exports\Purchases\Sheets;
 | 
			
		||||
 | 
			
		||||
use App\Abstracts\Export;
 | 
			
		||||
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()
 | 
			
		||||
    {
 | 
			
		||||
        $model = Model::usingSearchString(request('search'));
 | 
			
		||||
 | 
			
		||||
        if (!empty($this->bill_ids)) {
 | 
			
		||||
            $model->whereIn('bill_id', (array) $this->bill_ids);
 | 
			
		||||
        if (!empty($this->ids)) {
 | 
			
		||||
            $model->whereIn('bill_id', (array) $this->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
 | 
			
		||||
    public function fields(): array
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            'bill_id',
 | 
			
		||||
@@ -50,9 +29,4 @@ class BillTotals implements FromCollection, ShouldAutoSize, WithHeadings, WithMa
 | 
			
		||||
            'sort_order',
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function title(): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'bill_totals';
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,53 +2,23 @@
 | 
			
		||||
 | 
			
		||||
namespace App\Exports\Purchases\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 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()
 | 
			
		||||
    {
 | 
			
		||||
        $model = Model::type('expense')->isDocument()->usingSearchString(request('search'));
 | 
			
		||||
 | 
			
		||||
        if (!empty($this->bill_ids)) {
 | 
			
		||||
            $model->whereIn('document_id', (array) $this->bill_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 BillTransactions implements FromCollection, ShouldAutoSize, WithHeadings,
 | 
			
		||||
            'reconciled',
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function title(): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'bill_transactions';
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,23 +2,11 @@
 | 
			
		||||
 | 
			
		||||
namespace App\Exports\Purchases\Sheets;
 | 
			
		||||
 | 
			
		||||
use App\Abstracts\Export;
 | 
			
		||||
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()
 | 
			
		||||
    {
 | 
			
		||||
        $model = Model::usingSearchString(request('search'));
 | 
			
		||||
@@ -30,30 +18,7 @@ class Bills implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping
 | 
			
		||||
        return $model->get();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function map($model): 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
 | 
			
		||||
    public function fields(): array
 | 
			
		||||
    {
 | 
			
		||||
        return [
 | 
			
		||||
            'bill_number',
 | 
			
		||||
@@ -75,9 +40,4 @@ class Bills implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping
 | 
			
		||||
            'footer',
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function title(): string
 | 
			
		||||
    {
 | 
			
		||||
        return 'bills';
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user