A couple of fixes
This commit is contained in:
@@ -38,6 +38,30 @@ namespace MileageTraker.Web.Controllers
|
|||||||
return View(viewModel);
|
return View(viewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ActionLog]
|
||||||
|
public ActionResult Export(FuelLogQueryViewModel query)
|
||||||
|
{
|
||||||
|
var validLogYearMonths = DataService.GetValidFuelLogMonths();
|
||||||
|
|
||||||
|
// default parameter processing
|
||||||
|
if (!query.HasParameters())
|
||||||
|
{
|
||||||
|
query.FiscalYear = validLogYearMonths.First().Year;
|
||||||
|
query.Month = validLogYearMonths.First().Month;
|
||||||
|
}
|
||||||
|
|
||||||
|
var fuelLogs = DataService.GetFuelLogs();
|
||||||
|
var filteredLogs =
|
||||||
|
from fl in DataService.FilterFuelLogs(fuelLogs, query).ToList()
|
||||||
|
orderby fl.Date ascending
|
||||||
|
select new FuelLogIndexViewModel(fl);
|
||||||
|
|
||||||
|
var name = string.Format("FuelLogs_{0}", query);
|
||||||
|
|
||||||
|
var export = ExcelWriter<FuelLogIndexViewModel>.WriteXls(filteredLogs, name, name);
|
||||||
|
return File(export, "application/ms-excel", name + ".xls");
|
||||||
|
}
|
||||||
|
|
||||||
public ViewResult Details(int id)
|
public ViewResult Details(int id)
|
||||||
{
|
{
|
||||||
var fuelLog = DataService.GetFuelLog(id);
|
var fuelLog = DataService.GetFuelLog(id);
|
||||||
|
|||||||
@@ -104,6 +104,9 @@ namespace MileageTraker.Web.Utility
|
|||||||
else if (value is DateTime)
|
else if (value is DateTime)
|
||||||
formatString = @"MM/DD/YYYY hh:mm:ss";
|
formatString = @"MM/DD/YYYY hh:mm:ss";
|
||||||
|
|
||||||
|
if (p.Name == "GasPurchased") // format to the .000 place
|
||||||
|
formatString = "#,##0.000";
|
||||||
|
|
||||||
int intValue; // write int-looking values as numbers
|
int intValue; // write int-looking values as numbers
|
||||||
if (value is string && int.TryParse((string) value, out intValue))
|
if (value is string && int.TryParse((string) value, out intValue))
|
||||||
value = intValue;
|
value = intValue;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
@Html.Partial("_StatusMessage")
|
@Html.Partial("_StatusMessage")
|
||||||
|
|
||||||
<h2 class="center-content"><i class="fa fa-road"></i> @ViewBag.Title</h2>
|
<h2 class="center-content"><i class="fa fa-tachometer"></i> @ViewBag.Title</h2>
|
||||||
|
|
||||||
@using (Html.BeginForm("Import", "FuelLog", FormMethod.Post, new { enctype="multipart/form-data", @class = "form-horizontal well center-content", style="max-width:440px"}))
|
@using (Html.BeginForm("Import", "FuelLog", FormMethod.Post, new { enctype="multipart/form-data", @class = "form-horizontal well center-content", style="max-width:440px"}))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
@{
|
@{
|
||||||
ViewBag.Title = "Fuel Logs";
|
ViewBag.Title = "Fuel Logs";
|
||||||
var grid = new WebGrid(Model.FuelLogs, rowsPerPage: 45);
|
var grid = new WebGrid(Model.FuelLogs, rowsPerPage: 45);
|
||||||
var parameters = new {Year = Model.FiscalYear, Model.Month};
|
var parameters = new {FiscalYear = Model.FiscalYear, Model.Month, Model.Unmatched};
|
||||||
}
|
}
|
||||||
@section Styles {
|
@section Styles {
|
||||||
<link href="@Url.Content("~/Content/VehicleColors.css")" rel="stylesheet" type="text/css" />
|
<link href="@Url.Content("~/Content/VehicleColors.css")" rel="stylesheet" type="text/css" />
|
||||||
|
|||||||
@@ -36,9 +36,9 @@
|
|||||||
@if (User.IsInRole("Developer") || User.IsInRole("Administrator"))
|
@if (User.IsInRole("Developer") || User.IsInRole("Administrator"))
|
||||||
{
|
{
|
||||||
<li id="log-nav">@Html.ActionLink("Logs", "Index", "Log")</li>
|
<li id="log-nav">@Html.ActionLink("Logs", "Index", "Log")</li>
|
||||||
<li id="vehicle-nav">@Html.ActionLink("Vehicles", "Index", "Vehicle")</li>
|
<li id="vehicle-nav">@Html.ActionLink("Vehicles", "Index", "Vehicle")</li>
|
||||||
|
<li id="fuellog-nav">@Html.ActionLink("Fuel Logs", "Index", "FuelLog")</li>
|
||||||
<li id="user-nav">@Html.ActionLink("Users", "Index", "User")</li>
|
<li id="user-nav">@Html.ActionLink("Users", "Index", "User")</li>
|
||||||
<li id="fuellog-nav">@Html.ActionLink("Fuel Logs", "Index", "FuelLog")</li>
|
|
||||||
<li id="config-nav" class="dropdown">
|
<li id="config-nav" class="dropdown">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Config <span class="caret"></span></a>
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Config <span class="caret"></span></a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
|
|||||||
Reference in New Issue
Block a user