562 lines
		
	
	
		
			24 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			562 lines
		
	
	
		
			24 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| <%@ Page Title="" Language="C#" MasterPageFile="~/MachineDeviceManagement/DeviceManagementBase.master" AutoEventWireup="true" CodeFile="ManageRentals.aspx.cs" Inherits="ManageRentals" %>
 | |
| 
 | |
| 
 | |
| <asp:Content ID="Content1" ContentPlaceHolderID="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 type="text/javascript">        
 | |
|         var IsDealer = <%=IsDealer ?"true":"false"%>;
 | |
|         var IsAdmin =<%=IsAdmin ?"true":"false"%>;
 | |
|         var contractorid = "<%=ContractorID %>";
 | |
|         var MachineID = "<%=MachineID %>";
 | |
| 
 | |
|         var machines;
 | |
| 
 | |
|         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);
 | |
|                     else
 | |
|                         $("#btnAdd").hide();
 | |
|                 }
 | |
|                 else
 | |
|                     $("#btnAdd").hide();
 | |
| 
 | |
|                 OnRefresh();
 | |
|             });
 | |
|         }
 | |
| 
 | |
|         //普通用户 获取可操作的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);
 | |
|                     else
 | |
|                         $("#btnAdd").hide();
 | |
|                 }
 | |
|                 else
 | |
|                     $("#btnAdd").hide();
 | |
|                 OnRefresh();
 | |
|             });
 | |
|         }
 | |
| 
 | |
