Skip to content

Invoice Type Codes

Omar Bahareth edited this page Jul 12, 2024 · 1 revision

Invoice Type Code Values

# lib/zatca/ubl/invoice.rb
INVOICE_TYPE_CODES = {
  invoice: "388",
  debit: "383",
  credit: "381"
}.freeze

# Use like so
ZATCA::UBL::Invoice::INVOICE_TYPE_CODES[:invoice]

NOTE: For credit or debit notes you must also fill out invoice.instruction_note with an explanation on why this note was issued.

Invoice Subtypes (name attribute)

Documentation

# lib/zatca/ubl/invoice_subtype_builder.rb

  # Builds the invoice subtype code based on the provided parameters.
  #
  # @param simplified [Boolean] Specifies whether the invoice is a simplified tax invoice.
  # @param third_party [Boolean] Specifies whether the invoice is a third-party invoice transaction.
  # @param nominal [Boolean] Specifies whether the invoice is a nominal invoice transaction.
  # @param exports [Boolean] Specifies whether the invoice is an exports invoice transaction.
  # @param summary [Boolean] Specifies whether the invoice is a summary invoice transaction.
  # @param self_billed [Boolean] Specifies whether the invoice is a self-billed invoice.
  # @return [String] The generated invoice subtype code.

Example Usage

ZATCA::UBL::InvoiceSubtypeBuilder.build(
  simplified: true,
  third_party: false,
  nominal: true,
  exports: false,
  summary: false,
  self_billed: true
)
# => "0201001"

Payment Means

# lib/zatca/ubl/invoice.rb
PAYMENT_MEANS = {
  cash: "10",
  credit: "30",
  bank_account: "42",
  bank_card: "48"
}.freeze

# Use like so
ZATCA::UBL::Invoice::PAYMENT_MEANS[:bank_card]