use "xcontrol.vframe.vbusiness.vd" use "xbase.vframe.vbusiness.vd" use "base.view.vd" unit trade [ class EnquiryExQuoteWin : public frame { xdwgrid dw_list; xnode m_agentNode; //Agent Condition int SetAgent() { string xfNodeAgentArea = "agentarea"; xnode anode = GetAgentNode(xfNodeAgentArea); if (m_agentNode) { SetAgentNodeContent(anode, m_agentNode); } else { msxml::IXMLDOMElement xframeElement = GetElement(); msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); if (agent) { string s = agent.xml; m_agentNode = SetAgentNodeContent(anode, s); } } return 1; } int OnSearch() { xml x = new xml; string EnquiryNo; x.setNativePointer(xml::CreateInstance()); xaserverarg arg = GetParam(); xcontrol QuoteNo = GetControl("QuoteNo"); EnquiryNo = QuoteNo.GetText(); //alert(EnquiryNo); //string PartyID = arg.GetArgString("PartyID"); //x = ViewObject::RetrieveData("/sale/data/Customerv3/entity/XmShare"); x = ViewObject::RetrieveData("/sale/data/Quote3/maint", "id", EnquiryNo); if (x)dw_list.Retrieve(x); dw_list.SetReadOnly(true); dw_list.Redraw(); return 1; } //½¹µã¼¤»î´¦Àíº¯Êý int OnSetFocus(ref TEvent evt, int param) { //ÖØÖù¤¾ßÌõ SetAgent(); return 1; } int OnSaveAs() { int i = dw_list.SaveAs(""); if (i == 1) alert("µ¼³ö³É¹¦"); return 1; } int OnMatch() { xaserverarg arg = new xaserverarg; arg.setNativePointer(arg.CreateInstance()); int row = dw_list.GetNextSelectRow(1); string items = ""; while (row > 0 && row <= dw_list.GetRowCount()) { msxml::IXMLDOMElement e = dw_list.GetRowElement(row); string id = e.selectSingleNode("@guid").text; if (items == "") items = id; else items += "," + id; row = dw_list.GetNextSelectRow(row + 1); } xml x = ViewObject::RetrieveData("/sale/data/Enquiry/Update/UpdateQuoteLine", "ItemList", items); OnSearch(); return 1; } int OnPriceListSupplierEx() { xaserverarg arg = new xaserverarg; arg.setNativePointer(arg.CreateInstance()); arg.AddArg("sheetname", "tab_list2"); arg.AddArg("EntityName", "Enquiry3"); arg.AddArg("EntityID", ""); arg.AddArg("EntityNo", ""); arg.AddArg("Source", "quote"); arg.AddArg("QuoteNo", GetControl("QuoteNo").GetText()); int row = dw_list.GetNextSelectRow(1); string items = ""; //while(row > 0 && row <= dw_list.GetRowCount()) for (row = 1; row <= dw_list.GetRowCount(); row++) { msxml::IXMLDOMElement e = dw_list.GetRowElement(row); string id = e.selectSingleNode("@guid").text; if (items == "") items = id; else items += "," + id; //row = dw_list.GetNextSelectRow(row + 1); } arg.AddArg("EntityIDList", items); int p = arg.ptr_native_; OpenWindow("dev:xpage[Enquiry.maint.vx]", p); return 1; } //ÃüÁî·¢²¼º¯Êý int OnCmdDispatch(string comdid) { if (comdid == "xmClose") { CloseWindow(); return 1; } if (comdid == "xmSearch") { OnSearch(); return 1; } if (comdid == "xmMatch") { OnMatch(); return 1; } if (comdid == "xmMaint") { //win32::HideWindow(1); OnPriceListSupplierEx(); CloseWindow(); return 1; } if (comdid == "xmSave") { return 1; } if (comdid == "xmSaveAs") { return OnSaveAs(); } 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/item/pricelist"); dw_list.SetColumnState("ItemID", false); dw_list.SetColumnState("Picture", false); dw_list.SetColumnState("category", false); dw_list.SetColumnState("RealEnquiryLineID", false); dw_list.SetColumnState("RelEnquiryLineID", false); dw_list.SetSelectionMode(3); if (GetParam()) { string no = GetParam(); GetControl("QuoteNo").SetText(no); OnSearch(); } OnAttachEvent(); return 1; } int onloaded() { SetAgent(); return 1; } }; ]