This commit is contained in:
Gwenhael Le Moine 2017-10-21 22:51:25 +02:00
commit 227f87af8f
No known key found for this signature in database
GPG key ID: FDFE3669426707A7
4 changed files with 105 additions and 80 deletions

1
.gitignore vendored
View file

@ -34,3 +34,4 @@
.rvmrc
/thin.*
/bundle/
vendor/

View file

@ -63,6 +63,7 @@ module Ledger
period = period.nil? ? '' : "-p '#{period}'"
depth = depth.nil? ? '' : "--depth #{depth}"
operation = cleared ? 'cleared' : 'balance'
run( "--flat --no-total --exchange '#{CURRENCY}' #{period} #{depth}", operation, categories )
.split( "\n" )
.map do |line|
@ -73,6 +74,19 @@ module Ledger
end
end
# def int_treefied_balance( node )
# return { name: node[:account], size: node[:amount] } unless node[:account].include( ':' )
# { name: node[:account].split(':').first,
# children: int_treefied_balance( ... ) }
# end
# def treefeid_balance( cleared = false, depth = nil, period = nil, categories = '' )
# bal = balance( cleared, depth, period, categories )
# end
def cleared
run( "--flat --no-total --exchange '#{CURRENCY}'", 'cleared', 'Assets Equity' )
.split( "\n" )

View file

@ -119,14 +119,19 @@ app.controller( 'DashboardCtrl',
};
this.pie_graph_options = { chart: { type: 'pieChart',
donut: true,
donutRatio: 0.25,
height: 300,
x: function( d ) { return d.account; },
y: function( d ) { return d.amount; },
showLabels: false,
showLegend: false,
showLegend: true,
legendPosition: 'right',
showTooltipPercent: true,
duration: 500,
labelThreshold: 0.01,
labelSunbeamLayout: true
labelSunbeamLayout: true,
donutLabelsOutside: true
} };
};
@ -202,7 +207,11 @@ app.controller( 'DashboardCtrl',
} );
} );
$scope.graphiques = { monthly_values: { options: { chart: { type: 'multiBarChart',
$scope.graphiques = {
monthly_values: {
options: {
chart: {
type: 'multiBarChart',
height: 300,
showControls: false,
showLegend: true,
@ -220,7 +229,8 @@ app.controller( 'DashboardCtrl',
retrieve_period_detailed_data();
}
}
}}
}
}
},
data: _.chain( response.data )
.keys()

View file

@ -1,8 +1,8 @@
<md-content flex="100" layout="column">
<md-card flex="100" layout="row">
<md-card flex="20">
<select multiple="true" data-ng-model="graphed_accounts">
<option data-ng-repeat="account in accounts">{{account}}</option>
<select style="height: 100%;" multiple ng:model="graphed_accounts">
<option ng:repeat="account in accounts">{{account}}</option>
</select>
</md-card>
<md-card flex="81">
@ -12,36 +12,36 @@
</md-card>
<h1>{{period | amDateFormat:'MMMM YYYY'}}</h1>
<md-card flex="100" layout="column"
data-ng-repeat="bucket in balance.buckets">
ng:repeat="bucket in balance.buckets">
<md-toolbar>
<span data-ng-repeat="account in bucket.total_detailed">{{account.account}} = {{account.amount | number:2}} €</span>
<span ng:repeat="account in bucket.total_detailed">{{account.account}} = {{account.amount | number:2}} €</span>
</md-toolbar>
<md-content layout="row">
<md-card flex="20">
<select multiple
data-ng-model="bucket.accounts_selected"
data-ng-options="account.account for account in bucket.raw_data | orderBy:'account'"
data-ng-change="filter_data()">
<select style="height: 100%;" multiple
ng:model="bucket.accounts_selected"
ng:options="account.account for account in bucket.raw_data | orderBy:'account'"
ng:change="filter_data()">
<option value=''>...</option>
</select>
</md-card>
<md-card flex="20">
<md-card flex="78">
<nvd3 data="bucket.data"
options="bucket.pie_graph_options" >
</nvd3>
</md-card>
<md-card flex="56">
<!-- <md-card flex="56">
<table class="table">
<thead>
<tr>
<th><md-buton data-ng-click="bucket.order_by( 'account' )">account</md-buton></th>
<th><md-buton data-ng-click="bucket.order_by( 'amount' )">amount</md-buton></th>
<th><md-buton data-ng-click="bucket.order_by( 'score' )">score</md-buton></th>
<th><md-buton ng:click="bucket.order_by( 'account' )">account</md-buton></th>
<th><md-buton ng:click="bucket.order_by( 'amount' )">amount</md-buton></th>
<th><md-buton ng:click="bucket.order_by( 'score' )">score</md-buton></th>
</tr>
</thead>
<tbody>
<tr data-ng-repeat="account in bucket.data | orderBy:bucket.orderBy:bucket.orderDesc"
data-ng-class="{'even': $even, 'odd': $odd}"
<tr ng:repeat="account in bucket.data | orderBy:bucket.orderBy:bucket.orderDesc"
ng:class="{'even': $even, 'odd': $odd}"
style="border-left:10px solid {{coloring_score( account.score )}};border-right:10px solid {{coloring_score( account.score )}}">
<td style="border-bottom:1px solid {{coloring_score( account.score )}}">
{{account.account}}
@ -55,7 +55,7 @@
</tr>
</tbody>
</table>
</md-card>
</md-card> -->
</md-content>
</md-card>
</md-content>