| | |
| | | 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]" |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | unit vbusiness.xpage |
| | | [ |
| | | AddUomGroup is extend win__; |
| | | about AddUomGroup |
| | | [ |
| | | control: |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) AddUomGroup : public xwin |
| | | { |
| | | |
| | | public: |
| | | AddUomGroup(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static AddUomGroup* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | AddUomGroup* pWin = new AddUomGroup(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | |
| | | |
| | | int SetAgent() |
| | | { |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM p) |
| | | { |
| | | int SetAgent(); |
| | | |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"cb_cancel") |
| | | CloseWindow(); |
| | | else if (comdid == L"cb_ok") |
| | | { |
| | | control xc = new control; |
| | | xc.setNativePointer(GetControl(L"Txt")); |
| | | xstring name = xc.GetText(); |
| | | xaserverarg arg; |
| | | |
| | | arg = GetArg(); |
| | | arg.AddArg(L"GroupName", name); |
| | | arg.AddArg(L"return", L"ok"); |
| | | CloseWindow(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&AddUomGroup::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&AddUomGroup::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | |
| | | int onload() |
| | | { |
| | | SetArg(); |
| | | OnInitial(); |
| | | |
| | | |
| | | method: |
| | | [ |
| | | |
| | | |
| | | int SetAgent() |
| | | if (GetWinParam()) |
| | | { |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt,int p) |
| | | { |
| | | int SetAgent(); |
| | | xaserverarg arg; |
| | | |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid=="cb_cancel") |
| | | CloseWindow(); |
| | | else if(comdid=="cb_ok") |
| | | arg = GetArg(); |
| | | xstring note = arg.GetArgString(L"note"); |
| | | if (note == L"修改") |
| | | { |
| | | 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(); |
| | | xstring name = arg.GetArgString(L"GroupName"); |
| | | control xc = new control; |
| | | xc.setNativePointer(GetControl(L"Txt")); |
| | | xc.SetText(name); |
| | | } |
| | | 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()) |
| | | xstring id = arg.GetArgString(L"m_id"); |
| | | if (id == L"FND_UOM") |
| | | { |
| | | |
| | | 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(),"辅助属性"); |
| | | } |
| | | } |
| | | SetWindowText(GetHWND(), L"计量单位"); |
| | | } |
| | | |
| | | return 1; |
| | | else if (id == L"FND_CustomerSource") |
| | | { |
| | | SetWindowText(GetHWND(), L"客户来源"); |
| | | } |
| | | else if (id == L"FND_AuxiliaryAttribute") |
| | | { |
| | | SetWindowText(GetHWND(), L"辅助属性"); |
| | | } |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | use "system.vl" |
| | | use "win.vl" |
| | | use "list.vl" |
| | | unit vbusiness.entity |
| | | [ |
| | | BrandInforList is extend list; |
| | | about BrandInforList |
| | | [ |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | |
| | | 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; |
| | | } |
| | | |
| | | ] |
| | | ] |
| | | ] |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) BrandInforList : public xwin |
| | | { |
| | | |
| | | public: |
| | | BrandInforList(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static BrandInforList* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | BrandInforList* pWin = new BrandInforList(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | |
| | | |
| | | int ViewUpdate(param pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"del") { |
| | | int DelRow = dw_list.GetRow(); |
| | | 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) |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) BrandInforMaint : public xframe |
| | | { |
| | | public: |
| | | |
| | | KXMLDOMDocument m_configDoc; |
| | | xstring m_userid; |
| | | xstring m_username; |
| | | xstring ContactID; |
| | | xdwtable dw_base; |
| | | xcell dw_cell; |
| | | public: |
| | | BrandInforMaint(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static BrandInforMaint* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | BrandInforMaint* pWin = new BrandInforMaint(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int alert(xstring str) |
| | | { |
| | | //win::MessageBox(GetHWND(),str,L"提示22:",0); |
| | | TApp::alert(this, str); |
| | | return 0; |
| | | } |
| | | int ViewUpdate(param pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"update") |
| | | { |
| | | |
| | | dw_base.ResetUpdateStatus(); |
| | | return 1; |
| | | } |
| | | } |
| | | xstring GetEntityData(param pr) |
| | | { |
| | | xml x; |
| | | |
| | | dw_base.DwUpdateAllTo(x); |
| | | //trace(L"------x"); |
| | | trace(x.xml()); |
| | | return x.xml(); |
| | | } |
| | | int onload() |
| | | { |
| | | maint::onload(); |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | |
| | | dw_base.SetColHeaderHeight(0); |
| | | dw_base.SetRowSelectorWidth(0); |
| | | |
| | | dw_base.SetScrollState(false); |
| | | |
| | | |
| | | /*if (!maint::m_EntityID) |
| | | { |
| | | //xstring suserid = TApp::GetUserInfo().id; |
| | | xstring suserid = xaserver::GetUserId(); |
| | | xstring susername = TApp::GetUserInfo().name; |
| | | xstring sdate = TApp::GetCurDate(); |
| | | dw_base.SetItemString(dw_base.GetRow(),L"CreatorID",suserid);//Party |
| | | dw_base.SetItemDisplayString(dw_base.GetRow(),L"CreatorID",susername); |
| | | dw_base.SetItemString(dw_base.GetRow(),L"CreateDate",sdate); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"id", suserid); |
| | | if(xaserver::ExecXQuery(L"",L"[OrgInfo.xq]",arg.GetString(),x)!=1) |
| | | { |
| | | //win__::MessageBox(this.GetHWND(),str,"提示22:",0); |
| | | TApp::alert(this,str); |
| | | return 0; |
| | | trace(x.xml()); |
| | | return nil; |
| | | } |
| | | int ViewUpdate(param pr,string updateItem,xaserverarg__ arg) |
| | | //alert(x.xml()); |
| | | KXMLDOMElement e= x.documentElement(); |
| | | trace(e.xml); |
| | | if(e.selectSingleNode(L"orgid")) |
| | | { |
| | | 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); |
| | | } |
| | | }*/ |
| | | xstring orgid= e.selectSingleNode(L"orgid").text(); |
| | | dw_base.SetItemString(1,L"OrgID",orgid); |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| | | |
| | | if(e.selectSingleNode(L"orgname")) |
| | | { |
| | | xstring orgname = e.selectSingleNode(L"orgname").text(); |
| | | dw_base.SetItemDisplayString(1,L"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; |
| | | xstring m_QueryTxt; |
| | | msxml::IXMLDOMDocument m_configDoc; |
| | | static int dw_hWnd; |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | int alert(xstring str) |
| | | { |
| | | //win__::MessageBox(this.GetHWND(),str,L"提示22:",0); |
| | | TApp::alert(this,str); |
| | | return 0; |
| | | } |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | |
| | | xstring 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,L"PartyID",GetGuid()); |
| | | this.dw_list.SetItemString(rows,L"ContactID",GetGuid()); |
| | | this.dw_list.SetItemString(rows,L"PAStatus",L"1"); |
| | | this.dw_list.SetItemString(rows,L"PStatus",L"1"); |
| | | this.dw_list.SetItemString(rows,L"PCStatus",L"1"); |
| | | this.dw_list.SetItemString(rows,L"Type",L"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,L"PartyID",GetGuid()); |
| | | this.dw_list.SetItemString(row,L"ContactID",GetGuid()); |
| | | this.dw_list.SetItemString(row,L"PAStatus",L"1"); |
| | | this.dw_list.SetItemString(row,L"PStatus",L"1"); |
| | | this.dw_list.SetItemString(row,L"PCStatus",L"1"); |
| | | this.dw_list.SetItemString(row,L"Type",L"7"); |
| | | } |
| | | |
| | | int ViewUpdate(param pr,xstring updateItem,xaserverarg__ arg) |
| | | { |
| | | if( updateItem==L"del") |
| | | { |
| | | int DelRow = this.dw_list.GetRow(); |
| | | this.dw_list.DeleteRow(DelRow); |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) CartermList : public xwin |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xdwpages dw_pages; |
| | | xstring m_QueryTxt; |
| | | KXMLDOMDocument m_configDoc; |
| | | static int dw_hWnd; |
| | | |
| | | } |
| | | public: |
| | | CartermList(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static CartermList* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | CartermList* pWin = new CartermList(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int alert(xstring str) |
| | | { |
| | | //win::MessageBox(GetHWND(),str,L"提示22:",0); |
| | | TApp::alert(this, str); |
| | | return 0; |
| | | } |
| | | |
| | | 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() |
| | | { |
| | | /*xstring no = this.dw_list.GetItemString(1,L"CarTermNo"); |
| | | if(no==L""){ |
| | | alert(L"请输入车队编码!"); |
| | | return -1; |
| | | } |
| | | xstring SName = this.dw_list.GetItemString(1,L"Name"); |
| | | if(SName==L""){ |
| | | alert(L"请输入车队名称!"); |
| | | return -1; |
| | | } |
| | | xstring ContacterName = this.dw_list.GetItemString(1,L"ContacterName"); |
| | | if(ContacterName==L""){ |
| | | alert(L"请输入联系人名称!"); |
| | | 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(L"content",x.GetXml()); |
| | | arg.AddArg(L"dbmap",L"CarTerm.dbmap"); |
| | | if (getUrl(L"/sale/data/CarTerm/entity/carterm/save",arg.GetString(),x) != 1) |
| | | { |
| | | trace(L"error:"+x.GetXml()); |
| | | alert(L"保存失败!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | trace(x.GetXml()); |
| | | if(x.GetXmlDoc().selectSingleNode(L"error")) |
| | | { |
| | | alert(L"保存出错2!"); |
| | | return 0; |
| | | } |
| | | alert(L"保存成功!"); |
| | | this.dw_list.ResetUpdateStatus(); |
| | | } |
| | | this.dw_list.Redraw(); |
| | | return 0; |
| | | } |
| | | int OnCmdDispatch(xstring comdid) |
| | | |
| | | xstring GetGuid() { |
| | | return TApp::GetGuid(); |
| | | } |
| | | int OnAddrow() |
| | | { |
| | | dw_list.InsertRow(0); |
| | | int rows = dw_list.GetRowCount(); |
| | | dw_list.SetRow(rows); |
| | | dw_list.SetItemString(rows, L"PartyID", GetGuid()); |
| | | dw_list.SetItemString(rows, L"ContactID", GetGuid()); |
| | | dw_list.SetItemString(rows, L"PAStatus", L"1"); |
| | | dw_list.SetItemString(rows, L"PStatus", L"1"); |
| | | dw_list.SetItemString(rows, L"PCStatus", L"1"); |
| | | dw_list.SetItemString(rows, L"Type", L"7"); |
| | | } |
| | | int OnInsertRow() |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if (row<1 || row>dw_list.GetRowCount()) return 0; |
| | | dw_list.InsertRow(row); |
| | | dw_list.SetItemString(row, L"PartyID", GetGuid()); |
| | | dw_list.SetItemString(row, L"ContactID", GetGuid()); |
| | | dw_list.SetItemString(row, L"PAStatus", L"1"); |
| | | dw_list.SetItemString(row, L"PStatus", L"1"); |
| | | dw_list.SetItemString(row, L"PCStatus", L"1"); |
| | | dw_list.SetItemString(row, L"Type", L"7"); |
| | | } |
| | | |
| | | int ViewUpdate(param pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"del") |
| | | { |
| | | int DelRow = dw_list.GetRow(); |
| | | dw_list.DeleteRow(DelRow); |
| | | |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | 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 OnSave() |
| | | { |
| | | /*xstring no = dw_list.GetItemString(1,L"CarTermNo"); |
| | | if(no==L""){ |
| | | alert(L"请输入车队编码!"); |
| | | return -1; |
| | | } |
| | | xstring SName = dw_list.GetItemString(1,L"Name"); |
| | | if(SName==L""){ |
| | | alert(L"请输入车队名称!"); |
| | | return -1; |
| | | } |
| | | xstring ContacterName = dw_list.GetItemString(1,L"ContacterName"); |
| | | if(ContacterName==L""){ |
| | | alert(L"请输入联系人名称!"); |
| | | return -1; |
| | | } */ |
| | | xml x; |
| | | |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | trace(x.xml()); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | arg.AddArg(L"dbmap", L"CarTerm.dbmap"); |
| | | if (xurl::get(L"/sale/data/CarTerm/entity/carterm/save", arg.GetString(), x) != 1) |
| | | { |
| | | trace(L"error:" + (xstring)x.xml()); |
| | | alert(L"保存失败!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | trace(x.xml()); |
| | | if (x.selectSingleNode(L"error")) |
| | | { |
| | | if(comdid.find(L"action:bill.row.add",0)>=0) { |
| | | OnAddrow(); |
| | | } |
| | | else if(comdid.find(L"bill.row.insert",0)>=0) { |
| | | OnInsertRow(); |
| | | } |
| | | else if(comdid.find(L"bill.row.delete",0)>=0) { |
| | | OnDeleteRow(); |
| | | } |
| | | else if(comdid.find(L"bill.save",0)>=0) { |
| | | trace(1); |
| | | OnSave(); |
| | | } |
| | | alert(L"保存出错2!"); |
| | | return 0; |
| | | } |
| | | alert(L"保存成功!"); |
| | | dw_list.ResetUpdateStatus(); |
| | | } |
| | | dw_list.Redraw(); |
| | | return 0; |
| | | } |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid.find(L"action:bill.row.add", 0) >= 0) { |
| | | OnAddrow(); |
| | | } |
| | | else if (comdid.find(L"bill.row.insert", 0) >= 0) { |
| | | OnInsertRow(); |
| | | } |
| | | else if (comdid.find(L"bill.row.delete", 0) >= 0) { |
| | | OnDeleteRow(); |
| | | } |
| | | else if (comdid.find(L"bill.save", 0) >= 0) { |
| | | //trace(1); |
| | | OnSave(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent(L"WM_XCOMMAND",OnXCommand); |
| | | return 0; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | OnAttachEvent(); |
| | | list::onload(); |
| | | this.dw_list.SetReadOnly(false); |
| | | return -1; |
| | | } |
| | | |
| | | ] |
| | | ] |
| | | ] |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&CartermList::OnXCommand); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | OnAttachEvent(); |
| | | list::onload(); |
| | | dw_list.SetReadOnly(false); |
| | | return -1; |
| | | } |
| | | |
| | | }; |
| | |
| | | use "system.vl" |
| | | use "win.vl" |
| | | use "list.vl" |
| | | unit vbusiness.entity |
| | | [ |
| | | CustomerMarketList is extend list; |
| | | about CustomerMarketList |
| | | [ |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | |
| | | 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; |
| | | } |
| | | |
| | | ] |
| | | ] |
| | | ] |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) CustomerMarketList : public xwin |
| | | { |
| | | |
| | | public: |
| | | CustomerMarketList(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static CustomerMarketList* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | CustomerMarketList* pWin = new CustomerMarketList(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | |
| | | int ViewUpdate(param pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"del") { |
| | | int DelRow = dw_list.GetRow(); |
| | | 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); |
| | | } |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | if(e.selectSingleNode("orgname")) |
| | | { |
| | | string orgname = e.selectSingleNode("orgname").text; |
| | | dw_base.SetItemDisplayString(1,"OrgID",orgname); |
| | | } |
| | | } |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) CustomerMarketMaint : public xframe |
| | | { |
| | | public: |
| | | KXMLDOMDocument m_configDoc; |
| | | xstring m_userid; |
| | | xstring m_username; |
| | | xstring ContactID; |
| | | xdwtable dw_base; |
| | | xcell dw_cell; |
| | | public: |
| | | CustomerMarketMaint(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static CustomerMarketMaint* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | CustomerMarketMaint* pWin = new CustomerMarketMaint(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int alert(xstring str) |
| | | { |
| | | //win::MessageBox(GetHWND(),str,L"提示22:",0); |
| | | TApp::alert(this, str); |
| | | return 0; |
| | | } |
| | | int ViewUpdate(param pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"update") |
| | | { |
| | | |
| | | dw_base.ResetUpdateStatus(); |
| | | return 1; |
| | | } |
| | | } |
| | | xstring GetEntityData(param pr) |
| | | { |
| | | xml x; |
| | | |
| | | dw_base.DwUpdateAllTo(x); |
| | | //trace(L"------x"); |
| | | trace(x.xml()); |
| | | return x.xml(); |
| | | } |
| | | int onload() |
| | | { |
| | | maint::onload(); |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | if (!maint::m_EntityID) |
| | | { |
| | | //xstring suserid = TApp::GetUserInfo().id; |
| | | xstring suserid = xaserver::GetUserId(); |
| | | xstring susername = TApp::GetUserInfo().name; |
| | | xstring sdate = TApp::GetCurDate(); |
| | | dw_base.SetItemString(dw_base.GetRow(), L"CreatorID", suserid);//Party |
| | | dw_base.SetItemDisplayString(dw_base.GetRow(), L"CreatorID", susername); |
| | | dw_base.SetItemString(dw_base.GetRow(), L"CreateDate", sdate); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"id", suserid); |
| | | if (xaserver::ExecXQuery(L"", L"[OrgInfo.xq]", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.xml()); |
| | | return nil; |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| | | //alert(x.xml()); |
| | | KXMLDOMElement e = x.documentElement(); |
| | | trace(e.xml()); |
| | | if (e.selectSingleNode(L"orgid")) |
| | | { |
| | | xstring orgid = e.selectSingleNode(L"orgid").text(); |
| | | dw_base.SetItemString(1, L"OrgID", orgid); |
| | | } |
| | | |
| | | if (e.selectSingleNode(L"orgname")) |
| | | { |
| | | xstring orgname = e.selectSingleNode(L"orgname").text(); |
| | | dw_base.SetItemDisplayString(1, L"OrgID", orgname); |
| | | } |
| | | } |
| | | } |
| | | }; |
| | |
| | | use "system.vl" |
| | | use "win.vl" |
| | | use "list.vl" |
| | | unit vbusiness.entity |
| | | [ |
| | | ExpressList is extend list; |
| | | about ExpressList |
| | | [ |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | |
| | | 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); |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | } |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) ExpressList : public xwin |
| | | { |
| | | public: |
| | | ExpressList(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static ExpressList* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | ExpressList* pWin = new ExpressList(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int onload() |
| | | { |
| | | list::onload(); |
| | | return -1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | ] |
| | | ] |
| | | ] |
| | | int ViewUpdate(param pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | |
| | | if (updateItem == L"del") |
| | | { |
| | | int DelRow = dw_list.GetRow(); |
| | | 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; |
| | | } |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | 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; |
| | | } |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | }*/ |
| | | 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")); |
| | | } |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) ExpressMaint : public xframe |
| | | { |
| | | public: |
| | | KXMLDOMDocument m_configDoc; |
| | | xdwtable dw_base; |
| | | xstring m_userid; |
| | | xstring m_username; |
| | | xstring ContactID; |
| | | xcell dw_cell; |
| | | public: |
| | | ExpressMaint(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static ExpressMaint* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | ExpressMaint* pWin = new ExpressMaint(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int alert(xstring str) |
| | | { |
| | | //win::MessageBox(GetHWND(),str,L"提示22:",0); |
| | | TApp::alert(this, str); |
| | | return 0; |
| | | } |
| | | int setCellReadOnly() |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | dw_cell = new xcell; |
| | | dw_cell.setNativePointer(dw_base.QueryItem(L"ixcell")); |
| | | xstring strnew = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''/>"; |
| | | dw_cell.SetCellProps(2, 2, strnew); |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | 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() |
| | | xstring GetGuid() { |
| | | return TApp::GetGuid(); |
| | | } |
| | | int OnClear() { |
| | | if (m_EntityID == L"") { |
| | | trace(1); |
| | | m_userid = TApp::GetUserInfo().id; |
| | | m_username = TApp::GetUserInfo().name; |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | dw_base.SetItemString(1, L"PartyID", GetGuid()); |
| | | dw_base.SetItemString(1, L"PStatus", L"1"); |
| | | dw_base.SetItemDisplayString(1, L"PStatus", L"有效"); |
| | | dw_base.SetItemString(1, L"PADStatus", L"1"); |
| | | dw_base.SetItemString(1, L"CreatorID", m_userid); |
| | | dw_base.SetItemString(1, L"AddressID", GetGuid()); |
| | | dw_base.SetItemString(1, L"PADIdentifyAddressFlag", L"Y"); |
| | | dw_base.SetItemString(1, L"PrimaryFlag", L"Y"); |
| | | dw_base.SetItemString(1, L"Type", L"8"); |
| | | dw_base.SetItemString(1, L"EnterName", m_userid); |
| | | dw_base.SetItemDisplayString(1, L"EnterName", m_username); |
| | | dw_base.SetItemString(1, L"CreateDate", TApp::GetCurDate()); |
| | | dw_base.SetItemString(1, L"PBAStatus", L"Y"); |
| | | |
| | | |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnSetFocus(TEvent* evt, LPARAM p) |
| | | { |
| | | SetAgent(L"maint"); |
| | | return 1; |
| | | } |
| | | int OnAddrow() |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"item") |
| | | { |
| | | dw.InsertRow(0); |
| | | int rows = dw.GetRowCount(); |
| | | dw.SetRow(rows); |
| | | |
| | | } |
| | | return 1; |
| | | } |
| | | int OnInsertRow() |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"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(GetControl(L"dw_base")); |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"item") |
| | | { |
| | | int row = dw.GetRow(); |
| | | if (row < 1) return 0; |
| | | /*xstring del = dw.GetItemString(row,8); |
| | | if(del!=L"") |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | string SName = dw_base.GetItemString(1,"Name"); |
| | | if(SName==""){ |
| | | alert("请输入快递公司名称!"); |
| | | if(m_dels==L"") |
| | | { |
| | | m_dels=del; |
| | | } |
| | | else |
| | | { |
| | | xstring temp=m_dels; |
| | | m_dels=del + L"|" + temp; |
| | | //+= L"|"+del; |
| | | } |
| | | |
| | | }*/ |
| | | dw.DeleteRow(row); |
| | | dw.SetRow(row - 1); |
| | | } |
| | | //trace(m_dels); |
| | | return 1; |
| | | } |
| | | xstring getGoodsNo() |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | if (getUrl(L"/sale/data/LogisticsCode/pref/express/PartyNo", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.xml()); |
| | | return L""; |
| | | } |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (e) |
| | | { |
| | | xstring code = e.text(); |
| | | trace(code); |
| | | return L"E" + code; |
| | | } |
| | | return L"E1000"; |
| | | } |
| | | int OnPreSave() |
| | | { |
| | | dw_base.AcceptText(); |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | xstring ExpressNo = dw_base.GetItemString(1, L"ExpressNo"); |
| | | if (ExpressNo == L"") |
| | | { |
| | | dw_base.SetItemString(1, L"ExpressNo", getGoodsNo()); |
| | | } |
| | | xdwtable dwcon = new xdwtable; |
| | | dwcon.setNativePointer(dw_base.FindDwTable(L"item", 0)); |
| | | int i; |
| | | for (i = 1; i <= dwcon.GetRowCount(); i++) |
| | | { |
| | | xstring aTemp; |
| | | xstring aName = dwcon.GetItemString(i, L"ContacterName"); |
| | | if (aName == L"") |
| | | { |
| | | aTemp = dwcon.GetItemString(i, L"Mobile") + dwcon.GetItemString(i, L"TEL") + dwcon.GetItemString(i, L"Fax") + dwcon.GetItemString(i, L"Email") + dwcon.GetItemString(i, L"PCRemark"); |
| | | trace(aTemp); |
| | | if (aTemp != L"") |
| | | { |
| | | alert(L"联系人名称必填!"); |
| | | 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) |
| | | } |
| | | else { |
| | | xstring ContactID = dwcon.GetItemString(i, L"ContactID"); |
| | | if (ContactID == L"") |
| | | { |
| | | 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(); |
| | | dwcon.SetItemString(i, L"ContactID", GetGuid()); |
| | | dwcon.SetItemString(i, L"PCStatus", L"1"); |
| | | //dw_base.SetItemString(1,L"PrimaryContactID",dwcon.GetItemString(1,L"ContactID")); |
| | | } |
| | | 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) |
| | | } |
| | | xdwtable dwcon1 = new xdwtable; |
| | | dwcon1.setNativePointer(dw_base.FindDwTable(L"PartyBankAccount", 0)); |
| | | int j; |
| | | xstring sPBABankName = L""; |
| | | xstring sPBABankAccountNo = L""; |
| | | for (j = 1; j <= dwcon1.GetRowCount(); j++) |
| | | { |
| | | xstring sPBABankName = dwcon1.GetItemString(j, L"Bank"); |
| | | xstring sPBABankAccountNo = dwcon1.GetItemString(j, L"BankNo"); |
| | | |
| | | xstring sPBAAll = sPBABankName + sPBABankAccountNo; |
| | | if (sPBAAll != L"") |
| | | { |
| | | 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") |
| | | if (sPBABankName == L"") |
| | | { |
| | | 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; |
| | | } |
| | | |
| | | alert(L"银行名称不能为空"); |
| | | return -1; |
| | | } |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | if (sPBABankAccountNo == L"") |
| | | { |
| | | alert(L"银行账户不能为空"); |
| | | return -1; |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int OnSave() |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | xstring SName = dw_base.GetItemString(1, L"Name"); |
| | | if (SName == L"") { |
| | | alert(L"请输入快递公司名称!"); |
| | | return -1; |
| | | } |
| | | int rec = OnPreSave(); |
| | | if (rec == -1) return -1; |
| | | xml x; |
| | | |
| | | dw_base.DwUpdateAllTo(x); |
| | | trace(x.xml()); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | arg.AddArg(L"dbmap", L"Express.dbmap"); |
| | | //arg.AddArg(L"m_dels",m_dels); |
| | | if (getUrl(L"/sale/data/LogisticsCode/entity/express/save", arg.GetString(), x) != 1) |
| | | { |
| | | trace(L"error:" + (xstring)x.xml()); |
| | | alert(L"保存失败!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | trace(x.xml()); |
| | | if (x.selectSingleNode(L"error")) |
| | | { |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent("dw_base","DWV_ITEMCHANGED",OnCellChanged); |
| | | alert(L"保存出错2!"); |
| | | return 0; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_base = new xdwtable__; |
| | | dw_base.setNativePointer(this.GetControl("dw_base")); |
| | | |
| | | OnAttachEvent(); |
| | | //if(!m_configDoc) return -1; |
| | | alert(L"保存成功!"); |
| | | dw_base.ResetUpdateStatus(); |
| | | setCellReadOnly(); |
| | | } |
| | | dw_base.Redraw(); |
| | | //m_dels=L""; |
| | | return 0; |
| | | } |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid.find(L"action:bill.row.add", 0) >= 0) { |
| | | OnAddrow(); |
| | | } |
| | | else if (comdid.find(L"bill.row.insert", 0) >= 0) { |
| | | OnInsertRow(); |
| | | } |
| | | else if (comdid.find(L"bill.row.delete", 0) >= 0) { |
| | | OnDeleteRow(); |
| | | } |
| | | else if (comdid.find(L"bill.save", 0) >= 0) { |
| | | //trace(1); |
| | | OnSave(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | maint::onload(); |
| | | OnClear(); |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | int OnCellChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring colname = hdr.colname; |
| | | //trace(colname); |
| | | if (colname == L"ExpressNo") |
| | | { |
| | | xstring cspec = dw_base.GetItemString(1, 1); |
| | | trace(cspec); |
| | | xstring SpecRule = L"^\\d*$"; |
| | | xaserverarg args; |
| | | |
| | | args.AddArg(L"CSpec", cspec); |
| | | args.AddArg(L"SpecRule", SpecRule); |
| | | xml x; |
| | | |
| | | getUrl(L"/sale/data/LogisticsCode/pref/forwarderno/check", args.GetString(), x); |
| | | if (x.selectSingleNode(L"root/spec")) |
| | | { |
| | | alert(L"请输入数字!"); |
| | | return 0; |
| | | } |
| | | |
| | | ] |
| | | ] |
| | | ] |
| | | } |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&ExpressMaint::OnXCommand); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&ExpressMaint::OnSetFocus); |
| | | AttachEvent(L"dw_base", L"DWV_ITEMCHANGED", (FEvent)&ExpressMaint::OnCellChanged); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"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: |
| | | [ |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | 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() |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) FCL : public xframe |
| | | { |
| | | public: |
| | | xcombobox ddlb_1; |
| | | int changeddlb; |
| | | xdwgrid dw_list; |
| | | int m_PageSize; //每页显示数量 |
| | | int m_PageIndex; //第几页 |
| | | xstring m_QueryTxt; //查询条件 |
| | | xdwtable dw_base; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | xstring m_config; |
| | | xstring m_spec; |
| | | public: |
| | | FCL(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static FCL* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | FCL* pWin = new FCL(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | 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() |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | xdwpages zz = new xdwpages; |
| | | zz.setNativePointer(GetControl(L"pages")); |
| | | xml x; |
| | | |
| | | getUrl(L"/sale/data/FCL/entity/list", arg.GetString(), x); |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (e.selectSingleNode(L"@TotalPage")) |
| | | { |
| | | xstring s = e.selectSingleNode(L"@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, L""); |
| | | //dw_base.SetItemDisplayString(1,i,L""); |
| | | } |
| | | dw_base.ResetUpdateStatus(); |
| | | dw_base.Redraw(); |
| | | return 1; |
| | | } |
| | | int SetCellEdit(int row, xstring name, xstring value, xstring display) |
| | | { |
| | | dw_base.SetItemString(row, name, value); |
| | | dw_base.Redraw(); |
| | | if (display != L"") |
| | | { |
| | | 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(); |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | var list = e.selectNodes(L"*"); |
| | | if (list) |
| | | { |
| | | int s = list.length; |
| | | int i; |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | 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")) |
| | | xml x; |
| | | ; |
| | | KXMLDOMElement xitem = list.item(i); |
| | | x.loadXML(xitem.xml()); |
| | | //trace(xitem.xml); |
| | | KXMLDOMElement e1 = x.documentElement(); |
| | | xstring name = e1.tagName(); |
| | | trace(name); |
| | | trace(e1.text()); |
| | | xstring display; |
| | | if (e1.selectSingleNode(L"@_displaystring")) |
| | | { |
| | | string s=e.selectSingleNode("@TotalPage").text; //总数量 |
| | | zz.SetMaxPage(s.toInt()); |
| | | display = e1.selectSingleNode(L"@_displaystring").text(); |
| | | SetCellEdit(1, name, e1.text(), L"" + display); |
| | | } |
| | | 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()); |
| | | } |
| | | else |
| | | SetCellEdit(1, name, e1.text(), L""); |
| | | |
| | | 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) |
| | | } |
| | | return 1; |
| | | } |
| | | int OnRowClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | OnSetCTGValue(row); |
| | | return 1; |
| | | } |
| | | int setMaint() |
| | | { |
| | | xml x; |
| | | |
| | | dw_base.DwUpdateAllTo(x); |
| | | int row = dw_list.GetRow(); |
| | | dw_list.SetItemString(row, L"PriceInfo", x.xml()); |
| | | return 1; |
| | | } |
| | | int SetTotalAmount(int row, xstring name) |
| | | { |
| | | if (name == L"price20base" || name == L"price20BAF" || name == L"price20CAF" || name == L"price20add" || name == L"price20comm" || name == L"price20other") |
| | | { |
| | | double price20base = dw_base.GetItemString(row, L"price20base").toDouble(); |
| | | double price20BAF = dw_base.GetItemString(row, L"price20BAF").toDouble(); |
| | | double price20CAF = dw_base.GetItemString(row, L"price20CAF").toDouble(); |
| | | double price20add = dw_base.GetItemString(row, L"price20add").toDouble(); |
| | | double price20comm = dw_base.GetItemString(row, L"price20comm").toDouble(); |
| | | double price20other = dw_base.GetItemString(row, L"price20other").toDouble(); |
| | | double price20 = price20base + price20BAF + (price20CAF / 100) * price20base + price20add - (price20comm / 100) * price20base + price20other; |
| | | dw_base.SetItemString(1, L"price20", xstring(price20)); |
| | | } |
| | | |
| | | if (name == L"price40base" || name == L"price40BAF" || name == L"price40CAF" || name == L"price40add" || name == L"price40comm" || name == L"price40other") |
| | | { |
| | | double price40base = dw_base.GetItemString(row, L"price40base").toDouble(); |
| | | double price40BAF = dw_base.GetItemString(row, L"price40BAF").toDouble(); |
| | | double price40CAF = dw_base.GetItemString(row, L"price40CAF").toDouble(); |
| | | double price40add = dw_base.GetItemString(row, L"price40add").toDouble(); |
| | | double price40comm = dw_base.GetItemString(row, L"price40comm").toDouble(); |
| | | double price40other = dw_base.GetItemString(row, L"price40other").toDouble(); |
| | | double price40 = price40base + price40BAF + (price40CAF / 100) * price40base + price40add - (price40comm / 100) * price40base + price40other; |
| | | dw_base.SetItemString(1, L"price40", xstring(price40)); |
| | | } |
| | | |
| | | if (name == L"price40Hbase" || name == L"price40HBAF" || name == L"price40HCAF" || name == L"price40Hadd" || name == L"price40Hcomm" || name == L"price40Hother") |
| | | { |
| | | double price40Hbase = dw_base.GetItemString(row, L"price40Hbase").toDouble(); |
| | | double price40HBAF = dw_base.GetItemString(row, L"price40HBAF").toDouble(); |
| | | double price40HCAF = dw_base.GetItemString(row, L"price40HCAF").toDouble(); |
| | | double price40Hadd = dw_base.GetItemString(row, L"price40Hadd").toDouble(); |
| | | double price40Hcomm = dw_base.GetItemString(row, L"price40Hcomm").toDouble(); |
| | | double price40Hother = dw_base.GetItemString(row, L"price40Hother").toDouble(); |
| | | double price40H = price40Hbase + price40HBAF + (price40HCAF / 100) * price40Hbase + price40Hadd - (price40Hcomm / 100) * price40Hbase + price40Hother; |
| | | dw_base.SetItemString(1, L"price40h", xstring(price40H)); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnPriceBaseChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | trace(L"123"); |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring name = hdr.colname; |
| | | xstring value = hdr.data; |
| | | SetTotalAmount(1, name); |
| | | xstring price20 = dw_base.GetItemString(1, L"price20"); |
| | | xstring price40 = dw_base.GetItemString(1, L"price40"); |
| | | xstring price40h = dw_base.GetItemString(1, L"price40h"); |
| | | dw_list.SetItemString(dw_list.GetRow(), L"price20", price20); |
| | | dw_list.SetItemString(dw_list.GetRow(), L"price40", price40); |
| | | dw_list.SetItemString(dw_list.GetRow(), L"price40h", price40h); |
| | | dw_list.Redraw(); |
| | | setMaint(); |
| | | return 1; |
| | | } |
| | | int OnListChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | xstring colname = hdr.colname; |
| | | xstring value = hdr.data; |
| | | if (colname == L"port") |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"code", value); |
| | | if (getUrl(L"/sale/data/FCL/pref/shipthread", arg.GetString(), x) != 1) |
| | | { |
| | | 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(); |
| | | } |
| | | trace(x.xml()); |
| | | } |
| | | KXMLDOMElement e = x.documentElement(); |
| | | dw_list.SetItemString(row, L"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; |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| | | return 1; |
| | | } |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR& h = *(PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h.cur; |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | m_pageIndex = c; |
| | | OnRetrieve(); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | int onSave() |
| | | { |
| | | xml x; |
| | | |
| | | dw_list.DwUpdateAllToEx(x); |
| | | trace(x.xml()); |
| | | } |
| | | 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, L"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, L"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(xstring comdid) |
| | | { |
| | | if (comdid.find(L"add", 0) >= 0) |
| | | OnAddrow(); |
| | | else if (comdid.find(L"insert", 0) >= 0) |
| | | OnInsertRow(); |
| | | else if (comdid.find(L"del", 0) >= 0) |
| | | OnDeleteRow(); |
| | | else if (comdid.find(L"save", 0) >= 0) |
| | | onSave(); |
| | | return 1; |
| | | } |
| | | int OnSetFocus(TEvent* evt, LPARAM p) { |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | int OnItemError(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring value = hdr.data; |
| | | int e = hdr.idFrom; |
| | | if (e == -1000) |
| | | alert(L"【" + value + L"】不是有效的数字!"); |
| | | if (e == -1001) |
| | | alert(L"【" + value + L"】不是有效的数字!"); |
| | | if (e == -1002) |
| | | alert(L"【" + value + L"】不是有效的日期!"); |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&FCL::OnXCommand); |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&FCL::OnRowClicked); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&FCL::OnSetFocus); |
| | | AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&FCL::OnChangePages); |
| | | AttachEvent(L"dw_base", L"DWV_ITEMCHANGED", (FEvent)&FCL::OnPriceBaseChanged); |
| | | AttachEvent(L"dw_base", L"DWV_ITEMERROR", (FEvent)&FCL::OnItemError); |
| | | AttachEvent(L"dw_list", L"DWV_ITEMCHANGED", (FEvent)&FCL::OnListChanged); |
| | | return 1; |
| | | |
| | | } |
| | | int OnInit() |
| | | { |
| | | dw_list = new xdwgrid; |
| | | dw_list.setNativePointer(GetControl(L"dw_list")); |
| | | dw_list.openUrl(L"/sale/view/FCL/template/FCL/List"); |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | dw_base.openUrl(L"/sale/view/FCL/template/FCL/pricebase"); |
| | | dw_list.SetReadOnlyColumn(L"shipthread", true); |
| | | dw_list.SetReadOnlyColumn(L"price20", true); |
| | | dw_list.SetReadOnlyColumn(L"price40", true); |
| | | dw_list.SetReadOnlyColumn(L"price40h", true); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | m_PageSize = 30; //每页显示数量 |
| | | m_PageIndex = 1; //第几页 |
| | | m_QueryTxt = L""; //查询条件 |
| | | OnInit(); |
| | | OnAttachEvent(); |
| | | OnRetrieve(); |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | use "system.vl" |
| | | use "win.vl" |
| | | use "list.vl" |
| | | use "treeview.vm" |
| | | use "dev:vm[gridpages.vm]" |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) ForwarderList : public xwin |
| | | { |
| | | |
| | | |
| | | 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) |
| | | { |
| | | public: |
| | | //xdwpages dw_pages; |
| | | xstring m_QueryTxt; |
| | | KXMLDOMDocument m_configDoc; |
| | | xtreeview tv_1; |
| | | xstring sType; |
| | | static int dw_hWnd; |
| | | int m_pageIndex; |
| | | int m_pageNumber; |
| | | public: |
| | | ForwarderList(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static ForwarderList* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | ForwarderList* pWin = new ForwarderList(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | |
| | | |
| | | 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) |
| | | int SetEntityData(xaserverarg arg) |
| | | { |
| | | |
| | | arg.AddArg(L"sType", sType); |
| | | xml x; |
| | | |
| | | getUrl(L"/sale/data/LogisticsCode/entity/list", arg.GetString(), x); |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (e) |
| | | { |
| | | if (list::dw_pages.nativept && e.selectSingleNode(L"@TotalPage")) |
| | | { |
| | | 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; |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | list::dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | 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); |
| | | } |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | return 1; |
| | | } |
| | | |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | |
| | | ] |
| | | ] |
| | | ] |
| | | |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"pageindex", xstring(m_pageIndex)); //第几页 |
| | | arg.AddArg(L"pagenumber", xstring(m_pageNumber)); //每页数量 |
| | | //trace(list::m_QueryTxt); |
| | | arg.AddArg(L"QueryTxt", list::m_QueryTxt); //每页数量 |
| | | return SetEntityData(arg); |
| | | } |
| | | int OnTreeSelChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM hItem = nmtv.itemNew.hItem; |
| | | list::m_QueryTxt = L""; |
| | | |
| | | HTREEITEM hitem = tv_1.GetSelectedItem(); |
| | | //c_type=dw_type.GetItemLabel(hitem); |
| | | //如果是跟节点 |
| | | HTREEITEM roothitem = tv_1.GetRootItem(); |
| | | KXMLDOMElement e = tv_1.GetItemData(hitem); |
| | | xstring value = e.selectSingleNode(L"@data").text(); |
| | | sType = value + L""; |
| | | OnRetrieve(); |
| | | return 1; |
| | | } |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR& h = *(PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h.cur; |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | m_pageIndex = c; |
| | | OnRetrieve(); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int ViewUpdate(param pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"del") |
| | | { |
| | | int DelRow = dw_list.GetRow(); |
| | | dw_list.DeleteRow(DelRow); |
| | | |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&ForwarderList::OnTreeSelChanged); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | list::m_QueryTxt = L""; |
| | | m_pageIndex = 1; |
| | | m_pageNumber = 30; |
| | | sType = L"0"; |
| | | list::onload(); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | |
| | | |
| | | tv_1 = new treeview; |
| | | tv_1.setNativePointer(GetControl(L"tv_1")); |
| | | |
| | | HTREEITEM root = tv_1.GetRootItem(); |
| | | tv_1.ExpandItem(root); |
| | | dw_list.SetColumnStaus(L"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; |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | xdwtable__ dw_base; |
| | | string m_userid; |
| | | string m_username; |
| | | string ContactID; |
| | | xcell__ dw_cell; |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | int alert(string str) |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) ForwarderMaint : public xframe |
| | | { |
| | | public: |
| | | KXMLDOMDocument m_configDoc; |
| | | |
| | | xdwtable dw_base; |
| | | xstring m_userid; |
| | | xstring m_username; |
| | | xstring ContactID; |
| | | xcell dw_cell; |
| | | |
| | | public: |
| | | ForwarderMaint(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static ForwarderMaint* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | ForwarderMaint* pWin = new ForwarderMaint(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int alert(xstring str) |
| | | { |
| | | //win::MessageBox(GetHWND(),str,L"提示22:",0); |
| | | TApp::alert(this, str); |
| | | return 0; |
| | | } |
| | | int setCellReadOnly() |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | dw_cell = new xcell; |
| | | dw_cell.setNativePointer(dw_base.QueryItem(L"ixcell")); |
| | | xstring strnew = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''/>"; |
| | | //dw_cell.SetCellProps(2,2,strnew); |
| | | return 0; |
| | | } |
| | | |
| | | xstring GetGuid() { |
| | | return TApp::GetGuid(); |
| | | } |
| | | int OnClear() { |
| | | if (m_EntityID == L"") { |
| | | trace(1); |
| | | m_userid = TApp::GetUserInfo().id; |
| | | m_username = TApp::GetUserInfo().name; |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | dw_base.SetItemString(1, L"ForwarderID", GetGuid()); |
| | | dw_base.SetItemString(1, L"PartyID", GetGuid()); |
| | | dw_base.SetItemString(1, L"PStatus", L"1"); |
| | | dw_base.SetItemDisplayString(1, L"PStatus", L"普通"); |
| | | dw_base.SetItemString(1, L"CreatorID", m_userid); |
| | | dw_base.SetItemString(1, L"PADStatus", L"1"); |
| | | dw_base.SetItemString(1, L"AddressID", GetGuid()); |
| | | dw_base.SetItemString(1, L"PADIdentifyAddressFlag", L"Y"); |
| | | dw_base.SetItemString(1, L"PADPrimaryFlag", L"Y"); |
| | | //dw_base.SetItemString(1,L"BankAccountID",GetGuid()); |
| | | dw_base.SetItemString(1, L"Type", L"5"); |
| | | dw_base.SetItemString(1, L"EnterName", m_userid); |
| | | dw_base.SetItemDisplayString(1, L"EnterName", m_username); |
| | | dw_base.SetItemString(1, L"CreateDate", TApp::GetCurDate()); |
| | | /*xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | xdwtable dwcon = new xdwtable; |
| | | dwcon.setNativePointer(dw.FindDwTable(L"Contacters",0)); |
| | | dwcon.SetItemString(1,L"ContactID",GetGuid()); |
| | | dwcon.SetItemString(1,L"PCStatus",L"1");*/ |
| | | //dw_base.SetItemString(1,L"EBankAccountID",GetGuid()); |
| | | //dw_base.SetItemString(1,L"CBankAccountID",GetGuid()); |
| | | /*xdwtable dweon = new xdwtable; |
| | | dweon.setNativePointer(dw_base.FindDwTable(L"item1",0)); |
| | | xdwtable dwcon = new xdwtable; |
| | | dwcon.setNativePointer(dw_base.FindDwTable(L"item2",0)); |
| | | dweon.SetItemString(1,L"EPBAStatus",L"Y"); |
| | | dwcon.SetItemString(1,L"CPBAStatus",L"Y"); |
| | | dweon.SetItemString(1,L"ECurrencyCode",L"USD"); |
| | | dwcon.SetItemString(1,L"CCurrencyCode",L"RMB");*/ |
| | | dw_base.SetItemString(1, L"ForwarderType", L"1"); |
| | | dw_base.SetItemDisplayString(1, L"ForwarderType", L"预付货"); |
| | | //dw_base.SetItemString(1,L"PrimaryContactID",dwcon.GetItemString(1,L"ContactID")); |
| | | |
| | | } |
| | | else |
| | | { |
| | | setCellReadOnly(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnAddrow() |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"item") |
| | | { |
| | | dw.InsertRow(0); |
| | | int rows = dw.GetRowCount(); |
| | | dw.SetRow(rows); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnInsertRow() |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"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(GetControl(L"dw_base")); |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"item") |
| | | { |
| | | int row = dw.GetRow(); |
| | | if (row < 1) return 0; |
| | | /*xstring del = dw.GetItemString(row,8); |
| | | if(del!=L"") |
| | | { |
| | | //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")); |
| | | |
| | | if(m_dels==L"") |
| | | { |
| | | m_dels=del; |
| | | } |
| | | else |
| | | { |
| | | setCellReadOnly(); |
| | | } |
| | | return 0; |
| | | } |
| | | xstring temp=m_dels; |
| | | m_dels=del + L"|" + temp; |
| | | //+= L"|"+del; |
| | | } |
| | | |
| | | 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; |
| | | } |
| | | }*/ |
| | | dw.DeleteRow(row); |
| | | dw.SetRow(row - 1); |
| | | } |
| | | //trace(m_dels); |
| | | return 1; |
| | | } |
| | | xstring getGoodsNo() |
| | | { |
| | | xml x; |
| | | |
| | | 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; |
| | | } |
| | | xaserverarg arg; |
| | | |
| | | }*/ |
| | | dw.DeleteRow(row); |
| | | dw.SetRow(row - 1); |
| | | } |
| | | //trace(m_dels); |
| | | return 1; |
| | | } |
| | | string getGoodsNo() |
| | | if (getUrl(L"/sale/data/LogisticsCode/pref/PartyNo", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.xml()); |
| | | return L""; |
| | | } |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (e) |
| | | { |
| | | xstring code = e.text(); |
| | | trace(code); |
| | | return L"F" + code; |
| | | } |
| | | return L"F1000"; |
| | | } |
| | | int OnPreSave() |
| | | { |
| | | dw_base.AcceptText(); |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | xstring ForwarderNo = dw_base.GetItemString(1, L"ForwarderNo"); |
| | | if (ForwarderNo == L"") |
| | | { |
| | | dw_base.SetItemString(1, L"ForwarderNo", getGoodsNo()); |
| | | } |
| | | xdwtable dwcon = new xdwtable; |
| | | dwcon.setNativePointer(dw_base.FindDwTable(L"item", 0)); |
| | | int i; |
| | | for (i = 1; i <= dwcon.GetRowCount(); i++) |
| | | { |
| | | xstring aTemp; |
| | | xstring aName = dwcon.GetItemString(i, L"ContacterName"); |
| | | trace(aName); |
| | | if (aName == L"") |
| | | { |
| | | 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) |
| | | aTemp = dwcon.GetItemString(i, L"Mobile") + dwcon.GetItemString(i, L"TEL") + dwcon.GetItemString(i, L"Fax") + dwcon.GetItemString(i, L"Email") + dwcon.GetItemString(i, L"PCRemark") + dwcon.GetItemString(i, L"fz"); |
| | | trace(aTemp); |
| | | if (aTemp != L"") |
| | | { |
| | | 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("请输入货代名称!"); |
| | | alert(L"联系人名称必填!"); |
| | | 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) |
| | | } |
| | | else { |
| | | xstring ContactID = dwcon.GetItemString(i, L"ContactID"); |
| | | if (ContactID == L"") |
| | | { |
| | | 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(); |
| | | dwcon.SetItemString(i, L"ContactID", GetGuid()); |
| | | dwcon.SetItemString(i, L"PCStatus", L"Y"); |
| | | dw_base.SetItemString(1, L"PrimaryContactID", dwcon.GetItemString(1, L"ContactID")); |
| | | } |
| | | dw_base.Redraw(); |
| | | //m_dels=""; |
| | | return 0; |
| | | } |
| | | int OnCmdDispatch(string comdid) |
| | | } |
| | | } |
| | | xdwtable dwcon2 = new xdwtable; |
| | | dwcon2.setNativePointer(dw_base.FindDwTable(L"item2", 0)); |
| | | int k; |
| | | xstring sPBABankName2 = L""; |
| | | xstring sPBABankAccountNo2 = L""; |
| | | for (k = 1; k <= dwcon2.GetRowCount(); k++) |
| | | { |
| | | sPBABankName2 = dwcon2.GetItemString(k, L"CBank"); |
| | | sPBABankAccountNo2 = dwcon2.GetItemString(k, L"CBankNo"); |
| | | |
| | | xstring sPBAAll2 = sPBABankName2 + sPBABankAccountNo2; |
| | | |
| | | if (sPBAAll2 != L"") |
| | | { |
| | | if(comdid.find("action:bill.row.add",0)>=0) { |
| | | OnAddrow(); |
| | | if (sPBABankName2 == L"") |
| | | { |
| | | alert(L"人民币银行名称不能为空"); |
| | | return -1; |
| | | } |
| | | else if(comdid.find("bill.row.insert",0)>=0) { |
| | | OnInsertRow(); |
| | | if (sPBABankAccountNo2 == L"") |
| | | { |
| | | alert(L"人民币银行账户不能为空"); |
| | | return -1; |
| | | } |
| | | else if(comdid.find("bill.row.delete",0)>=0) { |
| | | OnDeleteRow(); |
| | | dwcon2.SetItemString(k, L"CPBAStatus", L"Y"); |
| | | dwcon2.SetItemString(k, L"CCurrencyCode", L"RMB"); |
| | | dwcon2.SetItemString(k, L"CBankAccountID", GetGuid()); |
| | | |
| | | if (dwcon2.GetItemString(k, L"CBankAccountID") != L"" && m_EntityID == L"") |
| | | { |
| | | dw_base.SetItemString(1, L"CBkAccountID", dwcon2.GetItemString(k, L"CBankAccountID")); |
| | | } |
| | | else if(comdid.find("bill.save",0)>=0) { |
| | | trace(1); |
| | | OnSave(); |
| | | } |
| | | } |
| | | } |
| | | xdwtable dwcon1 = new xdwtable; |
| | | dwcon1.setNativePointer(dw_base.FindDwTable(L"item1", 0)); |
| | | int j; |
| | | xstring sPBABankName1 = L""; |
| | | xstring sPBABankAccountNo1 = L""; |
| | | for (j = 1; j <= dwcon1.GetRowCount(); j++) |
| | | { |
| | | xstring sPBABankName1 = dwcon1.GetItemString(j, L"EBank"); |
| | | xstring sPBABankAccountNo1 = dwcon1.GetItemString(j, L"EBankNo"); |
| | | |
| | | xstring sPBAAll1 = sPBABankName1 + sPBABankAccountNo1; |
| | | if (sPBAAll1 != L"") |
| | | { |
| | | if (sPBABankName1 == L"") |
| | | { |
| | | alert(L"美金银行名称不能为空"); |
| | | return -1; |
| | | } |
| | | if (sPBABankAccountNo1 == L"") |
| | | { |
| | | alert(L"美金银行账户不能为空"); |
| | | return -1; |
| | | } |
| | | dwcon1.SetItemString(j, L"EPBAStatus", L"Y"); |
| | | dwcon1.SetItemString(j, L"ECurrencyCode", L"USD"); |
| | | dwcon1.SetItemString(j, L"EBankAccountID", GetGuid()); |
| | | if (dwcon1.GetItemString(j, L"EBankAccountID") != L"" && m_EntityID == L"") |
| | | { |
| | | dw_base.SetItemString(1, L"EBkAccountID", dwcon1.GetItemString(j, L"EBankAccountID")); |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int OnPostSave() |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | xaserverarg args; |
| | | |
| | | xml x; |
| | | |
| | | dw_base.DwUpdateAllTo(x); |
| | | //trace(x.xml()); |
| | | |
| | | //主联系人 |
| | | xstring spGuid; |
| | | KXMLDOMElement e; |
| | | var list = x.selectNodes(L"//item"); |
| | | int nlen = list.length; |
| | | int i; |
| | | for (i = 0; i < nlen; i++) |
| | | { |
| | | e = list.item(i); |
| | | if (i == 0) spGuid = e.selectSingleNode(L"@guid").text(); |
| | | xstring sP = e.selectSingleNode(L"PPrimaryFlag").text(); |
| | | if (sP == L"Y") |
| | | { |
| | | spGuid = e.selectSingleNode(L"@guid").text(); |
| | | break; |
| | | } |
| | | } |
| | | if (spGuid == L"") |
| | | { |
| | | trace(L"error"); |
| | | return 0; |
| | | } |
| | | args.AddArg(L"contact", spGuid); |
| | | //trace(L"<---->"); |
| | | //trace(spGuid); |
| | | xml x1; |
| | | |
| | | if (getUrl(L"/sale/data/SupplierSubmit/pref/primarycontact", args.GetString(), x) != 1) |
| | | { |
| | | xstring error = x1.text(); |
| | | trace(error); |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | return 1; |
| | | } |
| | | int OnSave() |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | xstring SName = dw_base.GetItemString(1, L"Name"); |
| | | if (SName == L"") { |
| | | alert(L"请输入货代名称!"); |
| | | return -1; |
| | | } |
| | | int rec = OnPreSave(); |
| | | if (rec == -1) return -1; |
| | | xml x; |
| | | |
| | | dw_base.DwUpdateAllTo(x); |
| | | trace(x.xml()); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | arg.AddArg(L"dbmap", L"Forwarder.dbmap"); |
| | | //arg.AddArg(L"m_dels",m_dels); |
| | | if (getUrl(L"/sale/data/LogisticsCode/entity/save", arg.GetString(), x) != 1) |
| | | { |
| | | trace(L"error:" + (xstring)x.xml()); |
| | | alert(L"保存失败!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | trace(x.xml()); |
| | | if (x.selectSingleNode(L"error")) |
| | | { |
| | | alert(L"保存出错2!"); |
| | | return 0; |
| | | } |
| | | alert(L"保存成功!"); |
| | | dw_base.ResetUpdateStatus(); |
| | | OnPostSave(); |
| | | } |
| | | dw_base.Redraw(); |
| | | //m_dels=L""; |
| | | return 0; |
| | | } |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid.find(L"action:bill.row.add", 0) >= 0) { |
| | | OnAddrow(); |
| | | } |
| | | else if (comdid.find(L"bill.row.insert", 0) >= 0) { |
| | | OnInsertRow(); |
| | | } |
| | | else if (comdid.find(L"bill.row.delete", 0) >= 0) { |
| | | OnDeleteRow(); |
| | | } |
| | | else if (comdid.find(L"bill.save", 0) >= 0) { |
| | | //trace(1); |
| | | OnSave(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | int OnCellChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring colname = hdr.colname; |
| | | xstring coldata = hdr.data; |
| | | trace(colname); |
| | | if (colname == L"ForwarderNo") |
| | | { |
| | | xstring cspec = dw_base.GetItemString(1, 1); |
| | | trace(cspec); |
| | | xstring SpecRule = L"^\\d*$"; |
| | | xaserverarg args; |
| | | |
| | | args.AddArg(L"CSpec", cspec); |
| | | args.AddArg(L"SpecRule", SpecRule); |
| | | xml x; |
| | | |
| | | getUrl(L"/sale/data/LogisticsCode/pref/forwarderno/check", args.GetString(), x); |
| | | |
| | | if (x.selectSingleNode(L"root/spec")) |
| | | { |
| | | alert(L"请输入数字!"); |
| | | return 0; |
| | | } |
| | | |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | } |
| | | //只能选一个主联系人 |
| | | else if (colname == L"PPrimaryFlag" && coldata == L"Y") |
| | | { |
| | | xdwtable dw_pc; |
| | | dw_pc = new xdwtable; |
| | | dw_pc.setNativePointer(dw_base.FindDwTable(L"item")); |
| | | if (dw_pc) |
| | | { |
| | | 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") |
| | | int i; |
| | | for (i = 1; i <= dw_pc.GetRowCount(); i++) |
| | | { |
| | | 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; |
| | | } |
| | | |
| | | if (i != hdr.row) |
| | | dw_pc.SetItemString(i, L"PPrimaryFlag", L"N"); |
| | | } |
| | | //只能选一个主联系人 |
| | | 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(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&ForwarderMaint::OnXCommand); |
| | | //AttachEvent(L"WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent(L"dw_base", L"DWV_ITEMCHANGED", (FEvent)&ForwarderMaint::OnCellChanged); |
| | | return 1; |
| | | } |
| | | int onload() |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | |
| | | ] |
| | | ] |
| | | ] |
| | | OnAttachEvent(); |
| | | //if(!m_configDoc) return -1; |
| | | |
| | | maint::onload(); |
| | | |
| | | OnClear(); |
| | | } |
| | | |
| | | }; |
| | |
| | | use "list.vd" |
| | | use "xtreeview.vd" |
| | | use "xwin.vd" |
| | | class PaymentTermlist111 : public list |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) PaymentTermlist111 : public xwin |
| | | { |
| | | //xdwgrid dw_list; |
| | | int OnDBClick(ref TNotifyEvent evt,int p) |
| | | public: |
| | | PaymentTermlist111(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static PaymentTermlist111* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | PaymentTermlist111* pWin = new PaymentTermlist111(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | //xdwgrid dw_list; |
| | | int OnDBClick(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | //alert(row.toString()); |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string id = e.selectSingleNode("TermID").text; |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xstring id = e.selectSingleNode(L"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") |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"EntityID", id); |
| | | //arg.AddArg(L"hwnd", GetHWND().toString()); |
| | | |
| | | openUrl(L"/sale/view/Payment/worknode/Payment/maint", arg); |
| | | if (arg.GetArgString(L"ret") == L"Ok") |
| | | { |
| | | alert("OK"); |
| | | alert(L"OK"); |
| | | list::onloaded(); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnDelete() |
| | | { |
| | | int row = this.dw_list.GetRow(); |
| | | int row = 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); |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring termid = ele.selectSingleNode(L"TermID").text(); |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"termId",termid); |
| | | //alert(termid); |
| | | xml x1 = new xml; |
| | | x1.setNativePointer(x1.CreateInstance()); |
| | | if (url::post("/sale/data/PaymentTerm/entity/delete",arg.GetString(),x1) != 1) |
| | | xml x1 ; |
| | | |
| | | if (xurl::post(L"/sale/data/PaymentTerm/entity/delete",arg.GetString(),x1) != 1) |
| | | { |
| | | string error = x1.GetXmlDoc().text; |
| | | xstring error = x1.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | //error = x1.GetXmlDoc().text; |
| | | //error = x1.text(); |
| | | //alert(error); |
| | | MessageBox(GetHWND(),"删除成功!","提示",0); |
| | | MessageBox(GetHWND(),L"删除成功!",L"提示",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); |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"EntityID", L"new"); |
| | | |
| | | //openUrl(L"/sale/view/Test/worknode/company/maint", arg); |
| | | openUrl(L"/sale/view/Payment/worknode/Payment/maint", arg); |
| | | return 0; |
| | | } |
| | | int OnOpen() |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xaserverarg arg ; |
| | | |
| | | int row = dw_list.GetRow(); |
| | | if (row < 1) |
| | | { |
| | | xwin::MessageBox(GetHWND(),"请选中要修改的行!","提示",0); |
| | | MessageBox(GetHWND(),L"请选中要修改的行!",L"提示",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); |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xstring guid = e.selectSingleNode(L"TermID").text(); |
| | | arg.AddArg(L"EntityID",guid); |
| | | |
| | | openUrl(L"/sale/view/Test2/worknode/company2/maint", arg); |
| | | |
| | | } |
| | | int OnRefresh() |
| | |
| | | return 0; |
| | | } |
| | | //按钮事件 |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring 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(); |
| | | if (comdid == L"action:bill.new") return OnNew(); |
| | | else if(comdid == L"action:bill.open") return OnOpen(); |
| | | else if(comdid == L"Refresh") return OnRefresh(); |
| | | else if(comdid == L"action:bill.delete") return OnDelete(); |
| | | return 0; |
| | | } |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | //命令发布函数 |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&PaymentTermlist111::OnXCommand); |
| | | //AttachEvent(L"WM_SETFOCUS",OnSetFocus); |
| | | |
| | | //AttachEvent("dw_list","DWV_ROWFOCUSCHANGED",OnRowChanged); |
| | | AttachEvent("dw_list","DWV_DOUBLECLICKED",OnDBClick); |
| | | //AttachEvent(L"dw_list",L"DWV_ROWFOCUSCHANGED",OnRowChanged); |
| | | AttachEvent(L"dw_list",L"DWV_DOUBLECLICKED", (FEvent)&PaymentTermlist111::OnDBClick); |
| | | return 1; |
| | | } |
| | | int onload() |
| | |
| | | int onloaded() |
| | | { |
| | | //OnRetrieve(); |
| | | //alert("12"); |
| | | //alert(L"12"); |
| | | list::onloaded(); |
| | | |
| | | |
| | |
| | | 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 |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) PaymentTermEdit : public xframe |
| | | { |
| | | public: |
| | | xdwtable dw_base; |
| | | xdwtable dw_p; |
| | | xcell dw_cell; |
| | | string sCryno; |
| | | xstring sCryno; |
| | | public: |
| | | PaymentTermEdit(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static PaymentTermEdit* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | PaymentTermEdit* pWin = new PaymentTermEdit(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnAddrow() |
| | | { |
| | | dw_p = dw_base.FindDwTable("line"); |
| | | dw_p = dw_base.FindDwTable(L"line"); |
| | | int i; |
| | | double dDueAmount = 0; |
| | | double dPercnet = 100; |
| | | for (i = 1 ; i <= dw_p.GetRowCount();i++) |
| | | { |
| | | dDueAmount = dw_p.GetItemDouble(i,"DueAmount"); |
| | | dDueAmount = dw_p.GetItemDouble(i,L"DueAmount"); |
| | | if (dDueAmount > 0) |
| | | break; |
| | | dPercnet = dPercnet - dw_p.GetItemDouble(i,"DuePercent"); |
| | | dPercnet = dPercnet - dw_p.GetItemDouble(i,L"DuePercent"); |
| | | } |
| | | int irow = dw_p.InsertRow(0); |
| | | dw_p.SetItemString(irow,"SeqNo",irow.toString()); |
| | | dw_p.SetItemString(irow,L"SeqNo",xstring(irow)); |
| | | if (dDueAmount <= 0) |
| | | dw_p.SetItemDouble(irow,"DuePercent",dPercnet); |
| | | dw_p.SetItemDouble(irow,L"DuePercent",dPercnet); |
| | | |
| | | return 1; |
| | | } |
| | | int OnDeleterow() |
| | | { |
| | | dw_p = dw_base.FindDwTable("line"); |
| | | dw_p = dw_base.FindDwTable(L"line"); |
| | | int row2 = dw_p.GetRow(); |
| | | if (row2 < 1) return 0; |
| | | dw_p.DeleteRow(row2); |
| | | |
| | | return 1; |
| | | } |
| | | string OnCreateTxt() |
| | | xstring OnCreateTxt() |
| | | { |
| | | //dw_1.AcceptText(); //不能加会报错 |
| | | int irow; |
| | | //int icnt = dw_1.GetRowCount(); |
| | | dw_p = dw_base.FindDwTable("line"); |
| | | dw_p = dw_base.FindDwTable(L"line"); |
| | | int icnt = dw_p.GetRowCount(); |
| | | if (icnt < 1) return ""; |
| | | string sTxt; |
| | | if (icnt < 1) return L""; |
| | | xstring 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"); //金额 |
| | | xstring sPaymentMethod = dw_p.GetItemString(irow,L"PaymentMethod"); //支付方式 |
| | | //xstring sDueDays = dw_p.GetItemDisplayString(irow,L"DueDays"); |
| | | xstring sDueDays = dw_p.GetItemString(irow,L"DueDays"); //期限 |
| | | xstring sDuePercent = dw_p.GetItemString(irow,L"DuePercent"); //比例 |
| | | xstring sDueAmount = dw_p.GetItemString(irow,L"DueAmount"); //金额 |
| | | |
| | | if (!sPaymentMethod || sPaymentMethod == "") |
| | | sTxt = sTxt + ""; |
| | | if (!sDueDays || sDueDays == "") |
| | | sTxt = sTxt + ""; |
| | | if (!sPaymentMethod || sPaymentMethod == L"") |
| | | sTxt = sTxt + L""; |
| | | if (!sDueDays || sDueDays == L"") |
| | | sTxt = sTxt + L""; |
| | | else |
| | | { |
| | | if (sDueDays == "-1") sDueDays = " IN ADVANCE"; |
| | | else if (sDueDays == "0") sDueDays = " AT SIGHT"; |
| | | if (sDueDays == L"-1") sDueDays = L" IN ADVANCE"; |
| | | else if (sDueDays == L"0") sDueDays = L" AT SIGHT"; |
| | | else |
| | | { |
| | | if (sPaymentMethod == "T/T") |
| | | sDueDays = " WITHIN "+sDueDays + " DAYS AFTER SHIPMENT"; |
| | | if (sPaymentMethod == L"T/T") |
| | | sDueDays = L" WITHIN "+sDueDays + L" DAYS AFTER SHIPMENT"; |
| | | else |
| | | sDueDays = " AT "+sDueDays + " DAYS"; |
| | | sDueDays = L" AT "+sDueDays + L" DAYS"; |
| | | } |
| | | |
| | | if (!sDuePercent || sDuePercent == "") |
| | | if (!sDuePercent || sDuePercent == L"") |
| | | { |
| | | if (!sDueAmount || sDueAmount == "") |
| | | sTxt = sTxt + ""; |
| | | if (!sDueAmount || sDueAmount == L"") |
| | | sTxt = sTxt + L""; |
| | | else |
| | | { |
| | | |
| | | sTxt = sTxt + sCryno + " " + sDueAmount + " " + sPaymentMethod + sDueDays + ";"; |
| | | sTxt = sTxt + sCryno + L" " + sDueAmount + L" " + sPaymentMethod + sDueDays + L";"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (sDuePercent.find(".",0) >= 0) |
| | | if (sDuePercent.find(L".",0) >= 0) |
| | | { |
| | | while (sDuePercent.right(1) == "0") |
| | | while (sDuePercent.right(1) == L"0") |
| | | { |
| | | sDuePercent = sDuePercent.left(sDuePercent.length() - 1); |
| | | } |
| | | if (sDuePercent.right(1) == ".") |
| | | if (sDuePercent.right(1) == L".") |
| | | sDuePercent = sDuePercent.left(sDuePercent.length() - 1); |
| | | } |
| | | |
| | | sTxt = sTxt + sDuePercent + "% " + sPaymentMethod+ sDueDays + ";"; |
| | | sTxt = sTxt + sDuePercent + L"% " + sPaymentMethod+ sDueDays + L";"; |
| | | } |
| | | } |
| | | } |
| | | |
| | | sTxt = sTxt.mid(0,sTxt.length() - 1); |
| | | if (sTxt != "") |
| | | sTxt = sTxt + "."; |
| | | if (sTxt != L"") |
| | | sTxt = sTxt + L"."; |
| | | |
| | | return sTxt; |
| | | } |
| | |
| | | { |
| | | dw_base.AcceptText(); |
| | | //判断是否有必输值为空 |
| | | dw_p = dw_base.FindDwTable("line"); |
| | | dw_p = dw_base.FindDwTable(L"line"); |
| | | double dPercnet = 0; |
| | | double dAmount = 0; |
| | | xstring sChargeAll = L""; |
| | | 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"); |
| | | xstring seqNo = dw_p.GetItemString(i,L"SeqNo"); |
| | | xstring sPaymentMethod = dw_p.GetItemString(i,L"PaymentMethod"); |
| | | xstring sDueDays = dw_p.GetItemString(i,L"DueDays"); |
| | | xstring sDuePercent = dw_p.GetItemString(i,L"DuePercent"); |
| | | dPercnet = dPercnet + sDuePercent.toDouble(); |
| | | string sDueAmount = dw_p.GetItemString(i,"DueAmount"); |
| | | xstring sDueAmount = dw_p.GetItemString(i,L"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 (!seqNo) seqNo = L""; |
| | | if (!sPaymentMethod) sPaymentMethod = L""; |
| | | if (!sDueDays) sDueDays = L""; |
| | | if (!sDuePercent) sDuePercent = L""; |
| | | if (!sDueAmount) sDueAmount = L""; |
| | | dw_p.SetItemString(i,L"SeqNo",xstring(i)); |
| | | sChargeAll = sPaymentMethod + sDueDays + sDuePercent + sDueAmount; |
| | | if (sChargeAll != L"") |
| | | { |
| | | if (sPaymentMethod == "") |
| | | if (sPaymentMethod == L"") |
| | | { |
| | | alert("支付方式不能为空!"); |
| | | alert(L"支付方式不能为空!"); |
| | | return 0; |
| | | } |
| | | if (sDueDays == "") |
| | | if (sDueDays == L"") |
| | | { |
| | | alert("期限不能为空!"); |
| | | alert(L"期限不能为空!"); |
| | | return 0; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | //百分比校验 |
| | | if (dw_p.GetRowCount() <= 1 && sChargeAll == "") |
| | | if (dw_p.GetRowCount() <= 1 && sChargeAll == L"") |
| | | {} |
| | | else |
| | | { |
| | |
| | | { |
| | | if (dAmount <= 0) |
| | | { |
| | | alert("比率不等于100!"); |
| | | alert(L"比率不等于100!"); |
| | | return 0; |
| | | } |
| | | } |
| | | } |
| | | |
| | | string sTxt = OnCreateTxt(); |
| | | dw_base.SetItemString(1,"PaymentTermEx",sTxt); |
| | | xstring sTxt = OnCreateTxt(); |
| | | dw_base.SetItemString(1,L"PaymentTermEx",sTxt); |
| | | |
| | | //CloseWindow(); |
| | | return 1; |
| | | } |
| | | int OnItemChanged(ref TNotifyEvent evt,int p) |
| | | int OnItemChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | string colname=hdr.colname; |
| | | string value = hdr.data; |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring colname=hdr.colname; |
| | | xstring value = hdr.data; |
| | | int row = hdr.row; |
| | | |
| | | if (colname == "DueDays") |
| | | if (colname == L"DueDays") |
| | | { |
| | | xdwtable dw; |
| | | dw = dw_base.FindDwTable("line"); |
| | | dw = dw_base.FindDwTable(L"line"); |
| | | |
| | | if (dw) |
| | | { |
| | | string sPaymentMethod = dw.GetItemString(row,"PaymentMethod"); |
| | | if (value == "0") |
| | | xstring sPaymentMethod = dw.GetItemString(row,L"PaymentMethod"); |
| | | if (value == L"0") |
| | | { |
| | | if (sPaymentMethod == "T/T") |
| | | if (sPaymentMethod == L"T/T") |
| | | { |
| | | //alert("此支付方式期限不能为 0 (AT SIGHT)"); |
| | | //alert(L"此支付方式期限不能为 0 (AT SIGHT)"); |
| | | //return -1; |
| | | } |
| | | } |
| | | else if (value == "-1") |
| | | else if (value == L"-1") |
| | | { |
| | | if (sPaymentMethod != "T/T") |
| | | if (sPaymentMethod != L"T/T") |
| | | { |
| | | alert("此支付方式期限不能为 -1(IN ADVANCE)"); |
| | | alert(L"此支付方式期限不能为 -1(IN ADVANCE)"); |
| | | return -1; |
| | | } |
| | | } |
| | |
| | | |
| | | } |
| | | //生成支付条款文本 |
| | | if (colname == "PaymentMethod" || colname == "DueDays" || colname == "DuePercent" || colname == "DueAmount") |
| | | if (colname == L"PaymentMethod" || colname == L"DueDays" || colname == L"DuePercent" || colname == L"DueAmount") |
| | | { |
| | | string sTxt = OnCreateTxt(); |
| | | xstring sTxt = OnCreateTxt(); |
| | | |
| | | dw_base.SetItemString(1,"Description",sTxt); |
| | | dw_base.SetItemString(1,L"Description",sTxt); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int OnClick(ref TNotifyEvent evt,int p) |
| | | int OnClick(TEvent* evt, LPARAM p) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | string value = hdr.data; |
| | | string colname = hdr.colname; |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring value = hdr.data; |
| | | xstring colname = hdr.colname; |
| | | int row = hdr.row; |
| | | xaserverarg arg=new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xaserverarg arg; |
| | | |
| | | //alert(row.toString()); |
| | | xdwtable dw; |
| | | dw = dw_base.FindDwTable("line"); |
| | | dw = dw_base.FindDwTable(L"line"); |
| | | //alert(colname); |
| | | if (dw) |
| | | { |
| | | if (colname == "DuePercent") |
| | | if (colname == L"DuePercent") |
| | | { |
| | | int i; |
| | | int icnt = dw.GetRowCount(); |
| | |
| | | double dDueAmount = 0; |
| | | for (i = 1 ; i <= icnt ; i++) |
| | | { |
| | | dDueAmount = dw.GetItemDouble(i,"DueAmount"); |
| | | dDueAmount = dw.GetItemDouble(i,L"DueAmount"); |
| | | if (dDueAmount > 0) |
| | | break; |
| | | } |
| | | dw_cell.setNativePointer(dw_base.QueryItem("ixcell")); |
| | | dw_cell.setNativePointer(dw_base.QueryItem(L"ixcell")); |
| | | if (dDueAmount > 0) |
| | | { |
| | | dw.SetColumnProp("DuePercent","cellprotect","保护");//保护中文规格 |
| | | dw.SetColumnProp(L"DuePercent",L"cellprotect",L"保护");//保护中文规格 |
| | | } |
| | | else |
| | | { |
| | | dw.SetColumnProp("DuePercent","cellprotect","不保护");//保护中文规格 |
| | | dw.SetColumnProp(L"DuePercent",L"cellprotect",L"不保护");//保护中文规格 |
| | | } |
| | | |
| | | } |
| | | |
| | | if (colname == "DueAmount") |
| | | if (colname == L"DueAmount") |
| | | { |
| | | int j; |
| | | int jcnt = dw.GetRowCount(); |
| | |
| | | double dDuePercent = 0; |
| | | for (j = 1 ; j <= jcnt ; j++) |
| | | { |
| | | dDuePercent = dw.GetItemDouble(j,"DuePercent"); |
| | | dDuePercent = dw.GetItemDouble(j,L"DuePercent"); |
| | | if (dDuePercent > 0) |
| | | break; |
| | | } |
| | | if (dDuePercent > 0) |
| | | { |
| | | dw.SetColumnProp("DueAmount","cellprotect","保护");//保护中文规格 |
| | | dw.SetColumnProp(L"DueAmount",L"cellprotect",L"保护");//保护中文规格 |
| | | } |
| | | else |
| | | { |
| | | dw.SetColumnProp("DueAmount","cellprotect","不保护");//保护中文规格 |
| | | dw.SetColumnProp(L"DueAmount",L"cellprotect",L"不保护");//保护中文规格 |
| | | } |
| | | } |
| | | |
| | |
| | | int OnSave() |
| | | { |
| | | if(OnOk()<1)return 0; |
| | | dw_base = GetControl("dw_base"); |
| | | dw_base = GetControl(L"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"); |
| | | xml x ; |
| | | xaserverarg arg ; |
| | | |
| | | dw_base.DwUpdateAllTo(x); |
| | | //dw_bank.DwUpdateAllTo(x); |
| | | //alert(x.xml()); |
| | | |
| | | arg.AddArg(L"content",x.xml()); |
| | | arg.AddArg(L"dbmap",L"FND_PaymentTerm.dbmap"); |
| | | //return 0; |
| | | if (getUrl("/sale/data/PaymentTerm/entity/company/save",arg.GetString(),x) != 1) |
| | | if (getUrl(L"/sale/data/PaymentTerm/entity/company/save",arg.GetString(),x) != 1) |
| | | { |
| | | alert("保存失败!"); |
| | | alert(L"保存失败!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | //alert(x.GetXml()); |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | //alert(x.xml()); |
| | | if(x.selectSingleNode(L"error")) |
| | | { |
| | | alert("保存出错2!"); |
| | | alert(L"保存出错2!"); |
| | | return 0; |
| | | } |
| | | arg.AddArg("ret","Ok"); |
| | | xwin::MessageBox(GetHWND(),"保存成功!","提示",0); |
| | | //alert("保存成功"); |
| | | arg.AddArg(L"ret",L"Ok"); |
| | | MessageBox(GetHWND(),L"保存成功!",L"提示",0); |
| | | //alert(L"保存成功"); |
| | | dw_base.ResetUpdateStatus(); |
| | | //dw_bank.ResetUpdateStatus(); |
| | | //xwin::SendMessage(parenthwnd, 0x401, "maintsave", 0);//通知list窗口更新数据 |
| | | //xwin::SendMessage(parenthwnd, 0x401, L"maintsave", 0);//通知list窗口更新数据 |
| | | } |
| | | //alert("保存成功"); |
| | | //alert(L"保存成功"); |
| | | dw_base.Redraw(); |
| | | //dw_bank.Redraw(); |
| | | CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring 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(); |
| | | if(comdid==L"xmOk") OnSave(); |
| | | else if(comdid==L"addrow") OnAddrow(); |
| | | else if(comdid==L"deleterow") OnDeleterow(); |
| | | //else if(comdid==L"AddRow") OnAddRow(); |
| | | //else if(comdid==L"InsertRow") OnInsertRow(); |
| | | //else if(comdid==L"DeleteRow")OnDeleteRow(); |
| | | return 1; |
| | | } |
| | | |
| | | //按钮事件 |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //按钮事件 |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&PaymentTermEdit::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | //AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent("dw_base","DWV_ITEMCHANGED",OnItemChanged); |
| | | AttachEvent("dw_base","DWV_CLICKED",OnClick); |
| | | //AttachEvent(L"WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent(L"dw_base",L"DWV_ITEMCHANGED", (FEvent)&PaymentTermEdit::OnItemChanged); |
| | | AttachEvent(L"dw_base",L"DWV_CLICKED", (FEvent)&PaymentTermEdit::OnClick); |
| | | return 1; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | if(GetParam()) |
| | | if(GetWinParam()) |
| | | { |
| | | int p = GetParam(); |
| | | xaserverarg args = new xaserverarg; |
| | | args.setNativePointer(p); |
| | | string id = args.GetArgString("EntityID"); |
| | | int p = GetArg(); |
| | | xaserverarg args ; |
| | | |
| | | xstring id = args.GetArgString(L"EntityID"); |
| | | //alert(id); |
| | | if(id=="new") |
| | | if(id==L"new") |
| | | { |
| | | |
| | | //OnAddNew(); |
| | | } |
| | | else |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | if(getUrl("/sale/data/PaymentTerm/entity/base12", args.GetString(), x) != 1) |
| | | xml x ; |
| | | |
| | | if(getUrl(L"/sale/data/PaymentTerm/entity/base12", args.GetString(), x) != 1) |
| | | { |
| | | alert("错误"); |
| | | alert(L"错误"); |
| | | return -1; |
| | | } |
| | | //alert(x.GetXml()); |
| | | //alert(x.xml()); |
| | | dw_base.Retrieve(x); |
| | | //dw_bank.Retrieve(x); |
| | | dw_base.Redraw(); |
| | |
| | | |
| | | int onload() |
| | | { |
| | | SetArg(); |
| | | //maint::onload(); |
| | | //maint::onloaded(); |
| | | dw_base = GetControl("dw_base"); |
| | | dw_base = GetControl(L"dw_base"); |
| | | dw_cell = new xcell; |
| | | dw_cell.setNativePointer(dw_base.QueryItem("ixcell")); |
| | | dw_base.openUrl("/sale/view/Payment/template/Payment/maint"); |
| | | //alert("1233"); |
| | | dw_cell.setNativePointer(dw_base.QueryItem(L"ixcell")); |
| | | dw_base.openUrl(L"/sale/view/Payment/template/Payment/maint"); |
| | | //alert(L"1233"); |
| | | OnRetrieve(); |
| | | OnAttachEvent(); |
| | | //dw_base = GetControl("dw_base"); |
| | | //dw_base = GetControl(L"dw_base"); |
| | | |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | //maint::onloaded(); |
| | | //alert("response"); |
| | | //dw_base = GetControl("dw_base"); |
| | | //alert(L"response"); |
| | | //dw_base = GetControl(L"dw_base"); |
| | | //dw_cell = new xcell; |
| | | //dw_cell.setNativePointer(dw_base.QueryItem("ixcell")); |
| | | //dw_cell.setNativePointer(dw_base.QueryItem(L"ixcell")); |
| | | 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) |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) QuickCode : public xwin |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | |
| | | xstring m_config; |
| | | xstring m_agent; |
| | | xstring m_id; |
| | | xstring m_dbmap; |
| | | xstring m_name; |
| | | xstring strconfig; |
| | | KXMLDOMDocument m_configDoc; |
| | | xnode m_agentNode; |
| | | public: |
| | | QuickCode(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static QuickCode* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | QuickCode* pWin = new QuickCode(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int alert(xstring str) |
| | | { |
| | | //win::MessageBox(GetHWND(),str,L"提示:",0); |
| | | TApp::alert(this, str); |
| | | return 0; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | //win__::MessageBox(this.GetHWND(),str,"提示:",0); |
| | | TApp::alert(this,str); |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | if (comdid == L"save") { |
| | | //type |
| | | xaserverarg args; |
| | | |
| | | args.AddArg(L"id", m_id); |
| | | args.AddArg(L"name", m_name); |
| | | xml y; |
| | | |
| | | //TDataSet::exec(m_config,L"savetype",args,y); |
| | | //url::post(L"QuickCode/pref/quickcode_type.save",args.GetString(),y); |
| | | //save |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | KXMLDOMElement e = x.documentElement(); |
| | | e.setAttribute(L"id", m_id); |
| | | //arg.AddArg(L"id",m_id); |
| | | arg.AddArg(L"content", e.xml()); |
| | | arg.AddArg(L"dbmap", m_dbmap); |
| | | //trace(L"-->",m_id); |
| | | //trace(L"-->",m_dbmap); |
| | | //trace(e.xml()); |
| | | /*if(TDataSet::exec(m_config,L"save",arg,x)!=1) |
| | | { |
| | | trace(L"error:"+x.xml()); |
| | | alert(L"保存出错!"); |
| | | return 0; |
| | | }*/ |
| | | //trace(m_dbmap); |
| | | trace(x.xml()); |
| | | if (xurl::get(L"QuickCode/pref/quickcode.save", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | trace(x.xml()); |
| | | if (x.selectSingleNode(L"error")) |
| | | { |
| | | alert(L"保存出错2!"); |
| | | 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; |
| | | dw_list.ResetUpdateStatus(); |
| | | alert(L"保存成功!"); |
| | | } |
| | | else if (comdid == L"add") { |
| | | dw_list.InsertRow(0); |
| | | int rows = dw_list.GetRowCount(); |
| | | dw_list.SetRow(rows); |
| | | dw_list.SetItemString(rows, L"ToCurrencyCode", L"RMB"); |
| | | dw_list.SetItemDisplayString(rows, L"ToCurrencyCode", L"人民币"); |
| | | } |
| | | else if (comdid == L"insert") { |
| | | int row = dw_list.GetRow(); |
| | | if (row<1 || row>dw_list.GetRowCount()) return 0; |
| | | dw_list.InsertRow(row); |
| | | dw_list.SetItemString(row, L"ToCurrencyCode", L"RMB"); |
| | | dw_list.SetItemDisplayString(row, L"ToCurrencyCode", L"人民币"); |
| | | } |
| | | else if (comdid == L"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); |
| | | } |
| | | |
| | | int OnCmdDispatch(string comdid) |
| | | 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 == L"import") { |
| | | if (m_id == L"FND_ExchangeRate") |
| | | { |
| | | int ll_delq = MessageBox(GetHWND(), L"确定要从老系统导入汇率数据吗?", L"提示", 1); |
| | | if (ll_delq != 1) |
| | | return 0; |
| | | xml xi; |
| | | |
| | | 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") |
| | | xaserverarg argi; |
| | | argi.setNativePointer(argi.CreateInstance()); |
| | | if (xurl::get(L"QuickCode/ExchangeRate/import", argi.GetString(), xi) != 1) |
| | | { |
| | | 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); |
| | | trace(xi.text()); |
| | | return -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); |
| | | alert(L"导入成功!"); |
| | | 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); |
| | | } |
| | | } |
| | | xutil::RestoreCursor(hCursor); |
| | | return 0; |
| | | } |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | int OnSetFocus(TEvent* evt, LPARAM p) { |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | int OnClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | int col = hdr.col + 1; |
| | | xstring colname = dw_list.GetColumnName(col); |
| | | trace(colname); |
| | | xaserverarg arg; |
| | | |
| | | xstring comdid; |
| | | if (colname == L"CategoryID") |
| | | { |
| | | openUrl(L"产品资料.vface/xpage/product/category/dialog", arg); |
| | | comdid = arg.GetArgString(L"comdid"); |
| | | if (comdid == L"ok") |
| | | { |
| | | xstring CategoryID = arg.GetArgString(L"CategoryID"); |
| | | xstring CName = arg.GetArgString(L"CName"); |
| | | dw_list.SetItemDisplayString(row, colname, CName); |
| | | dw_list.SetItemString(row, colname, CategoryID); |
| | | dw_list.Redraw(); |
| | | } |
| | | } |
| | | else if (colname == L"MkOrgId") |
| | | { |
| | | openUrl(L"组织架构.vface/xpage/HrOrg/Chart", arg); |
| | | comdid = arg.GetArgString(L"comdid"); |
| | | if (comdid == L"xmOk") |
| | | { |
| | | xstring OrgName = arg.GetArgString(L"OrgName"); |
| | | xstring OrgId = arg.GetArgString(L"OrgId"); |
| | | dw_list.SetItemDisplayString(row, colname, OrgName); |
| | | dw_list.SetItemString(row, colname, OrgId); |
| | | dw_list.Redraw(); |
| | | } |
| | | } |
| | | else if (colname == L"Cid") |
| | | { |
| | | openUrl(L"组织架构.vface/xpage/hremployee/select", arg); |
| | | comdid = arg.GetArgString(L"comdid"); |
| | | if (comdid == L"xmOk") |
| | | { |
| | | xstring sPersonID = arg.GetArgString(L"sPersonID"); |
| | | trace(sPersonID); |
| | | xstring sPersonName = arg.GetArgString(L"sPersonName"); |
| | | dw_list.SetItemDisplayString(row, colname, sPersonName); |
| | | dw_list.SetItemString(row, colname, sPersonID); |
| | | dw_list.Redraw(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int OnDoubleClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | if (row<1 || row > dw_list.GetRowCount()) return 0; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | //xstring str = hdr.data; |
| | | xstring colname = hdr.colname; |
| | | xstring str = dw_list.GetItemString(row, colname); |
| | | arg.AddArg(L"value", str); |
| | | openUrl(L"/sale/view/view.dlg/xpage/memo/edit", arg); |
| | | xstring comdid = arg.GetArgString(L"comdid"); |
| | | if (comdid == L"xmOK") |
| | | { |
| | | xstring value = arg.GetArgString(L"value"); |
| | | dw_list.SetItemString(row, colname, value); |
| | | dw_list.Redraw(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int ItemOutput() |
| | | { |
| | | xstring d = xaserver::GetCurrentDate(); |
| | | d = d.left(10) + L""; |
| | | dw_list.SaveAs(d); |
| | | return 1; |
| | | } |
| | | int OnSelectAllRow() |
| | | { |
| | | int rows = dw_list.GetRowCount(); |
| | | if (rows < 1) return -1; |
| | | dw_list.SelectRow(1, rows, true); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | int OnRowCopy() |
| | | { |
| | | int rows = dw_list.GetRowCount(); |
| | | if (rows < 1) return -1; |
| | | int cols = dw_list.GetColumnCount(); |
| | | xstring str = L""; |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | int i; |
| | | while (row > 0) |
| | | { |
| | | xstring tmp1 = L""; |
| | | for (i = 1; i < cols; i++) |
| | | { |
| | | int w = dw_list.GetColumnWidth(i); |
| | | if (w < 5) continue; |
| | | xstring tmp; |
| | | if (dw_list.GetItemDisplayString(row, i + 1)) |
| | | tmp = dw_list.GetItemDisplayString(row, i + 1); |
| | | 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); |
| | | |
| | | tmp = dw_list.GetItemString(row, i + 1); |
| | | tmp1 += tmp + L"\t"; |
| | | } |
| | | 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; |
| | | } |
| | | str += tmp1 + L"\r\n"; |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | dw_list.SetDataToClip(str); |
| | | return 1; |
| | | } |
| | | int OnColCopy(xstring col) |
| | | { |
| | | int rows = dw_list.GetRowCount(); |
| | | if (rows < 1) return -1; |
| | | xstring str = L""; |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | while (row > 0) |
| | | { |
| | | xstring tmp; |
| | | if (dw_list.GetItemDisplayString(row, col)) |
| | | tmp = dw_list.GetItemDisplayString(row, col); |
| | | else |
| | | tmp = dw_list.GetItemString(row, col); |
| | | str += tmp + L"\r\n"; |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | dw_list.SetDataToClip(str); |
| | | |
| | | 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>"; |
| | | return 1; |
| | | } |
| | | int OnRClick(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.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, L"复制行"); |
| | | win::AppendMenu(m, MF_STRING, 101, L"复制列"); |
| | | win::AppendMenu(m, MF_SEPARATOR, -1, L""); |
| | | win::AppendMenu(m, MF_STRING, 2, L"ȫѡ"); |
| | | win::AppendMenu(m, MF_SEPARATOR, -1, L""); |
| | | win::AppendMenu(m, MF_STRING, 4, L"导出到Excel"); |
| | | win::AppendMenu(m, MF_SEPARATOR, -1, L""); |
| | | win::AppendMenu(m, MF_STRING, 6, L"显示列设置"); |
| | | xrect xr; |
| | | xpoint pt; |
| | | win::GetCursorPos(pt); |
| | | int ret = win::TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, GetHWND(), xr); |
| | | |
| | | 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; |
| | | } |
| | | //trace(ret); |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | if (ret == 1) { OnRowCopy(); } |
| | | else if (ret == 101) { |
| | | xstring colname = hdr.colname; |
| | | if (colname != L"") |
| | | OnColCopy(colname); |
| | | } |
| | | else if (ret == 2) { OnSelectAllRow(); } |
| | | else if (ret == 4) { ItemOutput(); } |
| | | else if (ret == 6) {} |
| | | xutil::RestoreCursor(hCursor); |
| | | |
| | | 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>"; |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&QuickCode::OnSetFocus); |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&QuickCode::OnXCommand); |
| | | AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&QuickCode::OnDoubleClicked);//行双击 |
| | | AttachEvent(L"dw_list", L"DWV_ITEMBEINGEDIT", (FEvent)&QuickCode::OnClicked); |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&QuickCode::OnRClick);//鼠标右键 |
| | | return 1; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | 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; |
| | | } |
| | | trace(L"asdasd"); |
| | | |
| | | 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() |
| | | if (m_id.find(L"", 0) > 0) |
| | | { |
| | | m_id = m_id.mid(0, m_id.find(L"", 0)); |
| | | arg.AddArg(L"id", m_id); |
| | | //trace(m_id); |
| | | /*if (TDataSet::exec(m_config, L"query_remark", arg.GetString(),x) != 1) |
| | | { |
| | | 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; |
| | | trace(x.text()); |
| | | return -1; |
| | | }*/ |
| | | if (xurl::get(L"QuickCode/entity/list_remark", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| | | } |
| | | else |
| | | { |
| | | trace(L"asdasd"); |
| | | arg.AddArg(L"id", m_id); |
| | | arg.AddArg(L"querytxt", L""); |
| | | /*if (TDataSet::exec(m_config, L"query", arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | }*/ |
| | | if (xurl::get(L"QuickCode/entity/list", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | xstring jxParam(xstring p, xstring n) |
| | | { |
| | | if (p != L"") |
| | | { |
| | | p += L"&"; |
| | | int i = 1; |
| | | while (p.find(L"=L", 0) > 0) |
| | | { |
| | | xstring name = p.mid(0, p.find(L"=L", 0)); |
| | | xstring value = p.mid(p.find(L"=L", 0) + 1, p.find(L"&", 0) - p.find(L"=L", 0) - 1); |
| | | if (name == n) return L"" + value; |
| | | i += 1; |
| | | p = p.mid(p.find(L"&", 0) + 1, p.length()); |
| | | } |
| | | } |
| | | return ""; |
| | | } |
| | | int getURLParam() |
| | | { |
| | | if (GetWinParam()) |
| | | { |
| | | xpage xp = new xpage; |
| | | xp.setNativePointer(GetXPage()); |
| | | xstring aurl = xp.GetWkUrl(); |
| | | xaserverarg arg; |
| | | if (aurl && aurl.find(L"native=true", 0) > 0) |
| | | { |
| | | int p = GetParam(); |
| | | arg; |
| | | arg.setNativePointer(p); |
| | | } |
| | | else |
| | | { |
| | | arg = GetParam(); |
| | | } |
| | | xstring config = arg.GetArgString(L"config"); |
| | | xml x; |
| | | |
| | | if (config == L"") |
| | | { |
| | | xstring configXml = arg.GetArgString(L"configxml"); |
| | | x.loadXML(configXml); |
| | | } |
| | | else |
| | | { |
| | | getUrl(config, L"", x); |
| | | } |
| | | m_configDoc = x; |
| | | |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int loaded() |
| | | { |
| | | getURLParam(); |
| | | KXMLDOMDocument ee = m_configDoc; |
| | | xstring id = m_id; |
| | | var n = ee.selectSingleNode(L"//list/dwview[@type='dwgrid'][@id='" + id + L"']"); |
| | | xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text(); |
| | | xstring dwname = L"";//e.selectsingleNode(L"@name").text(); |
| | | xstring tpl = L"";//e.selectsingleNode(L"@url").text(); |
| | | xstring dbmap = L""; |
| | | if (n) |
| | | { |
| | | KXMLDOMElement e = n; |
| | | //trace(e.xml()); |
| | | if (e.selectSingleNode(L"@name")) dwname = e.selectSingleNode(L"@name").text(); |
| | | if (e.selectSingleNode(L"@url")) tpl = e.selectSingleNode(L"@url").text(); |
| | | if (e.selectSingleNode(L"@dbmap")) dbmap = e.selectSingleNode(L"@dbmap").text(); |
| | | //trace(vface +L"/"+ tpl); |
| | | //trace(selectmode); |
| | | } |
| | | else |
| | | { |
| | | var m = ee.selectSingleNode(L"//list"); |
| | | KXMLDOMElement e1 = m; |
| | | //trace(e.xml()); |
| | | if (e1.selectSingleNode(L"@name")) dwname = e1.selectSingleNode(L"@name").text(); |
| | | if (e1.selectSingleNode(L"@url")) tpl = e1.selectSingleNode(L"@url").text(); |
| | | if (e1.selectSingleNode(L"@dbmap")) dbmap = e1.selectSingleNode(L"@dbmap").text(); |
| | | |
| | | } |
| | | m_dbmap = dbmap; |
| | | dw_list = new xdwgrid; |
| | | dw_list.setNativePointer(GetControl(dwname)); |
| | | dw_list.openUrl(vface + L"/" + tpl); |
| | | //dw_list.SetSelectionMode(4); |
| | | |
| | | } |
| | | int Onital() |
| | | { |
| | | //地区 |
| | | xml x1; |
| | | |
| | | xaserverarg arg1; |
| | | arg1.setNativePointer(arg1.CreateInstance()); |
| | | arg1.AddArg(L"id", L"地区"); |
| | | if (xurl::get(L"/sale/data/QuickCode/entity/list", arg1.GetString(), x1) != 1) |
| | | { |
| | | trace(x1.text()); |
| | | return -1; |
| | | } |
| | | |
| | | var list = x1.selectNodes(L"root/item"); |
| | | int i; |
| | | int s = list.length; |
| | | if (s > 0) |
| | | { |
| | | xstring str = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='<data>"; |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | KXMLDOMElement xitem = list.item(i); |
| | | xstring id = L""; |
| | | if (xitem.selectSingleNode(L"Code")) |
| | | id = xitem.selectSingleNode(L"Code").text(); |
| | | xstring name = L""; |
| | | if (xitem.selectSingleNode(L"Meaning")) |
| | | name = xitem.selectSingleNode(L"Meaning").text(); |
| | | xstring tmp = L"<row><显示列>" + name + L"</显示列><数据列>" + id + L"</数据列></row>"; |
| | | str += tmp; |
| | | } |
| | | str += L"</data>'/></cellprop>"; |
| | | |
| | | |
| | | dw_list.SetColumnProps(L"AreaCode", str); |
| | | } |
| | | //币别 |
| | | xml x2; |
| | | |
| | | xaserverarg arg2; |
| | | arg2.setNativePointer(arg2.CreateInstance()); |
| | | arg2.AddArg(L"id", L"FND_Currency"); |
| | | if (xurl::get(L"/sale/data/QuickCode/entity/list", arg2.GetString(), x2) != 1) |
| | | { |
| | | trace(x2.text()); |
| | | return -1; |
| | | } |
| | | |
| | | var list1 = x2.selectNodes(L"root/item"); |
| | | int j; |
| | | int s1 = list1.length; |
| | | if (s1 > 0) |
| | | { |
| | | xstring str1 = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='<data>"; |
| | | for (j = 0; j < s1; j++) |
| | | { |
| | | KXMLDOMElement xitem1 = list1.item(j); |
| | | xstring id1 = L""; |
| | | if (xitem1.selectSingleNode(L"Code")) |
| | | id1 = xitem1.selectSingleNode(L"Code").text(); |
| | | xstring name1 = L""; |
| | | if (xitem1.selectSingleNode(L"Name")) |
| | | name1 = xitem1.selectSingleNode(L"Name").text(); |
| | | xstring tmp1 = L"<row><显示列>" + name1 + L"</显示列><数据列>" + id1 + L"</数据列></row>"; |
| | | str1 += tmp1; |
| | | } |
| | | str1 += L"</data>'/></cellprop>"; |
| | | |
| | | |
| | | dw_list.SetColumnProps(L"FromCurrencyCode", str1); |
| | | } |
| | | //国家 |
| | | xml x3; |
| | | |
| | | xaserverarg arg3; |
| | | arg3.setNativePointer(arg3.CreateInstance()); |
| | | arg3.AddArg(L"id", L"FND_Country"); |
| | | if (xurl::get(L"/sale/data/QuickCode/entity/list", arg3.GetString(), x3) != 1) |
| | | { |
| | | trace(x3.text()); |
| | | return -1; |
| | | } |
| | | |
| | | var list2 = x3.selectNodes(L"root/item"); |
| | | int k; |
| | | int s2 = list2.length; |
| | | if (s2 > 0) |
| | | { |
| | | xstring str2 = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='<data>"; |
| | | for (k = 0; k < s2; k++) |
| | | { |
| | | KXMLDOMElement xitem2 = list2.item(k); |
| | | xstring id2 = L""; |
| | | if (xitem2.selectSingleNode(L"Code")) |
| | | id2 = xitem2.selectSingleNode(L"Code").text(); |
| | | xstring name2 = L""; |
| | | if (xitem2.selectSingleNode(L"Name")) |
| | | name2 = xitem2.selectSingleNode(L"Name").text(); |
| | | xstring tmp2 = L"<row><显示列>" + name2 + L"</显示列><数据列>" + id2 + L"</数据列></row>"; |
| | | str2 += tmp2; |
| | | } |
| | | str2 += L"</data>'/></cellprop>"; |
| | | |
| | | |
| | | dw_list.SetColumnProps(L"MkCountryId", str2); |
| | | } |
| | | dw_list.SetReadOnlyColumn(L"ToCurrencyCode"); |
| | | } |
| | | int onload() |
| | | { |
| | | SetArg(); |
| | | m_config = L"QuickCode.config"; |
| | | m_agent = L""; |
| | | |
| | | //dw_list = new xdwgrid; |
| | | //dw_list.setNativePointer(GetControl(L"dw_list")); |
| | | //dw_list.SetSelectionMode(4); |
| | | //dw_list.AllowSort(false); |
| | | if (GetWinParam()) |
| | | { |
| | | xaserverarg arg = GetArg(); |
| | | xstring id = arg.GetArgString(L"id"); |
| | | if (id == L"") return 0; |
| | | m_id = id; |
| | | loaded(); |
| | | |
| | | /*xstring tpl = arg.GetArgString(L"tpl"); |
| | | if(tpl == L"" && (m_id.find(L"",0) >0)) |
| | | tpl = L"QuickCode.tpl/QuickCode_Remark"; |
| | | else if(tpl == L"" ) |
| | | tpl = L"QuickCode.tpl/QuickCode"; |
| | | dw_list.SetDataObject(GetServerUrl(),L"dev:sheet["+tpl+L"]"); |
| | | xstring dbmap = arg.GetArgString(L"dbmap"); |
| | | if(dbmap == L"" && (m_id.find(L"",0) >0) ) |
| | | dbmap = L"QuickCode_Remark.dbmap"; |
| | | else if(dbmap == L"") |
| | | dbmap =L"QuickCode.dbmap"; |
| | | m_dbmap = dbmap; |
| | | xstring name = arg.GetArgString(L"name"); |
| | | if(name == L"") |
| | | name = id; |
| | | m_name = name; |
| | | xstring title = arg.GetArgString(L"title"); |
| | | if(title != L"") |
| | | win::SetWindowText(GetHWND(),title);*/ |
| | | |
| | | |
| | | |
| | | |
| | | /* |
| | | param p = GetParam(); |
| | | xstring pa = L""+p; |
| | | //xstring pa = L"id=HrOrgType&title=客户类型"; |
| | | xstring id = jxParam(pa,L"id"); |
| | | if(id == L"") return 0; |
| | | m_id = id; |
| | | xstring tpl = jxParam(pa,L"tpl"); |
| | | if(tpl == L"" && (m_id.find(L"",0) >0)) |
| | | tpl = L"QuickCode.tpl/QuickCode_Remark"; |
| | | else if(tpl == L"" ) |
| | | tpl = L"QuickCode.tpl/QuickCode"; |
| | | dw_list.SetDataObject(GetServerUrl(),L"dev:sheet["+tpl+L"]"); |
| | | xstring dbmap = jxParam(pa,L"dbmap"); |
| | | if(dbmap == L"" && (m_id.find(L"",0) >0) ) |
| | | dbmap = L"QuickCode_Remark.dbmap"; |
| | | else if(dbmap == L"") |
| | | dbmap =L"QuickCode.dbmap"; |
| | | m_dbmap = dbmap; |
| | | //trace(m_dbmap); |
| | | |
| | | xstring name = jxParam(pa,L"name"); |
| | | if(name == L"") |
| | | name = id; |
| | | m_name = name; |
| | | xstring title = jxParam(pa,L"title"); |
| | | if(title != L"") |
| | | win::SetWindowText(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) |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) QuickCode_Tree : public xwin |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xtreeview tv_1; |
| | | xstring m_config; |
| | | xstring m_agent; |
| | | xstring m_id; |
| | | xstring m_dbmap; |
| | | xstring treexquery; |
| | | xstring c_type; |
| | | KXMLDOMDocument m_configDoc; |
| | | xstring kpstr; |
| | | xstring strtpl; |
| | | xstring m_QueryTxt; |
| | | xnode m_agentNode; |
| | | public: |
| | | QuickCode_Tree(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static QuickCode_Tree* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | QuickCode_Tree* pWin = new QuickCode_Tree(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int alert(xstring str) |
| | | { |
| | | TApp::alert(this, str); |
| | | //win::MessageBox(GetHWND(),str,L"提示:",0); |
| | | return 0; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | TApp::alert(this,str); |
| | | //win__::MessageBox(this.GetHWND(),str,"提示:",0); |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | dw_list.AcceptText(); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"id", m_id); |
| | | arg.AddArg(L"sType", c_type); |
| | | arg.AddArg(L"QueryTxt", m_QueryTxt); |
| | | //trace(arg.GetString()); |
| | | /*if (TDataSet::exec(m_config, L"query1", arg.GetString(),x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | }*/ |
| | | if (xurl::get(L"QuickCode/entity/listaddtree", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | //trace(x.xml()); |
| | | if (x.xml() == L"") |
| | | { |
| | | xml xx; |
| | | xx.loadXML(L"<root/>"); |
| | | dw_list.Retrieve(xx); |
| | | dw_list.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int OnTreeSelChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM hItem = nmtv.itemNew.hItem; |
| | | |
| | | |
| | | HTREEITEM hitem = tv_1.GetSelectedItem(); |
| | | //c_type=dw_type.GetItemLabel(hitem); |
| | | //如果是跟节点 |
| | | HTREEITEM roothitem = tv_1.GetRootItem(); |
| | | if (hitem == roothitem) { |
| | | c_type = L""; |
| | | } |
| | | else |
| | | { |
| | | c_type = tv_1.GetItemLabel(hitem); |
| | | |
| | | } |
| | | OnRetrieve(); |
| | | return 1; |
| | | } |
| | | int adduomfolder() |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"note", L"新增"); |
| | | arg.AddArg(L"m_id", m_id); |
| | | //win::OpenWindow(L"dev:xpage[AddUomGroup.vx]",arg); |
| | | openUrl(L"公共设置.vface/xpage/quickcode/AddGroup", arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring GroupName = arg.GetArgString(L"GroupName"); |
| | | xml xx; |
| | | |
| | | xaserverarg args; |
| | | |
| | | args.AddArg(L"GroupName", GroupName); |
| | | args.AddArg(L"OldGroupName", L""); |
| | | args.AddArg(L"m_id", m_id); |
| | | /*if(TFile::exec(m_config,L"updateuomtype",args,xx)!=1) |
| | | { |
| | | trace(L"error:"+xx.xml()); |
| | | alert(L"保存出错!"); |
| | | return 0; |
| | | }*/ |
| | | if (xurl::get(L"QuickCode/pref/quickcode_tree.updateGroup", args.GetString(), xx) != 1) |
| | | { |
| | | trace(L"error:" + (xstring)xx.xml()); |
| | | alert(L"保存出错!"); |
| | | return 0; |
| | | } |
| | | int SetAgent() |
| | | else |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = win__::GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]"); |
| | | if(agent) |
| | | xstring vv = xx.documentElement().text(); |
| | | xml x; |
| | | |
| | | x.loadXML(L"<row GroupName='" + GroupName + L"'/>"); |
| | | HTREEITEM root = tv_1.GetRootItem(); |
| | | if (vv == L"OK") |
| | | { |
| | | string s = agent.xml+""; |
| | | SetAgentNodeContent (anode,s); |
| | | tv_1.InsertChildItem(root, GroupName, x.documentElement(), 15); |
| | | } |
| | | 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) |
| | | } |
| | | return 1; |
| | | } |
| | | int modifyuomfolder() |
| | | { |
| | | |
| | | HTREEITEM h = tv_1.GetSelectedItem(); |
| | | if (!h) |
| | | { |
| | | alert(L"请选择需要修改的组名"); |
| | | return 0; |
| | | } |
| | | HTREEITEM roothitem = tv_1.GetRootItem(); |
| | | if (h == roothitem) |
| | | { |
| | | alert(L"不能修改根节点名称!"); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = tv_1.GetItemData(h); |
| | | trace(e.xml()); |
| | | //xstring OldGroupName= e.SelectSingleNode(L"@GroupName").text(); |
| | | xstring OldGroupName = tv_1.GetItemLabel(h); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"note", L"修改"); |
| | | arg.AddArg(L"m_id", m_id); |
| | | arg.AddArg(L"GroupName", OldGroupName); |
| | | OpenWindow(L"dev:xpage[AddUomGroup.vx]", arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring NewGroupName = arg.GetArgString(L"GroupName"); |
| | | xml xx; |
| | | |
| | | xaserverarg args; |
| | | |
| | | args.AddArg(L"GroupName", NewGroupName); |
| | | args.AddArg(L"OldGroupName", OldGroupName); |
| | | args.AddArg(L"m_id", m_id); |
| | | /*if(TFile::exec(m_config,L"updateuomtype",args,xx)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | trace(L"error:"+xx.xml()); |
| | | alert(L"保存出错!"); |
| | | return 0; |
| | | }*/ |
| | | if (url::get("QuickCode/entity/listaddtree",arg.GetString(),x) != 1) |
| | | if (xurl::get(L"QuickCode/pref/quickcode_tree.updateGroup", args.GetString(), xx) != 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(); |
| | | trace(L"error:" + (xstring)xx.xml()); |
| | | alert(L"保存出错!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | { |
| | | trace(xx.xml()); |
| | | xstring vv = xx.documentElement().text(); |
| | | if (vv == L"OK") |
| | | { |
| | | tv_1.SetItemLabel(h, NewGroupName); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int OnTreeSelChanged(ref TNotifyEvent evt,int p) |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int deluomfolder() |
| | | { |
| | | |
| | | HTREEITEM hitem = tv_1.GetSelectedItem(); |
| | | if (!hitem) |
| | | { |
| | | alert(L"请选择需要删除的组名"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | |
| | | int s = dw_list.GetRowCount(); |
| | | if (s > 0) |
| | | { |
| | | 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 |
| | | alert(L"该分组下面存在数据,不能删除!"); |
| | | return 0; |
| | | } |
| | | HTREEITEM roothitem = tv_1.GetRootItem(); |
| | | if (hitem == roothitem) |
| | | { |
| | | alert(L"不能删除根节点!"); |
| | | } |
| | | else |
| | | { |
| | | //缺少判断删除的条件 |
| | | xstring GroupName = tv_1.GetItemLabel(hitem); |
| | | if (MessageBox(GetHWND(), L"确定删除组名:" + GroupName + L" 吗?", L"提示", 1) == 1) |
| | | { |
| | | c_type = treeview__::GetItemLabel(wid,hitem); |
| | | xml xx; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"GroupName", GroupName); |
| | | arg.AddArg(L"m_id", m_id); |
| | | trace(GroupName); |
| | | trace(m_id); |
| | | /*if (xaserver::ExecXAction(GetServerUrl(),L"[delete.type.FND_UOM.xa]",arg.GetString()) == 1) |
| | | { |
| | | tv_1.DeleteItem(wid,hitem); |
| | | //OnTreeSelChanged(); |
| | | }*/ |
| | | if (xurl::get(L"QuickCode/pref/quickcode_tree.deleteGroup", arg.GetString(), xx) == 1) |
| | | { |
| | | tv_1.DeleteItem(hitem); |
| | | } |
| | | else |
| | | alert(L"删除失败!"); |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | xdwgrid getDW() |
| | | { |
| | | return dw_list; |
| | | } |
| | | int GridSearch() |
| | | { |
| | | xml x; |
| | | |
| | | xaserver::LoadUrl(L"", L"dev:vface[公共设置.vface]", L"", x); |
| | | //trace(x.xml()); |
| | | //trace(strtpl); |
| | | xstring aa = strtpl; |
| | | var doc = x; |
| | | var n = doc.selectSingleNode(L"//resource[@url='" + aa + L"']/@src"); |
| | | //trace(n.text()); |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sheet", n.text()); |
| | | arg.AddArg(L"search", list::m_QueryTxt); |
| | | openUrl(L"view.dlg.vface/xpage/grid/column/search", arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring txt = arg.GetArgString(L"search"); |
| | | if (txt != L"") { |
| | | m_QueryTxt = txt; |
| | | //trace(txt); |
| | | 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 0; |
| | | } |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | xdwgrid dw = getDW(); |
| | | if (comdid == L"save") { |
| | | dw_list.AcceptText(); |
| | | xml x; |
| | | |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int deluomfolder() |
| | | { |
| | | |
| | | int wid = tv_1.GetId(); |
| | | int hitem=treeview__::GetSelectedItem(wid); |
| | | if (hitem<1) |
| | | { |
| | | alert("请选择需要删除的组名"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | 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() |
| | | dw_list.DwUpdateAllToEx(x); |
| | | KXMLDOMElement e = x.documentElement(); |
| | | e.setAttribute(L"id", m_id); |
| | | //arg.AddArg(L"id",m_id); |
| | | //trace(m_id); |
| | | //trace(m_dbmap); |
| | | if (m_id == L"开票银行") |
| | | { |
| | | return dw_list; |
| | | xml kp; |
| | | |
| | | kp.loadXML(L"<root></root>"); |
| | | KXMLDOMElement ele = kp.documentElement(); |
| | | var list = e.selectNodes(L"item[@update.modify='1' or @update.delete='1' ]"); |
| | | int j; |
| | | int k = list.length; |
| | | for (j = 0; j < k; j++) |
| | | { |
| | | KXMLDOMElement ele1 = list.item(j); |
| | | ele.appendChild(ele1); |
| | | } |
| | | kpstr = ele.xml(); |
| | | trace(ele.xml()); |
| | | } |
| | | int GridSearch() |
| | | if (m_id == L"开票银行") |
| | | { |
| | | 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(); |
| | | } |
| | | } |
| | | arg.AddArg(L"content", kpstr); |
| | | } |
| | | else |
| | | { |
| | | arg.AddArg(L"content", e.xml()); |
| | | } |
| | | arg.AddArg(L"dbmap", m_dbmap); |
| | | /*if(TFile::exec(m_config,L"save",arg,x)!=1) |
| | | { |
| | | trace(L"error:"+x.xml()); |
| | | alert(L"保存出错!"); |
| | | return 0; |
| | | } |
| | | int OnCmdDispatch(string comdid) |
| | | }*/ |
| | | trace(m_dbmap + L"\r\n" + e.xml()); |
| | | if (xurl::get(L"QuickCode/pref/quickcode.save", arg.GetString(), x) != 1) |
| | | { |
| | | 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); |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | //trace(arg.GetString()); |
| | | if (x.selectSingleNode(L"error")) |
| | | { |
| | | alert(L"保存出错2!"); |
| | | 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);//鼠标右键 |
| | | } |
| | | dw_list.ResetUpdateStatus(); |
| | | alert(L"保存成功!"); |
| | | } |
| | | else if (comdid == L"add") { |
| | | dw.InsertRow(0); |
| | | int rows = dw.GetRowCount(); |
| | | dw.SetItemString(rows, L"GroupName", c_type); |
| | | dw.SetItemString(rows, L"BankName", c_type); |
| | | } |
| | | else if (comdid == L"insert") { |
| | | int row = dw.GetRow(); |
| | | if (row<1 || row>dw.GetRowCount()) return 0; |
| | | dw.InsertRow(row); |
| | | |
| | | |
| | | string jxParam(string p, string n) |
| | | dw.SetItemString(row, L"GroupName", c_type); |
| | | } |
| | | else if (comdid == L"delet") { |
| | | dw_list.AcceptText(); |
| | | int row2 = dw.GetRow(); |
| | | if (row2<1 || row2>dw.GetRowCount()) return 0; |
| | | dw.DeleteRow(row2); |
| | | } |
| | | else if (comdid == L"adduomfolder") |
| | | adduomfolder(); |
| | | else if (comdid == L"modifyuomfolder") |
| | | modifyuomfolder(); |
| | | else if (comdid == L"deluomfolder") |
| | | deluomfolder(); |
| | | else if (comdid == L"search") |
| | | GridSearch(); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 0; |
| | | } |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | int OnSetFocus(TEvent* evt, LPARAM p) |
| | | { |
| | | SetAgent(); |
| | | tv_1 = new treeview; |
| | | tv_1.setNativePointer(GetControl(L"tv_1")); |
| | | |
| | | HTREEITEM root = tv_1.GetRootItem(); |
| | | tv_1.ExpandItem(root); |
| | | return 1; |
| | | } |
| | | int OnDoubleClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | if (row<1 || row > dw_list.GetRowCount()) return 0; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | //xstring str = hdr.data; |
| | | xstring colname = hdr.colname; |
| | | xstring str = dw_list.GetItemString(row, colname); |
| | | arg.AddArg(L"value", str); |
| | | openUrl(L"/sale/view/view.dlg/xpage/memo/edit", arg); |
| | | xstring comdid = arg.GetArgString(L"comdid"); |
| | | if (comdid == L"xmOK") |
| | | { |
| | | xstring value = arg.GetArgString(L"value"); |
| | | dw_list.SetItemString(row, colname, value); |
| | | dw_list.Redraw(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int ItemOutput() |
| | | { |
| | | xstring d = xaserver::GetCurrentDate(); |
| | | d = d.left(10) + L""; |
| | | dw_list.SaveAs(d); |
| | | return 1; |
| | | } |
| | | int OnSelectAllRow() |
| | | { |
| | | int rows = dw_list.GetRowCount(); |
| | | if (rows < 1) return -1; |
| | | dw_list.SelectRow(1, rows, true); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | int OnRowCopy() |
| | | { |
| | | int rows = dw_list.GetRowCount(); |
| | | if (rows < 1) return -1; |
| | | int cols = dw_list.GetColumnCount(); |
| | | xstring str = L""; |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | int i; |
| | | while (row > 0) |
| | | { |
| | | xstring tmp1 = L""; |
| | | for (i = 1; i < cols; i++) |
| | | { |
| | | 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 w = dw_list.GetColumnWidth(i); |
| | | if (w < 5) continue; |
| | | xstring tmp; |
| | | if (dw_list.GetItemDisplayString(row, i + 1)) |
| | | tmp = dw_list.GetItemDisplayString(row, i + 1); |
| | | else |
| | | tmp = dw_list.GetItemString(row, i + 1); |
| | | tmp1 += tmp + L"\t"; |
| | | } |
| | | int getURLParam() |
| | | str += tmp1 + L"\r\n"; |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | dw_list.SetDataToClip(str); |
| | | return 1; |
| | | } |
| | | int OnColCopy(xstring col) |
| | | { |
| | | int rows = dw_list.GetRowCount(); |
| | | if (rows < 1) return -1; |
| | | xstring str = L""; |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | while (row > 0) |
| | | { |
| | | xstring tmp; |
| | | if (dw_list.GetItemDisplayString(row, col)) |
| | | tmp = dw_list.GetItemDisplayString(row, col); |
| | | else |
| | | tmp = dw_list.GetItemString(row, col); |
| | | str += tmp + L"\r\n"; |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | dw_list.SetDataToClip(str); |
| | | |
| | | return 1; |
| | | } |
| | | int OnRClick(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.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, L"复制行"); |
| | | win::AppendMenu(m, MF_STRING, 101, L"复制列"); |
| | | win::AppendMenu(m, MF_SEPARATOR, -1, L""); |
| | | win::AppendMenu(m, MF_STRING, 2, L"ȫѡ"); |
| | | win::AppendMenu(m, MF_SEPARATOR, -1, L""); |
| | | win::AppendMenu(m, MF_STRING, 4, L"导出到Excel"); |
| | | win::AppendMenu(m, MF_SEPARATOR, -1, L""); |
| | | win::AppendMenu(m, MF_STRING, 6, L"显示列设置"); |
| | | xrect xr; |
| | | xpoint pt; |
| | | win::GetCursorPos(pt); |
| | | int ret = win::TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, GetHWND(), xr); |
| | | |
| | | //trace(ret); |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | if (ret == 1) { OnRowCopy(); } |
| | | else if (ret == 101) { |
| | | xstring colname = hdr.colname; |
| | | if (colname != L"") |
| | | OnColCopy(colname); |
| | | } |
| | | else if (ret == 2) { OnSelectAllRow(); } |
| | | else if (ret == 4) { ItemOutput(); } |
| | | else if (ret == 6) {} |
| | | xutil::RestoreCursor(hCursor); |
| | | |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&QuickCode_Tree::OnSetFocus); |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&QuickCode_Tree::OnXCommand); |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&QuickCode_Tree::OnTreeSelChanged); |
| | | AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&QuickCode_Tree::OnDoubleClicked);//行双击 |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&QuickCode_Tree::OnRClick);//鼠标右键 |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | xstring jxParam(xstring p, xstring n) |
| | | { |
| | | if (p != L"") |
| | | { |
| | | p += L"&"; |
| | | int i = 1; |
| | | while (p.find(L"=L", 0) > 0) |
| | | { |
| | | 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() |
| | | xstring name = p.mid(0, p.find(L"=L", 0)); |
| | | xstring value = p.mid(p.find(L"=L", 0) + 1, p.find(L"&", 0) - p.find(L"=L", 0) - 1); |
| | | if (name == n) return L"" + value; |
| | | i += 1; |
| | | p = p.mid(p.find(L"&", 0) + 1, p.length()); |
| | | } |
| | | } |
| | | return L""; |
| | | } |
| | | int getURLParam() |
| | | { |
| | | if (GetWinParam()) |
| | | { |
| | | xpage xp = new xpage; |
| | | xp.setNativePointer(GetXPage()); |
| | | xstring aurl = xp.GetWkUrl(); |
| | | xaserverarg arg; |
| | | if (aurl && aurl.find(L"native=true", 0) > 0) |
| | | { |
| | | int p = GetParam(); |
| | | arg; |
| | | arg.setNativePointer(p); |
| | | } |
| | | else |
| | | { |
| | | arg = GetParam(); |
| | | } |
| | | xstring config = arg.GetArgString(L"config"); |
| | | xml x; |
| | | |
| | | if (config == L"") |
| | | { |
| | | xstring configXml = arg.GetArgString(L"configxml"); |
| | | x.loadXML(configXml); |
| | | } |
| | | else |
| | | { |
| | | getUrl(config, L"", x); |
| | | } |
| | | m_configDoc = x; |
| | | |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int loaded() |
| | | { |
| | | getURLParam(); |
| | | KXMLDOMDocument ee = m_configDoc; |
| | | xstring id = m_id; |
| | | var n = ee.selectSingleNode(L"//list/dwview[@type='dwgrid'][@id='" + id + L"']"); |
| | | if (n) |
| | | { |
| | | KXMLDOMElement e = n; |
| | | //trace(e.xml); |
| | | xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text(); |
| | | xstring dwname = L"";//e.selectsingleNode(L"@name").text(); |
| | | xstring tpl = L"";//e.selectsingleNode(L"@url").text(); |
| | | xstring dbmap = L""; |
| | | xstring strtreexquery = L""; |
| | | if (e.selectSingleNode(L"@name")) dwname = e.selectSingleNode(L"@name").text(); |
| | | if (e.selectSingleNode(L"@url")) tpl = e.selectSingleNode(L"@url").text(); |
| | | if (e.selectSingleNode(L"@dbmap")) dbmap = e.selectSingleNode(L"@dbmap").text(); |
| | | if (e.selectSingleNode(L"@treexquery")) strtreexquery = e.selectSingleNode(L"@treexquery").text(); |
| | | m_dbmap = dbmap; |
| | | treexquery = strtreexquery; |
| | | //trace(vface +L"/"+ tpl); |
| | | //trace(selectmode); |
| | | dw_list = new xdwgrid; |
| | | dw_list.setNativePointer(GetControl(dwname)); |
| | | dw_list.openUrl(vface + L"/" + tpl); |
| | | strtpl = tpl; |
| | | trace(tpl); |
| | | |
| | | } |
| | | } |
| | | int onload() |
| | | { |
| | | |
| | | SetArg(); |
| | | m_config = L"QuickCode.config"; |
| | | m_agent = L""; |
| | | dw_list = new xdwtable; |
| | | dw_list.setNativePointer(GetControl(L"dw_list")); |
| | | if (GetWinParam()) |
| | | { |
| | | xaserverarg arg = GetArg(); |
| | | //trace(arg.GetString()); |
| | | xstring id = arg.GetArgString(L"id"); |
| | | if (id == L"") return 0; |
| | | m_id = id; |
| | | loaded(); |
| | | |
| | | /*xstring tpl = arg.GetArgString(L"tpl"); |
| | | if(tpl == L"") |
| | | tpl = L"QuickCode.tpl/QuickCode"; |
| | | dw_list.SetDataObject(GetServerUrl(),L"dev:sheet["+tpl+L"]"); |
| | | //dw_list.SetColHeaderHeight(0); |
| | | //dw_list.SetRowSelectorWidth(0); |
| | | xstring dbmap = arg.GetArgString(L"dbmap"); |
| | | if(dbmap == L"") |
| | | dbmap = L"QuickCode.dbmap"; |
| | | m_dbmap = dbmap; |
| | | xstring txquery=arg.GetArgString(L"treexquery"); |
| | | treexquery=txquery; |
| | | xstring title = arg.GetArgString(L"title"); |
| | | if(title != L"") |
| | | win::SetWindowText(GetHWND(),title);*/ |
| | | OnRetrieve(); |
| | | } |
| | | SetAgent(); |
| | | xstring aa = treexquery; |
| | | xstring xfNodeAgentArea2 = L"treeagent"; |
| | | xnode tnode = new xnode; |
| | | tnode.setNativePointer(GetAgentNode(xfNodeAgentArea2)); |
| | | xstring stree = L"<vbox><xtree name='tv_1' imagelist='0'>"; |
| | | stree += L"<treeitem src='xquery:[" + aa + L"]' xcaption='@GroupName' xroot='/root' xpath='row' xchildpath='row' image='15' loop='yes' xdata='.'/>"; |
| | | stree += L"</xtree></vbox>"; |
| | | SetAgentNode(tnode, stree); |
| | | |
| | | tv_1 = new treeview; |
| | | tv_1.setNativePointer(GetControl(L"tv_1")); |
| | | |
| | | 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); |
| | | HTREEITEM root = tv_1.GetRootItem(); |
| | | tv_1.ExpandItem( root); |
| | | 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); |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | about SKUItemcategoryselect |
| | | [ |
| | | field: |
| | | xdwtable__ dw_category; |
| | | xdwtable dw_category; |
| | | method: |
| | | [ |
| | | treeview__ tv_gs; |
| | | treeview tv_gs; |
| | | //命令发布函数 |
| | | string GetPath(int tv, int h) |
| | | xstring GetPath(int tv, int h) |
| | | { |
| | | string str = treeview__::GetItemLabel(tv, h); |
| | | int k = treeview__::GetParentItem(tv, h); |
| | | int r = treeview__::GetRootItem(tv); |
| | | xstring 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); |
| | | xstring tmp = treeview::GetItemLabel(tv, k); |
| | | str = tmp+L"\\" + 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) |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_category.FindDwTable(L"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); |
| | | msxml::IXMLDOMElement e = treeview::GetItemData(tv_gs.GetId(),hItem); |
| | | xstring id = e.selectSingleNode(L"CategoryID").text; |
| | | xstring Name =GetPath(tv_gs.GetId(), hItem); |
| | | trace(Name); |
| | | if(dw.GetItemString(1,"CategoryID")=="") |
| | | if(dw.GetItemString(1,L"CategoryID")==L"") |
| | | { |
| | | dw.ItemChangeTo(1,"CategoryID",id); |
| | | dw.ItemChangeTo(1,"Category",Name); |
| | | dw.ItemChangeTo(1,L"CategoryID",id); |
| | | dw.ItemChangeTo(1,L"Category",Name); |
| | | } |
| | | else |
| | | { |
| | | int n=dw.InsertRow(0); |
| | | dw.ItemChangeTo(n,"CategoryID",id); |
| | | dw.ItemChangeTo(n,"Category",Name); |
| | | dw.ItemChangeTo(n,L"CategoryID",id); |
| | | dw.ItemChangeTo(n,L"Category",Name); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | int cItem = treeview__::GetChildItem(tv_gs.GetId(), hItem); |
| | | int cItem = treeview::GetChildItem(tv_gs.GetId(), hItem); |
| | | if(cItem > 0) |
| | | { |
| | | xunhuan(pItem,cItem); |
| | | } |
| | | int nItem = treeview__::GetNextItem(tv_gs.GetId(), hItem); |
| | | int nItem = treeview::GetNextItem(tv_gs.GetId(), hItem); |
| | | if(nItem > 0) |
| | | { |
| | | xunhuan(pItem,nItem); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if(comdid=="ok") |
| | | if(comdid==L"ok") |
| | | { |
| | | int hitem = treeview__::GetSelectedItem(tv_gs.GetId()); |
| | | 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); |
| | | msxml::IXMLDOMElement ele=treeview::GetItemData(tv_gs.GetId(),hitem); |
| | | xstring guid = ele.selectSingleNode(L"CategoryID").text; |
| | | //xstring label = ele.selectSingleNode(L"CName").text; |
| | | xstring label = GetPath(tv_gs.GetId(), hitem); |
| | | trace(label); |
| | | xunhuan(hitem, treeview__::GetChildItem(tv_gs.GetId(), treeview__::GetRootItem(tv_gs.GetId()))); |
| | | win__::CloseWindow(); |
| | | xunhuan(hitem, treeview::GetChildItem(tv_gs.GetId(), treeview::GetRootItem(tv_gs.GetId()))); |
| | | win::CloseWindow(); |
| | | } |
| | | return 1; |
| | | } |
| | | if(comdid=="close") |
| | | win__::CloseWindow(); |
| | | if(comdid==L"close") |
| | | win::CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | | int OnCmdDispatch0(string comdid) |
| | | int OnCmdDispatch0(xstring comdid) |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | 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) |
| | | arg = win::GetParam(); |
| | | arg.AddArg(L"comdid",comdid); |
| | | int xitem = treeview::GetSelectedItem(tv_gs.GetId()); |
| | | if(comdid==L"ok" && xitem != 0) |
| | | { |
| | | msxml::IXMLDOMElement e=treeview__::GetItemData(tv_gs.GetId(),xitem); |
| | | msxml::IXMLDOMElement e=treeview::GetItemData(tv_gs.GetId(),xitem); |
| | | |
| | | string sHasChild=e.selectSingleNode("@HasChild").text; |
| | | xstring sHasChild=e.selectSingleNode(L"@HasChild").text; |
| | | |
| | | if(treeview__::GetChildItem(tv_gs.GetId(),xitem)>0 || sHasChild=="1") |
| | | if(treeview::GetChildItem(tv_gs.GetId(),xitem)>0 || sHasChild==L"1") |
| | | { |
| | | alert("提示:请选择最后一级类别!"); |
| | | alert(L"提示:请选择最后一级类别!"); |
| | | return 0; |
| | | } |
| | | |
| | | string ID = e.selectSingleNode("CategoryID").text; |
| | | string CName = e.selectSingleNode("CName").text; |
| | | xstring ID = e.selectSingleNode(L"CategoryID").text; |
| | | xstring CName = e.selectSingleNode(L"CName").text; |
| | | trace(CName); |
| | | string ruler; |
| | | if(e.selectSingleNode("SpecRule")) |
| | | ruler = e.selectSingleNode("SpecRule").text; |
| | | xstring ruler; |
| | | if(e.selectSingleNode(L"SpecRule")) |
| | | ruler = e.selectSingleNode(L"SpecRule").text; |
| | | else |
| | | ruler =""; |
| | | arg.AddArg("CategoryID",ID); |
| | | arg.AddArg("CName",CName); |
| | | arg.AddArg("SpecRule",ruler); |
| | | ruler =L""; |
| | | arg.AddArg(L"CategoryID",ID); |
| | | arg.AddArg(L"CName",CName); |
| | | arg.AddArg(L"SpecRule",ruler); |
| | | |
| | | } |
| | | win__::CloseWindow(); |
| | | win::CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | 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); |
| | | msxml::IXMLDOMElement sitemdata=treeview::GetItemData(tv_gs.GetId(), pitem); |
| | | xstring sHasChild=sitemdata.selectSingleNode(L"@HasChild").text;//sitemdata.getAttribute(L"HasChild"); |
| | | xstring pid=sitemdata.selectSingleNode(L"CategoryID").text; |
| | | //trace(sHasChild+L"sdaga"+pid); |
| | | if(sHasChild==L"1"){//数据有子节点 |
| | | int citem=treeview::GetChildItem(tv_gs.GetId(), pitem); |
| | | |
| | | //alert(string(citem)); |
| | | //alert(xstring(citem)); |
| | | if (citem==0){//树视图有子节点 |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | 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) |
| | | arg.AddArg(L"parentID",pid); |
| | | //if(xaserver::ExecXQuery(GetServerUrl(),L"[ItemCategoryEx.xq]",arg.GetString(),x)!=1) |
| | | if(url::get(GetEntityName(1)+L"/entity/category",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return 0; |
| | | } |
| | | //trace(x.GetXml()); |
| | | var list=x.GetXmlDoc().selectNodes("root/Category"); |
| | | var list=x.GetXmlDoc().selectNodes(L"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"); |
| | | xstring Name=xitem.selectSingleNode(L"CName").text; |
| | | xstring Has2D=xitem.selectSingleNode(L"@Has2D").text;//item.getAttribute(L"Has2D"); |
| | | if (Has2D==L"1") |
| | | Name=Name+L"*"; |
| | | int kitem=treeview::InsertItem(tv_gs.GetId(), pitem,0,Name,xitem,15); |
| | | //int kitem=treeview::InsertChildItem(tv_gs.GetId(), pitem,Name,xitem,15); |
| | | xstring HasChild=xitem.selectSingleNode(L"@HasChild").text;//item.getAttribute(L"HasChild"); |
| | | //trace(HasChild, kitem); |
| | | if (HasChild=="1") |
| | | treeview__::SetItemChild1(tv_gs.GetId(), kitem,1); |
| | | if (HasChild==L"1") |
| | | treeview::SetItemChild1(tv_gs.GetId(), kitem,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); |
| | | xstring rootid=L"00000000-0000-0000-0000-000000000000"; |
| | | xml x=new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | x.LoadXml(L"<Category HasChild='1'><CategoryID>"+rootid+L"</CategoryID></Category>"); |
| | | int hroot=treeview::InsertItem(tv_gs.GetId(),L"公司产品类别", x.GetXmlDoc().documentElement, 17); |
| | | CreateSubTree(hroot); |
| | | treeview__::ExpandItemEx(tv_gs.GetId(),hroot); |
| | | treeview::ExpandItemEx(tv_gs.GetId(),hroot); |
| | | return 1; |
| | | } |
| | | |
| | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent(L"WM_XCOMMAND",OnXCommand); |
| | | //获得树的展开事件 |
| | | AttachEvent("tv_gs", "TVN_ITEMEXPANDING",OnTreeExpanding); |
| | | AttachEvent(L"tv_gs", L"TVN_ITEMEXPANDING",OnTreeExpanding); |
| | | } |
| | | int onload() |
| | | { |
| | | if (GetParam()) |
| | | { |
| | | xaserverarg__ arg1=GetParam(); |
| | | dw_category = new xdwtable__; |
| | | dw_category.setNativePointer(arg1.GetArgString("dw_category").toInt()); |
| | | xaserverarg arg1=GetParam(); |
| | | dw_category = new xdwtable; |
| | | dw_category.setNativePointer(arg1.GetArgString(L"dw_category").toInt()); |
| | | } |
| | | tv_gs = new treeview__; |
| | | tv_gs.setNativePointer(GetControl("tv_gs")); |
| | | tv_gs = new treeview; |
| | | tv_gs.setNativePointer(GetControl(L"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() |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) SKUItem : public xframe |
| | | { |
| | | public: |
| | | xtreeview tv_1; |
| | | xdwgrid dw_list; |
| | | xstring m_type; |
| | | xstring CategoryID; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | xstring m_searchtxt; |
| | | public: |
| | | SKUItem(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static SKUItem* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | SKUItem* pWin = new SKUItem(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM p) |
| | | { |
| | | SetAgent(); |
| | | |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | |
| | | int OnReTrieve() |
| | | { |
| | | xstring query = L"[SKUItem.tree.xq]"; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"parentID", CategoryID); |
| | | arg.AddArg(L"query", L""); |
| | | if (xaserver::ExecXQuery(GetServerUrl(), query, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.openUrl(L"其他设置.vface/template/other/SKUItem"); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM sitem = nmtv.itemNew.hItem; |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | dw_list.AcceptText(); |
| | | xml z; |
| | | |
| | | z.loadXML(L"<root/>"); |
| | | dw_list.Retrieve(z); |
| | | dw_list.Redraw(); |
| | | dw_list.ResetUpdateStatus(); |
| | | |
| | | KXMLDOMElement ele = tv_1.GetItemData(sitem); |
| | | if (!ele.selectSingleNode(L"ID")) return 0; |
| | | CategoryID = ele.selectSingleNode(L"ID").text(); |
| | | //trace(CategoryID); |
| | | m_searchtxt = L""; |
| | | |
| | | OnReTrieve(); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int CreateSubTree(HTREEITEM pitem) |
| | | { |
| | | KXMLDOMElement sitemdata = tv_1.GetItemData(pitem); |
| | | xstring sHasChild = sitemdata.selectSingleNode(L"@HasChild").text();//sitemdata.getAttribute(L"HasChild"); |
| | | //trace(sHasChild); |
| | | xstring pid = sitemdata.selectSingleNode(L"ID").text(); |
| | | //trace(sHasChild+L"sdaga"+pid); |
| | | if (sHasChild == L"1") {//数据有子节点 |
| | | HTREEITEM citem = tv_1.GetChildItem(pitem); |
| | | //alert(xstring(citem)); |
| | | if (citem == 0) {//树视图有子节点 |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"parentID", pid); |
| | | arg.AddArg(L"query", L""); |
| | | if (xaserver::ExecXQuery(GetServerUrl(), L"[SKUItem.tree.xq]", arg.GetString(), x) != 1) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent (anode,s); |
| | | trace(x.xml()); |
| | | return 0; |
| | | } |
| | | 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(); |
| | | //trace(x.xml()); |
| | | var list = x.selectNodes(L"root/SKUItem"); |
| | | int i = 0, s = list.length; |
| | | KXMLDOMElement xitem; |
| | | KXMLDOMNode d; |
| | | for (i = 0; i < s; i++) { |
| | | xitem = list.item(s - i - 1); |
| | | //if(i==0)xitem.setAttribute(L"HasChild",L"1"); |
| | | xstring Name = xitem.selectSingleNode(L"ItemName").text(); |
| | | HTREEITEM kitem = tv_1.InsertItem(pitem, 0, Name, xitem, 15); |
| | | //int kitem=tv_1.InsertChildItem(tv_1.GetId(), pitem,Name,xitem,15); |
| | | xstring HasChild = xitem.selectSingleNode(L"@HasChild").text();//item.getAttribute(L"HasChild"); |
| | | //trace(HasChild, kitem); |
| | | if (HasChild == L"1") |
| | | tv_1.SetItemChild1(kitem, 1); |
| | | } |
| | | return 1; |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int CreateRootTree() { |
| | | xstring id = L"00000000-0000-0000-0000-000000000000"; |
| | | xml x; |
| | | |
| | | int OnTreeSelChanged(ref TNotifyEvent evt,int p){ |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int sitem = nmtv.itemNew.hItem; |
| | | x.loadXML(L"<SKUItem HasChild='1' ><ID>" + id + L"</ID></SKUItem>"); |
| | | HTREEITEM hroot = tv_1.InsertItem(L"产品项目分类", x.documentElement(), 17); |
| | | //trace(hroot); |
| | | CreateSubTree(hroot); |
| | | tv_1.ExpandItemEx(hroot); |
| | | CategoryID = id; |
| | | OnReTrieve(); |
| | | return 1; |
| | | } |
| | | int OnTreeExpanding(TEvent* evt, int p) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | |
| | | 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 = ""; |
| | | HTREEITEM sitem = nmtv.itemNew.hItem; |
| | | CreateSubTree(sitem); |
| | | return 1; |
| | | } |
| | | int afterSave() { |
| | | HTREEITEM hitem = tv_1.GetSelectedItem(); |
| | | if (hitem == 0) |
| | | hitem = tv_1.GetRootItem(); |
| | | int rows = dw_list.GetRowCount(); |
| | | KXMLDOMElement ele = tv_1.GetItemData(hitem); |
| | | |
| | | OnReTrieve(); |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | HTREEITEM firstChild = tv_1.GetChildItem(hitem); |
| | | while (firstChild > 0) { |
| | | tv_1.DeleteItem(firstChild); |
| | | firstChild = tv_1.GetChildItem(hitem); |
| | | } |
| | | if (rows > 0) |
| | | { |
| | | tv_1.SetItemChild1(hitem, 1); |
| | | ele.setAttribute(L"HasChild", L"1"); |
| | | //trace(ele.xml); |
| | | tv_1.SetItemData(hitem, ele); |
| | | } |
| | | else |
| | | { |
| | | tv_1.SetItemChild1(hitem, 0); |
| | | ele.setAttribute(L"HasChild", L"0"); |
| | | //trace(ele.xml); |
| | | tv_1.SetItemData(hitem, ele); |
| | | } |
| | | CreateSubTree(hitem); |
| | | if (tv_1.GetRootItem() == hitem) |
| | | tv_1.ExpandItemEx(hitem); |
| | | |
| | | 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); |
| | | dw_list.ResetUpdateStatus(); |
| | | return 0; |
| | | } |
| | | int OnSave() |
| | | { |
| | | xml x; |
| | | |
| | | 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.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | trace(x.xml()); |
| | | xaserverarg arg; |
| | | |
| | | 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; |
| | | } |
| | | arg.AddArg(L"content", x.xml()); |
| | | arg.AddArg(L"dbmap", L"SKUItem.dbmap"); |
| | | if (xaserver::ExecXAction(GetServerUrl(), L"[onSave.xa]", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.documentElement().text()); |
| | | alert(L"保存失败"); |
| | | } |
| | | else { |
| | | alert(L"保存成功"); |
| | | } |
| | | dw_list.ResetUpdateStatus(); |
| | | dw_list.Redraw(); |
| | | afterSave(); |
| | | return 1; |
| | | } |
| | | int OnSetValue(int row) { |
| | | dw_list.SetItemString(row, L"PID", CategoryID); |
| | | dw_list.SetItemString(row, L"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 OnDeleteRow() |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if(row<0 || row>dw_list.GetRowCount()) return 0; |
| | | dw_list.DeleteRow(row); |
| | | 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 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"); |
| | | int OnDeleteRow() |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 0; |
| | | dw_list.DeleteRow(row); |
| | | return 1; |
| | | } |
| | | |
| | | OnInitial(); |
| | | CreateRootTree(); |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"Save") OnSave(); |
| | | else if (comdid == L"AddRow") OnAddRow(); |
| | | else if (comdid == L"InsertRow") OnInsertRow(); |
| | | else if (comdid == L"DeleteRow") OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&SKUItem::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&SKUItem::OnSetFocus); |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&SKUItem::OnTreeSelChanged); |
| | | AttachEvent(L"tv_1", L"TVN_ITEMEXPANDING", (FEvent)&SKUItem::OnTreeExpanding); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | m_type = L"all"; |
| | | tv_1 = new treeview; |
| | | tv_1.setNativePointer(GetControl(L"tv_1")); |
| | | dw_list = new xdwgrid; |
| | | dw_list.setNativePointer(GetControl(L"dw_list")); |
| | | dw_list.openUrl(L"其他设置.vface/template/other/SKUItem"); |
| | | |
| | | OnInitial(); |
| | | CreateRootTree(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | about SKUItemImport |
| | | [ |
| | | field: |
| | | xdwgrid__ dw_list; |
| | | treeview__ tv_1; |
| | | xdwtable__ dw_maint; |
| | | xdwgrid dw_list; |
| | | treeview tv_1; |
| | | xdwtable dw_maint; |
| | | method: |
| | | [ |
| | | |
| | | string jxParam(string p, string n) |
| | | xstring jxParam(xstring p, xstring n) |
| | | { |
| | | if(p != "") |
| | | if(p != L"") |
| | | { |
| | | |
| | | int i = 1; |
| | | while (p.find("=",0)>0) |
| | | while (p.find(L"=L",0)>0) |
| | | { |
| | | string name = p.mid(0, p.find("=",0)); |
| | | string value = p.mid(p.find("=",0) + 1, p.find("=",0) - 1); |
| | | xstring name = p.mid(0, p.find(L"=L",0)); |
| | | xstring value = p.mid(p.find(L"=L",0) + 1, p.find(L"=L",0) - 1); |
| | | return ""+value; |
| | | i += 1; |
| | | } |
| | |
| | | int OnOk() |
| | | { |
| | | |
| | | xdwtable__ dw = new xdwtable__; |
| | | dw.setNativePointer(dw_maint.FindDwTable("Item",0)); |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_maint.FindDwTable(L"Item",0)); |
| | | |
| | | int row = SKUItem::dw_list.GetNextSelectRow(1); |
| | | if (row<1) |
| | | { |
| | | alert("请选择项目名称!"); |
| | | alert(L"请选择项目名称!"); |
| | | return 1; |
| | | } |
| | | |
| | |
| | | { |
| | | |
| | | msxml::IXMLDOMElement e =SKUItem::dw_list.GetRowElement(row); |
| | | string ItemName = e.selectSingleNode("ItemName").text+""; |
| | | xstring ItemName = e.selectSingleNode(L"ItemName").text+L""; |
| | | //trace(ItemName); |
| | | if(dw.GetItemString(1,"ItemName")=="") |
| | | if(dw.GetItemString(1,L"ItemName")==L"") |
| | | { |
| | | dw.SetItemString(1,"SeqNo","1"); |
| | | dw.ItemChangeTo(1,"ItemName",ItemName); |
| | | dw.SetItemString(1,L"SeqNo",L"1"); |
| | | dw.ItemChangeTo(1,L"ItemName",ItemName); |
| | | } |
| | | else |
| | | { |
| | | int n=dw.InsertRow(0); |
| | | dw.SetItemString(n,"SeqNo",n.ToString()); |
| | | dw.ItemChangeTo(n,"ItemName",ItemName); |
| | | dw.SetItemString(n,L"SeqNo",n.ToString()); |
| | | dw.ItemChangeTo(n,L"ItemName",ItemName); |
| | | } |
| | | row = SKUItem::dw_list.GetNextSelectRow(row +1); |
| | | } |
| | |
| | | return 1; |
| | | } |
| | | |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring 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(); |
| | | if (comdid==L"SelectAll") OnSelectAll(); |
| | | else if (comdid==L"SelectNo") OnSelectNo(); |
| | | else if (comdid==L"cb_import") OnOk(); |
| | | else if (comdid==L"cb_close") OnCancel(); |
| | | //else if (comdid==L"query") GridSearch(); |
| | | return 0; |
| | | } |
| | | |
| | |
| | | { |
| | | if (GetParam()) |
| | | { |
| | | xaserverarg__ arg1=GetParam(); |
| | | dw_maint = new xdwtable__; |
| | | dw_maint.setNativePointer(arg1.GetArgString("dw_maint").toInt()); |
| | | xaserverarg arg1=GetParam(); |
| | | dw_maint = new xdwtable; |
| | | dw_maint.setNativePointer(arg1.GetArgString(L"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);//行双击 |
| | | AttachEvent(L"WM_XCOMMAND",OnXCommand); |
| | | AttachEvent(L"dw_list",L"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" |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | 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; |
| | | } |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | 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) |
| | | { |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) SKUTemplate : public xframe |
| | | { |
| | | public: |
| | | |
| | | 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() |
| | | xdwgrid dw_list; |
| | | xdwtable dw_maint; |
| | | xdwtable dw_category; |
| | | int rowno; |
| | | |
| | | xnode m_agentNode; |
| | | public: |
| | | SKUTemplate(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static SKUTemplate* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | SKUTemplate* pWin = new SKUTemplate(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | 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(); |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnSetFocus(TEvent* evt, LPARAM p) |
| | | { |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnReTrieve() |
| | | { |
| | | xstring query = L"[SKUTemplate.list.xq]"; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | if (xaserver::ExecXQuery(GetServerUrl(), query, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnRowChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int ll_row = hdr.row; |
| | | rowno = ll_row; |
| | | xstring TemplateContent = dw_list.GetItemString(ll_row, L"TemplateContent"); |
| | | xstring Category = dw_list.GetItemString(ll_row, L"Category"); |
| | | if (TemplateContent == L"") |
| | | { |
| | | dw_maint.openUrl(L"其他设置.vface/template/other/TemplateContent"); |
| | | dw_maint.SetColHeaderHeight(0); |
| | | dw_maint.SetRowSelectorWidth(0); |
| | | } |
| | | if (Category == L"") |
| | | { |
| | | dw_category.openUrl(L"其他设置.vface/template/other/TemplateCategory"); |
| | | dw_category.SetColHeaderHeight(0); |
| | | dw_category.SetRowSelectorWidth(0); |
| | | } |
| | | xml x; |
| | | |
| | | x.loadXML(TemplateContent); |
| | | xml x1; |
| | | 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; |
| | | |
| | | dw_list.DwUpdateAllToEx(x); |
| | | trace(x.xml()); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | arg.AddArg(L"dbmap", L"SKUTemplate.dbmap"); |
| | | if (xaserver::ExecXAction(GetServerUrl(), L"[onSave.xa]", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.documentElement().text()); |
| | | alert(L"保存失败"); |
| | | } |
| | | else { |
| | | alert(L"保存成功"); |
| | | } |
| | | 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, L"TemplateID", TApp::GetGuid()); |
| | | return 1; |
| | | } |
| | | int RemoveAttribute(xml x, xstring nodename)//根据名称删除属性节点 |
| | | { |
| | | KXMLDOMElement e; |
| | | var list = x.getElementsByTagName(L"" + nodename + L""); |
| | | if (list) |
| | | { |
| | | |
| | | int nlen = list.length; |
| | | int i; |
| | | for (i = 0; i < nlen; i++) |
| | | { |
| | | e = list.item(i); |
| | | //trace(e.xml); |
| | | e.removeAttribute(L"update.new"); |
| | | e.removeAttribute(L"update.modify"); |
| | | e.removeAttribute(L"update.delete"); |
| | | e.removeAttribute(L"guid"); |
| | | e.removeAttribute(L"update.origin"); |
| | | e.removeAttribute(L"isnull"); |
| | | //trace(e.xml); |
| | | } |
| | | } |
| | | } |
| | | int setMaint() |
| | | { |
| | | xml x; |
| | | |
| | | dw_maint.DwUpdateAllTo(x); |
| | | int row = dw_list.GetRow(); |
| | | trace(x.xml()); |
| | | RemoveAttribute(x, L"TemplateContent"); |
| | | RemoveAttribute(x, L"Item"); |
| | | RemoveAttribute(x, L"ItemName"); |
| | | RemoveAttribute(x, L"Remark"); |
| | | RemoveAttribute(x, L"SeqNo"); |
| | | //trace(x.xml()); |
| | | dw_list.SetItemString(row, L"TemplateContent", x.xml()); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | int setItemCategory() |
| | | { |
| | | xml x; |
| | | |
| | | dw_category.DwUpdateAllTo(x); |
| | | int row = dw_list.GetRow(); |
| | | //trace(row); |
| | | dw_list.SetItemString(row, L"Category", x.xml()); |
| | | 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(L"其他设置.vface/template/other/TemplateContent"); |
| | | dw_maint.SetColHeaderHeight(0); |
| | | dw_maint.SetRowSelectorWidth(0); |
| | | dw_category.openUrl(L"其他设置.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(L"其他设置.vface/template/other/TemplateContent"); |
| | | dw_maint.SetColHeaderHeight(0); |
| | | dw_maint.SetRowSelectorWidth(0); |
| | | dw_category.openUrl(L"其他设置.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(L"Item", 0)); |
| | | int i; |
| | | for (i = row; i <= dw.GetRowCount(); i++) |
| | | dw.SetItemString(i, L"SeqNo", xstring(i)); |
| | | 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(L"其他设置.vface/template/other/TemplateContent"); |
| | | dw_maint.SetColHeaderHeight(0); |
| | | dw_maint.SetRowSelectorWidth(0); |
| | | dw_category.openUrl(L"其他设置.vface/template/other/TemplateCategory"); |
| | | dw_category.SetColHeaderHeight(0); |
| | | dw_category.SetRowSelectorWidth(0); |
| | | return 1; |
| | | } |
| | | int RemoveChild(xml x, xstring nodename)//根据名称删除节点 |
| | | { |
| | | KXMLDOMElement e; |
| | | var list = x.selectNodes(L"//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; |
| | | |
| | | dw_maint.DwUpdateAllTo(x); |
| | | int row = dw_list.GetRow(); |
| | | //trace(x.xml()); |
| | | RemoveChild(x, L"Item"); |
| | | RemoveAttribute(x, L"TemplateContent"); |
| | | RemoveAttribute(x, L"Item"); |
| | | RemoveAttribute(x, L"ItemName"); |
| | | RemoveAttribute(x, L"Remark"); |
| | | RemoveAttribute(x, L"SeqNo"); |
| | | //trace(x.xml()); |
| | | dw_list.SetItemString(row, L"TemplateContent", x.xml()); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | int setItemCategory_removeChild() |
| | | { |
| | | xml x; |
| | | |
| | | dw_category.DwUpdateAllTo(x); |
| | | int row = dw_list.GetRow(); |
| | | RemoveChild(x, L"Item"); |
| | | //trace(row); |
| | | dw_list.SetItemString(row, L"Category", x.xml()); |
| | | 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() == L"TemplateContent") |
| | | { |
| | | OnChangeRowNo(row); |
| | | if (dw.GetRowCount() == 1 && dw.GetItemString(1, L"ItemName") == L"") |
| | | { |
| | | dw_list.SetItemString(rowno, L"TemplateContent", L""); |
| | | 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() |
| | | else |
| | | { |
| | | 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; |
| | | setMaint_removeChild(); |
| | | } |
| | | 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() |
| | | } |
| | | if (dw_1.GetDwName() == L"Categorys") |
| | | { |
| | | //trace(dw.GetRowCount()); |
| | | if (dw.GetRowCount() == 1 && dw.GetItemString(1, L"CategoryID") == L"") |
| | | { |
| | | 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; |
| | | dw_list.SetItemString(rowno, L"Category", L""); |
| | | dw_list.Redraw(); |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| | | else |
| | | { |
| | | setItemCategory_removeChild(); |
| | | } |
| | | |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int SKUItem() |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"dw_maint", dw_maint.nativept.toString()); |
| | | openUrl(L"其他设置.vface/xpage/SKUItem/select", arg); |
| | | return 1; |
| | | } |
| | | int SKUItemcategory() |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"dw_category", dw_category.nativept.toString()); |
| | | openUrl(L"其他设置.vface/xpage/SKUItemcategory/select", arg); |
| | | return 1; |
| | | } |
| | | int SKUItemModify() |
| | | { |
| | | openUrl(L"其他设置.vface/xpage/SKUItem/list"); |
| | | return 1; |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"save") OnSave(); |
| | | else if (comdid == L"AddRow") OnAddRow(); |
| | | else if (comdid == L"InsertRow") OnInsertRow(); |
| | | else if (comdid == L"DeleteRow") OnDeleteRow(); |
| | | else if (comdid == L"SKUItem") SKUItem(); |
| | | else if (comdid == L"SKUItemcategory") SKUItemcategory(); |
| | | else if (comdid == L"del_1") del(dw_maint); |
| | | else if (comdid == L"del_2") del(dw_category); |
| | | else if (comdid == L"SKUItemModify") SKUItemModify(); |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnMaintChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | //trace(L"hello"); |
| | | setMaint(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnCategoryChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | setItemCategory(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&SKUTemplate::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&SKUTemplate::OnSetFocus); |
| | | AttachEvent(L"dw_maint", L"DWV_ITEMCHANGED", (FEvent)&SKUTemplate::OnMaintChanged); |
| | | AttachEvent(L"dw_category", L"DWV_ITEMCHANGED", (FEvent)&SKUTemplate::OnCategoryChanged); |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&SKUTemplate::OnRowChanged); |
| | | |
| | | return 1; |
| | | } |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | int onload() |
| | | { |
| | | dw_list = new xdwgrid; |
| | | dw_list.setNativePointer(GetControl(L"dw_list")); |
| | | dw_list.openUrl(L"其他设置.vface/template/other/SKUTemplate"); |
| | | |
| | | dw_maint = new xdwtable; |
| | | dw_maint.setNativePointer(GetControl(L"dw_maint")); |
| | | dw_maint.openUrl(L"其他设置.vface/template/other/TemplateContent"); |
| | | dw_maint.SetColHeaderHeight(0); |
| | | dw_maint.SetRowSelectorWidth(0); |
| | | |
| | | dw_category = new xdwtable; |
| | | dw_category.setNativePointer(GetControl(L"dw_category")); |
| | | dw_category.openUrl(L"其他设置.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(L"Item", 0)); |
| | | //trace(dw.GetRowCount()); |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | about SKUTemplateImport |
| | | [ |
| | | field: |
| | | xdwgrid__ dw_list; |
| | | xdwtable__ dw_other; |
| | | xdwtable__ dw_prop; |
| | | xdwgrid dw_list; |
| | | xdwtable dw_other; |
| | | xdwtable dw_prop; |
| | | method: |
| | | [ |
| | | |
| | | string jxParam(string p, string n) |
| | | xstring jxParam(xstring p, xstring n) |
| | | { |
| | | if(p != "") |
| | | if(p != L"") |
| | | { |
| | | |
| | | int i = 1; |
| | | while (p.find("=",0)>0) |
| | | while (p.find(L"=L",0)>0) |
| | | { |
| | | string name = p.mid(0, p.find("=",0)); |
| | | string value = p.mid(p.find("=",0) + 1, p.find("=",0) - 1); |
| | | xstring name = p.mid(0, p.find(L"=L",0)); |
| | | xstring value = p.mid(p.find(L"=L",0) + 1, p.find(L"=L",0) - 1); |
| | | return ""+value; |
| | | i += 1; |
| | | } |
| | |
| | | |
| | | int OnOk() |
| | | { |
| | | dw_other.openUrl("/sale/view/CustomerGoods/template/CustomerGoods/itemother"); |
| | | dw_other.openUrl(L"/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("请选择模板!"); |
| | | alert(L"请选择模板!"); |
| | | return 1; |
| | | } |
| | | |
| | | msxml::IXMLDOMElement e =SKUTemplate::dw_list.GetRowElement(row); |
| | | string TemplateContent = e.selectSingleNode("TemplateContent").text+""; |
| | | string TemplateID = e.selectSingleNode("TemplateID").text+""; |
| | | xstring TemplateContent = e.selectSingleNode(L"TemplateContent").text+L""; |
| | | xstring TemplateID = e.selectSingleNode(L"TemplateID").text+L""; |
| | | //trace(ItemName); |
| | | xml__ x = new xml__; |
| | | xml x = new xml; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | x.LoadXml(TemplateContent); |
| | | dw_other.Retrieve(x); |
| | | dw_prop.SetItemString(1,"TemplateID",TemplateID); |
| | | dw_prop.SetItemString(1,L"TemplateID",TemplateID); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | |
| | | return 1; |
| | | } |
| | | |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring 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(); |
| | | if (comdid==L"SelectAll") OnSelectAll(); |
| | | else if (comdid==L"SelectNo") OnSelectNo(); |
| | | else if (comdid==L"cb_import") OnOk(); |
| | | else if (comdid==L"cb_close") OnCancel(); |
| | | //else if (comdid==L"query") GridSearch(); |
| | | return 0; |
| | | } |
| | | |
| | |
| | | if (GetParam()) |
| | | { |
| | | int iArgs = GetParam(); |
| | | xaserverarg__ arg1 = new xaserverarg__; |
| | | 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()); |
| | | dw_other = new xdwtable; |
| | | dw_other.setNativePointer(arg1.GetArgString(L"dw_other").toInt()); |
| | | dw_prop = new xdwtable; |
| | | dw_prop.setNativePointer(arg1.GetArgString(L"dw_prop").toInt()); |
| | | } |
| | | //trace(dw_other.__nativept); |
| | | //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);//行双击 |
| | | AttachEvent(L"WM_XCOMMAND",OnXCommand); |
| | | AttachEvent(L"dw_list",L"DWV_DOUBLECLICKED",OnDoubleClicked);//行双击 |
| | | } |
| | | ] |
| | | ] |
| | |
| | | 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); |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | } |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | ] |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) ShipcompanyList : public xwin |
| | | { |
| | | public: |
| | | ShipcompanyList(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static ShipcompanyList* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | ShipcompanyList* pWin = new ShipcompanyList(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int onload() |
| | | { |
| | | list::onload(); |
| | | return -1; |
| | | } |
| | | |
| | | int ViewUpdate(param pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"del") |
| | | { |
| | | int DelRow = dw_list.GetRow(); |
| | | 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) |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) ShipcompanyMaint : public xframe |
| | | { |
| | | public: |
| | | KXMLDOMDocument m_configDoc; |
| | | xstring m_userid; |
| | | xstring m_username; |
| | | xstring ContactID; |
| | | xdwtable dw_base; |
| | | xcell dw_cell; |
| | | public: |
| | | ShipcompanyMaint(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static ShipcompanyMaint* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | ShipcompanyMaint* pWin = new ShipcompanyMaint(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int alert(xstring str) |
| | | { |
| | | //win::MessageBox(GetHWND(),str,L"提示22:",0); |
| | | TApp::alert(this, str); |
| | | return 0; |
| | | } |
| | | int setCellReadOnly() |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | dw_cell = new xcell; |
| | | dw_cell.setNativePointer(dw_base.QueryItem(L"ixcell")); |
| | | xstring strnew = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''/>"; |
| | | dw_cell.SetCellProps(2, 2, strnew); |
| | | return 0; |
| | | } |
| | | int OnSetFocus(TEvent* evt, LPARAM p) |
| | | { |
| | | SetAgent(L"maint"); |
| | | return 1; |
| | | } |
| | | xstring GetGuid() { |
| | | return TApp::GetGuid(); |
| | | } |
| | | int OnClear() { |
| | | if (m_EntityID == L"") { |
| | | m_userid = TApp::GetUserInfo().id; |
| | | m_username = TApp::GetUserInfo().name; |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | dw_base.SetItemString(1, L"PartyID", GetGuid()); |
| | | dw_base.SetItemString(1, L"PStatus", L"1"); |
| | | dw_base.SetItemDisplayString(1, L"PStatus", L"有效"); |
| | | dw_base.SetItemString(1, L"CreatorID", m_userid); |
| | | dw_base.SetItemString(1, L"PADStatus", L"1"); |
| | | dw_base.SetItemString(1, L"Type", L"6"); |
| | | dw_base.SetItemString(1, L"AddressID", GetGuid()); |
| | | dw_base.SetItemString(1, L"PADIdentifyAddressFlag", L"Y"); |
| | | dw_base.SetItemString(1, L"PrimaryFlag", L"Y"); |
| | | dw_base.SetItemString(1, L"EnterName", m_userid); |
| | | dw_base.SetItemDisplayString(1, L"EnterName", m_username); |
| | | dw_base.SetItemString(1, L"CreateDate", TApp::GetCurDate()); |
| | | } |
| | | else |
| | | { |
| | | setCellReadOnly(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnAddrow() |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"item") |
| | | { |
| | | dw.InsertRow(0); |
| | | int rows = dw.GetRowCount(); |
| | | dw.SetRow(rows); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnInsertRow() |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"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(GetControl(L"dw_base")); |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"item") |
| | | { |
| | | int row = dw.GetRow(); |
| | | if (row < 1) return 0; |
| | | /*xstring del = dw.GetItemString(row,8); |
| | | if(del!=L"") |
| | | { |
| | | //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()); |
| | | if(m_dels==L"") |
| | | { |
| | | m_dels=del; |
| | | } |
| | | else |
| | | { |
| | | setCellReadOnly(); |
| | | } |
| | | return 0; |
| | | } |
| | | xstring temp=m_dels; |
| | | m_dels=del + L"|" + temp; |
| | | //+= L"|"+del; |
| | | } |
| | | |
| | | 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.DeleteRow(row); |
| | | dw.SetRow(row - 1); |
| | | } |
| | | return 1; |
| | | } |
| | | xstring getGoodsNo() |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | if (getUrl(L"/sale/data/LogisticsCode/pref/shipcompany/PartyNo", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.xml()); |
| | | return L""; |
| | | } |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (e) |
| | | { |
| | | xstring code = e.text(); |
| | | trace(code); |
| | | return L"P" + code; |
| | | } |
| | | return L"P1000"; |
| | | } |
| | | int OnPreSave() |
| | | { |
| | | dw_base.AcceptText(); |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | xstring ShipNo = dw_base.GetItemString(1, L"ShipNo"); |
| | | if (ShipNo == L"") |
| | | { |
| | | dw_base.SetItemString(1, L"ShipNo", getGoodsNo()); |
| | | } |
| | | xdwtable dwcon = new xdwtable; |
| | | dwcon.setNativePointer(dw_base.FindDwTable(L"item", 0)); |
| | | int i; |
| | | for (i = 1; i <= dwcon.GetRowCount(); i++) |
| | | { |
| | | xstring aTemp; |
| | | xstring aName = dwcon.GetItemString(i, L"ContacterName"); |
| | | trace(aName); |
| | | if (aName == L"") |
| | | { |
| | | 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") |
| | | aTemp = dwcon.GetItemString(i, L"Mobile") + dwcon.GetItemString(i, L"TEL") + dwcon.GetItemString(i, L"Fax") + dwcon.GetItemString(i, L"Email") + dwcon.GetItemString(i, L"PCRemark"); |
| | | trace(aTemp); |
| | | if (aTemp != L"") |
| | | { |
| | | 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("请输入船公司名称!"); |
| | | alert(L"联系人名称必填!"); |
| | | 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) |
| | | } |
| | | else { |
| | | xstring ContactID = dwcon.GetItemString(i, L"ContactID"); |
| | | if (ContactID == L"") |
| | | { |
| | | 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(); |
| | | dwcon.SetItemString(i, L"ContactID", GetGuid()); |
| | | dwcon.SetItemString(i, L"PCStatus", L"1"); |
| | | dw_base.SetItemString(1, L"PrimaryContactID", dwcon.GetItemString(1, L"ContactID")); |
| | | } |
| | | dw_base.Redraw(); |
| | | //m_dels=""; |
| | | return 0; |
| | | } |
| | | int OnCmdDispatch(string comdid) |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int OnSave() |
| | | { |
| | | |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | xstring SName = dw_base.GetItemString(1, L"Name"); |
| | | if (SName == L"") { |
| | | alert(L"请输入船公司名称!"); |
| | | return -1; |
| | | } |
| | | int rec = OnPreSave(); |
| | | if (rec == -1) return -1; |
| | | xml x; |
| | | |
| | | dw_base.DwUpdateAllTo(x); |
| | | trace(x.xml()); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | arg.AddArg(L"dbmap", L"Shipcompany.dbmap"); |
| | | //arg.AddArg(L"m_dels",m_dels); |
| | | |
| | | if (getUrl(L"/sale/data/LogisticsCode/entity/shipcompany/save", arg.GetString(), x) != 1) |
| | | { |
| | | trace(L"error:" + (xstring)x.xml()); |
| | | alert(L"保存失败!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | trace(x.xml()); |
| | | if (x.selectSingleNode(L"error")) |
| | | { |
| | | 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(); |
| | | } |
| | | alert(L"保存出错2!"); |
| | | return 0; |
| | | } |
| | | alert(L"保存成功!"); |
| | | dw_base.ResetUpdateStatus(); |
| | | setCellReadOnly(); |
| | | } |
| | | dw_base.Redraw(); |
| | | //m_dels=L""; |
| | | return 0; |
| | | } |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | trace(comdid); |
| | | if (comdid.find(L"action:bill.row.add", 0) >= 0) { |
| | | OnAddrow(); |
| | | } |
| | | else if (comdid.find(L"bill.row.insert", 0) >= 0) { |
| | | OnInsertRow(); |
| | | } |
| | | else if (comdid.find(L"bill.row.delete", 0) >= 0) { |
| | | OnDeleteRow(); |
| | | } |
| | | else if (comdid.find(L"bill.save", 0) >= 0) { |
| | | //trace(1); |
| | | dw_base.AcceptText(); |
| | | OnSave(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | int OnCellChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring colname = hdr.colname; |
| | | //trace(colname); |
| | | if (colname == L"ShipNo") |
| | | { |
| | | xstring cspec = dw_base.GetItemString(1, 1); |
| | | trace(cspec); |
| | | xstring SpecRule = L"^\\d*$"; |
| | | xaserverarg args; |
| | | |
| | | args.AddArg(L"CSpec", cspec); |
| | | args.AddArg(L"SpecRule", SpecRule); |
| | | xml x; |
| | | |
| | | getUrl(L"/sale/data/LogisticsCode/pref/forwarderno/check", args.GetString(), x); |
| | | if (x.selectSingleNode(L"root/spec")) |
| | | { |
| | | alert(L"请输入数字!"); |
| | | 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; |
| | | } |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&ShipcompanyMaint::OnXCommand); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&ShipcompanyMaint::OnSetFocus); |
| | | AttachEvent(L"dw_base", L"DWV_ITEMCHANGED", (FEvent)&ShipcompanyMaint::OnCellChanged); |
| | | return 1; |
| | | } |
| | | |
| | | maint::onload(); |
| | | |
| | | OnClear(); |
| | | |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| | | int onload() |
| | | { |
| | | |
| | | OnAttachEvent(); |
| | | //if(!m_configDoc) return -1; |
| | | |
| | | maint::onload(); |
| | | |
| | | OnClear(); |
| | | |
| | | } |
| | | }; |
| | |
| | | use "frame.vd" |
| | | use "publiccode.vd" |
| | | use "xcontrol.vd" |
| | | use "xtreeview.vd" |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | class SimpleMenuConfig : public frame |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | |
| | | class __declspec(dllexport) SimpleMenuConfig : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xtreeview tv_gs; |
| | | |
| | | xnode m_agentNode; |
| | | public: |
| | | SimpleMenuConfig(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static SimpleMenuConfig* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | SimpleMenuConfig* pWin = new SimpleMenuConfig(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int AddRow() |
| | | { |
| | | dw_list.InsertRow(0); |
| | |
| | | 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()); |
| | | xstring seq = dw_list.GetItemString(i, L"SeqNo"); |
| | | if(seq != xstring(i)) |
| | | dw_list.SetItemString(i, L"SeqNo", xstring(i)); |
| | | } |
| | | |
| | | 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("保存失败!"); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | dw_list.DwUpdateAllToEx(x); |
| | | arg.AddArg(L"content", x.xml()); |
| | | if(getUrl(L"/workflow/action/ItemPictureMenu.dbmap/bill.update", arg.GetString(), x) != 1) |
| | | alert(L"保存失败!"); |
| | | else |
| | | { |
| | | string str = x.GetXml(); |
| | | xstring str = x.xml(); |
| | | //alert(str); |
| | | if(str.find("失败", 0) > 0) |
| | | alert("保存失败!"); |
| | | if(str.find(L"失败", 0) > 0) |
| | | alert(L"保存失败!"); |
| | | else |
| | | { |
| | | //alert("保存成功!"); |
| | | //alert(L"保存成功!"); |
| | | dw_list.ResetUpdateStatus(); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | int hItem = xtreeview::GetSelectedItem(tv_gs.GetId()); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | HTREEITEM hItem =tv_gs.GetSelectedItem(); |
| | | if(hItem > 0) |
| | | { |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | int p = trust(e as int); |
| | | xtreeview::SetItemData(tv_gs.GetId(), hItem, p); |
| | | KXMLDOMElement e = x.documentElement(); |
| | | int p = trust(e); |
| | | tv_gs.SetItemData(hItem, p); |
| | | |
| | | while(xtreeview::GetChildItem(tv_gs.GetId(), hItem) > 0) |
| | | xtreeview::DeleteItem(tv_gs.GetId(), xtreeview::GetChildItem(tv_gs.GetId(), hItem)); |
| | | while(tv_gs.GetChildItem( hItem) > 0) |
| | | tv_gs.DeleteItem(tv_gs.GetChildItem( hItem)); |
| | | |
| | | msxml::IXMLDOMNodeList li = x.GetXmlDoc().selectNodes("item/item"); |
| | | int s = li.length; |
| | | KXMLDOMNodeList li = x.selectNodes(L"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); |
| | | KXMLDOMElement ele = li.item(i); |
| | | int pa = trust(ele); |
| | | xstring name = ele.selectSingleNode(L"Name").text(); |
| | | HTREEITEM cItem =tv_gs.InsertChildItem( hItem, name, pa, 15); |
| | | if(ele.selectSingleNode(L"item")) |
| | | tv_gs.SetItemChild1(cItem, 1); |
| | | } |
| | | } |
| | | |
| | |
| | | return 1; |
| | | } |
| | | |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring 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(); |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | if(comdid == L"AddRow") AddRow(); |
| | | else if(comdid == L"InsertRow") InsertRow(); |
| | | else if(comdid == L"DeleteRow") DeleteRow(); |
| | | else if(comdid == L"Save") Save(); |
| | | else if(comdid == L"UpRow") UpRow(); |
| | | else if(comdid == L"DownRow") DownRow(); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 0; |
| | | } |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"/*"); |
| | | if(agent) |
| | | if (m_agentNode) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent(anode,s); |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnSetFocus(ref TEvent evt,int p) |
| | | int OnSetFocus(TEvent* evt, LPARAM p) |
| | | { |
| | | SetAgent() ; |
| | | return 1; |
| | | } |
| | | |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TNotifyEvent evt,int p) |
| | | int OnTreeSelChanged(TEvent* evt, LPARAM 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; |
| | | |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM hItem = nmtv.itemNew.hItem; |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)tv_gs.GetItemData(hItem); |
| | | //trace(L"%s", e.xml); |
| | | //xstring id = e.selectSingleNode(L"MenuID").text(); |
| | | dw_list.AcceptText(); |
| | | dw_list.Retrieve(e); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeMoveNode(ref TNotifyEvent evt,int p) |
| | | int OnTreeMoveNode(TEvent* evt, LPARAM p) |
| | | { |
| | | ref TVNNMHDR nmtv = trust(evt.pnmh as ref TVNNMHDR); |
| | | int xfrom = nmtv.FromItem; |
| | | int xto = nmtv.ToItem; |
| | | TVNNMHDR& nmtv = *(TVNNMHDR*)evt->notify.pnmh; |
| | | HTREEITEM xfrom = nmtv.FromItem; |
| | | HTREEITEM xto = nmtv.ToItem; |
| | | |
| | | int ret = xwin::MessageBox(this.GetHWND(), "确定移动节点!","提示:",1); |
| | | int ret = MessageBox(GetHWND(), L"确定移动节点!",L"提示:",1); |
| | | //trace(ret); |
| | | if(ret == 2) |
| | | { |
| | | xtreeview::DeleteItem(tv_gs.GetId(), xto); |
| | | tv_gs.DeleteItem(xto); |
| | | return -1; |
| | | } |
| | | KXMLDOMElement& fid = *(KXMLDOMElement*)tv_gs.GetItemData(xto); |
| | | HTREEITEM xpto =tv_gs.GetParentItem(xto); |
| | | KXMLDOMElement& tid = *(KXMLDOMElement*)tv_gs.GetItemData(xto); |
| | | //trace(L"%s-------------------------%s",fid.xml,tid.xml); |
| | | xml x ; |
| | | |
| | | 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()); |
| | | xaserverarg arg; |
| | | |
| | | |
| | | 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')"; |
| | | xstring id1 = fid.selectSingleNode(L"@guid").text(); |
| | | xstring id2 = tid.selectSingleNode(L"@guid").text(); |
| | | //trace(L"%s-------------------------%s",id1,id2); |
| | | xstring str = L"update ItemPictureMenu set parentid='"+id2+L"' where menuid='"+id1+L"' "; |
| | | str += L" select 1 for xml path('root')L"; |
| | | |
| | | arg.AddArg("sql", str); |
| | | arg.AddArg(L"sql", str); |
| | | if(getSql(arg.GetString(),x)!=1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("移动节点出错!"); |
| | | xtreeview::DeleteItem(tv_gs.GetId(), xto); |
| | | trace(L"error:"+(xstring)x.xml()); |
| | | alert(L"移动节点出错!"); |
| | | tv_gs.DeleteItem(xto); |
| | | return 0; |
| | | } |
| | | //trace("================"); |
| | | //trace(L"================L"); |
| | | // |
| | | 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+"']"); |
| | | HTREEITEM xpfrom =tv_gs.GetParentItem(xfrom); |
| | | //trace(L"%d", xpfrom); |
| | | KXMLDOMElement& fe = *(KXMLDOMElement*)tv_gs.GetItemData(xpfrom); |
| | | //trace(L"%s-------------------------%s",fe.xml,tid.xml); |
| | | KXMLDOMElement fe1 = fe.selectSingleNode(L"item[@guid='"+id1+L"']"); |
| | | fe.removeChild(fe1); |
| | | tid.appendChild(fid); |
| | | |
| | | xtreeview::DeleteItem(tv_gs.GetId(), xfrom); |
| | | tv_gs.DeleteItem(xfrom); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | int rItem = xtreeview::GetRootItem(tv_gs.GetId()); |
| | | xtreeview::ExpandItemEx(tv_gs.GetId(), rItem); |
| | | xtreeview::ItemFocus(tv_gs.GetId(), rItem); |
| | | HTREEITEM rItem =tv_gs.GetRootItem(); |
| | | tv_gs.ExpandItemEx( rItem); |
| | | tv_gs.ItemFocus(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); |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&SimpleMenuConfig::OnXCommand); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&SimpleMenuConfig::OnSetFocus); |
| | | AttachEvent(L"tv_gs",L"TVN_SELCHANGED", (FEvent)&SimpleMenuConfig::OnTreeSelChanged); |
| | | AttachEvent(L"tv_gs", L"TVN_ENDDRAG", (FEvent)&SimpleMenuConfig::OnTreeMoveNode); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.openUrl("/sale/view/SimpleProduct/template/Simple/Menu"); |
| | | dw_list.SetColumnState("SeqNo", false); |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/SimpleProduct/template/Simple/Menu"); |
| | | dw_list.SetColumnState(L"SeqNo", false); |
| | | |
| | | tv_gs = GetControl("tv_gs"); |
| | | tv_gs = GetControl(L"tv_gs"); |
| | | |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | |
| | | 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); |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | } |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | ] |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) TestingCompanyList : public xwin |
| | | { |
| | | public: |
| | | TestingCompanyList(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static TestingCompanyList* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | TestingCompanyList* pWin = new TestingCompanyList(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int onload() |
| | | { |
| | | list::onload(); |
| | | return -1; |
| | | } |
| | | |
| | | int ViewUpdate(param pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"del") |
| | | { |
| | | int DelRow = dw_list.GetRow(); |
| | | 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) |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) TestingCompanyMaint : public xframe |
| | | { |
| | | public: |
| | | KXMLDOMDocument m_configDoc; |
| | | xstring m_userid; |
| | | xstring m_username; |
| | | xstring ContactID; |
| | | xdwtable dw_base; |
| | | xcell dw_cell; |
| | | public: |
| | | TestingCompanyMaint(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static TestingCompanyMaint* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | TestingCompanyMaint* pWin = new TestingCompanyMaint(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int alert(xstring str) |
| | | { |
| | | //win::MessageBox(GetHWND(),str,L"提示22:",0); |
| | | TApp::alert(this, str); |
| | | return 0; |
| | | } |
| | | int setCellReadOnly() |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | dw_cell = new xcell; |
| | | dw_cell.setNativePointer(dw_base.QueryItem(L"ixcell")); |
| | | xstring strnew = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''/>"; |
| | | dw_cell.SetCellProps(2, 2, strnew); |
| | | return 0; |
| | | } |
| | | int OnSetFocus(TEvent* evt, LPARAM p) |
| | | { |
| | | SetAgent(L"maint"); |
| | | return 1; |
| | | } |
| | | xstring GetGuid() { |
| | | return TApp::GetGuid(); |
| | | } |
| | | int OnClear() { |
| | | if (m_EntityID == L"") { |
| | | m_userid = TApp::GetUserInfo().id; |
| | | m_username = TApp::GetUserInfo().name; |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | dw_base.SetItemString(1, L"PartyID", GetGuid()); |
| | | dw_base.SetItemString(1, L"PStatus", L"1"); |
| | | dw_base.SetItemDisplayString(1, L"PStatus", L"有效"); |
| | | dw_base.SetItemString(1, L"CreatorID", m_userid); |
| | | dw_base.SetItemString(1, L"PADStatus", L"1"); |
| | | dw_base.SetItemString(1, L"Type", L"20"); |
| | | dw_base.SetItemString(1, L"AddressID", GetGuid()); |
| | | dw_base.SetItemString(1, L"PADIdentifyAddressFlag", L"Y"); |
| | | dw_base.SetItemString(1, L"PrimaryFlag", L"Y"); |
| | | dw_base.SetItemString(1, L"EnterName", m_userid); |
| | | dw_base.SetItemDisplayString(1, L"EnterName", m_username); |
| | | dw_base.SetItemString(1, L"CreateDate", TApp::GetCurDate()); |
| | | } |
| | | else |
| | | { |
| | | setCellReadOnly(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnAddrow() |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"item") |
| | | { |
| | | dw.InsertRow(0); |
| | | int rows = dw.GetRowCount(); |
| | | dw.SetRow(rows); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnInsertRow() |
| | | { |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"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(GetControl(L"dw_base")); |
| | | xdwtable dw = new xdwtable; |
| | | dw.setNativePointer(dw_base.GetCurTable()); |
| | | xstring dw_n = dw.GetDwName(); |
| | | if (dw_n == L"item") |
| | | { |
| | | int row = dw.GetRow(); |
| | | if (row < 1) return 0; |
| | | /*xstring del = dw.GetItemString(row,8); |
| | | if(del!=L"") |
| | | { |
| | | //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()); |
| | | if(m_dels==L"") |
| | | { |
| | | m_dels=del; |
| | | } |
| | | else |
| | | { |
| | | setCellReadOnly(); |
| | | } |
| | | return 0; |
| | | } |
| | | xstring temp=m_dels; |
| | | m_dels=del + L"|" + temp; |
| | | //+= L"|"+del; |
| | | } |
| | | |
| | | 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.DeleteRow(row); |
| | | dw.SetRow(row - 1); |
| | | } |
| | | return 1; |
| | | } |
| | | xstring getGoodsNo() |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | if (getUrl(L"/sale/data/LogisticsCode/pref/shipcompany/PartyNo", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.xml()); |
| | | return L""; |
| | | } |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (e) |
| | | { |
| | | xstring code = e.text(); |
| | | trace(code); |
| | | return L"P" + code; |
| | | } |
| | | return L"P1000"; |
| | | } |
| | | int OnPreSave() |
| | | { |
| | | dw_base.AcceptText(); |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | xstring ShipNo = dw_base.GetItemString(1, L"ShipNo"); |
| | | if (ShipNo == L"") |
| | | { |
| | | dw_base.SetItemString(1, L"ShipNo", getGoodsNo()); |
| | | } |
| | | xdwtable dwcon = new xdwtable; |
| | | dwcon.setNativePointer(dw_base.FindDwTable(L"item", 0)); |
| | | int i; |
| | | for (i = 1; i <= dwcon.GetRowCount(); i++) |
| | | { |
| | | xstring aTemp; |
| | | xstring aName = dwcon.GetItemString(i, L"ContacterName"); |
| | | trace(aName); |
| | | if (aName == L"" ) |
| | | { |
| | | 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") |
| | | aTemp = dwcon.GetItemString(i, L"Mobile") + dwcon.GetItemString(i, L"TEL") + dwcon.GetItemString(i, L"Fax") + dwcon.GetItemString(i, L"Email") + dwcon.GetItemString(i, L"PCRemark"); |
| | | trace(aTemp); |
| | | if (aTemp != L"") |
| | | { |
| | | 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("请输入船公司名称!"); |
| | | alert(L"联系人名称必填!"); |
| | | 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) |
| | | } |
| | | else { |
| | | xstring ContactID = dwcon.GetItemString(i, L"ContactID"); |
| | | if (ContactID == L"" ) |
| | | { |
| | | 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(); |
| | | dwcon.SetItemString(i, L"ContactID", GetGuid()); |
| | | dwcon.SetItemString(i, L"PCStatus", L"1"); |
| | | dw_base.SetItemString(1, L"PrimaryContactID", dwcon.GetItemString(1, L"ContactID")); |
| | | } |
| | | dw_base.Redraw(); |
| | | //m_dels=""; |
| | | return 0; |
| | | } |
| | | int OnCmdDispatch(string comdid) |
| | | |
| | | |
| | | |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int OnSave() |
| | | { |
| | | |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | xstring SName = dw_base.GetItemString(1, L"Name"); |
| | | if (SName == L"") { |
| | | alert(L"请输入船公司名称!"); |
| | | return -1; |
| | | } |
| | | int rec = OnPreSave(); |
| | | if (rec == -1) return -1; |
| | | xml x; |
| | | |
| | | dw_base.DwUpdateAllTo(x); |
| | | trace(x.xml()); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | arg.AddArg(L"dbmap", L"Shipcompany.dbmap"); |
| | | //arg.AddArg(L"m_dels",m_dels); |
| | | |
| | | if (getUrl(L"/sale/data/LogisticsCode/entity/shipcompany/save", arg.GetString(), x) != 1) |
| | | { |
| | | trace(L"error:" +(xstring)x.xml()); |
| | | alert(L"保存失败!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | trace(x.xml()); |
| | | if (x.selectSingleNode(L"error")) |
| | | { |
| | | 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(); |
| | | } |
| | | alert(L"保存出错2!"); |
| | | return 0; |
| | | } |
| | | alert(L"保存成功!"); |
| | | dw_base.ResetUpdateStatus(); |
| | | setCellReadOnly(); |
| | | } |
| | | dw_base.Redraw(); |
| | | //m_dels=L""; |
| | | return 0; |
| | | } |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | trace(comdid); |
| | | if (comdid.find(L"action:bill.row.add", 0) >= 0) { |
| | | OnAddrow(); |
| | | } |
| | | else if (comdid.find(L"bill.row.insert", 0) >= 0) { |
| | | OnInsertRow(); |
| | | } |
| | | else if (comdid.find(L"bill.row.delete", 0) >= 0) { |
| | | OnDeleteRow(); |
| | | } |
| | | else if (comdid.find(L"bill.save", 0) >= 0) { |
| | | //trace(1); |
| | | dw_base.AcceptText(); |
| | | OnSave(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | int OnCellChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | |
| | | dw_base = new xdwtable; |
| | | dw_base.setNativePointer(GetControl(L"dw_base")); |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring colname = hdr.colname; |
| | | //trace(colname); |
| | | if (colname == L"ShipNo") |
| | | { |
| | | xstring cspec = dw_base.GetItemString(1, 1); |
| | | trace(cspec); |
| | | xstring SpecRule = L"^\\d*$"; |
| | | xaserverarg args; |
| | | |
| | | args.AddArg(L"CSpec", cspec); |
| | | args.AddArg(L"SpecRule", SpecRule); |
| | | xml x = new xml; |
| | | |
| | | getUrl(L"/sale/data/LogisticsCode/pref/forwarderno/check", args.GetString(), x); |
| | | if (x.selectSingleNode(L"root/spec")) |
| | | { |
| | | alert(L"请输入数字!"); |
| | | 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; |
| | | } |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&TestingCompanyMaint::OnXCommand); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&TestingCompanyMaint::OnSetFocus); |
| | | AttachEvent(L"dw_base", L"DWV_ITEMCHANGED", (FEvent)&TestingCompanyMaint::OnCellChanged); |
| | | return 1; |
| | | } |
| | | |
| | | maint::onload(); |
| | | |
| | | OnClear(); |
| | | |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| | | int onload() |
| | | { |
| | | |
| | | OnAttachEvent(); |
| | | //if(!m_configDoc) return -1; |
| | | |
| | | maint::onload(); |
| | | |
| | | OnClear(); |
| | | |
| | | } |
| | | }; |
| | |
| | | use "frame.vl" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "file.vl" |
| | | use "dev:vm[xutil.vm]" |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xlayersheet.hpp> |
| | | |
| | | 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; |
| | | } |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | int onload() |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) brand_regtype : public xframe |
| | | { |
| | | public: |
| | | xdwtable dw_list; |
| | | xnode m_agentNode; |
| | | public: |
| | | brand_regtype(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static brand_regtype* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | brand_regtype* pWin = new brand_regtype(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | 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; |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | ] |
| | | ] |
| | | ] |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | xdwtable getDw() |
| | | { |
| | | xdwtable dw1 = new xdwtable; |
| | | dw1.setNativePointer(dw_list.FindDwTable(L"item")); |
| | | return dw1; |
| | | } |
| | | |
| | | int addRow() |
| | | { |
| | | xdwtable dw = getDw(); |
| | | int row = dw.InsertRow(0); |
| | | xstring no = L"2"; |
| | | if (row > 1) |
| | | no = dw.GetItemString(row - 1, L"RegTypeID"); |
| | | int n = no.toInt(); |
| | | int h = n + 1; |
| | | dw.SetItemString(row, L"RegTypeID", xstring(h)); |
| | | return 1; |
| | | } |
| | | int deleteRow() |
| | | { |
| | | xdwtable dw = getDw(); |
| | | int row = dw.GetRow(); |
| | | if (row < 1 || row > dw.GetRowCount()) return -1; |
| | | if (MessageBox(GetHWND(), L"是否删除选择的记录行?", L"提示", 4) == 7) |
| | | return 1; |
| | | dw.DeleteRow(row); |
| | | return 1; |
| | | } |
| | | int save() |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllTo(x); |
| | | KXMLDOMElement e = x.documentElement(); |
| | | //trace(e.xml); |
| | | arg.AddArg(L"content", e.xml()); |
| | | if (getUrl(L"/workflow/action/BrandRegType.dbmap/bill.update", arg.GetString(), x) != 1) |
| | | { |
| | | alert(L"保存失败!"); |
| | | return -1; |
| | | } |
| | | //trace(x.xml()); |
| | | xstring str = x.xml(); |
| | | if (str.find(L"保存成功", 0) > 0) |
| | | { |
| | | alert(L"保存成功"); |
| | | dw_list.ResetUpdateStatus(); |
| | | dw_list.Redraw(); |
| | | } |
| | | else |
| | | alert(L"保存失败0!"); |
| | | return 1; |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | if (comdid == L"xmNew") addRow(); |
| | | else if (comdid == L"xmDelete") deleteRow(); |
| | | else if (comdid == L"xmSave") save(); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnSetFocus(TEvent* evt, LPARAM p) |
| | | { |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&brand_regtype::OnXCommand); |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&brand_regtype::OnSetFocus); |
| | | |
| | | return 1; |
| | | } |
| | | int Initail() |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | xml x; |
| | | if (getUrl(L"/sale/data/brand/entity/regtype", arg.GetString(), x) != 1) |
| | | { |
| | | alert(L"初始化查询失败!"); |
| | | return -1; |
| | | } |
| | | //trace(x.xml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = new xdwtable; |
| | | dw_list.setNativePointer(GetControl(L"dw_list")); |
| | | dw_list.openUrl(L"/sale/view/brand/template/regtype"); |
| | | //dw_list.SetColHeaderHeight(0); |
| | | dw_list.SetRowSelectorWidth(0); |
| | | |
| | | OnAttachEvent(); |
| | | SetAgent(); |
| | | Initail(); |
| | | return -1; |
| | | } |
| | | }; |