xj qian
2024-06-25 53b6f7ad5895724e7db403283516775eeee7f5d8
jrj/project/business/Customer3.maint.cpp
@@ -24,7 +24,7 @@
   xdwgrid   dw_account;
   
   int            iLayer;//页面Index
   int            iLayer;//页面Index
   int APP=1;         
   HWND    CustomerGoodsHWND;
@@ -120,18 +120,18 @@
      dw_detail.SetItemString(1,L"CreateDate",publiccode::GetCurrentDate());
      dw_detail.SetItemString(1,L"ModifyDate",publiccode::GetCurrentDate());
      dw_detail.SetItemString(1,L"Status",L"1");
      dw_detail.SetItemString(1,L"PAStatus",L"1"); //地址状态
      dw_detail.SetItemString(1,L"PrimaryFlag",L"Y"); //主地址
      dw_detail.SetItemString(1,L"Type",L"1"); //客户为 1
      dw_detail.SetItemString(1,L"IdentifyAddressFlag",L"Y"); //没必要,暂时留着
      dw_detail.SetItemString(1,L"PAStatus",L"1"); //地址状态
      dw_detail.SetItemString(1,L"PrimaryFlag",L"Y"); //主地址
      dw_detail.SetItemString(1,L"Type",L"1"); //客户为 1
      dw_detail.SetItemString(1,L"IdentifyAddressFlag",L"Y"); //没必要,暂时留着
      
      xstring sdate = publiccode::GetCurrentDate();   
      dw_detail.SetItemString(1,L"ApplyDate",sdate);
      dw_detail.SetItemString(1,L"ApplyStatus",L"新建");
      dw_detail.SetItemString(1,L"ApplyStatus",L"新建");
      dw_detail.SetItemString(1,L"Level",L"");         
      
      //dw_detail.SetItemDisplayString(1,L"客户资料",L"客户资料附件");
      dw_detail.SetItemString(1,L"客户资料",L"客户资料附件");
      //dw_detail.SetItemDisplayString(1,L"客户资料",L"客户资料附件");
      dw_detail.SetItemString(1,L"客户资料",L"客户资料附件");
      xstring guid = publiccode::GetGuid();
      dw_detail.SetGuid(1,guid);
      dw_detail.Redraw();
