| | |
| | | <ClCompile Include="..\project\business\AP\Select.AP.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\CustomerTran.AR.cpp" /> |
| | | <ClCompile Include="..\project\business\AR\Deduction.cpp" /> |
| | | <ClCompile Include="..\project\business\AR\ExchageFile.cpp" /> |
| | | <ClCompile Include="..\project\business\AR\ExchageInput3.cpp" /> |
| | | <ClCompile Include="..\project\business\AR\ExchangeBankTran.cpp" /> |
| | | <ClCompile Include="..\project\business\AR\ExchangeColumnTran.cpp" /> |
| | | <ClCompile Include="..\project\business\AR\ExchangeSignFast.cpp" /> |
| | | <ClCompile Include="..\project\business\AR\maint.SettlementExchange.cpp" /> |
| | | <ClCompile Include="..\project\business\AR\CustomerTran.AR.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\Deduction.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\ExchageFile.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\ExchageInput3.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\ExchangeBankTran.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\ExchangeColumnTran.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\ExchangeSignFast.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\maint.SettlementExchange.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Customer3.list.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | </ClCompile> |
| | |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) listSupplierv3 : public listwin |
| | | { |
| | | public: |
| | | xdwgrid dw_goods; |
| | | xtreeview tv_1; |
| | | xcombobox ddlb_1; |
| | | int changeddlb; |
| | | xstring TypeWork; |
| | | xstring GoodsUrl; |
| | | xstring m_sType; //type |
| | | xstring m_sTypeTxt; //选中树的data |
| | | // xstring m_searchtxt; |
| | | int PIndex; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | |
| | | public: |
| | | listSupplierv3(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static listSupplierv3* CreateInstance(void* implPtr, void* hWnd) |
| | | class __declspec(dllexport) CustomerTranARView : public xframe |
| | | { |
| | | listSupplierv3* pWin = new listSupplierv3(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | public: |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"pageindex", xstring(PIndex)); //第几页 |
| | | arg.AddArg(L"pagenumber", xstring(listwin::m_pageNumber)); //每页数量 |
| | | arg.AddArg(L"QueryTxt", listwin::m_QueryTxt); |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | //alert(L"xxxx"); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | public: |
| | | CustomerTranARView(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static CustomerTranARView* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | return -1; |
| | | CustomerTranARView* pWin = new CustomerTranARView(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | else |
| | | int SetAgent() |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int SetEntityData(xaserverarg arg) |
| | | { |
| | | xstring strQueryTxt = arg.GetArgString(L"QueryTxt"); |
| | | xml x; |
| | | |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text()); |
| | | |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | else |
| | | { |
| | | |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | //trace(x.GetXml()); |
| | | listwin::dw_list.Retrieve(x); |
| | | listwin::dw_list.Redraw(); |
| | | listwin::dw_list.SetReadOnly(true); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h->cur; |
| | | |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnRetrieve(); |
| | | PIndex = c; |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | |
| | | |
| | | } |
| | | |
| | | int ViewUpdate(int pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"refresh") |
| | | { |
| | | //trace(L"sd"); |
| | | xdwpages zz = GetControl(L"pages"); |
| | | int h = zz.SetCurPage(1); |
| | | //trace(h); |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //树选择 |
| | | int OnTreeSelChanged(TEvent evt, LPARAM p) |
| | | { |
| | | if (changeddlb != 1) |
| | | { |
| | | //alert(L"1"); |
| | | |
| | | HTREEITEM h = tv_1.GetSelectedItem(); |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)tv_1.GetItemData(h); |
| | | |
| | | xstring t = e.selectSingleNode(L"@type").text(); |
| | | m_sType = t + L""; |
| | | xstring txt = e.selectSingleNode(L"@code").text(); |
| | | if (txt == L"") |
| | | txt = e.selectSingleNode(L"@name").text(); |
| | | m_sTypeTxt = txt + L""; |
| | | |
| | | //alert(m_sTypeTxt); |
| | | |
| | | PIndex = 1; |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int createSubTree(HTREEITEM h, KXMLDOMElement ele) |
| | | { |
| | | KXMLDOMNodeList nlist = ele.selectNodes(L"item"); |
| | | int i; |
| | | int s = nlist.length(); |
| | | if (s > 0) |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(h, name, (LPARAM)e, 15); |
| | | createSubTree(hw, *e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(xstring sType) |
| | | { |
| | | |
| | | while (tv_1.GetRootItem()) |
| | | tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sType", sType); |
| | | //Tree.pref.supplier.xq |
| | | //getUrl(GetEntityName(1)+L"/entity/list",arg.GetString(),x); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[Tree.pref.supplier.xq]",arg.GetString(),x)!=1) |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/pref/list/tree", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"root/item"); |
| | | int len = nlist.length(); |
| | | if (len > 0) |
| | | { |
| | | int i; |
| | | for (i = 0; i < len; i++) |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(0, name, (LPARAM)e, 15); |
| | | |
| | | createSubTree(hw, *e); |
| | | tv_1.ExpandItem(hw); |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | tv_1.ExpandItem(0); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //重置工具条 |
| | | //SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //xcombobox下拉 |
| | | int OnSelectDdlb(TEvent evt, LPARAM p) |
| | | { |
| | | changeddlb = 1; |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmAddRow") |
| | | { |
| | | dw_list.InsertRow(0); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmInsertRow") |
| | | { |
| | | dw_list.AcceptText(); |
| | | dw_list.InsertRow(dw_list.GetRow()); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmDeleteRow") |
| | | { |
| | | dw_list.DeleteRow(0); |
| | | } |
| | | else if (comdid == L"xmClose") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmSave") |
| | | { |
| | | return OnSave(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = SendMessageW(ddlb_1.GetHWND(), CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring((nIndex + 1)) + L"]"); |
| | | xstring text = e2.selectSingleNode(L"@element").text(); |
| | | OnCreateTree(text); |
| | | changeddlb = 0; |
| | | return 1; |
| | | } |
| | | int OnItemAskStyle(TEvent* evt, LPARAM p) |
| | | { |
| | | int DMS_CSSSTYLE = 0x8; |
| | | DWASKSTYLENMHDR& hdr = *(DWASKSTYLENMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | int col = hdr.col; |
| | | xstring colname = hdr.colname; |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = listwin::dw_list.GetNextSelectRow(1); |
| | | if (row < 1) { |
| | | row = listwin::dw_list.GetRow(); |
| | | if (row < 1) { |
| | | //win::MessageBox(GetHWND(),L"请选中要删除的行!",L"提示",0); |
| | | int rows = dw_list.GetRowCount(); |
| | | if (row < 1 || row > rows) |
| | | { |
| | | return 1; |
| | | } |
| | | |
| | | if (colname == L"DataColumn") |
| | | { |
| | | xstring str = dw_list.GetItemString(row, L"DataColumn"); |
| | | if (str.length() != 36) |
| | | { |
| | | hdr.mask = DMS_CSSSTYLE; |
| | | hdr.cssstyle = L"color:#ff0000"; |
| | | } |
| | | else if (str.find(L"-") != 8) |
| | | { |
| | | hdr.mask = DMS_CSSSTYLE; |
| | | hdr.cssstyle = L"color:#ff0000"; |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&CustomerTranARView::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&CustomerTranARView::OnSetFocus); |
| | | AttachEvent(L"dw_list", L"DWV_ASKSTYLE", (FEvent)&CustomerTranARView::OnItemAskStyle); |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | dw_list.AcceptText(); |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | arg.AddArg(L"content", x.xml()); |
| | | if (getUrl(L"/sale/data/AR/update/tran/customer", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | KXMLDOMElement e = listwin::dw_list.GetRowElement(row); |
| | | //xstring sguid = e.SelectSingleNode(L"@guid").text; |
| | | //xstring sName = e.selectSingleNode(L"Name").text+L""; |
| | | xstring sguid = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"); |
| | | xstring sName = dw_list.GetItemString(dw_list.GetRow(), L"Name"); |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBoxW(GetHWND(), L"确认要删除供应商 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"EntityID", sguid); |
| | | // trace(sguid); |
| | | if (xurl::post(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/delete", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement msg = x.selectNodes(L"process").item(0); |
| | | xstring success = msg.selectSingleNode(L"@finished").text(); |
| | | if (success == L"0") |
| | | { |
| | | alert(msg.selectSingleNode(L"@errInfo").text()); |
| | | } |
| | | else |
| | | { |
| | | MessageBoxW(GetHWND(), L"删除成功!", L"提示", 0); |
| | | listwin::dw_list.DeleteRow(row); |
| | | alert(x.text()); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChangedEx(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | //if(row < 1 or row > dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = listwin::dw_list.GetRowElement(row); |
| | | xstring entity = ele.selectSingleNode(L"SupplierID").text(); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"EntityID", entity); |
| | | |
| | | |
| | | xstring no1 = publiccode::GetUser().no; |
| | | if (no1 != L"00201") |
| | | { |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritemEx"; |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | if (getUrl(GetServerUrl(), GoodsUrl, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | } |
| | | SetAgent(L"list", entity); |
| | | return 1; |
| | | } |
| | | |
| | | int GridSearch() |
| | | { |
| | | //alert(L"你好"); |
| | | #if 0 |
| | | |
| | | xstring m_config = L"view.Supplier.v3.config"; |
| | | xdwgrid dw = listwin::dw_list; |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = TFile::node(m_config, L"config", L"search"); |
| | | if (str != L"") { |
| | | arg.AddArg(L"sheet", str); |
| | | } |
| | | else |
| | | arg.AddArg(L"sheet", L"dev:sheet[Supplier.v3.tpl/list]"); |
| | | arg.AddArg(L"search", listwin::m_QueryTxt); |
| | | openUrl(L"view.dlg.vface/xpage/grid/column/search", &arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring txt = arg.GetArgString(L"search"); |
| | | if (txt != L"") { |
| | | listwin::m_QueryTxt = txt; |
| | | //trace(txt); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | #endif |
| | | return 0; |
| | | } |
| | | |
| | | int OnSelectAllRow() |
| | | { |
| | | int rows = listwin::dw_list.GetRowCount(); |
| | | if (rows < 1) return -1; |
| | | listwin::dw_list.SelectRow(1, rows, true); |
| | | listwin::dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnRClick(TEvent evt, LPARAM p) |
| | | { |
| | | return 1; |
| | | } |
| | | int OnLogOff() |
| | | { |
| | | return 1; |
| | | } |
| | | int OnChecked() |
| | | { |
| | | xstring partyno = dw_list.GetItemString(dw_list.GetRow(), L"PartyNo"); |
| | | if (partyno.find(L"N") < 0) |
| | | { |
| | | alert(L"已经是正式供应商"); |
| | | return 0; |
| | | } |
| | | xstring entityid = GetEntityID(dw_list.GetRow()); |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBoxW(GetHWND(), L"是否转成正式供应商?", L"提示", MB_OKCANCEL); |
| | | if (ret == IDOK) |
| | | { |
| | | xml x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/updateno", L"entityid", entityid); |
| | | |
| | | if (xstring(x.xml()).find(L"success") > 0) |
| | | { |
| | | alert(L"处理成功"); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | //alert(comdid); |
| | | |
| | | if (comdid.find(L"action:LogOff", 0) >= 0) return OnLogOff(); |
| | | if (comdid.find(L"action:bill.delete", 0) >= 0) |
| | | { |
| | | OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | if (comdid == L"action:search1") return GridSearch(); |
| | | if (comdid == L"action:bill.refresh") |
| | | { |
| | | return OnRetrieve(); |
| | | } |
| | | if (comdid == L"action:bill.xmSaveAs") |
| | | { |
| | | xstring userno = publiccode::GetUser().no; |
| | | if (userno == L"00701" || userno == L"00601" || userno == L"admin") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | } |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.Annex") |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | arg.AddArg(L"ApplyStatus", dw_list.GetItemString(dw_list.GetRow(), L"ApplyStatus")); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.Document.Supplier.v3.vx]", (LPARAM)&arg); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.AnnexEx") |
| | | { |
| | | xaserverarg& arg4 = *new xaserverarg; |
| | | arg4.setNativePointer(arg4.CreateInstance()); |
| | | arg4.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | //arg4.AddArg(L"ApplyStatus",dw_list.GetItemString(dw_list.GetRow(),L"ApplyStatus")); |
| | | |
| | | //OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", p4); |
| | | OpenWindow(L"dev:xpage[maint.Document.SupplierSD.v3.vx]", (LPARAM)&arg4); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.checked") |
| | | return OnChecked(); |
| | | // if(comdid==L"action:bill.import") return OnImport(); |
| | | // if(comdid.find(L"action:",0)>=0) return ProcessFlowAction(comdid,1); |
| | | //if(comdid==L"search") return GridSearch(L"view.dlg.vface/xpage/grid/column/edit"); |
| | | //if(comdid==L"showall") return ShowAll(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int PostOnAttachEvent() |
| | | { |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listSupplierv3::OnTreeSelChanged); |
| | | AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listSupplierv3::OnSelectDdlb); |
| | | AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listSupplierv3::OnChangePages); |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&listSupplierv3::OnRClick);//鼠标右键 |
| | | //AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listSupplierv3::OnDoubleClicked); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | PIndex = 1; |
| | | listwin::m_QueryTxt = L""; //查询条件 |
| | | m_sType = L""; //type |
| | | m_sTypeTxt = L""; //选中树的data |
| | | |
| | | listwin::onload(); |
| | | |
| | | tv_1 = GetControl(L"tv_1"); |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | |
| | | changeddlb = 0; |
| | | OnCreateTree(L"GoodsCates"); |
| | | dw_list.SetColumnState(L"SupplierID", false); |
| | | dw_list.SetColumnState(L"userNo", false); |
| | | dw_list.SetColumnState(L"YearEstablished", false); |
| | | dw_list.SetColumnState(L"LegalPerson", false); |
| | | dw_list.SetColumnState(L"ThirdPartyReport", false); |
| | | dw_list.SetColumnState(L"bAddress", false); |
| | | dw_list.SetColumnState(L"PayType", false); |
| | | dw_list.SetColumnState(L"PicPath", false); |
| | | dw_list.SetColumnState(L"SDID", false); |
| | | dw_list.SetColumnState(L"AdvantageProduct", false); |
| | | //dw_list.SetColumnState(L"ApplyStatus",false); |
| | | |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(GetServerUrl(), L"/sale/view/SupplierV3/template/supplier/supplieritem"); |
| | | |
| | | if (publiccode::GetUser().name != L"admin") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | |
| | | xml supplier_x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); |
| | | if (supplier_x) |
| | | if (getUrl(L"/sale/data/AR/tran/customer", arg.GetString(), x) != 1) |
| | | { |
| | | TypeWork = supplier_x.text(); |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | |
| | | dw_list.SetColumnState(L"DateEx", false); |
| | | dw_list.SetColumnState(L"DateExS", false); |
| | | dw_list.SetColumnState(L"Name", false); |
| | | dw_list.SetColumnState(L"ProvinceCode", false); |
| | | dw_list.SetColumnState(L"City", false); |
| | | dw_list.SetColumnState(L"District", false); |
| | | dw_list.SetColumnState(L"Address", false); |
| | | dw_list.SetColumnState(L"CName", false); |
| | | dw_list.SetColumnState(L"TEL", false); |
| | | dw_list.SetColumnState(L"Mob", false); |
| | | dw_list.SetColumnState(L"AreaCode", false); |
| | | dw_list.SetColumnState(L"Fax", false); |
| | | dw_goods.SetColumnState(L"Price", false); |
| | | dw_goods.SetColumnState(L"PackRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PartRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PaperRMBPrice", false); |
| | | dw_goods.SetColumnState(L"ETD", false); |
| | | dw_goods.SetColumnState(L"InvoiceNo", false); |
| | | |
| | | } |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/AR/template/customertran"); |
| | | dw_list.SetAskStyle(true); |
| | | |
| | | int onloaded() |
| | | { |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&listSupplierv3::OnRowChangedEx); |
| | | OnAttachEvent(); |
| | | OnRetrieve(); |
| | | |
| | | listwin::onloaded(); |
| | | xstring EntityID; |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = listwin::m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text(); |
| | | if (ele.selectSingleNode(id)) |
| | | EntityID = ele.selectSingleNode(id).text(); |
| | | listwin::SetAgent(L"list", EntityID); |
| | | return 1; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | }; |
| | | int onloaded() |
| | | { |
| | | //SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) listSupplierv3 : public listwin |
| | | { |
| | | public: |
| | | xdwgrid dw_goods; |
| | | xtreeview tv_1; |
| | | xcombobox ddlb_1; |
| | | int changeddlb; |
| | | xstring TypeWork; |
| | | xstring GoodsUrl; |
| | | xstring m_sType; //type |
| | | xstring m_sTypeTxt; //选中树的data |
| | | // xstring m_searchtxt; |
| | | int PIndex; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | |
| | | public: |
| | | listSupplierv3(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static listSupplierv3* CreateInstance(void* implPtr, void* hWnd) |
| | | class __declspec(dllexport) Deduction : public xframe |
| | | { |
| | | listSupplierv3* pWin = new listSupplierv3(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | public: |
| | | xdwgrid dw_list; |
| | | xstring EntityID; |
| | | xstring InvoiceNo; |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"pageindex", xstring(PIndex)); //第几页 |
| | | arg.AddArg(L"pagenumber", xstring(listwin::m_pageNumber)); //每页数量 |
| | | arg.AddArg(L"QueryTxt", listwin::m_QueryTxt); |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | //alert(L"xxxx"); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | public: |
| | | Deduction(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static Deduction* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | return -1; |
| | | Deduction* pWin = new Deduction(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | else |
| | | int SetAgent() |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int SetEntityData(xaserverarg arg) |
| | | { |
| | | xstring strQueryTxt = arg.GetArgString(L"QueryTxt"); |
| | | xml x; |
| | | |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text()); |
| | | |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | else |
| | | { |
| | | |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | //trace(x.GetXml()); |
| | | listwin::dw_list.Retrieve(x); |
| | | listwin::dw_list.Redraw(); |
| | | listwin::dw_list.SetReadOnly(true); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h->cur; |
| | | |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnRetrieve(); |
| | | PIndex = c; |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | |
| | | |
| | | } |
| | | |
| | | int ViewUpdate(int pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"refresh") |
| | | { |
| | | //trace(L"sd"); |
| | | xdwpages zz = GetControl(L"pages"); |
| | | int h = zz.SetCurPage(1); |
| | | //trace(h); |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //树选择 |
| | | int OnTreeSelChanged(TEvent evt, LPARAM p) |
| | | { |
| | | if (changeddlb != 1) |
| | | { |
| | | //alert(L"1"); |
| | | |
| | | HTREEITEM h = tv_1.GetSelectedItem(); |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)tv_1.GetItemData(h); |
| | | |
| | | xstring t = e.selectSingleNode(L"@type").text(); |
| | | m_sType = t + L""; |
| | | xstring txt = e.selectSingleNode(L"@code").text(); |
| | | if (txt == L"") |
| | | txt = e.selectSingleNode(L"@name").text(); |
| | | m_sTypeTxt = txt + L""; |
| | | |
| | | //alert(m_sTypeTxt); |
| | | |
| | | PIndex = 1; |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int createSubTree(HTREEITEM h, KXMLDOMElement ele) |
| | | { |
| | | KXMLDOMNodeList nlist = ele.selectNodes(L"item"); |
| | | int i; |
| | | int s = nlist.length(); |
| | | if (s > 0) |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(h, name, (LPARAM)e, 15); |
| | | createSubTree(hw, *e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(xstring sType) |
| | | { |
| | | |
| | | while (tv_1.GetRootItem()) |
| | | tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sType", sType); |
| | | //Tree.pref.supplier.xq |
| | | //getUrl(GetEntityName(1)+L"/entity/list",arg.GetString(),x); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[Tree.pref.supplier.xq]",arg.GetString(),x)!=1) |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/pref/list/tree", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"root/item"); |
| | | int len = nlist.length(); |
| | | if (len > 0) |
| | | { |
| | | int i; |
| | | for (i = 0; i < len; i++) |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(0, name, (LPARAM)e, 15); |
| | | |
| | | createSubTree(hw, *e); |
| | | tv_1.ExpandItem(hw); |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | tv_1.ExpandItem(0); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int OnRowChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //xcombobox下拉 |
| | | int OnSelectDdlb(TEvent evt, LPARAM p) |
| | | { |
| | | changeddlb = 1; |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //重置工具条 |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = SendMessageW(ddlb_1.GetHWND(), CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring((nIndex + 1)) + L"]"); |
| | | xstring text = e2.selectSingleNode(L"@element").text(); |
| | | OnCreateTree(text); |
| | | changeddlb = 0; |
| | | return 1; |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmSave") |
| | | { |
| | | OnSave(); |
| | | return 1; |
| | | } |
| | | if (comdid == L"xmSearch") |
| | | { |
| | | OnRetrieve(InvoiceNo, EntityID); |
| | | return 1; |
| | | } |
| | | if (comdid == L"xmClose") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = listwin::dw_list.GetNextSelectRow(1); |
| | | if (row < 1) { |
| | | row = listwin::dw_list.GetRow(); |
| | | if (row < 1) { |
| | | //win::MessageBox(GetHWND(),L"请选中要删除的行!",L"提示",0); |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | xstring GetGuid() |
| | | { |
| | | return publiccode::GetGuid(); |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml x; |
| | | |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | trace(x.xml()); |
| | | if (xurl::get(L"/sale/data/AR/update/ARDeduction", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_list.ResetUpdateStatus(); |
| | | alert(L"保存成功!"); |
| | | } |
| | | else |
| | | { |
| | | alert(L"保存失败!"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnItemChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring colname = hdr.colname; |
| | | xstring value = hdr.data; |
| | | int row = hdr.row; |
| | | xstring dwname = L"dw_list"; |
| | | if (colname == L"DeductionAmount") |
| | | { |
| | | dw_list.SetItemString(row, L"SettlementAdjustID", EntityID); |
| | | xstring id = publiccode::GetGuid(); |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | ele.setAttribute(L"guid", id); |
| | | //dw_list.SetGuid(row,id); |
| | | //alert(ele.xml); |
| | | //alert(dw_list.GetGuid(row)); |
| | | } |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&Deduction::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&Deduction::OnSetFocus); |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&Deduction::OnRowChanged); |
| | | AttachEvent(L"dw_list", L"DWV_ITEMCHANGED", (FEvent)&Deduction::OnItemChanged); |
| | | } |
| | | |
| | | |
| | | int OnRetrieve(xstring InvoiceNo, xstring EntityID) |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"InvoiceNo", InvoiceNo); |
| | | arg.AddArg(L"InvoiceNoEx", GetControl(L"search").GetText()); |
| | | arg.AddArg(L"EntityID", EntityID); |
| | | |
| | | trace(GetControl(L"search").GetText()); |
| | | if (getUrl(L"/sale/data/AR/DeductionList", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | KXMLDOMElement e = listwin::dw_list.GetRowElement(row); |
| | | //xstring sguid = e.SelectSingleNode(L"@guid").text; |
| | | //xstring sName = e.selectSingleNode(L"Name").text+L""; |
| | | xstring sguid = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"); |
| | | xstring sName = dw_list.GetItemString(dw_list.GetRow(), L"Name"); |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBoxW(GetHWND(), L"确认要删除供应商 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"EntityID", sguid); |
| | | // trace(sguid); |
| | | if (xurl::post(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/delete", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement msg = x.selectNodes(L"process").item(0); |
| | | xstring success = msg.selectSingleNode(L"@finished").text(); |
| | | if (success == L"0") |
| | | { |
| | | alert(msg.selectSingleNode(L"@errInfo").text()); |
| | | } |
| | | else |
| | | { |
| | | MessageBoxW(GetHWND(), L"删除成功!", L"提示", 0); |
| | | listwin::dw_list.DeleteRow(row); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChangedEx(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | //if(row < 1 or row > dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = listwin::dw_list.GetRowElement(row); |
| | | xstring entity = ele.selectSingleNode(L"SupplierID").text(); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"EntityID", entity); |
| | | |
| | | |
| | | xstring no1 = publiccode::GetUser().no; |
| | | if (no1 != L"00201") |
| | | { |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritemEx"; |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | if (getUrl(GetServerUrl(), GoodsUrl, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | } |
| | | SetAgent(L"list", entity); |
| | | return 1; |
| | | } |
| | | |
| | | int GridSearch() |
| | | { |
| | | //alert(L"你好"); |
| | | #if 0 |
| | | |
| | | xstring m_config = L"view.Supplier.v3.config"; |
| | | xdwgrid dw = listwin::dw_list; |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = TFile::node(m_config, L"config", L"search"); |
| | | if (str != L"") { |
| | | arg.AddArg(L"sheet", str); |
| | | } |
| | | else |
| | | arg.AddArg(L"sheet", L"dev:sheet[Supplier.v3.tpl/list]"); |
| | | arg.AddArg(L"search", listwin::m_QueryTxt); |
| | | openUrl(L"view.dlg.vface/xpage/grid/column/search", &arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring txt = arg.GetArgString(L"search"); |
| | | if (txt != L"") { |
| | | listwin::m_QueryTxt = txt; |
| | | //trace(txt); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | #endif |
| | | return 0; |
| | | } |
| | | |
| | | int OnSelectAllRow() |
| | | { |
| | | int rows = listwin::dw_list.GetRowCount(); |
| | | if (rows < 1) return -1; |
| | | listwin::dw_list.SelectRow(1, rows, true); |
| | | listwin::dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnRClick(TEvent evt, LPARAM p) |
| | | { |
| | | return 1; |
| | | } |
| | | int OnLogOff() |
| | | { |
| | | return 1; |
| | | } |
| | | int OnChecked() |
| | | { |
| | | xstring partyno = dw_list.GetItemString(dw_list.GetRow(), L"PartyNo"); |
| | | if (partyno.find(L"N") < 0) |
| | | { |
| | | alert(L"已经是正式供应商"); |
| | | return 0; |
| | | } |
| | | xstring entityid = GetEntityID(dw_list.GetRow()); |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBoxW(GetHWND(), L"是否转成正式供应商?", L"提示", MB_OKCANCEL); |
| | | if (ret == IDOK) |
| | | { |
| | | xml x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/updateno", L"entityid", entityid); |
| | | |
| | | if (xstring(x.xml()).find(L"success") > 0) |
| | | { |
| | | alert(L"处理成功"); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | //alert(comdid); |
| | | |
| | | if (comdid.find(L"action:LogOff", 0) >= 0) return OnLogOff(); |
| | | if (comdid.find(L"action:bill.delete", 0) >= 0) |
| | | { |
| | | OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | if (comdid == L"action:search1") return GridSearch(); |
| | | if (comdid == L"action:bill.refresh") |
| | | { |
| | | return OnRetrieve(); |
| | | } |
| | | if (comdid == L"action:bill.xmSaveAs") |
| | | { |
| | | xstring userno = publiccode::GetUser().no; |
| | | if (userno == L"00701" || userno == L"00601" || userno == L"admin") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | } |
| | | dw_list.SetSelectionMode(1); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.Annex") |
| | | |
| | | int onload() |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | arg.AddArg(L"ApplyStatus", dw_list.GetItemString(dw_list.GetRow(), L"ApplyStatus")); |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/AR/template/Deduction"); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.Document.Supplier.v3.vx]", (LPARAM)&arg); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.AnnexEx") |
| | | { |
| | | xaserverarg& arg4 = *new xaserverarg; |
| | | arg4.setNativePointer(arg4.CreateInstance()); |
| | | arg4.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | //arg4.AddArg(L"ApplyStatus",dw_list.GetItemString(dw_list.GetRow(),L"ApplyStatus")); |
| | | |
| | | //OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", p4); |
| | | OpenWindow(L"dev:xpage[maint.Document.SupplierSD.v3.vx]", (LPARAM)&arg4); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.checked") |
| | | return OnChecked(); |
| | | // if(comdid==L"action:bill.import") return OnImport(); |
| | | // if(comdid.find(L"action:",0)>=0) return ProcessFlowAction(comdid,1); |
| | | //if(comdid==L"search") return GridSearch(L"view.dlg.vface/xpage/grid/column/edit"); |
| | | //if(comdid==L"showall") return ShowAll(); |
| | | |
| | | return 1; |
| | | } |
| | | dw_list.SetColumnState(L"ID", false); |
| | | dw_list.SetColumnState(L"GDNLineID", false); |
| | | dw_list.SetColumnState(L"SettlementAdjustID", false); |
| | | |
| | | |
| | | int PostOnAttachEvent() |
| | | { |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listSupplierv3::OnTreeSelChanged); |
| | | AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listSupplierv3::OnSelectDdlb); |
| | | AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listSupplierv3::OnChangePages); |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&listSupplierv3::OnRClick);//鼠标右键 |
| | | //AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listSupplierv3::OnDoubleClicked); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | PIndex = 1; |
| | | listwin::m_QueryTxt = L""; //查询条件 |
| | | m_sType = L""; //type |
| | | m_sTypeTxt = L""; //选中树的data |
| | | |
| | | listwin::onload(); |
| | | |
| | | tv_1 = GetControl(L"tv_1"); |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | |
| | | changeddlb = 0; |
| | | OnCreateTree(L"GoodsCates"); |
| | | dw_list.SetColumnState(L"SupplierID", false); |
| | | dw_list.SetColumnState(L"userNo", false); |
| | | dw_list.SetColumnState(L"YearEstablished", false); |
| | | dw_list.SetColumnState(L"LegalPerson", false); |
| | | dw_list.SetColumnState(L"ThirdPartyReport", false); |
| | | dw_list.SetColumnState(L"bAddress", false); |
| | | dw_list.SetColumnState(L"PayType", false); |
| | | dw_list.SetColumnState(L"PicPath", false); |
| | | dw_list.SetColumnState(L"SDID", false); |
| | | dw_list.SetColumnState(L"AdvantageProduct", false); |
| | | //dw_list.SetColumnState(L"ApplyStatus",false); |
| | | |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(GetServerUrl(), L"/sale/view/SupplierV3/template/supplier/supplieritem"); |
| | | |
| | | if (publiccode::GetUser().name != L"admin") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | |
| | | xml supplier_x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); |
| | | if (supplier_x) |
| | | if (GetWinParam()) |
| | | { |
| | | TypeWork = supplier_x.text(); |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | |
| | | dw_list.SetColumnState(L"DateEx", false); |
| | | dw_list.SetColumnState(L"DateExS", false); |
| | | dw_list.SetColumnState(L"Name", false); |
| | | dw_list.SetColumnState(L"ProvinceCode", false); |
| | | dw_list.SetColumnState(L"City", false); |
| | | dw_list.SetColumnState(L"District", false); |
| | | dw_list.SetColumnState(L"Address", false); |
| | | dw_list.SetColumnState(L"CName", false); |
| | | dw_list.SetColumnState(L"TEL", false); |
| | | dw_list.SetColumnState(L"Mob", false); |
| | | dw_list.SetColumnState(L"AreaCode", false); |
| | | dw_list.SetColumnState(L"Fax", false); |
| | | dw_goods.SetColumnState(L"Price", false); |
| | | dw_goods.SetColumnState(L"PackRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PartRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PaperRMBPrice", false); |
| | | dw_goods.SetColumnState(L"ETD", false); |
| | | dw_goods.SetColumnState(L"InvoiceNo", false); |
| | | |
| | | } |
| | | xaserverarg arg = GetArg(); |
| | | EntityID = arg.GetArgString(L"EntityID"); |
| | | InvoiceNo = arg.GetArgString(L"InvoiceNo"); |
| | | } |
| | | |
| | | trace(InvoiceNo); |
| | | OnRetrieve(InvoiceNo, EntityID); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | int onloaded() |
| | | { |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&listSupplierv3::OnRowChangedEx); |
| | | |
| | | listwin::onloaded(); |
| | | xstring EntityID; |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = listwin::m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text(); |
| | | if (ele.selectSingleNode(id)) |
| | | EntityID = ele.selectSingleNode(id).text(); |
| | | listwin::SetAgent(L"list", EntityID); |
| | | return 1; |
| | | } |
| | | |
| | | }; |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) listSupplierv3 : public listwin |
| | | { |
| | | public: |
| | | xdwgrid dw_goods; |
| | | xtreeview tv_1; |
| | | xcombobox ddlb_1; |
| | | int changeddlb; |
| | | xstring TypeWork; |
| | | xstring GoodsUrl; |
| | | xstring m_sType; //type |
| | | xstring m_sTypeTxt; //选中树的data |
| | | // xstring m_searchtxt; |
| | | int PIndex; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | |
| | | public: |
| | | listSupplierv3(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static listSupplierv3* CreateInstance(void* implPtr, void* hWnd) |
| | | class __declspec(dllexport) ExchangeFileView : public xframe |
| | | { |
| | | listSupplierv3* pWin = new listSupplierv3(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | public: |
| | | xcell dw_exchangefile; |
| | | xdwtable dw_arg; |
| | | xdwgrid dw_exch; |
| | | xstring filename; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"pageindex", xstring(PIndex)); //第几页 |
| | | arg.AddArg(L"pagenumber", xstring(listwin::m_pageNumber)); //每页数量 |
| | | arg.AddArg(L"QueryTxt", listwin::m_QueryTxt); |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | //alert(L"xxxx"); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | public: |
| | | ExchangeFileView(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static ExchangeFileView* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | return -1; |
| | | ExchangeFileView* pWin = new ExchangeFileView(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | else |
| | | int SetAgent() |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int SetEntityData(xaserverarg arg) |
| | | { |
| | | xstring strQueryTxt = arg.GetArgString(L"QueryTxt"); |
| | | xml x; |
| | | |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text()); |
| | | |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | else |
| | | { |
| | | |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | //trace(x.GetXml()); |
| | | listwin::dw_list.Retrieve(x); |
| | | listwin::dw_list.Redraw(); |
| | | listwin::dw_list.SetReadOnly(true); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h->cur; |
| | | |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnRetrieve(); |
| | | PIndex = c; |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | |
| | | |
| | | } |
| | | |
| | | int ViewUpdate(int pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"refresh") |
| | | { |
| | | //trace(L"sd"); |
| | | xdwpages zz = GetControl(L"pages"); |
| | | int h = zz.SetCurPage(1); |
| | | //trace(h); |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //树选择 |
| | | int OnTreeSelChanged(TEvent evt, LPARAM p) |
| | | { |
| | | if (changeddlb != 1) |
| | | { |
| | | //alert(L"1"); |
| | | |
| | | HTREEITEM h = tv_1.GetSelectedItem(); |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)tv_1.GetItemData(h); |
| | | |
| | | xstring t = e.selectSingleNode(L"@type").text(); |
| | | m_sType = t + L""; |
| | | xstring txt = e.selectSingleNode(L"@code").text(); |
| | | if (txt == L"") |
| | | txt = e.selectSingleNode(L"@name").text(); |
| | | m_sTypeTxt = txt + L""; |
| | | |
| | | //alert(m_sTypeTxt); |
| | | |
| | | PIndex = 1; |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int createSubTree(HTREEITEM h, KXMLDOMElement ele) |
| | | { |
| | | KXMLDOMNodeList nlist = ele.selectNodes(L"item"); |
| | | int i; |
| | | int s = nlist.length(); |
| | | if (s > 0) |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(h, name, (LPARAM)e, 15); |
| | | createSubTree(hw, *e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(xstring sType) |
| | | { |
| | | |
| | | while (tv_1.GetRootItem()) |
| | | tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sType", sType); |
| | | //Tree.pref.supplier.xq |
| | | //getUrl(GetEntityName(1)+L"/entity/list",arg.GetString(),x); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[Tree.pref.supplier.xq]",arg.GetString(),x)!=1) |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/pref/list/tree", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"root/item"); |
| | | int len = nlist.length(); |
| | | if (len > 0) |
| | | { |
| | | int i; |
| | | for (i = 0; i < len; i++) |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(0, name, (LPARAM)e, 15); |
| | | |
| | | createSubTree(hw, *e); |
| | | tv_1.ExpandItem(hw); |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | tv_1.ExpandItem(0); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int OnCellClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | //if(hdr.col ==1)hdr.idFrom = -1; |
| | | //if(hdr.col ==2)hdr.idFrom = -1; |
| | | if (hdr.row == 1)hdr.idFrom = -1; |
| | | return 2; |
| | | } |
| | | |
| | | //xcombobox下拉 |
| | | int OnSelectDdlb(TEvent evt, LPARAM p) |
| | | { |
| | | changeddlb = 1; |
| | | int OnValid() |
| | | { |
| | | int row = dw_exchangefile.GetValidRow(); |
| | | int col = dw_exchangefile.GetValidCol(); |
| | | for (int i = 2; i < row; i++) |
| | | { |
| | | |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = SendMessageW(ddlb_1.GetHWND(), CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring((nIndex + 1)) + L"]"); |
| | | xstring text = e2.selectSingleNode(L"@element").text(); |
| | | OnCreateTree(text); |
| | | changeddlb = 0; |
| | | return 1; |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = listwin::dw_list.GetNextSelectRow(1); |
| | | if (row < 1) { |
| | | row = listwin::dw_list.GetRow(); |
| | | if (row < 1) { |
| | | //win::MessageBox(GetHWND(),L"请选中要删除的行!",L"提示",0); |
| | | int OnCellItemChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | /*int currentrow; |
| | | int currentcol; |
| | | const xstring data; |
| | | int anchorrow; |
| | | int anchorcol;*/ |
| | | if (hdr.currentcol == 1 && hdr.data != L"") |
| | | { |
| | | //dw_exchangefile.SetItemString(hdr.currentrow,hdr.currentcol, L""); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //重置工具条 |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | dw_exch.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | int row = dw_exch.InsertRow(0); |
| | | xstring sdate = publiccode::GetCurrentDate(); |
| | | dw_exch.SetItemString(row, L"CreateDate", sdate); |
| | | dw_exch.SetItemString(row, L"SEDate", sdate); |
| | | dw_exch.SetItemString(row, L"CurrencyCode", L"USD"); |
| | | xstring suserid = publiccode::GetUser().id; |
| | | xstring susername = publiccode::GetUser().name; |
| | | dw_exch.SetItemString(row, L"CreatorID", suserid); |
| | | dw_exch.SetItemDisplayString(row, L"CreatorID", susername); |
| | | |
| | | if (row > 1) |
| | | { |
| | | xstring exchrate = dw_exch.GetItemString(row - 1, L"ExchRate"); |
| | | if (exchrate != L"") dw_exch.SetItemString(row, L"ExchRate", exchrate); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnTran() |
| | | { |
| | | //get head |
| | | xstring head = L""; |
| | | xstring val = L""; |
| | | int cols = dw_exchangefile.GetValidCol(1); |
| | | for (int col = 1; col <= cols; ++col) |
| | | { |
| | | val = dw_exchangefile.GetItemString(1, col); |
| | | val = val.trim(); |
| | | if (val == L"")continue; |
| | | if (val.find(L"(L") >= 0) val = val.left(val.find(L"(L")); |
| | | if (val.find(L"(") >= 0) val = val.left(val.find(L"(")); |
| | | if (val.find(L"[") >= 0) val = val.left(val.find(L"[")); |
| | | if (val.find(L"【") >= 0) val = val.left(val.find(L"【")); |
| | | if (val.find(L"/") >= 0) val = val.left(val.find(L"/")); |
| | | if (val.find(L"\r") >= 0) val = val.left(val.find(L"\r")); |
| | | if (val.find(L"\n") >= 0) val = val.left(val.find(L"\n")); |
| | | if (head == L"") head = val; else head += L",L" + val; |
| | | } |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"head", head); |
| | | //alert(head); |
| | | if (getUrl(L"/sale/data/AR/match/bank", arg.GetString(), x) != 1)return 1; |
| | | KXMLDOMNode n = x.selectSingleNode(L"data/Bank"); |
| | | if (!n) |
| | | { |
| | | alert(L"未匹配到合适的银行,请先配置数据转换信息"); |
| | | return 1; |
| | | } |
| | | |
| | | KXMLDOMNodeList items = n.selectNodes(L"Item"); |
| | | int len = items.length(); |
| | | IntegerArray indexs = IntegerArray::make(); |
| | | StringArray columns = StringArray::make(); |
| | | xstring bank = n.selectSingleNode(L"@name").text(); |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | KXMLDOMElement e = items.item(i); |
| | | xstring str = e.getAttribute(L"index"); |
| | | indexs.push_back(str.toInt()); |
| | | columns.push_back(e.selectSingleNode(L"DataColumn").text()); |
| | | } |
| | | |
| | | if (MessageBox(GetHWND(), L"是否载入" + bank + L"结汇数据!", L"提示", 1) == 2) return 1; |
| | | |
| | | SwitchLayer(L"sheet2", L"frame"); |
| | | //set bank account |
| | | xml xb = ViewObject::RetrieveData(L"/sale/data/AR/tran/bank/info", L"bank", bank); |
| | | if (xb) |
| | | { |
| | | KXMLDOMNode nt = xb.selectSingleNode(L"/data/Item/Account"); |
| | | if (nt) |
| | | { |
| | | dw_arg.SetItemString(1, L"Bank", nt.text()); |
| | | if (nt.selectSingleNode(L"@_displaystring")) |
| | | dw_arg.SetItemDisplayString(1, L"Bank", nt.selectSingleNode(L"@_displaystring").text()); |
| | | } |
| | | |
| | | } |
| | | |
| | | //clear data |
| | | for (int m = dw_exch.GetRowCount(); m > 0; m--) dw_exch.DeleteRow(m); |
| | | |
| | | |
| | | //读取客户转换信息 |
| | | xml xc; |
| | | |
| | | if (getUrl(L"/sale/data/AR/tran/customer", L"", xc) != 1) |
| | | { |
| | | trace(xc.text()); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | KXMLDOMElement e = listwin::dw_list.GetRowElement(row); |
| | | //xstring sguid = e.SelectSingleNode(L"@guid").text; |
| | | //xstring sName = e.selectSingleNode(L"Name").text+L""; |
| | | xstring sguid = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"); |
| | | xstring sName = dw_list.GetItemString(dw_list.GetRow(), L"Name"); |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBoxW(GetHWND(), L"确认要删除供应商 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | xml x; |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | KXMLDOMDocument xdoc = xc; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"EntityID", sguid); |
| | | // trace(sguid); |
| | | if (xurl::post(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/delete", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement msg = x.selectNodes(L"process").item(0); |
| | | xstring success = msg.selectSingleNode(L"@finished").text(); |
| | | if (success == L"0") |
| | | int rows = dw_exchangefile.GetValidRow(); |
| | | for (int row = 2; row <= rows; ++row) |
| | | { |
| | | alert(msg.selectSingleNode(L"@errInfo").text()); |
| | | } |
| | | else |
| | | { |
| | | MessageBoxW(GetHWND(), L"删除成功!", L"提示", 0); |
| | | listwin::dw_list.DeleteRow(row); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | val = dw_exchangefile.GetItemString(row, indexs.item(0)); |
| | | if (val.trim() == L"") continue; |
| | | int curRow = dw_exch.InsertRow(0); |
| | | |
| | | int OnRowChangedEx(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | //if(row < 1 or row > dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = listwin::dw_list.GetRowElement(row); |
| | | xstring entity = ele.selectSingleNode(L"SupplierID").text(); |
| | | xml x; |
| | | //init |
| | | xstring sdate = publiccode::GetCurrentDate(); |
| | | dw_exch.SetItemString(curRow, L"CreateDate", sdate); |
| | | dw_exch.SetItemString(curRow, L"SEDate", sdate); |
| | | xstring suserid = publiccode::GetUser().id; |
| | | xstring susername = publiccode::GetUser().name; |
| | | dw_exch.SetItemString(curRow, L"CreatorID", suserid); |
| | | dw_exch.SetItemDisplayString(curRow, L"CreatorID", susername); |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"EntityID", entity); |
| | | |
| | | |
| | | xstring no1 = publiccode::GetUser().no; |
| | | if (no1 != L"00201") |
| | | { |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritemEx"; |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | if (getUrl(GetServerUrl(), GoodsUrl, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | } |
| | | SetAgent(L"list", entity); |
| | | return 1; |
| | | } |
| | | |
| | | int GridSearch() |
| | | { |
| | | //alert(L"你好"); |
| | | #if 0 |
| | | |
| | | xstring m_config = L"view.Supplier.v3.config"; |
| | | xdwgrid dw = listwin::dw_list; |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = TFile::node(m_config, L"config", L"search"); |
| | | if (str != L"") { |
| | | arg.AddArg(L"sheet", str); |
| | | } |
| | | else |
| | | arg.AddArg(L"sheet", L"dev:sheet[Supplier.v3.tpl/list]"); |
| | | arg.AddArg(L"search", listwin::m_QueryTxt); |
| | | openUrl(L"view.dlg.vface/xpage/grid/column/search", &arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring txt = arg.GetArgString(L"search"); |
| | | if (txt != L"") { |
| | | listwin::m_QueryTxt = txt; |
| | | //trace(txt); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | #endif |
| | | return 0; |
| | | } |
| | | |
| | | int OnSelectAllRow() |
| | | { |
| | | int rows = listwin::dw_list.GetRowCount(); |
| | | if (rows < 1) return -1; |
| | | listwin::dw_list.SelectRow(1, rows, true); |
| | | listwin::dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnRClick(TEvent evt, LPARAM p) |
| | | { |
| | | return 1; |
| | | } |
| | | int OnLogOff() |
| | | { |
| | | return 1; |
| | | } |
| | | int OnChecked() |
| | | { |
| | | xstring partyno = dw_list.GetItemString(dw_list.GetRow(), L"PartyNo"); |
| | | if (partyno.find(L"N") < 0) |
| | | { |
| | | alert(L"已经是正式供应商"); |
| | | return 0; |
| | | } |
| | | xstring entityid = GetEntityID(dw_list.GetRow()); |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBoxW(GetHWND(), L"是否转成正式供应商?", L"提示", MB_OKCANCEL); |
| | | if (ret == IDOK) |
| | | { |
| | | xml x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/updateno", L"entityid", entityid); |
| | | |
| | | if (xstring(x.xml()).find(L"success") > 0) |
| | | { |
| | | alert(L"处理成功"); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | //alert(comdid); |
| | | |
| | | if (comdid.find(L"action:LogOff", 0) >= 0) return OnLogOff(); |
| | | if (comdid.find(L"action:bill.delete", 0) >= 0) |
| | | { |
| | | OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | if (comdid == L"action:search1") return GridSearch(); |
| | | if (comdid == L"action:bill.refresh") |
| | | { |
| | | return OnRetrieve(); |
| | | } |
| | | if (comdid == L"action:bill.xmSaveAs") |
| | | { |
| | | xstring userno = publiccode::GetUser().no; |
| | | if (userno == L"00701" || userno == L"00601" || userno == L"admin") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | } |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.Annex") |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | arg.AddArg(L"ApplyStatus", dw_list.GetItemString(dw_list.GetRow(), L"ApplyStatus")); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.Document.Supplier.v3.vx]", (LPARAM)&arg); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.AnnexEx") |
| | | { |
| | | xaserverarg& arg4 = *new xaserverarg; |
| | | arg4.setNativePointer(arg4.CreateInstance()); |
| | | arg4.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | //arg4.AddArg(L"ApplyStatus",dw_list.GetItemString(dw_list.GetRow(),L"ApplyStatus")); |
| | | |
| | | //OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", p4); |
| | | OpenWindow(L"dev:xpage[maint.Document.SupplierSD.v3.vx]", (LPARAM)&arg4); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.checked") |
| | | return OnChecked(); |
| | | // if(comdid==L"action:bill.import") return OnImport(); |
| | | // if(comdid.find(L"action:",0)>=0) return ProcessFlowAction(comdid,1); |
| | | //if(comdid==L"search") return GridSearch(L"view.dlg.vface/xpage/grid/column/edit"); |
| | | //if(comdid==L"showall") return ShowAll(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int PostOnAttachEvent() |
| | | { |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listSupplierv3::OnTreeSelChanged); |
| | | AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listSupplierv3::OnSelectDdlb); |
| | | AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listSupplierv3::OnChangePages); |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&listSupplierv3::OnRClick);//鼠标右键 |
| | | //AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listSupplierv3::OnDoubleClicked); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | PIndex = 1; |
| | | listwin::m_QueryTxt = L""; //查询条件 |
| | | m_sType = L""; //type |
| | | m_sTypeTxt = L""; //选中树的data |
| | | |
| | | listwin::onload(); |
| | | |
| | | tv_1 = GetControl(L"tv_1"); |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | |
| | | changeddlb = 0; |
| | | OnCreateTree(L"GoodsCates"); |
| | | dw_list.SetColumnState(L"SupplierID", false); |
| | | dw_list.SetColumnState(L"userNo", false); |
| | | dw_list.SetColumnState(L"YearEstablished", false); |
| | | dw_list.SetColumnState(L"LegalPerson", false); |
| | | dw_list.SetColumnState(L"ThirdPartyReport", false); |
| | | dw_list.SetColumnState(L"bAddress", false); |
| | | dw_list.SetColumnState(L"PayType", false); |
| | | dw_list.SetColumnState(L"PicPath", false); |
| | | dw_list.SetColumnState(L"SDID", false); |
| | | dw_list.SetColumnState(L"AdvantageProduct", false); |
| | | //dw_list.SetColumnState(L"ApplyStatus",false); |
| | | |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(GetServerUrl(), L"/sale/view/SupplierV3/template/supplier/supplieritem"); |
| | | |
| | | if (publiccode::GetUser().name != L"admin") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | |
| | | xml supplier_x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); |
| | | if (supplier_x) |
| | | { |
| | | TypeWork = supplier_x.text(); |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | for (int k = 0; k < indexs.length(); k++) |
| | | { |
| | | |
| | | dw_list.SetColumnState(L"DateEx", false); |
| | | dw_list.SetColumnState(L"DateExS", false); |
| | | dw_list.SetColumnState(L"Name", false); |
| | | dw_list.SetColumnState(L"ProvinceCode", false); |
| | | dw_list.SetColumnState(L"City", false); |
| | | dw_list.SetColumnState(L"District", false); |
| | | dw_list.SetColumnState(L"Address", false); |
| | | dw_list.SetColumnState(L"CName", false); |
| | | dw_list.SetColumnState(L"TEL", false); |
| | | dw_list.SetColumnState(L"Mob", false); |
| | | dw_list.SetColumnState(L"AreaCode", false); |
| | | dw_list.SetColumnState(L"Fax", false); |
| | | dw_goods.SetColumnState(L"Price", false); |
| | | dw_goods.SetColumnState(L"PackRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PartRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PaperRMBPrice", false); |
| | | dw_goods.SetColumnState(L"ETD", false); |
| | | dw_goods.SetColumnState(L"InvoiceNo", false); |
| | | |
| | | val = dw_exchangefile.GetItemString(row, indexs.item(k)); |
| | | if (columns.item(k) == L"ExchRate") |
| | | { |
| | | double d = val.toDouble(); |
| | | if (d > 100.0) d = d / 100.0; |
| | | dw_exch.SetItemDouble(curRow, L"ExchRate", d); |
| | | } |
| | | else if (columns.item(k) == L"CurrencyCode") |
| | | { |
| | | if (val == L"美元") val = L"USD"; |
| | | } |
| | | else if (columns.item(k) == L"CustomerID") |
| | | { |
| | | if (xdoc) |
| | | { |
| | | KXMLDOMNode n1 = xdoc.selectSingleNode(L"/data/Item[contains(\"" + val + L"\",RawColumn)]"); |
| | | if (n1) |
| | | { |
| | | //alert(n1.xml); |
| | | if (n1.selectSingleNode(L"DataColumn"))dw_exch.SetItemString(curRow, columns.item(k), n1.selectSingleNode(L"DataColumn").text()); |
| | | if (n1.selectSingleNode(L"DataColumn/@_displaystring"))dw_exch.SetItemDisplayString(curRow, columns.item(k), n1.selectSingleNode(L"DataColumn/@_displaystring").text()); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | dw_exch.SetItemString(curRow, columns.item(k), val); |
| | | } |
| | | } |
| | | xutil::RestoreCursor(hCursor); |
| | | alert(L"转换完成!"); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int OnSaveData() |
| | | { |
| | | xstring exchRate = dw_arg.GetItemString(1, L"ExchRate"); |
| | | xstring Bank = dw_arg.GetItemString(1, L"Bank"); |
| | | if (Bank == L"") |
| | | { |
| | | alert(L"请输入结汇银行!"); |
| | | return 1; |
| | | } |
| | | if (exchRate == L"") |
| | | { |
| | | alert(L"请输入汇率!"); |
| | | return 1; |
| | | } |
| | | for (int row = 1; row <= dw_exch.GetRowCount(); row++) |
| | | { |
| | | if (dw_exch.GetItemString(row, L"ExchRate") == L"") |
| | | { |
| | | dw_exch.SetItemString(row, L"ExchRate", exchRate); |
| | | } |
| | | /*else |
| | | { |
| | | |
| | | int onloaded() |
| | | { |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&listSupplierv3::OnRowChangedEx); |
| | | }*/ |
| | | if (dw_exch.GetItemString(row, L"Bank") == L"") |
| | | { |
| | | dw_exch.SetItemString(row, L"Bank", Bank); |
| | | dw_exch.SetItemDisplayString(row, L"Bank", dw_arg.GetItemDisplayString(1, L"Bank")); |
| | | } |
| | | } |
| | | dw_exch.Redraw(); |
| | | |
| | | listwin::onloaded(); |
| | | xstring EntityID; |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = listwin::m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text(); |
| | | if (ele.selectSingleNode(id)) |
| | | EntityID = ele.selectSingleNode(id).text(); |
| | | listwin::SetAgent(L"list", EntityID); |
| | | return 1; |
| | | } |
| | | xml x; |
| | | |
| | | dw_exch.AcceptText(); |
| | | dw_exch.DwUpdateAllToEx(x); |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | |
| | | }; |
| | | |
| | | |
| | | |
| | | //trace(x.xml()); |
| | | if (xurl::get(L"/sale/data/AR/update", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_exch.ResetUpdateStatus(); |
| | | alert(L"保存成功!"); |
| | | } |
| | | else |
| | | { |
| | | alert(L"保存失败!"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave(bool saveas = false) |
| | | { |
| | | |
| | | xstring myurl = L"data/SettleExchange"; |
| | | xstring sfilename = filename; |
| | | if (filename == L"" || saveas) |
| | | { |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"src", L"data/SettleExchange"); |
| | | OpenWindow(L"dev:xpage[trade.document.saveas.vx]", cast(arg as int)); |
| | | if (arg.GetArgString(L"result") == L"ok") |
| | | { |
| | | sfilename = arg.GetArgString(L"filename"); |
| | | } |
| | | else |
| | | return 1; |
| | | } |
| | | |
| | | xstring content = dw_exchangefile.GetData(); |
| | | |
| | | xstring sguid = publiccode::GetGuid(); |
| | | xstring sname = sguid; |
| | | xstring str = sname.mid(0, 2); |
| | | str = str.toUpper(); |
| | | xstring suri = L"attachment" + str; |
| | | int ret = xaserver::UploadData(suri, sguid + L".jpg", content); |
| | | if (ret < 0) |
| | | { |
| | | alert(L"上传文件出错!"); |
| | | return 0; |
| | | } |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg args ; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg(L"myurl", myurl); |
| | | args.AddArg(L"name", sfilename); |
| | | args.AddArg(L"filepath", sname); |
| | | args.AddArg(L"fileext", L"xdoc"); |
| | | args.AddArg(L"filesource", sfilename); |
| | | |
| | | |
| | | |
| | | if (xurl::get(L"/sale/data/TDocument3/attachment/add", args.GetString(), x) != 1) |
| | | { |
| | | alert(L"保存出错了!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | filename = sfilename; |
| | | SetWindowText(GetHWND(), L"结汇文件:" + filename); |
| | | alert(x.text()); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int SendCtrlCmd(xcontrol xc, xstring cmd) |
| | | { |
| | | SendMessage(xc.GetId(), 0x401, cmd, 0); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmFileOpen") |
| | | { |
| | | xaserverarg args ; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg(L"src", L"data/SettleExchange"); |
| | | args.AddArg(L"process", L"path"); |
| | | OpenWindow(L"dev:xpage[trade.document.selectdlg.vx]", cast(args as int)); |
| | | if (args.GetArgString(L"result") == L"ok") |
| | | { |
| | | xstring u = args.GetArgString(L"src"); |
| | | xml x; |
| | | |
| | | xaserver::LoadUrl(GetServerUrl(), u, L"", x); |
| | | dw_exchangefile.LoadTemplateEx(x.documentElement()); |
| | | dw_exchangefile.Redraw(); |
| | | filename = args.GetArgString(L"filename"); |
| | | SetWindowText(GetHWND(), L"结汇文件:" + filename); |
| | | } |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmFileNew") |
| | | { |
| | | dw_exchangefile.openUrl(L"/sale/view/AR/template/file"); |
| | | dw_exchangefile.Redraw(); |
| | | filename = L""; |
| | | SetWindowText(GetHWND(), L"结汇文件:[new]"); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmFileSave") |
| | | { |
| | | return OnSave(); |
| | | } |
| | | if (comdid == L"xmAddRow") |
| | | { |
| | | return OnInsertRow(); |
| | | } |
| | | else if (comdid == L"xmDeleteRow") |
| | | { |
| | | return OnDeleteRow(); |
| | | } |
| | | else if (comdid == L"xmSave") |
| | | { |
| | | return OnSaveData(); |
| | | } |
| | | else if (comdid == L"xmFileSaveAs") |
| | | { |
| | | return OnSave(/*saveas*/true); |
| | | } |
| | | else if (comdid.left(3) == L"IK_") |
| | | { |
| | | xstring cmd = comdid.mid(3, comdid.length()); |
| | | SendCtrlCmd(GetControl(L"dw_raw"), cmd); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmTrans") |
| | | { |
| | | OpenWindow(L"dev:xpage[ExchangeColumnTran.vx]"); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmClient") |
| | | { |
| | | OpenWindow(L"dev:xpage[CustomerTran.AR.vx]"); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmBank") |
| | | { |
| | | OpenWindow(L"dev:xpage[ExchangeBankTran.vx]"); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmTran") |
| | | { |
| | | return OnTran(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&ExchangeFileView::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&ExchangeFileView::OnSetFocus); |
| | | AttachEvent(L"dw_exchangefile", L"CELL_ITEMCHANGED", (FEvent)&ExchangeFileView::OnCellItemChanged); |
| | | AttachEvent(L"dw_exchangefile", L"DWV_CLICKED", (FEvent)&ExchangeFileView::OnCellClicked); |
| | | } |
| | | |
| | | |
| | | |
| | | int onload() |
| | | { |
| | | dw_arg = GetControl(L"dw_arg"); |
| | | dw_arg.openUrl(L"/sale/view/AR/template/import/arg"); |
| | | dw_arg.SetColHeaderHeight(0); |
| | | dw_arg.SetRowSelectorWidth(0); |
| | | dw_arg.SetHScrollState(false); |
| | | dw_arg.SetVScrollState(false); |
| | | |
| | | dw_exchangefile = GetControl(L"dw_raw"); |
| | | dw_exch = GetControl(L"dw_exch"); |
| | | dw_exch.openUrl(L"/sale/view/AR/template/listex"); |
| | | OnAttachEvent(); |
| | | |
| | | |
| | | filename = L""; |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | SetWindowText(GetHWND(), L"结汇文件:[new]"); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) listSupplierv3 : public listwin |
| | | { |
| | | public: |
| | | xdwgrid dw_goods; |
| | | xtreeview tv_1; |
| | | xcombobox ddlb_1; |
| | | int changeddlb; |
| | | xstring TypeWork; |
| | | xstring GoodsUrl; |
| | | xstring m_sType; //type |
| | | xstring m_sTypeTxt; //选中树的data |
| | | // xstring m_searchtxt; |
| | | int PIndex; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | |
| | | public: |
| | | listSupplierv3(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static listSupplierv3* CreateInstance(void* implPtr, void* hWnd) |
| | | class __declspec(dllexport) ExchangeInputView : public xframe |
| | | { |
| | | listSupplierv3* pWin = new listSupplierv3(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | public: |
| | | xdwgrid dw_list; |
| | | xdwgrid dw_signed; |
| | | xdwgrid dw_unexch; |
| | | xdwgrid dw_exch; |
| | | xdwgrid dw_adjust; |
| | | xdwtable dw_arg; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring tabname; |
| | | xstring tabagent; |
| | | int hSignWin; |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"pageindex", xstring(PIndex)); //第几页 |
| | | arg.AddArg(L"pagenumber", xstring(listwin::m_pageNumber)); //每页数量 |
| | | arg.AddArg(L"QueryTxt", listwin::m_QueryTxt); |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | //alert(L"xxxx"); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | ///sale/data/AR/list |
| | | public: |
| | | ExchangeInputView(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static ExchangeInputView* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | return -1; |
| | | ExchangeInputView* pWin = new ExchangeInputView(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | else |
| | | int SetAgent() |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (tabagent == tabname && m_agentNode) |
| | | { |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int SetEntityData(xaserverarg arg) |
| | | { |
| | | xstring strQueryTxt = arg.GetArgString(L"QueryTxt"); |
| | | xml x; |
| | | |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text()); |
| | | |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | else |
| | | { |
| | | |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | //trace(x.GetXml()); |
| | | listwin::dw_list.Retrieve(x); |
| | | listwin::dw_list.Redraw(); |
| | | listwin::dw_list.SetReadOnly(true); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h->cur; |
| | | |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnRetrieve(); |
| | | PIndex = c; |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | |
| | | |
| | | } |
| | | |
| | | int ViewUpdate(int pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"refresh") |
| | | { |
| | | //trace(L"sd"); |
| | | xdwpages zz = GetControl(L"pages"); |
| | | int h = zz.SetCurPage(1); |
| | | //trace(h); |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //树选择 |
| | | int OnTreeSelChanged(TEvent evt, LPARAM p) |
| | | { |
| | | if (changeddlb != 1) |
| | | { |
| | | //alert(L"1"); |
| | | |
| | | HTREEITEM h = tv_1.GetSelectedItem(); |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)tv_1.GetItemData(h); |
| | | |
| | | xstring t = e.selectSingleNode(L"@type").text(); |
| | | m_sType = t + L""; |
| | | xstring txt = e.selectSingleNode(L"@code").text(); |
| | | if (txt == L"") |
| | | txt = e.selectSingleNode(L"@name").text(); |
| | | m_sTypeTxt = txt + L""; |
| | | |
| | | //alert(m_sTypeTxt); |
| | | |
| | | PIndex = 1; |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int createSubTree(HTREEITEM h, KXMLDOMElement ele) |
| | | { |
| | | KXMLDOMNodeList nlist = ele.selectNodes(L"item"); |
| | | int i; |
| | | int s = nlist.length(); |
| | | if (s > 0) |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(h, name, (LPARAM)e, 15); |
| | | createSubTree(hw, *e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(xstring sType) |
| | | { |
| | | |
| | | while (tv_1.GetRootItem()) |
| | | tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sType", sType); |
| | | //Tree.pref.supplier.xq |
| | | //getUrl(GetEntityName(1)+L"/entity/list",arg.GetString(),x); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[Tree.pref.supplier.xq]",arg.GetString(),x)!=1) |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/pref/list/tree", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"root/item"); |
| | | int len = nlist.length(); |
| | | if (len > 0) |
| | | { |
| | | int i; |
| | | for (i = 0; i < len; i++) |
| | | tabagent = tabname; |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[@id='" + tabname + L"']/*"); |
| | | if (agent) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(0, name, (LPARAM)e, 15); |
| | | |
| | | createSubTree(hw, *e); |
| | | tv_1.ExpandItem(hw); |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | tv_1.ExpandItem(0); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int OnSaveEx() |
| | | { |
| | | xml x; |
| | | |
| | | dw_adjust.AcceptText(); |
| | | dw_adjust.DwUpdateAllToEx(x); |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | |
| | | //xcombobox下拉 |
| | | int OnSelectDdlb(TEvent evt, LPARAM p) |
| | | { |
| | | changeddlb = 1; |
| | | //trace(x.xml()); |
| | | if (xurl::get(L"/sale/data/AR/update/item", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_adjust.ResetUpdateStatus(); |
| | | alert(L"保存成功!"); |
| | | } |
| | | else |
| | | { |
| | | alert(L"保存失败!"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = SendMessageW(ddlb_1.GetHWND(), CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring((nIndex + 1)) + L"]"); |
| | | xstring text = e2.selectSingleNode(L"@element").text(); |
| | | OnCreateTree(text); |
| | | changeddlb = 0; |
| | | return 1; |
| | | } |
| | | int OnSave() |
| | | { |
| | | xml x; |
| | | |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = listwin::dw_list.GetNextSelectRow(1); |
| | | if (row < 1) { |
| | | row = listwin::dw_list.GetRow(); |
| | | if (row < 1) { |
| | | //win::MessageBox(GetHWND(),L"请选中要删除的行!",L"提示",0); |
| | | //trace(x.xml()); |
| | | if (xurl::get(L"/sale/data/AR/update", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_list.ResetUpdateStatus(); |
| | | alert(L"保存成功!"); |
| | | } |
| | | else |
| | | { |
| | | alert(L"保存失败!"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //重置工具条 |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | dw_list.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | int row = dw_list.InsertRow(0); |
| | | xstring sdate = publiccode::GetCurrentDate(); |
| | | dw_list.SetItemString(row, L"CreateDate", sdate); |
| | | dw_list.SetItemString(row, L"SEDate", sdate); |
| | | dw_list.SetItemString(row, L"CurrencyCode", L"USD"); |
| | | xstring suserid = publiccode::GetUser().id; |
| | | xstring susername = publiccode::GetUser().name; |
| | | dw_list.SetItemString(row, L"CreatorID", suserid); |
| | | dw_list.SetItemDisplayString(row, L"CreatorID", susername); |
| | | |
| | | if (row > 1) |
| | | { |
| | | xstring exchrate = dw_list.GetItemString(row - 1, L"ExchRate"); |
| | | if (exchrate != L"") dw_list.SetItemString(row, L"ExchRate", exchrate); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnSign() |
| | | { |
| | | OpenWindow(L"dev:xpage[ExchangeSignFast.vx]", cast(dw_list as int)); |
| | | return 1; |
| | | } |
| | | |
| | | int OnCustomerEx() |
| | | { |
| | | xml xc; |
| | | |
| | | if (getUrl(L"/sale/data/AR/tran/customer", L"", xc) != 1) |
| | | { |
| | | trace(xc.text()); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | KXMLDOMElement e = listwin::dw_list.GetRowElement(row); |
| | | //xstring sguid = e.SelectSingleNode(L"@guid").text; |
| | | //xstring sName = e.selectSingleNode(L"Name").text+L""; |
| | | xstring sguid = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"); |
| | | xstring sName = dw_list.GetItemString(dw_list.GetRow(), L"Name"); |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBoxW(GetHWND(), L"确认要删除供应商 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"EntityID", sguid); |
| | | // trace(sguid); |
| | | if (xurl::post(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/delete", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement msg = x.selectNodes(L"process").item(0); |
| | | xstring success = msg.selectSingleNode(L"@finished").text(); |
| | | if (success == L"0") |
| | | KXMLDOMDocument xdoc = xc; |
| | | if (xdoc) |
| | | { |
| | | alert(msg.selectSingleNode(L"@errInfo").text()); |
| | | } |
| | | else |
| | | { |
| | | MessageBoxW(GetHWND(), L"删除成功!", L"提示", 0); |
| | | listwin::dw_list.DeleteRow(row); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChangedEx(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | //if(row < 1 or row > dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = listwin::dw_list.GetRowElement(row); |
| | | xstring entity = ele.selectSingleNode(L"SupplierID").text(); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"EntityID", entity); |
| | | |
| | | |
| | | xstring no1 = publiccode::GetUser().no; |
| | | if (no1 != L"00201") |
| | | { |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritemEx"; |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | if (getUrl(GetServerUrl(), GoodsUrl, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | } |
| | | SetAgent(L"list", entity); |
| | | return 1; |
| | | } |
| | | |
| | | int GridSearch() |
| | | { |
| | | //alert(L"你好"); |
| | | #if 0 |
| | | |
| | | xstring m_config = L"view.Supplier.v3.config"; |
| | | xdwgrid dw = listwin::dw_list; |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = TFile::node(m_config, L"config", L"search"); |
| | | if (str != L"") { |
| | | arg.AddArg(L"sheet", str); |
| | | } |
| | | else |
| | | arg.AddArg(L"sheet", L"dev:sheet[Supplier.v3.tpl/list]"); |
| | | arg.AddArg(L"search", listwin::m_QueryTxt); |
| | | openUrl(L"view.dlg.vface/xpage/grid/column/search", &arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring txt = arg.GetArgString(L"search"); |
| | | if (txt != L"") { |
| | | listwin::m_QueryTxt = txt; |
| | | //trace(txt); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | #endif |
| | | return 0; |
| | | } |
| | | |
| | | int OnSelectAllRow() |
| | | { |
| | | int rows = listwin::dw_list.GetRowCount(); |
| | | if (rows < 1) return -1; |
| | | listwin::dw_list.SelectRow(1, rows, true); |
| | | listwin::dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnRClick(TEvent evt, LPARAM p) |
| | | { |
| | | return 1; |
| | | } |
| | | int OnLogOff() |
| | | { |
| | | return 1; |
| | | } |
| | | int OnChecked() |
| | | { |
| | | xstring partyno = dw_list.GetItemString(dw_list.GetRow(), L"PartyNo"); |
| | | if (partyno.find(L"N") < 0) |
| | | { |
| | | alert(L"已经是正式供应商"); |
| | | return 0; |
| | | } |
| | | xstring entityid = GetEntityID(dw_list.GetRow()); |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBoxW(GetHWND(), L"是否转成正式供应商?", L"提示", MB_OKCANCEL); |
| | | if (ret == IDOK) |
| | | { |
| | | xml x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/updateno", L"entityid", entityid); |
| | | |
| | | if (xstring(x.xml()).find(L"success") > 0) |
| | | { |
| | | alert(L"处理成功"); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | //alert(comdid); |
| | | |
| | | if (comdid.find(L"action:LogOff", 0) >= 0) return OnLogOff(); |
| | | if (comdid.find(L"action:bill.delete", 0) >= 0) |
| | | { |
| | | OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | if (comdid == L"action:search1") return GridSearch(); |
| | | if (comdid == L"action:bill.refresh") |
| | | { |
| | | return OnRetrieve(); |
| | | } |
| | | if (comdid == L"action:bill.xmSaveAs") |
| | | { |
| | | xstring userno = publiccode::GetUser().no; |
| | | if (userno == L"00701" || userno == L"00601" || userno == L"admin") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | } |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.Annex") |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | arg.AddArg(L"ApplyStatus", dw_list.GetItemString(dw_list.GetRow(), L"ApplyStatus")); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.Document.Supplier.v3.vx]", (LPARAM)&arg); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.AnnexEx") |
| | | { |
| | | xaserverarg& arg4 = *new xaserverarg; |
| | | arg4.setNativePointer(arg4.CreateInstance()); |
| | | arg4.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | //arg4.AddArg(L"ApplyStatus",dw_list.GetItemString(dw_list.GetRow(),L"ApplyStatus")); |
| | | |
| | | //OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", p4); |
| | | OpenWindow(L"dev:xpage[maint.Document.SupplierSD.v3.vx]", (LPARAM)&arg4); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.checked") |
| | | return OnChecked(); |
| | | // if(comdid==L"action:bill.import") return OnImport(); |
| | | // if(comdid.find(L"action:",0)>=0) return ProcessFlowAction(comdid,1); |
| | | //if(comdid==L"search") return GridSearch(L"view.dlg.vface/xpage/grid/column/edit"); |
| | | //if(comdid==L"showall") return ShowAll(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int PostOnAttachEvent() |
| | | { |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listSupplierv3::OnTreeSelChanged); |
| | | AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listSupplierv3::OnSelectDdlb); |
| | | AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listSupplierv3::OnChangePages); |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&listSupplierv3::OnRClick);//鼠标右键 |
| | | //AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listSupplierv3::OnDoubleClicked); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | PIndex = 1; |
| | | listwin::m_QueryTxt = L""; //查询条件 |
| | | m_sType = L""; //type |
| | | m_sTypeTxt = L""; //选中树的data |
| | | |
| | | listwin::onload(); |
| | | |
| | | tv_1 = GetControl(L"tv_1"); |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | |
| | | changeddlb = 0; |
| | | OnCreateTree(L"GoodsCates"); |
| | | dw_list.SetColumnState(L"SupplierID", false); |
| | | dw_list.SetColumnState(L"userNo", false); |
| | | dw_list.SetColumnState(L"YearEstablished", false); |
| | | dw_list.SetColumnState(L"LegalPerson", false); |
| | | dw_list.SetColumnState(L"ThirdPartyReport", false); |
| | | dw_list.SetColumnState(L"bAddress", false); |
| | | dw_list.SetColumnState(L"PayType", false); |
| | | dw_list.SetColumnState(L"PicPath", false); |
| | | dw_list.SetColumnState(L"SDID", false); |
| | | dw_list.SetColumnState(L"AdvantageProduct", false); |
| | | //dw_list.SetColumnState(L"ApplyStatus",false); |
| | | |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(GetServerUrl(), L"/sale/view/SupplierV3/template/supplier/supplieritem"); |
| | | |
| | | if (publiccode::GetUser().name != L"admin") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | |
| | | xml supplier_x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); |
| | | if (supplier_x) |
| | | { |
| | | TypeWork = supplier_x.text(); |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | for (int row = 1; row <= dw_list.GetRowCount(); ++row) |
| | | { |
| | | xstring val = dw_list.GetItemString(row, L"Customer"); |
| | | KXMLDOMNode n1 = xdoc.selectSingleNode(L"/data/Item[contains(\"" + val + L"\",RawColumn)]"); |
| | | if (n1) |
| | | { |
| | | dw_list.SetItemString(row, L"CustomerID", n1.selectSingleNode(L"DataColumn").text()); |
| | | dw_list.SetItemDisplayString(row, L"CustomerID", n1.selectSingleNode(L"DataColumn/@_displaystring").text()); |
| | | } |
| | | } |
| | | } |
| | | dw_list.Redraw(); |
| | | OnSave(); |
| | | //alert(L"重对应完成!"); |
| | | return 1; |
| | | } |
| | | |
| | | dw_list.SetColumnState(L"DateEx", false); |
| | | dw_list.SetColumnState(L"DateExS", false); |
| | | dw_list.SetColumnState(L"Name", false); |
| | | dw_list.SetColumnState(L"ProvinceCode", false); |
| | | dw_list.SetColumnState(L"City", false); |
| | | dw_list.SetColumnState(L"District", false); |
| | | dw_list.SetColumnState(L"Address", false); |
| | | dw_list.SetColumnState(L"CName", false); |
| | | dw_list.SetColumnState(L"TEL", false); |
| | | dw_list.SetColumnState(L"Mob", false); |
| | | dw_list.SetColumnState(L"AreaCode", false); |
| | | dw_list.SetColumnState(L"Fax", false); |
| | | dw_goods.SetColumnState(L"Price", false); |
| | | dw_goods.SetColumnState(L"PackRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PartRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PaperRMBPrice", false); |
| | | dw_goods.SetColumnState(L"ETD", false); |
| | | dw_goods.SetColumnState(L"InvoiceNo", false); |
| | | int OnImprt() |
| | | { |
| | | xaserverarg args ; |
| | | |
| | | args.AddArg(L"src", L"data/SettleExchange"); |
| | | args.AddArg(L"process", L"data"); |
| | | OpenWindow(L"dev:xpage[trade.document.selectdlg.vx]",args); |
| | | return 1; |
| | | } |
| | | |
| | | int RetrieveData() |
| | | { |
| | | if (tabname == L"sign") return OnRetrieve(L"/sale/data/AR/list", dw_list); |
| | | if (tabname == L"signed") return OnRetrieve(L"/sale/data/AR/listFinish", dw_signed); |
| | | if (tabname == L"exch") return OnRetrieve(L"/sale/data/AR/gdn/exch/list", dw_exch); |
| | | if (tabname == L"unexch") return OnRetrieve(L"/sale/data/AR/gdn/noexch/list", dw_unexch); |
| | | if (tabname == L"adjust") return OnRetrieve(L"/sale/data/AR/Adjust", dw_adjust); |
| | | return 1; |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmAddRow") |
| | | { |
| | | return OnInsertRow(); |
| | | } |
| | | else if (comdid == L"xmImportRow") |
| | | { |
| | | return OnImprt(); |
| | | } |
| | | else if (comdid == L"xmCustomerEx") |
| | | { |
| | | return OnCustomerEx(); |
| | | } |
| | | else if (comdid == L"xmDeleteRow") |
| | | { |
| | | return OnDeleteRow(); |
| | | } |
| | | else if (comdid == L"xmDelete") |
| | | { |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBox(GetHWND(), L"确认是否删除?", L"提示", MB_OKCANCEL); |
| | | if (ret == IDOK) |
| | | { |
| | | ViewObject::RetrieveData(L"/sale/data/expense3/delete/SettlementExchange", L"EntityID", dw_list.GetGuid(dw_list.GetRow())); |
| | | OnRetrieve(L"/sale/data/AR/list", dw_list); |
| | | } |
| | | } |
| | | else if (comdid == L"xmDeleteRowEx") |
| | | { |
| | | /*int len = dw_adjust.GetRowCount(); |
| | | for(int i = 0; i< len ; i++) |
| | | { |
| | | dw_adjust.DeleteRow(0); |
| | | } |
| | | alert(L"end");*/ |
| | | dw_adjust.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmAddRowEx") |
| | | { |
| | | /*int row = dw_signed.GetRowCount(); |
| | | for(int i = 1;i < dw_signed.GetRowCount();i++) |
| | | { |
| | | double BalanceAmt=dw_signed.GetItemDouble(i,L"BalanceAmt"); |
| | | double DraftAmount=dw_signed.GetItemDouble(i,L"DraftAmount"); |
| | | xstring Remark = dw_signed.GetItemString(i,L"Remark"); |
| | | if(BalanceAmt != 0.00) |
| | | { |
| | | int row1 = dw_adjust.InsertRow(0); |
| | | xstring InvoiceNo = dw_signed.GetItemString(i,L"InvoiceNo"); |
| | | dw_adjust.SetItemString(row1,L"InvoiceNo",InvoiceNo); |
| | | dw_adjust.SetItemDouble(row1,L"Amount",BalanceAmt); |
| | | dw_adjust.SetItemDouble(row1,L"应结汇美元金额",DraftAmount); |
| | | dw_adjust.SetItemDouble(row1,L"应收汇金额",DraftAmount); |
| | | dw_adjust.SetItemString(row1,L"Note",Remark); |
| | | } |
| | | } |
| | | alert(L"end");*/ |
| | | dw_adjust.InsertRow(1); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmClient") |
| | | { |
| | | OpenWindow(L"dev:xpage[CustomerTran.AR.vx]"); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmExchangeFile") |
| | | { |
| | | //if(iswindow(hSignWin) & 0x1) return 1; |
| | | xwin xw = OpenWindow(L"dev:xpage[ExchageFile.vx]", 0); |
| | | hSignWin = xw.GetHWND(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmRefresh") |
| | | { |
| | | |
| | | return RetrieveData(); |
| | | } |
| | | else if (comdid == L"xmSave") |
| | | { |
| | | return OnSave(); |
| | | } |
| | | else if (comdid == L"xmSaveEx") |
| | | { |
| | | return OnSaveEx(); |
| | | } |
| | | else if (comdid == L"xmSign") |
| | | { |
| | | return OnSign(); |
| | | } |
| | | else if (comdid.find(L"xmSignEx") >= 0) |
| | | { |
| | | xstring id = comdid.mid(comdid.find(L":") + 1, 9999); |
| | | trace(L"----\r\n" + id); |
| | | int frow = 0; |
| | | for (frow = 1; frow <= dw_list.GetRowCount(); frow++) |
| | | { |
| | | if (frow == 1) |
| | | trace(L"----\r\n" + dw_list.GetGuid(frow)); |
| | | if (id == dw_list.GetGuid(frow)) break; |
| | | } |
| | | if (frow > dw_list.GetRowCount()) return 1; |
| | | dw_list.SetRow(frow); |
| | | OpenWindow(L"dev:xpage[ExchangeSignFast.vx]", cast(dw_list as int)); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmAdd") |
| | | { |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"HWND", GetHWND()); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.SettlementExchange.vx]", arg); |
| | | } |
| | | else if (comdid == L"xmEdit") |
| | | { |
| | | xaserverarg arg1 ; |
| | | |
| | | arg1.AddArg(L"HWND", GetHWND().toString()); |
| | | arg1.AddArg(L"SettlementExchangeID", dw_list.GetGuid(dw_list.GetRow())); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.SettlementExchange.vx]", arg1); |
| | | } |
| | | else if (comdid == L"Deduction") |
| | | { |
| | | int row = dw_adjust.GetRow(); |
| | | if (row < 1) |
| | | return 1; |
| | | xstring InvoiceNoExs = dw_adjust.GetItemString(row, L"InvoiceNo"); |
| | | if (InvoiceNoExs != L"") |
| | | { |
| | | xaserverarg argEx ; |
| | | |
| | | argEx.AddArg(L"EntityID", dw_adjust.GetGuid(row)); |
| | | argEx.AddArg(L"InvoiceNo", InvoiceNoExs); |
| | | trace(dw_adjust.GetGuid(row) + InvoiceNoExs); |
| | | OpenWindow(L"dev:xpage[Deduction.vx]", argEx); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | alert(L"外运编号为空,无法分配!"); |
| | | return 1; |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&listSupplierv3::OnRowChangedEx); |
| | | int OnCombboChanged(ref TCommandEvent evt, int lParam) |
| | | { |
| | | xstring id = L""; |
| | | xstring name = L""; |
| | | int h = xcombobox::GetCurSel(evt.hCtrl); |
| | | if (h > -1) |
| | | { |
| | | tabname = xcombobox::GetItemData(evt.hCtrl, h); |
| | | SwitchLayer(L"sheet" + (h + 1).toString(), L"frame"); |
| | | RetrieveData(); |
| | | SetAgent(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | listwin::onloaded(); |
| | | xstring EntityID; |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = listwin::m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text(); |
| | | if (ele.selectSingleNode(id)) |
| | | EntityID = ele.selectSingleNode(id).text(); |
| | | listwin::SetAgent(L"list", EntityID); |
| | | return 1; |
| | | } |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | }; |
| | | int OnBaseItemChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring colname = hdr.colname; |
| | | xstring value = hdr.data; |
| | | |
| | | xstring dwname = L"dw_adjust"; |
| | | if (value != L"") |
| | | { |
| | | KXMLDOMNodeList nlist = GetElement().selectNodes(L"//*[@name='" + dwname + L"']/trans[@for='" + colname + L"']"); |
| | | ViewObject::TransData(nlist, dw_adjust, hdr.row, colname, value); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnDoubleClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | return OnCmdDispatch(L"xmEdit"); |
| | | } |
| | | |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&ExchangeInputView::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&ExchangeInputView::OnSetFocus); |
| | | AttachEvent(L"cbx_type", L"CBN_SELCHANGE", (FEvent)&ExchangeInputView::OnCombboChanged);//属性组切换list中列的数量变化 |
| | | AttachEvent(L"dw_adjust", L"DWV_ITEMCHANGED", (FEvent)&ExchangeInputView::OnBaseItemChanged); |
| | | AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&ExchangeInputView::OnDoubleClicked);//行双击 |
| | | |
| | | } |
| | | |
| | | xstring GetQueryArg() |
| | | { |
| | | dw_arg.AcceptText(); |
| | | xml x; |
| | | |
| | | dw_arg.DwUpdateAllTo(x); |
| | | trace(x.text()); |
| | | return x.xml(); |
| | | } |
| | | |
| | | int OnRetrieve(xstring dataUrl, xdwgrid dw_obj) |
| | | { |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"QueryTxt", GetControl(L"sle_search").GetText()); |
| | | arg.AddArg(L"QueryArg", GetQueryArg()); |
| | | //trace(L"QueryArg======L"+GetQueryArg()); |
| | | if (getUrl(dataUrl, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | xutil::RestoreCursor(hCursor); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | //trace(x.xml()); |
| | | dw_obj.Retrieve(x); |
| | | dw_obj.Redraw(); |
| | | } |
| | | //dw_obj.SetReadOnly(false); |
| | | dw_obj.SetSelectionMode(1); |
| | | xutil::RestoreCursor(hCursor); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/AR/template/list"); |
| | | |
| | | |
| | | dw_signed = GetControl(L"dw_signed"); |
| | | dw_signed.openUrl(L"/sale/view/AR/template/listFinish"); |
| | | dw_exch = GetControl(L"dw_exch"); |
| | | dw_exch.openUrl(L"/sale/view/AR/template/unexch"); |
| | | dw_unexch = GetControl(L"dw_unexch"); |
| | | dw_unexch.openUrl(L"/sale/view/AR/template/unexch"); |
| | | dw_adjust = GetControl(L"dw_adjust"); |
| | | dw_adjust.openUrl(L"/sale/view/AR/template/adjust"); |
| | | |
| | | dw_unexch.SetColumnState(L"SEItemID", false); |
| | | dw_unexch.SetColumnState(L"SEID", false); |
| | | dw_exch.SetColumnState(L"SEItemID", false); |
| | | dw_exch.SetColumnState(L"SEID", false); |
| | | dw_exch.SetColumnState(L"BankDeduction", false); |
| | | dw_exch.SetColumnState(L"实收汇金额", false); |
| | | |
| | | dw_arg = GetControl(L"dw_arg"); |
| | | dw_arg.openUrl(L"/sale/view/AR/template/queryarg"); |
| | | dw_arg.SetColHeaderHeight(0); |
| | | dw_arg.SetRowSelectorWidth(0); |
| | | dw_arg.SetHScrollState(false); |
| | | dw_arg.SetVScrollState(false); |
| | | |
| | | tabname = L"sign"; |
| | | tabagent = L""; |
| | | |
| | | OnAttachEvent(); |
| | | hSignWin = 0; |
| | | RetrieveData(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) listSupplierv3 : public listwin |
| | | { |
| | | public: |
| | | xdwgrid dw_goods; |
| | | xtreeview tv_1; |
| | | xcombobox ddlb_1; |
| | | int changeddlb; |
| | | xstring TypeWork; |
| | | xstring GoodsUrl; |
| | | xstring m_sType; //type |
| | | xstring m_sTypeTxt; //选中树的data |
| | | // xstring m_searchtxt; |
| | | int PIndex; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | |
| | | public: |
| | | listSupplierv3(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static listSupplierv3* CreateInstance(void* implPtr, void* hWnd) |
| | | class __declspec(dllexport) ExchangeBankTranView : public xframe |
| | | { |
| | | listSupplierv3* pWin = new listSupplierv3(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | public: |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"pageindex", xstring(PIndex)); //第几页 |
| | | arg.AddArg(L"pagenumber", xstring(listwin::m_pageNumber)); //每页数量 |
| | | arg.AddArg(L"QueryTxt", listwin::m_QueryTxt); |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | //alert(L"xxxx"); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | public: |
| | | ExchangeBankTranView(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static ExchangeBankTranView* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | return -1; |
| | | ExchangeBankTranView* pWin = new ExchangeBankTranView(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | else |
| | | int SetAgent() |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int SetEntityData(xaserverarg arg) |
| | | { |
| | | xstring strQueryTxt = arg.GetArgString(L"QueryTxt"); |
| | | xml x; |
| | | |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text()); |
| | | |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | else |
| | | { |
| | | |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | //trace(x.GetXml()); |
| | | listwin::dw_list.Retrieve(x); |
| | | listwin::dw_list.Redraw(); |
| | | listwin::dw_list.SetReadOnly(true); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h->cur; |
| | | |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnRetrieve(); |
| | | PIndex = c; |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | |
| | | |
| | | } |
| | | |
| | | int ViewUpdate(int pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"refresh") |
| | | { |
| | | //trace(L"sd"); |
| | | xdwpages zz = GetControl(L"pages"); |
| | | int h = zz.SetCurPage(1); |
| | | //trace(h); |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //树选择 |
| | | int OnTreeSelChanged(TEvent evt, LPARAM p) |
| | | { |
| | | if (changeddlb != 1) |
| | | { |
| | | //alert(L"1"); |
| | | |
| | | HTREEITEM h = tv_1.GetSelectedItem(); |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)tv_1.GetItemData(h); |
| | | |
| | | xstring t = e.selectSingleNode(L"@type").text(); |
| | | m_sType = t + L""; |
| | | xstring txt = e.selectSingleNode(L"@code").text(); |
| | | if (txt == L"") |
| | | txt = e.selectSingleNode(L"@name").text(); |
| | | m_sTypeTxt = txt + L""; |
| | | |
| | | //alert(m_sTypeTxt); |
| | | |
| | | PIndex = 1; |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int createSubTree(HTREEITEM h, KXMLDOMElement ele) |
| | | { |
| | | KXMLDOMNodeList nlist = ele.selectNodes(L"item"); |
| | | int i; |
| | | int s = nlist.length(); |
| | | if (s > 0) |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(h, name, (LPARAM)e, 15); |
| | | createSubTree(hw, *e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(xstring sType) |
| | | { |
| | | |
| | | while (tv_1.GetRootItem()) |
| | | tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sType", sType); |
| | | //Tree.pref.supplier.xq |
| | | //getUrl(GetEntityName(1)+L"/entity/list",arg.GetString(),x); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[Tree.pref.supplier.xq]",arg.GetString(),x)!=1) |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/pref/list/tree", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"root/item"); |
| | | int len = nlist.length(); |
| | | if (len > 0) |
| | | { |
| | | int i; |
| | | for (i = 0; i < len; i++) |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(0, name, (LPARAM)e, 15); |
| | | |
| | | createSubTree(hw, *e); |
| | | tv_1.ExpandItem(hw); |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | tv_1.ExpandItem(0); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //重置工具条 |
| | | //SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //xcombobox下拉 |
| | | int OnSelectDdlb(TEvent evt, LPARAM p) |
| | | { |
| | | changeddlb = 1; |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmAddRow") |
| | | { |
| | | dw_list.InsertRow(0); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmInsertRow") |
| | | { |
| | | dw_list.AcceptText(); |
| | | dw_list.InsertRow(dw_list.GetRow()); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmDeleteRow") |
| | | { |
| | | dw_list.DeleteRow(0); |
| | | } |
| | | else if (comdid == L"xmClose") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmSave") |
| | | { |
| | | return OnSave(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = SendMessageW(ddlb_1.GetHWND(), CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring((nIndex + 1)) + L"]"); |
| | | xstring text = e2.selectSingleNode(L"@element").text(); |
| | | OnCreateTree(text); |
| | | changeddlb = 0; |
| | | return 1; |
| | | } |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = listwin::dw_list.GetNextSelectRow(1); |
| | | if (row < 1) { |
| | | row = listwin::dw_list.GetRow(); |
| | | if (row < 1) { |
| | | //win::MessageBox(GetHWND(),L"请选中要删除的行!",L"提示",0); |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&ExchangeBankTranView::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&ExchangeBankTranView::OnSetFocus); |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | dw_list.AcceptText(); |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | arg.AddArg(L"content", x.xml()); |
| | | if (getUrl(L"/sale/data/AR/update/tran/bank", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | KXMLDOMElement e = listwin::dw_list.GetRowElement(row); |
| | | //xstring sguid = e.SelectSingleNode(L"@guid").text; |
| | | //xstring sName = e.selectSingleNode(L"Name").text+L""; |
| | | xstring sguid = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"); |
| | | xstring sName = dw_list.GetItemString(dw_list.GetRow(), L"Name"); |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBoxW(GetHWND(), L"确认要删除供应商 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"EntityID", sguid); |
| | | // trace(sguid); |
| | | if (xurl::post(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/delete", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement msg = x.selectNodes(L"process").item(0); |
| | | xstring success = msg.selectSingleNode(L"@finished").text(); |
| | | if (success == L"0") |
| | | { |
| | | alert(msg.selectSingleNode(L"@errInfo").text()); |
| | | } |
| | | else |
| | | { |
| | | MessageBoxW(GetHWND(), L"删除成功!", L"提示", 0); |
| | | listwin::dw_list.DeleteRow(row); |
| | | alert(x.text()); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChangedEx(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | //if(row < 1 or row > dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = listwin::dw_list.GetRowElement(row); |
| | | xstring entity = ele.selectSingleNode(L"SupplierID").text(); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"EntityID", entity); |
| | | |
| | | |
| | | xstring no1 = publiccode::GetUser().no; |
| | | if (no1 != L"00201") |
| | | { |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritemEx"; |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | if (getUrl(GetServerUrl(), GoodsUrl, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | } |
| | | SetAgent(L"list", entity); |
| | | return 1; |
| | | } |
| | | |
| | | int GridSearch() |
| | | { |
| | | //alert(L"你好"); |
| | | #if 0 |
| | | |
| | | xstring m_config = L"view.Supplier.v3.config"; |
| | | xdwgrid dw = listwin::dw_list; |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = TFile::node(m_config, L"config", L"search"); |
| | | if (str != L"") { |
| | | arg.AddArg(L"sheet", str); |
| | | } |
| | | else |
| | | arg.AddArg(L"sheet", L"dev:sheet[Supplier.v3.tpl/list]"); |
| | | arg.AddArg(L"search", listwin::m_QueryTxt); |
| | | openUrl(L"view.dlg.vface/xpage/grid/column/search", &arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring txt = arg.GetArgString(L"search"); |
| | | if (txt != L"") { |
| | | listwin::m_QueryTxt = txt; |
| | | //trace(txt); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | #endif |
| | | return 0; |
| | | } |
| | | |
| | | int OnSelectAllRow() |
| | | { |
| | | int rows = listwin::dw_list.GetRowCount(); |
| | | if (rows < 1) return -1; |
| | | listwin::dw_list.SelectRow(1, rows, true); |
| | | listwin::dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnRClick(TEvent evt, LPARAM p) |
| | | { |
| | | return 1; |
| | | } |
| | | int OnLogOff() |
| | | { |
| | | return 1; |
| | | } |
| | | int OnChecked() |
| | | { |
| | | xstring partyno = dw_list.GetItemString(dw_list.GetRow(), L"PartyNo"); |
| | | if (partyno.find(L"N") < 0) |
| | | { |
| | | alert(L"已经是正式供应商"); |
| | | return 0; |
| | | } |
| | | xstring entityid = GetEntityID(dw_list.GetRow()); |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBoxW(GetHWND(), L"是否转成正式供应商?", L"提示", MB_OKCANCEL); |
| | | if (ret == IDOK) |
| | | { |
| | | xml x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/updateno", L"entityid", entityid); |
| | | |
| | | if (xstring(x.xml()).find(L"success") > 0) |
| | | { |
| | | alert(L"处理成功"); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | //alert(comdid); |
| | | |
| | | if (comdid.find(L"action:LogOff", 0) >= 0) return OnLogOff(); |
| | | if (comdid.find(L"action:bill.delete", 0) >= 0) |
| | | { |
| | | OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | if (comdid == L"action:search1") return GridSearch(); |
| | | if (comdid == L"action:bill.refresh") |
| | | { |
| | | return OnRetrieve(); |
| | | } |
| | | if (comdid == L"action:bill.xmSaveAs") |
| | | { |
| | | xstring userno = publiccode::GetUser().no; |
| | | if (userno == L"00701" || userno == L"00601" || userno == L"admin") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | } |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.Annex") |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | arg.AddArg(L"ApplyStatus", dw_list.GetItemString(dw_list.GetRow(), L"ApplyStatus")); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.Document.Supplier.v3.vx]", (LPARAM)&arg); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.AnnexEx") |
| | | { |
| | | xaserverarg& arg4 = *new xaserverarg; |
| | | arg4.setNativePointer(arg4.CreateInstance()); |
| | | arg4.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | //arg4.AddArg(L"ApplyStatus",dw_list.GetItemString(dw_list.GetRow(),L"ApplyStatus")); |
| | | |
| | | //OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", p4); |
| | | OpenWindow(L"dev:xpage[maint.Document.SupplierSD.v3.vx]", (LPARAM)&arg4); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.checked") |
| | | return OnChecked(); |
| | | // if(comdid==L"action:bill.import") return OnImport(); |
| | | // if(comdid.find(L"action:",0)>=0) return ProcessFlowAction(comdid,1); |
| | | //if(comdid==L"search") return GridSearch(L"view.dlg.vface/xpage/grid/column/edit"); |
| | | //if(comdid==L"showall") return ShowAll(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int PostOnAttachEvent() |
| | | { |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listSupplierv3::OnTreeSelChanged); |
| | | AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listSupplierv3::OnSelectDdlb); |
| | | AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listSupplierv3::OnChangePages); |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&listSupplierv3::OnRClick);//鼠标右键 |
| | | //AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listSupplierv3::OnDoubleClicked); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | PIndex = 1; |
| | | listwin::m_QueryTxt = L""; //查询条件 |
| | | m_sType = L""; //type |
| | | m_sTypeTxt = L""; //选中树的data |
| | | |
| | | listwin::onload(); |
| | | |
| | | tv_1 = GetControl(L"tv_1"); |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | |
| | | changeddlb = 0; |
| | | OnCreateTree(L"GoodsCates"); |
| | | dw_list.SetColumnState(L"SupplierID", false); |
| | | dw_list.SetColumnState(L"userNo", false); |
| | | dw_list.SetColumnState(L"YearEstablished", false); |
| | | dw_list.SetColumnState(L"LegalPerson", false); |
| | | dw_list.SetColumnState(L"ThirdPartyReport", false); |
| | | dw_list.SetColumnState(L"bAddress", false); |
| | | dw_list.SetColumnState(L"PayType", false); |
| | | dw_list.SetColumnState(L"PicPath", false); |
| | | dw_list.SetColumnState(L"SDID", false); |
| | | dw_list.SetColumnState(L"AdvantageProduct", false); |
| | | //dw_list.SetColumnState(L"ApplyStatus",false); |
| | | |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(GetServerUrl(), L"/sale/view/SupplierV3/template/supplier/supplieritem"); |
| | | |
| | | if (publiccode::GetUser().name != L"admin") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | |
| | | xml supplier_x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); |
| | | if (supplier_x) |
| | | if (getUrl(L"/sale/data/AR/tran/bank", arg.GetString(), x) != 1) |
| | | { |
| | | TypeWork = supplier_x.text(); |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | |
| | | dw_list.SetColumnState(L"DateEx", false); |
| | | dw_list.SetColumnState(L"DateExS", false); |
| | | dw_list.SetColumnState(L"Name", false); |
| | | dw_list.SetColumnState(L"ProvinceCode", false); |
| | | dw_list.SetColumnState(L"City", false); |
| | | dw_list.SetColumnState(L"District", false); |
| | | dw_list.SetColumnState(L"Address", false); |
| | | dw_list.SetColumnState(L"CName", false); |
| | | dw_list.SetColumnState(L"TEL", false); |
| | | dw_list.SetColumnState(L"Mob", false); |
| | | dw_list.SetColumnState(L"AreaCode", false); |
| | | dw_list.SetColumnState(L"Fax", false); |
| | | dw_goods.SetColumnState(L"Price", false); |
| | | dw_goods.SetColumnState(L"PackRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PartRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PaperRMBPrice", false); |
| | | dw_goods.SetColumnState(L"ETD", false); |
| | | dw_goods.SetColumnState(L"InvoiceNo", false); |
| | | |
| | | } |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/AR/template/banktran"); |
| | | |
| | | int onloaded() |
| | | { |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&listSupplierv3::OnRowChangedEx); |
| | | OnAttachEvent(); |
| | | OnRetrieve(); |
| | | |
| | | listwin::onloaded(); |
| | | xstring EntityID; |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = listwin::m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text(); |
| | | if (ele.selectSingleNode(id)) |
| | | EntityID = ele.selectSingleNode(id).text(); |
| | | listwin::SetAgent(L"list", EntityID); |
| | | return 1; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | }; |
| | | int onloaded() |
| | | { |
| | | //SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) listSupplierv3 : public listwin |
| | | { |
| | | public: |
| | | xdwgrid dw_goods; |
| | | xtreeview tv_1; |
| | | xcombobox ddlb_1; |
| | | int changeddlb; |
| | | xstring TypeWork; |
| | | xstring GoodsUrl; |
| | | xstring m_sType; //type |
| | | xstring m_sTypeTxt; //选中树的data |
| | | // xstring m_searchtxt; |
| | | int PIndex; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | |
| | | public: |
| | | listSupplierv3(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static listSupplierv3* CreateInstance(void* implPtr, void* hWnd) |
| | | class __declspec(dllexport) ExchangeColumnTranView : public xframe |
| | | { |
| | | listSupplierv3* pWin = new listSupplierv3(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | public: |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"pageindex", xstring(PIndex)); //第几页 |
| | | arg.AddArg(L"pagenumber", xstring(listwin::m_pageNumber)); //每页数量 |
| | | arg.AddArg(L"QueryTxt", listwin::m_QueryTxt); |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | //alert(L"xxxx"); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | public: |
| | | ExchangeColumnTranView(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static ExchangeColumnTranView* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | return -1; |
| | | ExchangeColumnTranView* pWin = new ExchangeColumnTranView(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | else |
| | | int SetAgent() |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int SetEntityData(xaserverarg arg) |
| | | { |
| | | xstring strQueryTxt = arg.GetArgString(L"QueryTxt"); |
| | | xml x; |
| | | |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text()); |
| | | |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | else |
| | | { |
| | | |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | //trace(x.GetXml()); |
| | | listwin::dw_list.Retrieve(x); |
| | | listwin::dw_list.Redraw(); |
| | | listwin::dw_list.SetReadOnly(true); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h->cur; |
| | | |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnRetrieve(); |
| | | PIndex = c; |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | |
| | | |
| | | } |
| | | |
| | | int ViewUpdate(int pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"refresh") |
| | | { |
| | | //trace(L"sd"); |
| | | xdwpages zz = GetControl(L"pages"); |
| | | int h = zz.SetCurPage(1); |
| | | //trace(h); |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //树选择 |
| | | int OnTreeSelChanged(TEvent evt, LPARAM p) |
| | | { |
| | | if (changeddlb != 1) |
| | | { |
| | | //alert(L"1"); |
| | | |
| | | HTREEITEM h = tv_1.GetSelectedItem(); |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)tv_1.GetItemData(h); |
| | | |
| | | xstring t = e.selectSingleNode(L"@type").text(); |
| | | m_sType = t + L""; |
| | | xstring txt = e.selectSingleNode(L"@code").text(); |
| | | if (txt == L"") |
| | | txt = e.selectSingleNode(L"@name").text(); |
| | | m_sTypeTxt = txt + L""; |
| | | |
| | | //alert(m_sTypeTxt); |
| | | |
| | | PIndex = 1; |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int createSubTree(HTREEITEM h, KXMLDOMElement ele) |
| | | { |
| | | KXMLDOMNodeList nlist = ele.selectNodes(L"item"); |
| | | int i; |
| | | int s = nlist.length(); |
| | | if (s > 0) |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(h, name, (LPARAM)e, 15); |
| | | createSubTree(hw, *e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(xstring sType) |
| | | { |
| | | |
| | | while (tv_1.GetRootItem()) |
| | | tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sType", sType); |
| | | //Tree.pref.supplier.xq |
| | | //getUrl(GetEntityName(1)+L"/entity/list",arg.GetString(),x); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[Tree.pref.supplier.xq]",arg.GetString(),x)!=1) |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/pref/list/tree", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"root/item"); |
| | | int len = nlist.length(); |
| | | if (len > 0) |
| | | { |
| | | int i; |
| | | for (i = 0; i < len; i++) |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(0, name, (LPARAM)e, 15); |
| | | |
| | | createSubTree(hw, *e); |
| | | tv_1.ExpandItem(hw); |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | tv_1.ExpandItem(0); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //重置工具条 |
| | | //SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //xcombobox下拉 |
| | | int OnSelectDdlb(TEvent evt, LPARAM p) |
| | | { |
| | | changeddlb = 1; |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmAddRow") |
| | | { |
| | | dw_list.InsertRow(0); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmInsertRow") |
| | | { |
| | | dw_list.AcceptText(); |
| | | dw_list.InsertRow(dw_list.GetRow()); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmDeleteRow") |
| | | { |
| | | dw_list.DeleteRow(0); |
| | | } |
| | | else if (comdid == L"xmClose") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmSave") |
| | | { |
| | | return OnSave(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = SendMessageW(ddlb_1.GetHWND(), CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring((nIndex + 1)) + L"]"); |
| | | xstring text = e2.selectSingleNode(L"@element").text(); |
| | | OnCreateTree(text); |
| | | changeddlb = 0; |
| | | return 1; |
| | | } |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = listwin::dw_list.GetNextSelectRow(1); |
| | | if (row < 1) { |
| | | row = listwin::dw_list.GetRow(); |
| | | if (row < 1) { |
| | | //win::MessageBox(GetHWND(),L"请选中要删除的行!",L"提示",0); |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&ExchangeColumnTranView::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&ExchangeColumnTranView::OnSetFocus); |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | dw_list.AcceptText(); |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | dw_list.DwUpdateAllTo(x); |
| | | arg.AddArg(L"content", x.xml()); |
| | | if (getUrl(L"/sale/data/AR/update/tran/head", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | KXMLDOMElement e = listwin::dw_list.GetRowElement(row); |
| | | //xstring sguid = e.SelectSingleNode(L"@guid").text; |
| | | //xstring sName = e.selectSingleNode(L"Name").text+L""; |
| | | xstring sguid = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"); |
| | | xstring sName = dw_list.GetItemString(dw_list.GetRow(), L"Name"); |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBoxW(GetHWND(), L"确认要删除供应商 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"EntityID", sguid); |
| | | // trace(sguid); |
| | | if (xurl::post(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/delete", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement msg = x.selectNodes(L"process").item(0); |
| | | xstring success = msg.selectSingleNode(L"@finished").text(); |
| | | if (success == L"0") |
| | | { |
| | | alert(msg.selectSingleNode(L"@errInfo").text()); |
| | | } |
| | | else |
| | | { |
| | | MessageBoxW(GetHWND(), L"删除成功!", L"提示", 0); |
| | | listwin::dw_list.DeleteRow(row); |
| | | alert(x.text()); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChangedEx(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | //if(row < 1 or row > dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = listwin::dw_list.GetRowElement(row); |
| | | xstring entity = ele.selectSingleNode(L"SupplierID").text(); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"EntityID", entity); |
| | | |
| | | |
| | | xstring no1 = publiccode::GetUser().no; |
| | | if (no1 != L"00201") |
| | | { |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritemEx"; |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | if (getUrl(GetServerUrl(), GoodsUrl, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | } |
| | | SetAgent(L"list", entity); |
| | | return 1; |
| | | } |
| | | |
| | | int GridSearch() |
| | | { |
| | | //alert(L"你好"); |
| | | #if 0 |
| | | |
| | | xstring m_config = L"view.Supplier.v3.config"; |
| | | xdwgrid dw = listwin::dw_list; |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = TFile::node(m_config, L"config", L"search"); |
| | | if (str != L"") { |
| | | arg.AddArg(L"sheet", str); |
| | | } |
| | | else |
| | | arg.AddArg(L"sheet", L"dev:sheet[Supplier.v3.tpl/list]"); |
| | | arg.AddArg(L"search", listwin::m_QueryTxt); |
| | | openUrl(L"view.dlg.vface/xpage/grid/column/search", &arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring txt = arg.GetArgString(L"search"); |
| | | if (txt != L"") { |
| | | listwin::m_QueryTxt = txt; |
| | | //trace(txt); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | #endif |
| | | return 0; |
| | | } |
| | | |
| | | int OnSelectAllRow() |
| | | { |
| | | int rows = listwin::dw_list.GetRowCount(); |
| | | if (rows < 1) return -1; |
| | | listwin::dw_list.SelectRow(1, rows, true); |
| | | listwin::dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnRClick(TEvent evt, LPARAM p) |
| | | { |
| | | return 1; |
| | | } |
| | | int OnLogOff() |
| | | { |
| | | return 1; |
| | | } |
| | | int OnChecked() |
| | | { |
| | | xstring partyno = dw_list.GetItemString(dw_list.GetRow(), L"PartyNo"); |
| | | if (partyno.find(L"N") < 0) |
| | | { |
| | | alert(L"已经是正式供应商"); |
| | | return 0; |
| | | } |
| | | xstring entityid = GetEntityID(dw_list.GetRow()); |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBoxW(GetHWND(), L"是否转成正式供应商?", L"提示", MB_OKCANCEL); |
| | | if (ret == IDOK) |
| | | { |
| | | xml x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/updateno", L"entityid", entityid); |
| | | |
| | | if (xstring(x.xml()).find(L"success") > 0) |
| | | { |
| | | alert(L"处理成功"); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | //alert(comdid); |
| | | |
| | | if (comdid.find(L"action:LogOff", 0) >= 0) return OnLogOff(); |
| | | if (comdid.find(L"action:bill.delete", 0) >= 0) |
| | | { |
| | | OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | if (comdid == L"action:search1") return GridSearch(); |
| | | if (comdid == L"action:bill.refresh") |
| | | { |
| | | return OnRetrieve(); |
| | | } |
| | | if (comdid == L"action:bill.xmSaveAs") |
| | | { |
| | | xstring userno = publiccode::GetUser().no; |
| | | if (userno == L"00701" || userno == L"00601" || userno == L"admin") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | } |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.Annex") |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | arg.AddArg(L"ApplyStatus", dw_list.GetItemString(dw_list.GetRow(), L"ApplyStatus")); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.Document.Supplier.v3.vx]", (LPARAM)&arg); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.AnnexEx") |
| | | { |
| | | xaserverarg& arg4 = *new xaserverarg; |
| | | arg4.setNativePointer(arg4.CreateInstance()); |
| | | arg4.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | //arg4.AddArg(L"ApplyStatus",dw_list.GetItemString(dw_list.GetRow(),L"ApplyStatus")); |
| | | |
| | | //OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", p4); |
| | | OpenWindow(L"dev:xpage[maint.Document.SupplierSD.v3.vx]", (LPARAM)&arg4); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.checked") |
| | | return OnChecked(); |
| | | // if(comdid==L"action:bill.import") return OnImport(); |
| | | // if(comdid.find(L"action:",0)>=0) return ProcessFlowAction(comdid,1); |
| | | //if(comdid==L"search") return GridSearch(L"view.dlg.vface/xpage/grid/column/edit"); |
| | | //if(comdid==L"showall") return ShowAll(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int PostOnAttachEvent() |
| | | { |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listSupplierv3::OnTreeSelChanged); |
| | | AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listSupplierv3::OnSelectDdlb); |
| | | AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listSupplierv3::OnChangePages); |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&listSupplierv3::OnRClick);//鼠标右键 |
| | | //AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listSupplierv3::OnDoubleClicked); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | PIndex = 1; |
| | | listwin::m_QueryTxt = L""; //查询条件 |
| | | m_sType = L""; //type |
| | | m_sTypeTxt = L""; //选中树的data |
| | | |
| | | listwin::onload(); |
| | | |
| | | tv_1 = GetControl(L"tv_1"); |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | |
| | | changeddlb = 0; |
| | | OnCreateTree(L"GoodsCates"); |
| | | dw_list.SetColumnState(L"SupplierID", false); |
| | | dw_list.SetColumnState(L"userNo", false); |
| | | dw_list.SetColumnState(L"YearEstablished", false); |
| | | dw_list.SetColumnState(L"LegalPerson", false); |
| | | dw_list.SetColumnState(L"ThirdPartyReport", false); |
| | | dw_list.SetColumnState(L"bAddress", false); |
| | | dw_list.SetColumnState(L"PayType", false); |
| | | dw_list.SetColumnState(L"PicPath", false); |
| | | dw_list.SetColumnState(L"SDID", false); |
| | | dw_list.SetColumnState(L"AdvantageProduct", false); |
| | | //dw_list.SetColumnState(L"ApplyStatus",false); |
| | | |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(GetServerUrl(), L"/sale/view/SupplierV3/template/supplier/supplieritem"); |
| | | |
| | | if (publiccode::GetUser().name != L"admin") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | |
| | | xml supplier_x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); |
| | | if (supplier_x) |
| | | if (getUrl(L"/sale/data/AR/tran/head", arg.GetString(), x) != 1) |
| | | { |
| | | TypeWork = supplier_x.text(); |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | |
| | | dw_list.SetColumnState(L"DateEx", false); |
| | | dw_list.SetColumnState(L"DateExS", false); |
| | | dw_list.SetColumnState(L"Name", false); |
| | | dw_list.SetColumnState(L"ProvinceCode", false); |
| | | dw_list.SetColumnState(L"City", false); |
| | | dw_list.SetColumnState(L"District", false); |
| | | dw_list.SetColumnState(L"Address", false); |
| | | dw_list.SetColumnState(L"CName", false); |
| | | dw_list.SetColumnState(L"TEL", false); |
| | | dw_list.SetColumnState(L"Mob", false); |
| | | dw_list.SetColumnState(L"AreaCode", false); |
| | | dw_list.SetColumnState(L"Fax", false); |
| | | dw_goods.SetColumnState(L"Price", false); |
| | | dw_goods.SetColumnState(L"PackRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PartRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PaperRMBPrice", false); |
| | | dw_goods.SetColumnState(L"ETD", false); |
| | | dw_goods.SetColumnState(L"InvoiceNo", false); |
| | | |
| | | } |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/AR/template/headtran"); |
| | | |
| | | int onloaded() |
| | | { |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&listSupplierv3::OnRowChangedEx); |
| | | OnAttachEvent(); |
| | | OnRetrieve(); |
| | | |
| | | listwin::onloaded(); |
| | | xstring EntityID; |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = listwin::m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text(); |
| | | if (ele.selectSingleNode(id)) |
| | | EntityID = ele.selectSingleNode(id).text(); |
| | | listwin::SetAgent(L"list", EntityID); |
| | | return 1; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | }; |
| | | int onloaded() |
| | | { |
| | | //SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) listSupplierv3 : public listwin |
| | | { |
| | | public: |
| | | xdwgrid dw_goods; |
| | | xtreeview tv_1; |
| | | xcombobox ddlb_1; |
| | | int changeddlb; |
| | | xstring TypeWork; |
| | | xstring GoodsUrl; |
| | | xstring m_sType; //type |
| | | xstring m_sTypeTxt; //选中树的data |
| | | // xstring m_searchtxt; |
| | | int PIndex; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | |
| | | public: |
| | | listSupplierv3(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static listSupplierv3* CreateInstance(void* implPtr, void* hWnd) |
| | | class __declspec(dllexport) ExchangeSignFastWin : public xframe |
| | | { |
| | | listSupplierv3* pWin = new listSupplierv3(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | public: |
| | | xdwgrid dw_unexch; |
| | | xdwgrid dw_list; |
| | | xdwgrid dw_obj; |
| | | xdwtable dw_arg; |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"pageindex", xstring(PIndex)); //第几页 |
| | | arg.AddArg(L"pagenumber", xstring(listwin::m_pageNumber)); //每页数量 |
| | | arg.AddArg(L"QueryTxt", listwin::m_QueryTxt); |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | //alert(L"xxxx"); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | public: |
| | | ExchangeSignFastWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static ExchangeSignFastWin* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | return -1; |
| | | ExchangeSignFastWin* pWin = new ExchangeSignFastWin(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | else |
| | | int SetAgent() |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int SetEntityData(xaserverarg arg) |
| | | { |
| | | xstring strQueryTxt = arg.GetArgString(L"QueryTxt"); |
| | | xml x; |
| | | |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text()); |
| | | |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | else |
| | | { |
| | | |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | //trace(x.GetXml()); |
| | | listwin::dw_list.Retrieve(x); |
| | | listwin::dw_list.Redraw(); |
| | | listwin::dw_list.SetReadOnly(true); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h->cur; |
| | | |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnRetrieve(); |
| | | PIndex = c; |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | |
| | | |
| | | } |
| | | |
| | | int ViewUpdate(int pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"refresh") |
| | | { |
| | | //trace(L"sd"); |
| | | xdwpages zz = GetControl(L"pages"); |
| | | int h = zz.SetCurPage(1); |
| | | //trace(h); |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //树选择 |
| | | int OnTreeSelChanged(TEvent evt, LPARAM p) |
| | | { |
| | | if (changeddlb != 1) |
| | | { |
| | | //alert(L"1"); |
| | | |
| | | HTREEITEM h = tv_1.GetSelectedItem(); |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)tv_1.GetItemData(h); |
| | | |
| | | xstring t = e.selectSingleNode(L"@type").text(); |
| | | m_sType = t + L""; |
| | | xstring txt = e.selectSingleNode(L"@code").text(); |
| | | if (txt == L"") |
| | | txt = e.selectSingleNode(L"@name").text(); |
| | | m_sTypeTxt = txt + L""; |
| | | |
| | | //alert(m_sTypeTxt); |
| | | |
| | | PIndex = 1; |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int createSubTree(HTREEITEM h, KXMLDOMElement ele) |
| | | { |
| | | KXMLDOMNodeList nlist = ele.selectNodes(L"item"); |
| | | int i; |
| | | int s = nlist.length(); |
| | | if (s > 0) |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(h, name, (LPARAM)e, 15); |
| | | createSubTree(hw, *e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(xstring sType) |
| | | { |
| | | |
| | | while (tv_1.GetRootItem()) |
| | | tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sType", sType); |
| | | //Tree.pref.supplier.xq |
| | | //getUrl(GetEntityName(1)+L"/entity/list",arg.GetString(),x); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[Tree.pref.supplier.xq]",arg.GetString(),x)!=1) |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/pref/list/tree", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"root/item"); |
| | | int len = nlist.length(); |
| | | if (len > 0) |
| | | { |
| | | int i; |
| | | for (i = 0; i < len; i++) |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(0, name, (LPARAM)e, 15); |
| | | |
| | | createSubTree(hw, *e); |
| | | tv_1.ExpandItem(hw); |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | tv_1.ExpandItem(0); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //重置工具条 |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //xcombobox下拉 |
| | | int OnSelectDdlb(TEvent evt, LPARAM p) |
| | | { |
| | | changeddlb = 1; |
| | | bool IsNoEmptyValue(xstring val) |
| | | { |
| | | if (val != L"" && val != L".00" && val != L"0.00" && val != L"-0.00") return true; |
| | | return false; |
| | | } |
| | | |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = SendMessageW(ddlb_1.GetHWND(), CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring((nIndex + 1)) + L"]"); |
| | | xstring text = e2.selectSingleNode(L"@element").text(); |
| | | OnCreateTree(text); |
| | | changeddlb = 0; |
| | | return 1; |
| | | } |
| | | int OnSave() |
| | | { |
| | | for (int row = dw_list.GetRowCount(); row >= 1; row--) |
| | | { |
| | | if (dw_list.GetItemDouble(row, L"ExchAmt") != 0.0) continue; |
| | | if (dw_list.GetItemDouble(row, L"BankDeduction") != 0.0) continue; |
| | | if (dw_list.GetItemDouble(row, L"ForeignBankDeduction") != 0.0)continue; |
| | | dw_list.DeleteRow(row); |
| | | dw_list.Redraw(); |
| | | } |
| | | xml x; |
| | | |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = listwin::dw_list.GetNextSelectRow(1); |
| | | if (row < 1) { |
| | | row = listwin::dw_list.GetRow(); |
| | | if (row < 1) { |
| | | //win::MessageBox(GetHWND(),L"请选中要删除的行!",L"提示",0); |
| | | //trace(x.xml()); |
| | | xml x0 = ViewObject::MakeXml(); |
| | | x0.loadXML(L"<data/>"); |
| | | |
| | | KXMLDOMNodeList t = x.selectNodes(L"data/Item[@update.modify or @update.delete]"); |
| | | KXMLDOMElement e1 = x0.documentElement(); |
| | | int len = t.length(); |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | e1.appendChild(t.item(i)); |
| | | } |
| | | xaserverarg arg = ViewObject::MakeArg(); |
| | | arg.AddArg(L"content", x0.xml()); |
| | | |
| | | if (xurl::get(L"/sale/data/AR/update/item", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_list.ResetUpdateStatus(); |
| | | alert(L"保存成功!"); |
| | | } |
| | | else |
| | | { |
| | | alert(L"保存失败!"); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmSave") |
| | | { |
| | | return OnSave(); |
| | | } |
| | | else if (comdid == L"xmClose") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmSearch") |
| | | { |
| | | return OnRetrieve(0); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnCombboChanged(ref TCommandEvent evt, int lParam) |
| | | { |
| | | xstring id = L""; |
| | | xstring name = L""; |
| | | int h = xcombobox::GetCurSel(evt.hCtrl); |
| | | if (h > -1) |
| | | { |
| | | xstring txt = xcombobox::GetLBText(evt.hCtrl, h); |
| | | if (txt == L"限定客户") |
| | | { |
| | | OnRetrieve(1); |
| | | } |
| | | else if (txt == L"不限定客户") |
| | | { |
| | | OnRetrieve(0); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDoubleClicked(TEvent* evt, int p) |
| | | { |
| | | dw_unexch.AcceptText(); |
| | | int row = dw_unexch.GetRow(); |
| | | |
| | | int hCursor = xutil::SetCursorWait(); |
| | | double AdjustAmount = dw_unexch.GetItemDouble(row, L"AdjustAmount");//调整数 |
| | | double amted = dw_unexch.GetItemDouble(row, L"实收汇金额");//往次 |
| | | double samt = dw_unexch.GetItemDouble(row, L"应收汇金额");//应收汇金额 |
| | | double amt = samt - amted - AdjustAmount; |
| | | if (dw_obj) |
| | | { |
| | | xstring val = dw_unexch.GetItemDouble(row, L"ExchAmt"); |
| | | if (IsNoEmptyValue(val)) |
| | | { |
| | | dw_unexch.ItemChangeTo(row, L"ExchAmt", L""); |
| | | } |
| | | double amt1 = dw_obj.GetItemDouble(dw_obj.GetRow(), L"BalanceAmt"); |
| | | |
| | | int v1 = (amt * 100.0).toString().toInt(); |
| | | int v2 = (amt1 * 100.0).toString().toInt(); |
| | | if (v2 > v1) |
| | | { |
| | | dw_unexch.ItemChangeTo(row, L"Amount", xstring(amt)); |
| | | //dw_unexch.ItemChangeTo(row,L"ExchAmt",amt.toString()); |
| | | } |
| | | else |
| | | { |
| | | dw_unexch.ItemChangeTo(row, L"Amount", dw_obj.GetItemString(dw_obj.GetRow(), L"BalanceAmt")); |
| | | //dw_unexch.ItemChangeTo(row,L"ExchAmt",dw_obj.GetItemString(dw_obj.GetRow(),L"BalanceAmt")); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //dw_unexch.ItemChangeTo(row,L"ExchAmt",amt.toString()); |
| | | dw_unexch.ItemChangeTo(row, L"Amount", xstring(amt)); |
| | | } |
| | | dw_unexch.Redraw(); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int evalExchAmt() |
| | | { |
| | | double amt = 0; |
| | | xstring currencyCode = dw_obj.GetItemString(dw_obj.GetRow(), L"CurrencyCode"); |
| | | for (int i = 1; i <= dw_list.GetRowCount(); i++) |
| | | { |
| | | double amt0 = dw_list.GetItemDouble(i, L"Amount"); |
| | | xstring currencyCode1 = dw_list.GetItemString(i, L"CurrencyCode"); |
| | | if (currencyCode == L"CNY" || currencyCode == L"RMB") |
| | | { |
| | | if (currencyCode1 == L"USD") amt0 = amt0 * dw_list.GetItemDouble(i, L"ExchRate"); |
| | | } |
| | | amt += amt0; |
| | | //amt += dw_list.GetItemDouble(i,L"BankDeduction"); |
| | | //amt += dw_list.GetItemDouble(i,L"ForeignBankDeduction"); |
| | | } |
| | | if (dw_obj) |
| | | { |
| | | dw_obj.SetItemDouble(dw_obj.GetRow(), L"SignAmt", amt); |
| | | double amt1 = dw_obj.GetItemDouble(dw_obj.GetRow(), L"Amount"); |
| | | double BalanceAmt = amt1 - amt; |
| | | dw_obj.SetItemDouble(dw_obj.GetRow(), L"BalanceAmt", BalanceAmt); |
| | | dw_obj.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int Found(xstring InvoiceNo) |
| | | { |
| | | for (int row = 1; row <= dw_list.GetRowCount(); row++) |
| | | { |
| | | if (dw_list.GetItemString(row, L"InvoiceNo") == InvoiceNo) return row; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int ChangedListData(xstring colname, int row, xstring value) |
| | | { |
| | | if (colname == L"ExchRate" || colname == L"AcctAmount" || colname == L"CustomerCapitalExpense" || colname == L"BankRMBDeduction" || colname == L"Amount" || colname == L"ExchAmt" || colname == L"BankDeduction" || colname == L"ForeignBankDeduction") |
| | | { |
| | | int crow = Found(dw_unexch.GetItemString(row, L"InvoiceNo")); |
| | | if (crow < 1) |
| | | { |
| | | crow = dw_list.InsertRow(0); |
| | | dw_list.SetItemString(crow, L"InvoiceNo", dw_unexch.GetItemString(row, L"InvoiceNo")); |
| | | dw_list.SetItemString(crow, L"SEItemID", publiccode::GetGuid()); |
| | | if (dw_obj) |
| | | { |
| | | if (dw_obj.GetRowCount() > 0) |
| | | dw_list.SetItemString(crow, L"SEID", dw_obj.GetGuid(dw_obj.GetRow())); |
| | | } |
| | | dw_list.SetItemString(crow, colname, value); |
| | | } |
| | | else |
| | | { |
| | | dw_list.SetItemString(crow, colname, value); |
| | | } |
| | | dw_list.Redraw(); |
| | | evalExchAmt(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnItemChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring colname = hdr.colname; |
| | | xstring value = hdr.data; |
| | | int row = hdr.row; |
| | | |
| | | if (colname == L"ExchRate" || colname == L"BankDeduction" || colname == L"BankRMBDeduction" || colname == L"ForeignBankDeduction" || colname == L"ExchAmt" || colname == L"Amount" || colname == L"CustomerCapitalExpense") { |
| | | double ExchAmt = dw_unexch.GetItemDouble(row, L"ExchAmt"); |
| | | double Amt = dw_unexch.GetItemDouble(row, L"Amount"); |
| | | double BankDeduction = dw_unexch.GetItemDouble(row, L"BankDeduction"); |
| | | double ForeignBankDeduction = dw_unexch.GetItemDouble(row, L"ForeignBankDeduction"); |
| | | double CustomerCapitalExpense = dw_unexch.GetItemDouble(row, L"CustomerCapitalExpense"); |
| | | if (colname == L"BankDeduction" || colname == L"ForeignBankDeduction" || colname == L"ExchAmt" || colname == L"CustomerCapitalExpense") |
| | | { |
| | | dw_unexch.SetItemDouble(row, L"ExchAmt", Amt + BankDeduction + ForeignBankDeduction + CustomerCapitalExpense); |
| | | ChangedListData(L"ExchAmt", row, dw_unexch.GetItemString(row, L"ExchAmt")); |
| | | } |
| | | if (colname == L"Amount") |
| | | { |
| | | dw_unexch.SetItemDouble(row, L"ExchAmt", Amt + BankDeduction + ForeignBankDeduction + CustomerCapitalExpense); |
| | | ChangedListData(L"ExchAmt", row, dw_unexch.GetItemString(row, L"ExchAmt")); |
| | | } |
| | | |
| | | Amt = dw_unexch.GetItemDouble(row, L"Amount"); |
| | | double exchRate = dw_unexch.GetItemDouble(row, L"ExchRate"); |
| | | double rmbDeduction = dw_unexch.GetItemDouble(row, L"BankRMBDeduction"); |
| | | dw_unexch.ItemChangeTo(row, L"AcctAmount", xstring((Amt * exchRate /*- rmbDeduction*/))); |
| | | |
| | | //cala balance |
| | | double ttlamt = dw_unexch.GetItemDouble(row, L"应收汇金额"); |
| | | double AdjustAmount = dw_unexch.GetItemDouble(row, L"AdjustAmount"); |
| | | ExchAmt = dw_unexch.GetItemDouble(row, L"ExchAmt"); |
| | | double ExchAmted = dw_unexch.GetItemDouble(row, L"实收汇金额"); |
| | | dw_unexch.SetItemDouble(row, L"未收汇金额", ttlamt - AdjustAmount - ExchAmt - ExchAmted); |
| | | |
| | | dw_unexch.Redraw(); |
| | | } |
| | | ChangedListData(colname, row, value); |
| | | |
| | | return 1; |
| | | |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&ExchangeSignFastWin::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | //AttachEvent(L"WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent(L"dw_unexch", L"DWV_DOUBLECLICKED", (FEvent)&ExchangeSignFastWin::OnDoubleClicked);//行双击 |
| | | AttachEvent(L"cbx_customer", L"CBN_SELCHANGE", (FEvent)&ExchangeSignFastWin::OnCombboChanged);//属性组切换list中列的数量变化 |
| | | AttachEvent(L"dw_unexch", L"DWV_ITEMCHANGED", (FEvent)&ExchangeSignFastWin::OnItemChanged); |
| | | |
| | | } |
| | | |
| | | xstring GetQueryArg() |
| | | { |
| | | dw_arg.AcceptText(); |
| | | xml x; |
| | | |
| | | dw_arg.DwUpdateAllTo(x); |
| | | return x.xml(); |
| | | } |
| | | |
| | | int OnRetrieve(int customer = 1) |
| | | { |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | int row = dw_obj.GetRow(); |
| | | if (row < 1) return 1; |
| | | xstring CustomerID = dw_obj.GetItemString(row, L"CustomerID"); |
| | | //alert(CustomerID); |
| | | xstring SEID = dw_obj.GetGuid(dw_obj.GetRow()); |
| | | |
| | | trace(L"+++L" + CustomerID + L"+++L" + SEID); |
| | | |
| | | arg.AddArg(L"CustomerID", CustomerID); |
| | | arg.AddArg(L"SEID", SEID); |
| | | |
| | | xstring path = L"/sale/data/AR/item/noexch/listwithcustomer"; |
| | | if (customer == 0) path = L"/sale/data/AR/item/noexch/list"; |
| | | |
| | | xstring path1 = L"/sale/data/AR/item/exch/listwithcustomer"; |
| | | if (customer == 0) path1 = L"/sale/data/AR/item/exch/list"; |
| | | |
| | | arg.AddArg(L"QueryTxt", GetControl(L"sle_search").GetText()); |
| | | arg.AddArg(L"QueryArg", GetQueryArg()); |
| | | trace(L"SEID+++L" + SEID + L"+++QueryTxt+++L" + GetControl(L"sle_search").GetText() + L"+++QueryArg+++L" + GetQueryArg()); |
| | | if (getUrl(path, arg.GetString(), x) != 1) |
| | | { |
| | | trace(L"错误信息1=L" + xstring(x.text())); |
| | | xutil::RestoreCursor(hCursor); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | KXMLDOMElement e = listwin::dw_list.GetRowElement(row); |
| | | //xstring sguid = e.SelectSingleNode(L"@guid").text; |
| | | //xstring sName = e.selectSingleNode(L"Name").text+L""; |
| | | xstring sguid = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"); |
| | | xstring sName = dw_list.GetItemString(dw_list.GetRow(), L"Name"); |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBoxW(GetHWND(), L"确认要删除供应商 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"EntityID", sguid); |
| | | // trace(sguid); |
| | | if (xurl::post(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/delete", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement msg = x.selectNodes(L"process").item(0); |
| | | xstring success = msg.selectSingleNode(L"@finished").text(); |
| | | if (success == L"0") |
| | | else |
| | | { |
| | | alert(msg.selectSingleNode(L"@errInfo").text()); |
| | | dw_unexch.Retrieve(x); |
| | | dw_unexch.Redraw(); |
| | | } |
| | | |
| | | //trace(x.xml()); |
| | | if (getUrl(path1, arg.GetString(), x) != 1) |
| | | { |
| | | trace(L"错误信息2=L" + xstring(x.text())); |
| | | xutil::RestoreCursor(hCursor); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | MessageBoxW(GetHWND(), L"删除成功!", L"提示", 0); |
| | | listwin::dw_list.DeleteRow(row); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChangedEx(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | //if(row < 1 or row > dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = listwin::dw_list.GetRowElement(row); |
| | | xstring entity = ele.selectSingleNode(L"SupplierID").text(); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"EntityID", entity); |
| | | |
| | | |
| | | xstring no1 = publiccode::GetUser().no; |
| | | if (no1 != L"00201") |
| | | { |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritemEx"; |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | if (getUrl(GetServerUrl(), GoodsUrl, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | } |
| | | SetAgent(L"list", entity); |
| | | return 1; |
| | | } |
| | | |
| | | int GridSearch() |
| | | { |
| | | //alert(L"你好"); |
| | | #if 0 |
| | | |
| | | xstring m_config = L"view.Supplier.v3.config"; |
| | | xdwgrid dw = listwin::dw_list; |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = TFile::node(m_config, L"config", L"search"); |
| | | if (str != L"") { |
| | | arg.AddArg(L"sheet", str); |
| | | } |
| | | else |
| | | arg.AddArg(L"sheet", L"dev:sheet[Supplier.v3.tpl/list]"); |
| | | arg.AddArg(L"search", listwin::m_QueryTxt); |
| | | openUrl(L"view.dlg.vface/xpage/grid/column/search", &arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring txt = arg.GetArgString(L"search"); |
| | | if (txt != L"") { |
| | | listwin::m_QueryTxt = txt; |
| | | //trace(txt); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | #endif |
| | | return 0; |
| | | } |
| | | |
| | | int OnSelectAllRow() |
| | | { |
| | | int rows = listwin::dw_list.GetRowCount(); |
| | | if (rows < 1) return -1; |
| | | listwin::dw_list.SelectRow(1, rows, true); |
| | | listwin::dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnRClick(TEvent evt, LPARAM p) |
| | | { |
| | | return 1; |
| | | } |
| | | int OnLogOff() |
| | | { |
| | | return 1; |
| | | } |
| | | int OnChecked() |
| | | { |
| | | xstring partyno = dw_list.GetItemString(dw_list.GetRow(), L"PartyNo"); |
| | | if (partyno.find(L"N") < 0) |
| | | { |
| | | alert(L"已经是正式供应商"); |
| | | return 0; |
| | | } |
| | | xstring entityid = GetEntityID(dw_list.GetRow()); |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBoxW(GetHWND(), L"是否转成正式供应商?", L"提示", MB_OKCANCEL); |
| | | if (ret == IDOK) |
| | | { |
| | | xml x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/updateno", L"entityid", entityid); |
| | | |
| | | if (xstring(x.xml()).find(L"success") > 0) |
| | | { |
| | | alert(L"处理成功"); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | //alert(comdid); |
| | | |
| | | if (comdid.find(L"action:LogOff", 0) >= 0) return OnLogOff(); |
| | | if (comdid.find(L"action:bill.delete", 0) >= 0) |
| | | { |
| | | OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | if (comdid == L"action:search1") return GridSearch(); |
| | | if (comdid == L"action:bill.refresh") |
| | | { |
| | | return OnRetrieve(); |
| | | } |
| | | if (comdid == L"action:bill.xmSaveAs") |
| | | { |
| | | xstring userno = publiccode::GetUser().no; |
| | | if (userno == L"00701" || userno == L"00601" || userno == L"admin") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | } |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.Annex") |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | arg.AddArg(L"ApplyStatus", dw_list.GetItemString(dw_list.GetRow(), L"ApplyStatus")); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.Document.Supplier.v3.vx]", (LPARAM)&arg); |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/AR/template/unexch"); |
| | | dw_unexch = GetControl(L"dw_unexch"); |
| | | dw_unexch.openUrl(L"/sale/view/AR/template/unexch"); |
| | | |
| | | |
| | | dw_list.SetColumnState(L"SEID", false); |
| | | dw_list.SetColumnState(L"SEItemID", false); |
| | | |
| | | dw_unexch.SetColumnState(L"SEID", false); |
| | | dw_unexch.SetColumnState(L"SEItemID", false); |
| | | |
| | | dw_arg = GetControl(L"dw_arg"); |
| | | dw_arg.openUrl(L"/sale/view/AR/template/queryarg"); |
| | | dw_arg.SetColHeaderHeight(0); |
| | | dw_arg.SetRowSelectorWidth(0); |
| | | dw_arg.SetHScrollState(false); |
| | | dw_arg.SetVScrollState(false); |
| | | //dw_arg.SetItemString(1,L"DateType",L"本年"); |
| | | |
| | | /*xaserverarg arg = GetParam(); |
| | | xstring CustomerIDOne = arg.GetArgString(L"CustomerID"); |
| | | xstring SEIDOne = arg.GetArgString(L"SEID");*/ |
| | | if (GetWinParam())dw_obj = GetParam(); |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.AnnexEx") |
| | | { |
| | | xaserverarg& arg4 = *new xaserverarg; |
| | | arg4.setNativePointer(arg4.CreateInstance()); |
| | | arg4.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | //arg4.AddArg(L"ApplyStatus",dw_list.GetItemString(dw_list.GetRow(),L"ApplyStatus")); |
| | | |
| | | //OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", p4); |
| | | OpenWindow(L"dev:xpage[maint.Document.SupplierSD.v3.vx]", (LPARAM)&arg4); |
| | | int onloaded() |
| | | { |
| | | //SetAgent(); |
| | | if (dw_obj)OnRetrieve(1); |
| | | |
| | | |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.checked") |
| | | return OnChecked(); |
| | | // if(comdid==L"action:bill.import") return OnImport(); |
| | | // if(comdid.find(L"action:",0)>=0) return ProcessFlowAction(comdid,1); |
| | | //if(comdid==L"search") return GridSearch(L"view.dlg.vface/xpage/grid/column/edit"); |
| | | //if(comdid==L"showall") return ShowAll(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int PostOnAttachEvent() |
| | | { |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listSupplierv3::OnTreeSelChanged); |
| | | AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listSupplierv3::OnSelectDdlb); |
| | | AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listSupplierv3::OnChangePages); |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&listSupplierv3::OnRClick);//鼠标右键 |
| | | //AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listSupplierv3::OnDoubleClicked); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | PIndex = 1; |
| | | listwin::m_QueryTxt = L""; //查询条件 |
| | | m_sType = L""; //type |
| | | m_sTypeTxt = L""; //选中树的data |
| | | |
| | | listwin::onload(); |
| | | |
| | | tv_1 = GetControl(L"tv_1"); |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | |
| | | changeddlb = 0; |
| | | OnCreateTree(L"GoodsCates"); |
| | | dw_list.SetColumnState(L"SupplierID", false); |
| | | dw_list.SetColumnState(L"userNo", false); |
| | | dw_list.SetColumnState(L"YearEstablished", false); |
| | | dw_list.SetColumnState(L"LegalPerson", false); |
| | | dw_list.SetColumnState(L"ThirdPartyReport", false); |
| | | dw_list.SetColumnState(L"bAddress", false); |
| | | dw_list.SetColumnState(L"PayType", false); |
| | | dw_list.SetColumnState(L"PicPath", false); |
| | | dw_list.SetColumnState(L"SDID", false); |
| | | dw_list.SetColumnState(L"AdvantageProduct", false); |
| | | //dw_list.SetColumnState(L"ApplyStatus",false); |
| | | |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(GetServerUrl(), L"/sale/view/SupplierV3/template/supplier/supplieritem"); |
| | | |
| | | if (publiccode::GetUser().name != L"admin") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | |
| | | xml supplier_x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); |
| | | if (supplier_x) |
| | | { |
| | | TypeWork = supplier_x.text(); |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | |
| | | dw_list.SetColumnState(L"DateEx", false); |
| | | dw_list.SetColumnState(L"DateExS", false); |
| | | dw_list.SetColumnState(L"Name", false); |
| | | dw_list.SetColumnState(L"ProvinceCode", false); |
| | | dw_list.SetColumnState(L"City", false); |
| | | dw_list.SetColumnState(L"District", false); |
| | | dw_list.SetColumnState(L"Address", false); |
| | | dw_list.SetColumnState(L"CName", false); |
| | | dw_list.SetColumnState(L"TEL", false); |
| | | dw_list.SetColumnState(L"Mob", false); |
| | | dw_list.SetColumnState(L"AreaCode", false); |
| | | dw_list.SetColumnState(L"Fax", false); |
| | | dw_goods.SetColumnState(L"Price", false); |
| | | dw_goods.SetColumnState(L"PackRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PartRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PaperRMBPrice", false); |
| | | dw_goods.SetColumnState(L"ETD", false); |
| | | dw_goods.SetColumnState(L"InvoiceNo", false); |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&listSupplierv3::OnRowChangedEx); |
| | | |
| | | listwin::onloaded(); |
| | | xstring EntityID; |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = listwin::m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text(); |
| | | if (ele.selectSingleNode(id)) |
| | | EntityID = ele.selectSingleNode(id).text(); |
| | | listwin::SetAgent(L"list", EntityID); |
| | | return 1; |
| | | } |
| | | |
| | | }; |
| | | }; |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) listSupplierv3 : public listwin |
| | | { |
| | | public: |
| | | xdwgrid dw_goods; |
| | | xtreeview tv_1; |
| | | xcombobox ddlb_1; |
| | | int changeddlb; |
| | | xstring TypeWork; |
| | | xstring GoodsUrl; |
| | | xstring m_sType; //type |
| | | xstring m_sTypeTxt; //选中树的data |
| | | // xstring m_searchtxt; |
| | | int PIndex; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | |
| | | public: |
| | | listSupplierv3(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static listSupplierv3* CreateInstance(void* implPtr, void* hWnd) |
| | | class __declspec(dllexport) SettlementExchangeEdit : public xframe |
| | | { |
| | | listSupplierv3* pWin = new listSupplierv3(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | public: |
| | | xdwtable dw_base; |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"pageindex", xstring(PIndex)); //第几页 |
| | | arg.AddArg(L"pagenumber", xstring(listwin::m_pageNumber)); //每页数量 |
| | | arg.AddArg(L"QueryTxt", listwin::m_QueryTxt); |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | //alert(L"xxxx"); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | xnode m_agentNode; //Agent Condition |
| | | HWND hObject; |
| | | bool updated; |
| | | |
| | | public: |
| | | SettlementExchangeEdit(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static SettlementExchangeEdit* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | return -1; |
| | | SettlementExchangeEdit* pWin = new SettlementExchangeEdit(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | else |
| | | |
| | | int SetAgent() |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int SetEntityData(xaserverarg arg) |
| | | { |
| | | xstring strQueryTxt = arg.GetArgString(L"QueryTxt"); |
| | | xml x; |
| | | |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text()); |
| | | |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | else |
| | | { |
| | | |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | //trace(x.GetXml()); |
| | | listwin::dw_list.Retrieve(x); |
| | | listwin::dw_list.Redraw(); |
| | | listwin::dw_list.SetReadOnly(true); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h->cur; |
| | | |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnRetrieve(); |
| | | PIndex = c; |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | |
| | | |
| | | } |
| | | |
| | | int ViewUpdate(int pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"refresh") |
| | | { |
| | | //trace(L"sd"); |
| | | xdwpages zz = GetControl(L"pages"); |
| | | int h = zz.SetCurPage(1); |
| | | //trace(h); |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //树选择 |
| | | int OnTreeSelChanged(TEvent evt, LPARAM p) |
| | | { |
| | | if (changeddlb != 1) |
| | | { |
| | | //alert(L"1"); |
| | | |
| | | HTREEITEM h = tv_1.GetSelectedItem(); |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)tv_1.GetItemData(h); |
| | | |
| | | xstring t = e.selectSingleNode(L"@type").text(); |
| | | m_sType = t + L""; |
| | | xstring txt = e.selectSingleNode(L"@code").text(); |
| | | if (txt == L"") |
| | | txt = e.selectSingleNode(L"@name").text(); |
| | | m_sTypeTxt = txt + L""; |
| | | |
| | | //alert(m_sTypeTxt); |
| | | |
| | | PIndex = 1; |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int createSubTree(HTREEITEM h, KXMLDOMElement ele) |
| | | { |
| | | KXMLDOMNodeList nlist = ele.selectNodes(L"item"); |
| | | int i; |
| | | int s = nlist.length(); |
| | | if (s > 0) |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(h, name, (LPARAM)e, 15); |
| | | createSubTree(hw, *e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(xstring sType) |
| | | { |
| | | |
| | | while (tv_1.GetRootItem()) |
| | | tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sType", sType); |
| | | //Tree.pref.supplier.xq |
| | | //getUrl(GetEntityName(1)+L"/entity/list",arg.GetString(),x); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[Tree.pref.supplier.xq]",arg.GetString(),x)!=1) |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/pref/list/tree", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"root/item"); |
| | | int len = nlist.length(); |
| | | if (len > 0) |
| | | { |
| | | int i; |
| | | for (i = 0; i < len; i++) |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(0, name, (LPARAM)e, 15); |
| | | |
| | | createSubTree(hw, *e); |
| | | tv_1.ExpandItem(hw); |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | tv_1.ExpandItem(0); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //重置工具条 |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | int OnSave(bool dlg = true) |
| | | { |
| | | xml x; |
| | | |
| | | dw_base.AcceptText(); |
| | | dw_base.DwUpdateAllTo(x); |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | //alert(x.xml()); |
| | | if (xurl::get(L"/sale/data/AR/update", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_base.ResetUpdateStatus(); |
| | | dw_base.Redraw(); |
| | | updated = true; |
| | | if (dlg)alert(L"保存成功!"); |
| | | |
| | | //xcombobox下拉 |
| | | int OnSelectDdlb(TEvent evt, LPARAM p) |
| | | { |
| | | changeddlb = 1; |
| | | |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = SendMessageW(ddlb_1.GetHWND(), CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring((nIndex + 1)) + L"]"); |
| | | xstring text = e2.selectSingleNode(L"@element").text(); |
| | | OnCreateTree(text); |
| | | changeddlb = 0; |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = listwin::dw_list.GetNextSelectRow(1); |
| | | if (row < 1) { |
| | | row = listwin::dw_list.GetRow(); |
| | | if (row < 1) { |
| | | //win::MessageBox(GetHWND(),L"请选中要删除的行!",L"提示",0); |
| | | //SendMessage(hObject,0x401,L"xmSignEx:"+dw_base.GetGuid(1),0); |
| | | SendMessage(hObject, 0x401, (LPARAM)L"xmRefresh", 0); |
| | | //CloseWindow(); |
| | | } |
| | | else |
| | | { |
| | | alert(L"保存失败!"); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | KXMLDOMElement e = listwin::dw_list.GetRowElement(row); |
| | | //xstring sguid = e.SelectSingleNode(L"@guid").text; |
| | | //xstring sName = e.selectSingleNode(L"Name").text+L""; |
| | | xstring sguid = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"); |
| | | xstring sName = dw_list.GetItemString(dw_list.GetRow(), L"Name"); |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBoxW(GetHWND(), L"确认要删除供应商 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"EntityID", sguid); |
| | | // trace(sguid); |
| | | if (xurl::post(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/delete", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement msg = x.selectNodes(L"process").item(0); |
| | | xstring success = msg.selectSingleNode(L"@finished").text(); |
| | | if (success == L"0") |
| | | { |
| | | alert(msg.selectSingleNode(L"@errInfo").text()); |
| | | } |
| | | else |
| | | { |
| | | MessageBoxW(GetHWND(), L"删除成功!", L"提示", 0); |
| | | listwin::dw_list.DeleteRow(row); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChangedEx(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | //if(row < 1 or row > dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = listwin::dw_list.GetRowElement(row); |
| | | xstring entity = ele.selectSingleNode(L"SupplierID").text(); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"EntityID", entity); |
| | | |
| | | |
| | | xstring no1 = publiccode::GetUser().no; |
| | | if (no1 != L"00201") |
| | | { |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritemEx"; |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | if (getUrl(GetServerUrl(), GoodsUrl, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | } |
| | | SetAgent(L"list", entity); |
| | | return 1; |
| | | } |
| | | |
| | | int GridSearch() |
| | | { |
| | | //alert(L"你好"); |
| | | #if 0 |
| | | |
| | | xstring m_config = L"view.Supplier.v3.config"; |
| | | xdwgrid dw = listwin::dw_list; |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = TFile::node(m_config, L"config", L"search"); |
| | | if (str != L"") { |
| | | arg.AddArg(L"sheet", str); |
| | | } |
| | | else |
| | | arg.AddArg(L"sheet", L"dev:sheet[Supplier.v3.tpl/list]"); |
| | | arg.AddArg(L"search", listwin::m_QueryTxt); |
| | | openUrl(L"view.dlg.vface/xpage/grid/column/search", &arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring txt = arg.GetArgString(L"search"); |
| | | if (txt != L"") { |
| | | listwin::m_QueryTxt = txt; |
| | | //trace(txt); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | #endif |
| | | return 0; |
| | | } |
| | | |
| | | int OnSelectAllRow() |
| | | { |
| | | int rows = listwin::dw_list.GetRowCount(); |
| | | if (rows < 1) return -1; |
| | | listwin::dw_list.SelectRow(1, rows, true); |
| | | listwin::dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnRClick(TEvent evt, LPARAM p) |
| | | { |
| | | return 1; |
| | | } |
| | | int OnLogOff() |
| | | { |
| | | return 1; |
| | | } |
| | | int OnChecked() |
| | | { |
| | | xstring partyno = dw_list.GetItemString(dw_list.GetRow(), L"PartyNo"); |
| | | if (partyno.find(L"N") < 0) |
| | | { |
| | | alert(L"已经是正式供应商"); |
| | | return 0; |
| | | } |
| | | xstring entityid = GetEntityID(dw_list.GetRow()); |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBoxW(GetHWND(), L"是否转成正式供应商?", L"提示", MB_OKCANCEL); |
| | | if (ret == IDOK) |
| | | { |
| | | xml x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/updateno", L"entityid", entityid); |
| | | |
| | | if (xstring(x.xml()).find(L"success") > 0) |
| | | { |
| | | alert(L"处理成功"); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | //alert(comdid); |
| | | |
| | | if (comdid.find(L"action:LogOff", 0) >= 0) return OnLogOff(); |
| | | if (comdid.find(L"action:bill.delete", 0) >= 0) |
| | | { |
| | | OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | if (comdid == L"action:search1") return GridSearch(); |
| | | if (comdid == L"action:bill.refresh") |
| | | { |
| | | return OnRetrieve(); |
| | | } |
| | | if (comdid == L"action:bill.xmSaveAs") |
| | | { |
| | | xstring userno = publiccode::GetUser().no; |
| | | if (userno == L"00701" || userno == L"00601" || userno == L"admin") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | } |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.Annex") |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | if (comdid == L"xmClose") |
| | | { |
| | | if (updated) |
| | | SendMessage(hObject, 0x401, (LPARAM)L"xmRefresh", 0); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmSave") |
| | | { |
| | | OnSave(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmSign") |
| | | { |
| | | return OnSign(); |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int OnSign() |
| | | { |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | arg.AddArg(L"ApplyStatus", dw_list.GetItemString(dw_list.GetRow(), L"ApplyStatus")); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.Document.Supplier.v3.vx]", (LPARAM)&arg); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.AnnexEx") |
| | | { |
| | | xaserverarg& arg4 = *new xaserverarg; |
| | | arg4.setNativePointer(arg4.CreateInstance()); |
| | | arg4.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | //arg4.AddArg(L"ApplyStatus",dw_list.GetItemString(dw_list.GetRow(),L"ApplyStatus")); |
| | | xml x; |
| | | |
| | | dw_base.AcceptText(); |
| | | dw_base.DwUpdateAllTo(x); |
| | | if (x.selectSingleNode(L"//*[@update.modify='1']")) |
| | | if (OnSave(false) == -1) return 1; |
| | | |
| | | //OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", p4); |
| | | OpenWindow(L"dev:xpage[maint.Document.SupplierSD.v3.vx]", (LPARAM)&arg4); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.checked") |
| | | return OnChecked(); |
| | | // if(comdid==L"action:bill.import") return OnImport(); |
| | | // if(comdid.find(L"action:",0)>=0) return ProcessFlowAction(comdid,1); |
| | | //if(comdid==L"search") return GridSearch(L"view.dlg.vface/xpage/grid/column/edit"); |
| | | //if(comdid==L"showall") return ShowAll(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int PostOnAttachEvent() |
| | | { |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listSupplierv3::OnTreeSelChanged); |
| | | AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listSupplierv3::OnSelectDdlb); |
| | | AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listSupplierv3::OnChangePages); |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&listSupplierv3::OnRClick);//鼠标右键 |
| | | //AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listSupplierv3::OnDoubleClicked); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | PIndex = 1; |
| | | listwin::m_QueryTxt = L""; //查询条件 |
| | | m_sType = L""; //type |
| | | m_sTypeTxt = L""; //选中树的data |
| | | |
| | | listwin::onload(); |
| | | |
| | | tv_1 = GetControl(L"tv_1"); |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | |
| | | changeddlb = 0; |
| | | OnCreateTree(L"GoodsCates"); |
| | | dw_list.SetColumnState(L"SupplierID", false); |
| | | dw_list.SetColumnState(L"userNo", false); |
| | | dw_list.SetColumnState(L"YearEstablished", false); |
| | | dw_list.SetColumnState(L"LegalPerson", false); |
| | | dw_list.SetColumnState(L"ThirdPartyReport", false); |
| | | dw_list.SetColumnState(L"bAddress", false); |
| | | dw_list.SetColumnState(L"PayType", false); |
| | | dw_list.SetColumnState(L"PicPath", false); |
| | | dw_list.SetColumnState(L"SDID", false); |
| | | dw_list.SetColumnState(L"AdvantageProduct", false); |
| | | //dw_list.SetColumnState(L"ApplyStatus",false); |
| | | |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(GetServerUrl(), L"/sale/view/SupplierV3/template/supplier/supplieritem"); |
| | | |
| | | if (publiccode::GetUser().name != L"admin") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | |
| | | xml supplier_x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); |
| | | if (supplier_x) |
| | | if (dw_base.GetGuid(1) == L"") |
| | | { |
| | | TypeWork = supplier_x.text(); |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | |
| | | dw_list.SetColumnState(L"DateEx", false); |
| | | dw_list.SetColumnState(L"DateExS", false); |
| | | dw_list.SetColumnState(L"Name", false); |
| | | dw_list.SetColumnState(L"ProvinceCode", false); |
| | | dw_list.SetColumnState(L"City", false); |
| | | dw_list.SetColumnState(L"District", false); |
| | | dw_list.SetColumnState(L"Address", false); |
| | | dw_list.SetColumnState(L"CName", false); |
| | | dw_list.SetColumnState(L"TEL", false); |
| | | dw_list.SetColumnState(L"Mob", false); |
| | | dw_list.SetColumnState(L"AreaCode", false); |
| | | dw_list.SetColumnState(L"Fax", false); |
| | | dw_goods.SetColumnState(L"Price", false); |
| | | dw_goods.SetColumnState(L"PackRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PartRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PaperRMBPrice", false); |
| | | dw_goods.SetColumnState(L"ETD", false); |
| | | dw_goods.SetColumnState(L"InvoiceNo", false); |
| | | |
| | | } |
| | | alert(L"请先保存,在签收!"); |
| | | return 1; |
| | | } |
| | | |
| | | OnRetrieve(dw_base.GetGuid(1)); |
| | | |
| | | if (dw_base.GetItemString(1, L"CustomerID") == L"") |
| | | { |
| | | alert(L"客户不允许未空!"); |
| | | return 1; |
| | | } |
| | | arg.AddArg(L"CustomerID", dw_base.GetItemString(1, L"CustomerID")); |
| | | arg.AddArg(L"SEID", dw_base.GetGuid(1)); |
| | | SendMessage(hObject, 0x401, L"xmSignEx:" + dw_base.GetGuid(1), 0); |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int OnItemChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring colname = hdr.colname; |
| | | xstring value = hdr.data; |
| | | |
| | | int onloaded() |
| | | { |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&listSupplierv3::OnRowChangedEx); |
| | | xstring dwname = L"dw_base"; |
| | | |
| | | listwin::onloaded(); |
| | | xstring EntityID; |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = listwin::m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text(); |
| | | if (ele.selectSingleNode(id)) |
| | | EntityID = ele.selectSingleNode(id).text(); |
| | | listwin::SetAgent(L"list", EntityID); |
| | | return 1; |
| | | } |
| | | if (colname == L"Amount" || colname == L"ForeignBankDeduction" || colname == L"BankDeduction" || colname == L"BankRMBDeduction") |
| | | { |
| | | double Amount = dw_base.GetItemDouble(hdr.row, L"Amount"); |
| | | double ForeignBankDeduction = dw_base.GetItemDouble(hdr.row, L"ForeignBankDeduction"); |
| | | double BankDeduction = dw_base.GetItemDouble(hdr.row, L"BankDeduction"); |
| | | double CustomerCapitalExpense = dw_base.GetItemDouble(hdr.row, L"CustomerCapitalExpense"); |
| | | double PressureExchangeRate = dw_base.GetItemDouble(hdr.row, L"PressureExchangeRate"); |
| | | //double BankRMBDeduction = dw_base.GetItemDouble(hdr.row,L"BankRMBDeduction"); |
| | | dw_base.SetItemDouble(hdr.row, L"AmountEx", xdouble((Amount + ForeignBankDeduction + BankDeduction + CustomerCapitalExpense)).round(2)); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | }; |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&SettlementExchangeEdit::OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&SettlementExchangeEdit::OnSetFocus); |
| | | AttachEvent(L"dw_base", L"DWV_ITEMCHANGED", (FEvent)&SettlementExchangeEdit::OnItemChanged); |
| | | } |
| | | |
| | | |
| | | int OnRetrieve(xstring SettlementExchangeID) |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"SEID", SettlementExchangeID); |
| | | |
| | | if (getUrl(L"/sale/data/AR/se/getsebyid", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_base.Retrieve(x); |
| | | dw_base.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | int onload() |
| | | { |
| | | dw_base = GetControl(L"dw_base"); |
| | | dw_base.openUrl(L"/sale/view/AR/template/SEMaint"); |
| | | dw_base.SetColHeaderHeight(0); |
| | | dw_base.SetRowSelectorWidth(0); |
| | | dw_base.SetHScrollState(false); |
| | | dw_base.SetVScrollState(false); |
| | | xstring SettlementExchangeID = L""; |
| | | hObject = 0; |
| | | if (GetWinParam()) |
| | | { |
| | | xaserverarg arg =GetArg(); |
| | | SettlementExchangeID = arg.GetArgString(L"SettlementExchangeID"); |
| | | hObject = arg.GetArgString(L"HWND").toInt(); |
| | | } |
| | | if (SettlementExchangeID != L"") |
| | | { |
| | | //alert(SettlementExchangeID); |
| | | OnRetrieve(SettlementExchangeID); |
| | | } |
| | | else |
| | | { |
| | | xstring suserid = publiccode::GetUser().id; |
| | | xstring susername = publiccode::GetUser().name; |
| | | xstring sdate = publiccode::GetCurrentDate(); |
| | | dw_base.SetItemString(1, L"SEDate", sdate); |
| | | dw_base.SetItemString(1, L"CreateDate", sdate); |
| | | dw_base.SetItemString(1, L"CurrencyCode", L"USD"); |
| | | dw_base.SetItemString(1, L"CreatorID", suserid); |
| | | dw_base.SetItemDisplayString(1, L"CreatorID", susername); |
| | | } |
| | | OnAttachEvent(); |
| | | updated = false; |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |