local status=$1 id type net tax gross junk
grep -lxF "status ${status}" "$_DATA"/*.kvd \
- | LANG=C sort -r \
| while read file; do
id="${file##*/}" id="${id%.kvd}"
+ gross='0.00'
DB3 open "$file" || continue
type="$(DB3 get type)"
[ -d "${_EXEC}/${type}/" ] \
&& . "${_EXEC}/${type}/form.sh"
- cat <<-EOF
+ ( sed -E ':A; N; $!bA; s;\n;;g' <<-EOF
+ ${id}
[form .invoice method=POST
- [h3 [a href="${_BASE}/doc/${id}" . $(DB3 get invnum |HTML)]]
+ [h3 [a href="${_BASE}/doc/${id}" . $({ DB3 get invnum || printf '####'; }|HTML)]]
[span .date . $(DB3 get date |HTML)]
[span .rcpt . $(DB3 get rcpt |sed -E 's/ *;.*//g' |HTML)]
[span .total . ${gross} €]
[button type=submit name=action value=pdf_export . $(_ PDF)]
]
EOF
- done
+ ) &
+ done \
+ | LANG=C sort -r \
+ | cut -d" " -f2-
}
"$_EXEC/cgilite/html-sh.sed" <<EOF