Search Posts

Visits: 541

EIPAで検証中のPINT Standard Commercial Invoice

評価用にH物産札幌支社あての請求書を試作検証する。
ここでは、現在公開されているOpen Peppol BIS Billing 3.0 のスキーマトロンで日本対応に必要となる変更点を明らかにすることを目的とする。

標準税率と軽減税率

軽減税率は、UN 5305では、次のように定義されている。

5305 Duty or tax or fee category code [B]

Desc: Code specifying a duty or tax or fee category.
Repr: an..3
Code Values:

A Mixed tax rate
Code specifying that the rate is based on mixed tax.
AA Lower rate
Tax rate is lower than standard rate.
AB Exempt for resale
A tax category code indicating the item is tax exempt when the item is bought for future resale.
AC Value Added Tax (VAT) not now due for payment
A code to indicate that the Value Added Tax (VAT) amount which is due on the current invoice is to be paid on receipt of a separate VAT payment request.
AD Value Added Tax (VAT) due from a previous invoice
A code to indicate that the Value Added Tax (VAT) amount of a previous invoice is to be paid.
AE VAT Reverse Charge
Code specifying that the standard VAT rate is levied from the invoicee.
B Transferred (VAT)
VAT not to be paid to the issuer of the invoice but directly to relevant tax authority.
C Duty paid by supplier
Duty associated with shipment of goods is paid by the supplier; customer receives goods with duty paid.
D Value Added Tax (VAT) margin scheme – travel agents
Indication that the VAT margin scheme for travel agents is applied.
E Exempt from tax
Code specifying that taxes are not applicable.
F Value Added Tax (VAT) margin scheme – second-hand goods
Indication that the VAT margin scheme for second-hand goods is applied.
G Free export item, tax not charged
Code specifying that the item is free export and taxes are not charged.
H Higher rate
Code specifying a higher rate of duty or tax or fee.
I Value Added Tax (VAT) margin scheme – works of art Margin scheme Works of art
Indication that the VAT margin scheme for works of art is applied.
J Value Added Tax (VAT) margin scheme – collector’s items and antiques
Indication that the VAT margin scheme for collector’s items and antiques is applied.
K VAT exempt for EEA intra-community supply of goods and services
A tax category code indicating the item is VAT exempt due to an intra-community supply in the European Economic Area.
L Canary Islands general indirect tax
Impuesto General Indirecto Canario (IGIC) is an indirect tax levied on goods and services supplied in the Canary Islands (Spain) by traders and professionals, as well as on import of goods.
M Tax for production, services and importation in Ceuta and Melilla
Impuesto sobre la Producci?n, los Servicios y la Importaci n (IPSI) is an indirect municipal tax, levied on the production, processing and import of all kinds of movable tangible property, the supply of services and the transfer of immovable property located in the cities of Ceuta and Melilla.
O Services outside scope of tax
Code specifying that taxes are not applicable to the services.
S Standard rate
Code specifying the standard rate.
Z Zero rated goods
Code specifying that the goods are at a zero rate.

コード表ルールで登録されているのは、AE L M E S Z G O K B のみであり、AA が登録されていないので、AA を指定するとエラーとなる。追加登録要。

<rule flag="fatal" context="cac:TaxCategory/cbc:ID">
    <assert id="BR-CL-17" flag="fatal" test="(
( not(contains(normalize-space(.),' '))
and contains( ' AA AE L M E S Z G O K B ',concat(' ',normalize-space(.),' ') ) ) 
)">
[BR-CL-17]-Invoice tax categories MUST be coded using UNCL5305 code list
    </assert>
</rule>
<rule flag="fatal" context="cac:ClassifiedTaxCategory/cbc:ID">
    <assert id="BR-CL-18" flag="fatal" test="(
( not(contains(normalize-space(.),' '))
and contains( ' AA AE L M E S Z G O K B ',concat(' ',normalize-space(.),' ') ) )
)">
[BR-CL-18]-Invoice tax categories MUST be coded using UNCL5305 code list
    </assert>
</rule>

Allowance

値引きをAllowandeとして記載したインボイスの例を次に示す。

