d5d0dead36ae8c53817ecbce7b1295c63f84f7c8..19b3c440ff29039b013f098e874bdbb2675b8634
2025-04-07 xj qian
update
19b3c4 对比 | 目录
2025-04-07 xj qian
update
e4d896 对比 | 目录
已添加3个文件
已修改5个文件
1754 ■■■■■ 文件已修改
jrj/ext-jrj/ext-jrj.vcxproj 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/ext-jrj/ext-jrj.vcxproj.filters 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/HomeWin.cpp 1016 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/IndexWin3.cpp 693 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Expense/Salaryslip.cpp 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Expense/SalaryslipImp.cpp 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kexcel.hpp 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/xcontrol/xexcel.hpp 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/ext-jrj/ext-jrj.vcxproj
@@ -667,6 +667,7 @@
    </ClCompile>
    <ClCompile Include="..\project\business\Expense\SalaryslipEx.cpp" />
    <ClCompile Include="..\project\business\Expense\SalaryslipExMaint.cpp" />
    <ClCompile Include="..\project\business\Expense\SalaryslipImp.cpp" />
    <ClCompile Include="..\project\business\Expense\SaleCostBase.cpp" />
    <ClCompile Include="..\project\business\Expense\SaleCostList.cpp" />
    <ClCompile Include="..\project\business\Expense\SampleFee.cpp">
@@ -1130,6 +1131,8 @@
    <ClCompile Include="..\project\business\VATNotify\VATNotifyParse.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="..\project\HomeWin.cpp" />
    <ClCompile Include="..\project\IndexWin3.cpp" />
    <ClCompile Include="..\project\printview\Maint.Template.PrintEx.cpp">
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
jrj/ext-jrj/ext-jrj.vcxproj.filters
@@ -502,7 +502,7 @@
      <Filter>jarch\trap</Filter>
    </ClInclude>
    <ClInclude Include="..\xframe\devloper\XDevEditPage.hpp">
      <Filter>头文件</Filter>
      <Filter>devloper</Filter>
    </ClInclude>
  </ItemGroup>
  <ItemGroup>
@@ -1598,9 +1598,6 @@
    <ClCompile Include="..\project\business\Expense\RmbRegister.cpp">
      <Filter>project\business\Expense</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Quote\list.EnquiryQuote3.cpp">
      <Filter>源文件</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Expense\PremiumRateList.cpp">
      <Filter>project\business\Expense</Filter>
    </ClCompile>
@@ -1613,6 +1610,18 @@
    <ClCompile Include="..\project\business\Expense\SalaryslipExMaint.cpp">
      <Filter>project\business\Expense</Filter>
    </ClCompile>
    <ClCompile Include="..\project\IndexWin3.cpp">
      <Filter>vbusiness\wface</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Quote\list.EnquiryQuote3.cpp">
      <Filter>project\business</Filter>
    </ClCompile>
    <ClCompile Include="..\project\HomeWin.cpp">
      <Filter>vbusiness\wface</Filter>
    </ClCompile>
    <ClCompile Include="..\project\business\Expense\SalaryslipImp.cpp">
      <Filter>project\business\Expense</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="ext-jrj.def">
