#include <wobject/xstring.hpp> 
 | 
#include <xcontrol/xtreeview.hpp> 
 | 
#include <xcontrol/xdwgrid.hpp> 
 | 
#include <xcontrol/xcell.hpp> 
 | 
  
 | 
  
 | 
#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" 
 | 
#include "viewobject/view.base.hpp" 
 | 
  
 | 
using xml = KXMLDOMDocument; 
 | 
    class  __declspec(dllexport) ProcessManagement :  public xframe 
 | 
    { 
 | 
    public: 
 | 
        xdwgrid    dw_list; 
 | 
        xnode    m_agentNode;    //Agent Condition 
 | 
         
 | 
    public: 
 | 
        ProcessManagement(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} 
 | 
    public: 
 | 
        static ProcessManagement* CreateInstance(void* implPtr, void* hWnd) 
 | 
        { 
 | 
            ProcessManagement* pWin = new ProcessManagement(implPtr, (HWND)hWnd); 
 | 
            return pWin; 
 | 
        } 
 | 
        int SetAgent() 
 | 
        { 
 | 
            xstring xfNodeAgentArea  = L"agentarea"; 
 | 
            xnode anode = GetAgentNode(xfNodeAgentArea); 
 | 
            if(m_agentNode) 
 | 
            { 
 | 
                SetAgentNode (anode,m_agentNode); 
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                KXMLDOMElement xframeElement =  GetElement(); 
 | 
                KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/"+xfNodeAgentArea+L"[1]/*"); 
 | 
                if(agent) 
 | 
                { 
 | 
                    xstring s = agent.xml(); 
 | 
                    m_agentNode =  SetAgentNode (anode,s); 
 | 
                } 
 | 
            } 
 | 
            return 1; 
 | 
        } 
 | 
  
 | 
        //½¹µã¼¤»î´¦Àíº¯Êý 
 | 
        int OnSetFocus(TEvent* evt, LPARAM param) 
 | 
        { 
 | 
            //ÖØÖù¤¾ßÌõ 
 | 
            SetAgent(); 
 | 
            return 1; 
 | 
        } 
 | 
             
 | 
        //ÃüÁî·¢²¼º¯Êý 
 | 
        int OnCmdDispatch(xstring comdid) 
 | 
        {     
 | 
             
 | 
            if(comdid == L"xmDelete") 
 | 
            { 
 | 
                int MB_OKCANCEL = 1; 
 | 
                int IDOK  = 1; 
 | 
                int ret =MessageBox(GetHWND(),L"È·ÈÏɾ³ýÁ÷³Ì?",L"Ìáʾ",MB_OKCANCEL); 
 | 
                if(ret == IDOK) 
 | 
                { 
 | 
                    int row = dw_list.GetRow(); 
 | 
                    xstring TaskID = dw_list.GetItemString(row,L"TaskID"); 
 | 
                 
 | 
                 
 | 
                    xml x = ViewObject::RetrieveData(L"/sale/data/business/DelProcessManagement",L"TaskID",TaskID); 
 | 
                    xstring status = x.xml(); 
 | 
                    if(status.find(L"ok") == 1) 
 | 
                    { 
 | 
                        alert(L"ɾ³ý³É¹¦"); 
 | 
                        dw_list.DeleteRow(row); 
 | 
                    }else 
 | 
                    { 
 | 
                        alert(L"ɾ³ýʧ°Ü"); 
 | 
                    } 
 | 
                 
 | 
                } 
 | 
                return 1; 
 | 
                 
 | 
            } 
 | 
            else if (comdid == L"xmRefresh") 
 | 
            { 
 | 
                OnRetrieve(); 
 | 
            } 
 | 
            else if (comdid == L"AA") 
 | 
            { 
 | 
                AA(); 
 | 
            } 
 | 
            return 0; 
 | 
        } 
 | 
        int AA() 
 | 
        {         
 | 
         
 | 
                //xstring FobUnitPriceEx=dw_cell.GetItemString(row,colFOBPrice); 
 | 
            xstring FobUnitPriceEx=L"$123.0"; 
 | 
            if(FobUnitPriceEx==L"$") FobUnitPriceEx=L"123"; 
 | 
            //alert(FobUnitPriceEx.find(L"$").toString()); 
 | 
            if(FobUnitPriceEx.find(L"$") >=0) FobUnitPriceEx=FobUnitPriceEx.right(FobUnitPriceEx.length() - 1); 
 | 
            trace(FobUnitPriceEx); 
 | 
            return 1; 
 | 
        } 
 | 
        //´¥·¢Êó±êÀ뿪ºótranʼþ£¬Í¨¹ý²éÕÒij¸ö²ÎÊýµÃµ½¶ÔÓ¦µÄÁР            
 | 
        int OnBaseItemChanged(TEvent* evt, int p) 
 | 
        { 
 | 
            DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; 
 | 
            xstring colname=hdr.colname; 
 | 
            xstring value = hdr.data; 
 | 
             
 | 
            xstring dwname = L"dw_list"; 
 | 
            if(value != L"") 
 | 
            { 
 | 
                KXMLDOMNodeList nlist = GetElement().selectNodes(L"//*[@name='"+dwname+L"']/trans[@for='"+colname+L"']"); 
 | 
                ViewObject::TransData(nlist, dw_list, hdr.row, colname, value); 
 | 
            } 
 | 
  
 | 
            return 1; 
 | 
        } 
 | 
             
 | 
         
 | 
        //ÃüÁî´¦Àíʼþ 
 | 
        int OnXCommand(TEvent* evt, LPARAM param) 
 | 
        { 
 | 
            return OnCmdDispatch(evt->xcommand.pStrID); 
 | 
        } 
 | 
             
 | 
         
 | 
         
 | 
        int OnAttachEvent() 
 | 
        { 
 | 
            //°ó¶¨¹¤¾ßÌõµã»÷ʼþ 
 | 
            AttachEvent(L"WM_XCOMMAND", (FEvent)&ProcessManagement::OnXCommand); 
 | 
            //»ñÈ¡½¹µãʼþ£¬ÓÃÓÚÖØÖù¤¾ßÌõ 
 | 
            AttachEvent(L"WM_SETFOCUS", (FEvent)&ProcessManagement::OnSetFocus); 
 | 
            AttachEvent(L"dw_list",L"DWV_ITEMCHANGED", (FEvent)&ProcessManagement::OnBaseItemChanged); 
 | 
            return 1; 
 | 
        } 
 | 
             
 | 
  
 | 
        int  OnRetrieve() 
 | 
        { 
 | 
            xml x; 
 | 
            xaserverarg arg; 
 | 
            if (getUrl(L"/sale/data/business/ProcessManagement",arg.GetString(),x)!=1) 
 | 
            { 
 | 
                trace(x.text()); 
 | 
                return -1; 
 | 
            }else     
 | 
            { 
 | 
                dw_list.Retrieve(x); 
 | 
                dw_list.Redraw(); 
 | 
                dw_list.SetReadOnly(true); 
 | 
                dw_list.SetSelectionMode(1); 
 | 
            } 
 | 
            return 1; 
 | 
        } 
 | 
     
 | 
        int onload() 
 | 
        { 
 | 
            dw_list = GetControl(L"dw_list"); 
 | 
            dw_list.openUrl(L"/sale/view/Business3/template/ProcessManagement"); 
 | 
            dw_list.SetColumnState(L"TaskID",false); 
 | 
             
 | 
            OnRetrieve(); 
 | 
             
 | 
            OnAttachEvent();     
 | 
             
 | 
            return 1; 
 | 
        } 
 | 
         
 | 
        int onloaded() 
 | 
        { 
 | 
            SetAgent(); 
 | 
             
 | 
             
 | 
             
 | 
            return 1; 
 | 
        }         
 | 
    }; 
 |