#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) QuoteFilePurched : public xframe
|
{
|
public:
|
xdwgrid dw_list;
|
xnode m_agentNode; //Agent Condition
|
public:
|
QuoteFilePurched(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
|
public:
|
static QuoteFilePurched* CreateInstance(void* implPtr, void* hWnd)
|
{
|
QuoteFilePurched* pWin = new QuoteFilePurched(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 OnValid()
|
{
|
/*
|
for(int row=1;row<=dw_list.GetRowCount();row++)
|
{
|
if(dw_list.GetItemString(row,L"IsSend")==L"1")
|
{
|
if(dw_list.GetItemString(row,L"ItemName")==L"")
|
{
|
alert(L"µÚ"+row.toString()+L"ÐÐÉÌÆ·Ó¢ÎÄÃû³ÆÎ´ÊäÈë,²¹È«ºóÔÙ·¢Ë͸øÒµÎñÔ±");
|
return 0;
|
}
|
if(dw_list.GetItemString(row,L"ItemCName")==L"")
|
{
|
alert(L"µÚ"+row.toString()+L"ÐÐÉÌÆ·Ãû³ÆÎ´ÊäÈë,²¹È«ºóÔÙ·¢Ë͸øÒµÎñÔ±");
|
return 0;
|
}
|
if(dw_list.GetItemString(row,L"Package")==L"")
|
{
|
alert(L"µÚ"+row.toString()+L"ÐÐÉÌÆ·°üװδÊäÈë,²¹È«ºóÔÙ·¢Ë͸øÒµÎñÔ±");
|
return 0;
|
}
|
}
|
}
|
*/
|
return 1;
|
}
|
|
int OnOK()
|
{
|
if(OnValid()==0) return 1;
|
|
xml x ;
|
|
dw_list.DwUpdateAllToEx(x);
|
if(GetWinParam())
|
{
|
xaserverarg arg = GetArg();
|
arg.AddArg(L"process",L"ok");
|
arg.AddArg(L"value",x.xml());
|
}
|
CloseWindow();
|
return 1;
|
}
|
|
int OnCancel()
|
{
|
CloseWindow();
|
return 1;
|
}
|
|
int SelectAll()
|
{
|
for(int row = 1; row <= dw_list.GetRowCount(); row++)
|
{
|
dw_list.SetItemString(row,L"IsSend",L"1");
|
}
|
dw_list.Redraw();
|
return 1;
|
}
|
|
int UnSelectAll()
|
{
|
for(int row = 1; row <= dw_list.GetRowCount(); row++)
|
{
|
dw_list.SetItemString(row,L"IsSend",L"0");
|
}
|
dw_list.Redraw();
|
return 1;
|
}
|
|
//ÃüÁî·¢²¼º¯Êý
|
int OnCmdDispatch(xstring comdid)
|
{
|
if(comdid==L"xmOK") return OnOK();
|
else if(comdid==L"xmCancel") return OnCancel();
|
else if(comdid==L"xmSelectAll") return SelectAll();
|
else if(comdid==L"xmUnSelectAll") return UnSelectAll();
|
|
return 0;
|
}
|
|
//ÃüÁî´¦Àíʼþ
|
int OnXCommand(TEvent* evt, LPARAM param)
|
{
|
return OnCmdDispatch(evt->xcommand.pStrID);
|
}
|
|
int OnAttachEvent()
|
{
|
//°ó¶¨¹¤¾ßÌõµã»÷ʼþ
|
AttachEvent(L"WM_XCOMMAND", (FEvent)&QuoteFilePurched::OnXCommand);
|
//»ñÈ¡½¹µãʼþ£¬ÓÃÓÚÖØÖù¤¾ßÌõ
|
AttachEvent(L"WM_SETFOCUS", (FEvent)&QuoteFilePurched::OnSetFocus);
|
return 1;
|
}
|
|
/*
|
int OnRetrieve()
|
{
|
xml x ;
|
|
xaserverarg arg ;
|
|
arg.AddArg(L"xxx",L"xxx");
|
if (getUrl(L"",arg.GetString(),x)!=1)
|
{
|
trace(x.text());
|
return -1;
|
}else
|
{
|
//dw_list.Retrieve(x);
|
//dw_list.Redraw();
|
}
|
return 1;
|
}
|
*/
|
|
int onload()
|
{
|
SetArg();
|
dw_list = GetControl(L"dw_list");
|
dw_list.openUrl(L"/sale/view/Quote3/template/Quote/QuoteFilePurchedItem");
|
|
if(GetWinParam())
|
{
|
xaserverarg arg = GetArg();
|
xstring val = arg.GetArgString(L"value");
|
xml x ;
|
|
x.loadXML(val);
|
dw_list.Retrieve(x);
|
}
|
OnAttachEvent();
|
|
return 1;
|
}
|
|
int onloaded()
|
{
|
//SetAgent();
|
|
return 1;
|
}
|
};
|