|         function CloseDialog(type) {
 | |
|             $('#dialog_rental').hideDialog();
 | |
|             if (type == 1) {
 | |
|                 OnRefresh();
 | |
|             }
 | |
|             else {
 | |
|                 showmaskbg(false);
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         function ShowRentalDialog(type) {
 | |
|             //$('#dialog_rental .dialog-title span.title').text(type === "add" ? "Add Rental" : "Edit Rental");
 | |
|             showmaskbg(true);
 | |
|             $('#dialog_rental')
 | |
|                 .attr('act', type)
 | |
|                 .showDialogRight();
 | |
|         }
 | |
| 
 | |
|         function OnAdd() {
 | |
|             contractorid = htmlencode($.trim($('#sel_contractor').val()));
 | |
|             $('#iframerental').attr('src', 'AddRental.aspx?cid=' + contractorid);
 | |
| 
 | |
|             ShowRentalDialog("add");
 | |
|         }
 | |
| 
 | |
| 
 | |
|         var rentalID;
 | |
|         function OnEdit() {
 | |
|             var index = grid_dt.selectedIndex;
 | |
|             if (index < 0) {
 | |
|                 showAlert(GetTextByKey("P_MR_PLEASESELECTARENTAL", "Please select a Rental."), GetTextByKey("P_MR_EDITRENTAL", 'Edit Rental')); return;
 | |
|             }
 | |
|             var rental = grid_dt.source[index].Values;
 | |
|             if (!rental) {
 | |
|                 rentalID = undefined;
 | |
|                 return;
 | |
|             }
 | |
|             if (rental.Hide) {
 | |
|                 showAlert(GetTextByKey("P_MR_ASSETHIDDEN", "That asset has been hidden or is no longer available."), GetTextByKey("P_MR_EDITRENTAL", 'Edit Rental'));
 | |
|                 return;
 | |
|             }
 | |
|             rentalID = rental.RentalID;
 | |
|             contractorid = htmlencode($.trim($('#sel_contractor').val()));
 | |
|             $('#iframerental').attr('src', 'AddRental.aspx?cid=' + contractorid + "&rid=" + rentalID);
 | |
|             ShowRentalDialog("edit");
 | |
|         }
 | |
| 
 | |
|         function OnDblClick(e) {
 | |
|             OnEdit();
 | |
|         }
 | |
| 
 | |
|         function OnDelete(rental) {
 | |
|             if (!rental) {
 | |
|                 return;
 | |
|             }
 | |
| 
 | |
|             contractorid = htmlencode($.trim($('#sel_contractor').val()));
 | |
|             var alerttitle = GetTextByKey("P_MR_DELETERENTAL", 'Delete Rental');
 | |
|             showConfirm(GetTextByKey("P_MR_DOYOUWANTTODELETETHERENTALOCCURENCE", 'Do you want to delete the rental occurence?'), alerttitle, function () {
 | |
|                 devicerequest("DeleteRental", contractorid + String.fromCharCode(170) + rental.RentalID, function (data) {
 | |
|                     if (data !== 'OK')
 | |
|                         showAlert(data, alerttitle);
 | |
|                     else
 | |
|                         OnRefresh();
 | |
|                 }, function (err) {
 | |
|                     showAlert(GetTextByKey("P_MR_DELETERENTALFAILED", 'Failed to delete this rental occurence.'), alerttitle);
 | |
|                 });
 | |
|             });
 | |
|         }
 | |
| 
 | |
|         function OnRefresh() {
 | |
|             showloading(true);
 | |
| 
 | |
|             contractorid = htmlencode($.trim($('#sel_contractor').val()));
 | |
|             var searchtxt = "";
 | |
|             searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
 | |
|             var startdate = htmlencode($('#startdatetxt').val());
 | |
|             var enddate = htmlencode($('#enddatetxt').val());
 | |
| 
 | |
|             devicerequest("SearchRentals", contractorid + String.fromCharCode(170) + searchtxt
 | |
|                 + String.fromCharCode(170) + startdate + String.fromCharCode(170) + enddate
 | |
|                 + String.fromCharCode(170) + "", function (data) {
 | |
|                     $('#tbody_rentals').empty();
 | |
| 
 | |
|                     if (typeof (data) === "string") {
 | |
|                         showAlert(data, GetTextByKey("P_MR_ERROR", 'Error'));
 | |
|                         showloading(false);
 | |
|                         return;
 | |
|                     }
 | |
| 
 | |
|                     showRentals(data);
 | |
| 
 | |
|                     showloading(false);
 | |
|                 }, function (err) {
 | |
|                     showloading(false);
 | |
|                 });
 | |
|         }
 | |
| 
 | |
|         function getLangTermUnit(text) {
 | |
|             var langtext = text;
 | |
|             if (text === "Hourly")
 | |
|                 langtext = GetTextByKey("P_MR_HOURLY", "Hourly");
 | |
|             else if (text === "Daily")
 | |
|                 langtext = GetTextByKey("P_MR_DAILY", "Daily");
 | |
|             else if (text === "Weekly")
 | |
|                 langtext = GetTextByKey("P_MR_WEEKLY", "Weekly");
 | |
|             else if (text === "Monthly")
 | |
|                 langtext = GetTextByKey("P_MR_MONTHLY", "Monthly");
 | |
|             else if (text === "Annually")
 | |
|                 langtext = GetTextByKey("P_MR_ANNUALLY", "Annually");
 | |
|             return langtext;
 | |
|         }
 | |
| 
 | |
|         function getLangOutside(text) {
 | |
|             var langtext = text;
 | |
|             if (text === "Inside")
 | |
|                 langtext = GetTextByKey("P_MR_INSIDE", "Inside");
 | |
|             else if (text === "Outside")
 | |
|                 langtext = GetTextByKey("P_MR_OUTSIDE", "Outside");
 | |
|             return langtext;
 | |
|         }
 | |
| 
 | |
|         function showRentals(data) {
 | |
|             var rows = [];
 | |
|             for (var i = 0; i < data.length; i++) {
 | |
|                 var r = data[i];
 | |
|                 for (var j in r) {
 | |
|                     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] };
 | |
|                     else if (j === "TermUnit")
 | |
|                         r[j] = { DisplayValue: getLangTermUnit(r["TermUnit"]), Value: r[j] };
 | |
|                     else if (j === "Outside")
 | |
|                         r[j] = { DisplayValue: getLangOutside(r["Outside"]), 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: '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: 'AquisitionType', caption: GetTextByKey("P_MR_ACQUISITIONTYPE", "Acquisition Type"), valueIndex: 'AquisitionType', css: { 'width': 120, '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' } },
 | |
|                 { name: 'Edit', caption: "", css: { 'width': 30, 'text-align': 'center' } },
 | |
|                 { name: 'Delete', caption: "", css: { 'width': 30, 'text-align': 'center' } },
 | |
|                 { name: 'ViewChangeHistory', 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_MR_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.attrs = { 'title': GetTextByKey("P_MR_DELETE", 'Delete') };
 | |
|                 }
 | |
|                 else if (col.name === "ViewChangeHistory") {
 | |
|                     col.isurl = true;
 | |
|                     col.text = "\uf06e";
 | |
|                     col.events = {
 | |
|                         onclick: function () {
 | |
|                             OnViewChangeHistory(this);
 | |
|                         }
 | |
|                     };
 | |
|                     col.classFilter = function (e) {
 | |
|                         return "icon-col";
 | |
|                     };
 | |
|                     col.attrs = { 'title': GetTextByKey("P_MR_VIEWCHANGEHIS", 'View Change History') };
 | |
|                 }
 | |
|                 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) {
 | |
|                     rentalID = rowdata.Values.ID;
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         function OnExport() {
 | |
|             contractorid = htmlencode($.trim($('#sel_contractor').val()));
 | |
|             var searchtxt = "";
 | |
|             searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
 | |
|             var from = htmlencode($('#startdatetxt').val());
 | |
|             var to = htmlencode($('#enddatetxt').val());
 | |
| 
 | |
|             var mid = "";
 | |
| 
 | |
|             var sortPath = $("#tbRentals").data("sortPath");
 | |
|             if (sortPath === undefined) sortPath = "";
 | |
|             var desc = $("#tbRentals").data("desc");
 | |
|             if (desc === undefined) desc = false;
 | |
|             window.open("../ExportToFile.aspx?type=rentals&cid=" + contractorid + "&mid=" + mid
 | |
|                 + "&from=" + from + "&to=" + to + "&t=" + searchtxt + "&sp=" + sortPath + "&desc=" + desc);
 | |
|         }
 | |
| 
 | |
|         function OnPrint() {
 | |
|             contractorid = htmlencode($.trim($('#sel_contractor').val()));
 | |
|             var searchtxt = "";
 | |
|             searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
 | |
|             var from = htmlencode($('#startdatetxt').val());
 | |
|             var to = htmlencode($('#enddatetxt').val());
 | |
| 
 | |
|             var mid = "";
 | |
| 
 | |
|             var sortPath = $("#tbRentals").data("sortPath");
 | |
|             if (sortPath === undefined) sortPath = "";
 | |
|             var desc = $("#tbRentals").data("desc");
 | |
|             if (desc === undefined) desc = false;
 | |
|             window.open("PrintRentals.aspx?cid=" + contractorid + "&mid=" + mid + "&from=" + from + "&to=" + to
 | |
|                 + "&t=" + searchtxt + "&sp=" + sortPath + "&desc=" + desc);
 | |
|         }
 | |
| 
 | |
|         $(function () {
 | |
|             setPageTitle(GetTextByKey("P_MANAGERENTALS", "Manage Rentals"), true);
 | |
|             InitGridData();
 | |
| 
 | |
|             if (IsDealer == true) {
 | |
|                 $('#span_contractor').css('display', '');
 | |
|                 $('#span_contractor').parent().css('display', '');
 | |
|                 if (IsAdmin)
 | |
|                     getContractors();
 | |
|                 else {
 | |
|                     GetContractorsByUser();
 | |
|                 }
 | |
|             }
 | |
|             else
 | |
|                 OnRefresh();
 | |
| 
 | |
|             $("#sel_contractor").change(function () {
 | |
|                 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]);
 | |
|                 }
 | |
|             });
 | |
| 
 | |
|             $('#dialog_rentaldata').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]);
 | |
|                 }
 | |