@@ -166,7 +166,7 @@
      int row = hdr->row;
   
      //根据国别显示地区代码
      //根据国别显示地区代码
      if (colname == L"CountryCode")
      {
         xaserverarg arg ;
@@ -189,7 +189,7 @@
         }
      }
      
      //只能选一个主联系人
      //只能选一个主联系人
      if (colname == L"PrimaryFlag" && coldata == L"Y")
      {
         xdwtable dw_pc;
@@ -209,72 +209,72 @@
         }
      }
      //客户名相同。
      //客户名相同。
      if (colname == L"Name")
      {
      //alert(coldata);
      /*   xstring sguid = GetPartyID(coldata,colname);
         if (sguid != L"")
         {
            alert(L"客户名称与系统已有客户重复,请于管理员联系解决!");
            alert(L"客户名称与系统已有客户重复,请于管理员联系解决!");
         }*/
         //alert(L"ccc");
      }
   
      //客户简称
      //客户简称
      if (colname == L"ShortName")
      {
         xstring sguid1 = GetPartyID(coldata,colname);
         //trace(sguid1);
         if (sguid1 != L"")
         {
            alert(L"客户简称重复,请改用其他简称!");
            alert(L"客户简称重复,请改用其他简称!");
         }
      }
      //根据客户来源填写客户备注
      //根据客户来源填写客户备注
      /*if (colname == L"Source")
      {
         if(coldata==L"025")
            alert(L"来源备注对应填写客户如何知道我们公司");
            alert(L"来源备注对应填写客户如何知道我们公司");
         if(coldata==L"017" || coldata==L"018")
            alert(L"来源备注对应填写哪个客户介绍的");
            alert(L"来源备注对应填写哪个客户介绍的");
         if(coldata==L"019")
            alert(L"来源备注对应填写哪个海外办事处或者联络点介绍");
            alert(L"来源备注对应填写哪个海外办事处或者联络点介绍");
         if(coldata==L"020")
            alert(L"来源备注对应填写哪个门店介绍");
            alert(L"来源备注对应填写哪个门店介绍");
         if(coldata==L"021")
            alert(L"来源备注对应填写谁介绍");
            alert(L"来源备注对应填写谁介绍");
         if(coldata==L"026")
            alert(L"来源备注对应填写谁考察市场争取到的客户");
            alert(L"来源备注对应填写谁考察市场争取到的客户");
         if(coldata==L"028")
            alert(L"来源备注对应填写国外展会名称");
            alert(L"来源备注对应填写国外展会名称");
         if(coldata==L"034")
            alert(L"来源备注对应填写谁的代理业务");
            alert(L"来源备注对应填写谁的代理业务");
         if(coldata==L"001" || coldata==L"002" )
            alert(L"来源备注对应填写客户如何知道我们公司");
            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"阿里巴巴");
            dw_detail.SetItemString(1,L"SourceRemark",L"阿里巴巴");
         if(coldata==L"0161" || coldata==L"0162" )
            dw_detail.SetItemString(1,L"SourceRemark",L"环球资源");
            dw_detail.SetItemString(1,L"SourceRemark",L"环球资源");
         if(coldata==L"0061" || coldata==L"0062" )
            dw_detail.SetItemString(1,L"SourceRemark",L"中国制造网");
            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网站");
            dw_detail.SetItemString(1,L"SourceRemark",L"MH网站");
      }*/
      //联系人Title选择。
      //联系人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"男");
            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"女");
            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"")//设置人员归属
      if (colname==L"SalesPersonID"  && coldata != L"")//设置人员归属
      {
         trace(L"asdasd");
         xstring ls_deptname,ls_teamname,ls_groupname,ls_unitname;
@@ -285,7 +285,7 @@
         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;
@@ -467,65 +467,65 @@
      trace(xxx.xml());
      //return 0;
      
      //客户名称
      //客户名称
      xstring sName;
      sName = dw_detail.GetItemString(1,L"Name");
      if (sName == L"")
      {
         alert(L"客户名称不能为空!");
         alert(L"客户名称不能为空!");
         return 0;
      }
      
      xstring sShortName = dw_detail.GetItemString(1,L"ShortName");
      if (sShortName == L"")
      {
         alert(L"客户简称不能为空!");
         alert(L"客户简称不能为空!");
         return 0;
      }
      xstring Level = dw_detail.GetItemString(1,L"Level");
      /*if (Level == L"")
      {
         alert(L"客户等级不能为空!");
         alert(L"客户等级不能为空!");
         return 0;
      }*/
      
      /*
      if(dw_detail.GetItemString(1,L"Address")==L"")
      {
         alert(L"客户地址不能为空!");
         alert(L"客户地址不能为空!");
         return 0;
      }
      
      if(dw_detail.GetItemString(1,L"Source")==L"")
      {
         alert(L"客户来源不能为空!");
         alert(L"客户来源不能为空!");
         return 0;
      }
      if(dw_detail.GetItemString(1,L"CountryCode")==L"")
      {
         alert(L"客户国别不能为空!");
         alert(L"客户国别不能为空!");
         return 0;
      }
      if(dw_detail.GetItemString(1,L"TEL")==L"")
      {
         alert(L"公司电话不能为空!");
         alert(L"公司电话不能为空!");
         return 0;
      }*/
      //客户简称不能重复
      //客户简称不能重复
      /*
      xstring sPartyID = GetPartyID(sShortName,L"ShortName");
      if (sPartyID != L"")
      {
         alert(L"此客户简称已经存在!");
         alert(L"此客户简称已经存在!");
      }
      */
      
      //客户代码
      //客户代码
      xstring sPartyNo;
      sPartyNo = dw_detail.GetItemString(1,L"PartyNo");
      if (sPartyNo == L"" )
      {
         //alert(L"客户代码不能为空!");
         //alert(L"客户代码不能为空!");
         //return 0;
         
         xstring sNo = publiccode::GetIdentityNo(L"Party1");
@@ -535,14 +535,14 @@
         
      }   
      //成立时间YearEstablished
      //雇员数量Employees
      //成立时间YearEstablished
      //雇员数量Employees
      //xstring sYearEstablished = dw_detail.GetItemString(1,L"YearEstablished");
      //xstring sEmployees = dw_detail.GetItemString(1,L"Employees");
      //sYearEstablished.toInt();
         
      
      //联系人姓名Name-PCName,设置状态
      //联系人姓名Name-PCName,设置状态
      xdwtable dw_PartyContact;
      dw_PartyContact = dw_detail.FindDwTable(L"PartyContact");
      xdwtable PC_OtherInfo;
@@ -571,7 +571,7 @@
               xstring sAll = sPCTitle + sPCJobTitle + sPCGender + sPCMobile + sPCTEL + sPCEmail;
               /*if (sAll != L"")
               {
                  alert(L"联系人姓名不能为空");
                  alert(L"联系人姓名不能为空");
                  return 0;
               }*/
            }
@@ -606,7 +606,7 @@
         }                           
      }
      //银行帐号BankName-BankName;BankAccountNo-PBABankAccountNo ; 设置状态
      //银行帐号BankName-BankName;BankAccountNo-PBABankAccountNo ; 设置状态
      xdwtable dw_PartyBankAccount;
      dw_PartyBankAccount =dw_detail.FindDwTable(L"PartyBankAccount");
      if (dw_PartyBankAccount)
@@ -623,12 +623,12 @@
            {
               /*if (sPBABankName == L"")
               {
                  alert(L"银行名称不能为空");
                  alert(L"银行名称不能为空");
                  return 0;
               }
               if (sPBABankAccountNo == L"")
               {
                  alert(L"银行账户不能为空");
                  alert(L"银行账户不能为空");
                  return 0;
               }*/
               dw_PartyBankAccount.SetItemString(j,L"Status",L"1");
@@ -636,7 +636,7 @@
         }
      }
   
      //地址,设置状态
      //地址,设置状态
      xdwtable dw_PartyAddress;
      dw_PartyAddress =dw_detail.FindDwTable(L"PartyAddress");
      if (dw_PartyAddress)