<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
  xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
  xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd">
  <cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0</cbc:CustomizationID>
  <cbc:ProfileID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</cbc:ProfileID>
  <cbc:ID>000016</cbc:ID>
  <cbc:IssueDate>2003-03-04</cbc:IssueDate>
  <cbc:DueDate>2003-03-20</cbc:DueDate>
  <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
  <cbc:Note>注:#印は軽減税率対象商品</cbc:Note>
  <cbc:DocumentCurrencyCode>JPY</cbc:DocumentCurrencyCode>
  <!-- VAT accounting currency code MUST be different from invoice currency code when provided.
  <cbc:TaxCurrencyCode>JPY</cbc:TaxCurrencyCode>
  -->
  <cac:InvoicePeriod>
    <cbc:DescriptionCode>3</cbc:DescriptionCode>
  </cac:InvoicePeriod>
  <cac:OrderReference>
    <cbc:ID>AA-123-AA</cbc:ID>
  </cac:OrderReference>
  <cac:AccountingSupplierParty>
    <cac:Party>
      <cbc:EndpointID schemeID="0188">1234567890123</cbc:EndpointID>
      <cac:PartyIdentification>
        <cbc:ID schemeID="0147">123456000123</cbc:ID>
      </cac:PartyIdentification>
      <cac:PartyName>
        <cbc:Name>株式会社 ○○商事</cbc:Name>
      </cac:PartyName>
      <cac:PostalAddress>
        <cbc:StreetName>四谷4-29-X</cbc:StreetName>
        <cbc:AdditionalStreetName>〇〇商事ビル</cbc:AdditionalStreetName>
        <cbc:CityName>新宿区</cbc:CityName>
        <cbc:PostalZone>〒160-0044</cbc:PostalZone>
        <cbc:CountrySubentity>東京都</cbc:CountrySubentity>
        <cac:Country>
          <cbc:IdentificationCode>JP</cbc:IdentificationCode>
        </cac:Country>
      </cac:PostalAddress>
      <cac:PartyTaxScheme>
        <cbc:CompanyID>T1234567890123</cbc:CompanyID>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:PartyTaxScheme>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName>株式会社 ○○商事</cbc:RegistrationName>
      </cac:PartyLegalEntity>
      <cac:Contact>
        <cbc:Name>青木 志郎</cbc:Name>
        <cbc:Telephone>03-3xxx-0001</cbc:Telephone>
        <cbc:ElectronicMail>shirou_aoki@〇〇co.jp</cbc:ElectronicMail>
      </cac:Contact>
    </cac:Party>
  </cac:AccountingSupplierParty>
  <cac:AccountingCustomerParty>
    <cac:Party>
      <cbc:EndpointID schemeID="0188">3210987654321</cbc:EndpointID>
      <cac:PartyIdentification>
        <cbc:ID schemeID="0147">654321000321</cbc:ID>
      </cac:PartyIdentification>
      <cac:PartyName>
        <cbc:Name>株式会社 藤山物産</cbc:Name>
      </cac:PartyName>
      <cac:PostalAddress>
        <cbc:StreetName>北区</cbc:StreetName>
        <cbc:AdditionalStreetName>北十二条西76-X</cbc:AdditionalStreetName>
        <cbc:CityName>札幌市</cbc:CityName>
        <cbc:PostalZone>001-0012</cbc:PostalZone>
        <cbc:CountrySubentity>北海道</cbc:CountrySubentity>
        <cac:Country>
          <cbc:IdentificationCode>JP</cbc:IdentificationCode>
        </cac:Country>
      </cac:PostalAddress>
      <cac:PartyTaxScheme>
        <cbc:CompanyID>T3210987654321</cbc:CompanyID>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:PartyTaxScheme>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName>株式会社 藤山物産 札幌支社</cbc:RegistrationName>
      </cac:PartyLegalEntity>
      <cac:Contact>
        <cbc:Name>株式会社 藤山物産 札幌支社</cbc:Name>
        <cbc:ElectronicMail>purchaser@fujiyamabussan.co.jp</cbc:ElectronicMail>
      </cac:Contact>
    </cac:Party>
  </cac:AccountingCustomerParty>
