Noname > 08-08-10, 11:41 PM
Function pit(gross, ngPhuthuoc As Single) As Single
Dim giamtru As Single
giamtru = 4000000 + ngPhuthuoc * 1600000
If gross - giamtru > 0 Then
If gross - giamtru < 5000000 Then
pit = (gross - giamtru) * 0.05
ElseIf gross - giamtru < 10000000 Then
pit = 250000 + (gross - giamtru - 5000000) * 0.1
ElseIf gross - giamtru < 18000000 Then
pit = 750000 + (gross - giamtru - 10000000) * 0.15
ElseIf gross - giamtru < 32000000 Then
pit = 1950000 + (gross - giamtru - 18000000) * 0.2
ElseIf gross - giamtru < 52000000 Then
pit = 4750000 + (gross - giamtru - 32000000) * 0.25
ElseIf gross - giamtru < 80000000 Then
pit = 9750000 + (gross - giamtru - 52000000) * 0.3
Else
pit = 18150000 + (gross - giamtru - 80000000) * 0.35
End If
Else
pit = 0
End If
End Function
Function gross(net As Single, ngPhuthuoc As Single) As Single
Dim giamtru As Single
giamtru = 4000000 + ngPhuthuoc * 1600000
If net - giamtru > 0 Then
If net - giamtru < 4750000 Then
gross = (net - giamtru) / 0.95 + giamtru
ElseIf net - giamtru < 9250000 Then
gross = 5000000 + ((net - giamtru - 4750000) / 0.9) + giamtru
ElseIf net - giamtru < 16050000 Then
gross = 10000000 + ((net - giamtru - 9250000) / 0.85) + giamtru
ElseIf net - giamtru < 27250000 Then
gross = 18000000 + ((net - giamtru - 16050000) / 0.8) + giamtru
ElseIf net - giamtru < 42250000 Then
gross = 32000000 + ((net - giamtru - 27250000) / 0.75) + giamtru
ElseIf net - giamtru < 61850000 Then
gross = 52000000 + ((net - giamtru - 42250000) / 0.7) + giamtru
Else
gross = 80000000 + ((net - giamtru - 61850000) / 0.65) + giamtru
End If
Else
gross = net
End If
End Function
Function net(gross, ngPhuthuoc As Single) As Single
Dim giamtru As Single
giamtru = 4000000 + ngPhuthuoc * 1600000
If gross - giamtru > 0 Then
If gross - giamtru < 5000000 Then
net = gross - ((gross - giamtru) * 0.05)
ElseIf gross - giamtru < 10000000 Then
net = gross - (250000 + (gross - giamtru - 5000000) * 0.1)
ElseIf gross - giamtru < 18000000 Then
net = gross - (750000 + (gross - giamtru - 10000000) * 0.15)
ElseIf gross - giamtru < 32000000 Then
net = gross - (1950000 + (gross - giamtru - 18000000) * 0.2)
ElseIf gross - giamtru < 52000000 Then
net = gross - (4750000 + (gross - giamtru - 32000000) * 0.25)
ElseIf gross - giamtru < 80000000 Then
net = gross - (9750000 + (gross - giamtru - 52000000) * 0.3)
Else
net = gross - (18150000 + (gross - giamtru - 80000000) * 0.35)
End If
Else
net = gross
End If
End Function