add site
This commit is contained in:
395
Site/Maintenance/FuelRecordManagement.aspx
Normal file
395
Site/Maintenance/FuelRecordManagement.aspx
Normal file
@ -0,0 +1,395 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Maintenance/MaintenanceBase.master" AutoEventWireup="true" CodeFile="FuelRecordManagement.aspx.cs" Inherits="Maintenance_FuelRecordManagement" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
|
||||
<link href="../css/jquery.datetimepicker.css" rel="stylesheet" />
|
||||
<style type="text/css">
|
||||
.selectinput {
|
||||
width: 150px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.dialog-content table {
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dialog-content table td.label {
|
||||
width: 150px;
|
||||
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: 5px;
|
||||
}
|
||||
|
||||
.a {
|
||||
text-decoration: none;
|
||||
color: #2140fb;
|
||||
}
|
||||
</style>
|
||||
<script src="../js/jquery.datetimepicker.full.js"></script>
|
||||
<script src="<%=GetFileUrlWithVersion("js/inputdatactr.js")%>" type="text/javascript"></script>
|
||||
<script src="<%=GetFileUrlWithVersion("../js/editableselect.js")%>" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
var fuelrecorddata;
|
||||
var assetid = "<%=AssetID %>";
|
||||
|
||||
function fuelrequest(method, param, callback, error) {
|
||||
_network.request("Maintenance/FuelRecordManagement.aspx", -1, method, param, callback, error || function (e) {
|
||||
showmaskbg(false, true);
|
||||
showAlert(GetTextByKey('P_FR_PAGEERROR', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_FR_QUERY', 'Query'));
|
||||
});
|
||||
}
|
||||
|
||||
function recordrequest(method, param, callback, error) {
|
||||
_network.request("Maintenance/MaintanceRecordsManagement.aspx", -1, method, param, callback, error || function (e) {
|
||||
showmaskbg(false, true);
|
||||
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 GetTypesData() {
|
||||
recordrequest("GetTypesData", '', function (data) {
|
||||
if (typeof (data) === "string") {
|
||||
showAlert(data, GetTextByKey("P_FR_ERROR", 'Error'));
|
||||
return;
|
||||
}
|
||||
$('#typeselectinput').empty();
|
||||
$("<option></option>").val("-1").text(GetTextByKey("P_SELECT_ALL", "All")).appendTo($("#typeselectinput"));
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
$("<option></option>").val(data[i].Key).text(data[i].Value).appendTo($("#typeselectinput"));
|
||||
}
|
||||
|
||||
OnRefresh();
|
||||
}, function (err) {
|
||||
})
|
||||
}
|
||||
|
||||
function OnRefresh() {
|
||||
showloading(true);
|
||||
|
||||
var type = $('#typeselectinput').find("option:selected").val();
|
||||
var searchtxt = "";
|
||||
searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
|
||||
var startdate = htmlencode($('#startdatetxt').val());
|
||||
var enddate = htmlencode($('#enddatetxt').val());
|
||||
var aid = (!assetid || assetid == "") ? -1 : eval(assetid);
|
||||
|
||||
fuelrequest("GetFuelRecords", type + String.fromCharCode(170) + startdate + String.fromCharCode(170) + enddate + String.fromCharCode(170) + searchtxt + String.fromCharCode(170) + aid, 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 getLangUom(text) {
|
||||
var langtext = text;
|
||||
if (text === "Litre")
|
||||
langtext = GetTextByKey("P_FR_LITRE", "Litre");
|
||||
else if (text === "Gallon")
|
||||
langtext = GetTextByKey("P_FR_GALLON", "Gallon");
|
||||
return langtext;
|
||||
}
|
||||
|
||||
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 === "DistributedBy") {
|
||||
r["DistributedBy"] = { DisplayValue: r.DistributedBy == 0 ? "Fueling Station" : "Fueling Asset", Value: r[j] };
|
||||
}
|
||||
//else if (j === "Uom") {
|
||||
// r[j] = { DisplayValue: getLangUom(r["Uom"]), Value: r[j] };
|
||||
//}
|
||||
}
|
||||
var fr = { Values: r };
|
||||
rows.push(fr);
|
||||
}
|
||||
|
||||
grid_dt.setData(rows);
|
||||
}
|
||||
|
||||
var grid_dt;
|
||||
function InitGridData() {
|
||||
grid_dt = new GridView('#recordlist');
|
||||
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_FR_ASSETNAME", "Asset Name"), valueIndex: 'AssetName', 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', css: { 'width': 180, 'text-align': 'left' } },
|
||||
{ name: 'TransactionLocalDate', caption: GetTextByKey("P_FR_TRANSACTIONDATE", "Transaction Date"), valueIndex: 'TransactionLocalDate', css: { 'width': 120, 'text-align': 'left' } },
|
||||
{ name: 'DistributedBy', caption: GetTextByKey("P_FR_DISTRIBUTEDBY", "Distributed By"), valueIndex: 'DistributedBy', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
|
||||
{ name: 'RetailerName', caption: GetTextByKey("P_FR_RETAILERNAME", "Retailer Name"), valueIndex: 'RetailerName', css: { 'width': 180, 'text-align': 'left' } },
|
||||
{ name: 'FuelingAssetName', caption: GetTextByKey("P_FR_ASSET", "Asset"), valueIndex: 'FuelingAssetName', css: { 'width': 180, 'text-align': 'left' } },
|
||||
{ name: 'Quantity', caption: GetTextByKey("P_FR_QUANTITY", "Quantity"), valueIndex: 'Quantity', css: { 'width': 80, 'text-align': 'right' } },
|
||||
{ name: 'Uom', caption: GetTextByKey("P_FR_UOM", "UOM"), valueIndex: 'Uom', css: { 'width': 80, 'text-align': 'left' } },
|
||||
{ name: 'UnitCost', caption: GetTextByKey("P_FR_UOMCOST", "Unit Cost"), valueIndex: 'UnitCost', css: { 'width': 80, 'text-align': 'right' } },
|
||||
{ name: 'TotalCost', caption: GetTextByKey("P_FR_TOTALCOST", "Total Cost"), valueIndex: 'TotalCost', css: { 'width': 80, 'text-align': 'right' } },
|
||||
{ name: 'Edit', caption: "", css: { 'width': 30, 'text-align': 'center' } },
|
||||
{ name: 'Delete', caption: "", css: { 'width': 30, 'text-align': 'center' } }
|
||||
];
|
||||
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;
|
||||
if (col.name === "Edit") {
|
||||
col.isurl = true;
|
||||
col.text = "\uf044";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
OnEdit();
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
}
|
||||
col.attrs = { 'title': GetTextByKey("P_FR_EDIT", 'Edit') };
|
||||
}
|
||||
else if (col.name === "Delete") {
|
||||
col.isurl = true;
|
||||
col.text = "\uf00d";
|
||||
col.events = {
|
||||
onclick: function () {
|
||||
OnDelete(this);
|
||||
}
|
||||
};
|
||||
col.classFilter = function (e) {
|
||||
return "icon-col";
|
||||
};
|
||||
col.styleFilter = function (e) {
|
||||
return {
|
||||
display: e.IsComesFromAPI ? 'none' : ''
|
||||
};
|
||||
};
|
||||
col.attrs = { 'title': GetTextByKey("P_FR_DELETE", 'Delete') };
|
||||
}
|
||||
columns.push(col);
|
||||
}
|
||||
grid_dt.canMultiSelect = false;
|
||||
grid_dt.columns = columns;
|
||||
grid_dt.init();
|
||||
grid_dt.rowdblclick = OnEdit;
|
||||
|
||||
grid_dt.selectedrowchanged = function (rowindex) {
|
||||
var rowdata = grid_dt.source[rowindex];
|
||||
if (rowdata) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//执行iframe中函数
|
||||
var doIFrameFunc = function (v_mymethod, v_params, v_frmName) {
|
||||
if (document.getElementById(v_frmName)) {
|
||||
|
||||
var fn = document.getElementById(v_frmName).contentWindow[v_mymethod];
|
||||
|
||||
if (fn) {
|
||||
if (v_params == null)
|
||||
return fn();
|
||||
else {
|
||||
return fn.apply(this, v_params);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function ShowDialog(type) {
|
||||
showmaskbg(true);
|
||||
$('#dialog_fuelrecord')
|
||||
.attr('act', type)
|
||||
.showDialogRight();
|
||||
}
|
||||
|
||||
function CloseDialog(type) {
|
||||
$('#dialog_fuelrecord').hideDialog();
|
||||
OnRefresh();
|
||||
}
|
||||
|
||||
|
||||
function OnAdd() {
|
||||
doIFrameFunc("init", [], "iframfuelrecord");
|
||||
ShowDialog("add");
|
||||
}
|
||||
|
||||
function OnEdit() {
|
||||
var index = grid_dt.selectedIndex;
|
||||
if (index < 0) {
|
||||
showAlert(GetTextByKey("P_FR_PLEASESELECTAFUELRECORD", "Please select a fuel record."), GetTextByKey("P_FR_EDITFUELRECORD", "Edit Fuel Record"));
|
||||
return;
|
||||
}
|
||||
var record = grid_dt.source[index].Values;
|
||||
if (!record)
|
||||
return;
|
||||
doIFrameFunc("init", [record], "iframfuelrecord");
|
||||
|
||||
showmaskbg(true);
|
||||
ShowDialog("edit");
|
||||
}
|
||||
|
||||
|
||||
function OnDelete(record) {
|
||||
if (!record) {
|
||||
return;
|
||||
}
|
||||
var alerttitle = GetTextByKey("P_FR_DELETEFUELRECORD", 'Delete Fuel Record');
|
||||
showConfirm(GetTextByKey("P_FR_DOYOUDELETETHEFULERECORD", 'Do you want to delete the fuel record?'), alerttitle, function () {
|
||||
fuelrequest("DeleteFuelRecord", record.FuelID, function (data) {
|
||||
if (data !== "OK")
|
||||
showAlert(data, alerttitle);
|
||||
else
|
||||
OnRefresh();
|
||||
}, function (err) {
|
||||
showAlert(GetTextByKey("P_FR_FAILEDTODELETETHISFUELRECORD", 'Failed to delete this fuel record.'), alerttitle);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$(function () {
|
||||
setPageTitle(GetTextByKey("P_FUELRECORDS", "Fuel Records"), true);
|
||||
InitGridData();
|
||||
GetTypesData();
|
||||
|
||||
$('#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]);
|
||||
}
|
||||
});
|
||||
|
||||
$('#searchinputtxt').keydown(enterKeydown);
|
||||
$('#typeselectinput').change(function () { OnRefresh(); });
|
||||
|
||||
$(window).resize(function () {
|
||||
$("#recordlist").css("height", $(window).height() - $("#recordlist").offset().top - 4);
|
||||
grid_dt && grid_dt.resize();
|
||||
}).resize();
|
||||
|
||||
if (!canExport) {
|
||||
$('#spExport').hide();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
function changeasset(aid) {
|
||||
assetid = aid;
|
||||
OnRefresh();
|
||||
}
|
||||
function OnExit() {
|
||||
window.parent.CloseFuelRecordsDialog();
|
||||
}
|
||||
|
||||
function OnExport() {
|
||||
var searchtxt = "";
|
||||
searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
|
||||
var type = $('#typeselectinput').find("option:selected").val();
|
||||
var from = htmlencode($('#startdatetxt').val());
|
||||
var to = htmlencode($('#enddatetxt').val());
|
||||
var aid = (!assetid || assetid == "") ? -1 : eval(assetid);
|
||||
window.open("../ExportToFile.aspx?type=fuelrecordmanagement&t=" + searchtxt + "&from=" + from + "&to=" + to + "&tp=" + type + "&aid=" + aid);
|
||||
}
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
|
||||
<div id="recordcontent" style="padding: 0px; margin: 0px;">
|
||||
<div class="page_title" data-lgid="P_FUELRECORDS">Fuel Records</div>
|
||||
<div class="search_bar">
|
||||
<input type="password" autocomplete="new-password" style="display: none" />
|
||||
<span data-lgid="P_FR_BEGINDATE_COLON">Begin Date: </span>
|
||||
<span>
|
||||
<input id="startdatetxt" type="text" style="width: 100px;" value="<%=BeginDate %>" autocomplete="off" /></span>
|
||||
<span data-lgid="P_FR_ENDDATE_COLON">End Date: </span>
|
||||
<span>
|
||||
<input id="enddatetxt" type="text" style="width: 100px;" value="<%=EndDate %>" autocomplete="off" /></span>
|
||||
<span data-lgid="P_FR_ASSETTYPE_COLON" style="padding-left: 5px;">Type:</span> <select class="selectinput" id="typeselectinput"></select>
|
||||
<input id="searchinputtxt" type="text" autocomplete="off" />
|
||||
<input class="search" type="button" onclick="OnRefresh();" value="Search" data-lgid="P_FR_SEARCH" style="margin-left: 5px;" />
|
||||
</div>
|
||||
<div class="function_title">
|
||||
<span class="sbutton iconadd" onclick="OnAdd();" style="<%=InDialog?"display:none;": ""%>;" data-lgid="P_FR_ADD">Add</span>
|
||||
<span class="sbutton iconedit" onclick="OnEdit();" style="<%=InDialog?"display:none;": ""%>;" data-lgid="P_FR_EDIT">Edit</span>
|
||||
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_FR_REFRESH">Refresh</span>
|
||||
<span id="spExport" class="sbutton iconexport" onclick="OnExport();" data-lgid="P_MR_EXPORTTOEXCEL">Export to Excel</span>
|
||||
<span class="sbutton iconexit" onclick="OnExit();" style="<%=InDialog?"": "display:none;"%>;" data-lgid="P_WO_EXIT">Exit</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>
|
||||
|
||||
|
||||
<div class="dialog" id="dialog_fuelrecord" style="display: none; height: 100%; border-bottom: 0; border-top: 0;">
|
||||
<iframe id="iframfuelrecord" src="AddFuelRecord.aspx" style="width: 100%; height: 100%; display: block; border: none;"></iframe>
|
||||
<div class="maskbg" style="display: none;"></div>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
Reference in New Issue
Block a user