fleet-contractor/Site/Maintenance/WorkOrderHistory.aspx
2023-04-28 12:22:26 +08:00

563 lines
21 KiB
Plaintext

<%@ Page Title="" Language="C#" MasterPageFile="~/Maintenance/MaintenanceBase.master" AutoEventWireup="true" CodeFile="WorkOrderHistory.aspx.cs" Inherits="WorkOrderHistory" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<link href="../css/jquery.datetimepicker.css" rel="stylesheet" />
<style type="text/css">
.no_wrap th {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.max160 {
max-width: 160px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.dialog-content table {
border-collapse: collapse;
width: 100%;
line-height: 32px;
}
.dialog-content table td.label {
width: 130px;
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: 250px;
height: 18px;
padding: 1px;
}
#dialog_machines .dialog-content table td input {
width: auto;
}
.dialog-content table td textarea {
margin-top: 6px;
}
.dialog-content table td select {
width: 254px;
height: 24px;
}
.dialog-content table td input[type="checkbox"] {
border: none;
}
.dialog-content table td textarea {
height: 150px;
width: 420px;
max-width: 500px;
}
.ctl_button {
font-family: 'CalciteWebCoreIcons';
display: block;
margin: 6px auto;
width: 60px;
height: 22px;
line-height: 21px;
padding: 0;
}
#dialog_machinegroup {
z-index: 500;
width: 870px;
top: 60px;
left: 150px;
}
.inputbox {
width: 500px;
padding: 1px;
}
.group_table .main_table {
table-layout: fixed;
}
.group_table .main_table thead tr {
display: block;
}
.group_table .main_table tbody {
height: 280px;
display: block;
overflow-y: auto;
}
.group_table .main_table th {
width: 165px;
}
.group_table .main_table td {
width: 165px;
white-space: nowrap;
word-break: keep-all;
}
.group_table .main_table td div {
width: 165px;
overflow: hidden;
white-space: nowrap;
word-break: keep-all;
text-overflow: ellipsis;
}
.td_controller {
vertical-align: middle;
padding: 40px 8px;
/*border-left: 1px solid #b0b0b0;
border-right: 1px solid #b0b0b0;*/
}
.ctl_button {
font-family: 'CalciteWebCoreIcons';
display: block;
margin: 6px auto;
width: 60px;
height: 22px;
line-height: 21px;
padding: 0;
}
#tbwoh {
width: 100%;
line-height: 30px;
border-collapse: collapse;
border-spacing: 0;
}
#tbwoh th {
border: 1px solid #bababa;
background-color: #d8dce1;
text-align: left;
border-right: 1px solid #bababa;
font-weight: bold;
position: relative;
padding-left: 5px;
}
#tbwoh tr {
border-bottom: 1px solid #cacaca;
}
#tbwoh td {
border-right: 1px solid #cacaca;
padding-left: 5px;
}
</style>
<script src="<%=GetFileUrlWithVersion("../js/jquery.datetimepicker.full.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("../js/editableselect.js")%>"></script>
<script src="<%=GetFileUrlWithVersion("js/controls.js")%>" type="text/javascript"></script>
<script type="text/javascript">
woquery = function (method, param, callback, error) {
_network.request("Maintenance/WorkOrderHistory.aspx", -1, method, param, callback, error);
}
function CloseDialog(type) {
$('#dialog_user').hideDialog();
OnRefresh();
}
function OnRefresh() {
var woid = $('#div_wonumber').dropdownVal();
if (!woid) {
return;
}
showloading(true);
var beginDate = $('#startdatetxt').val();
var endDate = $('#enddatetxt').val();
var searchtxt = "";
searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
woquery('GetWorkOrderHistorys', JSON.stringify([woid, beginDate, endDate, searchtxt]), function (data) {
showloading(false);
if (typeof (data) === "string") {
showAlert(data, GetTextByKey('P_WORKORDER', "Work Order"));
return;
}
showWorkOrderList(data);
}, function (err) {
showloading(false);
});
}
function showWorkOrderList(data) {
var wohlist = $("#wohlist").empty();
//var logid = -1;
var datetime = "";
var ftr = null;
var count = 0;
for (var i = 0; i < data.length; i++) {
var r = data[i];
var type = "";
var status = "";
var category = "";
if (r.UpdateType == 0)
type = GetTextByKey('P_WO_XXX', 'Manually');
else if (r.UpdateType == 1)
type = GetTextByKey('P_WO_XXX', 'Automatically');
else if (r.UpdateType == 2)
type = GetTextByKey('P_WO_XXX', 'System');
if (r.UpdateStatus == 0)
status = GetTextByKey('P_WO_XXX', 'Created');
else if (r.UpdateStatus == 1 || r.UpdateStatus == 4 || r.UpdateStatus == 9999)
status = GetTextByKey('P_WO_XXX', 'Modified');
else if (r.UpdateStatus == 2)
status = GetTextByKey('P_WO_XXX', 'Closed');
else if (r.UpdateStatus == 3)
status = GetTextByKey('P_WO_XXX', 'Re_Opened');
//else if (r.UpdateStatus == 4)
// status = GetTextByKey('P_WO_XXX', 'Restored');
//else if (r.UpdateStatus == 9999)
// status = GetTextByKey('P_WO_XXX', 'Deleted');
switch (r.Category) {
case 0:
category = GetTextByKey('P_WO_XXX', 'Work Order Status');
break;
case 1:
category = GetTextByKey('P_WO_XXX', 'Assigned To');
break;
case 2:
category = GetTextByKey('P_WO_XXX', 'Advisor');
break;
case 3:
category = GetTextByKey('P_WO_XXX', 'Work Order Type');
break;
case 4:
category = GetTextByKey('P_WO_XXX', 'Location');
break;
case 5:
category = GetTextByKey('P_WO_XXX', 'Department');
break;
case 6:
category = GetTextByKey('P_WO_XXX', 'Alternate Status');
break;
case 7:
category = GetTextByKey('P_WO_XXX', 'Description');
break;
case 8:
category = GetTextByKey('P_WO_XXX', 'Invoice Number');
break;
case 9:
category = GetTextByKey('P_WO_XXX', 'Internal ID');
break;
case 10:
category = GetTextByKey('P_WO_XXX', 'Complete Date');
break;
case 11:
category = GetTextByKey('P_WO_XXX', 'Next Follow Up Date');
break;
case 12:
category = GetTextByKey('P_WO_XXX', 'Due Date');
break;
case 13:
category = GetTextByKey('P_WO_XXX', 'Parts Expected Date');
break;
case 14:
category = GetTextByKey('P_WO_XXX', 'Last Labor Date');
break;
case 15:
category = GetTextByKey('P_WO_XXX', 'Total Cost');
break;
case 16:
category = GetTextByKey('P_WO_XXX', 'Expected Cost');
break;
case 17:
category = GetTextByKey('P_WO_XXX', 'Parts Cost');
break;
case 18:
category = GetTextByKey('P_WO_XXX', 'Travel Time Cost');
break;
case 19:
category = GetTextByKey('P_WO_XXX', 'Labor Cost');
break;
case 20:
category = GetTextByKey('P_WO_XXX', 'Other Cost');
break;
case 21:
category = GetTextByKey('P_WO_XXX', 'Estimate');
break;
case 22:
category = GetTextByKey('P_WO_XXX', 'Inspection');
break;
case 23:
category = GetTextByKey('P_WO_XXX', 'Invoice');
break;
case 24:
category = GetTextByKey('P_WO_XXX', 'Segment User');
break;
case 25:
category = GetTextByKey('P_WO_XXX', 'Segment Hours');
break;
case 26:
category = GetTextByKey('P_WO_XXX', 'Segment Jobsite');
break;
case 27:
category = GetTextByKey('P_WO_XXX', 'Segment Cost');
break;
case 28:
category = GetTextByKey('P_WO_XXX', 'Segment Component');
break;
case 29:
category = GetTextByKey('P_WO_XXX', 'Segment Completed');
break;
case 30:
category = GetTextByKey('P_WO_XXX', 'Segment Completed Date');
break;
case 31:
category = GetTextByKey('P_WO_XXX', 'Segment Description');
break;
case 32:
category = GetTextByKey('P_WO_XXX', 'Segment Notes');
break;
case 33:
category = GetTextByKey('P_WO_XXX', 'Segment');
break;
case 34:
category = GetTextByKey('P_WO_XXX', 'Alerts');
break;
case 35:
category = GetTextByKey('P_WO_XXX', 'Segment Type');
break;
case 36:
category = GetTextByKey('P_WO_XXX', 'Segment Billable');
break;
case 37:
category = GetTextByKey('P_WO_XXX', 'Component');
break;
case 38:
category = GetTextByKey('P_WO_XXX', 'Billable');
break;
case 39:
category = GetTextByKey('P_WO_XXX', 'Bill to job');
break;
case 40:
category = GetTextByKey('P_WO_XXX', 'Work Order Attachment');
break;
case 41:
category = GetTextByKey('P_WO_XXX', 'Estimate Attachment');
break;
case 42:
category = GetTextByKey('P_WO_XXX', 'Invoice Attachment');
break;
case 43:
category = GetTextByKey('P_WO_XXX', 'Company Name');
break;
case 44:
category = GetTextByKey('P_WO_XXX', 'Asset');
break;
case 45:
category = GetTextByKey('P_WO_XXX', 'Parts Order Number');
break;
case 46:
category = GetTextByKey('P_WO_XXX', 'Parts Status');
break;
case 47:
category = GetTextByKey('P_WO_XXX', 'Salesperson');
break;
case 48:
category = GetTextByKey('P_WO_XXX', 'Inspection Template');
break;
case 97:
category = GetTextByKey('P_WO_XXX', 'Deleted');
break;
case 98:
category = GetTextByKey('P_WO_XXX', 'Restored');
break;
case 99:
category = GetTextByKey('P_WO_XXX', 'WO Life Cycle');
break;
default:
category = GetTextByKey('P_WO_XXX', 'Other');
break;
}
var tr = $("<tr></tr>");
//if (logid != r.Id) {
if (datetime !== r.DateTimeStr) {
if (ftr && count > 1)
ftr.children().eq(0).attr("rowspan", count);
count = 0;
ftr = tr;
tr.append($("<td></td>").text(r.DateTimeStr));
}
tr.append($("<td></td>").text(status));
tr.append($("<td></td>").text(type));
tr.append($("<td></td>").text(r.UpdateBy));
tr.append($("<td></td>").text(category));
tr.append($("<td></td>").text(r.Detail));
var td_del = $("<td></td>");
tr.append(td_del);
if (r.UpdateStatus == 9999 && r.CanDeleteAndRestore) {
var span_del = $('<a href="#" data-lgid="P_UM_XXXX">Restore</a>').data('wo', r).click(ManageDeleteAndRestore);
td_del.append(span_del);
}
if (i % 2 == 1)
tr.css("background-color", "#f1f4f8");
wohlist.append(tr);
//logid = r.Id;
datetime = r.DateTimeStr;
count++;
}
if (ftr && count > 1)
ftr.children().eq(0).attr("rowspan", count);
}
function ManageDeleteAndRestore() {
var wo = $(this).data('wo');
if (!wo)
return;
var alerttitle = GetTextByKey('P_WORKORDER', "Work Order");
showConfirm(GetTextByKey("P_WO_XXX", 'Are you sure you want to restore this work order?'), alerttitle, function () {
woquery("RestoreDeleteWorkOrder", wo.WorkOrderId, function (data) {
if (data == "OK")
OnRefresh();
}, function (err) {
showAlert(GetTextByKey("P_WO_XXX", 'Failed to restore this work order.'), alerttitle);
});
});
}
function GetWorkOrderNumbers() {
woquery('GetWorkOrderNumbers', '', function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
$('#div_wonumber').dropdownSource(data);
});
}
$(function () {
setPageTitle(GetTextByKey("P_WORKORDERHISTORY", "Work Order History"), true);
$('#div_wonumber').dropdown([], {
search: true,
valueKey: 'Key',
textKey: 'Value'
});
GetWorkOrderNumbers();
OnRefresh();
$('#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(searchEnter);
$(window).resize(function () {
$("#divwoh").css("height", $(window).height() - $("#divwoh").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 OnExport() {
var woid = $('#div_wonumber').dropdownVal();
if (!woid) {
return;
}
var from = $('#startdatetxt').val();
var to = $('#enddatetxt').val();
var searchtxt = "";
window.open("../ExportToFile.aspx?type=wohis&t=" + searchtxt + "&from=" + from + "&to=" + to + "&woid=" + woid);
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div style="min-width: 400px;">
<div class="page_title" data-lgid="P_XXX">Work Order History</div>
<div class="search_bar">
<input type="password" autocomplete="new-password" style="display: none" />
<span data-lgid="P_XXX">Work Order Number:</span>
<div class="dropdown" id="div_wonumber" style="width: 200px"></div>
<span style="margin-left: 5px;" data-lgid="P_FR_BEGINDATE_COLON">Begin Date:&nbsp;</span>
<div>
<input id="startdatetxt" type="text" style="width: 80px; margin-left: 5px;" value="<%=BeginDate %>" autocomplete="off" />
</div>
<span style="margin-left: 5px;" data-lgid="P_FR_ENDDATE_COLON">End Date:&nbsp;</span>
<div>
<input id="enddatetxt" type="text" style="width: 80px; margin-left: 5px;" value="<%=EndDate %>" autocomplete="off" />
</div>
<div style="display: none;">
<input id="searchinputtxt" autocomplete="off" style="width: 100px; margin-left: 5px;" />
</div>
<input class="search" type="button" onclick="OnRefresh();" style="margin-left: 10px;" value="Search" data-lgid="P_FR_SEARCH" />
</div>
<div class="function_title">
<span class="sbutton iconrefresh" onclick="OnRefresh();" data-lgid="P_UM_REFRESH">Refresh</span>
<span id="spExport" class="sbutton iconexport" onclick="OnExport();" data-lgid="P_MR_EXPORTTOEXCEL">Export to Excel</span>
</div>
<div class="clear"></div>
<div id="divwoh" style="overflow: auto;">
<table id="tbwoh" style="min-width: 1250px; table-layout: fixed;">
<thead>
<tr>
<th style="width: 150px;" data-lgid="P_XXX">Date/Time Stamp</th>
<th style="width: 80px;" data-lgid="P_XXX">Update</th>
<th style="width: 120px;" data-lgid="P_XXX">Update Type</th>
<th style="width: 200px;" data-lgid="P_XXX">By</th>
<th style="width: 200px;" data-lgid="P_XXX">Category</th>
<th style="width: 400px;" data-lgid="P_XXX">Detail</th>
<th></th>
</tr>
</thead>
<tbody id="wohlist" style="border: 1px solid #cacaca; overflow: hidden; text-overflow: ellipsis;">
</tbody>
</table>
</div>
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
</div>
</asp:Content>