@@ -95,7 +95,7 @@ var generateCmd = &cobra.Command{
}
writeLogo(&pdf, logo, from)
- writeTitle(&pdf, title, id)
+ writeTitle(&pdf, title, id, date)
writeBillTo(&pdf, to)
writeHeaderRow(&pdf)
subtotal := 0.0
@@ -117,6 +117,9 @@ var generateCmd = &cobra.Command{
writeNotes(&pdf, note)
}
writeTotals(&pdf, subtotal, subtotal*tax, subtotal*discount)
+ if due != "" {
+ writeDueDate(&pdf, due)
+ }
writeFooter(&pdf, id)
output = strings.TrimSuffix(output, ".pdf") + ".pdf"
err = pdf.WritePdf(output)
@@ -127,7 +130,6 @@ var generateCmd = &cobra.Command{
fmt.Printf("Generated %s\n", output)
return nil
-
},
}
@@ -39,7 +39,7 @@ func writeLogo(pdf *gopdf.GoPdf, logo string, from string) {
pdf.Br(36)
}
-func writeTitle(pdf *gopdf.GoPdf, title, id string) {
+func writeTitle(pdf *gopdf.GoPdf, title, id, date string) {
_ = pdf.SetFont("Inter-Bold", "", 24)
pdf.SetTextColor(0, 0, 0)
_ = pdf.Cell(nil, title)
@@ -47,16 +47,31 @@ func writeTitle(pdf *gopdf.GoPdf, title, id string) {
_ = pdf.SetFont("Inter", "", 12)
pdf.SetTextColor(100, 100, 100)
_ = pdf.Cell(nil, "#")
- pdf.SetTextColor(100, 100, 100)
_ = pdf.Cell(nil, id)
- pdf.Br(48)
+ pdf.SetTextColor(150, 150, 150)
+ _ = pdf.Cell(nil, " ยท ")
+ pdf.SetTextColor(100, 100, 100)
+ _ = pdf.Cell(nil, date)
+ pdf.Br(36)
+}
+
+func writeDueDate(pdf *gopdf.GoPdf, due string) {
+ _ = pdf.SetFont("Inter", "", 9)
+ pdf.SetTextColor(75, 75, 75)
+ pdf.SetX(rateColumnOffset)
+ _ = pdf.Cell(nil, "Due Date")
+ pdf.SetTextColor(0, 0, 0)
+ _ = pdf.SetFontSize(11)
+ pdf.SetX(amountColumnOffset - 15)
+ _ = pdf.Cell(nil, due)
+ pdf.Br(12)
}
func writeBillTo(pdf *gopdf.GoPdf, to string) {
pdf.SetTextColor(75, 75, 75)
_ = pdf.SetFont("Inter", "", 9)
_ = pdf.Cell(nil, "BILL TO")
- pdf.Br(14)
+ pdf.Br(18)
pdf.SetTextColor(75, 75, 75)
_ = pdf.SetFont("Inter", "", 15)
_ = pdf.Cell(nil, to)