<%@ page contentType="text/html; charset=GBK" %>
<%@ page import = "zr.zrpower.common.util.SysPreperty" %>
<%@ page import = "zr.zrpower.common.util.DateWork" %>
<%@ page import = "zr.zrpower.entity.sys.SessionUser" %>
<%@ page import = "zr.zrpower.flowengine.mode.monitor.FLOW_RUNTIME_PROCESS"%>
<%@ page import = "zr.zrpower.ejb.sys.UIService" %>
<%@ page import = "zr.zrpower.flowengine.service.FlowMonitor"%>


<HTML>
<%
SessionUser user = (SessionUser)session.getAttribute("userinfo");
UIService userUI =new UIService();
FLOW_RUNTIME_PROCESS[] flow = null;
FlowMonitor fm = new FlowMonitor();
SysPreperty syspr = new SysPreperty();
String DataBaseType = syspr.getProperty().DataBaseType;//数据库类型
%>
<HTML>
<HEAD>
<TITLE></TITLE>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META http-equiv="Content-Type" content="text/html; charset=GBK">
<LINK type="text/css" rel="stylesheet" href="../../../zrsysmanage/css/<%=user.getUserCSS()%>">
<SCRIPT LANGUAGE="JavaScript" src="../../../zrsysmanage/script/Public.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" src="../../DatePicker/WdatePicker.js"></SCRIPT>
<!--WEB组件样式和js-->
<link rel="stylesheet" type="text/css" media="all" href="../../../ZrwebGui/sigma_grid/grid/calendar/calendar-blue.css" >
<script type="text/javascript" src="../../../ZrwebGui/sigma_grid/grid/calendar/calendar.js"></script>
<script type="text/javascript" src="../../../ZrwebGui/sigma_grid/grid/calendar/calendar-setup.js"></script>
<link rel="stylesheet" type="text/css" href="../../../ZrwebGui/sigma_grid/grid/gt_grid.css">
<link rel="stylesheet" type="text/css" href="../../../ZrwebGui/sigma_grid/grid/skin/vista/skinstyle.css">
<link rel="stylesheet" type="text/css" href="../../../ZrwebGui/sigma_grid/grid/skin/pink/skinstyle.css">
<link rel="stylesheet" type="text/css" href="../../../ZrwebGui/sigma_grid/grid/skin/mac/skinstyle.css">
<script type="text/javascript" src="../../../ZrwebGui/sigma_grid/grid/gt_msg_en.js"></script>
<script type="text/javascript" src="../../../ZrwebGui/sigma_grid/grid/gt_const.js"></script>
<script type="text/javascript" src="../../../ZrwebGui/sigma_grid/grid/gt_grid_all.js"></script>


