corp

package
v0.0.0-...-56ad08b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Contains constants for the package.

Package corp is used to create the company's invoice in PDF format.

Contains the invoice struct and methods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DrawGrid

func DrawGrid(pdf *gofpdf.Fpdf)

DrawGrid draws a grid in the PDF for better navigation.

func FloatToDollar

func FloatToDollar(f float64) string

FloatToDollar converts a float to a string with only 2 floating points.

func FloatToText

func FloatToText(f float64) string

FloatToText converts a float to string and drops any floating points.

Types

type Company

type Company struct {

Company represents a company. Every company has a logo path, contact info, and address.

func (Company) InvoiceHeader

func (c Company) InvoiceHeader(pdf *gofpdf.Fpdf, invoice Invoice) error

InvoiceHeader renders the top part of the invoice with client name, client address, invoice number, date of issue, and the huge invoice total.

func (Company) ItemList

func (c Company) ItemList(pdf *gofpdf.Fpdf, invoice Invoice) error

ItemList renders the item list in the invoice.

func (Company) SetFooter

func (c Company) SetFooter(pdf *gofpdf.Fpdf)

SetFooter sets the simple footer.

func (Company) SetHeader

func (c Company) SetHeader(pdf *gofpdf.Fpdf) error

SetHeader, creates the header for the invoice.

type Invoice

type Invoice struct {
	ClientName, ClientAddress, InvoiceNumber, Date string
	Items                                          []Item
	Total                                          float64
}

Invoice contains the information for one invoice.

func (*Invoice) AddItem

func (i *Invoice) AddItem(item Item) error

AddItem, adds an item to the invoice and recalculates the total.

func (*Invoice) CalcTotal

func (i *Invoice) CalcTotal()

CalcTotal updates the invoice total.

type Item

type Item struct {
	Description  string
	PricePerUnit float64
	Quantity     float64
}

Item represents one item in the invoice.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL