Skip to main content

Lightweight Python library for payroll and salary slip generation

Project description

zimutils 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 zimutils

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

## USAGE


from zimutils.payroll import Payroll
from zimutils.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="zimutils/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.  

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.1.tar.gz (7.5 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.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: zimutils-0.1.1.tar.gz
  • Upload date:
  • Size: 7.5 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.1.tar.gz
Algorithm Hash digest
SHA256 4277c72f06cf6b639a3ca33c0c53a63c0d3947415c653d0cacef3a1cf2a4756b
MD5 b57dfcf27dd0c409d0f44fbf1c96e727
BLAKE2b-256 ea0fcd9ce62d68fbf41381324c422f4a20b59348e6d9d0bf72ed47b6aadb371b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: zimutils-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a4d9b1094ac7c8c382436e1980bfaefb321dfd64e43ddc41508d4f9f88e2bdc5
MD5 f76353d3fd90596f6fdca2495a51d5bd
BLAKE2b-256 3193fa4e2564ac2f4598e979650b123a9a56d1cbff7cb91d59558fdbfe51728f

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