cba

package
v0.0.0-...-1eac879 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CURRENCY_EURO          = "euro"
	CURRENCY_DOLLAR        = "dollar"
	CURRENCY_EURO_SYMBOL   = "€"
	CURRENCY_DOLLAR_SYMBOL = "$"
)
View Source
const (
	COST_TYPE_LABOR      = "labor"
	COST_TYPE_INVESTMENT = "investment"
	COST_TYPE_CONSULTING = "consulting"
	COST_TYPE_OTHERS     = "others"

	COST_METRIC_YEARLY = "yearly"
	COST_METRIC_DAILY  = "daily"
	COST_METRIC_ONCE   = "once"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Allocation

type Allocation struct {
	ID         string  `json:"id" yaml:"id"`
	Cost       string  `json:"cost" yaml:"cost"`
	Occurrence float64 `json:"occurrence" yaml:"occurrence"` // float64 because for labor cost you may have 1.3 FTE for example
	Phase      int     `json:"phase" yaml:"phase"`
	Discount   string  `json:"discount" yaml:"discount"`
}

type CBA

type CBA struct {
	Phases        []*Phase      `json:"phases" yaml:"phases"`
	Discounts     []*Discount   `json:"discounts" yaml:"discounts"`
	Costs         []*Cost       `json:"costs" yaml:"costs"`
	Allocations   []*Allocation `json:"allocations" yaml:"allocations"`
	Currency      string        `json:"currency" yaml:"currency"`
	ValueAddedTax float64       `json:"vat" yaml:"vat"`
	VAT           bool          `json:"vat_enable" yaml:"vat_enable"`
}

func NewCBA

func NewCBA() *CBA

func (*CBA) CalcReport

func (cba *CBA) CalcReport() Report

func (*CBA) DeleteAllocationByID

func (cba *CBA) DeleteAllocationByID(id string)

func (*CBA) DeleteCostByName

func (cba *CBA) DeleteCostByName(name string)

func (*CBA) DeletePhaseByIndex

func (cba *CBA) DeletePhaseByIndex(i int)

func (*CBA) FindAllocationByID

func (cba *CBA) FindAllocationByID(id string) *Allocation

func (*CBA) FindCostByName

func (cba *CBA) FindCostByName(name string) *Cost

func (*CBA) FindPhaseByIndex

func (cba *CBA) FindPhaseByIndex(i int) *Phase

func (*CBA) FindPhaseByName

func (cba *CBA) FindPhaseByName(name string) *Phase

func (*CBA) ListCosts

func (cba *CBA) ListCosts() []string

func (*CBA) ListPhases

func (cba *CBA) ListPhases() []string

func (*CBA) Load

func (cba *CBA) Load(data []byte)

func (*CBA) LoadCostsFromCatalog

func (cba *CBA) LoadCostsFromCatalog(data []byte) error

func (*CBA) LoadCostsFromCatalogFile

func (cba *CBA) LoadCostsFromCatalogFile(path string) error

func (*CBA) LoadFile

func (cba *CBA) LoadFile(path string) error

func (*CBA) NewAllocation

func (cba *CBA) NewAllocation() *Allocation

func (*CBA) NewCost

func (cba *CBA) NewCost() *Cost

func (*CBA) NewPhase

func (cba *CBA) NewPhase() *Phase

func (*CBA) RenderingReport

func (cba *CBA) RenderingReport(report Report, templateFile string, reportFile string) error

type CatalogOfCosts

type CatalogOfCosts struct {
	Catalog []*Cost `json:"costs" yaml:"costs"`
}

type Cost

type Cost struct {
	Name     string  `json:"name" yaml:"name"`
	Metric   string  `json:"metric" yaml:"metric"`
	Type     string  `json:"type" yaml:"type"`
	Amount   float64 `json:"amount" yaml:"amount"`
	Currency string  `json:"currency" yaml:"currency"`
	External bool    `json:"external" yaml:"external"`
	ReadOnly bool    `json:"readonly" yaml:"readonly"`
}

type Discount

type Discount struct {
	Name       string  `json:"name" yaml:"name"`
	Percentage float64 `json:"percentage" yaml:"percentage"`
	Absolute   float64 `json:"absolute" yaml:"absolute"`
}

type Phase

type Phase struct {
	Name  string `json:"name" yaml:"name"`
	Index int    `json:"index" yaml:"index"`
	Days  int    `json:"days" yaml:"days"`
}

type Report

type Report struct {
	External SubReport
	Internal SubReport
	Total    float64
}

type SubReport

type SubReport struct {
	Labor         map[int]float64
	Investment    map[int]float64
	Consulting    map[int]float64
	Others        map[int]float64
	TotLabor      float64
	TotInvestment float64
	TotConsulting float64
	TotOthers     float64
	Total         float64
}

Jump to

Keyboard shortcuts

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