splitter

package
v0.0.0-...-ace68cd Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OpNotInvolved = -1
	OpSettled     = 0
	OpGetsBack    = 1
	OpOwe         = 2 //not needed
	OpPaid        = 3
	OpBoth        = 4
)

Variables

This section is empty.

Functions

func SplitSharesForBillWrapper

func SplitSharesForBillWrapper(tripId int64, planId int64, billAmount float64, currentMemberEmail string, membersJson string, sharesJson string) (string, float64, bool)

func ValidateShares

func ValidateShares(sharesJson string, billAmount float64) (bool, string)

Types

type Member

type Member struct {
	Tripid  int64
	Name    string
	Email   string
	Avatar  string
	Created time.Time
	Updated int64
}

Member is the user who involved in the expense

type PlanSuggestion

type PlanSuggestion struct {
	Tripid      int64
	Planid      int64
	Notes       string
	Brief       string
	Date        string
	Amount      float64
	Operation   int
	Suggestions []Suggestion
}

PlanSuggestion is the wrapper above suggestions has all the suggestions/settlements

func CreateIndividualSuggestionWrapper

func CreateIndividualSuggestionWrapper(tripId, planId int64, amount float64, notes string, created time.Time, membersJson string, currentMemberEmail string, sharesJson string) *PlanSuggestion

func CreateTotalSuggestion

func CreateTotalSuggestion(tripId int64, totalAmount float64, members []Member, currentMemberEmail string, shares []Share) *PlanSuggestion

func CreateTotalSuggestionWrapper

func CreateTotalSuggestionWrapper(tripId int64, totalAmount float64, membersJson string, currentMemberEmail string, sharesJson string) *PlanSuggestion

type Share

type Share struct {
	Id              int64
	Tripid          int64
	Planid          int64
	Memberemail     string
	Membername      string
	Memberavatar    string
	Benefactoremail string //The amount paid by this Memberid to this Benefactorid.
	Note            string
	Paid            float64 //Amount paid by this member.
	Share           float64 //Actual share he has to pay.
	Diff            float64 //Used internally to create suggestions
	Auto            bool
	Created         time.Time
	Updated         int64
}

Share the member has to pay

type Suggestion

type Suggestion struct {
	AMemberemail  string
	AMembername   string
	AMemberavatar string
	BMemberemail  string
	BMembername   string
	BMemberavatar string
	Amount        float64
	Operation     int
	Datestr       string
}

Suggestion is the one we can use to settle/show the expense

Jump to

Keyboard shortcuts

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