jrj/project/HomeWin.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,1016 @@
#include "xcontrol/xreport.hpp"
#include "wobject/xwin.hpp"
#include "wobject/xaserverarg.hpp"
#include "wobject/xstring.hpp"
#include "wobject/xurl.hpp"
#include "xcontrol/xshtml.hpp"
#include "vbusiness/vframe/frame.vframe.vbusiness.hpp"
#include "viewobject/view.base.hpp"
#include "xcontrol/xshtml.hpp"
using xml = Hxsoft::XFrame::KXMLDOMDocument;
class __declspec(dllexport) HomeWin : public xframe
{
public:
    xreport dw_list;
public:
    HomeWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
public:
    static HomeWin* CreateInstance(void* implPtr, void* hWnd)
    {
        return new HomeWin(implPtr, (HWND)hWnd);
    }
    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.Redraw();
        dw_list.SetReadOnly(true);
        */
        return 1;
    }
    xstring GetEntityIDName(LPARAM pr)
    {
        return L"@EntityID";
    }
    xstring GetEntityName(LPARAM pr)
    {
        int nRow = dw_list.GetRow();
        if (nRow < 0) return L"";
        KXMLDOMElement ele = dw_list.GetRowElement(nRow);
        if (!ele) return L"";
        return ele.getAttribute(L"category");
    }
    xstring GetEntityID(LPARAM pr)
    {
        int row = dw_list.GetRow();
        if (row<1 || row>dw_list.GetRowCount()) return 0;
        KXMLDOMElement ele = dw_list.GetRowElement(row);
        if (!ele) return L"";
        xstring id = GetEntityIDName(pr);
        if (!ele.selectSingleNode(id)) return L"";
        xstring d = ele.selectSingleNode(id).text();
        return d;
    }
    xstring GetTaskID()
    {
        int row = dw_list.GetRow();
        if (row<1 || row>dw_list.GetRowCount()) return 0;
        KXMLDOMElement ele = dw_list.GetRowElement(row);
        if (!ele) return L"";
        xstring taskid = ele.getAttribute(L"taskid");
        return taskid;
    }
    xstring GetReason(LPARAM pr, xstring comd)
    {
        xaserverarg arg;
        if (GetEntityName(pr) == L"DeliveryDelay")
        {
            xstring ls_cmdid = comd;//pr;
            int row = dw_list.GetRow();
            if (row < 1) return 1;
            KXMLDOMElement ele = dw_list.GetRowElement(row);
            xstring  ls_status = ele.selectSingleNode(L"@status").text();
            if (ls_status == L"货源部待确认" && ls_cmdid == L"action:bill.check.agree")
            {
                arg.AddArg(L"DDID", GetEntityID(2));
                arg.AddArg(L"_ModuelPage", L"dev:xpage[DeliveryDelay.supmancheck.vx]");
                OpenWindow(L"dev:xpage[vindexforold.vx]", arg);
                //openUrl(L"/sale/view/DeliveryDelay/xpage/DeliveryDelay/supmancheck", arg);
                if (arg.GetArgString(L"ret") == L"Sucess")
                {
                    return L"Auto...";
                }
                return L"";
            }
            else
            {
                //return frame::GetReason(pr);
                arg.AddArg(L"EntityID", GetEntityID(2));
                arg.AddArg(L"_ModuelPage", L"dev:xpage[workflow.chkdlg.vx]");
                OpenWindow(L"dev:xpage[vindexforold.vx]", arg);
                //int newArg2 = arg.ptr_native_;
                //openUrl(L"/sale/view/workflow.view/xpage/chkdlg_vd", newArg2);
                xstring comdid = arg.GetArgString(L"comdid");
                if (comdid == L"xmOK")
                {
                    xstring value = arg.GetArgString(L"content") + L" ";
                    return value;
                }
                return L"";
            }
        }
        else
        {
            //return frame::GetReason(pr);
            arg.AddArg(L"EntityID", GetEntityID(2));
            OpenWindow(L"dev:xpage[workflow.chkdlg.vx]", arg);
            //openUrl(L"/sale/view/workflow.view/xpage/chkdlg", arg);
            xstring comdid2 = arg.GetArgString(L"comdid");
            if (comdid2 == L"xmOK")
            {
                xstring value2 = arg.GetArgString(L"content") + L" ";
                return value2;
            }
            return L"";
        }
    }
    int ViewUpdate(LPARAM pr, xstring updateItem, xaserverarg  arg)
    {
        init();
        return 1;
    }
    xstring GetEntityWorkNode(LPARAM pr, xstring what)
    {
        if (what == L"open")
        {
            int row = dw_list.GetRow();
            if (row<0 || row>dw_list.GetRowCount()) return 0;
            KXMLDOMElement ele = dw_list.GetRowElement(row);
            xstring aurl = ele.selectSingleNode(L"@url").text();
            return aurl;
        }
        return L"";
    }
    int SetAgent()
    {
        if (dw_list)
        {
            //init();
            xstring id = GetEntityID(1);
            if (id != L"")    xframe::SetAgent((xstring)L"letter", id);
        }
        return 1;
    }
    int openUrl(xstring aurl, /*param */ LPARAM para)
    {
        //alert(aurl);
        xml x;
        xurl::get(aurl, L"", x);
        KXMLDOMDocument doc = x;
        KXMLDOMNode n = doc.selectSingleNode(L"//resource/@src");
        //alert(x.xml());
        if (n)
        {
            /*
            xstring xq = n.text();
            OpenWindow(xq, para);
            return 1;
            */
            xstring xq = n.text();
            if (doc.selectSingleNode(L"//resource/@argnative"))
            {
                OpenWindow(xq, para);
            }
            //alert(xq);
            else if (xq.find(L"upplier", 0) > 0 and xq != L"dev:xpage[Maint.SupplierStatusModify.vx]" and xq != L"dev:xpage[Maint.SupplierSubmit.vx]")
                OpenWindow(xq, para);
            else
            {
                xq = xq.replace(L"dev:xpage[", L"");
                xq = xq.replace(L"]", L"");
                xaserverarg& args = *(xaserverarg*)para;
                args.AddArg(L"_ModuelPage", xq);
                //alert(args.GetString());
                OpenWindow(L"dev:xpage[vindexforold.vx]", args);
            }
            return 1;
        }
        else
        {
            xaserverarg& arg = *(xaserverarg*)para;
            n = doc.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, L"xs:xstring");
                }
                if (vface == L"." || vface == L"")
                {
                    xstring v = n.selectSingleNode(L"@url").text();
                    xstring burl = aurl.mid(0, aurl.find(v, 0));
                    //alert(burl);
                    return openUrl(burl + view, arg);
                }
                else
                    return openUrl(vface + L"/" + view, arg);
            }
        }
        return -1;
    }
    int SetTaskProcessed()
    {
        int row = dw_list.GetRow();
        if (row<0 || row>dw_list.GetRowCount()) return 1;
        if (!dw_list.GetRowElement(row)) return 1;
        KXMLDOMElement ele = dw_list.GetRowElement(row);
        xaserverarg arg;
        xstring taskid = ele.getAttribute(L"taskid");
        arg.AddArg(L"TaskID", taskid);
        xml x = ViewObject::RetrieveData(L"/sale/data/business/update/taskprocessed", L"TaskID", taskid);
        if (x) alert(x.text());
        dw_list.DeleteRow(row);
        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 (MessageBox(GetHWND(), L"是否确定删除记录!", L"提示", 1) == 2)
                return 1;
        }
        if (action == L"bill.processed")
        {
            if (MessageBox(GetHWND(), L"是否确定选中的任务转已处理?", L"提示", 1) == 2)
                return 1;
            return  SetTaskProcessed();
        }
        xaserverarg arg;
        arg.AddArg(L"Action", action, L"xs:xstring");
        xml x;
        xstring aurl = L"/workflow/query/actioninfo/" + action;
        if (xurl::get(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), L"xs:xstring");
        //参数要求
        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:xstring");
            else if (how == L"Entity" || how == L"EntityData")
                arg.AddArg(name, content, L"xs:xstring");
            else if (how == L"EntityRowData")
                arg.AddArg(name, GetEntityRowData(pr), L"xs:xstring");
            else if (how == L"Reason")
            {
                arg.AddArg(name, GetReason(1, L""), L"xs:xstring");
            }
            else if (how == L"EntityNo")
                arg.AddArg(name, GetEntityNo(pr), L"xs:xstring");
            else if (how == L"EntityTitle")
                arg.AddArg(name, GetEntityTitle(pr), L"xs:xstring");
            else if (how == L"GetParam")
                arg.AddArg(name, GetParamValue(name), L"xs:xstring");
            else if (how == L"UserID")
                arg.AddArg(name, xaserver::GetUserId(), L"xs:xstring");
            //"CHeckAskMsg"
            //"CHeckMsg
            if (how == L"Reason" && arg.GetArgString(name) == L"") return -1;
            //if(how==L"EntityData" && arg.GetArgString(name)==L"") 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(name + L" å‚数值不能为空,事件终止!");
                        return -1;
                    }
                }
            }
        }
        arg.AddArg(L"action.entity", GetEntityName(pr), L"xs:xstring");
        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:xstring");
            if (worknode != L"")
            {
                if (worknode.find(L"dev:xpage") == 0)
                    OpenWindow(worknode, arg);
                else
                    openUrl(worknode, arg); //---openUrl(worknode,arg);
            }
            else
            {
                alert(L"Warn: Please configure worknode for action " + name + L".");
                return -1;
            }
        }
        else
        {
            //url::post(GetEntityName(pr)+L"/workflow/action",arg.GetString(),x);
            xml x1;
            int retxx = xurl::post(L"/workflow/action/" + GetEntityName(pr) + L"/" + action, arg.GetString(), x1);
            //alert(L"/workflow/action/"+GetEntityName(pr)+L"/"+action+L"\r\n"+arg.GetString()+L"\r\n"+x1.xml());
            if (retxx != 1) execResult = false;
            if (x1.selectSingleNode(L"//process"))
            {
                KXMLDOMElement e1 = x1.selectSingleNode(L"//process");
                xstring valid = e1.getAttribute(L"valid");
                xstring 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");
                xstring val = e2.getAttribute(L"process");
                if (val == L"ok")
                {
                    alert(L"处理成功");
                    PostMessage(GetHWND(), 0x401, (WPARAM)L"action:bill.refresh", 0);
                }
                else if (val == L"part")
                {
                    alert(L"有部分数据处理未成功,提交成功的已处理。");
                    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(L"理成功",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:xstring");
                billstatus = x1.selectSingleNode(L"//msg[1]/@billstatus").text();
                arg.AddArg(L"billstatus", billstatus, L"xs:xstring");
            }
        }
        //更新要求
        if (execResult)
        {
            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:xstring");
                        arg.AddArg(L"billstatus", billstatus, L"xs:xstring");
                        ViewUpdate(pr, how, arg);
                    }
                }
                else
                    ViewUpdate(pr, how, arg);
            }
        }
        return 1;
    }
    /*int ProcessFlowAction(xstring comdid, int pr1)
    {
        //trace(L"comdid--->  %s\r\n", comdid);
        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 (MessageBox(GetHWND(),L"是否确定删除记录!",L"提示1",1) == 2)
                return 1;
        }
        xaserverarg arg = new xaserverarg ;
        arg.AddArg(L"Action", action,L"xs:xstring");
        xml x ;
        x.setNativePointer(xml ::CreateInstance());
        xstring aurl = L"/workflow/query/actioninfo/"+action;
        //trace(L"abc---",aurl);
        if(xurl::get(aurl, L"", x) != 1)
            return -1;
        //alert(x.xml());
        int nlen ;
        int i = 0;
        xstring name;
        xstring worknode;
        xstring how;
        xstring state;
        KXMLDOMElement e;
        arg.AddArg(L"EntityName", GetEntityName(pr),L"xs:xstring");
        //参数要求
        KXMLDOMNodeList nlist = x.selectNodes(L"//params/param");
        nlen = nlist.length;
        //trace(L"xxx");
        for(i=0;    i<nlen;    i++)
        {
            //trace(L"yyy");
            e = nlist.item(i);
            //trace(e.xml);
            name = e.selectSingleNode(L"@name").text();
            how = e.selectSingleNode(L"@how").text();
            //trace(how);
            //trace(name);
            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:xstring");
            else if(how==L"Entity" || how == L"EntityData")
                arg.AddArg(name, content,L"xs:xstring");
            else if(how==L"EntityRowData")
                arg.AddArg(name, GetEntityRowData(pr),L"xs:xstring");
            else if(how==L"Reason")
                arg.AddArg(name, GetReason(pr, comdid),L"xs:xstring");
            else if(how==L"EntityNo")
                arg.AddArg(name, GetEntityNo(pr),L"xs:xstring");
            else if(how==L"EntityTitle")
                arg.AddArg(name, GetEntityTitle(pr),L"xs:xstring");
            else if(how==L"GetParam")
                arg.AddArg(name, GetParamValue(name),L"xs:xstring");
            else if(how==L"UserID")
                arg.AddArg(name, xaserver::GetUserId(),L"xs:xstring");
            //"CHeckAskMsg"
            //"CHeckMsg
            //trace(arg.GetString());
            //trace(arg.GetArgString(name));
            if(how==L"Reason" && arg.GetArgString(name)==L"") return -1;
            //trace(L"cky1");
            //if(how==L"EntityData" && arg.GetArgString(name)==L"") 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(name + L" å‚数值不能为空,事件终止!");
                        return -1;
                    }
                }
            }
        }
        arg.AddArg(L"action.entity",GetEntityName(pr),L"xs:xstring");
        //trace(L"zzz");
        //trace(arg.GetString());
        //动作
        KXMLDOMNode n = x.selectSingleNode(L"//view.action[1]");
        //trace(x.xml());
        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:xstring");
            if(worknode !=L"")
            {
                //trace(L"do:"+worknode);
                int p = arg.ptr_native_;
                openUrl(worknode,p); //---openUrl(worknode,arg);
            }
            else
            {
                alert(L"Warn: Please configure worknode for action "+ name +L".");
                return -1;
            }
        }
        else
        {
            //url::post(GetEntityName(pr)+L"/workflow/action",arg.GetString(),x);
            //trace(L"/workflow/action/"+GetEntityName(pr)+L"/"+action);
            //trace(L"=====L");
            //trace(arg.GetString());
            xml x1 ;
            x1.setNativePointer(xml::CreateInstance());
            int retxx = url::post(L"/workflow/action/"+GetEntityName(pr)+L"/"+action,arg.GetString(),x1);
            if(retxx != 1) execResult = false;
            //trace(x1.xml());
            if(x1.selectSingleNode(L"//msg"))
            {
                xstring aStr = L""+x1.selectSingleNode(L"//msg[1]").text();
                if(aStr.find(L"理成功",0) < 0)
                    alert(aStr);
                if(aStr.find(L"失败",0) >= 0)
                    execResult = false;
                trace(aStr);
            }
            if(x1.selectSingleNode(L"//msg/@state"))
            {
                state = x1.selectSingleNode(L"//msg[1]/@state").text();
                arg.AddArg(L"state",state,L"xs:xstring");
            }
        }
        //更新要求
        if(execResult)
        {
            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();
                //trace(how+L"444"+state);
                if(how==L"setstate")
                {
                    if(state != L"")
                    {
                        arg.AddArg(L"state",state,L"xs:xstring");
                        ViewUpdate(pr,how,arg);
                    }
                }
                else
                    ViewUpdate(pr,how,arg);
            }
        }
        return 1;
    }    */
    int BillPurchor()
    {
        int row1 = dw_list.GetRow();
        if (row1<0 || row1>dw_list.GetRowCount()) return 1;
        if (!dw_list.GetRowElement(row1)) return 1;
        KXMLDOMElement ele1 = dw_list.GetRowElement(row1);
        xstring id1 = GetEntityIDName(1);
        xstring d1 = ele1.selectSingleNode(id1).text();
        xstring name1 = GetEntityName(row1);
        xaserverarg arg1;
        xstring templ = ele1.getAttribute(L"content2");
        xstring taskid = ele1.getAttribute(L"taskid");
        arg1.AddArg(L"template", templ);
        arg1.AddArg(L"TaskID", taskid);
        arg1.AddArg(L"EntityID", d1);
        arg1.AddArg(L"bill.purchor", L"1");
        OpenWindow(L"dev:xpage[QuoteFile.vx]", arg1);
        return 1;
    }
    //命令发布函数
    int OnCmdDispatch(xstring comdid)
    {
        //alert(comdid);
        xstring  userno = publiccode::GetUser().no;
        if (comdid == L"action:bill.purchor") return BillPurchor();
        if (comdid == L"action:bill.check.agree")
        {
            int row3 = dw_list.GetRow();
            if (row3<0 || row3>dw_list.GetRowCount()) return 1;
            if (!dw_list.GetRowElement(row3)) return 1;
            KXMLDOMElement ele3 = dw_list.GetRowElement(row3);
            xstring id3 = GetEntityIDName(1);
            xstring d3 = ele3.selectSingleNode(id3).text();
            xstring name3 = GetEntityName(row3);
            if (name3 == L"SaleItem3")
            {
                xml x3;
                xaserverarg arg3;
                arg3.AddArg(L"SOLineID", d3);
                if (getUrl(L"/sale/data/SaleOrder/UpdateSOLineTypeExS", arg3.GetString(), x3) != 1)
                {
                    xstring error3 = x3.text();
                    alert(L"err:" + error3);
                    return 1;
                }
                ProcessFlowAction(L"action:bill.check.agree", 1);
                return 1;
            }
        }
        if (userno == L"00601" || userno == L"00701" || userno == L"admin")
        {
            if (comdid == L"SourceRemark")
            {
                OnSourceRemark();
                return 1;
            }
        }
        if (comdid == L"action:bill.check.agreeEx")
        {
            int row2 = dw_list.GetRow();
            if (row2<0 || row2>dw_list.GetRowCount()) return 1;
            if (!dw_list.GetRowElement(row2)) return 1;
            KXMLDOMElement ele2 = dw_list.GetRowElement(row2);
            xstring id2 = GetEntityIDName(1);
            xstring d2 = ele2.selectSingleNode(id2).text();
            xstring name2 = GetEntityName(row2);
            if (name2 == L"SaleItem3")
            {
                if (MessageBox(GetHWND(), L"是否确认 å·¥åŽ‚ä»˜æ¬¾ï¼Ÿ", L"提示1", 1) == 2)
                    return 1;
                xml x5;
                xaserverarg arg5;
                arg5.AddArg(L"SOLineID", d2);
                if (getUrl(L"/sale/data/SaleOrder/UpdateSOLineTypeEx", arg5.GetString(), x5) != 1)
                {
                    xstring error = x5.text();
                    alert(L"err:" + error);
                    return 1;
                }
                alert(x5.text());
                ProcessFlowAction(L"action:bill.check.agree", 1);
                return 1;
            }
        }
        if (comdid && comdid.find(L"hand!", 0) == 0)
        {
            if (comdid == L"hand!toleft")
            {
                ProcessFlowAction(L"action:bill.check.unagree", 1);
                return 1;
            }
            if (comdid == L"hand!toright")
            {
                ProcessFlowAction(L"action:bill.check.agree", 1);
                return 1;
            }
            if (comdid == L"hand!toupright")
            {
                int row = dw_list.GetRow();
                if (row<0 || row>dw_list.GetRowCount()) return 1;
                if (!dw_list.GetRowElement(row)) return 1;
                KXMLDOMElement ele = dw_list.GetRowElement(row);
                xstring id = GetEntityIDName(1);
                xstring d = ele.selectSingleNode(id).text();
                if (d == L"") return 1;
                ProcessFlowAction(L"action:bill.open", 1);
                return 1;
            }
            if (comdid == L"hand!round")
            {
                ProcessFlowAction(L"action:bill.note", 1);
                return 1;
            }
        }
        if (comdid == L"xmIconNotifyClicked")
        {
            //OpenWindow(L"dev:xpage[/]",0);
            init();
            return 1;
        }
        if (comdid == L"xmRefresh" || comdid == L"xmRefreshTask")
        {
            init();
            return 1;
        }
        if (ProcessFlowAction(comdid, 1) == 0) return 0;
        if (comdid == L"action:bill.open")
        {
            int row1 = dw_list.GetRow();
            if (row1<0 || row1>dw_list.GetRowCount()) return 1;
            if (!dw_list.GetRowElement(row1)) return 1;
            KXMLDOMElement ele1 = dw_list.GetRowElement(row1);
            xstring id1 = GetEntityIDName(1);
            xstring d1 = ele1.selectSingleNode(id1).text();
            xstring name1 = GetEntityName(row1);
            if (name1 == L"QuoteEnquiry")
            {
                xaserverarg arg1;
                xstring templ = ele1.getAttribute(L"content2");
                xstring taskid = ele1.getAttribute(L"taskid");
                arg1.AddArg(L"template", templ);
                arg1.AddArg(L"TaskID", taskid);
                arg1.AddArg(L"EntityID", d1);
                OpenWindow(L"dev:xpage[QuoteFile.vx]", arg1);
                return 1;
            }
            if (name1 == L"SampleFee")
            {
                xaserverarg arg;
                arg.AddArg(L"SampleFeeID", d1);
                //arg.AddArg(L"HWND",GetHWND().toString());
                OpenWindow(L"dev:xpage[maint.samplefee.vx]", arg);
                return 1;
            }
        }
        return 0;
    }
    int OnSourceRemark()
    {
        xstring name = L"事务处理";
        xml x = ViewObject::RetrieveData(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;
        arg1.AddArg(L"value", Content);
        OpenWindow(L"dev:xpage[memo.edit.new.vx]", arg1);
        return 1;
    }
    int OnDoubleClicked(TEvent* evt, LPARAM p)
    {
        DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh;
        int row = hdr.row;
        if (row<0 || row>dw_list.GetRowCount()) return 1;
        if (!dw_list.GetRowElement(row)) return 1;
        KXMLDOMElement ele = dw_list.GetRowElement(row);
        xstring id = GetEntityIDName(1);
        xstring d = ele.selectSingleNode(id).text();
        if (d == L"") return 1;
        xstring name1 = GetEntityName(1);
        if (name1 == L"QuoteEnquiry")
        {
            xaserverarg arg1;
            xstring templ = ele.getAttribute(L"content2");
            xstring taskid = ele.getAttribute(L"taskid");
            //trace(templ);
            arg1.AddArg(L"template", templ);
            arg1.AddArg(L"TaskID", taskid);
            arg1.AddArg(L"EntityID", d);
            OpenWindow(L"dev:xpage[QuoteFile.vx]", arg1);
            return 1;
        }
        ProcessFlowAction(L"action:bill.open", 1);
        return 1;
    }
    //焦点激活处理函数
    int OnSetFocus(TEvent* evt, LPARAM param)
    {
        SetAgent();
        //重置工具条
        return 1;
    }
    //命令处理事件
    int OnXCommand(TEvent* evt, LPARAM 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;
        KXMLDOMElement ele = dw_list.GetRowElement(row);
        dw_list.SetRow(row);
        if (GetEntityID(1) == L"") return -1;
        //trace(ele.xml);
        xaserverarg arg;
        arg.AddArg(L"content", ele.xml());
        xml doc;
        if (getUrl(L"/sale/data/vpage/vstart/task", arg.GetString(), doc) != 1)
        {
            trace((xstring)L"error->:" + doc.xml());
            return 0;
        }
        if ((xstring)doc.xml() == L"")
            return -1;
        xshtml ht = GetControl(L"taskinfo");
        ht.SetContent(doc.xml());
        ht.Redraw();
        return 1;
    }
    int OnClicked(TEvent* evt, LPARAM p)
    {
        DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh;
        int row = hdr.row;
        trace(L"count:" + (xstring)dw_list.GetRowCount());
        if (row<1 || row>dw_list.GetRowCount()) return 1;
        trace(L"\r\n-------" + (xstring)row);
        if (ShowDetail(row) != 1)
        {
            xstring xfNodeAgentArea = L"agentarea";
            xnode anode = GetAgentNode(xfNodeAgentArea);
            this->SetAgentNode(anode, L"<vbox/>");
        }
        else
        {
            SetAgent();
            ShowAgentInfo();
        }
        return 1;
    }
    int ShowAgentInfo()
    {
        xstring taskID = GetTaskID();
        if (taskID != L"")
        {
            KXMLDOMDocument x = ViewObject::RetrieveData(L"/sale/data/Agent/task", L"TaskID", taskID);
            if (x)
            {
                xshtml xs = GetControl(L"frame:agentinfo");
                string content =  x.xml();
                xs.SetContent(content);
                xs.Redraw();
            }
        }
        return 1;
    }
    int OnRowChanged(TEvent* evt, LPARAM p)
    {
        DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh;
        int row = hdr.row;
        if (row<0 || row>dw_list.GetRowCount()) return 0;
        trace(L"\r\n-----222------");
        if (ShowDetail(row) != 1)
        {
            xstring xfNodeAgentArea = L"agentarea";
            xnode anode = GetAgentNode(xfNodeAgentArea);
            this->SetAgentNode(anode, L"<vbox/>");
        }
        else
        {
            SetAgent();
            ShowAgentInfo();
        }
        return 1;
    }
    int onload()
    {
        //alert(L"xxxxxxxxxxx");
        //SetAgent();
        //AttachEvent(L"WM_SETFOCUS", (FEvent)&startvframevbusiness::OnSetFocus);
        //绑定工具条点击事件
        AttachEvent(L"WM_XCOMMAND", (FEvent)&HomeWin::OnXCommand);
        //AttachEvent(L"WM_TIMER",OnTimer);
        AttachEvent(L"tasklist", L"DWV_ROWFOCUSCHANGED", (FEvent)&HomeWin::OnRowChanged);
        AttachEvent(L"tasklist", L"DWV_DOUBLECLICKED", (FEvent)&HomeWin::OnDoubleClicked);
        AttachEvent(L"tasklist", L"DWV_CLICKED", (FEvent)&HomeWin::OnClicked);
        dw_list = GetControl(L"tasklist");
        init();
        SetAgent();
        return 1;
    }
    int onloaded()
    {
        return 1;
    }
};
jrj/project/IndexWin3.cpp
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,693 @@

