Преглед изворни кода

Comma format dollar amounts in PDF

master
Immanuel Onyeka пре 1 година
родитељ
комит
87fba7a7f0
3 измењених фајлова са 5 додато и 1 уклоњено
  1. +1
    -0
      go.mod
  2. +2
    -0
      go.sum
  3. +2
    -1
      skouter.go

+ 1
- 0
go.mod Прегледај датотеку

@@ -6,6 +6,7 @@ require (
github.com/SebastiaanKlippert/go-wkhtmltopdf v1.9.0
github.com/brianvoe/gofakeit/v6 v6.23.2
github.com/disintegration/gift v1.2.1
github.com/dustin/go-humanize v1.0.1
github.com/go-sql-driver/mysql v1.6.0
github.com/golang-jwt/jwt/v4 v4.5.0
)

+ 2
- 0
go.sum Прегледај датотеку

@@ -4,6 +4,8 @@ github.com/brianvoe/gofakeit/v6 v6.23.2 h1:lVde18uhad5wII/f5RMVFLtdQNE0HaGFuBUXm
github.com/brianvoe/gofakeit/v6 v6.23.2/go.mod h1:Ow6qC71xtwm79anlwKRlWZW6zVq9D2XHE4QSSMP/rU8=
github.com/disintegration/gift v1.2.1 h1:Y005a1X4Z7Uc+0gLpSAsKhWi4qLtsdEcMIbbdvdZ6pc=
github.com/disintegration/gift v1.2.1/go.mod h1:Jh2i7f7Q2BM7Ezno3PhfezbR1xpUg9dUg3/RlKGr4HI=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=


+ 2
- 1
skouter.go Прегледај датотеку

@@ -25,6 +25,7 @@ import (
"github.com/golang-jwt/jwt/v4"
"github.com/disintegration/gift"
"github.com/brianvoe/gofakeit/v6"
"github.com/dustin/go-humanize"
"image"
"image/png"
_ "image/jpeg"
@@ -264,7 +265,7 @@ func cache(name string, title string) Page {
func cachePdf(name string) Page {
// Money is stored in cents, so it must be converted to dollars in reports
dollars := func(cents int) string {
return strconv.FormatFloat(float64(cents)/100, 'f', 2, 32)
return humanize.Commaf(float64(cents)/100)
}
// For calculating down payments


Loading…
Откажи
Сачувај