ÿþ#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) TestExpenseGDN : public xframe { public: TestExpenseGDN(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} public: static TestExpenseGDN* CreateInstance(void* implPtr, void* hWnd) { TestExpenseGDN* pWin = new TestExpenseGDN(implPtr, (HWND)hWnd); return pWin; } public: xdwgrid dw_list; xnode m_agentNode; //Agent Condition xstring CustomerID; 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;mYtýQpe int OnSetFocus(TEvent* evt, LPARAM param) { //͑nå]wQag //SetAgent(); return 1; } int onxmOK() { xaserverarg arg = GetArg(); arg.AddArg(L"items",L""); xstring str = L""; int row = dw_list.GetNextSelectRow(1); while(row > 0 && row <= dw_list.GetRowCount()) { KXMLDOMElement ele = dw_list.GetRowElement(row); str += ele.xml(); ele.Release(); row = dw_list.GetNextSelectRow(row + 1); } if(str != L"") arg.AddArg(L"items",L"<data>"+str+L"</data>"); //trace(L"<data>"+str+L"</data>"); CloseWindow(); return 1; } //}TäNÑS^ýQpe int OnCmdDispatch(xstring comdid) { if(comdid==L"xmSelectAll") { for(int i=1;i<=dw_list.GetRowCount();i++) { dw_list.SelectRow(i,true); } dw_list.Redraw(); return 1; } else if(comdid==L"xmSelectNo") { dw_list.SelectRow(0,false); dw_list.Redraw(); return 1; } else if(comdid==L"xmOk") { onxmOK(); return 1; } else if(comdid==L"xmCancel") { CloseWindow(); return 1; }else if(comdid == L"xmSearch") { xcontrol query = GetControl(L"sl_search"); xstring InvoiceNo = query.GetText(); if(InvoiceNo ==L"") { alert(L"÷‹“eQYЏ÷Sågâ‹ÿ"); return 1; } xml x = ViewObject::RetrieveData(L"/sale/data/Expense3/TestMaint",L"InvoiceNo",InvoiceNo); dw_list.Retrieve(x); dw_list.SetSelectionMode(1); dw_list.Redraw(); return 1; } return 0; } int OnClicked(TEvent* evt, LPARAM p) { DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; char ch; int row = hdr.row; xstring col = hdr.colname; if(col==L"ShipQuantity") return 1; for(int i=1;i<=dw_list.GetRowCount();i++) { int selected = dw_list.IsRowSelected(i) & 0x1; if(i==row && !selected) { if(dw_list.GetItemString(i,L"ShipQuantity")==L"") dw_list.SetItemString(i,L"ShipQuantity",dw_list.GetItemString(i,L"Quantity")); } if(selected !=0) { if(dw_list.GetItemString(i,L"ShipQuantity")==L"") dw_list.SetItemString(i,L"ShipQuantity",dw_list.GetItemString(i,L"Quantity")); } } dw_list.Redraw(); return 1; } //}TäNYt‹NöN int OnXCommand(TEvent* evt, LPARAM param) { return OnCmdDispatch(evt->xcommand.pStrID); } int OnAttachEvent() { //Ñ~š[å]wQag¹pûQ‹NöN AttachEvent(L"WM_XCOMMAND", (FEvent)&TestExpenseGDN::OnXCommand); //·ƒÖS&q¹p‹NöN ÿ(uŽN͑nå]wQag AttachEvent(L"WM_SETFOCUS", (FEvent)&TestExpenseGDN::OnSetFocus); //AttachEvent(L"dw_list",L"DWV_CLICKED",OnClicked); AttachEvent(L"dw_list",L"DWV_DOUBLECLICKED", (FEvent)&TestExpenseGDN::onxmOK); return 1; } int onload() { SetArg(); dw_list = GetControl(L"dw_list"); //dw_list.openUrl(L"/sale/view/SaleOrder/template/itemforgdn"); dw_list.openUrl(L"/sale/view/Expense3/test/Maint"); dw_list.SetColumnState(L"SalespersonID",false); dw_list.SetColumnState(L"CreatorID",false); dw_list.SetColumnState(L"POCreatorID",false); dw_list.SetColumnState(L"CustomerID",false); OnAttachEvent(); return 1; } int onloaded() { //SetAgent(); return 1; } };