From a4ff40b952d9fd744aec49fae5e645ed7736b673 Mon Sep 17 00:00:00 2001
From: lifan <2308045698@qq.com>
Date: 星期二, 23 六月 2026 17:43:33 +0800
Subject: [PATCH] update

---
 jrj/project/business/AP/list.Test.ap.cpp |  343 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 jrj/ext-jrj/ext-jrj.vcxproj              |    1 
 jrj/ext-jrj/ext-jrj.vcxproj.filters      |    3 
 3 files changed, 347 insertions(+), 0 deletions(-)

diff --git a/jrj/ext-jrj/ext-jrj.vcxproj b/jrj/ext-jrj/ext-jrj.vcxproj
index 393e1c8..a5b5e33 100644
--- a/jrj/ext-jrj/ext-jrj.vcxproj
+++ b/jrj/ext-jrj/ext-jrj.vcxproj
@@ -325,6 +325,7 @@
     <ClCompile Include="..\project\business\AP\list.manageSupplierID.ap.cpp" />
     <ClCompile Include="..\project\business\AP\list.RefundGDNLine.Entity.xarch.cpp" />
     <ClCompile Include="..\project\business\AP\list.RefundSourcingLine.Entity.xarch.cpp" />
+    <ClCompile Include="..\project\business\AP\list.Test.ap.cpp" />
     <ClCompile Include="..\project\business\AP\maint.ap.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
     </ClCompile>
diff --git a/jrj/ext-jrj/ext-jrj.vcxproj.filters b/jrj/ext-jrj/ext-jrj.vcxproj.filters
index 2ac2814..7eaf7b7 100644
--- a/jrj/ext-jrj/ext-jrj.vcxproj.filters
+++ b/jrj/ext-jrj/ext-jrj.vcxproj.filters
@@ -1652,6 +1652,9 @@
     <ClCompile Include="..\project\total3\FactoryPaymentMethod.cpp">
       <Filter>vbusiness\total</Filter>
     </ClCompile>
+    <ClCompile Include="..\project\business\AP\list.Test.ap.cpp">
+      <Filter>project\business\AP</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <None Include="ext-jrj.def">
diff --git a/jrj/project/business/AP/list.Test.ap.cpp b/jrj/project/business/AP/list.Test.ap.cpp
new file mode 100644
index 0000000..b4d20be
--- /dev/null
+++ b/jrj/project/business/AP/list.Test.ap.cpp
@@ -0,0 +1,343 @@
+#include <wobject/xstring.hpp>
+#include <xcontrol/xtreeview.hpp>
+#include <xcontrol/xdwgrid.hpp>
+#include <wobject/xdouble.hpp>
+#include <xcontrol/xlayersheet.hpp>
+#include <xcontrol/xdatetimepick.hpp>
+
+#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp"
+#include "viewobject/view.base.hpp"
+using xml = KXMLDOMDocument;
+class __declspec(dllexport) ListTestAP : public xframe
+{
+public:
+	xstring apType;
+	xdwgrid	dw_list;
+	xdwtable dw_arg;
+	xnode	m_agentNode;	//Agent Condition
+	xstring printStr = L"";
+public:
+	ListTestAP(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
+public:
+	static ListTestAP* CreateInstance(void* implPtr, void* hWnd)
+	{
+		ListTestAP* pWin = new ListTestAP(implPtr, (HWND)hWnd);
+		return pWin;
+	}
+	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;
+	}
+
+	//鐒︾偣婵�娲诲鐞嗗嚱鏁�
+	int OnSetFocus(TEvent* evt, LPARAM param)
+	{
+		//閲嶇疆宸ュ叿鏉�
+		SetAgent();
+		return 1;
+	}
+
+	xstring GetPayType()
+	{
+		xcombobox cbx_type = GetControl(L"cbx_type");
+		int h = xcombobox::GetCurSel(cbx_type.GetHWND());
+		if (h < 0) return L"";
+		return xcombobox::GetLBText(cbx_type.GetHWND(), h);
+	}
+
+	int OnBank()
+	{
+		xaserverarg arg;
+
+		OpenWindow(L"dev:xpage[APBank.vx]", arg);
+		if (arg.GetArgString(L"result") == L"ok")
+		{
+			int ll_row = dw_list.GetNextSelectRow(1);
+			dw_list.AcceptText();
+
+			while (ll_row > 0 && ll_row <= dw_list.GetRowCount())
+			{
+				dw_list.SetItemString(ll_row, L"PayedTerm", arg.GetArgString(L"PayedTerm"));
+				dw_list.SetItemString(ll_row, L"PayedBank", arg.GetArgString(L"PayedBank"));
+				dw_list.SetItemString(ll_row, L"PayedBankNo", arg.GetArgString(L"PayedBankNo"));
+				ll_row = dw_list.GetNextSelectRow(ll_row + 1);
+			}
+			dw_list.Redraw();
+			return 1;
+		}
+		else return 1;
+	}
+
+	//鍛戒护鍙戝竷鍑芥暟
+	int OnCmdDispatch(xstring comdid)
+	{
+		xstring payType = GetPayType();
+
+
+
+		if (comdid == L"xmBank") return OnBank();
+		if (comdid == L"xmSave") return OnSave();
+		if (comdid == L"xmRefresh" || comdid == L"xmSearch")
+		{
+			return OnRetrieveEx(apType);
+		}
+		if (comdid == L"xmAddRow")
+		{
+			xaserverarg arg1;
+
+			if (payType == L"杩愭潅璐�" or payType == L"娴嬭瘯璐�")
+				arg1.AddArg(L"payType", payType);
+			OpenWindow(L"dev:xpage[maint.expense.ap.vx]", arg1);
+			return 1;
+		}
+		if (comdid == L"xmModifyRow")
+		{
+			xaserverarg arg;
+			int row = dw_list.GetRow();
+			if (row < 1) return 1;
+			KXMLDOMElement ele = dw_list.GetRowElement(row);
+			xstring APID = ele.selectSingleNode(L"APID").text();
+
+			arg.AddArg(L"APID", APID);
+			arg.AddArg(L"payType", payType);
+			OpenWindow(L"dev:xpage[maint.expense.ap.vx]", arg);
+			return 1;
+		}
+		if (comdid == L"xmDeleteRow")
+		{
+			int row = dw_list.GetRow();
+			if (row < 1) return 1;
+			KXMLDOMElement ele = dw_list.GetRowElement(row);
+			xstring APID1 = ele.selectSingleNode(L"APID").text();
+
+			int MB_OKCANCEL = 1;
+			int IDOK = 1;
+			int ret = MessageBox(GetHWND(), L"纭鍒犻櫎浜у搧娴嬭瘯璐�?", L"鎻愮ず", MB_OKCANCEL);
+			if (ret == IDOK)
+			{
+				ViewObject::RetrieveData(L"/sale/data/AP/delete/AP", L"EntityID", APID1);
+				OnRetrieveEx(apType);
+			}
+
+
+			return 1;
+		}
+		if (comdid == L"xmPrint")
+		{
+			return OnPrint();
+		}
+		return 0;
+	}
+
+	int OnPrint()
+	{
+		int row = dw_list.GetRow();
+		if (row < 1) return 1;
+		xstring APID = dw_list.GetItemString(row, L"APID");
+
+		if (printStr == L"")printStr = L" " + APID;
+
+		xaserverarg arg;
+		arg.AddArg(L"EntityName", L"AP");
+		arg.AddArg(L"EntityID", printStr, L"");
+		arg.AddArg(L"EntityNo", L"", L"");
+
+		openUrl(L"/sale/view/view.base/xpage/Template/PrintViewEx", arg);
+		return 1;
+	}
+
+	int OnDoubleClicked(TEvent* evt, LPARAM p)
+	{
+		return OnCmdDispatch(L"xmModifyRow");
+	}
+
+	int OnCombboChanged(TEvent* evt, LPARAM lParam)
+	{
+		xstring id = L"";
+		xstring name = L"";
+		int h = xcombobox::GetCurSel(evt->command.hCtrl);
+		if (h > -1)
+		{
+			xstring txt = (string)xcombobox::GetLBText(evt->command.hCtrl, h);
+			apType = L"---";
+			if (txt == L"杩愭潅璐�")
+			{
+				dw_list.openUrl(L"/sale/view/AP/template/AP/Expense/List");
+				apType = L"003";
+			}
+			if (txt == L"娴嬭瘯璐�")
+			{
+				dw_list.openUrl(L"/sale/view/AP/template/AP/Expense/List");
+				apType = L"021";
+			}
+			OnRetrieveEx(apType);
+		}
+		return 1;
+	}
+
+	//鍛戒护澶勭悊浜嬩欢
+	int OnXCommand(TEvent* evt, LPARAM param)
+	{
+		return OnCmdDispatch(evt->xcommand.pStrID);
+	}
+
+	int OnAttachEvent()
+	{
+		//缁戝畾宸ュ叿鏉$偣鍑讳簨浠�
+		AttachEvent(L"WM_XCOMMAND", (FEvent)&ListTestAP::OnXCommand);
+		//鑾峰彇鐒︾偣浜嬩欢锛岀敤浜庨噸缃伐鍏锋潯
+		AttachEvent(L"WM_SETFOCUS", (FEvent)&ListTestAP::OnSetFocus);
+		AttachEvent(L"cbx_type", L"CBN_SELCHANGE", (FEvent)&ListTestAP::OnCombboChanged);//灞炴�х粍鍒囨崲list涓垪鐨勬暟閲忓彉鍖�
+		AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&ListTestAP::OnDoubleClicked);//琛屽弻鍑�
+		AttachEvent(L"dw_list", L"DWV_CLICKED", (FEvent)&ListTestAP::OnDwClicked);
+		return 1;
+	}
+
+	int OnDwClicked(TEvent* evt, int p)
+	{
+		DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh;
+		char ch;
+		int row = hdr.row;
+		xstring col = hdr.colname;
+
+		xstring str = L"";
+
+		if (dw_list.GetItemString(row, L"APID") != L"")
+		{
+			str = dw_list.GetItemString(row, L"APID");
+		}
+
+		if (dw_list.IsRowSelected(row) & 0xff)
+		{
+			printStr = printStr.replace(L" " + str, L"");
+		}
+		else
+		{
+			printStr += L" " + str;
+		}
+		return 1;
+	}
+
+	int OnSave()
+	{
+		xml x;
+
+		dw_list.DwUpdateAllToEx(x);
+
+		xml x1;
+
+		x1.loadXML(L"<data/>");
+
+		dw_list.DwUpdateAllToEx(x);
+		KXMLDOMNodeList t = x.selectNodes(L"data/Item[@update.modify]");
+		KXMLDOMElement e1 = x1.documentElement();
+		int len = t.length();
+		for (int i = 0; i < len; i++)
+		{
+			e1.appendChild(t.item(i));
+		}
+		//t.Release();
+		e1.Release();
+		//trace(x1.xml());
+		//return 1;
+
+		xaserverarg arg;
+
+		arg.AddArg(L"content", x1.xml());
+		if (xurl::get(L"/sale/data/AP/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;
+	}
+
+	xstring GetQueryArg()
+	{
+		dw_arg.AcceptText();
+		xml x;
+
+		dw_arg.DwUpdateAllTo(x);
+		return x.xml();
+	}
+
+	int  OnRetrieveEx(xstring APType)
+	{
+		xml x;
+
+		xaserverarg arg;
+
+		arg.AddArg(L"QueryTxt", xcontrol(GetControl(L"sle_search")).GetText());
+		arg.AddArg(L"APType", APType);
+		arg.AddArg(L"QueryArg", GetQueryArg());
+		arg.AddArg(L"DatePicker", L"APDate");
+		if (getUrl(L"/sale/data/AP/list", arg.GetString(), x) != 1)
+		{
+			trace(x.text());
+			return -1;
+		}
+		else
+		{
+			dw_list.Retrieve(x);
+			dw_list.Redraw();
+			dw_list.SetReadOnly(true);
+			dw_list.SetSelectionMode(3);
+		}
+		return 1;
+	}
+
+
+	int onload()
+	{
+		dw_list = GetControl(L"dw_list");
+		dw_list.openUrl(L"/sale/view/AP/template/AP/Expense/List");
+
+		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);
+
+
+		OnAttachEvent();
+		apType = L"003";
+		OnRetrieveEx(apType);
+
+		return 1;
+	}
+
+	int onloaded()
+	{
+		SetAgent();
+
+		return 1;
+	}
+};
\ No newline at end of file

--
Gitblit v1.9.3