From e5c63266146b8fc3a527920ffbced686d514e1fb Mon Sep 17 00:00:00 2001
From: LiFan <2308045698@qq.com>
Date: 星期四, 18 七月 2024 15:24:01 +0800
Subject: [PATCH] update Qoute

---
 jrj/project/business/Quote/TONewSelectDlg.cpp           |   99 +
 jrj/project/business/Quote/xmQuoteBillList.cpp          |  208 ++++
 jrj/project/business/Quote/QuoteSupplierItem.cpp        |  189 +++
 jrj/project/business/Quote/XmShare.Quote.v3.cpp         |  177 +++
 jrj/project/business/Quote/CustomerItemNoList.cpp       |  166 +++
 jrj/ext-jrj/ext-jrj.vcxproj                             |   33 
 jrj/project/business/Quote/QuoteFilePurch.cpp           |  182 +++
 jrj/project/business/Quote/trade.document.selectdlg.cpp |  246 ++++
 jrj/project/business/Quote/QuoteFilePurched.cpp         |  183 +++
 jrj/project/business/Quote/Product.Select.cpp           | 1090 +++++++++++++++++++++
 jrj/project/business/Quote/TOSelectDlg.cpp              |  255 +++++
 jrj/project/business/Quote/trade.document.saveas.cpp    |  118 ++
 12 files changed, 2,946 insertions(+), 0 deletions(-)

diff --git a/jrj/ext-jrj/ext-jrj.vcxproj b/jrj/ext-jrj/ext-jrj.vcxproj
index c972c3a..8bf5fe7 100644
--- a/jrj/ext-jrj/ext-jrj.vcxproj
+++ b/jrj/ext-jrj/ext-jrj.vcxproj
@@ -741,6 +741,39 @@
     <ClCompile Include="..\project\business\Quote3.maint.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="..\project\business\Quote\CustomerItemNoList.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\project\business\Quote\Product.Select.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\project\business\Quote\QuoteFilePurch.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\project\business\Quote\QuoteFilePurched.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\project\business\Quote\QuoteSupplierItem.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\project\business\Quote\TONewSelectDlg.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\project\business\Quote\TOSelectDlg.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\project\business\Quote\trade.document.saveas.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\project\business\Quote\trade.document.selectdlg.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\project\business\Quote\xmQuoteBillList.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+    </ClCompile>
+    <ClCompile Include="..\project\business\Quote\XmShare.Quote.v3.cpp">
+      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+    </ClCompile>
     <ClCompile Include="..\project\business\SO3.list.cpp" />
     <ClCompile Include="..\project\business\SO3.maint.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
