|  |  | 
 |  |  | use "list.vd" | 
 |  |  | use "xtreeview.vd" | 
 |  |  | use "xwin.vd" | 
 |  |  | class PaymentTermlist111 : public list | 
 |  |  | #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 | 
 |  |  | { | 
 |  |  |    //xdwgrid   dw_list;  | 
 |  |  |    int OnDBClick(ref TNotifyEvent evt,int p) | 
 |  |  | public: | 
 |  |  |  | 
 |  |  |    xdwgrid  dw_list; | 
 |  |  | public: | 
 |  |  |    PaymentTermlist111(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} | 
 |  |  | public: | 
 |  |  |    static PaymentTermlist111* CreateInstance(void* implPtr, void* hWnd) | 
 |  |  |    { | 
 |  |  |       ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR); | 
 |  |  |       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()); | 
 |  |  |       msxml::IXMLDOMElement e = dw_list.GetRowElement(row); | 
 |  |  |       string id = e.selectSingleNode("TermID").text; | 
 |  |  |       KXMLDOMElement e = dw_list.GetRowElement(row); | 
 |  |  |       xstring id = e.selectSingleNode(L"TermID").text(); | 
 |  |  |       //alert( id); | 
 |  |  |       xaserverarg arg = new xaserverarg; | 
 |  |  |       arg.setNativePointer(arg.CreateInstance()); | 
 |  |  |       arg.AddArg("EntityID", id); | 
 |  |  |       //arg.AddArg("hwnd", this.GetHWND().toString()); | 
 |  |  |       int p1 = arg.ptr_native_; | 
 |  |  |       openUrl("/sale/view/Payment/worknode/Payment/maint",p1); | 
 |  |  |       if (arg.GetArgString("ret") == "Ok") | 
 |  |  |       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("OK"); | 
 |  |  |          list::onloaded(); | 
 |  |  |          alert(L"OK"); | 
 |  |  |          listwin::onloaded(); | 
 |  |  |       }             | 
 |  |  |       return 1; | 
 |  |  |    }    | 
 |  |  |    int OnDelete() | 
 |  |  |    { | 
 |  |  |       int row = this.dw_list.GetRow(); | 
 |  |  |       int row = dw_list.GetRow(); | 
 |  |  |       if (row < 1) return 1;             | 
 |  |  |       msxml::IXMLDOMElement ele = this.dw_list.GetRowElement(row); | 
 |  |  |       string termid = ele.selectSingleNode("TermID").text; | 
 |  |  |       xaserverarg arg = new xaserverarg;  | 
 |  |  |       arg.setNativePointer(arg.CreateInstance());	 | 
 |  |  |       arg.AddArg("termId",termid); | 
 |  |  |       KXMLDOMElement ele = dw_list.GetRowElement(row); | 
 |  |  |       xstring termid = ele.selectSingleNode(L"TermID").text(); | 
 |  |  |       xaserverarg  arg;  | 
 |  |  | 			 | 
 |  |  |       arg.AddArg(L"termId",termid); | 
 |  |  |       //alert(termid); | 
 |  |  |       xml x1 = new xml; | 
 |  |  |       x1.setNativePointer(x1.CreateInstance()); | 
 |  |  |       if (url::post("/sale/data/PaymentTerm/entity/delete",arg.GetString(),x1) != 1) | 
 |  |  |       xml x1 ; | 
 |  |  | 	 | 
 |  |  |       if (xurl::post(L"/sale/data/PaymentTerm/entity/delete",arg.GetString(),x1) != 1) | 
 |  |  |       { | 
 |  |  |          string error = x1.GetXmlDoc().text; | 
 |  |  |          xstring error = x1.text(); | 
 |  |  |          trace(error); | 
 |  |  |       } | 
 |  |  |       else | 
 |  |  |       { | 
 |  |  |          //error = x1.GetXmlDoc().text; | 
 |  |  |          //error = x1.text(); | 
 |  |  |          //alert(error); | 
 |  |  |          MessageBox(GetHWND(),"删除成功!","提示",0); | 
 |  |  |          MessageBox(GetHWND(),L"删除成功!",L"提示",0); | 
 |  |  |          dw_list.DeleteRow(row); | 
 |  |  |       } | 
 |  |  |    } | 
 |  |  |        | 
 |  |  |    int OnNew() | 
 |  |  |    { | 
 |  |  |       xaserverarg arg = new xaserverarg; | 
 |  |  |       arg.setNativePointer(arg.CreateInstance()); | 
 |  |  |       arg.AddArg("EntityID", "new"); | 
 |  |  |       int p1 = arg.ptr_native_; | 
 |  |  |       //openUrl("/sale/view/Test/worknode/company/maint", arg); | 
 |  |  |       openUrl("/sale/view/Payment/worknode/Payment/maint",p1); | 
 |  |  |       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 = new xaserverarg; | 
 |  |  |       arg.setNativePointer(arg.CreateInstance()); | 
 |  |  |       xaserverarg arg ; | 
 |  |  | 		 | 
 |  |  |       int row = dw_list.GetRow(); | 
 |  |  |       if (row < 1)  | 
 |  |  |       { | 
 |  |  |          xwin::MessageBox(GetHWND(),"请选中要修改的行!","提示",0); | 
 |  |  |          MessageBox(GetHWND(),L"请选中要修改的行!",L"提示",0); | 
 |  |  |          return -1; | 
 |  |  |       } | 
 |  |  |       msxml::IXMLDOMElement e = dw_list.GetRowElement(row); | 
 |  |  |       string guid = e.selectSingleNode("TermID").text; | 
 |  |  |       arg.AddArg("EntityID",guid); | 
 |  |  |       int pp = arg.ptr_native_; | 
 |  |  |       openUrl("/sale/view/Test2/worknode/company2/maint", pp); | 
 |  |  |       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() | 
 |  |  |    { | 
 |  |  |       list::onloaded(); | 
 |  |  |       listwin::onloaded(); | 
 |  |  |       return 0; | 
 |  |  |    } | 
 |  |  |    //按钮事件 | 
 |  |  |    int OnCmdDispatch(string comdid) | 
 |  |  |    int OnCmdDispatch(xstring comdid) | 
 |  |  |    { | 
 |  |  |       //alert(comdid); | 
 |  |  |       if (comdid == "action:bill.new") return OnNew(); | 
 |  |  |       else if(comdid == "action:bill.open") return OnOpen();		 | 
 |  |  |       else if(comdid == "Refresh") return OnRefresh(); | 
 |  |  |       else if(comdid == "action:bill.delete") return OnDelete();		 | 
 |  |  |       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(ref TXCommandEvent evt,int p) | 
 |  |  |    int OnXCommand(TEvent* evt, LPARAM param) | 
 |  |  |    { | 
 |  |  |       return OnCmdDispatch(evt.pStrID); | 
 |  |  |    }	 | 
 |  |  |       return OnCmdDispatch(evt->xcommand.pStrID); | 
 |  |  |    } | 
 |  |  |    //命令发布函数 | 
 |  |  |    int OnAttachEvent() | 
 |  |  |    { | 
 |  |  |       AttachEvent("WM_XCOMMAND",OnXCommand); | 
 |  |  |       //AttachEvent("WM_SETFOCUS",OnSetFocus); | 
 |  |  |       AttachEvent(L"WM_XCOMMAND", (FEvent)&PaymentTermlist111::OnXCommand); | 
 |  |  |       //AttachEvent(L"WM_SETFOCUS",OnSetFocus); | 
 |  |  |  | 
 |  |  |       //AttachEvent("dw_list","DWV_ROWFOCUSCHANGED",OnRowChanged); | 
 |  |  |       AttachEvent("dw_list","DWV_DOUBLECLICKED",OnDBClick); | 
 |  |  |       //AttachEvent(L"dw_list",L"DWV_ROWFOCUSCHANGED",OnRowChanged); | 
 |  |  |       AttachEvent(L"dw_list",L"DWV_DOUBLECLICKED", (FEvent)&PaymentTermlist111::OnDBClick); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |    int onload() | 
 |  |  |    { | 
 |  |  | 		 | 
 |  |  |       list::onload(); | 
 |  |  |       SetAgent(); | 
 |  |  |       listwin::onload(); | 
 |  |  |       OnAttachEvent(); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |     | 
 |  |  |    int onloaded() | 
 |  |  |    { | 
 |  |  |       //OnRetrieve(); | 
 |  |  |       //alert("12"); | 
 |  |  |       list::onloaded(); | 
 |  |  |       //alert(L"12"); | 
 |  |  |       listwin::onloaded(); | 
 |  |  |           | 
 |  |  |           | 
 |  |  |       return -1;  |