Merge branch 'master' of http://116.62.18.175:6699/r/mis-prj
| | |
| | | <ClCompile Include="..\project\business\AR\maint.SettlementExchange.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\CompanyList.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\CompanyMaint.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrEmployee.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrEmployeeAdd.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrEmployeex.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrJob.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrOrg.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrOrgChart.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrOrgMaint.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrOrgType.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HRPerson.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrPersonAdd.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrPersonMaint.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrPersonSel.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrPosition.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrPositionAdd.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HR_Address.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Customer3.list.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | </ClCompile> |
| | |
| | | <ClCompile Include="..\project\business\GDN3.maint.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\GDN\AdvanceChargeList.cpp" /> |
| | | <ClCompile Include="..\project\business\GDN\CustomCodeNew.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\GDN\GDNDelay.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | </ClCompile> |
| | |
| | | <ClCompile Include="..\project\business\GDN\GDNSourcePriceMaint.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\GDN\list.SOTrace3.cpp" /> |
| | | <ClCompile Include="..\project\business\GDN\po.paper.cpp" /> |
| | | <ClCompile Include="..\project\business\GDN\select.item.po.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> |
| | |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\GDN\tracer.so.cpp" /> |
| | | <ClCompile Include="..\project\business\HR\AdministrativeDepartment.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild> |
| | |
| | | <Filter Include="project\business\ProductSample"> |
| | | <UniqueIdentifier>{4e706812-0c60-49af-ae6c-3f9e18a2cd65}</UniqueIdentifier> |
| | | </Filter> |
| | | <Filter Include="project\business\Company"> |
| | | <UniqueIdentifier>{84413ffb-b8a4-4dfe-a715-ef03dec8f2ef}</UniqueIdentifier> |
| | | </Filter> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClInclude Include="framework.h"> |
| | |
| | | <ClCompile Include="..\project\analysis\DataVanalysisWin.cpp"> |
| | | <Filter>vbusiness\analysis</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\total3\ViewExTotalWin.cpp"> |
| | | <Filter>vbusiness\total</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\tradedocument\DocFileSaveDlg.cpp"> |
| | | <Filter>vbusiness\tradedocument</Filter> |
| | | </ClCompile> |
| | |
| | | <ClCompile Include="..\project\total3\viewex.total2.cpp"> |
| | | <Filter>vbusiness\total</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\GDN\CustomCodeNew.cpp"> |
| | | <Filter>project\business\GDN</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\GDN\po.paper.cpp"> |
| | | <Filter>project\business\GDN</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\GDN\tracer.so.cpp"> |
| | | <Filter>project\business\GDN</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\GDN\AdvanceChargeList.cpp"> |
| | | <Filter>project\business\AP</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\GDN\list.SOTrace3.cpp"> |
| | | <Filter>project\business\SO</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\CompanyList.cpp"> |
| | | <Filter>project\business\Company</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\CompanyMaint.cpp"> |
| | | <Filter>project\business\Company</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HR_Address.cpp"> |
| | | <Filter>project\business\Company</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrEmployee.cpp"> |
| | | <Filter>project\business\Company</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrEmployeeAdd.cpp"> |
| | | <Filter>project\business\Company</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrEmployeex.cpp"> |
| | | <Filter>project\business\Company</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrJob.cpp"> |
| | | <Filter>project\business\Company</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrOrg.cpp"> |
| | | <Filter>project\business\Company</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrOrgChart.cpp"> |
| | | <Filter>project\business\Company</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrOrgMaint.cpp"> |
| | | <Filter>project\business\Company</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrOrgType.cpp"> |
| | | <Filter>project\business\Company</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HRPerson.cpp"> |
| | | <Filter>project\business\Company</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrPersonAdd.cpp"> |
| | | <Filter>project\business\Company</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrPersonMaint.cpp"> |
| | | <Filter>project\business\Company</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrPersonSel.cpp"> |
| | | <Filter>project\business\Company</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrPosition.cpp"> |
| | | <Filter>project\business\Company</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Company\HrPositionAdd.cpp"> |
| | | <Filter>project\business\Company</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\total3\ViewTotalWin.cpp"> |
| | | <Filter>vbusiness\total</Filter> |
| | | </ClCompile> |
| | | </ItemGroup> |
| | | </Project> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "treeview.vm" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "list.vl" |
| | | unit vbusiness.xpage |
| | | [ |
| | | CompanyList is extend list; |
| | | about CompanyList |
| | | [ |
| | | control: |
| | | |
| | | method: |
| | | [ |
| | | xdwgrid__ dw_list; |
| | | string m_agentCond; //Agent Node |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | if (agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent(anode, s); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt, int p) |
| | | { |
| | | SetAgent(); |
| | | |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | //arg.AddArg("sType",c_type); |
| | | if (url::get("OrganizationStruct/list.CompanyInfo", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | //trace(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | dw_list.SetReadOnly(true); |
| | | return 1; |
| | | } |
| | | |
| | | //xgridexåå» |
| | | int OnDoubleClicked(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int row = hdr.row; |
| | | if (row < 1 || row > dw_list.GetRowCount()) |
| | | return 1; |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sguid = e.SelectSingleNode("@guid").text; |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("operate", "modify"); |
| | | arg.AddArg("guid", sguid); |
| | | //trace(sguid); |
| | | //trace(row.toString()); |
| | | //win__::OpenWindow("dev:xpage[CompanyMaint.vx]",arg); |
| | | openUrl("ç»ç»æ¶æ.vface/xpage/CompanyInfo/maint", arg); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | msxml::IXMLDOMElement e; |
| | | string sguid; |
| | | string sName; |
| | | |
| | | if (comdid == "AddRow") |
| | | { |
| | | arg.AddArg("operate", "new0"); |
| | | arg.AddArg("guid", ""); |
| | | //win__::OpenWindow("dev:xpage[CompanyMaint.vx]",arg); |
| | | openUrl("ç»ç»æ¶æ.vface/xpage/CompanyInfo/maint", arg); |
| | | } |
| | | else if (comdid == "ModifyRow") |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | win__::MessageBox(GetHWND(), "请éä¸è¦ä¿®æ¹çå
¬å¸è¡ï¼", "æç¤º", 0); |
| | | return -1; |
| | | } |
| | | } |
| | | e = dw_list.GetRowElement(row); |
| | | sguid = e.SelectSingleNode("@guid").text; |
| | | arg.AddArg("operate", "modify"); |
| | | arg.AddArg("guid", sguid); |
| | | //win__::OpenWindow("dev:xpage[CompanyMaint.vx]",arg); |
| | | openUrl("ç»ç»æ¶æ.vface/xpage/CompanyInfo/maint", arg); |
| | | } |
| | | else if (comdid == "DeleteRow") |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | win__::MessageBox(GetHWND(), "请éä¸è¦å é¤çå
¬å¸è¡ï¼", "æç¤º", 0); |
| | | return -1; |
| | | } |
| | | } |
| | | e = dw_list.GetRowElement(row); |
| | | |
| | | sguid = e.SelectSingleNode("@guid").text; |
| | | sName = e.selectSingleNode("Name").text; |
| | | |
| | | sName += ""; |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (win__::MessageBox(GetHWND(), "确认è¦å é¤å
¬å¸ " + sName + " çä¿¡æ¯åï¼", "æç¤º", MB_YESNO) != IDYES) return 1; |
| | | arg.AddArg("guid", sguid); |
| | | trace(sguid); |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("OrganizationStruct/delete.CompanyInfo", arg.GetString(), x1) != 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | win__::MessageBox(GetHWND(), "å 餿åï¼", "æç¤º", 0); |
| | | dw_list.DeleteRow(row); |
| | | } |
| | | |
| | | } |
| | | else if (comdid == "Refresh") |
| | | { |
| | | OnRetrieve(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | //åå» |
| | | AttachEvent("dw_list", "DWV_DOUBLECLICKED", OnDoubleClicked); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | |
| | | //xaserverarg__ args = new xaserverarg__; |
| | | //args.setNativePointer(args.CreateInstance()); |
| | | //args.AddArg("type","CompanyList"); |
| | | //dw_list.SetDataObject(GetServerUrl(),pref::getPref("HumanResource/GetHrObject",args.GetString())); |
| | | dw_list.openUrl("ç»ç»æ¶æ.vface/template/company/list"); |
| | | dw_list.SetSelectionMode(1); |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | OnInitial(); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | ] |
| | | |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "treeview.vm" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "dev:vm[pagecontrol.vm]" |
| | | use "maint.vl" |
| | | use "publiccode.vl" |
| | | |
| | | unit vbusiness.xpage |
| | | [ |
| | | CompanyMaint is extend maint; |
| | | about CompanyMaint |
| | | [ |
| | | control: |
| | | |
| | | method: |
| | | [ |
| | | pagecontrol__ m_layer; |
| | | xdwtable__ dw_detail; |
| | | xdwtable__ dw_bank; |
| | | string m_operate; |
| | | string m_sguid; |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | if (agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent(anode, s); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt, int param) |
| | | { |
| | | SetAgent(); |
| | | |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | int OnPreSave() |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_detail.FindDwTable("CompanyInfo", 0)); |
| | | string sPartyNo = dw.GetItemString(1, "PartyNo", 0); |
| | | if (sPartyNo == "" || sPartyNo == nil) |
| | | { |
| | | string sGetNo = publiccode::GetIdentityNo(""); |
| | | dw.SetItemString(1, "PartyNo", sGetNo); |
| | | //alert("å
¬å¸ç¼å·ä¸ºç©ºï¼"); |
| | | //return -1; |
| | | } |
| | | string sPartyName = dw.GetItemString(1, "Name", 0); |
| | | if (sPartyName == "" || sPartyName == nil) |
| | | { |
| | | alert("å
¬å¸å称为空ï¼"); |
| | | return -1; |
| | | } |
| | | |
| | | string suserid = publiccode::GetUserInfo().id; |
| | | string sdate = publiccode::GetCurDate(); |
| | | dw.SetItemString(1, "ModifierID", suserid); |
| | | dw.SetItemString(1, "ModifyDate", sdate); |
| | | |
| | | dw.setNativePointer(dw_bank.FindDwTable("item", 0)); |
| | | if (dw) |
| | | { |
| | | string sno; |
| | | string sname, |
| | | string status; |
| | | int i; |
| | | int row = dw.GetRowCount(); |
| | | for (i = 1; i <= row; i++) |
| | | { |
| | | status = dw.GetItemString(i, "Status", 0) + ""; |
| | | if (status == "" || status == nil) |
| | | { |
| | | dw.SetItemString(i, "Status", "Y"); |
| | | //alert("第"+i.toString()+"è¡ç¶æä¸ºç©º"); |
| | | //return -1; |
| | | } |
| | | /* |
| | | sno=dw.GetItemString(i,"BankAccountNo",0)+""; |
| | | sname=dw.GetItemString(i,"BankName",0)+""; |
| | | status=dw.GetItemString(i,"Status",0)+""; |
| | | if (sno=="" || sno==nil) |
| | | { |
| | | if(sname !="" && sname != nil) |
| | | { |
| | | alert("第"+i.toString()+"è¡é¶è¡ç¼å·ä¸ºç©º"); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | if (sname=="" || sname==nil) |
| | | { |
| | | if(sno !="" && sno != nil) |
| | | { |
| | | alert("第"+i.toString()+"è¡é¶è¡å称为空"); |
| | | return -1; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (status=="" || status==nil) |
| | | { |
| | | dw.SetItemString(i,"Status","Y"); |
| | | //alert("第"+i.toString()+"è¡ç¶æä¸ºç©º"); |
| | | //return -1; |
| | | } |
| | | } |
| | | */ |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | dw_detail.AcceptText(); |
| | | dw_bank.AcceptText(); |
| | | int rec; |
| | | rec = OnPreSave(); |
| | | if (rec == -1) |
| | | return -1; |
| | | |
| | | int hIcon = xutil__::SetCursorWait(); |
| | | |
| | | string val, val2; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | var xdoc = x.GetXmlDoc(); |
| | | dw_detail.DwUpdateAllTo(xdoc); |
| | | //val = xdoc.xml ; |
| | | dw_bank.DwUpdateAllTo(xdoc); |
| | | val = xdoc.xml; |
| | | trace(val); |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("content", val); |
| | | args.AddArg("dbmap", "CompanyInfo.dbmap"); |
| | | //trace(m_EntityValueEx); |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("OrganizationStruct/update.companyinfoex", args.GetString(), x1) != 1) |
| | | //if (xaserver__::ExecXAction("","[update.CompanyInfoEx.xa]",args.GetString(),x1) !=1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | trace(x1.GetXml()); |
| | | if (x1.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert("ä¿ååºé2!"); |
| | | return 0; |
| | | } |
| | | win__::MessageBox(GetHWND(), "ä¿åæåï¼", "æç¤º", 0); |
| | | } |
| | | xutil__::RestoreCursor(hIcon); |
| | | dw_detail.ResetUpdateStatus(); |
| | | dw_bank.ResetUpdateStatus(); |
| | | var xdoc2 = x.GetXmlDoc(); |
| | | dw_detail.DwUpdateAllTo(xdoc2); |
| | | val = xdoc.xml; |
| | | trace(val); |
| | | return 1; |
| | | } |
| | | |
| | | int OnItemChanged(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR dwhdr = evt.pnmh; |
| | | int row = dwhdr.row; |
| | | string col = dwhdr.colname; |
| | | string data = dwhdr.data; |
| | | if (col == "Name") |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("Name", data); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnChildContent(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR dwhdr = evt.pnmh; |
| | | string col = dwhdr.colname; |
| | | if (col != "") { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | string query; |
| | | query = "[IResourceMSSql.xq]"; |
| | | if (col == "TradeType") { |
| | | arg.AddArg("ResourceType", "TradeType");//è´¸ææ¹å¼ |
| | | } |
| | | if (xaserver__::ExecXQuery(GetServerUrl(), query, arg.GetString(), x) == 1) |
| | | dwhdr.data = x.GetXml(); |
| | | //trace(x.GetXml()); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnAddRow() |
| | | { |
| | | int h = m_layer.GetSheetIndex(); |
| | | if (h == 1) |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_bank.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "item") |
| | | { |
| | | int row = dw.InsertRow(0); |
| | | dw.SetItemString(row, "Status", "Y"); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | int h = m_layer.GetSheetIndex(); |
| | | if (h == 1) |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_bank.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "item") |
| | | { |
| | | int row = dw.GetRow(); |
| | | int crow = dw.InsertRow(row); |
| | | dw.SetItemString(crow, "Status", "Y"); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int h = m_layer.GetSheetIndex(); |
| | | if (h == 1) |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_bank.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "item") |
| | | { |
| | | int row = dw.GetRow(); |
| | | dw.DeleteRow(row); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "Save") OnSave(); |
| | | else if (comdid == "AddRow") OnAddRow(); |
| | | else if (comdid == "InsertRow") OnInsertRow(); |
| | | else if (comdid == "DeleteRow") OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt, int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | //ä¸ææ¡ æä¾å
容 |
| | | AttachEvent("dw_detail", "DWV_CHILDCONTENT", OnChildContent); |
| | | AttachEvent("dw_detail", "DWV_ITEMCHANGED", OnItemChanged); |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid", m_sguid); |
| | | //trace(m_sguid); |
| | | //if (url::get("OrganizationStruct/detail.CompanyInfo",arg.GetString(),x) != 1) |
| | | if (url::post("OrganizationStruct/detail.CompanyInfo", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_detail.Retrieve(x); |
| | | dw_detail.Redraw(); |
| | | dw_bank.Retrieve(x); |
| | | dw_bank.Redraw(); |
| | | //trace(x.GetXml()); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = this.GetParam(); |
| | | if (arg) |
| | | { |
| | | m_operate = arg.GetArgString("operate"); |
| | | m_sguid = arg.GetArgString("guid"); |
| | | } |
| | | /*if ( m_sguid == "" || m_sguid == nil) |
| | | { |
| | | m_sguid = win__::GetGuid(); |
| | | trace(m_sguid); |
| | | }*/ |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | m_layer = new pagecontrol__; |
| | | m_layer.setNativePointer(this.GetControl("cTab")); |
| | | |
| | | dw_detail = new xdwtable__; |
| | | dw_detail.setNativePointer(this.GetControl("dw_detail")); |
| | | dw_detail.openUrl("ç»ç»æ¶æ.vface/template/company/detail"); |
| | | dw_detail.SetColHeaderHeight(0); |
| | | dw_detail.SetRowSelectorWidth(0); |
| | | dw_bank = new xdwtable__; |
| | | dw_bank.setNativePointer(this.GetControl("dw_bank")); |
| | | dw_bank.openUrl("ç»ç»æ¶æ.vface/template/company/bank"); |
| | | |
| | | OnInitial(); |
| | | if (m_sguid != "") { |
| | | OnRetrieve(); |
| | | } |
| | | else { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_detail.FindDwTable("CompanyInfo", 0)); |
| | | dw.SetItemString(1, "Status", "1"); |
| | | dw.SetItemString(1, "InternalFlag", "Y"); |
| | | dw.SetItemString(1, "Type", "0"); |
| | | string suserid = publiccode::GetUserInfo().id; |
| | | /*string susername = publiccode::GetUserInfo().name; |
| | | string sdate = publiccode::GetCurDate(); |
| | | dw.SetItemString(1,"CreatorID",suserid); |
| | | dw.SetItemDisplayString(1,"CreatorID",susername); |
| | | dw.SetItemString(1,"CreateDate",sdate);*/ |
| | | |
| | | dw.setNativePointer(dw_detail.FindDwTable("address", 0)); |
| | | dw.SetItemString(1, "IdentifyAddressFlag", "Y"); |
| | | dw.SetItemString(1, "Status", "1"); |
| | | dw.setNativePointer(dw_detail.FindDwTable("Regist", 0)); |
| | | dw.SetItemString(1, "IdentifyAddressFlag", "N"); |
| | | dw.SetItemString(1, "Status", "1"); |
| | | |
| | | dw.setNativePointer(dw_bank.FindDwTable("item", 0)); |
| | | if (dw) { |
| | | //msxml::IXMLDOMElement ele = dw.GetElement(); |
| | | //trace(ele.xml); |
| | | //dw.SetItemString(1,"Status","Y"); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | ] |
| | | |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "frame.vl" |
| | | //unit vclient.vobject tpp |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrPerson is extend frame; |
| | | about HrPerson |
| | | [ |
| | | control: |
| | | |
| | | method: |
| | | [ |
| | | xdwgrid__ dw_list; |
| | | xdwgrid__ dw_HrEmployee; |
| | | string m_sTxt; |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent (anode,s); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int p) |
| | | { |
| | | SetAgent(); |
| | | |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | //xgridexåå» |
| | | int OnDoubleClicked(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int row = hdr.row; |
| | | if(row < 1 || row > dw_list.GetRowCount()) |
| | | return 1; |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sguid = e.SelectSingleNode("@guid").text; |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("operate","modify"); |
| | | arg.AddArg("guid",sguid); |
| | | //trace(sguid); |
| | | //xwin::OpenWindow("dev:xpage[HrPersonMaint.xpage]",arg); |
| | | openUrl("ç»ç»æ¶æ.vface/xpage/Hr/HrPersonMaint", arg); |
| | | return 1; |
| | | } |
| | | //è¡æ¹å |
| | | int OnRowFocusChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int row = hdr.row; |
| | | if(row < 1 || row > dw_list.GetRowCount()) |
| | | return 1; |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sPersonID = e.SelectSingleNode("@guid").text; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid",sPersonID); |
| | | |
| | | if (url::get("OrganizationStruct/Person.HrEmployee",arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }else |
| | | { |
| | | dw_HrEmployee.Retrieve(x); |
| | | dw_HrEmployee.Redraw(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sTxt",m_sTxt); |
| | | if (url::get("OrganizationStruct/list.HrPerson",arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | // if (dw_list.GetRowCount() >0) |
| | | // OnRowFocusChanged(); |
| | | dw_list.SetReadOnly(true); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSearch() |
| | | { |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl("QueryTxt")); |
| | | m_sTxt= xc.GetText(); |
| | | OnRetrieve(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnUpdateAssignmentView() |
| | | { |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("OrganizationStruct/update.Assignmentview","",x1) != 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | trace(x1.GetXml()); |
| | | win__::MessageBox(GetHWND(),"æ´æ°æåï¼","æç¤º",0); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | msxml::IXMLDOMElement e; |
| | | string sPersonID; |
| | | string sName; |
| | | if (comdid =="AddPerson") |
| | | { |
| | | arg.AddArg("operate","new0"); |
| | | arg.AddArg("guid",""); |
| | | openUrl("ç»ç»æ¶æ.vface/xpage/Hr/HrPersonMaint", arg); |
| | | } |
| | | else if(comdid=="UpdateAssignmentView") |
| | | OnUpdateAssignmentView(); |
| | | else if (comdid =="ModifyPerson") |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | win__::MessageBox(GetHWND(),"请éä¸è¦ä¿®æ¹ç人åè¡ï¼","æç¤º",0); |
| | | return -1; |
| | | } |
| | | } |
| | | e = dw_list.GetRowElement(row); |
| | | sPersonID = e.SelectSingleNode("@guid").text; |
| | | arg.AddArg("operate","modify"); |
| | | arg.AddArg("guid",sPersonID); |
| | | openUrl("ç»ç»æ¶æ.vface/xpage/Hr/HrPersonMaint", arg); |
| | | } |
| | | else if (comdid =="DeletePerson") |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | win__::MessageBox(GetHWND(),"请éä¸è¦å é¤ç人åè¡ï¼","æç¤º",0); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | e = dw_list.GetRowElement(row); |
| | | sPersonID = e.SelectSingleNode("@guid").text; |
| | | sName = e.selectSingleNode("Name").text; |
| | | sName += ""; |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if(win__::MessageBox(GetHWND(),"确认è¦å é¤ "+sName+" çä¿¡æ¯åï¼","æç¤º",MB_YESNO)!=IDYES) return 1; |
| | | |
| | | |
| | | arg.AddArg("guid",sPersonID); |
| | | |
| | | |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("OrganizationStruct/delete.HrPerson",arg.GetString(),x1) != 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | //win32::MessageBox(GetHWND(),"å 餿åï¼","æç¤º",0); |
| | | dw_list.DeleteRow(row); |
| | | } |
| | | } |
| | | else if (comdid =="Refresh") |
| | | { |
| | | OnRetrieve(); |
| | | } |
| | | else if (comdid =="search" || comdid=="query") |
| | | { |
| | | OnSearch(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent("dw_list","DWV_CLICKED",OnRowFocusChanged); |
| | | AttachEvent("dw_list","DWV_DOUBLECLICKED",OnDoubleClicked); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | m_sTxt=""; |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | dw_list.openUrl("ç»ç»æ¶æ.vface/template/HrPerson/list"); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.SetSelectionMode(1); |
| | | |
| | | dw_HrEmployee = new xdwgrid__; |
| | | dw_HrEmployee.setNativePointer(this.GetControl("dw_HrEmployee")); |
| | | dw_HrEmployee.openUrl("ç»ç»æ¶æ.vface/template/HrPerson/listemp"); |
| | | //dw_HrEmployee.openUrl("ç»ç»æ¶æ.vface/template/HrEmployee/list"); |
| | | OnInitial(); |
| | | |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) Deduction : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xstring EntityID; |
| | | xstring InvoiceNo; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | public: |
| | | Deduction(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static Deduction* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | Deduction* pWin = new Deduction(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmSave") |
| | | { |
| | | OnSave(); |
| | | return 1; |
| | | } |
| | | if (comdid == L"xmSearch") |
| | | { |
| | | OnRetrieve(InvoiceNo, EntityID); |
| | | return 1; |
| | | } |
| | | if (comdid == L"xmClose") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | xstring GetGuid() |
| | | { |
| | | return publiccode::GetGuid(); |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml x; |
| | | |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | trace(x.xml()); |
| | | if (xurl::get(L"/sale/data/AR/update/ARDeduction", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_list.ResetUpdateStatus(); |
| | | alert(L"ä¿åæå!"); |
| | | } |
| | | else |
| | | { |
| | | alert(L"ä¿å失败!"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnItemChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring colname = hdr.colname; |
| | | xstring value = hdr.data; |
| | | int row = hdr.row; |
| | | xstring dwname = L"dw_list"; |
| | | if (colname == L"DeductionAmount") |
| | | { |
| | | dw_list.SetItemString(row, L"SettlementAdjustID", EntityID); |
| | | xstring id = publiccode::GetGuid(); |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | ele.setAttribute(L"guid", id); |
| | | //dw_list.SetGuid(row,id); |
| | | //alert(ele.xml); |
| | | //alert(dw_list.GetGuid(row)); |
| | | } |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&Deduction::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&Deduction::OnSetFocus); |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&Deduction::OnRowChanged); |
| | | AttachEvent(L"dw_list", L"DWV_ITEMCHANGED", (FEvent)&Deduction::OnItemChanged); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnRetrieve(xstring InvoiceNo, xstring EntityID) |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"InvoiceNo", InvoiceNo); |
| | | arg.AddArg(L"InvoiceNoEx", xcontrol(GetControl(L"search")).GetText()); |
| | | arg.AddArg(L"EntityID", EntityID); |
| | | |
| | | //trace(GetControl(L"search").GetText()); |
| | | if (getUrl(L"/sale/data/AR/DeductionList", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | dw_list.SetSelectionMode(1); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | SetArg(); |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/AR/template/Deduction"); |
| | | |
| | | dw_list.SetColumnState(L"ID", false); |
| | | dw_list.SetColumnState(L"GDNLineID", false); |
| | | dw_list.SetColumnState(L"SettlementAdjustID", false); |
| | | |
| | | |
| | | if (GetWinParam()) |
| | | { |
| | | xaserverarg arg = GetArg(); |
| | | EntityID = arg.GetArgString(L"EntityID"); |
| | | InvoiceNo = arg.GetArgString(L"InvoiceNo"); |
| | | } |
| | | trace(InvoiceNo); |
| | | OnRetrieve(InvoiceNo, EntityID); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "list.vl" |
| | | use "treeview.vm" |
| | | //unit vclient.vobject tpp |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrEmployee is extend list; |
| | | about HrEmployee |
| | | [ |
| | | field: |
| | | [ |
| | | treeview__ tv_org; |
| | | xdwgrid__ dw_emp; |
| | | |
| | | string is_orgid |
| | | string is_orgname; |
| | | string is_inflag; |
| | | xdwtable__ dw_empmaint; |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "/*[1]"); |
| | | if (agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent(anode, s); |
| | | } |
| | | } |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt, int p) |
| | | { |
| | | SetAgent(); |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve(string ls_orgid) |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("OrgID", ls_orgid); |
| | | //trace(ls_orgid); |
| | | //if (xaserver__::ExecXQuery(GetServerUrl(),"[MSSqlHrEmployee.xq]",arg.GetString(),x) == 1) |
| | | if (url::get("OrganizationStruct/list.Employee", arg.GetString(), x) == 1) |
| | | { |
| | | dw_emp.Retrieve(x); |
| | | dw_emp.Redraw(); |
| | | } |
| | | //trace(x.GetXml()); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | int hIcon = xutil__::SetCursorWait(); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | dw_emp.AcceptText(); |
| | | dw_emp.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | |
| | | string val = x.GetXml(); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content", val); |
| | | //trace(x.GetXml()); |
| | | //return 1; |
| | | if (url::post("OrganizationStruct/update.Employee", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().documentElement.text); |
| | | alert("ä¿å失败"); |
| | | } |
| | | else { |
| | | dw_emp.ResetUpdateStatus(); |
| | | alert("ä¿åæå"); |
| | | } |
| | | trace(x.GetXml()); |
| | | xutil__::RestoreCursor(hIcon); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSubTree(string id, int parentitem) |
| | | { |
| | | int wid = tv_org.GetId(); |
| | | if (treeview__::GetChildItem(wid, parentitem) > 0) return 1; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sguid", id); |
| | | if (url::post("/sale/data/OrganizationStruct/tree.child.OrgChart", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | var list = x.GetXmlDoc().selectNodes("//item"); |
| | | int i = 0, s = list.length; |
| | | msxml::IXMLDOMElement xitem; |
| | | string sName; |
| | | string sguid; |
| | | string stype; |
| | | if (s > 0) |
| | | { |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | xitem = list.item(i); |
| | | sName = xitem.SelectSingleNode("name").text; |
| | | sguid = xitem.SelectSingleNode("id").text; |
| | | stype = xitem.SelectSingleNode("typ").text; |
| | | //int curItem = tv_org.InsertChildItemEx(wid,parentitem,sName,xitem,15,4); |
| | | int curItem = 0; |
| | | if (stype == "Org") |
| | | { |
| | | curItem = tv_org.InsertChildItemEx(wid, parentitem, sName, xitem, 15, 4); |
| | | tv_org.SetItemChild1(wid, curItem, 1); |
| | | } |
| | | else |
| | | { |
| | | curItem = tv_org.InsertChildItemEx(wid, parentitem, sName, xitem, 21, 21); |
| | | } |
| | | //OnSubTree(sguid,curItem); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(string id, int parentitem) |
| | | { |
| | | //while (tv_1.GetRootItem()>0) |
| | | // tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | int wid = tv_org.GetId(); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | x.LoadXml("<item><id>" + id + "</id><no/><name>宿³¢å®¶å°ä½³</name><typ>Org</typ></item>"); |
| | | //msxml::IXMLDOMDocument root = x.GetXmlDoc(); |
| | | //msxml::IXMLDOMElement RDoc = x.GetXmlDoc().documentElement; |
| | | //msxml::IXMLDOMElement ele = RDoc.SelectSingleNode("//Org"); |
| | | msxml::IXMLDOMElement ele = x.GetXmlDoc().SelectSingleNode("//item"); |
| | | int hItem = treeview__::InsertChildItemEx(wid, 0, "宿³¢å®¶å°ä½³", ele, 15, 4); |
| | | treeview__::SetItemChild1(wid, hItem, 1); |
| | | return 1; |
| | | |
| | | /*xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sguid",id); |
| | | if(url::post("/sale/data/OrganizationStruct/tree.child.OrgChart",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | var list=x.GetXmlDoc().selectNodes("//item"); |
| | | int i=0,s=list.length; |
| | | msxml::IXMLDOMElement xitem; |
| | | string sName; |
| | | string sguid; |
| | | if (s >0) |
| | | { |
| | | for (i=0;i<s;i++) |
| | | { |
| | | xitem= list.item(i); |
| | | sName = xitem.SelectSingleNode("@name").text; |
| | | sguid = xitem.SelectSingleNode("@id").text; |
| | | int curItem = tv_org.InsertChildItemEx(wid,hItem,sName,xitem,15,4); |
| | | tv_org.SetItemChild1(wid,curItem,1); |
| | | //OnSubTree(sguid,curItem); |
| | | } |
| | | } |
| | | return 1;*/ |
| | | } |
| | | |
| | | int OnTreeExpanding(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int sitem = nmtv.itemNew.hItem; |
| | | |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | //string id = treeview__::GetItemData(tv_org.GetId(), sitem); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(tv_org.GetId(), sitem); |
| | | string id = ele.SelectSingleNode("id").text; |
| | | OnSubTree(id, sitem); |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TXCommandEvent evt, int p) |
| | | { |
| | | int wid = tv_org.GetId(); |
| | | int hitem = treeview__::GetSelectedItem(wid); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid, hitem); |
| | | if (ele) |
| | | { |
| | | string ls_orgid = ele.SelectSingleNode("id").text; |
| | | is_orgid = ls_orgid; |
| | | OnRetrieve(ls_orgid); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnAddRow() |
| | | { |
| | | int wid = tv_org.GetId(); |
| | | int hitem = treeview__::GetSelectedItem(wid); |
| | | if (!hitem) |
| | | { |
| | | alert("è¯·éæ©å²ä½ï¼"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid, hitem); |
| | | string stype = ele.SelectSingleNode("typ").text; |
| | | if (stype != "Pos") |
| | | { |
| | | alert("è¯·éæ©å²ä½ï¼"); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | OpenWindow("dev:xpage[HrEmployeeAdd.vx]", this); |
| | | //openUrl("ç»ç»æ¶æ.vface/xpage/Hr/HrEmployeeAdd", this); |
| | | return 1; |
| | | } |
| | | |
| | | int OnModifyRow() |
| | | { |
| | | int row = dw_emp.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | row = dw_emp.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | win__::MessageBox(GetHWND(), "请éä¸è¦ä¿®æ¹çä»»èä¿¡æ¯è¡ï¼", "æç¤º", 0); |
| | | return -1; |
| | | } |
| | | } |
| | | int wid = dw_emp.GetId(); |
| | | msxml::IXMLDOMElement e = dw_emp.GetRowElement(row); |
| | | string sPersonID = e.selectSingleNode("PersonID").text; |
| | | //trace(e.xml); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("operate", "modify"); |
| | | arg.AddArg("guid", sPersonID); |
| | | //xwin::OpenWindow("dev:xpage[HrPersonMaint.xpage]",arg); |
| | | openUrl("ç»ç»æ¶æ.vface/xpage/Hr/HrPersonMaint", arg); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int ll_row = dw_emp.GetNextSelectRow(1); |
| | | if (ll_row < 1) |
| | | { |
| | | ll_row = dw_emp.GetRow(); |
| | | if (ll_row < 1) |
| | | { |
| | | win__::MessageBox(GetHWND(), "请éä¸è¦å é¤çä»»èä¿¡æ¯è¡ï¼", "æç¤º", 0); |
| | | return -1; |
| | | } |
| | | } |
| | | string sName = dw_emp.GetItemDisplayString(ll_row, "PersonID", 0); |
| | | if (win__::MessageBox(GetHWND(), "ç¡®å®å é¤" + sName + "ä»»èä¿¡æ¯åï¼", "æç¤º", 1) != 1) |
| | | return 0; |
| | | |
| | | msxml::IXMLDOMElement ele = dw_emp.GetRowElement(ll_row); |
| | | string empid = ele.selectSingleNode("@guid").text; |
| | | |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("guid", empid); |
| | | //if(xaserver__::ExecXAction(GetServerUrl(),"[MSSqlHrEmployeeDel.xq]",args.GetString(),x) !=1) |
| | | if (url::post("OrganizationStruct/delete.Employee", args.GetString(), x) != 1) |
| | | { |
| | | string error = x.GetXmlDoc().text; |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | dw_emp.DeleteRow(ll_row); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int SetText() |
| | | { |
| | | win__::SetWindowText(GetHWND(), "æå±ç»ç»:" + is_orgname + " æä½ç¶æï¼" + is_inflag); |
| | | return 1; |
| | | } |
| | | |
| | | //xgridexåå» |
| | | int OnDoubleClicked(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int row = hdr.row; |
| | | if (row < 1 || row > dw_emp.GetRowCount()) |
| | | return 1; |
| | | msxml::IXMLDOMElement e = dw_emp.GetRowElement(row); |
| | | string sPersonID = e.selectSingleNode("PersonID").text; |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("operate", "modify"); |
| | | arg.AddArg("guid", sPersonID); |
| | | //xwin::OpenWindow("dev:xpage[HrPersonMaint.xpage]",arg); |
| | | openUrl("ç»ç»æ¶æ.vface/xpage/Hr/HrPersonMaint", arg); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "Save") return OnSave(); |
| | | else if (comdid == "AddRow") return OnAddRow(); |
| | | else if (comdid == "ModifyRow") return OnModifyRow(); |
| | | else if (comdid == "DeleteRow") return OnDeleteRow(); |
| | | else if (comdid == "Refresh") return OnRetrieve(is_orgid); |
| | | /*else if(comdid =="adjustorg") return OnAdjustOrg();*/ |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | //è·å¾æ çéæ©äºä»¶ |
| | | AttachEvent("tv_org", "TVN_SELCHANGED", OnTreeSelChanged); |
| | | AttachEvent("tv_org", "TVN_ITEMEXPANDING", OnTreeExpanding); |
| | | AttachEvent("dw_emp", "DWV_DOUBLECLICKED", OnDoubleClicked); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | m_agentNode = new xnode__; |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | tv_org = new treeview__; |
| | | tv_org.setNativePointer(this.GetControl("tv_org")); |
| | | dw_emp = new xdwgrid__; |
| | | dw_emp.setNativePointer(this.GetControl("dw_emp")); |
| | | dw_emp.openUrl("ç»ç»æ¶æ.vface/template/HrEmployee/list"); |
| | | //dw_emp.SetReadOnly(true); |
| | | //dw_emp.SetSelectionMode(1); |
| | | |
| | | OnInitial(); |
| | | OnCreateTree("00000000-0000-0000-0000-000000000000", 0); |
| | | int wid = tv_org.GetId(); |
| | | int root = treeview__::GetRootItem(wid); |
| | | treeview__::ExpandItem(wid, root); |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "frame.vl" |
| | | use "treeview.vm" |
| | | use "dev:code[HrEmployee.vx]" |
| | | use "publiccode.vl" |
| | | |
| | | //unit vclient.vobject tpp |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrEmployeeAdd is extend frame; |
| | | about HrEmployeeAdd |
| | | [ |
| | | field: |
| | | [ |
| | | HrEmployee lw_obj; |
| | | xdwgrid__ dw_list; |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | string m_sTxt; |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | if (agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent(anode, s); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt, int param) |
| | | { |
| | | SetAgent(); |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl("QueryTxt")); |
| | | m_sTxt = xc.GetText() + ""; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sTxt", m_sTxt); |
| | | if (url::post("OrganizationStruct/select.Employee", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnOK() |
| | | { |
| | | if (GetParam()) |
| | | { |
| | | lw_obj = new HrEmployee; |
| | | lw_obj.setNativePointer(GetParam()); |
| | | lw_obj = GetParam(); |
| | | } |
| | | else |
| | | return 0; |
| | | |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | alert("è¯·éæ©äººå!"); |
| | | return 1; |
| | | } |
| | | |
| | | string sPositionID, sPositionName; |
| | | string sOrgID, sOrgName; |
| | | string sJobID, sJobName; |
| | | int wid = lw_obj.tv_org.GetId(); |
| | | int hitem = treeview__::GetSelectedItem(wid); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid, hitem); |
| | | if (ele) |
| | | { |
| | | sPositionID = ele.SelectSingleNode("id").text; |
| | | sPositionName = ele.SelectSingleNode("name").text; |
| | | sOrgID = ele.SelectSingleNode("OrgID").text; |
| | | sOrgName = ele.SelectSingleNode("OrgName").text; |
| | | sJobID = ele.SelectSingleNode("JobID").text; |
| | | sJobName = ele.SelectSingleNode("JobName").text; |
| | | } |
| | | |
| | | while (row > 0) |
| | | { |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sEmployeeNo = e.selectSingleNode("EmployeeNo").text + ""; |
| | | string sPersonID = e.selectSingleNode("PersonID").text + ""; |
| | | string sPersonName = e.selectSingleNode("Name").text + ""; |
| | | |
| | | int nRow = lw_obj.dw_emp.InsertRow(0); |
| | | lw_obj.dw_emp.SetItemString(nRow, "EmployeeNo", sEmployeeNo); |
| | | lw_obj.dw_emp.SetItemString(nRow, "PersonID", sPersonID); |
| | | lw_obj.dw_emp.SetItemDisplayString(nRow, "PersonID", sPersonName); |
| | | |
| | | lw_obj.dw_emp.SetItemString(nRow, "PositionID", sPositionID); |
| | | lw_obj.dw_emp.SetItemDisplayString(nRow, "PositionID", sPositionName); |
| | | lw_obj.dw_emp.SetItemString(nRow, "OrgID", sOrgID); |
| | | lw_obj.dw_emp.SetItemDisplayString(nRow, "OrgID", sOrgName); |
| | | lw_obj.dw_emp.SetItemString(nRow, "JobID", sJobID); |
| | | lw_obj.dw_emp.SetItemDisplayString(nRow, "JobID", sJobName); |
| | | |
| | | lw_obj.dw_emp.SetItemString(nRow, "Status", "Y"); |
| | | lw_obj.dw_emp.SetItemDisplayString(nRow, "Status", "ææ"); |
| | | string sdate = publiccode::GetCurDate() + ""; |
| | | lw_obj.dw_emp.SetItemString(nRow, "StartDate", sdate + ""); |
| | | lw_obj.dw_emp.SetItemString(nRow, "EndDate", "2050-12-31"); |
| | | |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "xmOk") |
| | | OnOK(); |
| | | else if (comdid == "query") |
| | | OnRetrieve(); |
| | | else if (comdid == "xmCancel") |
| | | CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt, int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | dw_list.openUrl("ç»ç»æ¶æ.vface/template/HrEmployee/PersonSel"); |
| | | dw_list.SetSelectionMode(3); //3 |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | OnInitial(); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "list.vl" |
| | | use "treeview.vm" |
| | | //unit vclient.vobject tpp |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrEmployeex is extend list; |
| | | about HrEmployeex |
| | | [ |
| | | field: |
| | | [ |
| | | treeview__ tv_org; |
| | | xdwtable__ dw_1; |
| | | xnode__ m_agentNode; |
| | | string is_orgid |
| | | string is_orgname; |
| | | string is_inflag; |
| | | xdwtable__ dw_empmaint; |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "/*[1]"); |
| | | if (agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent(anode, s); |
| | | } |
| | | } |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt, int p) |
| | | { |
| | | SetAgent(); |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | int hIcon = xutil__::SetCursorWait(); |
| | | |
| | | string val; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | var xdoc = x.GetXmlDoc(); |
| | | dw_1.AcceptText(); |
| | | dw_1.DwUpdateAllTo(xdoc); |
| | | val = xdoc.xml; |
| | | //trace(val); |
| | | //return 1; |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("content", val); |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("OrganizationStruct/update.Employee", args.GetString(), x1) != 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | win__::MessageBox(GetHWND(), "ä¿åæåï¼", "æç¤º", 0); |
| | | } |
| | | |
| | | xutil__::RestoreCursor(hIcon); |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve(string ls_orgid) |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("OrgID", ls_orgid); |
| | | //trace(ls_orgid); |
| | | //if (xaserver__::ExecXQuery(GetServerUrl(),"[MSSqlHrEmployee.xq]",arg.GetString(),x) == 1) |
| | | if (url::get("OrganizationStruct/detail.Employee", arg.GetString(), x) == 1) |
| | | { |
| | | dw_1.openUrl("ç»ç»æ¶æ.vface/template/HrEmployee/detail"); |
| | | dw_1.Retrieve(x); |
| | | dw_1.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TXCommandEvent evt, int p) |
| | | { |
| | | int wid = tv_org.GetId(); |
| | | int hitem = treeview__::GetSelectedItem(wid); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid, hitem); |
| | | string ls_orgid = ele.SelectSingleNode("@guid").text; |
| | | is_orgid = ls_orgid; |
| | | //trace(is_orgid); |
| | | OnRetrieve(ls_orgid); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAddRow() |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_1.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "HrEmployee") |
| | | dw.InsertRow(0); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_1.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "HrEmployee") |
| | | { |
| | | int row = dw.GetRow(); |
| | | dw.InsertRow(row); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_1.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "HrEmployee") |
| | | { |
| | | int row = dw.GetRow(); |
| | | dw.DeleteRow(row); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnChildContent(ref TNotifyEvent evt, int p) { |
| | | ref DWNMHDR dwhdr = evt.pnmh; |
| | | string col = dwhdr.colname; |
| | | if (col != "") { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | string query; |
| | | query = "[IResourceMSSql.xq]"; |
| | | if (col == "PositionID") { |
| | | arg.AddArg("ResourceType", "HrPosition"); |
| | | } |
| | | else if (col == "PersonID") { |
| | | arg.AddArg("ResourceType", "HrPerson"); |
| | | } |
| | | else if (col == "OrgID") { |
| | | arg.AddArg("ResourceType", "HrOrg"); |
| | | } |
| | | else if (col == "JobID") { |
| | | arg.AddArg("ResourceType", "HrJob"); |
| | | } |
| | | if (xaserver__::ExecXQuery(GetServerUrl(), query, arg.GetString(), x) == 1) |
| | | dwhdr.data = x.GetXml(); |
| | | //trace(x.GetXml()); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnItemChanged(ref TNotifyEvent evt, int p) |
| | | { |
| | | int HCursor = xutil__::SetCursorWait(); |
| | | |
| | | ref DWNMHDR dwhdr = evt.pnmh; |
| | | int row = dwhdr.row; |
| | | string col = dwhdr.colname; |
| | | string data = dwhdr.data; |
| | | trace(row); |
| | | if (col == "PositionID") |
| | | { |
| | | xdwtable__ dw_HrEmployee = new xdwtable__; |
| | | dw_HrEmployee.setNativePointer(dw_1.FindDwTable("HrEmployee")); |
| | | string sPositionID = dw_HrEmployee.GetItemString(row, "PositionID"); |
| | | |
| | | if (sPositionID == "" || sPositionID == nil) |
| | | return 1; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid", sPositionID); |
| | | arg.AddArg("type", "GetOrgIDJobID"); |
| | | //trace(arg.GetString()); |
| | | if (url::get("OrganizationStruct/GetOrgIDJobID", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMDocument xdoc = x.GetXmlDoc(); |
| | | //IXMLDOMNodeList nlist = xdoc.getElementsByTagName("OrgID"); |
| | | msxml::IXMLDOMElement e = xdoc.documentElement; |
| | | string sOrgID = e.SelectSingleNode("@OrgID").text; |
| | | string sOrgName = e.SelectSingleNode("@OrgName").text; |
| | | string sJobID = e.SelectSingleNode("@JobID").text; |
| | | string sJobName = e.SelectSingleNode("@JobName").text; |
| | | dw_HrEmployee.SetItemString(row, "OrgID", sOrgID); |
| | | dw_HrEmployee.SetItemDisplayString(row, "OrgID", sOrgName); |
| | | dw_HrEmployee.SetItemString(row, "JobID", sJobID); |
| | | dw_HrEmployee.SetItemDisplayString(row, "JobID", sJobName); |
| | | } |
| | | } |
| | | xutil__::RestoreCursor(HCursor); |
| | | return 0; |
| | | } |
| | | |
| | | int OnImportData() |
| | | { |
| | | openUrl("ç»ç»æ¶æ.vface/xpage/Hr/HrPersonSel", this); |
| | | return 1; |
| | | } |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "AddRow") return OnAddRow(); |
| | | else if (comdid == "InsertRow") return OnInsertRow(); |
| | | else if (comdid == "DeleteRow") return OnDeleteRow(); |
| | | else if (comdid == "Save") return OnSave(); |
| | | else if (comdid == "ImportData") return OnImportData(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | //è·å¾æ çéæ©äºä»¶ |
| | | AttachEvent("tv_org", "TVN_SELCHANGED", OnTreeSelChanged); |
| | | //ä¸ææ¡ æä¾å
容 |
| | | AttachEvent("dw_1", "DWV_CHILDCONTENT", OnChildContent); |
| | | AttachEvent("dw_1", "DWV_ITEMCHANGED", OnItemChanged); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | tv_org = new treeview__; |
| | | tv_org.setNativePointer(this.GetControl("tv_org")); |
| | | dw_1 = new xdwtable__; |
| | | dw_1.setNativePointer(this.GetControl("dw_1")); |
| | | dw_1.openUrl("ç»ç»æ¶æ.vface/template/HrEmployee/detail"); |
| | | |
| | | OnInitial(); |
| | | int wid = tv_org.GetId(); |
| | | int root = treeview__::GetRootItem(wid); |
| | | treeview__::ExpandItem(wid, root); |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "frame.vl" |
| | | use "treeview.vm" |
| | | |
| | | //unit vclient.vobject tpp |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrJob is extend frame; |
| | | about HrJob |
| | | [ |
| | | field: |
| | | [ |
| | | treeview__ tv_1; |
| | | xdwgrid__ dw_list; |
| | | string m_type; |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | if (agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent(anode, s); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt, int param) |
| | | { |
| | | SetAgent(); |
| | | |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | string query = "[MSSqlHrJob.xq]"; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("type", m_type); |
| | | //if (xaserver__::ExecXQuery(GetServerUrl(),query,arg.GetString(),x)!=1) |
| | | if (url::post("OrganizationStruct/list.Job", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.openUrl("ç»ç»æ¶æ.vface/template/HrJob/list"); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TNotifyEvent evt, int p) { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int hItem = nmtv.itemNew.hItem; |
| | | |
| | | int wid = tv_1.GetId(); |
| | | int hItem = treeview__::GetSelectedItem(wid); |
| | | int rootItem = treeview__::GetRootItem(wid); |
| | | if (hItem <= 0 || hItem == rootItem) |
| | | { |
| | | m_type = "all"; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid, hItem); |
| | | m_type = ele.SelectSingleNode("@name").text; |
| | | } |
| | | OnRetrieve(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree() |
| | | { |
| | | int wid = tv_1.GetId(); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | x.Load("<Type code='0.0' name='all' guid='' />"); |
| | | msxml::IXMLDOMElement ele = x.GetXmlDoc().SelectSingleNode("Type"); |
| | | int hItem = tv_1.InsertChildItemEx(wid, 0, "å·¥ç§ç±»å", ele, 15, 4); |
| | | |
| | | if (url::post("/sale/data/OrganizationStruct/type.Job", "", x) != 1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | var list = x.GetXmlDoc().selectNodes("//Type"); |
| | | int i = 0, s = list.length; |
| | | msxml::IXMLDOMElement e; |
| | | string sname; |
| | | if (s > 0) |
| | | { |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | e = list.item(i); |
| | | sname = e.SelectSingleNode("@name").text; |
| | | int curItem = tv_1.InsertChildItemEx(wid, hItem, sname, e, 15, 4); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | |
| | | string xdata = x.GetXml(); |
| | | trace(x.GetXml()); |
| | | //return 1; |
| | | |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("xdata", xdata); |
| | | |
| | | string xAction = "[MSSqlHrJobUpdate.xa]"; |
| | | //if(xaserver__::ExecXAction(GetServerUrl(),xAction,arg.GetString())!=1) |
| | | if (url::post("OrganizationStruct/update.Job", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().documentElement.text); |
| | | alert("ä¿å失败"); |
| | | } |
| | | else { |
| | | alert("ä¿åæå"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnAddRow() |
| | | { |
| | | if (m_type == "all") |
| | | { |
| | | alert("请å
鿩工ç§ç±»åï¼"); |
| | | } |
| | | else |
| | | { |
| | | int row = dw_list.InsertRow(0); |
| | | trace(row.toString()); |
| | | dw_list.SetItemString(row, "JobType", m_type); |
| | | dw_list.SetItemString(row, "Status", "Y"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | if (m_type == "all") |
| | | { |
| | | alert("请å
鿩工ç§ç±»åï¼"); |
| | | } |
| | | else |
| | | { |
| | | int crow = dw_list.GetRow(); |
| | | int row = dw_list.InsertRow(crow); |
| | | dw_list.SetItemString(row, "JobType", m_type); |
| | | dw_list.SetItemString(row, "Status", "Y"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sguid = e.selectSingleNode("@guid").text; |
| | | string sName = e.selectSingleNode("JobName").text; |
| | | |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid", sguid); |
| | | if (url::post("OrganizationStruct/used.Job", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement; |
| | | string snums = ele.SelectSingleNode("@num").text; |
| | | int num = snums.toInt(); |
| | | if (num != 0) |
| | | { |
| | | win__::MessageBox(GetHWND(), "å·¥ç§ " + sName + " å·²å¯ç¨ï¼ç¦æ¢å é¤ï¼", "æç¤º", 0); |
| | | return -1; |
| | | } |
| | | } |
| | | dw_list.DeleteRow(row); |
| | | return 1; |
| | | } |
| | | |
| | | int OnJobType() |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("id", "å·¥ç§ç±»å"); |
| | | openUrl("å
Œ
±è®¾ç½®.vface/worknode/quickcode/config", arg); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "Save") OnSave(); |
| | | else if (comdid == "AddRow") OnAddRow(); |
| | | else if (comdid == "InsertRow") OnInsertRow(); |
| | | else if (comdid == "DeleteRow") OnDeleteRow(); |
| | | else if (comdid == "JobType") OnJobType(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt, int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | //è·å¾æ çéæ©äºä»¶ |
| | | AttachEvent("tv_1", "TVN_SELCHANGED", OnTreeSelChanged); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | m_type = "all"; |
| | | tv_1 = new treeview__; |
| | | tv_1.setNativePointer(this.GetControl("tv_1")); |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | dw_list.openUrl("ç»ç»æ¶æ.vface/template/HrJob/list"); |
| | | |
| | | OnInitial(); |
| | | OnCreateTree(); |
| | | int wid = tv_1.GetId(); |
| | | int hItem = treeview__::GetRootItem(wid); |
| | | tv_1.ExpandItem(wid, hItem); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "treeview.vm" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "list.vl" |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrOrg is extend list; |
| | | about HrOrg |
| | | [ |
| | | control: |
| | | |
| | | method: |
| | | [ |
| | | xdwgrid__ dw_list; |
| | | treeview__ tv_org; |
| | | string sOrgID; |
| | | string sOrgName; |
| | | |
| | | string sRootOrgID; |
| | | string sRootOrgName; |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | if (agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent(anode, s); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | int hIcon = xutil__::SetCursorWait(); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid", sOrgID); |
| | | if (url::get("OrganizationStruct/list.HrOrg", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | dw_list.SetReadOnly(true); |
| | | xutil__::RestoreCursor(hIcon); |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt, int p) |
| | | { |
| | | SetAgent(); |
| | | //OnRetrieve(); |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(string sguid, int parentitem) |
| | | { |
| | | int wid = tv_org.GetId(); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sguid", sguid); |
| | | if (url::post("/sale/data/OrganizationStruct/tree.child.OrgChart", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | var list = x.GetXmlDoc().selectNodes("//Org"); |
| | | int i = 0, s = list.length; |
| | | msxml::IXMLDOMElement xitem; |
| | | string sname; |
| | | string sguid; |
| | | if (s > 0) |
| | | { |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | xitem = list.item(s - i - 1); |
| | | sname = xitem.SelectSingleNode("OrgName").text; |
| | | sguid = xitem.SelectSingleNode("@guid").text; |
| | | int curItem = tv_org.InsertChildItemEx(wid, parentitem, sname, xitem, 15, 4); |
| | | OnCreateTree(sguid, curItem); |
| | | /*string id = xitem.selectSingleNode("ModuleID").text; |
| | | string Name=""; |
| | | if(xitem.selectSingleNode("ModuleName")) Name=xitem.selectSingleNode("ModuleName").text; |
| | | string image = 15; |
| | | if(xitem.selectSingleNode("ModuelImage")) image=xitem.selectSingleNode("ModuelImage").text; |
| | | int curItem=treeview__::InsertItem(tv_menu.GetId(), parentItem,0,Name,id,image.toInt()); |
| | | string child=xitem.selectSingleNode("@child").text;//item.getAttribute("HasChild"); |
| | | if (child != "0") |
| | | treeview__::SetItemChild1(tv_menu.GetId(), curItem,1);*/ |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeExpanding(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int sitem = nmtv.itemNew.hItem; |
| | | |
| | | string id = treeview__::GetItemData(tv_org.GetId(), sitem); |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | OnCreateTree(id, sitem); |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | //æ ç¹å»äºä»¶ |
| | | int OnTreeSelecded(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int hItem = nmtv.itemNew.hItem; |
| | | int wid = tv_org.GetId(); |
| | | int hitem = treeview__::GetSelectedItem(wid); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid, hitem); |
| | | |
| | | int hroot = treeview__::GetParentItem(wid, hitem); |
| | | int hparent = treeview__::GetParentItem(wid, hroot); |
| | | if (!hparent) |
| | | { |
| | | hparent = hroot; |
| | | hroot = hitem; |
| | | } |
| | | bool found = false; |
| | | if (hparent) found = true; |
| | | while (treeview__::GetParentItem(wid, hparent)) |
| | | { |
| | | hroot = hparent; |
| | | hparent = treeview__::GetParentItem(wid, hroot); |
| | | } |
| | | if (found) |
| | | { |
| | | msxml::IXMLDOMElement ele1 = treeview__::GetItemData(wid, hroot); |
| | | //trace(ele1.xml); |
| | | //sRootOrgID = ele1.SelectSingleNode("CompanyID").text; |
| | | //sRootOrgName = ele1.selectSingleNode("CompanyID/@_displaystring").text; |
| | | } |
| | | |
| | | string ls_orgid = ele.SelectSingleNode("@guid").text; |
| | | sOrgID = ls_orgid + ""; |
| | | //trace(sOrgID); |
| | | sOrgName = ele.selectSingleNode("OrgName").text; |
| | | OnRetrieve(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeMoveNode(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref TVNNMHDR nmtv = evt.pnmh; |
| | | int xfrom = nmtv.FromItem; |
| | | int xto = nmtv.ToItem; |
| | | |
| | | int ret = win__::MessageBox(this.GetHWND(), "ç¡®å®ç§»å¨ç»ç»èç¹ï¼", "æç¤ºï¼", 1); |
| | | //trace(ret); |
| | | int wid = tv_org.GetId(); |
| | | if (ret == 2) |
| | | { |
| | | treeview__::DeleteItem(wid, xto); |
| | | return -1; |
| | | } |
| | | |
| | | //string fid = treeview__::GetItemData(wid, xfrom); |
| | | //string tid = treeview__::GetItemData(wid, xto); |
| | | int xtop = treeview__::GetParentItem(wid, xto); |
| | | msxml::IXMLDOMElement ef = treeview__::GetItemData(wid, xfrom); |
| | | msxml::IXMLDOMElement et = treeview__::GetItemData(wid, xtop); |
| | | string fid = ef.SelectSingleNode("@guid").text;//ef.xml; |
| | | string tid = et.SelectSingleNode("@guid").text;//et.xml; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("from", fid); |
| | | arg.AddArg("to", tid); |
| | | //trace(et.xml); |
| | | //return 1; |
| | | if (url::post("OrganizationStruct/move.update.HrOrg", arg.GetString(), x) != 1) |
| | | { |
| | | trace("error:" + x.GetXml()); |
| | | alert("ç§»å¨ç»ç»èç¹åºé!"); |
| | | treeview__::DeleteItem(wid, xto); |
| | | return 0; |
| | | } |
| | | treeview__::DeleteItem(wid, xfrom); |
| | | return 1; |
| | | } |
| | | |
| | | //xgridexåå» |
| | | int OnDoubleClicked(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int row = hdr.row; |
| | | if (row < 1 || row > dw_list.GetRowCount()) |
| | | return 1; |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sguid = e.SelectSingleNode("@guid").text; |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("operate", "modify"); |
| | | arg.AddArg("guid", sguid); |
| | | arg.AddArg("tvOrgID", sOrgID); |
| | | arg.AddArg("tvOrgName", sOrgName); |
| | | arg.AddArg("tvRootOrgID", sRootOrgID); |
| | | arg.AddArg("tvRootOrgName", sRootOrgName); |
| | | //trace(row.toString()); |
| | | //win__::OpenWindow("dev:xpage[HrOrgMaint.xpage]",arg); |
| | | openUrl("ç»ç»æ¶æ.vface/xpage/HrOrg/maint", arg); |
| | | return 1; |
| | | } |
| | | |
| | | int AddRow() |
| | | { |
| | | /*int wid = tv_org.GetId(); |
| | | int hitem=treeview__::GetSelectedItem(wid); |
| | | int root=treeview__::GetRootItem(wid); |
| | | if (hitem == root) |
| | | { |
| | | win32::MessageBox(GetHWND(),"æ ¹ç»ç»ï¼","æç¤º",0); |
| | | return -1; |
| | | }*/ |
| | | //int row = dw_list.GetNextSelectRow(1); |
| | | //IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | //string sguid = e.getAttribute("guid"); |
| | | |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("operate", "new0"); |
| | | arg.AddArg("guid", ""); |
| | | arg.AddArg("tvOrgID", sOrgID); |
| | | arg.AddArg("tvOrgName", sOrgName); |
| | | arg.AddArg("tvRootOrgID", sRootOrgID); |
| | | arg.AddArg("tvRootOrgName", sRootOrgName); |
| | | openUrl("ç»ç»æ¶æ.vface/xpage/HrOrg/maint", arg); |
| | | return 1; |
| | | } |
| | | |
| | | int ModifyRow() |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | win__::MessageBox(GetHWND(), "请éä¸è¦ä¿®æ¹çç»ç»æ°æ®è¡ï¼", "æç¤º", 0); |
| | | return -1; |
| | | } |
| | | } |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sguid = e.SelectSingleNode("@guid").text; |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("operate", "modify"); |
| | | arg.AddArg("guid", sguid); |
| | | arg.AddArg("tvOrgID", sOrgID); |
| | | arg.AddArg("tvOrgName", sOrgName); |
| | | arg.AddArg("tvRootOrgID", sRootOrgID); |
| | | arg.AddArg("tvRootOrgName", sRootOrgName); |
| | | openUrl("ç»ç»æ¶æ.vface/xpage/HrOrg/maint", arg); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteItem(string sguid) |
| | | { |
| | | int wid = tv_org.GetId(); |
| | | int hitem = treeview__::GetSelectedItem(wid); |
| | | int ditem = treeview__::GetChildItem(wid, hitem); |
| | | msxml::IXMLDOMElement e = treeview__::GetItemData(wid, ditem); |
| | | if (e) |
| | | { |
| | | string dguid = e.SelectSingleNode("@guid").text; |
| | | while (dguid != sguid) |
| | | { |
| | | ditem = treeview__::GetNextItem(wid, ditem); |
| | | e = treeview__::GetItemData(wid, ditem); |
| | | dguid = e.SelectSingleNode("@guid").text; |
| | | } |
| | | treeview__::DeleteItem(wid, ditem); |
| | | } |
| | | return 1; |
| | | } |
| | | int DeleteRow() |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | //win__::MessageBox(GetHWND(),"请éä¸è¦å é¤çç»ç»æ°æ®è¡ï¼","æç¤º",0); |
| | | return -1; |
| | | } |
| | | } |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sguid = e.SelectSingleNode("@guid").text; |
| | | string sName = e.selectSingleNode("OrgName").text; |
| | | sName += ""; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid", sguid); |
| | | if (url::get("OrganizationStruct/child.OrgNums", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement; |
| | | string snums = ele.SelectSingleNode("@num").text; |
| | | int num = snums.toInt(); |
| | | if (num != 0) |
| | | { |
| | | win__::MessageBox(GetHWND(), "ç»ç» " + sName + " åå¨ä¸çº§ç»ç»åå
ï¼ç¦æ¢å é¤ï¼", "æç¤º", 0); |
| | | return 1; |
| | | } |
| | | } |
| | | |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (win__::MessageBox(GetHWND(), "确认è¦å é¤ç»ç» " + sName + " çä¿¡æ¯åï¼", "æç¤º", MB_YESNO) != IDYES) return 1; |
| | | arg.AddArg("guid", sguid); |
| | | //trace(sguid); |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("/sale/data/OrganizationStruct/delete.HrOrg", arg.GetString(), x1) != 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | //win32::MessageBox(GetHWND(),"å 餿åï¼","æç¤º",0); |
| | | dw_list.DeleteRow(row); |
| | | OnDeleteItem(sguid); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int Productlinemaint() |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("id", "产å线"); |
| | | openUrl("å
Œ
±è®¾ç½®.vface/worknode/quickcode/config", arg); |
| | | //openUrl("䏿çªå£.vface/xpage/hremployee/select", arg); |
| | | |
| | | return 1; |
| | | } |
| | | int setTree() |
| | | { |
| | | string str = "<vbox name='tree' >"; |
| | | str += "<xtree name='tv_org' imagelist='0' drag='true'>"; |
| | | str += "<treeitem src='xquery:[OrgChart.hr.xq]' src1='xquery:[OrgStructureRetrieve.xq]' xcaption='OrgName' xroot='/root' xpath='Org' xchildpath='Org' image='15' loop='yes' xdata='.'/>"; |
| | | str += "</xtree></vbox>"; |
| | | string xfNodeAgentArea = "tree"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | SetAgentNodeContent(anode, str); |
| | | tv_org = new treeview__; |
| | | tv_org.setNativePointer(this.GetControl("tv_org")); |
| | | AttachEvent("tv_org", "TVN_SELCHANGED", OnTreeSelecded); |
| | | int root = treeview__::GetRootItem(tv_org.GetId()); |
| | | if (root > 0) |
| | | { |
| | | treeview__::ExpandItemEx(tv_org.GetId(), root); |
| | | } |
| | | return 1; |
| | | } |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "AddRow") { return AddRow(); } |
| | | else if (comdid == "ModifyRow") { return ModifyRow(); } |
| | | else if (comdid == "DeleteRow") { return DeleteRow(); } |
| | | else if (comdid == "OrgType") |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("id", "ç»ç»ç±»å"); |
| | | openUrl("å
Œ
±è®¾ç½®.vface/worknode/quickcode/config", arg); |
| | | //openUrl("ç»ç»æ¶æ.vface/xpage/HrOrg/type"); |
| | | } |
| | | else if (comdid == "Refresh") |
| | | { |
| | | OnRetrieve(); |
| | | setTree(); |
| | | AttachEvent("tv_org", "TVN_ENDDRAG", OnTreeMoveNode); |
| | | } |
| | | else if (comdid == "Productlinemaint") |
| | | { |
| | | Productlinemaint(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | //è·å¾æ çç¹å»äºä»¶ |
| | | AttachEvent("tv_org", "TVN_SELCHANGED", OnTreeSelecded); |
| | | AttachEvent("tv_org", "TVN_ITEMEXPANDING", OnTreeExpanding); |
| | | AttachEvent("tv_org", "TVN_ENDDRAG", OnTreeMoveNode); |
| | | //åå» |
| | | AttachEvent("dw_list", "DWV_DOUBLECLICKED", OnDoubleClicked); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | tv_org = new treeview__; |
| | | tv_org.setNativePointer(this.GetControl("tv_org")); |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | dw_list.openUrl("ç»ç»æ¶æ.vface/template/HrOrg/list"); |
| | | dw_list.SetSelectionMode(1); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.SetColumnState("OrgPlat", false); |
| | | dw_list.SetColumnState("OrgComLeader", false); |
| | | dw_list.SetColumnState("OrgSupLeader", false); |
| | | dw_list.SetColumnState("OrgProLine", false); |
| | | |
| | | |
| | | OnInitial(); |
| | | |
| | | //OnCreateTree("00000000-0000-0000-0000-000000000000", 0); |
| | | int root = treeview__::GetRootItem(tv_org.GetId()); |
| | | if (root > 0) |
| | | { |
| | | treeview__::ExpandItemEx(tv_org.GetId(), root); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(tv_org.GetId(), root); |
| | | if (ele) |
| | | { |
| | | string ls_orgid = ele.SelectSingleNode("@guid").text; |
| | | sOrgID = ls_orgid + ""; |
| | | sOrgName = ele.selectSingleNode("OrgName").text; |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "treeview.vm" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrOrgChart is extend win__; |
| | | about HrOrgChart |
| | | [ |
| | | control: |
| | | |
| | | method: |
| | | [ |
| | | treeview__ tv_org; |
| | | xdwtable__ dw_parent; |
| | | int m_bCanDestroy; |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | |
| | | int OnTreeSelChanged(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int hitem = nmtv.itemNew.hItem; |
| | | if (hitem == 0) |
| | | hitem = treeview__::GetRootItem(tv_org.GetId()); |
| | | string label = treeview__::GetItemLabel(tv_org.GetId(), hitem); |
| | | string pUnit; |
| | | pUnit = treeview__::GetItemLabel(tv_org.GetId(), hitem) + "\\"; |
| | | int pitem = treeview__::GetParentItem(tv_org.GetId(), hitem); |
| | | while (pitem > 0) |
| | | { |
| | | pUnit = treeview__::GetItemLabel(tv_org.GetId(), pitem) + "\\" + pUnit; |
| | | pitem = treeview__::GetParentItem(tv_org.GetId(), pitem); |
| | | } |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(tv_org.GetId(), hitem); |
| | | string guid = ele.SelectSingleNode("@guid").text; |
| | | |
| | | //CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnActive(ref TEvent evt, int p) |
| | | { |
| | | /*int WA_INACTIVE = 0; |
| | | int WA_ACTIVE = 1; |
| | | int WA_CLICKACTIVE = 2; |
| | | int lw = evt.wParam & 0xffff; |
| | | if( lw ==WA_INACTIVE && m_bCanDestroy==1 ) |
| | | { |
| | | win__::CloseWindow(); |
| | | return 1; |
| | | } |
| | | if(lw !=WA_INACTIVE)m_bCanDestroy = 1; |
| | | return 1;*/ |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt, int p) |
| | | { |
| | | return 1; |
| | | } |
| | | |
| | | int OnOK(string comdid) |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = win__::GetParam(); |
| | | arg.AddArg("comdid", comdid); |
| | | int hitem = treeview__::GetSelectedItem(tv_org.GetId()); |
| | | if (hitem > 0) |
| | | { |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(tv_org.GetId(), hitem); |
| | | string guid = ele.SelectSingleNode("@guid").text; |
| | | string label = ele.selectSingleNode("OrgName").text; |
| | | arg.AddArg("OrgName", label); |
| | | arg.AddArg("OrgId", guid); |
| | | win__::CloseWindow(); |
| | | } |
| | | else |
| | | win__::MessageBox(GetHWND(), "è¯·éæ©ç»ç»ï¼", "æç¤º", 0); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | if (comdid == "xmOk") |
| | | OnOK(comdid); |
| | | else if (comdid == "xmCancel") |
| | | CloseWindow(); |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | AttachEvent("tv_org", "TVN_SELCHANGED", OnTreeSelChanged); |
| | | //AttachEvent("WM_ACTIVATE",OnActive); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | m_bCanDestroy = 1; |
| | | tv_org = new treeview__; |
| | | tv_org.setNativePointer(this.GetControl("tv_org")); |
| | | OnInitial(); |
| | | |
| | | int root = treeview__::GetRootItem(tv_org.GetId()); |
| | | treeview__::ExpandItemEx(tv_org.GetId(), root); |
| | | |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "treeview.vm" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "list.vl" |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrOrgMaint is extend list; |
| | | about HrOrgMaint |
| | | [ |
| | | control: |
| | | |
| | | method: |
| | | [ |
| | | xdwtable__ dw_detail; |
| | | string m_operate; |
| | | string m_sguid; |
| | | string m_tvOrgID; |
| | | string m_tvOrgName; |
| | | string m_tvRootOrgID; |
| | | string m_tvRootOrgName; |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | if (agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent(anode, s); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt, int p) |
| | | { |
| | | SetAgent(); |
| | | |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid", m_sguid); |
| | | if (url::get("OrganizationStruct/detail.HrOrg", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | trace(x.GetXml()); |
| | | dw_detail.Retrieve(x); |
| | | dw_detail.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | int hIcon = xutil__::SetCursorWait(); |
| | | //dw_detail.AcceptText(); |
| | | string val; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | var xdoc = x.GetXmlDoc(); |
| | | dw_detail.DwUpdateAllTo(xdoc); |
| | | val = xdoc.xml; |
| | | //trace(val); |
| | | //return 1; |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("content", val); |
| | | //trace(val); |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("OrganizationStruct/update.HrOrg", args.GetString(), x1) != 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | win__::MessageBox(GetHWND(), "ä¿åæåï¼", "æç¤º", 0); |
| | | } |
| | | dw_detail.ResetUpdateStatus(); |
| | | xutil__::RestoreCursor(hIcon); |
| | | return 1; |
| | | } |
| | | |
| | | int OnNew() |
| | | { |
| | | dw_detail.openUrl("ç»ç»æ¶æ.vface/template/HrOrg/detail"); |
| | | if (m_operate == "new0") |
| | | { |
| | | dw_detail.SetItemString(1, "ParentOrgID", m_tvOrgID); |
| | | dw_detail.SetItemDisplayString(1, "ParentOrgID", m_tvOrgName); |
| | | } |
| | | dw_detail.SetItemString(1, "Status", "Y"); |
| | | //dw_detail.SetItemDisplayString(1,"Status","ææ"); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "New") OnNew(); |
| | | if (comdid == "Save") OnSave(); |
| | | if (comdid == "xmOk") OnSave(); |
| | | if (comdid == "xmCancel") CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnChildContent(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR dwhdr = evt.pnmh; |
| | | string col = dwhdr.colname; |
| | | if (col != "") { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | string query; |
| | | query = "[IResourceMSSql.xq]"; |
| | | if (col == "OrgTypeID") { |
| | | arg.AddArg("ResourceType", "HrOrgType");//ç»ç»ç±»å |
| | | } |
| | | else if (col == "OrgAddress000") { |
| | | arg.AddArg("ResourceType", "HR_Address");//ç»ç»å°å |
| | | } |
| | | else if (col == "CompanyID") { |
| | | arg.AddArg("ResourceType", "CompanyInfo");//æå±æ³äºº |
| | | } |
| | | else if (col == "OrgProLine") { |
| | | arg.AddArg("ResourceType", "OrgProLine");//产å线 |
| | | } |
| | | if (xaserver__::ExecXQuery(GetServerUrl(), query, arg.GetString(), x) == 1) |
| | | dwhdr.data = x.GetXml(); |
| | | //trace(x.GetXml()); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnClicked(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | |
| | | string colname = hdr.colname; |
| | | if (colname == "ParentOrgID") |
| | | { |
| | | openUrl("ç»ç»æ¶æ.vface/xpage/HrOrg/Chart", arg); |
| | | //trace(arg.GetString()); |
| | | string comdid = arg.GetArgString("comdid"); |
| | | if (comdid == "xmOk") |
| | | { |
| | | string OrgName = arg.GetArgString("OrgName"); |
| | | string OrgID = arg.GetArgString("OrgId"); |
| | | dw_detail.SetItemDisplayString(1, "ParentOrgID", OrgName); |
| | | dw_detail.SetItemString(1, "ParentOrgID", OrgID); |
| | | dw_detail.Redraw(); |
| | | } |
| | | } |
| | | if (colname == "LeaderID") |
| | | { |
| | | openUrl("ç»ç»æ¶æ.vface/xpage/hremployee/select", arg); |
| | | comdid = arg.GetArgString("comdid"); |
| | | if (comdid == "xmOk") |
| | | { |
| | | string sPersonID = arg.GetArgString("sPersonID"); |
| | | //trace(sPersonID); |
| | | string sPersonName = arg.GetArgString("sPersonName"); |
| | | dw_detail.SetItemDisplayString(1, colname, sPersonName); |
| | | dw_detail.SetItemString(1, colname, sPersonID); |
| | | dw_detail.Redraw(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | //ä¸ææ¡ æä¾å
容 |
| | | AttachEvent("dw_detail", "DWV_CHILDCONTENT", OnChildContent); |
| | | AttachEvent("dw_detail", "DWV_ITEMFOCUSCHANGED", OnClicked); |
| | | } |
| | | |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_detail = new xdwtable__; |
| | | dw_detail.setNativePointer(this.GetControl("dw_detail")); |
| | | dw_detail.openUrl("ç»ç»æ¶æ.vface/template/HrOrg/detail"); |
| | | OnInitial(); |
| | | |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = this.GetParam(); |
| | | if (arg) |
| | | { |
| | | m_operate = arg.GetArgString("operate"); |
| | | m_sguid = arg.GetArgString("guid"); |
| | | m_tvOrgID = arg.GetArgString("tvOrgID");//ç»ç»æ çID |
| | | m_tvOrgName = arg.GetArgString("tvOrgName");//ç»ç»æ çName |
| | | m_tvRootOrgID = arg.GetArgString("tvRootOrgID");//ç»ç»æ çID |
| | | m_tvRootOrgName = arg.GetArgString("tvRootOrgName");//ç»ç»æ çName |
| | | //alert(m_tvRootOrgName); |
| | | } |
| | | /*if ( m_sguid == "" || m_sguid == nil) |
| | | { |
| | | m_sguid = win__::GetGuid();//é误 |
| | | trace(m_sguid); |
| | | }*/ |
| | | if (m_sguid != "") { |
| | | OnRetrieve(); |
| | | }; |
| | | if (m_operate == "new0") |
| | | { |
| | | //trace(m_tvOrgID); |
| | | dw_detail.SetItemString(1, "ParentOrgID", m_tvOrgID); |
| | | dw_detail.SetItemDisplayString(1, "ParentOrgID", m_tvOrgName); |
| | | dw_detail.SetItemString(1, "CompanyID", m_tvRootOrgID); |
| | | dw_detail.SetItemDisplayString(1, "CompanyID", m_tvRootOrgName); |
| | | dw_detail.SetItemString(1, "Status", "Y"); |
| | | //dw_detail.SetItemDisplayString(1,"Status","ææ"); |
| | | } |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "treeview.vm" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "list.vl" |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrOrgType is extend list; |
| | | about HrOrgType |
| | | [ |
| | | control: |
| | | |
| | | method: |
| | | [ |
| | | xdwgrid__ dw_list; |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | if (agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent(anode, s); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt, int p) |
| | | { |
| | | SetAgent(); |
| | | |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | int hIcon = xutil__::SetCursorWait(); |
| | | |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | var xdoc = x.GetXmlDoc(); |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllTo(xdoc);//dw_list.DwUpdateAllTo(xdoc); //dw_list.DwUpdateTo(xdoc); |
| | | |
| | | string val = xdoc.xml; |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("content", val); |
| | | //trace(val); |
| | | //return 1; |
| | | if (url::post("OrganizationStruct/update.HrOrgType", args.GetString(), x) != 1) |
| | | { |
| | | string error = x.GetXmlDoc().text; |
| | | trace(error); |
| | | xutil__::RestoreCursor(hIcon); |
| | | return -1; |
| | | } |
| | | |
| | | xutil__::RestoreCursor(hIcon); |
| | | win__::MessageBox(GetHWND(), "ä¿åæåï¼", "æç¤º", 0); |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | int hIcon = xutil__::SetCursorWait(); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | //arg.AddArg("guid","xxx"); |
| | | if (url::post("OrganizationStruct/list.HrOrgType", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | xutil__::RestoreCursor(hIcon); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAddrow() |
| | | { |
| | | dw_list.InsertRow(0); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertrow() |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if (row < 1) return 0; |
| | | dw_list.InsertRow(row); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if (row < 1) return 0; |
| | | |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sguid = e.selectSingleNode("Code").text; //e.getAttribute("guid"); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid", sguid); |
| | | //trace(sguid); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | if (url::post("OrganizationStruct/delete.HrOrgType", arg.GetString(), x) != 1) |
| | | { |
| | | string error = x.GetXmlDoc().text; |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | dw_list.DeleteRow(row); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "save") OnSave(); |
| | | else if (comdid == "addrow") OnAddrow(); |
| | | else if (comdid == "insertrow") OnInsertrow(); |
| | | else if (comdid == "deleterow") OnDeleteRow(); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | dw_list.openUrl("ç»ç»æ¶æ.vface/template/HrOrg/orgtype"); |
| | | //dw_list.SetSelectionMode(1); |
| | | //dw_list.SetReadOnly(true); |
| | | |
| | | OnInitial(); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "frame.vl" |
| | | use "treeview.vm" |
| | | use "dev:code[HrEmployee.vx]" |
| | | use "publiccode.vl" |
| | | |
| | | //unit vclient.vobject tpp |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrPersonAdd is extend frame; |
| | | about HrPersonAdd |
| | | [ |
| | | field: |
| | | [ |
| | | HrEmployee lw_obj; |
| | | xdwgrid__ dw_list; |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | string m_sTxt; |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | if (agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent(anode, s); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt, int param) |
| | | { |
| | | SetAgent(); |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl("QueryTxt")); |
| | | m_sTxt = xc.GetText() + ""; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sTxt", m_sTxt); |
| | | if (url::post("OrganizationStruct/select.Person", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnOK(string comdid) |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = win__::GetParam(); |
| | | arg.AddArg("comdid", comdid); |
| | | |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | alert("è¯·éæ©äººå!"); |
| | | return 1; |
| | | } |
| | | |
| | | while (row > 0) |
| | | { |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sPersonID = e.selectSingleNode("PersonID").text + ""; |
| | | string sPersonName = e.selectSingleNode("Name").text + ""; |
| | | arg.AddArg("sPersonID", sPersonID); |
| | | arg.AddArg("sPersonName", sPersonName); |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "xmOk") |
| | | OnOK(comdid); |
| | | else if (comdid == "query") |
| | | OnRetrieve(); |
| | | else if (comdid == "xmCancel") |
| | | CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt, int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | dw_list.openUrl("ç»ç»æ¶æ.vface/template/HrEmployee/PersonSel"); |
| | | dw_list.SetSelectionMode(4); //3 |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | OnInitial(); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "frame.vl" |
| | | use "publiccode.vl" |
| | | |
| | | //unit vclient.vobject tpp |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrPersonMaint is extend frame; |
| | | about HrPersonMaint |
| | | [ |
| | | control: |
| | | |
| | | method: |
| | | [ |
| | | xdwtable__ dw_1; |
| | | string m_operate; |
| | | string m_sguid; |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | if (agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent(anode, s); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt, int p) |
| | | { |
| | | SetAgent(); |
| | | |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | int hIcon = xutil__::SetCursorWait(); |
| | | |
| | | string val; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | var xdoc = x.GetXmlDoc(); |
| | | dw_1.AcceptText(); |
| | | dw_1.DwUpdateAllTo(xdoc); |
| | | val = xdoc.xml; |
| | | //trace(val); |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("content", val); |
| | | //trace(m_EntityValueEx); |
| | | //trace(val); |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("OrganizationStruct/update.HrPerson", args.GetString(), x1) != 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | trace(x1.GetXml()); |
| | | win__::MessageBox(GetHWND(), "ä¿åæåï¼", "æç¤º", 0); |
| | | } |
| | | dw_1.ResetUpdateStatus(); |
| | | xutil__::RestoreCursor(hIcon); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAddRow() |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_1.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "HrEmployee") |
| | | dw.InsertRow(0); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_1.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "HrEmployee") |
| | | { |
| | | int row = dw.GetRow(); |
| | | dw.InsertRow(row); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_1.GetCurTable()); |
| | | string dw_n = dw.GetDwName(); |
| | | if (dw_n == "HrEmployee") |
| | | { |
| | | int row = dw.GetRow(); |
| | | dw.DeleteRow(row); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnUpdateAssignmentView() |
| | | { |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("OrganizationStruct/update.Assignmentview", "", x1) != 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | trace(x1.GetXml()); |
| | | win__::MessageBox(GetHWND(), "æ´æ°æåï¼", "æç¤º", 0); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "Save") OnSave(); |
| | | else if (comdid == "AddRow") OnAddRow(); |
| | | else if (comdid == "InsertRow") OnInsertRow(); |
| | | else if (comdid == "DeleteRow") OnDeleteRow(); |
| | | else if (comdid == "Close") CloseWindow(); |
| | | else if (comdid == "UpdateAssignmentView") |
| | | OnUpdateAssignmentView(); |
| | | return 0; |
| | | } |
| | | |
| | | int OnChildContent(ref TNotifyEvent evt, int p) { |
| | | ref DWNMHDR dwhdr = evt.pnmh; |
| | | string col = dwhdr.colname; |
| | | if (col != "") { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | string query; |
| | | query = "[IResourceMSSql.xq]"; |
| | | if (col == "PositionID") { |
| | | arg.AddArg("ResourceType", "HrPosition"); |
| | | } |
| | | if (xaserver__::ExecXQuery(GetServerUrl(), query, arg.GetString(), x) == 1) |
| | | dwhdr.data = x.GetXml(); |
| | | //trace(x.GetXml()); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnItemChanged(ref TNotifyEvent evt, int p) |
| | | { |
| | | int HCursor = xutil__::SetCursorWait(); |
| | | |
| | | ref DWNMHDR dwhdr = evt.pnmh; |
| | | int row = dwhdr.row; |
| | | string col = dwhdr.colname; |
| | | string data = dwhdr.data; |
| | | trace(row); |
| | | |
| | | if (col == "Name") |
| | | { |
| | | string Name = dw_1.GetItemString(1, "Name", 0); |
| | | |
| | | xml__ xs = new xml__; |
| | | xs.setNativePointer(xs.CreateInstance()); |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("Name", Name); |
| | | if (url::get("/sale/data/ManpowerFile/GetUserName", args.GetString(), xs) != 1) |
| | | { |
| | | trace(xs.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMNodeList items = xs.GetXmlDoc().selectNodes("data/Item"); |
| | | int len = items.length; |
| | | if (len != 0) |
| | | { |
| | | msxml::IXMLDOMNode t = items.item(0); |
| | | |
| | | string english_name = ""; |
| | | string sex = ""; |
| | | string sexex = ""; |
| | | string birth_date = ""; |
| | | string contact = ""; |
| | | string induction_time = ""; |
| | | string household_register = ""; |
| | | string EmailAddress = ""; |
| | | if (t.selectSingleNode("english_name")) english_name = t.selectSingleNode("english_name").text; |
| | | if (t.selectSingleNode("sex")) sex = t.selectSingleNode("sexex").text; |
| | | if (t.selectSingleNode("sexex")) sexex = t.selectSingleNode("sexex").text; |
| | | if (t.selectSingleNode("birth_date")) birth_date = t.selectSingleNode("birth_date").text; |
| | | if (t.selectSingleNode("contact")) contact = t.selectSingleNode("contact").text; |
| | | if (t.selectSingleNode("induction_time")) induction_time = t.selectSingleNode("induction_time").text; |
| | | if (t.selectSingleNode("household_register")) household_register = t.selectSingleNode("household_register").text; |
| | | if (t.selectSingleNode("EmailAddress")) EmailAddress = t.selectSingleNode("EmailAddress").text; |
| | | |
| | | dw_1.SetItemString(1, "NickName", english_name); |
| | | dw_1.SetItemDisplayString(1, "Gender", sexex); |
| | | dw_1.SetItemString(1, "Gender", sex); |
| | | dw_1.SetItemString(1, "Birthday", birth_date); |
| | | dw_1.SetItemString(1, "Mobile", contact); |
| | | dw_1.SetItemString(1, "HireDate", induction_time); |
| | | dw_1.SetItemString(1, "BirthPlace", household_register); |
| | | dw_1.SetItemString(1, "Email", EmailAddress); |
| | | } |
| | | } |
| | | |
| | | } |
| | | if (col == "PositionID") |
| | | { |
| | | xdwtable__ dw_HrEmployee = new xdwtable__; |
| | | dw_HrEmployee.setNativePointer(dw_1.FindDwTable("HrEmployee")); |
| | | string sPositionID = dw_HrEmployee.GetItemString(row, "PositionID"); |
| | | |
| | | if (sPositionID == "" || sPositionID == nil) |
| | | return 1; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid", sPositionID); |
| | | arg.AddArg("type", "GetOrgIDJobID"); |
| | | //trace(arg.GetString()); |
| | | if (url::get("OrganizationStruct/GetOrgIDJobID", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMDocument xdoc = x.GetXmlDoc(); |
| | | //IXMLDOMNodeList nlist = xdoc.getElementsByTagName("OrgID"); |
| | | msxml::IXMLDOMElement e = xdoc.documentElement; |
| | | string sOrgID = e.SelectSingleNode("@OrgID").text; |
| | | string sJobID = e.SelectSingleNode("@JobID").text; |
| | | dw_HrEmployee.SetItemString(row, "OrgID", sOrgID); |
| | | dw_HrEmployee.SetItemString(row, "JobID", sJobID); |
| | | string sdate = publiccode::GetCurDate() + ""; |
| | | dw_HrEmployee.SetItemString(row, "StartDate", sdate + ""); |
| | | dw_HrEmployee.SetItemString(row, "EndDate", "2050-12-31"); |
| | | } |
| | | } |
| | | |
| | | xutil__::RestoreCursor(HCursor); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | //ä¸ææ¡ æä¾å
容 |
| | | AttachEvent("dw_detail", "DWV_CHILDCONTENT", OnChildContent); |
| | | //å
容æ¹å |
| | | AttachEvent("dw_detail", "DWV_ITEMCHANGED", OnItemChanged); |
| | | // |
| | | //AttachEvent("dw_detail","DWV_ITEMFOCUSCHANGED",OnItemFocusChanged); |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid", m_sguid); |
| | | if (url::get("OrganizationStruct/detail.HrPerson", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_1.Retrieve(x); |
| | | dw_1.Redraw(); |
| | | //trace(x.GetXml()); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | |
| | | dw_1 = new xdwtable__; |
| | | dw_1.setNativePointer(this.GetControl("dw_detail")); |
| | | dw_1.openUrl("ç»ç»æ¶æ.vface/template/HrPerson/maint"); |
| | | OnInitial(); |
| | | |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = this.GetParam(); |
| | | if (arg) |
| | | { |
| | | m_operate = arg.GetArgString("operate"); |
| | | m_sguid = arg.GetArgString("guid"); |
| | | } |
| | | |
| | | /*if ( m_sguid == "" || m_sguid == nil) |
| | | { |
| | | string val; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | var xdoc = x.GetXmlDoc(); |
| | | dw_1.DwUpdateTo(xdoc); |
| | | val = xdoc.xml ; |
| | | |
| | | xml__ xx = new xml__; |
| | | xx.setNativePointer(xx.CreateInstance()); |
| | | xx.loadXML(val); |
| | | msxml::IXMLDOMElement e; |
| | | e = xx.GetXmlDoc().selectSingleNode("HrPerson"); |
| | | if (e) |
| | | { |
| | | string sguid = e.getAttribute("guid"); |
| | | m_sguid = sguid; |
| | | } |
| | | //trace(m_sguid); |
| | | }*/ |
| | | if (m_sguid != "") |
| | | OnRetrieve(); |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "frame.vl" |
| | | use "treeview.vm" |
| | | use "dev:code[HrEmployeex.vx]" |
| | | use "publiccode.vl" |
| | | |
| | | //unit vclient.vobject tpp |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrPersonSel is extend frame; |
| | | about HrPersonSel |
| | | [ |
| | | field: |
| | | [ |
| | | HrEmployeex lw_obj; |
| | | xdwgrid__ dw_list; |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | string m_sTxt; |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | if (agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent(anode, s); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt, int param) |
| | | { |
| | | SetAgent(); |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl("QueryTxt")); |
| | | m_sTxt = xc.GetText() + ""; |
| | | string query = "[MSSqlHrJob.xq]"; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sTxt", m_sTxt); |
| | | //if (xaserver__::ExecXQuery(GetServerUrl(),query,arg.GetString(),x)!=1 |
| | | if (url::post("OrganizationStruct/select.Employee", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnOK() |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = win__::GetParam(); |
| | | arg.AddArg("comdid", "xmOk"); |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | alert("è¯·éæ©äººå!"); |
| | | return 1; |
| | | } |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | trace(e.xml); |
| | | string EmployeeID = e.selectSingleNode("EmployeeID").text + ""; |
| | | string Name = e.selectSingleNode("Name").text + ""; |
| | | arg.AddArg("EmployeeID", EmployeeID); |
| | | arg.AddArg("Name", Name); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "xmOk") |
| | | OnOK(); |
| | | else if (comdid == "query") |
| | | { |
| | | OnRetrieve(); |
| | | } |
| | | else if (comdid == "xmCancel") |
| | | CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt, int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | dw_list.openUrl("ç»ç»æ¶æ.vface/template/HrEmployee/PersonSel"); |
| | | dw_list.SetSelectionMode(3); //3 |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | OnInitial(); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "frame.vl" |
| | | use "treeview.vm" |
| | | |
| | | //unit vclient.vobject tpp |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrPosition is extend frame; |
| | | about HrPosition |
| | | [ |
| | | field: |
| | | [ |
| | | treeview__ tv_org; |
| | | xdwgrid__ dw_list; |
| | | string sOrgID; |
| | | string sOrgName; |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | if (agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent(anode, s); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt, int param) |
| | | { |
| | | SetAgent(); |
| | | |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve(string ls_orgid) |
| | | { |
| | | string query = "[MSSqlHrPosition.xq]"; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("orgID", ls_orgid); |
| | | //if (xaserver__::ExecXQuery(GetServerUrl(),query,arg.GetString(),x)!=1) |
| | | if (url::post("OrganizationStruct/list.Position", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | //trace(x.GetXml()); |
| | | //dw_list.openUrl("ç»ç»æ¶æ.vface/template/HrPosition/list"); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TXCommandEvent evt, int p) |
| | | { |
| | | int wid = tv_org.GetId(); |
| | | int hitem = treeview__::GetSelectedItem(wid); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid, hitem); |
| | | string ls_orgid = ele.selectSingleNode("@guid").text; |
| | | sOrgID = ls_orgid + ""; |
| | | sOrgName = ele.selectSingleNode("OrgName").text; |
| | | OnRetrieve(ls_orgid); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | |
| | | string xdata = x.GetXml(); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("xdata", xdata); |
| | | //trace(x.GetXml()); |
| | | //return 1; |
| | | |
| | | //string xAction="[MSSqlHrPositionUpdate.xa]"; |
| | | //if(xaserver__::ExecXAction(GetServerUrl(),xAction,arg.GetString())!=1) |
| | | if (url::post("OrganizationStruct/update.Position", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().documentElement.text); |
| | | alert("ä¿å失败1"); |
| | | } |
| | | else |
| | | { |
| | | dw_list.ResetUpdateStatus(); |
| | | alert("ä¿åæå"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnAddRow() |
| | | { |
| | | int wid = tv_org.GetId(); |
| | | int hitem = treeview__::GetSelectedItem(wid); |
| | | if (!hitem) |
| | | { |
| | | alert("è¯·éæ©ç»ç»æ¶æï¼"); |
| | | return 0; |
| | | } |
| | | //openUrl("ç»ç»æ¶æ.vface/xpage/Hr/HrPositionAdd", this); |
| | | OpenWindow("dev:xpage[HrPositionAdd.vx]", this); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | dw_list.InsertRow(row); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if (row > 0) |
| | | { |
| | | string sPositionName = dw_list.GetItemString(row, "PositionName", 0); |
| | | int del_flog = win__::MessageBox(0, "ç¡®å®è¦å é¤éä¸çå²ä½ " + sPositionName + " åï¼", "æç¤º", 4); |
| | | if (del_flog == 7) { return 0; } |
| | | //夿HrEmployeeé颿¯å¦åå¨è¯¥å²ä½ |
| | | //string sPositionID = dw_list.GetItemString(row,"PositionID",0); |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sPositionID = e.selectSingleNode("@guid").text; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("guid", sPositionID); |
| | | //if(xaserver__::ExecXQuery(GetServerUrl(),"[HrpositionSel.xq]",args.GetString(),x)!=1) |
| | | if (url::post("OrganizationStruct/select.Position", args.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return 0; |
| | | } |
| | | var doc = x.GetXmlDoc(); |
| | | string cnt = doc.text; |
| | | int ll_cnt = cnt.toInt(); |
| | | if (ll_cnt == 0) //夿HrEmploeeé颿¯å¦åå¨è¯¥å²ä½ |
| | | { |
| | | args.ClearArgs(); |
| | | //xaserverarg__ Args = new xaserverarg__; |
| | | //Args.setNativePointer(Args.CreateInstance()); |
| | | args.AddArg("guid", sPositionID); |
| | | //if(xaserver__::ExecXAction(GetServerUrl(),"[HrPositionDel.xa]",Args.GetString(),x)!=1) |
| | | if (url::post("OrganizationStruct/delete.Position", args.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().documentElement.text); |
| | | alert("å é¤å¤±è´¥"); |
| | | } |
| | | else { |
| | | dw_list.DeleteRow(row); |
| | | alert("å 餿å"); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | alert("å
¶ä»å°æ¹å·²ç»ä½¿ç¨è¯¥å²ä½ï¼ä¸å
许å é¤ï¼"); |
| | | return 0; |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnChildContent(ref TNotifyEvent evt, int param) { |
| | | ref DWNMHDR dwhdr = evt.pnmh; |
| | | string col = dwhdr.colname; |
| | | if (col != "") { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | string query; |
| | | query = "[IResourceMSSql.xq]"; |
| | | if (col == "OrgID") { |
| | | arg.AddArg("ResourceType", "HrOrg"); |
| | | } |
| | | else if (col == "JobID") { |
| | | arg.AddArg("ResourceType", "HrJob"); |
| | | } |
| | | if (xaserver__::ExecXQuery(GetServerUrl(), query, arg.GetString(), x) == 1) |
| | | dwhdr.data = x.GetXml(); |
| | | //trace(x.GetXml()); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "Save") OnSave(); |
| | | else if (comdid == "AddRow") OnAddRow(); |
| | | else if (comdid == "InsertRow") OnInsertRow(); |
| | | else if (comdid == "DeleteRow") OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt, int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | //è·å¾æ çéæ©äºä»¶ |
| | | AttachEvent("tv_org", "TVN_SELCHANGED", OnTreeSelChanged); |
| | | //AttachEvent("dw_list","DWV_CHILDCONTENT",OnChildContent); |
| | | //AttachEvent("dw_list","DWV_ITEMCHANGED",OnItemChanged); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | tv_org = new treeview__; |
| | | tv_org.setNativePointer(this.GetControl("tv_org")); |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | dw_list.openUrl("ç»ç»æ¶æ.vface/template/HrPosition/list"); |
| | | |
| | | OnInitial(); |
| | | |
| | | int wid = tv_org.GetId(); |
| | | int root = treeview__::GetRootItem(wid); |
| | | treeview__::ExpandItem(wid, root); |
| | | //OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "frame.vl" |
| | | use "treeview.vm" |
| | | use "dev:code[HrPosition.vx]" |
| | | use "HrPosition.vx" |
| | | |
| | | //unit vclient.vobject tpp |
| | | unit vbusiness.xpage |
| | | [ |
| | | HrPositionAdd is extend frame; |
| | | about HrPositionAdd |
| | | [ |
| | | field: |
| | | [ |
| | | HrPosition lw_obj; |
| | | xdwgrid__ dw_list; |
| | | treeview__ tv_1; |
| | | string m_type; |
| | | |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | if (agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent(anode, s); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt, int param) |
| | | { |
| | | //SetAgent(); |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | string query = "[MSSqlHrJob.xq]"; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("type", m_type); |
| | | //if (xaserver__::ExecXQuery(GetServerUrl(),query,arg.GetString(),x)!=1 |
| | | if (url::post("OrganizationStruct/list.Job", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TNotifyEvent evt, int p) { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int hItem = nmtv.itemNew.hItem; |
| | | |
| | | int wid = tv_1.GetId(); |
| | | int hItem = treeview__::GetSelectedItem(wid); |
| | | int rootItem = treeview__::GetRootItem(wid); |
| | | if (hItem <= 0 || hItem == rootItem) |
| | | { |
| | | m_type = "all"; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid, hItem); |
| | | m_type = ele.SelectSingleNode("@name").text; |
| | | } |
| | | OnRetrieve(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree() |
| | | { |
| | | int wid = tv_1.GetId(); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | x.Load("<Type name='all'/>"); |
| | | msxml::IXMLDOMElement ele = x.GetXmlDoc().SelectSingleNode("Type"); |
| | | int hItem = tv_1.InsertChildItemEx(wid, 0, "å·¥ç§ç±»å", ele, 15, 4); |
| | | |
| | | if (url::post("/sale/data/OrganizationStruct/type.Job", "", x) != 1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | var list = x.GetXmlDoc().selectNodes("//Type"); |
| | | int i = 0, s = list.length; |
| | | msxml::IXMLDOMElement e; |
| | | string sname; |
| | | if (s > 0) |
| | | { |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | e = list.item(i); |
| | | sname = e.SelectSingleNode("@name").text; |
| | | int curItem = tv_1.InsertChildItemEx(wid, hItem, sname, e, 15, 4); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnOK() |
| | | { |
| | | if (GetParam()) |
| | | { |
| | | lw_obj = new HrPosition; |
| | | lw_obj.setNativePointer(GetParam()); |
| | | lw_obj = GetParam(); |
| | | } |
| | | else |
| | | return 0; |
| | | |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | alert("è¯·éæ©å·¥ç§!"); |
| | | return 1; |
| | | } |
| | | //treeview__ tv_org = new treeview__; |
| | | //tv_org.setNativePointer(lw_obj.tv_org); |
| | | int wid = lw_obj.tv_org.GetId(); |
| | | int hitem = treeview__::GetSelectedItem(wid); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid, hitem); |
| | | string sOrgID = ele.selectSingleNode("@guid").text; |
| | | string sOrgName = ele.selectSingleNode("OrgName").text; |
| | | while (row > 0) |
| | | { |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string sJobID = e.selectSingleNode("@guid").text + ""; |
| | | string sJobName = e.selectSingleNode("JobName").text + ""; |
| | | |
| | | int nRow = lw_obj.dw_list.InsertRow(0); |
| | | lw_obj.dw_list.SetItemString(nRow, "JobID", sJobID); |
| | | lw_obj.dw_list.SetItemDisplayString(nRow, "JobID", sJobName); |
| | | lw_obj.dw_list.SetItemString(nRow, "Status", "Y"); |
| | | lw_obj.dw_list.SetItemDisplayString(nRow, "Status", "ææ"); |
| | | lw_obj.dw_list.SetItemString(nRow, "OrgID", sOrgID); |
| | | lw_obj.dw_list.SetItemDisplayString(nRow, "OrgID", sOrgName); |
| | | lw_obj.dw_list.SetItemString(nRow, "PositionName", sOrgName + sJobName); |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "xmOk") |
| | | OnOK(); |
| | | else if (comdid == "xmCancel") |
| | | CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt, int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | //è·å¾æ çéæ©äºä»¶ |
| | | AttachEvent("tv_1", "TVN_SELCHANGED", OnTreeSelChanged); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | //SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | m_type = "all"; |
| | | tv_1 = new treeview__; |
| | | tv_1.setNativePointer(this.GetControl("tv_1")); |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | dw_list.openUrl("ç»ç»æ¶æ.vface/template/HrJob/list"); |
| | | dw_list.SetSelectionMode(3); //3 |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | OnInitial(); |
| | | OnCreateTree(); |
| | | int wid = tv_1.GetId(); |
| | | int hItem = treeview__::GetRootItem(wid); |
| | | tv_1.ExpandItem(wid, hItem); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |