LiFan
10 天以前 63eebabbfee1bc84850b36967ecac5116a28b73f
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
#include <wobject/xstring.hpp>
#include <xcontrol/xtreeview.hpp>
#include <xcontrol/xdwgrid.hpp>
#include <wobject/xdouble.hpp>
#include <xcontrol/xlayersheet.hpp>
 
#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp"
#include "viewobject/view.base.hpp"
 
using xml = KXMLDOMDocument;
class  __declspec(dllexport) PaymentTermlist111 : public listwin
{
public:
 
    xdwgrid  dw_list;
public:
    PaymentTermlist111(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {}
public:
    static PaymentTermlist111* CreateInstance(void* implPtr, void* hWnd)
    {
        PaymentTermlist111* pWin = new PaymentTermlist111(implPtr, (HWND)hWnd);
        return pWin;
    }
    //xdwgrid    dw_list; 
    int OnDBClick(TEvent* evt, LPARAM p)
    {
        DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh;
        int row = hdr.row;
        //alert(row.toString());
        KXMLDOMElement e = dw_list.GetRowElement(row);
        xstring id = e.selectSingleNode(L"TermID").text();
        //alert( id);
        xaserverarg arg ;
        
        arg.AddArg(L"EntityID", id);
        //arg.AddArg(L"hwnd", GetHWND().toString());
        
        openUrl(L"/sale/view/Payment/worknode/Payment/maint", arg);
        if (arg.GetArgString(L"ret") == L"Ok")
        {
            alert(L"OK");
            listwin::onloaded();
        }                
        return 1;
    }    
    int OnDelete()
    {
        int row = dw_list.GetRow();
        if (row < 1) return 1;                
        KXMLDOMElement ele = dw_list.GetRowElement(row);
        xstring termid = ele.selectSingleNode(L"TermID").text();
        xaserverarg  arg; 
            
        arg.AddArg(L"termId",termid);
        //alert(termid);
        xml x1 ;
    
        if (xurl::post(L"/sale/data/PaymentTerm/entity/delete",arg.GetString(),x1) != 1)
        {
            xstring error = x1.text();
            trace(error);
        }
        else
        {
            //error = x1.text();
            //alert(error);
            MessageBox(GetHWND(),L"ɾ³ý³É¹¦£¡",L"Ìáʾ",0);
            dw_list.DeleteRow(row);
        }
    }
        
    int OnNew()
    {
        xaserverarg arg ;
        
        arg.AddArg(L"EntityID", L"new");
        
        //openUrl(L"/sale/view/Test/worknode/company/maint", arg);
        openUrl(L"/sale/view/Payment/worknode/Payment/maint", arg);
        return 0;
    }
    int OnOpen()
    {
        xaserverarg arg ;
        
        int row = dw_list.GetRow();
        if (row < 1) 
        {
            MessageBox(GetHWND(),L"ÇëÑ¡ÖÐÒªÐ޸ĵÄÐУ¡",L"Ìáʾ",0);
            return -1;
        }
        KXMLDOMElement e = dw_list.GetRowElement(row);
        xstring guid = e.selectSingleNode(L"TermID").text();
        arg.AddArg(L"EntityID",guid);
        
        openUrl(L"/sale/view/Test2/worknode/company2/maint", arg);
    
    }
    int OnRefresh()
    {
        listwin::onloaded();
        return 0;
    }
    //°´Å¥Ê¼þ
    int OnCmdDispatch(xstring comdid)
    {
        //alert(comdid);
        if (comdid == L"action:bill.new") return OnNew();
        else if(comdid == L"action:bill.open") return OnOpen();        
        else if(comdid == L"Refresh") return OnRefresh();
        else if(comdid == L"action:bill.delete") return OnDelete();        
        return 0;
    }    
    int OnXCommand(TEvent* evt, LPARAM param)
    {
        return OnCmdDispatch(evt->xcommand.pStrID);
    }
    //ÃüÁî·¢²¼º¯Êý
    int OnAttachEvent()
    {
        AttachEvent(L"WM_XCOMMAND", (FEvent)&PaymentTermlist111::OnXCommand);
        //AttachEvent(L"WM_SETFOCUS",OnSetFocus);
 
        //AttachEvent(L"dw_list",L"DWV_ROWFOCUSCHANGED",OnRowChanged);
        AttachEvent(L"dw_list",L"DWV_DOUBLECLICKED", (FEvent)&PaymentTermlist111::OnDBClick);
        return 1;
    }
    int onload()
    {
        SetAgent();
        listwin::onload();
        OnAttachEvent();
        return 1;
    }
    
    int onloaded()
    {
        //OnRetrieve();
        //alert(L"12");
        listwin::onloaded();
            
            
        return -1; 
    }
};