Skip to content

Commit

Permalink
Add date range to reports
Browse files Browse the repository at this point in the history
  • Loading branch information
howeyc committed Oct 7, 2015
1 parent 14dc92c commit c9c4829
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
9 changes: 8 additions & 1 deletion src/cmd/lweb/handler_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,18 @@ func ReportHandler(w http.ResponseWriter, r *http.Request, params martini.Params

type piePageData struct {
pageData
ChartAccounts []pieAccount
ReportName string
RangeStart, RangeEnd time.Time
ChartAccounts []pieAccount
}

var pData piePageData
pData.Reports = reportConfigData.Reports
pData.Transactions = trans
pData.ChartAccounts = values
pData.RangeStart = rStart
pData.RangeEnd = rEnd
pData.ReportName = reportName

t, err := template.ParseFiles("templates/template.piechart.html", "templates/template.nav.html")
if err != nil {
Expand All @@ -188,6 +193,7 @@ func ReportHandler(w http.ResponseWriter, r *http.Request, params martini.Params
}
type linePageData struct {
pageData
ReportName string
RangeStart, RangeEnd time.Time
ChartType string
Labels []string
Expand All @@ -196,6 +202,7 @@ func ReportHandler(w http.ResponseWriter, r *http.Request, params martini.Params
var lData linePageData
lData.Reports = reportConfigData.Reports
lData.Transactions = trans
lData.ReportName = reportName

colorIdx := 0
for _, freqAccountName := range rConf.Accounts {
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/lweb/templates/template.barlinechart.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="author" content="">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

<title>Ledger - Report</title>
<title>Ledger - Report - {{.ReportName}}</title>

<!-- Bootstrap core CSS -->
<link href="/bootstrap-3.3.0/dist/css/bootstrap.css" rel="stylesheet">
Expand All @@ -29,7 +29,7 @@
<div class="content-header">
<div class="row">
<div class="col-md-10">
<h1>Line Chart</h1>
<h1>{{.ReportName}} : {{.RangeStart.Format "2006-01-02"}} - {{.RangeEnd.Format "2006-01-02"}}</h1>
</div>
<div class="col-md-2"></div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/lweb/templates/template.piechart.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta name="author" content="">
<meta http-equiv="X-UA-Compatible" content="IE=edge">

<title>Ledger - Report</title>
<title>Ledger - Report - {{.ReportName}}</title>

<!-- Bootstrap core CSS -->
<link href="/bootstrap-3.3.0/dist/css/bootstrap.css" rel="stylesheet">
Expand All @@ -29,7 +29,7 @@
<div class="content-header">
<div class="row">
<div class="col-md-10">
<h1>Pie Chart</h1>
<h1>{{.ReportName}} : {{.RangeStart.Format "2006-01-02"}} - {{.RangeEnd.Format "2006-01-02"}}</h1>
</div>
<div class="col-md-2"></div>
</div>
Expand Down

0 comments on commit c9c4829

Please sign in to comment.