Adds ability to filter by category, adds invoice allowance as an account option
This commit is contained in:
@@ -7,10 +7,13 @@
|
||||
[clojure.tools.logging :as log]))
|
||||
|
||||
(defn <-datomic [a]
|
||||
(update a :account/applicability :db/ident))
|
||||
(-> a
|
||||
(update :account/applicability :db/ident)
|
||||
(update :account/invoice-allowance :db/ident)))
|
||||
|
||||
(def default-read ['* {:account/type [:db/ident :db/id]
|
||||
:account/applicability [:db/ident :db/id]
|
||||
:account/invoice-allowance [:db/ident :db/id]
|
||||
:account/client-overrides [:db/id
|
||||
:account-client-override/name
|
||||
{:account-client-override/client [:db/id :client/name]}]}])
|
||||
|
||||
@@ -166,97 +166,108 @@
|
||||
{:db/id i
|
||||
:account-client-override/search-terms n})))])
|
||||
|
||||
(defn backfill-account-options [conn]
|
||||
[(->> (d/q '[:find [?a ...]
|
||||
:in $
|
||||
:where [?a :account/name]]
|
||||
(d/db conn))
|
||||
(map (fn [i]
|
||||
{:db/id i
|
||||
:account/invoice-allowance :allowance/allowed})))
|
||||
])
|
||||
|
||||
|
||||
(defn migrate [conn]
|
||||
(let [
|
||||
norms-map (merge {:auto-ap/base-schema {:txes auto-ap.datomic/base-schema}
|
||||
:auto-ap/functions {:txes-fn 'auto-ap.datomic.migrate/functions
|
||||
:requires [:auto-ap/base-schema]}
|
||||
:auto-ap/fx-pay-function-10 {:txes-fn 'auto-ap.datomic.migrate/fix-pay-function
|
||||
:requires [:auto-ap/functions]}
|
||||
:auto-ap/migrate-vendors {:txes-fn 'auto-ap.datomic/migrate-vendors
|
||||
norms-map (merge {:auto-ap/base-schema {:txes auto-ap.datomic/base-schema}
|
||||
:auto-ap/functions {:txes-fn 'auto-ap.datomic.migrate/functions
|
||||
:requires [:auto-ap/base-schema]}
|
||||
:auto-ap/fx-pay-function-10 {:txes-fn 'auto-ap.datomic.migrate/fix-pay-function
|
||||
:requires [:auto-ap/functions]}
|
||||
:auto-ap/migrate-vendors {:txes-fn 'auto-ap.datomic/migrate-vendors
|
||||
:requires [:auto-ap/base-schema]}
|
||||
:auto-ap/migrate-clients {:txes-fn 'auto-ap.datomic/migrate-clients
|
||||
:auto-ap/migrate-clients {:txes-fn 'auto-ap.datomic/migrate-clients
|
||||
:requires [:auto-ap/migrate-vendors]}
|
||||
:auto-ap/migrate-users {:txes-fn 'auto-ap.datomic/migrate-users
|
||||
:auto-ap/migrate-users {:txes-fn 'auto-ap.datomic/migrate-users
|
||||
:requires [:auto-ap/migrate-clients]}
|
||||
:auto-ap/migrate-invoices {:txes-fn 'auto-ap.datomic/migrate-invoices
|
||||
:auto-ap/migrate-invoices {:txes-fn 'auto-ap.datomic/migrate-invoices
|
||||
:requires [:auto-ap/migrate-vendors :auto-ap/migrate-clients]}
|
||||
:auto-ap/migrate-payments {:txes-fn 'auto-ap.datomic/migrate-payments
|
||||
:auto-ap/migrate-payments {:txes-fn 'auto-ap.datomic/migrate-payments
|
||||
:requires [:auto-ap/migrate-invoices]}
|
||||
:auto-ap/migrate-invoices-payments {:txes-fn 'auto-ap.datomic/migrate-invoices-payments
|
||||
:auto-ap/migrate-invoices-payments {:txes-fn 'auto-ap.datomic/migrate-invoices-payments
|
||||
:requires [:auto-ap/migrate-payments :auto-ap/migrate-invoices]}
|
||||
:auto-ap/migrate-invoices-expense-accounts {:txes-fn 'auto-ap.datomic/migrate-invoices-expense-accounts
|
||||
:auto-ap/migrate-invoices-expense-accounts {:txes-fn 'auto-ap.datomic/migrate-invoices-expense-accounts
|
||||
:requires [:auto-ap/migrate-invoices-payments]}
|
||||
:auto-ap/migrate-transactions {:txes-fn 'auto-ap.datomic/migrate-transactions
|
||||
:auto-ap/migrate-transactions {:txes-fn 'auto-ap.datomic/migrate-transactions
|
||||
:requires [:auto-ap/migrate-invoices-expense-accounts]}
|
||||
:auto-ap/add-client-codes {:txes-fn 'auto-ap.datomic.migrate.add-client-codes/add-client-codes
|
||||
:auto-ap/add-client-codes {:txes-fn 'auto-ap.datomic.migrate.add-client-codes/add-client-codes
|
||||
:requires [:auto-ap/migrate-transactions]}
|
||||
:auto-ap/add-bank-account-codes-schema {:txes-fn 'auto-ap.datomic.migrate.add-bank-account-codes/add-bank-account-codes-schema
|
||||
:auto-ap/add-bank-account-codes-schema {:txes-fn 'auto-ap.datomic.migrate.add-bank-account-codes/add-bank-account-codes-schema
|
||||
:requires [:auto-ap/add-client-codes]}
|
||||
:auto-ap/add-bank-account-codes {:txes-fn 'auto-ap.datomic.migrate.add-bank-account-codes/add-bank-account-codes
|
||||
:auto-ap/add-bank-account-codes {:txes-fn 'auto-ap.datomic.migrate.add-bank-account-codes/add-bank-account-codes
|
||||
:requires [:auto-ap/add-bank-account-codes-schema]}
|
||||
:auto-ap/add-nick-the-greek {:txes [[{:client/name "Nick the Greek" :client/code "NGAK" :client/locations ["MH"] :client/bank-accounts [{:bank-account/code "NGAK-0" :bank-account/type :bank-account-type/cash :bank-account/name "Cash"}]}]]
|
||||
:auto-ap/add-nick-the-greek {:txes [[{:client/name "Nick the Greek" :client/code "NGAK" :client/locations ["MH"] :client/bank-accounts [{:bank-account/code "NGAK-0" :bank-account/type :bank-account-type/cash :bank-account/name "Cash"}]}]]
|
||||
:requires [:auto-ap/add-bank-account-codes]}
|
||||
:auto-ap/rename-codes-1 {:txes-fn 'auto-ap.datomic.migrate.rename-codes/rename-codes-1
|
||||
:auto-ap/rename-codes-1 {:txes-fn 'auto-ap.datomic.migrate.rename-codes/rename-codes-1
|
||||
:requires [:auto-ap/add-nick-the-greek]}
|
||||
:auto-ap/invoice-converter {:txes auto-ap.datomic.migrate.invoice-converter/add-matches
|
||||
:auto-ap/invoice-converter {:txes auto-ap.datomic.migrate.invoice-converter/add-matches
|
||||
:requires [:auto-ap/rename-codes-1]}
|
||||
:auto-ap/starter {:txes-fn 'auto-ap.datomic.migrate.invoice-converter/add-starter
|
||||
:auto-ap/starter {:txes-fn 'auto-ap.datomic.migrate.invoice-converter/add-starter
|
||||
:requires [:auto-ap/invoice-converter]}
|
||||
:auto-ap/add-default-location {:txes-fn 'auto-ap.datomic.migrate.invoice-converter/add-default-location
|
||||
:auto-ap/add-default-location {:txes-fn 'auto-ap.datomic.migrate.invoice-converter/add-default-location
|
||||
:requires [:auto-ap/invoice-converter]}
|
||||
:auto-ap/add-default-location-2 {:txes-fn 'auto-ap.datomic.migrate.invoice-converter/add-default-location-2
|
||||
:auto-ap/add-default-location-2 {:txes-fn 'auto-ap.datomic.migrate.invoice-converter/add-default-location-2
|
||||
:requires [:auto-ap/add-default-location]}
|
||||
:auto-ap/add-import-status {:txes auto-ap.datomic.migrate.invoice-converter/add-import-status
|
||||
:auto-ap/add-import-status {:txes auto-ap.datomic.migrate.invoice-converter/add-import-status
|
||||
:requires [:auto-ap/add-default-location-2]}
|
||||
:auto-ap/add-import-status-existing-invoices {:txes-fn 'auto-ap.datomic.migrate.invoice-converter/add-import-status-existing-invoices
|
||||
:requires [:auto-ap/add-import-status]}
|
||||
:auto-ap/fix-check-numbers {:txes-fn 'auto-ap.datomic.migrate.check-numbers/fix-check-numbers
|
||||
:auto-ap/fix-check-numbers {:txes-fn 'auto-ap.datomic.migrate.check-numbers/fix-check-numbers
|
||||
:requires [:auto-ap/add-import-status-existing-invoices]}
|
||||
:auto-ap/add-account-visibility-fields {:txes-fn 'auto-ap.datomic.migrate.account-sorting/add-account-visibility-fields
|
||||
:auto-ap/add-account-visibility-fields {:txes-fn 'auto-ap.datomic.migrate.account-sorting/add-account-visibility-fields
|
||||
:requires [:auto-ap/fix-check-numbers]}
|
||||
:auto-ap/make-every-account-visible {:txes-fn 'auto-ap.datomic.migrate.account-sorting/make-every-account-visible
|
||||
:auto-ap/make-every-account-visible {:txes-fn 'auto-ap.datomic.migrate.account-sorting/make-every-account-visible
|
||||
:requires [:auto-ap/add-account-visibility-fields]}
|
||||
:auto-ap/add-general-ledger6 {:txes add-general-ledger/add-general-ledger
|
||||
:auto-ap/add-general-ledger6 {:txes add-general-ledger/add-general-ledger
|
||||
:requires [:auto-ap/make-every-account-visible]}
|
||||
:auto-ap/add-general-ledger-fns2 {:txes-fn 'auto-ap.datomic.migrate.add-general-ledger/add-general-ledger-fns
|
||||
:auto-ap/add-general-ledger-fns2 {:txes-fn 'auto-ap.datomic.migrate.add-general-ledger/add-general-ledger-fns
|
||||
:requires [:auto-ap/add-general-ledger6]}
|
||||
:auto-ap/add-accounts {:txes auto-ap.datomic.migrate.add-general-ledger/add-accounts
|
||||
:auto-ap/add-accounts {:txes auto-ap.datomic.migrate.add-general-ledger/add-accounts
|
||||
:requires [:auto-ap/add-general-ledger-fns2]}
|
||||
:auto-ap/add-transaction-account {:txes auto-ap.datomic.migrate.add-general-ledger/add-transaction-account
|
||||
:auto-ap/add-transaction-account {:txes auto-ap.datomic.migrate.add-general-ledger/add-transaction-account
|
||||
:requires [:auto-ap/add-accounts]}
|
||||
:auto-ap/change-expense-account-to-entity {:txes auto-ap.datomic.migrate.add-general-ledger/change-expense-account-to-entity
|
||||
:auto-ap/change-expense-account-to-entity {:txes auto-ap.datomic.migrate.add-general-ledger/change-expense-account-to-entity
|
||||
:requires [:auto-ap/add-transaction-account]}
|
||||
:auto-ap/add-account-to-vendor {:txes auto-ap.datomic.migrate.add-general-ledger/add-account-to-vendor
|
||||
:auto-ap/add-account-to-vendor {:txes auto-ap.datomic.migrate.add-general-ledger/add-account-to-vendor
|
||||
:requires [:auto-ap/change-expense-account-to-entity]}
|
||||
:auto-ap/add-location-to-transaction {:txes add-general-ledger/add-location-to-transaction
|
||||
:auto-ap/add-location-to-transaction {:txes add-general-ledger/add-location-to-transaction
|
||||
:requires [:auto-ap/add-account-to-vendor]}
|
||||
:auto-ap/add-credit-bank-account {:txes add-general-ledger/add-credit-bank-account
|
||||
:auto-ap/add-credit-bank-account {:txes add-general-ledger/add-credit-bank-account
|
||||
:requires [:auto-ap/add-location-to-transaction]}
|
||||
:auto-ap/add-hidden-to-vendor {:txes-fn `add-general-ledger/add-hidden-to-vendor :requires [:auto-ap/add-credit-bank-account]}
|
||||
#_#_:auto-ap/convert-vendors {:txes-fn `add-general-ledger/convert-vendors
|
||||
:requires [:auto-ap/add-hidden-to-vendor]}
|
||||
#_#_:auto-ap/convert-invoices {:txes-fn `add-general-ledger/convert-invoices
|
||||
:requires [:auto-ap/convert-vendors]}
|
||||
:auto-ap/add-yodlee-merchant2 {:txes add-general-ledger/add-yodlee-merchant }
|
||||
:auto-ap/add-external-id-to-ledger {:txes add-general-ledger/add-external-id-to-ledger :requires [:auto-ap/add-yodlee-merchant2]}
|
||||
:auto-ap/add-exclude-to-transaction {:txes add-general-ledger/add-exclude-to-transaction :requires [:auto-ap/add-external-id-to-ledger]}
|
||||
:auto-ap/add-client-identifier2 {:txes add-client-identifier :requires [:auto-ap/make-every-account-visible]}
|
||||
:auto-ap/add-transaction-rules {:txes add-general-ledger/add-transaction-rules :requires [:auto-ap/add-exclude-to-transaction]}
|
||||
:auto-ap/add-bank-account-locations {:txes add-general-ledger/add-bank-account-locations :requires [:auto-ap/add-transaction-rules]}
|
||||
:auto-ap/add-hidden-to-vendor {:txes-fn `add-general-ledger/add-hidden-to-vendor :requires [:auto-ap/add-credit-bank-account]}
|
||||
#_#_:auto-ap/convert-vendors {:txes-fn `add-general-ledger/convert-vendors
|
||||
:requires [:auto-ap/add-hidden-to-vendor]}
|
||||
#_#_:auto-ap/convert-invoices {:txes-fn `add-general-ledger/convert-invoices
|
||||
:requires [:auto-ap/convert-vendors]}
|
||||
:auto-ap/add-yodlee-merchant2 {:txes add-general-ledger/add-yodlee-merchant }
|
||||
:auto-ap/add-external-id-to-ledger {:txes add-general-ledger/add-external-id-to-ledger :requires [:auto-ap/add-yodlee-merchant2]}
|
||||
:auto-ap/add-exclude-to-transaction {:txes add-general-ledger/add-exclude-to-transaction :requires [:auto-ap/add-external-id-to-ledger]}
|
||||
:auto-ap/add-client-identifier2 {:txes add-client-identifier :requires [:auto-ap/make-every-account-visible]}
|
||||
:auto-ap/add-transaction-rules {:txes add-general-ledger/add-transaction-rules :requires [:auto-ap/add-exclude-to-transaction]}
|
||||
:auto-ap/add-bank-account-locations {:txes add-general-ledger/add-bank-account-locations :requires [:auto-ap/add-transaction-rules]}
|
||||
|
||||
;; should not be needed.
|
||||
#_#_:auto-ap/convert-transactions {:txes-fn `add-general-ledger/convert-transactions :requires [:auto-ap/add-bank-account-locations]}
|
||||
:auto-ap/add-exclude-to-invoice {:txes add-general-ledger/add-exclude-to-invoice }
|
||||
:auto-ap/add-terms {:txes [[{:db/ident :vendor/terms
|
||||
:auto-ap/add-exclude-to-invoice {:txes add-general-ledger/add-exclude-to-invoice }
|
||||
:auto-ap/add-terms {:txes [[{:db/ident :vendor/terms
|
||||
:db/doc "How many days till you pay"
|
||||
:db/valueType :db.type/long
|
||||
:db/cardinality :db.cardinality/one}]]}
|
||||
:auto-ap/add-due {:txes [[{:db/ident :invoice/due
|
||||
:auto-ap/add-due {:txes [[{:db/ident :invoice/due
|
||||
:db/doc "When you gotta pay"
|
||||
:db/valueType :db.type/instant
|
||||
:db/cardinality :db.cardinality/one}]]}
|
||||
:auto-ap/add-vendor-overrides {:txes [[{:db/ident :vendor-account-override/account
|
||||
:auto-ap/add-vendor-overrides {:txes [[{:db/ident :vendor-account-override/account
|
||||
:db/doc "the account for invoices"
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/one}
|
||||
@@ -282,8 +293,8 @@
|
||||
:db/doc "Overrides per-client"
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/many}]]}
|
||||
:auto-ap/add-reset-rels {:txes-fn `reset-function}
|
||||
:auto-ap/add-account-overrides {:txes [[{:db/ident :account/applicability
|
||||
:auto-ap/add-reset-rels {:txes-fn `reset-function}
|
||||
:auto-ap/add-account-overrides {:txes [[{:db/ident :account/applicability
|
||||
:db/doc ":global, :optional :customized"
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/one}
|
||||
@@ -318,11 +329,11 @@
|
||||
:db/doc "client override"
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one}]]}
|
||||
:auto-ap/add-cleared-against {:txes [[{:db/ident :transaction/cleared-against
|
||||
:auto-ap/add-cleared-against {:txes [[{:db/ident :transaction/cleared-against
|
||||
:db/doc "which entitiy it was cleared against"
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one}]]}
|
||||
:auto-ap/add-cash-flow-schema {:txes [[{:db/ident :client/weekly-debits
|
||||
:auto-ap/add-cash-flow-schema {:txes [[{:db/ident :client/weekly-debits
|
||||
:db/doc "How much money gets debited each week"
|
||||
:db/valueType :db.type/double
|
||||
:db/cardinality :db.cardinality/one}
|
||||
@@ -347,18 +358,18 @@
|
||||
:db/doc "An identifier for this forcasted transaction, e.g., 'RENT'"
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one}]]}
|
||||
: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
|
||||
: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}]]
|
||||
:requires [:auto-ap/add-manager-schema]}
|
||||
:auto-ap/migrate-include-in-reports {:txes-fn `add-include-in-reports :requires [:auto-ap/add-include-in-reports1] }
|
||||
:auto-ap/migrate-include-in-reports {:txes-fn `add-include-in-reports :requires [:auto-ap/add-include-in-reports1] }
|
||||
:auto-ap/add-forecasted-transaction-match {:txes [[{:db/ident :transaction/forecast-match
|
||||
:db/doc "Which forecast this transaction matches, for cashflow"
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/one}]]}
|
||||
:auto-ap/add-week-a-and-b {:txes [[{:db/ident :client/week-a-debits
|
||||
:auto-ap/add-week-a-and-b {:txes [[{:db/ident :client/week-a-debits
|
||||
:db/doc "How much money gets debited each week"
|
||||
:db/valueType :db.type/double
|
||||
:db/cardinality :db.cardinality/one}
|
||||
@@ -385,12 +396,12 @@
|
||||
:db/valueType :db.type/boolean
|
||||
:db/cardinality :db.cardinality/one}]]}
|
||||
|
||||
:auto-ap/fix-reset-rels {:txes-fn `reset-function}
|
||||
:auto-ap/add-scheduled-payment {:txes [[{:db/ident :invoice/scheduled-payment
|
||||
:auto-ap/fix-reset-rels {:txes-fn `reset-function}
|
||||
:auto-ap/add-scheduled-payment {:txes [[{:db/ident :invoice/scheduled-payment
|
||||
:db/doc "When an invoice gets marked as paid"
|
||||
:db/valueType :db.type/instant
|
||||
:db/cardinality :db.cardinality/one}]]}
|
||||
:auto-ap/add-scheduled-payment-dom {:txes [[{:db/ident :vendor/schedule-payment-dom
|
||||
:auto-ap/add-scheduled-payment-dom {:txes [[{:db/ident :vendor/schedule-payment-dom
|
||||
:db/doc "When an invoice gets marked as paid"
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/many
|
||||
@@ -403,17 +414,17 @@
|
||||
:db/doc "What day of the month"
|
||||
:db/valueType :db.type/long
|
||||
:db/cardinality :db.cardinality/one}]]}
|
||||
:auto-ap/add-power-user-schema {:txes [[{:db/ident :user-role/power-user}]]}
|
||||
:auto-ap/add-power-user-schema {:txes [[{:db/ident :user-role/power-user}]]}
|
||||
:auto-ap/add-transaction-date-index {:txes [[{:db/ident :transaction/date
|
||||
:db/index true}]]
|
||||
:requires [:auto-ap/add-general-ledger6]}
|
||||
:auto-ap/add-invoice-index {:txes [[{:db/ident :invoice/invoice-number
|
||||
:auto-ap/add-invoice-index {:txes [[{:db/ident :invoice/invoice-number
|
||||
:db/index true}]]
|
||||
:requires [:auto-ap/base-schema]}
|
||||
|
||||
:auto-ap/add-propose-invoice {:txes-fn `propose-invoice-fn
|
||||
:auto-ap/add-propose-invoice {:txes-fn `propose-invoice-fn
|
||||
:requires [:auto-ap/base-schema]}
|
||||
:auto-ap/add-intuit-banks-4 {:txes [[{:db/ident :intuit-bank-account/external-id
|
||||
:auto-ap/add-intuit-banks-4 {:txes [[{:db/ident :intuit-bank-account/external-id
|
||||
:db/doc "Id of the intui bank"
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one
|
||||
@@ -432,60 +443,60 @@
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one}]]
|
||||
:requires [:auto-ap/add-general-ledger6]}
|
||||
:auto-ap/add-transaction-import2 {:txes [[{:db/ident :import-batch/external-id
|
||||
:db/doc "An identifier for the import batch"
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/unique :db.unique/identity}
|
||||
{:db/ident :import-batch/entry
|
||||
:db/doc "Links to everything that was imported"
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/many}
|
||||
{:db/ident :import-batch/imported
|
||||
:db/doc "How many entries were imported"
|
||||
:db/valueType :db.type/long
|
||||
:db/cardinality :db.cardinality/one}
|
||||
{:db/ident :import-batch/extant
|
||||
:db/doc "How many entries were already present"
|
||||
:db/valueType :db.type/long
|
||||
:db/cardinality :db.cardinality/one}
|
||||
{:db/ident :import-batch/suppressed
|
||||
:db/doc "How many entries were explicitly ignored"
|
||||
:db/valueType :db.type/long
|
||||
:db/cardinality :db.cardinality/one}
|
||||
{:db/ident :import-batch/date
|
||||
:db/doc "The date the import occurred"
|
||||
:db/valueType :db.type/instant
|
||||
:db/cardinality :db.cardinality/one}
|
||||
{:db/ident :import-batch/source
|
||||
:db/doc "What system triggered the import"
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/one}
|
||||
{:db/ident :import-batch/status
|
||||
:db/doc "What system triggered the import"
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/one}
|
||||
{:db/ident :import-source/intuit}
|
||||
{:db/ident :import-source/manual}
|
||||
{:db/ident :import-source/yodlee}
|
||||
{:db/ident :import-source/yodlee2}
|
||||
{:db/ident :import-status/started}
|
||||
{:db/ident :import-status/completed}
|
||||
{:db/ident :import-batch/user-name
|
||||
:db/doc "Who triggred this import"
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one}]]
|
||||
:auto-ap/add-transaction-import2 {:txes [[{:db/ident :import-batch/external-id
|
||||
:db/doc "An identifier for the import batch"
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/unique :db.unique/identity}
|
||||
{:db/ident :import-batch/entry
|
||||
:db/doc "Links to everything that was imported"
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/many}
|
||||
{:db/ident :import-batch/imported
|
||||
:db/doc "How many entries were imported"
|
||||
:db/valueType :db.type/long
|
||||
:db/cardinality :db.cardinality/one}
|
||||
{:db/ident :import-batch/extant
|
||||
:db/doc "How many entries were already present"
|
||||
:db/valueType :db.type/long
|
||||
:db/cardinality :db.cardinality/one}
|
||||
{:db/ident :import-batch/suppressed
|
||||
:db/doc "How many entries were explicitly ignored"
|
||||
:db/valueType :db.type/long
|
||||
:db/cardinality :db.cardinality/one}
|
||||
{:db/ident :import-batch/date
|
||||
:db/doc "The date the import occurred"
|
||||
:db/valueType :db.type/instant
|
||||
:db/cardinality :db.cardinality/one}
|
||||
{:db/ident :import-batch/source
|
||||
:db/doc "What system triggered the import"
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/one}
|
||||
{:db/ident :import-batch/status
|
||||
:db/doc "What system triggered the import"
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/one}
|
||||
{:db/ident :import-source/intuit}
|
||||
{:db/ident :import-source/manual}
|
||||
{:db/ident :import-source/yodlee}
|
||||
{:db/ident :import-source/yodlee2}
|
||||
{:db/ident :import-status/started}
|
||||
{:db/ident :import-status/completed}
|
||||
{:db/ident :import-batch/user-name
|
||||
:db/doc "Who triggred this import"
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one}]]
|
||||
:requires [:auto-ap/add-general-ledger6]}
|
||||
:auto-ap/add-suppression {:txes [[{:db/ident :transaction-approval-status/suppressed}
|
||||
:auto-ap/add-suppression {:txes [[{:db/ident :transaction-approval-status/suppressed}
|
||||
{:db/ident :transaction/approval-status
|
||||
:db/index true}]]
|
||||
:requires [:auto-ap/add-transaction-rules]}
|
||||
:auto-ap/add-other-statuses {:txes [[{:db/ident :import-batch/error
|
||||
:auto-ap/add-other-statuses {:txes [[{:db/ident :import-batch/error
|
||||
:db/doc "How many entries were an error "
|
||||
:db/valueType :db.type/long
|
||||
:db/cardinality :db.cardinality/one}
|
||||
{:db/ident :import-batch/not-ready
|
||||
:db/doc "How many entries were before a start date "
|
||||
:db/doc "How many entries were before a start date "
|
||||
:db/valueType :db.type/long
|
||||
:db/cardinality :db.cardinality/one}
|
||||
{:db/ident :import-batch/error-message
|
||||
@@ -496,7 +507,7 @@
|
||||
:auto-ap/apply-idents-to-well-known {:txes-fn `apply-idents-to-well-known
|
||||
:requires [:auto-ap/add-general-ledger6
|
||||
:auto-ap/add-account-to-vendor]}
|
||||
:auto-ap/add-invoice-link {:txes [[{:db/ident :invoice/source-url
|
||||
:auto-ap/add-invoice-link {:txes [[{:db/ident :invoice/source-url
|
||||
:db/doc "An s3 location for the invoice"
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one}
|
||||
@@ -504,20 +515,20 @@
|
||||
:db/doc "The location to code the invoice as"
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one}]]}
|
||||
:auto-ap/add-invoice-similarity {:txes [[{:db/ident :invoice/similarity
|
||||
:auto-ap/add-invoice-similarity {:txes [[{:db/ident :invoice/similarity
|
||||
:db/doc "How close an invoice matches its import"
|
||||
:db/valueType :db.type/double
|
||||
:db/cardinality :db.cardinality/one}]]}
|
||||
:auto-ap/add-source-url-admin-only {:txes [[{:db/ident :invoice/source-url-admin-only
|
||||
:auto-ap/add-source-url-admin-only {:txes [[{:db/ident :invoice/source-url-admin-only
|
||||
:db/doc "Can only admins see this invoice?"
|
||||
:db/valueType :db.type/boolean
|
||||
:db/cardinality :db.cardinality/one}]]}
|
||||
:auto-ap/add-payment-type-credit {:txes [[{:db/ident :payment-type/credit
|
||||
:auto-ap/add-payment-type-credit {:txes [[{:db/ident :payment-type/credit
|
||||
:db/doc "Credit for negative invoices"}]]}
|
||||
|
||||
:auto-ap/add-payment-type-balance-credit {:txes [[{:db/ident :payment-type/balance-credit
|
||||
:db/doc "Used for paying invoices from statement credits."}]]}
|
||||
:auto-ap/fulltext-accounts {:txes [[{:db/ident :account/search-terms
|
||||
:auto-ap/fulltext-accounts {:txes [[{:db/ident :account/search-terms
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/doc "a name search for accounts"
|
||||
@@ -528,8 +539,24 @@
|
||||
:db/doc "a name search for accounts"
|
||||
:db/fulltext true}]]
|
||||
:requires [:auto-ap/add-account-overrides]}
|
||||
:auto-ap/add-search-terms-accounts {:txes-fn `add-account-search-terms
|
||||
:requires [:auto-ap/fulltext-accounts]}}
|
||||
:auto-ap/add-search-terms-accounts {:txes-fn `add-account-search-terms
|
||||
:requires [:auto-ap/fulltext-accounts]}
|
||||
:auto-ap/add-account-options {:txes [[{:db/ident :account/invoice-allowance
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/doc "Whether this account can be used for invoices"}
|
||||
{:db/ident :allowance/allowed
|
||||
:db/doc "Allowed to be used"}
|
||||
{:db/ident :allowance/denied
|
||||
:db/doc "Denied usage"}
|
||||
{:db/ident :allowance/warn
|
||||
:db/doc "Warn on usage"}
|
||||
{:db/ident :allowance/admin-only
|
||||
:db/doc "Only admins can use it"}
|
||||
:requires [:auto-ap/add-search-terms-accounts]]]}
|
||||
:auto-ap/backfill-account-options {:txes-fn `backfill-account-options
|
||||
|
||||
:requires [:auto-ap/add-account-options]}}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -63,6 +63,12 @@
|
||||
'[?client-id :client/code ?client-code]]}
|
||||
:args [(:client-code args)]})
|
||||
|
||||
(:category args)
|
||||
(merge-query {:query {:in ['?category]
|
||||
:where ['[?e :sales-order/line-items ?li]
|
||||
'[?li :order-line-item/category ?category]]}
|
||||
:args [(:category args)]})
|
||||
|
||||
(:processor args)
|
||||
(merge-query {:query {:in ['?processor]
|
||||
:where ['[?e :sales-order/charges ?chg]
|
||||
|
||||
@@ -246,6 +246,7 @@
|
||||
|
||||
:account {:fields {:id {:type :id}
|
||||
:numeric_code {:type 'Int}
|
||||
:invoice_allowance {:type :allowance}
|
||||
:type {:type :ident}
|
||||
:applicability {:type :applicability}
|
||||
:account_set {:type 'String}
|
||||
@@ -500,6 +501,7 @@
|
||||
{:fields {:id {:type :id}
|
||||
:type {:type :account_type}
|
||||
:applicability {:type :applicability}
|
||||
:invoice_allowance {:type :allowance}
|
||||
:numeric_code {:type 'Int}
|
||||
:location {:type 'String}
|
||||
:account_set {:type 'String}
|
||||
@@ -517,6 +519,10 @@
|
||||
:integration_state {:values [{:enum-value :failed}
|
||||
{:enum-value :success}
|
||||
{:enum-value :unauthorized}]}
|
||||
:allowance {:values [{:enum-value :allowed}
|
||||
{:enum-value :denied}
|
||||
{:enum-value :warn}
|
||||
{:enum-value :admin_only}]}
|
||||
:tin_type {:values [{:enum-value :ein}
|
||||
{:enum-value :ssn}]}
|
||||
:type_1099 {:values [{:enum-value :none}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
(->graphql (d-accounts/clientize result (:client_id args)))))
|
||||
|
||||
(defn upsert-account [context args _]
|
||||
(let [{{:keys [id client-overrides numeric-code location applicability account-set name type]} :account} (<-graphql args)]
|
||||
(let [{{:keys [id client-overrides numeric-code location applicability account-set name invoice-allowance type]} :account} (<-graphql args)]
|
||||
(when-not id
|
||||
(when (seq (d/query {:query {:find ['?e]
|
||||
:in '[$ ?account-set ?numeric-code]
|
||||
@@ -51,6 +51,8 @@
|
||||
:account/type (keyword "account-type" (clojure.core/name type))
|
||||
:account/applicability (or (enum->keyword applicability "account-applicability")
|
||||
:account-applicability/global)
|
||||
|
||||
:account/invoice-allowance (some-> invoice-allowance (enum->keyword "allowance"))
|
||||
:account/account-set account-set
|
||||
:account/location location
|
||||
:account/numeric-code (when-not id
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
:total_gte {:type :money}
|
||||
:type_name {:type 'String}
|
||||
:processor {:type :processor}
|
||||
:category {:type 'String}
|
||||
:start {:type 'Int}
|
||||
:per_page {:type 'Int}
|
||||
:sort {:type '(list :sort_item)}}
|
||||
|
||||
@@ -381,11 +381,12 @@
|
||||
|
||||
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
||||
(defn tx-detail [i]
|
||||
(map (juxt :e #(d/ident (d/db (d/connect uri)) (:a %)) :v :added?)
|
||||
(map (juxt :e #(d/ident (d/db (d/connect uri)) (:a %)) :v :added)
|
||||
(:data (first
|
||||
(d/tx-range (d/log (d/connect uri))
|
||||
i
|
||||
(inc i))))))
|
||||
|
||||
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
||||
(defn tx-range-detail [i]
|
||||
(map (juxt :e #(d/ident (d/db (d/connect uri)) (:a %)) :v)
|
||||
|
||||
@@ -171,8 +171,7 @@
|
||||
"1099 data entry is now ready!"]]
|
||||
|
||||
(when (> (count @clients) 1)
|
||||
[client-dropdown]
|
||||
)])]
|
||||
[client-dropdown])])]
|
||||
(when-not is-initial-loading
|
||||
[login-dropdown])]
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
[reagent.core :as reagent]
|
||||
[vimsical.re-frame.fx.track :as track]))
|
||||
|
||||
(def default-read [:numeric-code :name :location :type :account_set :applicability :id [:client-overrides [:name [:client [:name :id]]]]])
|
||||
(def default-read [:numeric-code :name :location :type :account_set :applicability :invoice-allowance :id [:client-overrides [:name [:client [:name :id]]]]])
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -15,14 +15,16 @@
|
||||
|
||||
(def types [:dividend :expense :asset :liability :equity :revenue])
|
||||
(def applicabilities [:global :optional :customized])
|
||||
(def allowances [:allowed :denied :warn :admin-only])
|
||||
|
||||
(re-frame/reg-sub
|
||||
::request
|
||||
:<- [::forms/form ::form]
|
||||
(fn [{{:keys [id location type client-overrides applicability numeric-code name account-set]} :data}]
|
||||
(fn [{{:keys [id location type client-overrides applicability invoice-allowance numeric-code name account-set]} :data}]
|
||||
{:id id
|
||||
:type (keyword type)
|
||||
:applicability (keyword applicability)
|
||||
:invoice-allowance (keyword invoice-allowance)
|
||||
:location (if (clojure.string/blank? location)
|
||||
nil
|
||||
location)
|
||||
@@ -64,7 +66,7 @@
|
||||
:operation/name "UpsertAccount"}
|
||||
:venia/queries [{:query/data [:upsert-account
|
||||
{:account request}
|
||||
[:id :type :name :account-set :numeric-code :location :applicability [:client-overrides [:name :id [:client [:id :name]]]]]]}]}
|
||||
[:id :type :name :account-set :numeric-code :location :applicability :invoice-allowance [:client-overrides [:name :id [:client [:id :name]]]]]]}]}
|
||||
:on-success [::edited]
|
||||
:on-error [::forms/save-error ::form]}})))
|
||||
|
||||
@@ -81,6 +83,7 @@
|
||||
[:type [:enum :dividend :expense :asset :liability :equity :revenue]]
|
||||
[:location {:optional true} [:maybe :string]]
|
||||
[:applicability [:enum :global :optional :customized]]
|
||||
[:invoice-allowance [:enum :allowed :denied :warn :admin-only]]
|
||||
[:client-overrides {:optional true}
|
||||
[:maybe [:sequential account-customization-schema]]]]))
|
||||
|
||||
@@ -119,6 +122,15 @@
|
||||
"Location"
|
||||
[:input.input.known-field.location {:type "text"}]]
|
||||
|
||||
[form-builder/field-v2 {:field :invoice-allowance}
|
||||
"Invoice Allowance"
|
||||
[com/select-field {:options (map (fn [l]
|
||||
[l
|
||||
(str/capitalize (name l))])
|
||||
allowances)
|
||||
:allow-nil? true
|
||||
:keywordize? true}]]
|
||||
|
||||
[form-builder/section {:title "Client"}
|
||||
[:h2.subtitle "Client"]
|
||||
[form-builder/field-v2 {:field :applicability}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
:sort (:sort params)
|
||||
:per-page (:per-page params)
|
||||
:type-name (:type-name params)
|
||||
:category (:category params)
|
||||
:total-gte (:amount-gte (:total-range params))
|
||||
:total-lte (:amount-lte (:total-range params))
|
||||
:date-range (:date-range params)
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
(ns auto-ap.views.pages.pos.side-bar
|
||||
(:require [auto-ap.routes :as routes]
|
||||
[auto-ap.subs :as subs]
|
||||
[auto-ap.views.utils :refer [active-when dispatch-event]]
|
||||
[auto-ap.views.components.date-range-filter :refer [date-range-filter]]
|
||||
[auto-ap.views.components.number-filter :refer [number-filter]]
|
||||
[bidi.bidi :as bidi]
|
||||
[re-frame.core :as re-frame]
|
||||
[auto-ap.views.pages.data-page :as data-page]))
|
||||
(:require
|
||||
[auto-ap.routes :as routes]
|
||||
[auto-ap.subs :as subs]
|
||||
[auto-ap.views.components.date-range-filter :refer [date-range-filter]]
|
||||
[auto-ap.views.components.number-filter :refer [number-filter]]
|
||||
[auto-ap.views.pages.data-page :as data-page]
|
||||
[auto-ap.views.utils
|
||||
:refer [active-when dispatch-event dispatch-value-change]]
|
||||
[bidi.bidi :as bidi]
|
||||
[re-frame.core :as re-frame]))
|
||||
|
||||
(defn side-bar [{:keys [data-page]}]
|
||||
(let [ap @(re-frame/subscribe [::subs/active-page])]
|
||||
@@ -92,7 +94,12 @@
|
||||
[:a.panel-block {:on-click (dispatch-event [::data-page/filter-changed data-page :processor "na"])}
|
||||
[:span.panel-icon #_[:img.level-item {:src "/img/grubhub.png"}]]
|
||||
"No Processor"]
|
||||
]]])
|
||||
]]
|
||||
[:p.menu-label "Category"]
|
||||
[:div.field
|
||||
[:div.control [:input.input {:placeholder "Fries"
|
||||
:value @(re-frame/subscribe [::data-page/filter data-page :category])
|
||||
:on-change (dispatch-value-change [::data-page/filter-changed data-page :category])} ]]]])
|
||||
|
||||
(when-let [exact-match-id @(re-frame/subscribe [::data-page/filter data-page :exact-match-id])]
|
||||
[:div
|
||||
|
||||
Reference in New Issue
Block a user