Documentation ¶
Index ¶
- Constants
- Variables
- func CreateSearchIndex() error
- func GetConfigFilePath() string
- func GetConfigHome() string
- func GetI18nHome() string
- func GetI18nTranslationPath(lang string) string
- func GetSearchIndexFilePath() (string, bool)
- func ReadUserInput(message string) string
- func ReadUserPassword(message string) (string, error)
- func RebuildSearchIndex(c *Config, password *string) (int, time.Duration, error)
- func RenderInvoice(c *Config, password string) (string, error)
- func RenderPDF(invoice *Invoice, layout *Layout, pdfPath *string, T i18n.TranslateFunc)
- func RestoreInvoice(c *Config, invoiceNumber, password string) error
- func Setup(workspace string) (string, string, error)
- type BankCoordinates
- type Block
- type Config
- type Coords
- type Daily
- type DailyProject
- type I18NOther
- type Invoice
- type InvoiceData
- type InvoiceEntry
- type InvoiceQuery
- type InvoiceSettings
- type Item
- type Layout
- type Margins
- type Recipient
- type RowStyle
- type Style
- type Translation
Constants ¶
const ( EXT_PDF = "pdf" EXT_JSON = "json" EXT_TOML = "toml" EXT_JSONE = "json.cfb" EXT_CFB = ".cfb" )
const ( BOX_FULL_WIDTH float64 = 0 DEFAULT_LINE_BREAK float64 = -1 TEXT_ALIGN_LEFT = "L" NO_FILL = false FILL = true NO_BORDER = "0" BORDER_BOTTOM = "1B" BORDER_TOP_BOTTOM = "TB" FONT_STYLE_BOLD = "B" FONT_STYLE_NORMAL = "" TEXT_ALIGN_RIGHT_MID = "RM" TEXT_ALIGN_RIGHT_TOP = "RT" TEXT_ALIGN_RIGHT_BTM = "RB" TEXT_ALIGN_LEFT_MID = "LM" BLACK_R, BLACK_G, BLACK_B = 0, 0, 0 WHITE_R, WHITE_G, WHITE_B = 255, 255, 255 )
const ( FIELD_NUMBER = "Number" FIELD_CUSTOMER = "Customer" FIELD_AMOUNT = "Amount" FIELD_DATE = "Date" QUERY_DATE_FORMAT = "2006-01-02" QUERY_DEFAULT_DATE_FROM = "1970-01-01" QUERY_DEFAULT_AMOUNT_GE = float64(0) QUERY_DEFAULT_AMOUNT_LE = float64(1000000000000) QUERY_DEFAULT_CUSTOMER = "none" )
Variables ¶
var InvoiceDescriptorExists = errors.New("Invoice descriptor already exists")
Errors
Functions ¶
func CreateSearchIndex ¶
func CreateSearchIndex() error
CreateSearchIndex create a new empty search index in the GetSearchIndexFilePath folder
func GetConfigFilePath ¶
func GetConfigFilePath() string
func GetConfigHome ¶
func GetConfigHome() string
func GetI18nHome ¶
func GetI18nHome() string
func GetI18nTranslationPath ¶
func GetSearchIndexFilePath ¶
func ReadUserInput ¶
func ReadUserPassword ¶
func RebuildSearchIndex ¶
RebuildSearchIndex rebuild search index
func RenderInvoice ¶
RenderInvoice render the master descriptor to a pdf file and create the encrypted descriptor of the invoice. The pdf and the descriptor are stored in the workspace folder in the format $INVOICE_NUMBER.pdf / $INVOICE_NUMBER.json.cfb
func RenderPDF ¶
func RenderPDF(invoice *Invoice, layout *Layout, pdfPath *string, T i18n.TranslateFunc)
func RestoreInvoice ¶
RestoreInvoice restore the encrypted invoice descriptor into the master descriptor for editing. Overwrites the master descriptor without asking for confirmation.
Types ¶
type BankCoordinates ¶
type Config ¶
type Config struct { Workspace string `toml:"workspace"` SearchResultLimit int `toml:"searchResultLimit"` MasterDescriptor string `toml:"masterDescriptor"` DateInputFormat string `toml:"dateInputFormat"` Layout Layout `toml:"layout"` }
============== CONFIGURATION FILE =================
func (*Config) GetInvoiceJsonPath ¶
GetInvoiceJsonPath get the path of the encrypted version of an invoice in the workspace. returns the path of the invoice, and a boolean if the invoice already exists (true) or not (false)
func (*Config) GetMasterPath ¶
type Daily ¶
type Daily struct { Enabled bool `json:"enabled"` DateFrom string `json:"date_from,omitempty"` DateTo string `json:"date_to",omitempty` Projects []DailyProject `json:"projects",omitempty` }
type DailyProject ¶
type Invoice ¶
type Invoice struct { From Recipient `json:"from"` To Recipient `json:"to"` PaymentDetails BankCoordinates `json:"payment_details"` Invoice InvoiceData `json:"invoice"` Settings InvoiceSettings `json:"settings"` Dailytime Daily `json:"dailytime"` Items *[]Item `json:"items"` Notes []string `json:"notes"` }
Invoice contains all the information to generate an invoice
func ReadMasterDescriptor ¶
func (*Invoice) DisableExtensions ¶
func (i *Invoice) DisableExtensions()
DisableExtensions disable the extensions of the invoices TODO extenesions should be treathed as a list
type InvoiceData ¶
type InvoiceEntry ¶
InvoiceQuery is the object indexed by bleve
func SearchInvoice ¶
func SearchInvoice(q InvoiceQuery) ([]InvoiceEntry, uint64, time.Duration, error)
SearchInvoice search for an invoice using InvoiceQuery object returns the entries found (first 50), the total number of hits, the duration of the query and error
type InvoiceQuery ¶
type InvoiceQuery struct { Customer string AmountGE float64 AmountLE float64 DateFrom time.Time DateTo time.Time }
InvoiceQuery is the query object to search for invoices
func DefaultInvoiceQuery ¶
func DefaultInvoiceQuery() InvoiceQuery
DefaultInvoiceQuery return the default invoice query object
func (*InvoiceQuery) String ¶
func (q *InvoiceQuery) String() string
type InvoiceSettings ¶
type Item ¶
type Item struct { Description string `json:"description"` Quantity float64 `json:"quantity"` Price float64 `json:"price,omitempty"` QuantitySymbol string `json:"quantity_symbol,omitempty"` }
func (*Item) FormatQuantity ¶
FormatQuantity with a qunatity symbol if present
type Style ¶
type Style struct { Margins Margins `toml:"margins"` FontFamily string `toml:"fontFamily"` FontSizeNormal float64 `toml:"fontSizeNormal"` FontSizeH1 float64 `toml:"fontSizeH1"` FontSizeH2 float64 `toml:"fontSizeH2"` FontSizeSmall float64 `toml:"fontsizeSmall"` LineHeightNormal float64 `toml:"lineHeightNormal"` LineHeightH1 float64 `toml:"lineHeightH1"` LineHeightH2 float64 `toml:"lineHeightH2"` LineHeightSmall float64 `toml:"lineHeightSmall"` TableCol1W float64 `toml:"tableCol1w"` TableCol2W float64 `toml:"tableCol2w"` TableCol3W float64 `toml:"tableCol3w"` TableCol4W float64 `toml:"tableCol4w"` TableHeadHeight float64 `toml:"tableHeadHeight"` TableRowHeight float64 `toml:"tableRowHeight"` }
type Translation ¶
type Translation struct { From I18NOther `toml:"from"` Sender I18NOther `toml:"sender"` To I18NOther `toml:"to"` Recipient I18NOther `toml:"recipient"` Invoice I18NOther `toml:"invoice"` InvoiceData I18NOther `toml:"invoice_data"` PaymentDetails I18NOther `toml:"payment_details"` PaymentDetailsData I18NOther `toml:"payment_details_data"` Notes I18NOther `toml:"notes"` Desc I18NOther `toml:"desc"` Quantity I18NOther `toml:"quantity"` Rate I18NOther `toml:"rate"` Cost I18NOther `toml:"cost"` Subtotal I18NOther `toml:"subtotal"` Total I18NOther `toml:"total"` Tax I18NOther `toml:"tax"` }