<LINK type="text/css" rel="stylesheet" href="../../../zrsysmanage/html5/css/style_tables.css">
<SCRIPT LANGUAGE="JavaScript" src="../../../zrsysmanage/html5/script/jquery-2.0.3.min.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" src="../../../zrsysmanage/html5/layer/layer.js"></SCRIPT>
<LINK rel=stylesheet type="text/css" href="../../../zrsysmanage/html5/dist/css/datepicker.min.css">
<SCRIPT LANGUAGE="Javascript" src="../../Datehtml5/laydate.dev.js"></SCRIPT>

 <%
     String currentPage = request.getParameter("page");
  if(currentPage == null)
  {currentPage = "1";}


  String FCODE = request.getParameter("FCODE");
  if(FCODE == null)
  {FCODE = "";}

  String FDATE1 = request.getParameter("FDATE1");
  if(FDATE1 == null)
  {FDATE1 = "";}

  String FDATE2 = request.getParameter("FDATE2");
  if(FDATE2 == null)
  {FDATE2 = "";}

  String strw1 = " 1=1 ";
  String strw2 = " 1=1 ";


  if (FDATE1.length()>0 && FDATE2.length()>0)
  {
     if (DataBaseType.equals("1") || DataBaseType.equals("3"))
     {
        strw1 = strw1 +" and CREATEDATE >= to_date('"+FDATE1+" 00:00:00','yyyy-mm-dd  hh24:mi:ss') AND CREATEDATE <= to_date('"+FDATE2+" 23:59:59','yyyy-mm-dd  hh24:mi:ss')";
        strw2 = strw2 +" and B.CREATEDATE >= to_date('"+FDATE1+" 00:00:00','yyyy-mm-dd  hh24:mi:ss') AND B.CREATEDATE <= to_date('"+FDATE2+" 23:59:59','yyyy-mm-dd  hh24:mi:ss')";
     }
     if (DataBaseType.equals("2"))
     {
        strw1 = strw1 +" and CREATEDATE >= '"+FDATE1+" 00:00:00' AND CREATEDATE <= '"+FDATE2+" 23:59:59'";
        strw2 = strw2 +" and B.CREATEDATE >= '"+FDATE1+" 00:00:00' AND B.CREATEDATE <= '"+FDATE2+" 23:59:59'";
     }
  }



     String sqlStr = "";
     //得到查询的记录集
     flow = fm.GetFlowTransactList2(user.getUserID(),Integer.parseInt(currentPage),200,strw2);
     String strshow_data="";
     String t_data="";

     if (flow!=null && flow.length>0){


        strshow_data = strshow_data + "[";
        for(int i=0;i<flow.length;i++){

          try {
            t_data = flow[i].getID();
          }
          catch (Exception ex) {
            continue;
          }

            strshow_data = strshow_data + "[";

            strshow_data = strshow_data + "\""+flow[i].getID()+"\",";
            strshow_data = strshow_data + "\""+flow[i].getNAME()+"\",";
         if (i <flow.length-1 )
         {
            strshow_data = strshow_data + "\""+flow[i].getCREATEDATE()+"\"],\r\n";
         }else
         {
            strshow_data = strshow_data + "\""+flow[i].getCREATEDATE()+"\"]";
         }

        }

        strshow_data = strshow_data + "]";
    }else
    {
        strshow_data = "null";
    }



%>
</HEAD>
<script type="text/javascript" >
var css = "<%=user.getUserCSS()%>";
var skincss = "vista";

if (css=="Blue.css")
{skincss = "vista";}
if (css=="Public.css")
{skincss = "default";}
if (css=="Window.css" || css=="nBlue.css")
{skincss = "mac";}
if (css=="Yellow.css")
{skincss = "pink";}


var grid_demo_id = "myGrid1" ;
var show_data= <%=strshow_data%>;

var dsOption= {

	fields :[
		{name : 'ID'  },
		{name : 'NAME'  },
		{name : 'CREATEDATE'  }
	],

	recordType : 'array',
	data : show_data
}



var colsOption = [

           {id: 'ID' , header: "<center>流程运转编号</center>" , width :150 , align : 'left'  },
           {id: 'NAME' , header: "<center>流程名称/当前步骤</center>" , width :380,  align : 'center'  },
	   {id: 'CREATEDATE' , header: "<center>创建日期</center>" , width :180 ,align : 'left'  }
];


var gridOption={
	id : grid_demo_id,
	width: "99%",
	height: "92%",
	container : 'gridbox',
	replaceContainer : true,
	dataset : dsOption ,
	columns : colsOption,
	pageSize : 2000,
	toolbarContent : null,
        skin : skincss,

        onCellDblClick:function(value, record , cell, row,  colNO, rowNO,columnObj,grid){
           edit1();
        },

       showIndexColumn : true
};

<%if(!user.getUserWINDOWTYPE().equals("6")){%>

 var mygrid=new Sigma.Grid( gridOption );
 Sigma.Util.onLoad( Sigma.Grid.render(mygrid));

<%}%>




