diff options
author | Sebastian Reichel <sre@ring0.de> | 2013-03-06 21:58:16 +0100 |
---|---|---|
committer | Sebastian Reichel <sre@ring0.de> | 2013-03-06 21:58:16 +0100 |
commit | affa473b3cce8f43113d46dbf88dd695abaa44f7 (patch) | |
tree | f2d75cd512cb241991c090cf71553fd19f3a36d7 /src/web.vala | |
parent | 1a2ebec81a74e478f4e2976882451434deb40f7a (diff) | |
download | serial-barcode-scanner-affa473b3cce8f43113d46dbf88dd695abaa44f7.tar.bz2 |
show supplier & best before date in the web interface
Diffstat (limited to 'src/web.vala')
-rw-r--r-- | src/web.vala | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/web.vala b/src/web.vala index 81b8e67..7140c22 100644 --- a/src/web.vala +++ b/src/web.vala @@ -495,8 +495,16 @@ public class WebServer { string restocks = ""; foreach(var e in db.get_restocks(id)) { var time = new DateTime.from_unix_local(e.timestamp); - restocks += "<tr><td>%s</td><td>%d</td><td>%s€</td></tr>".printf( - time.format("%Y-%m-%d %H:%M"), e.amount, e.price + var supplier = db.get_supplier(e.supplier).name; + if(supplier == "Unknown") + supplier = ""; + string bbd; + if(e.best_before_date > 0) + bbd = (new DateTime.from_unix_local(e.best_before_date)).format("%Y-%m-%d"); + else + bbd = ""; + restocks += "<tr><td>%s</td><td>%d</td><td>%s€</td><td>%s</td><td>%s</td></tr>".printf( + time.format("%Y-%m-%d %H:%M"), e.amount, e.price, supplier, bbd ); } t.replace("RESTOCKS", restocks); |