This commit is contained in:
2023-08-31 23:24:42 -07:00
parent 1d82ec29e0
commit 7d251c8398
40 changed files with 333 additions and 286 deletions

View File

@@ -732,8 +732,7 @@
(def input-objects
{:invoice_payment_amount {:fields {:invoice_id {:type :id}
:amount {:type :money}}}
:payment_filters {:fields {:client_id {:type :id}
:vendor_id {:type :id}
:payment_filters {:fields {:vendor_id {:type :id}
:payment_type {:type :payment_type}
:status {:type :payment_status}
:exact_match_id {:type :id}

View File

@@ -255,7 +255,6 @@
(defn get-ids-matching-filters [args]
(let [ids (some-> args
:filters
(assoc :id (:id args))
(<-graphql)
(update :status enum->keyword "invoice-status")
(assoc :per-page Integer/MAX_VALUE)
@@ -278,7 +277,7 @@
(defn void-invoices [context args _]
(let [_ (assert-admin (:id context))
args (assoc args :id (:id context))
args (assoc args :clients (:clients context))
all-ids (all-ids-not-locked (get-ids-matching-filters args))
voidable-cash-payments (->> (dc/q '[:find ?p
:in $ [?i ...]
@@ -445,7 +444,7 @@
(when-not (:client_id args)
(throw (ex-info "Client is required"
{:validation-error "client is required"})))
(let [args (assoc args :id (:id context))
(let [args (assoc args :clients [{:db/id (:client_id args)}])
locations (pull-attr (dc/db conn)
:client/locations
(:client_id args))
@@ -602,7 +601,6 @@
:status {:type :invoice_status}
:unresolved {:type 'Boolean}
:scheduled_payments {:type 'Boolean}
:client_id {:type :id}
:vendor_id {:type :id}
:account_id {:type :id}
:amount_lte {:type :money}

View File

@@ -35,8 +35,14 @@
(defn get-ledger-page [context args _]
(let [args (assoc args :id (:id context))
_ (when (:client_id (:filters args))
(assert-can-see-client (:id context) (:client_id (:filters args))))
clients (or (and (:client_id (:filters args))
[{:db/id (:client_id (:filters args))}])
(:clients context))
[journal-entries journal-entries-count] (l/get-graphql (assoc (<-graphql (:filters args))
:clients (:clients context)))
:clients clients))
journal-entries (mapv
(fn [je]
@@ -49,7 +55,7 @@
(let [args (assoc args :id (:id context))
[journal-entries journal-entries-count] (l/get-graphql (assoc (<-graphql (:filters args))
:per-page Integer/MAX_VALUE
:id (:id context)))
:clients (:clients context)))
]
@@ -561,9 +567,9 @@
location (:client/locations c)
category (:categories input)
:let [category (<-graphql category)
all-journal-entries (->> (get-ledger-page context
{:filters {:client_id client-id
:location location
all-journal-entries (->> (get-ledger-page (assoc context
:clients [{:db/id client-id}])
{:filters {:location location
:date_range (:date_range input)
:from_numeric_code (l-reports/min-numeric-code category )
:to_numeric_code (l-reports/max-numeric-code category )

View File

@@ -9,7 +9,7 @@
[datomic.api :as dc]))
(defn get-report-page [context args _]
(let [args (assoc args :id (:id context))
(let [args (assoc args :clients (:clients context))
[reports reports-count] (r/get-graphql (assoc (<-graphql (:filters args))
:clients (:clients context)))]
(result->page reports reports-count :reports (:filters args)))
@@ -58,8 +58,7 @@
(def input-objects
{:report_filters
{:fields {:client_id {:type :id}
:start {:type 'Int}
{:fields {:start {:type 'Int}
:per_page {:type 'Int}
:sort {:type '(list :sort_item)}}}})

View File

@@ -41,7 +41,7 @@
(when-not (seq (->> filters
(filter (fn [[_ v]]
(not (nil? v))))
(filter (comp (complement #{:id :start :sort :client_id :bank_account_id :potential_duplicates :per_page})
(filter (comp (complement #{:id :start :sort :bank_account_id :potential_duplicates :per_page})
first))
(filter (fn [[k v]]
(if (= :date_range k)
@@ -141,8 +141,7 @@
(when-not (seq (:client_id args))
(throw (ex-info "Client is required"
{:validation-error "client is required"})))
;; TODO FIX THIS TO WORK WITH MULTIPLE
(let [args (assoc args :clients (:clients context))
(let [args (assoc args :clients [{:db/id [(:client_id args)]}])
locations (pull-attr (dc/db conn)
:client/locations
(:client_id args))
@@ -589,7 +588,6 @@
:resolve :mutation/bulk-change-transaction-status}
:bulk_code_transactions {:type :message
:args {:filters {:type :transaction_filters}
:client_id {:type :id}
:vendor {:type :id}
:approval_status {:type :transaction_approval_status}
:accounts {:type '(list :edit_percentage_account)}
@@ -630,8 +628,7 @@
:resolve :mutation/match-transaction-rules}})
(def input-objects
{:transaction_filters {:fields {:client_id {:type :id}
:exact_match_id {:type :id}
{:transaction_filters {:fields {:exact_match_id {:type :id}
:import_batch_id {:type :id}
:potential_duplicates {:type 'Boolean}
:vendor_id {:type :id}