Skip to content

Commit

Permalink
add templates
Browse files Browse the repository at this point in the history
  • Loading branch information
bosd committed Feb 5, 2024
1 parent 765e631 commit 925953f
Show file tree
Hide file tree
Showing 6 changed files with 527 additions and 0 deletions.
80 changes: 80 additions & 0 deletions src/invoice2data/extract/templates/com/com.cloudflare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
issuer: Cloudflare, Inc
fields:
amount:
parser: regex
regex:
- Total\s+[$€](\d+.\d{2})\s
type: float
amount_untaxed:
parser: regex
regex:
- Subtotal [(]USD[)]\s+[$€](\d+.\d{2})\s
type: float
amount_tax:
parser: regex
regex:
- Tax Amount\s+[$€](\d+.\d{2})\s
type: float
date:
parser: regex
regex:
- Date[:]\s+(\d{2}.\d{2}.\d{4})\s+
type: date
invoice_number:
parser: regex
regex:
- INVOICE.\s+(\w+)
partner_website:
parser: regex
regex:
- (cloudflare[.]com)
group: first
partner_name:
parser: regex
regex:
- '(Cloudflare, Inc)'
partner_email:
parser: static
value: [email protected]
partner_city:
parser: regex
regex: 'San Francisco'
group: first
partner_zip:
parser: regex
regex: 'CA 94107'
country_code:
parser: static
value: US
payment_method:
- (?i)(AMEX)
- (?i)(American express)
- (?i)(VISA)
- (?i)(Vpay)
- (?i)(Mastercard)
- (?i)(CONTANT)
- (?i)(KAS):\s.\s\d+\.\d+
lines:
parser: lines
rules:
- start: 'Summary of Current Charges'
end: '\s+Total\s+[$€](\d+.\d{2})\s'
line:
- '(?P<name>(\w+(?:\s\S+)*))\s+(?P<date_start>\d{2}[\/]\d{1,2}[\/]\d{4})\s-\s(?P<date_end>\d{2}[\/]\d{1,2}[\/]\d{4})\s+(?P<qty>\d)\s+[$€](?P<line_tax_amount>\d+.\d{2})\s+[$€](?P<price_subtotal>\d+.\d{2})'
types:
qty: float
price_unit: float
line_tax_amount: float
price_subtotal: float
date_end: date
date_start: date
keywords:
- 'Cloudflare, Inc'
- INVOICE
options:
date_formats:
- '%d %m %Y'
currency: USD
languages:
- en
decimal_separator: '.'
91 changes: 91 additions & 0 deletions src/invoice2data/extract/templates/com/com.hetzner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
issuer: Hetzner Online GmbH
fields:
amount:
parser: regex
regex: \s+Amount due[:]\s+[€]\s(\d+[.]\d+)
type: float
amount_tax:
parser: regex
regex: Total\s+[€]\s\d+[.]\d+\s+[€]\s(\d+[.]\d+)
type: float
amount_untaxed:
parser: regex
regex: \s+Subtotal [(]excl. VAT[)]\s+[$€]\s(d*[.,]?\d+[,.]\d+)
type: float
invoice_number:
parser: regex
regex: Invoice no\.[:] (\w+)
partner_website:
parser: static
value: hetzner.com
partner_email:
parser: static
value: [email protected]
partner_name:
parser: regex
regex: Hetzner Online GmbH
partner_city:
parser: regex
regex: Gunzenhausen
country_code:
parser: static
value: DE
partner_zip:
parser: regex
regex: '(\d{5}) Gunzenhausen'
partner_street:
parser: regex
regex: 'Industriestr. \d+'
currency_symbol:
parser: regex
regex: '[$€]'
date:
parser: regex
regex: Invoice date[:] (\d+.\d{2}.\d{4})
type: date
vat:
parser: regex
regex: 'VAT Reg\. No\.[:] (DE8\w+)'
bic:
parser: regex
regex: 'BIC.\s+(\w{8,11})'
iban:
parser: regex
regex: '[A-Z]{2}\d{2}?\s?\w{4}?\s?\d{4}?\s?\d{4}?\s?\d{4}?\s?\d{0,2}' # mod version do not copy
lines:
parser: lines
start: 'Pos\s+'
end: 'Subtotal'
first_line:
- '(?P<sectionheader>\w+(?:\s\S+)+\s+[(]\d{2}.\d{2}.\d{4}\s-\s\d{2}.\d{2}.\d{4}[)])\s[*]'
- '\d+\s+(?P<name>\w+(?:\s\w+)+)\s+(?P<qty>\d+)\s+[$€]\s(?P<unit_price>\d+.\d+)\s+[$€]\s(?P<price_subtotal>\d+.\d+)'
line:
- (?P<date_start>\d{2}.\d{2}.\d{4})\s-\s(?P<date_end>\d{2}.\d{2}.\d{4})
- Quantity type[:]\s(?P<uom>\w+)
types:
qty: float
unit_price: float
price_subtotal: float
date_start: date
date_end: date
tax_lines:
parser: lines
start: 'Tax code'
end: '(?i)Amount due'
line:
- '(?P<line_tax_code>\d+)\s+(?P<line_tax_percent>\d+[,.]?\d*)[%]\s+[$€]\s(?P<price_subtotal>(\d*[.,]?\d+[,.]\d+))\s+[$€]\s(?P<line_tax_amount>(\d*[.,]?\d+[,.]\d+))'
types:
line_tax_percent: float
price_subtotal: float
line_tax_amount: float
keywords:
- 'Hetzner Online'
- 'DE812871812'
- 'Invoice'
required_fields:
- lines
options:
languages:
- en
currency: EUR

66 changes: 66 additions & 0 deletions src/invoice2data/extract/templates/com/com.runbox.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
issuer: Runbox Solutions AS
fields:
amount:
parser: regex
regex: \s+Total\s+EUR\s(d*[.,]?\d+[,.]\d+)
type: float
amount_untaxed:
parser: regex
regex: \s+Total\s+EUR\s(d*[.,]?\d+[,.]\d+)
type: float
invoice_number:
parser: regex
regex: Invoice no[.:]+\s+(\d+)
partner_website:
parser: static
value: runbox.com
partner_name:
parser: regex
regex: Runbox Solutions AS
partner_city:
parser: regex
regex: Oslo
country_code:
parser: static
value: 'NO'
partner_zip:
parser: regex
regex: '([,]\s\d{4})\s\w+'
partner_email:
parser: regex
regex: '\w+[@]\w+[.]com'
date:
parser: regex
regex: Invoice date[:]\s+(\d+-\d{2}-\d{2})
type: date
date_due:
parser: regex
regex: 'Due date[:]\s+(\d{4}[-]\d{2}[-]\d{2})'
type: date
iban:
parser: regex
regex: (?:[A-Z]{2}[ \-]?[0-9]{2})(?:[ \-]?[A-Z0-9]{3,5}){2,7}
bic:
parser: regex
regex: SWIFT code[:]\s+(\w{8,11})
lines:
parser: lines
start: 'Description'
end: 'Total'
line:
- '(?P<name>[\S ]+)\s+(?P<qty>\d+)\s+(?P<unit_price>\d+[,.]\d{2})\s+(?P<line_tax_percent>\d+[,.]\d{2})\s+(?P<price_total>\d+[,.]\d{2})'
types:
qty: float
price_subtotal: float
line_amount_tax: float
unit_price: float
keywords:
- 'Runbox'
- 'Invoice'
required_fields:
- lines
options:
languages:
- en
currency: EUR

82 changes: 82 additions & 0 deletions src/invoice2data/extract/templates/com/com.vultr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
issuer: Vultr The Constant Company, LLC.
fields:
amount:
parser: regex # done
regex: \s+Total\s[(]\w+ \w+[)][:]\s+.(d*[.,]?\d+[,.]\d+)
type: float
amount_tax: # done
parser: regex
regex: \d+[,.]\d+[%):]+\s+.(\d*[.,]?\d+[,.]\d+)
type: float
amount_untaxed: # done
parser: regex
regex: \s+Sub Total[:]\s+.(d*[.,]?\d+[,.]\d+)
type: float
invoice_number: # done
parser: regex
regex: Invoice Number[:] (\d+)
partner_website: # done
parser: static
value: vultr.com
partner_name: # done
parser: regex
regex: Vultr
partner_city: # done
parser: regex
regex: West Palm Beach
state_code: # done
parser: regex
regex: FL
country_code: # done
parser: static
value: US
partner_zip: # done
parser: regex
regex: '([A-Z]{2}\s\d{5})'
partner_street: # done
parser: regex
regex: '\d{3} \w+ Street'
currency_symbol:
parser: regex
regex: '[$€]'
date: # done
parser: regex
regex: Invoice Date[:] (\d+-\d{2}-\d{2})
type: date
date_due: # done
parser: regex
regex: 'Please Pay By[:] (\w+\s\d{2},\s\d{4})'
type: date
vat: # done
parser: regex # done
regex: 'VAT ID (\w+)'
lines: # done
parser: lines
start: 'Start'
end: 'Total'
line:
- '(?P<date_start>\d{2}-\d{2}\s\d{2}[:]\d{2})\s+(?P<date_end>\d{2}-\d{2}\s\d{2}[:]\d{2})\s+(?P<name>[\S ]+)\s+(?P<qty>\d+)\s+.(?P<price_subtotal>\d+[,.]\d{2})'
types:
qty: float
price_subtotal: float
date_start: date
date_end: date
tax_lines:
parser: lines
start: 'Start'
end: '(?i)Please'
line:
- '(?P<line_tax_percent>\d+[,.]\d+)[%):]+\s+.(?P<line_tax_amount>(\d*[.,]?\d+[,.]\d+))'
types:
line_tax_percent: float
line_tax_amount: float
keywords:
- 'vultr'
- 'Invoice'
required_fields:
- lines
options:
languages:
- en
currency: USD

Loading

0 comments on commit 925953f

Please sign in to comment.