mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
Adding charts to reports
This commit is contained in:
parent
dea48b83e2
commit
954f606a1d
@ -174,6 +174,10 @@ class AbstractReport
|
||||
|
||||
protected function formatDate($date)
|
||||
{
|
||||
if (! $date instanceof \DateTime) {
|
||||
$date = new \DateTime($date);
|
||||
}
|
||||
|
||||
$groupBy = $this->chartGroupBy();
|
||||
$dateFormat = $groupBy == 'DAY' ? 'z' : ($groupBy == 'MONTH' ? 'm' : '');
|
||||
|
||||
|
@ -55,6 +55,8 @@ class ClientReport extends AbstractReport
|
||||
foreach ($client->invoices as $invoice) {
|
||||
$amount += $invoice->amount;
|
||||
$paid += $invoice->getAmountPaid();
|
||||
|
||||
$this->addChartData(ENTITY_INVOICE, $invoice->invoice_date, $invoice->amount);
|
||||
}
|
||||
|
||||
$row = [
|
||||
|
@ -39,6 +39,8 @@ class CreditReport extends AbstractReport
|
||||
foreach ($client->credits as $credit) {
|
||||
$amount += $credit->amount;
|
||||
$balance += $credit->balance;
|
||||
|
||||
$this->addChartData(ENTITY_CREDIT, $credit->credit_date, $credit->amount);
|
||||
}
|
||||
|
||||
if (! $amount && ! $balance) {
|
||||
|
@ -25,19 +25,14 @@ function loadChart(data) {
|
||||
return moment(item[0].xLabel).format("{{ $account->getMomentDateFormat() }}");
|
||||
},
|
||||
label: function(item, data) {
|
||||
//return label + formatMoney(item.yLabel, chartCurrencyId, account.country_id);
|
||||
|
||||
/*
|
||||
if (item.datasetIndex == 0) {
|
||||
var label = " {!! trans('texts.invoices') !!}: ";
|
||||
} else if (item.datasetIndex == 1) {
|
||||
var label = " {!! trans('texts.payments') !!}: ";
|
||||
} else if (item.datasetIndex == 2) {
|
||||
var label = " {!! trans('texts.expenses') !!}: ";
|
||||
}
|
||||
|
||||
return label + formatMoney(item.yLabel, chartCurrencyId, account.country_id);
|
||||
console.log('tooltip:');
|
||||
console.log(item);
|
||||
console.log(data);
|
||||
*/
|
||||
|
||||
return 'test';
|
||||
return item.yLabel;
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -76,7 +71,7 @@ var chartGroupBy = "{{ $report->chartGroupBy() }}";
|
||||
|
||||
$(function() {
|
||||
var chartData = {!! json_encode($report->getChartData()) !!};
|
||||
console.log(chartData);
|
||||
//console.log(chartData);
|
||||
loadChart(chartData);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user