⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sprk.frm

📁 关于图书销售管理
💻 FRM
📖 第 1 页 / 共 3 页
字号:
Public dj, c As Integer
Public xgorbc As Boolean
Public bc As Boolean
Private Sub Combo1_Change()
'data1.Recordset.FindFirst
End Sub

Private Sub Combo1_Click()

Data1.Recordset.FindFirst "spbh = " & "'" & Combo1.Text & "'"
Text9.Text = Data1.Recordset("spmc")
Text3.Text = Data1.Recordset("dw")
Text10.Text = Data1.Recordset("ghs")
End Sub

Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
   Data1.Recordset.FindFirst "spbh = " & "'" & Combo1.Text & "'"
   If Data1.Recordset.NoMatch = True Then
      MsgBox "商品信息中没有此商品编号。", vbInformation, "提示"
      Exit Sub
   End If
      
   Text9.Text = Data1.Recordset("spmc")
   Text3.Text = Data1.Recordset("dw")
   Text10.Text = Data1.Recordset("ghs")
End If
End Sub

Private Sub Command1_Click()
 If bc = False Then
        MsgBox "请先将当前记录保存。", vbCritical, "警告"
        Exit Sub
  End If
  Data2.Recordset.MoveLast
  If (Val(Data2.Recordset("kmbh")) + 1) < 9 Then Text1.Text = "000000000" & (Val(Data2.Recordset("kmbh")) + 1)
  If (Val(Data2.Recordset("kmbh")) + 1) > 9 And (Val(Data2.Recordset("kmbh")) + 1) < 100 Then
             Text1.Text = "00000000" & (Val(Data2.Recordset("kmbh")) + 1)
 End If
 If (Val(Data2.Recordset("kmbh")) + 1) > 99 And (Val(Data2.Recordset("kmbh")) + 1) < 1000 Then
             Text1.Text = "0000000" + (Val(Data2.Recordset("kmbh")) + 1)
 End If
  If (Val(Data2.Recordset("kmbh")) + 1) > 999 And (Val(Data2.Recordset("kmbh")) + 1) < 10000 Then
             Text1.Text = "000000" & (Val(Data2.Recordset("kmbh")) + 1)
 End If
  If (Val(Data2.Recordset("kmbh")) + 1) > 9999 And (Val(Data2.Recordset("kmbh")) + 1) < 100000 Then
             Text1.Text = "00000" & (Val(Data2.Recordset("kmbh")) + 1)
 End If
  If (Val(Data2.Recordset("kmbh")) + 1) > 99999 And (Val(Data2.Recordset("kmbh")) + 1) < 1000000 Then
  
             Text1.Text = "0000" & (Val(Data2.Recordset("kmbh")) + 1)
 End If
  If (Val(Data2.Recordset("kmbh")) + 1) > 999999 And (Val(Data2.Recordset("kmbh")) + 1) < 10000000 Then
             Text1.Text = "000" & (Val(Data2.Recordset("kmbh")) + 1)
 End If
  If (Val(Data2.Recordset("kmbh")) + 1) > 9999999 And (Val(Data2.Recordset("kmbh")) + 1) < 100000000 Then
             Text1.Text = "00" & (Val(Data2.Recordset("kmbh")) + 1)
 End If
  If (Val(Data2.Recordset("kmbh")) + 1) > 99999999 And (Val(Data2.Recordset("kmbh")) + 1) < 1000000000 Then
             Text1.Text = "0" & (Val(Data2.Recordset("kmbh")) + 1)
 End If
  If (Val(Data2.Recordset("kmbh")) + 1) > 999999999 And (Val(Data2.Recordset("kmbh")) + 1) < 10000000000# Then
             Text1.Text = Val(Data2.Recordset("kmbh")) + 1
 End If
Combo1.Text = "选择商品"
Text2.Text = ""
Text9.Text = ""
Text3.Text = ""
Text10.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text8.Text = ""
Text7.Text = ""
'Text11.Text = ""
bc = False
End Sub

Private Sub Command2_Click()
If dj = 1 Then
        Data2.Recordset.FindFirst "kmbh = " & "'" & MSFlexGrid.TextMatrix(c, 1) & "'"
        Text1.Text = Data2.Recordset("kmbh")
        Combo1.Text = Data2.Recordset("spbh")
        Text4.Text = Data2.Recordset("jhdj")
        Text2.Text = Data2.Recordset("sl")
        Text5.Text = Data2.Recordset("je")
       On Error Resume Next
        Text7.Text = Data2.Recordset("gg")
        Text6.Text = Data2.Recordset("kw")
        Text8.Text = Data2.Recordset("bz")
        DTPicker1.Value = Data2.Recordset("rkrq")
        Data1.Recordset.FindFirst "spbh = " & "'" & MSFlexGrid.TextMatrix(c, 3) & "'"
        Text9.Text = Data1.Recordset("spmc")
         Text3.Text = Data1.Recordset("dw")
         Text10.Text = Data1.Recordset("ghs")
      
          dj = 0
         xgorbc = True
     Else
         MsgBox "请先选择好要修改的对象。", vbInformation, "提示"
         Exit Sub
     End If
End Sub

Private Sub Command3_Click()
If Text4.Text = "0" Then
    MsgBox "单价不可能为 0 。", vbCritical, "警告"
    Text4.SetFocus
    Exit Sub
End If

If Text6.Text = "" Then
    MsgBox "库位不能为空.", vbCritical, "警告"
    Text6.SetFocus
    Exit Sub
End If

If Text7.Text = "" Then
    MsgBox "  规格不能为空" & vbCrLf & vbCrLf & "若没有规格请填'无' .", vbCritical, "警告"
   Text7.Text = "无"
    Text7.SetFocus
    Exit Sub
End If

If Len(Text8.Text) > 50 Then
    MsgBox "备注不要多于25个字", vbCritical, "警告"
    Text8.SetFocus
    Exit Sub
End If
If xgorbc = False Then
         Data2.Recordset.AddNew
     Else
          Data2.Recordset.Edit
 End If
Data2.Recordset("kmbh") = Trim(Text1.Text)
Data2.Recordset("spbh") = Trim(Combo1.Text)
Data2.Recordset("jsren") = Label13.Caption
Data2.Recordset("jhdj") = Trim(Text4.Text)
Data2.Recordset("sl") = Trim(Text2.Text)
Data2.Recordset("je") = Trim(Text5.Text)
Data2.Recordset("gg") = Trim(Text7.Text)
Data2.Recordset("kw") = Trim(Text6.Text)
Data2.Recordset("bz") = Trim(Text8.Text)
Data2.Recordset("rkrq") = DTPicker1.Value
Data2.Recordset.Update

Data2.Refresh
Call Form_Activate
'将商品添加到仓库
 Data4.RecordSource = "select * from kczk where spbh = '" & Combo1.Text & "'  and   gg = '" & Text7.Text & "'  "
 Data4.Refresh
' Data4.Recordset.MoveLast
 'aa = Data4.Recordset.RecordCount
 If Data4.Recordset.EOF = True Then
      'Data4.RecordSource = "select * from kczk "
      Data4.Recordset.AddNew
     ' Data4.Recordset("bh") = Trim(Text1.Text)
      Data4.Recordset("spbh") = Trim(Combo1.Text)
      'Data4.Recordset("jhdj") = Trim(Text4.Text)
      Data4.Recordset("kcsl") = Trim(Text2.Text)
      Data4.Recordset("kw") = Trim(Text6.Text)
      Data4.Recordset("bz") = Trim(Text8.Text)
      
     ' Data4.Recordset("rkrq") = DTPicker1.Value
        Data4.Recordset.Update
        Data4.Refresh
     Else
         Data4.Recordset.Edit
         Data4.Recordset("kcsl") = Data4.Recordset("kcsl") + Val(Text2.Text)
         Data4.Recordset.Update
         Data4.Refresh
     End If
'Unload Me
'zyxx.Show
bc = True
xgorbc = False
End Sub

Private Sub Command4_Click()
Unload Me
End Sub

Private Sub Command5_Click()
   Data4.RecordSource = "select * from kczk where spbh = '" & Combo1.Text & "'  and   gg = '" & Text7.Text & "'  "
 Data4.Refresh

   'Data2.Recordset("zk") = 90
End Sub

Private Sub Form_Activate()
'Data2.Recordset.Update
Dim incount As Integer
Dim jj, ll, je As Variant
Data2.Recordset.MoveLast
incount = Data2.Recordset.RecordCount
Data2.Recordset.MoveFirst
   'Data2.Recordset.Edit
For i = 1 To incount
     jj = Data2.Recordset("jhdj")
     ll = Data2.Recordset("sl")
     je = Data2.Recordset("je")
     Data2.Recordset.Edit
     sprk.Data2.Recordset("zk") = jj * ll - je
       Data2.Recordset.Update
     Data2.Recordset.MoveNext
   
Next
 ' Data2.Recordset.Update
    Data2.Refresh
  ' 自动生成科目编号
  Data2.Recordset.MoveFirst
  Data2.Recordset.MoveLast
  If (Val(Data2.Recordset("kmbh")) + 1) <= 9 Then Text1.Text = "000000000" & (Val(Data2.Recordset("kmbh")) + 1)
  If (Val(Data2.Recordset("kmbh")) + 1) > 9 And (Val(Data2.Recordset("kmbh")) + 1) < 100 Then
             Text1.Text = "00000000" & (Val(Data2.Recordset("kmbh")) + 1)
 End If
 If (Val(Data2.Recordset("kmbh")) + 1) > 99 And (Val(Data2.Recordset("kmbh")) + 1) < 1000 Then
             Text1.Text = "0000000" + (Val(Data2.Recordset("kmbh")) + 1)
 End If
  If (Val(Data2.Recordset("kmbh")) + 1) > 999 And (Val(Data2.Recordset("kmbh")) + 1) < 10000 Then
             Text1.Text = "000000" & (Val(Data2.Recordset("kmbh")) + 1)
 End If
  If (Val(Data2.Recordset("kmbh")) + 1) > 9999 And (Val(Data2.Recordset("kmbh")) + 1) < 100000 Then
             Text1.Text = "00000" & (Val(Data2.Recordset("kmbh")) + 1)
 End If
  If (Val(Data2.Recordset("kmbh")) + 1) > 99999 And (Val(Data2.Recordset("kmbh")) + 1) < 1000000 Then
  
             Text1.Text = "0000" & (Val(Data2.Recordset("kmbh")) + 1)
 End If
  If (Val(Data2.Recordset("kmbh")) + 1) > 999999 And (Val(Data2.Recordset("kmbh")) + 1) < 10000000 Then
             Text1.Text = "000" & (Val(Data2.Recordset("kmbh")) + 1)
 End If
  If (Val(Data2.Recordset("kmbh")) + 1) > 9999999 And (Val(Data2.Recordset("kmbh")) + 1) < 100000000 Then
             Text1.Text = "00" & (Val(Data2.Recordset("kmbh")) + 1)
 End If
  If (Val(Data2.Recordset("kmbh")) + 1) > 99999999 And (Val(Data2.Recordset("kmbh")) + 1) < 1000000000 Then
             Text1.Text = "0" & (Val(Data2.Recordset("kmbh")) + 1)
 End If
  If (Val(Data2.Recordset("kmbh")) + 1) > 999999999 And (Val(Data2.Recordset("kmbh")) + 1) < 10000000000# Then
             Text1.Text = Val(Data2.Recordset("kmbh")) + 1
 End If
'载入商品编号
 Data1.Recordset.MoveLast
 spbhcount = Data1.Recordset.RecordCount
 Data1.Recordset.MoveFirst
 For j = 1 To spbhcount
     Combo1.AddItem Data1.Recordset("spbh")
     Data1.Recordset.MoveNext
 Next
Data1.Recordset.MoveFirst
'载入经手人
 Data3.Recordset.MoveLast
 zycount = Data3.Recordset.RecordCount
 Data3.Recordset.MoveFirst
 Data3.Recordset.MoveNext
Data3.Recordset.MoveFirst

MSFlexGrid.ColWidth(0) = 200
MSFlexGrid.ColWidth(1) = 1500
MSFlexGrid.ColWidth(2) = 1200
MSFlexGrid.ColWidth(3) = 1300
MSFlexGrid.ColWidth(7) = 1500
MSFlexGrid.TextMatrix(0, 1) = "  科目编号"
MSFlexGrid.TextMatrix(0, 2) = "  经手人"
MSFlexGrid.TextMatrix(0, 3) = "  商品编号"
MSFlexGrid.TextMatrix(0, 4) = "入库日期"
MSFlexGrid.TextMatrix(0, 5) = "  规格"
MSFlexGrid.TextMatrix(0, 6) = "进货单价"
MSFlexGrid.TextMatrix(0, 7) = "数量  "
MSFlexGrid.TextMatrix(0, 8) = "金额    "
MSFlexGrid.TextMatrix(0, 9) = "折扣  "
MSFlexGrid.TextMatrix(0, 10) = "  库位"
MSFlexGrid.TextMatrix(0, 11) = "备注  "
xgorbc = False
End Sub

Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\db1.mdb"
Data1.RecordSource = "select * from spxx"
Data2.DatabaseName = App.Path & "\db1.mdb"
Data2.RecordSource = "select * from spzjrk"
Data3.DatabaseName = App.Path & "\db1.mdb"
Data3.RecordSource = "select * from zyzl"
Data4.DatabaseName = App.Path & "\db1.mdb"
Data4.RecordSource = "select * from kczk"
DTPicker1.Value = Date
Text9.Enabled = False
Text3.Enabled = False
Text10.Enabled = False
Label13.Enabled = False
Label13.Caption = dlm
End Sub



Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)

End Sub

Private Sub MSFlexGrid_Click()
dj = 1
c = sprk.MSFlexGrid.Row

End Sub

Private Sub Text5_Click()
Text5.Text = Val(Text4.Text) * Val(Text2.Text)

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -