report

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicReport

type BasicReport struct {
	Name         string
	NetIncome    currency.Euro
	TotalIncome  currency.Euro
	TotalExpense currency.Euro
	// contains filtered or unexported fields
}

BasicReport contains the information to summarize a budget

func CombineBasicReports

func CombineBasicReports(reportName string, reports []Report) (BasicReport, error)

func NewBasicBudgetReport

func NewBasicBudgetReport(reportName string, transactions []transaction.BasicTransaction) BasicReport

NewBasicBudgetReport creates a new report with a given reportName, calculating the total income, total expense, and net income

func ReadDefaultBudgetReportFromFile

func ReadDefaultBudgetReportFromFile(reportName string, path string) (BasicReport, error)

ReadDefaultBudgetReportFromFile reads in a CSV file with transactions, and parses them to create a report

func (BasicReport) CalculateTotalExpensePerDescription

func (r BasicReport) CalculateTotalExpensePerDescription() map[string]currency.Euro

CalculateTotalExpensePerDescription aggregates all expenses by category, and returns this data as a map

func (BasicReport) Save

func (r BasicReport) Save(filename string) error

Save saves the report's transactions to a CSV file The transasctions are saved in order: 1.) Incomes (sorted from largest to smallest) 2.) Expenses (sorted from most to least expensive)

func (BasicReport) SortExpenses

func (r BasicReport) SortExpenses() []transaction.BasicTransaction

SortExpenses sorts expenses in the report from largest expense to smallest expense

func (BasicReport) SortIncomes

func (r BasicReport) SortIncomes() []transaction.BasicTransaction

SortIncomes sort the incomes in the report from largest to smallest

func (BasicReport) String

func (r BasicReport) String() string

String returns a summary of the report, including Name, total income, total expense, net income, and list of transactions

func (BasicReport) Transactions

func (r BasicReport) Transactions() []transaction.BasicTransaction

Transactions returns a copy of the transactions from the report

func (BasicReport) WriteCSV

func (r BasicReport) WriteCSV(writer io.Writer) error

WriteCSV writes the report to a CSV

type MultiPayerReport

type MultiPayerReport struct {
	Name                 string
	NetIncome            currency.Euro
	TotalIncome          currency.Euro
	TotalExpense         currency.Euro
	NetIncomePerPayer    map[string]currency.Euro
	TotalIncomePerPayer  map[string]currency.Euro
	TotalExpensePerPayer map[string]currency.Euro
	// contains filtered or unexported fields
}

MultiPayerReport contains the information to summarize a shared Budget between multiple people

func CombineMultiPayerReports

func CombineMultiPayerReports(reportName string, reports []Report) (MultiPayerReport, error)

func NewMultiPayerBudgetReport

func NewMultiPayerBudgetReport(reportName string, transactions []transaction.PayerTransaction) MultiPayerReport

func ReadMultiPayerBudgetReportFromFile

func ReadMultiPayerBudgetReportFromFile(reportName string, path string) (MultiPayerReport, error)

func (MultiPayerReport) CalculateTotalExpensePerDescription

func (r MultiPayerReport) CalculateTotalExpensePerDescription() map[string]currency.Euro

CalculateTotalExpensePerDescription aggregates all expenses by category, and returns this data as a map

func (MultiPayerReport) Save

func (r MultiPayerReport) Save(filename string) error

Save saves the report's transactions to a CSV file The transasctions are saved in order: 1.) Incomes (sorted from largest to smallest) 2.) Expenses (sorted from most to least expensive)

func (MultiPayerReport) SortExpenses

func (r MultiPayerReport) SortExpenses() []transaction.PayerTransaction

SortExpenses sorts expenses in the report from largest expense to smallest expense

func (MultiPayerReport) SortIncomes

func (r MultiPayerReport) SortIncomes() []transaction.PayerTransaction

SortIncomes sort the incomes in the report from largest to smallest

func (MultiPayerReport) String

func (r MultiPayerReport) String() string

String returns a summary of the report, including the name, income/expenses per payer, and list of transactions

func (MultiPayerReport) Transactions

func (r MultiPayerReport) Transactions() []transaction.PayerTransaction

Transactions returns a copy of the transactions from the report

func (MultiPayerReport) WriteCSV

func (r MultiPayerReport) WriteCSV(writer io.Writer) error

WriteCSV writes the report to a CSV

type Report

type Report interface {
	fmt.Stringer
	Save(filename string) error
	WriteCSV(writer io.Writer) error
}

func CombineReports

func CombineReports(reportName string, reports []Report) (Report, error)

CombineReports merges a slice of reports into a single report It assumes that all reports are of the same type

func ReadBudgetReportFromFile

func ReadBudgetReportFromFile(reportName string, path string) (Report, error)

ReadBudgetReportFromFile reads in a CSV file with transactions, and parses them to create a report

Jump to

Keyboard shortcuts

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