-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support the usage of groups by the table plugin.
- Loading branch information
Showing
5 changed files
with
171 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[ | ||
{ | ||
"issuer": "Table Groups Tests", | ||
"date": "2024-12-20", | ||
"invoice_number": "007/10/2024", | ||
"amount": 123.4, | ||
"currency": "EUR", | ||
"hotel_details": [ | ||
"OYO 4189 Resort Nanganallur", | ||
"OYO 4189 Resort Nanganallur Suite A" | ||
], | ||
"date_check_in": "2024-01-08", | ||
"date_check_out": "2024-12-31", | ||
"qty_rooms": 2, | ||
"line_tax_percent": ["1%", "2%", "0%"], | ||
"lamount_tax": ["3.00", "2.00", "0.00"], | ||
"random_num_to_sum": 11.01, | ||
"desc": "Invoice from Table Groups Tests" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Issue date: 2024-12-20 | ||
Issuer: Table Group Tests | ||
Invoice number: 007/10/2024 | ||
Total: 123.40 EUR | ||
|
||
Table basic | ||
|
||
Simple table start | ||
Tax precentage amount qty | ||
1% 3.00 7.00 | ||
2% 2.00 4.00 | ||
0% 0.00 0.01 | ||
Simple table end | ||
|
||
|
||
|
||
Sample data below to test advanced grouping functions of table parser. | ||
|
||
Guest Name: Sanjay | ||
|
||
Hotel Details Check In Check Out Rooms | ||
OYO 4189 Resort Nanganallur, 01/08/2024 01/01/2018 1 | ||
OYO 4189 Resort Nanganallur Suite A, 31/12/2017 31/12/2024 1 | ||
25,Vembuliamman Koil Street,, Pazhavanthangal, Chennai | ||
Booking ID Payment Mode | ||
IBZY2087 Cash at Hotel | ||
|
||
|
||
invoice2data --input-reader=text --debug ./table-groups.txt | ||
|
||
invoice2data ./table-groups.txt --debug -t ./templates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# SPDX-License-Identifier: MIT | ||
issuer: Table Groups Tests | ||
keywords: | ||
- Table basic | ||
- Simple table start | ||
|
||
tables: | ||
- start: Hotel Details\s+Check In\s+Check Out\s+Rooms | ||
end: Booking ID | ||
body: (?P<hotel_details>[\S ]+),\s+(?P<date_check_in>\d{1,2}\/\d{1,2}\/\d{4})\s+(?P<date_check_out>\d{1,2}\/\d{1,2}\/\d{4})\s+(?P<qty_rooms>\d) | ||
types: | ||
qty_rooms: int | ||
fields: | ||
qty_rooms: | ||
group: sum | ||
date_check_in: | ||
group: first | ||
date_check_out: | ||
group: last | ||
- start: Tax precentage amount qty | ||
end: Simple table end | ||
body: (?P<line_tax_percent>\d[%])\s+(?P<lamount_tax>\d\.\d{2})\s+(?P<random_num_to_sum>\d\.\d{2}) | ||
fields: | ||
random_num_to_sum: | ||
group: sum | ||
# type: float # This is also supported | ||
types: | ||
random_num_to_sum: float # this is supported | ||
|
||
fields: | ||
date: | ||
parser: regex | ||
regex: Issue date:\s*(\d{4}-\d{2}-\d{2}) | ||
type: date | ||
invoice_number: | ||
parser: regex | ||
regex: Invoice number:\s*([\d/]+) | ||
amount: | ||
parser: regex | ||
regex: Total:\s*(\d+\.\d\d) | ||
type: float | ||
options: | ||
currency: EUR | ||
date_formats: | ||
- "%Y-%m-%d" | ||
decimal_separator: "." |