Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GST Calculator #304

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add files via upload
  • Loading branch information
BabyElias committed May 11, 2022
commit 29deab53e4953ca311bdb3972e554e822cb266ba
32 changes: 32 additions & 0 deletions Calculators/GST_Calculator/design.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
body {
margin-top: 5%;
margin-bottom: 10%;
margin-left: 20%;
margin-right: 25%;
font-size: x-large;
background-image:url("image.jpg");
background-repeat: no-repeat;
background-size: 100%;
}

table {
font-size: 100%;
width: 100%;
}

tr {
height: 70px;
}

input[type=number] {
width: 50%;
font-size: 75%;
padding: 12px;
}

#main {
width: 1000px;
padding: 10px;
border: 5px solid gray;
margin: 0;
}
Binary file added Calculators/GST_Calculator/image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
67 changes: 67 additions & 0 deletions Calculators/GST_Calculator/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<html lang="en" dir="ltr">

<head>
<link rel="stylesheet" href="design.css">

<meta charset="utf-8">
<title>GST Calculator</title>
</head>

<body>
<div id="main">



<h1>
<center><U>GST Calculator</U></center>
</h1>
<form>
<table>
<tr>
<td><label>
Gross Price
</label></td>
<td>(in Rs)</td>
<td>
<div><input type="number" id="gross" size="125%" /></div>
</td>
</tr>
<tr>
<td><label>
GST Rate
</label></td>
<td>(in %)</td>
<td><span><input type="number" id="gstrate" size="125%" /></span></td>
</tr>
<tr>
<td><label>
Net Price
</label></td>
<td>(in Rs)</td>
<td><span id="netprice"></span< /td>
</tr>
<tr>
<td><label>
SGST
</label></td>
<td>(in Rs)</td>
<td><span id="sgst"></span></td>
</tr>
<tr>
<td><label>
CGST
</label></td>
<td>(in Rs)</td>
<td><span id="cgst"></span></td>
</tr>
</table>
<center><button type="button" id="button">Submit</button></center>
</form>
</div>
<script src="script.js" charset="utf-8"></script>



</body>

</html>
30 changes: 30 additions & 0 deletions Calculators/GST_Calculator/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
document.getElementById("button").addEventListener("click", handleclick);

function handleclick() {
var gross_price = parseFloat(document.getElementById("gross").value);
var gst_rate = parseFloat(document.getElementById("gstrate").value);



var x1 = (100 * gross_price) / (100 + gst_rate);
var x2 = (x1 * gst_rate) / 200;
if (gst_rate === 5 || gst_rate === 12 || gst_rate === 18 || gst_rate === 28) {
document.getElementById("netprice").innerHTML = x1.toPrecision(4);

document.getElementById("sgst").innerHTML = x2.toPrecision(4);

document.getElementById("cgst").innerHTML = x2.toPrecision(4);

} else {
alert("Invalid GST Rate");
document.getElementById("netprice").innerHTML = " ";

document.getElementById("sgst").innerHTML = " ";

document.getElementById("cgst").innerHTML = " ";
}




}