ReportView报表开发记录(一)

在公司开发,使用到ReportView技术,写下自己的经验。

1.在工具箱中找到 ReportViewer,ScriptManager放到test.aspx页面。

如果找不到报表项,请参考http://www.cnblogs.com/worf/p/5714455.html 

 

2.添加数据集 DataSet.xsd

 

在数据集中添加DataTable,添加查询的列,列名要和数据库中的列(字段)对应。

3.添加报表Report.rdlc

4.绑定数据

在这里绑定数据使用的是动态绑定。 

 1  private void getDateBind()
 2     {
 3         //获得路径
 4         string req_url = this.Request.Url.ToString();
 5         string currentPath = "";
 6         int pos = req_url.LastIndexOf("/");
 7         if (pos > 0)
 8         {
 9             currentPath = req_url.Substring(0, pos + 1);//给报表文本框添加url
10         }
11         DataSet ds = BuildingDetails.GetIndustryHYData(time1, time2, buildingId, industryId);//从数据库中查询的数据
12         totalCount.InnerText = ds.Tables[0].Rows.Count.ToString();
13         rvBuildingDetail_IndustryHY.LocalReport.DataSources.Clear();
14         rvBuildingDetail_IndustryHY.LocalReport.DataSources.Add(new ReportDataSource("BuildingDetail_IndustryHY", ds.Tables[0]));
15         rvBuildingDetail_IndustryHY.AsyncRendering = true;
16         rvBuildingDetail_IndustryHY.InteractivityPostBackMode = InteractivityPostBackMode.AlwaysSynchronous;
17         rvBuildingDetail_IndustryHY.ShowToolBar= true;//获取或设置一个指示工具栏在控件上是否可见的值。默认为true
18         rvBuildingDetail_IndustryHY.LocalReport.EnableHyperlinks = true;//指示在报表包含超链接操作时是否可以呈现
19         rvBuildingDetail_IndustryHY.HyperlinkTarget = "_self";//在相同的框架中打开被链接文档
20         rvBuildingDetail_IndustryHY.LocalReport.ReportPath = @"BuildingDetail\rdlc\BuildingDetail_IndustryHY.rdlc";//获取或设置本地报表的本地文件系统路径
21         rvBuildingDetail_IndustryHY.LocalReport.ReportEmbeddedResource = "BuildingDetail_IndustryHY.rdlc";//获取或设置报表嵌入资源的名称
22 
23         //设置参数
24         ReportParameter rpCurrentPath = new ReportParameter("url", currentPath);
25         ReportParameter rpTime1 = new ReportParameter("time1", time1);
26         ReportParameter rpTime2 = new ReportParameter("time2", time2);
27         ReportParameter rpIndustryId = new ReportParameter("industryId", industryId);
28         ReportParameter rpBuildingId = new ReportParameter("buildingId", buildingId);
29         rvBuildingDetail_IndustryHY.LocalReport.SetParameters(new ReportParameter[] { rpCurrentPath, rpCurrentPath, rpTime1, rpTime2, rpIndustryId, rpBuildingId });
30     }
到此,整个流程完成。

 

转载于:https://www.cnblogs.com/worf/p/5893436.html

初学oracle报表开发笔记 -- process report output('<HTML xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel">'); output('<head>'); output('<title>库存现有量报表</title>'); output('<style>'); output('body,table{font-size:13px;font-family:"Book Antiqua","Segoe UI", Tahoma, "Trebuchet MS", verdana, helvetica, arial, sans-serif, Georgia;}.text {mso-number-format:"\@";}.retnum {mso-number-format:"0\.00";}'); output('</style>'); output('</head>'); output('<body>'); output('<h2 align=center><B>库存现有量报表</B></h2>'); output('<table width=600 border=0 bordercolor=black>'); output(' <tr>'); output('<th align=right>OU:</th>'); output('<td align=left>' || g_ou_name || '</td>'); output('<th align=right>组织:</th>'); output('<td align=left>' || l_organization_name || '</td>'); output(' </tr>'); output('</table>'); output('<table width=1800 border=1 bordercolor=black>'); output(' <tr>'); output('<th rowspan=1 width=50>库存组织编码</th>'); output('<th rowspan=1 width=50>库存组织说明</th>'); output('<th rowspan=1 width=50>子库编码</th>'); output('<th rowspan=1 width=50>子库说明</th>'); output('<th rowspan=1 width=50>物品编码</th>'); output('<th rowspan=1 width=50>物品说明</th>'); output('<th rowspan=1 width=50>批次</th>'); output('<th rowspan=1 width=50>库存量 </th>'); output('<th rowspan=1 width=50>最小库存量</th>'); output('<th rowspan=1 width=50>最大库存量</th>'); output(' </tr>'); FOR cl IN (select OOD.ORGANIZATION_CODE, --库存组织编码 OOD.ORGANIZATION_NAME, --库存组织说明 MSA.SECONDARY_INVENTORY_NAME subinventory_code, --子库编码 MSA.DESCRIPTION subinventory_name, --子库说明 MSIV.SEGMENT1 item_no, --物品编码 MSIV.DESCRIPTION item_desc, --物品说明 MOQD.LOT_NUMBER, --批次 sum(MOQD.Primary_Transaction_Quantity) Primary_Transaction_Quantity, --库存量 MSIV.MIN_MINMAX_QUANTITY, --最小库存量 MSIV.MAX_MINMAX_QUANTITY --最大库存量 from mtl_onhand_quantities_detail moqd, ORG_ORGANIZATION_DEFINITIONS OOD, mtl_subinventories_all_v MSA, MTL_SYSTEM_ITEMS_VL MSIV where moqd.inventory_item_id = msiv.INVENTORY_ITEM_ID and moqd.organization_id = msiv.ORGANIZATION_ID and moqd.organization_id = ood.ORGANIZATION_ID and moqd.subinventory_code = msa.SECONDARY_INVENTORY_NAME and moqd.organization_id = msa.ORGANIZATION_ID group by OOD.ORGANIZATION_CODE, OOD.ORGANIZATION_NAME, MSA.SECONDARY_INVENTORY_NAME, MSA.DESCRIPTION, MSIV.SEGMENT1, MSIV.DESCRIPTION, MOQD.LOT_NUMBER, MSIV.MIN_MINMAX_QUANTITY, MSIV.MAX_MINMAX_QUANTITY) LOOP output(' <tr>'); output(' <td align=left><font size=1>' || cl.ORGANIZATION_CODE || '</font></td>'); output(' <td align=left><font size=1>' || cl.ORGANIZATION_NAME || '</font></td>'); output(' <td align=left><font size=1>' || cl.subinventory_code || '</font></td>'); output(' <td align=left><font size=1>' || cl.subinventory_name || '</font></td>'); output(' <td align=left><font size=1>' || cl.item_no || '</font></td>'); output(' <td align=left><font size=1>' || cl.item_desc || '</font></td>'); output(' <td align=left><font size=1>' || cl.LOT_NUMBER || '</font></td>'); output(' <td align=left><font size=1>' || cl.Primary_Transaction_Quantity || '</font></td>'); output(' <td align=left><font size=1>' || cl.MIN_MINMAX_QUANTITY || '</font></td>'); output(' <td align=left><font size=1>' || cl.MAX_MINMAX_QUANTITY || '</font></td>'); output(' </tr>');
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值