From 84ec14efd79a7ef2a644fab0da8b6bcd7d7feae2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= <paul@plutz.net> Date: Thu, 30 Nov 2023 12:32:10 +0100 Subject: [PATCH] gross calculation in doclist --- doclist.css | 3 +++ doclist.sh | 14 +++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/doclist.css b/doclist.css index d842375..a3b07de 100644 --- a/doclist.css +++ b/doclist.css @@ -30,6 +30,9 @@ section form.invoice { background-color: #FFF; box-shadow: .25em .25em .5em #888; } +section form.invoice h3 { + text-align: center; +} section form.invoice span { display: block; } diff --git a/doclist.sh b/doclist.sh index d31619d..f875b15 100644 --- a/doclist.sh +++ b/doclist.sh @@ -3,18 +3,26 @@ printf '%s\r\n' "Content-Type: text/html; charset=utf-8" "" list_status() { - local status=$1 + local status=$1 id type net tax gross junk grep -lxF "status ${status}" "$_DATA"/*.kvd \ | while read file; do id="${file##*/}" id="${id%.kvd}" DB3 open "$file" || continue + type="$(DB3 get type)" + [ -d "${_EXEC}/${type}/" ] \ + && . "${_EXEC}/${type}/form.sh" + + read net tax gross junk <<-EOF + $(sumtotal) + EOF + cat <<-EOF [form .invoice method=POST - [h3 [a href="/doc/${id}" . $(DB3 get number || printf ????)]] + [h3 [a href="/doc/${id}" . $(DB3 get invnum |grep -xE '.+' || printf ????)]] [span .date . $(DB3 get date || printf ????-??-??)] [span .rcpt . $(DB3 get rcpt || printf ?)] - [span .total . $(DB3 get total || printf '?') â¬] + [span .total . ${gross} â¬] [select name=status [option value=open $([ "$status" = open ] && printf selected=selected) . $(_ Open)] [option value=sent $([ "$status" = sent ] && printf selected=selected) . $(_ Sent)] -- 2.39.5