-- 作者:悦颜
-- 发布时间:2015/3/25 21:03:00
-- 请教老师,为什么有些列统计不了?
Dim T As Integer = Date.Today.year Dim m As Integer = Date.Today.Month Dim dt5 As New Date(T, m, 1) Dim dt6 As New Date(T, m, Date.DaysInMonth(T, m)) \'获取本月的最后一天 Dim dr As DataRow = e.DataRow Dim dt As DataTable = DataTables("应收明细") Dim ot As DataTable = DataTables("出口明细")
If e.DataCol. Name ="销售" Then dr("内销收入")=dt.compute("sum(金额)","[开票人]= \'" & dr("销售") & "\'and 时间标 >= #" & dt5 & "# And 时间标 <= #" & dt6 & "#") dr("内销毛利")=dt.compute("sum(利1)","[开票人]= \'" & dr("销售") & "\'and 时间标 >= #" & dt5 & "# And 时间标 <= #" & dt6 & "#") dr("内销成本")=dt.compute("sum(成本合计)","[开票人]= \'" & dr("销售") & "\'and 时间标 >= #" & dt5 & "# And 时间标 <= #" & dt6 & "#") dr("内销运费")=dt.compute("sum(国内运费)","[开票人]= \'" & dr("销售") & "\'and 时间标 >= #" & dt5 & "# And 时间标 <= #" & dt6 & "#") dr("外销收入USD")=ot.compute("sum(USD金额)","[销售]= \'" & dr("销售") & "\'and 出口日期 >= #" & dt5 & "# And 出口日期 <= #" & dt6 & "#") dr("外销收入RMB")=ot.compute("sum(FOB合计CNY)","[销售]= \'" & dr("销售") & "\'and 出口日期 >= #" & dt5 & "# And 出口日期 <= #" & dt6 & "#") dr("外销成本")=ot.compute("sum(成本)","[销售]= \'" & dr("销售") & "\'and 出口日期 >= #" & dt5 & "# And 出口日期 <= #" & dt6 & "#") dr("外销运费")=ot.compute("sum(运费+保险费)","[销售]= \'" & dr("销售") & "\'and 出口日期 >= #" & dt5 & "# And 出口日期 <= #" & dt6 & "#") dr("外销毛利")=ot.compute("sum(利)","[销售]= \'" & dr("销售") & "\'and 出口日期 >= #" & dt5 & "# And 出口日期 <= #" & dt6 & "#") dr("当月销售收入")=dr("内销收入")+dr("外销收入RMB") dr("当销售成本")=dr("内销成本")+dr("外销成本") dr("当销售毛利")=dr("内销毛利")+dr("外销毛利") dr("当月运费")=dr("内销运费")+dr("外销运费") dr("内销平均毛利率")=dr("内销毛利")/dr("内销收入") dr("外销平均毛利率")=dr("外销毛利")/dr("外销收入RMB") End If
[此贴子已经被作者于2015/3/25 21:20:42编辑过]
|