fleet-contractor/Site/MachineDeviceManagement/OdometerAdjustHistory.aspx
2023-04-28 12:22:26 +08:00

244 lines
9.8 KiB
Plaintext

<%@ Page Title="" Language="C#" MasterPageFile="~/IronIntelMasterPage.master" AutoEventWireup="true" CodeFile="OdometerAdjustHistory.aspx.cs" Inherits="OdometerAdjustHistory" %>
<asp:Content ID="Content1" ContentPlaceHolderID="holder_head" runat="Server">
<style type="text/css">
::-ms-clear, ::-ms-reveal {
display: none;
}
.selectinput {
width: 150px;
margin-right: 10px;
}
.dialog-content table {
border-collapse: collapse;
width: 100%;
}
.dialog-content table td.label {
width: 160px;
text-align: right;
padding-right: 10px;
line-height: 24px;
height: 24px;
vertical-align: top;
}
.dialog-content table td input,
.dialog-content table td textarea {
border: 1px solid #a9a9a9;
width: 200px;
height: 18px;
padding: 1px;
}
.dialog-content table td input[type="checkbox"] {
border: none;
}
.dialog-content table td textarea {
height: 100px;
max-width: 200px;
}
#dialogdatatb td {
padding-top: 30px;
}
.a {
text-decoration: none;
color: #2140fb;
}
.machinetd {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
</style>
<link href="<%=GetFileUrlWithVersion("../css/jquery.datetimepicker.css")%>" rel="stylesheet" />
<script src="<%=GetFileUrlWithVersion("../Maintenance/js/inputdatactr.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../js/jquery.datetimepicker.full.js")%>"></script>
<script src="<%=GetFileUrlWithVersion("../js/editableselect.js")%>"></script>
<script type="text/javascript">
var IsDealer = <%=IsDealer ?"true":"false"%>;
var IsAdmin =<%=IsAdmin ?"true":"false"%>;
var contractorid = "<%=ContractorID %>";
var MachineID = "<%=MachineID %>";
var machines;
var editableSelectMachine;
var listeditableSelectMachine;
function assetrequest(method, param, callback, error) {
_network.request("MachineDeviceManagement/OdometerAdjustHistory.aspx", -1, method, param, callback, error || function (e) {
showmaskbg(false, true);
showAlert(GetTextByKey('P_MA_PAGEERROR', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_MA_QUERY', 'Query'));
});
}
function OnRefresh() {
showloading(true);
var startdate = htmlencode($('#startdatetxt').val());
var enddate = htmlencode($('#enddatetxt').val());
assetrequest("GetOdometerAdjustmentHistory", contractorid + String.fromCharCode(170) + MachineID
+ String.fromCharCode(170) + startdate + String.fromCharCode(170) + enddate
, function (data) {
if (typeof (data) === "string") {
showloading(false);
showAlert(data, GetTextByKey("P_MA_ERROR", 'Error'));
return;
}
showOdometerHistory(data);
showloading(false);
}, function (err) {
showloading(false);
});
}
function OnExport() {
var from = htmlencode($('#startdatetxt').val());
var to = htmlencode($('#enddatetxt').val());
var sortPath = grid_dt.sortKey;
if (sortPath === undefined) sortPath = "";
var desc = grid_dt.sortDirection !== 1;
window.open("../ExportToFile.aspx?type=odoadjusthis&cid=" + contractorid + "&mid=" + MachineID
+ "&from=" + from + "&to=" + to + "&sp=" + sortPath + "&desc=" + desc);
}
function showOdometerHistory(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
for (var j in r) {
if (j === "AdjustmentLocalTime")
r[j] = { DisplayValue: r["AdjustmentLocalTimeText"], Value: r[j] };
else if (j === "OdometerLocalTime")
r[j] = { DisplayValue: r["OdometerLocalTimeText"], Value: r[j] };
}
var fr = { Values: r };
rows.push(fr);
}
grid_dt.setData(rows);
}
var grid_dt;
function InitGridData() {
grid_dt = new GridView('#odometerlist');
grid_dt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
var list_columns = [
{ name: 'AssetName', caption: GetTextByKey("P_MA_ASSETNAME", "Asset Name"), valueIndex: 'DisplayName', css: { 'width': 200, 'text-align': 'left' } },
{ name: 'VIN', caption: GetTextByKey("P_MA_VIN", "VIN"), valueIndex: 'VIN', css: { 'width': 200, 'text-align': 'left' } },
{ name: 'UserName', caption: GetTextByKey("P_MA_USERNAME", "User Name"), valueIndex: 'UserName', css: { 'width': 200, 'text-align': 'left' } },
{ name: 'AdjustmentLocalTime', caption: GetTextByKey("P_MA_ADJUSTMENTTIME", "Adjustment Time"), valueIndex: 'AdjustmentLocalTime', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'Odometer', caption: GetTextByKey("P_MA_ODOMETERENTERED", "Odometer Entered"), valueIndex: 'Odometer', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'UOM', caption: GetTextByKey("P_MA_ODOMETERUOM", "Odometer Uom"), valueIndex: 'UOM', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'OdometerLocalTime', caption: GetTextByKey("P_MA_ODOMETERTIME", "Odometer Time"), valueIndex: 'OdometerLocalTime', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'Notes', caption: GetTextByKey("P_MA_NOTES", "Notes"), valueIndex: 'Notes', css: { 'width': 300, 'text-align': 'left' } }
];
var columns = [];
// head
for (var hd in list_columns) {
var col = {};
col.name = list_columns[hd].name;
col.caption = list_columns[hd].caption;
col.visible = true;
col.sortable = true;
col.width = list_columns[hd].css.width;
col.align = list_columns[hd].css["text-align"]
col.key = list_columns[hd].valueIndex;
col.allowFilter = list_columns[hd].allowFilter;
columns.push(col);
}
grid_dt.canMultiSelect = false;
grid_dt.columns = columns;
grid_dt.init();
}
$(function () {
InitGridData();
OnRefresh();
$('#startdatetxt').datetimepicker({
timepicker: false,
format: 'm/d/Y',
enterLikeTab: false,
onSelectDate: function (v, inp) {
var date = new DateFormatter().formatDate(v, 'm/d/Y 00:00:00');
inp.parent().data('val', [date]);
}
});
$('#enddatetxt').datetimepicker({
timepicker: false,
format: 'm/d/Y',
enterLikeTab: false,
onSelectDate: function (v, inp) {
var date = new DateFormatter().formatDate(v, 'm/d/Y 00:00:00');
inp.parent().data('val', [date]);
}
});
$(window).resize(function () {
$("#odometerlist").css("height", $(window).height() - $("#odometerlist").offset().top - 4);
grid_dt && grid_dt.resize();
}).resize();
});
function searchEnter(e) {
if (e.keyCode == 13 || e.keyCode == 9) {
OnRefresh();
}
}
</script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="holder_content" runat="Server">
<div id="recordcontent" style="padding: 0px; margin: 0px;">
<div class="page_title" data-lgid="P_MA_ODOMETERADJUSTMENTHISTORY">Odometer Adjustment History</div>
<table style="width: 100%; border-collapse: collapse; line-height: 32px; min-width: 1200px;">
<tr id="tr_search">
<td>
<span style="padding-left: 5px;" data-lgid="P_MA_STARTDATE_COLON">Start Date:</span>
<span>
<input id="startdatetxt" style="width: 100px;" value="<%=BeginDate %>" /></span>
<span style="padding-left: 5px;" data-lgid="P_MA_ENDDATE_COLON">End Date:</span>
<span>
<input id="enddatetxt" style="width: 100px;" value="<%=EndDate %>" /></span>
<input class="search" type="button" onclick="OnRefresh();" value="Search" data-lgid="P_MA_SEARCH" />
</td>
</tr>
<tr>
<td>
<div class="function_title">
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_MA_REFRESH">Refresh</span>
<span class="sbutton iconexport" onclick="OnExport();" data-lgid="P_MA_EXPORTTOEXCEL">Export to Excel</span>
</div>
</td>
</tr>
</table>
<div class="clear"></div>
<div id="odometerlist"></div>
</div>
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
</asp:Content>