Foxtable(狐表)用户栏目专家坐堂 → 求个复杂点的代码


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

主题:求个复杂点的代码

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


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

这个应该比较完美了,不过也心淡,罢了
'''
If e.DataCol.Name = "付款单位"  Then
     Dim T As String
     Dim mny,sum,sm As Double
     Dim Da As DataTable = DataTables("总表")    
     if e.DataRow("金额") <=0 then
          MessageBox.Show("请输入金额!", "提示")
     Else   
         T = "[发货单位] = '" & e.NewValue & "' and [运费结算_结清] = False"       
         if Da.Find(T) isNot nothing then
               sum = Da.Compute("Sum(运费结算_已收)",T)
               sm= Da.Compute("Sum(运费结算_应收费)",T)
               mny = e.DataRow("金额") +sum
               if mny > sm then
                    MessageBox.Show("金额超出应付款项:" & (mny-sm) &"!", "提示")
               end if
               for each dr As DataRow in Da.select(T)
                    if mny <=0 then
                       exit for                 
                    else
                        if  mny >= dr("运费结算_应收费")                                   
                            dr("运费结算_已收") = dr("运费结算_应收费")
                            dr("运费结算_结清") = True                      
                        else
                            dr("运费结算_已收") = mny
                        end if
                        mny =mny- dr("运费结算_应收费")
                   end if 
               next           
         end if
     end if
end if
[此贴子已经被作者于2008-12-20 22:53:49编辑过]

 回到顶部