diff --git a/jrj/project/business/Quote/CustomerItemNoList.cpp b/jrj/project/business/Quote/CustomerItemNoList.cpp
new file mode 100644
index 0000000..e13ca20
--- /dev/null
+++ b/jrj/project/business/Quote/CustomerItemNoList.cpp
@@ -0,0 +1,166 @@
+use "xcontrol.vframe.vbusiness.vd"
+use "xbase.vframe.vbusiness.vd"
+use "base.view.vd"
+
+unit trade 
+[
+	class CustomerItemNoList :  public xframe
+	{
+		xdwgrid	dw_list;
+
+		xnode	m_agentNode;	//Agent Condition
+		int hObject = 0;
+	
+		string GoodsNo;
+		
+	
+		int SetAgent()
+		{
+			string xfNodeAgentArea  = "agentarea";
+			xnode anode = GetAgentNode(xfNodeAgentArea);
+			if(m_agentNode)
+			{
+				SetAgentNodeContent (anode,m_agentNode);
+			}
+			else
+			{
+				msxml::IXMLDOMElement xframeElement =  GetElement();
+				msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*");
+				if(agent)
+				{
+					string s = agent.xml;
+					m_agentNode =  SetAgentNodeContent (anode,s);
+				}
+			}
+			return 1;
+		}
+	
+		int OnRowChanged(ref TNotifyEvent evt,int p)
+		{
+			ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR);
+			int row = hdr.row;
+			SetAgent();
+			return 1;
+		}
+
+
+		//焦点激活处理函数
+		int OnSetFocus(ref TEvent evt,int param)
+		{
+			//重置工具条
+			SetAgent();
+			//trace(GetEntityID(1));
+			return 1;
+		}
+		
+		
+			
+		//命令发布函数
+		int OnCmdDispatch(string comdid)
+		{
+			if(comdid=="xmImport")
+			{
+				
+				Doubleclick();
+				return 1;
+			}
+			if(comdid=="xmClose")
+			{
+				
+				CloseWindow();
+				return 1;
+			}
+			if(comdid=="xmSearch")
+			{
+				
+				OnRetrieve(GoodsNo);
+				return 1;
+			}
+			return 0;
+		}
+		
+		int Doubleclick()
+		{
+			xaserverarg arg = GetParam();
+			arg.AddArg("items","");
+			string str = "";
+			int row =  dw_list.GetNextSelectRow(1);
+			while(row > 0 && row <= dw_list.GetRowCount())
+			{
+				msxml::IXMLDOMElement ele = dw_list.GetRowElement(row);
+			
+				str += ele.xml;
+				row =  dw_list.GetNextSelectRow(row + 1);
+			}
+			if(str != "")
+				arg.AddArg("items","<data>"+str+"</data>");
+			trace(str);
+			arg.AddArg("action","ok");
+			CloseWindow();
+			return 1;
+		}
+		
+		//命令处理事件
+		int OnXCommand(ref TXCommandEvent evt,int param)
+		{
+			return OnCmdDispatch(evt.pStrID);
+		}
+			
+		int OnAttachEvent()
+		{
+			//绑定工具条点击事件
+			AttachEvent("WM_XCOMMAND",OnXCommand);
+			//获取焦点事件,用于重置工具条
+			AttachEvent("WM_SETFOCUS",OnSetFocus);
+			AttachEvent("dw_list","DWV_DOUBLECLICKED",Doubleclick);
+			
+		}
+		
+		
+		int  OnRetrieve(string GoodsNo)
+		{
+			xml x = new xml;
+			x.setNativePointer(xml::CreateInstance());
+			xaserverarg arg = new xaserverarg;
+			arg.setNativePointer(arg.CreateInstance());
+			arg.AddArg("GoodsNo",GoodsNo);
+			
+			if (getUrl("/sale/data/ProductLibrary3/GetCustomerItemNoList",arg.GetString(),x)!=1)
+			{
+				trace(x.GetXmlDoc().text);
+				return -1;
+			}else	
+			{
+				dw_list.Retrieve(x);
+				dw_list.Redraw();
+			}
+			dw_list.SetSelectionMode(1);
+			dw_list.SetReadOnly(true);
+			return 1;
+		}
+			
+		int onload()
+		{
+			dw_list = GetControl("dw_list");
+			dw_list.openUrl("/sale/view/Quote3/template/Quote/CustomerItemNoList");
+		
+			
+			if(GetParam())
+			{
+				xaserverarg arg = GetParam();
+				GoodsNo=arg.GetArgString("GoodsNo");
+				OnRetrieve(arg.GetArgString("GoodsNo"));
+			}
+			OnRetrieve(GoodsNo);
+			OnAttachEvent();	
+			return 1;
+		}
+		
+		int onloaded()
+		{
+			SetAgent();
+			
+			return 1;
+		}		
+	};
+]
\ No newline at end of file
diff --git a/jrj/project/business/Quote/Product.Select.cpp b/jrj/project/business/Quote/Product.Select.cpp
new file mode 100644
index 0000000..23e6501
--- /dev/null
+++ b/jrj/project/business/Quote/Product.Select.cpp
@@ -0,0 +1,1090 @@
+use "xcontrol.vframe.vbusiness.vd"
+use "xbase.vframe.vbusiness.vd"
+use "multi.vbind.vbind.wface.vd"
+use "productlibrary.vd"
+use "shoppingcart.vd"
+
+unit trade 
+[
+	class ProductSelectWin :  public xwin
+	{
+		int hObject = 0;
+		string CustomerID;
+		string m_customer;
+	
+		//产品库产品列表
+		xdwgrid	dw_list;
+		//购物车产品列表
+		xdwgrid	dwc_list;
+	
+		//产品缓存对象
+		xdataset g_xdoc_product;
+		xdataset g_xdoc_shoppingcart;
+
+		xcombobox  cbx_goodscar;
+		//是否多选
+
+		xnode	m_agentNode;	//Agent Condition
+		xtreeview tv_folder;	
+		string 	agentFor;
+	
+		string	impStr;
+	
+		int FillGoodsCarList()
+		{
+			xcombobox xc = GetControl("frame:cbx_goodscar");
+			if(!xc) return 0;
+			xml  x = ShoppingCartView::GetRoleList(CustomerID);	
+			if(!x) return 0;
+			xc.SetText("==选择购物车==");
+				
+			msxml::IXMLDOMNodeList nlist = x.GetXmlDoc().SelectNodes("//item"); 
+			int len = nlist.length;
+			for (int i = 0; i < len; i++)
+			{	
+				msxml::IXMLDOMElement e = nlist.item(i);
+				string name = e.getAttribute("name");
+				xcombobox::AddItem(xc.GetId(),name);				
+			}
+			return 1;
+		}		
+
+		int SetAgent()
+		{
+			string xfNodeAgentArea  = "agentarea";
+			xnode anode = GetAgentNode(xfNodeAgentArea);
+			if(m_agentNode)
+			{
+				SetAgentNodeContent (anode,m_agentNode);
+			}
+			else
+			{
+				msxml::IXMLDOMElement xframeElement =  GetElement();
+				msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*");
+				if(agent)
+				{
+					string s = agent.xml;
+					m_agentNode =  SetAgentNodeContent (anode,s);
+				}
+			}
+			return 1;
+		}
+				
+		//焦点激活处理函数
+		int OnSetFocus(ref TEvent evt,int param)
+		{
+			//重置工具条
+			SetAgent();
+			return 1;
+		}
+
+		msxml::IXMLDOMElement OnGetCarListRowElement(int row=0)
+		{
+			if(row < 1) row = dwc_list.GetRow();
+			if(row < 1 || row > dwc_list.GetRowCount()) return 0;
+			msxml::IXMLDOMElement e = g_xdoc_shoppingcart.getRowElement("data/Item", row);
+			return e;
+		}	
+	
+		int OnShowImage(string skuid)
+		{
+			imageview im = GetControl("im1");
+			//im.RemoveImage();
+			im.ResetEx();
+			
+			xml xp=new xml;
+			xp.setNativePointer(xml::CreateInstance());
+			xaserverarg arg_pic=new xaserverarg;
+			arg_pic.setNativePointer(arg_pic.CreateInstance());	
+			arg_pic.AddArg("SKUID",skuid);
+			if(url::get("/sale/data/ProductLibrary3/pref/picture/imagelistSKU",arg_pic.GetString(),xp)!=1)
+			{
+				trace("xxx",xp.GetXml());
+			}else
+			{
+				//imageElement = xp.GetXmlDoc().documentElement;
+				msxml::IXMLDOMNodeList  nlistp=  xp.GetXmlDoc().selectNodes("ImageList/image");
+				int lenp = nlistp.length;
+				for(int ip=0;ip<lenp;ip++)
+				{
+					msxml::IXMLDOMElement xitem = nlistp.item(ip);
+					string picname = xitem.selectSingleNode("PicPath").text; 
+					string goodno = xitem.selectSingleNode("GoodsNo").text; 	
+					if(picname == "/business/products/Thumbs//")
+						picname = "/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg";
+					im.AddImages(picname, "");
+				}
+				im.Redraw();
+				//win32::SendMessage(im.GetId(),0x000f,0,1);
+				//win32::InvalidateRect(im.GetId(),cast(0 as ref xrect),true);
+			}
+			return 1;
+		}
+					
+		int OnShowImage(string skuid, string customerItemNo)
+		{
+			imageview im = GetControl("im1");
+			//im.RemoveImage();
+			im.ResetEx();
+			
+			xml xp=new xml;
+			xp.setNativePointer(xml::CreateInstance());
+			xaserverarg arg_pic=new xaserverarg;
+			arg_pic.setNativePointer(arg_pic.CreateInstance());	
+			arg_pic.AddArg("SKUID",skuid);
+			arg_pic.AddArg("CustomerID",m_customer);
+			arg_pic.AddArg("CustomerItemNo",customerItemNo);
+			
+			if(url::get("/sale/data/ProductLibrary3/pref/picture/customer/imagelistSKU",arg_pic.GetString(),xp)!=1)
+			{
+				trace("error:" + xp.GetXml());
+			}else
+			{
+				//imageElement = xp.GetXmlDoc().documentElement;
+				msxml::IXMLDOMNodeList  nlistp=  xp.GetXmlDoc().selectNodes("ImageList/image");
+				int lenp = nlistp.length;
+				for(int ip=0;ip<lenp;ip++)
+				{
+					msxml::IXMLDOMElement xitem = nlistp.item(ip);
+					string picname = xitem.selectSingleNode("PicPath").text; 
+					string goodno = xitem.selectSingleNode("GoodsNo").text; 	
+					if(picname == "/business/products/Thumbs//")
+						picname = "/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg";
+					im.AddImages(picname, "");
+				}
+				im.Redraw();
+			}
+			return 1;
+		}
+		
+		int ItemAdd()
+		{
+			int hItem = tv_folder.GetSelectedItem();
+			int hTopItem = LookupTopFolder(hItem);
+			string name = tv_folder.GetItemLabel(hTopItem);
+
+			msxml::IXMLDOMElement e= tv_folder.GetItemData(hItem);
+			string guid =  e.getAttribute("guid");
+			if(guid=="") return 1;
+			xaserverarg arg = new xaserverarg;
+			arg.setNativePointer(arg.CreateInstance());
+			arg.AddArg("guid", e.getAttribute("guid"));
+			if(name=="个人产品")
+				arg.AddArg("FolderID", e.getAttribute("guid"));
+			else
+				arg.AddArg("CategoryID", e.getAttribute("guid"));
+			string No = e.getAttribute("CategoryNo");
+			if(No=="") No = e.getAttribute("no");
+			string Name = e.getAttribute("CName");
+			if(Name=="") Name = e.getAttribute("cname");
+			arg.AddArg("No",No);
+			arg.AddArg("CName",Name);
+			int p = arg;
+			OpenWindow("dev:xpage[Quick.Input.NewProduct.vx]",p);
+			//if(arg.GetArgString("data.modify")=="1")RetrieveData();
+			return 1;
+		}
+			
+		int OnRowChanged(ref TNotifyEvent evt,int p)
+		{
+			ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR);
+			int row = hdr.row;
+				
+			htmlctrl xs = GetControl("html_detail");
+			string html = makeHtml(row);
+			xs.SetContent(html);
+			xs.Redraw();
+			
+			string id = g_xdoc_product.getData(0,"data/Item",row,"@guid");
+			OnShowImage(id);
+					
+			return 1;
+		}
+		
+		int OnGoodsCarRowChanged(ref TNotifyEvent evt,int p)
+		{
+			ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR);
+			int row = hdr.row;
+				
+			htmlctrl xs = GetControl("html_detail");
+			string html = makeGoodscarHtml(row);
+			xs.SetContent(html);
+			xs.Redraw();
+			if(m_customer)
+			{
+				string id = g_xdoc_shoppingcart.getData(0,"data/Item",row,"SKUID");
+				string customerItemNo = g_xdoc_shoppingcart.getData(0,"data/Item",row,"CustomerItemNo");
+				OnShowImage(id,customerItemNo);
+			}
+				
+			return 1;
+		}	
+		
+		int DeleteRow(int row)
+		{
+			int IDOK = 1;
+			int MB_OKCANCEL  = 1;
+			int MB_ICONQUESTION  = 32;
+			if(win32::MessageBox(GetHWND(),"确认删除指定的项,删除后将不能恢复?","提示",MB_OKCANCEL|MB_ICONQUESTION)!=IDOK) return 1;
+			string id = g_xdoc_product.getData(0,"data/Item",row,"@guid");
+		
+			if(ProductLibraryView::DeleteItem(id)==1)	dw_list.DeleteRow(0);	
+			return 1;
+		}
+		
+		int SetSelectState(xdwgrid dw_obj, int state)
+		{
+			dw_obj.SetSelectionMode(3);
+			return 1;
+		}
+		
+		int OnCkbCLick(ref TEvent evt,int p)
+		{	
+			xcheckbox cbx_1 = GetControl("frame:cbx1");			
+			int state=cbx_1.GetCheck(cbx_1.GetId());	
+			return SetSelectState(dw_list,state);
+		}
+			
+		int OnCkbCLick2(ref TEvent evt,int p)
+		{	
+			xcheckbox cbx_2 = GetControl("frame:cbx2");			
+			int state=cbx_2.GetCheck(cbx_2.GetId());		
+			return SetSelectState(dwc_list,state);
+		}	
+			
+		xml  GetGoodsPropList(string guid)
+		{
+			xml x=new xml;
+			x.setNativePointer(xml::CreateInstance());
+			xaserverarg arg = new xaserverarg;
+			arg.setNativePointer(arg.CreateInstance());
+			arg.AddArg("guid", guid);	
+			if(url::get("/sale/data/SO/goods/goodsprop/list", arg.GetString(),x)!=1)
+			{
+				string error = x.GetXmlDoc().text;
+				alert(error);
+			}
+			return x;
+		}
+		
+					
+		xml  GetGoodsPropListEx(string guid)
+		{
+			xml x=new xml;
+			x.setNativePointer(xml::CreateInstance());
+			string fields="<data>";
+			
+			/*
+			fields +="<field name='HighestPrice' label='最高价'/>";
+			fields +="<field name='LowestPrice' label='最低价'/>";
+			
+			fields +="<field name='BulkPrice' label='散货价'/>";
+			fields +="<field name='CardPrice' label='纸卡价'/>";
+			fields +="<field name='BuyPrice' label='采购价'/>";
+			fields +="<field name='SupplierID' label='货源'/>";
+			*/
+			
+			fields +="<field name='Packing' label='包装方式'/>";
+			fields +="<field name='PackingRate' label='每箱数量'/>";
+			fields +="<field name='VolumeDesc' label='包装尺码'/>";
+			fields +="<field name='GWPerPkg' label='毛重'/>";
+			fields +="<field name='NWPerPkg' label='净重'/>";
+			//fields +="<field name='DeveloperID' label='开发人员'/>";
+			fields +="<field name='AttributeValue_1' label='产品属性'/>";
+			//fields +="<field name='Remark' label='备注'/>";
+			
+			fields += "</data>";
+			x.LoadXml(fields);
+			
+			return x;
+		}
+			
+		string makeHtml(int row)
+		{
+			string id = g_xdoc_product.getData(0,"data/Item",row,"@guid");
+			xml x = GetGoodsPropList(id);
+			xml x1 = GetGoodsPropListEx(id);
+			
+			string html="<html><style> .text{ font-weight:400} .label { font-weight:400;}</style><body style='margin:2;background-color1:#ccdccc none #f0f0f0 none'>";
+			html += "<div ><span style='font-weight:700;width:50;font-size:10pt'  >编号:</span><span  style='width:90;font-size:10pt'>" + dw_list.GetItemString(row,"No")+
+						"</span> <span style='font-weight:700;width:50;font-size:10pt' >类项:</span><span  style='width:90;font-size:10pt'>" + dw_list.GetItemString(row,"RefNo")+
+						"</span></div>";
+			html +=  "<div ><span style='font-weight:700;width:50;font-size:10pt'  >货号:</span><span  style='width:90;font-size:10pt'>" + dw_list.GetItemString(row,"GoodsNo")+
+						"</span></div>" ;
+			html +=  "<div ><span style='font-weight:700;width:50;font-size:10pt'  >品名:</span><span  style='width:90;font-size:10pt'>" + dw_list.GetItemString(row,"CName")+
+						"</span></div>" ;
+			if(dw_list.GetItemString(row,"CSpec")!="")
+				html +=  "<div ><span style='font-weight:700;width:50;font-size:10pt'  >规格:</span><span  style='width:90;font-size:10pt'>" + dw_list.GetItemString(row,"CSpec")+
+							"</span></div>" ;
+			
+			msxml::IXMLDOMNodeList fieldsEx = x1.GetXmlDoc().selectNodes("data/field");
+			string ls_detail="";
+			string ls_item ="";
+			string name;
+			string label;
+			int len = fieldsEx.length;
+			int i= 0;
+			
+			for(i=0;i<len; true)
+			{
+				int cnt  = 0;
+				ls_item = "";
+				while(cnt < 2)
+				{
+					name = fieldsEx.item(i).selectSingleNode("@name").text;
+					label  = fieldsEx.item(i).selectSingleNode("@label").text;
+					ls_item += "<td>" + label + "</td>" + "<td style='text-align:center'>" + g_xdoc_product.getData(0,"data/Item",row,name) + "</td>" ;
+					cnt++;
+					i++;
+					if(i ==len)break;
+				}
+				ls_detail += "<tr>" + ls_item + "</tr>";
+			}
+			html +=  "<div style='margin-left:8px;margin-right:16px;'>" +
+						+"<table><colgroup span='1' width='70'/><colgroup span='1' width='120'/><colgroup span='1' width='70'/><colgroup span='1' width='120'/>" 
+						+ ls_detail
+						+"</table>"
+						+"</div>" ;
+						
+			string ls_star="";
+			msxml::IXMLDOMNodeList fields  = x.GetXmlDoc().selectNodes("data/field");
+			len = fields.length;
+			
+			ls_detail = "";
+			if(len > 0) 
+				html +=  "<div ><span style='font-weight:700;width:50;font-size:10pt'  >技术要求:</span></div>" ;
+			for(i=0;i<len; true)
+			{
+				ls_item="";
+				
+				int count = 0;
+				while(count < 2)
+				{
+					name = fields.item(i).selectSingleNode("@name").text;
+					label  = fields.item(i).selectSingleNode("@label").text;
+				
+					if(name=="QualityTerm" || name=="PackTerm" || label=="质量" || label=="包装质量" || label=="技术要求")
+					{
+						i++;
+						if(i >= len)count = 2;
+						continue;
+					}
+					else if(g_xdoc_product.getData(0,"data/Item",row,name)=="")
+					{
+						msxml::IXMLDOMNodeList options = fields.item(i).selectNodes("item");
+						int tlen = options.length;
+						string terms = "" ;
+						for(int k=0; k<tlen; k++)
+						{
+							if(options.item(k).text)
+							{
+								if(k>0) terms += ", ";
+								terms += "[" + options.item(k).text +"]";
+							}
+						}
+						ls_star += "<div ><span style='font-weight:700;width:50;font-size:10pt'  >" + label +"*:</span><span  style='width:90;font-size:10pt'>" + terms + "</span></div>" ;
+					}else
+					{
+						ls_item = "<td>" + label + "</td>" + "<td>" + g_xdoc_product.getData(0,"data/Item",row,name) + "</td>" ;
+						count++;
+					}
+					i++;
+					if(i >= len)count = 2;
+				}
+				ls_item = "<tr>" + ls_item + "</tr>";
+				ls_detail += ls_item;
+			}
+			
+			html +=  "<div style='margin-left:8px;margin-right:16px;'>" +
+						+"<table><colgroup span='1' width='70'/><colgroup span='1' width='120'/><colgroup span='1' width='70'/><colgroup span='1' width='120'/>" 
+						+ ls_detail
+						+"</table>"
+						+"</div>" ;
+			if(dw_list.GetItemString(row,"QualityTerm")!="")
+			{
+				html +=  "<div style='height:12px'/>";
+				html +=  "<div ><span style='font-weight:700;width:50;font-size:10pt'  >质量:</span></div>" ;
+				html +=  "<div ><span style='margin-left:8px;margin-right:16px;font-weight:400;font-size:10pt'  >" + dw_list.GetItemString(row,"QualityTerm") +  "</span></div>" ;
+			}
+			
+			if(dw_list.GetItemString(row,"PackTerm")!="")
+			{
+				html +=  "<div style='height:12px'/>";
+				html +=  "<div ><span style='font-weight:700;width:50;font-size:10pt'  >包装质量:</span></div>" ;
+				html +=  "<div ><span style='margin-left:8px;margin-right:16px;font-weight:400;font-size:10pt' >" + dw_list.GetItemString(row,"PackTerm") +  "</span></div>" ;
+			}
+			
+			if(g_xdoc_product.getData(0,"data/Item",row,"Remark") != "" && id == "23A8BBA2-DEF1-4C00-978E-646151A6082E")
+			{
+				html +=  "<div ><span style='font-weight:700;width:50;font-size:10pt'  >备注:</span></div>" ;
+				html +=  "<div ><span style='margin-left:8px;margin-right:16px;font-weight:400;font-size:10pt' >" + g_xdoc_product.getData(0,"data/Item",row,"Remark") +  "</span></div>" ;
+			}
+
+			html +=  "<div style='height:24px'/>";
+			
+			//星标项
+			html += ls_star;
+
+			//显示图片			
+			/*string picname = "1FA9E331-F95C-4E51-B80C-73FB9B911D8D.jpg";//dw_list.GetItemString(row,"ImgName"); //ItemID+".jpg";
+			string str = picname.mid(0,2);
+			str = str.upper();
+			string serversrc ="http://192.168.7.241:1001/business/products/chanpin/"+str+"/"+picname;
+			html +=  "<div ><span style='font-weight:700;width:50;font-size:10pt'  >图片:</span>";
+			html +=  "<control visible='layer' controlclass='ximage'  data='' src='"+ serversrc +"'/></div>";
+			*/
+			html += "</body></html>";
+			return html;
+		}
+		
+		string makeGoodscarHtml(int row)
+		{
+			string No = dwc_list.GetItemString(row,"RefNo");//获取属性值id					
+			xml x = GetGoodsPropList(No);
+			
+			string html="<html><style> .text{ font-weight:400} .label { font-weight:400;}</style><body style='margin:2;background-color1:#ccdccc none #f0f0f0 none'>";
+			html += "<div ><span style='font-weight:700;width:50;font-size:10pt'  >编号:</span><span  style='width:90;font-size:10pt'>" + dwc_list.GetItemString(row,"No")+
+						"</span></div>";
+			html +=  "<div ><span style='font-weight:700;width:50;font-size:10pt'  >品名:</span><span  style='width:90;font-size:10pt'>" + dwc_list.GetItemString(row,"CName")+
+						"</span></div>" ;
+			html +=  "<div ><span style='font-weight:700;width:50;font-size:10pt'  >规格:</span><span  style='width:90;font-size:10pt'>" + dwc_list.GetItemString(row,"CSpec")+
+						"</span></div>" ;
+			
+			msxml::IXMLDOMNodeList fields = x.GetXmlDoc().selectNodes("data/field");
+			int len = fields.length;
+			html += "<table>" +
+				"<colgroup span='1' width='80'/>" +
+				"<colgroup span='1' width='120'/>" +
+				"<colgroup span='1' width='420'/>" ;
+			html += "<tr>" ;
+			html += "<td style='text-align:center'>编号</td><td style='text-align:center'>项目</td><td style='text-align:center'>内容</td>" ;
+			html +="</tr>";
+			for(int i=0;i<len; i++)
+			{
+				string name = fields.item(i).selectSingleNode("@name").text;
+				string label  = fields.item(i).selectSingleNode("@label").text;
+				html += "<tr>" ;
+				if(i==0)
+					html += "<td rowspan='" + len.toString() + "'>" + No + "</td><td >"+ label +  "</td><td >"+"</td>" ;
+				else
+					html += "<td >"+ label +  "</td><td >"+ g_xdoc_shoppingcart.getData(0,"data/Item",row,name)+"</td>" ;
+				html +="</tr>";
+			}
+			
+			html += "<tr>" ;
+			html += "<td rowspan='3'>" + g_xdoc_shoppingcart.getData(0,"data/Item",row,"PackCode") + "</td><td >包装方式</td><td >"+
+				 g_xdoc_shoppingcart.getData(0,"data/Item",row,"CPack") + "</td>" ;
+			html +="</tr>";
+			html += "<tr height='48'>" ;
+			html += "<td >包装要求</td><td >"+ g_xdoc_shoppingcart.getData(0,"data/Item",row,"PackQualityTerm")+"</td>" ;
+			html +="</tr>";
+			html += "<tr>" ;
+			html += "<td >侧唛</td><td ></td>" ;
+			html +="</tr>";
+	
+			html += "<tr height='72'>" ;
+			html += "<td>" + g_xdoc_shoppingcart.getData(0,"data/Item",row,"QualityCode") + "</td><td >质量要求</td><td >"+
+				 g_xdoc_shoppingcart.getData(0,"data/Item",row,"QualityTerm") + "</td>" ;
+			html +="</tr>";
+
+			html +="</table>";
+
+			html += "</body></html>";
+			return html;
+		}		
+
+		int OnImport()
+		{
+			if(!hObject ) return 1;
+			
+			int rw = 0;
+			string ls_nos = "ImportXml:";
+			
+			if (impStr=="")
+			{
+				alert("请选择商品!");
+				return 1;
+			}
+			ls_nos += impStr;
+			trace(impStr);
+			dwc_list.SelectRow(0,false);
+			dwc_list.Redraw();
+			dw_list.SelectRow(0,false);
+			dw_list.Redraw();
+			impStr ="";
+			//alert(ls_nos);
+			win32::SendMessage(hObject,0x401,ls_nos,0);
+			alert("转入完成");
+				
+			return 1;
+		}
+
+		int OnSearch()
+		{
+			int hItem = tv_folder.GetSelectedItem();
+			return RetrieveItem(hItem);
+		}
+					
+		//命令发布函数
+		int OnCmdDispatch(string comdid)
+		{
+			int hCursor;
+			string name="";
+			if(comdid=="xmClose")
+			{
+				CloseWindow();
+				return 1;
+			}
+			else if(comdid=="xmImport")
+			{
+				OnImport();
+				return 1;
+			}
+			else if(comdid=="xmAdd")
+			{
+				ItemAdd();
+				return 1;
+			}
+			else if(comdid=="xmSearch")
+			{
+				OnSearch();
+				return 1;
+			}
+			return 0;
+		}
+		
+		//命令处理事件
+		int OnXCommand(ref TXCommandEvent evt,int param)
+		{
+			return OnCmdDispatch(evt.pStrID);
+		}
+				
+		//查找当前树项的顶级目录
+		int LookupTopFolder(int hItem)
+		{
+			int hRoot = tv_folder.GetRootItem();
+			while(tv_folder.GetParentItem(hItem)) hItem = tv_folder.GetParentItem(hItem);
+			return hItem;
+		}
+		
+		//插入产品类项的子项
+		int MakeGoodsFolderItem(int hItem, string sno)
+		{
+			xml x = ProductLibraryView::GetTreeChildItems3(sno);
+			if(!x) return 0;
+			
+			msxml::IXMLDOMNodeList nlist = x.GetXmlDoc().SelectNodes("//Item"); 
+			int len = nlist.length;
+			for (int i = 0; i < len; i++)
+			{	
+				msxml::IXMLDOMElement e = nlist.item(i);
+				string name = e.getAttribute("CName");
+				string no = e.getAttribute("CategoryNo");
+				string label = no.trim() + " " + name;
+
+				int h= tv_folder.InsertChildItem(hItem,label, trust(e as int),15);				
+				tv_folder.SetItemChild(h,1);
+			}
+			return 1;				
+		}	
+
+		//插入新产品目录子项
+		int MakeUserGoodsFolderItem(int hItem, string sno)
+		{
+			xml x = ProductLibraryView::GetTreeUserChildItems3(sno);
+			if(!x) return 0;
+			
+			msxml::IXMLDOMNodeList nlist = x.GetXmlDoc().SelectNodes("//Item"); 
+			int len = nlist.length;
+			for (int i = 0; i < len; i++)
+			{	
+				msxml::IXMLDOMElement e = nlist.item(i);
+				string name = e.getAttribute("CName");
+				string no = e.getAttribute("CategoryNo");
+				string label = no.trim() + " " + name;
+
+				int h= tv_folder.InsertChildItem(hItem,label, trust(e as int),15);				
+				string child = e.getAttribute("Childs");
+				if(child=="")
+					tv_folder.SetItemChild(h,1);
+				else if(child !="0")
+					tv_folder.SetItemChild(h,1);
+			}
+			return 1;				
+		}	
+				
+		//插入购物车项
+		int ExpandCatChildFolder(int hItem, msxml::IXMLDOMElement ele ,int image)
+		{
+			msxml::IXMLDOMNodeList nlist = ele.SelectNodes("item");
+			int len = nlist.length;
+			if(len > 0) tv_folder.SetItemChild(hItem,1);
+			for (int i= 0; i < len; i++)
+			{	
+				msxml::IXMLDOMElement e = nlist.item(i);
+				string name = e.getAttribute("name");
+				int h = tv_folder.InsertChildItem(hItem,name, trust(e as int),image);
+				ExpandCatChildFolder(h,e,35);
+			}
+			return 1;
+		}
+		int MakeGoodCarFolderItem(int hItem)
+		{
+			//trace("\r\nCustomerID:"+CustomerID);
+			xml x = ShoppingCartView::GetRoleList(CustomerID);
+			//if(x) alert(x.GetXml());
+			if(!x) return 0;
+			msxml::IXMLDOMNodeList nlist = x.GetXmlDoc().SelectNodes("/data/item"); 
+			int len = nlist.length;
+			for (int i = 0; i < len; i++)
+			{	
+				msxml::IXMLDOMElement e = nlist.item(i);
+				string name = e.getAttribute("name");
+				int h = tv_folder.InsertChildItem(hItem,name, trust(e as int),35);
+				ExpandCatChildFolder(h,e,35);
+			}
+			return 1;				
+		}	
+
+		//树展开
+		int OnTreeExpanding(ref TNotifyEvent evt,int p)
+		{
+			ref NMTREEVIEW nmtv = evt.pnmh;
+			int hItem = nmtv.itemNew.hItem;
+			int hTopItem = LookupTopFolder(hItem);
+			string name = tv_folder.GetItemLabel(hTopItem);	
+			int child = tv_folder.GetChildItem(hItem);
+			string no ="";
+			msxml::IXMLDOMElement e;
+			if(name == "公司库" && !child )
+			{	
+				no ="";
+				if(hTopItem != hItem)
+				{
+					e= tv_folder.GetItemData(hItem);
+					no = e.getAttribute("categoryid");
+				}else
+				{
+					e= tv_folder.GetItemData(hItem);
+					no = e.getAttribute("categoryid");
+				}
+				MakeGoodsFolderItem(hItem, no);					
+			}
+			else if(name == "个人库" && !child )
+			{	
+				no ="";
+				if(hTopItem != hItem)
+				{
+					e= tv_folder.GetItemData(hItem);
+					no = e.getAttribute("categoryid");
+					MakeUserGoodsFolderItem(hItem, no);					
+				}
+			}
+			else if(name == "购物车" && !child )
+			{	
+				if(hItem==hTopItem)MakeGoodCarFolderItem(hItem);					
+			}
+			return 1;
+		}
+		
+		int ResetAgent(string agentAsk)
+		{
+			if(agentFor != agentAsk)
+			{
+				agentFor = agentAsk;
+				m_agentNode = 0;
+				SetAgent();
+			}
+			return 1;
+		}
+		
+		int LookupCustomerFolder(int hItem)
+		{
+			while(true)
+			{
+				msxml::IXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as msxml::IXMLDOMElement);
+				string str = e1.getAttribute("no");
+				if(str.find("Customer:")>=0) return hItem;
+				hItem = tv_folder.GetParentItem(hItem);
+				if(hItem==0) break;
+			}
+			return 0;
+		}
+		
+		string LookupCustomer(int hItem)
+		{
+			hItem = LookupCustomerFolder(hItem);
+			if(hItem==0) return "";
+			msxml::IXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as msxml::IXMLDOMElement);
+			string str = e1.getAttribute("no");
+			return str.mid("Customer:".length(),9999);
+		}
+	
+		int RetrieveItem(int hItem)
+		{
+			int hTopItem = LookupTopFolder(hItem);
+			string name = tv_folder.GetItemLabel(hTopItem);
+			string selectname = tv_folder.GetItemLabel(hItem);
+			imageview im = GetControl("im1");
+			m_customer = "";
+			xcontrol query = GetControl("sl_search");
+			string queryString = query.GetText();
+			
+			if(name == "购物车")
+			{
+				if(agentFor !="goodscar")SwitchLayer("goodscarsheet","sheetframe");
+				ResetAgent("goodscar");
+				if(selectname !=name)
+				{
+					msxml::IXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as msxml::IXMLDOMElement);
+					string str = e1.getAttribute("no");
+					
+					trace("\r\n-------"+str+"--------"+queryString);
+				
+					if(str=="Supplier") 
+					{
+						return 1;
+					}
+					//alert(str);
+					if(str.find("Customer:")==0 || str.find("SO:")==0 || str.find("Purcherex:")==0|| str.find("Purcher:")==0 || str.find("Supplier:")==0|| str.find("Enquiry:")==0)
+					{
+						m_customer = LookupCustomer(hItem);
+						if(str.find("Customer:")==0)
+						{
+							dwc_list.openUrl("/sale/view/ProductLibrary/template/cart/goodscustomerlist"); 
+						}
+						else
+						{
+							dwc_list.openUrl("/sale/view/ProductLibrary/template/cart/goodssolist");
+						}
+						dwc_list.Reset();
+						dwc_list.SetReadOnly(true);
+						dwc_list.SetColumnState("CurrencyCode",false);
+						//alert(str);
+						if(queryString=="")
+							g_xdoc_shoppingcart.Retrieve(ShoppingCartView::GetGoodsList(str));
+						else
+							g_xdoc_shoppingcart.Retrieve(ShoppingCartView::GetGoodsList(str,queryString));
+					}
+					else if(e1.getAttribute("categoryid") !="")
+					{
+						string categoryid = e1.getAttribute("categoryid");
+						dwc_list.SetDataObject(ProductLibraryView::GetMaintListForm3(categoryid).GetXmlDoc());
+						dwc_list.SetReadOnly(true);
+						dwc_list.Reset();
+						if(queryString=="")
+							g_xdoc_shoppingcart.Retrieve(ProductLibraryView::GetMaintList3(categoryid ));
+						else
+							g_xdoc_shoppingcart.Retrieve(ProductLibraryView::GetMaintList3(categoryid, queryString,""));
+					}
+					else
+					{
+						dwc_list.openUrl("/sale/view/ProductLibrary/template/cart/goodslist"); 
+						dwc_list.SetReadOnly(true);
+						dwc_list.Reset();
+						if(queryString=="")
+							g_xdoc_shoppingcart.Retrieve(ShoppingCartView::GetGoodsList(selectname));
+						else
+							g_xdoc_shoppingcart.Retrieve(ShoppingCartView::GetGoodsList(selectname,queryString));
+					}
+					dwc_list.PostRetrieve();
+					dwc_list.Redraw();
+
+					if(dwc_list.GetRowCount() >= 1 )
+					{
+						htmlctrl xs = GetControl("html_detail");
+						xs.SetContent(makeGoodscarHtml(1));
+						
+						if(m_customer !="")
+						{
+							string skuid = g_xdoc_shoppingcart.getData(0,"data/Item",1,"SKUID");
+							string customerItemNo = g_xdoc_shoppingcart.getData(0,"data/Item",1,"CustomerItemNo");
+							OnShowImage(skuid,customerItemNo);
+						}
+					} else {						
+						im.ResetEx();
+						im.Redraw();
+
+						xs = GetControl("html_detail");
+						xs.SetContent("<html><body style='margin:2;background-color:#ccdccc none #f0f0f0 none'/></html>");
+					}
+					xs.Redraw();
+				}	
+			}
+			else
+			{
+				if(agentFor !="goodslib")SwitchLayer("goodslibsheet","sheetframe");
+				if(name == "个人库") 
+					ResetAgent("userlib");
+				else 
+					ResetAgent("goodslib");
+				int hCursor = xutil::SetCursorWait();
+
+				if(name == "个人库" || name=="公司库")
+				{
+					string no="N000005";
+					if(name=="个人库") no="U000005";
+					if(hItem != hTopItem)
+					{
+						msxml::IXMLDOMElement e= tv_folder.GetItemData(hItem);
+						no = e.getAttribute("guid");
+					}
+					dw_list.SetDataObject(ProductLibraryView::GetMaintListForm3(no).GetXmlDoc());
+					dw_list = GetControl("dw_list");
+					dw_list.Reset();
+					dw_list.SetReadOnly(true);
+					
+					xml x;
+					if(queryString=="")
+					{
+						if(name == "个人库")
+							x = ProductLibraryView::GetMaintRoleList3(no);
+						else
+							x = ProductLibraryView::GetMaintList3(no);
+					}
+					else
+					{
+						if(name == "个人库")
+							x = ProductLibraryView::GetMaintRoleList3(no,queryString);
+						else
+						{
+							if(queryString !="")
+							{
+								if(no=="N000005")
+									x = ProductLibraryView::GetMaintList3("",queryString,"");
+								else
+									x = ProductLibraryView::GetMaintList3(no,queryString,"");
+							}else
+								x = ProductLibraryView::GetMaintList3(no);
+						}
+					}
+					if(x) g_xdoc_product.Retrieve(x);
+					dw_list.PostRetrieve();
+					dw_list.Redraw();
+
+					if(dw_list.GetRowCount() >0)
+					{
+						xs = GetControl("html_detail");
+						xs.SetContent(makeHtml(1));
+						string id = g_xdoc_product.getData(0,"data/Item",1,"@guid");
+						OnShowImage(id);
+					}else
+					{
+						im.ResetEx();
+						im.Redraw();
+
+						xs = GetControl("html_detail");
+						xs.SetContent("<html><body style='margin:2;background-color:#ccdccc none #f0f0f0 none'/></html>");
+					}
+					xs.Redraw();
+					xutil::RestoreCursor(hCursor);
+				}
+			}		
+			impStr = "";
+		}
+					
+		int OnTreeSelChanged(ref TNotifyEvent evt,int p)
+		{
+			ref NMTREEVIEW nmtv = cast(evt.pnmh as NMTREEVIEW);
+			int hItem = nmtv.itemNew.hItem;
+			return RetrieveItem(hItem);
+		}	
+
+		int  ExpandChildFolder(int hItem, msxml::IXMLDOMElement pElement)
+		{
+			msxml::IXMLDOMNodeList nlist = pElement.SelectNodes("Item");
+			int len = nlist.length;
+			for (int i = 0; i < len; i++)
+			{	
+				msxml::IXMLDOMElement e = nlist.item(i);
+				string name = e.getAttribute("cname");
+				string sImage = e.getAttribute("image");
+				int image = 15;
+				//if(sImage) image = sImage.toInt();
+				int h= tv_folder.InsertChildItem(tv_folder.GetId(),hItem,name, trust(e as int),image);				
+				tv_folder.SetItemChild(h,1);
+				ExpandChildFolder(h,e);
+			}
+			return 1;				
+		}
+		
+		int  InitialFolder()
+		{
+			msxml::IXMLDOMElement xframeElement =  GetElement();
+			msxml::IXMLDOMElement e =  xframeElement.selectSingleNode("//xtree[@name='tv_folder']/initial");
+			ExpandChildFolder(0,e);
+			return 1;
+		}
+		
+		int OnDwClicked(ref TNotifyEvent evt,int p)
+		{
+			ref DWNMHDR hdr = cast(evt.pnmh as ref DWNMHDR);
+			char ch;
+			int row = hdr.row;
+			string col = hdr.colname;
+			
+			string str = "";
+			if(dw_list.GetItemString(row, "SKUNo") !="") 
+				str =dw_list.GetItemString(row, "SKUNo");
+			else
+				str =dw_list.GetItemString(row, "No");
+			
+			if(dw_list.IsRowSelected(row) & 0xff)
+			{
+				//will unselect
+				impStr = impStr.replace(" "+str,"");
+			}else
+			{
+				//will select
+				impStr += " " + str;
+			}
+			return 1;
+		}
+		
+		int OnDwcClicked(ref TNotifyEvent evt,int p)
+		{
+			ref DWNMHDR hdr = cast(evt.pnmh as ref DWNMHDR);
+			char ch;
+			int row = hdr.row;
+			string col = hdr.colname;
+			
+			string str = g_xdoc_shoppingcart.getData(0,"data/Item",row,"SOLineID");
+			//string str1 = g_xdoc_shoppingcart.getData(0,"data/Item",row,"EnquiryLineID");
+			string str1 = g_xdoc_shoppingcart.getData(0,"data/Item",row,"EnquiryPriceListID");
+			if(str1 !="")
+				str += "el:" + str1;
+			else if(str != "")
+				str = "sl:"+str;
+			else if(dwc_list.GetItemString(row, "SKUNo") !="") 
+				str =dwc_list.GetItemString(row, "SKUNo");
+			else
+				str =dwc_list.GetItemString(row, "No");
+			
+			if(dwc_list.IsRowSelected(row) & 0xff)
+			{
+				//will unselect
+				impStr = impStr.replace(" "+str,"");
+			}else
+			{
+				//will select
+				impStr += " " + str;
+			}
+			return 1;
+		}
+		
+		int OnDoubleClicked(ref TNotifyEvent evt,int p)
+		{
+			int hCursor = xutil::SetCursorWait();
+			ref DWNMHDR hdr = cast(evt.pnmh as ref DWNMHDR);
+			int row = hdr.row;
+			string ls_nos = "ImportXml:";
+			string str = g_xdoc_shoppingcart.getData(0,"data/Item",row,"SOLineID");
+			string str1 = g_xdoc_shoppingcart.getData(0,"data/Item",row,"EnquiryPriceListID");
+			if(str1 !="")
+				str += "el:" + str1;
+			else if(str != "")
+				str = "sl:"+str;
+			else if(dwc_list.GetItemString(row, "SKUNo") !="") 
+				str =dwc_list.GetItemString(row, "SKUNo");
+			else
+				str =dwc_list.GetItemString(row, "No");
+			ls_nos += str;
+			
+			dw_list.SelectRow(0,false);
+			dwc_list.SelectRow(0,false);
+			dw_list.Redraw();
+			dwc_list.Redraw();
+			impStr ="";
+			
+			win32::SendMessage(hObject,0x401,ls_nos,0);
+
+			xutil::RestoreCursor(hCursor);
+			CloseWindow();
+			return 1;		
+		}
+			
+		int OnAttachEvent()
+		{
+			//绑定工具条点击事件
+			AttachEvent("WM_XCOMMAND",OnXCommand);
+			//获取焦点事件,用于重置工具条
+			AttachEvent("WM_SETFOCUS",OnSetFocus);
+			AttachEvent("dw_list","DWV_ROWFOCUSCHANGED",OnRowChanged);
+			AttachEvent("dwc_list","DWV_ROWFOCUSCHANGED",OnGoodsCarRowChanged);			
+			AttachEvent("tv_folder", "TVN_ITEMEXPANDING",OnTreeExpanding);
+			AttachEvent("tv_folder", "TVN_SELCHANGED",OnTreeSelChanged);
+			
+			AttachEvent("dwc_list","DWV_DOUBLECLICKED",OnDoubleClicked);
+			
+			AttachEvent("WM_COMMAND",OnCkbCLick);	//checkbox打钩事件
+			AttachEvent("WM_COMMAND",OnCkbCLick2);	//checkbox打钩事件	
+			
+			AttachEvent("dw_list","DWV_CLICKED",OnDwClicked);
+			AttachEvent("dwc_list","DWV_CLICKED",OnDwcClicked);
+		}
+
+		int onload()
+		{
+			agentFor = "goodslib";
+			impStr = "";
+					
+			OnAttachEvent();	
+			
+			tv_folder = GetControl("tv_folder");
+			dw_list 	= GetControl("dw_list");
+			dwc_list = GetControl("dwc_list");
+
+			xaserverarg arg = GetParam();
+			CustomerID = "";
+			m_customer ="";
+			hObject = 0;
+			if(arg)
+			{
+				hObject = arg.GetArgString("HWND").toInt();
+				CustomerID = arg.GetArgString("CustomerID");
+			}
+			InitialFolder();
+			
+			g_xdoc_product = new xdataset;
+			g_xdoc_product.Init();
+			xbind bindproduct = new xbind;
+			bindproduct.bindEx(dw_list, g_xdoc_product,"");
+			
+			g_xdoc_shoppingcart = new xdataset;
+			g_xdoc_shoppingcart.Init();
+
+			xbind bindcart = new xbind;
+			bindcart.bindEx(dwc_list, g_xdoc_shoppingcart,"");
+
+			dw_list.SetDataObject(ProductLibraryView::GetMaintListForm3("").GetXmlDoc());
+			dw_list = GetControl("dw_list");
+			dw_list.SetReadOnly(true);
+					
+			dwc_list.openUrl("/sale/view/ProductLibrary/template/cart/goodslist"); 
+			dwc_list.SetReadOnly(true);
+
+			if(dw_list.GetRowCount())
+			{
+				htmlctrl xs = GetControl("html_detail");
+				xs.SetContent(makeHtml(1));
+			}
+			
+			xtreeview::ExpandItem(tv_folder.GetId(),
+				xtreeview::GetNextItem(tv_folder.GetId(),xtreeview::GetRootItem(tv_folder.GetId())));
+			xtreeview::ExpandItem(tv_folder.GetId(),
+				xtreeview::GetNextItem(tv_folder.GetId(),xtreeview::GetNextItem(tv_folder.GetId(),xtreeview::GetRootItem(tv_folder.GetId()))));
+			
+			dw_list.SetSelectionMode(3);
+			dwc_list.SetSelectionMode(3);
+			
+			return 1;
+		}
+		
+		int onloaded()
+		{
+			SetAgent();			
+			
+			return 1;
+		}		
+	};
+]
\ No newline at end of file
diff --git a/jrj/project/business/Quote/QuoteFilePurch.cpp b/jrj/project/business/Quote/QuoteFilePurch.cpp
new file mode 100644
index 0000000..28ef245
--- /dev/null
+++ b/jrj/project/business/Quote/QuoteFilePurch.cpp
@@ -0,0 +1,182 @@
+use "xcontrol.vframe.vbusiness.vd"
+use "xbase.vframe.vbusiness.vd"
+
+unit trade 
+[
+	class QuoteFilePurch :  public xframe
+	{
+		xdwgrid	dw_list;
+		xnode	m_agentNode;	//Agent Condition
+
+		int SetAgent()
+		{
+			string xfNodeAgentArea  = "agentarea";
+			xnode anode = GetAgentNode(xfNodeAgentArea);
+			if(m_agentNode)
+			{
+				SetAgentNodeContent (anode,m_agentNode);
+			}
+			else
+			{
+				msxml::IXMLDOMElement xframeElement =  GetElement();
+				msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*");
+				if(agent)
+				{
+					string s = agent.xml;
+					m_agentNode =  SetAgentNodeContent (anode,s);
+				}
+			}
+			return 1;
+		}
+
+		//焦点激活处理函数
+		int OnSetFocus(ref TEvent evt,int param)
+		{
+			//重置工具条
+			//SetAgent();
+			return 1;
+		}
+
+		int OnValid()
+		{
+			for(int row=1;row<=dw_list.GetRowCount();row++)
+			{
+				if(dw_list.GetItemString(row,"IsSend")=="1")
+				{
+					if(dw_list.GetItemString(row,"ItemName")=="")
+					{
+						alert("第"+row.toString()+"行商品英文名称未输入,补全后再发送给业务员");
+						return 0;
+					}
+					if(dw_list.GetItemString(row,"ItemCName")=="")
+					{
+						alert("第"+row.toString()+"行商品名称未输入,补全后再发送给业务员");
+						return 0;
+					}
+					if(dw_list.GetItemString(row,"Package")=="")
+					{
+						alert("第"+row.toString()+"行商品包装未输入,补全后再发送给业务员");
+						return 0;
+					}
+				}
+			}
+			return 1;
+		}
+					
+		int OnOK()
+		{
+			dw_list.AcceptText();
+			if(OnValid()==0) return 1;
+					
+			xml x = new xml;
+			x.setNativePointer(xml::CreateInstance());
+			dw_list.DwUpdateAllToEx(x.GetXmlDoc());
+			if(GetParam())
+			{
+				xaserverarg arg = GetParam();
+				arg.AddArg("process","ok");
+				arg.AddArg("value",x.GetXml());
+			}
+			CloseWindow();
+			return 1;
+		}
+				
+		int OnCancel()
+		{
+			CloseWindow();
+			return 1;
+		}
+		
+		int SelectAll()
+		{
+			for(int row = 1; row <= dw_list.GetRowCount(); row++)
+			{
+				dw_list.SetItemString(row,"IsSend","1");
+			}
+			dw_list.Redraw();
+			return 1;
+		}
+		
+		int UnSelectAll()
+		{
+			for(int row = 1; row <= dw_list.GetRowCount(); row++)
+			{
+				dw_list.SetItemString(row,"IsSend","0");
+			}
+			dw_list.Redraw();
+			return 1;
+		}
+		
+		//命令发布函数
+		int OnCmdDispatch(string comdid)
+		{
+			if(comdid=="xmOK") return OnOK();
+			else if(comdid=="xmCancel") return OnCancel();
+			else if(comdid=="xmSelectAll") return SelectAll();
+			else if(comdid=="xmUnSelectAll") return UnSelectAll();
+			
+			return 0;
+		}
+		
+		//命令处理事件
+		int OnXCommand(ref TXCommandEvent evt,int param)
+		{
+			return OnCmdDispatch(evt.pStrID);
+		}
+		
+		int OnAttachEvent()
+		{
+			//绑定工具条点击事件
+			AttachEvent("WM_XCOMMAND",OnXCommand);
+			//获取焦点事件,用于重置工具条
+			AttachEvent("WM_SETFOCUS",OnSetFocus);
+		}
+		
+		/*
+		int  OnRetrieve()
+		{
+			xml x = new xml;
+			x.setNativePointer(xml::CreateInstance());
+			xaserverarg arg = new xaserverarg;
+			arg.setNativePointer(arg.CreateInstance());	
+			arg.AddArg("xxx","xxx");
+			if (getUrl("",arg.GetString(),x)!=1)
+			{
+				trace(x.GetXmlDoc().text);
+				return -1;
+			}else	
+			{
+				//dw_list.Retrieve(x);
+				//dw_list.Redraw();
+			}
+			return 1;
+		}
+		*/
+		
+		int onload()
+		{
+			dw_list = GetControl("dw_list");
+			dw_list.openUrl("/sale/view/Quote3/template/Quote/QuoteFileItem");
+		
+			if(GetParam())
+			{
+				xaserverarg arg = GetParam();
+				string val = arg.GetArgString("value");
+				xml x = new xml;
+				x.setNativePointer(xml::CreateInstance());
+				x.LoadXml(val);
+				dw_list.Retrieve(x);
+			}
+			OnAttachEvent();	
+			
+			return 1;
+		}
+		
+		int onloaded()
+		{
+			//SetAgent();			
+			
+			return 1;
+		}		
+	};
+]
\ No newline at end of file
diff --git a/jrj/project/business/Quote/QuoteFilePurched.cpp b/jrj/project/business/Quote/QuoteFilePurched.cpp
new file mode 100644
index 0000000..4733c3b
--- /dev/null
+++ b/jrj/project/business/Quote/QuoteFilePurched.cpp
@@ -0,0 +1,183 @@
+use "xcontrol.vframe.vbusiness.vd"
+use "xbase.vframe.vbusiness.vd"
+
+unit trade 
+[
+	class QuoteFilePurched :  public xframe
+	{
+		xdwgrid	dw_list;
+		xnode	m_agentNode;	//Agent Condition
+
+		int SetAgent()
+		{
+			string xfNodeAgentArea  = "agentarea";
+			xnode anode = GetAgentNode(xfNodeAgentArea);
+			if(m_agentNode)
+			{
+				SetAgentNodeContent (anode,m_agentNode);
+			}
+			else
+			{
+				msxml::IXMLDOMElement xframeElement =  GetElement();
+				msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*");
+				if(agent)
+				{
+					string s = agent.xml;
+					m_agentNode =  SetAgentNodeContent (anode,s);
+				}
+			}
+			return 1;
+		}
+
+		//焦点激活处理函数
+		int OnSetFocus(ref TEvent evt,int param)
+		{
+			//重置工具条
+			//SetAgent();
+			return 1;
+		}
+
+		int OnValid()
+		{
+			/*
+			for(int row=1;row<=dw_list.GetRowCount();row++)
+			{
+				if(dw_list.GetItemString(row,"IsSend")=="1")
+				{
+					if(dw_list.GetItemString(row,"ItemName")=="")
+					{
+						alert("第"+row.toString()+"行商品英文名称未输入,补全后再发送给业务员");
+						return 0;
+					}
+					if(dw_list.GetItemString(row,"ItemCName")=="")
+					{
+						alert("第"+row.toString()+"行商品名称未输入,补全后再发送给业务员");
+						return 0;
+					}
+					if(dw_list.GetItemString(row,"Package")=="")
+					{
+						alert("第"+row.toString()+"行商品包装未输入,补全后再发送给业务员");
+						return 0;
+					}
+				}
+			}
+			*/
+			return 1;
+		}
+					
+		int OnOK()
+		{
+			if(OnValid()==0) return 1;
+					
+			xml x = new xml;
+			x.setNativePointer(xml::CreateInstance());
+			dw_list.DwUpdateAllToEx(x.GetXmlDoc());
+			if(GetParam())
+			{
+				xaserverarg arg = GetParam();
+				arg.AddArg("process","ok");
+				arg.AddArg("value",x.GetXml());
+			}
+			CloseWindow();
+			return 1;
+		}
+				
+		int OnCancel()
+		{
+			CloseWindow();
+			return 1;
+		}
+		
+		int SelectAll()
+		{
+			for(int row = 1; row <= dw_list.GetRowCount(); row++)
+			{
+				dw_list.SetItemString(row,"IsSend","1");
+			}
+			dw_list.Redraw();
+			return 1;
+		}
+		
+		int UnSelectAll()
+		{
+			for(int row = 1; row <= dw_list.GetRowCount(); row++)
+			{
+				dw_list.SetItemString(row,"IsSend","0");
+			}
+			dw_list.Redraw();
+			return 1;
+		}
+		
+		//命令发布函数
+		int OnCmdDispatch(string comdid)
+		{
+			if(comdid=="xmOK") return OnOK();
+			else if(comdid=="xmCancel") return OnCancel();
+			else if(comdid=="xmSelectAll") return SelectAll();
+			else if(comdid=="xmUnSelectAll") return UnSelectAll();
+			
+			return 0;
+		}
+		
+		//命令处理事件
+		int OnXCommand(ref TXCommandEvent evt,int param)
+		{
+			return OnCmdDispatch(evt.pStrID);
+		}
+		
+		int OnAttachEvent()
+		{
+			//绑定工具条点击事件
+			AttachEvent("WM_XCOMMAND",OnXCommand);
+			//获取焦点事件,用于重置工具条
+			AttachEvent("WM_SETFOCUS",OnSetFocus);
+		}
+		
+		/*
+		int  OnRetrieve()
+		{
+			xml x = new xml;
+			x.setNativePointer(xml::CreateInstance());
+			xaserverarg arg = new xaserverarg;
+			arg.setNativePointer(arg.CreateInstance());	
+			arg.AddArg("xxx","xxx");
+			if (getUrl("",arg.GetString(),x)!=1)
+			{
+				trace(x.GetXmlDoc().text);
+				return -1;
+			}else	
+			{
+				//dw_list.Retrieve(x);
+				//dw_list.Redraw();
+			}
+			return 1;
+		}
+		*/
+		
+		int onload()
+		{
+			dw_list = GetControl("dw_list");
+			dw_list.openUrl("/sale/view/Quote3/template/Quote/QuoteFilePurchedItem");
+		
+			if(GetParam())
+			{
+				xaserverarg arg = GetParam();
+				string val = arg.GetArgString("value");
+				xml x = new xml;
+				x.setNativePointer(xml::CreateInstance());
+				x.LoadXml(val);
+				dw_list.Retrieve(x);
+			}
+			OnAttachEvent();	
+			
+			return 1;
+		}
+		
+		int onloaded()
+		{
+			//SetAgent();			
+			
+			return 1;
+		}		
+	};
+]
\ No newline at end of file
diff --git a/jrj/project/business/Quote/QuoteSupplierItem.cpp b/jrj/project/business/Quote/QuoteSupplierItem.cpp
new file mode 100644
index 0000000..8ff8ee3
--- /dev/null
+++ b/jrj/project/business/Quote/QuoteSupplierItem.cpp
@@ -0,0 +1,189 @@
+use "xcontrol.vframe.vbusiness.vd"
+use "xbase.vframe.vbusiness.vd"
+use "supplier.view.vd"
+
+unit trade 
+[
+	class QuoteSupplierItem :  public xframe
+	{
+		xdwgrid	dw_list;
+		xnode	m_agentNode;	//Agent Condition
+
+		int SetAgent()
+		{
+			string xfNodeAgentArea  = "agentarea";
+			xnode anode = GetAgentNode(xfNodeAgentArea);
+			if(m_agentNode)
+			{
+				SetAgentNodeContent (anode,m_agentNode);
+			}
+			else
+			{
+				msxml::IXMLDOMElement xframeElement =  GetElement();
+				msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*");
+				if(agent)
+				{
+					string s = agent.xml;
+					m_agentNode =  SetAgentNodeContent (anode,s);
+				}
+			}
+			return 1;
+		}
+
+		//焦点激活处理函数
+		int OnSetFocus(ref TEvent evt,int param)
+		{
+			//重置工具条
+			//SetAgent();
+			return 1;
+		}
+
+		int OnOk()
+		{
+			DoUpdate();
+			return 1;
+		}
+		
+		int OnCancel()
+		{
+			CloseWindow();
+			return 1;
+		}
+		
+		//命令发布函数
+		int OnCmdDispatch(string comdid)
+		{
+			if(comdid=="xmCancel") return OnCancel();
+			else if(comdid=="xmOK") return OnOk();
+			else if(comdid=="xmDelete") return OnDelete();
+			
+			return 0;
+		}
+		
+		//命令处理事件
+		int OnXCommand(ref TXCommandEvent evt,int param)
+		{
+			return OnCmdDispatch(evt.pStrID);
+		}
+		
+		int OnDelete()
+		{
+			dw_list.DeleteRow(dw_list.GetRow());
+			return 0;
+		}
+
+		int DoUpdate()
+		{
+			dw_list.AcceptText();
+			
+			xml xitem = new xml;
+			xitem.setNativePointer(xml::CreateInstance());
+			msxml::IXMLDOMDocument xitemdoc = xitem.GetXmlDoc();
+			dw_list.DwUpdateAllToEx(xitemdoc);
+			xaserverarg arg = new xaserverarg;
+			arg.setNativePointer(arg.CreateInstance());
+			arg.AddArg("content",xitem.GetXml());
+			
+			//alert(xitem.GetXml());
+			//return 1;
+			
+			if(url::get("/sale/data/SupplierV3/entity/update/quotemysupplier", arg.GetString(),xitem)!=1)
+			{
+				string error1 = xitem.GetXmlDoc().text;
+				return 1;
+			}else
+			{
+				string str = xitem.GetXmlDoc().documentElement.getAttribute("text");
+				if(str == "false")
+				{
+					alert("保存失败!");
+					return -1;
+				}
+				alert("保存成功!");
+				dw_list.ResetUpdateStatus();
+			}
+			
+			return 1;
+		}
+		
+		int OnAttachEvent()
+		{
+			//绑定工具条点击事件
+			AttachEvent("WM_XCOMMAND",OnXCommand);
+			//获取焦点事件,用于重置工具条
+			AttachEvent("WM_SETFOCUS",OnSetFocus);
+		}
+		
+		int  OnRetrieve()
+		{
+			if(GetParam())
+			{
+				xaserverarg arg = GetParam();
+				string val = arg.GetArgString("value");
+				xml x = new xml;
+				x.setNativePointer(x.CreateInstance());
+				x.LoadXml(val);
+				dw_list.Retrieve(x);
+				dw_list.Redraw();
+			
+				string sPartyNo = publiccode::GetIdentityNo("Party2");
+				string No ="";
+				string Name ="";
+				string NameEx ="";
+				/*for(int i=0; i <=dw_list.GetRowCount() ;i++)
+				{
+					Name=dw_list.GetItemString(i,"Name");
+					if(Name !="")
+					{
+						if(NameEx =="") 
+						{
+							NameEx = Name;
+						}
+						else if(NameEx.find(Name) < 0) 
+						{
+							
+							//dw_list.DeleteRow(i);
+						}
+					}
+				}*/
+			
+			
+				for(int row = 1;row <= dw_list.GetRowCount(); row++)
+				{
+					if(row==1) 
+						No = sPartyNo;
+					else
+						No = ("0000"+(No.toInt()+1).toString()).right(4);
+					dw_list.SetItemString(row,"PartyNo",No+"N");
+					dw_list.SetItemString(row,"Type","12");
+					dw_list.SetItemString(row,"IdentifyAddressFlag","Y");
+					dw_list.SetItemString(row,"PrimaryFlag","Y");
+					
+					string id = ViewObject::GetGuid();
+					msxml::IXMLDOMElement ele = dw_list.GetRowElement(row);
+					ele.SetAttribute("guid",id);
+					//dw_list.SetGuid(row,id);
+				}
+			}
+			return 1;
+		}
+		
+		int onload()
+		{
+			dw_list = GetControl("dw_list");
+			dw_list.openUrl("/sale/view/Quote3/template/Quote/QuoteSupplierItem");
+		
+			OnAttachEvent();	
+			OnRetrieve();
+			
+			return 1;
+		}
+		
+		int onloaded()
+		{
+			//SetAgent();			
+			
+			return 1;
+		}		
+	};
+]
\ No newline at end of file
diff --git a/jrj/project/business/Quote/TONewSelectDlg.cpp b/jrj/project/business/Quote/TONewSelectDlg.cpp
new file mode 100644
index 0000000..897a657
--- /dev/null
+++ b/jrj/project/business/Quote/TONewSelectDlg.cpp
@@ -0,0 +1,99 @@
+use "xcontrol.vframe.vbusiness.vd"
+use "xbase.vframe.vbusiness.vd"
+
+unit trade 
+[
+	class xxx :  public xframe
+	{
+		//xdwgrid	dw_list;
+
+		xnode	m_agentNode;	//Agent Condition
+
+		int SetAgent()
+		{
+			string xfNodeAgentArea  = "agentarea";
+			xnode anode = GetAgentNode(xfNodeAgentArea);
+			if(m_agentNode)
+			{
+				SetAgentNodeContent (anode,m_agentNode);
+			}
+			else
+			{
+				msxml::IXMLDOMElement xframeElement =  GetElement();
+				msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*");
+				if(agent)
+				{
+					string s = agent.xml;
+					m_agentNode =  SetAgentNodeContent (anode,s);
+				}
+			}
+			return 1;
+		}
+
+		//焦点激活处理函数
+		int OnSetFocus(ref TEvent evt,int param)
+		{
+			//重置工具条
+			SetAgent();
+			return 1;
+		}
+
+		//命令发布函数
+		int OnCmdDispatch(string comdid)
+		{
+			return 0;
+		}
+		
+		//命令处理事件
+		int OnXCommand(ref TXCommandEvent evt,int param)
+		{
+			return OnCmdDispatch(evt.pStrID);
+		}
+		
+		int OnAttachEvent()
+		{
+			//绑定工具条点击事件
+			AttachEvent("WM_XCOMMAND",OnXCommand);
+			//获取焦点事件,用于重置工具条
+			AttachEvent("WM_SETFOCUS",OnSetFocus);
+		}
+		
+		/*
+		int  OnRetrieve()
+		{
+			xml x = new xml;
+			x.setNativePointer(xml::CreateInstance());
+			xaserverarg arg = new xaserverarg;
+			arg.setNativePointer(arg.CreateInstance());	
+			arg.AddArg("xxx","xxx");
+			if (getUrl("",arg.GetString(),x)!=1)
+			{
+				trace(x.GetXmlDoc().text);
+				return -1;
+			}else	
+			{
+				//dw_list.Retrieve(x);
+				//dw_list.Redraw();
+			}
+			return 1;
+		}
+		*/
+		
+		int onload()
+		{
+			//dw_list = GetControl("xxx");
+			//dw_list.openUrl("xxx");
+		
+			OnAttachEvent();	
+			
+			return 1;
+		}
+		
+		int onloaded()
+		{
+			SetAgent();			
+			
+			return 1;
+		}		
+	};
+]
\ No newline at end of file
diff --git a/jrj/project/business/Quote/TOSelectDlg.cpp b/jrj/project/business/Quote/TOSelectDlg.cpp
new file mode 100644
index 0000000..4b18ce9
--- /dev/null
+++ b/jrj/project/business/Quote/TOSelectDlg.cpp
@@ -0,0 +1,255 @@
+use "xcontrol.vframe.vbusiness.vd"
+use "xbase.vframe.vbusiness.vd"
+use "base.view.vd"
+
+unit trade 
+[
+	class TOSelectDlg :  public frame
+	{
+		//xdwgrid	dw_list;
+		xlistview  lv_view;
+		xlistview  lv_view1;
+		int columnCount;
+		xnode	m_agentNode;	//Agent Condition
+
+		int SetAgent()
+		{
+			string xfNodeAgentArea  = "agentarea";
+			xnode anode = GetAgentNode(xfNodeAgentArea);
+			if(m_agentNode)
+			{
+				SetAgentNodeContent (anode,m_agentNode);
+			}
+			else
+			{
+				msxml::IXMLDOMElement xframeElement =  GetElement();
+				msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*");
+				if(agent)
+				{
+					string s = agent.xml;
+					m_agentNode =  SetAgentNodeContent (anode,s);
+				}
+			}
+			return 1;
+		}
+
+		//焦点激活处理函数
+		int OnSetFocus(ref TEvent evt,int param)
+		{
+			//重置工具条
+			SetAgent();
+			return 1;
+		}
+
+		//命令发布函数
+		int OnCmdDispatch(string comdid)
+		{
+			if(comdid=="xmCancel")
+			{
+				CloseWindow();
+				return 1;
+			}
+			else if(comdid=="xmOK")
+			{
+				int  LVNI_FOCUSED        = 0x0001;
+				int nItem =xlistview::GetNextItem(lv_view.GetId(), -1, LVNI_FOCUSED);
+				if(nItem < 0) return 1;
+			
+				if(GetParam())
+				{
+					msxml::IXMLDOMElement ele = GetItemData(lv_view, nItem);
+					xaserverarg arg = GetParam();
+					arg.AddArg("action","new");
+					arg.AddArg("ID",ele.getAttribute("guid"));
+					arg.AddArg("id",ele.getAttribute("guid"));
+				}
+				//重置工具条
+				CloseWindow();
+				return 1;
+			}
+			return 0;
+		}
+		
+		msxml::IXMLDOMElement  GetItemData(xlistview lv_item, int hItem)
+		{
+			int LVIF_PARAM = 0x0004;
+			
+			lvitem lvItem;
+			lvItem.iItem = hItem;
+			lvItem.iSubItem = 0;
+			lvItem.mask = LVIF_PARAM ;
+			
+			xlistview::GetItem(lv_item.GetId(), lvItem);
+			msxml::IXMLDOMElement  ele = trust(lvItem.lParam as msxml::IXMLDOMElement); 
+			return ele;
+		}
+		
+		int OnListViewDoubleClicked(ref TEvent evt,int param)
+		{
+			int  LVNI_ALL                = 0x0000;
+			int  LVNI_FOCUSED        = 0x0001;
+			int  LVNI_SELECTED       = 0x0002;
+			int  LVNI_CUT               = 0x0004;
+			int  LVNI_DROPHILITED   = 0x0008;
+			
+			int nItem =xlistview::GetNextItem(lv_view.GetId(), -1, LVNI_FOCUSED);
+			if(nItem < 0) return 1;
+			
+			if(GetParam())
+			{
+				msxml::IXMLDOMElement ele = GetItemData(lv_view, nItem);
+				xaserverarg arg = GetParam();
+				arg.AddArg("action","new");
+				arg.AddArg("ID",ele.getAttribute("guid"));
+				arg.AddArg("id",ele.getAttribute("guid"));
+			}
+			//重置工具条
+			CloseWindow();
+			return 1;
+		}
+		
+		int OnListViewDoubleClicked1(ref TEvent evt,int param)
+		{
+			int  LVNI_ALL                = 0x0000;
+			int  LVNI_FOCUSED        = 0x0001;
+			int  LVNI_SELECTED       = 0x0002;
+			int  LVNI_CUT               = 0x0004;
+			int  LVNI_DROPHILITED   = 0x0008;
+			
+			int nItem =xlistview::GetNextItem(lv_view1.GetId(), -1, LVNI_FOCUSED);
+			if(nItem < 0) return 1;
+			
+			if(GetParam())
+			{
+				msxml::IXMLDOMElement ele = GetItemData(lv_view1, nItem);
+				xaserverarg arg = GetParam();
+				arg.AddArg("action","open");
+				arg.AddArg("id",ele.getAttribute("id"));
+				arg.AddArg("ID",ele.getAttribute("id"));
+				arg.AddArg("ItemID",ele.getAttribute("itemid"));
+			}
+			//重置工具条
+			//OnDocumentOpen();
+			CloseWindow();
+			return 1;
+		}
+
+		int SetListViewHeaderColumn(string Url,xlistview lv_item)
+		{
+			const int LVCFMT_LEFT = 0;
+			for(int i=0;i<3;i++)  lv_item.DeleteColumn(lv_item.GetId(),1);
+			//if(Url=="")
+			//{
+				lv_item.InsertColumn(lv_item.GetId(),0,"创建日期",LVCFMT_LEFT,80,0);
+				lv_item.InsertColumn(lv_item.GetId(),0,"创建人员",LVCFMT_LEFT,80,0);
+				lv_item.InsertColumn(lv_item.GetId(),0,"名称",0,120,0);
+				columnCount = 3;
+			//}
+			return 1;
+		}
+		
+		int SetListViewHeaderColumnItem(string Url,xlistview lv_item)
+		{
+			const int LVCFMT_LEFT = 0;
+			for(int i=0;i<6;i++)  lv_item.DeleteColumn(lv_item.GetId(),1);
+			//if(Url=="")
+			//{
+				lv_item.InsertColumn(lv_item.GetId(),0,"最后修改日期",LVCFMT_LEFT,80,0);
+				lv_item.InsertColumn(lv_item.GetId(),0,"创建日期",LVCFMT_LEFT,80,0);
+				lv_item.InsertColumn(lv_item.GetId(),0,"创建人员",LVCFMT_LEFT,80,0);
+				lv_item.InsertColumn(lv_item.GetId(),0,"状态",0,70,0);
+				lv_item.InsertColumn(lv_item.GetId(),0,"主题",0,120,0);
+				lv_item.InsertColumn(lv_item.GetId(),0,"编号",0,70,0);
+				lv_item.InsertColumn(lv_item.GetId(),0,"事务",0,60,0);
+				columnCount = 6;
+			//}
+			return 1;
+		}
+
+		//命令处理事件
+		int OnXCommand(ref TXCommandEvent evt,int param)
+		{
+			return OnCmdDispatch(evt.pStrID);
+		}
+		
+		int OnAttachEvent()
+		{
+			//绑定工具条点击事件
+			AttachEvent("WM_XCOMMAND",OnXCommand);
+			//获取焦点事件,用于重置工具条
+			AttachEvent("WM_SETFOCUS",OnSetFocus);
+		}
+		
+		int RetrieveEx()
+		{
+			xml x = ViewObject::RetrieveData("/sale/data/TO/business/document/list");
+			if(x)
+			{
+				msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement;
+				msxml::IXMLDOMNodeList nlist=ele.SelectNodes("*");
+				int s=nlist.length;
+				if (s>0)
+				{
+					for (int i=0; i<s; i++)
+					{
+						msxml::IXMLDOMElement e=nlist.item(i);
+						string name=e.getAttribute("caption");
+						int nItem = xlistview::InsertItemEx(lv_view1.GetId(),0,name,23,cast(e as int));
+						
+						xlistview::SetItemText(lv_view1.GetId(),nItem,2,e.getAttribute("subject"));
+						xlistview::SetItemText(lv_view1.GetId(),nItem,4,e.getAttribute("CreatorID"));
+						xlistview::SetItemText(lv_view1.GetId(),nItem,5,e.getAttribute("CreateDate"));
+						xlistview::SetItemText(lv_view1.GetId(),nItem,6,e.getAttribute("LastUpdateDate"));
+					}		
+				}
+			}
+			return 1;
+		}
+		
+		int Retrieve(string src)
+		{
+			xml x = ViewObject::RetrieveData("/sale/data/TO/template/list", "role","");
+			if(x)
+			{
+				msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement;
+				msxml::IXMLDOMNodeList nlist=ele.SelectNodes("*");
+				int s=nlist.length;
+				if (s>0)
+				{
+					for (int i=0; i<s; i++)
+					{
+						msxml::IXMLDOMElement e=nlist.item(i);
+						string name=e.getAttribute("caption");
+						int nItem = xlistview::InsertItemEx(lv_view.GetId(),0,name,23,cast(e as int));
+						
+						xlistview::SetItemText(lv_view.GetId(),nItem,1,e.getAttribute("Creator"));
+						xlistview::SetItemText(lv_view.GetId(),nItem,2,e.getAttribute("CreateDate"));
+					}		
+				}
+			}
+			return 1;
+		}
+		
+		int onload()
+		{
+			lv_view = GetControl("lv_view");
+			xlistview::SetdwStyle(lv_view.GetId(),0);
+			
+			lv_view1 = GetControl("lv_view1");
+			//xlistview::SetdwStyle(lv_view1.GetId(),0);
+				
+			columnCount = 0;
+			SetListViewHeaderColumn("",lv_view);
+			SetListViewHeaderColumnItem("",lv_view1);
+			AttachEvent("lv_view", "NM_DBLCLK",OnListViewDoubleClicked);
+			AttachEvent("lv_view1", "NM_DBLCLK",OnListViewDoubleClicked1);
+		
+			OnAttachEvent();
+			
+			Retrieve("");
+			RetrieveEx();
+			
+			return 1;
+		}
+	};
+]
\ No newline at end of file
diff --git a/jrj/project/business/Quote/XmShare.Quote.v3.cpp b/jrj/project/business/Quote/XmShare.Quote.v3.cpp
new file mode 100644
index 0000000..4fc4da0
--- /dev/null
+++ b/jrj/project/business/Quote/XmShare.Quote.v3.cpp
@@ -0,0 +1,177 @@
+use "xcontrol.vframe.vbusiness.vd"
+use "xbase.vframe.vbusiness.vd"
+use "saleorder.view.vd"
+
+unit trade 
+[
+	class XmShareQuotev3 :  public xframe
+	{
+		xdwgrid	dw_list;
+		xdwtable dw_paper;
+		xnode	m_agentNode;	//Agent Condition
+
+		int SetAgent()
+		{
+			string xfNodeAgentArea  = "agentarea";
+			xnode anode = GetAgentNode(xfNodeAgentArea);
+			if(m_agentNode)
+			{
+				SetAgentNodeContent (anode,m_agentNode);
+			}
+			else
+			{
+				msxml::IXMLDOMElement xframeElement =  GetElement();
+				msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*");
+				if(agent)
+				{
+					string s = agent.xml;
+					m_agentNode =  SetAgentNodeContent (anode,s);
+				}
+			}
+			return 1;
+		}
+
+		//焦点激活处理函数
+		int OnSetFocus(ref TEvent evt,int param)
+		{
+			//重置工具条
+			//SetAgent();
+			return 1;
+		}
+		int OnSave()
+		{
+			xml x = new xml;
+			x.setNativePointer(x.CreateInstance());
+			dw_list.AcceptText();
+			dw_list.DwUpdateAllToEx(x.GetXmlDoc());
+			
+			string val = x.GetXml();
+			
+			xaserverarg arg = new xaserverarg;
+			arg.setNativePointer(arg.CreateInstance());	
+			arg.AddArg("content",val);
+			//trace(val);
+			if(url::get("/sale/data/UserGroup/update/entity", arg.GetString(),x)!=1)
+			{
+				string error = x.GetXmlDoc().text;
+				//alert(error);
+				return 1;
+			}else
+			{
+				string str = x.GetXmlDoc().documentElement.getAttribute("text");
+				if(str == "true")
+				{
+					dw_list.ResetUpdateStatus();
+					alert("保存成功!"); 
+					
+					CloseWindow();
+				}else 
+				{
+					alert("保存失败!");
+				}
+				//alert(x.GetXml());
+			}
+			return 1;
+		}		
+		
+		int OnDelete()
+		{
+			int MB_OKCANCEL = 1;
+			int IDOK  = 1;
+			int ret = win32::MessageBox(GetHWND(),"确认删除?","提示",MB_OKCANCEL);
+			if(ret == IDOK)
+			{
+				msxml::IXMLDOMElement ele = dw_list.GetRowElement(dw_list.GetRow());
+				string ID = ele.getAttribute("guid");
+				
+				xml x = ViewObject::RetrieveData("/sale/data/Quote3/DeleteXmShare","ID",ID);
+				string status = x.GetXml();
+				if(status.find("ok") == 1)
+				{
+					alert("删除成功");
+					dw_list.DeleteRow(dw_list.GetRow());
+				}else
+				{
+					alert("删除失败");
+				}
+				
+			}
+			return 0;
+		}
+		//命令发布函数
+		int OnCmdDispatch(string comdid)
+		{
+				
+			if(comdid=="xmDelete")
+			{
+				OnDelete();
+				return 1;
+			}
+			else if(comdid=="xmSave")
+			{
+				OnSave();
+				return 1;
+			}
+			else if(comdid=="xmClose")
+			{
+				CloseWindow();
+				return 1;
+			}
+		
+			return 0;
+		}
+		
+		//命令处理事件
+		int OnXCommand(ref TXCommandEvent evt,int param)
+		{
+			return OnCmdDispatch(evt.pStrID);
+		}
+		
+		int OnAttachEvent()
+		{
+			//绑定工具条点击事件
+			AttachEvent("WM_XCOMMAND",OnXCommand);
+			//获取焦点事件,用于重置工具条
+			AttachEvent("WM_SETFOCUS",OnSetFocus);
+		}
+		
+		
+		int  OnRetrieve()
+		{
+			xml x = new xml;
+			x.setNativePointer(xml::CreateInstance());
+			xaserverarg arg = GetParam();
+			if(arg)
+			{
+				string UserID = arg.GetArgString("UserID");
+				//alert(UserID);
+				x = ViewObject::RetrieveData("/sale/data/Quote3/XmShare","UserID",UserID);
+				if(x)dw_list.Retrieve(x);
+				dw_list.SetReadOnly(true);
+				dw_list.Redraw();
+			}
+			return 1;
+		}
+		
+		
+		int onload()
+		{
+			dw_list = GetControl("dw_list");
+			dw_list.openUrl("/sale/view/Quote3/template/XmShare");
+			dw_list.SetColumnState("EntityUserGroupID",false);
+			
+			OnRetrieve();
+			
+			OnAttachEvent();	
+			
+			return 1;
+		}
+		
+		int onloaded()
+		{
+			
+			//SetAgent();
+			return 1;
+		}		
+	};
+]
\ No newline at end of file
diff --git a/jrj/project/business/Quote/trade.document.saveas.cpp b/jrj/project/business/Quote/trade.document.saveas.cpp
new file mode 100644
index 0000000..8e9c3fe
--- /dev/null
+++ b/jrj/project/business/Quote/trade.document.saveas.cpp
@@ -0,0 +1,118 @@
+use "xcontrol.vframe.vbusiness.vd"
+use "xbase.vframe.vbusiness.vd"
+use "base.view.vd"
+unit trade 
+[
+	class DocFileSaveDlg:  public xframe
+	{
+		xlistview  lv_view;
+		xnode	m_agentNode;	//Agent Condition
+		int columnCount ;
+	
+		//焦点激活处理函数
+		int OnSetFocus(ref TEvent evt,int param)
+		{
+			//重置工具条
+			return 1;
+		}
+
+
+		//命令发布函数
+		int OnCmdDispatch(string comdid)
+		{
+			if(comdid=="xmOk")
+			{
+				string filename = GetControl("filename").GetText();
+				if(filename=="") return 1;
+				xaserverarg arg = GetParam();
+				if(!arg) return 1;
+				arg.AddArg("result","ok");
+				arg.AddArg("filename",filename);
+				CloseWindow();
+				return 1;
+			}
+			else if(comdid=="xmCancel")
+			{
+				CloseWindow();
+				return 1;
+			}
+			return 0;
+		}
+		
+		//命令处理事件
+		int OnXCommand(ref TXCommandEvent evt,int param)
+		{
+			return OnCmdDispatch(evt.pStrID);
+		}
+		
+		int OnAttachEvent()
+		{
+			//绑定工具条点击事件
+			AttachEvent("WM_XCOMMAND",OnXCommand);
+			//获取焦点事件,用于重置工具条
+			AttachEvent("WM_SETFOCUS",OnSetFocus);
+		}
+		
+	
+		int SetListViewHeaderColumn(string Url)
+		{
+			const int LVCFMT_LEFT = 0;
+			for(int i=0;i<3;i++)  lv_view.DeleteColumn(lv_view.GetId(),1);
+			lv_view.InsertColumn(lv_view.GetId(),0,"创建人员",LVCFMT_LEFT,80,0);
+			lv_view.InsertColumn(lv_view.GetId(),0,"创建日期",LVCFMT_LEFT,80,0);
+			lv_view.InsertColumn(lv_view.GetId(),0,"名称",0,120,0);
+			columnCount = 3;
+			return 1;
+		}
+
+		int Retrieve(string src)
+		{
+			xml x = ViewObject::RetrieveData("/sale/data/TDocument3/folder/list", "src",src);
+			if(x)
+			{
+				msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement;
+				msxml::IXMLDOMNodeList nlist=ele.SelectNodes("*");
+				int s=nlist.length;
+				if (s>0)
+				{
+					for (int i=0; i<s; i++)
+					{
+						msxml::IXMLDOMElement e=nlist.item(i);
+						string name=e.getAttribute("caption");
+						int nItem = xlistview::InsertItemEx(lv_view.GetId(),0,name,23,cast(e as int));
+						
+						xlistview::SetItemText(lv_view.GetId(),nItem,1,e.getAttribute("Creator"));
+						xlistview::SetItemText(lv_view.GetId(),nItem,2,e.getAttribute("CreateDate"));
+					}		
+				}
+			}
+			return 1;
+		}
+		
+		int onload()
+		{
+			lv_view = GetControl("lv_view");
+			//xlistview::SetdwStyle(lv_view.GetId(),0);
+				
+			columnCount = 0;
+			SetListViewHeaderColumn("");
+			OnAttachEvent();
+			
+			if(GetParam())
+			{
+				xaserverarg arg = GetParam();
+				string src = arg.GetArgString("src");
+				Retrieve(src);
+			}
+			
+			return 1;
+		}
+		
+		int onloaded()
+		{
+			//SetAgent();			
+			
+			return 1;
+		}		
+	};
+]
\ No newline at end of file
diff --git a/jrj/project/business/Quote/trade.document.selectdlg.cpp b/jrj/project/business/Quote/trade.document.selectdlg.cpp
new file mode 100644
index 0000000..5118dd9
--- /dev/null
+++ b/jrj/project/business/Quote/trade.document.selectdlg.cpp
@@ -0,0 +1,246 @@
+use "xcontrol.vframe.vbusiness.vd"
+use "xbase.vframe.vbusiness.vd"
+use "base.view.vd"
+unit trade 
+[
+	class DocSelectDlg:  public xframe
+	{
+		//xdwgrid	dw_list;
+		xlistview  lv_view;
+		xnode	m_agentNode;	//Agent Condition
+		int columnCount ;
+	
+		int SetAgent()
+		{
+			string xfNodeAgentArea  = "agentarea";
+			xnode anode = GetAgentNode(xfNodeAgentArea);
+			if(m_agentNode)
+			{
+				SetAgentNodeContent (anode,m_agentNode);
+			}
+			else
+			{
+				msxml::IXMLDOMElement xframeElement =  GetElement();
+				msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*");
+				if(agent)
+				{
+					string s = agent.xml;
+					m_agentNode =  SetAgentNodeContent (anode,s);
+				}
+			}
+			return 1;
+		}
+
+		//焦点激活处理函数
+		int OnSetFocus(ref TEvent evt,int param)
+		{
+			//重置工具条
+			//SetAgent();
+			return 1;
+		}
+
+		int OnListViewDoubleClicked(ref TEvent evt,int param)
+		{
+			//重置工具条
+			//SetAgent();
+			OnDocumentOpen();
+			CloseWindow();
+			return 1;
+		}
+
+		int OnDocumentOpen()
+		{
+			//return 1;
+			
+			int  LVNI_ALL                = 0x0000;
+			int  LVNI_FOCUSED        = 0x0001;
+			int  LVNI_SELECTED       = 0x0002;
+			int  LVNI_CUT               = 0x0004;
+			int  LVNI_DROPHILITED   = 0x0008;
+
+			int nItem =xlistview::GetNextItem(lv_view.GetId(), -1, LVNI_FOCUSED);
+			if(nItem < 0) return 1;
+			
+			int LVIF_PARAM = 0x0004;
+			
+			lvitem lvItem;
+			lvItem.iItem = nItem;
+			lvItem.iSubItem = 0;
+			lvItem.mask = LVIF_PARAM ;
+			
+			xlistview::GetItem(lv_view.GetId(), lvItem);
+			msxml::IXMLDOMElement ele = trust(lvItem.lParam as msxml::IXMLDOMElement); 
+			
+			string src = ele.getAttribute("url");
+			string name=ele.getAttribute("caption");
+			string file ="";
+			if(src.find("/file/")>0) file = src.mid(src.find("/file/") + 6,9999);
+			if(file =="") return 1;
+			string str = file.left(2);
+			string ext = "";
+			if(name.find(".")>=0) ext = name.mid(name.find("."),name.length());
+			string sfile = file;
+			
+			xaserverarg arg =  GetParam();
+			if(arg)
+			{
+				arg.AddArg("result","ok");
+				if((arg.GetArgString("process")=="path" ||arg.GetArgString("process")=="data"))
+				{
+					string id = ele.getAttribute("ID");
+					arg.AddArg("ID", id);
+					arg.AddArg("path", src);
+					arg.AddArg("filename", name);
+					arg.AddArg("src","/business/attachment/"+str+"/"+ file+".jpg");
+					if(arg.GetArgString("process")=="path" ) return 1;
+				}
+			}
+			
+			
+			/*
+			const string d = m_Html.GetData(p.object);	
+			if(d == "") return -1;
+			string file = d.mid(0, d.find("|##@@|",0));
+			string name = d.mid(d.find("|##@@|",0)+6, d.length());
+			*/
+			
+			xaserver::CreateDirectory("C:/Temp");
+			if(arg)
+			{
+				if(arg.GetArgString("process")=="data")
+				{
+					xml x = new xml;
+					x.setNativePointer(xml ::CreateInstance());
+					xaserver::LoadUrl(GetServerUrl(),"/business/attachment/"+str+"/"+ file+".jpg","",x);
+					arg.AddArg("data",x.GetXml());
+					return 1;
+				}
+			}
+			
+			int openRet = xaserver::DownLoadFile(GetServerUrl(),"/business/attachment/"+str+"/"+ file+".jpg","","C:/Temp/"+sfile+ext);
+			
+			
+			
+			//alert("/business/attachment/"+str+"/"+ file+".jpg");
+			if(openRet < 0)
+			{
+				alert("文件打开失败1!");
+				return -1;
+			}
+			//openRet = win32::ShellExecute(0,"open","C:/Temp/"+name,"","",5);	
+			openRet = win32::ShellExecute(0,"open","C:/Temp/"+sfile+ext,"","",5);	
+			if(openRet < 32)
+			{
+				alert("文件打开失败2!");
+				return -1;
+			}
+			
+			return 1;
+		}
+
+		//命令发布函数
+		int OnCmdDispatch(string comdid)
+		{
+			return 0;
+		}
+		
+		//命令处理事件
+		int OnXCommand(ref TXCommandEvent evt,int param)
+		{
+			return OnCmdDispatch(evt.pStrID);
+		}
+		
+		int OnAttachEvent()
+		{
+			//绑定工具条点击事件
+			AttachEvent("WM_XCOMMAND",OnXCommand);
+			//获取焦点事件,用于重置工具条
+			AttachEvent("WM_SETFOCUS",OnSetFocus);
+		}
+		
+		/*
+		int  OnRetrieve()
+		{
+			xml x = new xml;
+			x.setNativePointer(xml::CreateInstance());
+			xaserverarg arg = new xaserverarg;
+			arg.setNativePointer(arg.CreateInstance());	
+			arg.AddArg("xxx","xxx");
+			if (getUrl("",arg.GetString(),x)!=1)
+			{
+				trace(x.GetXmlDoc().text);
+				return -1;
+			}else	
+			{
+				//dw_list.Retrieve(x);
+				//dw_list.Redraw();
+			}
+			return 1;
+		}
+		*/
+		
+		int SetListViewHeaderColumn(string Url)
+		{
+			const int LVCFMT_LEFT = 0;
+			for(int i=0;i<3;i++)  lv_view.DeleteColumn(lv_view.GetId(),1);
+			//if(Url=="")
+			//{
+				lv_view.InsertColumn(lv_view.GetId(),0,"创建人员",LVCFMT_LEFT,80,0);
+				lv_view.InsertColumn(lv_view.GetId(),0,"创建日期",LVCFMT_LEFT,80,0);
+				lv_view.InsertColumn(lv_view.GetId(),0,"名称",0,120,0);
+				columnCount = 3;
+			//}
+			return 1;
+		}
+
+		int Retrieve(string src)
+		{
+			xml x = ViewObject::RetrieveData("/sale/data/TDocument3/folder/list", "src",src);
+			if(x)
+			{
+				msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement;
+				msxml::IXMLDOMNodeList nlist=ele.SelectNodes("*");
+				int s=nlist.length;
+				if (s>0)
+				{
+					for (int i=0; i<s; i++)
+					{
+						msxml::IXMLDOMElement e=nlist.item(i);
+						string name=e.getAttribute("caption");
+						int nItem = xlistview::InsertItemEx(lv_view.GetId(),0,name,23,cast(e as int));
+						
+						xlistview::SetItemText(lv_view.GetId(),nItem,1,e.getAttribute("Creator"));
+						xlistview::SetItemText(lv_view.GetId(),nItem,2,e.getAttribute("CreateDate"));
+					}		
+				}
+			}
+			return 1;
+		}
+		
+		int onload()
+		{
+			lv_view = GetControl("lv_view");
+			//xlistview::SetdwStyle(lv_view.GetId(),0);
+				
+			columnCount = 0;
+			SetListViewHeaderColumn("");
+			AttachEvent("lv_view", "NM_DBLCLK",OnListViewDoubleClicked);
+			
+			if(GetParam())
+			{
+				xaserverarg arg = GetParam();
+				string src = arg.GetArgString("src");
+				Retrieve(src);
+			}
+			
+			return 1;
+		}
+		
+		int onloaded()
+		{
+			//SetAgent();			
+			
+			return 1;
+		}		
+	};
+]
\ No newline at end of file
diff --git a/jrj/project/business/Quote/xmQuoteBillList.cpp b/jrj/project/business/Quote/xmQuoteBillList.cpp
new file mode 100644
index 0000000..23ebca4
--- /dev/null
+++ b/jrj/project/business/Quote/xmQuoteBillList.cpp
@@ -0,0 +1,208 @@
+use "xcontrol.vframe.vbusiness.vd"
+use "xbase.vframe.vbusiness.vd"
+use "base.view.vd"
+
+unit trade 
+[
+	class xmQuoteBillList :  public xframe
+	{
+		xdwgrid	dw_list;
+
+		xnode	m_agentNode;	//Agent Condition
+		int hObject = 0;
+	
+		string QuoteNo;
+		string printStr;
+	
+		int SetAgent()
+		{
+			string xfNodeAgentArea  = "agentarea";
+			xnode anode = GetAgentNode(xfNodeAgentArea);
+			if(m_agentNode)
+			{
+				SetAgentNodeContent (anode,m_agentNode);
+			}
+			else
+			{
+				msxml::IXMLDOMElement xframeElement =  GetElement();
+				msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*");
+				if(agent)
+				{
+					string s = agent.xml;
+					m_agentNode =  SetAgentNodeContent (anode,s);
+				}
+			}
+			return 1;
+		}
+	
+		int OnRowChanged(ref TNotifyEvent evt,int p)
+		{
+			ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR);
+			int row = hdr.row;
+			SetAgent();
+			return 1;
+		}
+
+
+		//焦点激活处理函数
+		int OnSetFocus(ref TEvent evt,int param)
+		{
+			//重置工具条
+			SetAgent();
+			//trace(GetEntityID(1));
+			return 1;
+		}
+		
+		
+			
+		//命令发布函数
+		int OnCmdDispatch(string comdid)
+		{
+			if(comdid=="xmImport")
+			{
+				if(GetParam())
+				{
+					xaserverarg arg = GetParam();
+					arg.AddArg("items",printStr);
+					
+					arg.AddArg("action","ok");
+				}
+				CloseWindow();
+				return 1;
+			}
+			if(comdid=="xmClose")
+			{
+				
+				CloseWindow();
+				return 1;
+			}
+			if(comdid=="xmSearch")
+			{
+				
+				OnRetrieve(QuoteNo);
+				return 1;
+			}
+			if(comdid=="xmSelectAll") return SelectAll();
+			if(comdid=="xmUnSelectAll") return UnSelectAll();
+			
+			return 0;
+		}
+		
+		int OnDwClicked(ref TNotifyEvent evt,int p)
+		{
+			ref DWNMHDR hdr = cast(evt.pnmh as ref DWNMHDR);
+			char ch;
+			int row = hdr.row;
+			string col = hdr.colname;
+			
+			string str = "";
+			if(dw_list.GetGuid(row) !="")
+			{
+				str = dw_list.GetItemString(row,"QuoteLineID");
+			}
+			
+			if(dw_list.IsRowSelected(row) & 0xff)
+			{
+				printStr = printStr.replace(" "+str,"");
+			}else
+			{
+				printStr += " " + str;
+			}
+			return 1;
+		}
+		//命令处理事件
+		int OnXCommand(ref TXCommandEvent evt,int param)
+		{
+			return OnCmdDispatch(evt.pStrID);
+		}
+		
+		int SelectAll()
+		{
+			printStr="";
+			for(int row = 1; row <= dw_list.GetRowCount(); row++)
+			{
+				dw_list.SetItemString(row,"IsSend","1");
+				dw_list.SelectRow(row,true);
+				string str = "";
+				if(dw_list.GetGuid(row) !="")
+				{
+					str = dw_list.GetItemString(row,"QuoteLineID");
+					printStr += " " + str;
+				}
+			}
+			dw_list.Redraw();
+			return 1;
+		}
+		
+		int UnSelectAll()
+		{
+			printStr="";
+			for(int row = 1; row <= dw_list.GetRowCount(); row++)
+			{
+				dw_list.SetItemString(row,"IsSend","0");
+				dw_list.SelectRow(row,false);
+			}
+			dw_list.Redraw();
+			return 1;
+		}
+		
+		int OnAttachEvent()
+		{
+			//绑定工具条点击事件
+			AttachEvent("WM_XCOMMAND",OnXCommand);
+			//获取焦点事件,用于重置工具条
+			AttachEvent("WM_SETFOCUS",OnSetFocus);
+			AttachEvent("dw_list","DWV_ROWFOCUSCHANGED",OnRowChanged);		
+			AttachEvent("dw_list","DWV_CLICKED",OnDwClicked);
+			
+		}
+		
+		
+		int  OnRetrieve(string QuoteNo)
+		{
+			xml x = new xml;
+			x.setNativePointer(xml::CreateInstance());
+			xaserverarg arg = new xaserverarg;
+			arg.setNativePointer(arg.CreateInstance());
+			arg.AddArg("QuoteNo",QuoteNo);
+			
+			if (getUrl("/sale/data/ProductLibrary3/QuoteBillList",arg.GetString(),x)!=1)
+			{
+				trace(x.GetXmlDoc().text);
+				return -1;
+			}else	
+			{
+				dw_list.Retrieve(x);
+				dw_list.Redraw();
+			}
+			dw_list.SetSelectionMode(3);
+			dw_list.SetReadOnly(true);
+			return 1;
+		}
+			
+		int onload()
+		{
+			dw_list = GetControl("dw_list");
+			dw_list.openUrl("/sale/view/Quote3/template/Quote/QuoteBillList");
+		
+			
+			if(GetParam())
+			{
+				xaserverarg arg = GetParam();
+				QuoteNo=arg.GetArgString("QuoteNo");
+				OnRetrieve(arg.GetArgString("QuoteNo"));
+			}
+			OnRetrieve(QuoteNo);
+			SelectAll();
+			OnAttachEvent();	
+			return 1;
+		}
+		
+		int onloaded()
+		{
+			SetAgent();
+			
+			return 1;
+		}		
+	};
+]
\ No newline at end of file

--
Gitblit v1.9.3