#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"
 #include "vbusiness/vframe/frame.vframe.vbusiness.hpp"
using xml = KXMLDOMDocument;
class __declspec(dllexport) IndexWin: public xwin
{
public:
    xstring m_Assignment;
    HWND m_hMenu;
    xlayersheet mainsheet;
    xcombobox cbx_menu; //页签数组
    xcombobox cbx_panelName; //页签顺序数组
    xcombobox cbx_panelNo; //页签数组
    xcombobox cbx_tab; //页签顺序数组
    HWND m_npHwnd; //菜单树窗口句柄
    HWND m_nHwnd; //菜单树窗口句柄
    int m_cursheet; //当前页签
    int menuShow;
    HWND m_npHwnd2; //openwindow
    HWND m_startwin;
public:
    IndexWin(void* implPtr,HWND hWnd):xwin(implPtr,hWnd){}
public:
    static IndexWin* CreateInstance(void* implPtr,void* hWnd)
    {
        return  new IndexWin(implPtr,(HWND)hWnd);
    }
public:
    xstring getHomeConfig(xstring att)
    {
        xml x ;
        x.load(L"cache\\config.xml");
        //alert(x.GetXml());
        if ((xstring)x.xml() == L"") return L"";
        KXMLDOMElement e = x.documentElement();
        if (e.selectSingleNode(L"home"))
        {
            KXMLDOMElement e1 = e.selectSingleNode(L"home");
            if (e1.selectSingleNode(L"@" + att))
                return e1.selectSingleNode(L"@" + att).text();
        }
        return L"";
    }
    int setHomeConfig(xstring att, xstring value)
    {
        xml x ;
        x.load(L"cache\\config.xml");
        if ((xstring)x.xml() == L"")
        {
            //alert(L"<config><home "+att+L"="+value+L"/></config>");
            x.loadXML(L"<config><home " + att + L"='" + value + L"'/></config>");
        }
        else
        {
            KXMLDOMElement e = x.documentElement();
            if (e)
            {
                if (e.selectSingleNode(L"home"))
                {
                    KXMLDOMElement e1 = e.selectSingleNode(L"home");
                    e1.setAttribute(att, value);
                }
                else
                {
                    KXMLDOMElement e2 = x.createElement(L"home");
                    e2.setAttribute(att, value);
                    e.appendChild(e2);
                }
            }
            //alert(e.xml);
        }
        //alert(x.GetXml());
        xutil::SaveToFile(L"cache\\config.xml", x.xml(), L"", L"", (LPTSTR)L"");
        return 1;
    }
    int OnDWClick(TEvent* evt, int p)
    {
        alert(L"clicked");
        return 1;
    }
    int OnMenu(HWND hMenu)
    {
        if (!hMenu)
        {
            HWND hw = m_hMenu;
            bool bwin = hw ? IsWindow(hw):false;
            if (!bwin)
            {
                xaserverarg* arg = new xaserverarg();
                HWND hWnd = GetHWND();
                arg->SetParam(L"hwnd", (LPARAM)hWnd);
                arg->SetParam(L"cbx_menu", (LPARAM)cbx_menu.getNativePointer());
                arg->SetParam(L"cbx_tab", (LPARAM)cbx_tab.getNativePointer());
                arg->SetParam(L"cbx_panelNo", (LPARAM)cbx_panelNo.getNativePointer());
                arg->SetParam(L"cbx_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, true);
        return 1;
    }
    int OnMenu1(xstring 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"cbx_menu", (LPARAM)cbx_menu.getNativePointer());
                arg->SetParam(L"cbx_tab", (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 = (HWND)hMenu.toInt64();
        }
        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, true);
        return 1;
    }
    int OnMenuAgent(xstring f)
    {
        //int LayerFlow_None = 0x00000001;
        //int LayerFlow_UnLayer = 0x00000100;
        //int LayerFlow_NS = 0x00000004;
        //int LayerFlow_Control = 0x00000010;
        int GWL_STYLE = -16;
        int WS_POPUP = 0x80000000;
        int WS_CHILD = 0x40000000;
        int WS_MAXIMIZE = 0x00010000;
        int SW_MAXIMIZE = 3;
        HWND HWND_TOPMOST = (HWND) - 1;
        HWND HWND_NOTOPMOST = (HWND) - 2;
        int SWP_NOSIZE = 0x0001;
        int SWP_NOMOVE = 0x0002;
        int SWP_SHOWWINDOW = 0x0040;
        SetWindowPos(m_nHwnd, HWND_TOPMOST, -1000, -1000, 0, 0, SWP_NOSIZE | SWP_SHOWWINDOW);
        int style = GetWindowLong(m_nHwnd, GWL_STYLE);
        xnode anode = GetAgentNode(L"menuAgent");
        xnode bnode = GetAgentNode(L"xmMenu");
        int isshow = menuShow;
        if (isshow == -1)
        {
            anode.SetLayerFlow(LayerFlow_NS | LayerFlow_Control);
            bnode.SetLayerFlow(LayerFlow_None | LayerFlow_UnLayer);
            style = style - WS_POPUP;
            style = style + WS_CHILD;
            SetWindowLong(m_nHwnd, GWL_STYLE, style);
            m_npHwnd = GetParent(m_nHwnd);
            xcontrol xc = GetControl(L"menuAgent");
            SetParent(m_nHwnd, xc.GetHWND());
            ShowWindow(m_nHwnd, SW_MAXIMIZE);
            ///AttachEvent(L"WM_SIZE",OnMenuSizeChanged);
            //AttachEvent(L"WM_PAINT",OnMenuSizeChanged);
            //AttachEvent(L"WM_WINDOWPOSCHANGED",OnMenuSizeChanged);
        }
        else
        {
            bnode.SetLayerFlow(LayerFlow_NS | LayerFlow_Control);
            anode.SetLayerFlow(LayerFlow_None | LayerFlow_UnLayer);
            style = style + WS_POPUP;
            style = style - WS_CHILD;
            SetWindowLong(m_nHwnd, GWL_STYLE, style);
            SetParent(m_nHwnd, m_npHwnd);
            OnMenu(NULL);
        }
        menuShow = -1 - isshow;
        cbx_menu.SetCurSel(menuShow);
        if (f != L"")
            setHomeConfig(L"menuposition", xstring(menuShow));
        return 1;
    }
    int ResetMenu()
    {
        ::DestroyWindow(m_hMenu);
        m_hMenu = 0;
        return 1;
        //if(m_nHwnd) xwin::CloseWindow(m_nHwnd);
        m_nHwnd = 0;
        OnMenu(NULL);
        OnMenuAgent(L"");
#if 0
        menuShow = -1;
        xstring f = getHomeConfig(L"menuposition");
        if (f == L"0")
        {
            OnMenu(NULL);
            OnMenuAgent(L"");
        }
        xaserverarg arg;
        HWND h = GetHWND();
        //arg.AddArg(L"hwnd", xstring(h));
        arg.SetParam(L"hwnd", h);
        OpenWindow(L"dev:xpage[vindexforold.vx]", arg);
#endif
        return 1;
    }
    int ReSetInfo()
    {
        cbx_menu.ResetContent();
        cbx_tab.ResetContent();
        cbx_panelNo.ResetContent();
        cbx_panelName.ResetContent();
        int hItem = mainsheet.GetSheetCount();
        while (hItem > 1)
        {
            //mainsheet.DeleteSheet(hItem - 1);
            SendMessage(GetHWND(), 0x401, (WPARAM)L"xmSheetClose", 0);
            hItem = mainsheet.GetSheetCount();
        }
        xml x;
        xaserverarg arg;
        arg.AddArg(L"Assignment", m_Assignment);
        //alert(arg.GetString());
        if (xaserver::ExecXQuery(GetServerUrl(), L"[GetSysInfo.xq]", arg.GetString(), x) != 1)
        {
            //trace(x.GetXml());
            return -1;
        }
        if ((xstring)x.xml() == L"") return -1;
        KXMLDOMElement e = x.documentElement();
        if (/*m_Assignment == L"" &&*/ e.selectSingleNode(L"AssignmentID"))
        {
            xstring sInfoEx = e.selectSingleNode(L"AssignmentID").text();
            m_Assignment = sInfoEx;
        }
        if (m_Assignment == L"")
            alert(L"获取用户数据失败,请重新登录!");
        else
            xaserver::SetUID((LPWSTR)m_Assignment.c_str(true));
        xcombobox::AddItem(cbx_menu.GetHWND(), L"开始");
        xcombobox::AddItem(cbx_tab.GetHWND(), L"-1");
        //OpenWindow(L"dev:xpage[vstart.vx]");
        xcontrol xc = GetControl(L"statusbar0");
        xc.SetText(L"正在初始化系统,请稍候....");
        HCURSOR hCursor = xutil::SetCursorWait();
        if (e.selectSingleNode(L"name"))
        {
            xstring sInfo = e.selectSingleNode(L"name").text();
            xc.SetText(sInfo + L"  ç³»ç»Ÿç‰ˆæœ¬:" + xaserver::GetVersion());
        }
        ResetMenu();
        xutil::RestoreCursor(hCursor);
        return 1;
    }
    int OnChangeLogin()
    {
        xml x;
        xaserverarg arg ;
        arg.AddArg(L"userno", xaserver::GetUserNo());
        if (xaserver::ExecXQuery(GetServerUrl(), L"[GetSysAssignment.xq]", arg.GetString(), x) != 1)
        {
            trace(x.xml());
            return -1;
        }
        if ((xstring)x.xml() == L"") return -1;
        KXMLDOMElement e = x.documentElement();
        KXMLDOMNodeList li = e.selectNodes(L"item");
        int i;
        int s = li.length();
        xstring sInfo = m_Assignment;
        if (s > 0)
        {
            HMENU m = CreatePopupMenu();
            int MF_STRING = 0x00000000;
            int MF_DISABLED = 0x00000002;
            int TPM_RIGHTBUTTON = 0x0002;
            int TPM_RETURNCMD = 0x0100;
            int MF_CHECKED = 0x8;
            for (i = 0; i < s; i++)
            {
                KXMLDOMElement xitem = li.item(i);
                xstring id = xitem.selectSingleNode(L"AssignmentID").text();
                xstring name = xitem.selectSingleNode(L"PositionName").text();
                if (sInfo == id)
                    AppendMenu(m, MF_STRING | MF_CHECKED, i + 1, name);
                else
                    AppendMenu(m, MF_STRING, i + 1, name);
            }
            RECT xr;
            xpoint pt;
            GetCursorPos(pt);
            int res = TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, GetHWND(), &xr);
            if (res == 0) return 0;
            KXMLDOMElement ele = li.item(res - 1);
            xstring sInfoEx = ele.selectSingleNode(L"AssignmentID").text();
            if (m_Assignment == sInfoEx) return 0;
            m_Assignment = sInfoEx;
            ReSetInfo();
            /*if(m_nHwnd)
            {
                win32::CloseWindow(m_nHwnd);
            }*/
        }
        return 1;
    }
    int OnAllCaption()
    {
        HMENU m = CreatePopupMenu();
        int MF_STRING = 0x00000000;
        int MF_DISABLED = 0x00000002;
        int TPM_RIGHTBUTTON = 0x0002;
        int TPM_RETURNCMD = 0x0100;
        int MF_CHECKED = 0x8;
        int k = mainsheet.GetSheetIndex();
        //int cs = xcombobox::GetCount(cbx_menu.GetId());
        int cs = mainsheet.GetSheetCount();
        int i;
        for (i = 0; i < cs; i++) {
            //xstring str = xcombobox::GetLBText(cbx_menu.GetId(), i);
            xstring str = mainsheet.GetSheetText(i);
            if (i == k)
                AppendMenu(m, MF_STRING | MF_CHECKED, i + 1, str);
            else
                AppendMenu(m, MF_STRING, i + 1, str);
        }
        RECT xr;
        xpoint pt;
        GetCursorPos(pt);
        int res = TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, GetHWND(), &xr);
        if (res == 0) return 0;
        int nSheet = mainsheet.GetSheetIndex();
        if (nSheet == (res - 1)) return 0;
        mainsheet.SelectSheet(res - 1);
        return 0;
    }
    int OnChangeSheet(xstring sheet)
    {
        if (sheet == L"") return 0;
        int nIndex = sheet.toInt();
        int curIndex = mainsheet.GetSheetIndex();
        if (nIndex == curIndex)
            return 0;
        mainsheet.SelectSheet(nIndex);
        return 1;
    }
    int OnMenuSizeChanged(TEvent* evt, int p)
    {
        /*xrect xr33;
        xcontrol xc = GetControl(L"menuAgent");
        xwin::GetWindowRect(xc.GetId(), xr33);
        int l = xr33.left;
        int b = xr33.right;
        int xx = b - l;*/
        //alert(xx.toString());
        int isshow = menuShow;
        if (isshow == 0)
        {
            int SW_MAXIMIZE = 3;
            xcontrol xc = GetControl(L"menuAgent");
            SetParent(m_nHwnd, xc.GetHWND());
            ShowWindow(m_nHwnd, SW_MAXIMIZE);
        }
        return 1;
    }
#if 0
    int OnOpen(xstring pa)
    {
        //xwin::SendMessage(m_npHwnd2, 0x401, pa, 0);
        //return 1;
        /*if(xaserver::GetUserNo() == L"admin")
        {
            OpenWindow(L"dev:xpage[vstart.vx]");
            return 1;
        }*/
        xaserverarg arg ;
        xstring isnew = arg.GetArgString(L"_isNewModule");
        xstring vx = arg.GetArgString(L"_ModuelPage");
        if (isnew == L"Y")
        {
            if (vx.find(L".vx", 0) > 0 || vx.find(L".xpage", 0) > 0)
                OpenWindow(L"dev:xpage[" + vx + L"]", arg);
            else
                openUrl(vx, p);
            return 1;
        }
        //OpenWindow(L"dev:xpage[vindexforold.vx]", p);
        return 1;
    }
    int OnOpenForOld(xstring pa)
    {
        m_npHwnd2 = pa.toInt();
        int GWL_STYLE = -16;
        int WS_POPUP = 0x80000000;
        int WS_CHILD = 0x40000000;
        int SW_MAXIMIZE = 3;
        int style = GetWindowLong(m_npHwnd2, GWL_STYLE);
        style = style - WS_POPUP;
        style = style + WS_CHILD;
        SetWindowLong(m_npHwnd2, GWL_STYLE, style);
        xcontrol xc = GetControl(L"openforold");
        SetParent(m_npHwnd2, xc.GetHWND());
        ShowWindow(m_npHwnd2, SW_MAXIMIZE);
        return 1;
    }
#endif
    int OnHelp()
    {
        OpenWindow(L"dev:xpage[trade.help3.vx]");
        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 (comdid ==L"xmAssignment") OnChangeLogin();
        else if (comdid == L"xmAllCaption") OnAllCaption();
        else if (comdid == L"xmMenu") OnMenu(0);
        else if (comdid == L"xmHelp") return OnHelp();
        //else if (comdid.find(L"menuid:", 0) >= 0) OnMenu(comdid.mid(comdid.find(L":", 0) + 1, comdid.length()));
        else if (comdid.find(L"menuAgent:", 0) >= 0) OnMenuAgent(comdid.mid(comdid.find(L":", 0) + 1, comdid.length()));
        else if (comdid.find(L"changesheet:", 0) >= 0) OnChangeSheet(comdid.mid(comdid.find(L":", 0) + 1, comdid.length()));
        //else if (comdid.find(L"openforoldid:", 0) >= 0) OnOpenForOld(comdid.mid(comdid.find(L":", 0) + 1, comdid.length()));
        //else if (comdid.find(L"open:", 0) >= 0) OnOpen(comdid.mid(comdid.find(L":", 0) + 1, comdid.length()));
        else if (comdid == L"xmRefreshTask")
        {
            SendMessage(m_startwin, 0x401, (WPARAM)comdid.c_str(), 0);
            return 1;
        }
        return 0;
    }
    int OnXCommand(TEvent* evt,int p)
    {
        return OnCmdDispatch(evt->xcommand.pStrID);
    }
    int OnAttachListon()
    {
        AttachEvent(L"WM_XCOMMAND",(FEvent)&IndexWin::OnXCommand,this);
        //AttachEvent(L"mdilayer", L"LYSN_SELECTEDSHEET", (FEvent)&IndexWin::OnSheetChanged);
        ////AttachEvent(L"mdilayer", L"LYSN_CLOSESHEET",(FEvent)&IndexWin::OnCloseSheet);
        return 1;
    }
    int OnSheetChanged(TEvent* evt, int p)
    {
        LYSNMHDR& nmtv = *(LYSNMHDR*)evt->notify.pnmh;
        int sheet = nmtv.nSheet;
        int s = mainsheet.GetSheetCount();
        //trace(s);
        int cs = xcombobox::GetCount(cbx_menu.GetHWND());
        int cursheet = m_cursheet;
        if (s > cs) {
            xcombobox::AddItem(cbx_menu.GetHWND(), L"自由窗口");
            xcombobox::AddItem(cbx_tab.GetHWND(), xstring(cursheet));
        }
        if (s < cs) {
            xcombobox::DeleteItem(cbx_menu.GetHWND(), cursheet);
            int i = 0;
            xstring value = xcombobox::GetLBText(cbx_tab.GetHWND(), cursheet);
            for (i = 0; i < cs; i++)
            {
                xstring tabId = xcombobox::GetLBText(cbx_tab.GetHWND(), i);
                if (tabId == xstring(cursheet))
                {
                    xcombobox::DeleteItem(cbx_tab.GetHWND(), i);
                    xcombobox::InsertString(cbx_tab.GetHWND(), i, value);
                }
            }
            xcombobox::DeleteItem(cbx_tab.GetHWND(), cursheet);
            if (sheet != value.toInt())
                mainsheet.SelectSheet(value.toInt());
        }
        if (cursheet != mainsheet.GetSheetIndex())
        {
            HWND hPicture = FindWindowEx(0, 0, L"XFrameWndClass", L"__ProductPicture");
            if (hPicture)
            {
                int WM_CLOSE = 0x0010;
                PostMessage(hPicture, WM_CLOSE, 0, 0);
            }
        }
        m_cursheet = mainsheet.GetSheetIndex();
        return 1;
    }
    int OnCloseSheet(TEvent* evt, int p)
    {
        LYSNMHDR& nmtv = *(LYSNMHDR*)evt->notify.pnmh;
        int sheet = nmtv.nSheet;
        //alert(L"xxxx");
        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"))
        {
            xstring sInfoEx = e.selectSingleNode(L"AssignmentID").text();
            m_Assignment = sInfoEx;
        }
        if((xstring)m_Assignment == L"")
            alert(L"获取用户数据失败,请重新登录!");
        else
            xaserver::SetUID((LPWSTR)m_Assignment.c_str(true));
        return 1;
    }
    int OnInitial()
    {
        xstring userno = xaserver::GetUserNo();
        if (userno == L"admin" /*|| userno==L"00206" || userno==L"00206" || userno==L"00201" ||userno==L"00101" */)
        {
            xnode anode = GetAgentNode(L"dev");
            int LayerFlow_WE_ = 0x00000002;
            int LayerFlow_Control_ = 0x00000010;
            anode.SetLayerFlow(LayerFlow_WE | LayerFlow_Control);
        }
        m_Assignment = L"";
        return 1;
    }
    int Initial()
    {
        SetUserID();
        xstring userno = xaserver::GetUserNo();
        if (userno == L"admin")
        {
            xnode anode = GetAgentNode(L"dev");
            int LayerFlow_WE_ = 0x00000002;
            int LayerFlow_Control_ = 0x00000010;
            anode.SetLayerFlow(LayerFlow_WE_ | LayerFlow_Control_);
        }
        m_Assignment = L"";
        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();
        return 1;
    }
    int onloaded()
    {
        ReSetInfo();
        //OpenWindow("dev:xpage[start.vframe.vbusiness.vx]");
        //xwin* lw_face = OpenWindow(L"dev:xpage[start.vframe.vbusiness.vx]");
        xwin* lw_face = OpenWindow(L"dev:xpage[test.homeex.vx]");
        if(lw_face)m_startwin = lw_face->GetHWND();
        cbx_panelName.SetCurSel( -1);
        ResetMenu();
        return 1;
    }
};
jrj/project/business/Expense/Salaryslip.cpp
Binary files differ
jrj/project/business/Expense/SalaryslipImp.cpp
Binary files differ
jrj/xframe/kobject/kexcel.hpp
@@ -15,4 +15,10 @@
    void SaveToFile(const LPTSTR FileName);// alias "?SaveToFile@CExcelApplication@@QAEXQA_W@Z";
    void Quit(); //alias "?Quit@CExcelApplication@@QAEXXZ";
    //LPDISPATCH GetApplication();
public:
    int GetValidRow();
    int GetValidColumn();
    BSTR GetCellString(int row, int col);
    int SetICellString(int row, int col, const wchar_t* val);
};
jrj/xframe/xcontrol/xexcel.hpp
@@ -41,4 +41,21 @@
    {
       GetKExcel()->Quit();
    }
};
    int GetValidRow()
    {
        return GetKExcel()->GetValidRow();
    }
    int GetValidColumn()
    {
        return GetKExcel()->GetValidColumn();
    }
    BSTR GetCellString(int row, int col)
    {
        return GetKExcel()->GetCellString(row, col);
    }
    int SetICellString(int row, int col, const wchar_t* val)
    {
        return GetKExcel()->SetICellString(row, col, val);
    }
};