Merge branch 'master' of http://116.62.18.175:6699/r/mis-prj
| | |
| | | <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> |
| | |
| | | </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> |
| | |
| | | <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"> |
| | |
| | | <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> |
| | |
| | | <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> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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); |
| | | } |
| | | }*/ |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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); |
| | | } |
| | | } |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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(); |
| | | |
| | | } |
| | | |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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(); |
| | | } |
| | | |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | ] |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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);//è¡åå» |
| | | } |
| | | ] |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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);//è¡åå» |
| | | } |
| | | ] |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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(); |
| | | |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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(); |
| | | |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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; |
| | | } |
| | | }; |