| | |
| | | class TemplatePrintDialog : public responsewin |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | #include "vbusiness/vframe/maint.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | |
| | | class __declspec(dllexport) TemplatePrintDialog : public responsewin |
| | | { |
| | | public: |
| | | xaserverarg arg_param; |
| | | string m_EntityName; |
| | | string m_EntityID; |
| | | string m_EntityNo; |
| | | string m_Dir; |
| | | string m_filePath; |
| | | string strNode; |
| | | xstring m_EntityName; |
| | | xstring m_EntityID; |
| | | xstring m_EntityNo; |
| | | xstring m_Dir; |
| | | xstring m_filePath; |
| | | xstring strNode; |
| | | xdwgrid dw_list; |
| | | xdwgrid dw_doclist; |
| | | xole ole_1; |
| | | bool bupdate; |
| | | |
| | | public: |
| | | TemplatePrintDialog(void* implPtr, HWND hWnd) :maint(implPtr, hWnd) {} |
| | | public: |
| | | static TemplatePrintDialog* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | TemplatePrintDialog* pWin = new TemplatePrintDialog(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnHtml() |
| | | { |
| | | string s1=L"<catalog>"+ |
| | | xstring s1=L"<catalog>"+ |
| | | " <book id='bk101'>"+ |
| | | " <author>Gambardella, Matthew</author>"+ |
| | | " <title>XML Developer's Guide</title>"+ |
| | |
| | | x.LoadXml(s1); |
| | | //trace(x.GetXml()); |
| | | |
| | | //string s2=L"<?xml version='1.0'?>"+ |
| | | string s2= |
| | | //xstring s2=L"<?xml version='1.0'?>"+ |
| | | xstring s2= |
| | | "<xsl:stylesheet version='1.0'"+ |
| | | " xmlns:xsl='http://www.w3.org/1999/XSL/Transform' >"+ |
| | | "<xsl:output method='xml' indent='yes'/>"+ |
| | |
| | | xsl.LoadXml(s2); |
| | | //trace(xsl.GetXml()); |
| | | |
| | | string strHtml = x.GetXmlDoc().transformNode(xsl.GetXmlDoc()); |
| | | xstring strHtml = x.GetXmlDoc().transformNode(xsl.GetXmlDoc()); |
| | | //strHtml = str.mid(21,99999); |
| | | ole_1.LoadHtml(strHtml); |
| | | //html_1.SetContent(strHtml); |
| | |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | string username = publiccode::GetUser().name; |
| | | xstring username = publiccode::GetUser().name; |
| | | if(username != L"admin" && m_Dir != username ) |
| | | { |
| | | bupdate = false; |
| | |
| | | { |
| | | bupdate = true; |
| | | } |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"Entity",m_EntityName); |
| | | arg.AddArg(L"Dir",m_Dir); |
| | | dw_list.Reset(); |
| | | if (url::get(L"/sale/data/SysPrintTemplate/listDialog",arg.GetString(),x) != 1) |
| | | if (xurl::get(L"/sale/data/SysPrintTemplate/listDialog",arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | trace(x.text()); |
| | | return -1; |
| | | }else |
| | | { |
| | | string s = x.GetXml(); |
| | | xstring s = x.xml(); |
| | | dw_list.Retrieve(x); |
| | | } |
| | | dw_list.Redraw(); |
| | |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | string sguid = ele.selectSingleNode(L"ID").text; |
| | | string sTemplName = ele.selectSingleNode(L"TemplName").text; |
| | | //string sFile = m_filePath + sguid+L".xsl"; |
| | | string sFile = m_filePath + ele.selectSingleNode(L"urlPath").text; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring sguid = ele.selectSingleNode(L"ID").text(); |
| | | xstring sTemplName = ele.selectSingleNode(L"TemplName").text(); |
| | | //xstring sFile = m_filePath + sguid+L".xsl"; |
| | | xstring sFile = m_filePath + ele.selectSingleNode(L"urlPath").text(); |
| | | arg_param.AddArg(L"xsl",sFile); |
| | | arg_param.AddArg(L"return",L"cancel"); |
| | | |
| | |
| | | alert(L"请选择模板目录!"); |
| | | return 0; |
| | | } |
| | | string sguid = publiccode::GetGuid(); |
| | | string sname= sguid +L".xsl"; |
| | | string suri= L"rpttemplate"+L"\\"+m_EntityName; //rpttemplate\SO |
| | | xstring sguid = publiccode::GetGuid(); |
| | | xstring sname= sguid +L".xsl"; |
| | | xstring suri= L"rpttemplate"+L"\\"+m_EntityName; //rpttemplate\SO |
| | | //suri = L"supplier00"; |
| | | string ret = xaserver::UploadFile(suri, sname, this.GetHWND(),L"",false); |
| | | xstring ret = xaserver::UploadFile(suri, sname, this.GetHWND(),L"",false); |
| | | if (ret == L"-1") |
| | | { |
| | | alert(L"上传的文件没选择!"); |
| | |
| | | { |
| | | if (win32::MessageBox(GetHWND(),L"确定要删除选中的模板?",L"提示",1) == 2) |
| | | return 0; |
| | | msxml::IXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | string sguid = ele.selectSingleNode(L"ID").text; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring sguid = ele.selectSingleNode(L"ID").text; |
| | | xml x=new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg args = new xaserverarg; |
| | |
| | | int OnOpenDocument() |
| | | { |
| | | if(dw_doclist.GetRowCount() < 1) return 1; |
| | | string documentid = dw_doclist.GetRowElement(dw_doclist.GetRow()).getAttribute(L"guid"); |
| | | //string billid = dw_docList |
| | | xstring documentid = dw_doclist.GetRowElement(dw_doclist.GetRow()).getAttribute(L"guid"); |
| | | //xstring billid = dw_docList |
| | | arg_param.AddArg(L"DocumentID",documentid); |
| | | arg_param.AddArg(L"return",L"ok"); |
| | | arg_param.AddArg(L"action",L"open"); |
| | |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | trace(L"\r\n---------------"); |
| | | trace(ele.xml); |
| | | |
| | | string sguid = ele.selectSingleNode(L"ID").text; |
| | | string pre = L""; |
| | | xstring sguid = ele.selectSingleNode(L"ID").text; |
| | | xstring pre = L""; |
| | | if(ele.selectSingleNode(L"TemplPre")) pre = ele.selectSingleNode(L"TemplPre").text; |
| | | string sTemplName = ele.selectSingleNode(L"TemplName").text; |
| | | //string sFile = m_filePath + sguid+L".xsl"; |
| | | xstring sTemplName = ele.selectSingleNode(L"TemplName").text; |
| | | //xstring sFile = m_filePath + sguid+L".xsl"; |
| | | trace(sTemplName); |
| | | string sFile = m_filePath + ele.selectSingleNode(L"urlPath").text; |
| | | xstring sFile = m_filePath + ele.selectSingleNode(L"urlPath").text; |
| | | arg_param.AddArg(L"xsl",sFile); |
| | | arg_param.AddArg(L"return",L"ok"); |
| | | arg_param.AddArg(L"template-name",sTemplName); |
| | |
| | | //xwin::ReadFile(hFile,pMemory,MEMSIZE - 1,SizeReadWrite,0); |
| | | int filesize = xwin::GetFileSize(hFile,0); |
| | | trace(L"filesize = %d",filesize); |
| | | string buffer = L"".space(filesize+1); |
| | | xstring buffer = L"".space(filesize+1); |
| | | int readsize = new int; |
| | | xwin::ReadFile(hFile,buffer,filesize,readsize,0); |
| | | trace(buffer); |
| | |
| | | return 1; |
| | | } |
| | | |
| | | int PreOnCmdDispatch(string comdid) |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | //返回0——不在执行以下代码;返回其他——执行以下代码。 |
| | | if(comdid.left(8) == L"xmPanel:"){ |
| | | string no = comdid.mid(8, 99); |
| | | xstring no = comdid.mid(8, 99); |
| | | //int id = no.toInt(); |
| | | |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | x.LoadXml(strNode); |
| | | msxml::IXMLDOMDocument doc= x.GetXmlDoc(); |
| | | msxml::IXMLDOMElement e = doc.documentElement; |
| | | string slable =e.selectSingleNode(L"//xtoolbutton[@name='"+comdid+L"']/@caption").text; |
| | | KXMLDOMDocument doc= x.GetXmlDoc(); |
| | | KXMLDOMElement e = doc.documentElement; |
| | | xstring slable =e.selectSingleNode(L"//xtoolbutton[@name='"+comdid+L"']/@caption").text; |
| | | m_Dir = slable; |
| | | OnRetrieve(); |
| | | |
| | |
| | | { |
| | | PUser puser = new PUser; |
| | | puser = publiccode::GetUser(); |
| | | string susername = puser.name; |
| | | xstring susername = puser.name; |
| | | if (susername !=L"admin") |
| | | { |
| | | string xfNodeAgentArea = L"DirButton"; |
| | | xstring xfNodeAgentArea = L"DirButton"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | string tools=L"<vbox name='DirButton' height='48' />"; |
| | | SetAgentNodeContent(anode, tools); |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | xstring tools=L"<vbox name='DirButton' height='48' />"; |
| | | SetAgentNode(anode, tools); |
| | | } |
| | | return 1; |
| | | } |
| | |
| | | { |
| | | PUser puser = new PUser; |
| | | puser = publiccode::GetUser(); |
| | | string susername = puser.name; |
| | | xstring susername = puser.name; |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | |
| | | return -1; |
| | | }else |
| | | { |
| | | string s = x.GetXml(); |
| | | xstring s = x.GetXml(); |
| | | } |
| | | msxml::IXMLDOMNodeList nlist = x.GetXmlDoc().selectNodes(L"//Entity"); |
| | | KXMLDOMNodeList nlist = x.GetXmlDoc().selectNodes(L"//Entity"); |
| | | int i; |
| | | int nlen = nlist.length; |
| | | string toolStr = L"<vbox name='Dir'>"; |
| | | string deptName= publiccode::GetUser().deptname; |
| | | xstring toolStr = L"<vbox name='Dir'>"; |
| | | xstring deptName= publiccode::GetUser().deptname; |
| | | if(deptName==L"跟单部" && m_EntityName==L"GDN3"){ |
| | | for(i=2; i<nlen; i++) |
| | | { |
| | | msxml::IXMLDOMElement e1 = nlist.item(i); |
| | | string sDir1 = e1.selectSingleNode(L"@Dir").text; |
| | | string str1 = L"<xtoolbutton image='15' caption='"+sDir1+L"' height='24' name='xmPanel:"+i.toString()+L"' style='background-color:none #ceecce none #ffffff'/>"; |
| | | KXMLDOMElement e1 = nlist.item(i); |
| | | xstring sDir1 = e1.selectSingleNode(L"@Dir").text; |
| | | xstring str1 = L"<xtoolbutton image='15' caption='"+sDir1+L"' height='24' name='xmPanel:"+i.toString()+L"' style='background-color:none #ceecce none #ffffff'/>"; |
| | | |
| | | toolStr += str1; |
| | | if (i==2) |
| | |
| | | { |
| | | for(i=1; i<2; i++) |
| | | { |
| | | msxml::IXMLDOMElement e2 = nlist.item(i); |
| | | string sDir2 = e2.selectSingleNode(L"@Dir").text; |
| | | string str2 = L"<xtoolbutton image='15' caption='"+sDir2+L"' height='24' name='xmPanel:"+i.toString()+L"' style='background-color:none #ceecce none #ffffff'/>"; |
| | | KXMLDOMElement e2 = nlist.item(i); |
| | | xstring sDir2 = e2.selectSingleNode(L"@Dir").text; |
| | | xstring str2 = L"<xtoolbutton image='15' caption='"+sDir2+L"' height='24' name='xmPanel:"+i.toString()+L"' style='background-color:none #ceecce none #ffffff'/>"; |
| | | |
| | | toolStr += str2; |
| | | if (i==1) |
| | |
| | | } |
| | | for(i=4; i<nlen; i++) |
| | | { |
| | | msxml::IXMLDOMElement e3 = nlist.item(i); |
| | | string sDir3 = e3.selectSingleNode(L"@Dir").text; |
| | | string str3 = L"<xtoolbutton image='15' caption='"+sDir3+L"' height='24' name='xmPanel:"+i.toString()+L"' style='background-color:none #ceecce none #ffffff'/>"; |
| | | KXMLDOMElement e3 = nlist.item(i); |
| | | xstring sDir3 = e3.selectSingleNode(L"@Dir").text; |
| | | xstring str3 = L"<xtoolbutton image='15' caption='"+sDir3+L"' height='24' name='xmPanel:"+i.toString()+L"' style='background-color:none #ceecce none #ffffff'/>"; |
| | | |
| | | toolStr += str3; |
| | | } |
| | | }else{ |
| | | for(i=0; i<nlen; i++) |
| | | { |
| | | msxml::IXMLDOMElement e = nlist.item(i); |
| | | string sDir = e.selectSingleNode(L"@Dir").text; |
| | | string str = L"<xtoolbutton image='15' caption='"+sDir+L"' height='24' name='xmPanel:"+i.toString()+L"' style='background-color:none #ceecce none #ffffff'/>"; |
| | | KXMLDOMElement e = nlist.item(i); |
| | | xstring sDir = e.selectSingleNode(L"@Dir").text; |
| | | xstring str = L"<xtoolbutton image='15' caption='"+sDir+L"' height='24' name='xmPanel:"+i.toString()+L"' style='background-color:none #ceecce none #ffffff'/>"; |
| | | |
| | | toolStr += str; |
| | | if (i==0) |
| | |
| | | strNode = toolStr; |
| | | //trace(toolStr); |
| | | xnode anode = GetAgentNode(L"Dir"); |
| | | xwin::SetAgentNodeContent(anode,toolStr) ; |
| | | xwin::SetAgentNode(anode,toolStr) ; |
| | | |
| | | OnRetrieve(); |
| | | return 1; |
| | |
| | | dw_doclist = GetControl(L"dw_doclist"); |
| | | dw_doclist.openUrl(L"/sale/view/GDN/template/doclist"); |
| | | |
| | | string sUrl = GetServerUrl(); |
| | | xstring sUrl = GetServerUrl(); |
| | | sUrl = sUrl.mid(0, sUrl.length() - 19); |
| | | m_filePath = L"/business/rpttemplate"; |
| | | arg_param = new xaserverarg; |
| | |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | if(url::get(L"/sale/data/DocumentList3/bill/doclist", arg.GetString(),x)!=1) |
| | | { |
| | | string error = x.GetXmlDoc().text; |
| | | xstring error = x.GetXmlDoc().text; |
| | | trace(error); |
| | | }else |
| | | { |
| | |
| | | |
| | | /*if (GetParam()) |
| | | { |
| | | string action = arg_param.GetArgString(L"action"); |
| | | xstring action = arg_param.GetArgString(L"action"); |
| | | if(action==L"open" || (action==L"" && dw_doclist.GetRowCount() > 0)) |
| | | SwitchLayer(L"sheet2",L"frame"); |
| | | } |
| | |
| | | |
| | | /*if (GetParam()) |
| | | { |
| | | string action = arg_param.GetArgString(L"action"); |
| | | xstring action = arg_param.GetArgString(L"action"); |
| | | if(action==L"open" || (action==L"" && dw_doclist.GetRowCount() > 0)) |
| | | SwitchLayer(L"sheet2",L"frame"); |
| | | } |