pdfbuilder

package
v0.0.0-...-53e80a7 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PaymentMethodOther          = 1
	PaymentMethodCash           = 2
	PaymentMethodCheque         = 3
	PaymentMethodETransfer      = 4
	PaymentMethodDebit          = 5
	PaymentMethodCredit         = 6
	PaymentMethodPurchaseOrder  = 7
	PaymentMethodCryptocurrency = 8
)

Variables

View Source
var PaymentMethodLabels = map[int8]string{
	PaymentMethodOther:          "Other",
	PaymentMethodCash:           "Cash",
	PaymentMethodCheque:         "Cheque",
	PaymentMethodETransfer:      "E-Transfer",
	PaymentMethodDebit:          "Debit",
	PaymentMethodCredit:         "Credit",
	PaymentMethodPurchaseOrder:  "Purchase Order",
	PaymentMethodCryptocurrency: "Cryptocurrency",
}

Functions

func DownloadFile

func DownloadFile(filepath string, url string) error

DownloadFile will download a url to a local file. It's efficient because it will write as it downloads and not load the whole file into memory.

Types

type AssociateInvoiceBuilder

type AssociateInvoiceBuilder interface {
	GeneratePDF(dto *AssociateInvoiceBuilderRequestDTO) (*PDFBuilderResponseDTO, error)
}

func NewAssociateInvoiceBuilder

func NewAssociateInvoiceBuilder(cfg *c.Conf, logger *slog.Logger) AssociateInvoiceBuilder

type AssociateInvoiceBuilderRequestDTO

