From dbe4c7b9c4d90d14e02a0e9bcc0a59a25b19e898 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Thu, 12 Sep 2019 20:47:16 -0700 Subject: [PATCH] Hovering fix --- src/clj/auto_ap/datomic/ledger.clj | 5 +- src/clj/auto_ap/graphql/ledger.clj | 3 +- src/clj/auto_ap/graphql/transaction_rules.clj | 3 +- .../auto_ap/views/components/typeahead.cljs | 1 + .../views/pages/ledger/external_import.cljs | 2 +- .../views/pages/ledger/profit_and_loss.cljs | 49 ++++++++++++++++++- 6 files changed, 57 insertions(+), 6 deletions(-) diff --git a/src/clj/auto_ap/datomic/ledger.clj b/src/clj/auto_ap/datomic/ledger.clj index 89880601..5d5d563f 100644 --- a/src/clj/auto_ap/datomic/ledger.clj +++ b/src/clj/auto_ap/datomic/ledger.clj @@ -3,7 +3,8 @@ [auto-ap.graphql.utils :refer [->graphql limited-clients]] [auto-ap.datomic :refer [merge-query apply-sort-2 apply-sort apply-pagination add-sorter-field]] [auto-ap.datomic :refer [uri]] - [clj-time.coerce :as c])) + [clj-time.coerce :as c] + [clj-time.core :as time])) (defn sort-fn [sort-by] (cond @@ -50,7 +51,7 @@ (merge-query {:query {:in ['?from-date] :where ['[?e :journal-entry/date ?d] '[(>= ?d ?from-date)]]} - :args [(c/to-date (:from-date args))]}) + :args [(c/to-date (time/minus (:from-date args) (time/days 1)))]}) (:from-numeric-code args) (merge-query {:query {:in ['?from-numeric-code] diff --git a/src/clj/auto_ap/graphql/ledger.clj b/src/clj/auto_ap/graphql/ledger.clj index 2814089a..0f600cf8 100644 --- a/src/clj/auto_ap/graphql/ledger.clj +++ b/src/clj/auto_ap/graphql/ledger.clj @@ -103,6 +103,7 @@ (defn get-profit-and-loss [context args value] (let [args (assoc args :id (:id context)) pnl (fn [from-date to-date] + (println from-date to-date) (let [[starting-results] (l/get-graphql {:client-id (:client_id args) :to-date from-date :count Integer/MAX_VALUE}) @@ -119,7 +120,7 @@ [] ending-accounts)))] (->graphql - {:balance-sheet-accounts (pnl (coerce/to-date (:from_date args)) + {:balance-sheet-accounts (pnl (coerce/to-date (time/minus (:from_date args) (time/days 1))) (coerce/to-date (:to_date args))) :comparable-balance-sheet-accounts (pnl (coerce/to-date (coerce/to-date (time/minus (coerce/to-date-time (:from_date args)) (time/years 1)))) (coerce/to-date (coerce/to-date (time/minus (coerce/to-date-time (:to_date args)) (time/years 1)))))}))) diff --git a/src/clj/auto_ap/graphql/transaction_rules.clj b/src/clj/auto_ap/graphql/transaction_rules.clj index 19f6d672..a8390540 100644 --- a/src/clj/auto_ap/graphql/transaction_rules.clj +++ b/src/clj/auto_ap/graphql/transaction_rules.clj @@ -160,7 +160,8 @@ (not include-coded?) - (merge-query {:query {:where ['[?e :transaction/approval-status :transaction-approval-status/unapproved]]}}) + (merge-query {:query {:where ['[or [?e :transaction/approval-status :transaction-approval-status/unapproved] + [(missing? $ ?e :transaction/approval-status)]]]}}) true (merge-query {:query {:where ['[?e :transaction/id]]}}))) diff --git a/src/cljs/auto_ap/views/components/typeahead.cljs b/src/cljs/auto_ap/views/components/typeahead.cljs index 929826c6..eb66eb86 100644 --- a/src/cljs/auto_ap/views/components/typeahead.cljs +++ b/src/cljs/auto_ap/views/components/typeahead.cljs @@ -218,6 +218,7 @@ (let [t (match->text entity)] ^{:key entity} [:li.typeahead-suggestion {:class (if (= entity h) "typeahead-highlighted") + :on-mouse-over (fn [] (reset! highlighted entity)) :on-mouse-down #(do (select entity))} t]))]]) :else diff --git a/src/cljs/auto_ap/views/pages/ledger/external_import.cljs b/src/cljs/auto_ap/views/pages/ledger/external_import.cljs index 4b5823c5..335090db 100644 --- a/src/cljs/auto_ap/views/pages/ledger/external_import.cljs +++ b/src/cljs/auto_ap/views/pages/ledger/external_import.cljs @@ -117,7 +117,7 @@ (defn textarea->table [{:keys [headings value on-change read-only-headings]} & children] (let [text-form (r/atom "") - include-headers (r/atom false) + include-headers (r/atom true) table-form (r/atom nil)] (fn [{:keys [headings value on-change row-filter]}] [:form.form diff --git a/src/cljs/auto_ap/views/pages/ledger/profit_and_loss.cljs b/src/cljs/auto_ap/views/pages/ledger/profit_and_loss.cljs index 699302e6..9d3163e1 100644 --- a/src/cljs/auto_ap/views/pages/ledger/profit_and_loss.cljs +++ b/src/cljs/auto_ap/views/pages/ledger/profit_and_loss.cljs @@ -218,7 +218,53 @@ (def groupings - {:expense [["1100 Cash and Bank Accounts" 1100 1199] + { + :revenue [["1100 Cash and Bank Accounts" 1100 1199] + ["1200 Accounts Receivable" 1200 1299] + ["1300 Inventory" 1300 1399] + ["1400 Prepaid Expenses" 1400 1499] + ["1500 Property and Equipment" 1500 1599] + ["1600 Intangible Assets" 1600 1699] + ["2100 Accounts Payable" 2100 2399] + ["2400 Accrued Expenses" 2400 2499] + ["2500 Other Liabilities" 2500 2599] + ["2600 Split Accounts" 2600 2699] + ["2700 Current Portion of Long-Term Debt" 2700 2799] + ["2800 Notes Payable" 2800 2899] + + ["4100-4200 Food Sales" 4100 4199] + ["4400-4600 Alcohol Sales" 4400 4599] + ["4700 Merchandise Sales" 4700 4799] + ["4800 Other Operating Income" 4800 4899] + ["5100-5200 Food Costs" 5100 5199] + ["5400-5600 Alcohol Cost" 5400 5599] + ["5700 Merchandise Cost" 5700 5799] + ["5800 Other Operating Cost" 5800 5899] + ["5900 Paper Cost" 5900 5999] + ["6010 HQ Payroll" 6010 6029] + ["6030 Payroll Benefits and Taxes" 6030 6099] + ["6100 Management Payroll" 6100 6199] + ["6200 Staff Payroll" 6200 6299] + ["7100 Ops Related DirGMC Exp" 7100 7199] + ["7200 Customer Related DirGMC Exp" 7200 7299] + ["7300 Employee Related DirGMC Exp" 7300 7399] + ["7400 Building and Equipment Related DirGMC Exp" 7400 7499] + ["7500 Office/ Management Related DirGMC Exp" 7500 7999] + ["8100 Operational" 8100 8199] + ["8200 Occupancy Costs" 8200 8299] + ["8300 Utilities" 8300 8399] + ["8400 Equipment Rental" 8400 8499] + ["8500-8700 Taxes and Insurance" 8500 8699] + ["8800 Depreciation" 8800 8899] + ["9100 Promotion and Outreach" 9100 9199] + ["9200 Employee Morale and Training" 9200 9299] + ["9300 Operational" 9300 9499] + ["9500 Interest and Bank Expenses" 9500 9599] + ["9600 Depreciation" 9600 9699] + ["9700 Taxes" 9700 9799] + ["9800 Other Expenses" 9800 9899] + ["9900 Tax Only Expenses" 9900 9999]] + :expense [["1100 Cash and Bank Accounts" 1100 1199] ["1200 Accounts Receivable" 1200 1299] ["1300 Inventory" 1300 1399] ["1400 Prepaid Expenses" 1400 1499] @@ -435,6 +481,7 @@ [:td]] (for [location (doto @(re-frame/subscribe [::locations]) println)] (list + (overall-grouping :revenue location location) (overall-grouping :expense location location))))]])])) {:component-will-mount #(re-frame/dispatch-sync [::params-change {:from-date (date->str (t/minus (local-now) (t/period :years 1)) standard) :to-date (date->str (local-now) standard)}]) }))