From 7a91c3a1ed37b0332d4ff0ebeae60bd6da3665c0 Mon Sep 17 00:00:00 2001 From: xj qian <qianxj15@sina.com> Date: 星期二, 16 七月 2024 18:28:58 +0800 Subject: [PATCH] Merge branch 'master' of http://116.62.18.175:6699/r/mis-prj --- jrj/project/business/BasicCode/SKUItem.categoryselect.cpp | 216 + jrj/project/business/BasicCode/ForwarderList.cpp | 135 jrj/project/business/BasicCode/AddUomGroup.cpp | 121 jrj/project/business/GDN/CustomCodeNew.cpp | 0 jrj/project/business/BasicCode/PaymentTerm.maint.cpp | 429 +++ jrj/project/business/BasicCode/SKUTemplate.cpp | 427 +++ jrj/project/business/BasicCode/basicfareTypeList.cpp | 158 + jrj/project/business/BasicCode/TestingCompanyMaint.cpp | 321 ++ jrj/project/business/BasicCode/ProfitParam.cpp | 140 + jrj/ext-jrj/ext-jrj.vcxproj.filters | 117 jrj/project/business/BasicCode/ShipcompanyList.cpp | 41 jrj/project/business/BasicCode/ExchangeRate.cpp | 226 + jrj/project/business/BasicCode/FCL.cpp | 354 ++ jrj/project/business/BasicCode/BrandInforMaint.cpp | 100 jrj/project/business/BasicCode/QuickCode_Tree.cpp | 696 ++++ jrj/project/business/BasicCode/ColorCardNew.cpp | 416 ++ jrj/project/business/BasicCode/ForwarderMaint.cpp | 467 +++ jrj/project/business/BasicCode/ExpressList.cpp | 41 jrj/project/business/BasicCode/QuickCode.cpp | 678 ++++ jrj/project/business/BasicCode/CustomerMarketMaint.cpp | 92 jrj/project/business/BasicCode/TypeList.maint.supplier.cpp | 186 + jrj/project/business/BasicCode/SetUpRemarks.cpp | 158 + jrj/project/business/BasicCode/AccountUnitMaint.cpp | 155 + jrj/project/business/BasicCode/TestingCompanyList.cpp | 42 jrj/project/business/BasicCode/Simple.Menu.Config.cpp | 276 + jrj/project/business/BasicCode/brand.regtype.cpp | 161 + jrj/project/business/BasicCode/CartermList.cpp | 170 + jrj/project/business/BasicCode/SKUItem.select.cpp | 126 jrj/project/business/BasicCode/ShipcompanyMaint.cpp | 320 ++ jrj/project/business/BasicCode/ExpressMaint.cpp | 346 ++ jrj/project/business/BasicCode/CustomerMarketList.cpp | 38 jrj/project/business/BasicCode/SpecialDeductFeeList.cpp | 159 + jrj/project/business/BasicCode/FreightExpenseType.cpp | 176 + jrj/project/business/BasicCode/SKUTemplate.select.cpp | 120 jrj/project/business/BasicCode/SourceRemark.cpp | 158 + jrj/project/business/BasicCode/BrandInforList.cpp | 39 jrj/project/business/BasicCode/SKUItem.cpp | 310 ++ jrj/ext-jrj/ext-jrj.vcxproj | 110 jrj/project/business/BasicCode/PaymentTerm.list.cpp | 144 + 39 files changed, 8,365 insertions(+), 4 deletions(-) diff --git a/jrj/ext-jrj/ext-jrj.vcxproj b/jrj/ext-jrj/ext-jrj.vcxproj index 551ba31..4013c16 100644 --- a/jrj/ext-jrj/ext-jrj.vcxproj +++ b/jrj/ext-jrj/ext-jrj.vcxproj @@ -287,6 +287,114 @@ <ClCompile Include="..\project\business\AR\maint.SettlementExchange.cpp"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> </ClCompile> + <ClCompile Include="..\project\business\BasicCode\AccountUnitMaint.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\AddUomGroup.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\basicfareTypeList.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\brand.regtype.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\BrandInforList.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\BrandInforMaint.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\CartermList.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\ColorCardNew.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\CustomerMarketList.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\CustomerMarketMaint.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\ExchangeRate.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\ExpressList.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\ExpressMaint.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\FCL.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\ForwarderList.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\ForwarderMaint.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\FreightExpenseType.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\PaymentTerm.list.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\PaymentTerm.maint.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\ProfitParam.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\QuickCode.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\QuickCode_Tree.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\SetUpRemarks.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\ShipcompanyList.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\ShipcompanyMaint.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\Simple.Menu.Config.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\SKUItem.categoryselect.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\SKUItem.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\SKUItem.select.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\SKUTemplate.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\SKUTemplate.select.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\SourceRemark.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\SpecialDeductFeeList.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\TestingCompanyList.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\TestingCompanyMaint.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\TypeList.maint.supplier.cpp"> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> + </ClCompile> <ClCompile Include="..\project\business\Company\CompanyList.cpp"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> </ClCompile> @@ -483,7 +591,7 @@ </ClCompile> <ClCompile Include="..\project\business\GDN\AdvanceChargeList.cpp" /> <ClCompile Include="..\project\business\GDN\CustomCodeNew.cpp"> - <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> + <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> </ClCompile> <ClCompile Include="..\project\business\GDN\GDNDelay.cpp"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> diff --git a/jrj/ext-jrj/ext-jrj.vcxproj.filters b/jrj/ext-jrj/ext-jrj.vcxproj.filters index edac3b9..965a48d 100644 --- a/jrj/ext-jrj/ext-jrj.vcxproj.filters +++ b/jrj/ext-jrj/ext-jrj.vcxproj.filters @@ -115,6 +115,9 @@ <Filter Include="project\business\Company"> <UniqueIdentifier>{84413ffb-b8a4-4dfe-a715-ef03dec8f2ef}</UniqueIdentifier> </Filter> + <Filter Include="project\business\BasicCode"> + <UniqueIdentifier>{64c23153-69c8-4db3-9225-9e5375e489ff}</UniqueIdentifier> + </Filter> </ItemGroup> <ItemGroup> <ClInclude Include="framework.h"> @@ -839,9 +842,6 @@ <ClCompile Include="..\project\total3\viewex.total2.cpp"> <Filter>vbusiness\total</Filter> </ClCompile> - <ClCompile Include="..\project\business\GDN\CustomCodeNew.cpp"> - <Filter>project\business\GDN</Filter> - </ClCompile> <ClCompile Include="..\project\business\GDN\po.paper.cpp"> <Filter>project\business\GDN</Filter> </ClCompile> @@ -908,5 +908,116 @@ <ClCompile Include="..\project\total3\ViewTotalWin.cpp"> <Filter>vbusiness\total</Filter> </ClCompile> + <ClCompile Include="..\project\business\GDN\CustomCodeNew.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\AccountUnitMaint.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\AddUomGroup.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\basicfareTypeList.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\brand.regtype.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\BrandInforList.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\BrandInforMaint.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\CartermList.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\ColorCardNew.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\CustomerMarketList.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\CustomerMarketMaint.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\ExchangeRate.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\ExpressList.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\ExpressMaint.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\FCL.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\ForwarderList.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\ForwarderMaint.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\FreightExpenseType.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\PaymentTerm.list.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\PaymentTerm.maint.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\ProfitParam.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\QuickCode.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\QuickCode_Tree.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\SetUpRemarks.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\ShipcompanyList.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\ShipcompanyMaint.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\Simple.Menu.Config.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\SKUItem.categoryselect.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\SKUItem.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\SKUItem.select.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\SKUTemplate.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\SKUTemplate.select.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\SourceRemark.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\SpecialDeductFeeList.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\TestingCompanyList.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\TestingCompanyMaint.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> + <ClCompile Include="..\project\business\BasicCode\TypeList.maint.supplier.cpp"> + <Filter>project\business\BasicCode</Filter> + </ClCompile> </ItemGroup> </Project> \ No newline at end of file diff --git a/jrj/project/business/BasicCode/AccountUnitMaint.cpp b/jrj/project/business/BasicCode/AccountUnitMaint.cpp new file mode 100644 index 0000000..25eb97f --- /dev/null +++ b/jrj/project/business/BasicCode/AccountUnitMaint.cpp @@ -0,0 +1,155 @@ +#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) AccountUnitMaintWin : public xwin + { + public: + xdwgrid dw_list; + xnode m_agentNode; //Agent Condition + public: + AccountUnitMaintWin(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} + public: + static AccountUnitMaintWin* CreateInstance(void* implPtr, void* hWnd) + { + AccountUnitMaintWin* pWin = new AccountUnitMaintWin(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 OnCmdDispatch(xstring comdid) + { + if(comdid==L"xmAddRow") + { + dw_list.InsertRow(0); + return 1; + } + else if(comdid==L"xmDeleteRow") + { + dw_list.DeleteRow(0); + return 1; + } + else if(comdid==L"xmSave") + return OnSave(); + else if(comdid==L"xmRefresh") + return OnRetrieve(); + return 0; + } + + //命令处理事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&AccountUnitMaintWin::OnXCommand); + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&AccountUnitMaintWin::OnSetFocus); + return 1; + } + + int OnSave() + { + xml x; + + dw_list.DwUpdateAllToEx(x); + xaserverarg arg; + + arg.AddArg(L"content",x.xml()); + if (xurl::get(L"/sale/data/TradeFinance3/accountunit/update",arg.GetString(),x) != 1) + { + trace(L"error:"+(xstring)x.xml()); + alert(L"保存失败!"); + return 0; + } + else + { + trace(x.xml()); + if(x.selectSingleNode(L"error")) + { + alert(L"保存出错2!"); + return 0; + } + MessageBox(GetHWND(),L"保存成功!",L"提示",0); + dw_list.ResetUpdateStatus(); + } + dw_list.Redraw(); + return 1; + } + + int OnRetrieve() + { + xml x = new xml; + + xaserverarg arg; + + if (xurl::get(L"/sale/data/TradeFinance3/accountunit/list",arg.GetString(),x)!=1) + { + trace(x.text()); + return -1; + }else + { + dw_list.Retrieve(x); + dw_list.Redraw(); + } + return 1; + } + + int onload() + { + dw_list = GetControl(L"dw_list"); + dw_list.openUrl(L"/sale/view/FinancialCode/template/AccountUnit"); + dw_list.SetColumnState(L"TAUID",false); + + OnRetrieve(); + + OnAttachEvent(); + return 1; + } + + int onloaded() + { + SetAgent(); + + return 1; + } + }; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/AddUomGroup.cpp b/jrj/project/business/BasicCode/AddUomGroup.cpp new file mode 100644 index 0000000..2327ddd --- /dev/null +++ b/jrj/project/business/BasicCode/AddUomGroup.cpp @@ -0,0 +1,121 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) AddUomGroup : public xwin +{ + +public: + AddUomGroup(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} +public: + static AddUomGroup* CreateInstance(void* implPtr, void* hWnd) + { + AddUomGroup* pWin = new AddUomGroup(implPtr, (HWND)hWnd); + return pWin; + } + + + int SetAgent() + { + return 1; + } + //焦点激活处理函数 + int OnSetFocus(TEvent* evt, LPARAM p) + { + int SetAgent(); + + //重置工具条 + return 1; + } + + //命令发布函数 + int OnCmdDispatch(xstring comdid) + { + if (comdid == L"cb_cancel") + CloseWindow(); + else if (comdid == L"cb_ok") + { + control xc = new control; + xc.setNativePointer(GetControl(L"Txt")); + xstring name = xc.GetText(); + xaserverarg arg; + + arg = GetArg(); + arg.AddArg(L"GroupName", name); + arg.AddArg(L"return", L"ok"); + CloseWindow(); + } + return 0; + } + + //命令处理事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&AddUomGroup::OnXCommand); + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&AddUomGroup::OnSetFocus); + return 1; + } + + int OnInitial() + { + SetAgent(); + + OnAttachEvent(); + + return 1; + } + + + + int onload() + { + SetArg(); + OnInitial(); + + + + if (GetWinParam()) + { + xaserverarg arg; + + arg = GetArg(); + xstring note = arg.GetArgString(L"note"); + if (note == L"修改") + { + xstring name = arg.GetArgString(L"GroupName"); + control xc = new control; + xc.setNativePointer(GetControl(L"Txt")); + xc.SetText(name); + } + xstring id = arg.GetArgString(L"m_id"); + if (id == L"FND_UOM") + { + SetWindowText(GetHWND(), L"计量单位"); + } + else if (id == L"FND_CustomerSource") + { + SetWindowText(GetHWND(), L"客户来源"); + } + else if (id == L"FND_AuxiliaryAttribute") + { + SetWindowText(GetHWND(), L"辅助属性"); + } + } + + + return 1; + } +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/BrandInforList.cpp b/jrj/project/business/BasicCode/BrandInforList.cpp new file mode 100644 index 0000000..4d9c6ad --- /dev/null +++ b/jrj/project/business/BasicCode/BrandInforList.cpp @@ -0,0 +1,39 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) BrandInforList : public xwin +{ +public: + xdwgrid dw_list; +public: + BrandInforList(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} +public: + static BrandInforList* CreateInstance(void* implPtr, void* hWnd) + { + BrandInforList* pWin = new BrandInforList(implPtr, (HWND)hWnd); + return pWin; + } + + + int ViewUpdate(param pr, xstring updateItem, xaserverarg arg) + { + if (updateItem == L"del") { + int DelRow = dw_list.GetRow(); + dw_list.DeleteRow(DelRow); + } + return 1; + } + int onload() + { + list::onload(); + return -1; + } + +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/BrandInforMaint.cpp b/jrj/project/business/BasicCode/BrandInforMaint.cpp new file mode 100644 index 0000000..5784bec --- /dev/null +++ b/jrj/project/business/BasicCode/BrandInforMaint.cpp @@ -0,0 +1,100 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) BrandInforMaint : public xframe +{ +public: + + KXMLDOMDocument m_configDoc; + xstring m_userid; + xstring m_username; + xstring ContactID; + xdwtable dw_base; + xcell dw_cell; +public: + BrandInforMaint(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} +public: + static BrandInforMaint* CreateInstance(void* implPtr, void* hWnd) + { + BrandInforMaint* pWin = new BrandInforMaint(implPtr, (HWND)hWnd); + return pWin; + } + int alert(xstring str) + { + //win::MessageBox(GetHWND(),str,L"提示22:",0); + TApp::alert(this, str); + return 0; + } + int ViewUpdate(param pr, xstring updateItem, xaserverarg arg) + { + if (updateItem == L"update") + { + + dw_base.ResetUpdateStatus(); + return 1; + } + } + xstring GetEntityData(param pr) + { + xml x; + + dw_base.DwUpdateAllTo(x); + //trace(L"------x"); + trace(x.xml()); + return x.xml(); + } + int onload() + { + maint::onload(); + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + + dw_base.SetColHeaderHeight(0); + dw_base.SetRowSelectorWidth(0); + + dw_base.SetScrollState(false); + + + /*if (!maint::m_EntityID) + { + //xstring suserid = publiccode::GetUser().id; + xstring suserid = xaserver::GetUserId(); + xstring susername = publiccode::GetUser().name; + xstring sdate = publiccode::GetCurrentDate(); + dw_base.SetItemString(dw_base.GetRow(),L"CreatorID",suserid);//Party + dw_base.SetItemDisplayString(dw_base.GetRow(),L"CreatorID",susername); + dw_base.SetItemString(dw_base.GetRow(),L"CreateDate",sdate); + xml x; + + xaserverarg arg; + + arg.AddArg(L"id", suserid); + if(xaserver::ExecXQuery(L"",L"[OrgInfo.xq]",arg.GetString(),x)!=1) + { + trace(x.xml()); + return nil; + } + //alert(x.xml()); + KXMLDOMElement e= x.documentElement(); + trace(e.xml); + if(e.selectSingleNode(L"orgid")) + { + xstring orgid= e.selectSingleNode(L"orgid").text(); + dw_base.SetItemString(1,L"OrgID",orgid); + } + + if(e.selectSingleNode(L"orgname")) + { + xstring orgname = e.selectSingleNode(L"orgname").text(); + dw_base.SetItemDisplayString(1,L"OrgID",orgname); + } + }*/ + } +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/CartermList.cpp b/jrj/project/business/BasicCode/CartermList.cpp new file mode 100644 index 0000000..01afbee --- /dev/null +++ b/jrj/project/business/BasicCode/CartermList.cpp @@ -0,0 +1,170 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) CartermList : public xwin +{ +public: + xdwgrid dw_list; + xdwpages dw_pages; + xstring m_QueryTxt; + KXMLDOMDocument m_configDoc; + static int dw_hWnd; + +public: + CartermList(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} +public: + static CartermList* CreateInstance(void* implPtr, void* hWnd) + { + CartermList* pWin = new CartermList(implPtr, (HWND)hWnd); + return pWin; + } + int alert(xstring str) + { + //win::MessageBox(GetHWND(),str,L"提示22:",0); + TApp::alert(this, str); + return 0; + } + + + xstring GetGuid() { + return publiccode::GetGuid(); + } + int OnAddrow() + { + dw_list.InsertRow(0); + int rows = dw_list.GetRowCount(); + dw_list.SetRow(rows); + dw_list.SetItemString(rows, L"PartyID", GetGuid()); + dw_list.SetItemString(rows, L"ContactID", GetGuid()); + dw_list.SetItemString(rows, L"PAStatus", L"1"); + dw_list.SetItemString(rows, L"PStatus", L"1"); + dw_list.SetItemString(rows, L"PCStatus", L"1"); + dw_list.SetItemString(rows, L"Type", L"7"); + } + int OnInsertRow() + { + int row = dw_list.GetRow(); + if (row<1 || row>dw_list.GetRowCount()) return 0; + dw_list.InsertRow(row); + dw_list.SetItemString(row, L"PartyID", GetGuid()); + dw_list.SetItemString(row, L"ContactID", GetGuid()); + dw_list.SetItemString(row, L"PAStatus", L"1"); + dw_list.SetItemString(row, L"PStatus", L"1"); + dw_list.SetItemString(row, L"PCStatus", L"1"); + dw_list.SetItemString(row, L"Type", L"7"); + } + + int ViewUpdate(param pr, xstring updateItem, xaserverarg arg) + { + if (updateItem == L"del") + { + int DelRow = dw_list.GetRow(); + dw_list.DeleteRow(DelRow); + + } + + return 1; + } + + int OnDeleteRow() + { + int rows = dw_list.GetRowCount(); + int row2 = dw_list.GetPrevSelectRow(rows); + while (row2 > 0) { + dw_list.DeleteRow(row2); + row2 = dw_list.GetPrevSelectRow(row2 - 1); + } + dw_list.SelectRow(0, false); + } + + int OnSave() + { + /*xstring no = dw_list.GetItemString(1,L"CarTermNo"); + if(no==L""){ + alert(L"请输入车队编码!"); + return -1; + } + xstring SName = dw_list.GetItemString(1,L"Name"); + if(SName==L""){ + alert(L"请输入车队名称!"); + return -1; + } + xstring ContacterName = dw_list.GetItemString(1,L"ContacterName"); + if(ContacterName==L""){ + alert(L"请输入联系人名称!"); + return -1; + } */ + xml x; + + dw_list.AcceptText(); + dw_list.DwUpdateAllToEx(x); + trace(x.xml()); + xaserverarg arg; + + arg.AddArg(L"content", x.xml()); + arg.AddArg(L"dbmap", L"CarTerm.dbmap"); + if (xurl::get(L"/sale/data/CarTerm/entity/carterm/save", arg.GetString(), x) != 1) + { + trace(L"error:" + (xstring)x.xml()); + alert(L"保存失败!"); + return 0; + } + else + { + trace(x.xml()); + if (x.selectSingleNode(L"error")) + { + alert(L"保存出错2!"); + return 0; + } + alert(L"保存成功!"); + dw_list.ResetUpdateStatus(); + } + dw_list.Redraw(); + return 0; + } + int OnCmdDispatch(xstring comdid) + { + if (comdid.find(L"action:bill.row.add", 0) >= 0) { + OnAddrow(); + } + else if (comdid.find(L"bill.row.insert", 0) >= 0) { + OnInsertRow(); + } + else if (comdid.find(L"bill.row.delete", 0) >= 0) { + OnDeleteRow(); + } + else if (comdid.find(L"bill.save", 0) >= 0) { + //trace(1); + OnSave(); + } + return 0; + } + + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnAttachEvent() + { + AttachEvent(L"WM_XCOMMAND", (FEvent)&CartermList::OnXCommand); + return 1; + } + + int onload() + { + OnAttachEvent(); + list::onload(); + dw_list.SetReadOnly(false); + return -1; + } + +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/ColorCardNew.cpp b/jrj/project/business/BasicCode/ColorCardNew.cpp new file mode 100644 index 0000000..d749027 --- /dev/null +++ b/jrj/project/business/BasicCode/ColorCardNew.cpp @@ -0,0 +1,416 @@ +#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) ColorCardNew : public listwin +{ +public: + xdwgrid dw_list; + xdwgrid dw_detail; + bool ismodify; + xnode m_agentNode; + xstring m_agentCond; +public: + ColorCardNew(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} +public: + static ColorCardNew* CreateInstance(void* implPtr, void* hWnd) + { + ColorCardNew* pWin = new ColorCardNew(implPtr, (HWND)hWnd); + return pWin; + } + int SetAgent() + { + xstring xfNodeAgentArea = L"agentarea"; + xnode anode = GetAgentNode(xfNodeAgentArea); + KXMLDOMElement xframeElement = GetElement(); + KXMLDOMNode agent = xframeElement.selectSingleNode(L"agent/"+xfNodeAgentArea+L"[1]/*"); + if(agent) + SetAgentNode(anode, agent.xml()); + return 1; + } + + //焦点激活处理函数 + int OnSetFocus(TEvent* evt, LPARAM param) + { + SetAgent(); + + //重置工具条 + return 1; + } + int ProcessFlowAction(xstring guid,xstring comdid) + { + //int pr = pr1; + //xstring action = comdid;//.mid(comdid.find(L"action:",0)+7,9999); + /*if(action == L"bill.delete" || action == L"bill.deleteEx") + { + if (MessageBox(GetHWND(),L"是否确定删除记录!",L"提示1",1) == 2) + return 1; + }*/ + + xaserverarg arg0 ; + arg0.setNativePointer(arg0.CreateInstance()); + //arg0.AddArg(L"Action", action,L"xs:xstring"); + arg0.AddArg(L"EntityName", L"ColorCard",L"xs:xstring"); + arg0.AddArg(L"EntityIDName", L"ColorCardID",L"xs:xstring"); + arg0.AddArg(L"EntityID", guid,L"xs:xstring"); + arg0.AddArg(L"FunctionCode", comdid,L"xs:xstring"); + xml x = new xml; + + + if(xurl::get(L"/sale/data/Role.config/sys/sql/action", arg0.GetString(), x) != 1) + { + //ismodify=false; + //dw_list.SetReadOnly(ismodify); + return -1; + } + xstring kk=x.xml(); + if(kk.find(L"<root/>",0)>=0) + { + //ismodify=true; + //dw_list.SetReadOnly(ismodify); + return 1; + } + return -1; + } + + int ModifyProcessAction(xstring guid,xstring comdid) + { + if(ProcessFlowAction(guid,comdid)>0) + { + ismodify=true; + dw_list.SetReadOnly(ismodify); + return -1; + } + else + { + ismodify=false; + dw_list.SetReadOnly(ismodify); + return -1; + } + } + int DeleteProcessAction(xstring guid,xstring comdid) + { + if(ProcessFlowAction(guid,comdid)>0) + { + return -1; //没有权限 + } + else + { + return 1; //有权限 + } + } + + //根据ColorCardID加载Detail数据 + int OnRetrieveDetail(xstring ColorCardID) + { + xml x; + + xaserverarg arg; + + + arg.AddArg(L"ColorCardID",ColorCardID); + if (xurl::get(L"ColorCard/entity/list1",arg.GetString(),x) != 1) + { + trace(x.text()); + return -1; + } + dw_detail.Retrieve(x); + dw_detail.Redraw(); + dw_detail.SetReadOnly(ismodify); + return 1; + } + + int OnPreSave() + { + if (dw_list) + { + xstring colorCardCName; + xstring colorCardName; + xstring orgID; + int i; + int row = dw_list.GetRowCount(); + for (i=1; i<=row;i++) + { + colorCardCName=dw_list.GetItemString(i,L"ColorCardCName")+L""; + colorCardName=dw_list.GetItemString(i,L"ColorCardName")+L""; + orgID=dw_list.GetItemString(i,L"OrgID")+L""; + if (colorCardCName==L"" || !colorCardCName) + { + alert(L"第"+xstring(i)+L"行色卡名称中文为空"); + return -1; + } + if (colorCardName==L"" || !colorCardName) + { + alert(L"第"+ xstring(i) +L"行色卡名称为空"); + return -1; + } + if (orgID==L"" || !orgID) + { + alert(L"第"+ xstring(i) +L"行关联组织为空"); + return -1; + } + } + } + + return 1 ; + } + + //保存 + int OnSave() + { + dw_list.AcceptText(); + dw_detail.AcceptText(); + int rec; + rec = OnPreSave(); + if (rec == -1) + return -1; + xml x= new xml; + + dw_list.DwUpdateAllToEx(x); + xaserverarg arg; + + KXMLDOMElement e= x.selectSingleNode(L"root"); + arg.AddArg(L"content",e.xml()); + arg.AddArg(L"dbmap",L"ColorCard.dbmap"); + if (xurl::get(L"ColorCard/pref/colorcard.save",arg.GetString(),x) != 1) + { + trace(L"error:"+(xstring)x.xml()); + alert(L"保存失败!"); + return 0; + } + else + { + alert(L"保存成功!"); + dw_list.ResetUpdateStatus(); + } + dw_list.Redraw(); + } + + //新增 + int OnAdd() + { + dw_list.AcceptText(); + int nrow=dw_list.InsertRow(0); + dw_list.ShowRowTo(nrow); + xstring tempguid = publiccode::GetGuid(); + dw_list.SetItemString(nrow,L"ColorCardID",tempguid); + OnRetrieveDetail(tempguid); + return 1; + } + + //插入 + int OnInsert() + { + dw_list.AcceptText(); + int row = dw_list.GetRow(); + if(row<1) return 0; + int nrow=dw_list.InsertRow(row); + xstring tempguid = publiccode::GetGuid(); + dw_list.SetItemString(nrow,L"ColorCardID",tempguid); + OnRetrieveDetail(tempguid); + } + + //删除 + int OnDelete() + { + dw_list.AcceptText(); + int row = dw_list.GetRow(); + if(row<1) return 0; + xstring id=dw_list.GetItemString(row,L"ColorCardID"); + if(DeleteProcessAction(id,L"DeleteColorCard")<0) + { + alert(L"您没有权限删除该数据"); + return -1; + } + if(id !=L"") + { + xml x; + + xaserverarg arg; + arg.setNativePointer(arg.CreateInstance()); + arg.AddArg(L"ColorCardID", id); + if(xurl::get(L"ColorCard/pref/beforedelete",arg.GetString(),x)!=1) + { + trace(L"error:"+(xstring)x.xml()); + alert(L"删除出错!"); + return 0; + } + KXMLDOMElement e= x.documentElement(); + if(e.selectSingleNode(L"error")) + { + alert(e.selectSingleNode(L"error").text()); + return 0; + } + } + dw_list.DeleteRow(row); + } + + int OnAddRowDetail() + { + dw_detail.AcceptText(); + int nrow=dw_detail.InsertRow(0); + xstring tempguid = publiccode::GetGuid(); + dw_detail.SetItemString(dw_detail.GetRow(),L"ColorCardID",dw_list.GetItemString(dw_list.GetRow(),L"ColorCardID")); + dw_detail.SetItemString(dw_detail.GetRow(),L"ColorID",tempguid); + //OnRetrieveDetail(tempguid); + dw_detail.ShowRowTo(nrow); + + return 1; + } + + int OnInsertRowDetail() + { + dw_detail.AcceptText(); + int row = dw_detail.GetRow(); + if(row<1) return 0; + int nrow=dw_detail.InsertRow(row); + xstring tempguid = publiccode::GetGuid(); + dw_detail.SetItemString(dw_detail.GetRow(),L"ColorCardID",dw_list.GetItemString(dw_list.GetRow(),L"ColorCardID")); + dw_detail.SetItemString(dw_detail.GetRow(),L"ColorID",tempguid); + + return 1; + } + + int OnDelRowDetail() + { + int row = dw_detail.GetRow(); + int rowz = dw_list.GetRow(); + if(row<1)return 0; + dw_detail.DeleteRow(row); + KXMLDOMElement ez= dw_list.GetRowElement(rowz); + xml xz; + dw_detail.DwUpdateAllToEx(xz); + if (ez.selectSingleNode(L"root")) + ez.removeChild(ez.selectSingleNode(L"root")); + ez.appendChild(xz.documentElement()); + + return 1; + } + + //命令发布函数 + int OnCmdDispatch(xstring comdid) + { + if(comdid==L"save") OnSave(); + else if(comdid==L"add") OnAdd(); + else if(comdid==L"insert") OnInsert(); + else if(comdid==L"del") OnDelete(); + else if(comdid==L"addrowDetail") OnAddRowDetail(); + else if(comdid==L"insertrowDetail") OnInsertRowDetail(); + else if(comdid==L"deleterowDetail") OnDelRowDetail(); + + return 1; + } + + //命令处理事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + //行改变事件 + int OnListRowChanged(TEvent* evt, int p) + { + dw_detail.AcceptText(); + + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + int row = hdr.row; + dw_list.Redraw(); + KXMLDOMElement e = dw_list.GetRowElement(row); + xstring ColorCardID = e.selectSingleNode(L"ColorCardID").text(); + OnRetrieveDetail(ColorCardID); + + return 1; + } + + int OnDetailChanged(TEvent* evt, int p) + { + int row = dw_list.GetRow(); + KXMLDOMElement e= dw_list.GetRowElement(row); + xml x; + + dw_detail.DwUpdateAllToEx(x); + if (e.selectSingleNode(L"root")) + e.removeChild(e.selectSingleNode(L"root")); + e.appendChild(x.documentElement()); + + return 0; + } + + int OnDwListClick(TEvent* evt, int p) + { + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + int row = hdr.row; + dw_list.Redraw(); + KXMLDOMElement e = dw_list.GetRowElement(row); + xstring ColorCardID = e.selectSingleNode(L"ColorCardID").text(); + ModifyProcessAction(ColorCardID,L"ModifyColorCard"); + + return 1; + } + + int OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&ColorCardNew::OnXCommand); + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&ColorCardNew::OnSetFocus); + //行改变事件 + AttachEvent(L"dw_list",L"DWV_ROWFOCUSCHANGED", (FEvent)&ColorCardNew::OnListRowChanged); + AttachEvent(L"dw_detail",L"DWV_ITEMCHANGED", (FEvent)&ColorCardNew::OnDetailChanged); + //AttachEvent(L"dw_list",L"DWV_ITEMCHANGED",OnDetailChanged); + AttachEvent(L"dw_list",L"DWV_CLICKED", (FEvent)&ColorCardNew::OnDwListClick); + + return 1; + } + + int OnRetrieve(xstring str) + { + xml x; + + xaserverarg arg; + + arg.AddArg(L"id",str); + if (xurl::get(L"ColorCard/entity/list",arg.GetString(),x) != 1) + { + trace(x.text()); + return -1; + } + //doc=x; + dw_list.Retrieve(x); + dw_list.Redraw(); + + return 1; + } + + int OnInitial() + { + SetAgent(); + + OnAttachEvent(); + + return 1; + } + + int onload() + { + + dw_list = GetControl(L"dw_list"); + dw_list.openUrl(L"产品设置.vface/template/ColorCard/list"); + + dw_detail = GetControl(L"dw_detail"); + dw_detail.openUrl(L"产品设置.vface/template/ColorCard/listex"); + OnInitial(); + + OnRetrieve(L"FND_ColorCard"); + + return 1; + } +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/CustomerMarketList.cpp b/jrj/project/business/BasicCode/CustomerMarketList.cpp new file mode 100644 index 0000000..cf794b4 --- /dev/null +++ b/jrj/project/business/BasicCode/CustomerMarketList.cpp @@ -0,0 +1,38 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) CustomerMarketList : public xwin +{ +public: + xdwgrid dw_list; +public: + CustomerMarketList(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} +public: + static CustomerMarketList* CreateInstance(void* implPtr, void* hWnd) + { + CustomerMarketList* pWin = new CustomerMarketList(implPtr, (HWND)hWnd); + return pWin; + } + + int ViewUpdate(param pr, xstring updateItem, xaserverarg arg) + { + if (updateItem == L"del") { + int DelRow = dw_list.GetRow(); + dw_list.DeleteRow(DelRow); + } + return 1; + } + int onload() + { + list::onload(); + return -1; + } + +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/CustomerMarketMaint.cpp b/jrj/project/business/BasicCode/CustomerMarketMaint.cpp new file mode 100644 index 0000000..ec84f4f --- /dev/null +++ b/jrj/project/business/BasicCode/CustomerMarketMaint.cpp @@ -0,0 +1,92 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) CustomerMarketMaint : public xframe +{ +public: + KXMLDOMDocument m_configDoc; + xstring m_userid; + xstring m_username; + xstring ContactID; + xdwtable dw_base; + xcell dw_cell; +public: + CustomerMarketMaint(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} +public: + static CustomerMarketMaint* CreateInstance(void* implPtr, void* hWnd) + { + CustomerMarketMaint* pWin = new CustomerMarketMaint(implPtr, (HWND)hWnd); + return pWin; + } + int alert(xstring str) + { + //win::MessageBox(GetHWND(),str,L"提示22:",0); + TApp::alert(this, str); + return 0; + } + int ViewUpdate(param pr, xstring updateItem, xaserverarg arg) + { + if (updateItem == L"update") + { + + dw_base.ResetUpdateStatus(); + return 1; + } + } + xstring GetEntityData(param pr) + { + xml x; + + dw_base.DwUpdateAllTo(x); + //trace(L"------x"); + trace(x.xml()); + return x.xml(); + } + int onload() + { + maint::onload(); + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + if (!maint::m_EntityID) + { + //xstring suserid = publiccode::GetUser().id; + xstring suserid = xaserver::GetUserId(); + xstring susername = publiccode::GetUser().name; + xstring sdate = publiccode::GetCurrentDate(); + dw_base.SetItemString(dw_base.GetRow(), L"CreatorID", suserid);//Party + dw_base.SetItemDisplayString(dw_base.GetRow(), L"CreatorID", susername); + dw_base.SetItemString(dw_base.GetRow(), L"CreateDate", sdate); + xml x; + + xaserverarg arg; + + arg.AddArg(L"id", suserid); + if (xaserver::ExecXQuery(L"", L"[OrgInfo.xq]", arg.GetString(), x) != 1) + { + trace(x.xml()); + return nil; + } + //alert(x.xml()); + KXMLDOMElement e = x.documentElement(); + trace(e.xml()); + if (e.selectSingleNode(L"orgid")) + { + xstring orgid = e.selectSingleNode(L"orgid").text(); + dw_base.SetItemString(1, L"OrgID", orgid); + } + + if (e.selectSingleNode(L"orgname")) + { + xstring orgname = e.selectSingleNode(L"orgname").text(); + dw_base.SetItemDisplayString(1, L"OrgID", orgname); + } + } + } +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/ExchangeRate.cpp b/jrj/project/business/BasicCode/ExchangeRate.cpp new file mode 100644 index 0000000..51e0e26 --- /dev/null +++ b/jrj/project/business/BasicCode/ExchangeRate.cpp @@ -0,0 +1,226 @@ +#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) ExchangeRateWin : public xframe + { + public: + xdwgrid dw_list; + int hSignWin; + xnode m_agentNode; //Agent Condition + public: + ExchangeRateWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} + public: + static ExchangeRateWin* CreateInstance(void* implPtr, void* hWnd) + { + ExchangeRateWin* pWin = new ExchangeRateWin(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 OnSave() + { + xml x = new xml; + + dw_list.AcceptText(); + dw_list.DwUpdateAllToEx(x); + xml x0; + x0.loadXML(L"<data/>"); + + KXMLDOMNodeList t = x.selectNodes(L"data/Item[@update.modify='1' or @update.delete ='1']"); + KXMLDOMElement e1= x0.documentElement(); + int len = t.length(); + for(int i=0;i<len;i++) + { + e1.appendChild(t.item(i)); + } + xaserverarg arg ; + arg.AddArg(L"content",x0.xml()); + trace(x0.xml()); + if(xurl::get(L"/sale/data/expense3/update/ExchangeRate", 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"xmAddRow") + { + xstring sdate = publiccode::GetCurrentDate(); + xstring suserid = publiccode::GetUser().id; + xstring susername = publiccode::GetUser().name; + int row =dw_list.GetRowCount(); + dw_list.InsertRow(0); + dw_list.SetItemString(row+1,L"CreatorID",suserid); + dw_list.SetItemDisplayString(row+1,L"CreatorID",susername); + dw_list.SetItemString(row+1,L"CreateDate",sdate); + return 1; + } + else if(comdid==L"xmDeleteRow") + { + dw_list.DeleteRow(0); + return 1; + } + else if (comdid == L"xmSave") + { + OnSave(); + } + else if (comdid == L"xmRefresh") + { + OnRetrieve(); + } + else if(comdid ==L"ToUpdate") + { + ToUpdate(); + } + + return 0; + } + + + int ToUpdate() + { + xstring Months = dw_list.GetItemString(dw_list.GetRow(),L"Months"); + int MB_OKCANCEL = 1; + int IDOK = 1; + int ret = MessageBox(GetHWND(),L"确认更新"+Months+L"盈亏汇率?",L"提示",MB_OKCANCEL); + if(ret == IDOK) + { + xml x = ViewObject::RetrieveData(L"/sale/data/Expense3/ExchangeRateUpdateEx",L"Months",Months); + xstring status = x.xml(); + if(status.find(L"ok") == 1) + { + alert(L"更新成功"); + }else + { + alert(L"更新失败"); + } + } + return 1; + } + + //触发鼠标离开后tran事件,通过查找某个参数得到对应的列 + int OnBaseItemChanged(TEvent* evt, int p) + { + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + xstring colname=hdr.colname; + xstring value = hdr.data; + + xstring dwname = L"dw_list"; + if(value != L"") + { + KXMLDOMNodeList nlist = GetElement().selectNodes(L"//*[@name='"+dwname+L"']/trans[@for='"+colname+L"']"); + ViewObject::TransData(nlist, dw_list, hdr.row, colname, value); + } + + return 1; + } + + + //命令处理事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&ExchangeRateWin::OnXCommand); + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&ExchangeRateWin::OnSetFocus); + AttachEvent(L"dw_list",L"DWV_ITEMCHANGED", (FEvent)&ExchangeRateWin::OnBaseItemChanged); + return 1; + } + + + int OnRetrieve() + { + xml x = new xml; + + xaserverarg arg; + + arg.AddArg(L"QueryTxt",xcontrol(GetControl(L"search")).GetText()); + + + if (getUrl(L"/sale/data/Expense3/ExchangeRateList",arg.GetString(),x)!=1) + { + trace(x.text()); + return -1; + }else + { + dw_list.Retrieve(x); + dw_list.Redraw(); + } + return 1; + } + + int onload() + { + dw_list = GetControl(L"dw_list"); + dw_list.openUrl(L"/sale/view/Expense3/ExchangeRate"); + + + OnRetrieve(); + + OnAttachEvent(); + + return 1; + } + + int onloaded() + { + SetAgent(); + return 1; + } + }; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/ExpressList.cpp b/jrj/project/business/BasicCode/ExpressList.cpp new file mode 100644 index 0000000..7f16177 --- /dev/null +++ b/jrj/project/business/BasicCode/ExpressList.cpp @@ -0,0 +1,41 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) ExpressList : public xwin +{ +public: + xdwgrid dw_list; +public: + ExpressList(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} +public: + static ExpressList* CreateInstance(void* implPtr, void* hWnd) + { + ExpressList* pWin = new ExpressList(implPtr, (HWND)hWnd); + return pWin; + } + int onload() + { + list::onload(); + return -1; + } + + int ViewUpdate(param pr, xstring updateItem, xaserverarg arg) + { + + if (updateItem == L"del") + { + int DelRow = dw_list.GetRow(); + dw_list.DeleteRow(DelRow); + + } + + return 1; + } +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/ExpressMaint.cpp b/jrj/project/business/BasicCode/ExpressMaint.cpp new file mode 100644 index 0000000..ce669d1 --- /dev/null +++ b/jrj/project/business/BasicCode/ExpressMaint.cpp @@ -0,0 +1,346 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) ExpressMaint : public xframe +{ +public: + KXMLDOMDocument m_configDoc; + xdwtable dw_base; + xstring m_userid; + xstring m_username; + xstring ContactID; + xcell dw_cell; +public: + ExpressMaint(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} +public: + static ExpressMaint* CreateInstance(void* implPtr, void* hWnd) + { + ExpressMaint* pWin = new ExpressMaint(implPtr, (HWND)hWnd); + return pWin; + } + int alert(xstring str) + { + //win::MessageBox(GetHWND(),str,L"提示22:",0); + TApp::alert(this, str); + return 0; + } + int setCellReadOnly() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + dw_cell = new xcell; + dw_cell.setNativePointer(dw_base.QueryItem(L"ixcell")); + xstring strnew = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''/>"; + dw_cell.SetCellProps(2, 2, strnew); + return 0; + } + + + xstring GetGuid() { + return publiccode::GetGuid(); + } + int OnClear() { + if (m_EntityID == L"") { + //trace(1); + m_userid = publiccode::GetUser().id; + m_username = publiccode::GetUser().name; + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + dw_base.SetItemString(1, L"PartyID", GetGuid()); + dw_base.SetItemString(1, L"PStatus", L"1"); + dw_base.SetItemDisplayString(1, L"PStatus", L"有效"); + dw_base.SetItemString(1, L"PADStatus", L"1"); + dw_base.SetItemString(1, L"CreatorID", m_userid); + dw_base.SetItemString(1, L"AddressID", GetGuid()); + dw_base.SetItemString(1, L"PADIdentifyAddressFlag", L"Y"); + dw_base.SetItemString(1, L"PrimaryFlag", L"Y"); + dw_base.SetItemString(1, L"Type", L"8"); + dw_base.SetItemString(1, L"EnterName", m_userid); + dw_base.SetItemDisplayString(1, L"EnterName", m_username); + dw_base.SetItemString(1, L"CreateDate", publiccode::GetCurrentDate()); + dw_base.SetItemString(1, L"PBAStatus", L"Y"); + + + } + return 0; + } + + int OnSetFocus(TEvent* evt, LPARAM p) + { + SetAgent(L"maint"); + return 1; + } + int OnAddrow() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xdwtable dw = new xdwtable; + dw.setNativePointer(dw_base.GetCurTable()); + xstring dw_n = dw.GetDwName(); + if (dw_n == L"item") + { + dw.InsertRow(0); + int rows = dw.GetRowCount(); + dw.SetRow(rows); + + } + return 1; + } + int OnInsertRow() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xdwtable dw = new xdwtable; + dw.setNativePointer(dw_base.GetCurTable()); + xstring dw_n = dw.GetDwName(); + if (dw_n == L"item") + { + int row = dw.GetRow(); + if (row < 1) return 0; + dw.InsertRow(row); + dw.SetRow(row); + + } + return 1; + } + + int OnDeleteRow() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xdwtable dw = new xdwtable; + dw.setNativePointer(dw_base.GetCurTable()); + xstring dw_n = dw.GetDwName(); + if (dw_n == L"item") + { + int row = dw.GetRow(); + if (row < 1) return 0; + /*xstring del = dw.GetItemString(row,8); + if(del!=L"") + { + if(m_dels==L"") + { + m_dels=del; + } + else + { + xstring temp=m_dels; + m_dels=del + L"|" + temp; + //+= L"|"+del; + } + + }*/ + dw.DeleteRow(row); + dw.SetRow(row - 1); + } + //trace(m_dels); + return 1; + } + xstring getGoodsNo() + { + xml x; + + xaserverarg arg; + + if (getUrl(L"/sale/data/LogisticsCode/pref/express/PartyNo", arg.GetString(), x) != 1) + { + trace(x.xml()); + return L""; + } + KXMLDOMElement e = x.documentElement(); + if (e) + { + xstring code = e.text(); + trace(code); + return L"E" + code; + } + return L"E1000"; + } + int OnPreSave() + { + dw_base.AcceptText(); + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xstring ExpressNo = dw_base.GetItemString(1, L"ExpressNo"); + if (ExpressNo == L"") + { + dw_base.SetItemString(1, L"ExpressNo", getGoodsNo()); + } + xdwtable dwcon = new xdwtable; + dwcon.setNativePointer(dw_base.FindDwTable(L"item", 0)); + int i; + for (i = 1; i <= dwcon.GetRowCount(); i++) + { + xstring aTemp; + xstring aName = dwcon.GetItemString(i, L"ContacterName"); + if (aName == L"") + { + aTemp = dwcon.GetItemString(i, L"Mobile") + dwcon.GetItemString(i, L"TEL") + dwcon.GetItemString(i, L"Fax") + dwcon.GetItemString(i, L"Email") + dwcon.GetItemString(i, L"PCRemark"); + trace(aTemp); + if (aTemp != L"") + { + alert(L"联系人名称必填!"); + return -1; + } + } + else { + xstring ContactID = dwcon.GetItemString(i, L"ContactID"); + if (ContactID == L"") + { + dwcon.SetItemString(i, L"ContactID", GetGuid()); + dwcon.SetItemString(i, L"PCStatus", L"1"); + //dw_base.SetItemString(1,L"PrimaryContactID",dwcon.GetItemString(1,L"ContactID")); + } + + + + } + } + xdwtable dwcon1 = new xdwtable; + dwcon1.setNativePointer(dw_base.FindDwTable(L"PartyBankAccount", 0)); + int j; + xstring sPBABankName = L""; + xstring sPBABankAccountNo = L""; + for (j = 1; j <= dwcon1.GetRowCount(); j++) + { + xstring sPBABankName = dwcon1.GetItemString(j, L"Bank"); + xstring sPBABankAccountNo = dwcon1.GetItemString(j, L"BankNo"); + + xstring sPBAAll = sPBABankName + sPBABankAccountNo; + if (sPBAAll != L"") + { + if (sPBABankName == L"") + { + alert(L"银行名称不能为空"); + return -1; + } + if (sPBABankAccountNo == L"") + { + alert(L"银行账户不能为空"); + return -1; + } + } + } + return 1; + } + int OnSave() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xstring SName = dw_base.GetItemString(1, L"Name"); + if (SName == L"") { + alert(L"请输入快递公司名称!"); + return -1; + } + int rec = OnPreSave(); + if (rec == -1) return -1; + xml x; + + dw_base.DwUpdateAllTo(x); + trace(x.xml()); + xaserverarg arg; + + arg.AddArg(L"content", x.xml()); + arg.AddArg(L"dbmap", L"Express.dbmap"); + //arg.AddArg(L"m_dels",m_dels); + if (getUrl(L"/sale/data/LogisticsCode/entity/express/save", arg.GetString(), x) != 1) + { + trace(L"error:" + (xstring)x.xml()); + alert(L"保存失败!"); + return 0; + } + else + { + trace(x.xml()); + if (x.selectSingleNode(L"error")) + { + alert(L"保存出错2!"); + return 0; + } + alert(L"保存成功!"); + dw_base.ResetUpdateStatus(); + setCellReadOnly(); + } + dw_base.Redraw(); + //m_dels=L""; + return 0; + } + int OnCmdDispatch(xstring comdid) + { + if (comdid.find(L"action:bill.row.add", 0) >= 0) { + OnAddrow(); + } + else if (comdid.find(L"bill.row.insert", 0) >= 0) { + OnInsertRow(); + } + else if (comdid.find(L"bill.row.delete", 0) >= 0) { + OnDeleteRow(); + } + else if (comdid.find(L"bill.save", 0) >= 0) { + //trace(1); + OnSave(); + } + return 0; + } + + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + int OnCellChanged(TEvent* evt, LPARAM p) + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + xstring colname = hdr.colname; + //trace(colname); + if (colname == L"ExpressNo") + { + xstring cspec = dw_base.GetItemString(1, 1); + trace(cspec); + xstring SpecRule = L"^\\d*$"; + xaserverarg args; + + args.AddArg(L"CSpec", cspec); + args.AddArg(L"SpecRule", SpecRule); + xml x; + + getUrl(L"/sale/data/LogisticsCode/pref/forwarderno/check", args.GetString(), x); + if (x.selectSingleNode(L"root/spec")) + { + alert(L"请输入数字!"); + return 0; + } + + } + return 1; + } + int OnAttachEvent() + { + AttachEvent(L"WM_XCOMMAND", (FEvent)&ExpressMaint::OnXCommand); + AttachEvent(L"WM_SETFOCUS", (FEvent)&ExpressMaint::OnSetFocus); + AttachEvent(L"dw_base", L"DWV_ITEMCHANGED", (FEvent)&ExpressMaint::OnCellChanged); + return 1; + } + + int onload() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + + OnAttachEvent(); + //if(!m_configDoc) return -1; + + maint::onload(); + OnClear(); + + } + +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/FCL.cpp b/jrj/project/business/BasicCode/FCL.cpp new file mode 100644 index 0000000..c612560 --- /dev/null +++ b/jrj/project/business/BasicCode/FCL.cpp @@ -0,0 +1,354 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) FCL : public xframe +{ +public: + xcombobox ddlb_1; + int changeddlb; + xdwgrid dw_list; + int m_PageSize; //每页显示数量 + int m_PageIndex; //第几页 + xstring m_QueryTxt; //查询条件 + xdwtable dw_base; + xnode m_agentNode; //Agent Condition + xstring m_agentCond; //Agent Node + xstring m_config; + xstring m_spec; +public: + FCL(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} +public: + static FCL* CreateInstance(void* implPtr, void* hWnd) + { + FCL* pWin = new FCL(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 OnRetrieve() + { + xaserverarg arg; + + xdwpages zz = new xdwpages; + zz.setNativePointer(GetControl(L"pages")); + xml x; + + getUrl(L"/sale/data/FCL/entity/list", arg.GetString(), x); + KXMLDOMElement e = x.documentElement(); + if (e.selectSingleNode(L"@TotalPage")) + { + xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 + zz.SetMaxPage(s.toInt()); + } + dw_list.Retrieve(x); + dw_list.Redraw(); + return 1; + } + int SetPriceBaseEmpty() + { + int rows = dw_base.GetColumnCount(); + int i; + for (i = 1; i <= rows; i++) + { + dw_base.SetItemString(1, i, L""); + //dw_base.SetItemDisplayString(1,i,L""); + } + dw_base.ResetUpdateStatus(); + dw_base.Redraw(); + return 1; + } + int SetCellEdit(int row, xstring name, xstring value, xstring display) + { + dw_base.SetItemString(row, name, value); + dw_base.Redraw(); + if (display != L"") + { + dw_base.SetItemDisplayString(row, name, display); + } + dw_base.AcceptText(); + dw_base.ResetUpdateStatus(); + dw_base.Redraw(); + return 1; + } + int OnSetCTGValue(int row) + { + dw_base.AcceptText(); + SetPriceBaseEmpty(); + KXMLDOMElement e = dw_list.GetRowElement(row); + var list = e.selectNodes(L"*"); + if (list) + { + int s = list.length; + int i; + for (i = 0; i < s; i++) + { + xml x; + ; + KXMLDOMElement xitem = list.item(i); + x.loadXML(xitem.xml()); + //trace(xitem.xml); + KXMLDOMElement e1 = x.documentElement(); + xstring name = e1.tagName(); + trace(name); + trace(e1.text()); + xstring display; + if (e1.selectSingleNode(L"@_displaystring")) + { + display = e1.selectSingleNode(L"@_displaystring").text(); + SetCellEdit(1, name, e1.text(), L"" + display); + } + else + SetCellEdit(1, name, e1.text(), L""); + + } + } + return 1; + } + int OnRowClicked(TEvent* evt, LPARAM p) + { + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + int row = hdr.row; + OnSetCTGValue(row); + return 1; + } + int setMaint() + { + xml x; + + dw_base.DwUpdateAllTo(x); + int row = dw_list.GetRow(); + dw_list.SetItemString(row, L"PriceInfo", x.xml()); + return 1; + } + int SetTotalAmount(int row, xstring name) + { + if (name == L"price20base" || name == L"price20BAF" || name == L"price20CAF" || name == L"price20add" || name == L"price20comm" || name == L"price20other") + { + double price20base = dw_base.GetItemString(row, L"price20base").toDouble(); + double price20BAF = dw_base.GetItemString(row, L"price20BAF").toDouble(); + double price20CAF = dw_base.GetItemString(row, L"price20CAF").toDouble(); + double price20add = dw_base.GetItemString(row, L"price20add").toDouble(); + double price20comm = dw_base.GetItemString(row, L"price20comm").toDouble(); + double price20other = dw_base.GetItemString(row, L"price20other").toDouble(); + double price20 = price20base + price20BAF + (price20CAF / 100) * price20base + price20add - (price20comm / 100) * price20base + price20other; + dw_base.SetItemString(1, L"price20", xstring(price20)); + } + + if (name == L"price40base" || name == L"price40BAF" || name == L"price40CAF" || name == L"price40add" || name == L"price40comm" || name == L"price40other") + { + double price40base = dw_base.GetItemString(row, L"price40base").toDouble(); + double price40BAF = dw_base.GetItemString(row, L"price40BAF").toDouble(); + double price40CAF = dw_base.GetItemString(row, L"price40CAF").toDouble(); + double price40add = dw_base.GetItemString(row, L"price40add").toDouble(); + double price40comm = dw_base.GetItemString(row, L"price40comm").toDouble(); + double price40other = dw_base.GetItemString(row, L"price40other").toDouble(); + double price40 = price40base + price40BAF + (price40CAF / 100) * price40base + price40add - (price40comm / 100) * price40base + price40other; + dw_base.SetItemString(1, L"price40", xstring(price40)); + } + + if (name == L"price40Hbase" || name == L"price40HBAF" || name == L"price40HCAF" || name == L"price40Hadd" || name == L"price40Hcomm" || name == L"price40Hother") + { + double price40Hbase = dw_base.GetItemString(row, L"price40Hbase").toDouble(); + double price40HBAF = dw_base.GetItemString(row, L"price40HBAF").toDouble(); + double price40HCAF = dw_base.GetItemString(row, L"price40HCAF").toDouble(); + double price40Hadd = dw_base.GetItemString(row, L"price40Hadd").toDouble(); + double price40Hcomm = dw_base.GetItemString(row, L"price40Hcomm").toDouble(); + double price40Hother = dw_base.GetItemString(row, L"price40Hother").toDouble(); + double price40H = price40Hbase + price40HBAF + (price40HCAF / 100) * price40Hbase + price40Hadd - (price40Hcomm / 100) * price40Hbase + price40Hother; + dw_base.SetItemString(1, L"price40h", xstring(price40H)); + } + return 1; + } + int OnPriceBaseChanged(TEvent* evt, LPARAM p) + { + trace(L"123"); + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + xstring name = hdr.colname; + xstring value = hdr.data; + SetTotalAmount(1, name); + xstring price20 = dw_base.GetItemString(1, L"price20"); + xstring price40 = dw_base.GetItemString(1, L"price40"); + xstring price40h = dw_base.GetItemString(1, L"price40h"); + dw_list.SetItemString(dw_list.GetRow(), L"price20", price20); + dw_list.SetItemString(dw_list.GetRow(), L"price40", price40); + dw_list.SetItemString(dw_list.GetRow(), L"price40h", price40h); + dw_list.Redraw(); + setMaint(); + return 1; + } + int OnListChanged(TEvent* evt, LPARAM p) + { + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + int row = hdr.row; + xstring colname = hdr.colname; + xstring value = hdr.data; + if (colname == L"port") + { + xml x; + + xaserverarg arg; + + arg.AddArg(L"code", value); + if (getUrl(L"/sale/data/FCL/pref/shipthread", arg.GetString(), x) != 1) + { + trace(x.xml()); + } + KXMLDOMElement e = x.documentElement(); + dw_list.SetItemString(row, L"shipthread", e.text()); + dw_list.Redraw(); + } + + + 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(); + xutil::RestoreCursor(hCursor); + return 1; + } + int onSave() + { + xml x; + + dw_list.DwUpdateAllToEx(x); + trace(x.xml()); + } + int OnDeleteRow() + { + int row = dw_list.GetRow(); + if (row<1 || row>dw_list.GetRowCount()) + { + return -1; + } + dw_list.DeleteRow(row); + + } + int OnAddrow() + { + int row = dw_list.InsertRow(0); + dw_list.SetItemString(row, L"modifieddate", publiccode::GetCurrentDate()); + SetPriceBaseEmpty(); + return 1; + } + int OnInsertRow() + { + int row = dw_list.GetRow(); + if (row < 1) return 0; + int newrow = dw_list.InsertRow(row); + dw_list.SetItemString(newrow, L"modifieddate", publiccode::GetCurrentDate()); + SetPriceBaseEmpty(); + return 1; + } + int OnDeleteRow() + { + int row = dw_list.GetRow(); + if (row > 0 && row <= dw_list.GetRowCount()) + { + dw_list.DeleteRow(row); + //OnSetCTGValue(row); + } + return 1; + } + int OnCmdDispatch(xstring comdid) + { + if (comdid.find(L"add", 0) >= 0) + OnAddrow(); + else if (comdid.find(L"insert", 0) >= 0) + OnInsertRow(); + else if (comdid.find(L"del", 0) >= 0) + OnDeleteRow(); + else if (comdid.find(L"save", 0) >= 0) + onSave(); + return 1; + } + int OnSetFocus(TEvent* evt, LPARAM p) { + SetAgent(); + return 1; + } + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + int OnItemError(TEvent* evt, LPARAM p) + { + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + xstring value = hdr.data; + int e = hdr.idFrom; + if (e == -1000) + alert(L"【" + value + L"】不是有效的数字!"); + if (e == -1001) + alert(L"【" + value + L"】不是有效的数字!"); + if (e == -1002) + alert(L"【" + value + L"】不是有效的日期!"); + return 1; + } + int OnAttachEvent() + { + AttachEvent(L"WM_XCOMMAND", (FEvent)&FCL::OnXCommand); + AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&FCL::OnRowClicked); + AttachEvent(L"WM_SETFOCUS", (FEvent)&FCL::OnSetFocus); + AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&FCL::OnChangePages); + AttachEvent(L"dw_base", L"DWV_ITEMCHANGED", (FEvent)&FCL::OnPriceBaseChanged); + AttachEvent(L"dw_base", L"DWV_ITEMERROR", (FEvent)&FCL::OnItemError); + AttachEvent(L"dw_list", L"DWV_ITEMCHANGED", (FEvent)&FCL::OnListChanged); + return 1; + + } + int OnInit() + { + dw_list = new xdwgrid; + dw_list.setNativePointer(GetControl(L"dw_list")); + dw_list.openUrl(L"/sale/view/FCL/template/FCL/List"); + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + dw_base.openUrl(L"/sale/view/FCL/template/FCL/pricebase"); + dw_list.SetReadOnlyColumn(L"shipthread", true); + dw_list.SetReadOnlyColumn(L"price20", true); + dw_list.SetReadOnlyColumn(L"price40", true); + dw_list.SetReadOnlyColumn(L"price40h", true); + return 1; + } + + int onload() + { + m_PageSize = 30; //每页显示数量 + m_PageIndex = 1; //第几页 + m_QueryTxt = L""; //查询条件 + OnInit(); + OnAttachEvent(); + OnRetrieve(); + SetAgent(); + return 1; + } +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/ForwarderList.cpp b/jrj/project/business/BasicCode/ForwarderList.cpp new file mode 100644 index 0000000..5d58f1e --- /dev/null +++ b/jrj/project/business/BasicCode/ForwarderList.cpp @@ -0,0 +1,135 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) ForwarderList : public xwin +{ + +public: + //xdwpages dw_pages; + xstring m_QueryTxt; + KXMLDOMDocument m_configDoc; + xtreeview tv_1; + xstring sType; + static int dw_hWnd; + int m_pageIndex; + int m_pageNumber; + xdwgrid dw_list; +public: + ForwarderList(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} +public: + static ForwarderList* CreateInstance(void* implPtr, void* hWnd) + { + ForwarderList* pWin = new ForwarderList(implPtr, (HWND)hWnd); + return pWin; + } + + + int SetEntityData(xaserverarg arg) + { + + arg.AddArg(L"sType", sType); + xml x; + + getUrl(L"/sale/data/LogisticsCode/entity/list", arg.GetString(), x); + KXMLDOMElement e = x.documentElement(); + if (e) + { + if (list::dw_pages.nativept && e.selectSingleNode(L"@TotalPage")) + { + xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 + list::dw_pages.SetMaxPage(s.toInt()); + } + } + dw_list.Retrieve(x); + dw_list.Redraw(); + dw_list.SetReadOnly(true); + return 1; + } + + + + + int OnRetrieve() + { + xaserverarg arg; + + arg.AddArg(L"pageindex", xstring(m_pageIndex)); //第几页 + arg.AddArg(L"pagenumber", xstring(m_pageNumber)); //每页数量 + //trace(list::m_QueryTxt); + arg.AddArg(L"QueryTxt", list::m_QueryTxt); //每页数量 + return SetEntityData(arg); + } + int OnTreeSelChanged(TEvent* evt, LPARAM p) + { + NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; + HTREEITEM hItem = nmtv.itemNew.hItem; + list::m_QueryTxt = L""; + + HTREEITEM hitem = tv_1.GetSelectedItem(); + //c_type=dw_type.GetItemLabel(hitem); + //如果是跟节点 + HTREEITEM roothitem = tv_1.GetRootItem(); + KXMLDOMElement e = tv_1.GetItemData(hitem); + xstring value = e.selectSingleNode(L"@data").text(); + sType = value + L""; + OnRetrieve(); + 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(); + xutil::RestoreCursor(hCursor); + return 1; + } + + int ViewUpdate(param pr, xstring updateItem, xaserverarg arg) + { + if (updateItem == L"del") + { + int DelRow = dw_list.GetRow(); + dw_list.DeleteRow(DelRow); + + } + + return 1; + } + + int OnAttachEvent() + { + //获得树的选择事件 + AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&ForwarderList::OnTreeSelChanged); + return 1; + } + + int onload() + { + list::m_QueryTxt = L""; + m_pageIndex = 1; + m_pageNumber = 30; + sType = L"0"; + list::onload(); + + OnAttachEvent(); + + + + tv_1 = new treeview; + tv_1.setNativePointer(GetControl(L"tv_1")); + + HTREEITEM root = tv_1.GetRootItem(); + tv_1.ExpandItem(root); + dw_list.SetColumnStaus(L"ForwarderID", false); + return 1; + } +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/ForwarderMaint.cpp b/jrj/project/business/BasicCode/ForwarderMaint.cpp new file mode 100644 index 0000000..89951e0 --- /dev/null +++ b/jrj/project/business/BasicCode/ForwarderMaint.cpp @@ -0,0 +1,467 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) ForwarderMaint : public xframe +{ +public: + KXMLDOMDocument m_configDoc; + + xdwtable dw_base; + xstring m_userid; + xstring m_username; + xstring ContactID; + xcell dw_cell; + +public: + ForwarderMaint(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} +public: + static ForwarderMaint* CreateInstance(void* implPtr, void* hWnd) + { + ForwarderMaint* pWin = new ForwarderMaint(implPtr, (HWND)hWnd); + return pWin; + } + int alert(xstring str) + { + //win::MessageBox(GetHWND(),str,L"提示22:",0); + TApp::alert(this, str); + return 0; + } + int setCellReadOnly() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + dw_cell = new xcell; + dw_cell.setNativePointer(dw_base.QueryItem(L"ixcell")); + xstring strnew = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''/>"; + //dw_cell.SetCellProps(2,2,strnew); + return 0; + } + + xstring GetGuid() { + return publiccode::GetGuid(); + } + int OnClear() { + if (m_EntityID == L"") { + trace(1); + m_userid = publiccode::GetUser().id; + m_username = publiccode::GetUser().name; + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + dw_base.SetItemString(1, L"ForwarderID", GetGuid()); + dw_base.SetItemString(1, L"PartyID", GetGuid()); + dw_base.SetItemString(1, L"PStatus", L"1"); + dw_base.SetItemDisplayString(1, L"PStatus", L"普通"); + dw_base.SetItemString(1, L"CreatorID", m_userid); + dw_base.SetItemString(1, L"PADStatus", L"1"); + dw_base.SetItemString(1, L"AddressID", GetGuid()); + dw_base.SetItemString(1, L"PADIdentifyAddressFlag", L"Y"); + dw_base.SetItemString(1, L"PADPrimaryFlag", L"Y"); + //dw_base.SetItemString(1,L"BankAccountID",GetGuid()); + dw_base.SetItemString(1, L"Type", L"5"); + dw_base.SetItemString(1, L"EnterName", m_userid); + dw_base.SetItemDisplayString(1, L"EnterName", m_username); + dw_base.SetItemString(1, L"CreateDate", publiccode::GetCurrentDate()); + /*xdwtable dw = new xdwtable; + dw.setNativePointer(dw_base.GetCurTable()); + xdwtable dwcon = new xdwtable; + dwcon.setNativePointer(dw.FindDwTable(L"Contacters",0)); + dwcon.SetItemString(1,L"ContactID",GetGuid()); + dwcon.SetItemString(1,L"PCStatus",L"1");*/ + //dw_base.SetItemString(1,L"EBankAccountID",GetGuid()); + //dw_base.SetItemString(1,L"CBankAccountID",GetGuid()); + /*xdwtable dweon = new xdwtable; + dweon.setNativePointer(dw_base.FindDwTable(L"item1",0)); + xdwtable dwcon = new xdwtable; + dwcon.setNativePointer(dw_base.FindDwTable(L"item2",0)); + dweon.SetItemString(1,L"EPBAStatus",L"Y"); + dwcon.SetItemString(1,L"CPBAStatus",L"Y"); + dweon.SetItemString(1,L"ECurrencyCode",L"USD"); + dwcon.SetItemString(1,L"CCurrencyCode",L"RMB");*/ + dw_base.SetItemString(1, L"ForwarderType", L"1"); + dw_base.SetItemDisplayString(1, L"ForwarderType", L"预付货"); + //dw_base.SetItemString(1,L"PrimaryContactID",dwcon.GetItemString(1,L"ContactID")); + + } + else + { + setCellReadOnly(); + } + return 0; + } + + int OnAddrow() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xdwtable dw = new xdwtable; + dw.setNativePointer(dw_base.GetCurTable()); + xstring dw_n = dw.GetDwName(); + if (dw_n == L"item") + { + dw.InsertRow(0); + int rows = dw.GetRowCount(); + dw.SetRow(rows); + } + return 1; + } + int OnInsertRow() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xdwtable dw = new xdwtable; + dw.setNativePointer(dw_base.GetCurTable()); + xstring dw_n = dw.GetDwName(); + if (dw_n == L"item") + { + int row = dw.GetRow(); + if (row < 1) return 0; + dw.InsertRow(row); + dw.SetRow(row); + } + return 1; + } + + int OnDeleteRow() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xdwtable dw = new xdwtable; + dw.setNativePointer(dw_base.GetCurTable()); + xstring dw_n = dw.GetDwName(); + if (dw_n == L"item") + { + int row = dw.GetRow(); + if (row < 1) return 0; + /*xstring del = dw.GetItemString(row,8); + if(del!=L"") + { + if(m_dels==L"") + { + m_dels=del; + } + else + { + xstring temp=m_dels; + m_dels=del + L"|" + temp; + //+= L"|"+del; + } + + }*/ + dw.DeleteRow(row); + dw.SetRow(row - 1); + } + //trace(m_dels); + return 1; + } + xstring getGoodsNo() + { + xml x; + + xaserverarg arg; + + if (getUrl(L"/sale/data/LogisticsCode/pref/PartyNo", arg.GetString(), x) != 1) + { + trace(x.xml()); + return L""; + } + KXMLDOMElement e = x.documentElement(); + if (e) + { + xstring code = e.text(); + trace(code); + return L"F" + code; + } + return L"F1000"; + } + int OnPreSave() + { + dw_base.AcceptText(); + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xstring ForwarderNo = dw_base.GetItemString(1, L"ForwarderNo"); + if (ForwarderNo == L"") + { + dw_base.SetItemString(1, L"ForwarderNo", getGoodsNo()); + } + xdwtable dwcon = new xdwtable; + dwcon.setNativePointer(dw_base.FindDwTable(L"item", 0)); + int i; + for (i = 1; i <= dwcon.GetRowCount(); i++) + { + xstring aTemp; + xstring aName = dwcon.GetItemString(i, L"ContacterName"); + trace(aName); + if (aName == L"") + { + aTemp = dwcon.GetItemString(i, L"Mobile") + dwcon.GetItemString(i, L"TEL") + dwcon.GetItemString(i, L"Fax") + dwcon.GetItemString(i, L"Email") + dwcon.GetItemString(i, L"PCRemark") + dwcon.GetItemString(i, L"fz"); + trace(aTemp); + if (aTemp != L"") + { + alert(L"联系人名称必填!"); + return -1; + } + } + else { + xstring ContactID = dwcon.GetItemString(i, L"ContactID"); + if (ContactID == L"") + { + dwcon.SetItemString(i, L"ContactID", GetGuid()); + dwcon.SetItemString(i, L"PCStatus", L"Y"); + dw_base.SetItemString(1, L"PrimaryContactID", dwcon.GetItemString(1, L"ContactID")); + } + } + } + xdwtable dwcon2 = new xdwtable; + dwcon2.setNativePointer(dw_base.FindDwTable(L"item2", 0)); + int k; + xstring sPBABankName2 = L""; + xstring sPBABankAccountNo2 = L""; + for (k = 1; k <= dwcon2.GetRowCount(); k++) + { + sPBABankName2 = dwcon2.GetItemString(k, L"CBank"); + sPBABankAccountNo2 = dwcon2.GetItemString(k, L"CBankNo"); + + xstring sPBAAll2 = sPBABankName2 + sPBABankAccountNo2; + + if (sPBAAll2 != L"") + { + if (sPBABankName2 == L"") + { + alert(L"人民币银行名称不能为空"); + return -1; + } + if (sPBABankAccountNo2 == L"") + { + alert(L"人民币银行账户不能为空"); + return -1; + } + dwcon2.SetItemString(k, L"CPBAStatus", L"Y"); + dwcon2.SetItemString(k, L"CCurrencyCode", L"RMB"); + dwcon2.SetItemString(k, L"CBankAccountID", GetGuid()); + + if (dwcon2.GetItemString(k, L"CBankAccountID") != L"" && m_EntityID == L"") + { + dw_base.SetItemString(1, L"CBkAccountID", dwcon2.GetItemString(k, L"CBankAccountID")); + } + } + } + xdwtable dwcon1 = new xdwtable; + dwcon1.setNativePointer(dw_base.FindDwTable(L"item1", 0)); + int j; + xstring sPBABankName1 = L""; + xstring sPBABankAccountNo1 = L""; + for (j = 1; j <= dwcon1.GetRowCount(); j++) + { + xstring sPBABankName1 = dwcon1.GetItemString(j, L"EBank"); + xstring sPBABankAccountNo1 = dwcon1.GetItemString(j, L"EBankNo"); + + xstring sPBAAll1 = sPBABankName1 + sPBABankAccountNo1; + if (sPBAAll1 != L"") + { + if (sPBABankName1 == L"") + { + alert(L"美金银行名称不能为空"); + return -1; + } + if (sPBABankAccountNo1 == L"") + { + alert(L"美金银行账户不能为空"); + return -1; + } + dwcon1.SetItemString(j, L"EPBAStatus", L"Y"); + dwcon1.SetItemString(j, L"ECurrencyCode", L"USD"); + dwcon1.SetItemString(j, L"EBankAccountID", GetGuid()); + if (dwcon1.GetItemString(j, L"EBankAccountID") != L"" && m_EntityID == L"") + { + dw_base.SetItemString(1, L"EBkAccountID", dwcon1.GetItemString(j, L"EBankAccountID")); + } + } + } + return 1; + } + int OnPostSave() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xaserverarg args; + + xml x; + + dw_base.DwUpdateAllTo(x); + //trace(x.xml()); + + //主联系人 + xstring spGuid; + KXMLDOMElement e; + var list = x.selectNodes(L"//item"); + int nlen = list.length; + int i; + for (i = 0; i < nlen; i++) + { + e = list.item(i); + if (i == 0) spGuid = e.selectSingleNode(L"@guid").text(); + xstring sP = e.selectSingleNode(L"PPrimaryFlag").text(); + if (sP == L"Y") + { + spGuid = e.selectSingleNode(L"@guid").text(); + break; + } + } + if (spGuid == L"") + { + trace(L"error"); + return 0; + } + args.AddArg(L"contact", spGuid); + //trace(L"<---->"); + //trace(spGuid); + xml x1; + + if (getUrl(L"/sale/data/SupplierSubmit/pref/primarycontact", args.GetString(), x) != 1) + { + xstring error = x1.text(); + trace(error); + return 0; + } + + + return 1; + } + int OnSave() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xstring SName = dw_base.GetItemString(1, L"Name"); + if (SName == L"") { + alert(L"请输入货代名称!"); + return -1; + } + int rec = OnPreSave(); + if (rec == -1) return -1; + xml x; + + dw_base.DwUpdateAllTo(x); + trace(x.xml()); + xaserverarg arg; + + arg.AddArg(L"content", x.xml()); + arg.AddArg(L"dbmap", L"Forwarder.dbmap"); + //arg.AddArg(L"m_dels",m_dels); + if (getUrl(L"/sale/data/LogisticsCode/entity/save", arg.GetString(), x) != 1) + { + trace(L"error:" + (xstring)x.xml()); + alert(L"保存失败!"); + return 0; + } + else + { + trace(x.xml()); + if (x.selectSingleNode(L"error")) + { + alert(L"保存出错2!"); + return 0; + } + alert(L"保存成功!"); + dw_base.ResetUpdateStatus(); + OnPostSave(); + } + dw_base.Redraw(); + //m_dels=L""; + return 0; + } + int OnCmdDispatch(xstring comdid) + { + if (comdid.find(L"action:bill.row.add", 0) >= 0) { + OnAddrow(); + } + else if (comdid.find(L"bill.row.insert", 0) >= 0) { + OnInsertRow(); + } + else if (comdid.find(L"bill.row.delete", 0) >= 0) { + OnDeleteRow(); + } + else if (comdid.find(L"bill.save", 0) >= 0) { + //trace(1); + OnSave(); + } + return 0; + } + + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + int OnCellChanged(TEvent* evt, LPARAM p) + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + xstring colname = hdr.colname; + xstring coldata = hdr.data; + trace(colname); + if (colname == L"ForwarderNo") + { + xstring cspec = dw_base.GetItemString(1, 1); + trace(cspec); + xstring SpecRule = L"^\\d*$"; + xaserverarg args; + + args.AddArg(L"CSpec", cspec); + args.AddArg(L"SpecRule", SpecRule); + xml x; + + getUrl(L"/sale/data/LogisticsCode/pref/forwarderno/check", args.GetString(), x); + + if (x.selectSingleNode(L"root/spec")) + { + alert(L"请输入数字!"); + return 0; + } + + } + //只能选一个主联系人 + else if (colname == L"PPrimaryFlag" && coldata == L"Y") + { + xdwtable dw_pc; + dw_pc = new xdwtable; + dw_pc.setNativePointer(dw_base.FindDwTable(L"item")); + if (dw_pc) + { + int i; + for (i = 1; i <= dw_pc.GetRowCount(); i++) + { + if (i != hdr.row) + dw_pc.SetItemString(i, L"PPrimaryFlag", L"N"); + } + } + } + return 1; + } + int OnAttachEvent() + { + AttachEvent(L"WM_XCOMMAND", (FEvent)&ForwarderMaint::OnXCommand); + //AttachEvent(L"WM_SETFOCUS",OnSetFocus); + AttachEvent(L"dw_base", L"DWV_ITEMCHANGED", (FEvent)&ForwarderMaint::OnCellChanged); + return 1; + } + int onload() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + + OnAttachEvent(); + //if(!m_configDoc) return -1; + + maint::onload(); + + OnClear(); + } + +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/FreightExpenseType.cpp b/jrj/project/business/BasicCode/FreightExpenseType.cpp new file mode 100644 index 0000000..b04754c --- /dev/null +++ b/jrj/project/business/BasicCode/FreightExpenseType.cpp @@ -0,0 +1,176 @@ +#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) FreightExpenseTypeWin : public xframe + { + public: + xdwgrid dw_list; + xnode m_agentNode; //Agent Condition + int seqno; + public: + FreightExpenseTypeWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} + public: + static FreightExpenseTypeWin* CreateInstance(void* implPtr, void* hWnd) + { + FreightExpenseTypeWin* pWin = new FreightExpenseTypeWin(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 CalcSeqNo() + { + seqno = -1; + for(int i=1; i<dw_list.GetRowCount();i++) + { + xstring val = dw_list.GetItemString(i,L"FieldName"); + if(val.find(L"OtherFee")==0) continue; + if(val.find(L"Other")==0) + { + xstring no = val.mid(5,99999); + if(no.toInt()>seqno) seqno = no.toInt(); + } + } + return seqno; + } + + //焦点激活处理函数 + int OnSetFocus(TEvent* evt, LPARAM param) + { + //重置工具条 + SetAgent(); + return 1; + } + + int OnSave() + { + dw_list.AcceptText(); + xml x= new xml; + + dw_list.DwUpdateAllToEx(x); + + xaserverarg arg; + arg.setNativePointer(xaserverarg::CreateInstance()); + arg.AddArg(L"content",x.xml()); + + //trace(x.xml()); + + if(xurl::get(L"/sale/data/LogisticsCode/entity/freightexpensetype/update", arg.GetString(),x)!=1) + { + xstring error = x.text(); + alert(L"err:"+error); + return 1; + } + //alert(x.xml()); + xstring str = x.documentElement().getAttribute(L"text"); + trace(x.xml()); + if(str == L"true") + { + dw_list.ResetUpdateStatus(); + alert(L"保存成功!"); + }else + { + alert(L"保存失败!"); + } + return 1; + } + + //命令发布函数 + int OnCmdDispatch(xstring comdid) + { + if(comdid==L"xmAddRow") + { + dw_list.InsertRow(0); + if(seqno==-1) CalcSeqNo(); + seqno++; + dw_list.SetItemString(dw_list.GetRowCount(),L"FieldName", L"Other"+xstring(seqno)); + return 1; + } + else if(comdid==L"xmDeleteRow") + { + dw_list.DeleteRow(0); + return 1; + } + else if(comdid==L"xmSave") + { + return OnSave(); + } + return 0; + } + + //命令处理事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&FreightExpenseTypeWin::OnXCommand); + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&FreightExpenseTypeWin::OnSetFocus); + return 1; + } + + int OnRetrieve() + { + xml x = new xml; + + if (getUrl(L"/sale/data/LogisticsCode/entity/freightexpensetype/list",L"",x)!=1) + { + trace(x.text()); + return -1; + }else + { + dw_list.Retrieve(x); + dw_list.Redraw(); + } + return 1; + } + + int onload() + { + dw_list = GetControl(L"dw_list"); + dw_list.openUrl(L"/sale/view/LogisticsCode/template/freightexpensetype/list"); + dw_list.SetColumnState(L"ID",false); + OnAttachEvent(); + seqno = -1; + + return 1; + } + + int onloaded() + { + SetAgent(); + OnRetrieve(); + return 1; + } + }; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/PaymentTerm.list.cpp b/jrj/project/business/BasicCode/PaymentTerm.list.cpp new file mode 100644 index 0000000..d21425f --- /dev/null +++ b/jrj/project/business/BasicCode/PaymentTerm.list.cpp @@ -0,0 +1,144 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) PaymentTermlist111 : public xwin +{ +public: + + xdwgrid dw_list; +public: + PaymentTermlist111(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} +public: + static PaymentTermlist111* CreateInstance(void* implPtr, void* hWnd) + { + PaymentTermlist111* pWin = new PaymentTermlist111(implPtr, (HWND)hWnd); + return pWin; + } + //xdwgrid dw_list; + int OnDBClick(TEvent* evt, LPARAM p) + { + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + int row = hdr.row; + //alert(row.toString()); + KXMLDOMElement e = dw_list.GetRowElement(row); + xstring id = e.selectSingleNode(L"TermID").text(); + //alert( id); + xaserverarg arg ; + + arg.AddArg(L"EntityID", id); + //arg.AddArg(L"hwnd", GetHWND().toString()); + + openUrl(L"/sale/view/Payment/worknode/Payment/maint", arg); + if (arg.GetArgString(L"ret") == L"Ok") + { + alert(L"OK"); + list::onloaded(); + } + return 1; + } + int OnDelete() + { + int row = dw_list.GetRow(); + if (row < 1) return 1; + KXMLDOMElement ele = dw_list.GetRowElement(row); + xstring termid = ele.selectSingleNode(L"TermID").text(); + xaserverarg arg ; + + arg.AddArg(L"termId",termid); + //alert(termid); + xml x1 ; + + if (xurl::post(L"/sale/data/PaymentTerm/entity/delete",arg.GetString(),x1) != 1) + { + xstring error = x1.text(); + trace(error); + } + else + { + //error = x1.text(); + //alert(error); + MessageBox(GetHWND(),L"删除成功!",L"提示",0); + dw_list.DeleteRow(row); + } + } + + int OnNew() + { + xaserverarg arg ; + + arg.AddArg(L"EntityID", L"new"); + + //openUrl(L"/sale/view/Test/worknode/company/maint", arg); + openUrl(L"/sale/view/Payment/worknode/Payment/maint", arg); + return 0; + } + int OnOpen() + { + xaserverarg arg ; + + int row = dw_list.GetRow(); + if (row < 1) + { + MessageBox(GetHWND(),L"请选中要修改的行!",L"提示",0); + return -1; + } + KXMLDOMElement e = dw_list.GetRowElement(row); + xstring guid = e.selectSingleNode(L"TermID").text(); + arg.AddArg(L"EntityID",guid); + + openUrl(L"/sale/view/Test2/worknode/company2/maint", arg); + + } + int OnRefresh() + { + list::onloaded(); + return 0; + } + //按钮事件 + int OnCmdDispatch(xstring comdid) + { + //alert(comdid); + if (comdid == L"action:bill.new") return OnNew(); + else if(comdid == L"action:bill.open") return OnOpen(); + else if(comdid == L"Refresh") return OnRefresh(); + else if(comdid == L"action:bill.delete") return OnDelete(); + return 0; + } + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + //命令发布函数 + int OnAttachEvent() + { + AttachEvent(L"WM_XCOMMAND", (FEvent)&PaymentTermlist111::OnXCommand); + //AttachEvent(L"WM_SETFOCUS",OnSetFocus); + + //AttachEvent(L"dw_list",L"DWV_ROWFOCUSCHANGED",OnRowChanged); + AttachEvent(L"dw_list",L"DWV_DOUBLECLICKED", (FEvent)&PaymentTermlist111::OnDBClick); + return 1; + } + int onload() + { + + list::onload(); + OnAttachEvent(); + } + + int onloaded() + { + //OnRetrieve(); + //alert(L"12"); + list::onloaded(); + + + return -1; + } +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/PaymentTerm.maint.cpp b/jrj/project/business/BasicCode/PaymentTerm.maint.cpp new file mode 100644 index 0000000..3604cc8 --- /dev/null +++ b/jrj/project/business/BasicCode/PaymentTerm.maint.cpp @@ -0,0 +1,429 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) PaymentTermEdit : public xframe +{ +public: + xdwtable dw_base; + xdwtable dw_p; + xcell dw_cell; + xstring sCryno; +public: + PaymentTermEdit(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} +public: + static PaymentTermEdit* CreateInstance(void* implPtr, void* hWnd) + { + PaymentTermEdit* pWin = new PaymentTermEdit(implPtr, (HWND)hWnd); + return pWin; + } + int OnAddrow() + { + dw_p = dw_base.FindDwTable(L"line"); + int i; + double dDueAmount = 0; + double dPercnet = 100; + for (i = 1 ; i <= dw_p.GetRowCount();i++) + { + dDueAmount = dw_p.GetItemDouble(i,L"DueAmount"); + if (dDueAmount > 0) + break; + dPercnet = dPercnet - dw_p.GetItemDouble(i,L"DuePercent"); + } + int irow = dw_p.InsertRow(0); + dw_p.SetItemString(irow,L"SeqNo",xstring(irow)); + if (dDueAmount <= 0) + dw_p.SetItemDouble(irow,L"DuePercent",dPercnet); + + return 1; + } + int OnDeleterow() + { + dw_p = dw_base.FindDwTable(L"line"); + int row2 = dw_p.GetRow(); + if (row2 < 1) return 0; + dw_p.DeleteRow(row2); + + return 1; + } + xstring OnCreateTxt() + { + //dw_1.AcceptText(); //不能加会报错 + int irow; + //int icnt = dw_1.GetRowCount(); + dw_p = dw_base.FindDwTable(L"line"); + int icnt = dw_p.GetRowCount(); + if (icnt < 1) return L""; + xstring sTxt; + //double dPercnet = 100; + for (irow = 1;irow <= icnt ;irow ++) + { + xstring sPaymentMethod = dw_p.GetItemString(irow,L"PaymentMethod"); //支付方式 + //xstring sDueDays = dw_p.GetItemDisplayString(irow,L"DueDays"); + xstring sDueDays = dw_p.GetItemString(irow,L"DueDays"); //期限 + xstring sDuePercent = dw_p.GetItemString(irow,L"DuePercent"); //比例 + xstring sDueAmount = dw_p.GetItemString(irow,L"DueAmount"); //金额 + + if (!sPaymentMethod || sPaymentMethod == L"") + sTxt = sTxt + L""; + if (!sDueDays || sDueDays == L"") + sTxt = sTxt + L""; + else + { + if (sDueDays == L"-1") sDueDays = L" IN ADVANCE"; + else if (sDueDays == L"0") sDueDays = L" AT SIGHT"; + else + { + if (sPaymentMethod == L"T/T") + sDueDays = L" WITHIN "+sDueDays + L" DAYS AFTER SHIPMENT"; + else + sDueDays = L" AT "+sDueDays + L" DAYS"; + } + + if (!sDuePercent || sDuePercent == L"") + { + if (!sDueAmount || sDueAmount == L"") + sTxt = sTxt + L""; + else + { + + sTxt = sTxt + sCryno + L" " + sDueAmount + L" " + sPaymentMethod + sDueDays + L";"; + } + } + else + { + if (sDuePercent.find(L".",0) >= 0) + { + while (sDuePercent.right(1) == L"0") + { + sDuePercent = sDuePercent.left(sDuePercent.length() - 1); + } + if (sDuePercent.right(1) == L".") + sDuePercent = sDuePercent.left(sDuePercent.length() - 1); + } + + sTxt = sTxt + sDuePercent + L"% " + sPaymentMethod+ sDueDays + L";"; + } + } + } + + sTxt = sTxt.mid(0,sTxt.length() - 1); + if (sTxt != L"") + sTxt = sTxt + L"."; + + return sTxt; + } + int OnOk() + { + dw_base.AcceptText(); + //判断是否有必输值为空 + dw_p = dw_base.FindDwTable(L"line"); + double dPercnet = 0; + double dAmount = 0; + xstring sChargeAll = L""; + if (dw_p) + { + int i; + for (i=1;i <= dw_p.GetRowCount();i++) + { + xstring seqNo = dw_p.GetItemString(i,L"SeqNo"); + xstring sPaymentMethod = dw_p.GetItemString(i,L"PaymentMethod"); + xstring sDueDays = dw_p.GetItemString(i,L"DueDays"); + xstring sDuePercent = dw_p.GetItemString(i,L"DuePercent"); + dPercnet = dPercnet + sDuePercent.toDouble(); + xstring sDueAmount = dw_p.GetItemString(i,L"DueAmount"); + dAmount = dAmount + sDueAmount.toDouble(); + if (!seqNo) seqNo = L""; + if (!sPaymentMethod) sPaymentMethod = L""; + if (!sDueDays) sDueDays = L""; + if (!sDuePercent) sDuePercent = L""; + if (!sDueAmount) sDueAmount = L""; + dw_p.SetItemString(i,L"SeqNo",xstring(i)); + sChargeAll = sPaymentMethod + sDueDays + sDuePercent + sDueAmount; + if (sChargeAll != L"") + { + if (sPaymentMethod == L"") + { + alert(L"支付方式不能为空!"); + return 0; + } + if (sDueDays == L"") + { + alert(L"期限不能为空!"); + return 0; + } + + } + } + } + + //百分比校验 + if (dw_p.GetRowCount() <= 1 && sChargeAll == L"") + {} + else + { + if (dPercnet != 100) + { + if (dAmount <= 0) + { + alert(L"比率不等于100!"); + return 0; + } + } + } + + xstring sTxt = OnCreateTxt(); + dw_base.SetItemString(1,L"PaymentTermEx",sTxt); + + //CloseWindow(); + 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"DueDays") + { + xdwtable dw; + dw = dw_base.FindDwTable(L"line"); + + if (dw) + { + xstring sPaymentMethod = dw.GetItemString(row,L"PaymentMethod"); + if (value == L"0") + { + if (sPaymentMethod == L"T/T") + { + //alert(L"此支付方式期限不能为 0 (AT SIGHT)"); + //return -1; + } + } + else if (value == L"-1") + { + if (sPaymentMethod != L"T/T") + { + alert(L"此支付方式期限不能为 -1(IN ADVANCE)"); + return -1; + } + } + } + + } + //生成支付条款文本 + if (colname == L"PaymentMethod" || colname == L"DueDays" || colname == L"DuePercent" || colname == L"DueAmount") + { + xstring sTxt = OnCreateTxt(); + + dw_base.SetItemString(1,L"Description",sTxt); + } + + return 1; + } + int OnClick(TEvent* evt, LPARAM p) + { + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + xstring value = hdr.data; + xstring colname = hdr.colname; + int row = hdr.row; + xaserverarg arg; + + //alert(row.toString()); + xdwtable dw; + dw = dw_base.FindDwTable(L"line"); + //alert(colname); + if (dw) + { + if (colname == L"DuePercent") + { + int i; + int icnt = dw.GetRowCount(); + if (icnt < 1) + return 0; + double dDueAmount = 0; + for (i = 1 ; i <= icnt ; i++) + { + dDueAmount = dw.GetItemDouble(i,L"DueAmount"); + if (dDueAmount > 0) + break; + } + dw_cell.setNativePointer(dw_base.QueryItem(L"ixcell")); + if (dDueAmount > 0) + { + dw.SetColumnProp(L"DuePercent",L"cellprotect",L"保护");//保护中文规格 + } + else + { + dw.SetColumnProp(L"DuePercent",L"cellprotect",L"不保护");//保护中文规格 + } + + } + + if (colname == L"DueAmount") + { + int j; + int jcnt = dw.GetRowCount(); + if (jcnt < 1) + return 0; + double dDuePercent = 0; + for (j = 1 ; j <= jcnt ; j++) + { + dDuePercent = dw.GetItemDouble(j,L"DuePercent"); + if (dDuePercent > 0) + break; + } + if (dDuePercent > 0) + { + dw.SetColumnProp(L"DueAmount",L"cellprotect",L"保护");//保护中文规格 + } + else + { + dw.SetColumnProp(L"DueAmount",L"cellprotect",L"不保护");//保护中文规格 + } + } + + } + + return 1; + } + + //保存事件 + int OnSave() + { + if(OnOk()<1)return 0; + dw_base = GetControl(L"dw_base"); + dw_base.AcceptText(); + //dw_bank.AcceptText(); + xml x ; + xaserverarg arg ; + + dw_base.DwUpdateAllTo(x); + //dw_bank.DwUpdateAllTo(x); + //alert(x.xml()); + + arg.AddArg(L"content",x.xml()); + arg.AddArg(L"dbmap",L"FND_PaymentTerm.dbmap"); + //return 0; + if (getUrl(L"/sale/data/PaymentTerm/entity/company/save",arg.GetString(),x) != 1) + { + alert(L"保存失败!"); + return 0; + } + else + { + //alert(x.xml()); + if(x.selectSingleNode(L"error")) + { + alert(L"保存出错2!"); + return 0; + } + arg.AddArg(L"ret",L"Ok"); + MessageBox(GetHWND(),L"保存成功!",L"提示",0); + //alert(L"保存成功"); + dw_base.ResetUpdateStatus(); + //dw_bank.ResetUpdateStatus(); + //xwin::SendMessage(parenthwnd, 0x401, L"maintsave", 0);//通知list窗口更新数据 + } + //alert(L"保存成功"); + dw_base.Redraw(); + //dw_bank.Redraw(); + CloseWindow(); + return 0; + } + + int OnCmdDispatch(xstring comdid) + { + //alert(comdid); + if(comdid==L"xmOk") OnSave(); + else if(comdid==L"addrow") OnAddrow(); + else if(comdid==L"deleterow") OnDeleterow(); + //else if(comdid==L"AddRow") OnAddRow(); + //else if(comdid==L"InsertRow") OnInsertRow(); + //else if(comdid==L"DeleteRow")OnDeleteRow(); + return 1; + } + + //按钮事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnAttachEvent() + { + //按钮事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&PaymentTermEdit::OnXCommand); + //获取焦点事件,用于重置工具条 + //AttachEvent(L"WM_SETFOCUS",OnSetFocus); + AttachEvent(L"dw_base",L"DWV_ITEMCHANGED", (FEvent)&PaymentTermEdit::OnItemChanged); + AttachEvent(L"dw_base",L"DWV_CLICKED", (FEvent)&PaymentTermEdit::OnClick); + return 1; + } + int OnRetrieve() + { + if(GetWinParam()) + { + int p = GetArg(); + xaserverarg args ; + + xstring id = args.GetArgString(L"EntityID"); + //alert(id); + if(id==L"new") + { + + //OnAddNew(); + } + else + { + xml x ; + + if(getUrl(L"/sale/data/PaymentTerm/entity/base12", args.GetString(), x) != 1) + { + alert(L"错误"); + return -1; + } + //alert(x.xml()); + dw_base.Retrieve(x); + //dw_bank.Retrieve(x); + dw_base.Redraw(); + //dw_bank.Redraw(); + } + } + return 1; + } + + int onload() + { + SetArg(); + //maint::onload(); + //maint::onloaded(); + dw_base = GetControl(L"dw_base"); + dw_cell = new xcell; + dw_cell.setNativePointer(dw_base.QueryItem(L"ixcell")); + dw_base.openUrl(L"/sale/view/Payment/template/Payment/maint"); + //alert(L"1233"); + OnRetrieve(); + OnAttachEvent(); + //dw_base = GetControl(L"dw_base"); + + } + + int onloaded() + { + //maint::onloaded(); + //alert(L"response"); + //dw_base = GetControl(L"dw_base"); + //dw_cell = new xcell; + //dw_cell.setNativePointer(dw_base.QueryItem(L"ixcell")); + return -1; + } + +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/ProfitParam.cpp b/jrj/project/business/BasicCode/ProfitParam.cpp new file mode 100644 index 0000000..80468cf --- /dev/null +++ b/jrj/project/business/BasicCode/ProfitParam.cpp @@ -0,0 +1,140 @@ +#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) ProfitParamList : public xframe + { + public: + xdwgrid dw_list; + + xnode m_agentNode; //Agent Condition + public: + ProfitParamList(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} + public: + static ProfitParamList* CreateInstance(void* implPtr, void* hWnd) + { + ProfitParamList* pWin = new ProfitParamList(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 OnSave() + { + xml x = new xml; + + dw_list.AcceptText(); + dw_list.DwUpdateAllToEx(x); + xaserverarg arg; + arg.setNativePointer(xaserverarg::CreateInstance()); + arg.AddArg(L"content",x.xml()); + if(xurl::get(L"/sale/data/Gdn/update/ProParamUpdate", 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(); + dw_list.Redraw(); + alert(L"保存成功!"); + }else + { + alert(L"保存失败!"); + } + } + //命令发布函数 + int OnCmdDispatch(xstring comdid) + { + if(comdid == L"xmsave") + { + OnSave(); + } + else if(comdid == L"xmrefresh") + { + OnRetrieve(); + } + return 0; + } + + //命令处理事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&ProfitParamList::OnXCommand); + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&ProfitParamList::OnSetFocus); + return 1; + } + + + int OnRetrieve() + { + xml x = new xml; + x = ViewObject::RetrieveData(L"/sale/data/Gdn/profit/profitParamList"); + if(x) + { + //alert(x.xml()); + dw_list.Retrieve(x); + dw_list.Redraw(); + } + return 1; + } + + int onload() + { + OnAttachEvent(); + dw_list = GetControl(L"dw_list"); + dw_list.openUrl(L"/sale/view/VATNotify/template/profitparam/list"); + + OnRetrieve(); + return 1; + } + + int onloaded() + { + SetAgent(); + + return 1; + } + }; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/QuickCode.cpp b/jrj/project/business/BasicCode/QuickCode.cpp new file mode 100644 index 0000000..ffc66cf --- /dev/null +++ b/jrj/project/business/BasicCode/QuickCode.cpp @@ -0,0 +1,678 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) QuickCode : public xwin +{ +public: + xdwgrid dw_list; + + xstring m_config; + xstring m_agent; + xstring m_id; + xstring m_dbmap; + xstring m_name; + xstring strconfig; + KXMLDOMDocument m_configDoc; + xnode m_agentNode; +public: + QuickCode(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} +public: + static QuickCode* CreateInstance(void* implPtr, void* hWnd) + { + QuickCode* pWin = new QuickCode(implPtr, (HWND)hWnd); + return pWin; + } + int alert(xstring str) + { + //win::MessageBox(GetHWND(),str,L"提示:",0); + TApp::alert(this, str); + return 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; + } + + int OnCmdDispatch(xstring comdid) + { + + HCURSOR hCursor = xutil::SetCursorWait(); + if (comdid == L"save") { + //type + xaserverarg args; + + args.AddArg(L"id", m_id); + args.AddArg(L"name", m_name); + xml y; + + //TDataSet::exec(m_config,L"savetype",args,y); + //url::post(L"QuickCode/pref/quickcode_type.save",args.GetString(),y); + //save + + xml x; + + xaserverarg arg; + + dw_list.AcceptText(); + dw_list.DwUpdateAllToEx(x); + KXMLDOMElement e = x.documentElement(); + e.setAttribute(L"id", m_id); + //arg.AddArg(L"id",m_id); + arg.AddArg(L"content", e.xml()); + arg.AddArg(L"dbmap", m_dbmap); + //trace(L"-->",m_id); + //trace(L"-->",m_dbmap); + //trace(e.xml()); + /*if(TDataSet::exec(m_config,L"save",arg,x)!=1) + { + trace(L"error:"+x.xml()); + alert(L"保存出错!"); + return 0; + }*/ + //trace(m_dbmap); + trace(x.xml()); + if (xurl::get(L"QuickCode/pref/quickcode.save", arg.GetString(), x) != 1) + { + xstring error = x.text(); + trace(error); + } + trace(x.xml()); + if (x.selectSingleNode(L"error")) + { + alert(L"保存出错2!"); + return 0; + } + dw_list.ResetUpdateStatus(); + alert(L"保存成功!"); + } + else if (comdid == L"add") { + dw_list.InsertRow(0); + int rows = dw_list.GetRowCount(); + dw_list.SetRow(rows); + dw_list.SetItemString(rows, L"ToCurrencyCode", L"RMB"); + dw_list.SetItemDisplayString(rows, L"ToCurrencyCode", L"人民币"); + } + else if (comdid == L"insert") { + int row = dw_list.GetRow(); + if (row<1 || row>dw_list.GetRowCount()) return 0; + dw_list.InsertRow(row); + dw_list.SetItemString(row, L"ToCurrencyCode", L"RMB"); + dw_list.SetItemDisplayString(row, L"ToCurrencyCode", L"人民币"); + } + else if (comdid == L"delet") { + /*int rows = dw_list.GetRowCount(); + int row2 = dw_list.GetPrevSelectRow(rows); + while(row2 > 0){ + dw_list.DeleteRow(row2); + row2 = dw_list.GetPrevSelectRow(row2 - 1); + } + dw_list.SelectRow(0, false);*/ + int row2 = dw_list.GetRow(); + if (row2<1 || row2>dw_list.GetRowCount()) return 0; + dw_list.DeleteRow(row2); + } + else if (comdid == L"import") { + if (m_id == L"FND_ExchangeRate") + { + int ll_delq = MessageBox(GetHWND(), L"确定要从老系统导入汇率数据吗?", L"提示", 1); + if (ll_delq != 1) + return 0; + xml xi; + + xaserverarg argi; + argi.setNativePointer(argi.CreateInstance()); + if (xurl::get(L"QuickCode/ExchangeRate/import", argi.GetString(), xi) != 1) + { + trace(xi.text()); + return -1; + } + alert(L"导入成功!"); + dw_list.Redraw(); + } + + } + xutil::RestoreCursor(hCursor); + return 0; + } + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + int OnSetFocus(TEvent* evt, LPARAM p) { + SetAgent(); + return 1; + } + int OnClicked(TEvent* evt, LPARAM p) + { + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + int row = hdr.row; + int col = hdr.col + 1; + xstring colname = dw_list.GetColumnName(col); + trace(colname); + xaserverarg arg; + + xstring comdid; + if (colname == L"CategoryID") + { + openUrl(L"产品资料.vface/xpage/product/category/dialog", arg); + comdid = arg.GetArgString(L"comdid"); + if (comdid == L"ok") + { + xstring CategoryID = arg.GetArgString(L"CategoryID"); + xstring CName = arg.GetArgString(L"CName"); + dw_list.SetItemDisplayString(row, colname, CName); + dw_list.SetItemString(row, colname, CategoryID); + dw_list.Redraw(); + } + } + else if (colname == L"MkOrgId") + { + openUrl(L"组织架构.vface/xpage/HrOrg/Chart", arg); + comdid = arg.GetArgString(L"comdid"); + if (comdid == L"xmOk") + { + xstring OrgName = arg.GetArgString(L"OrgName"); + xstring OrgId = arg.GetArgString(L"OrgId"); + dw_list.SetItemDisplayString(row, colname, OrgName); + dw_list.SetItemString(row, colname, OrgId); + dw_list.Redraw(); + } + } + else if (colname == L"Cid") + { + openUrl(L"组织架构.vface/xpage/hremployee/select", arg); + comdid = arg.GetArgString(L"comdid"); + if (comdid == L"xmOk") + { + xstring sPersonID = arg.GetArgString(L"sPersonID"); + trace(sPersonID); + xstring sPersonName = arg.GetArgString(L"sPersonName"); + dw_list.SetItemDisplayString(row, colname, sPersonName); + dw_list.SetItemString(row, colname, sPersonID); + dw_list.Redraw(); + } + } + return 1; + } + int OnDoubleClicked(TEvent* evt, LPARAM p) + { + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + int row = hdr.row; + if (row<1 || row > dw_list.GetRowCount()) return 0; + + xaserverarg arg; + + //xstring str = hdr.data; + xstring colname = hdr.colname; + xstring str = dw_list.GetItemString(row, colname); + arg.AddArg(L"value", str); + openUrl(L"/sale/view/view.dlg/xpage/memo/edit", arg); + xstring comdid = arg.GetArgString(L"comdid"); + if (comdid == L"xmOK") + { + xstring value = arg.GetArgString(L"value"); + dw_list.SetItemString(row, colname, value); + dw_list.Redraw(); + } + + return 1; + } + int ItemOutput() + { + xstring d = xaserver::GetCurrentDate(); + d = d.left(10) + L""; + dw_list.SaveAs(d); + return 1; + } + int OnSelectAllRow() + { + int rows = dw_list.GetRowCount(); + if (rows < 1) return -1; + dw_list.SelectRow(1, rows, true); + dw_list.Redraw(); + return 1; + } + int OnRowCopy() + { + int rows = dw_list.GetRowCount(); + if (rows < 1) return -1; + int cols = dw_list.GetColumnCount(); + xstring str = L""; + int row = dw_list.GetNextSelectRow(1); + int i; + while (row > 0) + { + xstring tmp1 = L""; + for (i = 1; i < cols; i++) + { + int w = dw_list.GetColumnWidth(i); + if (w < 5) continue; + xstring tmp; + if (dw_list.GetItemDisplayString(row, i + 1)) + tmp = dw_list.GetItemDisplayString(row, i + 1); + else + tmp = dw_list.GetItemString(row, i + 1); + tmp1 += tmp + L"\t"; + } + str += tmp1 + L"\r\n"; + row = dw_list.GetNextSelectRow(row + 1); + } + dw_list.SetDataToClip(str); + return 1; + } + int OnColCopy(xstring col) + { + int rows = dw_list.GetRowCount(); + if (rows < 1) return -1; + xstring str = L""; + int row = dw_list.GetNextSelectRow(1); + while (row > 0) + { + xstring tmp; + if (dw_list.GetItemDisplayString(row, col)) + tmp = dw_list.GetItemDisplayString(row, col); + else + tmp = dw_list.GetItemString(row, col); + str += tmp + L"\r\n"; + row = dw_list.GetNextSelectRow(row + 1); + } + dw_list.SetDataToClip(str); + + return 1; + } + int OnRClick(TEvent* evt, LPARAM p) + { + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + int row = hdr.row; + + int m = win::CreatePopupMenu(); + int MF_STRING = 0x00000000; + int MF_DISABLED = 0x00000002; + int TPM_RIGHTBUTTON = 0x0002; + int TPM_RETURNCMD = 0x0100; + int MF_CHECKED = 0x8; + int MF_SEPARATOR = 0x0800; + win::AppendMenu(m, MF_STRING, 1, L"复制行"); + win::AppendMenu(m, MF_STRING, 101, L"复制列"); + win::AppendMenu(m, MF_SEPARATOR, -1, L""); + win::AppendMenu(m, MF_STRING, 2, L"全选"); + win::AppendMenu(m, MF_SEPARATOR, -1, L""); + win::AppendMenu(m, MF_STRING, 4, L"导出到Excel"); + win::AppendMenu(m, MF_SEPARATOR, -1, L""); + win::AppendMenu(m, MF_STRING, 6, L"显示列设置"); + xrect xr; + xpoint pt; + win::GetCursorPos(pt); + int ret = win::TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, GetHWND(), xr); + + //trace(ret); + HCURSOR hCursor = xutil::SetCursorWait(); + if (ret == 1) { OnRowCopy(); } + else if (ret == 101) { + xstring colname = hdr.colname; + if (colname != L"") + OnColCopy(colname); + } + else if (ret == 2) { OnSelectAllRow(); } + else if (ret == 4) { ItemOutput(); } + else if (ret == 6) {} + xutil::RestoreCursor(hCursor); + + return 1; + } + int OnAttachEvent() + { + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&QuickCode::OnSetFocus); + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&QuickCode::OnXCommand); + AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&QuickCode::OnDoubleClicked);//行双击 + AttachEvent(L"dw_list", L"DWV_ITEMBEINGEDIT", (FEvent)&QuickCode::OnClicked); + AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&QuickCode::OnRClick);//鼠标右键 + return 1; + } + int OnRetrieve() + { + xml x; + + xaserverarg arg; + + trace(L"asdasd"); + + if (m_id.find(L"", 0) > 0) + { + m_id = m_id.mid(0, m_id.find(L"", 0)); + arg.AddArg(L"id", m_id); + //trace(m_id); + /*if (TDataSet::exec(m_config, L"query_remark", arg.GetString(),x) != 1) + { + trace(x.text()); + return -1; + }*/ + if (xurl::get(L"QuickCode/entity/list_remark", arg.GetString(), x) != 1) + { + trace(x.text()); + return -1; + } + } + else + { + trace(L"asdasd"); + arg.AddArg(L"id", m_id); + arg.AddArg(L"querytxt", L""); + /*if (TDataSet::exec(m_config, L"query", arg.GetString(),x) != 1) + { + trace(x.text()); + return -1; + }*/ + if (xurl::get(L"QuickCode/entity/list", arg.GetString(), x) != 1) + { + trace(x.text()); + return -1; + } + } + + dw_list.Retrieve(x); + dw_list.Redraw(); + return 1; + } + xstring jxParam(xstring p, xstring n) + { + if (p != L"") + { + p += L"&"; + int i = 1; + while (p.find(L"=L", 0) > 0) + { + xstring name = p.mid(0, p.find(L"=L", 0)); + xstring value = p.mid(p.find(L"=L", 0) + 1, p.find(L"&", 0) - p.find(L"=L", 0) - 1); + if (name == n) return L"" + value; + i += 1; + p = p.mid(p.find(L"&", 0) + 1, p.length()); + } + } + return ""; + } + int getURLParam() + { + if (GetWinParam()) + { + xpage xp = new xpage; + xp.setNativePointer(GetXPage()); + xstring aurl = xp.GetWkUrl(); + xaserverarg arg; + if (aurl && aurl.find(L"native=true", 0) > 0) + { + int p = GetParam(); + arg; + arg.setNativePointer(p); + } + else + { + arg = GetParam(); + } + xstring config = arg.GetArgString(L"config"); + xml x; + + if (config == L"") + { + xstring configXml = arg.GetArgString(L"configxml"); + x.loadXML(configXml); + } + else + { + getUrl(config, L"", x); + } + m_configDoc = x; + + } + + return 1; + } + int loaded() + { + getURLParam(); + KXMLDOMDocument ee = m_configDoc; + xstring id = m_id; + var n = ee.selectSingleNode(L"//list/dwview[@type='dwgrid'][@id='" + id + L"']"); + xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text(); + xstring dwname = L"";//e.selectsingleNode(L"@name").text(); + xstring tpl = L"";//e.selectsingleNode(L"@url").text(); + xstring dbmap = L""; + if (n) + { + KXMLDOMElement e = n; + //trace(e.xml()); + if (e.selectSingleNode(L"@name")) dwname = e.selectSingleNode(L"@name").text(); + if (e.selectSingleNode(L"@url")) tpl = e.selectSingleNode(L"@url").text(); + if (e.selectSingleNode(L"@dbmap")) dbmap = e.selectSingleNode(L"@dbmap").text(); + //trace(vface +L"/"+ tpl); + //trace(selectmode); + } + else + { + var m = ee.selectSingleNode(L"//list"); + KXMLDOMElement e1 = m; + //trace(e.xml()); + if (e1.selectSingleNode(L"@name")) dwname = e1.selectSingleNode(L"@name").text(); + if (e1.selectSingleNode(L"@url")) tpl = e1.selectSingleNode(L"@url").text(); + if (e1.selectSingleNode(L"@dbmap")) dbmap = e1.selectSingleNode(L"@dbmap").text(); + + } + m_dbmap = dbmap; + dw_list = new xdwgrid; + dw_list.setNativePointer(GetControl(dwname)); + dw_list.openUrl(vface + L"/" + tpl); + //dw_list.SetSelectionMode(4); + + } + int Onital() + { + //地区 + xml x1; + + xaserverarg arg1; + arg1.setNativePointer(arg1.CreateInstance()); + arg1.AddArg(L"id", L"地区"); + if (xurl::get(L"/sale/data/QuickCode/entity/list", arg1.GetString(), x1) != 1) + { + trace(x1.text()); + return -1; + } + + var list = x1.selectNodes(L"root/item"); + int i; + int s = list.length; + if (s > 0) + { + xstring str = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='<data>"; + for (i = 0; i < s; i++) + { + KXMLDOMElement xitem = list.item(i); + xstring id = L""; + if (xitem.selectSingleNode(L"Code")) + id = xitem.selectSingleNode(L"Code").text(); + xstring name = L""; + if (xitem.selectSingleNode(L"Meaning")) + name = xitem.selectSingleNode(L"Meaning").text(); + xstring tmp = L"<row><显示列>" + name + L"</显示列><数据列>" + id + L"</数据列></row>"; + str += tmp; + } + str += L"</data>'/></cellprop>"; + + + dw_list.SetColumnProps(L"AreaCode", str); + } + //币别 + xml x2; + + xaserverarg arg2; + arg2.setNativePointer(arg2.CreateInstance()); + arg2.AddArg(L"id", L"FND_Currency"); + if (xurl::get(L"/sale/data/QuickCode/entity/list", arg2.GetString(), x2) != 1) + { + trace(x2.text()); + return -1; + } + + var list1 = x2.selectNodes(L"root/item"); + int j; + int s1 = list1.length; + if (s1 > 0) + { + xstring str1 = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='<data>"; + for (j = 0; j < s1; j++) + { + KXMLDOMElement xitem1 = list1.item(j); + xstring id1 = L""; + if (xitem1.selectSingleNode(L"Code")) + id1 = xitem1.selectSingleNode(L"Code").text(); + xstring name1 = L""; + if (xitem1.selectSingleNode(L"Name")) + name1 = xitem1.selectSingleNode(L"Name").text(); + xstring tmp1 = L"<row><显示列>" + name1 + L"</显示列><数据列>" + id1 + L"</数据列></row>"; + str1 += tmp1; + } + str1 += L"</data>'/></cellprop>"; + + + dw_list.SetColumnProps(L"FromCurrencyCode", str1); + } + //国家 + xml x3; + + xaserverarg arg3; + arg3.setNativePointer(arg3.CreateInstance()); + arg3.AddArg(L"id", L"FND_Country"); + if (xurl::get(L"/sale/data/QuickCode/entity/list", arg3.GetString(), x3) != 1) + { + trace(x3.text()); + return -1; + } + + var list2 = x3.selectNodes(L"root/item"); + int k; + int s2 = list2.length; + if (s2 > 0) + { + xstring str2 = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='<data>"; + for (k = 0; k < s2; k++) + { + KXMLDOMElement xitem2 = list2.item(k); + xstring id2 = L""; + if (xitem2.selectSingleNode(L"Code")) + id2 = xitem2.selectSingleNode(L"Code").text(); + xstring name2 = L""; + if (xitem2.selectSingleNode(L"Name")) + name2 = xitem2.selectSingleNode(L"Name").text(); + xstring tmp2 = L"<row><显示列>" + name2 + L"</显示列><数据列>" + id2 + L"</数据列></row>"; + str2 += tmp2; + } + str2 += L"</data>'/></cellprop>"; + + + dw_list.SetColumnProps(L"MkCountryId", str2); + } + dw_list.SetReadOnlyColumn(L"ToCurrencyCode"); + } + int onload() + { + SetArg(); + m_config = L"QuickCode.config"; + m_agent = L""; + + //dw_list = new xdwgrid; + //dw_list.setNativePointer(GetControl(L"dw_list")); + //dw_list.SetSelectionMode(4); + //dw_list.AllowSort(false); + if (GetWinParam()) + { + xaserverarg arg = GetArg(); + xstring id = arg.GetArgString(L"id"); + if (id == L"") return 0; + m_id = id; + loaded(); + + /*xstring tpl = arg.GetArgString(L"tpl"); + if(tpl == L"" && (m_id.find(L"",0) >0)) + tpl = L"QuickCode.tpl/QuickCode_Remark"; + else if(tpl == L"" ) + tpl = L"QuickCode.tpl/QuickCode"; + dw_list.SetDataObject(GetServerUrl(),L"dev:sheet["+tpl+L"]"); + xstring dbmap = arg.GetArgString(L"dbmap"); + if(dbmap == L"" && (m_id.find(L"",0) >0) ) + dbmap = L"QuickCode_Remark.dbmap"; + else if(dbmap == L"") + dbmap =L"QuickCode.dbmap"; + m_dbmap = dbmap; + xstring name = arg.GetArgString(L"name"); + if(name == L"") + name = id; + m_name = name; + xstring title = arg.GetArgString(L"title"); + if(title != L"") + win::SetWindowText(GetHWND(),title);*/ + + + + + /* + param p = GetParam(); + xstring pa = L""+p; + //xstring pa = L"id=HrOrgType&title=客户类型"; + xstring id = jxParam(pa,L"id"); + if(id == L"") return 0; + m_id = id; + xstring tpl = jxParam(pa,L"tpl"); + if(tpl == L"" && (m_id.find(L"",0) >0)) + tpl = L"QuickCode.tpl/QuickCode_Remark"; + else if(tpl == L"" ) + tpl = L"QuickCode.tpl/QuickCode"; + dw_list.SetDataObject(GetServerUrl(),L"dev:sheet["+tpl+L"]"); + xstring dbmap = jxParam(pa,L"dbmap"); + if(dbmap == L"" && (m_id.find(L"",0) >0) ) + dbmap = L"QuickCode_Remark.dbmap"; + else if(dbmap == L"") + dbmap =L"QuickCode.dbmap"; + m_dbmap = dbmap; + //trace(m_dbmap); + + xstring name = jxParam(pa,L"name"); + if(name == L"") + name = id; + m_name = name; + xstring title = jxParam(pa,L"title"); + if(title != L"") + win::SetWindowText(GetHWND(),title);*/ + OnRetrieve(); + } + + OnAttachEvent(); + SetAgent(); + Onital(); + return 1; + } +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/QuickCode_Tree.cpp b/jrj/project/business/BasicCode/QuickCode_Tree.cpp new file mode 100644 index 0000000..b8b99b0 --- /dev/null +++ b/jrj/project/business/BasicCode/QuickCode_Tree.cpp @@ -0,0 +1,696 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) QuickCode_Tree : public xwin +{ +public: + xdwgrid dw_list; + xtreeview tv_1; + xstring m_config; + xstring m_agent; + xstring m_id; + xstring m_dbmap; + xstring treexquery; + xstring c_type; + KXMLDOMDocument m_configDoc; + xstring kpstr; + xstring strtpl; + xstring m_QueryTxt; + xnode m_agentNode; +public: + QuickCode_Tree(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} +public: + static QuickCode_Tree* CreateInstance(void* implPtr, void* hWnd) + { + QuickCode_Tree* pWin = new QuickCode_Tree(implPtr, (HWND)hWnd); + return pWin; + } + int alert(xstring str) + { + TApp::alert(this, str); + //win::MessageBox(GetHWND(),str,L"提示:",0); + return 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; + } + int OnRetrieve() + { + dw_list.AcceptText(); + xml x; + + xaserverarg arg; + + arg.AddArg(L"id", m_id); + arg.AddArg(L"sType", c_type); + arg.AddArg(L"QueryTxt", m_QueryTxt); + //trace(arg.GetString()); + /*if (TDataSet::exec(m_config, L"query1", arg.GetString(),x) != 1) + { + trace(x.text()); + return -1; + }*/ + if (xurl::get(L"QuickCode/entity/listaddtree", arg.GetString(), x) != 1) + { + trace(x.text()); + return -1; + } + //trace(x.xml()); + if (x.xml() == L"") + { + xml xx; + xx.loadXML(L"<root/>"); + dw_list.Retrieve(xx); + dw_list.Redraw(); + } + else + { + dw_list.Retrieve(x); + dw_list.Redraw(); + } + + return 1; + } + int OnTreeSelChanged(TEvent* evt, LPARAM p) + { + NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; + HTREEITEM hItem = nmtv.itemNew.hItem; + + + HTREEITEM hitem = tv_1.GetSelectedItem(); + //c_type=dw_type.GetItemLabel(hitem); + //如果是跟节点 + HTREEITEM roothitem = tv_1.GetRootItem(); + if (hitem == roothitem) { + c_type = L""; + } + else + { + c_type = tv_1.GetItemLabel(hitem); + + } + OnRetrieve(); + return 1; + } + int adduomfolder() + { + xaserverarg arg; + + arg.AddArg(L"note", L"新增"); + arg.AddArg(L"m_id", m_id); + //win::OpenWindow(L"dev:xpage[AddUomGroup.vx]",arg); + openUrl(L"公共设置.vface/xpage/quickcode/AddGroup", arg); + xstring ok = arg.GetArgString(L"return"); + if (ok == L"ok") { + xstring GroupName = arg.GetArgString(L"GroupName"); + xml xx; + + xaserverarg args; + + args.AddArg(L"GroupName", GroupName); + args.AddArg(L"OldGroupName", L""); + args.AddArg(L"m_id", m_id); + /*if(TFile::exec(m_config,L"updateuomtype",args,xx)!=1) + { + trace(L"error:"+xx.xml()); + alert(L"保存出错!"); + return 0; + }*/ + if (xurl::get(L"QuickCode/pref/quickcode_tree.updateGroup", args.GetString(), xx) != 1) + { + trace(L"error:" + (xstring)xx.xml()); + alert(L"保存出错!"); + return 0; + } + else + { + xstring vv = xx.documentElement().text(); + xml x; + + x.loadXML(L"<row GroupName='" + GroupName + L"'/>"); + HTREEITEM root = tv_1.GetRootItem(); + if (vv == L"OK") + { + tv_1.InsertChildItem(root, GroupName, x.documentElement(), 15); + } + + } + } + return 1; + } + int modifyuomfolder() + { + + HTREEITEM h = tv_1.GetSelectedItem(); + if (!h) + { + alert(L"请选择需要修改的组名"); + return 0; + } + HTREEITEM roothitem = tv_1.GetRootItem(); + if (h == roothitem) + { + alert(L"不能修改根节点名称!"); + } + else + { + KXMLDOMElement e = tv_1.GetItemData(h); + trace(e.xml()); + //xstring OldGroupName= e.SelectSingleNode(L"@GroupName").text(); + xstring OldGroupName = tv_1.GetItemLabel(h); + xaserverarg arg; + + arg.AddArg(L"note", L"修改"); + arg.AddArg(L"m_id", m_id); + arg.AddArg(L"GroupName", OldGroupName); + OpenWindow(L"dev:xpage[AddUomGroup.vx]", arg); + xstring ok = arg.GetArgString(L"return"); + if (ok == L"ok") { + xstring NewGroupName = arg.GetArgString(L"GroupName"); + xml xx; + + xaserverarg args; + + args.AddArg(L"GroupName", NewGroupName); + args.AddArg(L"OldGroupName", OldGroupName); + args.AddArg(L"m_id", m_id); + /*if(TFile::exec(m_config,L"updateuomtype",args,xx)!=1) + { + trace(L"error:"+xx.xml()); + alert(L"保存出错!"); + return 0; + }*/ + if (xurl::get(L"QuickCode/pref/quickcode_tree.updateGroup", args.GetString(), xx) != 1) + { + trace(L"error:" + (xstring)xx.xml()); + alert(L"保存出错!"); + return 0; + } + else + { + trace(xx.xml()); + xstring vv = xx.documentElement().text(); + if (vv == L"OK") + { + tv_1.SetItemLabel(h, NewGroupName); + } + + } + } + } + return 1; + } + int deluomfolder() + { + + HTREEITEM hitem = tv_1.GetSelectedItem(); + if (!hitem) + { + alert(L"请选择需要删除的组名"); + return 0; + } + else + { + + int s = dw_list.GetRowCount(); + if (s > 0) + { + alert(L"该分组下面存在数据,不能删除!"); + return 0; + } + HTREEITEM roothitem = tv_1.GetRootItem(); + if (hitem == roothitem) + { + alert(L"不能删除根节点!"); + } + else + { + //缺少判断删除的条件 + xstring GroupName = tv_1.GetItemLabel(hitem); + if (MessageBox(GetHWND(), L"确定删除组名:" + GroupName + L" 吗?", L"提示", 1) == 1) + { + xml xx; + + xaserverarg arg; + + arg.AddArg(L"GroupName", GroupName); + arg.AddArg(L"m_id", m_id); + trace(GroupName); + trace(m_id); + /*if (xaserver::ExecXAction(GetServerUrl(),L"[delete.type.FND_UOM.xa]",arg.GetString()) == 1) + { + tv_1.DeleteItem(wid,hitem); + //OnTreeSelChanged(); + }*/ + if (xurl::get(L"QuickCode/pref/quickcode_tree.deleteGroup", arg.GetString(), xx) == 1) + { + tv_1.DeleteItem(hitem); + } + else + alert(L"删除失败!"); + } + } + } + return 1; + } + xdwgrid getDW() + { + return dw_list; + } + int GridSearch() + { + xml x; + + xaserver::LoadUrl(L"", L"dev:vface[公共设置.vface]", L"", x); + //trace(x.xml()); + //trace(strtpl); + xstring aa = strtpl; + var doc = x; + var n = doc.selectSingleNode(L"//resource[@url='" + aa + L"']/@src"); + //trace(n.text()); + + xaserverarg arg; + + arg.AddArg(L"sheet", n.text()); + arg.AddArg(L"search", list::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"") { + m_QueryTxt = txt; + //trace(txt); + OnRetrieve(); + } + } + return 0; + } + int OnCmdDispatch(xstring comdid) + { + HCURSOR hCursor = xutil::SetCursorWait(); + xdwgrid dw = getDW(); + if (comdid == L"save") { + dw_list.AcceptText(); + xml x; + + xaserverarg arg; + + dw_list.DwUpdateAllToEx(x); + KXMLDOMElement e = x.documentElement(); + e.setAttribute(L"id", m_id); + //arg.AddArg(L"id",m_id); + //trace(m_id); + //trace(m_dbmap); + if (m_id == L"开票银行") + { + xml kp; + + kp.loadXML(L"<root></root>"); + KXMLDOMElement ele = kp.documentElement(); + var list = e.selectNodes(L"item[@update.modify='1' or @update.delete='1' ]"); + int j; + int k = list.length; + for (j = 0; j < k; j++) + { + KXMLDOMElement ele1 = list.item(j); + ele.appendChild(ele1); + } + kpstr = ele.xml(); + trace(ele.xml()); + } + if (m_id == L"开票银行") + { + arg.AddArg(L"content", kpstr); + } + else + { + arg.AddArg(L"content", e.xml()); + } + arg.AddArg(L"dbmap", m_dbmap); + /*if(TFile::exec(m_config,L"save",arg,x)!=1) + { + trace(L"error:"+x.xml()); + alert(L"保存出错!"); + return 0; + }*/ + trace(m_dbmap + L"\r\n" + e.xml()); + if (xurl::get(L"QuickCode/pref/quickcode.save", arg.GetString(), x) != 1) + { + xstring error = x.text(); + trace(error); + } + //trace(arg.GetString()); + if (x.selectSingleNode(L"error")) + { + alert(L"保存出错2!"); + return 0; + } + dw_list.ResetUpdateStatus(); + alert(L"保存成功!"); + } + else if (comdid == L"add") { + dw.InsertRow(0); + int rows = dw.GetRowCount(); + dw.SetItemString(rows, L"GroupName", c_type); + dw.SetItemString(rows, L"BankName", c_type); + } + else if (comdid == L"insert") { + int row = dw.GetRow(); + if (row<1 || row>dw.GetRowCount()) return 0; + dw.InsertRow(row); + + dw.SetItemString(row, L"GroupName", c_type); + } + else if (comdid == L"delet") { + dw_list.AcceptText(); + int row2 = dw.GetRow(); + if (row2<1 || row2>dw.GetRowCount()) return 0; + dw.DeleteRow(row2); + } + else if (comdid == L"adduomfolder") + adduomfolder(); + else if (comdid == L"modifyuomfolder") + modifyuomfolder(); + else if (comdid == L"deluomfolder") + deluomfolder(); + else if (comdid == L"search") + GridSearch(); + xutil::RestoreCursor(hCursor); + return 0; + } + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + int OnSetFocus(TEvent* evt, LPARAM p) + { + SetAgent(); + tv_1 = new treeview; + tv_1.setNativePointer(GetControl(L"tv_1")); + + HTREEITEM root = tv_1.GetRootItem(); + tv_1.ExpandItem(root); + return 1; + } + int OnDoubleClicked(TEvent* evt, LPARAM p) + { + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + int row = hdr.row; + if (row<1 || row > dw_list.GetRowCount()) return 0; + + xaserverarg arg; + + //xstring str = hdr.data; + xstring colname = hdr.colname; + xstring str = dw_list.GetItemString(row, colname); + arg.AddArg(L"value", str); + openUrl(L"/sale/view/view.dlg/xpage/memo/edit", arg); + xstring comdid = arg.GetArgString(L"comdid"); + if (comdid == L"xmOK") + { + xstring value = arg.GetArgString(L"value"); + dw_list.SetItemString(row, colname, value); + dw_list.Redraw(); + } + + return 1; + } + int ItemOutput() + { + xstring d = xaserver::GetCurrentDate(); + d = d.left(10) + L""; + dw_list.SaveAs(d); + return 1; + } + int OnSelectAllRow() + { + int rows = dw_list.GetRowCount(); + if (rows < 1) return -1; + dw_list.SelectRow(1, rows, true); + dw_list.Redraw(); + return 1; + } + int OnRowCopy() + { + int rows = dw_list.GetRowCount(); + if (rows < 1) return -1; + int cols = dw_list.GetColumnCount(); + xstring str = L""; + int row = dw_list.GetNextSelectRow(1); + int i; + while (row > 0) + { + xstring tmp1 = L""; + for (i = 1; i < cols; i++) + { + int w = dw_list.GetColumnWidth(i); + if (w < 5) continue; + xstring tmp; + if (dw_list.GetItemDisplayString(row, i + 1)) + tmp = dw_list.GetItemDisplayString(row, i + 1); + else + tmp = dw_list.GetItemString(row, i + 1); + tmp1 += tmp + L"\t"; + } + str += tmp1 + L"\r\n"; + row = dw_list.GetNextSelectRow(row + 1); + } + dw_list.SetDataToClip(str); + return 1; + } + int OnColCopy(xstring col) + { + int rows = dw_list.GetRowCount(); + if (rows < 1) return -1; + xstring str = L""; + int row = dw_list.GetNextSelectRow(1); + while (row > 0) + { + xstring tmp; + if (dw_list.GetItemDisplayString(row, col)) + tmp = dw_list.GetItemDisplayString(row, col); + else + tmp = dw_list.GetItemString(row, col); + str += tmp + L"\r\n"; + row = dw_list.GetNextSelectRow(row + 1); + } + dw_list.SetDataToClip(str); + + return 1; + } + int OnRClick(TEvent* evt, LPARAM p) + { + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + int row = hdr.row; + + int m = win::CreatePopupMenu(); + int MF_STRING = 0x00000000; + int MF_DISABLED = 0x00000002; + int TPM_RIGHTBUTTON = 0x0002; + int TPM_RETURNCMD = 0x0100; + int MF_CHECKED = 0x8; + int MF_SEPARATOR = 0x0800; + win::AppendMenu(m, MF_STRING, 1, L"复制行"); + win::AppendMenu(m, MF_STRING, 101, L"复制列"); + win::AppendMenu(m, MF_SEPARATOR, -1, L""); + win::AppendMenu(m, MF_STRING, 2, L"全选"); + win::AppendMenu(m, MF_SEPARATOR, -1, L""); + win::AppendMenu(m, MF_STRING, 4, L"导出到Excel"); + win::AppendMenu(m, MF_SEPARATOR, -1, L""); + win::AppendMenu(m, MF_STRING, 6, L"显示列设置"); + xrect xr; + xpoint pt; + win::GetCursorPos(pt); + int ret = win::TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, GetHWND(), xr); + + //trace(ret); + HCURSOR hCursor = xutil::SetCursorWait(); + if (ret == 1) { OnRowCopy(); } + else if (ret == 101) { + xstring colname = hdr.colname; + if (colname != L"") + OnColCopy(colname); + } + else if (ret == 2) { OnSelectAllRow(); } + else if (ret == 4) { ItemOutput(); } + else if (ret == 6) {} + xutil::RestoreCursor(hCursor); + + return 1; + } + int OnAttachEvent() + { + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&QuickCode_Tree::OnSetFocus); + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&QuickCode_Tree::OnXCommand); + //获得树的选择事件 + AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&QuickCode_Tree::OnTreeSelChanged); + AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&QuickCode_Tree::OnDoubleClicked);//行双击 + AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&QuickCode_Tree::OnRClick);//鼠标右键 + return 1; + } + + + xstring jxParam(xstring p, xstring n) + { + if (p != L"") + { + p += L"&"; + int i = 1; + while (p.find(L"=L", 0) > 0) + { + xstring name = p.mid(0, p.find(L"=L", 0)); + xstring value = p.mid(p.find(L"=L", 0) + 1, p.find(L"&", 0) - p.find(L"=L", 0) - 1); + if (name == n) return L"" + value; + i += 1; + p = p.mid(p.find(L"&", 0) + 1, p.length()); + } + } + return L""; + } + int getURLParam() + { + if (GetWinParam()) + { + xpage xp = new xpage; + xp.setNativePointer(GetXPage()); + xstring aurl = xp.GetWkUrl(); + xaserverarg arg; + if (aurl && aurl.find(L"native=true", 0) > 0) + { + int p = GetParam(); + arg; + arg.setNativePointer(p); + } + else + { + arg = GetParam(); + } + xstring config = arg.GetArgString(L"config"); + xml x; + + if (config == L"") + { + xstring configXml = arg.GetArgString(L"configxml"); + x.loadXML(configXml); + } + else + { + getUrl(config, L"", x); + } + m_configDoc = x; + + } + + return 1; + } + int loaded() + { + getURLParam(); + KXMLDOMDocument ee = m_configDoc; + xstring id = m_id; + var n = ee.selectSingleNode(L"//list/dwview[@type='dwgrid'][@id='" + id + L"']"); + if (n) + { + KXMLDOMElement e = n; + //trace(e.xml); + xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text(); + xstring dwname = L"";//e.selectsingleNode(L"@name").text(); + xstring tpl = L"";//e.selectsingleNode(L"@url").text(); + xstring dbmap = L""; + xstring strtreexquery = L""; + if (e.selectSingleNode(L"@name")) dwname = e.selectSingleNode(L"@name").text(); + if (e.selectSingleNode(L"@url")) tpl = e.selectSingleNode(L"@url").text(); + if (e.selectSingleNode(L"@dbmap")) dbmap = e.selectSingleNode(L"@dbmap").text(); + if (e.selectSingleNode(L"@treexquery")) strtreexquery = e.selectSingleNode(L"@treexquery").text(); + m_dbmap = dbmap; + treexquery = strtreexquery; + //trace(vface +L"/"+ tpl); + //trace(selectmode); + dw_list = new xdwgrid; + dw_list.setNativePointer(GetControl(dwname)); + dw_list.openUrl(vface + L"/" + tpl); + strtpl = tpl; + trace(tpl); + + } + } + int onload() + { + + SetArg(); + m_config = L"QuickCode.config"; + m_agent = L""; + dw_list = new xdwtable; + dw_list.setNativePointer(GetControl(L"dw_list")); + if (GetWinParam()) + { + xaserverarg arg = GetArg(); + //trace(arg.GetString()); + xstring id = arg.GetArgString(L"id"); + if (id == L"") return 0; + m_id = id; + loaded(); + + /*xstring tpl = arg.GetArgString(L"tpl"); + if(tpl == L"") + tpl = L"QuickCode.tpl/QuickCode"; + dw_list.SetDataObject(GetServerUrl(),L"dev:sheet["+tpl+L"]"); + //dw_list.SetColHeaderHeight(0); + //dw_list.SetRowSelectorWidth(0); + xstring dbmap = arg.GetArgString(L"dbmap"); + if(dbmap == L"") + dbmap = L"QuickCode.dbmap"; + m_dbmap = dbmap; + xstring txquery=arg.GetArgString(L"treexquery"); + treexquery=txquery; + xstring title = arg.GetArgString(L"title"); + if(title != L"") + win::SetWindowText(GetHWND(),title);*/ + OnRetrieve(); + } + SetAgent(); + xstring aa = treexquery; + xstring xfNodeAgentArea2 = L"treeagent"; + xnode tnode = new xnode; + tnode.setNativePointer(GetAgentNode(xfNodeAgentArea2)); + xstring stree = L"<vbox><xtree name='tv_1' imagelist='0'>"; + stree += L"<treeitem src='xquery:[" + aa + L"]' xcaption='@GroupName' xroot='/root' xpath='row' xchildpath='row' image='15' loop='yes' xdata='.'/>"; + stree += L"</xtree></vbox>"; + SetAgentNode(tnode, stree); + + tv_1 = new treeview; + tv_1.setNativePointer(GetControl(L"tv_1")); + + HTREEITEM root = tv_1.GetRootItem(); + tv_1.ExpandItem( root); + OnAttachEvent(); + + return 1; + } +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/SKUItem.categoryselect.cpp b/jrj/project/business/BasicCode/SKUItem.categoryselect.cpp new file mode 100644 index 0000000..4b62ed7 --- /dev/null +++ b/jrj/project/business/BasicCode/SKUItem.categoryselect.cpp @@ -0,0 +1,216 @@ +use"lang.vl" +use "win.vl" +use "treeview.vm" +use "file.vl" +use "dev:vm[xdwtable.vm]" + +unit vbusiness.vpage +[ + SKUItemcategoryselect is extend TProduct; + about SKUItemcategoryselect + [ + field: + xdwtable dw_category; + method: + [ + treeview tv_gs; + //命令发布函数 + xstring GetPath(int tv, int h) + { + xstring str = treeview::GetItemLabel(tv, h); + int k = treeview::GetParentItem(tv, h); + int r = treeview::GetRootItem(tv); + while(k > 0 && r != k) + { + xstring tmp = treeview::GetItemLabel(tv, k); + str = tmp+L"\\" + str; + k = treeview::GetParentItem(tv, k); + } + return str; + } + int xunhuan(int pItem, int hItem) + { + xdwtable dw = new xdwtable; + dw.setNativePointer(dw_category.FindDwTable(L"Item",0)); + if(treeview::GetChecked(tv_gs.GetId(),hItem) > 0) + { + msxml::IXMLDOMElement e = treeview::GetItemData(tv_gs.GetId(),hItem); + xstring id = e.selectSingleNode(L"CategoryID").text; + xstring Name =GetPath(tv_gs.GetId(), hItem); + trace(Name); + if(dw.GetItemString(1,L"CategoryID")==L"") + { + dw.ItemChangeTo(1,L"CategoryID",id); + dw.ItemChangeTo(1,L"Category",Name); + } + else + { + int n=dw.InsertRow(0); + dw.ItemChangeTo(n,L"CategoryID",id); + dw.ItemChangeTo(n,L"Category",Name); + } + + + } + + int cItem = treeview::GetChildItem(tv_gs.GetId(), hItem); + if(cItem > 0) + { + xunhuan(pItem,cItem); + } + int nItem = treeview::GetNextItem(tv_gs.GetId(), hItem); + if(nItem > 0) + { + xunhuan(pItem,nItem); + } + return 1; + } + int OnCmdDispatch(xstring comdid) + { + if(comdid==L"ok") + { + int hitem = treeview::GetSelectedItem(tv_gs.GetId()); + if (hitem >0) + { + msxml::IXMLDOMElement ele=treeview::GetItemData(tv_gs.GetId(),hitem); + xstring guid = ele.selectSingleNode(L"CategoryID").text; + //xstring label = ele.selectSingleNode(L"CName").text; + xstring label = GetPath(tv_gs.GetId(), hitem); + trace(label); + xunhuan(hitem, treeview::GetChildItem(tv_gs.GetId(), treeview::GetRootItem(tv_gs.GetId()))); + win::CloseWindow(); + } + return 1; + } + if(comdid==L"close") + win::CloseWindow(); + return 0; + } + + int OnCmdDispatch0(xstring comdid) + { + xaserverarg arg = new xaserverarg; + arg.setNativePointer(arg.CreateInstance()); + arg = win::GetParam(); + arg.AddArg(L"comdid",comdid); + int xitem = treeview::GetSelectedItem(tv_gs.GetId()); + if(comdid==L"ok" && xitem != 0) + { + msxml::IXMLDOMElement e=treeview::GetItemData(tv_gs.GetId(),xitem); + + xstring sHasChild=e.selectSingleNode(L"@HasChild").text; + + if(treeview::GetChildItem(tv_gs.GetId(),xitem)>0 || sHasChild==L"1") + { + alert(L"提示:请选择最后一级类别!"); + return 0; + } + + xstring ID = e.selectSingleNode(L"CategoryID").text; + xstring CName = e.selectSingleNode(L"CName").text; + trace(CName); + xstring ruler; + if(e.selectSingleNode(L"SpecRule")) + ruler = e.selectSingleNode(L"SpecRule").text; + else + ruler =L""; + arg.AddArg(L"CategoryID",ID); + arg.AddArg(L"CName",CName); + arg.AddArg(L"SpecRule",ruler); + + } + win::CloseWindow(); + return 0; + } + + //命令处理事件 + int OnXCommand(ref TXCommandEvent evt,int p) + { + return OnCmdDispatch(evt.pStrID); + } + + int CreateSubTree(int pitem){ + msxml::IXMLDOMElement sitemdata=treeview::GetItemData(tv_gs.GetId(), pitem); + xstring sHasChild=sitemdata.selectSingleNode(L"@HasChild").text;//sitemdata.getAttribute(L"HasChild"); + xstring pid=sitemdata.selectSingleNode(L"CategoryID").text; + //trace(sHasChild+L"sdaga"+pid); + if(sHasChild==L"1"){//数据有子节点 + int citem=treeview::GetChildItem(tv_gs.GetId(), pitem); + + //alert(xstring(citem)); + if (citem==0){//树视图有子节点 + xml x=new xml; + x.setNativePointer(xml::CreateInstance()); + xaserverarg arg=new xaserverarg; + arg.setNativePointer(arg.CreateInstance()); + arg.AddArg(L"parentID",pid); + //if(xaserver::ExecXQuery(GetServerUrl(),L"[ItemCategoryEx.xq]",arg.GetString(),x)!=1) + if(url::get(GetEntityName(1)+L"/entity/category",arg.GetString(),x)!=1) + { + trace(x.GetXml()); + return 0; + } + //trace(x.GetXml()); + var list=x.GetXmlDoc().selectNodes(L"root/Category"); + int i=0,s=list.length; + msxml::IXMLDOMElement xitem; + for (i=0;i<s;i++){ + xitem=list.item(s - i - 1); + xstring Name=xitem.selectSingleNode(L"CName").text; + xstring Has2D=xitem.selectSingleNode(L"@Has2D").text;//item.getAttribute(L"Has2D"); + if (Has2D==L"1") + Name=Name+L"*"; + int kitem=treeview::InsertItem(tv_gs.GetId(), pitem,0,Name,xitem,15); + //int kitem=treeview::InsertChildItem(tv_gs.GetId(), pitem,Name,xitem,15); + xstring HasChild=xitem.selectSingleNode(L"@HasChild").text;//item.getAttribute(L"HasChild"); + //trace(HasChild, kitem); + if (HasChild==L"1") + treeview::SetItemChild1(tv_gs.GetId(), kitem,1); + } + } + } + return 1; + } + + int CreateRootTree(){ + xstring rootid=L"00000000-0000-0000-0000-000000000000"; + xml x=new xml; + x.setNativePointer(xml::CreateInstance()); + x.LoadXml(L"<Category HasChild='1'><CategoryID>"+rootid+L"</CategoryID></Category>"); + int hroot=treeview::InsertItem(tv_gs.GetId(),L"公司产品类别", x.GetXmlDoc().documentElement, 17); + CreateSubTree(hroot); + treeview::ExpandItemEx(tv_gs.GetId(),hroot); + return 1; + } + + int OnTreeExpanding(ref TNotifyEvent evt,int p) { + ref NMTREEVIEW nmtv = evt.pnmh; + int sitem = nmtv.itemNew.hItem; + CreateSubTree(sitem); + return 1; + + } + int OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND",OnXCommand); + //获得树的展开事件 + AttachEvent(L"tv_gs", L"TVN_ITEMEXPANDING",OnTreeExpanding); + } + int onload() + { + if (GetParam()) + { + xaserverarg arg1=GetParam(); + dw_category = new xdwtable; + dw_category.setNativePointer(arg1.GetArgString(L"dw_category").toInt()); + } + tv_gs = new treeview; + tv_gs.setNativePointer(GetControl(L"tv_gs")); + CreateRootTree(); + OnAttachEvent(); + return 1; + } + ] + ] +] \ No newline at end of file diff --git a/jrj/project/business/BasicCode/SKUItem.cpp b/jrj/project/business/BasicCode/SKUItem.cpp new file mode 100644 index 0000000..ec0c200 --- /dev/null +++ b/jrj/project/business/BasicCode/SKUItem.cpp @@ -0,0 +1,310 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) SKUItem : public xframe +{ +public: + xtreeview tv_1; + xdwgrid dw_list; + xstring m_type; + xstring CategoryID; + xnode m_agentNode; //Agent Condition + xstring m_agentCond; //Agent Node + xstring m_searchtxt; +public: + SKUItem(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} +public: + static SKUItem* CreateInstance(void* implPtr, void* hWnd) + { + SKUItem* pWin = new SKUItem(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 p) + { + SetAgent(); + + //重置工具条 + return 1; + } + + int OnReTrieve() + { + xstring query = L"[SKUItem.tree.xq]"; + xml x; + + xaserverarg arg; + + arg.AddArg(L"parentID", CategoryID); + arg.AddArg(L"query", L""); + if (xaserver::ExecXQuery(GetServerUrl(), query, arg.GetString(), x) != 1) + { + trace(x.text()); + return -1; + } + else + { + dw_list.openUrl(L"其他设置.vface/template/other/SKUItem"); + dw_list.Retrieve(x); + dw_list.Redraw(); + } + return 1; + } + + int OnTreeSelChanged(TEvent* evt, LPARAM p) + { + NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; + HTREEITEM sitem = nmtv.itemNew.hItem; + + HCURSOR hCursor = xutil::SetCursorWait(); + dw_list.AcceptText(); + xml z; + + z.loadXML(L"<root/>"); + dw_list.Retrieve(z); + dw_list.Redraw(); + dw_list.ResetUpdateStatus(); + + KXMLDOMElement ele = tv_1.GetItemData(sitem); + if (!ele.selectSingleNode(L"ID")) return 0; + CategoryID = ele.selectSingleNode(L"ID").text(); + //trace(CategoryID); + m_searchtxt = L""; + + OnReTrieve(); + xutil::RestoreCursor(hCursor); + return 1; + } + + int CreateSubTree(HTREEITEM pitem) + { + KXMLDOMElement sitemdata = tv_1.GetItemData(pitem); + xstring sHasChild = sitemdata.selectSingleNode(L"@HasChild").text();//sitemdata.getAttribute(L"HasChild"); + //trace(sHasChild); + xstring pid = sitemdata.selectSingleNode(L"ID").text(); + //trace(sHasChild+L"sdaga"+pid); + if (sHasChild == L"1") {//数据有子节点 + HTREEITEM citem = tv_1.GetChildItem(pitem); + //alert(xstring(citem)); + if (citem == 0) {//树视图有子节点 + xml x; + + xaserverarg arg; + + arg.AddArg(L"parentID", pid); + arg.AddArg(L"query", L""); + if (xaserver::ExecXQuery(GetServerUrl(), L"[SKUItem.tree.xq]", arg.GetString(), x) != 1) + { + trace(x.xml()); + return 0; + } + //trace(x.xml()); + var list = x.selectNodes(L"root/SKUItem"); + int i = 0, s = list.length; + KXMLDOMElement xitem; + KXMLDOMNode d; + for (i = 0; i < s; i++) { + xitem = list.item(s - i - 1); + //if(i==0)xitem.setAttribute(L"HasChild",L"1"); + xstring Name = xitem.selectSingleNode(L"ItemName").text(); + HTREEITEM kitem = tv_1.InsertItem(pitem, 0, Name, xitem, 15); + //int kitem=tv_1.InsertChildItem(tv_1.GetId(), pitem,Name,xitem,15); + xstring HasChild = xitem.selectSingleNode(L"@HasChild").text();//item.getAttribute(L"HasChild"); + //trace(HasChild, kitem); + if (HasChild == L"1") + tv_1.SetItemChild1(kitem, 1); + } + } + } + return 1; + } + int CreateRootTree() { + xstring id = L"00000000-0000-0000-0000-000000000000"; + xml x; + + x.loadXML(L"<SKUItem HasChild='1' ><ID>" + id + L"</ID></SKUItem>"); + HTREEITEM hroot = tv_1.InsertItem(L"产品项目分类", x.documentElement(), 17); + //trace(hroot); + CreateSubTree(hroot); + tv_1.ExpandItemEx(hroot); + CategoryID = id; + OnReTrieve(); + return 1; + } + int OnTreeExpanding(TEvent* evt, int p) + { + NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; + + HTREEITEM sitem = nmtv.itemNew.hItem; + CreateSubTree(sitem); + return 1; + } + int afterSave() { + HTREEITEM hitem = tv_1.GetSelectedItem(); + if (hitem == 0) + hitem = tv_1.GetRootItem(); + int rows = dw_list.GetRowCount(); + KXMLDOMElement ele = tv_1.GetItemData(hitem); + + HTREEITEM firstChild = tv_1.GetChildItem(hitem); + while (firstChild > 0) { + tv_1.DeleteItem(firstChild); + firstChild = tv_1.GetChildItem(hitem); + } + if (rows > 0) + { + tv_1.SetItemChild1(hitem, 1); + ele.setAttribute(L"HasChild", L"1"); + //trace(ele.xml); + tv_1.SetItemData(hitem, ele); + } + else + { + tv_1.SetItemChild1(hitem, 0); + ele.setAttribute(L"HasChild", L"0"); + //trace(ele.xml); + tv_1.SetItemData(hitem, ele); + } + CreateSubTree(hitem); + if (tv_1.GetRootItem() == hitem) + tv_1.ExpandItemEx(hitem); + + dw_list.ResetUpdateStatus(); + return 0; + } + int OnSave() + { + xml x; + + dw_list.AcceptText(); + dw_list.DwUpdateAllToEx(x); + trace(x.xml()); + xaserverarg arg; + + arg.AddArg(L"content", x.xml()); + arg.AddArg(L"dbmap", L"SKUItem.dbmap"); + if (xaserver::ExecXAction(GetServerUrl(), L"[onSave.xa]", arg.GetString(), x) != 1) + { + trace(x.documentElement().text()); + alert(L"保存失败"); + } + else { + alert(L"保存成功"); + } + dw_list.ResetUpdateStatus(); + dw_list.Redraw(); + afterSave(); + return 1; + } + int OnSetValue(int row) { + dw_list.SetItemString(row, L"PID", CategoryID); + dw_list.SetItemString(row, L"ID", publiccode::GetGuid()); + return 1; + } + int OnAddRow() + { + int row = dw_list.InsertRow(0); + int rows = dw_list.GetRowCount(); + OnSetValue(rows); + dw_list.SetRow(dw_list.GetRowCount()); + //trace(row.toString()); + return 1; + } + + int OnInsertRow() + { + int row = dw_list.GetRow(); + if (row<0 || row>dw_list.GetRowCount()) return 0; + dw_list.InsertRow(row); + OnSetValue(row); + dw_list.SetRow(row); + return 1; + } + + int OnDeleteRow() + { + int row = dw_list.GetRow(); + if (row<0 || row>dw_list.GetRowCount()) return 0; + dw_list.DeleteRow(row); + return 1; + } + + + //命令发布函数 + int OnCmdDispatch(xstring comdid) + { + if (comdid == L"Save") OnSave(); + else if (comdid == L"AddRow") OnAddRow(); + else if (comdid == L"InsertRow") OnInsertRow(); + else if (comdid == L"DeleteRow") OnDeleteRow(); + return 0; + } + + //命令处理事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&SKUItem::OnXCommand); + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&SKUItem::OnSetFocus); + //获得树的选择事件 + AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&SKUItem::OnTreeSelChanged); + AttachEvent(L"tv_1", L"TVN_ITEMEXPANDING", (FEvent)&SKUItem::OnTreeExpanding); + return 1; + } + + int OnInitial() + { + SetAgent(); + OnAttachEvent(); + return 1; + } + + int onload() + { + m_type = L"all"; + tv_1 = new treeview; + tv_1.setNativePointer(GetControl(L"tv_1")); + dw_list = new xdwgrid; + dw_list.setNativePointer(GetControl(L"dw_list")); + dw_list.openUrl(L"其他设置.vface/template/other/SKUItem"); + + OnInitial(); + CreateRootTree(); + + return 1; + } +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/SKUItem.select.cpp b/jrj/project/business/BasicCode/SKUItem.select.cpp new file mode 100644 index 0000000..82f820b --- /dev/null +++ b/jrj/project/business/BasicCode/SKUItem.select.cpp @@ -0,0 +1,126 @@ +use "dev:code[SKUItem.vx]" + +unit vbusiness.vpage +[ + SKUItemImport is extend SKUItem; + about SKUItemImport + [ + field: + xdwgrid dw_list; + treeview tv_1; + xdwtable dw_maint; + method: + [ + + xstring jxParam(xstring p, xstring n) + { + if(p != L"") + { + + int i = 1; + while (p.find(L"=L",0)>0) + { + xstring name = p.mid(0, p.find(L"=L",0)); + xstring value = p.mid(p.find(L"=L",0) + 1, p.find(L"=L",0) - 1); + return ""+value; + i += 1; + } + } + return ""; + } + int OnSelectAll() + { + if(this.dw_list.GetRowCount() > 0 ) + this.dw_list.SelectRow(1,true); + + this.dw_list.SelectRow(0,true); + this.dw_list.Redraw(); + return 1; + } + + int OnSelectNo() + { + this.dw_list.SelectRow(0,false); + this.dw_list.Redraw(); + return 1; + } + + int OnOk() + { + + xdwtable dw = new xdwtable; + dw.setNativePointer(dw_maint.FindDwTable(L"Item",0)); + + int row = SKUItem::dw_list.GetNextSelectRow(1); + if (row<1) + { + alert(L"请选择项目名称!"); + return 1; + } + + while (row>0) + { + + msxml::IXMLDOMElement e =SKUItem::dw_list.GetRowElement(row); + xstring ItemName = e.selectSingleNode(L"ItemName").text+L""; + //trace(ItemName); + if(dw.GetItemString(1,L"ItemName")==L"") + { + dw.SetItemString(1,L"SeqNo",L"1"); + dw.ItemChangeTo(1,L"ItemName",ItemName); + } + else + { + int n=dw.InsertRow(0); + dw.SetItemString(n,L"SeqNo",n.ToString()); + dw.ItemChangeTo(n,L"ItemName",ItemName); + } + row = SKUItem::dw_list.GetNextSelectRow(row +1); + } + CloseWindow(); + return 1; + } + + int OnCancel() + { + CloseWindow(); + return 1; + } + int OnDoubleClicked(ref TNotifyEvent evt,int p) + { + OnOk(); + return 1; + } + + int OnCmdDispatch(xstring comdid) + { + if (comdid==L"SelectAll") OnSelectAll(); + else if (comdid==L"SelectNo") OnSelectNo(); + else if (comdid==L"cb_import") OnOk(); + else if (comdid==L"cb_close") OnCancel(); + //else if (comdid==L"query") GridSearch(); + return 0; + } + + int OnXCommand(ref TXCommandEvent evt,int p) + { + return OnCmdDispatch(evt.pStrID); + } + + int onload() + { + if (GetParam()) + { + xaserverarg arg1=GetParam(); + dw_maint = new xdwtable; + dw_maint.setNativePointer(arg1.GetArgString(L"dw_maint").toInt()); + } + SKUItem::onload(); + SKUItem::dw_list.SetSelectionMode(3); //3 + SKUItem::dw_list.SetReadOnly(true); + AttachEvent(L"WM_XCOMMAND",OnXCommand); + AttachEvent(L"dw_list",L"DWV_DOUBLECLICKED",OnDoubleClicked);//行双击 + } + ] + ] +] \ No newline at end of file diff --git a/jrj/project/business/BasicCode/SKUTemplate.cpp b/jrj/project/business/BasicCode/SKUTemplate.cpp new file mode 100644 index 0000000..9c410fb --- /dev/null +++ b/jrj/project/business/BasicCode/SKUTemplate.cpp @@ -0,0 +1,427 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) SKUTemplate : public xframe +{ +public: + + xdwgrid dw_list; + xdwtable dw_maint; + xdwtable dw_category; + int rowno; + + xnode m_agentNode; +public: + SKUTemplate(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} +public: + static SKUTemplate* CreateInstance(void* implPtr, void* hWnd) + { + SKUTemplate* pWin = new SKUTemplate(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 p) + { + SetAgent(); + return 1; + } + + int OnReTrieve() + { + xstring query = L"[SKUTemplate.list.xq]"; + xml x; + + xaserverarg arg; + + if (xaserver::ExecXQuery(GetServerUrl(), query, arg.GetString(), x) != 1) + { + trace(x.text()); + return -1; + } + else + { + dw_list.Retrieve(x); + dw_list.Redraw(); + } + return 1; + } + int OnRowChanged(TEvent* evt, LPARAM p) + { + + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + int ll_row = hdr.row; + rowno = ll_row; + xstring TemplateContent = dw_list.GetItemString(ll_row, L"TemplateContent"); + xstring Category = dw_list.GetItemString(ll_row, L"Category"); + if (TemplateContent == L"") + { + dw_maint.openUrl(L"其他设置.vface/template/other/TemplateContent"); + dw_maint.SetColHeaderHeight(0); + dw_maint.SetRowSelectorWidth(0); + } + if (Category == L"") + { + dw_category.openUrl(L"其他设置.vface/template/other/TemplateCategory"); + dw_category.SetColHeaderHeight(0); + dw_category.SetRowSelectorWidth(0); + } + xml x; + + x.loadXML(TemplateContent); + xml x1; + x1.loadXML(Category); + dw_maint.Retrieve(x); + dw_maint.Redraw(); + dw_category.Retrieve(x1); + dw_category.Redraw(); + return 1; + } + int OnSave() + { + dw_list.AcceptText(); + dw_maint.AcceptText(); + dw_category.AcceptText(); + + xml x; + + dw_list.DwUpdateAllToEx(x); + trace(x.xml()); + xaserverarg arg; + + arg.AddArg(L"content", x.xml()); + arg.AddArg(L"dbmap", L"SKUTemplate.dbmap"); + if (xaserver::ExecXAction(GetServerUrl(), L"[onSave.xa]", arg.GetString(), x) != 1) + { + trace(x.documentElement().text()); + alert(L"保存失败"); + } + else { + alert(L"保存成功"); + } + dw_list.ResetUpdateStatus(); + dw_maint.ResetUpdateStatus(); + dw_category.ResetUpdateStatus(); + dw_list.Redraw(); + dw_maint.Redraw(); + dw_category.Redraw(); + return 1; + } + int OnSetValue(int row) { + dw_list.SetItemString(row, L"TemplateID", publiccode::GetGuid()); + return 1; + } + int RemoveAttribute(xml x, xstring nodename)//根据名称删除属性节点 + { + KXMLDOMElement e; + var list = x.getElementsByTagName(L"" + nodename + L""); + if (list) + { + + int nlen = list.length; + int i; + for (i = 0; i < nlen; i++) + { + e = list.item(i); + //trace(e.xml); + e.removeAttribute(L"update.new"); + e.removeAttribute(L"update.modify"); + e.removeAttribute(L"update.delete"); + e.removeAttribute(L"guid"); + e.removeAttribute(L"update.origin"); + e.removeAttribute(L"isnull"); + //trace(e.xml); + } + } + } + int setMaint() + { + xml x; + + dw_maint.DwUpdateAllTo(x); + int row = dw_list.GetRow(); + trace(x.xml()); + RemoveAttribute(x, L"TemplateContent"); + RemoveAttribute(x, L"Item"); + RemoveAttribute(x, L"ItemName"); + RemoveAttribute(x, L"Remark"); + RemoveAttribute(x, L"SeqNo"); + //trace(x.xml()); + dw_list.SetItemString(row, L"TemplateContent", x.xml()); + dw_list.Redraw(); + return 1; + } + int setItemCategory() + { + xml x; + + dw_category.DwUpdateAllTo(x); + int row = dw_list.GetRow(); + //trace(row); + dw_list.SetItemString(row, L"Category", x.xml()); + return 1; + } + int OnAddRow() + { + int row = dw_list.InsertRow(0); + int rows = dw_list.GetRowCount(); + OnSetValue(rows); + dw_list.SetRow(dw_list.GetRowCount()); + //trace(row.toString()); + dw_maint.openUrl(L"其他设置.vface/template/other/TemplateContent"); + dw_maint.SetColHeaderHeight(0); + dw_maint.SetRowSelectorWidth(0); + dw_category.openUrl(L"其他设置.vface/template/other/TemplateCategory"); + dw_category.SetColHeaderHeight(0); + dw_category.SetRowSelectorWidth(0); + return 1; + } + + int OnInsertRow() + { + int row = dw_list.GetRow(); + if (row<0 || row>dw_list.GetRowCount()) return 0; + dw_list.InsertRow(row); + OnSetValue(row); + dw_list.SetRow(row); + dw_maint.openUrl(L"其他设置.vface/template/other/TemplateContent"); + dw_maint.SetColHeaderHeight(0); + dw_maint.SetRowSelectorWidth(0); + dw_category.openUrl(L"其他设置.vface/template/other/TemplateCategory"); + dw_category.SetColHeaderHeight(0); + dw_category.SetRowSelectorWidth(0); + return 1; + } + int OnChangeRowNo(int row) + { + xdwtable dw = new xdwtable; + dw.setNativePointer(dw_maint.FindDwTable(L"Item", 0)); + int i; + for (i = row; i <= dw.GetRowCount(); i++) + dw.SetItemString(i, L"SeqNo", xstring(i)); + return 1; + } + int OnDeleteRow() + { + int row = dw_list.GetRow(); + if (row<0 || row>dw_list.GetRowCount()) return 0; + dw_list.DeleteRow(row); + dw_maint.openUrl(L"其他设置.vface/template/other/TemplateContent"); + dw_maint.SetColHeaderHeight(0); + dw_maint.SetRowSelectorWidth(0); + dw_category.openUrl(L"其他设置.vface/template/other/TemplateCategory"); + dw_category.SetColHeaderHeight(0); + dw_category.SetRowSelectorWidth(0); + return 1; + } + int RemoveChild(xml x, xstring nodename)//根据名称删除节点 + { + KXMLDOMElement e; + var list = x.selectNodes(L"//Item[@update.delete='1']"); + if (list) + { + int nlen = list.length; + int i; + for (i = 0; i < nlen; i++) + { + e = list.item(i); + //trace(e.xml); + e.parentNode.removeChild(e); + //trace(e.xml); + } + } + } + int setMaint_removeChild() + { + xml x; + + dw_maint.DwUpdateAllTo(x); + int row = dw_list.GetRow(); + //trace(x.xml()); + RemoveChild(x, L"Item"); + RemoveAttribute(x, L"TemplateContent"); + RemoveAttribute(x, L"Item"); + RemoveAttribute(x, L"ItemName"); + RemoveAttribute(x, L"Remark"); + RemoveAttribute(x, L"SeqNo"); + //trace(x.xml()); + dw_list.SetItemString(row, L"TemplateContent", x.xml()); + dw_list.Redraw(); + return 1; + } + int setItemCategory_removeChild() + { + xml x; + + dw_category.DwUpdateAllTo(x); + int row = dw_list.GetRow(); + RemoveChild(x, L"Item"); + //trace(row); + dw_list.SetItemString(row, L"Category", x.xml()); + dw_list.Redraw(); + return 1; + } + int del(xdwtable dw_1) + { + xdwtable dw = new xdwtable; + dw.setNativePointer(dw_1.GetCurTable()); + int row = dw.GetRow(); + if (row < 1 || row > dw.GetRowCount()) return -1; + dw.DeleteRow(row); + //trace(dw.GetDwName()); + if (dw_1.GetDwName() == L"TemplateContent") + { + OnChangeRowNo(row); + if (dw.GetRowCount() == 1 && dw.GetItemString(1, L"ItemName") == L"") + { + dw_list.SetItemString(rowno, L"TemplateContent", L""); + dw_list.Redraw(); + } + else + { + setMaint_removeChild(); + } + + } + if (dw_1.GetDwName() == L"Categorys") + { + //trace(dw.GetRowCount()); + if (dw.GetRowCount() == 1 && dw.GetItemString(1, L"CategoryID") == L"") + { + dw_list.SetItemString(rowno, L"Category", L""); + dw_list.Redraw(); + } + else + { + setItemCategory_removeChild(); + } + + } + + return 1; + } + int SKUItem() + { + xaserverarg arg; + + arg.AddArg(L"dw_maint", dw_maint.nativept.toString()); + openUrl(L"其他设置.vface/xpage/SKUItem/select", arg); + return 1; + } + int SKUItemcategory() + { + xaserverarg arg; + + arg.AddArg(L"dw_category", dw_category.nativept.toString()); + openUrl(L"其他设置.vface/xpage/SKUItemcategory/select", arg); + return 1; + } + int SKUItemModify() + { + openUrl(L"其他设置.vface/xpage/SKUItem/list"); + return 1; + } + //命令发布函数 + int OnCmdDispatch(xstring comdid) + { + if (comdid == L"save") OnSave(); + else if (comdid == L"AddRow") OnAddRow(); + else if (comdid == L"InsertRow") OnInsertRow(); + else if (comdid == L"DeleteRow") OnDeleteRow(); + else if (comdid == L"SKUItem") SKUItem(); + else if (comdid == L"SKUItemcategory") SKUItemcategory(); + else if (comdid == L"del_1") del(dw_maint); + else if (comdid == L"del_2") del(dw_category); + else if (comdid == L"SKUItemModify") SKUItemModify(); + return 0; + } + + //命令处理事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnMaintChanged(TEvent* evt, LPARAM p) + { + //trace(L"hello"); + setMaint(); + return 1; + } + + int OnCategoryChanged(TEvent* evt, LPARAM p) + { + setItemCategory(); + return 1; + } + + int OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&SKUTemplate::OnXCommand); + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&SKUTemplate::OnSetFocus); + AttachEvent(L"dw_maint", L"DWV_ITEMCHANGED", (FEvent)&SKUTemplate::OnMaintChanged); + AttachEvent(L"dw_category", L"DWV_ITEMCHANGED", (FEvent)&SKUTemplate::OnCategoryChanged); + AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&SKUTemplate::OnRowChanged); + + return 1; + } + int OnInitial() + { + SetAgent(); + OnAttachEvent(); + return 1; + } + int onload() + { + dw_list = new xdwgrid; + dw_list.setNativePointer(GetControl(L"dw_list")); + dw_list.openUrl(L"其他设置.vface/template/other/SKUTemplate"); + + dw_maint = new xdwtable; + dw_maint.setNativePointer(GetControl(L"dw_maint")); + dw_maint.openUrl(L"其他设置.vface/template/other/TemplateContent"); + dw_maint.SetColHeaderHeight(0); + dw_maint.SetRowSelectorWidth(0); + + dw_category = new xdwtable; + dw_category.setNativePointer(GetControl(L"dw_category")); + dw_category.openUrl(L"其他设置.vface/template/other/TemplateCategory"); + dw_category.SetColHeaderHeight(0); + dw_category.SetRowSelectorWidth(0); + dw_category.SetReadOnly(true); + OnInitial(); + OnReTrieve(); + xdwtable dw = new xdwtable; + dw.setNativePointer(dw_category.FindDwTable(L"Item", 0)); + //trace(dw.GetRowCount()); + return 1; + } +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/SKUTemplate.select.cpp b/jrj/project/business/BasicCode/SKUTemplate.select.cpp new file mode 100644 index 0000000..35a9e24 --- /dev/null +++ b/jrj/project/business/BasicCode/SKUTemplate.select.cpp @@ -0,0 +1,120 @@ +use "dev:code[SKUTemplate.vx]" + +unit vbusiness.vpage +[ + SKUTemplateImport is extend SKUTemplate; + about SKUTemplateImport + [ + field: + xdwgrid dw_list; + xdwtable dw_other; + xdwtable dw_prop; + method: + [ + + xstring jxParam(xstring p, xstring n) + { + if(p != L"") + { + + int i = 1; + while (p.find(L"=L",0)>0) + { + xstring name = p.mid(0, p.find(L"=L",0)); + xstring value = p.mid(p.find(L"=L",0) + 1, p.find(L"=L",0) - 1); + return ""+value; + i += 1; + } + } + return ""; + } + int OnSelectAll() + { + if(this.dw_list.GetRowCount() > 0 ) + this.dw_list.SelectRow(1,true); + + this.dw_list.SelectRow(0,true); + this.dw_list.Redraw(); + return 1; + } + + int OnSelectNo() + { + this.dw_list.SelectRow(0,false); + this.dw_list.Redraw(); + return 1; + } + + int OnOk() + { + dw_other.openUrl(L"/sale/view/CustomerGoods/template/CustomerGoods/itemother"); + dw_other.SetColHeaderHeight(0); + dw_other.SetRowSelectorWidth(0); + int row = SKUTemplate::dw_list.GetNextSelectRow(1); + if (row<1) + { + alert(L"请选择模板!"); + return 1; + } + + msxml::IXMLDOMElement e =SKUTemplate::dw_list.GetRowElement(row); + xstring TemplateContent = e.selectSingleNode(L"TemplateContent").text+L""; + xstring TemplateID = e.selectSingleNode(L"TemplateID").text+L""; + //trace(ItemName); + xml x = new xml; + x.setNativePointer(x.CreateInstance()); + x.LoadXml(TemplateContent); + dw_other.Retrieve(x); + dw_prop.SetItemString(1,L"TemplateID",TemplateID); + CloseWindow(); + return 1; + } + + int OnCancel() + { + CloseWindow(); + return 1; + } + int OnDoubleClicked(ref TNotifyEvent evt,int p) + { + OnOk(); + return 1; + } + + int OnCmdDispatch(xstring comdid) + { + if (comdid==L"SelectAll") OnSelectAll(); + else if (comdid==L"SelectNo") OnSelectNo(); + else if (comdid==L"cb_import") OnOk(); + else if (comdid==L"cb_close") OnCancel(); + //else if (comdid==L"query") GridSearch(); + return 0; + } + + int OnXCommand(ref TXCommandEvent evt,int p) + { + return OnCmdDispatch(evt.pStrID); + } + + int onload() + { + if (GetParam()) + { + int iArgs = GetParam(); + xaserverarg arg1 = new xaserverarg; + arg1.setNativePointer(iArgs); + dw_other = new xdwtable; + dw_other.setNativePointer(arg1.GetArgString(L"dw_other").toInt()); + dw_prop = new xdwtable; + dw_prop.setNativePointer(arg1.GetArgString(L"dw_prop").toInt()); + } + //trace(dw_other.nativept); + SKUTemplate::onload(); + SKUTemplate::dw_list.SetSelectionMode(1); //3 + SKUTemplate::dw_list.SetReadOnly(true); + AttachEvent(L"WM_XCOMMAND",OnXCommand); + AttachEvent(L"dw_list",L"DWV_DOUBLECLICKED",OnDoubleClicked);//行双击 + } + ] + ] +] \ No newline at end of file diff --git a/jrj/project/business/BasicCode/SetUpRemarks.cpp b/jrj/project/business/BasicCode/SetUpRemarks.cpp new file mode 100644 index 0000000..8652de3 --- /dev/null +++ b/jrj/project/business/BasicCode/SetUpRemarks.cpp @@ -0,0 +1,158 @@ +#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) SetUpRemarks : public xwin + { + public: + xdwgrid dw_list; + xnode m_agentNode; //Agent Condition + public: + SetUpRemarks(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} + public: + static SetUpRemarks* CreateInstance(void* implPtr, void* hWnd) + { + SetUpRemarks* pWin = new SetUpRemarks(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 OnCmdDispatch(xstring comdid) + { + if(comdid==L"xmAddRow") + { + int row =dw_list.GetRowCount(); + dw_list.InsertRow(0); + dw_list.SetItemString(row+1,L"State",L"Y"); + return 1; + } + else if(comdid==L"xmDeleteRow") + { + dw_list.DeleteRow(0); + return 1; + } + else if(comdid==L"xmSave") + return OnSave(); + else if(comdid==L"xmRefresh") + return OnRetrieve(); + return 0; + } + + //命令处理事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&SetUpRemarks::OnXCommand); + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&SetUpRemarks::OnSetFocus); + return 1; + } + + int OnSave() + { + xml x; + + dw_list.DwUpdateAllToEx(x); + xaserverarg arg; + + arg.AddArg(L"content",x.xml()); + if (xurl::get(L"/sale/data/TradeFinance3/SetUpRemarks/update",arg.GetString(),x) != 1) + { + trace(L"error:"+(xstring)x.xml()); + alert(L"保存失败!"); + return 0; + } + else + { + trace(x.xml()); + if(x.selectSingleNode(L"error")) + { + alert(L"保存出错2!"); + return 0; + } + MessageBox(GetHWND(),L"保存成功!",L"提示",0); + dw_list.ResetUpdateStatus(); + } + dw_list.Redraw(); + return 1; + } + + + int OnRetrieve() + { + xml x = new xml; + + xaserverarg arg; + + if (xurl::get(L"/sale/data/TradeFinance3/SetUpRemarks/list",arg.GetString(),x)!=1) + { + trace(x.text()); + return -1; + }else + { + dw_list.Retrieve(x); + dw_list.Redraw(); + } + return 1; + } + + int onload() + { + dw_list = GetControl(L"dw_list"); + dw_list.openUrl(L"/sale/view/FinancialCode/template/SetUpRemarksList"); + dw_list.SetColumnState(L"ID",false); + + OnRetrieve(); + + OnAttachEvent(); + return 1; + } + + int onloaded() + { + SetAgent(); + + return 1; + } + }; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/ShipcompanyList.cpp b/jrj/project/business/BasicCode/ShipcompanyList.cpp new file mode 100644 index 0000000..fc49f1e --- /dev/null +++ b/jrj/project/business/BasicCode/ShipcompanyList.cpp @@ -0,0 +1,41 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) ShipcompanyList : public xwin +{ +public: + + xdwgrid dw_list; +public: + ShipcompanyList(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} +public: + static ShipcompanyList* CreateInstance(void* implPtr, void* hWnd) + { + ShipcompanyList* pWin = new ShipcompanyList(implPtr, (HWND)hWnd); + return pWin; + } + int onload() + { + list::onload(); + return -1; + } + + int ViewUpdate(param pr, xstring updateItem, xaserverarg arg) + { + if (updateItem == L"del") + { + int DelRow = dw_list.GetRow(); + dw_list.DeleteRow(DelRow); + + } + + return 1; + } +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/ShipcompanyMaint.cpp b/jrj/project/business/BasicCode/ShipcompanyMaint.cpp new file mode 100644 index 0000000..1d88656 --- /dev/null +++ b/jrj/project/business/BasicCode/ShipcompanyMaint.cpp @@ -0,0 +1,320 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) ShipcompanyMaint : public xframe +{ +public: + KXMLDOMDocument m_configDoc; + xstring m_userid; + xstring m_username; + xstring ContactID; + xdwtable dw_base; + xcell dw_cell; +public: + ShipcompanyMaint(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} +public: + static ShipcompanyMaint* CreateInstance(void* implPtr, void* hWnd) + { + ShipcompanyMaint* pWin = new ShipcompanyMaint(implPtr, (HWND)hWnd); + return pWin; + } + int alert(xstring str) + { + //win::MessageBox(GetHWND(),str,L"提示22:",0); + TApp::alert(this, str); + return 0; + } + int setCellReadOnly() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + dw_cell = new xcell; + dw_cell.setNativePointer(dw_base.QueryItem(L"ixcell")); + xstring strnew = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''/>"; + dw_cell.SetCellProps(2, 2, strnew); + return 0; + } + int OnSetFocus(TEvent* evt, LPARAM p) + { + SetAgent(L"maint"); + return 1; + } + xstring GetGuid() + { + return publiccode::GetGuid(); + } + int OnClear() { + if (m_EntityID == L"") { + m_userid = publiccode::GetUser().id; + m_username = publiccode::GetUser().name; + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + dw_base.SetItemString(1, L"PartyID", GetGuid()); + dw_base.SetItemString(1, L"PStatus", L"1"); + dw_base.SetItemDisplayString(1, L"PStatus", L"有效"); + dw_base.SetItemString(1, L"CreatorID", m_userid); + dw_base.SetItemString(1, L"PADStatus", L"1"); + dw_base.SetItemString(1, L"Type", L"6"); + dw_base.SetItemString(1, L"AddressID", GetGuid()); + dw_base.SetItemString(1, L"PADIdentifyAddressFlag", L"Y"); + dw_base.SetItemString(1, L"PrimaryFlag", L"Y"); + dw_base.SetItemString(1, L"EnterName", m_userid); + dw_base.SetItemDisplayString(1, L"EnterName", m_username); + dw_base.SetItemString(1, L"CreateDate", publiccode::GetCurrentDate()); + } + else + { + setCellReadOnly(); + } + return 0; + } + + int OnAddrow() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xdwtable dw = new xdwtable; + dw.setNativePointer(dw_base.GetCurTable()); + xstring dw_n = dw.GetDwName(); + if (dw_n == L"item") + { + dw.InsertRow(0); + int rows = dw.GetRowCount(); + dw.SetRow(rows); + } + return 1; + } + int OnInsertRow() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xdwtable dw = new xdwtable; + dw.setNativePointer(dw_base.GetCurTable()); + xstring dw_n = dw.GetDwName(); + if (dw_n == L"item") + { + int row = dw.GetRow(); + if (row < 1) return 0; + dw.InsertRow(row); + dw.SetRow(row); + } + return 1; + } + + int OnDeleteRow() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xdwtable dw = new xdwtable; + dw.setNativePointer(dw_base.GetCurTable()); + xstring dw_n = dw.GetDwName(); + if (dw_n == L"item") + { + int row = dw.GetRow(); + if (row < 1) return 0; + /*xstring del = dw.GetItemString(row,8); + if(del!=L"") + { + if(m_dels==L"") + { + m_dels=del; + } + else + { + xstring temp=m_dels; + m_dels=del + L"|" + temp; + //+= L"|"+del; + } + + }*/ + dw.DeleteRow(row); + dw.SetRow(row - 1); + } + return 1; + } + xstring getGoodsNo() + { + xml x; + + xaserverarg arg; + + if (getUrl(L"/sale/data/LogisticsCode/pref/shipcompany/PartyNo", arg.GetString(), x) != 1) + { + trace(x.xml()); + return L""; + } + KXMLDOMElement e = x.documentElement(); + if (e) + { + xstring code = e.text(); + trace(code); + return L"P" + code; + } + return L"P1000"; + } + int OnPreSave() + { + dw_base.AcceptText(); + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xstring ShipNo = dw_base.GetItemString(1, L"ShipNo"); + if (ShipNo == L"") + { + dw_base.SetItemString(1, L"ShipNo", getGoodsNo()); + } + xdwtable dwcon = new xdwtable; + dwcon.setNativePointer(dw_base.FindDwTable(L"item", 0)); + int i; + for (i = 1; i <= dwcon.GetRowCount(); i++) + { + xstring aTemp; + xstring aName = dwcon.GetItemString(i, L"ContacterName"); + trace(aName); + if (aName == L"") + { + aTemp = dwcon.GetItemString(i, L"Mobile") + dwcon.GetItemString(i, L"TEL") + dwcon.GetItemString(i, L"Fax") + dwcon.GetItemString(i, L"Email") + dwcon.GetItemString(i, L"PCRemark"); + trace(aTemp); + if (aTemp != L"") + { + alert(L"联系人名称必填!"); + return -1; + } + } + else { + xstring ContactID = dwcon.GetItemString(i, L"ContactID"); + if (ContactID == L"") + { + dwcon.SetItemString(i, L"ContactID", GetGuid()); + dwcon.SetItemString(i, L"PCStatus", L"1"); + dw_base.SetItemString(1, L"PrimaryContactID", dwcon.GetItemString(1, L"ContactID")); + } + + + + } + } + return 1; + } + int OnSave() + { + + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xstring SName = dw_base.GetItemString(1, L"Name"); + if (SName == L"") { + alert(L"请输入船公司名称!"); + return -1; + } + int rec = OnPreSave(); + if (rec == -1) return -1; + xml x; + + dw_base.DwUpdateAllTo(x); + trace(x.xml()); + xaserverarg arg; + + arg.AddArg(L"content", x.xml()); + arg.AddArg(L"dbmap", L"Shipcompany.dbmap"); + //arg.AddArg(L"m_dels",m_dels); + + if (getUrl(L"/sale/data/LogisticsCode/entity/shipcompany/save", arg.GetString(), x) != 1) + { + trace(L"error:" + (xstring)x.xml()); + alert(L"保存失败!"); + return 0; + } + else + { + trace(x.xml()); + if (x.selectSingleNode(L"error")) + { + alert(L"保存出错2!"); + return 0; + } + alert(L"保存成功!"); + dw_base.ResetUpdateStatus(); + setCellReadOnly(); + } + dw_base.Redraw(); + //m_dels=L""; + return 0; + } + int OnCmdDispatch(xstring comdid) + { + trace(comdid); + if (comdid.find(L"action:bill.row.add", 0) >= 0) { + OnAddrow(); + } + else if (comdid.find(L"bill.row.insert", 0) >= 0) { + OnInsertRow(); + } + else if (comdid.find(L"bill.row.delete", 0) >= 0) { + OnDeleteRow(); + } + else if (comdid.find(L"bill.save", 0) >= 0) { + //trace(1); + dw_base.AcceptText(); + OnSave(); + } + return 0; + } + + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + int OnCellChanged(TEvent* evt, LPARAM p) + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + xstring colname = hdr.colname; + //trace(colname); + if (colname == L"ShipNo") + { + xstring cspec = dw_base.GetItemString(1, 1); + trace(cspec); + xstring SpecRule = L"^\\d*$"; + xaserverarg args; + + args.AddArg(L"CSpec", cspec); + args.AddArg(L"SpecRule", SpecRule); + xml x; + + getUrl(L"/sale/data/LogisticsCode/pref/forwarderno/check", args.GetString(), x); + if (x.selectSingleNode(L"root/spec")) + { + alert(L"请输入数字!"); + return 0; + } + + } + return 1; + } + int OnAttachEvent() + { + AttachEvent(L"WM_XCOMMAND", (FEvent)&ShipcompanyMaint::OnXCommand); + AttachEvent(L"WM_SETFOCUS", (FEvent)&ShipcompanyMaint::OnSetFocus); + AttachEvent(L"dw_base", L"DWV_ITEMCHANGED", (FEvent)&ShipcompanyMaint::OnCellChanged); + return 1; + } + + int onload() + { + + OnAttachEvent(); + //if(!m_configDoc) return -1; + + maint::onload(); + + OnClear(); + + } +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/Simple.Menu.Config.cpp b/jrj/project/business/BasicCode/Simple.Menu.Config.cpp new file mode 100644 index 0000000..d201903 --- /dev/null +++ b/jrj/project/business/BasicCode/Simple.Menu.Config.cpp @@ -0,0 +1,276 @@ +#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" + +using xml = KXMLDOMDocument; + +class __declspec(dllexport) SimpleMenuConfig : public xframe +{ +public: + xdwgrid dw_list; + xtreeview tv_gs; + xnode m_agentNode; +public: + SimpleMenuConfig(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} +public: + static SimpleMenuConfig* CreateInstance(void* implPtr, void* hWnd) + { + SimpleMenuConfig* pWin = new SimpleMenuConfig(implPtr, (HWND)hWnd); + return pWin; + } + int AddRow() + { + dw_list.InsertRow(0); + return 1; + } + + int InsertRow() + { + dw_list.AcceptText(); + int row = dw_list.GetRow(); + if(row < 1 || row >dw_list.GetRowCount()) + AddRow(); + else + dw_list.InsertRow(row); + return 1; + } + + int DeleteRow() + { + dw_list.AcceptText(); + int row = dw_list.GetRow(); + if(row < 1 || row >dw_list.GetRowCount()) + return 1; + dw_list.DeleteRow(row); + return 1; + } + + int Save() + { + dw_list.AcceptText(); + int i=0; + for(i=1; i<=dw_list.GetRowCount();i++) + { + xstring seq = dw_list.GetItemString(i, L"SeqNo"); + if(seq != xstring(i)) + dw_list.SetItemString(i, L"SeqNo", xstring(i)); + } + + xml x; + + xaserverarg arg; + + dw_list.DwUpdateAllToEx(x); + arg.AddArg(L"content", x.xml()); + if(getUrl(L"/workflow/action/ItemPictureMenu.dbmap/bill.update", arg.GetString(), x) != 1) + alert(L"保存失败!"); + else + { + xstring str = x.xml(); + //alert(str); + if(str.find(L"失败", 0) > 0) + alert(L"保存失败!"); + else + { + //alert(L"保存成功!"); + dw_list.ResetUpdateStatus(); + dw_list.DwUpdateAllToEx(x); + HTREEITEM hItem =tv_gs.GetSelectedItem(); + if(hItem > 0) + { + KXMLDOMElement e = x.documentElement(); + int p = trust(e); + tv_gs.SetItemData(hItem, p); + + while(tv_gs.GetChildItem( hItem) > 0) + tv_gs.DeleteItem(tv_gs.GetChildItem( hItem)); + + KXMLDOMNodeList li = x.selectNodes(L"item/item"); + int s = li.length(); + for(i=0;i<s;i++) + { + KXMLDOMElement ele = li.item(i); + int pa = trust(ele); + xstring name = ele.selectSingleNode(L"Name").text(); + HTREEITEM cItem =tv_gs.InsertChildItem( hItem, name, pa, 15); + if(ele.selectSingleNode(L"item")) + tv_gs.SetItemChild1(cItem, 1); + } + } + + } + } + return 1; + } + + int UpRow() + { + dw_list.AcceptText(); + int row = dw_list.GetRow(); + if(row < 2 || row > dw_list.GetRowCount()) + return 1; + dw_list.SetRowMove(row, -1); + dw_list.SetRow(row - 1); + dw_list.Redraw(); + return 1; + } + + int DownRow() + { + dw_list.AcceptText(); + int row = dw_list.GetRow(); + if(row < 1 || row > dw_list.GetRowCount() - 1) + return 1; + dw_list.SetRowMove(row, 1); + dw_list.SetRow(row + 1); + dw_list.Redraw(); + return 1; + } + + int OnCmdDispatch(xstring comdid) + { + HCURSOR hCursor = xutil::SetCursorWait(); + if(comdid == L"AddRow") AddRow(); + else if(comdid == L"InsertRow") InsertRow(); + else if(comdid == L"DeleteRow") DeleteRow(); + else if(comdid == L"Save") Save(); + else if(comdid == L"UpRow") UpRow(); + else if(comdid == L"DownRow") DownRow(); + xutil::RestoreCursor(hCursor); + return 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; + } + + int OnSetFocus(TEvent* evt, LPARAM p) + { + SetAgent() ; + return 1; + } + + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnTreeSelChanged(TEvent* evt, LPARAM p) + { + + NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; + HTREEITEM hItem = nmtv.itemNew.hItem; + KXMLDOMElement& e = *(KXMLDOMElement*)tv_gs.GetItemData(hItem); + //trace(L"%s", e.xml); + //xstring id = e.selectSingleNode(L"MenuID").text(); + dw_list.AcceptText(); + dw_list.Retrieve(e); + dw_list.Redraw(); + return 1; + } + + int OnTreeMoveNode(TEvent* evt, LPARAM p) + { + TVNNMHDR& nmtv = *(TVNNMHDR*)evt->notify.pnmh; + HTREEITEM xfrom = nmtv.FromItem; + HTREEITEM xto = nmtv.ToItem; + + int ret = MessageBox(GetHWND(), L"确定移动节点!",L"提示:",1); + //trace(ret); + if(ret == 2) + { + tv_gs.DeleteItem(xto); + return -1; + } + KXMLDOMElement& fid = *(KXMLDOMElement*)tv_gs.GetItemData(xto); + HTREEITEM xpto =tv_gs.GetParentItem(xto); + KXMLDOMElement& tid = *(KXMLDOMElement*)tv_gs.GetItemData(xto); + //trace(L"%s-------------------------%s",fid.xml,tid.xml); + xml x ; + + xaserverarg arg; + + + xstring id1 = fid.selectSingleNode(L"@guid").text(); + xstring id2 = tid.selectSingleNode(L"@guid").text(); + //trace(L"%s-------------------------%s",id1,id2); + xstring str = L"update ItemPictureMenu set parentid='"+id2+L"' where menuid='"+id1+L"' "; + str += L" select 1 for xml path('root')L"; + + arg.AddArg(L"sql", str); + if(getSql(arg.GetString(),x)!=1) + { + trace(L"error:"+(xstring)x.xml()); + alert(L"移动节点出错!"); + tv_gs.DeleteItem(xto); + return 0; + } + //trace(L"================L"); + // + HTREEITEM xpfrom =tv_gs.GetParentItem(xfrom); + //trace(L"%d", xpfrom); + KXMLDOMElement& fe = *(KXMLDOMElement*)tv_gs.GetItemData(xpfrom); + //trace(L"%s-------------------------%s",fe.xml,tid.xml); + KXMLDOMElement fe1 = fe.selectSingleNode(L"item[@guid='"+id1+L"']"); + fe.removeChild(fe1); + tid.appendChild(fid); + + tv_gs.DeleteItem(xfrom); + return 1; + } + + int OnInitial() + { + HTREEITEM rItem =tv_gs.GetRootItem(); + tv_gs.ExpandItemEx( rItem); + tv_gs.ItemFocus(rItem); + return 1; + } + + int OnAttachEvent() + { + AttachEvent(L"WM_XCOMMAND", (FEvent)&SimpleMenuConfig::OnXCommand); + AttachEvent(L"WM_SETFOCUS", (FEvent)&SimpleMenuConfig::OnSetFocus); + AttachEvent(L"tv_gs",L"TVN_SELCHANGED", (FEvent)&SimpleMenuConfig::OnTreeSelChanged); + AttachEvent(L"tv_gs", L"TVN_ENDDRAG", (FEvent)&SimpleMenuConfig::OnTreeMoveNode); + return 1; + } + + int onload() + { + dw_list = GetControl(L"dw_list"); + dw_list.openUrl(L"/sale/view/SimpleProduct/template/Simple/Menu"); + dw_list.SetColumnState(L"SeqNo", false); + + tv_gs = GetControl(L"tv_gs"); + + SetAgent(); + OnAttachEvent(); + + OnInitial(); + + return 1; + } +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/SourceRemark.cpp b/jrj/project/business/BasicCode/SourceRemark.cpp new file mode 100644 index 0000000..fb8bc63 --- /dev/null +++ b/jrj/project/business/BasicCode/SourceRemark.cpp @@ -0,0 +1,158 @@ +#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) SourceRemark : public xwin + { + public: + xdwgrid dw_list; + xnode m_agentNode; //Agent Condition + public: + SourceRemark(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} + public: + static SourceRemark* CreateInstance(void* implPtr, void* hWnd) + { + SourceRemark* pWin = new SourceRemark(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 OnCmdDispatch(xstring comdid) + { + if(comdid==L"xmAddRow") + { + int row =dw_list.GetRowCount(); + dw_list.InsertRow(0); + //dw_list.SetItemString(row+1,L"State",L"Y"); + return 1; + } + else if(comdid==L"xmDeleteRow") + { + dw_list.DeleteRow(0); + return 1; + } + else if(comdid==L"xmSave") + return OnSave(); + else if(comdid==L"xmRefresh") + return OnRetrieve(); + return 0; + } + + //命令处理事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&SourceRemark::OnXCommand); + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&SourceRemark::OnSetFocus); + return 1; + } + + int OnSave() + { + xml x; + + dw_list.DwUpdateAllToEx(x); + xaserverarg arg; + + arg.AddArg(L"content",x.xml()); + if (xurl::get(L"/sale/data/TradeFinance3/SourceRemark/update",arg.GetString(),x) != 1) + { + trace(L"error:"+(xstring)x.xml()); + alert(L"保存失败!"); + return 0; + } + else + { + trace(x.xml()); + if(x.selectSingleNode(L"error")) + { + alert(L"保存出错2!"); + return 0; + } + MessageBox(GetHWND(),L"保存成功!",L"提示",0); + dw_list.ResetUpdateStatus(); + } + dw_list.Redraw(); + return 1; + } + + + int OnRetrieve() + { + xml x = new xml; + + xaserverarg arg; + + if (xurl::get(L"/sale/data/TradeFinance3/SourceRemark/list",arg.GetString(),x)!=1) + { + trace(x.text()); + return -1; + }else + { + dw_list.Retrieve(x); + dw_list.Redraw(); + } + return 1; + } + + int onload() + { + dw_list = GetControl(L"dw_list"); + dw_list.openUrl(L"/sale/view/FinancialCode/template/SourceRemarkList"); + dw_list.SetColumnState(L"ID",false); + + OnRetrieve(); + + OnAttachEvent(); + return 1; + } + + int onloaded() + { + SetAgent(); + + return 1; + } + }; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/SpecialDeductFeeList.cpp b/jrj/project/business/BasicCode/SpecialDeductFeeList.cpp new file mode 100644 index 0000000..6e905b7 --- /dev/null +++ b/jrj/project/business/BasicCode/SpecialDeductFeeList.cpp @@ -0,0 +1,159 @@ +#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) SpecialDeductFeeList : public xwin + { + public: + xdwgrid dw_list; + xnode m_agentNode; //Agent Condition + public: + SpecialDeductFeeList(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} + public: + static SpecialDeductFeeList* CreateInstance(void* implPtr, void* hWnd) + { + SpecialDeductFeeList* pWin = new SpecialDeductFeeList(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 OnCmdDispatch(xstring comdid) + { + if(comdid==L"xmAddRow") + { + int row =dw_list.GetRowCount(); + dw_list.InsertRow(0); + //dw_list.SetItemString(row+1,L"State",L"Y"); + return 1; + } + else if(comdid==L"xmDeleteRow") + { + dw_list.DeleteRow(0); + return 1; + } + else if(comdid==L"xmSave") + return OnSave(); + else if(comdid==L"xmRefresh") + return OnRetrieve(); + return 0; + } + + //命令处理事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&SpecialDeductFeeList::OnXCommand); + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&SpecialDeductFeeList::OnSetFocus); + return 1; + } + + int OnSave() + { + xml x; + + dw_list.DwUpdateAllToEx(x); + xaserverarg arg; + + arg.AddArg(L"content",x.xml()); + trace(x.xml()); + if (xurl::get(L"/sale/data/expense3/update/SpecialDeductFee",arg.GetString(),x) != 1) + { + trace(L"error:"+(xstring)x.xml()); + alert(L"保存失败!"); + return 0; + } + else + { + trace(x.xml()); + if(x.selectSingleNode(L"error")) + { + alert(L"保存出错2!"); + return 0; + } + MessageBox(GetHWND(),L"保存成功!",L"提示",0); + dw_list.ResetUpdateStatus(); + } + dw_list.Redraw(); + return 1; + } + + + int OnRetrieve() + { + xml x = new xml; + + xaserverarg arg; + + if (xurl::get(L"/sale/data/expense3/SpecialDeductFeeList",arg.GetString(),x)!=1) + { + trace(x.text()); + return -1; + }else + { + dw_list.Retrieve(x); + dw_list.Redraw(); + } + return 1; + } + + int onload() + { + dw_list = GetControl(L"dw_list"); + dw_list.openUrl(L"/sale/view/expense3/SpecialDeductFeeList"); + dw_list.SetColumnState(L"ID",false); + + OnRetrieve(); + + OnAttachEvent(); + return 1; + } + + int onloaded() + { + SetAgent(); + + return 1; + } + }; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/TestingCompanyList.cpp b/jrj/project/business/BasicCode/TestingCompanyList.cpp new file mode 100644 index 0000000..50c7dd3 --- /dev/null +++ b/jrj/project/business/BasicCode/TestingCompanyList.cpp @@ -0,0 +1,42 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) TestingCompanyList : public xwin +{ +public: + + xdwgrid dw_list; +public: + TestingCompanyList(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} +public: + static TestingCompanyList* CreateInstance(void* implPtr, void* hWnd) + { + TestingCompanyList* pWin = new TestingCompanyList(implPtr, (HWND)hWnd); + return pWin; + } + int onload() + { + list::onload(); + return -1; + } + + int ViewUpdate(param pr, xstring updateItem, xaserverarg arg) + { + if (updateItem == L"del") + { + int DelRow = dw_list.GetRow(); + dw_list.DeleteRow(DelRow); + + } + + return 1; + } + +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/TestingCompanyMaint.cpp b/jrj/project/business/BasicCode/TestingCompanyMaint.cpp new file mode 100644 index 0000000..12a369a --- /dev/null +++ b/jrj/project/business/BasicCode/TestingCompanyMaint.cpp @@ -0,0 +1,321 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) TestingCompanyMaint : public xframe +{ +public: + KXMLDOMDocument m_configDoc; + xstring m_userid; + xstring m_username; + xstring ContactID; + xdwtable dw_base; + xcell dw_cell; +public: + TestingCompanyMaint(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} +public: + static TestingCompanyMaint* CreateInstance(void* implPtr, void* hWnd) + { + TestingCompanyMaint* pWin = new TestingCompanyMaint(implPtr, (HWND)hWnd); + return pWin; + } + int alert(xstring str) + { + //win::MessageBox(GetHWND(),str,L"提示22:",0); + TApp::alert(this, str); + return 0; + } + int setCellReadOnly() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + dw_cell = new xcell; + dw_cell.setNativePointer(dw_base.QueryItem(L"ixcell")); + xstring strnew = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''/>"; + dw_cell.SetCellProps(2, 2, strnew); + return 0; + } + int OnSetFocus(TEvent* evt, LPARAM p) + { + SetAgent(L"maint"); + return 1; + } + xstring GetGuid() + { + return publiccode::GetGuid(); + } + int OnClear() { + if (m_EntityID == L"") { + m_userid = publiccode::GetUser().id; + m_username = publiccode::GetUser().name; + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + dw_base.SetItemString(1, L"PartyID", GetGuid()); + dw_base.SetItemString(1, L"PStatus", L"1"); + dw_base.SetItemDisplayString(1, L"PStatus", L"有效"); + dw_base.SetItemString(1, L"CreatorID", m_userid); + dw_base.SetItemString(1, L"PADStatus", L"1"); + dw_base.SetItemString(1, L"Type", L"20"); + dw_base.SetItemString(1, L"AddressID", GetGuid()); + dw_base.SetItemString(1, L"PADIdentifyAddressFlag", L"Y"); + dw_base.SetItemString(1, L"PrimaryFlag", L"Y"); + dw_base.SetItemString(1, L"EnterName", m_userid); + dw_base.SetItemDisplayString(1, L"EnterName", m_username); + dw_base.SetItemString(1, L"CreateDate", publiccode::GetCurrentDate()); + } + else + { + setCellReadOnly(); + } + return 0; + } + + int OnAddrow() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xdwtable dw = new xdwtable; + dw.setNativePointer(dw_base.GetCurTable()); + xstring dw_n = dw.GetDwName(); + if (dw_n == L"item") + { + dw.InsertRow(0); + int rows = dw.GetRowCount(); + dw.SetRow(rows); + } + return 1; + } + int OnInsertRow() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xdwtable dw = new xdwtable; + dw.setNativePointer(dw_base.GetCurTable()); + xstring dw_n = dw.GetDwName(); + if (dw_n == L"item") + { + int row = dw.GetRow(); + if (row < 1) return 0; + dw.InsertRow(row); + dw.SetRow(row); + } + return 1; + } + + int OnDeleteRow() + { + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xdwtable dw = new xdwtable; + dw.setNativePointer(dw_base.GetCurTable()); + xstring dw_n = dw.GetDwName(); + if (dw_n == L"item") + { + int row = dw.GetRow(); + if (row < 1) return 0; + /*xstring del = dw.GetItemString(row,8); + if(del!=L"") + { + if(m_dels==L"") + { + m_dels=del; + } + else + { + xstring temp=m_dels; + m_dels=del + L"|" + temp; + //+= L"|"+del; + } + + }*/ + dw.DeleteRow(row); + dw.SetRow(row - 1); + } + return 1; + } + xstring getGoodsNo() + { + xml x; + + xaserverarg arg; + + if (getUrl(L"/sale/data/LogisticsCode/pref/shipcompany/PartyNo", arg.GetString(), x) != 1) + { + trace(x.xml()); + return L""; + } + KXMLDOMElement e = x.documentElement(); + if (e) + { + xstring code = e.text(); + trace(code); + return L"P" + code; + } + return L"P1000"; + } + int OnPreSave() + { + dw_base.AcceptText(); + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xstring ShipNo = dw_base.GetItemString(1, L"ShipNo"); + if (ShipNo == L"") + { + dw_base.SetItemString(1, L"ShipNo", getGoodsNo()); + } + xdwtable dwcon = new xdwtable; + dwcon.setNativePointer(dw_base.FindDwTable(L"item", 0)); + int i; + for (i = 1; i <= dwcon.GetRowCount(); i++) + { + xstring aTemp; + xstring aName = dwcon.GetItemString(i, L"ContacterName"); + trace(aName); + if (aName == L"" ) + { + aTemp = dwcon.GetItemString(i, L"Mobile") + dwcon.GetItemString(i, L"TEL") + dwcon.GetItemString(i, L"Fax") + dwcon.GetItemString(i, L"Email") + dwcon.GetItemString(i, L"PCRemark"); + trace(aTemp); + if (aTemp != L"") + { + alert(L"联系人名称必填!"); + return -1; + } + } + else { + xstring ContactID = dwcon.GetItemString(i, L"ContactID"); + if (ContactID == L"" ) + { + dwcon.SetItemString(i, L"ContactID", GetGuid()); + dwcon.SetItemString(i, L"PCStatus", L"1"); + dw_base.SetItemString(1, L"PrimaryContactID", dwcon.GetItemString(1, L"ContactID")); + } + + + + } + } + return 1; + } + int OnSave() + { + + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + xstring SName = dw_base.GetItemString(1, L"Name"); + if (SName == L"") { + alert(L"请输入船公司名称!"); + return -1; + } + int rec = OnPreSave(); + if (rec == -1) return -1; + xml x; + + dw_base.DwUpdateAllTo(x); + trace(x.xml()); + xaserverarg arg; + + arg.AddArg(L"content", x.xml()); + arg.AddArg(L"dbmap", L"Shipcompany.dbmap"); + //arg.AddArg(L"m_dels",m_dels); + + if (getUrl(L"/sale/data/LogisticsCode/entity/shipcompany/save", arg.GetString(), x) != 1) + { + trace(L"error:" +(xstring)x.xml()); + alert(L"保存失败!"); + return 0; + } + else + { + trace(x.xml()); + if (x.selectSingleNode(L"error")) + { + alert(L"保存出错2!"); + return 0; + } + alert(L"保存成功!"); + dw_base.ResetUpdateStatus(); + setCellReadOnly(); + } + dw_base.Redraw(); + //m_dels=L""; + return 0; + } + int OnCmdDispatch(xstring comdid) + { + trace(comdid); + if (comdid.find(L"action:bill.row.add", 0) >= 0) { + OnAddrow(); + } + else if (comdid.find(L"bill.row.insert", 0) >= 0) { + OnInsertRow(); + } + else if (comdid.find(L"bill.row.delete", 0) >= 0) { + OnDeleteRow(); + } + else if (comdid.find(L"bill.save", 0) >= 0) { + //trace(1); + dw_base.AcceptText(); + OnSave(); + } + return 0; + } + + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + int OnCellChanged(TEvent* evt, LPARAM p) + { + + dw_base = new xdwtable; + dw_base.setNativePointer(GetControl(L"dw_base")); + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + xstring colname = hdr.colname; + //trace(colname); + if (colname == L"ShipNo") + { + xstring cspec = dw_base.GetItemString(1, 1); + trace(cspec); + xstring SpecRule = L"^\\d*$"; + xaserverarg args; + + args.AddArg(L"CSpec", cspec); + args.AddArg(L"SpecRule", SpecRule); + xml x = new xml; + + getUrl(L"/sale/data/LogisticsCode/pref/forwarderno/check", args.GetString(), x); + if (x.selectSingleNode(L"root/spec")) + { + alert(L"请输入数字!"); + return 0; + } + + } + return 1; + } + int OnAttachEvent() + { + AttachEvent(L"WM_XCOMMAND", (FEvent)&TestingCompanyMaint::OnXCommand); + AttachEvent(L"WM_SETFOCUS", (FEvent)&TestingCompanyMaint::OnSetFocus); + AttachEvent(L"dw_base", L"DWV_ITEMCHANGED", (FEvent)&TestingCompanyMaint::OnCellChanged); + return 1; + } + + int onload() + { + + OnAttachEvent(); + //if(!m_configDoc) return -1; + + maint::onload(); + + OnClear(); + + } +}; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/TypeList.maint.supplier.cpp b/jrj/project/business/BasicCode/TypeList.maint.supplier.cpp new file mode 100644 index 0000000..ccb1969 --- /dev/null +++ b/jrj/project/business/BasicCode/TypeList.maint.supplier.cpp @@ -0,0 +1,186 @@ +#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) TypeListMaintWin : public xframe + { + public: + xdwgrid dw_list; + xtreeview tv_folder; + + xnode m_agentNode; //Agent Condition + public: + TypeListMaintWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} + public: + static TypeListMaintWin* CreateInstance(void* implPtr, void* hWnd) + { + TypeListMaintWin* pWin = new TypeListMaintWin(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 OnSave() + { + xml x; + xaserverarg arg ; + + xml x1; + x1.loadXML(L"<root/>"); + + dw_list.DwUpdateAllToEx(x); + KXMLDOMNodeList t = x.selectNodes(L"root/Supplier[@update.modify]"); + KXMLDOMElement e1= x1.documentElement(); + int len = t.length(); + for(int i=0;i<len;i++) + { + e1.appendChild(t.item(i)); + } + arg.AddArg(L"content",x1.xml()); + if(xurl::get(L"/sale/data/SupplierV3/entity/save/v3", arg.GetString(),x)!=1) + { + xstring error = x.text(); + alert(error); + return 1; + }else + { + + if( x.selectSingleNode(L"ok")) + { + alert(L"保存成功"); + dw_list.ResetUpdateStatus(); + }else + { + alert(L"保存失败!"); + } + } + return 1; + } + + //命令发布函数 + int OnCmdDispatch(xstring comdid) + { + if(comdid==L"xmSave") + return OnSave(); + else if(comdid==L"xmSearch") + return OnRetrieve(); + + return 0; + } + + int OnRetrieve() + { + HTREEITEM hItem =tv_folder.GetSelectedItem(); + xstring typ = tv_folder.GetItemData(hItem); + xstring searchStr = xcontrol(GetControl(L"SearchContent")).GetText(); + + HCURSOR hCursor = xutil::SetCursorWait(); + xml x = ViewObject::RetrieveData(L"/sale/data/SupplierV3/type/list", L"sType",typ,L"SearchText",searchStr); + if(x) + dw_list.Retrieve(x); + else + dw_list.Reset(); + dw_list.Redraw(); + xutil::RestoreCursor(hCursor); + + return 1; + } + + //树选择 + int OnTreeSelChanged(TEvent* evt, int p) + { + NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; + + HTREEITEM hItem = nmtv.itemNew.hItem; + return OnRetrieve(); + } + //命令处理事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&TypeListMaintWin::OnXCommand); + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&TypeListMaintWin::OnSetFocus); + AttachEvent(L"tv_folder", L"TVN_SELCHANGED", (FEvent)&TypeListMaintWin::OnTreeSelChanged); + return 1; + } + + /* + int OnRetrieve() + { + xml x = new xml; + x.setNativePointer(xml::CreateInstance()); + xaserverarg arg = new xaserverarg; + arg.setNativePointer(arg.CreateInstance()); + arg.AddArg(L"xxx",L"xxx"); + if (getUrl(L"",arg.GetString(),x)!=1) + { + trace(x.text); + return -1; + }else + { + //dw_list.Retrieve(x); + //dw_list.Redraw(); + } + return 1; + } + */ + + int onload() + { + dw_list = GetControl(L"dw_list"); + dw_list.openUrl(L"/sale/view/SupplierV3/template/supplier/mainttypelist"); + + tv_folder = GetControl(L"tv_folder"); + OnAttachEvent(); + tv_folder.ExpandItem(tv_folder.GetRootItem()); + + return 1; + } + + int onloaded() + { + SetAgent(); + + return 1; + } + }; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/basicfareTypeList.cpp b/jrj/project/business/BasicCode/basicfareTypeList.cpp new file mode 100644 index 0000000..5988861 --- /dev/null +++ b/jrj/project/business/BasicCode/basicfareTypeList.cpp @@ -0,0 +1,158 @@ +#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) basicfareTypeList : public xwin + { + public: + xdwgrid dw_list; + xnode m_agentNode; //Agent Condition + public: + basicfareTypeList(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} + public: + static basicfareTypeList* CreateInstance(void* implPtr, void* hWnd) + { + basicfareTypeList* pWin = new basicfareTypeList(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 OnCmdDispatch(xstring comdid) + { + if(comdid==L"xmAddRow") + { + int row =dw_list.GetRowCount(); + dw_list.InsertRow(0); + dw_list.SetItemString(row+1,L"State",L"Y"); + return 1; + } + else if(comdid==L"xmDeleteRow") + { + dw_list.DeleteRow(0); + return 1; + } + else if(comdid==L"xmSave") + return OnSave(); + else if(comdid==L"xmRefresh") + return OnRetrieve(); + return 0; + } + + //命令处理事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnAttachEvent() + { + //绑定工具条点击事件 + AttachEvent(L"WM_XCOMMAND", (FEvent)&basicfareTypeList::OnXCommand); + //获取焦点事件,用于重置工具条 + AttachEvent(L"WM_SETFOCUS", (FEvent)&basicfareTypeList::OnSetFocus); + return 1; + } + + int OnSave() + { + xml x; + + dw_list.DwUpdateAllToEx(x); + xaserverarg arg; + + arg.AddArg(L"content",x.xml()); + if (xurl::get(L"/sale/data/expense3/update/basicfareType",arg.GetString(),x) != 1) + { + trace(L"error:"+(xstring)x.xml()); + alert(L"保存失败!"); + return 0; + } + else + { + trace(x.xml()); + if(x.selectSingleNode(L"error")) + { + alert(L"保存出错2!"); + return 0; + } + MessageBox(GetHWND(),L"保存成功!",L"提示",0); + dw_list.ResetUpdateStatus(); + } + dw_list.Redraw(); + return 1; + } + + + int OnRetrieve() + { + xml x = new xml; + + xaserverarg arg; + + if (xurl::get(L"/sale/data/expense3/basicfareTypeLsit",arg.GetString(),x)!=1) + { + trace(x.text()); + return -1; + }else + { + dw_list.Retrieve(x); + dw_list.Redraw(); + } + return 1; + } + + int onload() + { + dw_list = GetControl(L"dw_list"); + dw_list.openUrl(L"/sale/view/expense3/basicfareTypeList"); + dw_list.SetColumnState(L"ID",false); + + OnRetrieve(); + + OnAttachEvent(); + return 1; + } + + int onloaded() + { + SetAgent(); + + return 1; + } + }; \ No newline at end of file diff --git a/jrj/project/business/BasicCode/brand.regtype.cpp b/jrj/project/business/BasicCode/brand.regtype.cpp new file mode 100644 index 0000000..d58a1c3 --- /dev/null +++ b/jrj/project/business/BasicCode/brand.regtype.cpp @@ -0,0 +1,161 @@ +#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" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) brand_regtype : public xframe +{ +public: + xdwtable dw_list; + xnode m_agentNode; +public: + brand_regtype(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} +public: + static brand_regtype* CreateInstance(void* implPtr, void* hWnd) + { + brand_regtype* pWin = new brand_regtype(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; + } + + xdwtable getDw() + { + xdwtable dw1 = new xdwtable; + dw1.setNativePointer(dw_list.FindDwTable(L"item")); + return dw1; + } + + int addRow() + { + xdwtable dw = getDw(); + int row = dw.InsertRow(0); + xstring no = L"2"; + if (row > 1) + no = dw.GetItemString(row - 1, L"RegTypeID"); + int n = no.toInt(); + int h = n + 1; + dw.SetItemString(row, L"RegTypeID", xstring(h)); + return 1; + } + int deleteRow() + { + xdwtable dw = getDw(); + int row = dw.GetRow(); + if (row < 1 || row > dw.GetRowCount()) return -1; + if (MessageBox(GetHWND(), L"是否删除选择的记录行?", L"提示", 4) == 7) + return 1; + dw.DeleteRow(row); + return 1; + } + int save() + { + xml x; + + xaserverarg arg; + + dw_list.AcceptText(); + dw_list.DwUpdateAllTo(x); + KXMLDOMElement e = x.documentElement(); + //trace(e.xml); + arg.AddArg(L"content", e.xml()); + if (getUrl(L"/workflow/action/BrandRegType.dbmap/bill.update", arg.GetString(), x) != 1) + { + alert(L"保存失败!"); + return -1; + } + //trace(x.xml()); + xstring str = x.xml(); + if (str.find(L"保存成功", 0) > 0) + { + alert(L"保存成功"); + dw_list.ResetUpdateStatus(); + dw_list.Redraw(); + } + else + alert(L"保存失败0!"); + return 1; + } + + //命令发布函数 + int OnCmdDispatch(xstring comdid) + { + HCURSOR hCursor = xutil::SetCursorWait(); + if (comdid == L"xmNew") addRow(); + else if (comdid == L"xmDelete") deleteRow(); + else if (comdid == L"xmSave") save(); + xutil::RestoreCursor(hCursor); + return 0; + } + + //命令处理事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnSetFocus(TEvent* evt, LPARAM p) + { + SetAgent(); + return 1; + } + int OnAttachEvent() + { + AttachEvent(L"WM_XCOMMAND", (FEvent)&brand_regtype::OnXCommand); + AttachEvent(L"WM_SETFOCUS", (FEvent)&brand_regtype::OnSetFocus); + + return 1; + } + int Initail() + { + xaserverarg arg; + + xml x; + if (getUrl(L"/sale/data/brand/entity/regtype", arg.GetString(), x) != 1) + { + alert(L"初始化查询失败!"); + return -1; + } + //trace(x.xml()); + dw_list.Retrieve(x); + dw_list.Redraw(); + return 1; + } + + int onload() + { + dw_list = new xdwtable; + dw_list.setNativePointer(GetControl(L"dw_list")); + dw_list.openUrl(L"/sale/view/brand/template/regtype"); + //dw_list.SetColHeaderHeight(0); + dw_list.SetRowSelectorWidth(0); + + OnAttachEvent(); + SetAgent(); + Initail(); + return -1; + } +}; \ No newline at end of file diff --git a/jrj/project/business/GDN/CustomCodeNew.cpp b/jrj/project/business/GDN/CustomCodeNew.cpp index 110e378..76b8c83 100644 --- a/jrj/project/business/GDN/CustomCodeNew.cpp +++ b/jrj/project/business/GDN/CustomCodeNew.cpp Binary files differ -- Gitblit v1.9.3