Skip to content

Commit

Permalink
v1.1 - added support for currencies
Browse files Browse the repository at this point in the history
  • Loading branch information
DexterLagan authored Jul 16, 2022
1 parent f4448a8 commit da133b5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions invoicer.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@

;;; version history

; v1.0 - this version. Racket 8.0.10
; v1.1 - this version. Added currency support. Racket 8.5.
; v1.0 - initial version. Racket 8.0.10

;;; consts

Expand All @@ -58,6 +59,7 @@
(define *invoice-number-file* "invoice-number.txt")
(define *invoice-lines-file* "invoice-lines.txt")
(define *locale-file* "locale.txt")
(define *currency-file* "currency.txt")
(define *payee-file* "payee.txt")
(define *payor-file* "payor.txt")
(define *pay-interval-file* "pay-interval.txt")
Expand Down Expand Up @@ -347,6 +349,7 @@
(define invoice-number (file->number? *invoice-number-file*))
(define pay-interval (file->number? *pay-interval-file*))
(define locale (file->string? *locale-file*))
(define currency (file->string? *currency-file*))
(define invoice-lines (file->lines*? *invoice-lines-file*))

; handle tax name and rate
Expand Down Expand Up @@ -424,8 +427,8 @@
payment-method-block
invoice-lines
tax-name
(string-append "$" (~r tax-amount #:precision '(= 2)))
(string-append "$" (~r total-amount #:precision '(= 2)))))
(string-append currency (~r tax-amount #:precision '(= 2)))
(string-append currency (~r total-amount #:precision '(= 2)))))

; generate invoice filename
(define invoice-filename
Expand Down

0 comments on commit da133b5

Please sign in to comment.