MyReport实践:为ERP系统添加打印功能

Posted hunkcai

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MyReport实践:为ERP系统添加打印功能相关的知识,希望对你有一定的参考价值。



准备阶段

首先准备2html页面分别集成myreport的预览和设计功能,作为预览页面和打印编辑页面。

集成方式参考:Js与flash交互:在html页面中用js与MyReport插件交互

 

打印相关API

加载数据和格式

页面初始化时,获取浏览器地址栏参数,然后加载配置文件,加载单据的数据和打印格式,调用OrderAPI.LoadPrintData方法。

                     private var _Params:UrlParams;

                    

                     private function Init():void

                     {

                           //

                          

                           _Params = new UrlParams(url);

                           if(!_Params.HasParam("uid"))

                           {

                                  hlib.MsgUtil.ShowInfo("URL缺少uid参数!");

                                  return;

                           }

                           if(!_Params.HasParam("mid"))

                           {

                                  hlib.MsgUtil.ShowInfo("URL缺少mid参数!");

                                  return;

                           }

                           if(!_Params.HasParam("action"))

                           {

                                  hlib.MsgUtil.ShowInfo("URL缺少action参数!");

                                  return;

                           }

                           if(!_Params.HasParam("code"))

                           {

                                  hlib.MsgUtil.ShowInfo("URL缺少code参数!");

                                  return;

                           }

                          

                           var configLoader:UrlLoader = new UrlLoader();

                           configLoader.DisposeAfterLoad = true;

                           configLoader.addEventListener(Event.COMPLETE, OnConfigLoadComplete);

                           configLoader.Load("Config.xml");

                     }

                     private function OnConfigLoadComplete(e:Event):void

                     {

                           var configLoader:UrlLoader = e.currentTargetas UrlLoader;

                           var settings:XML = XML(configLoader.Data);

                           common.net.APIUtil.Server = settings.ERPServicePath;

                           if(!APIUtil.Server)

                           {

                                  MsgUtil.ShowInfo("Config.xml缺少配置ERPServicePath");

                           }

                          

                           OrderAPI.LoadPrintData(_Params.GetParam("mid"),_Params.GetParam("action"),

                                  _Params.GetParam("uid"),_Params.GetParam("code"),

                                  function(item:Object):void

                                  {

                                         var style:XML = null;

                                         if(item.PRINT_STYLE)

                                                style = new XML(item.PRINT_STYLE);

                                         delete item.PRINT_STYLE;

                                        

                                         var detail:Object = item.detail;

                                         delete item.detail;

                                        

                                         _Preview.Load(style,detail, item);//MyReport控件加载数据

                                  });

                     }

打印完成通知

监控MyReport控件的打印完成事件MyReportEvent.PRINT,向后台发送打印完成通知,调用OrderAPI.ReportPrintCompleted方法

有哪些erp系统软件?

JAVA日志系统

智邦国际ERP系统31.85版本发布,全面开启不同企业不同管理

嵌入式Linux系统添加USB打印机功能

MyReport报表系统v1.2公布

智邦国际erp软件31.86版本最新功能分享