add site
This commit is contained in:
406
Site/MachineDeviceManagement/RentalChangeHistory.aspx
Normal file
406
Site/MachineDeviceManagement/RentalChangeHistory.aspx
Normal file
@ -0,0 +1,406 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/IronIntelMasterPage.master" AutoEventWireup="true" CodeFile="RentalChangeHistory.aspx.cs" Inherits="RentalChangeHistory" %>
|
||||
|
||||
|
||||
<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 RentalID = "<%=RentalID %>";
|
||||
var machines;
|
||||
var editableSelectMachine;
|
||||
var listeditableSelectMachine;
|
||||
|
||||
function devicerequest(method, param, callback, error) {
|
||||
_network.request("MachineDeviceManagement/ManageRentals.aspx", -1, method, param, callback, error || function (e) {
|
||||
showmaskbg(false, true);
|
||||
showAlert(GetTextByKey('P_MR_PAGEERROR', 'An unknown error occurred. Please refresh page.'), GetTextByKey('P_MR_QUERY', 'Query'));
|
||||
});
|
||||
}
|
||||
|
||||
//admin用户 获取所有contractor
|
||||
function getContractors() {
|
||||
devicerequest('GetContractors', '', function (data) {
|
||||
if (typeof (data) === "string") {
|
||||
showAlert(data, GetTextByKey("P_MR_ERROR", 'Error'));
|
||||
return;
|
||||
}
|
||||
if (data && data.length > 0) {
|
||||
var sel_search = $('#sel_contractor').empty();
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var kv = data[i];
|
||||
var op_search = $('<option></option>').val(kv.Key).text(kv.Value);
|
||||
if (kv.Key == contractorid)
|
||||
op_search.prop('selected', true);
|
||||
sel_search.append(op_search);
|
||||
}
|
||||
if (contractorid !== "")
|
||||
sel_search.val(contractorid);
|
||||
}
|
||||
|
||||
GetMachines();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
//普通用户 获取可操作的contractor
|
||||
function GetContractorsByUser() {
|
||||
devicerequest('GetContractorsByUser', '', function (data) {
|
||||
if (typeof (data) === "string") {
|
||||
showAlert(data, GetTextByKey("P_MR_ERROR", 'Error'));
|
||||
return;
|
||||
}
|
||||
if (data && data.length > 0) {
|
||||
var sel_search = $('#sel_contractor').empty();
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var kv = data[i];
|
||||
var op_search = $('<option></option>').val(kv.Key).text(kv.Value);
|
||||
sel_search.append(op_search);
|
||||
}
|
||||
|
||||
if (contractorid !== "")
|
||||
sel_search.val(contractorid);
|
||||
}
|
||||
GetMachines();
|
||||
});
|
||||
}
|
||||
|
||||
function GetMachines() {
|
||||
contractorid = htmlencode($.trim($('#sel_contractor').val()));
|
||||
|
||||
devicerequest("GetSelectMachinesByCompany", contractorid, function (data) {
|
||||
if (data && data.length > 0) {
|
||||
machines = data;
|
||||
listeditableSelectMachine.datasource = machines;
|
||||
listeditableSelectMachine.valuepath = "MachineID"
|
||||
listeditableSelectMachine.displaypath = "DisplayName";
|
||||
//if (MachineID !== "")//暂时不过滤机器
|
||||
//listeditableSelectMachine.val(MachineID);
|
||||
}
|
||||
|
||||
OnRefresh();
|
||||
|
||||
}, function (err) {
|
||||
});
|
||||
}
|
||||
|
||||
function OnRefresh() {
|
||||
showloading(true);
|
||||
|
||||
var cid = htmlencode($.trim($('#sel_contractor').val()));
|
||||
if (cid && cid != '')
|
||||
contractorid = cid;
|
||||
var searchtxt = "";
|
||||
searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
|
||||
var startdate = htmlencode($('#startdatetxt').val());
|
||||
var enddate = htmlencode($('#enddatetxt').val());
|
||||
|
||||
var machine = listeditableSelectMachine.selecteditem();
|
||||
if (machine != null)
|
||||
MachineID = machine.MachineID;
|
||||
else
|
||||
MachineID = "";
|
||||
|
||||
|
||||
devicerequest("SearchRentalChangeHistory", contractorid + String.fromCharCode(170) + searchtxt
|
||||
+ String.fromCharCode(170) + startdate + String.fromCharCode(170) + enddate
|
||||
+ String.fromCharCode(170) + MachineID + String.fromCharCode(170) + RentalID, function (data) {
|
||||
if (typeof (data) === "string") {
|
||||
showloading(false);
|
||||
showAlert(data, GetTextByKey("P_MR_ERROR", 'Error'));
|
||||
return;
|
||||
}
|
||||
showRentals(data);
|
||||
|
||||
showloading(false);
|
||||
}, function (err) {
|
||||
showloading(false);
|
||||
});
|
||||
}
|
||||
|
||||
function OnExport() {
|
||||
var cid = htmlencode($.trim($('#sel_contractor').val()));
|
||||
if (cid && cid != '')
|
||||
contractorid = cid;
|
||||
var searchtxt = "";
|
||||
searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
|
||||
var from = htmlencode($('#startdatetxt').val());
|
||||
var to = htmlencode($('#enddatetxt').val());
|
||||
|
||||
mid = listeditableSelectMachine.val();
|
||||
if (mid === undefined) mid = "";
|
||||
|
||||
var sortPath = grid_dt.sortKey;
|
||||
if (sortPath === undefined) sortPath = "";
|
||||
var desc = grid_dt.sortDirection !== 1;
|
||||
window.open("../ExportToFile.aspx?type=rentalchg&cid=" + contractorid + "&mid=" + mid + "&rid=" + RentalID
|
||||
+ "&from=" + from + "&to=" + to + "&t=" + searchtxt + "&sp=" + sortPath + "&desc=" + desc);
|
||||
}
|
||||
|
||||
function OnPrint() {
|
||||
var cid = htmlencode($.trim($('#sel_contractor').val()));
|
||||
if (cid && cid != '')
|
||||
contractorid = cid;
|
||||
var searchtxt = "";
|
||||
searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
|
||||
var from = htmlencode($('#startdatetxt').val());
|
||||
var to = htmlencode($('#enddatetxt').val());
|
||||
|
||||
mid = listeditableSelectMachine.val();
|
||||
if (mid === undefined) mid = "";
|
||||
|
||||
var sortPath = grid_dt.sortKey;
|
||||
if (sortPath === undefined) sortPath = "";
|
||||
var desc = grid_dt.sortDirection !== 1;
|
||||
window.open("PrintRentalChanges.aspx?cid=" + contractorid + "&mid=" + mid + "&rid=" + RentalID
|
||||
+ "&from=" + from + "&to=" + to + "&t=" + searchtxt + "&sp=" + sortPath + "&desc=" + desc);
|
||||
}
|
||||
|
||||
function showRentals(data) {
|
||||
var rows = [];
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var r = data[i];
|
||||
for (var j in r) {
|
||||
if (j === "LastUpdateDate")
|
||||
r[j] = { DisplayValue: r["LastUpdateDateStr"], Value: r[j] };
|
||||
else if (j === "RentalDate")
|
||||
r[j] = { DisplayValue: r["RentalDateStr"], Value: r[j] };
|
||||
else if (j === "ProjectReturnDate")
|
||||
r[j] = { DisplayValue: r["ProjectReturnDateStr"], Value: r[j] };
|
||||
else if (j === "ReturnDate")
|
||||
r[j] = { DisplayValue: r["ReturnDateStr"], Value: r[j] };
|
||||
}
|
||||
var fr = { Values: r };
|
||||
rows.push(fr);
|
||||
}
|
||||
|
||||
grid_dt.setData(rows);
|
||||
}
|
||||
|
||||
var grid_dt;
|
||||
function InitGridData() {
|
||||
$('#btnEdit').attr("disabled", "disabled");
|
||||
|
||||
grid_dt = new GridView('#rentallist');
|
||||
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: 'RentalID', caption: GetTextByKey("P_MR_RENTALID", "Rental ID"), valueIndex: 'RentalID', css: { 'width': 120, 'text-align': 'left' } },
|
||||
{ name: 'LastUpdateUserName', caption: GetTextByKey("P_MR_USERNAME", "User Name"), valueIndex: 'LastUpdateUserName', css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'LastUpdateDate', caption: GetTextByKey("P_MR_LASTUPDATEDATE", "Last Update Date"), valueIndex: 'LastUpdateDate', css: { 'width': 150, 'text-align': 'left' } },
|
||||
//{ name: 'OperateType', caption: "Operate Type", valueIndex: 'OperateType',allowFilter:true, css: { 'width': 120, 'text-align': 'left' } },
|
||||
{ name: 'VIN', caption: GetTextByKey("P_MR_VINSN", "VIN/SN"), valueIndex: 'VIN', css: { 'width': 180, 'text-align': 'left' } },
|
||||
{ name: 'DisplayName', caption: GetTextByKey("P_MR_ASSETNAME", "Asset Name"), valueIndex: 'DisplayName', css: { 'width': 180, 'text-align': 'left' } },
|
||||
{ name: 'Outside', caption: GetTextByKey("P_MR_OUTSIDEINTERNAL", "Outside/Internal"), valueIndex: 'Outside', allowFilter: true, css: { 'width': 180, 'text-align': 'left' } },
|
||||
{ name: 'Vendor', caption: GetTextByKey("P_MR_RENTALVENDOR", "Rental Vendor"), valueIndex: 'Vendor', css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'RentalRate', caption: GetTextByKey("P_MR_RENTALRATE", "Rental Rate"), valueIndex: 'RentalRate', css: { 'width': 150, 'text-align': 'right' } },
|
||||
{ name: 'Term', caption: GetTextByKey("P_MR_TERM", "Term"), valueIndex: 'Term', css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'TermUnit', caption: GetTextByKey("P_MR_TERMUNIT", "Term Unit"), valueIndex: 'TermUnit', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'RentalDate', caption: GetTextByKey("P_MR_RENTALDATEON", "Rental Date On"), valueIndex: 'RentalDate', css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'ProjectReturnDate', caption: GetTextByKey("P_MR_PROJECTRETURN", "Project Return"), valueIndex: 'ProjectReturnDate', css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'ReturnDate', caption: GetTextByKey("P_MR_RETURNDATE", "Return Date"), valueIndex: 'ReturnDate', css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'PONumber', caption: GetTextByKey("P_MR_PURCHASEORDERN", "Purchase Order #"), valueIndex: 'PONumber', css: { 'width': 150, 'text-align': 'left' } },
|
||||
{ name: 'InsuredValue', caption: GetTextByKey("P_MR_INSUREDVALUE", "Insured Value"), valueIndex: 'InsuredValue', css: { 'width': 150, 'text-align': 'right' } },
|
||||
{ name: 'Comments', caption: GetTextByKey("P_MR_COMMENTS", "Comments"), valueIndex: 'Comments', 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.canMultiSelect = false;
|
||||
grid_dt.columns = columns;
|
||||
grid_dt.init();
|
||||
|
||||
}
|
||||
|
||||
|
||||
$(function () {
|
||||
$("#content").applyFleetLanguageText();
|
||||
InitGridData();
|
||||
listeditableSelectMachine = new $editableselect($("#sel_machine"));
|
||||
|
||||
if (RentalID !== "") {
|
||||
$('#tr_search').css('display', 'none');
|
||||
}
|
||||
|
||||
//if (IsDealer == true) {
|
||||
// $('#span_contractor').css('display', '');
|
||||
// $('#span_contractor').parent().css('display', '');
|
||||
// if (IsAdmin)
|
||||
// getContractors();
|
||||
// else {
|
||||
// GetContractorsByUser();
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
// GetMachines();
|
||||
|
||||
//$("#sel_contractor").change(function () {
|
||||
// GetMachines();
|
||||
//});
|
||||
|
||||
OnRefresh();
|
||||
|
||||
$('#searchinputtxt').keydown(searchEnter);
|
||||
|
||||
$('#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 () {
|
||||
$("#rentallist").css("height", $(window).height() - $("#rentallist").offset().top - 4);
|
||||
grid_dt && grid_dt.resize();
|
||||
}).resize();
|
||||
|
||||
if (!canExport) {
|
||||
$('#spExport').hide();
|
||||
}
|
||||
});
|
||||
|
||||
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_MR_RENTALCHANGEHISTORY">Rental Change History</div>
|
||||
<table style="width: 100%; border-collapse: collapse; line-height: 32px; min-width: 1200px;">
|
||||
<tr id="tr_search">
|
||||
<td style="display: none; width: 260px;">
|
||||
<span id="span_contractor" style="padding-left: 5px; display: none; float: left;">
|
||||
<span data-lgid="P_MR_CONTRACTOR_COLON">Contractor:</span>
|
||||
<select style="width: 180px;" id="sel_contractor"></select>
|
||||
</span>
|
||||
</td>
|
||||
<td style="width: 60px; display: none;">
|
||||
<span style="padding-left: 5px;" data-lgid="P_MR_ASSET_COLON">Asset:</span>
|
||||
</td>
|
||||
<td style="width: 180px; display: none;">
|
||||
<div id="sel_machine" style="width: 182px; height: 22px; line-height: normal;"></div>
|
||||
</td>
|
||||
<td style="width: 360px;">
|
||||
<span style="padding-left: 5px;" data-lgid="P_MR_RENTALDATEFROM_COLON">Rental Date From:</span>
|
||||
<span>
|
||||
<input id="startdatetxt" type="text" style="width: 100px;" /></span>
|
||||
<span style="padding-left: 5px;" data-lgid="P_MR_TO_COLON">To</span>
|
||||
<span>
|
||||
<input id="enddatetxt" type="text" style="width: 100px;" /></span>
|
||||
</td>
|
||||
<td style="width: 320px;">
|
||||
<input id="searchinputtxt" type="text" autocomplete="off" style="width: 180px; margin-left: 10px;" />
|
||||
<input class="search" type="button" onclick="OnRefresh();" value="Search" data-lgid="P_MR_SEARCH" />
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6">
|
||||
<div class="function_title">
|
||||
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_MR_REFRESH">Refresh</span>
|
||||
<span class="sbutton iconprint" onclick="OnPrint();" style="display: none;" data-lgid="P_MR_PRINT">Print</span>
|
||||
<span id="spExport" class="sbutton iconexport" onclick="OnExport();" data-lgid="P_MR_EXPORTTOEXCEL">Export to Excel</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="clear"></div>
|
||||
<div id="rentallist"></div>
|
||||
</div>
|
||||
<div id="mask_bg" style="display: none;">
|
||||
<div class="loading c-spin"></div>
|
||||
</div>
|
||||
|
||||
</asp:Content>
|
Reference in New Issue
Block a user