| | |
| | | <ClInclude Include="pch.h" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClCompile Include="..\project\business\AP\APBank.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AP\APNew3.warizd.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AP\list.ap.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AP\maint.ap.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AP\Select.AP.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\CustomerTran.AR.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\Deduction.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\ExchageFile.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\ExchageInput3.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\ExchangeBankTran.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\ExchangeColumnTran.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\ExchangeSignFast.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\maint.SettlementExchange.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Customer3.list.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | </ClCompile> |
| | |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Public\GroupManagerList.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Public\memo.edit.new.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | </ClCompile> |
| | |
| | | <ClCompile Include="..\project\business\Public\message.supplier.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Public\search.dialog.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Public\SupplierUserGroupPersonSelect.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Public\UserGroupMaint.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Public\UserGroupPersonSelect.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Public\UserGroupPersonSelectEx.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Public\UserGroupSelect.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Public\UserGroupShare.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Public\UserGroupShareEx.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\quote.enquiry.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\VATNotify\list.vatnotify.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\VATNotify\maint.papercard.vatnotify.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\VATNotify\simple.maint.vatnotify.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\VATNotify\update.vatnotify.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\VATNotify\VATNotifyParse.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\printview\Maint.Template.PrintEx.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | |
| | | <Filter Include="xframe\adt"> |
| | | <UniqueIdentifier>{183c9d39-437c-4c0f-9943-8f28e71eaa1a}</UniqueIdentifier> |
| | | </Filter> |
| | | <Filter Include="project\business\AP"> |
| | | <UniqueIdentifier>{53a12810-3857-48be-ad11-604fb1cca3ac}</UniqueIdentifier> |
| | | </Filter> |
| | | <Filter Include="project\business\VATNotify"> |
| | | <UniqueIdentifier>{ee5e5842-5c6a-4737-854d-3315c4aedf60}</UniqueIdentifier> |
| | | </Filter> |
| | | <Filter Include="project\business\AR"> |
| | | <UniqueIdentifier>{a4717a30-9c49-4681-a769-faa5b20ba2ea}</UniqueIdentifier> |
| | | </Filter> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClInclude Include="framework.h"> |
| | |
| | | <ClInclude Include="..\xframe\adt\xarray.hpp"> |
| | | <Filter>xframe\adt</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="..\xframe\xcontrol\xlistbox.hpp"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | <ClInclude Include="..\xframe\xcontrol\xlistview.hpp"> |
| | | <Filter>头æä»¶</Filter> |
| | | </ClInclude> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClCompile Include="dllmain.cpp"> |
| | |
| | | <ClCompile Include="..\project\business\PO\PO.maint.base.cpp"> |
| | | <Filter>project\business\PO</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AP\list.ap.cpp"> |
| | | <Filter>project\business\AP</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\VATNotify\list.vatnotify.cpp"> |
| | | <Filter>project\business\VATNotify</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AP\APBank.cpp"> |
| | | <Filter>project\business\AP</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AP\APNew3.warizd.cpp"> |
| | | <Filter>project\business\AP</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AP\maint.ap.cpp"> |
| | | <Filter>project\business\AP</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AP\Select.AP.cpp"> |
| | | <Filter>project\business\AP</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\VATNotify\maint.papercard.vatnotify.cpp"> |
| | | <Filter>project\business\VATNotify</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\VATNotify\simple.maint.vatnotify.cpp"> |
| | | <Filter>project\business\VATNotify</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\VATNotify\update.vatnotify.cpp"> |
| | | <Filter>project\business\VATNotify</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\VATNotify\VATNotifyParse.cpp"> |
| | | <Filter>project\business\VATNotify</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\CustomerTran.AR.cpp"> |
| | | <Filter>project\business\AR</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\Deduction.cpp"> |
| | | <Filter>project\business\AR</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\ExchageFile.cpp"> |
| | | <Filter>project\business\AR</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\ExchageInput3.cpp"> |
| | | <Filter>project\business\AR</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\ExchangeBankTran.cpp"> |
| | | <Filter>project\business\AR</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\ExchangeColumnTran.cpp"> |
| | | <Filter>project\business\AR</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\ExchangeSignFast.cpp"> |
| | | <Filter>project\business\AR</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\AR\maint.SettlementExchange.cpp"> |
| | | <Filter>project\business\AR</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Public\GroupManagerList.cpp"> |
| | | <Filter>project\business\Public</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Public\search.dialog.cpp"> |
| | | <Filter>project\business\Public</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Public\SupplierUserGroupPersonSelect.cpp"> |
| | | <Filter>project\business\Public</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Public\UserGroupPersonSelect.cpp"> |
| | | <Filter>project\business\Public</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Public\UserGroupPersonSelectEx.cpp"> |
| | | <Filter>project\business\Public</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Public\UserGroupMaint.cpp"> |
| | | <Filter>project\business\Public</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Public\UserGroupSelect.cpp"> |
| | | <Filter>project\business\Public</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Public\UserGroupShare.cpp"> |
| | | <Filter>project\business\Public</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Public\UserGroupShareEx.cpp"> |
| | | <Filter>project\business\Public</Filter> |
| | | </ClCompile> |
| | | </ItemGroup> |
| | | </Project> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) APListBankMaint : public xframe |
| | | { |
| | | public: |
| | | xdwtable dw_base; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | public: |
| | | APListBankMaint(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static APListBankMaint* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | APListBankMaint* pWin = new APListBankMaint(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"xmCancel") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | if (comdid == L"xmOK") |
| | | { |
| | | xaserverarg arg = GetArg(); |
| | | dw_base.AcceptText(); |
| | | arg.AddArg(L"PayedTerm", dw_base.GetItemString(1, L"PayedTerm")); |
| | | arg.AddArg(L"PayedBank", dw_base.GetItemString(1, L"PayedBank")); |
| | | arg.AddArg(L"PayedBankNo", dw_base.GetItemString(1, L"PayedBankNo")); |
| | | arg.AddArg(L"result", L"ok"); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&APListBankMaint::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&APListBankMaint::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | /* |
| | | int OnRetrieve() |
| | | { |
| | | xml x ; |
| | | |
| | | xaserverarg ; |
| | | |
| | | 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_base = GetControl(L"dw_base"); |
| | | dw_base.openUrl(L"/sale/view/AP/template/PayBank"); |
| | | |
| | | dw_base.SetColHeaderHeight(0); |
| | | dw_base.SetRowSelectorWidth(0); |
| | | dw_base.SetHScrollState(false); |
| | | dw_base.SetVScrollState(false); |
| | | |
| | | 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 "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) APNewWarizd3 : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_1; |
| | | xdwgrid dw_2; |
| | | xdwgrid dw_3; |
| | | xdwgrid dw_4; |
| | | xdwgrid dw_5; |
| | | xdwgrid dw_6; |
| | | xdwgrid dw_101; |
| | | xdwgrid dw_102; |
| | | bool bstart; |
| | | xlayersheet m_layer; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring searchStr; |
| | | |
| | | public: |
| | | APNewWarizd3(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static APNewWarizd3* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | APNewWarizd3* pWin = new APNewWarizd3(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 OnDoubleClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | dw_1.AcceptText(); |
| | | dw_2.AcceptText(); |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | int col = dw_1.GetColumn(); |
| | | dw_1.ItemChangeTo(dw_1.GetRow(), L"PayAmount", dw_1.GetItemString(dw_1.GetRow(), L"Balance")); |
| | | dw_1.Redraw(); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDoubleClickedOne(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring colname = hdr.colname; |
| | | xstring value = hdr.data; |
| | | |
| | | double Amount = dw_3.GetItemDouble(hdr.row, L"Amount"); |
| | | double PayedAmount = dw_3.GetItemDouble(hdr.row, L"PayedAmount"); |
| | | |
| | | if (colname == L"PrePayAmount" || colname == L"Amount") |
| | | { |
| | | double Amount1 = dw_3.GetItemDouble(hdr.row, L"Amount"); |
| | | double PrePayAmount = dw_3.GetItemDouble(hdr.row, L"PrePayAmount"); |
| | | dw_3.SetItemDouble(hdr.row, L"PayedAmount", xdouble(Amount - PrePayAmount).round(2)); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | //SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int ProcessBase(xdwgrid dw_obj) |
| | | { |
| | | xstring SupplierID; |
| | | for (int i = 1; i <= dw_obj.GetRowCount(); i++) |
| | | { |
| | | bool inserted = false; |
| | | SupplierID = dw_obj.GetItemString(i, L"SupplierID"); |
| | | int row = 1; |
| | | /*for(row = 1; row <= dw_3.GetRowCount(); row++) |
| | | { |
| | | if( SupplierID == dw_3.GetItemString(row,L"SupplierID")) break; |
| | | } |
| | | if(row > dw_3.GetRowCount()) |
| | | {*/ |
| | | row = dw_3.InsertRow(0); |
| | | inserted = true; |
| | | /*}*/ |
| | | if (inserted) |
| | | { |
| | | xstring sdate = publiccode::GetCurrentDate(); |
| | | dw_3.SetItemString(row, L"APDate", sdate); |
| | | |
| | | dw_3.SetItemString(row, L"CreateDate", sdate); |
| | | dw_3.SetItemString(row, L"PayedDate", sdate); |
| | | xstring suserid = publiccode::GetUser().id; |
| | | xstring susername = publiccode::GetUser().name; |
| | | dw_3.SetItemString(row, L"CreatorID", suserid); |
| | | dw_3.SetItemDisplayString(row, L"CreatorID", susername); |
| | | dw_3.SetItemDouble(row, L"PayedAmount", dw_obj.GetItemDouble(i, L"PayedAmount")); |
| | | dw_3.SetItemDouble(row, L"PrePayAmount", dw_obj.GetItemDouble(i, L"PrePayAmount")); |
| | | dw_3.SetItemDouble(row, L"Amount", dw_obj.GetItemDouble(i, L"Amount")); |
| | | |
| | | dw_3.SetItemString(row, L"APType", L"000"); /*货款*/ |
| | | dw_3.SetItemString(row, L"SupplierID", dw_obj.GetItemString(i, L"SupplierID")); |
| | | dw_3.SetItemDisplayString(row, L"SupplierID", dw_obj.GetItemDisplayString(i, L"SupplierID")); |
| | | dw_3.SetItemString(row, L"APSupplierID", dw_obj.GetItemString(i, L"APSupplierID")); |
| | | dw_3.SetItemDisplayString(row, L"APSupplierID", dw_obj.GetItemDisplayString(i, L"APSupplierID")); |
| | | dw_3.SetItemDisplayString(row, L"SalespersonID", dw_obj.GetItemDisplayString(i, L"SalespersonID")); |
| | | dw_3.SetItemString(row, L"SalespersonID", dw_obj.GetItemString(i, L"SalespersonID")); |
| | | dw_3.SetItemString(row, L"OrgName", dw_obj.GetItemString(i, L"OrgName")); |
| | | dw_3.SetItemString(row, L"InvoiceNo", dw_obj.GetItemString(i, L"NInvoiceNo")); |
| | | xstring APID = publiccode::GetGuid(); |
| | | dw_3.SetItemString(row, L"APID", APID); |
| | | } |
| | | else |
| | | { |
| | | double amt = 0.0; |
| | | amt = dw_3.GetItemDouble(row, L"PayedAmount"); |
| | | amt += dw_obj.GetItemDouble(i, L"PayedAmount"); |
| | | dw_3.SetItemDouble(row, L"PayedAmount", amt); |
| | | |
| | | amt = dw_3.GetItemDouble(row, L"PrePayAmount"); |
| | | amt += dw_obj.GetItemDouble(i, L"PrePayAmount"); |
| | | dw_3.SetItemDouble(row, L"PrePayAmount", amt); |
| | | |
| | | amt = dw_3.GetItemDouble(row, L"Amount"); |
| | | amt += dw_obj.GetItemDouble(i, L"Amount"); |
| | | dw_3.SetItemDouble(row, L"Amount", amt); |
| | | } |
| | | dw_obj.SetItemString(i, L"APID", dw_3.GetItemString(row, L"APID")); |
| | | } |
| | | dw_3.Redraw(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnTabSelectedSheet(TEvent* evt, LPARAM p) |
| | | { |
| | | int index = m_layer.GetSheetIndex(); |
| | | if (index == 1) |
| | | { |
| | | dw_1.AcceptText(); |
| | | |
| | | dw_4.Reset(); |
| | | dw_3.Reset(); |
| | | dw_6.Reset(); |
| | | |
| | | xml x ; |
| | | |
| | | x.loadXML(L"<data/>"); |
| | | |
| | | xml x1 ; |
| | | |
| | | dw_2.DwUpdateAllToEx(x1); |
| | | xstring SupplierID = L""; |
| | | int i = 0; |
| | | int row = 0; |
| | | for (i = 1; i <= dw_1.GetRowCount(); i++) |
| | | { |
| | | xstring Amount = dw_1.GetItemString(i, L"PayAmount"); |
| | | xstring PrePayAmount = dw_1.GetItemString(i, L"PrePayAmount"); |
| | | SupplierID = dw_1.GetItemString(i, L"VATSupplierID"); |
| | | xstring VATInvoiceID = dw_1.GetItemString(i, L"VATInvoiceID"); |
| | | if (Amount != L"" && Amount.toInt() != 0) |
| | | { |
| | | int row = dw_4.InsertRow(0); |
| | | dw_4.SetItemString(row, L"InvoiceNo", dw_1.GetItemString(i, L"InvoiceNo")); |
| | | dw_4.SetItemString(row, L"NInvoiceNo", dw_1.GetItemString(i, L"NInvoiceNo")); |
| | | dw_4.SetItemString(row, L"VATNo", dw_1.GetItemString(i, L"VATNo")); |
| | | |
| | | dw_4.SetItemString(row, L"Amount", dw_1.GetItemString(i, L"PayAmount")); |
| | | dw_4.SetItemString(row, L"PrePayAmount", dw_1.GetItemString(i, L"PrePayAmount")); |
| | | dw_4.SetItemString(row, L"PayedAmount", dw_1.GetItemString(i, L"APAmount")); |
| | | |
| | | dw_4.SetItemString(row, L"CurrencyCode", L"RMB"); |
| | | dw_4.SetItemString(row, L"SupplierID", dw_1.GetItemString(i, L"SupplierID")); |
| | | dw_4.SetItemDisplayString(row, L"SupplierID", dw_1.GetItemDisplayString(i, L"SupplierID")); |
| | | dw_4.SetItemString(row, L"APSupplierID", dw_1.GetItemString(i, L"VATSupplierID")); |
| | | dw_4.SetItemDisplayString(row, L"APSupplierID", dw_1.GetItemDisplayString(i, L"VATSupplierID")); |
| | | dw_4.SetItemString(row, L"VATInvoiceID", VATInvoiceID); |
| | | |
| | | dw_4.SetItemDisplayString(row, L"SalespersonID", dw_1.GetItemDisplayString(i, L"SalespersonID")); |
| | | dw_4.SetItemString(row, L"SalespersonID", dw_1.GetItemString(i, L"SalespersonID")); |
| | | dw_4.SetItemString(row, L"OrgName", dw_1.GetItemString(i, L"OrgName")); |
| | | |
| | | xstring APLineID = publiccode::GetGuid(); |
| | | dw_4.SetItemString(row, L"APLineID", APLineID); |
| | | } |
| | | } |
| | | ProcessBase(dw_4); |
| | | for (i = 1; i <= dw_6.GetRowCount(); i++) |
| | | { |
| | | SupplierID = dw_6.GetItemString(i, L"SupplierID"); |
| | | for (row = 1; row <= dw_3.GetRowCount(); row++) |
| | | { |
| | | if (SupplierID == dw_3.GetItemString(row, L"SupplierID")) |
| | | { |
| | | dw_6.SetItemString(i, L"APID", dw_3.GetItemString(row, L"APID")); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | KXMLDOMNodeList nodes = x1.selectNodes(L"data/Item[DisAmountCurrent != '']"); |
| | | int len = nodes.length(); |
| | | for (i = 0; i < len; i++) |
| | | { |
| | | KXMLDOMNode n = nodes.item(i); |
| | | x.documentElement().appendChild(n); |
| | | } |
| | | dw_5.Retrieve(x); |
| | | dw_5.Redraw(); |
| | | dw_5.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int ResetDataForContinue() |
| | | { |
| | | dw_1.Reset(); |
| | | dw_2.Reset(); |
| | | dw_3.Reset(); |
| | | dw_4.Reset(); |
| | | dw_5.Reset(); |
| | | dw_6.Reset(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave(bool continueAdd) |
| | | { |
| | | dw_3.AcceptText(); |
| | | dw_4.AcceptText(); |
| | | |
| | | xstring error; |
| | | xstring str; |
| | | xml x ; |
| | | xml x1 ; |
| | | xml x2 ; |
| | | xaserverarg arg; |
| | | xaserverarg arg1; |
| | | xaserverarg arg2; |
| | | |
| | | dw_3.DwUpdateAllToEx(x); |
| | | arg.AddArg(L"content", x.xml()); |
| | | |
| | | if (xurl::get(L"/sale/data/AP/update", arg.GetString(), x) != 1) |
| | | { |
| | | error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | str = x.documentElement().getAttribute(L"text"); |
| | | if (str != L"true") |
| | | { |
| | | alert(L"ä¿å失败1!"); |
| | | return 1; |
| | | } |
| | | |
| | | dw_4.DwUpdateAllToEx(x1); |
| | | arg1.AddArg(L"content", x1.xml()); |
| | | |
| | | if (xurl::get(L"/sale/data/AP/update", arg1.GetString(), x1) != 1) |
| | | { |
| | | error = x1.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | str = x1.documentElement().getAttribute(L"text"); |
| | | if (str != L"true") |
| | | { |
| | | alert(L"ä¿å失败2!"); |
| | | return 1; |
| | | } |
| | | |
| | | if (dw_6.GetRowCount() > 0) |
| | | { |
| | | dw_6.DwUpdateAllToEx(x2); |
| | | arg2.AddArg(L"content", x2.xml()); |
| | | |
| | | if (xurl::get(L"/sale/data/AP/update", arg2.GetString(), x2) != 1) |
| | | { |
| | | error = x2.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | str = x2.documentElement().getAttribute(L"text"); |
| | | if (str != L"true") |
| | | { |
| | | alert(L"ä¿å失败3!"); |
| | | return 1; |
| | | } |
| | | } |
| | | |
| | | dw_3.ResetUpdateStatus(); |
| | | dw_4.ResetUpdateStatus(); |
| | | dw_6.ResetUpdateStatus(); |
| | | |
| | | if (!continueAdd) |
| | | { |
| | | alert(L"ä¿åæå!"); |
| | | CloseWindow(); |
| | | } |
| | | else |
| | | { |
| | | ResetDataForContinue(); |
| | | m_layer.SelectSheet(0); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | int index; |
| | | if (comdid == L"xmPrev") |
| | | { |
| | | index = m_layer.GetSheetIndex(); |
| | | index--; |
| | | m_layer.SelectSheet(index); |
| | | } |
| | | else if (comdid == L"xmNext") |
| | | { |
| | | index = m_layer.GetSheetIndex(); |
| | | index++; |
| | | if (index == 1) |
| | | { |
| | | GetControl(L"sle_filter").SetText(L""); |
| | | xstring str = L""; |
| | | if (str != searchStr) |
| | | { |
| | | searchStr = str; |
| | | dw_1.Filter(L"VATSupplierID", searchStr); |
| | | } |
| | | } |
| | | m_layer.SelectSheet(index); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmCancel") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmOk") |
| | | { |
| | | return OnSave(false); |
| | | } |
| | | else if (comdid == L"xmOkEx") |
| | | { |
| | | return OnSave(true); |
| | | } |
| | | else if (comdid == L"xmFilter") return OnFilter(); |
| | | else if (comdid == L"xmQuery") |
| | | { |
| | | |
| | | index = m_layer.GetSheetIndex(); |
| | | index++; |
| | | OnRetrieve(); |
| | | |
| | | if (dw_1.GetRowCount() > 0) |
| | | { |
| | | OnPrepayRetrieve(1, bstart); |
| | | dw_2.Redraw(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | 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"PayAmount") |
| | | { |
| | | double amt = dw_1.GetItemDouble(row, L"PayAmount"); |
| | | dw_1.SetItemDouble(row, L"APAmount", amt); |
| | | dw_1.Redraw(); |
| | | } |
| | | if (colname == L"APAmount") |
| | | { |
| | | double APAmount = dw_1.GetItemDouble(row, L"APAmount"); |
| | | dw_1.SetItemDouble(row, L"PayAmount", APAmount); |
| | | dw_1.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnRowChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | |
| | | OnPrepayRetrieve(row, bstart); |
| | | xml x = ViewObject::RetrieveData( L"/sale/data/AP/list/invoice/supplier", L"InvoiceNo", dw_1.GetItemString(row, L"InvoiceNo"), |
| | | "SupplierID", dw_1.GetItemString(row, L"SupplierID")); |
| | | if (x) dw_101.Retrieve(x); |
| | | |
| | | dw_2.Redraw(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnItemAskStyle(TEvent* evt, LPARAM p) |
| | | { |
| | | int DMS_CSSSTYLE = 0x8; |
| | | DWASKSTYLENMHDR& hdr = *(DWASKSTYLENMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | int col = hdr.col; |
| | | xstring colname = hdr.colname; |
| | | |
| | | int rows = dw_1.GetRowCount(); |
| | | if (row < 1 || row > rows) |
| | | { |
| | | return 1; |
| | | } |
| | | |
| | | if (colname == L"NInvoiceNo") |
| | | { |
| | | xstring NInvoiceNo = dw_1.GetItemString(row, L"NInvoiceNo"); |
| | | xstring InvoiceNo = dw_1.GetItemString(row, L"InvoiceNo"); |
| | | if (NInvoiceNo != InvoiceNo) |
| | | { |
| | | hdr.mask = DMS_CSSSTYLE; |
| | | hdr.cssstyle = L"color:#ff0000"; |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&APNewWarizd3::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&APNewWarizd3::OnSetFocus); |
| | | AttachEvent(L"dw_1", L"DWV_DOUBLECLICKED", (FEvent)&APNewWarizd3::OnDoubleClicked);//è¡åå» |
| | | AttachEvent(L"dw_1", L"DWV_ITEMCHANGED", (FEvent)&APNewWarizd3::OnItemChanged); |
| | | AttachEvent(L"tab_1", L"LYSN_SELECTEDSHEET", (FEvent)&APNewWarizd3::OnTabSelectedSheet); |
| | | AttachEvent(L"dw_1", L"DWV_ROWFOCUSCHANGED", (FEvent)&APNewWarizd3::OnRowChanged); |
| | | AttachEvent(L"dw_1", L"DWV_ASKSTYLE", (FEvent)&APNewWarizd3::OnItemAskStyle); |
| | | return 1; |
| | | } |
| | | |
| | | int OnPrepayRetrieve(int row, bool start = false) |
| | | { |
| | | xstring supplier = dw_1.GetItemString(row, L"VATSupplierID"); |
| | | |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"SupplierID", supplier); |
| | | arg.AddArg(L"InvoiceNo", dw_1.GetItemString(row, L"InvoiceNo")); |
| | | if (getUrl(L"/sale/data/AP/prepaychecklistex", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_2.Retrieve(x); |
| | | dw_2.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnPrepayRetrieve0(int row, bool start = false) |
| | | { |
| | | xstring supplier = dw_1.GetItemString(row, L"VATSupplierID"); |
| | | xstring VATInvoiceID = dw_1.GetItemString(row, L"VATInvoiceID"); |
| | | xstring filterStr = supplier + L"||" + VATInvoiceID; |
| | | if (!start) |
| | | { |
| | | dw_2.Filter(L"FilterColumn", filterStr); |
| | | dw_2.Redraw(); |
| | | if (dw_2.GetRowCount() > 0) return 1; |
| | | } |
| | | |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"SupplierID", supplier); |
| | | if (getUrl(L"/sale/data/AP/prepaychecklist", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | if (start) |
| | | { |
| | | dw_2.Retrieve(x); |
| | | dw_2.Redraw(); |
| | | bstart = false; |
| | | } |
| | | else |
| | | { |
| | | xml x1 ; |
| | | |
| | | dw_2.DwUpdateAllToEx(x1); |
| | | KXMLDOMElement docElement = x1.documentElement(); |
| | | if (docElement) |
| | | { |
| | | KXMLDOMNodeList lst = x.selectNodes(L"data/Item"); |
| | | int n = lst.length(); |
| | | for (int i = 0; i < n; i++) |
| | | { |
| | | KXMLDOMElement e = lst.item(i); |
| | | docElement.appendChild(e); |
| | | KXMLDOMElement fe = x1.createElement(L"FilterColumn"); |
| | | fe.text = filterStr; |
| | | e.appendChild(fe); |
| | | fe.Release(); |
| | | e.Release(); |
| | | } |
| | | docElement.Release(); |
| | | lst.Release(); |
| | | dw_2.Retrieve(x1); |
| | | } |
| | | else |
| | | { |
| | | dw_2.Retrieve(x); |
| | | } |
| | | dw_2.Filter(L"FilterColumn", filterStr); |
| | | dw_2.Redraw(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"QueryTxt", GetControl(L"sle_search").GetText()); |
| | | |
| | | xcombobox cbx_type = GetControl(L"cbx_ship"); |
| | | int h = xcombobox::GetCurSel(cbx_type.GetHWND()); |
| | | if (h < 0) return 1; |
| | | xstring str = xcombobox::GetItemData(cbx_type.GetHWND()); |
| | | arg.AddArg(L"ShipDays", str); |
| | | trace(str); |
| | | if (getUrl(L"/sale/data/AP/list101", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | xutil::RestoreCursor(hCursor); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_1.Retrieve(x); |
| | | dw_1.Redraw(); |
| | | } |
| | | bstart = true; |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int OnFilter() |
| | | { |
| | | xstring str = GetControl(L"sle_filter").GetText(); |
| | | if (str != searchStr) |
| | | { |
| | | searchStr = str; |
| | | dw_1.Filter(L"*", searchStr); |
| | | |
| | | if (dw_1.GetRowCount() > 0) |
| | | { |
| | | OnPrepayRetrieve(1, bstart); |
| | | dw_2.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | m_layer = GetControl(L"tab_1"); |
| | | dw_1 = GetControl(L"dw_1"); |
| | | dw_1.openUrl(L"/sale/view/AP/template/ImportList100"); |
| | | dw_1.SetAskStyle(true); |
| | | |
| | | dw_1.SetColumnState(L"VATNo", false); |
| | | dw_1.SetColumnState(L"APAmount", false); |
| | | dw_1.SetColumnState(L"PrePayAmount", false); |
| | | dw_1.SetColumnState(L"PrePayBalance", false); |
| | | dw_1.SetColumnState(L"VATDate", false); |
| | | dw_1.SetColumnState(L"InvoiceNo", false); |
| | | dw_1.SetColumnState(L"SupplierID", false); |
| | | |
| | | dw_2 = GetControl(L"dw_2"); |
| | | dw_2.openUrl(L"/sale/view/AP/template/ImportList2"); |
| | | dw_2.SetColumnState(L"Balance", false); |
| | | dw_2.SetColumnState(L"DisAmountCurrent", false); |
| | | dw_2.SetColumnState(L"DisAmount", false); |
| | | |
| | | dw_101 = GetControl(L"dw_101"); |
| | | dw_101.openUrl(L"/sale/view/AP/template/AP/List1"); |
| | | dw_102 = GetControl(L"dw_102"); |
| | | dw_102.openUrl(L"/sale/view/AP/template/AP/List1"); |
| | | |
| | | dw_3 = GetControl(L"dw_3"); |
| | | dw_3.openUrl(L"/sale/view/AP/template/ImportList3"); |
| | | dw_4 = GetControl(L"dw_4"); |
| | | dw_4.openUrl(L"/sale/view/AP/template/ImportList4"); |
| | | |
| | | dw_5 = GetControl(L"dw_5"); |
| | | dw_5.openUrl(L"/sale/view/AP/template/ImportList5"); |
| | | dw_6 = GetControl(L"dw_6"); |
| | | dw_6.openUrl(L"/sale/view/AP/template/ImportList6"); |
| | | |
| | | OnAttachEvent(); |
| | | searchStr = L""; |
| | | bstart = true; |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) APSelectDlg : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xcontrol query; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | public: |
| | | APSelectDlg(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static APSelectDlg* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | APSelectDlg* pWin = new APSelectDlg(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 onOk() |
| | | { |
| | | xaserverarg arg = GetArg(); |
| | | arg.AddArg(L"items", L""); |
| | | KXMLDOMElement ele = dw_list.GetRowElement(dw_list.GetRow()); |
| | | arg.AddArg(L"items", L"<data>" + xstring(ele.xml()) + L"</data>"); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmCancel") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmQuery") |
| | | { |
| | | RetrieveData(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmOk") |
| | | { |
| | | onOk(); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&APSelectDlg::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&APSelectDlg::OnSetFocus); |
| | | AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&APSelectDlg::onOk); |
| | | return 1; |
| | | } |
| | | |
| | | int RetrieveData() |
| | | { |
| | | xstring keyword = query.GetText(); |
| | | trace(keyword); |
| | | xml x = ViewObject::RetrieveData(L"/sale/data/PurchaseOrder/po/searchadvance", L"PONo", keyword); |
| | | if (x) |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/PurchaseOrder/template/purchaseorder/POAdvance"); |
| | | OnAttachEvent(); |
| | | dw_list.SetColumnState(L"POID", false); |
| | | dw_list.SetColumnState(L"PartyID", false); |
| | | xaserverarg arg = GetArg(); |
| | | xstring PONo; |
| | | if (arg) |
| | | { |
| | | PONo = arg.GetArgString(L"PONo"); |
| | | } |
| | | query = GetControl(L"sle_search"); |
| | | query.SetText(PONo); |
| | | RetrieveData(); |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) ListAP : public xframe |
| | | { |
| | | public: |
| | | xstring apType; |
| | | xstring DatePicker; |
| | | xstring DatePickerOne; |
| | | xdwgrid dw_list; |
| | | xdwtable dw_arg; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | public: |
| | | ListAP(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static ListAP* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | ListAP* pWin = new ListAP(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | xstring GetPayType() |
| | | { |
| | | xcombobox cbx_type = GetControl(L"cbx_type"); |
| | | int h = xcombobox::GetCurSel(cbx_type.GetHWND()); |
| | | if (h < 0) return L""; |
| | | return xcombobox::GetLBText(cbx_type.GetHWND(), h); |
| | | } |
| | | |
| | | xstring GetEntityName(int pr) |
| | | { |
| | | return L"AP3"; |
| | | } |
| | | |
| | | xstring GetEntityIDName(int /*param*/ pr) |
| | | { |
| | | return L"APID"; |
| | | } |
| | | |
| | | xstring GetEntityID(int /*param*/ pr) |
| | | { |
| | | return dw_list.GetItemString(dw_list.GetRow(), L"APID"); |
| | | } |
| | | |
| | | int ViewUpdate(int pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"del") |
| | | { |
| | | int DelRow = dw_list.GetRow(); |
| | | dw_list.DeleteRow(DelRow); |
| | | return 1; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnBank() |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | OpenWindow(L"dev:xpage[APBank.vx]", arg); |
| | | if (arg.GetArgString(L"result") == L"ok") |
| | | { |
| | | int ll_row = dw_list.GetNextSelectRow(1); |
| | | dw_list.AcceptText(); |
| | | |
| | | while (ll_row > 0 && ll_row <= dw_list.GetRowCount()) |
| | | { |
| | | dw_list.SetItemString(ll_row, L"PayedTerm", arg.GetArgString(L"PayedTerm")); |
| | | dw_list.SetItemString(ll_row, L"PayedBank", arg.GetArgString(L"PayedBank")); |
| | | dw_list.SetItemString(ll_row, L"PayedBankNo", arg.GetArgString(L"PayedBankNo")); |
| | | ll_row = dw_list.GetNextSelectRow(ll_row + 1); |
| | | } |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | else return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmBank") return OnBank(); |
| | | if (comdid == L"xmSave") return OnSave(); |
| | | if (comdid == L"xmAnalysis") return OnAnalysis(); |
| | | if (comdid == L"xmRefresh" || comdid == L"xmSearch") |
| | | { |
| | | xstring payTypeOne = GetPayType(); |
| | | if (payTypeOne == L"å·²ä»è´§æ¬¾" || payTypeOne == L"å¾
ä»è´§æ¬¾") |
| | | { |
| | | return OnRetrieveEx(apType, DatePicker); |
| | | } |
| | | else if (payTypeOne == L"é¢ä»è´§æ¬¾") |
| | | { |
| | | apType = L"001"; |
| | | return OnRetrieveEx(apType, DatePicker); |
| | | } |
| | | else if (payTypeOne == L"é¢ä»è´§æ¬¾(å·²å²)L") |
| | | { |
| | | apType = L"001"; |
| | | return OnRetrieveEx1(apType, DatePickerOne); |
| | | } |
| | | |
| | | } |
| | | if (comdid == L"xmAddRow") |
| | | { |
| | | xstring payType = GetPayType(); |
| | | if (payType == L"å·²ä»è´§æ¬¾" || payType == L"å¾
ä»è´§æ¬¾") |
| | | OpenWindow(L"dev:xpage[APNew3.warizd.vx]"); |
| | | else if (payType == L"é¢ä»è´§æ¬¾" || payType == L"é¢ä»è´§æ¬¾(å·²å²)L") |
| | | { |
| | | xaserverarg arg1; |
| | | |
| | | arg1.AddArg(L"APType", apType); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.ap.vx]", arg1); |
| | | } |
| | | return 1; |
| | | } |
| | | if (comdid == L"xmSaveAs") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | return 1; |
| | | } |
| | | if (comdid == L"xmModifyRow") |
| | | { |
| | | |
| | | int row = dw_list.GetRow(); |
| | | if (row < 1) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring APID = ele.selectSingleNode(L"APID").text(); |
| | | ele.Release(); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"APID", APID); |
| | | arg.AddArg(L"APType", apType); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.ap.vx]", arg); |
| | | return 1; |
| | | } |
| | | if (comdid.find(L"action:", 0) >= 0) |
| | | { |
| | | xstring payType1 = GetPayType(); |
| | | if (payType1 == L"å·²ä»è´§æ¬¾" || payType1 == L"é¢ä»è´§æ¬¾") ProcessFlowAction(comdid, 1); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnDoubleClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | return OnCmdDispatch(L"xmModifyRow"); |
| | | } |
| | | |
| | | int OnCombboChanged(TEvent* evt, int lParam) |
| | | { |
| | | xstring id = L""; |
| | | xstring name = L""; |
| | | int h = xcombobox::GetCurSel(evt.hCtrl); |
| | | if (h > -1) |
| | | { |
| | | xstring txt = xcombobox::GetLBText(evt.hCtrl, h); |
| | | apType = L"---"; |
| | | if (txt == L"å·²ä»è´§æ¬¾") |
| | | { |
| | | dw_list.openUrl(L"/sale/view/AP/template/AP/list1"); |
| | | apType = L"000"; |
| | | OnRetrieveEx(apType, DatePicker); |
| | | } |
| | | else if (txt == L"å¾
ä»è´§æ¬¾") |
| | | { |
| | | dw_list.openUrl(L"/sale/view/AP/template/AP/list2"); |
| | | OnRetrieveEx(apType, DatePicker); |
| | | } |
| | | else if (txt == L"é¢ä»è´§æ¬¾") |
| | | { |
| | | dw_list.openUrl(L"/sale/view/AP/template/AP/list3"); |
| | | apType = L"001"; |
| | | OnRetrieveEx(apType, DatePicker); |
| | | } |
| | | else if (txt == L"é¢ä»è´§æ¬¾(å·²å²)L") |
| | | { |
| | | dw_list.openUrl(L"/sale/view/AP/template/AP/list3"); |
| | | apType = L"001"; |
| | | OnRetrieveEx1(apType, DatePickerOne); |
| | | } |
| | | |
| | | dw_list.SetColumnState(L"APID", false); |
| | | |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnItemChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | //if(datareading) return 0; |
| | | HCURSOR HCursor = xutil::SetCursorWait(); |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | xstring col = hdr.colname; |
| | | xstring data = hdr.data; |
| | | xstring ETD = L""; |
| | | if (col == L"InvoiceNo") |
| | | { |
| | | if (dw_list.GetItemString(row, L"InvoiceNo") != L"") |
| | | { |
| | | xml x12 = ViewObject::RetrieveData(L"/sale/data/AP/GetInvoiceNoEx", L"InvoiceNo", dw_list.GetItemString(row, L"InvoiceNo")); |
| | | if (x12) |
| | | { |
| | | xstring COUNT = x12.text(); |
| | | if (COUNT != L"") |
| | | { |
| | | alert(COUNT); |
| | | dw_list.SetItemString(row, L"InvoiceNo", L""); |
| | | dw_list.SetItemString(row, L"NotifyInvoiceNo", L""); |
| | | dw_list.SetItemString(row, L"GDNDate", L""); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | } |
| | | |
| | | xml x11 = ViewObject::RetrieveData(L"/sale/data/AP/GetInvoiceNo", L"InvoiceNo", dw_list.GetItemString(row, L"InvoiceNo")); |
| | | if (x11) |
| | | { |
| | | ETD = x11.text(); |
| | | } |
| | | dw_list.SetItemString(row, L"NotifyInvoiceNo", dw_list.GetItemString(row, L"InvoiceNo")); |
| | | dw_list.SetItemString(row, L"GDNDate", ETD); |
| | | dw_list.Redraw(); |
| | | |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.SetItemString(row, L"NotifyInvoiceNo", L""); |
| | | dw_list.SetItemString(row, L"GDNDate", L""); |
| | | dw_list.Redraw(); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&ListAP::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&ListAP::OnSetFocus); |
| | | AttachEvent(L"cbx_type", L"CBN_SELCHANGE", (FEvent)&ListAP::OnCombboChanged);//屿§ç»åæ¢listä¸åçæ°éåå |
| | | AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&ListAP::OnDoubleClicked);//è¡åå» |
| | | AttachEvent(L"cbx_state", L"CBN_SELCHANGE", (FEvent)&ListAP::OnDatePicker); |
| | | AttachEvent(L"dw_list", L"DWV_ITEMCHANGED", (FEvent)&ListAP::OnItemChanged); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDatePicker(TEvent* evt, int lParam) |
| | | { |
| | | xstring payTypeTwo = GetPayType(); |
| | | if (payTypeTwo == L"å·²ä»è´§æ¬¾" || payTypeTwo == L"å¾
ä»è´§æ¬¾") |
| | | { |
| | | int h = xcombobox::GetCurSel(evt.hCtrl); |
| | | if (h > -1) |
| | | { |
| | | xstring txt = xcombobox::GetLBText(evt.hCtrl, h); |
| | | if (txt == L"åºè¿æ¥æ") |
| | | { |
| | | apType = L"000"; |
| | | DatePicker = L"GDNDate"; |
| | | OnRetrieveEx(apType, DatePicker); |
| | | } |
| | | else if (txt == L"è¯·æ¬¾æ¥æ") |
| | | { |
| | | apType = L"000"; |
| | | DatePicker = L"APDate"; |
| | | OnRetrieveEx(apType, DatePicker); |
| | | } |
| | | else if (txt == L"仿¬¾æ¥æ") |
| | | { |
| | | apType = L"000"; |
| | | DatePicker = L"PayedDate"; |
| | | OnRetrieveEx(apType, DatePicker); |
| | | } |
| | | } |
| | | } |
| | | else if (payTypeTwo == L"é¢ä»è´§æ¬¾") |
| | | { |
| | | int h1 = xcombobox::GetCurSel(evt.hCtrl); |
| | | if (h1 > -1) |
| | | { |
| | | xstring txt1 = xcombobox::GetLBText(evt.hCtrl, h1); |
| | | if (txt1 == L"åºè¿æ¥æ") |
| | | { |
| | | apType = L"001"; |
| | | DatePicker = L"GDNDate"; |
| | | OnRetrieveEx(apType, DatePicker); |
| | | } |
| | | else if (txt1 == L"è¯·æ¬¾æ¥æ") |
| | | { |
| | | apType = L"001"; |
| | | DatePicker = L"APDate"; |
| | | OnRetrieveEx(apType, DatePicker); |
| | | } |
| | | else if (txt1 == L"仿¬¾æ¥æ") |
| | | { |
| | | apType = L"001"; |
| | | DatePicker = L"PayedDate"; |
| | | OnRetrieveEx(apType, DatePicker); |
| | | } |
| | | } |
| | | } |
| | | else if (payTypeTwo == L"é¢ä»è´§æ¬¾(å·²å²)L") |
| | | { |
| | | int h2 = xcombobox::GetCurSel(evt.hCtrl); |
| | | if (h2 > -1) |
| | | { |
| | | xstring txt2 = xcombobox::GetLBText(evt.hCtrl, h2); |
| | | if (txt2 == L"åºè¿æ¥æ") |
| | | { |
| | | apType = L"001"; |
| | | DatePickerOne = L"GDNDate"; |
| | | OnRetrieveEx1(apType, DatePickerOne); |
| | | } |
| | | else if (txt2 == L"è¯·æ¬¾æ¥æ") |
| | | { |
| | | apType = L"001"; |
| | | DatePickerOne = L"APDate"; |
| | | OnRetrieveEx1(apType, DatePickerOne); |
| | | } |
| | | else if (txt2 == L"仿¬¾æ¥æ") |
| | | { |
| | | apType = L"001"; |
| | | DatePickerOne = L"PayedDate"; |
| | | OnRetrieveEx1(apType, DatePickerOne); |
| | | } |
| | | } |
| | | } |
| | | 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/AP/update", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_list.ResetUpdateStatus(); |
| | | alert(L"ä¿åæå!"); |
| | | } |
| | | else |
| | | { |
| | | alert(L"ä¿å失败!"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieveEx1(xstring APType, xstring DatePickerOne) |
| | | { |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"QueryTxt", GetControl(L"sle_search").GetText()); |
| | | arg.AddArg(L"APType", APType); |
| | | arg.AddArg(L"QueryArg", GetQueryArg()); |
| | | arg.AddArg(L"DatePicker", DatePickerOne); |
| | | |
| | | trace(GetQueryArg()); |
| | | if (getUrl(L"/sale/data/AP/list9", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.SetSelectionMode(1); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | xstring GetQueryArg() |
| | | { |
| | | dw_arg.AcceptText(); |
| | | xml x ; |
| | | |
| | | dw_arg.DwUpdateAllTo(x); |
| | | |
| | | return x.xml(); |
| | | } |
| | | |
| | | int OnRetrieveEx(xstring APType, xstring DatePicker) |
| | | { |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"QueryTxt", GetControl(L"sle_search").GetText()); |
| | | arg.AddArg(L"APType", APType); |
| | | arg.AddArg(L"QueryArg", GetQueryArg()); |
| | | arg.AddArg(L"DatePicker", DatePicker); |
| | | |
| | | trace(GetQueryArg()); |
| | | if (getUrl(L"/sale/data/AP/list", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | //trace(L"xml=L"+x.xml); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | //dw_list.SetReadOnly(true); |
| | | dw_list.SetSelectionMode(1); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnAnalysis() |
| | | { |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | xstring str = dw_list.DataAnalysis(L""); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"html", str); |
| | | int obj = cast(dw_list as int); |
| | | arg.AddArg(L"obj", obj.toString()); |
| | | OpenWindow(L"dev:xpage[data.vanalysis.vx]", arg); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/AP/template/AP/list1"); |
| | | dw_list.SetColumnState(L"APID", false); |
| | | dw_list.SetColumnState(L"SupplierID", false); |
| | | dw_list.SetColumnState(L"VATNo", false); |
| | | |
| | | dw_arg = GetControl(L"dw_arg"); |
| | | dw_arg.openUrl(L"/sale/view/AR/template/queryarg"); |
| | | dw_arg.SetColHeaderHeight(0); |
| | | dw_arg.SetRowSelectorWidth(0); |
| | | dw_arg.SetHScrollState(false); |
| | | dw_arg.SetVScrollState(false); |
| | | dw_arg.SetItemString(1, L"DateType", L"æ¬æ"); |
| | | |
| | | OnAttachEvent(); |
| | | apType = L"000"; |
| | | OnRetrieveEx(apType, DatePicker); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) MaintAP : public xframe |
| | | { |
| | | public: |
| | | xstring APID; |
| | | xstring APType; |
| | | xdwtable dw_base; |
| | | xnode m_agentNode; //Agent Condition |
| | | HWND hObject = 0; |
| | | public: |
| | | MaintAP(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static MaintAP* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | MaintAP* pWin = new MaintAP(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 updateAdvance() |
| | | { |
| | | xstring AdvanceID = dw_base.GetItemString(1, L"AdvanceID"); |
| | | xstring ChargeOffState = L"Y"; |
| | | xstring ChargeOffDate = dw_base.GetItemString(1, L"APDate"); |
| | | xstring PayedAmount = dw_base.GetItemString(1, L"PayedAmount"); |
| | | xstring val = L"<data><PO><item guid='" + AdvanceID + L"' update.modify='1'>" + |
| | | "<ChargeOffState update.modify='1'>" + ChargeOffState + L"</ChargeOffState>" + |
| | | "<ChargeOffMoney update.modify='1'>" + PayedAmount + L"</ChargeOffMoney>" + |
| | | "<ChargeOffDate update.modify='1'>" + ChargeOffDate + L"</ChargeOffDate></item></PO></data>"; |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"content", val); |
| | | xml x ; |
| | | |
| | | if (xurl::get(L"/sale/data/PurchaseOrder/update/polistex", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | //alert(error); |
| | | return 0; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xstring APNo = dw_base.GetItemString(1, L"APNo"); |
| | | xml x ; |
| | | if (APNo == L"") |
| | | { |
| | | x = ViewObject::RetrieveData(L"/sale/data/AP/MakeAPNo"); |
| | | APNo = x.text(); |
| | | dw_base.SetItemString(1, L"APNo", APNo); |
| | | } |
| | | xstring AdvanceID = dw_base.GetItemString(1, L"AdvanceID"); |
| | | xstring OrigSysID = dw_base.GetItemString(1, L"OrigSysID"); |
| | | xstring APType1 = dw_base.GetItemString(1, L"APType"); |
| | | if (APType1 != L"000") |
| | | { |
| | | if (AdvanceID == L"" && OrigSysID != L"") { |
| | | alert(L"请转å
¥"); |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | |
| | | dw_base.AcceptText(); |
| | | dw_base.DwUpdateAllTo(x); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | |
| | | if (xurl::get(L"/sale/data/AP/update", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_base.ResetUpdateStatus(); |
| | | updateAdvance(); |
| | | alert(L"ä¿åæå!"); |
| | | |
| | | SendMessage(hObject, 0x401, (LPARAM)L"xmRefresh", 0); |
| | | CloseWindow(); |
| | | } |
| | | else |
| | | { |
| | | alert(L"ä¿å失败!"); |
| | | } |
| | | 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; |
| | | xstring dwname = L"dw_base"; |
| | | xstring ETD = L""; |
| | | |
| | | if (value == L"") return 1; |
| | | if (colname == L"SupplierID") |
| | | { |
| | | dw_base.SetItemString(1, L"APSupplierID", dw_base.GetItemString(1, L"SupplierID")); |
| | | dw_base.SetItemDisplayString(1, L"APSupplierID", dw_base.GetItemDisplayString(1, L"SupplierID")); |
| | | } |
| | | if (colname == L"Amount") |
| | | { |
| | | dw_base.SetItemString(1, L"PayedAmount", dw_base.GetItemString(1, L"Amount")); |
| | | } |
| | | if (colname == L"InvoiceNo") |
| | | { |
| | | dw_base.SetItemString(1, L"NotifyInvoiceNo", dw_base.GetItemString(1, L"InvoiceNo")); |
| | | |
| | | xml x11 = ViewObject::RetrieveData(L"/sale/data/AP/GetInvoiceNo", L"InvoiceNo", dw_base.GetItemString(1, L"InvoiceNo")); |
| | | if (x11) |
| | | { |
| | | ETD = x11.text(); |
| | | } |
| | | dw_base.SetItemString(1, L"GDNDate", ETD); |
| | | } |
| | | |
| | | return 1; |
| | | |
| | | } |
| | | int OnImport() |
| | | { |
| | | xaserverarg arg1; |
| | | |
| | | arg1.AddArg(L"PONo", dw_base.GetItemString(1, L"PONo")); |
| | | OpenWindow(L"dev:xpage[Select.AP.vx]", arg1); |
| | | xstring str = arg1.GetArgString(L"items"); |
| | | if (str != L"") |
| | | { |
| | | xml x ; |
| | | |
| | | x.loadXML(str); |
| | | KXMLDOMNodeList items = x.selectNodes(L"data/item"); |
| | | KXMLDOMNode t = items.item(0); |
| | | KXMLDOMNodeList items1 = x.selectNodes(L"data"); |
| | | KXMLDOMNode t1 = items1.item(0); |
| | | if (t1.selectSingleNode(L"item/@guid"))dw_base.SetItemString(1, L"AdvanceID", t1.selectSingleNode(L"item/@guid").text()); |
| | | if (t.selectSingleNode(L"PONo"))dw_base.SetItemString(1, L"PONo", t.selectSingleNode(L"PONo").text()); |
| | | if (t.selectSingleNode(L"OrgName"))dw_base.SetItemString(1, L"OrgName", t.selectSingleNode(L"OrgName").text()); |
| | | if (t.selectSingleNode(L"SalespersonID/@_displaystring"))dw_base.SetItemDisplayString(1, L"SalespersonID", t.selectSingleNode(L"SalespersonID/@_displaystring").text()); |
| | | if (t.selectSingleNode(L"SalespersonID"))dw_base.SetItemString(1, L"SalespersonID", t.selectSingleNode(L"SalespersonID").text()); |
| | | if (t.selectSingleNode(L"AdvancedMoney"))dw_base.SetItemString(1, L"Amount", t.selectSingleNode(L"AdvancedMoney").text()); |
| | | if (t.selectSingleNode(L"AdvancedMoney"))dw_base.SetItemString(1, L"PayedAmount", t.selectSingleNode(L"AdvancedMoney").text()); |
| | | if (t.selectSingleNode(L"PartyID"))dw_base.SetItemString(1, L"SupplierID", t.selectSingleNode(L"PartyID").text()); |
| | | if (t.selectSingleNode(L"PartyID"))dw_base.SetItemString(1, L"APSupplierID", t.selectSingleNode(L"PartyID").text()); |
| | | if (t.selectSingleNode(L"ShortName"))dw_base.SetItemDisplayString(1, L"APSupplierID", t.selectSingleNode(L"ShortName").text()); |
| | | if (t.selectSingleNode(L"ShortName"))dw_base.SetItemDisplayString(1, L"SupplierID", t.selectSingleNode(L"ShortName").text()); |
| | | if (t.selectSingleNode(L"SONo"))dw_base.SetItemString(1, L"SONO", t.selectSingleNode(L"SONo").text()); |
| | | |
| | | if (t.selectSingleNode(L"POAmount"))dw_base.SetItemString(1, L"POAmount", t.selectSingleNode(L"POAmount").text()); |
| | | } |
| | | return 1; |
| | | } |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmImport") |
| | | { |
| | | OnImport(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmClose") |
| | | { |
| | | CloseWindow(); |
| | | 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)&MaintAP::OnXCommand); |
| | | AttachEvent(L"dw_base", L"DWV_ITEMCHANGED", (FEvent)&MaintAP::OnItemChanged); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&MaintAP::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"EntityID", APID); |
| | | if (getUrl(L"/sale/data/AP/base", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_base.Retrieve(x); |
| | | dw_base.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | APID = L""; |
| | | APType = L""; |
| | | if (GetWinParam()) |
| | | { |
| | | xaserverarg arg=GetArg(); |
| | | |
| | | APID = arg.GetArgString(L"APID"); |
| | | APType = arg.GetArgString(L"APType"); |
| | | } |
| | | dw_base = GetControl(L"dw_base"); |
| | | dw_base.openUrl(L"/sale/view/AP/template/Base1"); |
| | | dw_base.SetColHeaderHeight(0); |
| | | dw_base.SetRowSelectorWidth(0); |
| | | dw_base.SetHScrollState(false); |
| | | dw_base.SetVScrollState(false); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | if (APID != L"") |
| | | { |
| | | OnRetrieve(); |
| | | } |
| | | else |
| | | { |
| | | xstring sdate = publiccode::GetCurrentDate(); |
| | | dw_base.SetItemString(1, L"APDate", sdate); |
| | | dw_base.SetItemString(1, L"PayedDate", sdate); |
| | | dw_base.SetItemString(1, L"CreateDate", sdate); |
| | | xstring suserid = publiccode::GetUser().id; |
| | | xstring susername = publiccode::GetUser().name; |
| | | dw_base.SetItemString(1, L"CreatorID", suserid); |
| | | dw_base.SetItemDisplayString(1, L"CreatorID", susername); |
| | | dw_base.SetItemString(1, L"APType", L"001"); |
| | | dw_base.SetItemDisplayString(1, L"APType", L"é¢ä»æ¬¾"); |
| | | dw_base.SetItemString(1, L"ApprovalStatus", L"6"); |
| | | |
| | | } |
| | | for (int m = 1; m <= dw_base.GetColumnCount(); m++) |
| | | { |
| | | xstring col = dw_base.GetColumnName(m); |
| | | if (col == L"OrgName" || col == L"APNo") |
| | | dw_base.SetColumnProp(col, L"cellprotect", L"1"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) CustomerTranARView : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | public: |
| | | CustomerTranARView(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static CustomerTranARView* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | CustomerTranARView* pWin = new CustomerTranARView(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"xmInsertRow") |
| | | { |
| | | dw_list.AcceptText(); |
| | | dw_list.InsertRow(dw_list.GetRow()); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmDeleteRow") |
| | | { |
| | | dw_list.DeleteRow(0); |
| | | } |
| | | else if (comdid == L"xmClose") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmSave") |
| | | { |
| | | return OnSave(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnItemAskStyle(TEvent* evt, LPARAM p) |
| | | { |
| | | int DMS_CSSSTYLE = 0x8; |
| | | DWASKSTYLENMHDR& hdr = *(DWASKSTYLENMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | int col = hdr.col; |
| | | xstring colname = hdr.colname; |
| | | |
| | | int rows = dw_list.GetRowCount(); |
| | | if (row < 1 || row > rows) |
| | | { |
| | | return 1; |
| | | } |
| | | |
| | | if (colname == L"DataColumn") |
| | | { |
| | | xstring str = dw_list.GetItemString(row, L"DataColumn"); |
| | | if (str.length() != 36) |
| | | { |
| | | hdr.mask = DMS_CSSSTYLE; |
| | | hdr.cssstyle = L"color:#ff0000"; |
| | | } |
| | | else if (str.find(L"-") != 8) |
| | | { |
| | | hdr.mask = DMS_CSSSTYLE; |
| | | hdr.cssstyle = L"color:#ff0000"; |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&CustomerTranARView::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&CustomerTranARView::OnSetFocus); |
| | | AttachEvent(L"dw_list", L"DWV_ASKSTYLE", (FEvent)&CustomerTranARView::OnItemAskStyle); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | dw_list.AcceptText(); |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | arg.AddArg(L"content", x.xml()); |
| | | if (getUrl(L"/sale/data/AR/update/tran/customer", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | alert(x.text()); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | if (getUrl(L"/sale/data/AR/tran/customer", 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/AR/template/customertran"); |
| | | dw_list.SetAskStyle(true); |
| | | |
| | | OnAttachEvent(); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | //SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) Deduction : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xstring EntityID; |
| | | xstring InvoiceNo; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | public: |
| | | Deduction(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static Deduction* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | Deduction* pWin = new Deduction(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 OnRowChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmSave") |
| | | { |
| | | OnSave(); |
| | | return 1; |
| | | } |
| | | if (comdid == L"xmSearch") |
| | | { |
| | | OnRetrieve(InvoiceNo, EntityID); |
| | | return 1; |
| | | } |
| | | if (comdid == L"xmClose") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | xstring GetGuid() |
| | | { |
| | | return publiccode::GetGuid(); |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml x; |
| | | |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | trace(x.xml()); |
| | | if (xurl::get(L"/sale/data/AR/update/ARDeduction", 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 OnItemChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring colname = hdr.colname; |
| | | xstring value = hdr.data; |
| | | int row = hdr.row; |
| | | xstring dwname = L"dw_list"; |
| | | if (colname == L"DeductionAmount") |
| | | { |
| | | dw_list.SetItemString(row, L"SettlementAdjustID", EntityID); |
| | | xstring id = publiccode::GetGuid(); |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | ele.setAttribute(L"guid", id); |
| | | //dw_list.SetGuid(row,id); |
| | | //alert(ele.xml); |
| | | //alert(dw_list.GetGuid(row)); |
| | | } |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&Deduction::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&Deduction::OnSetFocus); |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&Deduction::OnRowChanged); |
| | | AttachEvent(L"dw_list", L"DWV_ITEMCHANGED", (FEvent)&Deduction::OnItemChanged); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnRetrieve(xstring InvoiceNo, xstring EntityID) |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"InvoiceNo", InvoiceNo); |
| | | arg.AddArg(L"InvoiceNoEx", GetControl(L"search").GetText()); |
| | | arg.AddArg(L"EntityID", EntityID); |
| | | |
| | | trace(GetControl(L"search").GetText()); |
| | | if (getUrl(L"/sale/data/AR/DeductionList", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | dw_list.SetSelectionMode(1); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/AR/template/Deduction"); |
| | | |
| | | dw_list.SetColumnState(L"ID", false); |
| | | dw_list.SetColumnState(L"GDNLineID", false); |
| | | dw_list.SetColumnState(L"SettlementAdjustID", false); |
| | | |
| | | |
| | | if (GetWinParam()) |
| | | { |
| | | xaserverarg arg = GetArg(); |
| | | EntityID = arg.GetArgString(L"EntityID"); |
| | | InvoiceNo = arg.GetArgString(L"InvoiceNo"); |
| | | } |
| | | trace(InvoiceNo); |
| | | OnRetrieve(InvoiceNo, EntityID); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) ExchangeFileView : public xframe |
| | | { |
| | | public: |
| | | xcell dw_exchangefile; |
| | | xdwtable dw_arg; |
| | | xdwgrid dw_exch; |
| | | xstring filename; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | public: |
| | | ExchangeFileView(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static ExchangeFileView* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | ExchangeFileView* pWin = new ExchangeFileView(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 OnCellClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | //if(hdr.col ==1)hdr.idFrom = -1; |
| | | //if(hdr.col ==2)hdr.idFrom = -1; |
| | | if (hdr.row == 1)hdr.idFrom = -1; |
| | | return 2; |
| | | } |
| | | |
| | | int OnValid() |
| | | { |
| | | int row = dw_exchangefile.GetValidRow(); |
| | | int col = dw_exchangefile.GetValidCol(); |
| | | for (int i = 2; i < row; i++) |
| | | { |
| | | |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCellItemChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | /*int currentrow; |
| | | int currentcol; |
| | | const xstring data; |
| | | int anchorrow; |
| | | int anchorcol;*/ |
| | | if (hdr.currentcol == 1 && hdr.data != L"") |
| | | { |
| | | //dw_exchangefile.SetItemString(hdr.currentrow,hdr.currentcol, L""); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | dw_exch.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | int row = dw_exch.InsertRow(0); |
| | | xstring sdate = publiccode::GetCurrentDate(); |
| | | dw_exch.SetItemString(row, L"CreateDate", sdate); |
| | | dw_exch.SetItemString(row, L"SEDate", sdate); |
| | | dw_exch.SetItemString(row, L"CurrencyCode", L"USD"); |
| | | xstring suserid = publiccode::GetUser().id; |
| | | xstring susername = publiccode::GetUser().name; |
| | | dw_exch.SetItemString(row, L"CreatorID", suserid); |
| | | dw_exch.SetItemDisplayString(row, L"CreatorID", susername); |
| | | |
| | | if (row > 1) |
| | | { |
| | | xstring exchrate = dw_exch.GetItemString(row - 1, L"ExchRate"); |
| | | if (exchrate != L"") dw_exch.SetItemString(row, L"ExchRate", exchrate); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnTran() |
| | | { |
| | | //get head |
| | | xstring head = L""; |
| | | xstring val = L""; |
| | | int cols = dw_exchangefile.GetValidCol(1); |
| | | for (int col = 1; col <= cols; ++col) |
| | | { |
| | | val = dw_exchangefile.GetItemString(1, col); |
| | | val = val.trim(); |
| | | if (val == L"")continue; |
| | | if (val.find(L"(L") >= 0) val = val.left(val.find(L"(L")); |
| | | if (val.find(L"ï¼") >= 0) val = val.left(val.find(L"ï¼")); |
| | | if (val.find(L"[") >= 0) val = val.left(val.find(L"[")); |
| | | if (val.find(L"ã") >= 0) val = val.left(val.find(L"ã")); |
| | | if (val.find(L"/") >= 0) val = val.left(val.find(L"/")); |
| | | if (val.find(L"\r") >= 0) val = val.left(val.find(L"\r")); |
| | | if (val.find(L"\n") >= 0) val = val.left(val.find(L"\n")); |
| | | if (head == L"") head = val; else head += L",L" + val; |
| | | } |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"head", head); |
| | | //alert(head); |
| | | if (getUrl(L"/sale/data/AR/match/bank", arg.GetString(), x) != 1)return 1; |
| | | KXMLDOMNode n = x.selectSingleNode(L"data/Bank"); |
| | | if (!n) |
| | | { |
| | | alert(L"æªå¹é
å°åéçé¶è¡ï¼è¯·å
é
ç½®æ°æ®è½¬æ¢ä¿¡æ¯"); |
| | | return 1; |
| | | } |
| | | |
| | | KXMLDOMNodeList items = n.selectNodes(L"Item"); |
| | | int len = items.length(); |
| | | IntegerArray indexs = IntegerArray::make(); |
| | | StringArray columns = StringArray::make(); |
| | | xstring bank = n.selectSingleNode(L"@name").text(); |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | KXMLDOMElement e = items.item(i); |
| | | xstring str = e.getAttribute(L"index"); |
| | | indexs.push_back(str.toInt()); |
| | | columns.push_back(e.selectSingleNode(L"DataColumn").text()); |
| | | } |
| | | |
| | | if (MessageBox(GetHWND(), L"æ¯å¦è½½å
¥" + bank + L"ç»æ±æ°æ®!", L"æç¤º", 1) == 2) return 1; |
| | | |
| | | SwitchLayer(L"sheet2", L"frame"); |
| | | //set bank account |
| | | xml xb = ViewObject::RetrieveData(L"/sale/data/AR/tran/bank/info", L"bank", bank); |
| | | if (xb) |
| | | { |
| | | KXMLDOMNode nt = xb.selectSingleNode(L"/data/Item/Account"); |
| | | if (nt) |
| | | { |
| | | dw_arg.SetItemString(1, L"Bank", nt.text()); |
| | | if (nt.selectSingleNode(L"@_displaystring")) |
| | | dw_arg.SetItemDisplayString(1, L"Bank", nt.selectSingleNode(L"@_displaystring").text()); |
| | | } |
| | | |
| | | } |
| | | |
| | | //clear data |
| | | for (int m = dw_exch.GetRowCount(); m > 0; m--) dw_exch.DeleteRow(m); |
| | | |
| | | |
| | | //读å客æ·è½¬æ¢ä¿¡æ¯ |
| | | xml xc; |
| | | |
| | | if (getUrl(L"/sale/data/AR/tran/customer", L"", xc) != 1) |
| | | { |
| | | trace(xc.text()); |
| | | return -1; |
| | | } |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | KXMLDOMDocument xdoc = xc; |
| | | |
| | | int rows = dw_exchangefile.GetValidRow(); |
| | | for (int row = 2; row <= rows; ++row) |
| | | { |
| | | val = dw_exchangefile.GetItemString(row, indexs.item(0)); |
| | | if (val.trim() == L"") continue; |
| | | int curRow = dw_exch.InsertRow(0); |
| | | |
| | | //init |
| | | xstring sdate = publiccode::GetCurrentDate(); |
| | | dw_exch.SetItemString(curRow, L"CreateDate", sdate); |
| | | dw_exch.SetItemString(curRow, L"SEDate", sdate); |
| | | xstring suserid = publiccode::GetUser().id; |
| | | xstring susername = publiccode::GetUser().name; |
| | | dw_exch.SetItemString(curRow, L"CreatorID", suserid); |
| | | dw_exch.SetItemDisplayString(curRow, L"CreatorID", susername); |
| | | |
| | | for (int k = 0; k < indexs.length(); k++) |
| | | { |
| | | val = dw_exchangefile.GetItemString(row, indexs.item(k)); |
| | | if (columns.item(k) == L"ExchRate") |
| | | { |
| | | double d = val.toDouble(); |
| | | if (d > 100.0) d = d / 100.0; |
| | | dw_exch.SetItemDouble(curRow, L"ExchRate", d); |
| | | } |
| | | else if (columns.item(k) == L"CurrencyCode") |
| | | { |
| | | if (val == L"ç¾å
") val = L"USD"; |
| | | } |
| | | else if (columns.item(k) == L"CustomerID") |
| | | { |
| | | if (xdoc) |
| | | { |
| | | KXMLDOMNode n1 = xdoc.selectSingleNode(L"/data/Item[contains(\"" + val + L"\",RawColumn)]"); |
| | | if (n1) |
| | | { |
| | | //alert(n1.xml); |
| | | if (n1.selectSingleNode(L"DataColumn"))dw_exch.SetItemString(curRow, columns.item(k), n1.selectSingleNode(L"DataColumn").text()); |
| | | if (n1.selectSingleNode(L"DataColumn/@_displaystring"))dw_exch.SetItemDisplayString(curRow, columns.item(k), n1.selectSingleNode(L"DataColumn/@_displaystring").text()); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | dw_exch.SetItemString(curRow, columns.item(k), val); |
| | | } |
| | | } |
| | | xutil::RestoreCursor(hCursor); |
| | | alert(L"转æ¢å®æ!"); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSaveData() |
| | | { |
| | | xstring exchRate = dw_arg.GetItemString(1, L"ExchRate"); |
| | | xstring Bank = dw_arg.GetItemString(1, L"Bank"); |
| | | if (Bank == L"") |
| | | { |
| | | alert(L"请è¾å
¥ç»æ±é¶è¡!"); |
| | | return 1; |
| | | } |
| | | if (exchRate == L"") |
| | | { |
| | | alert(L"请è¾å
¥æ±ç!"); |
| | | return 1; |
| | | } |
| | | for (int row = 1; row <= dw_exch.GetRowCount(); row++) |
| | | { |
| | | if (dw_exch.GetItemString(row, L"ExchRate") == L"") |
| | | { |
| | | dw_exch.SetItemString(row, L"ExchRate", exchRate); |
| | | } |
| | | /*else |
| | | { |
| | | |
| | | }*/ |
| | | if (dw_exch.GetItemString(row, L"Bank") == L"") |
| | | { |
| | | dw_exch.SetItemString(row, L"Bank", Bank); |
| | | dw_exch.SetItemDisplayString(row, L"Bank", dw_arg.GetItemDisplayString(1, L"Bank")); |
| | | } |
| | | } |
| | | dw_exch.Redraw(); |
| | | |
| | | xml x; |
| | | |
| | | dw_exch.AcceptText(); |
| | | dw_exch.DwUpdateAllToEx(x); |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | |
| | | |
| | | |
| | | |
| | | //trace(x.xml()); |
| | | if (xurl::get(L"/sale/data/AR/update", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_exch.ResetUpdateStatus(); |
| | | alert(L"ä¿åæå!"); |
| | | } |
| | | else |
| | | { |
| | | alert(L"ä¿å失败!"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave(bool saveas = false) |
| | | { |
| | | |
| | | xstring myurl = L"data/SettleExchange"; |
| | | xstring sfilename = filename; |
| | | if (filename == L"" || saveas) |
| | | { |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"src", L"data/SettleExchange"); |
| | | OpenWindow(L"dev:xpage[trade.document.saveas.vx]", cast(arg as int)); |
| | | if (arg.GetArgString(L"result") == L"ok") |
| | | { |
| | | sfilename = arg.GetArgString(L"filename"); |
| | | } |
| | | else |
| | | return 1; |
| | | } |
| | | |
| | | xstring content = dw_exchangefile.GetData(); |
| | | |
| | | xstring sguid = publiccode::GetGuid(); |
| | | xstring sname = sguid; |
| | | xstring str = sname.mid(0, 2); |
| | | str = str.toUpper(); |
| | | xstring suri = L"attachment" + str; |
| | | int ret = xaserver::UploadData(suri, sguid + L".jpg", content); |
| | | if (ret < 0) |
| | | { |
| | | alert(L"ä¸ä¼ æä»¶åºé!"); |
| | | return 0; |
| | | } |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg args ; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg(L"myurl", myurl); |
| | | args.AddArg(L"name", sfilename); |
| | | args.AddArg(L"filepath", sname); |
| | | args.AddArg(L"fileext", L"xdoc"); |
| | | args.AddArg(L"filesource", sfilename); |
| | | |
| | | |
| | | |
| | | if (xurl::get(L"/sale/data/TDocument3/attachment/add", args.GetString(), x) != 1) |
| | | { |
| | | alert(L"ä¿ååºéäº!"); |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | filename = sfilename; |
| | | SetWindowText(GetHWND(), L"ç»æ±æä»¶:" + filename); |
| | | alert(x.text()); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int SendCtrlCmd(xcontrol xc, xstring cmd) |
| | | { |
| | | SendMessage(xc.GetId(), 0x401, cmd, 0); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmFileOpen") |
| | | { |
| | | xaserverarg args ; |
| | | args.setNativePointer(args.CreateInstance()); |
| | | args.AddArg(L"src", L"data/SettleExchange"); |
| | | args.AddArg(L"process", L"path"); |
| | | OpenWindow(L"dev:xpage[trade.document.selectdlg.vx]", cast(args as int)); |
| | | if (args.GetArgString(L"result") == L"ok") |
| | | { |
| | | xstring u = args.GetArgString(L"src"); |
| | | xml x; |
| | | |
| | | xaserver::LoadUrl(GetServerUrl(), u, L"", x); |
| | | dw_exchangefile.LoadTemplateEx(x.documentElement()); |
| | | dw_exchangefile.Redraw(); |
| | | filename = args.GetArgString(L"filename"); |
| | | SetWindowText(GetHWND(), L"ç»æ±æä»¶:" + filename); |
| | | } |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmFileNew") |
| | | { |
| | | dw_exchangefile.openUrl(L"/sale/view/AR/template/file"); |
| | | dw_exchangefile.Redraw(); |
| | | filename = L""; |
| | | SetWindowText(GetHWND(), L"ç»æ±æä»¶:[new]"); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmFileSave") |
| | | { |
| | | return OnSave(); |
| | | } |
| | | if (comdid == L"xmAddRow") |
| | | { |
| | | return OnInsertRow(); |
| | | } |
| | | else if (comdid == L"xmDeleteRow") |
| | | { |
| | | return OnDeleteRow(); |
| | | } |
| | | else if (comdid == L"xmSave") |
| | | { |
| | | return OnSaveData(); |
| | | } |
| | | else if (comdid == L"xmFileSaveAs") |
| | | { |
| | | return OnSave(/*saveas*/true); |
| | | } |
| | | else if (comdid.left(3) == L"IK_") |
| | | { |
| | | xstring cmd = comdid.mid(3, comdid.length()); |
| | | SendCtrlCmd(GetControl(L"dw_raw"), cmd); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmTrans") |
| | | { |
| | | OpenWindow(L"dev:xpage[ExchangeColumnTran.vx]"); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmClient") |
| | | { |
| | | OpenWindow(L"dev:xpage[CustomerTran.AR.vx]"); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmBank") |
| | | { |
| | | OpenWindow(L"dev:xpage[ExchangeBankTran.vx]"); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmTran") |
| | | { |
| | | return OnTran(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&ExchangeFileView::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&ExchangeFileView::OnSetFocus); |
| | | AttachEvent(L"dw_exchangefile", L"CELL_ITEMCHANGED", (FEvent)&ExchangeFileView::OnCellItemChanged); |
| | | AttachEvent(L"dw_exchangefile", L"DWV_CLICKED", (FEvent)&ExchangeFileView::OnCellClicked); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | |
| | | int onload() |
| | | { |
| | | dw_arg = GetControl(L"dw_arg"); |
| | | dw_arg.openUrl(L"/sale/view/AR/template/import/arg"); |
| | | dw_arg.SetColHeaderHeight(0); |
| | | dw_arg.SetRowSelectorWidth(0); |
| | | dw_arg.SetHScrollState(false); |
| | | dw_arg.SetVScrollState(false); |
| | | |
| | | dw_exchangefile = GetControl(L"dw_raw"); |
| | | dw_exch = GetControl(L"dw_exch"); |
| | | dw_exch.openUrl(L"/sale/view/AR/template/listex"); |
| | | OnAttachEvent(); |
| | | |
| | | |
| | | filename = L""; |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | SetWindowText(GetHWND(), L"ç»æ±æä»¶:[new]"); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) ExchangeInputView : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xdwgrid dw_signed; |
| | | xdwgrid dw_unexch; |
| | | xdwgrid dw_exch; |
| | | xdwgrid dw_adjust; |
| | | xdwtable dw_arg; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring tabname; |
| | | xstring tabagent; |
| | | int hSignWin; |
| | | |
| | | ///sale/data/AR/list |
| | | public: |
| | | ExchangeInputView(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static ExchangeInputView* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | ExchangeInputView* pWin = new ExchangeInputView(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (tabagent == tabname && m_agentNode) |
| | | { |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | tabagent = tabname; |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[@id='" + tabname + L"']/*"); |
| | | if (agent) |
| | | { |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnSaveEx() |
| | | { |
| | | xml x; |
| | | |
| | | dw_adjust.AcceptText(); |
| | | dw_adjust.DwUpdateAllToEx(x); |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | |
| | | //trace(x.xml()); |
| | | if (xurl::get(L"/sale/data/AR/update/item", 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_adjust.ResetUpdateStatus(); |
| | | alert(L"ä¿åæå!"); |
| | | } |
| | | else |
| | | { |
| | | alert(L"ä¿å失败!"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml x; |
| | | |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | |
| | | //trace(x.xml()); |
| | | if (xurl::get(L"/sale/data/AR/update", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_list.ResetUpdateStatus(); |
| | | alert(L"ä¿åæå!"); |
| | | } |
| | | else |
| | | { |
| | | alert(L"ä¿å失败!"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | dw_list.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | int row = dw_list.InsertRow(0); |
| | | xstring sdate = publiccode::GetCurrentDate(); |
| | | dw_list.SetItemString(row, L"CreateDate", sdate); |
| | | dw_list.SetItemString(row, L"SEDate", sdate); |
| | | dw_list.SetItemString(row, L"CurrencyCode", L"USD"); |
| | | xstring suserid = publiccode::GetUser().id; |
| | | xstring susername = publiccode::GetUser().name; |
| | | dw_list.SetItemString(row, L"CreatorID", suserid); |
| | | dw_list.SetItemDisplayString(row, L"CreatorID", susername); |
| | | |
| | | if (row > 1) |
| | | { |
| | | xstring exchrate = dw_list.GetItemString(row - 1, L"ExchRate"); |
| | | if (exchrate != L"") dw_list.SetItemString(row, L"ExchRate", exchrate); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnSign() |
| | | { |
| | | OpenWindow(L"dev:xpage[ExchangeSignFast.vx]", cast(dw_list as int)); |
| | | return 1; |
| | | } |
| | | |
| | | int OnCustomerEx() |
| | | { |
| | | xml xc; |
| | | |
| | | if (getUrl(L"/sale/data/AR/tran/customer", L"", xc) != 1) |
| | | { |
| | | trace(xc.text()); |
| | | return -1; |
| | | } |
| | | KXMLDOMDocument xdoc = xc; |
| | | if (xdoc) |
| | | { |
| | | for (int row = 1; row <= dw_list.GetRowCount(); ++row) |
| | | { |
| | | xstring val = dw_list.GetItemString(row, L"Customer"); |
| | | KXMLDOMNode n1 = xdoc.selectSingleNode(L"/data/Item[contains(\"" + val + L"\",RawColumn)]"); |
| | | if (n1) |
| | | { |
| | | dw_list.SetItemString(row, L"CustomerID", n1.selectSingleNode(L"DataColumn").text()); |
| | | dw_list.SetItemDisplayString(row, L"CustomerID", n1.selectSingleNode(L"DataColumn/@_displaystring").text()); |
| | | } |
| | | } |
| | | } |
| | | dw_list.Redraw(); |
| | | OnSave(); |
| | | //alert(L"é对åºå®æ!"); |
| | | return 1; |
| | | } |
| | | |
| | | int OnImprt() |
| | | { |
| | | xaserverarg args ; |
| | | |
| | | args.AddArg(L"src", L"data/SettleExchange"); |
| | | args.AddArg(L"process", L"data"); |
| | | OpenWindow(L"dev:xpage[trade.document.selectdlg.vx]",args); |
| | | return 1; |
| | | } |
| | | |
| | | int RetrieveData() |
| | | { |
| | | if (tabname == L"sign") return OnRetrieve(L"/sale/data/AR/list", dw_list); |
| | | if (tabname == L"signed") return OnRetrieve(L"/sale/data/AR/listFinish", dw_signed); |
| | | if (tabname == L"exch") return OnRetrieve(L"/sale/data/AR/gdn/exch/list", dw_exch); |
| | | if (tabname == L"unexch") return OnRetrieve(L"/sale/data/AR/gdn/noexch/list", dw_unexch); |
| | | if (tabname == L"adjust") return OnRetrieve(L"/sale/data/AR/Adjust", dw_adjust); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmAddRow") |
| | | { |
| | | return OnInsertRow(); |
| | | } |
| | | else if (comdid == L"xmImportRow") |
| | | { |
| | | return OnImprt(); |
| | | } |
| | | else if (comdid == L"xmCustomerEx") |
| | | { |
| | | return OnCustomerEx(); |
| | | } |
| | | else if (comdid == L"xmDeleteRow") |
| | | { |
| | | return OnDeleteRow(); |
| | | } |
| | | else if (comdid == L"xmDelete") |
| | | { |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBox(GetHWND(), L"确认æ¯å¦å é¤?", L"æç¤º", MB_OKCANCEL); |
| | | if (ret == IDOK) |
| | | { |
| | | ViewObject::RetrieveData(L"/sale/data/expense3/delete/SettlementExchange", L"EntityID", dw_list.GetGuid(dw_list.GetRow())); |
| | | OnRetrieve(L"/sale/data/AR/list", dw_list); |
| | | } |
| | | } |
| | | else if (comdid == L"xmDeleteRowEx") |
| | | { |
| | | /*int len = dw_adjust.GetRowCount(); |
| | | for(int i = 0; i< len ; i++) |
| | | { |
| | | dw_adjust.DeleteRow(0); |
| | | } |
| | | alert(L"end");*/ |
| | | dw_adjust.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmAddRowEx") |
| | | { |
| | | /*int row = dw_signed.GetRowCount(); |
| | | for(int i = 1;i < dw_signed.GetRowCount();i++) |
| | | { |
| | | double BalanceAmt=dw_signed.GetItemDouble(i,L"BalanceAmt"); |
| | | double DraftAmount=dw_signed.GetItemDouble(i,L"DraftAmount"); |
| | | xstring Remark = dw_signed.GetItemString(i,L"Remark"); |
| | | if(BalanceAmt != 0.00) |
| | | { |
| | | int row1 = dw_adjust.InsertRow(0); |
| | | xstring InvoiceNo = dw_signed.GetItemString(i,L"InvoiceNo"); |
| | | dw_adjust.SetItemString(row1,L"InvoiceNo",InvoiceNo); |
| | | dw_adjust.SetItemDouble(row1,L"Amount",BalanceAmt); |
| | | dw_adjust.SetItemDouble(row1,L"åºç»æ±ç¾å
éé¢",DraftAmount); |
| | | dw_adjust.SetItemDouble(row1,L"åºæ¶æ±éé¢",DraftAmount); |
| | | dw_adjust.SetItemString(row1,L"Note",Remark); |
| | | } |
| | | } |
| | | alert(L"end");*/ |
| | | dw_adjust.InsertRow(1); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmClient") |
| | | { |
| | | OpenWindow(L"dev:xpage[CustomerTran.AR.vx]"); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmExchangeFile") |
| | | { |
| | | //if(iswindow(hSignWin) & 0x1) return 1; |
| | | xwin xw = OpenWindow(L"dev:xpage[ExchageFile.vx]", 0); |
| | | hSignWin = xw.GetHWND(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmRefresh") |
| | | { |
| | | |
| | | return RetrieveData(); |
| | | } |
| | | else if (comdid == L"xmSave") |
| | | { |
| | | return OnSave(); |
| | | } |
| | | else if (comdid == L"xmSaveEx") |
| | | { |
| | | return OnSaveEx(); |
| | | } |
| | | else if (comdid == L"xmSign") |
| | | { |
| | | return OnSign(); |
| | | } |
| | | else if (comdid.find(L"xmSignEx") >= 0) |
| | | { |
| | | xstring id = comdid.mid(comdid.find(L":") + 1, 9999); |
| | | trace(L"----\r\n" + id); |
| | | int frow = 0; |
| | | for (frow = 1; frow <= dw_list.GetRowCount(); frow++) |
| | | { |
| | | if (frow == 1) |
| | | trace(L"----\r\n" + dw_list.GetGuid(frow)); |
| | | if (id == dw_list.GetGuid(frow)) break; |
| | | } |
| | | if (frow > dw_list.GetRowCount()) return 1; |
| | | dw_list.SetRow(frow); |
| | | OpenWindow(L"dev:xpage[ExchangeSignFast.vx]", cast(dw_list as int)); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmAdd") |
| | | { |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"HWND", GetHWND()); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.SettlementExchange.vx]", arg); |
| | | } |
| | | else if (comdid == L"xmEdit") |
| | | { |
| | | xaserverarg arg1 ; |
| | | |
| | | arg1.AddArg(L"HWND", GetHWND().toString()); |
| | | arg1.AddArg(L"SettlementExchangeID", dw_list.GetGuid(dw_list.GetRow())); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.SettlementExchange.vx]", arg1); |
| | | } |
| | | else if (comdid == L"Deduction") |
| | | { |
| | | int row = dw_adjust.GetRow(); |
| | | if (row < 1) |
| | | return 1; |
| | | xstring InvoiceNoExs = dw_adjust.GetItemString(row, L"InvoiceNo"); |
| | | if (InvoiceNoExs != L"") |
| | | { |
| | | xaserverarg argEx ; |
| | | |
| | | argEx.AddArg(L"EntityID", dw_adjust.GetGuid(row)); |
| | | argEx.AddArg(L"InvoiceNo", InvoiceNoExs); |
| | | trace(dw_adjust.GetGuid(row) + InvoiceNoExs); |
| | | OpenWindow(L"dev:xpage[Deduction.vx]", argEx); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | alert(L"å¤è¿ç¼å·ä¸ºç©ºï¼æ æ³åé
ï¼"); |
| | | return 1; |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | int OnCombboChanged(ref TCommandEvent evt, int lParam) |
| | | { |
| | | xstring id = L""; |
| | | xstring name = L""; |
| | | int h = xcombobox::GetCurSel(evt.hCtrl); |
| | | if (h > -1) |
| | | { |
| | | tabname = xcombobox::GetItemData(evt.hCtrl, h); |
| | | SwitchLayer(L"sheet" + (h + 1).toString(), L"frame"); |
| | | RetrieveData(); |
| | | SetAgent(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnBaseItemChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring colname = hdr.colname; |
| | | xstring value = hdr.data; |
| | | |
| | | xstring dwname = L"dw_adjust"; |
| | | if (value != L"") |
| | | { |
| | | KXMLDOMNodeList nlist = GetElement().selectNodes(L"//*[@name='" + dwname + L"']/trans[@for='" + colname + L"']"); |
| | | ViewObject::TransData(nlist, dw_adjust, hdr.row, colname, value); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnDoubleClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | return OnCmdDispatch(L"xmEdit"); |
| | | } |
| | | |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&ExchangeInputView::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&ExchangeInputView::OnSetFocus); |
| | | AttachEvent(L"cbx_type", L"CBN_SELCHANGE", (FEvent)&ExchangeInputView::OnCombboChanged);//屿§ç»åæ¢listä¸åçæ°éåå |
| | | AttachEvent(L"dw_adjust", L"DWV_ITEMCHANGED", (FEvent)&ExchangeInputView::OnBaseItemChanged); |
| | | AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&ExchangeInputView::OnDoubleClicked);//è¡åå» |
| | | return 1; |
| | | |
| | | } |
| | | |
| | | xstring GetQueryArg() |
| | | { |
| | | dw_arg.AcceptText(); |
| | | xml x; |
| | | |
| | | dw_arg.DwUpdateAllTo(x); |
| | | trace(x.text()); |
| | | return x.xml(); |
| | | } |
| | | |
| | | int OnRetrieve(xstring dataUrl, xdwgrid dw_obj) |
| | | { |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"QueryTxt", GetControl(L"sle_search").GetText()); |
| | | arg.AddArg(L"QueryArg", GetQueryArg()); |
| | | //trace(L"QueryArg======L"+GetQueryArg()); |
| | | if (getUrl(dataUrl, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | xutil::RestoreCursor(hCursor); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | //trace(x.xml()); |
| | | dw_obj.Retrieve(x); |
| | | dw_obj.Redraw(); |
| | | } |
| | | //dw_obj.SetReadOnly(false); |
| | | dw_obj.SetSelectionMode(1); |
| | | xutil::RestoreCursor(hCursor); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/AR/template/list"); |
| | | |
| | | |
| | | dw_signed = GetControl(L"dw_signed"); |
| | | dw_signed.openUrl(L"/sale/view/AR/template/listFinish"); |
| | | dw_exch = GetControl(L"dw_exch"); |
| | | dw_exch.openUrl(L"/sale/view/AR/template/unexch"); |
| | | dw_unexch = GetControl(L"dw_unexch"); |
| | | dw_unexch.openUrl(L"/sale/view/AR/template/unexch"); |
| | | dw_adjust = GetControl(L"dw_adjust"); |
| | | dw_adjust.openUrl(L"/sale/view/AR/template/adjust"); |
| | | |
| | | dw_unexch.SetColumnState(L"SEItemID", false); |
| | | dw_unexch.SetColumnState(L"SEID", false); |
| | | dw_exch.SetColumnState(L"SEItemID", false); |
| | | dw_exch.SetColumnState(L"SEID", false); |
| | | dw_exch.SetColumnState(L"BankDeduction", false); |
| | | dw_exch.SetColumnState(L"宿¶æ±éé¢", false); |
| | | |
| | | dw_arg = GetControl(L"dw_arg"); |
| | | dw_arg.openUrl(L"/sale/view/AR/template/queryarg"); |
| | | dw_arg.SetColHeaderHeight(0); |
| | | dw_arg.SetRowSelectorWidth(0); |
| | | dw_arg.SetHScrollState(false); |
| | | dw_arg.SetVScrollState(false); |
| | | |
| | | tabname = L"sign"; |
| | | tabagent = L""; |
| | | |
| | | OnAttachEvent(); |
| | | hSignWin = 0; |
| | | RetrieveData(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) ExchangeBankTranView : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | public: |
| | | ExchangeBankTranView(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static ExchangeBankTranView* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | ExchangeBankTranView* pWin = new ExchangeBankTranView(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"xmInsertRow") |
| | | { |
| | | dw_list.AcceptText(); |
| | | dw_list.InsertRow(dw_list.GetRow()); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmDeleteRow") |
| | | { |
| | | dw_list.DeleteRow(0); |
| | | } |
| | | else if (comdid == L"xmClose") |
| | | { |
| | | CloseWindow(); |
| | | 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)&ExchangeBankTranView::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&ExchangeBankTranView::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | dw_list.AcceptText(); |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | arg.AddArg(L"content", x.xml()); |
| | | if (getUrl(L"/sale/data/AR/update/tran/bank", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | alert(x.text()); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | if (getUrl(L"/sale/data/AR/tran/bank", 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/AR/template/banktran"); |
| | | |
| | | OnAttachEvent(); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | //SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) ExchangeColumnTranView : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | public: |
| | | ExchangeColumnTranView(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static ExchangeColumnTranView* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | ExchangeColumnTranView* pWin = new ExchangeColumnTranView(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"xmInsertRow") |
| | | { |
| | | dw_list.AcceptText(); |
| | | dw_list.InsertRow(dw_list.GetRow()); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmDeleteRow") |
| | | { |
| | | dw_list.DeleteRow(0); |
| | | } |
| | | else if (comdid == L"xmClose") |
| | | { |
| | | CloseWindow(); |
| | | 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)&ExchangeColumnTranView::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&ExchangeColumnTranView::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | dw_list.AcceptText(); |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | dw_list.DwUpdateAllTo(x); |
| | | arg.AddArg(L"content", x.xml()); |
| | | if (getUrl(L"/sale/data/AR/update/tran/head", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | alert(x.text()); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | if (getUrl(L"/sale/data/AR/tran/head", 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/AR/template/headtran"); |
| | | |
| | | OnAttachEvent(); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | //SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) ExchangeSignFastWin : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_unexch; |
| | | xdwgrid dw_list; |
| | | xdwgrid dw_obj; |
| | | xdwtable dw_arg; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | public: |
| | | ExchangeSignFastWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static ExchangeSignFastWin* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | ExchangeSignFastWin* pWin = new ExchangeSignFastWin(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; |
| | | } |
| | | |
| | | bool IsNoEmptyValue(xstring val) |
| | | { |
| | | if (val != L"" && val != L".00" && val != L"0.00" && val != L"-0.00") return true; |
| | | return false; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | for (int row = dw_list.GetRowCount(); row >= 1; row--) |
| | | { |
| | | if (dw_list.GetItemDouble(row, L"ExchAmt") != 0.0) continue; |
| | | if (dw_list.GetItemDouble(row, L"BankDeduction") != 0.0) continue; |
| | | if (dw_list.GetItemDouble(row, L"ForeignBankDeduction") != 0.0)continue; |
| | | dw_list.DeleteRow(row); |
| | | dw_list.Redraw(); |
| | | } |
| | | xml x; |
| | | |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | |
| | | //trace(x.xml()); |
| | | xml x0 = ViewObject::MakeXml(); |
| | | x0.loadXML(L"<data/>"); |
| | | |
| | | KXMLDOMNodeList t = x.selectNodes(L"data/Item[@update.modify or @update.delete]"); |
| | | KXMLDOMElement e1 = x0.documentElement(); |
| | | int len = t.length(); |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | e1.appendChild(t.item(i)); |
| | | } |
| | | xaserverarg arg = ViewObject::MakeArg(); |
| | | arg.AddArg(L"content", x0.xml()); |
| | | |
| | | if (xurl::get(L"/sale/data/AR/update/item", 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"xmSave") |
| | | { |
| | | return OnSave(); |
| | | } |
| | | else if (comdid == L"xmClose") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmSearch") |
| | | { |
| | | return OnRetrieve(0); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnCombboChanged(ref TCommandEvent evt, int lParam) |
| | | { |
| | | xstring id = L""; |
| | | xstring name = L""; |
| | | int h = xcombobox::GetCurSel(evt.hCtrl); |
| | | if (h > -1) |
| | | { |
| | | xstring txt = xcombobox::GetLBText(evt.hCtrl, h); |
| | | if (txt == L"éå®å®¢æ·") |
| | | { |
| | | OnRetrieve(1); |
| | | } |
| | | else if (txt == L"ä¸éå®å®¢æ·") |
| | | { |
| | | OnRetrieve(0); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDoubleClicked(TEvent* evt, int p) |
| | | { |
| | | dw_unexch.AcceptText(); |
| | | int row = dw_unexch.GetRow(); |
| | | |
| | | int hCursor = xutil::SetCursorWait(); |
| | | double AdjustAmount = dw_unexch.GetItemDouble(row, L"AdjustAmount");//è°æ´æ° |
| | | double amted = dw_unexch.GetItemDouble(row, L"宿¶æ±éé¢");//徿¬¡ |
| | | double samt = dw_unexch.GetItemDouble(row, L"åºæ¶æ±éé¢");//åºæ¶æ±éé¢ |
| | | double amt = samt - amted - AdjustAmount; |
| | | if (dw_obj) |
| | | { |
| | | xstring val = dw_unexch.GetItemDouble(row, L"ExchAmt"); |
| | | if (IsNoEmptyValue(val)) |
| | | { |
| | | dw_unexch.ItemChangeTo(row, L"ExchAmt", L""); |
| | | } |
| | | double amt1 = dw_obj.GetItemDouble(dw_obj.GetRow(), L"BalanceAmt"); |
| | | |
| | | int v1 = (amt * 100.0).toString().toInt(); |
| | | int v2 = (amt1 * 100.0).toString().toInt(); |
| | | if (v2 > v1) |
| | | { |
| | | dw_unexch.ItemChangeTo(row, L"Amount", xstring(amt)); |
| | | //dw_unexch.ItemChangeTo(row,L"ExchAmt",amt.toString()); |
| | | } |
| | | else |
| | | { |
| | | dw_unexch.ItemChangeTo(row, L"Amount", dw_obj.GetItemString(dw_obj.GetRow(), L"BalanceAmt")); |
| | | //dw_unexch.ItemChangeTo(row,L"ExchAmt",dw_obj.GetItemString(dw_obj.GetRow(),L"BalanceAmt")); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //dw_unexch.ItemChangeTo(row,L"ExchAmt",amt.toString()); |
| | | dw_unexch.ItemChangeTo(row, L"Amount", xstring(amt)); |
| | | } |
| | | dw_unexch.Redraw(); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int evalExchAmt() |
| | | { |
| | | double amt = 0; |
| | | xstring currencyCode = dw_obj.GetItemString(dw_obj.GetRow(), L"CurrencyCode"); |
| | | for (int i = 1; i <= dw_list.GetRowCount(); i++) |
| | | { |
| | | double amt0 = dw_list.GetItemDouble(i, L"Amount"); |
| | | xstring currencyCode1 = dw_list.GetItemString(i, L"CurrencyCode"); |
| | | if (currencyCode == L"CNY" || currencyCode == L"RMB") |
| | | { |
| | | if (currencyCode1 == L"USD") amt0 = amt0 * dw_list.GetItemDouble(i, L"ExchRate"); |
| | | } |
| | | amt += amt0; |
| | | //amt += dw_list.GetItemDouble(i,L"BankDeduction"); |
| | | //amt += dw_list.GetItemDouble(i,L"ForeignBankDeduction"); |
| | | } |
| | | if (dw_obj) |
| | | { |
| | | dw_obj.SetItemDouble(dw_obj.GetRow(), L"SignAmt", amt); |
| | | double amt1 = dw_obj.GetItemDouble(dw_obj.GetRow(), L"Amount"); |
| | | double BalanceAmt = amt1 - amt; |
| | | dw_obj.SetItemDouble(dw_obj.GetRow(), L"BalanceAmt", BalanceAmt); |
| | | dw_obj.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int Found(xstring InvoiceNo) |
| | | { |
| | | for (int row = 1; row <= dw_list.GetRowCount(); row++) |
| | | { |
| | | if (dw_list.GetItemString(row, L"InvoiceNo") == InvoiceNo) return row; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int ChangedListData(xstring colname, int row, xstring value) |
| | | { |
| | | if (colname == L"ExchRate" || colname == L"AcctAmount" || colname == L"CustomerCapitalExpense" || colname == L"BankRMBDeduction" || colname == L"Amount" || colname == L"ExchAmt" || colname == L"BankDeduction" || colname == L"ForeignBankDeduction") |
| | | { |
| | | int crow = Found(dw_unexch.GetItemString(row, L"InvoiceNo")); |
| | | if (crow < 1) |
| | | { |
| | | crow = dw_list.InsertRow(0); |
| | | dw_list.SetItemString(crow, L"InvoiceNo", dw_unexch.GetItemString(row, L"InvoiceNo")); |
| | | dw_list.SetItemString(crow, L"SEItemID", publiccode::GetGuid()); |
| | | if (dw_obj) |
| | | { |
| | | if (dw_obj.GetRowCount() > 0) |
| | | dw_list.SetItemString(crow, L"SEID", dw_obj.GetGuid(dw_obj.GetRow())); |
| | | } |
| | | dw_list.SetItemString(crow, colname, value); |
| | | } |
| | | else |
| | | { |
| | | dw_list.SetItemString(crow, colname, value); |
| | | } |
| | | dw_list.Redraw(); |
| | | evalExchAmt(); |
| | | } |
| | | 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"ExchRate" || colname == L"BankDeduction" || colname == L"BankRMBDeduction" || colname == L"ForeignBankDeduction" || colname == L"ExchAmt" || colname == L"Amount" || colname == L"CustomerCapitalExpense") { |
| | | double ExchAmt = dw_unexch.GetItemDouble(row, L"ExchAmt"); |
| | | double Amt = dw_unexch.GetItemDouble(row, L"Amount"); |
| | | double BankDeduction = dw_unexch.GetItemDouble(row, L"BankDeduction"); |
| | | double ForeignBankDeduction = dw_unexch.GetItemDouble(row, L"ForeignBankDeduction"); |
| | | double CustomerCapitalExpense = dw_unexch.GetItemDouble(row, L"CustomerCapitalExpense"); |
| | | if (colname == L"BankDeduction" || colname == L"ForeignBankDeduction" || colname == L"ExchAmt" || colname == L"CustomerCapitalExpense") |
| | | { |
| | | dw_unexch.SetItemDouble(row, L"ExchAmt", Amt + BankDeduction + ForeignBankDeduction + CustomerCapitalExpense); |
| | | ChangedListData(L"ExchAmt", row, dw_unexch.GetItemString(row, L"ExchAmt")); |
| | | } |
| | | if (colname == L"Amount") |
| | | { |
| | | dw_unexch.SetItemDouble(row, L"ExchAmt", Amt + BankDeduction + ForeignBankDeduction + CustomerCapitalExpense); |
| | | ChangedListData(L"ExchAmt", row, dw_unexch.GetItemString(row, L"ExchAmt")); |
| | | } |
| | | |
| | | Amt = dw_unexch.GetItemDouble(row, L"Amount"); |
| | | double exchRate = dw_unexch.GetItemDouble(row, L"ExchRate"); |
| | | double rmbDeduction = dw_unexch.GetItemDouble(row, L"BankRMBDeduction"); |
| | | dw_unexch.ItemChangeTo(row, L"AcctAmount", xstring((Amt * exchRate /*- rmbDeduction*/))); |
| | | |
| | | //cala balance |
| | | double ttlamt = dw_unexch.GetItemDouble(row, L"åºæ¶æ±éé¢"); |
| | | double AdjustAmount = dw_unexch.GetItemDouble(row, L"AdjustAmount"); |
| | | ExchAmt = dw_unexch.GetItemDouble(row, L"ExchAmt"); |
| | | double ExchAmted = dw_unexch.GetItemDouble(row, L"宿¶æ±éé¢"); |
| | | dw_unexch.SetItemDouble(row, L"æªæ¶æ±éé¢", ttlamt - AdjustAmount - ExchAmt - ExchAmted); |
| | | |
| | | dw_unexch.Redraw(); |
| | | } |
| | | ChangedListData(colname, row, value); |
| | | |
| | | return 1; |
| | | |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&ExchangeSignFastWin::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | //AttachEvent(L"WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent(L"dw_unexch", L"DWV_DOUBLECLICKED", (FEvent)&ExchangeSignFastWin::OnDoubleClicked);//è¡åå» |
| | | AttachEvent(L"cbx_customer", L"CBN_SELCHANGE", (FEvent)&ExchangeSignFastWin::OnCombboChanged);//屿§ç»åæ¢listä¸åçæ°éåå |
| | | AttachEvent(L"dw_unexch", L"DWV_ITEMCHANGED", (FEvent)&ExchangeSignFastWin::OnItemChanged); |
| | | return 1; |
| | | |
| | | } |
| | | |
| | | xstring GetQueryArg() |
| | | { |
| | | dw_arg.AcceptText(); |
| | | xml x; |
| | | |
| | | dw_arg.DwUpdateAllTo(x); |
| | | return x.xml(); |
| | | } |
| | | |
| | | int OnRetrieve(int customer = 1) |
| | | { |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | int row = dw_obj.GetRow(); |
| | | if (row < 1) return 1; |
| | | xstring CustomerID = dw_obj.GetItemString(row, L"CustomerID"); |
| | | //alert(CustomerID); |
| | | xstring SEID = dw_obj.GetGuid(dw_obj.GetRow()); |
| | | |
| | | trace(L"+++L" + CustomerID + L"+++L" + SEID); |
| | | |
| | | arg.AddArg(L"CustomerID", CustomerID); |
| | | arg.AddArg(L"SEID", SEID); |
| | | |
| | | xstring path = L"/sale/data/AR/item/noexch/listwithcustomer"; |
| | | if (customer == 0) path = L"/sale/data/AR/item/noexch/list"; |
| | | |
| | | xstring path1 = L"/sale/data/AR/item/exch/listwithcustomer"; |
| | | if (customer == 0) path1 = L"/sale/data/AR/item/exch/list"; |
| | | |
| | | arg.AddArg(L"QueryTxt", GetControl(L"sle_search").GetText()); |
| | | arg.AddArg(L"QueryArg", GetQueryArg()); |
| | | trace(L"SEID+++L" + SEID + L"+++QueryTxt+++L" + GetControl(L"sle_search").GetText() + L"+++QueryArg+++L" + GetQueryArg()); |
| | | if (getUrl(path, arg.GetString(), x) != 1) |
| | | { |
| | | trace(L"é误信æ¯1=L" + xstring(x.text())); |
| | | xutil::RestoreCursor(hCursor); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_unexch.Retrieve(x); |
| | | dw_unexch.Redraw(); |
| | | } |
| | | |
| | | //trace(x.xml()); |
| | | if (getUrl(path1, arg.GetString(), x) != 1) |
| | | { |
| | | trace(L"é误信æ¯2=L" + xstring(x.text())); |
| | | xutil::RestoreCursor(hCursor); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/AR/template/unexch"); |
| | | dw_unexch = GetControl(L"dw_unexch"); |
| | | dw_unexch.openUrl(L"/sale/view/AR/template/unexch"); |
| | | |
| | | |
| | | dw_list.SetColumnState(L"SEID", false); |
| | | dw_list.SetColumnState(L"SEItemID", false); |
| | | |
| | | dw_unexch.SetColumnState(L"SEID", false); |
| | | dw_unexch.SetColumnState(L"SEItemID", false); |
| | | |
| | | dw_arg = GetControl(L"dw_arg"); |
| | | dw_arg.openUrl(L"/sale/view/AR/template/queryarg"); |
| | | dw_arg.SetColHeaderHeight(0); |
| | | dw_arg.SetRowSelectorWidth(0); |
| | | dw_arg.SetHScrollState(false); |
| | | dw_arg.SetVScrollState(false); |
| | | //dw_arg.SetItemString(1,L"DateType",L"æ¬å¹´"); |
| | | |
| | | /*xaserverarg arg = GetParam(); |
| | | xstring CustomerIDOne = arg.GetArgString(L"CustomerID"); |
| | | xstring SEIDOne = arg.GetArgString(L"SEID");*/ |
| | | if (GetWinParam())dw_obj = GetParam(); |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | //SetAgent(); |
| | | if (dw_obj)OnRetrieve(1); |
| | | |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) SettlementExchangeEdit : public xframe |
| | | { |
| | | public: |
| | | xdwtable dw_base; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | HWND hObject; |
| | | bool updated; |
| | | |
| | | public: |
| | | SettlementExchangeEdit(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static SettlementExchangeEdit* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | SettlementExchangeEdit* pWin = new SettlementExchangeEdit(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(bool dlg = true) |
| | | { |
| | | xml x; |
| | | |
| | | dw_base.AcceptText(); |
| | | dw_base.DwUpdateAllTo(x); |
| | | xaserverarg arg ; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | //alert(x.xml()); |
| | | if (xurl::get(L"/sale/data/AR/update", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_base.ResetUpdateStatus(); |
| | | dw_base.Redraw(); |
| | | updated = true; |
| | | if (dlg)alert(L"ä¿åæå!"); |
| | | |
| | | //SendMessage(hObject,0x401,L"xmSignEx:"+dw_base.GetGuid(1),0); |
| | | SendMessage(hObject, 0x401, (LPARAM)L"xmRefresh", 0); |
| | | //CloseWindow(); |
| | | } |
| | | else |
| | | { |
| | | alert(L"ä¿å失败!"); |
| | | return -1; |
| | | } |
| | | return 1; |
| | | } |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmClose") |
| | | { |
| | | if (updated) |
| | | SendMessage(hObject, 0x401, (LPARAM)L"xmRefresh", 0); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmSave") |
| | | { |
| | | OnSave(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmSign") |
| | | { |
| | | return OnSign(); |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | int OnSign() |
| | | { |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | |
| | | xml x; |
| | | |
| | | dw_base.AcceptText(); |
| | | dw_base.DwUpdateAllTo(x); |
| | | if (x.selectSingleNode(L"//*[@update.modify='1']")) |
| | | if (OnSave(false) == -1) return 1; |
| | | |
| | | if (dw_base.GetGuid(1) == L"") |
| | | { |
| | | alert(L"请å
ä¿åï¼å¨ç¾æ¶ï¼"); |
| | | return 1; |
| | | } |
| | | |
| | | OnRetrieve(dw_base.GetGuid(1)); |
| | | |
| | | if (dw_base.GetItemString(1, L"CustomerID") == L"") |
| | | { |
| | | alert(L"客æ·ä¸å
许æªç©ºï¼"); |
| | | return 1; |
| | | } |
| | | arg.AddArg(L"CustomerID", dw_base.GetItemString(1, L"CustomerID")); |
| | | arg.AddArg(L"SEID", dw_base.GetGuid(1)); |
| | | SendMessage(hObject, 0x401, L"xmSignEx:" + dw_base.GetGuid(1), 0); |
| | | return 1; |
| | | } |
| | | |
| | | int OnItemChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring colname = hdr.colname; |
| | | xstring value = hdr.data; |
| | | |
| | | xstring dwname = L"dw_base"; |
| | | |
| | | if (colname == L"Amount" || colname == L"ForeignBankDeduction" || colname == L"BankDeduction" || colname == L"BankRMBDeduction") |
| | | { |
| | | double Amount = dw_base.GetItemDouble(hdr.row, L"Amount"); |
| | | double ForeignBankDeduction = dw_base.GetItemDouble(hdr.row, L"ForeignBankDeduction"); |
| | | double BankDeduction = dw_base.GetItemDouble(hdr.row, L"BankDeduction"); |
| | | double CustomerCapitalExpense = dw_base.GetItemDouble(hdr.row, L"CustomerCapitalExpense"); |
| | | double PressureExchangeRate = dw_base.GetItemDouble(hdr.row, L"PressureExchangeRate"); |
| | | //double BankRMBDeduction = dw_base.GetItemDouble(hdr.row,L"BankRMBDeduction"); |
| | | dw_base.SetItemDouble(hdr.row, L"AmountEx", xdouble((Amount + ForeignBankDeduction + BankDeduction + CustomerCapitalExpense)).round(2)); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&SettlementExchangeEdit::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&SettlementExchangeEdit::OnSetFocus); |
| | | AttachEvent(L"dw_base", L"DWV_ITEMCHANGED", (FEvent)&SettlementExchangeEdit::OnItemChanged); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnRetrieve(xstring SettlementExchangeID) |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg ; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"SEID", SettlementExchangeID); |
| | | |
| | | if (getUrl(L"/sale/data/AR/se/getsebyid", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_base.Retrieve(x); |
| | | dw_base.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | int onload() |
| | | { |
| | | dw_base = GetControl(L"dw_base"); |
| | | dw_base.openUrl(L"/sale/view/AR/template/SEMaint"); |
| | | dw_base.SetColHeaderHeight(0); |
| | | dw_base.SetRowSelectorWidth(0); |
| | | dw_base.SetHScrollState(false); |
| | | dw_base.SetVScrollState(false); |
| | | xstring SettlementExchangeID = L""; |
| | | hObject = 0; |
| | | if (GetWinParam()) |
| | | { |
| | | xaserverarg arg =GetArg(); |
| | | SettlementExchangeID = arg.GetArgString(L"SettlementExchangeID"); |
| | | hObject = arg.GetArgString(L"HWND").toInt(); |
| | | } |
| | | if (SettlementExchangeID != L"") |
| | | { |
| | | //alert(SettlementExchangeID); |
| | | OnRetrieve(SettlementExchangeID); |
| | | } |
| | | else |
| | | { |
| | | xstring suserid = publiccode::GetUser().id; |
| | | xstring susername = publiccode::GetUser().name; |
| | | xstring sdate = publiccode::GetCurrentDate(); |
| | | dw_base.SetItemString(1, L"SEDate", sdate); |
| | | dw_base.SetItemString(1, L"CreateDate", sdate); |
| | | dw_base.SetItemString(1, L"CurrencyCode", L"USD"); |
| | | dw_base.SetItemString(1, L"CreatorID", suserid); |
| | | dw_base.SetItemDisplayString(1, L"CreatorID", susername); |
| | | } |
| | | OnAttachEvent(); |
| | | updated = false; |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&BlankExcelTemplateView::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&BlankExcelTemplateView::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | /*//å è½½æ°æ® |
| | |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&ViewManpowerFileList::OnSetFocus); |
| | | AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&ViewManpowerFileList::OnDoubleClicked);//è¡åå» |
| | | AttachEvent(L"tv_folder", L"TVN_SELCHANGED", (FEvent)&ViewManpowerFileList::OnTreeSelChanged); //æ éæ© |
| | | return 1; |
| | | } |
| | | |
| | | //æ°æ®ä¼ è¾å½æ° |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <xcontrol/xcell.hpp> |
| | | |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) GroupManagerList : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | xtreeview tv_folder; |
| | | public: |
| | | GroupManagerList(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static GroupManagerList* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | GroupManagerList* pWin = new GroupManagerList(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 createSubTree(int wid, HTREEITEM h, KXMLDOMElement ele) |
| | | { |
| | | |
| | | KXMLDOMNodeList nlist = ele.selectNodes(L"item"); |
| | | int i; |
| | | int s = nlist.length(); |
| | | if (s > 0) |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | |
| | | KXMLDOMElement& e = *new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e.selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = xtreeview::InsertChildItem(wid, h, name,(LPARAM)&e , 15); |
| | | createSubTree(wid, hw, e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree() |
| | | { |
| | | int wid = tv_folder.GetId(); |
| | | while (xtreeview::GetRootItem(wid) > 0) |
| | | xtreeview::DeleteItem(wid, xtreeview::GetRootItem(wid)); |
| | | |
| | | xml x; |
| | | x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | if (xurl::get(L"/sale/data/UserGroup/tree", L"", x) != 1) |
| | | { |
| | | alert(x.text()); |
| | | return -1; |
| | | } |
| | | |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"root/item"); |
| | | int len = nlist.length(); |
| | | if (len > 0) |
| | | { |
| | | int i; |
| | | for (i = 0; i < len; i++) |
| | | { |
| | | KXMLDOMElement& e = *new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e.selectSingleNode(L"@name").text(); |
| | | HTREEITEM h = xtreeview::InsertChildItem(wid, 0, name, name, (LPARAM)&e, 15); |
| | | createSubTree(wid, h, e); |
| | | xtreeview::ExpandItem(wid, h); |
| | | } |
| | | xtreeview::ExpandItem(wid, 0); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //æ éæ© |
| | | int OnTreeSelChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM hItem = nmtv.itemNew.hItem; |
| | | |
| | | KXMLDOMElement e = xtreeview::GetItemData(tv_folder.GetId(), sItem); |
| | | xstring UserGroupID = e.selectSingleNode(L"@guid").text(); |
| | | OnRetrieve(UserGroupID); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmAdd") |
| | | { |
| | | OpenWindow(L"dev:xpage[UserGroupMaint.vx]", 0); |
| | | return 1; |
| | | } |
| | | if (comdid == L"xmSave") |
| | | { |
| | | return OnSave(); |
| | | } |
| | | if (comdid == L"xmMemberAdd") |
| | | { |
| | | HTREEITEM hItem = tv_folder.GetSelectedItem(); |
| | | if (hItem < 0) return 1; |
| | | KXMLDOMElement e = tv_folder.GetItemData(hItem); |
| | | |
| | | xaserverarg arg; |
| | | |
| | | |
| | | OpenWindow(L"dev:xpage[UserGroupPersonSelect.vx]", arg); |
| | | if (arg.GetArgString(L"comdid") == L"xmOk") |
| | | { |
| | | |
| | | xstring data = arg.GetArgString(L"data"); |
| | | xml x; |
| | | |
| | | x.loadXML(data); |
| | | KXMLDOMNodeList nodes = x.selectNodes(L"/root/item"); |
| | | int len = nodes.length(); |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | dw_list.InsertRow(0); |
| | | int row = dw_list.GetRowCount(); |
| | | KXMLDOMElement ele = nodes.item(i); |
| | | dw_list.SetItemString(row, L"No", ele.getAttribute(L"No")); |
| | | dw_list.SetItemString(row, L"Name", ele.getAttribute(L"Name")); |
| | | dw_list.SetItemString(row, L"PersonID", ele.getAttribute(L"PersonID")); |
| | | dw_list.SetItemString(row, L"UserGroupID", e.getAttribute(L"guid")); |
| | | } |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml x; |
| | | |
| | | dw_list.DwUpdateAllToEx(x); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | |
| | | if (xurl::get(L"/sale/data/UserGroup/update", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | alert(x.xml()); |
| | | dw_list.ResetUpdateStatus(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&GroupManagerList::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&GroupManagerList::OnSetFocus); |
| | | AttachEvent(L"tv_folder", L"TVN_SELCHANGED", (FEvent)&GroupManagerList::OnTreeSelChanged); //æ éæ© |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnRetrieve(xstring UserGroupID) |
| | | { |
| | | dw_list.Reset(); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"UserGroupID", UserGroupID); |
| | | if (getUrl(L"/sale/data/UserGroup/member", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/UserGroup/template/member"); |
| | | tv_folder = GetControl(L"tv_folder"); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.SetColumnState(L"UserGroupID", false); |
| | | dw_list.SetColumnState(L"PersonID", false); |
| | | |
| | | OnCreateTree(); |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) SupplierUserGroupPersonSelect : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_sTxt; |
| | | public: |
| | | SupplierUserGroupPersonSelect(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static SupplierUserGroupPersonSelect* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | SupplierUserGroupPersonSelect* pWin = new SupplierUserGroupPersonSelect(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 OnRetrieve() |
| | | { |
| | | xcontrol xc = GetControl(L"QueryTxt"); |
| | | m_sTxt = xc.GetText() + L""; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sTxt", m_sTxt); |
| | | if (xurl::post(L"OrganizationStruct/Supplier.select.Person", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnOK() |
| | | { |
| | | xaserverarg arg = GetArg(); |
| | | arg.AddArg(L"comdid", L"xmOk"); |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | alert(L"è¯·éæ©äººå!"); |
| | | return 1; |
| | | } |
| | | |
| | | xstring str = L"<root>"; |
| | | while (row > 0 && row <= dw_list.GetRowCount()) |
| | | { |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xstring PersonID = e.selectSingleNode(L"PersonID").text() + xstring(L""); |
| | | xstring Name = e.selectSingleNode(L"Name").text() + xstring(L""); |
| | | xstring No = e.selectSingleNode(L"EmployeeNo").text() + xstring(L""); |
| | | str += L"<item PersonID='" + PersonID + L"' Name='" + Name + L"' No='" + No + L"'/>"; |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | str += L"</root>"; |
| | | arg.AddArg(L"data", str); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmOk") |
| | | OnOK(); |
| | | else if (comdid == L"query") |
| | | { |
| | | OnRetrieve(); |
| | | } |
| | | else if (comdid == L"xmCancel") |
| | | CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&SupplierUserGroupPersonSelect::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&SupplierUserGroupPersonSelect::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | //SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"ç»ç»æ¶æ.vface/template/HrEmployee/PersonSel"); |
| | | dw_list.SetSelectionMode(3); |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | OnInitial(); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) UserGroupMaintWin : public xframe |
| | | { |
| | | public: |
| | | xdwtable dw_detail; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | public: |
| | | UserGroupMaintWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static UserGroupMaintWin* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | UserGroupMaintWin* pWin = new UserGroupMaintWin(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; |
| | | |
| | | dw_detail.DwUpdateAllTo(x); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | |
| | | if (xurl::get(L"/sale/data/UserGroup/update", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_detail.ResetUpdateStatus(); |
| | | alert(L"ä¿åæå!"); |
| | | } |
| | | else |
| | | { |
| | | alert(L"ä¿å失败!"); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmCancel") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmSave") |
| | | { |
| | | OnSave(); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&UserGroupMaintWin::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&UserGroupMaintWin::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | /* |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | 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_detail = GetControl(L"dw_detail"); |
| | | dw_detail.openUrl(L"/sale/view/UserGroup/template/maint"); |
| | | |
| | | dw_detail.SetSelectionBorder(0); |
| | | dw_detail.SetColHeaderHeight(0); |
| | | dw_detail.SetRowSelectorWidth(0); |
| | | dw_detail.SetHScrollState(false); |
| | | dw_detail.SetVScrollState(false); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) UserGroupPersonSelectWin : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_sTxt; |
| | | public: |
| | | UserGroupPersonSelectWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static UserGroupPersonSelectWin* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | UserGroupPersonSelectWin* pWin = new UserGroupPersonSelectWin(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 OnRetrieve() |
| | | { |
| | | xcontrol xc = GetControl(L"QueryTxt"); |
| | | m_sTxt = xc.GetText() + L""; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sTxt", m_sTxt); |
| | | if (xurl::post(L"OrganizationStruct/select.Person", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnOK() |
| | | { |
| | | xaserverarg arg = GetArg(); |
| | | arg.AddArg(L"comdid", L"xmOk"); |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | alert(L"è¯·éæ©äººå!"); |
| | | return 1; |
| | | } |
| | | |
| | | xstring str = L"<root>"; |
| | | while (row > 0 && row <= dw_list.GetRowCount()) |
| | | { |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xstring PersonID = e.selectSingleNode(L"PersonID").text() + xstring(L""); |
| | | xstring Name = e.selectSingleNode(L"Name").text() + xstring(L""); |
| | | xstring No = e.selectSingleNode(L"EmployeeNo").text() + xstring(L""); |
| | | str += L"<item PersonID='" + PersonID + L"' Name='" + Name + L"' No='" + No + L"'/>"; |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | str += L"</root>"; |
| | | arg.AddArg(L"data", str); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmOk") |
| | | OnOK(); |
| | | else if (comdid == L"query") |
| | | { |
| | | OnRetrieve(); |
| | | } |
| | | else if (comdid == L"xmCancel") |
| | | CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&UserGroupPersonSelectWin::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&UserGroupPersonSelectWin::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | //SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"ç»ç»æ¶æ.vface/template/HrEmployee/PersonSel"); |
| | | dw_list.SetSelectionMode(3); |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | OnInitial(); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) UserGroupPersonSelectWinEx : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_sTxt; |
| | | public: |
| | | UserGroupPersonSelectWinEx(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static UserGroupPersonSelectWinEx* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | UserGroupPersonSelectWinEx* pWin = new UserGroupPersonSelectWinEx(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 OnRetrieve() |
| | | { |
| | | xcontrol xc = GetControl(L"QueryTxt"); |
| | | m_sTxt = xc.GetText() + L""; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sTxt", m_sTxt); |
| | | if (xurl::post(L"OrganizationStruct/select.PersonEx", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnOK() |
| | | { |
| | | xaserverarg arg = GetArg(); |
| | | arg.AddArg(L"comdid", L"xmOk"); |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | alert(L"è¯·éæ©äººå!"); |
| | | return 1; |
| | | } |
| | | |
| | | xstring str = L"<root>"; |
| | | while (row > 0 && row <= dw_list.GetRowCount()) |
| | | { |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xstring PersonID = e.selectSingleNode(L"PersonID").text() + xstring(L""); |
| | | xstring Name = e.selectSingleNode(L"Name").text() + xstring(L""); |
| | | xstring No = e.selectSingleNode(L"EmployeeNo").text() + xstring(L""); |
| | | str += L"<item PersonID='" + PersonID + L"' Name='" + Name + L"' No='" + No + L"'/>"; |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | str += L"</root>"; |
| | | arg.AddArg(L"data", str); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmOk") |
| | | OnOK(); |
| | | else if (comdid == L"query") |
| | | { |
| | | OnRetrieve(); |
| | | } |
| | | else if (comdid == L"xmCancel") |
| | | CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&UserGroupPersonSelectWinEx::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&UserGroupPersonSelectWinEx::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | //SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"ç»ç»æ¶æ.vface/template/HrEmployee/PersonSel"); |
| | | dw_list.SetSelectionMode(3); |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | OnInitial(); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) UserGroupSelectWin : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_sTxt; |
| | | public: |
| | | UserGroupSelectWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static UserGroupSelectWin* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | UserGroupSelectWin* pWin = new UserGroupSelectWin(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 OnRetrieve() |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | if (xurl::post(L"/sale/data/UserGroup/list", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnOK() |
| | | { |
| | | xaserverarg arg = GetArg(); |
| | | arg.AddArg(L"comdid", L"xmOk"); |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) |
| | | { |
| | | alert(L"è¯·éæ©å°ç»!"); |
| | | return 1; |
| | | } |
| | | |
| | | xstring str = L"<root>"; |
| | | while (row > 0 && row <= dw_list.GetRowCount()) |
| | | { |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xstring UserGroupID = e.selectSingleNode(L"@guid").text() + xstring(L""); |
| | | xstring Name = e.selectSingleNode(L"Name").text() + xstring(L""); |
| | | xstring No = e.selectSingleNode(L"NO").text() + xstring(L""); |
| | | str += L"<item UserGroupID='" + UserGroupID + xstring(L"' Name='") + Name + L"' NO='" + No + L"'/>"; |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | str += L"</root>"; |
| | | arg.AddArg(L"data", str); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmOk") |
| | | OnOK(); |
| | | else if (comdid == L"query") |
| | | { |
| | | OnRetrieve(); |
| | | } |
| | | else if (comdid == L"xmCancel") |
| | | CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&UserGroupSelectWin::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&UserGroupSelectWin::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/UserGroup/template/list"); |
| | | dw_list.SetSelectionMode(3); |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | OnInitial(); |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) UserGroupShareWin : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | public: |
| | | UserGroupShareWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static UserGroupShareWin* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | UserGroupShareWin* pWin = new UserGroupShareWin(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"xmClose") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | if (comdid == L"xmSave") |
| | | { |
| | | return OnSave(); |
| | | } |
| | | if (comdid == L"xmMemberAdd" || comdid == L"xmAdd") |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | xaserverarg parg = GetArg(); |
| | | if (comdid == L"xmMemberAdd") |
| | | OpenWindow(L"dev:xpage[UserGroupPersonSelect.vx]", arg); |
| | | else |
| | | OpenWindow(L"dev:xpage[UserGroupSelect.vx]", arg); |
| | | if (arg.GetArgString(L"comdid") == L"xmOk") |
| | | { |
| | | xstring data = arg.GetArgString(L"data"); |
| | | xml x; |
| | | |
| | | x.loadXML(data); |
| | | KXMLDOMNodeList nodes = x.selectNodes(L"/root/item"); |
| | | int len = nodes.length(); |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | dw_list.InsertRow(0); |
| | | int row = dw_list.GetRowCount(); |
| | | KXMLDOMElement ele = nodes.item(i); |
| | | |
| | | dw_list.SetItemString(row, L"No", ele.getAttribute(L"No")); |
| | | dw_list.SetItemString(row, L"Name", ele.getAttribute(L"Name")); |
| | | |
| | | if (comdid == L"xmMemberAdd") |
| | | { |
| | | dw_list.SetItemString(row, L"PersonID", ele.getAttribute(L"PersonID")); |
| | | } |
| | | else |
| | | dw_list.SetItemString(row, L"UserGroupID", ele.getAttribute(L"UserGroupID")); |
| | | |
| | | dw_list.SetItemString(row, L"EntityID", parg.GetArgString(L"EntityID")); |
| | | dw_list.SetItemString(row, L"EntityName", parg.GetArgString(L"EntityName")); |
| | | } |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | /* |
| | | if(comdid==L"xmAdd") |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | xaserverarg parg = GetParam(); |
| | | OpenWindow(L"dev:xpage[UserGroupSelect.vx]",cast(arg as int)); |
| | | if(arg.GetArgString(L"comdid")==L"xmOk") |
| | | { |
| | | |
| | | xstring data = arg.GetArgString(L"data"); |
| | | xml x; |
| | | |
| | | x.loadXML(data); |
| | | KXMLDOMNodeList nodes = x.selectNodes(L"/root/item"); |
| | | int len = nodes.length(); |
| | | for(int i=0;i<len; i++) |
| | | { |
| | | dw_list.InsertRow(0); |
| | | int row = dw_list.GetRowCount(); |
| | | KXMLDOMElement ele= nodes.item(i); |
| | | dw_list.SetItemString(row,L"NO",ele.getAttribute(L"NO")); |
| | | dw_list.SetItemString(row,L"Name",ele.getAttribute(L"Name")); |
| | | dw_list.SetItemString(row,L"UserGroupID",ele.getAttribute(L"UserGroupID")); |
| | | |
| | | dw_list.SetItemString(row,L"EntityID",parg.GetArgString(L"EntityID")); |
| | | dw_list.SetItemString(row,L"EntityName",parg.GetArgString(L"EntityName")); |
| | | } |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | }*/ |
| | | if (comdid == L"xmDelete") |
| | | { |
| | | dw_list.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&UserGroupShareWin::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&UserGroupShareWin::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | int Send(xstring PersonID, xstring CName, xstring NO, xstring EntityID) |
| | | { |
| | | xaserverarg arg1 = GetArg(); |
| | | xstring Name = arg1.GetArgString(L"EntityName"); |
| | | xstring Subject = Name + L"å·²å
񄧮[" + CName + L"]"; |
| | | xstring Category = Name + L"å
񄧮"; |
| | | xstring Content = L""; |
| | | |
| | | xml x = ViewObject::RetrieveData(L"/sale/data/business/message/getUserNO", L"PersonID", PersonID); |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"//data/Item"); |
| | | KXMLDOMElement xitem = nlist.item(0); |
| | | xstring Reciever = xitem.selectSingleNode(L"userno").text(); |
| | | xitem.Release(); |
| | | |
| | | /*alert(L"Category:"+Category + |
| | | "\r\nReciever:"+Reciever + L"\r\nNo:"+NO + L"\r\nEntityID:"+EntityID + L"Subject:"+Subject+ |
| | | "\r\nContent:"+Content); |
| | | */ |
| | | x = ViewObject::AddMessage(Category, Reciever, NO, EntityID, Subject, Content); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int SendNotice(xml content) |
| | | { |
| | | xaserverarg arg = GetArg(); |
| | | xstring CName = arg.GetArgString(L"EntityName"); |
| | | xstring EntityID = arg.GetArgString(L"EntityID"); |
| | | xstring EntityNo = arg.GetArgString(L"EntityNo"); |
| | | |
| | | KXMLDOMNodeList nlist = content.selectNodes(L"//root/item[@update.new='1']"); |
| | | int leng = nlist.length(); |
| | | for (int i = 0; i < leng; i++) |
| | | { |
| | | KXMLDOMElement xitem = nlist.item(i); |
| | | xstring PersonID = xitem.selectSingleNode(L"PersonID").text(); |
| | | xstring UserGroupID = xitem.selectSingleNode(L"UserGroupID").text(); |
| | | xstring NO = xitem.selectSingleNode(L"NO").text(); |
| | | |
| | | if (PersonID != L"") |
| | | { |
| | | Send(PersonID, CName, EntityNo, EntityID); |
| | | } |
| | | if (UserGroupID != L"") |
| | | { |
| | | xml x = ViewObject::RetrieveData(L"/sale/data/business/message/getPersonIDByGroup", L"UserGroupID", UserGroupID); |
| | | KXMLDOMNodeList nlist1 = x.selectNodes(L"//data/Item"); |
| | | for (int j = 0; j < nlist1.length(); j++) |
| | | { |
| | | KXMLDOMElement xitem1 = nlist1.item(j); |
| | | PersonID = xitem1.selectSingleNode(L"PersonID").text(); |
| | | Send(PersonID, CName, EntityNo, EntityID); |
| | | } |
| | | } |
| | | xitem.Release(); |
| | | //return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml xs; |
| | | |
| | | dw_list.DwUpdateAllToEx(xs); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"content", xs.xml()); |
| | | |
| | | xml x; |
| | | |
| | | if (xurl::get(L"/sale/data/UserGroup/update/entity", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_list.ResetUpdateStatus(); |
| | | xaserverarg arg_ = GetArg(); |
| | | if (arg_.GetArgString(L"notify") == L"1") SendNotice(xs);//åééç¥ |
| | | alert(L"ä¿åæå!"); |
| | | } |
| | | else |
| | | { |
| | | alert(L"ä¿å失败!"); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | xaserverarg parg = GetArg(); |
| | | arg.AddArg(L"EntityID", parg.GetArgString(L"EntityID")); |
| | | if (getUrl(L"/sale/data/UserGroup/entity/list", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/UserGroup/template/entityusergrouplist"); |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | dw_list.SetColumnState(L"UserGroupID", false); |
| | | dw_list.SetColumnState(L"EntityID", false); |
| | | dw_list.SetColumnState(L"EntityName", false); |
| | | dw_list.SetColumnState(L"PersonID", false); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | //SetAgent(); |
| | | if (GetWinParam()) |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) UserGroupShareExWin : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | public: |
| | | UserGroupShareExWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static UserGroupShareExWin* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | UserGroupShareExWin* pWin = new UserGroupShareExWin(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 OnOK() |
| | | { |
| | | xaserverarg arg = GetArg(); |
| | | arg.AddArg(L"process", L"ok"); |
| | | |
| | | xml x = xml::Make(); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | arg.AddArg(L"result", x.xml()); |
| | | x.Free(); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmCancel") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | if (comdid == L"xmOK") return OnOK(); |
| | | if (comdid == L"xmMemberAdd" || comdid == L"xmAdd") |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | xaserverarg parg = GetArg(); |
| | | if (comdid == L"xmMemberAdd") |
| | | OpenWindow(L"dev:xpage[UserGroupPersonSelect.vx]",arg); |
| | | else |
| | | OpenWindow(L"dev:xpage[UserGroupSelect.vx]", arg); |
| | | if (arg.GetArgString(L"comdid") == L"xmOk") |
| | | { |
| | | xstring data = arg.GetArgString(L"data"); |
| | | xml x; |
| | | |
| | | x.loadXML(data); |
| | | KXMLDOMNodeList nodes = x.selectNodes(L"/root/item"); |
| | | int len = nodes.length(); |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | dw_list.InsertRow(0); |
| | | int row = dw_list.GetRowCount(); |
| | | KXMLDOMElement ele = nodes.item(i); |
| | | |
| | | dw_list.SetItemString(row, L"Name", ele.getAttribute(L"Name")); |
| | | |
| | | if (comdid == L"xmMemberAdd") |
| | | { |
| | | dw_list.SetItemString(row, L"No", ele.getAttribute(L"No")); |
| | | dw_list.SetItemString(row, L"PersonID", ele.getAttribute(L"PersonID")); |
| | | } |
| | | else |
| | | { |
| | | xstring no = ele.getAttribute(L"NO"); |
| | | dw_list.SetItemString(row, L"No", L"[" + no + L"]"); |
| | | dw_list.SetItemString(row, L"UserGroupID", ele.getAttribute(L"UserGroupID")); |
| | | } |
| | | } |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | if (comdid == L"xmDelete") |
| | | { |
| | | dw_list.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&UserGroupShareExWin::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&UserGroupShareExWin::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/UserGroup/template/entityusergrouplist"); |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | dw_list.SetColumnState(L"UserGroupID", false); |
| | | dw_list.SetColumnState(L"EntityID", false); |
| | | dw_list.SetColumnState(L"EntityName", false); |
| | | dw_list.SetColumnState(L"PersonID", false); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | //SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | }; |
| | |
| | | class SearchDlg : public xframe |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) SearchDlg : public xframe |
| | | { |
| | | public: |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | xcontrol sle_1; |
| | | |
| | | public: |
| | | SearchDlg(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static SearchDlg* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | SearchDlg* pWin = new SearchDlg(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | if (m_agentNode) |
| | | { |
| | | SetAgentNodeContent (anode,m_agentNode); |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | //SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnOk() |
| | | { |
| | | if(GetParam()) |
| | | if (GetWinParam()) |
| | | { |
| | | xaserverarg arg = GetParam(); |
| | | arg.AddArg("text",GetControl("sl_search").GetText()); |
| | | xaserverarg arg = GetArg(); |
| | | arg.AddArg(L"text", GetControl(L"sl_search").GetText()); |
| | | CloseWindow(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if(comdid=="xmCancel") |
| | | if (comdid == L"xmCancel") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if(comdid=="xmOk") return OnOk(); |
| | | else if (comdid == L"xmOk") return OnOk(); |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&SearchDlg::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | sle_1 = GetControl("sl_search"); |
| | | int x = win32::GetWindowLong(sle_1.GetId(), -16); //GWL_STYLE |
| | | x = x+ 0x0008; |
| | | win32::SetWindowLong(sle_1.GetId(), -16,x);//sle_1æ¯ç¼è¾çªå£æ§ä»¶ |
| | | |
| | | OnAttachEvent(); |
| | | if(GetParam()) |
| | | { |
| | | xaserverarg arg = GetParam(); |
| | | GetControl("sl_search").SetText(arg.GetArgString("text")); |
| | | } |
| | | |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&SearchDlg::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | }; |
| | | |
| | | int onload() |
| | | { |
| | | sle_1 = GetControl(L"sl_search"); |
| | | int x = GetWindowLong(GetHWND(), -16); //GWL_STYLE |
| | | x = x + 0x0008; |
| | | SetWindowLong(GetHWND(), -16, x);//sle_1æ¯ç¼è¾çªå£æ§ä»¶ |
| | | |
| | | OnAttachEvent(); |
| | | if (GetWinParam()) |
| | | { |
| | | xaserverarg arg = GetArg(); |
| | | GetControl(L"sl_search").SetText(arg.GetArgString(L"text")); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | }; |
| | |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&ProductFetchNoWin::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&ProductFetchNoWin::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | /* |
| | |
| | | AttachEvent(L"dwc_list", L"DWV_CLICKED", (FEvent)&ProductSelectSOWin::OnDwcClicked); |
| | | |
| | | AttachEvent(L"dwc_list", L"DWV_DOUBLECLICKED", (FEvent)&ProductSelectSOWin::OnImport); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&DocSO3::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | //AttachEvent(L"WM_SETFOCUS",OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | /* |
| | |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&SelectItemSOWin::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&SelectItemSOWin::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) VATNotifyParse : public xframe |
| | | { |
| | | public: |
| | | xdwtable dw_base; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | public: |
| | | VATNotifyParse(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static VATNotifyParse* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | VATNotifyParse* pWin = new VATNotifyParse(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 OnOk() |
| | | { |
| | | |
| | | xaserverarg arg = GetArg(); |
| | | arg.AddArg(L"process", L"ok"); |
| | | arg.AddArg(L"Quantity", dw_base.GetItemString(1, L"Quantity")); |
| | | arg.AddArg(L"CustQuantity", dw_base.GetItemString(1, L"CustQuantity")); |
| | | arg.AddArg(L"Amount", dw_base.GetItemString(1, L"Amount")); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmOk") return OnOk(); |
| | | if (comdid == L"xmCancel") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&VATNotifyParse::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&VATNotifyParse::OnSetFocus); |
| | | return 1; |
| | | } |
| | | |
| | | /* |
| | | int OnRetrieve() |
| | | { |
| | | xml x ; |
| | | |
| | | 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_base.Retrieve(x); |
| | | //dw_base.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | */ |
| | | |
| | | int onload() |
| | | { |
| | | dw_base = GetControl(L"dw_base"); |
| | | dw_base.openUrl(L"/sale/view/VATNotify/template/VATNotify/ParseNumber"); |
| | | |
| | | dw_base.SetColHeaderHeight(0); |
| | | dw_base.SetRowSelectorWidth(0); |
| | | dw_base.SetHScrollState(false); |
| | | dw_base.SetVScrollState(false); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | //SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) listvatnotifyWin : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xdwpages dw_pages; |
| | | xdwtable dw_arg; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | int m_pageindex; |
| | | int m_pagenumber; |
| | | xstring m_QueryTxt; |
| | | xstring DatePicker; |
| | | |
| | | public: |
| | | listvatnotifyWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static listvatnotifyWin* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | listvatnotifyWin* pWin = new listvatnotifyWin(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDWClick(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring value = hdr.data; |
| | | xstring colname = hdr.colname; |
| | | int row = hdr.row; |
| | | |
| | | if (row < 1) return 1; |
| | | |
| | | xaserverarg arg; |
| | | if (colname == L"SONo") |
| | | { |
| | | xstring SONo = dw_list.GetItemString(row, colname); |
| | | ; |
| | | |
| | | arg.AddArg(L"EntityNo", SONo); |
| | | arg.AddArg(L"ReadOnly", L"true"); |
| | | OpenWindow(L"dev:xpage[base.maint.so.vx]", arg); |
| | | } |
| | | if (colname == L"InvoiceNo") |
| | | { |
| | | xstring InvoiceNo = dw_list.GetItemString(row, colname); |
| | | ; |
| | | |
| | | arg.AddArg(L"EntityNo", InvoiceNo); |
| | | arg.AddArg(L"ReadOnly", L"true"); |
| | | OpenWindow(L"dev:xpage[maintex.GDN3.vx]", arg); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnPrint() |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | arg.AddArg(L"EntityName", L"VATNotify"); |
| | | arg.AddArg(L"EntityID", L"", L""); |
| | | xstring InvoiceNo = dw_list.GetItemString(dw_list.GetRow(), L"NInvoiceNo"); |
| | | if (InvoiceNo == L"") InvoiceNo = dw_list.GetItemString(dw_list.GetRow(), L"InvoiceNo"); |
| | | |
| | | xstring NInvoiceNoEx = dw_list.GetItemString(dw_list.GetRow(), L"NInvoiceNo"); |
| | | xstring InvoiceNoEx = dw_list.GetItemString(dw_list.GetRow(), L"InvoiceNo"); |
| | | if (NInvoiceNoEx != InvoiceNoEx) |
| | | { |
| | | NInvoiceNoEx = InvoiceNoEx; |
| | | } |
| | | xstring SupplierID = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"); |
| | | arg.AddArg(L"EntityNo", InvoiceNo, L""); |
| | | arg.AddArg(L"EntityNoEx", NInvoiceNoEx, L""); |
| | | arg.AddArg(L"SupplierID", SupplierID); |
| | | arg.AddArg(L"VATNotifyID", L""); |
| | | trace(InvoiceNo + L"==1" + NInvoiceNoEx + L"==2" + SupplierID + L"==3" + dw_list.GetGuid(dw_list.GetRow())); |
| | | |
| | | openUrl(L"/sale/view/view.base/xpage/Template/PrintViewEx", &arg); |
| | | return 1; |
| | | } |
| | | |
| | | int OnPrintItem() |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | arg.AddArg(L"EntityName", L"VATNotify"); |
| | | arg.AddArg(L"EntityID", L"", L""); |
| | | xstring InvoiceNo = dw_list.GetItemString(dw_list.GetRow(), L"NInvoiceNo"); |
| | | if (InvoiceNo == L"") InvoiceNo = dw_list.GetItemString(dw_list.GetRow(), L"InvoiceNo"); |
| | | |
| | | xstring NInvoiceNoEx = dw_list.GetItemString(dw_list.GetRow(), L"NInvoiceNo"); |
| | | xstring InvoiceNoEx = dw_list.GetItemString(dw_list.GetRow(), L"InvoiceNo"); |
| | | if (NInvoiceNoEx != InvoiceNoEx) |
| | | { |
| | | NInvoiceNoEx = InvoiceNoEx; |
| | | } |
| | | xstring SupplierID = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"); |
| | | arg.AddArg(L"EntityNo", InvoiceNo, L""); |
| | | arg.AddArg(L"EntityNoEx", NInvoiceNoEx, L""); |
| | | arg.AddArg(L"SupplierID", SupplierID); |
| | | arg.AddArg(L"VATNotifyID", dw_list.GetGuid(dw_list.GetRow())); |
| | | trace(L"=====L" + InvoiceNo + L"=====L" + SupplierID + L"=====L" + dw_list.GetGuid(dw_list.GetRow())); |
| | | |
| | | openUrl(L"/sale/view/view.base/xpage/Template/PrintViewEx", &arg); |
| | | return 1; |
| | | } |
| | | |
| | | int OnOpen() { |
| | | int row = dw_list.GetRow(); |
| | | if (row < 1) return 0; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring entityid = ele.selectSingleNode(L"InvoiceNo").text(); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"invoiceno", entityid); |
| | | |
| | | OpenWindow(L"dev:xpage[simple.maint.vatnotify.vx]", arg); |
| | | return 1; |
| | | } |
| | | |
| | | int OnPapercardOpen() { |
| | | int row = dw_list.GetRow(); |
| | | if (row < 1) return 0; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring entityid = ele.selectSingleNode(L"InvoiceNo").text(); |
| | | xstring classifyID = ele.selectSingleNode(L"ClassifyID").text(); |
| | | xstring supplierID = ele.selectSingleNode(L"SupplierID").text(); |
| | | xstring cname = ele.selectSingleNode(L"CName").text(); |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"invoiceno", entityid); |
| | | arg.AddArg(L"ClassifyID", classifyID); |
| | | arg.AddArg(L"SupplierID", supplierID); |
| | | arg.AddArg(L"CName", cname); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.papercard.vatnotify.vx]", arg); |
| | | return 1; |
| | | } |
| | | |
| | | int OnModify() { |
| | | int row = dw_list.GetRow(); |
| | | if (row < 1) return 0; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring entityid = ele.selectSingleNode(L"InvoiceNo").text(); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"invoiceno", entityid); |
| | | |
| | | OpenWindow(L"dev:xpage[update.vatnotify.vx]", arg); |
| | | return 1; |
| | | } |
| | | |
| | | int Onfinish() { |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | if (dw_list.GetRow() < 1) return 1; |
| | | int row = dw_list.GetRow(); |
| | | xstring InvoiceNo = dw_list.GetItemString(row, L"InvoiceNo"); |
| | | int res = MessageBox(GetHWND(), L"æ¯å¦ç¡®è®¤å é¤" + InvoiceNo + L"çå¼ç¥¨éç¥?", L"æç¤º", 4); |
| | | if (res == 6) |
| | | { |
| | | xml x = ViewObject::RetrieveData(L"/sale/data/VATNotify/entity/delete", L"invoiceno", InvoiceNo); |
| | | if (!x) |
| | | { |
| | | alert(L"å é¤é误"); |
| | | return 1; |
| | | } |
| | | //dw_list.DeleteRow(row); |
| | | alert(x.text()); |
| | | OnRetrieve(DatePicker); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xm:import") { |
| | | OpenWindow(L"dev:xpage[import.vatnotify.vx]", 0); |
| | | } |
| | | if (comdid == L"action:bill.open") { |
| | | OnOpen(); |
| | | } |
| | | else if (comdid == L"xm:notify") { |
| | | OnOpen(); |
| | | } |
| | | else if (comdid == L"xm:papercardnotify") { |
| | | OnPapercardOpen(); |
| | | } |
| | | else if (comdid == L"xm:modify") { |
| | | OnModify(); |
| | | } |
| | | else if (comdid == L"xm:finish") { |
| | | Onfinish(); |
| | | } |
| | | else if (comdid == L"xm:ratecalc") { |
| | | |
| | | } |
| | | else if (comdid == L"find") |
| | | { |
| | | m_QueryTxt = GetControl(L"txt").GetText(); |
| | | return OnRetrieve(DatePicker); |
| | | } |
| | | else if (comdid == L"xmRefresh") |
| | | { |
| | | return OnRetrieve(DatePicker); |
| | | } |
| | | else if (comdid == L"xmDeleteRow") |
| | | { |
| | | return OnDeleteRow(); |
| | | } |
| | | else if (comdid == L"xmPrint") { |
| | | return OnPrint(); |
| | | } |
| | | else if (comdid == L"xmPrintItem") { |
| | | return OnPrintItem(); |
| | | } |
| | | else if (comdid == L"xmSaveAs") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&listvatnotifyWin::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&listvatnotifyWin::OnSetFocus); |
| | | AttachEvent(L"dw_list", L"DWV_CLICKED", (FEvent)&listvatnotifyWin::OnDWClick); |
| | | AttachEvent(L"cbx_state", L"CBN_SELCHANGE", (FEvent)&listvatnotifyWin::OnDatePicker); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDatePicker(TEvent* evt, int lParam) |
| | | { |
| | | |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | |
| | | int h = xcombobox::GetCurSel(evt.hCtrl); |
| | | if (h > -1) |
| | | { |
| | | xstring txt = xcombobox::GetLBText(evt.hCtrl, h); |
| | | if (txt == L"éç¥æ¥æ") |
| | | { |
| | | |
| | | DatePicker = L"NotifyDate"; |
| | | OnRetrieve(DatePicker); |
| | | } |
| | | else if (txt == L"åºè¿æ¥æ") |
| | | { |
| | | |
| | | DatePicker = L"ETD"; |
| | | OnRetrieve(DatePicker); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | xstring GetQueryArg() |
| | | { |
| | | dw_arg.AcceptText(); |
| | | xml x ; |
| | | |
| | | dw_arg.DwUpdateAllTo(x); |
| | | return x.xml(); |
| | | } |
| | | |
| | | int OnRetrieve(xstring DatePicker) |
| | | { |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"pageindex", xstring(m_pageindex)); |
| | | arg.AddArg(L"pagenumber", xstring(m_pagenumber)); |
| | | arg.AddArg(L"QueryTxt", m_QueryTxt); |
| | | arg.AddArg(L"QueryArg", GetQueryArg()); |
| | | arg.AddArg(L"DatePicker", DatePicker); |
| | | if (getUrl(L"/sale/data/VATNotify/entity/listOne", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | xutil::RestoreCursor(hCursor); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | //trace(x.xml); |
| | | KXMLDOMElement ele = x.documentElement(); |
| | | if (dw_pages.ptr_native_) |
| | | { |
| | | if (ele.selectSingleNode(L"@TotalPage")) |
| | | { |
| | | xstring s = ele.selectSingleNode(L"@TotalPage").text(); //æ»æ°é |
| | | dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | } |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR& h = *(PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h.cur; |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | m_pageindex = c; |
| | | OnRetrieve(DatePicker); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDoubleClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnCmdDispatch(L"action:bill.open"); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/VATNotify/template/VATNotify/list"); |
| | | dw_arg = GetControl(L"dw_arg"); |
| | | dw_arg.openUrl(L"/sale/view/AR/template/queryarg"); |
| | | dw_arg.SetColHeaderHeight(0); |
| | | dw_arg.SetRowSelectorWidth(0); |
| | | dw_arg.SetHScrollState(false); |
| | | dw_arg.SetVScrollState(false); |
| | | dw_arg.SetItemString(1, L"DateType", L"æ¬æ"); |
| | | //dw_arg.SetItemString(1,L"DateType",L""); |
| | | AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listvatnotifyWin::OnDoubleClicked);//è¡åå» |
| | | dw_pages = GetControl(L"pages"); |
| | | AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listvatnotifyWin::OnChangePages); |
| | | |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | m_pageindex = 1; |
| | | m_pagenumber = 10000; |
| | | m_QueryTxt = L""; |
| | | |
| | | //OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) maintpapercardvatnotifyWin : public xframe |
| | | { |
| | | public: |
| | | xdwtable dw_profit; |
| | | xdwtable dw_arg; |
| | | xdwgrid dw_item; |
| | | xdwgrid dw_fob; |
| | | xstring InvNo; |
| | | xstring CurInvNo; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | public: |
| | | maintpapercardvatnotifyWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static maintpapercardvatnotifyWin* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | maintpapercardvatnotifyWin* pWin = new maintpapercardvatnotifyWin(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 OnPrint() |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | arg.AddArg(L"EntityName", L"VATNotify", L""); |
| | | arg.AddArg(L"EntityID", L"", L""); |
| | | arg.AddArg(L"EntityNo", dw_item.GetItemString(1, L"InvoiceNo"), L""); |
| | | |
| | | openUrl(L"/sale/view/view.base/xpage/Template/PrintViewEx", &arg); |
| | | return 1; |
| | | } |
| | | |
| | | int OnPrintItem() |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | arg.AddArg(L"EntityName", L"VATNotify", L""); |
| | | arg.AddArg(L"EntityID", L"", L""); |
| | | arg.AddArg(L"EntityNo", dw_item.GetItemString(1, L"InvoiceNo"), L""); |
| | | |
| | | openUrl(L"/sale/view/view.base/xpage/Template/PrintViewEx", &arg); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | |
| | | int onebill() |
| | | { |
| | | if (!GetWinParam()) return 1; |
| | | |
| | | int ll_row = dw_item.GetNextSelectRow(1); |
| | | if (ll_row < 1) return 1; |
| | | |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBox(GetHWND(), L"确认å¼ç¥¨å?", L"æç¤º", MB_OKCANCEL); |
| | | if (ret != IDOK) return 1; |
| | | dw_item.AcceptText(); |
| | | |
| | | xaserverarg arg; |
| | | |
| | | int pArg = GetArg(); |
| | | |
| | | |
| | | xstring ls_dtlno = arg.GetArgString(L"invoiceno"); |
| | | RetrieveFob(ls_dtlno); |
| | | RetrieveProfit(ls_dtlno); |
| | | while (ll_row > 0 && ll_row <= dw_item.GetRowCount()) |
| | | { |
| | | dw_item.SetItemString(ll_row, L"NInvoiceNo", ls_dtlno); |
| | | xstring sdate = publiccode::GetCurrentDate(); |
| | | |
| | | dw_item.SetItemDisplayString(ll_row, L"NClassifyID", arg.GetArgString(L"CName")); |
| | | dw_item.SetItemString(ll_row, L"NClassifyID", arg.GetArgString(L"ClassifyID")); |
| | | |
| | | int ll_find = FobLookup(arg.GetArgString(L"ClassifyID")); |
| | | xstring qtyUnit1 = dw_fob.GetItemString(ll_find, L"CQtyUnit"); |
| | | dw_item.SetItemString(ll_row, L"CQtyUnit", qtyUnit1); |
| | | dw_item.SetItemString(ll_row, L"VATRefundRate", dw_fob.GetItemString(ll_find, L"VATRefundRate")); |
| | | |
| | | dw_item.SetItemString(ll_row, L"NotifyDate", sdate); |
| | | dw_item.ItemChangeTo(ll_row, L"NAmount", dw_item.GetItemString(ll_row, L"Amount")); |
| | | ll_row = dw_item.GetNextSelectRow(ll_row + 1); |
| | | } |
| | | dw_item.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int onebillno() { |
| | | /* |
| | | int ll_row = dw_item.GetNextSelectRow(1); |
| | | if(ll_row < 1) return 1; |
| | | |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = win32::MessageBox(GetHWND(),L"确认ä¸äºå¼ç¥¨å?",L"æç¤º",MB_OKCANCEL); |
| | | if(ret !=IDOK) return 1; |
| | | dw_item.AcceptText(); |
| | | |
| | | while(ll_row > 0 && ll_row <= dw_item.GetRowCount()) |
| | | { |
| | | xstring ls_dtlno = dw_item.GetItemString(ll_row,L"InvoiceNo"); |
| | | dw_item.SetItemString(ll_row,L"NInvoiceNo",L""); |
| | | dw_item.SetItemString(ll_row,L"NAmount",L""); |
| | | dw_item.SetItemString(ll_row,L"NotifyDate",L""); |
| | | dw_item.SetItemString(ll_row,L"NClassifyID",L""); |
| | | dw_item.SetItemString(ll_row,L"NName",L""); |
| | | dw_item.ItemChangeTo(ll_row,L"NAmount",dw_item.GetItemString(ll_row,L"")); |
| | | dw_item.ItemChangeTo(ll_row,L"NQuantity",dw_item.GetItemString(ll_row,L"")); |
| | | ll_row = dw_item.GetNextSelectRow(ll_row + 1); |
| | | } |
| | | dw_item.Redraw(); |
| | | */ |
| | | |
| | | int ll_row = dw_item.GetNextSelectRow(1); |
| | | if (ll_row < 1) return 1; |
| | | |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBox(GetHWND(), L"确认ä¸äºå¼ç¥¨å?", L"æç¤º", MB_OKCANCEL); |
| | | if (ret != IDOK) return 1; |
| | | dw_item.AcceptText(); |
| | | |
| | | while (ll_row > 0 && ll_row <= dw_item.GetRowCount()) |
| | | { |
| | | xstring ls_dtlno = dw_item.GetItemString(ll_row, L"InvoiceNo"); |
| | | dw_item.ItemChangeTo(ll_row, L"NAmount", dw_item.GetItemString(ll_row, L"")); |
| | | dw_item.ItemChangeTo(ll_row, L"NQuantity", dw_item.GetItemString(ll_row, L"")); |
| | | dw_item.SetItemString(ll_row, L"NotifyDate", L""); |
| | | dw_item.SetItemString(ll_row, L"NClassifyID", L""); |
| | | dw_item.SetItemString(ll_row, L"NName", L""); |
| | | dw_item.SetItemDisplayString(ll_row, L"NClassifyID", L""); |
| | | dw_item.SetItemString(ll_row, L"NInvoiceNo", L""); |
| | | ll_row = dw_item.GetNextSelectRow(ll_row + 1); |
| | | } |
| | | dw_item.Redraw(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int CalcRate() |
| | | { |
| | | for (int row = 1; row <= dw_fob.GetRowCount(); row++) |
| | | { |
| | | xstring InvoiceNo = dw_fob.GetItemString(row, L"InvoiceNo"); |
| | | xstring ClassifyID = dw_fob.GetItemString(row, L"ClassifyID"); |
| | | double sumAmt = GetSumAmount(InvoiceNo, ClassifyID); |
| | | double sumQty = GetSumQuantity(InvoiceNo, ClassifyID); |
| | | double fobAmt = dw_fob.GetItemDouble(row, L"FobAmt"); |
| | | double rate = sumAmt / fobAmt; |
| | | double LimitAmt = fobAmt * rate; |
| | | dw_fob.SetItemDouble(row, L"Rate", rate); |
| | | dw_fob.SetItemDouble(row, L"LimitAmt", LimitAmt); |
| | | dw_fob.SetItemDouble(row, L"RestAmt", LimitAmt - sumAmt); |
| | | } |
| | | RecalcProfitData(); |
| | | dw_fob.Redraw(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onimport() { |
| | | //OpenWindow(L"dev:xpage[import.vatnotify.vx]",0); |
| | | return 1; |
| | | } |
| | | |
| | | int OnFobItemChanged(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"Rate" || colname == L"FobAmt") |
| | | { |
| | | xstring InvoiceNo = dw_fob.GetItemString(row, L"InvoiceNo"); |
| | | xstring ClassifyID = dw_fob.GetItemString(row, L"ClassifyID"); |
| | | double sumAmt = GetSumAmount(InvoiceNo, ClassifyID); |
| | | double sumQty = GetSumQuantity(InvoiceNo, ClassifyID); |
| | | double fobAmt = dw_fob.GetItemDouble(row, L"FobAmt"); |
| | | double rate = dw_fob.GetItemDouble(row, L"Rate"); |
| | | double LimitAmt = fobAmt * rate; |
| | | dw_fob.SetItemDouble(row, L"LimitAmt", LimitAmt); |
| | | dw_fob.SetItemDouble(row, L"RestAmt", LimitAmt - sumAmt); |
| | | dw_fob.Redraw(); |
| | | RecalcProfitData(); |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnArgChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | xstring colname = hdr.colname; |
| | | xstring value = hdr.data; |
| | | int row = hdr.row; |
| | | xstring SupplierID = dw_arg.GetItemString(1, L"SupplierID"); |
| | | if (SupplierID != L"") |
| | | { |
| | | if (GetWinParam()) |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | int pArg = GetArg(); |
| | | |
| | | arg.AddArg(L"SupplierID", SupplierID); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | |
| | | 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; |
| | | xstring ClassifyID = dw_item.GetItemString(row, L"NClassifyID"); |
| | | if (ClassifyID == L"") ClassifyID = dw_item.GetItemString(row, L"ClassifyID"); |
| | | xstring InvoiceNo = dw_item.GetItemString(row, L"NInvoiceNo"); |
| | | if (InvoiceNo == L"") InvoiceNo = dw_item.GetItemString(row, L"InvoiceNo"); |
| | | int ll_find = FobLookup(ClassifyID); |
| | | if (colname == L"NAmount") |
| | | { |
| | | if (ll_find > 0) |
| | | { |
| | | xstring qtyUnit = dw_fob.GetItemString(ll_find, L"CQtyUnit"); |
| | | double limitAmt = dw_fob.GetItemDouble(ll_find, L"LimitAmt"); |
| | | double CQuantity = dw_fob.GetItemDouble(ll_find, L"CQuantity"); |
| | | double sumAmt = GetSumAmount(InvoiceNo, ClassifyID); |
| | | double amt = dw_item.GetItemDouble(row, L"NAmount"); |
| | | double qty = CQuantity * amt / limitAmt; |
| | | if (qtyUnit.trim() != L"åå
") |
| | | { |
| | | int d = xstring(qty).toInt(); |
| | | xstring s = xstring(d); |
| | | qty = s.toDouble(); |
| | | } |
| | | double restAmt = limitAmt - sumAmt; |
| | | dw_fob.SetItemDouble(ll_find, L"RestAmt", restAmt); |
| | | dw_item.ItemChangeTo(row, L"NQuantity", xstring(qty)); |
| | | dw_item.Redraw(); |
| | | dw_fob.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | else if (colname == L"NQuantity") |
| | | { |
| | | if (ll_find > 0) |
| | | { |
| | | double CQuantity1 = dw_fob.GetItemDouble(ll_find, L"CQuantity"); |
| | | double sumQty = GetSumQuantity(InvoiceNo, ClassifyID); |
| | | double restQuantity = CQuantity1 - sumQty; |
| | | dw_fob.SetItemDouble(ll_find, L"RestQty", restQuantity); |
| | | dw_fob.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | else if (colname == L"NInvoiceNo") |
| | | { |
| | | row = dw_item.GetRow(); |
| | | InvoiceNo = dw_item.GetItemString(row, L"NInvoiceNo"); |
| | | if (InvoiceNo == L"") InvoiceNo = dw_item.GetItemString(row, L"InvoiceNo"); |
| | | RetrieveFob(InvoiceNo); |
| | | RetrieveProfit(InvoiceNo); |
| | | return 1; |
| | | } |
| | | else if (colname == L"NClassifyID") |
| | | { |
| | | xstring NQuantity = dw_item.GetItemString(row, L"NQuantity"); |
| | | if (NQuantity != L"") dw_item.ItemChangeTo(row, L"NQuantity", NQuantity); |
| | | xstring NAmount = dw_item.GetItemString(row, L"NAmount"); |
| | | if (NAmount != L"") dw_item.ItemChangeTo(row, L"NAmount", NAmount); |
| | | xstring sdate = publiccode::GetCurrentDate(); |
| | | dw_item.SetItemString(row, L"NotifyDate", sdate); |
| | | |
| | | xstring qtyUnit1 = dw_fob.GetItemString(ll_find, L"CQtyUnit"); |
| | | dw_item.SetItemString(row, L"CQtyUnit", qtyUnit1); |
| | | dw_item.SetItemString(row, L"VATRefundRate", dw_fob.GetItemString(ll_find, L"VATRefundRate")); |
| | | dw_item.Redraw(); |
| | | return 1; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | double GetSumAmountExcept(xstring InvoiceNo, xstring ClassifyID, xstring InvoiceNoExcept) |
| | | { |
| | | xml x ; |
| | | |
| | | xaserverarg arg = ViewObject::MakeArg(); |
| | | arg.AddArg(L"ClassifyID", ClassifyID); |
| | | arg.AddArg(L"InvoiceNo", InvoiceNo); |
| | | arg.AddArg(L"InvoiceExcept", InvoiceNoExcept); |
| | | |
| | | if (xurl::get(L"/sale/data/VATNotify/entity/suminfo", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 0.0; |
| | | } |
| | | KXMLDOMNode n = x.selectSingleNode(L"data/Item/amt"); |
| | | if (!n) return 0.0; |
| | | xstring str = n.text(); |
| | | return str.toDouble(); |
| | | } |
| | | |
| | | double GetSumQuantityExcept(xstring InvoiceNo, xstring ClassifyID, xstring InvoiceNoExcept) |
| | | { |
| | | xml x ; |
| | | |
| | | xaserverarg arg = ViewObject::MakeArg(); |
| | | arg.AddArg(L"ClassifyID", ClassifyID); |
| | | arg.AddArg(L"InvoiceNo", InvoiceNo); |
| | | arg.AddArg(L"InvoiceExcept", InvoiceNoExcept); |
| | | |
| | | if (xurl::get(L"/sale/data/VATNotify/entity/suminfo", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 0.0; |
| | | } |
| | | KXMLDOMNode n = x.selectSingleNode(L"data/Item/qty"); |
| | | if (!n) return 0.0; |
| | | xstring str = n.text(); |
| | | return str.toDouble(); |
| | | } |
| | | |
| | | double GetSumAmount(xstring InvoiceNo, xstring ClassifyID) |
| | | { |
| | | double amt = 0; |
| | | xstring InvoiceNoExcept = dw_item.GetItemString(1, L"InvoiceNo"); |
| | | if (InvoiceNoExcept != L"") amt = GetSumAmountExcept(InvoiceNo, ClassifyID, InvoiceNoExcept); |
| | | |
| | | for (int ll_row = 1; ll_row <= dw_item.GetRowCount(); ll_row++) |
| | | { |
| | | xstring ls_dtlno = dw_item.GetItemString(ll_row, L"NInvoiceNo"); |
| | | if (ls_dtlno == L"") ls_dtlno = dw_item.GetItemString(ll_row, L"InvoiceNo"); |
| | | if (InvoiceNo == ls_dtlno) |
| | | { |
| | | xstring classifyID = dw_item.GetItemString(ll_row, L"NClassifyID"); |
| | | if (classifyID == L"") classifyID = dw_item.GetItemString(ll_row, L"ClassifyID"); |
| | | if (classifyID == ClassifyID) |
| | | amt += dw_item.GetItemDouble(ll_row, L"NAmount"); |
| | | } |
| | | } |
| | | return amt; |
| | | } |
| | | |
| | | double GetSumQuantity(xstring InvoiceNo, xstring ClassifyID) |
| | | { |
| | | double qty = 0; |
| | | xstring InvoiceNoExcept = dw_item.GetItemString(1, L"InvoiceNo"); |
| | | if (InvoiceNoExcept != L"") qty = GetSumQuantityExcept(InvoiceNo, ClassifyID, InvoiceNoExcept); |
| | | |
| | | for (int ll_row = 1; ll_row <= dw_item.GetRowCount(); ll_row++) |
| | | { |
| | | xstring ls_dtlno = dw_item.GetItemString(ll_row, L"NInvoiceNo"); |
| | | if (ls_dtlno == L"") ls_dtlno = dw_item.GetItemString(ll_row, L"InvoiceNo"); |
| | | if (InvoiceNo == ls_dtlno) |
| | | { |
| | | xstring classifyID = dw_item.GetItemString(ll_row, L"NClassifyID"); |
| | | if (classifyID == L"") classifyID = dw_item.GetItemString(ll_row, L"ClassifyID"); |
| | | if (classifyID == ClassifyID) |
| | | qty += dw_item.GetItemDouble(ll_row, L"NQuantity"); |
| | | } |
| | | } |
| | | return qty; |
| | | } |
| | | |
| | | int RecalcProfitData() |
| | | { |
| | | double fobAmt = GetSumFobAmt(); |
| | | double limitAmt = GetSumLimitAmount(); |
| | | double RefundAmt = GetSumRefund(); |
| | | double goodsAmt = limitAmt - RefundAmt; |
| | | double freight = dw_profit.GetItemDouble(1, L"Freight"); |
| | | double comm = dw_profit.GetItemDouble(1, L"Comm"); |
| | | double netAmount = fobAmt - freight - comm; |
| | | double exchCost = (limitAmt - RefundAmt) / fobAmt; |
| | | dw_profit.SetItemDouble(1, L"NetAmount", netAmount); |
| | | dw_profit.SetItemDouble(1, L"SaleAmount", fobAmt); |
| | | dw_profit.SetItemDouble(1, L"SaleCost", goodsAmt); |
| | | dw_profit.SetItemDouble(1, L"Drawback", RefundAmt); |
| | | dw_profit.SetItemDouble(1, L"ExchCost", exchCost); |
| | | dw_profit.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | double GetSumLimitAmount() |
| | | { |
| | | double amt = 0; |
| | | for (int ll_row = 1; ll_row <= dw_fob.GetRowCount(); ll_row++) |
| | | { |
| | | amt += dw_fob.GetItemDouble(ll_row, L"LimitAmt"); |
| | | } |
| | | return amt; |
| | | } |
| | | |
| | | double GetSumRefund() |
| | | { |
| | | double amt = 0; |
| | | for (int ll_row = 1; ll_row <= dw_fob.GetRowCount(); ll_row++) |
| | | { |
| | | double rate = dw_fob.GetItemDouble(ll_row, L"VATRate"); |
| | | double refundRate = dw_fob.GetItemDouble(ll_row, L"VATRefundRate"); |
| | | double d = dw_fob.GetItemDouble(ll_row, L"LimitAmt"); |
| | | double val = d / (100.0 + rate) * refundRate; |
| | | amt += val; |
| | | } |
| | | return amt; |
| | | } |
| | | |
| | | double GetSumFobAmt() |
| | | { |
| | | double amt = 0; |
| | | for (int ll_row = 1; ll_row <= dw_fob.GetRowCount(); ll_row++) |
| | | { |
| | | amt += dw_fob.GetItemDouble(ll_row, L"FobAmt"); |
| | | } |
| | | return amt; |
| | | } |
| | | |
| | | int FobLookup(xstring ClassifyID) |
| | | { |
| | | for (int ll_row = 1; ll_row <= dw_fob.GetRowCount(); ll_row++) |
| | | { |
| | | if (dw_fob.GetItemString(ll_row, L"ClassifyID") == ClassifyID) return ll_row; |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | int addother() { |
| | | return 1; |
| | | } |
| | | int deleteother() { |
| | | return 1; |
| | | } |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"save") { |
| | | return OnSave(); |
| | | } |
| | | else if (comdid == L"onebill") { |
| | | return onebill(); |
| | | } |
| | | else if (comdid == L"onebillno") { |
| | | return onebillno(); |
| | | } |
| | | else if (comdid == L"xmPrint") { |
| | | return OnPrint(); |
| | | } |
| | | else if (comdid == L"xmPrintItem") { |
| | | return OnPrintItem(); |
| | | } |
| | | else if (comdid == L"xmCalcRate") { |
| | | return CalcRate(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnRowChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | |
| | | xstring InvoiceNo = dw_item.GetItemString(row, L"NInvoiceNo"); |
| | | if (InvoiceNo == L"") InvoiceNo = dw_item.GetItemString(row, L"InvoiceNo"); |
| | | if (InvoiceNo != CurInvNo) |
| | | { |
| | | CurInvNo = InvoiceNo; |
| | | RetrieveFob(InvoiceNo); |
| | | RetrieveProfit(InvoiceNo); |
| | | RecalcProfitData(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml x ; |
| | | |
| | | dw_item.AcceptText(); |
| | | dw_item.DwUpdateAllToEx(x); |
| | | |
| | | xml x0 = ViewObject::MakeXml(); |
| | | x0.loadXML(L"<root/>"); |
| | | |
| | | KXMLDOMNodeList t = x.selectNodes(L"root/item[@update.modify]"); |
| | | KXMLDOMElement e1 = x0.documentElement(); |
| | | int len = t.length(); |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | e1.appendChild(t.item(i)); |
| | | } |
| | | xaserverarg arg = ViewObject::MakeArg(); |
| | | arg.AddArg(L"content", x0.xml()); |
| | | |
| | | //trace(x.xml); |
| | | //return 1; |
| | | if (xurl::get(L"/sale/data/VATNotify/base/update", arg.GetString(), x0) != 1) |
| | | { |
| | | xstring error = x0.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | xstring str = x0.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_item.ResetUpdateStatus(); |
| | | alert(L"ä¿åæå!"); |
| | | } |
| | | else |
| | | { |
| | | alert(L"ä¿å失败1!"); |
| | | return 1; |
| | | } |
| | | |
| | | dw_fob.AcceptText(); |
| | | xml x1 ; |
| | | |
| | | dw_fob.DwUpdateAllToEx(x1); |
| | | arg.AddArg(L"content", x1.xml()); |
| | | if (xurl::get(L"/sale/data/VATNotify/fob/update", arg.GetString(), x1) != 1) |
| | | { |
| | | xstring error1 = x1.text(); |
| | | alert(L"err:" + error1); |
| | | return 1; |
| | | } |
| | | str = x1.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_fob.ResetUpdateStatus(); |
| | | alert(L"ä¿åæå!"); |
| | | } |
| | | else |
| | | { |
| | | alert(L"ä¿å失败2!"); |
| | | return 1; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&maintpapercardvatnotifyWin::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&maintpapercardvatnotifyWin::OnSetFocus); |
| | | AttachEvent(L"dw_item", L"DWV_ITEMCHANGED", (FEvent)&maintpapercardvatnotifyWin::OnItemChanged); |
| | | AttachEvent(L"dw_arg", L"DWV_ITEMCHANGED", (FEvent)&maintpapercardvatnotifyWin::OnArgChanged); |
| | | AttachEvent(L"dw_fob", L"DWV_ITEMCHANGED", (FEvent)&maintpapercardvatnotifyWin::OnFobItemChanged); |
| | | AttachEvent(L"dw_item", L"DWV_ROWFOCUSCHANGED", (FEvent)&maintpapercardvatnotifyWin::OnRowChanged); |
| | | AttachEvent(L"dw_item", L"DWV_ASKDATA", (FEvent)&maintpapercardvatnotifyWin::OnAskDataItem); |
| | | return 1; |
| | | } |
| | | |
| | | int RetrieveFob(xstring InvoiceNo, bool start = false) |
| | | { |
| | | if (!start) |
| | | { |
| | | dw_fob.Filter(L"InvoiceNo", InvoiceNo); |
| | | dw_fob.Redraw(); |
| | | if (dw_fob.GetRowCount() > 0) return 1; |
| | | } |
| | | |
| | | //start = true; |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"invoiceno", InvoiceNo); |
| | | if (getUrl(L"/sale/data/VATNotify/entity/fob", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | //trace(x.xml); |
| | | if (start) |
| | | { |
| | | dw_fob.Retrieve(x); |
| | | dw_fob.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | xml x1 ; |
| | | |
| | | dw_fob.DwUpdateAllToEx(x1); |
| | | KXMLDOMElement docElement = x1.documentElement(); |
| | | if (docElement) |
| | | { |
| | | KXMLDOMNodeList lst = x.selectNodes(L"data/Item"); |
| | | int n = lst.length(); |
| | | for (int i = 0; i < n; i++) |
| | | { |
| | | KXMLDOMElement e = lst.item(i); |
| | | docElement.appendChild(e); |
| | | e.Release(); |
| | | } |
| | | docElement.Release(); |
| | | lst.Release(); |
| | | dw_fob.Retrieve(x1); |
| | | } |
| | | else |
| | | { |
| | | dw_fob.Retrieve(x); |
| | | } |
| | | dw_fob.Filter(L"InvoiceNo", InvoiceNo); |
| | | dw_fob.Redraw(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int RetrieveProfit(xstring InvoiceNo) |
| | | { |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"invoiceno", InvoiceNo); |
| | | if (getUrl(L"/sale/data/VATNotify/entity/profit", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_profit.Retrieve(x); |
| | | dw_profit.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | |
| | | if (GetWinParam()) |
| | | { |
| | | int pArg = GetArg(); |
| | | |
| | | } |
| | | else |
| | | return 1; |
| | | if (getUrl(L"/sale/data/VATNotify/entity/papercard", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_item.Retrieve(x); |
| | | dw_item.Redraw(); |
| | | dw_item.SetSelectionMode(3); |
| | | } |
| | | if (dw_item.GetRowCount() > 0) |
| | | { |
| | | //xstring InvoiceNo = dw_item.GetItemString(1,L"NInvoiceNo"); |
| | | //if(InvoiceNo==L"") InvoiceNo = dw_item.GetItemString(1,L"InvoiceNo"); |
| | | xstring InvoiceNo = arg.GetArgString(L"invoiceno"); |
| | | CurInvNo = InvoiceNo; |
| | | RetrieveFob(InvoiceNo); |
| | | RetrieveProfit(InvoiceNo); |
| | | RecalcProfitData(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //base AskData |
| | | int OnAskDataItem(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | xstring x = hdr.colname; |
| | | if (x == L"userInvoiceNo") //䏿 |
| | | { |
| | | xstring sInvoiceNo = dw_item.GetItemString(row, L"NInvoiceNo"); |
| | | hdr.data = sInvoiceNo; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_item = GetControl(L"dw_item"); |
| | | dw_item.openUrl(L"/sale/view/VATNotify/template/VATNotify/item"); |
| | | dw_item.SetColumnState(L"CName", false); |
| | | dw_item.SetColumnState(L"CreatorID", false); |
| | | dw_item.SetColumnState(L"CreateDate", false); |
| | | dw_item.SetColumnState(L"VATRate", false); |
| | | dw_item.SetColumnState(L"VATRefundRate", false); |
| | | dw_item.SetColumnState(L"IsFinish", false); |
| | | dw_item.SetColumnState(L"Type", false); |
| | | |
| | | dw_fob = GetControl(L"dw_fob"); |
| | | dw_fob.openUrl(L"/sale/view/VATNotify/template/VATNotify/fob"); |
| | | dw_profit = GetControl(L"dw_profit"); |
| | | dw_profit.openUrl(L"/sale/view/VATNotify/template/VATNotify/profit"); |
| | | dw_profit.SetColHeaderHeight(0); |
| | | dw_profit.SetRowSelectorWidth(0); |
| | | dw_profit.SetHScrollState(false); |
| | | dw_profit.SetVScrollState(false); |
| | | |
| | | InvNo = L""; |
| | | CurInvNo = L""; |
| | | xaserverarg arg; |
| | | |
| | | |
| | | if (GetWinParam()) |
| | | { |
| | | int pArg = GetArg(); |
| | | |
| | | InvNo = arg.GetArgString(L"invoiceno"); |
| | | SetWindowText(GetHWND(), InvNo); |
| | | } |
| | | CurInvNo = InvNo; |
| | | |
| | | dw_arg = GetControl(L"dw_arg"); |
| | | dw_arg.openUrl(L"/sale/view/VATNotify/template/VATNotify/PaperCardArg"); |
| | | dw_arg.SetColHeaderHeight(0); |
| | | dw_arg.SetRowSelectorWidth(0); |
| | | dw_arg.SetHScrollState(false); |
| | | dw_arg.SetVScrollState(false); |
| | | |
| | | OnRetrieve(); |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) simplemaintvatnotifyWin : public xframe |
| | | { |
| | | public: |
| | | xdwtable dw_profit; |
| | | xdwgrid dw_item; |
| | | xdwgrid dw_fob; |
| | | xstring InvNo; |
| | | xstring CurInvNo; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | public: |
| | | simplemaintvatnotifyWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static simplemaintvatnotifyWin* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | simplemaintvatnotifyWin* pWin = new simplemaintvatnotifyWin(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; |
| | | } |
| | | |
| | | xstring GetEntityData(int pr) |
| | | { |
| | | xml x ; |
| | | dw_item.AcceptText(); |
| | | dw_item.DwUpdateAllToEx(x); |
| | | return x.xml(); |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnPrint() |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | arg.AddArg(L"EntityName", L"VATNotify"); |
| | | arg.AddArg(L"EntityID", L"", L""); |
| | | xstring InvoiceNo = dw_item.GetItemString(dw_item.GetRow(), L"NInvoiceNo"); |
| | | if (InvoiceNo == L"") InvoiceNo = dw_item.GetItemString(dw_item.GetRow(), L"InvoiceNo"); |
| | | xstring SupplierID = dw_item.GetItemString(dw_item.GetRow(), L"SupplierID"); |
| | | arg.AddArg(L"EntityNo", InvoiceNo, L""); |
| | | arg.AddArg(L"SupplierID", SupplierID); |
| | | arg.AddArg(L"VATNotifyID", L""); |
| | | |
| | | openUrl(L"/sale/view/view.base/xpage/Template/PrintViewEx", &arg); |
| | | return 1; |
| | | } |
| | | |
| | | int OnPrintItem() |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | |
| | | arg.AddArg(L"EntityName", L"VATNotify", L""); |
| | | arg.AddArg(L"EntityID", L"", L""); |
| | | xstring InvoiceNo = dw_item.GetItemString(dw_item.GetRow(), L"NInvoiceNo"); |
| | | if (InvoiceNo == L"") InvoiceNo = dw_item.GetItemString(dw_item.GetRow(), L"InvoiceNo"); |
| | | xstring SupplierID = dw_item.GetItemString(dw_item.GetRow(), L"SupplierID"); |
| | | arg.AddArg(L"EntityNo", InvoiceNo, L""); |
| | | arg.AddArg(L"SupplierID", SupplierID); |
| | | arg.AddArg(L"VATNotifyID", dw_item.GetGuid(dw_item.GetRow())); |
| | | trace(InvoiceNo + L"====L" + dw_item.GetGuid(dw_item.GetRow())); |
| | | |
| | | openUrl(L"/sale/view/view.base/xpage/Template/PrintViewEx", &arg); |
| | | return 1; |
| | | } |
| | | |
| | | int allbill() { |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret =MessageBox(GetHWND(), L"å
¨æ°å¼ç¥¨?", L"æç¤º", MB_OKCANCEL); |
| | | if (ret != IDOK) return 1; |
| | | dw_item.AcceptText(); |
| | | for (int ll_row = 1; ll_row <= dw_item.GetRowCount(); ll_row++) |
| | | { |
| | | xstring ls_dtlno = dw_item.GetItemString(ll_row, L"InvoiceNo"); |
| | | dw_item.SetItemString(ll_row, L"NInvoiceNo", ls_dtlno); |
| | | dw_item.SetItemString(ll_row, L"NAmount", dw_item.GetItemString(ll_row, L"Amount")); |
| | | xstring sdate = publiccode::GetCurrentDate(); |
| | | dw_item.SetItemString(ll_row, L"NotifyDate", sdate); |
| | | dw_item.ItemChangeTo(ll_row, L"NAmount", dw_item.GetItemString(ll_row, L"Amount")); |
| | | } |
| | | dw_item.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int allbillno() { |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret =MessageBox(GetHWND(), L"å
¨æ°ä¸å¼ç¥¨?", L"æç¤º", MB_OKCANCEL); |
| | | if (ret != IDOK) return 1; |
| | | dw_item.AcceptText(); |
| | | for (int ll_row = 1; ll_row <= dw_item.GetRowCount(); ll_row++) |
| | | { |
| | | xstring ls_dtlno = dw_item.GetItemString(ll_row, L"InvoiceNo"); |
| | | dw_item.ItemChangeTo(ll_row, L"NAmount", dw_item.GetItemString(ll_row, L"")); |
| | | dw_item.ItemChangeTo(ll_row, L"NQuantity", dw_item.GetItemString(ll_row, L"")); |
| | | dw_item.SetItemString(ll_row, L"NQtyUnit", L""); |
| | | dw_item.SetItemString(ll_row, L"NotifyDate", L""); |
| | | dw_item.SetItemString(ll_row, L"NClassifyID", L""); |
| | | dw_item.SetItemDisplayString(ll_row, L"NClassifyID", L""); |
| | | dw_item.SetItemString(ll_row, L"NName", L""); |
| | | dw_item.SetItemString(ll_row, L"NInvoiceNo", L""); |
| | | } |
| | | dw_item.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int onebill() |
| | | { |
| | | int ll_row = dw_item.GetNextSelectRow(1); |
| | | if (ll_row < 1) return 1; |
| | | |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret =MessageBox(GetHWND(), L"确认å¼ç¥¨å?", L"æç¤º", MB_OKCANCEL); |
| | | if (ret != IDOK) return 1; |
| | | dw_item.AcceptText(); |
| | | |
| | | while (ll_row > 0 && ll_row <= dw_item.GetRowCount()) |
| | | { |
| | | xstring ls_dtlno = dw_item.GetItemString(ll_row, L"InvoiceNo"); |
| | | dw_item.SetItemString(ll_row, L"NInvoiceNo", ls_dtlno); |
| | | //dw_item.SetItemString(ll_row,L"NAmount",dw_item.GetItemString(ll_row,L"Amount")); |
| | | xstring sdate = publiccode::GetCurrentDate(); |
| | | dw_item.SetItemString(ll_row, L"NotifyDate", sdate); |
| | | dw_item.ItemChangeTo(ll_row, L"NAmount", dw_item.GetItemString(ll_row, L"Amount")); |
| | | ll_row = dw_item.GetNextSelectRow(ll_row + 1); |
| | | } |
| | | |
| | | dw_item.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int onebillno() { |
| | | int ll_row = dw_item.GetNextSelectRow(1); |
| | | if (ll_row < 1) return 1; |
| | | |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBox(GetHWND(), L"确认ä¸äºå¼ç¥¨å?", L"æç¤º", MB_OKCANCEL); |
| | | if (ret != IDOK) return 1; |
| | | dw_item.AcceptText(); |
| | | |
| | | while (ll_row > 0 && ll_row <= dw_item.GetRowCount()) |
| | | { |
| | | xstring ls_dtlno = dw_item.GetItemString(ll_row, L"InvoiceNo"); |
| | | dw_item.ItemChangeTo(ll_row, L"NAmount", dw_item.GetItemString(ll_row, L"")); |
| | | dw_item.ItemChangeTo(ll_row, L"NQuantity", dw_item.GetItemString(ll_row, L"")); |
| | | dw_item.SetItemString(ll_row, L"NotifyDate", L""); |
| | | dw_item.SetItemString(ll_row, L"NClassifyID", L""); |
| | | dw_item.SetItemDisplayString(ll_row, L"NClassifyID", L""); |
| | | dw_item.SetItemString(ll_row, L"NQtyUnit", L""); |
| | | dw_item.SetItemString(ll_row, L"NName", L""); |
| | | dw_item.SetItemString(ll_row, L"NInvoiceNo", L""); |
| | | ll_row = dw_item.GetNextSelectRow(ll_row + 1); |
| | | } |
| | | dw_item.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int CalcRate() |
| | | { |
| | | for (int row = 1; row <= dw_fob.GetRowCount(); row++) |
| | | { |
| | | xstring InvoiceNo = dw_fob.GetItemString(row, L"InvoiceNo"); |
| | | xstring ClassifyID = dw_fob.GetItemString(row, L"ClassifyID"); |
| | | double sumAmt = GetSumAmount(InvoiceNo, ClassifyID); |
| | | double sumQty = GetSumQuantity(InvoiceNo, ClassifyID); |
| | | double fobAmt = dw_fob.GetItemDouble(row, L"FobAmt"); |
| | | double rate = sumAmt / fobAmt; |
| | | double LimitAmt = fobAmt * rate; |
| | | dw_fob.SetItemDouble(row, L"Rate", rate); |
| | | dw_fob.SetItemDouble(row, L"LimitAmt", LimitAmt); |
| | | dw_fob.SetItemDouble(row, L"RestAmt", LimitAmt - sumAmt); |
| | | } |
| | | RecalcProfitData(); |
| | | dw_fob.Redraw(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onimport() { |
| | | //OpenWindow(L"dev:xpage[import.vatnotify.vx]",0); |
| | | return 1; |
| | | } |
| | | |
| | | int OnFobItemChanged(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"Rate" || colname == L"FobAmt") |
| | | { |
| | | xstring InvoiceNo = dw_fob.GetItemString(row, L"InvoiceNo"); |
| | | xstring ClassifyID = dw_fob.GetItemString(row, L"ClassifyID"); |
| | | double sumAmt = GetSumAmount(InvoiceNo, ClassifyID); |
| | | double sumQty = GetSumQuantity(InvoiceNo, ClassifyID); |
| | | double fobAmt = dw_fob.GetItemDouble(row, L"FobAmt"); |
| | | double rate = dw_fob.GetItemDouble(row, L"Rate"); |
| | | double LimitAmt = fobAmt * rate; |
| | | dw_fob.SetItemDouble(row, L"LimitAmt", LimitAmt); |
| | | dw_fob.SetItemDouble(row, L"RestAmt", LimitAmt - sumAmt); |
| | | dw_fob.Redraw(); |
| | | RecalcProfitData(); |
| | | return 1; |
| | | } |
| | | |
| | | 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; |
| | | xstring ClassifyID = dw_item.GetItemString(row, L"NClassifyID"); |
| | | if (ClassifyID == L"") ClassifyID = dw_item.GetItemString(row, L"ClassifyID"); |
| | | xstring InvoiceNo = dw_item.GetItemString(row, L"NInvoiceNo"); |
| | | if (InvoiceNo == L"") InvoiceNo = dw_item.GetItemString(row, L"InvoiceNo"); |
| | | int ll_find = FobLookup(ClassifyID); |
| | | |
| | | //trace(L"\r\n"+ ll_find.toString()+L":"+ ClassifyID); |
| | | |
| | | if (colname == L"NAmount") |
| | | { |
| | | if (ll_find > 0) |
| | | { |
| | | //xstring qtyUnit = dw_fob.GetItemString(ll_find,L"CQtyUnit"); |
| | | xstring qtyUnit = dw_fob.GetItemString(ll_find, L"QtyUnit"); |
| | | double limitAmt = dw_fob.GetItemDouble(ll_find, L"LimitAmt"); |
| | | double CQuantity = dw_fob.GetItemDouble(ll_find, L"CQuantity"); |
| | | double sumAmt = GetSumAmount(InvoiceNo, ClassifyID); |
| | | double amt = dw_item.GetItemDouble(row, L"NAmount"); |
| | | //double qty = CQuantity * amt /limitAmt; |
| | | double qty = dw_item.GetItemDouble(row, L"Quantity"); |
| | | if (qtyUnit.trim() != L"åå
") |
| | | { |
| | | int d = xstring(qty).toInt(); |
| | | xstring s = xstring(d); |
| | | qty = s.toDouble(); |
| | | } |
| | | else |
| | | { |
| | | dw_item.SetItemDouble(row, L"NQuantity", qty); |
| | | xstring sqty = dw_item.GetItemString(row, L"NQuantity"); |
| | | qty = sqty.toDouble(); |
| | | } |
| | | double restAmt = limitAmt - sumAmt; |
| | | dw_fob.SetItemDouble(ll_find, L"RestAmt", restAmt); |
| | | dw_item.ItemChangeTo(row, L"NQuantity", xstring(qty)); |
| | | dw_fob.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | else if (colname == L"NQuantity") |
| | | { |
| | | if (ll_find > 0) |
| | | { |
| | | double CQuantity1 = dw_fob.GetItemDouble(ll_find, L"CQuantity"); |
| | | double sumQty = GetSumQuantity(InvoiceNo, ClassifyID); |
| | | double restQuantity = CQuantity1 - sumQty; |
| | | dw_fob.SetItemDouble(ll_find, L"RestQty", restQuantity); |
| | | |
| | | xstring qtyUnit2 = dw_fob.GetItemString(ll_find, L"QtyUnit"); |
| | | dw_item.SetItemString(row, L"NQtyUnit", qtyUnit2); |
| | | |
| | | dw_fob.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | else if (colname == L"NInvoiceNo") |
| | | { |
| | | row = dw_item.GetRow(); |
| | | InvoiceNo = dw_item.GetItemString(row, L"NInvoiceNo"); |
| | | if (InvoiceNo == L"") InvoiceNo = dw_item.GetItemString(row, L"InvoiceNo"); |
| | | RetrieveFob(InvoiceNo); |
| | | RetrieveProfit(InvoiceNo); |
| | | return 1; |
| | | } |
| | | else if (colname == L"NClassifyID") |
| | | { |
| | | xstring NQuantity = dw_item.GetItemString(dw_item.GetRow(), L"NQuantity"); |
| | | if (NQuantity != L"") dw_item.ItemChangeTo(dw_item.GetRow(), L"NQuantity", NQuantity); |
| | | xstring NAmount = dw_item.GetItemString(dw_item.GetRow(), L"NAmount"); |
| | | if (NAmount != L"") dw_item.ItemChangeTo(dw_item.GetRow(), L"NAmount", NAmount); |
| | | xstring sdate = publiccode::GetCurrentDate(); |
| | | dw_item.SetItemString(dw_item.GetRow(), L"NotifyDate", sdate); |
| | | |
| | | //xstring qtyUnit1 = dw_fob.GetItemString(ll_find,L"CQtyUnit"); |
| | | xstring qtyUnit1 = dw_fob.GetItemString(ll_find, L"QtyUnit"); |
| | | dw_item.SetItemString(dw_item.GetRow(), L"NQtyUnit", qtyUnit1); |
| | | dw_item.SetItemString(dw_item.GetRow(), L"VATRefundRate", dw_fob.GetItemString(ll_find, L"VATRefundRate")); |
| | | dw_item.Redraw(); |
| | | |
| | | return 1; |
| | | } |
| | | /* |
| | | if dwo.name='notifycname' then |
| | | if trim(data)='' then |
| | | this.setItem(row,'notifycustid','') |
| | | else |
| | | //cwd |
| | | if pos(data,'"') > 0 then |
| | | ll_find = dw_3.find(L"cname='"+data+L"'",0,dw_3.rowCount()) |
| | | else |
| | | ll_find = dw_3.find('cname=L"'+data+'"',0,dw_3.rowCount()) |
| | | end if |
| | | //end |
| | | // ll_find = dw_3.find('cname=L"'+data+'"',0,dw_3.rowCount()) |
| | | if ll_find > 0 then |
| | | this.setItem(row,'notifycustid',dw_3.getItemString(ll_find,'custid')) |
| | | this.setItem(row,'custunit',dw_3.getItemString(ll_find,'custunit')) |
| | | |
| | | decimal ld_rate |
| | | ls_custid = dw_3.getItemString(ll_find,'custid') |
| | | select retax into :ld_rate from code_t_custom where code_s = :ls_custid; |
| | | this.setitem(row,'retax',ld_rate) |
| | | end if |
| | | end if |
| | | if not isnull(this.getItemDecimal(row,'notifybuyamt')) then |
| | | dwoex = this.object.notifybuyamt |
| | | this.event itemchanged(row,dwoex,xstring(this.getItemDecimal(row,'notifybuyamt'))) |
| | | end if |
| | | if not isnull(this.getItemDecimal(row,'notifycustqty')) then |
| | | dwoex = this.object.notifycustqty |
| | | this.event itemchanged(row,dwoex,xstring(this.getItemDecimal(row,'notifycustqty'))) |
| | | end if |
| | | dw_1.setitem( dw_1.getrow(), 'notifydate',today()) |
| | | */ |
| | | return 1; |
| | | } |
| | | |
| | | double GetSumAmountExcept(xstring InvoiceNo, xstring ClassifyID, xstring InvoiceNoExcept) |
| | | { |
| | | xml x ; |
| | | |
| | | xaserverarg arg = ViewObject::MakeArg(); |
| | | arg.AddArg(L"ClassifyID", ClassifyID); |
| | | arg.AddArg(L"InvoiceNo", InvoiceNo); |
| | | arg.AddArg(L"InvoiceExcept", InvoiceNoExcept); |
| | | |
| | | if (xurl::get(L"/sale/data/VATNotify/entity/suminfo", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 0.0; |
| | | } |
| | | KXMLDOMNode n = x.selectSingleNode(L"data/Item/amt"); |
| | | if (!n) return 0.0; |
| | | xstring str = n.text(); |
| | | return str.toDouble(); |
| | | } |
| | | |
| | | double GetSumQuantityExcept(xstring InvoiceNo, xstring ClassifyID, xstring InvoiceNoExcept) |
| | | { |
| | | xml x ; |
| | | |
| | | xaserverarg arg = ViewObject::MakeArg(); |
| | | arg.AddArg(L"ClassifyID", ClassifyID); |
| | | arg.AddArg(L"InvoiceNo", InvoiceNo); |
| | | arg.AddArg(L"InvoiceExcept", InvoiceNoExcept); |
| | | |
| | | if (xurl::get(L"/sale/data/VATNotify/entity/suminfo", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 0.0; |
| | | } |
| | | KXMLDOMNode n = x.selectSingleNode(L"data/Item/qty"); |
| | | if (!n) return 0.0; |
| | | xstring str = n.text(); |
| | | return str.toDouble(); |
| | | } |
| | | |
| | | double GetSumAmount(xstring InvoiceNo, xstring ClassifyID) |
| | | { |
| | | double amt = 0; |
| | | xstring InvoiceNoExcept = dw_item.GetItemString(1, L"InvoiceNo"); |
| | | if (InvoiceNoExcept != L"") amt = GetSumAmountExcept(InvoiceNo, ClassifyID, InvoiceNoExcept); |
| | | |
| | | for (int ll_row = 1; ll_row <= dw_item.GetRowCount(); ll_row++) |
| | | { |
| | | xstring ls_dtlno = dw_item.GetItemString(ll_row, L"NInvoiceNo"); |
| | | if (ls_dtlno == L"") ls_dtlno = dw_item.GetItemString(ll_row, L"InvoiceNo"); |
| | | if (InvoiceNo == ls_dtlno) |
| | | { |
| | | xstring classifyID = dw_item.GetItemString(ll_row, L"NClassifyID"); |
| | | if (classifyID == L"") classifyID = dw_item.GetItemString(ll_row, L"ClassifyID"); |
| | | if (classifyID == ClassifyID) |
| | | amt += dw_item.GetItemDouble(ll_row, L"NAmount"); |
| | | } |
| | | } |
| | | return amt; |
| | | } |
| | | |
| | | int RecalcProfitData() |
| | | { |
| | | double fobAmt = GetSumFobAmt(); |
| | | double limitAmt = GetSumLimitAmount(); |
| | | double RefundAmt = GetSumRefund(); |
| | | double goodsAmt = limitAmt - RefundAmt; |
| | | double freight = dw_profit.GetItemDouble(1, L"Freight"); |
| | | double comm = dw_profit.GetItemDouble(1, L"Comm"); |
| | | double netAmount = fobAmt - freight - comm; |
| | | double exchCost = (limitAmt - RefundAmt) / fobAmt; |
| | | dw_profit.SetItemDouble(1, L"NetAmount", netAmount); |
| | | dw_profit.SetItemDouble(1, L"SaleAmount", fobAmt); |
| | | dw_profit.SetItemDouble(1, L"SaleCost", goodsAmt); |
| | | dw_profit.SetItemDouble(1, L"Drawback", RefundAmt); |
| | | dw_profit.SetItemDouble(1, L"ExchCost", exchCost); |
| | | dw_profit.Redraw(); |
| | | return 1; |
| | | } |
| | | double GetSumLimitAmount() |
| | | { |
| | | double amt = 0; |
| | | for (int ll_row = 1; ll_row <= dw_fob.GetRowCount(); ll_row++) |
| | | { |
| | | amt += dw_fob.GetItemDouble(ll_row, L"LimitAmt"); |
| | | } |
| | | return amt; |
| | | } |
| | | double GetSumRefund() |
| | | { |
| | | double amt = 0; |
| | | for (int ll_row = 1; ll_row <= dw_fob.GetRowCount(); ll_row++) |
| | | { |
| | | double rate = dw_fob.GetItemDouble(ll_row, L"VATRate"); |
| | | double refundRate = dw_fob.GetItemDouble(ll_row, L"VATRefundRate"); |
| | | double d = dw_fob.GetItemDouble(ll_row, L"LimitAmt"); |
| | | double val = d / (100.0 + rate) * refundRate; |
| | | amt += val; |
| | | } |
| | | return amt; |
| | | } |
| | | double GetSumFobAmt() |
| | | { |
| | | double amt = 0; |
| | | for (int ll_row = 1; ll_row <= dw_fob.GetRowCount(); ll_row++) |
| | | { |
| | | amt += dw_fob.GetItemDouble(ll_row, L"FobAmt"); |
| | | } |
| | | return amt; |
| | | } |
| | | |
| | | double GetSumQuantity(xstring InvoiceNo, xstring ClassifyID) |
| | | { |
| | | double qty = 0; |
| | | xstring InvoiceNoExcept = dw_item.GetItemString(1, L"InvoiceNo"); |
| | | if (InvoiceNoExcept != L"") qty = GetSumQuantityExcept(InvoiceNo, ClassifyID, InvoiceNoExcept); |
| | | |
| | | for (int ll_row = 1; ll_row <= dw_item.GetRowCount(); ll_row++) |
| | | { |
| | | xstring ls_dtlno = dw_item.GetItemString(ll_row, L"NInvoiceNo"); |
| | | if (ls_dtlno == L"") ls_dtlno = dw_item.GetItemString(ll_row, L"InvoiceNo"); |
| | | if (InvoiceNo == ls_dtlno) |
| | | { |
| | | xstring classifyID = dw_item.GetItemString(ll_row, L"NClassifyID"); |
| | | if (classifyID == L"") classifyID = dw_item.GetItemString(ll_row, L"ClassifyID"); |
| | | if (classifyID == ClassifyID) |
| | | { |
| | | qty += dw_item.GetItemDouble(ll_row, L"NQuantity"); |
| | | } |
| | | } |
| | | } |
| | | return qty; |
| | | } |
| | | |
| | | int FobLookup(xstring ClassifyID) |
| | | { |
| | | for (int ll_row = 1; ll_row <= dw_fob.GetRowCount(); ll_row++) |
| | | { |
| | | if (dw_fob.GetItemString(ll_row, L"ClassifyID") == ClassifyID) return ll_row; |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | int addother() { |
| | | return 1; |
| | | } |
| | | int deleteother() { |
| | | return 1; |
| | | } |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"save") { |
| | | return OnSave(); |
| | | } |
| | | else if (comdid == L"xmParse") |
| | | return OnParse(); |
| | | else if (comdid == L"allbill") { |
| | | return allbill(); |
| | | } |
| | | else if (comdid == L"allbillno") { |
| | | return allbillno(); |
| | | } |
| | | else if (comdid == L"onebill") { |
| | | return onebill(); |
| | | } |
| | | else if (comdid == L"onebillno") { |
| | | return onebillno(); |
| | | } |
| | | else if (comdid == L"import") { |
| | | return onimport(); |
| | | } |
| | | else if (comdid == L"addother") { |
| | | return addother(); |
| | | } |
| | | else if (comdid == L"deleteother") { |
| | | return deleteother(); |
| | | } |
| | | else if (comdid == L"xmPrint") { |
| | | return OnPrint(); |
| | | } |
| | | else if (comdid == L"xmPrintItem") { |
| | | return OnPrintItem(); |
| | | } |
| | | else if (comdid == L"xmCalcRate") { |
| | | return CalcRate(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnRowChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | |
| | | xstring InvoiceNo = dw_item.GetItemString(row, L"NInvoiceNo"); |
| | | if (InvoiceNo == L"") InvoiceNo = dw_item.GetItemString(row, L"InvoiceNo"); |
| | | if (InvoiceNo != CurInvNo) |
| | | { |
| | | CurInvNo = InvoiceNo; |
| | | RetrieveFob(InvoiceNo); |
| | | RetrieveProfit(InvoiceNo); |
| | | RecalcProfitData(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnParse() |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | OpenWindow(L"dev:xpage[VATNotifyParse.vx]", arg); |
| | | if (arg.GetArgString(L"process") == L"ok") |
| | | { |
| | | int row = dw_item.GetRow(); |
| | | int row1 = dw_item.InsertRow(0); |
| | | dw_item.SetItemString(row1, L"SupplierID", dw_item.GetItemString(row, L"SupplierID")); |
| | | dw_item.SetItemDisplayString(row1, L"SupplierID", dw_item.GetItemDisplayString(row, L"SupplierID")); |
| | | dw_item.SetItemString(row1, L"Amount", arg.GetArgString(L"Amount")); |
| | | dw_item.SetItemString(row1, L"Quantity", arg.GetArgString(L"Quantity")); |
| | | dw_item.SetItemString(row1, L"CQuantity", arg.GetArgString(L"CustQuantity")); |
| | | dw_item.SetItemString(row1, L"ClassifyID", dw_item.GetItemString(row, L"ClassifyID")); |
| | | dw_item.SetItemDisplayString(row1, L"ClassifyID", dw_item.GetItemDisplayString(row, L"ClassifyID")); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml x ; |
| | | |
| | | dw_item.AcceptText(); |
| | | dw_item.DwUpdateAllToEx(x); |
| | | xaserverarg arg = ViewObject::MakeArg(); |
| | | arg.AddArg(L"content", x.xml()); |
| | | |
| | | |
| | | |
| | | //trace(x.xml); |
| | | //return 1; |
| | | if (xurl::get(L"/sale/data/VATNotify/base/update", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_item.ResetUpdateStatus(); |
| | | } |
| | | else |
| | | { |
| | | alert(L"ä¿å失败1!"); |
| | | return 1; |
| | | } |
| | | |
| | | dw_fob.AcceptText(); |
| | | xml x1 ; |
| | | |
| | | dw_fob.DwUpdateAllToEx(x1); |
| | | arg.AddArg(L"content", x1.xml()); |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | |
| | | /* |
| | | for(int ll_row=1; ll_row <= dw_fob.GetRowCount(); ll_row++) |
| | | { |
| | | xstring RestQty = dw_fob.GetItemString(ll_row,L"RestQty"); |
| | | //xstring ClassifyID=dw_fob.GetItemString(ll_row,L"CName"); |
| | | if(RestQty !=L"0.00" ){ |
| | | //xstring qty =RestQty; |
| | | int ret = win32::MessageBox(GetHWND(),L" åå¨ç»åæ°éä¸ä¸º0çç©å,确认ä¿åå?",L"æç¤º",MB_OKCANCEL); |
| | | if(ret !=IDOK) return 1; |
| | | } |
| | | } |
| | | */ |
| | | |
| | | |
| | | //return 0; |
| | | if (xurl::get(L"/sale/data/VATNotify/fob/update", arg.GetString(), x1) != 1) |
| | | { |
| | | xstring error1 = x1.text(); |
| | | alert(L"err:" + error1); |
| | | return 1; |
| | | } |
| | | str = x1.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_fob.ResetUpdateStatus(); |
| | | alert(L"ä¿åæå!"); |
| | | } |
| | | else |
| | | { |
| | | alert(L"ä¿å失败2!"); |
| | | return 1; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&simplemaintvatnotifyWin::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&simplemaintvatnotifyWin::OnSetFocus); |
| | | AttachEvent(L"dw_item", L"DWV_ITEMCHANGED", (FEvent)&simplemaintvatnotifyWin::OnItemChanged); |
| | | AttachEvent(L"dw_fob", L"DWV_ITEMCHANGED", (FEvent)&simplemaintvatnotifyWin::OnFobItemChanged); |
| | | AttachEvent(L"dw_item", L"DWV_ROWFOCUSCHANGED", (FEvent)&simplemaintvatnotifyWin::OnRowChanged); |
| | | AttachEvent(L"dw_item", L"DWV_ASKDATA", (FEvent)&simplemaintvatnotifyWin::OnAskDataItem); |
| | | AttachCloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | int RetrieveFob(xstring InvoiceNo, bool start = false) |
| | | { |
| | | if (!start) |
| | | { |
| | | dw_fob.Filter(L"InvoiceNo", InvoiceNo); |
| | | dw_fob.Redraw(); |
| | | if (dw_fob.GetRowCount() > 0) return 1; |
| | | } |
| | | |
| | | //start = true; |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"invoiceno", InvoiceNo); |
| | | if (getUrl(L"/sale/data/VATNotify/entity/fob", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | //trace(x.xml); |
| | | if (start) |
| | | { |
| | | dw_fob.Retrieve(x); |
| | | dw_fob.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | xml x1 ; |
| | | |
| | | dw_fob.DwUpdateAllToEx(x1); |
| | | KXMLDOMElement docElement = x1.documentElement(); |
| | | if (docElement) |
| | | { |
| | | KXMLDOMNodeList lst = x.selectNodes(L"data/Item"); |
| | | int n = lst.length(); |
| | | for (int i = 0; i < n; i++) |
| | | { |
| | | KXMLDOMElement e = lst.item(i); |
| | | docElement.appendChild(e); |
| | | e.Release(); |
| | | } |
| | | docElement.Release(); |
| | | lst.Release(); |
| | | dw_fob.Retrieve(x1); |
| | | } |
| | | else |
| | | { |
| | | dw_fob.Retrieve(x); |
| | | } |
| | | dw_fob.Filter(L"InvoiceNo", InvoiceNo); |
| | | dw_fob.Redraw(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int RetrieveProfit(xstring InvoiceNo) |
| | | { |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"invoiceno", InvoiceNo); |
| | | if (getUrl(L"/sale/data/VATNotify/entity/profit", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_profit.Retrieve(x); |
| | | dw_profit.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | |
| | | |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | |
| | | if (GetWinParam()) |
| | | { |
| | | int pArg = GetArg(); |
| | | |
| | | } |
| | | else |
| | | { |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | if (getUrl(L"/sale/data/VATNotify/entity/base", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | xutil::RestoreCursor(hCursor); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_item.Retrieve(x); |
| | | dw_item.Redraw(); |
| | | dw_item.SetSelectionMode(1); |
| | | } |
| | | if (dw_item.GetRowCount() > 0) |
| | | { |
| | | xstring InvoiceNo = dw_item.GetItemString(1, L"NInvoiceNo"); |
| | | if (InvoiceNo == L"") InvoiceNo = dw_item.GetItemString(1, L"InvoiceNo"); |
| | | CurInvNo = InvoiceNo; |
| | | RetrieveFob(InvoiceNo); |
| | | RetrieveProfit(InvoiceNo); |
| | | RecalcProfitData(); |
| | | } |
| | | |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | //base AskData |
| | | int OnAskDataItem(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | xstring x = hdr.colname; |
| | | if (x == L"userInvoiceNo") //䏿 |
| | | { |
| | | xstring sInvoiceNo = dw_item.GetItemString(row, L"NInvoiceNo"); |
| | | hdr.data = sInvoiceNo; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_item = GetControl(L"dw_item"); |
| | | dw_item.openUrl(L"/sale/view/VATNotify/template/VATNotify/item"); |
| | | dw_item.SetColumnState(L"InvoiceNo", false); |
| | | dw_item.SetColumnState(L"CName", false); |
| | | //dw_item.SetColumnState(L"CreatorID",false); |
| | | //dw_item.SetColumnState(L"CreateDate",false); |
| | | dw_item.SetColumnState(L"VATRate", false); |
| | | dw_item.SetColumnState(L"VATRefundRate", false); |
| | | dw_item.SetColumnState(L"IsFinish", false); |
| | | dw_item.SetColumnState(L"Type", false); |
| | | dw_item.SetColumnState(L"QtyUnitName", false); |
| | | dw_item.SetColumnState(L"QtyUnit", false); |
| | | dw_item.SetColumnState(L"CQtyUnit", false); |
| | | |
| | | dw_fob = GetControl(L"dw_fob"); |
| | | dw_fob.openUrl(L"/sale/view/VATNotify/template/VATNotify/fob"); |
| | | dw_profit = GetControl(L"dw_profit"); |
| | | dw_profit.openUrl(L"/sale/view/VATNotify/template/VATNotify/profit"); |
| | | dw_profit.SetColHeaderHeight(0); |
| | | dw_profit.SetRowSelectorWidth(0); |
| | | dw_profit.SetHScrollState(false); |
| | | dw_profit.SetVScrollState(false); |
| | | |
| | | InvNo = L""; |
| | | CurInvNo = L""; |
| | | xaserverarg arg; |
| | | |
| | | |
| | | if (GetWinParam()) |
| | | { |
| | | int pArg = GetArg(); |
| | | |
| | | InvNo = arg.GetArgString(L"invoiceno"); |
| | | SetWindowText(GetHWND(), InvNo); |
| | | } |
| | | CurInvNo = InvNo; |
| | | |
| | | OnRetrieve(); |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) UpdateVatNotifyWin : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | xdwgrid dw_item; |
| | | xdwgrid dw_goods; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | public: |
| | | UpdateVatNotifyWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static UpdateVatNotifyWin* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | UpdateVatNotifyWin* pWin = new UpdateVatNotifyWin(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 ; |
| | | |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x); |
| | | xaserverarg arg = ViewObject::MakeArg(); |
| | | arg.AddArg(L"content", x.xml()); |
| | | |
| | | trace(x.xml()); |
| | | //return 1; |
| | | if (xurl::get(L"/sale/data/VATNotify/base/update", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | xstring str = x.documentElement().getAttribute(L"text"); |
| | | if (str == L"true") |
| | | { |
| | | dw_list.ResetUpdateStatus(); |
| | | alert(L"ä¿åæå!"); |
| | | } |
| | | else |
| | | { |
| | | alert(L"ä¿å失败!"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmReplaceRow") |
| | | { |
| | | return OnReplaceRow(); |
| | | } |
| | | if (comdid == L"xmReplaceSupplier") |
| | | { |
| | | return OnReplaceSupplier(); |
| | | } |
| | | else if (comdid == L"xmAddRow") |
| | | { |
| | | return OnAddRow(); |
| | | } |
| | | else if (comdid == L"xmSave") |
| | | { |
| | | return OnSave(); |
| | | } |
| | | else if (comdid == L"xmDeleteRow") |
| | | { |
| | | return OnDeleteRow(); |
| | | } |
| | | if (comdid == L"xmClose") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | if (dw_list.GetRowCount() == dw_item.GetRowCount()) |
| | | { |
| | | int res = MessageBox(GetHWND(), L"ä½ å¯ä»¥ç¨æ¿æ¢å®æç¸åºçæä½ï¼è¿ç»§ç»å é¤å?", L"æç¤º", 4); |
| | | if (res != 6) return 1; |
| | | } |
| | | else |
| | | { |
| | | int res1 = MessageBox(GetHWND(), L"确认å é¤å¯¹åºçè¡?", L"æç¤º", 4); |
| | | if (res1 != 6) return 1; |
| | | } |
| | | dw_list.DeleteRow(0); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAddRow() |
| | | { |
| | | if (dw_item.GetRow() < 1) return 1; |
| | | int ll_row1 = dw_item.GetRow(); |
| | | dw_list.InsertRow(0); |
| | | int ll_row = dw_list.GetRowCount(); |
| | | |
| | | KXMLDOMElement e = dw_item.GetRowElement(ll_row1); |
| | | dw_list.SetItemString(ll_row, L"SupplierID", dw_item.GetItemString(ll_row1, L"SupplierID")); |
| | | dw_list.SetItemDisplayString(ll_row, L"SupplierID", dw_item.GetItemDisplayString(ll_row1, L"SupplierID")); |
| | | dw_list.SetItemString(ll_row, L"CQuantity", dw_item.GetItemString(ll_row1, L"CustQuantity")); |
| | | dw_list.SetItemString(ll_row, L"Amount", dw_item.GetItemString(ll_row1, L"Amount")); |
| | | dw_list.SetItemString(ll_row, L"ClassifyID", dw_item.GetItemString(ll_row1, L"ClassifyID")); |
| | | dw_list.SetItemDisplayString(ll_row, L"ClassifyID", dw_item.GetItemDisplayString(ll_row1, L"ClassifyID")); |
| | | dw_list.SetItemString(ll_row, L"CName", dw_item.GetItemDisplayString(ll_row1, L"ClassifyID")); |
| | | if (e.selectSingleNode(L"Quantity")) dw_list.SetItemString(ll_row, L"Quantity", e.selectSingleNode(L"Quantity").text()); |
| | | if (e.selectSingleNode(L"CreatorID")) dw_list.SetItemString(ll_row, L"CreatorID", e.selectSingleNode(L"CreatorID").text()); |
| | | if (e.selectSingleNode(L"CreateDate")) dw_list.SetItemString(ll_row, L"CreateDate", e.selectSingleNode(L"CreateDate").text()); |
| | | if (e.selectSingleNode(L"ModifierID")) dw_list.SetItemString(ll_row, L"ModifierID", e.selectSingleNode(L"ModifierID").text()); |
| | | if (e.selectSingleNode(L"ModifyDate")) dw_list.SetItemString(ll_row, L"ModifyDate", e.selectSingleNode(L"ModifyDate").text()); |
| | | if (e.selectSingleNode(L"VATRate")) dw_list.SetItemString(ll_row, L"VATRate", e.selectSingleNode(L"VATRate").text()); |
| | | if (e.selectSingleNode(L"VATRefundRate")) dw_list.SetItemString(ll_row, L"VATRefundRate", e.selectSingleNode(L"VATRefundRate").text()); |
| | | if (e.selectSingleNode(L"CustomUOM")) dw_list.SetItemString(ll_row, L"CQtyUnit", e.selectSingleNode(L"CustomUOM").text()); |
| | | if (e.selectSingleNode(L"IsFinish")) dw_list.SetItemString(ll_row, L"IsFinish", e.selectSingleNode(L"IsFinish").text()); |
| | | if (e.selectSingleNode(L"Type")) dw_list.SetItemString(ll_row, L"Type", e.selectSingleNode(L"Type").text()); |
| | | if (e.selectSingleNode(L"InvoiceNo")) dw_list.SetItemString(ll_row, L"InvoiceNo", e.selectSingleNode(L"InvoiceNo").text()); |
| | | dw_list.Redraw(); |
| | | dw_item.SetItemString(ll_row1, L"Relation", xstring(ll_row)); |
| | | dw_item.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnReplaceSupplier() |
| | | { |
| | | int ll_row = dw_list.GetRow(); |
| | | int ll_row1 = dw_item.GetRow(); |
| | | |
| | | if (ll_row < 1 || ll_row1 < 1) |
| | | { |
| | | alert(L"没ææä½!"); |
| | | return 1; |
| | | } |
| | | xstring SupplierID1 = dw_item.GetItemString(ll_row1, L"SupplierID"); |
| | | dw_list.SetItemString(ll_row, L"SupplierID", SupplierID1); |
| | | dw_list.SetItemDisplayString(ll_row, L"SupplierID", dw_item.GetItemDisplayString(ll_row1, L"SupplierID")); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnReplaceRow() |
| | | { |
| | | int ll_row = dw_list.GetRow(); |
| | | int ll_row1 = dw_item.GetRow(); |
| | | if (ll_row < 1 || ll_row1 < 1) |
| | | { |
| | | alert(L"没ææä½!"); |
| | | return 1; |
| | | } |
| | | |
| | | bool updateSupplier = false; |
| | | bool updatePrice = false; |
| | | bool updateClassifyID = false; |
| | | xstring SupplierID = dw_list.GetItemString(ll_row, L"SupplierID"); |
| | | xstring CQuantity = dw_list.GetItemString(ll_row, L"CQuantity"); |
| | | xstring Amount = dw_list.GetItemString(ll_row, L"Amount"); |
| | | xstring ClassifyID = dw_list.GetItemString(ll_row, L"ClassifyID"); |
| | | |
| | | xstring SupplierID1 = dw_item.GetItemString(ll_row1, L"SupplierID"); |
| | | xstring CQuantity1 = dw_item.GetItemString(ll_row1, L"CustQuantity"); |
| | | xstring Amount1 = dw_item.GetItemString(ll_row1, L"Amount"); |
| | | xstring ClassifyID1 = dw_item.GetItemString(ll_row1, L"ClassifyID"); |
| | | |
| | | if (SupplierID != SupplierID1) updateSupplier = true; |
| | | if (CQuantity != CQuantity1) updatePrice = true; |
| | | if (Amount != Amount1) updatePrice = true; |
| | | if (ClassifyID != ClassifyID1) updateClassifyID = true; |
| | | |
| | | if (updateSupplier && updatePrice && updateClassifyID) |
| | | { |
| | | int res = MessageBox(GetHWND(), L"ä¸ä¸æ°æ®æ¥å
³ååãä»·æ ¼ãå·¥åå
¨ä¸ä¸è´ï¼æ¯å¦è¦å¼ºå¶æ¿æ¢?", L"æç¤º", 4); |
| | | if (res != 6) return 1; |
| | | } |
| | | if (updateSupplier) |
| | | { |
| | | dw_list.SetItemString(ll_row, L"SupplierID", SupplierID1); |
| | | dw_list.SetItemDisplayString(ll_row, L"SupplierID", dw_item.GetItemDisplayString(ll_row1, L"SupplierID")); |
| | | } |
| | | if (updatePrice) |
| | | { |
| | | dw_list.SetItemString(ll_row, L"CQuantity", CQuantity1); |
| | | dw_list.SetItemString(ll_row, L"Amount", Amount1); |
| | | } |
| | | if (updateClassifyID) |
| | | { |
| | | dw_list.SetItemString(ll_row, L"ClassifyID", ClassifyID); |
| | | dw_list.SetItemDisplayString(ll_row, L"ClassifyID", dw_item.GetItemDisplayString(ll_row1, L"ClassifyID")); |
| | | dw_list.SetItemString(ll_row, L"CName", dw_item.GetItemDisplayString(ll_row1, L"ClassifyID")); |
| | | } |
| | | dw_list.Redraw(); |
| | | dw_item.SetItemString(ll_row1, L"Relation",xstring(ll_row)); |
| | | dw_item.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&UpdateVatNotifyWin::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&UpdateVatNotifyWin::OnSetFocus); |
| | | AttachEvent(L"dw_item", L"DWV_ROWFOCUSCHANGED", (FEvent)&UpdateVatNotifyWin::OnRowChanged); |
| | | return 1; |
| | | } |
| | | |
| | | int RetrieveCustomSource(xstring classifyID, xstring supplierID) |
| | | { |
| | | xml x ; |
| | | |
| | | xaserverarg arg ; |
| | | |
| | | if (GetWinParam()) |
| | | { |
| | | int pArg = GetArg(); |
| | | |
| | | } |
| | | else |
| | | arg.AddArg(L"invoiceno", L"15HDLD0720"); |
| | | |
| | | arg.AddArg(L"ClassifyID", classifyID); |
| | | arg.AddArg(L"SupplierID", supplierID); |
| | | if (getUrl(L"/sale/data/VATNotify/pref/CustomSource", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | } |
| | | } |
| | | |
| | | int OnRowChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | |
| | | if (row < 1) return 1; |
| | | KXMLDOMElement e = dw_item.GetRowElement(row); |
| | | xstring classifyID = e.selectSingleNode(L"ClassifyID").text(); |
| | | xstring supplierID = e.selectSingleNode(L"SupplierID").text(); |
| | | e.Release(); |
| | | RetrieveCustomSource(classifyID, supplierID); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | if (GetWinParam()) |
| | | { |
| | | int pArg = GetArg(); |
| | | |
| | | } |
| | | else |
| | | arg.AddArg(L"invoiceno", L"15HDLD0720"); |
| | | if (getUrl(L"/sale/data/VATNotify/entity/base/miss", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | //return -1; |
| | | } |
| | | else |
| | | { |
| | | //alert(x.xml); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | |
| | | if (getUrl(L"/sale/data/VATNotify/pref/GdnInvoice", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_item.Retrieve(x); |
| | | dw_item.Redraw(); |
| | | dw_item.SetReadOnly(true); |
| | | if (dw_item.GetRowCount() > 0) |
| | | { |
| | | KXMLDOMElement e = dw_item.GetRowElement(1); |
| | | xstring classifyID = e.selectSingleNode(L"ClassifyID").text(); |
| | | xstring supplierID = e.selectSingleNode(L"SupplierID").text(); |
| | | e.Release(); |
| | | trace(L"!" + classifyID + L" " + supplierID); |
| | | RetrieveCustomSource(classifyID, supplierID); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.openUrl(L"/sale/view/VATNotify/template/VATNotify/item"); |
| | | dw_item = GetControl(L"dw_item"); |
| | | dw_item.openUrl(L"/sale/view/VATNotify/template/VATNotify/DItem"); |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(L"/sale/view/VATNotify/template/VATNotify/DItem1"); |
| | | |
| | | |
| | | OnRetrieve(); |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | //SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |