NAME
    Business::Tax::ID::PPH21 - Routines to help calculate Indonesian income
    tax article 21 (PPh pasal 21)

VERSION
    This document describes version 0.062 of Business::Tax::ID::PPH21 (from
    Perl distribution Business-Tax-ID-PPH21), released on 2020-03-03.

SYNOPSIS
DESCRIPTION
    The law ("undang-undang") for income tax ("pajak penghasilan") in
    Indonesia is UU 7/1983 (along with its several amendments, the latest of
    which is UU 36/2008). This law is comprised of several articles
    ("pasal"). Article 21 ("pasal 21") regulates earned income, which is
    income generated by individual/statutory bodies from performed
    work/services, including: employment (salary and benefits, as well as
    severance pay), freelance work, business, pension, and "jaminan hari
    tua" (life insurance paid to dependents when a worker is deceased).
    Article 21 also regulates some types of passive income, which is income
    generated from capital or other non-work sources, including: savings
    interests, gifts/lotteries, royalties.

    Some other passive income like rent and dividends are regulated in
    article 23 ("pasal 23") instead of article 21. And some articles
    regulate other aspects or special cases, e.g. income tax for sales to
    government agencies/import/specific industries ("pasal 22"), rules
    regarding monthly tax payments ("pasal 25"), or rules regarding work
    earned in Indonesia by non-citizens ("pasal 26").

    This module contains several routines to help calculate income tax
    article 21.

FUNCTIONS
  calc_net_income_from_pph21_op
    Usage:

     calc_net_income_from_pph21_op(%args) -> [status, msg, payload, meta]

    Given that someone pays a certain amount of PPh 21 op, calculate her
    yearly net income.

    Examples:

    *   Someone who doesn't pay PPh 21 op earns at or below PTKP:

         calc_net_income_from_pph21_op(year => 2016, pph21_op => 0, tp_status => "TK/0"); # -> 54000000

    *   Example #2:

         calc_net_income_from_pph21_op(year => 2016, pph21_op => 20000000, tp_status => "K/2"); # -> 234166666.666667

    If pph21_op is 0, will return the PTKP amount. Actually one can earn
    between zero and the full PTKP amount to pay zero PPh 21 op.

    This function is not exported by default, but exportable.

    Arguments ('*' denotes required arguments):

    *   monthly => *bool*

        Instead of yearly, return monthly net income.

    *   pph21_op* => *float*

        Amount of PPh 21 op paid.

    *   tp_status* => *str*

        Taxypayer status.

        Taypayer status reflects his/her marital status and affects the
        amount of his/her non-taxable income.

    *   year* => *int*

    Returns an enveloped result (an array).

    First element (status) is an integer containing HTTP status code (200
    means OK, 4xx caller error, 5xx function error). Second element (msg) is
    a string containing error message, or 'OK' if status is 200. Third
    element (payload) is optional, the actual result. Fourth element (meta)
    is called result metadata and is optional, a hash that contains extra
    information.

    Return value: (any)

  calc_pph21_op
    Usage:

     calc_pph21_op(%args) -> [status, msg, payload, meta]

    Calculate PPh 21 for individuals ("OP", "orang pribadi").

    Examples:

    *   Someone who earns below PTKP:

         calc_pph21_op(year => 2015, net_income => 30000000, tp_status => "TK/0"); # -> 0

    *   Example #2:

         calc_pph21_op(year => 2015, net_income => 300000000, tp_status => "K/2"); # -> 33750000

    This function is not exported by default, but exportable.

    Arguments ('*' denotes required arguments):

    *   net_income* => *float*

        Yearly net income.

    *   tp_status* => *str*

        Taxypayer status.

        Taypayer status reflects his/her marital status and affects the
        amount of his/her non-taxable income.

    *   year* => *int*

    Returns an enveloped result (an array).

    First element (status) is an integer containing HTTP status code (200
    means OK, 4xx caller error, 5xx function error). Second element (msg) is
    a string containing error message, or 'OK' if status is 200. Third
    element (payload) is optional, the actual result. Fourth element (meta)
    is called result metadata and is optional, a hash that contains extra
    information.

    Return value: (any)

  get_pph21_op_ptkp
    Usage:

     get_pph21_op_ptkp(%args) -> [status, msg, payload, meta]

    Get PPh21 non-taxable income amount ("PTKP") for individuals.

    Examples:

    *   Example #1:

         get_pph21_op_ptkp(year => 2016);

        Result:

         {
           "K/0"  => 58500000,
           "K/1"  => 63000000,
           "K/2"  => 67500000,
           "K/3"  => 72000000,
           "TK/0" => 54000000,
           "TK/1" => 58500000,
           "TK/2" => 63000000,
           "TK/3" => 67500000,
         }

    When calculating individual income tax, the net income is subtracted by
    this amount first. This means that if a person has income below this
    amount, he/she does not need to pay income tax.

    This function is not exported by default, but exportable.

    Arguments ('*' denotes required arguments):

    *   year* => *int*

    Returns an enveloped result (an array).

    First element (status) is an integer containing HTTP status code (200
    means OK, 4xx caller error, 5xx function error). Second element (msg) is
    a string containing error message, or 'OK' if status is 200. Third
    element (payload) is optional, the actual result. Fourth element (meta)
    is called result metadata and is optional, a hash that contains extra
    information.

    Return value: (any)

  get_pph21_op_rates
    Usage:

     get_pph21_op_rates(%args) -> [status, msg, payload, meta]

    Get tax rates for PPh21 for individuals ("OP", "orang pribadi").

    Examples:

    *   Example #1:

         get_pph21_op_rates(year => 2016);

        Result:

         [
           { max => 50000000, rate => 0.05 },
           { xmin => 50000000, max => 250000000, rate => 0.15 },
           { xmin => 250000000, max => 500000000, rate => 0.25 },
           { xmin => 500000000, rate => 0.3 },
         ]

    PPh21 differentiates rates between individuals ("OP", "orang pribadi")
    and statutory bodies ("badan"). Both are progressive. This routine
    returns the tax rates for individuals.

    Keywords: tax rates, tax brackets.

    This function is not exported by default, but exportable.

    Arguments ('*' denotes required arguments):

    *   year* => *int*

    Returns an enveloped result (an array).

    First element (status) is an integer containing HTTP status code (200
    means OK, 4xx caller error, 5xx function error). Second element (msg) is
    a string containing error message, or 'OK' if status is 200. Third
    element (payload) is optional, the actual result. Fourth element (meta)
    is called result metadata and is optional, a hash that contains extra
    information.

    Return value: (any)

HOMEPAGE
    Please visit the project's homepage at
    <https://metacpan.org/release/Business-Tax-ID-PPH21>.

SOURCE
    Source repository is at
    <https://github.com/perlancar/perl-Business-Tax-ID-PPH21>.

BUGS
    Please report any bugs or feature requests on the bugtracker website
    <https://rt.cpan.org/Public/Dist/Display.html?Name=Business-Tax-ID-PPH21
    >

    When submitting a bug or request, please include a test-file or a patch
    to an existing test-file that illustrates the bug or desired feature.

SEE ALSO
AUTHOR
    perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE
    This software is copyright (c) 2020, 2019, 2017, 2015 by
    perlancar@cpan.org.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.