You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/js/OpSeaeTotalChart.js

314 lines
13 KiB
JavaScript

2 years ago
var commonGridObj_opseaetotal;
var chartBarTeuObj;
var chartPieTeuObj;
var chartLineTeuObj;
var chartBarProfitObj;
var chartPieProfitObj;
var chartLineProfitObj;
var chartBarOrderObj;
var chartPieOrderObj;
var chartLineOrderObj;
function $(id){
return document.getElementById(id);
}
function createGrid(){
//header
var headerArgs_opseae = new Array("年","月","箱量","票数","毛利润");
//width
var widthArgs_opseae = new Array("120","120","120","120","120");
//column align
var colAlignArgs_opseae = new Array("center","center","center","center","center");
//column sort
var colSortArgs_opseae = new Array("str","str","str","str","str");
//column type
var colTypeArgs_opseae = new Array("ro","ro","ro","ro","ro");
commonGridObj_opseaetotal = new TGridCommon("mygrid_container_total","form1",headerArgs_opseae,widthArgs_opseae,colAlignArgs_opseae,colSortArgs_opseae,colTypeArgs_opseae);
commonGridObj_opseaetotal.setResponseUrl("ChartGridSource.aspx");
var searchcacheName = $("h_searchcache").value;
var searchStr = "";
if(searchcacheName.trim() != ""){
searchStr = "&searchcachename="+searchcacheName;
}
commonGridObj_opseaetotal.setRequest("ChartGridSource.aspx?handle=opseaetotal"+searchStr+"&oplb=op_Seae&uid="+commonGridObj_opseaetotal.newGuid());
commonGridObj_opseaetotal.setSourceType("json");
commonGridObj_opseaetotal.setSkin("xp");
commonGridObj_opseaetotal.setImageUrl("../images/");
commonGridObj_opseaetotal.initGrid();
commonGridObj_opseaetotal.bind();
//commonGridObj_opseaetotal.initPageByHandle("opseaetotal");
}
function initTeuChart(typeName){
var searchcacheName = $("h_searchcache").value;
var searchStr = "";
if(searchcacheName.trim() != ""){
searchStr = "&searchcachename="+searchcacheName;
}
switch(typeName){
case "bar":
switchDisplay("chartTeuBarContainer",true);
switchDisplay("chartTeuPieContainer",false);
switchDisplay("chartTeuLineContainer",false);
var chartBarTeuObj = new dhtmlXChart({
view:"bar",
container:"chartTeuBarContainer",
value:"#teu#",
label:"#yearmonth#"
})
chartBarTeuObj.load("ChartGridSource.aspx?handle=opseaechartjson"+searchStr+"&oplb=op_Seae&uid="+commonGridObj_opseaetotal.newGuid(),"json");
break;
case "pie":
switchDisplay("chartTeuBarContainer",false);
switchDisplay("chartTeuPieContainer",true);
switchDisplay("chartTeuLineContainer",false);
var chartPieTeuObj = new dhtmlXChart({
view:"pie",
container:"chartTeuPieContainer",
value:"#teu#",
label:"#yearmonth#"
})
chartPieTeuObj.load("ChartGridSource.aspx?handle=opseaechartjson"+searchStr+"&oplb=op_Seae&uid="+commonGridObj_opseaetotal.newGuid(),"json");
break;
case "line":
switchDisplay("chartTeuBarContainer",false);
switchDisplay("chartTeuPieContainer",false);
switchDisplay("chartTeuLineContainer",true);
var chartLineTeuObj = new dhtmlXChart({
view:"line",
container:"chartTeuLineContainer",
value:"#teu#",
label:"#yearmonth#"
})
chartLineTeuObj.load("ChartGridSource.aspx?handle=opseaechartjson"+searchStr+"&oplb=op_Seae&uid="+commonGridObj_opseaetotal.newGuid(),"json");
break;
}
}
function initProfitChart(typeName){
var searchcacheName = $("h_searchcache").value;
var searchStr = "";
if(searchcacheName.trim() != ""){
searchStr = "&searchcachename="+searchcacheName;
}
switch(typeName){
case "bar":
switchDisplay("chartProfitBarContainer",true);
switchDisplay("chartProfitPieContainer",false);
switchDisplay("chartProfitLineContainer",false);
var chartBarProfitObj = new dhtmlXChart({
view:"bar",
container:"chartProfitBarContainer",
value:"#profit#",
label:"#yearmonth#"
})
chartBarProfitObj.load("ChartGridSource.aspx?handle=opseaechartjson"+searchStr+"&oplb=op_Seae&uid="+commonGridObj_opseaetotal.newGuid(),"json");
break;
case "pie":
switchDisplay("chartProfitBarContainer",false);
switchDisplay("chartProfitPieContainer",true);
switchDisplay("chartProfitLineContainer",false);
var chartPieProfitObj = new dhtmlXChart({
view:"pie",
container:"chartProfitPieContainer",
value:"#profit#",
label:"#yearmonth#"
})
chartPieProfitObj.load("ChartGridSource.aspx?handle=opseaechartjson"+searchStr+"&oplb=op_Seae&uid="+commonGridObj_opseaetotal.newGuid(),"json");
break;
case "line":
switchDisplay("chartProfitBarContainer",false);
switchDisplay("chartProfitPieContainer",false);
switchDisplay("chartProfitLineContainer",true);
var chartLineProfitObj = new dhtmlXChart({
view:"line",
container:"chartProfitLineContainer",
value:"#profit#",
label:"#yearmonth#"
})
chartLineProfitObj.load("ChartGridSource.aspx?handle=opseaechartjson"+searchStr+"&oplb=op_Seae&uid="+commonGridObj_opseaetotal.newGuid(),"json");
break;
}
}
function initOrderChart(typeName){
var searchcacheName = $("h_searchcache").value;
var searchStr = "";
if(searchcacheName.trim() != ""){
searchStr = "&searchcachename="+searchcacheName;
}
switch(typeName){
case "bar":
switchDisplay("chartOrderBarContainer",true);
switchDisplay("chartOrderPieContainer",false);
switchDisplay("chartOrderLineContainer",false);
var chartBarOrderObj = new dhtmlXChart({
view:"bar",
container:"chartOrderBarContainer",
value:"#order#",
label:"#yearmonth#"
})
chartBarOrderObj.load("ChartGridSource.aspx?handle=opseaechartjson"+searchStr+"&oplb=op_Seae&uid="+commonGridObj_opseaetotal.newGuid(),"json");
break;
case "pie":
switchDisplay("chartOrderBarContainer",false);
switchDisplay("chartOrderPieContainer",true);
switchDisplay("chartOrderLineContainer",false);
var chartPieOrderObj = new dhtmlXChart({
view:"pie",
container:"chartOrderPieContainer",
value:"#order#",
label:"#yearmonth#"
})
chartPieOrderObj.load("ChartGridSource.aspx?handle=opseaechartjson"+searchStr+"&oplb=op_Seae&uid="+commonGridObj_opseaetotal.newGuid(),"json");
break;
case "line":
switchDisplay("chartOrderBarContainer",false);
switchDisplay("chartOrderPieContainer",false);
switchDisplay("chartOrderLineContainer",true);
var chartLineOrderObj = new dhtmlXChart({
view:"line",
container:"chartOrderLineContainer",
value:"#order#",
label:"#yearmonth#"
})
chartLineOrderObj.load("ChartGridSource.aspx?handle=opseaechartjson"+searchStr+"&oplb=op_Seae&uid="+commonGridObj_opseaetotal.newGuid(),"json");
break;
}
}
function refresh(){
$("h_searchcache").value = "";
createGrid();
initCharts($('sel_type').options[$('sel_type').selectedIndex].value);
}
function initCharts(chartType){
initTeuChart(chartType);
initProfitChart(chartType);
initOrderChart(chartType);
}
function checkList(val){
initCharts(val);
}
function switchDisplay(id,isDisplay){
isDisplay ? $(id).style.display = "":$(id).style.display = "none";
}
function searchMultiple(){
printMessageBox(event);
}
var isIe=(document.all)?true:false;
//设置select的可见状态
function setSelectState(state){
var objl=document.getElementsByTagName('select');
for(var i=0;i<objl.length;i++)
{
objl[i].style.visibility=state;
}
}
function mousePosition(ev){
if(ev.pageX || ev.pageY)
{
return {x:ev.pageX, y:ev.pageY};
}
return {
x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,y:ev.clientY + document.body.scrollTop - document.body.clientTop
};
}
//弹出方法
function showMessageBox(wTitle,content,pos,wWidth){
closeWindow();
var bWidth=parseInt(document.documentElement.scrollWidth);
var bHeight=parseInt(document.documentElement.scrollHeight);
if(isIe){
setSelectState('hidden');}
var back=document.createElement("div");
back.id="back";
var styleStr="top:0px;left:0px;position:absolute;background:#666;width:"+bWidth+"px;height:"+bHeight+"px;";
styleStr+=(isIe)?"filter:alpha(opacity=0);":"opacity:0;";
back.style.cssText=styleStr;
document.body.appendChild(back);
showBackground(back,50);
var mesW=document.createElement("div");
mesW.id="mesWindow";
mesW.className="mesWindow";
mesW.innerHTML = "<div class='mesWindowTop'><table width='100%' height='100%'><tr><td>"+wTitle+"</td><td style='width:1px;'>"
+ "<input type='button' onclick='closeWindow();' title='关闭窗口' class='close' value='关闭' style='width:60px;'/></td></tr></table></div>"
+ "<div class='mesWindowContent' id='mesWindowContent'>"+content+"</div><div class='mesWindowBottom'></div>";
var v_top=(document.body.clientHeight-mesW.clientHeight)/2;
v_top+=document.documentElement.scrollTop;
styleStr="top:120px;left:"+(document.body.clientWidth/2-mesW.clientWidth/2)+"px;position:absolute;width:700px;margin-left:-300px;left:50%;z-index:9999;";
mesW.style.cssText=styleStr;
document.body.appendChild(mesW);
}
//让背景渐渐变暗
function showBackground(obj,endInt){
if(isIe){
obj.filters.alpha.opacity+=5;
if(obj.filters.alpha.opacity<endInt){
setTimeout(function(){showBackground(obj,endInt)},5);
}
}else{
var al=parseFloat(obj.style.opacity);al+=0.05;
obj.style.opacity=al;
if(al<(endInt/100)){
setTimeout(function(){showBackground(obj,endInt)},5);}
}
}
//关闭窗口
function closeWindow(){
if(document.getElementById('back')!=null){
document.getElementById('back').parentNode.removeChild(document.getElementById('back'));
}
if(document.getElementById('mesWindow')!=null){
document.getElementById('mesWindow').parentNode.removeChild(document.getElementById('mesWindow'));
}
if(isIe){
setSelectState('');
}
}
//测试弹出
function printMessageBox(ev)
{
var messContent = "";
var objPos = mousePosition(ev);
// messContent = "<div style=\"padding:20px 0 20px 0;text-align:center\">"
// +"<div style=\"float:left;width:100%\"><select id=\"reportType\" onchange=\"onReportTypeChange('reportType')\"><option value=\"1\">打印应收费用报表</option><option value=\"2\">打印应付费用报表</option> "
// +"<option value=\"3\">打印利润报表</option></select></div> "
//// +"<div style=\"float:left;width:100%;text-align:center;display:none;\" id=\"dvGainCheck\"><div style=\"float:left\"><input type=\"radio\" id=\"ra_recv\" name=\"gain\" title=\"打印应收利润\"/>应收利润</div> "
//// +"<div style=\"float:left\"><input type=\"radio\" id=\"ra_recv\" name=\"gain\" title=\"打印应付利润\"/>应付利润</div><div style=\"float:left\"> "
//// +"<input type=\"radio\" id=\"ra_recv\" name=\"gain\" title=\"打印利润\"/>利润</div></div> "
// +"<div style=\"float:left;width:100%;padding-left:80px;\"> "
// +"<table style=\"width:350px;\"><tr><td><select id=\"sel_customer\" multiple style=\"width:150px; height:60px;\">"+selectCustomerOptions+"</select></td><td> "
// +"<table style=\"height:60px; width:20px;\"><tr><td height=\"20px\"><div id=\"dvRemove\"><img src=\"../images/icons/edit_left.gif\" "
// +"onmouseover=\"mouseMoveImg(this,1)\" onmouseout=\"mouseMoveImg(this,1)\" title=\"移除\" onclick=\"removeCustomer()\"/></div></td> "
// +"</tr><tr><td height=\"20px\"><div id=\"dvAdd\"><img src=\"../images/icons/edit_right.gif\" onmouseover=\"mouseMoveImg(this,2)\" "
// +"onmouseout=\"mouseMoveImg(this,2)\" title=\"添加\" onclick=\"addCustomer()\"/></div></td> "
// +"</tr></table></td><td><select id=\"sel_print\" multiple style=\"width:150px; height:60px;\" class=\"select\"></select></td></tr></table></div>"
// +"<input type=\"button\" id=\"btn_print_report\" value=\"打印\" class=\"btn\" onclick=\"printReport()\"/></div> ";
messContent += "<div style=\"padding:20px 0 20px 0;text-align:center\">"
+ "<iframe frameborder=\"0\" src=\"../search/multiplesearch.aspx?handle=opseaetotalchart&opentype=frame\" width=\"100%\" height=\"230px;\" scrolling=\"no\">";
+ "</div> ";
showMessageBox('综合查询',messContent,objPos,350);
}