2023-04-28 12:22:26 +08:00

125 lines
6.1 KiB
Plaintext

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PrintRentals.aspx.cs" Inherits="PrintRentals" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link rel="stylesheet" href="<%=GetFileUrlWithVersion("../css/default.css")%>" type="text/css" />
<link rel="stylesheet" href="<%=GetFileUrlWithVersion("../css/split_sub.css")%>" type="text/css" />
<script src="<%=GetFileUrlWithVersion("../js/jquery-3.6.0.min.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../js/utility.js")%>" type="text/javascript"></script>
<script type="text/javascript">
var contractorid = "<%=CompanyID %>";
var machineID = "<%=MachineID %>";
var startdate = "<%=FromDate %>";
var enddate = "<%=ToDate %>";
var searchtxt = "<%=SearchText %>";
var sortpath = "<%=SortPath %>";
var desc = <%=DESC %>;
var rentalsdata = [];
function devicerequest(method, param, callback, error) {
_network.request("MachineDeviceManagement/ManageRentals.aspx", -1, method, param, callback, error || function (e) {
console.log(e);
showAlert('An unknown error occurred. Please refresh page.', 'Query');
});
}
function getRentals() {
devicerequest("SearchRentals", contractorid + String.fromCharCode(170) + searchtxt
+ String.fromCharCode(170) + startdate + String.fromCharCode(170) + enddate
+ String.fromCharCode(170) + machineID, function (data) {
$('#tbody_rentals').empty();
if (typeof (data) === "string") {
showAlert(data, 'Error');
return;
}
if (data && data.length > 0)
rentalsdata = data;
else
rentalsdata = [];
rentalsdata = rentalsdata.sort(dataSort(sortpath, desc));
showRentals(rentalsdata);
window.print();
}, function (err) {
});
}
function showRentals(data) {
var trs = [];
for (var i = 0; i < data.length; i++) {
var rental = data[i];
var tr = $('<tr></tr>').data('rental', rental);
tr.append($('<td style="width: 180px;"></td>').attr('title', rental.VIN).html(replaceHtmlText(rental.VIN)));
tr.append($('<td style="width: 180px;"></td>').attr('title', rental.DisplayName).html(replaceHtmlText(rental.DisplayName)));
tr.append($('<td style="width: 180px;"></td>').html(replaceHtmlText(rental.Outside)));
tr.append($('<td style="width: 150px;"></td>').html(replaceHtmlText(rental.Vendor)));
tr.append($('<td style="width: 150px;"></td>').text(rental.RentalRate));
tr.append($('<td style="width: 150px;"></td>').text(rental.Term));
tr.append($('<td style="width: 150px;"></td>').text(rental.TermUnit));
tr.append($('<td style="width: 150px;>"></td>').text(rental.RentalDateStr));
tr.append($('<td style="width: 150px;"></td>').text(rental.ProjectReturnDateStr));
tr.append($('<td style="width: 150px;"></td>').text(rental.ReturnDateStr));
tr.append($('<td style="width: 150px;"></td>').html(replaceHtmlText(rental.PONumber)));
tr.append($('<td style="width: 200px;"></td>').attr('title', rental.Comments).html(replaceHtmlText(rental.Comments)));
trs.push(tr);
}
$('#tbody_rentals').append(trs);
}
$(function () {
$('#tbody_rentals').click(function (e) {
var target = $(e.target);
if (!target.is('tr')) {
target = target.parents('tr');
}
$('#tbody_rentals tr').removeClass('selected');
target.addClass('selected');
});
getRentals();
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="recordcontent" style="padding: 0px; margin: 0px;">
<div class="content_main" id="rentalListDiv" style="border-top: 1px solid #5c5c5c; padding: 0px; min-width: 1160px;">
<div id="machinesDiv" class="content_main" style="padding: 0px;">
<table class="main_table" id="tbRentals" style="min-width: 200px; border-top: none; width: 1500px; table-layout: fixed;">
<thead>
<tr style="border-width: 0px;">
<th style="width: 180px;" sort="VIN">VIN/SN</th>
<th style="width: 180px;" sort="DisplayName">Machine Name</th>
<th style="width: 180px;" sort="Outside">Outside/Internal</th>
<th style="width: 150px;" sort="Vendor">Rental Vendor</th>
<th style="width: 150px;" sort="RentalRate">Rental Rate</th>
<th style="width: 150px;" sort="Term">Term</th>
<th style="width: 150px;" sort="TermUnit">Term</th>
<th style="width: 150px;" sort="RentalDate">Rental Date On</th>
<th style="width: 150px;" sort="ProjectReturnDate">Project Return Date</th>
<th style="width: 150px;" sort="ReturnDate">Return Date</th>
<th style="width: 150px;" sort="PONumber">Purchase Order #</th>
<th style="width: 200px;" sort="Comments">Comments</th>
</tr>
</thead>
<tbody id="tbody_rentals">
</tbody>
</table>
</div>
</div>
</div>
</div>
</form>
</body>
</html>