þÿ#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 "vbusiness/vframe/listwin.vframe.vbusiness.hpp" #include "viewobject/view.base.hpp" using xml = KXMLDOMDocument; class __declspec(dllexport) CheckOutInstoreSampleWin : public xframe { public: xdwgrid dw_list; xnode m_agentNode; //Agent Condition public: CheckOutInstoreSampleWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} public: static CheckOutInstoreSampleWin* CreateInstance(void* implPtr, void* hWnd) { CheckOutInstoreSampleWin* pWin = new CheckOutInstoreSampleWin(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; } //q&p¹oÀm;YtQýep int OnSetFocus(TEvent* evt, LPARAM param) { //‘Ín]åQwga //SetAgent(); return 1; } //T}NäSÑ^Qýep int OnCmdDispatch(xstring comdid) { if (comdid == L"xmCancel") { xaserverarg arg; if (arg) arg.AddArg(L"process", L"cancel"); CloseWindow(); return 1; } else if (comdid == L"xmOk") { if (dw_list.GetRowCount() < 1) return 1; xaserverarg arg1; if (arg1) { int qty = arg1.GetArgString(L"Quantity").toInt(); int qty1 = dw_list.GetItemString(dw_list.GetRow(), L"Quantity").toInt(); if (qty > qty1) { alert(L"h7TÁQe^“ep…ÇPu(epÿ ‹÷ŒetQe^“ep‘Ï"); return 1; } arg1.AddArg(L"SampleOutstoreID", dw_list.GetItemString(dw_list.GetRow(), L"SampleOutstoreID")); arg1.AddArg(L"process", L"ok"); } CloseWindow(); return 1; } return 0; } //T}NäYtN‹Nö int OnXCommand(TEvent* evt, LPARAM param) { return OnCmdDispatch(evt->xcommand.pStrID); } int OnAttachEvent() { //~Ñ[š]åQwgap¹QûN‹Nö AttachEvent(L"WM_XCOMMAND", (FEvent)&CheckOutInstoreSampleWin::OnXCommand); //ƒ·SÖq&p¹N‹Nöÿ u(NŽ‘Ín]åQwga AttachEvent(L"WM_SETFOCUS", (FEvent)&CheckOutInstoreSampleWin::OnSetFocus); return 1; } int OnRetrieve() { xml x; xaserverarg arg; if (getUrl(L"/sale/data/Sample/checkout/dataex", arg.GetString(), x) != 1) { trace(x.text()); return -1; } else { dw_list.Retrieve(x); dw_list.Redraw(); dw_list.SetReadOnly(true); } return 1; } int onload() { SetArg(); dw_list = GetControl(L"dw_list"); dw_list.openUrl(L"/sale/view/Sample/template/Sample/checkout"); OnAttachEvent(); xaserverarg arg = GetArg(); if (arg)OnRetrieve(); return 1; } int onloaded() { //SetAgent(); return 1; } };