员工统计表只有datacolchanged事件
If e.DataCol.Name = "员工编号" Then '发生变化的是人员编号吗?
Dim dr As DataRow
dr = DataTables("员工档案").Find("员工编号 = '" & e.DataRow("员工编号") & "'" )
If dr IsNot Nothing '如果找到, 则设置各列内容
e.DataRow("姓名")= dr("姓名")
End If
End If
If e.DataCol.Name = "员工编号" Then '发生变化的是产品列.
Dim Today As Date = Date.Today
Dim year As Integer = Today.Year
'则累计订单表中同名产品总的销售量,然后赋值给变动行的数量列
e.DataRow("借款金额") = DataTables("员工借款").Compute("Sum(借款金额)","[员工编号] = '" & e.NewValue & "' And [借款年度] = " & year & "")
e.DataRow("报销金额") = DataTables("报销垫款").Compute("Sum(报销金额)","[员工编号] = '" & e.NewValue & "' And [报销年度] = " & year & "")
e.DataRow("借款余额") = e.DataRow("借款金额") - e.DataRow("报销金额")
e.DataRow("销售线索") = DataTables("项目信息").Compute("Sum(线索折算量)","[销售负责人] = '" & e.DataRow("姓名") & "' And [线索年度] = " & year & "")
e.DataRow("项目规模") = DataTables("项目信息").Compute("Sum(项目规模)","[销售负责人] = '" & e.DataRow("姓名") & "' And [项目年度] = " & year & "")
e.DataRow("项目数量") = DataTables("项目信息").Compute("Count(项目编号)","[销售负责人] = '" & e.DataRow("姓名") & "' And [项目年度] = " & year & "")
e.DataRow("销售漏斗") = DataTables("项目信息").Compute("Sum(名义销售漏斗值)","[销售负责人] = '" & e.DataRow("姓名") & "' And [项目年度] = " & year & "")
e.DataRow("A级项目规模") = DataTables("项目信息").Compute("Sum(项目规模)","[销售负责人] = '" & e.DataRow("姓名") & "' And [项目年度] = " & year & " And [项目等级] = 'A级'")
e.DataRow("A级项目数量") = DataTables("项目信息").Compute("Count(项目编号)","[销售负责人] = '" & e.DataRow("姓名") & "' And [项目年度] = " & year & " And [项目等级] = 'A级'")
e.DataRow("已签约额") = DataTables("合同台账").Compute("Sum(名义结算金额)","[销售负责人] = '" & e.DataRow("姓名") & "' And [合同年度] = " & year & "")
e.DataRow("已回款额") = DataTables("合同台账").Compute("Sum(已回款金额)","[销售负责人] = '" & e.DataRow("姓名") & "' And [合同年度] = " & year & "")
e.DataRow("应收金额") = DataTables("合同台账").Compute("Sum(欠款金额)","[销售负责人] = '" & e.DataRow("姓名") & "' And [合同年度] = " & year & "")
e.DataRow("已开fa piao额") = DataTables("合同台账").Compute("Sum(已开piao金额)","[销售负责人] = '" & e.DataRow("姓名") & "' And [合同年度] = " & year & "")
End If