我需要帮助来使用以下用于OpenERP的python公式编译我的工资单。请有人帮我写一下这个正确的工资单。
if categories.BASIC < 120:
result = 0
elif categories.BASIC < 180:
result = - categories.BASIC - 120 * 0.05
elif categories.BASIC < 264:
result = - categories.BASIC - 180 * 0.1 + 3
elif categories.BASIC < 2136:
result = - categories.BASIC - 264 * 0.175 + 11.4
else: categories.BASIC > 2400:
result = - categories.BASIC - 2400 * 0.25 + 214.55
亲切的问候
答案 0 :(得分:0)
不要缩进,如果没有适当的缩进,python将无法正常工作。
if categories.BASIC < 120:
result = 0
elif categories.BASIC < 180:
result = categories.BASIC - 120 * 0.05
elif categories.BASIC < 264:
result = categories.BASIC - 180 * 0.1 + 3
elif categories.BASIC < 2136:
result = categories.BASIC - 264 * 0.175 + 11.4
elif categories.BASIC > 2400: #the else statement can't have a condition
result = categories.BASIC - 2400 * 0.25 + 214.55