|  |  | 
 |  |  | #include <xcontrol/xlayersheet.hpp> | 
 |  |  |  | 
 |  |  | #include "vbusiness/vframe/maint.vframe.vbusiness.hpp" | 
 |  |  | #include "vbusiness/vframe/maint.vframe.vbusiness.hpp" | 
 |  |  | #include "vbusiness/vframe/responsewin.vframe.vbusiness.hpp" | 
 |  |  | #include "viewobject/view.base.hpp" | 
 |  |  |  | 
 |  |  | 
 |  |  |    xdwgrid   dw_list; | 
 |  |  |    xdwgrid   dw_doclist; | 
 |  |  |    bool bupdate; | 
 |  |  | public: | 
 |  |  |    TemplatePrintDialog(void* implPtr, HWND hWnd) :responsewin(implPtr, hWnd) {} | 
 |  |  | public: | 
 |  |  |    static TemplatePrintDialog* CreateInstance(void* implPtr, void* hWnd) | 
 |  |  |    { | 
 |  |  |       return new TemplatePrintDialog(implPtr, (HWND)hWnd); | 
 |  |  |    } | 
 |  |  |  | 
 |  |  | public: | 
 |  |  |    int OnRetrieve() | 
 |  |  |    { | 
 |  |  |       xstring username = publiccode::GetUser()->name; | 
 |  |  |       xstring username = publiccode::GetUser().name; | 
 |  |  |       if (username != L"admin" && m_Dir != username) | 
 |  |  |       { | 
 |  |  |          bupdate = false; | 
 |  |  | 
 |  |  |          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(); | 
 |  |  |          //xstring sFile = m_filePath + sguid+L".xsl"; | 
 |  |  |          xstring sFile = ele.selectSingleNode(L"urlPath").text(); | 
 |  |  |          if (sFile.left(1) == L"/") | 
 |  |  |          { | 
 |  |  |             sFile = L"/business/rpttemplate" + sFile; | 
 |  |  |          }else | 
 |  |  |             sFile = m_filePath + sFile; | 
 |  |  |  | 
 |  |  |          arg_param.AddArg(L"xsl", sFile); | 
 |  |  |          arg_param.AddArg(L"return", L"cancel"); | 
 |  |  |  | 
 |  |  | 
 |  |  |       } | 
 |  |  |       xstring sguid = publiccode::GetGuid(); | 
 |  |  |       xstring sname = sguid + L".xsl"; | 
 |  |  |       xstring suri = L"rpttemplate\\" + m_EntityName; //rpttemplate\SO | 
 |  |  |       xstring entityName = m_EntityName; | 
 |  |  |       xstring entitys = L",CD,GDN3,PO,PurchaseOrder,Quote,Quote1,SaleOrder,VATNotify,"; | 
 |  |  |       if(entitys.find(entityName) < 0) | 
 |  |  |          entityName = L"SaleOrder"; | 
 |  |  |       xstring suri = L"rpttemplate\\" + entityName; //rpttemplate\SO | 
 |  |  |       //suri = L"supplier00"; | 
 |  |  |       xstring ret = xaserver::UploadFile(suri, sname, GetHWND(), L"", false); | 
 |  |  |       if (ret == L"-1") | 
 |  |  | 
 |  |  |          args.AddArg(L"sEntity", m_EntityName); | 
 |  |  |          args.AddArg(L"sDir", m_Dir); | 
 |  |  |          args.AddArg(L"urlPath", sname); | 
 |  |  |          if (entityName != m_EntityName) | 
 |  |  |             args.AddArg(L"urlPath", L"/SaleOrder/" + sname); | 
 |  |  |          else | 
 |  |  |             args.AddArg(L"urlPath", sname); | 
 |  |  |  | 
 |  |  |          //alert(m_Dir); | 
 |  |  |          while (ret.find(L"\\", 0) >= 0) | 
 |  |  |             ret = ret.mid(ret.find(L"\\", 0) + 1, 9999); | 
 |  |  | 
 |  |  |          xstring sTemplName = ele.selectSingleNode(L"TemplName").text(); | 
 |  |  |          //xstring sFile = m_filePath + sguid+L".xsl";    | 
 |  |  |          trace(sTemplName); | 
 |  |  |          xstring sFile = m_filePath + ele.selectSingleNode(L"urlPath").text(); | 
 |  |  |          xstring sFile = ele.selectSingleNode(L"urlPath").text(); | 
 |  |  |          if (sFile.left(1) == L"/") | 
 |  |  |          { | 
 |  |  |             sFile = L"/business/rpttemplate" + sFile; | 
 |  |  |          } | 
 |  |  |          else | 
 |  |  |             sFile = m_filePath + sFile; | 
 |  |  |  | 
 |  |  |          arg_param.AddArg(L"xsl", sFile); | 
 |  |  |          arg_param.AddArg(L"return", L"ok"); | 
 |  |  |          arg_param.AddArg(L"template-name", sTemplName); | 
 |  |  | 
 |  |  |       dw_list.DwUpdateAllToEx(x); | 
 |  |  |  | 
 |  |  |       xaserverarg arg; | 
 |  |  |       arg.setNativePointer(xaserverarg::CreateInstance()); | 
 |  |  | 		 | 
 |  |  |       arg.AddArg(L"content", x.xml()); | 
 |  |  |  | 
 |  |  |       if (xurl::get(L"/sale/data/SysPrintTemplate/updateinfo", arg.GetString(), x) != 1) | 
 |  |  | 
 |  |  |  | 
 |  |  |    int SetAgent() | 
 |  |  |    { | 
 |  |  |       PUser& puser = *publiccode::GetUser(); | 
 |  |  |       PUser& puser = publiccode::GetUser(); | 
 |  |  |       xstring susername = puser.name; | 
 |  |  |       if (susername != L"admin") | 
 |  |  |       { | 
 |  |  | 
 |  |  |  | 
 |  |  |    int CreateDir() | 
 |  |  |    { | 
 |  |  |       PUser& puser = *publiccode::GetUser(); | 
 |  |  |       PUser& puser = publiccode::GetUser(); | 
 |  |  |       xstring susername = puser.name; | 
 |  |  |       xml x; | 
 |  |  |  | 
 |  |  |       xaserverarg arg; | 
 |  |  |       arg.setNativePointer(arg.CreateInstance()); | 
 |  |  | 		 | 
 |  |  |       arg.AddArg(L"EntityName", m_EntityName, L""); | 
 |  |  |       arg.AddArg(L"EntityID", m_EntityID, L""); | 
 |  |  |       arg.AddArg(L"susername", susername, L""); // | 
 |  |  | 
 |  |  |       int i; | 
 |  |  |       int nlen = nlist.length(); | 
 |  |  |       xstring toolStr = L"<vbox name='Dir'>"; | 
 |  |  |       xstring deptName = publiccode::GetUser()->deptname; | 
 |  |  |       if (deptName == L"跟单部" && m_EntityName == L"GDN3") { | 
 |  |  |       xstring deptName = publiccode::GetUser().deptname; | 
 |  |  |       if (deptName == L"订单操作部" && m_EntityName == L"GDN3") { | 
 |  |  |          for (i = 2; i < nlen; i++) | 
 |  |  |          { | 
 |  |  |             KXMLDOMElement e1 = nlist.item(i); | 
 |  |  | 
 |  |  |          m_EntityNo = arg_param.GetArgString(L"EntityNo"); | 
 |  |  |  | 
 |  |  |          xaserverarg arg; | 
 |  |  |          arg.setNativePointer(xaserverarg::CreateInstance()); | 
 |  |  |          arg.AddArg(L"EntityName", m_EntityName); | 
 |  |  |          arg.AddArg(L"EntityID", m_EntityID); | 
 |  |  |          arg.AddArg(L"EntityNo", m_EntityNo); | 
 |  |  |          xml x = new xml; | 
 |  |  |          xml x ; | 
 |  |  |  | 
 |  |  |          if (xurl::get(L"/sale/data/DocumentList3/bill/doclist", arg.GetString(), x) != 1) | 
 |  |  |          { | 
 |  |  | 
 |  |  |       } | 
 |  |  |       else | 
 |  |  |       { | 
 |  |  |          arg_param.setNativePointer(arg_param.CreateInstance()); | 
 |  |  | 			 | 
 |  |  |          m_EntityName = L"SO"; | 
 |  |  |          m_EntityID = L"00000000-0000-0000-0000-000000000000"; | 
 |  |  |       } | 
 |  |  | 
 |  |  |    { | 
 |  |  |       SetArg(); | 
 |  |  |       responsewin::onload(); | 
 |  |  |  | 
 |  |  |       /*if (GetParam()) | 
 |  |  |       { | 
 |  |  |          xstring action = arg_param.GetArgString(L"action"); |