</script>
<BODY class="BodyMain">
<form name="recordfrm" action="List.jsp">
<input type="hidden" name="page">

<%if(user.getUserWINDOWTYPE().equals("6")){ %>
<br>
 &nbsp;&nbsp;流程创建日期:&nbsp;&nbsp;从<input type="text" ID="FDATE1" name="FDATE1" value="<%=FDATE1%>" size="12">
   <IMG SRC="../../images/datecal.gif" onClick="laydate({elem:'#FDATE1'});" style="margin:0px 2px -5px 0px;cursor:pointer;" alt=选择日期>
   &nbsp;&nbsp;到&nbsp;&nbsp;<input type="text" ID="FDATE2" name="FDATE2" value="<%=FDATE2%>" size="12">
   <IMG SRC="../../images/datecal.gif" onClick="laydate({elem:'#FDATE2'});" style="margin:0px 2px -5px 0px;cursor:pointer;" alt=选择日期>
<br><br>
<TABLE height='31' cellSpacing='0' cellPadding='0' border='0'>
 <TR>
 <%=userUI.ClickButton("数据查询","JavaScript:recordfrm.page.value='1';recordfrm.submit();","IcoBrowse.gif",user.getUserImage())%>
 <%=userUI.ClickButton("处理流程","JavaScript:edit1();","IcoEdit.gif",user.getUserImage())%>
 <%=userUI.ClickButton("委托办理","JavaScript:edit2();","IcoEdit.gif",user.getUserImage())%>
 <%=userUI.ClickButton("移交办理","JavaScript:edit3();","IcoEdit.gif",user.getUserImage())%>
  </tr></table>



  <div id="mianRole" style="height: 90%;overflow: auto;">
  <table class="bordered" id="html5_table">

<thead>
<tr>
<th style="width:30%;">流程运转编号</th>
<th style="width:40%;">流程名称/当前步骤</th>
<th style="width:30%;">创建日期</th>

</tr>
</thead>

<%
 if (flow!=null && flow.length>0){
        String sid= "";
        String sname= "";
        String sdate= "";
        for(int i=0;i<flow.length;i++){
          try {
            t_data = flow[i].getID();
          }
          catch (Exception ex) {
            continue;
          }
          sid=flow[i].getID();
          sname=flow[i].getNAME();
          sdate=String.valueOf(flow[i].getCREATEDATE());
%>
        <tr onclick="click_color(this,'<%=sid%>');">
        <td style="text-align:center;"><%=sid%></td>
        <td style="text-align:center;"><%=sname%></td>
        <td style="text-align:center;"><%=sdate%></td>

        </tr>

<%
        }
 }
%>

</table>
<br>
</div>

<%}else{%>


  <!--HTML Head表单头显示[显示内容，用户肤色的图片文件夹]-->
 <%=userUI.ShowHeadHtml("我的待办流程",user.getUserImage())%>
  <!--HTML 功能标题显示[显示内容,图标文件,宽度,用户肤色的图片文件夹]-->
  <%=userUI.ShowTitleHtml("","","",user.getUserImage())%>

  <td width='5' height="5"></td><td></td></TR><TR>
 <td width='5'></td><td>
   &nbsp;&nbsp;流程创建日期:&nbsp;&nbsp;从<input type="text" name="FDATE1" value="<%=FDATE1%>" size="12">
   <IMG SRC="../../images/datecal.gif" onClick="WdatePicker({el:'FDATE1'});" style="margin:0px 2px -5px 0px;cursor:pointer;" alt=选择日期>
   &nbsp;&nbsp;到&nbsp;&nbsp;<input type="text" name="FDATE2" value="<%=FDATE2%>" size="12">
   <IMG SRC="../../images/datecal.gif" onClick="WdatePicker({el:'FDATE2'});" style="margin:0px 2px -5px 0px;cursor:pointer;" alt=选择日期>

 </td></TR><TR>

<td width='5' height="5"></td><td></td></TR><TR></td>

<table height='22' border='0' cellspacing='0' cellpadding='0'><tr>
 <%=userUI.ClickButton("数据查询","JavaScript:recordfrm.page.value='1';recordfrm.submit();","IcoBrowse.gif",user.getUserImage())%>
 <%=userUI.ClickButton("处理流程","JavaScript:edit1();","IcoEdit.gif",user.getUserImage())%>
 <%=userUI.ClickButton("委托办理","JavaScript:edit2();","IcoEdit.gif",user.getUserImage())%>
 <%=userUI.ClickButton("移交办理","JavaScript:edit3();","IcoEdit.gif",user.getUserImage())%>

 </td>


<!--HTML 功能标题结束-->
<%=userUI.ShowTitleEndHtml()%>
 <!--HTML Body Start显示表单开始部分-->
  <%=userUI.ShowBodyStartHtml()%>
 <div id="gridbox" style="border:0px solid #cccccc;background-color:#f3f3f3;padding:5px;height:600px;width:800px;" ></div>
  <%=userUI.ShowFootHtml()%>

 <%}%>

    <!--执行流程异常处理-->
  <iframe id=Abnormity name=Abnormity src="../../FlowRun/FlowAbnormity.jsp" border=0 frameborder=0 width=0 height=0></iframe>

  </form>
