| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | #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> |
| | | |
| | | unit trade |
| | | [ |
| | | class ViewEx1TotalWin : public xwin |
| | | #include <vbusiness/vutil/publiccode.vutil.vbusiness.hpp> |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | |
| | | class __declspec(dllexport) ViewEx1TotalWin : public xwin |
| | | { |
| | | public: |
| | | ViewEx1TotalWin(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static ViewEx1TotalWin* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | ViewEx1TotalWin* pWin = new ViewEx1TotalWin(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | public: |
| | | xdwgrid dw_list; |
| | | xoffice dw_office; |
| | | xcell dw_cell; |
| | | xnode m_agentNode; //Agent Condition |
| | | msxml::IXMLDOMElement rptEle; |
| | | string m_category; |
| | | string argStr; |
| | | KXMLDOMElement rptEle; |
| | | xstring m_category; |
| | | xstring argStr; |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | { |
| | | SetAgentNodeContent (anode,m_agentNode); |
| | | SetAgentNode (anode,m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/"+xfNodeAgentArea+L"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | int OnSetFocus(TEvent* evt, int param) |
| | | { |
| | | //重置工具条 |
| | | SetAgent(); |
| | |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | int hCursor = 0; |
| | | if(comdid=="xmAnalysis") |
| | | HCURSOR hCursor = 0; |
| | | if(comdid==L"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)); |
| | | xstring str = dw_list.DataAnalysis(L""); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"html", str); |
| | | |
| | | OpenWindow(L"dev:xpage[data.vanalysis.vx]", arg); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | if(comdid=="xmTrans") |
| | | if(comdid==L"xmTrans") |
| | | return OnTransData(); |
| | | if(comdid=="xmQuery") |
| | | if(comdid==L"xmQuery") |
| | | { |
| | | if(rptEle) |
| | | { |
| | | string argUrl = rptEle.getAttribute("arg"); |
| | | if(argUrl !="") |
| | | xstring argUrl = rptEle.getAttribute(L"arg"); |
| | | if(argUrl !=L"") |
| | | { |
| | | 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") |
| | | xaserverarg ar ; |
| | | |
| | | ar.AddArg(L"argurl",argUrl); |
| | | 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(rptEle.getAttribute("data"),argStr); |
| | | OnRetrieve(rptEle.getAttribute(L"data"),argStr); |
| | | xutil::RestoreCursor(hCursor); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | argStr=""; |
| | | OnRetrieve(rptEle.getAttribute("data"),argStr); |
| | | argStr=L""; |
| | | OnRetrieve(rptEle.getAttribute(L"data"),argStr); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | if(comdid=="xmSaveAs") |
| | | if(comdid==L"xmSaveAs") |
| | | { |
| | | dw_list.SaveAs(""); |
| | | dw_list.SaveAs(L""); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int SwitchReport(msxml::IXMLDOMElement e) |
| | | int SwitchReport(KXMLDOMElement e) |
| | | { |
| | | string dwname = e.getAttribute("template"); |
| | | string dataurl = e.getAttribute("data"); |
| | | string sheettype = e.getAttribute("reporttype"); |
| | | xstring dwname = e.getAttribute(L"template"); |
| | | xstring dataurl = e.getAttribute(L"data"); |
| | | xstring sheettype = e.getAttribute(L"reporttype"); |
| | | if(rptEle != e) |
| | | { |
| | | argStr = ""; |
| | | argStr = L""; |
| | | rptEle = e; |
| | | } |
| | | if(sheettype=="") sheettype="report"; |
| | | SwitchLayer("dw_"+sheettype,"report"); |
| | | if(sheettype=="report")dw_list.openUrl(dwname); |
| | | if(sheettype==L"") sheettype=L"report"; |
| | | SwitchLayer(L"dw_"+sheettype,L"report"); |
| | | if(sheettype==L"report")dw_list.openUrl(dwname); |
| | | |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnCombboChanged(ref TCommandEvent evt,int lParam) |
| | | int OnCombboChanged(TEvent* evt, int lParam) |
| | | { |
| | | int h = xcombobox::GetCurSel(evt.hCtrl); |
| | | int h = xcombobox::GetCurSel(evt->command.hCtrl); |
| | | if(h > -1) |
| | | { |
| | | int hCursor = xutil::SetCursorWait(); |
| | | msxml::IXMLDOMElement e = xcombobox::GetItemData(evt.hCtrl, h); |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | KXMLDOMElement e = xcombobox::GetItemData(evt->command.hCtrl, h); |
| | | SwitchReport(e); |
| | | win32::PostMessage(GetHWND(),0x401,"xmQuery",0); |
| | | //OnCmdDispatch("xmQuery"); |
| | | PostMessage(GetHWND(),0x401,(LPARAM)L"xmQuery",0); |
| | | //OnCmdDispatch(L"xmQuery"); |
| | | xutil::RestoreCursor(hCursor); |
| | | } |
| | | return 1; |
| | |
| | | |
| | | int OnTransData() |
| | | { |
| | | int ret = win32::MessageBox(GetHWND(),"是否更新数据?\n更新过程预计需要四十分钟,如果中间弹出等待时间过长的提示,请点击中间重试按钮,或等待到一定时间再点击","提示",0x4 /*yesno*/); |
| | | int ret = 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("/sale/data/Total3/total/transdata","",x)!=1) |
| | | xml x ; |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | if (xurl::get(L"/sale/data/Total3/total/transdata",L"",x)!=1) |
| | | { |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | }else |
| | | { |
| | | xutil::RestoreCursor(hCursor); |
| | | alert("数据传输完成!"); |
| | | alert(L"数据传输完成!"); |
| | | return 1; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | int OnXCommand(TEvent* evt, int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnDWClick(ref TNotifyEvent evt,int p) |
| | | int OnDWClick(TEvent* evt, int p) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | string value = hdr.data; |
| | | string colname = hdr.colname; |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring value = hdr.data; |
| | | xstring colname = hdr.colname; |
| | | int row = hdr.row; |
| | | |
| | | if(row < 1) return 1; |
| | | |
| | | xaserverarg arg; |
| | | /* |
| | | if(colname=="SONo") |
| | | if(colname==L"SONo") |
| | | { |
| | | string SONo = dw_list.GetItemString(row,colname); |
| | | xstring 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()); |
| | | arg.AddArg(L"EntityNo",SONo); |
| | | arg.AddArg(L"ReadOnly",L"true"); |
| | | OpenWindow(L"dev:xpage[base.maint.so.vx]",arg.getNativePointer()); |
| | | } |
| | | if(colname=="InvoiceNo") |
| | | if(colname==L"InvoiceNo") |
| | | { |
| | | string InvoiceNo= dw_list.GetItemString(row,colname); |
| | | xstring 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()); |
| | | arg.AddArg(L"EntityNo",InvoiceNo); |
| | | arg.AddArg(L"ReadOnly",L"true"); |
| | | OpenWindow(L"dev:xpage[maint.GDN3.vx]",arg.getNativePointer()); |
| | | } |
| | | if(colname=="InvoiceNoEx") |
| | | if(colname==L"InvoiceNoEx") |
| | | { |
| | | string InvoiceNoEx= dw_list.GetItemString(row,colname); |
| | | xstring 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()); |
| | | 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()); |
| | | } |
| | | */ |
| | | return 1; |
| | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&ViewEx1TotalWin::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent("cb_report","CBN_SELCHANGE",OnCombboChanged); |
| | | AttachEvent("dw_report","DWV_CLICKED",OnDWClick); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&ViewEx1TotalWin::OnSetFocus); |
| | | AttachEvent(L"cb_report",L"CBN_SELCHANGE", (FEvent)&ViewEx1TotalWin::OnCombboChanged); |
| | | AttachEvent(L"dw_report",L"DWV_CLICKED", (FEvent)&ViewEx1TotalWin::OnDWClick); |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve(string dataurl, string argstr) |
| | | int OnRetrieve(xstring dataurl, xstring 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); |
| | | xml x ; |
| | | |
| | | string sheettype = rptEle.getAttribute("reporttype"); |
| | | if(sheettype=="") sheettype="report"; |
| | | if (url::get(dataurl,arg.GetString(),x)!=1) |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"arg",argstr); |
| | | |
| | | xstring sheettype = rptEle.getAttribute(L"reporttype"); |
| | | if(sheettype==L"") sheettype=L"report"; |
| | | if (xurl::get(dataurl,arg.GetString(),x)!=1) |
| | | { |
| | | trace("\r\n--------"+x.GetXmlDoc().text); |
| | | trace(L"\r\n--------"+(xstring)x.text()); |
| | | dw_list.Redraw(); |
| | | return -1; |
| | | }else |
| | | { |
| | | //xutil::SaveToFile("C:\\Temp\\Total3.xml",x.GetXml(),"","",""); |
| | | if(sheettype=="report") |
| | | //xutil::SaveToFile(L"C:\\Temp\\Total3.xml()",x.GetXml(),L"",L"",L""); |
| | | if(sheettype==L"report") |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | else if(sheettype=="cell") |
| | | else if(sheettype==L"cell") |
| | | { |
| | | } |
| | | else if(sheettype=="office") |
| | | else if(sheettype==L"office") |
| | | { |
| | | dw_office.LoadTemplate(x); |
| | | dw_office.LoadTemplate(x,0); |
| | | for(int i=0; i<dw_office.GetSheetCount();i++) |
| | | { |
| | | xcell sheet = dw_office.GetSheet(i); |
| | |
| | | return 1; |
| | | } |
| | | |
| | | xml getReportSet(string category) |
| | | xml getReportSet(xstring category) |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("category",category); |
| | | if (url::get("/sale/data/Total3/reportset",arg.GetString(),x)!=1) |
| | | xml x ; |
| | | |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"category",category); |
| | | if (xurl::get(L"/sale/data/Total3/reportset",arg.GetString(),x)!=1) |
| | | { |
| | | return 0; |
| | | } |
| | |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl("dw_report"); |
| | | dw_office = GetControl("dw_office"); |
| | | dw_cell = GetControl("dw_cell"); |
| | | dw_list.openUrl("/sale/view/Total3/template/sodetail"); |
| | | SetArg(); |
| | | 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"); |
| | | |
| | | argStr =""; |
| | | rptEle = 0; |
| | | xcombobox xc = GetControl("cb_report"); |
| | | argStr =L""; |
| | | //rptEle = 0; |
| | | xcombobox xc = GetControl(L"cb_report"); |
| | | |
| | | //m_category = "total/business"; |
| | | m_category = "total/sample"; |
| | | if(GetParam()) { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(GetParam()); |
| | | m_category = arg.GetArgString("category"); |
| | | //m_category = L"total/business"; |
| | | m_category = L"total/sample"; |
| | | if(GetWinParam()) { |
| | | xaserverarg arg =GetArg(); |
| | | |
| | | m_category = arg.GetArgString(L"category"); |
| | | } |
| | | xml x = getReportSet(m_category); |
| | | if(x) |
| | | { |
| | | msxml::IXMLDOMNodeList nlist =x.GetXmlDoc().selectNodes("//reports/report"); |
| | | int len = nlist.length; |
| | | KXMLDOMNodeList nlist =x.selectNodes(L"//reports/report"); |
| | | int len = nlist.length(); |
| | | for(int i=0; i<len; i++) |
| | | { |
| | | msxml::IXMLDOMElement rpt = nlist.item(i); |
| | | string name = rpt.getAttribute("name"); |
| | | xcombobox::AddItem(xc.GetId(),name,trust(rpt as int)); |
| | | KXMLDOMElement rpt = nlist.item(i); |
| | | xstring name = rpt.getAttribute(L"name"); |
| | | xc.AddItem(name, rpt); |
| | | if(i==0) xc.SetText(name); |
| | | if(i==0) rptEle = rpt; |
| | | } |
| | |
| | | if(rptEle) |
| | | { |
| | | SwitchReport(rptEle); |
| | | //OnCmdDispatch("xmQuery"); |
| | | //OnCmdDispatch(L"xmQuery"); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
| | | }; |