jrj/ext-jrj/ext-jrj.vcxproj | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
jrj/ext-jrj/ext-jrj.vcxproj.filters | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
jrj/project/business/SystemSettings/Commentary.dialog.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
jrj/project/business/SystemSettings/CommentaryEx.dialog.cpp | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
jrj/ext-jrj/ext-jrj.vcxproj
@@ -1044,6 +1044,12 @@ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> </ClCompile> <ClCompile Include="..\project\business\SystemSettings\Commentary.dialog.cpp"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> </ClCompile> <ClCompile Include="..\project\business\SystemSettings\CommentaryEx.dialog.cpp"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> </ClCompile> <ClCompile Include="..\project\business\SystemSettings\Data.config.cpp"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> jrj/ext-jrj/ext-jrj.vcxproj.filters
@@ -1604,6 +1604,12 @@ <ClCompile Include="..\project\business\Expense\PremiumRateList.cpp"> <Filter>project\business\Expense</Filter> </ClCompile> <ClCompile Include="..\project\business\SystemSettings\Commentary.dialog.cpp"> <Filter>project\business\SystemSettings</Filter> </ClCompile> <ClCompile Include="..\project\business\SystemSettings\CommentaryEx.dialog.cpp"> <Filter>project\business\SystemSettings</Filter> </ClCompile> </ItemGroup> <ItemGroup> <None Include="ext-jrj.def"> jrj/project/business/SystemSettings/Commentary.dialog.cpp
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,269 @@ #include <wobject/xstring.hpp> #include <xcontrol/xtreeview.hpp> #include <xcontrol/xdwgrid.hpp> #include <wobject/xdouble.hpp> #include <xcontrol/xlayersheet.hpp> #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" #include "viewobject/view.base.hpp" using xml = KXMLDOMDocument; class __declspec(dllexport) Commentary : public xframe { public: string m_EntityID; string m_EntityType; string m_EntityConnect; string m_ConnectID; control__ m_Edit; html__ m_Html; combobox__ m_cb; public: BindComputerDlgNew(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} public: static BindComputerDlgNew* CreateInstance(void* implPtr, void* hWnd) { BindComputerDlgNew* pWin = new BindComputerDlgNew(implPtr, (HWND)hWnd); return pWin; } string GetGuid() { return TApp::GetGuid(); } int Init() { if (m_EntityID == "") return -1; xml__ x = new xml__; x.setNativePointer(x.CreateInstance()); xaserverarg__ arg = new xaserverarg__; arg.setNativePointer(arg.CreateInstance()); arg.AddArg("EntityID", m_EntityID); arg.AddArg("EntityType", m_EntityType); arg.AddArg("EntityConnect", m_EntityConnect); if (url::get("/sale/data/Commentary/entity/notelist", arg.GetString(), x) == 1) { //trace(x.GetXml()); m_Html.SetContent(x.GetXml()); m_Html.Redraw(); } return 1; } int AppendItem(xml__ x, msxml::IXMLDOMElement r, string name, string value) { var e = x.GetXmlDoc().createElement(name); e.text = value; r.appendChild(e); return 1; } int showAtt() { xnode__ anode = new xnode__; anode.setNativePointer(GetAgentNode("att")); int s = combobox__::GetCount(m_cb.GetId()); xml__ x = new xml__; x.setNativePointer(xml__::CreateInstance()); x.LoadXml("<vbox/>"); msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement; //trace(str); int i = 0; for (i = 0; i < s; i++) { string tmp = combobox__::GetLBText(m_cb.GetId(), i); //trace(tmp); var e = x.GetXmlDoc().createElement("hbox"); e.setAttribute("height", "20"); var l = x.GetXmlDoc().createElement("xlabel"); l.setAttribute("caption", "" + tmp); var b = x.GetXmlDoc().createElement("xtoolbutton"); b.setAttribute("width", "18"); b.setAttribute("name", "att_" + i.toString()); b.setAttribute("image", "1,5"); e.appendChild(l); e.appendChild(b); ele.appendChild(e); var g = x.GetXmlDoc().createElement("xlabel"); g.setAttribute("height", "2"); g.setAttribute("style", "background-color:#000000"); ele.appendChild(g); } //trace(ele.xml); SetAgentNodeContent(anode, ele.xml); anode.SetWidthHeight(-1, i * 20 + 1); return 1; } int addAtt() { string guid = TApp::GetGuid(); string ret = xaserver__::UploadFile("attachment", guid + ".jpg", this.GetHWND(), "", false); //trace(ret); int nIndex = combobox__::AddItem(m_cb.GetId(), ret, guid + ".jpg"); showAtt(); return 1; } int delAtt(string no) { int nIndex = no.toInt(); combobox__::DeleteItem(m_cb.GetId(), nIndex); showAtt(); return 1; } msxml::IXMLDOMElement getAtt() { int s = combobox__::GetCount(m_cb.GetId()); xml__ x = new xml__; x.setNativePointer(xml__::CreateInstance()); x.LoadXml("<Attachment/>"); msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement; //trace(str); int i = 0; for (i = 0; i < s; i++) { string tmp = combobox__::GetLBText(m_cb.GetId(), i); string tmp2 = combobox__::GetitemData(m_cb.GetId(), i); var e = x.GetXmlDoc().createElement("item"); e.setAttribute("name", "" + tmp); e.setAttribute("file", "" + tmp2); ele.appendChild(e); } return ele; } //å½ä»¤åå¸å½æ° int OnCmdDispatch(string comdid) { if (comdid == "xmOK") { if (m_EntityID == "") return 1; xml__ x = new xml__; x.setNativePointer(xml__::CreateInstance()); xaserverarg__ arg = new xaserverarg__; arg.setNativePointer(arg.CreateInstance()); string value = m_Edit.GetText(); if (value == "") { alert("è¯·å¡«åæ¹æ³¨ï¼"); return 1; } x.LoadXml("<Commentary update.new='1' update.modify='1'/>"); msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement; AppendItem(x, ele, "CommentaryID", GetGuid()); AppendItem(x, ele, "EntityID", m_EntityID); AppendItem(x, ele, "EntityType", m_EntityType); AppendItem(x, ele, "Remark", value); AppendItem(x, ele, "ParentConnect", m_EntityConnect); AppendItem(x, ele, "ParentCommentaryID", m_ConnectID); AppendItem(x, ele, "CreatorID", xaserver__::GetUserId()); ele.appendChild(getAtt()); //trace(ele.xml); arg.AddArg("content", "<root>" + ele.xml + "</root>"); if (getUrl("/workflow/action/Commentary/bill.update", arg.GetString(), x) == 1) { //trace(x.GetXml()); //alert("æ·»å æå!"); m_Edit.SetText(""); combobox__::ResetContent(m_cb.GetId()); Init(); showAtt(); return 1; } else { alert("æ·»å 失败!"); return -1; } } else if (comdid == "xmAtt") { addAtt(); } else if (comdid.left(4) == "att_") { delAtt(comdid.right(comdid.length() - 4)); } else { CloseWindow(); } return 1; } //å½ä»¤å¤çäºä»¶ int OnXCommand(ref TXCommandEvent evt, int param) { return OnCmdDispatch(evt.pStrID); } int OnHtmlClick(ref TNotifyEvent evt, int p) { ref HTMLNMHDR p = evt.pnmh; const string d = m_Html.GetData(p.object); if (d == "") return -1; string file = d.mid(0, d.find("|##@@|", 0)); string name = d.mid(d.find("|##@@|", 0) + 6, d.length()); xaserver__::CreateDirectory("C:/Temp"); int openRet = xaserver__::DownLoadFile(GetServerUrl(), "/business/supplierattachment/" + file, name, "C:/Temp/" + name); if (openRet < 0) { alert("æä»¶æå¼å¤±è´¥ï¼"); return -1; } openRet = win__::ShellExecute(0, "open", "C:/Temp/" + name, "", "", 5); if (openRet < 32) { alert("æä»¶æå¼å¤±è´¥2ï¼"); return -1; } return -1; } int OnAttachEvent() { //ç»å®å·¥å ·æ¡ç¹å»äºä»¶ AttachEvent("WM_XCOMMAND", OnXCommand); AttachEvent("note", "HTC_OBJECTCLICKED", OnHtmlClick); } int onload() { OnAttachEvent(); m_Edit = new control__; m_Edit.setNativePointer(GetControl("Txt")); m_Html = new html__; m_Html.setNativePointer(GetControl("note")); m_cb = new html__; m_cb.setNativePointer(GetControl("attlist")); m_EntityID = ""; m_EntityType = ""; m_EntityConnect = ""; m_ConnectID = ""; if (this.GetParam()) { xaserverarg__ arg = this.GetParam(); m_EntityID = arg.GetArgString("EntityID"); m_EntityType = arg.GetArgString("m_EntityType"); m_EntityConnect = arg.GetArgString("m_EntityConnect"); } Init(); return 1; } ] ] ] jrj/project/business/SystemSettings/CommentaryEx.dialog.cpp
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,250 @@ use "xcontrol.vframe.vbusiness.vd" use "xbase.vframe.vbusiness.vd" use "publiccode.vutil.vbusiness.vd" unit business [ class CommentaryEx : public xframe { string m_EntityID; string m_EntityType; string m_EntityConnect; string m_ConnectID; xcontrol m_Edit; htmlctrl m_Html; xcombobox m_cb; int Init() { if (m_EntityID == "") return -1; xml x = new xml; x.setNativePointer(x.CreateInstance()); xaserverarg arg = new xaserverarg; arg.setNativePointer(arg.CreateInstance()); arg.AddArg("EntityID", m_EntityID); arg.AddArg("EntityType", m_EntityType); arg.AddArg("EntityConnect", m_EntityConnect); if (url::get("/sale/data/Commentary/entity/notelist", arg.GetString(), x) == 1) { m_Html.SetContent(x.GetXml()); m_Html.Redraw(); } return 1; } int AppendItem(xml x, msxml::IXMLDOMElement r, string name, string value) { msxml::IXMLDOMElement e = x.GetXmlDoc().createElement(name); e.text = value; r.appendChild(e); return 1; } int showAtt() { xnode anode = GetAgentNode("att"); int s = xcombobox::GetCount(m_cb.GetId()); xml x = new xml; x.setNativePointer(xml::CreateInstance()); x.LoadXml("<vbox/>"); msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement; int i = 0; for (i = 0; i < s; i++) { string tmp = xcombobox::GetLBText(m_cb.GetId(), i); msxml::IXMLDOMElement e = x.GetXmlDoc().createElement("hbox"); e.setAttribute("height", "20"); msxml::IXMLDOMElement l = x.GetXmlDoc().createElement("xlabel"); l.setAttribute("caption", "" + tmp); msxml::IXMLDOMElement b = x.GetXmlDoc().createElement("xtoolbutton"); b.setAttribute("width", "18"); b.setAttribute("name", "att_" + i.toString()); b.setAttribute("image", "1,5"); e.appendChild(l); e.appendChild(b); ele.appendChild(e); msxml::IXMLDOMElement g = x.GetXmlDoc().createElement("xlabel"); g.setAttribute("height", "2"); g.setAttribute("style", "background-color:#000000"); ele.appendChild(g); } SetAgentNodeContent(anode, ele.xml); anode.SetWidthHeight(-1, i * 20 + 1); return 1; } int addAtt() { string guid = publiccode::GetGuid(); string str = guid.left(2); string ret = xaserver::UploadFile("attachment" + str, guid + ".jpg", this.GetHWND(), "", false); int nIndex = xcombobox::AddItem(m_cb.GetId(), ret, guid + ".jpg"); showAtt(); return 1; } int delAtt(string no) { int nIndex = no.toInt(); xcombobox::DeleteItem(m_cb.GetId(), nIndex); showAtt(); return 1; } msxml::IXMLDOMElement getAtt() { int s = xcombobox::GetCount(m_cb.GetId()); xml x = new xml; x.setNativePointer(xml::CreateInstance()); x.LoadXml("<Attachment/>"); msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement; int i = 0; for (i = 0; i < s; i++) { string tmp = xcombobox::GetLBText(m_cb.GetId(), i); string tmp2 = xcombobox::GetItemData(m_cb.GetId(), i); msxml::IXMLDOMElement e = x.GetXmlDoc().createElement("item"); e.setAttribute("name", "" + tmp); e.setAttribute("file", "" + tmp2); ele.appendChild(e); } return ele; } //å½ä»¤åå¸å½æ° int OnCmdDispatch(string comdid) { if (comdid == "xmOK") { if (m_EntityID == "") return 1; xml x = new xml; x.setNativePointer(xml::CreateInstance()); xaserverarg arg = new xaserverarg; arg.setNativePointer(arg.CreateInstance()); string value = m_Edit.GetText(); if (value == "") { alert("è¯·å¡«åæ¹æ³¨ï¼"); return 1; } x.LoadXml("<Commentary update.new='1' update.modify='1'/>"); msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement; AppendItem(x, ele, "CommentaryID", publiccode::GetGuid()); AppendItem(x, ele, "EntityID", m_EntityID); AppendItem(x, ele, "EntityType", m_EntityType); AppendItem(x, ele, "Remark", value); AppendItem(x, ele, "ParentConnect", m_EntityConnect); AppendItem(x, ele, "ParentCommentaryID", m_ConnectID); AppendItem(x, ele, "CreatorID", xaserver::GetUserId()); ele.appendChild(getAtt()); arg.AddArg("content", "<root>" + ele.xml + "</root>"); if (getUrl("/workflow/action/Commentary/bill.update", arg.GetString(), x) == 1) { m_Edit.SetText(""); xcombobox::ResetContent(m_cb.GetId()); Init(); showAtt(); return 1; } else { alert("æ·»å 失败!"); return -1; } } else if (comdid == "xmAtt") { addAtt(); } else if (comdid.left(4) == "att_") { delAtt(comdid.right(comdid.length() - 4)); } else { CloseWindow(); } return 1; } //å½ä»¤å¤çäºä»¶ int OnXCommand(ref TXCommandEvent evt, int param) { return OnCmdDispatch(evt.pStrID); } int OnHtmlClick(ref TNotifyEvent evt, int pr) { ref HTMLNMHDR p = evt.pnmh; const string d = m_Html.GetData(p.object); if (d == "") return -1; string file = d.mid(0, d.find("|##@@|", 0)); string name = d.mid(d.find("|##@@|", 0) + 6, d.length()); xaserver::CreateDirectory("C:/Temp"); string str = file.left(2); string ext = ""; if (name.find(".") >= 0) ext = name.mid(name.find("."), name.length()); string sfile = file.left(file.length() - 4); //trace("--"+ext +" " + "/business/attachment/"+str+"/"+ file); //int openRet = xaserver::DownLoadFile(GetServerUrl(),"/business/attachment/"+str+"/"+ file,name,"C:/Temp/"+name); int openRet = xaserver::DownLoadFile(GetServerUrl(), "/business/attachment/" + str + "/" + file, "", "C:/Temp/" + sfile + ext); if (openRet < 0) { alert("æä»¶æå¼å¤±è´¥1ï¼"); return -1; } //openRet = win32::ShellExecute(0,"open","C:/Temp/"+name,"","",5); openRet = win32::ShellExecute(0, "open", "C:/Temp/" + sfile + ext, "", "", 5); if (openRet < 32) { alert("æä»¶æå¼å¤±è´¥2ï¼"); return -1; } return -1; } int OnAttachEvent() { //ç»å®å·¥å ·æ¡ç¹å»äºä»¶ AttachEvent("WM_XCOMMAND", OnXCommand); AttachEvent("note", "HTC_OBJECTCLICKED", OnHtmlClick); } int onload() { OnAttachEvent(); m_Edit = GetControl("Txt"); m_Html = GetControl("note"); m_cb = GetControl("attlist"); m_EntityID = ""; m_EntityType = ""; m_EntityConnect = ""; m_ConnectID = ""; if (this.GetParam()) { //xaserverarg arg = new xaserverarg; //arg.setNativePointer(GetParam()); xaserverarg arg = GetParam(); m_EntityID = arg.GetArgString("EntityID"); m_EntityType = arg.GetArgString("m_EntityType"); m_EntityConnect = arg.GetArgString("m_EntityConnect"); } Init(); return 1; } }; ]