xj qian
2024-06-28 ebb3b956d3c5e2ec8c2308e20d650c91fb08cc01
update print view
已添加10个文件
已修改5个文件
551 ■■■■■ 文件已修改
jrj/ext-jrj/ext-jrj.vcxproj 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/ext-jrj/ext-jrj.vcxproj.filters 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Supplier/Inspection.Supplie.cpp 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Supplier/SupplierSource.cpp 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Supplier/asklist.Owner.Supplier.cpp 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Supplier/list.Owner.Supplier.cpp 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Supplier/maint.Document.Supplier.cpp 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Supplier/maint.Document.SupplierEx.cpp 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Supplier/maint.Document.SupplierSD.cpp 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Supplier/maint.Owner.Supplier.cpp 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Supplier/maintex.Owner.Supplier.cpp 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Supplier/paymen.Supplie.cpp 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/printview/Maint.Template.PrintEx.cpp 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/printview/Template.Print.Dialog.cpp 162 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/printview/Template.Print.ViewEx.cpp 287 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/ext-jrj/ext-jrj.vcxproj
@@ -333,6 +333,16 @@
    <ClCompile Include="..\project\business\Supplier3.list.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\asklist.Owner.Supplier.cpp" />
    <ClCompile Include="..\project\business\Supplier\Inspection.Supplie.cpp" />
    <ClCompile Include="..\project\business\Supplier\list.Owner.Supplier.cpp" />
    <ClCompile Include="..\project\business\Supplier\maint.Document.Supplier.cpp" />
    <ClCompile Include="..\project\business\Supplier\maint.Document.SupplierEx.cpp" />
    <ClCompile Include="..\project\business\Supplier\maint.Document.SupplierSD.cpp" />
    <ClCompile Include="..\project\business\Supplier\maint.Owner.Supplier.cpp" />
    <ClCompile Include="..\project\business\Supplier\maintex.Owner.Supplier.cpp" />
    <ClCompile Include="..\project\business\Supplier\paymen.Supplie.cpp" />
    <ClCompile Include="..\project\business\Supplier\SupplierSource.cpp" />
    <ClCompile Include="..\project\printview\Maint.Template.PrintEx.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
jrj/ext-jrj/ext-jrj.vcxproj.filters
@@ -70,6 +70,9 @@
    <Filter Include="vbusiness\printview">
      <UniqueIdentifier>{6f77cfbf-b9ec-4031-9d7a-6925116f657b}</UniqueIdentifier>
    </Filter>
    <Filter Include="project\business\Supplier">
      <UniqueIdentifier>{411fad96-7418-4b98-8e36-3f9893659ea1}</UniqueIdentifier>
    </Filter>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="framework.h">
@@ -437,5 +440,35 @@
    <ClCompile Include="..\project\printview\Template.Print.ViewEx.cpp">
      <Filter>vbusiness\printview</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\asklist.Owner.Supplier.cpp">
      <Filter>project\business\Supplier</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\Inspection.Supplie.cpp">
      <Filter>project\business\Supplier</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\list.Owner.Supplier.cpp">
      <Filter>project\business\Supplier</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\maint.Document.Supplier.cpp">
      <Filter>project\business\Supplier</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\maint.Document.SupplierEx.cpp">
      <Filter>project\business\Supplier</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\maint.Document.SupplierSD.cpp">
      <Filter>project\business\Supplier</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\maint.Owner.Supplier.cpp">
      <Filter>project\business\Supplier</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\maintex.Owner.Supplier.cpp">
      <Filter>project\business\Supplier</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\paymen.Supplie.cpp">
      <Filter>project\business\Supplier</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier\SupplierSource.cpp">
      <Filter>project\business\Supplier</Filter>
    </ClCompile>
  </ItemGroup>