type AssociateInvoiceBuilderRequestDTO struct {
	// Country controls what currency formatting we will apply to the invoice.
	// If nothing is set then we will automatically assume `Canada` and apply
	// the formatting for this country.
	Country string `bson:"country" json:"country"`

	ID                       primitive.ObjectID `json:"id"`
	TenantID                 primitive.ObjectID `json:"tenant_id"`
	OrderID                  primitive.ObjectID `json:"order_id"`
	OrderWJID                uint64             `json:"order_wjid"`
	InvoiceID                string             `json:"invoice_id"`
	InvoiceDate              time.Time          `json:"invoice_date"`
	AssociateName            string             `json:"associate_name"`
	AssociatePhone           string             `json:"associate_phone"`
	ClientName               string             `json:"client_name"`
	ClientPhone              string             `json:"client_phone"`
	ClientEmail              string             `json:"client_email"`
	Line01Qty                int64              `json:"line_01_qty"`
	Line01Desc               string             `json:"line_01_desc"`
	Line01Price              float64            `json:"line_01_price"`
	Line01Amount             float64            `json:"line_01_amount"`
	Line02Qty                int64              `json:"line_02_qty"`
	Line02Desc               string             `json:"line_02_desc"`
	Line02Price              float64            `json:"line_02_price"`
	Line02Amount             float64            `json:"line_02_amount"`
	Line03Qty                int64              `json:"line_03_qty"`
	Line03Desc               string             `json:"line_03_desc"`
	Line03Price              float64            `json:"line_03_price"`
	Line03Amount             float64            `json:"line_03_amount"`
	Line04Qty                int64              `json:"line_04_qty"`
	Line04Desc               string             `json:"line_04_desc"`
	Line04Price              float64            `json:"line_04_price"`
	Line04Amount             float64            `json:"line_04_amount"`
	Line05Qty                int64              `json:"line_05_qty"`
	Line05Desc               string             `json:"line_05_desc"`
	Line05Price              float64            `json:"line_05_price"`
	Line05Amount             float64            `json:"line_05_amount"`
	Line06Qty                int64              `json:"line_06_qty"`
	Line06Desc               string             `json:"line_06_desc"`
	Line06Price              float64            `json:"line_06_price"`
	Line06Amount             float64            `json:"line_06_amount"`
	Line07Qty                int64              `json:"line_07_qty"`
	Line07Desc               string             `json:"line_07_desc"`
	Line07Price              float64            `json:"line_07_price"`
	Line07Amount             float64            `json:"line_07_amount"`
	Line08Qty                int64              `json:"line_08_qty"`
	Line08Desc               string             `json:"line_08_desc"`
	Line08Price              float64            `json:"line_08_price"`
	Line08Amount             float64            `json:"line_08_amount"`
	Line09Qty                int64              `json:"line_09_qty"`
	Line09Desc               string             `json:"line_09_desc"`
	Line09Price              float64            `json:"line_09_price"`
	Line09Amount             float64            `json:"line_09_amount"`
	Line10Qty                int64              `json:"line_10_qty"`
	Line10Desc               string             `json:"line_10_desc"`
	Line10Price              float64            `json:"line_10_price"`
	Line10Amount             float64            `json:"line_10_amount"`
	Line11Qty                int64              `json:"line_11_qty"`
	Line11Desc               string             `json:"line_11_desc"`
	Line11Price              float64            `json:"line_11_price"`
	Line11Amount             float64            `json:"line_11_amount"`
	Line12Qty                int64              `json:"line_12_qty"`
	Line12Desc               string             `json:"line_12_desc"`
	Line12Price              float64            `json:"line_12_price"`
	Line12Amount             float64            `json:"line_12_amount"`
	Line13Qty                int64              `json:"line_13_qty"`
	Line13Desc               string             `json:"line_13_desc"`
	Line13Price              float64            `json:"line_13_price"`
	Line13Amount             float64            `json:"line_13_amount"`
	Line14Qty                int64              `json:"line_14_qty"`
	Line14Desc               string             `json:"line_14_desc"`
	Line14Price              float64            `json:"line_14_price"`
	Line14Amount             float64            `json:"line_14_amount"`
	Line15Qty                int64              `json:"line_15_qty"`
	Line15Desc               string             `json:"line_15_desc"`
	Line15Price              float64            `json:"line_15_price"`
	Line15Amount             float64            `json:"line_15_amount"`
	InvoiceQuoteDays         int8               `json:"invoice_quote_days"`
	InvoiceAssociateTax      string             `json:"invoice_associate_tax"`
	InvoiceQuoteDate         time.Time          `json:"invoice_quote_date"`
	InvoiceCustomersApproval string             `json:"invoice_customers_approval"`
	Line01Notes              string             `json:"line_01_notes"`
	Line02Notes              string             `json:"line_02_notes"`
	TotalLabour              float64            `json:"total_labour"`
	TotalMaterials           float64            `json:"total_materials"`
	OtherCosts               float64            `json:"other_costs"`
	SubTotal                 float64            `json:"sub_total"`
	Tax                      float64            `json:"tax"`
	IsCustomTax              bool               `bson:"is_custom_tax" json:"is_custom_tax"`
	Total                    float64            `json:"total"`
	PaymentAmount            float64            `json:"payment_amount"`
	DateClientPaidInvoice    time.Time          `json:"date_client_paid_invoice"`
	PaymentMethods           []int8             `bson:"payment_methods" json:"payment_methods,omitempty"`
	ClientSignature          string             `json:"client_signature"`
	AssociateSignDate        time.Time          `json:"associate_sign_date"`
	AssociateSignature       string             `json:"associate_signature"`
	CreatedTime              string             `json:"created_time"`
	LastModifiedTime         string             `json:"last_modified_time"`
	CreatedById              primitive.ObjectID `json:"created_by_id"`
	CreatedByName            string             `json:"created_by_name"`
	LastModifiedById         primitive.ObjectID `json:"last_modified_by_id"`
	LastModifiedByName       string             `json:"last_modified_by_name"`
	CreatedFrom              string             `json:"created_from"`
	CreatedFromIsPublic      string             `json:"created_from_is_public"`
	LastModifiedFrom         string             `json:"last_modified_from"`
	LastModifiedFromIsPublic string             `json:"last_modified_from_is_public"`
	ClientAddress            string             `json:"client_address"`
	Version                  uint64             `json:"version"`
	Deposit                  float64            `json:"deposit"`
	AmountDue                float64            `json:"amount_due"`
	Status                   string             `json:"state"` // IsArchived string `json:"is_archived"`
	// contains filtered or unexported fields
}

type PDFBuilderResponseDTO

type PDFBuilderResponseDTO struct {
	FileName string `json:"file_name"`
	FilePath string `json:"file_path"`
	Content  []byte `json:"content"`
}

Jump to

Keyboard shortcuts

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