用友UAP报表高级开发之输出事件_第1页
用友UAP报表高级开发之输出事件_第2页
用友UAP报表高级开发之输出事件_第3页
用友UAP报表高级开发之输出事件_第4页
用友UAP报表高级开发之输出事件_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、 报表输出事件1. 原理运用.net动态编译原理,所以语法上完全遵守c#语法规则,写的代码要在运行时期取编译运行的2. 执行时间加载完数据和个时候,要呈现前把该脚本功能应用上3. 报表元数据组成:C#标准语法和报表中已经存在的变量组成4. 脚本对象:4.1. filter【功能介绍】    过滤条件对象,获取过滤条件中的值【对象函数】    返回过滤条件区间初始值(编码):string GetValue1(string key);    返回过滤条件区间结束值(编码):str

2、ing GetValue2(string key);    返回过滤条件区间初始值(名称): string GetName1(string key);    返回过滤条件区间结束值(名称):string GetName2(string key);【用例】    filter.GetValue1("订单号")4.2. global【功能介绍】    全局对象,定义全局变量【对象函数】   

3、 执行SQL语句:object ExecuteScalar(string sql)    执行SQL语句并返回结果:DataSet Execute(string sql)    报表中的全局变量:.varent-定义的全局变量【用例】    global.ExecuteScalar("select top 1 ccode from SA_Sale");    global.A   A为报

4、表中定义的全局变量4.3. current 【功能介绍】    获取当前行【对象函数】    获取当前行的某列(只有get):object currentcolumnname    获取当前行的某列:.columnname    -列值【用例】    current.订单号current"订单号"定义sb.Append("public class Currentrn"

5、); sb.Append("rn"); sb.Append("private RowData _rowdata;rn"); sb.Append("public Current(RowData rowdata)rn"); sb.Append("rn"); sb.Append("_rowdata=rowdata;rn"); sb.Append("rn"); sb.Append("public object thisstring namern"); sb.App

6、end("rn"); sb.Append("getrn"); sb.Append("rn"); sb.Append("return _rowdataname;rn"); sb.Append("rn"); sb.Append("setrn"); sb.Append("rn"); sb.Append("_rowdataname=value;rn"); sb.Append("rn"); sb.Append("rn

7、");4.4. privious【功能介绍】    获取前一行【对象函数】    获取前一行的某列:object previouscolumnname    获取前一行的某列:.columnname    -列值【用例】    previous.订单号    previous"订单号"【功能介绍】   

8、60;获取系统参数【对象函数】    执行SQL语句:void ExecuteNonQuery(string sql)    执行SQL语句,返回结果:object ExecuteScalar(string sql)    执行SQL语句,返回结果:DataSet Exec(string sql)    在Meta库中执行SQL语句,返回结果:DataSet ExecFromMeta(string sql)  

9、60; 用户名:string UserName    当前日期:string Date    当前时间:string Time    当前年:int Year    当前月:int Month    当前日:int Day    帐套年:int AccountYear    帐套月:int AccountMo

10、nth    用户自定义参数:string CusDefineInfo(string key)    公司信息:string CompanyInfo(string key)【用例】    datahelper.CusDefineInfo("存货.自定义项1")4.5. args【功能介绍】    传递参数【对象函数】    取参数对象:object thisstring key

11、    取参数对象:object GetValue(string key);【用例】args"filterflag"4.6. indexs【功能介绍】    分组索引【对象函数】    startindex    -每一分组的开始序号    endindex      -每一分组的结束序号    c

12、urrentindex  -当前序号4.7. groups【功能介绍】    分组函数,获取报表的分组情况及指定分组【对象函数】    取指定分组:Group thisint index     取分组级次:int Levelsget;    取此组的分组数:int Countget;4.8. currenggoup【功能介绍】    分组函数,获取当前组信息【对象函数】 &#

13、160;  获取分组:string thisstring name     获取下级分组:Groups ChildGroups    获取上级分组:Group Parent     分组的可见性:bool Visible     分组的级次:int Level4.9. Cells【功能介绍】    字段组函数,获取指定字段【对象函数】   

14、0;获取指定列:Cell thisstring namecell.Caption=cells"cInvCode".ToString();4.10. Report【功能介绍】    报表对象,获取报表信息【对象函数】    获取报表的分组级次:int GroupLevels    获取二次过滤条件:string  RowFilter.FilterStringstring  GroupFilterreportsummaryData【功能介绍

15、】    报表汇总对象,获取报表的汇总信息【对象函数】    获取指定字段的汇总数:Double thisstring mapname【用例】    this"存货数量"5. 例子5.1. 根据已有内容,动态显示另外一个值比“数据权限查询”报表中的 有权if(cell.Value.ToString().Trim() = "1")cell.Caption=""elsecell.Caption=""5

16、.2. 获取当前登陆语言,并且动态显示列名称if(cell.Value.ToString().Trim() = "")if(datahelper.Login.LocaleID.ToLower() = "zh-cn")cell.Caption="来源自身"if(datahelper.Login.LocaleID.ToLower() = "zh-tw")cell.Caption="來源自身"if(datahelper.Login.LocaleID.ToLower() = "en-us&qu

17、ot;)cell.Caption="Inherit From Self"5.3. 根据不同值,显示不同的背景色,起醒目提示作用if (Convert.ToDouble(cell.Value) > 100000)    cell.ForeColor = Color.Red;效果】· "销售额"字段按上述条件变化背景色;"提成额"按上述条件设置为红色。5.4. 计算逻辑复杂计算列,需要根据上一行内容来动态计算,完全是靠代码写出来的如应付总账表中的余额本币列if( currentind

18、ex = 0 )/current.ye = current.ye+current.jf-current.df-current.jf2+current.df2;elsecurrent.ye = previous.ye+current.jf-current.df-current.jf2+current.df2;return current.ye;6. 附录(编译后的具体代码)public class CellcWhName:ICellEventpublic void Prepaint(Report report, RowData data, Cell innercell, FilterSrv fi

19、lter, AgileArgs args, DataHelper datahelper, ReportSummaryData reportsummary, RowBalance rowbalance, AccumulateData accumulate, BalanceData balance,object others) Current current=null; int grouplevels=report.GroupLevels; int currentindex=-1; int startindex=-1; Groups groups=null; Group currentgroup=

20、null; RowData columntodata=null; Current previous=new Current(rowbalance); if(rowbalance !=null ) currentindex=rowbalance.CurrentIndex; startindex=rowbalance.StartIndex; SemiRow cells=(data!=null?data.SemiRow:null); SemiRow row=cells; IKeyToObject nametodata=cells as IKeyToObject; StimulateCell cell=

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论