</Project>
jrj/project/business/Supplier/Inspection.Supplie.cpp
Binary files differ
jrj/project/business/Supplier/SupplierSource.cpp
Binary files differ
jrj/project/business/Supplier/asklist.Owner.Supplier.cpp
Binary files differ
jrj/project/business/Supplier/list.Owner.Supplier.cpp
Binary files differ
jrj/project/business/Supplier/maint.Document.Supplier.cpp
Binary files differ
jrj/project/business/Supplier/maint.Document.SupplierEx.cpp
Binary files differ
jrj/project/business/Supplier/maint.Document.SupplierSD.cpp
Binary files differ
jrj/project/business/Supplier/maint.Owner.Supplier.cpp
Binary files differ
jrj/project/business/Supplier/maintex.Owner.Supplier.cpp
Binary files differ
jrj/project/business/Supplier/paymen.Supplie.cpp
Binary files differ
jrj/project/printview/Maint.Template.PrintEx.cpp
@@ -1,50 +1,69 @@
class MaintTemplatePrintWin :  public xframe
#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) MaintTemplatePrintWin :  public xframe
    {
    public:
        xcell cell;
        xnode    m_agentNode;    //Agent Condition
        string args;
        xstring args;
    public:
        MaintTemplatePrintWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
    public:
        static MaintTemplatePrintWin* CreateInstance(void* implPtr, void* hWnd)
        {
            MaintTemplatePrintWin* pWin = new MaintTemplatePrintWin(implPtr, (HWND)hWnd);
            return pWin;
        }
        int SetAgent()
        {
            string xfNodeAgentArea  = L"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(L"agent/"+xfNodeAgentArea+L"[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, LPARAM p)
        {
            //重置工具条
            SetAgent();
            return 1;
        }
}
        int SendCtrlCmd(xcontrol xc, string cmd)
        int SendCtrlCmd(xcontrol xc, xstring cmd)
        {
            win32::SendMessage(xc.GetId(),0x401,cmd,0);
            return 1;
        }
        //命令发布函数
        int OnCmdDispatch(string comdid)
        int OnCmdDispatch(xstring comdid)
        {
            if(comdid.left(3) == L"IK_")
            {
                string cmd = comdid.mid(3, comdid.length());
                xstring cmd = comdid.mid(3, comdid.length());
                SendCtrlCmd(GetControl(L"cell"),cmd);
                return 1;
            }
@@ -68,17 +87,17 @@
        }
        
        //命令处理事件
        int OnXCommand(ref TXCommandEvent evt,int param)
        int OnXCommand(TEvent* evt, LPARAM p)
        {
            return OnCmdDispatch(evt.pStrID);
            return OnCmdDispatch(evt->xcommand.pStrID);
        }
        
        int OnAttachEvent()
        {
            //绑定工具条点击事件
            AttachEvent(L"WM_XCOMMAND",OnXCommand);
            AttachEvent(L"WM_XCOMMAND", (FEvent)&MaintTemplatePrintWin::OnXCommand);
            //获取焦点事件,用于重置工具条
            AttachEvent(L"WM_SETFOCUS",OnSetFocus);
            AttachEvent(L"WM_SETFOCUS", (FEvent)&MaintTemplatePrintWin::OnSetFocus);
        }
        
        int onload()
@@ -88,9 +107,9 @@
        
            OnAttachEvent();    
            
            if(GetParam())
            if(GetWinParam())
            {
                args = GetParam();
                args = GetParamString();
                cell.openUrl(L"/sale/data/SysPrintTemplate/getdevxsl",args);
            }
            else
@@ -104,4 +123,4 @@
            
            return 1;
        }        
    };
jrj/project/printview/Template.Print.Dialog.cpp
@@ -1,20 +1,38 @@
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>"+
@@ -40,8 +58,8 @@
            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'/>"+
@@ -75,7 +93,7 @@
            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);
@@ -86,7 +104,7 @@
        
        int OnRetrieve()
        {
            string username = publiccode::GetUser().name;
            xstring username = publiccode::GetUser().name;
            if(username != L"admin" && m_Dir != username )
            {
                bupdate = false;
@@ -94,20 +112,20 @@
            {
                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();
@@ -133,11 +151,11 @@
            }
            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");
                
@@ -159,11 +177,11 @@
                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"上传的文件没选择!");
@@ -213,8 +231,8 @@
            {
                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;
@@ -255,8 +273,8 @@
        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");
@@ -274,17 +292,17 @@
            }
            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);
@@ -319,7 +337,7 @@
                    //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);
@@ -363,19 +381,19 @@
            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();
            
@@ -416,14 +434,14 @@
        {    
            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;
        }
@@ -432,7 +450,7 @@
        {
            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;
@@ -446,19 +464,19 @@
                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) 
@@ -468,9 +486,9 @@
            {
                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) 
@@ -478,18 +496,18 @@
                }
                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) 
@@ -501,7 +519,7 @@
            strNode = toolStr;
            //trace(toolStr);
            xnode anode = GetAgentNode(L"Dir");
            xwin::SetAgentNodeContent(anode,toolStr) ;
            xwin::SetAgentNode(anode,toolStr) ;
            
            OnRetrieve();
            return 1;
@@ -519,7 +537,7 @@
            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;
