Search Posts

Visits: 417

昨日2022年6月3日 ペポルオーソリティからJP PINT 0.9.2 が公開されました。

PINT Complience には、次の記述があります。

Senders compliance to PINT based BIS

A sending party may claim compliance to the Peppol International model if they send invoices that comply with the rules of the Peppol International Invoice when applied without any specialized rules even if that document may at the same time comply with any set of specialized rules.

Processing of rules

A sender SHALL NOT send messages that are not compliant to the BIS specification identified by the customization.
A sender shall validate an outgoing message that are in line with the customsation identifier.

提供される検証ルールが5.Rulesで定義される計算式のどの範囲を対象として検算を行っているか、BIS Billing 3.0と比較してみようと思います。
BIS Billing 3.0のルールでは、次の2種類が提供されています。
EN16931 model bound to UBL
Rules for Peppol BIS 3.0 Billing

ID BT 5.1 Calculations JP PINT 0.9.2
ibt-092 Document level allowance amount
請求書レベルの返金金額
ibt-092 = ibt-093 * (ibt-094 / 100) なし
ibt-099 Document level charge amount
請求書レベルの追加請求金額
ibt-099 = ibt-100 * (ibt-101 / 100) なし
ibt-106 Sum of Invoice line net amount
値引後請求書明細行金額の合計
ibt-106 = Σ ibt-131 Shared
ibt-107 Sum of allowances on document level
請求書レベルの返金の合計
ibt-107 = Σ ibt-092 Shared
ibt-108 Sum of charges on document level
請求書レベルの追加請求の合計
ibt-108 = Σ ibt-099 Shared
ibt-109 Invoice total amount without TAX
請求書合計金額(税抜き)
ibt-109 = ibt-106 – ibt-107 + ibt-108 Shared
ibt-110 Invoice total TAX amount
請求書消費税合計金額
ibt-110 = Σ ibt-117 Shared
ibt-112 Invoice total amount with TAX
請求書合計金額(税込み)
ibt-112 = ibt-109 + ibt-110 Shared
ibt-115 Amount due for payment
差引請求金額
ibt-115 = ibt-112 – ibt-113 + ibt-114 Shared
ibt-116 TAX category taxable amount
課税分類毎の課税基準額
ibt-116 = Σ ibt-131 – ibt-092 + ibt-099 なし
ibt-117 TAX category tax amount
課税分類毎の消費税額
ibt-117 = ibt-116 * (ibt-119 / 100)
rounded result amount shall be between the floor and the ceiling
Specific
ibt-131 Invoice line net amount
値引後請求書明細行金額(税抜き)
ibt-131 = (ibt-146 / ibt-149) * ibt-129 – ibt-136 + ibt-141 なし
ibt-136 Invoice line allowance amount
請求書明細行の返金金額(税抜き)
ibt-136 = ibt-137 * (ibt-138 / 100) なし
ibt-141 Invoice line charge amount,br>請求書明細行の追加請求金額(税抜き) ibt-141 = ibt-142 * (ibt-143 / 100) なし
ibt-146 Item net price
品目単価(値引後)(税抜き)
ibt-146 = ibt-148 – ibt-147 なし

具体的な定義を次の表に示します。

ID BT rule
ibt-106 Sum of Invoice line net amount
値引後請求書明細行金額の合計
[ibr-co-10]
Sum of Invoice line net amount (ibt-106) = Σ Invoice line net amount (ibt-131).
ibt-107 Sum of allowances on document level
請求書レベルの返金の合計
[ibr-co-11]
Sum of allowances on document level (ibt-107) = Σ Document level allowance amount (ibt-092).
ibt-108 Sum of charges on document level
請求書レベルの追加請求の合計
[ibr-co-12]
Sum of charges on document level (ibt-108) = Σ Document level charge amount (ibt-099).
ibt-109 Invoice total amount without TAX
請求書合計金額(税抜き)
[ibr-co-13]
Invoice total amount without Tax (ibt-109) = Σ Invoice line net amount (ibt-131) – Sum of allowances on document level (ibt-107) + Sum of charges on document level (ibt-108).
ibt-110 Invoice total TAX amount
請求書消費税合計金額
[ibr-co-14]
Invoice total Tax amount (ibt-110) = Σ Tax category tax amount (ibt-117).
ibt-112 Invoice total amount with TAX
請求書合計金額(税込み)
[ibr-co-15]
Invoice total amount with Tax (ibt-112) = Invoice total amount without Tax (ibt-109) + Invoice total Tax amount (ibt-110).
ibt-115 Amount due for payment
請求書合計金額(税込み)
[ibr-co-16]
Amount due for payment (ibt-115) = Invoice total amount with Tax (ibt-112) – Paid amount (ibt-113) + Rounding amount (ibt-114).
ibt-117 TAX category tax amount
課税分類毎の消費税額
[aligned-ibrp-051-jp]
Tax category tax amount (ibt-117) = tax category taxable amount (ibt-116) x (tax category rate (ibt-119) / 100), rounded to integer. The rounded result amount shall be between the floor and the ceiling.
[aligned-ibrp-e-09]
The tax category tax amount (ibt-117) In a tax breakdown (ibg-23) where the tax category code (ibt-118) equals “”Exempt from tax”” MUST equal 0 (zero).
[aligned-ibrp-g-09]
The tax category tax amount (ibt-117) in a tax breakdown (ibg-23) where the tax category code (ibt-118) is “Export” MUST be 0 (zero).
[aligned-ibrp-o-09]
The tax category tax amount (ibt-117) in a tax breakdown (ibg-23) where the tax category code (ibt-118) is “Not subject to tax” MUST be 0 (zero).

[aligned-ibrp-051-jp]のページの表示が読みづらいので、行を分けてインデントすると次の定義が確認できます(税率にround()関数をかける必要はないと思いますが)。
なお、最後の箇所は、税率が0(ゼロ)の場合およびTax category codeが’O’のときには、税率がないのでそれらの条件が追加されています。
なお、ルール適用対象のcac:taxSubtotalの選択条件でcbc:TaxAmount/@currencyID=/ubl:Invoice/cbc:DocumentCurrencyCode/text()が指定されていますが、日本円を明記したcbc:TaxAmount/@currencyID=’JPY’の方が良いと思います。外貨建ての請求書の場合、必ずしも切り捨て、切り上げで金額が丸め計算されているとは限りません。

Context
  cac:TaxSubtotal[cbc:TaxAmount/@currencyID=/ubl:Invoice/cbc:DocumentCurrencyCode/text()]
Test
  (
    (cac:TaxCategory/normalize-space(upper-case(cbc:ID)) != 'O') and 
    (
      (
        round(cac:TaxCategory/xs:decimal(cbc:Percent)) != 0 and 
        (
          xs:decimal(cbc:TaxAmount) >= 
          floor(
            xs:decimal(cbc:TaxableAmount) * (cac:TaxCategory/xs:decimal(cbc:Percent) div 100)
          )
        ) and 
        (
          xs:decimal(cbc:TaxAmount) <= 
          ceiling(
            xs:decimal(cbc:TaxableAmount) * (cac:TaxCategory/xs:decimal(cbc:Percent) div 100)
          )
        )
      ) or 
      (
        round(cac:TaxCategory/xs:decimal(cbc:Percent)) = 0 and 
        (xs:decimal(cbc:TaxAmount) = 0)
      )
    )
  ) or 
  (
    not(cac:TaxCategory/cbc:Percent) and 
    (
      cac:TaxCategory/normalize-space(upper-case(cbc:ID)) = 'O'
    ) and 
    (xs:decimal(cbc:TaxAmount) = 0)
  )

この表と比較すると次のBIS Billing 3.0の表では、計算式全てを対象として検算ルールが提供されていることがわかります。

