mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Working on reports
This commit is contained in:
parent
2387d45960
commit
4750362961
@ -12,7 +12,6 @@ class AbstractReport
|
||||
public $options;
|
||||
|
||||
public $totals = [];
|
||||
public $columns = [];
|
||||
public $data = [];
|
||||
|
||||
public function __construct($startDate, $endDate, $isExport, $options = false)
|
||||
@ -28,10 +27,15 @@ class AbstractReport
|
||||
|
||||
}
|
||||
|
||||
public function getColumns()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function results()
|
||||
{
|
||||
return [
|
||||
'columns' => $this->columns,
|
||||
'columns' => $this->getColumns(),
|
||||
'displayData' => $this->data,
|
||||
'reportTotals' => $this->totals,
|
||||
];
|
||||
@ -55,7 +59,7 @@ class AbstractReport
|
||||
public function tableHeaderArray() {
|
||||
$columns_labeled = [];
|
||||
|
||||
foreach ($this->columns as $key => $val) {
|
||||
foreach ($this->getColumns() as $key => $val) {
|
||||
if (is_array($val)) {
|
||||
$field = $key;
|
||||
$class = $val;
|
||||
@ -74,8 +78,12 @@ class AbstractReport
|
||||
$class[] = 'group-number-30';
|
||||
}
|
||||
|
||||
if (! in_array('custom', $class)) {
|
||||
$label = trans("texts.{$field}");
|
||||
} else {
|
||||
$label = $field;
|
||||
}
|
||||
$class = count($class) ? implode(' ', $class) : 'group-false';
|
||||
$label = trans("texts.{$field}");
|
||||
|
||||
$columns_labeled[] = [
|
||||
'label' => $label,
|
||||
|
@ -7,12 +7,15 @@ use Auth;
|
||||
|
||||
class ActivityReport extends AbstractReport
|
||||
{
|
||||
public $columns = [
|
||||
'date',
|
||||
'client',
|
||||
'user',
|
||||
'activity',
|
||||
];
|
||||
public function getColumns()
|
||||
{
|
||||
return [
|
||||
'date',
|
||||
'client',
|
||||
'user',
|
||||
'activity',
|
||||
];
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
|
@ -7,15 +7,19 @@ use Auth;
|
||||
|
||||
class AgingReport extends AbstractReport
|
||||
{
|
||||
public $columns = [
|
||||
'client',
|
||||
'invoice_number',
|
||||
'invoice_date',
|
||||
'due_date',
|
||||
'age',
|
||||
'amount',
|
||||
'balance',
|
||||
];
|
||||
public function getColumns()
|
||||
{
|
||||
return [
|
||||
'client',
|
||||
'invoice_number',
|
||||
'invoice_date',
|
||||
'due_date',
|
||||
'age',
|
||||
'amount',
|
||||
'balance',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
|
@ -7,12 +7,29 @@ use Auth;
|
||||
|
||||
class ClientReport extends AbstractReport
|
||||
{
|
||||
public $columns = [
|
||||
public function getColumns()
|
||||
{
|
||||
$columns = [
|
||||
'client',
|
||||
'amount',
|
||||
'paid',
|
||||
'balance',
|
||||
];
|
||||
'public_notes' => ['columnSelector-false'],
|
||||
'private_notes' => ['columnSelector-false'],
|
||||
];
|
||||
|
||||
$user = auth()->user();
|
||||
$account = $user->account;
|
||||
|
||||
if ($account->custom_client_label1) {
|
||||
$columns[$account->custom_client_label1] = ['columnSelector-false', 'custom'];
|
||||
}
|
||||
if ($account->custom_client_label2) {
|
||||
$columns[$account->custom_client_label2] = ['columnSelector-false', 'custom'];
|
||||
}
|
||||
|
||||
return $columns;
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
@ -39,13 +56,24 @@ class ClientReport extends AbstractReport
|
||||
$paid += $invoice->getAmountPaid();
|
||||
}
|
||||
|
||||
$this->data[] = [
|
||||
$row = [
|
||||
$this->isExport ? $client->getDisplayName() : $client->present()->link,
|
||||
$account->formatMoney($amount, $client),
|
||||
$account->formatMoney($paid, $client),
|
||||
$account->formatMoney($amount - $paid, $client),
|
||||
$client->public_notes,
|
||||
$client->private_notes,
|
||||
];
|
||||
|
||||
if ($account->custom_client_label1) {
|
||||
$row[] = $client->custom_value1;
|
||||
}
|
||||
if ($account->custom_client_label2) {
|
||||
$row[] = $client->custom_value2;
|
||||
}
|
||||
|
||||
$this->data[] = $row;
|
||||
|
||||
$this->addToTotals($client->currency_id, 'amount', $amount);
|
||||
$this->addToTotals($client->currency_id, 'paid', $paid);
|
||||
$this->addToTotals($client->currency_id, 'balance', $amount - $paid);
|
||||
|
@ -8,12 +8,16 @@ use Barracuda\ArchiveStream\Archive;
|
||||
|
||||
class DocumentReport extends AbstractReport
|
||||
{
|
||||
public $columns = [
|
||||
'document',
|
||||
'client',
|
||||
'invoice_or_expense',
|
||||
'date',
|
||||
];
|
||||
public function getColumns()
|
||||
{
|
||||
return [
|
||||
'document',
|
||||
'client',
|
||||
'invoice_or_expense',
|
||||
'date',
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function run()
|
||||
{
|
||||
|
@ -9,13 +9,18 @@ use Utils;
|
||||
|
||||
class ExpenseReport extends AbstractReport
|
||||
{
|
||||
public $columns = [
|
||||
'vendor',
|
||||
'client',
|
||||
'date',
|
||||
'category',
|
||||
'amount',
|
||||
];
|
||||
public function getColumns()
|
||||
{
|
||||
return [
|
||||
'vendor',
|
||||
'client',
|
||||
'date',
|
||||
'category',
|
||||
'amount',
|
||||
'public_notes' => ['columnSelector-false'],
|
||||
'private_notes' => ['columnSelector-false'],
|
||||
];
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
@ -57,6 +62,8 @@ class ExpenseReport extends AbstractReport
|
||||
$this->isExport ? $expense->present()->expense_date : link_to($expense->present()->url, $expense->present()->expense_date),
|
||||
$expense->present()->category,
|
||||
Utils::formatMoney($amount, $expense->currency_id),
|
||||
$expense->public_notes,
|
||||
$expense->private_notes,
|
||||
];
|
||||
|
||||
$this->addToTotals($expense->expense_currency_id, 'amount', $amount);
|
||||
|
@ -8,16 +8,20 @@ use Barracuda\ArchiveStream\Archive;
|
||||
|
||||
class InvoiceReport extends AbstractReport
|
||||
{
|
||||
public $columns = [
|
||||
'client',
|
||||
'invoice_number',
|
||||
'invoice_date',
|
||||
'amount',
|
||||
'status',
|
||||
'payment_date',
|
||||
'paid',
|
||||
'method',
|
||||
];
|
||||
public function getColumns()
|
||||
{
|
||||
return [
|
||||
'client',
|
||||
'invoice_number',
|
||||
'invoice_date',
|
||||
'amount',
|
||||
'status',
|
||||
'payment_date',
|
||||
'paid',
|
||||
'method',
|
||||
'private_notes' => ['columnSelector-false'],
|
||||
];
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
@ -70,6 +74,7 @@ class InvoiceReport extends AbstractReport
|
||||
$payment ? $payment->present()->payment_date : '',
|
||||
$payment ? $account->formatMoney($payment->getCompletedAmount(), $client) : '',
|
||||
$payment ? $payment->present()->method : '',
|
||||
$invoice->private_notes,
|
||||
];
|
||||
|
||||
$this->addToTotals($client->currency_id, 'paid', $payment ? $payment->getCompletedAmount() : 0);
|
||||
|
@ -8,15 +8,19 @@ use Utils;
|
||||
|
||||
class PaymentReport extends AbstractReport
|
||||
{
|
||||
public $columns = [
|
||||
'client',
|
||||
'invoice_number',
|
||||
'invoice_date',
|
||||
'amount',
|
||||
'payment_date',
|
||||
'paid',
|
||||
'method',
|
||||
];
|
||||
public function getColumns()
|
||||
{
|
||||
return [
|
||||
'client',
|
||||
'invoice_number',
|
||||
'invoice_date',
|
||||
'amount',
|
||||
'payment_date',
|
||||
'paid',
|
||||
'method',
|
||||
'private_notes' => ['columnSelector-false'],
|
||||
];
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
@ -60,6 +64,7 @@ class PaymentReport extends AbstractReport
|
||||
$payment->present()->payment_date,
|
||||
$amount,
|
||||
$payment->present()->method,
|
||||
$payment->private_notes,
|
||||
];
|
||||
|
||||
if (! isset($invoiceMap[$invoice->id])) {
|
||||
|
@ -8,17 +8,20 @@ use Utils;
|
||||
|
||||
class ProductReport extends AbstractReport
|
||||
{
|
||||
public $columns = [
|
||||
'client',
|
||||
'invoice_number',
|
||||
'invoice_date',
|
||||
'product',
|
||||
'description',
|
||||
'qty',
|
||||
'cost',
|
||||
//'tax_rate1',
|
||||
//'tax_rate2',
|
||||
];
|
||||
public function getColumns()
|
||||
{
|
||||
return [
|
||||
'client',
|
||||
'invoice_number',
|
||||
'invoice_date',
|
||||
'product',
|
||||
'description',
|
||||
'qty',
|
||||
'cost',
|
||||
//'tax_rate1',
|
||||
//'tax_rate2',
|
||||
];
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
|
@ -8,13 +8,16 @@ use Auth;
|
||||
|
||||
class ProfitAndLossReport extends AbstractReport
|
||||
{
|
||||
public $columns = [
|
||||
'type',
|
||||
'client',
|
||||
'amount',
|
||||
'date',
|
||||
'notes',
|
||||
];
|
||||
public function getColumns()
|
||||
{
|
||||
return [
|
||||
'type',
|
||||
'client',
|
||||
'amount',
|
||||
'date',
|
||||
'notes',
|
||||
];
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
|
@ -8,13 +8,17 @@ use Barracuda\ArchiveStream\Archive;
|
||||
|
||||
class QuoteReport extends AbstractReport
|
||||
{
|
||||
public $columns = [
|
||||
'client',
|
||||
'quote_number',
|
||||
'quote_date',
|
||||
'amount',
|
||||
'status',
|
||||
];
|
||||
public function getColumns()
|
||||
{
|
||||
return [
|
||||
'client',
|
||||
'quote_number',
|
||||
'quote_date',
|
||||
'amount',
|
||||
'status',
|
||||
'private_notes' => ['columnSelector-false'],
|
||||
];
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
@ -58,6 +62,7 @@ class QuoteReport extends AbstractReport
|
||||
$invoice->present()->invoice_date,
|
||||
$account->formatMoney($invoice->amount, $client),
|
||||
$invoice->present()->status(),
|
||||
$invoice->private_notes,
|
||||
];
|
||||
|
||||
$this->addToTotals($client->currency_id, 'amount', $invoice->amount);
|
||||
|
@ -7,14 +7,17 @@ use Utils;
|
||||
|
||||
class TaskReport extends AbstractReport
|
||||
{
|
||||
public $columns = [
|
||||
'client',
|
||||
'date',
|
||||
'project',
|
||||
'description',
|
||||
'duration',
|
||||
'amount',
|
||||
];
|
||||
public function getColumns()
|
||||
{
|
||||
return [
|
||||
'client',
|
||||
'date',
|
||||
'project',
|
||||
'description',
|
||||
'duration',
|
||||
'amount',
|
||||
];
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
|
@ -7,14 +7,17 @@ use Auth;
|
||||
|
||||
class TaxRateReport extends AbstractReport
|
||||
{
|
||||
public $columns = [
|
||||
'client',
|
||||
'invoice',
|
||||
'tax_name',
|
||||
'tax_rate',
|
||||
'amount',
|
||||
'paid',
|
||||
];
|
||||
public function getColumns()
|
||||
{
|
||||
return [
|
||||
'client',
|
||||
'invoice',
|
||||
'tax_name',
|
||||
'tax_rate',
|
||||
'amount',
|
||||
'paid',
|
||||
];
|
||||
}
|
||||
|
||||
public function run()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user