@@ -667,7 +667,7 @@
      return 1;
   }
            
   int CustomerModify()//跳到客户修改界面
   int CustomerModify()//跳到客户修改界面
   {
      //trace(L"asdsad");
      xaserverarg& arg = *new xaserverarg;
@@ -692,7 +692,7 @@
      if(row < 1) return 0;
      xstring PartyID = dw_detail.GetItemString(row,L"PartyID");
      arg.AddArg(L"EntityID",PartyID);
      arg.AddArg(L"EntityName", L"客户共享");
      arg.AddArg(L"EntityName", L"客户共享");
      OpenWindow(L"dev:xpage[UserGroupShare.vx]", (LPARAM) & arg);
      return 1;
   }
@@ -776,7 +776,7 @@
      
      return 1;
   }
   //选择tab页面
   //选择tab页面
   int OnSelectedSheet(TEvent* evt,int p)
   {
      iLayer = m_layer.GetSheetIndex();
@@ -796,11 +796,11 @@
            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"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);
            int nIndex = xsheet.InsertSheet(-1, L"客户ID货号库", xp, (void *) &arg);
            xsheet.SelectSheet(nIndex);                        
         }
         //win32::SendMessage(CustomerGoodsHWND.toInt(),0x401, L"SetFocus", nil);    
@@ -811,7 +811,7 @@
         
   int OnSourceRemark()
   {
      xstring name = L"客户管理";
      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);
@@ -858,31 +858,31 @@
      //alert(value);
      xaserverarg& arg=* new xaserverarg;
                  
      if(value == L"主要联系人其它信息")
      if(value == L"主要联系人其它信息")
      {               
         dw_detail.ExpandCellRow(start +m +5,start +m+7);
      }
      else if(value == L"其它地址")
      else if(value == L"其它地址")
      {   
         dw_detail.ExpandCellRow(start +m+9,start +m+9+n);
         //dw_base.ExpandMarginRow(-22,-20);
      }
      else if(value == L"银行信息")
      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"业务概述")
      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"客户授信")
      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(value == L"客户资料附件")
      {   
         
         if(userno == L"admin" || userno == L"00601" || userno == L"00701")
@@ -894,7 +894,7 @@
            return 1;
         }
      }
      if(value == L"客户基本信息")
      if(value == L"客户基本信息")
      {   
         xaserverarg& arg1 = *new xaserverarg;   
         xstring str = dw_detail.GetItemString(1,L"BasicInformation");
@@ -925,11 +925,11 @@
      xaserverarg& arg=*new xaserverarg;
      arg.setNativePointer(arg.CreateInstance());               
      
      if(value == L"上传")
      if(value == L"上传")
      {
         if(dw.GetGuid(dw.GetRow())==L"")
         {
            alert(L"保存后在上传!");
            alert(L"保存后在上传!");
            return 1;
         }
         
@@ -954,11 +954,11 @@
      xaserverarg& arg=*new xaserverarg;
                  
      
      if(value == L"附件上传")
      if(value == L"附件上传")
      {
         if(dw.GetGuid(dw.GetRow())==L"")
         {
            alert(L"保存后在上传!");
            alert(L"保存后在上传!");
            return 1;
         }
         
@@ -968,7 +968,7 @@
         return 1;
      }
         
      if(value == L"人员")
      if(value == L"人员")
      {
         xaserverarg& arg2 =* new xaserverarg;
            
@@ -1023,11 +1023,11 @@
      xaserverarg& arg=*new xaserverarg;
                  
      
      if(value == L"附件上传")
      if(value == L"附件上传")
      {
         if(dw.GetGuid(dw.GetRow())==L"")
         {
            alert(L"保存后在上传!");
            alert(L"保存后在上传!");
            return 1;
         }
         
@@ -1037,7 +1037,7 @@
         return 1;
      }
         
      if(value == L"人员")
      if(value == L"人员")
      {
         xaserverarg& arg2 = *new xaserverarg;
         
@@ -1107,21 +1107,21 @@
      dw_visit = GetControl(L"dw_visit");
      dw_Meetings = GetControl(L"dw_Meetings");
      dw_MeetingsEx = GetControl(L"dw_MeetingsEx");
      //添加客户产品附页
      //添加客户产品附页
      xsheet = GetControl(L"tab_1");
      //xstring xp = L"<xframe src='dev:xpage[CustomerGoodsVd.vx]' />";
      /*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"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);
      //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;
@@ -1139,7 +1139,7 @@
      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);
@@ -1205,11 +1205,11 @@
            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"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);
            int nIndex = xsheet.InsertSheet(-1, L"客户ID货号库", xp, (void*)&arg);
            xsheet.SelectSheet(nIndex);
            //xsheet.SetSheetState(0, 0);         
         }
@@ -1219,7 +1219,7 @@
         
         if(userno !=L"00601" && userno !=L"admin" && userno !=L"00701")
         {
            if(ApplyStatus ==L"财务已审核")
            if(ApplyStatus ==L"财务已审核")
            {
               dw_detail.SetReadOnly(true);   
            }