<!-- [BR-17] The Payee name (BT-59) shall be provided in the Invoice, if the Payee (BG-10) is different from the Seller (BG-4)
  <cac:PayeeParty>
    <cac:PartyName>
      <cbc:Name>株式会社 ○○商事</cbc:Name>
    </cac:PartyName>
    <cac:PartyLegalEntity>
      <cbc:CompanyID schemeID="0147">123456000123</cbc:CompanyID>
    </cac:PartyLegalEntity>
  </cac:PayeeParty>-->
  <cac:Delivery>
    <cbc:ActualDeliveryDate>2021-03-04</cbc:ActualDeliveryDate>
    <cac:DeliveryLocation>
      <cac:Address>
        <cbc:StreetName>北海道札幌市北区</cbc:StreetName>
        <cbc:AdditionalStreetName>北十二条西76-X</cbc:AdditionalStreetName>
        <cbc:CityName>北海道札幌市</cbc:CityName>
        <cbc:PostalZone>001-0012</cbc:PostalZone>
        <cac:Country>
          <cbc:IdentificationCode>JP</cbc:IdentificationCode>
        </cac:Country>
      </cac:Address>
    </cac:DeliveryLocation>
    <cac:DeliveryParty>
      <cac:PartyName>
        <cbc:Name>株式会社 藤山物産 札幌支社</cbc:Name>
      </cac:PartyName>
    </cac:DeliveryParty>
  </cac:Delivery>
  <cac:PaymentMeans>
    <cbc:PaymentMeansCode name="Credit transfer">30</cbc:PaymentMeansCode>
    <cbc:PaymentID>Snippet1</cbc:PaymentID>
	<cac:PayeeFinancialAccount>
	  <cbc:ID>1234121123456789</cbc:ID>
	  <cbc:Name>株式会社 ○○商事</cbc:Name>
	</cac:PayeeFinancialAccount>
  </cac:PaymentMeans>
  <cac:AllowanceCharge>
    <cbc:ChargeIndicator>true</cbc:ChargeIndicator>
    <cbc:AllowanceChargeReason>諸掛</cbc:AllowanceChargeReason>
    <cbc:Amount currencyID="JPY">17700</cbc:Amount>
    <cac:TaxCategory>
      <cbc:ID>S</cbc:ID>
      <cbc:Percent>10</cbc:Percent>
      <cac:TaxScheme>
        <cbc:ID>VAT</cbc:ID>
      </cac:TaxScheme>
    </cac:TaxCategory>
  </cac:AllowanceCharge>
  <cac:TaxTotal>
    <cbc:TaxAmount currencyID="JPY">11970</cbc:TaxAmount>
    <cac:TaxSubtotal>
      <cbc:TaxableAmount currencyID="JPY">87700</cbc:TaxableAmount>
      <cbc:TaxAmount currencyID="JPY">8770</cbc:TaxAmount>
      <cac:TaxCategory>
        <cbc:ID>S</cbc:ID>
        <cbc:Percent>10</cbc:Percent>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:TaxCategory>
    </cac:TaxSubtotal>
    <cac:TaxSubtotal>
      <cbc:TaxableAmount currencyID="JPY">40000</cbc:TaxableAmount>
      <cbc:TaxAmount currencyID="JPY">3200</cbc:TaxAmount>
      <cac:TaxCategory>
        <cbc:ID>AA</cbc:ID>
        <cbc:Percent>8</cbc:Percent>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:TaxCategory>
    </cac:TaxSubtotal>
  </cac:TaxTotal>
  <cac:LegalMonetaryTotal>
    <cbc:LineExtensionAmount currencyID="JPY">120000</cbc:LineExtensionAmount>
    <cbc:TaxExclusiveAmount currencyID="JPY">127700</cbc:TaxExclusiveAmount>
    <cbc:TaxInclusiveAmount currencyID="JPY">139670</cbc:TaxInclusiveAmount>
    <cbc:ChargeTotalAmount currencyID="JPY">17700</cbc:ChargeTotalAmount>
    <cbc:PayableAmount currencyID="JPY">139670</cbc:PayableAmount>
  </cac:LegalMonetaryTotal>
  <cac:InvoiceLine>
    <cbc:ID>10</cbc:ID>
    <cbc:InvoicedQuantity unitCode="EA">1000</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="JPY">30000</cbc:LineExtensionAmount>
    <cac:Item>
      <cbc:Name>原稿用紙(A4)</cbc:Name>
      <cac:ClassifiedTaxCategory>
        <cbc:ID>S</cbc:ID>
        <cbc:Percent>10</cbc:Percent>
        <cbc:PerUnitAmount currencyID="JPY">30</cbc:PerUnitAmount>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:ClassifiedTaxCategory>
      <cac:AdditionalItemProperty>
        <cbc:Name>数量単位</cbc:Name>
        <cbc:Value>枚</cbc:Value>
      </cac:AdditionalItemProperty>
    </cac:Item>
    <cac:Price>
      <cbc:PriceAmount currencyID="JPY">30</cbc:PriceAmount>
      <cbc:BaseQuantity unitCode="EA">1</cbc:BaseQuantity>
    </cac:Price>
  </cac:InvoiceLine>
  <cac:InvoiceLine>
    <cbc:ID>20</cbc:ID>
    <cbc:InvoicedQuantity unitCode="EA">10</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="JPY">40000</cbc:LineExtensionAmount>
    <cac:Item>
      <cbc:Name>XX新聞</cbc:Name>
      <cac:ClassifiedTaxCategory>
        <cbc:ID>AA</cbc:ID>
        <cbc:Percent>8</cbc:Percent>
        <cbc:PerUnitAmount currencyID="JPY">320</cbc:PerUnitAmount>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:ClassifiedTaxCategory>
      <cac:AdditionalItemProperty>
        <cbc:Name>数量単位</cbc:Name>
        <cbc:Value>部</cbc:Value>
      </cac:AdditionalItemProperty>
    </cac:Item>
    <cac:Price>
      <cbc:PriceAmount currencyID="JPY">5000</cbc:PriceAmount>
      <cbc:BaseQuantity unitCode="EA">1</cbc:BaseQuantity>
    </cac:Price>
  </cac:InvoiceLine>
  <cac:InvoiceLine>
    <cbc:ID>30</cbc:ID>
    <cbc:InvoicedQuantity unitCode="EA">1</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="JPY">50000</cbc:LineExtensionAmount>
    <cac:AllowanceCharge>
      <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
      <cbc:AllowanceChargeReason>単品値引</cbc:AllowanceChargeReason>
      <cbc:MultiplierFactorNumeric>20</cbc:MultiplierFactorNumeric>
      <cbc:Amount currencyID="JPY">10000</cbc:Amount>
      <cbc:BaseAmount currencyID="JPY">50000</cbc:BaseAmount>
    </cac:AllowanceCharge>
    <cac:Item>
      <cbc:Name>回転椅子 K</cbc:Name>
      <cac:ClassifiedTaxCategory>
        <cbc:ID>S</cbc:ID>
        <cbc:Percent>10</cbc:Percent>
        <cbc:PerUnitAmount currencyID="JPY">50000</cbc:PerUnitAmount>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:ClassifiedTaxCategory>
      <cac:AdditionalItemProperty>
        <cbc:Name>数量単位</cbc:Name>
        <cbc:Value>個</cbc:Value>
      </cac:AdditionalItemProperty>
    </cac:Item>
    <cac:Price>
      <cbc:PriceAmount currencyID="JPY">50000</cbc:PriceAmount>
      <cbc:BaseQuantity unitCode="EA">1</cbc:BaseQuantity>
    </cac:Price>
  </cac:InvoiceLine>
