Skip to main content

Lightweight Python library for payroll and salary slip generation

Project description

Zwutils Payroll Library

A lightweight Python library to generate payrolls and salary slips, calculate deductions (NSSA, PAYE, AIDS Levy), earnings, and tax credits. Includes PDF generation using customizable HTML templates. Example : https://github.com/munyaradzichirove/zimutils/blob/main/images/salary%20_slip.png

Features

  • Add employee earnings, deductions, and tax credits.
  • Automatic calculation of NSSA, PAYE, and AIDS Levy.
  • Handles allowable deductions and taxable earnings.
  • Generates professional salary slip PDFs using HTML templates.
  • Dynamic company logos in PDFs.
  • Supports multiple currencies.

Installation

pip install zwutils

⚡ Note: This library installs WeasyPrint for PDF generation. Installation may take a few minutes.

## USAGE


from zwutils.payroll import Payroll
from zwutils.pdf import generate_payslip_pdf

# Create payroll
salary_slip = Payroll(
    employee_id="EMP-232377",
    first_name="xxxxxxxxxxxx", 
    last_name="xxxxxxxxxx",
    company="XXXXXXXXXXX",
    company_address="xxxxxxxxxxx",
    company_phone="+263 78 610 3016",
    company_email="xxxxxxxxx",
    department="IT",
    designation="Employee",
    period="December 2025",
    currency="USD",
    total_leave_days=11,
    leave_days_taken=3,
    date_of_joining="12/03/2025",
    logo_path="logo.webp"
)
# Earnings
salary_slip.add_earning(name="Basic Salary",amount=500,track_nssa=True,is_taxable=True)
salary_slip.add_earning(name="Bonus",amount=200,track_nssa=False)
salary_slip.add_earning(name="Transport Allowance",amount= 50)

# Tax Credits
salary_slip.add_credits(name="Blind",amount= 50)

# Deductions
salary_slip.add_deduction(name="Fuel", amount=120)
salary_slip.add_deduction(name="NSSA")
salary_slip.add_deduction(name="PAYE")
salary_slip.add_deduction(name="ZIBAWU",is_allowable_deduction=True, percentage=2)
salary_slip.add_deduction(name="UFAWUZ", is_allowable_deduction=True, percentage=3)
salary_slip.add_deduction(name="LAPF", is_allowable_deduction=True, percentage=6)
salary_slip.add_deduction(name="ZESCWU", is_allowable_deduction=True, percentage=1.5)
salary_slip.add_deduction(name="NECWEI", is_allowable_deduction=True, percentage=1)
salary_slip.add_deduction(name="NEC", is_allowable_deduction=True, percentage=2.4)
salary_slip.add_deduction(name="AIDS Levy")
salary_slip.add_deduction(name="Loan Repayment", amount=343)
salary_slip.finalize_deductions()
salary_slip.rearrange_deductions()

# print(salary_slip.author())
generate_payslip_pdf(
    payroll=salary_slip,
    output_path="payslip.pdf",
    template_dir="zwutils/templates",

)

Requirements

Python 3.10+

Jinja2

WeasyPrint (for PDF generation)


License

MIT License


You can adjust `path_to_your_logo.webp` to reflect how you want users to provide their logo dynamically.  
















sudo apt update
sudo apt install libcairo2-dev libpango1.0-dev libgdk-pixbuf2.0-dev libffi-dev

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zimutils-0.1.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zimutils-0.1.0-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file zimutils-0.1.0.tar.gz.

File metadata

  • Download URL: zimutils-0.1.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for zimutils-0.1.0.tar.gz
Algorithm Hash digest
SHA256 64db7b5742563866a40e95a286b310c76ec9eaf32ad377fe33acb80d6d8207ba
MD5 d9987470398c19beb6c6563da127bcd5
BLAKE2b-256 1d1677899732ea4228ccbd28dbc2d2013d75b453a3db45d4ac33e69ee9a2eb77

See more details on using hashes here.

File details

Details for the file zimutils-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: zimutils-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for zimutils-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6da420945c648d62d8a140764fd8ecf51d699b2c9f70c72b6e22368b153e1932
MD5 4e1c8bee66a1762aad474bc62c58daea
BLAKE2b-256 303901c4f8e4a64ba94bc2ad227d4e464eb3b1fdccad55d0b2227338c0289a99

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page