Skip to content

Instantly share code, notes, and snippets.

@asankalk
Created March 13, 2024 02:40
Show Gist options
  • Save asankalk/955af30948b31f745718b6fdaa503364 to your computer and use it in GitHub Desktop.
Save asankalk/955af30948b31f745718b6fdaa503364 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Development Application Fee Calculator</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
#calculator {
background-color: #fff;
border-radius: 10px;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
text-align: center;
}
h1 {
color: #333;
margin-bottom: 20px;
}
label {
font-weight: bold;
}
input[type="number"],
input[type="text"] {
width: 100%;
padding: 10px;
margin: 8px 0;
border: 1px solid #ccc;
border-radius: 5px;
box-sizing: border-box;
}
button {
background-color: #007bff;
color: #fff;
border: none;
border-radius: 5px;
padding: 10px 20px;
cursor: pointer;
font-size: 16px;
}
button:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div id="calculator">
<h1>Development Application Fee Calculator</h1>
<form method="post">
<label for="costOfDevelopment">Approximate cost of development (excluding GST):</label><br>
<input type="number" id="costOfDevelopment" name="costOfDevelopment" required><br><br>
<label for="applicationFee">Application Fee:</label><br>
<input type="text" id="applicationFee" name="applicationFee" readonly><br><br>
<button type="submit" name="calculate">Calculate</button>
</form>
</div>
<?php
if (isset($_POST['calculate'])) {
$costOfDevelopment = floatval($_POST['costOfDevelopment']);
$applicationFee = '';
const FEE_1 = 147;
const FEE_2_BASE = 50000;
const FEE_2_RATE = 0.0032;
const FEE_3_BASE = 500000;
const FEE_3_BASE_AMOUNT = 1700;
const FEE_3_RATE = 0.00257;
const FEE_4_BASE = 2500000;
const FEE_4_BASE_AMOUNT = 7161;
const FEE_4_RATE = 0.00206;
const FEE_5_BASE = 5000000;
const FEE_5_BASE_AMOUNT = 12633;
const FEE_5_RATE = 0.00123;
const FEE_6_BASE = 21500000;
const FEE_6_BASE_AMOUNT = 34196;
if ($costOfDevelopment <= FEE_2_BASE) {
$applicationFee = "$" . number_format(FEE_1, 2);
} elseif ($costOfDevelopment <= FEE_3_BASE) {
$applicationFee = "$" . number_format($costOfDevelopment * FEE_2_RATE, 2);
} elseif ($costOfDevelopment <= FEE_4_BASE) {
$applicationFee = "$" . number_format(FEE_3_BASE_AMOUNT + ($costOfDevelopment - FEE_3_BASE) * FEE_3_RATE, 2);
} elseif ($costOfDevelopment <= FEE_5_BASE) {
$applicationFee = "$" . number_format(FEE_4_BASE_AMOUNT + ($costOfDevelopment - FEE_4_BASE) * FEE_4_RATE, 2);
} elseif ($costOfDevelopment <= FEE_6_BASE) {
$applicationFee = "$" . number_format(FEE_5_BASE_AMOUNT + ($costOfDevelopment - FEE_5_BASE) * FEE_5_RATE, 2);
} else {
$applicationFee = "$" . number_format(FEE_6_BASE_AMOUNT, 2);
}
echo '<script>document.getElementById("applicationFee").value = "' . $applicationFee . '";</script>';
}
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment