code2pdf_6844251e225f9
code2pdf_6844251e225f9
def header(self):
self.set_font("Arial", "B", 12)
self.cell(0, 10, "Employee Master Data and Salary Sheet Template", ln=True, align="C")
self.ln(5)
# Initialize PDF
pdf = PDF()
pdf.add_page()
emp_headers = [
"Employee ID", "Name", "Designation", "Department", "Date of Joining",
"PAN No.", "Bank A/C No.", "IFSC Code", "Email", "Phone", "Salary Grade"
]
emp_data = [
["EMP001", "John Doe", "Software Engineer", "IT", "2021-03-01", "ABCPD1234K",
"123456789012", "HDFC0001234", "[email protected]", "9876543210", "Grade A"],
["EMP002", "Jane Smith", "HR Manager", "HR", "2020-07-15", "XYZPD5678L",
"987654321098", "ICIC0005678", "[email protected]", "8765432109", "Grade B"]
]
pdf.table([20, 25, 35, 25, 25, 25, 30, 25, 45, 25, 25], [emp_headers] + emp_data)
# Salary Sheet
pdf.ln(10)
pdf.chapter_title("Salary Sheet Template")
salary_headers = [
"Month", "Employee ID", "Name", "Basic Pay", "HRA", "Conveyance", "Other Allowances",
"Gross Salary", "PF Deduction", "ESI", "Income Tax", "Other Deductions", "Net Salary"
]
salary_data = [
["June 2025", "EMP001", "John Doe", "30,000", "12,000", "2,000", "3,000", "47,000",
"3,600", "0", "2,000", "500", "40,900"],
["June 2025", "EMP002", "Jane Smith", "40,000", "16,000", "2,000", "2,000", "60,000",
"4,800", "0", "3,500", "700", "51,000"]
]
pdf.table([20, 20, 25, 20, 15, 20, 25, 25, 20, 10, 20, 25, 20], [salary_headers] + salary_data)