Bernd Wurst
USt-Berechnung und Zwischenspeicherung komplett umgestellt. VATEX-Code für innergemeinschaftliche Lieferung im XML
Bernd Wurst commited 007b3b8 at 2025-05-03 07:43:46
InvoiceToText.py
# -* coding: utf8 *-
from __future__ import division
from . import _formatPrice, split_to_width
from .InvoiceObjects import Invoice, InvoiceTable, InvoiceText, InvoiceImage, PAYMENT_UEBERWEISUNG
def _breakLine(text, width=72):
lines = []
paras = text.split('\n')
for para in paras:
words = para.split(' ')
while len(words) > 0:
mywords = [words[0], ]
del words[0]
while len(words) > 0 and len(u' '.join(mywords) + ' ' + words[0]) <= width:
mywords.append(words[0])
del words[0]
lines.append(' '.join(mywords))
return lines
def InvoiceToText(invoice: Invoice):
ret = [u'Rechnungsempfänger:',
]
addresslines = filter(None, [
invoice.customer['name'].strip(),
invoice.customer['address']['line1'] or '',
invoice.customer['address']['line2'] or '',
invoice.customer['address']['line3'] or '',
((invoice.customer['address']['postcode'] or '') + ' ' + (
invoice.customer['address']['city_name'] or '')).strip(),
])
for line in addresslines:
ret.append(f' {line}')
ret.append('')
ret.append(f'Kundennummer: {invoice.customerno}')
if invoice.id:
ret.append(f'Rechnungsnummer: {invoice.id}')
if invoice.type:
ret.append(f'Rechnungsdatum: {invoice.date.strftime("%d.%m.%Y")}')
else:
ret.append(f'Datum: {invoice.date.strftime("%d.%m.%Y")}')
if invoice.leitweg_id:
ret.append(f'Leitweg-ID: {invoice.leitweg_id}')
if invoice.buyer_reference:
ret.append(f'Kunden-Referenz: {invoice.buyer_reference}')
if invoice.contract_number:
ret.append(f'Vertragsnummer: {invoice.contract_number}')
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX