Skip to content

Commit

Permalink
Show average unit price in calculations PDF. (#252)
Browse files Browse the repository at this point in the history
* Show average unit price in calculations PDF.

* Update example PDF

Co-authored-by: Ruslan Sayfutdinov <[email protected]>
  • Loading branch information
thibwk and KapJI committed Aug 22, 2022
1 parent e4822af commit 204e159
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Binary file modified calculations_example.pdf
Binary file not shown.
9 changes: 6 additions & 3 deletions cgt_calc/resources/template.tex.j2
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
\BLOCK{ set overall_gain = round_decimal(entries|sum(attribute="gain"), 2) }
\BLOCK{ set disposal_count.value = disposal_count.value + 1 }
\subsection*{
Disposal \VAR{ disposal_count.value }: \VAR{ strip_zeros(overall_quantity) } units of \VAR{ symbol } for £\VAR{ "{:,}".format(overall_disposed) }%
Disposal \VAR{ disposal_count.value }: \VAR{ strip_zeros(overall_quantity) } units of \VAR{ symbol } for £\VAR{ "{:,}".format(overall_disposed) }
(£\VAR{ "{:,}".format(round_decimal(overall_disposed/overall_quantity, 2)) }/unit)%
\BLOCK{ if overall_fees > 0 }
, after £\VAR{ "{:,}".format(overall_fees) } fees
\BLOCK{ endif }
Expand All @@ -49,7 +50,8 @@
\BLOCK{ if overall_quantity > 0 }
\BLOCK{ set acquisition_count.value = acquisition_count.value + 1 }
\subsection*{
Acquisition \VAR{ acquisition_count.value }: \VAR{ strip_zeros(overall_quantity) } units of \VAR{ symbol } for £\VAR{ "{:,}".format(acquisition_cost) }%
Acquisition \VAR{ acquisition_count.value }: \VAR{ strip_zeros(overall_quantity) } units of \VAR{ symbol } for £\VAR{ "{:,}".format(acquisition_cost) }
(£\VAR{ "{:,}".format(round_decimal(acquisition_cost/overall_quantity, 2)) }/unit)%
\BLOCK{ if overall_fees > 0 }
, including £\VAR{ "{:,}".format(overall_fees) } fees
\BLOCK{ endif }
Expand Down Expand Up @@ -89,7 +91,8 @@
\BLOCK{ endif }
\VAR{ strip_zeros(entry.new_quantity) }%
\BLOCK{ if entry.new_quantity > 0 },
new pool cost: £\VAR{ "{:,}".format(round_decimal(entry.new_pool_cost, 2)) }%
new pool cost: £\VAR{ "{:,}".format(round_decimal(entry.new_pool_cost, 2)) }
(£\VAR{ "{:,}".format(round_decimal(entry.new_pool_cost/entry.new_quantity, 2)) }/unit)%
\BLOCK{ endif }.

\BLOCK{ endfor}
Expand Down

0 comments on commit 204e159

Please sign in to comment.