Merge branch 'master' into datomic
This commit is contained in:
1
migrator/migrations/1534475443-DOWN-update-companies.sql
Normal file
1
migrator/migrations/1534475443-DOWN-update-companies.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-- 1534475443 DOWN update-companies
|
||||||
25
migrator/migrations/1534475443-UP-update-companies.sql
Normal file
25
migrator/migrations/1534475443-UP-update-companies.sql
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
-- 1534475443 UP update-companies
|
||||||
|
DELETE FROM companies where code in
|
||||||
|
('BES', 'BSA', 'HM', 'FCF', 'INT', 'JS', 'MV', 'ORA', 'SK', 'SLO', 'WE', 'MPI');
|
||||||
|
|
||||||
|
INSERT INTO companies (code, name, data)
|
||||||
|
VALUES
|
||||||
|
('BES', 'Brian & Erin Skarbek', '{:locations ["CB"] }'),
|
||||||
|
('BSA', 'Be Steak A', '{:locations ["CB"] }'),
|
||||||
|
('HM', 'Hiro Mura', '{:locations ["SV"] }'),
|
||||||
|
('FCF', 'Frost Cupcake Factory', '{:locations ["CB"] }'),
|
||||||
|
('INT', 'Integreat', '{:locations ["CB"] }'),
|
||||||
|
('JS', 'Jason Skarbek', '{:locations ["CB"] }'),
|
||||||
|
('MV', 'Mio Vicino - Santa Clara', '{:locations ["SC"] }'),
|
||||||
|
('MPI', 'Moscini Pizza', '{:locations ["CB"] }'),
|
||||||
|
('ORA', 'Orale''s', '{:locations ["CB"] }'),
|
||||||
|
('SK', 'Savory Kitchen', '{:locations ["AL"] }'),
|
||||||
|
('SLO', 'Skarbek Law Offices', '{:locations ["CB"] }'),
|
||||||
|
('WE', 'Warm Elements', '{:locations ["CB"] }');
|
||||||
|
|
||||||
|
DELETE FROM invoices_expense_accounts where invoice_id in (select id from invoices where company_id in (select id from companies where name in ('Knock Out Grill & Bar', 'Nasch Bistro', 'Naschmarkt', 'The Socialight')));
|
||||||
|
DELETE FROM invoices_checks where invoice_id in (select id from invoices where company_id in (select id from companies where name in ('Knock Out Grill & Bar', 'Nasch Bistro', 'Naschmarkt', 'The Socialight')));
|
||||||
|
|
||||||
|
DELETE FROM invoices where company_id in (select id from companies where name in ('Knock Out Grill & Bar', 'Nasch Bistro', 'Naschmarkt', 'The Socialight'));
|
||||||
|
DELETE FROM checks where company_id in (select id from companies where name in ('Knock Out Grill & Bar', 'Nasch Bistro', 'Naschmarkt', 'The Socialight'));
|
||||||
|
DELETE FROM companies where name in ('Knock Out Grill & Bar', 'Nasch Bistro', 'Naschmarkt', 'The Socialight');
|
||||||
31
resources/new-bank-accounts.csv
Normal file
31
resources/new-bank-accounts.csv
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
Bella Saratoga BSG - Capitol One Card - 5729 16551129 Capital One CC NA 5729 NA NA
|
||||||
|
Bella Saratoga BSG - Capitol One Card 5814 16551286 Capital One CC NA 5814 NA NA
|
||||||
|
Brian & Erin Skarbek SBE Chase Checking 16421865 Chase Bank, NA 322271627 4440034059 90-7162/3222 10000
|
||||||
|
Be Steak A CSH - Chase Bus Platinum Checking 16417200 Chase Bank, NA 322271627 876352191 90-7162/3222 10000
|
||||||
|
Hiro Mura HIM WF Checking 9522 16421944 Wells Fargo 121042882 5700859522 11-4288/1210 10000
|
||||||
|
Hiro Mura HIM WF Payroll 7599 16421943 Wells Fargo 121042882 7599 11-4288/1210 10000
|
||||||
|
Hiro Mura HIM WF CC Derik 2418 16421945 Wells Fargo NA 2418 NA NA
|
||||||
|
Hiro Mura HIM WF CC Todd 6993 16421946 Wells Fargo NA 6993 NA NA
|
||||||
|
Hiro Mura HIM Citi Visa Costco 9392 16428403 Citi Visa CC NA 9392 NA NA
|
||||||
|
Integreat BSK Chase BSK Main 16421862 Chase Bank, NA 322271627 793785572 90-7162/3222 10000
|
||||||
|
Integreat BSK Chase BSK Ink 16421963 Chase CC NA 8362 NA NA
|
||||||
|
Jason Skarbek JMS - BofA Checking 16428443 Bank of America 121000358 3275 11-35/1210 10000
|
||||||
|
Mio Vicino - Santa Clara MVSC - BofA Main - 2799 16422493 Bank of America 121000358 42902799 11-35/1210 10000
|
||||||
|
Mio Vicino - Santa Clara MVSC - BofA Payroll - 2283 16422492 Bank of America 121000358 2283 11-35/1210 10000
|
||||||
|
Mio Vicino - Santa Clara MVSC - BofA Inv - 5537 16422491 Bank of America NA 5537 NA NA
|
||||||
|
Mio Vicino - Santa Clara MVSC - BofA Corp Card Main - 5918 16422494 BofA CC NA 5918 NA NA
|
||||||
|
Mio Vicino - Santa Clara MVSC - BofA Corp Card John - 6485 16422495 BofA CC NA 6485 NA NA
|
||||||
|
Moscini Pizza MPI - Cap One - CB 0065 16550810 Capital One CC 65 NA NA
|
||||||
|
Moscini Pizza MPI - Cap One - SC 8392 16550811 Capital One CC 8392 NA NA
|
||||||
|
Moscini Pizza MPI - Cap One - BM 8396 16551102 Capital One CC 8396 NA NA
|
||||||
|
Orale's OMG - WF Business Checking 16422285 Wells Fargo 121042882 7319440462 11-4288/1210 10000
|
||||||
|
Orale's OMG - BofA CC 4914 16422296 BofA CC NA 4914 NA NA
|
||||||
|
Savory Kitchen SK - Citi Card 16428420 Citi CC NA 3039 NA NA
|
||||||
|
Skarbek Law Offices SLO Chase SLO Main 16421863 Chase Bank, NA 322271627 571585533 90-7162/3222 10000
|
||||||
|
Skarbek Law Offices SLO Chase Payroll 16421869 Chase Bank, NA 322271627 3110388457 90-7162/3222 10000
|
||||||
|
Skarbek Law Offices SLO Chase UD Exp 16421860 Chase Bank, NA 322271627 891155269 90-7162/3222 10000
|
||||||
|
Skarbek Law Offices SLO IOLTA 16421861 Chase Bank, NA 322271627 987982816 90-7162/3222 10000
|
||||||
|
Skarbek Law Offices SLO Chase CC 16421962 Chase CC NA 6088 NA NA
|
||||||
|
Skarbek Law Offices LTE Chase Main 16421864 Chase Bank, NA 322271627 259687089 90-7162/3222 10000
|
||||||
|
Warm Elements HOB - AmEx Card 16428453 Amex CC NA 51009 NA NA
|
||||||
|
Warm Elements HOB - AmEx Card 16428453 Amex CC 51009 NA NA
|
||||||
|
64
scratch-sessions/add-bank-accounts.clj
Normal file
64
scratch-sessions/add-bank-accounts.clj
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
;; This buffer is for Clojure experiments and evaluation.
|
||||||
|
;; Press C-j to evaluate the last expression.
|
||||||
|
|
||||||
|
(require #_'[clojure.data.csv :as csv]
|
||||||
|
'[clojure.java.io :as io]
|
||||||
|
'[auto-ap.db.companies :as c]
|
||||||
|
'[clojure.string :as str]
|
||||||
|
'[auto-ap.utils :refer [by]])
|
||||||
|
|
||||||
|
(def companies (by :name (c/get-all)))
|
||||||
|
#_ (defonce rows (with-open [reader (io/reader "resources/new-bank-accounts.csv")]
|
||||||
|
(doall
|
||||||
|
(csv/read-csv reader :separator \tab))))
|
||||||
|
(defonce all-rows (list ["Bella Saratoga" "BSG - Capitol One Card - 5729" "16551129" "Capital One CC" "NA" "5729" "NA" "NA"]
|
||||||
|
["Bella Saratoga" "BSG - Capitol One Card 5814" "16551286" "Capital One CC" "NA" "5814" "NA" "NA"]
|
||||||
|
["Brian & Erin Skarbek" "SBE Chase Checking" "16421865" "Chase Bank, NA" "322271627" "4440034059" "90-7162/3222" "10000"]
|
||||||
|
["Be Steak A" "CSH - Chase Bus Platinum Checking" "16417200" "Chase Bank, NA" "322271627" "876352191" "90-7162/3222" "10000"]
|
||||||
|
["Hiro Mura" "HIM WF Checking 9522" "16421944" "Wells Fargo" "121042882" "5700859522" "11-4288/1210" "10000"]
|
||||||
|
["Hiro Mura" "HIM WF Payroll 7599" "16421943" "Wells Fargo" "121042882" "7599" "11-4288/1210" "10000"]
|
||||||
|
["Hiro Mura" "HIM WF CC Derik 2418" "16421945" "Wells Fargo" "NA" "2418" "NA" "NA"]
|
||||||
|
["Hiro Mura" "HIM WF CC Todd 6993" "16421946" "Wells Fargo" "NA" "6993" "NA" "NA"]
|
||||||
|
["Hiro Mura" "HIM Citi Visa Costco 9392" "16428403" "Citi Visa CC" "NA" "9392" "NA" "NA"]
|
||||||
|
["Integreat" "BSK Chase BSK Main" "16421862" "Chase Bank, NA" "322271627" "793785572" "90-7162/3222" "10000"]
|
||||||
|
["Integreat" "BSK Chase BSK Ink" "16421963" "Chase CC" "NA" "8362" "NA" "NA"]
|
||||||
|
["Jason Skarbek" "JMS - BofA Checking" "16428443" "Bank of America" "121000358" "3275" "11-35/1210" "10000"]
|
||||||
|
["Mio Vicino - Santa Clara" "MVSC - BofA Main - 2799" "16422493" "Bank of America" "121000358" "42902799" "11-35/1210" "10000"]
|
||||||
|
["Mio Vicino - Santa Clara" "MVSC - BofA Payroll - 2283" "16422492" "Bank of America" "121000358" "2283" "11-35/1210" "10000"]
|
||||||
|
["Mio Vicino - Santa Clara" "MVSC - BofA Inv - 5537" "16422491" "Bank of America" "NA" "5537" "NA" "NA"]
|
||||||
|
["Mio Vicino - Santa Clara" "MVSC - BofA Corp Card Main - 5918" "16422494" "BofA CC" "NA" "5918" "NA" "NA"]
|
||||||
|
["Mio Vicino - Santa Clara" "MVSC - BofA Corp Card John - 6485" "16422495" "BofA CC" "NA" "6485" "NA" "NA"]
|
||||||
|
["Moscini Pizza" "MPI - Cap One - CB 0065" "16550810" "Capital One CC" "" "65" "NA" "NA"]
|
||||||
|
["Moscini Pizza" "MPI - Cap One - SC 8392" "16550811" "Capital One CC" "" "8392" "NA" "NA"]
|
||||||
|
["Moscini Pizza" "MPI - Cap One - BM 8396" "16551102" "Capital One CC" "" "8396" "NA" "NA"]
|
||||||
|
["Orale's" "OMG - WF Business Checking" "16422285" "Wells Fargo" "121042882" "7319440462" "11-4288/1210" "10000"]
|
||||||
|
["Orale's" "OMG - BofA CC 4914" "16422296" "BofA CC" "NA" "4914" "NA" "NA"]
|
||||||
|
["Savory Kitchen" "SK - Citi Card" "16428420" "Citi CC" "NA" "3039" "NA" "NA"]
|
||||||
|
["Skarbek Law Offices" "SLO Chase SLO Main" "16421863" "Chase Bank, NA" "322271627" "571585533" "90-7162/3222" "10000"]
|
||||||
|
["Skarbek Law Offices" "SLO Chase Payroll" "16421869" "Chase Bank, NA" "322271627" "3110388457" "90-7162/3222" "10000"]
|
||||||
|
["Skarbek Law Offices" "SLO Chase UD Exp" "16421860" "Chase Bank, NA" "322271627" "891155269" "90-7162/3222" "10000"]
|
||||||
|
["Skarbek Law Offices" "SLO IOLTA" "16421861" "Chase Bank, NA" "322271627" "987982816" "90-7162/3222" "10000"]
|
||||||
|
["Skarbek Law Offices" "SLO Chase CC" "16421962" "Chase CC" "NA" "6088" "NA" "NA"]
|
||||||
|
["Skarbek Law Offices" "LTE Chase Main" "16421864" "Chase Bank, NA" "322271627" "259687089" "90-7162/3222" "10000"]
|
||||||
|
["Warm Elements" "HOB - AmEx Card" "16428453" "Amex CC" "NA" "51009" "NA" "NA"] ["Warm Elements" "HOB - AmEx Card" "16428453" "Amex CC" "" "51009" "NA" "NA"]))
|
||||||
|
|
||||||
|
(doseq [[company-name nickname yodlee-account-id bank routing account bank-code starting-at] all-rows]
|
||||||
|
(let [company-name (str/trim company-name)]
|
||||||
|
|
||||||
|
(println (str "adding '" company-name "' : " (companies company-name)))
|
||||||
|
(c/add-bank-account (:id (companies company-name))
|
||||||
|
{:number account
|
||||||
|
:name nickname
|
||||||
|
:yodlee-account-id (Integer/parseInt yodlee-account-id)
|
||||||
|
:bank-name bank
|
||||||
|
:routing (if (#{"NA" ""} routing)
|
||||||
|
nil
|
||||||
|
routing)
|
||||||
|
:bank-code (if (#{"NA" ""} bank-code)
|
||||||
|
nil
|
||||||
|
bank-code)
|
||||||
|
:check-number (if (#{"NA" ""} starting-at)
|
||||||
|
nil
|
||||||
|
(Integer/parseInt starting-at))})))
|
||||||
|
|
||||||
|
|
||||||
@@ -18,9 +18,10 @@
|
|||||||
]
|
]
|
||||||
(r/create-class
|
(r/create-class
|
||||||
{:reagent-render (fn [{:keys [matches on-change field text-field value class not-found-description]}]
|
{:reagent-render (fn [{:keys [matches on-change field text-field value class not-found-description]}]
|
||||||
|
|
||||||
(let [text @text
|
(let [text @text
|
||||||
valid-matches (take 5 (for [[[id t :as match] i] (map vector matches (range))
|
valid-matches (take 5 (for [[[id t :as match] i] (map vector matches (range))
|
||||||
:when (str/includes? (.toLowerCase t) (.toLowerCase text))]
|
:when (str/includes? (or (some-> t .toLowerCase) "") (or (some-> text .toLowerCase) ""))]
|
||||||
match))
|
match))
|
||||||
valid-matches (if (and not-found-description text)
|
valid-matches (if (and not-found-description text)
|
||||||
(concat valid-matches [[:not-found (not-found-description text) (not-found-value text)]])
|
(concat valid-matches [[:not-found (not-found-description text) (not-found-value text)]])
|
||||||
@@ -68,6 +69,7 @@
|
|||||||
false)
|
false)
|
||||||
true))
|
true))
|
||||||
:on-change (fn [e]
|
:on-change (fn [e]
|
||||||
|
(println valid-matches)
|
||||||
(reset! highlighted (ffirst valid-matches))
|
(reset! highlighted (ffirst valid-matches))
|
||||||
(select [nil (.. e -target -value)]))}
|
(select [nil (.. e -target -value)]))}
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -3,8 +3,11 @@
|
|||||||
(:require [re-frame.core :as re-frame]
|
(:require [re-frame.core :as re-frame]
|
||||||
[reagent.core :as reagent]
|
[reagent.core :as reagent]
|
||||||
[auto-ap.subs :as subs]
|
[auto-ap.subs :as subs]
|
||||||
|
[auto-ap.events :as all-events]
|
||||||
[auto-ap.events.admin.companies :as events]
|
[auto-ap.events.admin.companies :as events]
|
||||||
[auto-ap.entities.companies :as entity]
|
[auto-ap.entities.companies :as entity]
|
||||||
|
|
||||||
|
[auto-ap.views.components.typeahead :refer [typeahead]]
|
||||||
[auto-ap.views.utils :refer [login-url dispatch-value-change bind-field horizontal-field dispatch-event]]
|
[auto-ap.views.utils :refer [login-url dispatch-value-change bind-field horizontal-field dispatch-event]]
|
||||||
[cljs.reader :as edn]
|
[cljs.reader :as edn]
|
||||||
[auto-ap.routes :as routes]
|
[auto-ap.routes :as routes]
|
||||||
@@ -16,6 +19,11 @@
|
|||||||
(fn [db]
|
(fn [db]
|
||||||
(::excel-import db)))
|
(::excel-import db)))
|
||||||
|
|
||||||
|
(re-frame/reg-sub
|
||||||
|
::expense-accounts
|
||||||
|
(fn [db]
|
||||||
|
(::expense-accounts db)))
|
||||||
|
|
||||||
(re-frame/reg-event-db
|
(re-frame/reg-event-db
|
||||||
::change
|
::change
|
||||||
(fn [db [_ field v]]
|
(fn [db [_ field v]]
|
||||||
@@ -71,13 +79,15 @@
|
|||||||
::create-vendors
|
::create-vendors
|
||||||
(fn [{:keys [db]}]
|
(fn [{:keys [db]}]
|
||||||
(let [excel-import (::excel-import db)]
|
(let [excel-import (::excel-import db)]
|
||||||
|
(println (::expense-accounts db))
|
||||||
{:https {:requests (map (fn [v]
|
{:https {:requests (map (fn [v]
|
||||||
{:token (:user db)
|
{:token (:user db)
|
||||||
:method :post
|
:method :post
|
||||||
:body (pr-str {:name v})
|
:body (pr-str {:name v :default-expense-account (-> db ::expense-accounts (get v) :default-expense-account) })
|
||||||
:headers {"Content-Type" "application/edn"}
|
:headers {"Content-Type" "application/edn"}
|
||||||
:uri (str "/api/vendors/")})
|
:uri (str "/api/vendors/")})
|
||||||
(get-in db [::excel-import :create-vendors]))
|
(doto (get-in db [::excel-import :create-vendors])
|
||||||
|
println))
|
||||||
:on-success [::create-vendor-complete]
|
:on-success [::create-vendor-complete]
|
||||||
:on-error [::create-vendor-error]}
|
:on-error [::create-vendor-error]}
|
||||||
:db (-> db
|
:db (-> db
|
||||||
@@ -98,7 +108,11 @@
|
|||||||
(let [{{:keys [vendors-not-found already-imported imported]} :rows
|
(let [{{:keys [vendors-not-found already-imported imported]} :rows
|
||||||
:keys [create-vendors]
|
:keys [create-vendors]
|
||||||
:or {create-vendors #{}}
|
:or {create-vendors #{}}
|
||||||
:as excel-import-data} @(re-frame/subscribe [::excel-import])]
|
:as excel-import-data} @(re-frame/subscribe [::excel-import])
|
||||||
|
data @(re-frame/subscribe [::expense-accounts])
|
||||||
|
|
||||||
|
chooseable-expense-accounts @(re-frame/subscribe [::subs/chooseable-expense-accounts])
|
||||||
|
change-event [::all-events/change-form [::expense-accounts]]]
|
||||||
[:div
|
[:div
|
||||||
[:h1.title "Import Invoices from Integreat Excel"]
|
[:h1.title "Import Invoices from Integreat Excel"]
|
||||||
(when (seq vendors-not-found)
|
(when (seq vendors-not-found)
|
||||||
@@ -113,17 +127,26 @@
|
|||||||
^{:key i}
|
^{:key i}
|
||||||
[:div.column
|
[:div.column
|
||||||
(for [v vendor-group]
|
(for [v vendor-group]
|
||||||
^{:key v} [:div.control
|
^{:key v} [:div.field.is-grouped
|
||||||
[:label.checkbox
|
[:p.control
|
||||||
[:input {:value v
|
[:label.checkbox
|
||||||
:checked (if (create-vendors v)
|
[:input {:value v
|
||||||
"checked"
|
:checked (if (create-vendors v)
|
||||||
"")
|
"checked"
|
||||||
|
"")
|
||||||
|
|
||||||
:type "checkbox"
|
:type "checkbox"
|
||||||
:on-change (fn []
|
:on-change (fn []
|
||||||
(re-frame/dispatch [::toggle-vendor v]))}]
|
(re-frame/dispatch [::toggle-vendor v]))}]
|
||||||
(str " " v)]])])]
|
(str " " v)]]
|
||||||
|
|
||||||
|
[:p.control
|
||||||
|
[bind-field
|
||||||
|
[typeahead {:matches (map (fn [x] [(:id x) (:name x)]) chooseable-expense-accounts)
|
||||||
|
:type "typeahead"
|
||||||
|
:field [v :default-expense-account]
|
||||||
|
:event change-event
|
||||||
|
:subscription data}]]]])])]
|
||||||
[:div
|
[:div
|
||||||
[:button.button.is-pulled-right
|
[:button.button.is-pulled-right
|
||||||
{:on-click (dispatch-event [::create-vendors])
|
{:on-click (dispatch-event [::create-vendors])
|
||||||
|
|||||||
@@ -554,7 +554,7 @@
|
|||||||
(for [{:keys [id number name]} (:bank-accounts current-company)]
|
(for [{:keys [id number name]} (:bank-accounts current-company)]
|
||||||
^{:key id} [:option {:value id} name])]]]]
|
^{:key id} [:option {:value id} name])]]]]
|
||||||
|
|
||||||
[:table.table
|
[:table.table.is-fullwidth
|
||||||
[:thead
|
[:thead
|
||||||
[:tr
|
[:tr
|
||||||
[:th "Vendor"]
|
[:th "Vendor"]
|
||||||
|
|||||||
Reference in New Issue
Block a user