¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) importvatnotifyWin : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xdwgrid dw_base; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | public: |
| | | importvatnotifyWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static importvatnotifyWin* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | importvatnotifyWin* pWin = new importvatnotifyWin(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(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/"+xfNodeAgentArea+L"[1]/*"); |
| | | if(agent) |
| | | { |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | //SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnImport() |
| | | { |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | int row = dw_list.GetRow(); |
| | | if(row < 1) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring invno = ele.selectSingleNode(L"InvoiceNo").text(); |
| | | arg.AddArg(L"InvoiceNo",invno); |
| | | |
| | | if (getUrl(L"/sale/data/VATNotify/import/invoice",arg.GetString(),x)!=1) |
| | | { |
| | | alert(x.text()); |
| | | return 1; |
| | | }else |
| | | { |
| | | alert(x.text()); |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnImport2() |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | for(int row=1; row<= dw_list.GetRowCount();row++){ |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring invno = ele.selectSingleNode(L"InvoiceNo").text(); |
| | | arg.AddArg(L"InvoiceNo",invno); |
| | | if (getUrl(L"/sale/data/VATNotify/import/invoice",arg.GetString(),x)!=1) |
| | | { |
| | | //alert(x.text()); |
| | | return 1; |
| | | }else |
| | | { |
| | | //alert(x.text()); |
| | | //OnRetrieve(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if(comdid==L"xmRetrieve") |
| | | { |
| | | OnRetrieve(); |
| | | } |
| | | else if(comdid==L"xmOk") |
| | | { |
| | | return OnImport(); |
| | | }else if (comdid==L"xmClose"){ |
| | | CloseWindow(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&importvatnotifyWin::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&importvatnotifyWin::OnSetFocus); |
| | | AttachEvent(L"dw_list",L"DWV_CLICKED", (FEvent)&importvatnotifyWin::OnClicked); |
| | | return 1; |
| | | } |
| | | |
| | | int OnClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | if(row < 1) return 1; |
| | | |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring invno = ele.selectSingleNode(L"InvoiceNo").text(); |
| | | |
| | | xml x ; |
| | | xaserverarg arg; |
| | | arg.AddArg(L"invoiceno",invno); |
| | | //alert(invno); |
| | | if (getUrl(L"/sale/data/VATNotify/pref/importbase",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | }else |
| | | { |
| | | dw_base.Retrieve(x); |
| | | dw_base.Redraw(); |
| | | dw_base.SetReadOnly(true); |
| | | dw_base.SetSelectionMode(1); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x ; |
| | | xaserverarg arg ; |
| | | |
| | | xstring QueryTxt = xcontrol(GetControl(L"sle_search")).GetText(); |
| | | arg.AddArg(L"QueryTxt",QueryTxt); |
| | | if (getUrl(L"/sale/data/VATNotify/pref/importlist",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | }else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | //dw_list.SetSelectionMode(3); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/VATNotify/template/VATNotify/importlist"); |
| | | dw_base = GetControl(L"dw_base"); |
| | | dw_base.openUrl(L"/sale/view/VATNotify/template/VATNotify/importbase"); |
| | | |
| | | OnAttachEvent(); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | //SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |