diff --git a/inc/myco.js b/inc/myco.js
index c303d89..5e1a33d 100644
--- a/inc/myco.js
+++ b/inc/myco.js
@@ -338,12 +338,16 @@ display_balance=function(group) {
bal=group.balance();
tbody=$($('#display_balance_modal tbody')[0]);
tbody.html('');
- sum=0;
- for (c in bal) {
- tbody.append('
'+c+' | '+bal[c]+' € |
');
- sum+=bal[c];
+ for (c in bal['balance']) {
+ if(bal['balance'][c]['diff']<0) {
+ diff=''+bal['balance'][c]['diff'].toFixed(2)+' € | ';
+ }
+ else {
+ diff=' | ';
+ }
+ tbody.append(''+c+' | '+bal['balance'][c]['total']+' € | '+diff+'
');
}
- $('#display_balance_modal #total-value').html(sum+' €');
+ $('#display_balance_modal #total-value').html(bal.sum.toFixed(2)+' €');
$('#display_balance_modal').modal('show');
}
diff --git a/inc/myco_objects.js b/inc/myco_objects.js
index e97910c..8ed0340 100644
--- a/inc/myco_objects.js
+++ b/inc/myco_objects.js
@@ -174,17 +174,39 @@ function Group(name,data) {
* Balance
*/
this.balance=function() {
- ret={}
+ total={}
+ min=-1;
+ max=0;
for (idx in this.contributors) {
- sum=0;
+ var sum=0;
c=this.contributors[idx].name;
cl=this.contributionsByContributorName(c);
for (idc in cl) {
sum+=cl[idc].cost;
}
- ret[c]=sum;
+ if (min==-1 || min>sum) {
+ min=sum;
+ }
+ if(max
- Participant | Participation |
+
+ Participant |
+ Participation |
+ |
+
Total : |
- |
+ |