npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

payroll-calculator

v0.1.2

Published

A comprehensive payroll calculator library to support Hihono projects.

Downloads

2

Readme

Payroll Calculator

A comprehensive payroll calculator library to support Hihono projects.

Getting Started

npm install payroll-calculator

How to use

Test case diambil dari Buku PPh 21-26 DJP Contoh: Penghitungan PPh Pasal 21 atas Pegawai Tetap Yang Menerima/Memperoleh Penghasilan Dalam Satu Tahun Pajak (Halaman: 62-64)

import PayrollCalculator from "payroll-calculator";

// Simulasi setahun Tuan A:
// Berdasarkan status Penghasilan Tidak Kena Pajak Tuan A (K/0)
// 1. Tuan A Menerima Gaji sebesar 10.000.000 dan Tunjangan Tetap 20.000.000 setiap bulannya
// 2. Tuan A mendapatkan uang lembur sebesar 5.000.000 pada bulan Februari dan Mei 2024
// 3. Tuan A mendapatkan Bonus sebesar 20.000.000 pada bulan juli
// 4. Tuan A mendapatkan THR sebesar 60.000.000 pada bulan desember
const yearIncomes = [];
const monthPeriod = 12;

const annually = {
	gross: 0,
	jkk: 0,
	jkm: 0,
	bonus: 0,
	THR: 0,
	pph21Paid: 0,
};
for (let month = 1; month <= monthPeriod; month++) {
	const calculator = new PayrollCalculator();
	// init State and Company Provisions
	calculator.Provisions.company.BPJSTKEmpTaxable = true; // BPJS TK Ditanggung karyawan
	calculator.Provisions.company.JKM = true;
	calculator.Provisions.company.JKK = true;
	calculator.Provisions.company.jkkRiskGrade = 0.5; // custom jkk risk grade
	// Use customBPJSTK
	calculator.Employee.earnings.bpjsKetenagakerjaanBase = 10000000;

	// init employee
	calculator.Employee.name = "Tuan A";
	calculator.Employee.ptkpStatus = "K/0";
	calculator.Employee.hasNPWP = true;
	calculator.Employee.permanentStatus = true;
	calculator.Employee.yearPeriod = 2024;
	calculator.Employee.monthPeriod = month;

	calculator.Employee.earnings.base = 10000000;
	calculator.Employee.earnings.baseBeforeProrate = 10000000;
	calculator.Employee.components.allowances.set("Tunjangan Jabatan", 20000000);
	if ([2, 5].includes(month)) {
		calculator.Employee.components.allowances.set("Uang Lembur", 5000000);
	}

	if (month === 7) {
		calculator.Employee.onetime.bonus = 20000000;
	}

	if (month === monthPeriod) {
		calculator.Employee.onetime.holidayAllowance = 60000000;

		// Set Last Tax Period
		calculator.Employee.lastTaxPeriod.annualGross = annually.gross;
		calculator.Employee.lastTaxPeriod.annualBonus = annually.bonus;
		calculator.Employee.lastTaxPeriod.annualHolidayAllowance = annually.THR;
		calculator.Employee.lastTaxPeriod.annualPPh21Paid = annually.pph21Paid;
		calculator.Employee.lastTaxPeriod.annualJIPEmployee = 1200000; // dibayar sendiri
		calculator.Employee.lastTaxPeriod.annualZakat = 2400000; // dibayar sendiri
	}
	const result = calculator.getCalculation();

	if (result) {
		const items = {
			month: new Date(2024, month - 1, 1).toLocaleDateString("id-ID", {
				month: "long",
			}),
			base: result.earnings.base,
			allowance: calculator.Employee.components.allowances.sum(),
			holidayAllowance: calculator.Employee.onetime.holidayAllowance,
			bonus: calculator.Employee.onetime.bonus,
			premi: { JKK: result?.company?.JKK, JKM: result?.company?.JKM },
			gross: result?.earnings.monthly.gross,
			terCategory: result?.taxable?.pph?.ter?.category,
			pph21: result?.taxable?.pph?.liability?.monthly,
		};
		yearIncomes.push(items);

		annually.gross +=
			items.base + items.allowance + items.premi.JKK + items.premi.JKM;
		annually.jkk += result.company.JKK;
		annually.jkm += result.company.JKM;
		annually.bonus += calculator.Employee.onetime.bonus;
		annually.THR += calculator.Employee.onetime.holidayAllowance;
		annually.pph21Paid += result?.taxable?.pph?.liability?.monthly;
	}
}

console.log("yearIncomes Tuan A Pada PT.Z");
console.table(yearIncomes);