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
16
src/core.clj
16
src/core.clj
|
@ -3,7 +3,8 @@
|
||||||
|
|
||||||
(ns core
|
(ns core
|
||||||
"Beancount importer for Paychex Pay Item Details report."
|
"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]]
|
[clojure.tools.cli :refer [parse-opts]]
|
||||||
[import :as import])
|
[import :as import])
|
||||||
(:gen-class))
|
(:gen-class))
|
||||||
|
@ -36,6 +37,11 @@
|
||||||
:assoc-fn (fn [m k [name proj]] (assoc-in m [k name] proj))]
|
:assoc-fn (fn [m k [name proj]] (assoc-in m [k name] proj))]
|
||||||
["-h" "--help"]])
|
["-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]
|
(defn -main [& args]
|
||||||
(let [{:keys [options errors summary]} (parse-opts args cli-options)
|
(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]
|
{:keys [date period pay-receipt-no total-fees fees-receipt-no fees-invoice-no retirement-receipt-no retirement-invoice-no project]} options]
|
||||||
|
@ -52,7 +58,13 @@
|
||||||
(import/individual-taxes date period pay-receipt-no retirement-invoice-no project data)
|
(import/individual-taxes date period pay-receipt-no retirement-invoice-no project data)
|
||||||
(import/employer-taxes date period pay-receipt-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/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]
|
(doseq [i imported]
|
||||||
(println (import/render-transaction i))))))
|
(println (import/render-transaction i))))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue