VB音像信息管理系统 第7页

VB音像信息管理系统 第7页
  End If
     tb.MoveNext
   Next i
Set db = OpenDatabase(App.Path + "\shujuzunku.mdb", False, False, "")
Set tb = db.OpenRecordset("chushou", dbOpenDynaset)
  tb.AddNew
  tb.Fields("bianhao") = Trim(Text1.Text)
  tb.Fields("mingcheng") = Label11.Caption
  If Text2.Text = "" Then Text2.Text = 0
  tb.Fields("shuliang") = Text2.Text
  tb.Fields("danjia") = Text3.Text
  tb.Fields("chushouriqi") = Label10.Caption
  tb.Fields("jingbanren") = Label9.Caption
  tb.Fields("beizhu") = Text5.Text
  tb.Update
  MsgBox ("商品:" + Label11.Caption + "已经出售成功!对方付现金:" + Text4.Text + ",合计:" + Str(Val(Text2.Text) * Val(Text3.Text)) + ",找零:" + Str(Val(Text4.Text) - Val(Text2.Text) * Val(Text3.Text)))
 Set db = OpenDatabase(App.Path + "\shujuzunku.mdb", False, False, "")
 Set tb = db.OpenRecordset("yejicha", dbOpenDynaset)
 tb.MoveFirst
 tb.Edit
 tb.Fields("kucongshu") = Str(Val(tb.Fields("kucongshu")) - Val(Text2.Text))
 tb.Fields("kongcongjia") = Str(Val(tb.Fields("kongcongjia")) - (Val(Text2.Text) * Val(Text3.Text)))
 tb.Fields("chushoushu") = Str(Val(tb.Fields("chushoushu")) + Val(Text2.Text))
 tb.Fields("chushoujia") = Str(Val(tb.Fields("chushoujia")) + (Val(Text2.Text) * Val(Text3.Text)))
 tb.Update
 Set db = OpenDatabase(App.Path + "\shujuzunku.mdb", False, False, "")
Set tb = db.OpenRecordset("shujukbb", dbOpenDynaset)
   tb.MoveLast
   tb.MoveFirst
   For i = 0 To tb.RecordCount - 1
     If Text1.Text = tb.Fields("bianhao") Then
       tb.Edit
       tb.Fields("shuliang") = Str(Val(tb.Fields("shuliang")) - Val(Text2.Text))
       tb.Update
       Exit For
     End If
     tb.MoveNext
   Next i
tttt:
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Label11.Caption = ""
Text5.Text = ""
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Label9.Caption = yunhu
qq = Date
 If Mid$(qq, 3, 1) = "-" Then
 qq = "20" + qq
 End If
Label10.Caption = qq
chshouform.Left = 70
chshouform.Top = 1800
chshouform.Width = 11800
chshouform.Height = 5000
End Sub
Private Sub Text1_LostFocus()
Set db = OpenDatabase(App.Path + "\shujuzunku.mdb", False, False, "")
Set tb = db.OpenRecordset("shujukbb", dbOpenDynaset)
  If tb.RecordCount > 0 Then
    tb.MoveLast
    tb.MoveFirst
    For i = 0 To tb.RecordCount - 1
      If Text1.Text = tb.Fields("bianhao") Then
       Label11.Caption = tb.Fields("mingcheng")
       Text3.Text = tb.Fields("danjia")
       GoTo mmmm
      End If
      tb.MoveNext
    Next i
    If i = tb.RecordCount Then
    kai = MsgBox("此库中无此记录,请检查输入是否正确?", vbOKCancel + vbQuestion, "错误提示")
    If kai = 1 Then
    Text1.Text = ""
    Text1.SetFocus
    Else
    GoTo mmmm
    End If
    End If
  Else
  MsgBox ("你还没有做商品入库录入处理!")
  End If
mmmm:
End Sub
Private Sub Text2_LostFocus()
Set db = OpenDatabase(App.Path + "\shujuzunku.mdb", False, False, "")
   Set tb = db.OpenRecordset("shujukbb", dbOpenDynaset)
  If tb.RecordCount > 0 Then
    tb.MoveLast
    tb.MoveFirst
    For i = 0 To tb.RecordCount - 1
      If Text1.Text = tb.Fields("bianhao") Then
       If Val(Text2.Text) > Val(tb.Fields("shuliang")) Then
       MsgBox ("目前库只有:(" + Str(tb.Fields("shuliang")) + "),无法出售。请重新输入数量。")
       Text2.Text = ""
       Text2.SetFocus
       End If
      GoTo xxxx
      End If
      tb.MoveNext
    Next i
  End If
xxxx:
End Sub

上一页  [1] [2] [3] [4] [5] [6] [7] 

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有