þÿ#include <wobject/xstring.hpp> #include <xcontrol/xtreeview.hpp> #include <xcontrol/xdwgrid.hpp> #include <wobject/xdouble.hpp> #include <xcontrol/xlayersheet.hpp> #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" #include "viewobject/view.base.hpp" #include <xcontrol/xdatetimepick.hpp> using xml = KXMLDOMDocument; class __declspec(dllexport) SampleFeeList : public xframe { public: xdwgrid dw_list; xdatetimepick sdate; xdatetimepick edate; xnode m_agentNode; //Agent Condition public: SampleFeeList(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} public: static SampleFeeList* CreateInstance(void* implPtr, void* hWnd) { SampleFeeList* pWin = new SampleFeeList(implPtr, (HWND)hWnd); return pWin; } #if 0 int SetAgent() { xstring xfNodeAgentArea = L"agentarea"; xnode anode = GetAgentNode(xfNodeAgentArea); if (m_agentNode) { SetAgentNode(anode, m_agentNode); } else { KXMLDOMElement xframeElement = GetElement(); KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); if (agent) { xstring s = agent.xml(); m_agentNode = SetAgentNode(anode, s); } } return 1; } #endif // 0 //q&p¹oÀm;YtQýep int OnSetFocus(TEvent* evt, LPARAM param) { //‘Ín]åQwga //SetAgent(); SetAgent(L"list", GetEntityID(1)); return 1; } xstring GetEntityName(LPARAM pr) { return L"SampleFee"; } xstring GetEntityID(LPARAM pr) { int row = dw_list.GetRow(); xstring id = dw_list.GetItemString(row, L"SampleID"); return id; } int ProcessUsedArg(xaserverarg arg) { xstring EntityIDList = L""; int ll_row = dw_list.GetNextSelectRow(1); while (ll_row > 0 && ll_row <= dw_list.GetRowCount()) { xstring id = dw_list.GetItemString(ll_row, L"SampleID"); if (EntityIDList == L"") EntityIDList = id; else EntityIDList += L"," + id; ll_row = dw_list.GetNextSelectRow(ll_row + 1); } if (EntityIDList != L"") arg.AddArg(L"EntityID", EntityIDList); return 1; } int OnRowChanged(TEvent* evt, LPARAM p) { DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; int row = hdr.row; SetAgent(L"list", dw_list.GetItemString(row, L"SampleID")); return 1; } //T}NäSÑ^Qýep int OnCmdDispatch(xstring comdid) { xstring s = publiccode::GetUser().deptname; xstring s1 = L"0"; if (s == L"‘Ǎ-è") s1 = L"1"; if (s.find(L"NR¡") >= 0) s1 = L"1"; if (s1 == L"0") { if (comdid == L"action:bill.new" || comdid == L"xmAdd") { xaserverarg arg; arg.AddArg(L"HWND", xstring((__int64)GetHWND())); OpenWindow(L"dev:xpage[maint.samplefee.vx]", arg); } else if (comdid == L"action:bill.open" || comdid == L"xmEdit") { xaserverarg arg; xstring SampleFeeID = dw_list.GetGuid(dw_list.GetRow()); arg.AddArg(L"SampleFeeID", SampleFeeID); arg.AddArg(L"HWND", xstring((__int64)GetHWND())); OpenWindow(L"dev:xpage[maint.samplefee.vx]", arg); } else if (comdid == L"action:bill.delete" || comdid == L"xmDelete") { xstring SampleNo = dw_list.GetItemString(1, L"SampleNo").trim(); xstring EntityID = dw_list.GetGuid(dw_list.GetRow()); int MB_OKCANCEL = 1; int IDOK = 1; int ret = MessageBox(GetHWND(), L"xn‹¤R –dh7TÁ9" + SampleNo + L"?", L"cÐy:", MB_OKCANCEL); if (ret == IDOK) { ViewObject::RetrieveData(L"/sale/data/expense3/delete/sampleFee", L"EntityID", EntityID); OnRetrieve(); } } else if (comdid == L"action:bill.xmAnalysis" || comdid == L"xmAnalysis") { HCURSOR hCursor = xutil::SetCursorWait(); xstring str = dw_list.DataAnalysis(L""); xaserverarg arg0; arg0.AddArg(L"html", str); OpenWindow(L"dev:xpage[data.vanalysis.vx]",arg0); xutil::RestoreCursor(hCursor); return 1; } else if (comdid == L"action:bill.xmSaveAs" || comdid == L"xmSaveAs") { dw_list.SaveAs(L""); return 1; } else if (comdid.find(L"action:", 0) >= 0) { int ret1 = ProcessFlowAction(comdid, 1); if (comdid == L"action:bill.check.ask") { PostMessage(GetFrameWindow().GetHWND(), 0x401, (LPARAM)L"xmRefresh", 0); } return ret1; } } if (comdid == L"xmSearch") { OnRetrieve(); } else if (comdid == L"action:bill.refresh" || comdid == L"xmRefresh") { OnRetrieve(); } return 0; } int OnDoubleClicked(TEvent* evt, LPARAM p) { xstring dept = publiccode::GetUser().deptname; xstring dept1 = L"0"; if (dept == L"‘Ǎ-è") dept1 = L"1"; if (dept.find(L"NR¡") >= 0) dept1 = L"1"; if (dept1 == L"0") { DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; xstring colname = hdr.colname; int row = hdr.row; HCURSOR hCursor = xutil::SetCursorWait(); xaserverarg arg; xstring SampleFeeID = dw_list.GetGuid(row); arg.AddArg(L"SampleFeeID", SampleFeeID); OpenWindow(L"dev:xpage[maint.samplefee.vx]", arg); xutil::RestoreCursor(hCursor); } return 1; } //T}NäYtN‹Nö int OnXCommand(TEvent* evt, LPARAM param) { return OnCmdDispatch(evt->xcommand.pStrID); } int OnAttachEvent() { //~Ñ[š]åQwgap¹QûN‹Nö AttachEvent(L"WM_XCOMMAND", (FEvent)&SampleFeeList::OnXCommand); //ƒ·SÖq&p¹N‹Nöÿ u(NŽ‘Ín]åQwga AttachEvent(L"WM_SETFOCUS", (FEvent)&SampleFeeList::OnSetFocus); AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&SampleFeeList::OnDoubleClicked); AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&SampleFeeList::OnRowChanged); return 1; } int OnRetrieve() { xml x ; xaserverarg arg; xstring sdatetxt = L""; xstring edatetxt = L""; if (sdate.IsChecked()) sdatetxt = sdate.GetText(); if (edate.IsChecked()) edatetxt = edate.GetText(); xcontrol query = GetControl(L"sl_search"); xstring keyword = query.GetText(); arg.AddArg(L"keyword", keyword); arg.AddArg(L"sdate", sdatetxt); arg.AddArg(L"edate", edatetxt); HCURSOR hCursor = xutil::SetCursorWait(); if (getUrl(L"/sale/data/expense3/view/saplefeeList", arg.GetString(), x) != 1) { trace(x.text()); return -1; } else { dw_list.Retrieve(x); dw_list.Redraw(); dw_list.SetReadOnly(true); } xutil::RestoreCursor(hCursor); return 1; } int onload() { sdate = GetControl(L"sdate"); edate = GetControl(L"edate"); dw_list = GetControl(L"dw_list"); dw_list.openUrl(L"/sale/view/expense3/Sample/list"); xstring currdate = publiccode::GetCurrentDate(); dw_list.SetColumnState(L"SampleID", false); int curryear = currdate.mid(0, 4).toInt(); sdate.SetDatetime(curryear - 1, 1, 1); OnAttachEvent(); OnRetrieve(); dw_list.SetReadOnly(true); return 1; } int onloaded() { SetAgent(L"list", GetEntityID(1)); return 1; } };