|  |  | 
 |  |  | use "xcontrol.vframe.vbusiness.vd" | 
 |  |  | use "xbase.vframe.vbusiness.vd" | 
 |  |  | use "saleorder.view.vd" | 
 |  |  | use "publiccode.vutil.vbusiness.vd" | 
 |  |  | #include <wobject/xstring.hpp> | 
 |  |  | #include <xcontrol/xtreeview.hpp> | 
 |  |  | #include <xcontrol/xdwgrid.hpp> | 
 |  |  | #include <xcontrol/xcell.hpp> | 
 |  |  |  | 
 |  |  | unit trade  | 
 |  |  | [ | 
 |  |  |    class Business5Win :  public xframe | 
 |  |  |  | 
 |  |  | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" | 
 |  |  | #include "viewobject/view.base.hpp" | 
 |  |  | #include "xcontrol/xshtml.hpp" | 
 |  |  |  | 
 |  |  | using xml = KXMLDOMDocument; | 
 |  |  |  | 
 |  |  |    class __declspec(dllexport) Business5Win :  public xframe | 
 |  |  |    { | 
 |  |  |    public: | 
 |  |  |       xdwgrid   dw_list; | 
 |  |  |       xdwgrid dw_processed; | 
 |  |  |       xdwgrid dw_message; | 
 |  |  | 
 |  |  |       xnode   m_agentNode;   //Agent Condition | 
 |  |  |       xtreeview tv_folder; | 
 |  |  |        | 
 |  |  |       int      hMessage; | 
 |  |  |       int      hTask; | 
 |  |  |       HTREEITEM      hMessage; | 
 |  |  |       HTREEITEM      hTask; | 
 |  |  |     | 
 |  |  |       string    agentFor; | 
 |  |  |       string    selectname; | 
 |  |  |       xstring    agentFor; | 
 |  |  |       xstring    selectname; | 
 |  |  |       xwin      sheet; | 
 |  |  |  | 
 |  |  |    public: | 
 |  |  |       Business5Win(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd),sheet(0) {} | 
 |  |  |    public: | 
 |  |  |       static Business5Win* CreateInstance(void* implPtr, void* hWnd) | 
 |  |  |       { | 
 |  |  |          Business5Win* pWin = new Business5Win(implPtr, (HWND)hWnd); | 
 |  |  |          return pWin; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       int SetAgent() | 
 |  |  |       { | 
 |  |  |          string xfNodeAgentArea  = "agentarea"; | 
 |  |  |          xstring xfNodeAgentArea  = L"agentarea"; | 
 |  |  |          xnode anode = GetAgentNode(xfNodeAgentArea); | 
 |  |  |          if(m_agentNode) | 
 |  |  |          { | 
 |  |  |             SetAgentNodeContent (anode,m_agentNode); | 
 |  |  |             SetAgentNode (anode,m_agentNode); | 
 |  |  |          } | 
 |  |  |          else | 
 |  |  |          { | 
 |  |  |             msxml::IXMLDOMElement xframeElement =  GetElement(); | 
 |  |  |             msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[@for='"+agentFor+"']/*"); | 
 |  |  |             KXMLDOMElement xframeElement =  GetElement(); | 
 |  |  |             KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/"+xfNodeAgentArea+L"[@for='"+agentFor+L"']/*"); | 
 |  |  |             if(agent) | 
 |  |  |             { | 
 |  |  |                string s = agent.xml; | 
 |  |  |                m_agentNode =  SetAgentNodeContent (anode,s); | 
 |  |  |                xstring s = agent.xml(); | 
 |  |  |                m_agentNode =  SetAgentNode (anode,s); | 
 |  |  |                //FillGoodsCarList(); | 
 |  |  |             } | 
 |  |  |          } | 
 |  |  | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       //焦点激活处理函数 | 
 |  |  |       int OnSetFocus(ref TEvent evt,int param) | 
 |  |  |       int OnSetFocus(TEvent* evt, LPARAM param) | 
 |  |  |       { | 
 |  |  |          //重置工具条 | 
 |  |  |          SetAgent(); | 
 |  |  | 
 |  |  |       } | 
 |  |  |       int RetrieveData() | 
 |  |  |       { | 
 |  |  |          if(selectname == "已处理任务") | 
 |  |  |          xml x; | 
 |  |  |          if(selectname == L"已处理任务") | 
 |  |  |          { | 
 |  |  |             xml x = ViewObject::RetrieveData("/sale/data/business/list/processedtask"); | 
 |  |  |              x = ViewObject::RetrieveData(L"/sale/data/business/list/processedtask"); | 
 |  |  |             dw_processed.Retrieve(x); | 
 |  |  |             dw_processed.Redraw(); | 
 |  |  |             dw_processed.SetReadOnly(true); | 
 |  |  |          }else if(selectname == "收件箱") | 
 |  |  |          }else if(selectname == L"收件箱") | 
 |  |  |          { | 
 |  |  |             string UserNO= publiccode::GetUser().no; | 
 |  |  |             xstring UserNO= publiccode::GetUser().no; | 
 |  |  |              | 
 |  |  |             x = ViewObject::RetrieveData("/sale/data/business/list/inbox"); | 
 |  |  |             x = ViewObject::RetrieveData(L"/sale/data/business/list/inbox"); | 
 |  |  |              | 
 |  |  |             dw_message.Retrieve(x); | 
 |  |  |             dw_message.Redraw(); | 
 |  |  |             dw_message.SetReadOnly(true); | 
 |  |  |          } | 
 |  |  |          else if(selectname == "发件箱") | 
 |  |  |          else if(selectname == L"发件箱") | 
 |  |  |          { | 
 |  |  |             x = ViewObject::RetrieveData("/sale/data/business/list/outbox"); | 
 |  |  |             x = ViewObject::RetrieveData(L"/sale/data/business/list/outbox"); | 
 |  |  |             dw_outbox.Retrieve(x); | 
 |  |  |             dw_outbox.Redraw(); | 
 |  |  |             dw_outbox.SetReadOnly(true); | 
 |  |  |          } | 
 |  |  |          else if(selectname == "回收箱") | 
 |  |  |          else if(selectname == L"回收箱") | 
 |  |  |          { | 
 |  |  |             x = ViewObject::RetrieveData("/sale/data/business/list/Recovery"); | 
 |  |  |             x = ViewObject::RetrieveData(L"/sale/data/business/list/Recovery"); | 
 |  |  |             dw_Recovery.Retrieve(x); | 
 |  |  |             dw_Recovery.Redraw(); | 
 |  |  |             dw_Recovery.SetReadOnly(true); | 
 |  |  | 
 |  |  |       { | 
 |  |  |          int MB_OKCANCEL = 1; | 
 |  |  |          int IDOK  = 1; | 
 |  |  |          int ret = win32::MessageBox(GetHWND(),"确认删除消息?","提示",MB_OKCANCEL); | 
 |  |  |          int ret =MessageBox(GetHWND(),L"确认删除消息?",L"提示",MB_OKCANCEL); | 
 |  |  |          if(ret == IDOK) | 
 |  |  |          { | 
 |  |  |             msxml::IXMLDOMElement ele = dw_message.GetRowElement(dw_message.GetRow()); | 
 |  |  |             string TaskID = ele.getAttribute("guid"); | 
 |  |  |             xml x = ViewObject::RetrieveData("/sale/data/business/message/delete","TaskID",TaskID); | 
 |  |  |             string status = x.GetXml(); | 
 |  |  |             if(status.find("ok") == 1) | 
 |  |  |             KXMLDOMElement ele = dw_message.GetRowElement(dw_message.GetRow()); | 
 |  |  |             xstring TaskID = ele.getAttribute(L"guid"); | 
 |  |  |             xml x = ViewObject::RetrieveData(L"/sale/data/business/message/delete",L"TaskID",TaskID); | 
 |  |  |             xstring status = x.xml(); | 
 |  |  |             if(status.find(L"ok") == 1) | 
 |  |  |             { | 
 |  |  |                alert("删除成功"); | 
 |  |  |                alert(L"删除成功"); | 
 |  |  |                RetrieveData(); | 
 |  |  |             }else | 
 |  |  |             { | 
 |  |  |                alert("删除失败"); | 
 |  |  |                alert(L"删除失败"); | 
 |  |  |             } | 
 |  |  |              | 
 |  |  |          } | 
 |  |  | 
 |  |  |       { | 
 |  |  |          int MB_OKCANCEL = 1; | 
 |  |  |          int IDOK  = 1; | 
 |  |  |          int ret = win32::MessageBox(GetHWND(),"确认恢复消息?","提示",MB_OKCANCEL); | 
 |  |  |          int ret =MessageBox(GetHWND(),L"确认恢复消息?",L"提示",MB_OKCANCEL); | 
 |  |  |          if(ret == IDOK) | 
 |  |  |          { | 
 |  |  |             msxml::IXMLDOMElement ele = dw_Recovery.GetRowElement(dw_Recovery.GetRow()); | 
 |  |  |             string TaskID = ele.getAttribute("guid"); | 
 |  |  |             xml x = ViewObject::RetrieveData("/sale/data/business/Recovery/UpdateRecovery","TaskID",TaskID); | 
 |  |  |             string status = x.GetXml(); | 
 |  |  |             if(status.find("ok") == 1) | 
 |  |  |             KXMLDOMElement ele = dw_Recovery.GetRowElement(dw_Recovery.GetRow()); | 
 |  |  |             xstring TaskID = ele.getAttribute(L"guid"); | 
 |  |  |             xml x = ViewObject::RetrieveData(L"/sale/data/business/Recovery/UpdateRecovery",L"TaskID",TaskID); | 
 |  |  |             xstring status = x.xml(); | 
 |  |  |             if(status.find(L"ok") == 1) | 
 |  |  |             { | 
 |  |  |                alert("恢复成功"); | 
 |  |  |                alert(L"恢复成功"); | 
 |  |  |                RetrieveData(); | 
 |  |  |             }else | 
 |  |  |             { | 
 |  |  |                alert("恢复失败"); | 
 |  |  |                alert(L"恢复失败"); | 
 |  |  |             } | 
 |  |  |              | 
 |  |  |          } | 
 |  |  | 
 |  |  |       { | 
 |  |  |          int MB_OKCANCEL = 1; | 
 |  |  |          int IDOK  = 1; | 
 |  |  |          int ret = win32::MessageBox(GetHWND(),"确认彻底删除消息?","提示",MB_OKCANCEL); | 
 |  |  |          int ret =MessageBox(GetHWND(),L"确认彻底删除消息?",L"提示",MB_OKCANCEL); | 
 |  |  |          if(ret == IDOK) | 
 |  |  |          { | 
 |  |  |             msxml::IXMLDOMElement ele = dw_Recovery.GetRowElement(dw_Recovery.GetRow()); | 
 |  |  |             string TaskID = ele.getAttribute("guid"); | 
 |  |  |             xml x = ViewObject::RetrieveData("/sale/data/business/Recovery/DeleteRecovery","TaskID",TaskID); | 
 |  |  |             string status = x.GetXml(); | 
 |  |  |             if(status.find("ok") == 1) | 
 |  |  |             KXMLDOMElement ele = dw_Recovery.GetRowElement(dw_Recovery.GetRow()); | 
 |  |  |             xstring TaskID = ele.getAttribute(L"guid"); | 
 |  |  |             xml x = ViewObject::RetrieveData(L"/sale/data/business/Recovery/DeleteRecovery",L"TaskID",TaskID); | 
 |  |  |             xstring status = x.xml(); | 
 |  |  |             if(status.find(L"ok") == 1) | 
 |  |  |             { | 
 |  |  |                alert("删除成功"); | 
 |  |  |                alert(L"删除成功"); | 
 |  |  |                RetrieveData(); | 
 |  |  |             }else | 
 |  |  |             { | 
 |  |  |                alert("删除失败"); | 
 |  |  |                alert(L"删除失败"); | 
 |  |  |             } | 
 |  |  |              | 
 |  |  |          } | 
 |  |  | 
 |  |  |              | 
 |  |  |       int OnAdd() | 
 |  |  |       { | 
 |  |  |          OpenWindow("dev:xpage[message.business.vx]"); | 
 |  |  |          if(selectname == "发件箱" || selectname == "草稿箱") RetrieveData();	 | 
 |  |  |          OpenWindow(L"dev:xpage[message.business.vx]"); | 
 |  |  |          if(selectname == L"发件箱" || selectname == L"草稿箱") RetrieveData();	 | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |              | 
 |  |  |              | 
 |  |  |       //命令发布函数 | 
 |  |  |       int OnCmdDispatch(string comdid) | 
 |  |  |       int OnCmdDispatch(xstring comdid) | 
 |  |  |       { | 
 |  |  |          int ret = 0; | 
 |  |  |          if(comdid.find("action:",0)>=0) | 
 |  |  |          if(comdid.find(L"action:",0)>=0) | 
 |  |  |          { | 
 |  |  |             ret = win32::SendMessage(sheet.GetHWND(),0x401,comdid,0); | 
 |  |  |             ret =SendMessage(sheet.GetHWND(),0x401,(LPARAM)comdid.c_str(), 0); | 
 |  |  |          } | 
 |  |  |          if(comdid=="xmRefreshTask") | 
 |  |  |          if(comdid==L"xmRefreshTask") | 
 |  |  |          { | 
 |  |  |             trace("\r\n----refresh task--------"); | 
 |  |  |             win32::SendMessage(sheet.GetHWND(),0x401,comdid,0); | 
 |  |  |             trace(L"\r\n----refresh task--------"); | 
 |  |  |             SendMessage(sheet.GetHWND(),0x401,(LPARAM)comdid.c_str(), 0); | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  |          if(comdid=="xmRefresh") | 
 |  |  |          if(comdid==L"xmRefresh") | 
 |  |  |          { | 
 |  |  |             trace("\r\n----refresh--------"); | 
 |  |  |             ret = win32::SendMessage(sheet.GetHWND(),0x401,comdid,0); | 
 |  |  |             trace(L"\r\n----refresh--------"); | 
 |  |  |             ret =SendMessage(sheet.GetHWND(),0x401, (LPARAM)comdid.c_str(), 0); | 
 |  |  |          } | 
 |  |  |          if(comdid == "xmRertieve") | 
 |  |  |          if(comdid == L"xmRertieve") | 
 |  |  |          { | 
 |  |  |             RetrieveData(); | 
 |  |  |             ret = 1; | 
 |  |  |          } | 
 |  |  |          if(comdid=="xmAdd") | 
 |  |  |          if(comdid==L"xmAdd") | 
 |  |  |          { | 
 |  |  |             OnAdd(); | 
 |  |  |             ret = 1; | 
 |  |  |          } | 
 |  |  |          if(comdid == "xmDelete") | 
 |  |  |          if(comdid == L"xmDelete") | 
 |  |  |          { | 
 |  |  |             OnDelete(); | 
 |  |  |             ret = 1; | 
 |  |  |          } | 
 |  |  |          if(comdid == "UpdateRecovery") | 
 |  |  |          if(comdid == L"UpdateRecovery") | 
 |  |  |          { | 
 |  |  |             OnUpdateRecovery(); | 
 |  |  |             ret = 1; | 
 |  |  |          } | 
 |  |  |          if(comdid == "DeleteRecovery") | 
 |  |  |          if(comdid == L"DeleteRecovery") | 
 |  |  |          { | 
 |  |  |             OnDeleteRecovery(); | 
 |  |  |             ret = 1; | 
 |  |  |          } | 
 |  |  |          if(comdid == "xmImage") | 
 |  |  |          if(comdid == L"xmImage") | 
 |  |  |          { | 
 |  |  |             int row = dw_message.GetRow(); | 
 |  |  |             string PriceID = dw_message.GetItemString(row,"EntityID"); | 
 |  |  |             xml x = ViewObject::RetrieveData("/sale/data/Enquiry/PriceList/GetSkunoByPriceID","PriceID",PriceID); | 
 |  |  |             msxml::IXMLDOMNodeList items = x.GetXmlDoc().selectNodes("data/Item"); | 
 |  |  |             msxml::IXMLDOMNode t = items.item(0); | 
 |  |  |             string skunos =  t.selectSingleNode("skuno").text; | 
 |  |  |             xaserverarg arg_pic=new xaserverarg; | 
 |  |  |             arg_pic.setNativePointer(arg_pic.CreateInstance());	 | 
 |  |  |             arg_pic.AddArg("SKUNoList",skunos); | 
 |  |  |             arg_pic.AddArg("ParentWindow",GetHWND().toString()); | 
 |  |  |             arg_pic.AddArg("OpenFlag","1"); | 
 |  |  |             OpenWindow("dev:xpage[SKU.PictureView.Product3.vx]",cast(arg_pic as int));	 | 
 |  |  |             xstring PriceID = dw_message.GetItemString(row,L"EntityID"); | 
 |  |  |             xml x = ViewObject::RetrieveData(L"/sale/data/Enquiry/PriceList/GetSkunoByPriceID",L"PriceID",PriceID); | 
 |  |  |             KXMLDOMNodeList items = x.selectNodes(L"data/Item"); | 
 |  |  |             KXMLDOMNode t = items.item(0); | 
 |  |  |             xstring skunos =  t.selectSingleNode(L"skuno").text(); | 
 |  |  |             xaserverarg arg_pic; | 
 |  |  | 		 | 
 |  |  |             arg_pic.AddArg(L"SKUNoList",skunos); | 
 |  |  | #if 0 | 
 |  |  |             arg_pic.AddArg(L"ParentWindow", GetHWND()); | 
 |  |  | #endif // 0 | 
 |  |  |  | 
 |  |  | 				 | 
 |  |  |  | 
 |  |  |             arg_pic.AddArg(L"OpenFlag",L"1"); | 
 |  |  |             OpenWindow(L"dev:xpage[SKU.PictureView.Product3.vx]",arg_pic );	 | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  |          else if(comdid == "xmSearchOne") | 
 |  |  |          else if(comdid == L"xmSearchOne") | 
 |  |  |          { | 
 |  |  |             OnSearchOne(); | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  |          else if(comdid == "xmSearchTwo") | 
 |  |  |          else if(comdid == L"xmSearchTwo") | 
 |  |  |          { | 
 |  |  |             OnSearchTwo(); | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  |          else if(comdid=="Lognew") | 
 |  |  |          else if(comdid==L"Lognew") | 
 |  |  |          { | 
 |  |  |             string EntityID = dw_processed.GetItemString(dw_processed.GetRow(),"EntityID"); | 
 |  |  |             xstring EntityID = dw_processed.GetItemString(dw_processed.GetRow(),L"EntityID"); | 
 |  |  |             //alert(EntityID); | 
 |  |  |     | 
 |  |  |             xaserverarg args=new xaserverarg; | 
 |  |  |             args.setNativePointer(args.CreateInstance());						 | 
 |  |  |             args.AddArg("EntityID",EntityID); | 
 |  |  |             //OpenWindow("dev:xpage[workflow.actionlog.vx]",cast(args as int));	 | 
 |  |  |             OpenWindow("dev:xpage[workflow.actionlog_vd.vx]",args.getNativePointer()); | 
 |  |  |             xaserverarg args; | 
 |  |  | 										 | 
 |  |  |             args.AddArg(L"EntityID",EntityID); | 
 |  |  |             //OpenWindow(L"dev:xpage[workflow.actionlog.vx]",cast(args as int));	 | 
 |  |  |             OpenWindow(L"dev:xpage[workflow.actionlog_vd.vx]",args); | 
 |  |  |           | 
 |  |  |           | 
 |  |  |              | 
 |  |  | 
 |  |  |           | 
 |  |  |       int OnSearchOne() | 
 |  |  |       { | 
 |  |  |          string searchStr=""; | 
 |  |  |          xaserverarg arg=new xaserverarg; | 
 |  |  |          arg.setNativePointer(arg.CreateInstance());						 | 
 |  |  |          arg.AddArg("text", searchStr); | 
 |  |  |          OpenWindow("dev:xpage[search.dialog.vx]", cast(arg as int)); | 
 |  |  |          string str = arg.GetArgString("text"); | 
 |  |  |          xstring searchStr=L""; | 
 |  |  |          xaserverarg arg; | 
 |  |  | 									 | 
 |  |  |          arg.AddArg(L"text", searchStr); | 
 |  |  |          OpenWindow(L"dev:xpage[search.dialog.vx]", arg); | 
 |  |  |          xstring str = arg.GetArgString(L"text"); | 
 |  |  |          if(str != searchStr) | 
 |  |  |          { | 
 |  |  |             searchStr = str; | 
 |  |  |             dw_message.Filter("*",searchStr); | 
 |  |  |             dw_message.Filter(L"*",searchStr); | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  |          return 1; | 
 |  |  | 
 |  |  |           | 
 |  |  |       int OnSearchTwo() | 
 |  |  |       { | 
 |  |  |          string searchStr=""; | 
 |  |  |          xaserverarg arg=new xaserverarg; | 
 |  |  |          arg.setNativePointer(arg.CreateInstance());						 | 
 |  |  |          arg.AddArg("text", searchStr); | 
 |  |  |          OpenWindow("dev:xpage[search.dialog.vx]", cast(arg as int)); | 
 |  |  |          string str = arg.GetArgString("text"); | 
 |  |  |          xstring searchStr=L""; | 
 |  |  |          xaserverarg arg; | 
 |  |  | 									 | 
 |  |  |          arg.AddArg(L"text", searchStr); | 
 |  |  |          OpenWindow(L"dev:xpage[search.dialog.vx]", arg); | 
 |  |  |          xstring str = arg.GetArgString(L"text"); | 
 |  |  |          if(str != searchStr) | 
 |  |  |          { | 
 |  |  |             searchStr = str; | 
 |  |  |             dw_Recovery.Filter("*",searchStr); | 
 |  |  |             dw_Recovery.Filter(L"*",searchStr); | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |        | 
 |  |  |       //命令处理事件 | 
 |  |  |       int OnXCommand(ref TXCommandEvent evt,int param) | 
 |  |  |       int OnXCommand(TEvent* evt, LPARAM param) | 
 |  |  |       { | 
 |  |  |          return OnCmdDispatch(evt.pStrID); | 
 |  |  |          return OnCmdDispatch(evt->xcommand.pStrID); | 
 |  |  |       } | 
 |  |  |        | 
 |  |  |        | 
 |  |  |       //查找当前树项的顶级目录 | 
 |  |  |       int LookupTopFolder(int hItem) | 
 |  |  |       HTREEITEM LookupTopFolder(HTREEITEM hItem) | 
 |  |  |       { | 
 |  |  |          int hRoot = tv_folder.GetRootItem(); | 
 |  |  |          while(tv_folder.GetParentItem(hItem)) hItem = tv_folder.GetParentItem(hItem); | 
 |  |  |          HTREEITEM hRoot = tv_folder.GetRootItem(); | 
 |  |  |          while (tv_folder.GetParentItem(hItem)) hItem = tv_folder.GetParentItem(hItem); | 
 |  |  |          return hItem; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       int ResetAgent(string agentAsk) | 
 |  |  |       int ResetAgent(xstring agentAsk) | 
 |  |  |       { | 
 |  |  |          if(agentFor != agentAsk) | 
 |  |  |          { | 
 |  |  | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |        | 
 |  |  |       int OnTreeSelChanged(ref TNotifyEvent evt,int p) | 
 |  |  |       int OnTreeSelChanged(TEvent* evt, LPARAM p) | 
 |  |  |       { | 
 |  |  |          ref NMTREEVIEW nmtv = cast(evt.pnmh as NMTREEVIEW); | 
 |  |  |          int hItem = nmtv.itemNew.hItem; | 
 |  |  |          int hTopItem = LookupTopFolder(hItem); | 
 |  |  |          NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; | 
 |  |  |          HTREEITEM hItem = nmtv.itemNew.hItem; | 
 |  |  |          HTREEITEM hTopItem = LookupTopFolder(hItem); | 
 |  |  |           | 
 |  |  |          string data = tv_folder.GetItemData(hItem); | 
 |  |  |          trace("\r\n"+data); | 
 |  |  |          //msxml::IXMLDOMElement e = cast(tv_folder.GetItemData(hItem) as msxml::IXMLDOMElement); | 
 |  |  |          //if(e)trace(e.xml); | 
 |  |  |          xstring data = tv_folder.GetItemData(hItem); | 
 |  |  |          trace(L"\r\n"+data); | 
 |  |  |          //KXMLDOMElement e = cast(tv_folder.GetItemData(hItem) as KXMLDOMElement); | 
 |  |  |          //if(e)trace(e.xml()); | 
 |  |  |  | 
 |  |  |          string name = tv_folder.GetItemLabel(hTopItem); | 
 |  |  |          xstring name = tv_folder.GetItemLabel(hTopItem); | 
 |  |  |          selectname = tv_folder.GetItemLabel(hItem); | 
 |  |  |          if(selectname == "待处理任务") | 
 |  |  |          if(selectname == L"待处理任务") | 
 |  |  |          { | 
 |  |  |             SwitchLayer("sheet2","frame"); | 
 |  |  |             sheet = GetChildWin("sheet2"); | 
 |  |  |             ResetAgent("business1"); | 
 |  |  |          }else if(selectname == "已处理任务") | 
 |  |  |             SwitchLayer(L"sheet2",L"frame"); | 
 |  |  |             sheet = GetChildWin(L"sheet2"); | 
 |  |  |             ResetAgent(L"business1"); | 
 |  |  |          }else if(selectname == L"已处理任务") | 
 |  |  |          { | 
 |  |  |             SwitchLayer("sheet3","frame"); | 
 |  |  |             SwitchLayer(L"sheet3",L"frame"); | 
 |  |  |             RetrieveData(); | 
 |  |  |             ResetAgent("business2"); | 
 |  |  |          }else if(selectname == "收件箱") | 
 |  |  |             ResetAgent(L"business2"); | 
 |  |  |          }else if(selectname == L"收件箱") | 
 |  |  |          { | 
 |  |  |             SwitchLayer("sheet4","frame"); | 
 |  |  |             SwitchLayer(L"sheet4",L"frame"); | 
 |  |  |             RetrieveData(); | 
 |  |  |             ResetAgent("business3"); | 
 |  |  |          }else if(selectname == "发件箱") | 
 |  |  |             ResetAgent(L"business3"); | 
 |  |  |          }else if(selectname == L"发件箱") | 
 |  |  |          { | 
 |  |  |             SwitchLayer("sheet5","frame"); | 
 |  |  |             SwitchLayer(L"sheet5",L"frame"); | 
 |  |  |             RetrieveData(); | 
 |  |  |             ResetAgent("business2"); | 
 |  |  |             ResetAgent(L"business2"); | 
 |  |  |          } | 
 |  |  |          else if(selectname == "事务") | 
 |  |  |          else if(selectname == L"事务") | 
 |  |  |          { | 
 |  |  |             SwitchLayer("sheet1","frame"); | 
 |  |  |          }else if(selectname == "回收箱") | 
 |  |  |             SwitchLayer(L"sheet1",L"frame"); | 
 |  |  |          }else if(selectname == L"回收箱") | 
 |  |  |          { | 
 |  |  |             SwitchLayer("sheet6","frame"); | 
 |  |  |             SwitchLayer(L"sheet6",L"frame"); | 
 |  |  |             RetrieveData(); | 
 |  |  |             ResetAgent("business5"); | 
 |  |  |             ResetAgent(L"business5"); | 
 |  |  |          } | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |       int OnRowChanged(ref TNotifyEvent evt,int p) | 
 |  |  |       int OnRowChanged(TEvent* evt, int p) | 
 |  |  |       { | 
 |  |  |          //fixed one event only one process | 
 |  |  |          ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR); | 
 |  |  |          DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; | 
 |  |  |          int row = hdr.row; | 
 |  |  |          if(selectname == "已处理任务") | 
 |  |  |             msxml::IXMLDOMElement ele = dw_processed.GetRowElement(row); | 
 |  |  |          else if(selectname == "收件箱") | 
 |  |  |          KXMLDOMElement ele; | 
 |  |  |          if(selectname == L"已处理任务") | 
 |  |  |              ele = dw_processed.GetRowElement(row); | 
 |  |  |          else if(selectname == L"收件箱") | 
 |  |  |          { | 
 |  |  |             ele = dw_message.GetRowElement(row); | 
 |  |  |             string Subject = dw_message.GetItemString(row,"Subject"); | 
 |  |  |             if(Subject.find("价格单") == -1) | 
 |  |  |             xstring Subject = dw_message.GetItemString(row,L"Subject"); | 
 |  |  |             if(Subject.find(L"价格单") == -1) | 
 |  |  |             { | 
 |  |  |                ResetAgent("business3"); | 
 |  |  |                ResetAgent(L"business3"); | 
 |  |  |             }else{ | 
 |  |  |                ResetAgent("business4"); | 
 |  |  |                ResetAgent(L"business4"); | 
 |  |  |             } | 
 |  |  |          } | 
 |  |  |          else if(selectname == "回收箱") | 
 |  |  |          else if(selectname == L"回收箱") | 
 |  |  |          { | 
 |  |  |             ele = dw_Recovery.GetRowElement(row); | 
 |  |  |             string SubjectOne = dw_Recovery.GetItemString(row,"Subject"); | 
 |  |  |             xstring SubjectOne = dw_Recovery.GetItemString(row,L"Subject"); | 
 |  |  |          } | 
 |  |  |          else if(selectname == "发件箱") | 
 |  |  |          else if(selectname == L"发件箱") | 
 |  |  |             ele = dw_outbox.GetRowElement(row); | 
 |  |  |          xaserverarg arg=new xaserverarg; | 
 |  |  |          arg.setNativePointer(arg.CreateInstance());	 | 
 |  |  |          trace(ele.xml); | 
 |  |  |          arg.AddArg("content",ele.xml); | 
 |  |  |          xml doc=new xml; | 
 |  |  |          doc.setNativePointer(xml::CreateInstance());				 | 
 |  |  |          if(getUrl("/sale/data/vpage/vstart/task",arg.GetString(),doc)!=1) | 
 |  |  |          xaserverarg arg; | 
 |  |  | 				 | 
 |  |  |          trace(ele.xml()); | 
 |  |  |          arg.AddArg(L"content",ele.xml()); | 
 |  |  |          xml doc;			 | 
 |  |  |          if(getUrl(L"/sale/data/vpage/vstart/task",arg.GetString(),doc)!=1) | 
 |  |  |          { | 
 |  |  |             trace("error->:"+doc.GetXml()); | 
 |  |  |             trace((xstring)L"error->:"+doc.xml()); | 
 |  |  |             return 0; | 
 |  |  |          } | 
 |  |  |          if(doc.GetXml() == "") | 
 |  |  |          if(doc.xml() == L"") | 
 |  |  |             return -1; | 
 |  |  |          //trace(doc.GetXml()); | 
 |  |  |          htmlctrl ht = GetControl("taskinfo"); | 
 |  |  |          ht.SetContent(doc.GetXml()); | 
 |  |  |          //trace(doc.xml()); | 
 |  |  |          xshtml ht = GetControl(L"taskinfo"); | 
 |  |  |          ht.SetContent(doc.xml()); | 
 |  |  |          ht.Redraw(); | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |       int OnItemAskStyle(ref TNotifyEvent evt,int p) | 
 |  |  |       int OnItemAskStyle(TEvent* evt, int p) | 
 |  |  |       { | 
 |  |  |          int DMS_CSSSTYLE = 0x8; | 
 |  |  |          ref DWASKSTYLENMHDR hdr = trust(evt.pnmh as ref DWASKSTYLENMHDR); | 
 |  |  |          DWASKSTYLENMHDR& hdr = *(DWASKSTYLENMHDR*)evt->notify.pnmh; | 
 |  |  |          int row = hdr.row; | 
 |  |  |          int col = hdr.col; | 
 |  |  |          string colname = hdr.colname; | 
 |  |  |          xstring colname = hdr.colname; | 
 |  |  |          int rows = dw_message.GetRowCount(); | 
 |  |  |          if(row < 1 || row > rows) | 
 |  |  |          { | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  |          if(colname=="flowName" || colname=="Process" || colname=="sender" || | 
 |  |  |          colname=="SendDate"||colname=="processer"||colname=="ProcessedDate"|| | 
 |  |  |          colname=="Subject"||colname=="Content") | 
 |  |  |          if(colname==L"flowName" || colname==L"Process" || colname==L"sender" || | 
 |  |  |          colname==L"SendDate"||colname==L"processer"||colname==L"ProcessedDate"|| | 
 |  |  |          colname==L"Subject"||colname==L"Content") | 
 |  |  |          { | 
 |  |  |             string ReadedFlag = dw_message.GetItemString(row,"ReadedFlag"); | 
 |  |  |             if(ReadedFlag != "Y") | 
 |  |  |             xstring ReadedFlag = dw_message.GetItemString(row,L"ReadedFlag"); | 
 |  |  |             if(ReadedFlag != L"Y") | 
 |  |  |             { | 
 |  |  |                hdr.mask =  DMS_CSSSTYLE; | 
 |  |  |                //hdr.cssstyle = "color:#cccccc"; | 
 |  |  |                hdr.cssstyle = "font-weight:700"; | 
 |  |  |                //hdr.cssstyle = L"color:#cccccc"; | 
 |  |  |                hdr.pCssStyle = (LPTSTR)L"font-weight:700"; | 
 |  |  |                 | 
 |  |  |             } | 
 |  |  |          } | 
 |  |  | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |              | 
 |  |  |       int OnDWClick(ref TNotifyEvent evt,int p) | 
 |  |  |       int OnDWClick(TEvent* evt, int p) | 
 |  |  |       { | 
 |  |  |          string UserNO=publiccode::GetUser().no; | 
 |  |  |          if(UserNO !="00701") | 
 |  |  |          xstring UserNO=publiccode::GetUser().no; | 
 |  |  |          if(UserNO !=L"00701") | 
 |  |  |          { | 
 |  |  |             ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR); | 
 |  |  |             string value = hdr.data; | 
 |  |  |             string colname = hdr.colname; | 
 |  |  |             DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; | 
 |  |  |             xstring value = hdr.data; | 
 |  |  |             xstring colname = hdr.colname; | 
 |  |  |             int row = hdr.row; | 
 |  |  |             msxml::IXMLDOMElement ele = dw_message.GetRowElement(row); | 
 |  |  |             string TaskID = ele.getAttribute("guid"); | 
 |  |  |             string ReadedFlag = dw_message.GetItemString(row,"ReadedFlag"); | 
 |  |  |             string flowName = dw_message.GetItemString(row,"flowName"); | 
 |  |  |             if(ReadedFlag != "Y") | 
 |  |  |             KXMLDOMElement ele = dw_message.GetRowElement(row); | 
 |  |  |             xstring TaskID = ele.getAttribute(L"guid"); | 
 |  |  |             xstring ReadedFlag = dw_message.GetItemString(row,L"ReadedFlag"); | 
 |  |  |             xstring flowName = dw_message.GetItemString(row,L"flowName"); | 
 |  |  |             if(ReadedFlag != L"Y") | 
 |  |  |             { | 
 |  |  |                xml x = ViewObject::RetrieveData("/sale/data/business/message/read","TaskID",TaskID); | 
 |  |  |                dw_message.SetItemString(row,"ReadedFlag","Y"); | 
 |  |  |                if(ReadedFlag != "Y" && flowName == "价格单共享") | 
 |  |  |                xml x = ViewObject::RetrieveData(L"/sale/data/business/message/read",L"TaskID",TaskID); | 
 |  |  |                dw_message.SetItemString(row,L"ReadedFlag",L"Y"); | 
 |  |  |                if(ReadedFlag != L"Y" && flowName == L"价格单共享") | 
 |  |  |                { | 
 |  |  |                   xml x1 = ViewObject::RetrieveData("/sale/data/business/Recovery/MessageStatus","TaskID",TaskID); | 
 |  |  |                   xml x1 = ViewObject::RetrieveData(L"/sale/data/business/Recovery/MessageStatus",L"TaskID",TaskID); | 
 |  |  |                } | 
 |  |  |                dw_message.Redraw(); | 
 |  |  |                //RetrieveData(); | 
 |  |  | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |                 | 
 |  |  |       int OpenShowroom1(ref TNotifyEvent evt,int p) | 
 |  |  |       int OpenShowroom1(TEvent* evt, int p) | 
 |  |  |          { | 
 |  |  |             ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR); | 
 |  |  |             string value = hdr.data; | 
 |  |  |             string colname = hdr.colname; | 
 |  |  |             DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; | 
 |  |  |             xstring value = hdr.data; | 
 |  |  |             xstring colname = hdr.colname; | 
 |  |  |             int row = hdr.row; | 
 |  |  |             msxml::IXMLDOMElement ele = dw_outbox.GetRowElement(row); | 
 |  |  |             string TaskID = ele.getAttribute("guid"); | 
 |  |  |             string Category = dw_outbox.GetItemString(row,"flowName"); | 
 |  |  |             if(Category=="普通"){ | 
 |  |  |                xaserverarg arg2 = new xaserverarg; | 
 |  |  |                arg2.setNativePointer(arg2.CreateInstance());	 | 
 |  |  |             KXMLDOMElement ele = dw_outbox.GetRowElement(row); | 
 |  |  |             xstring TaskID = ele.getAttribute(L"guid"); | 
 |  |  |             xstring Category = dw_outbox.GetItemString(row,L"flowName"); | 
 |  |  |             if(Category==L"普通"){ | 
 |  |  |                xaserverarg arg2; | 
 |  |  | 						 | 
 |  |  |                if(dw_outbox.GetRowCount() < 1) return 1; | 
 |  |  |                msxml::IXMLDOMElement ele1 = dw_outbox.GetRowElement(dw_outbox.GetRow()); | 
 |  |  |                arg2.AddArg("EntityID",dw_outbox.GetItemString(dw_outbox.GetRow(),"EntityID")); | 
 |  |  |                arg2.AddArg("id",ele1.getAttribute("guid")); | 
 |  |  |                OpenWindow("dev:xpage[message.business.vx]", cast(arg2 as int)); | 
 |  |  |                KXMLDOMElement ele1 = dw_outbox.GetRowElement(dw_outbox.GetRow()); | 
 |  |  |                arg2.AddArg(L"EntityID",dw_outbox.GetItemString(dw_outbox.GetRow(),L"EntityID")); | 
 |  |  |                arg2.AddArg(L"id",ele1.getAttribute(L"guid")); | 
 |  |  |                OpenWindow(L"dev:xpage[message.business.vx]",arg2); | 
 |  |  |                return 1; | 
 |  |  |             } | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  |              | 
 |  |  |       int OpenShowroom(ref TNotifyEvent evt,int p) | 
 |  |  |          { | 
 |  |  |             ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR); | 
 |  |  |             string value = hdr.data; | 
 |  |  |             string colname = hdr.colname; | 
 |  |  |       int OpenShowroom(TEvent* evt, int p) | 
 |  |  |       { | 
 |  |  |             DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; | 
 |  |  |             xstring value = hdr.data; | 
 |  |  |             xstring colname = hdr.colname; | 
 |  |  |             int row = hdr.row; | 
 |  |  |             msxml::IXMLDOMElement ele = dw_message.GetRowElement(row); | 
 |  |  |             string TaskID = ele.getAttribute("guid"); | 
 |  |  |             string Category = dw_message.GetItemString(row,"Category"); | 
 |  |  |             if(Category=="货号申请"){ | 
 |  |  |                int p1="" ; | 
 |  |  |                OpenWindow("dev:xpage[UserProductApply.vx]", p1); | 
 |  |  |             KXMLDOMElement ele = dw_message.GetRowElement(row); | 
 |  |  |             xstring TaskID = ele.getAttribute(L"guid"); | 
 |  |  |             xstring Category = dw_message.GetItemString(row,L"Category"); | 
 |  |  |             if(Category==L"货号申请"){ | 
 |  |  |                int p1=0 ; | 
 |  |  |                OpenWindow(L"dev:xpage[UserProductApply.vx]", p1); | 
 |  |  |             } | 
 |  |  |             if(Category=="普通"){ | 
 |  |  |                xaserverarg arg2 = new xaserverarg; | 
 |  |  |                arg2.setNativePointer(arg2.CreateInstance());	 | 
 |  |  |             if(Category==L"普通"){ | 
 |  |  |                xaserverarg arg2; | 
 |  |  | 						 | 
 |  |  |                if(dw_message.GetRowCount() < 1) return 1; | 
 |  |  |                msxml::IXMLDOMElement ele1 = dw_message.GetRowElement(dw_message.GetRow()); | 
 |  |  |                arg2.AddArg("EntityID",dw_message.GetItemString(dw_message.GetRow(),"EntityID")); | 
 |  |  |                arg2.AddArg("id",ele1.getAttribute("guid")); | 
 |  |  |                OpenWindow("dev:xpage[message.business.vx]", cast(arg2 as int)); | 
 |  |  |                KXMLDOMElement ele1 = dw_message.GetRowElement(dw_message.GetRow()); | 
 |  |  |                arg2.AddArg(L"EntityID",dw_message.GetItemString(dw_message.GetRow(),L"EntityID")); | 
 |  |  |                arg2.AddArg(L"id",ele1.getAttribute(L"guid")); | 
 |  |  |                OpenWindow(L"dev:xpage[message.business.vx]", arg2); | 
 |  |  |                return 1; | 
 |  |  |             } | 
 |  |  |             else if(Category=="报价单共享") | 
 |  |  |             else if(Category==L"报价单共享") | 
 |  |  |             { | 
 |  |  |                if(dw_message.GetRowCount() < 1) return 1; | 
 |  |  |                string No = dw_message.GetItemString(dw_message.GetRow(),"No"); | 
 |  |  |                OpenWindow("dev:xpage[EnquiryEx.quote.vx]",cast(No as int)); | 
 |  |  |                xstring No = dw_message.GetItemString(dw_message.GetRow(),L"No"); | 
 |  |  |                OpenWindow(L"dev:xpage[EnquiryEx.quote.vx]",(LPARAM)No.c_str()); | 
 |  |  |             } | 
 |  |  |             if(Category=="SupplierV3") | 
 |  |  |             if(Category==L"SupplierV3") | 
 |  |  |             { | 
 |  |  |                xaserverarg arg = new xaserverarg; | 
 |  |  |                arg.setNativePointer(arg.CreateInstance());	 | 
 |  |  |                xaserverarg arg; | 
 |  |  | 						 | 
 |  |  |                if(dw_message.GetRowCount() < 1) return 1; | 
 |  |  |                arg.AddArg("EntityID",dw_message.GetItemString(dw_message.GetRow(),"EntityID")); | 
 |  |  |                //OpenWindow("dev:xpage[maint.Owner.Supplier.v3.vx]",cast(arg as int)); | 
 |  |  |                arg.AddArg("config","/sale/view/SupplierV3/config/supplier/open"); | 
 |  |  |                OpenWindow("dev:xpage[maintex.Owner.Supplier.v3.vx]",arg.getNativePointer()); | 
 |  |  |                arg.AddArg(L"EntityID",dw_message.GetItemString(dw_message.GetRow(),L"EntityID")); | 
 |  |  |                //OpenWindow(L"dev:xpage[maint.Owner.Supplier.v3.vx]",cast(arg as int)); | 
 |  |  |                arg.AddArg(L"config",L"/sale/view/SupplierV3/config/supplier/open"); | 
 |  |  |                OpenWindow(L"dev:xpage[maintex.Owner.Supplier.v3.vx]",arg); | 
 |  |  |             } | 
 |  |  |             if(Category=="供应商回退") | 
 |  |  |             if(Category==L"供应商回退") | 
 |  |  |             { | 
 |  |  |                xaserverarg arg1 = new xaserverarg; | 
 |  |  |                arg1.setNativePointer(arg1.CreateInstance());	 | 
 |  |  |                xaserverarg arg1; | 
 |  |  | 						 | 
 |  |  |                if(dw_message.GetRowCount() < 1) return 1; | 
 |  |  |                arg1.AddArg("EntityID",dw_message.GetItemString(dw_message.GetRow(),"EntityID")); | 
 |  |  |                OpenWindow("dev:xpage[maint.Owner.Supplier.v3.vx]",cast(arg1 as int)); | 
 |  |  |                arg1.AddArg(L"EntityID",dw_message.GetItemString(dw_message.GetRow(),L"EntityID")); | 
 |  |  |                OpenWindow(L"dev:xpage[maint.Owner.Supplier.v3.vx]",arg1); | 
 |  |  |             } | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  |       int OnAttachEvent() | 
 |  |  |       { | 
 |  |  |          //绑定工具条点击事件 | 
 |  |  |          AttachEvent("WM_XCOMMAND",OnXCommand); | 
 |  |  |          AttachEvent(L"WM_XCOMMAND", (FEvent)&Business5Win::OnXCommand); | 
 |  |  |          //获取焦点事件,用于重置工具条 | 
 |  |  |          AttachEvent("WM_SETFOCUS",OnSetFocus); | 
 |  |  |          AttachEvent(L"WM_SETFOCUS", (FEvent)&Business5Win::OnSetFocus); | 
 |  |  |          //树选择 | 
 |  |  |          AttachEvent("tv_folder", "TVN_SELCHANGED",OnTreeSelChanged);  | 
 |  |  |          AttachEvent("dw_processed","DWV_ROWFOCUSCHANGED",OnRowChanged); | 
 |  |  |          AttachEvent("dw_message","DWV_ROWFOCUSCHANGED",OnRowChanged); | 
 |  |  |          AttachEvent("dw_outbox","DWV_ROWFOCUSCHANGED",OnRowChanged); | 
 |  |  |          AttachEvent("dw_Recovery","DWV_ROWFOCUSCHANGED",OnRowChanged); | 
 |  |  |          AttachEvent("dw_message","DWV_ASKSTYLE",OnItemAskStyle); | 
 |  |  |          AttachEvent("dw_message","DWV_CLICKED",OnDWClick); | 
 |  |  |          AttachEvent("dw_message","DWV_DOUBLECLICKED",OpenShowroom); | 
 |  |  |          AttachEvent("dw_outbox","DWV_DOUBLECLICKED",OpenShowroom1); | 
 |  |  |          AttachEvent(L"tv_folder", L"TVN_SELCHANGED", (FEvent)&Business5Win::OnTreeSelChanged); | 
 |  |  |          AttachEvent(L"dw_processed",L"DWV_ROWFOCUSCHANGED", (FEvent)&Business5Win::OnRowChanged); | 
 |  |  |          AttachEvent(L"dw_message",L"DWV_ROWFOCUSCHANGED", (FEvent)&Business5Win::OnRowChanged); | 
 |  |  |          AttachEvent(L"dw_outbox",L"DWV_ROWFOCUSCHANGED", (FEvent)&Business5Win::OnRowChanged); | 
 |  |  |          AttachEvent(L"dw_Recovery",L"DWV_ROWFOCUSCHANGED", (FEvent)&Business5Win::OnRowChanged); | 
 |  |  |          AttachEvent(L"dw_message",L"DWV_ASKSTYLE", (FEvent)&Business5Win::OnItemAskStyle); | 
 |  |  |          AttachEvent(L"dw_message",L"DWV_CLICKED", (FEvent)&Business5Win::OnDWClick); | 
 |  |  |          AttachEvent(L"dw_message",L"DWV_DOUBLECLICKED", (FEvent)&Business5Win::OpenShowroom); | 
 |  |  |          AttachEvent(L"dw_outbox",L"DWV_DOUBLECLICKED", (FEvent)&Business5Win::OpenShowroom1); | 
 |  |  |           | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  | 
 |  |  |        | 
 |  |  |       int  InitialFolder() | 
 |  |  |       { | 
 |  |  |          msxml::IXMLDOMElement xframeElement =  GetElement(); | 
 |  |  |          msxml::IXMLDOMElement e =  xframeElement.selectSingleNode("//xtree[@name='tv_folder']/initial"); | 
 |  |  |          KXMLDOMElement xframeElement =  GetElement(); | 
 |  |  |          KXMLDOMElement e =  xframeElement.selectSingleNode(L"//xtree[@name='tv_folder']/initial"); | 
 |  |  |           | 
 |  |  |          //msxml::IXMLDOMElement e =  xframeElement.selectSingleNode("//xtree[@name='tv_folder']/data/item[@name='"+"']"); | 
 |  |  |          //trace(e.xml); | 
 |  |  |          //KXMLDOMElement e =  xframeElement.selectSingleNode(L"//xtree[@name='tv_folder']/data/item[@name='"+L"']"); | 
 |  |  |          //trace(e.xml()); | 
 |  |  |          if(e) | 
 |  |  |             ExpandChildFolder(0,e); | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |        | 
 |  |  |       int  ExpandChildFolder(int hItem, msxml::IXMLDOMElement pElement) | 
 |  |  |       int  ExpandChildFolder(HTREEITEM hItem, KXMLDOMElement pElement) | 
 |  |  |       { | 
 |  |  |          msxml::IXMLDOMNodeList nlist = pElement.SelectNodes("Item"); | 
 |  |  |          int len = nlist.length; | 
 |  |  |          KXMLDOMNodeList nlist = pElement.selectNodes(L"Item"); | 
 |  |  |          int len = nlist.length(); | 
 |  |  |          for (int i = 0; i < len; i++) | 
 |  |  |          {    | 
 |  |  |             msxml::IXMLDOMElement e = nlist.item(i); | 
 |  |  |             string name = e.getAttribute("name"); | 
 |  |  |             string sImage = e.getAttribute("image"); | 
 |  |  |             string child = e.getAttribute("child"); | 
 |  |  |             KXMLDOMElement e = nlist.item(i); | 
 |  |  |             xstring name = e.getAttribute(L"name"); | 
 |  |  |             xstring sImage = e.getAttribute(L"image"); | 
 |  |  |             xstring child = e.getAttribute(L"child"); | 
 |  |  |             int image = 15; | 
 |  |  |             if(sImage) image = sImage.toInt(); | 
 |  |  |             int h= tv_folder.InsertChildItem(tv_folder.GetId(),hItem,name, trust(e as int),image); | 
 |  |  |             if(child !="no" ) tv_folder.SetItemChild(h,1); | 
 |  |  |             HTREEITEM h= tv_folder.InsertChildItem(hItem,name, e,image); | 
 |  |  |             if(child !=L"no" ) tv_folder.SetItemChild(h,1); | 
 |  |  |             ExpandChildFolder(h,e); | 
 |  |  |          } | 
 |  |  |          return 1;             | 
 |  |  | 
 |  |  |        | 
 |  |  |       int AdjustTip() | 
 |  |  |       { | 
 |  |  |          xml x = ViewObject::RetrieveData("/sale/data/business/list/AdjustTipNotify"); | 
 |  |  |          msxml::IXMLDOMNodeList nlist = x.GetXmlDoc().SelectNodes("/data/Item");  | 
 |  |  |          msxml::IXMLDOMNode t = nlist.item(0); | 
 |  |  |          string informationQuantity =t.selectSingleNode("informationQuantity").text; | 
 |  |  |          tv_folder.SetItemLabel(hMessage, "消息"+"("+informationQuantity+")"); | 
 |  |  |          xml x = ViewObject::RetrieveData(L"/sale/data/business/list/AdjustTipNotify"); | 
 |  |  |          KXMLDOMNodeList nlist = x.selectNodes(L"/data/Item");  | 
 |  |  |          KXMLDOMNode t = nlist.item(0); | 
 |  |  |          xstring informationQuantity =t.selectSingleNode(L"informationQuantity").text(); | 
 |  |  |          tv_folder.SetItemLabel(hMessage, (xstring)L"消息"+L"("+informationQuantity+L")"); | 
 |  |  |           | 
 |  |  |          xml x1 = ViewObject::RetrieveData("/sale/data/business/list/AdjustTipTask"); | 
 |  |  |          //alert(x1.GetXml()); | 
 |  |  |          msxml::IXMLDOMNodeList nlist1 = x1.GetXmlDoc().SelectNodes("/data/Item"); | 
 |  |  |          msxml::IXMLDOMNode t1= nlist1.item(0); | 
 |  |  |          string informationQuantityTask =t1.selectSingleNode("informationQuantityTask").text; | 
 |  |  |          tv_folder.SetItemLabel(hTask, "任务"+"("+informationQuantityTask+")"); | 
 |  |  |          xml x1 = ViewObject::RetrieveData(L"/sale/data/business/list/AdjustTipTask"); | 
 |  |  |          //alert(x1.xml()); | 
 |  |  |          KXMLDOMNodeList nlist1 = x1.selectNodes(L"/data/Item"); | 
 |  |  |          KXMLDOMNode t1= nlist1.item(0); | 
 |  |  |          xstring informationQuantityTask =t1.selectSingleNode(L"informationQuantityTask").text(); | 
 |  |  |          tv_folder.SetItemLabel(hTask, (xstring)L"任务"+L"("+informationQuantityTask+L")"); | 
 |  |  |           | 
 |  |  |          /*select count(*) from bpm_task where typ='notify' and  process='N'  | 
 |  |  |          and charindex('|'+'00303'+'|','|' + rtrim(receiver) +'|')>=1*/ | 
 |  |  | 
 |  |  |        | 
 |  |  |       int onload() | 
 |  |  |       { | 
 |  |  |          agentFor = "business"; | 
 |  |  |          agentFor = L"business"; | 
 |  |  |          OnAttachEvent(); | 
 |  |  |          dw_list = GetControl("dw_list"); | 
 |  |  |          dw_processed = GetControl("dw_processed"); | 
 |  |  |          dw_processed.openUrl("/sale/view/Business3/template/processedtask"); | 
 |  |  |          dw_processed.SetColumnState("EntityID",false); | 
 |  |  |          dw_processed.SetColumnState("Category",false); | 
 |  |  |          dw_list = GetControl(L"dw_list"); | 
 |  |  |          dw_processed = GetControl(L"dw_processed"); | 
 |  |  |          dw_processed.openUrl(L"/sale/view/Business3/template/processedtask"); | 
 |  |  |          dw_processed.SetColumnState(L"EntityID",false); | 
 |  |  |          dw_processed.SetColumnState(L"Category",false); | 
 |  |  |  | 
 |  |  |          dw_message = GetControl("dw_message"); | 
 |  |  |          dw_message.openUrl("/sale/view/Business3/template/message"); | 
 |  |  |          dw_message = GetControl(L"dw_message"); | 
 |  |  |          dw_message.openUrl(L"/sale/view/Business3/template/message"); | 
 |  |  |          dw_message.SetAskStyle(true); | 
 |  |  |          dw_message.SetColumnState("EntityID",false); | 
 |  |  |          dw_message.SetColumnState("Category",false); | 
 |  |  |          dw_message.SetColumnState("ReadedFlag",false); | 
 |  |  |          dw_message.SetColumnState(L"EntityID",false); | 
 |  |  |          dw_message.SetColumnState(L"Category",false); | 
 |  |  |          dw_message.SetColumnState(L"ReadedFlag",false); | 
 |  |  |           | 
 |  |  |          dw_outbox = GetControl("dw_outbox"); | 
 |  |  |          dw_outbox.openUrl("/sale/view/Business3/template/outbox"); | 
 |  |  |          dw_outbox.SetColumnState("EntityID",false); | 
 |  |  |          dw_outbox = GetControl(L"dw_outbox"); | 
 |  |  |          dw_outbox.openUrl(L"/sale/view/Business3/template/outbox"); | 
 |  |  |          dw_outbox.SetColumnState(L"EntityID",false); | 
 |  |  |           | 
 |  |  |          dw_Recovery = GetControl("dw_Recovery"); | 
 |  |  |          dw_Recovery.openUrl("/sale/view/Business3/template/message"); | 
 |  |  |          dw_Recovery.SetColumnState("EntityID",false); | 
 |  |  |          dw_Recovery.SetColumnState("Category",false); | 
 |  |  |          dw_Recovery.SetColumnState("ReadedFlag",false); | 
 |  |  |          dw_Recovery.SetColumnState("No",false); | 
 |  |  |          dw_Recovery = GetControl(L"dw_Recovery"); | 
 |  |  |          dw_Recovery.openUrl(L"/sale/view/Business3/template/message"); | 
 |  |  |          dw_Recovery.SetColumnState(L"EntityID",false); | 
 |  |  |          dw_Recovery.SetColumnState(L"Category",false); | 
 |  |  |          dw_Recovery.SetColumnState(L"ReadedFlag",false); | 
 |  |  |          dw_Recovery.SetColumnState(L"No",false); | 
 |  |  |           | 
 |  |  |           | 
 |  |  |          tv_folder = GetControl("tv_folder"); | 
 |  |  |          tv_folder = GetControl(L"tv_folder"); | 
 |  |  |          tv_folder.SetLineAtRoot(true); | 
 |  |  |          sheet = GetChildWin("sheet1"); | 
 |  |  |          sheet = GetChildWin(L"sheet1"); | 
 |  |  |           | 
 |  |  |          int hItem = tv_folder.GetRootItem(); | 
 |  |  |          HTREEITEM hItem = tv_folder.GetRootItem(); | 
 |  |  |          tv_folder.ExpandItem(hItem); | 
 |  |  |          int hcItem =tv_folder.GetChildItem(hItem); | 
 |  |  |          HTREEITEM hcItem =tv_folder.GetChildItem(hItem); | 
 |  |  |          hTask = hcItem; | 
 |  |  |          tv_folder.ExpandItemAll(hcItem); | 
 |  |  |          tv_folder.ItemFocus(tv_folder.GetChildItem(hcItem)); | 
 |  |  | 
 |  |  |           | 
 |  |  |          return 1; | 
 |  |  |       }       | 
 |  |  |    }; | 
 |  |  | ] | 
 |  |  |    }; |