c# - Get total Amount of the column in AngularJs -
i working on project wherein need sum of column in modal table. yes, calculates amount decimal point not included. (e.g expecting result 194,000.26 result shows 193,000.00) means didn't add decimal point. can me codes ??
here view :
<tr data-ng-repeat="model in models | orderby: sorting:reverse | filter : filter "> <td>{{jsondatetotext(model.requestdate) | date:'mm/dd/yyyy'}}</td> <td> <a href="#" data-toggle="modal" data-target="#basicmodalcontent" data-ng-click="getselectedpr(model)"> {{model.requestid}} </a> </td> <td>{{model.number }}</td> <td>{{model.programname }}</td> <td>{{model.fullname }}</td> <td>{{model.pono}}</td> <td>{{statuslist[model.statusid] | uppercase}}</td> <td class="totalamount"><span class="pull-right">{{model.totalamount | number:2}}</span> </td> <td>{{model.asadsf | lowercase}}</td> </tr> </table> </div> <!-- /.modal na ni --> <div class="modal fade" id="basicmodalcontent" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> </div> <div class="modal-body" id="exportablepritems"> <div class="table-responsive"> <table class="table table-striped table-bordered table-hover" id="datatables-example"> <thead> <tr> <th>pr # </th> <th>item description </th> <th>supplier </th> <th>account </th> <th>currency </th> <th>amount </th> <th>(usd) amount </th> </tr> </thead> <tbody data-ng-repeat="selectedpr in selectedmodal.itemlist"> <tr> <td>{{selectedpr.requestid}}</td> <td>{{selectedpr.partdesc}}</td> <td>{{selectedpr.supplierid }}</td> <td>{{selectedpr.accounttype}}</td> <td>{{selectedpr.currname }}</td> <td data-ng-model="amount" class="amount">{{selectedpr.amount | number:2}}</td> <td>{{selectedpr.amountusd}}</td> </tr> </tbody> <tr> <td colspan="7"><b>total amount : </b>{{selectedmodal.itemlist | sumbykey : 'amount' | number:2}} </td> </tr> </table> </div> </div>
and here angular filter
prapp.filter('sumbykey', function () { return function (data, key) { if (typeof (data) === 'undefined' || typeof (key) === 'undefined') { return 0; } var sum = 0.00; (var = data.length - 1; >= 0; i--) { sum += parseint(data[i][key]); } return sum; }; });
maybe try changing parseint
parsefloat
in filter?
Comments
Post a Comment