use "xcontrol.vframe.vbusiness.vd" use "xbase.vframe.vbusiness.vd" unit trade [ class ViewEx1TotalWin : public xwin { xdwgrid dw_list; xoffice dw_office; xcell dw_cell; xnode m_agentNode; //Agent Condition msxml::IXMLDOMElement rptEle; string m_category; string argStr; int SetAgent() { string xfNodeAgentArea = "agentarea"; xnode anode = GetAgentNode(xfNodeAgentArea); if(m_agentNode) { SetAgentNodeContent (anode,m_agentNode); } else { msxml::IXMLDOMElement xframeElement = GetElement(); msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); if(agent) { string s = agent.xml; m_agentNode = SetAgentNodeContent (anode,s); } } return 1; } //½¹µã¼¤»î´¦Àíº¯Êý int OnSetFocus(ref TEvent evt,int param) { //ÖØÖù¤¾ßÌõ SetAgent(); return 1; } //ÃüÁî·¢²¼º¯Êý int OnCmdDispatch(string comdid) { int hCursor = 0; if(comdid=="xmAnalysis") { hCursor = xutil::SetCursorWait(); string str = dw_list.DataAnalysis(""); xaserverarg arg=new xaserverarg; arg.setNativePointer(arg.CreateInstance()); arg.AddArg("html", str); int obj = cast(dw_list as int); arg.AddArg("obj",obj.toString()); OpenWindow("dev:xpage[data.vanalysis.vx]", cast(arg as int)); xutil::RestoreCursor(hCursor); return 1; } if(comdid=="xmTrans") return OnTransData(); if(comdid=="xmQuery") { if(rptEle) { string argUrl = rptEle.getAttribute("arg"); if(argUrl !="") { xaserverarg ar = new xaserverarg; ar.setNativePointer(ar.CreateInstance()); ar.AddArg("argurl",argUrl); if(argStr !="") ar.AddArg("arg",argStr); OpenWindow("dev:xpage[view.total.arg.vx]",cast(ar as int)); string arstr = ar.GetArgString("arg"); if(arstr != "" && ar.GetArgString("action")=="ok") { argStr = arstr; hCursor = xutil::SetCursorWait(); OnRetrieve(rptEle.getAttribute("data"),argStr); xutil::RestoreCursor(hCursor); } } else { argStr=""; OnRetrieve(rptEle.getAttribute("data"),argStr); } } return 1; } if(comdid=="xmSaveAs") { dw_list.SaveAs(""); return 1; } return 0; } int SwitchReport(msxml::IXMLDOMElement e) { string dwname = e.getAttribute("template"); string dataurl = e.getAttribute("data"); string sheettype = e.getAttribute("reporttype"); if(rptEle != e) { argStr = ""; rptEle = e; } if(sheettype=="") sheettype="report"; SwitchLayer("dw_"+sheettype,"report"); if(sheettype=="report")dw_list.openUrl(dwname); SetAgent(); return 1; } int OnCombboChanged(ref TCommandEvent evt,int lParam) { int h = xcombobox::GetCurSel(evt.hCtrl); if(h > -1) { int hCursor = xutil::SetCursorWait(); msxml::IXMLDOMElement e = xcombobox::GetItemData(evt.hCtrl, h); SwitchReport(e); win32::PostMessage(GetHWND(),0x401,"xmQuery",0); //OnCmdDispatch("xmQuery"); xutil::RestoreCursor(hCursor); } return 1; } int OnTransData() { int ret = win32::MessageBox(GetHWND(),"ÊÇ·ñ¸üÐÂÊý¾Ý?\n¸üйý³ÌÔ¤¼ÆÐèÒªËÄÊ®·ÖÖÓ£¬Èç¹ûÖм䵯³öµÈ´ýʱ¼ä¹ý³¤µÄÌáʾ£¬Çëµã»÷ÖмäÖØÊÔ°´Å¥£¬»òµÈ´ýµ½Ò»¶¨Ê±¼äÔÙµã»÷","Ìáʾ",0x4 /*yesno*/); if(ret != 6 /*IDYES */ ) return 1; xml x = new xml; x.setNativePointer(xml::CreateInstance()); int hCursor = xutil::SetCursorWait(); if (url::get("/sale/data/Total3/total/transdata","",x)!=1) { xutil::RestoreCursor(hCursor); return 1; }else { xutil::RestoreCursor(hCursor); alert("Êý¾Ý´«ÊäÍê³É!"); return 1; } return 1; } //ÃüÁî´¦Àíʼþ int OnXCommand(ref TXCommandEvent evt,int param) { return OnCmdDispatch(evt.pStrID); } 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; xaserverarg arg; /* if(colname=="SONo") { string SONo = dw_list.GetItemString(row,colname); arg=new xaserverarg; arg.setNativePointer(arg.CreateInstance()); arg.AddArg("EntityNo",SONo); arg.AddArg("ReadOnly","true"); OpenWindow("dev:xpage[base.maint.so.vx]",arg.getNativePointer()); } if(colname=="InvoiceNo") { string InvoiceNo= dw_list.GetItemString(row,colname); arg=new xaserverarg; arg.setNativePointer(arg.CreateInstance()); arg.AddArg("EntityNo",InvoiceNo); arg.AddArg("ReadOnly","true"); OpenWindow("dev:xpage[maint.GDN3.vx]",arg.getNativePointer()); } if(colname=="InvoiceNoEx") { string InvoiceNoEx= dw_list.GetItemString(row,colname); arg=new xaserverarg; arg.setNativePointer(arg.CreateInstance()); arg.AddArg("EntityNo",InvoiceNoEx); arg.AddArg("invoiceno",InvoiceNoEx); arg.AddArg("ReadOnly","true"); OpenWindow("dev:xpage[maint.vatnotify.vx]",arg.getNativePointer()); } */ return 1; } int OnAttachEvent() { //°ó¶¨¹¤¾ßÌõµã»÷ʼþ AttachEvent("WM_XCOMMAND",OnXCommand); //»ñÈ¡½¹µãʼþ£¬ÓÃÓÚÖØÖù¤¾ßÌõ AttachEvent("WM_SETFOCUS",OnSetFocus); AttachEvent("cb_report","CBN_SELCHANGE",OnCombboChanged); AttachEvent("dw_report","DWV_CLICKED",OnDWClick); } int OnRetrieve(string dataurl, string argstr) { if(!rptEle) return 0; dw_list.Reset(); xml x = new xml; x.setNativePointer(xml::CreateInstance()); xaserverarg arg = new xaserverarg; arg.setNativePointer(arg.CreateInstance()); arg.AddArg("arg",argstr); string sheettype = rptEle.getAttribute("reporttype"); if(sheettype=="") sheettype="report"; if (url::get(dataurl,arg.GetString(),x)!=1) { trace("\r\n--------"+x.GetXmlDoc().text); dw_list.Redraw(); return -1; }else { //xutil::SaveToFile("C:\\Temp\\Total3.xml",x.GetXml(),"","",""); if(sheettype=="report") { dw_list.Retrieve(x); dw_list.Redraw(); dw_list.SetReadOnly(true); } else if(sheettype=="cell") { } else if(sheettype=="office") { dw_office.LoadTemplate(x); for(int i=0; i