Allows you to filter down to ccp-processor
This commit is contained in:
@@ -47,6 +47,13 @@
|
||||
'[?client-id :client/code ?client-code]]}
|
||||
:args [(:client-code args)]})
|
||||
|
||||
(:processor args)
|
||||
(merge-query {:query {:in ['?processor]
|
||||
:where ['[?e :sales-order/charges ?chg]
|
||||
'[?chg :charge/processor ?processor]]}
|
||||
:args [(keyword "ccp-processor"
|
||||
(name (:processor args)))]})
|
||||
|
||||
(:total-gte args)
|
||||
(merge-query {:query {:in ['?total-gte]
|
||||
:where ['[?e :sales-order/total ?a]
|
||||
@@ -96,13 +103,28 @@
|
||||
(mapv <-datomic))]
|
||||
payments))
|
||||
|
||||
(defn summarize-orders [ids]
|
||||
|
||||
(let [[total tax] (->>
|
||||
(d/query {:query {:find ['(sum ?t) '(sum ?tax)]
|
||||
:with ['?id]
|
||||
:in ['$ '[?id ...]]
|
||||
:where ['[?id :sales-order/total ?t]
|
||||
'[?id :sales-order/tax ?tax]]}
|
||||
:args [(d/db (d/connect uri))
|
||||
ids]})
|
||||
first)]
|
||||
{:total total
|
||||
:tax tax}))
|
||||
|
||||
(defn get-graphql [args]
|
||||
(log/info "ARGS" args)
|
||||
(let [db (d/db (d/connect uri))
|
||||
{ids-to-retrieve :ids matching-count :count} (raw-graphql-ids db args)]
|
||||
|
||||
[(->> (graphql-results ids-to-retrieve db args))
|
||||
matching-count]))
|
||||
matching-count
|
||||
(summarize-orders ids-to-retrieve)]))
|
||||
|
||||
(defn get-by-id [id]
|
||||
(->>
|
||||
|
||||
@@ -63,8 +63,8 @@
|
||||
(str %)
|
||||
|
||||
:else
|
||||
%)
|
||||
}
|
||||
%)}
|
||||
|
||||
:percentage {:parse #(cond (and (string? %)
|
||||
(not (str/blank? %)))
|
||||
(Double/parseDouble %)
|
||||
@@ -177,8 +177,8 @@
|
||||
:terms_override
|
||||
{:fields {:id {:type :id}
|
||||
:client {:type :client}
|
||||
:terms {:type 'Int}
|
||||
}}
|
||||
:terms {:type 'Int}}}
|
||||
|
||||
|
||||
:schedule_payment_dom
|
||||
{:fields {:id {:type :id}
|
||||
@@ -218,9 +218,9 @@
|
||||
:legal_entity_last_name {:type 'String}
|
||||
:legal_entity_tin {:type 'String}
|
||||
:legal_entity_tin_type {:type :tin_type}
|
||||
:legal_entity_1099_type {:type :type_1099}
|
||||
:legal_entity_1099_type {:type :type_1099}}}
|
||||
|
||||
|
||||
}}
|
||||
:reminder
|
||||
{:fields {:id {:type 'Int}
|
||||
:email {:type 'String}
|
||||
@@ -228,8 +228,8 @@
|
||||
:body {:type 'String}
|
||||
:scheduled {:type 'String}
|
||||
:sent {:type 'String}
|
||||
:vendor {:type :vendor}
|
||||
}}
|
||||
:vendor {:type :vendor}}}
|
||||
|
||||
|
||||
:journal_entry_line
|
||||
{:fields {:id {:type :id}
|
||||
@@ -301,8 +301,8 @@
|
||||
:s3_url {:type 'String}
|
||||
:check_number {:type 'Int}
|
||||
:status {:type 'String}
|
||||
:invoices {:type '(list :invoice_payment)}
|
||||
}}
|
||||
:invoices {:type '(list :invoice_payment)}}}
|
||||
|
||||
|
||||
:payment {:fields {:id {:type :id}
|
||||
:type {:type :payment_type}
|
||||
@@ -317,8 +317,8 @@
|
||||
:check_number {:type 'Int}
|
||||
:status {:type :ident}
|
||||
:transaction {:type :transaction}
|
||||
:invoices {:type '(list :invoice_payment)}
|
||||
}}
|
||||
:invoices {:type '(list :invoice_payment)}}}
|
||||
|
||||
|
||||
:yodlee_merchant {:fields {:id {:type :id}
|
||||
:yodlee_id {:type 'String}
|
||||
@@ -459,7 +459,11 @@
|
||||
:count {:type 'Int}
|
||||
:total {:type 'Int}
|
||||
:start {:type 'Int}
|
||||
:end {:type 'Int}}}
|
||||
:end {:type 'Int}
|
||||
:sales_order_total {:type :money}
|
||||
:sales_order_tax {:type :money}}}
|
||||
|
||||
|
||||
|
||||
:expected_deposit_page {:fields {:expected_deposits {:type '(list :expected_deposit)}
|
||||
:count {:type 'Int}
|
||||
@@ -489,8 +493,8 @@
|
||||
:import_ledger_result {:fields {:successful {:type '(list :import_ledger_entry_result)}
|
||||
:existing {:type '(list :import_ledger_entry_result)}
|
||||
:ignored {:type '(list :import_ledger_entry_result)}
|
||||
:errors {:type '(list :import_ledger_entry_result)}
|
||||
}}
|
||||
:errors {:type '(list :import_ledger_entry_result)}}}
|
||||
|
||||
|
||||
:upcoming_transaction {:fields {:amount {:type :money}
|
||||
:identifier {:type 'String}
|
||||
@@ -500,8 +504,8 @@
|
||||
:invoices_due_soon {:type '(list :invoice)}
|
||||
:outstanding_payments {:type :money}
|
||||
:upcoming_credits {:type '(list :upcoming_transaction)}
|
||||
:upcoming_debits {:type '(list :upcoming_transaction)}}}
|
||||
}
|
||||
:upcoming_debits {:type '(list :upcoming_transaction)}}}}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -632,6 +636,7 @@
|
||||
:date_range {:type :date_range}
|
||||
:total_lte {:type :money}
|
||||
:total_gte {:type :money}
|
||||
:processor {:type :processor}
|
||||
:start {:type 'Int}
|
||||
:per_page {:type 'Int}
|
||||
:sort {:type '(list :sort_item)}}
|
||||
@@ -670,9 +675,9 @@
|
||||
:vendor {:type '(list :vendor)
|
||||
:resolve :get-vendor}
|
||||
:user {:type '(list :user)
|
||||
:resolve :get-user}
|
||||
:resolve :get-user}}
|
||||
|
||||
|
||||
}
|
||||
|
||||
:input-objects
|
||||
{
|
||||
@@ -756,8 +761,8 @@
|
||||
:matches {:type '(list String)}
|
||||
:location_matches {:type '(list :edit_location_match)}
|
||||
:bank_accounts {:type '(list :edit_bank_account)}
|
||||
:forecasted_transactions {:type '(list :edit_forecasted_transaction)}
|
||||
}}
|
||||
:forecasted_transactions {:type '(list :edit_forecasted_transaction)}}}
|
||||
|
||||
:edit_bank_account
|
||||
{:fields {:id {:type :id}
|
||||
:code {:type 'String}
|
||||
@@ -796,8 +801,8 @@
|
||||
:add_terms_override
|
||||
{:fields {:id {:type :id}
|
||||
:client_id {:type :id}
|
||||
:terms {:type 'Int}
|
||||
}}
|
||||
:terms {:type 'Int}}}
|
||||
|
||||
|
||||
:add_account_override
|
||||
{:fields {:id {:type :id}
|
||||
@@ -833,8 +838,8 @@
|
||||
:legal_entity_last_name {:type 'String}
|
||||
:legal_entity_tin {:type 'String}
|
||||
:legal_entity_tin_type {:type :tin_type}
|
||||
:legal_entity_1099_type {:type :type_1099}
|
||||
}}
|
||||
:legal_entity_1099_type {:type :type_1099}}}
|
||||
|
||||
|
||||
:edit_expense_account
|
||||
{:fields {:id {:type :id}
|
||||
@@ -1281,8 +1286,8 @@
|
||||
(or week-b-debits 0)))
|
||||
:date (coerce/to-date-time date)})
|
||||
(take (* 7 4) (time/day-of-week-seq 1)))
|
||||
(filter #(< (:amount %) 0) forecasted-transactions))
|
||||
})))
|
||||
(filter #(< (:amount %) 0) forecasted-transactions))})))
|
||||
|
||||
|
||||
(def schema
|
||||
(-> integreat-schema
|
||||
@@ -1383,8 +1388,8 @@
|
||||
|
||||
(catch Exception e
|
||||
(if-let [v (or (:validation-error (ex-data e))
|
||||
(:validation-error (ex-data (.getCause e)))
|
||||
)]
|
||||
(:validation-error (ex-data (.getCause e))))]
|
||||
|
||||
(do
|
||||
(warn-event "validation error" {:validation-error v
|
||||
:data (ex-data e)})
|
||||
|
||||
@@ -4,5 +4,7 @@
|
||||
|
||||
(defn get-sales-orders-page [context args value]
|
||||
(let [args (assoc args :id (:id context))
|
||||
[sales-orders sales-orders-count] (d-sales-orders2/get-graphql (<-graphql args))]
|
||||
(result->page sales-orders sales-orders-count :sales_orders args )))
|
||||
[sales-orders sales-orders-count {:keys [total tax]}] (d-sales-orders2/get-graphql (<-graphql args))]
|
||||
(assoc (result->page sales-orders sales-orders-count :sales_orders args)
|
||||
:sales_order_total total
|
||||
:sales_order_tax tax)))
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
:total-gte (:amount-gte (:total-range params))
|
||||
:total-lte (:amount-lte (:total-range params))
|
||||
:date-range (:date-range params)
|
||||
:processor (some-> (:processor params) keyword)
|
||||
:client-id (:id @(re-frame/subscribe [::subs/client]))}
|
||||
[[:sales-orders [:id :total :tax :tip :discount :service-charge :returns :date
|
||||
[:charges [:type-name :total :processor :id]]
|
||||
@@ -32,7 +33,9 @@
|
||||
[:client [:name :id]]]]
|
||||
:total
|
||||
:start
|
||||
:end]]]}
|
||||
:end
|
||||
:sales_order_total
|
||||
:sales_order_tax]]]}
|
||||
:on-success (fn [result]
|
||||
(let [result (set/rename-keys (:sales-order-page result)
|
||||
{:sales-orders :data})]
|
||||
@@ -67,7 +70,6 @@
|
||||
:reagent-render
|
||||
(fn []
|
||||
(let [{form-active? :active?} @(re-frame/subscribe [::forms/form ::form/form])]
|
||||
(println form-active?)
|
||||
[side-bar-layout {:side-bar [side-bar/side-bar {:data-page ::page}]
|
||||
:main [content]
|
||||
:right-side-bar [appearing-side-bar {:visible? form-active?}
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
(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-value-change]]
|
||||
[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]]
|
||||
[auto-ap.views.components.bank-account-filter :refer [bank-account-filter]]
|
||||
[bidi.bidi :as bidi]
|
||||
[re-frame.core :as re-frame]
|
||||
[auto-ap.views.pages.data-page :as data-page]))
|
||||
|
||||
(defn side-bar [{:keys [data-page]}]
|
||||
(let [ap @(re-frame/subscribe [::subs/active-page])
|
||||
user @(re-frame/subscribe [::subs/user])]
|
||||
(let [ap @(re-frame/subscribe [::subs/active-page])]
|
||||
[:div
|
||||
[:div [:p.menu-label "Type"]
|
||||
[:ul.menu-list
|
||||
@@ -37,4 +35,21 @@
|
||||
[:div
|
||||
[number-filter
|
||||
{:on-change-event [::data-page/filter-changed data-page :total-range]
|
||||
:value @(re-frame/subscribe [::data-page/filter data-page :total-range])}]]]]))
|
||||
:value @(re-frame/subscribe [::data-page/filter data-page :total-range])}]]
|
||||
|
||||
(when (= :sales-orders ap)
|
||||
[:<>
|
||||
[:p.menu-label "Processor"]
|
||||
[:div
|
||||
[:nav.panel
|
||||
[:a.panel-block {:on-click (dispatch-event [::data-page/filter-changed data-page :processor "doordash"])}
|
||||
[:span.panel-icon [:img.level-item {:src "/img/doordash.png"}]]
|
||||
"Doordash"]
|
||||
|
||||
[:a.panel-block {:on-click (dispatch-event [::data-page/filter-changed data-page :processor "uber-eats"])}
|
||||
[:span.panel-icon [:img.level-item {:src "/img/ubereats.png" }]]
|
||||
"Uber Eats"]
|
||||
[:a.panel-block {:on-click (dispatch-event [::data-page/filter-changed data-page :processor "grubhub"])}
|
||||
[:span.panel-icon [:img.level-item {:src "/img/grubhub.png"}]]
|
||||
"Grubhub"]]]])]]))
|
||||
|
||||
|
||||
@@ -43,11 +43,11 @@
|
||||
"SQUARE_GIFT_CARD"
|
||||
[:span.icon.level-item {:style {:font-size "24px"}} [:span {:class "icon-gift-box" :style {:font-weight "400"}}]]
|
||||
|
||||
[:span.level-item "Other (" (:type-name charge) ")"]
|
||||
))
|
||||
{:key (:id charge)}))]]
|
||||
[:span.level-item "Other (" (:type-name charge) ")"]))
|
||||
|
||||
{:key (:id charge)}))]]]
|
||||
|
||||
|
||||
]
|
||||
[grid/cell {} (str/join ", " (map :item-name line-items))]
|
||||
[grid/button-cell {}
|
||||
[:div.buttons
|
||||
@@ -58,7 +58,12 @@
|
||||
{:keys [data status]} @(re-frame/subscribe [::data-page/page data-page])]
|
||||
[grid/grid {:data-page data-page
|
||||
:column-count (if selected-client 7 8)}
|
||||
[grid/controls data]
|
||||
[grid/controls data
|
||||
[:div.level-item
|
||||
[:div.tag "Total: " (nf (:sales-order-total data))]
|
||||
]
|
||||
[:div.level-item
|
||||
[:div.tag " Tax: " (nf (:sales-order-tax data))]]]
|
||||
[grid/table {:fullwidth true}
|
||||
[grid/header {}
|
||||
[grid/row {}
|
||||
|
||||
Reference in New Issue
Block a user