Align unemployment postings
This commit is contained in:
parent
d77967d61b
commit
3f4abaf524
2 changed files with 37 additions and 27 deletions
|
@ -74,9 +74,8 @@
|
||||||
(def imported
|
(def imported
|
||||||
(concat (import/payroll "2024-01-31" "January 2024" "rt:19462/685751" grouped-data)
|
(concat (import/payroll "2024-01-31" "January 2024" "rt:19462/685751" grouped-data)
|
||||||
(import/individual-taxes "2024-01-31" "January 2024" "rt:19462/685751" "rt:19403/685602" grouped-data)
|
(import/individual-taxes "2024-01-31" "January 2024" "rt:19462/685751" "rt:19403/685602" grouped-data)
|
||||||
;; TODO: Needs fixes for the correct :entity and :memo
|
|
||||||
(import/employer-taxes "2024-01-31" "January 2024" "rt:19462/685751" grouped-data)
|
(import/employer-taxes "2024-01-31" "January 2024" "rt:19462/685751" grouped-data)
|
||||||
#_(import/payroll-fees "2024-01-31" "January 2024" "rt:19459/675387" "rt:19459/674887" 206.50M grouped-data)
|
(import/payroll-fees "2024-01-31" "January 2024" "rt:19459/675387" "rt:19459/674887" 206.50M grouped-data)
|
||||||
(import/retirement "2024-01-31" "January 2024" "rt:19403/685929" "rt:19403/685602" grouped-data)))
|
(import/retirement "2024-01-31" "January 2024" "rt:19403/685929" "rt:19403/685602" grouped-data)))
|
||||||
(dd/pretty-print
|
(dd/pretty-print
|
||||||
(dd/diff
|
(dd/diff
|
||||||
|
|
|
@ -64,16 +64,10 @@
|
||||||
"NY Re-empl Svc" "US:NY:Reempt"
|
"NY Re-empl Svc" "US:NY:Reempt"
|
||||||
cat))
|
cat))
|
||||||
|
|
||||||
(defn employee-entity-meta [name]
|
(defn assoc-project [name m]
|
||||||
(if (= name "Sharp-Sage-A")
|
(if (= name "Sharp-Sage-A")
|
||||||
{:entity name
|
(assoc m :project "Outreachy")
|
||||||
:project "Outreachy"}
|
m))
|
||||||
{:entity name}))
|
|
||||||
|
|
||||||
(defn project [name]
|
|
||||||
(if (= name "Sharp-Sage-A")
|
|
||||||
"Outreachy"
|
|
||||||
"Conservancy"))
|
|
||||||
|
|
||||||
(defn split-fee
|
(defn split-fee
|
||||||
"Share a total fee into n groups allocating the remainder as evenly as possible."
|
"Share a total fee into n groups allocating the remainder as evenly as possible."
|
||||||
|
@ -101,7 +95,7 @@
|
||||||
[{:account "Expenses:Payroll:Salary"
|
[{:account "Expenses:Payroll:Salary"
|
||||||
:amount actual-total-net-pay
|
:amount actual-total-net-pay
|
||||||
:currency "USD"
|
:currency "USD"
|
||||||
:meta (employee-entity-meta name)}
|
:meta (assoc-project name {:entity name})}
|
||||||
{:account "Assets:FR:Check2721"
|
{:account "Assets:FR:Check2721"
|
||||||
:amount (- actual-total-net-pay)
|
:amount (- actual-total-net-pay)
|
||||||
:currency "USD"
|
:currency "USD"
|
||||||
|
@ -109,11 +103,11 @@
|
||||||
{:account "Expenses:Hosting"
|
{:account "Expenses:Hosting"
|
||||||
:amount total-reimbursement
|
:amount total-reimbursement
|
||||||
:currency "USD"
|
:currency "USD"
|
||||||
:meta (merge (employee-entity-meta name) {:payroll-type "US:Reimbursement"})}
|
:meta (assoc-project name {:entity name :payroll-type "US:Reimbursement"})}
|
||||||
{:account "Assets:FR:Check2721"
|
{:account "Assets:FR:Check2721"
|
||||||
:amount (- total-reimbursement)
|
:amount (- total-reimbursement)
|
||||||
:currency "USD"
|
:currency "USD"
|
||||||
:meta (merge (employee-entity-meta name) {:tax-implication "Reimbursement"})}]))]
|
:meta (assoc-project name {:entity name :tax-implication "Reimbursement"})}]))]
|
||||||
[{:date date :desc (format "Monthly Payroll - %s - Net Pay" period)
|
[{:date date :desc (format "Monthly Payroll - %s - Net Pay" period)
|
||||||
:meta {:program "Conservancy:Payroll"
|
:meta {:program "Conservancy:Payroll"
|
||||||
:project "Conservancy"
|
:project "Conservancy"
|
||||||
|
@ -170,11 +164,11 @@
|
||||||
:amount (reduce + (map :amount insurance-lines))
|
:amount (reduce + (map :amount insurance-lines))
|
||||||
:currency "USD"}]]
|
:currency "USD"}]]
|
||||||
{:date date :desc (format "Monthly Payroll - %s - TAXES - %s" period name)
|
{:date date :desc (format "Monthly Payroll - %s - TAXES - %s" period name)
|
||||||
:meta {:project (project name)
|
:meta (assoc-project name {:project "Conservancy"
|
||||||
:program "Conservancy:Payroll"
|
:program "Conservancy:Payroll"
|
||||||
:entity name
|
:entity name
|
||||||
:receipt receipt-no
|
:receipt receipt-no
|
||||||
:approval "Financial/Employment-Records/memo-re-board-approval-of-payroll.txt"}
|
:approval "Financial/Employment-Records/memo-re-board-approval-of-payroll.txt"})
|
||||||
:postings (concat
|
:postings (concat
|
||||||
super-postings
|
super-postings
|
||||||
liability-postings
|
liability-postings
|
||||||
|
@ -188,18 +182,35 @@
|
||||||
[date period receipt-no groups]
|
[date period receipt-no groups]
|
||||||
(let [liability-postings (apply concat
|
(let [liability-postings (apply concat
|
||||||
(for [[name records] groups]
|
(for [[name records] groups]
|
||||||
(let [liability-lines (filter #(= (:type %) "Liability") records)]
|
(let [liability-lines (filter #(and (= (:type %) "Liability")
|
||||||
|
(not (str/includes? (:category %) "Unemploy"))) records)]
|
||||||
(for [{:keys [category amount]} liability-lines]
|
(for [{:keys [category amount]} liability-lines]
|
||||||
{:account "Expenses:Payroll:Tax"
|
{:account "Expenses:Payroll:Tax"
|
||||||
:amount amount
|
:amount amount
|
||||||
:currency "USD"
|
:currency "USD"
|
||||||
:meta (merge
|
|
||||||
(employee-entity-meta name)
|
|
||||||
;; TODO: Check lack of ":Tax:" with Rosanne.
|
;; TODO: Check lack of ":Tax:" with Rosanne.
|
||||||
{:payroll-type (str/replace (cat->acct category) "Tax:" "")})}))))
|
:meta (assoc-project
|
||||||
|
name
|
||||||
|
{:entity name
|
||||||
|
:payroll-type (str/replace (cat->acct category) "Tax:" "")})}))))
|
||||||
total-liabilities (->> liability-postings (map :amount) (reduce +))
|
total-liabilities (->> liability-postings (map :amount) (reduce +))
|
||||||
|
unemploy-postings (apply concat
|
||||||
|
(for [[name records] groups]
|
||||||
|
(let [unemploy-lines (filter #(and (= (:type %) "Liability")
|
||||||
|
(str/includes? (:category %) "Unemploy")) records)]
|
||||||
|
(for [{:keys [amount category]} unemploy-lines]
|
||||||
|
{:account "Expenses:Payroll:Tax"
|
||||||
|
:amount amount
|
||||||
|
:currency "USD"
|
||||||
|
:meta (assoc-project
|
||||||
|
name
|
||||||
|
{:entity (first (str/split category #" "))
|
||||||
|
;; TODO: Karen doesn't have a memo in January 2024
|
||||||
|
:memo name
|
||||||
|
:payroll-type (str "US:" (cat->acct category))})}))))
|
||||||
|
total-unemploy (->> unemploy-postings (map :amount) (reduce +))
|
||||||
asset-postings [{:account "Assets:FR:Check2721"
|
asset-postings [{:account "Assets:FR:Check2721"
|
||||||
:amount (- total-liabilities)
|
:amount (- (+ total-liabilities total-unemploy))
|
||||||
:currency "USD"
|
:currency "USD"
|
||||||
:meta {:entity "Paychex"
|
:meta {:entity "Paychex"
|
||||||
:tax-implication "Tax-Payment"}}]]
|
:tax-implication "Tax-Payment"}}]]
|
||||||
|
@ -208,7 +219,7 @@
|
||||||
:project "Conservancy"
|
:project "Conservancy"
|
||||||
:receipt receipt-no
|
:receipt receipt-no
|
||||||
:approval "Financial/Employment-Records/memo-re-board-approval-of-payroll.txt"}
|
:approval "Financial/Employment-Records/memo-re-board-approval-of-payroll.txt"}
|
||||||
:postings (concat liability-postings asset-postings)}]))
|
:postings (concat liability-postings unemploy-postings asset-postings)}]))
|
||||||
|
|
||||||
(defn payroll-fees
|
(defn payroll-fees
|
||||||
"Return a payroll fees transaction."
|
"Return a payroll fees transaction."
|
||||||
|
@ -220,7 +231,7 @@
|
||||||
{:account "Expenses:Payroll:Fees"
|
{:account "Expenses:Payroll:Fees"
|
||||||
:amount fee
|
:amount fee
|
||||||
:currency "USD"
|
:currency "USD"
|
||||||
:meta (employee-entity-meta name)})
|
:meta (assoc-project name {:entity name})})
|
||||||
asset-postings [{:account "Assets:FR:Check2721"
|
asset-postings [{:account "Assets:FR:Check2721"
|
||||||
:amount (- total-fees)
|
:amount (- total-fees)
|
||||||
:currency "USD"}]]
|
:currency "USD"}]]
|
||||||
|
|
Loading…
Reference in a new issue