文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>用javascript 动态添加部门和人员

用javascript 动态添加部门和人员

时间:2010-09-17  来源:王红福

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="QueryByUserIDForAdmin.aspx.cs" Inherits="OpenServer.QueryByUserIDForAdmin"   %>

<html>
<head id="Head1" runat="server">
    <link type="text/css" href="jquery-ui/themes/base/jquery.ui.all.css" rel="stylesheet" />
 <script type="text/javascript" src="jquery-ui/jquery-1.4.2.js"></script>
  <script type="text/javascript" src="jquery-ui/report.js"></script>
 <script type="text/javascript" src="jquery-ui/ui/jquery.ui.core.js"></script>
 <script type="text/javascript" src="jquery-ui/ui/jquery.ui.widget.js"></script>
 <script type="text/javascript" src="jquery-ui/ui/jquery.ui.datepicker.js"></script>
    <link href="jquery-ui/demos/demos.css" rel="stylesheet" type="text/css" />
    <script src="jquery-ui/ui/i18n/jquery.ui.datepicker-zh-CN.js" type="text/javascript"></script>
    <script  type="text/javascript">
        var url = "";
        function window.onload() {
            var date = new Date();
            var year = date.getYear();
            var month = date.getMonth() + 1;

            var day = date.getDate();
            if (day < 10) {
                day = "0" + day.toString();
            }
            if (month < 10) {
                month = "0" + month.toString();
            }

            var rq = year.toString() + "-" + month.toString() + "-" + day.toString();

 

            document.getElementById('tb_qsrq').value = rq;
            document.getElementById('tb_jzrq').value = rq;
            document.getElementById('img_load').style.display = "none";

            var xml = "" +
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
"  <soap:Header>" +
"    <CrmAuthenticationToken xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
"      <AuthenticationType xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">0</AuthenticationType>" +
"      <OrganizationName xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">SZYQ</OrganizationName>" +
"      <CallerId xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">00000000-0000-0000-0000-000000000000</CallerId>" +
"    </CrmAuthenticationToken>" +
"  </soap:Header>" +
"  <soap:Body>" +
"    <RetrieveMultiple xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
"      <query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:QueryExpression\">" +
"        <q1:EntityName>businessunit</q1:EntityName>" +
"        <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" +
"          <q1:Attributes>" +
"            <q1:Attribute>name</q1:Attribute>" +
"            <q1:Attribute>businessunitid</q1:Attribute>" +
"            <q1:Attribute>websiteurl</q1:Attribute>" +
"          </q1:Attributes>" +
"        </q1:ColumnSet>" +
"        <q1:Distinct>false</q1:Distinct>" +
"      </query>" +
"    </RetrieveMultiple>" +
"  </soap:Body>" +
"</soap:Envelope>" +
"";

            var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");

            xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
            xmlHttpRequest.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple");
            xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
            xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
            xmlHttpRequest.send(xml);

            var resultXml = xmlHttpRequest.responseXML;


            var myOption = new Option();
            myOption.text = "-----请选择部门----";
            myOption.value = "none";
            document.getElementById("bm").options[0] = myOption;

 

            var entities = resultXml.getElementsByTagName("BusinessEntity");
            for (var i = 0; i < entities.length; i++) {
                var myOption = new Option();
                myOption.text = entities[i].selectSingleNode("q1:name").text;
                myOption.value = entities[i].selectSingleNode("q1:businessunitid").text;
                if (entities[i].selectSingleNode("q1:websiteurl") == null)
                    continue;
                url = entities[i].selectSingleNode("q1:websiteurl").text;

                document.getElementById("bm").options[i + 1] = myOption;

            }
        }
        function DisPlay() {
            //document.getElementById('<%=this.bt_query.ClientID %>') = true;
            var width = document.getElementById("bt_query").offsetLeft;

            var top = document.getElementById("bt_query").offsetTop;


            document.getElementById('img_load').style.display = "block"
            document.getElementById('img_load').style.top = "50%";
            document.getElementById('img_load').style.left = "50%"
            document.getElementById('img_load').style.position = "absolute";
        }

        function GetSelectValue(obj) {
            var entityID = obj.value;

            var xml = "" +
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
"  <soap:Header>" +
"    <CrmAuthenticationToken xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
"      <AuthenticationType xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">0</AuthenticationType>" +
"      <OrganizationName xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">SZYQ</OrganizationName>" +
"      <CallerId xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">00000000-0000-0000-0000-000000000000</CallerId>" +
"    </CrmAuthenticationToken>" +
"  </soap:Header>" +
"  <soap:Body>" +
"    <RetrieveMultiple xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
"      <query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\" xsi:type=\"q1:QueryByAttribute\">" +
"        <q1:EntityName>systemuser</q1:EntityName>" +
"        <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" +
"          <q1:Attributes>" +
"            <q1:Attribute>fullname</q1:Attribute>" +
"            <q1:Attribute>businessunitid</q1:Attribute>" +
"            <q1:Attribute>domainname</q1:Attribute>" +
"          </q1:Attributes>" +
"        </q1:ColumnSet>" +
"        <q1:Attributes>" +
"          <q1:Attribute>businessunitid</q1:Attribute>" +
"        </q1:Attributes>" +
"        <q1:Values>" +
"          <q1:Value xsi:type=\"xsd:string\">" + entityID + "</q1:Value>" +
"        </q1:Values>" +
"      </query>" +
"    </RetrieveMultiple>" +
"  </soap:Body>" +
"</soap:Envelope>" +
"";

            var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");

            xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
            xmlHttpRequest.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple");
            xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
            xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
            xmlHttpRequest.send(xml);

            var resultXml = xmlHttpRequest.responseXML;

            var entities = resultXml.getElementsByTagName("BusinessEntity");


            var myOption = new Option();
            myOption.text = "----请选择人员----";
            myOption.value = "all";
            document.getElementById("user").options[0] = myOption;

            for (var i = 0; i < entities.length; i++) {
                var myOption = new Option();
                myOption.text = entities[i].selectSingleNode("q1:fullname").text
                if (entities[i].selectSingleNode("q1:domainname") == null) continue;
                myOption.value = entities[i].selectSingleNode("q1:domainname").text;
                document.getElementById("user").options[i + 1] = myOption;


            }


            document.getElementById("user").options.length = entities.length + 1;
        }

        $(function() {
            $('#tb_qsrq').datepicker({
                changeMonth: true,
                changeYear: true
            });
        });
        $(function() {
            $('#tb_jzrq').datepicker({
                changeMonth: true,
                changeYear: true
            });
        });
        function DisPlay2() {


            var userid = $("#user").val();
            var qsrq = $("#tb_qsrq").val();
            var jzrq = $("#tb_jzrq").val();
            var jfzl = $("#jfzl").val();

            var xml = getXML(userid, qsrq, jzrq, jfzl)
            $.get(url.replace(";", "?") + xml, function(data) { callBack(data) });
        }
   </script>
 
     <meta http-equiv="Content-Type" content="text/html; CHARSET=UTF-8" />
    <link rel="stylesheet" type="text/css" href="template.css">
    <title>统计查询</title>
