¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | |
| | | ] |
| | | |
| | | ] |
| | | ] |