File size: 62,531 Bytes
5099c79 | 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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>India Income Tax Calculator 2025-26</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.sheetjs.com/xlsx-0.19.3/package/dist/xlsx.full.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.toggle-checkbox:checked {
right: 0;
background-color: #4f46e5;
}
.toggle-checkbox:checked + .toggle-label {
background-color: #a5b4fc;
}
.tab-active {
border-bottom: 3px solid #4f46e5;
color: #4f46e5;
font-weight: 600;
}
.input-highlight {
transition: all 0.3s;
}
.input-highlight:focus {
box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
border-color: #4f46e5;
}
.tooltip {
position: relative;
display: inline-block;
}
.tooltip .tooltiptext {
visibility: hidden;
width: 200px;
background-color: #555;
color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px;
position: absolute;
z-index: 1;
bottom: 125%;
left: 50%;
margin-left: -100px;
opacity: 0;
transition: opacity 0.3s;
}
.tooltip:hover .tooltiptext {
visibility: visible;
opacity: 1;
}
</style>
</head>
<body class="bg-gray-50 min-h-screen">
<div class="container mx-auto px-4 py-8 max-w-6xl">
<!-- Header -->
<header class="mb-8 text-center">
<h1 class="text-3xl md:text-4xl font-bold text-indigo-800 mb-2">India Income Tax Calculator</h1>
<p class="text-lg text-gray-600">Financial Year 2025-26 | Old & New Regime Comparison</p>
<div class="mt-4 flex justify-center">
<div class="bg-indigo-100 text-indigo-800 px-4 py-2 rounded-full flex items-center">
<i class="fas fa-info-circle mr-2"></i>
<span>Assessment Year: 2026-27</span>
</div>
</div>
</header>
<!-- Main Calculator -->
<div class="bg-white rounded-xl shadow-lg overflow-hidden">
<!-- Tabs -->
<div class="flex border-b">
<button id="personal-tab" class="tab-active px-6 py-4 text-sm font-medium">Personal Details</button>
<button id="income-tab" class="px-6 py-4 text-sm font-medium text-gray-500 hover:text-indigo-600">Income Details</button>
<button id="deductions-tab" class="px-6 py-4 text-sm font-medium text-gray-500 hover:text-indigo-600">Deductions</button>
<button id="results-tab" class="px-6 py-4 text-sm font-medium text-gray-500 hover:text-indigo-600">Results</button>
</div>
<!-- Personal Details Tab -->
<div id="personal-section" class="p-6">
<h2 class="text-xl font-semibold text-gray-800 mb-6">Taxpayer Information</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<label for="name" class="block text-sm font-medium text-gray-700 mb-1">Full Name*</label>
<input type="text" id="name" class="w-full px-4 py-2 rounded-lg border border-gray-300 input-highlight focus:outline-none" placeholder="Enter your full name">
</div>
<div>
<label for="pan" class="block text-sm font-medium text-gray-700 mb-1">PAN Number*</label>
<input type="text" id="pan" class="w-full px-4 py-2 rounded-lg border border-gray-300 input-highlight focus:outline-none uppercase" placeholder="ABCDE1234F" maxlength="10" pattern="[A-Z]{5}[0-9]{4}[A-Z]{1}">
</div>
<div>
<label for="age" class="block text-sm font-medium text-gray-700 mb-1">Age*</label>
<input type="number" id="age" class="w-full px-4 py-2 rounded-lg border border-gray-300 input-highlight focus:outline-none" placeholder="Enter your age" min="18" max="120">
</div>
<div>
<label class="block text-sm font-medium text-gray-700 mb-1">Gender*</label>
<div class="flex space-x-4">
<label class="inline-flex items-center">
<input type="radio" name="gender" value="male" class="h-4 w-4 text-indigo-600" checked>
<span class="ml-2 text-gray-700">Male</span>
</label>
<label class="inline-flex items-center">
<input type="radio" name="gender" value="female" class="h-4 w-4 text-indigo-600">
<span class="ml-2 text-gray-700">Female</span>
</label>
<label class="inline-flex items-center">
<input type="radio" name="gender" value="other" class="h-4 w-4 text-indigo-600">
<span class="ml-2 text-gray-700">Other</span>
</label>
</div>
</div>
</div>
<div class="mt-8 flex justify-end">
<button id="next-to-income" class="px-6 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition duration-300">Next <i class="fas fa-arrow-right ml-2"></i></button>
</div>
</div>
<!-- Income Details Tab -->
<div id="income-section" class="p-6 hidden">
<h2 class="text-xl font-semibold text-gray-800 mb-6">Income Details</h2>
<div class="space-y-6">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<label for="salary" class="block text-sm font-medium text-gray-700 mb-1">Salary Income*</label>
<div class="relative">
<span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500">₹</span>
<input type="number" id="salary" class="w-full pl-8 pr-4 py-2 rounded-lg border border-gray-300 input-highlight focus:outline-none" placeholder="0" min="0">
</div>
</div>
<div>
<label for="rental" class="block text-sm font-medium text-gray-700 mb-1">House Property Income</label>
<div class="relative">
<span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500">₹</span>
<input type="number" id="rental" class="w-full pl-8 pr-4 py-2 rounded-lg border border-gray-300 input-highlight focus:outline-none" placeholder="0" min="0">
</div>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<label for="capital-gains" class="block text-sm font-medium text-gray-700 mb-1">Capital Gains</label>
<div class="relative">
<span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500">₹</span>
<input type="number" id="capital-gains" class="w-full pl-8 pr-4 py-2 rounded-lg border border-gray-300 input-highlight focus:outline-none" placeholder="0" min="0">
</div>
</div>
<div>
<label for="business" class="block text-sm font-medium text-gray-700 mb-1">Business/Profession Income</label>
<div class="relative">
<span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500">₹</span>
<input type="number" id="business" class="w-full pl-8 pr-4 py-2 rounded-lg border border-gray-300 input-highlight focus:outline-none" placeholder="0" min="0">
</div>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<label for="other-income" class="block text-sm font-medium text-gray-700 mb-1">Other Income</label>
<div class="relative">
<span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500">₹</span>
<input type="number" id="other-income" class="w-full pl-8 pr-4 py-2 rounded-lg border border-gray-300 input-highlight focus:outline-none" placeholder="0" min="0">
</div>
</div>
</div>
</div>
<div class="mt-8 flex justify-between">
<button id="back-to-personal" class="px-6 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 transition duration-300"><i class="fas fa-arrow-left mr-2"></i> Back</button>
<button id="next-to-deductions" class="px-6 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition duration-300">Next <i class="fas fa-arrow-right ml-2"></i></button>
</div>
</div>
<!-- Deductions Tab -->
<div id="deductions-section" class="p-6 hidden">
<h2 class="text-xl font-semibold text-gray-800 mb-6">Deductions (Old Regime Only)</h2>
<div class="mb-6">
<div class="flex items-center justify-between mb-4">
<h3 class="text-lg font-medium text-gray-800">Section 80C Deductions</h3>
<span class="text-sm text-gray-500">Max ₹1,50,000</span>
</div>
<div class="space-y-4">
<div>
<label for="ppf" class="block text-sm font-medium text-gray-700 mb-1">PPF/EPF Contribution</label>
<div class="relative">
<span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500">₹</span>
<input type="number" id="ppf" class="w-full pl-8 pr-4 py-2 rounded-lg border border-gray-300 input-highlight focus:outline-none" placeholder="0" min="0" max="150000">
</div>
</div>
<div>
<label for="elss" class="block text-sm font-medium text-gray-700 mb-1">ELSS Mutual Funds</label>
<div class="relative">
<span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500">₹</span>
<input type="number" id="elss" class="w-full pl-8 pr-4 py-2 rounded-lg border border-gray-300 input-highlight focus:outline-none" placeholder="0" min="0" max="150000">
</div>
</div>
<div>
<label for="insurance" class="block text-sm font-medium text-gray-700 mb-1">Life Insurance Premium</label>
<div class="relative">
<span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500">₹</span>
<input type="number" id="insurance" class="w-full pl-8 pr-4 py-2 rounded-lg border border-gray-300 input-highlight focus:outline-none" placeholder="0" min="0" max="150000">
</div>
</div>
</div>
</div>
<div class="mb-6">
<h3 class="text-lg font-medium text-gray-800 mb-4">Other Deductions</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<label for="medical-insurance" class="block text-sm font-medium text-gray-700 mb-1">Medical Insurance (80D)</label>
<div class="relative">
<span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500">₹</span>
<input type="number" id="medical-insurance" class="w-full pl-8 pr-4 py-2 rounded-lg border border-gray-300 input-highlight focus:outline-none" placeholder="0" min="0" max="50000">
</div>
</div>
<div>
<label for="education-loan" class="block text-sm font-medium text-gray-700 mb-1">Education Loan Interest (80E)</label>
<div class="relative">
<span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500">₹</span>
<input type="number" id="education-loan" class="w-full pl-8 pr-4 py-2 rounded-lg border border-gray-300 input-highlight focus:outline-none" placeholder="0" min="0">
</div>
</div>
<div>
<label for="donations" class="block text-sm font-medium text-gray-700 mb-1">Donations (80G)</label>
<div class="relative">
<span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500">₹</span>
<input type="number" id="donations" class="w-full pl-8 pr-4 py-2 rounded-lg border border-gray-300 input-highlight focus:outline-none" placeholder="0" min="0">
</div>
</div>
<div>
<label for="hra" class="block text-sm font-medium text-gray-700 mb-1">HRA Exemption</label>
<div class="relative">
<span class="absolute inset-y-0 left-0 flex items-center pl-3 text-gray-500">₹</span>
<input type="number" id="hra" class="w-full pl-8 pr-4 py-2 rounded-lg border border-gray-300 input-highlight focus:outline-none" placeholder="0" min="0">
</div>
</div>
</div>
</div>
<div class="mt-8 flex justify-between">
<button id="back-to-income" class="px-6 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 transition duration-300"><i class="fas fa-arrow-left mr-2"></i> Back</button>
<button id="calculate-tax" class="px-6 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition duration-300">Calculate Tax <i class="fas fa-calculator ml-2"></i></button>
</div>
</div>
<!-- Results Tab -->
<div id="results-section" class="p-6 hidden">
<h2 class="text-xl font-semibold text-gray-800 mb-6">Tax Calculation Results</h2>
<div class="mb-8">
<div class="flex items-center justify-between mb-4">
<h3 class="text-lg font-medium text-gray-800">Tax Regime Comparison</h3>
<div class="flex items-center">
<span class="mr-3 text-sm font-medium text-gray-700">Regime:</span>
<div class="relative inline-block w-12 mr-2 align-middle select-none">
<input type="checkbox" id="regime-toggle" class="toggle-checkbox absolute block w-6 h-6 rounded-full bg-white border-4 appearance-none cursor-pointer"/>
<label for="regime-toggle" class="toggle-label block overflow-hidden h-6 rounded-full bg-gray-300 cursor-pointer"></label>
</div>
<span id="regime-label" class="text-sm font-medium text-indigo-600">Old Regime</span>
</div>
</div>
<div class="bg-gray-50 rounded-lg p-6">
<div class="grid grid-cols-1 md:grid-cols-2 gap-8">
<!-- Old Regime Results -->
<div id="old-regime-results">
<div class="flex items-center mb-4">
<div class="w-3 h-3 bg-indigo-500 rounded-full mr-2"></div>
<h4 class="text-lg font-semibold text-gray-800">Old Regime Calculation</h4>
</div>
<div class="space-y-3">
<div class="flex justify-between">
<span class="text-gray-600">Total Income:</span>
<span id="old-total-income" class="font-medium">₹0</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Total Deductions:</span>
<span id="old-total-deductions" class="font-medium">₹0</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Taxable Income:</span>
<span id="old-taxable-income" class="font-medium text-indigo-600">₹0</span>
</div>
<div class="border-t border-gray-200 my-2"></div>
<div class="flex justify-between">
<span class="text-gray-600">Income Tax:</span>
<span id="old-income-tax" class="font-medium">₹0</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Surcharge:</span>
<span id="old-surcharge" class="font-medium">₹0</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Health & Education Cess:</span>
<span id="old-cess" class="font-medium">₹0</span>
</div>
<div class="border-t border-gray-200 my-2"></div>
<div class="flex justify-between">
<span class="text-gray-600 font-semibold">Total Tax Liability:</span>
<span id="old-total-tax" class="font-bold text-lg text-indigo-600">₹0</span>
</div>
</div>
</div>
<!-- New Regime Results -->
<div id="new-regime-results" class="opacity-50">
<div class="flex items-center mb-4">
<div class="w-3 h-3 bg-gray-400 rounded-full mr-2"></div>
<h4 class="text-lg font-semibold text-gray-600">New Regime Calculation</h4>
</div>
<div class="space-y-3">
<div class="flex justify-between">
<span class="text-gray-600">Total Income:</span>
<span id="new-total-income" class="font-medium">₹0</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Standard Deduction:</span>
<span id="new-standard-deduction" class="font-medium">₹50,000</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Taxable Income:</span>
<span id="new-taxable-income" class="font-medium text-indigo-600">₹0</span>
</div>
<div class="border-t border-gray-200 my-2"></div>
<div class="flex justify-between">
<span class="text-gray-600">Income Tax:</span>
<span id="new-income-tax" class="font-medium">₹0</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Surcharge:</span>
<span id="new-surcharge" class="font-medium">₹0</span>
</div>
<div class="flex justify-between">
<span class="text-gray-600">Health & Education Cess:</span>
<span id="new-cess" class="font-medium">₹0</span>
</div>
<div class="border-t border-gray-200 my-2"></div>
<div class="flex justify-between">
<span class="text-gray-600 font-semibold">Total Tax Liability:</span>
<span id="new-total-tax" class="font-bold text-lg text-indigo-600">₹0</span>
</div>
</div>
</div>
</div>
<div class="mt-6 bg-indigo-50 border border-indigo-100 rounded-lg p-4">
<div class="flex items-center">
<i class="fas fa-lightbulb text-indigo-500 mr-2"></i>
<h4 class="font-medium text-indigo-800">Recommendation</h4>
</div>
<p id="regime-recommendation" class="mt-2 text-sm text-gray-700">Based on your income and deductions, the old regime appears more beneficial.</p>
</div>
</div>
</div>
<div class="mb-8">
<h3 class="text-lg font-medium text-gray-800 mb-4">Tax Slabs Applied</h3>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Income Range</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Old Regime Rate</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">New Regime Rate</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Up to ₹2,50,000</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">0%</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">0%</td>
</tr>
<tr class="bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">₹2,50,001 - ₹5,00,000</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">5%</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">5%</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">₹5,00,001 - ₹7,50,000</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">20%</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">10%</td>
</tr>
<tr class="bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">₹7,50,001 - ₹10,00,000</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">20%</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">15%</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">₹10,00,001 - ₹12,50,000</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">30%</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">20%</td>
</tr>
<tr class="bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">₹12,50,001 - ₹15,00,000</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">30%</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">25%</td>
</tr>
<tr>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">Above ₹15,00,000</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">30%</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">30%</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="flex justify-between">
<button id="back-to-deductions" class="px-6 py-2 bg-gray-200 text-gray-700 rounded-lg hover:bg-gray-300 transition duration-300"><i class="fas fa-arrow-left mr-2"></i> Back</button>
<div class="space-x-4">
<button id="save-data" class="px-6 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700 transition duration-300"><i class="fas fa-save mr-2"></i> Save Data</button>
<button id="export-excel" class="px-6 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition duration-300"><i class="fas fa-file-excel mr-2"></i> Export to Excel</button>
</div>
</div>
</div>
</div>
<!-- Data Retrieval Section -->
<div class="mt-12 bg-white rounded-xl shadow-lg overflow-hidden p-6">
<h2 class="text-xl font-semibold text-gray-800 mb-6">Retrieve Saved Data</h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<label for="search-pan" class="block text-sm font-medium text-gray-700 mb-1">Search by PAN</label>
<div class="flex">
<input type="text" id="search-pan" class="flex-1 px-4 py-2 rounded-l-lg border border-gray-300 input-highlight focus:outline-none uppercase" placeholder="Enter PAN" maxlength="10">
<button id="search-by-pan" class="px-4 py-2 bg-indigo-600 text-white rounded-r-lg hover:bg-indigo-700 transition duration-300"><i class="fas fa-search"></i></button>
</div>
</div>
<div>
<label for="search-name" class="block text-sm font-medium text-gray-700 mb-1">Search by Name</label>
<div class="flex">
<input type="text" id="search-name" class="flex-1 px-4 py-2 rounded-l-lg border border-gray-300 input-highlight focus:outline-none" placeholder="Enter name">
<button id="search-by-name" class="px-4 py-2 bg-indigo-600 text-white rounded-r-lg hover:bg-indigo-700 transition duration-300"><i class="fas fa-search"></i></button>
</div>
</div>
</div>
<div id="search-results" class="mt-6 hidden">
<h3 class="text-lg font-medium text-gray-800 mb-4">Search Results</h3>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Name</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">PAN</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Age</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Gender</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Total Income</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Tax (Old)</th>
<th scope="col" class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Tax (New)</th>
</tr>
</thead>
<tbody id="results-table-body" class="bg-white divide-y divide-gray-200">
<!-- Results will be populated here -->
</tbody>
</table>
</div>
</div>
</div>
<!-- Footer -->
<footer class="mt-12 text-center text-gray-600 text-sm">
<p>© 2025 India Income Tax Calculator. This tool is for informational purposes only.</p>
<p class="mt-1">Tax rates are as per the Finance Act for FY 2025-26 (AY 2026-27).</p>
</footer>
</div>
<script>
// Global variables to store tax data
let taxData = {
personal: {},
income: {},
deductions: {},
results: {}
};
// Store all saved records
let savedRecords = JSON.parse(localStorage.getItem('taxRecords')) || [];
// Tab navigation
document.getElementById('next-to-income').addEventListener('click', function() {
const name = document.getElementById('name').value;
const pan = document.getElementById('pan').value;
const age = document.getElementById('age').value;
const gender = document.querySelector('input[name="gender"]:checked').value;
if (!name || !pan || !age) {
alert('Please fill all required personal details');
return;
}
if (!/^[A-Z]{5}[0-9]{4}[A-Z]{1}$/.test(pan)) {
alert('Please enter a valid PAN number');
return;
}
taxData.personal = { name, pan, age, gender };
document.getElementById('personal-section').classList.add('hidden');
document.getElementById('income-section').classList.remove('hidden');
document.getElementById('personal-tab').classList.remove('tab-active');
document.getElementById('income-tab').classList.add('tab-active');
});
document.getElementById('back-to-personal').addEventListener('click', function() {
document.getElementById('income-section').classList.add('hidden');
document.getElementById('personal-section').classList.remove('hidden');
document.getElementById('income-tab').classList.remove('tab-active');
document.getElementById('personal-tab').classList.add('tab-active');
});
document.getElementById('next-to-deductions').addEventListener('click', function() {
const salary = parseFloat(document.getElementById('salary').value) || 0;
const rental = parseFloat(document.getElementById('rental').value) || 0;
const capitalGains = parseFloat(document.getElementById('capital-gains').value) || 0;
const business = parseFloat(document.getElementById('business').value) || 0;
const otherIncome = parseFloat(document.getElementById('other-income').value) || 0;
if (salary === 0 && rental === 0 && capitalGains === 0 && business === 0 && otherIncome === 0) {
alert('Please enter at least one income source');
return;
}
taxData.income = { salary, rental, capitalGains, business, otherIncome };
document.getElementById('income-section').classList.add('hidden');
document.getElementById('deductions-section').classList.remove('hidden');
document.getElementById('income-tab').classList.remove('tab-active');
document.getElementById('deductions-tab').classList.add('tab-active');
});
document.getElementById('back-to-income').addEventListener('click', function() {
document.getElementById('deductions-section').classList.add('hidden');
document.getElementById('income-section').classList.remove('hidden');
document.getElementById('deductions-tab').classList.remove('tab-active');
document.getElementById('income-tab').classList.add('tab-active');
});
document.getElementById('calculate-tax').addEventListener('click', function() {
// Get deductions data
const ppf = parseFloat(document.getElementById('ppf').value) || 0;
const elss = parseFloat(document.getElementById('elss').value) || 0;
const insurance = parseFloat(document.getElementById('insurance').value) || 0;
const medicalInsurance = parseFloat(document.getElementById('medical-insurance').value) || 0;
const educationLoan = parseFloat(document.getElementById('education-loan').value) || 0;
const donations = parseFloat(document.getElementById('donations').value) || 0;
const hra = parseFloat(document.getElementById('hra').value) || 0;
taxData.deductions = { ppf, elss, insurance, medicalInsurance, educationLoan, donations, hra };
// Calculate taxes
calculateTaxes();
// Show results
document.getElementById('deductions-section').classList.add('hidden');
document.getElementById('results-section').classList.remove('hidden');
document.getElementById('deductions-tab').classList.remove('tab-active');
document.getElementById('results-tab').classList.add('tab-active');
});
document.getElementById('back-to-deductions').addEventListener('click', function() {
document.getElementById('results-section').classList.add('hidden');
document.getElementById('deductions-section').classList.remove('hidden');
document.getElementById('results-tab').classList.remove('tab-active');
document.getElementById('deductions-tab').classList.add('tab-active');
});
// Tax calculation function
function calculateTaxes() {
// Get income data
const { salary, rental, capitalGains, business, otherIncome } = taxData.income;
const { ppf, elss, insurance, medicalInsurance, educationLoan, donations, hra } = taxData.deductions;
// Calculate total income
const totalIncome = salary + rental + capitalGains + business + otherIncome;
// OLD REGIME CALCULATION
// Calculate total deductions under old regime
const total80C = Math.min(ppf + elss + insurance, 150000);
const totalDeductions = total80C + medicalInsurance + educationLoan + donations + hra;
// Calculate taxable income
const oldTaxableIncome = Math.max(0, totalIncome - totalDeductions);
// Calculate tax based on slabs
let oldTax = 0;
let oldSlabs = [];
if (oldTaxableIncome > 1500000) {
oldTax += (oldTaxableIncome - 1500000) * 0.3;
oldSlabs.push({ range: 'Above ₹15,00,000', amount: oldTaxableIncome - 1500000, rate: '30%', tax: (oldTaxableIncome - 1500000) * 0.3 });
oldTax += (1500000 - 1250000) * 0.3;
oldSlabs.push({ range: '₹12,50,001 - ₹15,00,000', amount: 1500000 - 1250000, rate: '30%', tax: (1500000 - 1250000) * 0.3 });
oldTax += (1250000 - 1000000) * 0.3;
oldSlabs.push({ range: '₹10,00,001 - ₹12,50,000', amount: 1250000 - 1000000, rate: '30%', tax: (1250000 - 1000000) * 0.3 });
oldTax += (1000000 - 750000) * 0.2;
oldSlabs.push({ range: '₹7,50,001 - ₹10,00,000', amount: 1000000 - 750000, rate: '20%', tax: (1000000 - 750000) * 0.2 });
oldTax += (750000 - 500000) * 0.2;
oldSlabs.push({ range: '₹5,00,001 - ₹7,50,000', amount: 750000 - 500000, rate: '20%', tax: (750000 - 500000) * 0.2 });
oldTax += (500000 - 250000) * 0.05;
oldSlabs.push({ range: '₹2,50,001 - ₹5,00,000', amount: 500000 - 250000, rate: '5%', tax: (500000 - 250000) * 0.05 });
} else if (oldTaxableIncome > 1250000) {
oldTax += (oldTaxableIncome - 1250000) * 0.3;
oldSlabs.push({ range: '₹12,50,001 - ₹15,00,000', amount: oldTaxableIncome - 1250000, rate: '30%', tax: (oldTaxableIncome - 1250000) * 0.3 });
oldTax += (1250000 - 1000000) * 0.3;
oldSlabs.push({ range: '₹10,00,001 - ₹12,50,000', amount: 1250000 - 1000000, rate: '30%', tax: (1250000 - 1000000) * 0.3 });
oldTax += (1000000 - 750000) * 0.2;
oldSlabs.push({ range: '₹7,50,001 - ₹10,00,000', amount: 1000000 - 750000, rate: '20%', tax: (1000000 - 750000) * 0.2 });
oldTax += (750000 - 500000) * 0.2;
oldSlabs.push({ range: '₹5,00,001 - ₹7,50,000', amount: 750000 - 500000, rate: '20%', tax: (750000 - 500000) * 0.2 });
oldTax += (500000 - 250000) * 0.05;
oldSlabs.push({ range: '₹2,50,001 - ₹5,00,000', amount: 500000 - 250000, rate: '5%', tax: (500000 - 250000) * 0.05 });
} else if (oldTaxableIncome > 1000000) {
oldTax += (oldTaxableIncome - 1000000) * 0.3;
oldSlabs.push({ range: '₹10,00,001 - ₹12,50,000', amount: oldTaxableIncome - 1000000, rate: '30%', tax: (oldTaxableIncome - 1000000) * 0.3 });
oldTax += (1000000 - 750000) * 0.2;
oldSlabs.push({ range: '₹7,50,001 - ₹10,00,000', amount: 1000000 - 750000, rate: '20%', tax: (1000000 - 750000) * 0.2 });
oldTax += (750000 - 500000) * 0.2;
oldSlabs.push({ range: '₹5,00,001 - ₹7,50,000', amount: 750000 - 500000, rate: '20%', tax: (750000 - 500000) * 0.2 });
oldTax += (500000 - 250000) * 0.05;
oldSlabs.push({ range: '₹2,50,001 - ₹5,00,000', amount: 500000 - 250000, rate: '5%', tax: (500000 - 250000) * 0.05 });
} else if (oldTaxableIncome > 750000) {
oldTax += (oldTaxableIncome - 750000) * 0.2;
oldSlabs.push({ range: '₹7,50,001 - ₹10,00,000', amount: oldTaxableIncome - 750000, rate: '20%', tax: (oldTaxableIncome - 750000) * 0.2 });
oldTax += (750000 - 500000) * 0.2;
oldSlabs.push({ range: '₹5,00,001 - ₹7,50,000', amount: 750000 - 500000, rate: '20%', tax: (750000 - 500000) * 0.2 });
oldTax += (500000 - 250000) * 0.05;
oldSlabs.push({ range: '₹2,50,001 - ₹5,00,000', amount: 500000 - 250000, rate: '5%', tax: (500000 - 250000) * 0.05 });
} else if (oldTaxableIncome > 500000) {
oldTax += (oldTaxableIncome - 500000) * 0.2;
oldSlabs.push({ range: '₹5,00,001 - ₹7,50,000', amount: oldTaxableIncome - 500000, rate: '20%', tax: (oldTaxableIncome - 500000) * 0.2 });
oldTax += (500000 - 250000) * 0.05;
oldSlabs.push({ range: '₹2,50,001 - ₹5,00,000', amount: 500000 - 250000, rate: '5%', tax: (500000 - 250000) * 0.05 });
} else if (oldTaxableIncome > 250000) {
oldTax += (oldTaxableIncome - 250000) * 0.05;
oldSlabs.push({ range: '₹2,50,001 - ₹5,00,000', amount: oldTaxableIncome - 250000, rate: '5%', tax: (oldTaxableIncome - 250000) * 0.05 });
}
// Rebate under section 87A (for income up to 7 lakhs)
if (oldTaxableIncome <= 700000) {
const rebate = Math.min(oldTax, 12500);
oldTax -= rebate;
}
// Surcharge
let oldSurcharge = 0;
if (oldTaxableIncome > 5000000 && oldTaxableIncome <= 10000000) {
oldSurcharge = oldTax * 0.1;
} else if (oldTaxableIncome > 10000000 && oldTaxableIncome <= 20000000) {
oldSurcharge = oldTax * 0.15;
} else if (oldTaxableIncome > 20000000 && oldTaxableIncome <= 50000000) {
oldSurcharge = oldTax * 0.25;
} else if (oldTaxableIncome > 50000000) {
oldSurcharge = oldTax * 0.37;
}
// Health and education cess
const oldCess = (oldTax + oldSurcharge) * 0.04;
// Total tax liability
const oldTotalTax = oldTax + oldSurcharge + oldCess;
// NEW REGIME CALCULATION
// Standard deduction (only for salaried individuals)
const newStandardDeduction = salary > 0 ? 50000 : 0;
const newTaxableIncome = Math.max(0, totalIncome - newStandardDeduction);
// Calculate tax based on new regime slabs
let newTax = 0;
let newSlabs = [];
if (newTaxableIncome > 1500000) {
newTax += (newTaxableIncome - 1500000) * 0.3;
newSlabs.push({ range: 'Above ₹15,00,000', amount: newTaxableIncome - 1500000, rate: '30%', tax: (newTaxableIncome - 1500000) * 0.3 });
newTax += (1500000 - 1250000) * 0.25;
newSlabs.push({ range: '₹12,50,001 - ₹15,00,000', amount: 1500000 - 1250000, rate: '25%', tax: (1500000 - 1250000) * 0.25 });
newTax += (1250000 - 1000000) * 0.2;
newSlabs.push({ range: '₹10,00,001 - ₹12,50,000', amount: 1250000 - 1000000, rate: '20%', tax: (1250000 - 1000000) * 0.2 });
newTax += (1000000 - 750000) * 0.15;
newSlabs.push({ range: '₹7,50,001 - ₹10,00,000', amount: 1000000 - 750000, rate: '15%', tax: (1000000 - 750000) * 0.15 });
newTax += (750000 - 500000) * 0.1;
newSlabs.push({ range: '₹5,00,001 - ₹7,50,000', amount: 750000 - 500000, rate: '10%', tax: (750000 - 500000) * 0.1 });
newTax += (500000 - 250000) * 0.05;
newSlabs.push({ range: '₹2,50,001 - ₹5,00,000', amount: 500000 - 250000, rate: '5%', tax: (500000 - 250000) * 0.05 });
} else if (newTaxableIncome > 1250000) {
newTax += (newTaxableIncome - 1250000) * 0.25;
newSlabs.push({ range: '₹12,50,001 - ₹15,00,000', amount: newTaxableIncome - 1250000, rate: '25%', tax: (newTaxableIncome - 1250000) * 0.25 });
newTax += (1250000 - 1000000) * 0.2;
newSlabs.push({ range: '₹10,00,001 - ₹12,50,000', amount: 1250000 - 1000000, rate: '20%', tax: (1250000 - 1000000) * 0.2 });
newTax += (1000000 - 750000) * 0.15;
newSlabs.push({ range: '₹7,50,001 - ₹10,00,000', amount: 1000000 - 750000, rate: '15%', tax: (1000000 - 750000) * 0.15 });
newTax += (750000 - 500000) * 0.1;
newSlabs.push({ range: '₹5,00,001 - ₹7,50,000', amount: 750000 - 500000, rate: '10%', tax: (750000 - 500000) * 0.1 });
newTax += (500000 - 250000) * 0.05;
newSlabs.push({ range: '₹2,50,001 - ₹5,00,000', amount: 500000 - 250000, rate: '5%', tax: (500000 - 250000) * 0.05 });
} else if (newTaxableIncome > 1000000) {
newTax += (newTaxableIncome - 1000000) * 0.2;
newSlabs.push({ range: '₹10,00,001 - ₹12,50,000', amount: newTaxableIncome - 1000000, rate: '20%', tax: (newTaxableIncome - 1000000) * 0.2 });
newTax += (1000000 - 750000) * 0.15;
newSlabs.push({ range: '₹7,50,001 - ₹10,00,000', amount: 1000000 - 750000, rate: '15%', tax: (1000000 - 750000) * 0.15 });
newTax += (750000 - 500000) * 0.1;
newSlabs.push({ range: '₹5,00,001 - ₹7,50,000', amount: 750000 - 500000, rate: '10%', tax: (750000 - 500000) * 0.1 });
newTax += (500000 - 250000) * 0.05;
newSlabs.push({ range: '₹2,50,001 - ₹5,00,000', amount: 500000 - 250000, rate: '5%', tax: (500000 - 250000) * 0.05 });
} else if (newTaxableIncome > 750000) {
newTax += (newTaxableIncome - 750000) * 0.15;
newSlabs.push({ range: '₹7,50,001 - ₹10,00,000', amount: newTaxableIncome - 750000, rate: '15%', tax: (newTaxableIncome - 750000) * 0.15 });
newTax += (750000 - 500000) * 0.1;
newSlabs.push({ range: '₹5,00,001 - ₹7,50,000', amount: 750000 - 500000, rate: '10%', tax: (750000 - 500000) * 0.1 });
newTax += (500000 - 250000) * 0.05;
newSlabs.push({ range: '₹2,50,001 - ₹5,00,000', amount: 500000 - 250000, rate: '5%', tax: (500000 - 250000) * 0.05 });
} else if (newTaxableIncome > 500000) {
newTax += (newTaxableIncome - 500000) * 0.1;
newSlabs.push({ range: '₹5,00,001 - ₹7,50,000', amount: newTaxableIncome - 500000, rate: '10%', tax: (newTaxableIncome - 500000) * 0.1 });
newTax += (500000 - 250000) * 0.05;
newSlabs.push({ range: '₹2,50,001 - ₹5,00,000', amount: 500000 - 250000, rate: '5%', tax: (500000 - 250000) * 0.5 });
} else if (newTaxableIncome > 250000) {
newTax += (newTaxableIncome - 250000) * 0.05;
newSlabs.push({ range: '₹2,50,001 - ₹5,00,000', amount: newTaxableIncome - 250000, rate: '5%', tax: (newTaxableIncome - 250000) * 0.05 });
}
// Rebate under section 87A (for income up to 7 lakhs)
if (newTaxableIncome <= 700000) {
const rebate = Math.min(newTax, 12500);
newTax -= rebate;
}
// Surcharge
let newSurcharge = 0;
if (newTaxableIncome > 5000000 && newTaxableIncome <= 10000000) {
newSurcharge = newTax * 0.1;
} else if (newTaxableIncome > 10000000 && newTaxableIncome <= 20000000) {
newSurcharge = newTax * 0.15;
} else if (newTaxableIncome > 20000000 && newTaxableIncome <= 50000000) {
newSurcharge = newTax * 0.25;
} else if (newTaxableIncome > 50000000) {
newSurcharge = newTax * 0.37;
}
// Health and education cess
const newCess = (newTax + newSurcharge) * 0.04;
// Total tax liability
const newTotalTax = newTax + newSurcharge + newCess;
// Determine which regime is better
const recommendation = oldTotalTax < newTotalTax ?
"Based on your income and deductions, the old regime appears more beneficial." :
"Based on your income and deductions, the new regime appears more beneficial.";
// Store results
taxData.results = {
oldRegime: {
totalIncome,
totalDeductions,
taxableIncome: oldTaxableIncome,
incomeTax: oldTax,
surcharge: oldSurcharge,
cess: oldCess,
totalTax: oldTotalTax,
slabs: oldSlabs
},
newRegime: {
totalIncome,
standardDeduction: newStandardDeduction,
taxableIncome: newTaxableIncome,
incomeTax: newTax,
surcharge: newSurcharge,
cess: newCess,
totalTax: newTotalTax,
slabs: newSlabs
},
recommendation
};
// Update UI with results
updateResultsUI();
}
// Update results UI
function updateResultsUI() {
const { oldRegime, newRegime, recommendation } = taxData.results;
// Format currency
const formatCurrency = (amount) => {
return new Intl.NumberFormat('en-IN', { style: 'currency', currency: 'INR', maximumFractionDigits: 0 }).format(amount).replace('₹', '₹');
};
// Old regime
document.getElementById('old-total-income').textContent = formatCurrency(oldRegime.totalIncome);
document.getElementById('old-total-deductions').textContent = formatCurrency(oldRegime.totalDeductions);
document.getElementById('old-taxable-income').textContent = formatCurrency(oldRegime.taxableIncome);
document.getElementById('old-income-tax').textContent = formatCurrency(oldRegime.incomeTax);
document.getElementById('old-surcharge').textContent = formatCurrency(oldRegime.surcharge);
document.getElementById('old-cess').textContent = formatCurrency(oldRegime.cess);
document.getElementById('old-total-tax').textContent = formatCurrency(oldRegime.totalTax);
// New regime
document.getElementById('new-total-income').textContent = formatCurrency(newRegime.totalIncome);
document.getElementById('new-standard-deduction').textContent = formatCurrency(newRegime.standardDeduction);
document.getElementById('new-taxable-income').textContent = formatCurrency(newRegime.taxableIncome);
document.getElementById('new-income-tax').textContent = formatCurrency(newRegime.incomeTax);
document.getElementById('new-surcharge').textContent = formatCurrency(newRegime.surcharge);
document.getElementById('new-cess').textContent = formatCurrency(newRegime.cess);
document.getElementById('new-total-tax').textContent = formatCurrency(newRegime.totalTax);
// Recommendation
document.getElementById('regime-recommendation').textContent = recommendation;
}
// Regime toggle
document.getElementById('regime-toggle').addEventListener('change', function() {
const oldRegimeResults = document.getElementById('old-regime-results');
const newRegimeResults = document.getElementById('new-regime-results');
const regimeLabel = document.getElementById('regime-label');
if (this.checked) {
oldRegimeResults.classList.add('opacity-50');
newRegimeResults.classList.remove('opacity-50');
regimeLabel.textContent = 'New Regime';
// Update the active tab indicator
oldRegimeResults.querySelector('h4').classList.remove('text-gray-800');
oldRegimeResults.querySelector('h4').classList.add('text-gray-600');
newRegimeResults.querySelector('h4').classList.remove('text-gray-600');
newRegimeResults.querySelector('h4').classList.add('text-gray-800');
// Update the dot color
oldRegimeResults.querySelector('.w-3').classList.remove('bg-indigo-500');
oldRegimeResults.querySelector('.w-3').classList.add('bg-gray-400');
newRegimeResults.querySelector('.w-3').classList.remove('bg-gray-400');
newRegimeResults.querySelector('.w-3').classList.add('bg-indigo-500');
} else {
oldRegimeResults.classList.remove('opacity-50');
newRegimeResults.classList.add('opacity-50');
regimeLabel.textContent = 'Old Regime';
// Update the active tab indicator
oldRegimeResults.querySelector('h4').classList.remove('text-gray-600');
oldRegimeResults.querySelector('h4').classList.add('text-gray-800');
newRegimeResults.querySelector('h4').classList.remove('text-gray-800');
newRegimeResults.querySelector('h4').classList.add('text-gray-600');
// Update the dot color
oldRegimeResults.querySelector('.w-3').classList.remove('bg-gray-400');
oldRegimeResults.querySelector('.w-3').classList.add('bg-indigo-500');
newRegimeResults.querySelector('.w-3').classList.remove('bg-indigo-500');
newRegimeResults.querySelector('.w-3').classList.add('bg-gray-400');
}
});
// Save data to localStorage
document.getElementById('save-data').addEventListener('click', function() {
// Check if PAN already exists
const existingIndex = savedRecords.findIndex(record => record.personal.pan === taxData.personal.pan);
if (existingIndex !== -1) {
// Update existing record
savedRecords[existingIndex] = taxData;
} else {
// Add new record
savedRecords.push(taxData);
}
// Save to localStorage
localStorage.setItem('taxRecords', JSON.stringify(savedRecords));
alert('Your tax data has been saved successfully!');
});
// Export to Excel
document.getElementById('export-excel').addEventListener('click', function() {
// Create a worksheet
const ws = XLSX.utils.json_to_sheet([
{
'Name': taxData.personal.name,
'PAN': taxData.personal.pan,
'Age': taxData.personal.age,
'Gender': taxData.personal.gender,
'Salary Income': taxData.income.salary,
'House Property Income': taxData.income.rental,
'Capital Gains': taxData.income.capitalGains,
'Business Income': taxData.income.business,
'Other Income': taxData.income.otherIncome,
'Total Income': taxData.results.oldRegime.totalIncome,
'Total Deductions (Old Regime)': taxData.results.oldRegime.totalDeductions,
'Taxable Income (Old Regime)': taxData.results.oldRegime.taxableIncome,
'Tax Liability (Old Regime)': taxData.results.oldRegime.totalTax,
'Standard Deduction (New Regime)': taxData.results.newRegime.standardDeduction,
'Taxable Income (New Regime)': taxData.results.newRegime.taxableIncome,
'Tax Liability (New Regime)': taxData.results.newRegime.totalTax,
'Recommended Regime': taxData.results.oldRegime.totalTax < taxData.results.newRegime.totalTax ? 'Old Regime' : 'New Regime'
}
]);
// Create a workbook
const wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, "Tax Data");
// Export the workbook
XLSX.writeFile(wb, `Tax_Calculation_${taxData.personal.pan}.xlsx`);
});
// Search functionality
document.getElementById('search-by-pan').addEventListener('click', function() {
const pan = document.getElementById('search-pan').value.trim().toUpperCase();
if (!pan) {
alert('Please enter a PAN number to search');
return;
}
if (!/^[A-Z]{5}[0-9]{4}[A-Z]{1}$/.test(pan)) {
alert('Please enter a valid PAN number');
return;
}
searchRecords('pan', pan);
});
document.getElementById('search-by-name').addEventListener('click', function() {
const name = document.getElementById('search-name').value.trim();
if (!name) {
alert('Please enter a name to search');
return;
}
searchRecords('name', name);
});
// Search records function
function searchRecords(field, value) {
const results = savedRecords.filter(record => {
if (field === 'pan') {
return record.personal.pan === value;
} else {
return record.personal.name.toLowerCase().includes(value.toLowerCase());
}
});
if (results.length === 0) {
alert('No records found matching your search criteria');
return;
}
// Display results
displaySearchResults(results);
}
// Display search results
function displaySearchResults(results) {
const resultsTableBody = document.getElementById('results-table-body');
resultsTableBody.innerHTML = '';
const formatCurrency = (amount) => {
return new Intl.NumberFormat('en-IN', { style: 'currency', currency: 'INR', maximumFractionDigits: 0 }).format(amount).replace('₹', '₹');
};
results.forEach(record => {
const row = document.createElement('tr');
row.innerHTML = `
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">${record.personal.name}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${record.personal.pan}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${record.personal.age}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${record.personal.gender.charAt(0).toUpperCase() + record.personal.gender.slice(1)}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${formatCurrency(record.results.oldRegime.totalIncome)}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${formatCurrency(record.results.oldRegime.totalTax)}</td>
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${formatCurrency(record.results.newRegime.totalTax)}</td>
`;
resultsTableBody.appendChild(row);
});
document.getElementById('search-results').classList.remove('hidden');
}
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Amujeeb/myspace" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |