#include <wobject/xstring.hpp> 
 | 
#include <xcontrol/xtreeview.hpp> 
 | 
#include <xcontrol/xdwgrid.hpp> 
 | 
#include <wobject/xdouble.hpp> 
 | 
#include <xcontrol/xlayersheet.hpp> 
 | 
#include <wobject/xpage.hpp> 
 | 
  
 | 
#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" 
 | 
#include "viewobject/view.base.hpp" 
 | 
  
 | 
using xml = KXMLDOMDocument; 
 | 
class __declspec(dllexport) QuickCode : public xframe 
 | 
{ 
 | 
public: 
 | 
    xdwgrid    dw_list; 
 | 
  
 | 
    xstring m_config; 
 | 
    xstring m_agent; 
 | 
    xstring m_id; 
 | 
    xstring m_dbmap; 
 | 
    xstring m_name; 
 | 
    xstring strconfig; 
 | 
    KXMLDOMDocument m_configDoc; 
 | 
    xnode    m_agentNode; 
 | 
public: 
 | 
    QuickCode(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} 
 | 
public: 
 | 
    static QuickCode* CreateInstance(void* implPtr, void* hWnd) 
 | 
    { 
 | 
        QuickCode* pWin = new QuickCode(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(); 
 | 
            //alert(m_configDoc.xml()); 
 | 
            KXMLDOMElement agent = m_configDoc.selectSingleNode(L"Config/" + xfNodeAgentArea + L"[1]/*"); 
 | 
            if (agent) 
 | 
            { 
 | 
                xstring s = agent.xml(); 
 | 
                m_agentNode = SetAgentNode(anode, s); 
 | 
            } 
 | 
        } 
 | 
        return 1; 
 | 
    } 
 | 
  
 | 
    int OnCmdDispatch(xstring comdid) 
 | 
    { 
 | 
  
 | 
        HCURSOR hCursor = xutil::SetCursorWait(); 
 | 
        if (comdid == L"save") { 
 | 
            //type 
 | 
            xaserverarg args; 
 | 
  
 | 
            args.AddArg(L"id", m_id); 
 | 
            args.AddArg(L"name", m_name); 
 | 
            xml y; 
 | 
  
 | 
            //TDataSet::exec(m_config,L"savetype",args,y); 
 | 
            //url::post(L"QuickCode/pref/quickcode_type.save",args.GetString(),y);              
 | 
            //save 
 | 
  
 | 
            xml x; 
 | 
  
 | 
            xaserverarg arg; 
 | 
  
 | 
            dw_list.AcceptText(); 
 | 
            dw_list.DwUpdateAllToEx(x); 
 | 
            KXMLDOMElement e = x.documentElement(); 
 | 
            e.setAttribute(L"id", m_id); 
 | 
            //arg.AddArg(L"id",m_id); 
 | 
            arg.AddArg(L"content", e.xml()); 
 | 
            arg.AddArg(L"dbmap", m_dbmap); 
 | 
            //trace(L"-->",m_id);                     
 | 
            //trace(L"-->",m_dbmap); 
 | 
            //trace(e.xml());                 
 | 
            /*if(TDataSet::exec(m_config,L"save",arg,x)!=1) 
 | 
            { 
 | 
                trace(L"error:"+x.xml()); 
 | 
                alert(L"±£´æ³ö´í!"); 
 | 
                return 0; 
 | 
            }*/ 
 | 
            //trace(m_dbmap); 
 | 
            trace(x.xml()); 
 | 
            if (xurl::get(L"QuickCode/pref/quickcode.save", arg.GetString(), x) != 1) 
 | 
            { 
 | 
                xstring error = x.text(); 
 | 
                trace(error); 
 | 
            } 
 | 
            trace(x.xml()); 
 | 
            if (x.selectSingleNode(L"error")) 
 | 
            { 
 | 
                alert(L"±£´æ³ö´í2!"); 
 | 
                return 0; 
 | 
            } 
 | 
            dw_list.ResetUpdateStatus(); 
 | 
            alert(L"±£´æ³É¹¦!"); 
 | 
        } 
 | 
        else if (comdid == L"add") { 
 | 
            dw_list.InsertRow(0); 
 | 
            int rows = dw_list.GetRowCount(); 
 | 
            dw_list.SetRow(rows); 
 | 
            dw_list.SetItemString(rows, L"ToCurrencyCode", L"RMB"); 
 | 
            dw_list.SetItemDisplayString(rows, L"ToCurrencyCode", L"ÈËÃñ±Ò"); 
 | 
        } 
 | 
        else if (comdid == L"insert") { 
 | 
            int row = dw_list.GetRow(); 
 | 
            if (row<1 || row>dw_list.GetRowCount()) return 0; 
 | 
            dw_list.InsertRow(row); 
 | 
            dw_list.SetItemString(row, L"ToCurrencyCode", L"RMB"); 
 | 
            dw_list.SetItemDisplayString(row, L"ToCurrencyCode", L"ÈËÃñ±Ò"); 
 | 
        } 
 | 
        else if (comdid == L"delet") { 
 | 
            /*int rows = dw_list.GetRowCount(); 
 | 
            int row2 = dw_list.GetPrevSelectRow(rows); 
 | 
            while(row2 > 0){ 
 | 
                dw_list.DeleteRow(row2); 
 | 
                row2 = dw_list.GetPrevSelectRow(row2 - 1); 
 | 
            } 
 | 
            dw_list.SelectRow(0, false);*/ 
 | 
            int row2 = dw_list.GetRow(); 
 | 
            if (row2<1 || row2>dw_list.GetRowCount()) return 0; 
 | 
            dw_list.DeleteRow(row2); 
 | 
        } 
 | 
        else if (comdid == L"import") { 
 | 
            if (m_id == L"FND_ExchangeRate") 
 | 
            { 
 | 
                int ll_delq = MessageBox(GetHWND(), L"È·¶¨Òª´ÓÀÏϵͳµ¼Èë»ãÂÊÊý¾ÝÂð?", L"Ìáʾ", 1); 
 | 
                if (ll_delq != 1) 
 | 
                    return 0; 
 | 
                xml xi; 
 | 
  
 | 
                xaserverarg argi; 
 | 
                 
 | 
                if (xurl::get(L"QuickCode/ExchangeRate/import", argi.GetString(), xi) != 1) 
 | 
                { 
 | 
                    trace(xi.text()); 
 | 
                    return -1; 
 | 
                } 
 | 
                alert(L"µ¼Èë³É¹¦!"); 
 | 
                dw_list.Redraw(); 
 | 
            } 
 | 
  
 | 
        } 
 | 
        xutil::RestoreCursor(hCursor); 
 | 
        return 0; 
 | 
    } 
 | 
    int OnXCommand(TEvent* evt, LPARAM param) 
 | 
    { 
 | 
        return OnCmdDispatch(evt->xcommand.pStrID); 
 | 
    } 
 | 
    int OnSetFocus(TEvent* evt, LPARAM p) { 
 | 
        SetAgent(); 
 | 
        return 1; 
 | 
    } 
 | 
    int OnClicked(TEvent* evt, LPARAM p) 
 | 
    { 
 | 
        DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; 
 | 
        int row = hdr.row; 
 | 
        int col = hdr.col + 1; 
 | 
        xstring colname = dw_list.GetColumnName(col); 
 | 
        trace(colname); 
 | 
        xaserverarg arg; 
 | 
  
 | 
        xstring comdid; 
 | 
        if (colname == L"CategoryID") 
 | 
        { 
 | 
            openUrl(L"²úÆ·×ÊÁÏ.vface/xpage/product/category/dialog", arg); 
 | 
            comdid = arg.GetArgString(L"comdid"); 
 | 
            if (comdid == L"ok") 
 | 
            { 
 | 
                xstring CategoryID = arg.GetArgString(L"CategoryID"); 
 | 
                xstring CName = arg.GetArgString(L"CName"); 
 | 
                dw_list.SetItemDisplayString(row, colname.c_str(), CName); 
 | 
                dw_list.SetItemString(row, colname.c_str(), CategoryID); 
 | 
                dw_list.Redraw(); 
 | 
            } 
 | 
        } 
 | 
        else if (colname == L"MkOrgId") 
 | 
        { 
 | 
            openUrl(L"×éÖ¯¼Ü¹¹.vface/xpage/HrOrg/Chart", arg); 
 | 
            comdid = arg.GetArgString(L"comdid"); 
 | 
            if (comdid == L"xmOk") 
 | 
            { 
 | 
                xstring OrgName = arg.GetArgString(L"OrgName"); 
 | 
                xstring OrgId = arg.GetArgString(L"OrgId"); 
 | 
                dw_list.SetItemDisplayString(row, colname.c_str(), OrgName); 
 | 
                dw_list.SetItemString(row, colname.c_str(), OrgId); 
 | 
                dw_list.Redraw(); 
 | 
            } 
 | 
        } 
 | 
        else if (colname == L"Cid") 
 | 
        { 
 | 
            openUrl(L"×éÖ¯¼Ü¹¹.vface/xpage/hremployee/select", arg); 
 | 
            comdid = arg.GetArgString(L"comdid"); 
 | 
            if (comdid == L"xmOk") 
 | 
            { 
 | 
                xstring sPersonID = arg.GetArgString(L"sPersonID"); 
 | 
                trace(sPersonID); 
 | 
                xstring sPersonName = arg.GetArgString(L"sPersonName"); 
 | 
                dw_list.SetItemDisplayString(row, colname.c_str(), sPersonName); 
 | 
                dw_list.SetItemString(row, colname.c_str(), sPersonID); 
 | 
                dw_list.Redraw(); 
 | 
            } 
 | 
        } 
 | 
        return 1; 
 | 
    } 
 | 
    int OnDoubleClicked(TEvent* evt, LPARAM p) 
 | 
    { 
 | 
        DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; 
 | 
        int row = hdr.row; 
 | 
        if (row<1 || row > dw_list.GetRowCount()) return 0; 
 | 
  
 | 
        xaserverarg arg; 
 | 
  
 | 
        //xstring str = hdr.data; 
 | 
        xstring colname = hdr.colname; 
 | 
        xstring str = dw_list.GetItemString(row, colname.c_str()); 
 | 
        arg.AddArg(L"value", str); 
 | 
        openUrl(L"/sale/view/view.dlg/xpage/memo/edit", arg); 
 | 
        xstring comdid = arg.GetArgString(L"comdid"); 
 | 
        if (comdid == L"xmOK") 
 | 
        { 
 | 
            xstring value = arg.GetArgString(L"value"); 
 | 
            dw_list.SetItemString(row, colname.c_str(), value); 
 | 
            dw_list.Redraw(); 
 | 
        } 
 | 
  
 | 
        return 1; 
 | 
    } 
 | 
    int ItemOutput() 
 | 
    { 
 | 
        xstring d = publiccode::GetCurrentDate(); 
 | 
        d = d.left(10) + L""; 
 | 
        dw_list.SaveAs(d); 
 | 
        return 1; 
 | 
    } 
 | 
    int OnSelectAllRow() 
 | 
    { 
 | 
        int rows = dw_list.GetRowCount(); 
 | 
        if (rows < 1) return -1; 
 | 
        dw_list.SelectRow(1, rows, true); 
 | 
        dw_list.Redraw(); 
 | 
        return 1; 
 | 
    } 
 | 
    int OnRowCopy() 
 | 
    { 
 | 
        int rows = dw_list.GetRowCount(); 
 | 
        if (rows < 1) return -1; 
 | 
        int cols = dw_list.GetColumnCount(); 
 | 
        xstring str = L""; 
 | 
        int row = dw_list.GetNextSelectRow(1); 
 | 
        int i; 
 | 
        while (row > 0) 
 | 
        { 
 | 
            xstring tmp1 = L""; 
 | 
            for (i = 1; i < cols; i++) 
 | 
            { 
 | 
                int w = dw_list.GetColumnWidth(i); 
 | 
                if (w < 5) continue; 
 | 
                xstring tmp; 
 | 
                if (dw_list.GetItemDisplayString(row, i + 1)) 
 | 
                    tmp = dw_list.GetItemDisplayString(row, i + 1); 
 | 
                else 
 | 
                    tmp = dw_list.GetItemString(row, i + 1); 
 | 
                tmp1 += tmp + L"\t"; 
 | 
            } 
 | 
            str += tmp1 + L"\r\n"; 
 | 
            row = dw_list.GetNextSelectRow(row + 1); 
 | 
        } 
 | 
        dw_list.SetDataToClip(str); 
 | 
        return 1; 
 | 
    } 
 | 
    int OnColCopy(xstring col) 
 | 
    { 
 | 
        int rows = dw_list.GetRowCount(); 
 | 
        if (rows < 1) return -1; 
 | 
        xstring str = L""; 
 | 
        int row = dw_list.GetNextSelectRow(1); 
 | 
        while (row > 0) 
 | 
        { 
 | 
            xstring tmp; 
 | 
            if (dw_list.GetItemDisplayString(row, col.c_str())) 
 | 
                tmp = dw_list.GetItemDisplayString(row, col.c_str()); 
 | 
            else 
 | 
                tmp = dw_list.GetItemString(row, col.c_str()); 
 | 
            str += tmp + L"\r\n"; 
 | 
            row = dw_list.GetNextSelectRow(row + 1); 
 | 
        } 
 | 
        dw_list.SetDataToClip(str); 
 | 
  
 | 
        return 1; 
 | 
    } 
 | 
    int OnRClick(TEvent* evt, LPARAM p) 
 | 
    { 
 | 
        DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; 
 | 
        int row = hdr.row; 
 | 
  
 | 
        HMENU m = CreatePopupMenu(); 
 | 
        int MF_STRING = 0x00000000; 
 | 
        int MF_DISABLED = 0x00000002; 
 | 
        int TPM_RIGHTBUTTON = 0x0002; 
 | 
        int TPM_RETURNCMD = 0x0100; 
 | 
        int MF_CHECKED = 0x8; 
 | 
        int MF_SEPARATOR = 0x0800; 
 | 
        AppendMenu(m, MF_STRING, 1, L"¸´ÖÆÐÐ"); 
 | 
        AppendMenu(m, MF_STRING, 101, L"¸´ÖÆÁÐ"); 
 | 
        AppendMenu(m, MF_SEPARATOR, -1, L""); 
 | 
        AppendMenu(m, MF_STRING, 2, L"ȫѡ"); 
 | 
        AppendMenu(m, MF_SEPARATOR, -1, L""); 
 | 
        AppendMenu(m, MF_STRING, 4, L"µ¼³öµ½Excel"); 
 | 
        AppendMenu(m, MF_SEPARATOR, -1, L""); 
 | 
        AppendMenu(m, MF_STRING, 6, L"ÏÔʾÁÐÉèÖÃ"); 
 | 
        RECT xr; 
 | 
        xpoint pt; 
 | 
        GetCursorPos(pt); 
 | 
        int ret = TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, GetHWND(), &xr); 
 | 
  
 | 
        //trace(ret); 
 | 
        HCURSOR hCursor = xutil::SetCursorWait(); 
 | 
        if (ret == 1) { OnRowCopy(); } 
 | 
        else if (ret == 101) { 
 | 
            xstring colname = hdr.colname; 
 | 
            if (colname != L"") 
 | 
                OnColCopy(colname); 
 | 
        } 
 | 
        else if (ret == 2) { OnSelectAllRow(); } 
 | 
        else if (ret == 4) { ItemOutput(); } 
 | 
        else if (ret == 6) {} 
 | 
        xutil::RestoreCursor(hCursor); 
 | 
  
 | 
        return 1; 
 | 
    } 
 | 
    int OnAttachEvent() 
 | 
    { 
 | 
        //»ñÈ¡½¹µãʼþ£¬ÓÃÓÚÖØÖù¤¾ßÌõ 
 | 
        AttachEvent(L"WM_SETFOCUS", (FEvent)&QuickCode::OnSetFocus); 
 | 
        //°ó¶¨¹¤¾ßÌõµã»÷ʼþ 
 | 
        AttachEvent(L"WM_XCOMMAND", (FEvent)&QuickCode::OnXCommand); 
 | 
        AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&QuickCode::OnDoubleClicked);//ÐÐË«»÷     
 | 
        AttachEvent(L"dw_list", L"DWV_ITEMBEINGEDIT", (FEvent)&QuickCode::OnClicked); 
 | 
        AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&QuickCode::OnRClick);//Êó±êÓÒ¼ü 
 | 
        return 1; 
 | 
    } 
 | 
    int OnRetrieve() 
 | 
    { 
 | 
        xml x; 
 | 
  
 | 
        xaserverarg arg; 
 | 
  
 | 
        trace(L"asdasd"); 
 | 
  
 | 
        if (m_id.find(L"", 0) > 0) 
 | 
        { 
 | 
            m_id = m_id.mid(0, m_id.find(L"", 0)); 
 | 
            arg.AddArg(L"id", m_id); 
 | 
            //trace(m_id);                 
 | 
            /*if (TDataSet::exec(m_config, L"query_remark", arg.GetString(),x) != 1) 
 | 
            { 
 | 
                trace(x.text()); 
 | 
                return -1; 
 | 
            }*/ 
 | 
            if (xurl::get(L"QuickCode/entity/list_remark", arg.GetString(), x) != 1) 
 | 
            { 
 | 
                trace(x.text()); 
 | 
                return -1; 
 | 
            } 
 | 
        } 
 | 
        else 
 | 
        { 
 | 
            trace(L"asdasd"); 
 | 
            arg.AddArg(L"id", m_id); 
 | 
            arg.AddArg(L"querytxt", L""); 
 | 
            /*if (TDataSet::exec(m_config, L"query", arg.GetString(),x) != 1) 
 | 
            { 
 | 
                trace(x.text()); 
 | 
                return -1; 
 | 
            }*/ 
 | 
            if (xurl::get(L"QuickCode/entity/list", arg.GetString(), x) != 1) 
 | 
            { 
 | 
                trace(x.text()); 
 | 
                return -1; 
 | 
            } 
 | 
        } 
 | 
  
 | 
        dw_list.Retrieve(x); 
 | 
        dw_list.Redraw(); 
 | 
        return 1; 
 | 
    } 
 | 
    xstring jxParam(xstring p, xstring n) 
 | 
    { 
 | 
        if (p != L"") 
 | 
        { 
 | 
            p += L"&"; 
 | 
            int i = 1; 
 | 
            while (p.find(L"=", 0) > 0) 
 | 
            { 
 | 
                xstring name = p.mid(0, p.find(L"=", 0)); 
 | 
                xstring value = p.mid(p.find(L"=", 0) + 1, p.find(L"&", 0) - p.find(L"=", 0) - 1); 
 | 
                if (name == n) return L"" + value; 
 | 
                i += 1; 
 | 
                p = p.mid(p.find(L"&", 0) + 1, p.length()); 
 | 
            } 
 | 
        } 
 | 
        return L""; 
 | 
    } 
 | 
    int getURLParam() 
 | 
    { 
 | 
        if (GetWinParam()) 
 | 
        { 
 | 
            xpage xp = GetXPage(); 
 | 
            xstring aurl = xp.GetWkUrl(); 
 | 
            xaserverarg arg = GetArg(); 
 | 
            xstring config = arg.GetArgString(L"config"); 
 | 
            xml x; 
 | 
  
 | 
            if (config == L"") 
 | 
            { 
 | 
                xstring configXml = arg.GetArgString(L"configxml"); 
 | 
                x.loadXML(configXml); 
 | 
            } 
 | 
            else 
 | 
            { 
 | 
                getUrl(config, L"", x); 
 | 
            } 
 | 
            m_configDoc = x; 
 | 
  
 | 
        } 
 | 
  
 | 
        return 1; 
 | 
    } 
 | 
    int loaded() 
 | 
    { 
 | 
         
 | 
        getURLParam(); 
 | 
        KXMLDOMDocument     ee = m_configDoc; 
 | 
        xstring id = m_id; 
 | 
        auto n = ee.selectSingleNode(L"//list/dwview[@type='dwgrid'][@id='" + id + L"']"); 
 | 
        xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text(); 
 | 
        xstring dwname = L"";//e.selectsingleNode(L"@name").text(); 
 | 
        xstring tpl = L"";//e.selectsingleNode(L"@url").text(); 
 | 
        xstring dbmap = L""; 
 | 
        if (n) 
 | 
        { 
 | 
            KXMLDOMElement e = n; 
 | 
            //trace(e.xml()); 
 | 
            if (e.selectSingleNode(L"@name")) dwname = e.selectSingleNode(L"@name").text(); 
 | 
            if (e.selectSingleNode(L"@url")) tpl = e.selectSingleNode(L"@url").text(); 
 | 
            if (e.selectSingleNode(L"@dbmap")) dbmap = e.selectSingleNode(L"@dbmap").text(); 
 | 
            //trace(vface +L"/"+ tpl); 
 | 
            //trace(selectmode);             
 | 
        } 
 | 
        else 
 | 
        { 
 | 
            auto m = ee.selectSingleNode(L"//list"); 
 | 
            KXMLDOMElement e1 = m; 
 | 
            //trace(e.xml()); 
 | 
            if (e1.selectSingleNode(L"@name")) dwname = e1.selectSingleNode(L"@name").text(); 
 | 
            if (e1.selectSingleNode(L"@url")) tpl = e1.selectSingleNode(L"@url").text(); 
 | 
            if (e1.selectSingleNode(L"@dbmap")) dbmap = e1.selectSingleNode(L"@dbmap").text(); 
 | 
  
 | 
        } 
 | 
        m_dbmap = dbmap; 
 | 
        dw_list = GetControl(dwname); 
 | 
        dw_list.openUrl(vface + L"/" + tpl); 
 | 
        //dw_list.SetSelectionMode(4);                             
 | 
        return 1; 
 | 
    } 
 | 
    int Onital() 
 | 
    { 
 | 
        //µØÇø 
 | 
        xml x1; 
 | 
  
 | 
        xaserverarg arg1; 
 | 
         
 | 
        arg1.AddArg(L"id", L"µØÇø"); 
 | 
        if (xurl::get(L"/sale/data/QuickCode/entity/list", arg1.GetString(), x1) != 1) 
 | 
        { 
 | 
            trace(x1.text()); 
 | 
            return -1; 
 | 
        } 
 | 
  
 | 
        auto list = x1.selectNodes(L"root/item"); 
 | 
        int i; 
 | 
        int s = list.length(); 
 | 
        if (s > 0) 
 | 
        { 
 | 
            xstring str = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='±£»¤' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='<data>"; 
 | 
            for (i = 0; i < s; i++) 
 | 
            { 
 | 
                KXMLDOMElement xitem = list.item(i); 
 | 
                xstring id = L""; 
 | 
                if (xitem.selectSingleNode(L"Code")) 
 | 
                    id = xitem.selectSingleNode(L"Code").text(); 
 | 
                xstring name = L""; 
 | 
                if (xitem.selectSingleNode(L"Meaning")) 
 | 
                    name = xitem.selectSingleNode(L"Meaning").text(); 
 | 
                xstring tmp = L"<row><ÏÔʾÁÐ>" + name + L"</ÏÔʾÁÐ><Êý¾ÝÁÐ>" + id + L"</Êý¾ÝÁÐ></row>"; 
 | 
                str += tmp; 
 | 
            } 
 | 
            str += L"</data>'/></cellprop>"; 
 | 
  
 | 
  
 | 
            dw_list.SetColumnProps(L"AreaCode", str); 
 | 
        } 
 | 
        //±Ò±ð 
 | 
        xml x2; 
 | 
  
 | 
        xaserverarg arg2; 
 | 
         
 | 
        arg2.AddArg(L"id", L"FND_Currency"); 
 | 
        if (xurl::get(L"/sale/data/QuickCode/entity/list", arg2.GetString(), x2) != 1) 
 | 
        { 
 | 
            trace(x2.text()); 
 | 
            return -1; 
 | 
        } 
 | 
  
 | 
        auto list1 = x2.selectNodes(L"root/item"); 
 | 
        int j; 
 | 
        int s1 = list1.length(); 
 | 
        if (s1 > 0) 
 | 
        { 
 | 
            xstring str1 = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='±£»¤' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='<data>"; 
 | 
            for (j = 0; j < s1; j++) 
 | 
            { 
 | 
                KXMLDOMElement xitem1 = list1.item(j); 
 | 
                xstring id1 = L""; 
 | 
                if (xitem1.selectSingleNode(L"Code")) 
 | 
                    id1 = xitem1.selectSingleNode(L"Code").text(); 
 | 
                xstring name1 = L""; 
 | 
                if (xitem1.selectSingleNode(L"Name")) 
 | 
                    name1 = xitem1.selectSingleNode(L"Name").text(); 
 | 
                xstring tmp1 = L"<row><ÏÔʾÁÐ>" + name1 + L"</ÏÔʾÁÐ><Êý¾ÝÁÐ>" + id1 + L"</Êý¾ÝÁÐ></row>"; 
 | 
                str1 += tmp1; 
 | 
            } 
 | 
            str1 += L"</data>'/></cellprop>"; 
 | 
  
 | 
  
 | 
            dw_list.SetColumnProps(L"FromCurrencyCode", str1); 
 | 
        } 
 | 
        //¹ú¼Ò 
 | 
        xml x3; 
 | 
  
 | 
        xaserverarg arg3; 
 | 
         
 | 
        arg3.AddArg(L"id", L"FND_Country"); 
 | 
        if (xurl::get(L"/sale/data/QuickCode/entity/list", arg3.GetString(), x3) != 1) 
 | 
        { 
 | 
            trace(x3.text()); 
 | 
            return -1; 
 | 
        } 
 | 
  
 | 
        auto list2 = x3.selectNodes(L"root/item"); 
 | 
        int k; 
 | 
        int s2 = list2.length(); 
 | 
        if (s2 > 0) 
 | 
        { 
 | 
            xstring str2 = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='±£»¤' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='<data>"; 
 | 
            for (k = 0; k < s2; k++) 
 | 
            { 
 | 
                KXMLDOMElement xitem2 = list2.item(k); 
 | 
                xstring id2 = L""; 
 | 
                if (xitem2.selectSingleNode(L"Code")) 
 | 
                    id2 = xitem2.selectSingleNode(L"Code").text(); 
 | 
                xstring name2 = L""; 
 | 
                if (xitem2.selectSingleNode(L"Name")) 
 | 
                    name2 = xitem2.selectSingleNode(L"Name").text(); 
 | 
                xstring tmp2 = L"<row><ÏÔʾÁÐ>" + name2 + L"</ÏÔʾÁÐ><Êý¾ÝÁÐ>" + id2 + L"</Êý¾ÝÁÐ></row>"; 
 | 
                str2 += tmp2; 
 | 
            } 
 | 
            str2 += L"</data>'/></cellprop>"; 
 | 
  
 | 
  
 | 
            dw_list.SetColumnProps(L"MkCountryId", str2); 
 | 
        } 
 | 
        dw_list.SetReadOnlyColumn(L"ToCurrencyCode"); 
 | 
    } 
 | 
    int onload() 
 | 
    { 
 | 
         
 | 
        SetArg(); 
 | 
        m_config = L"QuickCode.config"; 
 | 
        m_agent = L""; 
 | 
  
 | 
        //dw_list = new xdwgrid; 
 | 
        //dw_list.setNativePointer(GetControl(L"dw_list")); 
 | 
        //dw_list.SetSelectionMode(4); 
 | 
        //dw_list.AllowSort(false);             
 | 
        if (GetWinParam()) 
 | 
        { 
 | 
            xaserverarg arg = GetArg(); 
 | 
            xstring id = arg.GetArgString(L"id"); 
 | 
            if (id == L"") return 0; 
 | 
            m_id = id; 
 | 
            loaded(); 
 | 
  
 | 
            /*xstring tpl = arg.GetArgString(L"tpl"); 
 | 
            if(tpl == L"" && (m_id.find(L"",0) >0)) 
 | 
                tpl = L"QuickCode.tpl/QuickCode_Remark"; 
 | 
            else if(tpl == L"" ) 
 | 
                tpl = L"QuickCode.tpl/QuickCode"; 
 | 
            dw_list.SetDataObject(GetServerUrl(),L"dev:sheet["+tpl+L"]"); 
 | 
            xstring dbmap = arg.GetArgString(L"dbmap"); 
 | 
            if(dbmap == L""  && (m_id.find(L"",0)  >0) ) 
 | 
                dbmap = L"QuickCode_Remark.dbmap"; 
 | 
            else if(dbmap == L"") 
 | 
                dbmap =L"QuickCode.dbmap"; 
 | 
            m_dbmap = dbmap; 
 | 
            xstring name = arg.GetArgString(L"name"); 
 | 
            if(name == L"") 
 | 
                name = id; 
 | 
            m_name = name; 
 | 
            xstring title = arg.GetArgString(L"title"); 
 | 
            if(title != L"") 
 | 
                win::SetWindowText(GetHWND(),title);*/ 
 | 
  
 | 
  
 | 
  
 | 
  
 | 
                /* 
 | 
                param p = GetParam(); 
 | 
                xstring pa = L""+p; 
 | 
                //xstring pa = L"id=HrOrgType&title=¿Í»§ÀàÐÍ"; 
 | 
                xstring id = jxParam(pa,L"id"); 
 | 
                if(id == L"") return 0; 
 | 
                m_id = id; 
 | 
                xstring tpl = jxParam(pa,L"tpl"); 
 | 
                if(tpl == L"" && (m_id.find(L"",0) >0)) 
 | 
                    tpl = L"QuickCode.tpl/QuickCode_Remark"; 
 | 
                else if(tpl == L"" ) 
 | 
                    tpl = L"QuickCode.tpl/QuickCode"; 
 | 
                dw_list.SetDataObject(GetServerUrl(),L"dev:sheet["+tpl+L"]"); 
 | 
                xstring dbmap = jxParam(pa,L"dbmap"); 
 | 
                if(dbmap == L""  && (m_id.find(L"",0)  >0) ) 
 | 
                    dbmap = L"QuickCode_Remark.dbmap"; 
 | 
                else if(dbmap == L"") 
 | 
                    dbmap =L"QuickCode.dbmap"; 
 | 
                m_dbmap = dbmap; 
 | 
                //trace(m_dbmap); 
 | 
  
 | 
                xstring name = jxParam(pa,L"name"); 
 | 
                if(name == L"") 
 | 
                    name = id; 
 | 
                m_name = name; 
 | 
                xstring title = jxParam(pa,L"title"); 
 | 
                if(title != L"") 
 | 
                    win::SetWindowText(GetHWND(),title);*/ 
 | 
            OnRetrieve(); 
 | 
        } 
 | 
  
 | 
        OnAttachEvent(); 
 | 
        SetAgent(); 
 | 
        Onital(); 
 | 
        return 1; 
 | 
    } 
 | 
}; 
 |