forked from CoinCulture/point-of-sale
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
137 lines (106 loc) · 2.16 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package main
import (
"fmt"
"strings"
"time"
)
//--------------------------------------------------
// date/time
// tz := "America/New_York"
var _timezone string = "EST"
var _location, _ = time.LoadLocation(_timezone)
func CurrentTime() time.Time {
now := time.Now().In(_location)
return now //now.Add(-5 * time.Hour) //location not working...
}
func DateString() string {
return strings.Split(fmt.Sprintf("%s", CurrentTime()), " ")[0] // zero grabs the sql formatted date
}
//--------------------------------------------------
// day, visits, sessions ...
type Day struct {
Start time.Time
}
// memdb or sqldb
type Visits interface {
All() []*Visit
}
func NewDay() *Day {
return &Day{
Start: CurrentTime(), // what if its not tomorrow yet ?!
}
}
type EntryType struct {
General string
Punch string
PayAtEnd string
ItemsOnly string
}
var EntryTypes = EntryType{
General: "general",
Punch: "punch_a_pass",
PayAtEnd: "pay_at_end",
ItemsOnly: "items_only",
}
type ItemType struct {
Food string
Drink string
Misc string
}
var ItemTypes = ItemType{
Food: "food",
Drink: "drink",
Misc: "misc",
}
type Visit struct {
Date string
EntryTime string
ExitTimeHack string // TODO time.Time
ExitTime time.Time
BraceletID int
InvoiceID int
Total int
FinalBill BillOrMenu
AdmissionType string // should be EntryTypes from above
Kids int
}
type BillOrMenu struct {
Foods []*Item
Drinks []*Item
Miscs []*Item
LatestTransactions []*Transaction
Total int
}
type Item struct {
Name string
Price int
// to set checkboxes for the menu
IsActive string
// used for stats & inserting
Type string // TODO work in with ItemType struct
Amount int
Total int
}
type Statistics struct {
Visits []*Visit
TotalVisits int
MeanVisitLength int // TODO time.Time
// should be []*Items?
Foods []*Transaction
TotalFood int
Drinks []*Transaction
TotalDrink int
Miscs []*Transaction
TotalMisc int
GrandTotal int
NumberOfVisits int
Menu *BillOrMenu
}
type Transaction struct {
BraceletID int
Name string
Amount int
Price int
Total int
Type string
}