用友UAP报表高级开发之输出事件Word文档格式.docx
《用友UAP报表高级开发之输出事件Word文档格式.docx》由会员分享,可在线阅读,更多相关《用友UAP报表高级开发之输出事件Word文档格式.docx(11页珍藏版)》请在冰豆网上搜索。
![用友UAP报表高级开发之输出事件Word文档格式.docx](https://file1.bdocx.com/fileroot1/2022-11/29/99f4ca8f-a929-4c19-9ef9-754efdb20b0f/99f4ca8f-a929-4c19-9ef9-754efdb20b0f1.gif)
filter.GetValue1("
订单号"
)
4.2.global
全局对象,定义全局变量
执行SQL语句:
objectExecuteScalar(stringsql)
执行SQL语句并返回结果:
DataSetExecute(stringsql)
报表中的全局变量:
.varent----定义的全局变量
global.ExecuteScalar("
selecttop1ccodefromSA_Sale"
);
global.A
A为报表中定义的全局变量
4.3.current
获取当前行
获取当前行的某列(只有get):
objectcurrent[columnname]
获取当前行的某列:
.columnname
-----列值
current.订单号
current["
]
定义
sb.Append("
publicclassCurrent\r\n"
sb.Append("
{\r\n"
privateRowData_rowdata;
\r\n"
publicCurrent(RowDatarowdata)\r\n"
_rowdata=rowdata;
}\r\n"
publicobjectthis[stringname]\r\n"
get\r\n"
return_rowdata[name];
set\r\n"
_rowdata[name]=value;
4.4.privious
获取前一行
获取前一行的某列:
objectprevious[columnname]
previous.订单号
previous["
获取系统参数
voidExecuteNonQuery(stringsql)
执行SQL语句,返回结果:
DataSetExec(stringsql)
在Meta库中执行SQL语句,返回结果:
DataSetExecFromMeta(stringsql)
用户名:
stringUserName
当前日期:
stringDate
当前时间:
stringTime
当前年:
intYear
当前月:
intMonth
当前日:
intDay
帐套年:
intAccountYear
帐套月:
intAccountMonth
用户自定义参数:
stringCusDefineInfo(stringkey)
公司信息:
stringCompanyInfo(stringkey)
datahelper.CusDefineInfo("
@存货.自定义项1"
4.5.args
传递参数
取参数对象:
objectthis[stringkey]
objectGetValue(stringkey);
args["
filterflag"
4.6.indexs
分组索引
startindex
---每一分组的开始序号
endindex
---每一分组的结束序号
currentindex
---当前序号
4.7.groups
分组函数,获取报表的分组情况及指定分组
取指定分组:
Groupthis[intindex]
取分组级次:
intLevels{get;
}
取此组的分组数:
intCount{get;
4.8.currenggoup
分组函数,获取当前组信息
获取分组:
stringthis[stringname]
获取下级分组:
GroupsChildGroups
获取上级分组:
GroupParent
分组的可见性:
boolVisible
分组的级次:
intLevel
4.9.Cells
字段组函数,获取指定字段
获取指定列:
Cellthis[stringname]
cell.Caption=cells["
cInvCode"
].ToString();
4.10.Report
报表对象,获取报表信息
获取报表的分组级次:
intGroupLevels
获取二次过滤条件:
string
RowFilter.FilterString
GroupFilter
reportsummaryData
报表汇总对象,获取报表的汇总信息
获取指定字段的汇总数:
Doublethis[stringmapname]
this["
存货数量"
5.例子
5.1.根据已有内容,动态显示另外一个值比“数据权限查询”报表中的有权
if(cell.Value.ToString().Trim()=="
1"
cell.Caption="
√"
;
else
cell.Caption="
"
5.2.获取当前登陆语言,并且动态显示列名称
{
if(datahelper.Login.LocaleID.ToLower()=="
zh-cn"
cell.Caption="
来源自身"
zh-tw"
來源自身"
en-us"
InheritFromSelf"
5.3.根据不同值,显示不同的背景色,起醒目提示作用
if(Convert.ToDouble(cell.Value)>
100000)
cell.ForeColor=Color.Red;
效果】
∙"
销售额"
字段按上述条件变化背景色;
提成额"
按上述条件设置为红色。
5.4.计算逻辑
复杂计算列,需要根据上一行内容来动态计算,完全是靠代码写出来的
如应付总账表中的余额本币列
if(currentindex==0)
//current.ye=current.ye+current.jf-current.df-current.jf2+current.df2;
current.ye=previous.ye+current.jf-current.df-current.jf2+current.df2;
returncurrent.ye;
6.附录(编译后的具体代码)
publicclassCellcWhName:
ICellEvent
publicvoidPrepaint(Reportreport,RowDatadata,Cellinnercell,FilterSrvfilter,AgileArgsargs,DataHelperdatahelper,ReportSummaryDatareportsummary,RowBalancerowbalance,AccumulateDataaccumulate,BalanceDatabalance,object[]others)
Currentcurrent=null;
intgrouplevels=report.GroupLevels;
intcurrentindex=-1;
intstartindex=-1;
Groupsgroups=null;
Groupcurrentgroup=null;
RowDatacolumntodata=null;
Currentprevious=newCurrent(rowbalance);
if(rowbalance!
=null)
{
currentindex=rowbalance.CurrentIndex;
startindex=rowbalance.StartIndex;
}
SemiRowcells=(data!
=null?
data.SemiRow:
null);
SemiRowrow=cells;
IKeyToObjectnametodata=cellsasIKeyToObject;
StimulateCellcell=newStimulateCell(innercell);
if(dataisGroup)
cell.bInGroup=true;
currentgroup=dataasGroup;
columntodata=currentgroup;
elseif(!
(dataisReportSummaryData))
current=newCurrent(data);
columntodata=data;
else
cell.bInReportSummary=true;
if(nametodata==null)
nametodata=columntodataasIKeyToObject;
Globalglobal;
if(datahelper.Global==null)
global=newGlobal();
global.DataHelper=datahelper;
datahelper.Global=global;
global=datahelper.GlobalasGlobal;
//cell.Caption=current.Function0;
//(cells["
cWhName"
]asCell).Caption=current.Function0;
cell.Caption=report.GroupLevels;