Starting the process of multiple profit and loss, fixes numeric code bug.
This commit is contained in:
@@ -132,7 +132,7 @@
|
|||||||
:name name
|
:name name
|
||||||
:check-number (when-not (str/blank? check-number)
|
:check-number (when-not (str/blank? check-number)
|
||||||
(js/parseInt check-number))
|
(js/parseInt check-number))
|
||||||
:numeric-code (when-not (str/blank? check-number)
|
:numeric-code (when-not (str/blank? numeric-code)
|
||||||
(js/parseInt numeric-code))
|
(js/parseInt numeric-code))
|
||||||
:include-in-reports include-in-reports
|
:include-in-reports include-in-reports
|
||||||
:start-date (cond (not start-date)
|
:start-date (cond (not start-date)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
[auto-ap.views.components.buttons :as buttons]
|
[auto-ap.views.components.buttons :as buttons]
|
||||||
[auto-ap.views.components.switch-field :refer [switch-field]]
|
[auto-ap.views.components.switch-field :refer [switch-field]]
|
||||||
[auto-ap.views.components.modal :as modal]
|
[auto-ap.views.components.modal :as modal]
|
||||||
[auto-ap.views.utils :refer [date->str date-picker date-picker-friendly bind-field standard pretty dispatch-event local-today ->% ->$ str->date with-user dispatch-value-change query-params]]
|
[auto-ap.views.utils :refer [date->str date-picker date-picker-friendly bind-field standard pretty dispatch-event local-today ->% ->$ str->date with-user dispatch-value-change query-params multi-field]]
|
||||||
[cljs-time.core :as t]
|
[cljs-time.core :as t]
|
||||||
[re-frame.core :as re-frame]
|
[re-frame.core :as re-frame]
|
||||||
[react-dom :as react-dom]
|
[react-dom :as react-dom]
|
||||||
@@ -172,8 +172,7 @@
|
|||||||
(cond-> {:graphql {:token user
|
(cond-> {:graphql {:token user
|
||||||
:owns-state {:single ::page}
|
:owns-state {:single ::page}
|
||||||
:query-obj {:venia/queries [[:profit-and-loss
|
:query-obj {:venia/queries [[:profit-and-loss
|
||||||
{:client-ids (some-> (:id (:client (:data db)))
|
{:client-ids (map :id (:clients (:data db)))
|
||||||
vector)
|
|
||||||
:periods (mapv (fn [[start end] ] {:start (date->str start standard) :end (date->str end standard)} )
|
:periods (mapv (fn [[start end] ] {:start (date->str start standard) :end (date->str end standard)} )
|
||||||
(:periods (:data db)))}
|
(:periods (:data db)))}
|
||||||
[[:periods [[:accounts [:name :amount :client_id :account-type :id :count :numeric-code :location]]]]]]]}
|
[[:periods [[:accounts [:name :amount :client_id :account-type :id :count :numeric-code :location]]]]]]]}
|
||||||
@@ -639,11 +638,13 @@
|
|||||||
[report-control-detail {:active active :box !box :which :clients}
|
[report-control-detail {:active active :box !box :which :clients}
|
||||||
[:div {:style {:width "20em"}}
|
[:div {:style {:width "20em"}}
|
||||||
[:h4.subtitle "Companies"]
|
[:h4.subtitle "Companies"]
|
||||||
(raw-field
|
[raw-field
|
||||||
[typeahead-v3 {:entities @(re-frame/subscribe [::subs/clients])
|
[multi-field {:type "multi-field"
|
||||||
:entity->text :name
|
:field [:clients]
|
||||||
:type "typeahead-v3"
|
:template [[typeahead-v3 {:entities @(re-frame/subscribe [::subs/clients])
|
||||||
:field [:client]}])]]]
|
:entity->text :name
|
||||||
|
:type "typeahead-v3"}]]}]]
|
||||||
|
]]]
|
||||||
[:div.level-item
|
[:div.level-item
|
||||||
[buttons/dropdown {:on-click (fn [] (reset! active :range))}
|
[buttons/dropdown {:on-click (fn [] (reset! active :range))}
|
||||||
[:span (str "Range"
|
[:span (str "Range"
|
||||||
@@ -829,6 +830,7 @@
|
|||||||
(when-not @!box
|
(when-not @!box
|
||||||
(reset! !box el)))}]]))))
|
(reset! !box el)))}]]))))
|
||||||
|
|
||||||
|
|
||||||
(defn profit-and-loss-content []
|
(defn profit-and-loss-content []
|
||||||
(let [user @(re-frame/subscribe [::subs/user])
|
(let [user @(re-frame/subscribe [::subs/user])
|
||||||
status @(re-frame/subscribe [::status/single ::page])
|
status @(re-frame/subscribe [::status/single ::page])
|
||||||
@@ -847,7 +849,7 @@
|
|||||||
|
|
||||||
[:div
|
[:div
|
||||||
|
|
||||||
[:h1.title "Profit and Loss - " (:name (:client data))]
|
[:h1.title "Profit and Loss - " (str/join ", " (map :name (:clients data)))]
|
||||||
(when (seq unresolved-accounts)
|
(when (seq unresolved-accounts)
|
||||||
[:div.notification.is-warning.is-light
|
[:div.notification.is-warning.is-light
|
||||||
"This report does not include " (str/join ", "
|
"This report does not include " (str/join ", "
|
||||||
@@ -890,6 +892,8 @@
|
|||||||
period))))
|
period))))
|
||||||
:client (or (:client qp)
|
:client (or (:client qp)
|
||||||
(some-> @(re-frame/subscribe [::subs/client]) (select-keys [:name :id])))
|
(some-> @(re-frame/subscribe [::subs/client]) (select-keys [:name :id])))
|
||||||
|
:clients [(or (:client qp)
|
||||||
|
(some-> @(re-frame/subscribe [::subs/client]) (select-keys [:name :id])))]
|
||||||
:include-deltas true})
|
:include-deltas true})
|
||||||
::track/register {:id ::ledger-params
|
::track/register {:id ::ledger-params
|
||||||
:subscription [::data-page/params ::ledger]
|
:subscription [::data-page/params ::ledger]
|
||||||
|
|||||||
@@ -155,7 +155,13 @@
|
|||||||
|
|
||||||
[:div.level-item
|
[:div.level-item
|
||||||
(update template 1 assoc
|
(update template 1 assoc
|
||||||
:value (get-in override (get-in template [1 :field]))
|
:value (let [value (get-in override (get-in template [1 :field])) ;; TODO this is really ugly to support maps or strings
|
||||||
|
value (if (map? value)
|
||||||
|
(dissoc value :key :new?)
|
||||||
|
value)]
|
||||||
|
(if (= value {})
|
||||||
|
nil
|
||||||
|
value))
|
||||||
:disabled is-disabled?
|
:disabled is-disabled?
|
||||||
:on-change (fn [e]
|
:on-change (fn [e]
|
||||||
(reset! value-repr
|
(reset! value-repr
|
||||||
|
|||||||
Reference in New Issue
Block a user