@@ -540,7 +558,7 @@
                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
                {
@@ -570,7 +588,7 @@
        
        /*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");
        }
@@ -585,7 +603,7 @@
        
        /*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");
        }
jrj/project/printview/Template.Print.ViewEx.cpp
@@ -1,3 +1,13 @@
#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;
namespace _excel for ole "Excel.Application,{00020813-0000-0000-C000-000000000046}";
namespace _mshtml for ole "MSHtml,{3050F1C5-98B5-11CF-BB82-00AA00BDCE0B}";
@@ -7,9 +17,9 @@
    static int CreateInstance() alias "?CreateInstance@CExcelApplication@@SAPAV1@XZ";
    void put_Visible(bool t) alias "?put_Visible@CExcelApplication@@QAEXH@Z";
    bool get_Visible() alias "?get_Visible@CExcelApplication@@QAEHXZ";
    void OpenDocument(const string filename) alias "?OpenDocument@CExcelApplication@@QAEXQA_W@Z";
    void OpenDocument(const xstring filename) alias "?OpenDocument@CExcelApplication@@QAEXQA_W@Z";
    void TransShape() alias "?TransShape@CExcelApplication@@QAEXXZ";
    void SaveToFile(string filename) alias "?SaveToFile@CExcelApplication@@QAEXQA_W@Z";
    void SaveToFile(xstring filename) alias "?SaveToFile@CExcelApplication@@QAEXQA_W@Z";
    void Quit() alias "?Quit@CExcelApplication@@QAEXXZ";
};
@@ -18,27 +28,27 @@
   unsigned int    lStructSize;
   unsigned int   hwndOwner;
   unsigned int   hInstance;
   string                 lpstrFilter;
   xstring                 lpstrFilter;
   
   string               lpstrCustomFilter;
   xstring               lpstrCustomFilter;
   unsigned int   nMaxCustFilter;
   unsigned int        nFilterIndex;
   string                    lpstrFile;
   xstring                    lpstrFile;
   
   unsigned int        nMaxFile;
   string                    lpstrFileTitle;
   xstring                    lpstrFileTitle;
   unsigned int        nMaxFileTitle;
   string      lpstrInitialDir;
   xstring      lpstrInitialDir;
   
   string                  lpstrTitle;
   xstring                  lpstrTitle;
   unsigned int       Flags;
   unsigned short   nFileOffset;
   unsigned short   nFileExtension;
   string      lpstrDefExt;
   xstring      lpstrDefExt;
   
   unsigned int   lCustData;
   unsigned int     lpfnHook;
   string      lpTemplateName;
   xstring      lpTemplateName;
   
    //_WIN32_WINNT >= 0x0500
   unsigned int         pvReserved;
@@ -47,55 +57,64 @@
    // (_WIN32_WINNT >= 0x0500)
};
    
class TemplatePrintViewEx : public frame
class  __declspec(dllexport) TemplatePrintViewEx : public xframe
{    
public:
    xole ole_print;
    xcell cell;
    string m_EntityName;
    string m_EntityID;
    string m_EntityNo;
    string m_strHtml;
    string m_spath;
    xstring m_EntityName;
    xstring m_EntityID;
    xstring m_EntityNo;
    xstring m_strHtml;
    xstring m_spath;
    bool updated;
    string   htmlStr;
    xstring   htmlStr;
    cexcel   excel;
    bool        editing;
    string  billName ;
    string  billID ;
    string  billPre;
    xstring  billName ;
    xstring  billID ;
    xstring  billPre;
    string  m_DocumentID;
    xstring  m_DocumentID;
    xml      m_dataset;
    //bool showgrid;
    bool PaperPrint;
    static stdcall int GetModuleFileName(int hModule ,string lpFileName ,int nSize ) native from "kernel32.dll" alias "GetModuleFileNameW";
    static stdcall int PathRemoveFileSpec(string lpFileName ) native from "shlwapi.dll" alias "PathRemoveFileSpecW";
    static stdcall int DeleteFile(string lpFileName) native from "kernel32.dll" alias "DeleteFileW";
    static stdcall int GetModuleFileName(int hModule ,xstring lpFileName ,int nSize ) native from "kernel32.dll" alias "GetModuleFileNameW";
    static stdcall int PathRemoveFileSpec(xstring lpFileName ) native from "shlwapi.dll" alias "PathRemoveFileSpecW";
    static stdcall int DeleteFile(xstring lpFileName) native from "kernel32.dll" alias "DeleteFileW";
    static stdcall bool GetSaveFileName(ref MYOPENFILENAMEW)native from "comdlg32.dll" alias "GetSaveFileNameW"; 
    string GetModulePath()
public:
    TemplatePrintViewEx(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
public:
    static TemplatePrintViewEx* CreateInstance(void* implPtr, void* hWnd)
    {
        string str =L"";
        TemplatePrintViewEx* pWin = new TemplatePrintViewEx(implPtr, (HWND)hWnd);
        return pWin;
    }
    xstring GetModulePath()
    {
        xstring str =L"";
        str = str.space(255);
        GetModuleFileName(0,str,250);
        PathRemoveFileSpec(str);
        return str;
    }
    string GetModuleTmpPath()
    xstring GetModuleTmpPath()
    {
        string str =L"";
        xstring str =L"";
        str = str.space(255);
        GetModuleFileName(0,str,250);
        PathRemoveFileSpec(str);
        string tmp = str + L"\\Temp";
        xstring tmp = str + L"\\Temp";
        xaserver::CreateDirectory(tmp);
        return tmp;
    }
    
    string GetSaveFileName(string initFileName, string filter, string ext)
    xstring GetSaveFileName(xstring initFileName, xstring filter, xstring ext)
    {
        char[]  szFileName = new char[255] ;
        char[]  szPath =  new char[255];
@@ -151,14 +170,14 @@
            
    int OnExport()
    {
        string pre = billPre;
        xstring pre = billPre;
        if(pre==L"")
        {
            pre = m_EntityName;
            if(m_EntityName==L"SaleOrder") pre=L"PI";
            if(m_EntityName==L"GDN3")pre=L"INV";
        }
        string file1 =  GetSaveFileName(pre+m_EntityNo+L".xlsx",
        xstring file1 =  GetSaveFileName(pre+m_EntityNo+L".xlsx",
            "Excel1文件(*.xlsx)\0*.xlsx;*.xls\0Excel97文件(*.xls)\0*.xls\0PDF文件(*.pdf)\0*.pdf\0",
            "xlsx");
        if(file1 ==L"") return 1;
@@ -179,8 +198,8 @@
            return 1;
        }
        string gid =  publiccode::GetGuid();
        string filename= pre+m_EntityNo+L"_.htm";
        xstring gid =  publiccode::GetGuid();
        xstring filename= pre+m_EntityNo+L"_.htm";
        xutil::SaveToFile(GetModuleTmpPath() + L"\\"+ filename, htmlStr,L"",L"",L"");
        trace(L"\r\n excel to open");
        excel .OpenDocument(GetModuleTmpPath() + L"\\"+ filename);
@@ -217,12 +236,12 @@
        excel = new cexcel;
        excel.setNativePointer(cexcel::CreateInstance());
        
        string gid =  publiccode::GetGuid();
        string pre = m_EntityName;
        xstring gid =  publiccode::GetGuid();
        xstring pre = m_EntityName;
        if(m_EntityName==L"SaleOrder") pre=L"PI";
        if(m_EntityName==L"GDN3")pre=L"INV";
        string filename= pre+m_EntityNo+L".htm";
        string filenameex= pre+m_EntityNo+L".xlsx";
        xstring filename= pre+m_EntityNo+L".htm";
        xstring filenameex= pre+m_EntityNo+L".xlsx";
        xutil::SaveToFile(GetModuleTmpPath() + L"\\"+ filename, htmlStr,L"",L"",L"");
        excel .OpenDocument(GetModuleTmpPath() + L"\\"+ filename);
        //excel.put_Visible(true);
@@ -236,10 +255,10 @@
        return 1;
    }
    string getfilePath()
    xstring getfilePath()
    {
        string path=GetModulePath()+L"\\resource\\image";
        string filename=L"contract.jpg";
        xstring path=GetModulePath()+L"\\resource\\image";
        xstring filename=L"contract.jpg";
        filename=L"sign.png";
        filename=L"jrj_maersk.png";
        filename=L"HomeDecorSign.png";
@@ -249,18 +268,18 @@
        return path;
    }
    
    string replaceInnerElement(string html)
    xstring replaceInnerElement(xstring html)
    {
        string str = html;
        xstring str = html;
        if(str.find(L"[$element:")<0) return str;
        
        int len = 0;
        int pos = 0;
        int pos1 = 0;
        string pre=L"";
        string left=L"";
        string right=L"";
        string tag=L"";
        xstring pre=L"";
        xstring left=L"";
        xstring right=L"";
        xstring tag=L"";
        
        len = L"[$element:".length();
        while(true)
@@ -310,7 +329,7 @@
        return str;
    }
    string adjustXsl(string str,string localPath)
    xstring adjustXsl(xstring str,xstring localPath)
    {
        //if(str.find(L"%")>=0)  str = str.replace(L"%",L"");
        if(str.find(L"[$path]/rpttemplate")>=0) str = str.replace(L"[$path]/rpttemplate",localPath);
@@ -318,7 +337,7 @@
        return str;
    }
    
    string DownLoadSKUNoPic(string SKUNo,string CustomerID=L"",string CustomerItemNo=L"")
    xstring DownLoadSKUNoPic(xstring SKUNo,xstring CustomerID=L"",xstring CustomerItemNo=L"")
    {
        
        if(SKUNo.length()>20) return DownLoadPaperPic(SKUNo);
@@ -329,7 +348,7 @@
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg(L"SKUNo",SKUNo);
        
        string src =L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo";
        xstring src =L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo";
        if(CustomerID !=L"")
        {
            arg.AddArg(L"CustomerID",CustomerID);
@@ -343,9 +362,9 @@
            return "";
        }
        
        string spath = L"";
        string path =GetModuleTmpPath();
        string ext = L"jpg";
        xstring spath = L"";
        xstring path =GetModuleTmpPath();
        xstring ext = L"jpg";
        if(x.GetXmlDoc().selectSingleNode(L"//FileExt[1]"))
        {
            ext = x.GetXmlDoc().selectSingleNode(L"//FileExt[1]").text;
@@ -361,7 +380,7 @@
                ext = x.GetXmlDoc().selectSingleNode(L"//FileExt[1]").text;
        }
            
        string filename = SKUNo + L"." + ext;
        xstring filename = SKUNo + L"." + ext;
        if(x.GetXmlDoc().selectSingleNode(L"//PicPath[1]"))
            spath = x.GetXmlDoc().selectSingleNode(L"//PicPath[1]").text;
        if(spath != L"")
@@ -371,7 +390,7 @@
        return "file://"+ path+L"/"+filename;
    }
        
    string DownLoadSKUNoPic(string SKUNo,string CustomerID=L"",string CustomerItemNo=L"")
    xstring DownLoadSKUNoPic(xstring SKUNo,xstring CustomerID=L"",xstring CustomerItemNo=L"")
    {
        
        if(SKUNo.length()>20) return DownLoadPaperPic(SKUNo);
@@ -382,7 +401,7 @@
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg(L"SKUNo",SKUNo);
        
        string src =L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo";
        xstring src =L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo";
        if(CustomerID !=L"")
        {
            arg.AddArg(L"CustomerID",CustomerID);
@@ -396,9 +415,9 @@
            return "";
        }
        
        string spath = L"";
        string path =GetModuleTmpPath();
        string ext = L"jpg";
        xstring spath = L"";
        xstring path =GetModuleTmpPath();
        xstring ext = L"jpg";
        if(x.GetXmlDoc().selectSingleNode(L"//FileExt[1]"))
        {
            ext = x.GetXmlDoc().selectSingleNode(L"//FileExt[1]").text;
@@ -414,7 +433,7 @@
                ext = x.GetXmlDoc().selectSingleNode(L"//FileExt[1]").text;
        }
            
        string filename = SKUNo + L"." + ext;
        xstring filename = SKUNo + L"." + ext;
        if(x.GetXmlDoc().selectSingleNode(L"//PicPath[1]"))
            spath = x.GetXmlDoc().selectSingleNode(L"//PicPath[1]").text;
        if(spath != L"")
@@ -424,7 +443,7 @@
        return "file://"+ path+L"/"+filename;
    }
        
    string GetImageUrl(string id)
    xstring GetImageUrl(xstring id)
    {
        xml xp=new xml;
        xp.setNativePointer(xml::CreateInstance());
@@ -432,50 +451,50 @@
        arg_pic.setNativePointer(arg_pic.CreateInstance());    
        arg_pic.AddArg(L"id",id);
        
        string res = L"/sale/data/productlibrary3/image/url";
        xstring res = L"/sale/data/productlibrary3/image/url";
        if(url::get(res,arg_pic.GetString(),xp)!=1)
        {
            xp.GetXml();
            return 1;
        }else
        {
            string path = xp.GetXmlDoc().text;
            xstring path = xp.GetXmlDoc().text;
            if(path !=L"") return path;
        }
        
        return "/business/products/chanpin/"+id.left(2)+L"/"+ id+L".jpg";
    }
    
    string DownLoadPaperPic(string guid)
    xstring DownLoadPaperPic(xstring guid)
    {
        
        string path =GetModuleTmpPath();
        string ext = L"jpg";
        string filename = guid + L"." + ext;
        string spath = GetImageUrl(guid);
        xstring path =GetModuleTmpPath();
        xstring ext = L"jpg";
        xstring filename = guid + L"." + ext;
        xstring spath = GetImageUrl(guid);
        //alert(spath);
        xaserver::DownLoadFile(GetServerUrl(),spath,L"",path+L"/"+filename);
        return "file://"+ path+L"/"+filename;
    }
            
    string DownLoadPaperPic1(string guid)
    xstring DownLoadPaperPic1(xstring guid)
    {
        string path =GetModuleTmpPath();
        string ext = L"jpg";
        string filename = guid + L"." + ext;
        string str = guid.mid(0,2);
        string spath = L"/business/products/chanpin/"+str+L"/"+guid+L".jpg";
        xstring path =GetModuleTmpPath();
        xstring ext = L"jpg";
        xstring filename = guid + L"." + ext;
        xstring str = guid.mid(0,2);
        xstring spath = L"/business/products/chanpin/"+str+L"/"+guid+L".jpg";
        xaserver::DownLoadFile(GetServerUrl(),spath,L"",path+L"/"+filename);
        return "file://"+ path+L"/"+filename;
    }
    
    string DownLoadUrlPic(string src)
    xstring DownLoadUrlPic(xstring src)
    {
        string guid =  publiccode::GetGuid();
        string path =GetModuleTmpPath();
        string ext = L"jpg";
        string filename = guid + L"." + ext;
        string spath = src;
        xstring guid =  publiccode::GetGuid();
        xstring path =GetModuleTmpPath();
        xstring ext = L"jpg";
        xstring filename = guid + L"." + ext;
        xstring spath = src;
        xaserver::DownLoadFile(GetServerUrl(),spath,L"",path+L"/"+filename);
        return "file://"+ path+L"/"+filename;
    }
@@ -484,9 +503,9 @@
    {
        int hCursor = xutil::SetCursorWait();
        string sEntityName = arg.GetArgString(L"EntityName");
        string sEntityID = arg.GetArgString(L"EntityID");
        string dataUrl = arg.GetArgString(L"DataUrl");
        xstring sEntityName = arg.GetArgString(L"EntityName");
        xstring sEntityID = arg.GetArgString(L"EntityID");
        xstring dataUrl = arg.GetArgString(L"DataUrl");
        if(dataUrl==L"") 
            dataUrl = L"/sale/data/"+sEntityName+L"/print/dataset";
        else if(dataUrl.left(1)!=L"/") 
@@ -504,7 +523,7 @@
            m_dataset = x0;
        }
            
        string sPath;
        xstring sPath;
        sPath = getfilePath();
        arg.AddArg(L"sPath",sPath);
        m_spath = sPath;
@@ -517,7 +536,7 @@
            return 0;
        }
        
        string xslStr = xsl.GetXml();
        xstring xslStr = xsl.GetXml();
        
        xslStr = adjustXsl(xslStr,sPath);
        xsl.LoadXml(xslStr);
@@ -526,21 +545,21 @@
        trace(L"\r\n--------\r\n"+xslStr);
        
        m_strHtml = m_dataset.GetXmlDoc().transformNode(xsl.GetXmlDoc());
        string aspace = m_strHtml.replace(L"[空]",L"&nbsp;",0);
        xstring aspace = m_strHtml.replace(L"[空]",L"&nbsp;",0);
        aspace = aspace.replace(L"[line]",L"<br/>",0);
        string scontent = aspace.replace(L"<?xml version=\"1.0\"?>",L"",0);
        xstring scontent = aspace.replace(L"<?xml version=\"1.0\"?>",L"",0);
        
        string head =L"";
        string tail = scontent;
        xstring head =L"";
        xstring tail = scontent;
        int pos = tail.find(L"src=\"item-picture:");
        while(pos > 0)
        {
            int spos = pos+L"src=\"item-picture:".length();
            int pos1 = tail.find(L"\"",spos+1);
            string skuno = tail.mid(spos,pos1 - spos ).trim();
            string CustomerID=L"";
            string CustomerItemNo=L"";
            xstring skuno = tail.mid(spos,pos1 - spos ).trim();
            xstring CustomerID=L"";
            xstring CustomerItemNo=L"";
            if(skuno.find(L",L")>0)
            {
                CustomerID = skuno.left(skuno.find(L",L")).trim();
@@ -551,7 +570,7 @@
                CustomerItemNo = skuno.left(skuno.find(L",L")).trim();
                skuno = skuno.mid(skuno.find(L",L")+1,256).trim();
            }
            string src =  DownLoadSKUNoPic(skuno,CustomerID,CustomerItemNo);
            xstring src =  DownLoadSKUNoPic(skuno,CustomerID,CustomerItemNo);
            head += tail.left(pos) + L"src=\"" + src;
            tail = tail.mid(pos1,999999999);
            pos = tail.find(L"src=\"item-picture:");
@@ -565,8 +584,8 @@
        {
            int sposition = position+L"src=\"paper-picture:".length();
            int position1 = tail.find(L"\"",sposition+1);
            string guid = tail.mid(sposition,position1 - sposition ).trim();
            string src2 =  DownLoadPaperPic(guid);
            xstring guid = tail.mid(sposition,position1 - sposition ).trim();
            xstring src2 =  DownLoadPaperPic(guid);
            head += tail.left(position) + L"src=\"" + src2;
            tail = tail.mid(position1,999999999);
            position = tail.find(L"src=\"paper-picture:");
@@ -594,13 +613,13 @@
        
        xml x1 = new xml;
        x1.setNativePointer(xml ::CreateInstance());
        //string xcontent = m_strHtml.replace(L"&nbsp;",L"[空]",0);
        string xcontent = m_strHtml.replace(L"[空]",L" ",0);
        //xstring xcontent = m_strHtml.replace(L"&nbsp;",L"[空]",0);
        xstring xcontent = m_strHtml.replace(L"[空]",L" ",0);
        int pos0 = xcontent.find(L"<xml");
        int pos2 = xcontent.find(L"</xml>");
        if(pos0>=0)
        {
            string str = xcontent.left(pos0)+ xcontent.mid(pos2+6,9999999);
            xstring str = xcontent.left(pos0)+ xcontent.mid(pos2+6,9999999);
            xcontent = str;
        }
        x1.LoadXml(xcontent);
@@ -656,8 +675,8 @@
            arg.AddArg(L"DocumentID",L"");
            arg.AddArg(L"ok",L"");
            openUrl(L"/sale/view/view.dlg/xpage/Template/PrintDialog", p);
            string ret = arg.GetArgString(L"return");
            string action = arg.GetArgString(L"action");
            xstring ret = arg.GetArgString(L"return");
            xstring action = arg.GetArgString(L"action");
            if (ret ==L"ok") 
            {
                if(action ==L"open")
@@ -665,7 +684,7 @@
                    m_DocumentID = arg.GetArgString(L"DocumentID");
                    xml x = new xml;
                    x.setNativePointer(xml::CreateInstance());    
                    string prestr = m_DocumentID.mid(0,2);
                    xstring prestr = m_DocumentID.mid(0,2);
                    prestr = prestr.upper();
                    xaserver::LoadUrl(GetServerUrl(),L"/business/data/bill/"+prestr+L"/"+ m_DocumentID+L".jpg",L"",x);
                    if(x.GetXml()!=L"")
@@ -689,7 +708,7 @@
                }
                else
                {
                    string templateName = arg.GetArgString(L"template-name");
                    xstring templateName = arg.GetArgString(L"template-name");
                    win32::SetWindowText(GetHWND(),templateName);
                    billName = templateName;
                    billPre = arg.GetArgString(L"template-pre");
@@ -716,8 +735,8 @@
            int p = arg.ptr_native_;
            arg.AddArg(L"ok",L"");
            openUrl(L"/sale/view/view.dlg/xpage/Template/PrintDialog", p);
            string ret = arg.GetArgString(L"return");
            string action = arg.GetArgString(L"action");
            xstring ret = arg.GetArgString(L"return");
            xstring action = arg.GetArgString(L"action");
            if (ret ==L"ok") 
            {
                updated = false;
@@ -726,13 +745,13 @@
                    m_DocumentID = arg.GetArgString(L"DocumentID");
                    xml x = new xml;
                    x.setNativePointer(xml::CreateInstance());    
                    string prestr = m_DocumentID.mid(0,2);
                    xstring prestr = m_DocumentID.mid(0,2);
                    prestr = prestr.upper();
                    xaserver::LoadUrl(GetServerUrl(),L"/business/data/bill/"+prestr+L"/"+ m_DocumentID+L".jpg",L"",x);
                    if(x.GetXml()!=L"")
                    {
                        
                        string content = L"";
                        xstring content = L"";
                        if(x.GetXmlDoc().documentElement.tagName==L"Bill")
                        {
                            content = x.GetXmlDoc().documentElement.text;
@@ -749,7 +768,7 @@
                                }*/
                                xml x1 = new xml;
                                x1.setNativePointer(xml::CreateInstance());    
                                string content1 = x.GetXml();
                                xstring content1 = x.GetXml();
                                content1 = content1.replace(L"[空]",L" ",0);
                                //trace(content1);
                                x1.LoadXml(content1);
@@ -768,7 +787,7 @@
                }
                else
                {
                    string templateName = arg.GetArgString(L"template-name");
                    xstring templateName = arg.GetArgString(L"template-name");
                    win32::SetWindowText(GetHWND(),templateName);
                    billName = templateName;
                    billPre = arg.GetArgString(L"template-pre");
@@ -786,16 +805,16 @@
            
    int SetAgent()
    {    
        string xfNodeAgentArea  = L"agentarea";
        xstring xfNodeAgentArea  = L"agentarea";
        xnode anode = GetAgentNode(xfNodeAgentArea);
        msxml::IXMLDOMElement xframeElement =  GetElement();
        msxml::IXMLDOMNode agent = xframeElement.selectSingleNode(L"agent/"+xfNodeAgentArea+L"[1]/*");
        KXMLDOMElement xframeElement =  GetElement();
        KXMLDOMNode agent = xframeElement.selectSingleNode(L"agent/"+xfNodeAgentArea+L"[1]/*");
        msxml::IXMLDOMNodeList nlist;
        KXMLDOMNodeList nlist;
        int  index;
        int  nlen;
        msxml::IXMLDOMElement ele;
        string tools=L"<hbox class=''>";
        KXMLDOMElement ele;
        xstring tools=L"<hbox class=''>";
        if(agent)
        {
            nlist = agent.SelectNodes(L".//xtoolbutton");
@@ -803,10 +822,10 @@
            for(index=0;index<nlen;index++)
            {
                ele  =  nlist.item(index);
                string name = ele.selectSingleNode(L"@name").text;
                string label  =  ele.selectSingleNode(L"@caption").text;
                string image;
                string src = L"";
                xstring name = ele.selectSingleNode(L"@name").text;
                xstring label  =  ele.selectSingleNode(L"@caption").text;
                xstring image;
                xstring src = L"";
                if(ele.selectSingleNode(L"@image"))
                    image = ele.selectSingleNode(L"@image").text;
                else
@@ -817,7 +836,7 @@
                
                int strLen = label.length();
                int width = 60 + (strLen - 2) * 10;
                string tool;
                xstring tool;
                if (src != L"")
                    tool = L"<xtoolbutton src='"+src+L"'  caption='"+label+L"' name='"+name+L"' height='28'  class1='action'/>";
                else
@@ -826,7 +845,7 @@
            }
        }
        tools +=L"</hbox>";
        SetAgentNodeContent(anode, tools);
        SetAgentNode(anode, tools);
        return 1;
    }
@@ -847,7 +866,7 @@
        }else
        {
            htmlStr = cell.GetHtml();
            //string content = htmlStr;
            //xstring content = htmlStr;
            htmlStr = htmlStr.replace(L"[空]",L"&nbsp;",0);
            htmlStr = htmlStr.replace(L"[line]",L"<br/>",0);
            ole_print.LoadHtml(htmlStr);    
@@ -931,11 +950,11 @@
    
    int OnAddToDocument()
    {
        string content = htmlStr;
        xstring content = htmlStr;
        if(editing)content = cell.GetHtml();
        string guid = publiccode::GetGuid();
        xstring guid = publiccode::GetGuid();
        
        string prestr = guid.mid(0,2);
        xstring prestr = guid.mid(0,2);
        prestr = prestr.upper();
        
        
@@ -952,7 +971,7 @@
        int ret= xaserver::UploadData(L"bill"+prestr, guid+L".jpg", content);
        if(ret < 0) trace(L"error upload");
        
        string ls_xml =L"<DocumentList guid='"+guid+L"' update.modify='1' update.new='1'>";
        xstring ls_xml =L"<DocumentList guid='"+guid+L"' update.modify='1' update.new='1'>";
        ls_xml += L"<EntityName>"+ m_EntityName + L"</EntityName>";
        ls_xml += L"<EntityID>"+ m_EntityID + L"</EntityID>";
        ls_xml += L"<EntityNo>"+ m_EntityNo + L"</EntityNo>";
@@ -969,11 +988,11 @@
        
        if(url::get(L"/sale/data/DocumentList3/bill/update", arg.GetString(),x)!=1)
        {
            string error = x.GetXmlDoc().text;
            xstring error = x.GetXmlDoc().text;
            alert(L"err:"+error);
            return 1;
        }
        string str = x.GetXmlDoc().documentElement.getAttribute(L"text");
        xstring str = x.GetXmlDoc().documentElement.getAttribute(L"text");
        if(str == L"true")
        {
            alert(L"保存成功!"); 
@@ -986,7 +1005,7 @@
        return 1;
    }
    
    int SendCtrlCmd(xcontrol xc, string cmd)
    int SendCtrlCmd(xcontrol xc, xstring cmd)
    {
        win32::SendMessage(xc.GetId(),0x401,cmd,0);
        return 1;
@@ -996,7 +1015,7 @@
    {
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(GetParam());
        string templateName = arg.GetArgString(L"template-name");
        xstring templateName = arg.GetArgString(L"template-name");
        win32::SetWindowText(GetHWND(),templateName);
        OnHtml(arg);
        billName = templateName;
@@ -1009,7 +1028,7 @@
        return 1;
    }
        
    int OnCmdDispatch(string comdid)
    int OnCmdDispatch(xstring comdid)
    {
        if(comdid==L"xmSort")
        {
@@ -1082,13 +1101,13 @@
        
        if(comdid.left(3) == L"xmSort")
        {
            //string str =
            //xstring str =
            return 1;
        }
        
        if(comdid.left(3) == L"IK_")
        {
            string cmd = comdid.mid(3, comdid.length());
            xstring cmd = comdid.mid(3, comdid.length());
            SendCtrlCmd(cell,cmd);
            return 1;
        }
@@ -1123,7 +1142,7 @@
                alert(L"数据集出错了!");
                return 0;
            }
            string strHtml = x.GetXml();
            xstring strHtml = x.GetXml();
            ole_print.LoadHtml(strHtml);        
        }
        return 0;
@@ -1191,7 +1210,7 @@
        {
            xaserverarg arg = new xaserverarg;
            arg.setNativePointer(GetParam());
            string templateName = arg.GetArgString(L"template-name");
            xstring templateName = arg.GetArgString(L"template-name");
            if(templateName ==L"")
            {
                OnPrintDialog();