renamed income/expense

This commit is contained in:
denisdulici
2019-12-31 15:49:09 +03:00
parent e2189158b9
commit 2428feb73b
235 changed files with 815 additions and 2147 deletions

View File

@ -0,0 +1,56 @@
<?php
namespace App\Exports\Purchases\Sheets;
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
{
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';
}
}

View File

@ -0,0 +1,58 @@
<?php
namespace App\Exports\Purchases\Sheets;
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
{
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';
}
}

View File

@ -0,0 +1,60 @@
<?php
namespace App\Exports\Purchases\Sheets;
use App\Models\Purchase\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';
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Exports\Purchases\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';
}
}

View File

@ -0,0 +1,58 @@
<?php
namespace App\Exports\Purchases\Sheets;
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
{
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';
}
}

View File

@ -0,0 +1,81 @@
<?php
namespace App\Exports\Purchases\Sheets;
use App\Models\Purchase\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';
}
}