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