costcenter

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package costcenter provides cost center hierarchy management

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CostCenter

type CostCenter struct {
	ID          string
	Name        string
	Description string
	ParentID    string
	Children    []string
	Budget      float64
	ActualSpend float64
	Owner       string
	Tags        map[string]string
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

CostCenter represents a cost center in the hierarchy

type CostCenterHierarchy

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

CostCenterHierarchy manages the cost center hierarchy

func NewCostCenterHierarchy

func NewCostCenterHierarchy() *CostCenterHierarchy

NewCostCenterHierarchy creates a new hierarchy

func (*CostCenterHierarchy) AddCenter

func (h *CostCenterHierarchy) AddCenter(center *CostCenter) error

AddCenter adds a cost center

func (*CostCenterHierarchy) GetBudgetUtilization

func (h *CostCenterHierarchy) GetBudgetUtilization(id string) (float64, error)

GetBudgetUtilization returns budget utilization for a cost center

func (*CostCenterHierarchy) GetCenter

func (h *CostCenterHierarchy) GetCenter(id string) (*CostCenter, error)

GetCenter returns a cost center by ID

func (*CostCenterHierarchy) GetChildren

func (h *CostCenterHierarchy) GetChildren(id string) []*CostCenter

GetChildren returns all children of a cost center

func (*CostCenterHierarchy) GetHierarchyReport

func (h *CostCenterHierarchy) GetHierarchyReport() []HierarchyReport

GetHierarchyReport returns a report of the entire hierarchy

func (*CostCenterHierarchy) GetRootCenters

func (h *CostCenterHierarchy) GetRootCenters() []*CostCenter

GetRootCenters returns all root cost centers

func (*CostCenterHierarchy) UpdateSpend

func (h *CostCenterHierarchy) UpdateSpend(id string, amount float64) error

UpdateSpend updates the actual spend for a cost center

type HierarchyReport

type HierarchyReport struct {
	ID            string  `json:"id"`
	Name          string  `json:"name"`
	ParentID      string  `json:"parent_id"`
	Budget        float64 `json:"budget"`
	ActualSpend   float64 `json:"actual_spend"`
	Utilization   float64 `json:"utilization"`
	ChildrenCount int     `json:"children_count"`
	Owner         string  `json:"owner"`
}

HierarchyReport represents a cost center report

Jump to

Keyboard shortcuts

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