从总表的报废总数里面减除报废申请表里面的报废数的规则

Sub Initialize
On Error Goto errormsg
        dim sql1 as string
        dim sql2 as string
        dim sql3 as string
        dim sql4 as string
        
        dim Total1 as string
        dim fldLst as new lcfieldList
        dim fldLst2 as new lcfieldList
        dim doc as notesdocument
         msgbox "我进来了"
         call rdb.Connect()


         sql1="select * from S010_Scrapped"
                  
        
         msgbox "sql="+sql1       
         call WF_Con.execute(sql1,fldLst) '对数据到数据集fldLst中去   
            if WF_Con.fetch(fldLst)>0 then  
                   msgbox "11111111111"
           MoldCategory= fldLst.lookup("MoldCategories").text(0)
               msgbox "MoldCategory="+MoldCategory
          DepotCategoryName= fldLst.lookup("DepotCategoryName").text(0)
                 msgbox"sss"+DepotCategoryName
         Quantity= fldLst.lookup("Quantity").text(0)
                 msgbox "Quantity="+ Quantity
          end if  
     sql2="select * from S010_MoldManagement2 where MoldCategories='"+MoldCategory+"' and DepotCategoryName='"+DepotCategoryName+"'"  
          msgbox "sql2="+sql2
          call WF_Con.execute(sql2,fldLst2) '对数据到数据集fldLst2中去
          if WF_Con.fetch(fldLst2)>0 then 
             Total1 = fldLst2.lookup("Total").text(0)
                 msgbox "Total="+Total1  
        end if 
             Total1=Clng(Total1)-Clng(Quantity)
                 msgbox "Total"+Total1
                 dim updfldlst as new lcfieldlist 


          sql3="update S010_MoldManagement2 set Total='"+Cstr(Total1)+"' where MoldCategories='"+MoldCategory+"' and DepotCategoryName='"+DepotCategoryName+"'" 
          msgbox "sql3="+sql3
         call WF_Con.execute(sql3,updfldlst)
                      
                   
       msgbox "插入成功"          
Exit Sub
errormsg:
Msgbox "Rule Error:" & Str(Erl) & "  " & Error
End Sub
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值