Add brutto option for items

This commit is contained in:
Daniel O'Connell 2020-04-06 10:37:35 +02:00
parent bb85a5f2fa
commit 433a03cc30
2 changed files with 3 additions and 0 deletions

View File

@ -72,6 +72,7 @@ item is VAT free), :to (the date from which this item is valid), :from (the date
The price can be provided in one of the following ways:
* :netto - is a set price and will be displayed as provided
* :brutto - is a set price and will be first scaled down to netto
* :hourly - is an hourly price - worklogs will be queried in order to work out how many hours should be billed.
If no worklog could be found (or its :worked is nil), this item will be skipped.
* :base + :per-day - in the case of a variable number of hours worked. :base provides the amount that would be paid

View File

@ -7,6 +7,7 @@
(if-not vat-level 0 (* netto (/ vat-level 100))))
(defn brutto [{netto :netto :as item}] (round (+ netto (vat item))))
(defn netto [{brutto :brutto vat :vat}] (/ (* brutto 100) (+ 100 vat)))
(defn parse-custom
"Parse the given function definition and execute it with the given `worklog`."
@ -36,5 +37,6 @@
(contains? item :function) (assoc item :netto (calc-custom worked item))
(contains? item :hourly) (assoc item :netto (calc-hourly worked item))
(contains? item :base) (assoc item :netto (calc-part-time worked item))
(contains? item :brutto) (assoc item :netto (netto item))
(not (contains? item :netto)) (assoc item :netto 0)
:else item))