|             });
 | |
| 
 | |
|             $('#dialog_projectreturndate').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]);
 | |
|                 }
 | |
|             });
 | |
|             $('#dialog_returndate').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();
 | |
|             }
 | |
|         }
 | |
| 
 | |
|         function OnViewChangeHistory(rental) {
 | |
|             if (!rental) {
 | |
|                 return;
 | |
|             }
 | |
|             var cid = "";
 | |
|             cid = htmlencode($.trim($('#sel_contractor').val()));
 | |
|             var machineID = "";
 | |
| 
 | |
|             window.open("RentalChangeHistory.aspx?cid=" + cid + "&mid=" + machineID + "&rid=" + rental.RentalID + "");
 | |
|         }
 | |
| 
 | |
|     </script>
 | |
| </asp:Content>
 | |
| <asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
 | |
|     <div id="recordcontent" style="padding: 0px; margin: 0px;">
 | |
|         <div class="page_title" data-lgid="P_MANAGERENTALS">Manage Rentals</div>
 | |
|         <table style="width: 100%; border-collapse: collapse; line-height: 32px; min-width: 1280px;">
 | |
|             <tr>
 | |
|                 <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="text-align: left;">
 | |
|                     <span style="padding-left: 5px;" data-lgid="P_MR_RENTALDATEFROM_COLON">Rental Date From: </span>
 | |
|                     <span>
 | |
|                         <input id="startdatetxt" style="width: 100px;" value="<%=BeginDate %>" /></span>
 | |
|                     <span style="padding-left: 5px;" data-lgid="P_MR_TO_COLON">To: </span>
 | |
|                     <span>
 | |
|                         <input id="enddatetxt" value="<%=EndDate %>" style="width: 100px;" /></span>
 | |
|                     <input id="searchinputtxt" autocomplete="off" style="width: 180px; margin-left: 10px;" />
 | |
|                     <input class="search" type="button" onclick="OnRefresh();" value="Search" data-lgid="P_MR_SEARCH" />
 | |
|                 </td>
 | |
|             </tr>
 | |
|             <tr>
 | |
|                 <td colspan="6">
 | |
|                     <div class="function_title">
 | |
|                         <span class="sbutton iconadd" id="btnAdd" onclick="OnAdd();" data-lgid="P_MR_ADD">Add</span>
 | |
|                         <span class="sbutton iconedit" onclick="OnEdit();" data-lgid="P_MR_EDIT">Edit</span>
 | |
|                         <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>
 | |
| 
 | |
| 
 | |
|     <div class="dialog" id="dialog_rental" style="display: none; height: 100%; border-bottom: 0; border-top: 0;">
 | |
|         <%--<div class="dialog-title"><span class="title">Add Work Order</span></div>--%>
 | |
|         <iframe id="iframerental" style="width: 100%; height: 100%; display: block; border: none;"></iframe>
 | |
|         <div class="maskbg" style="display: none;"></div>
 | |
|     </div>
 | |
| </asp:Content>
 |