Search Posts

How to display sum of particular column from Array of Object which is having dynamic columns using Angularjs dynamically

How to display sum of particular column from Array of Object which is having dynamic columns using Angularjs dynamicallyDynamic Table Data
Earning Columns and deductions heads will be dynamic ..

    <table>
<thead>
	<tr>
		<th rowspan="2">Sl.No</th>
		<th rowspan="2">Employee Code</th>
		<th rowspan="2">Employee Name</th>
		<th rowspan="2">Worked Days</th>
		<th rowspan="2">Days (LOP)</th>
		<th colspan="{{earnlen}}">Earnings</th>
		<th rowspan="2">Gross Earning</th>
		<th colspan="{{dedlen}}">Deductions</th>
		<th rowspan="2">Gross Deduction</th>
		<th rowspan="2">Net Salary</th>
	</tr>
	<tr>
		<th ng-repeat="earncolumn in earningheadlist">{{earncolumn.hrmeD_Name}}</th>
		<th ng-repeat="dedcolumn in deductionheadlist">{{dedcolumn.hrmeD_Name}}</th>
	</tr>
</thead>
<tbody>
	<tr ng-repeat="employee in employeeSalaryslipDetails">
		<td>{{$index +1}}</td>
		<td>{{employee.hrmE_EmployeeCode}}</td>
		<td>{{employee.employeeName}}</td>
		<td>{{employee.hreS_WorkingDays}}</td>
		<td>{{employee.lopDays}}</td>
		<td ng-repeat="earn in employee.earningresult">{{earn.hresD_Amount | number : 2}}</td>
		<td>{{employee.grossEarning | number : 2}}</td>
		<td ng-repeat="dedrow in employee.deductionresult">{{dedrow.hresD_Amount | number : 2}}</td>
		<td>{{employee.grossDeduction | number : 2}}</td>
		<td>{{employee.netSalary | number : 2}}</td>
</tr>
</tbody>
<tfoot>
	<tr>
		<td colspan="5"> Total</td>
		<td ng-repeat="earncolumn in earningheadlist">{{TotalEarningHead()}}</td>
		<td>{{TotalgrossEarning() | number : 2}}</td>
		<td ng-repeat="dedcolumn in deductionheadlist">{{}}</td>
		<td>{{TotalgrossDeduction() | number : 2}}</td>
		<td>{{TotalnetSalary() | number : 2}}</td>
	</tr>
</tfoot>
</table>

Source: AngularJS

Leave a Reply

Your email address will not be published. Required fields are marked *