reporting

package
v0.0.0-...-66b7006 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const ReportPaginationLimit = 100

Variables

This section is empty.

Functions

func AdjustForWeekStart

func AdjustForWeekStart(fromDate time.Time, toDate time.Time, weekStart int, today time.Time) (time.Time, time.Time)

* Adjust the from/to dates by the weekStart from the profile * All dates assume 0 = Sunday and 6 = Saturday

func ExportClientReportResponse

func ExportClientReportResponse(report *ClientReport) []string

func ExportPersonReportResponse

func ExportPersonReportResponse(report *PersonReport) []string

func ExportProjectReportResponse

func ExportProjectReportResponse(report *ProjectReport) []string

func ExportTaskReportResponse

func ExportTaskReportResponse(report *TaskReport) []string

func WriteExportClientReportsResponse

func WriteExportClientReportsResponse(w http.ResponseWriter, companyName string, fromDate time.Time, toDate time.Time, clientReportRows []*ClientReport)

func WriteExportPersonReportsResponse

func WriteExportPersonReportsResponse(w http.ResponseWriter, companyName string, fromDate time.Time, toDate time.Time, personReportRows []*PersonReport)

func WriteExportProjectReportsResponse

func WriteExportProjectReportsResponse(w http.ResponseWriter, companyName string, fromDate time.Time, toDate time.Time, projectReportRows []*ProjectReport)

func WriteExportTaskReportsResponse

func WriteExportTaskReportsResponse(w http.ResponseWriter, companyName string, fromDate time.Time, toDate time.Time, taskReportRows []*TaskReport)

Types

type ClientReport

type ClientReport struct {
	ClientId         int             `json:"-" db:"client_id"`
	ClientName       string          `json:"-" db:"client_name"`
	NonBillableHours sql.NullFloat64 `json:"-" db:"non_billable_hours"`
	BillableHours    sql.NullFloat64 `json:"-" db:"billable_hours"`
	BillableTotal    sql.NullFloat64 `json:"-" db:"billable_total"`
}

type ClientReportResponse

type ClientReportResponse struct {
	ClientId         int     `json:"clientId"`
	ClientName       string  `json:"clientName"`
	NonBillableHours float64 `json:"nonBillableHours"`
	BillableHours    float64 `json:"billableHours"`
	BillableTotal    float64 `json:"billableTotal"`
}

func NewClientReportResponse

func NewClientReportResponse(report *ClientReport) *ClientReportResponse

func NewClientReportsResponse

func NewClientReportsResponse(clientReportRows []*ClientReport) []*ClientReportResponse

type PersonReport

type PersonReport struct {
	ProfileId        int             `json:"-" db:"profile_id"`
	FirstName        string          `json:"-" db:"first_name"`
	LastName         string          `json:"-" db:"last_name"`
	NonBillableHours sql.NullFloat64 `json:"-" db:"non_billable_hours"`
	BillableHours    sql.NullFloat64 `json:"-" db:"billable_hours"`
	BillableTotal    sql.NullFloat64 `json:"-" db:"billable_total"`
}

type PersonReportResponse

type PersonReportResponse struct {
	ProfileId        int     `json:"profileId"`
	FirstName        string  `json:"firstName"`
	LastName         string  `json:"lastName"`
	NonBillableHours float64 `json:"nonBillableHours"`
	BillableHours    float64 `json:"billableHours"`
	BillableTotal    float64 `json:"billableTotal"`
}

func NewPersonReportResponse

func NewPersonReportResponse(report *PersonReport) *PersonReportResponse

func NewPersonReportsResponse

func NewPersonReportsResponse(reportRows []*PersonReport) []*PersonReportResponse

type ProjectReport

type ProjectReport struct {
	ProjectId        int             `json:"-" db:"project_id"`
	ProjectName      string          `json:"-" db:"project_name"`
	ClientName       string          `json:"-" db:"client_name"`
	NonBillableHours sql.NullFloat64 `json:"-" db:"non_billable_hours"`
	BillableHours    sql.NullFloat64 `json:"-" db:"billable_hours"`
	BillableTotal    sql.NullFloat64 `json:"-" db:"billable_total"`
}

type ProjectReportResponse

type ProjectReportResponse struct {
	ProjectId        int     `json:"projectId"`
	ProjectName      string  `json:"projectName"`
	ClientName       string  `json:"clientName"`
	NonBillableHours float64 `json:"nonBillableHours"`
	BillableHours    float64 `json:"billableHours"`
	BillableTotal    float64 `json:"billableTotal"`
}

func NewProjectReportResponse

