|  |  | 
 |  |  | 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 listwin | 
 |  |  | { | 
 |  |  | 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) :listwin(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 = 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.c_str(), value); | 
 |  |  |       dw_base.Redraw(); | 
 |  |  |       if (display != L"") | 
 |  |  |       { | 
 |  |  |          dw_base.SetItemDisplayString(row, name.c_str(), 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); | 
 |  |  |       auto 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()); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int OnAddrow() | 
 |  |  |    { | 
 |  |  |       int row = dw_list.InsertRow(0); | 
 |  |  |       dw_list.SetItemString(row, L"modifieddate", publiccode::GetCurrentDate()); | 
 |  |  |       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", publiccode::GetCurrentDate()); | 
 |  |  |       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 = GetControl(L"dw_list"); | 
 |  |  |       dw_list.openUrl(L"/sale/view/FCL/template/FCL/List"); | 
 |  |  |       dw_base = 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; | 
 |  |  |    } | 
 |  |  | }; |