<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DuoYeDaYin.aspx.cs" Inherits="Emr_bs.main.DuoYeDaYin" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>多页打印</title>
    <style type="text/css">

.tr_top{
 background-image:url(../main/image/tab_bg.jpg);
 background-repeat:repeat-x;
 border-right-style: none;
 text-align: center;
 text-indent: 5px;
}
        </style>
        <script type="text/javascript" src="../public/jquery-1.4.2.min.js"></script>
        <script type="text/javascript">
        var tempPatient_id ="";
        var tempVisit_id ="";
var  tempFileExec="";
 var temptotal=0;
      var intervalID,j=0;
        $(document).ready(function(){
            var    obj    =    window.dialogArguments  
            tempPatient_id=obj.patient_id;
            tempVisit_id =obj.visit_id;
            $("#BtAll").click(function(){
            $("[type='checkbox']").attr("checked","true");//取消全选
            }) ;

            $("#BtQuXiao").click(function(){
            $("[type='checkbox']").removeAttr("checked");//取消全选
            }) ;
            //绑定打印
            $("#BtPrint").click(function(){
              var str="";
             j=0;tempFileExec="";
              $("#BtPrint").attr("disabled",true);  
              $("#idtotal").html(1);          
             if(intervalID.length<1){
              intervalID=window.setInterval("FunDemo('a')",10);
              }
                try
                {
                temptotal =$("[type=checkbox]:checked").length;
                $("#idAllCount").html(temptotal);
                $("[type=checkbox]:checked").each(function(){
                var tempFile = $("#"+$(this).attr("id").replace("IDNum","IDEmr_File_Name")).val();          
                LoadFile(tempPatient_id,tempVisit_id,tempFile);
                });
                }
                catch(e)
                {
                alert(e.message);
                }
               
            });
        });
        function getCheck()
        {
         
 

        }
        function LoadFile(tempPatient_id,tempVisit_id,tempfileName)
        {
        var dataReturn = "";
         $.ajax({  
                    type:"GET",
                    url : "DuoYeDaYin.aspx",
                    dataType:"json", 
                    data:{isAjax:"true",action:"pdf",patient_id:tempPatient_id,visit_id:tempVisit_id,pdfpath:tempfileName},
                    complete: function(XMLHttpRequest, textStatus){
                         //alert(XMLHttpRequest.responseText);
                        var data1 =eval("("+XMLHttpRequest.responseText+")");
                        dataReturn= data1.urls;
                     // alert("dataReturn:"+dataReturn);
//                            YCanPDF.Zoom=1;// 按照PDF原始界面大小显示
//                            var n=YCanPDF.SetURL(dataReturn,"");// 打开网络的PDF文件,只支持绝对路径
//                            if(n==0)
//                            {
//                            // YCanPDF.PrintNoDlg('Print',1,YCanPDF.MaxPage,1,2,1);
//                              YCanPDF.CloseFile();
//                            }
                      tempFileExec+="YCanPDF.Zoom=1;var n=YCanPDF.SetURL('"+dataReturn+"','');if(n==0){ YCanPDF.PrintNoDlg('Print',1,YCanPDF.MaxPage,1,2,1);YCanPDF.CloseFile();};$('#idtotal').html('"+(++j)+"');";//$('#idtotal').html('"+tempstatus+"');
                     
                         //$("#idtotal").html(j);
                        }
                   
                });  
                return dataReturn;

        }
 
  
       
        function FunDemo(a)
        {
    
        if(j==temptotal){
         //  alert("print");
        eval(tempFileExec);
        //alert(tempFileExec);
        window.clearTimeout( intervalID );
        intervalID="";
      $("#BtPrint").attr("disabled",false);
        }
     //   $("#idtotal").html(j);
        } 
        intervalID=window.setInterval("FunDemo('a')",10);
     
        </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
    <asp:GridView ID="gvList" runat="server"
                        BorderColor="#93B6E3" BorderWidth="0px" Font-Size="Small" ForeColor="#333333"
                        Height="32%" OnRowDataBound="gvList_RowDataBound"
        Width="100%" AutoGenerateColumns="False"
       >
                        <FooterStyle BackColor="#A6A1E0" Font-Bold="True" ForeColor="White" />
                   <Columns>
                            <asp:TemplateField HeaderText="编号">
                                <ItemTemplate>
                            <asp:CheckBox ID="IDNum" runat="server"  Checked="true" />
                            <asp:HiddenField ID="IDEmr_File_Name" runat="server" Value='<%#Eval("EMR_FILE_NAME")%>' />
                                </ItemTemplate>
                           
                            </asp:TemplateField>
                              <asp:BoundField DataField="Patient_ID" HeaderText="病人编号" />
                                <asp:BoundField DataField="visit_id" HeaderText="住院次数" />
                              <asp:TemplateField HeaderText="类别">
                                <ItemTemplate>
                                    <%#Eval("MR_CLASS")%>                            
                                </ItemTemplate>
                            </asp:TemplateField>
                               <asp:TemplateField HeaderText="名称">
                                <ItemTemplate>
                                    <%#Eval("TOPIC")%>                            
                                </ItemTemplate>
                            </asp:TemplateField>
                               <asp:TemplateField HeaderText="标识">
                                <ItemTemplate>
                                    <%#Eval("ARCHIVE_KEY")%>                            
                                </ItemTemplate>
                            </asp:TemplateField>                         
                        </Columns>
                        <RowStyle BackColor="White" Font-Bold="True" Font-Size="Small" ForeColor="#003399"
                            HorizontalAlign="Center" />
                        <EditRowStyle BackColor="#999999" />
                        <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
                        <PagerStyle BackColor="#337FB2" ForeColor="White" HorizontalAlign="Center" VerticalAlign="Middle" />
                        <HeaderStyle BackColor="#B5D1F6" Font-Size="12px" ForeColor="White" HorizontalAlign="Center"
                            VerticalAlign="Middle"  CssClass="tr_top"  Height="25px" />
                         
                        <AlternatingRowStyle BackColor="#E8F4FF" Font-Bold="True" Font-Size="Small" HorizontalAlign="Center"/>
                    </asp:GridView>
   
    </div>
    </form>
     <object id="YCanPDF" classid="clsid:474C1AB2-EFA5-4A19-9267-BA38B685C74A" codebase="pdfview.cab#version=1,7,6,2"  width = 0 height = 0 >
      </object>
     
    <p>
    <table style="width:100%;height:24px"><tr>
    <td width="20%"> 打印第<span id="idtotal"></span>个</td>  
    <td width="20%"> 共<span id="idAllCount"></span>个</td>
    <td width="60%"></td>
    </tr></table>
  
        <input id="BtPrint" type="button" value="打印选择病历文件"/>&nbsp;&nbsp;&nbsp;
        <input
            id="BtAll" type="button" value="全选" />&nbsp;&nbsp; <input id="BtQuXiao"
            type="button" value="反选" /></p>
   
       
</body>
</html>

posted on 2010-09-25 17:14 sanmao 阅读(72) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航:
 

常用链接

留言簿(5)

随笔分类

随笔档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