eerste sessie

This commit is contained in:
2025-08-01 08:09:25 +00:00
commit 8a5330d08c
1517 changed files with 276499 additions and 0 deletions

48
postbank_csv_importer.py Normal file
View File

@@ -0,0 +1,48 @@
from beancount.ingest import importer
from beancount.core import data
from beancount.core.number import D
import csv
class MyCSVImporter(importer.ImporterProtocol):
"""A Beancount importer for CSV files"""
def identify(self, file):
return file.name.endswith('.csv')
def file_account(self, file):
return "Assets:Bank:POSTBANK"
def file_date(self, file):
"""Returns the unique date of the file, if any."""
# Optioneel: als je bestandsnaam een datum bevat
return None
def file_name(self, file):
"""Returns the unique name of the file, if any."""
# Optioneel: als je een unieke naam wilt baseren op het bestand
return None
def extract(self, file, existing_entries=None):
entries = []
print(f"Start extracting from: {file.name}")
print(f"Content will be processed from: {file.contents}")
meta = data.new_metadata(file.name, 0)
transaction = data.Transaction(
meta=meta,
date=data.D(2025, 7, 29),
flag='*',
payee="Dummy Payee",
narration="Dummy narration - REPLACE this",
tags=data.frozenset(['test']),
links=data.frozenset(),
postings=[
data.Postings("Assets:Bank:POSTBANK", D("-100.00"), data.get_currency_meta('EUR'), None, None, None),
data.Postings("Expenses:Food", D("100.00"), data.get_currency_meta('EUR'), None, None, None),
]
)
entries.append(transaction)
return entries