2013-03-22 49 views
1

我需要幫助來編譯我的工資,使用下面的OpenERP python公式。有人可以幫助我正確地寫下這張薪水錶。OpenERP Payroll公式爲PAYE稅

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

不要爲得到縮進,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 
+0

它不需要在類別前減去。所以我會將這個公式放入薪資規則中? – 2013-03-22 16:07:51

+0

elif categories.BASIC <2136: result = categories.BASIC - 264 * 0.175 + 11.4請幫助此行減去11.4而不是添加。 – 2013-03-22 17:24:03

+0

好了,現在所有的工作。這裏是最後的答案>非常感謝Johnthexiii – 2013-03-22 17:34:28