Foxtable(狐表)用户栏目专家坐堂 → [求助]谁能帮忙设计一个计算库存的表达式,或者代码?(重发)


  共有12194人关注过本帖树形打印复制链接

主题:[求助]谁能帮忙设计一个计算库存的表达式,或者代码?(重发)

帅哥哟,离线,有人找我吗?
don
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1812 积分:12999 威望:0 精华:14 注册:2008/10/11 18:07:00
  发帖心情 Post By:2011/10/11 18:47:00 [显示全部帖子]

chanpin:
Select Case e.DataCol.Name
    Case "shuliang"
        Dim fl as string = "chanpinid = " & e.DataRow("_Identify")
        Dim n1,n2 As Double     
        n1 = DataTables("chuhuo").Compute("sum(shuliang)",fl)
        n2 = DataTables("zhidai").Compute("sum(shuliang)",fl & " and ruku = True")
       e.DataRow("库存数量")=dr("shuliang")- n1+n2      
End Select

chuhuo:
Select Case e.DataCol.Name
    Case "shuliang"
        Dim n1,n2 As Double  
        Dim fl as string = "chanpinid = " & e.DataRow("chanpinid")        
        n1 = DataTables("chuhuo").Compute("sum(shuliang)",fl)
        n2 = DataTables("zhidai").Compute("sum(shuliang)",fl & " and ruku = True")
        Dim dr As DataRow = e.DataRow.GetParentrow("chanpin")
         if dr isnot nothing then
             dr("库存数量")=dr("shuliang")- n1+n2
         end if      
End Select


ZHIDAI:
Select Case e.DataCol.Name
    Case "shuliang","ruku"
        Dim n1,n2 As Double  
        Dim fl As String = "chanpinid = " & e.DataRow("chanpinid")        
        n1 = DataTables("chuhuo").Compute("sum(shuliang)",fl)
        n2= DataTables("zhidai").Compute("sum(shuliang)",fl & " and ruku = True")
       Dim dr As DataRow = e.DataRow.GetParentrow("chanpin")
         If dr IsNot Nothing Then
             dr("库存数量")=dr("shuliang")- n1+n2
         End If      
End Select

 回到顶部
帅哥哟,离线,有人找我吗?
don
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1812 积分:12999 威望:0 精华:14 注册:2008/10/11 18:07:00
  发帖心情 Post By:2011/10/12 17:29:00 [显示全部帖子]

表达式法:
chanpin:
IsNull([shuliang],0) - isnull(Sum(Child(产品联出货).shuliang),0)+isnull(Sum(Child(产品联制袋).数量),0)

ZHIDAI增数量列,表达式为:
IIF([ruku] =  True,[shuliang],0)

 回到顶部