maaslalani / invoice

Command line invoice generator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to?

se7en-x230 opened this issue · comments

  1. How would I include a address with several lines?

  2. How could I add a currency? DONE
    I see the file and would add the currency + symbol but how would I compile it with the additional currency?
    Recompiled it with my currency added and set as default. All good.

  3. Also --date "June 10, 2023" does not print the date on the invoice.
    Would it be possible to add the current date without typing it on the invoice?
    Something like --date current or similar even better set it in env?

Some changes you made make it impossible to compile.

shop-2023-06-27-11-30

go version go1.20.5 linux/amd64
arch linux

image

Hey @se7en-x230, I'm not able to reproduce. Can you try the following:

go clean -modcache -cache
go install .

Thanks
go clean -modcache -cache
Did work

I use dmenu to collect the infos like --to --date --item ...
Fast, easy and the result looks good.

shop-2023-06-27-19-52

Thanks

Thanks, I will eventually add support for multiline From and To fields it will likely look something along the lines of:

invoice generate --from "Name<br>Address<br>Zip Code<br>City, State"

or

invoice generate --from "Name\nAddress\nZip Code\nCity, State"

You might also like gum for collecting the infos:

https://github.com/charmbracelet/gum

I am trying to add common options to json. How do I add multiple items with different quantity/prices to the json?

@se7en-x230 you can do something like this in pdf.go

func writeNotes(pdf *gopdf.GoPdf, notes string) {
	pdf.SetY(650)

	_ = pdf.SetFont("Inter", "", 10)
	pdf.SetTextColor(55, 55, 55)
	_ = pdf.Cell(nil, "Notes")
	pdf.Br(18)
	_ = pdf.SetFont("Inter", "", 8)
	pdf.SetTextColor(0, 0, 0)

	notesArr := strings.Split(notes, "\\n")

	for i := 0; i < len(notesArr); i++ {
		_ = pdf.Cell(nil, notesArr[i])
		pdf.Br(15)
	}
	pdf.Br(48)
}

SOLVED!

shop-2023-06-29-08-30

./pdf.go:103:14: undefined: strings

shop-2023-06-29-08-07

works fine

--from --to and --notes should have the possibility for multiple lines

I am trying to add common options to json. How do I add multiple items with different quantity/prices to the json?

@akyag You can do something like the following:

{
	"items": ["Item 1", "Item 2", "Item 3"],
	"rates": [1, 2, 3],
	"quantities": [1, 2, 3]
}
invoice generate --import <file>.json

can the notes section be multiline?
I'm trying to add wire info toit, and it gets all on a single line instead of multi-line.

I tried adding both <br/> and \\n and \n but nothing seems to do the job

@piotryordanov I just made a PR to fix it, it's an issue with an extra escape character

@dvrd awesome!
Please let me know when this gets merged