Fix receipt/invoice numbers

This commit is contained in:
Ben Sturmfels 2024-03-15 13:27:16 +11:00
parent ebb3cefeb7
commit a1b59bc609
Signed by: bsturmfels
GPG key ID: 023C05E2C9C068F0
2 changed files with 12 additions and 13 deletions

View file

@ -56,10 +56,9 @@
(str/join \newline errors))) (str/join \newline errors)))
(System/exit 1)) (System/exit 1))
(let [data (import/read-csv (:csv options)) (let [data (import/read-csv (:csv options))
;; TODO: Renamed receipt meta to invoice imported (concat (import/net-pay date period pay-invoice-no project data)
imported (concat (import/net-pay date period pay-receipt-no project data) (import/individual-taxes date period pay-invoice-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-invoice-no project data)
(import/employer-taxes date period pay-receipt-no project data)
(import/net-pay-ach-debit date period pay-receipt-no pay-invoice-no {} 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/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/fees date period fees-receipt-no fees-invoice-no total-fees project data)

View file

@ -134,11 +134,11 @@
(defn net-pay (defn net-pay
"Return a net pay transaction." "Return a net pay transaction."
[date period receipt-no projects records] [date period invoice-no projects records]
(let [template {:date date :desc (format "Monthly Payroll - %s - Net Pay" period) (let [template {:date date :desc (format "Monthly Payroll - %s - Net Pay" period)
:meta {:program "Conservancy:Payroll" :meta {:program "Conservancy:Payroll"
:project "Conservancy" :project "Conservancy"
:invoice receipt-no :invoice invoice-no
:approval "Financial/Employment-Records/memo-re-board-approval-of-payroll.txt" :approval "Financial/Employment-Records/memo-re-board-approval-of-payroll.txt"
:tax-implication "W2" :tax-implication "W2"
:payroll-type "US:General"} :payroll-type "US:General"}
@ -164,7 +164,7 @@
(defn individual-taxes (defn individual-taxes
"Return a transaction of expenses/witholding for each employee." "Return a transaction of expenses/witholding for each employee."
[date period receipt-no invoice-no projects records] [date period pay-invoice-no retirement-invoice-no projects records]
(for [[name employee-records] (group-by :name records)] (for [[name employee-records] (group-by :name records)]
(let [template {:date date :desc (format "Monthly Payroll - %s - TAXES - %s" period name) (let [template {:date date :desc (format "Monthly Payroll - %s - TAXES - %s" period name)
:meta (assoc-project :meta (assoc-project
@ -172,7 +172,7 @@
{:project "Conservancy" {:project "Conservancy"
:program "Conservancy:Payroll" :program "Conservancy:Payroll"
:entity name :entity name
:invoice receipt-no :invoice pay-invoice-no
:approval "Financial/Employment-Records/memo-re-board-approval-of-payroll.txt"}) :approval "Financial/Employment-Records/memo-re-board-approval-of-payroll.txt"})
:postings []} :postings []}
retirement-records (filter #(= (:type %) "Retirement") employee-records) retirement-records (filter #(= (:type %) "Retirement") employee-records)
@ -188,14 +188,14 @@
{:account "Expenses:Payroll:Salary" {:account "Expenses:Payroll:Salary"
:amount amount :currency "USD" :amount amount :currency "USD"
:meta {:payroll-type "US:403b:Match" :meta {:payroll-type "US:403b:Match"
:invoice invoice-no}} :invoice retirement-invoice-no}}
{:account "Expenses:Payroll:Salary" {:account "Expenses:Payroll:Salary"
:amount amount :currency "USD" :amount amount :currency "USD"
:meta {:payroll-type "US:403b:Employee" :meta {:payroll-type "US:403b:Employee"
:invoice invoice-no}})) :invoice retirement-invoice-no}}))
liability-postings [{:account "Liabilities:Payable:Accounts" liability-postings [{:account "Liabilities:Payable:Accounts"
:amount (- total-retirement) :currency "USD" :amount (- total-retirement) :currency "USD"
:meta {:invoice invoice-no}}] :meta {:invoice retirement-invoice-no}}]
withholding-postings (for [{:keys [category amount]} witholding-records] withholding-postings (for [{:keys [category amount]} witholding-records]
{:account "Expenses:Payroll:Salary" {:account "Expenses:Payroll:Salary"
:amount amount :currency "USD" :amount amount :currency "USD"
@ -220,11 +220,11 @@
(defn employer-taxes (defn employer-taxes
"Return an employer taxes transaction." "Return an employer taxes transaction."
[date period receipt-no projects records] [date period invoice-no projects records]
(let [template {:date date :desc (format "Monthly Payroll - %s - TAXES - Employer" period) (let [template {:date date :desc (format "Monthly Payroll - %s - TAXES - Employer" period)
:meta {:program "Conservancy:Payroll" :meta {:program "Conservancy:Payroll"
:project "Conservancy" :project "Conservancy"
:invoice receipt-no :invoice invoice-no
:approval "Financial/Employment-Records/memo-re-board-approval-of-payroll.txt"} :approval "Financial/Employment-Records/memo-re-board-approval-of-payroll.txt"}
:postings []} :postings []}
liability-records (filter (fn [{:keys [category type]}] liability-records (filter (fn [{:keys [category type]}]