Commit d31fe363 by epsi sayidina

### PPh ps 17: Tarif Progresif

parent 8a8690ab
 -- penghasilan kena pajak pkp :: Double pkp :: Int pkp = 1000000000 -- pajak penghasilan = tarif progresif pasal 17 (t1, t2, t3) = (50000000, 250000000, 500000000) pph :: Double -> Double pph pkp = if pkp <= t1 then pph_t1 pkp else pph_t2 pkp pph_t1 :: Double -> Double pph_t1 pkp = pkp * 0.05 pph_t2 :: Double -> Double pph_t2 pkp = if pkp <= t2 then (pkp - t1) * 0.15 + pph_t1(t1) else pph_t3 pkp pph_t3 :: Double -> Double pph_t3 pkp = if pkp <= t3 then (pkp - t2) * 0.25 + pph_t2(t2) else pph_t4 pkp pph_t4 :: Double -> Double pph_t4 pkp = (pkp - t3) * 0.30 + pph_t3(t3) pph :: Int -> Int pph pkp = round \$ pph_rec \$ fromIntegral pkp where (t1, t2, t3) = (50000000, 250000000, 500000000) pph_rec pkp_r = pkp_guard pkp_r pkp_guard pkp | pkp <= t1 = pkp * 0.05 | pkp <= t2 = (pkp - t1) * 0.15 + pph_rec t1 | pkp <= t3 = (pkp - t2) * 0.25 + pph_rec t2 | otherwise = (pkp - t3) * 0.30 + pph_rec t3 main = do print \$ round \$ pph pkp print \$ pph pkp
 -- penghasilan kena pajak pkp :: Double pkp = 1000000000 -- pajak penghasilan = tarif progresif pasal 17 (t1, t2, t3) = (50000000, 250000000, 500000000) pph :: Double -> Double pph pkp = if pkp <= t1 then pph_t1 pkp else pph_t2 pkp pph_t1 :: Double -> Double pph_t1 pkp = pkp * 0.05 pph_t2 :: Double -> Double pph_t2 pkp = if pkp <= t2 then (pkp - t1) * 0.15 + pph_t1(t1) else pph_t3 pkp pph_t3 :: Double -> Double pph_t3 pkp = if pkp <= t3 then (pkp - t2) * 0.25 + pph_t2(t2) else pph_t4 pkp pph_t4 :: Double -> Double pph_t4 pkp = (pkp - t3) * 0.30 + pph_t3(t3) main = do print \$ round \$ pph pkp
 -- penghasilan kena pajak pkp :: Double pkp = 1000000000 -- pajak penghasilan = tarif progresif pasal 17 pph :: Double -> Double pph pkp = pkpr pkp where (t1, t2, t3) = (50000000, 250000000, 500000000) pkpr pkp | pkp <= t1 = pkp * 0.05 | pkp <= t2 = (pkp - t1) * 0.15 + pph t1 | pkp <= t3 = (pkp - t2) * 0.25 + pph t2 | otherwise = (pkp - t3) * 0.30 + pph t3 main = do print \$ round (pph pkp)
 ... ... @@ -5,12 +5,13 @@ pkp = 1000000000 -- pajak penghasilan = tarif progresif pasal 17 pph :: Int -> Int pph pkp = round(pkpr pkp) where where pkp_d = fromIntegral(pkp) pkpr pkp | pkp <= 50000000 = fromIntegral(pkp) * 0.05 | pkp <= 250000000 = fromIntegral(pkp) * 0.15 - 5000000 | pkp <= 500000000 = fromIntegral(pkp) * 0.25 - 30000000 | otherwise = fromIntegral(pkp) * 0.30 - 55000000 | pkp <= 50000000 = pkp_d * 0.05 | pkp <= 250000000 = pkp_d * 0.15 - 5000000 | pkp <= 500000000 = pkp_d * 0.25 - 30000000 | otherwise = pkp_d * 0.30 - 55000000 main = do print \$ pph pkp
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!