Skip to main content

Example of Monthly Salary Calculation (Tracing the variables)

The data used here is from PT. AMARIS INTERNASIONAL MANAGEMENT

We start tracing from the NET_1_MONTH calculation

if DESEPARATE:
result = (GROSS - (DETOTAL + PPH21_TOTAL))+DESEPARATE + LOANINS
else:
result = GROSS - (DETOTAL + PPH21_TOTAL) + LOANINS

we need to know where all that values come from.

->GROSS :

result = categories.BASIC + categories.ALW + ALPPH21

categories.BASIC and categories.ALW means that the code sum all the salary rules that categorized as BASIC and ALW.

->->ALPPH21 :

        if contract.date_end == payslip.date_to:
result = round((ALPPH21_YEAR - payslip.sum('ALPPH21'))+0.05)
else:
result = round(((ALPPH21_YEAR - payslip.sum('ALPPH21')) / Y)+0.05)

->->->ALPPH21_YEAR :

            PPHALW = 0  //PPHALW (PPH ALLOWANCE)
TEMP_PPHALW = 0
i = 0
for i in range(100):
GROSSYEAR = BASIC_SUM + REG_SUM + INSURANCE_SUM
GROSSYEAR_IREG = GROSSYEAR + IREG_INCOME + PPHALW

if contract.date_end == payslip.date_to:
JABATAN_SUM = round(min(GROSSYEAR_IREG*
(payslip.company_id.tax_config_id.position_percentage / 100),
(payslip.company_id.tax_config_id.position_maxvalue)*X))
else:
JABATAN_SUM = round(min(GROSSYEAR_IREG*
(payslip.company_id.tax_config_id.position_percentage / 100),
(payslip.company_id.tax_config_id.position_maxvalue)*MK))

NET0 = GROSSYEAR_IREG- JABATAN_SUM - PENSION_SUM
NET = NET0 - (NET0%1000)

if NET-PTKP<=0:
PKP = 0
if NET-PTKP>0:
PKP = (NET - PTKP)

if PKP <= 0:
PPHALW = PKP * 0
else:
PPHALW=round((payslip.env['hr.payslip'].get_pkp(employee.company_id.tax_config_id, PKP)))

if PPHALW - TEMP_PPHALW <= 1:
break
else :
TEMP_PPHALW = PPHALW

result = PPHALW

->->->->BASIC_SUM :

        if contract.date_end == payslip.date_to:
result = round((payslip.sum('BASIC') + BASIC) * (X/X))
else:
result = round((payslip.sum('BASIC') + BASIC) * (MK/X))

->->->->->BASIC :

result = contract.wage

->->->->->MK :

if employee.length_of_service + employee.month_employment_date>=13:
result = 12
elif employee.length_of_service + employee.month_employment_date<=12:
result = 13 - employee.month_employment_date

->->->->->X :

if MK < 12:
result = ((MK+PERIOD)-(MK+employee.month_employment_date))+1
else:
result = PERIOD

->->->->->->PERIOD :

result = payslip.month_date_to

->->->->REG_SUM :

        if contract.date_end == payslip.date_to:
result = round((payslip.sum('REG_INCOME') + REG_INCOME) * (X/X))
else:
result = round((payslip.sum('REG_INCOME') + REG_INCOME) * (MK/X))

->->->->->REG_INCOME :

result = payslip.env['hr.payslip'].get_amount_by_tax(lines, is_taxed=True, tax_class_id='R', type_id='', category_code='ALW') - payslip.env['hr.payslip'].get_amount_by_tax(lines, is_taxed=True, tax_class_id='R', type_id='BPJS', category_code='ALW')

->->->->INSURANCE_SUM :

if contract.date_end == payslip.date_to:
result = round((payslip.sum('INSURANCE_INCOME') + INSURANCE_INCOME) * (X/X))
else:
result = round((payslip.sum('INSURANCE_INCOME') + INSURANCE_INCOME) * (MK/X))

->->->->->INSURANCE_INCOME

result = payslip.env['hr.payslip'].get_amount_by_tax(lines, is_taxed=True, tax_class_id='R', type_id='BPJS', category_code='ALW')

->->->->IRREG_INCOME :

result = payslip.env['hr.payslip'].get_amount_by_tax(lines, is_taxed=True, tax_class_id='I', type_id='', category_code='ALW')

->->->->PENSION_SUM :

    if contract.date_end == payslip.date_to:
result = round((payslip.sum('PENSION') + PENSION) * (X/X))
else:
result = round((payslip.sum('PENSION') + PENSION) * (MK/X))

->->->->->PENSION :

result = payslip.env['hr.payslip'].get_amount_by_tax(lines, is_taxed=True, tax_class_id='', type_id='', category_code='DED')

->->->-><PTKP :

result = payslip.env['hr.payslip'].get_ptkp(employee.tax_status_id)

->DETOTAL :

total = 0
if employee.bpjstk_no:
total += DEJHTEMP
total += DEJPEMP
if employee.bpjsks_no:
total += DEBEMP

result = categories.DED - total

->->DEJHTEMP :

result = round((BASIC_BPJSTK * (contract.pyr_config_id.pension_plan_employee_percentage / 100)))

->->->BASIC_BPJSTK :

if employee.bpjstk_no and employee.bpjstk_join_date <= payslip.date_from:
result = max((contract.wage),contract.pyr_config_id.province_minimum_salary)
else:
result = 0

->->DEJPEMP :

if employee.is_pension_bpjs:
result = round((min(BASIC_BPJSTK,contract.pyr_config_id.pension_guarantee_max_value) * (contract.pyr_config_id.pension_guarantee_employee_percentage / 100)))
else:
result = 0

->->DEBEMP :

result = round((BASIC_BPJS * (contract.pyr_config_id.employee_medical_percentage / 100)))

->->->BASIC_BPJS :

if employee.bpjsks_no and employee.bpjsks_join_date <= payslip.date_from:
result = min(max((contract.wage),contract.pyr_config_id.province_minimum_salary),contract.pyr_config_id.medical_maxvalue)
else:
result = 0

->PPH21_TOTAL:

if contract.date_end == payslip.date_to:
result = round((PPH21_YEAR - payslip.sum('PPH21_TOTAL'))+0.05)
else:
result = round(((PPH21_YEAR - payslip.sum('PPH21_TOTAL')) / Y)+0.05)

->->PPH21_YEAR :

result = ALPPH21_YEAR

->->Y :

result = (MK+1)-X

->DESEPERATE :

//ngecek di class inputs bukan langsung di file perhitungan yang sama kayak yang lain.

if not inputs.BONUS3013:
DEBONUS3013 = 0
else:
if inputs.BONUS3013.transfer_type == 'combine':
DEBONUS3013 = 0
elif inputs.BONUS3013.transfer_type == 'separate':
DEBONUS3013 = inputs.BONUS3013.amount
if not inputs.BONUS3016 :
DEBONUS3016 = 0
else:
if inputs.BONUS3016 .transfer_type == 'combine':
DEBONUS3016 = 0
elif inputs.BONUS3016 .transfer_type == 'separate':
DEBONUS3016 = inputs.BONUS3016 .amount
if not inputs.BONUS3110:
DEBONUS3110 = 0
else:
if inputs.BONUS3110.transfer_type == 'combine':
DEBONUS3110 = 0
elif inputs.BONUS3110.transfer_type == 'separate':
DEBONUS3110 = inputs.BONUS3110.amount
if not inputs.ALTHR:
DETHR = 0
else:
if inputs.ALTHR.transfer_type == 'combine':
DETHR = 0
elif inputs.ALTHR.transfer_type == 'separate':
DETHR = inputs.ALTHR.amount
if not inputs.BONUS3010:
DEBONUS3010 = 0
else:
if inputs.BONUS3010.transfer_type == 'combine':
DEBONUS3010 = 0
elif inputs.BONUS3010.transfer_type == 'separate':
DEBONUS3010 = inputs.BONUS3010.amount
result = DEBONUS3013 + DEBONUS3016 + DEBONUS3110 + DETHR + DEBONUS3010
//masukin value input

->LOANINS:

result = (payslip.installment_amount*-1 or 0)
info

Not all salary rules explicitly described in the calculations, but all of their value are used in the calculations. Example: categories.BASIC = sum all the salary rules that categorized as basic, every salary rules that included in BASIC category will be calculated. (They are variables of the values)