Check the employees named with --project
are in the pay run
This commit is contained in:
parent
8029f8b60c
commit
2d65abbd58
1 changed files with 15 additions and 3 deletions
18
src/core.clj
18
src/core.clj
|
@ -3,7 +3,8 @@
|
|||
|
||||
(ns core
|
||||
"Beancount importer for Paychex Pay Item Details report."
|
||||
(:require [clojure.string :as str]
|
||||
(:require [clojure.set :as set]
|
||||
[clojure.string :as str]
|
||||
[clojure.tools.cli :refer [parse-opts]]
|
||||
[import :as import])
|
||||
(:gen-class))
|
||||
|
@ -36,6 +37,11 @@
|
|||
:assoc-fn (fn [m k [name proj]] (assoc-in m [k name] proj))]
|
||||
["-h" "--help"]])
|
||||
|
||||
(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)))
|
||||
|
||||
(defn -main [& args]
|
||||
(let [{:keys [options errors summary]} (parse-opts args cli-options)
|
||||
{:keys [date period pay-receipt-no total-fees fees-receipt-no fees-invoice-no retirement-receipt-no retirement-invoice-no project]} options]
|
||||
|
@ -52,9 +58,15 @@
|
|||
(import/individual-taxes date period pay-receipt-no retirement-invoice-no project data)
|
||||
(import/employer-taxes date period pay-receipt-no project data)
|
||||
(import/payroll-fees date period fees-receipt-no fees-invoice-no total-fees project data)
|
||||
(import/retirement date period retirement-receipt-no retirement-invoice-no data))]
|
||||
(import/retirement date period retirement-receipt-no retirement-invoice-no data))
|
||||
unmatched (unmatched-employees data project)]
|
||||
(when-not (empty? unmatched)
|
||||
(println
|
||||
(str "Could not find these employees in the payroll:\n\n"
|
||||
(str/join ", " unmatched)))
|
||||
(System/exit 1))
|
||||
(doseq [i imported]
|
||||
(println (import/render-transaction i))))))
|
||||
(println (import/render-transaction i))))))
|
||||
|
||||
(comment
|
||||
;; Examples to exercise the importer during development.
|
||||
|
|
Loading…
Reference in a new issue