lots of new features.

This commit is contained in:
Bryce Covert
2020-05-30 10:31:46 -07:00
parent d9bf9867e4
commit 3101dd1fe6
11 changed files with 61 additions and 23 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@@ -96,6 +96,13 @@
{:bank-account/type [*]}]}]}] {:bank-account/type [*]}]}]}]
ids) ids)
(map #(update % :journal-entry/date c/from-date)) (map #(update % :journal-entry/date c/from-date))
(filter (fn [je]
(every?
(fn [jel]
(let [include-in-reports (-> jel :journal-entry-line/account :bank-account/include-in-reports)]
(or (nil? include-in-reports)
(true? include-in-reports))))
(:journal-entry/line-items je))))
(group-by :db/id))] (group-by :db/id))]
(->> ids (->> ids
(map results) (map results)

View File

@@ -71,6 +71,21 @@
(seq vs) (conj {:db/id e (seq vs) (conj {:db/id e
a vs})))})}]]) a vs})))})}]])
(defn add-include-in-reports [conn]
(let [existing-accounts (->> (d/query {:query {:find ['?e]
:in ['$]
:where ['[?e :bank-account/name]]}
:args [(d/db conn)]})
(transduce
(comp
(map first)
(map (fn [bank-account]
{:db/id bank-account :bank-account/include-in-reports true})))
conj
[]))]
[existing-accounts]))
(defn -main [& args] (defn -main [& args]
(println "Creating database ..." uri) (println "Creating database ..." uri)
(doto (d/create-database uri) println) (doto (d/create-database uri) println)
@@ -257,7 +272,13 @@
:db/doc "An identifier for this forcasted transaction, e.g., 'RENT'" :db/doc "An identifier for this forcasted transaction, e.g., 'RENT'"
:db/valueType :db.type/string :db/valueType :db.type/string
:db/cardinality :db.cardinality/one}]]} :db/cardinality :db.cardinality/one}]]}
:auto-ap/add-manager-schema {:txes [[{:db/ident :user-role/manager}]]}} :auto-ap/add-manager-schema {:txes [[{:db/ident :user-role/manager}]]}
:auto-ap/add-include-in-reports1 {:txes [[{:db/ident :bank-account/include-in-reports
:db/doc "Whether to include this bank account in balance sheet, etc."
:db/valueType :db.type/boolean
:db/cardinality :db.cardinality/one}]]
:depends-on [:auto-ap/add-manager-schema]}
:auto-ap/migrate-include-in-reports {:txes-fn `add-include-in-reports :depends-on [:auto-ap/add-include-in-reports1] }}
] ]
(println "Conforming database...") (println "Conforming database...")
(c/ensure-conforms conn norms-map) (c/ensure-conforms conn norms-map)

View File

@@ -85,6 +85,7 @@
:number {:type 'String} :number {:type 'String}
:sort_order {:type 'Int} :sort_order {:type 'Int}
:visible {:type 'Boolean} :visible {:type 'Boolean}
:include_in_reports {:type 'Boolean}
:routing {:type 'String} :routing {:type 'String}
:code {:type 'String} :code {:type 'String}
:check_number {:type 'Int} :check_number {:type 'Int}
@@ -531,6 +532,7 @@
:number {:type 'String} :number {:type 'String}
:check_number {:type 'Int} :check_number {:type 'Int}
:visible {:type 'Boolean} :visible {:type 'Boolean}
:include_in_reports {:type 'Boolean}
:sort_order {:type 'Int} :sort_order {:type 'Int}
:name {:type 'String} :name {:type 'String}
:bank_code {:type 'String} :bank_code {:type 'String}

View File

@@ -51,6 +51,7 @@
:bank-account/bank-name (:bank_name %) :bank-account/bank-name (:bank_name %)
:bank-account/bank-code (:bank_code %) :bank-account/bank-code (:bank_code %)
:bank-account/routing (:routing %) :bank-account/routing (:routing %)
:bank-account/include-in-reports (:include_in_reports %)
:bank-account/name (:name %) :bank-account/name (:name %)
:bank-account/visible (:visible %) :bank-account/visible (:visible %)

View File

@@ -68,9 +68,9 @@
:id (str (:db/id account) "-" location) :id (str (:db/id account) "-" location)
:numeric-code (or (:account/numeric-code account) :numeric-code (or (:account/numeric-code account)
(and (#{:bank-account-type/check} (:db/ident (:bank-account/type account))) (and (#{:bank-account-type/check} (:db/ident (:bank-account/type account)))
1100) 11100)
(and (#{:bank-account-type/credit} (:db/ident (:bank-account/type account))) (and (#{:bank-account-type/credit} (:db/ident (:bank-account/type account)))
2800)) 28000))
:account-type (or (:db/ident (:account/type account)) :account-type (or (:db/ident (:account/type account))
({:bank-account-type/check :asset ({:bank-account-type/check :asset
:bank-account-type/credit :liability} :bank-account-type/credit :liability}

View File

@@ -131,7 +131,7 @@
(->> (g-tr/run-transaction-rule context {:transaction_rule_id transaction_rule_id (->> (g-tr/run-transaction-rule context {:transaction_rule_id transaction_rule_id
:count Integer/MAX_VALUE} nil) :count Integer/MAX_VALUE} nil)
(filter #(not (:transaction/payment %))) (filter #(not (:payment %)))
(map :id )) (map :id ))

View File

@@ -44,7 +44,7 @@
:graphql {:token token :graphql {:token token
:query-obj {:venia/queries [[:client :query-obj {:venia/queries [[:client
[:id :name :code :email :matches :locations [:location-matches [:location :match]] [:bank-accounts [:id :code :number :bank-name :bank-code :check-number :name :routing :type :sort-order :visible :yodlee-account-id :locations] ] [:id :name :code :email :matches :locations [:location-matches [:location :match]] [:bank-accounts [:id :code :number :bank-name :bank-code :check-number :name :routing :type :sort-order :visible :yodlee-account-id :locations :include-in-reports] ]
[:address [:street1 :street2 :city :state :zip]]]] [:address [:street1 :street2 :city :state :zip]]]]
[:vendor [:vendor
[:id :name :hidden [:default-account [:name :id :location]] [:primary-contact [:name :phone :email :id]] [:secondary-contact [:id :name :phone :email]] :print-as :invoice-reminder-schedule :code [:id :name :hidden [:default-account [:name :id :location]] [:primary-contact [:name :phone :email :id]] [:secondary-contact [:id :name :phone :email]] :print-as :invoice-reminder-schedule :code
@@ -71,7 +71,7 @@
(fn [{:keys [db]} [_ token user]] (fn [{:keys [db]} [_ token user]]
{:graphql {:token token {:graphql {:token token
:query-obj {:venia/queries [[:client :query-obj {:venia/queries [[:client
[:id :name :code :matches :locations [:location-matches [:location :match]] [:address [:street1 :street2 :city :state :zip]] [:bank-accounts [:id :code :number :bank-name :bank-code :check-number :name :routing :type :sort-order :visible :yodlee-account-id :locations] ]]] [:id :name :code :matches :locations [:location-matches [:location :match]] [:address [:street1 :street2 :city :state :zip]] [:bank-accounts [:id :code :number :bank-name :bank-code :check-number :name :routing :type :sort-order :visible :yodlee-account-id :locations :include-in-reports] ]]]
[:vendor [:vendor
[:id :name :hidden [:default-account [:name :id :location]] [:primary-contact [:name :phone :email :id]] [:secondary-contact [:id :name :phone :email]] :print-as :invoice-reminder-schedule :code]] [:id :name :hidden [:default-account [:name :id :location]] [:primary-contact [:name :phone :email :id]] [:secondary-contact [:id :name :phone :email]] :print-as :invoice-reminder-schedule :code]]
[:accounts [:numeric-code :name :location :type :account_set :applicability :id [:client-overrides [:name [:client [:name :id]]]]]]]} [:accounts [:numeric-code :name :location :type :account_set :applicability :id [:client-overrides [:name [:client [:name :id]]]]]]]}

View File

@@ -75,10 +75,9 @@
[:a.navbar-item {:class [(active-when ap = :payments)] [:a.navbar-item {:class [(active-when ap = :payments)]
:href (bidi/path-for routes/routes :payments)} :href (bidi/path-for routes/routes :payments)}
"Payments" ] "Payments" ]
(when (not= "manager" (:user/role @user)) [:a.navbar-item {:class [(active-when ap = :transactions)]
[:a.navbar-item {:class [(active-when ap = :transactions)] :href (bidi/path-for routes/routes :transactions)}
:href (bidi/path-for routes/routes :transactions)} "Transactions" ]
"Transactions" ])
(when (not= "manager" (:user/role @user)) (when (not= "manager" (:user/role @user))
[:a.navbar-item {:class [(active-when ap = :ledger)] [:a.navbar-item {:class [(active-when ap = :ledger)]

View File

@@ -50,10 +50,11 @@
:city (:city (:address new-client-data)) :city (:city (:address new-client-data))
:state (:state (:address new-client-data)) :state (:state (:address new-client-data))
:zip (:zip (:address new-client-data))} :zip (:zip (:address new-client-data))}
:bank-accounts (map (fn [{:keys [number name check-number type id code bank-name routing bank-code new? sort-order visible yodlee-account-id locations]}] :bank-accounts (map (fn [{:keys [number name check-number include-in-reports type id code bank-name routing bank-code new? sort-order visible yodlee-account-id locations]}]
{:number number {:number number
:name name :name name
:check-number check-number :check-number check-number
:include-in-reports include-in-reports
:type type :type type
:id id :id id
:sort-order sort-order :sort-order sort-order
@@ -415,7 +416,16 @@
[:ul [:ul
(for [location locations] (for [location locations]
^{:key location} [:li location ])] ^{:key location} [:li location ])]
[:i "This account applies to all locations"])]]) [:i "This account applies to all locations"])]
[:div.field
[:label.checkbox
[bind-field
[:input {:type "checkbox"
:field [:bank-accounts sort-order :include-in-reports]
:event change-event
:subscription new-client}]]
" Include in reports"]
]])
(when active? (when active?
[:footer.card-footer [:footer.card-footer

View File

@@ -162,15 +162,13 @@
params @(re-frame/subscribe [::params]) ;; Keep to make sure it doens'nt get disposed params @(re-frame/subscribe [::params]) ;; Keep to make sure it doens'nt get disposed
ap @(re-frame/subscribe [::subs/active-page]) ap @(re-frame/subscribe [::subs/active-page])
user (re-frame/subscribe [::subs/user])] user (re-frame/subscribe [::subs/user])]
(if (not= "manager" (:user/role @user)) [side-bar-layout
[side-bar-layout {:side-bar [side-bar/side-bar]
{:side-bar [side-bar/side-bar] :main [:div ^{:key approval-status}
:main [:div ^{:key approval-status} [content]]
[content]] :bottom [:div
:bottom [:div [manual/modal {:import-completed [::manual-import-completed ]}]]
[manual/modal {:import-completed [::manual-import-completed ]}]] :right-side-bar [appearing-side-bar
:right-side-bar [appearing-side-bar {:visible? transaction-bar-active?}
{:visible? transaction-bar-active?} [edit/form {:edit-completed [::edit-completed]}]]}]))}))
[edit/form {:edit-completed [::edit-completed]}]]}]
[:div "Not authorized"])))}))