打印
若此页有一个打印按钮:
<input type="button" id="btnPrint" class="button_sm7" value="打印" onclick="PrintDep();" />
JS连接到打印页问号后边是传参数,是在此页的查询条件:
function PrintDep() {
            window.open('Print.aspx?txtUName=' + escape($("#txtUName").val()) + '&ddlDep=' + escape($("#ddlDep").val()) + '&ddlClass=' + escape($("#ddlClass").val()) + '&ddlIYear=' + escape($("#ddlIYear").val()), '_blank')
        }
Print.aspx(显示的是要打印的数据):

<head id="Head1" runat="server">
    <title>。。。。打印</title>
    <script type="text/javascript" src="../Page/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="../Page/js/hide_show.js"></script>
    <link href="../Page/css/layout.css" rel="stylesheet" type="text/css" />
    <link href="../Page/css/Dialog.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../Page/js/jQuery_Dialog.js"></script>
    <script type="text/javascript" src="../Page/js/function.js"></script>
    <script type="text/javascript" src="../Page/js/jquery.easydrag.js"></script>
    <link href="../Page/css/style01.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">

<div class="div_page_bottom_operation" style="text-align: center; display: '';">
        <input type="button" class="button_sm7" value="打印" onclick="PrintSalary();" />
    </div>
    <div style="width: 96%; margin: 0 auto;font-size:24px;" align="center" >
        。。查询
    </div>

<div style="overflow: auto; width: 96%; margin: 0 auto;">
      <table class="table">
            <thead>
                <tr>
                    <th style="width: 60px" rowspan="2">
                        序号
                    </th>
                    <th rowspan="2">
                        。。
                    </th>
                    <th rowspan="2">
                        。。
                    </th>
                    <th rowspan="2">
                        。。
                    </th>
                    <th rowspan="2">
                        。。
                    </th>
                    <th rowspan="2">
                        。。
                    </th>
                    <th rowspan="2">
                        。。
                    </th>
                    <th rowspan="2">
                        。。
                    </th>
                    <th colspan="4" style="text-align: center;">
                        。。
                    </th>
                </tr>
                <tr>
                    <th>
                        。。
                    </th>
                    <th>
                        。。
                    </th>
                    <th>
                        。。
                    </th>
                    <th>
                        。。
                    </th>
                </tr>
            </thead>
            <tbody>
                <asp:Repeater ID="rptStudentFee" runat="server">
                    <ItemTemplate>
                        <tr>
                            <td>
                                <%#Eval("r_n") %>
                            </td>
                            <td>
                                <%#Eval("Department") %>
                            </td>
                            <td>
                                <%#Eval("CName") %>
                            </td>
                            <td>
                                <%#Eval("TTCard") %>
                            </td>
                            <td>
                                <%#Eval("UName") %>
                            </td>
                            <td>
                                <%#DigitalCampus.Web.Common.pfunction.getPBCName(DigitalCampus.Web.Common.clsDictionaryData.Gender.ToString(),Eval("Gender").ToString()) %>
                            </td>
                            <td>
                                <%#DigitalCampus.Web.Common.pfunction.GetStrToShortDate(Eval("AdmissionDate").ToString())%>
                            </td>
                            <td>
                                <%#Eval("UName") %>
                            </td>
                            <td>
                                <%#Eval("SubYear")%>
                            </td>
                            <td>
                                <%#Eval("ShouldPayment")%>
                            </td>
                            <td>
                                <%#Eval("ActualPayment")%>
                            </td>
                            <td>
                                <%#Decimal.Parse(Eval("ShouldPayment").ToString()) - Decimal.Parse(Eval("ActualPayment").ToString())%>
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
                <asp:Repeater runat="server" ID="rptCount">
                    <ItemTemplate>
                        <tr style="font-weight: bold;">
                            <td>
                                合计
                            </td>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                               ¥ <%#Eval("ShouldPayment") %>
                            </td>
                            <td>
                               ¥ <%#Eval("ActualPayment")%>
                            </td>
                            <td>
                               ¥ <%#Decimal.Parse(Eval("ShouldPayment").ToString()) - Decimal.Parse(Eval("ActualPayment").ToString())%>
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:Repeater>
            </tbody>
        </table>
    </div>
     <script type="text/javascript" language="javascript">
         function PrintSalary() {
             $(".div_page_bottom_operation").hide();
             window.print();
         }
    </script>
    </form>
</body>
</html>

Print.aspx.cs(后台查询出数据):
       
        //查询参数
        public string txtUName = string.Empty;
        public string ddlDep = string.Empty;
        public string ddlClass = string.Empty;
        public string ddlIYear = string.Empty;

protected void Page_Load(object sender, EventArgs e)
        {
            txtUName = Request.QueryString["txtUName"];
            ddlDep = Request.QueryString["ddlDep"];
            ddlClass = Request.QueryString["ddlClass"];
            ddlIYear = Request.QueryString["ddlIYear"];

if (!IsPostBack)
            {
                GetFilesList();
            }
        }

private void GetFilesList()
        {
            string sort = "";
            string strWhere = " where 1=1 ";
            if (!string.IsNullOrEmpty(txtUName) && txtUName != "。。")
            {
                strWhere += " and (vw.UName like '%" + txtUName+ "%' or vw.IdentityCard like '%" + txtUName + "%' or vw.TTCard like '%" + txtUName + "%')";
            }
            if (ddlDep != "-1")
            {
                strWhere += " and vw.DepName='" + ddlDep + "'";
            }
            if (ddlClass != "-1")
            {
                strWhere += " and vw.ClassName='" + ddlClass + "'";
            }
            if (ddlIYear != "-1")
            {
                strWhere += " and sp.SubYear='" + ddlIYear + "'";
            }

string strSql = @"select row_number() over(order by sp.SubYear,vw.DepName,vw.ClassName,vw.UName) as r_n,sp.*,vw.*
                             from (select StuID,SubYear,isnull(sum(ShouldPayment),0) ShouldPayment,isnull(sum(ActualPayment),0)
                             ActualPayment from StudentShouldpay group by StuID,SubYear) sp inner join dbo.vw_StudentInfo vw on sp.StuID=vw.ID " + strWhere;
            DataTable dt = sys.GetRecordByPage(strSql, pNum, pSize, sort, out rCount, out pCount).Tables[0];
            rptStudentFee.DataSource = dt;
            rptStudentFee.DataBind();
            if (dt.Rows.Count > 0)
            {
                DataTable dt2 = new DataTable();
                dt2 = DbHelperSQL.Query(@"select isnull(sum(ShouldPayment),0) ShouldPayment,isnull(sum(ActualPayment),0) ActualPayment from (select StuID,SubYear,isnull(sum(ShouldPayment),0) ShouldPayment,isnull(sum(ActualPayment),0) ActualPayment from StudentShouldpay group by StuID,SubYear) sp inner join dbo.vw_StudentInfo vw on sp.StuID=vw.ID " + strWhere).Tables[0];
                rptCount.DataSource = dt2;
                rptCount.DataBind();
            }

}

点击Print.aspx页的打印就可打印出

