]> git.plutz.net Git - invoices/commitdiff
parallel processing of invoice summary in doclist
authorPaul Hänsch <paul@plutz.net>
Mon, 26 May 2025 18:45:55 +0000 (20:45 +0200)
committerPaul Hänsch <paul@plutz.net>
Thu, 24 Jul 2025 19:13:04 +0000 (21:13 +0200)
doclist.sh

index 6e77fa6fe4c92ca9376da436bd2e7896fde0d382..9abecd7e7d8a333997fb7384e427814407300442 100755 (executable)
@@ -6,17 +6,18 @@ list_status() {
   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} €]
@@ -34,7 +35,10 @@ list_status() {
          [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