| ¶Ô±ÈÐÂÎļþ | 
|  |  |  | 
|---|
|  |  |  | #include <wobject/xwin.hpp> | 
|---|
|  |  |  | #include <xcontrol/xdwgrid.hpp> | 
|---|
|  |  |  | #include <xcontrol/xoffice.hpp> | 
|---|
|  |  |  | #include <xcontrol/xcell.hpp> | 
|---|
|  |  |  | #include <xcontrol/xflowchart.hpp> | 
|---|
|  |  |  | #include <xcontrol/ximageview.hpp> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | using xml = KXMLDOMDocument; | 
|---|
|  |  |  | class __declspec(dllexport) ViewTotalWin : public xwin | 
|---|
|  |  |  | { | 
|---|
|  |  |  | public: | 
|---|
|  |  |  | ViewTotalWin(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} | 
|---|
|  |  |  | static ViewTotalWin* CreateInstance(void* implPtr, void* hWnd) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return new ViewTotalWin(implPtr, (HWND)hWnd); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | xdwgrid    dw_list; | 
|---|
|  |  |  | xoffice     dw_office; | 
|---|
|  |  |  | xcell        dw_cell; | 
|---|
|  |  |  | xnode    m_agentNode;    //Agent Condition | 
|---|
|  |  |  | KXMLDOMElement rptEle; | 
|---|
|  |  |  | string m_category; | 
|---|
|  |  |  | string argStr; | 
|---|
|  |  |  | string searchStr; | 
|---|
|  |  |  | string fieldRoleStr; | 
|---|
|  |  |  | int      hWndImageView; | 
|---|
|  |  |  | int      hWndRetrieveTip; | 
|---|
|  |  |  | bool    dataretrieveing; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int SetAgent() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string 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) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string s = agent.xml(); | 
|---|
|  |  |  | m_agentNode = SetAgentNode(anode, s); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int OnSearch() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | xaserverarg arg = new xaserverarg; | 
|---|
|  |  |  | arg.setNativePointer(arg.CreateInstance()); | 
|---|
|  |  |  | arg.AddArg(L"text", searchStr); | 
|---|
|  |  |  | //trace(searchStr); | 
|---|
|  |  |  | OpenWindow(L"dev:xpage[search.dialog.vx]", cast(arg as int)); | 
|---|
|  |  |  | string str = arg.GetArgString(L"text"); | 
|---|
|  |  |  | if (str != searchStr) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | searchStr = str; | 
|---|
|  |  |  | dw_list.Filter(L"*", searchStr); | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //ç¦ç¹æ¿æ´»å¤ç彿° | 
|---|
|  |  |  | int OnSetFocus(ref TEvent evt, int param) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //é置工å
·æ¡ | 
|---|
|  |  |  | SetAgent(); | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //å½ä»¤åå¸å½æ° | 
|---|
|  |  |  | int OnCmdDispatch(string comdid) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string UserNo = publiccode::GetUser().no; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int hCursor = 0; | 
|---|
|  |  |  | if (comdid == L"xmSearch") return OnSearch(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //if(UserNo !=L"00603") | 
|---|
|  |  |  | //{ | 
|---|
|  |  |  | if (comdid == L"xmAnalysis") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | hCursor = xutil::SetCursorWait(); | 
|---|
|  |  |  | string str = dw_list.DataAnalysis(L""); | 
|---|
|  |  |  | xaserverarg arg = new xaserverarg; | 
|---|
|  |  |  | arg.setNativePointer(arg.CreateInstance()); | 
|---|
|  |  |  | arg.AddArg(L"html", str); | 
|---|
|  |  |  | int obj = cast(dw_list as int); | 
|---|
|  |  |  | arg.AddArg(L"obj", obj.toString()); | 
|---|
|  |  |  | OpenWindow(L"dev:xpage[data.vanalysis.vx]", cast(arg as int)); | 
|---|
|  |  |  | xutil::RestoreCursor(hCursor); | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (comdid == L"xmSaveAs") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | dw_list.SaveAs(L""); | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (comdid == L"xmRemarks") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string name = rptEle.getAttribute(L"name"); | 
|---|
|  |  |  | xml x = ViewObject::RetrieveData(L"/sale/data/TradeFinance3/GetSetUpRemarks", L"Type", name); | 
|---|
|  |  |  | KXMLDOMNodeList items = x.GetXmlDoc().selectNodes(L"data/Item"); | 
|---|
|  |  |  | KXMLDOMNode t = items.item(0); | 
|---|
|  |  |  | string Content = L""; | 
|---|
|  |  |  | if (t.selectSingleNode(L"Content")) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | Content = t.selectSingleNode(L"Content").text; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | xaserverarg arg1 = new xaserverarg; | 
|---|
|  |  |  | arg1.setNativePointer(arg1.CreateInstance()); | 
|---|
|  |  |  | arg1.AddArg(L"value", Content); | 
|---|
|  |  |  | OpenWindow(L"dev:xpage[memo.edit.new.vx]", arg1.getNativePointer()); | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | if (comdid == L"xmTrans1") | 
|---|
|  |  |  | return OnTransData(); | 
|---|
|  |  |  | if (comdid == L"xmQuery") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (rptEle) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string argUrl = rptEle.getAttribute(L"arg"); | 
|---|
|  |  |  | if (argUrl != L"") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | xaserverarg ar = new xaserverarg; | 
|---|
|  |  |  | ar.setNativePointer(ar.CreateInstance()); | 
|---|
|  |  |  | ar.AddArg(L"argurl", argUrl); | 
|---|
|  |  |  | if (argStr != L"") | 
|---|
|  |  |  | ar.AddArg(L"arg", argStr); | 
|---|
|  |  |  | OpenWindow(L"dev:xpage[view.total.arg.vx]", cast(ar as int)); | 
|---|
|  |  |  | string arstr = ar.GetArgString(L"arg"); | 
|---|
|  |  |  | if (arstr != L"" && ar.GetArgString(L"action") == L"ok") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | argStr = arstr; | 
|---|
|  |  |  | hCursor = xutil::SetCursorWait(); | 
|---|
|  |  |  | //trace(rptEle.getAttribute(L"data")); | 
|---|
|  |  |  | OnRetrieve(rptEle.getAttribute(L"data"), argStr); | 
|---|
|  |  |  | xutil::RestoreCursor(hCursor); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | argStr = L""; | 
|---|
|  |  |  | OnRetrieve(rptEle.getAttribute(L"data"), argStr); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (comdid == L"xmLookImage") | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int row = dw_list.GetRow(); | 
|---|
|  |  |  | string skuid = dw_list.GetGuid(row); | 
|---|
|  |  |  | OnLookImage(skuid); | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (comdid == L"CalculationFormula") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | OpenWindow(L"dev:xpage[CalculationFormula.vx]", 0); | 
|---|
|  |  |  | SetAgent(); | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int OnLookImage(string skuid) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | int hCursor = xutil::SetCursorWait(); | 
|---|
|  |  |  | xaserverarg arg = ViewObject::MakeArg(); | 
|---|
|  |  |  | arg.AddArg(L"guid", skuid); | 
|---|
|  |  |  | OpenWindow(L"dev:xpage[ViewPictures.vx]", arg.getNativePointer()); | 
|---|
|  |  |  | xutil::RestoreCursor(hCursor); | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int AdjustField(xdwgrid dw) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string str = fieldRoleStr; | 
|---|
|  |  |  | for (int i = 1; i < dw.GetColumnCount(); i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string colname = dw.GetColumnName(i); | 
|---|
|  |  |  | if (str.find(L"!" + colname + L",L") >= 0) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | dw.SetColumnState(colname, false); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int SwitchReport(KXMLDOMElement e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string dwname = e.getAttribute(L"template"); | 
|---|
|  |  |  | string dataurl = e.getAttribute(L"data"); | 
|---|
|  |  |  | string sheettype = e.getAttribute(L"reporttype"); | 
|---|
|  |  |  | if (rptEle != e) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | argStr = L""; | 
|---|
|  |  |  | rptEle = e; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if (sheettype == L"") sheettype = L"report"; | 
|---|
|  |  |  | SwitchLayer(L"dw_" + sheettype, L"report"); | 
|---|
|  |  |  | if (sheettype == L"report")dw_list.openUrl(dwname); | 
|---|
|  |  |  | if (hWndImageView) win32::DestroyWindow(hWndImageView); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | AdjustField(dw_list); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SetAgent(); | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int OnCombboChanged(ref TCommandEvent evt, int lParam) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | int h = xcombobox::GetCurSel(evt.hCtrl); | 
|---|
|  |  |  | if (h > -1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | int hCursor = xutil::SetCursorWait(); | 
|---|
|  |  |  | KXMLDOMElement e = xcombobox::GetItemData(evt.hCtrl, h); | 
|---|
|  |  |  | SwitchReport(e); | 
|---|
|  |  |  | win32::PostMessage(GetHWND(), 0x401, L"xmQuery", 0); | 
|---|
|  |  |  | //OnCmdDispatch(L"xmQuery"); | 
|---|
|  |  |  | xutil::RestoreCursor(hCursor); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int OnTransData() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | int ret = win32::MessageBox(GetHWND(), L"æ¯å¦æ´æ°æ°æ®?\næ´æ°è¿ç¨é¢è®¡éè¦åååéï¼å¦æä¸é´å¼¹åºçå¾
æ¶é´è¿é¿çæç¤ºï¼è¯·ç¹å»ä¸é´éè¯æé®ï¼æçå¾
å°ä¸å®æ¶é´åç¹å»", L"æç¤º", 0x4 /*yesno*/); | 
|---|
|  |  |  | if (ret != 6 /*IDYES */) return 1; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | xml x = new.xml(); | 
|---|
|  |  |  | x.setNativePointer(xml::CreateInstance()); | 
|---|
|  |  |  | int hCursor = xutil::SetCursorWait(); | 
|---|
|  |  |  | if (url::get(L"/sale/data/Total3/total/transdata", L"", x) != 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | xutil::RestoreCursor(hCursor); | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | xutil::RestoreCursor(hCursor); | 
|---|
|  |  |  | alert(L"æ°æ®ä¼ è¾å®æ!"); | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //å½ä»¤å¤çäºä»¶ | 
|---|
|  |  |  | int OnXCommand(ref TXCommandEvent evt, int param) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return OnCmdDispatch(evt.pStrID); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int SendImageMessage(int row) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (dw_list.GetItemString(row, L"GDNLineID") != L"") | 
|---|
|  |  |  | win32::SendMessage(hWndImageView, 0x401, L"xmRetrieve:GDNLineID:" + dw_list.GetItemString(row, L"GDNLineID"), 0); | 
|---|
|  |  |  | else if (dw_list.GetItemString(row, L"ItemID") != L"") | 
|---|
|  |  |  | win32::SendMessage(hWndImageView, 0x401, L"xmRetrieve:SKUID:" + dw_list.GetItemString(row, L"ItemID"), 0); | 
|---|
|  |  |  | else if (dw_list.GetItemString(row, L"SKUID") != L"") | 
|---|
|  |  |  | win32::SendMessage(hWndImageView, 0x401, L"xmRetrieve:SKUID:" + dw_list.GetItemString(row, L"SKUID"), 0); | 
|---|
|  |  |  | else if (dw_list.GetItemString(row, L"GoodsNo") != L"") | 
|---|
|  |  |  | win32::SendMessage(hWndImageView, 0x401, L"xmRetrieve:GoodsNo:" + dw_list.GetItemString(row, L"GoodsNo"), 0); | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int OnDWClick(ref TNotifyEvent evt, int p) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR); | 
|---|
|  |  |  | string value = hdr.data; | 
|---|
|  |  |  | string colname = hdr.colname; | 
|---|
|  |  |  | int row = hdr.row; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (row < 1) return 1; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (rptEle) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string str = rptEle.getAttribute(L"forward"); | 
|---|
|  |  |  | if (str == L"false") return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /* | 
|---|
|  |  |  | string s = publiccode::GetUser().id; | 
|---|
|  |  |  | xml supplier_x = ViewObject::RetrieveData(L"/sale/data/SupplierV3/entity/FindBySaleType",L"id", s); | 
|---|
|  |  |  | if(supplier_x.GetXmlDoc().text == L"æ ·åé´" || supplier_x.GetXmlDoc().text == L"主管"){ | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | xaserverarg arg; | 
|---|
|  |  |  | if(colname==L"SONo") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string SONo = dw_list.GetItemString(row,colname); | 
|---|
|  |  |  | arg=new xaserverarg; | 
|---|
|  |  |  | arg.setNativePointer(arg.CreateInstance()); | 
|---|
|  |  |  | arg.AddArg(L"EntityNo",SONo); | 
|---|
|  |  |  | arg.AddArg(L"ReadOnly",L"true"); | 
|---|
|  |  |  | OpenWindow(L"dev:xpage[base.maint.so.vx]",arg.getNativePointer()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(colname==L"InvoiceNo") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string InvoiceNo= dw_list.GetItemString(row,colname); | 
|---|
|  |  |  | arg=new xaserverarg; | 
|---|
|  |  |  | arg.setNativePointer(arg.CreateInstance()); | 
|---|
|  |  |  | arg.AddArg(L"EntityNo",InvoiceNo); | 
|---|
|  |  |  | arg.AddArg(L"ReadOnly",L"true"); | 
|---|
|  |  |  | OpenWindow(L"dev:xpage[maint.GDN3.vx]",arg.getNativePointer()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(colname==L"InvoiceNoEx") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | string InvoiceNoEx= dw_list.GetItemString(row,colname); | 
|---|
|  |  |  | arg=new xaserverarg; | 
|---|
|  |  |  | arg.setNativePointer(arg.CreateInstance()); | 
|---|
|  |  |  | arg.AddArg(L"EntityNo",InvoiceNoEx); | 
|---|
|  |  |  | arg.AddArg(L"invoiceno",InvoiceNoEx); | 
|---|
|  |  |  | arg.AddArg(L"ReadOnly",L"true"); | 
|---|
|  |  |  | OpenWindow(L"dev:xpage[maint.vatnotify.vx]",arg.getNativePointer()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | */ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (hWndImageView != 0 && win32::IsWindow(hWndImageView)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SendImageMessage(row); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (colname == L"HasImage") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | xwin pwin = OpenWindow(L"dev:xpage[testImage.vx]", 0); | 
|---|
|  |  |  | hWndImageView = pwin.GetHWND(); | 
|---|
|  |  |  | SendImageMessage(row); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int OnRowChanged(ref TNotifyEvent evt, int p) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR); | 
|---|
|  |  |  | int row = hdr.row; | 
|---|
|  |  |  | if (row < 1) return 1; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (hWndImageView != 0 && win32::IsWindow(hWndImageView)) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SendImageMessage(row); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int ShowRetrieveingTip() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | dataretrieveing = true; | 
|---|
|  |  |  | xwin pwin = OpenWindow(L"dev:xpage[TestRetrieveing.vx]", 0); | 
|---|
|  |  |  | hWndRetrieveTip = pwin.GetHWND(); | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | int CloseRetrieveTip() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | dataretrieveing = false; | 
|---|
|  |  |  | win32::SendMessage(hWndRetrieveTip, 0x401, L"RetrieveFinished", 0); | 
|---|
|  |  |  | hWndRetrieveTip = 0; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int OnRetrieveFinished(ref TNotifyEvent evt, int p) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | CloseRetrieveTip(); | 
|---|
|  |  |  | //dataretrieveing = false; | 
|---|
|  |  |  | //alert(L"读å宿"); | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int OnAttachEvent() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ | 
|---|
|  |  |  | AttachEvent(L"WM_XCOMMAND", OnXCommand); | 
|---|
|  |  |  | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ | 
|---|
|  |  |  | AttachEvent(L"WM_SETFOCUS", OnSetFocus); | 
|---|
|  |  |  | AttachEvent(L"cb_report", L"CBN_SELCHANGE", OnCombboChanged); | 
|---|
|  |  |  | AttachEvent(L"dw_report", L"DWV_CLICKED", OnDWClick); | 
|---|
|  |  |  | AttachEvent(L"dw_report", L"DWV_ROWFOCUSCHANGED", OnRowChanged);//ç»å®è¡æ´æ¹è§¦åäºä»¶OnRowChanged | 
|---|
|  |  |  | AttachEvent(L"dw_report", (0x400 + 81).toString(), OnRetrieveFinished); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int  OnRetrieve(string dataurl, string argstr) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (!rptEle) return 0; | 
|---|
|  |  |  | if (dataretrieveing) return -1; | 
|---|
|  |  |  | dw_list.Reset(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | xml x = new.xml(); | 
|---|
|  |  |  | x.setNativePointer(xml::CreateInstance()); | 
|---|
|  |  |  | xaserverarg arg = new xaserverarg; | 
|---|
|  |  |  | arg.setNativePointer(arg.CreateInstance()); | 
|---|
|  |  |  | arg.AddArg(L"arg", argstr); | 
|---|
|  |  |  | trace(argstr); | 
|---|
|  |  |  | string sheettype = rptEle.getAttribute(L"reporttype"); | 
|---|
|  |  |  | if (sheettype == L"") sheettype = L"report"; | 
|---|
|  |  |  | //ShowRetrieveingTip(); | 
|---|
|  |  |  | if (url::get(dataurl, arg.GetString(), x) != 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | trace(L"é误信æ¯=L" + x.GetXmlDoc().text); | 
|---|
|  |  |  | dw_list.Redraw(); | 
|---|
|  |  |  | return -1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else | 
|---|
|  |  |  | { | 
|---|
|  |  |  | if (sheettype == L"report") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | //CloseRetrieveTip(); | 
|---|
|  |  |  | dw_list.Retrieve(x); | 
|---|
|  |  |  | dw_list.Redraw(); | 
|---|
|  |  |  | dw_list.SetReadOnly(true); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (sheettype == L"cell") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | } | 
|---|
|  |  |  | else if (sheettype == L"office") | 
|---|
|  |  |  | { | 
|---|
|  |  |  | dw_office.LoadTemplate(x); | 
|---|
|  |  |  | for (int i = 0; i < dw_office.GetSheetCount(); i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | xcell sheet = dw_office.GetSheet(i); | 
|---|
|  |  |  | sheet.SetReadOnly(true); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | xml getReportSet(string category) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | xml x = new.xml(); | 
|---|
|  |  |  | x.setNativePointer(xml::CreateInstance()); | 
|---|
|  |  |  | xaserverarg arg = new xaserverarg; | 
|---|
|  |  |  | arg.setNativePointer(arg.CreateInstance()); | 
|---|
|  |  |  | arg.AddArg(L"category", category); | 
|---|
|  |  |  | if (url::get(L"/sale/data/Total3/reportset", arg.GetString(), x) != 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return 0; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return x; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | string GetReportFieldRole() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | xml x = new.xml(); | 
|---|
|  |  |  | x.setNativePointer(xml::CreateInstance()); | 
|---|
|  |  |  | xaserverarg arg = new xaserverarg; | 
|---|
|  |  |  | arg.setNativePointer(arg.CreateInstance()); | 
|---|
|  |  |  | if (url::get(L"/sale/data/Total3/report/field", arg.GetString(), x) != 1) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | return ""; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | string str = x.GetXmlDoc().text; | 
|---|
|  |  |  | return str; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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/sodetail"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | fieldRoleStr = GetReportFieldRole(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | argStr = L""; | 
|---|
|  |  |  | rptEle = 0; | 
|---|
|  |  |  | xcombobox xc = GetControl(L"cb_report"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | m_category = L"total/trade"; | 
|---|
|  |  |  | if (GetParam()) { | 
|---|
|  |  |  | xaserverarg arg = new xaserverarg; | 
|---|
|  |  |  | arg.setNativePointer(GetParam()); | 
|---|
|  |  |  | m_category = arg.GetArgString(L"category"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | xml x = getReportSet(m_category); | 
|---|
|  |  |  | if (x) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | KXMLDOMNodeList nlist = x.GetXmlDoc().selectNodes(L"//reports/report"); | 
|---|
|  |  |  | int len = nlist.length; | 
|---|
|  |  |  | for (int i = 0; i < len; i++) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | KXMLDOMElement rpt = nlist.item(i); | 
|---|
|  |  |  | string name = rpt.getAttribute(L"name"); | 
|---|
|  |  |  | xcombobox::AddItem(xc.GetId(), name, trust(rpt as int)); | 
|---|
|  |  |  | if (i == 0) xc.SetText(name); | 
|---|
|  |  |  | if (i == 0) rptEle = rpt; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | searchStr = L""; | 
|---|
|  |  |  | hWndImageView = 0; | 
|---|
|  |  |  | hWndRetrieveTip = 0; | 
|---|
|  |  |  | dataretrieveing = false; | 
|---|
|  |  |  | OnAttachEvent(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | int onloaded() | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SetAgent(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (rptEle) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | SwitchReport(rptEle); | 
|---|
|  |  |  | //OnCmdDispatch(L"xmQuery"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }; | 
|---|