新增RS報表詳細過程

1.確定報表名稱,準備好報表欄位、報表欄位所在數據庫表的字段名、報表的英文代號(目錄名+Of+英文名)

2.寫出準確的sql語句

select pmm01, pmm04, ima01, pmn20, pmn02, pmn50, pmm12,pmm27 from pmm_file, pmn_file, ima_file where pmm01=pmn01 and pmn04=ima01(+)

3.在webreport中的App_Data中的GridColumns.xml里新增報表的欄位信息

4.在報表所在目錄(Purchase)下編寫報表的顯示頁PurchaseOfClosed.aspx

<%@ Page Title="PurchaseOfClosed" Language="C#" MasterPageFile="~/Site1.Master"
AutoEventWireup="true" CodeBehind="PurchaseOfClosed.aspx.cs" Inherits="WebReport.Purchase.PurchaseOfClosed" %>
<%@ MasterType VirtualPath="~/Site1.Master" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v9.3, Version=9.3.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<table border="0" cellpadding="5" width="100%">
<tr>
<td>採購單號</td>
<td>
<asp:TextBox ID="txtID" runat="server" CssClass="userinput Width="110px" ></asp:TextBox>
</td>
<td>
<asp:CheckBox ID="chkDate" runat="server" Text="採購日期" Checked="true" />
</td>
<td>
<dx:ASPxDateEdit ID="startDate" runat="server" CssFilePath="~/App_Themes/Aqua/{0}/styles.css"
CssPostfix="Aqua" ShowShadow="False" SpriteCssFilePath="~/App_Themes/Aqua/{0}/sprite.css"
Width="110px">
<CalendarProperties>
<HeaderStyle Spacing="1px" />
<FooterStyle Spacing="17px" />
</CalendarProperties>
<DropDownButton>
<Image>
<SpriteProperties HottrackedCssClass="dxEditors_edtDropDownHover_Aqua" PressedCssClass="dxEditors_edtDropDownPressed_Aqua" />
</Image>
</DropDownButton>
<ValidationSettings>
<ErrorFrameStyle ImageSpacing="4px">
<ErrorTextPaddings PaddingLeft="4px" />
</ErrorFrameStyle>
</ValidationSettings>
</dx:ASPxDateEdit>
</td>
<td>至</td>
<td>
<dx:ASPxDateEdit ID="endDate" runat="server" CssFilePath="~/App_Themes/Aqua/{0}/styles.css"
CssPostfix="Aqua" ShowShadow="False" SpriteCssFilePath="~/App_Themes/Aqua/{0}/sprite.css"
Width="110px">
<CalendarProperties>
<HeaderStyle Spacing="1px" />
<FooterStyle Spacing="17px" />
</CalendarProperties>
<DropDownButton>
<Image>
<SpriteProperties HottrackedCssClass="dxEditors_edtDropDownHover_Aqua" PressedCssClass="dxEditors_edtDropDownPressed_Aqua" />
</Image>
</DropDownButton>
<ValidationSettings>
<ErrorFrameStyle ImageSpacing="4px">
<ErrorTextPaddings PaddingLeft="4px" />
</ErrorFrameStyle>
</ValidationSettings>
</dx:ASPxDateEdit>
</td>
</tr>
<tr>
<td>採購人員</td>
<td>
<asp:TextBox ID="txtUser" runat="server" CssClass="userinput" Width="110px" ></asp:TextBox>
</td>
<td>採購結案</td>
<td>
<dx:ASPxComboBox ID="cmbType" runat="server" CssFilePath="~/App_Themes/Aqua/{0}/styles.css"
CssPostfix="Aqua" LoadingPanelImagePosition="Top" SelectedIndex="0" ShowShadow="False"
SpriteCssFilePath="~/App_Themes/Aqua/{0}/sprite.css" ValueType="System.String"
Width="110px">
<LoadingPanelImage Url="~/App_Themes/Aqua/Editors/Loading.gif">
</LoadingPanelImage>
<Items>
<dx:ListEditItem Selected="True" Text="顯示全部" Value="0" />
<dx:ListEditItem Text="已結案" Value="1" />
<dx:ListEditItem Text="未結案" Value="2" />
</Items>
<DropDownButton>
<Image>
<SpriteProperties HottrackedCssClass="dxEditors_edtDropDownHover_Aqua" PressedCssClass="dxEditors_edtDropDownPressed_Aqua" />
</Image>
</DropDownButton>
<ValidationSettings>
<ErrorFrameStyle ImageSpacing="4px">
<ErrorTextPaddings PaddingLeft="4px" />
</ErrorFrameStyle>
</ValidationSettings>
</dx:ASPxComboBox>
</td>
</tr>
</table>
</asp:Content>

