diff --git a/src/core.clj b/src/core.clj index a65600e..e47b7fd 100644 --- a/src/core.clj +++ b/src/core.clj @@ -41,8 +41,8 @@ (defn unmatched-employees "Identify any mismatches between employees in the pay run and --project employee allocations." - [data projects] - (set/difference (set (keys projects)) (->> data (map :name) set))) + [records projects] + (set/difference (set (keys projects)) (->> records (map :name) set))) (defn -main [& args] (let [{:keys [options errors summary]} (parse-opts args cli-options) @@ -55,15 +55,15 @@ (str "The following errors occurred while parsing your command:\n\n" (str/join \newline errors))) (System/exit 1)) - (let [data (import/read-csv (:csv options)) - imported (concat (import/net-pay date period pay-invoice-no project data) - (import/individual-taxes date period pay-invoice-no retirement-invoice-no project data) - (import/employer-taxes date period pay-invoice-no project data) - (import/net-pay-ach-debit date period pay-receipt-no pay-invoice-no {} data) - (import/taxes-ach-debit date period pay-receipt-no pay-invoice-no {} data) - (import/fees date period fees-receipt-no fees-invoice-no total-fees project data) - (import/retirement date period retirement-receipt-no retirement-invoice-no data)) - unmatched (unmatched-employees data project)] + (let [records (import/read-csv (:csv options)) + imported (concat (import/net-pay date period pay-invoice-no project records) + (import/individual-taxes date period pay-invoice-no retirement-invoice-no project records) + (import/employer-taxes date period pay-invoice-no project records) + (import/net-pay-ach-debit date period pay-receipt-no pay-invoice-no {} records) + (import/taxes-ach-debit date period pay-receipt-no pay-invoice-no {} records) + (import/fees date period fees-receipt-no fees-invoice-no total-fees project records) + (import/retirement date period retirement-receipt-no retirement-invoice-no records)) + unmatched (unmatched-employees records project)] (when-not (empty? unmatched) (println (str "Could not find these employees in the payroll:\n\n" @@ -81,15 +81,15 @@ ;; These examples are not included with the code for privacy reasons. (require '[examples]) - (def data (import/read-csv "/home/ben/Downloads/2024-01-29_Pay-Item-Details_2024-01.csv")) + (def records (import/read-csv "/home/ben/Downloads/2024-01-29_Pay-Item-Details_2024-01.csv")) (def imported - (concat (import/net-pay "2024-01-31" "January 2024" "rt:19462/685751" {} data) - (import/individual-taxes "2024-01-31" "January 2024" "rt:19462/685751" "rt:19403/685602" {} data) - (import/employer-taxes "2024-01-31" "January 2024" "rt:19462/685751" {} data) - (import/net-pay-ach-debit "2024-01-31" "January 2024" "TODO-PAY-RECEIPT" "TODO-PAY-INVOICE" {} data) - (import/taxes-ach-debit "2024-01-31" "January 2024" "TODO-PAY-RECEIPT" "TODO-PAY-INVOICE" {} data) - (import/fees "2024-01-31" "January 2024" "rt:19459/675387" "rt:19459/674887" 206.50M {} data) - (import/retirement "2024-01-31" "January 2024" "rt:19403/685929" "rt:19403/685602" data))) + (concat (import/net-pay "2024-01-31" "January 2024" "rt:19462/685751" {} records) + (import/individual-taxes "2024-01-31" "January 2024" "rt:19462/685751" "rt:19403/685602" {} records) + (import/employer-taxes "2024-01-31" "January 2024" "rt:19462/685751" {} records) + (import/net-pay-ach-debit "2024-01-31" "January 2024" "TODO-PAY-RECEIPT" "TODO-PAY-INVOICE" {} records) + (import/taxes-ach-debit "2024-01-31" "January 2024" "TODO-PAY-RECEIPT" "TODO-PAY-INVOICE" {} records) + (import/fees "2024-01-31" "January 2024" "rt:19459/675387" "rt:19459/674887" 206.50M {} records) + (import/retirement "2024-01-31" "January 2024" "rt:19403/685929" "rt:19403/685602" records))) ;; Compare hand-written transactions with imported (ignoring ordering). (dd/pretty-print (dd/diff diff --git a/src/import.clj b/src/import.clj index fb5a846..173218e 100644 --- a/src/import.clj +++ b/src/import.clj @@ -121,7 +121,7 @@ ;; without realising that file existed and instead by precisely matching the ;; recent manually created payroll transactions). ;; -;; These functions take the input CSV data, pre-formatted and grouped by +;; These functions take the input CSV records, pre-formatted and grouped by ;; employee. ;; ;; The output is an intermediate data structure that can then be run through