#include #include #include #include #include "vbusiness/vframe/maint.vframe.vbusiness.hpp" #include "viewobject/view.base.hpp" using xml = KXMLDOMDocument; class __declspec(dllexport) maintCustomerv3 : public maint { public: xlayersheet xsheet; xlayersheet m_layer; xdwtable dw_detail; xdwtable dw_power; xdwtable dw_require; xdwtable dw_jzfx; xdwtable dw_visit; xdwtable dw_Meetings; xdwtable dw_MeetingsEx; xdwgrid dw_account; int iLayer;//页面Index int APP=1; HWND CustomerGoodsHWND; xstring userno; xstring ApplyStatus; /*struct PUser { xstring id; xstring no; xstring name; };*/ public: maintCustomerv3(void* implPtr, HWND hWnd) :maint(implPtr, hWnd) {} public: static maintCustomerv3* CreateInstance(void* implPtr, void* hWnd) { maintCustomerv3* pWin = new maintCustomerv3(implPtr, (HWND)hWnd); return pWin; } xstring GetGuid() { return publiccode::GetGuid(); } int ViewUpdate(int pr,xstring updateItem,xaserverarg arg) { if(updateItem==L"update") { dw_detail.ResetUpdateStatus(); } return 1; } xstring GetEntityData(LPARAM pr) { xml x; dw_detail.DwUpdateAllTo(x); KXMLDOMElement e=x.documentElement(); xml x1 ; dw_visit.DwUpdateAllTo(x1); KXMLDOMElement e1=x1.documentElement(); KXMLDOMNodeList oNodeList = e1.selectNodes(L"//Customer/*"); int i=0; for (i=0; inotify.pnmh; xstring colname = hdr->colname; xstring coldata = hdr->data; int row = hdr->row; //根据国别显示地区代码 if (colname == L"CountryCode") { xaserverarg arg ; arg.setNativePointer(arg.CreateInstance()); arg.AddArg(L"countryCode",coldata); xml x; if (getUrl(L"/sale/data/"+GetEntityName(1)+L"/pref/areacode",arg.GetString(),x)==1) { xstring sareacode = L""; xstring sareaname = L""; if(x.selectSingleNode(L"//AreaCode")) { sareacode = x.selectSingleNode(L"//AreaCode").text(); sareaname = x.selectSingleNode(L"//AreaName").text(); } dw_detail.SetItemString(1,L"AreaCode",sareacode); dw_detail.SetItemDisplayString(1,L"AreaCode",sareaname); dw_detail.Redraw(); } } //只能选一个主联系人 if (colname == L"PrimaryFlag" && coldata == L"Y") { xdwtable dw_pc; dw_pc = dw_detail.FindDwTable(L"item1"); if (dw_pc) { int i; for (i=1;i <= dw_pc.GetRowCount();i++) { if (i != row) { dw_pc.SetItemString(i,L"PrimaryFlag",L"N"); dw_pc.SetItemDisplayString(i,L"PrimaryFlag",L""); } } } } //客户名相同。 if (colname == L"Name") { //alert(coldata); /* xstring sguid = GetPartyID(coldata,colname); if (sguid != L"") { alert(L"客户名称与系统已有客户重复,请于管理员联系解决!"); }*/ //alert(L"ccc"); } //客户简称 if (colname == L"ShortName") { xstring sguid1 = GetPartyID(coldata,colname); //trace(sguid1); if (sguid1 != L"") { alert(L"客户简称重复,请改用其他简称!"); } } //根据客户来源填写客户备注 /*if (colname == L"Source") { if(coldata==L"025") alert(L"来源备注对应填写客户如何知道我们公司"); if(coldata==L"017" || coldata==L"018") alert(L"来源备注对应填写哪个客户介绍的"); if(coldata==L"019") alert(L"来源备注对应填写哪个海外办事处或者联络点介绍"); if(coldata==L"020") alert(L"来源备注对应填写哪个门店介绍"); if(coldata==L"021") alert(L"来源备注对应填写谁介绍"); if(coldata==L"026") alert(L"来源备注对应填写谁考察市场争取到的客户"); if(coldata==L"028") alert(L"来源备注对应填写国外展会名称"); if(coldata==L"034") alert(L"来源备注对应填写谁的代理业务"); if(coldata==L"001" || coldata==L"002" ) alert(L"来源备注对应填写客户如何知道我们公司"); if(coldata==L"0052" || coldata==L"0053" || coldata==L"0054" || coldata==L"0055" || coldata==L"0051") dw_detail.SetItemString(1,L"SourceRemark",L"阿里巴巴"); if(coldata==L"0161" || coldata==L"0162" ) dw_detail.SetItemString(1,L"SourceRemark",L"环球资源"); if(coldata==L"0061" || coldata==L"0062" ) dw_detail.SetItemString(1,L"SourceRemark",L"中国制造网"); if(coldata==L"022" || coldata==L"023" || coldata==L"037" || coldata==L"038" || coldata==L"039" || coldata==L"040" || coldata==L"007" || coldata==L"024" ) dw_detail.SetItemString(1,L"SourceRemark",L"MH网站"); }*/ //联系人Title选择。 if (colname == L"Title") { xdwtable dw_PartyContact; dw_PartyContact = dw_detail.FindDwTable(L"PartyContact"); if(coldata==L"MR") dw_PartyContact.SetItemString(dw_PartyContact.GetRow(),L"Gender",L"男"); else if(coldata==L"MS" || coldata==L"MADAM" || coldata==L"MRS" ) dw_PartyContact.SetItemString(dw_PartyContact.GetRow(),L"Gender",L"女"); else dw_PartyContact.SetItemString(dw_PartyContact.GetRow(),L"Gender",L""); } if (colname==L"SalesPersonID" && coldata != L"")//设置人员归属 { trace(L"asdasd"); xstring ls_deptname,ls_teamname,ls_groupname,ls_unitname; ls_deptname = publiccode::GetUser(coldata).deptname; ls_teamname = publiccode::GetUser(coldata).teamname; ls_groupname = publiccode::GetUser(coldata).groupname; ls_unitname = publiccode::GetUser(coldata).unitname; trace(ls_unitname); dw_detail.SetItemString(1,L"OrgName",ls_deptname+xstring(ls_teamname)+ xstring(ls_groupname)+ xstring(ls_unitname) ); } //根据生日自动设置年龄。 /*if (colname == L"Birthday") { xdwtable dw_PartyContact1; dw_PartyContact1 =dw_detail.FindDwTable(L"PC_OtherInfo"); xml xx = new xml; xx.setNativePointer(xml ::CreateInstance()); xaserverarg argnew = new xaserverarg; argnew.setNativePointer(argnew.CreateInstance()); xstring agesql; agesql = L"select Dbo.GetAge( '{$Birthday}',getdate()) for xml PATH('root'),ELEMENTS XSINIL"; argnew.AddArg(L"sql",agesql); argnew.AddArg(L"Birthday",coldata); if (getSql(argnew.GetString(),xx) == 1) { KXMLDOMElement AgeEle=xx.documentElement; dw_PartyContact1.SetItemString(1,L"Age",AgeEle.text()); } }*/ return 1; } int OnAddRow() { xdwtable dw_obj; xdwtable dw_contact; dw_contact = dw_detail.GetCurTable(); xstring sDwname = dw_contact.GetDwName(); if(sDwname.find(L"item") >=0 ) sDwname = dw_contact.GetParent().GetDwName(); if(sDwname==L"PartyContact") { int iRowPc = dw_contact.InsertRow(0); } else if(sDwname==L"PartyAddress") { int iRowPad = dw_contact.InsertRow(0); } else if(sDwname==L"PartyBankAccount") { int iRowPba = dw_contact.InsertRow(0); } int h=m_layer.GetSheetIndex(); int nindex = h+1; //alert(nindex.toString()); if(nindex==5) { dw_obj=GetControl(L"dw_jzfx"); xdwtable dw = dw_obj.GetCurTable(); int row = dw.InsertRow(1, 0); dw.SetItemString(row,L"SeqNo",xstring(row)); } if(nindex==4) { dw_obj=GetControl(L"dw_visit"); xdwtable dw1 = dw_obj.GetCurTable(); int row1 = dw1.InsertRow(0); } if(nindex==3) { dw_obj=GetControl(L"dw_MeetingsEx"); xdwtable dw3 = dw_obj.GetCurTable(); int row3 = dw3.InsertRow(0); } if(nindex==2) { dw_obj=GetControl(L"dw_Meetings"); xdwtable dw2 = dw_obj.GetCurTable(); int row2 = dw2.InsertRow(0); } return 0; } int OnInsertRow() { xdwtable dw_obj; xdwtable dw_contact; dw_contact = dw_detail.GetCurTable(); xstring sDwname = dw_contact.GetDwName(); if(sDwname.find(L"item") >=0 ) sDwname = dw_contact.GetParent().GetDwName(); if(sDwname==L"PartyContact") { int iRowPc = dw_contact.InsertRow(dw_contact.GetRow()); } else if(sDwname==L"PartyAddress") { int iRowPad = dw_contact.InsertRow(dw_contact.GetRow()); } else if(sDwname==L"PartyBankAccount") { int iRowPba = dw_contact.InsertRow(dw_contact.GetRow()); } int h=m_layer.GetSheetIndex(); int nindex = h+1; if(nindex==5) { dw_obj=GetControl(L"dw_jzfx"); xdwtable dw = dw_obj.FindDwTable(L"CustomerJzfx"); int row = dw.InsertRow(1,dw.GetRow()); //dw.SetGuid(row,publiccode::GetGuid()); } if(nindex==4) { dw_obj=GetControl(L"dw_visit"); xdwtable dw1 =dw_obj.GetCurTable(); int row1 = dw1.InsertRow(dw1.GetRow()); } if(nindex==3) { dw_obj=GetControl(L"dw_MeetingsEx"); xdwtable dw3 =dw_obj.GetCurTable(); int row3 = dw3.InsertRow(dw3.GetRow()); } if(nindex==2) { dw_obj=GetControl(L"dw_Meetings"); xdwtable dw2 =dw_obj.GetCurTable(); int row2 = dw2.InsertRow(dw2.GetRow()); } return 0; } int OnDeleteRow() { xdwtable dw_obj; xdwtable dw_contact; dw_contact = dw_detail.GetCurTable(); xstring sDwname = dw_contact.GetDwName(); if(sDwname.find(L"item") >=0 ) sDwname = dw_contact.GetParent().GetDwName(); if(sDwname==L"PartyContact" ||sDwname==L"PartyAddress" ||sDwname==L"PartyBankAccount" ) { int row = dw_contact.GetRow(); dw_contact.DeleteRow(row); } int h=m_layer.GetSheetIndex(); int nindex = h+1; if(nindex==5) { dw_obj=GetControl(L"dw_jzfx"); xdwtable dw = dw_obj.GetCurTable(); int row1 = dw.GetRow(); if(dw.GetRowCount() >1) dw.DeleteRow(row1); } if(nindex==4) { dw_obj=GetControl(L"dw_visit"); xdwtable dw1 = dw_obj.GetCurTable(); int row2 = dw1.GetRow(); dw1.DeleteRow(row2); } if(nindex==3) { dw_obj=GetControl(L"dw_MeetingsEx"); xdwtable dw4 = dw_obj.GetCurTable(); int row4 = dw4.GetRow(); dw4.DeleteRow(row4); } if(nindex==2) { dw_obj=GetControl(L"dw_Meetings"); xdwtable dw3 = dw_obj.GetCurTable(); int row3 = dw3.GetRow(); dw3.DeleteRow(row3); } return 0; } int OnDetailRow() { trace(L"detail"); return 0; } int OnPreSave() { xml xxx ; dw_detail.DwUpdateAllTo(xxx); trace(xxx.xml()); //return 0; //客户名称 xstring sName; sName = dw_detail.GetItemString(1,L"Name"); if (sName == L"") { alert(L"客户名称不能为空!"); return 0; } xstring sShortName = dw_detail.GetItemString(1,L"ShortName"); if (sShortName == L"") { alert(L"客户简称不能为空!"); return 0; } xstring Level = dw_detail.GetItemString(1,L"Level"); /*if (Level == L"") { alert(L"客户等级不能为空!"); return 0; }*/ /* if(dw_detail.GetItemString(1,L"Address")==L"") { alert(L"客户地址不能为空!"); return 0; } if(dw_detail.GetItemString(1,L"Source")==L"") { alert(L"客户来源不能为空!"); return 0; } if(dw_detail.GetItemString(1,L"CountryCode")==L"") { alert(L"客户国别不能为空!"); return 0; } if(dw_detail.GetItemString(1,L"TEL")==L"") { alert(L"公司电话不能为空!"); return 0; }*/ //客户简称不能重复 /* xstring sPartyID = GetPartyID(sShortName,L"ShortName"); if (sPartyID != L"") { alert(L"此客户简称已经存在!"); } */ //客户代码 xstring sPartyNo; sPartyNo = dw_detail.GetItemString(1,L"PartyNo"); if (sPartyNo == L"" ) { //alert(L"客户代码不能为空!"); //return 0; xstring sNo = publiccode::GetIdentityNo(L"Party1"); if (sNo == L"") sNo == L"1000"; dw_detail.SetItemString(1,L"PartyNo",sNo); } //成立时间YearEstablished //雇员数量Employees //xstring sYearEstablished = dw_detail.GetItemString(1,L"YearEstablished"); //xstring sEmployees = dw_detail.GetItemString(1,L"Employees"); //sYearEstablished.toInt(); //联系人姓名Name-PCName,设置状态 xdwtable dw_PartyContact; dw_PartyContact = dw_detail.FindDwTable(L"PartyContact"); xdwtable PC_OtherInfo; PC_OtherInfo = dw_detail.FindDwTable(L"PC_OtherInfo"); int countflag=0; if (dw_PartyContact) { int i; for (i=1;i <= dw_PartyContact.GetRowCount();i++) { xstring sPCName = dw_PartyContact.GetItemString(i,L"Name"); if (sPCName == L"" ) { xstring sPCTitle = dw_PartyContact.GetItemString(i,L"Title"); if (sPCTitle == L"") sPCTitle = L""; xstring sPCJobTitle = dw_PartyContact.GetItemString(i,L"JobTitle"); if (sPCJobTitle == L"") sPCJobTitle = L""; xstring sPCGender = dw_PartyContact.GetItemString(i,L"Gender"); if (sPCGender == L"") sPCGender = L""; xstring sPCMobile = dw_PartyContact.GetItemString(i,L"Mobile"); if (sPCMobile == L"") sPCMobile = L""; xstring sPCTEL = dw_PartyContact.GetItemString(i,L"TEL"); if (sPCTEL == L"") sPCTEL = L""; xstring sPCEmail = dw_PartyContact.GetItemString(i,L"Email"); if (sPCEmail == L"") sPCEmail = L""; xstring sAll = sPCTitle + sPCJobTitle + sPCGender + sPCMobile + sPCTEL + sPCEmail; /*if (sAll != L"") { alert(L"联系人姓名不能为空"); return 0; }*/ } else { xstring aStatus; aStatus = dw_PartyContact.GetItemString(i,L"Status"); if (aStatus==L"") { dw_PartyContact.SetItemString(i,L"Status",L"1"); } } if(dw_PartyContact.GetItemString(i,L"ContactID")==L"") { dw_PartyContact.SetItemString(i,L"ContactID",GetGuid()); } xstring sFlag = dw_PartyContact.GetItemString(i,L"PrimaryFlag"); if(sFlag==L"Y") { countflag ++; dw_PartyContact.SetItemString(i,L"PrimaryFlag",L"Y"); PC_OtherInfo.SetItemString(1,L"ContactID",dw_PartyContact.GetItemString(i,L"ContactID")); } } if(countflag==0 && dw_PartyContact.GetItemString(1,L"Name") !=L"") { dw_PartyContact.SetItemString(1,L"PrimaryFlag",L"Y"); PC_OtherInfo.SetItemString(1,L"ContactID",dw_PartyContact.GetItemString(1,L"ContactID")); } } //银行帐号BankName-BankName;BankAccountNo-PBABankAccountNo ; 设置状态 xdwtable dw_PartyBankAccount; dw_PartyBankAccount =dw_detail.FindDwTable(L"PartyBankAccount"); if (dw_PartyBankAccount) { int j; for (j=1;j <= dw_PartyBankAccount.GetRowCount();j++) { xstring sPBABankName = dw_PartyBankAccount.GetItemString(j,L"BankName"); xstring sPBABankAccountNo = dw_PartyBankAccount.GetItemString(j,L"BankAccountNo"); if (sPBABankName == L"") sPBABankName = L""; if (sPBABankAccountNo == L"") sPBABankAccountNo = L""; xstring sPBAAll = sPBABankName + sPBABankAccountNo; if (sPBAAll != L"") { /*if (sPBABankName == L"") { alert(L"银行名称不能为空"); return 0; } if (sPBABankAccountNo == L"") { alert(L"银行账户不能为空"); return 0; }*/ dw_PartyBankAccount.SetItemString(j,L"Status",L"1"); } } } //地址,设置状态 xdwtable dw_PartyAddress; dw_PartyAddress =dw_detail.FindDwTable(L"PartyAddress"); if (dw_PartyAddress) { int k; for (k=1;k <= dw_PartyAddress.GetRowCount();k++) { xstring sPADAddressName = dw_PartyAddress.GetItemString(k,L"AddressName"); xstring sPADAddress = dw_PartyAddress.GetItemString(k,L"Address"); if (sPADAddressName == L"") sPADAddressName = L""; if (sPADAddress == L"") sPADAddress = L""; xstring sPADAll = sPADAddressName + sPADAddress; if (sPADAll != L"") { dw_PartyAddress.SetItemString(k,L"Status",L"1"); dw_PartyAddress.SetItemString(k,L"IdentifyAddressFlag",L"N"); } } } return 1; } int DoUpdate(bool showSuccess = true) { int rec =OnPreSave(); if (rec != 1) return 0; ProcessFlowAction(L"action:bill.update",1); return 1; } int CustomerModify()//跳到客户修改界面 { //trace(L"asdsad"); xaserverarg& arg = *new xaserverarg; arg.setNativePointer(arg.CreateInstance()); arg.AddArg(L"EntityID", maint::m_EntityID); openUrl(L"/sale/view/"+GetEntityName(1)+L"/worknode/customermodify/open", &arg); //CloseWindow(); return 1; } int OnComdidSplit(xstring str){ if(str.find(L"|", 0)<0) return -1; CustomerGoodsHWND = (HWND)str.mid(str.find(L"|",0) + 1, str.length()).toInt64(); } int OnShare() { xaserverarg& arg = *new xaserverarg; arg.setNativePointer(arg.CreateInstance()); int row = dw_detail.GetRow(); if(row < 1) return 0; xstring PartyID = dw_detail.GetItemString(row,L"PartyID"); arg.AddArg(L"EntityID",PartyID); arg.AddArg(L"EntityName", L"客户共享"); OpenWindow(L"dev:xpage[UserGroupShare.vx]", (LPARAM) & arg); return 1; } int OnShareMessage() { xaserverarg& arg = *new xaserverarg; arg.setNativePointer(arg.CreateInstance()); int row = dw_detail.GetRow(); if(row < 1) return 0; xstring PartyID = dw_detail.GetItemString(row,L"PartyID"); arg.AddArg(L"PartyID",PartyID); OpenWindow(L"dev:xpage[XmShare.Custumer.v3.vx]", (LPARAM)&arg); return 1; } int PreOnCmdDispatch(xstring comdid) { if (comdid == L"cb_save") { SendMessageW(CustomerGoodsHWND,0x401, (WPARAM)L"cb_save", 0); } else if (comdid == L"cb_copy") { SendMessageW(CustomerGoodsHWND,0x401, (WPARAM)L"cb_copy", 0); } else if (comdid == L"cb_delete") { SendMessageW(CustomerGoodsHWND,0x401, (WPARAM)L"cb_delete", 0); } else if (comdid == L"cb_reflash") { SendMessageW(CustomerGoodsHWND,0x401, (WPARAM)L"cb_reflash", 0); } else if(comdid == L"cb_add") { SendMessageW(CustomerGoodsHWND,0x401, (WPARAM)L"cb_add", 0); } else if(comdid == L"cb_import") { SendMessageW(CustomerGoodsHWND,0x401, (WPARAM)L"cb_import",0); } else if (comdid == L"action:bill.row.add") return OnAddRow(); else if (comdid == L"action:bill.row.insert") return OnInsertRow(); else if (comdid == L"action:bill.row.delete") return OnDeleteRow(); else if (comdid == L"action:bill.row.detail") return OnDetailRow(); else if (comdid == L"action:bill.SourceRemark") return OnSourceRemark(); else if (comdid == L"action:bill.update") { return OnPreSave(); } else if (comdid == L"action:customermodify") return CustomerModify(); else if(comdid.find(L"|",0)){ OnComdidSplit(comdid); } if(comdid==L"action:XmShare") { OnShare(); return 0; } if(comdid==L"action:XmShareMessage") { OnShareMessage(); return 0; } // else if (comdid.find(L"action:",0) >= 0) return OnAction(comdid); return -1; } int PostOnCmdDispatch(xstring comdid) { if (comdid == L"action:bill.update") { dw_detail.ResetUpdateStatus(); dw_visit.ResetUpdateStatus(); dw_Meetings.ResetUpdateStatus(); dw_MeetingsEx.ResetUpdateStatus(); } return 1; } //选择tab页面 int OnSelectedSheet(TEvent* evt,int p) { iLayer = m_layer.GetSheetIndex(); if (iLayer == 0) SetAgent(L"maint",maint::m_EntityID); else if (iLayer == 1) { int cc=APP; cc=cc +1; APP=cc; if(cc==2) { xsheet.DeleteSheet(1); xstring xp = L""; xaserverarg& arg = * new xaserverarg; arg.setNativePointer(arg.CreateInstance()); arg.AddArg(L"CustomerID",m_EntityID); arg.AddArg(L"FROM", L"Customer"); arg.AddArg(L"CustomerName", dw_detail.GetItemString(1,L"Name")); arg.AddArg(L"config", L"客户产品.vface/config/CustomerGoodsVdVd/view"); //arg.AddArg(L"CustomerHWND",GetHWND().toString()); arg.SetParam(L"CustomerHWND", (LPARAM)GetHWND()); int nIndex = xsheet.InsertSheet(-1, L"客户ID货号库", xp, (void *) &arg); xsheet.SelectSheet(nIndex); } //win32::SendMessage(CustomerGoodsHWND.toInt(),0x401, L"SetFocus", nil); } return 1; } 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 = * new xaserverarg; arg1.setNativePointer(arg1.CreateInstance()); arg1.AddArg(L"value",Content); OpenWindow(L"dev:xpage[memo.edit.new.vx]",(LPARAM) & arg1); return 1; } int OnItemClick(TEvent* evt,int p) { xdwtable dw = dw_detail.FindDwTable(L"item1",0); xdwtable dw1 = dw_detail.FindDwTable(L"item2",0); xdwtable dw2 = dw_detail.FindDwTable(L"item3",0); int start=dw_detail.GetCellRowFromRowColumn(1,dw_detail.GetColumnIndex(L"Website")); int m,n,k; m=dw.GetRowCount(); n=dw1.GetRowCount(); k=dw2.GetRowCount(); if(dw.GetRowCount()==0) { m=dw.GetRowCount() +1; } if(dw1.GetRowCount()==0) { n=dw1.GetRowCount() +1; } if(dw2.GetRowCount()==0) { k=dw2.GetRowCount() +1; } DWNMHDR* hdr = (DWNMHDR*)evt->notify.pnmh; xstring value = hdr->data; //alert(value); xaserverarg& arg=* new xaserverarg; if(value == L"主要联系人其它信息") { dw_detail.ExpandCellRow(start +m +5,start +m+7); } else if(value == L"其它地址") { dw_detail.ExpandCellRow(start +m+9,start +m+9+n); //dw_base.ExpandMarginRow(-22,-20); } else if(value == L"银行信息") { dw_detail.ExpandCellRow(start +m+11+n,start +m+11+n+k); //dw_base.ExpandMarginRow(-22,-20); } else if(value == L"业务概述") { dw_detail.ExpandCellRow(start +m+13+n+k,start +m+13+n+k+2); //dw_base.ExpandMarginRow(-22,-20); } else if(value == L"客户授信") { dw_detail.ExpandCellRow(start +m+15+n+k +2,start +m+15+n+k +2+1); //dw_base.ExpandMarginRow(-22,-20); } if(value == L"客户资料附件") { if(userno == L"admin" || userno == L"00601" || userno == L"00701") { //alert(dw_detail.GetGuid(1)); arg.AddArg(L"entityid",dw_detail.GetGuid(1)); OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", (LPARAM) & arg); return 1; } } if(value == L"客户基本信息") { xaserverarg& arg1 = *new xaserverarg; xstring str = dw_detail.GetItemString(1,L"BasicInformation"); arg1.AddArg(L"value",str); OpenWindow(L"dev:xpage[memo.edit.new.vx]", (LPARAM)&arg1); if(arg1.GetArgString(L"comdid")==L"xmOK") { str = arg1.GetArgString(L"value"); dw_detail.AcceptText(); dw_detail.SetItemString(1,L"BasicInformation",str); } return 1; } return 1; } int OnItemClickEx(TEvent* evt, int pr) { xdwtable dw = dw_visit.FindDwTable(L"item",0); DWNMHDR* hdr = (DWNMHDR*)evt->notify.pnmh; xstring colname = hdr->colname; xstring value = hdr->data; int row = hdr->row; //alert(value); xaserverarg& arg=*new xaserverarg; arg.setNativePointer(arg.CreateInstance()); if(value == L"上传") { if(dw.GetGuid(dw.GetRow())==L"") { alert(L"保存后在上传!"); return 1; } arg.AddArg(L"entityid",dw.GetGuid(dw.GetRow())); OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", (LPARAM)&arg); return 1; } return 1; } int OnItemClickExS(TEvent* evt,int p) { xdwtable dw = dw_Meetings.FindDwTable(L"item",0); DWNMHDR* hdr = (DWNMHDR*)evt->notify.pnmh; xstring colname = hdr->colname; xstring value = hdr->data; int row = hdr->row; //alert(value); xaserverarg& arg=*new xaserverarg; if(value == L"附件上传") { if(dw.GetGuid(dw.GetRow())==L"") { alert(L"保存后在上传!"); return 1; } arg.AddArg(L"entityid",dw.GetGuid(dw.GetRow())); OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", (LPARAM)&arg); return 1; } if(value == L"人员") { xaserverarg& arg2 =* new xaserverarg; xaserverarg& parg2 = *(xaserverarg*)GetParam(); OpenWindow(L"dev:xpage[UserGroupPersonSelect.vx]", (LPARAM)&arg2); if(arg2.GetArgString(L"comdid")==L"xmOk") { xstring data = arg2.GetArgString(L"data"); xml x2; x2.loadXML(data); KXMLDOMNodeList nodes = x2.selectNodes(L"/root/item"); trace(x2.xml()); int len = nodes.length(); xstring Names = L""; for(int i=0;inotify.pnmh; xstring colname = hdr->colname; xstring value = hdr->data; int row = hdr->row; //alert(value); xaserverarg& arg=*new xaserverarg; if(value == L"附件上传") { if(dw.GetGuid(dw.GetRow())==L"") { alert(L"保存后在上传!"); return 1; } arg.AddArg(L"entityid",dw.GetGuid(dw.GetRow())); OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]",(LPARAM)&arg); return 1; } if(value == L"人员") { xaserverarg& arg2 = *new xaserverarg; xaserverarg parg2 = *(xaserverarg*)GetParam(); OpenWindow(L"dev:xpage[UserGroupPersonSelectEx.vx]", (LPARAM)&arg2); if(arg2.GetArgString(L"comdid")==L"xmOk") { xstring data = arg2.GetArgString(L"data"); xml x2; x2.loadXML(data); KXMLDOMNodeList nodes = x2.selectNodes(L"/root/item"); trace(x2.xml()); int len = nodes.length(); xstring Names = L""; for(int i=0;i"; /*xaserverarg arg = new xaserverarg; arg.setNativePointer(arg.CreateInstance()); arg.AddArg(L"CustomerID", this.m_EntityID); arg.AddArg(L"CustomerName", dw_detail.GetItemString(1,L"Name")); arg.AddArg(L"config", L"客户产品.vface/config/CustomerGoodsNewVd/view"); arg.AddArg(L"CustomerHWND",this.GetHWND().toString()); //trace(this.m_EntityID); int p =arg.__nativept;*/ //int nIndex = xsheet.InsertSheet(-1, L"客户ID货号库", xp, 0); //xsheet.SelectSheet(nIndex); //xsheet.SelectSheet(0); //默认收缩 /*xdwtable dw = new xdwtable; dw.setNativePointer(dw_detail.FindDwTable(L"PartyAddress",0)); xdwtable dw1 = new xdwtable; dw1.setNativePointer(dw_detail.FindDwTable(L"PartyBankAccount",0)); xdwtable dw2 = new xdwtable; dw2.setNativePointer(dw_detail.FindDwTable(L"PartyContact",0)); int start=dw_detail.GetCellRowFromRowColumn(1,dw_detail.GetColumnIndex(L"Website")); dw_detail.ExpandCellRow(start + dw2.GetRowCount() +3,start +dw2.GetRowCount()+5); int start1=dw_detail.GetCellRowFromRowColumn(1,dw_detail.GetColumnIndex(L"Website")); dw_detail.ExpandCellRow(start1 + dw2.GetRowCount() +7,start1 + dw2.GetRowCount() +7 +dw.GetRowCount()); int start2=dw_detail.GetCellRowFromRowColumn(1,dw_detail.GetColumnIndex(L"Website")); dw_detail.ExpandCellRow(start2 + dw2.GetRowCount() +9 +dw.GetRowCount(),start2 + dw2.GetRowCount() +9 +dw.GetRowCount() +dw1.GetRowCount()); int start3=dw_detail.GetCellRowFromRowColumn(1,dw_detail.GetColumnIndex(L"YearEstablished")); dw_detail.ExpandCellRow(start3,start3 +2); int start4=dw_detail.GetCellRowFromRowColumn(1,dw_detail.GetColumnIndex(L"CompanyCredit")); dw_detail.ExpandCellRow(start4,start4 +1); */ //默认收缩 xdwtable dw = dw_detail.FindDwTable(L"item1",0); xdwtable dw1 = dw_detail.FindDwTable(L"item2",0); xdwtable dw2 = dw_detail.FindDwTable(L"item3",0); int m,n,k; m=dw.GetRowCount(); n=dw1.GetRowCount(); k=dw2.GetRowCount(); if(dw.GetRowCount()==0) { m=dw.GetRowCount() +1; } if(dw1.GetRowCount()==0) { n=dw1.GetRowCount() +1; } if(dw2.GetRowCount()==0) { k=dw2.GetRowCount() +1; } //trace(dw2.GetRowCount()); int start=dw_detail.GetCellRowFromRowColumn(1,dw_detail.GetColumnIndex(L"Website")); dw_detail.ExpandCellRow(start +m +5,start +m+7); //trace(start +k +3); dw_detail.ExpandCellRow(start +m+9,start +m+9+n); //trace(start +k+7); dw_detail.ExpandCellRow(start +m+11+n,start +m+11+n+k); //trace(start +k+10+m); dw_detail.ExpandCellRow(start +m+13+n+k,start +m+13+n+k+2); //trace(start +k+14+m+n); dw_detail.ExpandCellRow(start +m+15+n+k +2,start +m+15+n+k +2+1); //trace(start +k+16+m+n +2); if (!maint::m_EntityID) { OnInit(); }else { //xstring userno = publiccode::getUserNo(); userno = xaserver::GetUserNo(); if(userno !=L"00601" && userno !=L"admin" && userno !=L"00701") { dw_detail.SetColumnProp(L"SalesPersonID",L"cellprotect",L"1"); } } if (GetParam()) { int iArgs = GetParam(); xaserverarg& args = *new xaserverarg; //alert(args.GetString()); xstring CustomerGood = args.GetArgString(L"CustomerGood"); ApplyStatus= args.GetArgString(L"CustomerGood"); if(CustomerGood==L"Y") { xsheet.DeleteSheet(0); xstring xp = L""; xaserverarg& arg = *new xaserverarg; arg.setNativePointer(arg.CreateInstance()); arg.AddArg(L"CustomerID", m_EntityID); arg.AddArg(L"FROM", L"Customer"); arg.AddArg(L"CustomerName", dw_detail.GetItemString(1,L"Name")); arg.AddArg(L"config", L"客户产品.vface/config/CustomerGoodsVdVd/view"); //arg.AddArg(L"CustomerHWND",GetHWND().toString()); arg.SetParam(L"CustomerHWND", (LPARAM)GetHWND()); int nIndex = xsheet.InsertSheet(-1, L"客户ID货号库", xp, (void*)&arg); xsheet.SelectSheet(nIndex); //xsheet.SetSheetState(0, 0); } ApplyStatus=dw_detail.GetItemString(1,L"ApplyStatus"); if(userno !=L"00601" && userno !=L"admin" && userno !=L"00701") { if(ApplyStatus ==L"财务已审核") { dw_detail.SetReadOnly(true); } } dw_detail.SetEditUpperMode(true); dw_visit.SetEditUpperMode(true); dw_Meetings.SetEditUpperMode(true); dw_MeetingsEx.SetEditUpperMode(true); } return 1; } };