#include <wobject/xwin.hpp>
|
#include <xcontrol/xdwgrid.hpp>
|
#include <xcontrol/xoffice.hpp>
|
#include <xcontrol/xcell.hpp>
|
#include <xcontrol/xflowchart.hpp>
|
#include <xcontrol/ximageview.hpp>
|
#include <xcontrol/xcombobox.hpp>
|
|
#include <vbusiness/vutil/publiccode.vutil.vbusiness.hpp>
|
#include "viewobject/view.base.hpp"
|
|
|
using xml = KXMLDOMDocument;
|
class __declspec(dllexport) ViewProductNoOutTotalWin : public xwin
|
{
|
public:
|
ViewProductNoOutTotalWin(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {}
|
public:
|
static ViewProductNoOutTotalWin* CreateInstance(void* implPtr, void* hWnd)
|
{
|
ViewProductNoOutTotalWin* pWin = new ViewProductNoOutTotalWin(implPtr, (HWND)hWnd);
|
return pWin;
|
}
|
public:
|
xdwgrid dw_list;
|
xoffice dw_office;
|
xcell dw_cell;
|
xnode m_agentNode; //Agent Condition
|
xstring m_category;
|
xstring argStr;
|
|
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, int param)
|
{
|
//ÖØÖù¤¾ßÌõ
|
SetAgent();
|
return 1;
|
}
|
|
//ÃüÁî·¢²¼º¯Êý
|
int OnCmdDispatch(xstring comdid)
|
{
|
HCURSOR hCursor = 0;
|
if (comdid == L"xmQuery")
|
{
|
xaserverarg ar ;
|
|
ar.AddArg(L"argurl", L"/sale/view/Total3/arg/SODY");
|
if (argStr != L"")
|
ar.AddArg(L"arg", argStr);
|
OpenWindow(L"dev:xpage[view.total.arg.vx]", ar );
|
xstring arstr = ar.GetArgString(L"arg");
|
if (arstr != L"" && ar.GetArgString(L"action") == L"ok")
|
{
|
argStr = arstr;
|
hCursor = xutil::SetCursorWait();
|
OnRetrieve(L"/sale/data/Total3/total/SODY", argStr);
|
|
xutil::RestoreCursor(hCursor);
|
}
|
|
else
|
{
|
argStr = L"";
|
OnRetrieve(L"/sale/data/Total3/total/SODY", argStr);
|
}
|
|
return 1;
|
}
|
return 0;
|
}
|
|
|
int SwitchReport(KXMLDOMElement ele)
|
{
|
return 1;
|
}
|
|
int OnCombboChanged(TEvent* evt, int lParam)
|
{
|
int h = xcombobox::GetCurSel(evt->command.hCtrl);
|
if (h > -1)
|
{
|
HCURSOR hCursor = xutil::SetCursorWait();
|
KXMLDOMElement e = xcombobox::GetItemData(evt->command.hCtrl, h);
|
SwitchReport(e);
|
PostMessage(GetHWND(), 0x401, (WPARAM)L"xmQuery", 0);
|
//OnCmdDispatch(L"xmQuery");
|
xutil::RestoreCursor(hCursor);
|
}
|
return 1;
|
}
|
|
|
|
//ÃüÁî´¦Àíʼþ
|
int OnXCommand(TEvent* evt, int param)
|
{
|
return OnCmdDispatch(evt->xcommand.pStrID);
|
}
|
|
int OnDWClick(TEvent* evt, int p)
|
{
|
DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh;
|
xstring value = hdr.data;
|
xstring colname = hdr.colname;
|
int row = hdr.row;
|
|
if (row < 1) return 1;
|
|
return 1;
|
}
|
|
int OnAttachEvent()
|
{
|
//°ó¶¨¹¤¾ßÌõµã»÷ʼþ
|
AttachEvent(L"WM_XCOMMAND", (FEvent)&ViewProductNoOutTotalWin::OnXCommand);
|
//»ñÈ¡½¹µãʼþ£¬ÓÃÓÚÖØÖù¤¾ßÌõ
|
AttachEvent(L"WM_SETFOCUS", (FEvent)&ViewProductNoOutTotalWin::OnSetFocus);
|
AttachEvent(L"cb_report", L"CBN_SELCHANGE", (FEvent)&ViewProductNoOutTotalWin::OnCombboChanged);
|
AttachEvent(L"dw_report", L"DWV_CLICKED", (FEvent)&ViewProductNoOutTotalWin::OnDWClick);
|
return 1;
|
}
|
|
int OnRetrieve(xstring dataurl, xstring argstr)
|
{
|
dw_list.Reset();
|
|
xml x;
|
|
xaserverarg arg ;
|
|
arg.AddArg(L"arg", argstr);
|
|
|
if (xurl::get(dataurl, arg.GetString(), x) != 1)
|
{
|
trace(x.text());
|
dw_list.Redraw();
|
return -1;
|
}
|
|
dw_list.Retrieve(x);
|
dw_list.Redraw();
|
dw_list.SetReadOnly(true);
|
|
return 1;
|
}
|
|
int onload()
|
{
|
dw_list = GetControl(L"dw_report");
|
dw_office = GetControl(L"dw_office");
|
dw_cell = GetControl(L"dw_cell");
|
dw_list.openUrl(L"/sale/view/Total3/template/PRODUCTSODY");
|
|
argStr = L"";
|
xcombobox xc = GetControl(L"cb_report");
|
|
|
OnAttachEvent();
|
return 1;
|
}
|
|
int onloaded()
|
{
|
SetAgent();
|
OnCmdDispatch(L"xmQuery");
|
return 1;
|
}
|
};
|