5.編寫報表的執行代碼PurchaseOfClosed.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebReport.BLL;

namespace WebReport.Purchase
{
    public partial class PurchaseOfClosed : WebReport.CommonPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
            if (!IsPostBack)
            {
                startDate.Text = DateTime.Now.AddMonths(-1).ToShortDateString();
                endDate.Text = DateTime.Now.ToShortDateString();
            }
            
        }
        public override DataSet GetData(int pageSize, int pageIndex, string strOrderby, out int pageCount)
        {
        	return new B_Purchase().GetClosed(pageSize, pageIndex + 1, txtID.Text.Trim(), chkDate.Checked, startDate.Date.ToString("yyyyMMdd"), endDate.Date.ToString("yyyyMMdd"),
        	    txtUser.Text.Trim(),cmbType.SelectedItem.Index.ToString(), strOrderby, out pageCount);
        }
    }
}

將頁面上的值傳遞到邏輯層webreport.BLL

6.在webreport.BLL中編寫邏輯層的對應目錄(Purchase.cs)里的方法

public DataSet GetClosed(int pageSize, int pageIndex, string txtID, bool chkDate, string startDate, string endDate, string txtUser, string cmbType,
string strOrderby, out int pageCount)
{
StringBuilder strFilter = new StringBuilder();
if (!string.IsNullOrEmpty(txtID))
strFilter.Append(string.Format(" and pmm01 {0}", StringHandle.StringAnalysis(txtID)));
if (chkDate)
{
if (!string.IsNullOrEmpty(startDate) && !string.IsNullOrEmpty(endDate))
strFilter.Append(string.Format(" and to_char(pmm04,'YYYYMMDD') between '{0}' and '{1}'", startDate, endDate));
}
if (!string.IsNullOrEmpty(txtUser))
strFilter.Append(string.Format(" and pmm12 {0}", StringHandle.StringAnalysis(txtUser)));
switch(cmbType)
{
case "1":
strFilter.Append(string.Format(" and pmm25='6'"));
break;
case "2":
strFilter.Append(string.Format(" and pmm25<>'6'"));
break;
}
if (!string.IsNullOrEmpty(strOrderby))
strFilter.Append(string.Format(" order by {0}",strOrderby));

return new D_Purchase().GetClosed(pageSize, pageIndex, strFilter.ToString(), strOrderby, out pageCount);
}

將整合QBE,并傳遞參數到數據訪問層webreport.DLL

7.在webreport.DLL中編寫數據訪問層的對應目錄(Purchase.cs)里的方法

public DataSet GetClosed(int pageSize, int pageIndex, string strFilter, string strOrderby, out int pageCount)
{
strSql = "select pmm01, pmm04, ima01, pmn20, pmn02, pmn50, pmm12,pmm27 from pmm_file, pmn_file, ima_file where pmm01=pmn01 and pmn04=ima01(+) ";
return OracleHelper.GetDataByPage(ConnstringManager.OraConnetionString, pageSize, pageIndex, strSql, strFilter, strOrderby, out pageCount);
}

將寫好SQL語句,并傳遞到DBHelp的方法里抓取資料,并返回

8.在RS報表上新增這個報表的目錄節點、頁面地址等設置。

節點ID : 不需要填寫
節點名稱 : 就是報表名稱
節點標誌 : 填寫報表英文代號
父級節點填 : 寫目錄的節點ID
是否為葉子節點 : 一般選擇,是
頁面地址填寫 : /目錄名/報表名.aspx

9.修改報表權限

10.測試報表

[声明]本站内容除特别声明外,均属原创内容。
1、本站所有原创文章、图片等资料,如需转载使用,必须附上来源出处及链接方式;
2、若本站侵犯到您的权益或任何版权问题,请立即告知本站,我们将及时删除并致以最深的歉意!
3、本站转载文章版权归原作者所有,内容为作者个人观点,本站只提供参考并不构成任何投资及应用建议。任何本站转载文章链接及得到的资讯、产品、服务,本站概不负责,亦不负任何法律责任。
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