remove excluded from ledger.

This commit is contained in:
Bryce Covert
2019-05-19 08:06:21 -07:00
parent 9396bbb7eb
commit cf2319b681
19 changed files with 3508 additions and 144 deletions

3376
resources/IconFont.json Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 266 KiB

After

Width:  |  Height:  |  Size: 215 KiB

View File

@@ -1,10 +1,10 @@
@font-face {
font-family: 'icomoon';
src: url('fonts/icomoon.eot?wfctkz');
src: url('fonts/icomoon.eot?wfctkz#iefix') format('embedded-opentype'),
url('fonts/icomoon.ttf?wfctkz') format('truetype'),
url('fonts/icomoon.woff?wfctkz') format('woff'),
url('fonts/icomoon.svg?wfctkz#icomoon') format('svg');
src: url('fonts/icomoon.eot?z8rl1o');
src: url('fonts/icomoon.eot?z8rl1o#iefix') format('embedded-opentype'),
url('fonts/icomoon.ttf?z8rl1o') format('truetype'),
url('fonts/icomoon.woff?z8rl1o') format('woff'),
url('fonts/icomoon.svg?z8rl1o#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
@@ -24,6 +24,18 @@
-moz-osx-font-smoothing: grayscale;
}
.icon-task-list-check-1:before {
content: "\e90b";
}
.icon-task-list-disable:before {
content: "\e91c";
}
.icon-task-list-text-1:before {
content: "\e922";
}
.icon-task-list-question:before {
content: "\e92a";
}
.icon-list-bullets:before {
content: "\e967";
}
@@ -96,18 +108,12 @@
.icon-cash-payment-coin-1:before {
content: "\e90a";
}
.icon-cash-payment-coin-stash:before {
content: "\e90b";
}
.icon-cash-payment-coin:before {
content: "\e90c";
}
.icon-cash-payment-coins:before {
content: "\e90d";
}
.icon-cash-payment-person:before {
content: "\e90e";
}
.icon-cash-payment-wallet:before {
content: "\e90f";
}
@@ -129,27 +135,9 @@
.icon-credit-card-amex:before {
content: "\e915";
}
.icon-credit-card-check:before {
content: "\e916";
}
.icon-credit-card-disable:before {
content: "\e917";
}
.icon-credit-card-dollar-1:before {
content: "\e918";
}
.icon-credit-card-dollar:before {
content: "\e919";
}
.icon-credit-card-flag:before {
content: "\e91a";
}
.icon-credit-card-give:before {
content: "\e91b";
}
.icon-credit-card-laptop-payment:before {
content: "\e91c";
}
.icon-credit-card-lock:before {
content: "\e91d";
}
@@ -165,9 +153,6 @@
.icon-credit-card-payment:before {
content: "\e921";
}
.icon-credit-card-phone-call:before {
content: "\e922";
}
.icon-credit-card-remove:before {
content: "\e923";
}
@@ -189,9 +174,6 @@
.icon-credit-card:before {
content: "\e929";
}
.icon-saving-bag-increase:before {
content: "\e92a";
}
.icon-saving-bank-1:before {
content: "\e92b";
}
@@ -210,33 +192,6 @@
.icon-saving-bear:before {
content: "\e930";
}
.icon-saving-bull-decrease:before {
content: "\e931";
}
.icon-saving-bull-increase:before {
content: "\e932";
}
.icon-saving-bull:before {
content: "\e933";
}
.icon-saving-dog-guard-decrease:before {
content: "\e934";
}
.icon-saving-dog-guard-increase:before {
content: "\e935";
}
.icon-saving-money-egg:before {
content: "\e936";
}
.icon-saving-money-flower:before {
content: "\e937";
}
.icon-saving-money-seedling:before {
content: "\e938";
}
.icon-saving-money-tree:before {
content: "\e939";
}
.icon-saving-piggy-bank:before {
content: "\e93a";
}
@@ -276,12 +231,6 @@
.icon-accounting-coins-bill:before {
content: "\e946";
}
.icon-accounting-coins-stack-1:before {
content: "\e947";
}
.icon-accounting-coins-stack:before {
content: "\e948";
}
.icon-accounting-withdraw:before {
content: "\e949";
}
@@ -315,9 +264,6 @@
.icon-accounting-abacus:before {
content: "\e953";
}
.icon-accounting-calculator-1:before {
content: "\e954";
}
.icon-accounting-calculator-2:before {
content: "\e955";
}

View File

@@ -397,6 +397,7 @@
{:db/ident :transaction-approval-status/approved}
{:db/ident :transaction-approval-status/unapproved}
{:db/ident :transaction-approval-status/requires-feedback}
{:db/ident :transaction-approval-status/excluded}
]])
(def add-credit-bank-account

View File

@@ -66,6 +66,11 @@
'[(<= ?date ?end-date)]]}
:args [(coerce/to-date (:end (:date-range args)))]})
(:approval-status args)
(merge-query {:query {:in ['?approval-status]
:where ['[?e :transaction/approval-status ?approval-status]]}
:args [(:approval-status args)]})
(:client-code args)
(merge-query {:query {:in ['?client-code]
:where ['[?e :transaction/client ?client-id]

View File

@@ -180,7 +180,6 @@
:description_original {:type 'String}
:description_simple {:type 'String}
:location {:type 'String}
:exclude_from_ledger {:type 'Boolean}
:status {:type 'String}
:yodlee_merchant {:type :yodlee_merchant}
:client {:type :client}
@@ -387,7 +386,8 @@
:date_range {:type :date_range}
:start {:type 'Int}
:sort_by {:type 'String}
:asc {:type 'Boolean}}
:asc {:type 'Boolean}
:approval_status {:type :transaction_approval_status}}
:resolve :get-transaction-page}
@@ -528,7 +528,6 @@
:total {:type 'Float}}}
:edit_transaction
{:fields {:id {:type :id}
:exclude_from_ledger {:type 'Boolean}
:vendor_id {:type :id}
:approval_status {:type :transaction_approval_status}
:accounts {:type '(list :edit_expense_account)}}}
@@ -576,7 +575,8 @@
{:enum-value :revenue}]}
:transaction_approval_status {:values [{:enum-value :approved}
{:enum-value :unapproved}
{:enum-value :requires_feedback}]}}
{:enum-value :requires_feedback}
{:enum-value :excluded}]}}
:mutations
{:reject_invoices {:type '(list :id)
:args {:invoices {:type '(list :id)}}

View File

@@ -26,7 +26,11 @@
(defn get-transaction-page [context args value]
(let [args (assoc args :id (:id context))
[transactions transactions-count] (d-transactions/get-graphql (<-graphql args))
[transactions transactions-count] (d-transactions/get-graphql (update (<-graphql args) :approval-status
#(some->> %
name
snake->kebab
(keyword "transaction-approval-status"))))
transactions (map ->graphql (map approval-status->graphql transactions))]
[{:transactions transactions
:total transactions-count
@@ -51,7 +55,7 @@
set)]
(set/difference existing-ids specified-ids)))
(defn edit-transaction [context {{:keys [id exclude_from_ledger accounts vendor_id approval_status] :as transaction} :transaction} value]
(defn edit-transaction [context {{:keys [id accounts vendor_id approval_status] :as transaction} :transaction} value]
(let [existing-transaction (d-transactions/get-by-id id)
_ (assert-can-see-client (:id context) (:transaction/client existing-transaction) )
deleted (deleted-accounts existing-transaction accounts)
@@ -79,7 +83,6 @@
name
snake->kebab
(keyword "transaction-approval-status"))
:transaction/exclude-from-ledger exclude_from_ledger
:transaction/accounts (map transaction-account->entity accounts)
})]
(map (fn [d]

View File

@@ -58,6 +58,7 @@
[db [type id]]
(let [entity (d/pull db ['* {:transaction/vendor '[*]
:transaction/client '[*]
:transaction/approval-status '[*]
:transaction/bank-account '[* {:bank-account/type [:db/ident]}]
:transaction/accounts '[*
{:transaction-account/account [*]}] }] id)
@@ -65,7 +66,7 @@
decreasing? (< (:transaction/amount entity) 0.0)
credit-from-bank? decreasing?
debit-from-bank? (not decreasing?)]
(when-not (:transaction/exclude-from-ledger entity)
(when-not (= :transaction-approval-status/excluded (:db/ident (:transaction/approval-status entity)))
(remove-nils
{:journal-entry/source "transaction"
:journal-entry/client (:db/id (:transaction/client entity))

View File

@@ -93,7 +93,7 @@
:amount (double amount)
:description-original description-original
:description-simple description-simple
:exclude-from-ledger false
:approval-status :transaction-approval-status/unapproved
:type type
:status status
:client client-id

View File

@@ -21,7 +21,12 @@
"paid" :paid-invoices
"voided" :voided-invoices
"new" :new-invoice}
"transactions/" {"" :transactions}
"transactions/" {"" :transactions
"unapproved" :unapproved-transactions
"approved" :approved-transactions
"requires-feedback" :requires-feedback-transactions
"excluded" :excluded-transactions}
"ledger/" {"" :ledger
"profit-and-loss" :profit-and-loss
"balance-sheet" :balance-sheet

View File

@@ -49,7 +49,20 @@
(checks-page))
(defmethod page :transactions [_]
(transactions-page))
(transactions-page {}))
(defmethod page :unapproved-transactions [_]
[transactions-page {:approval-status :unapproved}])
(defmethod page :approved-transactions [_]
[transactions-page {:approval-status :approved}])
(defmethod page :requires-feedback-transactions [_]
[transactions-page {:approval-status :requires-feedback}])
(defmethod page :excluded-transactions [_]
[transactions-page {:approval-status :excluded}])
(defmethod page :ledger [_]
(ledger-page))

View File

@@ -299,7 +299,8 @@
:field [:transaction-approval-status]
:options [[:unapproved "Unapproved"]
[:requires-feedback "Client Review"]
[:approved "Approved"]]}]]
[:approved "Approved"]
[:excluded "Excluded from Ledger"]]}]]
[:div.is-divider]

View File

@@ -2,6 +2,8 @@
(:require [auto-ap.events :as events]
[auto-ap.forms :as forms]
[auto-ap.subs :as subs]
[bidi.bidi :as bidi]
[auto-ap.routes :as routes]
[auto-ap.views.components.bank-account-filter :refer [bank-account-filter]]
[auto-ap.views.components.date-range-filter :refer [date-range-filter]]
[auto-ap.views.components.layouts :refer [appearing-side-bar side-bar-layout]]
@@ -13,7 +15,7 @@
[auto-ap.views.pages.transactions.common :refer [transaction-read]]
[auto-ap.utils :refer [replace-by]]
[auto-ap.views.pages.transactions.manual :as manual]
[auto-ap.views.utils :refer [bind-field date->str dispatch-event nf date-picker]]
[auto-ap.views.utils :refer [bind-field date->str dispatch-event nf date-picker active-when]]
[goog.string :as gstring]
[re-frame.core :as re-frame]))
@@ -95,7 +97,7 @@
(fn [db]
(-> db ::notification)))
(def transactions-content
(defn content [{:keys [approval-status]}]
(with-meta
(fn []
(let [notification (re-frame/subscribe [::notification])
@@ -127,12 +129,56 @@
:on-params-change (fn [params]
(re-frame/dispatch [::params-change params]))}]
]))
{:component-will-mount #(re-frame/dispatch-sync [::params-change {}]) }))
{:component-will-mount #(re-frame/dispatch-sync [::params-change {:approval-status approval-status}]) }))
(defn transactions-page []
(let [{transaction-bar-active? :active?} @(re-frame/subscribe [::forms/form ::edit/form])]
(def main-content {nil (content {:approval-status nil})
:unapproved (content {:approval-status :unapproved})
:requires-feedback (content {:approval-status :requires-feedback})
:approved (content {:approval-status :approved})
:excluded (content {:approval-status :excluded})})
(defn transactions-page [{:keys [approval-status]}]
(let [{transaction-bar-active? :active?} @(re-frame/subscribe [::forms/form ::edit/form])
ap @(re-frame/subscribe [::subs/active-page])]
[side-bar-layout
{:side-bar [:div
{:side-bar
[:div
[:div [:p.menu-label "Type"]
[:ul.menu-list
[:li.menu-item
[:a.item {:href (bidi/path-for routes/routes :transactions)
:class [(active-when ap = :transactions)]}
[:span {:class "icon" :style {:font-size "25px"}}]
[:span {:class "name"} "All"]]]
[:li.menu-item
[:a.item {:href (bidi/path-for routes/routes :unapproved-transactions)
:class [(active-when ap = :unapproved-transactions)]}
[:span {:class "icon icon-task-list-text-1" :style {:font-size "25px"}}]
[:span {:class "name"} "Unapproved"]]]
[:li.menu-item
[:a.item {:href (bidi/path-for routes/routes :requires-feedback-transactions)
:class [(active-when ap = :requires-feedback-transactions)]}
[:span {:class "icon icon-task-list-question" :style {:font-size "25px"}}]
[:span {:class "name"} "Client Review"]]]
[:li.menu-item
[:a.item {:href (bidi/path-for routes/routes :approved-transactions)
:class [(active-when ap = :approved-transactions)]}
[:span {:class "icon icon-task-list-check-1" :style {:font-size "25px"}}]
[:span {:class "name"} "Approved"]]]
[:li.menu-item
[:a.item {:href (bidi/path-for routes/routes :excluded-transactions)
:class [(active-when ap = :excluded-transactions)]}
[:span {:class "icon icon-task-list-disable" :style {:font-size "25px"}}]
[:span {:class "name"} "Excluded"]]]
]]
[:p.menu-label "Bank Account"]
[:div
[bank-account-filter
@@ -144,7 +190,7 @@
[date-range-filter
{:on-change-event [::change-selected-date-range]
:value (:date-range-filter @(re-frame/subscribe [::transaction-page]))}]]]
:main [transactions-content]
:main [(get main-content approval-status)]
:bottom [:div
[manual/modal {:import-completed [::manual-import-completed ]}]]

View File

@@ -4,7 +4,6 @@
[:id
:amount
:location
:exclude-from-ledger
:approval-status
[:matched-rule [:note :id]]
[:vendor [:name :id]]

View File

@@ -15,14 +15,13 @@
(re-frame/reg-sub
::submit-query
:<- [::forms/form ::form]
(fn [{{:keys [id vendor accounts exclude-from-ledger approval-status]} :data}]
(fn [{{:keys [id vendor accounts approval-status]} :data}]
{:venia/operation {:operation/type :mutation
:operation/name "EditTransaction"}
:venia/queries [{:query/data
[:edit-transaction
{:transaction {:id id
:vendor-id (:id vendor)
:exclude-from-ledger exclude-from-ledger
:approval-status approval-status
:accounts (map
(fn [{:keys [id account amount location]}]
@@ -51,7 +50,7 @@
(-> which
(select-keys [:vendor :amount :payment :client :description-original
:yodlee-merchant :id :potential-payment-matches
:exclude-from-ledger :location :accounts :approval-status
:location :accounts :approval-status
:matched-rule])
(assoc :potential-payment-matches (if (:matched-rule which)
nil
@@ -243,21 +242,7 @@
:locations locations}]]
[:div.field
[:label.checkbox
[raw-field
[:input
{:type "checkbox"
:field [:exclude-from-ledger]}]]
" Exclude from ledger"]]
[field "Include in ledger"
[button-radio
{:type "button-radio"
:field [:exclude-from-ledger]
:options [[true "Exclude from Ledger"]
[false "Include in Ledger"]
]}]]
[field "Approval Status"
[button-radio
@@ -265,7 +250,8 @@
:field [:approval-status]
:options [[:unapproved "Unapproved"]
[:requires-feedback "Client Review"]
[:approved "Approved"]]}]]
[:approved "Approved"]
[:excluded "Excluded from Ledger"]]}]]
[:hr]

View File

@@ -53,7 +53,7 @@
:name "456"}
:status "PENDING"
:id "6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b"
:exclude-from-ledger false
:approval-status :transaction-approval-status/unapproved
:description-simple "simple-description"}]
result))))