From 6e93e717799723de98287f5a036ab34367bd08cd Mon Sep 17 00:00:00 2001
From: xj qian <qianxj15@sina.com>
Date: 星期五, 05 七月 2024 17:15:44 +0800
Subject: [PATCH] update some

---
 jrj/project/business/VATNotify/list.vatnotify.cpp |  410 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 410 insertions(+), 0 deletions(-)

diff --git a/jrj/project/business/VATNotify/list.vatnotify.cpp b/jrj/project/business/VATNotify/list.vatnotify.cpp
new file mode 100644
index 0000000..4ea5cfd
--- /dev/null
+++ b/jrj/project/business/VATNotify/list.vatnotify.cpp
@@ -0,0 +1,410 @@
+#include <wobject/xstring.hpp>
+#include <xcontrol/xtreeview.hpp>
+#include <xcontrol/xdwgrid.hpp>
+
+#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp"
+#include "viewobject/view.base.hpp"
+
+using xml = KXMLDOMDocument;
+	class __declspec(dllexport) listvatnotifyWin : public xframe
+	{
+	public:
+		xdwgrid	dw_list;
+		xdwpages dw_pages;
+		xdwtable dw_arg;
+
+		xnode	m_agentNode;	//Agent Condition
+
+		int 	m_pageindex;
+		int	m_pagenumber;
+		xstring 	m_QueryTxt;
+		xstring DatePicker;
+
+	public:
+		listvatnotifyWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
+	public:
+		static listvatnotifyWin* CreateInstance(void* implPtr, void* hWnd)
+		{
+			listvatnotifyWin* pWin = new listvatnotifyWin(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;
+		}
+
+		int OnDWClick(TEvent* evt, LPARAM p)
+		{
+			DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh;
+			xstring value = hdr.data;
+			xstring colname = hdr.colname;
+			int row = hdr.row;
+
+			if (row < 1) return 1;
+
+			xaserverarg arg;
+			if (colname == L"SONo")
+			{
+				xstring SONo = dw_list.GetItemString(row, colname);
+				;
+				
+				arg.AddArg(L"EntityNo", SONo);
+				arg.AddArg(L"ReadOnly", L"true");
+				OpenWindow(L"dev:xpage[base.maint.so.vx]", arg);
+			}
+			if (colname == L"InvoiceNo")
+			{
+				xstring InvoiceNo = dw_list.GetItemString(row, colname);
+				;
+				
+				arg.AddArg(L"EntityNo", InvoiceNo);
+				arg.AddArg(L"ReadOnly", L"true");
+				OpenWindow(L"dev:xpage[maintex.GDN3.vx]", arg);
+			}
+			return 1;
+		}
+
+		int OnPrint()
+		{
+			xaserverarg& arg = *new xaserverarg;
+			
+			arg.AddArg(L"EntityName", L"VATNotify");
+			arg.AddArg(L"EntityID", L"", L"");
+			xstring InvoiceNo = dw_list.GetItemString(dw_list.GetRow(), L"NInvoiceNo");
+			if (InvoiceNo == L"") InvoiceNo = dw_list.GetItemString(dw_list.GetRow(), L"InvoiceNo");
+
+			xstring NInvoiceNoEx = dw_list.GetItemString(dw_list.GetRow(), L"NInvoiceNo");
+			xstring InvoiceNoEx = dw_list.GetItemString(dw_list.GetRow(), L"InvoiceNo");
+			if (NInvoiceNoEx != InvoiceNoEx)
+			{
+				NInvoiceNoEx = InvoiceNoEx;
+			}
+			xstring SupplierID = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID");
+			arg.AddArg(L"EntityNo", InvoiceNo, L"");
+			arg.AddArg(L"EntityNoEx", NInvoiceNoEx, L"");
+			arg.AddArg(L"SupplierID", SupplierID);
+			arg.AddArg(L"VATNotifyID", L"");
+			trace(InvoiceNo + L"==1" + NInvoiceNoEx + L"==2" + SupplierID + L"==3" + dw_list.GetGuid(dw_list.GetRow()));
+			
+			openUrl(L"/sale/view/view.base/xpage/Template/PrintViewEx", &arg);
+			return 1;
+		}
+
+		int OnPrintItem()
+		{
+			xaserverarg& arg = *new xaserverarg;
+			
+			arg.AddArg(L"EntityName", L"VATNotify");
+			arg.AddArg(L"EntityID", L"", L"");
+			xstring InvoiceNo = dw_list.GetItemString(dw_list.GetRow(), L"NInvoiceNo");
+			if (InvoiceNo == L"") InvoiceNo = dw_list.GetItemString(dw_list.GetRow(), L"InvoiceNo");
+
+			xstring NInvoiceNoEx = dw_list.GetItemString(dw_list.GetRow(), L"NInvoiceNo");
+			xstring InvoiceNoEx = dw_list.GetItemString(dw_list.GetRow(), L"InvoiceNo");
+			if (NInvoiceNoEx != InvoiceNoEx)
+			{
+				NInvoiceNoEx = InvoiceNoEx;
+			}
+			xstring SupplierID = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID");
+			arg.AddArg(L"EntityNo", InvoiceNo, L"");
+			arg.AddArg(L"EntityNoEx", NInvoiceNoEx, L"");
+			arg.AddArg(L"SupplierID", SupplierID);
+			arg.AddArg(L"VATNotifyID", dw_list.GetGuid(dw_list.GetRow()));
+			trace(L"=====L" + InvoiceNo + L"=====L" + SupplierID + L"=====L" + dw_list.GetGuid(dw_list.GetRow()));
+			
+			openUrl(L"/sale/view/view.base/xpage/Template/PrintViewEx", &arg);
+			return 1;
+		}
+
+		int OnOpen() {
+			int row = dw_list.GetRow();
+			if (row < 1) return 0;
+			KXMLDOMElement ele = dw_list.GetRowElement(row);
+			xstring entityid = ele.selectSingleNode(L"InvoiceNo").text();
+			xaserverarg arg;
+			
+			arg.AddArg(L"invoiceno", entityid);
+			
+			OpenWindow(L"dev:xpage[simple.maint.vatnotify.vx]", arg);
+			return 1;
+		}
+
+		int OnPapercardOpen() {
+			int row = dw_list.GetRow();
+			if (row < 1) return 0;
+			KXMLDOMElement ele = dw_list.GetRowElement(row);
+			xstring entityid = ele.selectSingleNode(L"InvoiceNo").text();
+			xstring classifyID = ele.selectSingleNode(L"ClassifyID").text();
+			xstring supplierID = ele.selectSingleNode(L"SupplierID").text();
+			xstring cname = ele.selectSingleNode(L"CName").text();
+
+			xaserverarg arg;
+			
+			arg.AddArg(L"invoiceno", entityid);
+			arg.AddArg(L"ClassifyID", classifyID);
+			arg.AddArg(L"SupplierID", supplierID);
+			arg.AddArg(L"CName", cname);
+			
+			OpenWindow(L"dev:xpage[maint.papercard.vatnotify.vx]", arg);
+			return 1;
+		}
+
+		int OnModify() {
+			int row = dw_list.GetRow();
+			if (row < 1) return 0;
+			KXMLDOMElement ele = dw_list.GetRowElement(row);
+			xstring entityid = ele.selectSingleNode(L"InvoiceNo").text();
+			xaserverarg arg;
+			
+			arg.AddArg(L"invoiceno", entityid);
+			
+			OpenWindow(L"dev:xpage[update.vatnotify.vx]", arg);
+			return 1;
+		}
+
+		int Onfinish() {
+
+			return 1;
+		}
+
+		int OnDeleteRow()
+		{
+			if (dw_list.GetRow() < 1) return 1;
+			int row = dw_list.GetRow();
+			xstring InvoiceNo = dw_list.GetItemString(row, L"InvoiceNo");
+			int res = MessageBox(GetHWND(), L"是否确认删除" + InvoiceNo + L"的开票通知?", L"提示", 4);
+			if (res == 6)
+			{
+				xml x = ViewObject::RetrieveData(L"/sale/data/VATNotify/entity/delete", L"invoiceno", InvoiceNo);
+				if (!x)
+				{
+					alert(L"删除错误");
+					return 1;
+				}
+				//dw_list.DeleteRow(row);
+				alert(x.text());
+				OnRetrieve(DatePicker);
+			}
+
+			return 1;
+		}
+
+		//命令发布函数
+		int OnCmdDispatch(xstring comdid)
+		{
+			if (comdid == L"xm:import") {
+				OpenWindow(L"dev:xpage[import.vatnotify.vx]", 0);
+			}
+			if (comdid == L"action:bill.open") {
+				OnOpen();
+			}
+			else if (comdid == L"xm:notify") {
+				OnOpen();
+			}
+			else if (comdid == L"xm:papercardnotify") {
+				OnPapercardOpen();
+			}
+			else if (comdid == L"xm:modify") {
+				OnModify();
+			}
+			else if (comdid == L"xm:finish") {
+				Onfinish();
+			}
+			else if (comdid == L"xm:ratecalc") {
+
+			}
+			else if (comdid == L"find")
+			{
+				m_QueryTxt = GetControl(L"txt").GetText();
+				return OnRetrieve(DatePicker);
+			}
+			else if (comdid == L"xmRefresh")
+			{
+				return OnRetrieve(DatePicker);
+			}
+			else if (comdid == L"xmDeleteRow")
+			{
+				return OnDeleteRow();
+			}
+			else if (comdid == L"xmPrint") {
+				return OnPrint();
+			}
+			else if (comdid == L"xmPrintItem") {
+				return OnPrintItem();
+			}
+			else if (comdid == L"xmSaveAs")
+			{
+				dw_list.SaveAs(L"");
+				return 1;
+			}
+			return 0;
+		}
+
+		//命令处理事件
+		int OnXCommand(TEvent* evt, LPARAM param)
+		{
+			return OnCmdDispatch(evt->xcommand.pStrID);
+		}
+
+		int OnAttachEvent()
+		{
+			//绑定工具条点击事件
+			AttachEvent(L"WM_XCOMMAND", (FEvent)&listvatnotifyWin::OnXCommand);
+			//获取焦点事件,用于重置工具条
+			AttachEvent(L"WM_SETFOCUS", (FEvent)&listvatnotifyWin::OnSetFocus);
+			AttachEvent(L"dw_list", L"DWV_CLICKED", (FEvent)&listvatnotifyWin::OnDWClick);
+			AttachEvent(L"cbx_state", L"CBN_SELCHANGE", (FEvent)&listvatnotifyWin::OnDatePicker);
+			return 1;
+		}
+
+		int OnDatePicker(TEvent* evt, int lParam)
+		{
+			
+			DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh;
+
+			int h = xcombobox::GetCurSel(evt.hCtrl);
+			if (h > -1)
+			{
+				xstring txt = xcombobox::GetLBText(evt.hCtrl, h);
+				if (txt == L"通知日期")
+				{
+
+					DatePicker = L"NotifyDate";
+					OnRetrieve(DatePicker);
+				}
+				else if (txt == L"出运日期")
+				{
+
+					DatePicker = L"ETD";
+					OnRetrieve(DatePicker);
+				}
+			}
+			return 1;
+		}
+
+
+		xstring GetQueryArg()
+		{
+			dw_arg.AcceptText();
+			xml x ;
+			
+			dw_arg.DwUpdateAllTo(x);
+			return x.xml();
+		}
+
+		int  OnRetrieve(xstring DatePicker)
+		{
+			HCURSOR  hCursor = xutil::SetCursorWait();
+			xml x ;
+			
+			xaserverarg arg;
+			
+			arg.AddArg(L"pageindex", xstring(m_pageindex));
+			arg.AddArg(L"pagenumber", xstring(m_pagenumber));
+			arg.AddArg(L"QueryTxt", m_QueryTxt);
+			arg.AddArg(L"QueryArg", GetQueryArg());
+			arg.AddArg(L"DatePicker", DatePicker);
+			if (getUrl(L"/sale/data/VATNotify/entity/listOne", arg.GetString(), x) != 1)
+			{
+				trace(x.text());
+				xutil::RestoreCursor(hCursor);
+				return -1;
+			}
+			else
+			{
+				//trace(x.xml);
+				KXMLDOMElement ele = x.documentElement();
+				if (dw_pages.ptr_native_)
+				{
+					if (ele.selectSingleNode(L"@TotalPage"))
+					{
+						xstring s = ele.selectSingleNode(L"@TotalPage").text(); //总数量				
+						dw_pages.SetMaxPage(s.toInt());
+					}
+				}
+				dw_list.Retrieve(x);
+				dw_list.Redraw();
+				dw_list.SetReadOnly(true);
+			}
+			xutil::RestoreCursor(hCursor);
+			return 1;
+		}
+
+		int OnChangePages(TEvent* evt, LPARAM p)
+		{
+			PAGENMHDR& h = *(PAGENMHDR*)evt->notify.pnmh;
+			int c = h.cur;
+			HCURSOR hCursor = xutil::SetCursorWait();
+			m_pageindex = c;
+			OnRetrieve(DatePicker);
+			xutil::RestoreCursor(hCursor);
+			return 1;
+		}
+
+		int OnDoubleClicked(TEvent* evt, LPARAM p)
+		{
+			HCURSOR hCursor = xutil::SetCursorWait();
+			OnCmdDispatch(L"action:bill.open");
+			xutil::RestoreCursor(hCursor);
+			return 1;
+		}
+
+		int onload()
+		{
+			dw_list = GetControl(L"dw_list");
+			dw_list.openUrl(L"/sale/view/VATNotify/template/VATNotify/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);
+			dw_arg.SetItemString(1, L"DateType", L"本月");
+			//dw_arg.SetItemString(1,L"DateType",L"");
+			AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listvatnotifyWin::OnDoubleClicked);//行双击
+			dw_pages = GetControl(L"pages");
+			AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listvatnotifyWin::OnChangePages);
+
+
+			OnAttachEvent();
+
+			return 1;
+		}
+
+		int onloaded()
+		{
+			SetAgent();
+
+			m_pageindex = 1;
+			m_pagenumber = 10000;
+			m_QueryTxt = L"";
+
+			//OnRetrieve();
+
+			return 1;
+		}
+	};

--
Gitblit v1.9.3