¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | class __declspec(dllexport) GDN3list : public listwin |
| | | { |
| | | public: |
| | | GDN3list(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static GDN3list* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | GDN3list* pWin = new GDN3list(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | |
| | | public: |
| | | xstring m_sType; //æ éä¸çç±»å |
| | | xstring m_sTypeTxt; //æ éä¸çæ°æ® |
| | | xstring urlTree; |
| | | xstring myDataUrl; |
| | | xstring searchStr; |
| | | xstring rows; |
| | | bool readed; |
| | | |
| | | int changeddlb; |
| | | xcombobox ddlb_1; |
| | | xcombobox cbx_datashow; |
| | | |
| | | xtreeview tv_folder; |
| | | xdwgrid dw_goods; |
| | | xdwgrid dw_source; |
| | | xdwtable dw_profit; |
| | | xdwgrid dw_custom; |
| | | |
| | | //process tree |
| | | //æ¥æ¾å½åæ 项ç顶级ç®å½ |
| | | int LookupTopFolder(HTREEVIEW hItem) |
| | | { |
| | | int hRoot = tv_folder.GetRootItem(); |
| | | while (tv_folder.GetParentItem(hItem)) hItem = tv_folder.GetParentItem(hItem); |
| | | return hItem; |
| | | } |
| | | |
| | | |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(TEvent* evt, int param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | int row = dw_list.GetRow(); |
| | | if (row < 1) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = GetEntityIDName(1); |
| | | trace(L"\rn---" + id); |
| | | xstring entity = ele.selectSingleNode(id).text(); |
| | | //trace(entity); |
| | | SetAgent(L"list", entity); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int ExpandCatChildFolder(HTREEVIEW hItem, KXMLDOMElement ele, int image) |
| | | { |
| | | 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); |
| | | ExpandCatChildFolder(h, e, 35); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int ExpandFolderItem(HTREEVIEW hItem, xstring no) |
| | | { |
| | | //xml x = ViewObject::RetrieveData(urlTree,L"no",no); |
| | | xml x = xml::Make(); |
| | | xaserverarg arg = xaserverarg::Make(); |
| | | arg.AddArg(L"no", no); |
| | | xaserver::ExecXQuery(GetServerUrl(), L"[customerfolder.gdn.sql.xq]", arg.GetString(), x); |
| | | |
| | | if (!x) return 0; |
| | | |
| | | KXMLDOMNodeList nlist = x.GetXmlDoc().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); |
| | | ExpandCatChildFolder(h, e, 35); |
| | | } |
| | | x.Free(); |
| | | return 1; |
| | | } |
| | | |
| | | //æ å±å¼ |
| | | int OnTreeExpanding(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | HTREEVIEW hItem = nmtv.itemNew.hItem; |
| | | int hTopItem = LookupTopFolder(hItem); |
| | | xstring name = tv_folder.GetItemLabel(hTopItem); |
| | | int 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) |
| | | { |
| | | 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"); |
| | | xstring sImage = e.getAttribute(L"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() |
| | | { |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement e = xframeElement.selectSingleNode(L"//xtree[@name='tv_folder']/initial"); |
| | | if (e)ExpandChildFolder(0, e); |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TNotifyEvent evt, int p) |
| | | { |
| | | if (changeddlb) return 1; |
| | | return OnPreRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int ViewUpdate(int pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"del") |
| | | { |
| | | int DelRow = this.dw_list.GetRow(); |
| | | this.dw_list.DeleteRow(DelRow); |
| | | |
| | | } |
| | | else if (updateItem == L"setstate") |
| | | { |
| | | int row = this.dw_list.GetRow(); |
| | | if (row < 1) return 1; |
| | | KXMLDOMElement ele = this.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"ApplyStatus", arg.GetArgString(L"state")); |
| | | if (arg.GetArgString(L"billstatus") != L"") |
| | | { |
| | | xstring billstatus = arg.GetArgString(L"billstatus"); |
| | | xstring statusName = GetBillStatusName(billstatus); |
| | | dw_list.SetItemString(row, L"ApprovalStatus", billstatus); |
| | | dw_list.SetItemDisplayString(row, L"ApprovalStatus", statusName); |
| | | } |
| | | |
| | | this.dw_list.Redraw(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | bool IsEmptyQueryStr(xstring queryStr) |
| | | { |
| | | if (queryStr == L"") return true; |
| | | if (queryStr == L"<items join='and'/>") return true; |
| | | if (queryStr == L"<items join=\"and\"/>") return true; |
| | | return false; |
| | | } |
| | | |
| | | //æ£ç´¢ |
| | | int OnPreRetrieveEx() |
| | | { |
| | | |
| | | if (readed) return 1; |
| | | HTREEVIEW hItem = tv_folder.GetSelectedItem(); |
| | | if (hItem <= 0) |
| | | { |
| | | hItem = tv_folder.GetRootItem(); |
| | | if (hItem <= 0) return 1; |
| | | } |
| | | int hCursor = xutil::SetCursorWait(); |
| | | KXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as KXMLDOMElement); |
| | | 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(); |
| | | 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()); |
| | | }else{ |
| | | 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); |
| | | |
| | | if (dw_list.GetRowCount() >= 1) RetrieveDetail(1); |
| | | |
| | | xutil::RestoreCursor(hCursor); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnPreRetrieve() |
| | | { |
| | | HTREEVIEW hItem = tv_folder.GetSelectedItem(); |
| | | if (hItem <= 0) return 1; |
| | | |
| | | int hCursor = xutil::SetCursorWait(); |
| | | KXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as KXMLDOMElement); |
| | | 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); |
| | | if (x) |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | dw_list.ResetEx(); |
| | | dw_list.Redraw(); |
| | | } |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.SetRowSort(L"ETD", false); |
| | | |
| | | if (dw_list.GetRowCount() >= 1) RetrieveDetail(1); |
| | | |
| | | xutil::RestoreCursor(hCursor); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int RetrieveDetail(int row) |
| | | { |
| | | xstring EntityID = dw_list.GetGuid(row); |
| | | xstring InvoiceNo = dw_list.GetItemString(row, L"InvoiceNo"); |
| | | dw_goods.DwRetrieve(GetServerUrl(), L"[gdnline.gdn.sql.xq]", L"EntityID", EntityID); |
| | | dw_goods.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); |
| | | if (x) |
| | | dw_source.Retrieve(x); |
| | | else |
| | | dw_source.Reset(); |
| | | dw_source.Redraw(); |
| | | dw_source.SetReadOnly(true); |
| | | |
| | | xml x1 = ViewObject::RetrieveData(L"/sale/data/Custom3/maint/custom/data", L"invno", InvoiceNo); |
| | | if (x1) |
| | | dw_custom.Retrieve(x1); |
| | | else |
| | | dw_custom.Reset(); |
| | | dw_custom.Redraw(); |
| | | dw_custom.SetReadOnly(true); |
| | | |
| | | dw_profit.DwRetrieve(GetServerUrl(), L"[profit.dgn.sql.xq]", L"EntityID", EntityID); |
| | | dw_profit.SetReadOnly(true); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChanged(ref TNotifyEvent evt, int p) |
| | | { |
| | | |
| | | //fixed one event only one process |
| | | listwin::OnRowChanged(evt, p); |
| | | |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | int row = hdr.row; |
| | | int hCursor = xutil::SetCursorWait(); |
| | | RetrieveDetail(row); |
| | | xutil::RestoreCursor(hCursor); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | /* |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | //è¿å0ââä¸å¨æ§è¡ä»¥ä¸ä»£ç ï¼è¿åå
¶ä»ââæ§è¡ä»¥ä¸ä»£ç ã |
| | | if(comdid==L"action:bill.merge") |
| | | { |
| | | OpenWindow(L"dev:xpage[Merge.GDN.vx]"); |
| | | return 0; |
| | | } |
| | | else if(comdid==L"action:bill.check.ask") |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | xstring ApprovalStatus = dw_list.GetItemString(row,L"ApprovalStatus"); |
| | | if(ApprovalStatus == L"9"){ |
| | | alert(L"å并票ä¸å
许æäº¤å®¡æ¹!"); |
| | | return 0; |
| | | } |
| | | xstring InvoiceNo = dw_list.GetItemString(row,L"InvoiceNo"); |
| | | xml x = ViewObject::RetrieveData(L"/sale/data/Gdn/checksource",L"invno",InvoiceNo); |
| | | if(!x) return 1; |
| | | |
| | | if(x.GetXmlDoc().selectSingleNode(L"error")) |
| | | { |
| | | alert(x.GetXmlDoc().selectSingleNode(L"error").text); |
| | | return 0; |
| | | } |
| | | |
| | | } |
| | | else if(comdid==L"action:bill.new") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | |
| | | xml supplier_x = ViewObject::RetrieveData(L"/sale/data/SupplierV3/entity/FindBySaleType",L"id", s); |
| | | if(supplier_x) |
| | | { |
| | | if(supplier_x.GetXmlDoc().text != L"ä¸å¡å") |
| | | { |
| | | alert(L"å½åè§è²ä¸æ¯ä¸å¡åä¸è½æ°å¢ååï¼è¯·éæ°éæ©è§è²"); |
| | | return 0; |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | */ |
| | | |
| | | int OnSearch() |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"text", searchStr); |
| | | OpenWindow(L"dev:xpage[search.dialog.vx]", cast(arg as int)); |
| | | xstring str = arg.GetArgString(L"text"); |
| | | if (str != searchStr) |
| | | { |
| | | searchStr = str; |
| | | dw_list.Filter(L"*", searchStr); |
| | | return 1; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"action:bill.refresh") |
| | | { |
| | | changeddlb = 1; |
| | | int RItem = tv_folder.GetRootItem(); |
| | | while (tv_folder.GetChildItem(RItem)) |
| | | tv_folder.DeleteItem(tv_folder.GetChildItem(RItem)); |
| | | ExpandFolderItem(RItem, L"Category:Customer"); |
| | | tv_folder.ExpandItem(RItem); |
| | | tv_folder.ItemFocus(RItem); |
| | | changeddlb = 0; |
| | | return OnPreRetrieve(); |
| | | } |
| | | else if (comdid == L"action:bill.merge") |
| | | { |
| | | OpenWindow(L"dev:xpage[Merge.GDN.vx]"); |
| | | return 0; |
| | | } |
| | | else if (comdid == L"xmSaveAs") |
| | | return dw_list.SaveAs(L""); |
| | | else if (comdid == L"xmSearch") |
| | | return OnSearch(); |
| | | 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(); |
| | | if (Results1 != L"") |
| | | { |
| | | alert(Results1); |
| | | return 0; |
| | | } |
| | | |
| | | OnPrintOne(); |
| | | OnPrint(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"action:bill.new") |
| | | { |
| | | 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); |
| | | if (supplier_x) |
| | | { |
| | | if (supplier_x.GetXmlDoc().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); |
| | | argEx.AddArg(L"GDNID", EntityIDEx); |
| | | OpenWindow(L"dev:xpage[GDNDelay.vx]", cast(argEx as int)); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"action:bill.check.ask") |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | xstring ApprovalStatus = dw_list.GetItemString(row, L"ApprovalStatus"); |
| | | if (ApprovalStatus == L"9") { |
| | | alert(L"å并票ä¸å
许æäº¤å®¡æ¹!"); |
| | | return 0; |
| | | } |
| | | |
| | | 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(); |
| | | if (Results != L"") |
| | | { |
| | | alert(Results); |
| | | return 0; |
| | | } |
| | | |
| | | xml xx2 = ViewObject::RetrieveData(L"/sale/data/GDN/GetGDNJudgeEx", L"GDNID", EntityID); |
| | | xstring Results2 = xx2.GetXmlDoc().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(); |
| | | if (Results3 != L"") |
| | | { |
| | | alert(Results3); |
| | | return 0; |
| | | } |
| | | |
| | | xml xx4 = ViewObject::RetrieveData(L"/sale/data/GDN/GetGDNJudgeAmount", L"GDNID", EntityID); |
| | | xstring Results4 = xx4.GetXmlDoc().text(); |
| | | if (Results4 != L"") |
| | | { |
| | | alert(Results4); |
| | | return 0; |
| | | } |
| | | |
| | | /*xml xx5= ViewObject::RetrieveData(L"/sale/data/GDN/GetGDNCost",L"GDNID",EntityID); |
| | | xstring Results5=xx5.GetXmlDoc().text(); |
| | | if(Results5 !=L"") |
| | | { |
| | | alert(Results5); |
| | | return 0; |
| | | }*/ |
| | | |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | trace(EntityID); |
| | | arg.AddArg(L"GDNID", EntityID); |
| | | OpenWindow(L"dev:xpage[GDNDelay.vx]", cast(arg as int)); |
| | | |
| | | } |
| | | else if (comdid == L"action:bill.SourceRemark") return OnSourceRemark(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | 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"); |
| | | 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()); |
| | | arg1.AddArg(L"value", Content); |
| | | OpenWindow(L"dev:xpage[memo.edit.new.vx]", arg1.getNativePointer()); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnPrint() |
| | | { |
| | | 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(); |
| | | int r1 = r.toInt(); |
| | | if (x) |
| | | { |
| | | if (r1 > 0) |
| | | { |
| | | alert(L"æ¥å
³æ°é忥å
³éé¢ä¸åºè¿æ°éåéé¢ä¸ä¸è´\r\né¨åæ¥å
³æ°éåéé¢éè¦æ ¸å¯¹ï¼"); |
| | | } |
| | | } |
| | | //alert(GDNID); |
| | | return 1; |
| | | } |
| | | |
| | | int OnPrintOne() |
| | | { |
| | | 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(); |
| | | int r1 = r.toInt(); |
| | | if (x) |
| | | { |
| | | if (r1 > 0) |
| | | { |
| | | alert(L"æ¯éæ»éæåæ»ééä¸ä¸è´ï¼éè¦æ ¸å¯¹ï¼"); |
| | | } |
| | | } |
| | | //alert(GDNID); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | //xcombobox䏿 |
| | | int OnSelectDdlb(ref TNotifyEvent evt, int p) |
| | | { |
| | | changeddlb = 1; |
| | | int wid = ddlb_1.GetId(); |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = win32::SendMessage(wid, CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + (nIndex + 1).toString() + L"]"); |
| | | xstring no = e2.selectSingleNode(L"@element").text(); |
| | | |
| | | HTREEVIEW hItem = tv_folder.GetRootItem(); |
| | | while (tv_folder.GetChildItem(hItem)) |
| | | tv_folder.DeleteItem(tv_folder.GetChildItem(hItem)); |
| | | |
| | | ExpandFolderItem(hItem, no); |
| | | |
| | | changeddlb = 0; |
| | | return 1; |
| | | } |
| | | |
| | | int OnSelectDataShowDdlb(ref TNotifyEvent evt, int p) |
| | | { |
| | | int wid = cbx_datashow.GetId(); |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = win32::SendMessage(wid, CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = cbx_datashow.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + (nIndex + 1).toString() + L"]"); |
| | | rows = e2.selectSingleNode(L"@rows").text(); |
| | | OnPreRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int AttachEvent() |
| | | { |
| | | 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); |
| | | return 1; |
| | | } |
| | | |
| | | virtual xstring GetTemplateUrl() |
| | | { |
| | | return "/sale/view/GDN/template/GDN/ListEx"; |
| | | } |
| | | int onload() |
| | | { |
| | | listwin::onload(); |
| | | dw_list.SetColumnState(L"CurrencyNo", false); |
| | | |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | cbx_datashow = GetControl(L"cbx_datashow"); |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | //dw_goods.openUrl(L"/sale/view/GDN/template/GDNItem1"); |
| | | dw_goods.SetDataObject(GetServerUrl(), L"dev:sheet[GDN.v3.EX.tpl/GDNItem]"); |
| | | dw_goods.SetColumnState(L"ItemID", false); |
| | | dw_goods.SetColumnState(L"LineType", false); |
| | | dw_goods.SetColumnState(L"LineNo", false); |
| | | dw_goods.SetColumnState(L"Assortment", false); |
| | | dw_goods.SetColumnState(L"SOLineNo", false); |
| | | dw_goods.SetColumnState(L"SKUNo", false); |
| | | dw_goods.SetColumnState(L"POCreatorID", false); |
| | | dw_goods.SetColumnState(L"BuyAmount", false); |
| | | dw_goods.SetColumnState(L"CostRate", false); |
| | | dw_goods.SetColumnState(L"CommissionRate", false); |
| | | dw_goods.SetColumnState(L"DiscountRate", false); |
| | | dw_goods.SetColumnState(L"Remark", false); |
| | | dw_goods.SetColumnState(L"DiscountRate", false); |
| | | dw_goods.SetColumnState(L"SOLineID", false); |
| | | dw_goods.SetColumnState(L"PONo", false); |
| | | |
| | | dw_source = GetControl(L"dw_source"); |
| | | //dw_source.openUrl(L"/sale/view/GDN/template/item/sourcing"); |
| | | dw_source.SetDataObject(GetServerUrl(), L"dev:sheet[GDN.v3.EX.tpl/SourcingItem]"); |
| | | |
| | | dw_source.SetColumnState(L"POID", false); |
| | | dw_source.SetColumnState(L"InvoiceNo", false); |
| | | dw_source.SetColumnState(L"ETD", false); |
| | | dw_source.SetColumnState(L"SOLineID", false); |
| | | dw_source.SetColumnState(L"ItemID", false); |
| | | dw_source.SetColumnState(L"POItemID", false); |
| | | dw_source.SetColumnState(L"GDNLineID", false); |
| | | dw_source.SetColumnState(L"Amount", false); |
| | | |
| | | dw_profit = GetControl(L"dw_profit"); |
| | | //dw_profit.openUrl(L"/sale/view/GDN/template/Profit"); |
| | | dw_profit.SetDataObject(GetServerUrl(), L"dev:sheet[GDN.v3.EX.tpl/Profit]"); |
| | | dw_profit.SetColHeaderHeight(0); |
| | | dw_profit.SetRowSelectorWidth(0); |
| | | dw_profit.SetHScrollState(false); |
| | | |
| | | |
| | | dw_custom = GetControl(L"dw_custom"); |
| | | dw_custom.openUrl(L"/sale/view/Custom3/template/maint"); |
| | | dw_custom.SetColumnState(L"ClassifyID", false); |
| | | dw_custom.SetColumnState(L"AmountEx", false); |
| | | //dw_custom.SetReadOnlyColumn(L"CustName",true); |
| | | dw_custom.SetColumnState(L"LineNo", false); |
| | | |
| | | rows = L"500"; |
| | | myDataUrl = L"/sale/data/GDN3/folder/list"; |
| | | urlTree = L"/sale/data/GDN3/folder"; |
| | | tv_folder = GetControl(L"tv_folder"); |
| | | //tv_folder.SetLineAtRoot(true); |
| | | InitialFolder(); |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | |
| | | HTREEVIEW hItem = tv_folder.GetRootItem(); |
| | | ExpandFolderItem(hItem, L"Category:Customer"); |
| | | tv_folder.ExpandItem(hItem); |
| | | tv_folder.ItemFocus(hItem); |
| | | |
| | | listwin::onloaded(); |
| | | searchStr = L""; |
| | | readed = true; |
| | | |
| | | |
| | | |
| | | //attach my control event |
| | | AttachEvent(); |
| | | |
| | | readed = false; |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int ProcessUsedArg(xaserverarg arg) |
| | | { |
| | | xstring action = arg.GetArgString(L"Action"); |
| | | //trace(L"\r\n*******************action:"+action+L"\r\n"); |
| | | if (action == L"bill.open") { |
| | | int row = dw_list.GetRow(); |
| | | xstring ApprovalStatus = dw_list.GetItemString(row, L"ApprovalStatus"); |
| | | if (ApprovalStatus == L"9") |
| | | { |
| | | arg.AddArg(L"ReadOnly", L"true"); |
| | | arg.AddArg(L"ReadOnlyEx", L"true"); |
| | | } |
| | | } |
| | | else { |
| | | arg.AddArg(L"ReadOnly", L"false"); |
| | | } |
| | | |
| | | HTREEVIEW hItem = tv_folder.GetCaretItem(); |
| | | if (hItem <= 0) 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")); |
| | | arg.AddArg(L"CustomerName", name); |
| | | } |
| | | return 1; |
| | | } |
| | | }; |