Professional Tax (PT) condition or formula for Maharashtra in Salary Component

Hello Community,

I am trying to calculate Professional Tax (PT) as per Maharashtra Rule.

I tried below formula but Its not working and showing below error.

0 if 7500 > custom_employee_ctc > 0 AND custom_gender == "Male" OR 0 < custom_employee_ctc > 25000 AND custom_gender == "Female" else
175 if custom_gender == "Male" AND 7501 =< custom_employee_ctc < 10000 else
200

custom_employee_ctc and custom_gender is my custom field in Salary Slip.

Below is the error I am getting.

Error while evaluating the Salary Structure Worker7 at row 1.

Error: invalid syntax. Perhaps you forgot a comma? (, line 1)

Hint: This error can be due to invalid syntax.

If anyone has an idea or hint please suggest.

Use this

0 if (0 < custom_employee_ctc <= 7500 and custom_gender == "Male") or (0 < custom_employee_ctc <= 25000 and custom_gender == "Female") else \
175 if custom_gender == "Male" and 7501 <= custom_employee_ctc < 10000 else 200
1 Like

Where does the 25000 come from, and what about February’s exception?

Anyway, why not use a longer, but easier to understand multi-line construct?
But that’s just my 2ct.

Also, I guess it would be nice if those who decide these tables supply an official library anybody could use. That would be a good use of tax money, putting the small programming effort needed by the whole collectivity at the place where the multiplication enabled by almost effortless copying of software were put to maximum effect.
A bit like FSF’s “Public money, public code” initiative, even if this would probably be another facette of the slogan.

In Germany, the finance ministry publishes pseudocode tax calculation-and-decision trees corresponding to the tax regulations which probably could be compiled to any language.

1 Like
if ctc < 7500:
	pt = 0
elif ctc <= 10000:
	if male:
		pt = 175
	else:
		pt = 0
else:
	if february:
		pt = 300
	else:
		pt = 200
1 Like

It’s Working fine.

175 if custom_gender == "Male" and 10001 > gross_pay > 7500 else
200 if custom_gender == "Male" and 10000 < gross_pay or custom_gender == "Female" and 25000 < gross_pay else
300 if getdate(start_date).month == 2 else
0