xj qian
2024-09-25 703d27d52ba0ac373b62aedb93f9cfe9f8857ed2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#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;
    }
 
    //ÃüÁî·¢²¼º¯Êý
    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())
                {
                    xaserverarg arg = GetArg();
                    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;
    }
 
};