reporting

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 10 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package reporting prepares calendar parts and monthly reports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CalendarPart

type CalendarPart struct {
	Start  time.Time
	End    time.Time
	Source timesheet.ProcessedEntry
}

CalendarPart is the portion of a processed entry within one local day. Source retains the full original interval and all its occurrences.

func PartsForPeriod

func PartsForPeriod(entries []timesheet.ProcessedEntry, period ReportingPeriod) []CalendarPart

PartsForPeriod selects and splits validated, non-overlapping entries from duplicate handling. Parts follow input order, and their bounds use the reporting location.

func (CalendarPart) Duration

func (p CalendarPart) Duration() time.Duration

Duration returns the exact elapsed time in the part.

type DetailedReport

type DetailedReport struct {
	Period        ReportingPeriod
	MemberName    string
	TotalDuration time.Duration
	Rows          []DetailedRow
}

DetailedReport contains the data for a detailed monthly report.

func NewDetailedReport

func NewDetailedReport(period ReportingPeriod, memberName string, parts []CalendarPart) DetailedReport

NewDetailedReport builds chronological rows from the selected calendar parts. It uses the member name resolved by configuration validation.

type DetailedRow

type DetailedRow struct {
	Start       time.Time
	End         time.Time
	Ticket      string
	Description string

	// Original holds the full source interval when the part covers less of it.
	Original *DetailedSourceInterval
}

DetailedRow describes one calendar part in the reporting location.

func (DetailedRow) Duration

func (r DetailedRow) Duration() time.Duration

Duration returns the exact elapsed time in the row.

type DetailedSourceInterval

type DetailedSourceInterval struct {
	Start time.Time
	End   time.Time
}

DetailedSourceInterval identifies the full interval of the source entry.

type Invoice

type Invoice struct {
	Period              ReportingPeriod
	Number              string
	Date                string
	DueDate             string
	Supplier            v1alpha1.InvoiceParty
	Customer            v1alpha1.InvoiceParty
	PaymentInstructions string
	ServiceDescription  string
	HourlyRate          string
	Currency            string
	MonetaryPrecision   int32
	Tax                 v1alpha1.InvoiceTax
	TotalDuration       time.Duration
	Line                *InvoiceLine
	AdditionalLines     []InvoiceAdditionalLine
	Subtotal            string
	TaxAmount           string
	Total               string
}

Invoice contains the details and calculated totals for a monthly invoice. Subtotal, TaxAmount and Total are decimal strings with MonetaryPrecision digits after the decimal point.

func NewInvoice

func NewInvoice(period ReportingPeriod, context InvoiceContext, parts []CalendarPart) (Invoice, error)

NewInvoice calculates an invoice from the selected calendar parts and final invoice settings. It validates the settings even when the selection is empty.

type InvoiceAdditionalLine

type InvoiceAdditionalLine struct {
	v1alpha1.InvoiceAdditionalLine
	Amount string
}

InvoiceAdditionalLine is an independently priced invoice charge.

type InvoiceContext

type InvoiceContext struct {
	Number  string
	Date    string
	DueDate string
	Config  v1alpha1.InvoiceSettings
}

InvoiceContext contains the settings resolved for a single invoice. Date and optional DueDate are calendar dates in YYYY-MM-DD format.

type InvoiceLine

type InvoiceLine struct {
	Description string
	Qty         time.Duration
	UnitPrice   string
	Amount      string
}

InvoiceLine summarizes all selected work as a single service.

type ReportingPeriod

type ReportingPeriod struct {
	// contains filtered or unexported fields
}

ReportingPeriod covers a calendar month in the reporting location. Its start is inclusive and its end is exclusive.

func NewReportingPeriod

func NewReportingPeriod(year int, month time.Month, location *time.Location) (ReportingPeriod, error)

NewReportingPeriod creates the period for the given year and month. A nil location uses time.Local.

func (ReportingPeriod) End

func (p ReportingPeriod) End() time.Time

End returns the exclusive boundary of the period in the reporting location.

func (ReportingPeriod) Start

func (p ReportingPeriod) Start() time.Time

Start returns the inclusive boundary of the period in the reporting location.

type SummaryReport

type SummaryReport struct {
	Period        ReportingPeriod
	MemberName    string
	TotalDuration time.Duration
	Weeks         []SummaryWeek
}

SummaryReport contains the weekly totals for a reporting month.

func NewSummaryReport

func NewSummaryReport(period ReportingPeriod, memberName string, parts []CalendarPart) SummaryReport

NewSummaryReport groups the selected calendar parts by week. It includes weeks without work and uses the member name resolved by configuration validation.

type SummaryWeek

type SummaryWeek struct {
	Monday        time.Time
	FirstDate     time.Time
	LastDate      time.Time // Inclusive.
	TotalDuration time.Duration
}

SummaryWeek contains the total for one calendar week intersecting the month. Monday, FirstDate and LastDate are local calendar dates stored at midnight UTC.

Directories

Path Synopsis
Package render writes prepared reporting documents.
Package render writes prepared reporting documents.
internal/format
Package format shares display conventions between reporting renderers.
Package format shares display conventions between reporting renderers.
pdf
Package pdf renders reporting documents with Typst.
Package pdf renders reporting documents with Typst.

Jump to

Keyboard shortcuts

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