Basf_EProject/EProject/FineUIPro.Web/ManHours/ManHoursStatisticsNew.aspx

1106 lines
58 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManHoursStatisticsNew.aspx.cs" Inherits="FineUIPro.Web.ManHours.ManHoursStatisticsNew" %>
<!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>
<script src="../Scripts/jquery-3.7.1.min.js"></script>
<script src="../res/echarts/echarts.js"></script>
</head>
<body>
<form id="form1" runat="server">
<f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
<f:Panel ID="Panel1" CssClass="blockpanel" Margin="5px" runat="server" ShowBorder="false" ShowHeader="false" Layout="Region">
<Items>
<f:Panel runat="server" ID="panelLeftRegion" RegionPosition="Left" RegionSplit="true" EnableCollapse="true"
RegionPercent="20%" Title="Navigation" ShowBorder="true" ShowHeader="true" AutoScroll="true">
<Toolbars>
<f:Toolbar ID="Toolbar1" Position="Top" runat="server" ToolbarAlign="Left">
<Items>
<f:TextBox ID="txtUserName" runat="server" Label="UserName" EmptyText="Search by name" AutoPostBack="true"
OnTextChanged="txtUserName_TextChanged" Width="240px" LabelWidth="80px" LabelAlign="Right">
</f:TextBox>
<f:HiddenField ID="hdId" runat="server"></f:HiddenField>
</Items>
</f:Toolbar>
</Toolbars>
<Items>
<f:Tree ID="tvControlItem" ShowHeader="false" Title="部门-人员树节点" OnNodeCommand="tvControlItem_NodeCommand"
runat="server" ShowBorder="false" EnableCollapse="true" EnableSingleClickExpand="true"
AutoLeafIdentification="true" EnableSingleExpand="true" EnableTextSelection="true">
<Listeners>
<f:Listener Event="nodeselect" Handler="onTree1NodeSelect" />
</Listeners>
</f:Tree>
</Items>
</f:Panel>
<f:Panel runat="server" ID="panelCenterRegion" RegionPosition="Center"
Title="中间面板" ShowBorder="true" ShowHeader="false" Layout="Region">
<Items>
<f:Panel runat="server" ID="panelTopRegion" RegionPosition="Center"
ShowBorder="true" ShowHeader="false" Layout="HBox">
<Items>
<f:Panel ID="Panel2" Width="700px" runat="server"
ShowBorder="false" ShowHeader="false" Layout="VBox">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="true" Title="Task List"
AllowColumnLocking="true" EnableColumnLines="true" runat="server" BoxFlex="1" DataKeyNames="EProjectId" DataIDField="EProjectId" AllowCellEditing="true" SortDirection="DESC"
EnableSummary="true" SummaryPosition="Flow" AllowSorting="true" SortField="ProjectControl_JobNo" EnableRowSelectEvent="true" OnRowSelect="Grid1_RowSelect" AllowPaging="true" IsDatabasePaging="true" PageSize="15" OnPageIndexChange="Grid1_PageIndexChange">
<Columns>
<f:RowNumberField EnablePagingNumber="true" Width="40px" HeaderTextAlign="Center"
TextAlign="Center" />
<f:RenderField Width="90px" ColumnID="ProjectControl_JobNo" DataField="ProjectControl_JobNo" EnableFilter="true"
SortField="JobNo" FieldType="String" HeaderText="Job No." HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="150px" ColumnID="ProjectControl_JobTitle" DataField="ProjectControl_JobTitle"
FieldType="String" HeaderText="Title" HeaderTextAlign="Center" ExpandUnusedSpace="true">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="ReceivedDate" DataField="ReceivedDate"
FieldType="Date" Renderer="Date" HeaderText="Received<br/>Date" HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="ManhoursPlan" DataField="ManhoursPlan"
FieldType="String" HeaderText="Manhours<br/>(Plan)" HeaderTextAlign="Center">
</f:RenderField>
<%--<f:RenderField Width="100px" ColumnID="ManhoursPlaned" DataField="ManhoursPlaned"
FieldType="String" HeaderText="Manhours<br/>(∑Planed)" HeaderTextAlign="Center">
</f:RenderField>--%>
<f:RenderField Width="100px" ColumnID="ManhoursActual" DataField="ManhoursActual"
FieldType="String" HeaderText="ManHours<br/>(∑Actual)" HeaderTextAlign="Center">
</f:RenderField>
</Columns>
<Listeners>
<f:Listener Event="rowselect" Handler="onRowselect" />
</Listeners>
</f:Grid>
</Items>
</f:Panel>
<f:Panel ID="Panel3" MinWidth="440px"
runat="server" ShowBorder="false" ShowHeader="false" Layout="VBox">
<Items>
<f:Grid ID="Grid2" ShowBorder="true" ShowHeader="true" Title="Manhours"
AllowColumnLocking="true" EnableColumnLines="true" Width="410px"
IsDatabasePaging="false" EnableSummary="true" SummaryPosition="Flow"
runat="server" BoxFlex="1" DataKeyNames="DateMonth" AllowCellEditing="true" AllowSorting="true" SortField="DateMonth" SortDirection="DESC">
<Columns>
<f:RowNumberField EnablePagingNumber="true" Width="40px" HeaderTextAlign="Center"
TextAlign="Center" />
<f:RenderField Width="80px" ColumnID="DateMonth" DataField="DateMonth"
FieldType="String" HeaderText="Month" HeaderTextAlign="Center" TextAlign="Left">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="PlanHours" DataField="PlanHours"
FieldType="String" HeaderText="Task Planed" HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="ActualHours" DataField="ActualHours"
FieldType="String" HeaderText="Task Actual" HeaderTextAlign="Center">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="NoPlanHours" DataField="NoPlanHours"
FieldType="String" HeaderText="No Planned" HeaderTextAlign="Center">
</f:RenderField>
</Columns>
</f:Grid>
</Items>
</f:Panel>
</Items>
</f:Panel>
<f:Panel runat="server" ID="panelBottomRegion" RegionPosition="Bottom" RegionSplit="true" EnableCollapse="true" RegionPercent="45%"
Title="Work Load" ShowBorder="true" ShowHeader="true" RegionSplitWidth="10px">
<Items>
<f:ContentPanel ID="ContentPanel1" CssClass="blockpanel" runat="server" BodyPadding="1px"
ShowBorder="true" ShowHeader="false" Title="Work Load" EnableAjax="false">
<asp:HiddenField ID="hidjson" runat="server" />
<asp:HiddenField ID="ActualManHour" runat="server" />
<asp:HiddenField ID="hidchildJson" runat="server" />
<asp:HiddenField ID="hidTree1Node" runat="server" />
<div id="divChart1" class="echartsdiv" style="height: 320px; min-width: 1100px; width: 1200px;"></div>
<div id="divChart2" class="echartsdiv" style="height: 320px; min-width: 1100px; width: 1200px; display: none"></div>
<div id="divChart3" class="echartsdiv" style="height: 320px; min-width: 1100px; width: 1200px; display: none"></div>
<%-- <div style="width:100%;height:20px;"></div>--%>
</f:ContentPanel>
</Items>
</f:Panel>
</Items>
</f:Panel>
</Items>
</f:Panel>
</form>
<script type="text/javascript">
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
var interval = 1500;
$(function () {
var json = $("#<%=hidjson.ClientID%>").val();
var jsArr = eval(json);
if (jsArr.length > 0) {
divPieRecord(jsArr, interval);
}
});
function onRowselect(event, nodeId) {
var TreeValue = $("#<%=hidTree1Node.ClientID%>").val();
var values = TreeValue.split('@')[0];
if (values == "" || values == "D1") {
$("#divChart2").hide();
$("#divChart1").hide();
$("#divChart3").show();
var HeadCount = $("#<%=hidchildJson.ClientID%>").val();
var json = $("#<%=hidjson.ClientID%>").val();
var jsArr = eval(json);
divPieRecord3(jsArr, HeadCount);
} else if (values == "UD") {
$("#divChart2").show();
$("#divChart1").hide();
$("#divChart3").hide();
$.ajax({
url: "ManHoursStatisticsHandler.ashx",
type: "POST",
async: false,
data: { "sId": TreeValue },
dataType: "json",
success: function (data) {
if (data != null) {
divRecord(data, 1);
}
}
});
}
}
function onTree1NodeSelect(event, nodeId) {
$("#<%=hidTree1Node.ClientID%>").val(nodeId);
var ss = nodeId.split('@');
if (ss[0] == "UD") {//选择人员
$("#divChart2").show();
$("#divChart1").hide();
$("#divChart3").hide();
$.ajax({
url: "ManHoursStatisticsHandler.ashx",
type: "POST",
async: false,
data: { "sId": nodeId },
dataType: "json",
success: function (data) {
//debugger
if (data != null) {
divRecord(data, 1);
}
}
});
} else
{
$("#divChart1").show();
$("#divChart2").hide();
$("#divChart3").hide();
$.ajax({
url: "ManHoursStatisticsHandler.ashx",
type: "POST",
async: false,
data: { "sId": nodeId },
dataType: "json",
success: function (data) {
if (data != null) {
divPieRecord(data, ss[0]);
}
}
});
}
}
function divPieRecord(jsArrData, intnum) {
var ActualManHourMonthSet = $("#<%=ActualManHour.ClientID%>").val();
var HeadCount = "";
var jsArr = "";
if (intnum == "D2") {
HeadCount = jsArrData.SetJson;
jsArr = jsArrData.json;
} else {
jsArr = jsArrData;
HeadCount = $("#<%=hidchildJson.ClientID%>").val();
}
var jsons = eval(ActualManHourMonthSet);
HeadCount = eval(HeadCount);
var Legendata = '';
var TaskPlan = '';
var TaskActual = '';
var NoPlanned = '';
var ActualRate = '';
var PlanedRate = "";
var TargetRate = "";
var tr = 0.85;
for (var i = jsArr.length-1; i >=0 ; i--) {
if (jsArr[i].DateMonth != "") {
var str = jsArr[i].DateMonth;
Legendata += "'" + jsArr[i].DateMonth + "',";
TaskPlan += "" + jsArr[i].PlanHours + ",";
TaskActual += "" + jsArr[i].ActualHours + ",";
NoPlanned += "" + jsArr[i].NoPlanHours + ",";
TargetRate += "" + tr + ",";
var tempHeardCount = null;
for (var j = 0; j < HeadCount.length; j++) {
if (HeadCount[j].Years + '' == str.substring(0, 4)) {
tempHeardCount = HeadCount[j];
}
}
var tempJsons = null;
for (var j = 0; j < jsons.length; j++) {
if (jsons[j].Years + '' == str.substring(0, 4)) {
tempJsons = jsons[j];
}
}
if (str.substring(4) == "01") {
if (tempJsons != null && tempJsons.Month1 != null && tempHeardCount != null && tempHeardCount.Month1 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month1 * tempJsons.Month1) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month1 * tempJsons.Month1) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "02") {
if (tempJsons != null && tempJsons.Month2 != null && tempHeardCount != null && tempHeardCount.Month2 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month2 * tempJsons.Month2) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month2 * tempJsons.Month2) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "03") {
if (tempJsons != null && tempJsons.Month3 != null && tempHeardCount != null && tempHeardCount.Month3 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month3 * tempJsons.Month3) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month3 * tempJsons.Month3) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "04") {
if (tempJsons != null && tempJsons.Month4 != null && tempHeardCount != null && tempHeardCount.Month4 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month4 * tempJsons.Month4) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month4 * tempJsons.Month4) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "05") {
if (tempJsons != null && tempJsons.Month5 != null && tempHeardCount != null && tempHeardCount.Month5 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month5 * tempJsons.Month5) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month5 * tempJsons.Month5) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "06") {
if (tempJsons != null && tempJsons.Month6 != null && tempHeardCount != null && tempHeardCount.Month6 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month6 * tempJsons.Month6) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month6 * tempJsons.Month6) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "07") {
if (tempJsons != null && tempJsons.Month7 != null && tempHeardCount != null && tempHeardCount.Month7 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month7 * tempJsons.Month7) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month7 * tempJsons.Month7) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "08") {
if (tempJsons != null && tempJsons.Month8 != null && tempHeardCount != null && tempHeardCount.Month8 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month8 * tempJsons.Month8) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month8 * tempJsons.Month8) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "09") {
if (tempJsons != null && tempJsons.Month9 != null && tempHeardCount != null && tempHeardCount.Month9 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month9 * tempJsons.Month9) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month9 * tempJsons.Month9) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "10") {
if (tempJsons != null && tempJsons.Month10 != null && tempHeardCount != null && tempHeardCount.Month10 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month10 * tempJsons.Month10) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month10 * tempJsons.Month10) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "11") {
if (tempJsons != null && tempJsons.Month11 != null && tempHeardCount != null && tempHeardCount.Month11 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month11 * tempJsons.Month11) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month11 * tempJsons.Month11) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "12") {
if (tempJsons != null && tempJsons.Month12 != null && tempHeardCount != null && tempHeardCount.Month12 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month12 * tempJsons.Month12) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month12 * tempJsons.Month12) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
}
}
Legendata = '[' + Legendata.substring(0, Legendata.length - 1) + ']';
Legendata = eval(Legendata);
TaskPlan = '[' + TaskPlan.substring(0, TaskPlan.length - 1) + ']';
TaskPlan = eval(TaskPlan);
TaskActual = '[' + TaskActual.substring(0, TaskActual.length - 1) + ']';
TaskActual = eval(TaskActual);
NoPlanned = '[' + NoPlanned.substring(0, NoPlanned.length - 1) + ']';
NoPlanned = eval(NoPlanned);
ActualRate = '[' + ActualRate.substring(0, ActualRate.length - 1) + ']';
ActualRate = eval(ActualRate);
PlanedRate = '[' + PlanedRate.substring(0, PlanedRate.length - 1) + ']';
PlanedRate = eval(PlanedRate);
TargetRate = '[' + TargetRate.substring(0, TargetRate.length - 1) + ']';
TargetRate = eval(TargetRate);
var dataT = [TaskPlan, TaskActual, NoPlanned, ActualRate, PlanedRate, TargetRate];
dataT = eval(dataT);
var myChart = echarts.init(document.getElementById('divChart1'));
var colors = ['#675bba', '#5793f3', '#d14a61'];
var option = {
// color: colors,
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
grid: {
left: '3%',
right: '10%',
bottom: '10%',
containLabel: true
},
//left: '10%',bottom:'35%',
legend: {
data: ['New Task', 'Actual', 'Planned', 'Actual WorkLoad Rate', 'Planned WorkLoad Rate', 'Target workload rate']
},
xAxis: [
{
type: 'category',
data: Legendata,
axisLabel: {
interval: 0, //控制坐标轴刻度标签的显示间隔.设置成 0 强制显示所有标签。设置为 1隔一个标签显示一个标签。设置为2间隔2个标签。以此类推
rotate: -90,//倾斜度 -90 至 90 默认为0
textStyle: {
//fontWeight:"bold", //加粗
color: "#000000" //黑色
},
},
axisTick: {
alignWithLabel: true
}
}
],
yAxis: [
{
type: 'value',
axisTick: {
inside: true
},
scale: true
}
, {
type: 'value',
name: '',
min: 0,
max: 1.5,
interval: 0.1,
axisLabel: {
formatter: '{value}'
}
}
],
series: [
{
name: 'New Task',
type: 'bar',
barWidth: '20%',
data: dataT[2],
itemStyle: {
normal: {
color: '#5793f3'
}
}
},
{
name: 'Actual',
type: 'bar',
barWidth: '20%',
data: dataT[1],
itemStyle: {
normal: {
color: '#00EE76'
// color: '#675bba'
}
}
},
{
name: 'Planned',
type: 'bar',
barWidth: '20%',
data: dataT[0],
itemStyle: {
normal: {
color: '#7D26CD'//'#d14a61'
}
}
},
{//'#675bba', '#5793f3', '#d14a61'
name: 'Actual WorkLoad Rate',
type: 'line',
yAxisIndex: 1,
data: dataT[3],
itemStyle: {
normal: {
color: '#00EE76'//'#ff0000'
}
}
},
{
name: 'Planned WorkLoad Rate',
type: 'line',
yAxisIndex: 1,
data: dataT[4],
itemStyle: {
normal: {
color: '#7D26CD'//'#077023'
}
}
},
{
name: 'Target workload rate',
type: 'line',
yAxisIndex: 1,
data: dataT[5],
itemStyle: {
normal: {
color: '#d14a61'
}
}
}
]
};
myChart.setOption(option,true);
}
function divRecord(jsArrData, intnum) {
var ActualManHourMonthSet = $("#<%=ActualManHour.ClientID%>").val();
jsArr = jsArrData.json;
var jsons = eval(ActualManHourMonthSet);
var Legendata = '';
var ActualRate = '';
var PlanedRate = "";
var TargetRate = "";
var tr = 0.85;
for (var i = jsArr.length-1; i >=0 ; i--) {
if (jsArr[i].DateMonth != "") {
var str = jsArr[i].DateMonth;
Legendata += "'" + jsArr[i].DateMonth + "',";
TargetRate += "" + tr + ",";
var tempJsons = null;
for (var j = 0; j < jsons.length; j++) {
if (jsons[j].Years + '' == str.substring(0, 4)) {
tempJsons = jsons[j];
}
}
if (str.substring(4) == "01") {
if (tempJsons != null && tempJsons.Month1 != null) {
ActualRate += "" + ((jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (1 * tempJsons.Month1)).toFixed(2) + ",";
PlanedRate += "" + (jsArr[i].PlanHours / (1 * tempJsons.Month1)).toFixed(2) + ",";
}
}
if (str.substring(4) == "02") {
if (tempJsons != null && tempJsons.Month2 != null) {
ActualRate += "" + ((jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (1 * tempJsons.Month2)).toFixed(2) + ",";
PlanedRate += "" + (jsArr[i].PlanHours / (1 * tempJsons.Month2)).toFixed(2) + ",";
}
}
if (str.substring(4) == "03") {
if (tempJsons != null && tempJsons.Month3 != null) {
ActualRate += "" + ((jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (1 * tempJsons.Month3)).toFixed(2) + ",";
PlanedRate += "" + (jsArr[i].PlanHours / (1 * tempJsons.Month3)).toFixed(2) + ",";
}
}
if (str.substring(4) == "04") {
if (tempJsons != null && tempJsons.Month4 != null) {
ActualRate += "" + ((jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (1 * tempJsons.Month4)).toFixed(2) + ",";
PlanedRate += "" + (jsArr[i].PlanHours / (1 * tempJsons.Month4)).toFixed(2) + ",";
}
}
if (str.substring(4) == "05") {
if (tempJsons != null && tempJsons.Month5 != null) {
ActualRate += "" + ((jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (1 * tempJsons.Month5)).toFixed(2) + ",";
PlanedRate += "" + (jsArr[i].PlanHours / (1 * tempJsons.Month5)).toFixed(2) + ",";
}
}
if (str.substring(4) == "06") {
if (tempJsons != null && tempJsons.Month6 != null) {
ActualRate += "" + ((jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (1 * tempJsons.Month6)).toFixed(2) + ",";
PlanedRate += "" + (jsArr[i].PlanHours / (1 * tempJsons.Month6)).toFixed(2) + ",";
}
}
if (str.substring(4) == "07") {
if (tempJsons != null && tempJsons.Month7 != null) {
ActualRate += "" + ((jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (1 * tempJsons.Month7)).toFixed(2) + ",";
PlanedRate += "" + (jsArr[i].PlanHours / (1 * tempJsons.Month7)).toFixed(2) + ",";
}
}
if (str.substring(4) == "08") {
if (tempJsons != null && tempJsons.Month8 != null) {
ActualRate += "" + ((jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (1 * tempJsons.Month8)).toFixed(2) + ",";
PlanedRate += "" + (jsArr[i].PlanHours / (1 * tempJsons.Month8)).toFixed(2) + ",";
}
}
if (str.substring(4) == "09") {
if (tempJsons != null && tempJsons.Month9 != null) {
ActualRate += "" + ((jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (1 * tempJsons.Month9)).toFixed(2) + ",";
PlanedRate += "" + (jsArr[i].PlanHours / (1 * tempJsons.Month9)).toFixed(2) + ",";
}
}
if (str.substring(4) == "10") {
if (tempJsons != null && tempJsons.Month10 != null) {
ActualRate += "" + ((jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (1 * tempJsons.Month10)).toFixed(2) + ",";
PlanedRate += "" + (jsArr[i].PlanHours / (1 * tempJsons.Month10)).toFixed(2) + ",";
}
}
if (str.substring(4) == "11") {
if (tempJsons != null && tempJsons.Month11 != null) {
ActualRate += "" + ((jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (1 * tempJsons.Month11)).toFixed(2) + ",";
PlanedRate += "" + (jsArr[i].PlanHours / (1 * tempJsons.Month11)).toFixed(2) + ",";
}
}
if (str.substring(4) == "12") {
if (tempJsons != null && tempJsons.Month12 != null) {
ActualRate += "" + ((jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (1 * tempJsons.Month12)).toFixed(2) + ",";
PlanedRate += "" + (jsArr[i].PlanHours / (1 * tempJsons.Month12)).toFixed(2) + ",";
}
}
}
}
Legendata = '[' + Legendata.substring(0, Legendata.length - 1) + ']';
Legendata = eval(Legendata);
ActualRate = '[' + ActualRate.substring(0, ActualRate.length - 1) + ']';
ActualRate = eval(ActualRate);
PlanedRate = '[' + PlanedRate.substring(0, PlanedRate.length - 1) + ']';
PlanedRate = eval(PlanedRate);
TargetRate = '[' + TargetRate.substring(0, TargetRate.length - 1) + ']';
TargetRate = eval(TargetRate);
var dataT = [ActualRate, PlanedRate, TargetRate];
dataT = eval(dataT);
var myChart = echarts.init(document.getElementById('divChart2'));
var option = {
// color: colors,
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
grid: {
left: '3%',
right: '10%',
bottom: '10%',
containLabel: true
},
//left: '10%',bottom:'35%',
legend: {
data: ['Actual WorkLoad Rate', 'Planned WorkLoad Rate', 'Target workload rate']
},
xAxis: [
{
type: 'category',
data: Legendata,
axisLabel: {
interval: 0, //控制坐标轴刻度标签的显示间隔.设置成 0 强制显示所有标签。设置为 1隔一个标签显示一个标签。设置为2间隔2个标签。以此类推
rotate: -90,//倾斜度 -90 至 90 默认为0
textStyle: {
//fontWeight:"bold", //加粗
color: "#000000" //黑色
},
},
axisTick: {
alignWithLabel: true
}
}
],
yAxis: [
{
type: 'value',
axisTick: {
inside: true
},
scale: true
}
],
series: [
{
name: 'Actual WorkLoad Rate',
type: 'line',
data: dataT[0],
itemStyle: {
normal: {
color: '#ff0000'
}
}
},
{
name: 'Planned WorkLoad Rate',
type: 'line',
data: dataT[1],
itemStyle: {
normal: {
color: '#077023'
}
}
},
{
name: 'Target workload rate',
type: 'line',
data: dataT[2],
itemStyle: {
normal: {
color: '#d14a61'
}
}
}
]
};
myChart.setOption(option);
}
function divPieRecord3(jsArr, HeadCount) {
var ActualManHourMonthSet = $("#<%=ActualManHour.ClientID%>").val();
var jsons = eval(ActualManHourMonthSet);
HeadCount = eval(HeadCount);
var Legendata = '';
var TaskPlan = '';
var TaskActual = '';
var NoPlanned = '';
var ActualRate = '';
var PlanedRate = "";
var TargetRate = "";
var tr = 0.85;
for (var i = jsArr.length-10; i >=0 ; i--) {
//if (jsArr[i].DateMonth != "") {
// var str = jsArr[i].DateMonth;
// Legendata += "'" + jsArr[i].DateMonth + "',";
// TaskPlan += "" + jsArr[i].TaskPlan + ",";
// TaskActual += "" + jsArr[i].TaskActual + ",";
// NoPlanned += "" + jsArr[i].NoPlanned + ",";
// TargetRate += "" + tr + ",";
// if (str.substring(4) == "01") {
// if (jsons[0].Month1 != null) {
// ActualRate += "" + jsArr[i].TaskActual / (HeadCount[0].Month1 * jsons[0].Month1) + ",";
// PlanedRate += "" + jsArr[i].NoPlanned / (HeadCount[0].Month1 * jsons[0].Month1) + ",";
// }
// }
// if (str.substring(4) == "02") {
// if (jsons[0].Month2 != null) {
// ActualRate += "" + jsArr[i].TaskActual / (HeadCount[0].Month2 * jsons[0].Month2) + ",";
// PlanedRate += "" + jsArr[i].NoPlanned / (HeadCount[0].Month2 * jsons[0].Month2) + ",";
// }
// }
// if (str.substring(4) == "03") {
// if (jsons[0].Month3 != null) {
// ActualRate += "" + jsArr[i].TaskActual / (HeadCount[0].Month3 * jsons[0].Month3) + ",";
// PlanedRate += "" + jsArr[i].NoPlanned / (HeadCount[0].Month3 * jsons[0].Month3) + ",";
// }
// }
// if (str.substring(4) == "04") {
// if (jsons[0].Month4 != null) {
// ActualRate += "" + jsArr[i].TaskActual / (HeadCount[0].Month4 * jsons[0].Month4) + ",";
// PlanedRate += "" + jsArr[i].NoPlanned / (HeadCount[0].Month4 * jsons[0].Month4) + ",";
// }
// }
// if (str.substring(4) == "05") {
// if (jsons[0].Month5 != null) {
// ActualRate += "" + jsArr[i].TaskActual / (HeadCount[0].Month5 * jsons[0].Month5) + ",";
// PlanedRate += "" + jsArr[i].NoPlanned / (HeadCount[0].Month5 * jsons[0].Month5) + ",";
// }
// }
// if (str.substring(4) == "06") {
// if (jsons[0].Month6 != null) {
// ActualRate += "" + jsArr[i].TaskActual / (HeadCount[0].Month6 * jsons[0].Month6) + ",";
// PlanedRate += "" + jsArr[i].NoPlanned / (HeadCount[0].Month6 * jsons[0].Month6) + ",";
// }
// }
// if (str.substring(4) == "07") {
// if (jsons[0].Month7 != null) {
// ActualRate += "" + jsArr[i].TaskActual / (HeadCount[0].Month7 * jsons[0].Month7) + ",";
// PlanedRate += "" + jsArr[i].NoPlanned / (HeadCount[0].Month7 * jsons[0].Month7) + ",";
// }
// }
// if (str.substring(4) == "08") {
// if (jsons[0].Month8 != null) {
// ActualRate += "" + jsArr[i].TaskActual / (HeadCount[0].Month8 * jsons[0].Month8) + ",";
// PlanedRate += "" + jsArr[i].NoPlanned / (HeadCount[0].Month8 * jsons[0].Month8) + ",";
// }
// }
// if (str.substring(4) == "09") {
// if (jsons[0].Month9 != null) {
// ActualRate += "" + jsArr[i].TaskActual / (HeadCount[0].Month9 * jsons[0].Month9) + ",";
// PlanedRate += "" + jsArr[i].NoPlanned / (HeadCount[0].Month9 * jsons[0].Month9) + ",";
// }
// }
// if (str.substring(4) == "10") {
// if (jsons[0].Month10 != null) {
// ActualRate += "" + jsArr[i].TaskActual / (HeadCount[0].Month10 * jsons[0].Month10) + ",";
// PlanedRate += "" + jsArr[i].NoPlanned / (HeadCount[0].Month10 * jsons[0].Month10) + ",";
// }
// }
// if (str.substring(4) == "11") {
// if (jsons[0].Month11 != null) {
// ActualRate += "" + jsArr[i].TaskActual / (HeadCount[0].Month11 * jsons[0].Month11) + ",";
// PlanedRate += "" + jsArr[i].NoPlanned / (HeadCount[0].Month11 * jsons[0].Month11) + ",";
// }
// }
// if (str.substring(4) == "12") {
// if (jsons[0].Month12 != null) {
// ActualRate += "" + jsArr[i].TaskActual / (HeadCount[0].Month12 * jsons[0].Month12) + ",";
// PlanedRate += "" + jsArr[i].NoPlanned / (HeadCount[0].Month12 * jsons[0].Month12) + ",";
// }
// }
//}
if (jsArr[i].DateMonth != "") {
var str = jsArr[i].DateMonth;
Legendata += "'" + jsArr[i].DateMonth + "',";
TaskPlan += "" + jsArr[i].PlanHours + ",";
TaskActual += "" + jsArr[i].ActualHours + ",";
NoPlanned += "" + jsArr[i].NoPlanHours + ",";
TargetRate += "" + tr + ",";
var tempHeardCount = null;
for (var j = 0; j < HeadCount.length; j++) {
if (HeadCount[j].Years + '' == str.substring(0, 4)) {
tempHeardCount = HeadCount[j];
}
}
var tempJsons = null;
for (var j = 0; j < jsons.length; j++) {
if (jsons[j].Years + '' == str.substring(0, 4)) {
tempJsons = jsons[j];
}
}
if (str.substring(4) == "01") {
if (tempJsons != null && tempJsons.Month1 != null && tempHeardCount != null && tempHeardCount.Month1 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month1 * tempJsons.Month1) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month1 * tempJsons.Month1) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "02") {
if (tempJsons != null && tempJsons.Month2 != null && tempHeardCount != null && tempHeardCount.Month2 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month2 * tempJsons.Month2) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month2 * tempJsons.Month2) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "03") {
if (tempJsons != null && tempJsons.Month3 != null && tempHeardCount != null && tempHeardCount.Month3 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month3 * tempJsons.Month3) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month3 * tempJsons.Month3) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "04") {
if (tempJsons != null && tempJsons.Month4 != null && tempHeardCount != null && tempHeardCount.Month4 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month4 * tempJsons.Month4) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month4 * tempJsons.Month4) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "05") {
if (tempJsons != null && tempJsons.Month5 != null && tempHeardCount != null && tempHeardCount.Month5 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month5 * tempJsons.Month5) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month5 * tempJsons.Month5) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "06") {
if (tempJsons != null && tempJsons.Month6 != null && tempHeardCount != null && tempHeardCount.Month6 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month6 * tempJsons.Month6) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month6 * tempJsons.Month6) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "07") {
if (tempJsons != null && tempJsons.Month7 != null && tempHeardCount != null && tempHeardCount.Month7 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month7 * tempJsons.Month7) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month7 * tempJsons.Month7) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "08") {
if (tempJsons != null && tempJsons.Month8 != null && tempHeardCount != null && tempHeardCount.Month8 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month8 * tempJsons.Month8) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month8 * tempJsons.Month8) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "09") {
if (tempJsons != null && tempJsons.Month9 != null && tempHeardCount != null && tempHeardCount.Month9 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month9 * tempJsons.Month9) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month9 * tempJsons.Month9) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "10") {
if (tempJsons != null && tempJsons.Month10 != null && tempHeardCount != null && tempHeardCount.Month10 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month10 * tempJsons.Month10) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month10 * tempJsons.Month10) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "11") {
if (tempJsons != null && tempJsons.Month11 != null && tempHeardCount != null && tempHeardCount.Month11 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month11 * tempJsons.Month11) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month11 * tempJsons.Month11) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
if (str.substring(4) == "12") {
if (tempJsons != null && tempJsons.Month12 != null && tempHeardCount != null && tempHeardCount.Month12 != null) {
ActualRate += "" + (jsArr[i].ActualHours + jsArr[i].NoPlanHours) / (tempHeardCount.Month12 * tempJsons.Month12) + ",";
PlanedRate += "" + jsArr[i].PlanHours / (tempHeardCount.Month12 * tempJsons.Month12) + ",";
} else {
ActualRate += "0,";
PlanedRate += "0,";
}
}
}
}
Legendata = '[' + Legendata.substring(0, Legendata.length - 1) + ']';
Legendata = eval(Legendata);
TaskPlan = '[' + TaskPlan.substring(0, TaskPlan.length - 1) + ']';
TaskPlan = eval(TaskPlan);
TaskActual = '[' + TaskActual.substring(0, TaskActual.length - 1) + ']';
TaskActual = eval(TaskActual);
NoPlanned = '[' + NoPlanned.substring(0, NoPlanned.length - 1) + ']';
NoPlanned = eval(NoPlanned);
ActualRate = '[' + ActualRate.substring(0, ActualRate.length - 1) + ']';
ActualRate = eval(ActualRate);
PlanedRate = '[' + PlanedRate.substring(0, PlanedRate.length - 1) + ']';
PlanedRate = eval(PlanedRate);
TargetRate = '[' + TargetRate.substring(0, TargetRate.length - 1) + ']';
TargetRate = eval(TargetRate);
var dataT = [TaskPlan, TaskActual, NoPlanned, ActualRate, PlanedRate, TargetRate];
dataT = eval(dataT);
var myChart = echarts.init(document.getElementById('divChart3'));
var colors = ['#675bba', '#5793f3', '#d14a61'];
var option = {
// color: colors,
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
grid: {
left: '3%',
right: '10%',
bottom: '10%',
containLabel: true
},
//left: '10%',bottom:'35%',
legend: {
data: ['New Task', 'Actual', 'Planned', 'Actual WorkLoad Rate', 'Planned WorkLoad Rate','Target workload rate']
},
xAxis: [
{
type: 'category',
data: Legendata,
axisLabel: {
interval: 0, //控制坐标轴刻度标签的显示间隔.设置成 0 强制显示所有标签。设置为 1隔一个标签显示一个标签。设置为2间隔2个标签。以此类推
rotate: -90,//倾斜度 -90 至 90 默认为0
textStyle: {
//fontWeight:"bold", //加粗
color: "#000000" //黑色
},
},
axisTick: {
alignWithLabel: true
}
}
],
yAxis: [
{
type: 'value',
axisTick: {
inside: true
},
scale: true
}
, {
type: 'value',
name: '',
min: 0,
max: 1.5,
interval: 0.1,
axisLabel: {
formatter: '{value}'
}
}
],
series: [
{
name: 'New Task',
type: 'bar',
barWidth: '20%',
data: dataT[2],
itemStyle: {
normal: {
color: '#5793f3'
}
}
},
{
name: 'Actual',
type: 'bar',
barWidth: '20%',
data: dataT[1],
itemStyle: {
normal: {
color: '#675bba'
// color: '#675bba'
}
}
},
{
name: 'Planned',
type: 'bar',
barWidth: '20%',
data: dataT[0],
itemStyle: {
normal: {
// color: '#675bba'
color: '#d14a61'
}
}
},
{//'#675bba', '#5793f3', '#d14a61'
name: 'Actual WorkLoad Rate',
type: 'line',
yAxisIndex: 1,
data: dataT[3],
itemStyle: {
normal: {
color: '#ff0000'
}
}
},
{
name: 'Planned WorkLoad Rate',
type: 'line',
yAxisIndex: 1,
data: dataT[4],
itemStyle: {
normal: {
color: '#077023'
}
}
},
{
name: 'Target workload rate',
type: 'line',
yAxisIndex: 1,
data: dataT[5],
itemStyle: {
normal: {
color: '#d14a61'
}
}
}
]
};
myChart.setOption(option);
}
</script>
</body>
</html>