税額計算の丸めルールは提供されますが、その基礎となるibt-116 TAX category taxable amount 課税分類毎の課税基準額 や ibt-131 Invoice line net amount 値引後請求書明細行金額(税抜き) これらの金額の元になるibt-146 Item net price 品目単価(値引後)(税抜き)などについてBIS Billing 3.0で提供されていた検算ルールが提供されないのに、
A sender shall validate an outgoing message that are in line with the customsation identifier.
を守っていても、
A sender SHALL NOT send messages that are not compliant to the BIS specification identified by the customization.
を達成することができません。

この条件を達成するために、それぞれの事業者で独自の対策を行うとすれば、標準化の意図に外れるだけでなく、デジタライゼーションへの意図しない追加投資となりかねません。

改善を期待します。

ID BT BIS Billing 3.0
ibt-092 Document level allowance amount PEPPOL-EN16931-R040
Allowance/charge amount must equal base amount * percentage/100 if base amount and percentage exists
ibt-099 Document level charge amount PEPPOL-EN16931-R040
Allowance/charge amount must equal base amount * percentage/100 if base amount and percentage exists
ibt-106 Sum of Invoice line net amount BR-CO-10
Sum of Invoice line net amount (BT-106) = Σ Invoice line net amount (BT-131).
ibt-107 Sum of allowances on document level BR-CO-11
Sum of allowances on document level (BT-107) = Σ Document level allowance amount (BT-92).
ibt-108 Sum of charges on document level BBR-CO-12
Sum of charges on document level (BT-108) = Σ Document level charge amount (BT-99).
ibt-109 Invoice total amount without TAX BR-CO-13
Invoice total amount without VAT (BT-109) = Σ Invoice line net amount (BT-131) – Sum of allowances on document level (BT-107) + Sum of charges on document level (BT-108).
ibt-110 Invoice total TAX amount BR-CO-14
Invoice total VAT amount (BT-110) = Σ VAT category tax amount (BT-117).
ibt-112 Invoice total amount with TAX BR-CO-15
Invoice total amount with VAT (BT-112) = Invoice total amount without VAT (BT-109) + Invoice total VAT amount (BT-110).
ibt-115 Amount due for payment BR-CO-16
Amount due for payment (BT-115) = Invoice total amount with VAT (BT-112) -Paid amount (BT-113) +Rounding amount (BT-114).
ibt-116 TAX category taxable amount BR-S-08
For each different value of VAT category rate (BT-119) where the VAT category code (BT-118) is “Standard rated”, the VAT category taxable amount (BT-116) in a VAT breakdown (BG-23) shall equal the sum of Invoice line net amounts (BT-131) plus the sum of document level charge amounts (BT-99) minus the sum of document level allowance amounts (BT-92) where the VAT category code (BT-151, BT-102, BT-95) is “Standard rated” and the VAT rate (BT-152, BT-103, BT-96) equals the VAT category rate (BT-119).
ibt-117 TAX category tax amount BR-CO-17
VAT category tax amount (BT-117) = VAT category taxable amount (BT-116) x (VAT category rate (BT-119) / 100), rounded to two decimals.
BR-S-09
The VAT category tax amount (BT-117) in a VAT breakdown (BG-23) where VAT category code (BT-118) is “Standard rated” shall equal the VAT category taxable amount (BT-116) multiplied by the VAT category rate (BT-119).
ibt-131 Invoice line net amount PEPPOL-EN16931-R120
Invoice line net amount MUST equal (Invoiced quantity * (Item net price/item price base quantity) + Sum of invoice line charge amount – sum of invoice line allowance amount
ibt-136 Invoice line allowance amount PEPPOL-EN16931-R040
Allowance/charge amount must equal base amount * percentage/100 if base amount and percentage exists
ibt-141 Invoice line charge amount PEPPOL-EN16931-R040PEPPOL-EN16931-R040
Allowance/charge amount must equal base amount * percentage/100 if base amount and percentage exists
ibt-146 Item net price PEPPOL-EN16931-R046
Item net price MUST equal (Gross price – Allowance amount) when gross price is provided.

BIS Billing 3.0 の ibt-116 TAX category taxable amount 課税分類毎の課税基準額の検算ルールは、次のような定義です。
BR-S-08 (fatal)
For each different value of VAT category rate (BT-119) where the VAT category code (BT-118) is “Standard rated”, the VAT category taxable amount (BT-116) in a VAT breakdown (BG-23) shall equal the sum of Invoice line net amounts (BT-131) plus the sum of document level charge amounts (BT-99) minus the sum of document level allowance amounts (BT-92) where the VAT category code (BT-151, BT-102, BT-95) is “Standard rated” and the VAT rate (BT-152, BT-103, BT-96) equals the VAT category rate (BT-119).

ここでは、contextが次のようにcac:TaxSubtotal/cac:TaxCategoryを対象としてtest文を定義しています。
/*/cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID)=’S’][cac:TaxScheme/normalize-space(upper-case(cbc:ID))=’VAT’]

every $rate in xs:decimal(cbc:Percent) satisfies (
  (
    (
      exists(//cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='S'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent=$rate]) or
      exists(//cac:AllowanceCharge[cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent)=$rate])
    ) and
    (
      (
        ../xs:decimal(cbc:TaxableAmount - 1) < 
        (
          sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='S'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent)=$rate]/xs:decimal(cbc:LineExtensionAmount)) +
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent)=$rate]/xs:decimal(cbc:Amount)) -
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent)=$rate]/xs:decimal(cbc:Amount))
        )
      ) and
      (
        ../xs:decimal(cbc:TaxableAmount + 1) > 
        (
          sum(../../../cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='S'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent)=$rate]/xs:decimal(cbc:LineExtensionAmount)) +
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent)=$rate]/xs:decimal(cbc:Amount)) -
          sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent)=$rate]/xs:decimal(cbc:Amount))
        )
      )
    )
  ) or
  (
    exists(//cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='S'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent)=$rate]) or
    exists(//cac:AllowanceCharge[cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent)=$rate])
  ) and
  (
    (
      ../xs:decimal(cbc:TaxableAmount - 1) < 
      (
        sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='S'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent)=$rate]/xs:decimal(cbc:LineExtensionAmount)) +
        sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent)=$rate]/xs:decimal(cbc:Amount)) -
        sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent)=$rate]/xs:decimal(cbc:Amount))
      )
    ) and
    (
      ../xs:decimal(cbc:TaxableAmount + 1) > 
      (
        sum(../../../cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/normalize-space(cbc:ID)='S'][cac:Item/cac:ClassifiedTaxCategory/xs:decimal(cbc:Percent)=$rate]/xs:decimal(cbc:LineExtensionAmount)) +
        sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=true()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent)=$rate]/xs:decimal(cbc:Amount)) -
        sum(../../../cac:AllowanceCharge[cbc:ChargeIndicator=false()][cac:TaxCategory/normalize-space(cbc:ID)='S'][cac:TaxCategory/xs:decimal(cbc:Percent)=$rate]/xs:decimal(cbc:Amount))
      )
    )
  )
)

また、ibt-131 Invoice line net amount 値引後請求書明細行金額(税抜き)の検算ルールでは、次のようにslack()関数が使用されています。

Context
  cac:InvoiceLine | cac:CreditNoteLine
Test
  u:slack($lineExtensionAmount, 
  (
    $quantity * ($priceAmount div $baseQuantity)) + 
    $chargesTotal - 
    $allowancesTotal,
    0.02
  )

このslack関数は、次のようなXSL関数です。

<function xmlns="http://www.w3.org/1999/XSL/Transform" name="u:slack" as="xs:boolean">
    <param name="exp" as="xs:decimal"/>
    <param name="val" as="xs:decimal"/>
    <param name="slack" as="xs:decimal"/>
    <value-of select="
        xs:decimal($exp + $slack) &gt;= $val and 
        xs:decimal($exp - $slack) &lt;= $val
    "/>
</function>

比較対象の金額と検算結果の金額が ± slack値の範囲内に収まっているかを判定しています。外貨の場合、小数点以下に2桁ありますのでslack値が 0.02 になっています。検算結果と比較対象金額の違いがこの範囲であれば正しい計算だと判断されています。日本円では通常の金額では整数表記ですからslack値が 2 でしょうか。