taxreturn

package module
v0.0.0-...-747c999 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

README

tax-return

A set of helpers to calculate tax return and expenses.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DaysInPeriod

func DaysInPeriod(start, end time.Time) int

DaysInPeriod calculates amount of days between start and end date (end date excluded).

func PeriodOutside

func PeriodOutside(a, b Period) bool

PeriodOutside retuns true when period a is outside period b including period start and end dates.

func PeriodOverlapsEnd

func PeriodOverlapsEnd(a, b Period) bool

PeriodOverlapsEnd retuns true when period a ovelaps with the end of period b.

func PeriodOverlapsStart

func PeriodOverlapsStart(a, b Period) bool

PeriodOverlapsStart retuns true when period a ovelaps with the start of period b.

func PeriodWithin

func PeriodWithin(a, b Period) bool

PeriodWithin retuns true when period a is within period b including period start and end dates.

Types

type Bill

type Bill struct {
	Period BillPeriod
	Due    float32
	Paid   float32
}

Bill describes a bill for a period of time.

func (Bill) BilledDaysIn

func (b Bill) BilledDaysIn(p Period) int

BilledDaysIn caclulates how many billed days were in provided period.

func (Bill) PaidDaily

func (b Bill) PaidDaily() float32

PaidDaily shows an average payment amount per day.

func (Bill) PaidIn

func (b Bill) PaidIn(p Period) float32

PaidIn returns amount paid in period.

type BillPeriod

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

BillPeriod describes date period.

func NewBillPeriod

func NewBillPeriod(periodStart, periodEnd string) (BillPeriod, error)

NewBillPeriod creates a new bill period, start and end dates are in fomat YYYY-MM-DD.

func (BillPeriod) Days

func (p BillPeriod) Days() int

Days calculates amount of days in the period. Start and end dates are counted as part of period.

func (BillPeriod) End

func (p BillPeriod) End() time.Time

End ...

func (BillPeriod) Start

func (p BillPeriod) Start() time.Time

Start ...

func (BillPeriod) String

func (p BillPeriod) String() string

type Bills

type Bills []Bill

Bills describes a list of bills.

func ReadCsv

func ReadCsv(file *os.File, hasHeader bool) (Bills, error)

ReadCsv reads CSV file and maps it to Bills.

func (Bills) AmountPaidIn

func (bills Bills) AmountPaidIn(p Period) float32

AmountPaidIn returns amount paid in financial year by the list of bills.

func (Bills) Report

func (bills Bills) Report(p Period) (string, error)

Report generates bills report.

type FinancialYear

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

FinancialYear describes financial year.

func FinancialYearEnding

func FinancialYearEnding(year int) FinancialYear

FinancialYearEnding creates new financial year by ending year.

func FinancialYearStarting

func FinancialYearStarting(year int) FinancialYear

FinancialYearStarting creates new financial year by starting year.

func (FinancialYear) End

func (fy FinancialYear) End() time.Time

End end date of financial year.

func (FinancialYear) Start

func (fy FinancialYear) Start() time.Time

Start start date of financial year.

func (FinancialYear) String

func (fy FinancialYear) String() string

type Period

type Period interface {
	Start() time.Time
	End() time.Time
	String() string
}

Period describes interface of the generic time period.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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