This commit is contained in:
2024-03-26 15:56:31 +08:00
parent 634e8b71ab
commit 0855ae42cd
547 changed files with 94818 additions and 60463 deletions

View File

@ -12,37 +12,6 @@
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;
}
@ -59,9 +28,7 @@
}
</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"%>;
@ -76,7 +43,7 @@
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) {
@ -163,7 +130,7 @@
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;
var rental = grid_dt.source[index];
if (!rental) {
rentalID = undefined;
return;
@ -202,16 +169,27 @@
}
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());
var begindate = $('#startdatetxt').val();
var enddate = $('#enddatetxt').val();
if (begindate && !$('#startdatetxt').is(':valid')) {
showAlert(GetTextByKey('P_MR_THERENTALDATEFROMISINVALID', "The rental date from is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
if (enddate && !$('#enddatetxt').is(':valid')) {
showAlert(GetTextByKey('P_MR_THERENTALDATETOISINVALID', "The rental date to is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
if (begindate && enddate && begindate > enddate) {
showAlert(GetTextByKey("P_MR_RENTALDATETOMUSTBELATERTHANRENTALDATEFROM", "Rental date to must be later than rental date from."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
showloading(true);
devicerequest("SearchRentals", contractorid + String.fromCharCode(170) + searchtxt
+ String.fromCharCode(170) + startdate + String.fromCharCode(170) + enddate
+ String.fromCharCode(170) + begindate + String.fromCharCode(170) + enddate
+ String.fromCharCode(170) + "", function (data) {
$('#tbody_rentals').empty();
@ -259,18 +237,17 @@
var r = data[i];
for (var j in r) {
if (j === "RentalDate")
r[j] = { DisplayValue: r["RentalDateStr"], Value: r[j] };
r[j] = { DisplayValue: r["RentalDateStr"], Value: r[j] || "" };
else if (j === "ProjectReturnDate")
r[j] = { DisplayValue: r["ProjectReturnDateStr"], Value: r[j] };
r[j] = { DisplayValue: r["ProjectReturnDateStr"], Value: r[j] || "" };
else if (j === "ReturnDate")
r[j] = { DisplayValue: r["ReturnDateStr"], Value: r[j] };
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);
rows.push(r);
}
grid_dt.setData(rows);
@ -280,26 +257,21 @@
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")
};
grid_dt = createGridView('#rentallist');
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: 'VIN', caption: GetTextByKey("P_MR_VINSN", "VIN/SN"), valueIndex: 'VIN', allowFilter: true, css: { 'width': 180, 'text-align': 'left' } },
{ name: 'DisplayName', caption: GetTextByKey("P_MR_ASSETNAME", "Asset Name"), valueIndex: 'DisplayName', allowFilter: true, css: { 'width': 180, 'text-align': 'left' } },
{ name: 'AquisitionType', caption: GetTextByKey("P_MR_ACQUISITIONTYPE", "Acquisition Type"), valueIndex: 'AquisitionType', allowFilter: true, 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: 'Vendor', caption: GetTextByKey("P_MR_RENTALVENDOR", "Rental Vendor"), valueIndex: 'Vendor', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'RentalRate', caption: GetTextByKey("P_MR_RENTALRATE", "Rental Rate"), valueIndex: 'RentalRate', allowFilter: true, css: { 'width': 150, 'text-align': 'right' } },
{ name: 'Term', caption: GetTextByKey("P_MR_TERM", "Term"), valueIndex: 'Term', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'TermUnit', caption: GetTextByKey("P_MR_TERMUNIT", "Term Unit"), valueIndex: 'TermUnit', allowFilter: true, 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: 'PONumber', caption: GetTextByKey("P_MR_PURCHASEORDERN", "Purchase Order #"), valueIndex: 'PONumber', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'InsuredValue', caption: GetTextByKey("P_MR_INSUREDVALUE", "Insured Value"), valueIndex: 'InsuredValue', allowFilter: true, 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' } },
@ -318,8 +290,10 @@
col.key = list_columns[hd].valueIndex;
col.allowFilter = list_columns[hd].allowFilter;
if (col.name === "Edit") {
col.isurl = true;
col.text = "\uf044";
col.sortable = false;
col.resizable = false;
col.type = GridView.ColumnTypes.Icon;
col.text = "edit";
col.events = {
onclick: function () {
OnEdit();
@ -331,8 +305,10 @@
col.attrs = { 'title': GetTextByKey("P_MR_EDIT", 'Edit') };
}
else if (col.name === "Delete") {
col.isurl = true;
col.text = "\uf00d";
col.sortable = false;
col.resizable = false;
col.type = GridView.ColumnTypes.Icon;
col.text = "times";
col.events = {
onclick: function () {
OnDelete(this);
@ -344,8 +320,10 @@
col.attrs = { 'title': GetTextByKey("P_MR_DELETE", 'Delete') };
}
else if (col.name === "ViewChangeHistory") {
col.isurl = true;
col.text = "\uf06e";
col.sortable = false;
col.resizable = false;
col.type = GridView.ColumnTypes.Icon;
col.text = "eye";
col.events = {
onclick: function () {
OnViewChangeHistory(this);
@ -358,15 +336,15 @@
}
columns.push(col);
}
grid_dt.canMultiSelect = false;
grid_dt.multiSelect = false;
grid_dt.columns = columns;
grid_dt.init();
grid_dt.rowdblclick = OnEdit;
grid_dt.onRowDblClicked = OnEdit;
grid_dt.selectedrowchanged = function (rowindex) {
grid_dt.onSelectedRowChanged = function (rowindex) {
var rowdata = grid_dt.source[rowindex];
if (rowdata) {
rentalID = rowdata.Values.ID;
rentalID = rowdata.ID;
}
}
}
@ -375,9 +353,20 @@
contractorid = htmlencode($.trim($('#sel_contractor').val()));
var searchtxt = "";
searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
var from = htmlencode($('#startdatetxt').val());
var to = htmlencode($('#enddatetxt').val());
var begindate = $('#startdatetxt').val();
var enddate = $('#enddatetxt').val();
if (begindate && !$('#startdatetxt').is(':valid')) {
showAlert(GetTextByKey('P_MR_THERENTALDATEFROMISINVALID', "The rental date from is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
if (enddate && !$('#enddatetxt').is(':valid')) {
showAlert(GetTextByKey('P_MR_THERENTALDATETOISINVALID', "The rental date to is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
if (begindate && enddate && begindate > enddate) {
showAlert(GetTextByKey("P_MR_RENTALDATETOMUSTBELATERTHANRENTALDATEFROM", "Rental date to must be later than rental date from."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
var mid = "";
var sortPath = $("#tbRentals").data("sortPath");
@ -385,23 +374,34 @@
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);
+ "&from=" + htmlencode(begindate) + "&to=" + htmlencode(enddate) + "&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 begindate = $('#startdatetxt').val();
var enddate = $('#enddatetxt').val();
if (begindate && !$('#startdatetxt').is(':valid')) {
showAlert(GetTextByKey('P_MR_THERENTALDATEFROMISINVALID', "The rental date from is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
if (enddate && !$('#enddatetxt').is(':valid')) {
showAlert(GetTextByKey('P_MR_THERENTALDATETOISINVALID', "The rental date to is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
if (begindate && enddate && begindate > enddate) {
showAlert(GetTextByKey("P_MR_RENTALDATETOMUSTBELATERTHANRENTALDATEFROM", "Rental date to must be later than rental date from."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
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
window.open("PrintRentals.aspx?cid=" + contractorid + "&mid=" + mid + "&from=" + htmlencode(begindate) + "&to=" + htmlencode(enddate)
+ "&t=" + searchtxt + "&sp=" + sortPath + "&desc=" + desc);
}
@ -427,55 +427,6 @@
$('#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();
@ -521,15 +472,13 @@
<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;">
<td style="text-align: left;" class="search_bar">
<span style="padding-left: 5px;" data-lgid="P_MR_RENTALDATEFROM_COLON">Rental Date From:&nbsp;</span>
<span>
<input id="startdatetxt" style="width: 100px;" value="<%=BeginDate %>" /></span>
<input id="startdatetxt" type="date" class="type-date" required min="1900-01-01" style="width: 100px; margin-left: 5px" value="<%=BeginDate %>" />
<span style="padding-left: 5px;" data-lgid="P_MR_TO_COLON">To:&nbsp;</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" />
<input id="enddatetxt" type="date" class="type-date" required min="1900-01-01" value="<%=EndDate %>" style="width: 100px;; margin-left: 5px" />
<input id="searchinputtxt" type="text" autocomplete="off" style="width: 180px; margin-left: 10px;" />
<input class="search" type="button" onclick="OnRefresh();" value="Search" style="margin-left: 5px" data-lgid="P_MR_SEARCH" />
</td>
</tr>
<tr>