xj qian
2024-06-25 58c129e8f21f79396a822eaeadd78edf281b52a0
first add  source code
已添加108个文件
21132 ■■■■■ 文件已修改
.gitignore 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/.vscode/launch.json 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/ext-jrj/dllmain.cpp 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/ext-jrj/ext-jrj.vcxproj 265 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/ext-jrj/ext-jrj.vcxproj.filters 306 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/ext-jrj/ext-jrj.vcxproj.user 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/ext-jrj/framework.h 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/ext-jrj/pch.cpp 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/ext-jrj/pch.h 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/jrj.sln 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Customer3.list.cpp 499 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Customer3.maint.cpp 1213 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Enquiry.list.cpp 1705 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Product.list.cpp 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Product.maint.cpp 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Quote3.list3.cpp 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Quote3.maint.cpp 1230 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/SO3.list.cpp 513 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/SO3.maint.cpp 1115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Supplier.maint.cpp 1473 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Supplier3.list.cpp 541 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/start.vframe.vbusiness.cpp 119 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/viewobject/customer.view.hpp 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/viewobject/productlibrary.view.hpp 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/viewobject/purchaseorder.view.hpp 113 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/viewobject/quote.view.hpp 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/viewobject/saleorder.view.hpp 143 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/viewobject/shoppingcart.view.hpp 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/viewobject/supplier.view.hpp 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/viewobject/view.base.hpp 298 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/vindexform.cpp 180 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/vindexmenu.cpp 516 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kapp.hpp 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kbase.hpp 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kcachemgr.hpp 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kcontrol.hpp 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kdwgrid.hpp 239 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kdwpages.hpp 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kdwtable.hpp 244 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kdwview.hpp 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kimage.hpp 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kimageview.hpp 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/klayersheet.hpp 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/knode.hpp 104 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kpage.hpp 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kreport.hpp 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kshtml.hpp 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kutil.hpp 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kwin.hpp 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kxaserver.hpp 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kxml.hpp 262 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/lib/nmemory.obj 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/lib/nmemory1.obj 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/lib/nstring.obj 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/lib/nstring1.obj 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/lib/xstring.obj 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/lib/xstring1.obj 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/platform/nmemory.hpp 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/platform/nstring.hpp 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/src/nmemory.cpp 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/src/nmemory.obj 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/src/nstring.cpp 346 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/src/nstring.obj 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/src/win.cpp 178 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/src/xstring.cpp 649 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/src/xstring.obj 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/system/base.hpp 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/system/itemalloc.hpp 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/test/1.txt 198 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/test/test01.bc 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/test/test01.cpp 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/test/test01.ll 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/test/test01.obj 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/vbusiness/vframe/frame.vframe.vbusiness.hpp 587 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/vbusiness/vframe/listex.vframe.vbusiness.hpp 600 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/vbusiness/vframe/listtree.vframe.vbusiness.hpp 161 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/vbusiness/vframe/listwin.vframe.vbusiness.hpp 819 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/vbusiness/vframe/maint.vframe.vbusiness.hpp 547 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/vbusiness/vframe/responsewin.vframe.vbusiness.hpp 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/vbusiness/vutil/publiccode.vutil.vbusiness.hpp 375 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/win32/win.hpp 196 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xapp.hpp 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xaserver.hpp 208 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xaserverarg.hpp 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xbase.hpp 270 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xcachemgr.hpp 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xcontrol.hpp 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xdouble.hpp 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xint.hpp 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xnative.hpp 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xnode.hpp 239 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xobject.hpp 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xpage.hpp 141 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xstring.hpp 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xurl.hpp 210 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xutil.hpp 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xview.hpp 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/wobject/xwin.hpp 167 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/xcontrol/xcombobox.hpp 288 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/xcontrol/xdwgrid.hpp 537 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/xcontrol/xdwpages.hpp 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/xcontrol/xdwtable.hpp 480 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/xcontrol/ximage.hpp 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/xcontrol/ximageview.hpp 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/xcontrol/xlayersheet.hpp 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/xcontrol/xreport.hpp 127 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/xcontrol/xshtml.hpp 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/xcontrol/xtreeview.hpp 522 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.gitignore
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
.vs
# Package Files #
*.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
jrj/.vscode/launch.json
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,7 @@
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": []
}
jrj/ext-jrj/dllmain.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
// dllmain.cpp : å®šä¹‰ DLL åº”用程序的入口点。
#include "pch.h"
BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
    case DLL_PROCESS_DETACH:
        break;
    }
    return TRUE;
}
jrj/ext-jrj/ext-jrj.vcxproj
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,265 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <VCProjectVersion>17.0</VCProjectVersion>
    <Keyword>Win32Proj</Keyword>
    <ProjectGuid>{ff1f0c96-5b8e-4794-8670-ee8c83ce3be2}</ProjectGuid>
    <RootNamespace>extjrj</RootNamespace>
    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v143</PlatformToolset>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v143</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v143</PlatformToolset>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>v143</PlatformToolset>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <ImportGroup Label="ExtensionSettings">
  </ImportGroup>
  <ImportGroup Label="Shared">
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  </ImportGroup>
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <OutDir>$(SolutionDir)..\..\..\mis-prj-build\jrj\$(Platform)\$(Configuration)\</OutDir>
    <IntDir>$(SolutionDir)..\..\..\mis-prj-build\jrj-temp\$(Platform)\$(Configuration)\</IntDir>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>WIN32;_DEBUG;EXTJRJ_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
      <PrecompiledHeader>Use</PrecompiledHeader>
      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
    </ClCompile>
    <Link>
      <SubSystem>Windows</SubSystem>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <EnableUAC>false</EnableUAC>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>WIN32;NDEBUG;EXTJRJ_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
      <PrecompiledHeader>Use</PrecompiledHeader>
      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
    </ClCompile>
    <Link>
      <SubSystem>Windows</SubSystem>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <EnableUAC>false</EnableUAC>
    </Link>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>_DEBUG;EXTJRJ_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
      <PrecompiledHeader>NotUsing</PrecompiledHeader>
      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
      <AdditionalIncludeDirectories>D:\mis-prj\jrj\xframe;D:\mis-prj\jrj\xframe\system;D:\mis-prj\jrj\project</AdditionalIncludeDirectories>
    </ClCompile>
    <Link>
      <SubSystem>Windows</SubSystem>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <EnableUAC>false</EnableUAC>
      <AdditionalDependencies>xarch.shape.lib;xarch.base.lib;xarch.util.lib;xarch.network.lib;xarch.xframe.lib;xarch.xcontrol.lib;xoffice.xcell.lib;xoffice.xgrid.lib;xoffice.xreport.lib;%(AdditionalDependencies);$(CoreLibraryDependencies)</AdditionalDependencies>
      <AdditionalLibraryDirectories>D:\xclient64</AdditionalLibraryDirectories>
    </Link>
    <PostBuildEvent>
      <Command>copy $(OutDirFullPath)ext-jrj.dll D:\xclient64\ext\ext-jrj.dll</Command>
    </PostBuildEvent>
  </ItemDefinitionGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <WarningLevel>Level3</WarningLevel>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <SDLCheck>true</SDLCheck>
      <PreprocessorDefinitions>NDEBUG;EXTJRJ_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <ConformanceMode>true</ConformanceMode>
      <PrecompiledHeader>Use</PrecompiledHeader>
      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
    </ClCompile>
    <Link>
      <SubSystem>Windows</SubSystem>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <EnableUAC>false</EnableUAC>
    </Link>
  </ItemDefinitionGroup>
  <ItemGroup>
    <ClInclude Include="..\project\viewobject\customer.view.hpp" />
    <ClInclude Include="..\project\viewobject\productlibrary.view.hpp" />
    <ClInclude Include="..\project\viewobject\purchaseorder.view.hpp" />
    <ClInclude Include="..\project\viewobject\quote.view.hpp" />
    <ClInclude Include="..\project\viewobject\saleorder.view.hpp" />
    <ClInclude Include="..\project\viewobject\shoppingcart.view.hpp" />
    <ClInclude Include="..\project\viewobject\supplier.view.hpp" />
    <ClInclude Include="..\xframe\kobject\kapp.hpp" />
    <ClInclude Include="..\xframe\kobject\kbase.hpp" />
    <ClInclude Include="..\xframe\kobject\kcachemgr.hpp" />
    <ClInclude Include="..\xframe\kobject\kcontrol.hpp" />
    <ClInclude Include="..\xframe\kobject\kdwgrid.hpp" />
    <ClInclude Include="..\xframe\kobject\kdwpages.hpp" />
    <ClInclude Include="..\xframe\kobject\kdwtable.hpp" />
    <ClInclude Include="..\xframe\kobject\kdwview.hpp" />
    <ClInclude Include="..\xframe\kobject\klayersheet.hpp" />
    <ClInclude Include="..\xframe\kobject\knode.hpp" />
    <ClInclude Include="..\xframe\kobject\kpage.hpp" />
    <ClInclude Include="..\xframe\kobject\kreport.hpp" />
    <ClInclude Include="..\xframe\kobject\kshtml.hpp" />
    <ClInclude Include="..\xframe\kobject\kutil.hpp" />
    <ClInclude Include="..\xframe\kobject\kwin.hpp" />
    <ClInclude Include="..\xframe\kobject\kxaserver.hpp" />
    <ClInclude Include="..\xframe\kobject\kxml.hpp" />
    <ClInclude Include="..\xframe\platform\nmemory.hpp" />
    <ClInclude Include="..\xframe\platform\nstring.hpp" />
    <ClInclude Include="..\xframe\system\base.hpp" />
    <ClInclude Include="..\xframe\system\itemalloc.hpp" />
    <ClInclude Include="..\xframe\vbusiness\vframe\frame.vframe.vbusiness.hpp" />
    <ClInclude Include="..\xframe\vbusiness\vframe\listex.vframe.vbusiness.hpp" />
    <ClInclude Include="..\xframe\vbusiness\vframe\listtree.vframe.vbusiness.hpp" />
    <ClInclude Include="..\xframe\vbusiness\vframe\listwin.vframe.vbusiness.hpp" />
    <ClInclude Include="..\xframe\vbusiness\vframe\maint.vframe.vbusiness.hpp" />
    <ClInclude Include="..\xframe\vbusiness\vframe\responsewin.vframe.vbusiness.hpp" />
    <ClInclude Include="..\xframe\vbusiness\vutil\publiccode.vutil.vbusiness.hpp" />
    <ClInclude Include="..\xframe\wobject\xapp.hpp" />
    <ClInclude Include="..\xframe\wobject\xaserver.hpp" />
    <ClInclude Include="..\xframe\wobject\xaserverarg.hpp" />
    <ClInclude Include="..\xframe\wobject\xbase.hpp" />
    <ClInclude Include="..\xframe\wobject\xcachemgr.hpp" />
    <ClInclude Include="..\xframe\wobject\xcontrol.hpp" />
    <ClInclude Include="..\xframe\wobject\xdouble.hpp" />
    <ClInclude Include="..\xframe\wobject\xint.hpp" />
    <ClInclude Include="..\xframe\wobject\xnative.hpp" />
    <ClInclude Include="..\xframe\wobject\xnode.hpp" />
    <ClInclude Include="..\xframe\wobject\xobject.hpp" />
    <ClInclude Include="..\xframe\wobject\xpage.hpp" />
    <ClInclude Include="..\xframe\wobject\xstring.hpp" />
    <ClInclude Include="..\xframe\wobject\xurl.hpp" />
    <ClInclude Include="..\xframe\wobject\xutil.hpp" />
    <ClInclude Include="..\xframe\wobject\xview.hpp" />
    <ClInclude Include="..\xframe\wobject\xwin.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xcombobox.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xdwgrid.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xdwpages.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xdwtable.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xlayersheet.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xreport.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xshtml.hpp" />
    <ClInclude Include="..\xframe\xcontrol\xtreeview.hpp" />
    <ClInclude Include="framework.h" />
    <ClInclude Include="pch.h" />
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="..\project\business\Customer3.list.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Customer3.maint.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Enquiry.list.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Product.list.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Product.maint.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Quote3.list3.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Quote3.maint.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\SO3.list.cpp" />
    <ClCompile Include="..\project\business\SO3.maint.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier.maint.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier3.list.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\start.vframe.vbusiness.cpp" />
    <ClCompile Include="..\project\viewobject\view.base.hpp" />
    <ClCompile Include="..\project\vindexform.cpp" />
    <ClCompile Include="..\project\vindexmenu.cpp" />
    <ClCompile Include="..\xframe\src\nmemory.cpp" />
    <ClCompile Include="..\xframe\src\nstring.cpp" />
    <ClCompile Include="..\xframe\src\xstring.cpp" />
    <ClCompile Include="dllmain.cpp" />
    <ClCompile Include="pch.cpp">
      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
    </ClCompile>
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
  </ImportGroup>
</Project>
jrj/ext-jrj/ext-jrj.vcxproj.filters
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,306 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <Filter Include="源文件">
      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
      <Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
    </Filter>
    <Filter Include="头文件">
      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
      <Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
    </Filter>
    <Filter Include="资源文件">
      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
    </Filter>
    <Filter Include="project">
      <UniqueIdentifier>{ac14d21c-b1c0-4c08-b9d7-29966daf5802}</UniqueIdentifier>
    </Filter>
    <Filter Include="xframe">
      <UniqueIdentifier>{541a32c0-999c-4222-a7f3-043aeaeeca6c}</UniqueIdentifier>
    </Filter>
    <Filter Include="xframe\system">
      <UniqueIdentifier>{4e5b8407-7d17-48c3-90c8-32a9f7fc233c}</UniqueIdentifier>
    </Filter>
    <Filter Include="xframe\wobject">
      <UniqueIdentifier>{d8e3b7df-6bca-4436-bf99-1de21b39686f}</UniqueIdentifier>
    </Filter>
    <Filter Include="xframe\kobject">
      <UniqueIdentifier>{013263f0-67a6-4bb5-9d39-d0d783d0786d}</UniqueIdentifier>
    </Filter>
    <Filter Include="xframe\xcontrol">
      <UniqueIdentifier>{4e0d716f-4228-4e95-a97b-937a74aa08c1}</UniqueIdentifier>
    </Filter>
    <Filter Include="xframe\src">
      <UniqueIdentifier>{c38f2df4-a908-40ad-9e85-d89bbabf27e9}</UniqueIdentifier>
    </Filter>
    <Filter Include="xframe\platform">
      <UniqueIdentifier>{a9ed32f0-b794-4999-9e85-67bc2464166b}</UniqueIdentifier>
    </Filter>
    <Filter Include="vbusiness">
      <UniqueIdentifier>{851a5d67-65b8-464f-a4ad-0672efada520}</UniqueIdentifier>
    </Filter>
    <Filter Include="vbusiness\vframe">
      <UniqueIdentifier>{2774dd40-8747-427b-acc8-94d3103a6f05}</UniqueIdentifier>
    </Filter>
    <Filter Include="vbusiness\util">
      <UniqueIdentifier>{538f2623-b2e1-4a86-9a16-5e00bc4ac258}</UniqueIdentifier>
    </Filter>
    <Filter Include="project\business">
      <UniqueIdentifier>{6d7b6d05-6db8-4a9e-9295-7415fc8ba8c2}</UniqueIdentifier>
    </Filter>
    <Filter Include="project\viewobject">
      <UniqueIdentifier>{1204eabe-475a-4239-9711-8e90447311db}</UniqueIdentifier>
    </Filter>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="framework.h">
      <Filter>头文件</Filter>
    </ClInclude>
    <ClInclude Include="pch.h">
      <Filter>头文件</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\platform\nmemory.hpp">
      <Filter>xframe\platform</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\platform\nstring.hpp">
      <Filter>xframe\platform</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\kobject\kbase.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\kobject\kcontrol.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\kobject\kdwgrid.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\kobject\kdwtable.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\kobject\klayersheet.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\kobject\knode.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\kobject\kpage.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\kobject\kreport.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\kobject\kshtml.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\kobject\kutil.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\kobject\kwin.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\kobject\kxaserver.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\kobject\kxml.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\xcontrol\xcombobox.hpp">
      <Filter>xframe\xcontrol</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\xcontrol\xdwgrid.hpp">
      <Filter>xframe\xcontrol</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\xcontrol\xdwtable.hpp">
      <Filter>xframe\xcontrol</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\xcontrol\xlayersheet.hpp">
      <Filter>xframe\xcontrol</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\xcontrol\xreport.hpp">
      <Filter>xframe\xcontrol</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\xcontrol\xshtml.hpp">
      <Filter>xframe\xcontrol</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\xcontrol\xtreeview.hpp">
      <Filter>xframe\xcontrol</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\wobject\xapp.hpp">
      <Filter>xframe\wobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\wobject\xaserver.hpp">
      <Filter>xframe\wobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\wobject\xaserverarg.hpp">
      <Filter>xframe\wobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\wobject\xbase.hpp">
      <Filter>xframe\wobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\wobject\xcontrol.hpp">
      <Filter>xframe\wobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\wobject\xnative.hpp">
      <Filter>xframe\wobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\wobject\xnode.hpp">
      <Filter>xframe\wobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\wobject\xobject.hpp">
      <Filter>xframe\wobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\wobject\xpage.hpp">
      <Filter>xframe\wobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\wobject\xstring.hpp">
      <Filter>xframe\wobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\wobject\xurl.hpp">
      <Filter>xframe\wobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\wobject\xutil.hpp">
      <Filter>xframe\wobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\wobject\xview.hpp">
      <Filter>xframe\wobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\wobject\xwin.hpp">
      <Filter>xframe\wobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\system\base.hpp">
      <Filter>xframe\system</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\system\itemalloc.hpp">
      <Filter>xframe\system</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\vbusiness\vframe\frame.vframe.vbusiness.hpp">
      <Filter>vbusiness\vframe</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\vbusiness\vframe\listwin.vframe.vbusiness.hpp">
      <Filter>vbusiness\vframe</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\vbusiness\vframe\maint.vframe.vbusiness.hpp">
      <Filter>vbusiness\vframe</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\vbusiness\vframe\responsewin.vframe.vbusiness.hpp">
      <Filter>vbusiness\vframe</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\kobject\kdwpages.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\xcontrol\xdwpages.hpp">
      <Filter>xframe\xcontrol</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\vbusiness\vframe\listex.vframe.vbusiness.hpp">
      <Filter>vbusiness\vframe</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\vbusiness\vutil\publiccode.vutil.vbusiness.hpp">
      <Filter>vbusiness\util</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\vbusiness\vframe\listtree.vframe.vbusiness.hpp">
      <Filter>vbusiness\vframe</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\kobject\kdwview.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\project\viewobject\customer.view.hpp">
      <Filter>project\viewobject</Filter>
    </ClInclude>
    <ClInclude Include="..\project\viewobject\productlibrary.view.hpp">
      <Filter>project\viewobject</Filter>
    </ClInclude>
    <ClInclude Include="..\project\viewobject\purchaseorder.view.hpp">
      <Filter>project\viewobject</Filter>
    </ClInclude>
    <ClInclude Include="..\project\viewobject\saleorder.view.hpp">
      <Filter>project\viewobject</Filter>
    </ClInclude>
    <ClInclude Include="..\project\viewobject\shoppingcart.view.hpp">
      <Filter>project\viewobject</Filter>
    </ClInclude>
    <ClInclude Include="..\project\viewobject\supplier.view.hpp">
      <Filter>project\viewobject</Filter>
    </ClInclude>
    <ClInclude Include="..\project\viewobject\quote.view.hpp">
      <Filter>project\viewobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\kobject\kapp.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\kobject\kcachemgr.hpp">
      <Filter>xframe\kobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\wobject\xcachemgr.hpp">
      <Filter>xframe\wobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\wobject\xdouble.hpp">
      <Filter>xframe\wobject</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\wobject\xint.hpp">
      <Filter>xframe\wobject</Filter>
    </ClInclude>
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="dllmain.cpp">
      <Filter>源文件</Filter>
    </ClCompile>
    <ClCompile Include="pch.cpp">
      <Filter>源文件</Filter>
    </ClCompile>
    <ClCompile Include="..\xframe\src\nmemory.cpp">
      <Filter>xframe\src</Filter>
    </ClCompile>
    <ClCompile Include="..\xframe\src\nstring.cpp">
      <Filter>xframe\src</Filter>
    </ClCompile>
    <ClCompile Include="..\xframe\src\xstring.cpp">
      <Filter>xframe\src</Filter>
    </ClCompile>
    <ClCompile Include="..\project\start.vframe.vbusiness.cpp">
      <Filter>project</Filter>
    </ClCompile>
    <ClCompile Include="..\project\vindexform.cpp">
      <Filter>project</Filter>
    </ClCompile>
    <ClCompile Include="..\project\vindexmenu.cpp">
      <Filter>project</Filter>
    </ClCompile>
    <ClCompile Include="..\project\viewobject\view.base.hpp">
      <Filter>project\viewobject</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\SO3.list.cpp">
      <Filter>project\business</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\SO3.maint.cpp">
      <Filter>project\business</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Customer3.list.cpp">
      <Filter>project\business</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Customer3.maint.cpp">
      <Filter>project\business</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Enquiry.list.cpp">
      <Filter>project\business</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Product.list.cpp">
      <Filter>project\business</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Product.maint.cpp">
      <Filter>project\business</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Quote3.list3.cpp">
      <Filter>project\business</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Quote3.maint.cpp">
      <Filter>project\business</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier.maint.cpp">
      <Filter>project\business</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Supplier3.list.cpp">
      <Filter>project\business</Filter>
    </ClCompile>
  </ItemGroup>
</Project>
jrj/ext-jrj/ext-jrj.vcxproj.user
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <LocalDebuggerCommand>d:\xclient64\xexplorer.exe</LocalDebuggerCommand>
    <LocalDebuggerWorkingDirectory>d:\xclient64</LocalDebuggerWorkingDirectory>
    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
  </PropertyGroup>
</Project>
jrj/ext-jrj/framework.h
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,5 @@
#pragma once
#define WIN32_LEAN_AND_MEAN             // ä»Ž Windows å¤´æ–‡ä»¶ä¸­æŽ’除极少使用的内容
// Windows å¤´æ–‡ä»¶
#include <windows.h>
jrj/ext-jrj/pch.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,5 @@
// pch.cpp: ä¸Žé¢„编译标头对应的源文件
#include "pch.h"
// å½“使用预编译的头时,需要使用此源文件,编译才能成功。
jrj/ext-jrj/pch.h
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
// pch.h: è¿™æ˜¯é¢„编译标头文件。
// ä¸‹æ–¹åˆ—出的文件仅编译一次,提高了将来生成的生成性能。
// è¿™è¿˜å°†å½±å“ IntelliSense æ€§èƒ½ï¼ŒåŒ…括代码完成和许多代码浏览功能。
// ä½†æ˜¯ï¼Œå¦‚果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
// è¯·å‹¿åœ¨æ­¤å¤„添加要频繁更新的文件,这将使得性能优势无效。
#ifndef PCH_H
#define PCH_H
// æ·»åŠ è¦åœ¨æ­¤å¤„é¢„ç¼–è¯‘çš„æ ‡å¤´
#include "framework.h"
#endif //PCH_H
jrj/jrj.sln
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ext-jrj", ".\ext-jrj\ext-jrj.vcxproj", "{FF1F0C96-5B8E-4794-8670-EE8C83CE3BE2}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|x64 = Debug|x64
        Debug|x86 = Debug|x86
        Release|x64 = Release|x64
        Release|x86 = Release|x86
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {FF1F0C96-5B8E-4794-8670-EE8C83CE3BE2}.Debug|x64.ActiveCfg = Debug|x64
        {FF1F0C96-5B8E-4794-8670-EE8C83CE3BE2}.Debug|x64.Build.0 = Debug|x64
        {FF1F0C96-5B8E-4794-8670-EE8C83CE3BE2}.Debug|x86.ActiveCfg = Debug|Win32
        {FF1F0C96-5B8E-4794-8670-EE8C83CE3BE2}.Debug|x86.Build.0 = Debug|Win32
        {FF1F0C96-5B8E-4794-8670-EE8C83CE3BE2}.Release|x64.ActiveCfg = Release|x64
        {FF1F0C96-5B8E-4794-8670-EE8C83CE3BE2}.Release|x64.Build.0 = Release|x64
        {FF1F0C96-5B8E-4794-8670-EE8C83CE3BE2}.Release|x86.ActiveCfg = Release|Win32
        {FF1F0C96-5B8E-4794-8670-EE8C83CE3BE2}.Release|x86.Build.0 = Release|Win32
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
    GlobalSection(ExtensibilityGlobals) = postSolution
        SolutionGuid = {B7F74F1A-D194-40A8-8958-8272B16B52F8}
    EndGlobalSection
EndGlobal
jrj/project/business/Customer3.list.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,499 @@
#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) listCustomerv3 : public listwin
{
public:
    xdwgrid dw_goods;
    xtreeview tv_1;
    xcombobox ddlb_1;
    int    changeddlb;
    xstring m_sType; //type
    xstring m_sTypeTxt; //选中树的data
    //    xstring m_searchtxt;
    int PIndex;
    xnode    m_agentNode;    //Agent Condition
    xstring    m_agentCond;    //Agent Node
public:
    listCustomerv3(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {}
public:
    static listCustomerv3* CreateInstance(void* implPtr, void* hWnd)
    {
        listCustomerv3* pWin = new listCustomerv3(implPtr, (HWND)hWnd);
        return pWin;
    }
    int OnPreRetrieve()
    {
        xml x;
        xaserverarg arg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg(L"pageindex", xstring(PIndex)); //第几页
        arg.AddArg(L"pagenumber", xstring(m_pageNumber)); //每页数量
        arg.AddArg(L"QueryTxt", m_QueryTxt);
        arg.AddArg(L"sType", m_sType);
        if (m_sType == L"Source.unshipedEx")m_sTypeTxt = L".";
        arg.AddArg(L"sTypeTxt", m_sTypeTxt);
        //        arg.AddArg(L"txt",m_searchtxt);
                //alert(listwin::m_QueryTxt);
        trace(L"pageindex====L" + xstring(PIndex) + L"pagenumber====L" + xstring(m_pageNumber) +
            L"QueryTxt====L" + L"sType====L" + m_sType + L"sTypeTxt====L" + m_sTypeTxt);
        if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1)
        {
            //alert(x.text());
            return -1;
        }
        else
        {
            if ((xstring)x.xml() == L"") return 1;
            KXMLDOMElement e = x.documentElement();
            if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage"))
            {
                xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量
                dw_pages.SetMaxPage(s.toInt());
            }
            dw_list.Retrieve(x);
            dw_list.Redraw();
            dw_list.SetReadOnly(true);
        }
        return 1;
    }
    int SetEntityData(xaserverarg arg)
    {
        xstring strQueryTxt = arg.GetArgString(L"QueryTxt");
        //trace(strQueryTxt);
    //    arg.AddArg(L"QueryTxt", m_QueryTxt);
        xml x;
        arg.AddArg(L"sType", m_sType);
        arg.AddArg(L"sTypeTxt", m_sTypeTxt);
        //    arg.AddArg(L"txt",m_searchtxt);
            //alert(arg.GetString());    CustomerV3
        if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1)
        {
            alert(x.text() + (xstring)L"url:" + L"/sale/data/" + GetEntityName(1) + L"/entity/list");
            return -1;
        }
        else
        {
            KXMLDOMElement e = x.documentElement();
            if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage"))
            {
                xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量
                listwin::dw_pages.SetMaxPage(s.toInt());
            }
            //trace(x.GetXml());
            listwin::dw_list.Retrieve(x);
            listwin::dw_list.Redraw();
            listwin::dw_list.SetReadOnly(true);
        }
        return 1;
    }
    int OnChangePages(TEvent* evt, LPARAM p)
    {
        PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh;
        int c = h->cur;
        HCURSOR hCursor = xutil::SetCursorWait();
        OnRetrieve();
        PIndex = c;
        xutil::RestoreCursor(hCursor);
        return 1;
    }
    int ViewUpdate(int pr, xstring updateItem, xaserverarg  arg)
    {
        //alert(    updateItem);
        if (updateItem == L"del")
        {
            int DelRow = dw_list.GetRow();
            dw_list.DeleteRow(DelRow);
        }
        if (updateItem == L"refresh")
        {
            //trace(L"sd");
            xdwpages zz = GetControl(L"pages");
            int h = zz.SetCurPage(1);
            //trace(h);
            OnRetrieve();
        }
        return 1;
    }
    //树选择
    int OnTreeSelChanged(TEvent* evt, LPARAM p)
    {
        if (changeddlb != 1)
        {
            HTREEITEM h = tv_1.GetSelectedItem();
            KXMLDOMElement& e = *(KXMLDOMElement*)tv_1.GetItemData(h);
            xstring t = e.selectSingleNode(L"@type").text();
            m_sType = t + L"";
            xstring txt = e.selectSingleNode(L"@code").text();
            if (txt == L"")
                txt = e.selectSingleNode(L"@name").text();
            m_sTypeTxt = txt + L"";
            PIndex = 1;
            OnRetrieve();
        }
        return 1;
    }
    int createSubTree(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 = tv_1.InsertChildItem(h, name, (LPARAM)e, 15);
                createSubTree(hw, *e);
            }
        return 1;
    }
    int OnCreateTree(xstring sType)
    {
        trace(L"***");
        while (tv_1.GetRootItem())
            tv_1.DeleteItem(tv_1.GetRootItem());
        xml x;
        xaserverarg arg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg(L"sType", sType);
        trace(L"sType****" + sType);
        if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/pref/list/tree", arg.GetString(), x) != 1)
        {
            trace(x.text());
            return -1;
        }
        else
        {
            //alert(x.GetXml());
            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 hw = tv_1.InsertChildItem(0, name, (LPARAM)e, 15);
                    createSubTree(hw, *e);
                    tv_1.ExpandItem(hw);
                }
                tv_1.ExpandItem(0);
            }
        }
        return 1;
    }
    //xcombobox下拉
    int OnSelectDdlb(TEvent* evt, int p)
    {
        changeddlb = 1;
        int CB_GETCURSEL = 0x0147;
        int nIndex = SendMessageW(ddlb_1.GetHWND(), CB_GETCURSEL, 0, 0);
        KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement();
        KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring((nIndex + 1)) + L"]");
        xstring text = e2.selectSingleNode(L"@element").text();
        OnCreateTree(text);
        changeddlb = 0;
        return 1;
    }
    /*
    int OnDeleteRow()
    {
        int row = dw_list.GetNextSelectRow(1);
        if (row < 1){
            row = listwin::dw_list.GetRow();
            if (row < 1) {
                //win::MessageBox(GetHWND(),L"请选中要删除的行!",L"提示",0);
                return 0;
            }
        }
        KXMLDOMElement e = dw_list.GetRowElement(row);
        xstring sguid = e.SelectSingleNode(L"CustomerID").text()
        xstring sName = e.selectSingleNode(L"Name").text+L"";
        int  MB_YESNO = 0x00000004;
        int  IDYES =  6;
        if(win32::MessageBox(GetHWND(),L"确认要删除客户 "+sName+L" çš„信息吗?",L"提示",MB_YESNO)!=IDYES) return 1;
        xml x ;
        x.setNativePointer(x.CreateInstance());
        xaserverarg arg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg(L"guid",sguid);
        //    trace(sguid);
        if (url::post(L"/sale/data/"+GetEntityName(1)+L"/entity/delete",arg.GetString(),x) != 1)
        {
            xstring error = x.text();
            trace(error);
        }
        else
        {
            //win32::MessageBox(GetHWND(),L"删除成功!",L"提示",0);
            dw_list.DeleteRow(row);
        }
        return 0;
    }*/
    int GridSearch()
    {
#if 0
        xstring m_config = L"view.Customer.v3.config";
        xdwgrid dw = listwin::dw_list;
        xaserverarg arg;
        xstring str = TFile::node(m_config, L"config", L"search");
        if (str != L"") {
            arg.AddArg(L"sheet", str);
        }
        else
            arg.AddArg(L"sheet", L"dev:sheet[Customer.v3.tpl/list]");
        arg.AddArg(L"search", listwin::m_QueryTxt);
        openUrl(L"view.dlg.vface/xpage/grid/column/search", arg);
        xstring ok = arg.GetArgString(L"return");
        if (ok == L"ok") {
            xstring txt = arg.GetArgString(L"search");
            if (txt != L"") {
                listwin::m_QueryTxt = txt;
                //trace(txt);
                OnRetrieve();
            }
        }
#endif
        return 0;
    }
    int OnSelectAllRow()
    {
        int rows = listwin::dw_list.GetRowCount();
        if (rows < 1) return -1;
        listwin::dw_list.SelectRow(1, rows, true);
        listwin::dw_list.Redraw();
        return 1;
    }
    int OnRClick(TEvent* evt, int p)
    {
        return 1;
    }
    int OnLogOff()
    {
        return 1;
    }
    int OnShare()
    {
        xaserverarg& arg = *new xaserverarg;
        int row = dw_list.GetRow();
        if (row < 1) return 0;
        xstring PartyID = dw_list.GetItemString(row, L"PartyID");
        arg.AddArg(L"EntityID", PartyID);
        arg.AddArg(L"EntityName", L"客户共享");
        OpenWindow(L"dev:xpage[UserGroupShare.vx]", (LPARAM)&arg);
        return 1;
    }
    int OnShareMessage()
    {
        xaserverarg& arg = *new xaserverarg;
        int row = dw_list.GetRow();
        if (row < 1) return 0;
        xstring PartyID = dw_list.GetItemString(row, L"PartyID");
        arg.AddArg(L"PartyID", PartyID);
        OpenWindow(L"dev:xpage[XmShare.Custumer.v3.vx]", (LPARAM)&arg);
        return 1;
    }
    int PreOnCmdDispatch(xstring comdid)
    {
        if (comdid.find(L"action:LogOff", 0) >= 0) return OnLogOff();
        //if(comdid.find(L"action:bill.delete",0)>=0) return OnDeleteRow();
        if (comdid == L"action:search1") return GridSearch();
        if (comdid == L"action:bill.refresh")
        {    //m_PageIndex= 1;
            return OnRetrieve();
        }
        if (comdid == L"action:XmShare")
        {
            OnShare();
            return 0;
        }
        if (comdid == L"action:XmShareMessage")
        {
            OnShareMessage();
            return 0;
        }
        if (comdid == L"action:bill.xmSaveAs")
        {
            xstring  userno = publiccode::GetUser().no;
            if (userno == L"00701" || userno == L"00601" || userno == L"admin")
            {
                dw_list.SaveAs(L"");
            }
            return 1;
        }
        if (comdid == L"action:bill.SourceRemark") return OnSourceRemark();
        if (comdid == L"action:bill.Annex")
        {
            xaserverarg& arg = *new xaserverarg;
            arg.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"PartyID"));
            OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", (LPARAM)&arg);
            return 1;
        }
        if (comdid == L"action:bill.AnnexEx")
        {
            xaserverarg& arg4 = *new xaserverarg;
            arg4.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"CMID"));
            OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", (LPARAM)&arg4);
            return 1;
        }
        //    if(comdid==L"action:bill.import") return OnImport();
        //    if(comdid.find(L"action:",0)>=0) return ProcessFlowAction(comdid,1);
            //if(comdid==L"search") return GridSearch(L"view.dlg.vface/xpage/grid/column/edit");
            //if(comdid==L"showall")     return ShowAll();
        return 1;
    }
    int OnSourceRemark()
    {
        xstring name = L"客户管理";
        xml x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/TradeFinance3/GetSetUpRemarks", L"Type", name);
        KXMLDOMNodeList items = x.selectNodes(L"data/Item");
        KXMLDOMNode t = items.item(0);
        xstring Content = L"";
        if (t.selectSingleNode(L"Content"))
        {
            Content = t.selectSingleNode(L"Content").text();
        }
        xaserverarg& arg1 = *new xaserverarg;
        arg1.AddArg(L"value", Content);
        OpenWindow(L"dev:xpage[memo.edit.new.vx]", (LPARAM)&arg1);
        return 1;
    }
    int OnRowChangedEx(TEvent* evt, int p)
    {
        DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh;
        int row = hdr.row;
        //if(row < 1 or row > dw_list.GetRowCount()) return 1;
        KXMLDOMElement ele = listwin::dw_list.GetRowElement(row);
        xstring entity = ele.selectSingleNode(L"CustomerID").text();
        xml x;
        xaserverarg arg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg(L"EntityID", entity);
        if (getUrl(GetServerUrl(), L"/sale/data/CustomerV3/entity/customeritem", arg.GetString(), x) != 1)
        {
            trace(x.text());
            return -1;
        }
        else
        {
            dw_goods.Retrieve(x);
            dw_goods.Redraw();
            dw_goods.SetReadOnly(true);
        }
        SetAgent(L"list", entity);
        return 1;
    }
    int PostOnAttachEvent()
    {
        //获得树的选择事件
        AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listCustomerv3::OnTreeSelChanged);
        AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listCustomerv3::OnSelectDdlb);
        AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listCustomerv3::OnChangePages);
        AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&listCustomerv3::OnRClick);//鼠标右键
        //AttachEvent(L"dw_list",L"DWV_CLICKED",OnClick);//鼠标右键
        return 1;
    }
    int onload()
    {
        PIndex = 1;
        m_QueryTxt = L""; //查询条件
        m_sType = L""; //type
        m_sTypeTxt = L""; //选中树的data
        listwin::onload();
        tv_1 = GetControl(L"tv_1");
        ddlb_1 = GetControl(L"cbx_1");
        changeddlb = 0;
        OnCreateTree(L"Source");
        dw_goods = GetControl(L"dw_goods");
        dw_goods.openUrl(GetServerUrl(), L"/sale/view/CustomerV3/template/customer/customeritem");
        return 1;
    }
    int onloaded()
    {
        AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&listCustomerv3::OnRowChangedEx);
        listwin::onloaded();
        dw_list.SetColumnState(L"PartyID", false);
        dw_list.SetColumnState(L"CMID", false);
        xstring EntityID;
        int row = dw_list.GetRow();
        if (row<0 || row>dw_list.GetRowCount()) return 1;
        KXMLDOMElement ele = dw_list.GetRowElement(row);
        xstring id = listwin::m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text();
        if (ele.selectSingleNode(id))
            EntityID = ele.selectSingleNode(id).text();
        listwin::SetAgent(L"list", EntityID);
        return 1;
    }
};
jrj/project/business/Customer3.maint.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,1213 @@
#include <wobject/xstring.hpp>
#include <xcontrol/xtreeview.hpp>
#include <xcontrol/xdwgrid.hpp>
#include "vbusiness/vframe/maint.vframe.vbusiness.hpp"
#include "viewobject/view.base.hpp"
class maintCustomerv3 : public maint
{
    xlayersheet xsheet;
    xlayersheet m_layer;
    xdwtable    dw_detail;
    xdwtable dw_power;
    xdwtable dw_require;
    xdwtable dw_jzfx;
    xdwtable dw_visit;
    xdwtable dw_Meetings;
    xdwtable dw_MeetingsEx;
    xdwgrid    dw_account;
    int                iLayer;//页面Index
    int APP=1;
    string     CustomerGoodsHWND;
    string userno;
    string ApplyStatus;
    /*struct PUser
    {
        string id;
        string no;
        string name;
    };*/
    string GetGuid()
    {
        return publiccode::GetGuid();
    }
    int ViewUpdate(int pr,string updateItem,xaserverarg  arg)
    {
        if(updateItem=="update")
        {
            dw_detail.ResetUpdateStatus();
        }
        return 1;
    }
    string GetEntityData(int pr)
    {
        xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        dw_detail.DwUpdateAllTo(x.GetXmlDoc());
        msxml::IXMLDOMElement e=x.GetXmlDoc().documentElement;
        xml x1 = new xml;
        x1.setNativePointer(xml::CreateInstance());
        dw_visit.DwUpdateAllTo(x1.GetXmlDoc());
        msxml::IXMLDOMElement e1=x1.GetXmlDoc().documentElement;
        msxml::IXMLDOMNodeList  oNodeList = e1.selectNodes("//Customer/*");
        int i=0;
        for (i=0; i<oNodeList.length; i++)
        {
          msxml::IXMLDOMElement Item = oNodeList.item(i);
          e.appendChild(Item);
       }
       xml x2= new xml;
        x2.setNativePointer(xml::CreateInstance());
        dw_Meetings.DwUpdateAllTo(x2.GetXmlDoc());
        msxml::IXMLDOMElement e2=x2.GetXmlDoc().documentElement;
        msxml::IXMLDOMNodeList  oNodeList2 = e2.selectNodes("//Customer/*");
        int i2=0;
        for (i2=0; i2<oNodeList2.length; i2++)
        {
          msxml::IXMLDOMElement Item2 = oNodeList2.item(i2);
          e.appendChild(Item2);
       }
       xml x3= new xml;
        x3.setNativePointer(xml::CreateInstance());
        dw_MeetingsEx.DwUpdateAllTo(x3.GetXmlDoc());
        msxml::IXMLDOMElement e3=x3.GetXmlDoc().documentElement;
        msxml::IXMLDOMNodeList  oNodeList3 = e3.selectNodes("//Customer/*");
        int i3=0;
        for (i3=0; i3<oNodeList3.length; i3++)
        {
          msxml::IXMLDOMElement Item3 = oNodeList3.item(i3);
          e.appendChild(Item3);
       }
       trace(e.xml);
        return e.xml;
    }
    int OnInit()
    {
        userno = xaserver::GetUserNo();
        //PUser User = publiccode::GetUserInfo();
        dw_detail.SetItemString(1,"SalesPersonID",xaserver::GetUserId());
        dw_detail.SetItemDisplayString(1,"SalesPersonID",publiccode::GetUser().name);
        dw_detail.SetItemString(1,"CreatorID",xaserver::GetUserId());
        dw_detail.SetItemDisplayString(1,"CreatorID",publiccode::GetUser().name);
        dw_detail.SetItemString(1,"CreateDate",publiccode::GetCurrentDate());
        dw_detail.SetItemString(1,"ModifyDate",publiccode::GetCurrentDate());
        dw_detail.SetItemString(1,"Status","1");
        dw_detail.SetItemString(1,"PAStatus","1"); //地址状态
        dw_detail.SetItemString(1,"PrimaryFlag","Y"); //主地址
        dw_detail.SetItemString(1,"Type","1"); //客户为 1
        dw_detail.SetItemString(1,"IdentifyAddressFlag","Y"); //没必要,暂时留着
        string sdate = publiccode::GetCurrentDate();
        dw_detail.SetItemString(1,"ApplyDate",sdate);
        dw_detail.SetItemString(1,"ApplyStatus","新建");
        dw_detail.SetItemString(1,"Level","");
        //dw_detail.SetItemDisplayString(1,"客户资料","客户资料附件");
        dw_detail.SetItemString(1,"客户资料","客户资料附件");
        string guid = publiccode::GetGuid();
        dw_detail.SetGuid(1,guid);
        dw_detail.Redraw();
        return 1;
    }
    string GetPartyID(string sName,string sType)
    {
        xml x1=new xml;
        x1.setNativePointer(xml::CreateInstance());
        xaserverarg arg=new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg("sname", sName);
        arg.AddArg("type",sType);
        if(url::get("/sale/data/"+GetEntityName(1)+"/pref/searchname",arg.GetString(),x1)!=1)
        {
            string error = x1.GetXmlDoc().text;
            //alert("/sale/data/"+GetEntityName(1)+"/pref/searchname");
            return "";
        }
        string sID="";
        if(x1.GetXmlDoc().selectSingleNode("root/PartyID"))
            sID = x1.GetXmlDoc().selectSingleNode("root/PartyID").text;
        return sID+"";
    }
    int OnItemChanged(ref TNotifyEvent evt,int p)
    {
        ref DWNMHDR  hdr = evt.pnmh;
        string colname = hdr.colname;
        string coldata = hdr.data;
        //根据国别显示地区代码
        if (colname == "CountryCode")
        {
            xaserverarg arg = new xaserverarg;
            arg.setNativePointer(arg.CreateInstance());
            arg.AddArg("countryCode",coldata);
            xml x = new xml;
            x.setNativePointer(x.CreateInstance());
            if (getUrl("/sale/data/"+GetEntityName(1)+"/pref/areacode",arg.GetString(),x)==1)
            {
                string sareacode = "";
                string sareaname = "";
                if(x.GetXmlDoc().selectSingleNode("//AreaCode"))
                {
                    sareacode = x.GetXmlDoc().selectSingleNode("//AreaCode").text;
                    sareaname = x.GetXmlDoc().selectSingleNode("//AreaName").text;
                }
                dw_detail.SetItemString(1,"AreaCode",sareacode);
                dw_detail.SetItemDisplayString(1,"AreaCode",sareaname);
                dw_detail.Redraw();
            }
        }
        //只能选一个主联系人
        if (colname == "PrimaryFlag" && coldata == "Y")
        {
            xdwtable dw_pc;
            dw_pc = dw_detail.FindDwTable("item1");
            if (dw_pc)
            {
                int i;
                for (i=1;i <= dw_pc.GetRowCount();i++)
                {
                    if (i != hdr.row)
                    {
                        dw_pc.SetItemString(i,"PrimaryFlag","N");
                        dw_pc.SetItemDisplayString(i,"PrimaryFlag","");
                    }
                }
            }
        }
        //客户名相同。
        if (colname == "Name")
        {
        //alert(coldata);
        /*    string sguid = GetPartyID(coldata,colname);
            if (sguid != "")
            {
                alert("客户名称与系统已有客户重复,请于管理员联系解决!");
            }*/
            //alert("ccc");
        }
        //客户简称
        if (colname == "ShortName")
        {
            string sguid1 = GetPartyID(coldata,colname);
            //trace(sguid1);
            if (sguid1 != "")
            {
                alert("客户简称重复,请改用其他简称!");
            }
        }
        //根据客户来源填写客户备注
        /*if (colname == "Source")
        {
            if(coldata=="025")
                alert("来源备注对应填写客户如何知道我们公司");
            if(coldata=="017" || coldata=="018")
                alert("来源备注对应填写哪个客户介绍的");
            if(coldata=="019")
                alert("来源备注对应填写哪个海外办事处或者联络点介绍");
            if(coldata=="020")
                alert("来源备注对应填写哪个门店介绍");
            if(coldata=="021")
                alert("来源备注对应填写谁介绍");
            if(coldata=="026")
                alert("来源备注对应填写谁考察市场争取到的客户");
            if(coldata=="028")
                alert("来源备注对应填写国外展会名称");
            if(coldata=="034")
                alert("来源备注对应填写谁的代理业务");
            if(coldata=="001" || coldata=="002" )
                alert("来源备注对应填写客户如何知道我们公司");
            if(coldata=="0052" || coldata=="0053" || coldata=="0054" || coldata=="0055" || coldata=="0051")
                dw_detail.SetItemString(1,"SourceRemark","阿里巴巴");
            if(coldata=="0161" || coldata=="0162" )
                dw_detail.SetItemString(1,"SourceRemark","环球资源");
            if(coldata=="0061" || coldata=="0062" )
                dw_detail.SetItemString(1,"SourceRemark","中国制造网");
            if(coldata=="022" || coldata=="023"  || coldata=="037"  || coldata=="038"  || coldata=="039"  || coldata=="040"  || coldata=="007"  || coldata=="024" )
                dw_detail.SetItemString(1,"SourceRemark","MH网站");
        }*/
        //联系人Title选择。
        if (colname == "Title")
        {
            xdwtable dw_PartyContact;
            dw_PartyContact = dw_detail.FindDwTable("PartyContact");
            if(coldata=="MR")
                dw_PartyContact.SetItemString(dw_PartyContact.GetRow(),"Gender","男");
            else if(coldata=="MS" || coldata=="MADAM" || coldata=="MRS" )
                dw_PartyContact.SetItemString(dw_PartyContact.GetRow(),"Gender","女");
            else
                dw_PartyContact.SetItemString(dw_PartyContact.GetRow(),"Gender","");
        }
        if (colname=="SalesPersonID"  && coldata != "")//设置人员归属
        {
            trace("asdasd");
            string ls_deptname,ls_teamname,ls_groupname,ls_unitname;
            ls_deptname =  publiccode::GetUser(coldata).deptname;
            ls_teamname = publiccode::GetUser(coldata).teamname;
            ls_groupname =  publiccode::GetUser(coldata).groupname;
            ls_unitname = publiccode::GetUser(coldata).unitname;
            trace(ls_unitname);
            dw_detail.SetItemString(1,"OrgName",ls_deptname+ls_teamname+ls_groupname+ls_unitname );
        }
        //根据生日自动设置年龄。
        /*if (colname == "Birthday")
        {
            xdwtable dw_PartyContact1;
            dw_PartyContact1 =dw_detail.FindDwTable("PC_OtherInfo");
            xml xx = new xml;
            xx.setNativePointer(xml ::CreateInstance());
            xaserverarg argnew = new xaserverarg;
            argnew.setNativePointer(argnew.CreateInstance());
            string     agesql;
            agesql =  "select Dbo.GetAge( '{$Birthday}',getdate()) for xml PATH('root'),ELEMENTS XSINIL";
            argnew.AddArg("sql",agesql);
            argnew.AddArg("Birthday",coldata);
            if (getSql(argnew.GetString(),xx) == 1)
            {
                msxml::IXMLDOMElement AgeEle=xx.GetXmlDoc().documentElement;
                dw_PartyContact1.SetItemString(1,"Age",AgeEle.text);
            }
        }*/
        return 1;
    }
    int OnAddRow()
    {
        xdwtable dw_obj;
        xdwtable dw_contact;
        dw_contact = dw_detail.GetCurTable();
        string sDwname = dw_contact.GetDwName();
        if(sDwname.find("item") >=0 ) sDwname = dw_contact.GetParent().GetDwName();
        if(sDwname=="PartyContact")
        {
            int iRowPc = dw_contact.InsertRow(0);
        }
        else if(sDwname=="PartyAddress")
        {
            int iRowPad = dw_contact.InsertRow(0);
        }
        else if(sDwname=="PartyBankAccount")
        {
            int iRowPba = dw_contact.InsertRow(0);
        }
        int h=m_layer.GetSheetIndex();
        int nindex = h+1;
        //alert(nindex.toString());
        if(nindex==5)
        {
            dw_obj=GetControl("dw_jzfx");
            xdwtable dw = dw_obj.GetCurTable();
            int row = dw.InsertRow(1, 0);
            dw.SetItemString(row,"SeqNo",row.toString());
        }
        if(nindex==4)
        {
            dw_obj=GetControl("dw_visit");
            xdwtable dw1 = dw_obj.GetCurTable();
            int row1 = dw1.InsertRow(0);
        }
        if(nindex==3)
        {
            dw_obj=GetControl("dw_MeetingsEx");
            xdwtable dw3 = dw_obj.GetCurTable();
            int row3 = dw3.InsertRow(0);
        }
        if(nindex==2)
        {
            dw_obj=GetControl("dw_Meetings");
            xdwtable dw2 = dw_obj.GetCurTable();
            int row2 = dw2.InsertRow(0);
        }
        return 0;
    }
    int OnInsertRow()
    {
        xdwtable dw_obj;
        xdwtable dw_contact;
        dw_contact = dw_detail.GetCurTable();
        string sDwname = dw_contact.GetDwName();
        if(sDwname.find("item") >=0 ) sDwname = dw_contact.GetParent().GetDwName();
        if(sDwname=="PartyContact")
        {
            int iRowPc = dw_contact.InsertRow(dw_contact.GetRow());
        }
        else if(sDwname=="PartyAddress")
        {
            int iRowPad = dw_contact.InsertRow(dw_contact.GetRow());
        }
        else if(sDwname=="PartyBankAccount")
        {
            int iRowPba = dw_contact.InsertRow(dw_contact.GetRow());
        }
        int h=m_layer.GetSheetIndex();
        int nindex = h+1;
        if(nindex==5)
        {
            dw_obj=GetControl("dw_jzfx");
            xdwtable dw = dw_obj.FindDwTable("CustomerJzfx");
            int row = dw.InsertRow(1,dw.GetRow());
            //dw.SetGuid(row,publiccode::GetGuid());
        }
        if(nindex==4)
        {
            dw_obj=GetControl("dw_visit");
            xdwtable dw1 =dw_obj.GetCurTable();
            int row1 = dw1.InsertRow(dw1.GetRow());
        }
        if(nindex==3)
        {
            dw_obj=GetControl("dw_MeetingsEx");
            xdwtable dw3 =dw_obj.GetCurTable();
            int row3 = dw3.InsertRow(dw3.GetRow());
        }
        if(nindex==2)
        {
            dw_obj=GetControl("dw_Meetings");
            xdwtable dw2 =dw_obj.GetCurTable();
            int row2 = dw2.InsertRow(dw2.GetRow());
        }
        return 0;
    }
    int OnDeleteRow()
    {
        xdwtable dw_obj;
        xdwtable dw_contact;
        dw_contact = dw_detail.GetCurTable();
        string sDwname = dw_contact.GetDwName();
        if(sDwname.find("item") >=0 ) sDwname = dw_contact.GetParent().GetDwName();
        if(sDwname=="PartyContact" ||sDwname=="PartyAddress" ||sDwname=="PartyBankAccount" )
        {
            int row = dw_contact.GetRow();
            dw_contact.DeleteRow(row);
        }
        int h=m_layer.GetSheetIndex();
        int nindex = h+1;
        if(nindex==5)
        {
            dw_obj=GetControl("dw_jzfx");
            xdwtable dw = dw_obj.GetCurTable();
            int row1 = dw.GetRow();
            if(dw.GetRowCount() >1)
                dw.DeleteRow(row1);
        }
        if(nindex==4)
        {
            dw_obj=GetControl("dw_visit");
            xdwtable dw1 = dw_obj.GetCurTable();
            int row2 = dw1.GetRow();
            dw1.DeleteRow(row2);
        }
        if(nindex==3)
        {
            dw_obj=GetControl("dw_MeetingsEx");
            xdwtable dw4 = dw_obj.GetCurTable();
            int row4 = dw4.GetRow();
            dw4.DeleteRow(row4);
        }
        if(nindex==2)
        {
            dw_obj=GetControl("dw_Meetings");
            xdwtable dw3 = dw_obj.GetCurTable();
            int row3 = dw3.GetRow();
            dw3.DeleteRow(row3);
        }
        return 0;
    }
    int OnDetailRow()
    {
        trace("detail");
        return 0;
    }
    int OnPreSave()
    {
        xml xxx = new xml;
        xxx.setNativePointer(xxx.CreateInstance());
        dw_detail.DwUpdateAllTo(xxx.GetXmlDoc());
        trace(xxx.GetXml());
        //return 0;
        //客户名称
        string sName;
        sName = dw_detail.GetItemString(1,"Name");
        if (sName == "")
        {
            alert("客户名称不能为空!");
            return 0;
        }
        string sShortName = dw_detail.GetItemString(1,"ShortName");
        if (sShortName == "")
        {
            alert("客户简称不能为空!");
            return 0;
        }
        string Level = dw_detail.GetItemString(1,"Level");
        /*if (Level == "")
        {
            alert("客户等级不能为空!");
            return 0;
        }*/
        /*
        if(dw_detail.GetItemString(1,"Address")=="")
        {
            alert("客户地址不能为空!");
            return 0;
        }
        if(dw_detail.GetItemString(1,"Source")=="")
        {
            alert("客户来源不能为空!");
            return 0;
        }
        if(dw_detail.GetItemString(1,"CountryCode")=="")
        {
            alert("客户国别不能为空!");
            return 0;
        }
        if(dw_detail.GetItemString(1,"TEL")=="")
        {
            alert("公司电话不能为空!");
            return 0;
        }*/
        //客户简称不能重复
        /*
        string sPartyID = GetPartyID(sShortName,"ShortName");
        if (sPartyID != "")
        {
            alert("此客户简称已经存在!");
        }
        */
        //客户代码
        string sPartyNo;
        sPartyNo = dw_detail.GetItemString(1,"PartyNo");
        if (sPartyNo == "" )
        {
            //alert("客户代码不能为空!");
            //return 0;
            string sNo = publiccode::GetIdentityNo("Party1");
            if (sNo == "")
                sNo == "1000";
            dw_detail.SetItemString(1,"PartyNo",sNo);
        }
        //成立时间YearEstablished
        //雇员数量Employees
        //string sYearEstablished = dw_detail.GetItemString(1,"YearEstablished");
        //string sEmployees = dw_detail.GetItemString(1,"Employees");
        //sYearEstablished.toInt();
        //联系人姓名Name-PCName,设置状态
        xdwtable dw_PartyContact;
        dw_PartyContact = dw_detail.FindDwTable("PartyContact");
        xdwtable PC_OtherInfo;
        PC_OtherInfo = dw_detail.FindDwTable("PC_OtherInfo");
        int countflag=0;
        if (dw_PartyContact)
        {
            int i;
            for (i=1;i <= dw_PartyContact.GetRowCount();i++)
            {
                string sPCName = dw_PartyContact.GetItemString(i,"Name");
                if (sPCName == "" )
                {
                    string sPCTitle = dw_PartyContact.GetItemString(i,"Title");
                    if (sPCTitle == "") sPCTitle = "";
                    string sPCJobTitle = dw_PartyContact.GetItemString(i,"JobTitle");
                    if (sPCJobTitle == "") sPCJobTitle = "";
                    string sPCGender = dw_PartyContact.GetItemString(i,"Gender");
                    if (sPCGender == "") sPCGender = "";
                    string sPCMobile = dw_PartyContact.GetItemString(i,"Mobile");
                    if (sPCMobile == "") sPCMobile = "";
                    string sPCTEL = dw_PartyContact.GetItemString(i,"TEL");
                    if (sPCTEL == "") sPCTEL = "";
                    string sPCEmail = dw_PartyContact.GetItemString(i,"Email");
                    if (sPCEmail == "") sPCEmail = "";
                    string sAll = sPCTitle + sPCJobTitle + sPCGender + sPCMobile + sPCTEL + sPCEmail;
                    /*if (sAll != "")
                    {
                        alert("联系人姓名不能为空");
                        return 0;
                    }*/
                }
                else
                {
                    string aStatus;
                    aStatus = dw_PartyContact.GetItemString(i,"Status",0);
                    if (aStatus=="")
                    {
                        dw_PartyContact.SetItemString(i,"Status","1");
                    }
                }
                if(dw_PartyContact.GetItemString(i,"ContactID")=="")
                {
                    dw_PartyContact.SetItemString(i,"ContactID",GetGuid());
                }
                string sFlag = dw_PartyContact.GetItemString(i,"PrimaryFlag");
                if(sFlag=="Y")
                {
                    countflag ++;
                    dw_PartyContact.SetItemString(i,"PrimaryFlag","Y");
                    PC_OtherInfo.SetItemString(1,"ContactID",dw_PartyContact.GetItemString(i,"ContactID"));
                }
            }
            if(countflag==0 && dw_PartyContact.GetItemString(1,"Name") !="")
            {
                dw_PartyContact.SetItemString(1,"PrimaryFlag","Y");
                PC_OtherInfo.SetItemString(1,"ContactID",dw_PartyContact.GetItemString(1,"ContactID"));
            }
        }
        //银行帐号BankName-BankName;BankAccountNo-PBABankAccountNo ï¼› è®¾ç½®çŠ¶æ€
        xdwtable dw_PartyBankAccount;
        dw_PartyBankAccount =dw_detail.FindDwTable("PartyBankAccount");
        if (dw_PartyBankAccount)
        {
            int j;
            for (j=1;j <= dw_PartyBankAccount.GetRowCount();j++)
            {
                string sPBABankName = dw_PartyBankAccount.GetItemString(j,"BankName");
                string sPBABankAccountNo = dw_PartyBankAccount.GetItemString(j,"BankAccountNo");
                if (sPBABankName == "") sPBABankName = "";
                if (sPBABankAccountNo == "") sPBABankAccountNo = "";
                string sPBAAll = sPBABankName + sPBABankAccountNo;
                if (sPBAAll != "")
                {
                    /*if (sPBABankName == "")
                    {
                        alert("银行名称不能为空");
                        return 0;
                    }
                    if (sPBABankAccountNo == "")
                    {
                        alert("银行账户不能为空");
                        return 0;
                    }*/
                    dw_PartyBankAccount.SetItemString(j,"Status","1");
                }
            }
        }
        //地址,设置状态
        xdwtable dw_PartyAddress;
        dw_PartyAddress =dw_detail.FindDwTable("PartyAddress");
        if (dw_PartyAddress)
        {
            int k;
            for (k=1;k <= dw_PartyAddress.GetRowCount();k++)
            {
                string sPADAddressName = dw_PartyAddress.GetItemString(k,"AddressName");
                string sPADAddress = dw_PartyAddress.GetItemString(k,"Address");
                if (sPADAddressName == "") sPADAddressName = "";
                if (sPADAddress == "") sPADAddress = "";
                string sPADAll = sPADAddressName + sPADAddress;
                if (sPADAll != "")
                {
                    dw_PartyAddress.SetItemString(k,"Status","1");
                    dw_PartyAddress.SetItemString(k,"IdentifyAddressFlag","N");
                }
            }
        }
        return 1;
    }
    int DoUpdate(bool showSuccess = true)
    {
        int rec =OnPreSave();
        if (rec != 1)    return 0;
        ProcessFlowAction("action:bill.update",1);
        return 1;
    }
    int CustomerModify()//跳到客户修改界面
    {
        //trace("asdsad");
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg("EntityID", maint::m_EntityID);
        openUrl("/sale/view/"+GetEntityName(1)+"/worknode/customermodify/open",arg);
        //CloseWindow();
        return 1;
    }
    int OnComdidSplit(string str){
        if(str.find("|", 0)<0)
            return -1;
        CustomerGoodsHWND = str.mid(str.find("|",0) + 1, str.length());
    }
    int OnShare()
    {
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        int row = dw_detail.GetRow();
        if(row < 1) return 0;
        string PartyID = dw_detail.GetItemString(row,"PartyID");
        arg.AddArg("EntityID",PartyID);
        arg.AddArg("EntityName", "客户共享");
        OpenWindow("dev:xpage[UserGroupShare.vx]",cast(arg as int));
        return 1;
    }
    int OnShareMessage()
    {
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        int row = dw_detail.GetRow();
        if(row < 1) return 0;
        string PartyID = dw_detail.GetItemString(row,"PartyID");
        arg.AddArg("PartyID",PartyID);
        OpenWindow("dev:xpage[XmShare.Custumer.v3.vx]",cast(arg as int));
    return 1;
    }
    int PreOnCmdDispatch(string comdid)
    {
        if (comdid == "cb_save")
        {
            win32::SendMessage(CustomerGoodsHWND.toInt(),0x401, "cb_save", 0);
        }
        else if (comdid == "cb_copy")
        {
            win32::SendMessage(CustomerGoodsHWND.toInt(),0x401, "cb_copy", 0);
        }
        else if (comdid == "cb_delete")
        {
            win32::SendMessage(CustomerGoodsHWND.toInt(),0x401, "cb_delete", 0);
        }
        else if (comdid == "cb_reflash")
        {
            win32::SendMessage(CustomerGoodsHWND.toInt(),0x401, "cb_reflash", 0);
        }
        else if(comdid == "cb_add")
        {
            win32::SendMessage(CustomerGoodsHWND.toInt(),0x401, "cb_add", 0);
        }
        else if(comdid == "cb_import")
        {
            win32::SendMessage(CustomerGoodsHWND.toInt(),0x401, "cb_import",0);
        }
        else if (comdid == "action:bill.row.add") return OnAddRow();
        else if (comdid == "action:bill.row.insert") return OnInsertRow();
        else if (comdid == "action:bill.row.delete") return OnDeleteRow();
        else if (comdid == "action:bill.row.detail") return OnDetailRow();
        else if (comdid == "action:bill.SourceRemark") return OnSourceRemark();
        else if (comdid == "action:bill.update")
        {
             return OnPreSave();
        }
        else if (comdid == "action:customermodify") return CustomerModify();
        else if(comdid.find("|",0)){
            OnComdidSplit(comdid);
        }
        if(comdid=="action:XmShare")
        {
                OnShare();
                return 0;
        }
        if(comdid=="action:XmShareMessage")
        {
                OnShareMessage();
                return 0;
        }
    //    else if (comdid.find("action:",0) >= 0) return OnAction(comdid);
        return -1;
    }
    int PostOnCmdDispatch(string comdid)
    {
        if (comdid == "action:bill.update")
        {
            dw_detail.ResetUpdateStatus();
            dw_visit.ResetUpdateStatus();
            dw_Meetings.ResetUpdateStatus();
            dw_MeetingsEx.ResetUpdateStatus();
        }
        return 1;
    }
    //选择tab页面
    int OnSelectedSheet(ref TNotifyEvent evt,int p)
    {
        iLayer = m_layer.GetSheetIndex();
        if (iLayer == 0)
            SetAgent("maint",maint::m_EntityID);
        else if (iLayer == 1)
        {
            int cc=APP;
            cc=cc +1;
            APP=cc;
            if(cc==2)
            {
                xsheet.DeleteSheet(1);
                string xp = "<xframe src='dev:xpage[CustomerGoodsVd.vx]' />";
                xaserverarg arg = new xaserverarg;
                arg.setNativePointer(arg.CreateInstance());
                arg.AddArg("CustomerID", this.m_EntityID);
                arg.AddArg("FROM", "Customer");
                arg.AddArg("CustomerName", dw_detail.GetItemString(1,"Name"));
                arg.AddArg("config", "客户产品.vface/config/CustomerGoodsVdVd/view");
                arg.AddArg("CustomerHWND",this.GetHWND().toString());
                int p1 =arg.ptr_native_;
                int nIndex = xsheet.InsertSheet(-1, "客户ID货号库", xp, p1);
                xsheet.SelectSheet(nIndex);
            }
            //win32::SendMessage(CustomerGoodsHWND.toInt(),0x401, "SetFocus", nil);
        }
        return 1;
    }
    int OnSourceRemark()
    {
        string name = "客户管理";
        xml x = ViewObject::RetrieveData("/sale/data/TradeFinance3/GetSetUpRemarks","Type",name);
        msxml::IXMLDOMNodeList items = x.GetXmlDoc().selectNodes("data/Item");
        msxml::IXMLDOMNode t = items.item(0);
        string Content="";
        if(t.selectSingleNode("Content"))
        {
            Content=t.selectSingleNode("Content").text;
        }
        xaserverarg arg1 = new xaserverarg;
        arg1.setNativePointer(arg1.CreateInstance());
        arg1.AddArg("value",Content);
        OpenWindow("dev:xpage[memo.edit.new.vx]",arg1.getNativePointer());
        return 1;
    }
    int OnItemClick(ref TNotifyEvent evt,int p)
    {
        xdwtable dw = dw_detail.FindDwTable("item1",0);
        xdwtable dw1 = dw_detail.FindDwTable("item2",0);
        xdwtable dw2 = dw_detail.FindDwTable("item3",0);
        int start=dw_detail.GetCellRowFromRowColumn(1,dw_detail.GetColumnIndex("Website"));
        int m,n,k;
        m=dw.GetRowCount();
        n=dw1.GetRowCount();
        k=dw2.GetRowCount();
        if(dw.GetRowCount()==0)
        {
            m=dw.GetRowCount() +1;
        }
        if(dw1.GetRowCount()==0)
        {
            n=dw1.GetRowCount() +1;
        }
        if(dw2.GetRowCount()==0)
        {
            k=dw2.GetRowCount() +1;
        }
        ref DWNMHDR  hdr = cast(evt.pnmh as ref DWNMHDR);
        string value = hdr.data;
        //alert(value);
        xaserverarg arg=new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        if(value == "主要联系人其它信息")
        {
            dw_detail.ExpandCellRow(start +m +5,start +m+7);
        }
        else if(value == "其它地址")
        {
            dw_detail.ExpandCellRow(start +m+9,start +m+9+n);
            //dw_base.ExpandMarginRow(-22,-20);
        }
        else if(value == "银行信息")
        {
            dw_detail.ExpandCellRow(start +m+11+n,start +m+11+n+k);
            //dw_base.ExpandMarginRow(-22,-20);
        }
        else if(value == "业务概述")
        {
            dw_detail.ExpandCellRow(start +m+13+n+k,start +m+13+n+k+2);
            //dw_base.ExpandMarginRow(-22,-20);
        }
        else if(value == "客户授信")
        {
            dw_detail.ExpandCellRow(start +m+15+n+k +2,start +m+15+n+k +2+1);
            //dw_base.ExpandMarginRow(-22,-20);
        }
        if(value == "客户资料附件")
        {
            if(userno == "admin" || userno == "00601" || userno == "00701")
             {
                //alert(dw_detail.GetGuid(1));
                arg.AddArg("entityid",dw_detail.GetGuid(1));
                int p3=cast(arg as int) ;
                OpenWindow("dev:xpage[maint.Document.Customer.v3.vx]", p3);
                return 1;
            }
        }
        if(value == "客户基本信息")
        {
            xaserverarg arg1 = new xaserverarg;
            arg1.setNativePointer(arg1.CreateInstance());
            string str = dw_detail.GetItemString(1,"BasicInformation");
            arg1.AddArg("value",str);
            OpenWindow("dev:xpage[memo.edit.new.vx]",arg1.getNativePointer());
            if(arg1.GetArgString("comdid")=="xmOK")
            {
                str = arg1.GetArgString("value");
                dw_detail.AcceptText();
                dw_detail.SetItemString(1,"BasicInformation",str);
            }
            return 1;
        }
        return 1;
    }
    int OnItemClickEx(ref TNotifyEvent evt,int p)
    {
        xdwtable dw = dw_visit.FindDwTable("item",0);
        ref DWNMHDR  hdr = cast(evt.pnmh as ref DWNMHDR);
        string value = hdr.data;
        int row = hdr.row;
        //alert(value);
        xaserverarg arg=new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        if(value == "上传")
        {
            if(dw.GetGuid(dw.GetRow())=="")
            {
                alert("保存后在上传!");
                return 1;
            }
            arg.AddArg("entityid",dw.GetGuid(dw.GetRow()));
            int p4=cast(arg as int) ;
            OpenWindow("dev:xpage[maint.Document.Customer.v3.vx]", p4);
            return 1;
        }
        return 1;
    }
    int OnItemClickExS(ref TNotifyEvent evt,int p)
    {
        xdwtable dw = dw_Meetings.FindDwTable("item",0);
        ref DWNMHDR  hdr = cast(evt.pnmh as ref DWNMHDR);
        string value = hdr.data;
        int row = hdr.row;
        //alert(value);
        xaserverarg arg=new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        if(value == "附件上传")
        {
            if(dw.GetGuid(dw.GetRow())=="")
            {
                alert("保存后在上传!");
                return 1;
            }
            arg.AddArg("entityid",dw.GetGuid(dw.GetRow()));
            int p4=cast(arg as int) ;
            OpenWindow("dev:xpage[maint.Document.Customer.v3.vx]", p4);
            return 1;
        }
        if(value == "人员")
        {
            xaserverarg arg2 = new xaserverarg;
            arg2.setNativePointer(arg2.CreateInstance());
            xaserverarg parg2 = GetParam();
            OpenWindow("dev:xpage[UserGroupPersonSelect.vx]",cast(arg2 as int));
            if(arg2.GetArgString("comdid")=="xmOk")
            {
                string data = arg2.GetArgString("data");
                xml x2 = new xml;
                x2.setNativePointer(xml::CreateInstance());
                x2.LoadXml(data);
                msxml::IXMLDOMNodeList nodes = x2.GetXmlDoc().selectNodes("/root/item");
                trace(x2.GetXml());
                int len = nodes.length;
                string Names = "";
                for(int i=0;i<len; i++)
                {
                    msxml::IXMLDOMElement t= nodes.item(i);
                    if(t.getAttribute("Name"))
                    {
                        string Name = t.getAttribute("Name");
                        if(Names=="")
                            Names = Name;
                        else if(Names.find(Name) < 0) Names+=","+Name;
                    }
                }
                dw.SetItemString(dw.GetRow(),"CMPersonnel",Names);
            }
            return 1;
        }
        return 1;
    }
    int OnItemClickExSS(ref TNotifyEvent evt,int p)
    {
        xdwtable dw = dw_MeetingsEx.FindDwTable("item",0);
        ref DWNMHDR  hdr = cast(evt.pnmh as ref DWNMHDR);
        string value = hdr.data;
        int row = hdr.row;
        //alert(value);
        xaserverarg arg=new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        if(value == "附件上传")
        {
            if(dw.GetGuid(dw.GetRow())=="")
            {
                alert("保存后在上传!");
                return 1;
            }
            arg.AddArg("entityid",dw.GetGuid(dw.GetRow()));
            int p4=cast(arg as int) ;
            OpenWindow("dev:xpage[maint.Document.Customer.v3.vx]", p4);
            return 1;
        }
        if(value == "人员")
        {
            xaserverarg arg2 = new xaserverarg;
            arg2.setNativePointer(arg2.CreateInstance());
            xaserverarg parg2 = GetParam();
            OpenWindow("dev:xpage[UserGroupPersonSelectEx.vx]",cast(arg2 as int));
            if(arg2.GetArgString("comdid")=="xmOk")
            {
                string data = arg2.GetArgString("data");
                xml x2 = new xml;
                x2.setNativePointer(xml::CreateInstance());
                x2.LoadXml(data);
                msxml::IXMLDOMNodeList nodes = x2.GetXmlDoc().selectNodes("/root/item");
                trace(x2.GetXml());
                int len = nodes.length;
                string Names = "";
                for(int i=0;i<len; i++)
                {
                    msxml::IXMLDOMElement t= nodes.item(i);
                    if(t.getAttribute("Name"))
                    {
                        string Name = t.getAttribute("Name");
                        if(Names=="")
                            Names = Name;
                        else if(Names.find(Name) < 0) Names+=","+Name;
                    }
                }
                dw.SetItemString(dw.GetRow(),"CMPersonnel",Names);
            }
            return 1;
        }
        return 1;
    }
    int PostOnAttachEvent()
    {
        AttachEvent("dw_detail","DWV_ITEMCHANGED",OnItemChanged);
        //AttachEvent("tab_1","LYSN_SELECTEDSHEET",OnSelectedSheet);
        AttachEvent("dw_detail","DWV_CLICKED",OnItemClick);
        AttachEvent("dw_visit","DWV_CLICKED",OnItemClickEx);
        AttachEvent("dw_Meetings","DWV_CLICKED",OnItemClickExS);
        AttachEvent("dw_MeetingsEx","DWV_CLICKED",OnItemClickExSS);
        return 1;
    }
    int onload()
    {
        maint::onload();
    }
    int onloaded()
    {
        APP=1;
        maint::onloaded();
        m_layer = GetControl("tab_1");
        dw_detail = GetControl("dw_detail");
        dw_detail.SetColHeaderHeight(16);
        dw_power = GetControl("dw_power");
        dw_require =GetControl("dw_require");
        dw_jzfx = GetControl("dw_jzfx");
        dw_visit = GetControl("dw_visit");
        dw_Meetings = GetControl("dw_Meetings");
        dw_MeetingsEx = GetControl("dw_MeetingsEx");
        //添加客户产品附页
        xsheet = GetControl("tab_1");
        //string xp = "<xframe src='dev:xpage[CustomerGoodsVd.vx]' />";
        /*xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg("CustomerID", this.m_EntityID);
        arg.AddArg("CustomerName", dw_detail.GetItemString(1,"Name"));
        arg.AddArg("config", "客户产品.vface/config/CustomerGoodsNewVd/view");
        arg.AddArg("CustomerHWND",this.GetHWND().toString());
        //trace(this.m_EntityID);
        int p =arg.__nativept;*/
        //int nIndex = xsheet.InsertSheet(-1, "客户ID货号库", xp, 0);
        //xsheet.SelectSheet(nIndex);
        //xsheet.SelectSheet(0);
        //默认收缩
        /*xdwtable dw = new xdwtable;
        dw.setNativePointer(dw_detail.FindDwTable("PartyAddress",0));
        xdwtable dw1 = new xdwtable;
        dw1.setNativePointer(dw_detail.FindDwTable("PartyBankAccount",0));
        xdwtable dw2 = new xdwtable;
        dw2.setNativePointer(dw_detail.FindDwTable("PartyContact",0));
        int start=dw_detail.GetCellRowFromRowColumn(1,dw_detail.GetColumnIndex("Website"));
        dw_detail.ExpandCellRow(start + dw2.GetRowCount() +3,start +dw2.GetRowCount()+5);
        int start1=dw_detail.GetCellRowFromRowColumn(1,dw_detail.GetColumnIndex("Website"));
        dw_detail.ExpandCellRow(start1 + dw2.GetRowCount() +7,start1 + dw2.GetRowCount() +7 +dw.GetRowCount());
        int start2=dw_detail.GetCellRowFromRowColumn(1,dw_detail.GetColumnIndex("Website"));
        dw_detail.ExpandCellRow(start2 + dw2.GetRowCount() +9 +dw.GetRowCount(),start2 + dw2.GetRowCount() +9 +dw.GetRowCount() +dw1.GetRowCount());
        int start3=dw_detail.GetCellRowFromRowColumn(1,dw_detail.GetColumnIndex("YearEstablished"));
        dw_detail.ExpandCellRow(start3,start3 +2);
        int start4=dw_detail.GetCellRowFromRowColumn(1,dw_detail.GetColumnIndex("CompanyCredit"));
        dw_detail.ExpandCellRow(start4,start4 +1);    */
        //默认收缩
        xdwtable dw = dw_detail.FindDwTable("item1",0);
        xdwtable dw1 = dw_detail.FindDwTable("item2",0);
        xdwtable dw2 = dw_detail.FindDwTable("item3",0);
        int m,n,k;
        m=dw.GetRowCount();
        n=dw1.GetRowCount();
        k=dw2.GetRowCount();
        if(dw.GetRowCount()==0)
        {
            m=dw.GetRowCount() +1;
        }
        if(dw1.GetRowCount()==0)
        {
            n=dw1.GetRowCount() +1;
        }
        if(dw2.GetRowCount()==0)
        {
            k=dw2.GetRowCount() +1;
        }
        //trace(dw2.GetRowCount());
        int start=dw_detail.GetCellRowFromRowColumn(1,dw_detail.GetColumnIndex("Website"));
        dw_detail.ExpandCellRow(start +m +5,start +m+7);
        //trace(start +k +3);
        dw_detail.ExpandCellRow(start +m+9,start +m+9+n);
        //trace(start +k+7);
        dw_detail.ExpandCellRow(start +m+11+n,start +m+11+n+k);
        //trace(start +k+10+m);
        dw_detail.ExpandCellRow(start +m+13+n+k,start +m+13+n+k+2);
        //trace(start +k+14+m+n);
        dw_detail.ExpandCellRow(start +m+15+n+k +2,start +m+15+n+k +2+1);
        //trace(start +k+16+m+n +2);
        if (!maint::m_EntityID)
        {
            OnInit();
        }else
        {
            //string userno = publiccode::getUserNo();
            userno = xaserver::GetUserNo();
            if(userno !="00601" && userno !="admin" && userno !="00701")
            {
                dw_detail.SetColumnProp("SalesPersonID","cellprotect","1");
            }
        }
        if (GetParam())
        {
            int iArgs = GetParam();
            xaserverarg args = new xaserverarg;
            args.setNativePointer(iArgs);
            //alert(args.GetString());
            string CustomerGood = args.GetArgString("CustomerGood");
            ApplyStatus= args.GetArgString("CustomerGood");
            if(CustomerGood=="Y")
            {
                xsheet.DeleteSheet(0);
                string xp = "<xframe src='dev:xpage[CustomerGoodsVd.vx]' />";
                xaserverarg arg = new xaserverarg;
                arg.setNativePointer(arg.CreateInstance());
                arg.AddArg("CustomerID", this.m_EntityID);
                arg.AddArg("FROM", "Customer");
                arg.AddArg("CustomerName", dw_detail.GetItemString(1,"Name"));
                arg.AddArg("config", "客户产品.vface/config/CustomerGoodsVdVd/view");
                arg.AddArg("CustomerHWND",this.GetHWND().toString());
                int p1 =arg.ptr_native_;
                int nIndex = xsheet.InsertSheet(-1, "客户ID货号库", xp, p1);
                xsheet.SelectSheet(nIndex);
                //xsheet.SetSheetState(0, 0);
            }
            ApplyStatus=dw_detail.GetItemString(1,"ApplyStatus");
            if(userno !="00601" && userno !="admin" && userno !="00701")
            {
                if(ApplyStatus =="财务已审核")
                {
                    dw_detail.SetReadOnly(true);
                }
            }
            dw_detail.SetEditUpperMode(true);
            dw_visit.SetEditUpperMode(true);
            dw_Meetings.SetEditUpperMode(true);
            dw_MeetingsEx.SetEditUpperMode(true);
        }
        return 1;
    }
};
jrj/project/business/Enquiry.list.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,1705 @@
class Enquiry3list : public listwin
{
    string m_sType; //树选中的类型
    string m_sTypeTxt; //树选中的数据
    string urlTree;
    string myDataUrl;
    string myDataUrl1;
    xcombobox ddlb_1;
    xtreeview tv_folder;
    xtreeview tv_folder_pricebill;
    xdwgrid dw_goods;
    xdwgrid dw_list1;
    xdwgrid dw_list2;
    xdwgrid dw_goods1;
    xdwgrid dw_goods2;
    xdwgrid dw_pricelist;
    xdwgrid dw_pricelistex;
    xdwgrid dw_priceitem;
    xdwgrid dw_pricelistshare;
    int changeddlb;
    int state1;
    int state2;
    string sheetname;
    xnode    m_agentNode;
    int SetAgentEx()
    {
        string xfNodeAgentArea  = "agentarea";
        xnode anode = GetAgentNode(xfNodeAgentArea);
        /*if(m_agentNode)
        {
            SetAgentNodeContent (anode,m_agentNode);
        }
        else
        {*/
            msxml::IXMLDOMElement xframeElement =  GetElement();
            msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[@id='"+sheetname+"']/*");
            if(agent)
            {
                string s = agent.xml;
                m_agentNode =  SetAgentNodeContent (anode,s);
            }
        //}
        return 1;
    }
    int SetAgent1(string scene, string EntityID)
    {
        string xfNodeAgentArea  = "agentarea";
        xnode anode = GetAgentNode(xfNodeAgentArea);
        msxml::IXMLDOMElement xframeElement =  GetElement();
        msxml::IXMLDOMNode agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*");
        xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg("scene",scene,"xs:string");
        arg.AddArg("EntityID",EntityID,"xs:string");
        arg.AddArg("EntityName",GetEntityName(1),"xs:string");
        url::get("/workflow/query/datarole/"+GetEntityName(1),arg.GetString(),x);
        SetObjectInfo(x.GetXmlDoc().documentElement);
        string sNodes;
        sNodes = "datarole/actions/action[contains(@scene,'"+ scene + "')]";
        msxml::IXMLDOMNodeList nlist = x.GetXmlDoc().SelectNodes(sNodes);
        int  index;
        int  nlen = nlist.length;
        msxml::IXMLDOMElement ele;
        string tools="<vbox class=''>";
        if(scene=="list") tools +="<xspace height='12'/>";
        for(index=0;index<nlen;index++)
        {
            ele  =  nlist.item(index);
            string name = ele.selectSingleNode("@id").text;//.getAttribute("id");
            string label  =  ele.selectSingleNode("@caption").text;//ele.getAttribute("caption");
            string image;
            string src = "";
            if(ele.selectSingleNode("@image"))
                image = ele.selectSingleNode("@image").text;
            else
                image = "0 22";
            if(ele.selectSingleNode("@src"))
                src = ele.selectSingleNode("@src").text;
            string tool;
            if (src != "")
                tool = "<xtoolbutton src='"+src+"'  caption='"+label+"' name='action:"+name+"' height='23' style='background-color:none #ceecce  none #ffffff'/>";
            else
                tool = "<xtoolbutton image='"+image+"'  caption='"+label+"' name='action:"+name+"' height='23'  style='background-color:none #ceecce none #ffffff'/>";
            tools += tool;
        }
        /*if(agent)
        {
            nlist = agent.SelectNodes(".//xtoolbutton");
            nlen = nlist.length;
            for(index=0;index<nlen;index++)
            {
                ele  =  nlist.item(index);
                string tmp = ele.xml;
                tools += tmp;
            }
        }*/
        tools +="</vbox>";
        //trace(tools);
        SetAgentNodeContent(anode, tools);
        return 1;
    }
    int SetAgent(string scene, string EntityID)
    {
        if(sheetname !="tab_pricebill" && sheetname !="tab_pricebillex"  && sheetname !="tab_pricebillshare" && sheetname !="tab_list2")
            SetAgent1(scene,EntityID);
        else
            SetAgentEx();
        return 1;
    }
    //process tree
    //查找当前树项的顶级目录
    int LookupTopFolder(xtreeview tv_folder, int hItem)
    {
        int hRoot = tv_folder.GetRootItem();
        while(tv_folder.GetParentItem(hItem)) hItem = tv_folder.GetParentItem(hItem);
        return hItem;
    }
    int ExpandCatChildFolder(xtreeview tv_folder, int hItem, msxml::IXMLDOMElement ele ,int image)
    {
        msxml::IXMLDOMNodeList nlist = ele.SelectNodes("item");
        int len = nlist.length;
        if(len > 0) tv_folder.SetItemChild(hItem,1);
        for (int i= 0; i < len; i++)
        {
            msxml::IXMLDOMElement e = nlist.item(i);
            string name = e.getAttribute("name");
            int h = tv_folder.InsertChildItem(hItem,name, trust(e as int),image);
            ExpandCatChildFolder(tv_folder,h,e,35);
        }
        return 1;
    }
    int ExpandFolderItem(xtreeview tv_folder, int hItem,string no)
    {
        xml x = ViewObject::RetrieveData(urlTree,"no",no);
        //if(x) alert(x.GetXml());
        if(!x) return 0;
        msxml::IXMLDOMNodeList nlist = x.GetXmlDoc().SelectNodes("/data/item");
        int len = nlist.length;
        for (int i = 0; i < len; i++)
        {
            msxml::IXMLDOMElement e = nlist.item(i);
            string name = e.getAttribute("name");
            int h = tv_folder.InsertChildItem(hItem,name, trust(e as int),35);
            ExpandCatChildFolder(tv_folder,h,e,35);
        }
        return 1;
    }
    //树展开
    int OnTreeExpanding(ref TNotifyEvent evt,int p)
    {
        ref NMTREEVIEW nmtv = evt.pnmh;
        int hItem = nmtv.itemNew.hItem;
        int hTopItem = LookupTopFolder(tv_folder,hItem);
        string name = tv_folder.GetItemLabel(hTopItem);
        int child = tv_folder.GetChildItem(hItem);
        msxml::IXMLDOMElement e = tv_folder.GetItemData(hItem);
        if(!child)ExpandFolderItem(tv_folder,hItem, e.getAttribute("no"));
        return 1;
    }
    int OnPriceBillTreeExpanding(ref TNotifyEvent evt,int p)
    {
        ref NMTREEVIEW nmtv = evt.pnmh;
        int hItem = nmtv.itemNew.hItem;
        int hTopItem = LookupTopFolder(tv_folder_pricebill,hItem);
        string name = tv_folder_pricebill.GetItemLabel(hTopItem);
        int child = tv_folder_pricebill.GetChildItem(hItem);
        msxml::IXMLDOMElement e = tv_folder_pricebill.GetItemData(hItem);
        if(!child)ExpandFolderItem(tv_folder_pricebill,hItem, e.getAttribute("no"));
        return 1;
    }
    int  ExpandChildFolder(xtreeview tv_folder, int hItem, msxml::IXMLDOMElement pElement)
    {
        msxml::IXMLDOMNodeList nlist = pElement.SelectNodes("Item");
        int len = nlist.length;
        for (int i = 0; i < len; i++)
        {
            msxml::IXMLDOMElement e = nlist.item(i);
            string name = e.getAttribute("name");
            string sImage = e.getAttribute("image");
            string child = e.getAttribute("child");
            int image = 15;
            if(sImage) image = sImage.toInt();
            int h= tv_folder.InsertChildItem(tv_folder.GetId(),hItem,name, trust(e as int),image);
            if(child !="no" ) tv_folder.SetItemChild(h,1);
            ExpandChildFolder(tv_folder,h,e);
        }
        return 1;
    }
    int  InitialFolder()
    {
        msxml::IXMLDOMElement xframeElement =  GetElement();
        msxml::IXMLDOMElement e =  xframeElement.selectSingleNode("//xtree[@name='tv_folder']/initial");
        if(e)ExpandChildFolder(tv_folder, 0,e);
        return 1;
    }
    int  InitialFolderPriceBill()
    {
        msxml::IXMLDOMElement xframeElement =  GetElement();
        msxml::IXMLDOMElement e =  xframeElement.selectSingleNode("//xtree[@name='tv_folder_pricebill']/initial");
        if(e)ExpandChildFolder(tv_folder_pricebill,0,e);
        return 1;
    }
    int OnTreeSelChanged(ref TNotifyEvent evt,int p)
    {
        //OnPriceBillRetrieve();
        //OnProductPriceBillRetrieve();
        return OnPreRetrieve();
    }
    int OnPriceBillTreeSelChanged(ref TNotifyEvent evt,int p)
    {
        OnPriceBillRetrieve();
        OnProductPriceBillRetrieve();
        return 1;
    }
    int OnSaveShare()
    {
        dw_pricelistshare.AcceptText();
        xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        dw_pricelistshare.DwUpdateAllToEx(x.GetXmlDoc());
        arg.AddArg("content", x.GetXml() );
        if(url::get("/sale/data/UserGroup/update/entity", arg.GetString(),x)!=1)
        {
            string error = x.GetXmlDoc().text;
            alert("err:"+error);
            return 1;
        }else
        {
            string str = x.GetXmlDoc().documentElement.getAttribute("text");
            if(str == "true")
            {
                alert("保存成功!");
                dw_pricelistshare.ResetUpdateStatus();
            }else
            {
                alert("保存失败!");
            }
        }
        if(x) x.Free();
        return 1;
    }
    int Send(string PersonID, string CName,string NO,string EntityID)
    {
        xml x = ViewObject::RetrieveData("/sale/data/business/message/getUserNO","PersonID",PersonID);
        msxml::IXMLDOMNodeList nlist = x.GetXmlDoc().SelectNodes("//data/Item");
        msxml::IXMLDOMElement xitem = nlist.item(0);
        string Reciever = xitem.selectSingleNode("userno").text;
        string Subject = "价格单已共享["+CName+"]";
        string Category = "价格单共享";
        string Content  = "";
        x = ViewObject::AddMessage(Category,Reciever, NO, EntityID, Subject, Content);
        return 1;
    }
    int SendNotice(xml content)
    {
        msxml::IXMLDOMNodeList nlist = content.GetXmlDoc().SelectNodes("//root/item[@update.new='1']");
        int leng = nlist.length;
        for(int i = 0; i < leng; i++)
        {
            msxml::IXMLDOMElement xitem = nlist.item(i);
            string PersonID = xitem.selectSingleNode("PersonID").text;
            string UserGroupID = xitem.selectSingleNode("UserGroupID").text;
            string CName = xitem.selectSingleNode("CName").text;
            string NO = xitem.selectSingleNode("NO").text;
            string EntityID = xitem.selectSingleNode("EntityID").text;
            if(PersonID != "")
            {
                Send(PersonID,CName,NO,EntityID);
            }
            if(UserGroupID != "")
            {
                xml x = ViewObject::RetrieveData("/sale/data/business/message/getPersonIDByGroup","UserGroupID",UserGroupID);
                msxml::IXMLDOMNodeList nlist1 = x.GetXmlDoc().SelectNodes("//data/Item");
                for(int j = 0 ; j < nlist1.length ; j++)
                {
                    msxml::IXMLDOMElement xitem1 = nlist1.item(j);
                    PersonID = xitem1.selectSingleNode("PersonID").text;
                    Send(PersonID,CName,NO,EntityID);
                }
            }
            return 1;
        }
        return 1;
    }
    int OnSave()
    {
        dw_pricelist.AcceptText();
        dw_pricelistex.AcceptText();
        dw_pricelistshare.AcceptText();
        xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        dw_pricelistex.DwUpdateAllToEx(x.GetXmlDoc());
        if(x.GetXml()!="")
        {
            string error = "";
            string str = "";
            arg.AddArg("content", x.GetXml());
            if(url::get("/sale/data/Enquiry/update/pricelistex", arg.GetString(),x)!=1)
            {
                error = x.GetXmlDoc().text;
                alert(error);
                return 1;
            }
            else
            {
                str = x.GetXmlDoc().documentElement.getAttribute("text");
                if(str == "true")
                {
                    dw_pricelistex.ResetUpdateStatus();
                }else
                {
                    alert("成品价格单保存失败!");
                    return 1;
                }
            }
            xml x0 = new xml;
            x0.setNativePointer(xml::CreateInstance());
            dw_pricelist.DwUpdateAllToEx(x0.GetXmlDoc());
            if(x0.GetXml() !="")
            {
                xml x1 = xml::Make();
                dw_priceitem.DwUpdateAllToEx(x1.GetXmlDoc());
                if(x0.GetXmlDoc().documentElement)
                {
                    if(x1.GetXmlDoc().documentElement)
                        x0.GetXmlDoc().documentElement.appendChild(x1.GetXmlDoc().documentElement);
                }
                x1.Free();
                arg.AddArg("content", x0.GetXml() );
                x0.Free();
                if(url::get("/sale/data/Enquiry/update/pricelist", arg.GetString(),x)!=1)
                {
                    error = x.GetXmlDoc().text;
                    alert(error);
                    return 1;
                }
                else
                {
                    str = x.GetXmlDoc().documentElement.getAttribute("text");
                    if(str == "true")
                    {
                        dw_pricelist.ResetUpdateStatus();
                        dw_priceitem.ResetUpdateStatus();
                    }else
                    {
                        alert("组件价格单保存失败!");
                        return 1;
                    }
                }
            }
        }
        xml x2 = new xml;
        x2.setNativePointer(xml::CreateInstance());
        dw_pricelistshare.DwUpdateAllToEx(x2.GetXmlDoc());
        arg.AddArg("content", x2.GetXml());
        if(url::get("/sale/data/UserGroup/update/entity", arg.GetString(),x)!=1)
        {
            error = x.GetXmlDoc().text;
            alert("err:"+error);
            return 1;
        }else
        {
            str = x.GetXmlDoc().documentElement.getAttribute("text");
            if(str == "true")
            {
                dw_pricelistshare.ResetUpdateStatus();
                alert("保存成功!");
                OnProductPriceShareRetrieve();//刷新数据
                SendNotice(x2);//发送通知
                x2.Free();
            }else
            {
                alert("共享数据保存失败!");
            }
        }
        x.Free();
        return 1;
    }
    int ViewUpdate(int pr,string updateItem,xaserverarg  arg)
    {
        if(    updateItem=="del")
        {
            int DelRow = dw_list.GetRow();
            dw_list.DeleteRow(DelRow);
        }
        else if(    updateItem=="setstate")
        {
            int row = this.dw_list.GetRow();
            if (row < 1) return 1;
            msxml::IXMLDOMElement ele = this.dw_list.GetRowElement(row);
            string id = GetEntityIDName(1);
            string entity = ele.selectSingleNode(id).text;
            //trace(entity);
            SetAgent("list", entity);
            if(arg.GetArgString("state") != "")
                //this.dw_list.SetItemString(row, "ApprovalStatus", arg.GetArgString("state"));
                dw_list.SetItemString(row, "ApplyStatus", arg.GetArgString("state"));
            if(arg.GetArgString("billstatus") != "")
            {
                string billstatus = arg.GetArgString("billstatus");
                string statusName = GetBillStatusName(billstatus);
                dw_list.SetItemString(row, "ApprovalStatus", billstatus);
                dw_list.SetItemDisplayString(row, "ApprovalStatus", statusName);
            }
            this.dw_list.Redraw();
        }
        return 1;
    }
    bool IsEmptyQueryStr(string queryStr)
    {
        if(queryStr=="") return true;
        if(queryStr=="<items join='and'/>") return true;
        if(queryStr=="<items join=\"and\"/>") return true;
        return false;
    }
    //检索
    int OnPreRetrieve()
    {
        int hItem = tv_folder.GetSelectedItem();
        if(hItem <=0) return 1;
        int     hCursor = xutil::SetCursorWait();
        msxml::IXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as msxml::IXMLDOMElement);
        string no = e1.getAttribute("no");
        xml x = 0;
        if(!(no =="Category:All" && IsEmptyQueryStr(m_QueryTxt)))
            x = ViewObject::RetrieveData(myDataUrl,"no",no,"QueryTxt", m_QueryTxt);
        if(x)
        {
            dw_list.Retrieve(x);
            dw_list.Redraw();
        }else
        {
            dw_list.ResetEx();
            dw_list.Redraw();
            dw_goods.ResetEx();
            dw_goods.Redraw();
        }
        if(!(no =="Category:All" && IsEmptyQueryStr(m_QueryTxt)))
            x = ViewObject::RetrieveData("/sale/data/Enquiry/folder/list2","no",no,"QueryTxt", m_QueryTxt);
        if(x)
        {
            dw_list2.Retrieve(x);
            dw_list2.Redraw();
        }else
        {
            dw_list2.ResetEx();
            dw_list2.Redraw();
            dw_goods2.ResetEx();
            dw_goods2.Redraw();
        }
        if(x)
        {
            dw_list1.Retrieve(x);
            dw_list1.Redraw();
        }else
        {
            dw_list1.ResetEx();
            dw_list1.Redraw();
            dw_goods1.ResetEx();
            dw_goods1.Redraw();
        }
        x = ViewObject::RetrieveData(myDataUrl1,"no",no,"QueryTxt", m_QueryTxt);
        if(x)
        {
            dw_list1.Retrieve(x);
            dw_list1.Redraw();
        }else
        {
            dw_list1.ResetEx();
            dw_list1.Redraw();
            dw_goods1.ResetEx();
            dw_goods1.Redraw();
        }
        dw_list1.SetReadOnly(true);
        xutil::RestoreCursor(hCursor);
        return 1;
    }
    //历史数据
    int Onhistroydata()
    {
        return 1;
        int row = dw_list.GetNextSelectRow(1);
        if(row>0)
        {
            msxml::IXMLDOMElement e =dw_list.GetRowElement(row);
            xaserverarg arg=new xaserverarg;
            arg.setNativePointer(arg.CreateInstance());
            string sCustomerID = e.selectSingleNode("CustomerID").text;
            arg.AddArg("CustomerID",sCustomerID,"");
            string sCustomerName = e.selectSingleNode("CustomerName").text;
            arg.AddArg("CustomerName",sCustomerName,"");
            arg.AddArg("EntityName",GetEntityName(1),"");
            arg.AddArg("EntityID",GetEntityID(1),"");
            int p = arg.ptr_native_;
            openUrl("/sale/view/Enquiry3/xpage/histroydata", p);
        }
        return 1;
    }
    int OnPrint()
    {
        xaserverarg arg=new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg("EntityName","Enquiry","");
        arg.AddArg("EntityID",GetEntityID(1),"");
        arg.AddArg("EntityNo",GetEntityNo(1),"");
        int p = arg.ptr_native_;
        openUrl("/sale/view/view.base/xpage/Template/PrintViewEx", p);
        return 0;
    }
    int OnAddPriceList()
    {
        dw_priceitem.Reset();
        xaserverarg arg = xaserverarg::Make();
        arg.AddArg("action","AddPriceList");
        OpenWindow("dev:xpage[ProductSchemaSelect.vx]",cast(arg as int));
        if(arg.GetArgString("process") == "ok")
        {
            xml x = new xml;
            x.setNativePointer(xml::CreateInstance());
            if (getUrl("/sale/data/Enquiry/PriceListEx/SKU",arg.GetString(),x)!=1) return 1;
            msxml::IXMLDOMNodeList nodes = x.GetXmlDoc().selectNodes("data/Item");
            int len = nodes.length;
            for(int i=0; i<len;i++)
            {
                dw_pricelist.InsertRow(0);
                int row = dw_pricelist.GetRowCount();
                dw_pricelist.SetRow(row);
                msxml::IXMLDOMNode ele = nodes.item(i);
                if(ele.selectSingleNode("SKUID")) dw_pricelist.SetItemString(row,"SKUID",ele.selectSingleNode("SKUID").text);
                if(ele.selectSingleNode("SKUID/@_displaystring")) dw_pricelist.SetItemDisplayString(row,"SKUID",ele.selectSingleNode("SKUID/@_displaystring").text);
                if(ele.selectSingleNode("GoodsNo")) dw_pricelist.SetItemString(row,"GoodsNo",ele.selectSingleNode("GoodsNo").text);
                if(ele.selectSingleNode("CName")) dw_pricelist.SetItemString(row,"CName",ele.selectSingleNode("CName").text);
                if(ele.selectSingleNode("BOMSchema")) dw_pricelist.SetItemString(row,"BOMSchema",ele.selectSingleNode("BOMSchema").text);
                if(ele.selectSingleNode("Version")) dw_pricelist.SetItemString(row,"Version",ele.selectSingleNode("Version").text);
                if(ele.selectSingleNode("SchemaNote")) dw_pricelist.SetItemString(row,"SchemaNote",ele.selectSingleNode("SchemaNote").text);
                if(ele.selectSingleNode("Current")) dw_pricelist.SetItemString(row,"Current",ele.selectSingleNode("Current").text);
                if(ele.selectSingleNode("PriceInfo")) dw_pricelist.SetItemString(row,"PriceInfo",ele.selectSingleNode("PriceInfo").text);
                string id = dw_pricelist.GetGuid(row);
                if(id=="")
                {
                    id = publiccode::GetGuid();
                    dw_pricelist.SetGuid(row,id);
                }
                msxml::IXMLDOMNodeList items = ele.selectNodes("data/Item");
                AddItems(id,items);
                items.Release();
                ele.Release();
            }
            x.Free();
            nodes.Release();
        }
        arg.Free();
        //OnRetrieveItem(dw_pricelist.GetGuid(row));
        return  1;
    }
    int OnAddPriceListVersion()
    {
        int row = dw_pricelist.GetRow();
        if( row < 1 ) return 1;
        dw_priceitem.Reset();
        xaserverarg arg = xaserverarg::Make();
        xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        arg.AddArg("SKUID",dw_pricelist.GetItemString(row,"SKUID"));
        arg.AddArg("SchemaNo",dw_pricelist.GetItemString(row,"BOMSchema"));
        if (getUrl("/sale/data/Enquiry/PriceListEx/SKU",arg.GetString(),x)!=1) return 1;
        msxml::IXMLDOMNodeList nodes = x.GetXmlDoc().selectNodes("data/Item");
        int len = nodes.length;
        for(int i=0; i<len;i++)
        {
            dw_pricelist.InsertRow(0);
            row = dw_pricelist.GetRowCount();
            dw_pricelist.SetRow(row);
            msxml::IXMLDOMNode ele = nodes.item(i);
            if(ele.selectSingleNode("SKUID")) dw_pricelist.SetItemString(row,"SKUID",ele.selectSingleNode("SKUID").text);
            if(ele.selectSingleNode("SKUID/@_displaystring")) dw_pricelist.SetItemDisplayString(row,"SKUID",ele.selectSingleNode("SKUID/@_displaystring").text);
            if(ele.selectSingleNode("GoodsNo")) dw_pricelist.SetItemString(row,"GoodsNo",ele.selectSingleNode("GoodsNo").text);
            if(ele.selectSingleNode("CName")) dw_pricelist.SetItemString(row,"CName",ele.selectSingleNode("CName").text);
            if(ele.selectSingleNode("BOMSchema")) dw_pricelist.SetItemString(row,"BOMSchema",ele.selectSingleNode("BOMSchema").text);
            if(ele.selectSingleNode("Version")) dw_pricelist.SetItemString(row,"Version",ele.selectSingleNode("Version").text);
            if(ele.selectSingleNode("SchemaNote")) dw_pricelist.SetItemString(row,"SchemaNote",ele.selectSingleNode("SchemaNote").text);
            if(ele.selectSingleNode("Current")) dw_pricelist.SetItemString(row,"Current",ele.selectSingleNode("Current").text);
            if(ele.selectSingleNode("PriceInfo")) dw_pricelist.SetItemString(row,"PriceInfo",ele.selectSingleNode("PriceInfo").text);
            string id = dw_pricelist.GetGuid(row);
            if(id=="")
            {
                id = publiccode::GetGuid();
                dw_pricelist.SetGuid(row,id);
            }
            msxml::IXMLDOMNodeList items = ele.selectNodes("data/Item");
            AddItems(id,items);
            items.Release();
            ele.Release();
        }
        nodes.Release();
        x.Free();
        arg.Free();
        //OnRetrieveItem(dw_pricelist.GetGuid(row));
        return  1;
    }
    int AddItems(string id, msxml::IXMLDOMNodeList nodes)
    {
        //dw_pricelist.Filter("EnquiryPriceListID","");
        int len = nodes.length;
        for(int i=0;i<len;i++)
        {
            dw_priceitem.InsertRow(0);
            int row = dw_priceitem.GetRowCount();
            dw_priceitem.SetItemString(row,"EnquiryPriceListID",id);
            msxml::IXMLDOMNode ele = nodes.item(i);
            if(ele.selectSingleNode("SchemaNote")) dw_priceitem.SetItemString(row,"SchemaNote",ele.selectSingleNode("SchemaNote").text);
            if(ele.selectSingleNode("BOMType")) dw_priceitem.SetItemString(row,"BOMType",ele.selectSingleNode("BOMType").text);
            if(ele.selectSingleNode("BOMPartNo")) dw_priceitem.SetItemString(row,"BOMPartNo",ele.selectSingleNode("BOMPartNo").text);
            if(ele.selectSingleNode("SupplierID")) dw_priceitem.SetItemString(row,"SupplierID",ele.selectSingleNode("SupplierID").text);
            if(ele.selectSingleNode("SupplierID/@_displaystring")) dw_priceitem.SetItemDisplayString(row,"SupplierID",ele.selectSingleNode("SupplierID/@_displaystring").text);
            if(ele.selectSingleNode("BuyPrice")) dw_priceitem.SetItemString(row,"BuyPrice",ele.selectSingleNode("BuyPrice").text);
            if(ele.selectSingleNode("ItemMiniQty")) dw_priceitem.SetItemString(row,"ItemMiniQty",ele.selectSingleNode("ItemMiniQty").text);
            if(ele.selectSingleNode("EnquiryNo")) dw_priceitem.SetItemString(row,"EnquiryNo",ele.selectSingleNode("EnquiryNo").text);
            if(ele.selectSingleNode("EnquiryDate")) dw_priceitem.SetItemString(row,"EnquiryDate",ele.selectSingleNode("EnquiryDate").text);
            if(ele.selectSingleNode("ValidDay")) dw_priceitem.SetItemString(row,"ValidDay",ele.selectSingleNode("ValidDay").text);
            if(ele.selectSingleNode("ItemNote")) dw_priceitem.SetItemString(row,"ItemNote",ele.selectSingleNode("ItemNote").text);
            if(ele.selectSingleNode("EnquiryLineID")) dw_priceitem.SetItemString(row,"EnquiryLineID",ele.selectSingleNode("EnquiryLineID").text);
            if(ele.selectSingleNode("PriceInfo")) dw_priceitem.SetItemString(row,"PriceInfo",ele.selectSingleNode("PriceInfo").text);
        }
        return 1;
    }
    int OnAddRow()
    {
        if(dw_pricelist.GetRow() < 1) return 1;
        int row = dw_pricelist.GetRow();
        xaserverarg arg= new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg("SKUID",dw_pricelist.GetItemString(row,"SKUID"));
        arg.AddArg("SchemaNo",dw_pricelist.GetItemString(row,"BOMSchema"));
        OpenWindow("dev:xpage[PriceList.PurcharItemSelect.vx]",cast(arg as int));
        string id = dw_pricelist.GetGuid(dw_pricelist.GetRow());
        if(id=="")
        {
            id = publiccode::GetGuid();
            dw_pricelist.SetGuid(dw_pricelist.GetRow(),id);
        }
        if(arg.GetArgString("process")=="ok")
        {
            string content = arg.GetArgString("result");
            xml x = xml::Make();
            x.LoadXml(content);
            msxml::IXMLDOMNodeList nodes = x.GetXmlDoc().selectNodes("data/Item");
            AddItems(id,nodes);
            nodes.Release();
            string PriceInfo = "";
            for(int i=1;i<=dw_pricelist.GetRowCount();i++)
            {
                if(i==1)
                    PriceInfo = dw_priceitem.GetItemString(i,"PriceInfo");
                else
                    PriceInfo = PriceInfo + " " + dw_priceitem.GetItemString(i,"PriceInfo");
            }
            dw_pricelist.SetItemString(dw_pricelist.GetRow(),"PriceInfo",PriceInfo);
            dw_pricelist.Redraw();
        }
        return 1;
    }
    int OnDeletePriceList()
    {
        dw_pricelist.DeleteRow(0);
        for(int i = dw_pricelist.GetRowCount(); i > 0 ; i = i - 1)
        {
            dw_priceitem.DeleteRow(i);
        }
        return 1;
    }
    int OnDeleteRow()
    {
        if(dw_pricelist.GetRow() < 1) return 1;
        dw_priceitem.DeleteRow(0);
        string PriceInfo = "";
        for(int i=1;i<=dw_pricelist.GetRowCount();i++)
        {
            if(i==1)
                PriceInfo = dw_priceitem.GetItemString(i,"PriceInfo");
            else
                PriceInfo = PriceInfo + " " + dw_priceitem.GetItemString(i,"PriceInfo");
        }
        dw_pricelist.SetItemString(dw_pricelist.GetRow(),"PriceInfo",PriceInfo);
        dw_pricelist.Redraw();
        return 1;
    }
    int OnRowChanged(ref TNotifyEvent evt,int p)
    {
        listwin::OnRowChanged(evt,p);
        ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR);
        int row = hdr.row;
        int     hCursor = xutil::SetCursorWait();
        string EnquiryNo = dw_list.GetItemString(row,"EnquiryNo");
        xml x = ViewObject::RetrieveData("/sale/data/Enquiry/maint","id",EnquiryNo);
        if(x)
            dw_goods.Retrieve(x);
        else
            dw_goods.Reset();
        dw_goods.Redraw();
        dw_goods.SetReadOnly(true);
        xutil::RestoreCursor(hCursor);
        return 1;
    }
    int OnRowChanged2(ref TNotifyEvent evt,int p)
    {
        ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR);
        int row = hdr.row;
        int     hCursor = xutil::SetCursorWait();
        string EnquiryNo = dw_list2.GetItemString(row,"EnquiryNo");
        xml x = ViewObject::RetrieveData("/sale/data/Enquiry/maint","id",EnquiryNo);
        if(x)
            dw_goods2.Retrieve(x);
        else
            dw_goods2.Reset();
        dw_goods2.Redraw();
        dw_goods2.SetReadOnly(true);
        xutil::RestoreCursor(hCursor);
        return 1;
    }
    int OnRowChanged1(ref TNotifyEvent evt,int p)
    {
        //fixed one event only one process
        //listwin::OnRowChanged(evt,p);
        ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR);
        int row = hdr.row;
        int     hCursor = xutil::SetCursorWait();
        string ItemID = dw_list1.GetItemString(row,"ItemID");
        //alert(ItemID);
        xml x = ViewObject::RetrieveData("/sale/data/Enquiry/folder/listitemsex","itemID",ItemID,"type",state2.toString());
        if(x)
            dw_goods1.Retrieve(x);
        else
            dw_goods1.Reset();
        dw_goods1.Redraw();
        dw_goods1.SetReadOnly(true);
        xutil::RestoreCursor(hCursor);
        return 1;
    }
    int OnShare()
    {
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        OpenWindow("dev:xpage[UserGroupShareEx.vx]",cast(arg as int));
        if(arg.GetArgString("process")=="ok")
        {
            xdwgrid dw_obj = dw_pricelistex;
            if(sheetname=="tab_pricebillex") dw_obj = dw_pricelist;
            sheetname="tab_pricebillshare";
            SetAgent("list");
            SwitchLayer("sheet5","frame");
            xml x = xml::Make();
            x.LoadXml(arg.GetArgString("result"));
            msxml::IXMLDOMNodeList nodes = x.GetXmlDoc().selectNodes("root/item");
            int count = nodes.length;
            int row = dw_obj.GetNextSelectRow(1);
            while(row > 0 && row <= dw_obj.GetRowCount())
            {
                string SKUID = dw_obj.GetItemString(row,"SKUID");
                string SKUNo = dw_obj.GetItemDisplayString(row,"SKUID");
                string CName = dw_obj.GetItemString(row,"CName");
                string Version = dw_obj.GetItemString(row,"Version");
                string GoodsNo = dw_obj.GetItemString(row,"GoodsNo");
                string BOMSchema = dw_obj.GetItemString(row,"BOMSchema");
                string EntityID = dw_obj.GetGuid(row);
                if(EntityID=="") EntityID = dw_obj.GetItemString(row,"EnquiryPriceListID");
                for(int i=0; i<count; i++)
                {
                    msxml::IXMLDOMNode node = nodes.item(i);
                    string No = "";
                    string GroupOrEmp = "";
                    if(node.selectSingleNode("NO")) No = node.selectSingleNode("NO").text;
                    if(node.selectSingleNode("Name")) GroupOrEmp = node.selectSingleNode("Name").text;
                    int crow = dw_pricelistshare.InsertRow(1);
                    //int crow = dw_pricelistshare.GetRowCount();
                    dw_pricelistshare.SetItemString(crow,"NO",No);
                    dw_pricelistshare.SetItemString(crow,"GroupOrEmp",GroupOrEmp);
                    dw_pricelistshare.SetItemString(crow,"EntityID",EntityID);
                    dw_pricelistshare.SetItemString(crow,"EntityName","产品价格单");
                    if(node.selectSingleNode("UserGroupID"))
                        dw_pricelistshare.SetItemString(crow,"UserGroupID",node.selectSingleNode("UserGroupID").text);
                    if(node.selectSingleNode("PersonID"))
                        dw_pricelistshare.SetItemString(crow,"PersonID",node.selectSingleNode("PersonID").text);
                    dw_pricelistshare.SetItemString(crow,"SKUID",SKUID);
                    dw_pricelistshare.SetItemDisplayString(crow,"SKUID",SKUNo);
                    dw_pricelistshare.SetItemString(crow,"CName",CName);
                    dw_pricelistshare.SetItemString(crow,"Version",Version);
                    dw_pricelistshare.SetItemString(crow,"GoodsNo",GoodsNo);
                    dw_pricelistshare.SetItemString(crow,"BOMSchema",BOMSchema);
                    node.Release();
                }
                row =  dw_obj.GetNextSelectRow(row + 1);
            }
        }
        return 1;
    }
    int OnShare2()
    {
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        OpenWindow("dev:xpage[UserGroupShareEx.vx]",cast(arg as int));
        return 1;
    }
    int OnTransPriceBillEx()
    {
        xaserverarg arg= new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg("no","Category:All");
        arg.AddArg("QueryTxt","");
        OpenWindow("dev:xpage[PriceList.PurcharItemSelectEx.vx]",cast(arg as int));
        if(arg.GetArgString("process") == "ok")
        {
            xml x = new xml;
            x.setNativePointer(xml::CreateInstance());
            x.LoadXml(arg.GetArgString("result"));
            msxml::IXMLDOMNodeList nodes = x.GetXmlDoc().selectNodes("data/Item");
            int len = nodes.length;
            for(int i=0; i<len;i++)
            {
                 int row = dw_pricelistex.InsertRow(1);
                //int row = dw_pricelistex.GetRowCount();
                msxml::IXMLDOMNode ele = nodes.item(i);
                //alert(ele.xml);
                if(ele.selectSingleNode("SKUID")) dw_pricelistex.SetItemString(row,"Item",ele.selectSingleNode("SKUID").text);
                if(ele.selectSingleNode("SKUNo")) dw_pricelistex.SetItemDisplayString(row,"SKUID",ele.selectSingleNode("SKUNo").text);
                if(ele.selectSingleNode("GoodsNo")) dw_pricelistex.SetItemString(row,"GoodsNo",ele.selectSingleNode("GoodsNo").text);
                if(ele.selectSingleNode("CName")) dw_pricelistex.SetItemString(row,"CName",ele.selectSingleNode("CName").text);
                if(ele.selectSingleNode("ItemName")) dw_pricelistex.SetItemString(row,"CName",ele.selectSingleNode("ItemName").text);
                if(ele.selectSingleNode("BOMSchema")) dw_pricelistex.SetItemString(row,"BOMSchema",ele.selectSingleNode("BOMSchema").text);
                if(ele.selectSingleNode("Version")) dw_pricelistex.SetItemString(row,"Version",ele.selectSingleNode("Version").text);
                if(ele.selectSingleNode("SchemaNote")) dw_pricelistex.SetItemString(row,"SchemaNote",ele.selectSingleNode("SchemaNote").text);
                if(ele.selectSingleNode("Current")) dw_pricelistex.SetItemString(row,"Current",ele.selectSingleNode("Current").text);
                if(ele.selectSingleNode("PriceInfo")) dw_pricelistex.SetItemString(row,"PriceInfo",ele.selectSingleNode("PriceInfo").text);
                string edate = ele.selectSingleNode("EnquiryDate").text;
                string ver = edate.mid(2,2)+"."+edate.mid(5,2)+"."+edate.mid(5,2);
                dw_pricelistex.SetItemString(row,"Version",ver);
                ///dw_pricelistex.SetItemString(row,"EnquiryPriceListID",id);
                if(ele.selectSingleNode("SchemaNote")) dw_pricelistex.SetItemString(row,"SchemaNote",ele.selectSingleNode("SchemaNote").text);
                if(ele.selectSingleNode("BOMType")) dw_pricelistex.SetItemString(row,"BOMType",ele.selectSingleNode("BOMType").text);
                if(ele.selectSingleNode("BOMPartNo")) dw_pricelistex.SetItemString(row,"BOMPartNo",ele.selectSingleNode("BOMPartNo").text);
                if(ele.selectSingleNode("SupplierID")) dw_pricelistex.SetItemString(row,"SupplierID",ele.selectSingleNode("SupplierID").text);
                if(ele.selectSingleNode("SupplierID/@_displaystring")) dw_pricelistex.SetItemDisplayString(row,"SupplierID",ele.selectSingleNode("SupplierID/@_displaystring").text);
                if(ele.selectSingleNode("POPrice")) dw_pricelistex.SetItemString(row,"BuyPrice",ele.selectSingleNode("POPrice").text);
                if(ele.selectSingleNode("ItemMiniQty")) dw_pricelistex.SetItemString(row,"ItemMiniQty",ele.selectSingleNode("ItemMiniQty").text);
                if(ele.selectSingleNode("EnquiryNo")) dw_pricelistex.SetItemString(row,"EnquiryNo",ele.selectSingleNode("EnquiryNo").text);
                if(ele.selectSingleNode("EnquiryDate")) dw_pricelistex.SetItemString(row,"EnquiryDate",ele.selectSingleNode("EnquiryDate").text);
                if(ele.selectSingleNode("ValidDay")) dw_pricelistex.SetItemString(row,"ValidDay",ele.selectSingleNode("ValidDay").text);
                if(ele.selectSingleNode("ItemNote")) dw_pricelistex.SetItemString(row,"ItemNote",ele.selectSingleNode("ItemNote").text);
                if(ele.selectSingleNode("EnquiryLineID")) dw_pricelistex.SetItemString(row,"EnquiryLineID",ele.selectSingleNode("EnquiryLineID").text);
                ele.Release();
            }
            x.Free();
            nodes.Release();
        }
        return 1;
    }
    int OnTransPriceBill()
    {
        xaserverarg arg= new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg("no","Category:All");
        arg.AddArg("QueryTxt","");
        OpenWindow("dev:xpage[PriceList.PurcharItemSelectEx.vx]",cast(arg as int));
        if(arg.GetArgString("process") == "ok")
        {
            xml x = new xml;
            x.setNativePointer(xml::CreateInstance());
            x.LoadXml(arg.GetArgString("result"));
            msxml::IXMLDOMNodeList nodes = x.GetXmlDoc().selectNodes("data/Item");
            int len = nodes.length;
            for(int i=0; i<len;i++)
            {
                dw_pricelist.InsertRow(0);
                int row = dw_pricelist.GetRowCount();
                //dw_pricelist.SetRow(row);
                msxml::IXMLDOMNode ele = nodes.item(i);
                if(ele.selectSingleNode("SKUID")) dw_pricelist.SetItemString(row,"Item",ele.selectSingleNode("SKUID").text);
                if(ele.selectSingleNode("SKUNo")) dw_pricelist.SetItemDisplayString(row,"SKUID",ele.selectSingleNode("SKUNo").text);
                if(ele.selectSingleNode("GoodsNo")) dw_pricelist.SetItemString(row,"GoodsNo",ele.selectSingleNode("GoodsNo").text);
                if(ele.selectSingleNode("CName")) dw_pricelist.SetItemString(row,"CName",ele.selectSingleNode("CName").text);
                if(ele.selectSingleNode("BOMSchema")) dw_pricelist.SetItemString(row,"BOMSchema",ele.selectSingleNode("BOMSchema").text);
                if(ele.selectSingleNode("Version")) dw_pricelist.SetItemString(row,"Version",ele.selectSingleNode("Version").text);
                if(ele.selectSingleNode("SchemaNote")) dw_pricelist.SetItemString(row,"SchemaNote",ele.selectSingleNode("SchemaNote").text);
                if(ele.selectSingleNode("Current")) dw_pricelist.SetItemString(row,"Current",ele.selectSingleNode("Current").text);
                if(ele.selectSingleNode("PriceInfo")) dw_pricelist.SetItemString(row,"PriceInfo",ele.selectSingleNode("PriceInfo").text);
                string edate = ele.selectSingleNode("EnquiryDate").text;
                string ver = edate.mid(2,2)+"."+edate.mid(5,2)+"."+edate.mid(5,2);
                dw_pricelist.SetItemString(row,"Version",ver);
                if(ele.selectSingleNode("SupplierID/@_displaystring"))
                {
                    string name = ele.selectSingleNode("SupplierID/@_displaystring").text;
                    string price = ele.selectSingleNode("POPrice").text;
                    string PriceInfo = price + "   " + name;
                    dw_pricelist.SetItemString(row,"PriceInfo",PriceInfo);
                }
                string id = dw_pricelist.GetGuid(row);
                if(id=="")
                {
                    id = publiccode::GetGuid();
                    dw_pricelist.SetGuid(row,id);
                }
                dw_priceitem.InsertRow(0);
                row = dw_priceitem.GetRowCount();
                dw_priceitem.SetItemString(row,"EnquiryPriceListID",id);
                if(ele.selectSingleNode("SchemaNote")) dw_priceitem.SetItemString(row,"SchemaNote",ele.selectSingleNode("SchemaNote").text);
                if(ele.selectSingleNode("BOMType")) dw_priceitem.SetItemString(row,"BOMType",ele.selectSingleNode("BOMType").text);
                if(ele.selectSingleNode("BOMPartNo")) dw_priceitem.SetItemString(row,"BOMPartNo",ele.selectSingleNode("BOMPartNo").text);
                if(ele.selectSingleNode("SupplierID")) dw_priceitem.SetItemString(row,"SupplierID",ele.selectSingleNode("SupplierID").text);
                if(ele.selectSingleNode("SupplierID/@_displaystring")) dw_priceitem.SetItemDisplayString(row,"SupplierID",ele.selectSingleNode("SupplierID/@_displaystring").text);
                if(ele.selectSingleNode("POPrice")) dw_priceitem.SetItemString(row,"BuyPrice",ele.selectSingleNode("POPrice").text);
                if(ele.selectSingleNode("ItemMiniQty")) dw_priceitem.SetItemString(row,"ItemMiniQty",ele.selectSingleNode("ItemMiniQty").text);
                if(ele.selectSingleNode("EnquiryNo")) dw_priceitem.SetItemString(row,"EnquiryNo",ele.selectSingleNode("EnquiryNo").text);
                if(ele.selectSingleNode("EnquiryDate")) dw_priceitem.SetItemString(row,"EnquiryDate",ele.selectSingleNode("EnquiryDate").text);
                if(ele.selectSingleNode("ValidDay")) dw_priceitem.SetItemString(row,"ValidDay",ele.selectSingleNode("ValidDay").text);
                if(ele.selectSingleNode("ItemNote")) dw_priceitem.SetItemString(row,"ItemNote",ele.selectSingleNode("ItemNote").text);
                if(ele.selectSingleNode("EnquiryLineID")) dw_priceitem.SetItemString(row,"EnquiryLineID",ele.selectSingleNode("EnquiryLineID").text);
                //AddItems(id,items);
                //items.Release();
                ele.Release();
            }
            x.Free();
            nodes.Release();
        }
        return 1;
    }
    int OnTech(xdwgrid dw_term)
    {
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        int row = dw_term.GetRow();
        if(row < 1) return 0;
        string str = dw_term.GetItemString(row,"TechNote");
        arg.AddArg("value",str);
        OpenWindow("dev:xpage[memo.edit.new.vx]",arg.getNativePointer());
        if(arg.GetArgString("comdid")=="xmOK")
        {
            str = arg.GetArgString("value");
            dw_term.AcceptText();
            dw_term.SetItemString(row,"TechNote",str);
            dw_term.Redraw();
        }
        return 0;
    }
    int OnCopy()
    {
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        int row = dw_pricelistex.GetRow();
        if(row < 1) return 0;
        string ItemID = dw_pricelistex.GetItemString(row,"ItemID");
        string EnquiryID = dw_pricelistex.GetItemString(row,"EnquiryID");
        string OriginEnquiryLineID = dw_pricelistex.GetItemString(row,"OriginEnquiryLineID");
        string ValidDay = dw_pricelistex.GetItemString(row,"ValidDay");
        string SupplierID = dw_pricelistex.GetItemString(row,"SupplierID1");
        string SupplierIDName = dw_pricelistex.GetItemString(row,"supplieridName1");
        string SONo = dw_pricelistex.GetItemString(row,"SONo");
        string Remark = dw_pricelistex.GetItemString(row,"Remark");
        string Source = dw_pricelistex.GetItemString(row,"Source");
        string PayTerm = dw_pricelistex.GetItemString(row,"PayTerm");
        string CustomerContactName = dw_pricelistex.GetItemString(row,"CustomerContactName");
        string ContactTel = dw_pricelistex.GetItemString(row,"ContactTel");
        //string EnquiryNo = EnquiryView::MakeBillNo();
        arg.AddArg("ItemID",ItemID);
        arg.AddArg("EnquiryID",EnquiryID);
        arg.AddArg("ValidDay",ValidDay);
        arg.AddArg("SupplierID",SupplierID);
        arg.AddArg("SupplierID/@_displaystring",SupplierIDName);
        arg.AddArg("SONo",SONo);
        arg.AddArg("Remark",Remark);
        arg.AddArg("Source",Source);
        arg.AddArg("PayTerm",PayTerm);
        arg.AddArg("CustomerContactName",CustomerContactName);
        arg.AddArg("ContactTel",ContactTel);
        int pa = arg.getNativePointer();
        openUrl("/sale/view/Enquiry3/xpage/maint", pa);
        return 1;
    }
    int OnGroupCopy()
    {
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        int row = dw_priceitem.GetRow();
        int row1 = dw_pricelist.GetRow();
        if(row < 1) return 0;
        if(row1 < 1) return 0;
        string ItemID = dw_pricelist.GetItemString(row1,"ItemID");
        string EnquiryID = dw_priceitem.GetItemString(row,"EnquiryID");
        string OriginEnquiryLineID = dw_priceitem.GetItemString(row,"OriginEnquiryLineID");
        string ValidDay = dw_priceitem.GetItemString(row,"ValidDay");
        string SupplierID = dw_priceitem.GetItemString(row,"SupplierID1");
        string SupplierIDName = dw_priceitem.GetItemString(row,"supplieridName1");
        string SONo = dw_priceitem.GetItemString(row,"SONo");
        string Remark = dw_priceitem.GetItemString(row,"Remark");
        string Source = dw_priceitem.GetItemString(row,"Source");
        string PayTerm = dw_priceitem.GetItemString(row,"PayTerm");
        string CustomerContactName = dw_priceitem.GetItemString(row,"CustomerContactName");
        string ContactTel = dw_priceitem.GetItemString(row,"ContactTel");
        //string EnquiryNo = EnquiryView::MakeBillNo();
        arg.AddArg("ItemID",ItemID);
        arg.AddArg("EnquiryID",EnquiryID);
        arg.AddArg("ValidDay",ValidDay);
        arg.AddArg("SupplierID",SupplierID);
        arg.AddArg("SupplierID/@_displaystring",SupplierIDName);
        arg.AddArg("SONo",SONo);
        arg.AddArg("Remark",Remark);
        arg.AddArg("Source",Source);
        arg.AddArg("PayTerm",PayTerm);
        arg.AddArg("CustomerContactName",CustomerContactName);
        arg.AddArg("ContactTel",ContactTel);
        int pa = arg.getNativePointer();
        openUrl("/sale/view/Enquiry3/xpage/maint", pa);
        return 1;
    }
    int PreOnCmdDispatch(string comdid)
    {
        //alert(comdid);
        if(comdid=="xmSearch")
        {
            OnFilter();
            return 0;
        }
        if(comdid=="xmTech")
        {
            return OnTech(dw_pricelistex);
        }
        else if(comdid=="xmTech1")
        {
            return OnTech(dw_pricelist);
        }
        else if(comdid=="xmTech2")
        {
            return OnTech(dw_priceitem);
        }
        if(comdid=="tab_pricebill")
        {
            sheetname="tab_pricebill";
            SetAgent("list");
            SwitchLayer("tv_folder_pricebill","folder_frame");
            if(dw_pricelistex.GetRowCount() < 1) OnProductPriceBillRetrieve();
            return 0;
        }
        else    if(comdid=="tab_pricebillex")
        {
            sheetname="tab_pricebillex";
            SetAgent("list");
            SwitchLayer("tv_folder_pricebill","folder_frame");
            if(dw_pricelist.GetRowCount() < 1) OnPriceBillRetrieve();
            return 0;
        }else if(comdid=="tab_list2")
        {
            dw_list = GetControl("dw_list2");
            sheetname = "tab_list2";
            SetAgent("list");
        }
        else if(comdid.left(4)=="tab_")
        {
            if(comdid=="tab_list")
            {
                dw_list = GetControl("dw_list");
                sheetname = "dw_list";
            }
            if(comdid=="tab_pricebillshare")
                SwitchLayer("tv_folder_pricebill","folder_frame");
            else
                SwitchLayer("tv_folder","folder_frame");
            sheetname=comdid;
            SetAgent("list");
            return 0;
        }
        if(comdid=="xmAddRow")
        {
            OnAddRow();
            return 0;
        }
        if(comdid=="xmDeleteRow")
        {
            OnDeleteRow();
            return 0;
        }
        if(comdid=="xmDelete")
        {
            OnDeletePriceList();
            return 0;
        }
        if(comdid=="xmBOMSchema")
        {
            OpenWindow("dev:xpage[ProductSchema.vx]");
            return 0;
        }
        else if(comdid=="xmAddPriceList")
        {
            OnAddPriceList();
            return 0;
        }
        else if(comdid=="xmAddPriceListVersion")
        {
            OnAddPriceListVersion();
            return 0;
        }
        if(comdid=="action:bill.trantopricebill" || comdid=="bill.trantopricebill")
        {
            OnTransPriceBillEx();
            return 0;
        }
        if(comdid=="action:bill.new")
        {
                string s = publiccode::GetUser().id;
                xml supplier_x = ViewObject::RetrieveData("/sale/data/SupplierV3/entity/FindBySaleType","id", s);
                if(supplier_x)
                {
                    if(supplier_x.GetXmlDoc().text == "采购经理")
                        {
                        alert("当前角色不是采购员不能新增单子,请重新选择角色");
                        return 0;
                    }
                }
        }
        if(comdid=="action:bill.histroydata") return Onhistroydata();
        else if(comdid=="action:bill.refresh") return OnPreRetrieve();
        else if(comdid=="action:bill.print") return OnPrint();
        else if(comdid=="action:bill.share" || comdid=="xmShare")
        {
            OnShare();
            return 0;
        }
        else if(comdid=="xmShare2")
        {
            OnShare2();
            return 0;
        }
        else if(comdid=="xmSave")
        {
            OnSave();
            return 0;
        }
        else if(comdid=="xmCopy")
        {
            OnCopy();
            return 0;
        }
        else if(comdid=="xmGroupCopy")
        {
            OnGroupCopy();
            return 0;
        }
        else if(comdid=="xmShareSave")
        {
            OnSaveShare();
            return 0;
        }
        else if(comdid=="xmPriceListDeleteRow")
        {
            dw_pricelistex.DeleteRow(0);
            return 0;
        }
        else if(comdid=="xmShareRefresh")
        {
            OnProductPriceShareRetrieve();
            return 0;
        }
        else if(comdid=="xmPriceBillRefresh")
        {
            OnPriceBillRetrieve();
            return 0;
        }
        else if(comdid=="xmShareDeleteRow")
        {
            dw_pricelistshare.DeleteRow(0);
            return 0;
        }
        return 1;
    }
    //xcombobox下拉
    int OnSelectDdlb(ref TNotifyEvent evt,int p)
    {
        changeddlb=1;
        int wid = ddlb_1.GetId();
        int CB_GETCURSEL  = 0x0147;
        int nIndex = win32::SendMessage(wid,CB_GETCURSEL,0,0);
        msxml::IXMLDOMElement e = ddlb_1.GetElement();
        msxml::IXMLDOMElement e2 = e.selectSingleNode("item["+(nIndex+1).toString()+"]");
        string no=e2.selectSingleNode("@element").text;
        int hItem = tv_folder.GetRootItem();
        while(tv_folder.GetChildItem(hItem))
            tv_folder.DeleteItem(tv_folder.GetChildItem(hItem));
        ExpandFolderItem(tv_folder,hItem, no);
        changeddlb=0;
        return 1;
    }
    int OnCkbCLick(ref TEvent evt,int p)
    {
        xcheckbox cbx_1 = GetControl("cbx1");
        int state=cbx_1.GetCheck(cbx_1.GetId());
        if(evt.lParam == GetControl("cbx1").GetId())
        {
            if (state== -1)
                SwitchLayer("sheet1","frame");
            else
                SwitchLayer("sheet2","frame");
            return 1;
        }else if(evt.lParam == GetControl("cbx2").GetId())
        {
            cbx_1 = GetControl("cbx2");
            state=cbx_1.GetCheck(cbx_1.GetId());
            int     hCursor = xutil::SetCursorWait();
            string ItemID = dw_list1.GetItemString(dw_list1.GetRow(),"ItemID");
            xml x = ViewObject::RetrieveData("/sale/data/Enquiry/folder/listitemsex","itemID",ItemID,"type",state.toString());
            if(x)
                dw_goods1.Retrieve(x);
            else
                dw_goods1.Reset();
            dw_goods1.Redraw();
            dw_goods1.SetReadOnly(true);
            xutil::RestoreCursor(hCursor);
            if(state==-1) state2 = 1; else state2 = -1;
            return 1;
        }
    }
    int OnPriceListRowChanged(ref TNotifyEvent evt,int p)
    {
        ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR);
        int row = hdr.row;
        int     hCursor = xutil::SetCursorWait();
        OnRetrieveItem(dw_pricelist.GetGuid(row));
        return 1;
    }
    int OnItemAskStyle(ref TNotifyEvent evt,int p)
    {
        int DMS_CSSSTYLE = 0x8;
        ref DWASKSTYLENMHDR hdr = trust(evt.pnmh as ref DWASKSTYLENMHDR);
        int row = hdr.row;
        int col = hdr.col;
        string colname = hdr.colname;
        int rows = dw_list.GetRowCount();
        if(row < 1 || row > rows)
        {
            return 1;
        }
        if(colname=="EnquiryNo" || colname=="SupplierID" || colname=="EnquiryDate" ||
            colname=="ValidDate"||colname=="ApprovalStatus"||colname=="SalespersonID"||
            colname=="PayTerm"||colname=="OrgName")
        {
            int days = dw_list.GetItemInt(row,"Days");
            if(days < 0)
            {
                hdr.mask =  DMS_CSSSTYLE;
                hdr.cssstyle = "color:#cccccc";
            }
        }
        return 1;
    }
    int OnFilter()
    {
        string str = GetControl("sl_search").GetText();
        xdwgrid dw_obj;
        if(sheetname=="tab_goods") dw_obj = dw_list1;
        else if(sheetname=="tab_pricebill") dw_obj = dw_pricelistex;
        else if(sheetname=="tab_pricebillex") dw_obj = dw_pricelist;
        else if(sheetname=="tab_pricebillshare") dw_obj = dw_pricelistshare;
        dw_obj.Filter("*",str);
        return 1;
    }
    int OnPriceListDoubleClicked(ref TNotifyEvent evt,int p)
    {
        int hCursor = xutil::SetCursorWait();
        int row = dw_pricelistex.GetRow();
        if(row > 0) OnTech(dw_pricelistex);
        xutil::RestoreCursor(hCursor);
        return 1;
    }
    int OnDoubleClicked(ref TNotifyEvent evt,int p)
    {
        int hCursor = xutil::SetCursorWait();
        int row = dw_list2.GetRow();
        xaserverarg arg=new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        string EnquiryNo  = dw_list2.GetItemString(row,"EnquiryNo");
        arg.AddArg("EnquiryNo",EnquiryNo);
        int pa = arg.getNativePointer();
        openUrl("/sale/view/Enquiry3/xpage/maint", pa);
        xutil::RestoreCursor(hCursor);
        return 1;
    }
    int OnDoubleClicked(ref TNotifyEvent evt,int p)
    {
        int hCursor = xutil::SetCursorWait();
        OnCmdDispatch("action:bill.open");
        xutil::RestoreCursor(hCursor);
        return 1;
    }
    int AttachEvent()
    {
        AttachEvent("tv_folder", "TVN_SELCHANGED",OnTreeSelChanged); //树选择
        AttachEvent("tv_folder", "TVN_ITEMEXPANDING",OnTreeExpanding); //树展开
        AttachEvent("dw_list","DWV_ROWFOCUSCHANGED",OnRowChanged);
        AttachEvent("dw_list2","DWV_ROWFOCUSCHANGED",OnRowChanged2);
        AttachEvent("dw_list1","DWV_ROWFOCUSCHANGED",OnRowChanged1);
        AttachEvent("cbx_1","CBN_SELCHANGE",OnSelectDdlb);
        AttachEvent("WM_COMMAND",OnCkbCLick);
        AttachEvent("dw_list","DWV_ASKSTYLE",OnItemAskStyle);
        AttachEvent("dw_pricelist","DWV_ROWFOCUSCHANGED",OnPriceListRowChanged);
        AttachEvent("tv_folder_pricebill", "TVN_SELCHANGED",OnPriceBillTreeSelChanged); //树选择
        AttachEvent("tv_folder_pricebill", "TVN_ITEMEXPANDING",OnPriceBillTreeExpanding);
        AttachEvent("dw_pricelistex","DWV_DOUBLECLICKED",OnPriceListDoubleClicked);
        AttachEvent("dw_list2","DWV_DOUBLECLICKED",OnDoubleClicked);
        return 1;
    }
    int OnRetrieveItem(string EnquiryPriceListID)
    {
        xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg("EnquiryPriceListID",EnquiryPriceListID);
        if (getUrl("/sale/data/Enquiry/fetch/PriceList/item",arg.GetString(),x)!=1)
        {
            trace(x.GetXmlDoc().text);
            return -1;
        }else
        {
            dw_priceitem.Retrieve(x);
            dw_priceitem.Redraw();
            dw_priceitem.SetReadOnly(true);
        }
        return 1;
    }
    int  OnPriceBillRetrieve()
    {
        int hItem = tv_folder_pricebill.GetSelectedItem();
        msxml::IXMLDOMElement e1 = cast(tv_folder_pricebill.GetItemData(hItem) as msxml::IXMLDOMElement);
        string no = e1.getAttribute("no");
        xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg("no",no);
        if (getUrl("/sale/data/Enquiry/fetch/PriceList",arg.GetString(),x)!=1)
        {
            trace(x.GetXmlDoc().text);
            return -1;
        }else
        {
            dw_pricelist.Retrieve(x);
            dw_pricelist.Redraw();
            dw_pricelist.SetSelectionMode(3);
        }
        if(dw_pricelist.GetRowCount() > 0)
            OnRetrieveItem(dw_pricelist.GetGuid(1));
        else
        {
            dw_priceitem.Reset();
        }
        return 1;
    }
    int  OnProductPriceBillRetrieve()
    {
        int hItem = tv_folder_pricebill.GetSelectedItem();
        msxml::IXMLDOMElement e1 = cast(tv_folder_pricebill.GetItemData(hItem) as msxml::IXMLDOMElement);
        string no = e1.getAttribute("no");
        xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg("no",no);
        if (getUrl("/sale/data/Enquiry/ProductPriceList/nobom",arg.GetString(),x)!=1)
        {
            trace(x.GetXmlDoc().text);
            return -1;
        }else
        {
            dw_pricelistex.Retrieve(x);
            dw_pricelistex.Redraw();
            dw_pricelistex.SetSelectionMode(3);
        }
        return 1;
    }
    int  OnProductPriceShareRetrieve()
    {
        xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        if (getUrl("/sale/data/Enquiry/ProductPriceList/share",arg.GetString(),x)!=1)
        {
            trace(x.GetXmlDoc().text);
            return -1;
        }else
        {
            trace(x.GetXml());
            dw_pricelistshare.Retrieve(x);
            dw_pricelistshare.Redraw();
            dw_pricelistshare.SetReadOnly(true);
        }
    }
    int onload()
    {
        state1=-1;
        state2=-1;
        listwin::onload();
        dw_list.SetAskStyle(true);
        dw_list2 = GetControl("dw_list2");
        dw_list2.openUrl("/sale/view/Enquiry3/template/list");
        dw_list2.SetColumnState("SupplierID",false);
        dw_list2.SetColumnState("PayTerm",false);
        dw_list2.SetColumnState("EnquiryID",false);
        dw_list2.SetColumnState("Days",false);
        dw_list2.SetSelectionMode(3);
        dw_goods2 = GetControl("dw_goods2");
        dw_goods2.openUrl("/sale/view/Enquiry3/template/item/pricelist");
        dw_goods2.SetColumnState("ItemID",false);
        dw_goods2.SetColumnState("Picture",false);
        dw_goods2.SetColumnState("category",false);
        dw_goods2.SetColumnState("RealEnquiryLineID",false);
        dw_goods2.SetColumnState("RelEnquiryLineID",false);
        ddlb_1 = this.GetControl("cbx_1");
        dw_goods = GetControl("dw_goods");
        dw_goods .openUrl("/sale/view/Enquiry3/template/item/pricelist");
        dw_goods.SetColumnState("ItemID",false);
        dw_goods.SetColumnState("SupplierID",false);
        dw_list1 = GetControl("dw_list1");
        dw_list1 .openUrl("/sale/view/Enquiry3/template/item/itempricelist");
        dw_list1.SetColumnState("ItemID",false);
        dw_goods1 = GetControl("dw_goods1");
        dw_goods1 .openUrl("/sale/view/Enquiry3/template/item/itempricelist");
        dw_goods1.SetColumnState("ItemID",false);
        dw_pricelistex = GetControl("dw_pricelistex");
        dw_pricelistex.openUrl("/sale/view/Enquiry3/template/purcharpricelist");
        dw_pricelistex.SetColumnState("EnquiryID",false);
        dw_pricelistex.SetColumnState("PayTerm",false);
        dw_pricelistex.SetColumnState("Source",false);
        dw_pricelistex.SetColumnState("SONo",false);
        dw_pricelistex.SetColumnState("OriginEnquiryLineID",false);
        dw_pricelistex.SetColumnState("EnquiryLineID",false);
        dw_pricelistex.SetColumnState("SupplierID1",false);
        dw_pricelistex.SetColumnState("supplieridName1",false);
        dw_pricelistex.SetColumnState("CustomerContactName",false);
        dw_pricelistex.SetColumnState("ContactTel",false);
        dw_pricelist = GetControl("dw_pricelist");
        dw_pricelist.openUrl("/sale/view/Enquiry3/template/purcharpricelistex");
        dw_pricelist.SetColumnState("ItemID",false);
        dw_priceitem = GetControl("dw_priceitem");
        dw_priceitem.openUrl("/sale/view/Enquiry3/template/purcharpricelist/item");
        dw_pricelistshare = GetControl("dw_pricelistshare");
        dw_pricelistshare.openUrl("/sale/view/Enquiry3/template/purcharpricelist/item/share");
        dw_pricelistshare.SetReadOnly(true);
        dw_pricelistex.SetColumnState("ItemID",false);
        dw_pricelistex.SetColumnState("EnquiryLineID",false);
        dw_pricelistshare.SetColumnState("UserGroupID",false);
        dw_pricelistshare.SetColumnState("EntityID",false);
        dw_pricelistshare.SetColumnState("EntityName",false);
        dw_pricelistshare.SetColumnState("PersonID",false);
        dw_pricelistshare.SetColumnState("NO",false);
        dw_priceitem.SetColumnState("PriceInfo",false);
        dw_priceitem.SetColumnState("EnquiryID",false);
        dw_priceitem.SetColumnState("PayTerm",false);
        dw_priceitem.SetColumnState("Source",false);
        dw_priceitem.SetColumnState("SONo",false);
        dw_priceitem.SetColumnState("OriginEnquiryLineID",false);
        dw_priceitem.SetColumnState("EnquiryLineID",false);
        dw_priceitem.SetColumnState("SupplierID1",false);
        dw_priceitem.SetColumnState("supplieridName1",false);
        dw_priceitem.SetColumnState("CustomerContactName",false);
        dw_priceitem.SetColumnState("ContactTel",false);
        dw_priceitem.SetColumnState("Remark",false);
        myDataUrl = "/sale/data/Enquiry/folder/list";
        myDataUrl1 = "/sale/data/Enquiry/folder/listitems";
        urlTree = "/sale/data/Enquiry/folder";
        tv_folder = GetControl("tv_folder");
        //tv_folder.SetLineAtRoot(true);
        InitialFolder();
        tv_folder_pricebill = GetControl("tv_folder_pricebill");
        InitialFolderPriceBill();
    }
    int onloaded()
    {
        listwin::onloaded();
        AttachEvent();
        dw_list.SetColumnState("EnquiryID",false);
        dw_list.SetColumnState("Days",false);
        dw_list1.SetColumnState("EnquiryLineID",false);
        dw_list1.SetColumnState("EnquiryPriceListID",false);
        OnAttachEvent();
        OnRetrieve();
        dw_list1.SetReadOnly(true);
        OnProductPriceShareRetrieve();
        int hItem = tv_folder.GetRootItem();
        tv_folder.ExpandItem(hItem);
        tv_folder.ItemFocus(hItem);
        hItem = tv_folder_pricebill.GetRootItem();
        tv_folder_pricebill.ExpandItem(hItem);
        tv_folder_pricebill.ItemFocus(hItem);
        sheetname = "tab_list";
        //dw_priceitem.SetColumnState("EnquiryLineID",false);
        //dw_priceitem.SetColumnState("EnquiryPriceListID",false);
        dw_pricelistex.SetColumnState("BOMPartNo",false);
        dw_pricelistex.SetColumnState("BOMSchema",false);
        dw_pricelistex.SetColumnState("BOMType",false);
        dw_pricelistex.SetColumnState("Current",false);
        dw_priceitem.SetReadOnly(true);
        return -1;
    }
    int ProcessUsedArg(xaserverarg arg)
    {
        int hItem = tv_folder.GetCaretItem();
        arg.AddArg("sheetname",sheetname);
        if(hItem > 0)
        {
            msxml::IXMLDOMElement e = tv_folder.GetItemData(hItem);
            if(e)
            {
                string  no = e.getAttribute("no");
                if(no.find("Customer:")>=0)
                {
                    arg.AddArg("CustomerID",e.getAttribute("id"));
                    string name = e.getAttribute("name");
                    if(name.find("(")>=0) name = name.left(name.find("("));
                    arg.AddArg("CustomerName",name);
                }
            }
        }
        return 1;
    }
};
jrj/project/business/Product.list.cpp
jrj/project/business/Product.maint.cpp
jrj/project/business/Quote3.list3.cpp
Binary files differ
jrj/project/business/Quote3.maint.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,1230 @@
#include <wobject/xstring.hpp>
#include <xcontrol/xtreeview.hpp>
#include <xcontrol/xdwgrid.hpp>
#include "vbusiness/vframe/maint.vframe.vbusiness.hpp"
#include "viewobject/view.base.hpp"
#include "viewobject/view.base.hpp"
using xml = KXMLDOMDocument;
class Quote3MaintWin : public maint
{
public:
    xdwgrid    dw_goods;
    xdwtable dw_base;
    xnode    m_agentNode;    //Agent Condition
public:
    Quote3MaintWin(void* implPtr, HWND hWnd) :maint(implPtr, hWnd) {}
public:
    static Quote3MaintWin* CreateInstance(void* implPtr, void* hWnd)
    {
        Quote3MaintWin* pWin = new Quote3MaintWin(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, int param)
    {
        //重置工具条
        SetAgent();
        return 1;
    }
    xstring GetEntityData(LPARAM pr)
    {
        dw_base.AcceptText();
        dw_goods.AcceptText();
        if (dw_base.GetItemString(1, L"QuoteNo") == L"")
        {
            xstring QuoteNo = QuoteView::MakeBillNo();
            dw_base.SetItemString(1, L"QuoteNo", QuoteNo);
        }
        xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        dw_goods.DwUpdateAllToEx(x.GetXmlDoc());
        dw_base.DwUpdateAllTo(x.GetXmlDoc());
        return x.GetXml();
    }
    int SetSeqNo(xdwgrid dw_obj, xstring SeqNoColumn, int nRow)
    {
        if (nRow > 1)
        {
            int SeqNo = dw_goods.GetItemInt(nRow - 1, SeqNoColumn);
            if (SeqNo != 0) SeqNo += 10; else SeqNo = nRow * 10;
            dw_obj.SetItemInt(nRow, SeqNoColumn, SeqNo);
        }
        else
            dw_obj.SetItemInt(nRow, SeqNoColumn, 10);
        return 1;
    }
    int DoUpdate(bool showSuccess)
    {
        if (publiccode::GetUser().id != dw_base.GetItemString(1, L"SalespersonID"))
        {
            alert(L"只允许当前本人修改,保存!");
            return 0;
        }
        dw_base.AcceptText();
        dw_goods.AcceptText();
        if (dw_base.GetItemString(1, L"QuoteNo") == L"")
        {
            xstring QuoteNo = QuoteView::MakeBillNo();
            dw_base.SetItemString(1, L"QuoteNo", QuoteNo);
        }
        xstring Source = dw_base.GetItemString(1, L"Source");
        if (Source != L"客户选单")
        {
            if (dw_base.GetItemString(1, L"CustomerID") == L"")
            {
                alert(L"请输入客户!");
                return 0;
            }
            if (dw_base.GetItemString(1, L"PriceTerm") == L"")
            {
                alert(L"请输入价格条款!");
                return 0;
            }
            if (dw_base.GetItemString(1, L"LoadPort") == L"")
            {
                alert(L"请输入出口口岸!");
                return 0;
            }
        }
        xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        dw_goods.DwUpdateAllToEx(x.GetXmlDoc());
        dw_base.DwUpdateAllTo(x.GetXmlDoc());
        //trace(x.GetXml());
        //return 1;
        if (dw_goods.GetRowCount() == 0)
        {
            alert(L"请转入产品!");
            return 0;
        }
        if (Source != L"客户选单")
        {
            for (int i = 1; i <= dw_goods.GetRowCount(); i++)
            {
                if (dw_goods.GetItemString(i, L"FobUnitPrice") == L"" || dw_goods.GetItemString(i, L"FobUnitPrice") == L".000")
                {
                    alert(L"请输入FOBä»·æ ¼!");
                    return 0;
                }
                if (dw_goods.GetItemString(i, L"PaperCardPrice") == L"" || dw_goods.GetItemString(i, L"PaperCardPrice") == L".0000")
                {
                    alert(L"请输入纸卡价!");
                    return 0;
                }
                if (dw_goods.GetItemString(i, L"VATRefundRate") == L"")
                {
                    alert(L"请输入退税率!");
                    return 0;
                }
                if (dw_goods.GetItemString(i, L"ItemMiniQty") == L"")
                {
                    alert(L"请输入起订量!");
                    return 0;
                }
                if (dw_goods.GetItemString(i, L"ItemName") == L"")
                {
                    alert(L"请输入英文品名!");
                    return 0;
                }
                if (dw_goods.GetItemString(i, L"Packages") == L"" || dw_goods.GetItemString(i, L"Packages") == L"0")
                {
                    alert(L"请输入外箱装数!");
                    return 0;
                }
            }
        }
        xstring error = L"";
        arg.AddArg(L"content", x.GetXml());
        trace(x.GetXml());
        if (url::get(L"/sale/data/Quote/update", arg.GetString(), x) != 1)
        {
            error = x.GetXmlDoc().text;
            alert(error);
        }
        else
        {
            xstring str = x.GetXmlDoc().documentElement.getAttribute(L"text");
            if (str == L"true")
            {
                dw_goods.ResetUpdateStatus();
                dw_base.ResetUpdateStatus();
                if (showSuccess)alert(L"保存成功!");
                OnRetrieve(dw_base.GetGuid(1));
                return -1;
            }
            else
            {
                if (showSuccess)alert(L"保存失败!");
                return -1;
            }
        }
        return 1;
    }
    int OnSave()
    {
        DoUpdate(true);
        return 1;
    }
    int ImportProductByText(xstring str)
    {
        xstring CustomerID = dw_base.GetItemString(1, L"CustomerID");
        //alert(str+L"----"+CustomerID);
        xml x;
        if (CustomerID == L"")
            x = QuoteView::LookupProductsByText(str);
        else
            x = QuoteView::LookupProductsByText(str, CustomerID);
        if (!x) return 1;
        KXMLDOMNodeList items = x.GetXmlDoc().selectNodes(L"/Items/Item");
        int len = items.length;
        for (int i = 0; i < len; i++)
        {
            KXMLDOMElement e = items.item(i);
            dw_goods.InsertRow(0);
            //alert(e.xml);
            int nRow = dw_goods.GetRowCount();
            SetSeqNo(dw_goods, L"SeqNo", nRow);
            dw_goods.SetItemString(nRow, L"UOMCode", L"007");
            dw_goods.SetItemDisplayString(nRow, L"UOMCode", L"PCS");
            dw_goods.SetItemString(nRow, L"KOPCode", L"120");
            dw_goods.SetItemDisplayString(nRow, L"KOPCode", L"CTNS");
            dw_goods.SetItemString(nRow, L"SKUNo", e.getAttribute(L"SKUNo"));
            dw_goods.SetItemString(nRow, L"ItemID", e.getAttribute(L"SKUID"));
            dw_goods.SetItemString(nRow, L"ItemName", e.getAttribute(L"EName"));
            dw_goods.SetItemString(nRow, L"GoodsNo", e.getAttribute(L"GoodsNo"));
            dw_goods.SetItemString(nRow, L"CustomerItemNo", e.getAttribute(L"CustomerItemNo"));
            dw_goods.SetItemString(nRow, L"Packing", e.getAttribute(L"Packing"));
            dw_goods.SetItemString(nRow, L"VolumeDesc", e.getAttribute(L"VolumeDesc"));
            dw_goods.SetItemString(nRow, L"Packages", e.getAttribute(L"QtyPerPkg"));
            dw_goods.SetItemString(nRow, L"VATRefundRate", e.getAttribute(L"VATRefundRate"));
            dw_goods.SetItemString(nRow, L"VATRate", e.getAttribute(L"VATRate"));
            dw_goods.SetItemString(nRow, L"HSCode", e.getAttribute(L"HSCode"));
            dw_goods.SetItemString(nRow, L"POPrice", e.getAttribute(L"POPrice"));
            dw_goods.SetItemString(nRow, L"SampleFee", e.getAttribute(L"SampleFee"));
            dw_goods.SetItemString(nRow, L"TestFee", e.getAttribute(L"TestFee"));
            dw_goods.SetItemString(nRow, L"ModelFee", e.getAttribute(L"ModelFee"));
            dw_goods.SetItemString(nRow, L"ProductDesc", e.getAttribute(L"ProductDesc"));
            xstring POPrice_display = e.getAttribute(L"POPrice_displaystring");
            if (POPrice_display != L"") dw_goods.SetItemDisplayString(nRow, L"POPrice", POPrice_display);
            //xstring POPrice_display = e.getAttribute(L"POPrice_tipstring");
            //if(POPrice_display !=L"") dw_goods.SetItemDisplayString(nRow,L"POPrice",POPrice_display);
            dw_goods.SetItemString(nRow, L"CurPOPrice", e.getAttribute(L"CurPOPrice"));
            dw_goods.SetItemString(nRow, L"EnquiryLineID", e.getAttribute(L"EnquiryLineID"));
            dw_goods.SetItemString(nRow, L"EnquiryPriceListID", e.getAttribute(L"EnquiryPriceListID"));
            dw_goods.SetItemString(nRow, L"PurcharID", e.getAttribute(L"PurcharID"));
            //alert(e.getAttribute(L"ItemMiniQty"));
            dw_goods.SetItemString(nRow, L"ItemMiniQty", e.getAttribute(L"ItemMiniQty"));
            if (dw_goods.GetItemString(nRow, L"VolumeDesc") != L"" &&
                dw_goods.GetItemString(nRow, L"Packages") != L"")
            {
                int qty = EvalQtyPerFCL45H(nRow);
                dw_goods.SetItemString(nRow, L"Packages45H", qty.toString());
                dw_goods.SetItemDouble(nRow, L"TransportationFee", 5000.0 / qty);
            }
            dw_goods.SetItemString(nRow, L"NwPerPkg", e.getAttribute(L"NwPerPkg"));
            dw_goods.SetItemString(nRow, L"GwPerPkg", e.getAttribute(L"GwPerPkg"));
            dw_goods.SetItemString(nRow, L"QtyPerPk", e.getAttribute(L"QtyPerPk"));
            dw_goods.SetItemString(nRow, L"InnerQty", e.getAttribute(L"InnerQty"));
        }
        dw_goods.Redraw();
        int row = dw_goods.GetRow();
        if (row >= 1)
        {
            imageview im = GetControl(L"im1");
            im.ResetEx();
            xstring skuno = dw_goods.GetItemString(row, L"SKUNo");
            OnShowImage(skuno, row);
            im.Redraw();
        }
        return 1;
    }
    double EvalCost(int row)
    {
        double cost = 0.0;
        cost += dw_goods.GetItemDouble(row, L"POPrice");
        cost += dw_goods.GetItemDouble(row, L"PaperCardPrice");
        cost += dw_goods.GetItemDouble(row, L"TransportationFee");
        cost += dw_goods.GetItemDouble(row, L"OtherFee");
        cost += dw_goods.GetItemDouble(row, L"ManagementFee");
        return cost;
    }
    double EvalRefund(int row)
    {
        double VATRefundRate = dw_goods.GetItemDouble(row, L"VATRefundRate");
        double VATRefund = dw_goods.GetItemDouble(row, L"POPrice") * VATRefundRate / 117.0;
        VATRefund += dw_goods.GetItemDouble(row, L"PaperCardPrice") * 13.0 / 117.0;
        return VATRefund;
    }
    int EvalQtyPerFCL45H(int row)
    {
        double vol = EvalVol(dw_goods.GetItemString(row, L"VolumeDesc"));
        double packages = dw_goods.GetItemDouble(row, L"Packages");
        return (packages * 65.0 / vol).toInt();
    }
    double EvalUnitProfit(int row)
    {
        double ExchangeRate = dw_base.GetItemDouble(1, L"ExchangeRate");
        double FobUnitPrice = dw_goods.GetItemDouble(row, L"FobUnitPrice");
        double UnitCost = dw_goods.GetItemDouble(row, L"UnitCost");
        double VATRefund = dw_goods.GetItemDouble(row, L"VATRefund");
        return ExchangeRate * FobUnitPrice - UnitCost + VATRefund;
    }
    double EvalProfitRate(int row)
    {
        double UnitProfit = EvalUnitProfit(row);
        double UnitCost = dw_goods.GetItemDouble(row, L"UnitCost");
        return UnitProfit / UnitCost;
    }
    double EvalSaleProfitRate(int row)
    {
        double UnitProfit = EvalUnitProfit(row);
        double FobUnitPrice = dw_goods.GetItemDouble(row, L"FobUnitPrice");
        return UnitProfit / FobUnitPrice;
    }
    double EvalExchangeCostRate(int row)
    {
        double FobUnitPrice = dw_goods.GetItemDouble(row, L"FobUnitPrice");
        double UnitCost = dw_goods.GetItemDouble(row, L"UnitCost");
        double VATRefund = dw_goods.GetItemDouble(row, L"VATRefund");
        return (UnitCost - VATRefund) / FobUnitPrice;
    }
    double EvalTransportationFee(int row)
    {
        double vol = EvalVol(dw_goods.GetItemString(row, L"VolumeDesc"));
        double packages = dw_goods.GetItemDouble(row, L"Packages");
        return 80 * vol / packages;
    }
    double EvalVol(xstring value)
    {
        double vol = 1.0;
        xstring volstr = value;
        int pos1 = volstr.find(L"*");
        int pos2 = volstr.find(L"X");
        int pos3 = volstr.find(L"x");
        int pos = pos1;
        trace(L"pos: " + pos.toString() + L"pos1: " + pos1.toString() + L"pos2: " + pos2.toString() + L"pos3: " + pos3.toString());
        if (pos2 > 0 && pos == -1) pos = pos2;
        if (pos2 >= 0 && pos2 < pos) pos = pos2;
        trace(L"pos: " + pos.toString() + L"pos1: " + pos1.toString() + L"pos2: " + pos2.toString() + L"pos3: " + pos3.toString());
        if (pos3 > 0 && pos == -1) pos = pos3;
        if (pos3 >= 0 && pos3 < pos) pos = pos3;
        trace(L"pos: " + pos.toString() + L"pos1: " + pos1.toString() + L"pos2: " + pos2.toString() + L"pos3: " + pos3.toString());
        while (pos >= 0)
        {
            xstring tm = volstr.left(pos);
            volstr = volstr.mid(pos + 1, 9999);
            vol *= tm.toDouble();
            pos1 = volstr.find(L"*");
            pos2 = volstr.find(L"X");
            pos3 = volstr.find(L"x");
            pos = pos1;
            if (pos2 > 0 && pos == -1) pos = pos2;
            if (pos2 >= 0 && pos2 < pos) pos = pos2;
            if (pos3 > 0 && pos == -1) pos = pos3;
            if (pos3 >= 0 && pos3 < pos) pos = pos3;
        }
        if (volstr != L"") vol *= volstr.toDouble();
        return vol / 1000000.0;
    }
    int ClassifyChanged(int row, xstring ClassifyID)
    {
        xml x = ViewObject::RetrieveData(L"/sale/data/Custom3/custom/classifyinfo", L"ClassifyID", ClassifyID);
        if (x)
        {
            KXMLDOMNode o = x.GetXmlDoc().selectSingleNode(L"data/Item");
            if (o.selectSingleNode(L"VATRefundRate"))
            {
                //dw_goods.SetItemString(i,L"VATRefundRate",o.selectSingleNode(L"VATRefundRate").text);
                dw_goods.ItemChangeTo(row, L"VATRefundRate", o.selectSingleNode(L"VATRefundRate").text);
            }
            else
            {
                dw_goods.ItemChangeTo(row, L"VATRefundRate", L"");
            }
        }
        return 1;
    }
    //包装数改变颜色
    int OnItemAskStyle(ref TNotifyEvent evt, int p)
    {
        int DMS_CSSSTYLE = 0x8;
        ref DWASKSTYLENMHDR hdr = trust(evt.pnmh as ref DWASKSTYLENMHDR);
        int row = hdr.row;
        int col = hdr.col;
        xstring colname = hdr.colname;
        int rows = dw_goods.GetRowCount();
        if (row < 1 || row > rows)
        {
            return 1;
        }
        if (colname == L"POPrice")
        {
            xstring POPrice = dw_goods.GetItemDisplayString(row, L"POPrice");
            if (POPrice == L"") POPrice = dw_goods.GetItemString(row, L"POPrice");
            xstring CurPOPrice = dw_goods.GetItemDisplayString(row, L"CurPOPrice");
            xstring POPrices = dw_goods.GetItemString(row, L"POPrices");
            if (POPrice == L"" || CurPOPrice == L"" || POPrices == L"") return 1;
            if (CurPOPrice.find(POPrice, 0) < 0)
                //if(POPrice.find(POPrices,0)<0)
            {
                hdr.mask = DMS_CSSSTYLE;
                hdr.cssstyle = L"color:#ff0000;text-decoration:underline";
            }
        }
        return 1;
    }
    int OnItemChanged(ref TNotifyEvent evt, int p)
    {
        ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR);
        xstring colname = hdr.colname;
        xstring value = hdr.data;
        int row = hdr.row;
        double VATRefund = 0.0;
        double VATRefundRate = 0.0;
        if (colname == L"ClassifyID")
        {
            return ClassifyChanged(row, value);
        }
        if ((colname == L"GoodsNo" || colname == L"CustomerItemNo") && value != L"")
        {
            if (colname == L"CustomerItemNo")
            {
                if (dw_goods.GetItemString(row, L"GoodsNo") != L"") return 1;
            }
            xml x;
            xstring CustomerID = dw_base.GetItemString(1, L"CustomerID");
            xstring sval = value;
            if (colname == L"GoodsNo") sval = L"gs:" + value;
            if (colname == L"CustomerItemNo") sval = L"cs:" + value;
            if (CustomerID != L"")
                x = QuoteView::LookupProductsByText(sval, CustomerID);
            else
                x = QuoteView::LookupProductsByText(sval);
            if (!x) return 1;
            KXMLDOMNodeList items = x.GetXmlDoc().selectNodes(L"/Items/Item");
            int len = items.length;
            if (len == 0)
            {
                if (colname == L"GoodsNo")alert(L"没有此公司型号!");
                return 1;
            }
            if (len >= 1)
            {
                KXMLDOMElement e = items.item(0);
                int nRow = dw_goods.GetRow();
                dw_goods.SetItemString(nRow, L"SKUNo", e.getAttribute(L"SKUNo"));
                dw_goods.SetItemString(nRow, L"ItemID", e.getAttribute(L"SKUID"));
                dw_goods.SetItemString(nRow, L"ItemName", e.getAttribute(L"EName"));
                if (colname == L"CustomerItemNo")dw_goods.SetItemString(nRow, L"GoodsNo", e.getAttribute(L"GoodsNo"));
                if (colname == L"GoodsNo")dw_goods.SetItemString(nRow, L"CustomerItemNo", e.getAttribute(L"CustomerItemNo"));
                dw_goods.SetItemString(nRow, L"Packing", e.getAttribute(L"Packing"));
                dw_goods.SetItemString(nRow, L"VolumeDesc", e.getAttribute(L"VolumeDesc"));
                dw_goods.SetItemString(nRow, L"Packages", e.getAttribute(L"QTYPerPkg"));
                if (dw_goods.GetItemString(nRow, L"VolumeDesc") != L"" &&
                    dw_goods.GetItemString(nRow, L"Packages") != L"")
                {
                    int qty1 = EvalQtyPerFCL45H(nRow);
                    dw_goods.SetItemString(nRow, L"Packages45H", qty1.toString());
                    dw_goods.SetItemDouble(nRow, L"TransportationFee", 5000.0 / qty1);
                }
                dw_goods.Redraw();
            }
        }
        else if (colname == L"POPrice" || colname == L"PaperCardPrice" || colname == L"TransportationFee" ||
            colname == L"OtherFee" || colname == L"ManagementFee")
        {
            dw_goods.SetItemDouble(row, L"UnitCost", EvalCost(row));
            if ((colname == L"POPrice" || colname == L"PaperCardPrice") && dw_goods.GetItemString(row, L"VATRefundRate") != L"")
            {
                dw_goods.SetItemDouble(row, L"VATRefund", EvalRefund(row));
            }
        }
        else if (colname == L"VATRefundRate" && value != L"")
        {
            dw_goods.SetItemDouble(row, L"VATRefund", EvalRefund(row));
        }
        else if (colname == L"VolumeDesc" || colname == L"Packages")
        {
            if (dw_goods.GetItemString(row, L"VolumeDesc") != L"" &&
                dw_goods.GetItemString(row, L"Packages") != L"")
            {
                int qty = EvalQtyPerFCL45H(row);
                dw_goods.SetItemString(row, L"Packages45H", qty.toString());
                dw_goods.SetItemDouble(row, L"TransportationFee", EvalTransportationFee(row));
                dw_goods.SetItemDouble(row, L"UnitCost", EvalCost(row));
            }
        }
        else if (colname == L"FobUnitPrice")
        {
            xstring CurrencyCode = dw_base.GetItemString(1, L"CurrencyCode");
            xstring expRate = L"";
            xstring exchRate = L"";
            xstring prepareFeeRate = L"";
            xml x0 = ViewObject::RetrieveData(L"/sale/data/GDN3/profit/param", L"item", L"mgtFeeRate");
            if (x0.GetXmlDoc().selectSingleNode(L"root/item/@value"))
                expRate = x0.GetXmlDoc().selectSingleNode(L"root/item/@value").text;
            x0 = ViewObject::RetrieveData(L"/sale/data/GDN3/profit/param", L"item", L"cryrate");
            if (x0.GetXmlDoc().selectSingleNode(L"root/item/@value"))
                exchRate = x0.GetXmlDoc().selectSingleNode(L"root/item/@value").text;
            x0 = ViewObject::RetrieveData(L"/sale/data/GDN3/profit/param", L"item", L"prepareFeeRate");
            if (x0.GetXmlDoc().selectSingleNode(L"root/item/@value"))
                prepareFeeRate = x0.GetXmlDoc().selectSingleNode(L"root/item/@value").text;
            //alert(exchRate);
            //alert(expRate);
            double r1 = exchRate.toDouble();
            double r2 = expRate.toDouble();
            double r3 = prepareFeeRate.toDouble();
            double val = value.toDouble();
            if (CurrencyCode == L"RMB" || CurrencyCode == L"CNY")
            {
                if (exchRate != L"")
                {
                    double ManagementFee = (val / r1) * r1;
                    double OtherFee = (val / r1) * r3;
                    dw_goods.SetItemDouble(row, L"ManagementFee", ManagementFee);
                    dw_goods.SetItemDouble(row, L"OtherFee", OtherFee);
                }
            }
            else
            {
                dw_goods.SetItemDouble(row, L"ManagementFee", val * r2);
                dw_goods.SetItemDouble(row, L"OtherFee", val * r3);
            }
            dw_goods.SetItemDouble(row, L"UnitCost", EvalCost(row));
        }
        if (dw_goods.GetItemString(row, L"FobUnitPrice") != L"" &&
            dw_goods.GetItemString(row, L"POPrice") != L"" &&
            dw_goods.GetItemString(row, L"VolumeDesc") != L"" &&
            dw_goods.GetItemString(row, L"Packages") != L"")
        {
            dw_goods.SetItemDouble(row, L"UnitProfit", EvalUnitProfit(row));
            dw_goods.SetItemDouble(row, L"ProfitRate", EvalProfitRate(row));
            dw_goods.SetItemDouble(row, L"SaleProfitRate", EvalSaleProfitRate(row));
            dw_goods.SetItemDouble(row, L"ExchangeCostRate", EvalExchangeCostRate(row));
        }
        dw_goods.Redraw();
        return 1;
    }
    int OnBaseItemChanged(ref TNotifyEvent evt, int p)
    {
        ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR);
        xstring colname = hdr.colname;
        xstring value = hdr.data;
        xstring dwname = L"dw_base";
        if (value != L"")
        {
            KXMLDOMNodeList nlist = GetElement().selectNodes(L"//*[@name='" + dwname + L"']/trans[@for='" + colname + L"']");
            ViewObject::TransData(nlist, dw_base, hdr.row, colname, value);
        }
        if (colname == L"ExchangeRate")
        {
            if (dw_goods.GetRowCount() > 0)
            {
                for (int i = 1; i <= dw_goods.GetRowCount(); i++)
                {
                    dw_goods.SetItemDouble(i, L"UnitProfit", EvalUnitProfit(i));
                    dw_goods.SetItemDouble(i, L"ProfitRate", EvalProfitRate(i));
                    dw_goods.SetItemDouble(i, L"SaleProfitRate", EvalSaleProfitRate(i));
                    dw_goods.SetItemDouble(i, L"ExchangeCostRate", EvalExchangeCostRate(i));
                }
            }
            dw_goods.RedrawEx();
        }
        return 1;
    }
    int OnPriceEval()
    {
        OpenWindow(L"dev:xpage[eval.quote3.vx]", cast(dw_goods as int));
        return 1;
    }
    int OnRowChanged(ref TNotifyEvent evt, int p)
    {
        ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR);
        int row = hdr.row;
        imageview im = GetControl(L"im1");
        im.ResetEx();
        xstring skuno = dw_goods.GetItemString(row, L"SKUNo");
        OnShowImage(skuno, row);
        im.Redraw();
        return 1;
    }
    int OnShowImage()
    {
        int rowCount = dw_goods.GetRowCount();
        xstring skunos;
        for (int i = 1; i <= rowCount; i++)
        {
            xstring skuno = dw_goods.GetItemString(i, L"SKUNo");
            if (i == 1)
                skunos = skuno;
            else
                skunos += L",L" + skuno;
        }
        xaserverarg arg_pic = new xaserverarg;
        arg_pic.setNativePointer(arg_pic.CreateInstance());
        arg_pic.AddArg(L"SKUNoList", skunos);
        arg_pic.AddArg(L"ParentWindow", GetHWND().toString());
        arg_pic.AddArg(L"OpenFlag", L"1");
        OpenWindow(L"dev:xpage[SKU.PictureView.Product3.vx]", cast(arg_pic as int));
        return 1;
    }
    int OnShowImage(xstring skuno, int row)
    {
        imageview im = GetControl(L"im1");
        xml xp = new xml;
        xp.setNativePointer(xml::CreateInstance());
        xaserverarg arg_pic = new xaserverarg;
        arg_pic.setNativePointer(arg_pic.CreateInstance());
        arg_pic.AddArg(L"SKUNo", skuno);
        xstring res = L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo";
        xstring customerID = dw_base.GetItemString(1, L"CustomerID");
        xstring customerItemNo = dw_goods.GetItemString(row, L"CustomerItemNo");
        if (customerItemNo != L"")
        {
            trace(customerID + L":" + customerItemNo);
            res = L"/sale/data/ProductLibrary3/pref/picture/customer/imagelistSKUNo";
            arg_pic.AddArg(L"CustomerID", customerID);
            arg_pic.AddArg(L"CustomerItemNo", customerItemNo);
        }
        bool hasIamge = false;
        if (url::get(res, arg_pic.GetString(), xp) != 1)
        {
            trace(xp.GetXml());
            return 1;
        }
        else
        {
            KXMLDOMNodeList  nlistp = xp.GetXmlDoc().selectNodes(L"ImageList/image");
            int lenp = nlistp.length;
            for (int ip = 0; ip < lenp; ip++)
            {
                hasIamge = true;
                KXMLDOMElement xitem = nlistp.item(ip);
                xstring picname = xitem.selectSingleNode(L"PicPath").text;
                xstring goodno = xitem.selectSingleNode(L"GoodsNo").text;
                if (picname == L"/business/products/Thumbs//")
                    picname = L"/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg";
                im.AddImages(picname, goodno);
            }
        }
        if (!hasIamge)
        {
            res = L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo";
            if (url::get(res, arg_pic.GetString(), xp) != 1)
            {
                trace(xp.GetXml());
                return 1;
            }
            else
            {
                nlistp = xp.GetXmlDoc().selectNodes(L"ImageList/image");
                lenp = nlistp.length;
                for (ip = 0; ip < lenp; ip++)
                {
                    xitem = nlistp.item(ip);
                    picname = xitem.selectSingleNode(L"PicPath").text;
                    goodno = xitem.selectSingleNode(L"GoodsNo").text;
                    if (picname == L"/business/products/Thumbs//")
                        picname = L"/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg";
                    im.AddImages(picname, goodno);
                }
            }
        }
        return 1;
    }
    int OnPrint()
    {
        if (dw_base.GetItemString(1, L"QuoteNo") == L"")
        {
            alert(L"请先保存数据!");
            return 1;
        }
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg(L"EntityName", L"Quote", L"");
        arg.AddArg(L"EntityID", dw_base.GetItemString(1, L"QuoteID"), L"");
        arg.AddArg(L"EntityNo", dw_base.GetItemString(1, L"QuoteNo"), L"");
        trace(dw_base.GetItemString(1, L"QuoteID") + L"***" + dw_base.GetItemString(1, L"QuoteNo"));
        int p = arg.ptr_native_;
        openUrl(L"/sale/view/view.base/xpage/Template/PrintViewEx", p);
        return 1;
    }
    int ReSeqNo(xstring SeqNoColumn)
    {
        for (int i = 1; i <= dw_goods.GetRowCount(); i++)
        {
            dw_goods.SetItemString(i, SeqNoColumn, (i * 10).toString());
        }
        dw_goods.Redraw();
        return 1;
    }
    //命令发布函数
    int OnCmdDispatch(xstring comdid)
    {
        if (comdid == L"xmNewProduct")
        {
            //xaserverarg arg = new xaserverarg;
            //arg.setNativePointer(arg.CreateInstance());
            openUrl(L"/sale/view/Quote3/xpage/quick/newestproduct", GetHWND());
            return 1;
        }
        else if (comdid == L"xmPrint") return OnPrint();
        else if (comdid == L"xmImage")
            return OnShowImage();
        else if (comdid == L"xmImportProduct")
        {
            xstring str = GetControl(L"goods").GetText();
            str = str.trim();
            if (str == L"")
            {
                xaserverarg arg1 = new xaserverarg;
                arg1.setNativePointer(arg1.CreateInstance());
                arg1.AddArg(L"HWND", GetHWND().toString());
                arg1.AddArg(L"CustomerID", dw_base.GetItemString(1, L"CustomerID"));
                OpenWindow(L"dev:xpage[Product.Select.vx]", cast(arg1 as int));
                int row = dw_goods.GetRow();
                if (row >= 1)
                {
                    imageview im = GetControl(L"im1");
                    im.ResetEx();
                    xstring skuno = dw_goods.GetItemString(row, L"SKUNo");
                    OnShowImage(skuno, row);
                    im.Redraw();
                }
            }
            else
                ImportProductByText(str);
            return 1;
        }
        else if (comdid == L"xmSave")
        {
            if (publiccode::GetUser().id != dw_base.GetItemString(1, L"SalespersonID"))
            {
                alert(L"只允许当前本人修改,保存!");
                return 0;
            }
            OnSave();
            return 1;
        }
        else if (comdid == L"xmPriceEval")
            return OnPriceEval();
        else if (comdid == L"xmOpen")
        {
            xaserverarg arg = new xaserverarg;
            arg.setNativePointer(arg.CreateInstance());
            OpenWindow(L"dev:xpage[SOQuote.list.vx]", cast(arg as int));
            if (arg.GetArgString(L"id") != L"") return OnRetrieve(arg.GetArgString(L"id"));
            return 1;
        }
        else if (comdid == L"xmDeleteRow")
        {
            dw_goods.DeleteRow(0);
            return 1;
        }
        else if (comdid == L"xmAskGoodsNo")
        {
            return OnAskGoodsNo();
        }
        else if (comdid == L"xmReSeqNo")
        {
            if (win32::MessageBox(GetHWND(), L"是否重置序号!", L"提示1", 1) == 2)
                return 1;
            return ReSeqNo(L"SeqNo");
        }
        else if (comdid == L"xmProductDesc")
        {
            xaserverarg arg2 = new xaserverarg;
            arg2.setNativePointer(arg2.CreateInstance());
            int row2 = dw_goods.GetRow();
            if (row2 < 1) return 0;
            xstring str2 = dw_goods.GetItemString(row2, L"ProductDesc");
            arg2.AddArg(L"value", str2);
            OpenWindow(L"dev:xpage[memo.edit.new.vx]", arg2.getNativePointer());
            return 1;
        }
        else if (comdid == L"xmDescription")
        {
            arg2 = new xaserverarg;
            arg2.setNativePointer(arg2.CreateInstance());
            row2 = dw_goods.GetRow();
            if (row2 < 1) return 0;
            str2 = dw_goods.GetItemString(row2, L"Description");
            arg2.AddArg(L"value", str2);
            OpenWindow(L"dev:xpage[memo.edit.new.vx]", arg2.getNativePointer());
            if (arg2.GetArgString(L"comdid") == L"xmOK")
            {
                str2 = arg2.GetArgString(L"value");
                dw_goods.AcceptText();
                dw_goods.SetItemString(row2, L"Description", str2);
                dw_goods.Redraw();
            }
            return 1;
        }
        else if (comdid == L"xmAddRow")
        {
            int nRow = dw_goods.InsertRow(0);
            SetSeqNo(dw_goods, L"SeqNo", nRow);
            dw_goods.SetItemString(nRow, L"UOMCode", L"007");
            dw_goods.SetItemDisplayString(nRow, L"UOMCode", L"PCS");
            dw_goods.SetItemString(nRow, L"KOPCode", L"120");
            dw_goods.SetItemDisplayString(nRow, L"KOPCode", L"CTNS");
            return 1;
        }
        else if (comdid == L"xmClose")
        {
            CloseWindow();
            return 1;
        }
        else if (comdid.find(L"ImportXml:", 0) == 0)
        {
            xstring strImport = comdid.mid(L"ImportXml:".length(), 9999);
            ImportProductByText(strImport);
            return 1;
        }
        return 0;
    }
    int OnImgDBClicked(ref TNotifyEvent evt, int pr)
    {
        ref IMGNNMHDR nmtv = evt.pnmh;
        xstring src = nmtv.path;
        /*if(src.length() > 60)
            src = src.right(44);
        else
            src=src.mid(src.find(L"Thumbs", 0)+6, 50);
        */
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        //arg.AddArg(L"src",L"/business/products/chanpin"+src);
        arg.AddArg(L"src", src);
        //win::OpenWindow(L"dev:xpage[BigPicture.vx]",arg);
        int h = openUrl(L"/sale/view/ProductLibrary/xpage/bigpictureview", arg);
        return 1;
        /*
        xwin x = new xwin;
        x.setNativePointer(h);
        m_winHwnd = x.GetHWND();
        xstring sh = doc.GetXml();
        int p = cast(sh as int);
        win32::SendMessage(m_winHwnd, 0x401, p, 0);
        */
        return 1;
    }
    //命令处理事件
    int OnXCommand(ref TXCommandEvent evt, int param)
    {
        return OnCmdDispatch(evt.pStrID);
    }
    int OnDoubleClicked(ref TNotifyEvent evt, int p)
    {
        ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR);
        xstring colname = hdr.colname;
        int row = hdr.row;
        dw_goods.AcceptText();
        int hCursor = xutil::SetCursorWait();
        if (colname == L"CurPOPrice")
        {
            xstring str = dw_goods.GetItemDisplayString(row, L"CurPOPrice");
            //xstring str =dw_goods.GetItemString(row,L"POPrices");
            if (str.find(L"[", 0) > 0)
            {
                xstring val = str.left(str.find(L"[", 0));
                xstring val1 = val;
                if (val.right(1) == L"A" or val.right(1) == L"B" or val.right(1) == L"C")
                    val1 = val.left(val.length() - 1);
                dw_goods.ItemChangeTo(dw_goods.GetRow(), L"POPrice", val1);
                dw_goods.SetItemDisplayString(dw_goods.GetRow(), L"POPrice", val);
            }
            //alert(dw_goods.GetItemString(dw_goods.GetRow(),L"CurPOPrice"));
            dw_goods.SetItemString(dw_goods.GetRow(), L"EnquiryPriceListID",
                dw_goods.GetItemString(dw_goods.GetRow(), L"CurPOPrice"));
            //dw_goods.SetItemString(dw_goods.GetRow(),L"EnquiryLineID",
            //        dw_goods.GetItemString(dw_goods.GetRow(),L"CurPOPrice"));
        }
        dw_goods.Redraw();
        xutil::RestoreCursor(hCursor);
        return 1;
    }
    int OnAttachEvent()
    {
        //绑定工具条点击事件
        AttachEvent(L"WM_XCOMMAND", OnXCommand);
        //获取焦点事件,用于重置工具条
        AttachEvent(L"WM_SETFOCUS", OnSetFocus);
        AttachEvent(L"dw_goods", L"DWV_ITEMCHANGED", OnItemChanged);
        AttachEvent(L"dw_base", L"DWV_ITEMCHANGED", OnBaseItemChanged);
        AttachEvent(L"im1", L"IMG_LDBCLICK", OnImgDBClicked);
        AttachEvent(L"dw_goods", L"DWV_ROWFOCUSCHANGED", OnRowChanged);
        AttachEvent(L"dw_goods", L"DWV_ASKSTYLE", OnItemAskStyle);
        AttachEvent(L"dw_goods", L"DWV_DOUBLECLICKED", OnDoubleClicked);//行双击
        AttachEvent(L"dw_goods", L"DWV_ITEMCHANGING", OnItemChanging);
        AttachCloseWindow();
        return 1;
    }
    int OnItemChanging(ref TNotifyEvent evt, int p)
    {
        ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR);
        xstring colname = hdr.colname;
        xstring value = hdr.data;
        int row = hdr.row;
        if (value == L"") return 1;
        xstring cellType = dw_goods.GetColumnProp(colname, L"celltype");
        if (cellType == L"xs:decimal" || cellType == L"xs:integer")
        {
            if (value.isNumber() == false)
            {
                alert(value + L"不是数字!");
                hdr.idFrom = -1;
                return 1;
            }
        }
    }
    int  OnRetrieve(xstring id)
    {
        xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg(L"id", id);
        //alert(id);
        if (getUrl(L"/sale/data/Quote/maint", arg.GetString(), x) != 1)
        {
            trace(x.GetXmlDoc().text);
            return -1;
        }
        else
        {
            trace(x.GetXml());
            dw_base.Retrieve(x);
            dw_base.Redraw();
            dw_goods.Retrieve(x);
            dw_goods.Redraw();
            if (dw_goods.GetRowCount() > 0)
            {
                imageview im = GetControl(L"im1");
                im.ResetEx();
                xstring skuno = dw_goods.GetItemString(1, L"SKUNo");
                OnShowImage(skuno, 1);
                im.Redraw();
            }
        }
        return 1;
    }
    xstring GetExchangeRate(xstring pcur, xstring pdate)
    {
        if (pcur.upper() == L"RMB") return "1";
        xstring exchangeRate = L"";
        if (exchangeRate == L"") {
            xml x = ViewObject::RetrieveData(L"/sale/data/GDN3/profit/param", L"item", L"cryrate");
            if (x.GetXmlDoc().selectSingleNode(L"root/item/@value"))
                exchangeRate = x.GetXmlDoc().selectSingleNode(L"root/item/@value").text;
        }
        /*xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        xaserverarg args=new xaserverarg;
        args.setNativePointer(args.CreateInstance());
        args.AddArg(L"currency", pcur);
        if(pdate != L"") args.AddArg(L"date", pcur);
        xstring ls_date=L"";
        if(xaserver::ExecXQuery(L"",L"[GetCurrencyExchangeRate.xq]",args.GetString(),x)==1)
        {
            KXMLDOMElement e= x.GetXmlDoc().documentElement;
            if(e)
                if(e.selectSingleNode(L"ExchangeRate"))
                    ls_date =  e.selectSingleNode(L"ExchangeRate").text;  //e.getAttribute(L"date");
        }
            return ls_date+L"";
        */
        return exchangeRate;
    }
    xstring GetExchangeRate(xstring pcur)
    {
        return GetExchangeRate(pcur, L"");
    }
    int OnInit()
    {
        //公司抬头、报价人、报价日期
        xstring sdate = publiccode::GetCurrentDate();
        dw_base.SetItemString(1, L"QuoteDate", sdate);
        xstring suserid = publiccode::GetUser().id;
        xstring susername = publiccode::GetUser().name;
        dw_base.SetItemString(1, L"SalespersonID", suserid);
        dw_base.SetItemDisplayString(1, L"SalespersonID", susername);
        dw_base.SetItemString(1, L"CurrencyCode", L"USD");
        dw_base.SetItemDisplayString(1, L"CurrencyCode", L"USD");
        xstring exchangeRate = L"";
        xml x = ViewObject::RetrieveData(L"/sale/data/GDN3/profit/paramEx", L"ETD", sdate);
        if (x.GetXmlDoc().selectSingleNode(L"root/item/@value"))
            exchangeRate = x.GetXmlDoc().selectSingleNode(L"root/item/@value").text;
        if (exchangeRate != L"")
        {
            dw_base.SetItemString(1, L"ExchangeRate", exchangeRate);
        }
        else
        {
            dw_base.SetItemString(1, L"ExchangeRate", L"6.49");
        }
        //dw_base.SetItemString(1,L"ExchangeRate",GetExchangeRate(L"USD"));
        dw_base.SetItemString(1, L"CompanyID", L"E9E3C542-062C-4957-B8F4-9B92C3E351FC");
        dw_base.SetItemDisplayString(1, L"CompanyID", L"宁波家尔佳进出口有限公司");
        /*xstring ss = L"select (select EnglishName from Party where PartyID = CompanyID) as 'CompanyID/@_displaystring',CompanyID from HR_Org where OrgID = '{$id}' for xml PATH('root'),ELEMENTS XSINIL";
        xstring scguid;
        xstring sCename;
        xml x1 = RetrieveSqlData(ss,L"id",sg);
        KXMLDOMElement e1 = x1.GetXmlDoc().documentElement;
        scguid = sureNodeText(e1,L"CompanyID");
        sCename = sureNodeText(e1,L"CompanyID/@_displaystring");
        */
        return 1;
    }
    int QuoteList(xstring QuoteID)
    {
        xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg(L"id", QuoteID);
        if (getUrl(L"/sale/data/Quote/maintOne", arg.GetString(), x) != 1)
        {
            trace(x.GetXmlDoc().text);
            return -1;
        }
        else
        {
            dw_base.Retrieve(x);
            dw_base.Redraw();
            dw_goods.Retrieve(x);
            dw_goods.Redraw();
            if (dw_goods.GetRowCount() > 0)
            {
                imageview im = GetControl(L"im1");
                im.ResetEx();
                xstring skuno = dw_goods.GetItemString(1, L"SKUNo");
                OnShowImage(skuno, 1);
                im.Redraw();
            }
        }
        dw_base.SetItemString(1, L"QuoteNo", L"");
        return 1;
    }
    int onload()
    {
        dw_goods = GetControl(L"dw_goods");
        //dw_goods .openUrl(L"/sale/view/Quote3/template/goods");
        dw_goods.openUrl(L"/sale/view/Quote3/template/item/pricelist");
        dw_goods.SetColumnState(L"ItemID", false);
        dw_goods.SetColumnState(L"EnquiryLineID", false);
        dw_goods.SetColumnState(L"EnquiryPriceListID", false);
        dw_goods.SetColumnState(L"POPrices", false);
        dw_goods.SetColumnState(L"ClassifyID", false);
        dw_goods.SetColumnState(L"Description", false);
        dw_goods.SetAskStyle(true);
        dw_base = GetControl(L"dw_base");
        dw_base.openUrl(L"/sale/view/Quote3/template/base");
        //dw_base.SetSelectionBorder(0);
        dw_base.SetColHeaderHeight(0);
        dw_base.SetRowSelectorWidth(0);
        dw_base.SetHScrollState(false);
        dw_base.SetVScrollState(false);
        if (GetParam())
        {
            xaserverarg arg = new xaserverarg;
            arg.setNativePointer(GetParam());
            xstring  QName = arg.GetArgString(L"QuoteName");
            if (QName != L"")
            {
                if (arg.GetArgString(L"QuoteID") != L"")
                {
                    QuoteList(arg.GetArgString(L"QuoteID"));
                }
            }
            //alert(arg.GetString());
            xstring QuoteNo = arg.GetArgString(L"QuoteNo");
            if (QuoteNo == L"") QuoteNo = arg.GetArgString(L"EntityNo");
            if (QuoteNo != L"")
            {
                OnRetrieve(QuoteNo);
            }
            else
            {
                OnInit();
                if (arg.GetArgString(L"CustomerID") != L"")
                {
                    dw_base.SetItemDisplayString(1, L"CustomerID", arg.GetArgString(L"CustomerName"));
                    dw_base.ItemChangeTo(1, L"CustomerID", arg.GetArgString(L"CustomerID"));
                    xstring dwname = L"dw_base";
                    xstring colname = L"CustomerID";
                    xstring value = arg.GetArgString(L"CustomerID");
                    KXMLDOMNodeList nlist = GetElement().selectNodes(L"//*[@name='" + dwname + L"']/trans[@for='" + colname + L"']");
                    ViewObject::TransData(nlist, dw_base, 1, colname, value);
                }
            }
        }
        else
            OnInit();
        OnAttachEvent();
        //dw_base.SetEditUpperMode(true);
        //dw_goods.SetEditUpperMode(true);
        return 1;
    }
    int OnAskGoodsNo()
    {
        int rowCount = dw_goods.GetRowCount();
        xstring skunos = L"";
        for (int i = 1; i <= rowCount; i++)
        {
            if (dw_goods.GetItemString(i, L"SKUNo") != L"" && dw_goods.GetItemString(i, L"GoodsNo") == L"")
            {
                if (skunos == L"")
                    skunos = dw_goods.GetItemString(i, L"SKUNo");
                else
                    skunos += L",L" + dw_goods.GetItemString(i, L"SKUNo");
            }
        }
        xaserverarg arg = ViewObject::MakeArg();
        arg.AddArg(L"SKUNoList", skunos);
        OpenWindow(L"dev:xpage[Product.FetchNo.vx]", cast(arg as int));
        return 1;
    }
    int onloaded()
    {
        SetAgent();
        return 1;
    }
};
jrj/project/business/SO3.list.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,513 @@
#include <wobject/xstring.hpp>
#include <xcontrol/xtreeview.hpp>
#include <xcontrol/xdwgrid.hpp>
#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp"
#include "viewobject/view.base.hpp"
class __declspec(dllexport) SO3list : public listwin
{
public:
    string m_sType; //树选中的类型
    string m_sTypeTxt; //树选中的数据
    string urlTree;
    string myDataUrl;
    string rows;
    xcombobox ddlb_1;
    xcombobox cbx_datashow;
    int changeddlb;
    xtreeview tv_folder;
    xdwgrid dw_goods;
    xdwgrid dw_source;
public:
    SO3list(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {}
public:
    static SO3list* CreateInstance(void* implPtr, void* hWnd)
    {
        SO3list* pWin = new SO3list(implPtr, (HWND)hWnd);
        return pWin;
    }
    //process tree
    //查找当前树项的顶级目录
    HTREEITEM LookupTopFolder(HTREEITEM hItem)
    {
        HTREEITEM hRoot = tv_folder.GetRootItem();
        while (tv_folder.GetParentItem(hItem)) hItem = tv_folder.GetParentItem(hItem);
        return hItem;
    }
    int ExpandCatChildFolder(HTREEITEM hItem, KXMLDOMElement ele, int image)
    {
        KXMLDOMNodeList nlist = ele.selectNodes(L"item");
        int len = nlist.length();
        if (len > 0) tv_folder.SetItemChild(hItem, 1);
        for (int i = 0; i < len; i++)
        {
            KXMLDOMElement& e = * new KXMLDOMElement(nlist.item(i));
            string name = e.getAttribute(L"name");
            HTREEITEM h = tv_folder.InsertChildItem(hItem, name, (LPARAM)&e, image);
            ExpandCatChildFolder(h, e, 35);
        }
        return 1;
    }
    int ExpandFolderItem(HTREEITEM hItem, string no)
    {
        KXMLDOMDocument x = ViewObject::RetrieveData(GetServerUrl(),urlTree, L"no", no, L"rows", rows);
        if (!x) return 0;
        KXMLDOMNodeList nlist = x.selectNodes(L"/data/item");
        int len = nlist.length();
        for (int i = 0; i < len; i++)
        {
            KXMLDOMElement& e = *new KXMLDOMElement(nlist.item(i));
            string name = e.getAttribute(L"name");
            HTREEITEM h = tv_folder.InsertChildItem(hItem, name, (LPARAM)&e, 35);
            ExpandCatChildFolder(h, e, 35);
        }
        return 1;
    }
    //树展开
    int OnTreeExpanding(TEvent* evt, int p)
    {
        NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh;
        HTREEITEM hItem = nmtv.itemNew.hItem;
        HTREEITEM hTopItem = LookupTopFolder(hItem);
        string name = tv_folder.GetItemLabel(hTopItem);
        HTREEITEM child = tv_folder.GetChildItem(hItem);
        KXMLDOMElement& e = *(KXMLDOMElement*)tv_folder.GetItemData(hItem);
        if (!child)ExpandFolderItem(hItem, e.getAttribute(L"no"));
        return 1;
    }
    //展开子文件
    int  ExpandChildFolder(HTREEITEM hItem, KXMLDOMElement pElement)
    {
        KXMLDOMNodeList nlist = pElement.selectNodes(L"Item");
        int len = nlist.length();
        for (int i = 0; i < len; i++)
        {
            KXMLDOMElement& e = *new KXMLDOMElement(nlist.item(i));
            string name = e.getAttribute(L"name");
            xstring sImage = e.getAttribute(L"image");
            xstring child = e.getAttribute(L"child");
            int image = 15;
            if (sImage) image = sImage.toInt();
            HTREEITEM h = tv_folder.InsertChildItem(hItem, name, (LPARAM)&e, image);
            if (child != L"no") tv_folder.SetItemChild(h, 1);
            ExpandChildFolder(h, e);
        }
        return 1;
    }
    //初始化文件夹
    int  InitialFolder()
    {
        KXMLDOMElement xframeElement = GetElement();
        KXMLDOMElement e = xframeElement.selectSingleNode(L"//xtree[@name='tv_folder']/initial");
        if (e)
            ExpandChildFolder(0, e);
        return 1;
    }
    int OnTreeSelChanged(TEvent* evt, LPARAM p)
    {
        if (changeddlb) return 1;
        return OnPreRetrieve();
    }
    int ViewUpdate(LPARAM pr, xstring updateItem, xaserverarg  arg)
    {
        if (updateItem == L"del")
        {
            int DelRow = dw_list.GetRow();
            dw_list.DeleteRow(DelRow);
            return 1;
        }
        else if (updateItem == L"setstate")
        {
            int row = dw_list.GetRow();
            if (row < 1) return 1;
            KXMLDOMElement ele = dw_list.GetRowElement(row);
            string id = GetEntityIDName(1);
            string entity = ele.selectSingleNode(id).text();
            //trace(entity);
            SetAgent(L"list", entity);
            if (arg.GetArgString(L"state") != L"")
                //this.dw_list.SetItemString(row, "ApprovalStatus", arg.GetArgString(L"state"));
                dw_list.SetItemString(row, L"ApplyStatus", arg.GetArgString(L"state"));
            if (arg.GetArgString(L"billstatus") != L"")
            {
                string billstatus = arg.GetArgString(L"billstatus");
                string statusName = GetBillStatusName(billstatus);
                dw_list.SetItemString(row, L"ApprovalStatus", billstatus);
                dw_list.SetItemDisplayString(row, L"ApprovalStatus", statusName);
            }
            dw_list.Redraw();
        }
        return 1;
    }
    bool IsEmptyQueryStr(string queryStr)
    {
        if (queryStr == L"") return true;
        if (queryStr == L"<items join='and'/>") return true;
        if (queryStr == L"<items join=\"and\"/>") return true;
        //trace(queryStr);
        return false;
    }
    //检索
    int OnPreRetrieve()
    {
        HTREEITEM hItem = tv_folder.GetSelectedItem();
        if (!hItem) return 1;
        HCURSOR hCursor = xutil::SetCursorWait();
        KXMLDOMElement& e1 = *(KXMLDOMElement*)tv_folder.GetItemData(hItem);
        string no = e1.getAttribute(L"no");
        KXMLDOMDocument x = ViewObject::RetrieveData(GetServerUrl(),myDataUrl, L"no", no, L"QueryTxt", m_QueryTxt, L"rows", rows);
        if (x)
        {
            dw_list.Retrieve(x);
            dw_list.Redraw();
        }
        else
        {
            dw_list.Reset();
            dw_list.Redraw();
            dw_goods.Reset();
            dw_goods.Redraw();
        }
        dw_list.SetReadOnly(true);
        xutil::RestoreCursor(hCursor);
        return 1;
        /*
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg(L"pageindex", m_pageIndex.toString(),""); //第几页
        arg.AddArg(L"pagenumber", m_pageNumber.toString(),""); //每页数量
        arg.AddArg(L"QueryTxt", m_QueryTxt,""); //查询条件
        arg.AddArg(L"sType",m_sType,"");
        arg.AddArg(L"sTypeTxt",m_sTypeTxt,"");
        xml x =  ViewObject::MakeXml();
        KXMLDOMElement   n = m_configDoc.selectSingleNode(L"//list/dwview[@type='dwgrid'][1]");
        if(n)
        {
            KXMLDOMElement e = n;
            if(e.selectSingleNode(L"@dataUrl"))
            {
                string dataUrl = e.selectSingleNode(L"@dataUrl").text;
                if(dataUrl.left(1)!="/") dataUrl = GetEntityName(1)+"/"+dataUrl;
                getUrl(dataUrl, arg.GetString(), x);
                KXMLDOMElement ele=x.GetXmlDoc().documentElement;
                if(dw_pages.ptr_native_)
                {
                    if(ele.selectSingleNode(L"@TotalPage"))
                    {
                        string s=ele.selectSingleNode(L"@TotalPage").text; //总数量
                        dw_pages.SetMaxPage(s.toInt());
                    }
                }
                dw_list.Retrieve(x);
                dw_list.Redraw();
                dw_list.SetReadOnly(true);
            }
            else
            {
                SetEntityData(arg);
            }
        }
        else
        {
            SetEntityData(arg);
        }
        */
    }
    //历史数据
    int Onhistroydata()
    {
        int row = dw_list.GetNextSelectRow(1);
        if (row > 0)
        {
            KXMLDOMElement e = dw_list.GetRowElement(row);
            xaserverarg& arg = * new xaserverarg;
            string sCustomerID = e.selectSingleNode(L"CustomerID").text();
            arg.AddArg(L"CustomerID", sCustomerID, L"");
            string sCustomerName = e.selectSingleNode(L"CustomerName").text();
            arg.AddArg(L"CustomerName", sCustomerName, L"");
            arg.AddArg(L"EntityName", GetEntityName(1), L"");
            arg.AddArg(L"EntityID", GetEntityID(1), L"");
            openUrl(L"/sale/view/SO/xpage/histroydata", &arg);
        }
        return 1;
    }
    //xcombobox下拉
    int OnSelectDdlb(TEvent* evt, LPARAM p)
    {
        changeddlb = 1;
        HWND wid = ddlb_1.GetHWND();
        int CB_GETCURSEL = 0x0147;
        int nIndex =SendMessage(wid, CB_GETCURSEL, 0, 0);
        KXMLDOMElement e = ddlb_1.GetElement();
        KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring(nIndex + 1) + L"]");
        string no = e2.selectSingleNode(L"@element").text();
        HTREEITEM hItem = tv_folder.GetRootItem();
        while (tv_folder.GetChildItem(hItem))
            tv_folder.DeleteItem(tv_folder.GetChildItem(hItem));
        ExpandFolderItem(hItem, no);
        changeddlb = 0;
        return 1;
    }
    int OnSelectDataShowDdlb(TEvent* evt, LPARAM p)
    {
        HWND wid = cbx_datashow.GetHWND();
        int CB_GETCURSEL = 0x0147;
        int nIndex = SendMessage(wid, CB_GETCURSEL, 0, 0);
        KXMLDOMElement e = cbx_datashow.GetElement();
        KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring(nIndex + 1) + L"]");
        rows = e2.selectSingleNode(L"@rows").text();
        OnPreRetrieve();
        return 1;
    }
    int PreOnCmdDispatch(string comdid)
    {
        if (comdid == L"action:bill.new")
        {
            string s = publiccode::GetUser().id;
            string no = publiccode::GetUser().no;
            if (no != L"00303" && no != L"admin")
            {
                KXMLDOMDocument supplier_x = ViewObject::RetrieveData(GetServerUrl(),L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s);
                if (supplier_x)
                {
                    if ((xstring)supplier_x.text() != L"业务员")
                    {
                        alert(L"当前角色不是业务员不能新增单子,请重新选择角色");
                        return 0;
                    }
                }
            }
        }
        if (comdid == L"action:bill.annex")
        {
            string deptname = publiccode::GetUser().deptname;
            if (deptname == L"采购部")
            {
                return 1;
            }
            int row = dw_list.GetRow();
            if (row < 1) return 1;
            xstring guid = dw_list.GetItemString(row, L"SOID");
            xaserverarg& arg = * new xaserverarg();
            if (guid.length() <= 0)return 1;
            arg.AddArg(L"entityid", guid);
            arg.AddArg(L"Type", L"Y");
            OpenWindow(L"dev:xpage[maint.Document.SO3.v3.vx]", arg);
            return 0;
        }
        if (comdid == L"action:bill.histroydata") return Onhistroydata();
        else if (comdid == L"action:bill.refresh")
        {
            changeddlb = 1;
            HTREEITEM RItem = tv_folder.GetRootItem();
            while (tv_folder.GetChildItem(RItem))
                tv_folder.DeleteItem(tv_folder.GetChildItem(RItem));
            ExpandFolderItem(RItem, L"Category:Customer");
            tv_folder.ExpandItem(RItem);
            tv_folder.ItemFocus(RItem);
            changeddlb = 0;
            return OnPreRetrieve();
        }
        if (comdid == L"action:bill.saveas")
        {
            dw_list.SaveAs(L"");
            return 1;
        }
        if (comdid == L"action:bill.SourceRemark") return OnSourceRemark();
        return 1;
    }
    int OnSourceRemark()
    {
        xstring name = L"外销合同";
        KXMLDOMDocument x = ViewObject::RetrieveData(GetServerUrl(),L"/sale/data/TradeFinance3/GetSetUpRemarks", L"Type", name);
        KXMLDOMNodeList items = x.selectNodes(L"data/Item");
        KXMLDOMNode t = items.item(0);
        xstring Content = L"";
        if (t.selectSingleNode(L"Content"))
        {
            Content = t.selectSingleNode(L"Content").text();
        }
        xaserverarg& arg = *new xaserverarg;
        arg.AddArg(L"value", Content);
        OpenWindow(L"dev:xpage[memo.edit.new.vx]", arg);
        return 1;
    }
    int OnRowChanged(TEvent* evt, LPARAM p)
    {
        DWNMHDR&  hdr = *(DWNMHDR*)evt->notify.pnmh;
        int row = hdr.row;
        if (row < 1) return 1;
        //fixed one event only one process
        listwin::OnRowChanged(evt, p);
        HCURSOR     hCursor = xutil::SetCursorWait();
        xstring SONo = dw_list.GetItemString(row, L"SONo");
        KXMLDOMDocument x = ViewObject::RetrieveData(GetServerUrl(),L"/sale/data/SaleOrder/maint/item", L"id", SONo);
        if (x)
            dw_goods.Retrieve(x);
        else
            dw_goods.Reset();
        dw_goods.Redraw();
        dw_goods.SetReadOnly(true);
        x = ViewObject::RetrieveData(GetServerUrl(),L"/sale/data/SaleOrder/maint/itemwithsource", L"id", SONo);
        if (x)
            dw_source.Retrieve(x);
        else
            dw_source.Reset();
        dw_source.Redraw();
        dw_source.SetReadOnly(true);
        xutil::RestoreCursor(hCursor);
        return 1;
    }
    int AttachListon()
    {
        AttachEvent(L"tv_folder", L"TVN_SELCHANGED", (FEvent)&SO3list::OnTreeSelChanged); //树选择
        AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&SO3list::OnRowChanged);//绑定行更改触发事件OnRowChanged
        AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listwin::OnDoubleClicked);
        AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&SO3list::OnSelectDdlb);//绑定下拉框更改触发事件OnSelectDdlb
        AttachEvent(L"cbx_datashow", L"CBN_SELCHANGE", (FEvent)&SO3list::OnSelectDataShowDdlb);//绑定选择数据显示下拉列表事件OnSelectDataShowDdlb
        return 1;
    }
    int onload()
    {
        changeddlb = 0;
        listwin::onload();
        ddlb_1 = GetControl(L"cbx_1");
        cbx_datashow = GetControl(L"cbx_datashow");
        dw_goods = GetControl(L"dw_goods");
        dw_goods.openUrl(GetServerUrl(),L"/sale/view/SaleOrder/template/item");
        dw_source = GetControl(L"dw_source");
        dw_source.openUrl(GetServerUrl(), L"/sale/view/SaleOrder/template/sourceitem");
        dw_goods.SetColumnState(L"ItemID", false);
        dw_goods.SetColumnState(L"LineType", false);
        dw_goods.SetColumnState(L"Brand", false);
        dw_goods.SetColumnState(L"Assortment", false);
        dw_goods.SetColumnState(L"ClassifyID", false);
        dw_goods.SetColumnState(L"UnitFreight", false);
        //dw_goods.SetColumnState(L"CName",false);//隐藏列
        dw_goods.SetColumnState(L"Brand", false);
        dw_goods.SetColumnState(L"SKUNo", false);
        dw_goods.SetColumnState(L"SOLineNo", false);
        dw_goods.SetColumnState(L"CustomerPONo", false);
        dw_goods.SetColumnState(L"ScheduleShipDate", false);
        dw_goods.SetColumnState(L"PackTechNote", false);
        dw_goods.SetColumnState(L"EnquiryPriceListID", false);
        dw_goods.SetColumnState(L"Submitter", false);
        dw_goods.SetColumnState(L"POSupplierID", false);
        dw_goods.SetColumnState(L"QuoteLineID", false);
        dw_list.SetColumnState(L"CreatorID", false);
        dw_list.SetColumnState(L"SOID", false);
        string groupname = publiccode::GetUser().groupname;
        if (groupname == L"采购小组")
        {
            dw_list.SetColumnState(L"USDAmount", false);
            dw_list.SetColumnState(L"RMBAmount", false);
            dw_goods.SetColumnState(L"UnitPrice", false);
            dw_goods.SetColumnState(L"Amount", false);
            dw_goods.SetColumnState(L"UnitCommPrice", false);
            dw_goods.SetColumnState(L"CommissionRate", false);
            dw_source.SetColumnState(L"UnitPrice", false);
            dw_source.SetColumnState(L"Amount", false);
            dw_source.SetColumnState(L"FOBAmount", false);
            dw_source.SetColumnState(L"BuyUnitPrice", false);
            dw_source.SetColumnState(L"BuyAmount", false);
            dw_source.SetColumnState(L"CostRate", false);
        }
        rows = L"500";
        myDataUrl = L"/sale/data/SaleOrder/folder/list";
        urlTree = L"/sale/data/SaleOrder/folder";
        tv_folder = GetControl(L"tv_folder");
        tv_folder.SetLineAtRoot(true);
        InitialFolder();
        return 1;
    }
    int onloaded()
    {
        listwin::onloaded();
        //attach my control event
        AttachListon();
        dw_list.SetColumnState(L"SOID", false);
        HTREEITEM hItem = tv_folder.GetRootItem();
        ExpandFolderItem(hItem, L"Category:Customer");
        tv_folder.ExpandItem(hItem);
        //tv_folder.ItemFocus(tv_folder.GetChildItem(hItem));
        tv_folder.ItemFocus(hItem);
        return -1;
    }
    int ProcessUsedArg(xaserverarg arg)
    {
        HTREEITEM hItem = tv_folder.GetCaretItem();
        if (hItem ) return 1;
        KXMLDOMElement& e = *(KXMLDOMElement*)tv_folder.GetItemData(hItem);
        xstring  no = e.getAttribute(L"no");
        if (no.find(L"Customer:") >= 0)
        {
            arg.AddArg(L"CustomerID", e.getAttribute(L"id"));
            xstring name = e.getAttribute(L"name");
            if (name.find(L"(L") >= 0) name = name.left(name.find(L"(L"));
            arg.AddArg(L"CustomerName", name);
        }
        return 1;
    }
};
jrj/project/business/SO3.maint.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,1115 @@
#include <wobject/xstring.hpp>
#include <wobject/xdouble.hpp>
#include <xcontrol/xtreeview.hpp>
#include <xcontrol/xdwgrid.hpp>
#include <xcontrol/ximageview.hpp>
#include "vbusiness/vframe/maint.vframe.vbusiness.hpp"
#include "viewobject/view.base.hpp"
#include "viewobject/saleorder.view.hpp"
#include "viewobject/quote.view.hpp"
class __declspec(dllexport) BaseMaintSOWin : public maint
{
    xdwtable dw_props;
    xdwtable dw_base;
    xdwgrid     dw_item;
    xnode     m_agentNode;    //Agent Condition
public:
    BaseMaintSOWin(void* implPtr, HWND hWnd) :maint(implPtr, hWnd) {}
public:
    static BaseMaintSOWin* CreateInstance(void* implPtr, void* hWnd)
    {
        BaseMaintSOWin* pWin = new BaseMaintSOWin(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)
            {
                bstring s = agent.xml();
                m_agentNode = SetAgentNode(anode, s);
            }
        }
        return 1;
    }
    //焦点激活处理函数
    int OnSetFocus(TEvent* evt, LPARAM param)
    {
        //重置工具条
        //SetAgent();
        //SetAgent(L"maint", m_EntityID);
        //SetAgent(L"maint",dw_base.GetGuid(0));
        return 1;
    }
    xstring GetGuid()
    {
        return publiccode::GetGuid();
    }
    xstring  GetEntityData(LPARAM pr)
    {
        dw_item.AcceptText();
        dw_base.AcceptText();
        KXMLDOMDocument xbase ;
        dw_base.DwUpdateAllTo(xbase);
        KXMLDOMDocument xitem;
        dw_item.DwUpdateAllToEx(xitem);
        KXMLDOMElement ebase = xbase.documentElement();
        if ((xstring)xitem.xml() != L"")
        {
            KXMLDOMElement eitem = xitem.selectSingleNode(L"data");
            if (eitem) ebase.appendChild(eitem);
        }
        return ebase.xml();
    }
    int DoUpdate(bool showSuccess)
    {
        dw_base.AcceptText();
        dw_item.AcceptText();
        if ((xstring)dw_base.GetItemString(1, L"SONo") == L"")
        {
            xstring SONo = SaleOrderView::MakeBillNo();
            dw_base.SetItemString(1, L"SONo", SONo);
        }
        for (int i = 1; i <= dw_item.GetRowCount(); i++)
        {
            //should to sure not new state
            if (dw_item.GetItemString(i, L"SOLineNo") == L"")
                dw_item.SetItemString(i, L"SOLineNo", SaleOrderView::AskNo(GetServerUrl(),L"E"));
            if (dw_item.GetItemString(i, L"CustomerItemNo") == L"")
            {
                alert(L"请输入客户型号!");
                return 0;
            }
        }
        dw_item.Redraw();
        if (dw_base.GetItemString(1, L"SODate").trim() == L"")
        {
            alert(L"请输入订单日期!");
            return 0;
        }
        if (dw_base.GetItemString(1, L"CurrencyCode").trim() == L"")
        {
            alert(L"请输入计价货币!");
            return 0;
        }
        if (dw_base.GetItemString(1, L"CompanyID").trim() == L"")
        {
            alert(L"请输入公司抬头!");
            return 0;
        }
        if (dw_base.GetItemString(1, L"PaymentTermEx").trim() == L"")
        {
            alert(L"请输入支付条款!");
            return 0;
        }
        if (dw_base.GetItemString(1, L"CustomerPONo").trim() == L"")
        {
            alert(L"请输入客户PO#!");
            return 0;
        }
        if (dw_base.GetItemString(1, L"Merchandiser").trim() == L"")
        {
            alert(L"请选择跟单人员!");
            return 0;
        }
        if (dw_base.GetItemString(1, L"PaymentTermEx").trim() == L"")
        {
            alert(L"请输入支付条款!");
            return 0;
        }
        if (dw_base.GetItemString(1, L"TransportMode").trim() == L"")
        {
            alert(L"请输入运输方式!");
            return 0;
        }
        if (dw_base.GetItemString(1, L"POL").trim() == L"")
        {
            alert(L"请输入出口口岸!");
            return 0;
        }
        if (dw_base.GetItemString(1, L"POD").trim() == L"")
        {
            alert(L"请输入目的口岸!");
            return 0;
        }
        if (dw_base.GetItemString(1, L"SalespersonID") != publiccode::GetUser().id)
        {
            alert(L"只能保存本人的数据!");
            return 0;
        }
        KXMLDOMDocument xbase;
        dw_base.DwUpdateAllTo(xbase);
        KXMLDOMDocument xitem ;
        dw_item.DwUpdateAllToEx(xitem);
        KXMLDOMElement ebase = xbase.documentElement();
        KXMLDOMElement eitem = xitem.selectSingleNode(L"data");
        ebase.appendChild(eitem);
        KXMLDOMDocument x ;
        x.loadXML(ebase.xml());
        xaserverarg arg;
        arg.AddArg(L"content", x.xml());
        if (xurl::get(GetServerUrl(),L"/sale/data/SaleOrder/update/base", arg.GetString(), x) != 1)
        {
            xstring error = x.text();
            alert(L"err:" + error);
            return 0;
        }
        xstring str = x.documentElement().getAttribute(L"text");
        if (str == L"true")
        {
            dw_base.ResetUpdateStatus();
            dw_item.ResetUpdateStatus();
            //vc.xdoc.SetXPath(L"SaleOrder/PaymentTerm");
            if (showSuccess)
                alert(L"保存成功!");
            return 1;
        }
        else
        {
            alert(L"保存失败!");
            return -1;
        }
        return 1;
    }
    int OnSaveEx()
    {
        DoUpdate(true);
        return 1;
    }
    //event
    int OnDWClick(TEvent* evt, int p)
    {
        DWNMHDR*  hdr = (DWNMHDR*)evt->notify.pnmh;
        xstring value = hdr->data;
        xstring colname = hdr->colname;
        if (value == L"支付条款")
        {
            //int  p1 = vc.xdoc.getNativePointer();
            //openUrl(L"/sale/view/SaleOrder/xpage/payment", p1);
            dw_base.AcceptText();
            return 1;
        }
        //交货期维护
        if (value == L"交货期")
        {
            //int p2 = vc.xdoc.getNativePointer();
            //openUrl(L"/sale/view/SaleOrder/xpage/delivery1", p2);
            dw_base.AcceptText();
            dw_base.Redraw();
            return 1;
        }
        if (value == L"客户合同")
        {
            xstring deptname = publiccode::GetUser().deptname;
            if (deptname == L"采购部")
            {
                return 1;
            }
            xaserverarg& arg= * new xaserverarg();
            xstring SOID = dw_base.GetItemString(1, L"SOID");
            if (SOID.length() <= 0)
            {
                alert(L"无法上传,请重新打开订单!");
                return 1;
            }
            arg.AddArg(L"entityid", SOID);
            arg.AddArg(L"Type", L"N");
            arg.AddArg(L"ApprovalStatus", dw_base.GetItemString(1, L"ApprovalStatus"));
            OpenWindow(L"dev:xpage[maint.Document.SO3.v3.vx]", (LPARAM) & arg);
            //DocCount(guid);
        }
    }
    /*int DocCount(xstring guid)
    {
        dw_base.AcceptText();
        xdwtable dw = dw_base.FindDwTable(L"SaleOrder",0);
        xstring count = L"0";
        xstring entityid = dw_base.GetItemString(1,L"SOID",0);
        if(entityid.length() <= 0)
        {
            entityid=guid;
        }
        KXMLDOMDocument x1 = ViewObject::RetrieveData(L"/sale/data/TDocument3/attachment/GetDocCountEx_s",L"entityid",entityid);
        trace(x1.xml());
        KXMLDOMNodeList items = x1.selectNodes(L"data/Item");
        KXMLDOMNode t = items.item(0);
        if(t.selectSingleNode(L"count"))count=t.selectSingleNode(L"count").text();
        if(count==L"0")
        {
            dw_base.SetItemString(1,L"CType",L"N");
        }else
        {
          dw_base.SetItemString(1,L"CType",L"Y");
        }
    }*/
    int SetSeqNo(xdwgrid dw_obj, xstring SeqNoColumn, int nRow)
    {
        if (nRow > 1)
        {
            int SeqNo = dw_obj.GetItemInt(nRow - 1, SeqNoColumn.c_str());
            if (SeqNo != 0) SeqNo += 10; else SeqNo = nRow * 10;
            dw_obj.SetItemInt(nRow, SeqNoColumn.c_str(), SeqNo);
        }
        else
            dw_obj.SetItemInt(nRow, SeqNoColumn.c_str(), 10);
        return 1;
    }
    int SetRowData(int nRow, KXMLDOMElement e)
    {
        //trace(e.xml());
        dw_item.SetItemString(nRow, L"SKUNo", e.getAttribute(L"SKUNo"));
        dw_item.SetItemString(nRow, L"ItemID", e.getAttribute(L"SKUID"));
        dw_item.SetItemString(nRow, L"CName", e.getAttribute(L"CName"));
        dw_item.SetItemString(nRow, L"EName", e.getAttribute(L"EName"));
        dw_item.SetItemString(nRow, L"GoodsNo", e.getAttribute(L"GoodsNo"));
        dw_item.SetItemString(nRow, L"CustomerItemNo", e.getAttribute(L"CustomerItemNo"));
        dw_item.SetItemString(nRow, L"Packing", e.getAttribute(L"Packing"));
        dw_item.SetItemString(nRow, L"VolumeDesc", e.getAttribute(L"VolumeDesc"));
        dw_item.SetItemString(nRow, L"NwPerPkg", e.getAttribute(L"NwPerPkg"));
        dw_item.SetItemString(nRow, L"GwPerPkg", e.getAttribute(L"GwPerPkg"));
        dw_item.SetItemString(nRow, L"PackingRate", e.getAttribute(L"QTYPerPkg"));
        dw_item.SetItemString(nRow, L"InnerQty", e.getAttribute(L"InnerQty"));
        dw_item.SetItemString(nRow, L"UnitCommPrice", e.getAttribute(L"UnitCommPrice"));
        dw_item.SetItemString(nRow, L"QuoteLineID", e.getAttribute(L"QuoteLineID"));
        if (e.getAttribute(L"UOMCode") == L"")
        {
            dw_item.SetItemString(nRow, L"UOMCode", L"007");
            dw_item.SetItemDisplayString(nRow, L"UOMCode", L"PCS");
        }
        else
        {
            dw_item.SetItemString(nRow, L"UOMCode", e.getAttribute(L"UOMCode"));
            dw_item.SetItemDisplayString(nRow, L"UOMCode", e.getAttribute(L"UOMCode_display"));
        }
        if (e.getAttribute(L"KOPCode") == L"")
        {
            dw_item.SetItemString(nRow, L"KOPCode", L"120");
            dw_item.SetItemDisplayString(nRow, L"KOPCode", L"CTNS");
        }
        else
        {
            dw_item.SetItemString(nRow, L"KOPCode", e.getAttribute(L"KOPCode"));
            dw_item.SetItemDisplayString(nRow, L"KOPCode", e.getAttribute(L"KOPCode_display"));
        }
        dw_item.SetItemString(nRow, L"PackageL", e.getAttribute(L"PackageL"));
        dw_item.SetItemString(nRow, L"PackageW", e.getAttribute(L"PackageW"));
        dw_item.SetItemString(nRow, L"PackageH", e.getAttribute(L"PackageH"));
        dw_item.SetItemString(nRow, L"UnitPrice", e.getAttribute(L"UnitPrice"));
        //    dw_item.SetItemDisplayString(nRow,L"PriceType",e.getAttribute(L"PriceType"));
        dw_item.SetItemDisplayString(nRow, L"POCreatorID", e.getAttribute(L"POCreatorID._displaystring"));
        dw_item.SetItemString(nRow, L"POCreatorID", e.getAttribute(L"POCreatorID"));
        return 1;
    }
    int ImportProductByText(xstring str)
    {
        xstring CustomerID = dw_base.GetItemString(1, L"CustomerID");
        //KXMLDOMDocument x = QuoteView::LookupProductsByText(str,CustomerID);
        //trace(str+L"--" + CustomerID);
        KXMLDOMDocument x = ViewObject::RetrieveData(GetServerUrl(),L"/sale/data/SaleOrder/lookup/productsex", L"str", str, L"CustomerID", CustomerID);
        if (!x) return 1;
        KXMLDOMNodeList items = x.selectNodes(L"/Items/Item");
        int len = items.length();
        for (int i = 0; i < len; i++)
        {
            KXMLDOMElement e = items.item(i);
            dw_item.InsertRow(0);
            int nRow = dw_item.GetRowCount();
            SetSeqNo(dw_item, L"LineNo", nRow);
            dw_item.SetItemString(nRow, L"KOPCode", L"120");
            dw_item.SetItemDisplayString(nRow, L"KOPCode", L"CTNS");
            dw_item.SetItemString(nRow, L"UOMCode", L"007");
            dw_item.SetItemDisplayString(nRow, L"UOMCode", L"PCS");
            SetRowData(nRow, e);
        }
        dw_item.Redraw();
        int row = dw_item.GetRow();
        if (row >= 1)
        {
            ximageview im = GetControl(L"im1");
            im.Reset();
            xstring skuno = dw_item.GetItemString(row, L"SKUNo");
            OnShowImage(skuno, row);
            im.Redraw();
        }
        return 1;
    }
    int ReSeqNo(xstring SeqNoColumn)
    {
        for (int i = 1; i <= dw_item.GetRowCount(); i++)
        {
            dw_item.SetItemInt(i, SeqNoColumn.c_str(), (i * 10));
        }
        dw_item.Redraw();
        return 1;
    }
    int OnItemChanged(TEvent* evt, int p)
    {
        DWNMHDR*  hdr = (DWNMHDR*)evt->notify.pnmh;
        xstring colname = hdr->colname;
        xstring value = hdr->data;
        int row = hdr->row;
        if (colname == L"GoodsNo" && value != L"")
        {
            KXMLDOMDocument x = QuoteView::LookupProductsByText(value);
            if (!x) return 1;
            KXMLDOMNodeList items = x.selectNodes(L"/Items/Item");
            int len = items.length();
            if (len == 0)
            {
                alert(L"无此公司型号!");
                return 1;
            }
            if (len > 0)
            {
                KXMLDOMElement e = items.item(0);
                int nRow = dw_item.GetRow();
                SetRowData(nRow, e);
                dw_item.Redraw();
            }
        }
        if (colname == L"Quantity" || colname == L"PackingRate")
        {
            //件数
            double dqty = dw_item.GetItemDouble(row, L"Quantity");
            xstring spackingrate = dw_item.GetItemString(row, L"PackingRate");
            int ipack = caclPacking(dqty, spackingrate);
            dw_item.SetItemInt(row, L"Packages", ipack);
            dw_item.Redraw();
        }
        if (colname == L"Quantity" || colname == L"UnitCommPrice")
        {
            double dqty1 = dw_item.GetItemDouble(row, L"Quantity");
            double UnitCommPrice = dw_item.GetItemDouble(row, L"UnitCommPrice");
            dw_item.SetItemDouble(row, L"UnitCommPriceAmount", xdouble(dqty1 * UnitCommPrice).round(2));
            dw_item.Redraw();
        }
        if (colname == L"Quantity" || colname == L"MiddlemanAmount")
        {
            double dqty2 = dw_item.GetItemDouble(row, L"Quantity");
            double MiddlemanAmount = dw_item.GetItemDouble(row, L"MiddlemanAmount");
            dw_item.SetItemDouble(row, L"MiddlemanAmountS", xdouble(dqty2 * MiddlemanAmount).round(2));
            dw_item.Redraw();
        }
        if (colname == L"Quantity" || colname == L"UnitPrice" || colname == L"Amount")
        {
            double ttlamt = 0;
            double amt;
            double qty = dw_item.GetItemDouble(row, L"Quantity");
            double price = dw_item.GetItemDouble(row, L"UnitPrice");
            if (colname != L"Amount")
            {
                amt = qty * price;
                dw_item.SetItemDouble(row, L"Amount", amt);
                dw_item.Redraw();
            }
            for (int i = 1; i <= dw_item.GetRowCount(); i++)
            {
                amt = dw_item.GetItemDouble(i, L"Amount");
                ttlamt += amt;
            }
            double OtherExpenses = dw_base.GetItemDouble(1, L"OtherExpenses");
            dw_base.SetItemDouble(1, L"Amount", ttlamt + OtherExpenses);
            return 1;
        }
        return 1;
    }
    //件数
    int caclPacking(double dQty, xstring sPRate)
    {
        if (sPRate == L"" || sPRate == L"0" || sPRate == L" ")
            return 0;
        double dPackages;
        int iFlag;
        iFlag = sPRate.find(L"/", 1);
        if (iFlag >= 0)
        {
            xstring sBegin = sPRate.mid(0, iFlag);
            xstring sEnd = sPRate.mid(iFlag + 1, sPRate.length() - iFlag + 2);
            if (!sBegin || sBegin == L"" || sBegin == L"0" || !sEnd || sEnd == L"" || sEnd == L"0")
                return 0;
            dPackages = dQty * sEnd.toDouble() / sBegin.toDouble();
        }
        else
        {
            dPackages = dQty / sPRate.toDouble();
        }
        if ((int)(dPackages * 1000) > (int)dPackages * 1000)
            dPackages = dPackages + 1;
        return (int)dPackages;
    }
    int OnBaseItemChanged(TEvent* evt, int p)
    {
        DWNMHDR* hdr = (DWNMHDR*)evt->notify.pnmh;
        xstring colname = hdr->colname;
        xstring value = hdr->data;
        xstring dwname = L"dw_base";
        if (value != L"")
        {
            KXMLDOMNodeList nlist = GetElement().selectNodes(L"//*[@name='" + dwname + L"']/trans[@for='" + colname + L"']");
            ViewObject::TransData(GetServerUrl(),nlist, dw_base, hdr->row, colname, value);
        }
        if (colname == L"OtherExpenses")
        {
            double Amount = 0;
            double amt1;
            for (int i = 1; i <= dw_item.GetRowCount(); i++)
            {
                amt1 = dw_item.GetItemDouble(i, L"Amount");
                Amount += amt1;
            }
            // trace(L"====ttlamt1====L"+ttlamt1.toString());
            double OtherExpenses = dw_base.GetItemDouble(1, L"OtherExpenses");
            //double Amount = dw_base.GetItemDouble(1,L"Amount");
            double ttlamt = OtherExpenses + Amount;
            dw_base.SetItemDouble(1, L"Amount", ttlamt);
        }
        return 1;
    }
    int OnAskDataBase(TEvent* evt, int p)
    {
        //alert(L"xx");
        DWNMHDR*  hdr = (DWNMHDR*)evt->notify.pnmh;
        xstring x = hdr->colname;
        if (x == L"userSalespersonID")
        {
            xstring sSalespersonID = dw_base.GetItemString(1, L"SalespersonID");
            //alert(sSalespersonID);
            hdr->data = sSalespersonID;
        }
        return 1;
    }
    int OnAskGoodsNo()
    {
        int rowCount = dw_item.GetRowCount();
        xstring skunos = L"";
        xstring GoodsNo1 = dw_item.GetItemString(dw_item.GetRow(), L"GoodsNo");
        xstring GoodsNo2 = GoodsNo1.mid(0, 1);
        xstring GoodsNo3 = GoodsNo1.mid(1, 1);
        xstring GoodsNo4 = GoodsNo1.mid(2, 1);
        //trace(L"=====L"+GoodsNo2+L"=====L"+GoodsNo3+L"=====L"+GoodsNo4+L"=====L");
        for (int i = 1; i <= rowCount; i++)
        {
            if (dw_item.GetItemString(i, L"SKUNo") != L"" && dw_item.GetItemString(i, L"GoodsNo") == L"" ||
                GoodsNo1.find(L"N") >= 0 || GoodsNo1.find(L"n") >= 0 || GoodsNo4.isNumber() == false && GoodsNo2.isNumber() == true && GoodsNo3.isNumber() == true)
            {
                if (skunos == L"")
                    skunos = dw_item.GetItemString(i, L"SKUNo");
                else
                    skunos += L",L" + dw_item.GetItemString(i, L"SKUNo");
            }
        }
        xaserverarg& arg = *new xaserverarg();
        arg.AddArg(L"SKUNoList", skunos);
        OpenWindow(L"dev:xpage[Product.FetchNo.vx]", (LPARAM) & arg);
        return 1;
    }
    bool SOLineMaybeDelete(xstring SOLineID)
    {
        KXMLDOMDocument x;
        xaserverarg arg;
        arg.AddArg(L"SOLineID", SOLineID);
        if (xurl::get(GetServerUrl(),L"/sale/data/SaleOrder/MaybeDelete", arg.GetString(), x) != 1)
        {
            xstring error = x.text();
            alert(L"err:" + error);
            return false;
        }
        xstring val = x.documentElement().getAttribute(L"delete");
        if (val == L"true") return L"true";
        return false;
    }
    //命令发布函数
    int OnCmdDispatch(xstring comdid)
    {
        bool bupdate = true;
        if (dw_base.GetItemString(1, L"ApprovalStatus") == L"3")bupdate = false;
        if (comdid == L"xmImportProduct" && bupdate)
        {
            //xstring str = GetControl(L"goods").GetText();
            //str = str.trim();
            //if(str==L"")
            //{
            xaserverarg& arg = *new xaserverarg;
            arg.setNativePointer(arg.CreateInstance());
            arg.AddArg(L"HWND", xstring((__int64)GetHWND()));
            arg.AddArg(L"CustomerID", dw_base.GetItemString(1, L"CustomerID"));
            OpenWindow(L"dev:xpage[Product.Select.SO.vx]", (LPARAM)&arg);
            //OpenWindow(L"dev:xpage[Product.Select.vx]",cast(arg1 as int));
        //}
        //else
            //ImportProductByText(str);
            int row = dw_item.GetRow();
            if (row >= 1)
            {
                ximageview im = GetControl(L"im1");
                im.Reset();
                xstring skuno = dw_item.GetItemString(row, L"SKUNo");
                OnShowImage(skuno, row);
                im.Redraw();
            }
            return 1;
        }
        else if (comdid == L"xmReSeqNo")
        {
            if (MessageBoxW(GetHWND(), L"是否重置序号!", L"提示1", 1) == 2)
                return 1;
            return ReSeqNo(L"LineNo");
        }
        else if (comdid == L"xmDeleteRow" && bupdate)
        {
            int row2 = dw_item.GetRow();
            xstring ChkState = dw_item.GetItemInt(row2, L"ChkState");
            if (ChkState == L"") ChkState = L"1";
            xstring SOLineID = dw_item.GetGuid(row2);
            KXMLDOMDocument x = ViewObject::RetrieveData(GetServerUrl(),L"/sale/data/SaleOrder/MaybeDeleteEx", L"SOLineID", SOLineID);
            xstring  r = x.text();
            int r1 = r.toInt();
            if (x)
            {
                if (r1 > 0)
                {
                    alert(L"还有对应的采购,不允许删除!");
                    return 0;
                }
            }
            /*if(SOLineMaybeDelete(SOLineID)==false)
            {
                alert(L"还有对应的采购,不允许删除!");
                return 0;
            }
            if(ChkState != L"1" && ChkState != L"5" )
            {
                if(SOLineMaybeDelete(SOLineID)==false)
                {
                    alert(L"当前状态不允许删除!");
                    return 0;
                }
            }*/
            dw_item.DeleteRow(row2);
            double ttlamt = 0;
            double amt;
            for (int i = 1; i <= dw_item.GetRowCount(); i++)
            {
                amt = dw_item.GetItemDouble(i, L"Amount");
                ttlamt += amt;
            }
            dw_base.SetItemDouble(1, L"Amount", ttlamt);
            return 1;
        }
        else if (comdid == L"xmAddRow" && bupdate)
        {
            int row = dw_item.InsertRow(0);
            SetSeqNo(dw_item, L"LineNo", row);
            dw_item.SetItemString(row, L"KOPCode", L"120");
            dw_item.SetItemDisplayString(row, L"KOPCode", L"CTNS");
            dw_item.SetItemString(row, L"UOMCode", L"007");
            dw_item.SetItemDisplayString(row, L"UOMCode", L"PCS");
            return 1;
        }
        else if (comdid.find(L"ImportXml:", 0) == 0)
        {
            xstring strImport = comdid.mid(xstring(L"ImportXml:").length(), 9999);
            ImportProductByText(strImport);
            return 1;
        }
        else if (comdid == L"xmPrint")
        {
            if (dw_base.GetItemString(1, L"SONo") == L"")
            {
                alert(L"请先保存数据!");
                return 1;
            }
            xaserverarg& arg = * new xaserverarg;
            arg.setNativePointer(arg.CreateInstance());
            arg.AddArg(L"EntityName", L"SaleOrder", L"");
            arg.AddArg(L"EntityID", dw_base.GetItemString(1, L"SOID"), L"");
            arg.AddArg(L"EntityNo", dw_base.GetItemString(1, L"SONo"), L"");
            openUrl(L"/sale/view/view.base/xpage/Template/PrintViewEx", &arg);
            return 1;
        }
        else if (comdid == L"xmSaveEx" && bupdate)
        {
            OnSaveEx();
            return 1;
        }
        else if (comdid == L"xmAskGoodsNo")
        {
            return OnAskGoodsNo();
        }
        else if (comdid == L"xmClose")
        {
            CloseWindow();
            return 1;
        }
        else if (comdid.find(L"xmSetCustomer") >= 0 && bupdate)
        {
            xstring no = comdid.mid(comdid.find(L":") + 1, 99999);
            xstring name = no.mid(no.find(L"\t") + 1, 999999);
            no = no.left(no.find(L"\t"));
            dw_base.SetItemString(1, L"CustomerID", no);
            dw_base.SetItemDisplayString(1, L"CustomerID", name);
            return 1;
        }
        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_item.GetRowCount();
        if (row < 1 || row > rows)
        {
            return 1;
        }
        /*
        KXMLDOMElement ele = dw_list.GetRowElement(dw_list.GetTreeRow(row));
        xstring lineType = GetEleString(ele, L"LineType");
        if(lineType == L"成品") return 1;
        if(lineType == L"1") return 1;
        hdr.mask =  DMS_CSSSTYLE;
        xstring name = ele.parentNode.nodeName;
        if(name == L"item")
            hdr.cssstyle = L"color:#858585";
        else
            hdr.cssstyle = L"color:#921D5E";
        */
        if (colname == L"Packages")
        {
            //trace(L"\r\ncol index: "+ col.toString()+L" name:"+ colname);
            int PackingRate = dw_item.GetItemString(row, L"PackingRate").toInt();
            int Quantity = dw_item.GetItemString(row, L"Quantity").toInt();
            if (PackingRate != 0)
            {
                if ((Quantity / PackingRate) * PackingRate != Quantity)
                {
                    hdr.mask = DMS_CSSSTYLE;
                    hdr.pCssStyle = (wchar_t*)L"color:#ff0000";
                }
            }
        }
        return 1;
    }
    //命令处理事件
    int OnXCommand(TEvent* evt, int param)
    {
        return OnCmdDispatch(evt->xcommand.pStrID);
    }
    int OnAttachListon()
    {
        //绑定工具条点击事件
        AttachEvent(L"WM_XCOMMAND", (FEvent)&BaseMaintSOWin::OnXCommand);
        //获取焦点事件,用于重置工具条
        AttachEvent(L"WM_SETFOCUS", (FEvent)&BaseMaintSOWin::OnSetFocus);
        //AttachEvent(L"dw_props",L"DWV_CLICKED",(FEvent)&BaseMaintSOWin::OnDWClick);
        AttachEvent(L"dw_base", L"DWV_CLICKED", (FEvent)&BaseMaintSOWin::OnDWClick);
        AttachEvent(L"dw_item", L"DWV_ITEMCHANGED", (FEvent)&BaseMaintSOWin::OnItemChanged);
        AttachEvent(L"dw_base", L"DWV_ITEMCHANGED", (FEvent)&BaseMaintSOWin::OnBaseItemChanged);
        AttachEvent(L"im1", L"IMG_LDBCLICK", (FEvent)&BaseMaintSOWin::OnImgDBClicked);
        AttachEvent(L"dw_item", L"DWV_ROWFOCUSCHANGED", (FEvent)&BaseMaintSOWin::OnRowChanged);
        AttachEvent(L"dw_base", L"DWV_ASKDATA", (FEvent)&BaseMaintSOWin::OnAskDataBase);
        AttachEvent(L"dw_item", L"DWV_ASKSTYLE", (FEvent)&BaseMaintSOWin::OnItemAskStyle);
        AttachEvent(L"dw_item", L"DWV_ITEMCHANGING", (FEvent)&BaseMaintSOWin::OnItemChanging);
        //AttachCloseWindow();
        return 1;
    }
    int OnItemChanging(TEvent* evt, int p)
    {
        DWNMHDR*  hdr = (DWNMHDR*)evt->notify.pnmh;
        xstring colname = hdr->colname;
        xstring value = hdr->data;
        int row = hdr->row;
#ifdef ShouldFinisg
        if (value == L"") return 1;
        xstring cellType = dw_item.GetColumnProp(colname.c_str(), L"celltype");
        if (cellType == L"xs:decimal" || cellType == L"xs:integer")
        {
            if (value.isNumber() == false)
            {
                alert(value + L"不是数字!");
                hdr->idFrom = -1;
                return 1;
            }
        }
#endif
        return 1;
    }
    int OnImgDBClicked(TEvent* evt, int pr)
    {
        IMGNNMHDR* nmtv = (IMGNNMHDR *)evt->notify.pnmh;
        xstring src = nmtv->path;
        /*if(src.length() > 60)
            src = src.right(44);
        else
            src=src.mid(src.find(L"Thumbs", 0)+6, 50);
        */
        xaserverarg& arg = * new xaserverarg;
        //arg.AddArg(L"src",L"/business/products/chanpin"+src);
        arg.AddArg(L"src", src);
        //win::OpenWindow(L"dev:xpage[BigPicture.vx]",arg);
        int h = openUrl(L"/sale/view/ProductLibrary/xpage/bigpictureview", &arg);
        /*
        xwin x = new xwin;
        x.setNativePointer(h);
        m_winHwnd = x.GetHWND();
        xstring sh = doc.xml();
        int p = cast(sh as int);
        win32::SendMessage(m_winHwnd, 0x401, p, 0);
        */
        return 1;
    }
    int OnShowImage(xstring skuno, int row)
    {
        ximageview im = GetControl(L"im1");
        KXMLDOMDocument xp;
        xaserverarg& arg_pic = *new xaserverarg;
        arg_pic.setNativePointer(arg_pic.CreateInstance());
        arg_pic.AddArg(L"SKUNo", skuno);
        xstring res = L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo";
        xstring customerID = dw_base.GetItemString(1, L"CustomerID");
        xstring customerItemNo = dw_item.GetItemString(row, L"CustomerItemNo");
        if (customerItemNo != L"")
        {
            //trace(customerID+L":"+customerItemNo);
            res = L"/sale/data/ProductLibrary3/pref/picture/customer/imagelistSKUNo";
            arg_pic.AddArg(L"CustomerID", customerID);
            arg_pic.AddArg(L"CustomerItemNo", customerItemNo);
        }
        bool hasIamge = false;
        if (xurl::get(GetServerUrl(),res, arg_pic.GetString(), xp) != 1)
        {
            //trace(xp.xml());
            return 1;
        }
        else
        {
            KXMLDOMNodeList  nlistp = xp.selectNodes(L"ImageList/image");
            int lenp = nlistp.length();
            for (int ip = 0; ip < lenp; ip++)
            {
                hasIamge = true;
                KXMLDOMElement xitem = nlistp.item(ip);
                xstring picname = xitem.selectSingleNode(L"PicPath").text();
                string goodno = xitem.selectSingleNode(L"GoodsNo").text();
                if (picname == L"/business/products/Thumbs//")
                    picname = L"/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg";
                im.AddImages(picname, (wchar_t*)goodno);
            }
        }
        if (!hasIamge)
        {
            res = L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo";
            if (xurl::get(GetServerUrl(),res, arg_pic.GetString(), xp) != 1)
            {
                //trace(xp.xml());
                return 1;
            }
            else
            {
                KXMLDOMNodeList nlistp = xp.selectNodes(L"ImageList/image");
                int lenp = nlistp.length();
                for (int ip = 0; ip < lenp; ip++)
                {
                    auto xitem = nlistp.item(ip);
                    string picname = xitem.selectSingleNode(L"PicPath").text();
                    string goodno = xitem.selectSingleNode(L"GoodsNo").text();
                    if (picname == L"/business/products/Thumbs//")
                        picname = L"/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg";
                    im.AddImages(picname, (wchar_t*)goodno);
                }
            }
        }
        return 1;
    }
    int OnRowChanged(TEvent* evt, int p)
    {
        DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh;
        int row = hdr.row;
        ximageview im = GetControl(L"im1");
        im.Reset();
        xstring skuno = dw_item.GetItemString(row, L"SKUNo");
        OnShowImage(skuno, row);
        im.Redraw();
        return 1;
    }
    int onload()
    {
        dw_props = GetControl(L"dw_props");
        /*KXMLDOMDocument x = SaleOrderView::GetMaintFormForBase();
        dw_props.SetDataObject(x);
        //dw_props.SetSelectionBorder(0);
        dw_props.SetColHeaderHeight(0);
        dw_props.SetRowSelectorWidth(0);
        dw_props.SetHScrollState(false);*/
        dw_base = GetControl(L"dw_base");
        dw_base.openUrl(L"/sale/view/SaleOrder/template/base");
        dw_base.SetColHeaderHeight(0);
        dw_base.SetRowSelectorWidth(0);
        dw_base.SetHScrollState(false);
        dw_base.SetVScrollState(false);
        dw_item = GetControl(L"dw_item");
        dw_item.openUrl(L"/sale/view/SaleOrder/template/item");
        dw_item.SetAskStyle(true);
        dw_item.SetColumnState(L"ItemID", false);
        dw_item.SetColumnState(L"LineType", false);
        //dw_item.SetColumnState(L"LineNo",false);
        dw_item.SetColumnState(L"Assortment", false);
        dw_item.SetColumnState(L"ClassifyID", false);
        dw_item.SetColumnState(L"UnitFreight", false);
        //dw_item.SetColumnState(L"CName",false);
        dw_item.SetColumnState(L"Brand", false);
        dw_item.SetColumnState(L"SKUNo", false);
        dw_item.SetColumnState(L"SOLineNo", false);
        dw_item.SetColumnState(L"EnquiryPriceListID", false);
        dw_item.SetColumnState(L"QuoteLineID", false);
        dw_item.SetColumnState(L"CustomerPONo", false);
        dw_item.SetColumnState(L"KOPCode", false);
        dw_item.SetColumnState(L"PackTechNote", false);
        //dw_item.SetColumnState(L"ScheduleShipDate",false);
        dw_item.SetColumnState(L"Submitter", false);
        dw_item.SetColumnState(L"POSupplierID", false);
        xstring groupname = publiccode::GetUser().groupname;
        if (groupname == L"采购小组")
        {
            dw_item.SetColumnState(L"UnitPrice", false);
            dw_item.SetColumnState(L"Amount", false);
            dw_item.SetColumnState(L"UnitCommPrice", false);
            dw_item.SetColumnState(L"CommissionRate", false);
        }
        //alert(groupid);
        /*
        xaserverarg arg = GetParam();
        if(arg)
        {
            xstring SONo = arg.GetArgString(L"SONo");
            x = SaleOrderView::GetMaintDataForBase(SONo);
            dw_props.Retrieve(SaleOrderView::GetMaintDataForBase(SONo));
        }*/
        xstring SONo;
        xstring CustomerID;
        xaserverarg* arg = 0;
        if (GetParam())
        {
            arg = (xaserverarg *)GetParam();
            SONo = arg->GetArgString(L"SONo");
            if (SONo == L"") SONo = arg->GetArgString(L"EntityNo");
        }
        if (SONo != L"")
        {
            KXMLDOMDocument x = SaleOrderView::GetMaintDataForBase(SONo);
            dw_base.Retrieve(x);
            dw_item.Retrieve(x);
        }
        else
        {
            KXMLDOMDocument x = ViewObject::RetrieveData(GetServerUrl(),L"/sale/data/SaleOrder/newinitial");
            dw_base.Retrieve(x);
            xstring sdate = publiccode::GetCurrentDate();
            dw_base.SetItemString(1, L"SODate", sdate);
            xstring suserid = publiccode::GetUser().id;
            xstring susername = publiccode::GetUser().name;
            xstring deptname = publiccode::GetUser().deptname;
            dw_base.SetItemString(1, L"SalespersonID", suserid);
            dw_base.SetItemDisplayString(1, L"SalespersonID", susername);
            dw_base.SetItemString(1, L"orgname", deptname);
            dw_base.SetItemString(1, L"FrontMarks", L"N/M");
            //dw_base.SetItemString(1,L"CurrencyCode",L"USD");
            //dw_base.SetItemDisplayString(1,L"CurrencyCode",L"USD");
            xstring srano = publiccode::GetRANo(L"SO", suserid);
            dw_base.SetItemString(1, L"RANo", srano);
            dw_base.SetItemDisplayString(1, L"RANo", srano);
            dw_base.SetItemString(1, L"CompanyID", L"E9E3C542-062C-4957-B8F4-9B92C3E351FC");
            dw_base.SetItemDisplayString(1, L"CompanyID", L"宁波家尔佳进出口有限公司");
            xstring guid = publiccode::GetGuid();
            dw_base.SetGuid(1, guid);
            dw_base.SetItemString(1, L"@guid", dw_base.GetGuid(1));
            dw_base.SetItemString(1, L"SOID", dw_base.GetGuid(1));
            if (CustomerID != L"")
            {
                dw_base.ItemChangeTo(1, L"CustomerID", arg->GetArgString(L"CustomerID"));
                dw_base.SetItemDisplayString(1, L"CustomerID", arg->GetArgString(L"CustomerName"));
                xstring dwname = L"dw_base";
                xstring colname = L"CustomerID";
                xstring value = CustomerID;
                KXMLDOMNodeList nlist = GetElement().selectNodes(L"//*[@name='" + dwname + L"']/trans[@for='" + colname + L"']");
                ViewObject::TransData(GetServerUrl(),nlist, dw_base, 1, colname, value);
            }
        }
        OnAttachListon();
        return 1;
    }
    int onloaded()
    {
        SetAgent();
        if (GetParam())
        {
            xaserverarg& arg = *(xaserverarg * )GetParam();
            HCURSOR hCursor = xutil::SetCursorWait();
            xstring SONo = arg.GetArgString(L"SONo");
            if (SONo == L"") SONo = arg.GetArgString(L"EntityNo");
            if (SONo != L"")
            {
                KXMLDOMDocument x = SaleOrderView::GetMaintFormForItemList(SONo);
                dw_item.Retrieve(x);
                dw_item.Redraw();
            }
            xutil::RestoreCursor(hCursor);
            if (arg.GetArgString(L"ReadOnly") == L"true")
            {
                dw_base.SetReadOnly(true);
                dw_item.SetReadOnly(true);
            }
        }
        if (dw_base.GetItemString(1, L"ApprovalStatus") == L"3")
        {
            dw_base.SetReadOnly(true);
            dw_item.SetReadOnly(true);
        }
        /*int row3 = dw_item.GetRow();
        xstring ChkStates=dw_item.GetItemInt(row3 ,L"ChkState").toString();
        if(ChkStates==L"") ChkStates=L"1";
        if(ChkStates !=L"1" && ChkStates !=L"5" )
        {
            dw_item.SetReadOnly(true);
            //dw_item.SetColumnState(L"POCreatorID",false);
        }*/
        //dw_base.SetEditUpperMode(true);
        //dw_item.SetEditUpperMode(true);
        if (dw_item.GetRowCount() > 0)
        {
            ximageview im = GetControl(L"im1");
            im.Reset();
            xstring skuno = dw_item.GetItemString(1, L"SKUNo");
            OnShowImage(skuno, 1);
            im.Redraw();
        }
        return 1;
    }
};
jrj/project/business/Supplier.maint.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,1473 @@
class maintSupplierv3 : public maint
{
    xdwtable dw_base;
    xdwtable dw_kpinfo;
    xdwtable dw_visitp;
    xdwtable dw_basegy;
    xdwgrid dw_supgoods;
    xlayersheet m_layer;
    xlayersheet xsheet;
    //string xpage;
    string m_diffstr;
    vcontrol vc;
    string str_replace(string s, string a, string b, int k)
    {
        int i = s.find(a,k);
        if (i > -1)
        {
            string tmp;
            if(i==0)
                tmp = b + s.mid(i + a.length(), s.length());
            else if (i + a.length() == s.length())
                tmp = s.mid(0, i) + b;
            else
                tmp = s.mid(0, i) + b + s.mid(i + a.length(), s.length());
            str_replace(tmp, a, b, i + b.length() + 1);
        }
        else
            return ""+s;
    }
    string str_replace(string s, string a, string b)
    {
        return str_replace( s,  a, b, 0);
    }
    int SetAttributeByxml(xml x,string nodename,string action,string status)
    {
        msxml::IXMLDOMElement e;
        msxml::IXMLDOMNodeList nlist = x.GetXmlDoc().selectNodes("//"+nodename+"");
        if(nlist)
        {
            int nlen = nlist.length;
            int i;
            for(i=0;    i<nlen;    i++)
            {
                e = nlist.item(i);
                //alert(e.xml);
                e.setAttribute(action,status);
                //alert(e.xml);
            }
        }
    }
    int SetAttributeByaddress(xml x,string nodename,string action,string status)
    {
        msxml::IXMLDOMElement e;
        msxml::IXMLDOMNodeList nlist = x.GetXmlDoc().selectNodes("//"+nodename+"");
        if(nlist)
        {
            int nlen = nlist.length;
            int i;
            for(i=0;    i<nlen;    i++)
            {
                e = nlist.item(i);
                //alert(e.xml);
                e.setAttribute(action,status);
                //alert(e.xml);
            }
        }
    }
    int OnPreSave()
    {
        dw_base.AcceptText();
        dw_kpinfo.AcceptText();
        dw_visitp.AcceptText();
        //xdwtable__ dw_base = new xdwtable__;
        //dw_base.setNativePointer(this.GetControl("dw_base"));
        xdwtable dw = dw_base.FindDwTable("Supplier",0);
        string sStatus = dw.GetItemString(1,"Status",0);
        int slen = sStatus.length();
        //if (slen >1)
        string AdvantageProduct = dw_base.GetItemString(1,"AdvantageProduct");
        if(AdvantageProduct.rtrim()=="" )
        {
                alert("优势产品为空!");
                return  -1;
        }
        string FactoryForPaperCard = dw_base.GetItemString(1,"FactoryForPaperCard");
        string FactoryForPart = dw_base.GetItemString(1,"FactoryForPart");
        string FactoryForPacking = dw_base.GetItemString(1,"FactoryForPacking");
        string FactoryForItem = dw_base.GetItemString(1,"FactoryForItem");
        string FactoryForMake = dw_base.GetItemString(1,"FactoryForMake");
        if(FactoryForPaperCard !="Y" && FactoryForPart  !="Y" && FactoryForPacking  !="Y" && FactoryForItem  !="Y" && FactoryForMake  !="Y")
        {
                alert("供应商分组为空!");
                return  -1;
        }
        if(sStatus=="")
        {
            alert("供应商状态输入有误!");
            return -1;
        }
        string sPartyNo = dw.GetItemString(1,"PartyNo",0);
        if (sPartyNo=="" )
            {
                //sPartyNo = publiccode::GetIdentityNo("Party2");
                sPartyNo = publiccode::GetIdentityNo("Party2");
                dw.SetItemString(1,"PartyNo",sPartyNo);
                //alert("供应商编号为空!");
                //return -1;
        }
        string ShortName = dw.GetItemString(1,"ShortName",0);
        if(ShortName.rtrim()=="" )
        {
                alert("供应商简称为空!");
                return -1;
        }
        string YearEstablished = dw_base.GetItemString(1,"YearEstablished");
        if(YearEstablished.rtrim()=="" )
        {
                alert("成立时间为空!");
                return -1;
        }
        string LegalPerson = dw_base.GetItemString(1,"LegalPerson");
        if(LegalPerson.rtrim()=="" )
        {
                alert("法人代表为空!");
                return -1;
        }
        string ThirdPartyReport = dw_base.GetItemString(1,"ThirdPartyReport");
        if(ThirdPartyReport.rtrim()=="" )
        {
                alert("验厂报告为空!");
                return -1;
        }
        string SupplierSource = dw_base.GetItemString(1,"SupplierSource");
        if(SupplierSource.rtrim()=="" )
        {
                alert("供应商来源为空!");
                return -1;
        }
        string Address = dw_base.GetItemString(1,"Address");
        if(Address.rtrim()=="" )
        {
                alert("供应商地址为空!");
                return -1;
        }
        string bAddress = dw_base.GetItemString(1,"bAddress");
        if(bAddress.rtrim()=="" )
        {
                alert("寄件地址为空!");
                return -1;
        }
        string sName = dw.GetItemString(1,"Name",0)+"";
        sName.rtrim();
        //sName = str_replace(sName," ","");
        if (sName=="")
            {
                alert("供应商名称为空!");
                return -1;
        }
        else
        {
            xaserverarg arg=new xaserverarg;
            arg.setNativePointer(arg.CreateInstance());
            arg.AddArg("stype", "Party2");
            arg.AddArg("svalue", sName);
            xml x = new xml;
            x.setNativePointer(x.CreateInstance());
            msxml::IXMLDOMDocument xdoc = x.GetXmlDoc();
            dw_base.DwUpdateAllTo(xdoc);
            //msxml::IXMLDOMElement e= x.GetXmlDoc().documentElement;
            //var n = x.GetXmlDoc().selectSingleNode("Supplier[@update.new='1']");
            //if (n)
            if (!maint::m_EntityID)
            {
                arg.AddArg("operate", "update.new");
            }
            else
            {
                arg.AddArg("operate", "update.modify");
            }
            string sguid=x.GetXmlDoc().selectSingleNode("Supplier/@guid").text;
            arg.AddArg("sguid", sguid);
            //alert(sguid,"->",maint::m_EntityID);
            bool lbRepeated = publiccode::IsRepeated(arg);
            if (lbRepeated)
            {
                alert("供应商名称有重复!");
                return -1;
            }
        }
        /*dw = dw_basegy.FindDwTable("Supplier",0);
        string suserid = xaserver::GetUserId();//publiccode::GetUserInfo().id;
        string susername = publiccode::GetUser(suserid).name;
        string sdate = publiccode::GetCurrentDate();
        dw.SetItemString(1,"ModifierID",suserid);//Party
        dw.SetItemDisplayString(1,"ModifierID",susername);//Party
        dw.SetItemString(1,"ModifyDate",sdate);*/
        int i;
        dw =  dw_base.FindDwTable("item",0);
        for(i=1;i<=dw.GetRowCount();i++)
        {
            string aTemp;
            string aName = dw.GetItemString(i,"Name",0);
            if (aName=="" )
            {
                aTemp=dw.GetItemString(i,"JobTitle",0)+dw.GetItemString(i,"Gender",0)+dw.GetItemString(i,"Mobile",0)+dw.GetItemString(i,"TEL",0)+dw.GetItemString(i,"Email",0)+dw.GetItemString(i,"IM",0)+dw.GetItemString(i,"Remark",0);
                if(aTemp !="")
                {
                    alert("联系人名称必填!");
                    return -1;
                }
            }
            else
            {
                string aStatus;
                aStatus = dw.GetItemString(i,"Status",0);
                if (aStatus=="")
                {
                    dw.SetItemString(i,"Status","1");
                }
            }
        }
        /*dw.setNativePointer(dw_base.FindDwTable("item2",0));
        for(i=1;i<=dw.GetRowCount();i++)
        {
            string bTemp;
            bTemp=dw.GetItemString(i,"AddressName",0)+dw.GetItemString(i,"Address",0);
            if(bTemp !="" && bTemp != nil)
            {
                if (dw.GetItemString(i,"Status",0)=="" || dw.GetItemString(i,"Status",0)==nil)
                    dw.SetItemString(i,"Status","1");
                if (dw.GetItemString(i,"IdentifyAddressFlag",0)=="" || dw.GetItemString(i,"IdentifyAddressFlag",0)==nil)
                    dw.SetItemString(i,"IdentifyAddressFlag","N");
                if (dw.GetItemString(i,"PrimaryFlag",0)=="" || dw.GetItemString(i,"PrimaryFlag",0)==nil)
                    dw.SetItemString(i,"PrimaryFlag","N");
            }
        }*/
        dw = dw_kpinfo.FindDwTable("item3",0);
        for(i=1;i<=dw.GetRowCount();i++)
        {
            string cTemp;
            string cName = dw.GetItemString(i,"BankName",0);
            if (cName=="" )
            {
                cTemp=dw.GetItemString(i,"BankAccountNo",0)+dw.GetItemString(i,"City",0);
                if(cTemp !="")
                {
                    alert("银行名称必填!");
                    return -1;
                }
            }
            cName = dw.GetItemString(i,"BankAccountNo",0);
            if (cName=="" )
            {
                cTemp=dw.GetItemString(i,"BankName",0)+dw.GetItemString(i,"City",0);
                if(cTemp !="" )
                {
                    alert("银行账号必填!");
                    return -1;
                }
            }
            else {
                if (dw.GetItemString(i,"Status",0)=="" )
                    dw.SetItemString(i,"Status","1");
                }
        }
        dw = dw_kpinfo.FindDwTable("Party",0);
        if (dw)
        {
            xdwtable dw_b = dw_kpinfo.FindDwTable("item3",0);
            for(i=1;i<=dw.GetRowCount();i++)
            {
                string skName = dw.GetItemString(i,"Name",0);
                if (skName=="" )
                {
                    int j;
                    for(j=1;j<=dw_b.GetRowCount();j++)
                    {
                        string kTemp = dw_b.GetItemString(j,"BankName",0)+dw_b.GetItemString(j,"BankAccountNo",0)+"";
                        if(kTemp !="" )
                        {
                            alert("开票单位名称为空!");
                            return -1;
                        }
                    }
                }
            }
        }
        xdwtable dw_pc = dw_base.FindDwTable("item");
        for(int h =1; h <= dw_pc.GetRowCount();h++)
        {
            if(dw_pc.GetItemString(h,"Name")=="")
            {
                alert("请输入联系人姓名!");
                    return -1;
            }
            if(dw_pc.GetItemString(h,"Mobile")=="")
            {
                alert("请输入联系人手机号!");
                return -1;
            }
            if(dw_pc.GetItemString(h,"IM")=="")
            {
                alert("请输入联系人QQ号!");
                return -1;
            }
        }
        return 1;
    }
    int OnChangeRowNo(xdwtable dw,int row)
    {
        dw.SetItemString(1, "SeqNo", "1");
        int i;
        for (i=row; i<=dw.GetRowCount(); i++)
            dw.SetItemString(i, "SeqNo", i.toString());
        return 1;
    }
    int OnAddRow()
    {
        if (!m_layer) return 0;
        int h=m_layer.GetSheetIndex();
        int nindex = h+1;
        msxml::IXMLDOMElement n = maint::m_configDoc.selectSingleNode("//maint/group[@for='dwviev']/dwview["+nindex.toString()+"]");
        string sname= n.selectSingleNode("@name").text;
        string stype=n.selectSingleNode("@type").text;
        if (stype == "dwtable")
        {
            int row;
            int crow;
            xdwtable dw_obj = this.GetControl(sname);
            xdwtable dw = dw_obj.GetCurTable();
            string dw_n=dw.GetDwName();
            if(dw_n=="item" || dw_n=="item2" || dw_n=="item3" || dw_n=="item4")
            {
                row = dw.InsertRow(-1);
                if(dw_n=="item2" || dw_n=="item3" || dw_n=="item4")
                {
                    OnChangeRowNo(dw,dw.GetRowCount());
                }
            //alert(row.toString());
                //dw.SetItemString(row,"Status","Y");
            }
            if (dw_n=="item3ooo")
            {
                dw = dw_obj.FindDwTable("Party",0);
                crow = dw.GetRow();
                string scName;
                if (crow >0)
                    scName = dw.GetItemString(crow,"Name",0);
                row = dw.InsertRow(-1);
                if (scName !="" )
                    dw.SetItemString(dw.GetRowCount(),"Name",scName);
            }
            if (dw_n=="Party")
            {
                row = dw.InsertRow(-1);
                crow = dw.GetRow();
            //alert(crow.toString());
                dw.SetItemString(crow,"loadpic","上传图片");
                dw.SetItemString(crow,"dispic","查看");
            }
        }
        else if (stype=="dwgrid")
        {
            xdwgrid dw_objx = new xdwgrid;
            dw_objx = this.GetControl(sname);
            int xrow = dw_objx.InsertRow(-1);
            //dw_objx.SetItemString(xrow,"Status","Y");
        }
        return 1;
    }
    int OnInsertRow()
    {
        if (!m_layer) return 0;
        int h=m_layer.GetSheetIndex();
        int nindex = h+1;
        msxml::IXMLDOMElement n = maint::m_configDoc.selectSingleNode("//maint/group[@for='dwviev']/dwview["+nindex.toString()+"]");
        string sname= n.selectSingleNode("@name").text;
        string stype=n.selectSingleNode("@type").text;
        if (stype=="dwtable")
        {
            int row;
            int crow;
            xdwtable dw_obj = this.GetControl(sname);
            xdwtable dw = dw_obj.GetCurTable();
            string dw_n=dw.GetDwName();
            if(dw_n=="item" || dw_n=="item2" || dw_n=="item3" || dw_n=="item4")
            {
                row=dw.GetRow();
                if (row == 1) row = 0;
                crow = dw.InsertRow(row);
                //dw.SetItemString(crow,"Status","Y");
            }
            if (dw_n=="Party")
            {
                row=dw.GetRow();
                if (row == 1) row = 0;
                crow = dw.InsertRow(row);
                crow = dw.GetRow();
                dw.SetItemString(crow,"loadpic","上传图片");
                dw.SetItemString(crow,"dispic","查看");
            }
        }
        return 1;
    }
    int OnDeleteRow()
    {
        if (!m_layer) return 0;
        int h=m_layer.GetSheetIndex();
        int nindex = h+1;
        msxml::IXMLDOMElement n = maint::m_configDoc.selectSingleNode("//maint/group[@for='dwviev']/dwview["+nindex.toString()+"]");
        string sname= n.selectSingleNode("@name").text;
        string stype=n.selectSingleNode("@type").text;
        if (stype=="dwtable")
        {
            int row;
            xdwtable dw_obj = this.GetControl(sname);
            xdwtable dw = dw_obj.GetCurTable();
            string dw_n=dw.GetDwName();
            if(dw_n=="item" || dw_n=="item2" || dw_n=="item3" || dw_n=="item4"|| dw_n=="Party")
            {
                row=dw.GetRow();
                //if(row != 1)
                //{
                    dw.DeleteRow(row);
                //}
            }
            if (dw_n=="Party0")
            {
                row=dw.GetRow();
                //if(row != 1)
                //{
                    dw.DeleteRow(row);
                //}
            }
        }
        return 1;
    }
    string onpartyadjust(string val)
    {
        xml x = new xml;
        x.setNativePointer(x.CreateInstance());
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg("content",val);
        //alert(val);
        //string sguid = xdoc.selectSingleNode("@guid").text;
        string suserid = xaserver::GetUserId();
        string sdate = publiccode::GetCurrentDate();
        //arg.AddArg("sguid",sguid);
        arg.AddArg("suserid",suserid);
        arg.AddArg("sdate",sdate);
        if (url::post("/sale/data/"+GetEntityName(1)+"/pref/partyadjust",arg.GetString(),x) != 1)
        {
            alert(x.GetXmlDoc().text);
            return val;
        }else
        {
            string s = x.GetXml();
        //alert(s);
            return s;
        }
    }
    string GetEntityData(int pr)
    {
        string val;
        xml x = new xml;
        x.setNativePointer(x.CreateInstance());
        msxml::IXMLDOMDocument xdoc = x.GetXmlDoc();
        msxml::IXMLDOMNodeList nlist = maint::m_configDoc.SelectNodes("//maint/group[@for='dwviev']/dwview[@name !='dw_check' and @name !='dw_supgoods']");
        int  index;
        int  nlen = nlist.length;
        if(nlen>0)
        {
            for(index=0;index<nlen;index++)
            {
                msxml::IXMLDOMElement e  =  nlist.item(index);
                string sname= e.selectSingleNode("@name").text;
                string stype=e.selectSingleNode("@type").text;
                if (stype=="dwtable")
                {
                    xdwtable dw_obj = this.GetControl(sname);
                    dw_obj.AcceptText();
                    if (index==0)
                    {
                        //Address
                        xml xdd = new xml;
                        xdd.setNativePointer(xdd.CreateInstance());
                        string bAddressID = ""+dw_base.GetItemString(1,"bAddressID");
                        if (bAddressID==" ")
                        {
                            dw_base.SetItemString(1,"bAddressID",publiccode::GetGuid());
                            dw_base.SetItemString(1,"bAddressName","邮寄地址");
                            dw_base.SetItemString(1,"bStatus","1");
                            dw_base.SetItemString(1,"bPrimaryFlag","N");
                            dw_base.SetItemString(1,"bIdentifyAddressFlag","N");
                            dw_base.DwUpdateAllTo(xdd.GetXmlDoc());
                            string bAddress = ""+dw_base.GetItemString(1,"bAddress");
                            if ( bAddress !="")
                                SetAttributeByaddress(xdd,"bAddress","update.new","1");
                            xdoc = xdd.GetXmlDoc();
                        }
                        else
                            {dw_obj.DwUpdateAllTo(xdoc);
                            }
                    }
                    /*else if (index==1)
                    {
                        xml__ xchk = new xml__;
                        xchk.setNativePointer(xchk.CreateInstance());
                        dw_obj.DwUpdateAllTo(xchk.GetXmlDoc());
                        SetAttributeByaddress(xchk,"item3","update.modify","1");
                        SetAttributeByaddress(xchk,"isdeleted","update.modify","1");
                        xdoc = xchk.GetXmlDoc();
                    }*/
                    else
                        dw_obj.DwUpdateAllTo(xdoc);
                }
                else
                {
                    xdwgrid dw_objx = this.GetControl(sname);
                    dw_objx.AcceptText();
                    dw_objx.DwUpdateAllTo(xdoc);
                }
            }
        }
       /*var root = xdoc.documentElement;
       var currNode = root.childNodes.item(1);
       var MyNewNode = currNode.cloneNode(true);
       root.appendChild(MyNewNode);
       alert(xdoc.xml);
        return "";
        /*xml__ x1 = new xml__;
        x1.setNativePointer(x1.CreateInstance());
        x1.LoadXml("<a/>");
        msxml::IXMLDOMElement ele = x1.GetXmlDoc();
        var root = xdoc.getElementsByTagName("Name").item(0);
        root.appendChild(ele);*/
        val = xdoc.xml ;
        //alert(val);
        val = onpartyadjust(xdoc.xml);
        //alert(val);
        return val;
    }
    int SetEntityData(xaserverarg arg)
    {
        return 0;
    }
    int ProcessFlowAction0(string comdid, int pr)
    {
        string action = comdid.mid(comdid.find("action:",0)+7,9999);
        xaserverarg arg = new xaserverarg ;
        arg.setNativePointer(arg.CreateInstance());
        xml x = new xml;
        x.setNativePointer(xml ::CreateInstance());
        string aurl = "/workflow/query/actioninfo/"+action;
        if(url::get(aurl, "", x) != 1)
            return -1;
        int nlen ;
        int i = 0;
        string name;
        string worknode;
        string how;
        string state;
        msxml::IXMLDOMElement e;
        //参数要求
        msxml::IXMLDOMNodeList nlist = x.GetXmlDoc().selectNodes("//params/param");
        nlen = nlist.length;
        for(i=0;    i<nlen;    i++)
        {
            e = nlist.item(i);
            name = e.selectSingleNode("@name").text;
            how = e.selectSingleNode("@how").text;
            if(how=="EntityID")
                arg.AddArg(name, GetEntityID(pr));
            else if(how=="Entity" || how == "EntityData")
                arg.AddArg(name, GetEntityData(pr));
            //"CHeckAskMsg"
            //"CHeckMsg"
        }
        arg.AddArg("action.entity",GetEntityName(pr));
        //动作
        if (x.GetXmlDoc().selectSingleNode("//view.action[1]"))
        {
            msxml::IXMLDOMElement n = x.GetXmlDoc().selectSingleNode("//view.action[1]");
            if(n)
            {
                name = n.selectSingleNode("@name").text;
                //worknode = n.selectSingleNode("@worknode").text;
                worknode = GetEntityWorkNode(pr,name);
                arg.AddArg("do",name);
                if(worknode !="")
                {
                    openUrl(worknode,arg);
                }
                else
                {
                    alert("Warn: Please configure worknode for action "+ name +".");
                    return 1;
                }
            }
        }
        else
        {
            //url::post("/workflow/action/Supplier/bill.update",arg.GetString(),x);
            xml x1 = new xml;
            x1.setNativePointer(x1.CreateInstance());
            //if (url::post("/workflow/action/"+GetEntityName(pr)+"/"+action,arg.GetString(),x1) != 1)
            if(url::post("/sale/data/SupplierV3/entity/owner/save", arg.GetString(),x)!=1)
            {
                if (x1.GetXmlDoc())
                {
                    string error = x1.GetXmlDoc().text;
                    //alert(error);
                }
            }
            else
            {
                //alert(x1.GetXml());
                if(x1.GetXmlDoc().selectSingleNode("error"))
                {
                    alert("保存出错2!");
                    return 0;
                }
            }
            win32::MessageBox(GetHWND(),"保存成功!","提示",0);
            dw_base.ResetUpdateStatus();
            dw_kpinfo.ResetUpdateStatus();
            dw_visitp.ResetUpdateStatus();
            OnRetrieve();
        }
        return 1;
    }
    int r1()
    {
            msxml::IXMLDOMNodeList nlist = maint::m_configDoc.SelectNodes("//maint/group[@for='dwviev']/dwview");
            int  index;
            int  nlen = nlist.length;
            if(nlen>0)
            {
                for(index=0;index<nlen;index++)
                {
                    msxml::IXMLDOMElement e  =  nlist.item(index);
                    string sname= e.selectSingleNode("@name").text;
                    string stype=e.selectSingleNode("@type").text;
                    if (stype=="dwtable")
                    {
                        xdwtable dw_obj = this.GetControl(sname);
                        xaserverarg arg = new xaserverarg;
                        arg.setNativePointer(arg.CreateInstance());
                        arg.AddArg("EntityID", this.GetEntityID(1));
                        xml x1 = new xml;
                        x1.setNativePointer(xml ::CreateInstance());
                        string dataUrl = "/sale/data/"+GetEntityName(1)+"/entity/maint" ;
                        getUrl(dataUrl,arg.GetString(),x1);
                        dw_obj.Retrieve(x1);
                        break;
                    }
                }
                return 1;
            }
            return 1;
    }
    int r2()
    {
            xml x = new xml;
            x.setNativePointer(x.CreateInstance());
            msxml::IXMLDOMDocument xdoc = x.GetXmlDoc();
            //dw_base.DwUpdateAllTo(xdoc);
            msxml::IXMLDOMNodeList nlist = maint::m_configDoc.SelectNodes("//maint/group[@for='dwviev']/dwview");
            int  index;
            int  nlen = nlist.length;
            if(nlen>0)
            {
                for(index=0;index<nlen;index++)
                {
                    msxml::IXMLDOMElement e  =  nlist.item(index);
                    string sname= e.selectSingleNode("@name").text;
                    string stype=e.selectSingleNode("@type").text;
                    if (stype=="dwtable")
                    {
                        xdwtable dw_obj = this.GetControl(sname);
                        dw_obj.DwUpdateAllToDiff(xdoc);
                        m_diffstr = xdoc.xml;
                        //alert(m_diffstr);
                        break;
                    }
                }
                return 1;
            }
            return 1;
    }
    int r3()
    {
            if(m_diffstr=="") return 1;
            xml x = new xml;
            x.setNativePointer(x.CreateInstance());
            x.LoadXml(m_diffstr);
            msxml::IXMLDOMDocument xdoc = x.GetXmlDoc();
            //dw_base.DwUpdateAllTo(xdoc);
            msxml::IXMLDOMNodeList nlist = maint::m_configDoc.SelectNodes("//maint/group[@for='dwviev']/dwview");
            int  index;
            int  nlen = nlist.length;
            if(nlen>0)
            {
                for(index=0;index<nlen;index++)
                {
                    msxml::IXMLDOMElement e  =  nlist.item(index);
                    string sname= e.selectSingleNode("@name").text;
                    string stype=e.selectSingleNode("@type").text;
                    if (stype=="dwtable")
                    {
                        xdwtable dw_obj = this.GetControl(sname);
                        dw_obj.RetrieveDiff(xdoc);
                        dw_obj.Redraw();
                        break;
                    }
                }
                return 1;
            }
            return 1;
    }
    int test()
    {
        xml x = new xml;
        x.setNativePointer(x.CreateInstance());
        dw_kpinfo.DwUpdateAllTo(x.GetXmlDoc());
        //dw_visitp.dwUpdateAllTo(x.GetXmlDoc());
        //dw_kpinfo.ClearAdvanceString(1,1);
        //dw_kpinfo.ClearNoteString(1,1);
        //dw_kpinfo.ClearOriginString(1,1);
        //dw_kpinfo.DeleteRows(1,1,1);
        //dw_kpinfo.ExpandCellRow(1,2);
        //dw_kpinfo.ExpandMarginRow(2,1);
        //dw_kpinfo.ExpandRow(2,3);
        //dw_kpinfo.GetDwType(); ???
        //string s = dw_kpinfo.GetDwXPath(); //Supplier
        //msxml::IXMLDOMElement e = dw_kpinfo.GetElement(); //alert(e.xml); <xcell state="run" name="dw_kpinfo"/>
        //string s = dw_kpinfo.GetGuid(1);
        //string s = dw_kpinfo.GetHtml(); ???
        //int i = dw_kpinfo.GetId();
        //int i = dw_kpinfo.GetXNode();
        //dw_kpinfo.SetGuid(1,"5CF56D30-C02C-4CC0-971B-57894236816A");
    }
    int OnMoveup()
    {
        test();
        return 1;
        if (!m_layer) return 0;
        int h=m_layer.GetSheetIndex();
        int nindex = h+1;
        msxml::IXMLDOMElement n = maint::m_configDoc.selectSingleNode("//maint/group[@for='dwviev']/dwview["+nindex.toString()+"]");
        string sname= n.selectSingleNode("@name").text;
        string stype=n.selectSingleNode("@type").text;
        if (stype=="dwtable")
        {
            xdwtable dw_obj = this.GetControl(sname);
            xdwtable dw = dw_obj.GetCurTable();
            string dw_n=dw.GetDwName();
            if(dw_n=="item3")
            {
                int row=dw.GetRow();
                if (row == 1) row = 0;
                int crow = dw.InsertRow(row);
                //dw.
                //dw.SetItemString(crow,"Status","Y");
            }
        }
        return 1;
    }
    int OnMovedown()
    {
        return 1;
    }
    int xxx()
    {
        //msxml::IXMLDOMElement xframeElement =  GetElement();
        //msxml::IXMLDOMNode xpage = xframeElement.selectSingleNode("//xpage");
        //alert(xframeElement.xml);
        /*string xfNodeAgentArea  = "layers";
        xnode__ anode = GetAgentNode(xfNodeAgentArea);
        msxml::IXMLDOMElement xframeElement =  GetElement();
        alert(anode.GetXml());
        msxml::IXMLDOMNode layers = xframeElement.selectSingleNode("//layers");
        msxml::IXMLDOMNodeList nlist;
        int  index;
        int  nlen;
        msxml::IXMLDOMElement ele;
        if(layers)
        {
            nlist = layers.SelectNodes(".//layer");
            nlen = nlist.length;
        alert("nlen=",nlen.toString());
        }
        //string tools;
        //SetAgentNodeContent(anode, tools);*/
        return 1;
    }
    int DoUpdate(bool showSuccess = true)
    {
        int rec =OnPreSave();
        if (rec== -1)    return 0;
        ProcessFlowAction0("action:bill.update",1);
        return 1;
    }
    int PreOnCmdDispatch(string comdid)
    {
        if(comdid=="action:xxx") return xxx();
        if(comdid=="retrieve") return r1();
        if(comdid=="retrievediff") return r3();
        if(comdid=="updatediff") return r2();
        if(comdid=="test") return test();
        //<action id="bill.update" caption="保存"  scene="maint"/>
        if(comdid.find("action:bill.update",0)>=0)
        {
            string suserid = xaserver::GetUserId();
            PUser pp = publiccode::GetUser(suserid);
            string userno = pp.no;
            if(userno !="admin")
            {
                int rec =OnPreSave();
                if (rec== -1)    return 0;//返回0——不在执行以下代码;返回其他——执行以下代码。
            }
            ProcessFlowAction0(comdid,1);
            return 1;
        }
        if(comdid.find("action:bill.addrow",0)>=0) OnAddRow();
        if(comdid.find("action:bill.insertrow",0)>=0) OnInsertRow();
        if(comdid.find("action:bill.deleterow",0)>=0) OnDeleteRow();
        if(comdid.find("action:bill.moveup",0)>=0) OnMoveup();
        if(comdid.find("action:bill.movedown",0)>=0) OnMovedown();
        return 1;
    }
    int OnDoubleClicked(ref TNotifyEvent evt,int p)
    {
        ref DWNMHDR  hdr = evt.pnmh;
        int row = hdr.row;
        /*if(row < 1 || row > list::dw_list.GetRowCount())
            return 1;
        int hwnd = evt.lParam;
        int s = combobox::GetCount(cb_config.GetId());
        int i;
        for (i=0; i < s; i++){
            combobox cb = new combobox;
            cb.setNativePointer(this.GetControl("value"+i.ToString()));
            if(hwnd == cb.GetId())
                break;
        }*/
        return 1;
    }
    int OnItemChangedkp(ref TNotifyEvent evt,int p)
    {
        ref DWNMHDR  hdr = evt.pnmh;
        string colname=hdr.colname;
        string coldata = hdr.data;
        int row = hdr.row;
        xdwtable dw = dw_kpinfo.FindDwTable("item3",0);
        if (dw)
        {
            row=dw.GetRow();
            string sdate = publiccode::GetCurrentDate();
            dw.SetItemString(row,"ModifyDate",sdate);
        }
    }
    int OnItemChanged3(ref TNotifyEvent evt,int p)
    {
        ref DWNMHDR  hdr = evt.pnmh;
        string colname=hdr.colname;
        string coldata = hdr.data;
        int row = hdr.row;
        if(colname=="DeveloperID")
        {
            xml x = new xml;
            x.setNativePointer(xml ::CreateInstance());
            xaserverarg arg = new xaserverarg;
            arg.setNativePointer(arg.CreateInstance());
            arg.AddArg("guid",coldata);
            if (url::get("/sale/data/"+GetEntityName(1)+"/pref/getAssignment",arg.GetString(),x) == 1)
            {
                msxml::IXMLDOMElement e=x.GetXmlDoc().documentElement;
                string sOrgID = e.selectSingleNode("OrgID").text;
                string sOrgName = e.selectSingleNode("OrgName").text;
                dw_basegy.SetItemString(1,"devOrgID",sOrgID);
                dw_basegy.SetItemDisplayString(1,"devOrgID",sOrgName);
            }
        }
        if(colname=="CreatorID")
        {
            xml x2 = new xml;
            x2.setNativePointer(xml ::CreateInstance());
            xaserverarg arg2 = new xaserverarg;
            arg2.setNativePointer(arg2.CreateInstance());
            arg2.AddArg("guid",coldata);
            if (url::get("/sale/data/"+GetEntityName(1)+"/pref/getAssignment",arg2.GetString(),x2) == 1)
            {
                msxml::IXMLDOMElement e2=x2.GetXmlDoc().documentElement;
                string sOrgID2 = e2.selectSingleNode("OrgID").text;
                string sOrgName2 = e2.selectSingleNode("OrgName").text;
                dw_basegy.SetItemString(1,"OrgID",sOrgID2);
                dw_basegy.SetItemDisplayString(1,"OrgID",sOrgName2);
            }
        }
        return 1;
    }
    int OnItemChanged(ref TNotifyEvent evt,int p)
    {
        ref DWNMHDR  hdr = evt.pnmh;
        string colname=hdr.colname;
        string coldata = hdr.data;
        int row = hdr.row;
        if(colname=="DeveloperID")
        {
            xml x = new xml;
            x.setNativePointer(xml ::CreateInstance());
            xaserverarg arg = new xaserverarg;
            arg.setNativePointer(arg.CreateInstance());
            arg.AddArg("guid",coldata);
            if (url::get("/sale/data/"+GetEntityName(1)+"/pref/getAssignment",arg.GetString(),x) == 1)
            {
                msxml::IXMLDOMElement e=x.GetXmlDoc().documentElement;
                string sOrgID = e.selectSingleNode("OrgID").text;
                string sOrgName = e.selectSingleNode("OrgName").text;
                dw_base.SetItemString(1,"devOrgID",sOrgID);
                dw_base.SetItemDisplayString(1,"devOrgID",sOrgName);
            }
        }
        if(colname=="CreatorID")
        {
            xml x2 = new xml;
            x2.setNativePointer(xml ::CreateInstance());
            xaserverarg arg2 = new xaserverarg;
            arg2.setNativePointer(arg2.CreateInstance());
            arg2.AddArg("guid",coldata);
            if (url::get("/sale/data/"+GetEntityName(1)+"/pref/getAssignment",arg2.GetString(),x2) == 1)
            {
                msxml::IXMLDOMElement e2=x2.GetXmlDoc().documentElement;
                string sOrgID2 = e2.selectSingleNode("OrgID").text;
                string sOrgName2 = e2.selectSingleNode("OrgName").text;
                dw_base.SetItemString(1,"OrgID",sOrgID2);
                dw_base.SetItemDisplayString(1,"OrgID",sOrgName2);
            }
        }
        if(colname=="isdeleted")
        {
            //xml xchk = new xml;
            //xchk.setNativePointer(xchk.CreateInstance());
            //var xdoc = xchk.GetXmlDoc();
           // dw_kpinfo.DwUpdateAllTo(xdoc);
            //SetAttributeByxml(xchk,"isdeleted","update.modify","1");
            //dw_kpinfo.SetColumnProp("isdeleted","update.modify","1");
            //xdwtable dw = new xdwtable;
            //dw.setNativePointer(dw_kpinfo.FindDwTable("item3",0));
            //dw.SetItemString(row,"isdeleted",coldata);
        }
        if(colname == "ProvinceCode" || colname == "City" || colname == "District")
        {
            if(colname == "ProvinceCode")
            {
                dw_base.SetItemString(row,"City","");
                dw_base.SetItemString(row,"District","");
                dw_base.SetItemDisplayString(row,"City","");
                dw_base.SetItemDisplayString(row,"District","");
            }
            if(colname == "City")
            {
                dw_base.SetItemString(row,"District","");
                dw_base.SetItemDisplayString(row,"District","");
            }
            string provinceCode = dw_base.GetItemDisplayString(row,"ProvinceCode");
            string city = dw_base.GetItemDisplayString(row,"City");
            string district = dw_base.GetItemDisplayString(row,"District");
            dw_base.SetItemString(row,"Address",provinceCode+city+district);
            dw_base.SetItemString(row,"bAddress",provinceCode+city+district);
        }
        if(colname == "Address")
        {
            dw_base.SetItemString(row,"bAddress",dw_base.GetItemString(1,"Address"));
        }
        xdwtable dw = dw_base.FindDwTable("Supplier",0);
        if (dw)
        {
            string suserid = xaserver::GetUserId();//publiccode::GetUserInfo().id;
            string susername = publiccode::GetUser(suserid).name;
            string sdate = publiccode::GetCurrentDate();
            dw.SetItemString(1,"ModifierID",suserid);//Party
            dw.SetItemDisplayString(1,"ModifierID",susername);//Party
            dw.SetItemString(1,"ModifyDate",sdate);
        }
        return 1;
    }
    //---------
    int UpLoad(string name)
    {
        string str = name.mid(0,2);
        str = str.upper();
        //alert(str);
        int ret1 = xaserver::Upload("supplier"+str, name+".jpg", this.GetHWND(),"",false);
        //alert(ret1);
        return ret1;
    }
    int OnkpItemClick(ref TNotifyEvent evt,int p)
    {
        xdwtable dw = dw_kpinfo.FindDwTable("Party",0);
        /*xdwtable__ dw1 = new xdwtable__;
        dw1.setNativePointer(dw_base.FindDwTable("item3",0));    */
        ref DWNMHDR  hdr = evt.pnmh;
        string value = hdr.data;
        int row = dw.GetRow();// hdr.row;
        string xrow = row.toString();
        xaserverarg arg=new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        if(value == "上传图片")
        {
            string strguid = publiccode::GetGuid();
            //alert(strguid);
            int ret1 =UpLoad(strguid);
            if(ret1  == -1)
                return -1;
            if(ret1  == 0)
            {
                alert("上传图片失败");
                return -1;
            }
            else
            {
                alert("上传图片成功");
                string strimage=dw.GetItemString(row,"ImageList1");
                //alert(strimage);
                if(strimage=="")
                    strimage="<ImageList></ImageList>";
                xml y=new xml;
                y.setNativePointer(xml::CreateInstance());
                y.LoadXml(strimage);
                msxml::IXMLDOMElement ele= y.GetXmlDoc().documentElement;
                xml x=new xml;
                x.setNativePointer(xml::CreateInstance());
                string xx = "<ImageList><image>"+strguid+".jpg</image></ImageList>";
                x.LoadXml(xx);
                msxml::IXMLDOMElement e=  x.GetXmlDoc().selectSingleNode("//image");
                ele.appendChild(e);
                dw.SetItemString(row,"ImageList1",ele.xml);
                //dw.Redraw();
            }
        }
        if(value == "查看")
        {
            arg.AddArg("src",dw.GetItemString(row,"ImageList1"));
            int pa = arg.getNativePointer();
            openUrl("/sale/view/"+GetEntityName(1)+"/xpage/supplierattachment/picture", pa);
            //alert(arg.GetArgString("src"));
            dw.SetItemString(row,"ImageList1",arg.GetArgString("src"));
        }
        return 1;
    }
    int OnItemClick(ref TNotifyEvent evt,int p)
    {
        ref DWNMHDR  hdr1 = trust(evt.pnmh as ref DWNMHDR);
        string colname1= hdr1.colname;
        ref DWNMHDR  hdr = evt.pnmh;
        string value = hdr.data;
        //alert(value);
        //xdwtable dw = dw_base.FindDwTable("item2",0);
        //xdwtable dw1 = dw_base.FindDwTable("item3",0);
        xaserverarg arg=new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        /*if(value == "上传附件")
        {
            string strguid = publiccode::GetGuid();
            //alert(strguid);
            int ret1 = UpLoad(strguid);
            if(ret1  == -1)
                return -1;
            if(ret1  == 0)
            {
                alert("上传附件失败");
                return -1;
            }
            else
            {
                alert("上传附件成功");
                string strimage=dw_base.GetItemString(1,"ImageList1");
                //alert(strimage);
                if(strimage=="")
                    strimage="<ImageList></ImageList>";
                xml y=new xml;
                y.setNativePointer(xml::CreateInstance());
                y.LoadXml(strimage);
                msxml::IXMLDOMElement ele= y.GetXmlDoc().documentElement;
                xml x=new xml;
                x.setNativePointer(xml::CreateInstance());
                string xx = "<ImageList><image>"+strguid+".jpg</image></ImageList>";
                x.LoadXml(xx);
                msxml::IXMLDOMElement e=  x.GetXmlDoc().selectSingleNode("//image");
                ele.appendChild(e);
                dw_base.SetItemString(1,"ImageList1",ele.xml);
                dw_base.Redraw();
                //alert(ele.xml);
            }
        }
        if(value == "查看")
        {
            arg.AddArg("src",dw_base.GetItemString(1,"ImageList1"));
            //alert(dw_base.GetItemString(1,"ImageList1"));
            int pa = arg.getNativePointer();
            //alert(GetEntityName(1));
            openUrl("/sale/view/"+GetEntityName(1)+"/xpage/supplierattachment/picture", pa);
            //alert(arg.GetArgString("src"));
            arg.setNativePointer(pa);
            dw_base.SetItemString(1,"ImageList1",arg.GetArgString("src"));
        }*/
        /*else if(value == "产品信息")
        {
            int start=dw_base.GetCellRowFromRowColumn(1,dw_base.GetColumnIndex("MainProducts"));
            dw_base.ExpandCellRow(start,start + dw.GetRowCount() +1);
        }
        else if(value == "设备产能")
        {
            int start1=dw_base.GetCellRowFromRowColumn(1,dw_base.GetColumnIndex("MainProducts"));
            int begin=dw_base.GetCellRowFromRowColumn(1,dw_base.GetColumnIndex("DeveloperID"));
            dw_base.ExpandCellRow(start1 + dw.GetRowCount() +3,begin -2);
            //dw_base.ExpandMarginRow(-22,-20);
        }*/
        if(value == "供应商资料附件")
        {
            arg.AddArg("entityid",dw_base.GetGuid(1));
            arg.AddArg("ApplyStatus",dw_base.GetItemString(1,"ApplyStatus"));
            int p3=cast(arg as int) ;
            OpenWindow("dev:xpage[maint.Document.Supplier.v3.vx]", p3);
        }
        if(value == "验厂报告附件")
        {
            arg.AddArg("entityid",dw_base.GetGuid(1));
            arg.AddArg("ApplyStatus",dw_base.GetItemString(1,"ApplyStatus"));
            int p7=cast(arg as int) ;
            OpenWindow("dev:xpage[maint.Document.SupplierEx.v3.vx]", p7);
        }
        else if(value == "合作信息")
        {
            int start2=dw_base.GetCellRowFromRowColumn(1,dw_base.GetColumnIndex("Status"));
            dw_base.ExpandCellRow(start2,start2 +1);
            //dw_base.ExpandMarginRow(-22,-20);
        }
        if (colname1 == "ThirdPartyReport")
            {
                xaserverarg arg1 = new xaserverarg;
                arg1.setNativePointer(arg.CreateInstance());
                int p2=cast(arg1 as int) ;
                dw_base.SetItemString(1,"ThirdPartyReport","");
                OpenWindow("dev:xpage[Inspection.Supplie.vx]", p2);
                string str1 = arg1.GetArgString("ThirdPartyReport");
                if(str1 != ""){
                    dw_base.SetItemString(1,"ThirdPartyReport",str1);
                    dw_base.Redraw();
                }
            }
        if (colname1 == "PayType")
            {
                xaserverarg arg2 = new xaserverarg;
                arg2.setNativePointer(arg.CreateInstance());
                int p1=cast(arg2 as int) ;
                OpenWindow("dev:xpage[paymen.Supplier.vx]", p1);
                string str = arg2.GetArgString("PayType");
                if(str != ""){
                    dw_base.SetItemString(1,"PayType",str);
                    dw_base.Redraw();
                }
            }
        return 1;
    }
    int OnSheetChanged(ref TNotifyEvent evt,int p)
    {
        string suserid = xaserver::GetUserId();
        PUser pp = publiccode::GetUser(suserid);
        string userno = pp.no;
        if (userno == "admin" )
        {
            dw_base.SetReadOnly(false);
            dw_kpinfo.SetReadOnly(false);
            dw_visitp.SetReadOnly(false);
        }else
        {
            dw_base.SetReadOnly(true);
            dw_kpinfo.SetReadOnly(true);
            //dw_visitp.SetReadOnly(true);
        }
    }
    int OnItemClickExS(ref TNotifyEvent evt,int p)
    {
        xdwtable dw = dw_visitp.FindDwTable("item4",0);
        ref DWNMHDR  hdr = cast(evt.pnmh as ref DWNMHDR);
        string value = hdr.data;
        int row = hdr.row;
        //alert(value);
        xaserverarg arg=new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        if(value == "附件上传")
        {
            if(dw.GetGuid(dw.GetRow())=="")
            {
                alert("保存后在上传!");
                return 1;
            }
            arg.AddArg("entityid",dw.GetGuid(dw.GetRow()));
            //arg.AddArg("ApplyStatus",dw_base.GetItemString(1,"ApplyStatus"));
            int p4=cast(arg as int) ;
            OpenWindow("dev:xpage[maint.Document.Customer.v3.vx]", p4);
            return 1;
        }
        if(value == "人员")
        {
            xaserverarg arg2 = new xaserverarg;
            arg2.setNativePointer(arg2.CreateInstance());
            xaserverarg parg2 = GetParam();
            OpenWindow("dev:xpage[SupplierUserGroupPersonSelect.vx]",cast(arg2 as int));
            if(arg2.GetArgString("comdid")=="xmOk")
            {
                string data = arg2.GetArgString("data");
                xml x2 = new xml;
                x2.setNativePointer(xml::CreateInstance());
                x2.LoadXml(data);
                msxml::IXMLDOMNodeList nodes = x2.GetXmlDoc().selectNodes("/root/item");
                trace(x2.GetXml());
                int len = nodes.length;
                string Names = "";
                for(int i=0;i<len; i++)
                {
                    msxml::IXMLDOMElement t= nodes.item(i);
                    if(t.getAttribute("Name"))
                    {
                        string Name = t.getAttribute("Name");
                        if(Names=="")
                            Names = Name;
                        else if(Names.find(Name) < 0) Names+=","+Name;
                    }
                }
                dw.SetItemString(dw.GetRow(),"ItemType",Names);
            }
            return 1;
        }
        return 1;
    }
    int PostOnAttachEvent()
    {
        AttachEvent("dw_base","DWV_CLICKED",OnItemClick);
        //AttachEvent("tab_1", "LYSN_SELECTEDSHEET",OnSheetChanged);
        AttachEvent("dw_kpinfo","DWV_CLICKED",OnkpItemClick);
        AttachEvent("dw_kpinfo","DWV_ITEMCHANGED",OnItemChangedkp);
        AttachEvent("dw_base","DWV_ITEMCHANGED",OnItemChanged);
        AttachEvent("dw_basegy","DWV_ITEMCHANGED",OnItemChanged3);
        AttachEvent("dw_visitp","DWV_CLICKED",OnItemClickExS);
        return 1;
    }
    int OnInit()
    {
        dw_base = this.GetControl("dw_base");
        dw_base.SetColHeaderHeight(16);
        dw_kpinfo = this.GetControl("dw_kpinfo");
        dw_kpinfo.SetColHeaderHeight(16);
        dw_visitp = this.GetControl("dw_visitp");
        dw_visitp.SetColHeaderHeight(16);
        //xdwtable dw_check = this.GetControl("dw_check");
        //dw_check.SetColHeaderHeight(16);
        //dw_check.SetReadOnly(true);
        dw_basegy = this.GetControl("dw_basegy");
        dw_supgoods = this.GetControl("dw_supgoods");
        m_layer = GetControl("tab_1");
        xsheet = GetControl("tab_1");
        //string  userno = xaserver::GetUserNo();
        string ApplyStatus=dw_base.GetItemString(1,"ApplyStatus");
        //if(userno !="00601" && userno !="admin" && userno !="00701")
        //{
            //alert(ApplyStatus);
            if(ApplyStatus =="已批准")
            {
                dw_visitp.SetReadOnly(false);
            }
        //}
        if (!maint::m_EntityID)
        {
            string suserid = xaserver::GetUserId();
            string susername = publiccode::GetUser(suserid).name;
            string sdate = publiccode::GetCurrentDate();
            string sAddressID = publiccode::GetGuid();
            dw_base.SetItemString(1,"CreatorID",suserid);//Party
            dw_base.SetItemDisplayString(1,"CreatorID",susername);
            dw_base.SetItemString(1,"CreateDate",sdate);
            //string sCountryCode = dw.GetItemString(1,"CountryCode",0);
            //if (sCountryCode=="" || sCountryCode== nil)
            dw_base.SetItemString(1,"CountryCode","142");
            dw_base.SetItemDisplayString(1,"CountryCode","中国");
            dw_base.SetItemString(1,"Status","1");
            dw_base.SetItemString(1,"Type","2");//PartyAccount  ä¾›åº”商
            dw_base.SetItemString(1,"aIdentifyAddressFlag","Y");//PartyAddress  ä¸»åœ°å€
            dw_base.SetItemString(1,"aPrimaryFlag","Y");
            dw_base.SetItemString(1,"aStatus","1");
            dw_base.SetItemString(1,"bAddressID",sAddressID);//PartyAddress  å¯„件地址
            dw_base.SetItemString(1,"bAddressName","寄件地址");
            dw_base.SetItemString(1,"bIdentifyAddressFlag","N");
            dw_base.SetItemString(1,"bPrimaryFlag","N");
            dw_base.SetItemString(1,"bStatus","1");
            //dw_base.ResetUpdateStatus();
            //dw_check.SetItemDisplayString(1,"BusinessLicenceFlag","营业执照");
            //dw_check.SetItemDisplayString(1,"TaxRegistrationFlag","税务登记证复印件");
            //dw_check.SetItemDisplayString(1,"OrganizationCodeFlag","组织机构代码");
        }
        //dw_base.SetColHeaderHeight(0);
        //dw_base.SetRowSelectorWidth(0);
        //dw_base.SetScrollState(false);
        return 1;
    }
    int onload()
    {
        maint::onload();
        return 1;
    }
    int onloaded()
    {
        //PostOnAttachEvent();
        maint::onloaded();
        OnInit();
        string suserid = xaserver::GetUserId();
        PUser p = publiccode::GetUser(suserid);
        string deptname = p.deptname;
        string userno = p.no;
        string jobname=p.jobname;
        string ApplyStatusEx=dw_base.GetItemString(1,"ApplyStatus");
        //alert(ApplyStatusEx);
        if (userno == "admin" ||userno == "00601" || userno == "00701" || ApplyStatusEx=="修改")
        {
            dw_base.SetReadOnly(false);
            dw_kpinfo.SetReadOnly(false);
            dw_visitp.SetReadOnly(false);
        }else
        {
            dw_base.SetReadOnly(true);
            dw_kpinfo.SetReadOnly(true);
            //dw_visitp.SetReadOnly(true);
        }
        /*if(deptname != "产品供应部" && userno != "admin")
        {
            xdwtable dw = dw_base.FindDwTable("item2",0);
            int start=dw_base.GetCellRowFromRowColumn(1,dw_base.GetColumnIndex("MainProducts"));
    alert(start.toString());
            //dw_base.ExpandCellRow(start,dw.GetRowCount());
    alert("2");
            int start1=dw_base.GetCellRowFromRowColumn(1,dw_base.GetColumnIndex("MainProducts"));
            int begin=dw_base.GetCellRowFromRowColumn(1,dw_base.GetColumnIndex("DeveloperID"));
    alert("2");
            //dw_base.ExpandCellRow(start1 + dw.GetRowCount() +3,begin -2);
            int start2=dw_base.GetCellRowFromRowColumn(1,dw_base.GetColumnIndex("Status"));
    alert("2");
            //dw_base.ExpandCellRow(start2,start2 +1);
            //dw_kpinfo.openUrl("/sale/view/Supplier/template/supplier/kpinfo2");
            //maint::OnRetrieve();
        }*/
        /*if (userno == "admin" )
        {
            dw_base.SetReadOnly(false);
            dw_kpinfo.SetReadOnly(false);
        }else
        {
            dw_base.SetReadOnly(true);
            dw_kpinfo.SetReadOnly(true);
        }
        dw_supgoods.SetReadOnly(true);
        if(jobname=="业务部经理" || jobname == "业务经理" || jobname == "业务主管" || jobname == "业务组长" || userno == "admin")
        {
            xsheet.SetSheetState(4,1);//显示产品库
        }
        else
        {
            xsheet.SetSheetState(4,0);    //隐藏产品库
        }*/
        return 1;
    }
};
jrj/project/business/Supplier3.list.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,541 @@
#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) listSupplierv3 : public listwin
{
public:
    xdwgrid dw_goods;
    xtreeview tv_1;
    xcombobox ddlb_1;
    int    changeddlb;
    xstring TypeWork;
    xstring GoodsUrl;
    xstring m_sType; //type
    xstring m_sTypeTxt; //选中树的data
    //    xstring m_searchtxt;
    int PIndex;
    xnode    m_agentNode;    //Agent Condition
    xstring    m_agentCond;    //Agent Node
public:
    listSupplierv3(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {}
public:
    static listSupplierv3* CreateInstance(void* implPtr, void* hWnd)
    {
        listSupplierv3* pWin = new listSupplierv3(implPtr, (HWND)hWnd);
        return pWin;
    }
    int OnRetrieve()
    {
        xml x;
        xaserverarg arg;
        arg.AddArg(L"pageindex", xstring(PIndex)); //第几页
        arg.AddArg(L"pagenumber", xstring(listwin::m_pageNumber)); //每页数量
        arg.AddArg(L"QueryTxt", listwin::m_QueryTxt);
        arg.AddArg(L"sType", m_sType);
        arg.AddArg(L"sTypeTxt", m_sTypeTxt);
        trace(arg.GetString());
        //alert(L"xxxx");
        if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1)
        {
            return -1;
        }
        else
        {
            KXMLDOMElement e = x.documentElement();
            if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage"))
            {
                xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量
                listwin::dw_pages.SetMaxPage(s.toInt());
            }
            //alert(x.GetXml());
            dw_list.Retrieve(x);
            dw_list.Redraw();
            dw_list.SetReadOnly(true);
        }
        return 1;
    }
    int SetEntityData(xaserverarg arg)
    {
        xstring strQueryTxt = arg.GetArgString(L"QueryTxt");
        xml x;
        arg.AddArg(L"sType", m_sType);
        arg.AddArg(L"sTypeTxt", m_sTypeTxt);
        trace(arg.GetString());
        if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1)
        {
            alert(x.text());
            return -1;
        }
        else
        {
            KXMLDOMElement e = x.documentElement();
            if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage"))
            {
                xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量
                listwin::dw_pages.SetMaxPage(s.toInt());
            }
            //trace(x.GetXml());
            listwin::dw_list.Retrieve(x);
            listwin::dw_list.Redraw();
            listwin::dw_list.SetReadOnly(true);
        }
        return 1;
    }
    int OnChangePages(TEvent* evt, LPARAM p)
    {
        PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh;
        int c = h->cur;
        HCURSOR hCursor = xutil::SetCursorWait();
        OnRetrieve();
        PIndex = c;
        xutil::RestoreCursor(hCursor);
        return 1;
    }
    int ViewUpdate(int pr, xstring updateItem, xaserverarg  arg)
    {
        if (updateItem == L"refresh")
        {
            //trace(L"sd");
            xdwpages zz = GetControl(L"pages");
            int h = zz.SetCurPage(1);
            //trace(h);
            OnRetrieve();
        }
        return 1;
    }
    //树选择
    int OnTreeSelChanged(TEvent evt, LPARAM p)
    {
        if (changeddlb != 1)
        {
            //alert(L"1");
            HTREEITEM h = tv_1.GetSelectedItem();
            KXMLDOMElement& e = *(KXMLDOMElement*)tv_1.GetItemData(h);
            xstring t = e.selectSingleNode(L"@type").text();
            m_sType = t + L"";
            xstring txt = e.selectSingleNode(L"@code").text();
            if (txt == L"")
                txt = e.selectSingleNode(L"@name").text();
            m_sTypeTxt = txt + L"";
            //alert(m_sTypeTxt);
            PIndex = 1;
            OnRetrieve();
        }
        return 1;
    }
    int createSubTree(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 = tv_1.InsertChildItem(h, name, (LPARAM)e, 15);
                createSubTree(hw, *e);
            }
        return 1;
    }
    int OnCreateTree(xstring sType)
    {
        while (tv_1.GetRootItem())
            tv_1.DeleteItem(tv_1.GetRootItem());
        xml x;
        xaserverarg arg;
        arg.AddArg(L"sType", sType);
        //Tree.pref.supplier.xq
        //getUrl(GetEntityName(1)+L"/entity/list",arg.GetString(),x);
        //if (xaserver::ExecXQuery(GetServerUrl(),L"[Tree.pref.supplier.xq]",arg.GetString(),x)!=1)
        if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/pref/list/tree", arg.GetString(), x) != 1)
        {
            trace(x.text());
            return -1;
        }
        else
        {
            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 hw = tv_1.InsertChildItem(0, name, (LPARAM)e, 15);
                    createSubTree(hw, *e);
                    tv_1.ExpandItem(hw);
                }
                tv_1.ExpandItem(0);
            }
        }
        return 1;
    }
    //xcombobox下拉
    int OnSelectDdlb(TEvent evt, LPARAM p)
    {
        changeddlb = 1;
        int CB_GETCURSEL = 0x0147;
        int nIndex = SendMessageW(ddlb_1.GetHWND(), CB_GETCURSEL, 0, 0);
        KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement();
        KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring((nIndex + 1)) + L"]");
        xstring text = e2.selectSingleNode(L"@element").text();
        OnCreateTree(text);
        changeddlb = 0;
        return 1;
    }
    int OnDeleteRow()
    {
        int row = listwin::dw_list.GetNextSelectRow(1);
        if (row < 1) {
            row = listwin::dw_list.GetRow();
            if (row < 1) {
                //win::MessageBox(GetHWND(),L"请选中要删除的行!",L"提示",0);
                return -1;
            }
        }
        KXMLDOMElement e = listwin::dw_list.GetRowElement(row);
        //xstring sguid = e.SelectSingleNode(L"@guid").text;
        //xstring sName = e.selectSingleNode(L"Name").text+L"";
        xstring sguid = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID");
        xstring sName = dw_list.GetItemString(dw_list.GetRow(), L"Name");
        int  MB_YESNO = 0x00000004;
        int  IDYES = 6;
        if (MessageBoxW(GetHWND(), L"确认要删除供应商 " + sName + L" çš„信息吗?", L"提示", MB_YESNO) != IDYES) return 1;
        xml x;
        xaserverarg arg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg(L"guid", sguid);
        arg.AddArg(L"EntityID", sguid);
        //    trace(sguid);
        if (xurl::post(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/delete", arg.GetString(), x) != 1)
        {
            xstring error = x.text();
            trace(error);
        }
        else
        {
            KXMLDOMElement msg = x.selectNodes(L"process").item(0);
            xstring success = msg.selectSingleNode(L"@finished").text();
            if (success == L"0")
            {
                alert(msg.selectSingleNode(L"@errInfo").text());
            }
            else
            {
                MessageBoxW(GetHWND(), L"删除成功!", L"提示", 0);
                listwin::dw_list.DeleteRow(row);
            }
        }
        return 1;
    }
    int OnRowChangedEx(TEvent* evt, LPARAM p)
    {
        DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh;
        int row = hdr.row;
        //if(row < 1 or row > dw_list.GetRowCount()) return 1;
        KXMLDOMElement ele = listwin::dw_list.GetRowElement(row);
        xstring entity = ele.selectSingleNode(L"SupplierID").text();
        xml x;
        xaserverarg arg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg(L"EntityID", entity);
        xstring no1 = publiccode::GetUser().no;
        if (no1 != L"00201")
        {
            if (TypeWork.find(L"采购") >= 0)
            {
                GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritemEx";
            }
            else
            {
                GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem";
            }
        }
        else
        {
            GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem";
        }
        if (getUrl(GetServerUrl(), GoodsUrl, arg.GetString(), x) != 1)
        {
            trace(x.text());
            return -1;
        }
        else
        {
            dw_goods.Retrieve(x);
            dw_goods.Redraw();
            dw_goods.SetReadOnly(true);
        }
        SetAgent(L"list", entity);
        return 1;
    }
    int GridSearch()
    {
        //alert(L"你好");
#if 0
        xstring m_config = L"view.Supplier.v3.config";
        xdwgrid dw = listwin::dw_list;
        xaserverarg& arg = *new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        xstring str = TFile::node(m_config, L"config", L"search");
        if (str != L"") {
            arg.AddArg(L"sheet", str);
        }
        else
            arg.AddArg(L"sheet", L"dev:sheet[Supplier.v3.tpl/list]");
        arg.AddArg(L"search", listwin::m_QueryTxt);
        openUrl(L"view.dlg.vface/xpage/grid/column/search", &arg);
        xstring ok = arg.GetArgString(L"return");
        if (ok == L"ok") {
            xstring txt = arg.GetArgString(L"search");
            if (txt != L"") {
                listwin::m_QueryTxt = txt;
                //trace(txt);
                OnRetrieve();
            }
        }
#endif
        return 0;
    }
    int OnSelectAllRow()
    {
        int rows = listwin::dw_list.GetRowCount();
        if (rows < 1) return -1;
        listwin::dw_list.SelectRow(1, rows, true);
        listwin::dw_list.Redraw();
        return 1;
    }
    int OnRClick(TEvent evt, LPARAM p)
    {
        return 1;
    }
    int OnLogOff()
    {
        return 1;
    }
    int OnChecked()
    {
        xstring partyno = dw_list.GetItemString(dw_list.GetRow(), L"PartyNo");
        if (partyno.find(L"N") < 0)
        {
            alert(L"已经是正式供应商");
            return 0;
        }
        xstring entityid = GetEntityID(dw_list.GetRow());
        int MB_OKCANCEL = 1;
        int IDOK = 1;
        int ret = MessageBoxW(GetHWND(), L"是否转成正式供应商?", L"提示", MB_OKCANCEL);
        if (ret == IDOK)
        {
            xml x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/updateno", L"entityid", entityid);
            if (xstring(x.xml()).find(L"success") > 0)
            {
                alert(L"处理成功");
                OnRetrieve();
            }
        }
        return 1;
    }
    int PreOnCmdDispatch(xstring comdid)
    {
        //alert(comdid);
        if (comdid.find(L"action:LogOff", 0) >= 0) return OnLogOff();
        if (comdid.find(L"action:bill.delete", 0) >= 0)
        {
            OnDeleteRow();
            return 0;
        }
        if (comdid == L"action:search1") return GridSearch();
        if (comdid == L"action:bill.refresh")
        {
            return OnRetrieve();
        }
        if (comdid == L"action:bill.xmSaveAs")
        {
            xstring  userno = publiccode::GetUser().no;
            if (userno == L"00701" || userno == L"00601" || userno == L"admin")
            {
                dw_list.SaveAs(L"");
            }
            return 1;
        }
        if (comdid == L"action:bill.Annex")
        {
            xaserverarg& arg = *new xaserverarg;
            arg.setNativePointer(arg.CreateInstance());
            arg.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"));
            arg.AddArg(L"ApplyStatus", dw_list.GetItemString(dw_list.GetRow(), L"ApplyStatus"));
            OpenWindow(L"dev:xpage[maint.Document.Supplier.v3.vx]", (LPARAM)&arg);
            return 1;
        }
        if (comdid == L"action:bill.AnnexEx")
        {
            xaserverarg& arg4 = *new xaserverarg;
            arg4.setNativePointer(arg4.CreateInstance());
            arg4.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"));
            //arg4.AddArg(L"ApplyStatus",dw_list.GetItemString(dw_list.GetRow(),L"ApplyStatus"));
            //OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", p4);
            OpenWindow(L"dev:xpage[maint.Document.SupplierSD.v3.vx]", (LPARAM)&arg4);
            return 1;
        }
        if (comdid == L"action:bill.checked")
            return OnChecked();
        //    if(comdid==L"action:bill.import") return OnImport();
        //    if(comdid.find(L"action:",0)>=0) return ProcessFlowAction(comdid,1);
            //if(comdid==L"search") return GridSearch(L"view.dlg.vface/xpage/grid/column/edit");
            //if(comdid==L"showall")     return ShowAll();
        return 1;
    }
    int PostOnAttachEvent()
    {
        //获得树的选择事件
        AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listSupplierv3::OnTreeSelChanged);
        AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listSupplierv3::OnSelectDdlb);
        AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listSupplierv3::OnChangePages);
        AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&listSupplierv3::OnRClick);//鼠标右键
        return 1;
    }
    int onload()
    {
        PIndex = 1;
        listwin::m_QueryTxt = L""; //查询条件
        m_sType = L""; //type
        m_sTypeTxt = L""; //选中树的data
        listwin::onload();
        tv_1 = GetControl(L"tv_1");
        ddlb_1 = GetControl(L"cbx_1");
        changeddlb = 0;
        OnCreateTree(L"GoodsCates");
        dw_list.SetColumnState(L"SupplierID", false);
        dw_list.SetColumnState(L"userNo", false);
        dw_list.SetColumnState(L"YearEstablished", false);
        dw_list.SetColumnState(L"LegalPerson", false);
        dw_list.SetColumnState(L"ThirdPartyReport", false);
        dw_list.SetColumnState(L"bAddress", false);
        dw_list.SetColumnState(L"PayType", false);
        dw_list.SetColumnState(L"PicPath", false);
        dw_list.SetColumnState(L"SDID", false);
        dw_list.SetColumnState(L"AdvantageProduct", false);
        //dw_list.SetColumnState(L"ApplyStatus",false);
        dw_goods = GetControl(L"dw_goods");
        dw_goods.openUrl(GetServerUrl(), L"/sale/view/SupplierV3/template/supplier/supplieritem");
        if (publiccode::GetUser().name != L"admin")
        {
            xstring s = publiccode::GetUser().id;
            xml supplier_x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s);
            if (supplier_x)
            {
                TypeWork = supplier_x.text();
                if (TypeWork.find(L"采购") >= 0)
                {
                    dw_list.SetColumnState(L"DateEx", false);
                    dw_list.SetColumnState(L"DateExS", false);
                    dw_list.SetColumnState(L"Name", false);
                    dw_list.SetColumnState(L"ProvinceCode", false);
                    dw_list.SetColumnState(L"City", false);
                    dw_list.SetColumnState(L"District", false);
                    dw_list.SetColumnState(L"Address", false);
                    dw_list.SetColumnState(L"CName", false);
                    dw_list.SetColumnState(L"TEL", false);
                    dw_list.SetColumnState(L"Mob", false);
                    dw_list.SetColumnState(L"AreaCode", false);
                    dw_list.SetColumnState(L"Fax", false);
                    dw_goods.SetColumnState(L"Price", false);
                    dw_goods.SetColumnState(L"PackRMBPrice", false);
                    dw_goods.SetColumnState(L"PartRMBPrice", false);
                    dw_goods.SetColumnState(L"PaperRMBPrice", false);
                    dw_goods.SetColumnState(L"ETD", false);
                    dw_goods.SetColumnState(L"InvoiceNo", false);
                }
            }
        }
        return 1;
    }
    int onloaded()
    {
        AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&listSupplierv3::OnRowChangedEx);
        listwin::onloaded();
        xstring EntityID;
        int row = dw_list.GetRow();
        if (row<0 || row>dw_list.GetRowCount()) return 1;
        KXMLDOMElement ele = dw_list.GetRowElement(row);
        xstring id = listwin::m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text();
        if (ele.selectSingleNode(id))
            EntityID = ele.selectSingleNode(id).text();
        listwin::SetAgent(L"list", EntityID);
        return 1;
    }
};
jrj/project/start.vframe.vbusiness.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,119 @@
#include "xcontrol/xreport.hpp"
#include "wobject/xwin.hpp"
#include "wobject/xaserverarg.hpp"
#include "wobject/xstring.hpp"
#include "wobject/xurl.hpp"
#include "xcontrol/xshtml.hpp"
class __declspec(dllexport) startvframevbusiness: public xwin
{
public:
    xreport dw_list;
public:
    startvframevbusiness(void* implPtr,HWND hWnd):xwin(implPtr,hWnd){}
public:
    static startvframevbusiness * CreateInstance(void* implPtr,void* hWnd)
    {
        startvframevbusiness* pWin = new startvframevbusiness(implPtr,(HWND)hWnd);
        return pWin;
    }
public:
    int OnCmdDispatch(const wchar_t* comd)
    {
        //alert(comd);
        return 0;
    }
    int OnXCommand(TEvent* evt,int p)
    {
        return OnCmdDispatch(evt->xcommand.pStrID);
    }
    int ShowDetail(int row)
    {
        if(row<0 || row>dw_list.GetRowCount()) return 1;
        if(!dw_list.GetRowElement(row)) return 1;
        Hxsoft::XFrame::KXMLDOMElement ele = dw_list. GetRowElement(row);
        //alert(ele.xml());
        dw_list.SetRow(row);
        string EntityID=ele.getAttribute(L"EntityID");
        if(!EntityID || !EntityID[0]) return -1;
        //SetAgent("letter",GetEntityID(1));
        xaserverarg arg;
        arg.AddArg(L"content",ele.xml());
        Hxsoft::XFrame::KXMLDOMDocument doc;
         if(xurl::get(GetServerUrl(),L"/sale/data/vpage/vstart/task",arg.GetString(),doc)!=1)
        {
            alert(((xstring)L"error:"+doc.xml()).c_str());
            return 0;
        }
        //alert(doc.xml());
        xshtml ht(GetControl(L"taskinfo"));
        ht.SetContent(doc.xml());
        ht.Redraw();
        return 1;
    }
    //#include <tchar.h>
    int OnClicked(TEvent* evt,int p)
    {
       DWNMHDR*  hdr = (DWNMHDR*)evt->notify.pnmh;
       int row = hdr->row;
       if(row<1 || row>dw_list.GetRowCount()) return 1;
       ShowDetail(row);
       //SetAgent();
        return 1;
    }
    int init()
    {
        xaserverarg arg;
        KXMLDOMDocument doc;
        if(xurl::get(GetServerUrl(),L"/sale/data/vpage/vstart/list",arg.GetString(),doc)!=1)
        {
            alert(((xstring)L"error:"+doc.xml()).c_str());
            return 0;
        }
        if(!doc.xml()) return 0;
        dw_list.Retrieve(doc);
        dw_list.CreateTree((LPCWSTR)L"node()", 1, 15, 16);
        /*
        dw_list.Redraw();
        dw_list.SetReadOnly(true);
        */
        return 1;
    }
    int OnAttachListon()
    {
        AttachEvent(L"WM_XCOMMAND",(FEvent)&startvframevbusiness::OnXCommand,this);
        AttachEvent(L"tasklist",L"DWV_CLICKED",(FEvent)&startvframevbusiness::OnClicked,this);
        //AttachEvent("mdilayer", "LYSN_SELECTEDSHEET",OnSheetChanged);
        ////AttachEvent("mdilayer", "LYSN_CLOSESHEET",OnCloseSheet);
        return 1;
    }
    int onload()
    {
        dw_list = GetControl(L"tasklist");
        init();
        OnAttachListon();
        return 1;
    }
};
jrj/project/viewobject/customer.view.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
#pragma once
#include <wobject/xstring.hpp>
#include <wobject/xaserverarg.hpp>
#include <win32/win.hpp>
#include <vbusiness/vutil/publiccode.vutil.vbusiness.hpp>
#include <wobject/xurl.hpp>
#include <xcontrol/xdwgrid.hpp>
#include <xcontrol/xdwtable.hpp>
#include "view.base.hpp"
class CustomerView: public ViewObject
{
public:
    static string GetEntityName(int pr)
    {
        return L"CustomerV3";
    }
};
jrj/project/viewobject/productlibrary.view.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,85 @@
#pragma once
#include <wobject/xstring.hpp>
#include <wobject/xaserverarg.hpp>
#include <win32/win.hpp>
#include <vbusiness/vutil/publiccode.vutil.vbusiness.hpp>
#include <wobject/xurl.hpp>
#include <xcontrol/xdwgrid.hpp>
#include <xcontrol/xdwtable.hpp>
#include <view.base.hpp>
class ProductLibraryView: public ViewObject
{
public:
    //form
    static KXMLDOMDocument  GetMaintListForm(string no)
    {
        return RetrieveData(L"/sale/data/ProductLibrary/maint/listform",L"refno",no);
    }
public:
    static KXMLDOMDocument  GetMaintList(string no)
    {
        return RetrieveData(L"/sale/data/ProductLibrary/data/list",L"parent",no);
    }
    //读取树的子项
    static KXMLDOMDocument  GetTreeChildItems(string sno)
    {
        return RetrieveData(L"/sale/data/ProductLibrary/ChildFolderList",L"no",sno);
    }
public:
    //删除商品项
    static int DeleteItem(string id)
    {
        //if(RetrieveData(L"/sale/data/SO/goods/usegoods/delete",L"guid",id)) return 1;
        string str = "<Item update.modify='1' update.delete='1' guid='"+id+L"'/>";
        if(RetrieveData(L"/sale/data/ProductLibrary3/update/product",L"content",str)) return 1;
        return -1;
    }
public:
    xml  GetGoodsPropList(string guid)
    {
        return RetrieveData(L"/sale/data/SO/goods/goodsprop/list",L"guid", guid);
    }
public:
    //form
    static KXMLDOMDocument  GetMaintListForm3(string CategoryID)
    {
        return RetrieveData(L"/sale/data/ProductLibrary3/maint/listform",L"CategoryID",CategoryID);
    }
    //读取树的子项
    static KXMLDOMDocument  GetTreeChildItems3(string CategoryID)
    {
        return RetrieveData(L"/sale/data/ProductLibrary3/ChildFolderList",L"CategoryID",CategoryID);
    }
    //读取树的子项
    static KXMLDOMDocument  GetTreeUserChildItems3(string CategoryID)
    {
        //return RetrieveData(L"/sale/data/ProductLibrary3/User/ChildFolderList",L"CategoryID",CategoryID);
        return RetrieveData(L"/sale/data/ProductLibrary3/User/ChildFolderList",L"CategoryID",CategoryID);
    }
    static KXMLDOMDocument  GetMaintList3(string CategroyID)
    {
        return RetrieveData(L"/sale/data/ProductLibrary3/data/list",L"CategoryID",CategroyID);
    }
    static KXMLDOMDocument  GetMaintList3(string CategroyID,string QueryText,string QueryArg)
    {
        return RetrieveData(L"/sale/data/ProductLibrary3/data/listex",L"CategoryID",CategroyID,L"QueryText",QueryText,L"QueryArg",QueryArg);
    }
    static KXMLDOMDocument  GetMaintRoleList3(string CategroyID)
    {
        return RetrieveData(L"/sale/data/ProductLibrary3/role/data/list",L"CategoryID",CategroyID);
    }
    static KXMLDOMDocument  GetMaintRoleList3(string CategroyID,string QueryText)
    {
        return RetrieveData(L"/sale/data/ProductLibrary3/role/data/listex",L"CategoryID",CategroyID,L"QueryText",QueryText);
    }
};
jrj/project/viewobject/purchaseorder.view.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,113 @@
#pragma once
#include <wobject/xstring.hpp>
#include <wobject/xaserverarg.hpp>
#include <win32/win.hpp>
#include <vbusiness/vutil/publiccode.vutil.vbusiness.hpp>
#include <wobject/xurl.hpp>
#include <xcontrol/xdwgrid.hpp>
#include <xcontrol/xdwtable.hpp>
#include <view.base.hpp>
class PurchaseOrderView: public ViewObject
{
public:
    static string GetEntityName(int pr)
    {
        return "PurchaseOrder";
    }
    //模拟-采购订单页面信息
    static KXMLDOMDocument GetSimulationView(string SONo)
    {
        KXMLDOMDocument x = MakeXml();
        xaserverarg arg = MakeArg( L"sono", SONo);
        if(url::get( L"/sale/data/"+GetEntityName(1)+ L"/simulation/view/FullView", arg.GetString(),x)!=1)
        {
            string error = x.GetXmlDoc().text;
            win32::alert(error);
        }
        return x;
    }
    //模拟- é‡‡è´­è®¢å•列表
    static KXMLDOMDocument GetSimulationPOList(string SONo)
    {
        KXMLDOMDocument x = MakeXml();
        xaserverarg arg = MakeArg( L"sono", SONo);
        if(url::get( L"/sale/data/"+GetEntityName(1)+ L"/simulation/view/polist", arg.GetString(),x)!=1)
        {
            string error = x.GetXmlDoc().text;
            win32::alert(error);
        }
        return x;
    }
    //模拟- é‡‡è´­è®¢å•html
    static KXMLDOMDocument GetSimulationPOhtcontent(string PONo)
    {
        KXMLDOMDocument x = MakeXml();
        xaserverarg arg = MakeArg( L"pono", PONo);
        if(url::get( L"/sale/data/"+GetEntityName(1)+ L"/simulation/view/pohtcontent", arg.GetString(),x)!=1)
        {
            string error = x.GetXmlDoc().text;
            win32::alert(error);
        }
        return x;
    }
    //Form
    //采购订单-主信息维护
    static KXMLDOMDocument GetMaintFormForBase()
    {
        return FecthData( L"/sale/data/"+GetEntityName(1)+ L"/maint/form/base", L"");
    }
    //采购订单-Item å•†å“ç»´æŠ¤
    static KXMLDOMDocument GetMaintFormForItemList()
    {
        return FecthData( L"/sale/data/"+GetEntityName(1)+ L"/maint/form/item/list", L"");
    }
    //采购订单-Line å•†å“è¡Œç»´æŠ¤
    static KXMLDOMDocument GetMaintFormForLineList()
    {
        return FecthData( L"/sale/data/"+GetEntityName(1)+ L"/maint/form/line/list", L"");
    }
    //Data
    //数据:采购订单-主信息
    static KXMLDOMDocument GetMaintDataForBase(string EntityID)
    {
        xaserverarg arg = MakeArg( L"id", EntityID);
        return FecthData( L"/sale/data/"+GetEntityName(1)+ L"/maint/data/base", arg.GetString());
    }
    //数据:采购订单 Item -产品数据
    static KXMLDOMDocument GetMaintDataForItemList(string EntityID)
    {
        xaserverarg arg = MakeArg( L"id", EntityID);
        return FecthData( L"/sale/data/"+GetEntityName(1)+ L"/maint/data/item", arg.GetString());
    }
    //数据:采购订单 Line -产品数据
    static KXMLDOMDocument GetMaintDataForLineList(string EntityID)
    {
        xaserverarg arg = MakeArg( L"id", EntityID);
        return FecthData( L"/sale/data/"+GetEntityName(1)+ L"/maint/data/line", arg.GetString());
    }
    //独立采购:商品选择FormList
    static KXMLDOMDocument GetAloneFormItemList()
    {
        return FecthData( L"/sale/data/"+GetEntityName(1)+ L"/alone/form/item/list", L"");
    }
    //独立采购:保存
    static int UpdateAlonePO(xaserverarg arg)
    {
        KXMLDOMDocument x = MakeXml();
        if(url::get( L"/sale/data/"+GetEntityName(1)+ L"/update/alone", arg.GetString(),x)!=1)
        {
            xstring error = x.GetXmlDoc().text;
            alert( L"err...:"+arg.GetString());
            return 1;
        }else
            //alert(x.GetXml());
            alert( L"保存成功!");
        return 1;
    }
};
jrj/project/viewobject/quote.view.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,70 @@
#include  "view.base.hpp"
using xml = KXMLDOMDocument;
class QuoteView : public ViewObject
{
public:
    static KXMLDOMDocument GetSimulationView(string QuoteNo)
    {
        xaserverarg arg = MakeArg(L"QuoteNo", QuoteNo);
        return FecthData(L"/sale/data/Quote/fullview", arg.GetString());
    }
public:
    //主信息维护
    static KXMLDOMDocument GetMaintFormForBase()
    {
        return FecthData(L"/sale/data/Quote/maint/form/base", L"");
    }
    //商品维护列表
    static KXMLDOMDocument GetMaintFormForItemList()
    {
        return FecthData(L"/sale/data/Quote/maint/form/item/list", L"");
    }
    //商品维护商品细节
    static KXMLDOMDocument GetMaintFormForItemDetail()
    {
        return FecthData(L"/sale/data/Quote/maint/form/item/detail", L"");
    }
    static KXMLDOMDocument GetMaintFormForItemDetail(string guid)
    {
        xaserverarg arg = MakeArg(L"guid", guid);
        return FecthData(L"/sale/data/Quote/goods/maint/form", arg.GetString());
    }
public:
    //主信息
    static KXMLDOMDocument GetMaintDataForBase(string No)
    {
        xaserverarg arg = MakeArg(L"id", No);
        return FecthData(L"/sale/data/Quote/maint/base", arg.GetString());
    }
    //产品数据
    static KXMLDOMDocument GetMaintFormForItemList(string No)
    {
        xaserverarg arg = MakeArg(L"id", No);
        return FecthData(L"/sale/data/Quote/maint/item", arg.GetString());
    }
    static KXMLDOMDocument LookupProductsByText(string str)
    {
        return RetrieveData(xapp::GetServerUrl(),L"/sale/data/Quote/lookup/products", L"str", str);
    }
    static KXMLDOMDocument Oncopy(string EnquiryID, string ItemID)
    {
        return RetrieveData(xapp::GetServerUrl(), L"/sale/data/Enquiry/Oncopy", L"EnquiryID", EnquiryID, L"ItemID", ItemID);
    }
    static KXMLDOMDocument LookupProductsByText(string str, string customerid)
    {
        return RetrieveData(xapp::GetServerUrl(), L"/sale/data/Quote/lookup/productsex", L"str", str, L"CustomerID", customerid);
    }
    static string MakeBillNo()
    {
        xml x = RetrieveData(xapp::GetServerUrl(), L"/sale/data/Quote/makebillno");
        return x.text();
    }
};
jrj/project/viewobject/saleorder.view.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,143 @@
#pragma once
#include <wobject/xstring.hpp>
#include <wobject/xaserverarg.hpp>
#include <win32/win.hpp>
#include <vbusiness/vutil/publiccode.vutil.vbusiness.hpp>
#include <wobject/xurl.hpp>
#include <xcontrol/xdwgrid.hpp>
#include <xcontrol/xdwtable.hpp>
#include "view.base.hpp"
class SaleOrderView: public ViewObject
{
public:
    //订单模拟页面信息
    static KXMLDOMDocument GetSimulationView(string SONo)
    {
        xaserverarg arg = MakeArg(L"SONo", SONo);
        return FecthData(L"/sale/data/SaleOrder/simulation/view", arg.GetString());
    }
    //订单主信息维护
    static  KXMLDOMDocument GetMaintFormForBase()
    {
        return FecthData(L"/sale/data/SaleOrder/maint/form/base",L"");
    }
    //订单商品维护列表
    static  KXMLDOMDocument GetMaintFormForItemList()
    {
        return FecthData(L"/sale/data/SaleOrder/maint/form/item/list", L"");
    }
    //订单商品维护商品细节
    static  KXMLDOMDocument GetMaintFormForItemDetail()
    {
        return FecthData(L"/sale/data/SaleOrder/maint/form/item/detail", L"");
    }
    static  KXMLDOMDocument GetMaintFormForItemDetail(string guid)
    {
        xaserverarg arg = MakeArg(L"guid", guid);
        return FecthData(L"/sale/data/SO/goods/maint/form", arg.GetString());
    }
    //订单执行情况跟踪表
    static  KXMLDOMDocument GetReportSOTrack(string SONo)
    {
        xaserverarg arg = MakeArg(L"id", SONo);
        return FecthData(L"/sale/data/SaleOrder/report/sotrack", arg.GetString());
    }
    //订单执行情况跟踪表
    static  KXMLDOMDocument GetReportSOTrackHtml(string SONo)
    {
        xaserverarg arg = MakeArg(L"id", SONo);
        return FecthData(L"/sale/data/SaleOrder/report/sotrack/html", arg.GetString());
    }
public:
    //订单主信息
    static  KXMLDOMDocument GetMaintDataForBase(string SONo)
    {
        xaserverarg arg = MakeArg(L"id", SONo);
        return FecthData(L"/sale/data/SaleOrder/maint/base", arg.GetString());
    }
    //订单产品数据
    static  KXMLDOMDocument GetMaintFormForItemList(string SONo)
    {
        xaserverarg arg = MakeArg(L"id", SONo);
        return FecthData(L"/sale/data/SaleOrder/maint/item", arg.GetString());
    }
    static  KXMLDOMDocument GetContractsList(string PartyID)
    {
        xaserverarg arg = MakeArg(L"PartyID", PartyID);
        return FecthData(L"/sale/data/PurchaseOrder/so/ContactsSelect", arg.GetString());
    }
    //订单产品数据
    static  KXMLDOMDocument GetMaintFormForItemListForPO(string SONo)
    {
        xaserverarg arg = MakeArg(L"id", SONo);
        return FecthData(L"/sale/data/SaleOrder/maint/item/forpo", arg.GetString());
    }
    static  KXMLDOMDocument GetMaintFormForItemListForPO2(string SONo,string SOLineID)
    {
        xaserverarg arg = MakeArg(L"id", SONo);
        arg.AddArg(L"solineid", SOLineID);
        return FecthData(L"/sale/data/SaleOrder/maint/item/forpo2", arg.GetString());
    }
    //订单未出运产品数据
    static  KXMLDOMDocument GetItemListForGDN(string SONo,string CustomerID)
    {
        xaserverarg arg = MakeArg(L"id", SONo);
        arg.AddArg(L"CustomerID", CustomerID);
        return FecthData(L"/sale/data/SaleOrder/maint/gdnitem", arg.GetString());
    }
    static  KXMLDOMDocument NewObject(string SONo, string CustomerID, string Content)
    {
        return RetrieveData(L"/sale/data/SaleOrder/newobject", L"sono", SONo, L"CustomerID", CustomerID, L"content", Content);
    }
    static  KXMLDOMDocument UpdateObject(string Content)
    {
        return RetrieveData(L"/sale/data/SaleOrder/update/so", L"content", Content);
    }
    static  KXMLDOMDocument GetCustomerSOHabit(string CustomerID)
    {
        return RetrieveData(L"/sale/data/SaleOrder/habit/socustomer", L"CustomerID", CustomerID);
    }
    static string MakeBillNo()
    {
        KXMLDOMDocument x = RetrieveData(L"/sale/data/SaleOrder/makebillno");
        return x.text();
    }
    static string GetSOIDByLineID(string SOLineID)
    {
        KXMLDOMDocument x = RetrieveData(L"/sale/data/SaleOrder/GetSOIDByLineID", L"SOLineID",SOLineID);
        return x.text();
    }
    static string GetSONoByLineID(string SOLineID)
    {
        KXMLDOMDocument x = RetrieveData(L"/sale/data/SaleOrder/GetSONoByLineID", L"SOLineID",SOLineID);
        return x.text();
    }
    static string GetSOID(string SONo)
    {
        KXMLDOMDocument x = RetrieveData(L"/sale/data/SaleOrder/GetSOID", L"SONo",SONo);
        return x.text();
    }
    static string GetSONo(string SOID)
    {
        KXMLDOMDocument x = RetrieveData(L"/sale/data/SaleOrder/GetSONo", L"SOID",SOID);
        return x.text();
    }
};
jrj/project/viewobject/shoppingcart.view.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,56 @@
#pragma once
#include <wobject/xstring.hpp>
#include <wobject/xaserverarg.hpp>
#include <win32/win.hpp>
#include <vbusiness/vutil/publiccode.vutil.vbusiness.hpp>
#include <wobject/xurl.hpp>
#include <xcontrol/xdwgrid.hpp>
#include <xcontrol/xdwtable.hpp>
#include <view.base.hpp>
class ShoppingCartView: public ViewObject
{
public:
    //购物车列表
    static KXMLDOMDocument  GetRoleList()
    {
        return RetrieveData(L"/sale/data/ProductLibrary/shoppingcart/rolelist");
    }
    static KXMLDOMDocument  GetRoleList(string CustomerID)
    {
        return RetrieveData(L"/sale/data/ProductLibrary3/shoppingcart/rolelistex",L"CustomerID",CustomerID);
    }
    static KXMLDOMDocument  GetSupplierRoleList(string SupplierID)
    {
        return RetrieveData(L"/sale/data/ProductLibrary3/shoppingcart/supplier.rolelist",L"SupplierID",SupplierID);
    }
    static KXMLDOMDocument  GetRoleListForSO(string CustomerID)
    {
        return RetrieveData(L"/sale/data/ProductLibrary3/shoppingcart/so/rolelistex",L"CustomerID",CustomerID);
    }
    static KXMLDOMDocument  GetGoodsList(string name)
    {
        return RetrieveData(L"/sale/data/ProductLibrary/shoppingcart/goodslist",L"name",name);
    }
    static KXMLDOMDocument  GetGoodsList(string name,string QueryText)
    {
        return RetrieveData(L"/sale/data/ProductLibrary3/shoppingcart/goodslistex",L"name",name,L"QueryText",QueryText);
    }
    int AddCar(string name)
    {
        if(RetrieveData(L"/sale/data/SO/goods/goodscar/add",L"name",name)) return 1;
        return -1;
    }
    int GoodsImport(string name,string content)
    {
        if(RetrieveData(L"/sale/data/ProductLibrary/shoppingcart/import",L"name",name,L"content",content)) return 1;
        return -1;
    }
};
jrj/project/viewobject/supplier.view.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
#pragma once
#include <wobject/xstring.hpp>
#include <wobject/xaserverarg.hpp>
#include <win32/win.hpp>
#include <vbusiness/vutil/publiccode.vutil.vbusiness.hpp>
#include <wobject/xurl.hpp>
#include <xcontrol/xdwgrid.hpp>
#include <xcontrol/xdwtable.hpp>
#include <view.base.hpp>
class SupplierView: public ViewObject
{
public:
    static string GetEntityName(int pr)
    {
        return L"SupplierV3";
    }
};
jrj/project/viewobject/view.base.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,298 @@
#pragma once
#include <wobject/xstring.hpp>
#include <wobject/xaserverarg.hpp>
#include <win32/win.hpp>
#include <vbusiness/vutil/publiccode.vutil.vbusiness.hpp>
#include <wobject/xurl.hpp>
#include <xcontrol/xdwgrid.hpp>
#include <xcontrol/xdwtable.hpp>
#include <wobject/xapp.hpp>
class ViewObject
{
public:
    static int alert(HWND hWnd,string error)
    {
        return MessageBoxW(hWnd, error, L"提示", 0);
    }
    static int alert(string error)
    {
        return alert(nullptr, error);
    }
    static int trace(string error)
    {
        return 1;
    }
    static xaserverarg MakeArg(string argName, string argValue)
    {
        xaserverarg arg;
        arg.AddArg(argName, argValue);
        return arg;
    }
    static xaserverarg MakeArg(string argName, string argValue, string argName1, string argValue1)
    {
        xaserverarg arg;
        arg.AddArg(argName, argValue);
        arg.AddArg(argName1, argValue1);
        return arg;
    }
    string GetGuid()
    {
        return publiccode::GetGuid();
    }
    //获取行元素的值
    xstring GetElementString(KXMLDOMElement e, xstring name)
    {
        if (name == L"") return L"";
        if (e.selectSingleNode(name))
            return e.selectSingleNode(name).text();
        else
            return L"";
    }
    string GetElementString(KXMLDOMElement e, xstring name, bool isdisplay)
    {
        if (isdisplay) name += L"/@_displaystring";
        return GetElementString(e, name);
    }
    static  KXMLDOMDocument RetrieveData(string queryUrl)
    {
        return RetrieveData(xapp::GetServerUrl(), queryUrl);
    }
    static  KXMLDOMDocument RetrieveData(string serverUrl,string queryUrl)
    {
        KXMLDOMDocument x;
        if (xurl::get(serverUrl,queryUrl, L"", x) != 1)
        {
            string error = x.text();
            trace(error);
            return 0;
        }
        return x;
    }
    static  KXMLDOMDocument RetrieveData( string queryUrl, string argName, string argValue)
    {
        return RetrieveData(xapp::GetServerUrl(), queryUrl, argName, argValue);
    }
    static  KXMLDOMDocument RetrieveData(string serverUrl, string queryUrl, string argName, string argValue)
    {
        KXMLDOMDocument x;
        xaserverarg arg;
        arg.AddArg(argName, argValue);
        if (xurl::get(serverUrl,queryUrl, arg.GetString(), x) != 1)
        {
            string error = x.text();
            trace(error);
            return 0;
        }
        return x;
    }
    static   KXMLDOMDocument RetrieveData(string queryUrl, string argName, string argValue, string argName1, string argValue1)
    {
        return RetrieveData(xapp::GetServerUrl(), queryUrl, argName, argValue, argName1, argValue1);
    }
    static   KXMLDOMDocument RetrieveData(string serverUrl, string queryUrl, string argName, string argValue, string argName1, string argValue1)
    {
        KXMLDOMDocument x;
        xaserverarg arg;
        arg.AddArg(argName, argValue);
        arg.AddArg(argName1, argValue1);
        if (xurl::get(serverUrl, queryUrl, arg.GetString(), x) != 1)
        {
            string error = x.text();
            trace(error);
            return 0;
        }
        return x;
    }
    static   KXMLDOMDocument RetrieveData(string queryUrl, string argName, string argValue, string argName1, string argValue1, string argName2, string argValue2)
    {
        return RetrieveData(xapp::GetServerUrl(), queryUrl, argName, argValue, argName1, argValue1, argName2, argValue2);
    }
    static   KXMLDOMDocument RetrieveData(string serverUrl, string queryUrl, string argName, string argValue, string argName1, string argValue1, string argName2, string argValue2)
    {
        KXMLDOMDocument x;
        xaserverarg arg;
        arg.AddArg(argName, argValue);
        arg.AddArg(argName1, argValue1);
        arg.AddArg(argName2, argValue2);
        if (xurl::get(serverUrl, queryUrl, arg.GetString(), x) != 1)
        {
            string error = x.text();
            trace(error);
            return 0;
        }
        return x;
    }
    static KXMLDOMDocument RetrieveData(string queryUrl, string argName, string argValue, string argName1, string argValue1, string argName2, string argValue2, string argName3, string argValue3)
    {
        return RetrieveData(xapp::GetServerUrl(), queryUrl, argName, argValue, argName1, argValue1, argName2, argValue3, argName2, argValue3);
    }
    static KXMLDOMDocument RetrieveData(string serverUrl, string queryUrl, string argName, string argValue, string argName1, string argValue1, string argName2, string argValue2, string argName3, string argValue3)
    {
        KXMLDOMDocument x;
        xaserverarg arg;
        arg.AddArg(argName, argValue);
        arg.AddArg(argName1, argValue1);
        arg.AddArg(argName2, argValue2);
        arg.AddArg(argName3, argValue3);
        if (xurl::get(serverUrl, queryUrl, arg.GetString(), x) != 1)
        {
            string error = x.text();
            trace(error);
            return 0;
        }
        return x;
    }
    static KXMLDOMDocument FecthData(string pUrl, string argStr)
    {
        KXMLDOMDocument x;
        if (xurl::get(xapp::GetApp()->GetServerUrl(), pUrl, argStr, x) != 1)
        {
            xstring error = x.text();
            trace(L"\r\nError fetch data:" + error + L"\r\nurl:=" + pUrl);
        }
        return x;
    }
    static KXMLDOMDocument FecthData(string serverUrl,string pUrl, string argStr)
    {
        KXMLDOMDocument x;
        if (xurl::get(serverUrl,pUrl, argStr, x) != 1)
        {
            xstring error = x.text();
            trace(L"\r\nError fetch data:" + error + L"\r\nurl:=" + pUrl);
        }
        return x;
    }
    static xstring AskNo(string serverUrl,string typ)
    {
        KXMLDOMDocument x;
        xaserverarg arg = MakeArg(L"type", typ);
        if (xurl::get(serverUrl,L"/sale/data/Util/askno", arg.GetString(), x) != 1)
        {
            string error = x.text();
            alert(error);
            return L"";
        }
        string no = x.text();
        return no;
    }
    static int TransData(string serverUrl,KXMLDOMNodeList nlist, xdwtable dwobj, int row, string column, string data)
    {
        int len = nlist.length();
        for (int i = 0; i < len; i++)
        {
            KXMLDOMElement e = nlist.item(i);
            string dataurl = e.getAttribute(L"dataurl");
            xstring columns = e.getAttribute(L"columns");
            string arg = e.getAttribute(L"arg");
            KXMLDOMDocument x = RetrieveData(serverUrl,dataurl, arg, data);
            if (!x) continue;
            xstring it;
            while (columns != L"")
            {
                if (columns.find(L",") > 0)
                {
                    it = columns.left(columns.find(L","));
                    columns = columns.mid(columns.find(L",") + 1, 9999);
                }
                else
                {
                    it = columns;
                    columns = L"";
                }
                KXMLDOMNode n = x.selectSingleNode(L"//" + it);
                if (n)
                {
                    dwobj.SetItemString(row, it.c_str(), xstring(n.text()).trim());
                }
                n = x.selectSingleNode(L"//" + it + L"/@_displaystring");
                if (n)
                {
                    dwobj.SetItemDisplayString(row, it.c_str(), xstring(n.text()).trim());
                }
            }
        }
        dwobj.Redraw();
        return 1;
    }
    static int TransData(string serverUrl, KXMLDOMNodeList nlist, xdwgrid dwobj, int row, string column, string data)
    {
        int len = nlist.length();
        for (int i = 0; i < len; i++)
        {
            KXMLDOMElement e = nlist.item(i);
            string dataurl = e.getAttribute(L"dataurl");
            xstring columns = e.getAttribute(L"columns");
            string arg = e.getAttribute(L"arg");
            KXMLDOMDocument x = RetrieveData(serverUrl, dataurl, arg, data);
            if (!x) continue;
            xstring it;
            while (columns != L"")
            {
                if (columns.find(L",") > 0)
                {
                    it = columns.left(columns.find(L","));
                    columns = columns.mid(columns.find(L",") + 1, 9999);
                }
                else
                {
                    it = columns;
                    columns = L"";
                }
                KXMLDOMNode n = x.selectSingleNode(L"//" + it);
                if (n)
                {
                    dwobj.SetItemString(row, it.c_str(), xstring(n.text()).trim());
                }
                n = x.selectSingleNode(L"//" + it + L"/@_displaystring");
                if (n)
                {
                    dwobj.SetItemDisplayString(row, it.c_str(), xstring(n.text()).trim());
                }
            }
        }
        dwobj.Redraw();
    }
    int AddMessage(string serverUrl, string Category, string Reciever, string EntityNo, string EntityID, string Subject, string Content)
    {
        KXMLDOMDocument x;
        xaserverarg arg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg(L"EntityNo", EntityNo);
        arg.AddArg(L"EntityID", EntityID);
        arg.AddArg(L"Subject", Subject);
        arg.AddArg(L"Category", Category);
        arg.AddArg(L"Reciever", Reciever);
        arg.AddArg(L"Content", Content);
        if (xurl::get(serverUrl,L"/sale/data/business/message/add", arg.GetString(), x) != 1)
        {
            string error = x.text();
            trace(error);
            return 0;
        }
        return 1;
    }
};
jrj/project/vindexform.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,180 @@

#pragma once
#include "xcontrol/xdwtable.hpp"
#include "xcontrol/xdwgrid.hpp"
#include "wobject/xwin.hpp"
#include "wobject/xstring.hpp"
#include "wobject/xaserverarg.hpp"
#include "wobject/xaserver.hpp"
#include "xcontrol/xcombobox.hpp"
#include "xcontrol/xlayersheet.hpp"
class __declspec(dllexport) vindexform: public xwin
{
public:
    string m_Assignment;
    HWND m_hMenu;
    xlayersheet mainsheet;
    xcombobox cbx_menu;
    xcombobox cbx_panelName;
    xcombobox cbx_panelNo;
    xcombobox cbx_tab;
public:
    vindexform(void* implPtr,HWND hWnd):xwin(implPtr,hWnd){}
public:
    static vindexform * CreateInstance(void* implPtr,void* hWnd)
    {
        vindexform* pWin = new vindexform(implPtr,(HWND)hWnd);
        return pWin;
    }
public:
    int OnDWClick(TEvent* evt, int p)
    {
        alert(L"clicked");
        return 1;
    }
    int OnMenu(HWND hMenu)
    {
        if (!hMenu)
        {
            HWND hw = m_hMenu;
            bool f = IsWindow(hw);
            if (hw == 0 && f <= 0)
            {
                xaserverarg* arg = new xaserverarg();
                HWND hWnd = GetHWND();
                arg->SetParam(L"hwnd", (LPARAM)hWnd);
                arg->SetParam(L"memuId", (LPARAM)cbx_menu.getNativePointer());
                arg->SetParam(L"tabNo", (LPARAM)cbx_tab.getNativePointer());
                arg->SetParam(L"panelNo", (LPARAM)cbx_panelNo.getNativePointer());
                arg->SetParam(L"panelName", (LPARAM)cbx_panelName.getNativePointer());
                xwin* pwin=OpenWindow(L"dev:xpage[vindexmenu.vx]", (LPARAM)arg);
                m_hMenu = pwin->GetHWND();
                hw = m_hMenu;
                //return 1;
            }
            HWND HWND_TOPMOST = (HWND) - 1;
            HWND HWND_NOTOPMOST =(HWND)-2;
            int SWP_NOSIZE = 0x0001;
            int SWP_NOMOVE = 0x0002;
            int SWP_SHOWWINDOW = 0x0040;
            SetWindowPos(hw, HWND_TOPMOST, -1000, -1000, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
        }
        else
        {
            m_hMenu = hMenu;
        }
        xrect xr;
        xcontrol xc = GetControl(L"xmMenu");
        GetWindowRect(xc.GetHWND(), xr);
        int l = xr.left;
        int b = xr.bottom;
        xrect r;
        xc = GetControl(L"split");
        GetWindowRect(xc.GetHWND(), r);
        int t2 = r.top;
        int b2 = r.bottom;
        MoveWindow(m_hMenu, l - 7, b, 220, b2 - t2, false);
        return 1;
    }
    int OnCmdDispatch(xstring comdid)
    {
        if (comdid == L"xmMenu") OnMenu(0);
        //else if (comdid.find(L"menuid:", 0) >= 0)
        //    return OnMenu((HWND)comdid.mid(comdid.find(L":", 0) + 1, comdid.length()).toInt());
#if 0
        if (comdid ==L "xmAssignment") OnChangeLogin();
        else if (comdid == L"xmAllCaption") OnAllCaption();
        else if (comdid == L"xmMenu") OnMenu(L"");
        else if (comdid == L"xmHelp") return OnHelp();
        else if (comdid.find("menuid:", 0) >= 0) OnMenu(comdid.mid(comdid.find(":", 0) + 1, comdid.length()));
        else if (comdid.find("menuAgent:", 0) >= 0) OnMenuAgent(comdid.mid(comdid.find(":", 0) + 1, comdid.length()));
        else if (comdid.find("changesheet:", 0) >= 0) OnChangeSheet(comdid.mid(comdid.find(":", 0) + 1, comdid.length()));
        else if (comdid.find("openforoldid:", 0) >= 0) OnOpenForOld(comdid.mid(comdid.find(":", 0) + 1, comdid.length()));
        else if (comdid.find("open:", 0) >= 0) OnOpen(comdid.mid(comdid.find(":", 0) + 1, comdid.length()));
        else if (comdid == "xmRefreshTask")
        {
            SendMessage(m_startwin, 0x401, comdid, 0);
            return 1;
        }
#endif
        return 0;
    }
    int OnXCommand(TEvent* evt,int p)
    {
        return OnCmdDispatch(evt->xcommand.pStrID);
    }
    int OnAttachListon()
    {
        AttachEvent(L"WM_XCOMMAND",(FEvent)&vindexform::OnXCommand,this);
        //AttachEvent("mdilayer", "LYSN_SELECTEDSHEET",OnSheetChanged);
        ////AttachEvent("mdilayer", "LYSN_CLOSESHEET",OnCloseSheet);
        return 1;
    }
    int SetUserID()
    {
        Hxsoft::XFrame::KXMLDOMDocument x;
        xaserverarg arg;
        arg.AddArg(L"Assignment", m_Assignment);
        if(xaserver::ExecXQuery(GetServerUrl(),L"[GetSysInfo.xq]",arg.GetString(),x)!=1)
        {
            trace(x.xml());
            return -1;
        }
        if((xstring)x.xml() == L"") return -1;
        Hxsoft::XFrame::KXMLDOMElement e = x.documentElement();
        if((xstring)m_Assignment == L"" && e.selectSingleNode(L"AssignmentID"))
        {
            string sInfoEx = e.selectSingleNode(L"AssignmentID").text();
            m_Assignment = sInfoEx;
        }
        if((xstring)m_Assignment == L"")
            alert(L"获取用户数据失败,请重新登录!");
        else
            xaserver::SetUID((LPWSTR)m_Assignment);
        return 1;
    }
    int Initial()
    {
        SetUserID();
        return 1;
    }
    int onload()
    {
        m_hMenu = 0;
        m_Assignment = L"";
        mainsheet = GetControl(L"mdilayer");
        cbx_menu = GetControl(L"memuId");
        cbx_tab = GetControl(L"tabNo");
        cbx_panelNo = GetControl(L"panelNo");
        cbx_panelName = GetControl(L"panelName");
        Initial();
        OnAttachListon();
        OpenWindow(L"dev:xpage[start.vframe.vbusiness.vx]");
        return 1;
    }
};
jrj/project/vindexmenu.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,516 @@
#include "xcontrol/xdwgrid.hpp"
#include "xcontrol/xdwtable.hpp"
#include "wobject/xwin.hpp"
#include "wobject/xstring.hpp"
#include "wobject/xaserverarg.hpp"
#include "wobject/xaserver.hpp"
#include "xcontrol/xtreeview.hpp"
#include "xcontrol/xcombobox.hpp"
#include "xcontrol/xlayersheet.hpp"
#include "wobject/xutil.hpp"
#include "wobject/xnode.hpp"
#include "platform/nstring.hpp"
class __declspec(dllexport) vindexmenu: public xwin
{
public:
    xtreeview tv_menu;
    xtreeview tv_menu1;
    xtreeview tv_menu2;
    xlayersheet mainfolder;
    xcombobox cbx_menu;
    xcombobox cbx_panelName;
    xcombobox cbx_panelNo;
    xcombobox cbx_tab;
    int m_bCanDestroy;
    HWND m_nHwnd;
    int tabNo;
    //int m_panelNo; // å½“前菜单组
    string m_Assignment;
public:
    vindexmenu(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {}
public:
    static vindexmenu* CreateInstance(void* implPtr, void* hWnd)
    {
        vindexmenu* pWin = new vindexmenu(implPtr, (HWND)hWnd);
        return pWin;
    }
    int OnHideWin()
    {
        int nIndex = cbx_menu.GetCurSel();
        if(nIndex == 0) return 0;
        HWND HWND_NOTOPMOST= ((HWND)-2);
        int SWP_NOSIZE = 0x0001;
        int SWP_NOMOVE = 0x0002;
        int SWP_HIDEWINDOW = 0x0080;
        SetWindowPos(GetHandle(), HWND_NOTOPMOST, -1000,-1000,0,0,SWP_NOSIZE | SWP_HIDEWINDOW);
        return 1;
    }
    int OnActive(TEvent* evt,int p)
    {
        int WA_INACTIVE   =  0;
        int WA_ACTIVE     =  1;
        int WA_CLICKACTIVE = 2;
        int SW_HIDE=0x1;
        WPARAM lw = evt->wParam & 0xffff;
        int x = m_bCanDestroy;
        if( lw ==WA_INACTIVE && x==1 )
        {
            //CloseWindow();
            //xwin::ShowWindow(this.GetHWND(), SW_HIDE);
            OnHideWin();
            return 1;
        }
        if(lw !=WA_INACTIVE) m_bCanDestroy = 1;
        return 1;
    }
    int createPanel()
    {
        KXMLDOMDocument x ;
        xaserverarg arg;
        arg.AddArg(L"pid",L"null");
        arg.AddArg(L"Assignment", m_Assignment);
        if(xaserver::ExecXQuery(GetServerUrl(),L"[Menu.index.xq]",arg.GetString(),x)!=1)
        {
            //trace(x.xml());
            return -1;
        }
        Hxsoft::XFrame::KXMLDOMNodeList li=x.selectNodes(L"items/item");
        int i=0;
        long s=li.length();
        for (i=0;i<s;i++)
        {
            KXMLDOMElement xitem= li.item(i);
            void * p = new KXMLDOMElement(xitem);
            int k = cbx_panelName.AddItem(xstring(i).c_str());
            cbx_panelName.SetItemData(k, (LPARAM)p);
        }
        return 1;
    }
    int GetCurPanel()
    {
        return  cbx_panelName.GetCurSel();
    }
    int createTree(string id, HTREEITEM parentItem)
    {
        if(tv_menu.GetChildItem(parentItem)) return 0;
        KXMLDOMDocument x;
        xaserverarg arg;
        arg.AddArg(L"pid",id);
        arg.AddArg(L"Assignment", m_Assignment);
        if(xaserver::ExecXQuery(GetServerUrl(),L"[Menu.index.xq]",arg.GetString(),x)!=1)
        {
            trace(x.xml());
            return -1;
        }
        KXMLDOMNodeList li=x.selectNodes(L"items/item");
        int i=0;
        int s=li.length();
        KXMLDOMElement xitem;
        for (i=0;i<s;i++)
        {
            xitem= li.item(s - i - 1);
            string xid = xitem.selectSingleNode(L"id").text();
            string Name=xitem.selectSingleNode(L"name").text();
            string image = L"15";
            if(xitem.selectSingleNode(L"image")) image=xitem.selectSingleNode(L"image").text();
            HTREEITEM hBeforItem = 0;
            HTREEITEM curItem=tv_menu.InsertItem(parentItem,hBeforItem,Name,(LPARAM)xid,xstring(image).toInt());
            string child=xitem.selectSingleNode(L"@child").text();//item.getAttribute("HasChild");
            if ((xstring)child != L"0")
                tv_menu.SetItemChild1(curItem,1);
        }
        return 1;
    }
    int createTreeBase(xtreeview& tv_item, KXMLDOMDocument x)
    {
        KXMLDOMNodeList li=x.selectNodes(L"items/item");
        int i=0;
        int s=li.length();
        KXMLDOMElement xitem;
        for (i=0;i<s;i++)
        {
            xitem= li.item(s - i - 1);
            string id =xitem.selectSingleNode(L"id").text();
            string Name=xitem.selectSingleNode(L"name").text();
            xstring image(L"15");
            if(xitem.selectSingleNode(L"image")) image=xitem.selectSingleNode(L"image").text();
            HTREEITEM curItem=tv_item.InsertItem(0,0,Name, (LPARAM)id, image.toInt());
        }
        return 1;
    }
    int createTree1()
    {
        HTREEITEM rItem = tv_menu1.GetRootItem();
        while(rItem)
        {
            tv_menu1.DeleteItem(rItem);
            rItem = tv_menu1.GetRootItem();
        }
        KXMLDOMDocument x ;
        xaserverarg arg;
        if(xaserver::ExecXQuery(GetServerUrl(),L"[menu.user.list.xq]",arg.GetString(),x)!=1)
        {
            trace(x.xml());
            return -1;
        }
        createTreeBase(tv_menu1, x);
        return 1;
    }
    int OnTreeExpanding(TEvent* evt,int p)
    {
        NMTREEVIEW* nmtv =  (NMTREEVIEW*)evt->notify.pnmh;
        HTREEITEM sitem = nmtv->itemNew.hItem;
        string id = (string)tv_menu.GetItemData(sitem);
        HCURSOR hCursor = xutil::SetCursorWait();
        createTree(id, sitem);
        xutil::RestoreCursor(hCursor);
        return 1;
    }
    bool rClick(string str)
    {
        HMENU m = CreatePopupMenu();
        int MF_STRING = 0x00000000;
        int TPM_RIGHTBUTTON = 0x0002;
        int TPM_RETURNCMD = 0x0100;
        AppendMenuW(m,MF_STRING, 1, str);
        xrect xr = { 0,0,0,0 };
        xpoint pt;
        GetCursorPos(pt);
        return TrackPopupMenu (m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, this->GetHandle(), xr);
    }
    int OnRClicked(TEvent* evt,int p)
    {
        TVNNMHDR* nmtv = (TVNNMHDR*)evt->notify.pnmh;
        HTREEITEM hItem = nmtv->FromItem;
        if(hItem == 0) return 1;
        int hasChild = tv_menu.GetItemChild1(hItem);
        if(hasChild > 0) return 1;
        int ret = rClick(L"收藏菜单");
        if(ret == 1)
        {
            string id = (string)tv_menu.GetItemData(hItem);
            KXMLDOMDocument x;
            xaserverarg arg;
            arg.AddArg(L"id",id);
            arg.AddArg(L"flag",L"insert");
            if(xaserver::ExecXQuery(GetServerUrl(),L"[menu.user.edit.xq]",arg.GetString(),x)!=1)
            {
                trace(x.xml());
                //alert("收藏失败!");
                return -1;
            }
            createTree1();
        }
        return 1;
    }
    int dbClick(xtreeview& tid, HTREEITEM hItem)
    {
        HCURSOR hCursor = xutil::SetCursorWait();
        string id = (string)tid.GetItemData(hItem);
        string label = tid.GetItemLabel(hItem);
        KXMLDOMDocument x;
        xaserverarg* arg = new xaserverarg();
        arg->AddArg(L"id",id);
        if(xaserver::ExecXQuery(GetServerUrl(),L"[Maint.menu.index.xq]",arg->GetString(),x)!=1)
        {
            trace(x.xml());
            return -1;
        }
        if((xstring)x.xml()==L"") return -1;
        KXMLDOMElement e = x.documentElement();
        //alert(x.xml);
        int nIndex =cbx_menu.FindString(label);
        if(e.selectSingleNode(L"ModuelMore") && nIndex > - 1)
        {
            string mo = e.selectSingleNode(L"ModuelMore").text();
            if((xstring)mo != L"Y")
            {
                xstring comd = L"changesheet:"+xstring(nIndex);
                SendMessage(m_nHwnd, 0x401, (LPARAM)comd.c_str(), 0);
                OnHideWin();
                return 0;
            }
        }
        if(e.selectSingleNode(L"ModuelPage")) {} else return -1;
        cbx_menu.AddItem(label);
        int sheets = cbx_menu.GetCount();
        cbx_tab.AddItem(xstring(sheets - 1).c_str());
        xstring  vx = e.selectSingleNode(L"ModuelPage").text();
        if((xstring)vx == L"") return -1;
        bool hasArg = false;
        if(e.selectSingleNode(L"ModuelParam/args"))
        {
            KXMLDOMNodeList li=e.selectNodes(L"ModuelParam/args/arg");
            int i=0;
            long s=li.length();
            KXMLDOMElement xitem;
            if(s>0) hasArg = true;
            for (i=0;i<s;i++)
            {
                xitem= li.item(i);
                string name = xitem.selectSingleNode(L"@name").text();
                string value=xitem.selectSingleNode(L"@value").text();
                arg->AddArg(name, value);
            }
        }
        //if(xaserver::GetUserNo() == "admin")
        //    alert("000");
        SetFocus(m_nHwnd);
        if(vx.find(L".vx",0)>0 || vx.find(L".xpage",0)>0)
            OpenWindow((L"dev:xpage["+vx+L"]").c_str(), (LPARAM)arg);
        else
            openUrl(vx, arg);
        OnHideWin();
        xutil::RestoreCursor(hCursor);
        return 1;
    }
    int OnDbClick(TNotifyEvent& evt,int p)
    {
        HTREEITEM hItem = tv_menu.GetSelectedItem();
        dbClick(tv_menu, hItem);
        return 1;
    }
    int SetInitAgent()
    {
        int no = GetCurPanel();
        xnode anode(GetAgentNode(L"mainmemu"));
        int p =0;
        string id=nullptr;
        int h = cbx_panelNo.FindString(xstring(no).c_str());
        if(h < 0)
        {
            int i = 0;
            int s = cbx_panelName.GetCount();
            xstring toolStr = L"<vbox>";
            for (i=0;i<s;i++)
            {
                LPARAM pa = cbx_panelName.GetItemData(i);
                if (!pa)return 1;
                KXMLDOMElement& hData = *(KXMLDOMElement*)pa;
                string Name= hData.selectSingleNode(L"name").text();
                string Image = L"15";
                if(hData.selectSingleNode(L"image")) Image=hData.selectSingleNode(L"image").text();
                xstring str = (xstring)L"<xtoolbutton image='"+Image+L"' caption='"+Name+L"' height='24' name='xmPanel:"+xstring(i).c_str() + L"' style='background-color:none #ceecce none #ffffff;text-align:left'/>";
                if(i == no)
                {
                    id = hData.selectSingleNode(L"id").text();
                    str +=  (xstring)L"<vbox><xtree imagelist='0' name='panelTree"+xstring(no)+ L"'/></vbox>";
                    //AttachEvent("panelTree"+no.toString(),"TVN_SELCHANGED",OnTreeSelChanged);
                    xstring panelTree = L"panelTree"+xstring(no);
                    AttachEvent(nstring::clone(panelTree.c_str()),L"TVN_ITEMEXPANDING", (FEvent)&vindexmenu::OnTreeExpanding);
                    AttachEvent(nstring::clone(panelTree.c_str()),L"TVN_RCLICK", (FEvent)&vindexmenu::OnRClicked);
                    AttachEvent(nstring::clone(panelTree.c_str()),L"NM_DBLCLK", (FEvent)&vindexmenu::OnDbClick);
                }
                toolStr += str;
            }
            toolStr += L"</vbox>";
            //alert(toolStr);
            xnode bnode = this->SetAgentNode(anode,toolStr);
            int k = cbx_panelNo.AddItem(xstring(no).c_str());
            cbx_panelNo.SetItemData(k, (LPARAM)bnode.GetNativePtr());
        }
        else
        {
            xnode dnode((void*)cbx_panelNo.GetItemData(h));
            SetAgentNode(anode,dnode);
        }
        tv_menu = xtreeview(GetControl(L"panelTree"+(xstring)no));
        if(h < 0 && (xstring)id != L"") createTree(id, 0);
        return 1;
    }
    int OnQuery()
    {
        xcontrol xc = GetControl(L"editQuery");
        xstring str = xc.GetText();
        if(str.isEmpty())
        {
            alert(L"请输入查询条件!");
            return -1;
        }
        HTREEITEM rItem = tv_menu2.GetRootItem();
        while(rItem)
        {
            tv_menu2.DeleteItem(rItem);
            rItem = tv_menu2.GetRootItem();
        }
        KXMLDOMDocument x;
        xaserverarg arg;
        arg.AddArg(L"query",str.c_str());
        if(xaserver::ExecXQuery(GetServerUrl(),L"[menu.user.query.xq]",arg.GetString(),x)!=1)
        {
            trace(x.xml());
            return -1;
        }
        createTreeBase(tv_menu2,x);
        return 1;
    }
    int OnMenuAgent()
    {
        string s = L"menuAgent:Y";
        SendMessage(m_nHwnd, 0x401, (LPARAM)s, 0);
        OnHideWin();
        return 1;
    }
    int OnChangePanel(xstring&& xno)
    {
        int pno = GetCurPanel();
        if(pno == xno.toInt())
            cbx_panelName.SetCurSel(-1);
        else
            cbx_panelName.SetCurSel(xno.toInt());
        SetInitAgent();
        return 1;
    }
    int OnCmdDispatch(xstring&& comdid)
    {
        if (comdid == L"xmAll")    mainfolder.SelectSheet(0);
        else if (comdid == L"xmFav") mainfolder.SelectSheet(1);
        else if (comdid == L"xmQue") mainfolder.SelectSheet(2);
        else if (comdid == L"xmQuery") OnQuery();
        else if (comdid == L"xmMenuAgent") OnMenuAgent();
        else if(comdid.left(8) == L"xmPanel:") OnChangePanel(comdid.mid(8, 99));
        return 0;
    }
    int OnXCommand(TEvent *evt,int p)
    {
        return OnCmdDispatch(evt->xcommand.pStrID);
    }
    int OnDbClick1(TNotifyEvent* evt,int p)
    {
        //ref TVNNMHDR nmtv = evt.pnmh;
        //int hItem = nmtv.FromItem;
        HTREEITEM hItem = tv_menu1.GetSelectedItem();
        dbClick(tv_menu1, hItem);
        return 1;
    }
    int OnDbClick2(TNotifyEvent* evt,int p)
    {
        //ref TVNNMHDR nmtv = evt.pnmh;
        //int hItem = nmtv.FromItem;
        HTREEITEM hItem = tv_menu2.GetSelectedItem();
        dbClick(tv_menu2, hItem);
        return 1;
    }
    int OnRClicked1(TNotifyEvent* evt,int p)
    {
        TVNNMHDR& nmtv = *(TVNNMHDR*)evt->notify.pnmh;
        HTREEITEM hItem = nmtv.FromItem;
        if(!hItem) return 1;
        int ret = rClick(L"取消收藏");
        if(ret == 1)
        {
            string id = (string)tv_menu1.GetItemData(hItem);
            KXMLDOMDocument x;
            xaserverarg arg;
            arg.AddArg(L"id",id);
            arg.AddArg(L"flag",L"del");
            if(xaserver::ExecXQuery(GetServerUrl(),L"[menu.user.edit.xq]",arg.GetString(),x)!=1)
            {
                trace(x.xml());
                alert("取消失败!");
                return -1;
            }
            tv_menu1.DeleteItem(hItem);
        }
        return 1;
    }
    int OnAttachEvent()
    {
        AttachEvent(L"WM_XCOMMAND",(FEvent)&vindexmenu::OnXCommand);
        AttachEvent(L"WM_ACTIVATE",(FEvent)&vindexmenu::OnActive);
        AttachEvent(L"menu1", L"TVN_RCLICK",(FEvent)&vindexmenu::OnRClicked1);
        AttachEvent(L"menu1", L"NM_DBLCLK",(FEvent)&vindexmenu::OnDbClick1);
        AttachEvent(L"menu2", L"NM_DBLCLK",(FEvent)&vindexmenu::OnDbClick2);
        return 1;
    }
    int OnInitial()
    {
        if(GetParam())
        {
            xaserverarg& arg = *(xaserverarg*)GetParam();
            m_nHwnd = (HWND)arg.GetParam(L"hwnd");
            cbx_menu = (void*)arg.GetParam(L"memuId");
            cbx_tab = (void*)arg.GetParam(L"tabNo");
            cbx_panelNo = (void*)arg.GetParam(L"panelNo");
            cbx_panelName = (void*)arg.GetParam(L"panelName");
            xstring s = L"menuid:"+xstring((LPARAM)GetHWND());
            SendMessage(m_nHwnd, 0x401, (LPARAM)s.c_str(), 0);
        }
        return 1;
    }
    int onload()
    {
        m_bCanDestroy = 1;
        tv_menu1 = GetControl(L"menu1");
        tv_menu2 = GetControl(L"menu2");
        mainfolder = GetControl(L"mainFolder");
        int GWL_STYLE = -16;
        int WS_CAPTION =  0x00C00000;
        int style = GetWindowLong(GetHWND(), GWL_STYLE);
        style = style - WS_CAPTION;
        SetWindowLong(GetHWND(), GWL_STYLE, style);
        OnInitial();
        OnAttachEvent();
        long n = cbx_panelNo.GetCount();
        return 1;
    }
    int onloaded()
    {
        HCURSOR hCursor = xutil::SetCursorWait();
        m_Assignment = xaserver::GetUID();
        createPanel();
        cbx_panelName.SetCurSel(-1);
        SetInitAgent();
        createTree1();
        xutil::RestoreCursor(hCursor);
        //this->Redraw();
        return 1;
    }
};
jrj/xframe/kobject/kapp.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
#pragma once
#include "kcontrol.hpp"
#include "kcachemgr.hpp"
namespace Hxsoft{namespace XFrame{
    class xfApp : public xbObject
    {
    public:
        int OnIdle(int nLevel);
        int Idle(DWORD dwTime);
    public:
        int InitApp();
        int ExitApp();
    public:
        int AddhWnd(HWND hWnd);
        int RemovehWnd(HWND hWnd);
    public:
        int XFrameStartUp(HINSTANCE hInstance,DWORD dwIcon,DWORD dwIconSm);
        int XFrameShutDown(HINSTANCE hInstance);
        HINSTANCE GetInstance();
    public:
        static xfApp * GetApp();
    public:
        const wchar_t* GetServerUrl();
    public:
        void InitObjectMgr();
    public:
        xfCacheMgr* GetCacheMgr();
    public:
        static int trace(LPCTSTR pstr);
    public:
        int Run();
    };
}}
jrj/xframe/kobject/kbase.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
#pragma once
#include "system/base.hpp"
#include "win32/win.hpp"
namespace Hxsoft{ namespace XFrame
{
    class IXPage;
    class IXNode;
    class ITrans{};
    class xbObject{};
    typedef struct tagEvent {} TEvent;
    typedef int    (* FEvent)(TEvent * pEvent,LPARAM  lParam);
}}
jrj/xframe/kobject/kcachemgr.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
#pragma once
#include "kcontrol.hpp"
namespace Hxsoft{namespace XFrame{
    class xfCacheMgr :public xbObject
    {
    public:
        int InsertCacheFile(LPTSTR pStrUrl, LPTSTR pCacheFile, DWORD ver = 0);
        LPCTSTR GetCacheFile(LPTSTR pStrUrl);
        DWORD GetCacheVersion(LPTSTR pStrUrl);
    public:
        void CacheObject(LPCTSTR pUrl, void* pObject);
        void* GetCacheObject(LPCTSTR pUrl);
    };
}}
jrj/xframe/kobject/kcontrol.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,42 @@
#pragma once
#include "kbase.hpp"
#include "kxml.hpp"
namespace Hxsoft{ namespace XFrame
{
    class IXFWin;
    class  IXFControl : public xbObject
    {
    public:
        HWND GetHWND();
    public:
        IXFWin* GetWindow();
    public:
        IXNode * GetXNode();
        KXMLDOMElement  GetElement();
    public:
        RECT & GetAreaRect();
        RECT & GetContentRect();
    public:
        int SetAreaRect(RECT & rc);
        int SetContentRect(RECT & rc);
    public:
        RECT  GetClientRect();
    public:
        int Redraw();
    public:
        int DoAcceptText();
        virtual int AcceptText(){return 0;};
    public:
        int SetStyle(DWORD dwStyle);
        int SetStyleEx(DWORD dwStyleEx);
    public:
        bool SetLayerFlow(LPCTSTR pFlow,bool bRedraw);
        bool SwitchLayer(LPTSTR pStrLayerSheet,LPTSTR pStrLayerFrame);
    public:
        xbObject * QueryItem(LPTSTR pItem);
    public:
        bool GetContentExtent(SIZE &sz);
    };
}}
jrj/xframe/kobject/kdwgrid.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,239 @@
#pragma once
#include "kcontrol.hpp"
#include "kdwview.hpp"
namespace Hxsoft{namespace XFrame{
    namespace XOffice {namespace XCell    {
        class IGridReport  : public IDwView
        {
        public:
            int GetRow_() ;//得到行
            int GetColumn_() ;//得到列
            int GetRowCount_() ; //得到行数
            int GetColumnCount_() ; //得到列数
        public:
            int SetRow_(int row) ;
        public:
            LPCTSTR GetNote_(int nRow, int nColumn) ;//得到备注
            bool SetNote_(int nRow, int nColumn, LPCTSTR pStrNote) ; //设置备注
            bool AddNote_(int nRow, int nColumn, LPCTSTR pStrNote, LPCTSTR pUser = NULL, LPCTSTR pData = NULL) ; //设置备注
            LPCTSTR GetNote1_(int nRow, int nColumn) ;//得到修改
            bool SetNote1_(int nRow, int nColumn, LPCTSTR pStrNote) ; //设置修改
            bool AddNote1_(int nRow, int nColumn, LPCTSTR pStrNote, LPCTSTR pUser = NULL, LPCTSTR pData = NULL) ; //设置修改
            LPCTSTR GetNote2_(int nRow, int nColumn) ;//得到批注
            bool SetNote2_(int nRow, int nColumn, LPCTSTR pStrNote) ; //设置批注
            bool AddNote2_(int nRow, int nColumn, LPCTSTR pStrNote, LPCTSTR pUser = NULL, LPCTSTR pData = NULL) ; //设置批注
        public:
            int InsertRow_(int nRow) ;//插入行
            int DeleteRow_(int nRow) ;//删除行
            int InsertRows_(int nRow, int nAmt) ;//插入多行
            int DeleteRows_(int nRow, int nAmt) ;//删除多行
        public:
            LPCTSTR GetColumnName_(int nColumn) ;//得到列名
            int GetColumnIndex_(LPCTSTR pColumn) ; //得到列号
        public:
            LPCTSTR GetItemString_(int nRow, int nColumn, DWBuffer dwBuffer = dbuf_normal) ;//得到数据值
            LPCTSTR GetItemString_(int nRow, LPCTSTR ColumnName, DWBuffer dwBuffer = dbuf_normal) ;//得到数据值
            bool SetItemString_(int nRow, int nColumn, LPCTSTR lptStr, DWBuffer dwBuffer = dbuf_normal) ;//设置数据值
            bool SetItemString_(int nRow, LPCTSTR ColumnName, LPCTSTR lptStr, DWBuffer dwBuffer = dbuf_normal) ;//设置数据值
        public:
            bool SetItemStatus_(int nRow, int nColumn, RowStatus status, DWBuffer dwBuffer = dbuf_normal) ;//设置行列状态
            RowStatus GetItemStatus_(int nRow, int nColumn, DWBuffer dwBuffer = dbuf_normal) ;//得到行列状态
        public:
            int    SetKeyValue_(int nRow, int nKeyValue) ;//设置整数关健值
            int GetKeyValue_(int nRow) ;//得到整数关健值
            bool GetGuid_(int nRow, TCHAR Guid[], int nMax) ;//设置guid
            bool SetGuid_(int nRow, LPCTSTR pStrGuid) ; //设置guid
        public:
            int SetReadOnly_(bool bReadOnly = true) ; //设置只读
        public:
            int SelectRow_(int nRow, bool bSelect = true) ;//选中单行
            int SelectRow_(int sRow, int eRow, bool bSelect = true) ;//选中多行
            int GetNextSelectRow_(int nStartRow) ; //得到下拉修改行
            bool IsRowSelected_(int nRow) ; //判断行是否被选种
            int SetSelectBkColor_(COLORREF color) ; //设置选择的背景颜色
            int SetSelectionMode_(int nMode) ; //设置选择的模式//0 unselection 1 singleSelection 2 multiselection 3 multiselectionex
        public:
            int    DeletedCount_() ; //得到删除行行数
            int    ModifiedCount_() ; //得到修改行行数
        public:
            int    Reset_() ; //清除数据
            int    ResetUpdateStatus_() ;//清除修改标记
        public:
            int  GetXml_(BSTR& bstr) ;//获取XML数据
            int  GetXml_(BSTR& bstr, LPCTSTR pGuid) ; //获取XML数据
            int Load_(KXMLDOMElement  pElement) ;//读取数据
            int  LoadXml_(BSTR bstr) ;//读取数据
        public:
            int ClearObserver_() ;//清除事件侦听对象
        public:
            int DwUpdateTo_(KXMLDOMDocument pXmlDoc) ;//把数据更新到XML对象中
            int DwUpdateAllTo_(KXMLDOMDocument  pXmlDoc) ;//把数据更新到XML对象中
        public:
            int Retrieve_(LPCTSTR pServer, LPCTSTR pDataUrl, LPCTSTR pArgStr) ;//读取数据
            int Retrieve_(ITrans* pTrans, LPCTSTR pDataUrl, LPCTSTR pArgStr) ;//读取数据
            int Retrieve_(LPCTSTR pDataUrl, LPCTSTR pArgStr) ;//读取数据
            int Retrieve_(KXMLDOMElement  pElement) ;//读取数据
            int Retrieve_(KXMLDOMDocument& xml) ;//读取数据
            int RetrieveEx_(LPCTSTR pServer, LPCTSTR pEntity, LPCTSTR pEntityKey) ;//读取数据
            int RetrieveEx_(ITrans* pTrans, LPCTSTR pEntity, LPCTSTR pEntityKey) ;//读取数据
            int RetrieveEx_(LPCTSTR pEntity, LPCTSTR pEntityKey) ;//读取数据
        public:
            int SetDataObject_(LPCTSTR pServer, LPCTSTR pUrl) ;//设置模板对象
            int SetDataObject_(ITrans* pTrans, LPCTSTR pUrl) ;//设置模板对象
            int SetDataObject_(LPCTSTR pUrl) ;//设置模板对象
            int SetDataObject_(KXMLDOMElement  pElement) ;//设置模板对象
            int SetDataObject_(KXMLDOMDocument  pDoc) ;
        public:
            int ImportFile_() ; //转入数据
            int ImportFile_(LPCTSTR pStrFile, LPCTSTR pType = NULL, bool Header = false) ; //转入数据
            int ImportString_(LPCTSTR pStr, LPCTSTR pType = NULL, bool Header = false) ; //转入文本数据
        public:
            int SetValues_(LPCTSTR pColName, LPCTSTR pExpr) ; //批量设置值
            int AddCalcColumn_(LPCTSTR pColName, LPCTSTR pExpr) ;//设置关联计算列
            int ClearCalcColumn_(LPCTSTR pColName = NULL) ;//清除关联计算列
        public:
            int GetNextModifyRow_(int nStart) ; //得到下一修改行
        public:
            int Modify_(LPCTSTR pStr) ; //语法修改
            int Evaluate_(int nRow, LPCTSTR pExpr) ; //评估表达式
        public:
            int SetAutoFilter_(bool bAutoFilter) ; //设置自动过滤
            int SetFilter_(LPCTSTR pStrFilter) ; //设置过滤条件
            int Filter_() ; //过滤
            int SetSort_(LPCTSTR pStrSort) ; //设置排序参数
            int Sort_() ; //排序
            int Find_(LPCTSTR pCondition = NULL) ; //查找
            int FindNext_() ; //查找
        public:
            int GetFirstVisibleRow_() ; //得到当前显示的第一行
            int Expand_(bool bExpand) ;//收缩或展开数据视图
        public:
            int Print_(LPCTSTR pXmlArg = NULL) ; //打印
            int PrintPreview_(LPCTSTR pXmlArg = NULL) ; //打印预览
        public:
            int SaveAs_(LPCTSTR pXmlArg = NULL) ; //另存为
            int SaveAs_(KXMLDOMDocument& xml, LPCTSTR pFileName = NULL); //另存为
            int SaveAsEx_() ; //整体另存为
            int SaveAsEx_(LPCTSTR pStrFile) ; //整体另存为
        public:
            LPTSTR GetColumnProps_(LPCTSTR pColName) ; //得到列整体XML属性
            int SetColumnProps_(LPCTSTR pColName, LPCTSTR pXmlProp) ; //设置列整体XML属性
            LPTSTR GetColumnProp_(LPCTSTR pColName, LPCTSTR pItem) ; //得到列属性
            int SetColumnProp_(LPCTSTR pColName, LPCTSTR pItem, LPCTSTR pProp) ;//设置列属性
            LPTSTR GetColumnProps_(int nCol) ; //得到列整体XML属性
            int SetColumnProps_(int nCol, LPCTSTR pXmlProp) ; //设置列整体XML属性
            LPTSTR GetColumnProp_(int nCol, LPCTSTR pItem) ; //得到列属性
            int SetColumnProp_(int nCol, LPCTSTR pItem, LPCTSTR pProp) ;//设置列属性
        public:
            int DataBI_(LPCTSTR pSchema = NULL) ;//数据BI分析
        public:
            int chart_(LPCTSTR pXmlArg = NULL) ;//图形
            //send event message
            int event_ItemFocusChanged_(int nRow, int nCol) ;
            int event_RowFocusChanged_(int nRow, int nOldRow) ;
            int event_GetFocus_() ;
            int event_LoseFocus_() ;
            int event_ItemChanged_(int nRow, int nCol, LPCTSTR pData) ;
            int event_ItemChanging_(int nRow, int nCol, LPCTSTR pData) ;
    public:
        int GetDwType_();
    public:
        int DwUpdateAllToEx(KXMLDOMDocument pXmlDoc);
    public:
        Hxsoft::XFrame::KXMLDOMElement  GetRowElement(int nRow);
    public:
        int InsertCol(int nCol, LPCTSTR pCaption, LPCTSTR pColName, int nWidth, LPCTSTR pColPath = NULL, LPCTSTR pStyleClass = NULL,
            LPCTSTR pEditClass = NULL, LPCTSTR pFormatClass = NULL);
        int RemoveCol(int nCol);
        int RemoveVCol(int nCol);
        int RemoveCol(LPCTSTR pColName);
        int AddEditStyle(LPCTSTR pName, LPCTSTR pStr);
        int RemoveEditStyle(LPCTSTR pName, LPCTSTR pStr);
        int SetColEditStyle(LPCTSTR pColName, LPCTSTR pClassName);
        int SetDDLBData(LPCTSTR pColName, LPCTSTR pData);
        LPCTSTR GetDDLBData(LPCTSTR pColName);
    public:
        LPTSTR GetColumnProp(int nCol, LPCTSTR pItem);
        LPTSTR GetColumnProp(LPCTSTR pColName, LPCTSTR pItem);
    public:
        int CreateTree(LPCTSTR pPath, int nCol, int nImage1, int nImage2);
        int GetContentRow(int nRow);
    public:
        int DwShareTo(IGridReport* pPrimaryReport);
    public:
        int SetAskStyle(bool bAskStyle);
        int CreateTreeEx(LPCTSTR pPath, int nCol, int nImage1, int nImage2);
    public:
        LPCTSTR GetItemDisplayString(int nRow, int nColumn, DWBuffer dwBuffer = dbuf_normal);
        LPCTSTR GetItemDisplayString(int nRow, LPCTSTR ColumnName, DWBuffer dwBuffer = dbuf_normal);
        bool SetItemDisplayString(int nRow, int nColumn, LPCTSTR lptStr, DWBuffer dwBuffer = dbuf_normal);
        bool SetItemDisplayString(int nRow, LPCTSTR ColumnName, LPCTSTR lptStr, DWBuffer dwBuffer = dbuf_normal);
        LPCTSTR GetItemTipString(int nRow, int nColumn, DWBuffer dwBuffer = dbuf_normal);
        LPCTSTR GetItemTipString(int nRow, LPCTSTR ColumnName, DWBuffer dwBuffer = dbuf_normal);
        bool SetItemTipString(int nRow, int nColumn, LPCTSTR lptStr, DWBuffer dwBuffer = dbuf_normal);
        bool SetItemTipString(int nRow, LPCTSTR ColumnName, LPCTSTR lptStr, DWBuffer dwBuffer = dbuf_normal);
    public:
        bool ItemChangeTo(int nRow, int nColumn, LPCTSTR lptStr, DWBuffer dwBuffer = dbuf_normal);
        bool ItemChangeTo(int nRow, LPCTSTR ColumnName, LPCTSTR lptStr, DWBuffer dwBuffer =dbuf_normal);
    public:
        int AllowSort(bool sort);
    public:
        int FindByColumn(int startRow, int columnIndex, LPCTSTR columnValue);
        int FindByColumn(int startRow, LPCTSTR column, LPCTSTR columnValue);
        int SetReadOnlyColumn(int columnIndex, bool flag = true);
        int SetReadOnlyColumn(LPCTSTR column, bool flag = true);
        int SetColumnWidth(int columnIndex, int width = 1);
        int SetColumnWidth(LPCTSTR column, int width = 1);
        int GetColumnWidth(int columnIndex);
        int GetColumnWidth(LPCTSTR column);
        int SetColumnState(int columnIndex, bool state);
        int SetColumnState(LPCTSTR column, bool state);
        void SetDataToClip(LPCTSTR DataStr);
        int AcceptText();
        int ShowRowTo(int row);
        int GetShowRow();
        LPCTSTR GetTitleName(int col);
    public:
        int SetRowSort(LPTSTR colName, bool colOrder = true);
        int SetClickEditFlag(bool f);
        int RedrawEx();
        bool SetRowMove(int row, int movecount);
        int GetTreeRow(int row);
        int GetTreeRowCount();
        int TreeRowExpand(int row, bool exp);
        int RetrieveDiff(KXMLDOMDocument& xml);//读取数据
        int Filter(LPTSTR pColumn, LPTSTR pStr);
    public:
        int SetHeaderText(int row, int col, LPTSTR name);
        int MoveColumnTo(int fromcolumn, int tocolumn);
    public:
        void SetEditUpperMode(bool upper);
        bool GetEditUpperMode();
    public:
        void ResetRepeats();
        void AddRepeats(wchar_t* colName);
        };
    }}
}}
jrj/xframe/kobject/kdwpages.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
#pragma once
#include "kcontrol.hpp"
namespace Hxsoft {namespace XFrame
{
    class  IXPages : public IXFControl
    {
    public:
        int SetMaxPage(int mpage);
        int SetCurPage(int cpage);
        int GetMaxPage();
        int GetCurPage();
    };
}}
jrj/xframe/kobject/kdwtable.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,244 @@
#pragma once
#include "kcontrol.hpp"
#include "kdwview.hpp"
namespace Hxsoft{namespace XFrame{
    namespace XOffice {namespace XCell    {
        class IDwTable : public IDwView
        {
        public:
            int GetRow_() ;//得到行
            int GetColumn_() ;//得到列
            int GetRowCount_() ; //得到行数
            int GetColumnCount_() ; //得到列数
        public:
            int SetRow_(int row) ;
        public:
            LPCTSTR GetNote_(int nRow, int nColumn) ;//得到备注
            bool SetNote_(int nRow, int nColumn, LPCTSTR pStrNote) ; //设置备注
            bool AddNote_(int nRow, int nColumn, LPCTSTR pStrNote, LPCTSTR pUser = NULL, LPCTSTR pData = NULL) ; //设置备注
            LPCTSTR GetNote1_(int nRow, int nColumn) ;//得到修改
            bool SetNote1_(int nRow, int nColumn, LPCTSTR pStrNote) ; //设置修改
            bool AddNote1_(int nRow, int nColumn, LPCTSTR pStrNote, LPCTSTR pUser = NULL, LPCTSTR pData = NULL) ; //设置修改
            LPCTSTR GetNote2_(int nRow, int nColumn) ;//得到批注
            bool SetNote2_(int nRow, int nColumn, LPCTSTR pStrNote) ; //设置批注
            bool AddNote2_(int nRow, int nColumn, LPCTSTR pStrNote, LPCTSTR pUser = NULL, LPCTSTR pData = NULL) ; //设置批注
        public:
            int InsertRow_(int nRow) ;//插入行
            int DeleteRow_(int nRow) ;//删除行
            int InsertRows_(int nRow, int nAmt) ;//插入多行
            int DeleteRows_(int nRow, int nAmt) ;//删除多行
        public:
            LPCTSTR GetColumnName_(int nColumn) ;//得到列名
            int GetColumnIndex_(LPCTSTR pColumn) ; //得到列号
        public:
            LPCTSTR GetItemString_(int nRow, int nColumn, DWBuffer dwBuffer = dbuf_normal) ;//得到数据值
            LPCTSTR GetItemString_(int nRow, LPCTSTR ColumnName, DWBuffer dwBuffer = dbuf_normal) ;//得到数据值
            bool SetItemString_(int nRow, int nColumn, LPCTSTR lptStr, DWBuffer dwBuffer = dbuf_normal) ;//设置数据值
            bool SetItemString_(int nRow, LPCTSTR ColumnName, LPCTSTR lptStr, DWBuffer dwBuffer = dbuf_normal) ;//设置数据值
        public:
            bool SetItemStatus_(int nRow, int nColumn, RowStatus status, DWBuffer dwBuffer = dbuf_normal) ;//设置行列状态
            RowStatus GetItemStatus_(int nRow, int nColumn, DWBuffer dwBuffer = dbuf_normal) ;//得到行列状态
        public:
            int    SetKeyValue_(int nRow, int nKeyValue) ;//设置整数关健值
            int GetKeyValue_(int nRow) ;//得到整数关健值
            bool GetGuid_(int nRow, TCHAR Guid[], int nMax) ;//设置guid
            bool SetGuid_(int nRow, LPCTSTR pStrGuid) ; //设置guid
        public:
            int SetReadOnly_(bool bReadOnly = true) ; //设置只读
        public:
            int SelectRow_(int nRow, bool bSelect = true) ;//选中单行
            int SelectRow_(int sRow, int eRow, bool bSelect = true) ;//选中多行
            int GetNextSelectRow_(int nStartRow) ; //得到下拉修改行
            bool IsRowSelected_(int nRow) ; //判断行是否被选种
            int SetSelectBkColor_(COLORREF color) ; //设置选择的背景颜色
            int SetSelectionMode_(int nMode) ; //设置选择的模式//0 unselection 1 singleSelection 2 multiselection 3 multiselectionex
        public:
            int    DeletedCount_() ; //得到删除行行数
            int    ModifiedCount_() ; //得到修改行行数
        public:
            int    Reset_() ; //清除数据
            int    ResetUpdateStatus_() ;//清除修改标记
        public:
            BSTR GetXml_(LPCTSTR pRoot, bool bIncludeChild) ; //获取XML数据
            int Load_(KXMLDOMElement  pElement) ;//读取数据
            int  LoadXml_(BSTR bstr) ;//读取数据
        public:
            int ClearObserver_() ;//清除事件侦听对象
        public:
            int DwUpdateTo_(KXMLDOMDocument pXmlDoc) ;//把数据更新到XML对象中
            int DwUpdateAllTo_(KXMLDOMDocument  pXmlDoc) ;//把数据更新到XML对象中
        public:
            int Retrieve_(LPCTSTR pServer, LPCTSTR pDataUrl, LPCTSTR pArgStr) ;//读取数据
            int Retrieve_(ITrans* pTrans, LPCTSTR pDataUrl, LPCTSTR pArgStr) ;//读取数据
            int Retrieve_(LPCTSTR pDataUrl, LPCTSTR pArgStr) ;//读取数据
            int Retrieve_(KXMLDOMElement  pElement) ;//读取数据
            int Retrieve_(KXMLDOMDocument& xml) ;//读取数据
            int RetrieveEx_(LPCTSTR pServer, LPCTSTR pEntity, LPCTSTR pEntityKey) ;//读取数据
            int RetrieveEx_(ITrans* pTrans, LPCTSTR pEntity, LPCTSTR pEntityKey) ;//读取数据
            int RetrieveEx_(LPCTSTR pEntity, LPCTSTR pEntityKey) ;//读取数据
        public:
            int SetDataObject_(LPCTSTR pServer, LPCTSTR pUrl) ;//设置模板对象
            int SetDataObject_(ITrans* pTrans, LPCTSTR pUrl) ;//设置模板对象
            int SetDataObject_(LPCTSTR pUrl) ;//设置模板对象
            int SetDataObject_(KXMLDOMElement  pElement) ;//设置模板对象
            int SetDataObject_(KXMLDOMDocument  pDoc) ;
        public:
            int ImportFile_() ; //转入数据
            int ImportFile_(LPCTSTR pStrFile, LPCTSTR pType = NULL, bool Header = false) ; //转入数据
            int ImportString_(LPCTSTR pStr, LPCTSTR pType = NULL, bool Header = false) ; //转入文本数据
        public:
            int SetValues_(LPCTSTR pColName, LPCTSTR pExpr) ; //批量设置值
            int AddCalcColumn_(LPCTSTR pColName, LPCTSTR pExpr) ;//设置关联计算列
            int ClearCalcColumn_(LPCTSTR pColName = NULL) ;//清除关联计算列
        public:
            int GetNextModifyRow_(int nStart) ; //得到下一修改行
        public:
            int Modify_(LPCTSTR pStr) ; //语法修改
            int Evaluate_(int nRow, LPCTSTR pExpr) ; //评估表达式
        public:
            int SetAutoFilter_(bool bAutoFilter) ; //设置自动过滤
            int SetFilter_(LPCTSTR pStrFilter) ; //设置过滤条件
            int Filter_() ; //过滤
            int SetSort_(LPCTSTR pStrSort) ; //设置排序参数
            int Sort_() ; //排序
            int Find_(LPCTSTR pCondition = NULL) ; //查找
            int FindNext_() ; //查找
        public:
            int GetFirstVisibleRow_() ; //得到当前显示的第一行
            int Expand_(bool bExpand) ;//收缩或展开数据视图
        public:
            int Print_(LPCTSTR pXmlArg = NULL) ; //打印
            int PrintPreview_(LPCTSTR pXmlArg = NULL) ; //打印预览
        public:
            int SaveAs_(LPCTSTR pXmlArg = NULL) ; //另存为
            int SaveAsEx_() ; //整体另存为
            int SaveAsEx_(LPCTSTR pStrFile) ; //整体另存为
        public:
            LPTSTR GetColumnProps_(LPCTSTR pColName) ; //得到列整体XML属性
            int SetColumnProps_(LPCTSTR pColName, LPCTSTR pXmlProp) ; //设置列整体XML属性
            LPTSTR GetColumnProp_(LPCTSTR pColName, LPCTSTR pItem) ; //得到列属性
            int SetColumnProp_(LPCTSTR pColName, LPCTSTR pItem, LPCTSTR pProp) ;//设置列属性
            LPTSTR GetColumnProps_(int nCol) ; //得到列整体XML属性
            int SetColumnProps_(int nCol, LPCTSTR pXmlProp) ; //设置列整体XML属性
            LPTSTR GetColumnProp_(int nCol, LPCTSTR pItem) ; //得到列属性
            int SetColumnProp_(int nCol, LPCTSTR pItem, LPCTSTR pProp) ;//设置列属性
        public:
            int DataBI_(LPCTSTR pSchema = NULL) ;//数据BI分析
        public:
            int chart_(LPCTSTR pXmlArg = NULL) ;//图形
            //send event message
            int event_ItemFocusChanged_(int nRow, int nCol) ;
            int event_RowFocusChanged_(int nRow, int nOldRow) ;
            int event_GetFocus_() ;
            int event_LoseFocus_() ;
            int event_ItemChanged_(int nRow, int nCol, LPCTSTR pData) ;
            int event_ItemChanging_(int nRow, int nCol, LPCTSTR pData) ;
        public:
            bool ItemChangeTo(int nRow, int nColumn, LPCTSTR lptStr, DWBuffer dwBuffer = dbuf_normal);
            bool ItemChangeTo(int nRow, LPCTSTR ColumnName, LPCTSTR lptStr, DWBuffer dwBuffer = dbuf_normal);
        public:
            LPCTSTR GetGuid(int nRow);
            //follow function for cell table
        public:
            int InsertRow_(int nGroup, int nRow) ; //插入组行
            int DeleteRow_(int nGroup, int nRow) ; //删除组行
            int InsertRows_(int nGroup, int nRow, int nAmt) ; //插入组多行
            int DeleteRows_(int nGroup, int nRow, int nAmt) ;//删除组多行
        public:
            int GetGroupStartRow_(int nGroup) ; //得到指定组的开始行
            int GetGroupRowCount_(int nGroup) ; //得到指定组的结束行
            int InsertGroupRow_(int nGroup, int nRow) ; //插入组行
        public:
            int GetMaxDeep_() ; //插入数据视图的最大深度
            int GetLevel_() ; //得到数据视图的级号
            LPCTSTR GetDwXPath_() ; //得到数据视图的XPATH
        public:
            IDwView* GetParent_() ; //得到父数据试图
        public:
            int GetChildCount_() ; //得到子数据视图数
            IDwView* GetChild_(int nIndex) ; //得到指定序号的子数据视图
        public:
            LPCTSTR GetDwName_() ; //得到数据视图的名称
            IDwView* FindDwTable_(LPCTSTR pStrName, IDwView* pParent = NULL) ; //查找数据试图
            IDwView* GetCurTable_(int& nRow, int& nCol) ;//得到当前数据视图,并返回行列
            IDwView* GetCurTable_() ;//得到当前数据视图
        public:
            int SetRowSelectorWidth(int nWidth);
            int ResetRowSelector();
            int GetRowSelectorWidth();
            int GetRowSelectorDefaultWidth();
            int SetColHeaderHeight(int nHeight);
            int GetColHeaderDefaultHeight();
            int ResetColHeaderHeight();
            int GetColHeaderHeight();
        public:
            LPTSTR GetHtml();
        public:
            int SetScrollState(bool both);
            int SetHScrollState(bool bShow);
            int SetVScrollState(bool bShow);
        public:
            COLORREF    GetDirectColor();
            void        SetDirectColor(COLORREF cr);
            COLORREF    GetAdvanceColor();
            void        SetAdvanceColor(COLORREF cr);
        public:
            LPTSTR        GetNoteString(int nRow, int nCol);
            LPTSTR        GetOriginString(int nRow, int nCol);
            LPTSTR        GetAdvanceString(int nRow, int nCol);
            void        SetNoteString(int nRow, int nCol, LPTSTR pStr);
            void        SetOriginString(int nRow, int nCol, LPTSTR pStr);
            void        SetAdvanceString(int nRow, int nCol, LPTSTR pStr);
            void        ClearNoteString(int nRow, int nCol);
            void        ClearOriginString(int nRow, int nCol);
            void        ClearAdvanceString(int nRow, int nCol);
        public:
            int AcceptText();
            int getNullCell(POINT& p);
            int ExpandRow();
            int ExpandRow(int sRow, int eRow);
            int ExpandCellRow(int sRow, int eRow);
            int ExpandMarginRow(int sRow, int eRow);
            int GetCellRowFromRowColumn(int sRow, int sCol); //得到行列
            int SetSelectionBorder(int Flag);
            int SetItemText(int row, int col, LPTSTR name);
        public:
            void SetEditUpperMode(bool upper);
            bool GetEditUpperMode();
        public:
            int SetRowSort(LPTSTR colName, bool colOrder = true);
        public:
            LPCTSTR GetItemDisplayString(int nRow, int nColumn, DWBuffer dwBuffer = dbuf_normal);
            LPCTSTR GetItemDisplayString(int nRow, LPCTSTR ColumnName, DWBuffer dwBuffer = dbuf_normal);
            bool SetItemDisplayString(int nRow, int nColumn, LPCTSTR lptStr, DWBuffer dwBuffer = dbuf_normal);
            bool SetItemDisplayString(int nRow, LPCTSTR ColumnName, LPCTSTR lptStr, DWBuffer dwBuffer = dbuf_normal);
            LPCTSTR GetItemTipString(int nRow, int nColumn, DWBuffer dwBuffer = dbuf_normal);
            LPCTSTR GetItemTipString(int nRow, LPCTSTR ColumnName, DWBuffer dwBuffer = dbuf_normal);
            bool SetItemTipString(int nRow, int nColumn, LPCTSTR lptStr, DWBuffer dwBuffer = dbuf_normal);
            bool SetItemTipString(int nRow, LPCTSTR ColumnName, LPCTSTR lptStr, DWBuffer dwBuffer = dbuf_normal);
        };
    }}
}}
jrj/xframe/kobject/kdwview.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
#pragma once
#include "kcontrol.hpp"
namespace Hxsoft {    namespace XFrame {
    class IDwView : public IXFControl
    {
    public:
        enum RowStatus { rs_new = 0, rs_newmodified, rs_datamodified, rs_datanotmodified };
        enum DWBuffer { dbuf_normal = 0, dbuf_filter, dbuf_delete };
    };
}}
jrj/xframe/kobject/kimage.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
#pragma once
#include "kcontrol.hpp"
using KXMLDOMElementt=Hxsoft::XFrame::KXMLDOMDocument;
using KXMLDOMElement=Hxsoft::XFrame::KXMLDOMElement;
namespace Hxsoft{ namespace XFrame
{
    class IXImage : public IXFControl
    {
    public:
        int GetWidth();
        int GetHeight();
    public:
        LPCTSTR  SetUrl(LPCTSTR pServer,LPCTSTR pUrl);
        LPCTSTR  GetUrl();
        LPCTSTR  GetServerUrl();
    public:
        bool SaveToFile();
        bool SaveToFile(LPTSTR pFile);
        bool SaveToFileEx(LPTSTR pFile);
        bool LoadFromUrl(LPCTSTR pServerUrl,LPCTSTR pUrl);
    };
}}
jrj/xframe/kobject/kimageview.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,29 @@
#pragma once
#include "kcontrol.hpp"
using KXMLDOMElementt=Hxsoft::XFrame::KXMLDOMDocument;
using KXMLDOMElement=Hxsoft::XFrame::KXMLDOMElement;
namespace Hxsoft{ namespace XFrame
{
    class IXImageView : public IXFControl
    {
    public:
        int AddImages(LPCTSTR pUrl, LPTSTR pText=NULL);
        int InsertImages(LPCTSTR pUrl, LPTSTR pText, int nIndex);
        int RemoveImage(int nIndex);
        int RemoveImage();
        int GetSelectIndex();
        int SetSelectIndex(int nIndex);
        int GetImageCount();
        int Reset();
        LPTSTR GetImageUrl(int nIndex);
        int SetImageLabel(int nIndex, LPTSTR pText);
        LPTSTR GetImageLabel(int nIndex);
        int Preview(int percent);
        int SelectImage(int nRow,bool bSelect=true);
        int SelectImage(int sRow,int eRow, bool bSelect=true);
        bool IsImageSelected(int nRow);
        int GetNextSelectImage(int nStartRow);
        void SetSelectedMode(int mode);
    };
}}
jrj/xframe/kobject/klayersheet.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,33 @@
#pragma once
#include "kcontrol.hpp"
using KXMLDOMElementt=Hxsoft::XFrame::KXMLDOMDocument;
using KXMLDOMElement=Hxsoft::XFrame::KXMLDOMElement;
namespace Hxsoft{ namespace XFrame
{
    class IXNode;
    class ILayerSheet : public IXFControl
    {
    public:
        int InsertSheet(int nIndex,LPTSTR pText,KXMLDOMElement  pElement,int iImage = -1,bool bToCurrent = false);
        int InsertSheet(int nIndex,LPTSTR pText, IXNode * pNode,int iImage = -1,bool bToCurrent = false,bool bCreateControl = true);
        int InsertSheet(int nIndex,LPTSTR pText,KXMLDOMElement  pElement,void *,int iImage = -1,bool bToCurrent = false);
        int InsertSheet(int nIndex,LPTSTR pText, IXNode * pNode,void *,int iImage = -1,bool bToCurrent = false,bool bCreateControl = true);
        int DeleteSheet(int nIndex);
        bool SelectSheet(int nIndex);
        int Clear();
        int GetSheetCount();
        int GetSheetIndex();
    public:
        bool SetParam(int nIndex,void *);
        void * GetParam(int nIndex);
    public:
        int SetSheetState(int sheet, int state);
        int GetSheetState(int sheet);
        int SetSheetText(int sheet, LPWSTR text);
        LPWSTR GetSheetText(int sheet);
    };
}}
jrj/xframe/kobject/knode.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,104 @@
#pragma once
#include "kcontrol.hpp"
#include "win32/win.hpp"
using KXMLDOMElementt=Hxsoft::XFrame::KXMLDOMDocument;
using KXMLDOMElement=Hxsoft::XFrame::KXMLDOMElement;
namespace Hxsoft{ namespace XFrame
{
    #define LayerFlow_None            0x00000001        //not layer space
    #define LayerFlow_WE            0x00000002
    #define LayerFlow_NS            0x00000004
    #define LayerFlow_FreeForm        0x00000008
    #define LayerFlow_Control        0x00000010
    #define LayerFlow_HtmlFlow        0x00000020
    #define LayerFlow_Sheets        0x00000040
    #define LayerFlow_Hidden        0x00000080        //not show but layer space
    #define LayerFlow_UnLayer        0x00000100        //not show and not layer space
    #define    LayerFlow_NotLayerNode    (LayerFlow_None | LayerFlow_UnLayer)
    #define LayerFlow_LayerChild    (LayerFlow_WE|LayerFlow_NS|LayerFlow_FreeForm|LayerFlow_Sheets| LayerFlow_HtmlFlow )
    class IXFControl;
    class IXPage;
    class IXNode
    {
    public:
        LPCWSTR GetNodeName();
        LPCWSTR GetNodeID();
    public:
        int SetNodeName(LPCWSTR pNodeName);
        int SetNodeID(LPCWSTR pNodeID);
    public:
        LPCWSTR GetCaption();
        int SetCaption(LPCWSTR pCaption);
    public:
        IXNode * GetNodeByID(LPCWSTR pStrNodeID);
        IXNode * GetNodeByName(LPCWSTR pStrName);
    public:
        IXNode * GetXNode();
        IXPage * GetXPage();
        KXMLDOMElement  GetElement();
    public:
        IXNode * GetRootNode();
        BOOL IsControlNode();
        BOOL IsControlNode(IXNode *pNode);
    public:
        IXFControl * GetControl();
    public:
        int SetXNode(IXNode * pNode,bool bReCeate = true);
        int SetElement(IXNode * pNode,bool bReCeate = false);
    public:
        int RemoveControl();
        int CreateControl(HWND hWnd);
    public:
        int RemoveChild();
        int RemoveChild(IXNode * pParentNode);
    public:
        IXNode * CreateNode(KXMLDOMElement pElement,bool setClassName = true);
    public:
        int TransToControl(LPCWSTR pControlClass);
        int TransToControl(IXNode * pNode,LPCWSTR pControlClass);
    public:
        RECT & GetAreaRect();
        RECT & GetContentRect();
    public:
        int SetAreaRect(RECT & rc);
        int SetContentRect(RECT & rc);
    public:
        //adjust or size rect
        int AdjustRect(); //adjust content rect,adjust child node or brother node
        int AdjustRect(RECT rect); //adjust content rect,adjust child node or brother node
        int AdjustRect(int dx); //adjust content rect,adjust child node or brother node
        int CalcContentRect();    //calc content rect
        int CreateNodeControl(HWND    hWnd);
        int AdjustCtrlRect();
    public:
        //draw
        int DrawNode(HDC hDC);
    public:
        IXNode * GetParentNode();
        int GetChildNodesCount();
        IXNode* GetChild(int nItem); //from 0
        bool RemoveChildNode(int nIndex);
        IXNode* InsertChildNode(int nIndex, LPTSTR pXml);
        IXNode* InsertChildNode(int nIndex, KXMLDOMElement  pElement );
    public:
        DWORD GetLayerFlow();
        int SetLayerFlow(DWORD dwLayerFlow);
        DWORD GetLayerFlow(IXNode * pNode);
        int SetLayerFlow(IXNode * pNode,DWORD dwLayerFlow);
    public:
        static IXNode * CreateInstance();
        static int ReleaseInstance(IXNode * pNode);
    public:
        LPTSTR GetXml();
    public:
        HWND GetHWND();
    public:
        int SetWidthHeight(int width, int height);
        int MoveTo(LPTSTR Name);
    };
}}
jrj/xframe/kobject/kpage.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,66 @@
#pragma once
#include "kcontrol.hpp"
#include "win32/win.hpp"
using KXMLDOMElementt=Hxsoft::XFrame::KXMLDOMDocument;
using KXMLDOMElement=Hxsoft::XFrame::KXMLDOMElement;
namespace Hxsoft{ namespace XFrame
{
    #define LayerFlow_None            0x00000001        //not layer space
    #define LayerFlow_WE            0x00000002
    #define LayerFlow_NS            0x00000004
    #define LayerFlow_FreeForm        0x00000008
    #define LayerFlow_Control        0x00000010
    #define LayerFlow_HtmlFlow        0x00000020
    #define LayerFlow_Sheets        0x00000040
    #define LayerFlow_Hidden        0x00000080        //not show but layer space
    #define LayerFlow_UnLayer        0x00000100        //not show and not layer space
    #define    LayerFlow_NotLayerNode    (LayerFlow_None | LayerFlow_UnLayer)
    #define LayerFlow_LayerChild    (LayerFlow_WE|LayerFlow_NS|LayerFlow_FreeForm|LayerFlow_Sheets| LayerFlow_HtmlFlow )
    class IXFControl;
    class IXNode;
     class  IXPage
    {
    public:
        bool Load(LPCTSTR pStrXPageFile);
        bool Load(KXMLDOMElement pElement);
        bool LoadXPage(LPCTSTR pServer,LPCTSTR pStrUrl);
        //bool LoadXPage(ITrans *pTrans,LPCTSTR pStrUrl);
        bool LoadXPage(LPCTSTR pStrPage);
    public:
        IXFControl * GetControl();
        IXFWin *     GetWin();
    public:
        LPCTSTR GetStrLocal();
        LPCTSTR GetUrl();
        LPCTSTR GetWkUrl();
    public:
        int SetStrLocal(LPCTSTR pStr);
        int SetUrl(LPCTSTR pStr);
        int SetWkUrl(LPCTSTR pStr);
    public:
        int SetXNode(IXNode * pNode,bool bReCeate = true);
        int SetElement(IXNode * pNode,bool bReCeate = false);
    public:
        int RemoveControl();
        int CreateNodeControl(HWND hWnd);
    public:
        int RemoveChild();
        int RemoveChild(IXNode * pParentNode);
    public:
        static IXNode * CreateNode(KXMLDOMElement * pElement,bool setClassName = true);
    public:
        static int TransToControl(IXNode * pNode,LPCTSTR pControlClass);
    public:
        BOOL IsControlNode(IXNode *pNode);
    public:
        DWORD GetLayerFlow();
        int SetLayerFlow(DWORD dwLayerFlow);
        DWORD GetLayerFlow(IXNode * pNode);
        int SetLayerFlow(IXNode * pNode,DWORD dwLayerFlow);
    public:
        //draw
        int DrawNode(HDC hDC);
    };
}}
jrj/xframe/kobject/kreport.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,100 @@
#pragma once
#include "kcontrol.hpp"
namespace Hxsoft{ namespace XFrame{ namespace XOffice {namespace XReport
{
    class IXReport : public IXFControl
    {
    public:
        enum RowStatus{rs_new=0,rs_newmodified,rs_datamodified,rs_datanotmodified};
        enum DWBuffer{dbuf_normal=0,dbuf_filter,dbuf_delete};
    public:
        int GetRow_();
        int GetColumn_();
        int GetRowCount_();
        int SetRow_(int row);
    public:
        int GetColumnCount_();
        LPCTSTR GetColumnName_(int col);
        int GetColumnIndex_(LPCTSTR pColumn);
    public:
        LPCTSTR GetItemString_(int nRow,int nColumn,DWBuffer dwBuffer=dbuf_normal);
        LPCTSTR GetItemString_(int nRow,LPCTSTR ColumnName,DWBuffer dwBuffer=dbuf_normal);
        bool SetItemString_(int nRow,int nColumn,LPCTSTR lptStr,DWBuffer dwBuffer=dbuf_normal);
        bool SetItemString_(int nRow,LPCTSTR ColumnName,LPCTSTR lptStr,DWBuffer dwBuffer=dbuf_normal);
    public:
        int InsertRow_(int nRow);
        int DeleteRow_(int nRow);
    public:
        int  GetXml_(BSTR &bstr);
        int  GetXml_(BSTR &bstr,LPCTSTR pGuid);
        int  LoadXml_(BSTR bstr);
        int Load_(KXMLDOMElement  pElement);
    public:
        int SetReadOnly_(bool bReadOnly=true);
    public:
        int SelectRow_(int nRow,bool bSelect=true);
        int SelectRow_(int sRow,int eRow, bool bSelect=true);
        int GetNextSelectRow_(int nStartRow);
        bool IsRowSelected_(int nRow);
        //int SetSelectBkColor_(COLORREF color);
        int SetSelectionMode_(int nMode); //0 unselection 1 singleSelection 2 multiselection 3 multiselectionex
    public:
        int DwUpdateTo_(KXMLDOMDocument pXmlDoc);
        int DwUpdateAllTo_(KXMLDOMDocument pXmlDoc);
    public:
        int Retrieve_(LPCTSTR pServer,LPCTSTR pDataUrl, LPCTSTR pArgStr) ;//读取数据
        int Retrieve_(ITrans *pTrans,LPCTSTR pDataUrl, LPCTSTR pArgStr);//读取数据
        int Retrieve_(LPCTSTR pDataUrl, LPCTSTR pArgStr) ;//读取数据
        int Retrieve_(KXMLDOMElement  pElement);//读取数据
        int Retrieve_(KXMLDOMDocument &xml);//读取数据
    public:
        virtual int SetDataObject_(LPCTSTR pServer,LPCTSTR pUrl) ;//设置模板对象
        virtual int SetDataObject_(ITrans *pTrans,LPCTSTR pUrl) ;//设置模板对象
        virtual int SetDataObject_(LPCTSTR pUrl) ;//设置模板对象
        virtual int SetDataObject_(KXMLDOMElement  pElement) ;//设置模板对象
        virtual int SetDataObject_(KXMLDOMDocument  pDoc);
    public:
        int ImportFile_() ;
        int ImportFile_(LPCTSTR pStrFile,LPCTSTR pType=NULL,bool Header = false);
        int ImportString_(LPCTSTR pStr,LPCTSTR pType=NULL,bool Header = false);
    public:
        int    Reset_();
        int    ResetUpdateStatus_();
    public:
        int event_ItemFocusChanged_(int nRow,int nCol);
        int event_RowFocusChanged_(int nRow,int nOldRow);
        int event_GetFocus_();
        int event_LoseFocus_();
        int event_ItemChanged_(int nRow,int nCol,LPCTSTR pData);
        int event_ItemChanging_(int nRow,int nCol,LPCTSTR pData);
    public:
        int GetDwType_();
    public:
        Hxsoft::XFrame::KXMLDOMElement  GetRowElement(int nRow);
    public:
        int InsertCol(int nCol,LPCTSTR pCaption,LPCTSTR pColName,int nWidth,LPCTSTR pColPath = NULL,LPCTSTR pStyleClass=NULL,
            LPCTSTR pEditClass=NULL,LPCTSTR pFormatClass=NULL);
        int RemoveCol(int nCol);
        int RemoveVCol(int nCol);
        int RemoveCol(LPCTSTR pColName);
        int AddEditStyle(LPCTSTR pName, LPCTSTR pStr);
        int RemoveEditStyle(LPCTSTR pName, LPCTSTR pStr);
        int SetColEditStyle(LPCTSTR pColName,LPCTSTR pClassName);
        int SetDDLBData(LPCTSTR pColName,LPCTSTR pData);
        LPCTSTR GetDDLBData(LPCTSTR pColName);
    public:
        int CreateTree(LPCTSTR pPath,int nCol, int nImage1,int nImage2);
        int GetContentRow(int nRow);
    };
}}}}
jrj/xframe/kobject/kshtml.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,47 @@
#pragma once
#include "kcontrol.hpp"
namespace Hxsoft{ namespace XFrame
{
    class xcSHtml
    {
    public:
        struct htBlock{};
    };
    class IXSHtmlItem
    {
    public:
        LPCTSTR GetUrl(xcSHtml::htBlock*  pBlock);
        LPCTSTR GetData(xcSHtml::htBlock* pBlock);
        LPCTSTR GetData(xcSHtml::htBlock* pBlock, int nRow, int nCol);
        int GetRowColumn(xcSHtml::htBlock* pBlock, int &Row, int &Col);
        int RenameID(xcSHtml::htBlock* pBlock,LPTSTR ID);
        int SetData(xcSHtml::htBlock* pBlock,LPTSTR strText);
        int SetStyle(xcSHtml::htBlock* pBlock,LPTSTR cssStyle);
        int SetStyleClass(xcSHtml::htBlock* pBlock,LPTSTR cssStyleClass);
        LPCTSTR GetText(xcSHtml::htBlock* pBlock);
        int SetText(xcSHtml::htBlock* pBlock,LPTSTR strText);
        LPCTSTR GetID(xcSHtml::htBlock* pBlock);
        int SetID(xcSHtml::htBlock* pBlock,LPTSTR newID);
    };
    class IXSHtml : public IXFControl
    {
    public:
        int SetContent(LPCTSTR pStr);
    public:
        //int DrawHtml(HDC hPaintDC,LPTSTR pHtml,RECT &rt);
    public:
        int SetElementVisible(LPTSTR ID, bool bVisible);
    public:
        bool IsVisible(LPTSTR ID);
        bool SwitchState(LPTSTR ID);
    public:
        xcSHtml::htBlock* FoundBlockByID(LPTSTR ID);
        xcSHtml::htBlock* FoundBlockByID(xcSHtml::htBlock* pBlock, LPTSTR ID);
    };
}}
jrj/xframe/kobject/kutil.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@
#pragma once
#include "kbase.hpp"
typedef struct HICON__{}*HICON;
typedef HICON HCURSOR;
namespace Hxsoft{ namespace XFrame
{
    class IXFUtil
    {
    public:
        static HCURSOR  SetCursorWait();
        static int RestoreCursor(HCURSOR hCursor);
        static const wchar_t* GetUrlData(LPWSTR url);
        static bool HasCacheData(LPWSTR url);
        static void CacheUrlData(LPWSTR url,LPWSTR data);
        static int SaveToFile(LPTSTR pFile,LPTSTR pData,LPTSTR ext, LPTSTR pFilter, LPTSTR pFileName=NULL);
        static LPWSTR MD5(LPWSTR pStr);
        static bool SmallImage(LPCTSTR lpszPathName, LPCTSTR lpszNewPathName, int width, int height, int flag=0);
        static LPWSTR OpenDialog(HWND Owner,LPWSTR str);
        //static std::wstring MakeComboStyleClassName(std::wstring styleClass);
        //static std::wstring EnsureComboStyleClassName(std::wstring styleClass,std::map<std::wstring,std::wstring> &items);
    };
}}
namespace Hxsoft { namespace XUtil{
    LPTSTR FormatDecimalString(LPTSTR  str, LPTSTR format, bool& bfree);
}}
jrj/xframe/kobject/kwin.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,78 @@
#pragma once
#include "kbase.hpp"
#include "kxml.hpp"
#include "kcontrol.hpp"
namespace Hxsoft{ namespace XFrame
{
    class  IXFWin
    {
    public:
        HWND GetHWND();
    public:
        IXFWin* GetFrameWindow();
    public:
        int CloseWindow();
    public:
        int SetStyle(DWORD dwStyle);
        int SetStyleEx(DWORD dwStyleEx);
    public:
        //static IXFWin * OpenWindow(LPCTSTR pServer,LPCTSTR pStrUrl,IXFWin* pParent,LPARAM lParam,IXFWin *pCmdWin,DWORD dwStyleEx=0,DWORD DwStyle=0,LPCTSTR pCtrl=NULL);
        static IXFWin * OpenWindow(LPCTSTR pServer,LPCTSTR pStrUrl,IXFWin* pParent,LPARAM lParam,IXFWin *pCmdWin,DWORD dwStyleEx=0,DWORD DwStyle=0,LPRECT pRect=NULL);
        static IXFWin * OpenWindow(LPCTSTR pServer,LPCTSTR pStrUrl,IXFWin* pParent=NULL,LPARAM lParam=NULL,DWORD dwStyleEx=0,DWORD DwStyle=0,LPRECT pRect=NULL);
        static IXFWin * OpenWindow(ITrans * pTrans,LPCTSTR pStrUrl,IXFWin* pParent,LPARAM lParam,IXFWin *pCmdWin,DWORD dwStyleEx=0,DWORD DwStyle=0,LPRECT pRect=NULL);
        static IXFWin * OpenWindow(ITrans * pTrans,LPCTSTR pStrUrl,IXFWin* pParent=NULL,LPARAM lParam=NULL,DWORD dwStyleEx=0,DWORD DwStyle=0,LPRECT pRect=NULL);
        IXFWin * OpenWindow(LPCTSTR pStrUrl,IXFWin* pParent,LPARAM lParam,IXFWin *pCmdWin,DWORD dwStyleEx=0,DWORD DwStyle=0,LPRECT pRect=NULL);
        IXFWin * OpenWindow(LPCTSTR pStrUrl,IXFWin* pParent=NULL,LPARAM lParam=NULL,DWORD dwStyleEx=0,DWORD DwStyle=0,LPRECT pRect=NULL);
        static IXFWin * OpenWindow(KXMLDOMElement  pElement,IXFWin* pParent,LPARAM lParam,IXFWin *pCmdWin,DWORD dwStyleEx=0,DWORD DwStyle=0,LPRECT pRect=NULL);
        static IXFWin * OpenWindow(KXMLDOMElement ,IXFWin* pParent=NULL,LPARAM lParam=NULL,DWORD dwStyleEx=0,DWORD DwStyle=0,LPRECT pRect=NULL);
        static IXFWin * OpenWindow(KXMLDOMDocument &xml,IXFWin* pParent=NULL,LPARAM lParam=NULL,DWORD dwStyleEx=0,DWORD DwStyle=0,LPRECT pRect=NULL);
        static IXFWin * OpenWindow(IXPage * pPage,IXFWin* pParent,LPARAM lParam,IXFWin *pCmdWin,DWORD dwStyleEx=0,DWORD DwStyle=0,LPRECT pRect=NULL);
        static IXFWin * OpenWindow(IXPage * pPage,IXFWin* pParent=NULL,LPARAM lParam=NULL,DWORD dwStyleEx=0,DWORD DwStyle=0,LPRECT pRect=NULL);
    public:
        IXFControl * GetControl(LPCTSTR pControlName);
        IXFControl * GetControl(LPCTSTR pControlName,IXNode * pNode);
        IXFControl * GetControl(LPCTSTR pControlName,bool bInsUnlayered);
    public:
        int GetAttachObject();
        static int GetAttachObject(HWND hWnd);
    public:
        LPCTSTR GetServerUrl();
    public:
        int Redraw();
    public:
        IXNode * GetAgentNode(LPCTSTR pStrName = L"agentarea");
        IXNode* SetAgentNodeContent(IXNode* pAgentNode,KXMLDOMElement pElement,IXNode * pOwnerNode);
        IXNode* SetAgentNodeContent(IXNode* pAgentNode,LPCTSTR pStrXml,IXNode * pOwnerNode);
        IXNode* SetAgentNodeContent(IXNode* pAgentNode,IXNode *Node,IXNode * pOwnerNode);
        IXNode* SetAgentNodeContent(IXNode* pAgentNode,LPCTSTR pStrXml);
        IXNode* SetAgentNodeContent(IXNode* pAgentNode,KXMLDOMElement pElement);
        IXNode* SetAgentNodeContent(IXNode* pAgentNode,IXNode *pNode);
        int ClearAgentNodeContent(IXNode* pAgentNode = NULL,LPCTSTR pStrName = NULL);
        int ClearAgentNodeContentEx(IXNode* pAgentNode = NULL,LPCTSTR pStrName = NULL);
        int RemoveAgentNodeContent(IXNode* pAgentNode , IXNode *pNode);
    public:
        IXNode * GetXNode();
        IXPage * GetXPage();
        KXMLDOMElement  GetElement();
    public:
        void* GetParam();
        bool  SetParam(void* pParam);
        void* GetFrameParam();
        bool  SetFrameParam(void* pParam);
    public:
        void SwitchLayer(LPTSTR pStrLayerSheet,LPTSTR pStrLayerFrame);
    public:
        xbObject * QueryItem(LPCTSTR pControlName,LPCTSTR pItem);
    public:
        bool AttachEvent(LPTSTR msgid,FEvent pEvt,void * pThis);
        bool AttachEvent(LPTSTR pCtlName, LPTSTR msgid,FEvent pEvt,void * pThis);
    };
}}
jrj/xframe/kobject/kxaserver.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,99 @@
#pragma once
#include "kbase.hpp"
#include "kxml.hpp"
namespace Hxsoft{ namespace XFrame
{
    class   IXAServer
    {
    public:
        //读取开发的对象,pObject should in( 'xpage','entity','sheet','workflow','worknode','xquery','xaction'
        static int GetDevObject(LPCTSTR pStrServer,LPCTSTR pObject,LPCTSTR pObjGuid, KXMLDOMDocument&xml);
        static int GetDevObject(ITrans * pTrans,LPCTSTR pObject,LPCTSTR pObjGuid, KXMLDOMDocument&xml);
        int GetDevObject(LPCTSTR pObject,LPCTSTR pObjGuid, KXMLDOMDocument &xml);
    public:
        //执行服务命令
        static LPTSTR ProcessCmd(LPCTSTR pStrServer,LPCTSTR pStrCmd,LPCTSTR pExtStr, bool needlogin=false);
        static int ProcessCmd(LPCTSTR pStrServer,LPCTSTR pStrCmd,LPCTSTR pExtStr,BYTE * &pData,int &len);
        static int ProcessCmd(ITrans * pTrans,LPCTSTR pStrCmd,LPCTSTR pExtStr,BYTE * &pData,int &len);
        int ProcessCmd(LPCTSTR pStrCmd,LPCTSTR pExtStr,BYTE * &pData,int &len);
        int ProcessCmd(LPCTSTR pStrServer,LPCTSTR pStrCmd,LPCTSTR pExtStr,BYTE * &pData,int &len, HWND hWnd);
        //执行服务命令并装载到xml对象中
        static int FetchXml(LPCTSTR pStrServer,LPCTSTR pStrCmd,LPCTSTR pExtStr,KXMLDOMDocument &xml);
        static int FetchXml(ITrans * pTrans,LPCTSTR pStrCmd,LPCTSTR pExtStr,KXMLDOMDocument &xml);
        int FetchXml(LPCTSTR pStrCmd,LPCTSTR pExtStr,KXMLDOMDocument &xml);
    public:
        //执行服务命令并装载到xml对象中
        static int LoadUrl(LPCTSTR pStrServer,LPCTSTR pUrl,LPCTSTR pExtStr,BYTE * &pData,int &len,bool bCache=true);
        static int LoadUrl(ITrans * pTrans,LPCTSTR pUrl,LPCTSTR pExtStr,BYTE * &pData,int &len,bool bCache=true);
        int LoadUrl(LPCTSTR pUrl,LPCTSTR pExtStr,BYTE * &pData,int &len,bool bCache=true);
        //执行服务命令并装载到xml对象中
        static int LoadUrl(LPCTSTR pStrServer,LPCTSTR pUrl,LPCTSTR pExtStr,KXMLDOMDocument &xml);
        static int LoadUrl(ITrans * pTrans,LPCTSTR pUrl,LPCTSTR pExtStr,KXMLDOMDocument &xml);
        int LoadUrl(LPCTSTR pUrl,LPCTSTR pExtStr,KXMLDOMDocument &xml);
        //读取XPage
        static int LoadXPage(LPCTSTR pStrServer,LPCTSTR pStrUrl,KXMLDOMDocument &xml);
        static int LoadXPage(ITrans * pTrans,LPCTSTR pStrUrl,KXMLDOMDocument &xml);
        int LoadXPage(LPCTSTR pStrUrl,KXMLDOMDocument &xml);
    public:
        //执行XQuery命令
        static int ExecXQuery(LPCTSTR pStrServer,LPCTSTR pObjGuid,LPCTSTR pArgs,BYTE * &pData,int &len);
        static int ExecXQuery(LPCTSTR pStrServer,LPCTSTR pObjGuid,LPCTSTR pArgs,KXMLDOMDocument &xml);
        static int ExecXAction(LPCTSTR pStrServer,LPCTSTR pObjGuid,LPCTSTR pArgs,BYTE * &pData,int &len);
        static int ExecXAction(LPCTSTR pStrServer,LPCTSTR pObjGuid,LPCTSTR pArgs,KXMLDOMDocument &xml);
        static int ExecXQuery(LPCTSTR pStrServer,LPCTSTR pObjGuid,LPCTSTR pArgs,int &val);
        static int ExecXAction(LPCTSTR pStrServer,LPCTSTR pObjGuid,LPCTSTR pArgs);
        static int ExecXQuery(ITrans * pTrans,LPCTSTR pObjGuid,LPCTSTR pArgs,BYTE * &pData,int &len);
        static int ExecXQuery(ITrans * pTrans,LPCTSTR pObjGuid,LPCTSTR pArgs,KXMLDOMDocument &xml);
        static int ExecXAction(ITrans * pTrans,LPCTSTR pObjGuid,LPCTSTR pArgs,BYTE * &pData,int &len);
        static int ExecXAction(ITrans * pTrans,LPCTSTR pObjGuid,LPCTSTR pArgs,KXMLDOMDocument &xml);
        int ExecXQuery(LPCTSTR pObjGuid,LPCTSTR pArgs,BYTE * &pData,int &len);
        int ExecXQuery(LPCTSTR pObjGuid,LPCTSTR pArgs,KXMLDOMDocument &xml);
        int ExecXAction(LPCTSTR pObjGuid,LPCTSTR pArgs,BYTE * &pData,int &len);
        int ExecXAction(LPCTSTR pObjGuid,LPCTSTR pArgs,KXMLDOMDocument &xml);
        static LPCTSTR ExecArgs(LPCTSTR pArgs);
    public:
        //重新连接
        static int ReConnect(LPCTSTR pStrServer);
        static int ReConnect(ITrans * pTrans);
        int ReConnect();
    public:
        //得到用户
        static LPCTSTR GetUserNo();
        static LPCTSTR GetVersion();
        static LPWSTR GetComputerNameEx();
        static LPWSTR GetAppPath();
        static int SetUID(LPWSTR uid);
        static LPWSTR GetUID();
        static LPWSTR GetMacAddress();
        static LPWSTR GetIpAddress();
        static LPWSTR GetConnectId();
        static int SetLoginLog(LPCTSTR pStrServer,LPWSTR pStatus);
        static void SetDataToClip(LPCTSTR DataStr);
    public:
        //设置交易对象
        ITrans * m_pTrans;
        int SetTrans(ITrans *);
        ITrans * GetTrans();
        static int UploadEx(LPTSTR pUri,LPTSTR pName,HWND m_hWnd,LPTSTR pSource=NULL,BOOL bCompress=false);
        static int Upload(LPTSTR pUri,LPTSTR pName,HWND m_hWnd,LPTSTR pSource=NULL,BOOL bCompress=false);
        static int Upload(LPTSTR pUri,LPTSTR pName,LPTSTR pPath,HWND m_hWnd,LPTSTR pSource=NULL,BOOL bCompress=false);
        static int FileCopy(LPTSTR pUri,LPTSTR pName,LPTSTR pUri1,LPTSTR pName1);
        static LPTSTR UploadFile(LPTSTR pUri,LPTSTR pName,HWND m_hWnd,LPTSTR pSource,BOOL bCompress);
        static int __DeleteFile(LPTSTR pName);
        static int __CreateDirectory(LPTSTR pName);
        static int DownLoadFile(LPCTSTR pStrServer,LPCTSTR pUrl,LPCTSTR pExt,LPTSTR pName=NULL);
        static int UploadData(LPTSTR pUri,LPTSTR pName,LPTSTR pData);
    };
}}
jrj/xframe/kobject/kxml.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,262 @@
#pragma once
typedef wchar_t* BSTR ;
namespace Hxsoft {    namespace XFrame
{
    class KXMLDOMNode;
    class KXMLDOMAttribute;
    class KXMLDOMElement;
    class KXMLDOMCDATASection;
    class KXMLDOMDocumentFragment;
    class KXMLDOMComment;
    class KXMLDOMEntityReference;
    class KXMLDOMTextNode;
    class KXMLDOMProcessingInstruction;
    class KXMLDOMNodeList;
    class KXMLParseError;
    enum  KDOMNodeType
    {
        KNODE_INVALID = 0,
        KNODE_ELEMENT = (KNODE_INVALID + 1),
        KNODE_ATTRIBUTE = (KNODE_ELEMENT + 1),
        KNODE_TEXT = (KNODE_ATTRIBUTE + 1),
        KNODE_CDATA_SECTION = (KNODE_TEXT + 1),
        KNODE_ENTITY_REFERENCE = (KNODE_CDATA_SECTION + 1),
        KNODE_ENTITY = (KNODE_ENTITY_REFERENCE + 1),
        KNODE_PROCESSING_INSTRUCTION = (KNODE_ENTITY + 1),
        KNODE_COMMENT = (KNODE_PROCESSING_INSTRUCTION + 1),
        KNODE_DOCUMENT = (KNODE_COMMENT + 1),
        KNODE_DOCUMENT_TYPE = (KNODE_DOCUMENT + 1),
        KNODE_DOCUMENT_FRAGMENT = (KNODE_DOCUMENT_TYPE + 1),
        KNODE_NOTATION = (KNODE_DOCUMENT_FRAGMENT + 1)
    };
    class KXMLDOMNodeList
    {
    public:
        long length();
        bool length(long&);
        bool length(long*);
        bool gen_length(long* v) { return length(v);}
        KXMLDOMNode item(int index);
        bool item(int index, KXMLDOMNode& node);
        bool item(int index, KXMLDOMNode* node);
        bool get_item(int index, KXMLDOMNode* node) { return item(index, node); }
    private:
        void* impl;
    public:
        void* getImpl();
    public:
        KXMLDOMNodeList(void* impl);
        KXMLDOMNodeList() :impl(nullptr) {}
        ~KXMLDOMNodeList();
    public:
        operator bool() { return impl ? true : false; }
    public:
        KXMLDOMNodeList(const KXMLDOMNodeList& rhs);
        const KXMLDOMNodeList& operator =(const KXMLDOMNodeList& rhs);
    };
    class KXMLDOMElement;
    class KXMLDOMAttribute;
    class KXMLDOMDocument;
    class KXMLDOMNode {
    public:
    //    attributes
    //        baseName
        KXMLDOMNodeList childNodes();
        //    dataType
        //    definition
        KXMLDOMNode    firstChild();
        KXMLDOMNode    lastChild();
        //    namespaceURI
        //    namespaceURI
        KXMLDOMNode    nextSibling();
        const wchar_t* nodeName();
        KDOMNodeType    nodeType();
        KDOMNodeType    get_nodeType() { return nodeType(); }
        //    nodeTypedValue
        //    nodeTypeString
        //    nodeValue
        KXMLDOMDocument    ownerDocument();
        KXMLDOMNode    parentNode();
        //    parsed
        //    prefix
        KXMLDOMNode    previousSibling();
        //    specified
        const wchar_t* tagName();
        const wchar_t* text();
        const wchar_t* xml();
        bool get_tagName(BSTR& str);
        bool get_text(BSTR& str);
        bool get_xml(BSTR& str);
        bool get_tagName(BSTR* str) { return get_tagName(*str); }
        bool get_text(BSTR* str) { return get_text(*str); }
        bool get_xml(BSTR* str) { return get_xml(*str); }
        bool settext(const wchar_t* txt);
        bool put_text(const wchar_t* txt) { return settext(txt); }
        bool    appendChild(KXMLDOMNode);
        KXMLDOMNode    cloneNode(bool);
        wchar_t* getAttribute(const wchar_t* name);
        void getAttribute(const wchar_t* name,void * vt);
        KXMLDOMAttribute    getAttributeNode(const wchar_t* name);
        KXMLDOMNodeList    getElementsByTagName(const wchar_t* name);
        bool    hasChildNodes();
        bool    insertBefore(KXMLDOMNode newnode, KXMLDOMNode at);
        void    normalize();
        bool    removeAttribute(const wchar_t* name);
        bool    removeAttributeNode(KXMLDOMNode attr);
        bool    removeChild(KXMLDOMNode val);
        bool    replaceChild(KXMLDOMNode newChild, KXMLDOMNode oldChild);
        KXMLDOMNodeList    selectNodes(const wchar_t*);
        KXMLDOMNode    selectSingleNode(const wchar_t*);
        bool selectNodes(const wchar_t*, KXMLDOMNodeList& pNodeList);
        bool selectSingleNode(const wchar_t*, KXMLDOMNode& pNode);
        bool selectNodes(const wchar_t*, KXMLDOMNodeList* pNodeList);
        bool selectSingleNode(const wchar_t*, KXMLDOMNode* pNode);
        void    setAttribute(const wchar_t* name, const wchar_t* value);
        void    setAttribute(const wchar_t* name, long val);
        void    setAttribute(const wchar_t* name, double val);
        wchar_t* transformNode(KXMLDOMNode stylesheet);
        KXMLDOMNode    transformNodeToObject(KXMLDOMNode);
    protected:
        void* impl;
    public:
        KXMLDOMNode(void* impl);
        KXMLDOMNode():KXMLDOMNode(nullptr) {}
        ~KXMLDOMNode();
    public:
        KXMLDOMNode(const KXMLDOMNode& rhs);
        const KXMLDOMNode& operator =(const KXMLDOMNode& rhs);
    public:
        operator bool() { return impl ? true : false; }
    public:
        void* getImpl();
    };
    class KXMLDOMDocument : public KXMLDOMNode
    {
    public:
        const wchar_t* text();
        const wchar_t* url();
        const wchar_t* xml();
        KXMLDOMElement documentElement();
        bool documentElement(KXMLDOMElement * pDoc);
        bool get_documentElement(KXMLDOMElement* pDoc) { return documentElement(pDoc); }
    public:
        bool appendChild(KXMLDOMNode);
        KXMLDOMAttribute createAttribute(const wchar_t*);
        KXMLDOMCDATASection createCDATASection(const wchar_t*);
        KXMLDOMComment createComment(const wchar_t*);
        KXMLDOMDocumentFragment createDocumentFragment();
        KXMLDOMElement createElement(const wchar_t*);
        bool createElement(const wchar_t*, KXMLDOMElement* ele);
        KXMLDOMEntityReference createEntityReference(const wchar_t*);
        KXMLDOMNode createNode(KDOMNodeType ty, const wchar_t* name, const wchar_t* ns);
        KXMLDOMProcessingInstruction createProcessingInstruction(const wchar_t* target, const wchar_t* data);
        KXMLDOMTextNode createTextNode(const wchar_t*);
        KXMLDOMNodeList getElementsByTagName(const wchar_t*);
        wchar_t* getProperty(const wchar_t*);
        bool setProperty(const wchar_t* prop, const wchar_t* val);
        bool setProperty(const wchar_t* prop, bool val);
        bool hasChildNodes();
        bool importNode(KXMLDOMNode);
        bool insertBefore(KXMLDOMNode newnode, KXMLDOMNode at);
        bool load(const wchar_t*);
        bool loadXML(const wchar_t*);
        KXMLDOMNode nodeFromID(const wchar_t*);
        bool removeChild(KXMLDOMNode);
        bool replaceChild(KXMLDOMNode newChild, KXMLDOMNode oldChild);
        bool save(const wchar_t*);
        KXMLDOMNodeList selectNodes(const wchar_t*);
        KXMLDOMNode selectSingleNode(const wchar_t*);
        bool selectNodes(const wchar_t*, KXMLDOMNodeList& pNodeList);
        bool selectSingleNode(const wchar_t*, KXMLDOMNode& pNode);
        bool selectNodes(const wchar_t*, KXMLDOMNodeList* pNodeList);
        bool selectSingleNode(const wchar_t*, KXMLDOMNode* pNode);
        wchar_t* transformNode(KXMLDOMNode);
        KXMLDOMNode transformNodeToObject(KXMLDOMNode);
        KXMLParseError validate();
        //bool validateNode();
    public:
        KXMLDOMDocument(void* impl);
        KXMLDOMDocument();
        ~KXMLDOMDocument();
    public:
        const KXMLDOMDocument& operator =(const KXMLDOMDocument& rhs);
        KXMLDOMDocument(const KXMLDOMDocument& rhs);
    };
    class KXMLDOMElement : public KXMLDOMNode
    {
    public:
        KXMLDOMElement( KXMLDOMNode v);
        KXMLDOMElement(void* impl) :KXMLDOMNode(impl) {}
        KXMLDOMElement() :KXMLDOMNode() {}
    };
    class KXMLDOMAttribute : public KXMLDOMNode
    {
    public:
        KXMLDOMAttribute(KXMLDOMNode& v);
        KXMLDOMAttribute(void* impl) :KXMLDOMNode(impl) {}
    };
    class KXMLDOMCDATASection : public KXMLDOMNode
    {
    public:
        KXMLDOMCDATASection(KXMLDOMNode& v);
        KXMLDOMCDATASection(void* impl) :KXMLDOMNode(impl) {}
    };
    class KXMLDOMComment: public KXMLDOMNode
    {
    public:
        KXMLDOMComment(KXMLDOMNode& v);
        KXMLDOMComment(void* impl) :KXMLDOMNode(impl) {}
    };
    class KXMLDOMEntityReference : public KXMLDOMNode
    {
    public:
        KXMLDOMEntityReference(KXMLDOMNode& v);
        KXMLDOMEntityReference(void* impl) :KXMLDOMNode(impl) {}
    };
    class KXMLDOMTextNode : public KXMLDOMNode
    {
    public:
        KXMLDOMTextNode(KXMLDOMNode& v);
        KXMLDOMTextNode(void* impl) :KXMLDOMNode(impl) {}
    };
    class KXMLDOMProcessingInstruction : public KXMLDOMNode
    {
    public:
        KXMLDOMProcessingInstruction(KXMLDOMNode& v);
        KXMLDOMProcessingInstruction(void* impl) :KXMLDOMNode(impl) {}
    };
    class KXMLDOMDocumentFragment : public KXMLDOMNode
    {
    public:
        KXMLDOMDocumentFragment(KXMLDOMNode& v);
        KXMLDOMDocumentFragment(void* impl) :KXMLDOMNode(impl) {}
    };
    class KXMLParseError : public KXMLDOMNode
    {
    public:
        KXMLParseError(KXMLDOMNode& v);
        KXMLParseError(void* impl) :KXMLDOMNode(impl) {}
    };
}}
using KXMLDOMDocument=Hxsoft::XFrame::KXMLDOMDocument;
using KXMLDOMNode=Hxsoft::XFrame::KXMLDOMNode;
using KXMLDOMElement=Hxsoft::XFrame::KXMLDOMElement;
using KXMLDOMNodeList = Hxsoft::XFrame::KXMLDOMNodeList;
jrj/xframe/lib/nmemory.obj
Binary files differ
jrj/xframe/lib/nmemory1.obj
Binary files differ
jrj/xframe/lib/nstring.obj
Binary files differ
jrj/xframe/lib/nstring1.obj
Binary files differ
jrj/xframe/lib/xstring.obj
Binary files differ
jrj/xframe/lib/xstring1.obj
Binary files differ
jrj/xframe/platform/nmemory.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
#pragma once
typedef unsigned long long size_t;
class nmemory
{
public:
    static void* alloc(int size);
    static void free(void *);
public:
    static const void * chr(const void *_Buf ,int _Val,size_t _MaxCount);
    static int  icmp(const void *_Buf1,const void *_Buf2,size_t _Size);
    static int  cmp(const void *_Buf1,const void *_Buf2,size_t _Size);
    static void * cpy(void *  _Dst,const void *  _Src,size_t _Size);
    static void *  set(void *_Dst,int _Val,size_t _Size);
};
jrj/xframe/platform/nstring.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,69 @@
#pragma once
#include <system/base.hpp>
typedef unsigned long long  size_t;
class nstring
{
public:
    static size_t length(const wchar_t*,int MaxCount=0);
    static wchar_t* clone(const wchar_t* psrc);
    static size_t find(const wchar_t* psrc, const wchar_t* substr,int pos = 0);
    static const wchar_t* str(const wchar_t* psrc, const wchar_t* substr);
    static wchar_t * set(wchar_t * psrc, int val);
    static wchar_t* cpy(wchar_t* pdest, const wchar_t* psrc);
    static wchar_t* ncpy(wchar_t* pdest, const wchar_t* psrc,int nlen);
    static char* ncpy(char* pdest, const char* psrc,int nlen);
    static int cmp(const wchar_t* pstr1,const wchar_t* pstr2,int MaxCount=0);
    static int icmp(const wchar_t* pstr1,const wchar_t* pstr2,int MaxCount=0);
    static wchar_t* cat(wchar_t* pdest, wchar_t* psrc,int MaxCount=0);
    static const wchar_t* chr(const wchar_t* psrc, int val);
    static int coll(const wchar_t* pstr1,const wchar_t* pstr2);
    static size_t cspn(const wchar_t *_Str,const wchar_t *_Control);
    static wchar_t * error(const wchar_t *_ErrMsg);
    static wchar_t * toLower(wchar_t *_Str);
    static wchar_t * toUpper(wchar_t *_Str);
    static const wchar_t * pbrk(const wchar_t *_Str,const wchar_t *_Control);
    static wchar_t * rev(wchar_t *_Str);
    static int toInt(wchar_t *_Str);
    static int toInt64(wchar_t* _Str);
    static double toDouble(wchar_t* str);
    static wchar_t* trim(wchar_t* str);
    static wchar_t* ltrim(wchar_t* str);
    static wchar_t* rtrim(wchar_t* str);
   static wchar_t* trim_(wchar_t* str,wchar_t* dest);
    static wchar_t* ltrim_(wchar_t* str, wchar_t* dest);
    static wchar_t* rtrim_(wchar_t* str, wchar_t* dest);
public:
    static size_t length(const char*,int MaxCount=0);
    static char* clone(const char* psrc);
    static size_t find(const char* psrc, const char* substr,int pos = 0);
    static const char* str(const char* psrc, const char* substr);
    static char * set(char * psrc, int val);
    static char* cpy(char* pdest, const char* psrc);
    static int cmp(const char* pstr1,const char* pstr2,int MaxCount=0);
    static int icmp(const char* pstr1,const char* pstr2,int MaxCount=0);
    static char* cat(char* pdest, char* psrc,int MaxCount=0);
    static const char* chr(const char* psrc, int val);
    static int coll(const char* pstr1,const char* pstr2);
    static size_t cspn(const char *_Str,const char *_Control);
    static char * error(const char *_ErrMsg);
    static char * toLower(char *_Str);
    static char * toUpper(char *_Str);
    static const char * pbrk(const char *_Str,const char *_Control);
    static char * rev(char *_Str);
    static int toInt(char *_Str);
    static int toInt64(char* _Str);
    static double toDouble(char* str);
    static wchar_t * toWStr(int val);
    static wchar_t * toWStr(double val);
    static wchar_t * toWStr(int val,wchar_t* buffer, int maxLen=16);
    static wchar_t * toWStr(double val,wchar_t* buffer, int maxLen=31);
    static wchar_t* toWStr(LPARAM val);
    static wchar_t* toWStr(LPARAM val,wchar_t* buffer, int maxLen=31);
    static char* trim(char* str);
    static char* ltrim(char* str);
    static char* rtrim(char* str);
};
jrj/xframe/src/nmemory.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
#include "platform/nmemory.hpp"
#include <stdlib.h>
#include <memory.h>
void* nmemory::alloc(int size)
{
    return ::malloc(size);
}
void nmemory::free(void * p)
{
    if(p)::free(p);
}
const void * nmemory::chr(const void *_Buf ,int _Val,size_t _MaxCount)
{
    return ::memchr(_Buf,_Val,_MaxCount);
}
int  nmemory::icmp(const void *_Buf1,const void *_Buf2,size_t _Size)
{
    return ::_memicmp(_Buf1,_Buf2,_Size);
}
int  nmemory::cmp(const void *_Buf1,const void *_Buf2,size_t _Size)
{
    return ::memcmp(_Buf1,_Buf2,_Size);
}
void *  nmemory::cpy(void *  _Dst,const void *  _Src,size_t _Size)
{
    return ::memcpy(_Dst,_Src,_Size);
}
void *  nmemory::set(void *_Dst,int _Val,size_t _Size)
{
    return ::memset(_Dst,_Val,_Size);
}
jrj/xframe/src/nmemory.obj
Binary files differ
jrj/xframe/src/nstring.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,346 @@
#include "platform/nstring.hpp"
#include "string.h"
#include "wchar.h"
#include "stdlib.h"
size_t nstring::length(const wchar_t* pstr,int MaxCount)
{
    return !pstr? 0 :  MaxCount? wcsnlen(pstr,MaxCount): wcslen(pstr);
}
size_t nstring::length(const char* pstr,int MaxCount)
{
    return !pstr? 0 :  MaxCount? strnlen(pstr,MaxCount): strlen(pstr);
}
wchar_t* nstring::clone(const wchar_t* psrc)
{
    return !psrc? nullptr: _wcsdup(psrc);
}
char* nstring::clone(const char* psrc)
{
    return !psrc? nullptr: _strdup(psrc);
}
size_t nstring::find(const wchar_t* psrc, const wchar_t* substr,int pos)
{
    return !psrc || !substr ? -1 : wcsstr(psrc+pos,substr)? wcsstr(psrc+pos,substr) - psrc : -1;
}
size_t nstring::find(const char* psrc, const char* substr,int pos)
{
    return !psrc || !substr ? -1 : strstr(psrc+pos,substr)? strstr(psrc+pos,substr) - psrc : -1;
}
const wchar_t* nstring::str(const wchar_t* psrc, const wchar_t* substr)
{
    return !psrc?nullptr:!substr?nullptr:wcsstr(psrc,substr);
}
const char* nstring::str(const char* psrc, const char* substr)
{
    return !psrc?nullptr:!substr?nullptr:strstr(psrc,substr);
}
wchar_t * nstring::set(wchar_t * psrc, int val)
{
    return _wcsset(psrc,val);
}
char * nstring::set(char * psrc, int val)
{
    return _strset(psrc,val);
}
wchar_t* nstring::ncpy(wchar_t* pdest, const wchar_t* psrc,int nlen)
{
    return !pdest? nullptr : !psrc?pdest: wcsncpy(pdest,psrc,nlen);
}
char* nstring::ncpy(char* pdest, const char* psrc,int nlen)
{
    return !pdest? nullptr : !psrc?pdest: strncpy(pdest,psrc,nlen);
}
wchar_t* nstring::cpy(wchar_t* pdest, const wchar_t* psrc)
{
    return !pdest? nullptr : !psrc?pdest: wcscpy(pdest,psrc);
}
char* nstring::cpy(char* pdest, const char* psrc)
{
    return !pdest? nullptr : !psrc?pdest: strcpy(pdest,psrc);
}
int nstring::cmp(const wchar_t* pstr1,const wchar_t* pstr2,int MaxCount)
{
    return !pstr1 && !pstr2? 0: !pstr1? 1:!pstr2?-1:MaxCount? wcsncmp(pstr1,pstr2,MaxCount): wcscmp(pstr1,pstr2);
}
int nstring::cmp(const char* pstr1,const char* pstr2,int MaxCount)
{
    return !pstr1 && !pstr2? 0: !pstr1? 1:!pstr2?-1:MaxCount? strncmp(pstr1,pstr2,MaxCount): strcmp(pstr1,pstr2);
}
int nstring::icmp(const wchar_t* pstr1,const wchar_t* pstr2,int MaxCount)
{
     return !pstr1 && !pstr2? 0: !pstr1? 1:!pstr2?-1:MaxCount? _wcsnicmp(pstr1,pstr2,MaxCount): _wcsicmp(pstr1,pstr2);
}
int nstring::icmp(const char* pstr1,const char* pstr2,int MaxCount)
{
    return !pstr1 && !pstr2? 0: !pstr1? 1:!pstr2?-1:MaxCount? _strnicmp(pstr1,pstr2,MaxCount): _stricmp(pstr1,pstr2);
}
wchar_t* nstring::cat(wchar_t* pdest, wchar_t* psrc,int MaxCount)
{
   return !pdest? nullptr:!psrc? pdest: MaxCount? wcsncat(pdest,psrc,MaxCount): wcscat(pdest,psrc);
}
char* nstring::cat(char* pdest, char* psrc,int MaxCount)
{
     return !pdest? nullptr:!psrc? pdest: MaxCount? strncat(pdest,psrc,MaxCount): strcat(pdest,psrc);
}
const wchar_t* nstring::chr(const wchar_t* psrc, int val)
{
    return !psrc?nullptr: wcschr(psrc,val);
}
const char* nstring::chr(const char* psrc, int val)
{
    return !psrc?nullptr: strchr(psrc,val);
}
int nstring::coll(const wchar_t* pstr1,const wchar_t* pstr2)
{
     return !pstr1 && !pstr2? 0: !pstr1? 1:!pstr2?-1: wcscoll(pstr1,pstr2);
}
int nstring::coll(const char* pstr1,const char* pstr2)
{
    return !pstr1 && !pstr2? 0: !pstr1? 1:!pstr2?-1: strcoll(pstr1,pstr2);
}
size_t nstring::cspn(const wchar_t *_Str,const wchar_t *_Control)
{
    return !_Str||!_Control?-1: wcscspn(_Str,_Control);
}
size_t nstring::cspn(const char *_Str,const char *_Control)
{
    return !_Str||!_Control?-1: strcspn(_Str,_Control);
}
wchar_t * nstring::error(const wchar_t *_ErrMsg)
{
    return !_ErrMsg?nullptr: __wcserror(_ErrMsg);
}
char * nstring::error(const char *_ErrMsg)
{
    return !_ErrMsg?nullptr: _strerror(_ErrMsg);
}
wchar_t * nstring::toLower(wchar_t *_Str)
{
    return !_Str?nullptr: _wcslwr(_Str);
}
wchar_t * nstring::toUpper(wchar_t *_Str)
{
    return !_Str?nullptr: _wcsupr(_Str);
}
char* nstring::toLower(char* _Str)
{
    return !_Str ? nullptr : _strlwr(_Str);
}
char* nstring::toUpper(char* _Str)
{
    return !_Str ? nullptr : _strupr(_Str);
}
const wchar_t * nstring::pbrk(const wchar_t *_Str,const wchar_t *_Control)
{
    return !_Str||!_Control?nullptr:!_Str?nullptr:!_Control?nullptr: wcspbrk(_Str,_Control);
}
const char * nstring::pbrk(const char *_Str,const char *_Control)
{
    return !_Str||!_Control?nullptr:!_Str?nullptr:!_Control?nullptr: strpbrk(_Str,_Control);
}
wchar_t * nstring::rev(wchar_t *_Str)
{
    return !_Str?nullptr: _wcsrev(_Str);
}
char * nstring::rev(char *_Str)
{
    return !_Str?nullptr: _strrev(_Str);
}
int nstring::toInt(wchar_t *_Str)
{
    return !_Str?0:_wtol(_Str);
}
int nstring::toInt64(wchar_t* _Str)
{
    return !_Str ? 0 : _wtoll(_Str);
}
double nstring::toDouble(wchar_t* _Str)
{
    return !_Str ? 0 : ::_wtof(_Str);
}
int nstring::toInt(char *_Str)
{
    return !_Str?0:atol(_Str);
}
int nstring::toInt64(char* _Str)
{
    return !_Str ? 0 : atoll(_Str);
}
double nstring::toDouble(char* _Str)
{
    return !_Str ? 0 : atof(_Str);
}
wchar_t * nstring::toWStr(int val)
{
    wchar_t buf[64];
    _ltow_s(val,buf,10);
    return _wcsdup(buf);
}
wchar_t * nstring::toWStr(double val)
{
    wchar_t buf[64];
    swprintf_s(buf,L"%f",val);
    return _wcsdup(buf);
}
wchar_t * nstring::toWStr(int val,wchar_t* buffer, int maxLen)
{
    _ltow_s(val,buffer,maxLen,10);
    return buffer;
}
wchar_t * nstring::toWStr(double val,wchar_t* buffer, int maxLen)
{
    swprintf_s(buffer,maxLen,L"%f",val);
    return buffer;
}
wchar_t* nstring::toWStr(LPARAM val)
{
    wchar_t buf[64];
    //swprintf_s(buf,L"%l64d",(__int64)val);
    _i64tow_s((long long)val, buf, 64, 10);
    return _wcsdup(buf);
}
wchar_t* nstring::toWStr(LPARAM val,wchar_t* buffer, int maxLen)
{
    _i64tow_s((long long)val, buffer, maxLen, 10);
    //swprintf_s(buffer,maxLen,L"%l64d",(__int64)val);
    return buffer;
}
wchar_t* nstring::trim(wchar_t* pstr)
{
    if (!pstr)return 0;
    wchar_t* p = pstr;
    while (p && p[0] == ' ' || p[0] == '\t' || p[0] == '\n')p++;
    p = _wcsdup(p);
    int nlen = (int)wcslen(p);
    while (nlen > 1 && p[nlen - 1] == ' ' || p[nlen - 1] == '\t' || p[nlen - 1] == '\n')nlen--;
    p[nlen] = 0;
    return p;
}
wchar_t* nstring::ltrim(wchar_t* pstr)
{
    if (!pstr)return 0;
    wchar_t* p = pstr;
    while (p && p[0] == ' ' || p[0] == '\t' || p[0] == '\n')p++;
    return _wcsdup(p);;
}
wchar_t* nstring::rtrim(wchar_t* pstr)
{
    if (!pstr)return 0;
    wchar_t* p = _wcsdup(pstr);
    int nlen = (int)wcslen(p);
    while (nlen > 1 && p[nlen - 1] == ' ' || p[nlen - 1] == '\t' || p[nlen - 1] == '\n')nlen--;
    p[nlen] = 0;
    return p;
}
char* nstring::trim(char* pstr)
{
    if (!pstr)return 0;
    char* p = pstr;
    while (p && p[0] == ' ' || p[0] == '\t' || p[0] == '\n')p++;
    p = _strdup(p);
    int nlen = (int)strlen(p);
    while (nlen > 1 && p[nlen - 1] == ' ' || p[nlen - 1] == '\t' || p[nlen - 1] == '\n')nlen--;
    p[nlen] = 0;
    return p;
}
char* nstring::ltrim(char* pstr)
{
    if (!pstr)return 0;
    char* p = pstr;
    while (p && p[0] == ' ' || p[0] == '\t' || p[0] == '\n')p++;
    return _strdup(p);;
}
char* nstring::rtrim(char* pstr)
{
    if (!pstr)return 0;
    char* p = _strdup(pstr);
    int nlen = (int)strlen(p);
    while (nlen > 1 && p[nlen - 1] == ' ' || p[nlen - 1] == '\t' || p[nlen - 1] == '\n')nlen--;
    p[nlen] = 0;
    return p;
}
wchar_t* nstring::trim_(wchar_t* pstr,wchar_t* dest)
{
    if (!pstr)return 0;
    wchar_t* p = pstr;
    while (p && p[0] == ' ' || p[0] == '\t' || p[0] == '\n')p++;
    wcscpy(dest,p);
    p = dest;
    int nlen = (int)wcslen(p);
    while (nlen > 1 && p[nlen - 1] == ' ' || p[nlen - 1] == '\t' || p[nlen - 1] == '\n')nlen--;
    p[nlen] = 0;
    return p;
}
wchar_t* nstring::ltrim_(wchar_t* pstr, wchar_t* dest)
{
    if (!pstr)return 0;
    wchar_t* p = pstr;
    while (p && p[0] == ' ' || p[0] == '\t' || p[0] == '\n')p++;
    wcscpy(dest, p);
    return dest;
}
wchar_t* nstring::rtrim_(wchar_t* pstr, wchar_t* dest)
{
    if (!pstr)return 0;
    wchar_t* p = dest;
    int nlen = (int)wcslen(p);
    while (nlen > 1 && p[nlen - 1] == ' ' || p[nlen - 1] == '\t' || p[nlen - 1] == '\n')nlen--;
    p[nlen] = 0;
    return p;
}
jrj/xframe/src/nstring.obj
Binary files differ
jrj/xframe/src/win.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,178 @@
#include "win32/win.hpp"
#if 0
#define WINAPI   __stdcall
extern "C"
{
    void *  WINAPI  LoadLibraryW(const wchar_t* lpText);
    bool  WINAPI FreeLibrary(void *  hModule);
    void *  WINAPI  GetProcAddressW(void* hModule, const char* lpText);
    LPARAM WINAPI  GetPropW(HWND  hWnd,string  lpString);
    HWND WINAPI  GetParent(HWND) ;
    LRESULT WINAPI MessageBoxW(HWND hWnd,string title,string caption,int button );
    LRESULT WINAPI MessageBoxA(HWND hWnd,const char* title,const char* caption,int button );
    LRESULT WINAPI SendMessage(HWND hWnd,int msg,WPARAM wparam,LPARAM lparam) ;
    LRESULT WINAPI PostMessage(HWND hWnd,int msg,WPARAM wparam,LPARAM lparam) ;
    HDC WINAPI GetDC(HWND hWnd) ;//native from "user32.dll" alias "GetDC";
    int WINAPI ReleaseDC(HWND hWnd,int hDC) ;//native from "user32.dll" alias "ReleaseDC";
    HWND WINAPI GetChild(HWND hWnd,int uCmd) ;//native from "user32.dll" alias "GetChild";
    int WINAPI GetWindowTextW(HWND hWnd,string str,int nMaxCount) ;//native from "user32.dll" alias "GetWindowTextW";
    int WINAPI SetWindowTextW(HWND hWnd,string str) ;//native from "user32.dll" alias "SetWindowTextW";
    int WINAPI GetWindowTextLengthW(HWND hWnd) ;//native from "user32.dll" alias "GetWindowTextLengthW";
    int WINAPI EnableWindow(HWND hWnd,bool abled) ;//native from "user32.dll" alias "EnableWindow";
    int WINAPI SetFocus(HWND hWnd) ;//native from "user32.dll" alias "SetFocus";
    HWND WINAPI GetFocus() ;//native from "user32.dll" alias "GetFocus";
    int WINAPI IsWindowVisible(HWND hWnd) ;//native from "user32.dll" alias "IsWindowVisible";
    //int WINAPI GetLocalTime(ref dwtime dt)  ;//native from "Kernel32.dll" alias "GetLocalTime";
    bool WINAPI AnimateWindow(HWND hWnd,int dwTime,int dwFlags) ;//native from "user32.dll" alias "AnimateWindow";
    int WINAPI GetKeyState(int nVirtKey) ;//native from "user32.dll" alias "GetKeyState";
    int WINAPI SetWindowLong(HWND hWnd, int nIndex, int dwNewLong) ;//native from "user32.dll" alias "SetWindowLongW";
    LPARAM WINAPI GetWindowLong(HWND hWnd, int nIndex) ;//native from "user32.dll" alias "GetWindowLongW";
    int WINAPI GetClientRect(HWND hWnd, xrect & lpRect) ;//native from "user32.dll" alias "GetClientRect";
    int WINAPI GetWindowRect(HWND hWnd, xrect & lpRect) ;//native from "user32.dll" alias "GetWindowRect";
    int WINAPI MoveWindow(HWND hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint) ;//native from "user32.dll" alias "MoveWindow";
    int WINAPI GetCursorPos(/*manage*/xpoint & IpPoint) ;//native from "user32.dll" alias "GetCursorPos";
    int WINAPI SetCursorPos(int X, int Y) ;//native from "user32.dll" alias "SetCursorPos";
    int WINAPI SetParent(HWND hWndChild,HWND hWndNewParent) ;//native from "user32.dll" alias "SetParent";
    int WINAPI SetWindowPos(HWND hWnd, HWND hWndlnsertAfter,int X,int Y,int cx, int cy,int  Flags) ;//native from "user32.dll" alias "SetWindowPos";
    int WINAPI CreateWindowEx(int dwExStyle,string IpClassName,string lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, int hMenu, int hInstance, int lpParam) ;//native from "user32.dll" alias "CreateWindowExW";
    int WINAPI ScrollWindow(HWND hWnd, int XAmount, int YAmount, xrect IpRect, xrect lpClipRect) ;//native from "user32.dll" alias "ScrollWindow";
    int WINAPI ShowWindow(HWND hWnd, int nCmdShow) ;//native from "user32.dll" alias "ShowWindow";
    int WINAPI WindowFromPoint(int xPoint, int yPoint) ;//native from "user32.dll" alias "WindowFromPoint";
    int WINAPI SetClassLongW(HWND hWnd,int nlndex,int dwNewLong) ;//native from "user32.dll" alias "SetClassLongW";
    int WINAPI ScreenToClient(HWND hWnd, xpoint lpPoint) ;//native from "user32.dll" alias "ScreenToClient";
    int WINAPI GetCursor() ;//native from "user32.dll" alias "GetCursor";
    int WINAPI GetPinYinLeader(string & ,string) ;//native from "pinyin.dll" alias "GetPinYinLeader";
    int WINAPI SetTextColor(int hdc, int crColor ) ;//native from "gdi32.dll" alias "SetTextColor";
    int WINAPI SetCapture(HWND hWnd) ;//native from "user32.dll" alias "SetCapture";
    int WINAPI SetTimer(HWND hWnd, int nIDEvent, int uElapse, int lpTimerFunc) ;//native from "user32.dll" alias "SetTimer";
    int WINAPI KillTimer(HWND hWnd, int nIDEvent) ;//native from "user32.dll" alias "KillTimer";
    HWND WINAPI FindWindowExW(HWND hWndParent, HWND hWndChildAfter, string lpszClass, string lpszWindow) ;//native from "user32.dll" alias "FindWindowExW";
    int WINAPI DestroyWindow(HWND hWnd) ;//native from "user32.dll" alias "DestroyWindow";
    HMENU WINAPI CreatePopupMenu() ;//native from "user32.dll" alias "CreatePopupMenu";
    bool WINAPI AppendMenuW(HMENU hMenu, int uFlags, int uIDNewltem, string lpNewltem) ;//native from "user32.dll" alias "AppendMenuW";
    bool WINAPI TrackPopupMenu(HMENU hMenu, int uFlags, int x, int y, int nReserved, HWND hWnd, xrect prcRect) ;//native from "user32.dll" alias "TrackPopupMenu";
    //int WINAPI CallWindowProc(int OldWProc,HWND hWnd,int uMsg,param wParam,param lParam) ;//native from "user32.dll" alias "CallWindowProcW";
    int WINAPI InvalidateRect(HWND hWnd,xrect & lpRect, bool bErase) ;//native from "user32.dll" alias "InvalidateRect";
    int WINAPI Sleep(int dwMilliseconds) ;//native from "kernel32.dll" alias "Sleep";
    int WINAPI DestroyWindow(HWND hWnd) ;//native from "user32.dll" alias "DestroyWindow";
    int WINAPI GetClassNameW(HWND hWnd,string str,int nMaxCount) ;//native from "user32.dll" alias "GetClassNameW";
    int WINAPI GetDeviceCaps(HWND hWnd,int HORZRES) ;//native from "user32.dll" alias "GetDeviceCaps";
    int WINAPI GetComputerName(string name , int len) ;//native from "kernel32.dll" alias "GetComputerName";
    int WINAPI IsWindow(HWND hWnd) ;//native from "user32.dll" alias "IsWindow";
    int WINAPI GetCurrentDirectory(int nBufferLength, string lpBuffer) ;//native from "kernel32.dll" alias "GetCurrentDirectory";
    int WINAPI ShellExecuteW(HWND hWnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd) ;//native from "shell32.dll" alias "ShellExecuteW";
    int WINAPI DeleteFile(string lpFileName) ;//native from "Shlwapi.dll" alias "DeleteFileW";
    bool WINAPI PathFileExists(string lpFileName) ;//native from "shlwapi.dll" alias "PathFileExistsW";
    int WINAPI CreateDirectory(string lpFileName, string lpFileAttributes) ;//native from "kernel32.dll" alias "CreateDirectoryW";
    //bool WINAPI SystemParametersinfo(int uiAction,int uiParam,param pvParam,int fWinlni) ;//native from "user32.dll" alias "SystemParametersinfo";
    int WINAPI GetSystemMetrics(int nIndex) ;//native from "user32.dll" alias "GetSystemMetrics";
    HWND WINAPI FindWindowW(string lpClassName, string lpWindowName);//native from "user32.dll" alias "FindWindowW";
    int WINAPI GetTempPathW(int NAME_LEN,string & OutPath) ;//native from "kernel32.dll" alias "GetTempPathW";
    int WINAPI GetModuleHandleW(string lpModuleName) ;//native from "kernel32.dll" alias "GetModuleHandleW";
    int WINAPI GetModuleFileName(int hModule ,string & lpFileName ,int nSize ) ;//native from "kernel32.dll" alias "GetModuleFileName";
    void WINAPI GetLocalTime(SYSTEMTIME& lpSystemTime) ;//native from "kernel32.dll" alias "GetLocalTime";
}
#endif
#if 0
namespace win32
{
    void *  LoadLibrary(const wchar_t* lpText)
    {
        return ::LoadLibraryW(lpText);
    }
    bool  FreeLibrary(void *  hModule)
    {
        return ::FreeLibrary(hModule);
    }
    void *  GetProcAddress(void* hModule, const char* lpText)
    {
        return ::GetProcAddressW(hModule,lpText);
    }
    LPARAM  GetPropW(HWND  hWnd,string  lpString)
    {
    }
    HWND  GetParent(HWND) ;
    LRESULT MessageBoxW(HWND hWnd,string title,string caption,int button );
    LRESULT MessageBoxA(HWND hWnd,const char* title,const char* caption,int button );
    LRESULT SendMessage(HWND hWnd,int msg,WPARAM wparam,LPARAM lparam) ;
    LRESULT PostMessage(HWND hWnd,int msg,WPARAM wparam,LPARAM lparam) ;
    HDC GetDC(HWND hWnd) ;//native from "user32.dll" alias "GetDC";
    int ReleaseDC(HWND hWnd,int hDC) ;//native from "user32.dll" alias "ReleaseDC";
    HWND GetChild(HWND hWnd,int uCmd) ;//native from "user32.dll" alias "GetChild";
    int GetWindowTextW(HWND hWnd,string str,int nMaxCount) ;//native from "user32.dll" alias "GetWindowTextW";
    int SetWindowTextW(HWND hWnd,string str) ;//native from "user32.dll" alias "SetWindowTextW";
    int GetWindowTextLengthW(HWND hWnd) ;//native from "user32.dll" alias "GetWindowTextLengthW";
    int EnableWindow(HWND hWnd,bool abled) ;//native from "user32.dll" alias "EnableWindow";
    int SetFocus(HWND hWnd) ;//native from "user32.dll" alias "SetFocus";
    HWND GetFocus() ;//native from "user32.dll" alias "GetFocus";
    int IsWindowVisible(HWND hWnd) ;//native from "user32.dll" alias "IsWindowVisible";
    //int GetLocalTime(ref dwtime dt)  ;//native from "Kernel32.dll" alias "GetLocalTime";
    bool AnimateWindow(HWND hWnd,int dwTime,int dwFlags) ;//native from "user32.dll" alias "AnimateWindow";
    int GetKeyState(int nVirtKey) ;//native from "user32.dll" alias "GetKeyState";
    int SetWindowLong(HWND hWnd, int nIndex, int dwNewLong) ;//native from "user32.dll" alias "SetWindowLongW";
    LPARAM GetWindowLong(HWND hWnd, int nIndex) ;//native from "user32.dll" alias "GetWindowLongW";
    int GetClientRect(HWND hWnd, xrect & lpRect) ;//native from "user32.dll" alias "GetClientRect";
    int GetWindowRect(HWND hWnd, xrect & lpRect) ;//native from "user32.dll" alias "GetWindowRect";
    int MoveWindow(HWND hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint) ;//native from "user32.dll" alias "MoveWindow";
    int GetCursorPos(/*manage*/xpoint & IpPoint) ;//native from "user32.dll" alias "GetCursorPos";
    int SetCursorPos(int X, int Y) ;//native from "user32.dll" alias "SetCursorPos";
    int SetParent(HWND hWndChild,HWND hWndNewParent) ;//native from "user32.dll" alias "SetParent";
    int SetWindowPos(HWND hWnd, HWND hWndlnsertAfter,int X,int Y,int cx, int cy,int  Flags) ;//native from "user32.dll" alias "SetWindowPos";
    int CreateWindowEx(int dwExStyle,string IpClassName,string lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, int hMenu, int hInstance, int lpParam) ;//native from "user32.dll" alias "CreateWindowExW";
    int ScrollWindow(HWND hWnd, int XAmount, int YAmount, xrect IpRect, xrect lpClipRect) ;//native from "user32.dll" alias "ScrollWindow";
    int ShowWindow(HWND hWnd, int nCmdShow) ;//native from "user32.dll" alias "ShowWindow";
    int WindowFromPoint(int xPoint, int yPoint) ;//native from "user32.dll" alias "WindowFromPoint";
    int SetClassLongW(HWND hWnd,int nlndex,int dwNewLong) ;//native from "user32.dll" alias "SetClassLongW";
    int ScreenToClient(HWND hWnd, xpoint lpPoint) ;//native from "user32.dll" alias "ScreenToClient";
    int GetCursor() ;//native from "user32.dll" alias "GetCursor";
    int GetPinYinLeader(string & ,string) ;//native from "pinyin.dll" alias "GetPinYinLeader";
    int SetTextColor(int hdc, int crColor ) ;//native from "gdi32.dll" alias "SetTextColor";
    int SetCapture(HWND hWnd) ;//native from "user32.dll" alias "SetCapture";
    int SetTimer(HWND hWnd, int nIDEvent, int uElapse, int lpTimerFunc) ;//native from "user32.dll" alias "SetTimer";
    int KillTimer(HWND hWnd, int nIDEvent) ;//native from "user32.dll" alias "KillTimer";
    HWND FindWindowExW(HWND hWndParent, HWND hWndChildAfter, string lpszClass, string lpszWindow) ;//native from "user32.dll" alias "FindWindowExW";
    int DestroyWindow(HWND hWnd) ;//native from "user32.dll" alias "DestroyWindow";
    HMENU CreatePopupMenu() ;//native from "user32.dll" alias "CreatePopupMenu";
    bool AppendMenuW(HMENU hMenu, int uFlags, int uIDNewltem, string lpNewltem) ;//native from "user32.dll" alias "AppendMenuW";
    bool TrackPopupMenu(HMENU hMenu, int uFlags, int x, int y, int nReserved, HWND hWnd, xrect prcRect) ;//native from "user32.dll" alias "TrackPopupMenu";
    //int CallWindowProc(int OldWProc,HWND hWnd,int uMsg,param wParam,param lParam) ;//native from "user32.dll" alias "CallWindowProcW";
    int InvalidateRect(HWND hWnd,xrect & lpRect, bool bErase) ;//native from "user32.dll" alias "InvalidateRect";
    int Sleep(int dwMilliseconds) ;//native from "kernel32.dll" alias "Sleep";
    int DestroyWindow(HWND hWnd) ;//native from "user32.dll" alias "DestroyWindow";
    int GetClassNameW(HWND hWnd,string str,int nMaxCount) ;//native from "user32.dll" alias "GetClassNameW";
    int GetDeviceCaps(HWND hWnd,int HORZRES) ;//native from "user32.dll" alias "GetDeviceCaps";
    int GetComputerName(string name , int len) ;//native from "kernel32.dll" alias "GetComputerName";
    int IsWindow(HWND hWnd) ;//native from "user32.dll" alias "IsWindow";
    int GetCurrentDirectory(int nBufferLength, string lpBuffer) ;//native from "kernel32.dll" alias "GetCurrentDirectory";
    int ShellExecuteW(HWND hWnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd) ;//native from "shell32.dll" alias "ShellExecuteW";
    int DeleteFile(string lpFileName) ;//native from "Shlwapi.dll" alias "DeleteFileW";
    bool PathFileExists(string lpFileName) ;//native from "shlwapi.dll" alias "PathFileExistsW";
    int CreateDirectory(string lpFileName, string lpFileAttributes) ;//native from "kernel32.dll" alias "CreateDirectoryW";
    //bool SystemParametersinfo(int uiAction,int uiParam,param pvParam,int fWinlni) ;//native from "user32.dll" alias "SystemParametersinfo";
    int GetSystemMetrics(int nIndex) ;//native from "user32.dll" alias "GetSystemMetrics";
    HWND FindWindowW(string lpClassName, string lpWindowName);//native from "user32.dll" alias "FindWindowW";
    int GetTempPathW(int NAME_LEN,string & OutPath) ;//native from "kernel32.dll" alias "GetTempPathW";
    int GetModuleHandleW(string lpModuleName) ;//native from "kernel32.dll" alias "GetModuleHandleW";
    int GetModuleFileName(int hModule ,string & lpFileName ,int nSize ) ;//native from "kernel32.dll" alias "GetModuleFileName";
    void GetLocalTime(SYSTEMTIME& lpSystemTime) ;//native from "kernel32.dll" alias "GetLocalTime";
}
#endif
jrj/xframe/src/xstring.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,649 @@
#include "wobject/xstring.hpp"
#include "platform/nstring.hpp"
#include "platform/nmemory.hpp"
#include "system/itemalloc.hpp"
#include "win32/win.hpp"
#include <vector>
//#include <new.h>
template<class T>
class KStringBlock
{
private:
    static const unsigned int kShouldFree = 0x1;
    static const unsigned int kShouldSysFree = 0x2;
    static const unsigned int kUTF16 = 0x4;
    static const unsigned int kUTF8 = 0x8;
    static const unsigned int kACP = 0x10;
private:
    union
    {
        T* m_val;
        T  m_buff[16];
    };
    int m_len;
    int m_ref;
    unsigned int flag;
public:
    void AddRef()
    {
        m_ref++;
    }
    void Release()
    {
        m_ref--;
        if (m_ref == 0)
        {
            if (flag & kShouldSysFree)
                ::SysFreeString((BSTR)m_val);
            else if (flag & kShouldFree)
            {
                if(m_len>=16)free(m_val,m_len);
            }
            this->~KStringBlock();
            MyAllocer().free(this);
        }
    }
public:
    const T* str()
    {
        return (m_len<16 && (flag & kShouldSysFree)==0)? (const T*)m_buff : (const T*)m_val;
    }
private:
    KStringBlock() :m_val(nullptr), m_len(0), m_ref(1), flag(0) {}
    KStringBlock(wchar_t* val, bool shouldfree, bool shouldsysfree)
        :m_val(val), m_len(val ? (int)nstring::length(val) : 0), m_ref(1), flag(kUTF16 | (shouldfree ? kShouldFree : 0) | (shouldsysfree ? kShouldSysFree : 0))
    {
    }
    KStringBlock(char* val, bool shouldfree, bool shouldsysfree)
        :m_val(val), m_len(val ? (int)nstring::length(val) : 0), m_ref(1), flag(kACP | (shouldfree ? kShouldFree : 0) | (shouldsysfree ? kShouldSysFree : 0))
    {
    }
    ~KStringBlock()
    {
    }
    void initial()
    {
        m_val =nullptr;
        m_len = 0;
        m_ref=1;
        flag = kShouldFree | kUTF16;
    }
public:
    static ItemAlloc<T[32], 4096>* stringBlock32;
    static ItemAlloc<T[64], 4096>* stringBlock64;
    static ItemAlloc<T[128], 4096>* stringBlock128;
    static ItemAlloc<T[256], 4096>* stringBlock256;
    static ItemAlloc<KStringBlock<T>, 4096>* stringBlockMgr;
public:
    static ItemAlloc<KStringBlock<T>, 4096>& MyAllocer()
    {
        //static ItemAlloc<KStringBlock<T>, 4096> stringBlockMgr;
        //ItemAlloc<KStringBlock<T>, 4096>* stringBlockMgr=new (ItemAlloc<KStringBlock<T>, 4096>);
        if(!stringBlockMgr)stringBlockMgr=new ItemAlloc<KStringBlock<T>, 4096>();
        return *stringBlockMgr;
    }
    static KStringBlock<wchar_t>* make()
    {
        KStringBlock<wchar_t> * p =  MyAllocer().alloc();
        p->initial();
        return p;
    }
    static KStringBlock<char>* make(char* value, bool shouldSysFree)
    {
        if(!value)return nullptr;
        int len = nstring::length(value);
        KStringBlock<char> * p =  MyAllocer().alloc();
        //p = new (p) KStringBlock<char>();
        p->initial();
        p->flag = kACP | kShouldFree;
        p->m_len = len;
        if(shouldSysFree)
        {
            m_val = value;
            if(shouldSysFree) p->flag |= kShouldSysFree;
        }else
        {
            if(len<16)
                nstring::cpy(m_buff,value);
            else
            {
                m_val = p->alloc(m_len+1);
                nstring::cpy(m_val,value);
            }
        }
        return p;
    }
    static KStringBlock<wchar_t>* make(wchar_t* value, bool shouldSysFree)
    {
        if(!value)return nullptr;
        int len = nstring::length(value);
        KStringBlock<wchar_t> * p =  MyAllocer().alloc();
        //p = new (p) KStringBlock<wchar_t>();
        p->initial();
        p->flag = kUTF16 | kShouldFree;
        p->m_len =len;
        if(shouldSysFree)
        {
            p->m_val = value;
            if(shouldSysFree) p->flag |= kShouldSysFree;
        }else
        {
            if(len<16)
                nstring::cpy(p->m_buff,value);
            else
            {
                p->m_val = p->alloc(p->m_len+1);
                nstring::cpy(p->m_val,value);
            }
        }
        return p;
    }
    static KStringBlock<wchar_t>* make(int value)
    {
        int len = 15;
        KStringBlock<wchar_t> * p =  MyAllocer().alloc();
        //p = new (p) KStringBlock<wchar_t>();
        p->initial();
        p->flag = kUTF16 | kShouldFree;
        p->m_len = len;
        nstring::toWStr(value,p->alloc(p->m_len+1),p->m_len+1);
        return p;
    }
    static KStringBlock<wchar_t>* make(double value)
    {
         int len = 31;
        KStringBlock<wchar_t> * p =  MyAllocer().alloc();
        //p = new (p) KStringBlock<wchar_t>();
        p->initial();
        p->flag = kUTF16 | kShouldFree;
        p->m_len = len;
        nstring::toWStr(value,p->alloc(p->m_len+1),p->m_len+1);
        return p;
    }
    static KStringBlock<wchar_t>* make(LPARAM value)
    {
        int len = 31;
        KStringBlock<wchar_t> * p =  MyAllocer().alloc();
        //p = new (p) KStringBlock<wchar_t>();
        p->initial();
        p->flag = kUTF16 | kShouldFree;
        p->m_len = len;
        nstring::toWStr(value,p->alloc(p->m_len+1),p->m_len+1);
        return p;
    }
public:
    int length()
    {
       return this->m_len;
    }
    T* sure(int size)
    {
        if(size <=0) return nullptr;
        m_len = size - 1;
        if(size < 16) return m_buff;
        m_val = this->alloc(size);
        return m_val;
    }
private:
    T* alloc(int size)
    {
       if(size <= 16) return m_buff;
       if(size <=32)
       {
            if(!stringBlock32)stringBlock32 = new ItemAlloc<wchar_t[32], 4096>;
            return (T*)stringBlock32->alloc();
       }
       if(size <=64)
       {
            if(!stringBlock64)stringBlock64 = new ItemAlloc<wchar_t[64], 4096>;
            return (T*)stringBlock64->alloc();
       }
       if(size <=128)
       {
            if(!stringBlock128)stringBlock128 = new ItemAlloc<wchar_t[128], 4096>;
            return (T*)stringBlock128->alloc();
       }
       if(size <=256)
       {
            if(!stringBlock256)stringBlock256 = new ItemAlloc<wchar_t[256], 4096>;
            return (T*)stringBlock256->alloc();
       }
       return new T[size];
    }
    void free(T* p, int size)
    {
       if(!p) return;
       if(p==m_buff) return;
       if(size <32)return stringBlock32->free(p);
       if(size <64)return stringBlock64->free(p);
       if(size <128)return stringBlock128->free(p);
       if(size <256)return stringBlock256->free(p);
       return delete p;
    }
 };
template<> ItemAlloc<wchar_t[32], 4096>* KStringBlock<wchar_t>::stringBlock32 = 0;
template<> ItemAlloc<wchar_t[64], 4096>* KStringBlock<wchar_t>::stringBlock64 = 0;
template<> ItemAlloc<wchar_t[128], 4096>* KStringBlock<wchar_t>::stringBlock128 = 0;
template<> ItemAlloc<wchar_t[256], 4096>* KStringBlock<wchar_t>::stringBlock256 = 0;
template<> ItemAlloc<KStringBlock<wchar_t>, 4096>* KStringBlock<wchar_t>::stringBlockMgr = 0;
xstring::xstring() :data(nullptr)
{
}
xstring::xstring(const xstring& rhs):data(rhs.data)
{
    if(rhs.data)((KStringBlock<wchar_t>*)rhs.data)->AddRef();
}
xstring::xstring(wchar_t* val, bool shouldSysFree) :data(KStringBlock<wchar_t>::make(val,shouldSysFree))
{
}
xstring::xstring(const wchar_t* val, bool shouldSysFree):data(KStringBlock<wchar_t>::make((wchar_t*)val,shouldSysFree))
{
}
xstring::xstring(int val):data((KStringBlock<wchar_t>::make(val)))
{
}
xstring::xstring(double val):data((KStringBlock<wchar_t>::make(val)))
{
}
xstring::xstring(LPARAM val):data((KStringBlock<wchar_t>::make(val)))
{
}
xstring::~xstring()
{
    if(data) ((KStringBlock<wchar_t>*)data)->Release();
}
xstring& xstring::operator =(const xstring& rhs)
{
    if (data)((KStringBlock<wchar_t>*)data)->Release();
    ((KStringBlock<wchar_t>*)rhs.data)->AddRef();
    data = rhs.data;
   return *this;
}
xstring& xstring::operator =(const wchar_t* rhs)
{
    if (data)((KStringBlock<wchar_t>*)data)->Release();
    data = KStringBlock<wchar_t>::make((wchar_t*)rhs,false);
    return *this;
}
bool xstring::isEmpty()
{
    if(!data) return true;
    const wchar_t* str = ((KStringBlock<wchar_t>*)data)->str();
    if(!str)return true;
    if(str[0]==0)return true;
    return false;
}
bool xstring::operator ==(const wchar_t* rhs)
{
    bool rhsEmpty = !rhs || rhs[0]==0;
    if(rhsEmpty && isEmpty()) return true;
    if(rhsEmpty != isEmpty()) return false;
    return nstring::cmp(c_str(),rhs)==0;
}
bool xstring::operator >=(const wchar_t* rhs)
{
    bool rhsEmpty = !rhs || rhs[0]==0;
    if(rhsEmpty) return true;
    if(isEmpty()) return false;
    return nstring::cmp(c_str(),rhs)>=0;
}
bool xstring::operator >(const wchar_t* rhs)
{
    bool rhsEmpty = !rhs || rhs[0]==0;
    if(rhsEmpty) return isEmpty()?false:true;
    if(isEmpty())return false;
    return nstring::cmp(c_str(),rhs)>0;
}
bool xstring::operator <=(const wchar_t* rhs)
{
    return !this->operator >(rhs);
}
bool xstring::operator <(const wchar_t* rhs)
{
    return !this->operator >=(rhs);
}
bool xstring::operator !=(const wchar_t* rhs)
{
    return !operator ==(rhs);
}
bool xstring::operator ==(const xstring& rhs)
{
    return operator==(rhs.c_str());
}
bool xstring::operator >=(const xstring& rhs)
{
    return operator>=(rhs.c_str());
}
bool xstring::operator >(const xstring& rhs)
{
    return operator>(rhs.c_str());
}
bool xstring::operator <=(const xstring& rhs)
{
    return operator<=(rhs.c_str());
}
bool xstring::operator <(const xstring& rhs)
{
    return operator<(rhs.c_str());
}
bool xstring::operator !=(const xstring& rhs)
{
    return operator!=(rhs.c_str());
}
xstring::operator bool()
{
    return this->isEmpty();
}
const wchar_t* xstring::c_str(bool bclone) const{
    if(!data) return nullptr;
    const wchar_t* val = ((KStringBlock<wchar_t>*)data)->str();
    return bclone ? nstring::clone(val) : val;
}
int xstring::length()
{
    if(!data) return 0;
    if (c_str())return nstring::length(c_str());
    return 0;
    //return ((KStringBlock<wchar_t>*)data)->length();
}
wchar_t xstring::at(int index)
{
    if(index < 0) return 0;
    if(isEmpty()) return 0;
    if(index >= length()) return 0;
    return c_str()[index];
}
xstring xstring::concat(xstring && rhs)
{
    return concat(rhs.c_str());
}
xstring xstring::concat(const wchar_t* rhs)
{
    if(!rhs) return *this;
    xstring xs;
    KStringBlock<wchar_t>* pdata = KStringBlock<wchar_t>::make();
    xs.data = pdata;
    int len = length()+nstring::length(rhs);
    wchar_t* buffer = pdata->sure(len+1);
    if(length())nstring::cpy(buffer,c_str());
    if(rhs)nstring::cpy(buffer +length(), rhs);
    return xs;
}
xstring xstring::operator +(const wchar_t* rhs)
{
    return concat(rhs);
}
xstring xstring::operator +(xstring rhs)
{
    return concat(rhs.c_str());
}
int xstring::find(const xstring & str)
{
    return find(str.c_str());
}
int xstring::find(const wchar_t* str)
{
    if (!str)return -1;
    if (!data)return -1;
    const wchar_t* p = nstring::str(c_str(), str);
    if(!p) return -1;
    return  p - c_str();
}
int xstring::find(const wchar_t* str,int pos)
{
    if (!str)return -1;
    if (!data)return -1;
    if(pos >= nstring::length(c_str()))return -1;
    const wchar_t* p = nstring::str(c_str()+pos, str);
    if(!p) return -1;
    return  p - c_str();
}
wchar_t* xstring::sure(int len)
{
    KStringBlock<wchar_t>* pdata = KStringBlock<wchar_t>::make();
    this->data = pdata;
    return pdata->sure(len);
}
xstring xstring::mid(int start, int len)
{
    if (!data) return xstring();
    if (nstring::length(c_str()) < start) return xstring();
    len = start + len > nstring::length(c_str()) ? nstring::length(c_str()) - start : len;
    xstring xs;
    wchar_t* buffer = xs.sure(len+1);
    nstring::ncpy(buffer, c_str() + start, len);
    buffer[len] = 0;
    return xs;
}
xstring xstring::left(int len)
{
    if(!data) return xstring();
    if(len<1) return xstring();
    if(len > nstring::length(c_str())) len = nstring::length(c_str());
    xstring xs;
    wchar_t* buffer = xs.sure(len+1);
    nstring::ncpy(buffer,c_str(),len);
    buffer[len] = 0;
    return xs;
}
xstring xstring::right(int len)
{
    if (!data) return xstring();
    if (len < 1) return xstring();
    if (len > nstring::length(c_str())) len = nstring::length(c_str());
    xstring xs;
    wchar_t* buffer = xs.sure(len + 1);
    nstring::ncpy(buffer, c_str() + (nstring::length(c_str()) - len), len);
    buffer[len] = 0;
    return xs;
}
int xstring::toInt()
{
    if (!data)return 0;
    return nstring::toInt((wchar_t*)c_str());
}
__int64 xstring::toInt64()
{
    if (!data)return 0;
    return nstring::toInt64((wchar_t*)c_str());
}
double xstring::toDouble()
{
    return nstring::toDouble((wchar_t*)c_str());
}
xstring xstring::toUpper()
{
    return nstring::toUpper((wchar_t*)c_str());
}
xstring xstring::toLower()
{
    return nstring::toLower((wchar_t*)c_str());
}
xstring& xstring::operator +=(const wchar_t* rhs)
{
    xstring xs = *this;
    *this = xs + rhs;
    return *this;
}
xstring& xstring::operator +=(xstring rhs)
{
    return operator +=(rhs.c_str());
}
xstring xstring::trim()
{
    xstring xs(c_str());
    return xstring(nstring::trim_((wchar_t*)c_str(), (wchar_t*)xs.c_str()));
}
xstring xstring::rtrim()
{
    xstring xs(c_str());
    return xstring(nstring::rtrim_((wchar_t*)c_str(), (wchar_t*)xs.c_str()));
}
xstring xstring::ltrim()
{
    xstring xs(c_str());
    return xstring(nstring::ltrim_((wchar_t*)c_str(), (wchar_t*)xs.c_str()));
}
bool xstring::isNumber()
{
    const wchar_t* val = c_str();
    int len = length();
    int i = 0;
    int cnt = 0;
    int e = 0;
    bool hasNumber = false;
    for (i = 0; i < len; i++)
    {
        wchar_t ch = val[i] & 0xff;
        if (ch >= L'0' && ch <= L'9')
        {
            hasNumber = true;
            continue;
        }
        else if (ch == L'e' || ch == L'E')
        {
            if (e == 0 && hasNumber)
            {
                e = 1;
                hasNumber = false;
                continue;
            }
            else
                return false;
        }
        else if (ch == L'-')
        {
            if (hasNumber) return false;
            hasNumber = true;
            continue;
        }
        else if (ch == L'.')
        {
            if (cnt == 1) return false;
            if (e) return false;
            cnt = 1;
            continue;
        }
        else if (ch == ' ')continue;
        break;
    }
    if (i == len) return true;
    return false;
}
xstring xstring::replace(wchar_t* from, wchar_t* to, int pos)
{
    const wchar_t* pstr = c_str();
    if (!pstr) return 0;
    if (!from[0]) return pstr;
    if (pos < 1) pos = 0;
    int len = (int)nstring::length(from);
    if (len < 0) return pstr;
    std::vector<int> arpos;
    const wchar_t* ptext = pstr;
    ptext = wcsstr(ptext + pos, from);
    if (!ptext) return pstr;
    while (ptext)
    {
        arpos.push_back((int)(ptext - pstr));
        ptext = wcsstr(ptext + len, from);
    }
    int tolen = (int)wcslen(to);
    int inc = ((int)arpos.size()) * (tolen - len);
    int nlen = (int)wcslen(pstr) + inc + 1;
    int start = 0;
    int end = 0;
    wchar_t* p = new  wchar_t[nlen];
    memset(p, 0, nlen * 2);
    wchar_t* np = p;
    arpos.push_back((int)wcslen(pstr));
    for (int i = 0; i < (int)arpos.size(); i++)
    {
        end = arpos[i];
        if (end - start > 0)
        {
            wcsncpy_s(np, end - start + 1, pstr + start, end - start);
            np += end - start;
        }
        if (i != (int)arpos.size() - 1)
        {
            if (tolen)
            {
                wcsncpy_s(np, tolen + 1, to, tolen);
                np += tolen;
            }
        }
        start = end + len;
    }
    return p;
}
xstring operator +(const wchar_t* lhs, const xstring& rhs)
{
    return xstring(lhs).concat(rhs.c_str());
}
jrj/xframe/src/xstring.obj
Binary files differ
jrj/xframe/system/base.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,100 @@
#pragma once
struct xrect
{
    int left;
    int top;
    int right;
    int bottom;
};
struct xrectf
{
    double left;
    double top;
    double right;
    double bottom;
};
struct xpoint
{
    int x;
    int y;
};
struct xpointf
{
    double x;
    double y;
};
typedef const wchar_t* string;
typedef long LONG;
typedef struct HWND__ {} * HWND;
typedef struct HMENU__ {} * HMENU;
typedef struct HDC__ {} * HDC;
typedef void *  HINSTANCE;
typedef wchar_t wchar;
typedef wchar* BSTR;
typedef const wchar_t* LPCTSTR;
typedef wchar_t* LPWSTR;
typedef wchar_t* LPCWSTR;
typedef wchar_t TCHAR;
typedef wchar_t* LPTSTR;
typedef int BOOL;
#define NULL 0
typedef __int64 INT_PTR, *PINT_PTR;
typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
typedef __int64 LONG_PTR, *PLONG_PTR;
typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
typedef UINT_PTR            WPARAM;
typedef LONG_PTR            LPARAM;
typedef LONG_PTR            LRESULT;
typedef char    BYTE;
typedef unsigned short ushort;
typedef unsigned long       DWORD;
typedef DWORD   COLORREF;
struct SYSTEMTIME {
        ushort wYear;
        ushort wMonth;
        ushort wDayOfWeek;
        ushort wDay;
        ushort wHour;
        ushort wMinute;
        ushort wSecond;
        ushort wMilliseconds;
};
typedef struct tagRECT
{
    LONG    left;
    LONG    top;
    LONG    right;
    LONG    bottom;
} RECT, *PRECT, *LPRECT;
typedef const RECT * LPCRECT;
typedef struct tagPOINT
{
    LONG  x;
    LONG  y;
} POINT, *PPOINT,  *LPPOINT;
typedef POINT Point;
typedef struct tagSIZE
{
    LONG        cx;
    LONG        cy;
} SIZE, *PSIZE, *LPSIZE;
jrj/xframe/system/itemalloc.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,78 @@
template<class T, int kPageItems>
class ItemAlloc
{
public:
    struct DataItem
    {
        DataItem* next;
        void* reserve[3];
        T data[kPageItems];
    };
public:
    ItemAlloc() :m_pages(0), first(nullptr), freefirst(nullptr), m_items(0), m_maxitems(0)
    {
        allocPage();
    }
public:
    void* allocPage()
    {
        m_pages++;
        DataItem* tmp = (DataItem *)new char[sizeof(DataItem)];
        //initial
        for (int i = 0; i < kPageItems - 1; i++)
        {
            *(void**)(tmp->data+i) = tmp->data+(i + 1);
        }
        *(void**)&tmp->data[kPageItems - 1] = freefirst;
        tmp->next = first;
        first = tmp;
        freefirst = &tmp->data[0];
        return tmp;
    }
    ~ItemAlloc()
    {
        if (!first)return;
        DataItem* p = first;
        DataItem* next = first->next;
        while (p)
        {
            ::free(p);
            if (!next)break;
            p = next;
            next = p->next;
        }
    }
    T* alloc()
    {
        if (!freefirst)allocPage();
        T* p = freefirst;
        freefirst = (T*)*(void**)p;
        m_items++;
        if(m_items > m_maxitems) m_maxitems++;
        m_ttlitems++;
        return p;
    }
    void destroy(T* p)
    {
        if(p)p->~T();
        free(p);
    }
    void free(void* p )
    {
        m_items--;
        *(void**)p = freefirst;
        freefirst = (T*)p;
    }
public:
    DataItem* first;
    T* freefirst;
public:
    int m_pages;
    int m_items;
    int m_maxitems;
    int m_ttlitems;
};
jrj/xframe/test/1.txt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,198 @@
OVERVIEW: llvm interpreter & dynamic compiler
USAGE: lli.exe [options] <input bitcode> <program arguments>...
OPTIONS:
Color Options:
  --color                                                               - Use colors in output (default=autodetect)
General options:
  -O <char>                                                             - Optimization level. [-O0, -O1, -O2, or -O3] (default = '-O2')
  --addrsig                                                             - Emit an address-significance table
  --align-loops=<uint>                                                  - Default alignment for loops
  --allow-ginsert-as-artifact                                           - Allow G_INSERT to be considered an artifact. Hack around AMDGPU test infinite loops.
  --asm-show-inst                                                       - Emit internal instruction representation to assembly file
  --basic-block-sections=<all | <function list (file)> | labels | none> - Emit basic blocks into separate sections
  --code-model=<value>                                                  - Choose code model
    =tiny                                                               -   Tiny code model
    =small                                                              -   Small code model
    =kernel                                                             -   Kernel code model
    =medium                                                             -   Medium code model
    =large                                                              -   Large code model
  --compile-threads=<uint>                                              - Choose the number of compile threads (jit-kind=orc-lazy only)
  --data-sections                                                       - Emit data into separate sections
  --debug-entry-values                                                  - Enable debug info for the debug entry values.
  --debugger-tune=<value>                                               - Tune debug info for a particular debugger
    =gdb                                                                -   gdb
    =lldb                                                               -   lldb
    =dbx                                                                -   dbx
    =sce                                                                -   SCE targets (e.g. PS4)
  --debugify-func-limit=<ulong>                                         - Set max number of processed functions per pass.
  --debugify-level=<value>                                              - Kind of debug info to add
    =locations                                                          -   Locations only
    =location+variables                                                 -   Locations and Variables
  --debugify-quiet                                                      - Suppress verbose debugify output
  --denormal-fp-math=<value>                                            - Select which denormal numbers the code is permitted to require
    =ieee                                                               -   IEEE 754 denormal numbers
    =preserve-sign                                                      -   the sign of a  flushed-to-zero number is preserved in the sign of 0
    =positive-zero                                                      -   denormals are flushed to positive zero
    =dynamic                                                            -   denormals have unknown treatment
  --denormal-fp-math-f32=<value>                                        - Select which denormal numbers the code is permitted to require for float
    =ieee                                                               -   IEEE 754 denormal numbers
    =preserve-sign                                                      -   the sign of a  flushed-to-zero number is preserved in the sign of 0
    =positive-zero                                                      -   denormals are flushed to positive zero
    =dynamic                                                            -   denormals have unknown treatment
  --disable-auto-upgrade-debug-info                                     - Disable autoupgrade of debug info
  --disable-i2p-p2i-opt                                                 - Disables inttoptr/ptrtoint roundtrip optimization
  --disable-lazy-compilation                                            - Disable JIT lazy compilation
  --disable-tail-calls                                                  - Never emit tail calls
  --dlopen=<string>                                                     - Dynamic libraries to load before linking
  --dot-cfg-mssa=<file name for generated dot file>                     - file name for generated dot file
  --dwarf-version=<int>                                                 - Dwarf version
  --dwarf64                                                             - Generate debugging info in the 64-bit DWARF format
  --emit-call-site-info                                                 - Emit call site debug information, if debug information is enabled.
  --emit-compact-unwind-non-canonical                                   - Whether to try to emit Compact Unwind for non canonical entries.
  --emit-dwarf-unwind=<value>                                           - Whether to emit DWARF EH frame entries.
    =always                                                             -   Always emit EH frame entries
    =no-compact-unwind                                                  -   Only emit EH frame entries when compact unwind is not available
    =default                                                            -   Use target platform default
  --emulated-tls                                                        - Use emulated TLS model
  --enable-approx-func-fp-math                                          - Enable FP math optimizations that assume approx func
  --enable-cache-manager                                                - Use cache manager to save/load modules
  --enable-cse-in-irtranslator                                          - Should enable CSE in irtranslator
  --enable-cse-in-legalizer                                             - Should enable CSE in Legalizer
  --enable-jmc-instrument                                               - Instrument functions with a call to __CheckForDebuggerJustMyCode
  --enable-name-compression                                             - Enable name/filename string compression
  --enable-no-infs-fp-math                                              - Enable FP math optimizations that assume no +-Infs
  --enable-no-nans-fp-math                                              - Enable FP math optimizations that assume no NaNs
  --enable-no-signed-zeros-fp-math                                      - Enable FP math optimizations that assume the sign of 0 is insignificant
  --enable-no-trapping-fp-math                                          - Enable setting the FP exceptions build attribute not to use exceptions
  --enable-unsafe-fp-math                                               - Enable optimizations that may decrease FP precision
  --entry-function=<function>                                           - Specify the entry function (default = 'main') of the executable
  --exception-model=<value>                                             - exception model
    =default                                                            -   default exception handling model
    =dwarf                                                              -   DWARF-like CFI based exception handling
    =sjlj                                                               -   SjLj exception handling
    =arm                                                                -   ARM EHABI exceptions
    =wineh                                                              -   Windows exception model
    =wasm                                                               -   WebAssembly exception handling
  --experimental-debug-variable-locations                               - Use experimental new value-tracking variable locations
  --extra-archive=<input archive>                                       - Extra archive files to be loaded
  --extra-module=<input bitcode>                                        - Extra modules to be loaded
  --extra-object=<input object>                                         - Extra object files to be loaded
  --fake-argv0=<executable>                                             - Override the 'argv[0]' value passed into the executing program
  --fatal-warnings                                                      - Treat warnings as errors
  --filetype=<value>                                                    - Choose a file type (not all types are supported by all targets):
    =asm                                                                -   Emit an assembly ('.s') file
    =obj                                                                -   Emit a native object ('.o') file
    =null                                                               -   Emit nothing, for performance testing
  --float-abi=<value>                                                   - Choose float ABI type
    =default                                                            -   Target default float ABI type
    =soft                                                               -   Soft float ABI (implied by -soft-float)
    =hard                                                               -   Hard float ABI (uses FP registers)
  --force-dwarf-frame-section                                           - Always emit a debug frame section.
  --force-interpreter                                                   - Force interpretation: disable JIT
  --fp-contract=<value>                                                 - Enable aggressive formation of fused FP ops
    =fast                                                               -   Fuse FP ops whenever profitable
    =on                                                                 -   Only fuse 'blessed' FP ops.
    =off                                                                -   Only fuse FP ops when the result won't be affected.
  --frame-pointer=<value>                                               - Specify frame pointer elimination optimization
    =all                                                                -   Disable frame pointer elimination
    =non-leaf                                                           -   Disable frame pointer elimination for non-leaf frame
    =none                                                               -   Enable frame pointer elimination
  --fs-profile-debug-bw-threshold=<uint>                                - Only show debug message if the source branch weight is greater  than this value.
  --fs-profile-debug-prob-diff-threshold=<uint>                         - Only show debug message if the branch probility is greater than this value (in percentage).
  --function-sections                                                   - Emit functions into separate sections
  --generate-merged-base-profiles                                       - When generating nested context-sensitive profiles, always generate extra base profile for function with all its context profiles merged into it.
  --ignore-xcoff-visibility                                             - Not emit the visibility attribute for asm in AIX OS or give all symbols 'unspecified' visibility in XCOFF object file
  --incremental-linker-compatible                                       - When used with filetype=obj, emit an object file which can be used with an incremental linker
  --jd=<string>                                                         - Specifies the JITDylib to be used for any subsequent -extra-module arguments.
  --jit-kind=<value>                                                    - Choose underlying JIT kind.
    =mcjit                                                              -   MCJIT
    =orc                                                                -   Orc JIT
    =orc-lazy                                                           -   Orc-based lazy JIT.
  --jit-linker=<value>                                                  - Choose the dynamic linker/loader.
    =default                                                            -   Default for platform and JIT-kind
    =rtdyld                                                             -   RuntimeDyld
    =jitlink                                                            -   Orc-specific linker
  --load=<pluginfilename>                                               - Load the specified plugin
  --march=<string>                                                      - Architecture to generate code for (see --version)
  --mattr=<a1,+a2,-a3,...>                                              - Target specific attributes (-mattr=help for details)
  --mc-relax-all                                                        - When used with filetype=obj, relax all fixups in the emitted object file
  --mcjit-remote-process=<filename>                                     - Specify the filename of the process to launch for remote MCJIT execution.  If none is specified,
                                                                              remote execution will be simulated in-process.
  --mcpu=<cpu-name>                                                     - Target a specific cpu type (-mcpu=help for details)
  --meabi=<value>                                                       - Set EABI type (default depends on triple):
    =default                                                            -   Triple default EABI version
    =4                                                                  -   EABI version 4
    =5                                                                  -   EABI version 5
    =gnu                                                                -   EABI GNU
  --mir-strip-debugify-only                                             - Should mir-strip-debug only strip debug info from debugified modules by default
  --mtriple=<string>                                                    - Override target triple for module
  --mxcoff-roptr                                                        - When set to true, const objects with relocatable address values are put into the RO data section.
  --no-deprecated-warn                                                  - Suppress all deprecated warnings
  --no-integrated-as                                                    - Disable integrated assembler
  --no-process-syms                                                     - Do not resolve lli process symbols in JIT'd code
  --no-type-check                                                       - Suppress type errors (Wasm)
  --no-warn                                                             - Suppress all warnings
  --nozero-initialized-in-bss                                           - Don't place zero-initialized symbols into bss section
  --object-cache-dir=<string>                                           - Directory to store cached object files (must be user writable)
  --orc-runtime=<string>                                                - Use ORC runtime from given path
  --per-module-lazy                                                     - Performs lazy compilation on whole module boundaries rather than individual functions
  --relax-elf-relocations                                               - Emit GOTPCRELX/REX_GOTPCRELX instead of GOTPCREL on x86-64 ELF
  --relocation-model=<value>                                            - Choose relocation model
    =static                                                             -   Non-relocatable code
    =pic                                                                -   Fully relocatable, position independent code
    =dynamic-no-pic                                                     -   Relocatable external references, non-relocatable code
    =ropi                                                               -   Code and read-only data relocatable, accessed PC-relative
    =rwpi                                                               -   Read-write data relocatable, accessed relative to static base
    =ropi-rwpi                                                          -   Combination of ropi and rwpi
  --remote-mcjit                                                        - Execute MCJIT'ed code in a separate process.
  --sample-profile-check-record-coverage=<N>                            - Emit a warning if less than N% of records in the input profile are matched to the IR.
  --sample-profile-check-sample-coverage=<N>                            - Emit a warning if less than N% of samples in the input profile are matched to the IR.
  --sample-profile-max-propagate-iterations=<uint>                      - Maximum number of iterations to go through when propagating sample block/edge weights through the CFG.
  --soft-float                                                          - Generate software floating point library calls
  --split-machine-functions                                             - Split out cold basic blocks from machine functions based on profile information
  --stack-size-section                                                  - Emit a section containing stack size metadata
  --stack-symbol-ordering                                               - Order local stack symbols.
  --stackrealign                                                        - Force align the stack to the minimum alignment
  --strict-dwarf                                                        - use strict dwarf
  --swift-async-fp=<value>                                              - Determine when the Swift async frame pointer should be set
    =auto                                                               -   Determine based on deployment target
    =always                                                             -   Always set the bit
    =never                                                              -   Never set the bit
  --tailcallopt                                                         - Turn fastcc calls into tail calls by (potentially) changing ABI.
  --thread-entry=<string>                                               - calls the given entry-point on a new thread (jit-kind=orc-lazy only)
  --thread-model=<value>                                                - Choose threading model
    =posix                                                              -   POSIX thread model
    =single                                                             -   Single thread model
  --tls-size=<uint>                                                     - Bit size of immediate TLS offsets
  --unique-basic-block-section-names                                    - Give unique names to every basic block section
  --unique-section-names                                                - Give unique names to every section
  --use-ctors                                                           - Use .ctors instead of .init_array.
  --vec-extabi                                                          - Enable the AIX Extended Altivec ABI.
  --verify-legalizer-debug-locs=<value>                                 - Verify that debug locations are handled
    =none                                                               -   No verification
    =legalizations                                                      -   Verify legalizations
    =legalizations+artifactcombiners                                    -   Verify legalizations and artifact combines
  --x86-align-branch=<string>                                           - Specify types of branches to align (plus separated list of types):
                                                                          jcc      indicates conditional jumps
                                                                          fused    indicates fused conditional jumps
                                                                          jmp      indicates direct unconditional jumps
                                                                          call     indicates direct and indirect calls
                                                                          ret      indicates rets
                                                                          indirect indicates indirect unconditional jumps
  --x86-align-branch-boundary=<uint>                                    - Control how the assembler should align branches with NOP. If the boundary's size is not 0, it should be a power of 2 and no less than 32. Branches will be aligned to prevent from being across or against the boundary of specified size. The default value 0 does not align branches.
  --x86-branches-within-32B-boundaries                                  - Align selected instructions to mitigate negative performance impact of Intel's micro code update for errata skx102.  May break assumptions about labels corresponding to particular instructions, and should be used with caution.
  --x86-pad-max-prefix-size=<uint>                                      - Maximum number of prefixes to use for padding
  --xcoff-traceback-table                                               - Emit the XCOFF traceback table
  --xray-function-index                                                 - Emit xray_fn_idx section
Generic Options:
  --help                                                                - Display available options (--help-hidden for more)
  --help-list                                                           - Display list of available options (--help-list-hidden for more)
  --version                                                             - Display the version of this program
jrj/xframe/test/test01.bc
Binary files differ
jrj/xframe/test/test01.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
#include "wobject/xwin.hpp"
#include "wobject/xstring.hpp"
//#include "stdio.h"
//#include <string>
int main()
{
    xstring xs(L"hello world");
    //std::wstring ws=L"test";
    MessageBoxW(nullptr,L"Caption",L"test",0);
    //printf("hello world\n");
    return 1;
}
jrj/xframe/test/test01.ll
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
; ModuleID = 'test01.cpp'
source_filename = "test01.cpp"
target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc19.38.33133"
$"??_C@_1BA@DDDHLKME@?$AAC?$AAa?$AAp?$AAt?$AAi?$AAo?$AAn?$AA?$AA@" = comdat any
$"??_C@_1BK@IOBBFFJ@?$AAh?$AAe?$AAl?$AAl?$AAo?$AA?5?$AAw?$AAo?$AAr?$AAl?$AAd?$AA?$CB?$AA?$AA@" = comdat any
@"??_C@_1BA@DDDHLKME@?$AAC?$AAa?$AAp?$AAt?$AAi?$AAo?$AAn?$AA?$AA@" = linkonce_odr dso_local unnamed_addr constant [8 x i16] [i16 67, i16 97, i16 112, i16 116, i16 105, i16 111, i16 110, i16 0], comdat, align 2
@"??_C@_1BK@IOBBFFJ@?$AAh?$AAe?$AAl?$AAl?$AAo?$AA?5?$AAw?$AAo?$AAr?$AAl?$AAd?$AA?$CB?$AA?$AA@" = linkonce_odr dso_local unnamed_addr constant [13 x i16] [i16 104, i16 101, i16 108, i16 108, i16 111, i16 32, i16 119, i16 111, i16 114, i16 108, i16 100, i16 33, i16 0], comdat, align 2
; Function Attrs: mustprogress noinline norecurse optnone uwtable
define dso_local noundef i32 @main() #0 {
entry:
  %retval = alloca i32, align 4
  store i32 0, ptr %retval, align 4
  %call = call i32 @MessageBoxW(ptr noundef null, ptr noundef @"??_C@_1BK@IOBBFFJ@?$AAh?$AAe?$AAl?$AAl?$AAo?$AA?5?$AAw?$AAo?$AAr?$AAl?$AAd?$AA?$CB?$AA?$AA@", ptr noundef @"??_C@_1BA@DDDHLKME@?$AAC?$AAa?$AAp?$AAt?$AAi?$AAo?$AAn?$AA?$AA@", i32 noundef 0)
  ret i32 1
}
declare dso_local i32 @MessageBoxW(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #1
attributes #0 = { mustprogress noinline norecurse optnone uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}
!0 = !{i32 1, !"wchar_size", i32 2}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"uwtable", i32 2}
!3 = !{i32 1, !"MaxTLSAlign", i32 65536}
!4 = !{!"clang version 17.0.6"}
jrj/xframe/test/test01.obj
Binary files differ
jrj/xframe/vbusiness/vframe/frame.vframe.vbusiness.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,587 @@
#pragma once
#include <wobject/xwin.hpp>
#include <wobject/xurl.hpp>
#include <wobject/xapp.hpp>
class xframe : public xwin
{
public:
    xframe(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {}
    static int getUrl(string url1, string para, KXMLDOMDocument x)
    {
        return xurl::get(xapp::GetServerUrl(), url1, para, x);
    }
    static int getUrl(string serverUrl,string url1, string para, KXMLDOMDocument x)
    {
        return xurl::get(serverUrl,url1, para, x);
    }
    int getSql( string para, KXMLDOMDocument x)
    {
        return xurl::getSql(GetServerUrl(), para, x);
    }
    int getSql( xaserverarg para, KXMLDOMDocument x)
    {
        return xurl::getSql(GetServerUrl(), para.GetString(), x);
    }
    virtual string GetBillStatusName(xstring billstatus)
    {
        if (billstatus == L"1") return L"新建";
        else if (billstatus == L"2") return L"待批";
        else if (billstatus ==L"3") return L"已批准";
        else if (billstatus ==L"4") return L"申请取消";
        else if (billstatus ==L"5") return L"修改";
        else if (billstatus ==L"6") return L"已审核";
        else if (billstatus ==L"9") return L"合并";
        else if (billstatus ==L"10") return L"归档";
        else if (billstatus ==L"11") return L"作废";
        return L"#Error";
    }
    virtual int ProcessUsedArg(xaserverarg& arg)
    {
        return 1;
    }
    virtual xstring GetEntityName(LPARAM pr)
    {
        //alert("frame:get entity name!");
        return L"";
    }
    virtual xstring GetEntityIDName(LPARAM pr)
    {
        return L"";
    }
    virtual xstring GetEntityID(LPARAM pr)
    {
        return L"";
    }
    virtual xstring GetEntityData(LPARAM pr)
    {
        return L"";
    }
    virtual xstring GetEntityRowData(LPARAM pr)
    {
        return L"";
    }
    virtual xstring GetEntityTitle(LPARAM pr)
    {
        return L"";
    }
    virtual xstring GetEntityNo(LPARAM pr)
    {
        return L"";
    }
    virtual xstring GetEntityItemValue(LPARAM pr, xstring obj, xstring item)
    {
        return L"";
    }
    virtual int ViewUpdate(LPARAM pr, xstring updateItem, xaserverarg  arg)
    {
        return 1;
    }
    virtual xstring GetEntityWorkNode(LPARAM pr, xstring what)
    {
        return L"";
    }
    virtual int CheckEntityValidity(LPARAM pr)
    {
        return 1;
    }
    virtual int ShowAll()
    {
        return 1;
    }
    virtual int GridSearchnew()
    {
        return 1;
    }
    virtual int CustomerModify()
    {
        return 1;
    }
    virtual xstring GetReason(LPARAM pr)
    {
        xaserverarg arg;
        //openUrl("/sale/view/view.dlg/xpage/memo/edit", arg);
        arg.AddArg(L"EntityID", GetEntityID(2));
        openUrl(L"/sale/view/workflow.view/xpage/chkdlg_vd", &arg);
        xstring comdid = arg.GetArgString(L"comdid");
        if (comdid ==L"xmOK")
        {
            string value = arg.GetArgString(L"content");
            return value;
        }
        return L"";
    }
    virtual xstring GetParamValue(xstring name)
    {
        return L"";
    }
    virtual xstring GetSheetContent()
    {
        return L"";
    }
    int OnModifyRows()
    {
        xstring SheetStr = GetSheetContent();
        if (SheetStr ==L"") return -1;
        xaserverarg arg;
        arg.AddArg(L"sheet", SheetStr);
        openUrl(L"/sale/view/view.dlg/xpage/grid/column/editex", &arg);
        return 1;
    }
    int ProcessFlowAction(xstring comdid, LPARAM pr1)
    {
        if (comdid ==L"__ModifyRows")
        {
            OnModifyRows();
            return 1;
        }
        LPARAM pr = pr1;
        xstring action = comdid.mid(comdid.find(L"action:", 0) + 7, 9999);
        if (action ==L"bill.delete" || action ==L"bill.deleteEx")
        {
            if (MessageBoxW(GetHWND(),L"是否确定删除记录!",L"提示", 1) == 2)
                return 1;
        }
        xaserverarg& arg = *(new xaserverarg);
        arg.AddArg(L"Action", action);
        KXMLDOMDocument x;
        xstring aurl =L"/workflow/query/actioninfo/" + action;
        if (xurl::get(GetServerUrl(),aurl,L"", x) != 1)
            return -1;
        int nlen;
        int i = 0;
        xstring name;
        xstring worknode;
        xstring how;
        xstring state =L"";
        xstring billstatus =L"";
        KXMLDOMElement e;
        arg.AddArg(L"EntityName", GetEntityName(pr));
        //参数要求
        KXMLDOMNodeList nlist = x.selectNodes(L"//params/param");
        nlen = nlist.length();
        for (i = 0; i < nlen; i++)
        {
            e = nlist.item(i);
            name = e.selectSingleNode(L"@name").text();
            how = e.selectSingleNode(L"@how").text();
            xstring content =L"";
            if (how ==L"Entity" || how ==L"EntityData")
            {
                content = GetEntityData(pr);
            }
            if (e.selectSingleNode(L"@valid"))
            {
                if (content.find(L"update.modify", 0) > 0 || content.find(L"update.delete", 0) > 0) {}
                else return 0;
                if (CheckEntityValidity(pr) < 0) return -1;
            }
            if (how ==L"EntityID")
                arg.AddArg(name, GetEntityID(pr),L"xs:string");
            else if (how ==L"Entity" || how ==L"EntityData")
                arg.AddArg(name, content,L"xs:string");
            else if (how ==L"EntityRowData")
                arg.AddArg(name, GetEntityRowData(pr),L"xs:string");
            else if (how ==L"Reason")
            {
                arg.AddArg(name, GetReason(1),L"xs:string");
            }
            else if (how ==L"EntityNo")
                arg.AddArg(name, GetEntityNo(pr),L"xs:string");
            else if (how ==L"EntityTitle")
                arg.AddArg(name, GetEntityTitle(pr),L"xs:string");
            else if (how ==L"GetParam")
                arg.AddArg(name, GetParamValue(name),L"xs:string");
            else if (how ==L"UserID")
                arg.AddArg(name, xaserver::GetUID(),L"xs:string");
            if (how ==L"Reason" && arg.GetArgString(name) ==L"") return -1;
            //if(how=="EntityData" && arg.GetArgString(name)=="") return -1;
            if (e.selectSingleNode(L"@check"))
            {
                xstring doCheck = e.selectSingleNode(L"@check").text();
                if (doCheck ==L"Y")
                {
                    xstring value = arg.GetArgString(name);
                    if (value ==L"")
                    {
                        alert(xstring(name) +L" å‚数值不能为空,事件终止!");
                        return -1;
                    }
                }
            }
        }
        arg.AddArg(L"action.entity", GetEntityName(pr),L"xs:string");
        ProcessUsedArg(arg);
        //动作
        KXMLDOMNode n = x.selectSingleNode(L"//view.action[1]");
        bool execResult = true; //处理结果
        if (n)
        {
            name = n.selectSingleNode(L"@name").text();
            if (n.selectSingleNode(L"@worknode"))
                worknode = n.selectSingleNode(L"@worknode").text();
            else
                worknode = GetEntityWorkNode(pr, name);
            arg.AddArg(L"do", name,L"xs:string");
            if (worknode !=L"")
            {
                if (worknode.find(L"dev:xpage") == 0)
                    OpenWindow(worknode, (LPARAM) & arg);
                else
                    openUrl(worknode, &arg);
            }
            else
            {
                alert(L"Warn: Please configure worknode for actionL" + xstring(name) +L".");
                return -1;
            }
        }
        else
        {
            //url::post(GetEntityName(pr)+"/workflow/action",arg.GetString(),x);
            KXMLDOMDocument x1;
            xstring EntityNo = GetEntityName(pr);
            int retxx = xurl::post(GetServerUrl(), (xstring)(L"/workflow/action/") + EntityNo + L"/" + action, arg.GetString(), x1);
            //alert("/workflow/action/"+GetEntityName(pr)+"/"+action+"\r\n"+arg.GetString()+"\r\n"+x1.GetXml());
            if (retxx != 1) execResult = false;
            if (x1.selectSingleNode(L"//process"))
            {
                KXMLDOMElement e1 = x1.selectSingleNode(L"//process");
                string valid = e1.getAttribute(L"valid");
                string finished = e1.getAttribute(L"finished");
                xstring errInfo =L"";
                if (valid ==L"0")
                {
                    errInfo = e1.getAttribute(L"errInfo");
                    alert(errInfo);
                    execResult = false;
                }
                else if (finished ==L"0")
                {
                    errInfo = e1.getAttribute(L"errInfo");
                    errInfo =L"处理失败!\r\n" + errInfo;
                    alert(errInfo);
                    execResult = false;
                }
            }
            else if (x1.selectSingleNode(L"//process-check-list"))
            {
                KXMLDOMElement e2 = x1.selectSingleNode(L"//process-check-list");
                string val = e2.getAttribute(L"process");
                if (val ==L"ok")
                {
                    alert("处理成功");
                    PostMessageW(GetHWND(), 0x401,(WPARAM)L"action:bill.refresh", 0);
                }
                else if (val ==L"part")
                {
                    alert("有部分数据处理未成功,提交成功的已处理。");
                    PostMessage(GetHWND(), 0x401, (WPARAM)L"action:bill.refresh", 0);
                }
                else
                    alert((xstring)L"数据处理不成功\r\n" + x1.xml());
                return 1;
            }
            else if (x1.selectSingleNode(L"//msg"))
            {
                xstring aStr =x1.selectSingleNode(L"//msg[1]").text();
                //if(aStr.find("理成功",0) < 0)
                //    alert(aStr);
                if (aStr.find(L"失败", 0) >= 0)
                    execResult = false;
                alert(aStr);
            }
            if (x1.selectSingleNode(L"//msg/@state"))
            {
                state = x1.selectSingleNode(L"//msg[1]/@state").text();
                arg.AddArg(L"state", state,L"xs:string");
                billstatus = x1.selectSingleNode(L"//msg[1]/@billstatus").text();
                arg.AddArg(L"billstatus", billstatus,L"xs:string");
            }
        }
        //更新要求
        if (execResult & 0xf)
        {
            nlist = x.selectNodes(L"//view/update");
            nlen = nlist.length();
            for (i = 0; i < nlen; i++)
            {
                e = nlist.item(i);
                how = e.selectSingleNode(L"@do").text();
                if (how ==L"setstate")
                {
                    if (state !=L"")
                    {
                        arg.AddArg(L"state", state,L"xs:string");
                        arg.AddArg(L"billstatus", billstatus,L"xs:string");
                        ViewUpdate(pr, how, arg);
                    }
                }
                else
                    ViewUpdate(pr, how, arg);
            }
        }
        return 1;
    }
    int OnItemError(TNotifyEvent* evt, int p)
    {
        DWNMHDR&  hdr = *(DWNMHDR *)evt->notify.pnmh;
        xstring value = hdr.data;
        int e = hdr.idFrom;
        if (e == -1000)
            MessageBoxW(0,L"【" + value +L"】不是有效的数字!",L"OnItemError", 0);
        if (e == -1001)
            MessageBoxW(0,L"【" + value +L"】不是有效的数字!", L"OnItemError", 0);
        if (e == -1002)
            MessageBoxW(0,L"【" + value +L"】不是有效的日期!", L"OnItemError", 0);
        hdr.idFrom = 0;
        return 1;
    }
    virtual int SetObjectInfo(KXMLDOMElement e)
    {
        return 1;
    }
    virtual string GetTaskID()
    {
        return L"";
    }
    virtual int SetAgent(xstring scene, xstring EntityID)
    {
        xstring xfNodeAgentArea =L"agentarea";
        xnode anode = GetAgentNode(xfNodeAgentArea);
        KXMLDOMElement xframeElement = GetElement();
        KXMLDOMNode agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea +L"[1]/*");
        KXMLDOMDocument x;
        xaserverarg arg;
        arg.AddArg(L"scene", scene,L"xs:string");
        arg.AddArg(L"EntityID", EntityID,L"xs:string");
        arg.AddArg(L"TaskID", GetTaskID(),L"xs:string");
        arg.AddArg(L"EntityName", GetEntityName(1),L"xs:string");
        xurl::get(GetServerUrl(),(xstring)L"/workflow/query/datarole/" + GetEntityName(1), arg.GetString(), x);
        //if(x.GetXmlDoc().selectSingleNode("datarole/rightes/right"))
        SetObjectInfo(x.documentElement());
        xstring sNodes;
        sNodes =(xstring)L"datarole/actions/action[contains(@scene,'" + scene +L"')]";
        KXMLDOMNodeList nlist = x.selectNodes(sNodes);
        int  index;
        int  nlen = nlist.length();
        KXMLDOMElement ele;
        xstring tools =L"<vbox class=''>";
        if (scene ==L"list") tools +=L"<xspace height='12'/>";
        for (index = 0; index < nlen; index++)
        {
            ele = nlist.item(index);
            xstring name = ele.selectSingleNode(L"@id").text();//.getAttribute("id");
            xstring label = ele.selectSingleNode(L"@caption").text();//ele.getAttribute("caption");
            xstring image;
            xstring src =L"";
            if (ele.selectSingleNode(L"@image"))
                image = ele.selectSingleNode(L"@image").text();
            else
                image =L"0 22";
            if (ele.selectSingleNode(L"@src"))
                src = ele.selectSingleNode(L"@src").text();
            xstring tool;
            if (src !=L"")
                tool =(xstring)L"<xtoolbutton src='" + src +L"'  caption='" + label +L"' name='action:" + name +L"' height='23' style='background-color:none #ceecce  none #ffffff'/>";
            else
                tool =(xstring)L"<xtoolbutton image='" + image +L"'  caption='" + label +L"' name='action:" + name +L"' height='23'  style='background-color:none #ceecce none #ffffff'/>";
            tools += tool;
        }
        if (agent)
        {
            nlist = agent.selectNodes(L".//xtoolbutton");
            nlen = nlist.length();
            for (index = 0; index < nlen; index++)
            {
                ele = nlist.item(index);
                xstring tmp = ele.xml();
                tools += tmp;
            }
        }
        tools +=L"</vbox>";
        SetAgentNode(anode, tools);
        return 1;
    }
    virtual int SetAgent(xstring scene)
    {
        return SetAgent(scene,L"*");
    }
    virtual int SetAgent()
    {
        return SetAgent(L"list");
    }
    virtual int DoUpdate(bool showSuccess)
    {
        return 0;
    }
    virtual bool NeedNotifyUpdate()
    {
        return false;
        return true;
    }
    virtual int BeforeCloseWindow()
    {
        if (!NeedNotifyUpdate()) return 1;
        xstring content = GetEntityData(1);
        if (content ==L"") return 1;
        if (content.find(L"update.modify", 0) > 0 || content.find(L"update.delete", 0) > 0)
        {
            int MB_YESNOCANCEL = 3;
            int IDYES = 6;
            int IDNO = 7;
            int IDCANCEL = 2;
            int re = MessageBoxW(GetHWND(),L"数据已经修改,是否保存?",L"提示:", MB_YESNOCANCEL);
            if (re == IDCANCEL) return -1;
            if (re == IDNO) return 1;
            if (DoUpdate(false) == 1) return 1;
            return -1;
        }
        return 1;
    }
    int OnCloseOwnerWindow(TEvent* evt, LPARAM p)
    {
        if (BeforeCloseWindow() < 0)     return 1;
        return 0;
    }
    int OnCloseFrameSheet(TEvent* evt, LPARAM p)
    {
        LYSNMHDR* nmtv = (LYSNMHDR*)evt->notify.pnmh;
        HWND h = (HWND)nmtv->idFrom;
        int canCLose = 1;
        if (h == GetHWND())
            canCLose = BeforeCloseWindow();
        if (canCLose < 0)
            nmtv->nSheet = canCLose;
        return 1;
    }
    int AttachCloseWindow()
    {
        xstring typ = GetElement().getAttribute(L"type");
        if (typ ==L"sheet")
        {
            AttachEvent(L"frame:mdilayer",L"LYSN_CLOSESHEET", (FEvent)&xframe::OnCloseFrameSheet);
        }
        else
        {
            AttachEvent(L"WM_CLOSE", (FEvent)&xframe::OnCloseOwnerWindow);
        }
        return 1;
    }
    int OnCloseWindow()
    {
        //AttachEvent("frame:mdilayer",L"LYSN_CLOSESHEET",BeforeCloseWindow);
        return 1;
    }
    /*
    int AppendItem(xml x,msxml::IXMLDOMElement r,string name,string value)
    {
        msxml::IXMLDOMElement e = x.GetXmlDoc().createElement(name);
        e.text =L""+value;
        e.setAttribute("update.modify","1");
        r.appendChild(e);
        return 1;
    }
    int OnSaveTemplate(xdwgrid dw_list, string aurl)
    {
        //alert("未开放...");
        if(aurl ==L"") return -1;
        int i;
        int s = dw_list.GetColumnCount();
        xaserverarg arg = new xaserverarg;
        arg.setNativePointer(arg.CreateInstance());
        for(i=1; i<=s; i++)
        {
            string name = dw_list.GetColumnName(i);
            if(name ==L"guid") continue;
            string titlename = dw_list.GetTitleName(i - 1);
            int width = dw_list.GetColumnWidth(name);
            arg.AddArg(name, width.toString(), titlename);
        }
        xml x=new xml;
        x.setNativePointer(xml::CreateInstance());
        x.LoadXml("<root><SysGridCols update.new='1' update.modify='1'/></root>");
        msxml::IXMLDOMElement doc = x.GetXmlDoc().documentElement;
        msxml::IXMLDOMElement e = doc.selectSingleNode("*");
        //string guid1 = publiccode::GetGuid();
        //string gid = publiccode::GetCurrentDate();
        //AppendItem(x, e,L"ID", publiccode::GetGuid());
        AppendItem(x, e,L"TplType", aurl);
        AppendItem(x, e,L"Cols", arg.GetString());
        AppendItem(x, e,L"Recorder", xaserver::GetUserId());
        doc.appendChild(e);
        xaserverarg arg0 = new xaserverarg;
        arg0.setNativePointer(arg0.CreateInstance());
        arg0.AddArg("content", doc.xml);
        if(url::get("/workflow/action/SysGridCols/bill.update",arg0.GetString(),x)!=1)
        {
            trace("error:"+x.GetXml());
            alert("出错!");
        }
        return 1;
    }        */
};
jrj/xframe/vbusiness/vframe/listex.vframe.vbusiness.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,600 @@
#pragma once
#include <wobject/xwin.hpp>
#include <wobject/xurl.hpp>
#include <xcontrol/xdwgrid.hpp>
#include <xcontrol/xdwpages.hpp>
#include <xcontrol/xcombobox.hpp>
#include "frame.vframe.vbusiness.hpp"
#include <wobject/xurl.hpp>
#include "../vutil/publiccode.vutil.vbusiness.hpp"
class listEx
{
public:
    xcombobox dw_col;
    KXMLDOMDocument m_configDoc;
    xwin* m_this;
public:
    listEx() {}
public:
    bool Init(xwin* w, KXMLDOMDocument c)
    {
        m_this = w;
        m_configDoc = c;
        return true;
    }
    int alert(string str)
    {
        return m_this->alert(str);
    }
    string GetServerUrl()
    {
        return L"";
    }
    xnode SetAgentNodeContent(xnode n, string str)
    {
        return m_this->SetAgentNode(n, str);
    }
    bool AttachEvent(string control, string notify, xview::FEvent fevt)
    {
        return m_this->AttachEvent(control, notify, fevt);
    }
    int getUrl(string aurl, string para, KXMLDOMDocument x)
    {
        return xurl::get(GetServerUrl(),aurl, para, x);
    }
    string EditCombo(KXMLDOMElement d)
    {
        if (d.selectSingleNode(L"datas")) {
            KXMLDOMElement e = d.selectSingleNode(L"datas");
            KXMLDOMElement ele;
            string c1;
            string c2;
            if (e.selectSingleNode(L"@xquery") && e.selectSingleNode(L"@column1") && e.selectSingleNode(L"@column2")) {
                xstring xq = e.selectSingleNode(L"@xquery").text();
                c1 = e.selectSingleNode(L"@column1").text();
                c2 = e.selectSingleNode(L"@column2").text();
                xstring pa = L"";
                if (e.selectSingleNode(L"@param"))
                    pa = e.selectSingleNode(L"@param").text();
                KXMLDOMDocument x;
                xaserverarg arg;
                if (pa !=L"") {
                    arg.AddArg(pa.mid(0, pa.find(L"=", 0)), pa.mid(pa.find(L"=", 0) + 1, pa.length()), L"xsd:string");
                }
                if (xaserver::ExecXQuery(GetServerUrl(), L"[" + xq + L"]", arg.GetString(), x) != 1)
                    //if(getUrl(xq, arg, x)!=1)
                {
                    //trace("error:"+x.GetXml());
                    return L"";
                }
                ele = x.documentElement();
            }
            else {
                ele = e;
                c1 = L"@column1";
                c2 = L"@column2";
            }
            KXMLDOMNodeList nlist = ele.selectNodes(L"*");
            int i = 0;
            int s = nlist.length();
            string str = L"";
            for (i = 0; i < s; i++) {
                KXMLDOMElement xitem = nlist.item(i);
                string name = L"";
                if (xitem.selectSingleNode(c1))
                    name = xitem.selectSingleNode(c1).text();
                xstring value = L"";
                if (xitem.selectSingleNode(c2))
                    value = xitem.selectSingleNode(c2).text();
                xstring tmp = L"<item text='" + value + L"' data='" + name + L"'/>";
                str += tmp;
            }
            //trace(str);
            return str;
        }
        return L"";
    }
    string EditDate(KXMLDOMElement e)
    {
        string str = L"<xedit name='_cb_grid_value1' bind='_cb_grid_search'/><xlabel caption='~' width='8'/><xedit name='_cb_grid_value2' bind='_cb_grid_search'/>";
        return str;
    }
    string EditSheet(KXMLDOMElement d)
    {
        xstring str = L"<xedit  name='_cb_grid_value1'  bind='_cb_grid_search'/>";
        if (d.selectSingleNode(L"@sheet")) {
            KXMLDOMDocument x;
            if (x.loadXML(d.selectSingleNode(L"@sheet").text()))
            {
                KXMLDOMElement e = x.documentElement();
                if (e.selectSingleNode(L"edit")) {
                    KXMLDOMElement ed = e.selectSingleNode(L"edit");
                    if (ed.selectSingleNode(L"@edittype"))
                    {
                        xstring edittype = ed.selectSingleNode(L"@edittype").text();
                        if (edittype == L"ddlb") {
                            str = L"<xcombobox name='_cb_grid_value1' bind='_cb_grid_search'>";
                            xstring ddlbxml = ed.selectSingleNode(L"@ddlbxml").text();//ed.GetAttribute("ddlbxml");
                            KXMLDOMDocument y;
                            if (y.loadXML(L"" + ddlbxml))
                            {
                                KXMLDOMElement ele = y.documentElement();
                                KXMLDOMNodeList nlist = ele.selectNodes(L"row");
                                int i = 0;
                                int s = nlist.length();
                                xstring tmp = L"";
                                for (i = 0; i < s; i++) {
                                    KXMLDOMElement xitem = nlist.item(i);
                                    xstring name = xitem.selectSingleNode(L"数据列").text();
                                    xstring value = xitem.selectSingleNode(L"显示列").text();
                                    xstring tmp1 = L"<item text='" + value + L"' data='" + name + L"'/>";
                                    tmp += tmp1;
                                }
                                str += tmp;
                            }
                            str += L"</xcombobox>";
                        }
                    }
                }
            }
        }
        return str;
    }
    string EditTree(KXMLDOMElement e)
    {
        if (e.selectSingleNode(L"@xpage") && e.selectSingleNode(L"@column1") && e.selectSingleNode(L"@column2")) {
            xstring xq = e.selectSingleNode(L"@xpage").text();
            xstring c1 = e.selectSingleNode(L"@column1").text();
            xstring c2 = e.selectSingleNode(L"@column2").text();
            xaserverarg arg;
            m_this->OpenWindow(L"dev:xpage[" + xq + L"]", (LPARAM) & arg);
            //trace(arg.GetString());
            xstring d1 = arg.GetArgString(c1);
            xstring d2 = arg.GetArgString(c2);
            //trace(CategoryID, CName);
            xcombobox cb_value = m_this->GetControl(L"_cb_grid_value1");
            cb_value.ResetContent();
            if (d1 != L"" && d2 != L"") {
                int k = cb_value.AddItem(d2.c_str(), d1.c_str());
                cb_value.SetCurSel( k);
            }
        }
        return L"";
    }
    int OnSelectDialog()
    {
        int h = dw_col.GetCurSel();
        if (h < 0) return 0;
        int dt0 = dw_col.GetItemData( h);
        xstring  str = dt0;
        KXMLDOMDocument x;
        if (x.loadXML(str))
        {
            KXMLDOMElement e = x.documentElement();
            if (e.selectSingleNode(L"@editer")) {
                string edittype = e.getAttribute(L"editer");
                if (e.selectSingleNode(L"datas")) {
                    KXMLDOMElement d = e.selectSingleNode(L"datas");
                    if (edittype == L"tree" || edittype == L"grid") {
                        EditTree(d);
                    }
                }
            }
        }
        return 0;
    }
    int OnDropDown(TNotifyEvent* evt, LPARAM p)
    {
        OnSelectDialog();
        return 1;
    }
    xstring GetSysDefault(xstring str)
    {
        xstring ret = str;
        if (str == L"now")
        {
            ret = publiccode::GetCurrentDate();
            ret = ret.left(10);
        }
        else if (str == L"year")
        {
            ret = publiccode::GetCurrentDate();
            ret = ret.left(4) + L"-01-01";
        }
        else if (str.left(4) == L"year")
        {
            ret = publiccode::GetCurrentDate();
            if (str == L"year-1")
                ret = xstring(ret.left(4).toInt() - 1) + L"-01-01";
            else     if (str == L"year-2")
                ret = xstring(ret.left(4).toInt() - 2) + L"-01-01";
            else     if (str == L"year-3")
                ret = xstring(ret.left(4).toInt() - 3) + L"-01-01";
            else     if (str == L"year-4")
                ret = xstring(ret.left(4).toInt() - 4) + L"-01-01";
            else     if (str == L"year-5")
                ret = xstring(ret.left(4).toInt() - 5) + L"-01-01";
            else     if (str == L"year-x")
                ret = L"1900-00-00";
            if (str == L"year+1")
                ret = xstring(ret.left(4).toInt() + 1) + L"-01-01";
            else     if (str == L"year+2")
                ret = xstring(ret.left(4).toInt() + 2) + L"-01-01";
            else     if (str == L"year+3")
                ret = xstring(ret.left(4).toInt() + 3) + L"-01-01";
            else     if (str == L"year+4")
                ret = xstring(ret.left(4).toInt() + 4) + L"-01-01";
            else     if (str == L"year+5")
                ret = xstring(ret.left(4).toInt() + 5) + L"-01-01";
            else     if (str == L"year+x")
                ret = L"2150-12-31";
        }
        else if (str.left(3) == L"now")
        {
            xaserverarg arg;
            if (str == L"now-90")
                arg.AddArg(L"code", L"1", L"");
            else if (str == L"now-30")
                arg.AddArg(L"code", L"2", L"");
            else if (str == L"now-60")
                arg.AddArg(L"code", L"4", L"");
            else if (str == L"now-180")
                arg.AddArg(L"code", L"5", L"");
            else
                arg.AddArg(L"code", str, L"");
            KXMLDOMDocument x;
            if (xurl::get(this->GetServerUrl(),L"/sale/data/product/pref/report/initdate", arg.GetString(), x) != 1)
                return L"";
            KXMLDOMElement e = x.documentElement();
            ret = (xstring)L"" + e.selectSingleNode(L"sDate").text();
        }
        else if (str == L"userid")
        {
            ret = publiccode::GetUser().id;
        }
        else if (str == L"userno")
        {
            ret = publiccode::GetUser().no;
        }
        else if (str == L"username")
        {
            ret = publiccode::GetUser().name;
        }
        return ret;
    }
    int SetSearchDefault(KXMLDOMElement e, int flag)
    {
        if (e.selectSingleNode(L"@default"))
        {
            bstring dstr = e.selectSingleNode(L"@default").text();
            xstring d = GetSysDefault(dstr);
            xcombobox xc = m_this->GetControl(L"_cb_grid_value1");
            if (flag == 1 || flag == 3)
            {
                int h = xc.FindString(d);
                if (h < 0) h = 0;
                xc.SetCurSel( h);
            }
            else if (flag == 2) //日期
            {
                xc.SetText(d);
                xcombobox  xc2 = m_this->GetControl(L"_cb_grid_value2");
                //xc2.SetText(GetSysDefault("now"));
            }
            else
            {
                xc.SetText(d);
            }
        }
        return 1;
    }
    int ComboChange(int h)
    {
        string str = (string)dw_col.GetItemData(h);
        //alert(str);
        KXMLDOMDocument x;
        int flag = 0;
        if (x.loadXML(str))
        {
            //trace("299 ComboChange");
            xstring xcText = L"";
            xcontrol xc = m_this->GetControl(L"_cb_grid_value1");
            if (xc)
                xcText = xc.GetText();
            xstring box = L"<hbox>";
            KXMLDOMElement e = x.documentElement();
            if (e.selectSingleNode(L"@editer"))
            {
                xstring edittype = e.selectSingleNode(L"@editer").text();
                xstring tmp = L"";
                if (edittype == L"ddlb") {
                    tmp = L"<xcombobox name='_cb_grid_value1'>";
                    tmp += EditCombo(e);
                    tmp += L"</xcombobox>";
                    flag = 1;
                }
                else if (edittype == L"date") {
                    //tmp += EditDate(e);
                    //tmp = "<xdatetimepick name='_cb_grid_value1'/><xlabel caption='~' width='8'/><xdatetimepick name='_cb_grid_value2'/>";
                    tmp = L"<xedit name='_cb_grid_value1' bind='_cb_grid_search'/><xlabel caption='~' width='8'/><xedit name='_cb_grid_value2' bind='_cb_grid_search'/>";
                    flag = 2;
                }
                else if (edittype == L"tree" || edittype == L"grid") {
                    tmp = L"<xcombobox name='_cb_grid_value1' bind='_cb_grid_search'>";
                    //tmp += EditTree(e);
                    tmp += L"</xcombobox>";
                    flag = 3;
                }
                else {
                    tmp = L"<xedit  name='_cb_grid_value1' bind='_cb_grid_search'/>";
                    flag = 99;
                }
                box += tmp;
            }
            else if (e.selectSingleNode(L"@sheet"))
            {
                box += EditSheet(e);
            }
            else
            {
                box += L"<xedit  name='_cb_grid_value1' bind='_cb_grid_search'/>";
                flag = 99;
            }
            box += L"</hbox>";
            //alert(box);
            xnode anode = m_this->GetAgentNode(L"_cb_grid_value");
            if (anode.getNativePointer() == 0) return -1;
            SetAgentNodeContent(anode, box);
            SetSearchDefault(e, flag);
            if (xcText != L"")
            {
                xcontrol xc2 = m_this->GetControl(L"_cb_grid_value1");
                if (xc2)
                    xc2.SetText(xcText);
            }
            //if(flag == 3)
            //    AttachEvent("_cb_grid_value1","CBN_DROPDOWN",OnDropDown);  -->  TO  list
        }
        return flag;
    }
    int OnCombboChange(TEvent* evt, LPARAM lParam)
    {
        int h = dw_col.GetCurSel();
        if (h < 0) return 0;
        ComboChange(h);
        return 1;
    }
    string searchcol(KXMLDOMElement e)
    {
        if (e.selectSingleNode(L"xml")) {
            string colprop = e.selectSingleNode(L"xml").text();
            //trace(colprop);
            KXMLDOMDocument y;
            y.loadXML(colprop);
            //msxml::IXMLDOMElement prop= y.GetXmlDoc().selectSingleNode(L"cell/cellprop[1]");
            KXMLDOMElement cellprop = y.documentElement();
            if (cellprop.selectSingleNode(L"cellprop/@searchcolumn")) {
                string searchcolumn = cellprop.selectSingleNode(L"cellprop/@searchcolumn").text();
                return searchcolumn;
            }
        }
        return L"是";
    }
    int setSheetSearch(KXMLDOMDocument x)
    {
        KXMLDOMElement e = x.documentElement();
        KXMLDOMElement ele = e.selectSingleNode(L"//row[@rowindex='3']");
        KXMLDOMNodeList nlist = ele.selectNodes(L"cell");
        int i = 0;
        int s = nlist.length();
        string agentstr = L"<vbox>";
        int k = 0;
        for (i = 0; i < s; i++)
        {
            KXMLDOMElement xitem = nlist.item(i);
            //if(!xitem.selectSingleNode(L"text")) continue;
            if (xitem.selectSingleNode(L"text")) {}
            else continue;
            //trace(xitem.text);
            xstring colindex = xitem.selectSingleNode(L"@colindex").text();
            //宽度《10不显示??已经有了是否是查询列的属性,为什么还要这个?
            //if(!e.selectSingleNode(L"//col/item[@colend='"+colindex+"']")) continue;
            if (e.selectSingleNode(L"//col/item[@colend='" + colindex + L"']"))
            {
                KXMLDOMElement colwidth = e.selectSingleNode(L"//col/item[@colend='" + colindex + L"']");
                xstring width = colwidth.selectSingleNode(L"@width").text();
                if (width.toInt() < 10) continue;
            }
            //列
            //if(!e.selectSingleNode(L"//row[@rowindex='5']/cell[@colindex='"+colindex+"']")) continue;
            if (e.selectSingleNode(L"//row[@rowindex='5']/cell[@colindex='" + colindex +L"']")) {}
            else continue;
            KXMLDOMElement colename = e.selectSingleNode(L"//row[@rowindex='5']/cell[@colindex='" + colindex + L"']");
            //查询列
            string searchcolumn = searchcol(colename);
            if (searchcolumn == L"否") continue;
            //英文名
            string ename = colename.selectSingleNode(L"@column").text();
            //中文名
            string cname = L"";
            if (xitem.selectSingleNode(L"text"))
                cname = xitem.selectSingleNode(L"text").text();
            KXMLDOMElement sheetEle = x.createElement(L"column");
            sheetEle.setAttribute(L"name",ename);
            sheetEle.setAttribute(L"cname", cname);
            //有属性
            if (colename.selectSingleNode(L"xml"))
            {
                string colprop = colename.selectSingleNode(L"xml").text();
                //trace(colprop);
                KXMLDOMDocument y;
                y.loadXML(colprop);
                //msxml::IXMLDOMElement prop= y.GetXmlDoc().selectSingleNode(L"cell/cellprop[1]");
                KXMLDOMElement cellprop = y.documentElement();
                //msxml::IXMLDOMElement prop ;
                KXMLDOMElement n = cellprop.selectSingleNode(L"cellprop[1]");
                sheetEle.setAttribute(L"sheet", n.xml());
            }
            if (cname != L"")
                dw_col.AddItem(cname, sheetEle.xml());
        }
        return 1;
    }
    int rowSearch(string tpl)
    {
        //trace(m_configDoc.xml);
        //if(!m_configDoc) return -1; //---
        xnode anode = m_this->GetAgentNode(L"gridSearch");
        if (!anode) return -1;
        //string str = "<hbox><xcombobox name='_cb_grid_col' width='120'/><xspace width='5'/><vbox><xspace height='1'/><hbox height='19' name='_cb_grid_value'/></vbox><xspace width='5'/><hbox height='20' width='140'><xtoolbutton caption='查找' name='_cb_grid_search' width='50' image='6,21'/><xtoolbutton caption='高级查找' name='_cb_grid_search_ad' width='80' image='6,10'/></hbox></hbox>";
        string str = L"<hbox><xcombobox name='_cb_grid_col' width='120'/><xspace width='5'/><vbox><xspace height='1' visible='unlayer'/><hbox height='19' name='_cb_grid_value'/></vbox><xspace width='5'/><xtoolbutton caption='查找' name='_cb_grid_search' height='20' width='50' src='icons/find.png' image0='6,21'/><xtoolbutton caption='高级...' name='_cb_grid_search_ad' height='20' width='80' src='icons/trans.png' image0='6,10'/></hbox>";
        SetAgentNodeContent(anode, str);
        dw_col = m_this->GetControl(L"_cb_grid_col");
        /*xcontrol xc= m_this.GetControl("_cb_grid_col");
        dw_col = GetControlCombox("_cb_grid_col");
        dw_col.setNativePointer(xc.ptr_native_);
        int  id = dw_col.ptr_native_;
        trace("dw_col = %d",id);    */
        if (m_configDoc) {}
        else return 1;
        if (m_configDoc.selectSingleNode(L"Config/search"))
        {
            KXMLDOMNodeList nlist = m_configDoc.selectNodes(L"Config/search[1]/column");
            int s = nlist.length();
            if (s > 0)
            {
                int i = 0;
                for (i = 0; i < s; i++)
                {
                    KXMLDOMElement e = nlist.item(i);
                    if (e.selectSingleNode(L"@cname")) {}
                    else continue;
                    string name = e.selectSingleNode(L"@cname").text();
                    dw_col.AddItem(name, e.xml());
                }
            }
        }
        else
        {
            KXMLDOMDocument x;
            int ret = getUrl(tpl, L"<args/>", x);
            if (ret == 1 && x.xml() != L"")
            {
                setSheetSearch(x);
            }
        }
        //AttachEvent("_cb_grid_col","CBN_SELCHANGE",OnCombboChange);  //TO list
        if (dw_col.GetCount() > 0)
        {
            dw_col.SetCurSel( 0);
            ComboChange(0);
        }
        return 1;
    }
    string GridSearchEx()
    {
        //alert("ex");
        int h = dw_col.GetCurSel();
        if (h < 0) return L"";
        string  str = (string)dw_col.GetItemData(h);
        KXMLDOMDocument x;
        if (x.loadXML(str))
        {
            KXMLDOMElement e = x.documentElement();
            xstring name = e.selectSingleNode(L"@name").text();
            xstring cls = L"";// = "".space(256);
            if (e.selectSingleNode(L"@editer"))
                cls = e.selectSingleNode(L"@editer").text();
            else if (e.selectSingleNode(L"@sheet"))
                cls = e.selectSingleNode(L"@sheet").text();
            xcombobox xc = m_this->GetControl(L"_cb_grid_value1");
            xstring value = L"";
            x.loadXML(L"<items join='and'/>");
            e = x.documentElement();
            KXMLDOMElement ele = x.createElement(L"item");
            ele.setAttribute(L"name", name.c_str());
            //if(cls == "ComboBox")
            if (cls == L"ddlb" || cls == L"tree" || cls == L"grid")
            {
                value = xc.GetText();
                value = (string)xc.GetItemData();
                ele.setAttribute(L"op", L"like");
            }
            //else if(cls == "SysDateTimePick32")
            else if (cls == L"date")
            {
                value = xc.GetText();
                ele.setAttribute(L"op", L">=");
                xcombobox xc2 = m_this->GetControl(L"_cb_grid_value2");
                if (xc2.GetText() != L"")
                {
                    KXMLDOMElement ele2 = x.createElement(L"item");
                    ele2.setAttribute(L"name", name.c_str());
                    ele2.setAttribute(L"op", L"<=");
                    ele2.setAttribute(L"value", (xc2.GetText() +L" 23:59:59").c_str());
                    e.appendChild(ele2);
                }
            }
            else if (cls != L"")
            {
                value = xc.GetText();
                KXMLDOMDocument x2;
                if (x2.loadXML(cls))
                {
                    KXMLDOMElement ele3 = x2.documentElement();
                    if (ele3.selectSingleNode(L"edit"))
                    {
                        KXMLDOMElement ed = ele3.selectSingleNode(L"edit");
                        if (ed.selectSingleNode(L"@edittype"))
                        {
                            string edittype = ed.selectSingleNode(L"@edittype").text();
                            if (edittype == L"ddlb")
                            {
                                value = (string)xc.GetItemData();
                            }
                        }
                    }
                }
                ele.setAttribute(L"op", L"like");
            }
            else
            {
                value = xc.GetText();
                ele.setAttribute(L"op", L"like");
            }
            ele.setAttribute(L"value", value.c_str());
            if (value != L"")
                e.appendChild(ele);
            return e.xml();
        }
        return L"";
    }
};
jrj/xframe/vbusiness/vframe/listtree.vframe.vbusiness.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,161 @@
#pragma once
#include <wobject/xwin.hpp>
#include <wobject/xurl.hpp>
#include <xcontrol/xdwgrid.hpp>
#include <xcontrol/xdwpages.hpp>
#include <xcontrol/xcombobox.hpp>
#include <xcontrol/xtreeview.hpp>
#include "frame.vframe.vbusiness.hpp"
#include <wobject/xurl.hpp>
#include "../vutil/publiccode.vutil.vbusiness.hpp"
#include "listwin.vframe.vbusiness.hpp"
class listtree : public listwin
{
    string m_sType; //type
    string m_sTypeTxt; //选中树的data
    xtreeview tv_1;
    xcombobox ddlb_1;
    int    changeddlb;
    int createSubTree(xtreeview* tv_folder, 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));
                string name = e->selectSingleNode(L"Name").text();
                HTREEITEM hw = tv_folder->InsertChildItem(h, name, (LPARAM)e, 15);
                createSubTree(tv_folder, hw, e);
            }
        }
        return 1;
    }
    int OnCreateTree(string sType)
    {
        while (tv_1.GetRootItem() > 0)
            tv_1.DeleteItem(tv_1.GetRootItem());
        KXMLDOMDocument x;
        xaserverarg arg;
        arg.AddArg(L"sType", sType);
        xstring dataUrl = L"pref/listtree";
        KXMLDOMElement xframeElement = GetElement();
        KXMLDOMNode agent = xframeElement.selectSingleNode(L"//xtree[@name='tv_1']");
        if (agent)
        {
            if (agent.selectSingleNode(L"@dataurl"))
                dataUrl = agent.selectSingleNode(L"@dataurl").text();
        }
        if (xurl::get(GetServerUrl(),(xstring)GetEntityName(1) + L"/" + dataUrl, arg.GetString(), x) != 1)
        {
            //trace(x.GetXmlDoc().text);
            return -1;
        }
        else
        {
            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));
                    string name = e->selectSingleNode(L"Name").text();
                    HTREEITEM h = tv_1.InsertChildItem(0, name, (LPARAM)e, 17);
                    createSubTree(&tv_1, h, e);
                    if (len == 1) tv_1.ExpandItem(h);
                }
                tv_1.ExpandItem(0);
            }
        }
        return 1;
    }
    //树选择
    int OnTreeSelChanged(TEvent* evt, LPARAM p)
    {
        if (changeddlb == 0)
        {
        HTREEITEM h = tv_1.GetSelectedItem();
            KXMLDOMElement* e = (KXMLDOMElement * )tv_1.GetItemData(h);
            HTREEITEM root =tv_1.GetRootItem();
            if (h == root)
            {
                m_sType = L"";
                m_sTypeTxt = L"";
            }
            else
            {
                string t = e->selectSingleNode(L"Type").text();
                m_sType = t ;
                string txt = e->selectSingleNode(L"Code").text();
                if (txt == L"")
                    txt = e->selectSingleNode(L"Name").text();
                m_sTypeTxt = txt;
            }
            m_pageIndex = 1;
            OnRetrieve();
            //trace(m_sTypeTxt);
        }
        return 1;
    }
    //xcombobox下拉
    int OnSelectDdlb(TEvent* evt, LPARAM p)
    {
        changeddlb = 1;
        HWND wid = ddlb_1.GetHWND();
        int CB_GETCURSEL = 0x0147;
        int nIndex = SendMessageW(wid, CB_GETCURSEL, 0, 0);
        KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement();
        KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring(nIndex + 1) + L"]");
        string text = e2.selectSingleNode(L"@element").text();
        OnCreateTree(text);
        changeddlb = 0;
        return 1;
    }
    int onloadtree()
    {
        tv_1 = GetControl(L"tv_1");
        ddlb_1 = GetControl(L"cbx_1");
        //dw_detail = this.GetControl("dw_detail");
        AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listtree::OnTreeSelChanged);
        AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listtree::OnSelectDdlb);
        m_sType = L""; //type
        m_sTypeTxt = L""; //选中树的data
        changeddlb = 0;
        KXMLDOMElement xframeElement = GetElement();
        KXMLDOMNode agent = xframeElement.selectSingleNode(L"//xcombobox[@name='cbx_1' and @visible ='layer']");
        if (agent)
        {
            string s = agent.xml();
            string sType = agent.selectSingleNode(L"@element").text();
            OnCreateTree(sType);
        }
        else
            OnCreateTree(L"");
        return 1;
    }
    int onload()
    {
        listwin::onload();
        onloadtree();
        return 1;
    }
};
jrj/xframe/vbusiness/vframe/listwin.vframe.vbusiness.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,819 @@
#pragma once
#include <wobject/xwin.hpp>
#include <wobject/xurl.hpp>
#include <xcontrol/xdwgrid.hpp>
#include <xcontrol/xdwpages.hpp>
#include "listex.vframe.vbusiness.hpp"
#include "frame.vframe.vbusiness.hpp"
class listwin : public xframe
{
public:
    xdwgrid  dw_list;
    xdwpages dw_pages;
    string m_QueryTxt;
    KXMLDOMDocument m_configDoc;
    int m_pageIndex;
    int m_pageNumber;
    listEx* m_listEx;
    listwin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd){}
    xstring GetEntityWorkNode(/*param*/LPARAM pr, xstring what)
    {
        if (m_configDoc)
        {
            KXMLDOMNode n = m_configDoc.selectSingleNode(L"//worknodes/worknode[@for='" + what + L"']/@url");
            if (n)
            {
                xstring surl = n.text();
                if (surl.find(L"/", 0) != 0)
                {
                    xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text();
                    surl = vface + L"/" + surl;
                }
                return surl;
            }
        }
        return L"";
    }
    string GetEntityIDName(/*param*/int pr)
    {
        if (m_configDoc)
        {
            if (m_configDoc.selectSingleNode(L"//entity/EntityID[1]"))
                return m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text();
            else
                return L"";
        }
        else
            return L"";
    }
    xstring GetEntityID(LPARAM pr)
    {
        int row = dw_list.GetRow();
        if (row<0 || row>dw_list.GetRowCount()) return L"";
        KXMLDOMElement ele = dw_list.GetRowElement(row);
        xstring id = GetEntityIDName(pr);
        if (id == L"") return L"";
        if (ele.selectSingleNode(id))
        {
            xstring d = ele.selectSingleNode(id).text();
            return L"" + d;
        }
        return L"";
    }
    virtual xstring GetEntityRowData(LPARAM pr)
    {
        int row = dw_list.GetRow();
        if (row<0 || row>dw_list.GetRowCount()) return L"";
        KXMLDOMElement ele = dw_list.GetRowElement(row);
        ele.setAttribute(L"update.delete", L"1");
        ele.setAttribute(L"guid", GetEntityID(1).c_str());
        //trace(ele.xml);
        return ele.xml();
    }
    virtual xstring GetEntityData(LPARAM pr)
    {
        dw_list.AcceptText();
        KXMLDOMDocument x;
        dw_list.DwUpdateAllToEx(x);
        return x.xml();
    }
    xstring GetEntityName(LPARAM pr)
    {
        if (m_configDoc)
        {
            if (m_configDoc.selectSingleNode(L"//entity/name[1]"))
            {
                return m_configDoc.selectSingleNode(L"//entity/name[1]").text();
            }
            else
                return L"";
        }
        else
            return L"";
    }
    xstring GetEntityTitle(LPARAM pr)
    {
        if (m_configDoc)
        {
            if (m_configDoc.selectSingleNode(L"//entity/EntityName[1]"))
            {
                int row = dw_list.GetRow();
                if (row<0 || row>dw_list.GetRowCount()) return L"";
                KXMLDOMElement ele = dw_list.GetRowElement(row);
                string id = m_configDoc.selectSingleNode(L"//entity/EntityName[1]").text();
                if (ele.selectSingleNode(id))
                    return ele.selectSingleNode(id).text();
                else
                    return L"";
            }
            else
                return L"";
        }
        else
            return L"";
    }
    xstring GetEntityNo(LPARAM pr)
    {
        if (m_configDoc)
        {
            if (m_configDoc.selectSingleNode(L"//entity/EntityNo[1]"))
            {
                int row = dw_list.GetRow();
                if (row<0 || row>dw_list.GetRowCount()) return L"";
                KXMLDOMElement ele = dw_list.GetRowElement(row);
                string id = m_configDoc.selectSingleNode(L"//entity/EntityNo[1]").text();
                if (ele.selectSingleNode(id))
                    return ele.selectSingleNode(id).text();
                else
                    return L"";
            }
            else
                return L"";
        }
        else
            return L"";
    }
    int getURLParam()
    {
        if (GetParam())
        {
            xaserverarg* arg = (xaserverarg * )GetParam();
            xstring config = arg->GetArgString(L"config");
            KXMLDOMDocument x;
            if (config == L"")
            {
                string configXml = arg->GetArgString(L"configxml");
                if (configXml == L"") return 1;
                x.loadXML(configXml);
            }
            else
            {
                getUrl(GetServerUrl(),config, L"", x);
            }
            m_configDoc = x;
        }
        return 1;
    }
    virtual int SetEntityData(xaserverarg arg)
    {
        return 0;
    }
    virtual int OnPreRetrieve()
    {
        return 0;
    }
    virtual int OnPostRetrieve()
    {
        return 0;
    }
    virtual int setSearchInit()
    {
        return 0;
    }
    int OnRetrieve()
    {
        if (OnPreRetrieve() == 1)
            return 0;
        xaserverarg arg;
        arg.AddArg(L"pageindex", xstring(m_pageIndex), L""); //第几页
        arg.AddArg(L"pagenumber", xstring(m_pageNumber), L""); //每页数量
        arg.AddArg(L"QueryTxt", m_QueryTxt, L""); //查询条件
        //trace("OnRetrieve.arg="+arg.GetString());
        KXMLDOMDocument x;
        KXMLDOMNode n = m_configDoc.selectSingleNode(L"//list/dwview[@type='dwgrid'][1]");
        if (n)
        {
            //trace("OnRetrieve.n != null");
            KXMLDOMElement e = n;
            //trace("OnRetrieve.e="+e.xml);
            if (e.selectSingleNode(L"@dataurl"))
            {
                xstring dataUrl = e.selectSingleNode(L"@dataurl").text();
                //trace("OnRetrieve.dataUrl="+dataUrl);
                if (getUrl(GetServerUrl(),GetEntityName(1) + L"/" + dataUrl, arg.GetString(), x) != 1)
                    return 1;
                //trace("OnRetrieve.GetEntityName(1)/dataUrl="+GetEntityName(1)+"/"+dataUrl);
                //trace("OnRetrieve.x="+x.GetXml());
                KXMLDOMElement ele = x.documentElement();
                if (dw_pages)
                {
                    if (ele.selectSingleNode(L"@TotalPage"))
                    {
                        xstring s = ele.selectSingleNode(L"@TotalPage").text(); //总数量
                        dw_pages.SetMaxPage(s.toInt());
                    }
                }
                //trace("OnRetrieve.Retrieve(x)");
                dw_list.Retrieve(x);
                dw_list.Redraw();
                if (e.selectSingleNode(L"@readonly"))
                {
                    if (e.selectSingleNode(L"@readonly").text() == L"Y")
                        dw_list.SetReadOnly(true);
                }
                else
                    dw_list.SetReadOnly(true);
            }
            else
            {
                //trace("OnRetrieve.SetEntityData");
                SetEntityData(arg);
            }
        }
        else
        {
            // trace("OnRetrieve.n == null");
            SetEntityData(arg);
        }
        //trace("OnRetrieve.OnPostRetrieve begin");
        OnPostRetrieve();
        //trace("OnRetrieve.OnPostRetrieve end");
        return 1;
    }
    int OnChangePages(TNotifyEvent* evt, LPARAM p)
    {
        PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh;
        int c = h->cur;
        HCURSOR hCursor = xutil::SetCursorWait();
        m_pageIndex = c;
        OnRetrieve();
        xutil::RestoreCursor(hCursor);
        return 1;
    }
    int OnSetFocus(TNotifyEvent* evt, LPARAM p)
    {
        //if(!m_configDoc) return -1; //---
        KXMLDOMNode n = m_configDoc.selectSingleNode(L"//list/dwview[@type='dwgrid'][1]");
        if (n)
        {
            KXMLDOMElement e = n;
            if (e.selectSingleNode(L"@rowagent"))
            {
                xstring rowagent = e.selectSingleNode(L"@rowagent").text();
                if (rowagent == L"Y")
                {
                    int row = dw_list.GetRow();
                    if (row < 1 || row > dw_list.GetRowCount())
                        SetAgent(L"list");
                    else
                    {
                        KXMLDOMElement ele = dw_list.GetRowElement(row);
                        string id = GetEntityIDName(1);
                        string entity = ele.selectSingleNode(id).text();
                        //alert(ele.xml);
                        SetAgent(L"list", entity);
                    }
                }
            }
            else
                SetAgent(L"list");
        }
        else
            SetAgent(L"list");
        return 1;
    }
    int OnPrint()
    {
        xaserverarg& arg = *(new xaserverarg);
        arg.AddArg(L"EntityName", GetEntityName(1), L"");
        arg.AddArg(L"EntityID", GetEntityID(1), L"");
        arg.AddArg(L"EntityNo", GetEntityNo(1), L"");
        //openUrl("/sale/view/view.base/xpage/Template/PrintView", p);
        openUrl(L"/sale/view/view.base/xpage/Template/PrintViewEx", &arg);
        return 1;
    }
    virtual int Onhistroydata()
    {
        return 1;
    }
    int GridSearch()
    {
        xaserverarg arg;
        if (m_configDoc.selectSingleNode(L"Config/search"))
        {
            KXMLDOMNode nn = m_configDoc.selectSingleNode(L"Config/search");
            arg.AddArg(L"sheet", nn.xml(), L"");
        }
        else
        {
            xstring tpl = L"";
            xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text();
            KXMLDOMNode n = m_configDoc.selectSingleNode(L"//list/dwview[@type='dwgrid'][1]");
            if (n)
            {
                KXMLDOMElement e = n;
                if (e.selectSingleNode(L"@url")) tpl = e.selectSingleNode(L"@url").text();
            }
            if (tpl == L"") return -1;
            KXMLDOMDocument x;
            xurl::get(GetServerUrl(),vface + L"/" + tpl, L"", x);
            arg.AddArg(L"sheet", x.xml(), L"");
            //alert(m_QueryTxt);
        }
        arg.AddArg(L"search", m_QueryTxt, L"");
        //trace(arg.GetString());
        OpenWindow(L"dev:xpage[search.column.grid.ex.vx]", (LPARAM) & arg);
        xstring ok = arg.GetArgString(L"return");
        if (ok == L"ok") {
            xstring txt = arg.GetArgString(L"search");
            if (txt != L"")
            {
                m_QueryTxt = txt;
                //trace(txt);
                m_pageIndex = 1;
                if (dw_pages) dw_pages.SetCurPage(1);
                OnRetrieve();
            }
        }
        return 0;
    }
    virtual int GridSearchExAdd()
    {
        return 1;
    }
    int GridSearchEx()
    {
        //trace("372Line :GridSearchEx   %d   %d",dw_pages.ptr_native_,dw_pages.get_native_ptr());
        m_pageIndex = 1;
        if (dw_pages)dw_pages.SetCurPage(1);
        m_QueryTxt = m_listEx->GridSearchEx();
        GridSearchExAdd();
        OnRetrieve();
        return 1;
    }
    int OnSearchDropDown(TNotifyEvent* evt, LPARAM p) {
        m_listEx->OnSelectDialog();
        return 0;
    }
    int OnSearchCombboChange(TEvent* evt, LPARAM lParam)
    {
        HWND k= (HWND)evt->lParam;
        int h = xcombobox::GetCurSel(k);
        if (h < 0) return 0;
        int ret = m_listEx->ComboChange(h);
        if (ret == 3)
            AttachEvent(L"_cb_grid_value1", L"CBN_DROPDOWN", (FEvent)&listwin::OnSearchDropDown);
        return 1;
    }
    int rowSearch(string tpl)
    {
        m_listEx = new listEx();
        m_listEx->Init(this, m_configDoc);
        //alert(tpl);
        int ret = m_listEx->rowSearch(tpl);
        if (ret == 1)
            AttachEvent(L"_cb_grid_col", L"CBN_SELCHANGE", (FEvent)&listwin::OnSearchCombboChange);
        return ret;
    }
    virtual int PostOnAttachEvent()
    {
        return 1;
    }
    virtual int PreOnCmdDispatch(string comdid)
    {
        //返回0——不在执行以下代码;返回其他——执行以下代码。
        return 1;
    }
    virtual int PostOnCmdDispatch(string comdid)
    {
        //    trace("test");
        return 1;
    }
    xstring GetSheetContent()
    {
        if (m_configDoc) {}
        else return L"";
        if (m_configDoc.selectSingleNode(L"Config/columns"))
        {
            KXMLDOMElement e = m_configDoc.selectSingleNode(L"Config/columns");
            return e.xml();
        }
        if (m_configDoc.selectSingleNode(L"//list/dwview[@type='dwgrid'][1]"))
        {
            KXMLDOMElement e2 = m_configDoc.selectSingleNode(L"//list/dwview[@type='dwgrid'][1]");
            xstring tpl = L"";
            if (e2.selectSingleNode(L"@url")) tpl = e2.selectSingleNode(L"@url").text();
            if (tpl != L"")
            {
                xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text();
                KXMLDOMDocument x;
                if (getUrl(GetServerUrl(),vface + L"/" + tpl, L"", x) == 1)
                {
                    KXMLDOMElement e3 = x.documentElement();
                    //trace("e3--->%s\r\n",e3.xml);
                    xstring src = e3.xml();//
                    if (src.left(6) == L"<sheet")
                        return src;
                    src = e3.getAttribute(L"src");
                    return src;
                }
            }
        }
        return L"";
    }
    virtual int OnCanModifyRow(int row)
    {
        return 1;
    }
    virtual int OnPostModifyRows()
    {
        return 1;
    }
    int OnModifyRows()
    {
        xstring SheetStr = GetSheetContent();
        //trace("sheet---->  %s\r\n", SheetStr);
        if (SheetStr == L"") return -1;
        xaserverarg arg;
        arg.AddArg(L"sheet", SheetStr);
        openUrl(L"/sale/view/view.dlg/xpage/grid/column/editex", &arg);
        //trace("%s", arg.GetString());
        string ret = arg.GetArgString(L"return");
        if (ret != L"ok") return 1;
        string column = arg.GetArgString(L"column");
        if (column == L"") return 1;
        string tpy = arg.GetArgString(L"tpy");
        string value = arg.GetArgString(L"value");// id  //value
        string value2 = arg.GetArgString(L"value2"); //value
        int row = 1;
        if (tpy != L"全部行")
            row = dw_list.GetNextSelectRow(0);
        while (row > 0)
        {
            int rowret = OnCanModifyRow(row);
            if (rowret < 0) continue;
            //dw_list.ItemChangeTo(row, column, value);
            dw_list.SetItemString(row, column, value);
            if (value2 != L"")
                dw_list.SetItemDisplayString(row, column, value2);
            if (tpy == L"全部行")
                row++;
            else
                row = dw_list.GetNextSelectRow(row + 1);
            if (row > dw_list.GetRowCount()) break;
        }
        OnPostModifyRows();
        dw_list.Redraw();
        return 1;
    }
    int AppendItem(KXMLDOMDocument x, KXMLDOMElement r, string name, string value)
    {
        KXMLDOMElement e = x.createElement(name);
        e.settext(value);
        e.setAttribute(L"update.modify", L"1");
        r.appendChild(e);
        return 1;
    }
    virtual xstring GetTemplateUrl()
    {
        KXMLDOMNode n = m_configDoc.selectSingleNode(L"//list/dwview[@type='dwgrid'][1]");
        if (n)
        {
            KXMLDOMElement e0 = n;
            xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text();
            xstring tpl = L"";//e.selectsingleNode("@url").text;
            if (e0.selectSingleNode(L"@url"))
                tpl = e0.selectSingleNode(L"@url").text();
            else
                return L"";
            if (tpl.left(1) == L"/") return tpl;
            return vface + L"/" + tpl;
        }
        return L"";
    }
    int OnSaveTemplate(xdwgrid dw_list, string aurl)
    {
        //alert("未开放...");
        if (aurl == L"") return -1;
        int i;
        int s = dw_list.GetColumnCount();
        xaserverarg arg;
        for (i = 1; i <= s; i++)
        {
            xstring name = dw_list.GetColumnName(i);
            if (name == L"guid") continue;
            string titlename = dw_list.GetTitleName(i - 1);
            int width = dw_list.GetColumnWidth(name.c_str());
            //trace("%s    %s   %d\r\n", titlename, name, width);
            arg.AddArg(name, xstring(width), titlename);
        }
        //trace("%s \r\n", arg.GetString());
        KXMLDOMDocument x;
        x.loadXML(L"<root><SysGridCols update.new='1' update.modify='1'/></root>");
        KXMLDOMElement doc = x.documentElement();
        KXMLDOMElement e = doc.selectSingleNode(L"*");
        AppendItem(x, e, L"ID", publiccode::GetGuid());
        AppendItem(x, e, L"TplType", aurl);
        AppendItem(x, e, L"Cols", arg.GetString());
        AppendItem(x, e, L"Recorder", xaserver::GetUID());
        doc.appendChild(e);
        //trace(doc.xml);
        xaserverarg arg0;
        arg0.AddArg(L"content", doc.xml());
        if (xurl::get(GetServerUrl(),L"/workflow/action/SysGridCols/bill.update", arg0.GetString(), x) != 1)
        {
            //trace("error:"+x.GetXml());
            alert(L"出错!");
        }
        return 1;
    }
    int SetUserTemplate(xstring aurl)
    {
        if (aurl == L"") return -1;
        KXMLDOMDocument x;
        xaserverarg arg;
        arg.AddArg(L"user", xaserver::GetUID());
        arg.AddArg(L"type", aurl);
        if (getUrl(GetServerUrl(), L"/sale/data/product/category/col", arg.GetString(), x) != 1) return 0;
        KXMLDOMElement e0 = x.documentElement();
        if (e0.selectSingleNode(L"Cols")) {}
        else return 0;
        xstring content =e0.selectSingleNode(L"Cols").text();
        x.loadXML(content);
        //trace("content:  %s \r\n  x:  %s", content, x.GetXml());
        KXMLDOMElement e = x.documentElement();
        KXMLDOMNodeList li = e.selectNodes(L"arg");
        int i;
        int s = li.length();
        int h = 1;
        for (i = 0; i < s; i++)
        {
            //if(i > 3) break;
            KXMLDOMElement ele = li.item(i);
            string name = ele.getAttribute(L"name");
            int k = dw_list.GetColumnIndex(name) - 1;
            if (k < 1) continue;
            h++;
            xstring value = ele.getAttribute(L"value");
            int width = value.toInt();
            dw_list.SetColumnWidth(name, width);
            if (width < 0) dw_list.SetColumnState(name, false);
            xstring tpy = ele.getAttribute(L"type");
            if (tpy == L"xs:string" || tpy == L"") continue;
            if (h >= dw_list.GetColumnCount()) break;
            if (k != h) dw_list.MoveColumnTo(k, h);
        }
        return 1;
    }
    int OnCmdDispatch(xstring comdid)
    {
        int result = 0;
        if (PreOnCmdDispatch(comdid) == 0)
            return 1;
        if (comdid.find(L"__ModifyRows", 0) >= 0)
        {
            OnModifyRows();
            return 1;
        }
        if (comdid.find(L"__SaveTpl", 0) >= 0)
        {
            OnSaveTemplate(dw_list, GetTemplateUrl());
            return 1;
        }
        if (comdid == L"action:bill.print") return OnPrint();
        if (comdid == L"action:bill.histroydata") return Onhistroydata();
        if (comdid == L"action:refresh")
        {
            xaserverarg arg;
            OnRetrieve();
            ViewUpdate(1, L"setstate", arg);
        }
        else if (comdid == L"action:search" || comdid == L"search" || comdid == L"action:bill.search")
        {
            GridSearch();
            return 1;
        }
        else if (comdid.find(L"action:", 0) >= 0)
        {
            result = ProcessFlowAction(comdid, 1);
        }
        if (PostOnCmdDispatch(comdid) != 1)
        {
            //alert("error");
            return -1;
        }
        if (comdid == L"showall") return ShowAll();
        if (comdid == L"action:search1") return GridSearchnew();
        if (comdid == L"action:customermodify") return CustomerModify();
        if (comdid == L"_cb_grid_search") return GridSearchEx();
        if (comdid == L"_cb_grid_search_ad") return GridSearch();
        return result;
    }
    int OnDoubleClicked(TNotifyEvent* evt, LPARAM p)
    {
        HCURSOR hCursor = xutil::SetCursorWait();
        OnCmdDispatch(L"action:bill.open");
        xutil::RestoreCursor(hCursor);
        return 1;
    }
    int OnRowChanged(TEvent* evt, LPARAM p)
    {
        DWNMHDR* hdr = (DWNMHDR*)evt->notify.pnmh;
        int row = hdr->row;
        KXMLDOMElement ele = dw_list.GetRowElement(row);
        xstring id = GetEntityIDName(1);
        xstring entity = ele.selectSingleNode(id).text();
        SetAgent(L"list", entity);
        return 1;
    }
    virtual int getGridRClickItem(xaserverarg arg)
    {
        return 1;
    }
    int OnGridRClicked(TEvent* evt, LPARAM p)
    {
        DWNMHDR* hdr = (DWNMHDR*)evt->notify.pnmh;
        HWND idfrom = (HWND)hdr->idFrom;
        xaserverarg arg;
        arg.AddArg(L"__SaveTpl_" + xstring((__int64)idfrom), L"保存布局");
        arg.AddArg(L"__", L"");
        arg.AddArg(L"__ModifyRows_" + xstring((__int64)idfrom), L"批量修改");
        getGridRClickItem(arg);
        //if(getRClickItem(arg) > 0)
        //    arg.AddArg("__ModifyRows", "批量修改");
        hdr->data = arg.GetString();
        return 1;
    }
    int OnXCommand(TEvent* evt, LPARAM p)
    {
        return OnCmdDispatch(evt->xcommand.pStrID);
    }
    int OnAttachEvent()
    {
        AttachEvent(L"WM_XCOMMAND", (FEvent)&listwin::OnXCommand);
        AttachEvent(L"WM_SETFOCUS", (FEvent)&listwin::OnSetFocus);
        //AttachEvent(L"dw_list",L"DWV_DOUBLECLICKED", (FEvent)&listwin::OnDoubleClicked);
        PostOnAttachEvent();
        OnCloseWindow();
        return 0;
    }
    int onloaded()
    {
        KXMLDOMNode n = m_configDoc.selectSingleNode(L"//list/dwview[@type='dwgrid'][1]");
        if (n)
        {
            KXMLDOMElement e = n;
            xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text();
            xstring tpl = L"";//e.selectsingleNode("@url").text;
            if (e.selectSingleNode(L"@url")) tpl = e.selectSingleNode(L"@url").text();
            if (e.selectSingleNode(L"@search"))
            {
                xstring colsearch = e.selectSingleNode(L"@search").text();
                if (colsearch == L"Y")
                {
                    int ret = rowSearch(vface + L"/" + tpl);
                    if (ret == -1)
                    {
                        OnRetrieve();
                    }
                    else
                    {
                        setSearchInit();
                        ret = GridSearchEx();
                        if (ret == -1)
                        {
                            //trace("onload.OnRetrieve1()");
                            OnRetrieve();
                        }
                    }
                }
                else
                {
                    //trace("onload.OnRetrieve2()");
                    OnRetrieve();
                }
            }
            else
            {
                //trace("onload.OnRetrieve66()");
                OnRetrieve();
            }
        }
        SetAgent(L"list");
        return -1;
    }
    int onload()
    {
        OnAttachEvent();
        getURLParam();
        KXMLDOMNode n = m_configDoc.selectSingleNode(L"//list/dwview[@type='dwgrid'][1]");
        if (n)
        {
            //trace("m_configDoc.xml1111111111="+m_configDoc.xml);
            KXMLDOMElement e = n;
            //trace("m_configDoc//list/dwview[@type='dwgrid'][1]="+e.xml);
            xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text();
            xstring dwname = L"";//e.selectsingleNode("@name").text;
            xstring tpl = GetTemplateUrl();//e.selectsingleNode("@url").text;
            xstring selectmode = L"4";
            if (e.selectSingleNode(L"@name")) dwname = e.selectSingleNode(L"@name").text();
            //if(e.selectSingleNode("@url")) tpl = e.selectSingleNode("@url").text;
            if (e.selectSingleNode(L"@selectmode")) selectmode = e.selectSingleNode(L"@selectmode").text();
            dw_list = GetControl(dwname);
            dw_list.openUrl(GetServerUrl(), tpl);
            SetUserTemplate(tpl);
            dw_list.SetReadOnly(true);
            dw_list.SetSelectionMode(selectmode.toInt());
            //trace("onload.2");
            if (e.selectSingleNode(L"@DBClick"))
            {
                AttachEvent(dwname, L"DWV_DOUBLECLICKED", (FEvent)&listwin::OnDoubleClicked);//行双击
            }
            m_pageIndex = 1;
            m_pageNumber = 40;
            if (e.selectSingleNode(L"@page.rows"))
            {
                xstring rows = e.selectSingleNode(L"@page.rows").text();
                m_pageNumber = rows.toInt();
            }
            if (e.selectSingleNode(L"@pages"))
            {
                string pages = e.selectSingleNode(L"@pages").text();
                dw_pages = GetControl(pages);
                AttachEvent(pages, L"PAGE_CLICK", (FEvent)&listwin::OnChangePages);
            }
            if (e.selectSingleNode(L"@rowagent"))
            {
                xstring rowagent = e.selectSingleNode(L"@rowagent").text();
                if (rowagent == L"Y")
                    AttachEvent(dwname, L"DWV_ROWFOCUSCHANGED", (FEvent)&listwin::OnRowChanged);
            }
            AttachEvent(dwname, L"DWV_RCLICKED", (FEvent)&listwin::OnGridRClicked);
            return 1;
        }
        return -1;
    }
    virtual int BeforeCloseWindow()
    {
        return 1;
    }
};
jrj/xframe/vbusiness/vframe/maint.vframe.vbusiness.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,547 @@
#pragma once
#include <wobject/xwin.hpp>
#include <wobject/xurl.hpp>
#include <xcontrol/xdwgrid.hpp>
#include <xcontrol/xdwpages.hpp>
#include "listex.vframe.vbusiness.hpp"
#include "frame.vframe.vbusiness.hpp"
#include <xcontrol/xdwtable.hpp>
class maint : public xframe
{
public:
    KXMLDOMDocument m_configDoc;
    string m_EntityID;
    maint(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
    xstring GetEntityWorkNode(LPARAM  pr, xstring what)
    {
        if (m_configDoc)
        {
            KXMLDOMNode n;
            n = m_configDoc.selectSingleNode(L"//worknodes/worknode[@for='" + what + L"']/@url");
            if (n)
            {
                xstring aurl = n.text();
                if (aurl.find(L"/", 0) != 0)
                {
                    xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text();
                    aurl = vface + L"/" + aurl;
                }
                return aurl;
            }
        }
        return L"";
    }
    xstring GetEntityID(LPARAM /*param*/ pr)
    {
        return m_EntityID;
    }
    xstring GetEntityName(LPARAM /*param*/ pr)
    {
        if (m_configDoc)
        {
            if (m_configDoc.selectSingleNode(L"//entity/name[1]"))
                return m_configDoc.selectSingleNode(L"//entity/name[1]").text();
            else
                return L"";
        }
        else
            return L"";
    }
    virtual string GetEntityRowData(int pr)
    {
        return GetEntityData(pr);
    }
    virtual string GetEntityData(int /*param*/ pr)
    {
        //trace(L"zzz");
        return L"";
    }
    int getURLParam()
    {
        //xpage xp = GetXPage();
        //xstring aurl = xp.GetWkUrl();
        xaserverarg* arg = (xaserverarg *)GetParam();
        m_EntityID = arg->GetArgString(L"EntityID");
        xstring config = arg->GetArgString(L"config");
        KXMLDOMDocument x;
        if (config == L"")
        {
            string configXml = arg->GetArgString(L"configxml");
            if (configXml == L"") return 1;
            x.loadXML(configXml);
        }
        else
        {
            getUrl(config, L"", x);
        }
        m_configDoc = x;
        return 1;
    }
    virtual int SetEntityData(xaserverarg arg)
    {
        return 0;
    }
    int OnRetrieve()
    {
        KXMLDOMDocument x;
        xaserverarg arg;
        arg.AddArg(L"EntityID", m_EntityID, L"xs:string");
        xstring dataUrl = L"";
        KXMLDOMNode n = m_configDoc.selectSingleNode(L"//maint/group[@for='dwviev']/@dataurl");
        if (n)
        {
            xstring u = n.text();
            if (u.left(1) != L"/")
                getUrl(L"/sale/data/" + GetEntityName(1) + L"/" + u, arg.GetString(), x);
            else
                getUrl(u, arg.GetString(), x);
        }
        else
        {
            //trace(L"maint.OnRetrieve.n == null");
        }
        //trace(L"yyy");
        KXMLDOMNodeList nlist = m_configDoc.selectNodes(L"//maint/group[@for='dwviev']/dwview");
        int  index;
        int  nlen = nlist.length();
        if (nlen > 0)
        {
            for (index = 0; index < nlen; index++)
            {
                //trace(L"zzz");
                KXMLDOMElement e = nlist.item(index);
                KXMLDOMDocument d;
                if (e.selectSingleNode(L"@dataurl"))
                {
                    KXMLDOMDocument x1 ;
                    xstring dataUrlEx = e.selectSingleNode(L"@dataurl").text();
                    if (dataUrlEx.left(1) != L"/")
                        getUrl(GetServerUrl(),L"/sale/data/" + GetEntityName(1) + L"/" + dataUrlEx, arg.GetString(), x1);
                    else
                        getUrl(GetServerUrl(), dataUrlEx, arg.GetString(), x1);
                    //getUrl(L"/sale/data/"+GetEntityName(1)+"/"+dataUrlEx,arg.GetString(),x1);
                    d = x1;
                    //trace(x1.GetXml());
                    //trace(L"maint.OnRetrieve.maint.xq.data = " + x1.GetXml());
                }
                else
                {
                    // trace(L"maint.OnRetrieve.config.maint[@dataurl] == null");
                     //trace(L"maint.OnRetrieve.config.e = " + e.xml);
                    d = x;
                }
                //trace(L"maint:"+index.toString());
                //alert(L"xq.xml = "+d.GetXml());
                //trace(L"xxx");
                string dwname = L"";//e.selectsingleNode(L"@name").text();
                string tpy = L"dwgrid";
                if (e.selectSingleNode(L"@name")) dwname = e.selectSingleNode(L"@name").text();
                if (e.selectSingleNode(L"@type")) tpy = e.selectSingleNode(L"@type").text();
                if (tpy == L"dwgrid")
                {
                    //trace(L"grid");
                    //xdwgrid dw_list = new xdwgrid;
                    //dw_list.setNativePointer(GetControl(dwname));
                    xdwgrid dw_list = GetControl(dwname);
                    //trace(index);
                    //trace(d.GetXml());
                    dw_list.Retrieve(d);
                    dw_list.Redraw();
                    //trace(L"grid end");
                }
                else if (tpy == L"dwtable")
                {
                    //trace(L"table");
                    xdwtable dw_table = GetControl(dwname);
                    //alert(L"dw_table.Retrieve(d) ===== "+d.GetXml());
                    dw_table.Retrieve(d);
                    dw_table.Redraw();
                    //trace(L"table end");
                }
            }
        }
        else
        {
            //trace(L"maint.OnRetrieve.list.length == 0");
        }
        return 1;
    }
    virtual int PreOnSetFocus()
    {
        //返回0——不在执行以下代码;返回其他——执行以下代码。
        return 1;
    }
    int OnSetFocus(TEvent * evt, LPARAM p)
    {
        if (PreOnSetFocus() == 0) return 0;
        SetAgent(L"maint", m_EntityID);
        return 1;
    }
    virtual int PreOnCmdDispatch(string comdid)
    {
        //返回0——不在执行以下代码;返回其他——执行以下代码。
        return 1;
    }
    virtual int PostOnCmdDispatch(string comdid)
    {
        return 1;
    }
    int OnPrint()
    {
        xaserverarg* arg;
        arg->AddArg(L"EntityName", GetEntityName(1), L"");
        arg->AddArg(L"EntityID", GetEntityID(1), L"");
        openUrl(L"/sale/view/view.base/xpage/Template/PrintView", arg);
        return 1;
    }
    int OnCmdDispatch(xstring comdid)
    {
        if (PreOnCmdDispatch(comdid) == 0) return 1;
        if (comdid == L"action:bill.print") return OnPrint();
        if (comdid.find(L"action:", 0) >= 0)
        {
            int ret = ProcessFlowAction(comdid, 1);
        }
        if (PostOnCmdDispatch(comdid) != 1)
        {
            alert(L"error");
            return -1;
        }
        return 0;
    }
    int OnXCommand(TEvent* evt, int p)
    {
        return OnCmdDispatch(evt->xcommand.pStrID);
    }
    int OnClose(TEvent * evt, int p)
    {
        return 0;
        //if(!m_configDoc) return -1; //---
        KXMLDOMNodeList nlist = m_configDoc.selectNodes(L"//maint/group[@for='dwviev']/dwview");
        int  index;
        int  nlen = nlist.length();
        KXMLDOMElement e;
        if (nlen > 0)
        {
            string vface = m_configDoc.selectSingleNode(L"//vface[1]").text();
            KXMLDOMDocument x;
            for (index = 0; index < nlen; index++)
            {
                e = nlist.item(index);
                //if(!e.selectSingleNode(L"@type")) continue;
                xstring dwname = L"";//e.selectsingleNode(L"@name").text();
                xstring tpy = L"dwgrid";
                if (e.selectSingleNode(L"@name")) dwname = e.selectSingleNode(L"@name").text();
                if (e.selectSingleNode(L"@type")) tpy = e.selectSingleNode(L"@type").text();
                if (tpy == L"dwgrid")
                {
                    xdwgrid dw_list = GetControl(dwname);
                    dw_list.AcceptText();
                    dw_list.DwUpdateAllToEx(x);
                }
                else if (tpy == L"dwtable")
                {
                    xdwtable dw_table = GetControl(dwname);
                    dw_table.AcceptText();
                    dw_table.DwUpdateAllTo(x);
                }
                KXMLDOMElement ele = x.documentElement();
                if (ele.selectSingleNode(L"//*[@update.origin != '']"))
                {
                    int res = MessageBoxW(GetHWND(), L"数据已经改变,是否保存?", L"提示", 4);
                    if (res == 6)
                        OnCmdDispatch(L"action:bill.update");
                    break;
                }
            }
        }
        return 0;
    }
    virtual int PostOnAttachEvent()
    {
        return 1;
    }
    virtual int CheckEntityValidity(LPARAM  pr)
    {
#if shouldFinish
        //if(!m_configDoc) return 1; //---
        KXMLDOMNodeList nlist = m_configDoc.selectNodes(L"//maint/group[@for='dwviev']/dwview[@type='dwtable']");
        int  index;
        int  nlen = nlist.length();
        KXMLDOMElement e;
        for (index = 0; index < nlen; index++)
        {
            e = nlist.item(index);
            string dwname = L"";//e.selectsingleNode(L"@name").text();
            //string tpy = "dwgrid";
            if (e.selectSingleNode(L"@name")) dwname = e.selectSingleNode(L"@name").text();
            xdwtable dw_table = GetControl(dwname);
            xpoint p;
            p.x = 0;
            p.y = 0;
            int dw = dw_table.getNullCell(p); //---
            //while(dw > 0)
            if (dw > 0)
            {
                xdwtable dw_1 = new xdwtable;
                dw_1.setNativePointer(dw);
                int colIndex = p.y;
                if (colIndex < 1) return 1;
                xstring colName = dw_1.GetColumnName(colIndex);
                xstring colText;
                if (m_configDoc.selectSingleNode(L"//MustFill/item[@name='" + colName + L"']"))
                    colText = m_configDoc.selectSingleNode(L"//MustFill/item[@name='" + colName + L"']/@text[1]").text();
                else
                    colText = colName;
                alert(L"字段" + colText + L"不能为空!");
                return -1;
            }
        }
#endif
        return 1;
    }
    int OnAttachEvent()
    {
        AttachEvent(L"WM_XCOMMAND", (FEvent)&maint::OnXCommand);
        AttachEvent(L"WM_SETFOCUS", (FEvent)&maint::OnSetFocus);
        AttachCloseWindow();
        PostOnAttachEvent();
        return 0;
    }
    int SetObjectInfo(KXMLDOMElement e)
    {
        //trace(e.xml);
        if (!e.selectSingleNode(L"rightes")) return 1;
        //alert(L"zzzzzzzzzzzz");
        string objUpdate = L"";
        if (e.selectSingleNode(L"//right[1]/@update"))
        {
            objUpdate = e.selectSingleNode(L"//right[1]/@update").text();
            //if(objUpdate == "yes") return 1;
            if (objUpdate == L"*") return 1;
        }
        //alert(L"xxxxxxxxxxxxx");
        //if(!m_configDoc) return -1; //---
        KXMLDOMNodeList nlist = m_configDoc.selectNodes(L"//maint/group[@for='dwviev']/dwview");
        int  index;
        int  nlen = nlist.length();
        KXMLDOMElement ele;
        for (index = 0; index < nlen; index++)
        {
            ele = nlist.item(index);
            string dwname = L"";//e.selectsingleNode(L"@name").text();
            string tpy = L"dwgrid";
            if (ele.selectSingleNode(L"@name")) dwname = ele.selectSingleNode(L"@name").text();
            if (ele.selectSingleNode(L"@type")) tpy = ele.selectSingleNode(L"@type").text();
            if (tpy == L"dwgrid")
            {
                xdwgrid dw_list = GetControl(dwname);
                if (objUpdate == L"yes")
                    dw_list.SetReadOnly(false);
                else
                    dw_list.SetReadOnly(true);
            }
            else if (tpy == L"dwtable")
            {
                xdwtable dw_table = GetControl(dwname);
                if (L"yes" == objUpdate)
                    dw_table.SetReadOnly(false);
                else
                {
                    dw_table.SetReadOnly(true);
                }
            }
        }
        return 1;
    }
    int onload()
    {
        OnAttachEvent();
        //if(!m_configDoc) return -1; //---
        //trace(m_EntityID);
        getURLParam();
        //alert(m_configDoc.xml);
        KXMLDOMNodeList nlist = m_configDoc.selectNodes(L"//maint/group[@for='dwviev']/dwview");
        int  index;
        int  nlen = nlist.length();
        //alert(m_configDoc.xml);
        //trace(nlen);
        KXMLDOMElement e;
        xnode anode = GetAgentNode(L"viewclient");
        //    alert(L"xxx");
        if (anode)
        {
            KXMLDOMNode n = m_configDoc.selectSingleNode(L"//maint/xpage[@use!='false']");
            if (n)
            {
                //  trace(L"maint.onload.n != null");
                string vx = n.xml();
                SetAgentNode(anode, vx);
            }
            else
            {
                //   trace(L"maint.onload.n == null");
                xstring sxpage;
                if (nlen > 1)
                {
                    //   trace(L"maint.onload.nlen > 1");
                                               //    alert(L"xxx1");
                    sxpage = L"<xpage><layers tabsize='20' tabplace='top' tabstyle='tdsShape' name='tab_1'>";
                    for (index = 0; index < nlen; index++)
                    {
                        e = nlist.item(index);
                        xstring dwname = L"";//e.selectsingleNode(L"@name").text();
                        xstring caption = L"";//e.selectsingleNode(L"@url").text();
                        xstring tpy = L"dwgrid";
                        if (e.selectSingleNode(L"@name")) dwname = e.selectSingleNode(L"@name").text();
                        if (e.selectSingleNode(L"@caption")) caption = e.selectSingleNode(L"@caption").text();
                        if (e.selectSingleNode(L"@type")) tpy = e.selectSingleNode(L"@type").text();
                        xstring layer = L"<layer caption='" + caption + L"'>";
                        if (tpy == L"dwgrid")
                            layer += L"<xgridex state='run' name='" + dwname + L"'/>";
                        else if (tpy == L"dwtable")
                            layer += L"<xcell state='run' name='" + dwname + L"'/>";
                        layer += L"</layer>";
                        sxpage += layer;
                    }
                    sxpage += L"</layers></xpage>";
                    SetAgentNode(anode, sxpage);
                }
                else if (nlen > 0)
                {
                    //  trace(L"maint.onload.nlen > 0");
                    sxpage = L"<xpage><vbox>";
                    e = nlist.item(0);
                    xstring sdwname = L"";//e.selectsingleNode(L"@name").text();
                    xstring scaption = L"";//e.selectsingleNode(L"@url").text();
                    xstring stpy = L"dwgrid";
                    if (e.selectSingleNode(L"@name")) sdwname = e.selectSingleNode(L"@name").text();
                    if (e.selectSingleNode(L"@caption")) scaption = e.selectSingleNode(L"@caption").text();
                    if (e.selectSingleNode(L"@type")) stpy = e.selectSingleNode(L"@type").text();
                    sxpage += L"<xlabel caption='" + scaption + L":' height='25'/>";
                    xstring slayer = L"";
                    if (stpy == L"dwgrid")
                        slayer = L"<xgridex state='run' name='" + sdwname + L"'/>";
                    else if (stpy == L"dwtable")
                        slayer = L"<xcell state='run' name='" + sdwname + L"'/>";
                    sxpage += slayer;
                    sxpage += L"</vbox></xpage>";
                    SetAgentNode(anode, sxpage);
                }
            }
        }
        if (nlen > 0)
        {
            //trace(L"maint.onload.nlen2 > 0");
            xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text();
            //alert(vface);
            for (index = 0; index < nlen; index++)
            {
                e = nlist.item(index);
                //if(!e.selectSingleNode(L"@type")) continue;
                //alert(e.xml);
                xstring xdwname = L"";//e.selectsingleNode(L"@name").text();
                xstring xtpl = L"";//e.selectsingleNode(L"@url").text();
                xstring xtpy = L"dwgrid";
                if (e.selectSingleNode(L"@name")) xdwname = e.selectSingleNode(L"@name").text();
                if (e.selectSingleNode(L"@url")) xtpl = e.selectSingleNode(L"@url").text();
                if (e.selectSingleNode(L"@type")) xtpy = e.selectSingleNode(L"@type").text();
                //alert(xdwname+"--"+xtpl);
                if (xtpy == L"dwgrid")
                {
                    xdwgrid dw_list = GetControl(xdwname);
                    dw_list.openUrl(vface + L"/" + xtpl);
                    //dw_list.SetSelectionMode(4);
                    if (e.selectSingleNode(L"@readonly"))
                    {
                        string sreadonly = e.selectSingleNode(L"@readonly").text();
                        if (sreadonly == L"true")
                            dw_list.SetReadOnly(true);
                    }
                }
                else if (xtpy == L"dwtable")
                {
                    //    trace(L"tpy == dwtable");
                        //trace(dwname);
                        //trace(vface+"/"+tpl);
                    xdwtable dw_table = GetControl(xdwname);
                    //        trace(L"maint.onload.vface/tpl = "+vface + "/" + tpl);
                    dw_table.openUrl(vface + L"/" + xtpl);
                    //trace(dw_table.__nativept);
                    //trace(L"xxxx");
                    if (e.selectSingleNode(L"@title"))
                    {
                        //trace(L"xx");
                    //    trace(L"e.selectSingleNode(@title)");
                        dw_table.SetColHeaderHeight(0);
                        dw_table.SetRowSelectorWidth(0);
                        //trace(L"yyy");
                    }
                    if (e.selectSingleNode(L"@scrollbox"))
                    {
                        //    trace(L"e.selectSingleNode(@scrollbox)");
                        dw_table.SetScrollState(false);
                    }
                    AttachEvent(xdwname, L"DWV_ITEMERROR",(FEvent)&maint::OnItemError);
                }
            }
            //trace(L"OnRetrieve()...");
            //trace(L"xxxx");
        }
        return 1;
    }
    int onloaded()
    {
        SetAgent(L"maint", m_EntityID);
        KXMLDOMNodeList nlist = m_configDoc.selectNodes(L"//maint/group[@for='dwviev']/dwview");
        int  nlen = nlist.length();
        if (nlen > 0)
            OnRetrieve();
        return -1;
    }
};
jrj/xframe/vbusiness/vframe/responsewin.vframe.vbusiness.hpp
jrj/xframe/vbusiness/vutil/publiccode.vutil.vbusiness.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,375 @@
#pragma once
#include <wobject/xwin.hpp>
#include <wobject/xurl.hpp>
struct PUser
{
    string id;
    string no;
    string name;
    string userid;
    string personid;
    string deptid;
    string deptname;
    string orgid;
    string orgname;
    string jobid;
    string jobname;
    string positionid;
    string positionname;
    string teamid;
    string teamname;
    string groupid;
    string groupname;
    string unitid;
    string unitname;
    string companyid;
    string companyname;
    string tel;
};
namespace publiccode
{
    //取服务器当前时间
    static string GetCurrentDate()
    {
        KXMLDOMDocument x;
        string ls_date=L"";
        if (xaserver::ExecXQuery(L"", L"[dev.GetDate]", L"", x) == 1)
        {
            KXMLDOMElement e = x.documentElement();
            if (e)
                ls_date = e.selectSingleNode(L"@date").text();  //e.getAttribute(L"date");
        }
        return ls_date;
    }
    //取当前用户
    static PUser GetUser(xstring id)
    {
        string userno = xaserver::GetUserNo();
        //trace(userno);
        KXMLDOMDocument x;
        xaserverarg arg;
        if (id != L"") arg.AddArg(L"userid", id, L"");
        if (xaserver::ExecXQuery(L"", L"[GetUserInfomation.xq]", arg.GetString(), x) != 1)
        {
            //trace(x.GetXml());
            //return "";//---return nil;
        }
        //trace(L"---%s",x.GetXml());
        KXMLDOMElement e = x.documentElement();
        PUser& p = *(new PUser);
        if (e)
        {
            if (e.selectSingleNode(L"任职"))    p.id = e.selectSingleNode(L"任职").text();
            if (e.selectSingleNode(L"用户"))    p.no = e.selectSingleNode(L"用户").text();
            if (e.selectSingleNode(L"名字"))    p.name = e.selectSingleNode(L"名字").text();
            if (e.selectSingleNode(L"Ö°Ô±"))    p.personid = e.selectSingleNode(L"Ö°Ô±").text();
            if (e.selectSingleNode(L"编号"))    p.userid = e.selectSingleNode(L"编号").text();
            if (e.selectSingleNode(L"工种"))    p.jobid = e.selectSingleNode(L"工种").text();
            if (e.selectSingleNode(L"岗位"))    p.positionid = e.selectSingleNode(L"岗位").text();
            if (e.selectSingleNode(L"事业部"))    p.orgid = e.selectSingleNode(L"事业部").text();
            if (e.selectSingleNode(L"部门"))    p.deptid = e.selectSingleNode(L"部门").text();
            if (e.selectSingleNode(L"团队"))    p.teamid = e.selectSingleNode(L"团队").text();
            if (e.selectSingleNode(L"小组"))    p.groupid = e.selectSingleNode(L"小组").text();
            if (e.selectSingleNode(L"单元"))    p.unitid = e.selectSingleNode(L"单元").text();
            if (e.selectSingleNode(L"法人"))    p.companyid = e.selectSingleNode(L"法人").text();
            if (e.selectSingleNode(L"工种名称"))    p.jobname = e.selectSingleNode(L"工种名称").text();
            if (e.selectSingleNode(L"岗位名称"))    p.positionname = e.selectSingleNode(L"岗位名称").text();
            if (e.selectSingleNode(L"事业部名称"))    p.orgname = e.selectSingleNode(L"事业部名称").text();
            if (e.selectSingleNode(L"部门名称"))    p.deptname = e.selectSingleNode(L"部门名称").text();
            if (e.selectSingleNode(L"团队名称"))    p.teamname = e.selectSingleNode(L"团队名称").text();
            if (e.selectSingleNode(L"小组名称"))    p.groupname = e.selectSingleNode(L"小组名称").text();
            if (e.selectSingleNode(L"单元名称"))    p.unitname = e.selectSingleNode(L"单元名称").text();
            if (e.selectSingleNode(L"法人名称"))    p.companyname = e.selectSingleNode(L"法人名称").text();
            if (e.selectSingleNode(L"电话"))    p.tel = e.selectSingleNode(L"电话").text();
        }
        return p;
    }
    static PUser GetUser()
    {
        return GetUser(L"");
    }
    //取公司费率(定额费率)-暂时没用到
    static string GetFixedChargeRate(string sOrgID)
    {
        /*
        if (sOrgID == "") return "4.2";
        xml x = new xml;
        x.setNativePointer(xml::CreateInstance());
        xaserverarg args=new xaserverarg;
        args.setNativePointer(args.CreateInstance());
        args.AddArg(L"orgid",sOrgID);
        string ls_date;
        if(xaserver::ExecXQuery(L"","[GetFixedChargeRate.xq]",args.GetString(),x)==1)
        {
            msxml::IXMLDOMElement e= x.GetXmlDoc().documentElement;
            if(e)
                if(e.selectSingleNode(L"FixedChargeRate"))
                    ls_date =  e.selectSingleNode(L"FixedChargeRate").text();
        }
        return ls_date+"";*/
        return L"";
    }
    //取汇率
    static xstring GetExchangeRate(xstring pcur, xstring pdate)
    {
        if (pcur.toUpper() == L"RMB") return L"1";
        KXMLDOMDocument x;
        xaserverarg args;
        args.AddArg(L"currency", pcur, L"");
        if (pdate != L"") args.AddArg(L"date", pcur, L"");
        xstring ls_date;
        if (xaserver::ExecXQuery(L"", L"[GetCurrencyExchangeRate.xq]", args.GetString(), x) == 1)
        {
            KXMLDOMElement e = x.documentElement();
            if (e)
                if (e.selectSingleNode(L"ExchangeRate"))
                    ls_date = e.selectSingleNode(L"ExchangeRate").text();  //e.getAttribute(L"date");
        }
        return ls_date + L"";
    }
    static xstring GetExchangeRate(string pcur)
    {
        return GetExchangeRate(pcur, L"");
    }
    static string GetExchangeRate()
    {
        return GetExchangeRate(L"USD");
    }
    //file æ–‡ä»¶å¤åˆ¶è¿‡æ¥
    static int get(xstring aurl, xstring atype, KXMLDOMDocument x)
    {
        return xaserver::LoadUrl(L"", L"dev:" + atype + L"[" + aurl + L"]", L"", x);
    }
    static int get(xstring aurl, KXMLDOMDocument x)
    {
        if (aurl.find(L":", 0) > 0) {
            xstring str = aurl.mid(aurl.find(L":", 0) + 1, aurl.length());
            xstring t = str.mid(0, str.find(L"[", 0));
            xstring n = str.mid(str.find(L"[", 0) + 1, str.find(L"]", 0));
            return get(n, t, x);
        }
        else
            return get(aurl, L"xml", x);
    }
    static xstring get(xstring aurl, xstring atype)
    {
        KXMLDOMDocument x;
        int res = get(aurl, atype, x);
        if (res == 1)
            return x.xml();
        else
            return L"";
    }
    static xstring get(xstring aurl)
    {
        if (aurl.find(L":", 0) > 0) {
            xstring str = aurl.mid(aurl.find(L":", 0) + 1, aurl.length());
            xstring t = str.mid(0, str.find(L"[", 0));
            xstring n = str.mid(str.find(L"[", 0) + 1, str.find(L"]", 0));
            return get(n, t);
        }
        else
            return get(aurl, (xstring)L"xml");
    }
    static xstring node(xstring aurl, xstring atype, xstring id)
    {
        KXMLDOMDocument config;
        int res = get(aurl, atype, config);
        KXMLDOMElement e = config.selectSingleNode(L"*/" + id);
        if (e) {
            return e.xml();
        }
        else {
            return L"";
        }
    }
    static xstring node(xstring aurl, xstring id)
    {
        return node(aurl, L"xml", id);
    }
    //新Guid
    static xstring GetGuid()
    {
        KXMLDOMDocument x;
        if (xaserver::ExecXQuery(L"", L"[GetGuid.xq]", L"", x) != 1)
        {
            //trace(x.GetXml());
            return L"";
        }
        KXMLDOMElement e = x.documentElement();
        return e.text();
    }
    //È¡OrgID
    static xstring getOrgID(xstring sguid)
    {
        KXMLDOMDocument x;
        xaserverarg arg ;
        arg.AddArg(L"AssignmentID", sguid);
        if (xaserver::ExecXQuery(L"", L"[getAssignment.xq]", arg.GetString(), x) == 1)
        {
            KXMLDOMElement e = x.documentElement();
        }
        return L"";
    }
    static KXMLDOMDocument getAssignment(string sguid, KXMLDOMDocument x)
    {
        //xml x = new xml;
        //x.setNativePointer(xml::CreateInstance());
        xaserverarg arg;
        arg.setNativePointer(arg.CreateInstance());
        arg.AddArg(L"AssignmentID", sguid);
        if (xaserver::ExecXQuery(L"", L"[getAssignment.xq]", arg.GetString(), x) == 1)
        {
            KXMLDOMElement e = x.documentElement();
        }
        return x;
    }
    //日期转换
    static xstring DateTransform(xaserverarg arg)
    {
        xstring ls_date;
        KXMLDOMDocument x;
        if (xaserver::ExecXQuery(L"", L"[DateTransform.xq]", arg.GetString(), x) == 1)
        {
            KXMLDOMElement e = x.documentElement();
            if (e)
                ls_date = e.text();  //e.getAttribute(L"date");
        }
        return ls_date + L"";
    }
    //往来单位生成编号
    static xstring GetIdentityNo(string stype)
    {
        KXMLDOMDocument x;
        xaserverarg arg;
        arg.AddArg(L"sType", stype, L"");
        if (xaserver::ExecXQuery(L"", L"[GetIdentityNo.xq]", arg.GetString(), x) != 1)
        {
            //trace(x.GetXml());
            return L"";
        }
        KXMLDOMElement e = x.documentElement();
        return e.text();
    }
    //往来单位判断重复
    static bool IsRepeated(xaserverarg arg)
    {
        KXMLDOMDocument x;
        if (xaserver::ExecXQuery(L"", L"[IsRepeated.xq]", arg.GetString(), x) != 1)
        {
            //trace(x.GetXml());
            return false;
        }
        KXMLDOMElement e = x.documentElement();
        xstring scnt = e.text();
        if (scnt == L"0")
            return false;
        return true;
    }
    //取中文计量单位 by cky
    static xstring   GetUnitCName(xstring unitcode)
    {
        KXMLDOMDocument x;
        xaserverarg arg;
        arg.AddArg(L"code", unitcode, L"");
        if (xaserver::ExecXQuery(L"",L"[getUnitCName.xq]", arg.GetString(), x) != 1)
        {
            //trace(x.GetXml());
            return L"";
        }
        KXMLDOMElement e = x.documentElement();
        //trace(e.xml);
        if (e)
        {
            xstring CName = e.text();
            //trace(srate);
            return CName;
        }
        return L"1";
    }
    //取计量单位转换率
    static string   GetConversionRate(string ls_from_unit, string ls_to_unit)
    {
        /*
        ls_from_unit  åŽŸå•ä½
        ls_to_unit   ç›®æ ‡å•位
        */
        KXMLDOMDocument x;
        xaserverarg arg;
        arg.AddArg(L"code1", ls_from_unit, L"");
        arg.AddArg(L"code2", ls_to_unit, L"");
        if (xaserver::ExecXQuery(L"", L"[getUomInfo.xq]", arg.GetString(), x) != 1)
        {
            //trace(x.GetXml());
            return L"";
        }
        KXMLDOMElement e = x.documentElement();
        //trace(e.xml);
        if (e)
        {
            string srate = e.text();
            //trace(srate);
            return srate;
        }
        return L"1";
    }
    //根据装运的类型取容积
    static double GetFreightMode(string ls_type)
    {
        KXMLDOMDocument x;
        xaserverarg arg;
        arg.AddArg(L"ModelNo", ls_type, L"");
        if (xaserver::ExecXQuery(L"", L"[GetFreightMode.xq]", arg.GetString(), x) != 1)
        {
            return 0;
        }
        KXMLDOMElement e = x.documentElement();
        if (e.selectSingleNode(L"Capacity"))
            return xstring(e.selectSingleNode(L"Capacity").text()).toDouble();
        else
            return 1;
    }
    static xstring GetRANo(xstring stype, xstring suseid)
    {
        KXMLDOMDocument x;
        xaserverarg arg;
        arg.AddArg(L"runo", stype, L"");
        arg.AddArg(L"useid", suseid, L"");
        if (xaserver::ExecXQuery(L"", L"[GetRANo.xq]", arg.GetString(), x) != 1)
        {
            //trace(x.GetXml());
            return L"";
        }
        KXMLDOMElement e = x.documentElement();
        if (e.selectSingleNode(L"raa/@RANo"))
            return e.selectSingleNode(L"raa/@RANo").text();
        else
            return L"";
    }
}
jrj/xframe/win32/win.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,196 @@
#pragma once
#include "system/base.hpp"
typedef struct _GUID {
    unsigned long  Data1;
    unsigned short Data2;
    unsigned short Data3;
    unsigned char  Data4[ 8 ];
} GUID;
typedef GUID IID;
typedef const IID * REFCLSID;
typedef wchar_t OLECHAR;
typedef OLECHAR*  LPOLESTR;
typedef GUID CLSID;
typedef CLSID *LPCLSID;
typedef const OLECHAR*  LPCOLESTR;
typedef const OLECHAR *LPCOLESTR;
#define DECLSPEC_IMPORT __declspec(dllimport)
#define EXTERN_C       extern "C"
typedef long HRESULT;
#define STDAPICALLTYPE          __stdcall
#define WINOLEAPI        EXTERN_C DECLSPEC_IMPORT HRESULT STDAPICALLTYPE
WINOLEAPI CoCreateGuid(GUID * pguid);
WINOLEAPI StringFromCLSID(REFCLSID rclsid,  LPOLESTR* ppsz) ;
WINOLEAPI CLSIDFromProgID(LPCOLESTR lpsz, LPCLSID pclsid) ;
#define WINAPI   __stdcall
#define SendMessage SendMessageW
#define PostMessage PostMessageW
#define GetWindowLong GetWindowLongW
#define SetWindowLong SetWindowLongW
extern "C"
{
    void WINAPI SysFreeString(BSTR str);//OleAut32.dll
    void *  WINAPI  LoadLibraryW(const wchar_t* lpText);
    bool  WINAPI FreeLibrary(void *  hModule);
    void *  WINAPI  GetProcAddressW(void* hModule, const char* lpText);
    LPARAM WINAPI  GetPropW(HWND  hWnd,string  lpString);
    HWND WINAPI  GetParent(HWND) ;
    LRESULT WINAPI MessageBoxW(HWND hWnd,string title,string caption,int button );
    LRESULT WINAPI MessageBoxA(HWND hWnd,const char* title,const char* caption,int button );
    LRESULT WINAPI SendMessageW(HWND hWnd,int msg,WPARAM wparam,LPARAM lparam) ;
    LRESULT WINAPI PostMessageW(HWND hWnd,int msg,WPARAM wparam,LPARAM lparam) ;
    HDC WINAPI GetDC(HWND hWnd) ;//native from "user32.dll" alias "GetDC";
    int WINAPI ReleaseDC(HWND hWnd,int hDC) ;//native from "user32.dll" alias "ReleaseDC";
    HWND WINAPI GetChild(HWND hWnd,int uCmd) ;//native from "user32.dll" alias "GetChild";
    int WINAPI GetWindowTextW(HWND hWnd,string str,int nMaxCount) ;//native from "user32.dll" alias "GetWindowTextW";
    int WINAPI SetWindowTextW(HWND hWnd,string str) ;//native from "user32.dll" alias "SetWindowTextW";
    int WINAPI GetWindowTextLengthW(HWND hWnd) ;//native from "user32.dll" alias "GetWindowTextLengthW";
    int WINAPI EnableWindow(HWND hWnd,bool abled) ;//native from "user32.dll" alias "EnableWindow";
    int WINAPI SetFocus(HWND hWnd) ;//native from "user32.dll" alias "SetFocus";
    HWND WINAPI GetFocus() ;//native from "user32.dll" alias "GetFocus";
    int WINAPI IsWindowVisible(HWND hWnd) ;//native from "user32.dll" alias "IsWindowVisible";
    //int WINAPI GetLocalTime(ref dwtime dt)  ;//native from "Kernel32.dll" alias "GetLocalTime";
    bool WINAPI AnimateWindow(HWND hWnd,int dwTime,int dwFlags) ;//native from "user32.dll" alias "AnimateWindow";
    int WINAPI GetKeyState(int nVirtKey) ;//native from "user32.dll" alias "GetKeyState";
    int WINAPI SetWindowLong(HWND hWnd, int nIndex, int dwNewLong) ;//native from "user32.dll" alias "SetWindowLongW";
    LPARAM WINAPI GetWindowLong(HWND hWnd, int nIndex) ;//native from "user32.dll" alias "GetWindowLongW";
    int WINAPI GetClientRect(HWND hWnd, xrect & lpRect) ;//native from "user32.dll" alias "GetClientRect";
    int WINAPI GetWindowRect(HWND hWnd, xrect & lpRect) ;//native from "user32.dll" alias "GetWindowRect";
    int WINAPI MoveWindow(HWND hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint) ;//native from "user32.dll" alias "MoveWindow";
    int WINAPI GetCursorPos(/*manage*/xpoint & IpPoint) ;//native from "user32.dll" alias "GetCursorPos";
    int WINAPI SetCursorPos(int X, int Y) ;//native from "user32.dll" alias "SetCursorPos";
    int WINAPI SetParent(HWND hWndChild,HWND hWndNewParent) ;//native from "user32.dll" alias "SetParent";
    int WINAPI SetWindowPos(HWND hWnd, HWND hWndlnsertAfter,int X,int Y,int cx, int cy,int  Flags) ;//native from "user32.dll" alias "SetWindowPos";
    int WINAPI CreateWindowEx(int dwExStyle,string IpClassName,string lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, int hMenu, int hInstance, int lpParam) ;//native from "user32.dll" alias "CreateWindowExW";
    int WINAPI ScrollWindow(HWND hWnd, int XAmount, int YAmount, xrect IpRect, xrect lpClipRect) ;//native from "user32.dll" alias "ScrollWindow";
    int WINAPI ShowWindow(HWND hWnd, int nCmdShow) ;//native from "user32.dll" alias "ShowWindow";
    int WINAPI WindowFromPoint(int xPoint, int yPoint) ;//native from "user32.dll" alias "WindowFromPoint";
    int WINAPI SetClassLongW(HWND hWnd,int nlndex,int dwNewLong) ;//native from "user32.dll" alias "SetClassLongW";
    int WINAPI ScreenToClient(HWND hWnd, xpoint lpPoint) ;//native from "user32.dll" alias "ScreenToClient";
    int WINAPI GetCursor() ;//native from "user32.dll" alias "GetCursor";
    int WINAPI GetPinYinLeader(string & ,string) ;//native from "pinyin.dll" alias "GetPinYinLeader";
    int WINAPI SetTextColor(int hdc, int crColor ) ;//native from "gdi32.dll" alias "SetTextColor";
    int WINAPI SetCapture(HWND hWnd) ;//native from "user32.dll" alias "SetCapture";
    int WINAPI SetTimer(HWND hWnd, int nIDEvent, int uElapse, int lpTimerFunc) ;//native from "user32.dll" alias "SetTimer";
    int WINAPI KillTimer(HWND hWnd, int nIDEvent) ;//native from "user32.dll" alias "KillTimer";
    HWND WINAPI FindWindowExW(HWND hWndParent, HWND hWndChildAfter, string lpszClass, string lpszWindow) ;//native from "user32.dll" alias "FindWindowExW";
    int WINAPI DestroyWindow(HWND hWnd) ;//native from "user32.dll" alias "DestroyWindow";
    HMENU WINAPI CreatePopupMenu() ;//native from "user32.dll" alias "CreatePopupMenu";
    bool WINAPI AppendMenuW(HMENU hMenu, int uFlags, int uIDNewltem, string lpNewltem) ;//native from "user32.dll" alias "AppendMenuW";
    bool WINAPI TrackPopupMenu(HMENU hMenu, int uFlags, int x, int y, int nReserved, HWND hWnd, xrect prcRect) ;//native from "user32.dll" alias "TrackPopupMenu";
    //int WINAPI CallWindowProc(int OldWProc,HWND hWnd,int uMsg,param wParam,param lParam) ;//native from "user32.dll" alias "CallWindowProcW";
    int WINAPI InvalidateRect(HWND hWnd,xrect * lpRect, bool bErase) ;//native from "user32.dll" alias "InvalidateRect";
    int WINAPI Sleep(int dwMilliseconds) ;//native from "kernel32.dll" alias "Sleep";
    int WINAPI DestroyWindow(HWND hWnd) ;//native from "user32.dll" alias "DestroyWindow";
    int WINAPI GetClassNameW(HWND hWnd,string str,int nMaxCount) ;//native from "user32.dll" alias "GetClassNameW";
    int WINAPI GetDeviceCaps(HWND hWnd,int HORZRES) ;//native from "user32.dll" alias "GetDeviceCaps";
    int WINAPI GetComputerName(string name , int len) ;//native from "kernel32.dll" alias "GetComputerName";
    int WINAPI IsWindow(HWND hWnd) ;//native from "user32.dll" alias "IsWindow";
    int WINAPI GetCurrentDirectory(int nBufferLength, string lpBuffer) ;//native from "kernel32.dll" alias "GetCurrentDirectory";
    int WINAPI ShellExecuteW(HWND hWnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd) ;//native from "shell32.dll" alias "ShellExecuteW";
    int WINAPI DeleteFile(string lpFileName) ;//native from "Shlwapi.dll" alias "DeleteFileW";
    bool WINAPI PathFileExists(string lpFileName) ;//native from "shlwapi.dll" alias "PathFileExistsW";
    int WINAPI CreateDirectory(string lpFileName, string lpFileAttributes) ;//native from "kernel32.dll" alias "CreateDirectoryW";
    //bool WINAPI SystemParametersinfo(int uiAction,int uiParam,param pvParam,int fWinlni) ;//native from "user32.dll" alias "SystemParametersinfo";
    int WINAPI GetSystemMetrics(int nIndex) ;//native from "user32.dll" alias "GetSystemMetrics";
    HWND WINAPI FindWindowW(string lpClassName, string lpWindowName);//native from "user32.dll" alias "FindWindowW";
    int WINAPI GetTempPathW(int NAME_LEN,string & OutPath) ;//native from "kernel32.dll" alias "GetTempPathW";
    int WINAPI GetModuleHandleW(string lpModuleName) ;//native from "kernel32.dll" alias "GetModuleHandleW";
    int WINAPI GetModuleFileName(int hModule ,string & lpFileName ,int nSize ) ;//native from "kernel32.dll" alias "GetModuleFileName";
    void WINAPI GetLocalTime(SYSTEMTIME& lpSystemTime) ;//native from "kernel32.dll" alias "GetLocalTime";
}
#if 0
namespace win32
{
    void *  LoadLibrary(const wchar_t* lpText);
    bool  FreeLibrary(void *  hModule);
    void *  GetProcAddress(void* hModule, const char* lpText);
    LPARAM  GetProp(HWND  hWnd,string  lpString);
    HWND  GetParent(HWND) ;
    LRESULT MessageBoxW(HWND hWnd,string title,string caption,int button );
    LRESULT MessageBoxA(HWND hWnd,const char* title,const char* caption,int button );
    LRESULT SendMessage(HWND hWnd,int msg,WPARAM wparam,LPARAM lparam) ;
    LRESULT PostMessage(HWND hWnd,int msg,WPARAM wparam,LPARAM lparam) ;
    HDC GetDC(HWND hWnd) ;//native from "user32.dll" alias "GetDC";
    int ReleaseDC(HWND hWnd,int hDC) ;//native from "user32.dll" alias "ReleaseDC";
    HWND GetChild(HWND hWnd,int uCmd) ;//native from "user32.dll" alias "GetChild";
    int GetWindowTextW(HWND hWnd,string str,int nMaxCount) ;//native from "user32.dll" alias "GetWindowTextW";
    int SetWindowTextW(HWND hWnd,string str) ;//native from "user32.dll" alias "SetWindowTextW";
    int GetWindowTextLengthW(HWND hWnd) ;//native from "user32.dll" alias "GetWindowTextLengthW";
    int EnableWindow(HWND hWnd,bool abled) ;//native from "user32.dll" alias "EnableWindow";
    int SetFocus(HWND hWnd) ;//native from "user32.dll" alias "SetFocus";
    HWND GetFocus() ;//native from "user32.dll" alias "GetFocus";
    int IsWindowVisible(HWND hWnd) ;//native from "user32.dll" alias "IsWindowVisible";
    //int GetLocalTime(ref dwtime dt)  ;//native from "Kernel32.dll" alias "GetLocalTime";
    bool AnimateWindow(HWND hWnd,int dwTime,int dwFlags) ;//native from "user32.dll" alias "AnimateWindow";
    int GetKeyState(int nVirtKey) ;//native from "user32.dll" alias "GetKeyState";
    int SetWindowLong(HWND hWnd, int nIndex, int dwNewLong) ;//native from "user32.dll" alias "SetWindowLongW";
    LPARAM GetWindowLong(HWND hWnd, int nIndex) ;//native from "user32.dll" alias "GetWindowLongW";
    int GetClientRect(HWND hWnd, xrect & lpRect) ;//native from "user32.dll" alias "GetClientRect";
    int GetWindowRect(HWND hWnd, xrect & lpRect) ;//native from "user32.dll" alias "GetWindowRect";
    int MoveWindow(HWND hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint) ;//native from "user32.dll" alias "MoveWindow";
    int GetCursorPos(/*manage*/xpoint & IpPoint) ;//native from "user32.dll" alias "GetCursorPos";
    int SetCursorPos(int X, int Y) ;//native from "user32.dll" alias "SetCursorPos";
    int SetParent(HWND hWndChild,HWND hWndNewParent) ;//native from "user32.dll" alias "SetParent";
    int SetWindowPos(HWND hWnd, HWND hWndlnsertAfter,int X,int Y,int cx, int cy,int  Flags) ;//native from "user32.dll" alias "SetWindowPos";
    int CreateWindowEx(int dwExStyle,string IpClassName,string lpWindowName, int dwStyle, int x, int y, int nWidth, int nHeight, HWND hWndParent, int hMenu, int hInstance, int lpParam) ;//native from "user32.dll" alias "CreateWindowExW";
    int ScrollWindow(HWND hWnd, int XAmount, int YAmount, xrect IpRect, xrect lpClipRect) ;//native from "user32.dll" alias "ScrollWindow";
    int ShowWindow(HWND hWnd, int nCmdShow) ;//native from "user32.dll" alias "ShowWindow";
    int WindowFromPoint(int xPoint, int yPoint) ;//native from "user32.dll" alias "WindowFromPoint";
    int SetClassLongW(HWND hWnd,int nlndex,int dwNewLong) ;//native from "user32.dll" alias "SetClassLongW";
    int ScreenToClient(HWND hWnd, xpoint lpPoint) ;//native from "user32.dll" alias "ScreenToClient";
    int GetCursor() ;//native from "user32.dll" alias "GetCursor";
    int GetPinYinLeader(string & ,string) ;//native from "pinyin.dll" alias "GetPinYinLeader";
    int SetTextColor(int hdc, int crColor ) ;//native from "gdi32.dll" alias "SetTextColor";
    int SetCapture(HWND hWnd) ;//native from "user32.dll" alias "SetCapture";
    int SetTimer(HWND hWnd, int nIDEvent, int uElapse, int lpTimerFunc) ;//native from "user32.dll" alias "SetTimer";
    int KillTimer(HWND hWnd, int nIDEvent) ;//native from "user32.dll" alias "KillTimer";
    HWND FindWindowExW(HWND hWndParent, HWND hWndChildAfter, string lpszClass, string lpszWindow) ;//native from "user32.dll" alias "FindWindowExW";
    int DestroyWindow(HWND hWnd) ;//native from "user32.dll" alias "DestroyWindow";
    HMENU CreatePopupMenu() ;//native from "user32.dll" alias "CreatePopupMenu";
    bool AppendMenuW(HMENU hMenu, int uFlags, int uIDNewltem, string lpNewltem) ;//native from "user32.dll" alias "AppendMenuW";
    bool TrackPopupMenu(HMENU hMenu, int uFlags, int x, int y, int nReserved, HWND hWnd, xrect prcRect) ;//native from "user32.dll" alias "TrackPopupMenu";
    //int CallWindowProc(int OldWProc,HWND hWnd,int uMsg,param wParam,param lParam) ;//native from "user32.dll" alias "CallWindowProcW";
    int InvalidateRect(HWND hWnd,xrect & lpRect, bool bErase) ;//native from "user32.dll" alias "InvalidateRect";
    int Sleep(int dwMilliseconds) ;//native from "kernel32.dll" alias "Sleep";
    int DestroyWindow(HWND hWnd) ;//native from "user32.dll" alias "DestroyWindow";
    int GetClassNameW(HWND hWnd,string str,int nMaxCount) ;//native from "user32.dll" alias "GetClassNameW";
    int GetDeviceCaps(HWND hWnd,int HORZRES) ;//native from "user32.dll" alias "GetDeviceCaps";
    int GetComputerName(string name , int len) ;//native from "kernel32.dll" alias "GetComputerName";
    int IsWindow(HWND hWnd) ;//native from "user32.dll" alias "IsWindow";
    int GetCurrentDirectory(int nBufferLength, string lpBuffer) ;//native from "kernel32.dll" alias "GetCurrentDirectory";
    int ShellExecuteW(HWND hWnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd) ;//native from "shell32.dll" alias "ShellExecuteW";
    int DeleteFile(string lpFileName) ;//native from "Shlwapi.dll" alias "DeleteFileW";
    bool PathFileExists(string lpFileName) ;//native from "shlwapi.dll" alias "PathFileExistsW";
    int CreateDirectory(string lpFileName, string lpFileAttributes) ;//native from "kernel32.dll" alias "CreateDirectoryW";
    //bool SystemParametersinfo(int uiAction,int uiParam,param pvParam,int fWinlni) ;//native from "user32.dll" alias "SystemParametersinfo";
    int GetSystemMetrics(int nIndex) ;//native from "user32.dll" alias "GetSystemMetrics";
    HWND FindWindowW(string lpClassName, string lpWindowName);//native from "user32.dll" alias "FindWindowW";
    int GetTempPathW(int NAME_LEN,string & OutPath) ;//native from "kernel32.dll" alias "GetTempPathW";
    int GetModuleHandleW(string lpModuleName) ;//native from "kernel32.dll" alias "GetModuleHandleW";
    int GetModuleFileName(int hModule ,string & lpFileName ,int nSize ) ;//native from "kernel32.dll" alias "GetModuleFileName";
    void GetLocalTime(SYSTEMTIME& lpSystemTime) ;//native from "kernel32.dll" alias "GetLocalTime";
}
#endif
jrj/xframe/wobject/xapp.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,80 @@
#pragma once
#include "xobject.hpp"
#include "xnative.hpp"
#include "kobject/kapp.hpp"
using kapp = Hxsoft::XFrame::xfApp;
using kcachemgr = Hxsoft::XFrame::xfCacheMgr;
class xapp : public xnative
{
public:
    kapp* GetKApp()
    {
        return (kapp*)this->getNativePointer();
    }
public:
    int OnIdle(int nLevel)
    {
        return GetKApp()->OnIdle(nLevel);
    }
    int Idle(DWORD dwTime)
    {
        return GetKApp()->Idle(dwTime);
    }
public:
    int InitApp()
    {
        return GetKApp()->InitApp();
    }
    int ExitApp()
    {
        return GetKApp()->ExitApp();
    }
public:
    int AddhWnd(HWND hWnd)
    {
        return GetKApp()->AddhWnd(hWnd);
    }
    int RemovehWnd(HWND hWnd)
    {
        return GetKApp()->RemovehWnd(hWnd);
    }
public:
    int XFrameStartUp(HINSTANCE hInstance, DWORD dwIcon, DWORD dwIconSm)
    {
        return GetKApp()->XFrameStartUp(hInstance, dwIcon, dwIconSm);
    }
    int XFrameShutDown(HINSTANCE hInstance)
    {
        return GetKApp()->XFrameShutDown(hInstance);
    }
    HINSTANCE GetInstance()
    {
        return GetKApp()->GetInstance();
    }
public:
    static kapp* GetApp()
    {
        return kapp::GetApp();
    }
public:
    static const wchar_t* GetServerUrl()
    {
        return kapp::GetApp()->GetServerUrl();
    }
public:
    kcachemgr* GetCacheMgr()
    {
        return GetKApp()->GetCacheMgr();
    }
public:
    static int trace(LPCTSTR pstr)
    {
        return kapp::trace(pstr);
    }
public:
    int Run()
    {
        return GetKApp()->Run();
    }
};
jrj/xframe/wobject/xaserver.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,208 @@
#pragma once
#include "xbase.hpp"
#include "kobject/kxml.hpp"
#include "kobject/kxaserver.hpp"
using KXMLDOMDocument=Hxsoft::XFrame::KXMLDOMDocument;
using kxaserver = Hxsoft::XFrame::IXAServer;
class   xaserver
{
public:
    //读取开发的对象,pObject should in( 'xpage','entity','sheet','workflow','worknode','xquery','xaction'
    static int GetDevObject(LPCTSTR pStrServer,LPCTSTR pObject,LPCTSTR pObjGuid, KXMLDOMDocument&xml)
    {
        return kxaserver::GetDevObject(pStrServer,pObject,pObjGuid,xml);
    }
    //static int GetDevObject(ITrans * pTrans,LPCTSTR pObject,LPCTSTR pObjGuid, KXMLDOMDocument&xml);
    //int GetDevObject(LPCTSTR pObject,LPCTSTR pObjGuid, KXMLDOMDocument &xml);
public:
    //执行服务命令
    static LPTSTR ProcessCmd(LPCTSTR pStrServer,LPCTSTR pStrCmd,LPCTSTR pExtStr, bool needlogin=false)
    {
         return kxaserver::ProcessCmd(pStrServer, pStrCmd,pExtStr, needlogin);
    }
    static int ProcessCmd(LPCTSTR pStrServer,LPCTSTR pStrCmd,LPCTSTR pExtStr,BYTE * &pData,int &len)
    {
        return kxaserver::ProcessCmd(pStrServer,pStrCmd,pExtStr,pData,len);
    }
    //static int ProcessCmd(ITrans * pTrans,LPCTSTR pStrCmd,LPCTSTR pExtStr,BYTE * &pData,int &len);
    //int ProcessCmd(LPCTSTR pStrCmd,LPCTSTR pExtStr,BYTE * &pData,int &len)
    //int ProcessCmd(LPCTSTR pStrServer,LPCTSTR pStrCmd,LPCTSTR pExtStr,BYTE * &pData,int &len, HWND hWnd);
    //执行服务命令并装载到xml对象中
    static int FetchXml(LPCTSTR pStrServer,LPCTSTR pStrCmd,LPCTSTR pExtStr,KXMLDOMDocument &xml)
    {
        return kxaserver::FetchXml(pStrServer,pStrCmd,pExtStr,xml);
    }
    //static int FetchXml(ITrans * pTrans,LPCTSTR pStrCmd,LPCTSTR pExtStr,KXMLDOMDocument &xml);
    //int FetchXml(LPCTSTR pStrCmd,LPCTSTR pExtStr,KXMLDOMDocument &xml);
public:
    //执行服务命令并装载到xml对象中
    static int LoadUrl(LPCTSTR pStrServer,LPCTSTR pUrl,LPCTSTR pExtStr,BYTE * &pData,int &len,bool bCache=true)
    {
        return kxaserver::LoadUrl(pStrServer,pUrl,pExtStr,pData,len,bCache);
    }
    //static int LoadUrl(ITrans * pTrans,LPCTSTR pUrl,LPCTSTR pExtStr,BYTE * &pData,int &len,bool bCache=true);
    //int LoadUrl(LPCTSTR pUrl,LPCTSTR pExtStr,BYTE * &pData,int &len,bool bCache=true);
    //执行服务命令并装载到xml对象中
    static int LoadUrl(LPCTSTR pStrServer,LPCTSTR pUrl,LPCTSTR pExtStr,KXMLDOMDocument &xml)
    {
        return kxaserver::LoadUrl(pStrServer,pUrl,pExtStr,xml);
    }
    //static int LoadUrl(ITrans * pTrans,LPCTSTR pUrl,LPCTSTR pExtStr,KXMLDOMDocument &xml);
    //int LoadUrl(LPCTSTR pUrl,LPCTSTR pExtStr,KXMLDOMDocument &xml);
    //读取XPage
    static int LoadXPage(LPCTSTR pStrServer,LPCTSTR pStrUrl,KXMLDOMDocument &xml)
    {
        return kxaserver::LoadXPage(pStrServer,pStrUrl,xml);
    }
    //static int LoadXPage(ITrans * pTrans,LPCTSTR pStrUrl,KXMLDOMDocument &xml);
    //int LoadXPage(LPCTSTR pStrUrl,KXMLDOMDocument &xml);
public:
    //执行XQuery命令
    static int ExecXQuery(LPCTSTR pStrServer,LPCTSTR pObjGuid,LPCTSTR pArgs,BYTE * &pData,int &len)
    {
        return kxaserver::ExecXQuery(pStrServer,pObjGuid,pArgs,pData,len);
    }
    static int ExecXQuery(LPCTSTR pStrServer,LPCTSTR pObjGuid,LPCTSTR pArgs,KXMLDOMDocument &xml)
    {
         return kxaserver::ExecXQuery(pStrServer,pObjGuid,pArgs,xml);
    }
    static int ExecXAction(LPCTSTR pStrServer,LPCTSTR pObjGuid,LPCTSTR pArgs,BYTE * &pData,int &len)
    {
         return kxaserver::ExecXAction(pStrServer,pObjGuid,pArgs,pData,len);
    }
    static int ExecXAction(LPCTSTR pStrServer,LPCTSTR pObjGuid,LPCTSTR pArgs,KXMLDOMDocument &xml)
    {
         return kxaserver::ExecXAction(pStrServer,pObjGuid,pArgs,xml);
    }
    static int ExecXQuery(LPCTSTR pStrServer,LPCTSTR pObjGuid,LPCTSTR pArgs,int &val)
    {
         return kxaserver::ExecXQuery(pStrServer,pObjGuid,pArgs,val);
    }
    static int ExecXAction(LPCTSTR pStrServer,LPCTSTR pObjGuid,LPCTSTR pArgs)
    {
         return kxaserver::ExecXAction(pStrServer,pObjGuid,pArgs);
    }
    //static int ExecXQuery(ITrans * pTrans,LPCTSTR pObjGuid,LPCTSTR pArgs,BYTE * &pData,int &len);
    //static int ExecXQuery(ITrans * pTrans,LPCTSTR pObjGuid,LPCTSTR pArgs,KXMLDOMDocument &xml);
    //static int ExecXAction(ITrans * pTrans,LPCTSTR pObjGuid,LPCTSTR pArgs,BYTE * &pData,int &len);
    //static int ExecXAction(ITrans * pTrans,LPCTSTR pObjGuid,LPCTSTR pArgs,KXMLDOMDocument &xml);
    //int ExecXQuery(LPCTSTR pObjGuid,LPCTSTR pArgs,BYTE * &pData,int &len);
    //int ExecXQuery(LPCTSTR pObjGuid,LPCTSTR pArgs,KXMLDOMDocument &xml);
    //int ExecXAction(LPCTSTR pObjGuid,LPCTSTR pArgs,BYTE * &pData,int &len);
    //int ExecXAction(LPCTSTR pObjGuid,LPCTSTR pArgs,KXMLDOMDocument &xml);
    static LPCTSTR ExecArgs(LPCTSTR pArgs)
    {
        return kxaserver::ExecArgs(pArgs);
    }
public:
    //重新连接
    static int ReConnect(LPCTSTR pStrServer)
    {
        return kxaserver::ReConnect(pStrServer);
    }
    //static int ReConnect(ITrans * pTrans);
    //int ReConnect();
public:
    //得到用户
    static LPCTSTR GetUserNo()
    {
        return kxaserver::GetUserNo();
    }
    static LPCTSTR GetVersion()
    {
        return kxaserver::GetVersion();
    }
    static LPWSTR GetComputerNameEx()
    {
        return kxaserver::GetComputerNameEx();
    }
    static LPWSTR GetAppPath()
    {
        return kxaserver::GetAppPath();
    }
    static int SetUID(LPWSTR uid)
    {
        return kxaserver::SetUID(uid);
    }
    static LPWSTR GetUID()
    {
        return kxaserver::GetUID();
    }
    static LPWSTR GetMacAddress()
    {
        return kxaserver::GetMacAddress();
    }
    static LPWSTR GetIpAddress()
    {
        return kxaserver::GetIpAddress();
    }
    static LPWSTR GetConnectId()
    {
        return kxaserver::GetConnectId();
    }
    static int SetLoginLog(LPCTSTR pStrServer,LPWSTR pStatus)
    {
        return kxaserver::SetLoginLog(pStrServer,pStatus);
   }
    static void SetDataToClip(LPCTSTR DataStr)
    {
        return kxaserver::SetDataToClip(DataStr);
    }
public:
    //设置交易对象
    //ITrans * m_pTrans;
    //int SetTrans(ITrans *);
    //ITrans * GetTrans();
    static int UploadEx(LPTSTR pUri,LPTSTR pName,HWND m_hWnd,LPTSTR pSource=NULL,BOOL bCompress=false)
    {
        return kxaserver::UploadEx(pUri,pName,m_hWnd,pSource,bCompress);
    }
    static int Upload(LPTSTR pUri,LPTSTR pName,HWND m_hWnd,LPTSTR pSource=NULL,BOOL bCompress=false)
    {
        return kxaserver::Upload(pUri,pName,m_hWnd,pSource,bCompress);
    }
    static int Upload(LPTSTR pUri,LPTSTR pName,LPTSTR pPath,HWND m_hWnd,LPTSTR pSource=NULL,BOOL bCompress=false)
    {
        return kxaserver::Upload(pUri,pName,pPath,m_hWnd,pSource,bCompress);
    }
    static int FileCopy(LPTSTR pUri,LPTSTR pName,LPTSTR pUri1,LPTSTR pName1)
    {
        return kxaserver::FileCopy(pUri,pName,pUri1,pName1);
    }
    static LPTSTR UploadFile(LPTSTR pUri,LPTSTR pName,HWND m_hWnd,LPTSTR pSource,BOOL bCompress)
    {
        return kxaserver::UploadFile(pUri,pName,m_hWnd,pSource,bCompress);
    }
    static int __DeleteFile(LPTSTR pName)
    {
        return kxaserver::__DeleteFile(pName);
    }
    static int __CreateDirectory(LPTSTR pName)
    {
        return kxaserver::__CreateDirectory(pName);
    }
    static int DownLoadFile(LPCTSTR pStrServer,LPCTSTR pUrl,LPCTSTR pExt,LPTSTR pName=NULL)
    {
        return kxaserver::DownLoadFile(pStrServer,pUrl,pExt,pName);
    }
    static int UploadData(LPTSTR pUri,LPTSTR pName,LPTSTR pData)
    {
        return kxaserver::UploadData(pUri,pName,pData);
    }
};
jrj/xframe/wobject/xaserverarg.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,115 @@
#pragma once
#include "xnative.hpp"
namespace Hxsoft{ namespace XFrame
{
    class IXAServerArg
    {
    public:
        int ClearArgs();
        int RemoveArg(LPCTSTR pArgName);
        int SetArg(LPCTSTR pArgName,LPCTSTR pValue,LPCTSTR pTyp = NULL);
        int AddArg(LPCTSTR pArgName,LPCTSTR pValue,LPCTSTR pTyp = NULL);
        int GetArgInt(LPTSTR pArgName);
        LPTSTR GetArgString(LPTSTR pArgName);
        bool GetArgBool(LPTSTR pArgName);
        double GetArgDouble(LPTSTR pArgName);
        LPCTSTR GetString();
    public:
        int SetParam(LPCTSTR pArgName, LPARAM pValue);
        LPARAM GetParam(LPCTSTR pArgName);
    public:
        static IXAServerArg * CreateInstance();
        static int ReleaseInstance(IXAServerArg * pArgs);
        int SetXml(LPTSTR pStrXml);
    };
}};
class xaserverarg : public xnative
{
public:
    xaserverarg():xnative(Hxsoft::XFrame::IXAServerArg::CreateInstance()){}
    ~xaserverarg()
    {
        Hxsoft::XFrame::IXAServerArg::ReleaseInstance((Hxsoft::XFrame::IXAServerArg*)getNativePointer());
    }
public:
    /*int AddArg(string argname,double val,string typ=NULL)// alias "?AddArg@IXAServerArg@XFrame@Hxsoft@@QAEHPB_WNO@Z";
    {
        return ((Hxsoft::XFrame::IXAServerArg*)getNativePointer())->AddArg(argname,val,typ);
    }
    int AddArg(string argname,int val,string typ=NULL) //alias "?AddArg@IXAServerArg@XFrame@Hxsoft@@QAEHPB_WHO@Z";
    {
        return ((Hxsoft::XFrame::IXAServerArg*)getNativePointer())->AddArg(argname,val,typ);
    }*/
    int AddArg(string argname,string val,string typ=NULL) //alias "?AddArg@IXAServerArg@XFrame@Hxsoft@@QAEHPB_W00@Z";
    {
        return ((Hxsoft::XFrame::IXAServerArg*)getNativePointer())->AddArg(argname,val,typ);
    }
    int ClearArgs() //alias "?ClearArgs@IXAServerArg@XFrame@Hxsoft@@QAEHXZ"  from "xframe.dll";
    {
        return ((Hxsoft::XFrame::IXAServerArg*)getNativePointer())->ClearArgs();
    }
    int RemoveArg(string argname) //alias "?RemoveArg@IXAServerArg@XFrame@Hxsoft@@QAEHPB_W@Z";
    {
        return ((Hxsoft::XFrame::IXAServerArg*)getNativePointer())->RemoveArg(argname);
    }
    /*int SetArg(string argname,double val,string typ=NULL) //alias "?SetArg@IXAServerArg@XFrame@Hxsoft@@QAEHPB_WNO@Z";
    {
        return ((Hxsoft::XFrame::IXAServerArg*)getNativePointer())->SetArg(argname,val,typ);
    }
    int SetArg(string argname,int val,string typ=NULL) //alias "?SetArg@IXAServerArg@XFrame@Hxsoft@@QAEHPB_WHO@Z";
    {
        return ((Hxsoft::XFrame::IXAServerArg*)getNativePointer())->SetArg(argname,val,typ);
    }*/
    int SetArg(string argname,string val,string typ=NULL) //alias "?SetArg@IXAServerArg@XFrame@Hxsoft@@QAEHPB_W00@Z";
    {
        return ((Hxsoft::XFrame::IXAServerArg*)getNativePointer())->SetArg(argname,val,typ);
    }
    string GetString() //alias "?GetString@IXAServerArg@XFrame@Hxsoft@@QAEPB_WXZ"  from "xframe.dll";
    {
        return ((Hxsoft::XFrame::IXAServerArg*)getNativePointer())->GetString();
    }
    static void* CreateInstance() //alias "?CreateInstance@IXAServerArg@XFrame@Hxsoft@@SAPAV123@XZ";
    {
        return Hxsoft::XFrame::IXAServerArg::CreateInstance();
    }
    static int ReleaseInstance(void* p) //alias "?ReleaseInstance@IXAServerArg@XFrame@Hxsoft@@SAHPAV123@@Z";
    {
        Hxsoft::XFrame::IXAServerArg::ReleaseInstance((Hxsoft::XFrame::IXAServerArg*)p);
        return 1;
    }
    bool GetArgBool(string argname) //alias "?GetArgBool@IXAServerArg@XFrame@Hxsoft@@QAE_NPA_W@Z";
    {
        return ((Hxsoft::XFrame::IXAServerArg*)getNativePointer())->GetArgBool((LPTSTR)argname);
    }
    double GetArgDouble(string argname) //alias "?GetArgDouble@IXAServerArg@XFrame@Hxsoft@@QAENPA_W@Z";
    {
        return ((Hxsoft::XFrame::IXAServerArg*)getNativePointer())->GetArgDouble((LPTSTR)argname);
    }
    int  GetArgInt(string argname) //alias "?GetArgInt@IXAServerArg@XFrame@Hxsoft@@QAEHPA_W@Z";
    {
        return ((Hxsoft::XFrame::IXAServerArg*)getNativePointer())->GetArgInt((LPTSTR)argname);
    }
    string GetArgString(string argname) //alias "?GetArgString@IXAServerArg@XFrame@Hxsoft@@QAEPA_WPA_W@Z";
    {
        return ((Hxsoft::XFrame::IXAServerArg*)getNativePointer())->GetArgString((LPTSTR)argname);
    }
    int SetParam(LPCTSTR pArgName, LPARAM pValue)
    {
        return ((Hxsoft::XFrame::IXAServerArg*)getNativePointer())->SetParam(pArgName,pValue);
    }
    LPARAM GetParam(LPCTSTR pArgName)
    {
        return ((Hxsoft::XFrame::IXAServerArg*)getNativePointer())->GetParam(pArgName);
    }
};
jrj/xframe/wobject/xbase.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,270 @@
#pragma once
#include "base.hpp"
/*
struct xevent
{
    int hWnd;
    int message;
    int wParam;
    int lParam;
    int time;
    xpoint scpt;
};
struct xeventcommand
{
    xevent evt;
    string cmdid;
    void*   pfrom;
};
struct xeventmouse : public xevent
{
    int nFlags;
    xpoint pt;
};
struct NMHDR
{
    HWND hwndFrom;
    int idFrom;
    int code;
};
struct xeventnotify : public xevent
{
    int idCtrl;
    NMHDR*  pNMHDR;
};
*/
typedef unsigned int UINT;
typedef struct NMHDR
{
    HWND hwndFrom;
    UINT_PTR idFrom;
    int code;
} * LPNMHDR;
typedef struct tagEvent
{
    HWND    hWnd;
    DWORD    message;
    WPARAM    wParam;
    LPARAM    lParam;
    DWORD    time;
    POINT    pt;
    union
    {
        struct {
            int wmId    ;
            int wmEvent ;
            HWND hCtrl ;
        }command;
        struct
        {
            LPTSTR pStrID;
            void * pCmdFrom;
        }xcommand;
        struct {
            UINT nFlags;
            POINT point;
        } mouse;
        struct {
            UINT nFlags;
            POINT point;
        } size;
        struct {
            UINT nChar;
            UINT nRepCnt;
            UINT nFlags;
        }key;
        struct {
            HDC hdc;
        }paint;
        struct {
            HWND    hWnd ;
            UINT    nHitTest;
            UINT    mouseMsg;
        }cursor;
        struct {
            UINT nSBCode;
            UINT nPos;
            HWND hWndCtl;
        }scroll;
        struct {
            POINT point;
            UINT_PTR fwKeys;
            short zDelta;
        }wheel;
        struct {
            int idCtrl;
            LPNMHDR pnmh;
        }notify;
    };
    void * pSrcObject;
    LPARAM    dwRet;
} TEvent;
typedef TEvent TNotifyEvent;
/*
struct TEvent
{
    int        hWnd;
    int        message;
    int        wParam;
    int        lParam;
    int        time;
    xpoint    pt;
};
struct TMouseEvent : public TEvent
{
    int nFlags;
    xpoint point;
};
struct TKeyEvent :  public TEvent
{
    int nChar;
    int nRepCnt;
    int nFlags;
};
struct TXCommandEvent : public TEvent
{
    string pStrID;
};
struct TCommandEvent : public TEvent
{
    int wmId    ;
    int wmEvent ;
    int hCtrl ;
};
struct TPaintEvent :  public TEvent
{
    int hdc;
};
struct TScrollEvent : public TEvent
{
    int nSBCode;
    int nPos;
    int hWndCtl;
};
struct TWheelEvent : public TEvent
{
    xpoint point;
    int fwKeys;
    short zDelta;
};
struct TNotifyEvent : public TEvent
{
    int idCtrl;
    NMHDR* pnmh; //ref
};
struct     DWASKSTYLENMHDR :  public NMHDR
{
    int row;
    int col;
    string colname;
    int mask;
    int indent;
    int imagelist;
    int image;
    int cximage;
    int cyimage;
    int imagerightindent;
    string cssstyle;
    string cssclass;
    string text;
    xrect    rt;
};
*/
struct    IMGNNMHDR :  public NMHDR
{
   string path;
   string text;
   int nIndex;
};
struct     PAGENMHDR :  public NMHDR
{
    int max;
    int cur;
};
struct     LYSNMHDR : public NMHDR
{
    int nSheet;
};
struct xstruct
{
};
struct OVERLAPPED : public xstruct
{
    int Internal;
    int InternalHigh;
    int Offset;
    int OffsetHigh;
    int hEvent;
};
struct OFSTRUCT : public xstruct
{
    int cBytes;
    int fFixedDisk;
    int nErrCode;
    int Reserved1;
    int Reserved2;
    string szPathName;
};
struct     CELLNMHDR : public NMHDR
{
    int currentrow;
    int currentcol;
    string data;
    int anchorrow;
    int anchorcol;
};
struct     DWNMHDR : public NMHDR
{
    void* dw;
    int row;
    int col;
    string data;
    int oldrow;
    int oldcol;
    string colname;
    string oldcolname;
};
struct     DWASKSTYLENMHDR : public NMHDR
{
    int row;
    int col;
    LPTSTR colname;
    int mask;
    int indent;
    int imagelist;
    int image;
    int cximage;
    int cyimage;
    int indent1;
    LPTSTR pCssStyle;
    LPTSTR pCssClass;
    RECT rt;
    LPTSTR pStr;
};
//typedef int FEvent(TEvent * evt, int p);
jrj/xframe/wobject/xcachemgr.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
#pragma once
#include "xobject.hpp"
#include "xnative.hpp"
#include <kobject/kapp.hpp>
#include <kobject/kcachemgr.hpp>
using kcachemgr = Hxsoft::XFrame::xfCacheMgr;
class xcachemgr : public xnative
{
public:
    kcachemgr* GetCacheMgr()
    {
        return (kcachemgr*)getNativePointer();
    }
public:
    int InsertCacheFile(LPTSTR pStrUrl, LPTSTR pCacheFile, DWORD ver = 0)
    {
        return GetCacheMgr()->InsertCacheFile(pStrUrl, pCacheFile, ver);
    }
    LPCTSTR GetCacheFile(LPTSTR pStrUrl)
    {
        return GetCacheMgr()->GetCacheFile(pStrUrl);
    }
    DWORD GetCacheVersion(LPTSTR pStrUrl)
    {
        return GetCacheMgr()->GetCacheVersion(pStrUrl);
    }
public:
    void CacheObject(LPCTSTR pUrl, void* pObject)
    {
        return GetCacheMgr()->CacheObject(pUrl, pObject);
    }
    void* GetCacheObject(LPCTSTR pUrl)
    {
        return GetCacheMgr()->GetCacheObject(pUrl);
    }
};
jrj/xframe/wobject/xcontrol.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,64 @@
#pragma once
#include "xview.hpp"
#include "kobject/kcontrol.hpp"
#include "kobject/kwin.hpp"
#include "win32/win.hpp"
#include "wobject/xstring.hpp"
using kwin=Hxsoft::XFrame::IXFWin;
using kcontrol = Hxsoft::XFrame::IXFControl;
class xcontrol: public xview
{
public:
    xcontrol(void * impl):xview(impl){}
public:
    int Redraw()
    {
        return ((kcontrol*)this->getNativePointer())->Redraw();
    }
    HWND GetHWND()
    {
        return ((kcontrol*)this->getNativePointer())->GetHWND();
    }
    int SetReadOnlyEx(const bool )
    {
        int EM_SETREADONLY = 0x00CF;
        return SendMessage(GetHWND(),EM_SETREADONLY,0,0);
    }
    int EnableWindow(bool abled)
    {
        return ::EnableWindow(GetHWND(),abled);
    }
    int GetTextLength()
    {
        int WM_GETTEXTLENGTH = 0x000E;
        int nLen = ::GetWindowTextLengthW(GetHWND());
        return nLen;
    }
    xstring GetText()
    {
        int WM_GETTEXT = 0x000D;
        int nLen = GetTextLength();
        xstring xs;
        GetWindowTextW(GetHWND(),xs.sure(nLen+1),nLen + 1);
        return xs;
    }
    int SetText(string value)
    {
        int WM_SETTEXT = 0x000C;
        ::SetWindowTextW(GetHWND(),value);
        return 1;
    }
    KXMLDOMElement GetElement()
    {
        return ((kcontrol*)this->getNativePointer())->GetElement();
    }
};
jrj/xframe/wobject/xdouble.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,35 @@
#pragma once
//#include <stdio.h>
//#include <stdlib.h>
//#include <tchar.h>
//#include <memory.h>
#include "system/base.hpp"
#include "xstring.hpp"
#include "wobject/xutil.hpp"
class xdouble
{
private:
    double value;
public:
    xdouble(double val = 0) :value(val) {}
    xdouble(int val) :value((double)val) {}
    xdouble(xstring val) :value(val.toDouble()) {}
public:
    operator double() { return value; }
    double toInt() { return (int)value; }
    xstring toString() { return xstring(value); }
    double round(int len)
    {
        wchar_t format[64] = L"#.";
        for (int i = 0; i < len && i<  60; i++)
        {
            format[2+i] = L'#';
        }
        xstring str(value);
        bool del = false;
        xstring str1 = xutil::FormatDecimalString((LPTSTR)str.c_str(), format, del);
        return str1.toDouble();
    }
};
jrj/xframe/wobject/xint.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
#pragma once
//#include <stdio.h>
//#include <stdlib.h>
//#include <tchar.h>
//#include <memory.h>
#include "system/base.hpp"
#include "xstring.hpp"
class xint
{
private:
    int value;
public:
    xint(int val = 0) :value(val) {}
    xint(double val) :value((int)val) {}
    xint(xstring val) :value(val.toInt()) {}
public:
    operator int() { return value; }
    double toDouble() { return (double)value; }
    xstring toString() { return (xstring(value); }
};
jrj/xframe/wobject/xnative.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,28 @@
#pragma once
#include "xobject.hpp"
class xnative : public xobject
{
private:
    void* ptr_native_;
public:
    xnative():ptr_native_(0){}
    xnative(void* nativePtr):ptr_native_(nativePtr){}
public:
    void setNativePointer(void* nativePtr){ ptr_native_ = nativePtr; }
    void* getNativePointer(){ return ptr_native_;}
public:
    void SetNativePtr(void * nativePtr)
    {
        ptr_native_ = nativePtr;
    }
    void * GetNativePtr()
    {
        return ptr_native_;
    }
public:
    operator bool()
    {
        return ptr_native_?true:false;
    }
};
jrj/xframe/wobject/xnode.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,239 @@
#pragma once
#include "xbase.hpp"
#include "xnative.hpp"
#include "kobject/knode.hpp"
#include "kobject/kpage.hpp"
using knode = Hxsoft::XFrame::IXNode ;
using kwin = Hxsoft::XFrame::IXFWin ;
using kpage = Hxsoft::XFrame::IXPage ;
using kcontrol = Hxsoft::XFrame::IXFControl;
class xnode : public xnative
{
public:
    xnode() :xnative(nullptr) {}
    xnode(void * impl):xnative(impl){}
public:
    knode* getKNode()
    {
        (knode*)this->GetNativePtr();
    }
public:
    LPCWSTR GetNodeName()
    {
        return getKNode()->GetNodeName();
    }
    LPCWSTR GetNodeID()
    {
        return getKNode()->GetNodeID();
    }
public:
    int SetNodeName(LPCWSTR pNodeName)
    {
        return getKNode()->SetNodeName(pNodeName);
    }
    int SetNodeID(LPCWSTR pNodeID)
    {
        return getKNode()->SetNodeID(pNodeID);
    }
public:
    LPCWSTR GetCaption()
    {
        return getKNode()->GetCaption();
    }
    int SetCaption(LPCWSTR pCaption)
    {
        return getKNode()->SetCaption(pCaption);
    }
public:
    knode * GetNodeByID(LPCWSTR pStrNodeID)
    {
        return getKNode()->GetNodeByID(pStrNodeID);
    }
    knode * GetNodeByName(LPCWSTR pStrName)
    {
        return getKNode()->GetNodeByName(pStrName);
    }
public:
    knode * GetXNode()
    {
        return getKNode()->GetXNode();
    }
    kpage * GetXPage()
    {
        return getKNode()->GetXPage();
    }
    KXMLDOMElement  GetElement()
    {
        return getKNode()->GetElement();
    }
public:
    knode * GetRootNode()
    {
        return getKNode()->GetRootNode();
    }
    BOOL IsControlNode()
    {
        return getKNode()->IsControlNode();
    }
    BOOL IsControlNode(knode *pNode)
    {
        return getKNode()->IsControlNode(pNode);
    }
public:
    kcontrol* GetControl()
    {
        return getKNode()->GetControl();
    }
public:
    int SetXNode(knode* pNode,bool bReCeate = true)
    {
        return getKNode()->SetXNode(pNode,bReCeate);
    }
    int SetElement(knode * pNode,bool bReCeate = false)
    {
        return getKNode()->SetElement(pNode,bReCeate);
    }
public:
    int RemoveControl()
    {
        return getKNode()->RemoveControl();
    }
    int CreateControl(HWND hWnd)
    {
        return getKNode()->CreateControl(hWnd);
    }
public:
    int RemoveChild()
    {
        return getKNode()->RemoveChild();
    }
    int RemoveChild(knode * pParentNode)
    {
        return getKNode()->RemoveChild(pParentNode);
    }
public:
    knode * CreateNode(KXMLDOMElement pElement,bool setClassName = true)
    {
        return getKNode()->CreateNode(pElement,setClassName);
    }
public:
    int TransToControl(LPCWSTR pControlClass)
    {
        return getKNode()->TransToControl(pControlClass);
    }
    int TransToControl(knode * pNode,LPCWSTR pControlClass)
    {
        return getKNode()->TransToControl(pNode,pControlClass);
    }
public:
    RECT & GetAreaRect()
    {
        return getKNode()->GetAreaRect();
    }
    RECT & GetContentRect()
    {
        return getKNode()->GetContentRect();
    }
public:
    int SetAreaRect(RECT & rc)
    {
        return getKNode()->SetAreaRect(rc);
    }
    int SetContentRect(RECT & rc)
    {
        return getKNode()->SetContentRect(rc);
    }
public:
    //adjust or size rect
    int AdjustRect() //adjust content rect,adjust child node or brother node
    {
        return getKNode()->AdjustRect();
    }
    int AdjustRect(RECT rect) //adjust content rect,adjust child node or brother node
    {
        return getKNode()->AdjustRect(rect);
    }
    int AdjustRect(int dx) //adjust content rect,adjust child node or brother node
    {
        return getKNode()->AdjustRect(dx);
    }
    int CalcContentRect()    //calc content rect
    {
        return getKNode()->CalcContentRect();
    }
    int CreateNodeControl(HWND    hWnd)
    {
        return getKNode()->CreateNodeControl(hWnd);
    }
    int AdjustCtrlRect()
    {
        return getKNode()->AdjustCtrlRect();
    }
public:
    //draw
    int DrawNode(HDC hDC)
    {
        return getKNode()->DrawNode(hDC);
    }
public:
    knode * GetParentNode()
    {
        return getKNode()->GetParentNode();
    }
    int GetChildNodesCount()
    {
        return getKNode()->GetChildNodesCount();
    }
    knode* GetChild(int nItem) //from 0
    {
        return getKNode()->GetChild(nItem);
    }
    bool RemoveChildNode(int nIndex)
    {
        return getKNode()->RemoveChildNode(nIndex);
    }
    knode* InsertChildNode(int nIndex, LPTSTR pXml)
    {
        return getKNode()->InsertChildNode(nIndex, pXml);
    }
    knode* InsertChildNode(int nIndex, KXMLDOMElement  pElement )
    {
        return getKNode()->InsertChildNode(nIndex,pElement);
    }
public:
    DWORD GetLayerFlow()
    {
        return getKNode()->GetLayerFlow();
    }
    int SetLayerFlow(DWORD dwLayerFlow)
    {
        return getKNode()->SetLayerFlow(dwLayerFlow);
    }
    DWORD GetLayerFlow(knode * pNode)
    {
        return getKNode()->GetLayerFlow(pNode);
    }
    int SetLayerFlow(knode * pNode,DWORD dwLayerFlow)
    {
        return getKNode()->SetLayerFlow(pNode,dwLayerFlow);
    }
};
jrj/xframe/wobject/xobject.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
#pragma once
#include "win32/win.hpp"
class xobject
{
public:
    void * GetFuncPtr(const wchar_t* dll, const char * name)
    {
        void * fnAttachEvent = nullptr;
        void * hModule = LoadLibraryW(dll);
        if(hModule)fnAttachEvent = GetProcAddressW(hModule,name);
        return fnAttachEvent;
    }
};
jrj/xframe/wobject/xpage.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,141 @@
#pragma once
#include "xbase.hpp"
#include "xnative.hpp"
#include "kobject/knode.hpp"
#include "kobject/kpage.hpp"
using knode = Hxsoft::XFrame::IXNode ;
using kwin = Hxsoft::XFrame::IXFWin ;
using kpage = Hxsoft::XFrame::IXPage ;
using kcontrol = Hxsoft::XFrame::IXFControl;
using KXMLDOMElement = Hxsoft::XFrame::KXMLDOMElement;
class xpage : public xnative
{
public:
    kpage* getKPage()
    {
        return (kpage*)this->GetNativePtr();
    }
public:
    bool Load(LPCTSTR pStrXPageFile)
    {
        return getKPage()->Load(pStrXPageFile);
    }
    bool Load(KXMLDOMElement pElement)
    {
        return getKPage()->Load(pElement);
    }
    bool LoadXPage(LPCTSTR pServer,LPCTSTR pStrUrl)
    {
        return getKPage()->LoadXPage(pServer,pStrUrl);
    }
    //bool LoadXPage(ITrans *pTrans,LPCTSTR pStrUrl);
    bool LoadXPage(LPCTSTR pStrPage)
    {
        return getKPage()->LoadXPage(pStrPage);
    }
public:
    kcontrol * GetControl()
    {
         return getKPage()->GetControl();
    }
    kwin *     GetWin()
    {
        return getKPage()->GetWin();
    }
public:
    LPCTSTR GetStrLocal()
    {
        return getKPage()->GetStrLocal();
    }
    LPCTSTR GetUrl()
    {
        return getKPage()->GetUrl();
    }
    LPCTSTR GetWkUrl()
    {
        return getKPage()->GetWkUrl();
    }
public:
    int SetStrLocal(LPCTSTR pStr)
    {
        return getKPage()->SetStrLocal(pStr);
    }
    int SetUrl(LPCTSTR pStr)
    {
        return getKPage()->SetUrl(pStr);
    }
    int SetWkUrl(LPCTSTR pStr)
    {
        return getKPage()->SetWkUrl(pStr);
    }
public:
    int SetXNode(knode * pNode,bool bReCeate = true)
    {
        return getKPage()->SetXNode(pNode,bReCeate);
    }
    int SetElement(knode * pNode,bool bReCeate = false)
    {
        return getKPage()->SetElement(pNode,bReCeate);
    }
public:
    int RemoveControl()
    {
        return getKPage()->RemoveControl();
    }
    int CreateNodeControl(HWND hWnd)
    {
        return getKPage()->CreateNodeControl(hWnd);
    }
public:
    int RemoveChild()
    {
        return getKPage()->RemoveChild();
    }
    int RemoveChild(knode * pParentNode)
    {
        return getKPage()->RemoveChild(pParentNode);
    }
public:
    static knode * CreateNode(KXMLDOMElement * pElement,bool setClassName = true)
    {
        return Hxsoft::XFrame::IXPage::CreateNode(pElement,setClassName);
    }
public:
    static int TransToControl(knode * pNode,LPCTSTR pControlClass)
    {
        return Hxsoft::XFrame::IXPage::TransToControl(pNode,pControlClass);
    }
public:
    BOOL IsControlNode(knode *pNode)
    {
        return getKPage()->IsControlNode(pNode);
    }
public:
    DWORD GetLayerFlow()
    {
        return getKPage()->GetLayerFlow();
    }
    int SetLayerFlow(DWORD dwLayerFlow)
    {
        return getKPage()->SetLayerFlow(dwLayerFlow);
    }
    DWORD GetLayerFlow(knode * pNode)
    {
        return getKPage()->GetLayerFlow(pNode);
    }
    int SetLayerFlow(knode * pNode,DWORD dwLayerFlow)
    {
        return getKPage()->SetLayerFlow(pNode,dwLayerFlow);
    }
public:
    //draw
    int DrawNode(HDC hDC)
    {
        return getKPage()->DrawNode(hDC);
    }
};
jrj/xframe/wobject/xstring.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,98 @@
#pragma once
//#include <stdio.h>
//#include <stdlib.h>
//#include <tchar.h>
//#include <memory.h>
#include "system/base.hpp"
class xstring
{
private:
    //wchar_t* data;
    void * data;
public:
    xstring();
    xstring(const xstring& rhs);
    xstring(int val);
    xstring(double val);
    xstring(LPARAM val);
    xstring(wchar_t* val, bool shouldSysFree = false);
    xstring(const wchar_t* val, bool shouldSysFree = false);
    ~xstring();
public:
    operator const wchar_t*()
    {
        return c_str();
    }
    xstring& operator =(const xstring& rhs);
    xstring& operator =(const wchar_t* rhs);
    bool operator ==(const wchar_t* rhs);
    bool operator >=(const wchar_t* rhs);
    bool operator >(const wchar_t* rhs);
    bool operator <=(const wchar_t* rhs);
    bool operator <(const wchar_t* rhs);
    bool operator !=(const wchar_t* rhs);
    bool operator ==(const xstring &rhs);
    bool operator >=(const xstring& rhs);
    bool operator >(const xstring& rhs);
    bool operator <=(const xstring& rhshs);
    bool operator <(const xstring& rhs);
    bool operator !=(const xstring& rhs);
    operator bool();
public:
    const wchar_t* c_str(bool bclone = false) const;
    int length();
public:
    wchar_t* sure(int len);
public:
    //static const wchar_t* concat(const wchar_t* lhs, const wchar_t* rhs);
    wchar_t at(int index);
    //static xstring concat(xstring && lhs, xstring && rhs);
    xstring concat(const wchar_t* rhs);
    xstring concat(xstring&& rhs);
    xstring operator +(const wchar_t* rhs);
    xstring operator +(xstring rhs);
    xstring& operator +=(const wchar_t* rhs);
    xstring& operator +=(xstring rhs);
    bool isEmpty();
    int find(const xstring & str);
    int find(const wchar_t* str);
    int find(const wchar_t* str,int pos);
    xstring mid(int start, int len);
    xstring left(int len);
    xstring right(int len);
    int toInt();
    __int64 toInt64();
    double toDouble();
    xstring toUpper();
    xstring toLower();
    xstring trim();
    xstring ltrim();
    xstring rtrim();
    bool isNumber();
    xstring replace(wchar_t* from, wchar_t* to, int pos);
};
xstring operator +(const wchar_t* lhs, const xstring& rhs);
class bstring : public xstring
{
public:
    bstring(const wchar_t* val):xstring(val,true){}
};
jrj/xframe/wobject/xurl.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,210 @@
#pragma once
#include "xbase.hpp"
#include "kobject/kxml.hpp"
#include "wobject/xapp.hpp"
#include "wobject/xstring.hpp"
#include "wobject/xaserver.hpp"
#include "wobject/xaserverarg.hpp"
#include "wobject/xutil.hpp"
#include "win32/win.hpp"
class xurl
{
public:
    static int getEx(string serverurl,string aurl, string args, Hxsoft::XFrame::KXMLDOMDocument x)
    {
        xstring arg = L"<arg name='url' value='";
        arg = arg + aurl +L"'/>";
        int ret;
        if(xstring(args) == L"" || xstring(args).find(L"<args/>",0)>-1)
        {
            ret = xaserver::ExecXQuery( serverurl,L"[service.url.xq]",(L"<args>"+arg+L"</args>").c_str(),x);
        }
        else
        {
            xstring tmp = xstring(args).mid(6, 9999999);
            ret = xaserver::ExecXQuery( serverurl,L"[service.url.xq]",(L"<args>" + arg +tmp).c_str(),x);
        }
        if(ret != 1) return -1;
        return 1;
    }
    static int get(string url1, string args, Hxsoft::XFrame::KXMLDOMDocument x)
    {
        return get(xapp::GetApp()->GetServerUrl(), url1, args, x);
    }
    static int get(string serverUrl,string url1, string args, Hxsoft::XFrame::KXMLDOMDocument x)
    {
        //return getEx(serverUrl,url1, args, x);
        #if 0
        //trace("\r\n-----------");
        bool f0 = xutil::HasCacheData(((xstring)L"[URL]"+url1).c_str());
        if(f0)
            url1 = xutil::GetUrlData(((xstring)L"[URL]"+url1).c_str());
        //trace("%s",url1);
        bool f = xutil::HasCacheData(url1);
        bool f1 = xutil::HasCacheData(((xstring)L"[VER]"+url1).c_str());
        string ver = L"1";
        string t = L"0";
        if(f && f1)
        {
            Hxsoft::XFrame::KXMLDOMDocument xl2;
            xaserverarg arg;
            arg.AddArg(L"url", url1);
            xaserver::ExecXQuery( serverUrl,L"[service.url.type.xq]",arg.GetString(),xl2);
            BSTR str = (BSTR)xl2.xml();
            if( str && str[0])
                t = xl2.text();
            string t1 = xutil::GetUrlData(((xstring)L"[VER]"+url1).c_str());
            //trace("\r\nclient:%s  server:%s", t1, t);
            //win32::alert("url:"+url1+"      client:"+t1+"     server:"+t);
            if(t == t1)
            {
                //trace("\r\nurl: %s find", url1);
                string d = xutil::GetUrlData(url1);
                //trace("\r\nurl: %s data: %s", aurl, d.left(100));
                x.loadXML(d);
                return 1;
            }
            ver = t;
        }
        //trace("\r\nurl: %s not find", url1);
        #endif
        xstring iface ;
        xstring root ;
        Hxsoft::XFrame::KXMLDOMDocument doc;
        Hxsoft::XFrame::KXMLDOMNode n;
        Hxsoft::XFrame::KXMLDOMDocument xl ;
        xstring aurl = url1;
        int pos = aurl.find(L".vface",0);
        if(pos>0)
        {
            //MessageBoxW(0,aurl.c_str(),L"vface",0);
            iface = aurl.left(pos+6);
            root = aurl.mid(pos +6,9999);
            xaserver::LoadUrl(serverUrl,L"dev:xml[sale.view.url.xml]",L"",xl);
            doc = xl;
            n = doc.selectSingleNode(((xstring)L"//item[@src='dev:vface[" + iface+L"]']/@url").c_str());
            if(n)
                aurl = (xstring)L"/sale/view/"+n.text()+root;
            else
            {
                xaserver::LoadUrl(serverUrl,L"dev:xml[saleex.view.url.xml]",L"",xl);
                doc = xl;
                n = doc.selectSingleNode(((xstring)L"//item[@src='dev:vface[" + iface+L"]']/@url").c_str());
                if(n)
                    aurl = (xstring)L"/sale/view/"+n.text()+root;
                else
                    return -1;
            }
        }
        else if (aurl.find(L".iface",0)>0)
        {
            //MessageBoxW(0,L"caption",L"iface",0);
            iface = aurl.left(aurl.find(L".iface",0)+6);
            root = aurl.mid(aurl.find(L".iface",0) +6,9999);
            xaserver::LoadUrl(serverUrl,L"dev:xml[sale.data.url.xml]",L"",xl);
            doc = xl;
            n = doc.selectSingleNode(((xstring)L"//item[@src='dev:iface[" + iface+L"]']/@url").c_str());
            if(n)
                aurl = (xstring)L"/sale/data/"+n.text()+root;
            else
                return -1;
        }
        else if(aurl.find(L"/",0)!=0)
        {
            //MessageBoxW(0,L"caption",L"path",0);
            iface = aurl.left(aurl.find(L"/",0));
            root = aurl.mid(aurl.find(L"/",0),9999);
            xaserver::LoadUrl(serverUrl,L"dev:xml[sale.data.url.xml]",L"",xl);
            doc = xl;
            n = doc.selectSingleNode(((xstring)L"//item[@src='dev:iface[" + iface+L".iface]']/@url").c_str());
            if(n)
            {
                aurl = (xstring)L"/sale/data/"+n.text()+root;
            }
            else
                return -1;
        }
        if((xstring)url1 != aurl)
        {
            //xutil::CacheUrlData("[URL]"+url1, aurl);
        }
        if(getEx(serverUrl,aurl, args, x) != 1)
        {
            return -1;
        }
#if 0
        if(aurl.find(L"/sale/data/", 0)<0 && aurl.find(L"/workflow/query", 0)<0 && aurl.find(L"/workflow/action", 0)<0)
        {
            if((xstring)ver == L"1")
            {
                Hxsoft::XFrame::KXMLDOMDocument xl3;
                xaserverarg arg3;
                arg3.AddArg(L"url", aurl.c_str());
                xaserver::ExecXQuery( serverUrl,L"[service.url.type.xq]",arg3.GetString(),xl3);
                t = xl3.text();
                if((xstring)t != L"") ver = t;
            }
            //trace("\r\nurl: %s cache version:%s", aurl, ver);
            xutil::CacheUrlData(aurl.c_str(), (const LPWSTR)x.xml());
            xutil::CacheUrlData(((xstring)L"[VER]"+aurl.c_str()).c_str(), ver);
        }
#endif
        return 1;
    }
    static int post(string aurl, string args, Hxsoft::XFrame::KXMLDOMDocument x)
    {
        return get(aurl, args, x);
    }
    static int post(string serverUrl,string aurl, string args, Hxsoft::XFrame::KXMLDOMDocument x)
    {
        return get(serverUrl,aurl,args,x);
    }
    static string get(string serverUrl,string aurl, string args)
    {
        KXMLDOMDocument x;
        int r = get(serverUrl,aurl,args,x);
        if ( r == 1)
            return x.xml();
        else
            return L"";
    }
    static string get(string serverUrl,string aurl, xaserverarg args, Hxsoft::XFrame::KXMLDOMDocument x)
    {
        int r = get(serverUrl,aurl,args.GetString(),x);
        if ( r == 1)
            return x.xml();
        else
            return L"";
    }
    static string get(string serverUrl,string aurl, xaserverarg args)
    {
        return get(serverUrl,aurl,args.GetString());
    }
    static int getSql(string serverUrl,string arg,  Hxsoft::XFrame::KXMLDOMDocument& x)
    {
        return xaserver::ExecXQuery(serverUrl,L"[publicSql.xq]",arg,x);
    }
    static int getSql(string serverUrl,xaserverarg& arg,Hxsoft::XFrame::KXMLDOMDocument& x)
    {
        return getSql(serverUrl,arg.GetString(),x);
    }
};
jrj/xframe/wobject/xutil.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,56 @@
#pragma once
#include "xbase.hpp"
#include "kobject/kutil.hpp"
using kutil = Hxsoft::XFrame::IXFUtil;
class xutil
{
public:
    static HCURSOR  SetCursorWait()
    {
        return Hxsoft::XFrame::IXFUtil::SetCursorWait();
    }
    static int RestoreCursor(HCURSOR hCursor)
    {
       return Hxsoft::XFrame::IXFUtil::RestoreCursor(hCursor);
    }
    static const wchar_t* GetUrlData(const wchar_t* url)
    {
        return kutil::GetUrlData((LPWSTR)url);
    }
    static bool HasCacheData(const wchar_t* url)
    {
        return kutil::HasCacheData((LPWSTR)url);
    }
    static void CacheUrlData(const wchar_t* url,const wchar_t* data)
    {
        return kutil::CacheUrlData((LPWSTR)url,(LPWSTR)data);
    }
    static int SaveToFile(const LPTSTR pFile,const LPTSTR pData,const LPTSTR ext, const LPTSTR pFilter, const LPTSTR pFileName=NULL)
    {
        return kutil::SaveToFile((LPWSTR)pFile,(LPWSTR)pData,(LPWSTR)ext,(LPWSTR)pFileName);
    }
    static LPWSTR MD5(const wchar_t* pStr)
    {
        return kutil::MD5((LPWSTR)pStr);
    }
    static bool SmallImage(LPCTSTR lpszPathName, LPCTSTR lpszNewPathName, int width, int height, int flag=0)
    {
        return kutil::SmallImage(lpszPathName,lpszNewPathName,width,height,flag);
    }
    static LPWSTR OpenDialog(HWND Owner,const wchar_t* str)
    {
        return kutil::OpenDialog(Owner,(LPWSTR)str);
    }
    static LPTSTR FormatDecimalString(LPTSTR  str, LPTSTR format, bool& bfree)
    {
        return Hxsoft::XUtil::FormatDecimalString(str, format, bfree);
    }
};
jrj/xframe/wobject/xview.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@
#pragma once
#include "xbase.hpp"
#include "xnative.hpp"
class xview : public xnative
{
public:
    xview(void * impl,HWND hWnd):xnative(impl),hWnd(hWnd){}
    xview(void * impl):xnative(impl),hWnd(0){}
public:
    virtual ~xview() {}
public:
    typedef int (xview::*FEvent)(TEvent* evt, LPARAM p);
private:
    HWND hWnd;
public:
    void SetHandle(HWND hWnd){this->hWnd=hWnd;}
    HWND GetHandle(){return hWnd;}
public:
    int alert(const wchar_t* txt)
    {
        MessageBoxW(GetHandle(),txt,L"Tip",1);
        return 1;
    }
    int alert(const char* txt)
    {
        MessageBoxA(GetHandle(),txt,"Tip",1);
        return 1;
    }
};
jrj/xframe/wobject/xwin.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,167 @@
#pragma once
#include "xview.hpp"
#include "kobject/kcontrol.hpp"
#include "kobject/kwin.hpp"
#include "win32/win.hpp"
#include "wobject/xnode.hpp"
#include "wobject/xurl.hpp"
using kwin=Hxsoft::XFrame::IXFWin;
using kcontrol = Hxsoft::XFrame::IXFControl;
using knode = Hxsoft::XFrame::IXNode;
class xwin: public xview
{
public:
    xwin(void * impl, HWND hWnd):xview(impl,hWnd){}
public:
    kwin* getKWin()
    {
        return (Hxsoft::XFrame::IXFWin*)GetNativePtr();
    }
public:
    bool AttachEvent(const wchar_t* ctrlname,const wchar_t* msg, FEvent fnEvt, xwin* pthis)
    {
        return getKWin()->AttachEvent((LPTSTR)ctrlname,(LPTSTR)msg,*(Hxsoft::XFrame::FEvent*)&fnEvt,pthis);
    }
    bool AttachEvent(const wchar_t* msg, FEvent fnEvt, xwin* pthis)
    {
        return getKWin()->AttachEvent((LPTSTR)msg,*(Hxsoft::XFrame::FEvent*)&fnEvt,pthis);
    }
    bool AttachEvent(const wchar_t* ctrlname,const wchar_t* msg, FEvent fnEvt)
    {
        return getKWin()->AttachEvent((LPTSTR)ctrlname,(LPTSTR)msg,*(Hxsoft::XFrame::FEvent*)&fnEvt,this);
    }
    bool AttachEvent(const wchar_t* msg, FEvent fnEvt)
    {
        return getKWin()->AttachEvent((LPTSTR)msg,*(Hxsoft::XFrame::FEvent*)&fnEvt,this);
    }
    kcontrol* GetControl(const wchar_t* ctrlname)
    {
        return getKWin()->GetControl(ctrlname);
    }
    string GetServerUrl()
    {
        return getKWin()->GetServerUrl();
    }
    xwin* OpenWindow(string url)
    {
        int WS_OVERLAPPEDWINDOW = 0x00cf0000 ;
        kwin* w = kwin::OpenWindow(GetServerUrl(),url,getKWin(),0/*param*/,0/*CmdWind*/,0,WS_OVERLAPPEDWINDOW,0);
        if(!w) return 0; //response
        return (xwin*)GetPropW(w->GetHWND(),L"AttachObject");
    }
    xwin* OpenWindow(string url,LPARAM p)
    {
        int WS_OVERLAPPEDWINDOW = 0x00cf0000;
        kwin* w= kwin::OpenWindow(GetServerUrl(),url,getKWin(),p,0/*CmdWind*/,0/*dwStyleEx*/,WS_OVERLAPPEDWINDOW,0);
        if(!w) return 0; //response
        return (xwin*)GetPropW(w->GetHWND(),L"AttachObject");
    }
    int trace(string info)
    {
        return 1;
    }
    knode * GetAgentNode(string path)
    {
        return getKWin()->GetAgentNode(path);
    }
    HWND GetHWND()
    {
        return getKWin()->GetHWND();
    }
    xnode SetAgentNode(xnode node, string val)
    {
        return xnode(getKWin()->SetAgentNodeContent((knode*)node.getNativePointer(), val));
    }
    xnode SetAgentNode(xnode node,xnode val)
    {
        return xnode(getKWin()->SetAgentNodeContent((knode*)node.getNativePointer(), (knode*)val.getNativePointer()));
    }
    LPARAM GetParam()
    {
        return (LPARAM)getKWin()->GetParam();
    }
    bool  SetParam(LPARAM pParam)
    {
        return getKWin()->SetParam((void*)pParam);
    }
    LPARAM GetFrameParam()
    {
        return (LPARAM)getKWin()->GetFrameParam();
    }
    bool  SetFrameParam(LPARAM pParam)
    {
        return getKWin()->SetFrameParam((void*)pParam);
    }
    int Redraw()
    {
        return getKWin()->Redraw();
    }
    int openUrl(string aurl, xaserverarg* para)
    {
        KXMLDOMDocument x;
        xurl::get(GetServerUrl(), aurl, L"", x);
        KXMLDOMNode n = x.selectSingleNode(L"//resource/@src");
        if (n)
        {
            string xq = n.text();
            OpenWindow(xq, (LPARAM)para);
            return 1;
        }
        else
        {
            xaserverarg* arg = (xaserverarg*)para;
            n = x.selectSingleNode(L"//resource[@vface!='' and @view!='']");
            if (n)
            {
                xstring vface = n.selectSingleNode(L"@vface").text();
                xstring view = n.selectSingleNode(L"@view").text();
                xstring config = n.selectSingleNode(L"@config").text();
                if (config != L"")arg->AddArg(L"config", config);
                if (vface == L"." || vface == L"")
                {
                    string v = n.selectSingleNode(L"@url").text();
                    xstring burl = xstring(aurl).mid(0, xstring(aurl).find(v, 0));
                    return openUrl(burl + view, para);
                }
                else
                    return openUrl(vface + L"/" + view, para);
            }
        }
        return -1;
    }
    int CloseWindow()
    {
        return getKWin()->CloseWindow();
    }
    int openUrl(string aurl)
    {
        xaserverarg* arg = new xaserverarg();
        return openUrl(aurl, arg);
    }
    KXMLDOMElement GetElement()
    {
        return getKWin()->GetElement();
    }
};
jrj/xframe/xcontrol/xcombobox.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,288 @@
#pragma once
#include "win32/win.hpp"
#include "wobject/xcontrol.hpp"
class xcombobox:  public xcontrol
{
public:
    xcombobox() :xcontrol(nullptr) {}
    xcombobox(void* impl) :xcontrol(impl) {}
public:
    xcombobox & operator =(const kcontrol* pcontrol)
    {
        this->setNativePointer((void *)pcontrol);
        return *this;
    }
public:
    int GetCurSel()
    {
        int CB_GETCURSEL  = 0x0147;
        return SendMessage(GetHWND(),CB_GETCURSEL,0,0);
    }
    int SetCurSel( int nIndex)
    {
        int CB_SETCURSEL  = 0x014E;
        return SendMessage(GetHWND(),CB_SETCURSEL,nIndex,0);
    }
    int GetCount()
    {
        int CB_GETCOUNT = 0x0146;
        return SendMessage(GetHWND(),CB_GETCOUNT,0,0);
    }
   string GetLBText(int nIndex)
    {
        int CB_GETLBTEXT     =  0x0148;
        int CB_GETLBTEXTLEN  =  0x0149;
        int nLen = SendMessage(GetHWND(),CB_GETLBTEXTLEN ,nIndex,0);
        string str = new wchar_t[nLen+1];
        SendMessage(GetHWND(),CB_GETLBTEXT ,nIndex, (LPARAM)str);
        return str;
    }
   string GetLBText()
    {
        int CB_GETLBTEXT     =  0x0148;
        int CB_GETLBTEXTLEN  =  0x0149;
        int nIndex = GetCurSel();
        int nLen = SendMessage(GetHWND(),CB_GETLBTEXTLEN ,nIndex,0);
         string str = new wchar_t[nLen+1];
        SendMessage(GetHWND(),CB_GETLBTEXT ,nIndex, (LPARAM)str);
        return str;
    }
    int SetItemIndex(int nIndex)
    {
        int CB_SETCURSEL = 0x014E;
        return SendMessage(GetHWND(),CB_SETCURSEL ,nIndex, 0);
    }
   int AddItem(string str)
    {
        int CB_ADDSTRING =  0x0143;
        return SendMessage(GetHWND(),CB_ADDSTRING  ,(WPARAM)0,(LPARAM)str);
    }
   int FindString(string str)
    {
        int CB_FINDSTRINGEXACT = 0x0158;
        return SendMessage(GetHWND(),CB_FINDSTRINGEXACT,0,(LPARAM)str);
    }
   int DeleteItem(int nIndex)
    {
        int CB_DELETESTRING = 0x0144;
        return SendMessage(GetHWND(),CB_DELETESTRING,nIndex,0);
    }
   int SelectString( int nIndex,string str)
    {
        int CB_SELECTSTRING  = 0x014D;
        return SendMessage(GetHWND(),CB_SELECTSTRING,nIndex,(LPARAM)str);
    }
   int InsertString( int nIndex,string str)
    {
        int CB_INSERTSTRING  = 0x014A;
        return SendMessage(GetHWND(),CB_INSERTSTRING,nIndex,(LPARAM)str);
    }
   int InsertString( string str)
    {
        int CB_INSERTSTRING  = 0x014A;
        return SendMessage(GetHWND(),CB_INSERTSTRING,0,(LPARAM)str);
    }
   int ResetContent()
    {
        int CB_RESETCONTENT  =  0x014B;
        return SendMessage(GetHWND(),CB_RESETCONTENT,0,0);
    }
   int SetItemData(int nIndex, LPARAM p)
    {
        int CB_SETITEMDATA  =   0x0151;
        return SendMessage(GetHWND(),CB_SETITEMDATA,nIndex,p);
    }
   int GetItemData()
    {
        int CB_GETITEMDATA  =   0x0150;
        int nIndex = GetCurSel();
        if(nIndex < 0)
        return -1;
        else
        return SendMessage(GetHWND(),CB_GETITEMDATA,nIndex,0);
    }
   LPARAM GetItemData(int nIndex)
    {
        int CB_GETITEMDATA  =   0x0150;
        return SendMessage(GetHWND(),CB_GETITEMDATA,nIndex,0);
    }
   int AddItem(string str, int p)
    {
        int CB_ADDSTRING =  0x0143;
        int h = SendMessage(GetHWND(),CB_ADDSTRING  ,0,(LPARAM)str);
        SetItemData( h, p);
        return h;
    }
   int AddItem(string str, string p)
    {
        int CB_ADDSTRING =  0x0143;
        int h = SendMessage(GetHWND(),CB_ADDSTRING  ,0,(LPARAM)str);
        SetItemData( h, (LPARAM)p);
        return h;
    }
   int InsertString( string str, LPARAM p)
    {
        int CB_INSERTSTRING  = 0x014A;
        int h =  SendMessage(GetHWND(),CB_INSERTSTRING,0,(LPARAM)str);
        SetItemData( h, p);
        return h;
    }
   /////
   static int GetCurSel(HWND hWnd)
   {
       int CB_GETCURSEL = 0x0147;
       return SendMessage(hWnd, CB_GETCURSEL, 0, 0);
   }
   static int SetCurSel(HWND hWnd,int nIndex)
   {
       int CB_SETCURSEL = 0x014E;
       return SendMessage(hWnd, CB_SETCURSEL, nIndex, 0);
   }
   static int GetCount(HWND hWnd)
   {
       int CB_GETCOUNT = 0x0146;
       return SendMessage(hWnd, CB_GETCOUNT, 0, 0);
   }
   static string GetLBText(HWND hWnd,int nIndex)
   {
       int CB_GETLBTEXT = 0x0148;
       int CB_GETLBTEXTLEN = 0x0149;
       int nLen = SendMessage(hWnd, CB_GETLBTEXTLEN, nIndex, 0);
       string str = new wchar_t[nLen + 1];
       SendMessage(hWnd, CB_GETLBTEXT, nIndex, (LPARAM)str);
       return str;
   }
   static string GetLBText(HWND hWnd)
   {
       int CB_GETLBTEXT = 0x0148;
       int CB_GETLBTEXTLEN = 0x0149;
       int nIndex = GetCurSel(hWnd);
       int nLen = SendMessage(hWnd, CB_GETLBTEXTLEN, nIndex, 0);
       string str = new wchar_t[nLen + 1];
       SendMessage(hWnd, CB_GETLBTEXT, nIndex, (LPARAM)str);
       return str;
   }
   static int SetItemIndex(HWND hWnd,int nIndex)
   {
       int CB_SETCURSEL = 0x014E;
       return SendMessage(hWnd, CB_SETCURSEL, nIndex, 0);
   }
   static int AddItem(HWND hWnd,string str)
   {
       int CB_ADDSTRING = 0x0143;
       return SendMessage(hWnd, CB_ADDSTRING, (WPARAM)0, (LPARAM)str);
   }
   static int FindString(HWND hWnd,string str)
   {
       int CB_FINDSTRINGEXACT = 0x0158;
       return SendMessage(hWnd, CB_FINDSTRINGEXACT, 0, (LPARAM)str);
   }
   static int DeleteItem(HWND hWnd,int nIndex)
   {
       int CB_DELETESTRING = 0x0144;
       return SendMessage(hWnd, CB_DELETESTRING, nIndex, 0);
   }
   static int SelectString(HWND hWnd,int nIndex, string str)
   {
       int CB_SELECTSTRING = 0x014D;
       return SendMessage(hWnd, CB_SELECTSTRING, nIndex, (LPARAM)str);
   }
   static int InsertString(HWND hWnd,int nIndex, string str)
   {
       int CB_INSERTSTRING = 0x014A;
       return SendMessage(hWnd, CB_INSERTSTRING, nIndex, (LPARAM)str);
   }
   static int InsertString(HWND hWnd,string str)
   {
       int CB_INSERTSTRING = 0x014A;
       return SendMessage(hWnd, CB_INSERTSTRING, 0, (LPARAM)str);
   }
   int ResetContent(HWND hWnd)
   {
       int CB_RESETCONTENT = 0x014B;
       return SendMessage(hWnd, CB_RESETCONTENT, 0, 0);
   }
   static int SetItemData(HWND hWnd,int nIndex, LPARAM p)
   {
       int CB_SETITEMDATA = 0x0151;
       return SendMessage(hWnd, CB_SETITEMDATA, nIndex, p);
   }
   static int GetItemData(HWND hWnd)
   {
       int CB_GETITEMDATA = 0x0150;
       int nIndex = GetCurSel(hWnd);
       if (nIndex < 0)
           return -1;
       else
           return SendMessage(hWnd, CB_GETITEMDATA, nIndex, 0);
   }
   static LPARAM GetItemData(HWND hWnd,int nIndex)
   {
       int CB_GETITEMDATA = 0x0150;
       return SendMessage(hWnd, CB_GETITEMDATA, nIndex, 0);
   }
   static int AddItem(HWND hWnd,string str, int p)
   {
       int CB_ADDSTRING = 0x0143;
       int h = SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)str);
       SetItemData(hWnd,h, p);
       return h;
   }
   static int AddItem(HWND hWnd,string str, string p)
   {
       int CB_ADDSTRING = 0x0143;
       int h = SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)str);
       SetItemData(hWnd,h, (LPARAM)p);
       return h;
   }
   static int InsertString(HWND hWnd,string str, LPARAM p)
   {
       int CB_INSERTSTRING = 0x014A;
       int h = SendMessage(hWnd, CB_INSERTSTRING, 0, (LPARAM)str);
       SetItemData(hWnd,h, p);
       return h;
   }
};
jrj/xframe/xcontrol/xdwgrid.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,537 @@
#pragma once
#include "wobject/xcontrol.hpp"
#include "kobject/kdwgrid.hpp"
#include "wobject/xurl.hpp"
#include "wobject/xaserverarg.hpp"
using kdwgrid = Hxsoft::XFrame::XOffice::XCell::IGridReport;
class xdwgrid : public xcontrol
{
public:
    xdwgrid() :xcontrol(nullptr) {}
    xdwgrid(void * implptr):xcontrol(implptr){}
public:
    xdwgrid & operator =(const kcontrol* pcontrol)
    {
        this->setNativePointer((void *)pcontrol);
        return *this;
    }
public:
    kdwgrid* getKReport() { return (kdwgrid*)this->GetNativePtr(); }
public:
    int GetRow() { return getKReport()->GetRow_(); }
    int GetColumn() { return getKReport()->GetColumn_(); }
    int GetRowCount() { return getKReport()->GetRowCount_(); }
    int SetRow(int row) { return getKReport()->SetRow_(row); }
public:
    int GetColumnCount() { return getKReport()->GetColumnCount_(); }
    LPCTSTR GetColumnName(int col) { return getKReport()->GetColumnName_(col); }
    int GetColumnIndex(LPCTSTR pColumn) { return getKReport()->GetColumnIndex_(pColumn); }
public:
    xstring GetItemString(int nRow, int nColumn, kdwgrid::DWBuffer dwBuffer = kdwgrid::dbuf_normal)
    {
        return getKReport()->GetItemString_(nRow, nColumn, dwBuffer);
    }
    xstring GetItemString(int nRow, LPCTSTR ColumnName, kdwgrid::DWBuffer dwBuffer = kdwgrid::dbuf_normal)
    {
        return getKReport()->GetItemString_(nRow, ColumnName, dwBuffer);
    }
    bool SetItemString(int nRow, int nColumn, LPCTSTR lptStr, kdwgrid::DWBuffer dwBuffer = kdwgrid::dbuf_normal)
    {
        return getKReport()->SetItemString_(nRow, nColumn, lptStr, dwBuffer);
    }
    bool SetItemString(int nRow, LPCTSTR ColumnName, LPCTSTR lptStr, kdwgrid::DWBuffer dwBuffer = kdwgrid::dbuf_normal)
    {
        return getKReport()->SetItemString_(nRow, ColumnName, lptStr, dwBuffer);
    }
public:
    int SaveAs(LPCTSTR pXmlArg = NULL) //另存为
    {
        return getKReport()->SaveAs_(pXmlArg);
    }
    int SaveAs(KXMLDOMDocument& xml, LPCTSTR pFileName = NULL) //另存为
    {
        return getKReport()->SaveAs_(xml,pFileName);
    }
public:
    int InsertRow(int nRow) { return getKReport()->InsertRow_(nRow); }
    int DeleteRow(int nRow) { return getKReport()->DeleteRow_(nRow); }
public:
    int  GetXml(BSTR& bstr) { return getKReport()->GetXml_(bstr); }
    int  GetXml(BSTR& bstr, LPCTSTR pGuid) { return getKReport()->GetXml_(bstr, pGuid); }
    int  LoadXml(BSTR bstr) { return getKReport()->LoadXml_(bstr); }
    int Load(KXMLDOMElement  pElement) { return getKReport()->Load_(pElement); }
public:
    int SetReadOnly(bool bReadOnly = true) { return getKReport()->SetReadOnly_(bReadOnly); }
public:
    int SelectRow(int nRow, bool bSelect = true) { return getKReport()->SelectRow_(nRow, bSelect); }
    int SelectRow(int sRow, int eRow, bool bSelect = true) { return getKReport()->SelectRow_(sRow, eRow, bSelect); }
    int GetNextSelectRow(int nStartRow) { return getKReport()->GetNextSelectRow_(nStartRow); }
    bool IsRowSelected(int nRow) { return getKReport()->IsRowSelected_(nRow); }
    //int SetSelectBkColor(COLORREF color){return getKReport()->SetSelectBkColor_(color);}
    int SetSelectionMode(int nMode) { return getKReport()->SetSelectionMode_(nMode); } //0 unselection 1 singleSelection 2 multiselection 3 multiselectionex
public:
    int DwUpdateTo(KXMLDOMDocument pXmlDoc) { return getKReport()->DwUpdateTo_(pXmlDoc); }
    int DwUpdateAllTo(KXMLDOMDocument pXmlDoc) { return getKReport()->DwUpdateAllTo_(pXmlDoc); }
public:
    int Retrieve(LPCTSTR pServer, LPCTSTR pDataUrl, LPCTSTR pArgStr) { return getKReport()->Retrieve_(pServer, pDataUrl, pArgStr); }//读取数据
    //int Retrieve(ITrans *pTrans,LPCTSTR pDataUrl, LPCTSTR pArgStr);//读取数据
    int Retrieve(LPCTSTR pDataUrl, LPCTSTR pArgStr) { return getKReport()->Retrieve_(pDataUrl, pArgStr); }//读取数据
    int Retrieve(KXMLDOMElement  pElement) { return getKReport()->Retrieve_(pElement); }//读取数据
    int Retrieve(KXMLDOMDocument& xml) { return  getKReport()->Retrieve_(xml); }//读取数据
public:
    int SetDataObject(LPCTSTR pServer, LPCTSTR pUrl) { return getKReport()->SetDataObject_(pServer, pUrl); }//设置模板对象
    //virtual int SetDataObject(ITrans *pTrans,LPCTSTR pUrl) ;//设置模板对象
    int SetDataObject(LPCTSTR pUrl) { return getKReport()->SetDataObject_(pUrl); }//设置模板对象
    int SetDataObject(KXMLDOMElement  pElement) { return getKReport()->SetDataObject_(pElement); }//设置模板对象
    int SetDataObject(KXMLDOMDocument  pDoc) { return getKReport()->SetDataObject_(pDoc); }
public:
    int ImportFile() { return getKReport()->ImportFile_(); }
    int ImportFile(LPCTSTR pStrFile, LPCTSTR pType = NULL, bool Header = false) { return getKReport()->ImportFile_(pStrFile, pType, Header); }
    int ImportString(LPCTSTR pStr, LPCTSTR pType = NULL, bool Header = false) { return getKReport()->ImportString_(pStr, pType, Header); }
public:
    int    Reset() { return getKReport()->Reset_(); }
    int    ResetUpdateStatus() { return getKReport()->ResetUpdateStatus_(); }
public:
    int event_ItemFocusChanged(int nRow, int nCol) { return getKReport()->event_ItemFocusChanged_(nRow, nCol); }
    int event_RowFocusChanged(int nRow, int nOldRow) { return getKReport()->event_RowFocusChanged_(nRow, nOldRow); }
    int event_GetFocus() { return getKReport()->event_GetFocus_(); }
    int event_LoseFocus() { return getKReport()->event_LoseFocus_(); }
    int event_ItemChanged(int nRow, int nCol, LPCTSTR pData) { return getKReport()->event_ItemChanged_(nRow, nCol, pData); }
    int event_ItemChanging(int nRow, int nCol, LPCTSTR pData) { return getKReport()->event_ItemChanging_(nRow, nCol, pData); }
public:
    int GetDwType() { return getKReport()->GetDwType_(); }
public:
    KXMLDOMElement  GetRowElement(int nRow) { return getKReport()->GetRowElement(nRow); }
public:
    int InsertCol(int nCol, LPCTSTR pCaption, LPCTSTR pColName, int nWidth, LPCTSTR pColPath = NULL, LPCTSTR pStyleClass = NULL,
        LPCTSTR pEditClass = NULL, LPCTSTR pFormatClass = NULL)
    {
        return  getKReport()->InsertCol(nCol, pCaption, pColName, nWidth, pColPath, pStyleClass, pEditClass, pFormatClass);
    }
    int RemoveCol(int nCol) { return getKReport()->RemoveCol(nCol); }
    int RemoveVCol(int nCol) { return getKReport()->RemoveVCol(nCol); }
    int RemoveCol(LPCTSTR pColName) { return getKReport()->RemoveCol(pColName); }
    int AddEditStyle(LPCTSTR pName, LPCTSTR pStr) { return getKReport()->AddEditStyle(pName, pStr); }
    int RemoveEditStyle(LPCTSTR pName, LPCTSTR pStr) { return getKReport()->RemoveEditStyle(pName, pStr); }
    int SetColEditStyle(LPCTSTR pColName, LPCTSTR pClassName) { return getKReport()->SetColEditStyle(pColName, pClassName); }
    int SetDDLBData(LPCTSTR pColName, LPCTSTR pData) { return getKReport()->SetDDLBData(pColName, pData); }
    LPCTSTR GetDDLBData(LPCTSTR pColName) { return getKReport()->GetDDLBData(pColName); }
public:
    bool ItemChangeTo(int nRow, int nColumn, LPCTSTR lptStr, kdwgrid::DWBuffer dwBuffer = kdwgrid::dbuf_normal)
    {
        return getKReport()->ItemChangeTo(nRow, nColumn, lptStr, dwBuffer);
    }
    bool ItemChangeTo(int nRow, LPCTSTR ColumnName, LPCTSTR lptStr, kdwgrid::DWBuffer dwBuffer = kdwgrid::dbuf_normal)
    {
        return getKReport()->ItemChangeTo(nRow, ColumnName, lptStr, dwBuffer);
    }
public:
    int CreateTree(LPCWSTR pPath, int nCol, int nImage1, int nImage2)
    {
        return getKReport()->CreateTree(pPath, nCol, nImage1, nImage2);
    }
    int GetContentRow(int nRow)
    {
        return getKReport()->GetContentRow(nRow);
    }
public:
    int DwUpdateAllToEx(KXMLDOMDocument pXmlDoc)
    {
        return getKReport()->DwUpdateAllToEx(pXmlDoc);
    }
public:
    int DwShareTo(kdwgrid* pPrimaryReport)
    {
        return getKReport()->DwShareTo(pPrimaryReport);
    }
public:
    int SetAskStyle(bool bAskStyle)
    {
        return getKReport()->SetAskStyle(bAskStyle);
    }
    int CreateTreeEx(LPCTSTR pPath, int nCol, int nImage1, int nImage2)
    {
        return getKReport()->CreateTreeEx(pPath, nCol,nImage1, nImage2);
    }
public:
    LPCTSTR GetItemDisplayString(int nRow, int nColumn, kdwgrid::DWBuffer dwBuffer = kdwgrid::dbuf_normal)
    {
        return getKReport() -> GetItemDisplayString(nRow, nColumn, dwBuffer);
    }
    LPCTSTR GetItemDisplayString(int nRow, LPCTSTR ColumnName, kdwgrid::DWBuffer dwBuffer = kdwgrid::dbuf_normal)
    {
        return getKReport()->GetItemDisplayString(nRow, ColumnName, dwBuffer);
    }
    bool SetItemDisplayString(int nRow, int nColumn, LPCTSTR lptStr, kdwgrid::DWBuffer dwBuffer = kdwgrid::dbuf_normal)
    {
        return getKReport()->SetItemDisplayString(nRow, nColumn, lptStr, dwBuffer);
    }
    bool SetItemDisplayString(int nRow, LPCTSTR ColumnName, LPCTSTR lptStr, kdwgrid::DWBuffer dwBuffer = kdwgrid::dbuf_normal)
    {
        return getKReport()->SetItemDisplayString(nRow, ColumnName, lptStr, dwBuffer);
    }
    LPCTSTR GetItemTipString(int nRow, int nColumn, kdwgrid::DWBuffer dwBuffer = kdwgrid::dbuf_normal)
    {
        return getKReport()->GetItemTipString(nRow, nColumn, dwBuffer);
    }
    LPCTSTR GetItemTipString(int nRow, LPCTSTR ColumnName, kdwgrid::DWBuffer dwBuffer = kdwgrid::dbuf_normal)
    {
        return getKReport()->GetItemTipString(nRow, ColumnName, dwBuffer);
    }
    bool SetItemTipString(int nRow, int nColumn, LPCTSTR lptStr, kdwgrid::DWBuffer dwBuffer = kdwgrid::dbuf_normal)
    {
        return getKReport()->SetItemTipString(nRow, nColumn, lptStr, dwBuffer);
    }
    bool SetItemTipString(int nRow, LPCTSTR ColumnName, LPCTSTR lptStr, kdwgrid::DWBuffer dwBuffer = kdwgrid::dbuf_normal)
    {
        return getKReport()->SetItemTipString(nRow, ColumnName, lptStr, dwBuffer);
    }
public:
    int AllowSort(bool sort)
    {
        return getKReport()->AllowSort(sort);
    }
public:
    int FindByColumn(int startRow, int columnIndex, LPCTSTR columnValue)
    {
        return getKReport()->FindByColumn(startRow, columnIndex, columnValue);
    }
    int FindByColumn(int startRow, LPCTSTR column, LPCTSTR columnValue)
    {
        return getKReport()->FindByColumn(startRow,column,columnValue);
    }
    int SetReadOnlyColumn(int columnIndex, bool flag = true)
    {
        return getKReport()->SetReadOnlyColumn(columnIndex, flag);
    }
    int SetReadOnlyColumn(LPCTSTR column, bool flag = true)
    {
        return getKReport()->SetReadOnlyColumn(column, flag);
    }
    int SetColumnWidth(int columnIndex, int width = 1)
    {
        return getKReport()->SetColumnWidth(columnIndex, width);
    }
    int SetColumnWidth(LPCTSTR column, int width = 1)
    {
        return getKReport()->SetColumnWidth(column, width);
    }
    int GetColumnWidth(int columnIndex)
    {
        return getKReport()->GetColumnWidth(columnIndex);
    }
    int GetColumnWidth(LPCTSTR column)
    {
        return getKReport()->GetColumnWidth(column);
    }
    int SetColumnState(int columnIndex, bool state)
    {
        return getKReport()->SetColumnState(columnIndex, state);
    }
    int SetColumnState(LPCTSTR column, bool state)
    {
        return getKReport()->SetColumnState(column, state);
    }
    void SetDataToClip(LPCTSTR DataStr)
    {
        return getKReport()->SetDataToClip(DataStr);
    }
    int AcceptText()
    {
        return getKReport()->AcceptText();
    }
    int ShowRowTo(int row)
    {
        return getKReport()->ShowRowTo(row);
    }
    int GetShowRow()
    {
        return getKReport()->GetShowRow();
    }
    LPCTSTR GetTitleName(int col)
    {
        return getKReport()->GetTitleName(col);
    }
public:
    int SetRowSort(LPTSTR colName, bool colOrder = true)
    {
        return getKReport()->SetRowSort(colName, colOrder);
    }
    int SetClickEditFlag(bool f)
    {
        return getKReport()->SetClickEditFlag(f);
    }
    int Redraw()
    {
        return getKReport()->RedrawEx();
    }
    bool SetRowMove(int row, int movecount)
    {
        return getKReport()->SetRowMove(row, movecount);
    }
    int GetTreeRow(int row)
    {
        return getKReport()->GetTreeRow( row);
    }
    int GetTreeRowCount()
    {
        return getKReport()->GetTreeRowCount();
    }
    int TreeRowExpand(int row, bool exp)
    {
        return getKReport()->TreeRowExpand(row, exp);
    }
    int RetrieveDiff(KXMLDOMDocument& xml)//读取数据
    {
        return getKReport()->RetrieveDiff(xml);
    }
    int Filter(LPTSTR pColumn, LPTSTR pStr)
    {
        return getKReport()->Filter(pColumn, pStr);
    }
public:
    int SetHeaderText(int row, int col, LPTSTR name)
    {
        return getKReport()->SetHeaderText(row, col, name);
    }
    int MoveColumnTo(int fromcolumn, int tocolumn)
    {
        return getKReport()->MoveColumnTo(fromcolumn,  tocolumn);
    }
public:
    void SetEditUpperMode(bool upper)
    {
        return getKReport()->SetEditUpperMode(upper);
    }
    bool GetEditUpperMode()
    {
        return getKReport()->GetEditUpperMode();
    }
public:
    void ResetRepeats()
    {
        return getKReport()->ResetRepeats();
    }
    void AddRepeats(wchar_t* colName)
    {
        return getKReport()->AddRepeats(colName);
    }
public:
    LPTSTR GetColumnProp(int nCol, LPCTSTR pItem)
    {
        return getKReport()->GetColumnProp(nCol, pItem);
    }
    LPTSTR GetColumnProp(LPCTSTR pColName, LPCTSTR pItem)
    {
        return getKReport()->GetColumnProp(pColName, pItem);
    }
    int GetItemInt(int row, int col)
    {
        xstring str = GetItemString(row, col);
        return str.toInt();
    }
    int GetItemInt(int row, string col)
    {
        xstring str = GetItemString(row, col);
        return str.toInt();
    }
    double GetItemDouble(int row, int col)
    {
        xstring str = GetItemString(row, col);
        return str.toDouble();
    }
    double GetItemDouble(int row, string col)
    {
        xstring str = GetItemString(row, col);
        return str.toDouble();
    }
    bool SetItemInt(int row, int col, int str)
    {
        return SetItemString(row, col, xstring(str));
    }
    bool SetItemInt(int row, string col, int str)
    {
        return SetItemString(row, col, xstring(str));
    }
    bool SetItemDouble(int row, int col, double str)
    {
        return SetItemString(row, col, xstring(str));
    }
    bool SetItemDouble(int row, string col, double str)
    {
        return SetItemString(row, col, xstring(str));
    }
public:
    int openUrl(string aurl)
    {
        KXMLDOMDocument x;
        xurl::get(aurl, L"", x);
        return SetDataObject(x);
    }
    int openUrl(string ServerUrl, string aurl)
    {
        KXMLDOMDocument x;
        xurl::get(ServerUrl, aurl, L"", x);
        return SetDataObject(x);
    }
    int openSheet(string sheet)
    {
        KXMLDOMDocument x;
        xaserver::LoadUrl(L"", sheet, L"", x);
        SetDataObject(x);
        return 1;
    }
    int UnDeleteRow(int row)
    {
        KXMLDOMElement e = GetRowElement(row);
        if (e.selectSingleNode(L"@update.modify"))
            e.removeAttribute(L"update.delete");
        return 1;
    }
    int LookUpRow(string col, string value, int startRow = 1)
    {
        for (int i = startRow; i <= GetRowCount(); i++)
        {
            if (GetItemString(i, col) == value) return i;
        }
        return 0;
    }
    int IsRowModified(int row)
    {
        KXMLDOMElement e = GetRowElement(row);
        if (e.selectSingleNode(L"@update.modify")) return true;
        return false;
    }
    //cwd
    double GetItemSumDouble(string col)
    {
        double dItemSum = 0.0;
        int i;
        int icnt = GetRowCount();
        if (icnt < 1) return 0.0;
        for (i = 1; i <= icnt; i++)
        {
            double d = GetItemDouble(i, col);
            dItemSum = dItemSum + d;
        }
        //alert(dItemSum.toString());
        return dItemSum;
    }
    xstring GetGuid(int row)
    {
        KXMLDOMElement  e = GetRowElement(row);
        if (e) return e.getAttribute(L"guid");
        return L"";
    }
public:
#if 0
    int GetItemInt(int row, int col)
    {
        xstring str = GetItemString(row, col);
        return str.toInt();
    }
    double GetItemDouble(int row, int col)
    {
        xstring str = GetItemString(row, col);
        return str.toDouble();
    }
    int GetItemInt(int row, string col)
    {
        xstring str = GetItemString(row, col);
        return str.toInt();
    }
    double GetItemDouble(int row, string col)
    {
        xstring str = GetItemString(row, col);
        return str.toDouble();
    }
    bool SetItemInt(int row, int col, int str)
    {
        return SetItemString(row, col, xstring(str));
    }
    bool SetItemDouble(int row, int col, double str)
    {
        return SetItemString(row, col, xstring(str));
    }
    bool SetItemInt(int row, string col, int str)
    {
        return SetItemString(row, col, xstring(str));
    }
    bool SetItemDouble(int row, string col, double str)
    {
        return SetItemString(row, col, xstring(str));
    }
#endif
    int DwRetrieve(string ServerUrl, string src, string argstr)
    {
        KXMLDOMDocument x;
        xaserver::ExecXQuery(ServerUrl, src, argstr, x);
        Retrieve(x);
        Redraw();
        return 1;
    }
    int DwRetrieve(string ServerUrl, string src, string arg0, string value0)
    {
        xaserverarg arg;
        arg.AddArg(arg0, value0);
        DwRetrieve(ServerUrl, src, arg.GetString());
        return 1;
    }
    int DwRetrieve(string ServerUrl, string src, string arg0, string value0, string arg1, string value1)
    {
        xaserverarg arg;
        arg.AddArg(arg0, value0);
        arg.AddArg(arg1, value1);
        DwRetrieve(ServerUrl, src, arg.GetString());
        return 1;
    }
};
jrj/xframe/xcontrol/xdwpages.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,41 @@
#pragma once
#include "wobject/xcontrol.hpp"
#include "kobject/kdwpages.hpp"
using kdwpages = Hxsoft::XFrame::IXPages;
class xdwpages : public xcontrol
{
public:
    xdwpages() :xcontrol(nullptr) {}
    xdwpages(void* implptr) :xcontrol(implptr) {}
public:
    xdwpages& operator =(const kcontrol* pcontrol)
    {
        this->setNativePointer((void*)pcontrol);
        return *this;
    }
public:
    kdwpages* GetKDwPage()
    {
        return (kdwpages*)this->GetNativePtr();
    }
public:
    int SetMaxPage(int mpage)
    {
        return GetKDwPage()->SetMaxPage(mpage);
    }
    int SetCurPage(int cpage)
    {
        return GetKDwPage()->SetCurPage(cpage);
    }
    int GetMaxPage()
    {
        return GetKDwPage()->GetMaxPage();
    }
    int GetCurPage()
    {
        return GetKDwPage()->GetCurPage();
    }
};
jrj/xframe/xcontrol/xdwtable.hpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,480 @@
#pragma once
#include "wobject/xcontrol.hpp"
#include "kobject/kdwtable.hpp"
#include "wobject/xaserverarg.hpp"
#include "wobject/xurl.hpp"
using kdwtable = Hxsoft::XFrame::XOffice::XCell::IDwTable;
class xdwtable : public xcontrol
{
public:
    xdwtable(void * implptr=nullptr) : xcontrol(implptr){}
public:
    kdwtable* GetDwTable()
    {
        return (kdwtable*)getNativePointer();
    }
public:
    int GetRow() { return GetDwTable()->GetRow_(); }//得到行
    int GetColumn() { return GetDwTable()->GetColumn_(); }//得到列
    int GetRowCount() { return GetDwTable()->GetRowCount_(); } //得到行数
    int GetColumnCount() { return GetDwTable()->GetColumnCount_(); } //得到列数
public:
    int SetRow(int row) { return GetDwTable()->SetRow_(row); }
public:
    LPCTSTR GetNote(int nRow, int nColumn) { return GetDwTable()->GetNote_(nRow, nColumn); }//得到备注
    bool SetNote(int nRow, int nColumn, LPCTSTR pStrNote) { return GetDwTable()->SetNote_(nRow, nColumn, pStrNote); } //设置备注
    bool AddNote(int nRow, int nColumn, LPCTSTR pStrNote, LPCTSTR pUser = NULL, LPCTSTR pData = NULL) { return GetDwTable()->AddNote_(nRow, nColumn, pStrNote, pUser, pData); } //设置备注
    LPCTSTR GetNote1(int nRow, int nColumn) { return GetDwTable()->GetNote1_(nRow, nColumn); }//得到修改
    bool SetNote1(int nRow, int nColumn, LPCTSTR pStrNote) { return GetDwTable()->SetNote1_(nRow, nColumn, pStrNote); } //设置修改
    bool AddNote1(int nRow, int nColumn, LPCTSTR pStrNote, LPCTSTR pUser = NULL, LPCTSTR pData = NULL) { return GetDwTable()->AddNote1_(nRow, nColumn, pStrNote, pUser, pData); } //设置修改
    LPCTSTR GetNote2(int nRow, int nColumn) { return GetDwTable()->GetNote2_(nRow, nColumn); }//得到批注
    bool SetNote2(int nRow, int nColumn, LPCTSTR pStrNote) { return GetDwTable()->SetNote2_(nRow, nColumn, pStrNote); } //设置批注
    bool AddNote2(int nRow, int nColumn, LPCTSTR pStrNote, LPCTSTR pUser = NULL, LPCTSTR pData = NULL) { return GetDwTable()->AddNote2_(nRow, nColumn, pStrNote, pUser, pData); } //设置批注
public:
    int InsertRow(int nRow) { return GetDwTable()->InsertRow_(nRow); }//插入行
    int DeleteRow(int nRow) { return GetDwTable()->DeleteRow_(nRow); }//删除行
    int InsertRows(int nRow, int nAmt) { return GetDwTable()->InsertRows_(nRow, nAmt); }//插入多行
    int DeleteRows(int nRow, int nAmt) { return GetDwTable()->DeleteRows_(nRow, nAmt); }//删除多行
public:
    LPCTSTR GetColumnName(int nColumn) { return GetDwTable()->GetColumnName_(nColumn); }//得到列名
    int GetColumnIndex(LPCTSTR pColumn) { return GetDwTable()->GetColumnIndex_(pColumn); } //得到列号
public:
    //LPCTSTR GetItemString(int nRow, int nColumn, kdwtable::DWBuffer dwBuffer = kdwtable::dbuf_normal) { return GetDwTable()->GetItemString_(nRow, nColumn, dwBuffer); }//得到数据值
    //LPCTSTR GetItemString(int nRow, LPCTSTR ColumnName, kdwtable::DWBuffer dwBuffer = kdwtable::dbuf_normal) { return GetDwTable()->GetItemString_(nRow, ColumnName, dwBuffer); }//得到数据值
    xstring GetItemString(int nRow, int nColumn, kdwtable::DWBuffer dwBuffer = kdwtable::dbuf_normal) { return GetDwTable()->GetItemString_(nRow, nColumn, dwBuffer); }//得到数据值
    xstring GetItemString(int nRow, LPCTSTR ColumnName, kdwtable::DWBuffer dwBuffer = kdwtable::dbuf_normal) { return GetDwTable()->GetItemString_(nRow, ColumnName, dwBuffer); }//得到数据值
    bool SetItemString(int nRow, int nColumn, LPCTSTR lptStr, kdwtable::DWBuffer dwBuffer = kdwtable::dbuf_normal) { return GetDwTable()->SetItemString_(nRow, nColumn, lptStr, dwBuffer); }//设置数据值
    bool SetItemString(int nRow, LPCTSTR ColumnName, LPCTSTR lptStr, kdwtable::DWBuffer dwBuffer = kdwtable::dbuf_normal) { return GetDwTable()->SetItemString_(nRow, ColumnName, lptStr, dwBuffer); }//设置数据值
public:
    bool SetItemStatus(int nRow, int nColumn, kdwtable::RowStatus status, kdwtable::DWBuffer dwBuffer = kdwtable::dbuf_normal) { return GetDwTable()->SetItemStatus_(nRow, nColumn, status, dwBuffer); }//设置行列状态
    kdwtable::RowStatus GetItemStatus(int nRow, int nColumn, kdwtable::DWBuffer dwBuffer = kdwtable::dbuf_normal) { return GetDwTable()->GetItemStatus_(nRow, nColumn, dwBuffer); }//得到行列状态
public:
    int    SetKeyValue(int nRow, int nKeyValue) { return GetDwTable()->SetKeyValue_(nRow, nKeyValue); }//设置整数关健值
    int GetKeyValue(int nRow) { return GetDwTable()->GetKeyValue_(nRow); }//得到整数关健值
    bool GetGuid(int nRow, TCHAR Guid[], int nMax) { return GetDwTable()->GetGuid_(nRow, Guid, nMax); }//设置guid
    bool SetGuid(int nRow, LPCTSTR pStrGuid) { return GetDwTable()->SetGuid_(nRow, pStrGuid); } //设置guid
public:
    int SetReadOnly(bool bReadOnly = true) { return GetDwTable()->SetReadOnly_(bReadOnly); } //设置只读
public:
    int SelectRow(int nRow, bool bSelect = true) { return GetDwTable()->SelectRow_(nRow, bSelect); }//选中单行
    int SelectRow(int sRow, int eRow, bool bSelect = true) { return GetDwTable()->SelectRow_(sRow, eRow, bSelect); }//选中多行
    int GetNextSelectRow(int nStartRow) { return GetDwTable()->GetNextSelectRow_(nStartRow); } //得到下拉修改行
    bool IsRowSelected(int nRow) { return GetDwTable()->IsRowSelected_(nRow); } //判断行是否被选种
    int SetSelectBkColor(COLORREF color) { return GetDwTable()->SetSelectBkColor_(color); } //设置选择的背景颜色
    int SetSelectionMode(int nMode) { return GetDwTable()->SetSelectionMode_(nMode); } //设置选择的模式//0 unselection 1 singleSelection 2 multiselection 3 multiselectionex
public:
    int    DeletedCount() { return GetDwTable()->DeletedCount_(); } //得到删除行行数
    int    ModifiedCount() { return GetDwTable()->ModifiedCount_(); } //得到修改行行数
public:
    int    Reset() { return GetDwTable()->Reset_(); } //清除数据
    int    ResetUpdateStatus() { return GetDwTable()->ResetUpdateStatus_(); }//清除修改标记
public:
    BSTR GetXml(LPCTSTR pRoot, bool bIncludeChild) { return GetDwTable()->GetXml_(pRoot, bIncludeChild); } //获取XML数据
    int Load(KXMLDOMElement  pElement) { return GetDwTable()->Load_(pElement); }//读取数据
    int  LoadXml(BSTR bstr) { return GetDwTable()->LoadXml_(bstr); }//读取数据
public:
    int ClearObserver() { return GetDwTable()-> ClearObserver_(); }//清除事件侦听对象
public:
    int DwUpdateTo(KXMLDOMDocument pXmlDoc) { return GetDwTable()->DwUpdateTo_(pXmlDoc); }//把数据更新到XML对象中
    int DwUpdateAllTo(KXMLDOMDocument  pXmlDoc) { return GetDwTable()->DwUpdateAllTo_(pXmlDoc); }//把数据更新到XML对象中
public:
    int Retrieve(LPCTSTR pServer, LPCTSTR pDataUrl, LPCTSTR pArgStr) { return GetDwTable()->Retrieve_(pServer, pDataUrl, pArgStr); }//读取数据
    int Retrieve(LPCTSTR pDataUrl, LPCTSTR pArgStr) { return GetDwTable()->Retrieve_(pDataUrl, pArgStr); }//读取数据
    int Retrieve(KXMLDOMElement  pElement) { return GetDwTable()->Retrieve_(pElement); }//读取数据
    int Retrieve(KXMLDOMDocument& xml) { return GetDwTable()->Retrieve_(xml); }//读取数据
    int RetrieveEx(LPCTSTR pServer, LPCTSTR pEntity, LPCTSTR pEntityKey) { return GetDwTable()->RetrieveEx_(pServer, pEntity, pEntityKey); }//读取数据
    int RetrieveEx(LPCTSTR pEntity, LPCTSTR pEntityKey) { return GetDwTable()->RetrieveEx_(pEntity, pEntityKey); }//读取数据
public:
    int SetDataObject(LPCTSTR pServer, LPCTSTR pUrl) { return GetDwTable()->SetDataObject_(pServer, pUrl); }//设置模板对象
    int SetDataObject(LPCTSTR pUrl) { return GetDwTable()->SetDataObject_(pUrl); }//设置模板对象
    int SetDataObject(KXMLDOMElement  pElement) { return GetDwTable()->SetDataObject_(pElement); }//设置模板对象
    int SetDataObject(KXMLDOMDocument  pDoc) { return GetDwTable()->SetDataObject_(pDoc); }
public:
    int ImportFile() { return GetDwTable()->ImportFile_(); } //转入数据
    int ImportFile(LPCTSTR pStrFile, LPCTSTR pType = NULL, bool Header = false) { return GetDwTable()->ImportFile_(pStrFile, pType, Header); } //转入数据
    int ImportString(LPCTSTR pStr, LPCTSTR pType = NULL, bool Header = false) { return GetDwTable()->ImportString_(pStr, pType, Header); } //转入文本数据
public:
    int SetValues(LPCTSTR pColName, LPCTSTR pExpr) { return GetDwTable()->SetValues_(pColName, pExpr); } //批量设置值
    int AddCalcColumn(LPCTSTR pColName, LPCTSTR pExpr) { return GetDwTable()->AddCalcColumn_(pColName, pExpr); }//设置关联计算列
    int ClearCalcColumn(LPCTSTR pColName = NULL) { return GetDwTable()->ClearCalcColumn_(pColName); }//清除关联计算列
public:
    int GetNextModifyRow(int nStart) { return GetDwTable()->GetNextModifyRow_(nStart); } //得到下一修改行
public:
    int Modify(LPCTSTR pStr) { return GetDwTable()->Modify_(pStr); } //语法修改
    int Evaluate(int nRow, LPCTSTR pExpr) { return GetDwTable()->Evaluate_(nRow, pExpr); } //评估表达式
public:
    int SetAutoFilter(bool bAutoFilter) { return GetDwTable()->SetAutoFilter_(bAutoFilter); } //设置自动过滤
    int SetFilter(LPCTSTR pStrFilter) { return GetDwTable()->SetFilter_(pStrFilter); } //设置过滤条件
    int Filter() { return GetDwTable()->Filter_(); } //过滤
    int SetSort(LPCTSTR pStrSort) { return GetDwTable()->SetSort_(pStrSort); } //设置排序参数
    int Sort() { return GetDwTable()->Sort_(); } //排序
    int Find(LPCTSTR pCondition = NULL) { return GetDwTable()->Find_(pCondition); } //查找
    int FindNext() { return GetDwTable()->FindNext_(); } //查找
public:
    int GetFirstVisibleRow() { return GetDwTable()->GetFirstVisibleRow_(); } //得到当前显示的第一行
    int Expand(bool bExpand) { return GetDwTable()->Expand_(bExpand); }//收缩或展开数据视图
public:
    int Print(LPCTSTR pXmlArg = NULL) { return GetDwTable()->Print_(pXmlArg); } //打印
    int PrintPreview(LPCTSTR pXmlArg = NULL) { return GetDwTable()->PrintPreview_(pXmlArg); } //打印预览
public:
    int SaveAs(LPCTSTR pXmlArg = NULL) { return GetDwTable()->SaveAs_(pXmlArg); } //另存为
    int SaveAsEx() { return GetDwTable()->SaveAsEx_(); } //整体另存为
    int SaveAsEx(LPCTSTR pStrFile) { return GetDwTable()->SaveAsEx_(pStrFile); } //整体另存为
public:
    LPTSTR GetColumnProps(LPCTSTR pColName) { return GetDwTable()->GetColumnProps_(pColName); } //得到列整体XML属性
    int SetColumnProps(LPCTSTR pColName, LPCTSTR pXmlProp) { return GetDwTable()->SetColumnProps_(pColName, pXmlProp); } //设置列整体XML属性
    LPTSTR GetColumnProp(LPCTSTR pColName, LPCTSTR pItem) { return GetDwTable()->GetColumnProp_(pColName, pItem); } //得到列属性
    int SetColumnProp(LPCTSTR pColName, LPCTSTR pItem, LPCTSTR pProp) { return GetDwTable()->SetColumnProp_(pColName, pItem, pProp); }//设置列属性
    LPTSTR GetColumnProps(int nCol) { return GetDwTable()->GetColumnProps_(nCol); } //得到列整体XML属性
    int SetColumnProps(int nCol, LPCTSTR pXmlProp) { return GetDwTable()->SetColumnProps_(nCol, pXmlProp); } //设置列整体XML属性
    LPTSTR GetColumnProp(int nCol, LPCTSTR pItem) { return GetDwTable()->GetColumnProp_(nCol, pItem); } //得到列属性
    int SetColumnProp(int nCol, LPCTSTR pItem, LPCTSTR pProp) { return GetDwTable()->SetColumnProp_(nCol, pItem, pProp); }//设置列属性
public:
    int DataBI(LPCTSTR pSchema = NULL) { return GetDwTable()->DataBI_(pSchema); }//数据BI分析
public:
    int chart(LPCTSTR pXmlArg = NULL) { return GetDwTable()->chart_(pXmlArg); }//图形
    //send event message
    int event_ItemFocusChanged(int nRow, int nCol) { return GetDwTable()->event_ItemFocusChanged_(nRow, nCol); }
    int event_RowFocusChanged(int nRow, int nOldRow) { return GetDwTable()->event_RowFocusChanged_(nRow, nOldRow); }
    int event_GetFocus() { return GetDwTable()->event_GetFocus_(); }
    int event_LoseFocus() { return GetDwTable()->event_LoseFocus_(); }
    int event_ItemChanged(int nRow, int nCol, LPCTSTR pData) { return GetDwTable()->event_ItemChanged_(nRow, nCol, pData); }
    int event_ItemChanging(int nRow, int nCol, LPCTSTR pData) { return GetDwTable()->event_ItemChanging_(nRow, nCol, pData); }
    //follow function for cell table
public:
    int InsertRow(int nGroup, int nRow) { return GetDwTable()->InsertRow_(nGroup, nRow); } //插入组行
    int DeleteRow(int nGroup, int nRow) { return GetDwTable()->DeleteRow_(nGroup, nRow); } //删除组行
    int InsertRows(int nGroup, int nRow, int nAmt) { return GetDwTable()->InsertRows_(nGroup, nRow, nAmt); } //插入组多行
    int DeleteRows(int nGroup, int nRow, int nAmt) { return GetDwTable()->DeleteRows_(nGroup, nRow, nAmt); }//删除组多行
public:
    int GetGroupStartRow(int nGroup) { return GetDwTable()->GetGroupStartRow_(nGroup); } //得到指定组的开始行
    int GetGroupRowCount(int nGroup) { return GetDwTable()->GetGroupRowCount_(nGroup); } //得到指定组的结束行
    int InsertGroupRow(int nGroup, int nRow) { return GetDwTable()->InsertGroupRow_(nGroup, nRow); } //插入组行
public:
    int GetMaxDeep() { return GetDwTable()->GetMaxDeep_(); } //插入数据视图的最大深度
    int GetLevel() { return GetDwTable()->GetLevel_(); } //得到数据视图的级号
    LPCTSTR GetDwXPath() { return GetDwTable()->GetDwXPath_(); } //得到数据视图的XPATH
public:
    kdwtable* GetParent() { return (kdwtable*)GetDwTable()->GetParent_(); } //得到父数据试图
public:
    int GetChildCount() { return GetDwTable()->GetChildCount_(); } //得到子数据视图数
    kdwtable* GetChild(int nIndex) { return (kdwtable*)GetDwTable()->GetChild_(nIndex); } //得到指定序号的子数据视图
public:
    LPCTSTR GetDwName() { return GetDwTable()->GetDwName_(); } //得到数据视图的名称
    kdwtable* FindDwTable(LPCTSTR pStrName, kdwtable* pParent = NULL) { return (kdwtable*)GetDwTable()->FindDwTable_(pStrName, (Hxsoft::XFrame::IDwView*)pParent); } //查找数据试图
    kdwtable* GetCurTable(int& nRow, int& nCol) { return (kdwtable*)GetDwTable()->GetCurTable_(nRow, nCol); }//得到当前数据视图,并返回行列
    kdwtable* GetCurTable() { return (kdwtable*)GetDwTable()->GetCurTable_(); }//得到当前数据视图
public:
    int SetRowSelectorWidth(int nWidth)
    {
        return GetDwTable()->SetRowSelectorWidth(nWidth);
    }
    int ResetRowSelector()
    {
        return GetDwTable()->ResetRowSelector();
    }
    int GetRowSelectorWidth()
    {
        return GetDwTable()->GetRowSelectorWidth();
    }
    int GetRowSelectorDefaultWidth()
    {
        return GetDwTable()->GetRowSelectorDefaultWidth();
    }
    int SetColHeaderHeight(int nHeight)
    {
        return GetDwTable()->SetColHeaderHeight(nHeight);
    }
    int GetColHeaderDefaultHeight()
    {
        return GetDwTable()->GetColHeaderDefaultHeight();
    }
    int ResetColHeaderHeight()
    {
        return GetDwTable()->ResetColHeaderHeight();
    }
    int GetColHeaderHeight()
    {
        return GetDwTable()->GetColHeaderHeight();
    }
public:
    LPTSTR GetHtml()
    {
        return GetDwTable()->GetHtml();
    }
public:
    int SetScrollState(bool both)
    {
        return GetDwTable()->SetScrollState(both);
    }
    int SetHScrollState(bool bShow)
    {
        return GetDwTable()->SetHScrollState(bShow);
    }
    int SetVScrollState(bool bShow)
    {
        return GetDwTable()->SetVScrollState(bShow);
    }
public:
    COLORREF    GetDirectColor()
    {
        return GetDwTable()->GetDirectColor();
    }
    void        SetDirectColor(COLORREF cr)
    {
        return GetDwTable()->SetDirectColor(cr);
    }
    COLORREF    GetAdvanceColor()
    {
        return GetDwTable()->GetAdvanceColor();
    }
    void        SetAdvanceColor(COLORREF cr)
    {
        return GetDwTable()->SetAdvanceColor(cr);
    }
public:
    LPTSTR        GetNoteString(int nRow, int nCol)
    {
        return GetDwTable()->GetNoteString(nRow, nCol);
    }
    LPTSTR        GetOriginString(int nRow, int nCol)
    {
        return GetDwTable()->GetOriginString(nRow, nCol);
    }
    LPTSTR        GetAdvanceString(int nRow, int nCol)
    {
        return GetDwTable()->GetAdvanceString(nRow, nCol);
    }
    void        SetNoteString(int nRow, int nCol, LPTSTR pStr)
    {
        return GetDwTable()->SetNoteString(nRow, nCol, pStr);
    }
    void        SetOriginString(int nRow, int nCol, LPTSTR pStr)
    {
        return GetDwTable()->SetOriginString(nRow, nCol, pStr);
    }
    void        SetAdvanceString(int nRow, int nCol, LPTSTR pStr)
    {
        return GetDwTable()->SetAdvanceString(nRow, nCol, pStr);
    }
    void        ClearNoteString(int nRow, int nCol)
    {
        return GetDwTable()->ClearNoteString(nRow, nCol);
    }
    void        ClearOriginString(int nRow, int nCol)
    {
        return GetDwTable()->ClearOriginString(nRow,nCol);
    }
    void        ClearAdvanceString(int nRow, int nCol)
    {
        return GetDwTable()->ClearAdvanceString( nRow, nCol);
    }
public:
    LPCTSTR GetGuid(int nRow)
    {
        return GetDwTable()->GetGuid(nRow);
    }
public:
    bool ItemChangeTo(int nRow, int nColumn, LPCTSTR lptStr, kdwtable::DWBuffer dwBuffer = kdwtable::dbuf_normal)
    {
        return GetDwTable()->ItemChangeTo(nRow, nColumn, lptStr, dwBuffer);
    }
    bool ItemChangeTo(int nRow, LPCTSTR ColumnName, LPCTSTR lptStr, kdwtable::DWBuffer dwBuffer = kdwtable::dbuf_normal)
    {
        return GetDwTable()->ItemChangeTo(nRow, ColumnName, lptStr, dwBuffer);
    }
public:
    LPCTSTR GetItemDisplayString(int nRow, int nColumn, kdwtable::DWBuffer dwBuffer = kdwtable::dbuf_normal)
    {
        return GetDwTable()->GetItemDisplayString(nRow, nColumn, dwBuffer);
    }
    LPCTSTR GetItemDisplayString(int nRow, LPCTSTR ColumnName, kdwtable::DWBuffer dwBuffer = kdwtable::dbuf_normal)
    {
        return GetDwTable()->GetItemDisplayString(nRow, ColumnName, dwBuffer);
    }
    bool SetItemDisplayString(int nRow, int nColumn, LPCTSTR lptStr, kdwtable::DWBuffer dwBuffer = kdwtable::dbuf_normal)
    {
        return GetDwTable()->SetItemDisplayString(nRow, nColumn, lptStr, dwBuffer);
    }
    bool SetItemDisplayString(int nRow, LPCTSTR ColumnName, LPCTSTR lptStr, kdwtable::DWBuffer dwBuffer = kdwtable::dbuf_normal)
    {
        return GetDwTable()->SetItemDisplayString(nRow, ColumnName, lptStr, dwBuffer);
    }
    LPCTSTR GetItemTipString(int nRow, int nColumn, kdwtable::DWBuffer dwBuffer = kdwtable::dbuf_normal)
    {
        return GetDwTable()->GetItemTipString(nRow, nColumn, dwBuffer);
    }
    LPCTSTR GetItemTipString(int nRow, LPCTSTR ColumnName, kdwtable::DWBuffer dwBuffer = kdwtable::dbuf_normal)
    {
        return GetDwTable()->GetItemTipString(nRow, ColumnName, dwBuffer);
    }
    bool SetItemTipString(int nRow, int nColumn, LPCTSTR lptStr, kdwtable::DWBuffer dwBuffer = kdwtable::dbuf_normal)
    {
        return GetDwTable()->SetItemTipString(nRow, nColumn, lptStr, dwBuffer);
    }
    bool SetItemTipString(int nRow, LPCTSTR ColumnName, LPCTSTR lptStr, kdwtable::DWBuffer dwBuffer = kdwtable::dbuf_normal)
    {
        return GetDwTable()->SetItemTipString(nRow, ColumnName, lptStr, dwBuffer);
    }
public:
    int AcceptText()
    {
        return GetDwTable()->AcceptText();
    }
    int getNullCell(POINT& p)
    {
        return GetDwTable()->getNullCell(p);
    }
    int ExpandRow()
    {
        return GetDwTable()->ExpandRow();
    }
    int ExpandRow(int sRow, int eRow)
    {
        return GetDwTable()->ExpandRow(sRow, eRow);
    }
    int ExpandCellRow(int sRow, int eRow)
    {
        return GetDwTable()->ExpandCellRow(sRow, eRow);
    }
    int ExpandMarginRow(int sRow, int eRow)
    {
        return GetDwTable()->ExpandMarginRow(sRow, eRow);
    }
    int GetCellRowFromRowColumn(int sRow, int sCol)//得到行列
    {
        return GetDwTable()->GetCellRowFromRowColumn(sRow, sCol);
    }
    int SetSelectionBorder(int Flag)
    {
        return GetDwTable()->SetSelectionBorder(Flag);
    }
    int SetItemText(int row, int col, LPTSTR name)
    {
        return GetDwTable()->SetItemText(row, col, name);
    }
public:
    void SetEditUpperMode(bool upper)
    {
        return GetDwTable()->SetEditUpperMode(upper);
    }
    bool GetEditUpperMode()
    {
        return GetDwTable()->GetEditUpperMode();
    }
public:
    int SetRowSort(LPTSTR colName, bool colOrder = true)
    {
        return GetDwTable()->SetRowSort(colName, colOrder);
    }
public:
    int GetItemInt(int row, int col)
    {
        xstring str = GetItemString(row, col);
        return str.toInt();
    }
    double GetItemDouble(int row, int col)
    {
        xstring str = GetItemString(row, col);
        return str.toDouble();
    }
    int GetItemInt(int row, string col)
    {
        xstring str = GetItemString(row, col);
        return str.toInt();
    }
    double GetItemDouble(int row, string col)
    {
        xstring str = GetItemString(row, col);
        return str.toDouble();
    }
    bool SetItemInt(int row, int col, int str)
    {
        return SetItemString(row, col, xstring(str));
    }
    bool SetItemDouble(int row, int col, double str)
    {
        return SetItemString(row, col, xstring(str));
    }
    bool SetItemInt(int row, string col, int str)
    {
        return SetItemString(row, col, xstring(str));
    }
    bool SetItemDouble(int row, string col, double str)
    {
        return SetItemString(row, col, xstring(str));
    }
    int openUrl(string aurl)
    {
        KXMLDOMDocument x;
        xurl::get(aurl, L"", x);
        return SetDataObject(x);
    }
    int openUrl(string ServerUrl, string aurl)
    {
        KXMLDOMDocument x;
        xurl::get(ServerUrl, aurl, L"", x);
        return SetDataObject(x);
    }
    int DwRetrieve(string ServerUrl, string src, string argstr)
    {
        KXMLDOMDocument x;
        xaserver::ExecXQuery(ServerUrl, src, argstr, x);
        Retrieve(x);
        Redraw();
        return 1;
    }
    int DwRetrieve(string ServerUrl, string src, string arg0, string value0)
    {
        xaserverarg arg;
        arg.AddArg(arg0, value0);
        DwRetrieve(ServerUrl, src, arg.GetString());
        return 1;
    }
    int DwRetrieve(string ServerUrl, string src, string arg0, string value0, string arg1, string value1)
    {
        xaserverarg arg;
        arg.AddArg(arg0, value0);
        arg.AddArg(arg1, value1);
        DwRetrieve(ServerUrl, src, arg.GetString());
        return 1;
    }
};
在上述文件截断后对比
jrj/xframe/xcontrol/ximage.hpp jrj/xframe/xcontrol/ximageview.hpp jrj/xframe/xcontrol/xlayersheet.hpp jrj/xframe/xcontrol/xreport.hpp jrj/xframe/xcontrol/xshtml.hpp jrj/xframe/xcontrol/xtreeview.hpp