</BODY>
<script language="JavaScript" type="text/JavaScript">
<!--
var allvalue="";
function clickValue(value){
    allvalue=value;
}
function edit1(){

   <%if(user.getUserWINDOWTYPE().equals("6")){ %>
     var strID = allvalue;

   <%}else{%>
     var allvalue = mygrid.getSelectedRecords()+",0";
     var strID = allvalue.split(",")[0];
   <%}%>

    if (strID==null||strID=="")
    {
      <%if(user.getUserWINDOWTYPE().equals("6")){ %>
         layer.alert('请先选择处理的流程!', {icon: 7});
      <%}else{%>
         alert("请先选择处理的流程!");
      <%}%>

    }else
    {



       var w,h,s;
       var MenuWindow = null;
       w = screen.availWidth - 4;
       h = screen.availHeight - 43;
       s = "directories=no,left=0,top=0,location=no,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,width=" + w + ",height=" + h;
       MenuWindow = window.open("Edit.jsp?SelectedItems="+strID,"MailWindow",s);
       MenuWindow.moveTo(-4,-4);
       MenuWindow.focus();



    }

}
function edit2(){
   <%if(user.getUserWINDOWTYPE().equals("6")){ %>
     var strID = allvalue;
   <%}else{%>
     var allvalue = mygrid.getSelectedRecords()+",0";
     var strID = allvalue.split(",")[0];
   <%}%>

   if (strID==null||strID=="")
    {
      <%if(user.getUserWINDOWTYPE().equals("6")){ %>
         layer.alert('请先选择委托办理的流程!', {icon: 7});
      <%}else{%>
         alert("请先选择委托办理的流程!");
      <%}%>

    }else
    {location.href="WTEdit.jsp?SelectedItems="+strID;}
    }

function edit3(){
   <%if(user.getUserWINDOWTYPE().equals("6")){ %>
     var strID = allvalue;
   <%}else{%>
     var allvalue = mygrid.getSelectedRecords()+",0";
     var strID = allvalue.split(",")[0];
   <%}%>


     if (strID==null||strID=="")
    {
      <%if(user.getUserWINDOWTYPE().equals("6")){ %>
         layer.alert('请先选择移交办理的流程!', {icon: 7});
      <%}else{%>
         alert("请先选择移交办理的流程!");
      <%}%>

    }else
    {location.href="YJEdit.jsp?SelectedItems="+strID;}
}
//-->
</script>
</HTML>
<%
//清空相关对象
user = null;
userUI = null;
flow = null;
fm = null;
%>
