fleet-contractor/Site/Maintenance/FuelRecordChangeHistory.aspx
2024-03-26 15:56:31 +08:00

150 lines
8.1 KiB
Plaintext

<%@ Page Title="" Language="C#" MasterPageFile="~/IronIntelMasterPage.master" AutoEventWireup="true" CodeFile="FuelRecordChangeHistory.aspx.cs" Inherits="FuelRecordChangeHistory" %>
<asp:Content ID="Content1" ContentPlaceHolderID="holder_head" runat="Server">
<style type="text/css">
.selectinput {
width: 150px;
margin-right: 10px;
}
#dialogdatatb td {
padding-top: 5px;
}
.a {
text-decoration: none;
color: #2140fb;
}
</style>
<script type="text/javascript">
var FuelID = "<%=FuelID %>";
var fuelrecorddata;
function fuelrequest(method, param, callback, error) {
_network.request("Maintenance/FuelRecordChangeHistory.aspx", -1, method, param, callback, error || function (e) {
showAlert(GetTextByKey('P_FR_PAGEERROR', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_FR_QUERY', 'Query'));
});
}
function enterKeydown(e) {
if (e.keyCode == 13) {
OnRefresh();
}
}
function OnRefresh() {
showloading(true);
fuelrequest("GetFuelRecordChangeHistory", FuelID, function (data) {
showloading(false);
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
if (data && data.length > 0)
fuelrecorddata = data;
else
fuelrecorddata = [];
showFuelRecordList(fuelrecorddata);
}, function (err) {
showloading(false);
});
}
function showFuelRecordList(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
var r = data[i];
for (var j in r) {
if (j === "TransactionLocalDate") {
r[j] = { DisplayValue: r["TransactionLocalDateStr"], Value: r[j] };
}
else if (j === "AddedOn_Local") {
r[j] = { DisplayValue: r["AddedOn_LocalStr"], Value: r[j] };
}
else if (j === "LastUpdatedOn_Local") {
r[j] = { DisplayValue: r["LastUpdatedOn_LocalStr"], Value: r[j] };
}
}
rows.push(r);
}
grid_dt.setData(rows);
}
var grid_dt;
function InitGridData() {
grid_dt = createGridView('#recordlist');
var list_columns = [
{ name: 'AssetName', caption: GetTextByKey("P_FR_ASSETNAME", GetTextByKey("P_FR_ASSETNAME", "Asset Name")), valueIndex: 'AssetName', allowFilter: true, css: { 'width': 180, 'text-align': 'left' } },
{ name: 'AssetMake', caption: GetTextByKey("P_FR_MAKE", "Make"), valueIndex: 'AssetMake', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
{ name: 'AssetModel', caption: GetTextByKey("P_FR_MODEL", "Model"), valueIndex: 'AssetModel', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
{ name: 'VIN', caption: GetTextByKey("P_FR_SNVIN", "SN/VIN"), valueIndex: 'VIN', allowFilter: true, css: { 'width': 180, 'text-align': 'left' } },
{ name: 'TicketNumber', caption: GetTextByKey("P_FR_TICKETNUMBER", "Ticket Number"), valueIndex: 'TicketNumber', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
{ name: 'DriverName', caption: GetTextByKey("P_FR_DRIVERNAME", "Driver Name"), valueIndex: 'DriverName', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
{ name: 'FuelType', caption: GetTextByKey("P_FR_FUELTYPE", "Fuel Type"), valueIndex: 'FuelType', allowFilter: true, css: { 'width': 90, 'text-align': 'left' } },
{ name: 'TransactionLocalDate', caption: GetTextByKey("P_FR_TRANSACTIONDATE", "Transaction Date"), valueIndex: 'TransactionLocalDate', css: { 'width': 120, 'text-align': 'left' } },
{ name: 'RetailerName', caption: GetTextByKey("P_FR_RETAILERNAME", "Retailer Name"), valueIndex: 'RetailerName', allowFilter: true, css: { 'width': 180, 'text-align': 'left' } },
{ name: 'RetailerAddress', caption: GetTextByKey("P_FR_ADDRESS", "Address"), valueIndex: 'RetailerAddress', allowFilter: true, css: { 'width': 180, 'text-align': 'left' } },
{ name: 'RetailerCity', caption: GetTextByKey("P_FR_CITY", "City"), valueIndex: 'RetailerCity', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'RetailerState', caption: GetTextByKey("P_FR_STATE", "State"), valueIndex: 'RetailerState', allowFilter: true, css: { 'width': 80, 'text-align': 'left' } },
{ name: 'RetailerZip', caption: GetTextByKey("P_FR_ZIP", "Zip"), valueIndex: 'RetailerZip', allowFilter: true, css: { 'width': 80, 'text-align': 'left' } },
{ name: 'Quantity', caption: GetTextByKey("P_FR_QUANTITY", "Quantity"), valueIndex: 'Quantity', allowFilter: true, css: { 'width': 80, 'text-align': 'right' } },
{ name: 'Uom', caption: GetTextByKey("P_FR_UOM", "Uom"), valueIndex: 'Uom', allowFilter: true, css: { 'width': 80, 'text-align': 'left' } },
{ name: 'TotalCost', caption: GetTextByKey("P_FR_TOTALCOST", "Total Cost"), valueIndex: 'TotalCost', allowFilter: true, css: { 'width': 80, 'text-align': 'right' } },
{ name: 'AddedByName', caption: GetTextByKey("P_FR_ADDEDNAME", "Added Name"), valueIndex: 'AddedByName', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
{ name: 'AddedOn_Local', caption: GetTextByKey("P_FR_ADDEDON", "Added On"), valueIndex: 'AddedOn_Local', css: { 'width': 120, 'text-align': 'left' } },
{ name: 'LasetUpdatedByName', caption: GetTextByKey("P_FR_LASTUPDATEDNAME", "Last Updated Name"), valueIndex: 'LasetUpdatedByName', allowFilter: true, css: { 'width': 122, 'text-align': 'left' } },
{ name: 'LastUpdatedOn_Local', caption: GetTextByKey("P_FR_LASTUPDATEDON", "Last Updated On"), valueIndex: 'LastUpdatedOn_Local', css: { 'width': 120, 'text-align': 'left' } },
{ name: 'Notes', caption: GetTextByKey("P_FR_NOTES", "Notes"), valueIndex: 'Notes', css: { 'width': 200, '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.multiSelect = false;
grid_dt.columns = columns;
grid_dt.init();
}
$(function () {
InitGridData();
OnRefresh();
$(window).resize(function () {
$("#recordlist").css("height", $(window).height() - $("#recordlist").offset().top - 4);
grid_dt && grid_dt.resize();
}).resize();
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="holder_content" runat="Server">
<div id="recordcontent" style="padding: 0px; margin: 0px;">
<div class="page_title" data-lgid="P_FR_FUELRECORDCHANGEHISTORY">Fuel Record Change History</div>
<div class="search_bar">
</div>
<div class="function_title">
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_FR_REFRESH">Refresh</span>
</div>
<div class="clear"></div>
<div id="recordlist"></div>
</div>
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
</asp:Content>