-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patholdTax.js
46 lines (38 loc) · 1.84 KB
/
oldTax.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
document.getElementById('calculate-btn').addEventListener('click', function() {
const income = Number(document.getElementById('income-input').value);
let tax = 0;
if (income <= 300000) {
tax = 0;
} else if (income <= 600000) {
tax = (income - 300000) * 0.05;
} else if (income <= 900000) {
tax = (300000 * 0.05) + ((income - 600000) * 0.1);
} else if (income <= 1200000) {
tax = (300000 * 0.05) + (300000 * 0.1) + ((income - 900000) * 0.15);
} else if (income <= 1500000) {
tax = (300000 * 0.05) + (300000 * 0.1) + (300000 * 0.15) + ((income - 1200000) * 0.2);
} else if (income > 1500000) {
tax = (300000 * 0.05) + (300000 * 0.1) + (300000 * 0.15) + (300000 * 0.2) + ((income - 1500000) * 0.3);
}
document.getElementById('tax-output').textContent = `You need to pay: ₹${tax.toFixed(2)} in taxes.`;
const payNowBtn = document.getElementById('pay-now-btn') || document.createElement('button');
payNowBtn.textContent = 'Pay Now';
payNowBtn.id = 'pay-now-btn';
document.getElementById('pay-now-container').appendChild(payNowBtn);
payNowBtn.addEventListener('click', function() {
const upiID = "yadavlakshya@fam";
const amount = tax.toFixed(2);
const name = "Name";
const note = "Tax Payment";
const upiString = `upi://pay?pa=${upiID}&pn=${name}&am=${amount}&cu=INR&tn=${note}`;
// Remove any existing QR code
const existingQRCode = document.getElementById('qrcode');
if (existingQRCode) {
existingQRCode.remove();
}
const qrcodeDiv = document.createElement('div');
qrcodeDiv.id = 'qrcode';
document.getElementById('qrcode-container').appendChild(qrcodeDiv);
new QRCode(document.getElementById("qrcode"), { text: upiString, width: 128, height: 128 });
});
});