| | |
| | | <ClCompile Include="..\project\business\AR\maint.SettlementExchange.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\BasicCode\AccountUnitMaint.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\AddUomGroup.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\basicfareTypeList.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\brand.regtype.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\BrandInforList.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\BrandInforMaint.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\CartermList.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\ColorCardNew.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\CustomerMarketList.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\CustomerMarketMaint.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\ExchangeRate.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\ExpressList.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\ExpressMaint.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\FCL.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\ForwarderList.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\ForwarderMaint.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\FreightExpenseType.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\PaymentTerm.list.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\PaymentTerm.maint.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\ProfitParam.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\QuickCode.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\QuickCode_Tree.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\SetUpRemarks.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\ShipcompanyList.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\ShipcompanyMaint.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\Simple.Menu.Config.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\SKUItem.categoryselect.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\SKUItem.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\SKUItem.select.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\SKUTemplate.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\SKUTemplate.select.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\SourceRemark.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\SpecialDeductFeeList.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\TestingCompanyList.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\TestingCompanyMaint.cpp" /> |
| | | <ClCompile Include="..\project\business\BasicCode\TypeList.maint.supplier.cpp" /> |
| | | <ClCompile Include="..\project\business\Company\CompanyList.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | </ClCompile> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | |
| | | unit trade |
| | | [ |
| | | class AccountUnitMaintWin : public xwin |
| | | { |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | { |
| | | SetAgentNodeContent (anode,m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid=="xmAddRow") |
| | | { |
| | | dw_list.InsertRow(0); |
| | | return 1; |
| | | } |
| | | else if(comdid=="xmDeleteRow") |
| | | { |
| | | dw_list.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | else if(comdid=="xmSave") |
| | | return OnSave(); |
| | | else if(comdid=="xmRefresh") |
| | | return OnRetrieve(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml x=new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | xaserverarg arg=new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content",x.GetXml()); |
| | | if (url::get("/sale/data/TradeFinance3/accountunit/update",arg.GetString(),x) != 1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("ä¿å失败!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | trace(x.GetXml()); |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert("ä¿ååºé2!"); |
| | | return 0; |
| | | } |
| | | win32::MessageBox(GetHWND(),"ä¿åæåï¼","æç¤º",0); |
| | | dw_list.ResetUpdateStatus(); |
| | | } |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | if (url::get("/sale/data/TradeFinance3/accountunit/list",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.openUrl("/sale/view/FinancialCode/template/AccountUnit"); |
| | | dw_list.SetColumnState("TAUID",false); |
| | | |
| | | OnRetrieve(); |
| | | |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | 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[control.vm]" |
| | | |
| | | unit vbusiness.xpage |
| | | [ |
| | | AddUomGroup is extend win__; |
| | | about AddUomGroup |
| | | [ |
| | | control: |
| | | |
| | | method: |
| | | [ |
| | | |
| | | |
| | | int SetAgent() |
| | | { |
| | | return 1; |
| | | } |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int p) |
| | | { |
| | | int SetAgent(); |
| | | |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid=="cb_cancel") |
| | | CloseWindow(); |
| | | else if(comdid=="cb_ok") |
| | | { |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl("Txt")); |
| | | string name = xc.GetText(); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = GetParam(); |
| | | arg.AddArg("GroupName",name); |
| | | arg.AddArg("return","ok"); |
| | | CloseWindow(); |
| | | } |
| | | 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() |
| | | { |
| | | OnInitial(); |
| | | |
| | | if(this.GetParam()) |
| | | { |
| | | |
| | | if (GetParam()) |
| | | { |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = GetParam(); |
| | | string note = arg.GetArgString("note"); |
| | | if(note=="ä¿®æ¹") |
| | | { |
| | | string name = arg.GetArgString("GroupName"); |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(GetControl("Txt")); |
| | | xc.SetText(name); |
| | | } |
| | | string id = arg.GetArgString("m_id"); |
| | | if(id =="FND_UOM") |
| | | { |
| | | win__::SetWindowText(this.GetHWND(),"计éåä½"); |
| | | } |
| | | else if(id =="FND_CustomerSource") |
| | | { |
| | | win__::SetWindowText(this.GetHWND(),"å®¢æ·æ¥æº"); |
| | | } |
| | | else if(id =="FND_AuxiliaryAttribute") |
| | | { |
| | | win__::SetWindowText(this.GetHWND(),"è¾
å©å±æ§"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "system.vl" |
| | | use "win.vl" |
| | | use "list.vl" |
| | | unit vbusiness.entity |
| | | [ |
| | | BrandInforList is extend list; |
| | | about BrandInforList |
| | | [ |
| | | |
| | | |
| | | method: |
| | | [ |
| | | int ViewUpdate(param pr,string updateItem,xaserverarg__ arg) |
| | | { |
| | | if( updateItem=="del"){ |
| | | int DelRow = this.dw_list.GetRow(); |
| | | this.dw_list.DeleteRow(DelRow); |
| | | } |
| | | return 1; |
| | | } |
| | | int onload() |
| | | { |
| | | list::onload(); |
| | | return -1; |
| | | } |
| | | |
| | | ] |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "system.vl" |
| | | use "win.vl" |
| | | use "maint.vl" |
| | | use "file.vl" |
| | | use "dev:vm[xcell.vm]" |
| | | use "publiccode.vl" |
| | | use "dev:vm[pagecontrol.vm]" |
| | | unit vbusiness.entity |
| | | [ |
| | | BrandInforMaint is extend maint; |
| | | about BrandInforMaint |
| | | [ |
| | | field: |
| | | [ |
| | | msxml::IXMLDOMDocument m_configDoc; |
| | | string m_userid; |
| | | string m_username; |
| | | string ContactID; |
| | | xdwtable__ dw_base; |
| | | xcell__ dw_cell; |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | int alert(string str) |
| | | { |
| | | //win__::MessageBox(this.GetHWND(),str,"æç¤º22:",0); |
| | | TApp::alert(this,str); |
| | | return 0; |
| | | } |
| | | int ViewUpdate(param pr,string updateItem,xaserverarg__ arg) |
| | | { |
| | | if(updateItem=="update") |
| | | { |
| | | |
| | | dw_base.ResetUpdateStatus(); |
| | | return 1; |
| | | } |
| | | } |
| | | string GetEntityData(param pr) |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | dw_base.DwUpdateAllTo(x.GetXmlDoc()); |
| | | //trace("------x"); |
| | | trace(x.GetXml()); |
| | | return x.GetXml(); |
| | | } |
| | | int onload() |
| | | { |
| | | maint::onload(); |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(GetControl("dw_base")); |
| | | |
| | | dw_base.SetColHeaderHeight(0); |
| | | dw_base.SetRowSelectorWidth(0); |
| | | |
| | | dw_base.SetScrollState(false); |
| | | |
| | | |
| | | /*if (!maint::m_EntityID) |
| | | { |
| | | //string suserid = TApp::GetUserInfo().id; |
| | | string suserid = xaserver__::GetUserId(); |
| | | string susername = TApp::GetUserInfo().name; |
| | | string sdate = TApp::GetCurDate(); |
| | | dw_base.SetItemString(dw_base.GetRow(),"CreatorID",suserid);//Party |
| | | dw_base.SetItemDisplayString(dw_base.GetRow(),"CreatorID",susername); |
| | | dw_base.SetItemString(dw_base.GetRow(),"CreateDate",sdate); |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("id", suserid); |
| | | if(xaserver__::ExecXQuery("","[OrgInfo.xq]",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return nil; |
| | | } |
| | | //alert(x.GetXml()); |
| | | msxml::IXMLDOMElement e= x.GetXmlDoc().documentElement; |
| | | trace(e.xml); |
| | | if(e.selectSingleNode("orgid")) |
| | | { |
| | | string orgid= e.selectSingleNode("orgid").text; |
| | | dw_base.SetItemString(1,"OrgID",orgid); |
| | | } |
| | | |
| | | if(e.selectSingleNode("orgname")) |
| | | { |
| | | string orgname = e.selectSingleNode("orgname").text; |
| | | dw_base.SetItemDisplayString(1,"OrgID",orgname); |
| | | } |
| | | }*/ |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "system.vl" |
| | | use "win.vl" |
| | | use "list.vl" |
| | | use "file.vl" |
| | | unit vbusiness.entity |
| | | [ |
| | | CartermList is extend list; |
| | | about CartermList |
| | | [ |
| | | field: |
| | | [ |
| | | xdwpages__ dw_pages; |
| | | string m_QueryTxt; |
| | | msxml::IXMLDOMDocument m_configDoc; |
| | | static int dw_hWnd; |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | |
| | | int alert(string str) |
| | | { |
| | | //win__::MessageBox(this.GetHWND(),str,"æç¤º22:",0); |
| | | TApp::alert(this,str); |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | string GetGuid(){ |
| | | return TApp::GetGuid(); |
| | | } |
| | | int OnAddrow() |
| | | { |
| | | this.dw_list.InsertRow(0); |
| | | int rows = this.dw_list.GetRowCount(); |
| | | this.dw_list.SetRow(rows); |
| | | this.dw_list.SetItemString(rows,"PartyID",GetGuid()); |
| | | this.dw_list.SetItemString(rows,"ContactID",GetGuid()); |
| | | this.dw_list.SetItemString(rows,"PAStatus","1"); |
| | | this.dw_list.SetItemString(rows,"PStatus","1"); |
| | | this.dw_list.SetItemString(rows,"PCStatus","1"); |
| | | this.dw_list.SetItemString(rows,"Type","7"); |
| | | } |
| | | int OnInsertRow() |
| | | { |
| | | int row = this.dw_list.GetRow(); |
| | | if(row<1 || row>this.dw_list.GetRowCount()) return 0; |
| | | this.dw_list.InsertRow(row); |
| | | this.dw_list.SetItemString(row,"PartyID",GetGuid()); |
| | | this.dw_list.SetItemString(row,"ContactID",GetGuid()); |
| | | this.dw_list.SetItemString(row,"PAStatus","1"); |
| | | this.dw_list.SetItemString(row,"PStatus","1"); |
| | | this.dw_list.SetItemString(row,"PCStatus","1"); |
| | | this.dw_list.SetItemString(row,"Type","7"); |
| | | } |
| | | |
| | | int ViewUpdate(param pr,string updateItem,xaserverarg__ arg) |
| | | { |
| | | if( updateItem=="del") |
| | | { |
| | | int DelRow = this.dw_list.GetRow(); |
| | | this.dw_list.DeleteRow(DelRow); |
| | | |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int rows = this.dw_list.GetRowCount(); |
| | | int row2 = this.dw_list.GetPrevSelectRow(rows); |
| | | while(row2 > 0){ |
| | | this.dw_list.DeleteRow(row2); |
| | | row2 = this.dw_list.GetPrevSelectRow(row2 - 1); |
| | | } |
| | | this.dw_list.SelectRow(0, false); |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | /*string no = this.dw_list.GetItemString(1,"CarTermNo"); |
| | | if(no==""){ |
| | | alert("请è¾å
¥è½¦éç¼ç ï¼"); |
| | | return -1; |
| | | } |
| | | string SName = this.dw_list.GetItemString(1,"Name"); |
| | | if(SName==""){ |
| | | alert("请è¾å
¥è½¦éåç§°ï¼"); |
| | | return -1; |
| | | } |
| | | string ContacterName = this.dw_list.GetItemString(1,"ContacterName"); |
| | | if(ContacterName==""){ |
| | | alert("请è¾å
¥è系人åç§°ï¼"); |
| | | return -1; |
| | | } */ |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | this.dw_list.AcceptText(); |
| | | this.dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | trace(x.GetXml()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content",x.GetXml()); |
| | | arg.AddArg("dbmap","CarTerm.dbmap"); |
| | | if (getUrl("/sale/data/CarTerm/entity/carterm/save",arg.GetString(),x) != 1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("ä¿å失败!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | trace(x.GetXml()); |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert("ä¿ååºé2!"); |
| | | return 0; |
| | | } |
| | | alert("ä¿åæåï¼"); |
| | | this.dw_list.ResetUpdateStatus(); |
| | | } |
| | | this.dw_list.Redraw(); |
| | | return 0; |
| | | } |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid.find("action:bill.row.add",0)>=0) { |
| | | OnAddrow(); |
| | | } |
| | | else if(comdid.find("bill.row.insert",0)>=0) { |
| | | OnInsertRow(); |
| | | } |
| | | else if(comdid.find("bill.row.delete",0)>=0) { |
| | | OnDeleteRow(); |
| | | } |
| | | else if(comdid.find("bill.save",0)>=0) { |
| | | trace(1); |
| | | OnSave(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | return 0; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | OnAttachEvent(); |
| | | list::onload(); |
| | | this.dw_list.SetReadOnly(false); |
| | | return -1; |
| | | } |
| | | |
| | | ] |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | /*use "list.vd" |
| | | use "xtreeview.vd" |
| | | use "publiccode.vd"*/ |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | unit trade |
| | | [ |
| | | class ColorCardNew : public listwin |
| | | { |
| | | xdwgrid dw_list; |
| | | xdwgrid dw_detail; |
| | | bool ismodify; |
| | | xnode m_agentNode; |
| | | string m_agentCond; |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMNode agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | SetAgentNodeContent(anode, agent.xml); |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | SetAgent(); |
| | | |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | int ProcessFlowAction(string guid,string comdid) |
| | | { |
| | | //int pr = pr1; |
| | | //string action = comdid;//.mid(comdid.find("action:",0)+7,9999); |
| | | /*if(action == "bill.delete" || action == "bill.deleteEx") |
| | | { |
| | | if (MessageBox(GetHWND(),"æ¯å¦ç¡®å®å é¤è®°å½!","æç¤º1",1) == 2) |
| | | return 1; |
| | | }*/ |
| | | |
| | | xaserverarg arg0 = new xaserverarg ; |
| | | arg0.setNativePointer(arg0.CreateInstance()); |
| | | //arg0.AddArg("Action", action,"xs:string"); |
| | | arg0.AddArg("EntityName", "ColorCard","xs:string"); |
| | | arg0.AddArg("EntityIDName", "ColorCardID","xs:string"); |
| | | arg0.AddArg("EntityID", guid,"xs:string"); |
| | | arg0.AddArg("FunctionCode", comdid,"xs:string"); |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | |
| | | if(url::get("/sale/data/Role.config/sys/sql/action", arg0.GetString(), x) != 1) |
| | | { |
| | | //ismodify=false; |
| | | //dw_list.SetReadOnly(ismodify); |
| | | return -1; |
| | | } |
| | | string kk=x.GetXml(); |
| | | if(kk.find("<root/>",0)>=0) |
| | | { |
| | | //ismodify=true; |
| | | //dw_list.SetReadOnly(ismodify); |
| | | return 1; |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | int ModifyProcessAction(string guid,string comdid) |
| | | { |
| | | if(ProcessFlowAction(guid,comdid)>0) |
| | | { |
| | | ismodify=true; |
| | | dw_list.SetReadOnly(ismodify); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | ismodify=false; |
| | | dw_list.SetReadOnly(ismodify); |
| | | return -1; |
| | | } |
| | | } |
| | | int DeleteProcessAction(string guid,string comdid) |
| | | { |
| | | if(ProcessFlowAction(guid,comdid)>0) |
| | | { |
| | | return -1; //没ææé |
| | | } |
| | | else |
| | | { |
| | | return 1; //ææé |
| | | } |
| | | } |
| | | |
| | | //æ ¹æ®ColorCardIDå è½½Detailæ°æ® |
| | | int OnRetrieveDetail(string ColorCardID) |
| | | { |
| | | xml x=new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg=new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | |
| | | arg.AddArg("ColorCardID",ColorCardID); |
| | | if (url::get("ColorCard/entity/list1",arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | dw_detail.Retrieve(x); |
| | | dw_detail.Redraw(); |
| | | dw_detail.SetReadOnly(ismodify); |
| | | return 1; |
| | | } |
| | | |
| | | int OnPreSave() |
| | | { |
| | | if (dw_list) |
| | | { |
| | | string colorCardCName; |
| | | string colorCardName; |
| | | string orgID; |
| | | int i; |
| | | int row = dw_list.GetRowCount(); |
| | | for (i=1; i<=row;i++) |
| | | { |
| | | colorCardCName=dw_list.GetItemString(i,"ColorCardCName",0)+""; |
| | | colorCardName=dw_list.GetItemString(i,"ColorCardName",0)+""; |
| | | orgID=dw_list.GetItemString(i,"OrgID",0)+""; |
| | | if (colorCardCName=="" || !colorCardCName) |
| | | { |
| | | alert("第"+i.toString()+"è¡è²å¡åç§°ä¸æä¸ºç©º"); |
| | | return -1; |
| | | } |
| | | if (colorCardName=="" || !colorCardName) |
| | | { |
| | | alert("第"+i.toString()+"è¡è²å¡å称为空"); |
| | | return -1; |
| | | } |
| | | if (orgID=="" || !orgID) |
| | | { |
| | | alert("第"+i.toString()+"è¡å
³èç»ç»ä¸ºç©º"); |
| | | return -1; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return 1 ; |
| | | } |
| | | |
| | | //ä¿å |
| | | int OnSave() |
| | | { |
| | | dw_list.AcceptText(); |
| | | dw_detail.AcceptText(); |
| | | int rec; |
| | | rec = OnPreSave(); |
| | | if (rec == -1) |
| | | return -1; |
| | | xml x= new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | msxml::IXMLDOMElement e= x.GetXmlDoc().selectSingleNode("root"); |
| | | arg.AddArg("content",e.xml); |
| | | arg.AddArg("dbmap","ColorCard.dbmap"); |
| | | if (url::get("ColorCard/pref/colorcard.save",arg.GetString(),x) != 1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("ä¿å失败!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | alert("ä¿åæå!"); |
| | | dw_list.ResetUpdateStatus(); |
| | | } |
| | | dw_list.Redraw(); |
| | | } |
| | | |
| | | //æ°å¢ |
| | | int OnAdd() |
| | | { |
| | | dw_list.AcceptText(); |
| | | int nrow=dw_list.InsertRow(0); |
| | | dw_list.ShowRowTo(nrow); |
| | | string tempguid = publiccode::GetGuid(); |
| | | dw_list.SetItemString(nrow,"ColorCardID",tempguid); |
| | | OnRetrieveDetail(tempguid); |
| | | } |
| | | |
| | | //æå
¥ |
| | | int OnInsert() |
| | | { |
| | | dw_list.AcceptText(); |
| | | int row = dw_list.GetRow(); |
| | | if(row<1) return 0; |
| | | int nrow=dw_list.InsertRow(row); |
| | | string tempguid = publiccode::GetGuid(); |
| | | dw_list.SetItemString(nrow,"ColorCardID",tempguid); |
| | | OnRetrieveDetail(tempguid); |
| | | } |
| | | |
| | | //å é¤ |
| | | int OnDelete() |
| | | { |
| | | dw_list.AcceptText(); |
| | | int row = dw_list.GetRow(); |
| | | if(row<1) return 0; |
| | | string id=dw_list.GetItemString(row,"ColorCardID"); |
| | | if(DeleteProcessAction(id,"DeleteColorCard")<0) |
| | | { |
| | | alert("æ¨æ²¡ææéå é¤è¯¥æ°æ®"); |
| | | return -1; |
| | | } |
| | | if(id !="") |
| | | { |
| | | xml x=new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("ColorCardID", id); |
| | | if(url::get("ColorCard/pref/beforedelete",arg.GetString(),x)!=1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("å é¤åºé!"); |
| | | return 0; |
| | | } |
| | | msxml::IXMLDOMElement e= x.GetXmlDoc().documentElement; |
| | | if(e.selectSingleNode("error")) |
| | | { |
| | | alert(e.selectSingleNode("error").text); |
| | | return 0; |
| | | } |
| | | } |
| | | dw_list.DeleteRow(row); |
| | | } |
| | | |
| | | int OnAddRowDetail() |
| | | { |
| | | dw_detail.AcceptText(); |
| | | int nrow=dw_detail.InsertRow(0); |
| | | string tempguid = publiccode::GetGuid(); |
| | | dw_detail.SetItemString(dw_detail.GetRow(),"ColorCardID",dw_list.GetItemString(dw_list.GetRow(),"ColorCardID")); |
| | | dw_detail.SetItemString(dw_detail.GetRow(),"ColorID",tempguid); |
| | | //OnRetrieveDetail(tempguid); |
| | | dw_detail.ShowRowTo(nrow); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRowDetail() |
| | | { |
| | | dw_detail.AcceptText(); |
| | | int row = dw_detail.GetRow(); |
| | | if(row<1) return 0; |
| | | int nrow=dw_detail.InsertRow(row); |
| | | string tempguid = publiccode::GetGuid(); |
| | | dw_detail.SetItemString(dw_detail.GetRow(),"ColorCardID",dw_list.GetItemString(dw_list.GetRow(),"ColorCardID")); |
| | | dw_detail.SetItemString(dw_detail.GetRow(),"ColorID",tempguid); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnDelRowDetail() |
| | | { |
| | | int row = dw_detail.GetRow(); |
| | | int rowz = dw_list.GetRow(); |
| | | if(row<1)return 0; |
| | | dw_detail.DeleteRow(row); |
| | | msxml::IXMLDOMElement ez= this.dw_list.GetRowElement(rowz); |
| | | xml xz=new xml; |
| | | xz.setNativePointer(xml::CreateInstance()); |
| | | dw_detail.DwUpdateAllToEx(xz.GetXmlDoc()); |
| | | if (ez.selectSingleNode("root")) |
| | | ez.removeChild(ez.selectSingleNode("root")); |
| | | ez.appendChild(xz.GetXmlDoc().documentElement); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid=="save") OnSave(); |
| | | else if(comdid=="add") OnAdd(); |
| | | else if(comdid=="insert") OnInsert(); |
| | | else if(comdid=="del") OnDelete(); |
| | | else if(comdid=="addrowDetail") OnAddRowDetail(); |
| | | else if(comdid=="insertrowDetail") OnInsertRowDetail(); |
| | | else if(comdid=="deleterowDetail") OnDelRowDetail(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | //è¡æ¹åäºä»¶ |
| | | int OnListRowChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | dw_detail.AcceptText(); |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | int row = hdr.row; |
| | | dw_list.Redraw(); |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string ColorCardID = e.selectSingleNode("ColorCardID").text; |
| | | OnRetrieveDetail(ColorCardID); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnDetailChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | msxml::IXMLDOMElement e= this.dw_list.GetRowElement(row); |
| | | xml x=new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | dw_detail.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | if (e.selectSingleNode("root")) |
| | | e.removeChild(e.selectSingleNode("root")); |
| | | e.appendChild(x.GetXmlDoc().documentElement); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int OnDwListClick(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | int row = hdr.row; |
| | | dw_list.Redraw(); |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string ColorCardID = e.selectSingleNode("ColorCardID").text; |
| | | ModifyProcessAction(ColorCardID,"ModifyColorCard"); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | //è¡æ¹åäºä»¶ |
| | | AttachEvent("dw_list","DWV_ROWFOCUSCHANGED",OnListRowChanged); |
| | | AttachEvent("dw_detail","DWV_ITEMCHANGED",OnDetailChanged); |
| | | //AttachEvent("dw_list","DWV_ITEMCHANGED",OnDetailChanged); |
| | | AttachEvent("dw_list","DWV_CLICKED",OnDwListClick); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve(string str) |
| | | { |
| | | xml x=new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg=new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("id",str); |
| | | if (url::get("ColorCard/entity/list",arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | //doc=x; |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.openUrl("产å设置.vface/template/ColorCard/list"); |
| | | |
| | | dw_detail = GetControl("dw_detail"); |
| | | dw_detail.openUrl("产å设置.vface/template/ColorCard/listex"); |
| | | OnInitial(); |
| | | |
| | | OnRetrieve("FND_ColorCard"); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "system.vl" |
| | | use "win.vl" |
| | | use "list.vl" |
| | | unit vbusiness.entity |
| | | [ |
| | | CustomerMarketList is extend list; |
| | | about CustomerMarketList |
| | | [ |
| | | |
| | | |
| | | method: |
| | | [ |
| | | int ViewUpdate(param pr,string updateItem,xaserverarg__ arg) |
| | | { |
| | | if( updateItem=="del"){ |
| | | int DelRow = this.dw_list.GetRow(); |
| | | this.dw_list.DeleteRow(DelRow); |
| | | } |
| | | return 1; |
| | | } |
| | | int onload() |
| | | { |
| | | list::onload(); |
| | | return -1; |
| | | } |
| | | |
| | | ] |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "system.vl" |
| | | use "win.vl" |
| | | use "maint.vl" |
| | | use "file.vl" |
| | | use "dev:vm[xcell.vm]" |
| | | unit vbusiness.entity |
| | | [ |
| | | CustomerMarketMaint is extend maint; |
| | | about CustomerMarketMaint |
| | | [ |
| | | field: |
| | | [ |
| | | msxml::IXMLDOMDocument m_configDoc; |
| | | string m_userid; |
| | | string m_username; |
| | | string ContactID; |
| | | xdwtable__ dw_base; |
| | | xcell__ dw_cell; |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | int alert(string str) |
| | | { |
| | | //win__::MessageBox(this.GetHWND(),str,"æç¤º22:",0); |
| | | TApp::alert(this,str); |
| | | return 0; |
| | | } |
| | | int ViewUpdate(param pr,string updateItem,xaserverarg__ arg) |
| | | { |
| | | if(updateItem=="update") |
| | | { |
| | | |
| | | dw_base.ResetUpdateStatus(); |
| | | return 1; |
| | | } |
| | | } |
| | | string GetEntityData(param pr) |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | dw_base.DwUpdateAllTo(x.GetXmlDoc()); |
| | | //trace("------x"); |
| | | trace(x.GetXml()); |
| | | return x.GetXml(); |
| | | } |
| | | int onload() |
| | | { |
| | | maint::onload(); |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | if (!maint::m_EntityID) |
| | | { |
| | | //string suserid = TApp::GetUserInfo().id; |
| | | string suserid = xaserver__::GetUserId(); |
| | | string susername = TApp::GetUserInfo().name; |
| | | string sdate = TApp::GetCurDate(); |
| | | dw_base.SetItemString(dw_base.GetRow(),"CreatorID",suserid);//Party |
| | | dw_base.SetItemDisplayString(dw_base.GetRow(),"CreatorID",susername); |
| | | dw_base.SetItemString(dw_base.GetRow(),"CreateDate",sdate); |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("id", suserid); |
| | | if(xaserver__::ExecXQuery("","[OrgInfo.xq]",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return nil; |
| | | } |
| | | //alert(x.GetXml()); |
| | | msxml::IXMLDOMElement e= x.GetXmlDoc().documentElement; |
| | | trace(e.xml); |
| | | if(e.selectSingleNode("orgid")) |
| | | { |
| | | string orgid= e.selectSingleNode("orgid").text; |
| | | dw_base.SetItemString(1,"OrgID",orgid); |
| | | } |
| | | |
| | | if(e.selectSingleNode("orgname")) |
| | | { |
| | | string orgname = e.selectSingleNode("orgname").text; |
| | | dw_base.SetItemDisplayString(1,"OrgID",orgname); |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | use "base.view.vd" |
| | | |
| | | unit trade |
| | | [ |
| | | class ExchangeRateWin : public xframe |
| | | { |
| | | xdwgrid dw_list; |
| | | int hSignWin; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | { |
| | | SetAgentNodeContent (anode,m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | xml x0 = ViewObject::MakeXml(); |
| | | x0.LoadXml("<data/>"); |
| | | |
| | | msxml::IXMLDOMNodeList t = x.GetXmlDoc().selectNodes("data/Item[@update.modify='1' or @update.delete ='1']"); |
| | | msxml::IXMLDOMElement e1= x0.GetXmlDoc().documentElement; |
| | | int len = t.length; |
| | | for(int i=0;i<len;i++) |
| | | { |
| | | e1.appendChild(t.item(i)); |
| | | } |
| | | xaserverarg arg = ViewObject::MakeArg(); |
| | | arg.AddArg("content",x0.GetXml()); |
| | | trace(x0.GetXml()); |
| | | if(url::get("/sale/data/expense3/update/ExchangeRate", arg.GetString(),x)!=1) |
| | | { |
| | | string error = x.GetXmlDoc().text; |
| | | alert("err:"+error); |
| | | return 1; |
| | | } |
| | | string str = x.GetXmlDoc().documentElement.getAttribute("text"); |
| | | if(str == "true") |
| | | { |
| | | dw_list.ResetUpdateStatus(); |
| | | alert("ä¿åæå!"); |
| | | }else |
| | | { |
| | | alert("ä¿å失败!"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid=="xmAddRow") |
| | | { |
| | | string sdate = publiccode::GetCurrentDate(); |
| | | string suserid = publiccode::GetUser().id; |
| | | string susername = publiccode::GetUser().name; |
| | | int row =dw_list.GetRowCount(); |
| | | dw_list.InsertRow(0); |
| | | dw_list.SetItemString(row+1,"CreatorID",suserid); |
| | | dw_list.SetItemDisplayString(row+1,"CreatorID",susername); |
| | | dw_list.SetItemString(row+1,"CreateDate",sdate); |
| | | return 1; |
| | | } |
| | | else if(comdid=="xmDeleteRow") |
| | | { |
| | | dw_list.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmSave") |
| | | { |
| | | OnSave(); |
| | | } |
| | | else if (comdid == "xmRefresh") |
| | | { |
| | | OnRetrieve(); |
| | | } |
| | | else if(comdid =="ToUpdate") |
| | | { |
| | | ToUpdate(); |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | int ToUpdate() |
| | | { |
| | | string Months = dw_list.GetItemString(dw_list.GetRow(),"Months"); |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = win32::MessageBox(GetHWND(),"ç¡®è®¤æ´æ°"+Months+"çäºæ±ç?","æç¤º",MB_OKCANCEL); |
| | | if(ret == IDOK) |
| | | { |
| | | xml x = ViewObject::RetrieveData("/sale/data/Expense3/ExchangeRateUpdateEx","Months",Months); |
| | | string status = x.GetXml(); |
| | | if(status.find("ok") == 1) |
| | | { |
| | | alert("æ´æ°æå"); |
| | | }else |
| | | { |
| | | alert("æ´æ°å¤±è´¥"); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //触åé¼ æ 离å¼åtranäºä»¶ï¼éè¿æ¥æ¾æä¸ªåæ°å¾å°å¯¹åºçå |
| | | int OnBaseItemChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | string colname=hdr.colname; |
| | | string value = hdr.data; |
| | | |
| | | string dwname = "dw_list"; |
| | | if(value != "") |
| | | { |
| | | msxml::IXMLDOMNodeList nlist = GetElement().selectNodes("//*[@name='"+dwname+"']/trans[@for='"+colname+"']"); |
| | | ViewObject::TransData(nlist, dw_list, hdr.row, colname, value); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | 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_ITEMCHANGED",OnBaseItemChanged); |
| | | } |
| | | |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("QueryTxt",GetControl("search").GetText()); |
| | | |
| | | |
| | | if (getUrl("/sale/data/Expense3/ExchangeRateList",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.openUrl("/sale/view/Expense3/ExchangeRate"); |
| | | |
| | | |
| | | OnRetrieve(); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "system.vl" |
| | | use "win.vl" |
| | | use "list.vl" |
| | | unit vbusiness.entity |
| | | [ |
| | | ExpressList is extend list; |
| | | about ExpressList |
| | | [ |
| | | |
| | | |
| | | method: |
| | | [ |
| | | int onload() |
| | | { |
| | | list::onload(); |
| | | return -1; |
| | | } |
| | | |
| | | int ViewUpdate(param pr,string updateItem,xaserverarg__ arg) |
| | | { |
| | | |
| | | if( updateItem=="del") |
| | | { |
| | | int DelRow = this.dw_list.GetRow(); |
| | | this.dw_list.DeleteRow(DelRow); |
| | | |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | ] |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "system.vl" |
| | | use "win.vl" |
| | | use "maint.vl" |
| | | use "file.vl" |
| | | use "dev:vm[xcell.vm]" |
| | | unit vbusiness.entity |
| | | [ |
| | | ExpressMaint is extend maint; |
| | | about ExpressMaint |
| | | [ |
| | | field: |
| | | [ |
| | | msxml::IXMLDOMDocument m_configDoc; |
| | | xdwtable__ dw_base; |
| | | string m_userid; |
| | | string m_username; |
| | | string ContactID; |
| | | xcell__ dw_cell; |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | int alert(string str) |
| | | { |
| | | //win__::MessageBox(this.GetHWND(),str,"æç¤º22:",0); |
| | | TApp::alert(this,str); |
| | | return 0; |
| | | } |
| | | int setCellReadOnly() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | dw_cell = new xcell__; |
| | | dw_cell.setNativePointer(dw_base.QueryItem("ixcell")); |
| | | string strnew = "<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='ä¿æ¤' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''/>"; |
| | | dw_cell.SetCellProps(2,2,strnew); |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | string GetGuid(){ |
| | | return TApp::GetGuid(); |
| | | } |
| | | int OnClear(){ |
| | | if(this.m_EntityID ==""){ |
| | | trace(1); |
| | | m_userid = TApp::GetUserInfo().id; |
| | | m_username = TApp::GetUserInfo().name; |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | dw_base.SetItemString(1,"PartyID",GetGuid()); |
| | | dw_base.SetItemString(1,"PStatus","1"); |
| | | dw_base.SetItemDisplayString(1,"PStatus","ææ"); |
| | | dw_base.SetItemString(1,"PADStatus","1"); |
| | | dw_base.SetItemString(1,"CreatorID",m_userid); |
| | | dw_base.SetItemString(1,"AddressID",GetGuid()); |
| | | dw_base.SetItemString(1,"PADIdentifyAddressFlag","Y"); |
| | | dw_base.SetItemString(1,"PrimaryFlag","Y"); |
| | | dw_base.SetItemString(1,"Type","8"); |
| | | dw_base.SetItemString(1,"EnterName",m_userid); |
| | | dw_base.SetItemDisplayString(1,"EnterName",m_username); |
| | | dw_base.SetItemString(1,"CreateDate",TApp::GetCurDate()); |
| | | dw_base.SetItemString(1,"PBAStatus","Y"); |
| | | |
| | | |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnSetFocus(ref TNotifyEvent evt,int p) |
| | | { |
| | | SetAgent("maint"); |
| | | return 1; |
| | | } |
| | | int OnAddrow() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | string dw_n=dw.GetDwName(); |
| | | if(dw_n=="item") |
| | | { |
| | | dw.InsertRow(0); |
| | | int rows = dw.GetRowCount(); |
| | | dw.SetRow(rows); |
| | | |
| | | } |
| | | return 1; |
| | | } |
| | | int OnInsertRow() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | string dw_n=dw.GetDwName(); |
| | | if(dw_n=="item") |
| | | { |
| | | int row=dw.GetRow(); |
| | | if(row<1) return 0; |
| | | dw.InsertRow(row); |
| | | dw.SetRow(row); |
| | | |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | string dw_n=dw.GetDwName(); |
| | | if(dw_n=="item") |
| | | { |
| | | int row=dw.GetRow(); |
| | | if(row<1) return 0; |
| | | /*string del = dw.GetItemString(row,8); |
| | | if(del!="") |
| | | { |
| | | if(m_dels=="") |
| | | { |
| | | m_dels=del; |
| | | } |
| | | else |
| | | { |
| | | string temp=m_dels; |
| | | m_dels=del + "|" + temp; |
| | | //+= "|"+del; |
| | | } |
| | | |
| | | }*/ |
| | | dw.DeleteRow(row); |
| | | dw.SetRow(row - 1); |
| | | } |
| | | //trace(m_dels); |
| | | return 1; |
| | | } |
| | | string getGoodsNo() |
| | | { |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | if (getUrl("/sale/data/LogisticsCode/pref/express/PartyNo",arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return ""; |
| | | } |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | if(e) |
| | | { |
| | | string code = e.text; |
| | | trace(code); |
| | | return "E"+code; |
| | | } |
| | | return "E1000"; |
| | | } |
| | | int OnPreSave() |
| | | { |
| | | dw_base.AcceptText(); |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | string ExpressNo = dw_base.GetItemString(1,"ExpressNo",0); |
| | | if (ExpressNo=="" || ExpressNo== nil) |
| | | { |
| | | dw_base.SetItemString(1,"ExpressNo",getGoodsNo()); |
| | | } |
| | | xdwtable__ dwcon = new xdwtable__; |
| | | dwcon.setNativePointer(dw_base.FindDwTable("item",0)); |
| | | int i; |
| | | for(i=1;i<=dwcon.GetRowCount();i++) |
| | | { |
| | | string aTemp; |
| | | string aName = dwcon.GetItemString(i,"ContacterName",0); |
| | | if (aName=="" || aName== nil) |
| | | { |
| | | aTemp=dwcon.GetItemString(i,"Mobile",0)+dwcon.GetItemString(i,"TEL",0)+dwcon.GetItemString(i,"Fax",0)+dwcon.GetItemString(i,"Email",0)+dwcon.GetItemString(i,"PCRemark",0); |
| | | trace(aTemp); |
| | | if(aTemp !="" && aTemp != nil) |
| | | { |
| | | alert("è系人åç§°å¿
å¡«ï¼"); |
| | | return -1; |
| | | } |
| | | } |
| | | else{ |
| | | string ContactID = dwcon.GetItemString(i,"ContactID",0); |
| | | if (ContactID=="" || ContactID== nil) |
| | | { |
| | | dwcon.SetItemString(i,"ContactID",GetGuid()); |
| | | dwcon.SetItemString(i,"PCStatus","1"); |
| | | //dw_base.SetItemString(1,"PrimaryContactID",dwcon.GetItemString(1,"ContactID")); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | xdwtable__ dwcon1 = new xdwtable__; |
| | | dwcon1.setNativePointer(dw_base.FindDwTable("PartyBankAccount",0)); |
| | | int j; |
| | | for (j=1;j <= dwcon1.GetRowCount();j++) |
| | | { |
| | | string sPBABankName = dwcon1.GetItemString(j,"Bank"); |
| | | string sPBABankAccountNo = dwcon1.GetItemString(j,"BankNo"); |
| | | if (sPBABankName == nil) sPBABankName = ""; |
| | | if (sPBABankAccountNo == nil) sPBABankAccountNo = ""; |
| | | string sPBAAll = sPBABankName + sPBABankAccountNo; |
| | | if (sPBAAll != "") |
| | | { |
| | | if (sPBABankName == "") |
| | | { |
| | | alert("é¶è¡åç§°ä¸è½ä¸ºç©º"); |
| | | return -1; |
| | | } |
| | | if (sPBABankAccountNo == "") |
| | | { |
| | | alert("é¶è¡è´¦æ·ä¸è½ä¸ºç©º"); |
| | | return -1; |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int OnSave() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | string SName = dw_base.GetItemString(1,"Name"); |
| | | if(SName==""){ |
| | | alert("请è¾å
¥å¿«éå
¬å¸åç§°ï¼"); |
| | | return -1; |
| | | } |
| | | int rec =OnPreSave(); |
| | | if (rec== -1) return -1; |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | dw_base.DwUpdateAllTo(x.GetXmlDoc()); |
| | | trace(x.GetXml()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content",x.GetXml()); |
| | | arg.AddArg("dbmap","Express.dbmap"); |
| | | //arg.AddArg("m_dels",m_dels); |
| | | if (getUrl("/sale/data/LogisticsCode/entity/express/save",arg.GetString(),x) != 1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("ä¿å失败!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | trace(x.GetXml()); |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert("ä¿ååºé2!"); |
| | | return 0; |
| | | } |
| | | alert("ä¿åæå!"); |
| | | dw_base.ResetUpdateStatus(); |
| | | setCellReadOnly(); |
| | | } |
| | | dw_base.Redraw(); |
| | | //m_dels=""; |
| | | return 0; |
| | | } |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid.find("action:bill.row.add",0)>=0) { |
| | | OnAddrow(); |
| | | } |
| | | else if(comdid.find("bill.row.insert",0)>=0) { |
| | | OnInsertRow(); |
| | | } |
| | | else if(comdid.find("bill.row.delete",0)>=0) { |
| | | OnDeleteRow(); |
| | | } |
| | | else if(comdid.find("bill.save",0)>=0) { |
| | | trace(1); |
| | | OnSave(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | int OnCellChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | string colname=hdr.colname; |
| | | //trace(colname); |
| | | if(colname=="ExpressNo") |
| | | { |
| | | string cspec = dw_base.GetItemString(1,1); |
| | | trace(cspec); |
| | | string SpecRule="^\\d*$"; |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("CSpec",cspec); |
| | | args.AddArg("SpecRule",SpecRule); |
| | | xml__ x= new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | getUrl("/sale/data/LogisticsCode/pref/forwarderno/check",args.GetString(),x); |
| | | if(x.GetXmlDoc().selectSingleNode("root/spec")) |
| | | { |
| | | alert("请è¾å
¥æ°åï¼"); |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent("dw_base","DWV_ITEMCHANGED",OnCellChanged); |
| | | return 0; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | |
| | | OnAttachEvent(); |
| | | //if(!m_configDoc) return -1; |
| | | |
| | | maint::onload(); |
| | | OnClear(); |
| | | |
| | | } |
| | | |
| | | ] |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "list.vl" |
| | | use "dev:vm[combobox.vm]" |
| | | use "dev:vm[gridpages.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "dev:vm[xpage.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "file.vl" |
| | | unit vbusiness.entity |
| | | [ |
| | | FCL is extend frame; |
| | | about FCL |
| | | [ |
| | | field: |
| | | [ |
| | | |
| | | combobox__ ddlb_1; |
| | | int changeddlb; |
| | | xdwgrid__ dw_list; |
| | | int m_PageSize; //æ¯é¡µæ¾ç¤ºæ°é |
| | | int m_PageIndex; //第å 页 |
| | | string m_QueryTxt; //æ¥è¯¢æ¡ä»¶ |
| | | xdwtable__ dw_base; |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | string m_config; |
| | | string m_spec; |
| | | ] |
| | | |
| | | 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){ |
| | | SetAgentNodeContent (anode,agent.xml); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xdwpages__ zz = new xdwpages__; |
| | | zz.setNativePointer(this.GetControl("pages")); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | getUrl("/sale/data/FCL/entity/list",arg.GetString(),x); |
| | | msxml::IXMLDOMElement e=x.GetXmlDoc().documentElement; |
| | | if(e.selectSingleNode("@TotalPage")) |
| | | { |
| | | string s=e.selectSingleNode("@TotalPage").text; //æ»æ°é |
| | | zz.SetMaxPage(s.toInt()); |
| | | } |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | int SetPriceBaseEmpty() |
| | | { |
| | | int rows=dw_base.GetColumnCount(); |
| | | int i; |
| | | for( i=1; i<=rows; i++) |
| | | { |
| | | dw_base.SetItemString(1,i,""); |
| | | //dw_base.SetItemDisplayString(1,i,""); |
| | | } |
| | | dw_base.ResetUpdateStatus(); |
| | | dw_base.Redraw(); |
| | | return 1; |
| | | } |
| | | int SetCellEdit(int row,string name,string value,string display) |
| | | { |
| | | dw_base.SetItemString(row,name,value); |
| | | dw_base.Redraw(); |
| | | if(display !="") |
| | | { |
| | | dw_base.SetItemDisplayString(row,name,display); |
| | | } |
| | | dw_base.AcceptText(); |
| | | dw_base.ResetUpdateStatus(); |
| | | dw_base.Redraw(); |
| | | return 1; |
| | | } |
| | | int OnSetCTGValue(int row) |
| | | { |
| | | dw_base.AcceptText(); |
| | | SetPriceBaseEmpty(); |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | var list = e.SelectNodes("*"); |
| | | if(list) |
| | | { |
| | | int s = list.length; |
| | | int i; |
| | | for(i=0;i<s;i++) |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | msxml::IXMLDOMElement xitem = list.item(i); |
| | | x.LoadXml(xitem.xml); |
| | | //trace(xitem.xml); |
| | | msxml::IXMLDOMElement e1=x.GetXmlDoc().documentElement; |
| | | string name = e1.tagName; |
| | | trace(name); |
| | | trace(e1.text); |
| | | string display; |
| | | if( e1.selectSingleNode("@_displaystring")) |
| | | { |
| | | display= e1.selectSingleNode("@_displaystring").text; |
| | | SetCellEdit(1,name,e1.text,""+display); |
| | | } |
| | | else |
| | | SetCellEdit(1,name,e1.text,""); |
| | | |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int OnRowClicked(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int row = hdr.row; |
| | | OnSetCTGValue(row); |
| | | return 1; |
| | | } |
| | | int setMaint() |
| | | { |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | dw_base.DwUpdateAllTo(x.GetXmlDoc()); |
| | | int row =dw_list.GetRow(); |
| | | dw_list.SetItemString(row, "PriceInfo", x.GetXml()); |
| | | return 1; |
| | | } |
| | | int SetTotalAmount(int row,string name) |
| | | { |
| | | if(name=="price20base" || name=="price20BAF"|| name=="price20CAF"|| name=="price20add"|| name=="price20comm"|| name=="price20other") |
| | | { |
| | | double price20base = dw_base.GetItemString(row, "price20base").toDouble(); |
| | | double price20BAF = dw_base.GetItemString(row, "price20BAF").toDouble(); |
| | | double price20CAF = dw_base.GetItemString(row, "price20CAF").toDouble(); |
| | | double price20add = dw_base.GetItemString(row, "price20add").toDouble(); |
| | | double price20comm = dw_base.GetItemString(row, "price20comm").toDouble(); |
| | | double price20other = dw_base.GetItemString(row, "price20other").toDouble(); |
| | | double price20=price20base+price20BAF+(price20CAF/100)*price20base+price20add - (price20comm/100)*price20base+price20other; |
| | | dw_base.SetItemString(1,"price20",price20.toString()); |
| | | } |
| | | |
| | | if(name=="price40base" || name=="price40BAF"|| name=="price40CAF"|| name=="price40add"|| name=="price40comm"|| name=="price40other") |
| | | { |
| | | double price40base = dw_base.GetItemString(row, "price40base").toDouble(); |
| | | double price40BAF = dw_base.GetItemString(row, "price40BAF").toDouble(); |
| | | double price40CAF = dw_base.GetItemString(row, "price40CAF").toDouble(); |
| | | double price40add = dw_base.GetItemString(row, "price40add").toDouble(); |
| | | double price40comm = dw_base.GetItemString(row, "price40comm").toDouble(); |
| | | double price40other = dw_base.GetItemString(row, "price40other").toDouble(); |
| | | double price40=price40base+price40BAF+(price40CAF/100)*price40base+price40add - (price40comm/100)*price40base+price40other; |
| | | dw_base.SetItemString(1,"price40",price40.toString()); |
| | | } |
| | | |
| | | if(name=="price40Hbase" || name=="price40HBAF"|| name=="price40HCAF"|| name=="price40Hadd"|| name=="price40Hcomm"|| name=="price40Hother") |
| | | { |
| | | double price40Hbase = dw_base.GetItemString(row, "price40Hbase").toDouble(); |
| | | double price40HBAF = dw_base.GetItemString(row, "price40HBAF").toDouble(); |
| | | double price40HCAF = dw_base.GetItemString(row, "price40HCAF").toDouble(); |
| | | double price40Hadd = dw_base.GetItemString(row, "price40Hadd").toDouble(); |
| | | double price40Hcomm = dw_base.GetItemString(row, "price40Hcomm").toDouble(); |
| | | double price40Hother = dw_base.GetItemString(row, "price40Hother").toDouble(); |
| | | double price40H=price40Hbase+price40HBAF+(price40HCAF/100)*price40Hbase+price40Hadd - (price40Hcomm/100)*price40Hbase+price40Hother; |
| | | dw_base.SetItemString(1,"price40h",price40H.toString()); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnPriceBaseChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | trace("123"); |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | string name=hdr.colname; |
| | | string value = hdr.data; |
| | | SetTotalAmount(1,name); |
| | | string price20=dw_base.GetItemString(1,"price20"); |
| | | string price40=dw_base.GetItemString(1,"price40"); |
| | | string price40h=dw_base.GetItemString(1,"price40h"); |
| | | dw_list.SetItemString(dw_list.GetRow(),"price20",price20); |
| | | dw_list.SetItemString(dw_list.GetRow(),"price40",price40); |
| | | dw_list.SetItemString(dw_list.GetRow(),"price40h",price40h); |
| | | dw_list.Redraw(); |
| | | setMaint(); |
| | | return 1; |
| | | } |
| | | int OnListChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int row = hdr.row; |
| | | string colname=hdr.colname; |
| | | string value = hdr.data; |
| | | if(colname=="port") |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("code", value); |
| | | if (getUrl("/sale/data/FCL/pref/shipthread",arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.GetXml()); |
| | | } |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | dw_list.SetItemString(row,"shipthread", e.text); |
| | | dw_list.Redraw(); |
| | | } |
| | | |
| | | |
| | | return 1; |
| | | } |
| | | int OnChangePages(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref PAGENMHDR h = evt.pnmh; |
| | | int c = h.cur; |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | m_pageIndex = c; |
| | | OnRetrieve(); |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | int onSave() |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | trace(x.GetXml()); |
| | | } |
| | | int OnDeleteRow() |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if(row<1 || row>dw_list.GetRowCount()) |
| | | { |
| | | return -1; |
| | | } |
| | | dw_list.DeleteRow(row); |
| | | |
| | | } |
| | | int OnAddrow() |
| | | { |
| | | int row=dw_list.InsertRow(0); |
| | | dw_list.SetItemString(row,"modifieddate",TApp::GetCurDate()); |
| | | SetPriceBaseEmpty(); |
| | | return 1; |
| | | } |
| | | int OnInsertRow() |
| | | { |
| | | int row=dw_list.GetRow(); |
| | | if(row<1) return 0; |
| | | int newrow=dw_list.InsertRow(row); |
| | | dw_list.SetItemString(newrow,"modifieddate",TApp::GetCurDate()); |
| | | SetPriceBaseEmpty(); |
| | | return 1; |
| | | } |
| | | int OnDeleteRow() |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if(row>0 && row<=dw_list.GetRowCount()) |
| | | { |
| | | dw_list.DeleteRow(row); |
| | | //OnSetCTGValue(row); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid.find("add",0)>=0) |
| | | OnAddrow(); |
| | | else if(comdid.find("insert",0)>=0) |
| | | OnInsertRow(); |
| | | else if(comdid.find("del",0)>=0) |
| | | OnDeleteRow(); |
| | | else if(comdid.find("save",0)>=0) |
| | | onSave(); |
| | | return 1; |
| | | } |
| | | int OnSetFocus(ref TNotifyEvent evt,int p){ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | int OnItemError(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | string value=hdr.data; |
| | | int e = hdr.idFrom; |
| | | if(e == -1000) |
| | | alert("ã"+value+"ã䏿¯ææçæ°å!"); |
| | | if(e == -1001) |
| | | alert("ã"+value+"ã䏿¯ææçæ°å!"); |
| | | if(e == -1002) |
| | | alert("ã"+value+"ã䏿¯ææçæ¥æ!"); |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent("dw_list","DWV_ROWFOCUSCHANGED",OnRowClicked); |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent("pages","PAGE_CLICK",OnChangePages); |
| | | AttachEvent("dw_base","DWV_ITEMCHANGED",OnPriceBaseChanged); |
| | | AttachEvent("dw_base","DWV_ITEMERROR",OnItemError); |
| | | AttachEvent("dw_list","DWV_ITEMCHANGED",OnListChanged); |
| | | |
| | | } |
| | | int OnInit() |
| | | { |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | dw_list.openUrl("/sale/view/FCL/template/FCL/List"); |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(GetControl("dw_base")); |
| | | dw_base.openUrl("/sale/view/FCL/template/FCL/pricebase"); |
| | | dw_list.SetReadOnlyColumn("shipthread",true); |
| | | dw_list.SetReadOnlyColumn("price20",true); |
| | | dw_list.SetReadOnlyColumn("price40",true); |
| | | dw_list.SetReadOnlyColumn("price40h",true); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | m_PageSize=30; //æ¯é¡µæ¾ç¤ºæ°é |
| | | m_PageIndex=1; //第å 页 |
| | | m_QueryTxt=""; //æ¥è¯¢æ¡ä»¶ |
| | | OnInit(); |
| | | OnAttachEvent(); |
| | | OnRetrieve(); |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "system.vl" |
| | | use "win.vl" |
| | | use "list.vl" |
| | | use "treeview.vm" |
| | | use "dev:vm[gridpages.vm]" |
| | | |
| | | |
| | | unit vbusiness.entity |
| | | [ |
| | | ForwarderList is extend list; |
| | | about ForwarderList |
| | | [ |
| | | field: |
| | | [ |
| | | |
| | | //xdwpages__ dw_pages; |
| | | string m_QueryTxt; |
| | | msxml::IXMLDOMDocument m_configDoc; |
| | | treeview__ tv_1; |
| | | string sType; |
| | | static int dw_hWnd; |
| | | int m_pageIndex; |
| | | int m_pageNumber; |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | |
| | | |
| | | |
| | | int SetEntityData(xaserverarg__ arg) |
| | | { |
| | | |
| | | |
| | | arg.AddArg("sType",sType); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | getUrl("/sale/data/LogisticsCode/entity/list",arg.GetString(),x); |
| | | msxml::IXMLDOMElement e=x.GetXmlDoc().documentElement; |
| | | if(e) |
| | | { |
| | | if(list::dw_pages.__nativept && e.selectSingleNode("@TotalPage")) |
| | | { |
| | | string s=e.selectSingleNode("@TotalPage").text; //æ»æ°é |
| | | list::dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | } |
| | | this.dw_list.Retrieve(x); |
| | | this.dw_list.Redraw(); |
| | | this.dw_list.SetReadOnly(true); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("pageindex", m_pageIndex.toString()); //第å 页 |
| | | arg.AddArg("pagenumber", m_pageNumber.toString()); //æ¯é¡µæ°é |
| | | //trace(list::m_QueryTxt); |
| | | arg.AddArg("QueryTxt", list::m_QueryTxt); //æ¯é¡µæ°é |
| | | return SetEntityData(arg); |
| | | } |
| | | int OnTreeSelChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int hItem = nmtv.itemNew.hItem; |
| | | list::m_QueryTxt = ""; |
| | | int wid = tv_1.GetId(); |
| | | int hitem=treeview__::GetSelectedItem(wid); |
| | | //c_type=dw_type.GetItemLabel(hitem); |
| | | //妿æ¯è·èç¹ |
| | | int roothitem=treeview__::GetRootItem(wid); |
| | | msxml::IXMLDOMElement e = treeview__::GetItemData(wid,hitem); |
| | | string value = e.SelectSingleNode("@data").text; |
| | | sType= value+""; |
| | | OnRetrieve(); |
| | | return 1; |
| | | } |
| | | int OnChangePages(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref PAGENMHDR h = evt.pnmh; |
| | | int c = h.cur; |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | m_pageIndex = c; |
| | | OnRetrieve(); |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int ViewUpdate(param pr,string updateItem,xaserverarg__ arg) |
| | | { |
| | | if( updateItem=="del") |
| | | { |
| | | int DelRow = this.dw_list.GetRow(); |
| | | this.dw_list.DeleteRow(DelRow); |
| | | |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //è·å¾æ çéæ©äºä»¶ |
| | | AttachEvent("tv_1", "TVN_SELCHANGED",OnTreeSelChanged); |
| | | return 0; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | list::m_QueryTxt = ""; |
| | | m_pageIndex = 1; |
| | | m_pageNumber = 30; |
| | | sType="0"; |
| | | list::onload(); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | |
| | | |
| | | tv_1 = new treeview__; |
| | | tv_1.setNativePointer(this.GetControl("tv_1")); |
| | | int wid = tv_1.GetId(); |
| | | int root = treeview__::GetRootItem(wid); |
| | | treeview__::ExpandItem(wid,root); |
| | | this.dw_list.SetColumnStaus("ForwarderID",false); |
| | | return 1; |
| | | } |
| | | |
| | | ] |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "system.vl" |
| | | use "win.vl" |
| | | use "maint.vl" |
| | | use "file.vl" |
| | | use "dev:vm[xcell.vm]" |
| | | unit vbusiness.entity |
| | | [ |
| | | ForwarderMaint is extend maint; |
| | | about ForwarderMaint |
| | | [ |
| | | field: |
| | | [ |
| | | msxml::IXMLDOMDocument m_configDoc; |
| | | |
| | | xdwtable__ dw_base; |
| | | string m_userid; |
| | | string m_username; |
| | | string ContactID; |
| | | xcell__ dw_cell; |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | int alert(string str) |
| | | { |
| | | //win__::MessageBox(this.GetHWND(),str,"æç¤º22:",0); |
| | | TApp::alert(this,str); |
| | | return 0; |
| | | } |
| | | int setCellReadOnly() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | dw_cell = new xcell__; |
| | | dw_cell.setNativePointer(dw_base.QueryItem("ixcell")); |
| | | string strnew = "<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='ä¿æ¤' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''/>"; |
| | | //dw_cell.SetCellProps(2,2,strnew); |
| | | return 0; |
| | | } |
| | | |
| | | string GetGuid(){ |
| | | return TApp::GetGuid(); |
| | | } |
| | | int OnClear(){ |
| | | if(this.m_EntityID ==""){ |
| | | trace(1); |
| | | m_userid = TApp::GetUserInfo().id; |
| | | m_username = TApp::GetUserInfo().name; |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | dw_base.SetItemString(1,"ForwarderID",GetGuid()); |
| | | dw_base.SetItemString(1,"PartyID",GetGuid()); |
| | | dw_base.SetItemString(1,"PStatus","1"); |
| | | dw_base.SetItemDisplayString(1,"PStatus","æ®é"); |
| | | dw_base.SetItemString(1,"CreatorID",m_userid); |
| | | dw_base.SetItemString(1,"PADStatus","1"); |
| | | dw_base.SetItemString(1,"AddressID",GetGuid()); |
| | | dw_base.SetItemString(1,"PADIdentifyAddressFlag","Y"); |
| | | dw_base.SetItemString(1,"PADPrimaryFlag","Y"); |
| | | //dw_base.SetItemString(1,"BankAccountID",GetGuid()); |
| | | dw_base.SetItemString(1,"Type","5"); |
| | | dw_base.SetItemString(1,"EnterName",m_userid); |
| | | dw_base.SetItemDisplayString(1,"EnterName",m_username); |
| | | dw_base.SetItemString(1,"CreateDate",TApp::GetCurDate()); |
| | | /*xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | xdwtable__ dwcon = new xdwtable__; |
| | | dwcon.setNativePointer(dw.FindDwTable("Contacters",0)); |
| | | dwcon.SetItemString(1,"ContactID",GetGuid()); |
| | | dwcon.SetItemString(1,"PCStatus","1");*/ |
| | | //dw_base.SetItemString(1,"EBankAccountID",GetGuid()); |
| | | //dw_base.SetItemString(1,"CBankAccountID",GetGuid()); |
| | | /*xdwtable__ dweon = new xdwtable__; |
| | | dweon.setNativePointer(dw_base.FindDwTable("item1",0)); |
| | | xdwtable__ dwcon = new xdwtable__; |
| | | dwcon.setNativePointer(dw_base.FindDwTable("item2",0)); |
| | | dweon.SetItemString(1,"EPBAStatus","Y"); |
| | | dwcon.SetItemString(1,"CPBAStatus","Y"); |
| | | dweon.SetItemString(1,"ECurrencyCode","USD"); |
| | | dwcon.SetItemString(1,"CCurrencyCode","RMB");*/ |
| | | dw_base.SetItemString(1,"ForwarderType","1"); |
| | | dw_base.SetItemDisplayString(1,"ForwarderType","é¢ä»è´§"); |
| | | //dw_base.SetItemString(1,"PrimaryContactID",dwcon.GetItemString(1,"ContactID")); |
| | | |
| | | } |
| | | else |
| | | { |
| | | setCellReadOnly(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnAddrow() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | string dw_n=dw.GetDwName(); |
| | | if(dw_n=="item") |
| | | { |
| | | dw.InsertRow(0); |
| | | int rows = dw.GetRowCount(); |
| | | dw.SetRow(rows); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnInsertRow() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | string dw_n=dw.GetDwName(); |
| | | if(dw_n=="item") |
| | | { |
| | | int row=dw.GetRow(); |
| | | if(row<1) return 0; |
| | | dw.InsertRow(row); |
| | | dw.SetRow(row); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | string dw_n=dw.GetDwName(); |
| | | if(dw_n=="item") |
| | | { |
| | | int row=dw.GetRow(); |
| | | if(row<1) return 0; |
| | | /*string del = dw.GetItemString(row,8); |
| | | if(del!="") |
| | | { |
| | | if(m_dels=="") |
| | | { |
| | | m_dels=del; |
| | | } |
| | | else |
| | | { |
| | | string temp=m_dels; |
| | | m_dels=del + "|" + temp; |
| | | //+= "|"+del; |
| | | } |
| | | |
| | | }*/ |
| | | dw.DeleteRow(row); |
| | | dw.SetRow(row - 1); |
| | | } |
| | | //trace(m_dels); |
| | | return 1; |
| | | } |
| | | string getGoodsNo() |
| | | { |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | if (getUrl("/sale/data/LogisticsCode/pref/PartyNo",arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return ""; |
| | | } |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | if(e) |
| | | { |
| | | string code = e.text; |
| | | trace(code); |
| | | return "F"+code; |
| | | } |
| | | return "F1000"; |
| | | } |
| | | int OnPreSave() |
| | | { |
| | | dw_base.AcceptText(); |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | string ForwarderNo = dw_base.GetItemString(1,"ForwarderNo",0); |
| | | if (ForwarderNo=="" || ForwarderNo== nil) |
| | | { |
| | | dw_base.SetItemString(1,"ForwarderNo",getGoodsNo()); |
| | | } |
| | | xdwtable__ dwcon = new xdwtable__; |
| | | dwcon.setNativePointer(dw_base.FindDwTable("item",0)); |
| | | int i; |
| | | for(i=1;i<=dwcon.GetRowCount();i++) |
| | | { |
| | | string aTemp; |
| | | string aName = dwcon.GetItemString(i,"ContacterName",0); |
| | | trace(aName); |
| | | if (aName=="" || aName== nil) |
| | | { |
| | | aTemp=dwcon.GetItemString(i,"Mobile",0)+dwcon.GetItemString(i,"TEL",0)+dwcon.GetItemString(i,"Fax",0)+dwcon.GetItemString(i,"Email",0)+dwcon.GetItemString(i,"PCRemark",0)+dwcon.GetItemString(i,"fz",0); |
| | | trace(aTemp); |
| | | if(aTemp !="" && aTemp != nil) |
| | | { |
| | | alert("è系人åç§°å¿
å¡«ï¼"); |
| | | return -1; |
| | | } |
| | | } |
| | | else{ |
| | | string ContactID = dwcon.GetItemString(i,"ContactID",0); |
| | | if (ContactID=="" || ContactID== nil) |
| | | { |
| | | dwcon.SetItemString(i,"ContactID",GetGuid()); |
| | | dwcon.SetItemString(i,"PCStatus","Y"); |
| | | dw_base.SetItemString(1,"PrimaryContactID",dwcon.GetItemString(1,"ContactID")); |
| | | } |
| | | } |
| | | } |
| | | xdwtable__ dwcon2 = new xdwtable__; |
| | | dwcon2.setNativePointer(dw_base.FindDwTable("item2",0)); |
| | | int k; |
| | | for (k=1;k <= dwcon2.GetRowCount();k++) |
| | | { |
| | | string sPBABankName2 = dwcon2.GetItemString(k,"CBank"); |
| | | string sPBABankAccountNo2 = dwcon2.GetItemString(k,"CBankNo"); |
| | | if (sPBABankName2 == nil) sPBABankName2 = ""; |
| | | if (sPBABankAccountNo2 == nil) sPBABankAccountNo2 = ""; |
| | | string sPBAAll2 = sPBABankName2 + sPBABankAccountNo2; |
| | | |
| | | if (sPBAAll2 != "") |
| | | { |
| | | if (sPBABankName2 == "") |
| | | { |
| | | alert("人æ°å¸é¶è¡åç§°ä¸è½ä¸ºç©º"); |
| | | return -1; |
| | | } |
| | | if (sPBABankAccountNo2 == "") |
| | | { |
| | | alert("人æ°å¸é¶è¡è´¦æ·ä¸è½ä¸ºç©º"); |
| | | return -1; |
| | | } |
| | | dwcon2.SetItemString(k,"CPBAStatus","Y"); |
| | | dwcon2.SetItemString(k,"CCurrencyCode","RMB"); |
| | | dwcon2.SetItemString(k,"CBankAccountID",GetGuid()); |
| | | |
| | | if(dwcon2.GetItemString(k,"CBankAccountID")!="" && this.m_EntityID =="") |
| | | { |
| | | dw_base.SetItemString(1,"CBkAccountID",dwcon2.GetItemString(k,"CBankAccountID")); |
| | | } |
| | | } |
| | | } |
| | | xdwtable__ dwcon1 = new xdwtable__; |
| | | dwcon1.setNativePointer(dw_base.FindDwTable("item1",0)); |
| | | int j; |
| | | for (j=1;j <= dwcon1.GetRowCount();j++) |
| | | { |
| | | string sPBABankName1 = dwcon1.GetItemString(j,"EBank"); |
| | | string sPBABankAccountNo1 = dwcon1.GetItemString(j,"EBankNo"); |
| | | if (sPBABankName1 == nil) sPBABankName1 = ""; |
| | | if (sPBABankAccountNo1 == nil) sPBABankAccountNo1 = ""; |
| | | string sPBAAll1 = sPBABankName1 + sPBABankAccountNo1; |
| | | if (sPBAAll1 != "") |
| | | { |
| | | if (sPBABankName1 == "") |
| | | { |
| | | alert("ç¾éé¶è¡åç§°ä¸è½ä¸ºç©º"); |
| | | return -1; |
| | | } |
| | | if (sPBABankAccountNo1 == "") |
| | | { |
| | | alert("ç¾éé¶è¡è´¦æ·ä¸è½ä¸ºç©º"); |
| | | return -1; |
| | | } |
| | | dwcon1.SetItemString(j,"EPBAStatus","Y"); |
| | | dwcon1.SetItemString(j,"ECurrencyCode","USD"); |
| | | dwcon1.SetItemString(j,"EBankAccountID",GetGuid()); |
| | | if(dwcon1.GetItemString(j,"EBankAccountID")!="" && this.m_EntityID =="") |
| | | { |
| | | dw_base.SetItemString(1,"EBkAccountID",dwcon1.GetItemString(j,"EBankAccountID")); |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int OnPostSave() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | dw_base.DwUpdateAllTo(x.GetXmlDoc()); |
| | | //trace(x.GetXml()); |
| | | |
| | | //主è系人 |
| | | string spGuid; |
| | | msxml::IXMLDOMElement e; |
| | | var list = x.GetXmlDoc().selectNodes("//item"); |
| | | int nlen = list.length; |
| | | int i; |
| | | for(i=0; i<nlen; i++) |
| | | { |
| | | e = list.item(i); |
| | | if (i == 0) spGuid = e.selectSingleNode("@guid").text; |
| | | string sP = e.selectSingleNode("PPrimaryFlag").text; |
| | | if (sP == "Y") |
| | | { |
| | | spGuid = e.selectSingleNode("@guid").text; |
| | | break; |
| | | } |
| | | } |
| | | if (spGuid == "" || spGuid == nil) |
| | | { |
| | | trace("error"); |
| | | return 0; |
| | | } |
| | | args.AddArg("contact",spGuid); |
| | | //trace("<---->"); |
| | | //trace(spGuid); |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (getUrl("/sale/data/SupplierSubmit/pref/primarycontact",args.GetString(),x) != 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | return 1; |
| | | } |
| | | int OnSave() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | string SName = dw_base.GetItemString(1,"Name"); |
| | | if(SName==""){ |
| | | alert("请è¾å
¥è´§ä»£åç§°ï¼"); |
| | | return -1; |
| | | } |
| | | int rec =OnPreSave(); |
| | | if (rec== -1) return -1; |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | dw_base.DwUpdateAllTo(x.GetXmlDoc()); |
| | | trace(x.GetXml()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content",x.GetXml()); |
| | | arg.AddArg("dbmap","Forwarder.dbmap"); |
| | | //arg.AddArg("m_dels",m_dels); |
| | | if (getUrl("/sale/data/LogisticsCode/entity/save",arg.GetString(),x) != 1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("ä¿å失败!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | trace(x.GetXml()); |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert("ä¿ååºé2!"); |
| | | return 0; |
| | | } |
| | | alert("ä¿åæå!"); |
| | | dw_base.ResetUpdateStatus(); |
| | | OnPostSave(); |
| | | } |
| | | dw_base.Redraw(); |
| | | //m_dels=""; |
| | | return 0; |
| | | } |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid.find("action:bill.row.add",0)>=0) { |
| | | OnAddrow(); |
| | | } |
| | | else if(comdid.find("bill.row.insert",0)>=0) { |
| | | OnInsertRow(); |
| | | } |
| | | else if(comdid.find("bill.row.delete",0)>=0) { |
| | | OnDeleteRow(); |
| | | } |
| | | else if(comdid.find("bill.save",0)>=0) { |
| | | trace(1); |
| | | OnSave(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | int OnCellChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | string colname=hdr.colname; |
| | | string coldata = hdr.data; |
| | | trace(colname); |
| | | if(colname=="ForwarderNo") |
| | | { |
| | | string cspec = dw_base.GetItemString(1,1); |
| | | trace(cspec); |
| | | string SpecRule="^\\d*$"; |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("CSpec",cspec); |
| | | args.AddArg("SpecRule",SpecRule); |
| | | xml__ x= new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | getUrl("/sale/data/LogisticsCode/pref/forwarderno/check",args.GetString(),x); |
| | | |
| | | if(x.GetXmlDoc().selectSingleNode("root/spec")) |
| | | { |
| | | alert("请è¾å
¥æ°åï¼"); |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | | //åªè½éä¸ä¸ªä¸»è系人 |
| | | else if (colname == "PPrimaryFlag" && coldata == "Y") |
| | | { |
| | | xdwtable__ dw_pc; |
| | | dw_pc = new xdwtable__; |
| | | dw_pc.setNativePointer(dw_base.FindDwTable("item")); |
| | | if (dw_pc) |
| | | { |
| | | int i; |
| | | for (i=1;i <= dw_pc.GetRowCount();i++) |
| | | { |
| | | if (i != hdr.row) |
| | | dw_pc.SetItemString(i,"PPrimaryFlag","N"); |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent("dw_base","DWV_ITEMCHANGED",OnCellChanged); |
| | | return 0; |
| | | } |
| | | int onload() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | |
| | | OnAttachEvent(); |
| | | //if(!m_configDoc) return -1; |
| | | |
| | | maint::onload(); |
| | | |
| | | OnClear(); |
| | | } |
| | | |
| | | ] |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | |
| | | unit trade |
| | | [ |
| | | class FreightExpenseTypeWin : public xframe |
| | | { |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | int seqno; |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | { |
| | | SetAgentNodeContent (anode,m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int CalcSeqNo() |
| | | { |
| | | seqno = -1; |
| | | for(int i=1; i<dw_list.GetRowCount();i++) |
| | | { |
| | | string val = dw_list.GetItemString(i,"FieldName"); |
| | | if(val.find("OtherFee")==0) continue; |
| | | if(val.find("Other")==0) |
| | | { |
| | | string no = val.mid(5,99999); |
| | | if(no.toInt()>seqno) seqno = no.toInt(); |
| | | } |
| | | } |
| | | return seqno; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | dw_list.AcceptText(); |
| | | xml x= new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(xaserverarg::CreateInstance()); |
| | | arg.AddArg("content",x.GetXml()); |
| | | |
| | | //trace(x.GetXml()); |
| | | |
| | | if(url::get("/sale/data/LogisticsCode/entity/freightexpensetype/update", arg.GetString(),x)!=1) |
| | | { |
| | | string error = x.GetXmlDoc().text; |
| | | alert("err:"+error); |
| | | return 1; |
| | | } |
| | | //alert(x.GetXml()); |
| | | string str = x.GetXmlDoc().documentElement.getAttribute("text"); |
| | | trace(x.GetXml()); |
| | | if(str == "true") |
| | | { |
| | | dw_list.ResetUpdateStatus(); |
| | | alert("ä¿åæå!"); |
| | | }else |
| | | { |
| | | alert("ä¿å失败!"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid=="xmAddRow") |
| | | { |
| | | dw_list.InsertRow(0); |
| | | if(seqno==-1) CalcSeqNo(); |
| | | seqno++; |
| | | dw_list.SetItemString(dw_list.GetRowCount(),"FieldName", "Other"+seqno.toString()); |
| | | return 1; |
| | | } |
| | | else if(comdid=="xmDeleteRow") |
| | | { |
| | | dw_list.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | else if(comdid=="xmSave") |
| | | { |
| | | return OnSave(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | if (getUrl("/sale/data/LogisticsCode/entity/freightexpensetype/list","",x)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.openUrl("/sale/view/LogisticsCode/template/freightexpensetype/list"); |
| | | dw_list.SetColumnState("ID",false); |
| | | OnAttachEvent(); |
| | | seqno = -1; |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | OnRetrieve(); |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "list.vd" |
| | | use "xtreeview.vd" |
| | | use "xwin.vd" |
| | | class PaymentTermlist111 : public list |
| | | { |
| | | //xdwgrid dw_list; |
| | | int OnDBClick(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | int row = hdr.row; |
| | | //alert(row.toString()); |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string id = e.selectSingleNode("TermID").text; |
| | | //alert( id); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("EntityID", id); |
| | | //arg.AddArg("hwnd", this.GetHWND().toString()); |
| | | int p1 = arg.ptr_native_; |
| | | openUrl("/sale/view/Payment/worknode/Payment/maint",p1); |
| | | if (arg.GetArgString("ret") == "Ok") |
| | | { |
| | | alert("OK"); |
| | | list::onloaded(); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnDelete() |
| | | { |
| | | int row = this.dw_list.GetRow(); |
| | | if (row < 1) return 1; |
| | | msxml::IXMLDOMElement ele = this.dw_list.GetRowElement(row); |
| | | string termid = ele.selectSingleNode("TermID").text; |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("termId",termid); |
| | | //alert(termid); |
| | | xml x1 = new xml; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("/sale/data/PaymentTerm/entity/delete",arg.GetString(),x1) != 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | //error = x1.GetXmlDoc().text; |
| | | //alert(error); |
| | | MessageBox(GetHWND(),"å 餿åï¼","æç¤º",0); |
| | | dw_list.DeleteRow(row); |
| | | } |
| | | } |
| | | |
| | | int OnNew() |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("EntityID", "new"); |
| | | int p1 = arg.ptr_native_; |
| | | //openUrl("/sale/view/Test/worknode/company/maint", arg); |
| | | openUrl("/sale/view/Payment/worknode/Payment/maint",p1); |
| | | return 0; |
| | | } |
| | | int OnOpen() |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | int row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | xwin::MessageBox(GetHWND(),"请éä¸è¦ä¿®æ¹çè¡ï¼","æç¤º",0); |
| | | return -1; |
| | | } |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string guid = e.selectSingleNode("TermID").text; |
| | | arg.AddArg("EntityID",guid); |
| | | int pp = arg.ptr_native_; |
| | | openUrl("/sale/view/Test2/worknode/company2/maint", pp); |
| | | |
| | | } |
| | | int OnRefresh() |
| | | { |
| | | list::onloaded(); |
| | | return 0; |
| | | } |
| | | //æé®äºä»¶ |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | //alert(comdid); |
| | | if (comdid == "action:bill.new") return OnNew(); |
| | | else if(comdid == "action:bill.open") return OnOpen(); |
| | | else if(comdid == "Refresh") return OnRefresh(); |
| | | else if(comdid == "action:bill.delete") return OnDelete(); |
| | | 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_ROWFOCUSCHANGED",OnRowChanged); |
| | | AttachEvent("dw_list","DWV_DOUBLECLICKED",OnDBClick); |
| | | return 1; |
| | | } |
| | | int onload() |
| | | { |
| | | |
| | | list::onload(); |
| | | OnAttachEvent(); |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | //OnRetrieve(); |
| | | //alert("12"); |
| | | list::onloaded(); |
| | | |
| | | |
| | | return -1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "maint.vd" |
| | | use "xaserver.vd" |
| | | use "xaserverarg.vd" |
| | | use "profit.vd" |
| | | use "xcell.vd" |
| | | use "vbind.vd" |
| | | use "publiccode.vd" |
| | | use "xpagecontrol.vd" |
| | | class PaymentTermEdit : public maint |
| | | { |
| | | xdwtable dw_base; |
| | | xdwtable dw_p; |
| | | xcell dw_cell; |
| | | string sCryno; |
| | | int OnAddrow() |
| | | { |
| | | dw_p = dw_base.FindDwTable("line"); |
| | | int i; |
| | | double dDueAmount = 0; |
| | | double dPercnet = 100; |
| | | for (i = 1 ; i <= dw_p.GetRowCount();i++) |
| | | { |
| | | dDueAmount = dw_p.GetItemDouble(i,"DueAmount"); |
| | | if (dDueAmount > 0) |
| | | break; |
| | | dPercnet = dPercnet - dw_p.GetItemDouble(i,"DuePercent"); |
| | | } |
| | | int irow = dw_p.InsertRow(0); |
| | | dw_p.SetItemString(irow,"SeqNo",irow.toString()); |
| | | if (dDueAmount <= 0) |
| | | dw_p.SetItemDouble(irow,"DuePercent",dPercnet); |
| | | |
| | | return 1; |
| | | } |
| | | int OnDeleterow() |
| | | { |
| | | dw_p = dw_base.FindDwTable("line"); |
| | | int row2 = dw_p.GetRow(); |
| | | if (row2 < 1) return 0; |
| | | dw_p.DeleteRow(row2); |
| | | |
| | | return 1; |
| | | } |
| | | string OnCreateTxt() |
| | | { |
| | | //dw_1.AcceptText(); //ä¸è½å 伿¥é |
| | | int irow; |
| | | //int icnt = dw_1.GetRowCount(); |
| | | dw_p = dw_base.FindDwTable("line"); |
| | | int icnt = dw_p.GetRowCount(); |
| | | if (icnt < 1) return ""; |
| | | string sTxt; |
| | | //double dPercnet = 100; |
| | | for (irow = 1;irow <= icnt ;irow ++) |
| | | { |
| | | string sPaymentMethod = dw_p.GetItemString(irow,"PaymentMethod"); //æ¯ä»æ¹å¼ |
| | | //string sDueDays = dw_p.GetItemDisplayString(irow,"DueDays"); |
| | | string sDueDays = dw_p.GetItemString(irow,"DueDays"); //æé |
| | | string sDuePercent = dw_p.GetItemString(irow,"DuePercent"); //æ¯ä¾ |
| | | string sDueAmount = dw_p.GetItemString(irow,"DueAmount"); //éé¢ |
| | | |
| | | if (!sPaymentMethod || sPaymentMethod == "") |
| | | sTxt = sTxt + ""; |
| | | if (!sDueDays || sDueDays == "") |
| | | sTxt = sTxt + ""; |
| | | else |
| | | { |
| | | if (sDueDays == "-1") sDueDays = " IN ADVANCE"; |
| | | else if (sDueDays == "0") sDueDays = " AT SIGHT"; |
| | | else |
| | | { |
| | | if (sPaymentMethod == "T/T") |
| | | sDueDays = " WITHIN "+sDueDays + " DAYS AFTER SHIPMENT"; |
| | | else |
| | | sDueDays = " AT "+sDueDays + " DAYS"; |
| | | } |
| | | |
| | | if (!sDuePercent || sDuePercent == "") |
| | | { |
| | | if (!sDueAmount || sDueAmount == "") |
| | | sTxt = sTxt + ""; |
| | | else |
| | | { |
| | | |
| | | sTxt = sTxt + sCryno + " " + sDueAmount + " " + sPaymentMethod + sDueDays + ";"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (sDuePercent.find(".",0) >= 0) |
| | | { |
| | | while (sDuePercent.right(1) == "0") |
| | | { |
| | | sDuePercent = sDuePercent.left(sDuePercent.length() - 1); |
| | | } |
| | | if (sDuePercent.right(1) == ".") |
| | | sDuePercent = sDuePercent.left(sDuePercent.length() - 1); |
| | | } |
| | | |
| | | sTxt = sTxt + sDuePercent + "% " + sPaymentMethod+ sDueDays + ";"; |
| | | } |
| | | } |
| | | } |
| | | |
| | | sTxt = sTxt.mid(0,sTxt.length() - 1); |
| | | if (sTxt != "") |
| | | sTxt = sTxt + "."; |
| | | |
| | | return sTxt; |
| | | } |
| | | int OnOk() |
| | | { |
| | | dw_base.AcceptText(); |
| | | //夿æ¯å¦æå¿
è¾å¼ä¸ºç©º |
| | | dw_p = dw_base.FindDwTable("line"); |
| | | double dPercnet = 0; |
| | | double dAmount = 0; |
| | | if (dw_p) |
| | | { |
| | | int i; |
| | | for (i=1;i <= dw_p.GetRowCount();i++) |
| | | { |
| | | string seqNo = dw_p.GetItemString(i,"SeqNo"); |
| | | string sPaymentMethod = dw_p.GetItemString(i,"PaymentMethod"); |
| | | string sDueDays = dw_p.GetItemString(i,"DueDays"); |
| | | string sDuePercent = dw_p.GetItemString(i,"DuePercent"); |
| | | dPercnet = dPercnet + sDuePercent.toDouble(); |
| | | string sDueAmount = dw_p.GetItemString(i,"DueAmount"); |
| | | dAmount = dAmount + sDueAmount.toDouble(); |
| | | if (!seqNo) seqNo = ""; |
| | | if (!sPaymentMethod) sPaymentMethod = ""; |
| | | if (!sDueDays) sDueDays = ""; |
| | | if (!sDuePercent) sDuePercent = ""; |
| | | if (!sDueAmount) sDueAmount = ""; |
| | | dw_p.SetItemString(i,"SeqNo",i.toString()); |
| | | string sChargeAll = sPaymentMethod + sDueDays + sDuePercent + sDueAmount; |
| | | if (sChargeAll != "") |
| | | { |
| | | if (sPaymentMethod == "") |
| | | { |
| | | alert("æ¯ä»æ¹å¼ä¸è½ä¸ºç©ºï¼"); |
| | | return 0; |
| | | } |
| | | if (sDueDays == "") |
| | | { |
| | | alert("æéä¸è½ä¸ºç©ºï¼"); |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | //ç¾åæ¯æ ¡éª |
| | | if (dw_p.GetRowCount() <= 1 && sChargeAll == "") |
| | | {} |
| | | else |
| | | { |
| | | if (dPercnet != 100) |
| | | { |
| | | if (dAmount <= 0) |
| | | { |
| | | alert("æ¯çä¸çäº100ï¼"); |
| | | return 0; |
| | | } |
| | | } |
| | | } |
| | | |
| | | string sTxt = OnCreateTxt(); |
| | | dw_base.SetItemString(1,"PaymentTermEx",sTxt); |
| | | |
| | | //CloseWindow(); |
| | | return 1; |
| | | } |
| | | int OnItemChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | string colname=hdr.colname; |
| | | string value = hdr.data; |
| | | int row = hdr.row; |
| | | |
| | | if (colname == "DueDays") |
| | | { |
| | | xdwtable dw; |
| | | dw = dw_base.FindDwTable("line"); |
| | | |
| | | if (dw) |
| | | { |
| | | string sPaymentMethod = dw.GetItemString(row,"PaymentMethod"); |
| | | if (value == "0") |
| | | { |
| | | if (sPaymentMethod == "T/T") |
| | | { |
| | | //alert("æ¤æ¯ä»æ¹å¼æéä¸è½ä¸º 0 ï¼AT SIGHTï¼"); |
| | | //return -1; |
| | | } |
| | | } |
| | | else if (value == "-1") |
| | | { |
| | | if (sPaymentMethod != "T/T") |
| | | { |
| | | alert("æ¤æ¯ä»æ¹å¼æéä¸è½ä¸º -1ï¼IN ADVANCEï¼"); |
| | | return -1; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | //çææ¯ä»æ¡æ¬¾ææ¬ |
| | | if (colname == "PaymentMethod" || colname == "DueDays" || colname == "DuePercent" || colname == "DueAmount") |
| | | { |
| | | string sTxt = OnCreateTxt(); |
| | | |
| | | dw_base.SetItemString(1,"Description",sTxt); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int OnClick(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | string value = hdr.data; |
| | | string colname = hdr.colname; |
| | | int row = hdr.row; |
| | | xaserverarg arg=new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | //alert(row.toString()); |
| | | xdwtable dw; |
| | | dw = dw_base.FindDwTable("line"); |
| | | //alert(colname); |
| | | if (dw) |
| | | { |
| | | if (colname == "DuePercent") |
| | | { |
| | | int i; |
| | | int icnt = dw.GetRowCount(); |
| | | if (icnt < 1) |
| | | return 0; |
| | | double dDueAmount = 0; |
| | | for (i = 1 ; i <= icnt ; i++) |
| | | { |
| | | dDueAmount = dw.GetItemDouble(i,"DueAmount"); |
| | | if (dDueAmount > 0) |
| | | break; |
| | | } |
| | | dw_cell.setNativePointer(dw_base.QueryItem("ixcell")); |
| | | if (dDueAmount > 0) |
| | | { |
| | | dw.SetColumnProp("DuePercent","cellprotect","ä¿æ¤");//ä¿æ¤ä¸æè§æ ¼ |
| | | } |
| | | else |
| | | { |
| | | dw.SetColumnProp("DuePercent","cellprotect","ä¸ä¿æ¤");//ä¿æ¤ä¸æè§æ ¼ |
| | | } |
| | | |
| | | } |
| | | |
| | | if (colname == "DueAmount") |
| | | { |
| | | int j; |
| | | int jcnt = dw.GetRowCount(); |
| | | if (jcnt < 1) |
| | | return 0; |
| | | double dDuePercent = 0; |
| | | for (j = 1 ; j <= jcnt ; j++) |
| | | { |
| | | dDuePercent = dw.GetItemDouble(j,"DuePercent"); |
| | | if (dDuePercent > 0) |
| | | break; |
| | | } |
| | | if (dDuePercent > 0) |
| | | { |
| | | dw.SetColumnProp("DueAmount","cellprotect","ä¿æ¤");//ä¿æ¤ä¸æè§æ ¼ |
| | | } |
| | | else |
| | | { |
| | | dw.SetColumnProp("DueAmount","cellprotect","ä¸ä¿æ¤");//ä¿æ¤ä¸æè§æ ¼ |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //ä¿åäºä»¶ |
| | | int OnSave() |
| | | { |
| | | if(OnOk()<1)return 0; |
| | | dw_base = GetControl("dw_base"); |
| | | dw_base.AcceptText(); |
| | | //dw_bank.AcceptText(); |
| | | xml x = new xml; |
| | | xaserverarg arg = new xaserverarg; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | dw_base.DwUpdateAllTo(x.GetXmlDoc()); |
| | | //dw_bank.DwUpdateAllTo(x.GetXmlDoc()); |
| | | //alert(x.GetXml()); |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content",x.GetXml()); |
| | | arg.AddArg("dbmap","FND_PaymentTerm.dbmap"); |
| | | //return 0; |
| | | if (getUrl("/sale/data/PaymentTerm/entity/company/save",arg.GetString(),x) != 1) |
| | | { |
| | | alert("ä¿å失败!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | //alert(x.GetXml()); |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert("ä¿ååºé2!"); |
| | | return 0; |
| | | } |
| | | arg.AddArg("ret","Ok"); |
| | | xwin::MessageBox(GetHWND(),"ä¿åæåï¼","æç¤º",0); |
| | | //alert("ä¿åæå"); |
| | | dw_base.ResetUpdateStatus(); |
| | | //dw_bank.ResetUpdateStatus(); |
| | | //xwin::SendMessage(parenthwnd, 0x401, "maintsave", 0);//éç¥listçªå£æ´æ°æ°æ® |
| | | } |
| | | //alert("ä¿åæå"); |
| | | dw_base.Redraw(); |
| | | //dw_bank.Redraw(); |
| | | CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | //alert(comdid); |
| | | if(comdid=="xmOk") OnSave(); |
| | | else if(comdid=="addrow") OnAddrow(); |
| | | else if(comdid=="deleterow") OnDeleterow(); |
| | | //else if(comdid=="AddRow") OnAddRow(); |
| | | //else if(comdid=="InsertRow") OnInsertRow(); |
| | | //else if(comdid=="DeleteRow")OnDeleteRow(); |
| | | return 1; |
| | | } |
| | | |
| | | //æé®äºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //æé®äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | //AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent("dw_base","DWV_ITEMCHANGED",OnItemChanged); |
| | | AttachEvent("dw_base","DWV_CLICKED",OnClick); |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | if(GetParam()) |
| | | { |
| | | int p = GetParam(); |
| | | xaserverarg args = new xaserverarg; |
| | | args.setNativePointer(p); |
| | | string id = args.GetArgString("EntityID"); |
| | | //alert(id); |
| | | if(id=="new") |
| | | { |
| | | |
| | | //OnAddNew(); |
| | | } |
| | | else |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | if(getUrl("/sale/data/PaymentTerm/entity/base12", args.GetString(), x) != 1) |
| | | { |
| | | alert("é误"); |
| | | return -1; |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_base.Retrieve(x); |
| | | //dw_bank.Retrieve(x); |
| | | dw_base.Redraw(); |
| | | //dw_bank.Redraw(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | //maint::onload(); |
| | | //maint::onloaded(); |
| | | dw_base = GetControl("dw_base"); |
| | | dw_cell = new xcell; |
| | | dw_cell.setNativePointer(dw_base.QueryItem("ixcell")); |
| | | dw_base.openUrl("/sale/view/Payment/template/Payment/maint"); |
| | | //alert("1233"); |
| | | OnRetrieve(); |
| | | OnAttachEvent(); |
| | | //dw_base = GetControl("dw_base"); |
| | | |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | //maint::onloaded(); |
| | | //alert("response"); |
| | | //dw_base = GetControl("dw_base"); |
| | | //dw_cell = new xcell; |
| | | //dw_cell.setNativePointer(dw_base.QueryItem("ixcell")); |
| | | return -1; |
| | | } |
| | | |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | use "base.view.vd" |
| | | |
| | | unit trade |
| | | [ |
| | | class ProfitParamList : public frame |
| | | { |
| | | xdwgrid dw_list; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | { |
| | | SetAgentNodeContent (anode,m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | int OnSave() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(xaserverarg::CreateInstance()); |
| | | arg.AddArg("content",x.GetXml()); |
| | | if(url::get("/sale/data/Gdn/update/ProParamUpdate", arg.GetString(),x)!=1) |
| | | { |
| | | string error = x.GetXmlDoc().text; |
| | | alert("err:"+error); |
| | | return 1; |
| | | } |
| | | string str = x.GetXmlDoc().documentElement.getAttribute("text"); |
| | | if(str == "true") |
| | | { |
| | | dw_list.ResetUpdateStatus(); |
| | | dw_list.Redraw(); |
| | | alert("ä¿åæå!"); |
| | | }else |
| | | { |
| | | alert("ä¿å失败!"); |
| | | } |
| | | } |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid == "xmsave") |
| | | { |
| | | OnSave(); |
| | | } |
| | | else if(comdid == "xmrefresh") |
| | | { |
| | | OnRetrieve(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | } |
| | | |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x = new xml; |
| | | x = ViewObject::RetrieveData("/sale/data/Gdn/profit/profitParamList"); |
| | | if(x) |
| | | { |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | OnAttachEvent(); |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.openUrl("/sale/view/VATNotify/template/profitparam/list"); |
| | | |
| | | OnRetrieve(); |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use"lang.vl" |
| | | use "win.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "treeview.vm" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "file.vl" |
| | | use "list.vl" |
| | | unit vbusiness.vpage |
| | | [ |
| | | QuickCode is extend list; |
| | | about QuickCode |
| | | [ |
| | | field: |
| | | |
| | | method: |
| | | [ |
| | | xdwgrid__ dw_list; |
| | | |
| | | string m_config; |
| | | string m_agent; |
| | | string m_id; |
| | | string m_dbmap; |
| | | string m_name; |
| | | string strconfig; |
| | | msxml::IXMLDOMDocument m_configDoc; |
| | | int alert(string str) |
| | | { |
| | | //win__::MessageBox(this.GetHWND(),str,"æç¤º:",0); |
| | | TApp::alert(this,str); |
| | | return 0; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | string magent = m_agent; |
| | | if (magent == ""){ |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | TFile::get(m_config, x); |
| | | var agent = x.GetXmlDoc().selectSingleNode("config/agentarea/*[1]"); |
| | | if(agent){ |
| | | magent = agent.xml; |
| | | trace(magent); |
| | | m_agent = magent;//agent.xml; |
| | | SetAgentNodeContent (anode,magent); |
| | | } |
| | | } |
| | | else |
| | | SetAgentNodeContent (anode,m_agent); |
| | | return 1; |
| | | } |
| | | |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | if(comdid == "save"){ |
| | | //type |
| | | xaserverarg__ args=new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("id",m_id); |
| | | args.AddArg("name", m_name); |
| | | xml__ y=new xml__; |
| | | y.setNativePointer(xml__::CreateInstance()); |
| | | //TDataSet::exec(m_config,"savetype",args,y); |
| | | //url::post("QuickCode/pref/quickcode_type.save",args.GetString(),y); |
| | | //save |
| | | |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | msxml::IXMLDOMElement e= x.GetXmlDoc().documentElement; |
| | | e.SetAttribute("id", m_id); |
| | | //arg.AddArg("id",m_id); |
| | | arg.AddArg("content",e.xml); |
| | | arg.AddArg("dbmap", m_dbmap); |
| | | //trace("-->",m_id); |
| | | //trace("-->",m_dbmap); |
| | | //trace(e.xml); |
| | | /*if(TDataSet::exec(m_config,"save",arg,x)!=1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("ä¿ååºé!"); |
| | | return 0; |
| | | }*/ |
| | | //trace(m_dbmap); |
| | | trace(x.GetXml()); |
| | | if (url::get("QuickCode/pref/quickcode.save",arg.GetString(),x) != 1) |
| | | { |
| | | string error = x.GetXmlDoc().text; |
| | | trace(error); |
| | | } |
| | | trace(x.GetXml()); |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert("ä¿ååºé2!"); |
| | | return 0; |
| | | } |
| | | dw_list.ResetUpdateStatus(); |
| | | alert("ä¿åæå!"); |
| | | } |
| | | else if(comdid=="add"){ |
| | | dw_list.InsertRow(0); |
| | | int rows = dw_list.GetRowCount(); |
| | | dw_list.SetRow(rows); |
| | | dw_list.SetItemString(rows,"ToCurrencyCode","RMB"); |
| | | dw_list.SetItemDisplayString(rows,"ToCurrencyCode","人æ°å¸"); |
| | | } |
| | | else if(comdid=="insert"){ |
| | | int row = dw_list.GetRow(); |
| | | if(row<1 || row>dw_list.GetRowCount()) return 0; |
| | | dw_list.InsertRow(row); |
| | | dw_list.SetItemString(row,"ToCurrencyCode","RMB"); |
| | | dw_list.SetItemDisplayString(row,"ToCurrencyCode","人æ°å¸"); |
| | | } |
| | | else if(comdid == "delet"){ |
| | | /*int rows = dw_list.GetRowCount(); |
| | | int row2 = dw_list.GetPrevSelectRow(rows); |
| | | while(row2 > 0){ |
| | | dw_list.DeleteRow(row2); |
| | | row2 = dw_list.GetPrevSelectRow(row2 - 1); |
| | | } |
| | | dw_list.SelectRow(0, false);*/ |
| | | int row2 = dw_list.GetRow(); |
| | | if(row2<1 || row2>dw_list.GetRowCount()) return 0; |
| | | dw_list.DeleteRow(row2); |
| | | } |
| | | else if(comdid == "import"){ |
| | | if(m_id=="FND_ExchangeRate") |
| | | { |
| | | int ll_delq = win__::MessageBox(this.GetHWND(), "ç¡®å®è¦ä»èç³»ç»å¯¼å
¥æ±çæ°æ®å?","æç¤º",1); |
| | | if (ll_delq != 1) |
| | | return 0; |
| | | xml__ xi=new xml__; |
| | | xi.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ argi=new xaserverarg__; |
| | | argi.setNativePointer(argi.CreateInstance()); |
| | | if (url::get("QuickCode/ExchangeRate/import",argi.GetString(),xi) != 1) |
| | | { |
| | | trace(xi.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | alert("导å
¥æå!"); |
| | | dw_list.Redraw(); |
| | | } |
| | | |
| | | } |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 0; |
| | | } |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(""+evt.pStrID); |
| | | } |
| | | int OnSetFocus(ref TNotifyEvent evt,int p){ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | int OnClicked(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int row = hdr.row; |
| | | int col=hdr.col + 1; |
| | | string colname=dw_list.GetColumnName(col); |
| | | trace(colname); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | string comdid; |
| | | if(colname=="CategoryID") |
| | | { |
| | | openUrl("产åèµæ.vface/xpage/product/category/dialog", arg); |
| | | comdid = arg.GetArgString("comdid"); |
| | | if(comdid=="ok") |
| | | { |
| | | string CategoryID = arg.GetArgString("CategoryID"); |
| | | string CName = arg.GetArgString("CName"); |
| | | dw_list.SetItemDisplayString(row,colname,CName); |
| | | dw_list.SetItemString(row,colname,CategoryID); |
| | | dw_list.Redraw(); |
| | | } |
| | | } |
| | | else if(colname=="MkOrgId") |
| | | { |
| | | openUrl("ç»ç»æ¶æ.vface/xpage/HrOrg/Chart", arg); |
| | | comdid = arg.GetArgString("comdid"); |
| | | if(comdid=="xmOk") |
| | | { |
| | | string OrgName = arg.GetArgString("OrgName"); |
| | | string OrgId = arg.GetArgString("OrgId"); |
| | | dw_list.SetItemDisplayString(row,colname,OrgName); |
| | | dw_list.SetItemString(row,colname,OrgId); |
| | | dw_list.Redraw(); |
| | | } |
| | | } |
| | | else if(colname=="Cid") |
| | | { |
| | | 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_list.SetItemDisplayString(row,colname,sPersonName); |
| | | dw_list.SetItemString(row,colname,sPersonID); |
| | | dw_list.Redraw(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int OnDoubleClicked(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int row = hdr.row; |
| | | if(row<1 || row > dw_list.GetRowCount() ) return 0; |
| | | |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | //string str = hdr.data; |
| | | string colname=hdr.colname; |
| | | string str = dw_list.GetItemString(row, colname); |
| | | arg.AddArg("value",str); |
| | | openUrl("/sale/view/view.dlg/xpage/memo/edit", arg); |
| | | string comdid = arg.GetArgString("comdid"); |
| | | if(comdid=="xmOK") |
| | | { |
| | | string value = arg.GetArgString("value"); |
| | | dw_list.SetItemString(row,colname,value); |
| | | dw_list.Redraw(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int ItemOutput() |
| | | { |
| | | string d = xaserver__::GetCurrentDate(); |
| | | d = d.left(10) +""; |
| | | dw_list.SaveAs(d); |
| | | return 1; |
| | | } |
| | | int OnSelectAllRow() |
| | | { |
| | | int rows = this.dw_list.GetRowCount(); |
| | | if(rows < 1) return -1; |
| | | this.dw_list.SelectRow(1, rows, true); |
| | | this.dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | int OnRowCopy() |
| | | { |
| | | int rows = this.dw_list.GetRowCount(); |
| | | if(rows < 1) return -1; |
| | | int cols = this.dw_list.GetColumnCount(); |
| | | string str = ""; |
| | | int row = this.dw_list.GetNextSelectRow(1); |
| | | int i; |
| | | while(row > 0) |
| | | { |
| | | string tmp1 = ""; |
| | | for(i=1; i<cols; i++) |
| | | { |
| | | int w = this.dw_list.GetColumnWidth(i); |
| | | if(w < 5) continue; |
| | | string tmp; |
| | | if(this.dw_list.GetItemDisplayString(row, i + 1)) |
| | | tmp = this.dw_list.GetItemDisplayString(row, i + 1); |
| | | else |
| | | tmp = this.dw_list.GetItemString(row, i + 1); |
| | | tmp1 += tmp + "\t"; |
| | | } |
| | | str += tmp1 + "\r\n"; |
| | | row = this.dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | this.dw_list.SetDataToClip(str); |
| | | return 1; |
| | | } |
| | | int OnColCopy(string col) |
| | | { |
| | | int rows = this.dw_list.GetRowCount(); |
| | | if(rows < 1) return -1; |
| | | string str = ""; |
| | | int row = this.dw_list.GetNextSelectRow(1); |
| | | while(row > 0) |
| | | { |
| | | string tmp; |
| | | if(this.dw_list.GetItemDisplayString(row, col)) |
| | | tmp = this.dw_list.GetItemDisplayString(row,col); |
| | | else |
| | | tmp = this.dw_list.GetItemString(row, col); |
| | | str += tmp + "\r\n"; |
| | | row = this.dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | this.dw_list.SetDataToClip(str); |
| | | |
| | | return 1; |
| | | } |
| | | int OnRClick(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int row = hdr.row; |
| | | |
| | | int m = win__::CreatePopupMenu(); |
| | | int MF_STRING = 0x00000000; |
| | | int MF_DISABLED = 0x00000002; |
| | | int TPM_RIGHTBUTTON = 0x0002; |
| | | int TPM_RETURNCMD = 0x0100; |
| | | int MF_CHECKED = 0x8; |
| | | int MF_SEPARATOR = 0x0800; |
| | | win__::AppendMenu(m,MF_STRING, 1, "å¤å¶è¡"); |
| | | win__::AppendMenu(m,MF_STRING, 101, "å¤å¶å"); |
| | | win__::AppendMenu(m,MF_SEPARATOR, -1, ""); |
| | | win__::AppendMenu(m,MF_STRING, 2, "ȫѡ"); |
| | | win__::AppendMenu(m,MF_SEPARATOR, -1, ""); |
| | | win__::AppendMenu(m,MF_STRING, 4, "导åºå°Excel"); |
| | | win__::AppendMenu(m,MF_SEPARATOR, -1, ""); |
| | | win__::AppendMenu(m,MF_STRING, 6, "æ¾ç¤ºå设置"); |
| | | xrect xr; |
| | | xpoint pt; |
| | | win__::GetCursorPos(pt); |
| | | int ret=win__::TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, this.GetHWND(), xr); |
| | | |
| | | //trace(ret); |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | if(ret == 1) {OnRowCopy();} |
| | | else if(ret == 101) { |
| | | string colname=hdr.colname; |
| | | if(colname != "") |
| | | OnColCopy(colname); |
| | | } |
| | | else if(ret == 2) {OnSelectAllRow();} |
| | | else if(ret == 4) {ItemOutput();} |
| | | else if(ret == 6) {} |
| | | xutil__::RestoreCursor(hCursor); |
| | | |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent("dw_list","DWV_DOUBLECLICKED",OnDoubleClicked);//è¡åå» |
| | | AttachEvent("dw_list","DWV_ITEMBEINGEDIT",OnClicked); |
| | | AttachEvent("dw_list","DWV_RCLICKED",OnRClick);//é¼ æ å³é® |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | trace("asdasd"); |
| | | |
| | | if(m_id.find("__",0) >0) |
| | | { |
| | | m_id = m_id.mid(0, m_id.find("__",0)); |
| | | arg.AddArg("id",m_id); |
| | | //trace(m_id); |
| | | /*if (TDataSet::exec(m_config, "query_remark", arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }*/ |
| | | if (url::get("QuickCode/entity/list_remark",arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | } |
| | | else |
| | | { trace("asdasd"); |
| | | arg.AddArg("id",m_id); |
| | | arg.AddArg("querytxt",""); |
| | | /*if (TDataSet::exec(m_config, "query", arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }*/ |
| | | if (url::get("QuickCode/entity/list",arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | string jxParam(string p, string n) |
| | | { |
| | | if(p != "") |
| | | { |
| | | p +="&"; |
| | | int i = 1; |
| | | while (p.find("=",0)>0) |
| | | { |
| | | string name = p.mid(0, p.find("=",0)); |
| | | string value = p.mid(p.find("=",0) + 1, p.find("&",0) - p.find("=",0) - 1); |
| | | if(name==n) return ""+value; |
| | | i += 1; |
| | | p = p.mid(p.find("&",0) + 1, p.length()); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | int getURLParam() |
| | | { |
| | | if(GetParam()) |
| | | { |
| | | xpage__ xp=new xpage__; |
| | | xp.setNativePointer(this.GetXPage()); |
| | | string aurl = xp.GetWkUrl(); |
| | | xaserverarg__ arg; |
| | | if(aurl && aurl.find("native=true",0)>0) |
| | | { |
| | | int p = this.GetParam(); |
| | | arg = new xaserverarg__; |
| | | arg.setNativePointer(p); |
| | | } |
| | | else |
| | | { |
| | | arg = GetParam(); |
| | | } |
| | | string config = arg.GetArgString("config"); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | if(config == "") |
| | | { |
| | | string configXml = arg.GetArgString("configxml"); |
| | | x.LoadXml(configXml); |
| | | } |
| | | else |
| | | { |
| | | getUrl(config, "", x); |
| | | } |
| | | m_configDoc = x.GetXmlDoc(); |
| | | |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int loaded() |
| | | { |
| | | getURLParam(); |
| | | msxml::IXMLDOMDocument ee=m_configDoc; |
| | | string id=m_id; |
| | | var n = ee.selectSingleNode("//list/dwview[@type='dwgrid'][@id='"+id+"']"); |
| | | string vface = m_configDoc.selectSingleNode("//vface[1]").text; |
| | | string dwname = "";//e.selectsingleNode("@name").text; |
| | | string tpl = "";//e.selectsingleNode("@url").text; |
| | | string dbmap = ""; |
| | | if(n) |
| | | { |
| | | msxml::IXMLDOMElement e = n; |
| | | //trace(e.xml); |
| | | if(e.selectSingleNode("@name")) dwname = e.selectSingleNode("@name").text; |
| | | if(e.selectSingleNode("@url")) tpl = e.selectSingleNode("@url").text; |
| | | if(e.selectSingleNode("@dbmap")) dbmap = e.selectSingleNode("@dbmap").text; |
| | | //trace(vface +"/"+ tpl); |
| | | //trace(selectmode); |
| | | } |
| | | else |
| | | { |
| | | var m = ee.selectSingleNode("//list"); |
| | | msxml::IXMLDOMElement e1 = m; |
| | | //trace(e.xml); |
| | | if(e1.selectSingleNode("@name")) dwname = e1.selectSingleNode("@name").text; |
| | | if(e1.selectSingleNode("@url")) tpl = e1.selectSingleNode("@url").text; |
| | | if(e1.selectSingleNode("@dbmap")) dbmap = e1.selectSingleNode("@dbmap").text; |
| | | |
| | | } |
| | | m_dbmap = dbmap; |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(GetControl(dwname)); |
| | | dw_list.openUrl(vface +"/"+ tpl); |
| | | //dw_list.SetSelectionMode(4); |
| | | |
| | | } |
| | | int Onital() |
| | | { |
| | | //å°åº |
| | | xml__ x1=new xml__; |
| | | x1.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg1=new xaserverarg__; |
| | | arg1.setNativePointer(arg1.CreateInstance()); |
| | | arg1.AddArg("id","å°åº"); |
| | | if (url::get("/sale/data/QuickCode/entity/list",arg1.GetString(),x1) != 1) |
| | | { |
| | | trace(x1.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | |
| | | var list = x1.GetXmlDoc().selectNodes("root/item"); |
| | | int i; |
| | | int s = list.length; |
| | | if(s>0) |
| | | { |
| | | string str = "<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='ä¿æ¤' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='<data>"; |
| | | for(i=0;i<s;i++) |
| | | { |
| | | msxml::IXMLDOMElement xitem = list.item(i); |
| | | string id=""; |
| | | if(xitem.selectSingleNode("Code")) |
| | | id = xitem.selectSingleNode("Code").text; |
| | | string name =""; |
| | | if(xitem.selectSingleNode("Meaning")) |
| | | name = xitem.selectSingleNode("Meaning").text; |
| | | string tmp = "<row><æ¾ç¤ºå>"+name+"</æ¾ç¤ºå><æ°æ®å>"+id+"</æ°æ®å></row>"; |
| | | str += tmp; |
| | | } |
| | | str += "</data>'/></cellprop>"; |
| | | |
| | | |
| | | dw_list.SetColumnProps("AreaCode",str); |
| | | } |
| | | //å¸å« |
| | | xml__ x2=new xml__; |
| | | x2.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg2=new xaserverarg__; |
| | | arg2.setNativePointer(arg2.CreateInstance()); |
| | | arg2.AddArg("id","FND_Currency"); |
| | | if (url::get("/sale/data/QuickCode/entity/list",arg2.GetString(),x2) != 1) |
| | | { |
| | | trace(x2.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | |
| | | var list1 = x2.GetXmlDoc().selectNodes("root/item"); |
| | | int j; |
| | | int s1 = list1.length; |
| | | if(s1>0) |
| | | { |
| | | string str1 = "<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='ä¿æ¤' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='<data>"; |
| | | for(j=0;j<s1;j++) |
| | | { |
| | | msxml::IXMLDOMElement xitem1 = list1.item(j); |
| | | string id1=""; |
| | | if(xitem1.selectSingleNode("Code")) |
| | | id1 = xitem1.selectSingleNode("Code").text; |
| | | string name1 =""; |
| | | if(xitem1.selectSingleNode("Name")) |
| | | name1 = xitem1.selectSingleNode("Name").text; |
| | | string tmp1 = "<row><æ¾ç¤ºå>"+name1+"</æ¾ç¤ºå><æ°æ®å>"+id1+"</æ°æ®å></row>"; |
| | | str1 += tmp1; |
| | | } |
| | | str1 += "</data>'/></cellprop>"; |
| | | |
| | | |
| | | dw_list.SetColumnProps("FromCurrencyCode",str1); |
| | | } |
| | | //å½å®¶ |
| | | xml__ x3=new xml__; |
| | | x3.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg3=new xaserverarg__; |
| | | arg3.setNativePointer(arg3.CreateInstance()); |
| | | arg3.AddArg("id","FND_Country"); |
| | | if (url::get("/sale/data/QuickCode/entity/list",arg3.GetString(),x3) != 1) |
| | | { |
| | | trace(x3.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | |
| | | var list2 = x3.GetXmlDoc().selectNodes("root/item"); |
| | | int k; |
| | | int s2 = list2.length; |
| | | if(s2>0) |
| | | { |
| | | string str2 = "<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='ä¿æ¤' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='<data>"; |
| | | for(k=0;k<s2;k++) |
| | | { |
| | | msxml::IXMLDOMElement xitem2 = list2.item(k); |
| | | string id2=""; |
| | | if(xitem2.selectSingleNode("Code")) |
| | | id2 = xitem2.selectSingleNode("Code").text; |
| | | string name2 =""; |
| | | if(xitem2.selectSingleNode("Name")) |
| | | name2 = xitem2.selectSingleNode("Name").text; |
| | | string tmp2 = "<row><æ¾ç¤ºå>"+name2+"</æ¾ç¤ºå><æ°æ®å>"+id2+"</æ°æ®å></row>"; |
| | | str2 += tmp2; |
| | | } |
| | | str2 += "</data>'/></cellprop>"; |
| | | |
| | | |
| | | dw_list.SetColumnProps("MkCountryId",str2); |
| | | } |
| | | dw_list.SetReadOnlyColumn("ToCurrencyCode"); |
| | | } |
| | | int onload() |
| | | { |
| | | m_config = "QuickCode.config"; |
| | | m_agent = ""; |
| | | |
| | | //dw_list = new xdwgrid__; |
| | | //dw_list.setNativePointer(GetControl("dw_list")); |
| | | //dw_list.SetSelectionMode(4); |
| | | //dw_list.AllowSort(false); |
| | | if(this.GetParam()) |
| | | { |
| | | xaserverarg__ arg = this.GetParam(); |
| | | string id = arg.GetArgString("id"); |
| | | if(id == "") return 0; |
| | | m_id = id; |
| | | loaded(); |
| | | |
| | | /*string tpl = arg.GetArgString("tpl"); |
| | | if(tpl == "" && (m_id.find("__",0) >0)) |
| | | tpl = "QuickCode.tpl/QuickCode_Remark"; |
| | | else if(tpl == "" ) |
| | | tpl = "QuickCode.tpl/QuickCode"; |
| | | dw_list.SetDataObject(GetServerUrl(),"dev:sheet["+tpl+"]"); |
| | | string dbmap = arg.GetArgString("dbmap"); |
| | | if(dbmap == "" && (m_id.find("__",0) >0) ) |
| | | dbmap = "QuickCode_Remark.dbmap"; |
| | | else if(dbmap == "") |
| | | dbmap ="QuickCode.dbmap"; |
| | | m_dbmap = dbmap; |
| | | string name = arg.GetArgString("name"); |
| | | if(name == "") |
| | | name = id; |
| | | m_name = name; |
| | | string title = arg.GetArgString("title"); |
| | | if(title != "") |
| | | win__::SetWindowText(this.GetHWND(),title);*/ |
| | | |
| | | |
| | | |
| | | |
| | | /* |
| | | param p = this.GetParam(); |
| | | string pa = ""+p; |
| | | //string pa = "id=HrOrgType&title=客æ·ç±»å"; |
| | | string id = jxParam(pa,"id"); |
| | | if(id == "") return 0; |
| | | m_id = id; |
| | | string tpl = jxParam(pa,"tpl"); |
| | | if(tpl == "" && (m_id.find("__",0) >0)) |
| | | tpl = "QuickCode.tpl/QuickCode_Remark"; |
| | | else if(tpl == "" ) |
| | | tpl = "QuickCode.tpl/QuickCode"; |
| | | dw_list.SetDataObject(GetServerUrl(),"dev:sheet["+tpl+"]"); |
| | | string dbmap = jxParam(pa,"dbmap"); |
| | | if(dbmap == "" && (m_id.find("__",0) >0) ) |
| | | dbmap = "QuickCode_Remark.dbmap"; |
| | | else if(dbmap == "") |
| | | dbmap ="QuickCode.dbmap"; |
| | | m_dbmap = dbmap; |
| | | //trace(m_dbmap); |
| | | |
| | | string name = jxParam(pa,"name"); |
| | | if(name == "") |
| | | name = id; |
| | | m_name = name; |
| | | string title = jxParam(pa,"title"); |
| | | if(title != "") |
| | | win__::SetWindowText(this.GetHWND(),title);*/ |
| | | OnRetrieve(); |
| | | } |
| | | |
| | | OnAttachEvent(); |
| | | SetAgent(); |
| | | Onital(); |
| | | return 1; |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use"lang.vl" |
| | | use "win.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "treeview.vm" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "file.vl" |
| | | use "list.vl" |
| | | unit vbusiness.vpage |
| | | [ |
| | | QuickCode_Tree is extend list; |
| | | about QuickCode_Tree |
| | | [ |
| | | field: |
| | | |
| | | method: |
| | | [ |
| | | xdwgrid__ dw_list; |
| | | treeview__ tv_1; |
| | | string m_config; |
| | | string m_agent; |
| | | string m_id; |
| | | string m_dbmap; |
| | | string treexquery; |
| | | string c_type; |
| | | msxml::IXMLDOMDocument m_configDoc; |
| | | string kpstr; |
| | | string strtpl; |
| | | string m_QueryTxt; |
| | | int alert(string str) |
| | | { |
| | | TApp::alert(this,str); |
| | | //win__::MessageBox(this.GetHWND(),str,"æç¤º:",0); |
| | | return 0; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = win__::GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml+""; |
| | | SetAgentNodeContent (anode,s); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | dw_list.AcceptText(); |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("id",m_id); |
| | | arg.AddArg("sType",c_type); |
| | | arg.AddArg("QueryTxt", m_QueryTxt ); |
| | | //trace(arg.GetString()); |
| | | /*if (TDataSet::exec(m_config, "query1", arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }*/ |
| | | if (url::get("QuickCode/entity/listaddtree",arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | if(x.GetXml()=="") |
| | | { |
| | | xml__ xx=new xml__; |
| | | xx.setNativePointer(xml__::CreateInstance()); |
| | | xx.LoadXml("<root/>"); |
| | | dw_list.Retrieve(xx); |
| | | dw_list.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | 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); |
| | | //c_type=dw_type.GetItemLabel(hitem); |
| | | //妿æ¯è·èç¹ |
| | | int roothitem=treeview__::GetRootItem(wid); |
| | | if(hitem == roothitem){ |
| | | c_type=""; |
| | | } |
| | | else |
| | | { |
| | | c_type = treeview__::GetItemLabel(wid,hitem); |
| | | |
| | | } |
| | | OnRetrieve(); |
| | | return 1; |
| | | } |
| | | int adduomfolder() |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("note","æ°å¢"); |
| | | arg.AddArg("m_id",m_id); |
| | | //win__::OpenWindow("dev:xpage[AddUomGroup.vx]",arg); |
| | | openUrl("å
Œ
±è®¾ç½®.vface/xpage/quickcode/AddGroup", arg); |
| | | string ok = arg.GetArgString("return"); |
| | | if(ok == "ok"){ |
| | | string GroupName = arg.GetArgString("GroupName"); |
| | | xml__ xx=new xml__; |
| | | xx.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("GroupName",GroupName); |
| | | args.AddArg("OldGroupName",""); |
| | | args.AddArg("m_id",m_id); |
| | | /*if(TFile::exec(m_config,"updateuomtype",args,xx)!=1) |
| | | { |
| | | trace("error:"+xx.GetXml()); |
| | | alert("ä¿ååºé!"); |
| | | return 0; |
| | | }*/ |
| | | if (url::get("QuickCode/pref/quickcode_tree.updateGroup",args.GetString(),xx) != 1) |
| | | { |
| | | trace("error:"+xx.GetXml()); |
| | | alert("ä¿ååºé!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | string vv=xx.GetXmlDoc().documentElement.text; |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | x.LoadXml("<row GroupName='"+GroupName+"'/>"); |
| | | int root = treeview__::GetRootItem(tv_1.GetId()); |
| | | if(vv=="OK") |
| | | { |
| | | treeview__::InsertChildItem(tv_1.GetId(), root, GroupName,x.GetXmlDoc().documentElement, 15); |
| | | } |
| | | |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int modifyuomfolder() |
| | | { |
| | | int wid = tv_1.GetId(); |
| | | int h = treeview__::GetSelectedItem(wid); |
| | | if (h<1) |
| | | { |
| | | alert("è¯·éæ©éè¦ä¿®æ¹çç»å"); |
| | | return 0; |
| | | } |
| | | int roothitem=treeview__::GetRootItem(wid); |
| | | if(h==roothitem) |
| | | { |
| | | alert("ä¸è½ä¿®æ¹æ ¹èç¹åç§°ï¼"); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement e = treeview__::GetItemData(wid,h); |
| | | trace(e.xml); |
| | | //string OldGroupName= e.SelectSingleNode("@GroupName").text; |
| | | string OldGroupName= treeview__::GetItemLabel(wid,h); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("note","ä¿®æ¹"); |
| | | arg.AddArg("m_id",m_id); |
| | | arg.AddArg("GroupName",OldGroupName); |
| | | win__::OpenWindow("dev:xpage[AddUomGroup.vx]",arg); |
| | | string ok = arg.GetArgString("return"); |
| | | if(ok == "ok"){ |
| | | string NewGroupName = arg.GetArgString("GroupName"); |
| | | xml__ xx=new xml__; |
| | | xx.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("GroupName",NewGroupName); |
| | | args.AddArg("OldGroupName",OldGroupName); |
| | | args.AddArg("m_id",m_id); |
| | | /*if(TFile::exec(m_config,"updateuomtype",args,xx)!=1) |
| | | { |
| | | trace("error:"+xx.GetXml()); |
| | | alert("ä¿ååºé!"); |
| | | return 0; |
| | | }*/ |
| | | if (url::get("QuickCode/pref/quickcode_tree.updateGroup",args.GetString(),xx)!=1) |
| | | { |
| | | trace("error:"+xx.GetXml()); |
| | | alert("ä¿ååºé!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | trace(xx.GetXml()); |
| | | string vv=xx.GetXmlDoc().documentElement.text; |
| | | if(vv=="OK") |
| | | { |
| | | treeview__::SetItemLabel(tv_1.GetId(), h,NewGroupName); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int deluomfolder() |
| | | { |
| | | |
| | | int wid = tv_1.GetId(); |
| | | int hitem=treeview__::GetSelectedItem(wid); |
| | | if (hitem<1) |
| | | { |
| | | alert("è¯·éæ©éè¦å é¤çç»å"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | |
| | | int s=dw_list.GetRowCount(); |
| | | if (s>0) |
| | | { |
| | | alert("该åç»ä¸é¢å卿°æ®ï¼ä¸è½å é¤ï¼"); |
| | | return 0; |
| | | } |
| | | int roothitem=treeview__::GetRootItem(wid); |
| | | if(hitem==roothitem) |
| | | { |
| | | alert("ä¸è½å 餿 ¹èç¹ï¼"); |
| | | } |
| | | else |
| | | { |
| | | //缺å°å¤æå é¤çæ¡ä»¶ |
| | | string GroupName =treeview__::GetItemLabel(wid,hitem); |
| | | if(win__::MessageBox(GetHWND(),"ç¡®å®å é¤ç»åï¼"+GroupName+" åï¼","æç¤º",1)==1) |
| | | { |
| | | xml__ xx=new xml__; |
| | | xx.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("GroupName",GroupName); |
| | | arg.AddArg("m_id",m_id); |
| | | trace(GroupName); |
| | | trace(m_id); |
| | | /*if (xaserver__::ExecXAction(GetServerUrl(),"[delete.type.FND_UOM.xa]",arg.GetString()) == 1) |
| | | { |
| | | treeview__::DeleteItem(wid,hitem); |
| | | //OnTreeSelChanged(); |
| | | }*/ |
| | | if (url::get("QuickCode/pref/quickcode_tree.deleteGroup",arg.GetString(),xx)== 1) |
| | | { |
| | | treeview__::DeleteItem(wid,hitem); |
| | | } |
| | | else |
| | | alert("å é¤å¤±è´¥ï¼"); |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | xdwgrid__ getDW() |
| | | { |
| | | return dw_list; |
| | | } |
| | | int GridSearch() |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | xaserver__::LoadUrl("","dev:vface[å
Œ
±è®¾ç½®.vface]","",x); |
| | | //trace(x.GetXml()); |
| | | //trace(strtpl); |
| | | string aa=strtpl; |
| | | var doc = x.GetXmlDoc(); |
| | | var n = doc.selectSingleNode("//resource[@url='"+aa+"']/@src"); |
| | | //trace(n.text); |
| | | |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sheet",n.text); |
| | | arg.AddArg("search",list::m_QueryTxt); |
| | | openUrl("view.dlg.vface/xpage/grid/column/search", arg); |
| | | string ok = arg.GetArgString("return"); |
| | | if(ok == "ok"){ |
| | | string txt = arg.GetArgString("search"); |
| | | if(txt != ""){ |
| | | m_QueryTxt = txt; |
| | | //trace(txt); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | xdwgrid__ dw=getDW(); |
| | | if(comdid == "save"){ |
| | | dw_list.AcceptText(); |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | msxml::IXMLDOMElement e= x.GetXmlDoc().documentElement; |
| | | e.SetAttribute("id", m_id); |
| | | //arg.AddArg("id",m_id); |
| | | //trace(m_id); |
| | | //trace(m_dbmap); |
| | | if(m_id=="å¼ç¥¨é¶è¡") |
| | | { |
| | | xml__ kp = new xml__; |
| | | kp.setNativePointer(xml__::CreateInstance()); |
| | | kp.LoadXml("<root></root>"); |
| | | msxml::IXMLDOMElement ele= kp.GetXmlDoc().documentElement; |
| | | var list = e.SelectNodes("item[@update.modify='1' or @update.delete='1' ]"); |
| | | int j; |
| | | int k = list.length; |
| | | for (j=0; j<k; j++) |
| | | { |
| | | msxml::IXMLDOMElement ele1 = list.item(j); |
| | | ele.appendChild(ele1); |
| | | } |
| | | kpstr=ele.xml; |
| | | trace(ele.xml); |
| | | } |
| | | if(m_id=="å¼ç¥¨é¶è¡") |
| | | { |
| | | arg.AddArg("content",kpstr); |
| | | } |
| | | else |
| | | { |
| | | arg.AddArg("content",e.xml); |
| | | } |
| | | arg.AddArg("dbmap", m_dbmap); |
| | | /*if(TFile::exec(m_config,"save",arg,x)!=1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("ä¿ååºé!"); |
| | | return 0; |
| | | }*/ |
| | | trace(m_dbmap+"\r\n"+e.xml); |
| | | if (url::get("QuickCode/pref/quickcode.save",arg.GetString(),x) != 1) |
| | | { |
| | | string error = x.GetXmlDoc().text; |
| | | trace(error); |
| | | } |
| | | //trace(arg.GetString()); |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert("ä¿ååºé2!"); |
| | | return 0; |
| | | } |
| | | dw_list.ResetUpdateStatus(); |
| | | alert("ä¿åæå!"); |
| | | } |
| | | else if(comdid=="add"){ |
| | | dw.InsertRow(0); |
| | | int rows = dw.GetRowCount(); |
| | | dw.SetItemString(rows,"GroupName",c_type); |
| | | dw.SetItemString(rows,"BankName",c_type); |
| | | } |
| | | else if(comdid=="insert"){ |
| | | int row = dw.GetRow(); |
| | | if(row<1 || row>dw.GetRowCount()) return 0; |
| | | dw.InsertRow(row); |
| | | |
| | | dw.SetItemString(row,"GroupName",c_type); |
| | | } |
| | | else if(comdid == "delet"){ |
| | | dw_list.AcceptText(); |
| | | int row2 = dw.GetRow(); |
| | | if(row2<1 || row2>dw.GetRowCount()) return 0; |
| | | dw.DeleteRow(row2); |
| | | } |
| | | else if (comdid=="adduomfolder") |
| | | adduomfolder(); |
| | | else if (comdid=="modifyuomfolder") |
| | | modifyuomfolder(); |
| | | else if (comdid=="deluomfolder") |
| | | deluomfolder(); |
| | | else if (comdid=="search") |
| | | GridSearch(); |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 0; |
| | | } |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(""+evt.pStrID); |
| | | } |
| | | int OnSetFocus(ref TNotifyEvent evt,int p){ |
| | | SetAgent(); |
| | | tv_1 = new treeview__; |
| | | tv_1.setNativePointer(this.GetControl("tv_1")); |
| | | int wid = tv_1.GetId(); |
| | | int root = treeview__::GetRootItem(wid); |
| | | treeview__::ExpandItem(wid,root); |
| | | return 1; |
| | | } |
| | | int OnDoubleClicked(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int row = hdr.row; |
| | | if(row<1 || row > dw_list.GetRowCount() ) return 0; |
| | | |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | //string str = hdr.data; |
| | | string colname=hdr.colname; |
| | | string str = dw_list.GetItemString(row, colname); |
| | | arg.AddArg("value",str); |
| | | openUrl("/sale/view/view.dlg/xpage/memo/edit", arg); |
| | | string comdid = arg.GetArgString("comdid"); |
| | | if(comdid=="xmOK") |
| | | { |
| | | string value = arg.GetArgString("value"); |
| | | dw_list.SetItemString(row,colname,value); |
| | | dw_list.Redraw(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int ItemOutput() |
| | | { |
| | | string d = xaserver__::GetCurrentDate(); |
| | | d = d.left(10) +""; |
| | | dw_list.SaveAs(d); |
| | | return 1; |
| | | } |
| | | int OnSelectAllRow() |
| | | { |
| | | int rows = this.dw_list.GetRowCount(); |
| | | if(rows < 1) return -1; |
| | | this.dw_list.SelectRow(1, rows, true); |
| | | this.dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | int OnRowCopy() |
| | | { |
| | | int rows = this.dw_list.GetRowCount(); |
| | | if(rows < 1) return -1; |
| | | int cols = this.dw_list.GetColumnCount(); |
| | | string str = ""; |
| | | int row = this.dw_list.GetNextSelectRow(1); |
| | | int i; |
| | | while(row > 0) |
| | | { |
| | | string tmp1 = ""; |
| | | for(i=1; i<cols; i++) |
| | | { |
| | | int w = this.dw_list.GetColumnWidth(i); |
| | | if(w < 5) continue; |
| | | string tmp; |
| | | if(this.dw_list.GetItemDisplayString(row, i + 1)) |
| | | tmp = this.dw_list.GetItemDisplayString(row, i + 1); |
| | | else |
| | | tmp = this.dw_list.GetItemString(row, i + 1); |
| | | tmp1 += tmp + "\t"; |
| | | } |
| | | str += tmp1 + "\r\n"; |
| | | row = this.dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | this.dw_list.SetDataToClip(str); |
| | | return 1; |
| | | } |
| | | int OnColCopy(string col) |
| | | { |
| | | int rows = this.dw_list.GetRowCount(); |
| | | if(rows < 1) return -1; |
| | | string str = ""; |
| | | int row = this.dw_list.GetNextSelectRow(1); |
| | | while(row > 0) |
| | | { |
| | | string tmp; |
| | | if(this.dw_list.GetItemDisplayString(row, col)) |
| | | tmp = this.dw_list.GetItemDisplayString(row,col); |
| | | else |
| | | tmp = this.dw_list.GetItemString(row, col); |
| | | str += tmp + "\r\n"; |
| | | row = this.dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | this.dw_list.SetDataToClip(str); |
| | | |
| | | return 1; |
| | | } |
| | | int OnRClick(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int row = hdr.row; |
| | | |
| | | int m = win__::CreatePopupMenu(); |
| | | int MF_STRING = 0x00000000; |
| | | int MF_DISABLED = 0x00000002; |
| | | int TPM_RIGHTBUTTON = 0x0002; |
| | | int TPM_RETURNCMD = 0x0100; |
| | | int MF_CHECKED = 0x8; |
| | | int MF_SEPARATOR = 0x0800; |
| | | win__::AppendMenu(m,MF_STRING, 1, "å¤å¶è¡"); |
| | | win__::AppendMenu(m,MF_STRING, 101, "å¤å¶å"); |
| | | win__::AppendMenu(m,MF_SEPARATOR, -1, ""); |
| | | win__::AppendMenu(m,MF_STRING, 2, "ȫѡ"); |
| | | win__::AppendMenu(m,MF_SEPARATOR, -1, ""); |
| | | win__::AppendMenu(m,MF_STRING, 4, "导åºå°Excel"); |
| | | win__::AppendMenu(m,MF_SEPARATOR, -1, ""); |
| | | win__::AppendMenu(m,MF_STRING, 6, "æ¾ç¤ºå设置"); |
| | | xrect xr; |
| | | xpoint pt; |
| | | win__::GetCursorPos(pt); |
| | | int ret=win__::TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, this.GetHWND(), xr); |
| | | |
| | | //trace(ret); |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | if(ret == 1) {OnRowCopy();} |
| | | else if(ret == 101) { |
| | | string colname=hdr.colname; |
| | | if(colname != "") |
| | | OnColCopy(colname); |
| | | } |
| | | else if(ret == 2) {OnSelectAllRow();} |
| | | else if(ret == 4) {ItemOutput();} |
| | | else if(ret == 6) {} |
| | | xutil__::RestoreCursor(hCursor); |
| | | |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·å¾æ çéæ©äºä»¶ |
| | | AttachEvent("tv_1", "TVN_SELCHANGED",OnTreeSelChanged); |
| | | AttachEvent("dw_list","DWV_DOUBLECLICKED",OnDoubleClicked);//è¡åå» |
| | | AttachEvent("dw_list","DWV_RCLICKED",OnRClick);//é¼ æ å³é® |
| | | } |
| | | |
| | | |
| | | string jxParam(string p, string n) |
| | | { |
| | | if(p != "") |
| | | { |
| | | p +="&"; |
| | | int i = 1; |
| | | while (p.find("=",0)>0) |
| | | { |
| | | string name = p.mid(0, p.find("=",0)); |
| | | string value = p.mid(p.find("=",0) + 1, p.find("&",0) - p.find("=",0) - 1); |
| | | if(name==n) return ""+value; |
| | | i += 1; |
| | | p = p.mid(p.find("&",0) + 1, p.length()); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | int getURLParam() |
| | | { |
| | | if(GetParam()) |
| | | { |
| | | xpage__ xp=new xpage__; |
| | | xp.setNativePointer(this.GetXPage()); |
| | | string aurl = xp.GetWkUrl(); |
| | | xaserverarg__ arg; |
| | | if(aurl && aurl.find("native=true",0)>0) |
| | | { |
| | | int p = this.GetParam(); |
| | | arg = new xaserverarg__; |
| | | arg.setNativePointer(p); |
| | | } |
| | | else |
| | | { |
| | | arg = GetParam(); |
| | | } |
| | | string config = arg.GetArgString("config"); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | if(config == "") |
| | | { |
| | | string configXml = arg.GetArgString("configxml"); |
| | | x.LoadXml(configXml); |
| | | } |
| | | else |
| | | { |
| | | getUrl(config, "", x); |
| | | } |
| | | m_configDoc = x.GetXmlDoc(); |
| | | |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int loaded() |
| | | { |
| | | getURLParam(); |
| | | msxml::IXMLDOMDocument ee=m_configDoc; |
| | | string id=m_id; |
| | | var n = ee.selectSingleNode("//list/dwview[@type='dwgrid'][@id='"+id+"']"); |
| | | if(n) |
| | | { |
| | | msxml::IXMLDOMElement e = n; |
| | | //trace(e.xml); |
| | | string vface = m_configDoc.selectSingleNode("//vface[1]").text; |
| | | string dwname = "";//e.selectsingleNode("@name").text; |
| | | string tpl = "";//e.selectsingleNode("@url").text; |
| | | string dbmap = ""; |
| | | string strtreexquery=""; |
| | | if(e.selectSingleNode("@name")) dwname = e.selectSingleNode("@name").text; |
| | | if(e.selectSingleNode("@url")) tpl = e.selectSingleNode("@url").text; |
| | | if(e.selectSingleNode("@dbmap")) dbmap = e.selectSingleNode("@dbmap").text; |
| | | if(e.selectSingleNode("@treexquery")) strtreexquery = e.selectSingleNode("@treexquery").text; |
| | | m_dbmap = dbmap; |
| | | treexquery = strtreexquery; |
| | | //trace(vface +"/"+ tpl); |
| | | //trace(selectmode); |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(GetControl(dwname)); |
| | | dw_list.openUrl(vface +"/"+ tpl); |
| | | strtpl=tpl; |
| | | trace(tpl); |
| | | |
| | | } |
| | | } |
| | | int onload() |
| | | { |
| | | |
| | | |
| | | m_config = "QuickCode.config"; |
| | | m_agent = ""; |
| | | dw_list = new xdwtable__; |
| | | dw_list.setNativePointer(GetControl("dw_list")); |
| | | if(this.GetParam()) |
| | | { |
| | | xaserverarg__ arg = this.GetParam(); |
| | | //trace(arg.GetString()); |
| | | string id = arg.GetArgString("id"); |
| | | if(id == "") return 0; |
| | | m_id = id; |
| | | loaded(); |
| | | |
| | | /*string tpl = arg.GetArgString("tpl"); |
| | | if(tpl == "") |
| | | tpl = "QuickCode.tpl/QuickCode"; |
| | | dw_list.SetDataObject(GetServerUrl(),"dev:sheet["+tpl+"]"); |
| | | //dw_list.SetColHeaderHeight(0); |
| | | //dw_list.SetRowSelectorWidth(0); |
| | | string dbmap = arg.GetArgString("dbmap"); |
| | | if(dbmap == "") |
| | | dbmap = "QuickCode.dbmap"; |
| | | m_dbmap = dbmap; |
| | | string txquery=arg.GetArgString("treexquery"); |
| | | treexquery=txquery; |
| | | string title = arg.GetArgString("title"); |
| | | if(title != "") |
| | | win__::SetWindowText(this.GetHWND(),title);*/ |
| | | OnRetrieve(); |
| | | } |
| | | SetAgent(); |
| | | string aa=treexquery; |
| | | string xfNodeAgentArea2 = "treeagent"; |
| | | xnode__ tnode = new xnode__; |
| | | tnode.setNativePointer(GetAgentNode(xfNodeAgentArea2)); |
| | | string stree="<vbox><xtree name='tv_1' imagelist='0'>"; |
| | | stree +="<treeitem src='xquery:["+aa+"]' xcaption='@GroupName' xroot='/root' xpath='row' xchildpath='row' image='15' loop='yes' xdata='.'/>"; |
| | | stree +="</xtree></vbox>"; |
| | | SetAgentNodeContent (tnode,stree); |
| | | |
| | | tv_1 = new treeview__; |
| | | tv_1.setNativePointer(this.GetControl("tv_1")); |
| | | int wid = tv_1.GetId(); |
| | | int root = treeview__::GetRootItem(wid); |
| | | treeview__::ExpandItem(wid,root); |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use"lang.vl" |
| | | use "win.vl" |
| | | use "treeview.vm" |
| | | use "file.vl" |
| | | use "dev:vm[xdwtable.vm]" |
| | | |
| | | unit vbusiness.vpage |
| | | [ |
| | | SKUItemcategoryselect is extend TProduct; |
| | | about SKUItemcategoryselect |
| | | [ |
| | | field: |
| | | xdwtable__ dw_category; |
| | | method: |
| | | [ |
| | | treeview__ tv_gs; |
| | | //å½ä»¤åå¸å½æ° |
| | | string GetPath(int tv, int h) |
| | | { |
| | | string str = treeview__::GetItemLabel(tv, h); |
| | | int k = treeview__::GetParentItem(tv, h); |
| | | int r = treeview__::GetRootItem(tv); |
| | | while(k > 0 && r != k) |
| | | { |
| | | string tmp = treeview__::GetItemLabel(tv, k); |
| | | str = tmp+"\\" + str; |
| | | k = treeview__::GetParentItem(tv, k); |
| | | } |
| | | return str; |
| | | } |
| | | int xunhuan(int pItem, int hItem) |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_category.FindDwTable("Item",0)); |
| | | if(treeview__::GetChecked(tv_gs.GetId(),hItem) > 0) |
| | | { |
| | | msxml::IXMLDOMElement e = treeview__::GetItemData(tv_gs.GetId(),hItem); |
| | | string id = e.selectSingleNode("CategoryID").text; |
| | | string Name =GetPath(tv_gs.GetId(), hItem); |
| | | trace(Name); |
| | | if(dw.GetItemString(1,"CategoryID")=="") |
| | | { |
| | | dw.ItemChangeTo(1,"CategoryID",id); |
| | | dw.ItemChangeTo(1,"Category",Name); |
| | | } |
| | | else |
| | | { |
| | | int n=dw.InsertRow(0); |
| | | dw.ItemChangeTo(n,"CategoryID",id); |
| | | dw.ItemChangeTo(n,"Category",Name); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | int cItem = treeview__::GetChildItem(tv_gs.GetId(), hItem); |
| | | if(cItem > 0) |
| | | { |
| | | xunhuan(pItem,cItem); |
| | | } |
| | | int nItem = treeview__::GetNextItem(tv_gs.GetId(), hItem); |
| | | if(nItem > 0) |
| | | { |
| | | xunhuan(pItem,nItem); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid=="ok") |
| | | { |
| | | int hitem = treeview__::GetSelectedItem(tv_gs.GetId()); |
| | | if (hitem >0) |
| | | { |
| | | msxml::IXMLDOMElement ele=treeview__::GetItemData(tv_gs.GetId(),hitem); |
| | | string guid = ele.selectSingleNode("CategoryID").text; |
| | | //string label = ele.selectSingleNode("CName").text; |
| | | string label = GetPath(tv_gs.GetId(), hitem); |
| | | trace(label); |
| | | xunhuan(hitem, treeview__::GetChildItem(tv_gs.GetId(), treeview__::GetRootItem(tv_gs.GetId()))); |
| | | win__::CloseWindow(); |
| | | } |
| | | return 1; |
| | | } |
| | | if(comdid=="close") |
| | | win__::CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | | int OnCmdDispatch0(string comdid) |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = win__::GetParam(); |
| | | arg.AddArg("comdid",comdid); |
| | | int xitem = treeview__::GetSelectedItem(tv_gs.GetId()); |
| | | if(comdid=="ok" && xitem != 0) |
| | | { |
| | | msxml::IXMLDOMElement e=treeview__::GetItemData(tv_gs.GetId(),xitem); |
| | | |
| | | string sHasChild=e.selectSingleNode("@HasChild").text; |
| | | |
| | | if(treeview__::GetChildItem(tv_gs.GetId(),xitem)>0 || sHasChild=="1") |
| | | { |
| | | alert("æç¤ºï¼è¯·éæ©æåä¸çº§ç±»å«!"); |
| | | return 0; |
| | | } |
| | | |
| | | string ID = e.selectSingleNode("CategoryID").text; |
| | | string CName = e.selectSingleNode("CName").text; |
| | | trace(CName); |
| | | string ruler; |
| | | if(e.selectSingleNode("SpecRule")) |
| | | ruler = e.selectSingleNode("SpecRule").text; |
| | | else |
| | | ruler =""; |
| | | arg.AddArg("CategoryID",ID); |
| | | arg.AddArg("CName",CName); |
| | | arg.AddArg("SpecRule",ruler); |
| | | |
| | | } |
| | | win__::CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int CreateSubTree(int pitem){ |
| | | msxml::IXMLDOMElement sitemdata=treeview__::GetItemData(tv_gs.GetId(), pitem); |
| | | string sHasChild=sitemdata.selectSingleNode("@HasChild").text;//sitemdata.getAttribute("HasChild"); |
| | | string pid=sitemdata.selectSingleNode("CategoryID").text; |
| | | //trace(sHasChild+"sdaga"+pid); |
| | | if(sHasChild=="1"){//æ°æ®æåèç¹ |
| | | int citem=treeview__::GetChildItem(tv_gs.GetId(), pitem); |
| | | |
| | | //alert(string(citem)); |
| | | if (citem==0){//æ è§å¾æåèç¹ |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("parentID",pid); |
| | | //if(xaserver__::ExecXQuery(GetServerUrl(),"[ItemCategoryEx.xq]",arg.GetString(),x)!=1) |
| | | if(url::get(GetEntityName(1)+"/entity/category",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return 0; |
| | | } |
| | | //trace(x.GetXml()); |
| | | var list=x.GetXmlDoc().selectNodes("root/Category"); |
| | | int i=0,s=list.length; |
| | | msxml::IXMLDOMElement xitem; |
| | | for (i=0;i<s;i++){ |
| | | xitem=list.item(s - i - 1); |
| | | string Name=xitem.selectSingleNode("CName").text; |
| | | string Has2D=xitem.selectSingleNode("@Has2D").text;//item.getAttribute("Has2D"); |
| | | if (Has2D=="1") |
| | | Name=Name+"*"; |
| | | int kitem=treeview__::InsertItem(tv_gs.GetId(), pitem,0,Name,xitem,15); |
| | | //int kitem=treeview__::InsertChildItem(tv_gs.GetId(), pitem,Name,xitem,15); |
| | | string HasChild=xitem.selectSingleNode("@HasChild").text;//item.getAttribute("HasChild"); |
| | | //trace(HasChild, kitem); |
| | | if (HasChild=="1") |
| | | treeview__::SetItemChild1(tv_gs.GetId(), kitem,1); |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int CreateRootTree(){ |
| | | string rootid="00000000-0000-0000-0000-000000000000"; |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | x.LoadXml("<Category HasChild='1'><CategoryID>"+rootid+"</CategoryID></Category>"); |
| | | int hroot=treeview__::InsertItem(tv_gs.GetId(),"å
¬å¸äº§åç±»å«", x.GetXmlDoc().documentElement, 17); |
| | | CreateSubTree(hroot); |
| | | treeview__::ExpandItemEx(tv_gs.GetId(),hroot); |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeExpanding(ref TNotifyEvent evt,int p) { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int sitem = nmtv.itemNew.hItem; |
| | | CreateSubTree(sitem); |
| | | return 1; |
| | | |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·å¾æ çå±å¼äºä»¶ |
| | | AttachEvent("tv_gs", "TVN_ITEMEXPANDING",OnTreeExpanding); |
| | | } |
| | | int onload() |
| | | { |
| | | if (GetParam()) |
| | | { |
| | | xaserverarg__ arg1=GetParam(); |
| | | dw_category = new xdwtable__; |
| | | dw_category.setNativePointer(arg1.GetArgString("dw_category").toInt()); |
| | | } |
| | | tv_gs = new treeview__; |
| | | tv_gs.setNativePointer(GetControl("tv_gs")); |
| | | CreateRootTree(); |
| | | OnAttachEvent(); |
| | | 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 "file.vl" |
| | | //unit vclient.vobject tpp |
| | | unit vbusiness.xpage |
| | | [ |
| | | SKUItem is extend frame; |
| | | about SKUItem |
| | | [ |
| | | field: |
| | | [ |
| | | treeview__ tv_1; |
| | | xdwgrid__ dw_list; |
| | | string m_type; |
| | | string CategoryID; |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | string m_searchtxt; |
| | | ] |
| | | |
| | | 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="[SKUItem.tree.xq]"; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("parentID",CategoryID); |
| | | arg.AddArg("query",""); |
| | | if (xaserver__::ExecXQuery(GetServerUrl(),query,arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }else |
| | | { |
| | | dw_list.openUrl("å
¶ä»è®¾ç½®.vface/template/other/SKUItem"); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TNotifyEvent evt,int p){ |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int sitem = nmtv.itemNew.hItem; |
| | | |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | dw_list.AcceptText(); |
| | | xml__ z= new xml__; |
| | | z.setNativePointer(xml__::CreateInstance()); |
| | | z.LoadXml("<root/>"); |
| | | dw_list.Retrieve(z); |
| | | dw_list.Redraw(); |
| | | dw_list.ResetUpdateStatus(); |
| | | |
| | | msxml::IXMLDOMElement ele=treeview__::GetItemData(tv_1.GetId(), sitem); |
| | | if(!ele.selectSingleNode("ID")) return 0; |
| | | CategoryID = ele.selectSingleNode("ID").text; |
| | | //trace(CategoryID); |
| | | m_searchtxt = ""; |
| | | |
| | | OnReTrieve(); |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int CreateSubTree(int pitem){ |
| | | msxml::IXMLDOMElement sitemdata=treeview__::GetItemData(tv_1.GetId(), pitem); |
| | | string sHasChild=sitemdata.selectSingleNode("@HasChild").text;//sitemdata.getAttribute("HasChild"); |
| | | //trace(sHasChild); |
| | | string pid=sitemdata.selectSingleNode("ID").text; |
| | | //trace(sHasChild+"sdaga"+pid); |
| | | if(sHasChild=="1"){//æ°æ®æåèç¹ |
| | | int citem=treeview__::GetChildItem(tv_1.GetId(), pitem); |
| | | //alert(string(citem)); |
| | | if (citem==0){//æ è§å¾æåèç¹ |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("parentID",pid); |
| | | arg.AddArg("query",""); |
| | | if(xaserver__::ExecXQuery(GetServerUrl(),"[SKUItem.tree.xq]",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return 0; |
| | | } |
| | | //trace(x.GetXml()); |
| | | var list=x.GetXmlDoc().selectNodes("root/SKUItem"); |
| | | int i=0,s=list.length; |
| | | msxml::IXMLDOMElement xitem; |
| | | msxml::IXMLDOMNode d; |
| | | for (i=0;i<s;i++){ |
| | | xitem= list.item(s - i - 1); |
| | | //if(i==0)xitem.setAttribute("HasChild","1"); |
| | | string Name=xitem.selectSingleNode("ItemName").text; |
| | | int kitem=treeview__::InsertItem(tv_1.GetId(), pitem,0,Name,xitem,15); |
| | | //int kitem=treeview__::InsertChildItem(tv_1.GetId(), pitem,Name,xitem,15); |
| | | string HasChild=xitem.selectSingleNode("@HasChild").text;//item.getAttribute("HasChild"); |
| | | //trace(HasChild, kitem); |
| | | if (HasChild=="1") |
| | | treeview__::SetItemChild1(tv_1.GetId(), kitem,1); |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int CreateRootTree(){ |
| | | string id="00000000-0000-0000-0000-000000000000"; |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | x.LoadXml("<SKUItem HasChild='1' ><ID>"+id+"</ID></SKUItem>"); |
| | | int hroot=treeview__::InsertItem(tv_1.GetId(), "产å项ç®åç±»", x.GetXmlDoc().documentElement, 17); |
| | | //trace(hroot); |
| | | CreateSubTree(hroot); |
| | | treeview__::ExpandItemEx(tv_1.GetId(), hroot); |
| | | CategoryID = id; |
| | | OnReTrieve(); |
| | | return 1; |
| | | } |
| | | int OnTreeExpanding(ref TNotifyEvent evt,int p) { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int sitem = nmtv.itemNew.hItem; |
| | | CreateSubTree(sitem); |
| | | return 1; |
| | | } |
| | | int afterSave(){ |
| | | int hitem = treeview__::GetSelectedItem(tv_1.GetId()); |
| | | if(hitem == 0) |
| | | hitem = treeview__::GetRootItem(tv_1.GetId()); |
| | | int rows = dw_list.GetRowCount(); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(tv_1.GetId() ,hitem); |
| | | |
| | | int firstChild = treeview__::GetChildItem(tv_1.GetId() ,hitem); |
| | | while (firstChild>0){ |
| | | treeview__::DeleteItem(tv_1.GetId() ,firstChild); |
| | | firstChild = treeview__::GetChildItem(tv_1.GetId() ,hitem); |
| | | } |
| | | if(rows>0) |
| | | { |
| | | treeview__::SetItemChild1(tv_1.GetId() ,hitem,1); |
| | | ele.setAttribute("HasChild","1"); |
| | | //trace(ele.xml); |
| | | treeview__::SetItemData(tv_1.GetId() ,hitem,ele); |
| | | } |
| | | else |
| | | { |
| | | treeview__::SetItemChild1(tv_1.GetId() ,hitem,0); |
| | | ele.setAttribute("HasChild","0"); |
| | | //trace(ele.xml); |
| | | treeview__::SetItemData(tv_1.GetId() ,hitem,ele); |
| | | } |
| | | CreateSubTree(hitem); |
| | | if(treeview__::GetRootItem(tv_1.GetId()) == hitem) |
| | | treeview__::ExpandItemEx(tv_1.GetId() ,hitem); |
| | | |
| | | dw_list.ResetUpdateStatus(); |
| | | return 0; |
| | | } |
| | | int OnSave() |
| | | { |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | trace(x.GetXml()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content", x.GetXml()); |
| | | arg.AddArg("dbmap", "SKUItem.dbmap"); |
| | | if(xaserver__::ExecXAction(this.GetServerUrl(),"[onSave.xa]",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().documentElement.text); |
| | | alert("ä¿å失败"); |
| | | }else{ |
| | | alert("ä¿åæå"); |
| | | } |
| | | dw_list.ResetUpdateStatus(); |
| | | dw_list.Redraw(); |
| | | afterSave(); |
| | | return 1; |
| | | } |
| | | int OnSetValue( int row){ |
| | | dw_list.SetItemString(row,"PID",CategoryID); |
| | | dw_list.SetItemString(row,"ID",TApp::GetGuid()); |
| | | return 1; |
| | | } |
| | | int OnAddRow() |
| | | { |
| | | int row = dw_list.InsertRow(0); |
| | | int rows = dw_list.GetRowCount(); |
| | | OnSetValue(rows); |
| | | dw_list.SetRow(dw_list.GetRowCount()); |
| | | //trace(row.toString()); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | int row=dw_list.GetRow(); |
| | | if(row<0 || row>dw_list.GetRowCount()) return 0; |
| | | dw_list.InsertRow(row); |
| | | OnSetValue(row); |
| | | dw_list.SetRow(row); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if(row<0 || row>dw_list.GetRowCount()) return 0; |
| | | 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 param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | //è·å¾æ çéæ©äºä»¶ |
| | | AttachEvent("tv_1", "TVN_SELCHANGED",OnTreeSelChanged); |
| | | AttachEvent("tv_1", "TVN_ITEMEXPANDING",OnTreeExpanding); |
| | | } |
| | | |
| | | 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/other/SKUItem"); |
| | | |
| | | OnInitial(); |
| | | CreateRootTree(); |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "dev:code[SKUItem.vx]" |
| | | |
| | | unit vbusiness.vpage |
| | | [ |
| | | SKUItemImport is extend SKUItem; |
| | | about SKUItemImport |
| | | [ |
| | | field: |
| | | xdwgrid__ dw_list; |
| | | treeview__ tv_1; |
| | | xdwtable__ dw_maint; |
| | | method: |
| | | [ |
| | | |
| | | string jxParam(string p, string n) |
| | | { |
| | | if(p != "") |
| | | { |
| | | |
| | | int i = 1; |
| | | while (p.find("=",0)>0) |
| | | { |
| | | string name = p.mid(0, p.find("=",0)); |
| | | string value = p.mid(p.find("=",0) + 1, p.find("=",0) - 1); |
| | | return ""+value; |
| | | i += 1; |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | int OnSelectAll() |
| | | { |
| | | if(this.dw_list.GetRowCount() > 0 ) |
| | | this.dw_list.SelectRow(1,true); |
| | | |
| | | this.dw_list.SelectRow(0,true); |
| | | this.dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSelectNo() |
| | | { |
| | | this.dw_list.SelectRow(0,false); |
| | | this.dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnOk() |
| | | { |
| | | |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_maint.FindDwTable("Item",0)); |
| | | |
| | | int row = SKUItem::dw_list.GetNextSelectRow(1); |
| | | if (row<1) |
| | | { |
| | | alert("è¯·éæ©é¡¹ç®åç§°!"); |
| | | return 1; |
| | | } |
| | | |
| | | while (row>0) |
| | | { |
| | | |
| | | msxml::IXMLDOMElement e =SKUItem::dw_list.GetRowElement(row); |
| | | string ItemName = e.selectSingleNode("ItemName").text+""; |
| | | //trace(ItemName); |
| | | if(dw.GetItemString(1,"ItemName")=="") |
| | | { |
| | | dw.SetItemString(1,"SeqNo","1"); |
| | | dw.ItemChangeTo(1,"ItemName",ItemName); |
| | | } |
| | | else |
| | | { |
| | | int n=dw.InsertRow(0); |
| | | dw.SetItemString(n,"SeqNo",n.ToString()); |
| | | dw.ItemChangeTo(n,"ItemName",ItemName); |
| | | } |
| | | row = SKUItem::dw_list.GetNextSelectRow(row +1); |
| | | } |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnCancel() |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | int OnDoubleClicked(ref TNotifyEvent evt,int p) |
| | | { |
| | | OnOk(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid=="SelectAll") OnSelectAll(); |
| | | else if (comdid=="SelectNo") OnSelectNo(); |
| | | else if (comdid=="cb_import") OnOk(); |
| | | else if (comdid=="cb_close") OnCancel(); |
| | | //else if (comdid=="query") GridSearch(); |
| | | return 0; |
| | | } |
| | | |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | if (GetParam()) |
| | | { |
| | | xaserverarg__ arg1=GetParam(); |
| | | dw_maint = new xdwtable__; |
| | | dw_maint.setNativePointer(arg1.GetArgString("dw_maint").toInt()); |
| | | } |
| | | SKUItem::onload(); |
| | | SKUItem::dw_list.SetSelectionMode(3); //3 |
| | | SKUItem::dw_list.SetReadOnly(true); |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent("dw_list","DWV_DOUBLECLICKED",OnDoubleClicked);//è¡åå» |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "list.vl" |
| | | use "dev:vm[combobox.vm]" |
| | | use "treeview.vm" |
| | | use "dev:vm[gridpages.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "dev:vm[xpage.vm]" |
| | | use "dev:vm[xcell.vm]" |
| | | use "file.vl" |
| | | use "publiccode.vl" |
| | | |
| | | unit vbusiness.entity |
| | | [ |
| | | SKUTemplate is extend frame; |
| | | about SKUTemplate |
| | | [ |
| | | field: |
| | | [ |
| | | xdwgrid__ dw_list; |
| | | xdwtable__ dw_maint; |
| | | xdwtable__ dw_category; |
| | | int rowno; |
| | | ] |
| | | |
| | | 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 p) |
| | | { |
| | | SetAgent() ; |
| | | return 1; |
| | | } |
| | | |
| | | int OnReTrieve() |
| | | { |
| | | string query="[SKUTemplate.list.xq]"; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | if (xaserver__::ExecXQuery(GetServerUrl(),query,arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnRowChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int ll_row = hdr.row; |
| | | rowno=ll_row; |
| | | string TemplateContent = dw_list.GetItemString(ll_row,"TemplateContent"); |
| | | string Category = dw_list.GetItemString(ll_row,"Category"); |
| | | if(TemplateContent=="") |
| | | { |
| | | dw_maint.openUrl("å
¶ä»è®¾ç½®.vface/template/other/TemplateContent"); |
| | | dw_maint.SetColHeaderHeight(0); |
| | | dw_maint.SetRowSelectorWidth(0); |
| | | } |
| | | if(Category=="") |
| | | { |
| | | dw_category.openUrl("å
¶ä»è®¾ç½®.vface/template/other/TemplateCategory"); |
| | | dw_category.SetColHeaderHeight(0); |
| | | dw_category.SetRowSelectorWidth(0); |
| | | } |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | x.LoadXml(TemplateContent); |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(x.CreateInstance()); |
| | | x1.LoadXml(Category); |
| | | dw_maint.Retrieve(x); |
| | | dw_maint.Redraw(); |
| | | dw_category.Retrieve(x1); |
| | | dw_category.Redraw(); |
| | | return 1; |
| | | } |
| | | int OnSave() |
| | | { |
| | | dw_list.AcceptText(); |
| | | dw_maint.AcceptText(); |
| | | dw_category.AcceptText(); |
| | | |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | trace(x.GetXml()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content", x.GetXml()); |
| | | arg.AddArg("dbmap", "SKUTemplate.dbmap"); |
| | | if(xaserver__::ExecXAction(this.GetServerUrl(),"[onSave.xa]",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().documentElement.text); |
| | | alert("ä¿å失败"); |
| | | }else{ |
| | | alert("ä¿åæå"); |
| | | } |
| | | dw_list.ResetUpdateStatus(); |
| | | dw_maint.ResetUpdateStatus(); |
| | | dw_category.ResetUpdateStatus(); |
| | | dw_list.Redraw(); |
| | | dw_maint.Redraw(); |
| | | dw_category.Redraw(); |
| | | return 1; |
| | | } |
| | | int OnSetValue( int row){ |
| | | dw_list.SetItemString(row,"TemplateID",TApp::GetGuid()); |
| | | return 1; |
| | | } |
| | | int RemoveAttribute(xml__ x,string nodename)//æ ¹æ®åç§°å é¤å±æ§èç¹ |
| | | { |
| | | msxml::IXMLDOMElement e; |
| | | var list = x.GetXmlDoc().getElementsByTagName(""+nodename+""); |
| | | if(list) |
| | | { |
| | | |
| | | int nlen = list.length; |
| | | int i; |
| | | for(i=0; i<nlen; i++) |
| | | { |
| | | e = list.item(i); |
| | | //trace(e.xml); |
| | | e.removeAttribute("update.new"); |
| | | e.removeAttribute("update.modify"); |
| | | e.removeAttribute("update.delete"); |
| | | e.removeAttribute("guid"); |
| | | e.removeAttribute("update.origin"); |
| | | e.removeAttribute("isnull"); |
| | | //trace(e.xml); |
| | | } |
| | | } |
| | | } |
| | | int setMaint() |
| | | { |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | dw_maint.DwUpdateAllTo(x.GetXmlDoc()); |
| | | int row = dw_list.GetRow(); |
| | | trace(x.GetXml()); |
| | | RemoveAttribute(x,"TemplateContent"); |
| | | RemoveAttribute(x,"Item"); |
| | | RemoveAttribute(x,"ItemName"); |
| | | RemoveAttribute(x,"Remark"); |
| | | RemoveAttribute(x,"SeqNo"); |
| | | //trace(x.GetXml()); |
| | | dw_list.SetItemString(row, "TemplateContent", x.GetXml()); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | int setItemCategory() |
| | | { |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | dw_category.DwUpdateAllTo(x.GetXmlDoc()); |
| | | int row = dw_list.GetRow(); |
| | | trace(row); |
| | | dw_list.SetItemString(row, "Category", x.GetXml()); |
| | | return 1; |
| | | } |
| | | int OnAddRow() |
| | | { |
| | | int row = dw_list.InsertRow(0); |
| | | int rows = dw_list.GetRowCount(); |
| | | OnSetValue(rows); |
| | | dw_list.SetRow(dw_list.GetRowCount()); |
| | | trace(row.toString()); |
| | | dw_maint.openUrl("å
¶ä»è®¾ç½®.vface/template/other/TemplateContent"); |
| | | dw_maint.SetColHeaderHeight(0); |
| | | dw_maint.SetRowSelectorWidth(0); |
| | | dw_category.openUrl("å
¶ä»è®¾ç½®.vface/template/other/TemplateCategory"); |
| | | dw_category.SetColHeaderHeight(0); |
| | | dw_category.SetRowSelectorWidth(0); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | int row=dw_list.GetRow(); |
| | | if(row<0 || row>dw_list.GetRowCount()) return 0; |
| | | dw_list.InsertRow(row); |
| | | OnSetValue(row); |
| | | dw_list.SetRow(row); |
| | | dw_maint.openUrl("å
¶ä»è®¾ç½®.vface/template/other/TemplateContent"); |
| | | dw_maint.SetColHeaderHeight(0); |
| | | dw_maint.SetRowSelectorWidth(0); |
| | | dw_category.openUrl("å
¶ä»è®¾ç½®.vface/template/other/TemplateCategory"); |
| | | dw_category.SetColHeaderHeight(0); |
| | | dw_category.SetRowSelectorWidth(0); |
| | | return 1; |
| | | } |
| | | int OnChangeRowNo(int row) |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_maint.FindDwTable("Item",0)); |
| | | int i; |
| | | for (i=row; i<=dw.GetRowCount(); i++) |
| | | dw.SetItemString(i, "SeqNo", i.toString()); |
| | | return 1; |
| | | } |
| | | int OnDeleteRow() |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if(row<0 || row>dw_list.GetRowCount()) return 0; |
| | | dw_list.DeleteRow(row); |
| | | dw_maint.openUrl("å
¶ä»è®¾ç½®.vface/template/other/TemplateContent"); |
| | | dw_maint.SetColHeaderHeight(0); |
| | | dw_maint.SetRowSelectorWidth(0); |
| | | dw_category.openUrl("å
¶ä»è®¾ç½®.vface/template/other/TemplateCategory"); |
| | | dw_category.SetColHeaderHeight(0); |
| | | dw_category.SetRowSelectorWidth(0); |
| | | return 1; |
| | | } |
| | | int RemoveChild(xml__ x,string nodename)//æ ¹æ®åç§°å é¤èç¹ |
| | | { |
| | | msxml::IXMLDOMElement e; |
| | | var list = x.GetXmlDoc().SelectNodes("//Item[@update.delete='1']"); |
| | | if(list) |
| | | { |
| | | int nlen = list.length; |
| | | int i; |
| | | for(i=0; i<nlen; i++) |
| | | { |
| | | e = list.item(i); |
| | | //trace(e.xml); |
| | | e.parentNode.removeChild(e); |
| | | //trace(e.xml); |
| | | } |
| | | } |
| | | } |
| | | int setMaint_removeChild() |
| | | { |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | dw_maint.DwUpdateAllTo(x.GetXmlDoc()); |
| | | int row = dw_list.GetRow(); |
| | | //trace(x.GetXml()); |
| | | RemoveChild(x,"Item"); |
| | | RemoveAttribute(x,"TemplateContent"); |
| | | RemoveAttribute(x,"Item"); |
| | | RemoveAttribute(x,"ItemName"); |
| | | RemoveAttribute(x,"Remark"); |
| | | RemoveAttribute(x,"SeqNo"); |
| | | //trace(x.GetXml()); |
| | | dw_list.SetItemString(row, "TemplateContent", x.GetXml()); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | int setItemCategory_removeChild() |
| | | { |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | dw_category.DwUpdateAllTo(x.GetXmlDoc()); |
| | | int row = dw_list.GetRow(); |
| | | RemoveChild(x,"Item"); |
| | | trace(row); |
| | | dw_list.SetItemString(row, "Category", x.GetXml()); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | int del(xdwtable__ dw_1) |
| | | { |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_1.GetCurTable()); |
| | | int row = dw.GetRow(); |
| | | if(row < 1 || row > dw.GetRowCount()) return -1; |
| | | dw.DeleteRow(row); |
| | | //trace(dw.GetDwName()); |
| | | if(dw_1.GetDwName()=="TemplateContent") |
| | | { |
| | | OnChangeRowNo(row); |
| | | if(dw.GetRowCount()==1 && dw.GetItemString(1,"ItemName")=="") |
| | | { |
| | | dw_list.SetItemString(rowno, "TemplateContent", ""); |
| | | dw_list.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | setMaint_removeChild(); |
| | | } |
| | | |
| | | } |
| | | if(dw_1.GetDwName()=="Categorys") |
| | | { |
| | | trace(dw.GetRowCount()); |
| | | if(dw.GetRowCount()==1 && dw.GetItemString(1,"CategoryID")=="") |
| | | { |
| | | dw_list.SetItemString(rowno, "Category", ""); |
| | | dw_list.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | setItemCategory_removeChild(); |
| | | } |
| | | |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int SKUItem() |
| | | { |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("dw_maint",dw_maint.__nativept.toString()); |
| | | openUrl("å
¶ä»è®¾ç½®.vface/xpage/SKUItem/select",arg); |
| | | return 1; |
| | | } |
| | | int SKUItemcategory() |
| | | { |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("dw_category",dw_category.__nativept.toString()); |
| | | openUrl("å
¶ä»è®¾ç½®.vface/xpage/SKUItemcategory/select",arg); |
| | | return 1; |
| | | } |
| | | int SKUItemModify() |
| | | { |
| | | openUrl("å
¶ä»è®¾ç½®.vface/xpage/SKUItem/list"); |
| | | 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 =="SKUItem") SKUItem(); |
| | | else if (comdid =="SKUItemcategory") SKUItemcategory(); |
| | | else if(comdid == "del_1") del(dw_maint); |
| | | else if(comdid == "del_2") del(dw_category); |
| | | else if(comdid == "SKUItemModify") SKUItemModify(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnMaintChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | //trace("hello"); |
| | | setMaint(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnCategoryChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | setItemCategory(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent("dw_maint","DWV_ITEMCHANGED",OnMaintChanged); |
| | | AttachEvent("dw_category","DWV_ITEMCHANGED",OnCategoryChanged); |
| | | AttachEvent("dw_list","DWV_ROWFOCUSCHANGED",OnRowChanged); |
| | | |
| | | return 1; |
| | | } |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | int onload() |
| | | { |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | dw_list.openUrl("å
¶ä»è®¾ç½®.vface/template/other/SKUTemplate"); |
| | | |
| | | dw_maint = new xdwtable__; |
| | | dw_maint.setNativePointer(GetControl("dw_maint")); |
| | | dw_maint.openUrl("å
¶ä»è®¾ç½®.vface/template/other/TemplateContent"); |
| | | dw_maint.SetColHeaderHeight(0); |
| | | dw_maint.SetRowSelectorWidth(0); |
| | | |
| | | dw_category = new xdwtable__; |
| | | dw_category.setNativePointer(GetControl("dw_category")); |
| | | dw_category.openUrl("å
¶ä»è®¾ç½®.vface/template/other/TemplateCategory"); |
| | | dw_category.SetColHeaderHeight(0); |
| | | dw_category.SetRowSelectorWidth(0); |
| | | dw_category.SetReadOnly(true); |
| | | OnInitial(); |
| | | OnReTrieve(); |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_category.FindDwTable("Item",0)); |
| | | trace(dw.GetRowCount()); |
| | | return 1; |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "dev:code[SKUTemplate.vx]" |
| | | |
| | | unit vbusiness.vpage |
| | | [ |
| | | SKUTemplateImport is extend SKUTemplate; |
| | | about SKUTemplateImport |
| | | [ |
| | | field: |
| | | xdwgrid__ dw_list; |
| | | xdwtable__ dw_other; |
| | | xdwtable__ dw_prop; |
| | | method: |
| | | [ |
| | | |
| | | string jxParam(string p, string n) |
| | | { |
| | | if(p != "") |
| | | { |
| | | |
| | | int i = 1; |
| | | while (p.find("=",0)>0) |
| | | { |
| | | string name = p.mid(0, p.find("=",0)); |
| | | string value = p.mid(p.find("=",0) + 1, p.find("=",0) - 1); |
| | | return ""+value; |
| | | i += 1; |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | int OnSelectAll() |
| | | { |
| | | if(this.dw_list.GetRowCount() > 0 ) |
| | | this.dw_list.SelectRow(1,true); |
| | | |
| | | this.dw_list.SelectRow(0,true); |
| | | this.dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSelectNo() |
| | | { |
| | | this.dw_list.SelectRow(0,false); |
| | | this.dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnOk() |
| | | { |
| | | dw_other.openUrl("/sale/view/CustomerGoods/template/CustomerGoods/itemother"); |
| | | dw_other.SetColHeaderHeight(0); |
| | | dw_other.SetRowSelectorWidth(0); |
| | | int row = SKUTemplate::dw_list.GetNextSelectRow(1); |
| | | if (row<1) |
| | | { |
| | | alert("è¯·éæ©æ¨¡æ¿!"); |
| | | return 1; |
| | | } |
| | | |
| | | msxml::IXMLDOMElement e =SKUTemplate::dw_list.GetRowElement(row); |
| | | string TemplateContent = e.selectSingleNode("TemplateContent").text+""; |
| | | string TemplateID = e.selectSingleNode("TemplateID").text+""; |
| | | //trace(ItemName); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | x.LoadXml(TemplateContent); |
| | | dw_other.Retrieve(x); |
| | | dw_prop.SetItemString(1,"TemplateID",TemplateID); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnCancel() |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | int OnDoubleClicked(ref TNotifyEvent evt,int p) |
| | | { |
| | | OnOk(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid=="SelectAll") OnSelectAll(); |
| | | else if (comdid=="SelectNo") OnSelectNo(); |
| | | else if (comdid=="cb_import") OnOk(); |
| | | else if (comdid=="cb_close") OnCancel(); |
| | | //else if (comdid=="query") GridSearch(); |
| | | return 0; |
| | | } |
| | | |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | if (GetParam()) |
| | | { |
| | | int iArgs = GetParam(); |
| | | xaserverarg__ arg1 = new xaserverarg__; |
| | | arg1.setNativePointer(iArgs); |
| | | dw_other = new xdwtable__; |
| | | dw_other.setNativePointer(arg1.GetArgString("dw_other").toInt()); |
| | | dw_prop = new xdwtable__; |
| | | dw_prop.setNativePointer(arg1.GetArgString("dw_prop").toInt()); |
| | | } |
| | | //trace(dw_other.__nativept); |
| | | SKUTemplate::onload(); |
| | | SKUTemplate::dw_list.SetSelectionMode(1); //3 |
| | | SKUTemplate::dw_list.SetReadOnly(true); |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent("dw_list","DWV_DOUBLECLICKED",OnDoubleClicked);//è¡åå» |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | |
| | | unit trade |
| | | [ |
| | | class SetUpRemarks : public xwin |
| | | { |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | { |
| | | SetAgentNodeContent (anode,m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid=="xmAddRow") |
| | | { |
| | | int row =dw_list.GetRowCount(); |
| | | dw_list.InsertRow(0); |
| | | dw_list.SetItemString(row+1,"State","Y"); |
| | | return 1; |
| | | } |
| | | else if(comdid=="xmDeleteRow") |
| | | { |
| | | dw_list.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | else if(comdid=="xmSave") |
| | | return OnSave(); |
| | | else if(comdid=="xmRefresh") |
| | | return OnRetrieve(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml x=new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | xaserverarg arg=new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content",x.GetXml()); |
| | | if (url::get("/sale/data/TradeFinance3/SetUpRemarks/update",arg.GetString(),x) != 1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("ä¿å失败!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | trace(x.GetXml()); |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert("ä¿ååºé2!"); |
| | | return 0; |
| | | } |
| | | win32::MessageBox(GetHWND(),"ä¿åæåï¼","æç¤º",0); |
| | | dw_list.ResetUpdateStatus(); |
| | | } |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | if (url::get("/sale/data/TradeFinance3/SetUpRemarks/list",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.openUrl("/sale/view/FinancialCode/template/SetUpRemarksList"); |
| | | dw_list.SetColumnState("ID",false); |
| | | |
| | | OnRetrieve(); |
| | | |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "system.vl" |
| | | use "win.vl" |
| | | use "list.vl" |
| | | unit vbusiness.entity |
| | | [ |
| | | ShipcompanyList is extend list; |
| | | about ShipcompanyList |
| | | [ |
| | | method: |
| | | [ |
| | | int onload() |
| | | { |
| | | list::onload(); |
| | | return -1; |
| | | } |
| | | |
| | | int ViewUpdate(param pr,string updateItem,xaserverarg__ arg) |
| | | { |
| | | if( updateItem=="del") |
| | | { |
| | | int DelRow = this.dw_list.GetRow(); |
| | | this.dw_list.DeleteRow(DelRow); |
| | | |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | ] |
| | | |
| | | |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "system.vl" |
| | | use "win.vl" |
| | | use "maint.vl" |
| | | use "file.vl" |
| | | use "dev:vm[xcell.vm]" |
| | | unit vbusiness.entity |
| | | [ |
| | | ShipcompanyMaint is extend maint; |
| | | about ShipcompanyMaint |
| | | [ |
| | | field: |
| | | [ |
| | | msxml::IXMLDOMDocument m_configDoc; |
| | | string m_userid; |
| | | string m_username; |
| | | string ContactID; |
| | | xdwtable__ dw_base; |
| | | xcell__ dw_cell; |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | int alert(string str) |
| | | { |
| | | //win__::MessageBox(this.GetHWND(),str,"æç¤º22:",0); |
| | | TApp::alert(this,str); |
| | | return 0; |
| | | } |
| | | int setCellReadOnly() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | dw_cell = new xcell__; |
| | | dw_cell.setNativePointer(dw_base.QueryItem("ixcell")); |
| | | string strnew = "<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='ä¿æ¤' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''/>"; |
| | | dw_cell.SetCellProps(2,2,strnew); |
| | | return 0; |
| | | } |
| | | int OnSetFocus(ref TNotifyEvent evt,int p) |
| | | { |
| | | SetAgent("maint"); |
| | | return 1; |
| | | } |
| | | string GetGuid(){ |
| | | return TApp::GetGuid(); |
| | | } |
| | | int OnClear(){ |
| | | if(this.m_EntityID ==""){ |
| | | m_userid = TApp::GetUserInfo().id; |
| | | m_username = TApp::GetUserInfo().name; |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | dw_base.SetItemString(1,"PartyID",GetGuid()); |
| | | dw_base.SetItemString(1,"PStatus","1"); |
| | | dw_base.SetItemDisplayString(1,"PStatus","ææ"); |
| | | dw_base.SetItemString(1,"CreatorID",m_userid); |
| | | dw_base.SetItemString(1,"PADStatus","1"); |
| | | dw_base.SetItemString(1,"Type","6"); |
| | | dw_base.SetItemString(1,"AddressID",GetGuid()); |
| | | dw_base.SetItemString(1,"PADIdentifyAddressFlag","Y"); |
| | | dw_base.SetItemString(1,"PrimaryFlag","Y"); |
| | | dw_base.SetItemString(1,"EnterName",m_userid); |
| | | dw_base.SetItemDisplayString(1,"EnterName",m_username); |
| | | dw_base.SetItemString(1,"CreateDate",TApp::GetCurDate()); |
| | | } |
| | | else |
| | | { |
| | | setCellReadOnly(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnAddrow() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | string dw_n=dw.GetDwName(); |
| | | if(dw_n=="item") |
| | | { |
| | | dw.InsertRow(0); |
| | | int rows = dw.GetRowCount(); |
| | | dw.SetRow(rows); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnInsertRow() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | string dw_n=dw.GetDwName(); |
| | | if(dw_n=="item") |
| | | { |
| | | int row=dw.GetRow(); |
| | | if(row<1) return 0; |
| | | dw.InsertRow(row); |
| | | dw.SetRow(row); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | string dw_n=dw.GetDwName(); |
| | | if(dw_n=="item") |
| | | { |
| | | int row=dw.GetRow(); |
| | | if(row<1) return 0; |
| | | /*string del = dw.GetItemString(row,8); |
| | | if(del!="") |
| | | { |
| | | if(m_dels=="") |
| | | { |
| | | m_dels=del; |
| | | } |
| | | else |
| | | { |
| | | string temp=m_dels; |
| | | m_dels=del + "|" + temp; |
| | | //+= "|"+del; |
| | | } |
| | | |
| | | }*/ |
| | | dw.DeleteRow(row); |
| | | dw.SetRow(row - 1); |
| | | } |
| | | return 1; |
| | | } |
| | | string getGoodsNo() |
| | | { |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | if (getUrl("/sale/data/LogisticsCode/pref/shipcompany/PartyNo",arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return ""; |
| | | } |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | if(e) |
| | | { |
| | | string code = e.text; |
| | | trace(code); |
| | | return "P"+code; |
| | | } |
| | | return "P1000"; |
| | | } |
| | | int OnPreSave() |
| | | { |
| | | dw_base.AcceptText(); |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | string ShipNo = dw_base.GetItemString(1,"ShipNo",0); |
| | | if (ShipNo=="" || ShipNo== nil) |
| | | { |
| | | dw_base.SetItemString(1,"ShipNo",getGoodsNo()); |
| | | } |
| | | xdwtable__ dwcon = new xdwtable__; |
| | | dwcon.setNativePointer(dw_base.FindDwTable("item",0)); |
| | | int i; |
| | | for(i=1;i<=dwcon.GetRowCount();i++) |
| | | { |
| | | string aTemp; |
| | | string aName = dwcon.GetItemString(i,"ContacterName",0); |
| | | trace(aName); |
| | | if (aName=="" || aName== nil) |
| | | { |
| | | aTemp=dwcon.GetItemString(i,"Mobile",0)+dwcon.GetItemString(i,"TEL",0)+dwcon.GetItemString(i,"Fax",0)+dwcon.GetItemString(i,"Email",0)+dwcon.GetItemString(i,"PCRemark",0); |
| | | trace(aTemp); |
| | | if(aTemp !="" && aTemp != nil) |
| | | { |
| | | alert("è系人åç§°å¿
å¡«ï¼"); |
| | | return -1; |
| | | } |
| | | } |
| | | else{ |
| | | string ContactID = dwcon.GetItemString(i,"ContactID",0); |
| | | if (ContactID=="" || ContactID== nil) |
| | | { |
| | | dwcon.SetItemString(i,"ContactID",GetGuid()); |
| | | dwcon.SetItemString(i,"PCStatus","1"); |
| | | dw_base.SetItemString(1,"PrimaryContactID",dwcon.GetItemString(1,"ContactID")); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int OnSave() |
| | | { |
| | | |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | string SName = dw_base.GetItemString(1,"Name"); |
| | | if(SName==""){ |
| | | alert("请è¾å
¥è¹å
¬å¸åç§°ï¼"); |
| | | return -1; |
| | | } |
| | | int rec =OnPreSave(); |
| | | if (rec== -1) return -1; |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | dw_base.DwUpdateAllTo(x.GetXmlDoc()); |
| | | trace(x.GetXml()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content",x.GetXml()); |
| | | arg.AddArg("dbmap","Shipcompany.dbmap"); |
| | | //arg.AddArg("m_dels",m_dels); |
| | | |
| | | if (getUrl("/sale/data/LogisticsCode/entity/shipcompany/save",arg.GetString(),x) != 1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("ä¿å失败!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | trace(x.GetXml()); |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert("ä¿ååºé2!"); |
| | | return 0; |
| | | } |
| | | alert("ä¿åæå!"); |
| | | dw_base.ResetUpdateStatus(); |
| | | setCellReadOnly(); |
| | | } |
| | | dw_base.Redraw(); |
| | | //m_dels=""; |
| | | return 0; |
| | | } |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | trace(comdid); |
| | | if(comdid.find("action:bill.row.add",0)>=0) { |
| | | OnAddrow(); |
| | | } |
| | | else if(comdid.find("bill.row.insert",0)>=0) { |
| | | OnInsertRow(); |
| | | } |
| | | else if(comdid.find("bill.row.delete",0)>=0) { |
| | | OnDeleteRow(); |
| | | } |
| | | else if(comdid.find("bill.save",0)>=0) { |
| | | trace(1); |
| | | dw_base.AcceptText(); |
| | | OnSave(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | int OnCellChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | string colname=hdr.colname; |
| | | //trace(colname); |
| | | if(colname=="ShipNo") |
| | | { |
| | | string cspec = dw_base.GetItemString(1,1); |
| | | trace(cspec); |
| | | string SpecRule="^\\d*$"; |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("CSpec",cspec); |
| | | args.AddArg("SpecRule",SpecRule); |
| | | xml__ x= new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | getUrl("/sale/data/LogisticsCode/pref/forwarderno/check",args.GetString(),x); |
| | | if(x.GetXmlDoc().selectSingleNode("root/spec")) |
| | | { |
| | | alert("请è¾å
¥æ°åï¼"); |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent("dw_base","DWV_ITEMCHANGED",OnCellChanged); |
| | | return 0; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | |
| | | OnAttachEvent(); |
| | | //if(!m_configDoc) return -1; |
| | | |
| | | maint::onload(); |
| | | |
| | | OnClear(); |
| | | |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "frame.vd" |
| | | use "publiccode.vd" |
| | | use "xcontrol.vd" |
| | | use "xtreeview.vd" |
| | | |
| | | class SimpleMenuConfig : public frame |
| | | { |
| | | xdwgrid dw_list; |
| | | xtreeview tv_gs; |
| | | |
| | | int AddRow() |
| | | { |
| | | dw_list.InsertRow(0); |
| | | return 1; |
| | | } |
| | | |
| | | int InsertRow() |
| | | { |
| | | dw_list.AcceptText(); |
| | | int row = dw_list.GetRow(); |
| | | if(row < 1 || row >dw_list.GetRowCount()) |
| | | AddRow(); |
| | | else |
| | | dw_list.InsertRow(row); |
| | | return 1; |
| | | } |
| | | |
| | | int DeleteRow() |
| | | { |
| | | dw_list.AcceptText(); |
| | | int row = dw_list.GetRow(); |
| | | if(row < 1 || row >dw_list.GetRowCount()) |
| | | return 1; |
| | | dw_list.DeleteRow(row); |
| | | return 1; |
| | | } |
| | | |
| | | int Save() |
| | | { |
| | | dw_list.AcceptText(); |
| | | int i=0; |
| | | for(i=1; i<=dw_list.GetRowCount();i++) |
| | | { |
| | | string seq = dw_list.GetItemString(i, "SeqNo"); |
| | | if(seq != i.toString()) |
| | | dw_list.SetItemString(i, "SeqNo", i.toString()); |
| | | } |
| | | |
| | | xml x=new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg=new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | arg.AddArg("content", x.GetXml()); |
| | | if(getUrl("/workflow/action/ItemPictureMenu.dbmap/bill.update", arg.GetString(), x) != 1) |
| | | alert("ä¿å失败!"); |
| | | else |
| | | { |
| | | string str = x.GetXml(); |
| | | //alert(str); |
| | | if(str.find("失败", 0) > 0) |
| | | alert("ä¿å失败!"); |
| | | else |
| | | { |
| | | //alert("ä¿åæå!"); |
| | | dw_list.ResetUpdateStatus(); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | int hItem = xtreeview::GetSelectedItem(tv_gs.GetId()); |
| | | if(hItem > 0) |
| | | { |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | int p = trust(e as int); |
| | | xtreeview::SetItemData(tv_gs.GetId(), hItem, p); |
| | | |
| | | while(xtreeview::GetChildItem(tv_gs.GetId(), hItem) > 0) |
| | | xtreeview::DeleteItem(tv_gs.GetId(), xtreeview::GetChildItem(tv_gs.GetId(), hItem)); |
| | | |
| | | msxml::IXMLDOMNodeList li = x.GetXmlDoc().selectNodes("item/item"); |
| | | int s = li.length; |
| | | for(i=0;i<s;i++) |
| | | { |
| | | msxml::IXMLDOMElement ele = li.item(i); |
| | | int pa = trust(ele as int); |
| | | string name = ele.selectSingleNode("Name").text; |
| | | int cItem = xtreeview::InsertChildItem(tv_gs.GetId(), hItem, name, pa, 15); |
| | | if(ele.selectSingleNode("item")) |
| | | xtreeview::SetItemChild1(tv_gs.GetId(), cItem, 1); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int UpRow() |
| | | { |
| | | dw_list.AcceptText(); |
| | | int row = dw_list.GetRow(); |
| | | if(row < 2 || row > dw_list.GetRowCount()) |
| | | return 1; |
| | | dw_list.SetRowMove(row, -1); |
| | | dw_list.SetRow(row - 1); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int DownRow() |
| | | { |
| | | dw_list.AcceptText(); |
| | | int row = dw_list.GetRow(); |
| | | if(row < 1 || row > dw_list.GetRowCount() - 1) |
| | | return 1; |
| | | dw_list.SetRowMove(row, 1); |
| | | dw_list.SetRow(row + 1); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | int hCursor = xutil::SetCursorWait(); |
| | | if(comdid == "AddRow") AddRow(); |
| | | else if(comdid == "InsertRow") InsertRow(); |
| | | else if(comdid == "DeleteRow") DeleteRow(); |
| | | else if(comdid == "Save") Save(); |
| | | else if(comdid == "UpRow") UpRow(); |
| | | else if(comdid == "DownRow") DownRow(); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 0; |
| | | } |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent(anode,s); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnSetFocus(ref TEvent evt,int p) |
| | | { |
| | | SetAgent() ; |
| | | return 1; |
| | | } |
| | | |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = cast(evt.pnmh as NMTREEVIEW); |
| | | int hItem = nmtv.itemNew.hItem; |
| | | msxml::IXMLDOMElement e = trust(xtreeview::GetItemData(tv_gs.GetId(), hItem) as msxml::IXMLDOMElement); |
| | | //trace("%s", e.xml); |
| | | //string id = e.selectSingleNode("MenuID").text; |
| | | dw_list.AcceptText(); |
| | | dw_list.Retrieve(e); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeMoveNode(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref TVNNMHDR nmtv = trust(evt.pnmh as ref TVNNMHDR); |
| | | int xfrom = nmtv.FromItem; |
| | | int xto = nmtv.ToItem; |
| | | |
| | | int ret = xwin::MessageBox(this.GetHWND(), "ç¡®å®ç§»å¨èç¹ï¼","æç¤ºï¼",1); |
| | | //trace(ret); |
| | | if(ret == 2) |
| | | { |
| | | xtreeview::DeleteItem(tv_gs.GetId(), xto); |
| | | return -1; |
| | | } |
| | | |
| | | msxml::IXMLDOMElement fid = trust(xtreeview::GetItemData(tv_gs.GetId(), xfrom) as msxml::IXMLDOMElement); |
| | | int xpto = xtreeview::GetParentItem(tv_gs.GetId(), xto); |
| | | msxml::IXMLDOMElement tid = trust(xtreeview::GetItemData(tv_gs.GetId(), xpto) as msxml::IXMLDOMElement); |
| | | //trace("%s-------------------------%s",fid.xml,tid.xml); |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg=new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | |
| | | string id1 = fid.selectSingleNode("@guid").text; |
| | | string id2 = tid.selectSingleNode("@guid").text; |
| | | //trace("%s-------------------------%s",id1,id2); |
| | | string str = "update ItemPictureMenu set parentid='"+id2+"' where menuid='"+id1+"' "; |
| | | str += " select 1 for xml path('root')"; |
| | | |
| | | arg.AddArg("sql", str); |
| | | if(getSql(arg.GetString(),x)!=1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("ç§»å¨èç¹åºé!"); |
| | | xtreeview::DeleteItem(tv_gs.GetId(), xto); |
| | | return 0; |
| | | } |
| | | //trace("================"); |
| | | // |
| | | int xpfrom = xtreeview::GetParentItem(tv_gs.GetId(), xfrom); |
| | | trace("%d", xpfrom); |
| | | msxml::IXMLDOMElement fe = trust(xtreeview::GetItemData(tv_gs.GetId(), xpfrom) as msxml::IXMLDOMElement); |
| | | //trace("%s-------------------------%s",fe.xml,tid.xml); |
| | | msxml::IXMLDOMElement fe1 = fe.selectSingleNode("item[@guid='"+id1+"']"); |
| | | fe.removeChild(fe1); |
| | | tid.appendChild(fid); |
| | | |
| | | xtreeview::DeleteItem(tv_gs.GetId(), xfrom); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | int rItem = xtreeview::GetRootItem(tv_gs.GetId()); |
| | | xtreeview::ExpandItemEx(tv_gs.GetId(), rItem); |
| | | xtreeview::ItemFocus(tv_gs.GetId(), rItem); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent("tv_gs","TVN_SELCHANGED",OnTreeSelChanged); |
| | | AttachEvent("tv_gs", "TVN_ENDDRAG",OnTreeMoveNode); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.openUrl("/sale/view/SimpleProduct/template/Simple/Menu"); |
| | | dw_list.SetColumnState("SeqNo", false); |
| | | |
| | | tv_gs = GetControl("tv_gs"); |
| | | |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | |
| | | OnInitial(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | |
| | | unit trade |
| | | [ |
| | | class SourceRemark : public xwin |
| | | { |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | { |
| | | SetAgentNodeContent (anode,m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid=="xmAddRow") |
| | | { |
| | | int row =dw_list.GetRowCount(); |
| | | dw_list.InsertRow(0); |
| | | //dw_list.SetItemString(row+1,"State","Y"); |
| | | return 1; |
| | | } |
| | | else if(comdid=="xmDeleteRow") |
| | | { |
| | | dw_list.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | else if(comdid=="xmSave") |
| | | return OnSave(); |
| | | else if(comdid=="xmRefresh") |
| | | return OnRetrieve(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml x=new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | xaserverarg arg=new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content",x.GetXml()); |
| | | if (url::get("/sale/data/TradeFinance3/SourceRemark/update",arg.GetString(),x) != 1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("ä¿å失败!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | trace(x.GetXml()); |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert("ä¿ååºé2!"); |
| | | return 0; |
| | | } |
| | | win32::MessageBox(GetHWND(),"ä¿åæåï¼","æç¤º",0); |
| | | dw_list.ResetUpdateStatus(); |
| | | } |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | if (url::get("/sale/data/TradeFinance3/SourceRemark/list",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.openUrl("/sale/view/FinancialCode/template/SourceRemarkList"); |
| | | dw_list.SetColumnState("ID",false); |
| | | |
| | | OnRetrieve(); |
| | | |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | |
| | | unit trade |
| | | [ |
| | | class SpecialDeductFeeList : public xwin |
| | | { |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | { |
| | | SetAgentNodeContent (anode,m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid=="xmAddRow") |
| | | { |
| | | int row =dw_list.GetRowCount(); |
| | | dw_list.InsertRow(0); |
| | | //dw_list.SetItemString(row+1,"State","Y"); |
| | | return 1; |
| | | } |
| | | else if(comdid=="xmDeleteRow") |
| | | { |
| | | dw_list.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | else if(comdid=="xmSave") |
| | | return OnSave(); |
| | | else if(comdid=="xmRefresh") |
| | | return OnRetrieve(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml x=new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | xaserverarg arg=new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content",x.GetXml()); |
| | | trace(x.GetXml()); |
| | | if (url::get("/sale/data/expense3/update/SpecialDeductFee",arg.GetString(),x) != 1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("ä¿å失败!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | trace(x.GetXml()); |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert("ä¿ååºé2!"); |
| | | return 0; |
| | | } |
| | | win32::MessageBox(GetHWND(),"ä¿åæåï¼","æç¤º",0); |
| | | dw_list.ResetUpdateStatus(); |
| | | } |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | if (url::get("/sale/data/expense3/SpecialDeductFeeList",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.openUrl("/sale/view/expense3/SpecialDeductFeeList"); |
| | | dw_list.SetColumnState("ID",false); |
| | | |
| | | OnRetrieve(); |
| | | |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "system.vl" |
| | | use "win.vl" |
| | | use "list.vl" |
| | | unit vbusiness.entity |
| | | [ |
| | | TestingCompanyList is extend list; |
| | | about TestingCompanyList |
| | | [ |
| | | method: |
| | | [ |
| | | int onload() |
| | | { |
| | | list::onload(); |
| | | return -1; |
| | | } |
| | | |
| | | int ViewUpdate(param pr,string updateItem,xaserverarg__ arg) |
| | | { |
| | | if( updateItem=="del") |
| | | { |
| | | int DelRow = this.dw_list.GetRow(); |
| | | this.dw_list.DeleteRow(DelRow); |
| | | |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | ] |
| | | |
| | | |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "system.vl" |
| | | use "win.vl" |
| | | use "maint.vl" |
| | | use "file.vl" |
| | | use "dev:vm[xcell.vm]" |
| | | unit vbusiness.entity |
| | | [ |
| | | TestingCompanyMaint is extend maint; |
| | | about TestingCompanyMaint |
| | | [ |
| | | field: |
| | | [ |
| | | msxml::IXMLDOMDocument m_configDoc; |
| | | string m_userid; |
| | | string m_username; |
| | | string ContactID; |
| | | xdwtable__ dw_base; |
| | | xcell__ dw_cell; |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | int alert(string str) |
| | | { |
| | | //win__::MessageBox(this.GetHWND(),str,"æç¤º22:",0); |
| | | TApp::alert(this,str); |
| | | return 0; |
| | | } |
| | | int setCellReadOnly() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | dw_cell = new xcell__; |
| | | dw_cell.setNativePointer(dw_base.QueryItem("ixcell")); |
| | | string strnew = "<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='ä¿æ¤' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''/>"; |
| | | dw_cell.SetCellProps(2,2,strnew); |
| | | return 0; |
| | | } |
| | | int OnSetFocus(ref TNotifyEvent evt,int p) |
| | | { |
| | | SetAgent("maint"); |
| | | return 1; |
| | | } |
| | | string GetGuid(){ |
| | | return TApp::GetGuid(); |
| | | } |
| | | int OnClear(){ |
| | | if(this.m_EntityID ==""){ |
| | | m_userid = TApp::GetUserInfo().id; |
| | | m_username = TApp::GetUserInfo().name; |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | dw_base.SetItemString(1,"PartyID",GetGuid()); |
| | | dw_base.SetItemString(1,"PStatus","1"); |
| | | dw_base.SetItemDisplayString(1,"PStatus","ææ"); |
| | | dw_base.SetItemString(1,"CreatorID",m_userid); |
| | | dw_base.SetItemString(1,"PADStatus","1"); |
| | | dw_base.SetItemString(1,"Type","20"); |
| | | dw_base.SetItemString(1,"AddressID",GetGuid()); |
| | | dw_base.SetItemString(1,"PADIdentifyAddressFlag","Y"); |
| | | dw_base.SetItemString(1,"PrimaryFlag","Y"); |
| | | dw_base.SetItemString(1,"EnterName",m_userid); |
| | | dw_base.SetItemDisplayString(1,"EnterName",m_username); |
| | | dw_base.SetItemString(1,"CreateDate",TApp::GetCurDate()); |
| | | } |
| | | else |
| | | { |
| | | setCellReadOnly(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnAddrow() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | string dw_n=dw.GetDwName(); |
| | | if(dw_n=="item") |
| | | { |
| | | dw.InsertRow(0); |
| | | int rows = dw.GetRowCount(); |
| | | dw.SetRow(rows); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnInsertRow() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | string dw_n=dw.GetDwName(); |
| | | if(dw_n=="item") |
| | | { |
| | | int row=dw.GetRow(); |
| | | if(row<1) return 0; |
| | | dw.InsertRow(row); |
| | | dw.SetRow(row); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | string dw_n=dw.GetDwName(); |
| | | if(dw_n=="item") |
| | | { |
| | | int row=dw.GetRow(); |
| | | if(row<1) return 0; |
| | | /*string del = dw.GetItemString(row,8); |
| | | if(del!="") |
| | | { |
| | | if(m_dels=="") |
| | | { |
| | | m_dels=del; |
| | | } |
| | | else |
| | | { |
| | | string temp=m_dels; |
| | | m_dels=del + "|" + temp; |
| | | //+= "|"+del; |
| | | } |
| | | |
| | | }*/ |
| | | dw.DeleteRow(row); |
| | | dw.SetRow(row - 1); |
| | | } |
| | | return 1; |
| | | } |
| | | string getGoodsNo() |
| | | { |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | if (getUrl("/sale/data/LogisticsCode/pref/shipcompany/PartyNo",arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return ""; |
| | | } |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | if(e) |
| | | { |
| | | string code = e.text; |
| | | trace(code); |
| | | return "P"+code; |
| | | } |
| | | return "P1000"; |
| | | } |
| | | int OnPreSave() |
| | | { |
| | | dw_base.AcceptText(); |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | string ShipNo = dw_base.GetItemString(1,"ShipNo",0); |
| | | if (ShipNo=="" || ShipNo== nil) |
| | | { |
| | | dw_base.SetItemString(1,"ShipNo",getGoodsNo()); |
| | | } |
| | | xdwtable__ dwcon = new xdwtable__; |
| | | dwcon.setNativePointer(dw_base.FindDwTable("item",0)); |
| | | int i; |
| | | for(i=1;i<=dwcon.GetRowCount();i++) |
| | | { |
| | | string aTemp; |
| | | string aName = dwcon.GetItemString(i,"ContacterName",0); |
| | | trace(aName); |
| | | if (aName=="" || aName== nil) |
| | | { |
| | | aTemp=dwcon.GetItemString(i,"Mobile",0)+dwcon.GetItemString(i,"TEL",0)+dwcon.GetItemString(i,"Fax",0)+dwcon.GetItemString(i,"Email",0)+dwcon.GetItemString(i,"PCRemark",0); |
| | | trace(aTemp); |
| | | if(aTemp !="" && aTemp != nil) |
| | | { |
| | | alert("è系人åç§°å¿
å¡«ï¼"); |
| | | return -1; |
| | | } |
| | | } |
| | | else{ |
| | | string ContactID = dwcon.GetItemString(i,"ContactID",0); |
| | | if (ContactID=="" || ContactID== nil) |
| | | { |
| | | dwcon.SetItemString(i,"ContactID",GetGuid()); |
| | | dwcon.SetItemString(i,"PCStatus","1"); |
| | | dw_base.SetItemString(1,"PrimaryContactID",dwcon.GetItemString(1,"ContactID")); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int OnSave() |
| | | { |
| | | |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | string SName = dw_base.GetItemString(1,"Name"); |
| | | if(SName==""){ |
| | | alert("请è¾å
¥è¹å
¬å¸åç§°ï¼"); |
| | | return -1; |
| | | } |
| | | int rec =OnPreSave(); |
| | | if (rec== -1) return -1; |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | dw_base.DwUpdateAllTo(x.GetXmlDoc()); |
| | | trace(x.GetXml()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content",x.GetXml()); |
| | | arg.AddArg("dbmap","Shipcompany.dbmap"); |
| | | //arg.AddArg("m_dels",m_dels); |
| | | |
| | | if (getUrl("/sale/data/LogisticsCode/entity/shipcompany/save",arg.GetString(),x) != 1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("ä¿å失败!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | trace(x.GetXml()); |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert("ä¿ååºé2!"); |
| | | return 0; |
| | | } |
| | | alert("ä¿åæå!"); |
| | | dw_base.ResetUpdateStatus(); |
| | | setCellReadOnly(); |
| | | } |
| | | dw_base.Redraw(); |
| | | //m_dels=""; |
| | | return 0; |
| | | } |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | trace(comdid); |
| | | if(comdid.find("action:bill.row.add",0)>=0) { |
| | | OnAddrow(); |
| | | } |
| | | else if(comdid.find("bill.row.insert",0)>=0) { |
| | | OnInsertRow(); |
| | | } |
| | | else if(comdid.find("bill.row.delete",0)>=0) { |
| | | OnDeleteRow(); |
| | | } |
| | | else if(comdid.find("bill.save",0)>=0) { |
| | | trace(1); |
| | | dw_base.AcceptText(); |
| | | OnSave(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | int OnCellChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | string colname=hdr.colname; |
| | | //trace(colname); |
| | | if(colname=="ShipNo") |
| | | { |
| | | string cspec = dw_base.GetItemString(1,1); |
| | | trace(cspec); |
| | | string SpecRule="^\\d*$"; |
| | | xaserverarg__ args = new xaserverarg__; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg("CSpec",cspec); |
| | | args.AddArg("SpecRule",SpecRule); |
| | | xml__ x= new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | getUrl("/sale/data/LogisticsCode/pref/forwarderno/check",args.GetString(),x); |
| | | if(x.GetXmlDoc().selectSingleNode("root/spec")) |
| | | { |
| | | alert("请è¾å
¥æ°åï¼"); |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent("dw_base","DWV_ITEMCHANGED",OnCellChanged); |
| | | return 0; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | |
| | | OnAttachEvent(); |
| | | //if(!m_configDoc) return -1; |
| | | |
| | | maint::onload(); |
| | | |
| | | OnClear(); |
| | | |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | use "base.view.vd" |
| | | |
| | | unit trade |
| | | [ |
| | | class TypeListMaintWin : public xframe |
| | | { |
| | | xdwgrid dw_list; |
| | | xtreeview tv_folder; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | { |
| | | SetAgentNodeContent (anode,m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml x = ViewObject::MakeXml(); |
| | | xaserverarg arg = ViewObject::MakeArg(); |
| | | |
| | | xml x1 = ViewObject::MakeXml(); |
| | | x1.LoadXml("<root/>"); |
| | | |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | msxml::IXMLDOMNodeList t = x.GetXmlDoc().selectNodes("root/Supplier[@update.modify]"); |
| | | msxml::IXMLDOMElement e1= x1.GetXmlDoc().documentElement; |
| | | int len = t.length; |
| | | for(int i=0;i<len;i++) |
| | | { |
| | | e1.appendChild(t.item(i)); |
| | | } |
| | | arg.AddArg("content",x1.GetXml()); |
| | | if(url::get("/sale/data/SupplierV3/entity/save/v3", arg.GetString(),x)!=1) |
| | | { |
| | | string error = x.GetXmlDoc().text; |
| | | alert(error); |
| | | return 1; |
| | | }else |
| | | { |
| | | |
| | | if( x.GetXmlDoc().selectSingleNode("ok")) |
| | | { |
| | | alert("ä¿åæå"); |
| | | dw_list.ResetUpdateStatus(); |
| | | }else |
| | | { |
| | | alert("ä¿å失败!"); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid=="xmSave") |
| | | return OnSave(); |
| | | else if(comdid=="xmSearch") |
| | | return OnRetrieve(); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | int hItem =tv_folder.GetSelectedItem(); |
| | | string typ = tv_folder.GetItemData(hItem); |
| | | string searchStr = GetControl("SearchContent").GetText(); |
| | | |
| | | int hCursor = xutil::SetCursorWait(); |
| | | xml x = ViewObject::RetrieveData("/sale/data/SupplierV3/type/list", "sType",typ,"SearchText",searchStr); |
| | | if(x) |
| | | dw_list.Retrieve(x); |
| | | else |
| | | dw_list.Reset(); |
| | | dw_list.Redraw(); |
| | | xutil::RestoreCursor(hCursor); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //æ éæ© |
| | | int OnTreeSelChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = cast(evt.pnmh as NMTREEVIEW); |
| | | int hItem = nmtv.itemNew.hItem; |
| | | return OnRetrieve(); |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent("tv_folder", "TVN_SELCHANGED",OnTreeSelChanged); |
| | | } |
| | | |
| | | /* |
| | | int OnRetrieve() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("xxx","xxx"); |
| | | if (getUrl("",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }else |
| | | { |
| | | //dw_list.Retrieve(x); |
| | | //dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | */ |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.openUrl("/sale/view/SupplierV3/template/supplier/mainttypelist"); |
| | | |
| | | tv_folder = GetControl("tv_folder"); |
| | | OnAttachEvent(); |
| | | xtreeview::ExpandItem(tv_folder.GetId(),xtreeview::GetRootItem(tv_folder.GetId())); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | |
| | | unit trade |
| | | [ |
| | | class basicfareTypeList : public xwin |
| | | { |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | { |
| | | SetAgentNodeContent (anode,m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid=="xmAddRow") |
| | | { |
| | | int row =dw_list.GetRowCount(); |
| | | dw_list.InsertRow(0); |
| | | dw_list.SetItemString(row+1,"State","Y"); |
| | | return 1; |
| | | } |
| | | else if(comdid=="xmDeleteRow") |
| | | { |
| | | dw_list.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | else if(comdid=="xmSave") |
| | | return OnSave(); |
| | | else if(comdid=="xmRefresh") |
| | | return OnRetrieve(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml x=new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | xaserverarg arg=new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content",x.GetXml()); |
| | | if (url::get("/sale/data/expense3/update/basicfareType",arg.GetString(),x) != 1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("ä¿å失败!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | trace(x.GetXml()); |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert("ä¿ååºé2!"); |
| | | return 0; |
| | | } |
| | | win32::MessageBox(GetHWND(),"ä¿åæåï¼","æç¤º",0); |
| | | dw_list.ResetUpdateStatus(); |
| | | } |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | if (url::get("/sale/data/expense3/basicfareTypeLsit",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.openUrl("/sale/view/expense3/basicfareTypeList"); |
| | | dw_list.SetColumnState("ID",false); |
| | | |
| | | OnRetrieve(); |
| | | |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | use "frame.vl" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "file.vl" |
| | | use "dev:vm[xutil.vm]" |
| | | |
| | | unit vbusiness.entity |
| | | [ |
| | | brand_regtype is extend frame; |
| | | about brand_regtype |
| | | [ |
| | | method: |
| | | [ |
| | | xdwtable__ dw_list; |
| | | |
| | | 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){ |
| | | SetAgentNodeContent (anode,agent.xml); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | xdwtable__ getDw() |
| | | { |
| | | xdwtable__ dw1 = new xdwtable__; |
| | | dw1.setNativePointer(dw_list.FindDwTable("item")); |
| | | return dw1; |
| | | } |
| | | |
| | | int addRow() |
| | | { |
| | | xdwtable__ dw = getDw(); |
| | | int row = dw.InsertRow(0); |
| | | string no = "2"; |
| | | if(row > 1) |
| | | no = dw.GetItemString(row - 1, "RegTypeID"); |
| | | int n = no.toInt(); |
| | | int h = n + 1; |
| | | dw.SetItemString(row, "RegTypeID", h.toString()); |
| | | return 1; |
| | | } |
| | | int deleteRow() |
| | | { |
| | | xdwtable__ dw = getDw(); |
| | | int row = dw.GetRow(); |
| | | if(row < 1 || row > dw.GetRowCount()) return -1; |
| | | if (win__::MessageBox(this.GetHWND(),"æ¯å¦å é¤éæ©çè®°å½è¡ï¼","æç¤º",4) == 7) |
| | | return 1; |
| | | dw.DeleteRow(row); |
| | | return 1; |
| | | } |
| | | int save() |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllTo(x.GetXmlDoc()); |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | //trace(e.xml); |
| | | arg.AddArg("content", e.xml); |
| | | if(getUrl("/workflow/action/BrandRegType.dbmap/bill.update", arg.GetString(), x) != 1) |
| | | { |
| | | alert("ä¿å失败!"); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | string str = x.GetXml(); |
| | | if(str.find("ä¿åæå", 0) > 0) |
| | | { |
| | | alert("ä¿åæå"); |
| | | dw_list.ResetUpdateStatus(); |
| | | dw_list.Redraw(); |
| | | } |
| | | else |
| | | alert("ä¿å失败0!"); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | if(comdid == "xmNew") addRow(); |
| | | else if(comdid == "xmDelete") deleteRow(); |
| | | else if(comdid == "xmSave") save(); |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnSetFocus(ref TEvent evt,int p) |
| | | { |
| | | SetAgent() ; |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | |
| | | return 1; |
| | | } |
| | | int Initail() |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | if(getUrl("/sale/data/brand/entity/regtype", arg.GetString(), x) != 1) |
| | | { |
| | | alert("åå§åæ¥è¯¢å¤±è´¥!"); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = new xdwtable__; |
| | | dw_list.setNativePointer(GetControl("dw_list")); |
| | | dw_list.openUrl("/sale/view/brand/template/regtype"); |
| | | //dw_list.SetColHeaderHeight(0); |
| | | dw_list.SetRowSelectorWidth(0); |
| | | |
| | | OnAttachEvent(); |
| | | SetAgent(); |
| | | Initail(); |
| | | return -1; |
| | | } |
| | | ] |
| | | ] |
| | | ] |