#include <wobject/xstring.hpp> 
 | 
#include <xcontrol/xtreeview.hpp> 
 | 
#include <xcontrol/xdwgrid.hpp> 
 | 
#include <wobject/xdouble.hpp> 
 | 
#include <xcontrol/xlayersheet.hpp> 
 | 
#include <xcontrol/xdatetimepick.hpp> 
 | 
#include <xcontrol/xshtml.hpp> 
 | 
  
 | 
  
 | 
#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" 
 | 
#include "viewobject/view.base.hpp" 
 | 
  
 | 
using xml = KXMLDOMDocument; 
 | 
class __declspec(dllexport) QuoteFilePurch2Select :  public xframe 
 | 
{ 
 | 
public: 
 | 
    xdwgrid dw_process; 
 | 
  
 | 
    xnode    m_agentNode;    //Agent Condition 
 | 
    xstring EntityID; 
 | 
  
 | 
public: 
 | 
    QuoteFilePurch2Select(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} 
 | 
public: 
 | 
    static QuoteFilePurch2Select* CreateInstance(void* implPtr, void* hWnd) 
 | 
    { 
 | 
        return  new QuoteFilePurch2Select(implPtr, (HWND)hWnd); 
 | 
    } 
 | 
  
 | 
    int SetAgent() 
 | 
    { 
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    int OnRowChanged(TEvent* evt, LPARAM p) 
 | 
    { 
 | 
        //fixed one event only one process 
 | 
        DWNMHDR&  hdr = *(DWNMHDR*)evt->notify.pnmh; 
 | 
        int row = hdr.row; 
 | 
        KXMLDOMElement ele = dw_process.GetRowElement(row); 
 | 
  
 | 
        xaserverarg arg ; 
 | 
        arg.AddArg(L"content", ele.xml()); 
 | 
        xml doc; 
 | 
        if (getUrl(L"/sale/data/vpage/vstart/task", arg.GetString(), doc) != 1) 
 | 
        { 
 | 
            trace((xstring)L"error->:" + doc.xml()); 
 | 
            return 0; 
 | 
        } 
 | 
        if ((xstring)doc.xml() == L"") 
 | 
            return -1; 
 | 
  
 | 
        xshtml ht = GetControl(L"taskinfo"); 
 | 
        ht.SetContent(doc.xml()); 
 | 
        ht.Redraw(); 
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    int RetrieveData() 
 | 
    { 
 | 
        xml x = ViewObject::RetrieveData(L"/sale/data/business/list/task/quote/enquiry", L"Category", L"QuoteEnquiry", 
 | 
            L"EntityID", EntityID); 
 | 
        dw_process.Retrieve(x); 
 | 
        dw_process.Redraw(); 
 | 
        dw_process.SetReadOnly(true); 
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    //½¹µã¼¤»î´¦Àíº¯Êý 
 | 
    int OnSetFocus(TEvent* evt, LPARAM param) 
 | 
    { 
 | 
        //ÖØÖù¤¾ßÌõ 
 | 
        SetAgent(); 
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    xstring GetReason(LPARAM pr) 
 | 
    { 
 | 
        xaserverarg arg; 
 | 
        arg.AddArg(L"EntityID", GetEntityID(2),L"xs:string"); 
 | 
        openUrl(L"/sale/view/workflow.view/xpage/chkdlg_vd", &arg);    //---openUrl("/sale/view/workflow.view/xpage/chkdlg", arg);                                 
 | 
        xstring comdid = arg.GetArgString(L"comdid"); 
 | 
        if (comdid == L"xmOK") 
 | 
        { 
 | 
            xstring value = arg.GetArgString(L"content"); 
 | 
            if (value == L"")value = L"."; 
 | 
            return value; 
 | 
        } 
 | 
        return L""; 
 | 
    } 
 | 
  
 | 
    //ÃüÁî·¢²¼º¯Êý 
 | 
    int OnCmdDispatch(xstring comdid) 
 | 
    { 
 | 
        if (comdid == L"xmOk") 
 | 
        { 
 | 
            int row = dw_process.GetRow(); 
 | 
            if (row > 0) 
 | 
            { 
 | 
                xstring TaskID = dw_process.GetItemString(row, L"taskid"); 
 | 
                if (GetWinParam()) 
 | 
                { 
 | 
                    xstring reason = GetReason(0); 
 | 
                    if (reason == L"")return 1; 
 | 
                    xaserverarg arg = GetArg(); 
 | 
                    arg.AddArg(L"Reason", reason); 
 | 
                    arg.AddArg(L"TaskID", TaskID); 
 | 
                    CloseWindow(); 
 | 
                    return 1; 
 | 
                } 
 | 
            } 
 | 
            return 1; 
 | 
        } 
 | 
        if (comdid == L"xmCancel") 
 | 
        { 
 | 
            CloseWindow(); 
 | 
            return 1; 
 | 
        } 
 | 
  
 | 
        return 0; 
 | 
    } 
 | 
  
 | 
    //ÃüÁî´¦Àíʼþ 
 | 
    int OnXCommand(TEvent* evt, int param) 
 | 
    { 
 | 
        return OnCmdDispatch(evt->xcommand.pStrID); 
 | 
    } 
 | 
  
 | 
  
 | 
    int OnAttachEvent() 
 | 
    { 
 | 
        //°ó¶¨¹¤¾ßÌõµã»÷ʼþ 
 | 
        AttachEvent(L"WM_XCOMMAND", (FEvent)&QuoteFilePurch2Select::OnXCommand); 
 | 
        //»ñÈ¡½¹µãʼþ£¬ÓÃÓÚÖØÖù¤¾ßÌõ 
 | 
        //AttachEvent("WM_SETFOCUS",OnSetFocus); 
 | 
        AttachEvent(L"dw_process", L"DWV_ROWFOCUSCHANGED", (FEvent)&QuoteFilePurch2Select::OnRowChanged); 
 | 
        //AttachEvent("dw_process","DWV_ASKSTYLE",OnItemAskStyle); 
 | 
        //AttachEvent("dw_process","DWV_DOUBLECLICKED",OnDoubleClicked); 
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    int onload() 
 | 
    { 
 | 
        SetArg(); 
 | 
        //dw_process = GetControl("xxx"); 
 | 
        //dw_process.openUrl("xxx"); 
 | 
        dw_process = GetControl(L"dw_process"); 
 | 
        dw_process.openUrl(L"/sale/view/Business3/template/QuoteFilePurchrList"); 
 | 
        dw_process.SetColumnState(L"taskid", false); 
 | 
        dw_process.SetColumnState(L"EntityID", false); 
 | 
        dw_process.SetColumnState(L"Category", false); 
 | 
        dw_process.SetColumnState(L"content2", false); 
 | 
        dw_process.SetAskStyle(true); 
 | 
  
 | 
        EntityID = L""; 
 | 
        if (GetWinParam()) 
 | 
        { 
 | 
            xaserverarg arg = GetArg(); 
 | 
            EntityID = arg.GetArgString(L"EntityID"); 
 | 
            arg.AddArg(L"TaskID", L""); 
 | 
        } 
 | 
  
 | 
        OnAttachEvent(); 
 | 
        RetrieveData(); 
 | 
  
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
}; 
 |