akaunting 3.0 (the last dance)
This commit is contained in:
@@ -11,7 +11,7 @@ class Transactions extends Export implements WithColumnFormatting
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return Model::with('account', 'category', 'contact', 'document')->collectForExport($this->ids, ['paid_at' => 'desc']);
|
||||
return Model::with('account', 'category', 'contact', 'document')->isNotRecurring()->collectForExport($this->ids, ['paid_at' => 'desc']);
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
@@ -28,6 +28,7 @@ class Transactions extends Export implements WithColumnFormatting
|
||||
{
|
||||
return [
|
||||
'type',
|
||||
'number',
|
||||
'paid_at',
|
||||
'amount',
|
||||
'currency_code',
|
||||
|
||||
@@ -23,6 +23,7 @@ class Items extends Export
|
||||
{
|
||||
return [
|
||||
'name',
|
||||
'type',
|
||||
'description',
|
||||
'sale_price',
|
||||
'purchase_price',
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Purchases;
|
||||
|
||||
use App\Abstracts\Export;
|
||||
use App\Models\Banking\Transaction as Model;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class Payments extends Export implements WithColumnFormatting
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return Model::with('account', 'bill', 'category', 'contact')->expense()->collectForExport($this->ids, ['paid_at' => 'desc']);
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
$model->account_name = $model->account->name;
|
||||
$model->bill_number = $model->bill->document_number ?? 0;
|
||||
$model->contact_email = $model->contact->email;
|
||||
$model->category_name = $model->category->name;
|
||||
|
||||
return parent::map($model);
|
||||
}
|
||||
|
||||
public function fields(): array
|
||||
{
|
||||
return [
|
||||
'paid_at',
|
||||
'amount',
|
||||
'currency_code',
|
||||
'currency_rate',
|
||||
'account_name',
|
||||
'bill_number',
|
||||
'contact_email',
|
||||
'category_name',
|
||||
'description',
|
||||
'payment_method',
|
||||
'reference',
|
||||
'reconciled',
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_DATE_YYYYMMDD,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ class BillTransactions extends Export implements WithColumnFormatting
|
||||
$model->account_name = $model->account->name;
|
||||
$model->category_name = $model->category->name;
|
||||
$model->contact_email = $model->contact->email;
|
||||
$model->transaction_number = $model->number;
|
||||
|
||||
return parent::map($model);
|
||||
}
|
||||
@@ -34,6 +35,7 @@ class BillTransactions extends Export implements WithColumnFormatting
|
||||
{
|
||||
return [
|
||||
'bill_number',
|
||||
'transaction_number',
|
||||
'paid_at',
|
||||
'amount',
|
||||
'currency_code',
|
||||
|
||||
@@ -11,7 +11,7 @@ class Bills extends Export implements WithColumnFormatting
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return Model::with('category')->bill()->collectForExport($this->ids, ['document_number' => 'desc']);
|
||||
return Model::with('category')->bill()->isNotRecurring()->collectForExport($this->ids, ['document_number' => 'desc']);
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Sales;
|
||||
|
||||
use App\Abstracts\Export;
|
||||
use App\Models\Banking\Transaction as Model;
|
||||
use Maatwebsite\Excel\Concerns\WithColumnFormatting;
|
||||
use PhpOffice\PhpSpreadsheet\Style\NumberFormat;
|
||||
|
||||
class Revenues extends Export implements WithColumnFormatting
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return Model::with('account', 'category', 'contact', 'invoice')->income()->collectForExport($this->ids, ['paid_at' => 'desc']);
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
{
|
||||
$model->account_name = $model->account->name;
|
||||
$model->invoice_number = $model->invoice->document_number ?? 0;
|
||||
$model->contact_email = $model->contact->email;
|
||||
$model->category_name = $model->category->name;
|
||||
|
||||
return parent::map($model);
|
||||
}
|
||||
|
||||
public function fields(): array
|
||||
{
|
||||
return [
|
||||
'paid_at',
|
||||
'amount',
|
||||
'currency_code',
|
||||
'currency_rate',
|
||||
'account_name',
|
||||
'invoice_number',
|
||||
'contact_email',
|
||||
'category_name',
|
||||
'description',
|
||||
'payment_method',
|
||||
'reference',
|
||||
'reconciled',
|
||||
];
|
||||
}
|
||||
|
||||
public function columnFormats(): array
|
||||
{
|
||||
return [
|
||||
'A' => NumberFormat::FORMAT_DATE_YYYYMMDD,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ class InvoiceTransactions extends Export implements WithColumnFormatting
|
||||
$model->account_name = $model->account->name;
|
||||
$model->category_name = $model->category->name;
|
||||
$model->contact_email = $model->contact->email;
|
||||
$model->transaction_number = $model->number;
|
||||
|
||||
return parent::map($model);
|
||||
}
|
||||
@@ -34,6 +35,7 @@ class InvoiceTransactions extends Export implements WithColumnFormatting
|
||||
{
|
||||
return [
|
||||
'invoice_number',
|
||||
'transaction_number',
|
||||
'paid_at',
|
||||
'amount',
|
||||
'currency_code',
|
||||
|
||||
@@ -11,7 +11,7 @@ class Invoices extends Export implements WithColumnFormatting
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return Model::with('category')->invoice()->collectForExport($this->ids, ['document_number' => 'desc']);
|
||||
return Model::with('category')->invoice()->isNotRecurring()->collectForExport($this->ids, ['document_number' => 'desc']);
|
||||
}
|
||||
|
||||
public function map($model): array
|
||||
|
||||
24
app/Exports/Settings/Taxes.php
Normal file
24
app/Exports/Settings/Taxes.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exports\Settings;
|
||||
|
||||
use App\Abstracts\Export;
|
||||
use App\Models\Setting\Tax as Model;
|
||||
|
||||
class Taxes extends Export
|
||||
{
|
||||
public function collection()
|
||||
{
|
||||
return Model::collectForExport($this->ids);
|
||||
}
|
||||
|
||||
public function fields(): array
|
||||
{
|
||||
return [
|
||||
'name',
|
||||
'type',
|
||||
'rate',
|
||||
'enabled',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user