</Invoice>

これをスキーマトロンで検証すると次のメッセージが報告された。

エラーの原因は、明細行の金額計算の誤りと合計金額の誤り。また、明細行に<PerUnitAmount>は、非推奨項目だった。これらを修正したサンプルを次に示す。

<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
  xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
  xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2 http://docs.oasis-open.org/ubl/os-UBL-2.1/xsd/maindoc/UBL-Invoice-2.1.xsd">
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0</cbc:CustomizationID>
  <cbc:ProfileID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</cbc:ProfileID>
  <cbc:ID>000016</cbc:ID>
  <cbc:IssueDate>2003-03-04</cbc:IssueDate>
  <cbc:DueDate>2003-03-20</cbc:DueDate>
  <cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
  <cbc:Note>注:#印は軽減税率対象商品</cbc:Note>
  <cbc:DocumentCurrencyCode>JPY</cbc:DocumentCurrencyCode>
  <!-- VAT accounting currency code MUST be different from invoice currency code when provided.
  <cbc:TaxCurrencyCode>JPY</cbc:TaxCurrencyCode>
  -->
  <cac:InvoicePeriod>
    <cbc:DescriptionCode>3</cbc:DescriptionCode>
  </cac:InvoicePeriod>
  <cac:OrderReference>
    <cbc:ID>AA-123-AA</cbc:ID>
  </cac:OrderReference>
  <cac:AccountingSupplierParty>
    <cac:Party>
      <cbc:EndpointID schemeID="0188">1234567890123</cbc:EndpointID>
      <cac:PartyIdentification>
        <cbc:ID schemeID="0147">123456000123</cbc:ID>
      </cac:PartyIdentification>
      <cac:PartyName>
        <cbc:Name>株式会社 ○○商事</cbc:Name>
      </cac:PartyName>
      <cac:PostalAddress>
        <cbc:StreetName>四谷4-29-X</cbc:StreetName>
        <cbc:AdditionalStreetName>〇〇商事ビル</cbc:AdditionalStreetName>
        <cbc:CityName>新宿区</cbc:CityName>
        <cbc:PostalZone>〒160-0044</cbc:PostalZone>
        <cbc:CountrySubentity>東京都</cbc:CountrySubentity>
        <cac:Country>
          <cbc:IdentificationCode>JP</cbc:IdentificationCode>
        </cac:Country>
      </cac:PostalAddress>
      <cac:PartyTaxScheme>
        <cbc:CompanyID>T1234567890123</cbc:CompanyID>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:PartyTaxScheme>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName>株式会社 ○○商事</cbc:RegistrationName>
      </cac:PartyLegalEntity>
      <cac:Contact>
        <cbc:Name>青木 志郎</cbc:Name>
        <cbc:Telephone>03-3xxx-0001</cbc:Telephone>
        <cbc:ElectronicMail>shirou_aoki@〇〇co.jp</cbc:ElectronicMail>
      </cac:Contact>
    </cac:Party>
  </cac:AccountingSupplierParty>
  <cac:AccountingCustomerParty>
    <cac:Party>
      <cbc:EndpointID schemeID="0188">3210987654321</cbc:EndpointID>
      <cac:PartyIdentification>
        <cbc:ID schemeID="0147">654321000321</cbc:ID>
      </cac:PartyIdentification>
      <cac:PartyName>
        <cbc:Name>株式会社 藤山物産</cbc:Name>
      </cac:PartyName>
      <cac:PostalAddress>
        <cbc:StreetName>北区</cbc:StreetName>
        <cbc:AdditionalStreetName>北十二条西76-X</cbc:AdditionalStreetName>
        <cbc:CityName>札幌市</cbc:CityName>
        <cbc:PostalZone>001-0012</cbc:PostalZone>
        <cbc:CountrySubentity>北海道</cbc:CountrySubentity>
        <cac:Country>
          <cbc:IdentificationCode>JP</cbc:IdentificationCode>
        </cac:Country>
      </cac:PostalAddress>
      <cac:PartyTaxScheme>
        <cbc:CompanyID>T3210987654321</cbc:CompanyID>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:PartyTaxScheme>
      <cac:PartyLegalEntity>
        <cbc:RegistrationName>株式会社 藤山物産 札幌支社</cbc:RegistrationName>
      </cac:PartyLegalEntity>
      <cac:Contact>
        <cbc:Name>株式会社 藤山物産 札幌支社</cbc:Name>
        <cbc:ElectronicMail>purchaser@fujiyamabussan.co.jp</cbc:ElectronicMail>
      </cac:Contact>
    </cac:Party>
  </cac:AccountingCustomerParty>