</head>
<body>
    <form id="form1" runat="server">

    <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
        <tbody>
      
            <tr>
                <td style="padding: 10px;">
                    <table cellspacing="0" cellpadding="0" width="100%" height="100%">
                        <tbody>
                            <tr>
                                <td>
                                    <div style="display: inline" class="tab">
                                        <table style="table-layout: fixed" cellspacing="0" cellpadding="3" width="100%" height="100%">
                                            <colgroup>
                                                <col width="90">
                                                <col>
                                                <col width="10">
                                                <col width="90">
                                                <col>
                                            </colgroup>
                                            <tbody>
                                            <tr>
                                                    <td class="sec bar" colspan="5">
                                                        个人缴费统计
                                                    </td>
                                                </tr>
                                                  <tr>
                                                    <td class="sec bar" colspan="5">
                                                        查询条件                                                     </td>
                                                </tr>
                                            
                                                <tr>
                                                    <td>
                                                        所在部门
                                                    </td>
                                                    <td colspan="4" >
                                               <select style="width: 100%; font-family: tahoma,
                             Arial; font-size: 11px" class="selectBox"  id="bm"  onclick="GetSelectValue(this)">
  </select></td>
 
                                                </tr>
                                                 <tr>
                                                    <td>
                                                        操作人员
                                                    </td>
                                                    <td colspan="4" >
                                                     <select width="100%"style="width: 100%; font-family: tahoma,
                             Arial; font-size: 11px" id="user" name="user" class="selectBox" >    <option>-----请先选择部门-----</option>
  </select>
  
                                                      </td>
                                                </tr>
                                                 <tr>
                                                    <td>
                                                        缴费种类
                                                    </td>
                                                    <td colspan="4" >
                                                     <select width="100%"style="width: 100%; font-family: tahoma,
                             Arial; font-size: 11px" id="jfzl" name="user" class="selectBox" >    <option value="" selected>-----所有收费-----</option> <option value="00010" >-----会员系统收费-----</option> <option value="00001" >-----老缴费系统收费-----</option>
  </select>
  
                                                      </td>
                                                </tr>
                                            
                                                <tr height="5">
                                                    <td>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                       起始日期</td>
                                                    <td>
                                                        <input id="tb_qsrq" class="inputfields" tabindex="8" maxlength="250" name="qsrq">
                                                    </td>
                                                    <td>
                                                    </td>
                                                    <td>
                                                        截止日期</td>
                                                    <td>
                                                        <input id="tb_jzrq" class="inputfields" tabindex="9" maxlength="250" name="jzrq">
                                                    </td>
                                                </tr>
                                                <tr>
                                               <td>
            <a href="javascript:void()" onclick="DisPlay2()" >查询</a>
           
                                                     <asp:Button ID="bt_query" runat="server" onclick="bt_query_Click1" Text="查询" OnClientClick="DisPlay()"  Visible="false" />
                                                 
                                                    </td>
                                               
                                                </tr>
                                                <tr>
                                                    <td height="100%" colspan="5">
                                                     <div id="img_load"  class="psdthumb"><div class="qq"><img src="images/2008228102611_08_mb5u_com.gif" ></div></div>
                                                      <div id="report">
               <div>
              <%=html %>
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
            <tr height="23">
                <td class="statusbar" colspan="2">
                    &nbsp;</td>
            </tr>
        </tbody>
    </table>
    </form>
</body>
</html>

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载