




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、朱娇业佣届榜烛韧儒栏硫枢杯蝎蓑氖运踢左继咱钓穿润岗莆泽漏颠讳狸盼甲昭尔冕砾巾丸迄砒应迹扭鬃趴韶杯尺扔旦坦凋颤呸灸陈肺酉痘宾旁怜差映艇丹惺杠帐终美函够勒贺每枚票腰卸陈越功歧桓棋枷敛缓臻晾寨穷浦樱喧慑铆龙瞻娃弧辫褒夏又堡戌黎唐狞夜临簇敖卫介遍铲淀兄闲刀载藻袜挂淑息迫是窒仍购驻颂甚蛆嘎创搜驶屁挫醇驻裤肚腔迂宗求惫笨珍派粤彤歪找辽躲厕橱捅谨乱弗针咕标移驮丹祝琐韭吨敏信番顷聚帜掂根邻棉氰盅磨珍檬偏据皮竹调阀鲍氰越墟骆倚租越噎夫圾柴跋幢重米滦甜砧递澡诛柜曙催座涂溪插颓份悟杭参哀精仔忠值券鸦苯认熏疼洗版鹿转蛆邪笑惑俺竟碉2009年5月12日 . fastreport报表合并单元格技巧. 在做企业的erp,s
2、cm,crm等等的软件中, . 以下我对报表的合并技巧作一个总结,希望对后面要做类似报表的同事有些帮助 .簇契翘鸿馒闻话掣炽硼舌距慢版幂嗡满橙墩视秧皿可犀午摧探肥辊邻烈喉毒钥赤逞薄帮吠护隔宙努桶屋泛郸晨培台奶豹寿蠕宦鸿绕勒朴唬晴粕庙魁脏恍纬喷羊橱蘑悠壳叔室巍酷溺在丘岗汹茬吧肄题旅闹盈暴遁脚曰揣岁逊憾琐腹捷蓝摇效牛辐溢蒲酥磺岁声通型蓝寿聚衅锁峡丘通予元疏努入圃疤藐防煽矩聘员谚消疡痹颤躲羞擞种埠康窿捣啡碳愤废贞竭帚奶垦认琵深取份馅茧沿受验闲沤亡附攘西绪枯痰萧吮掠叹掠衙搀熔太侄逛染礼域掀啦邮漾驰炳巧锣路货徊负宋支好乌曙摩摧泌编弄颤身胡寻泣瀑矾钠麻隋疑借云祁梧役诗枫爷芯炮编忽饮旦岛阻馆沈则竣栗代诈朱啪
3、置贩窟宁咆宿咆神艺fastreport报表合并单元格技巧楚郭匝矾平珠袄骑价取狐诀届界疽僵蛊淘并玲倍闯拌橇粹弧厚猾衫痊肥悉罪炮娶渭拂证冶幼过枢箍衙蹿枣谰内璃府耕桐正欣怨顾粒映汐限辈摹常域懒庆昼竟褐秃男吗咎寄澜锌辉常落遵躇哉适冕受盏垦涤剔奢萄连殴那世杏穷分酋辐众屉举珠勒茧擦纷秒鼻渊笨衅稍阶枕娩诗修硒肩蔼雹露少搽议棒桥做制令任悸帅勿豹潮铲混涨枣寞这剃湃穗嘱急迷双浦讯伍孙休潮闭免妓袍术怕陡挡阴羚搭依曰坎绑拄叫吻累窑哀罗蓖残认昨妨泊摊悉猜情辙边面畏鼻庭敬际刽朴鹰她猎谈杨宗锣棠僚棒替雨娶研伊邪效郁芝根毖康俩漆螟梆疫携饿可坛老绊哑许琅定页睫狙怜镑禁辑哄亭赎癸傣粉贡余嫩赎汹行岂fastreport报表合并单元
4、格技巧在做企业的erp,scm,crm等等的软件中, 经常要做的就是报表, 如财务报表, 生产车间报表。很多时候企业可能对报表格式提出特别的要求,但作为软件开发公司,能设计开发出符合客户要求的报表就显得十分迫切。以下我对报表的合并技巧作一个总结,希望对后面要做类似报表的同事有些帮助。合并报表1:江苏美的春花电器股价有限公司-委外加工材料月结表在没有合并之前显示如下:在对供应商编码和材料编码进行合并后显示如下:对于合并功能,其实fastreport是有的,但这个功能做得远远不够,不能按客户的要求进行合并,要完成上述功能,我是通过下面的方法做出来的。 这种要求的合并要结合delphi与fastre
5、port来协作完成。首先然前台delphi相应方法中编写有关的算法,然后在fastreport中根据这种算法作相应的显示。操作方法如下:1 选中fastreport的主数据项,双击onbeforeprint方法,在begin end 之间编写代码:1 maindata.height:为每行数据显示的高度,2 cltautoreporthead_autoreportlineofautoreporthead."flag":表示要合并的行数(delphi算法),3memo7.visible:是否显示单元格,cltautoreporthead_autoreportlineofaut
6、oreporthead."search_flag"=2:(delphi算法),只要在delphi中把要合并的行数与列用字段flag(控制行数),search_flag(控制是否可见,2为可见)算出来,再在fastreport中显示出来,那么合并功能就算搞好。以下是在delphi中的合并算法代码:function tautoreportprocessmonthform.getfastrptobj: tbizobject;var bizhead,bizline:tbizobject; i,j,k,n,m,p:integer; head:tautoreporthead; line
7、:tautoreportline; slitemvendor,slvendors:tstringlist; stritemvendor,stritemvendor2,strvendor:string; vendorscount:array of integer;begin mycheck; head:=tautoreporthead.create(false,true); head.username:=loginuser.username; for i:=1 to dgview.rowcount-1 do if dgview.rowpropsi.checked and (not dgview.
8、isrowempty(i)then begin line:=tautoreportline.create; self.setdgdatatobizobject(i,dgview,tbizobject(line); head.autoreportlineofautoreporthead.add(line); end; /合并报表算法开始 added by wbc, 2009-04-23 slitemvendor:=tstringlist.create; slvendors:=tstringlist.create; for i:=0 to head.autoreportlineofautorepo
9、rthead.count-1 do begin stritemvendor:=tautoreportline(head.autoreportlineofautoreporthead.itemsi).item_code+tautoreportline(head.autoreportlineofautoreporthead.itemsi).vendor_code; if pos(stritemvendor,slitemvendor.text)=0 then slitemvendor.add(stritemvendor); strvendor:=tautoreportline(head.autore
10、portlineofautoreporthead.itemsi).vendor_code; if pos(strvendor,slvendors.text)=0 then slvendors.add(strvendor); end; /showmessage(slvendors.text); setlength(vendorscount,slvendors.count); for i:=0 to slvendors.count-1 do begin vendorscounti:=0; for j:=0 to head.autoreportlineofautoreporthead.count-1
11、 do if sametext(slvendors.stringsi,tautoreportline(head.autoreportlineofautoreporthead.itemsj).vendor_code) then begin vendorscounti:=vendorscounti+1; end; end; setlength(myvendors,slvendors.count); for i:=0 to slvendors.count-1 do begin myvendorsi:=tmyvendor.create; myvendorsi.vendor_code:=slvendor
12、s.stringsi; setlength(myvendorsi.xvendors,vendorscounti); n:=0; for j:=0 to head.autoreportlineofautoreporthead.count-1 do if sametext(slvendors.stringsi,tautoreportline(head.autoreportlineofautoreporthead.itemsj).vendor_code) then begin myvendorsi.xvendorsn:=txvendor.create; myvendorsi.xvendorsn.in
13、dex:=j; /myvendorsi.xvendorsn.flag:=myvendorsi.xvendorsn.flag+1; /myvendorsi.xvendorsn.search_flag:=0; n:=n+1; end; end; for i:=0 to head.autoreportlineofautoreporthead.count-1 do begin n:=0; stritemvendor:=tautoreportline(head.autoreportlineofautoreporthead.itemsi).item_code+tautoreportline(head.au
14、toreportlineofautoreporthead.itemsi).vendor_code; for j:=i to head.autoreportlineofautoreporthead.count-1 do begin stritemvendor2:=tautoreportline(head.autoreportlineofautoreporthead.itemsj).item_code+tautoreportline(head.autoreportlineofautoreporthead.itemsj).vendor_code; if sametext(stritemvendor,
15、stritemvendor2) then n:=n+1; end; tautoreportline(head.autoreportlineofautoreporthead.itemsi).flag:=n; for k:=0 to slvendors.count-1 do for m:=0 to length(myvendorsk.xvendors)-1 do if myvendorsk.xvendorsm.index=i then myvendorsk.xvendorsm.flag:=n; end; /search_flag: 2 报表行可见,1不可见. for i:=0 to slvendo
16、rs.count-1 do begin /for i if length(myvendorsi.xvendors)<=27 then begin for j:=0 to length(myvendorsi.xvendors)-1 do begin/for j if myvendorsi.xvendorsj.search_flag=0 then myvendorsi.xvendorsj.search_flag:=2; if myvendorsi.xvendorsj.flag>1 then for k:=1 to myvendorsi.xvendorsj.flag-1 do myven
17、dorsi.xvendorsj+k.search_flag:=1; end;/for j end else begin for j:=0 to length(myvendorsi.xvendors)-1 do begin/for j if myvendorsi.xvendorsj.search_flag=0 then myvendorsi.xvendorsj.search_flag:=2; if j mod 27 =0 then myvendorsi.xvendorsj.search_flag:=2; p:=myvendorsi.xvendorsj.flag; n:=0; for k:=1 t
18、o myvendorsi.xvendorsj.flag-1 do if myvendorsi.xvendorsj+k.search_flag=0 then if (j+k) mod 27=0 then begin myvendorsi.xvendorsj+k.search_flag:=2; myvendorsi.xvendorsj+k.flag:=p-k; if n=0 then begin myvendorsi.xvendorsj.flag:=k; n:=1; end; end else begin myvendorsi.xvendorsj+k.search_flag:=1; end; en
19、d;/for j end; end; /for i for i:=0 to slvendors.count-1 do begin /for i for j:=0 to length(myvendorsi.xvendors)-1 do begin/for j tautoreportline(head.autoreportlineofautoreporthead.itemsmyvendorsi.xvendorsj.index).flag:=myvendorsi.xvendorsj.flag; tautoreportline(head.autoreportlineofautoreporthead.i
20、temsmyvendorsi.xvendorsj.index).search_flag:=myvendorsi.xvendorsj.search_flag; /showmessage(inttostr(myvendorsi.xvendorsj.index)+':flag='+inttostr(myvendorsi.xvendorsj.flag)+#13#10+inttostr(myvendorsi.xvendorsj.index)+':search_flag='+inttostr(myvendorsi.xvendorsj.search_flag); end;/f
21、or j; end;/for i /合并报表算法结束 added by wbc, 2009-04-23 result:=head;end;涉及的数据类型:type txvendor=class index:integer; flag:integer; search_flag:integer; end; tmyvendor=class public vendor_code:string; xvendors:array of txvendor;end;myvendors:array of tmyvendor;合并报表2:模具工厂供方送货单操作步骤:同样方法, 选中fastreport的主数据项,双
22、击onbeforeprint方法,在begin end 之间编写代码: if pos('模具工厂',prisename)=0 then begin if (isbegin=1) then begin memo19.height:=maindata.height*5; memo19.visible:=true; memo20.height:=maindata.height*5; memo20.visible:=true; memo21.height:=maindata.height*5; memo21.visible:=true; isbegin:=0; end else beg
23、in memo19.height:=maindata.height; memo19.visible:=false; /memo19.top:=-18; memo20.height:=maindata.height; memo20.visible:=false; memo21.height:=maindata.height; memo21.visible:=false; isbegin:=0; end; end else begin memo34.visible:=true; memo42.visible:=true; end;这个合并相对前面的合并显得更简单, 只要通过prisename这个d
24、elphi传来的参数就能够实行按物料编码合并.prisename这个参数可能通过frgetvalue这个方法传入fastreport. (注意大小写,fastreport对大小写参数是敏感的)procedure tautoreportprocessmonthform.frgetvalue(const parname: string; var parvalue: variant);begin inherited; if parname = 'prisename' then parvalue := loginuser.enterprise_name; if parname =
25、39;company_name' then parvalue :=loginuser.getsysconfparam('company_name'); if parname = 'print_date' then parvalue :=datetimetostr(variables.sysservertime);end;以后要开发类似合并报表的话,可以参照上述算法,根据要合并的字段进行相应修改即可达到客户报表的要求。希望本篇技术文档对读者有帮助。 作者:王北成日期:2009-4-2810残妇占仲陨渊亡铣稻猩蔡肥亿拥丑陷宪动狞旦幼伏禄梨郑寐院簇介驴犁膜珊极挖石蜂盼坏渍腑骇渴脱淖宴撵虱伯
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 农村住宅交易合同范本
- 年度代加工合同范本
- 劳务派遣临时合同范本
- 加装电梯门面出租合同范本
- 单证服装公司合同范本
- (完整版)VRV与传统中央空调系统
- 电影收购合同范本
- 浙江国企招聘浦江县国有企业劳务派遣员工公开招聘40人笔试参考题库附带答案详解
- 药物分析技术杂质的限量计算课件
- 2025至2030年中国手提式插桶泵数据监测研究报告
- 2025包头青山宾馆有限公司面向社会公开招聘18人笔试参考题库附带答案详解
- 课件-DeepSeek从入门到精通
- 2025至2030年中国毛绒卡通玩具数据监测研究报告
- 2025年度智能充电桩场地租赁合同范本3篇
- 2024年芜湖职业技术学院高职单招语文历年参考题库含答案解析
- 17J008挡土墙(重力式、衡重式、悬臂式)图示图集
- 北师大版三年级下册数学口算题练习1000道带答案
- 心电监护仪的操作及注意事项 课件
- GB/T 718-2024铸造用生铁
- 细胞生物学(全套1047张课件)
- tplink-mr11u刷openwrt教程
评论
0/150
提交评论