<!-- [BR-17] The Payee name (BT-59) shall be provided in the Invoice, if the Payee (BG-10) is different from the Seller (BG-4)
  <cac:PayeeParty>
    <cac:PartyName>
      <cbc:Name>株式会社 ○○商事</cbc:Name>
    </cac:PartyName>
    <cac:PartyLegalEntity>
      <cbc:CompanyID schemeID="0147">123456000123</cbc:CompanyID>
    </cac:PartyLegalEntity>
  </cac:PayeeParty>-->
  <cac:Delivery>
    <cbc:ActualDeliveryDate>2021-03-04</cbc:ActualDeliveryDate>
    <cac:DeliveryLocation>
      <cac:Address>
        <cbc:StreetName>北海道札幌市北区</cbc:StreetName>
        <cbc:AdditionalStreetName>北十二条西76-X</cbc:AdditionalStreetName>
        <cbc:CityName>北海道札幌市</cbc:CityName>
        <cbc:PostalZone>001-0012</cbc:PostalZone>
        <cac:Country>
          <cbc:IdentificationCode>JP</cbc:IdentificationCode>
        </cac:Country>
      </cac:Address>
    </cac:DeliveryLocation>
    <cac:DeliveryParty>
      <cac:PartyName>
        <cbc:Name>株式会社 藤山物産 札幌支社</cbc:Name>
      </cac:PartyName>
    </cac:DeliveryParty>
  </cac:Delivery>
  <cac:PaymentMeans>
    <cbc:PaymentMeansCode name="Credit transfer">30</cbc:PaymentMeansCode>
    <cbc:PaymentID>Snippet1</cbc:PaymentID>
	<cac:PayeeFinancialAccount>
	  <cbc:ID>1234121123456789</cbc:ID>
	  <cbc:Name>株式会社 ○○商事</cbc:Name>
	</cac:PayeeFinancialAccount>
  </cac:PaymentMeans>
  <cac:AllowanceCharge>
    <cbc:ChargeIndicator>true</cbc:ChargeIndicator>
    <cbc:AllowanceChargeReason>諸掛</cbc:AllowanceChargeReason>
    <cbc:Amount currencyID="JPY">17700</cbc:Amount>
    <cac:TaxCategory>
      <cbc:ID>S</cbc:ID>
      <cbc:Percent>10</cbc:Percent>
      <cac:TaxScheme>
        <cbc:ID>VAT</cbc:ID>
      </cac:TaxScheme>
    </cac:TaxCategory>
  </cac:AllowanceCharge>
  <cac:TaxTotal>
    <cbc:TaxAmount currencyID="JPY">11970</cbc:TaxAmount>
    <cac:TaxSubtotal>
      <cbc:TaxableAmount currencyID="JPY">87700</cbc:TaxableAmount>
      <cbc:TaxAmount currencyID="JPY">8770</cbc:TaxAmount>
      <cac:TaxCategory>
        <cbc:ID>S</cbc:ID>
        <cbc:Percent>10</cbc:Percent>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:TaxCategory>
    </cac:TaxSubtotal>
    <cac:TaxSubtotal>
      <cbc:TaxableAmount currencyID="JPY">40000</cbc:TaxableAmount>
      <cbc:TaxAmount currencyID="JPY">3200</cbc:TaxAmount>
      <cac:TaxCategory>
        <cbc:ID>AA</cbc:ID>
        <cbc:Percent>8</cbc:Percent>
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:TaxCategory>
    </cac:TaxSubtotal>
  </cac:TaxTotal>
  <cac:LegalMonetaryTotal>
    <cbc:LineExtensionAmount currencyID="JPY">120000</cbc:LineExtensionAmount>
    <cbc:TaxExclusiveAmount currencyID="JPY">137700</cbc:TaxExclusiveAmount>
    <cbc:TaxInclusiveAmount currencyID="JPY">149670</cbc:TaxInclusiveAmount>
    <cbc:ChargeTotalAmount currencyID="JPY">17700</cbc:ChargeTotalAmount>
    <cbc:PayableAmount currencyID="JPY">149670</cbc:PayableAmount>
  </cac:LegalMonetaryTotal>
  <cac:InvoiceLine>
    <cbc:ID>10</cbc:ID>
    <cbc:InvoicedQuantity unitCode="EA">1000</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="JPY">30000</cbc:LineExtensionAmount>
    <cac:Item>
      <cbc:Name>原稿用紙(A4)</cbc:Name>
      <cac:ClassifiedTaxCategory>
        <cbc:ID>S</cbc:ID>
        <cbc:Percent>10</cbc:Percent>
 <!--       <cbc:PerUnitAmount currencyID="JPY">30</cbc:PerUnitAmount>
 -->
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:ClassifiedTaxCategory>
      <cac:AdditionalItemProperty>
        <cbc:Name>数量単位</cbc:Name>
        <cbc:Value>枚</cbc:Value>
      </cac:AdditionalItemProperty>
    </cac:Item>
    <cac:Price>
      <cbc:PriceAmount currencyID="JPY">30</cbc:PriceAmount>
      <cbc:BaseQuantity unitCode="EA">1</cbc:BaseQuantity>
    </cac:Price>
  </cac:InvoiceLine>
  <cac:InvoiceLine>
    <cbc:ID>20</cbc:ID>
    <cbc:InvoicedQuantity unitCode="EA">10</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="JPY">50000</cbc:LineExtensionAmount>
    <cac:Item>
      <cbc:Name>XX新聞</cbc:Name>
      <cac:ClassifiedTaxCategory>
        <cbc:ID>AA</cbc:ID>
        <cbc:Percent>8</cbc:Percent>
  <!--      <cbc:PerUnitAmount currencyID="JPY">320</cbc:PerUnitAmount>
  -->
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:ClassifiedTaxCategory>
      <cac:AdditionalItemProperty>
        <cbc:Name>数量単位</cbc:Name>
        <cbc:Value>部</cbc:Value>
      </cac:AdditionalItemProperty>
    </cac:Item>
    <cac:Price>
      <cbc:PriceAmount currencyID="JPY">5000</cbc:PriceAmount>
      <cbc:BaseQuantity unitCode="EA">1</cbc:BaseQuantity>
    </cac:Price>
  </cac:InvoiceLine>
  <cac:InvoiceLine>
    <cbc:ID>30</cbc:ID>
    <cbc:InvoicedQuantity unitCode="EA">1</cbc:InvoicedQuantity>
    <cbc:LineExtensionAmount currencyID="JPY">40000</cbc:LineExtensionAmount>
    <cac:AllowanceCharge>
      <cbc:ChargeIndicator>false</cbc:ChargeIndicator>
      <cbc:AllowanceChargeReason>単品値引</cbc:AllowanceChargeReason>
      <cbc:MultiplierFactorNumeric>20</cbc:MultiplierFactorNumeric>
      <cbc:Amount currencyID="JPY">10000</cbc:Amount>
      <cbc:BaseAmount currencyID="JPY">50000</cbc:BaseAmount>
    </cac:AllowanceCharge>
    <cac:Item>
      <cbc:Name>回転椅子 K</cbc:Name>
      <cac:ClassifiedTaxCategory>
        <cbc:ID>S</cbc:ID>
        <cbc:Percent>10</cbc:Percent>
  <!--      <cbc:PerUnitAmount currencyID="JPY">50000</cbc:PerUnitAmount>
  -->
        <cac:TaxScheme>
          <cbc:ID>VAT</cbc:ID>
        </cac:TaxScheme>
      </cac:ClassifiedTaxCategory>
      <cac:AdditionalItemProperty>
        <cbc:Name>数量単位</cbc:Name>
        <cbc:Value>個</cbc:Value>
      </cac:AdditionalItemProperty>
    </cac:Item>
    <cac:Price>
      <cbc:PriceAmount currencyID="JPY">50000</cbc:PriceAmount>
      <cbc:BaseQuantity unitCode="EA">1</cbc:BaseQuantity>
    </cac:Price>
  </cac:InvoiceLine>
