basic partition by company.

This commit is contained in:
Bryce Covert
2017-12-12 12:40:07 -08:00
parent 198c1a39a3
commit 5b8d25bf8f
6 changed files with 112 additions and 51 deletions

View File

@@ -17,8 +17,12 @@
(defn reject []
(j/delete! conn :invoices ["imported = false"]))
(defn get-unpaid []
(map db->clj (j/query conn "SELECT * FROM invoices WHERE imported=true")))
(defn get-unpaid [company]
(if company
(map db->clj (j/query conn ["SELECT * FROM invoices WHERE imported=true AND company = ?" company]))
(map db->clj (j/query conn "SELECT * FROM invoices WHERE imported=true"))))
(defn get-pending []
(map db->clj (j/query conn "SELECT * FROM invoices WHERE imported=false or imported is null")))
(defn get-pending [company]
(if company
(map db->clj (j/query conn ["SELECT * FROM invoices WHERE (imported=false or imported is null) AND company = ?" company]))
(map db->clj (j/query conn"SELECT * FROM invoices WHERE imported=false or imported is null"))))