OA项目之打印的更多相关文章

  1. 【Java EE 学习 67 上】【OA项目练习】【JBPM工作流的使用】

    OA项目中有极大可能性使用到JBPM框架解决流程控制问题,比如请假流程.报销流程等等. JBPM:JBoss Business Process Management,翻译过来就是业务流程管理.实际上就 ...

  2. 第一周博客之二---OA项目环境搭建及开发包部署

    OA项目环境搭建 一个项目想要能够在开发人员打包好项目包之后进行测试,就必须进行项目测试环境的搭建,要根据开发工程师的开发环境采用不同的测试环境,以下只是浅谈下Java项目OA(办公自动化平台)的环境 ...

  3. [deviceone开发]-企业OA项目开源分享

    一.简介 是一个真实的企业OA项目改造的开源项目,几乎涵盖了所有常用的组件,包括环信实现在线聊天等功能,类似微信的朋友圈功能,自定义的智能搜索等,而且这个是真实的通过Http链接后台web服务,里面很 ...

  4. 01传智_jbpm与OA项目_整体项目架构

    oA项目: 项目结构如下:

  5. 基于SSH2的OA项目1.0_20161206_需求分析与框架搭建

    1. SSH项目 OA项目,办公自动化,将公司的数据,文档,流程实现在系统中的管理. 降低人员交流过程中的成本.提高办公的效率. 2 .系统管理 主要实现系统权限的管理,不同的用户登陆后看到菜单项不一 ...

  6. OA项目实战(二) 开发准备

    上次的博文OA系统实践(一) 概述中,我们已经了解了OA的相关概念.从本次博文开始,我们做一个简单的OA实例. 在OA开发之前,有几个工作们需要提前做.一个是对需求进行分析,另一个是对开发环境进行选择 ...

  7. OA项目_环境搭建

    OA项目现在要做成微服务,用的框架是springboot,所用的编程工具是idea,maven,做为一个程序员最关心的就是我需要在那个架包中编写代码,我们只需关注domain,repository,s ...

  8. 修改struts2自定义标签的源代码,在原有基础上增加功能(用于OA项目权限判断,是否显示某个权限)

    OA项目在做权限判断时  原始方式: 现在完成的功能 :通过改变struts2自定标签源代码   在原有的基础上  增加判断权限的功能  而页面上使用标签的方式 还是下图 步骤: 打开文件 搜索< ...

  9. 搭建OA项目环境及卸载指南

    一.项目介绍 1).JDK是什么? 全称:Java Development Kit 中文名:java开发工具包 作用:提供java项目的运行环境         JDK安装 a.jdk.jre 安装 ...

随机推荐

  1. Looper、Hander、HandlerThread

    一.Message .Looper.Handler之间的关系 1.系统发送的Message消息传送给Handler,Handler将Message放入自己的looper队列的底部   然后再从Loop ...

  2. php 数据结构 hash表

    hash表 定义 hash表定义了一种将字符组成的字符串转换为固定长度(一般是更短长度)的数值或索引值的方法,称为散列法,也叫哈希法.由于通过更短的哈希值比用原始值进行数据库搜索更快,这种方法一般用来 ...

  3. cordova开发中遇到的一些坑

    # 外域的JS被禁止,修改meta标签 <meta http-equiv="Content-Security-Policy" content="default-sr ...

  4. [LeetCode]题解(python):004-Median of Two Sorted Arrays

    题目来源: https://leetcode.com/problems/median-of-two-sorted-arrays/ 题意分析: 这道题目是输入两个已经排好序的数组(长度为m,n),将这两 ...

  5. SQL Server 数据库状态选项

    选项 1. single_user(单用户),multi_user(多用户),restricted_user(受限用户); 描述数据库的用户访问属性,它们互斥,设置其中任何一个选项就会取消对其它选项的 ...

  6. Android05-UI02布局,自定义控件,ListView

    1.布局 布局的内部除了放置控件外,也可以放置布局,通过多层布局的嵌套,我们就能够完成一些 比较复杂的界面实现 ¨四种基本布局 LinearLayout RelativeLayout FrameLay ...

  7. 重启VirtualBox里面的系统提示VT-x features locked or unavailable in MSR错误

    有次不小心设置了一下virtualbox里面的一些配置,然后启动系统时出现了如下提示 在网上找了一些资料尝试了一些方法偶然有一次成功 原来是自己把那个cpu个数设置成了2,改成1就好了,不知道为什么做 ...

  8. Ajax学习教程在线阅读

      1.什么是AJAX ?(1) 2.什么是AJAX ?(2) 3.什么是AJAX ?(3) 4.什么是AJAX ?(4) 5.Ajax基础教程(1)-Ajax简介 1.1 Web应用简史 6.Aja ...

  9. AndroidUI 布局动画-为布局添加动画

    除了可以为视图添加动画以外,还可以为视图的布局添加动画: <RelativeLayout xmlns:android="http://schemas.android.com/apk/r ...

  10. magento中取不同store中的产品数据

    $products = Mage::getResourceModel('catalog/product_collection')                    ->setStoreId( ...