</Invoice>

加盟国の独自ルールの判断方法

住所に指定された国コードを用いた判定

他の加盟国の定義例を参考に国コードを用いた判定を行う。
先ず、JPSupplierCountryおよびJPCustomerCountry変数を定義する。

<let name="JPSupplierCountry" value="concat(
        ubl-invoice:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode,
        ubl-creditnote:CreditNote/cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode)"/>
<let name="JPCustomerCountry" value="concat(
        ubl-invoice:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode,
        ubl-creditnote:CreditNote/cac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode)"/>   

この変数をビジネスルールのcontext定義で使用する。

適格請求書発行事業者の登録番号

登録番号については、法人番号を有する事業者は「T+法人番号」、それ以外の事業者は「T+13桁の数字(新
たな固有の番号)」が登録番号となる。この形式で登録番号が電子インボイスに記載されているか確認するビジネスルール(案)を次に示す。

<!-- VAT Registration Number Rules -->
<rule context="ubl-invoice:Invoice[$JPSupplierCountry = 'JP']/cac:AccountingSupplierParty">
      <assert id="JP-R-001" test="cac:Party/cac:PartyTaxScheme[normalize-space(cac:TaxScheme/cbc:ID) = 'VAT']/matches(normalize-space(cbc:CompanyID),'^T[0-9]{13}$')" flag="fatal">
        [JP-R-001]- For the Japanese Suppliers, the VAT registration number must start with 'T' and be followed by 13-digit number.</assert>
