I have one table
with fields
AutoPopList
................................
Id value Is % IsDis% TaxType Base
1 10 1 1 Discount Basic
2 20 1 0 Savings Basic
3 5 1 0 SGST Cumulative
4 5 0 0 CGST cumulative
after clicking of taxes popup it was displaying relevant values on
taxes popup
https://ibb.co/FhQ4p4H
https://ibb.co/ZxVr0TV
currently my requirement is that if i have checked Is Dis% then
display total value in minus (-100) or else display in plus(+100)
Ex:
if you can look at into screenshot on 1st row of taxes popup
i have checked Is Dis% then i need to display Total value=-100 or
else display Total=+100
2)if Base=cumulative then total value should be displayed on particular row on basic of basic value ,sum of total(Base=basic in taxes array) and
value(tax%)
Ex:
if you can look at into screensshot 1st 2 rows are base=basic those
total values (-100 & 200)
currently i need to get total value(on 3 and 4 rows)
arebase=cumulative) if base=cumulative
Ex:
basic value=1000
Forumula:
Total=basicvalue+( sum of total only Base=Basic)*Value
Total=1000-100+200*5/100 =55 my excepted o/p should be like below
Id value Is % Is Dis % TaxType Case Total
1 10 CB(che) CB(che) Discount basic - 100
2 20 CB(che) CB(disa) Savings basic 200
3 5 CB(che) CB(dis) SGST cumulative 55
4 5 CB(che) CB(dis) CGST cumulative 55
Could you please help me
I have shared you my code
@{
Layout = null;
}
<html>
<head>
<title>Index</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.9/angular.min.js"></script>
<script src="~/scripts/dirpagination.js"></script>
<script type="text/javascript">
var app = angular.module('MyApp', ['angularUtils.directives.dirPagination'])
app.controller('MyController', function ($scope, $http, $window, RegistrationService) {
loadEmployees();
$scope.basicChange = function (i) {
$scope.taxes[i].rowtotal = $(this)[0].basicamount * $scope.taxes[i].value / 100;
};
$scope.childrow = false;
//Addition of 2 numbers
$scope.AddNumbers = function (i) {
debugger;
var a = Number($scope.taxtotal || 0);
var b = Number($scope.basicamount || 0);
$scope.grandtotal = a + b;
}
function loadEmployees() {
var EmployeeRecords = RegistrationService.gettaxes();
EmployeeRecords.then(function (d) {
$scope.taxes = d.data;
}, function () {
alert("Error occured while fetching employee list...");
});
}
$scope.Customers = [];
$scope.taxes = [];
$scope.newtaxes = [];
$scope.change = function (i) {
var basic = $scope.basicamount;
var total = 0;
for (var i = 0; i < $scope.taxes.length; i++) {
$scope.taxes[i].rowtotal = parseFloat($scope.taxes[i].value) * parseFloat(basic) / 100;
}
var total = 0;
for (var i = 0; i < $scope.taxes.length; i++) {
if ($scope.taxes[i].Is__) {
total += $scope.taxes[i].rowtotal;
}
}
$scope.taxtotal = parseFloat(total).toFixed(2);
};
$scope.Add = function () {
// Add Selected taxes.
for (var i = 0; i < $scope.taxes.length; i++) {
if ($scope.taxes[i].Is__) {
$scope.newtaxes.push($scope.taxes[i]);
}
}
//Add the new item to the Array.
var customer = {};
customer.basicamount = $scope.basicamount;
customer.taxes = $scope.newtaxes;
customer.taxtotal = $scope.taxtotal;
customer.grandtotal = $scope.grandtotal;
$scope.Customers.push(customer);
//Clear the TextBoxes.
$scope.newtaxes = [];
$scope.basicamount = "";
$scope.taxtotal = "";
$scope.grandtotal = "";
loadEmployees();
};
});
app.service("RegistrationService", function ($http) {
this.gettaxes = function () {
return $http.get("/taxcalculation/getAll1");
};
});
</script>
</head>
</html>
public JsonResult getAll1()
{
List<TaxCaluculation> Emp = db.TaxCaluculation.ToList();
return Json(Emp, JsonRequestBehavior.AllowGet);
}