---
name: pph21-calculator
description: Calculate Indonesian monthly income tax (PPh Pasal 21) based on the TER (Tarif Efektif Rata-Rata) per PP 58/2023 and PMK 168/2023, supporting December Annual Reconciliation.
argument-hint: "<gross_salary> <ptkp_status> <has_npwp> [is_december] [jan_nov_withheld]"
risk_level: HIGH
rule_type: statutory
---

# PPh 21 TER Hybrid Tax Calculator

A hybrid precision engine for calculating employee PPh 21 monthly taxes (Jan-Nov) and December annual reconciliation.

## Statutory Provenance
* **Primary Regulation**: Peraturan Pemerintah (PP) No. 58 Tahun 2023 & Peraturan Menteri Keuangan (PMK) No. 168 Tahun 2023.
* **Effective Date**: January 1, 2024.
* **Authority**: Direktorat Jenderal Pajak (DJP), Kementerian Keuangan RI.

## Execution Model (Hybrid Engine)
Do not perform mathematical computations using the probabilistic LLM. Instead, extract parameters and feed them to the deterministic engine (`engines/pph21-calculator.js`).

### 1. Monthly Withholding (Jan-Nov)
* Match PTKP to TER Category:
  * **Category A**: TK/0 (54M), TK/1 (58.5M), K/0 (58.5M).
  * **Category B**: TK/2 (63M), TK/3 (67.5M), K/1 (63M), K/2 (67.5M).
  * **Category C**: K/3 (72M).
* Multiply gross monthly salary by matched bracket rate.
* Apply 20% penalty if `hasNpwp` is `false` or NIK is not validated.

### 2. December Annual Reconciliation (Masa Pajak Terakhir)
* Determine PTKP threshold deduction.
* Deduct Biaya Jabatan (5% of gross, capped at Rp 500.000/month or Rp 6.000.000/year).
* Deduct employee BPJS JHT (2%) and JP (1%).
* Compute progressive Article 17 progressive tax on Net Taxable Income (PKP):
  * Up to Rp 60M: 5%
  * > Rp 60M to Rp 250M: 15%
  * > Rp 250M to Rp 500M: 25%
  * > Rp 500M to Rp 5B: 30%
  * Above Rp 5B: 35%
* Subtract tax already withheld during Jan-Nov to yield December tax.

## Standardized Output Schema
Ensure output matches the following structure:
```markdown
### PPh 21 Tax Calculation Report

#### Parameter Summary
* **Monthly Gross Salary / Annual**: Rp [Amount]
* **PTKP Status**: [Status]
* **Identity Validation**: [validated_nik_npwp / unvalidated] (Penalty applied: [Yes/No])

#### Calculation Details
* **Tax Period**: [Jan-Nov / December Reconciliation]
* **Tax Withheld**: Rp [Amount]
* **Regulatory Authority**: DJP RI
```

## Trust Envelope (Confidence Contract)
Every engine output must be wrapped in a structured envelope declaring production trust attributes:
* **`regulatory_framework`**: Applying regulation with article references (e.g. `PP No. 58/2023 jo. PMK 168/2023 - TER`).
* **`ruleset_version`**: Versioned Id of the `engines/rules/*.json` ruleset consulted (e.g. `PPH21-2024 v1.0.0`).
* **`effective_window`**: `[effective_from] – [effective_to]` of the applied ruleset.
* **`integrity_status`**: `VERIFIED` after SHA-256 ruleset check, or `UNVERIFIED` — never present silent calculations when UNVERIFIED.
* **`risk_level`**: Contextual `LOW / MEDIUM / HIGH` per skill risk metadata.
* **`requires_human_review`**: `true` for HIGH risk outputs — mandatory professional sign-off before filing, payment, or execution.
* **`currency`**: IDR, rounded to the nearest whole Rupiah unless another precision is stated.
* **`as_of`**: The simulation/effective date used to select the ruleset.