</rule>
<rule context="ubl-invoice:Invoice[$JPSupplierCountry = 'JP']/cac:AccountingBuyerParty">
      <assert id="JP-R-002" test="cac:Party/cac:PartyTaxScheme[normalize-space(cac:TaxScheme/cbc:ID) = 'VAT']/matches(normalize-space(cbc:CompanyID),'^T[0-9]{13}$')" flag="fatal">
        [JP-R-002]- For the Japanese Customers, the VAT registration number must start with 'T' and be followed by 13-digit number.</assert>
</rule>

context=”ubl-invoice:Invoice[$JPSupplierCountry = ‘JP’]/cac:AccountingSupplierParty”と指定することで、日本の販売者について定義されている情報項目を対象とすることを指定する。
テスト条件では、cac:Party/cac:PartyTaxScheme[normalize-space(cac:TaxScheme/cbc:ID) = ‘VAT’]/matches(normalize-space(cbc:CompanyID),’^T[0-9]{13}$’)” と記述することで、住所に記載されている登録番号が、「T+13桁の数字」かどうかチェックしている。
発注者についても同様。
この箇所の定義は、次のとおり。

<pattern id="Japan">
    <let name="JPSupplierCountry" value="concat(
        ubl-invoice:Invoice/cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode,
        ubl-creditnote:CreditNote/cac:AccountingSupplierParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode)"/>
    <let name="JPCustomerCountry" value="concat(
        ubl-invoice:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode,
        ubl-creditnote:CreditNote/cac:AccountingCustomerParty/cac:Party/cac:PostalAddress/cac:Country/cbc:IdentificationCode)"/>   
    <!-- VAT Registration Number Rules -->
    <rule context="ubl-invoice:Invoice[$JPSupplierCountry = 'JP']/cac:AccountingSupplierParty">
      <assert id="JP-R-001" test="cac:Party/cac:PartyTaxScheme[normalize-space(cac:TaxScheme/cbc:ID) = 'VAT']/matches(normalize-space(cbc:CompanyID),'^T[0-9]{13}$')" flag="fatal">
        [JP-R-001]- For the Japanese Suppliers, the VAT registration number must start with 'T' and be followed by 13-digit number.</assert>
    </rule>
    <rule context="ubl-invoice:Invoice[$JPSupplierCountry = 'JP']/cac:AccountingBuyerParty">
      <assert id="JP-R-002" test="cac:Party/cac:PartyTaxScheme[normalize-space(cac:TaxScheme/cbc:ID) = 'VAT']/matches(normalize-space(cbc:CompanyID),'^T[0-9]{13}$')" flag="fatal">
        [JP-R-002]- For the Japanese Customers, the VAT registration number must start with 'T' and be followed by 13-digit number.</assert>
    </rule>
</pattern>