|  |  | 
 |  |  | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" | 
 |  |  | #include "viewobject/view.base.hpp" | 
 |  |  |  | 
 |  |  | class __declspec(dllexport) GDN3list : public listwin | 
 |  |  | using xml = KXMLDOMDocument; | 
 |  |  | class __declspec(dllexport) ListGDN3Win : public listwin | 
 |  |  | { | 
 |  |  | public: | 
 |  |  |    GDN3list(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} | 
 |  |  |    ListGDN3Win(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} | 
 |  |  | public: | 
 |  |  |    static GDN3list* CreateInstance(void* implPtr, void* hWnd) | 
 |  |  |    static ListGDN3Win* CreateInstance(void* implPtr, void* hWnd) | 
 |  |  |    { | 
 |  |  |       GDN3list* pWin = new GDN3list(implPtr, (HWND)hWnd); | 
 |  |  |       ListGDN3Win* pWin = new ListGDN3Win(implPtr, (HWND)hWnd); | 
 |  |  |       return pWin; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |    int changeddlb; | 
 |  |  |    xcombobox ddlb_1; | 
 |  |  |    xcombobox cbx_datashow; | 
 |  |  |    xcombobox cbx_datashow;  | 
 |  |  |  | 
 |  |  |    xtreeview tv_folder; | 
 |  |  |    xdwgrid   dw_goods; | 
 |  |  | 
 |  |  |  | 
 |  |  |    //process tree | 
 |  |  | //查找当前树项的顶级目录 | 
 |  |  |    int LookupTopFolder(HTREEVIEW hItem) | 
 |  |  |    HTREEITEM LookupTopFolder(HTREEITEM hItem) | 
 |  |  |    { | 
 |  |  |       int hRoot = tv_folder.GetRootItem(); | 
 |  |  |       HTREEITEM hRoot = tv_folder.GetRootItem(); | 
 |  |  |       while (tv_folder.GetParentItem(hItem)) hItem = tv_folder.GetParentItem(hItem); | 
 |  |  |       return hItem; | 
 |  |  |    } | 
 |  |  | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int ExpandCatChildFolder(HTREEVIEW hItem, KXMLDOMElement ele, int image) | 
 |  |  |    int ExpandCatChildFolder(HTREEITEM hItem, KXMLDOMElement ele, int image) | 
 |  |  |    { | 
 |  |  |       KXMLDOMNodeList nlist = ele.SelectNodes(L"item"); | 
 |  |  |       int len = nlist.length; | 
 |  |  |       KXMLDOMNodeList nlist = ele.selectNodes(L"item"); | 
 |  |  |       int len = nlist.length(); | 
 |  |  |       if (len > 0) tv_folder.SetItemChild(hItem, 1); | 
 |  |  |       for (int i = 0; i < len; i++) | 
 |  |  |       { | 
 |  |  |          KXMLDOMElement e = nlist.item(i); | 
 |  |  |          xstring name = e.getAttribute(L"name"); | 
 |  |  |          int h = tv_folder.InsertChildItem(hItem, name, trust(e as int), image); | 
 |  |  |          string name = e.getAttribute(L"name"); | 
 |  |  |          HTREEITEM h = tv_folder.InsertChildItem(hItem, name, e, image); | 
 |  |  |          ExpandCatChildFolder(h, e, 35); | 
 |  |  |       } | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int ExpandFolderItem(HTREEVIEW hItem, xstring no) | 
 |  |  |    int ExpandFolderItem(HTREEITEM hItem, xstring no) | 
 |  |  |    { | 
 |  |  |       //xml x = ViewObject::RetrieveData(urlTree,L"no",no); | 
 |  |  |       xml x = xml::Make(); | 
 |  |  |       /*xml x = xml::Make(); | 
 |  |  |       xaserverarg arg = xaserverarg::Make(); | 
 |  |  |       arg.AddArg(L"no", no); | 
 |  |  |       xaserver::ExecXQuery(GetServerUrl(), L"[customerfolder.gdn.sql.xq]", arg.GetString(), x); | 
 |  |  |       */ | 
 |  |  |  | 
 |  |  |       KXMLDOMDocument x; | 
 |  |  |       xaserverarg arg; | 
 |  |  |       arg.AddArg(L"no", no); | 
 |  |  |       xaserver::ExecXQuery(GetServerUrl(), L"[customerfolder.gdn.sql.xq]", arg.GetString(), x); | 
 |  |  |       //KXMLDOMDocument x = ViewObject::RetrieveData(GetServerUrl(), L"[customerfolder.gdn.sql.xq]", L"id", no); | 
 |  |  |  | 
 |  |  |       if (!x) return 0; | 
 |  |  |  | 
 |  |  |       KXMLDOMNodeList nlist = x.GetXmlDoc().SelectNodes(L"/data/item"); | 
 |  |  |       int len = nlist.length; | 
 |  |  |       KXMLDOMNodeList nlist = x.selectNodes(L"/data/item"); | 
 |  |  |       int len = nlist.length(); | 
 |  |  |       for (int i = 0; i < len; i++) | 
 |  |  |       { | 
 |  |  |          KXMLDOMElement e = nlist.item(i); | 
 |  |  |          xstring name = e.getAttribute(L"name"); | 
 |  |  |          int h = tv_folder.InsertChildItem(hItem, name, trust(e as int), 35); | 
 |  |  |          string name = e.getAttribute(L"name"); | 
 |  |  |          HTREEITEM h = tv_folder.InsertChildItem(hItem, name, e, 35); | 
 |  |  |          ExpandCatChildFolder(h, e, 35); | 
 |  |  |       } | 
 |  |  |       x.Free(); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    //树展开 | 
 |  |  |    int OnTreeExpanding(ref TNotifyEvent evt, int p) | 
 |  |  |    int OnTreeExpanding(TEvent* evt, int p) | 
 |  |  |    { | 
 |  |  |       ref NMTREEVIEW nmtv = evt.pnmh; | 
 |  |  |       HTREEVIEW hItem = nmtv.itemNew.hItem; | 
 |  |  |       int hTopItem = LookupTopFolder(hItem); | 
 |  |  |       NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; | 
 |  |  |       HTREEITEM hItem = nmtv.itemNew.hItem; | 
 |  |  |       HTREEITEM hTopItem = LookupTopFolder(hItem); | 
 |  |  |       xstring name = tv_folder.GetItemLabel(hTopItem); | 
 |  |  |       int child = tv_folder.GetChildItem(hItem); | 
 |  |  |       HTREEITEM child = tv_folder.GetChildItem(hItem); | 
 |  |  |  | 
 |  |  |       KXMLDOMElement e = tv_folder.GetItemData(hItem); | 
 |  |  |       if (!child)ExpandFolderItem(hItem, e.getAttribute(L"no")); | 
 |  |  | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int  ExpandChildFolder(HTREEVIEW hItem, KXMLDOMElement pElement) | 
 |  |  |    int  ExpandChildFolder(HTREEITEM hItem, KXMLDOMElement pElement) | 
 |  |  |    { | 
 |  |  |       KXMLDOMNodeList nlist = pElement.SelectNodes(L"Item"); | 
 |  |  |       int len = nlist.length; | 
 |  |  |       KXMLDOMNodeList nlist = pElement.selectNodes(L"Item"); | 
 |  |  |       int len = nlist.length(); | 
 |  |  |       for (int i = 0; i < len; i++) | 
 |  |  |       { | 
 |  |  |          KXMLDOMElement e = nlist.item(i); | 
 |  |  |          xstring name = e.getAttribute(L"name"); | 
 |  |  |          string name = e.getAttribute(L"name"); | 
 |  |  |          xstring sImage = e.getAttribute(L"image"); | 
 |  |  |          xstring child = e.getAttribute(L"child"); | 
 |  |  |          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); | 
 |  |  |          if (sImage) image = sImage.toInt(); | 
 |  |  |          HTREEITEM h = tv_folder.InsertChildItem(hItem, name, e, image); | 
 |  |  |          if (child != L"no") tv_folder.SetItemChild(h, 1); | 
 |  |  |          ExpandChildFolder(h, e); | 
 |  |  |       } | 
 |  |  |       return 1; | 
 |  |  | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int OnTreeSelChanged(ref TNotifyEvent evt, int p) | 
 |  |  |    int OnTreeSelChanged(TEvent* evt, LPARAM p) | 
 |  |  |    { | 
 |  |  |       if (changeddlb) return 1; | 
 |  |  |       return OnPreRetrieve(); | 
 |  |  | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int ViewUpdate(int pr, xstring updateItem, xaserverarg  arg) | 
 |  |  |    int ViewUpdate(LPARAM pr, xstring updateItem, xaserverarg  arg) | 
 |  |  |    { | 
 |  |  |       if (updateItem == L"del") | 
 |  |  |       { | 
 |  |  |          int DelRow = this.dw_list.GetRow(); | 
 |  |  |          this.dw_list.DeleteRow(DelRow); | 
 |  |  |          int DelRow = dw_list.GetRow(); | 
 |  |  |          dw_list.DeleteRow(DelRow); | 
 |  |  |  | 
 |  |  |       } | 
 |  |  |       else if (updateItem == L"setstate") | 
 |  |  |       { | 
 |  |  |          int row = this.dw_list.GetRow(); | 
 |  |  |          int row = dw_list.GetRow(); | 
 |  |  |          if (row < 1) return 1; | 
 |  |  |          KXMLDOMElement ele = this.dw_list.GetRowElement(row); | 
 |  |  |          KXMLDOMElement ele = dw_list.GetRowElement(row); | 
 |  |  |          xstring id = GetEntityIDName(1); | 
 |  |  |          xstring entity = ele.selectSingleNode(id).text(); | 
 |  |  |          SetAgent(L"list", entity); | 
 |  |  |          if (arg.GetArgString(L"state") != L"") | 
 |  |  |             //this.dw_list.SetItemString(row, L"ApprovalStatus", arg.GetArgString(L"state")); | 
 |  |  |             //dw_list.SetItemString(row, L"ApprovalStatus", arg.GetArgString(L"state")); | 
 |  |  |             dw_list.SetItemString(row, L"ApplyStatus", arg.GetArgString(L"state")); | 
 |  |  |          if (arg.GetArgString(L"billstatus") != L"") | 
 |  |  |          { | 
 |  |  | 
 |  |  |             dw_list.SetItemDisplayString(row, L"ApprovalStatus", statusName); | 
 |  |  |          } | 
 |  |  |  | 
 |  |  |          this.dw_list.Redraw(); | 
 |  |  |          dw_list.Redraw(); | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       return 1; | 
 |  |  | 
 |  |  |    { | 
 |  |  |  | 
 |  |  |       if (readed) return 1; | 
 |  |  |       HTREEVIEW hItem = tv_folder.GetSelectedItem(); | 
 |  |  |       if (hItem <= 0) | 
 |  |  |       HTREEITEM hItem = tv_folder.GetSelectedItem(); | 
 |  |  |       if (!hItem) | 
 |  |  |       { | 
 |  |  |          hItem = tv_folder.GetRootItem(); | 
 |  |  |          if (hItem <= 0)  return 1; | 
 |  |  |          if (!hItem)  return 1; | 
 |  |  |       } | 
 |  |  |       int    hCursor = xutil::SetCursorWait(); | 
 |  |  |       KXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as KXMLDOMElement); | 
 |  |  |       HCURSOR hCursor = xutil::SetCursorWait(); | 
 |  |  |       KXMLDOMElement e1 = tv_folder.GetItemData(hItem); | 
 |  |  |       xstring no = e1.getAttribute(L"no"); | 
 |  |  |       //xml x = 0; | 
 |  |  |       //x = ViewObject::RetrieveData(myDataUrl,L"no",no,L"QueryTxt", m_QueryTxt,L"rows",rows); | 
 |  |  |       xstring DeptName = publiccode::GetUser().deptname; | 
 |  |  |       xaserverarg arg = xaserverarg::Make(); | 
 |  |  |       xaserverarg arg ; | 
 |  |  |       arg.AddArg(L"no", no); | 
 |  |  |       arg.AddArg(L"QueryTxt", m_QueryTxt); | 
 |  |  |       arg.AddArg(L"rows", rows); | 
 |  |  |  | 
 |  |  |       trace(no + L"***" + m_QueryTxt + L"***" + rows); | 
 |  |  |       /*if(DeptName==L"跟单部"){ | 
 |  |  |          dw_list.DwRetrieve(GetServerUrl(),L"[list.creator.gdn.sql.xq]",arg.GetString()); | 
 |  |  | 
 |  |  |          dw_list.DwRetrieve(GetServerUrl(),L"[list.folder.gdn.sql.xq]",arg.GetString()); | 
 |  |  |       }*/ | 
 |  |  |       dw_list.DwRetrieve(GetServerUrl(), L"[list.folder.gdn.sql.xq]", arg.GetString()); | 
 |  |  |       arg.Free(); | 
 |  |  |       dw_list.SetReadOnly(true); | 
 |  |  |       dw_list.SetRowSort(L"ETD", false); | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |    int OnPreRetrieve() | 
 |  |  |    { | 
 |  |  |       HTREEVIEW hItem = tv_folder.GetSelectedItem(); | 
 |  |  |       if (hItem <= 0) return 1; | 
 |  |  |       HTREEITEM hItem = tv_folder.GetSelectedItem(); | 
 |  |  |       if (!hItem) return 1; | 
 |  |  |  | 
 |  |  |       int hCursor = xutil::SetCursorWait(); | 
 |  |  |       KXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as KXMLDOMElement); | 
 |  |  |       HCURSOR hCursor = xutil::SetCursorWait(); | 
 |  |  |  | 
 |  |  |       KXMLDOMElement e1 = tv_folder.GetItemData(hItem); | 
 |  |  |       xstring no = e1.getAttribute(L"no"); | 
 |  |  |       xml x = 0; | 
 |  |  |  | 
 |  |  |       trace(L"\r\n" + no + L"\r\n" + m_QueryTxt); | 
 |  |  |       x = ViewObject::RetrieveData(myDataUrl, L"no", no, L"QueryTxt", m_QueryTxt, L"rows", rows); | 
 |  |  |       KXMLDOMDocument x = ViewObject::RetrieveData(myDataUrl, L"no", no, L"QueryTxt", m_QueryTxt, L"rows", rows); | 
 |  |  |       if (x) | 
 |  |  |       { | 
 |  |  |          dw_list.Retrieve(x); | 
 |  |  | 
 |  |  |       } | 
 |  |  |       else | 
 |  |  |       { | 
 |  |  |          dw_list.ResetEx(); | 
 |  |  |          dw_list.Reset(); | 
 |  |  |          dw_list.Redraw(); | 
 |  |  |       } | 
 |  |  |       dw_list.SetReadOnly(true); | 
 |  |  | 
 |  |  |       //dw_source.DwRetrieve(GetServerUrl(),L"[source.gdn.sql.xq]",L"EntityID",  EntityID ); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |       xml x = ViewObject::RetrieveData(L"/sale/data/GDN/source/maintex1", L"GDNID", EntityID); | 
 |  |  |       KXMLDOMDocument x = ViewObject::RetrieveData(L"/sale/data/GDN/source/maintex1", L"GDNID", EntityID); | 
 |  |  |       if (x) | 
 |  |  |          dw_source.Retrieve(x); | 
 |  |  |       else | 
 |  |  | 
 |  |  |       dw_source.Redraw(); | 
 |  |  |       dw_source.SetReadOnly(true); | 
 |  |  |  | 
 |  |  |       xml x1 = ViewObject::RetrieveData(L"/sale/data/Custom3/maint/custom/data", L"invno", InvoiceNo); | 
 |  |  |       KXMLDOMDocument x1 = ViewObject::RetrieveData(L"/sale/data/Custom3/maint/custom/data", L"invno", InvoiceNo); | 
 |  |  |       if (x1) | 
 |  |  |          dw_custom.Retrieve(x1); | 
 |  |  |       else | 
 |  |  | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int OnRowChanged(ref TNotifyEvent evt, int p) | 
 |  |  |    int OnRowChanged(TEvent* evt, LPARAM p) | 
 |  |  |    { | 
 |  |  |  | 
 |  |  |       //fixed one event only one process | 
 |  |  |       listwin::OnRowChanged(evt, p); | 
 |  |  |  | 
 |  |  |       ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR); | 
 |  |  |       DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; | 
 |  |  |       int row = hdr.row; | 
 |  |  |       int    hCursor = xutil::SetCursorWait(); | 
 |  |  |       HCURSOR    hCursor = xutil::SetCursorWait(); | 
 |  |  |       RetrieveDetail(row); | 
 |  |  |       xutil::RestoreCursor(hCursor); | 
 |  |  |  | 
 |  |  | 
 |  |  |       xml x = ViewObject::RetrieveData(L"/sale/data/Gdn/checksource",L"invno",InvoiceNo); | 
 |  |  |       if(!x) return 1; | 
 |  |  |  | 
 |  |  |       if(x.GetXmlDoc().selectSingleNode(L"error")) | 
 |  |  |       if(x.selectSingleNode(L"error")) | 
 |  |  |       { | 
 |  |  |          alert(x.GetXmlDoc().selectSingleNode(L"error").text); | 
 |  |  |          alert(x.selectSingleNode(L"error").text); | 
 |  |  |          return 0; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  | 
 |  |  |          xml supplier_x = ViewObject::RetrieveData(L"/sale/data/SupplierV3/entity/FindBySaleType",L"id", s); | 
 |  |  |          if(supplier_x) | 
 |  |  |          { | 
 |  |  |             if(supplier_x.GetXmlDoc().text != L"业务员") | 
 |  |  |             if(supplier_x.text != L"业务员") | 
 |  |  |                { | 
 |  |  |                alert(L"当前角色不是业务员不能新增单子,请重新选择角色"); | 
 |  |  |                return 0; | 
 |  |  | 
 |  |  |  | 
 |  |  |    int OnSearch() | 
 |  |  |    { | 
 |  |  |       xaserverarg arg = new xaserverarg; | 
 |  |  |       arg.setNativePointer(arg.CreateInstance()); | 
 |  |  |       xaserverarg& arg = *new xaserverarg; | 
 |  |  |  | 
 |  |  |       arg.AddArg(L"text", searchStr); | 
 |  |  |       OpenWindow(L"dev:xpage[search.dialog.vx]", cast(arg as int)); | 
 |  |  |       OpenWindow(L"dev:xpage[search.dialog.vx]", (LPARAM)&arg); | 
 |  |  |       xstring str = arg.GetArgString(L"text"); | 
 |  |  |       if (str != searchStr) | 
 |  |  |       { | 
 |  |  | 
 |  |  |       if (comdid == L"action:bill.refresh") | 
 |  |  |       { | 
 |  |  |          changeddlb = 1; | 
 |  |  |          int RItem = tv_folder.GetRootItem(); | 
 |  |  |          HTREEITEM RItem = tv_folder.GetRootItem(); | 
 |  |  |          while (tv_folder.GetChildItem(RItem)) | 
 |  |  |             tv_folder.DeleteItem(tv_folder.GetChildItem(RItem)); | 
 |  |  |          ExpandFolderItem(RItem, L"Category:Customer"); | 
 |  |  | 
 |  |  |       else if (comdid.find(L"bill.print") > 0) | 
 |  |  |       { | 
 |  |  |          xstring EntityIDS = dw_list.GetGuid(dw_list.GetRow()); | 
 |  |  |          xml xs = ViewObject::RetrieveData(L"/sale/data/GDN/GetGDNJudge", L"GDNID", EntityIDS); | 
 |  |  |          xstring Results1 = xs.GetXmlDoc().text(); | 
 |  |  |          KXMLDOMDocument xs = ViewObject::RetrieveData(L"/sale/data/GDN/GetGDNJudge", L"GDNID", EntityIDS); | 
 |  |  |          xstring Results1 = xs.text(); | 
 |  |  |          if (Results1 != L"") | 
 |  |  |          { | 
 |  |  |             alert(Results1); | 
 |  |  | 
 |  |  |          if (publiccode::GetUser().name != L"admin") | 
 |  |  |          { | 
 |  |  |             xstring s = publiccode::GetUser().id; | 
 |  |  |             xml supplier_x = ViewObject::RetrieveData(L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); | 
 |  |  |             KXMLDOMDocument supplier_x = ViewObject::RetrieveData(L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); | 
 |  |  |             if (supplier_x) | 
 |  |  |             { | 
 |  |  |                if (supplier_x.GetXmlDoc().text != L"跟单") | 
 |  |  |                if ((xstring)supplier_x.text() != L"跟单") | 
 |  |  |                { | 
 |  |  |                   alert(L"当前角色不是跟单员不能新增单子,请重新选择角色"); | 
 |  |  |                   return 0; | 
 |  |  | 
 |  |  |       else if (comdid == L"action:bill.GDNDelay") | 
 |  |  |       { | 
 |  |  |          xstring EntityIDEx = dw_list.GetGuid(dw_list.GetRow()); | 
 |  |  |          xaserverarg argEx = new xaserverarg; | 
 |  |  |          argEx.setNativePointer(argEx.CreateInstance()); | 
 |  |  |          trace(EntityIDEx); | 
 |  |  |          xaserverarg argEx; | 
 |  |  | 			 | 
 |  |  |          //alert(EntityIDEx); | 
 |  |  |          argEx.AddArg(L"GDNID", EntityIDEx); | 
 |  |  |          OpenWindow(L"dev:xpage[GDNDelay.vx]", cast(argEx as int)); | 
 |  |  |          OpenWindow(L"dev:xpage[GDNDelay.vx]", argEx); | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |       else if (comdid == L"action:bill.check.ask") | 
 |  |  | 
 |  |  |          } | 
 |  |  |  | 
 |  |  |          xstring EntityID = dw_list.GetGuid(dw_list.GetRow()); | 
 |  |  |          xml xx = ViewObject::RetrieveData(L"/sale/data/GDN/GetGDNJudge", L"GDNID", EntityID); | 
 |  |  |          xstring Results = xx.GetXmlDoc().text(); | 
 |  |  |          KXMLDOMDocument xx = ViewObject::RetrieveData(L"/sale/data/GDN/GetGDNJudge", L"GDNID", EntityID); | 
 |  |  |          xstring Results = xx.text(); | 
 |  |  |          if (Results != L"") | 
 |  |  |          { | 
 |  |  |             alert(Results); | 
 |  |  |             return 0; | 
 |  |  |          } | 
 |  |  |  | 
 |  |  |          xml xx2 = ViewObject::RetrieveData(L"/sale/data/GDN/GetGDNJudgeEx", L"GDNID", EntityID); | 
 |  |  |          xstring Results2 = xx2.GetXmlDoc().text(); | 
 |  |  |          KXMLDOMDocument xx2 = ViewObject::RetrieveData(L"/sale/data/GDN/GetGDNJudgeEx", L"GDNID", EntityID); | 
 |  |  |          xstring Results2 = xx2.text(); | 
 |  |  |          if (Results2 != L"") | 
 |  |  |          { | 
 |  |  |             alert(Results2); | 
 |  |  |             return 0; | 
 |  |  |          } | 
 |  |  |  | 
 |  |  |          xml xx3 = ViewObject::RetrieveData(L"/sale/data/GDN/GetGDNJudgeExS", L"GDNID", EntityID); | 
 |  |  |          xstring Results3 = xx3.GetXmlDoc().text(); | 
 |  |  |          KXMLDOMDocument xx3 = ViewObject::RetrieveData(L"/sale/data/GDN/GetGDNJudgeExS", L"GDNID", EntityID); | 
 |  |  |          xstring Results3 = xx3.text(); | 
 |  |  |          if (Results3 != L"") | 
 |  |  |          { | 
 |  |  |             alert(Results3); | 
 |  |  |             return 0; | 
 |  |  |          } | 
 |  |  |  | 
 |  |  |          xml xx4 = ViewObject::RetrieveData(L"/sale/data/GDN/GetGDNJudgeAmount", L"GDNID", EntityID); | 
 |  |  |          xstring Results4 = xx4.GetXmlDoc().text(); | 
 |  |  |          KXMLDOMDocument xx4 = ViewObject::RetrieveData(L"/sale/data/GDN/GetGDNJudgeAmount", L"GDNID", EntityID); | 
 |  |  |          xstring Results4 = xx4.text(); | 
 |  |  |          if (Results4 != L"") | 
 |  |  |          { | 
 |  |  |             alert(Results4); | 
 |  |  | 
 |  |  |          } | 
 |  |  |  | 
 |  |  |          /*xml xx5= ViewObject::RetrieveData(L"/sale/data/GDN/GetGDNCost",L"GDNID",EntityID); | 
 |  |  |          xstring Results5=xx5.GetXmlDoc().text(); | 
 |  |  |          xstring Results5=xx5.text(); | 
 |  |  |          if(Results5 !=L"") | 
 |  |  |          { | 
 |  |  |             alert(Results5); | 
 |  |  |             return 0; | 
 |  |  |          }*/ | 
 |  |  |  | 
 |  |  |          xaserverarg arg = new xaserverarg; | 
 |  |  |          arg.setNativePointer(arg.CreateInstance()); | 
 |  |  |          xaserverarg arg ; | 
 |  |  | 			 | 
 |  |  |          trace(EntityID); | 
 |  |  |          arg.AddArg(L"GDNID", EntityID); | 
 |  |  |          OpenWindow(L"dev:xpage[GDNDelay.vx]", cast(arg as int)); | 
 |  |  |          OpenWindow(L"dev:xpage[GDNDelay.vx]", arg); | 
 |  |  |  | 
 |  |  |       } | 
 |  |  |       else if (comdid == L"action:bill.SourceRemark") return OnSourceRemark(); | 
 |  |  | 
 |  |  |    int OnSourceRemark() | 
 |  |  |    { | 
 |  |  |       xstring name = L"出运明细单"; | 
 |  |  |       xml x = ViewObject::RetrieveData(L"/sale/data/TradeFinance3/GetSetUpRemarks", L"Type", name); | 
 |  |  |       KXMLDOMNodeList items = x.GetXmlDoc().selectNodes(L"data/Item"); | 
 |  |  |       KXMLDOMDocument x = ViewObject::RetrieveData(L"/sale/data/TradeFinance3/GetSetUpRemarks", L"Type", name); | 
 |  |  |       KXMLDOMNodeList items = x.selectNodes(L"data/Item"); | 
 |  |  |       KXMLDOMNode t = items.item(0); | 
 |  |  |       xstring Content = L""; | 
 |  |  |       if (t.selectSingleNode(L"Content")) | 
 |  |  |       { | 
 |  |  |          Content = t.selectSingleNode(L"Content").text(); | 
 |  |  |       } | 
 |  |  |       xaserverarg arg1 = new xaserverarg; | 
 |  |  |       arg1.setNativePointer(arg1.CreateInstance()); | 
 |  |  |       xaserverarg arg1 ; | 
 |  |  | 		 | 
 |  |  |       arg1.AddArg(L"value", Content); | 
 |  |  |       OpenWindow(L"dev:xpage[memo.edit.new.vx]", arg1.getNativePointer()); | 
 |  |  |       OpenWindow(L"dev:xpage[memo.edit.new.vx]",arg1); | 
 |  |  |  | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  | 
 |  |  |    { | 
 |  |  |       int row = dw_list.GetRow(); | 
 |  |  |       xstring GDNID = dw_list.GetGuid(row); | 
 |  |  |       xml x = ViewObject::RetrieveData(L"/sale/data/GDN/CheckCDLine", L"GDNID", GDNID); | 
 |  |  |       xstring  r = x.GetXmlDoc().text(); | 
 |  |  |       KXMLDOMDocument x = ViewObject::RetrieveData(L"/sale/data/GDN/CheckCDLine", L"GDNID", GDNID); | 
 |  |  |       xstring  r = x.text(); | 
 |  |  |       int r1 = r.toInt(); | 
 |  |  |       if (x) | 
 |  |  |       { | 
 |  |  | 
 |  |  |    { | 
 |  |  |       int row = dw_list.GetRow(); | 
 |  |  |       xstring GDNID = dw_list.GetGuid(row); | 
 |  |  |       xml x = ViewObject::RetrieveData(L"/sale/data/GDN/CheckGW", L"GDNID", GDNID); | 
 |  |  |       xstring  r = x.GetXmlDoc().text(); | 
 |  |  |       KXMLDOMDocument x = ViewObject::RetrieveData(L"/sale/data/GDN/CheckGW", L"GDNID", GDNID); | 
 |  |  |       xstring  r = x.text(); | 
 |  |  |       int r1 = r.toInt(); | 
 |  |  |       if (x) | 
 |  |  |       { | 
 |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |    //xcombobox下拉 | 
 |  |  |    int OnSelectDdlb(ref TNotifyEvent evt, int p) | 
 |  |  |    int OnSelectDdlb(TEvent* evt, LPARAM p) | 
 |  |  |    { | 
 |  |  |       changeddlb = 1; | 
 |  |  |       int wid = ddlb_1.GetId(); | 
 |  |  |       int CB_GETCURSEL = 0x0147; | 
 |  |  |       int nIndex = win32::SendMessage(wid, CB_GETCURSEL, 0, 0); | 
 |  |  |       int nIndex = SendMessageW(HWND(), CB_GETCURSEL, 0, 0); | 
 |  |  |       KXMLDOMElement e = ddlb_1.GetElement(); | 
 |  |  |       KXMLDOMElement e2 = e.selectSingleNode(L"item[" + (nIndex + 1).toString() + L"]"); | 
 |  |  |       KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring(nIndex + 1) + L"]"); | 
 |  |  |       xstring no = e2.selectSingleNode(L"@element").text(); | 
 |  |  |  | 
 |  |  |       HTREEVIEW hItem = tv_folder.GetRootItem(); | 
 |  |  |       HTREEITEM hItem = tv_folder.GetRootItem(); | 
 |  |  |       while (tv_folder.GetChildItem(hItem)) | 
 |  |  |          tv_folder.DeleteItem(tv_folder.GetChildItem(hItem)); | 
 |  |  |  | 
 |  |  | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int OnSelectDataShowDdlb(ref TNotifyEvent evt, int p) | 
 |  |  |    int OnSelectDataShowDdlb(TEvent* evt, LPARAM p) | 
 |  |  |    { | 
 |  |  |       int wid = cbx_datashow.GetId(); | 
 |  |  |       HWND wid = cbx_datashow.GetHWND(); | 
 |  |  |       int CB_GETCURSEL = 0x0147; | 
 |  |  |       int nIndex = win32::SendMessage(wid, CB_GETCURSEL, 0, 0); | 
 |  |  |       int nIndex = SendMessageW(wid, CB_GETCURSEL, 0, 0); | 
 |  |  |       KXMLDOMElement e = cbx_datashow.GetElement(); | 
 |  |  |       KXMLDOMElement e2 = e.selectSingleNode(L"item[" + (nIndex + 1).toString() + L"]"); | 
 |  |  |       KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring(nIndex + 1) + L"]"); | 
 |  |  |       rows = e2.selectSingleNode(L"@rows").text(); | 
 |  |  |       OnPreRetrieve(); | 
 |  |  |  | 
 |  |  | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |    int AttachEvent() | 
 |  |  |  | 
 |  |  |    int PostOnAttachEvent() | 
 |  |  |    { | 
 |  |  |       AttachEvent(L"tv_folder", L"TVN_SELCHANGED", OnTreeSelChanged); //树选择 | 
 |  |  |       //AttachEvent(L"tv_folder", L"TVN_ITEMEXPANDING",OnTreeExpanding); //树展开 | 
 |  |  |       AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", OnRowChanged); | 
 |  |  |       AttachEvent(L"cbx_1", L"CBN_SELCHANGE", OnSelectDdlb); | 
 |  |  |       AttachEvent(L"cbx_datashow", L"CBN_SELCHANGE", OnSelectDataShowDdlb); | 
 |  |  |       AttachEvent(L"tv_folder", L"TVN_SELCHANGED", (FEvent)&ListGDN3Win::OnTreeSelChanged); //树选择 | 
 |  |  |       //AttachEvent(L"tv_folder", L"TVN_ITEMEXPANDING",(FEvent)&ListGDN3Win::OnTreeExpanding); //树展开 | 
 |  |  |       AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&ListGDN3Win::OnRowChanged); | 
 |  |  |       AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&ListGDN3Win::OnSelectDdlb); | 
 |  |  |       AttachEvent(L"cbx_datashow", L"CBN_SELCHANGE", (FEvent)&ListGDN3Win::OnSelectDataShowDdlb); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    virtual xstring GetTemplateUrl() | 
 |  |  |    { | 
 |  |  |       return "/sale/view/GDN/template/GDN/ListEx"; | 
 |  |  |       return L"/sale/view/GDN/template/GDN/ListEx"; | 
 |  |  |    } | 
 |  |  |    int onload() | 
 |  |  |    { | 
 |  |  | 
 |  |  |       dw_custom.SetColumnState(L"ClassifyID", false); | 
 |  |  |       dw_custom.SetColumnState(L"AmountEx", false); | 
 |  |  |       //dw_custom.SetReadOnlyColumn(L"CustName",true); | 
 |  |  |       dw_custom.SetColumnState(L"LineNo", false); | 
 |  |  |       //dw_custom.SetColumnState(L"LineNo", false); | 
 |  |  |  | 
 |  |  |       rows = L"500"; | 
 |  |  |       myDataUrl = L"/sale/data/GDN3/folder/list"; | 
 |  |  | 
 |  |  |    int onloaded() | 
 |  |  |    { | 
 |  |  |  | 
 |  |  |       HTREEVIEW hItem = tv_folder.GetRootItem(); | 
 |  |  |       HTREEITEM hItem = tv_folder.GetRootItem(); | 
 |  |  |       ExpandFolderItem(hItem, L"Category:Customer"); | 
 |  |  |       tv_folder.ExpandItem(hItem); | 
 |  |  |       tv_folder.ItemFocus(hItem); | 
 |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |       //attach my control event | 
 |  |  |       AttachEvent(); | 
 |  |  |       PostOnAttachEvent(); | 
 |  |  |  | 
 |  |  |       readed = false; | 
 |  |  |  | 
 |  |  | 
 |  |  |          arg.AddArg(L"ReadOnly", L"false"); | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       HTREEVIEW hItem = tv_folder.GetCaretItem(); | 
 |  |  |       if (hItem <= 0) return 1; | 
 |  |  |       HTREEITEM hItem = tv_folder.GetCaretItem(); | 
 |  |  |       if (!hItem) return 1; | 
 |  |  |       KXMLDOMElement e = tv_folder.GetItemData(hItem); | 
 |  |  |       xstring  no = e.getAttribute(L"no"); | 
 |  |  |       if (no.find(L"Customer:") >= 0) | 
 |  |  |       { | 
 |  |  |          arg.AddArg(L"CustomerID", e.getAttribute(L"id")); | 
 |  |  |          xstring name = e.getAttribute(L"name"); | 
 |  |  |          if (name.find(L"(L") >= 0) name = name.left(name.find(L"(L")); | 
 |  |  |          if (name.find(L"(") >= 0) name = name.left(name.find(L"(")); | 
 |  |  |          arg.AddArg(L"CustomerName", name); | 
 |  |  |       } | 
 |  |  |       return 1; |