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