func NewProjectReportResponse(report *ProjectReport) *ProjectReportResponse

func NewProjectReportsResponse

func NewProjectReportsResponse(reportRows []*ProjectReport) []*ProjectReportResponse

type ReportingData

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

func (*ReportingData) GetTimeByClient

func (c *ReportingData) GetTimeByClient(accountId int, fromDate time.Time, toDate time.Time, offset int) ([]*ClientReport, error)

func (*ReportingData) GetTimeByPerson

func (c *ReportingData) GetTimeByPerson(accountId int, fromDate time.Time, toDate time.Time, offset int) ([]*PersonReport, error)

func (*ReportingData) GetTimeByProject

func (c *ReportingData) GetTimeByProject(accountId int, fromDate time.Time, toDate time.Time, offset int) ([]*ProjectReport, error)

func (*ReportingData) GetTimeByTask

func (c *ReportingData) GetTimeByTask(accountId int, fromDate time.Time, toDate time.Time, offset int) ([]*TaskReport, error)

type ReportingResource

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

func (*ReportingResource) GetTimeByClient

func (c *ReportingResource) GetTimeByClient(accountId int, fromDate time.Time, toDate time.Time, offset int) ([]*ClientReport, *api.Error)

func (*ReportingResource) GetTimeByPerson

func (c *ReportingResource) GetTimeByPerson(accountId int, fromDate time.Time, toDate time.Time, offset int) ([]*PersonReport, *api.Error)

func (*ReportingResource) GetTimeByProject

func (c *ReportingResource) GetTimeByProject(accountId int, fromDate time.Time, toDate time.Time, offset int) ([]*ProjectReport, *api.Error)

func (*ReportingResource) GetTimeByTask

func (c *ReportingResource) GetTimeByTask(accountId int, fromDate time.Time, toDate time.Time, offset int) ([]*TaskReport, *api.Error)

type ReportingRouter

type ReportingRouter struct {
	ReportingService ReportingService
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(store ReportingStore, profileRouter *profile.ProfileRouter) *ReportingRouter

func (*ReportingRouter) Router

func (a *ReportingRouter) Router() *chi.Mux

type ReportingService

type ReportingService interface {
	GetTimeByClient(accountId int, fromDate time.Time, toDate time.Time, offset int) ([]*ClientReport, *api.Error)
	GetTimeByProject(accountId int, fromDate time.Time, toDate time.Time, offset int) ([]*ProjectReport, *api.Error)
	GetTimeByTask(accountId int, fromDate time.Time, toDate time.Time, offset int) ([]*TaskReport, *api.Error)
	GetTimeByPerson(accountId int, fromDate time.Time, toDate time.Time, offset int) ([]*PersonReport, *api.Error)
}

func NewReportingService

func NewReportingService(store ReportingStore) ReportingService

type ReportingStore

type ReportingStore interface {
	GetTimeByClient(accountId int, fromDate time.Time, toDate time.Time, offset int) ([]*ClientReport, error)
	GetTimeByProject(accountId int, fromDate time.Time, toDate time.Time, offset int) ([]*ProjectReport, error)
	GetTimeByTask(accountId int, fromDate time.Time, toDate time.Time, offset int) ([]*TaskReport, error)
	GetTimeByPerson(accountId int, fromDate time.Time, toDate time.Time, offset int) ([]*PersonReport, error)
}

func NewReportingStore

func NewReportingStore(db *sqlx.DB) ReportingStore

type TaskReport

type TaskReport struct {
	TaskId           int             `json:"-" db:"task_id"`
	ClientId         int             `json:"-" db:"client_id"`
	TaskName         string          `json:"-" db:"task_name"`
	NonBillableHours sql.NullFloat64 `json:"-" db:"non_billable_hours"`
	BillableHours    sql.NullFloat64 `json:"-" db:"billable_hours"`
	BillableTotal    sql.NullFloat64 `json:"-" db:"billable_total"`
}

type TaskReportResponse

type TaskReportResponse struct {
	TaskId           int     `json:"taskId"`
	ClientId         int     `json:"clientId"`
	TaskName         string  `json:"taskName"`
	ClientName       string  `json:"clientName"`
	NonBillableHours float64 `json:"nonBillableHours"`
	BillableHours    float64 `json:"billableHours"`
	BillableTotal    float64 `json:"billableTotal"`
}

func NewTaskReportResponse

func NewTaskReportResponse(report *TaskReport) *TaskReportResponse

func NewTaskReportsResponse

func NewTaskReportsResponse(reportRows []*TaskReport) []*TaskReportResponse

Jump to

Keyboard shortcuts

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