Commit e0021e6e authored by Johannes Knödtel's avatar Johannes Knödtel 🎶
Browse files

add quantity table to tex pdf

fixes #7
parent 2dbbf8e2
......@@ -56,7 +56,8 @@
(GET "/" [:as {h :headers}] (list-page h))
(GET "/pdf" [] (list-pdf))
(GET "/tex-pdf" [] {:headers {"Content-Type" "application/pdf"}
:body (tex/get-pdf (db/run db/get-food)) })
:body (tex/get-pdf (db/run db/get-food)
(db/run db/get-food-numbers))})
;(GET "/announce-deliver" [] (irc/announce-deliver))
(GET "/special/doener" [:as {h :headers}] (list-page doener-list))
(GET "/special/grill" [:as {h :headers}] (list-page grill-list))
......
......@@ -47,10 +47,23 @@
(concat ["\\begin{tabular}{rrrlll}\\toprule\\\\"
"\\checkmark&\\euro&\\#&Fresse&Extra-Würste&Depp\\\\"
"\\midrule\\\\"]
(map #(str "&" "&" (escape-tex (:food_name %))
(map #(str "&" "&"
(escape-tex (:quantity %)) "&"
(escape-tex (:food_name %))
"&" (escape-tex (:comment %)) "&"
(escape-tex (:customer %)) "\\\\" \newline) data)
["\\bottomrule\\\\\\end{tabular}"])))
(defn get-pdf [data]
(gen-document (order-table data)))
(defn quantity-table [data]
(apply str
(concat ["\\begin{tabular}{lll}\\toprule\\\\"
"\\#&Fresse&Extra-Würste\\\\"
"\\midrule\\\\"]
(map #(str
(escape-tex (:number %))
"&" (escape-tex (:food_name %)) "&"
(escape-tex (:comment %)) "\\\\" \newline) data)
["\\bottomrule\\\\\\end{tabular}"])))
(defn get-pdf [data numbers]
(gen-document (str "\\noindent" (order-table data) "\\\\" (quantity-table numbers))))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment