Sneha K

Sneha K

  • 1.2k
  • 527
  • 195.9k

How to round up the value end with Zero in asp.net mvc5?

Jul 17 2020 7:05 AM
Hi i need to round up to Zero Value (end value to be 0, like 450, 55000, 4560). Hi i want to round up the value with ending zero eg if i got value like 102498 means 102500 and if i got value like 47504 means 47500 this i have to do in mvc
eg values
999 =>1000
994=>990.
995=>990
I want to round up the value and end value is zero of each one
My View Code
<table class="table table-bordered table-striped mb-none" id="tblTestDetails">
<thead>
<tr>
<th>Test Name</th>
<th>Total hrs</th>
<th>Rate/Hr</th>
<th>Margin</th>
<th>Discount</th>
<th>Total Cost</th>
<th>Total Cost With Discount</th>
<th>Remarks</th>
</tr>
</thead>
<tbody>
@{double totRC = 0.0, totCost = 0.0, totWithDisc = 0.0, TotalRatecardcost = 0.0;}
@if (Model != null && Model.TestDetails != null && Model.TestDetails.Count > 0)
{
foreach (var item in Model.TestDetails)
{
cnt++;
<tr>
<td>@item.TestName</td>
<td>@item.TotalHours</td>
<td class="amt-field">@item.PerHourRate</td>
<td>@item.Margin)</td>
<td>@item.Discount)</td>
<td class="amt-field">
@{double totamt = item.PerHourRate * item.TotalHours;
totRC += totamt;
totamt += totamt * item.Margin * 0.01;
totCost += totamt;
}
@Math.Round(totamt)
</td>
<td class="amt-field">
@{double totamtWithDisc = totamt - (totamt * item.Discount * 0.01);
totWithDisc += totamtWithDisc; }
@Math.Round(totamtWithDisc)
</td>
<td>@item.Remarks</td>
<td>
</tr>
</tbody>
</table>
In the above table i have to round off the **TOTAL COST VALUE** .Please any one understand my issue help me to resolve this issue.Thanks.

Answers (3)