| Server IP : 65.108.144.40 / Your IP : 216.73.217.165 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 User : dev ( 1000) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/erp/payroll/ |
Upload File : |
"""
context_processor.py
This module is used to register context processor`
"""
from employee.models import Employee
from payroll.models import tax_models as models
from payroll.models.models import Deduction
def default_currency(request):
"""
This method will return the currency
"""
if models.PayrollSettings.objects.first() is None:
settings = models.PayrollSettings()
settings.currency_symbol = "$"
settings.save()
symbol = models.PayrollSettings.objects.first().currency_symbol
position = models.PayrollSettings.objects.first().position
return {
"currency": request.session.get("currency", symbol),
"position": request.session.get("position", position),
}
def host(request):
"""
This method will return the host
"""
protocol = "https" if request.is_secure() else "http"
return {"host": request.get_host(), "protocol": protocol}
def get_deductions(request):
"""
This method used to return the deduction
"""
deductions = Deduction.objects.filter(
only_show_under_employee=False, employer_rate__gt=0
)
return {"get_deductions": deductions}
def get_active_employees(request):
"""
This method used to return the deduction
"""
employees = Employee.objects.filter(
is_active=True, contract_set__isnull=False, payslip__isnull=False
).distinct()
return {"get_active_employees": employees}