292 lines
14 KiB
Plaintext
292 lines
14 KiB
Plaintext
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManHoursPlanEditNew.aspx.cs" Inherits="FineUIPro.Web.ManHours.ManHoursPlanEditNew" %>
|
||
|
||
<!DOCTYPE html>
|
||
|
||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
<head runat="server">
|
||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
<title></title>
|
||
<style type="text/css">
|
||
.totalRed {
|
||
color: red;
|
||
}
|
||
</style>
|
||
|
||
</head>
|
||
<body>
|
||
<form id="form1" runat="server">
|
||
<f:PageManager ID="PageManager1" runat="server" AutoSizePanelID="Panel1" />
|
||
<f:Panel ID="Panel1" CssClass="blockpanel" Margin="20px" runat="server" ShowBorder="false" ShowHeader="false" Layout="Region">
|
||
<Items>
|
||
<f:Grid ID="Grid1" CssClass="blockpanel" runat="server" EnableCheckBoxSelect="false" ShowBorder="true"
|
||
EnableCollapse="true" BoxFlex="1" DataIDField="ManHoursPlanId" DataKeyNames="ManHoursPlanId" AllowCellEditing="true" EnableColumnLines="true"
|
||
Title="Planned" ShowHeader="false" AllowColumnLocking="true" ClicksToEdit="1" EnableSummary="true" SummaryPosition="Top">
|
||
<Columns>
|
||
<f:RenderField Width="80px" ColumnID="JobNo" DataField="ProjectControl_JobNo" HeaderText="Job No" Locked="true">
|
||
</f:RenderField>
|
||
<f:RenderField Width="400px" ColumnID="JobTitle" DataField="ProjectControl_JobTitle" HeaderText="Job Title" Locked="true">
|
||
</f:RenderField>
|
||
<f:RenderField Width="90px" ColumnID="JobStatus" DataField="ProjectControl_JobStatus" HeaderText="Job Status">
|
||
</f:RenderField>
|
||
<f:RenderField Width="80px" ColumnID="JobType" DataField="ProjectControl_JobType" HeaderText="Job Type">
|
||
</f:RenderField>
|
||
<f:RenderField Width="150px" ColumnID="Discipline" DataField="Discipline" HeaderText="Discipline">
|
||
</f:RenderField>
|
||
<f:RenderField Width="70px" ColumnID="Priority" DataField="PM_General_Priority" HeaderText="Priority">
|
||
</f:RenderField>
|
||
<f:RenderField Width="190px" ColumnID="Roles" DataField="Roles" HeaderText="Role">
|
||
</f:RenderField>
|
||
<f:RenderField Width="140px" ColumnID="Account" DataField="ProjectControl_Account" HeaderText="Account">
|
||
</f:RenderField>
|
||
|
||
<f:RenderField Width="120px" ColumnID="ReceivedDate" DataField="ReceivedDate" HeaderText="Received Date">
|
||
</f:RenderField>
|
||
<f:RenderField Width="120px" ColumnID="ApprovalDatePlan" DataField="ApprovalDatePlan" HeaderText="Approval Date Plan">
|
||
</f:RenderField>
|
||
<f:RenderField Width="120px" ColumnID="ApprovalDateActual" DataField="ApprovalDateActual" HeaderText="Approval Date Actual">
|
||
</f:RenderField>
|
||
<f:RenderField Width="120px" ColumnID="Civil_RevisedEnd" DataField="Civil_RevisedEnd" HeaderText="Detail Eng.-Civil End">
|
||
</f:RenderField>
|
||
<f:RenderField Width="120px" ColumnID="EI_RevisedEnd" DataField="EI_RevisedEnd" HeaderText="Detail Eng.-Mech,E&I End">
|
||
</f:RenderField>
|
||
<f:RenderField Width="120px" ColumnID="LLE_RevisedEnd" DataField="LLE_RevisedEnd" HeaderText="LLE Procument End">
|
||
</f:RenderField>
|
||
<f:RenderField Width="120px" ColumnID="Const_Civil_RevisedEnd" DataField="Const_Civil_RevisedEnd" HeaderText="Const.-Civil End">
|
||
</f:RenderField>
|
||
<f:RenderField Width="120px" ColumnID="Const_EI_RevisedEnd" DataField="Const_EI_RevisedEnd" HeaderText="Const.-Mech,E&I End">
|
||
</f:RenderField>
|
||
|
||
<f:RenderField Width="70px" ColumnID="ManHours" DataField="ManHours" HeaderText="Manhour<br/>Plan">
|
||
</f:RenderField>
|
||
<f:RenderField Width="70px" ColumnID="ManHoursActual" DataField="ManHoursActual" HeaderText="Manhour<br/>Actual">
|
||
</f:RenderField>
|
||
<f:RenderField Width="70px" ColumnID="ManhourActualForecast" DataField="ManhourActualForecast" HeaderText="Manhour<br/>Actual+<br/>Forecast">
|
||
</f:RenderField>
|
||
<f:RenderField Width="80px" ColumnID="Realization" DataField="Realization" HeaderText="Realization(%)">
|
||
</f:RenderField>
|
||
<f:RenderField ColumnID="ManHoursPlanId" DataField="ManHoursPlanId" Hidden="true">
|
||
</f:RenderField>
|
||
</Columns>
|
||
<Listeners>
|
||
<f:Listener Event="afteredit" Handler="onGridAfterEdit" />
|
||
</Listeners>
|
||
</f:Grid>
|
||
</Items>
|
||
<Toolbars>
|
||
<f:Toolbar ID="Toolbar2" Position="Bottom" ToolbarAlign="Right" runat="server">
|
||
<Items>
|
||
<f:HiddenField ID="hidCurMonthManHour" runat="server"></f:HiddenField>
|
||
|
||
<f:Button ID="btnSave" Icon="SystemSave" runat="server" Text="Save" ToolTip="Save" ValidateForms="SimpleForm1"
|
||
OnClick="btnSave_Click" Hidden="true">
|
||
</f:Button>
|
||
<f:Button ID="btnClose" EnablePostBack="false" Text="Close" ToolTip="Close" runat="server" Icon="SystemClose">
|
||
</f:Button>
|
||
</Items>
|
||
</f:Toolbar>
|
||
</Toolbars>
|
||
</f:Panel>
|
||
</form>
|
||
<script>
|
||
var grid1ClientID = '<%= Grid1.ClientID %>';
|
||
var hidCurMonthManHourClientID = '<%= hidCurMonthManHour.ClientID %>';
|
||
|
||
// 渲染合计列
|
||
//function renderHeji(value, params) {
|
||
// var actualForecast = calculateHejiValue(params.rowValue).toString();
|
||
// //ManhourActualForecast列合计
|
||
// this.updateCellValue(params.rowId, 'ManhourActualForecast', actualForecast);
|
||
//}
|
||
function onGridAfterEdit(event, value, params) {
|
||
var myDate = new Date();
|
||
var month = "";
|
||
var year = parseInt(myDate.getFullYear());
|
||
var day = parseInt(myDate.getDate());
|
||
if (day >= 26) {
|
||
month = parseInt(myDate.getMonth());
|
||
}
|
||
else {
|
||
month = parseInt(myDate.getMonth()) - 1;
|
||
}
|
||
|
||
for (var i = 0; i < 12; i++) {
|
||
year = month + 1 > 12 ? year + 1 : year;
|
||
month = month + 1 > 12 ? 1 : month + 1;
|
||
var m = month < 10 ? "0" + month : month;
|
||
if (params.columnId === year.toString() + "-" + m.toString()) {
|
||
updateSummary(params.columnId);
|
||
}
|
||
}
|
||
|
||
//var m = month < 10 ? "0" + month : month;
|
||
////头部合计
|
||
//if (params.columnId === year.toString() + "-" + m.toString()) {
|
||
// updateSummary(params.columnId);
|
||
//}
|
||
var actualForecast = calculateHejiValue(params.rowValue).toString();
|
||
//ManhourActualForecast列合计
|
||
this.updateCellValue(params.rowId, 'ManhourActualForecast', actualForecast);
|
||
|
||
var manHours = this.getCellValue(params.rowId, 'ManHours');
|
||
var rate = (actualForecast / manHours).toFixed(1)
|
||
this.updateCellValue(params.rowId, 'Realization', rate);
|
||
if (rate > 1) {
|
||
this.updateCellValue(params.rowId, 'Realization.cls', 'highlight');
|
||
}
|
||
else {
|
||
this.updateCellValue(params.rowId, 'Realization.cls', '');
|
||
}
|
||
}
|
||
|
||
function calculateHejiValue(rowValue) {
|
||
var total = 0;
|
||
function addColumnValue(columnName) {
|
||
var columnValue = rowValue[columnName];
|
||
if (typeof (columnValue) === 'number') {
|
||
total += columnValue;
|
||
}
|
||
}
|
||
var myDate = new Date();
|
||
var month = "";
|
||
var year = parseInt(myDate.getFullYear());
|
||
var day = parseInt(myDate.getDate());
|
||
if (day >= 26) {
|
||
month = parseInt(myDate.getMonth());
|
||
}
|
||
else {
|
||
month = parseInt(myDate.getMonth()) - 1;
|
||
}
|
||
|
||
for (var i = 0; i < 12; i++) {
|
||
year = month + 1 > 12 ? year + 1 : year;
|
||
month = month + 1 > 12 ? 1 : month + 1;
|
||
var m = month < 10 ? "0" + month : month;
|
||
if (i > 0) {
|
||
addColumnValue(year.toString() + "-" + m.toString());
|
||
}
|
||
}
|
||
return total + parseFloat(rowValue["ManHoursActual"]);
|
||
}
|
||
//合计
|
||
function updateSummary(obj) {
|
||
var myDate = new Date();
|
||
var year = parseInt(myDate.getFullYear());
|
||
//var month = parseInt(myDate.getMonth());
|
||
var allhh = F(hidCurMonthManHourClientID).value.split('|');
|
||
var hh = 0;
|
||
if (obj.substring(0, 4) == year && allhh.length > 0) {
|
||
if (obj.substring(5, 7) == "01") {
|
||
hh = parseFloat(allhh[0])
|
||
}
|
||
if (obj.substring(5, 7) == "02") {
|
||
hh = parseFloat(allhh[1])
|
||
}
|
||
if (obj.substring(5, 7) == "03") {
|
||
hh = parseFloat(allhh[2])
|
||
}
|
||
if (obj.substring(5, 7) == "04") {
|
||
hh = parseFloat(allhh[3])
|
||
}
|
||
if (obj.substring(5, 7) == "05") {
|
||
hh = parseFloat(allhh[4])
|
||
}
|
||
if (obj.substring(5, 7) == "06") {
|
||
hh = parseFloat(allhh[5])
|
||
}
|
||
if (obj.substring(5, 7) == "07") {
|
||
hh = parseFloat(allhh[6])
|
||
}
|
||
if (obj.substring(5, 7) == "08") {
|
||
hh = parseFloat(allhh[7])
|
||
}
|
||
if (obj.substring(5, 7) == "09") {
|
||
hh = parseFloat(allhh[8])
|
||
}
|
||
if (obj.substring(5, 7) == "10") {
|
||
hh = parseFloat(allhh[9])
|
||
}
|
||
if (obj.substring(5, 7) == "11") {
|
||
hh = parseFloat(allhh[10])
|
||
}
|
||
if (obj.substring(5, 7) == "12") {
|
||
hh = parseFloat(allhh[11])
|
||
}
|
||
}
|
||
if (obj.substring(0, 4) == year + 1 && allhh.length > 12) {
|
||
if (obj.substring(5, 7) == "01") {
|
||
hh = parseFloat(allhh[12])
|
||
}
|
||
if (obj.substring(5, 7) == "02") {
|
||
hh = parseFloat(allhh[13])
|
||
}
|
||
if (obj.substring(5, 7) == "03") {
|
||
hh = parseFloat(allhh[14])
|
||
}
|
||
if (obj.substring(5, 7) == "04") {
|
||
hh = parseFloat(allhh[15])
|
||
}
|
||
if (obj.substring(5, 7) == "05") {
|
||
hh = parseFloat(allhh[16])
|
||
}
|
||
if (obj.substring(5, 7) == "06") {
|
||
hh = parseFloat(allhh[17])
|
||
}
|
||
if (obj.substring(5, 7) == "07") {
|
||
hh = parseFloat(allhh[18])
|
||
}
|
||
if (obj.substring(5, 7) == "08") {
|
||
hh = parseFloat(allhh[19])
|
||
}
|
||
if (obj.substring(5, 7) == "09") {
|
||
hh = parseFloat(allhh[20])
|
||
}
|
||
if (obj.substring(5, 7) == "10") {
|
||
hh = parseFloat(allhh[21])
|
||
}
|
||
if (obj.substring(5, 7) == "11") {
|
||
hh = parseFloat(allhh[22])
|
||
}
|
||
if (obj.substring(5, 7) == "12") {
|
||
hh = parseFloat(allhh[23])
|
||
}
|
||
}
|
||
var me = F(grid1ClientID), nowTotal = 0;
|
||
me.getRowEls().each(function (index, tr) {
|
||
nowTotal += me.getCellValue(tr, obj);
|
||
});
|
||
// 第三个参数 true,强制更新,不显示左上角的更改标识
|
||
me.updateSummaryCellValue(obj, nowTotal, true);
|
||
//判断红色标识样式
|
||
if (hh != 0 && nowTotal > hh) {
|
||
$(".f-grid-row-summary .f-grid-cell-" + obj + " .f-grid-cell-inner").addClass("totalRed");
|
||
} else {
|
||
$(".f-grid-row-summary .f-grid-cell-" + obj + " .f-grid-cell-inner").removeClass("totalRed");
|
||
}
|
||
}
|
||
|
||
F.ready(function () {
|
||
var myDate = new Date();
|
||
var month = "";
|
||
var year = parseInt(myDate.getFullYear());
|
||
var day = parseInt(myDate.getDate());
|
||
if (day >= 26) {
|
||
month = parseInt(myDate.getMonth());
|
||
}
|
||
else {
|
||
month = parseInt(myDate.getMonth()) - 1;
|
||
}
|
||
//var m = month < 10 ? "0" + month : month;
|
||
//头部合计
|
||
for (var i = 0; i < 12; i++) {
|
||
year = month + 1 > 12 ? year + 1 : year;
|
||
month = month + 1 > 12 ? 1 : month + 1;
|
||
var m = month < 10 ? "0" + month : month;
|
||
updateSummary(year.toString() + "-" + m.toString());
|
||
}
|
||
//updateSummary(year.toString() + "-" + m.toString());
|
||
|
||
});
|
||
</script>
|
||
</body>
|
||
</html>
|