lifan
2026-03-04 e39d18d6d7ed5ee9c7dd94836d7a898c975a7354
update
已修改4个文件
2526 ■■■■ 文件已修改
jrj/project/business/Expense/SampleRequestForm.cpp 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/start.vframe.vbusiness.cpp 2064 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/kobject/kreport.hpp 204 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/xframe/xcontrol/xreport.hpp 258 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jrj/project/business/Expense/SampleRequestForm.cpp
Binary files differ
jrj/project/start.vframe.vbusiness.cpp
@@ -1,999 +1,1065 @@
#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) startvframevbusiness : public xframe
{
public:
    xreport dw_list;
public:
    startvframevbusiness(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
public:
    static startvframevbusiness* CreateInstance(void* implPtr, void* hWnd)
    {
        return new startvframevbusiness(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);
        trace((xstring)L"\r\n====113======L" + ele.xml());
        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;
        }
        //trace(L"----1111----");
        if ((xstring)doc.xml() == L"")
            return -1;
        //trace(doc.xml());
        xshtml ht = GetControl(L"taskinfo");
        ht.SetContent(doc.xml());
        ht.Redraw();
        //xframe::SetAgent((xstring)L"letter", GetEntityID(1));
        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();
        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();
        return 1;
    }
    int onload()
    {
        //alert(L"xxxxxxxxxxx");
        //SetAgent();
        //AttachEvent(L"WM_SETFOCUS", (FEvent)&startvframevbusiness::OnSetFocus);
        //绑定工具条点击事件
        AttachEvent(L"WM_XCOMMAND", (FEvent)&startvframevbusiness::OnXCommand);
        //AttachEvent(L"WM_TIMER",OnTimer);
        AttachEvent(L"tasklist", L"DWV_ROWFOCUSCHANGED", (FEvent)&startvframevbusiness::OnRowChanged);
        AttachEvent(L"tasklist", L"DWV_DOUBLECLICKED", (FEvent)&startvframevbusiness::OnDoubleClicked);
        AttachEvent(L"tasklist", L"DWV_CLICKED", (FEvent)&startvframevbusiness::OnClicked);
        dw_list = GetControl(L"tasklist");
        init();
        SetAgent();
        return 1;
    }
    int onloaded()
    {
        return 1;
    }
};
#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) startvframevbusiness : public xframe
{
public:
    xreport dw_list;
public:
    startvframevbusiness(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
public:
    static startvframevbusiness* CreateInstance(void* implPtr, void* hWnd)
    {
        return new startvframevbusiness(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;
        int row = dw_list.GetRow();
        KXMLDOMElement pElement;
        LPCWSTR path = L"@cate";
        LPWSTR val = nullptr;
        LPWSTR guid = nullptr;
        LPWSTR guid1 = nullptr;
        if (dw_list.GetRowCount() >= row  && row > 0)
        {
            pElement = dw_list.GetRowElement(row);
            val = pElement.getAttribute(L"cate");
            guid = pElement.getAttribute(L"taskid");
            if (dw_list.GetRowCount() >= row + 1)
            {
                KXMLDOMElement pElement1 = dw_list.GetRowElement(row+1);
                if (pElement1)
                {
                    xstring val1 = pElement.getAttribute(L"cate");
                    if(val1 == val)
                    {
                        guid1 = pElement.getAttribute(L"taskid");
                    }
                }
            }
        }
        dw_list.Retrieve(doc);
        if(val)
            dw_list.CreateTree((LPCWSTR)L"node()",path,val, 1, 15, 16);
        else
            dw_list.CreateTree((LPCWSTR)L"node()", 1, 15, 16);
        dw_list.Redraw();
        if (val)
        {
            row = 0;
            for (int i = 1; i <= dw_list.GetRowCount(); i++)
            {
                pElement = dw_list.GetRowElement(i);
                //BSTR bxml;
                //pElement.get_xml(bxml);
                //if (bxml)::SysFreeString(bxml);
                LPWSTR val1 = pElement.getAttribute(L"cate");
                if (xstring(val1) == val)
                {
                    row = i + 1;
                    break;
                }
            }
            if (row)
            {
                int srow = row;
                for (; row < dw_list.GetRowCount(); row++)
                {
                    pElement = dw_list.GetRowElement(row);
                    xstring cate = pElement.getAttribute(L"cate");
                    if (cate != val)break;
                    xstring id = pElement.getAttribute(L"taskid");
                    if (id == guid || id == guid1)
                    {
                        srow = row;
                        break;
                    }
                }
                dw_list.SetRow(srow);
            }
        }
        if (val)delete val;
        /*
        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);
        trace((xstring)L"\r\n====113======L" + ele.xml());
        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;
        }
        //trace(L"----1111----");
        if ((xstring)doc.xml() == L"")
            return -1;
        //trace(doc.xml());
        xshtml ht = GetControl(L"taskinfo");
        ht.SetContent(doc.xml());
        ht.Redraw();
        //xframe::SetAgent((xstring)L"letter", GetEntityID(1));
        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();
        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();
        return 1;
    }
    int onload()
    {
        //alert(L"xxxxxxxxxxx");
        //SetAgent();
        //AttachEvent(L"WM_SETFOCUS", (FEvent)&startvframevbusiness::OnSetFocus);
        //绑定工具条点击事件
        AttachEvent(L"WM_XCOMMAND", (FEvent)&startvframevbusiness::OnXCommand);
        //AttachEvent(L"WM_TIMER",OnTimer);
        AttachEvent(L"tasklist", L"DWV_ROWFOCUSCHANGED", (FEvent)&startvframevbusiness::OnRowChanged);
        AttachEvent(L"tasklist", L"DWV_DOUBLECLICKED", (FEvent)&startvframevbusiness::OnDoubleClicked);
        AttachEvent(L"tasklist", L"DWV_CLICKED", (FEvent)&startvframevbusiness::OnClicked);
        dw_list = GetControl(L"tasklist");
        init();
        SetAgent();
        return 1;
    }
    int onloaded()
    {
        return 1;
    }
};
jrj/xframe/kobject/kreport.hpp
@@ -1,101 +1,103 @@
#pragma once
#include "kcontrol.hpp"
#include "kdwview.hpp"
namespace Hxsoft{ namespace XFrame{ namespace XOffice {namespace XReport
{
    class IXReport : public IDwView //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);
    };
}}}}
#pragma once
#include "kcontrol.hpp"
#include "kdwview.hpp"
namespace Hxsoft{ namespace XFrame{ namespace XOffice {namespace XReport
{
    class IXReport : public IDwView //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 CreateTree(LPCTSTR pPath, LPCTSTR pValPath, LPCTSTR pVal,int nCol, int nImage1, int nImage2);
        int GetContentRow(int nRow);
    };
}}}}
jrj/xframe/xcontrol/xreport.hpp
@@ -1,127 +1,131 @@
#pragma once
#include "wobject/xcontrol.hpp"
#include "kobject/kreport.hpp"
using kreport = Hxsoft::XFrame::XOffice::XReport::IXReport;
using KXMLDOMDocument = Hxsoft::XFrame::KXMLDOMDocument;
using KXMLDOMElement = Hxsoft::XFrame::KXMLDOMElement;
class xreport : public xcontrol
{
    public:
        xreport():xcontrol(nullptr){}
        xreport(void * implptr):xcontrol(implptr){}
        kreport * getKReport(){return (kreport*)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:
        LPCTSTR GetItemString(int nRow,int nColumn,kreport::DWBuffer dwBuffer=kreport::dbuf_normal)
        {
            return getKReport()->GetItemString_(nRow,nColumn,dwBuffer);
        }
        LPCTSTR GetItemString(int nRow,LPCTSTR ColumnName,kreport::DWBuffer dwBuffer=kreport::dbuf_normal)
        {
            return getKReport()->GetItemString_(nRow,ColumnName,dwBuffer);
        }
        bool SetItemString(int nRow,int nColumn,LPCTSTR lptStr,kreport::DWBuffer dwBuffer=kreport::dbuf_normal)
        {
            return getKReport()->SetItemString_(nRow,nColumn,lptStr,dwBuffer);
        }
        bool SetItemString(int nRow,LPCTSTR ColumnName,LPCTSTR lptStr,kreport::DWBuffer dwBuffer=kreport::dbuf_normal)
        {
            return getKReport()->SetItemString_(nRow,ColumnName,lptStr,dwBuffer);
        }
    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:
        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);
        }
};
#pragma once
#include "wobject/xcontrol.hpp"
#include "kobject/kreport.hpp"
using kreport = Hxsoft::XFrame::XOffice::XReport::IXReport;
using KXMLDOMDocument = Hxsoft::XFrame::KXMLDOMDocument;
using KXMLDOMElement = Hxsoft::XFrame::KXMLDOMElement;
class xreport : public xcontrol
{
    public:
        xreport():xcontrol(nullptr){}
        xreport(void * implptr):xcontrol(implptr){}
        kreport * getKReport(){return (kreport*)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:
        LPCTSTR GetItemString(int nRow,int nColumn,kreport::DWBuffer dwBuffer=kreport::dbuf_normal)
        {
            return getKReport()->GetItemString_(nRow,nColumn,dwBuffer);
        }
        LPCTSTR GetItemString(int nRow,LPCTSTR ColumnName,kreport::DWBuffer dwBuffer=kreport::dbuf_normal)
        {
            return getKReport()->GetItemString_(nRow,ColumnName,dwBuffer);
        }
        bool SetItemString(int nRow,int nColumn,LPCTSTR lptStr,kreport::DWBuffer dwBuffer=kreport::dbuf_normal)
        {
            return getKReport()->SetItemString_(nRow,nColumn,lptStr,dwBuffer);
        }
        bool SetItemString(int nRow,LPCTSTR ColumnName,LPCTSTR lptStr,kreport::DWBuffer dwBuffer=kreport::dbuf_normal)
        {
            return getKReport()->SetItemString_(nRow,ColumnName,lptStr,dwBuffer);
        }
    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:
        int CreateTree(LPCWSTR pPath,int nCol, int nImage1,int nImage2)
        {
            return getKReport()->CreateTree(pPath,nCol,nImage1,nImage2);
        }
        int CreateTree(LPCWSTR pPath, LPCWSTR pValPath, LPCWSTR pVal,int nCol, int nImage1, int nImage2)
        {
            return getKReport()->CreateTree(pPath, pValPath, pVal,nCol, nImage1, nImage2);
        }
        int GetContentRow(int nRow)
        {
            return getKReport()->GetContentRow(nRow);
        }
};