--- /dev/null
+#!/bin/sh
+
+# import directory
+import="$1"
+
+for invoice in "$import/invoices/"????????????????; do
+ status= date= invnum= rcpt= sender= taxrate= taxtype= tb_desc= tb_pcs= tb_ppp= tb_time=
+ sender= client= date= number= vat= vatrate= hourly= status= time= work= hours=
+
+ { read sender client date number vat vatrate hourly status junk
+ sender="${sender#*=}" client="${client#*=}" date="${date#*=}" number="${number#*=}"
+ vat="${vat#*=}" vatrate="${vatrate#*=}" hourly="${hourly#*=}" status="${status#*=}"
+ while read time work hours junk; do
+ time="${time#*=}" work="${work#*=}" hours="${hours#*=}"
+ tb_time="${tb_time}${tb_time:+ }${time}"
+ tb_desc="${tb_desc}${tb_desc:+ }${work}"
+ tb_pcs="${tb_pcs}${tb_pcs:+ }${hours}"
+ tb_ppp="${tb_ppp}${tb_ppp:+ }${hourly}"
+ done
+ } <"$invoice"
+
+ read sender junk <"$import/senders/${sender}"; sender="${sender#*=}"
+ read client junk <"$import/clients/${client}"; client="${client#*=}"
+
+ cat >"${invoice##*/}.kvd" <<-EOF
+ type tmpl_paul_byhour
+ status ${status}
+ date $(date -d %${date} +%F)
+ invnum ${number}
+ rcpt ${client}
+ sender ${sender}
+ tax ${vat}
+ taxrate ${vatrate}
+ tb_desc ${tb_desc}
+ tb_pcs ${tb_pcs}
+ tb_ppp ${tb_ppp}
+ tb_time ${tb_time}
+ EOF
+done