Spaces:
Running
Running
File size: 27,812 Bytes
20cc475 | 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 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Iraq Salary & Tax Calculator</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
:root {
--primary: #1a3a6c;
--secondary: #2c5282;
--accent: #e74c3c;
--light: #f0f7ff;
--dark: #1a202c;
--success: #38a169;
--warning: #ecc94b;
--gray: #718096;
--info: #4299e1;
}
body {
background: linear-gradient(135deg, #1a3a6c, #2c5282);
color: var(--dark);
min-height: 100vh;
padding: 20px;
}
.container {
max-width: 1200px;
margin: 0 auto;
}
header {
text-align: center;
padding: 30px 0;
color: white;
}
header h1 {
font-size: 2.5rem;
margin-bottom: 10px;
display: flex;
align-items: center;
justify-content: center;
gap: 15px;
}
header p {
font-size: 1.1rem;
max-width: 700px;
margin: 0 auto;
opacity: 0.9;
line-height: 1.6;
}
.calculator-container {
display: flex;
flex-wrap: wrap;
gap: 25px;
margin-top: 20px;
}
.input-section {
background: white;
border-radius: 15px;
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
padding: 30px;
flex: 1;
min-width: 300px;
}
.result-section {
background: white;
border-radius: 15px;
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
padding: 30px;
flex: 1;
min-width: 300px;
display: flex;
flex-direction: column;
}
.section-title {
font-size: 1.5rem;
color: var(--primary);
margin-bottom: 25px;
padding-bottom: 10px;
border-bottom: 2px solid var(--primary);
display: flex;
align-items: center;
gap: 10px;
}
.section-title i {
background: var(--primary);
color: white;
width: 36px;
height: 36px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.form-group {
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 8px;
font-weight: 600;
color: var(--secondary);
font-size: 0.95rem;
}
input, select {
width: 100%;
padding: 12px;
border: 2px solid #e2e8f0;
border-radius: 8px;
font-size: 1rem;
transition: all 0.3s;
}
input:focus, select:focus {
outline: none;
border-color: var(--primary);
box-shadow: 0 0 0 3px rgba(26, 58, 108, 0.2);
}
.region-toggle {
display: flex;
gap: 12px;
margin-bottom: 25px;
}
.region-btn {
flex: 1;
padding: 14px;
background: #edf2f7;
border: none;
border-radius: 8px;
font-size: 0.95rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
text-align: center;
}
.region-btn.active {
background: var(--primary);
color: white;
}
.calculate-btn {
width: 100%;
padding: 15px;
background: var(--accent);
color: white;
border: none;
border-radius: 8px;
font-size: 1.1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s;
margin-top: 10px;
box-shadow: 0 4px 6px rgba(231, 76, 60, 0.3);
}
.calculate-btn:hover {
background: #c0392b;
transform: translateY(-2px);
}
.result-item {
display: flex;
justify-content: space-between;
padding: 14px 0;
border-bottom: 1px solid #e2e8f0;
}
.result-item:last-child {
border-bottom: none;
}
.result-label {
font-weight: 600;
color: var(--secondary);
font-size: 0.95rem;
}
.result-value {
font-weight: 700;
color: var(--primary);
font-size: 1rem;
}
.highlight {
background: var(--light);
padding: 12px 15px;
border-radius: 8px;
margin: 5px 0;
border-left: 4px solid var(--accent);
}
.net-salary {
background: var(--success);
color: white;
padding: 22px;
border-radius: 10px;
margin-top: auto;
text-align: center;
}
.net-salary .label {
font-size: 1.2rem;
margin-bottom: 10px;
}
.net-salary .value {
font-size: 2.2rem;
font-weight: 700;
}
.allowances-section {
background: #f7fafc;
border-radius: 8px;
padding: 15px;
margin: 15px 0;
border: 1px solid #e2e8f0;
}
.allowance-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10px;
}
.add-allowance-btn {
background: var(--primary);
color: white;
border: none;
border-radius: 6px;
padding: 7px 14px;
cursor: pointer;
font-weight: 600;
transition: all 0.3s;
font-size: 0.9rem;
}
.add-allowance-btn:hover {
background: var(--secondary);
}
.allowance-item {
display: flex;
gap: 10px;
margin-bottom: 10px;
align-items: center;
}
.allowance-item input {
flex: 1;
}
.allowance-item select {
flex: 1.5;
}
.remove-allowance {
background: #e53e3e;
color: white;
border: none;
border-radius: 50%;
width: 28px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
font-size: 0.9rem;
}
.min-sos {
font-size: 0.8rem;
color: #e53e3e;
margin-top: 3px;
display: block;
}
.info-box {
background: var(--light);
border-radius: 10px;
padding: 20px;
margin-top: 30px;
}
.info-box h3 {
color: var(--primary);
margin-bottom: 15px;
display: flex;
align-items: center;
gap: 10px;
font-size: 1.3rem;
}
.info-box ul {
padding-left: 20px;
}
.info-box li {
margin-bottom: 10px;
line-height: 1.5;
font-size: 0.95rem;
}
.note-box {
background: #f0f7ff;
border-left: 4px solid var(--primary);
padding: 12px;
border-radius: 4px;
margin-top: 15px;
font-size: 0.9rem;
}
@media (max-width: 768px) {
.calculator-container {
flex-direction: column;
}
header h1 {
font-size: 2rem;
}
.allowance-item {
flex-direction: column;
align-items: stretch;
}
}
</style>
</head>
<body>
<div class="container">
<header>
<h1><i class="fas fa-calculator"></i> Iraq Salary & Tax Calculator</h1>
<p>Calculate your net salary after taxes and social security contributions for all regions of Iraq</p>
</header>
<div class="calculator-container">
<div class="input-section">
<h2 class="section-title"><i class="fas fa-edit"></i> Salary Information</h2>
<div class="region-toggle">
<button class="region-btn active" data-region="iraq">South/Central Iraq</button>
<button class="region-btn" data-region="kri">Kurdistan Region (KRI)</button>
</div>
<div class="form-group">
<label for="baseSalary">Total Base Salary (IQD)</label>
<input type="number" id="baseSalary" placeholder="Enter monthly base salary" value="2500000">
</div>
<div id="iraqInputs">
<div class="form-group">
<label for="maritalStatus">Marital Status</label>
<select id="maritalStatus">
<option value="single">Single</option>
<option value="married">Married</option>
<option value="married1">Married + 1 Child</option>
<option value="married2" selected>Married + 2 Children</option>
<option value="married3">Married + 3 Children</option>
<option value="married4">Married + 4 Children</option>
<option value="divorced">Divorced/Widowed</option>
<option value="divorced1">Divorced/Widowed + 1 Child</option>
<option value="divorced2">Divorced/Widowed + 2 Children</option>
</select>
</div>
</div>
<div class="allowances-section">
<div class="allowance-header">
<h3><i class="fas fa-plus-circle"></i> Monthly Allowances</h3>
<button class="add-allowance-btn" id="addAllowanceBtn">
<i class="fas fa-plus"></i> Add
</button>
</div>
<div id="allowancesContainer">
<div class="allowance-item">
<select class="allowance-type">
<option value="food">Food Allowance</option>
<option value="transport">Transportation</option>
<option value="housing">Housing</option>
<option value="incentive">Incentive/Commissions</option>
<option value="other">Other</option>
</select>
<input type="number" class="allowance-amount" placeholder="Amount" value="200000">
<button class="remove-allowance"><i class="fas fa-times"></i></button>
</div>
</div>
</div>
<button class="calculate-btn" id="calculateBtn">
<i class="fas fa-calculator"></i> Calculate Net Salary
</button>
</div>
<div class="result-section">
<h2 class="section-title"><i class="fas fa-chart-bar"></i> Salary Summary</h2>
<div class="result-item">
<span class="result-label">Base Salary</span>
<span class="result-value" id="baseSalaryResult">2,500,000 IQD</span>
</div>
<div class="result-item">
<span class="result-label">Total Allowances</span>
<span class="result-value" id="totalAllowances">200,000 IQD</span>
</div>
<div class="highlight">
<div class="result-item">
<span class="result-label">Total Income</span>
<span class="result-value" id="totalIncome">2,700,000 IQD</span>
</div>
</div>
<h3 style="margin: 20px 0 10px; color: var(--accent);">Deductions</h3>
<div class="result-item">
<span class="result-label" id="sosLabel">Social Security (SOS)</span>
<span class="result-value" id="sos">125,000 IQD</span>
</div>
<div class="min-sos" id="sosMinNote"></div>
<div class="result-item">
<span class="result-label">Taxable Amount</span>
<span class="result-value" id="taxableAmount">1,050,000 IQD</span>
</div>
<div class="result-item">
<span class="result-label">Income Tax</span>
<span class="result-value" id="incomeTax">125,000 IQD</span>
</div>
<div class="highlight">
<div class="result-item">
<span class="result-label">Total Deductions</span>
<span class="result-value" id="totalDeductions">250,000 IQD</span>
</div>
</div>
<div class="net-salary">
<div class="label">Your Net Salary</div>
<div class="value" id="netSalary">2,450,000 IQD</div>
</div>
<div class="note-box">
<i class="fas fa-info-circle"></i> Social Security minimums:
<ul style="margin-top: 8px; padding-left: 20px;">
<li>South/Central Iraq: 350,000 IQD/year (29,167 IQD/month)</li>
<li>Kurdistan Region: 450,000 IQD/year (37,500 IQD/month)</li>
</ul>
</div>
</div>
</div>
<div class="info-box">
<h3><i class="fas fa-info-circle"></i> How It Works</h3>
<ul>
<li><strong>Total Base Salary</strong> is your core monthly salary before any allowances</li>
<li><strong>Social Security (SOS)</strong> is calculated as:
<ul>
<li>5% of Total Base Salary for South/Central Iraq (min 29,167 IQD/month)</li>
<li>5% of (Total Base Salary/1.3) for Kurdistan Region (min 37,500 IQD/month)</li>
</ul>
</li>
<li><strong>Taxable Amount</strong> is calculated after deducting SOS and non-taxable portions</li>
<li><strong>Income Tax</strong> uses progressive brackets (3%, 5%, 10%, 15%) for South/Central Iraq and a flat 5% for KRI</li>
<li>All <strong>Monthly Allowances</strong> are added to your total income and are fully taxable</li>
</ul>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
const regionBtns = document.querySelectorAll('.region-btn');
const iraqInputs = document.getElementById('iraqInputs');
const calculateBtn = document.getElementById('calculateBtn');
const addAllowanceBtn = document.getElementById('addAllowanceBtn');
const allowancesContainer = document.getElementById('allowancesContainer');
const sosLabel = document.getElementById('sosLabel');
const sosMinNote = document.getElementById('sosMinNote');
// Set initial region
sosLabel.textContent = 'Social Security (5% of base)';
// Region toggle functionality
regionBtns.forEach(btn => {
btn.addEventListener('click', function() {
regionBtns.forEach(b => b.classList.remove('active'));
this.classList.add('active');
if (this.dataset.region === 'iraq') {
iraqInputs.style.display = 'block';
sosLabel.textContent = 'Social Security (5% of base)';
} else {
iraqInputs.style.display = 'none';
sosLabel.textContent = 'Social Security (5% of base/1.3)';
}
calculateSalary();
});
});
// Add allowance functionality
addAllowanceBtn.addEventListener('click', function() {
const allowanceItem = document.createElement('div');
allowanceItem.className = 'allowance-item';
allowanceItem.innerHTML = `
<select class="allowance-type">
<option value="food">Food Allowance</option>
<option value="transport">Transportation</option>
<option value="housing">Housing</option>
<option value="incentive">Incentive/Commissions</option>
<option value="other">Other</option>
</select>
<input type="number" class="allowance-amount" placeholder="Amount">
<button class="remove-allowance"><i class="fas fa-times"></i></button>
`;
allowancesContainer.appendChild(allowanceItem);
// Add event listener to the new remove button
allowanceItem.querySelector('.remove-allowance').addEventListener('click', function() {
allowanceItem.remove();
calculateSalary();
});
// Add event listener to the new inputs
allowanceItem.querySelectorAll('input, select').forEach(input => {
input.addEventListener('input', calculateSalary);
});
});
// Add event listeners to existing remove buttons
document.querySelectorAll('.remove-allowance').forEach(btn => {
btn.addEventListener('click', function() {
this.closest('.allowance-item').remove();
calculateSalary();
});
});
// Set up event listeners for inputs
const inputs = document.querySelectorAll('input, select');
inputs.forEach(input => {
input.addEventListener('input', calculateSalary);
});
// Calculation function
function calculateSalary() {
const isIraq = document.querySelector('.region-btn.active').dataset.region === 'iraq';
const baseSalary = parseFloat(document.getElementById('baseSalary').value) || 0;
// Calculate total allowances
let totalAllowances = 0;
document.querySelectorAll('.allowance-item').forEach(item => {
const amount = parseFloat(item.querySelector('.allowance-amount').value) || 0;
totalAllowances += amount;
});
// Calculate total income
const totalIncome = baseSalary + totalAllowances;
if (isIraq) {
calculateIraqSalary(baseSalary, totalAllowances, totalIncome);
} else {
calculateKriSalary(baseSalary, totalAllowances, totalIncome);
}
}
function calculateIraqSalary(baseSalary, totalAllowances, totalIncome) {
const maritalStatus = document.getElementById('maritalStatus').value;
// Calculate SOS (5% of base, min 29,167 IQD/month)
const calculatedSos = baseSalary * 0.05;
const minSosIraq = 350000 / 12; // 29,167 IQD/month
const sos = Math.max(calculatedSos, minSosIraq);
// Non-taxable portion (30% of base)
const nonTaxablePortion = baseSalary * 0.3;
// Calculate taxable amount
let taxableAmount = totalIncome - nonTaxablePortion - sos;
// Apply marital status deductions
const maritalDeductions = {
single: 2500000 / 12,
married: 4500000 / 12,
married1: (4500000 + 200000) / 12,
married2: (4500000 + 400000) / 12,
married3: (4500000 + 600000) / 12,
married4: (4500000 + 800000) / 12,
divorced: 3200000 / 12,
divorced1: (3200000 + 200000) / 12,
divorced2: (3200000 + 400000) / 12
};
const maritalDeduction = maritalDeductions[maritalStatus] || 0;
taxableAmount -= maritalDeduction;
if (taxableAmount < 0) taxableAmount = 0;
// Apply tax brackets
let incomeTax = 0;
// Tax brackets (monthly)
const brackets = [
{ limit: 250000 / 12, rate: 0.03 },
{ limit: 500000 / 12, rate: 0.05 },
{ limit: 1000000 / 12, rate: 0.10 },
{ rate: 0.15 } // Above 1,000,000 IQD
];
let remaining = taxableAmount;
let prevLimit = 0;
for (let i = 0; i < brackets.length; i++) {
if (remaining <= 0) break;
const bracket = brackets[i];
let taxableInBracket = 0;
if (bracket.limit) {
if (remaining > (bracket.limit - prevLimit)) {
taxableInBracket = bracket.limit - prevLimit;
remaining -= taxableInBracket;
} else {
taxableInBracket = remaining;
remaining = 0;
}
} else {
// Last bracket (no upper limit)
taxableInBracket = remaining;
remaining = 0;
}
incomeTax += taxableInBracket * bracket.rate;
prevLimit = bracket.limit || 0;
}
// Calculate net salary
const totalDeductions = sos + incomeTax;
const netSalary = totalIncome - totalDeductions;
// Update UI
updateResults(baseSalary, totalAllowances, totalIncome, sos, taxableAmount,
incomeTax, totalDeductions, netSalary);
// Update SOS note
if (calculatedSos < minSosIraq) {
sosMinNote.textContent = `Applied minimum: ${formatCurrency(minSosIraq)}/month`;
sosMinNote.style.display = 'block';
} else {
sosMinNote.style.display = 'none';
}
}
function calculateKriSalary(baseSalary, totalAllowances, totalIncome) {
// Calculate base for KRI (gross/1.3)
const kriBase = baseSalary / 1.3;
// Calculate SOS (5% of kriBase, min 37,500 IQD/month)
const calculatedSos = kriBase * 0.05;
const minSosKri = 450000 / 12; // 37,500 IQD/month
const sos = Math.max(calculatedSos, minSosKri);
// Calculate taxable amount (base - 1,000,000 + allowances)
let taxableAmount = Math.max(0, kriBase - 1000000) + totalAllowances;
// Calculate income tax (5% of taxable amount)
const incomeTax = taxableAmount * 0.05;
// Calculate net salary
const totalDeductions = sos + incomeTax;
const netSalary = totalIncome - totalDeductions;
// Update UI
updateResults(baseSalary, totalAllowances, totalIncome, sos, taxableAmount,
incomeTax, totalDeductions, netSalary);
// Update SOS note
if (calculatedSos < minSosKri) {
sosMinNote.textContent = `Applied minimum: ${formatCurrency(minSosKri)}/month`;
sosMinNote.style.display = 'block';
} else {
sosMinNote.style.display = 'none';
}
}
function updateResults(baseSalary, totalAllowances, totalIncome, sos,
taxableAmount, incomeTax, totalDeductions, netSalary) {
document.getElementById('baseSalaryResult').textContent = formatCurrency(baseSalary);
document.getElementById('totalAllowances').textContent = formatCurrency(totalAllowances);
document.getElementById('totalIncome').textContent = formatCurrency(totalIncome);
document.getElementById('sos').textContent = formatCurrency(sos);
document.getElementById('taxableAmount').textContent = formatCurrency(taxableAmount);
document.getElementById('incomeTax').textContent = formatCurrency(incomeTax);
document.getElementById('totalDeductions').textContent = formatCurrency(totalDeductions);
document.getElementById('netSalary').textContent = formatCurrency(netSalary);
}
function formatCurrency(amount) {
return new Intl.NumberFormat('en-IQ', {
style: 'currency',
currency: 'IQD',
maximumFractionDigits: 0
}).format(amount);
}
// Set up calculate button
calculateBtn.addEventListener('click', calculateSalary);
// Initial calculation
calculateSalary();
});
</script>
</body>
</html> |