This commit is contained in:
Bryce Covert
2018-09-03 13:12:20 -07:00
parent da97d730ad
commit fe5d09c02b
8 changed files with 29 additions and 13 deletions

View File

@@ -13,7 +13,8 @@
(defn raw-graphql [args]
(->> (d/query
(cond-> {:query {:find ['(pull ?e [* {:transaction/client [:client/name :db/id]}])]
(cond-> {:query {:find ['(pull ?e [* {:transaction/client [:client/name :db/id]
:transaction/bank-account [:bank-account/name :bank-account/yodlee-account-id]}])]
:in ['$]
:where ['[?e :transaction/original-id]]}
:args [(d/db (d/connect uri))]}

View File

@@ -80,7 +80,7 @@
:else
q)))
(defn base-graphql [{:keys [company-id vendor-id check-number bank-account-id status amount id]}]
(defn base-graphql [{:keys [company-id vendor-id check-number bank-account-id status amount id statuses]}]
(cond-> base-query
(limited-companies id) (helpers/merge-where [:in :company-id (limited-companies id)])
@@ -89,7 +89,8 @@
(not (nil? vendor-id)) (helpers/merge-where [:= :vendor-id vendor-id])
(not (nil? check-number)) (helpers/merge-where [:= :check-number check-number])
(not (nil? status)) (helpers/merge-where [:= :status status])
(not (nil? amount)) (helpers/merge-where [:= :amount amount])))
(not (nil? amount)) (helpers/merge-where [:= :amount amount])
(seq statuses ) (helpers/merge-where [:in :status statuses])))
(defn get-graphql [{:keys [start sort-by asc id limit] :as args :or {limit 20}}]
(query

View File

@@ -142,9 +142,10 @@
(defn base-graphql [{:keys [imported company-id status id]}]
(defn base-graphql [{:keys [imported company-id status id statuses]}]
(cond-> base-query
(limited-companies id) (helpers/merge-where [:in :company-id (limited-companies id)])
(seq statuses ) (helpers/merge-where [:in :status statuses])
(not (nil? imported)) (helpers/merge-where [:= :imported imported])
(not (nil? status)) (helpers/merge-where [:= :status status])
(not (nil? company-id)) (helpers/merge-where [:= :company-id company-id])))
@@ -152,6 +153,7 @@
(defn get-graphql [{:keys [start sort-by asc limit] :as args :or {limit 20}}]
(query
(cond-> (base-graphql args)
true (add-sort-by sort-by asc)
true (assoc :limit limit)
start (assoc :offset start))))

View File

@@ -63,7 +63,8 @@
:check_number {:type 'Int}
:name {:type 'String}
:bank_code {:type 'String}
:bank_name {:type 'String}}}
:bank_name {:type 'String}
:yodlee_account_id {:type 'Int}}}
:address
{:fields {:street1 {:type 'String}
:street2 {:type 'String}
@@ -130,6 +131,8 @@
:status {:type 'String}
:client {:type :client}
:payment {:type :payment}
:bank_account {:type :bank_account
:resolve :bank-account-for-check}
:date {:type 'String}
:post_date {:type 'String}}}
:invoice_payment
@@ -167,6 +170,7 @@
:total {:type 'String}
:outstanding_balance {:type 'String}
:invoice_number {:type 'String}
:status {:type 'String}
:expense_accounts {:type '(list :invoices_expense_accounts)}
:date {:type 'String}
:company_id {:type 'Int}
@@ -216,12 +220,14 @@
:all_invoices {:type '(list :invoice)
:args {:client_id {:type 'String}
:original_id {:type 'Int}}
:original_id {:type 'Int}
:statuses {:type '(list String)}}
:resolve :get-all-invoices}
:all_payments {:type '(list :payment)
:args {:client_id {:type 'String}
:original_id {:type 'Int}}
:original_id {:type 'Int}
:statuses {:type '(list String)}}
:resolve :get-all-payments}
:transaction_page {:type '(list :transaction_page)

View File

@@ -30,7 +30,7 @@
(let [query [[:all_invoices
{:client-id (query-params "client")
:original-id (query-params "original")}
[:id :total :outstanding-balance :invoice-number :date
[:id :total :outstanding-balance :invoice-number :date :status
[:payments [:amount [:payment [:check-number :memo [:bank_account [:id :number :bank-name :bank-code]]]]]]
[:vendor [:name :id [:primary_contact [:name]] [:address [:street1 :city :state :zip]]]]
[:expense_accounts [:amount :id :expense_account_id :location
@@ -43,7 +43,7 @@
(let [query [[:all_payments
{:client-id (query-params "client")
:original-id (query-params "original")}
[:id :check-number :amount :memo :date
[:id :check-number :amount :memo :date :status
[:invoices [[:invoice [:id]] :amount]]
[:bank-account [:number :bank-name :bank-code :id]]
[:vendor [:name :id [:primary-contact [:name :email :phone]] :default-expense-account [:address [:street1 :city :state :zip]]]]

View File

@@ -93,7 +93,7 @@
(defn manual-import [manual-transactions company-id]
(let [transformed-transactions (->> manual-transactions
(filter #(= "posted" (:status %)))
(group-by #(select-keys % [:date :original-description :amount]))
(group-by #(select-keys % [:date :description-original :amount]))
(vals)

View File

@@ -41,7 +41,8 @@
:status
:description_original
[:payment [:check_number :s3_url]]
[:client [:name :id]]]]
[:client [:name :id]]
[:bank-account [:name :yodlee-account-id]]]]
:total
:start
:end]]]}
@@ -68,7 +69,7 @@
(let [{:keys [sort-by asc]} @state
{:keys [transactions start end count total]} @transaction-page
selected-company @(re-frame/subscribe [::subs/company])
percentage-size (if selected-company "100%" "50%")]
percentage-size (if selected-company "25%" "33%")]
[:div
[paginator {:start start :end end :count count :total total
:on-change (fn [p ]
@@ -111,6 +112,8 @@
:sort-by sort-by
:asc asc}
"Status"]
[:th {:width percentage-size} "Bank account"]
[:th {:width percentage-size} "Yodlee bank account"]
[:th {:style {:width "10em"}} "" ]]]
@@ -119,7 +122,7 @@
[:tr
[:td {:col-span 5}
[:i.fa.fa-spin.fa-spinner]]]
(for [{:keys [client check status description-original date amount id ] :as i} (:transactions @transaction-page)]
(for [{:keys [client check status bank-account description-original date amount id ] :as i} (:transactions @transaction-page)]
^{:key id}
[:tr {:class (:class i)}
@@ -129,6 +132,8 @@
[:td (date->str date) ]
[:td (gstring/format "$%.2f" amount )]
[:td status]
[:td (:name bank-account )]
[:td (:yodlee-account-id bank-account )]
[:td